@lateralus-ai/shipping-ui 1.3.2 → 1.3.3
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.
package/dist/index.cjs
CHANGED
|
@@ -38,7 +38,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
38
38
|
`),position:b,pageIndex:w-1,rect:h.slice(0),rotation:d,annotationElementId:p,id:p,deleted:!1,popupRef:g}}const a=await super.deserialize(t,r,n);return T(a,Yn,t.fontSize),T(a,Bi,Qe.makeHexColor(...t.color)),T(a,Xn,L(o=Jt,ca,G0).call(o,t.value)),a._initialData=s,a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const r=Jt._internalPadding*this.parentScale,n=this.getRect(r,r),s=tr._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:u(this,Bi)),a={annotationType:ot.FREETEXT,color:s,fontSize:u(this,Yn),value:L(this,Pr,Cw).call(this),pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(a.isCopy=!0,a):this.annotationElementId&&!L(this,Pr,Sw).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){const r=super.renderAnnotationElement(t);if(this.deleted)return r;const{style:n}=r;n.fontSize=`calc(${u(this,Yn)}px * var(--total-scale-factor))`,n.color=u(this,Bi),r.replaceChildren();for(const a of u(this,Xn).split(`
|
|
39
39
|
`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),r.append(o)}const s=Jt._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:u(this,Xn)}),r}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};Bi=new WeakMap,Xn=new WeakMap,sf=new WeakMap,ml=new WeakMap,Yn=new WeakMap,Pr=new WeakSet,Aw=function(t){const r=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-u(this,Yn))*this.parentScale),T(this,Yn,s),L(this,Pr,Pp).call(this)},n=u(this,Yn);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Ew=function(t){const r=s=>{T(this,Bi,this.editorDiv.style.color=s)},n=u(this,Bi);this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},_w=function(){var n;const t=[];this.editorDiv.normalize();let r=null;for(const s of this.editorDiv.childNodes)(r==null?void 0:r.nodeType)===Node.TEXT_NODE&&s.nodeName==="BR"||(t.push(L(n=Jt,ca,Rp).call(n,s)),r=s);return t.join(`
|
|
40
40
|
`)},Pp=function(){const[t,r]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:s,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),n=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=n.width/t,this.height=n.height/r):(this.width=n.height/t,this.height=n.width/r),this.fixAndSetPosition()},ca=new WeakSet,Rp=function(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(sp,"")},Ip=function(){if(this.editorDiv.replaceChildren(),!!u(this,Xn))for(const t of u(this,Xn).split(`
|
|
41
|
-
`)){const r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}},Cw=function(){return u(this,Xn).replaceAll(" "," ")},G0=function(t){return t.replaceAll(" "," ")},Sw=function(t){const{value:r,fontSize:n,color:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||t.value!==r||t.fontSize!==n||t.color.some((o,l)=>o!==s[l])||t.pageIndex!==a},N(Jt,ca),Ie(Jt,"_freeTextDefaultContent",""),Ie(Jt,"_internalPadding",0),Ie(Jt,"_defaultColor",null),Ie(Jt,"_defaultFontSize",10),Ie(Jt,"_type","freetext"),Ie(Jt,"_editorType",ot.FREETEXT);let V0=Jt;class qe{toSVGPath(){Wt("Abstract method `toSVGPath` must be implemented.")}get box(){Wt("Abstract getter `box` must be implemented.")}serialize(e,t){Wt("Abstract method `serialize` must be implemented.")}static _rescale(e,t,r,n,s,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o]*n,a[o+1]=r+e[o+1]*s;return a}static _rescaleAndSwap(e,t,r,n,s,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o+1]*n,a[o+1]=r+e[o]*s;return a}static _translate(e,t,r,n){n||(n=new Float32Array(e.length));for(let s=0,a=e.length;s<a;s+=2)n[s]=t+e[s],n[s+1]=r+e[s+1];return n}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,r,n,s){switch(s){case 90:return[1-t/r,e/n];case 180:return[1-e/r,1-t/n];case 270:return[t/r,1-e/n];default:return[e/r,t/n]}}static _normalizePagePoint(e,t,r){switch(r){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,r,n,s,a){return[(e+5*r)/6,(t+5*n)/6,(5*r+s)/6,(5*n+a)/6,(r+s)/2,(n+a)/2]}}Ie(qe,"PRECISION",1e-4);var Zn,zi,ic,sc,hs,xt,bl,vl,af,of,ac,oc,Va,lf,yg,wg,Lr,yh,Tw,kw,Dw,Pw,Rw,Iw;const Rs=class Rs{constructor({x:e,y:t},r,n,s,a,o=0){N(this,Lr);N(this,Zn);N(this,zi,[]);N(this,ic);N(this,sc);N(this,hs,[]);N(this,xt,new Float32Array(18));N(this,bl);N(this,vl);N(this,af);N(this,of);N(this,ac);N(this,oc);N(this,Va,[]);T(this,Zn,r),T(this,oc,s*n),T(this,sc,a),u(this,xt).set([NaN,NaN,NaN,NaN,e,t],6),T(this,ic,o),T(this,of,u(Rs,lf)*n),T(this,af,u(Rs,wg)*n),T(this,ac,n),u(this,Va).push(e,t)}isEmpty(){return isNaN(u(this,xt)[8])}add({x:e,y:t}){var R;T(this,bl,e),T(this,vl,t);const[r,n,s,a]=u(this,Zn);let[o,l,c,h]=u(this,xt).subarray(8,12);const d=e-c,p=t-h,g=Math.hypot(d,p);if(g<u(this,af))return!1;const y=g-u(this,of),b=y/g,w=b*d,v=b*p;let A=o,E=l;o=c,l=h,c+=w,h+=v,(R=u(this,Va))==null||R.push(e,t);const _=-v/y,C=w/y,I=_*u(this,oc),k=C*u(this,oc);return u(this,xt).set(u(this,xt).subarray(2,8),0),u(this,xt).set([c+I,h+k],4),u(this,xt).set(u(this,xt).subarray(14,18),12),u(this,xt).set([c-I,h-k],16),isNaN(u(this,xt)[6])?(u(this,hs).length===0&&(u(this,xt).set([o+I,l+k],2),u(this,hs).push(NaN,NaN,NaN,NaN,(o+I-r)/s,(l+k-n)/a),u(this,xt).set([o-I,l-k],14),u(this,zi).push(NaN,NaN,NaN,NaN,(o-I-r)/s,(l-k-n)/a)),u(this,xt).set([A,E,o,l,c,h],6),!this.isEmpty()):(u(this,xt).set([A,E,o,l,c,h],6),Math.abs(Math.atan2(E-l,A-o)-Math.atan2(v,w))<Math.PI/2?([o,l,c,h]=u(this,xt).subarray(2,6),u(this,hs).push(NaN,NaN,NaN,NaN,((o+c)/2-r)/s,((l+h)/2-n)/a),[o,l,A,E]=u(this,xt).subarray(14,18),u(this,zi).push(NaN,NaN,NaN,NaN,((A+o)/2-r)/s,((E+l)/2-n)/a),!0):([A,E,o,l,c,h]=u(this,xt).subarray(0,6),u(this,hs).push(((A+5*o)/6-r)/s,((E+5*l)/6-n)/a,((5*o+c)/6-r)/s,((5*l+h)/6-n)/a,((o+c)/2-r)/s,((l+h)/2-n)/a),[c,h,o,l,A,E]=u(this,xt).subarray(12,18),u(this,zi).push(((A+5*o)/6-r)/s,((E+5*l)/6-n)/a,((5*o+c)/6-r)/s,((5*l+h)/6-n)/a,((o+c)/2-r)/s,((l+h)/2-n)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const e=u(this,hs),t=u(this,zi);if(isNaN(u(this,xt)[6])&&!this.isEmpty())return L(this,Lr,Tw).call(this);const r=[];r.push(`M${e[4]} ${e[5]}`);for(let n=6;n<e.length;n+=6)isNaN(e[n])?r.push(`L${e[n+4]} ${e[n+5]}`):r.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);L(this,Lr,Dw).call(this,r);for(let n=t.length-6;n>=6;n-=6)isNaN(t[n])?r.push(`L${t[n+4]} ${t[n+5]}`):r.push(`C${t[n]} ${t[n+1]} ${t[n+2]} ${t[n+3]} ${t[n+4]} ${t[n+5]}`);return L(this,Lr,kw).call(this,r),r.join(" ")}newFreeDrawOutline(e,t,r,n,s,a){return new Nw(e,t,r,n,s,a)}getOutlines(){var d;const e=u(this,hs),t=u(this,zi),r=u(this,xt),[n,s,a,o]=u(this,Zn),l=new Float32Array((((d=u(this,Va))==null?void 0:d.length)??0)+2);for(let p=0,g=l.length-2;p<g;p+=2)l[p]=(u(this,Va)[p]-n)/a,l[p+1]=(u(this,Va)[p+1]-s)/o;if(l[l.length-2]=(u(this,bl)-n)/a,l[l.length-1]=(u(this,vl)-s)/o,isNaN(r[6])&&!this.isEmpty())return L(this,Lr,Pw).call(this,l);const c=new Float32Array(u(this,hs).length+24+u(this,zi).length);let h=e.length;for(let p=0;p<h;p+=2){if(isNaN(e[p])){c[p]=c[p+1]=NaN;continue}c[p]=e[p],c[p+1]=e[p+1]}h=L(this,Lr,Iw).call(this,c,h);for(let p=t.length-6;p>=6;p-=6)for(let g=0;g<6;g+=2){if(isNaN(t[p+g])){c[h]=c[h+1]=NaN,h+=2;continue}c[h]=t[p+g],c[h+1]=t[p+g+1],h+=2}return L(this,Lr,Rw).call(this,c,h),this.newFreeDrawOutline(c,l,u(this,Zn),u(this,ac),u(this,ic),u(this,sc))}};Zn=new WeakMap,zi=new WeakMap,ic=new WeakMap,sc=new WeakMap,hs=new WeakMap,xt=new WeakMap,bl=new WeakMap,vl=new WeakMap,af=new WeakMap,of=new WeakMap,ac=new WeakMap,oc=new WeakMap,Va=new WeakMap,lf=new WeakMap,yg=new WeakMap,wg=new WeakMap,Lr=new WeakSet,yh=function(){const e=u(this,xt).subarray(4,6),t=u(this,xt).subarray(16,18),[r,n,s,a]=u(this,Zn);return[(u(this,bl)+(e[0]-t[0])/2-r)/s,(u(this,vl)+(e[1]-t[1])/2-n)/a,(u(this,bl)+(t[0]-e[0])/2-r)/s,(u(this,vl)+(t[1]-e[1])/2-n)/a]},Tw=function(){const[e,t,r,n]=u(this,Zn),[s,a,o,l]=L(this,Lr,yh).call(this);return`M${(u(this,xt)[2]-e)/r} ${(u(this,xt)[3]-t)/n} L${(u(this,xt)[4]-e)/r} ${(u(this,xt)[5]-t)/n} L${s} ${a} L${o} ${l} L${(u(this,xt)[16]-e)/r} ${(u(this,xt)[17]-t)/n} L${(u(this,xt)[14]-e)/r} ${(u(this,xt)[15]-t)/n} Z`},kw=function(e){const t=u(this,zi);e.push(`L${t[4]} ${t[5]} Z`)},Dw=function(e){const[t,r,n,s]=u(this,Zn),a=u(this,xt).subarray(4,6),o=u(this,xt).subarray(16,18),[l,c,h,d]=L(this,Lr,yh).call(this);e.push(`L${(a[0]-t)/n} ${(a[1]-r)/s} L${l} ${c} L${h} ${d} L${(o[0]-t)/n} ${(o[1]-r)/s}`)},Pw=function(e){const t=u(this,xt),[r,n,s,a]=u(this,Zn),[o,l,c,h]=L(this,Lr,yh).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(t[2]-r)/s,(t[3]-n)/a,NaN,NaN,NaN,NaN,(t[4]-r)/s,(t[5]-n)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(t[16]-r)/s,(t[17]-n)/a,NaN,NaN,NaN,NaN,(t[14]-r)/s,(t[15]-n)/a],0),this.newFreeDrawOutline(d,e,u(this,Zn),u(this,ac),u(this,ic),u(this,sc))},Rw=function(e,t){const r=u(this,zi);return e.set([NaN,NaN,NaN,NaN,r[4],r[5]],t),t+=6},Iw=function(e,t){const r=u(this,xt).subarray(4,6),n=u(this,xt).subarray(16,18),[s,a,o,l]=u(this,Zn),[c,h,d,p]=L(this,Lr,yh).call(this);return e.set([NaN,NaN,NaN,NaN,(r[0]-s)/o,(r[1]-a)/l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,d,p,NaN,NaN,NaN,NaN,(n[0]-s)/o,(n[1]-a)/l],t),t+=24},N(Rs,lf,8),N(Rs,yg,2),N(Rs,wg,u(Rs,lf)+u(Rs,yg));let Zp=Rs;var lc,yl,Js,uf,Kn,cf,Ar,xg,Mw;class Nw extends qe{constructor(t,r,n,s,a,o){super();N(this,xg);N(this,lc);N(this,yl,new Float32Array(4));N(this,Js);N(this,uf);N(this,Kn);N(this,cf);N(this,Ar);T(this,Ar,t),T(this,Kn,r),T(this,lc,n),T(this,cf,s),T(this,Js,a),T(this,uf,o),this.lastPoint=[NaN,NaN],L(this,xg,Mw).call(this,o);const[l,c,h,d]=u(this,yl);for(let p=0,g=t.length;p<g;p+=2)t[p]=(t[p]-l)/h,t[p+1]=(t[p+1]-c)/d;for(let p=0,g=r.length;p<g;p+=2)r[p]=(r[p]-l)/h,r[p+1]=(r[p+1]-c)/d}toSVGPath(){const t=[`M${u(this,Ar)[4]} ${u(this,Ar)[5]}`];for(let r=6,n=u(this,Ar).length;r<n;r+=6){if(isNaN(u(this,Ar)[r])){t.push(`L${u(this,Ar)[r+4]} ${u(this,Ar)[r+5]}`);continue}t.push(`C${u(this,Ar)[r]} ${u(this,Ar)[r+1]} ${u(this,Ar)[r+2]} ${u(this,Ar)[r+3]} ${u(this,Ar)[r+4]} ${u(this,Ar)[r+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,r,n,s],a){const o=n-t,l=s-r;let c,h;switch(a){case 0:c=qe._rescale(u(this,Ar),t,s,o,-l),h=qe._rescale(u(this,Kn),t,s,o,-l);break;case 90:c=qe._rescaleAndSwap(u(this,Ar),t,r,o,l),h=qe._rescaleAndSwap(u(this,Kn),t,r,o,l);break;case 180:c=qe._rescale(u(this,Ar),n,r,-o,l),h=qe._rescale(u(this,Kn),n,r,-o,l);break;case 270:c=qe._rescaleAndSwap(u(this,Ar),n,s,-o,-l),h=qe._rescaleAndSwap(u(this,Kn),n,s,-o,-l);break}return{outline:Array.from(c),points:[Array.from(h)]}}get box(){return u(this,yl)}newOutliner(t,r,n,s,a,o=0){return new Zp(t,r,n,s,a,o)}getNewOutline(t,r){const[n,s,a,o]=u(this,yl),[l,c,h,d]=u(this,lc),p=a*h,g=o*d,y=n*h+l,b=s*d+c,w=this.newOutliner({x:u(this,Kn)[0]*p+y,y:u(this,Kn)[1]*g+b},u(this,lc),u(this,cf),t,u(this,uf),r??u(this,Js));for(let v=2;v<u(this,Kn).length;v+=2)w.add({x:u(this,Kn)[v]*p+y,y:u(this,Kn)[v+1]*g+b});return w.getOutlines()}}lc=new WeakMap,yl=new WeakMap,Js=new WeakMap,uf=new WeakMap,Kn=new WeakMap,cf=new WeakMap,Ar=new WeakMap,xg=new WeakSet,Mw=function(t){const r=u(this,Ar);let n=r[4],s=r[5];const a=[n,s,n,s];let o=n,l=s;const c=t?Math.max:Math.min;for(let d=6,p=r.length;d<p;d+=6){const g=r[d+4],y=r[d+5];if(isNaN(r[d]))Qe.pointBoundingBox(g,y,a),l<y?(o=g,l=y):l===y&&(o=c(o,g));else{const b=[1/0,1/0,-1/0,-1/0];Qe.bezierBoundingBox(n,s,...r.slice(d,d+6),b),Qe.rectBoundingBox(...b,a),l<b[3]?(o=b[2],l=b[3]):l===b[3]&&(o=c(o,b[2]))}n=g,s=y}const h=u(this,yl);h[0]=a[0]-u(this,Js),h[1]=a[1]-u(this,Js),h[2]=a[2]-a[0]+2*u(this,Js),h[3]=a[3]-a[1]+2*u(this,Js),this.lastPoint=[o,l]};var hf,df,Ga,ji,kn,Lw,Np,Ow,Fw,W0;class q0{constructor(e,t=0,r=0,n=!0){N(this,kn);N(this,hf);N(this,df);N(this,Ga,[]);N(this,ji,[]);const s=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:g,y,width:b,height:w}of e){const v=Math.floor((g-t)/a)*a,A=Math.ceil((g+b+t)/a)*a,E=Math.floor((y-t)/a)*a,_=Math.ceil((y+w+t)/a)*a,C=[v,E,_,!0],I=[A,E,_,!1];u(this,Ga).push(C,I),Qe.rectBoundingBox(v,E,A,_,s)}const o=s[2]-s[0]+2*r,l=s[3]-s[1]+2*r,c=s[0]-r,h=s[1]-r,d=u(this,Ga).at(n?-1:-2),p=[d[0],d[2]];for(const g of u(this,Ga)){const[y,b,w]=g;g[0]=(y-c)/o,g[1]=(b-h)/l,g[2]=(w-h)/l}T(this,hf,new Float32Array([c,h,o,l])),T(this,df,p)}getOutlines(){u(this,Ga).sort((t,r)=>t[0]-r[0]||t[1]-r[1]||t[2]-r[2]);const e=[];for(const t of u(this,Ga))t[3]?(e.push(...L(this,kn,W0).call(this,t)),L(this,kn,Ow).call(this,t)):(L(this,kn,Fw).call(this,t),e.push(...L(this,kn,W0).call(this,t)));return L(this,kn,Lw).call(this,e)}}hf=new WeakMap,df=new WeakMap,Ga=new WeakMap,ji=new WeakMap,kn=new WeakSet,Lw=function(e){const t=[],r=new Set;for(const a of e){const[o,l,c]=a;t.push([o,l,a],[o,c,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){const l=t[a][2],c=t[a+1][2];l.push(c),c.push(l),r.add(l),r.add(c)}const n=[];let s;for(;r.size>0;){const a=r.values().next().value;let[o,l,c,h,d]=a;r.delete(a);let p=o,g=l;for(s=[o,c],n.push(s);;){let y;if(r.has(h))y=h;else if(r.has(d))y=d;else break;r.delete(y),[o,l,c,h,d]=y,p!==o&&(s.push(p,g,o,g===l?l:c),p=o),g=g===l?c:l}s.push(p,g)}return new eS(n,u(this,hf),u(this,df))},Np=function(e){const t=u(this,ji);let r=0,n=t.length-1;for(;r<=n;){const s=r+n>>1,a=t[s][0];if(a===e)return s;a<e?r=s+1:n=s-1}return n+1},Ow=function([,e,t]){const r=L(this,kn,Np).call(this,e);u(this,ji).splice(r,0,[e,t])},Fw=function([,e,t]){const r=L(this,kn,Np).call(this,e);for(let n=r;n<u(this,ji).length;n++){const[s,a]=u(this,ji)[n];if(s!==e)break;if(s===e&&a===t){u(this,ji).splice(n,1);return}}for(let n=r-1;n>=0;n--){const[s,a]=u(this,ji)[n];if(s!==e)break;if(s===e&&a===t){u(this,ji).splice(n,1);return}}},W0=function(e){const[t,r,n]=e,s=[[t,r,n]],a=L(this,kn,Np).call(this,n);for(let o=0;o<a;o++){const[l,c]=u(this,ji)[o];for(let h=0,d=s.length;h<d;h++){const[,p,g]=s[h];if(!(c<=p||g<=l)){if(p>=l){if(g>c)s[h][1]=c;else{if(d===1)return[];s.splice(h,1),h--,d--}continue}s[h][2]=l,g>c&&s.push([t,c,g])}}}return s};var ff,uc;class eS extends qe{constructor(t,r,n){super();N(this,ff);N(this,uc);T(this,uc,t),T(this,ff,r),this.lastPoint=n}toSVGPath(){const t=[];for(const r of u(this,uc)){let[n,s]=r;t.push(`M${n} ${s}`);for(let a=2;a<r.length;a+=2){const o=r[a],l=r[a+1];o===n?(t.push(`V${l}`),s=l):l===s&&(t.push(`H${o}`),n=o)}t.push("Z")}return t.join(" ")}serialize([t,r,n,s],a){const o=[],l=n-t,c=s-r;for(const h of u(this,uc)){const d=new Array(h.length);for(let p=0;p<h.length;p+=2)d[p]=t+h[p]*l,d[p+1]=s-h[p+1]*c;o.push(d)}return o}get box(){return u(this,ff)}get classNamesForOutlining(){return["highlightOutline"]}}ff=new WeakMap,uc=new WeakMap;class X0 extends Zp{newFreeDrawOutline(e,t,r,n,s,a){return new tS(e,t,r,n,s,a)}}class tS extends Nw{newOutliner(e,t,r,n,s,a=0){return new X0(e,t,r,n,s,a)}}var Qn,wl,cc,Nr,pf,hc,ea,gf,qa,Ui,dc,mf,qt,Y0,Z0,K0,Co,Bw,ya;const Pn=class Pn{constructor({editor:e=null,uiManager:t=null}){N(this,qt);N(this,Qn,null);N(this,wl,null);N(this,cc);N(this,Nr,null);N(this,pf,!1);N(this,hc,!1);N(this,ea,null);N(this,gf);N(this,qa,null);N(this,Ui,null);N(this,dc);var r,n;e?(T(this,hc,!1),T(this,dc,kt.HIGHLIGHT_COLOR),T(this,ea,e)):(T(this,hc,!0),T(this,dc,kt.HIGHLIGHT_DEFAULT_COLOR)),T(this,Ui,(e==null?void 0:e._uiManager)||t),T(this,gf,u(this,Ui)._eventBus),T(this,cc,((r=e==null?void 0:e.color)==null?void 0:r.toUpperCase())||((n=u(this,Ui))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98"),u(Pn,mf)||T(Pn,mf,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ct(this,"_keyboardManager",new Df([[["Escape","mac+Escape"],Pn.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Pn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Pn.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Pn.prototype._moveToPrevious],[["Home","mac+Home"],Pn.prototype._moveToBeginning],[["End","mac+End"],Pn.prototype._moveToEnd]]))}renderButton(){const e=T(this,Qn,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",u(this,ea)&&(e.ariaControls=`${u(this,ea).id}_colorpicker_dropdown`);const t=u(this,Ui)._signal;e.addEventListener("click",L(this,qt,Co).bind(this),{signal:t}),e.addEventListener("keydown",L(this,qt,K0).bind(this),{signal:t});const r=T(this,wl,document.createElement("span"));return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=u(this,cc),e.append(r),e}renderMainDropdown(){const e=T(this,Nr,L(this,qt,Y0).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===u(this,Qn)){L(this,qt,Co).call(this,e);return}const t=e.target.getAttribute("data-color");t&&L(this,qt,Z0).call(this,t,e)}_moveToNext(e){var t,r;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}if(e.target===u(this,Qn)){(t=u(this,Nr).firstChild)==null||t.focus();return}(r=e.target.nextSibling)==null||r.focus()}_moveToPrevious(e){var t,r;if(e.target===((t=u(this,Nr))==null?void 0:t.firstChild)||e.target===u(this,Qn)){u(this,qt,ya)&&this._hideDropdownFromKeyboard();return}u(this,qt,ya)||L(this,qt,Co).call(this,e),(r=e.target.previousSibling)==null||r.focus()}_moveToBeginning(e){var t;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}(t=u(this,Nr).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}(t=u(this,Nr).lastChild)==null||t.focus()}hideDropdown(){var e,t;(e=u(this,Nr))==null||e.classList.add("hidden"),u(this,Qn).ariaExpanded="false",(t=u(this,qa))==null||t.abort(),T(this,qa,null)}_hideDropdownFromKeyboard(){var e;if(!u(this,hc)){if(!u(this,qt,ya)){(e=u(this,ea))==null||e.unselect();return}this.hideDropdown(),u(this,Qn).focus({preventScroll:!0,focusVisible:u(this,pf)})}}updateColor(e){if(u(this,wl)&&(u(this,wl).style.backgroundColor=e),!u(this,Nr))return;const t=u(this,Ui).highlightColors.values();for(const r of u(this,Nr).children)r.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=u(this,Qn))==null||e.remove(),T(this,Qn,null),T(this,wl,null),(t=u(this,Nr))==null||t.remove(),T(this,Nr,null)}};Qn=new WeakMap,wl=new WeakMap,cc=new WeakMap,Nr=new WeakMap,pf=new WeakMap,hc=new WeakMap,ea=new WeakMap,gf=new WeakMap,qa=new WeakMap,Ui=new WeakMap,dc=new WeakMap,mf=new WeakMap,qt=new WeakSet,Y0=function(){const e=document.createElement("div"),t=u(this,Ui)._signal;e.addEventListener("contextmenu",Ei,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),u(this,ea)&&(e.id=`${u(this,ea).id}_colorpicker_dropdown`);for(const[r,n]of u(this,Ui).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=r,s.setAttribute("data-l10n-id",u(Pn,mf)[r]);const a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=n,s.ariaSelected=n===u(this,cc),s.addEventListener("click",L(this,qt,Z0).bind(this,n),{signal:t}),e.append(s)}return e.addEventListener("keydown",L(this,qt,K0).bind(this),{signal:t}),e},Z0=function(e,t){t.stopPropagation(),u(this,gf).dispatch("switchannotationeditorparams",{source:this,type:u(this,dc),value:e})},K0=function(e){Pn._keyboardManager.exec(this,e)},Co=function(e){if(u(this,qt,ya)){this.hideDropdown();return}if(T(this,pf,e.detail===0),u(this,qa)||(T(this,qa,new AbortController),window.addEventListener("pointerdown",L(this,qt,Bw).bind(this),{signal:u(this,Ui).combinedSignal(u(this,qa))})),u(this,Qn).ariaExpanded="true",u(this,Nr)){u(this,Nr).classList.remove("hidden");return}const t=T(this,Nr,L(this,qt,Y0).call(this));u(this,Qn).append(t)},Bw=function(e){var t;(t=u(this,Nr))!=null&&t.contains(e.target)||this.hideDropdown()},ya=function(){return u(this,Nr)&&!u(this,Nr).classList.contains("hidden")},N(Pn,mf,null);let Oh=Pn;var fc,bf,ta,xl,vf,Nn,yf,wf,Al,gi,Jn,Qr,pc,ra,hn,gc,mi,xf,ft,Q0,Mp,zw,jw,Uw,J0,So,wi,uu,Hw,Lp,wh,$w,Vw,Gw,qw,Ww;const Bt=class Bt extends tr{constructor(t){super({...t,name:"highlightEditor"});N(this,ft);N(this,fc,null);N(this,bf,0);N(this,ta);N(this,xl,null);N(this,vf,null);N(this,Nn,null);N(this,yf,null);N(this,wf,0);N(this,Al,null);N(this,gi,null);N(this,Jn,null);N(this,Qr,!1);N(this,pc,null);N(this,ra);N(this,hn,null);N(this,gc,"");N(this,mi);N(this,xf,"");this.color=t.color||Bt._defaultColor,T(this,mi,t.thickness||Bt._defaultThickness),T(this,ra,t.opacity||Bt._defaultOpacity),T(this,ta,t.boxes||null),T(this,xf,t.methodOfCreation||""),T(this,gc,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(T(this,Qr,!0),L(this,ft,Mp).call(this,t),L(this,ft,So).call(this)):u(this,ta)&&(T(this,fc,t.anchorNode),T(this,bf,t.anchorOffset),T(this,yf,t.focusNode),T(this,wf,t.focusOffset),L(this,ft,Q0).call(this),L(this,ft,So).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const t=Bt.prototype;return Ct(this,"_keyboardManager",new Df([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:u(this,Qr)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:u(this,mi),methodOfCreation:u(this,xf)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,r){var n;tr.initialize(t,r),Bt._defaultColor||(Bt._defaultColor=((n=r.highlightColors)==null?void 0:n.values().next().value)||"#fff066")}static updateDefaultParams(t,r){switch(t){case kt.HIGHLIGHT_DEFAULT_COLOR:Bt._defaultColor=r;break;case kt.HIGHLIGHT_THICKNESS:Bt._defaultThickness=r;break}}translateInPage(t,r){}get toolbarPosition(){return u(this,pc)}updateParams(t,r){switch(t){case kt.HIGHLIGHT_COLOR:L(this,ft,zw).call(this,r);break;case kt.HIGHLIGHT_THICKNESS:L(this,ft,jw).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[kt.HIGHLIGHT_DEFAULT_COLOR,Bt._defaultColor],[kt.HIGHLIGHT_THICKNESS,Bt._defaultThickness]]}get propertiesToUpdate(){return[[kt.HIGHLIGHT_COLOR,this.color||Bt._defaultColor],[kt.HIGHLIGHT_THICKNESS,u(this,mi)||Bt._defaultThickness],[kt.HIGHLIGHT_FREE,u(this,Qr)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",T(this,vf,new Oh({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(L(this,ft,wh).call(this))}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,L(this,ft,wh).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){L(this,ft,J0).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(L(this,ft,So).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var n;let r=!1;this.parent&&!t?L(this,ft,J0).call(this):t&&(L(this,ft,So).call(this,t),r=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),r&&this.select()}rotate(t){var s,a,o;const{drawLayer:r}=this.parent;let n;u(this,Qr)?(t=(t-this.rotation+360)%360,n=L(s=Bt,wi,uu).call(s,u(this,gi).box,t)):n=L(a=Bt,wi,uu).call(a,[this.x,this.y,this.width,this.height],t),r.updateProperties(u(this,Jn),{bbox:n,root:{"data-main-rotation":t}}),r.updateProperties(u(this,hn),{bbox:L(o=Bt,wi,uu).call(o,u(this,Nn).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();u(this,gc)&&(t.setAttribute("aria-label",u(this,gc)),t.setAttribute("role","mark")),u(this,Qr)?t.classList.add("free"):this.div.addEventListener("keydown",L(this,ft,Hw).bind(this),{signal:this._uiManager._signal});const r=T(this,Al,document.createElement("div"));t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=u(this,xl);const[n,s]=this.parentDimensions;return this.setDims(this.width*n,this.height*s),f1(this,u(this,Al),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:L(this,ft,Lp).call(this,!0);break;case 1:case 3:L(this,ft,Lp).call(this,!1);break}}select(){var t;super.select(),u(this,hn)&&((t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),u(this,hn)&&((t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{selected:!1}}),u(this,Qr)||L(this,ft,Lp).call(this,!1))}get _mustFixPosition(){return!u(this,Qr)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(u(this,Jn),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(u(this,hn),{rootClass:{hidden:!t}}))}static startHighlighting(t,r,{target:n,x:s,y:a}){const{x:o,y:l,width:c,height:h}=n.getBoundingClientRect(),d=new AbortController,p=t.combinedSignal(d),g=y=>{d.abort(),L(this,wi,qw).call(this,t,y)};window.addEventListener("blur",g,{signal:p}),window.addEventListener("pointerup",g,{signal:p}),window.addEventListener("pointerdown",_r,{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",Ei,{signal:p}),n.addEventListener("pointermove",L(this,wi,Gw).bind(this,t),{signal:p}),this._freeHighlight=new X0({x:s,y:a},[o,l,c,h],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(t,r,n){var b,w,v,A;let s=null;if(t instanceof ww){const{data:{quadPoints:E,rect:_,rotation:C,id:I,color:k,opacity:D,popupRef:R},parent:{page:{pageNumber:z}}}=t;s=t={annotationType:ot.HIGHLIGHT,color:Array.from(k),opacity:D,quadPoints:E,boxes:null,pageIndex:z-1,rect:_.slice(0),rotation:C,annotationElementId:I,id:I,deleted:!1,popupRef:R}}else if(t instanceof Hb){const{data:{inkLists:E,rect:_,rotation:C,id:I,color:k,borderStyle:{rawWidth:D},popupRef:R},parent:{page:{pageNumber:z}}}=t;s=t={annotationType:ot.HIGHLIGHT,color:Array.from(k),thickness:D,inkLists:E,boxes:null,pageIndex:z-1,rect:_.slice(0),rotation:C,annotationElementId:I,id:I,deleted:!1,popupRef:R}}const{color:a,quadPoints:o,inkLists:l,opacity:c}=t,h=await super.deserialize(t,r,n);h.color=Qe.makeHexColor(...a),T(h,ra,c||1),l&&T(h,mi,t.thickness),h._initialData=s;const[d,p]=h.pageDimensions,[g,y]=h.pageTranslation;if(o){const E=T(h,ta,[]);for(let _=0;_<o.length;_+=8)E.push({x:(o[_]-g)/d,y:1-(o[_+1]-y)/p,width:(o[_+2]-o[_])/d,height:(o[_+1]-o[_+5])/p});L(b=h,ft,Q0).call(b),L(w=h,ft,So).call(w),h.rotate(h.rotation)}else if(l){T(h,Qr,!0);const E=l[0],_={x:E[0]-g,y:p-(E[1]-y)},C=new X0(_,[0,0,d,p],1,u(h,mi)/2,!0,.001);for(let D=0,R=E.length;D<R;D+=2)_.x=E[D]-g,_.y=p-(E[D+1]-y),C.add(_);const{id:I,clipPathId:k}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);L(v=h,ft,Mp).call(v,{highlightOutlines:C.getOutlines(),highlightId:I,clipPathId:k}),L(A=h,ft,So).call(A),h.rotate(h.parentRotation)}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const r=this.getRect(0,0),n=tr._colorManager.convert(this.color),s={annotationType:ot.HIGHLIGHT,color:n,opacity:u(this,ra),thickness:u(this,mi),quadPoints:L(this,ft,$w).call(this),outlines:L(this,ft,Vw).call(this,r),pageIndex:this.pageIndex,rect:r,rotation:L(this,ft,wh).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!L(this,ft,Ww).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};fc=new WeakMap,bf=new WeakMap,ta=new WeakMap,xl=new WeakMap,vf=new WeakMap,Nn=new WeakMap,yf=new WeakMap,wf=new WeakMap,Al=new WeakMap,gi=new WeakMap,Jn=new WeakMap,Qr=new WeakMap,pc=new WeakMap,ra=new WeakMap,hn=new WeakMap,gc=new WeakMap,mi=new WeakMap,xf=new WeakMap,ft=new WeakSet,Q0=function(){const t=new q0(u(this,ta),.001);T(this,gi,t.getOutlines()),[this.x,this.y,this.width,this.height]=u(this,gi).box;const r=new q0(u(this,ta),.0025,.001,this._uiManager.direction==="ltr");T(this,Nn,r.getOutlines());const{lastPoint:n}=u(this,Nn);T(this,pc,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])},Mp=function({highlightOutlines:t,highlightId:r,clipPathId:n}){var d,p;if(T(this,gi,t),T(this,Nn,t.getNewOutline(u(this,mi)/2+1.5,.0025)),r>=0)T(this,Jn,r),T(this,xl,n),this.parent.drawLayer.finalizeDraw(r,{bbox:t.box,path:{d:t.toSVGPath()}}),T(this,hn,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:u(this,Nn).box,path:{d:u(this,Nn).toSVGPath()}},!0));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(u(this,Jn),{bbox:L(d=Bt,wi,uu).call(d,u(this,gi).box,(g-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(u(this,hn),{bbox:L(p=Bt,wi,uu).call(p,u(this,Nn).box,g),path:{d:u(this,Nn).toSVGPath()}})}const[a,o,l,c]=t.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=c;break;case 90:{const[g,y]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*y/g,this.height=c*g/y;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=c;break;case 270:{const[g,y]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*y/g,this.height=c*g/y;break}}const{lastPoint:h}=u(this,Nn);T(this,pc,[(h[0]-a)/l,(h[1]-o)/c])},zw=function(t){const r=(a,o)=>{var l,c;this.color=a,T(this,ra,o),(l=this.parent)==null||l.drawLayer.updateProperties(u(this,Jn),{root:{fill:a,"fill-opacity":o}}),(c=u(this,vf))==null||c.updateColor(a)},n=this.color,s=u(this,ra);this.addCommands({cmd:r.bind(this,t,Bt._defaultOpacity),undo:r.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},jw=function(t){const r=u(this,mi),n=s=>{T(this,mi,s),L(this,ft,Uw).call(this,s)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Uw=function(t){if(!u(this,Qr))return;L(this,ft,Mp).call(this,{highlightOutlines:u(this,gi).getNewOutline(t/2)}),this.fixAndSetPosition();const[r,n]=this.parentDimensions;this.setDims(this.width*r,this.height*n)},J0=function(){u(this,Jn)===null||!this.parent||(this.parent.drawLayer.remove(u(this,Jn)),T(this,Jn,null),this.parent.drawLayer.remove(u(this,hn)),T(this,hn,null))},So=function(t=this.parent){u(this,Jn)===null&&({id:bn(this,Jn)._,clipPathId:bn(this,xl)._}=t.drawLayer.draw({bbox:u(this,gi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":u(this,ra)},rootClass:{highlight:!0,free:u(this,Qr)},path:{d:u(this,gi).toSVGPath()}},!1,!0),T(this,hn,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:u(this,Qr)},bbox:u(this,Nn).box,path:{d:u(this,Nn).toSVGPath()}},u(this,Qr))),u(this,Al)&&(u(this,Al).style.clipPath=u(this,xl)))},wi=new WeakSet,uu=function([t,r,n,s],a){switch(a){case 90:return[1-r-s,t,s,n];case 180:return[1-t-n,1-r-s,n,s];case 270:return[r,1-t-n,s,n]}return[t,r,n,s]},Hw=function(t){Bt._keyboardManager.exec(this,t)},Lp=function(t){if(!u(this,fc))return;const r=window.getSelection();t?r.setPosition(u(this,fc),u(this,bf)):r.setPosition(u(this,yf),u(this,wf))},wh=function(){return u(this,Qr)?this.rotation:0},$w=function(){if(u(this,Qr))return null;const[t,r]=this.pageDimensions,[n,s]=this.pageTranslation,a=u(this,ta),o=new Float32Array(a.length*8);let l=0;for(const{x:c,y:h,width:d,height:p}of a){const g=c*t+n,y=(1-h)*r+s;o[l]=o[l+4]=g,o[l+1]=o[l+3]=y,o[l+2]=o[l+6]=g+d*t,o[l+5]=o[l+7]=y-p*r,l+=8}return o},Vw=function(t){return u(this,gi).serialize(t,L(this,ft,wh).call(this))},Gw=function(t,r){this._freeHighlight.add(r)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},qw=function(t,r){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Ww=function(t){const{color:r}=this._initialData;return t.color.some((n,s)=>n!==r[s])},N(Bt,wi),Ie(Bt,"_defaultColor",null),Ie(Bt,"_defaultOpacity",1),Ie(Bt,"_defaultThickness",12),Ie(Bt,"_type","highlight"),Ie(Bt,"_editorType",ot.HIGHLIGHT),Ie(Bt,"_freeHighlightId",-1),Ie(Bt,"_freeHighlight",null),Ie(Bt,"_freeHighlightClipId","");let Kp=Bt;var El;class Xw{constructor(){N(this,El,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,r]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,r)}updateSVGProperty(e,t){u(this,El)[e]=t}toSVGProperties(){const e=u(this,El);return T(this,El,Object.create(null)),{root:e}}reset(){T(this,El,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){Wt("Not implemented")}}El=new WeakMap;var ei,mc,Ur,_l,Cl,Wa,Xa,Ya,Sl,Lt,eb,tb,rb,xh,Yw,Op,Ah,cu;const We=class We extends tr{constructor(t){super(t);N(this,Lt);N(this,ei,null);N(this,mc);Ie(this,"_drawId",null);T(this,mc,t.mustBeCommitted||!1),this._addOutlines(t)}_addOutlines(t){t.drawOutlines&&(L(this,Lt,eb).call(this,t),L(this,Lt,xh).call(this))}static _mergeSVGProperties(t,r){const n=new Set(Object.keys(t));for(const[s,a]of Object.entries(r))n.has(s)?Object.assign(t[s],a):t[s]=a;return t}static getDefaultDrawingOptions(t){Wt("Not implemented")}static get typesMap(){Wt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,r){const n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,r),this._currentParent&&(u(We,Ur).updateProperty(n,r),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,r){const n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,r)}static get defaultPropertiesToUpdate(){const t=[],r=this._defaultDrawingOptions;for(const[n,s]of this.typesMap)t.push([n,r[s]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:r}=this;for(const[n,s]of this.constructor.typesMap)t.push([n,r[s]]);return t}_updateProperty(t,r,n){const s=this._drawingOptions,a=s[r],o=l=>{var h;s.updateProperty(r,l);const c=u(this,ei).updateProperty(r,l);c&&L(this,Lt,Ah).call(this,c),(h=this.parent)==null||h.drawLayer.updateProperties(this._drawId,s.toSVGProperties())};this.addCommands({cmd:o.bind(this,n),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathResizingSVGProperties(L(this,Lt,Op).call(this)),{bbox:L(this,Lt,cu).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathResizedSVGProperties(L(this,Lt,Op).call(this)),{bbox:L(this,Lt,cu).call(this)}))}_onTranslating(t,r){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,{bbox:L(this,Lt,cu).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathTranslatedSVGProperties(L(this,Lt,Op).call(this),this.parentDimensions),{bbox:L(this,Lt,cu).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,u(this,mc)&&(T(this,mc,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){L(this,Lt,rb).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(L(this,Lt,xh).call(this),L(this,Lt,Ah).call(this,u(this,ei).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var n;let r=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),L(this,Lt,rb).call(this)):t&&(this._uiManager.addShouldRescale(this),L(this,Lt,xh).call(this,t),r=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(t),r&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties({bbox:L(this,Lt,cu).call(this)},u(this,ei).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&L(this,Lt,Ah).call(this,u(this,ei).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,r;this._isCopy&&(t=this.x,r=this.y);const n=super.render();n.classList.add("draw");const s=document.createElement("div");n.append(s),s.setAttribute("aria-hidden","true"),s.className="internal";const[a,o]=this.parentDimensions;return this.setDims(this.width*a,this.height*o),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,r),n}static createDrawerInstance(t,r,n,s,a){Wt("Not implemented")}static startDrawing(t,r,n,s){var w;const{target:a,offsetX:o,offsetY:l,pointerId:c,pointerType:h}=s;if(u(We,Xa)&&u(We,Xa)!==h)return;const{viewport:{rotation:d}}=t,{width:p,height:g}=a.getBoundingClientRect(),y=T(We,_l,new AbortController),b=t.combinedSignal(y);if(u(We,Wa)||T(We,Wa,c),u(We,Xa)??T(We,Xa,h),window.addEventListener("pointerup",v=>{var A;u(We,Wa)===v.pointerId?this._endDraw(v):(A=u(We,Ya))==null||A.delete(v.pointerId)},{signal:b}),window.addEventListener("pointercancel",v=>{var A;u(We,Wa)===v.pointerId?this._currentParent.endDrawingSession():(A=u(We,Ya))==null||A.delete(v.pointerId)},{signal:b}),window.addEventListener("pointerdown",v=>{u(We,Xa)===v.pointerType&&((u(We,Ya)||T(We,Ya,new Set)).add(v.pointerId),u(We,Ur).isCancellable()&&(u(We,Ur).removeLastElement(),u(We,Ur).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:b}),window.addEventListener("contextmenu",Ei,{signal:b}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:b}),a.addEventListener("touchmove",v=>{v.timeStamp===u(We,Sl)&&_r(v)},{signal:b}),t.toggleDrawing(),(w=r._editorUndoBar)==null||w.hide(),u(We,Ur)){t.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).startNew(o,l,p,g,d));return}r.updateUIForDefaultProperties(this),T(We,Ur,this.createDrawerInstance(o,l,p,g,d)),T(We,Cl,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(u(We,Cl).toSVGProperties(),u(We,Ur).defaultSVGProperties),!0,!1)}static _drawMove(t){var a;if(T(We,Sl,-1),!u(We,Ur))return;const{offsetX:r,offsetY:n,pointerId:s}=t;if(u(We,Wa)===s){if(((a=u(We,Ya))==null?void 0:a.size)>=1){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).add(r,n)),T(We,Sl,t.timeStamp),_r(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,T(We,Ur,null),T(We,Cl,null),T(We,Xa,null),T(We,Sl,NaN)),u(We,_l)&&(u(We,_l).abort(),T(We,_l,null),T(We,Wa,NaN),T(We,Ya,null))}static _endDraw(t){const r=this._currentParent;if(r){if(r.toggleDrawing(!0),this._cleanup(!1),(t==null?void 0:t.target)===r.div&&r.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const n=u(We,Ur),s=this._currentDrawId,a=n.getLastElement();r.addCommands({cmd:()=>{r.drawLayer.updateProperties(s,n.setLastElement(a))},undo:()=>{r.drawLayer.updateProperties(s,n.removeLastElement())},mustExec:!1,type:kt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const r=this._currentParent;if(!r)return null;if(r.toggleDrawing(!0),r.cleanUndoStack(kt.DRAW_STEP),!u(We,Ur).isEmpty()){const{pageDimensions:[n,s],scale:a}=r,o=r.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:u(We,Ur).getOutlines(n*a,s*a,a,this._INNER_MARGIN),drawingOptions:u(We,Cl),mustBeCommitted:!t});return this._cleanup(!0),o}return r.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,r,n,s,a,o){Wt("Not implemented")}static async deserialize(t,r,n){var d,p;const{rawDims:{pageWidth:s,pageHeight:a,pageX:o,pageY:l}}=r.viewport,c=this.deserializeDraw(o,l,s,a,this._INNER_MARGIN,t),h=await super.deserialize(t,r,n);return h.createDrawingOptions(t),L(d=h,Lt,eb).call(d,{drawOutlines:c}),L(p=h,Lt,xh).call(p),h.onScaleChanging(),h.rotate(),h}serializeDraw(t){const[r,n]=this.pageTranslation,[s,a]=this.pageDimensions;return u(this,ei).serialize([r,n,s,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};ei=new WeakMap,mc=new WeakMap,Ur=new WeakMap,_l=new WeakMap,Cl=new WeakMap,Wa=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,Sl=new WeakMap,Lt=new WeakSet,eb=function({drawOutlines:t,drawId:r,drawingOptions:n}){T(this,ei,t),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),r>=0?(this._drawId=r,this.parent.drawLayer.finalizeDraw(r,t.defaultProperties)):this._drawId=L(this,Lt,tb).call(this,t,this.parent),L(this,Lt,Ah).call(this,t.box)},tb=function(t,r){const{id:n}=r.drawLayer.draw(We._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n},rb=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},xh=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=L(this,Lt,tb).call(this,u(this,ei),t)}},Yw=function([t,r,n,s]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[r,1-t,n*(o/a),s*(a/o)];case 180:return[1-t,1-r,n,s];case 270:return[1-r,t,n*(o/a),s*(a/o)];default:return[t,r,n,s]}},Op=function(){const{x:t,y:r,width:n,height:s,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-r,t,n*(a/o),s*(o/a)];case 180:return[1-t,1-r,n,s];case 270:return[r,1-t,n*(a/o),s*(o/a)];default:return[t,r,n,s]}},Ah=function(t){if([this.x,this.y,this.width,this.height]=L(this,Lt,Yw).call(this,t),this.div){this.fixAndSetPosition();const[r,n]=this.parentDimensions;this.setDims(this.width*r,this.height*n)}this._onResized()},cu=function(){const{x:t,y:r,width:n,height:s,rotation:a,parentRotation:o,parentDimensions:[l,c]}=this;switch((a*4+o)/90){case 1:return[1-r-s,t,s,n];case 2:return[1-t-n,1-r-s,n,s];case 3:return[r,1-t-n,s,n];case 4:return[t,r-n*(l/c),s*(c/l),n*(l/c)];case 5:return[1-r,t,n*(l/c),s*(c/l)];case 6:return[1-t-s*(c/l),1-r,s*(c/l),n*(l/c)];case 7:return[r-n*(l/c),1-t-s*(c/l),n*(l/c),s*(c/l)];case 8:return[t-n,r-s,n,s];case 9:return[1-r,t-n,s,n];case 10:return[1-t,1-r,n,s];case 11:return[r-s,1-t,s,n];case 12:return[t-s*(c/l),r,s*(c/l),n*(l/c)];case 13:return[1-r-n*(l/c),t-s*(c/l),n*(l/c),s*(c/l)];case 14:return[1-t,1-r-n*(l/c),s*(c/l),n*(l/c)];case 15:return[r,1-t,n*(l/c),s*(c/l)];default:return[t,r,n,s]}},Ie(We,"_currentDrawId",-1),Ie(We,"_currentParent",null),N(We,Ur,null),N(We,_l,null),N(We,Cl,null),N(We,Wa,NaN),N(We,Xa,null),N(We,Ya,null),N(We,Sl,NaN),Ie(We,"_INNER_MARGIN",3);let Qp=We;var ds,Hr,$r,Tl,bc,xn,Jr,bi,kl,Dl,Pl,vc,Fp;class rS{constructor(e,t,r,n,s,a){N(this,vc);N(this,ds,new Float64Array(6));N(this,Hr);N(this,$r);N(this,Tl);N(this,bc);N(this,xn);N(this,Jr,"");N(this,bi,0);N(this,kl,new Rf);N(this,Dl);N(this,Pl);T(this,Dl,r),T(this,Pl,n),T(this,Tl,s),T(this,bc,a),[e,t]=L(this,vc,Fp).call(this,e,t);const o=T(this,Hr,[NaN,NaN,NaN,NaN,e,t]);T(this,xn,[e,t]),T(this,$r,[{line:o,points:u(this,xn)}]),u(this,ds).set(o,0)}updateProperty(e,t){e==="stroke-width"&&T(this,bc,t)}isEmpty(){return!u(this,$r)||u(this,$r).length===0}isCancellable(){return u(this,xn).length<=10}add(e,t){[e,t]=L(this,vc,Fp).call(this,e,t);const[r,n,s,a]=u(this,ds).subarray(2,6),o=e-s,l=t-a;return Math.hypot(u(this,Dl)*o,u(this,Pl)*l)<=2?null:(u(this,xn).push(e,t),isNaN(r)?(u(this,ds).set([s,a,e,t],2),u(this,Hr).push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(u(this,ds)[0])&&u(this,Hr).splice(6,6),u(this,ds).set([r,n,s,a,e,t],0),u(this,Hr).push(...qe.createBezierPoints(r,n,s,a,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const r=this.add(e,t);return r||(u(this,xn).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,r,n,s){T(this,Dl,r),T(this,Pl,n),T(this,Tl,s),[e,t]=L(this,vc,Fp).call(this,e,t);const a=T(this,Hr,[NaN,NaN,NaN,NaN,e,t]);T(this,xn,[e,t]);const o=u(this,$r).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),u(this,$r).push({line:a,points:u(this,xn)}),u(this,ds).set(a,0),T(this,bi,0),this.toSVGPath(),null}getLastElement(){return u(this,$r).at(-1)}setLastElement(e){return u(this,$r)?(u(this,$r).push(e),T(this,Hr,e.line),T(this,xn,e.points),T(this,bi,0),{path:{d:this.toSVGPath()}}):u(this,kl).setLastElement(e)}removeLastElement(){if(!u(this,$r))return u(this,kl).removeLastElement();u(this,$r).pop(),T(this,Jr,"");for(let e=0,t=u(this,$r).length;e<t;e++){const{line:r,points:n}=u(this,$r)[e];T(this,Hr,r),T(this,xn,n),T(this,bi,0),this.toSVGPath()}return{path:{d:u(this,Jr)}}}toSVGPath(){const e=qe.svgRound(u(this,Hr)[4]),t=qe.svgRound(u(this,Hr)[5]);if(u(this,xn).length===2)return T(this,Jr,`${u(this,Jr)} M ${e} ${t} Z`),u(this,Jr);if(u(this,xn).length<=6){const n=u(this,Jr).lastIndexOf("M");T(this,Jr,`${u(this,Jr).slice(0,n)} M ${e} ${t}`),T(this,bi,6)}if(u(this,xn).length===4){const n=qe.svgRound(u(this,Hr)[10]),s=qe.svgRound(u(this,Hr)[11]);return T(this,Jr,`${u(this,Jr)} L ${n} ${s}`),T(this,bi,12),u(this,Jr)}const r=[];u(this,bi)===0&&(r.push(`M ${e} ${t}`),T(this,bi,6));for(let n=u(this,bi),s=u(this,Hr).length;n<s;n+=6){const[a,o,l,c,h,d]=u(this,Hr).slice(n,n+6).map(qe.svgRound);r.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}return T(this,Jr,u(this,Jr)+r.join(" ")),T(this,bi,u(this,Hr).length),u(this,Jr)}getOutlines(e,t,r,n){const s=u(this,$r).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),u(this,kl).build(u(this,$r),e,t,r,u(this,Tl),u(this,bc),n),T(this,ds,null),T(this,Hr,null),T(this,$r,null),T(this,Jr,null),u(this,kl)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}ds=new WeakMap,Hr=new WeakMap,$r=new WeakMap,Tl=new WeakMap,bc=new WeakMap,xn=new WeakMap,Jr=new WeakMap,bi=new WeakMap,kl=new WeakMap,Dl=new WeakMap,Pl=new WeakMap,vc=new WeakSet,Fp=function(e,t){return qe._normalizePoint(e,t,u(this,Dl),u(this,Pl),u(this,Tl))};var An,Af,Ef,ti,fs,ps,yc,wc,Rl,rn,Ds,Zw,Kw,Qw;class Rf extends qe{constructor(){super(...arguments);N(this,rn);N(this,An);N(this,Af,0);N(this,Ef);N(this,ti);N(this,fs);N(this,ps);N(this,yc);N(this,wc);N(this,Rl)}build(t,r,n,s,a,o,l){T(this,fs,r),T(this,ps,n),T(this,yc,s),T(this,wc,a),T(this,Rl,o),T(this,Ef,l??0),T(this,ti,t),L(this,rn,Kw).call(this)}get thickness(){return u(this,Rl)}setLastElement(t){return u(this,ti).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return u(this,ti).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:r}of u(this,ti)){if(t.push(`M${qe.svgRound(r[4])} ${qe.svgRound(r[5])}`),r.length===6){t.push("Z");continue}if(r.length===12&&isNaN(r[6])){t.push(`L${qe.svgRound(r[10])} ${qe.svgRound(r[11])}`);continue}for(let n=6,s=r.length;n<s;n+=6){const[a,o,l,c,h,d]=r.subarray(n,n+6).map(qe.svgRound);t.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}}return t.join("")}serialize([t,r,n,s],a){const o=[],l=[],[c,h,d,p]=L(this,rn,Zw).call(this);let g,y,b,w,v,A,E,_,C;switch(u(this,wc)){case 0:C=qe._rescale,g=t,y=r+s,b=n,w=-s,v=t+c*n,A=r+(1-h-p)*s,E=t+(c+d)*n,_=r+(1-h)*s;break;case 90:C=qe._rescaleAndSwap,g=t,y=r,b=n,w=s,v=t+h*n,A=r+c*s,E=t+(h+p)*n,_=r+(c+d)*s;break;case 180:C=qe._rescale,g=t+n,y=r,b=-n,w=s,v=t+(1-c-d)*n,A=r+h*s,E=t+(1-c)*n,_=r+(h+p)*s;break;case 270:C=qe._rescaleAndSwap,g=t+n,y=r+s,b=-n,w=-s,v=t+(1-h-p)*n,A=r+(1-c-d)*s,E=t+(1-h)*n,_=r+(1-c)*s;break}for(const{line:I,points:k}of u(this,ti))o.push(C(I,g,y,b,w,a?new Array(I.length):null)),l.push(C(k,g,y,b,w,a?new Array(k.length):null));return{lines:o,points:l,rect:[v,A,E,_]}}static deserialize(t,r,n,s,a,{paths:{lines:o,points:l},rotation:c,thickness:h}){const d=[];let p,g,y,b,w;switch(c){case 0:w=qe._rescale,p=-t/n,g=r/s+1,y=1/n,b=-1/s;break;case 90:w=qe._rescaleAndSwap,p=-r/s,g=-t/n,y=1/s,b=1/n;break;case 180:w=qe._rescale,p=t/n+1,g=-r/s,y=-1/n,b=1/s;break;case 270:w=qe._rescaleAndSwap,p=r/s+1,g=t/n+1,y=-1/s,b=-1/n;break}if(!o){o=[];for(const A of l){const E=A.length;if(E===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1]]));continue}if(E===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1],NaN,NaN,NaN,NaN,A[2],A[3]]));continue}const _=new Float32Array(3*(E-2));o.push(_);let[C,I,k,D]=A.subarray(0,4);_.set([NaN,NaN,NaN,NaN,C,I],0);for(let R=4;R<E;R+=2){const z=A[R],G=A[R+1];_.set(qe.createBezierPoints(C,I,k,D,z,G),(R-2)*3),[C,I,k,D]=[k,D,z,G]}}}for(let A=0,E=o.length;A<E;A++)d.push({line:w(o[A].map(_=>_??NaN),p,g,y,b),points:w(l[A].map(_=>_??NaN),p,g,y,b)});const v=new this.prototype.constructor;return v.build(d,n,s,1,c,h,a),v}get box(){return u(this,An)}updateProperty(t,r){return t==="stroke-width"?L(this,rn,Qw).call(this,r):null}updateParentDimensions([t,r],n){const[s,a]=L(this,rn,Ds).call(this);T(this,fs,t),T(this,ps,r),T(this,yc,n);const[o,l]=L(this,rn,Ds).call(this),c=o-s,h=l-a,d=u(this,An);return d[0]-=c,d[1]-=h,d[2]+=2*c,d[3]+=2*h,d}updateRotation(t){return T(this,Af,t),{path:{transform:this.rotationTransform}}}get viewBox(){return u(this,An).map(qe.svgRound).join(" ")}get defaultProperties(){const[t,r]=u(this,An);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`}}}get rotationTransform(){const[,,t,r]=u(this,An);let n=0,s=0,a=0,o=0,l=0,c=0;switch(u(this,Af)){case 90:s=r/t,a=-t/r,l=t;break;case 180:n=-1,o=-1,l=t,c=r;break;case 270:s=-r/t,a=t/r,c=r;break;default:return""}return`matrix(${n} ${s} ${a} ${o} ${qe.svgRound(l)} ${qe.svgRound(c)})`}getPathResizingSVGProperties([t,r,n,s]){const[a,o]=L(this,rn,Ds).call(this),[l,c,h,d]=u(this,An);if(Math.abs(h-a)<=qe.PRECISION||Math.abs(d-o)<=qe.PRECISION){const w=t+n/2-(l+h/2),v=r+s/2-(c+d/2);return{path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:`${this.rotationTransform} translate(${w} ${v})`}}}const p=(n-2*a)/(h-2*a),g=(s-2*o)/(d-2*o),y=h/n,b=d/s;return{path:{"transform-origin":`${qe.svgRound(l)} ${qe.svgRound(c)}`,transform:`${this.rotationTransform} scale(${y} ${b}) translate(${qe.svgRound(a)} ${qe.svgRound(o)}) scale(${p} ${g}) translate(${qe.svgRound(-a)} ${qe.svgRound(-o)})`}}}getPathResizedSVGProperties([t,r,n,s]){const[a,o]=L(this,rn,Ds).call(this),l=u(this,An),[c,h,d,p]=l;if(l[0]=t,l[1]=r,l[2]=n,l[3]=s,Math.abs(d-a)<=qe.PRECISION||Math.abs(p-o)<=qe.PRECISION){const v=t+n/2-(c+d/2),A=r+s/2-(h+p/2);for(const{line:E,points:_}of u(this,ti))qe._translate(E,v,A,E),qe._translate(_,v,A,_);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(n-2*a)/(d-2*a),y=(s-2*o)/(p-2*o),b=-g*(c+a)+t+a,w=-y*(h+o)+r+o;if(g!==1||y!==1||b!==0||w!==0)for(const{line:v,points:A}of u(this,ti))qe._rescale(v,b,w,g,y,v),qe._rescale(A,b,w,g,y,A);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,r],n){const[s,a]=n,o=u(this,An),l=t-o[0],c=r-o[1];if(u(this,fs)===s&&u(this,ps)===a)for(const{line:h,points:d}of u(this,ti))qe._translate(h,l,c,h),qe._translate(d,l,c,d);else{const h=u(this,fs)/s,d=u(this,ps)/a;T(this,fs,s),T(this,ps,a);for(const{line:p,points:g}of u(this,ti))qe._rescale(p,l,c,h,d,p),qe._rescale(g,l,c,h,d,g);o[2]*=h,o[3]*=d}return o[0]=t,o[1]=r,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`}}}get defaultSVGProperties(){const t=u(this,An);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${qe.svgRound(t[0])} ${qe.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}An=new WeakMap,Af=new WeakMap,Ef=new WeakMap,ti=new WeakMap,fs=new WeakMap,ps=new WeakMap,yc=new WeakMap,wc=new WeakMap,Rl=new WeakMap,rn=new WeakSet,Ds=function(t=u(this,Rl)){const r=u(this,Ef)+t/2*u(this,yc);return u(this,wc)%180===0?[r/u(this,fs),r/u(this,ps)]:[r/u(this,ps),r/u(this,fs)]},Zw=function(){const[t,r,n,s]=u(this,An),[a,o]=L(this,rn,Ds).call(this,0);return[t+a,r+o,n-2*a,s-2*o]},Kw=function(){const t=T(this,An,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:s}of u(this,ti)){if(s.length<=12){for(let l=4,c=s.length;l<c;l+=6)Qe.pointBoundingBox(s[l],s[l+1],t);continue}let a=s[4],o=s[5];for(let l=6,c=s.length;l<c;l+=6){const[h,d,p,g,y,b]=s.subarray(l,l+6);Qe.bezierBoundingBox(a,o,h,d,p,g,y,b,t),a=y,o=b}}const[r,n]=L(this,rn,Ds).call(this);t[0]=dn(t[0]-r,0,1),t[1]=dn(t[1]-n,0,1),t[2]=dn(t[2]+r,0,1),t[3]=dn(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]},Qw=function(t){const[r,n]=L(this,rn,Ds).call(this);T(this,Rl,t);const[s,a]=L(this,rn,Ds).call(this),[o,l]=[s-r,a-n],c=u(this,An);return c[0]-=o,c[1]-=l,c[2]+=2*o,c[3]+=2*l,c};class Rg extends Xw{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:tr._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??(t=this["stroke-width"]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new Rg(this._viewParameters);return e.updateAll(this),e}}var Ag,Jw;const gu=class gu extends Qp{constructor(t){super({...t,name:"inkEditor"});N(this,Ag);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,r){tr.initialize(t,r),this._defaultDrawingOptions=new Rg(r.viewParameters)}static getDefaultDrawingOptions(t){const r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ct(this,"typesMap",new Map([[kt.INK_THICKNESS,"stroke-width"],[kt.INK_COLOR,"stroke"],[kt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,r,n,s,a){return new rS(t,r,n,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,r,n,s,a,o){return Rf.deserialize(t,r,n,s,a,o)}static async deserialize(t,r,n){let s=null;if(t instanceof Hb){const{data:{inkLists:o,rect:l,rotation:c,id:h,color:d,opacity:p,borderStyle:{rawWidth:g},popupRef:y},parent:{page:{pageNumber:b}}}=t;s=t={annotationType:ot.INK,color:Array.from(d),thickness:g,opacity:p,paths:{points:o},boxes:null,pageIndex:b-1,rect:l.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:y}}const a=await super.deserialize(t,r,n);return a._initialData=s,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:r,parent:n}=this;r.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(t,r.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:r,opacity:n}){this._drawingOptions=gu.getDefaultDrawingOptions({stroke:Qe.makeHexColor(...t),"stroke-width":r,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:r,points:n,rect:s}=this.serializeDraw(t),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":l}}=this,c={annotationType:ot.INK,color:tr._colorManager.convert(a),opacity:o,thickness:l,paths:{lines:r,points:n},pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(c.isCopy=!0,c):this.annotationElementId&&!L(this,Ag,Jw).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(t){const{points:r,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:r}),null}};Ag=new WeakSet,Jw=function(t){const{color:r,thickness:n,opacity:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||t.color.some((o,l)=>o!==r[l])||t.thickness!==n||t.opacity!==s||t.pageIndex!==a},Ie(gu,"_type","ink"),Ie(gu,"_editorType",ot.INK),Ie(gu,"_defaultDrawingOptions",null);let nb=gu;class ib extends Rf{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const ap=8,Jc=3;var Il,zt,sb,Hi,ex,tx,ab,Bp,rx,nx,ix,ob,lb,sx;class ys{static extractContoursFromText(e,{fontFamily:t,fontStyle:r,fontWeight:n},s,a,o,l){let c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1});const d=200,p=h.font=`${r} ${n} ${d}px ${t}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:y,actualBoundingBoxAscent:b,actualBoundingBoxDescent:w,fontBoundingBoxAscent:v,fontBoundingBoxDescent:A,width:E}=h.measureText(e),_=1.5,C=Math.ceil(Math.max(Math.abs(g)+Math.abs(y)||0,E)*_),I=Math.ceil(Math.max(Math.abs(b)+Math.abs(w)||d,Math.abs(v)+Math.abs(A)||d)*_);c=new OffscreenCanvas(C,I),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=p,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,C,I),h.fillStyle="black",h.fillText(e,C*(_-1)/2,I*(3-_)/2);const k=L(this,zt,ob).call(this,h.getImageData(0,0,C,I).data),D=L(this,zt,ix).call(this,k),R=L(this,zt,lb).call(this,D),z=L(this,zt,ab).call(this,k,C,I,R);return this.processDrawnLines({lines:{curves:z,width:C,height:I},pageWidth:s,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(e,t,r,n,s){const[a,o,l]=L(this,zt,sx).call(this,e),[c,h]=L(this,zt,nx).call(this,a,o,l,Math.hypot(o,l)*u(this,Il).sigmaSFactor,u(this,Il).sigmaR,u(this,Il).kernelSize),d=L(this,zt,lb).call(this,h),p=L(this,zt,ab).call(this,c,o,l,d);return this.processDrawnLines({lines:{curves:p,width:o,height:l},pageWidth:t,pageHeight:r,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:r,rotation:n,innerMargin:s,mustSmooth:a,areContours:o}){n%180!==0&&([t,r]=[r,t]);const{curves:l,width:c,height:h}=e,d=e.thickness??0,p=[],g=Math.min(t/c,r/h),y=g/t,b=g/r,w=[];for(const{points:A}of l){const E=a?L(this,zt,rx).call(this,A):A;if(!E)continue;w.push(E);const _=E.length,C=new Float32Array(_),I=new Float32Array(3*(_===2?2:_-2));if(p.push({line:I,points:C}),_===2){C[0]=E[0]*y,C[1]=E[1]*b,I.set([NaN,NaN,NaN,NaN,C[0],C[1]],0);continue}let[k,D,R,z]=E;k*=y,D*=b,R*=y,z*=b,C.set([k,D,R,z],0),I.set([NaN,NaN,NaN,NaN,k,D],0);for(let G=4;G<_;G+=2){const O=C[G]=E[G]*y,X=C[G+1]=E[G+1]*b;I.set(qe.createBezierPoints(k,D,R,z,O,X),(G-2)*3),[k,D,R,z]=[R,z,O,X]}}if(p.length===0)return null;const v=o?new ib:new Rf;return v.build(p,t,r,1,n,o?0:d,s),{outline:v,newCurves:w,areContours:o,thickness:d,width:c,height:h}}static async compressSignature({outlines:e,areContours:t,thickness:r,width:n,height:s}){let a=1/0,o=-1/0,l=0;for(const E of e){l+=E.length;for(let _=2,C=E.length;_<C;_++){const I=E[_]-E[_-2];a=Math.min(a,I),o=Math.max(o,I)}}let c;a>=-128&&o<=127?c=Int8Array:a>=-32768&&o<=32767?c=Int16Array:c=Int32Array;const h=e.length,d=ap+Jc*h,p=new Uint32Array(d);let g=0;p[g++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*c.BYTES_PER_ELEMENT,p[g++]=0,p[g++]=n,p[g++]=s,p[g++]=t?0:1,p[g++]=Math.max(0,Math.floor(r??0)),p[g++]=h,p[g++]=c.BYTES_PER_ELEMENT;for(const E of e)p[g++]=E.length-2,p[g++]=E[0],p[g++]=E[1];const y=new CompressionStream("deflate-raw"),b=y.writable.getWriter();await b.ready,b.write(p);const w=c.prototype.constructor;for(const E of e){const _=new w(E.length-2);for(let C=2,I=E.length;C<I;C++)_[C-2]=E[C]-E[C-2];b.write(_)}b.close();const v=await new Response(y.readable).arrayBuffer(),A=new Uint8Array(v);return n1(A)}static async decompressSignature(e){try{const t=I_(e),{readable:r,writable:n}=new DecompressionStream("deflate-raw"),s=n.getWriter();await s.ready,s.write(t).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,o=0;for await(const E of r)a||(a=new Uint8Array(new Uint32Array(E.buffer,0,4)[0])),a.set(E,o),o+=E.length;const l=new Uint32Array(a.buffer,0,a.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);const h=l[2],d=l[3],p=l[4]===0,g=l[5],y=l[6],b=l[7],w=[],v=(ap+Jc*y)*Uint32Array.BYTES_PER_ELEMENT;let A;switch(b){case Int8Array.BYTES_PER_ELEMENT:A=new Int8Array(a.buffer,v);break;case Int16Array.BYTES_PER_ELEMENT:A=new Int16Array(a.buffer,v);break;case Int32Array.BYTES_PER_ELEMENT:A=new Int32Array(a.buffer,v);break}o=0;for(let E=0;E<y;E++){const _=l[Jc*E+ap],C=new Float32Array(_+2);w.push(C);for(let I=0;I<Jc-1;I++)C[I]=l[Jc*E+ap+I+1];for(let I=0;I<_;I++)C[I+2]=C[I]+A[o++]}return{areContours:p,thickness:g,outlines:w,width:h,height:d}}catch(t){return ut(`decompressSignature: ${t}`),null}}}Il=new WeakMap,zt=new WeakSet,sb=function(e,t,r,n){return r-=e,n-=t,r===0?n>0?0:4:r===1?n+6:2-n},Hi=new WeakMap,ex=function(e,t,r,n,s,a,o){const l=L(this,zt,sb).call(this,r,n,s,a);for(let c=0;c<8;c++){const h=(-c+l-o+16)%8,d=u(this,Hi)[2*h],p=u(this,Hi)[2*h+1];if(e[(r+d)*t+(n+p)]!==0)return h}return-1},tx=function(e,t,r,n,s,a,o){const l=L(this,zt,sb).call(this,r,n,s,a);for(let c=0;c<8;c++){const h=(c+l+o+16)%8,d=u(this,Hi)[2*h],p=u(this,Hi)[2*h+1];if(e[(r+d)*t+(n+p)]!==0)return h}return-1},ab=function(e,t,r,n){const s=e.length,a=new Int32Array(s);for(let h=0;h<s;h++)a[h]=e[h]<=n?1:0;for(let h=1;h<r-1;h++)a[h*t]=a[h*t+t-1]=0;for(let h=0;h<t;h++)a[h]=a[t*r-1-h]=0;let o=1,l;const c=[];for(let h=1;h<r-1;h++){l=1;for(let d=1;d<t-1;d++){const p=h*t+d,g=a[p];if(g===0)continue;let y=h,b=d;if(g===1&&a[p-1]===0)o+=1,b-=1;else if(g>=1&&a[p+1]===0)o+=1,b+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const w=[d,h],v=b===d+1,A={isHole:v,points:w,id:o,parent:0};c.push(A);let E;for(const G of c)if(G.id===l){E=G;break}E?E.isHole?A.parent=v?E.parent:l:A.parent=v?l:E.parent:A.parent=v?l:0;const _=L(this,zt,ex).call(this,a,t,h,d,y,b,0);if(_===-1){a[p]=-o,a[p]!==1&&(l=Math.abs(a[p]));continue}let C=u(this,Hi)[2*_],I=u(this,Hi)[2*_+1];const k=h+C,D=d+I;y=k,b=D;let R=h,z=d;for(;;){const G=L(this,zt,tx).call(this,a,t,R,z,y,b,1);C=u(this,Hi)[2*G],I=u(this,Hi)[2*G+1];const O=R+C,X=z+I;w.push(X,O);const S=R*t+z;if(a[S+1]===0?a[S]=-o:a[S]===1&&(a[S]=o),O===h&&X===d&&R===k&&z===D){a[p]!==1&&(l=Math.abs(a[p]));break}else y=R,b=z,R=O,z=X}}}return c},Bp=function(e,t,r,n){if(r-t<=4){for(let k=t;k<r-2;k+=2)n.push(e[k],e[k+1]);return}const s=e[t],a=e[t+1],o=e[r-4]-s,l=e[r-3]-a,c=Math.hypot(o,l),h=o/c,d=l/c,p=h*a-d*s,g=l/o,y=1/c,b=Math.atan(g),w=Math.cos(b),v=Math.sin(b),A=y*(Math.abs(w)+Math.abs(v)),E=y*(1-A+A**2),_=Math.max(Math.atan(Math.abs(v+w)*E),Math.atan(Math.abs(v-w)*E));let C=0,I=t;for(let k=t+2;k<r-2;k+=2){const D=Math.abs(p-h*e[k+1]+d*e[k]);D>C&&(I=k,C=D)}C>(c*_)**2?(L(this,zt,Bp).call(this,e,t,I+2,n),L(this,zt,Bp).call(this,e,I,r,n)):n.push(s,a)},rx=function(e){const t=[],r=e.length;return L(this,zt,Bp).call(this,e,0,r,t),t.push(e[r-2],e[r-1]),t.length<=4?null:t},nx=function(e,t,r,n,s,a){const o=new Float32Array(a**2),l=-2*n**2,c=a>>1;for(let b=0;b<a;b++){const w=(b-c)**2;for(let v=0;v<a;v++)o[b*a+v]=Math.exp((w+(v-c)**2)/l)}const h=new Float32Array(256),d=-2*s**2;for(let b=0;b<256;b++)h[b]=Math.exp(b**2/d);const p=e.length,g=new Uint8Array(p),y=new Uint32Array(256);for(let b=0;b<r;b++)for(let w=0;w<t;w++){const v=b*t+w,A=e[v];let E=0,_=0;for(let I=0;I<a;I++){const k=b+I-c;if(!(k<0||k>=r))for(let D=0;D<a;D++){const R=w+D-c;if(R<0||R>=t)continue;const z=e[k*t+R],G=o[I*a+D]*h[Math.abs(z-A)];E+=z*G,_+=G}}const C=g[v]=Math.round(E/_);y[C]++}return[g,y]},ix=function(e){const t=new Uint32Array(256);for(const r of e)t[r]++;return t},ob=function(e){const t=e.length,r=new Uint8ClampedArray(t>>2);let n=-1/0,s=1/0;for(let o=0,l=r.length;o<l;o++){if(e[(o<<2)+3]===0){n=r[o]=255;continue}const h=r[o]=e[o<<2];h>n&&(n=h),h<s&&(s=h)}const a=255/(n-s);for(let o=0;o<t;o++)r[o]=(r[o]-s)*a;return r},lb=function(e){let t,r=-1/0,n=-1/0;const s=e.findIndex(l=>l!==0);let a=s,o=s;for(t=s;t<256;t++){const l=e[t];l>r&&(t-a>n&&(n=t-a,o=t-1),r=l,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t},sx=function(e){const t=e,{width:r,height:n}=e,{maxDim:s}=u(this,Il);let a=r,o=n;if(r>s||n>s){let p=r,g=n,y=Math.log2(Math.max(r,n)/s);const b=Math.floor(y);y=y===b?b-1:b;for(let v=0;v<y;v++){a=Math.ceil(p/2),o=Math.ceil(g/2);const A=new OffscreenCanvas(a,o);A.getContext("2d").drawImage(e,0,0,p,g,0,0,a,o),p=a,g=o,e!==t&&e.close(),e=A.transferToImageBitmap()}const w=Math.min(s/a,s/o);a=Math.round(a*w),o=Math.round(o*w)}const c=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});c.filter="grayscale(1)",c.drawImage(e,0,0,e.width,e.height,0,0,a,o);const h=c.getImageData(0,0,a,o).data;return[L(this,zt,ob).call(this,h),a,o]},N(ys,zt),N(ys,Il,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),N(ys,Hi,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Vb extends Xw{constructor(){super(),super.updateProperties({fill:tr._defaultLineColor,"stroke-width":0})}clone(){const e=new Vb;return e.updateAll(this),e}}class Gb extends Rg{constructor(e){super(e),super.updateProperties({stroke:tr._defaultLineColor,"stroke-width":1})}clone(){const e=new Gb(this._viewParameters);return e.updateAll(this),e}}var Za,gs,Ka,Nl;const $n=class $n extends Qp{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});N(this,Za,!1);N(this,gs,null);N(this,Ka,null);N(this,Nl,null);this._willKeepAspectRatio=!0,T(this,Ka,t.signatureData||null),T(this,gs,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,r){tr.initialize(t,r),this._defaultDrawingOptions=new Vb,this._defaultDrawnSignatureOptions=new Gb(r.viewParameters)}static getDefaultDrawingOptions(t){const r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ct(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!u(this,gs)}}static computeTelemetryFinalData(t){const r=t.get("hasDescription");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,r;const{_isCopy:n}=this;if(n&&(this._isCopy=!1,t=this.x,r=this.y),super.render(),this._drawId===null)if(u(this,Ka)){const{lines:s,mustSmooth:a,areContours:o,description:l,uuid:c,heightInPage:h}=u(this,Ka),{rawDims:{pageWidth:d,pageHeight:p},rotation:g}=this.parent.viewport,y=ys.processDrawnLines({lines:s,pageWidth:d,pageHeight:p,rotation:g,innerMargin:$n._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(y,h,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);return n&&(this._isCopy=!0,this._moveAfterPaste(t,r)),this.div}setUuid(t){T(this,Nl,t),this.addEditToolbar()}getUuid(){return u(this,Nl)}get description(){return u(this,gs)}set description(t){T(this,gs,t),super.addEditToolbar().then(r=>{r==null||r.updateEditSignatureButton(t)})}getSignaturePreview(){const{newCurves:t,areContours:r,thickness:n,width:s,height:a}=u(this,Ka),o=Math.max(s,a),l=ys.processDrawnLines({lines:{curves:t.map(c=>({points:c})),thickness:n,width:s,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:r});return{areContours:r,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,r,n,s){const{x:a,y:o}=this,{outline:l}=T(this,Ka,t);T(this,Za,l instanceof ib),this.description=n,this.div.setAttribute("data-l10n-args",JSON.stringify({description:n}));let c;u(this,Za)?c=$n.getDefaultDrawingOptions():(c=$n._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:c});const[h,d]=this.parentDimensions,[,p]=this.pageDimensions;let g=r/p;g=g>=1?.5:g,this.width*=g/this.height,this.width>=1&&(g*=.9/this.width,this.width=.9),this.height=g,this.setDims(h*this.width,d*this.height),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:r,pageHeight:n},rotation:s}=this.parent.viewport;return ys.process(t,r,n,s,$n._INNER_MARGIN)}getFromText(t,r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:a}=this.parent.viewport;return ys.extractContoursFromText(t,r,n,s,a,$n._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:r,pageHeight:n},rotation:s}=this.parent.viewport;return ys.processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:s,innerMargin:$n._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:r}){t?this._drawingOptions=$n.getDefaultDrawingOptions():(this._drawingOptions=$n._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":r}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:r,points:n,rect:s}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":a}}=this,o={annotationType:ot.SIGNATURE,isSignature:!0,areContours:u(this,Za),color:[0,0,0],thickness:u(this,Za)?0:a,pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(o.paths={lines:r,points:n},o.uuid=u(this,Nl),o.isCopy=!0):o.lines=r,u(this,gs)&&(o.accessibilityData={type:"Figure",alt:u(this,gs)}),o}static deserializeDraw(t,r,n,s,a,o){return o.areContours?ib.deserialize(t,r,n,s,a,o):Rf.deserialize(t,r,n,s,a,o)}static async deserialize(t,r,n){var a;const s=await super.deserialize(t,r,n);return T(s,Za,t.areContours),T(s,gs,((a=t.accessibilityData)==null?void 0:a.alt)||""),T(s,Nl,t.uuid),s}};Za=new WeakMap,gs=new WeakMap,Ka=new WeakMap,Nl=new WeakMap,Ie($n,"_type","signature"),Ie($n,"_editorType",ot.SIGNATURE),Ie($n,"_defaultDrawingOptions",null);let ub=$n;var lr,Vr,Qa,na,Ja,xc,ia,Ml,ms,ri,Ac,Ot,Eh,_h,zp,jp,Up,hb,Hp,ax;class cb extends tr{constructor(t){super({...t,name:"stampEditor"});N(this,Ot);N(this,lr,null);N(this,Vr,null);N(this,Qa,null);N(this,na,null);N(this,Ja,null);N(this,xc,"");N(this,ia,null);N(this,Ml,!1);N(this,ms,null);N(this,ri,!1);N(this,Ac,!1);T(this,na,t.bitmapUrl),T(this,Ja,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,r){tr.initialize(t,r)}static isHandlingMimeForPasting(t){return Xp.includes(t)}static paste(t,r){r.pasteEditor({mode:ot.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:s,width:a,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await n.guess({name:"altText",request:{data:s,width:a,height:o,channels:s.length/(a*o)}});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 c=l.output;return await this.setGuessedAltText(c),r&&!this.hasAltTextData()&&(this.altTextData={alt:c,decorative:!1}),c}remove(){var t;u(this,Vr)&&(T(this,lr,null),this._uiManager.imageManager.deleteId(u(this,Vr)),(t=u(this,ia))==null||t.remove(),T(this,ia,null),u(this,ms)&&(clearTimeout(u(this,ms)),T(this,ms,null))),super.remove()}rebuild(){if(!this.parent){u(this,Vr)&&L(this,Ot,zp).call(this);return}super.rebuild(),this.div!==null&&(u(this,Vr)&&u(this,ia)===null&&L(this,Ot,zp).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(u(this,Qa)||u(this,lr)||u(this,na)||u(this,Ja)||u(this,Vr)||u(this,Ml))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;return this._isCopy&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.createAltText(),u(this,Ml)||(u(this,lr)?L(this,Ot,jp).call(this):L(this,Ot,zp).call(this)),this._isCopy&&this._moveAfterPaste(t,r),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,r){const{id:n,bitmap:s}=this._uiManager.imageManager.getFromCanvas(t,r);r.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(T(this,Vr,n),s&&T(this,lr,s),T(this,Ml,!1),L(this,Ot,jp).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;u(this,ms)!==null&&clearTimeout(u(this,ms)),T(this,ms,setTimeout(()=>{T(this,ms,null),L(this,Ot,hb).call(this)},200))}copyCanvas(t,r,n=!1){var g;t||(t=224);const{width:s,height:a}=u(this,lr),o=new Wi;let l=u(this,lr),c=s,h=a,d=null;if(r){if(s>r||a>r){const D=Math.min(r/s,r/a);c=Math.floor(s*D),h=Math.floor(a*D)}d=document.createElement("canvas");const y=d.width=Math.ceil(c*o.sx),b=d.height=Math.ceil(h*o.sy);u(this,ri)||(l=L(this,Ot,Up).call(this,y,b));const w=d.getContext("2d");w.filter=this._uiManager.hcmFilter;let v="white",A="#cfcfd8";this._uiManager.hcmFilter!=="none"?A="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(v="#8f8f9d",A="#42414d");const E=15,_=E*o.sx,C=E*o.sy,I=new OffscreenCanvas(_*2,C*2),k=I.getContext("2d");k.fillStyle=v,k.fillRect(0,0,_*2,C*2),k.fillStyle=A,k.fillRect(0,0,_,C),k.fillRect(_,C,_,C),w.fillStyle=w.createPattern(I,"repeat"),w.fillRect(0,0,y,b),w.drawImage(l,0,0,l.width,l.height,0,0,y,b)}let p=null;if(n){let y,b;if(o.symmetric&&l.width<t&&l.height<t)y=l.width,b=l.height;else if(l=u(this,lr),s>t||a>t){const A=Math.min(t/s,t/a);y=Math.floor(s*A),b=Math.floor(a*A),u(this,ri)||(l=L(this,Ot,Up).call(this,y,b))}const v=new OffscreenCanvas(y,b).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,y,b),p={width:y,height:b,data:v.getImageData(0,0,y,b).data}}return{canvas:d,width:c,height:h,imageData:p}}static async deserialize(t,r,n){var w;let s=null,a=!1;if(t instanceof xw){const{data:{rect:v,rotation:A,id:E,structParent:_,popupRef:C},container:I,parent:{page:{pageNumber:k}},canvas:D}=t;let R,z;D?(delete t.canvas,{id:R,bitmap:z}=n.imageManager.getFromCanvas(I.id,D),D.remove()):(a=!0,t._hasNoCanvas=!0);const G=((w=await r._structTree.getAriaAttributes(`${Nb}${E}`))==null?void 0:w.get("aria-label"))||"";s=t={annotationType:ot.STAMP,bitmapId:R,bitmap:z,pageIndex:k-1,rect:v.slice(0),rotation:A,annotationElementId:E,id:E,deleted:!1,accessibilityData:{decorative:!1,altText:G},isSvg:!1,structParent:_,popupRef:C}}const o=await super.deserialize(t,r,n),{rect:l,bitmap:c,bitmapUrl:h,bitmapId:d,isSvg:p,accessibilityData:g}=t;a?(n.addMissingCanvas(t.id,o),T(o,Ml,!0)):d&&n.imageManager.isValidId(d)?(T(o,Vr,d),c&&T(o,lr,c)):T(o,na,h),T(o,ri,p);const[y,b]=o.pageDimensions;return o.width=(l[2]-l[0])/y,o.height=(l[3]-l[1])/b,g&&(o.altTextData=g),o._initialData=s,T(o,Ac,!!s),o}serialize(t=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:ot.STAMP,bitmapId:u(this,Vr),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:u(this,ri),structTreeParentId:this._structTreeParentId};if(t)return n.bitmapUrl=L(this,Ot,Hp).call(this,!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;const{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=L(this,Ot,ax).call(this,n);if(l.isSame)return null;l.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1}if(n.id=this.annotationElementId,r===null)return n;r.stamps||(r.stamps=new Map);const o=u(this,ri)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!r.stamps.has(u(this,Vr)))r.stamps.set(u(this,Vr),{area:o,serialized:n}),n.bitmap=L(this,Ot,Hp).call(this,!1);else if(u(this,ri)){const l=r.stamps.get(u(this,Vr));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=L(this,Ot,Hp).call(this,!1))}return n}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}lr=new WeakMap,Vr=new WeakMap,Qa=new WeakMap,na=new WeakMap,Ja=new WeakMap,xc=new WeakMap,ia=new WeakMap,Ml=new WeakMap,ms=new WeakMap,ri=new WeakMap,Ac=new WeakMap,Ot=new WeakSet,Eh=function(t,r=!1){if(!t){this.remove();return}T(this,lr,t.bitmap),r||(T(this,Vr,t.id),T(this,ri,t.isSvg)),t.file&&T(this,xc,t.file.name),L(this,Ot,jp).call(this)},_h=function(){if(T(this,Qa,null),this._uiManager.enableWaiting(!1),!!u(this,ia)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&u(this,lr)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&u(this,lr)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},zp=function(){if(u(this,Vr)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(u(this,Vr)).then(n=>L(this,Ot,Eh).call(this,n,!0)).finally(()=>L(this,Ot,_h).call(this));return}if(u(this,na)){const n=u(this,na);T(this,na,null),this._uiManager.enableWaiting(!0),T(this,Qa,this._uiManager.imageManager.getFromUrl(n).then(s=>L(this,Ot,Eh).call(this,s)).finally(()=>L(this,Ot,_h).call(this)));return}if(u(this,Ja)){const n=u(this,Ja);T(this,Ja,null),this._uiManager.enableWaiting(!0),T(this,Qa,this._uiManager.imageManager.getFromFile(n).then(s=>L(this,Ot,Eh).call(this,s)).finally(()=>L(this,Ot,_h).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Xp.join(",");const r=this._uiManager._signal;T(this,Qa,new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const s=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),L(this,Ot,Eh).call(this,s)}n()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:r})}).finally(()=>L(this,Ot,_h).call(this))),t.click()},jp=function(){var d;const{div:t}=this;let{width:r,height:n}=u(this,lr);const[s,a]=this.pageDimensions,o=.75;if(this.width)r=this.width*s,n=this.height*a;else if(r>o*s||n>o*a){const p=Math.min(o*s/r,o*a/n);r*=p,n*=p}const[l,c]=this.parentDimensions;this.setDims(r*l/s,n*c/a),this._uiManager.enableWaiting(!1);const h=T(this,ia,document.createElement("canvas"));h.setAttribute("role","img"),this.addContainer(h),this.width=r/s,this.height=n/a,(d=this._initialOptions)!=null&&d.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),L(this,Ot,hb).call(this),u(this,Ac)||(this.parent.addUndoableEditor(this),T(this,Ac,!0)),this._reportTelemetry({action:"inserted_image"}),u(this,xc)&&this.div.setAttribute("aria-description",u(this,xc)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Up=function(t,r){const{width:n,height:s}=u(this,lr);let a=n,o=s,l=u(this,lr);for(;a>2*t||o>2*r;){const c=a,h=o;a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*r&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const d=new OffscreenCanvas(a,o);d.getContext("2d").drawImage(l,0,0,c,h,0,0,a,o),l=d.transferToImageBitmap()}return l},hb=function(){const[t,r]=this.parentDimensions,{width:n,height:s}=this,a=new Wi,o=Math.ceil(n*t*a.sx),l=Math.ceil(s*r*a.sy),c=u(this,ia);if(!c||c.width===o&&c.height===l)return;c.width=o,c.height=l;const h=u(this,ri)?u(this,lr):L(this,Ot,Up).call(this,o,l),d=c.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,o,l)},Hp=function(t){if(t){if(u(this,ri)){const s=this._uiManager.imageManager.getSvgUrl(u(this,Vr));if(s)return s}const r=document.createElement("canvas");return{width:r.width,height:r.height}=u(this,lr),r.getContext("2d").drawImage(u(this,lr),0,0),r.toDataURL()}if(u(this,ri)){const[r,n]=this.pageDimensions,s=Math.round(this.width*r*da.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*da.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(s,a);return o.getContext("2d").drawImage(u(this,lr),0,0,u(this,lr).width,u(this,lr).height,0,0,s,a),o.transferToImageBitmap()}return structuredClone(u(this,lr))},ax=function(t){var o;const{pageIndex:r,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===r,a=(((o=t.accessibilityData)==null?void 0:o.alt)||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}},Ie(cb,"_type","stamp"),Ie(cb,"_editorType",ot.STAMP);var Ll,Ec,bs,eo,sa,ni,to,_c,Ol,$i,aa,Gr,oa,ro,Cc,Ze,no,ur,ox,Ji,db,fb,$p;const Ii=class Ii{constructor({uiManager:e,pageIndex:t,div:r,structTreeLayer:n,accessibilityManager:s,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:h}){N(this,ur);N(this,Ll);N(this,Ec,!1);N(this,bs,null);N(this,eo,null);N(this,sa,null);N(this,ni,new Map);N(this,to,!1);N(this,_c,!1);N(this,Ol,!1);N(this,$i,null);N(this,aa,null);N(this,Gr,null);N(this,oa,null);N(this,ro,null);N(this,Cc,-1);N(this,Ze);const d=[...u(Ii,no).values()];if(!Ii._initialized){Ii._initialized=!0;for(const p of d)p.initialize(h,e)}e.registerEditorTypes(d),T(this,Ze,e),this.pageIndex=t,this.div=r,T(this,Ll,s),T(this,bs,a),this.viewport=c,T(this,Gr,l),this.drawLayer=o,this._structTree=n,u(this,Ze).addLayer(this)}get isEmpty(){return u(this,ni).size===0}get isInvisible(){return this.isEmpty&&u(this,Ze).getMode()===ot.NONE}updateToolbar(e){u(this,Ze).updateToolbar(e)}updateMode(e=u(this,Ze).getMode()){switch(L(this,ur,$p).call(this),e){case ot.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ot.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ot.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const r of u(Ii,no).values())t.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=u(this,Gr))==null?void 0:t.div)}setEditingState(e){u(this,Ze).setEditingState(e)}addCommands(e){u(this,Ze).addCommands(e)}cleanUndoStack(e){u(this,Ze).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=u(this,bs))==null||t.div.classList.toggle("disabled",!e)}async enable(){var r;T(this,Ol,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(r=u(this,ro))==null||r.abort(),T(this,ro,null);const e=new Set;for(const n of u(this,ni).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(u(this,Ze).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));if(!u(this,bs)){T(this,Ol,!1);return}const t=u(this,bs).getEditableAnnotations();for(const n of t){if(n.hide(),u(this,Ze).isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const s=await this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}T(this,Ol,!1)}disable(){var n;if(T(this,_c,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),u(this,Gr)&&!u(this,ro)){T(this,ro,new AbortController);const s=u(this,Ze).combinedSignal(u(this,ro));u(this,Gr).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:c,timeStamp:h}=a,d=u(this,Cc);if(h-d>500){T(this,Cc,h);return}T(this,Cc,-1);const{classList:p}=this.div;p.toggle("getElements",!0);const g=document.elementsFromPoint(l,c);if(p.toggle("getElements",!1),!this.div.contains(g[0]))return;let y;const b=new RegExp(`^${Q2}[0-9]+$`);for(const v of g)if(b.test(v.id)){y=v.id;break}if(!y)return;const w=u(this,ni).get(y);(w==null?void 0:w.annotationElementId)===null&&(a.stopPropagation(),a.preventDefault(),w.dblclick())},{signal:s,capture:!0})}const e=new Map,t=new Map;for(const s of u(this,ni).values())if(s.disableEditing(),!!s.annotationElementId){if(s.serialize()!==null){e.set(s.annotationElementId,s);continue}else t.set(s.annotationElementId,s);(n=this.getEditableAnnotation(s.annotationElementId))==null||n.show(),s.remove()}if(u(this,bs)){const s=u(this,bs).getEditableAnnotations();for(const a of s){const{id:o}=a.data;if(u(this,Ze).isDeletedAnnotationElement(o))continue;let l=t.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=e.get(o),l&&(u(this,Ze).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}L(this,ur,$p).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const s of u(Ii,no).values())r.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),T(this,_c,!1)}getEditableAnnotation(e){var t;return((t=u(this,bs))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){u(this,Ze).getActive()!==e&&u(this,Ze).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=u(this,Gr))!=null&&e.div&&!u(this,oa)){T(this,oa,new AbortController);const t=u(this,Ze).combinedSignal(u(this,oa));u(this,Gr).div.addEventListener("pointerdown",L(this,ur,ox).bind(this),{signal:t}),u(this,Gr).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=u(this,Gr))!=null&&e.div&&u(this,oa)&&(u(this,oa).abort(),T(this,oa,null),u(this,Gr).div.classList.remove("highlighting"))}enableClick(){if(u(this,eo))return;T(this,eo,new AbortController);const e=u(this,Ze).combinedSignal(u(this,eo));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){var e;(e=u(this,eo))==null||e.abort(),T(this,eo,null)}attach(e){u(this,ni).set(e.id,e);const{annotationElementId:t}=e;t&&u(this,Ze).isDeletedAnnotationElement(t)&&u(this,Ze).removeDeletedAnnotationElement(e)}detach(e){var t;u(this,ni).delete(e.id),(t=u(this,Ll))==null||t.removePointerInTextLayer(e.contentDiv),!u(this,_c)&&e.annotationElementId&&u(this,Ze).addDeletedAnnotationElement(e)}remove(e){this.detach(e),u(this,Ze).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(u(this,Ze).addDeletedAnnotationElement(e.annotationElementId),tr.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),u(this,Ze).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!u(this,Ol)),u(this,Ze).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!u(this,sa)&&(e._focusEventsAllowed=!1,T(this,sa,setTimeout(()=>{T(this,sa,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:u(this,Ze)._signal}),t.focus())},0))),e._structTreeParentId=(r=u(this,Ll))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),r=()=>{e.remove()};this.addCommands({cmd:t,undo:r,mustExec:!1})}getNextId(){return u(this,Ze).getId()}combinedSignal(e){return u(this,Ze).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=u(this,ur,Ji))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await u(this,Ze).updateMode(e.mode);const{offsetX:r,offsetY:n}=L(this,ur,fb).call(this),s=this.getNextId(),a=L(this,ur,db).call(this,{parent:this,id:s,x:r,y:n,uiManager:u(this,Ze),isCentered:!0,...t});a&&this.add(a)}async deserialize(e){var t;return await((t=u(Ii,no).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,u(this,Ze)))||null}createAndAddNewEditor(e,t,r={}){const n=this.getNextId(),s=L(this,ur,db).call(this,{parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:u(this,Ze),isCentered:t,...r});return s&&this.add(s),s}addNewEditor(e={}){this.createAndAddNewEditor(L(this,ur,fb).call(this),!0,e)}setSelected(e){u(this,Ze).setSelected(e)}toggleSelected(e){u(this,Ze).toggleSelected(e)}unselect(e){u(this,Ze).unselect(e)}pointerup(e){var n;const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!u(this,to)||(T(this,to,!1),(n=u(this,ur,Ji))!=null&&n.isDrawer&&u(this,ur,Ji).supportMultipleDrawings))return;if(!u(this,Ec)){T(this,Ec,!0);return}const r=u(this,Ze).getMode();if(r===ot.STAMP||r===ot.SIGNATURE){u(this,Ze).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var n;if(u(this,Ze).getMode()===ot.HIGHLIGHT&&this.enableTextSelection(),u(this,to)){T(this,to,!1);return}const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(T(this,to,!0),(n=u(this,ur,Ji))!=null&&n.isDrawer){this.startDrawingSession(e);return}const r=u(this,Ze).getActive();T(this,Ec,!r||r.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),u(this,$i)){u(this,ur,Ji).startDrawing(this,u(this,Ze),!1,e);return}u(this,Ze).setCurrentDrawingSession(this),T(this,$i,new AbortController);const t=u(this,Ze).combinedSignal(u(this,$i));this.div.addEventListener("blur",({relatedTarget:r})=>{r&&!this.div.contains(r)&&(T(this,aa,null),this.commitOrRemove())},{signal:t}),u(this,ur,Ji).startDrawing(this,u(this,Ze),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&T(this,aa,t);return}u(this,aa)&&setTimeout(()=>{var t;(t=u(this,aa))==null||t.focus(),T(this,aa,null)},0)}endDrawingSession(e=!1){return u(this,$i)?(u(this,Ze).setCurrentDrawingSession(null),u(this,$i).abort(),T(this,$i,null),T(this,aa,null),u(this,ur,Ji).endDrawing(e)):null}findNewParent(e,t,r){const n=u(this,Ze).findParent(t,r);return n===null||n===this?!1:(n.changeParent(e),!0)}commitOrRemove(){return u(this,$i)?(this.endDrawingSession(),!0):!1}onScaleChanging(){u(this,$i)&&u(this,ur,Ji).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=u(this,Ze).getActive())==null?void 0:e.parent)===this&&(u(this,Ze).commitOrRemove(),u(this,Ze).setActiveEditor(null)),u(this,sa)&&(clearTimeout(u(this,sa)),T(this,sa,null));for(const r of u(this,ni).values())(t=u(this,Ll))==null||t.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,u(this,ni).clear(),u(this,Ze).removeLayer(this)}render({viewport:e}){this.viewport=e,so(this.div,e);for(const t of u(this,Ze).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){u(this,Ze).commitOrRemove(),L(this,ur,$p).call(this);const t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,so(this.div,{rotation:r}),t!==r)for(const n of u(this,ni).values())n.rotate(r)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return u(this,Ze).viewParameters.realScale}};Ll=new WeakMap,Ec=new WeakMap,bs=new WeakMap,eo=new WeakMap,sa=new WeakMap,ni=new WeakMap,to=new WeakMap,_c=new WeakMap,Ol=new WeakMap,$i=new WeakMap,aa=new WeakMap,Gr=new WeakMap,oa=new WeakMap,ro=new WeakMap,Cc=new WeakMap,Ze=new WeakMap,no=new WeakMap,ur=new WeakSet,ox=function(e){u(this,Ze).unselectAll();const{target:t}=e;if(t===u(this,Gr).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&u(this,Gr).div.contains(t)){const{isMac:r}=qr.platform;if(e.button!==0||e.ctrlKey&&r)return;u(this,Ze).showAllEditors("highlight",!0,!0),u(this,Gr).div.classList.add("free"),this.toggleDrawing(),Kp.startHighlighting(this,u(this,Ze).direction==="ltr",{target:u(this,Gr).div,x:e.x,y:e.y}),u(this,Gr).div.addEventListener("pointerup",()=>{u(this,Gr).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:u(this,Ze)._signal}),e.preventDefault()}},Ji=function(){return u(Ii,no).get(u(this,Ze).getMode())},db=function(e){const t=u(this,ur,Ji);return t?new t.prototype.constructor(e):null},fb=function(){const{x:e,y:t,width:r,height:n}=this.div.getBoundingClientRect(),s=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+r),l=Math.min(window.innerHeight,t+n),c=(s+o)/2-e,h=(a+l)/2-t,[d,p]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:d,offsetY:p}},$p=function(){for(const e of u(this,ni).values())e.isEmpty()&&e.remove()},Ie(Ii,"_initialized",!1),N(Ii,no,new Map([V0,nb,cb,Kp,ub].map(e=>[e._editorType,e])));let Jp=Ii;var Vi,En,Fl,_f,Eg,lx,As,pb,ux,gb;const Rr=class Rr{constructor({pageIndex:e}){N(this,As);N(this,Vi,null);N(this,En,new Map);N(this,Fl,new Map);this.pageIndex=e}setParent(e){if(!u(this,Vi)){T(this,Vi,e);return}if(u(this,Vi)!==e){if(u(this,En).size>0)for(const t of u(this,En).values())t.remove(),e.append(t);T(this,Vi,e)}}static get _svgFactory(){return Ct(this,"_svgFactory",new Lh)}draw(e,t=!1,r=!1){const n=bn(Rr,_f)._++,s=L(this,As,pb).call(this),a=Rr._svgFactory.createElement("defs");s.append(a);const o=Rr._svgFactory.createElement("path");a.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&u(this,Fl).set(n,o);const c=r?L(this,As,ux).call(this,a,l):null,h=Rr._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${l}`),this.updateProperties(s,e),u(this,En).set(n,s),{id:n,clipPathId:`url(#${c})`}}drawOutline(e,t){const r=bn(Rr,_f)._++,n=L(this,As,pb).call(this),s=Rr._svgFactory.createElement("defs");n.append(s);const a=Rr._svgFactory.createElement("path");s.append(a);const o=`path_p${this.pageIndex}_${r}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const d=Rr._svgFactory.createElement("mask");s.append(d),l=`mask_p${this.pageIndex}_${r}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const p=Rr._svgFactory.createElement("rect");d.append(p),p.setAttribute("width","1"),p.setAttribute("height","1"),p.setAttribute("fill","white");const g=Rr._svgFactory.createElement("use");d.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const c=Rr._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);const h=c.cloneNode();return n.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,e),u(this,En).set(r,n),r}finalizeDraw(e,t){u(this,Fl).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var l;if(!t)return;const{root:r,bbox:n,rootClass:s,path:a}=t,o=typeof e=="number"?u(this,En).get(e):e;if(o){if(r&&L(this,As,gb).call(this,o,r),n&&L(l=Rr,Eg,lx).call(l,o,n),s){const{classList:c}=o;for(const[h,d]of Object.entries(s))c.toggle(h,d)}if(a){const h=o.firstChild.firstChild;L(this,As,gb).call(this,h,a)}}}updateParent(e,t){if(t===this)return;const r=u(this,En).get(e);r&&(u(t,Vi).append(r),u(this,En).delete(e),u(t,En).set(e,r))}remove(e){u(this,Fl).delete(e),u(this,Vi)!==null&&(u(this,En).get(e).remove(),u(this,En).delete(e))}destroy(){T(this,Vi,null);for(const e of u(this,En).values())e.remove();u(this,En).clear(),u(this,Fl).clear()}};Vi=new WeakMap,En=new WeakMap,Fl=new WeakMap,_f=new WeakMap,Eg=new WeakSet,lx=function(e,[t,r,n,s]){const{style:a}=e;a.top=`${100*r}%`,a.left=`${100*t}%`,a.width=`${100*n}%`,a.height=`${100*s}%`},As=new WeakSet,pb=function(){const e=Rr._svgFactory.create(1,1,!0);return u(this,Vi).append(e),e.setAttribute("aria-hidden",!0),e},ux=function(e,t){const r=Rr._svgFactory.createElement("clipPath");e.append(r);const n=`clip_${t}`;r.setAttribute("id",n),r.setAttribute("clipPathUnits","objectBoundingBox");const s=Rr._svgFactory.createElement("use");return r.append(s),s.setAttribute("href",`#${t}`),s.classList.add("clip"),n},gb=function(e,t){for(const[r,n]of Object.entries(t))n===null?e.removeAttribute(r):e.setAttribute(r,n)},N(Rr,Eg),N(Rr,_f,0);let eg=Rr;globalThis._pdfjsTestingUtils={HighlightOutliner:q0};globalThis.pdfjsLib={AbortException:ha,AnnotationEditorLayer:Jp,AnnotationEditorParamsType:kt,AnnotationEditorType:ot,AnnotationEditorUIManager:ao,AnnotationLayer:$b,AnnotationMode:vs,AnnotationType:wr,build:uw,ColorPicker:Oh,createValidAbsoluteUrl:Pb,DOMSVGFactory:Lh,DrawLayer:eg,FeatureTest:qr,fetchData:Nc,getDocument:Bb,getFilenameFromUrl:i1,getPdfFilenameFromUrl:s1,getUuid:Ib,getXfaPageViewport:a1,GlobalWorkerOptions:yi,ImageKind:Th,InvalidPDFException:Wp,isDataScheme:kf,isPdfFile:kg,isValidExplicitDest:j1,MathClamp:dn,noContextMenu:Ei,normalizeUnicode:r1,OPS:Ph,OutputScale:Wi,PasswordResponses:e1,PDFDataRangeTransport:zb,PDFDateString:Dg,PDFWorker:Sc,PermissionFlag:J2,PixelsPerInch:da,RenderingCancelledException:Tg,ResponseException:Rh,setLayerDimensions:so,shadow:Ct,SignatureExtractor:ys,stopEvent:_r,SupportedImageMimeTypes:Xp,TextLayer:Nh,TouchManager:Ih,updateUrlHash:Rb,Util:Qe,VerbosityLevel:Cf,version:jb,XfaLayer:Ub};const nS=Object.freeze(Object.defineProperty({__proto__:null,AbortException:ha,AnnotationEditorLayer:Jp,AnnotationEditorParamsType:kt,AnnotationEditorType:ot,AnnotationEditorUIManager:ao,AnnotationLayer:$b,AnnotationMode:vs,AnnotationType:wr,ColorPicker:Oh,DOMSVGFactory:Lh,DrawLayer:eg,FeatureTest:qr,GlobalWorkerOptions:yi,ImageKind:Th,InvalidPDFException:Wp,MathClamp:dn,OPS:Ph,OutputScale:Wi,PDFDataRangeTransport:zb,PDFDateString:Dg,PDFWorker:Sc,PasswordResponses:e1,PermissionFlag:J2,PixelsPerInch:da,RenderingCancelledException:Tg,ResponseException:Rh,SignatureExtractor:ys,SupportedImageMimeTypes:Xp,TextLayer:Nh,TouchManager:Ih,Util:Qe,VerbosityLevel:Cf,XfaLayer:Ub,build:uw,createValidAbsoluteUrl:Pb,fetchData:Nc,getDocument:Bb,getFilenameFromUrl:i1,getPdfFilenameFromUrl:s1,getUuid:Ib,getXfaPageViewport:a1,isDataScheme:kf,isPdfFile:kg,isValidExplicitDest:j1,noContextMenu:Ei,normalizeUnicode:r1,setLayerDimensions:so,shadow:Ct,stopEvent:_r,updateUrlHash:Rb,version:jb},Symbol.toStringTag,{value:"Module"}));function cx(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=cx(i[e]))&&(r&&(r+=" "),r+=t)}else for(t in i)i[t]&&(r&&(r+=" "),r+=t);return r}function Ig(){for(var i,e,t=0,r="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=cx(i))&&(r&&(r+=" "),r+=e);return r}var gy=Object.prototype.hasOwnProperty;function my(i,e,t){for(t of i.keys())if(bu(t,e))return t}function bu(i,e){var t,r,n;if(i===e)return!0;if(i&&e&&(t=i.constructor)===e.constructor){if(t===Date)return i.getTime()===e.getTime();if(t===RegExp)return i.toString()===e.toString();if(t===Array){if((r=i.length)===e.length)for(;r--&&bu(i[r],e[r]););return r===-1}if(t===Set){if(i.size!==e.size)return!1;for(r of i)if(n=r,n&&typeof n=="object"&&(n=my(e,n),!n)||!e.has(n))return!1;return!0}if(t===Map){if(i.size!==e.size)return!1;for(r of i)if(n=r[0],n&&typeof n=="object"&&(n=my(e,n),!n)||!bu(r[1],e.get(n)))return!1;return!0}if(t===ArrayBuffer)i=new Uint8Array(i),e=new Uint8Array(e);else if(t===DataView){if((r=i.byteLength)===e.byteLength)for(;r--&&i.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(i)){if((r=i.byteLength)===e.byteLength)for(;r--&&i[r]===e[r];);return r===-1}if(!t||typeof i=="object"){r=0;for(t in i)if(gy.call(i,t)&&++r&&!gy.call(e,t)||!(t in e)||!bu(i[t],e[t]))return!1;return Object.keys(e).length===r}}return i!==i&&e!==e}function If(i){let e=!1;return{promise:new Promise((r,n)=>{i.then(s=>!e&&r(s)).catch(s=>!e&&n(s))}),cancel(){e=!0}}}const iS=["onCopy","onCut","onPaste"],sS=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],aS=["onFocus","onBlur"],oS=["onInput","onInvalid","onReset","onSubmit"],lS=["onLoad","onError"],uS=["onKeyDown","onKeyPress","onKeyUp"],cS=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],hS=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],dS=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],fS=["onSelect"],pS=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],gS=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],mS=["onScroll"],bS=["onWheel"],vS=["onAnimationStart","onAnimationEnd","onAnimationIteration"],yS=["onTransitionEnd"],wS=["onToggle"],xS=["onChange"],AS=[...iS,...sS,...aS,...oS,...lS,...uS,...cS,...hS,...dS,...fS,...pS,...gS,...mS,...bS,...vS,...yS,...xS,...wS];function hx(i,e){const t={};for(const r of AS){const n=i[r];n&&(e?t[r]=s=>n(s,e(r)):t[r]=n)}return t}var ES=process.env.NODE_ENV==="production",ym="Invariant failed";function Qt(i,e){if(!i){if(ES)throw new Error(ym);var t=typeof e=="function"?e():e,r=t?"".concat(ym,": ").concat(t):ym;throw new Error(r)}}var _S=process.env.NODE_ENV!=="production",dx=function(){};if(_S){var CS=function(e,t){var r=arguments.length;t=new Array(r>1?r-1:0);for(var n=1;n<r;n++)t[n-1]=arguments[n];var s=0,a="Warning: "+e.replace(/%s/g,function(){return t[s++]});typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}};dx=function(i,e,t){var r=arguments.length;t=new Array(r>2?r-2:0);for(var n=2;n<r;n++)t[n-2]=arguments[n];if(e===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");i||CS.apply(null,[e].concat(t))}}var SS=dx;const fn=_g(SS),fx=Pe.createContext(null),TS="noopener noreferrer nofollow";class kS{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Qt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){Qt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise(t=>{Qt(this.pdfDocument,"PDF document not loaded."),Qt(e,"Destination is not specified."),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{Qt(Array.isArray(t),`"${t}" is not a valid destination array.`);const r=t[0];new Promise(n=>{Qt(this.pdfDocument,"PDF document not loaded."),r instanceof Object?this.pdfDocument.getPageIndex(r).then(s=>{n(s)}).catch(()=>{Qt(!1,`"${r}" is not a valid page reference.`)}):typeof r=="number"?n(r):Qt(!1,`"${r}" is not a valid destination reference.`)}).then(n=>{const s=n+1;Qt(this.pdfViewer,"PDF viewer is not initialized."),Qt(s>=1&&s<=this.pagesCount,`"${s}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:n,pageNumber:s})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;Qt(this.pdfViewer,"PDF viewer is not initialized."),Qt(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,r){e.href=t,e.rel=this.externalLinkRel||TS,e.target=r?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}function vu({children:i,type:e}){return we.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:i})}const by={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function DS(i,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return i}}function Tc(){return Pe.useReducer(DS,{value:void 0,error:void 0})}const Ng=typeof window<"u",px=Ng&&window.location.protocol==="file:";function PS(i){return typeof i<"u"}function xo(i){return PS(i)&&i!==null}function RS(i){return typeof i=="string"}function IS(i){return i instanceof ArrayBuffer}function NS(i){return Qt(Ng,"isBlob can only be used in a browser environment"),i instanceof Blob}function mb(i){return RS(i)&&/^data:/.test(i)}function vy(i){Qt(mb(i),"Invalid data URI.");const[e="",t=""]=i.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function MS(){return Ng&&window.devicePixelRatio||1}const gx="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function yy(){fn(!px,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${gx}`)}function LS(){fn(!px,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${gx}`)}function Ul(i){i!=null&&i.cancel&&i.cancel()}function bb(i,e){return Object.defineProperty(i,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(i,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(i,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(i,"originalHeight",{get(){return this.view[3]},configurable:!0}),i}function OS(i){return i.name==="RenderingCancelledException"}function FS(i){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>{if(!r.result)return t(new Error("Error while reading a file."));e(r.result)},r.onerror=n=>{if(!n.target)return t(new Error("Error while reading a file."));const{error:s}=n.target;if(!s)return t(new Error("Error while reading a file."));switch(s.code){case s.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case s.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case s.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},r.readAsArrayBuffer(i)})}const{PDFDataRangeTransport:BS}=nS,zS=(i,e)=>{switch(e){case by.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");i(t);break}case by.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");i(t);break}}};function wy(i){return typeof i=="object"&&i!==null&&("data"in i||"range"in i||"url"in i)}const jS=Pe.forwardRef(function({children:e,className:t,error:r="Failed to load PDF file.",externalLinkRel:n,externalLinkTarget:s,file:a,inputRef:o,imageResourcesPath:l,loading:c="Loading PDF…",noData:h="No PDF file specified.",onItemClick:d,onLoadError:p,onLoadProgress:g,onLoadSuccess:y,onPassword:b=zS,onSourceError:w,onSourceSuccess:v,options:A,renderMode:E,rotate:_,scale:C,...I},k){const[D,R]=Tc(),{value:z,error:G}=D,[O,X]=Tc(),{value:S,error:J}=O,Y=Pe.useRef(new kS),W=Pe.useRef([]),fe=Pe.useRef(void 0),K=Pe.useRef(void 0);a&&a!==fe.current&&wy(a)&&(fn(!bu(a,fe.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),fe.current=a),A&&A!==K.current&&(fn(!bu(A,K.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),K.current=A);const be=Pe.useRef({scrollPageIntoView:Te=>{const{dest:x,pageNumber:U,pageIndex:B=U-1}=Te;if(d){d({dest:x,pageIndex:B,pageNumber:U});return}const F=W.current[B];if(F){F.scrollIntoView();return}fn(!1,`An internal link leading to page ${U} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});Pe.useImperativeHandle(k,()=>({linkService:Y,pages:W,viewer:be}),[]);function te(){v&&v()}function j(){G&&(fn(!1,G.toString()),w&&w(G))}function ie(){R({type:"RESET"})}Pe.useEffect(ie,[a,R]);const ae=Pe.useCallback(async()=>{if(!a)return null;if(typeof a=="string")return mb(a)?{data:vy(a)}:(yy(),{url:a});if(a instanceof BS)return{range:a};if(IS(a))return{data:a};if(Ng&&NS(a))return{data:await FS(a)};if(Qt(typeof a=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Qt(wy(a),"Invalid parameter object: need either .data, .range or .url"),"url"in a&&typeof a.url=="string"){if(mb(a.url)){const{url:Te,...x}=a;return{data:vy(Te),...x}}yy()}return a},[a]);Pe.useEffect(()=>{const Te=If(ae());return Te.promise.then(x=>{R({type:"RESOLVE",value:x})}).catch(x=>{R({type:"REJECT",error:x})}),()=>{Ul(Te)}},[ae,R]),Pe.useEffect(()=>{if(!(typeof z>"u")){if(z===!1){j();return}te()}},[z]);function H(){S&&(y&&y(S),W.current=new Array(S.numPages),Y.current.setDocument(S))}function se(){J&&(fn(!1,J.toString()),p&&p(J))}Pe.useEffect(function(){X({type:"RESET"})},[X,z]),Pe.useEffect(function(){if(!z)return;const x=A?{...z,...A}:z,U=Bb(x);g&&(U.onProgress=g),b&&(U.onPassword=b);const B=U,F=B.promise.then(M=>{X({type:"RESOLVE",value:M})}).catch(M=>{B.destroyed||X({type:"REJECT",error:M})});return()=>{F.finally(()=>B.destroy())}},[A,X,z]),Pe.useEffect(()=>{if(!(typeof S>"u")){if(S===!1){se();return}H()}},[S]),Pe.useEffect(function(){Y.current.setViewer(be.current),Y.current.setExternalLinkRel(n),Y.current.setExternalLinkTarget(s)},[n,s]);const le=Pe.useCallback((Te,x)=>{W.current[Te]=x},[]),oe=Pe.useCallback(Te=>{delete W.current[Te]},[]),ce=Pe.useMemo(()=>({imageResourcesPath:l,linkService:Y.current,onItemClick:d,pdf:S,registerPage:le,renderMode:E,rotate:_,scale:C,unregisterPage:oe}),[l,d,S,le,E,_,C,oe]),Ae=Pe.useMemo(()=>hx(I,()=>S),[I,S]);function Se(){function Te(U){return!!(U!=null&&U.pdf)}if(!Te(ce))throw new Error("pdf is undefined");const x=typeof e=="function"?e(ce):e;return we.jsx(fx.Provider,{value:ce,children:x})}function Ne(){return a?S==null?we.jsx(vu,{type:"loading",children:typeof c=="function"?c():c}):S===!1?we.jsx(vu,{type:"error",children:typeof r=="function"?r():r}):Se():we.jsx(vu,{type:"no-data",children:typeof h=="function"?h():h})}return we.jsx("div",{className:Ig("react-pdf__Document",t),ref:o,...Ae,children:Ne()})});function mx(){return Pe.useContext(fx)}function bx(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];var t=i.filter(Boolean);if(t.length<=1){var r=t[0];return r||null}return function(s){for(var a=0,o=t;a<o.length;a++){var l=o[a];typeof l=="function"?l(s):l&&(l.current=s)}}}const vx=Pe.createContext(null);function Mg(){return Pe.useContext(vx)}function US(){const i=mx(),e=Mg();Qt(e,"Unable to find Page context.");const t={...i,...e},{imageResourcesPath:r,linkService:n,onGetAnnotationsError:s,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:c,pdf:h,renderForms:d,rotate:p,scale:g=1}=t;Qt(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Qt(c,"Attempted to load page annotations, but no page was specified."),Qt(n,"Attempted to load page annotations, but no linkService was specified.");const[y,b]=Tc(),{value:w,error:v}=y,A=Pe.useRef(null);fn(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function E(){w&&a&&a(w)}function _(){v&&(fn(!1,v.toString()),s&&s(v))}Pe.useEffect(function(){b({type:"RESET"})},[b,c]),Pe.useEffect(function(){if(!c)return;const R=If(c.getAnnotations()),z=R;return R.promise.then(G=>{b({type:"RESOLVE",value:G})}).catch(G=>{b({type:"REJECT",error:G})}),()=>{Ul(z)}},[b,c]),Pe.useEffect(()=>{if(w!==void 0){if(w===!1){_();return}E()}},[w]);function C(){l&&l()}function I(D){fn(!1,`${D}`),o&&o(D)}const k=Pe.useMemo(()=>c.getViewport({scale:g,rotation:p}),[c,p,g]);return Pe.useEffect(function(){if(!h||!c||!n||!w)return;const{current:R}=A;if(!R)return;const z=k.clone({dontFlip:!0}),G={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:R,l10n:null,page:c,structTreeLayer:null,viewport:z},O={annotations:w,annotationStorage:h.annotationStorage,div:R,imageResourcesPath:r,linkService:n,page:c,renderForms:d,viewport:z};R.innerHTML="";try{new $b(G).render(O),C()}catch(X){I(X)}return()=>{}},[w,r,n,c,h,d,k]),we.jsx("div",{className:Ig("react-pdf__Page__annotations","annotationLayer"),ref:A})}const yx={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},HS=/^H(\d+)$/;function $S(i){return i in yx}function Lg(i){return"children"in i}function wx(i){return Lg(i)?i.children.length===1&&0 in i.children&&"id"in i.children[0]:!1}function VS(i){const e={};if(Lg(i)){const{role:t}=i,r=t.match(HS);if(r)e.role="heading",e["aria-level"]=Number(r[1]);else if($S(t)){const n=yx[t];n&&(e.role=n)}}return e}function xx(i){const e={};if(Lg(i)){if(i.alt!==void 0&&(e["aria-label"]=i.alt),i.lang!==void 0&&(e.lang=i.lang),wx(i)){const[t]=i.children;if(t){const r=xx(t);return{...e,...r}}}}else"id"in i&&(e["aria-owns"]=i.id);return e}function GS(i){return i?{...VS(i),...xx(i)}:null}function Ax({className:i,node:e}){const t=Pe.useMemo(()=>GS(e),[e]),r=Pe.useMemo(()=>!Lg(e)||wx(e)?null:e.children.map((n,s)=>we.jsx(Ax,{node:n},s)),[e]);return we.jsx("span",{className:i,...t,children:r})}function qS(){const i=Mg();Qt(i,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=i,[r,n]=Tc(),{value:s,error:a}=r,{customTextRenderer:o,page:l}=i;function c(){s&&t&&t(s)}function h(){a&&(fn(!1,a.toString()),e&&e(a))}return Pe.useEffect(function(){n({type:"RESET"})},[n,l]),Pe.useEffect(function(){if(o||!l)return;const p=If(l.getStructTree()),g=p;return p.promise.then(y=>{n({type:"RESOLVE",value:y})}).catch(y=>{n({type:"REJECT",error:y})}),()=>Ul(g)},[o,l,n]),Pe.useEffect(()=>{if(s!==void 0){if(s===!1){h();return}c()}},[s]),s?we.jsx(Ax,{className:"react-pdf__Page__structTree structTree",node:s}):null}const xy=vs;function WS(i){const e=Mg();Qt(e,"Unable to find Page context.");const t={...e,...i},{_className:r,canvasBackground:n,devicePixelRatio:s=MS(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:c,renderTextLayer:h,rotate:d,scale:p}=t,{canvasRef:g}=i;Qt(l,"Attempted to render page canvas, but no page was specified.");const y=Pe.useRef(null);function b(){l&&o&&o(bb(l,p))}function w(_){OS(_)||(fn(!1,_.toString()),a&&a(_))}const v=Pe.useMemo(()=>l.getViewport({scale:p*s,rotation:d}),[s,l,d,p]),A=Pe.useMemo(()=>l.getViewport({scale:p,rotation:d}),[l,d,p]);Pe.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=y;if(!C)return;C.width=v.width,C.height=v.height,C.style.width=`${Math.floor(A.width)}px`,C.style.height=`${Math.floor(A.height)}px`,C.style.visibility="hidden";const I={annotationMode:c?xy.ENABLE_FORMS:xy.ENABLE,canvasContext:C.getContext("2d",{alpha:!1}),viewport:v};n&&(I.background=n);const k=l.render(I),D=k;return k.promise.then(()=>{C.style.visibility="",b()}).catch(w),()=>Ul(D)},[n,l,c,v,A]);const E=Pe.useCallback(()=>{const{current:_}=y;_&&(_.width=0,_.height=0)},[]);return Pe.useEffect(()=>E,[E]),we.jsx("canvas",{className:`${r}__canvas`,dir:"ltr",ref:bx(g,y),style:{display:"block",userSelect:"none"},children:h?we.jsx(qS,{}):null})}function XS(i){return"str"in i}function YS(){const i=Mg();Qt(i,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:r,onRenderTextLayerError:n,onRenderTextLayerSuccess:s,page:a,pageIndex:o,pageNumber:l,rotate:c,scale:h}=i;Qt(a,"Attempted to load page text content, but no page was specified.");const[d,p]=Tc(),{value:g,error:y}=d,b=Pe.useRef(null);fn(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function w(){g&&r&&r(g)}function v(){y&&(fn(!1,y.toString()),t&&t(y))}Pe.useEffect(function(){p({type:"RESET"})},[a,p]),Pe.useEffect(function(){if(!a)return;const D=If(a.getTextContent()),R=D;return D.promise.then(z=>{p({type:"RESOLVE",value:z})}).catch(z=>{p({type:"REJECT",error:z})}),()=>Ul(R)},[a,p]),Pe.useEffect(()=>{if(g!==void 0){if(g===!1){v();return}w()}},[g]);const A=Pe.useCallback(()=>{s&&s()},[s]),E=Pe.useCallback(k=>{fn(!1,k.toString()),n&&n(k)},[n]);function _(){const k=b.current;k&&k.classList.add("selecting")}function C(){const k=b.current;k&&k.classList.remove("selecting")}const I=Pe.useMemo(()=>a.getViewport({scale:h,rotation:c}),[a,c,h]);return Pe.useLayoutEffect(function(){if(!a||!g)return;const{current:D}=b;if(!D)return;D.innerHTML="";const R=a.streamTextContent({includeMarkedContent:!0}),z={container:D,textContentSource:R,viewport:I},G=new Nh(z),O=G;return G.render().then(()=>{const X=document.createElement("div");X.className="endOfContent",D.append(X);const S=D.querySelectorAll('[role="presentation"]');if(e){let J=0;g.items.forEach((Y,W)=>{if(!XS(Y))return;const fe=S[J];if(!fe)return;const K=e({pageIndex:o,pageNumber:l,itemIndex:W,...Y});fe.innerHTML=K,J+=Y.str&&Y.hasEOL?2:1})}A()}).catch(E),()=>Ul(O)},[e,E,A,a,o,l,g,I]),we.jsx("div",{className:Ig("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:_,ref:b})}const Ay=1;function ZS(i){const t={...mx(),...i},{_className:r="react-pdf__Page",_enableRegisterUnregisterPage:n=!0,canvasBackground:s,canvasRef:a,children:o,className:l,customRenderer:c,customTextRenderer:h,devicePixelRatio:d,error:p="Failed to load the page.",height:g,inputRef:y,loading:b="Loading page…",noData:w="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:A,onGetStructTreeError:E,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:I,onLoadError:k,onLoadSuccess:D,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:z,onRenderError:G,onRenderSuccess:O,onRenderTextLayerError:X,onRenderTextLayerSuccess:S,pageIndex:J,pageNumber:Y,pdf:W,registerPage:fe,renderAnnotationLayer:K=!0,renderForms:be=!1,renderMode:te="canvas",renderTextLayer:j=!0,rotate:ie,scale:ae=Ay,unregisterPage:H,width:se,...le}=t,[oe,ce]=Tc(),{value:Ae,error:Se}=oe,Ne=Pe.useRef(null);Qt(W,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const Te=xo(Y)?Y-1:J??null,x=Y??(xo(J)?J+1:null),U=ie??(Ae?Ae.rotate:null),B=Pe.useMemo(()=>{if(!Ae)return null;let $e=1;const Xe=ae??Ay;if(se||g){const Tt=Ae.getViewport({scale:1,rotation:U});se?$e=se/Tt.width:g&&($e=g/Tt.height)}return Xe*$e},[g,Ae,U,ae,se]);Pe.useEffect(function(){return()=>{xo(Te)&&n&&H&&H(Te)}},[n,W,Te,H]);function F(){if(D){if(!Ae||!B)return;D(bb(Ae,B))}if(n&&fe){if(!xo(Te)||!Ne.current)return;fe(Te,Ne.current)}}function M(){Se&&(fn(!1,Se.toString()),k&&k(Se))}Pe.useEffect(function(){ce({type:"RESET"})},[ce,W,Te]),Pe.useEffect(function(){if(!W||!x)return;const Xe=If(W.getPage(x)),Tt=Xe;return Xe.promise.then(nr=>{ce({type:"RESOLVE",value:nr})}).catch(nr=>{ce({type:"REJECT",error:nr})}),()=>Ul(Tt)},[ce,W,x]),Pe.useEffect(()=>{if(Ae!==void 0){if(Ae===!1){M();return}F()}},[Ae,B]);const q=Pe.useMemo(()=>xo(Te)&&x&&xo(U)&&xo(B)?{_className:r,canvasBackground:s,customTextRenderer:h,devicePixelRatio:d,onGetAnnotationsError:v,onGetAnnotationsSuccess:A,onGetStructTreeError:E,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:I,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:z,onRenderError:G,onRenderSuccess:O,onRenderTextLayerError:X,onRenderTextLayerSuccess:S,page:Ae,pageIndex:Te,pageNumber:x,renderForms:be,renderTextLayer:j,rotate:U,scale:B}:null,[r,s,h,d,v,A,E,_,C,I,R,z,G,O,X,S,Ae,Te,x,be,j,U,B]),de=Pe.useMemo(()=>hx(le,()=>Ae&&(B?bb(Ae,B):void 0)),[le,Ae,B]),ye=`${Te}@${B}/${U}`;function ee(){switch(te){case"custom":return Qt(c,'renderMode was set to "custom", but no customRenderer was passed.'),we.jsx(c,{},`${ye}_custom`);case"none":return null;case"canvas":default:return we.jsx(WS,{canvasRef:a},`${ye}_canvas`)}}function Ee(){return j?we.jsx(YS,{},`${ye}_text`):null}function De(){return K?we.jsx(US,{},`${ye}_annotations`):null}function Ce(){function $e(Tt){return!!(Tt!=null&&Tt.page)}if(!$e(q))throw new Error("page is undefined");const Xe=typeof o=="function"?o(q):o;return we.jsxs(vx.Provider,{value:q,children:[ee(),Ee(),De(),Xe]})}function Me(){return x?W===null||Ae===void 0||Ae===null?we.jsx(vu,{type:"loading",children:typeof b=="function"?b():b}):W===!1||Ae===!1?we.jsx(vu,{type:"error",children:typeof p=="function"?p():p}):Ce():we.jsx(vu,{type:"no-data",children:typeof w=="function"?w():w})}return we.jsx("div",{className:Ig(r,l),"data-page-number":x,ref:bx(y,Ne),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${B}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:s||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...de,children:Me()})}LS();yi.workerSrc="pdf.worker.mjs";yi.workerSrc=`//unpkg.com/pdfjs-dist@${jb}/build/pdf.worker.min.mjs`;const KS=({onClose:i,src:e,title:t="PDF Viewer",className:r,onOpen:n})=>{const[s,a]=X2(),[o,l]=Y2(),[{currentPage:c,totalPages:h},d]=K2(),[{pan:p,isDragging:g},y]=Z2(),b=v=>{if(n==null||n(v),!v.defaultPrevented){if(!e){v.preventDefault();return}window.open(e,"_blank","noopener,noreferrer")}},w=we.jsx(Mt.IconButton,{variant:"text",color:"gray",onClick:b,children:we.jsx(W2,{className:"size-4"})});return we.jsxs("div",{className:zl("shadow rounded-t-lg flex flex-col h-full",r),children:[we.jsx(q2.Header,{onClose:i,right:w,children:t}),we.jsxs("div",{className:"grid grow h-full overflow-hidden",children:[we.jsx("div",{className:zl("col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",g?"cursor-grabbing":"cursor-grab"),onMouseDown:y.handleMouseDown,onMouseMove:y.handleMouseMove,onMouseUp:y.handleMouseUp,onMouseLeave:y.handleMouseUp,style:{userSelect:"none"},children:we.jsx("div",{style:{transform:`translate(${p.x}px, ${p.y}px)`,transition:g?"none":"transform 0.1s",pointerEvents:"none"},children:we.jsx(jS,{file:e,onLoadSuccess:({numPages:v})=>{d.setTotalPages(v)},scale:s/100,rotate:o,children:we.jsx(ZS,{pageNumber:c,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),we.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[we.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:a.zoomOut,children:we.jsx(vi.Icon,{icon:"lucide:minus"})}),we.jsx(Mt.Tooltip,{content:"Click to reset zoom and pan",children:we.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{a.reset(),y.reset()},children:[s,"%"]})}),we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:a.zoomIn,children:we.jsx(vi.Icon,{icon:"lucide:plus"})})]}),we.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.rotateClockwise,children:we.jsx(vi.Icon,{icon:"lucide:iteration-cw"})}),we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.rotateCounterClockwise,children:we.jsx(vi.Icon,{icon:"lucide:iteration-ccw"})})]}),we.jsxs(Mt.ButtonGroup,{className:"divide-x-0 ",children:[we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.prevPage,disabled:c===1,children:we.jsx(vi.Icon,{icon:"lucide:chevron-left"})}),we.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:c,onChange:v=>{const A=parseInt(v.target.value);isNaN(A)||d.goToPage(A)},type:"number",min:"1",max:h}),we.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",h]}),we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.nextPage,disabled:c===h,children:we.jsx(vi.Icon,{icon:"lucide:chevron-right"})})]})]})]})]})},QS=({...i})=>we.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...i,children:[we.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.16699 7.7334C4.91574 7.73357 6.33301 9.1516 6.33301 10.9004C6.33283 12.3905 5.30337 13.6386 3.91699 13.9756V15.25C3.91685 15.664 3.58098 15.9998 3.16699 16C2.75287 16 2.41713 15.6641 2.41699 15.25V13.9756C1.0303 13.6387 0.000177983 12.3906 0 10.9004C0 9.15149 1.41809 7.7334 3.16699 7.7334ZM3.16699 9.2334C2.24652 9.2334 1.5 9.97992 1.5 10.9004C1.50021 11.8207 2.24665 12.5664 3.16699 12.5664C4.08719 12.5662 4.8328 11.8206 4.83301 10.9004C4.83301 9.98002 4.08732 9.23357 3.16699 9.2334Z",fill:"currentColor"}),we.jsx("path",{d:"M11.8662 9.66699C12.2804 9.66699 12.6162 10.0028 12.6162 10.417V15.25C12.616 15.6641 12.2803 16 11.8662 16C11.4523 15.9998 11.1164 15.6639 11.1162 15.25V10.417C11.1162 10.0029 11.4522 9.66722 11.8662 9.66699Z",fill:"currentColor"}),we.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.8662 0C12.2804 0 12.6162 0.335786 12.6162 0.75V2.02344C14.0032 2.36025 15.0332 3.60999 15.0332 5.10059C15.0329 6.84904 13.6157 8.26633 11.8672 8.2666C10.1185 8.2666 8.70052 6.84921 8.7002 5.10059C8.7002 3.6104 9.7297 2.36066 11.1162 2.02344V0.75C11.1162 0.335929 11.4522 0.000230806 11.8662 0ZM11.8672 3.43359C10.9467 3.43359 10.2002 4.18011 10.2002 5.10059C10.2005 6.02078 10.9469 6.7666 11.8672 6.7666C12.7872 6.76633 13.5329 6.02062 13.5332 5.10059C13.5332 4.18028 12.7874 3.43387 11.8672 3.43359Z",fill:"currentColor"}),we.jsx("path",{d:"M3.16699 0C3.58107 0.000164881 3.91699 0.335888 3.91699 0.75V5.58301C3.91699 5.99712 3.58107 6.33284 3.16699 6.33301C2.75278 6.33301 2.41699 5.99722 2.41699 5.58301V0.75C2.41699 0.335786 2.75278 0 3.16699 0Z",fill:"currentColor"})]}),JS=()=>we.jsxs(Mt.Tabs,{className:"w-[800px]",children:[we.jsxs(Mt.TabsHeader,{children:[we.jsx(Mt.Tab,{value:"chats",children:"Chats"}),we.jsx(Mt.Tab,{value:"issues",children:"Issues"}),we.jsx("button",{className:"cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100",children:we.jsx(QS,{className:"size-4"})})]}),we.jsxs(Mt.TabsBody,{children:[we.jsx(Mt.TabPanel,{value:"chats",children:"ChatsPanel"}),we.jsx(Mt.TabPanel,{value:"issues",children:"IssuesPanel"})]})]});var Ex={exports:{}},Nt={},br={};function eT(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r<i.length;r++)if(Xl(i,r)){var n=i[r];if(e.call(void 0,n,r,i))return n}}function Mc(i,e){return e===void 0&&(e=Object),e&&typeof e.getOwnPropertyDescriptors=="function"&&(i=e.create(null,e.getOwnPropertyDescriptors(i))),e&&typeof e.freeze=="function"?e.freeze(i):i}function Xl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}function tT(i,e){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var t in e)Xl(e,t)&&(i[t]=e[t]);return i}var _x=Mc({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function rT(i){return Xl(_x,i.toLowerCase())}var Cx=Mc({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nT(i){return Xl(Cx,i.toLowerCase())}var Fh=Mc({script:!1,style:!1,textarea:!0,title:!0});function iT(i){var e=i.toLowerCase();return Xl(Fh,e)&&!Fh[e]}function sT(i){var e=i.toLowerCase();return Xl(Fh,e)&&Fh[e]}function Sx(i){return i===Bh.HTML}function aT(i){return Sx(i)||i===Bh.XML_XHTML_APPLICATION}var Bh=Mc({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),oT=Object.keys(Bh).map(function(i){return Bh[i]});function lT(i){return oT.indexOf(i)>-1}var uT=Mc({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});br.assign=tT;br.find=eT;br.freeze=Mc;br.HTML_BOOLEAN_ATTRIBUTES=_x;br.HTML_RAW_TEXT_ELEMENTS=Fh;br.HTML_VOID_ELEMENTS=Cx;br.hasDefaultHTMLNamespace=aT;br.hasOwn=Xl;br.isHTMLBooleanAttribute=rT;br.isHTMLRawTextElement=iT;br.isHTMLEscapableRawTextElement=sT;br.isHTMLMimeType=Sx;br.isHTMLVoidElement=nT;br.isValidMimeType=lT;br.MIME_TYPE=Bh;br.NAMESPACE=uT;var go={},cT=br;function Tx(i,e){i.prototype=Object.create(Error.prototype,{constructor:{value:i},name:{value:i.name,enumerable:!0,writable:e}})}var zh=cT.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),kx=Object.keys(zh);function Dx(i){return typeof i=="number"&&i>=1&&i<=25}function hT(i){return typeof i=="string"&&i.substring(i.length-zh.Error.length)===zh.Error}function Nf(i,e){Dx(i)?(this.name=kx[i],this.message=e||""):(this.message=i,this.name=hT(e)?e:zh.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Nf)}Tx(Nf,!0);Object.defineProperties(Nf.prototype,{code:{enumerable:!0,get:function(){var i=kx.indexOf(this.name);return Dx(i)?i:0}}});var Px={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},wm=Object.entries(Px);for(var op=0;op<wm.length;op++){var dT=wm[op][0];Nf[dT]=wm[op][1]}function qb(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,qb)}Tx(qb);go.DOMException=Nf;go.DOMExceptionName=zh;go.ExceptionCode=Px;go.ParseError=qb;var vr={},gt={};function Rx(i){try{typeof i!="function"&&(i=RegExp);var e=new i("𝌆","u").exec("𝌆");return!!e&&e[0].length===2}catch{}return!1}var Mf=Rx();function Hl(i){if(i.source[0]!=="[")throw new Error(i+" can not be used with chars");return i.source.slice(1,i.source.lastIndexOf("]"))}function kc(i,e){if(i.source[0]!=="[")throw new Error("/"+i.source+"/ can not be used with chars_without");if(!e||typeof e!="string")throw new Error(JSON.stringify(e)+" is not a valid search");if(i.source.indexOf(e)===-1)throw new Error('"'+e+'" is not is /'+i.source+"/");if(e==="-"&&i.source.indexOf(e)!==1)throw new Error('"'+e+'" is not at the first postion of /'+i.source+"/");return new RegExp(i.source.replace(e,""),Mf?"u":"")}function St(i){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var r=typeof t=="string";if(r&&e===void 0&&t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return r?t:t.source}).join(""),Mf?"mu":"m")}function it(i){if(arguments.length===0)throw new Error("no parameters provided");return St.apply(it,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var fT="�",$l=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Mf&&($l=St("[",Hl($l),"\\u{10000}-\\u{10FFFF}","]"));var Wb=/[\x20\x09\x0D\x0A]/,pT=Hl(Wb),$t=St(Wb,"+"),dr=St(Wb,"*"),jh=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Mf&&(jh=St("[",Hl(jh),"\\u{10000}-\\u{10FFFF}","]"));var gT=Hl(jh),Xb=St("[",gT,Hl(/[-.0-9\xB7]/),Hl(/[\u0300-\u036F\u203F-\u2040]/),"]"),_i=St(jh,Xb,"*"),Ey=St(Xb,"+"),mT=St("&",_i,";"),bT=it(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Uh=it(mT,"|",bT),Hh=St("%",_i,";"),Yb=it(St('"',it(/[^%&"]/,"|",Hh,"|",Uh),"*",'"'),"|",St("'",it(/[^%&']/,"|",Hh,"|",Uh),"*","'")),vT=it('"',it(/[^<&"]/,"|",Uh),"*",'"',"|","'",it(/[^<&']/,"|",Uh),"*","'"),yT=kc(jh,":"),wT=kc(Xb,":"),_y=St(yT,wT,"*"),Lf=St(_y,it(":",_y),"?"),xT=St("^",Lf,"$"),AT=St("(",Lf,")"),$h=it(/"[^"]*"|'[^']*'/),ET=St(/^<\?/,"(",_i,")",it($t,"(",$l,"*?)"),"?",/\?>/),Cy=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Og=it('"',Cy,'*"',"|","'",kc(Cy,"'"),"*'"),Ix="<!--",Nx="-->",_T=St(Ix,it(kc($l,"-"),"|",St("-",kc($l,"-"))),"*",Nx),Sy="#PCDATA",CT=it(St(/\(/,dr,Sy,it(dr,/\|/,dr,Lf),"*",dr,/\)\*/),"|",St(/\(/,dr,Sy,dr,/\)/)),ST=/[?*+]?/,TT=St(/\([^>]+\)/,ST),kT=it("EMPTY","|","ANY","|",CT,"|",TT),DT="<!ELEMENT",PT=St(DT,$t,it(Lf,"|",Hh),$t,it(kT,"|",Hh),dr,">"),RT=St("NOTATION",$t,/\(/,dr,_i,it(dr,/\|/,dr,_i),"*",dr,/\)/),IT=St(/\(/,dr,Ey,it(dr,/\|/,dr,Ey),"*",dr,/\)/),NT=it(RT,"|",IT),MT=it(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",NT),LT=it(/#REQUIRED|#IMPLIED/,"|",it(it("#FIXED",$t),"?",vT)),OT=it($t,_i,$t,MT,$t,LT),FT="<!ATTLIST",BT=St(FT,$t,_i,OT,"*",dr,">"),vb="about:legacy-compat",zT=it('"'+vb+'"',"|","'"+vb+"'"),Zb="SYSTEM",Fg="PUBLIC",Bg=it(it(Zb,$t,$h),"|",it(Fg,$t,Og,$t,$h)),jT=St("^",it(it(Zb,$t,"(?<SystemLiteralOnly>",$h,")"),"|",it(Fg,$t,"(?<PubidLiteral>",Og,")",$t,"(?<SystemLiteral>",$h,")"))),UT=it($t,"NDATA",$t,_i),HT=it(Yb,"|",it(Bg,UT,"?")),Mx="<!ENTITY",$T=St(Mx,$t,_i,$t,HT,dr,">"),VT=it(Yb,"|",Bg),GT=St(Mx,$t,"%",$t,_i,$t,VT,dr,">"),qT=it($T,"|",GT),WT=St(Fg,$t,Og),XT=St("<!NOTATION",$t,_i,$t,it(Bg,"|",WT),dr,">"),Kb=St(dr,"=",dr),Ty=/1[.]\d+/,YT=St($t,"version",Kb,it("'",Ty,"'","|",'"',Ty,'"')),ky=/[A-Za-z][-A-Za-z0-9._]*/,ZT=it($t,"encoding",Kb,it('"',ky,'"',"|","'",ky,"'")),KT=it($t,"standalone",Kb,it("'",it("yes","|","no"),"'","|",'"',it("yes","|","no"),'"')),QT=St(/^<\?xml/,YT,ZT,"?",KT,"?",dr,/\?>/),JT="<!DOCTYPE",ek="<![CDATA[",tk="]]>",rk=/<!\[CDATA\[/,nk=/\]\]>/,ik=St($l,"*?",nk),sk=St(rk,ik);gt.chars=Hl;gt.chars_without=kc;gt.detectUnicodeSupport=Rx;gt.reg=St;gt.regg=it;gt.ABOUT_LEGACY_COMPAT=vb;gt.ABOUT_LEGACY_COMPAT_SystemLiteral=zT;gt.AttlistDecl=BT;gt.CDATA_START=ek;gt.CDATA_END=tk;gt.CDSect=sk;gt.Char=$l;gt.Comment=_T;gt.COMMENT_START=Ix;gt.COMMENT_END=Nx;gt.DOCTYPE_DECL_START=JT;gt.elementdecl=PT;gt.EntityDecl=qT;gt.EntityValue=Yb;gt.ExternalID=Bg;gt.ExternalID_match=jT;gt.Name=_i;gt.NotationDecl=XT;gt.Reference=Uh;gt.PEReference=Hh;gt.PI=ET;gt.PUBLIC=Fg;gt.PubidLiteral=Og;gt.QName=Lf;gt.QName_exact=xT;gt.QName_group=AT;gt.S=$t;gt.SChar_s=pT;gt.S_OPT=dr;gt.SYSTEM=Zb;gt.SystemLiteral=$h;gt.UNICODE_REPLACEMENT_CHARACTER=fT;gt.UNICODE_SUPPORT=Mf;gt.XMLDecl=QT;var xi=br,ws=xi.find,ak=xi.hasDefaultHTMLNamespace,Dc=xi.hasOwn,ok=xi.isHTMLMimeType,lk=xi.isHTMLRawTextElement,uk=xi.isHTMLVoidElement,Ch=xi.MIME_TYPE,xs=xi.NAMESPACE,Cn=Symbol(),Lx=go,et=Lx.DOMException,ck=Lx.DOMExceptionName,es=gt;function On(i){if(i!==Cn)throw new TypeError("Illegal constructor")}function hk(i){return i!==""}function dk(i){return i?i.split(/[\t\n\f\r ]+/).filter(hk):[]}function fk(i,e){return Dc(i,e)||(i[e]=!0),i}function Dy(i){if(!i)return[];var e=dk(i);return Object.keys(e.reduce(fk,{}))}function pk(i){return function(e){return i&&i.indexOf(e)!==-1}}function Ox(i){if(!es.QName_exact.test(i))throw new et(et.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+i+'"')}function yb(i,e){Ox(e),i=i||null;var t=null,r=e;if(e.indexOf(":")>=0){var n=e.split(":");t=n[0],r=n[1]}if(t!==null&&i===null)throw new et(et.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&i!==xi.NAMESPACE.XML)throw new et(et.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&i!==xi.NAMESPACE.XMLNS)throw new et(et.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(i===xi.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new et(et.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[i,t,r]}function Lc(i,e){for(var t in i)Dc(i,t)&&(e[t]=i[t])}function Fn(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Lc(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var Bn={},Gi=Bn.ELEMENT_NODE=1,Pc=Bn.ATTRIBUTE_NODE=2,tg=Bn.TEXT_NODE=3,Fx=Bn.CDATA_SECTION_NODE=4,Bx=Bn.ENTITY_REFERENCE_NODE=5,gk=Bn.ENTITY_NODE=6,zx=Bn.PROCESSING_INSTRUCTION_NODE=7,jx=Bn.COMMENT_NODE=8,Vh=Bn.DOCUMENT_NODE=9,Ux=Bn.DOCUMENT_TYPE_NODE=10,oo=Bn.DOCUMENT_FRAGMENT_NODE=11,mk=Bn.NOTATION_NODE=12,fr=xi.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Hx(i,e){if(e.length<i.length)return Hx(e,i);var t=null;for(var r in i){if(i[r]!==e[r])return t;t=i[r]}return t}function Py(i){return i.guid||(i.guid=Math.random()),i.guid}function Mr(){}Mr.prototype={length:0,item:function(i){return i>=0&&i<this.length?this[i]:null},toString:function(i){for(var e=[],t=0;t<this.length;t++)fu(this[t],e,i);return e.join("")},filter:function(i){return Array.prototype.filter.call(this,i)},indexOf:function(i){return Array.prototype.indexOf.call(this,i)}};Mr.prototype[Symbol.iterator]=function(){var i=this,e=0;return{next:function(){return e<i.length?{value:i[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Bl(i,e){this._node=i,this._refresh=e,zg(this)}function zg(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(eA(i,"length",t.length),!i.$$length||t.length<i.$$length)for(var r=t.length;r in i;r++)Dc(i,r)&&delete i[r];Lc(t,i),i._inc=e}}Bl.prototype.item=function(i){return zg(this),this[i]||null};Fn(Bl,Mr);function Rc(){}function $x(i,e){for(var t=0;t<i.length;){if(i[t]===e)return t;t++}}function bk(i,e,t,r){if(r?e[$x(e,r)]=t:(e[e.length]=t,e.length++),i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&qx(n,i,r),vk(n,i,t))}}function Ry(i,e,t){var r=$x(e,t);if(r>=0){for(var n=e.length-1;r<=n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&qx(s,i,t),t.ownerElement=null}}}Rc.prototype={length:0,item:Mr.prototype.item,getNamedItem:function(i){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase());for(var e=0;e<this.length;){var t=this[e];if(t.nodeName===i)return t;e++}return null},setNamedItem:function(i){var e=i.ownerElement;if(e&&e!==this._ownerElement)throw new et(et.INUSE_ATTRIBUTE_ERR);var t=this.getNamedItemNS(i.namespaceURI,i.localName);return t===i?i:(bk(this._ownerElement,this,i,t),t)},setNamedItemNS:function(i){return this.setNamedItem(i)},removeNamedItem:function(i){var e=this.getNamedItem(i);if(!e)throw new et(et.NOT_FOUND_ERR,i);return Ry(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);if(!t)throw new et(et.NOT_FOUND_ERR,i?i+" : "+e:e);return Ry(this._ownerElement,this,t),t},getNamedItemNS:function(i,e){i||(i=null);for(var t=0;t<this.length;){var r=this[t];if(r.localName===e&&r.namespaceURI===i)return r;t++}return null}};Rc.prototype[Symbol.iterator]=function(){var i=this,e=0;return{next:function(){return e<i.length?{value:i[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Vx(){}Vx.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=Ch.XML_APPLICATION;i===xs.HTML?r=Ch.XML_XHTML_APPLICATION:i===xs.SVG&&(r=Ch.XML_SVG_IMAGE);var n=new lo(Cn,{contentType:r});if(n.implementation=this,n.childNodes=new Mr,n.doctype=t||null,t&&n.appendChild(t),e){var s=n.createElementNS(i,e);n.appendChild(s)}return n},createDocumentType:function(i,e,t,r){Ox(i);var n=new Hg(Cn);return n.name=i,n.nodeName=i,n.publicId=e||"",n.systemId=t||"",n.internalSubset=r||"",n.childNodes=new Mr,n},createHTMLDocument:function(i){var e=new lo(Cn,{contentType:Ch.HTML});if(e.implementation=this,e.childNodes=new Mr,i!==!1){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var t=e.createElement("html");e.appendChild(t);var r=e.createElement("head");if(t.appendChild(r),typeof i=="string"){var n=e.createElement("title");n.appendChild(e.createTextNode(i)),r.appendChild(n)}t.appendChild(e.createElement("body"))}return e}};function It(i){On(i)}It.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var i=this.getRootNode();return i&&i.nodeType===i.DOCUMENT_NODE},contains:function(i){if(!i)return!1;var e=i;do{if(this===e)return!0;e=i.parentNode}while(e);return!1},getRootNode:function(i){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(i){if(!i||this.nodeType!==i.nodeType)return!1;switch(this.nodeType){case this.DOCUMENT_TYPE_NODE:if(this.name!==i.name||this.publicId!==i.publicId||this.systemId!==i.systemId)return!1;break;case this.ELEMENT_NODE:if(this.namespaceURI!==i.namespaceURI||this.prefix!==i.prefix||this.localName!==i.localName||this.attributes.length!==i.attributes.length)return!1;for(var e=0;e<this.attributes.length;e++){var t=this.attributes.item(e);if(!t.isEqualNode(i.getAttributeNodeNS(t.namespaceURI,t.localName)))return!1}break;case this.ATTRIBUTE_NODE:if(this.namespaceURI!==i.namespaceURI||this.localName!==i.localName||this.value!==i.value)return!1;break;case this.PROCESSING_INSTRUCTION_NODE:if(this.target!==i.target||this.data!==i.data)return!1;break;case this.TEXT_NODE:case this.COMMENT_NODE:if(this.data!==i.data)return!1;break}if(this.childNodes.length!==i.childNodes.length)return!1;for(var e=0;e<this.childNodes.length;e++)if(!this.childNodes[e].isEqualNode(i.childNodes[e]))return!1;return!0},isSameNode:function(i){return this===i},insertBefore:function(i,e){return rg(this,i,e)},replaceChild:function(i,e){rg(this,i,e,Zx),e&&this.removeChild(e)},removeChild:function(i){return Xx(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return wb(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==tg&&i.nodeType==tg?(this.removeChild(e),i.appendData(e.data)):(i.normalize(),i=e)}},isSupported:function(i,e){return this.ownerDocument.implementation.hasFeature(i,e)},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Dc(t,r)&&t[r]===i)return r}e=e.nodeType==Pc?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Dc(t,i))return t[i];e=e.nodeType==Pc?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null},compareDocumentPosition:function(i){if(this===i)return 0;var e=i,t=this,r=null,n=null;if(e instanceof Vl&&(r=e,e=r.ownerElement),t instanceof Vl&&(n=t,t=n.ownerElement,r&&e&&t===e))for(var s=0,a;a=t.attributes[s];s++){if(a===r)return fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+fr.DOCUMENT_POSITION_PRECEDING;if(a===n)return fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+fr.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return fr.DOCUMENT_POSITION_DISCONNECTED+fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Py(t.ownerDocument)>Py(e.ownerDocument)?fr.DOCUMENT_POSITION_FOLLOWING:fr.DOCUMENT_POSITION_PRECEDING);if(n&&e===t)return fr.DOCUMENT_POSITION_CONTAINS+fr.DOCUMENT_POSITION_PRECEDING;if(r&&e===t)return fr.DOCUMENT_POSITION_CONTAINED_BY+fr.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=e.parentNode;l;){if(!n&&l===t)return fr.DOCUMENT_POSITION_CONTAINED_BY+fr.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var c=[],h=t.parentNode;h;){if(!r&&h===e)return fr.DOCUMENT_POSITION_CONTAINS+fr.DOCUMENT_POSITION_PRECEDING;c.push(h),h=h.parentNode}c.reverse();var d=Hx(o,c);for(var p in d.childNodes){var g=d.childNodes[p];if(g===t)return fr.DOCUMENT_POSITION_FOLLOWING;if(g===e)return fr.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(g)>=0)return fr.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(g)>=0)return fr.DOCUMENT_POSITION_PRECEDING}return 0}};function Gx(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}Lc(Bn,It);Lc(Bn,It.prototype);Lc(fr,It);Lc(fr,It.prototype);function kh(i,e){if(e(i))return!0;if(i=i.firstChild)do if(kh(i,e))return!0;while(i=i.nextSibling)}function lo(i,e){On(i);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||Ch.XML_APPLICATION,this.type=ok(this.contentType)?"html":"xml"}function vk(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===xs.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function qx(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===xs.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Wx(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t&&!t.nextSibling)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function Xx(i,e){if(i!==e.parentNode)throw new et(et.NOT_FOUND_ERR,"child's parent is not parent");var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,Wx(i.ownerDocument,i),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function yk(i){return i&&(i.nodeType===It.DOCUMENT_NODE||i.nodeType===It.DOCUMENT_FRAGMENT_NODE||i.nodeType===It.ELEMENT_NODE)}function wk(i){return i&&(i.nodeType===It.CDATA_SECTION_NODE||i.nodeType===It.COMMENT_NODE||i.nodeType===It.DOCUMENT_FRAGMENT_NODE||i.nodeType===It.DOCUMENT_TYPE_NODE||i.nodeType===It.ELEMENT_NODE||i.nodeType===It.PROCESSING_INSTRUCTION_NODE||i.nodeType===It.TEXT_NODE)}function uo(i){return i&&i.nodeType===It.DOCUMENT_TYPE_NODE}function la(i){return i&&i.nodeType===It.ELEMENT_NODE}function Yx(i){return i&&i.nodeType===It.TEXT_NODE}function Iy(i,e){var t=i.childNodes||[];if(ws(t,la)||uo(e))return!1;var r=ws(t,uo);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Ny(i,e){var t=i.childNodes||[];function r(s){return la(s)&&s!==e}if(ws(t,r))return!1;var n=ws(t,uo);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function xk(i,e,t){if(!yk(i))throw new et(et.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new et(et.NOT_FOUND_ERR,"child not in parent");if(!wk(e)||uo(e)&&i.nodeType!==It.DOCUMENT_NODE)throw new et(et.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function Ak(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===It.DOCUMENT_FRAGMENT_NODE){var s=n.filter(la);if(s.length>1||ws(n,Yx))throw new et(et.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!Iy(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(la(e)&&!Iy(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(uo(e)){if(ws(r,uo))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ws(r,la);if(t&&r.indexOf(a)<r.indexOf(t))throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&a)throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Zx(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===It.DOCUMENT_FRAGMENT_NODE){var s=n.filter(la);if(s.length>1||ws(n,Yx))throw new et(et.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!Ny(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(la(e)&&!Ny(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(uo(e)){if(ws(r,function(l){return uo(l)&&l!==t}))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ws(r,la);if(t&&r.indexOf(a)<r.indexOf(t))throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function rg(i,e,t,r){xk(i,e,t),i.nodeType===It.DOCUMENT_NODE&&(r||Ak)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===oo){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var o=t?t.previousSibling:i.lastChild;s.previousSibling=o,a.nextSibling=t,o?o.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return Wx(i.ownerDocument||i,i,e),e.nodeType==oo&&(e.firstChild=e.lastChild=null),e}lo.prototype={implementation:null,nodeName:"#document",nodeType:Vh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType===oo){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return rg(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===Gi&&(this.documentElement=i),i},removeChild:function(i){var e=Xx(this,i);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(i,e){rg(this,i,e,Zx),i.ownerDocument=this,e&&this.removeChild(e),la(i)&&(this.documentElement=i)},importNode:function(i,e){return Jx(this,i,e)},getElementById:function(i){var e=null;return kh(this.documentElement,function(t){if(t.nodeType==Gi&&t.getAttribute("id")==i)return e=t,!0}),e},createElement:function(i){var e=new co(Cn);e.ownerDocument=this,this.type==="html"&&(i=i.toLowerCase()),ak(this.contentType)&&(e.namespaceURI=xs.HTML),e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new Mr;var t=e.attributes=new Rc;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Ff(Cn);return i.ownerDocument=this,i.childNodes=new Mr,i},createTextNode:function(i){var e=new Of(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createComment:function(i){var e=new jg(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createCDATASection:function(i){var e=new Ug(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Vg(Cn);return t.ownerDocument=this,t.childNodes=new Mr,t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){if(!es.QName_exact.test(i))throw new et(et.INVALID_CHARACTER_ERR,'invalid character in name "'+i+'"');return this.type==="html"&&(i=i.toLowerCase()),this._createAttribute(i)},_createAttribute:function(i){var e=new Vl(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){if(!es.Name.test(i))throw new et(et.INVALID_CHARACTER_ERR,'not a valid xml name "'+i+'"');if(this.type==="html")throw new et("document is an html document",ck.NotSupportedError);var e=new $g(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.nodeName=i,e},createElementNS:function(i,e){var t=yb(i,e),r=new co(Cn),n=r.attributes=new Rc;return r.childNodes=new Mr,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=t[0],r.prefix=t[1],r.localName=t[2],n._ownerElement=r,r},createAttributeNS:function(i,e){var t=yb(i,e),r=new Vl(Cn);return r.ownerDocument=this,r.childNodes=new Mr,r.nodeName=e,r.name=e,r.specified=!0,r.namespaceURI=t[0],r.prefix=t[1],r.localName=t[2],r}};Fn(lo,It);function co(i){On(i),this._nsMap=Object.create(null)}co.prototype={nodeType:Gi,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===xs.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(i){return!!this.getAttributeNode(i)},getAttribute:function(i){var e=this.getAttributeNode(i);return e?e.value:null},getAttributeNode:function(i){return this._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase()),this.attributes.getNamedItem(i)},setAttribute:function(i,e){this._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase());var t=this.getAttributeNode(i);t?t.value=t.nodeValue=""+e:(t=this.ownerDocument._createAttribute(i),t.value=t.nodeValue=""+e,this.setAttributeNode(t))},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t?t.value:null},setAttributeNS:function(i,e,t){var r=yb(i,e),n=r[2],s=this.getAttributeNodeNS(i,n);s?s.value=s.nodeValue=""+t:(s=this.ownerDocument.createAttributeNS(i,e),s.value=s.nodeValue=""+t,this.setAttributeNode(s))},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByClassName:function(i){var e=Dy(i);return new Bl(this,function(t){var r=[];return e.length>0&&kh(t,function(n){if(n!==t&&n.nodeType===Gi){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var o=Dy(s);a=e.every(pk(o))}a&&r.push(n)}}}),r})},getElementsByTagName:function(i){var e=(this.nodeType===Vh?this:this.ownerDocument).type==="html",t=i.toLowerCase();return new Bl(this,function(r){var n=[];return kh(r,function(s){if(!(s===r||s.nodeType!==Gi))if(i==="*")n.push(s);else{var a=s.getQualifiedName(),o=e&&s.namespaceURI===xs.HTML?t:i;a===o&&n.push(s)}}),n})},getElementsByTagNameNS:function(i,e){return new Bl(this,function(t){var r=[];return kh(t,function(n){n!==t&&n.nodeType===Gi&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};lo.prototype.getElementsByClassName=co.prototype.getElementsByClassName;lo.prototype.getElementsByTagName=co.prototype.getElementsByTagName;lo.prototype.getElementsByTagNameNS=co.prototype.getElementsByTagNameNS;Fn(co,It);function Vl(i){On(i),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Vl.prototype.nodeType=Pc;Fn(Vl,It);function Oc(i){On(i)}Oc.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};Fn(Oc,It);function Of(i){On(i)}Of.prototype={nodeName:"#text",nodeType:tg,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Fn(Of,Oc);function jg(i){On(i)}jg.prototype={nodeName:"#comment",nodeType:jx};Fn(jg,Oc);function Ug(i){On(i)}Ug.prototype={nodeName:"#cdata-section",nodeType:Fx};Fn(Ug,Of);function Hg(i){On(i)}Hg.prototype.nodeType=Ux;Fn(Hg,It);function Qb(i){On(i)}Qb.prototype.nodeType=mk;Fn(Qb,It);function Jb(i){On(i)}Jb.prototype.nodeType=gk;Fn(Jb,It);function $g(i){On(i)}$g.prototype.nodeType=Bx;Fn($g,It);function Ff(i){On(i)}Ff.prototype.nodeName="#document-fragment";Ff.prototype.nodeType=oo;Fn(Ff,It);function Vg(i){On(i)}Vg.prototype.nodeType=zx;Fn(Vg,Oc);function Kx(){}Kx.prototype.serializeToString=function(i,e){return Qx.call(i,e)};It.prototype.toString=Qx;function Qx(i){var e=[],t=this.nodeType===Vh&&this.documentElement||this,r=t.prefix,n=t.namespaceURI;if(n&&r==null){var r=t.lookupPrefix(n);if(r==null)var s=[{namespace:n,prefix:null}]}return fu(this,e,i,s),e.join("")}function My(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===xs.XML||n===xs.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function xm(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Gx),'"')}function fu(i,e,t,r){r||(r=[]);var n=i.nodeType===Vh?i:i.ownerDocument,s=n.type==="html";if(t)if(i=t(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Gi:var a=i.attributes,o=a.length,E=i.firstChild,l=i.tagName,c=l;if(!s&&!i.prefix&&i.namespaceURI){for(var h,d=0;d<a.length;d++)if(a.item(d).name==="xmlns"){h=a.item(d).value;break}if(!h)for(var p=r.length-1;p>=0;p--){var g=r[p];if(g.prefix===""&&g.namespace===i.namespaceURI){h=g.namespace;break}}if(h!==i.namespaceURI)for(var p=r.length-1;p>=0;p--){var g=r[p];if(g.namespace===i.namespaceURI){g.prefix&&(c=g.prefix+":"+l);break}}}e.push("<",c);for(var y=0;y<o;y++){var b=a.item(y);b.prefix=="xmlns"?r.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&r.push({prefix:"",namespace:b.value})}for(var y=0;y<o;y++){var b=a.item(y);if(My(b,s,r)){var w=b.prefix||"",v=b.namespaceURI;xm(e,w?"xmlns:"+w:"xmlns",v),r.push({prefix:w,namespace:v})}fu(b,e,t,r)}if(l===c&&My(i,s,r)){var w=i.prefix||"",v=i.namespaceURI;xm(e,w?"xmlns:"+w:"xmlns",v),r.push({prefix:w,namespace:v})}var A=!E;if(A&&(s||i.namespaceURI===xs.HTML)&&(A=uk(l)),A)e.push("/>");else{if(e.push(">"),s&&lk(l))for(;E;)E.data?e.push(E.data):fu(E,e,t,r.slice()),E=E.nextSibling;else for(;E;)fu(E,e,t,r.slice()),E=E.nextSibling;e.push("</",c,">")}return;case Vh:case oo:for(var E=i.firstChild;E;)fu(E,e,t,r.slice()),E=E.nextSibling;return;case Pc:return xm(e,i.name,i.value);case tg:return e.push(i.data.replace(/[<&>]/g,Gx));case Fx:return e.push(es.CDATA_START,i.data,es.CDATA_END);case jx:return e.push(es.COMMENT_START,i.data,es.COMMENT_END);case Ux:var _=i.publicId,C=i.systemId;e.push(es.DOCTYPE_DECL_START," ",i.name),_?(e.push(" ",es.PUBLIC," ",_),C&&C!=="."&&e.push(" ",C)):C&&C!=="."&&e.push(" ",es.SYSTEM," ",C),i.internalSubset&&e.push(" [",i.internalSubset,"]"),e.push(">");return;case zx:return e.push("<?",i.target," ",i.data,"?>");case Bx:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Jx(i,e,t){var r;switch(e.nodeType){case Gi:r=e.cloneNode(!1),r.ownerDocument=i;case oo:break;case Pc:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(Jx(i,n,t)),n=n.nextSibling;return r}function wb(i,e,t){var r=new e.constructor(Cn);for(var n in e)if(Dc(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new Mr),r.ownerDocument=i,r.nodeType){case Gi:var a=e.attributes,o=r.attributes=new Rc,l=a.length;o._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(wb(i,a.item(c),!0));break;case Pc:t=!0}if(t)for(var h=e.firstChild;h;)r.appendChild(wb(i,h,t)),h=h.nextSibling;return r}function eA(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Gi:case oo:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Bl.prototype,"length",{get:function(){return zg(this),this.$$length}}),Object.defineProperty(It.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Gi:case oo:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),eA=function(e,t,r){e["$$"+t]=r}}}catch{}vr._updateLiveList=zg;vr.Attr=Vl;vr.CDATASection=Ug;vr.CharacterData=Oc;vr.Comment=jg;vr.Document=lo;vr.DocumentFragment=Ff;vr.DocumentType=Hg;vr.DOMImplementation=Vx;vr.Element=co;vr.Entity=Jb;vr.EntityReference=$g;vr.LiveNodeList=Bl;vr.NamedNodeMap=Rc;vr.Node=It;vr.NodeList=Mr;vr.Notation=Qb;vr.Text=Of;vr.ProcessingInstruction=Vg;vr.XMLSerializer=Kx;var Fc={},tA={};(function(i){var e=br.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
41
|
+
`)){const r=document.createElement("div");r.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(r)}},Cw=function(){return u(this,Xn).replaceAll(" "," ")},G0=function(t){return t.replaceAll(" "," ")},Sw=function(t){const{value:r,fontSize:n,color:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||t.value!==r||t.fontSize!==n||t.color.some((o,l)=>o!==s[l])||t.pageIndex!==a},N(Jt,ca),Ie(Jt,"_freeTextDefaultContent",""),Ie(Jt,"_internalPadding",0),Ie(Jt,"_defaultColor",null),Ie(Jt,"_defaultFontSize",10),Ie(Jt,"_type","freetext"),Ie(Jt,"_editorType",ot.FREETEXT);let V0=Jt;class qe{toSVGPath(){Wt("Abstract method `toSVGPath` must be implemented.")}get box(){Wt("Abstract getter `box` must be implemented.")}serialize(e,t){Wt("Abstract method `serialize` must be implemented.")}static _rescale(e,t,r,n,s,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o]*n,a[o+1]=r+e[o+1]*s;return a}static _rescaleAndSwap(e,t,r,n,s,a){a||(a=new Float32Array(e.length));for(let o=0,l=e.length;o<l;o+=2)a[o]=t+e[o+1]*n,a[o+1]=r+e[o]*s;return a}static _translate(e,t,r,n){n||(n=new Float32Array(e.length));for(let s=0,a=e.length;s<a;s+=2)n[s]=t+e[s],n[s+1]=r+e[s+1];return n}static svgRound(e){return Math.round(e*1e4)}static _normalizePoint(e,t,r,n,s){switch(s){case 90:return[1-t/r,e/n];case 180:return[1-e/r,1-t/n];case 270:return[t/r,1-e/n];default:return[e/r,t/n]}}static _normalizePagePoint(e,t,r){switch(r){case 90:return[1-t,e];case 180:return[1-e,1-t];case 270:return[t,1-e];default:return[e,t]}}static createBezierPoints(e,t,r,n,s,a){return[(e+5*r)/6,(t+5*n)/6,(5*r+s)/6,(5*n+a)/6,(r+s)/2,(n+a)/2]}}Ie(qe,"PRECISION",1e-4);var Zn,zi,ic,sc,hs,xt,bl,vl,af,of,ac,oc,Va,lf,yg,wg,Lr,yh,Tw,kw,Dw,Pw,Rw,Iw;const Rs=class Rs{constructor({x:e,y:t},r,n,s,a,o=0){N(this,Lr);N(this,Zn);N(this,zi,[]);N(this,ic);N(this,sc);N(this,hs,[]);N(this,xt,new Float32Array(18));N(this,bl);N(this,vl);N(this,af);N(this,of);N(this,ac);N(this,oc);N(this,Va,[]);T(this,Zn,r),T(this,oc,s*n),T(this,sc,a),u(this,xt).set([NaN,NaN,NaN,NaN,e,t],6),T(this,ic,o),T(this,of,u(Rs,lf)*n),T(this,af,u(Rs,wg)*n),T(this,ac,n),u(this,Va).push(e,t)}isEmpty(){return isNaN(u(this,xt)[8])}add({x:e,y:t}){var R;T(this,bl,e),T(this,vl,t);const[r,n,s,a]=u(this,Zn);let[o,l,c,h]=u(this,xt).subarray(8,12);const d=e-c,p=t-h,g=Math.hypot(d,p);if(g<u(this,af))return!1;const y=g-u(this,of),b=y/g,w=b*d,v=b*p;let A=o,E=l;o=c,l=h,c+=w,h+=v,(R=u(this,Va))==null||R.push(e,t);const _=-v/y,C=w/y,I=_*u(this,oc),k=C*u(this,oc);return u(this,xt).set(u(this,xt).subarray(2,8),0),u(this,xt).set([c+I,h+k],4),u(this,xt).set(u(this,xt).subarray(14,18),12),u(this,xt).set([c-I,h-k],16),isNaN(u(this,xt)[6])?(u(this,hs).length===0&&(u(this,xt).set([o+I,l+k],2),u(this,hs).push(NaN,NaN,NaN,NaN,(o+I-r)/s,(l+k-n)/a),u(this,xt).set([o-I,l-k],14),u(this,zi).push(NaN,NaN,NaN,NaN,(o-I-r)/s,(l-k-n)/a)),u(this,xt).set([A,E,o,l,c,h],6),!this.isEmpty()):(u(this,xt).set([A,E,o,l,c,h],6),Math.abs(Math.atan2(E-l,A-o)-Math.atan2(v,w))<Math.PI/2?([o,l,c,h]=u(this,xt).subarray(2,6),u(this,hs).push(NaN,NaN,NaN,NaN,((o+c)/2-r)/s,((l+h)/2-n)/a),[o,l,A,E]=u(this,xt).subarray(14,18),u(this,zi).push(NaN,NaN,NaN,NaN,((A+o)/2-r)/s,((E+l)/2-n)/a),!0):([A,E,o,l,c,h]=u(this,xt).subarray(0,6),u(this,hs).push(((A+5*o)/6-r)/s,((E+5*l)/6-n)/a,((5*o+c)/6-r)/s,((5*l+h)/6-n)/a,((o+c)/2-r)/s,((l+h)/2-n)/a),[c,h,o,l,A,E]=u(this,xt).subarray(12,18),u(this,zi).push(((A+5*o)/6-r)/s,((E+5*l)/6-n)/a,((5*o+c)/6-r)/s,((5*l+h)/6-n)/a,((o+c)/2-r)/s,((l+h)/2-n)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const e=u(this,hs),t=u(this,zi);if(isNaN(u(this,xt)[6])&&!this.isEmpty())return L(this,Lr,Tw).call(this);const r=[];r.push(`M${e[4]} ${e[5]}`);for(let n=6;n<e.length;n+=6)isNaN(e[n])?r.push(`L${e[n+4]} ${e[n+5]}`):r.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);L(this,Lr,Dw).call(this,r);for(let n=t.length-6;n>=6;n-=6)isNaN(t[n])?r.push(`L${t[n+4]} ${t[n+5]}`):r.push(`C${t[n]} ${t[n+1]} ${t[n+2]} ${t[n+3]} ${t[n+4]} ${t[n+5]}`);return L(this,Lr,kw).call(this,r),r.join(" ")}newFreeDrawOutline(e,t,r,n,s,a){return new Nw(e,t,r,n,s,a)}getOutlines(){var d;const e=u(this,hs),t=u(this,zi),r=u(this,xt),[n,s,a,o]=u(this,Zn),l=new Float32Array((((d=u(this,Va))==null?void 0:d.length)??0)+2);for(let p=0,g=l.length-2;p<g;p+=2)l[p]=(u(this,Va)[p]-n)/a,l[p+1]=(u(this,Va)[p+1]-s)/o;if(l[l.length-2]=(u(this,bl)-n)/a,l[l.length-1]=(u(this,vl)-s)/o,isNaN(r[6])&&!this.isEmpty())return L(this,Lr,Pw).call(this,l);const c=new Float32Array(u(this,hs).length+24+u(this,zi).length);let h=e.length;for(let p=0;p<h;p+=2){if(isNaN(e[p])){c[p]=c[p+1]=NaN;continue}c[p]=e[p],c[p+1]=e[p+1]}h=L(this,Lr,Iw).call(this,c,h);for(let p=t.length-6;p>=6;p-=6)for(let g=0;g<6;g+=2){if(isNaN(t[p+g])){c[h]=c[h+1]=NaN,h+=2;continue}c[h]=t[p+g],c[h+1]=t[p+g+1],h+=2}return L(this,Lr,Rw).call(this,c,h),this.newFreeDrawOutline(c,l,u(this,Zn),u(this,ac),u(this,ic),u(this,sc))}};Zn=new WeakMap,zi=new WeakMap,ic=new WeakMap,sc=new WeakMap,hs=new WeakMap,xt=new WeakMap,bl=new WeakMap,vl=new WeakMap,af=new WeakMap,of=new WeakMap,ac=new WeakMap,oc=new WeakMap,Va=new WeakMap,lf=new WeakMap,yg=new WeakMap,wg=new WeakMap,Lr=new WeakSet,yh=function(){const e=u(this,xt).subarray(4,6),t=u(this,xt).subarray(16,18),[r,n,s,a]=u(this,Zn);return[(u(this,bl)+(e[0]-t[0])/2-r)/s,(u(this,vl)+(e[1]-t[1])/2-n)/a,(u(this,bl)+(t[0]-e[0])/2-r)/s,(u(this,vl)+(t[1]-e[1])/2-n)/a]},Tw=function(){const[e,t,r,n]=u(this,Zn),[s,a,o,l]=L(this,Lr,yh).call(this);return`M${(u(this,xt)[2]-e)/r} ${(u(this,xt)[3]-t)/n} L${(u(this,xt)[4]-e)/r} ${(u(this,xt)[5]-t)/n} L${s} ${a} L${o} ${l} L${(u(this,xt)[16]-e)/r} ${(u(this,xt)[17]-t)/n} L${(u(this,xt)[14]-e)/r} ${(u(this,xt)[15]-t)/n} Z`},kw=function(e){const t=u(this,zi);e.push(`L${t[4]} ${t[5]} Z`)},Dw=function(e){const[t,r,n,s]=u(this,Zn),a=u(this,xt).subarray(4,6),o=u(this,xt).subarray(16,18),[l,c,h,d]=L(this,Lr,yh).call(this);e.push(`L${(a[0]-t)/n} ${(a[1]-r)/s} L${l} ${c} L${h} ${d} L${(o[0]-t)/n} ${(o[1]-r)/s}`)},Pw=function(e){const t=u(this,xt),[r,n,s,a]=u(this,Zn),[o,l,c,h]=L(this,Lr,yh).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(t[2]-r)/s,(t[3]-n)/a,NaN,NaN,NaN,NaN,(t[4]-r)/s,(t[5]-n)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,(t[16]-r)/s,(t[17]-n)/a,NaN,NaN,NaN,NaN,(t[14]-r)/s,(t[15]-n)/a],0),this.newFreeDrawOutline(d,e,u(this,Zn),u(this,ac),u(this,ic),u(this,sc))},Rw=function(e,t){const r=u(this,zi);return e.set([NaN,NaN,NaN,NaN,r[4],r[5]],t),t+=6},Iw=function(e,t){const r=u(this,xt).subarray(4,6),n=u(this,xt).subarray(16,18),[s,a,o,l]=u(this,Zn),[c,h,d,p]=L(this,Lr,yh).call(this);return e.set([NaN,NaN,NaN,NaN,(r[0]-s)/o,(r[1]-a)/l,NaN,NaN,NaN,NaN,c,h,NaN,NaN,NaN,NaN,d,p,NaN,NaN,NaN,NaN,(n[0]-s)/o,(n[1]-a)/l],t),t+=24},N(Rs,lf,8),N(Rs,yg,2),N(Rs,wg,u(Rs,lf)+u(Rs,yg));let Zp=Rs;var lc,yl,Js,uf,Kn,cf,Ar,xg,Mw;class Nw extends qe{constructor(t,r,n,s,a,o){super();N(this,xg);N(this,lc);N(this,yl,new Float32Array(4));N(this,Js);N(this,uf);N(this,Kn);N(this,cf);N(this,Ar);T(this,Ar,t),T(this,Kn,r),T(this,lc,n),T(this,cf,s),T(this,Js,a),T(this,uf,o),this.lastPoint=[NaN,NaN],L(this,xg,Mw).call(this,o);const[l,c,h,d]=u(this,yl);for(let p=0,g=t.length;p<g;p+=2)t[p]=(t[p]-l)/h,t[p+1]=(t[p+1]-c)/d;for(let p=0,g=r.length;p<g;p+=2)r[p]=(r[p]-l)/h,r[p+1]=(r[p+1]-c)/d}toSVGPath(){const t=[`M${u(this,Ar)[4]} ${u(this,Ar)[5]}`];for(let r=6,n=u(this,Ar).length;r<n;r+=6){if(isNaN(u(this,Ar)[r])){t.push(`L${u(this,Ar)[r+4]} ${u(this,Ar)[r+5]}`);continue}t.push(`C${u(this,Ar)[r]} ${u(this,Ar)[r+1]} ${u(this,Ar)[r+2]} ${u(this,Ar)[r+3]} ${u(this,Ar)[r+4]} ${u(this,Ar)[r+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,r,n,s],a){const o=n-t,l=s-r;let c,h;switch(a){case 0:c=qe._rescale(u(this,Ar),t,s,o,-l),h=qe._rescale(u(this,Kn),t,s,o,-l);break;case 90:c=qe._rescaleAndSwap(u(this,Ar),t,r,o,l),h=qe._rescaleAndSwap(u(this,Kn),t,r,o,l);break;case 180:c=qe._rescale(u(this,Ar),n,r,-o,l),h=qe._rescale(u(this,Kn),n,r,-o,l);break;case 270:c=qe._rescaleAndSwap(u(this,Ar),n,s,-o,-l),h=qe._rescaleAndSwap(u(this,Kn),n,s,-o,-l);break}return{outline:Array.from(c),points:[Array.from(h)]}}get box(){return u(this,yl)}newOutliner(t,r,n,s,a,o=0){return new Zp(t,r,n,s,a,o)}getNewOutline(t,r){const[n,s,a,o]=u(this,yl),[l,c,h,d]=u(this,lc),p=a*h,g=o*d,y=n*h+l,b=s*d+c,w=this.newOutliner({x:u(this,Kn)[0]*p+y,y:u(this,Kn)[1]*g+b},u(this,lc),u(this,cf),t,u(this,uf),r??u(this,Js));for(let v=2;v<u(this,Kn).length;v+=2)w.add({x:u(this,Kn)[v]*p+y,y:u(this,Kn)[v+1]*g+b});return w.getOutlines()}}lc=new WeakMap,yl=new WeakMap,Js=new WeakMap,uf=new WeakMap,Kn=new WeakMap,cf=new WeakMap,Ar=new WeakMap,xg=new WeakSet,Mw=function(t){const r=u(this,Ar);let n=r[4],s=r[5];const a=[n,s,n,s];let o=n,l=s;const c=t?Math.max:Math.min;for(let d=6,p=r.length;d<p;d+=6){const g=r[d+4],y=r[d+5];if(isNaN(r[d]))Qe.pointBoundingBox(g,y,a),l<y?(o=g,l=y):l===y&&(o=c(o,g));else{const b=[1/0,1/0,-1/0,-1/0];Qe.bezierBoundingBox(n,s,...r.slice(d,d+6),b),Qe.rectBoundingBox(...b,a),l<b[3]?(o=b[2],l=b[3]):l===b[3]&&(o=c(o,b[2]))}n=g,s=y}const h=u(this,yl);h[0]=a[0]-u(this,Js),h[1]=a[1]-u(this,Js),h[2]=a[2]-a[0]+2*u(this,Js),h[3]=a[3]-a[1]+2*u(this,Js),this.lastPoint=[o,l]};var hf,df,Ga,ji,kn,Lw,Np,Ow,Fw,W0;class q0{constructor(e,t=0,r=0,n=!0){N(this,kn);N(this,hf);N(this,df);N(this,Ga,[]);N(this,ji,[]);const s=[1/0,1/0,-1/0,-1/0],a=10**-4;for(const{x:g,y,width:b,height:w}of e){const v=Math.floor((g-t)/a)*a,A=Math.ceil((g+b+t)/a)*a,E=Math.floor((y-t)/a)*a,_=Math.ceil((y+w+t)/a)*a,C=[v,E,_,!0],I=[A,E,_,!1];u(this,Ga).push(C,I),Qe.rectBoundingBox(v,E,A,_,s)}const o=s[2]-s[0]+2*r,l=s[3]-s[1]+2*r,c=s[0]-r,h=s[1]-r,d=u(this,Ga).at(n?-1:-2),p=[d[0],d[2]];for(const g of u(this,Ga)){const[y,b,w]=g;g[0]=(y-c)/o,g[1]=(b-h)/l,g[2]=(w-h)/l}T(this,hf,new Float32Array([c,h,o,l])),T(this,df,p)}getOutlines(){u(this,Ga).sort((t,r)=>t[0]-r[0]||t[1]-r[1]||t[2]-r[2]);const e=[];for(const t of u(this,Ga))t[3]?(e.push(...L(this,kn,W0).call(this,t)),L(this,kn,Ow).call(this,t)):(L(this,kn,Fw).call(this,t),e.push(...L(this,kn,W0).call(this,t)));return L(this,kn,Lw).call(this,e)}}hf=new WeakMap,df=new WeakMap,Ga=new WeakMap,ji=new WeakMap,kn=new WeakSet,Lw=function(e){const t=[],r=new Set;for(const a of e){const[o,l,c]=a;t.push([o,l,a],[o,c,a])}t.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=t.length;a<o;a+=2){const l=t[a][2],c=t[a+1][2];l.push(c),c.push(l),r.add(l),r.add(c)}const n=[];let s;for(;r.size>0;){const a=r.values().next().value;let[o,l,c,h,d]=a;r.delete(a);let p=o,g=l;for(s=[o,c],n.push(s);;){let y;if(r.has(h))y=h;else if(r.has(d))y=d;else break;r.delete(y),[o,l,c,h,d]=y,p!==o&&(s.push(p,g,o,g===l?l:c),p=o),g=g===l?c:l}s.push(p,g)}return new eS(n,u(this,hf),u(this,df))},Np=function(e){const t=u(this,ji);let r=0,n=t.length-1;for(;r<=n;){const s=r+n>>1,a=t[s][0];if(a===e)return s;a<e?r=s+1:n=s-1}return n+1},Ow=function([,e,t]){const r=L(this,kn,Np).call(this,e);u(this,ji).splice(r,0,[e,t])},Fw=function([,e,t]){const r=L(this,kn,Np).call(this,e);for(let n=r;n<u(this,ji).length;n++){const[s,a]=u(this,ji)[n];if(s!==e)break;if(s===e&&a===t){u(this,ji).splice(n,1);return}}for(let n=r-1;n>=0;n--){const[s,a]=u(this,ji)[n];if(s!==e)break;if(s===e&&a===t){u(this,ji).splice(n,1);return}}},W0=function(e){const[t,r,n]=e,s=[[t,r,n]],a=L(this,kn,Np).call(this,n);for(let o=0;o<a;o++){const[l,c]=u(this,ji)[o];for(let h=0,d=s.length;h<d;h++){const[,p,g]=s[h];if(!(c<=p||g<=l)){if(p>=l){if(g>c)s[h][1]=c;else{if(d===1)return[];s.splice(h,1),h--,d--}continue}s[h][2]=l,g>c&&s.push([t,c,g])}}}return s};var ff,uc;class eS extends qe{constructor(t,r,n){super();N(this,ff);N(this,uc);T(this,uc,t),T(this,ff,r),this.lastPoint=n}toSVGPath(){const t=[];for(const r of u(this,uc)){let[n,s]=r;t.push(`M${n} ${s}`);for(let a=2;a<r.length;a+=2){const o=r[a],l=r[a+1];o===n?(t.push(`V${l}`),s=l):l===s&&(t.push(`H${o}`),n=o)}t.push("Z")}return t.join(" ")}serialize([t,r,n,s],a){const o=[],l=n-t,c=s-r;for(const h of u(this,uc)){const d=new Array(h.length);for(let p=0;p<h.length;p+=2)d[p]=t+h[p]*l,d[p+1]=s-h[p+1]*c;o.push(d)}return o}get box(){return u(this,ff)}get classNamesForOutlining(){return["highlightOutline"]}}ff=new WeakMap,uc=new WeakMap;class X0 extends Zp{newFreeDrawOutline(e,t,r,n,s,a){return new tS(e,t,r,n,s,a)}}class tS extends Nw{newOutliner(e,t,r,n,s,a=0){return new X0(e,t,r,n,s,a)}}var Qn,wl,cc,Nr,pf,hc,ea,gf,qa,Ui,dc,mf,qt,Y0,Z0,K0,Co,Bw,ya;const Pn=class Pn{constructor({editor:e=null,uiManager:t=null}){N(this,qt);N(this,Qn,null);N(this,wl,null);N(this,cc);N(this,Nr,null);N(this,pf,!1);N(this,hc,!1);N(this,ea,null);N(this,gf);N(this,qa,null);N(this,Ui,null);N(this,dc);var r,n;e?(T(this,hc,!1),T(this,dc,kt.HIGHLIGHT_COLOR),T(this,ea,e)):(T(this,hc,!0),T(this,dc,kt.HIGHLIGHT_DEFAULT_COLOR)),T(this,Ui,(e==null?void 0:e._uiManager)||t),T(this,gf,u(this,Ui)._eventBus),T(this,cc,((r=e==null?void 0:e.color)==null?void 0:r.toUpperCase())||((n=u(this,Ui))==null?void 0:n.highlightColors.values().next().value)||"#FFFF98"),u(Pn,mf)||T(Pn,mf,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ct(this,"_keyboardManager",new Df([[["Escape","mac+Escape"],Pn.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Pn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Pn.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Pn.prototype._moveToPrevious],[["Home","mac+Home"],Pn.prototype._moveToBeginning],[["End","mac+End"],Pn.prototype._moveToEnd]]))}renderButton(){const e=T(this,Qn,document.createElement("button"));e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",u(this,ea)&&(e.ariaControls=`${u(this,ea).id}_colorpicker_dropdown`);const t=u(this,Ui)._signal;e.addEventListener("click",L(this,qt,Co).bind(this),{signal:t}),e.addEventListener("keydown",L(this,qt,K0).bind(this),{signal:t});const r=T(this,wl,document.createElement("span"));return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=u(this,cc),e.append(r),e}renderMainDropdown(){const e=T(this,Nr,L(this,qt,Y0).call(this));return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}_colorSelectFromKeyboard(e){if(e.target===u(this,Qn)){L(this,qt,Co).call(this,e);return}const t=e.target.getAttribute("data-color");t&&L(this,qt,Z0).call(this,t,e)}_moveToNext(e){var t,r;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}if(e.target===u(this,Qn)){(t=u(this,Nr).firstChild)==null||t.focus();return}(r=e.target.nextSibling)==null||r.focus()}_moveToPrevious(e){var t,r;if(e.target===((t=u(this,Nr))==null?void 0:t.firstChild)||e.target===u(this,Qn)){u(this,qt,ya)&&this._hideDropdownFromKeyboard();return}u(this,qt,ya)||L(this,qt,Co).call(this,e),(r=e.target.previousSibling)==null||r.focus()}_moveToBeginning(e){var t;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}(t=u(this,Nr).firstChild)==null||t.focus()}_moveToEnd(e){var t;if(!u(this,qt,ya)){L(this,qt,Co).call(this,e);return}(t=u(this,Nr).lastChild)==null||t.focus()}hideDropdown(){var e,t;(e=u(this,Nr))==null||e.classList.add("hidden"),u(this,Qn).ariaExpanded="false",(t=u(this,qa))==null||t.abort(),T(this,qa,null)}_hideDropdownFromKeyboard(){var e;if(!u(this,hc)){if(!u(this,qt,ya)){(e=u(this,ea))==null||e.unselect();return}this.hideDropdown(),u(this,Qn).focus({preventScroll:!0,focusVisible:u(this,pf)})}}updateColor(e){if(u(this,wl)&&(u(this,wl).style.backgroundColor=e),!u(this,Nr))return;const t=u(this,Ui).highlightColors.values();for(const r of u(this,Nr).children)r.ariaSelected=t.next().value===e.toUpperCase()}destroy(){var e,t;(e=u(this,Qn))==null||e.remove(),T(this,Qn,null),T(this,wl,null),(t=u(this,Nr))==null||t.remove(),T(this,Nr,null)}};Qn=new WeakMap,wl=new WeakMap,cc=new WeakMap,Nr=new WeakMap,pf=new WeakMap,hc=new WeakMap,ea=new WeakMap,gf=new WeakMap,qa=new WeakMap,Ui=new WeakMap,dc=new WeakMap,mf=new WeakMap,qt=new WeakSet,Y0=function(){const e=document.createElement("div"),t=u(this,Ui)._signal;e.addEventListener("contextmenu",Ei,{signal:t}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),u(this,ea)&&(e.id=`${u(this,ea).id}_colorpicker_dropdown`);for(const[r,n]of u(this,Ui).highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=r,s.setAttribute("data-l10n-id",u(Pn,mf)[r]);const a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=n,s.ariaSelected=n===u(this,cc),s.addEventListener("click",L(this,qt,Z0).bind(this,n),{signal:t}),e.append(s)}return e.addEventListener("keydown",L(this,qt,K0).bind(this),{signal:t}),e},Z0=function(e,t){t.stopPropagation(),u(this,gf).dispatch("switchannotationeditorparams",{source:this,type:u(this,dc),value:e})},K0=function(e){Pn._keyboardManager.exec(this,e)},Co=function(e){if(u(this,qt,ya)){this.hideDropdown();return}if(T(this,pf,e.detail===0),u(this,qa)||(T(this,qa,new AbortController),window.addEventListener("pointerdown",L(this,qt,Bw).bind(this),{signal:u(this,Ui).combinedSignal(u(this,qa))})),u(this,Qn).ariaExpanded="true",u(this,Nr)){u(this,Nr).classList.remove("hidden");return}const t=T(this,Nr,L(this,qt,Y0).call(this));u(this,Qn).append(t)},Bw=function(e){var t;(t=u(this,Nr))!=null&&t.contains(e.target)||this.hideDropdown()},ya=function(){return u(this,Nr)&&!u(this,Nr).classList.contains("hidden")},N(Pn,mf,null);let Oh=Pn;var fc,bf,ta,xl,vf,Nn,yf,wf,Al,gi,Jn,Qr,pc,ra,hn,gc,mi,xf,ft,Q0,Mp,zw,jw,Uw,J0,So,wi,uu,Hw,Lp,wh,$w,Vw,Gw,qw,Ww;const Bt=class Bt extends tr{constructor(t){super({...t,name:"highlightEditor"});N(this,ft);N(this,fc,null);N(this,bf,0);N(this,ta);N(this,xl,null);N(this,vf,null);N(this,Nn,null);N(this,yf,null);N(this,wf,0);N(this,Al,null);N(this,gi,null);N(this,Jn,null);N(this,Qr,!1);N(this,pc,null);N(this,ra);N(this,hn,null);N(this,gc,"");N(this,mi);N(this,xf,"");this.color=t.color||Bt._defaultColor,T(this,mi,t.thickness||Bt._defaultThickness),T(this,ra,t.opacity||Bt._defaultOpacity),T(this,ta,t.boxes||null),T(this,xf,t.methodOfCreation||""),T(this,gc,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(T(this,Qr,!0),L(this,ft,Mp).call(this,t),L(this,ft,So).call(this)):u(this,ta)&&(T(this,fc,t.anchorNode),T(this,bf,t.anchorOffset),T(this,yf,t.focusNode),T(this,wf,t.focusOffset),L(this,ft,Q0).call(this),L(this,ft,So).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const t=Bt.prototype;return Ct(this,"_keyboardManager",new Df([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:u(this,Qr)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:u(this,mi),methodOfCreation:u(this,xf)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,r){var n;tr.initialize(t,r),Bt._defaultColor||(Bt._defaultColor=((n=r.highlightColors)==null?void 0:n.values().next().value)||"#fff066")}static updateDefaultParams(t,r){switch(t){case kt.HIGHLIGHT_DEFAULT_COLOR:Bt._defaultColor=r;break;case kt.HIGHLIGHT_THICKNESS:Bt._defaultThickness=r;break}}translateInPage(t,r){}get toolbarPosition(){return u(this,pc)}updateParams(t,r){switch(t){case kt.HIGHLIGHT_COLOR:L(this,ft,zw).call(this,r);break;case kt.HIGHLIGHT_THICKNESS:L(this,ft,jw).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[kt.HIGHLIGHT_DEFAULT_COLOR,Bt._defaultColor],[kt.HIGHLIGHT_THICKNESS,Bt._defaultThickness]]}get propertiesToUpdate(){return[[kt.HIGHLIGHT_COLOR,this.color||Bt._defaultColor],[kt.HIGHLIGHT_THICKNESS,u(this,mi)||Bt._defaultThickness],[kt.HIGHLIGHT_FREE,u(this,Qr)]]}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",T(this,vf,new Oh({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(L(this,ft,wh).call(this))}getBaseTranslation(){return[0,0]}getRect(t,r){return super.getRect(t,r,L(this,ft,wh).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){L(this,ft,J0).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(L(this,ft,So).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var n;let r=!1;this.parent&&!t?L(this,ft,J0).call(this):t&&(L(this,ft,So).call(this,t),r=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),r&&this.select()}rotate(t){var s,a,o;const{drawLayer:r}=this.parent;let n;u(this,Qr)?(t=(t-this.rotation+360)%360,n=L(s=Bt,wi,uu).call(s,u(this,gi).box,t)):n=L(a=Bt,wi,uu).call(a,[this.x,this.y,this.width,this.height],t),r.updateProperties(u(this,Jn),{bbox:n,root:{"data-main-rotation":t}}),r.updateProperties(u(this,hn),{bbox:L(o=Bt,wi,uu).call(o,u(this,Nn).box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;const t=super.render();u(this,gc)&&(t.setAttribute("aria-label",u(this,gc)),t.setAttribute("role","mark")),u(this,Qr)?t.classList.add("free"):this.div.addEventListener("keydown",L(this,ft,Hw).bind(this),{signal:this._uiManager._signal});const r=T(this,Al,document.createElement("div"));t.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=u(this,xl);const[n,s]=this.parentDimensions;return this.setDims(this.width*n,this.height*s),f1(this,u(this,Al),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:L(this,ft,Lp).call(this,!0);break;case 1:case 3:L(this,ft,Lp).call(this,!1);break}}select(){var t;super.select(),u(this,hn)&&((t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),u(this,hn)&&((t=this.parent)==null||t.drawLayer.updateProperties(u(this,hn),{rootClass:{selected:!1}}),u(this,Qr)||L(this,ft,Lp).call(this,!1))}get _mustFixPosition(){return!u(this,Qr)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(u(this,Jn),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(u(this,hn),{rootClass:{hidden:!t}}))}static startHighlighting(t,r,{target:n,x:s,y:a}){const{x:o,y:l,width:c,height:h}=n.getBoundingClientRect(),d=new AbortController,p=t.combinedSignal(d),g=y=>{d.abort(),L(this,wi,qw).call(this,t,y)};window.addEventListener("blur",g,{signal:p}),window.addEventListener("pointerup",g,{signal:p}),window.addEventListener("pointerdown",_r,{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",Ei,{signal:p}),n.addEventListener("pointermove",L(this,wi,Gw).bind(this,t),{signal:p}),this._freeHighlight=new X0({x:s,y:a},[o,l,c,h],t.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(t,r,n){var b,w,v,A;let s=null;if(t instanceof ww){const{data:{quadPoints:E,rect:_,rotation:C,id:I,color:k,opacity:D,popupRef:R},parent:{page:{pageNumber:z}}}=t;s=t={annotationType:ot.HIGHLIGHT,color:Array.from(k),opacity:D,quadPoints:E,boxes:null,pageIndex:z-1,rect:_.slice(0),rotation:C,annotationElementId:I,id:I,deleted:!1,popupRef:R}}else if(t instanceof Hb){const{data:{inkLists:E,rect:_,rotation:C,id:I,color:k,borderStyle:{rawWidth:D},popupRef:R},parent:{page:{pageNumber:z}}}=t;s=t={annotationType:ot.HIGHLIGHT,color:Array.from(k),thickness:D,inkLists:E,boxes:null,pageIndex:z-1,rect:_.slice(0),rotation:C,annotationElementId:I,id:I,deleted:!1,popupRef:R}}const{color:a,quadPoints:o,inkLists:l,opacity:c}=t,h=await super.deserialize(t,r,n);h.color=Qe.makeHexColor(...a),T(h,ra,c||1),l&&T(h,mi,t.thickness),h._initialData=s;const[d,p]=h.pageDimensions,[g,y]=h.pageTranslation;if(o){const E=T(h,ta,[]);for(let _=0;_<o.length;_+=8)E.push({x:(o[_]-g)/d,y:1-(o[_+1]-y)/p,width:(o[_+2]-o[_])/d,height:(o[_+1]-o[_+5])/p});L(b=h,ft,Q0).call(b),L(w=h,ft,So).call(w),h.rotate(h.rotation)}else if(l){T(h,Qr,!0);const E=l[0],_={x:E[0]-g,y:p-(E[1]-y)},C=new X0(_,[0,0,d,p],1,u(h,mi)/2,!0,.001);for(let D=0,R=E.length;D<R;D+=2)_.x=E[D]-g,_.y=p-(E[D+1]-y),C.add(_);const{id:I,clipPathId:k}=r.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);L(v=h,ft,Mp).call(v,{highlightOutlines:C.getOutlines(),highlightId:I,clipPathId:k}),L(A=h,ft,So).call(A),h.rotate(h.parentRotation)}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const r=this.getRect(0,0),n=tr._colorManager.convert(this.color),s={annotationType:ot.HIGHLIGHT,color:n,opacity:u(this,ra),thickness:u(this,mi),quadPoints:L(this,ft,$w).call(this),outlines:L(this,ft,Vw).call(this,r),pageIndex:this.pageIndex,rect:r,rotation:L(this,ft,wh).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!L(this,ft,Ww).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};fc=new WeakMap,bf=new WeakMap,ta=new WeakMap,xl=new WeakMap,vf=new WeakMap,Nn=new WeakMap,yf=new WeakMap,wf=new WeakMap,Al=new WeakMap,gi=new WeakMap,Jn=new WeakMap,Qr=new WeakMap,pc=new WeakMap,ra=new WeakMap,hn=new WeakMap,gc=new WeakMap,mi=new WeakMap,xf=new WeakMap,ft=new WeakSet,Q0=function(){const t=new q0(u(this,ta),.001);T(this,gi,t.getOutlines()),[this.x,this.y,this.width,this.height]=u(this,gi).box;const r=new q0(u(this,ta),.0025,.001,this._uiManager.direction==="ltr");T(this,Nn,r.getOutlines());const{lastPoint:n}=u(this,Nn);T(this,pc,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])},Mp=function({highlightOutlines:t,highlightId:r,clipPathId:n}){var d,p;if(T(this,gi,t),T(this,Nn,t.getNewOutline(u(this,mi)/2+1.5,.0025)),r>=0)T(this,Jn,r),T(this,xl,n),this.parent.drawLayer.finalizeDraw(r,{bbox:t.box,path:{d:t.toSVGPath()}}),T(this,hn,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:u(this,Nn).box,path:{d:u(this,Nn).toSVGPath()}},!0));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(u(this,Jn),{bbox:L(d=Bt,wi,uu).call(d,u(this,gi).box,(g-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(u(this,hn),{bbox:L(p=Bt,wi,uu).call(p,u(this,Nn).box,g),path:{d:u(this,Nn).toSVGPath()}})}const[a,o,l,c]=t.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=l,this.height=c;break;case 90:{const[g,y]=this.parentDimensions;this.x=o,this.y=1-a,this.width=l*y/g,this.height=c*g/y;break}case 180:this.x=1-a,this.y=1-o,this.width=l,this.height=c;break;case 270:{const[g,y]=this.parentDimensions;this.x=1-o,this.y=a,this.width=l*y/g,this.height=c*g/y;break}}const{lastPoint:h}=u(this,Nn);T(this,pc,[(h[0]-a)/l,(h[1]-o)/c])},zw=function(t){const r=(a,o)=>{var l,c;this.color=a,T(this,ra,o),(l=this.parent)==null||l.drawLayer.updateProperties(u(this,Jn),{root:{fill:a,"fill-opacity":o}}),(c=u(this,vf))==null||c.updateColor(a)},n=this.color,s=u(this,ra);this.addCommands({cmd:r.bind(this,t,Bt._defaultOpacity),undo:r.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)},jw=function(t){const r=u(this,mi),n=s=>{T(this,mi,s),L(this,ft,Uw).call(this,s)};this.addCommands({cmd:n.bind(this,t),undo:n.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:kt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)},Uw=function(t){if(!u(this,Qr))return;L(this,ft,Mp).call(this,{highlightOutlines:u(this,gi).getNewOutline(t/2)}),this.fixAndSetPosition();const[r,n]=this.parentDimensions;this.setDims(this.width*r,this.height*n)},J0=function(){u(this,Jn)===null||!this.parent||(this.parent.drawLayer.remove(u(this,Jn)),T(this,Jn,null),this.parent.drawLayer.remove(u(this,hn)),T(this,hn,null))},So=function(t=this.parent){u(this,Jn)===null&&({id:bn(this,Jn)._,clipPathId:bn(this,xl)._}=t.drawLayer.draw({bbox:u(this,gi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":u(this,ra)},rootClass:{highlight:!0,free:u(this,Qr)},path:{d:u(this,gi).toSVGPath()}},!1,!0),T(this,hn,t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:u(this,Qr)},bbox:u(this,Nn).box,path:{d:u(this,Nn).toSVGPath()}},u(this,Qr))),u(this,Al)&&(u(this,Al).style.clipPath=u(this,xl)))},wi=new WeakSet,uu=function([t,r,n,s],a){switch(a){case 90:return[1-r-s,t,s,n];case 180:return[1-t-n,1-r-s,n,s];case 270:return[r,1-t-n,s,n]}return[t,r,n,s]},Hw=function(t){Bt._keyboardManager.exec(this,t)},Lp=function(t){if(!u(this,fc))return;const r=window.getSelection();t?r.setPosition(u(this,fc),u(this,bf)):r.setPosition(u(this,yf),u(this,wf))},wh=function(){return u(this,Qr)?this.rotation:0},$w=function(){if(u(this,Qr))return null;const[t,r]=this.pageDimensions,[n,s]=this.pageTranslation,a=u(this,ta),o=new Float32Array(a.length*8);let l=0;for(const{x:c,y:h,width:d,height:p}of a){const g=c*t+n,y=(1-h)*r+s;o[l]=o[l+4]=g,o[l+1]=o[l+3]=y,o[l+2]=o[l+6]=g+d*t,o[l+5]=o[l+7]=y-p*r,l+=8}return o},Vw=function(t){return u(this,gi).serialize(t,L(this,ft,wh).call(this))},Gw=function(t,r){this._freeHighlight.add(r)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},qw=function(t,r){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},Ww=function(t){const{color:r}=this._initialData;return t.color.some((n,s)=>n!==r[s])},N(Bt,wi),Ie(Bt,"_defaultColor",null),Ie(Bt,"_defaultOpacity",1),Ie(Bt,"_defaultThickness",12),Ie(Bt,"_type","highlight"),Ie(Bt,"_editorType",ot.HIGHLIGHT),Ie(Bt,"_freeHighlightId",-1),Ie(Bt,"_freeHighlight",null),Ie(Bt,"_freeHighlightClipId","");let Kp=Bt;var El;class Xw{constructor(){N(this,El,Object.create(null))}updateProperty(e,t){this[e]=t,this.updateSVGProperty(e,t)}updateProperties(e){if(e)for(const[t,r]of Object.entries(e))t.startsWith("_")||this.updateProperty(t,r)}updateSVGProperty(e,t){u(this,El)[e]=t}toSVGProperties(){const e=u(this,El);return T(this,El,Object.create(null)),{root:e}}reset(){T(this,El,Object.create(null))}updateAll(e=this){this.updateProperties(e)}clone(){Wt("Not implemented")}}El=new WeakMap;var ei,mc,Ur,_l,Cl,Wa,Xa,Ya,Sl,Lt,eb,tb,rb,xh,Yw,Op,Ah,cu;const We=class We extends tr{constructor(t){super(t);N(this,Lt);N(this,ei,null);N(this,mc);Ie(this,"_drawId",null);T(this,mc,t.mustBeCommitted||!1),this._addOutlines(t)}_addOutlines(t){t.drawOutlines&&(L(this,Lt,eb).call(this,t),L(this,Lt,xh).call(this))}static _mergeSVGProperties(t,r){const n=new Set(Object.keys(t));for(const[s,a]of Object.entries(r))n.has(s)?Object.assign(t[s],a):t[s]=a;return t}static getDefaultDrawingOptions(t){Wt("Not implemented")}static get typesMap(){Wt("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,r){const n=this.typesMap.get(t);n&&this._defaultDrawingOptions.updateProperty(n,r),this._currentParent&&(u(We,Ur).updateProperty(n,r),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,r){const n=this.constructor.typesMap.get(t);n&&this._updateProperty(t,n,r)}static get defaultPropertiesToUpdate(){const t=[],r=this._defaultDrawingOptions;for(const[n,s]of this.typesMap)t.push([n,r[s]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:r}=this;for(const[n,s]of this.constructor.typesMap)t.push([n,r[s]]);return t}_updateProperty(t,r,n){const s=this._drawingOptions,a=s[r],o=l=>{var h;s.updateProperty(r,l);const c=u(this,ei).updateProperty(r,l);c&&L(this,Lt,Ah).call(this,c),(h=this.parent)==null||h.drawLayer.updateProperties(this._drawId,s.toSVGProperties())};this.addCommands({cmd:o.bind(this,n),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathResizingSVGProperties(L(this,Lt,Op).call(this)),{bbox:L(this,Lt,cu).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathResizedSVGProperties(L(this,Lt,Op).call(this)),{bbox:L(this,Lt,cu).call(this)}))}_onTranslating(t,r){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,{bbox:L(this,Lt,cu).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties(u(this,ei).getPathTranslatedSVGProperties(L(this,Lt,Op).call(this),this.parentDimensions),{bbox:L(this,Lt,cu).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,u(this,mc)&&(T(this,mc,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){L(this,Lt,rb).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(L(this,Lt,xh).call(this),L(this,Lt,Ah).call(this,u(this,ei).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var n;let r=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),L(this,Lt,rb).call(this)):t&&(this._uiManager.addShouldRescale(this),L(this,Lt,xh).call(this,t),r=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(t),r&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,We._mergeSVGProperties({bbox:L(this,Lt,cu).call(this)},u(this,ei).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&L(this,Lt,Ah).call(this,u(this,ei).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let t,r;this._isCopy&&(t=this.x,r=this.y);const n=super.render();n.classList.add("draw");const s=document.createElement("div");n.append(s),s.setAttribute("aria-hidden","true"),s.className="internal";const[a,o]=this.parentDimensions;return this.setDims(this.width*a,this.height*o),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,r),n}static createDrawerInstance(t,r,n,s,a){Wt("Not implemented")}static startDrawing(t,r,n,s){var w;const{target:a,offsetX:o,offsetY:l,pointerId:c,pointerType:h}=s;if(u(We,Xa)&&u(We,Xa)!==h)return;const{viewport:{rotation:d}}=t,{width:p,height:g}=a.getBoundingClientRect(),y=T(We,_l,new AbortController),b=t.combinedSignal(y);if(u(We,Wa)||T(We,Wa,c),u(We,Xa)??T(We,Xa,h),window.addEventListener("pointerup",v=>{var A;u(We,Wa)===v.pointerId?this._endDraw(v):(A=u(We,Ya))==null||A.delete(v.pointerId)},{signal:b}),window.addEventListener("pointercancel",v=>{var A;u(We,Wa)===v.pointerId?this._currentParent.endDrawingSession():(A=u(We,Ya))==null||A.delete(v.pointerId)},{signal:b}),window.addEventListener("pointerdown",v=>{u(We,Xa)===v.pointerType&&((u(We,Ya)||T(We,Ya,new Set)).add(v.pointerId),u(We,Ur).isCancellable()&&(u(We,Ur).removeLastElement(),u(We,Ur).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:b}),window.addEventListener("contextmenu",Ei,{signal:b}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:b}),a.addEventListener("touchmove",v=>{v.timeStamp===u(We,Sl)&&_r(v)},{signal:b}),t.toggleDrawing(),(w=r._editorUndoBar)==null||w.hide(),u(We,Ur)){t.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).startNew(o,l,p,g,d));return}r.updateUIForDefaultProperties(this),T(We,Ur,this.createDrawerInstance(o,l,p,g,d)),T(We,Cl,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(u(We,Cl).toSVGProperties(),u(We,Ur).defaultSVGProperties),!0,!1)}static _drawMove(t){var a;if(T(We,Sl,-1),!u(We,Ur))return;const{offsetX:r,offsetY:n,pointerId:s}=t;if(u(We,Wa)===s){if(((a=u(We,Ya))==null?void 0:a.size)>=1){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).add(r,n)),T(We,Sl,t.timeStamp),_r(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,T(We,Ur,null),T(We,Cl,null),T(We,Xa,null),T(We,Sl,NaN)),u(We,_l)&&(u(We,_l).abort(),T(We,_l,null),T(We,Wa,NaN),T(We,Ya,null))}static _endDraw(t){const r=this._currentParent;if(r){if(r.toggleDrawing(!0),this._cleanup(!1),(t==null?void 0:t.target)===r.div&&r.drawLayer.updateProperties(this._currentDrawId,u(We,Ur).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const n=u(We,Ur),s=this._currentDrawId,a=n.getLastElement();r.addCommands({cmd:()=>{r.drawLayer.updateProperties(s,n.setLastElement(a))},undo:()=>{r.drawLayer.updateProperties(s,n.removeLastElement())},mustExec:!1,type:kt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const r=this._currentParent;if(!r)return null;if(r.toggleDrawing(!0),r.cleanUndoStack(kt.DRAW_STEP),!u(We,Ur).isEmpty()){const{pageDimensions:[n,s],scale:a}=r,o=r.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:u(We,Ur).getOutlines(n*a,s*a,a,this._INNER_MARGIN),drawingOptions:u(We,Cl),mustBeCommitted:!t});return this._cleanup(!0),o}return r.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,r,n,s,a,o){Wt("Not implemented")}static async deserialize(t,r,n){var d,p;const{rawDims:{pageWidth:s,pageHeight:a,pageX:o,pageY:l}}=r.viewport,c=this.deserializeDraw(o,l,s,a,this._INNER_MARGIN,t),h=await super.deserialize(t,r,n);return h.createDrawingOptions(t),L(d=h,Lt,eb).call(d,{drawOutlines:c}),L(p=h,Lt,xh).call(p),h.onScaleChanging(),h.rotate(),h}serializeDraw(t){const[r,n]=this.pageTranslation,[s,a]=this.pageDimensions;return u(this,ei).serialize([r,n,s,a],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};ei=new WeakMap,mc=new WeakMap,Ur=new WeakMap,_l=new WeakMap,Cl=new WeakMap,Wa=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,Sl=new WeakMap,Lt=new WeakSet,eb=function({drawOutlines:t,drawId:r,drawingOptions:n}){T(this,ei,t),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),r>=0?(this._drawId=r,this.parent.drawLayer.finalizeDraw(r,t.defaultProperties)):this._drawId=L(this,Lt,tb).call(this,t,this.parent),L(this,Lt,Ah).call(this,t.box)},tb=function(t,r){const{id:n}=r.drawLayer.draw(We._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return n},rb=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},xh=function(t=this.parent){if(!(this._drawId!==null&&this.parent===t)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=L(this,Lt,tb).call(this,u(this,ei),t)}},Yw=function([t,r,n,s]){const{parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[r,1-t,n*(o/a),s*(a/o)];case 180:return[1-t,1-r,n,s];case 270:return[1-r,t,n*(o/a),s*(a/o)];default:return[t,r,n,s]}},Op=function(){const{x:t,y:r,width:n,height:s,parentDimensions:[a,o],rotation:l}=this;switch(l){case 90:return[1-r,t,n*(a/o),s*(o/a)];case 180:return[1-t,1-r,n,s];case 270:return[r,1-t,n*(a/o),s*(o/a)];default:return[t,r,n,s]}},Ah=function(t){if([this.x,this.y,this.width,this.height]=L(this,Lt,Yw).call(this,t),this.div){this.fixAndSetPosition();const[r,n]=this.parentDimensions;this.setDims(this.width*r,this.height*n)}this._onResized()},cu=function(){const{x:t,y:r,width:n,height:s,rotation:a,parentRotation:o,parentDimensions:[l,c]}=this;switch((a*4+o)/90){case 1:return[1-r-s,t,s,n];case 2:return[1-t-n,1-r-s,n,s];case 3:return[r,1-t-n,s,n];case 4:return[t,r-n*(l/c),s*(c/l),n*(l/c)];case 5:return[1-r,t,n*(l/c),s*(c/l)];case 6:return[1-t-s*(c/l),1-r,s*(c/l),n*(l/c)];case 7:return[r-n*(l/c),1-t-s*(c/l),n*(l/c),s*(c/l)];case 8:return[t-n,r-s,n,s];case 9:return[1-r,t-n,s,n];case 10:return[1-t,1-r,n,s];case 11:return[r-s,1-t,s,n];case 12:return[t-s*(c/l),r,s*(c/l),n*(l/c)];case 13:return[1-r-n*(l/c),t-s*(c/l),n*(l/c),s*(c/l)];case 14:return[1-t,1-r-n*(l/c),s*(c/l),n*(l/c)];case 15:return[r,1-t,n*(l/c),s*(c/l)];default:return[t,r,n,s]}},Ie(We,"_currentDrawId",-1),Ie(We,"_currentParent",null),N(We,Ur,null),N(We,_l,null),N(We,Cl,null),N(We,Wa,NaN),N(We,Xa,null),N(We,Ya,null),N(We,Sl,NaN),Ie(We,"_INNER_MARGIN",3);let Qp=We;var ds,Hr,$r,Tl,bc,xn,Jr,bi,kl,Dl,Pl,vc,Fp;class rS{constructor(e,t,r,n,s,a){N(this,vc);N(this,ds,new Float64Array(6));N(this,Hr);N(this,$r);N(this,Tl);N(this,bc);N(this,xn);N(this,Jr,"");N(this,bi,0);N(this,kl,new Rf);N(this,Dl);N(this,Pl);T(this,Dl,r),T(this,Pl,n),T(this,Tl,s),T(this,bc,a),[e,t]=L(this,vc,Fp).call(this,e,t);const o=T(this,Hr,[NaN,NaN,NaN,NaN,e,t]);T(this,xn,[e,t]),T(this,$r,[{line:o,points:u(this,xn)}]),u(this,ds).set(o,0)}updateProperty(e,t){e==="stroke-width"&&T(this,bc,t)}isEmpty(){return!u(this,$r)||u(this,$r).length===0}isCancellable(){return u(this,xn).length<=10}add(e,t){[e,t]=L(this,vc,Fp).call(this,e,t);const[r,n,s,a]=u(this,ds).subarray(2,6),o=e-s,l=t-a;return Math.hypot(u(this,Dl)*o,u(this,Pl)*l)<=2?null:(u(this,xn).push(e,t),isNaN(r)?(u(this,ds).set([s,a,e,t],2),u(this,Hr).push(NaN,NaN,NaN,NaN,e,t),{path:{d:this.toSVGPath()}}):(isNaN(u(this,ds)[0])&&u(this,Hr).splice(6,6),u(this,ds).set([r,n,s,a,e,t],0),u(this,Hr).push(...qe.createBezierPoints(r,n,s,a,e,t)),{path:{d:this.toSVGPath()}}))}end(e,t){const r=this.add(e,t);return r||(u(this,xn).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(e,t,r,n,s){T(this,Dl,r),T(this,Pl,n),T(this,Tl,s),[e,t]=L(this,vc,Fp).call(this,e,t);const a=T(this,Hr,[NaN,NaN,NaN,NaN,e,t]);T(this,xn,[e,t]);const o=u(this,$r).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),u(this,$r).push({line:a,points:u(this,xn)}),u(this,ds).set(a,0),T(this,bi,0),this.toSVGPath(),null}getLastElement(){return u(this,$r).at(-1)}setLastElement(e){return u(this,$r)?(u(this,$r).push(e),T(this,Hr,e.line),T(this,xn,e.points),T(this,bi,0),{path:{d:this.toSVGPath()}}):u(this,kl).setLastElement(e)}removeLastElement(){if(!u(this,$r))return u(this,kl).removeLastElement();u(this,$r).pop(),T(this,Jr,"");for(let e=0,t=u(this,$r).length;e<t;e++){const{line:r,points:n}=u(this,$r)[e];T(this,Hr,r),T(this,xn,n),T(this,bi,0),this.toSVGPath()}return{path:{d:u(this,Jr)}}}toSVGPath(){const e=qe.svgRound(u(this,Hr)[4]),t=qe.svgRound(u(this,Hr)[5]);if(u(this,xn).length===2)return T(this,Jr,`${u(this,Jr)} M ${e} ${t} Z`),u(this,Jr);if(u(this,xn).length<=6){const n=u(this,Jr).lastIndexOf("M");T(this,Jr,`${u(this,Jr).slice(0,n)} M ${e} ${t}`),T(this,bi,6)}if(u(this,xn).length===4){const n=qe.svgRound(u(this,Hr)[10]),s=qe.svgRound(u(this,Hr)[11]);return T(this,Jr,`${u(this,Jr)} L ${n} ${s}`),T(this,bi,12),u(this,Jr)}const r=[];u(this,bi)===0&&(r.push(`M ${e} ${t}`),T(this,bi,6));for(let n=u(this,bi),s=u(this,Hr).length;n<s;n+=6){const[a,o,l,c,h,d]=u(this,Hr).slice(n,n+6).map(qe.svgRound);r.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}return T(this,Jr,u(this,Jr)+r.join(" ")),T(this,bi,u(this,Hr).length),u(this,Jr)}getOutlines(e,t,r,n){const s=u(this,$r).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),u(this,kl).build(u(this,$r),e,t,r,u(this,Tl),u(this,bc),n),T(this,ds,null),T(this,Hr,null),T(this,$r,null),T(this,Jr,null),u(this,kl)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}ds=new WeakMap,Hr=new WeakMap,$r=new WeakMap,Tl=new WeakMap,bc=new WeakMap,xn=new WeakMap,Jr=new WeakMap,bi=new WeakMap,kl=new WeakMap,Dl=new WeakMap,Pl=new WeakMap,vc=new WeakSet,Fp=function(e,t){return qe._normalizePoint(e,t,u(this,Dl),u(this,Pl),u(this,Tl))};var An,Af,Ef,ti,fs,ps,yc,wc,Rl,rn,Ds,Zw,Kw,Qw;class Rf extends qe{constructor(){super(...arguments);N(this,rn);N(this,An);N(this,Af,0);N(this,Ef);N(this,ti);N(this,fs);N(this,ps);N(this,yc);N(this,wc);N(this,Rl)}build(t,r,n,s,a,o,l){T(this,fs,r),T(this,ps,n),T(this,yc,s),T(this,wc,a),T(this,Rl,o),T(this,Ef,l??0),T(this,ti,t),L(this,rn,Kw).call(this)}get thickness(){return u(this,Rl)}setLastElement(t){return u(this,ti).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return u(this,ti).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:r}of u(this,ti)){if(t.push(`M${qe.svgRound(r[4])} ${qe.svgRound(r[5])}`),r.length===6){t.push("Z");continue}if(r.length===12&&isNaN(r[6])){t.push(`L${qe.svgRound(r[10])} ${qe.svgRound(r[11])}`);continue}for(let n=6,s=r.length;n<s;n+=6){const[a,o,l,c,h,d]=r.subarray(n,n+6).map(qe.svgRound);t.push(`C${a} ${o} ${l} ${c} ${h} ${d}`)}}return t.join("")}serialize([t,r,n,s],a){const o=[],l=[],[c,h,d,p]=L(this,rn,Zw).call(this);let g,y,b,w,v,A,E,_,C;switch(u(this,wc)){case 0:C=qe._rescale,g=t,y=r+s,b=n,w=-s,v=t+c*n,A=r+(1-h-p)*s,E=t+(c+d)*n,_=r+(1-h)*s;break;case 90:C=qe._rescaleAndSwap,g=t,y=r,b=n,w=s,v=t+h*n,A=r+c*s,E=t+(h+p)*n,_=r+(c+d)*s;break;case 180:C=qe._rescale,g=t+n,y=r,b=-n,w=s,v=t+(1-c-d)*n,A=r+h*s,E=t+(1-c)*n,_=r+(h+p)*s;break;case 270:C=qe._rescaleAndSwap,g=t+n,y=r+s,b=-n,w=-s,v=t+(1-h-p)*n,A=r+(1-c-d)*s,E=t+(1-h)*n,_=r+(1-c)*s;break}for(const{line:I,points:k}of u(this,ti))o.push(C(I,g,y,b,w,a?new Array(I.length):null)),l.push(C(k,g,y,b,w,a?new Array(k.length):null));return{lines:o,points:l,rect:[v,A,E,_]}}static deserialize(t,r,n,s,a,{paths:{lines:o,points:l},rotation:c,thickness:h}){const d=[];let p,g,y,b,w;switch(c){case 0:w=qe._rescale,p=-t/n,g=r/s+1,y=1/n,b=-1/s;break;case 90:w=qe._rescaleAndSwap,p=-r/s,g=-t/n,y=1/s,b=1/n;break;case 180:w=qe._rescale,p=t/n+1,g=-r/s,y=-1/n,b=1/s;break;case 270:w=qe._rescaleAndSwap,p=r/s+1,g=t/n+1,y=-1/s,b=-1/n;break}if(!o){o=[];for(const A of l){const E=A.length;if(E===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1]]));continue}if(E===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1],NaN,NaN,NaN,NaN,A[2],A[3]]));continue}const _=new Float32Array(3*(E-2));o.push(_);let[C,I,k,D]=A.subarray(0,4);_.set([NaN,NaN,NaN,NaN,C,I],0);for(let R=4;R<E;R+=2){const z=A[R],G=A[R+1];_.set(qe.createBezierPoints(C,I,k,D,z,G),(R-2)*3),[C,I,k,D]=[k,D,z,G]}}}for(let A=0,E=o.length;A<E;A++)d.push({line:w(o[A].map(_=>_??NaN),p,g,y,b),points:w(l[A].map(_=>_??NaN),p,g,y,b)});const v=new this.prototype.constructor;return v.build(d,n,s,1,c,h,a),v}get box(){return u(this,An)}updateProperty(t,r){return t==="stroke-width"?L(this,rn,Qw).call(this,r):null}updateParentDimensions([t,r],n){const[s,a]=L(this,rn,Ds).call(this);T(this,fs,t),T(this,ps,r),T(this,yc,n);const[o,l]=L(this,rn,Ds).call(this),c=o-s,h=l-a,d=u(this,An);return d[0]-=c,d[1]-=h,d[2]+=2*c,d[3]+=2*h,d}updateRotation(t){return T(this,Af,t),{path:{transform:this.rotationTransform}}}get viewBox(){return u(this,An).map(qe.svgRound).join(" ")}get defaultProperties(){const[t,r]=u(this,An);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`}}}get rotationTransform(){const[,,t,r]=u(this,An);let n=0,s=0,a=0,o=0,l=0,c=0;switch(u(this,Af)){case 90:s=r/t,a=-t/r,l=t;break;case 180:n=-1,o=-1,l=t,c=r;break;case 270:s=-r/t,a=t/r,c=r;break;default:return""}return`matrix(${n} ${s} ${a} ${o} ${qe.svgRound(l)} ${qe.svgRound(c)})`}getPathResizingSVGProperties([t,r,n,s]){const[a,o]=L(this,rn,Ds).call(this),[l,c,h,d]=u(this,An);if(Math.abs(h-a)<=qe.PRECISION||Math.abs(d-o)<=qe.PRECISION){const w=t+n/2-(l+h/2),v=r+s/2-(c+d/2);return{path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:`${this.rotationTransform} translate(${w} ${v})`}}}const p=(n-2*a)/(h-2*a),g=(s-2*o)/(d-2*o),y=h/n,b=d/s;return{path:{"transform-origin":`${qe.svgRound(l)} ${qe.svgRound(c)}`,transform:`${this.rotationTransform} scale(${y} ${b}) translate(${qe.svgRound(a)} ${qe.svgRound(o)}) scale(${p} ${g}) translate(${qe.svgRound(-a)} ${qe.svgRound(-o)})`}}}getPathResizedSVGProperties([t,r,n,s]){const[a,o]=L(this,rn,Ds).call(this),l=u(this,An),[c,h,d,p]=l;if(l[0]=t,l[1]=r,l[2]=n,l[3]=s,Math.abs(d-a)<=qe.PRECISION||Math.abs(p-o)<=qe.PRECISION){const v=t+n/2-(c+d/2),A=r+s/2-(h+p/2);for(const{line:E,points:_}of u(this,ti))qe._translate(E,v,A,E),qe._translate(_,v,A,_);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(n-2*a)/(d-2*a),y=(s-2*o)/(p-2*o),b=-g*(c+a)+t+a,w=-y*(h+o)+r+o;if(g!==1||y!==1||b!==0||w!==0)for(const{line:v,points:A}of u(this,ti))qe._rescale(v,b,w,g,y,v),qe._rescale(A,b,w,g,y,A);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,r],n){const[s,a]=n,o=u(this,An),l=t-o[0],c=r-o[1];if(u(this,fs)===s&&u(this,ps)===a)for(const{line:h,points:d}of u(this,ti))qe._translate(h,l,c,h),qe._translate(d,l,c,d);else{const h=u(this,fs)/s,d=u(this,ps)/a;T(this,fs,s),T(this,ps,a);for(const{line:p,points:g}of u(this,ti))qe._rescale(p,l,c,h,d,p),qe._rescale(g,l,c,h,d,g);o[2]*=h,o[3]*=d}return o[0]=t,o[1]=r,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${qe.svgRound(t)} ${qe.svgRound(r)}`}}}get defaultSVGProperties(){const t=u(this,An);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${qe.svgRound(t[0])} ${qe.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}An=new WeakMap,Af=new WeakMap,Ef=new WeakMap,ti=new WeakMap,fs=new WeakMap,ps=new WeakMap,yc=new WeakMap,wc=new WeakMap,Rl=new WeakMap,rn=new WeakSet,Ds=function(t=u(this,Rl)){const r=u(this,Ef)+t/2*u(this,yc);return u(this,wc)%180===0?[r/u(this,fs),r/u(this,ps)]:[r/u(this,ps),r/u(this,fs)]},Zw=function(){const[t,r,n,s]=u(this,An),[a,o]=L(this,rn,Ds).call(this,0);return[t+a,r+o,n-2*a,s-2*o]},Kw=function(){const t=T(this,An,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:s}of u(this,ti)){if(s.length<=12){for(let l=4,c=s.length;l<c;l+=6)Qe.pointBoundingBox(s[l],s[l+1],t);continue}let a=s[4],o=s[5];for(let l=6,c=s.length;l<c;l+=6){const[h,d,p,g,y,b]=s.subarray(l,l+6);Qe.bezierBoundingBox(a,o,h,d,p,g,y,b,t),a=y,o=b}}const[r,n]=L(this,rn,Ds).call(this);t[0]=dn(t[0]-r,0,1),t[1]=dn(t[1]-n,0,1),t[2]=dn(t[2]+r,0,1),t[3]=dn(t[3]+n,0,1),t[2]-=t[0],t[3]-=t[1]},Qw=function(t){const[r,n]=L(this,rn,Ds).call(this);T(this,Rl,t);const[s,a]=L(this,rn,Ds).call(this),[o,l]=[s-r,a-n],c=u(this,An);return c[0]-=o,c[1]-=l,c[2]+=2*o,c[3]+=2*l,c};class Rg extends Xw{constructor(e){super(),this._viewParameters=e,super.updateProperties({fill:"none",stroke:tr._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,t){e==="stroke-width"&&(t??(t=this["stroke-width"]),t*=this._viewParameters.realScale),super.updateSVGProperty(e,t)}clone(){const e=new Rg(this._viewParameters);return e.updateAll(this),e}}var Ag,Jw;const gu=class gu extends Qp{constructor(t){super({...t,name:"inkEditor"});N(this,Ag);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,r){tr.initialize(t,r),this._defaultDrawingOptions=new Rg(r.viewParameters)}static getDefaultDrawingOptions(t){const r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ct(this,"typesMap",new Map([[kt.INK_THICKNESS,"stroke-width"],[kt.INK_COLOR,"stroke"],[kt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,r,n,s,a){return new rS(t,r,n,s,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,r,n,s,a,o){return Rf.deserialize(t,r,n,s,a,o)}static async deserialize(t,r,n){let s=null;if(t instanceof Hb){const{data:{inkLists:o,rect:l,rotation:c,id:h,color:d,opacity:p,borderStyle:{rawWidth:g},popupRef:y},parent:{page:{pageNumber:b}}}=t;s=t={annotationType:ot.INK,color:Array.from(d),thickness:g,opacity:p,paths:{points:o},boxes:null,pageIndex:b-1,rect:l.slice(0),rotation:c,annotationElementId:h,id:h,deleted:!1,popupRef:y}}const a=await super.deserialize(t,r,n);return a._initialData=s,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:r,parent:n}=this;r.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(t,r.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:r,opacity:n}){this._drawingOptions=gu.getDefaultDrawingOptions({stroke:Qe.makeHexColor(...t),"stroke-width":r,"stroke-opacity":n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:r,points:n,rect:s}=this.serializeDraw(t),{_drawingOptions:{stroke:a,"stroke-opacity":o,"stroke-width":l}}=this,c={annotationType:ot.INK,color:tr._colorManager.convert(a),opacity:o,thickness:l,paths:{lines:r,points:n},pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(c.isCopy=!0,c):this.annotationElementId&&!L(this,Ag,Jw).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(t){const{points:r,rect:n}=this.serializeDraw(!1);return t.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:r}),null}};Ag=new WeakSet,Jw=function(t){const{color:r,thickness:n,opacity:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||t.color.some((o,l)=>o!==r[l])||t.thickness!==n||t.opacity!==s||t.pageIndex!==a},Ie(gu,"_type","ink"),Ie(gu,"_editorType",ot.INK),Ie(gu,"_defaultDrawingOptions",null);let nb=gu;class ib extends Rf{toSVGPath(){let e=super.toSVGPath();return e.endsWith("Z")||(e+="Z"),e}}const ap=8,Jc=3;var Il,zt,sb,Hi,ex,tx,ab,Bp,rx,nx,ix,ob,lb,sx;class ys{static extractContoursFromText(e,{fontFamily:t,fontStyle:r,fontWeight:n},s,a,o,l){let c=new OffscreenCanvas(1,1),h=c.getContext("2d",{alpha:!1});const d=200,p=h.font=`${r} ${n} ${d}px ${t}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:y,actualBoundingBoxAscent:b,actualBoundingBoxDescent:w,fontBoundingBoxAscent:v,fontBoundingBoxDescent:A,width:E}=h.measureText(e),_=1.5,C=Math.ceil(Math.max(Math.abs(g)+Math.abs(y)||0,E)*_),I=Math.ceil(Math.max(Math.abs(b)+Math.abs(w)||d,Math.abs(v)+Math.abs(A)||d)*_);c=new OffscreenCanvas(C,I),h=c.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=p,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,C,I),h.fillStyle="black",h.fillText(e,C*(_-1)/2,I*(3-_)/2);const k=L(this,zt,ob).call(this,h.getImageData(0,0,C,I).data),D=L(this,zt,ix).call(this,k),R=L(this,zt,lb).call(this,D),z=L(this,zt,ab).call(this,k,C,I,R);return this.processDrawnLines({lines:{curves:z,width:C,height:I},pageWidth:s,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(e,t,r,n,s){const[a,o,l]=L(this,zt,sx).call(this,e),[c,h]=L(this,zt,nx).call(this,a,o,l,Math.hypot(o,l)*u(this,Il).sigmaSFactor,u(this,Il).sigmaR,u(this,Il).kernelSize),d=L(this,zt,lb).call(this,h),p=L(this,zt,ab).call(this,c,o,l,d);return this.processDrawnLines({lines:{curves:p,width:o,height:l},pageWidth:t,pageHeight:r,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:e,pageWidth:t,pageHeight:r,rotation:n,innerMargin:s,mustSmooth:a,areContours:o}){n%180!==0&&([t,r]=[r,t]);const{curves:l,width:c,height:h}=e,d=e.thickness??0,p=[],g=Math.min(t/c,r/h),y=g/t,b=g/r,w=[];for(const{points:A}of l){const E=a?L(this,zt,rx).call(this,A):A;if(!E)continue;w.push(E);const _=E.length,C=new Float32Array(_),I=new Float32Array(3*(_===2?2:_-2));if(p.push({line:I,points:C}),_===2){C[0]=E[0]*y,C[1]=E[1]*b,I.set([NaN,NaN,NaN,NaN,C[0],C[1]],0);continue}let[k,D,R,z]=E;k*=y,D*=b,R*=y,z*=b,C.set([k,D,R,z],0),I.set([NaN,NaN,NaN,NaN,k,D],0);for(let G=4;G<_;G+=2){const O=C[G]=E[G]*y,X=C[G+1]=E[G+1]*b;I.set(qe.createBezierPoints(k,D,R,z,O,X),(G-2)*3),[k,D,R,z]=[R,z,O,X]}}if(p.length===0)return null;const v=o?new ib:new Rf;return v.build(p,t,r,1,n,o?0:d,s),{outline:v,newCurves:w,areContours:o,thickness:d,width:c,height:h}}static async compressSignature({outlines:e,areContours:t,thickness:r,width:n,height:s}){let a=1/0,o=-1/0,l=0;for(const E of e){l+=E.length;for(let _=2,C=E.length;_<C;_++){const I=E[_]-E[_-2];a=Math.min(a,I),o=Math.max(o,I)}}let c;a>=-128&&o<=127?c=Int8Array:a>=-32768&&o<=32767?c=Int16Array:c=Int32Array;const h=e.length,d=ap+Jc*h,p=new Uint32Array(d);let g=0;p[g++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*c.BYTES_PER_ELEMENT,p[g++]=0,p[g++]=n,p[g++]=s,p[g++]=t?0:1,p[g++]=Math.max(0,Math.floor(r??0)),p[g++]=h,p[g++]=c.BYTES_PER_ELEMENT;for(const E of e)p[g++]=E.length-2,p[g++]=E[0],p[g++]=E[1];const y=new CompressionStream("deflate-raw"),b=y.writable.getWriter();await b.ready,b.write(p);const w=c.prototype.constructor;for(const E of e){const _=new w(E.length-2);for(let C=2,I=E.length;C<I;C++)_[C-2]=E[C]-E[C-2];b.write(_)}b.close();const v=await new Response(y.readable).arrayBuffer(),A=new Uint8Array(v);return n1(A)}static async decompressSignature(e){try{const t=I_(e),{readable:r,writable:n}=new DecompressionStream("deflate-raw"),s=n.getWriter();await s.ready,s.write(t).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,o=0;for await(const E of r)a||(a=new Uint8Array(new Uint32Array(E.buffer,0,4)[0])),a.set(E,o),o+=E.length;const l=new Uint32Array(a.buffer,0,a.length>>2),c=l[1];if(c!==0)throw new Error(`Invalid version: ${c}`);const h=l[2],d=l[3],p=l[4]===0,g=l[5],y=l[6],b=l[7],w=[],v=(ap+Jc*y)*Uint32Array.BYTES_PER_ELEMENT;let A;switch(b){case Int8Array.BYTES_PER_ELEMENT:A=new Int8Array(a.buffer,v);break;case Int16Array.BYTES_PER_ELEMENT:A=new Int16Array(a.buffer,v);break;case Int32Array.BYTES_PER_ELEMENT:A=new Int32Array(a.buffer,v);break}o=0;for(let E=0;E<y;E++){const _=l[Jc*E+ap],C=new Float32Array(_+2);w.push(C);for(let I=0;I<Jc-1;I++)C[I]=l[Jc*E+ap+I+1];for(let I=0;I<_;I++)C[I+2]=C[I]+A[o++]}return{areContours:p,thickness:g,outlines:w,width:h,height:d}}catch(t){return ut(`decompressSignature: ${t}`),null}}}Il=new WeakMap,zt=new WeakSet,sb=function(e,t,r,n){return r-=e,n-=t,r===0?n>0?0:4:r===1?n+6:2-n},Hi=new WeakMap,ex=function(e,t,r,n,s,a,o){const l=L(this,zt,sb).call(this,r,n,s,a);for(let c=0;c<8;c++){const h=(-c+l-o+16)%8,d=u(this,Hi)[2*h],p=u(this,Hi)[2*h+1];if(e[(r+d)*t+(n+p)]!==0)return h}return-1},tx=function(e,t,r,n,s,a,o){const l=L(this,zt,sb).call(this,r,n,s,a);for(let c=0;c<8;c++){const h=(c+l+o+16)%8,d=u(this,Hi)[2*h],p=u(this,Hi)[2*h+1];if(e[(r+d)*t+(n+p)]!==0)return h}return-1},ab=function(e,t,r,n){const s=e.length,a=new Int32Array(s);for(let h=0;h<s;h++)a[h]=e[h]<=n?1:0;for(let h=1;h<r-1;h++)a[h*t]=a[h*t+t-1]=0;for(let h=0;h<t;h++)a[h]=a[t*r-1-h]=0;let o=1,l;const c=[];for(let h=1;h<r-1;h++){l=1;for(let d=1;d<t-1;d++){const p=h*t+d,g=a[p];if(g===0)continue;let y=h,b=d;if(g===1&&a[p-1]===0)o+=1,b-=1;else if(g>=1&&a[p+1]===0)o+=1,b+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const w=[d,h],v=b===d+1,A={isHole:v,points:w,id:o,parent:0};c.push(A);let E;for(const G of c)if(G.id===l){E=G;break}E?E.isHole?A.parent=v?E.parent:l:A.parent=v?l:E.parent:A.parent=v?l:0;const _=L(this,zt,ex).call(this,a,t,h,d,y,b,0);if(_===-1){a[p]=-o,a[p]!==1&&(l=Math.abs(a[p]));continue}let C=u(this,Hi)[2*_],I=u(this,Hi)[2*_+1];const k=h+C,D=d+I;y=k,b=D;let R=h,z=d;for(;;){const G=L(this,zt,tx).call(this,a,t,R,z,y,b,1);C=u(this,Hi)[2*G],I=u(this,Hi)[2*G+1];const O=R+C,X=z+I;w.push(X,O);const S=R*t+z;if(a[S+1]===0?a[S]=-o:a[S]===1&&(a[S]=o),O===h&&X===d&&R===k&&z===D){a[p]!==1&&(l=Math.abs(a[p]));break}else y=R,b=z,R=O,z=X}}}return c},Bp=function(e,t,r,n){if(r-t<=4){for(let k=t;k<r-2;k+=2)n.push(e[k],e[k+1]);return}const s=e[t],a=e[t+1],o=e[r-4]-s,l=e[r-3]-a,c=Math.hypot(o,l),h=o/c,d=l/c,p=h*a-d*s,g=l/o,y=1/c,b=Math.atan(g),w=Math.cos(b),v=Math.sin(b),A=y*(Math.abs(w)+Math.abs(v)),E=y*(1-A+A**2),_=Math.max(Math.atan(Math.abs(v+w)*E),Math.atan(Math.abs(v-w)*E));let C=0,I=t;for(let k=t+2;k<r-2;k+=2){const D=Math.abs(p-h*e[k+1]+d*e[k]);D>C&&(I=k,C=D)}C>(c*_)**2?(L(this,zt,Bp).call(this,e,t,I+2,n),L(this,zt,Bp).call(this,e,I,r,n)):n.push(s,a)},rx=function(e){const t=[],r=e.length;return L(this,zt,Bp).call(this,e,0,r,t),t.push(e[r-2],e[r-1]),t.length<=4?null:t},nx=function(e,t,r,n,s,a){const o=new Float32Array(a**2),l=-2*n**2,c=a>>1;for(let b=0;b<a;b++){const w=(b-c)**2;for(let v=0;v<a;v++)o[b*a+v]=Math.exp((w+(v-c)**2)/l)}const h=new Float32Array(256),d=-2*s**2;for(let b=0;b<256;b++)h[b]=Math.exp(b**2/d);const p=e.length,g=new Uint8Array(p),y=new Uint32Array(256);for(let b=0;b<r;b++)for(let w=0;w<t;w++){const v=b*t+w,A=e[v];let E=0,_=0;for(let I=0;I<a;I++){const k=b+I-c;if(!(k<0||k>=r))for(let D=0;D<a;D++){const R=w+D-c;if(R<0||R>=t)continue;const z=e[k*t+R],G=o[I*a+D]*h[Math.abs(z-A)];E+=z*G,_+=G}}const C=g[v]=Math.round(E/_);y[C]++}return[g,y]},ix=function(e){const t=new Uint32Array(256);for(const r of e)t[r]++;return t},ob=function(e){const t=e.length,r=new Uint8ClampedArray(t>>2);let n=-1/0,s=1/0;for(let o=0,l=r.length;o<l;o++){if(e[(o<<2)+3]===0){n=r[o]=255;continue}const h=r[o]=e[o<<2];h>n&&(n=h),h<s&&(s=h)}const a=255/(n-s);for(let o=0;o<t;o++)r[o]=(r[o]-s)*a;return r},lb=function(e){let t,r=-1/0,n=-1/0;const s=e.findIndex(l=>l!==0);let a=s,o=s;for(t=s;t<256;t++){const l=e[t];l>r&&(t-a>n&&(n=t-a,o=t-1),r=l,a=t)}for(t=o-1;t>=0&&!(e[t]>e[t+1]);t--);return t},sx=function(e){const t=e,{width:r,height:n}=e,{maxDim:s}=u(this,Il);let a=r,o=n;if(r>s||n>s){let p=r,g=n,y=Math.log2(Math.max(r,n)/s);const b=Math.floor(y);y=y===b?b-1:b;for(let v=0;v<y;v++){a=Math.ceil(p/2),o=Math.ceil(g/2);const A=new OffscreenCanvas(a,o);A.getContext("2d").drawImage(e,0,0,p,g,0,0,a,o),p=a,g=o,e!==t&&e.close(),e=A.transferToImageBitmap()}const w=Math.min(s/a,s/o);a=Math.round(a*w),o=Math.round(o*w)}const c=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});c.filter="grayscale(1)",c.drawImage(e,0,0,e.width,e.height,0,0,a,o);const h=c.getImageData(0,0,a,o).data;return[L(this,zt,ob).call(this,h),a,o]},N(ys,zt),N(ys,Il,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),N(ys,Hi,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));class Vb extends Xw{constructor(){super(),super.updateProperties({fill:tr._defaultLineColor,"stroke-width":0})}clone(){const e=new Vb;return e.updateAll(this),e}}class Gb extends Rg{constructor(e){super(e),super.updateProperties({stroke:tr._defaultLineColor,"stroke-width":1})}clone(){const e=new Gb(this._viewParameters);return e.updateAll(this),e}}var Za,gs,Ka,Nl;const $n=class $n extends Qp{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"});N(this,Za,!1);N(this,gs,null);N(this,Ka,null);N(this,Nl,null);this._willKeepAspectRatio=!0,T(this,Ka,t.signatureData||null),T(this,gs,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,r){tr.initialize(t,r),this._defaultDrawingOptions=new Vb,this._defaultDrawnSignatureOptions=new Gb(r.viewParameters)}static getDefaultDrawingOptions(t){const r=this._defaultDrawingOptions.clone();return r.updateProperties(t),r}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ct(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!u(this,gs)}}static computeTelemetryFinalData(t){const r=t.get("hasDescription");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let t,r;const{_isCopy:n}=this;if(n&&(this._isCopy=!1,t=this.x,r=this.y),super.render(),this._drawId===null)if(u(this,Ka)){const{lines:s,mustSmooth:a,areContours:o,description:l,uuid:c,heightInPage:h}=u(this,Ka),{rawDims:{pageWidth:d,pageHeight:p},rotation:g}=this.parent.viewport,y=ys.processDrawnLines({lines:s,pageWidth:d,pageHeight:p,rotation:g,innerMargin:$n._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(y,h,l,c)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);return n&&(this._isCopy=!0,this._moveAfterPaste(t,r)),this.div}setUuid(t){T(this,Nl,t),this.addEditToolbar()}getUuid(){return u(this,Nl)}get description(){return u(this,gs)}set description(t){T(this,gs,t),super.addEditToolbar().then(r=>{r==null||r.updateEditSignatureButton(t)})}getSignaturePreview(){const{newCurves:t,areContours:r,thickness:n,width:s,height:a}=u(this,Ka),o=Math.max(s,a),l=ys.processDrawnLines({lines:{curves:t.map(c=>({points:c})),thickness:n,width:s,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:r});return{areContours:r,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,r,n,s){const{x:a,y:o}=this,{outline:l}=T(this,Ka,t);T(this,Za,l instanceof ib),this.description=n,this.div.setAttribute("data-l10n-args",JSON.stringify({description:n}));let c;u(this,Za)?c=$n.getDefaultDrawingOptions():(c=$n._defaultDrawnSignatureOptions.clone(),c.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:c});const[h,d]=this.parentDimensions,[,p]=this.pageDimensions;let g=r/p;g=g>=1?.5:g,this.width*=g/this.height,this.width>=1&&(g*=.9/this.width,this.width=.9),this.height=g,this.setDims(h*this.width,d*this.height),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:r,pageHeight:n},rotation:s}=this.parent.viewport;return ys.process(t,r,n,s,$n._INNER_MARGIN)}getFromText(t,r){const{rawDims:{pageWidth:n,pageHeight:s},rotation:a}=this.parent.viewport;return ys.extractContoursFromText(t,r,n,s,a,$n._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:r,pageHeight:n},rotation:s}=this.parent.viewport;return ys.processDrawnLines({lines:t,pageWidth:r,pageHeight:n,rotation:s,innerMargin:$n._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:r}){t?this._drawingOptions=$n.getDefaultDrawingOptions():(this._drawingOptions=$n._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":r}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:r,points:n,rect:s}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":a}}=this,o={annotationType:ot.SIGNATURE,isSignature:!0,areContours:u(this,Za),color:[0,0,0],thickness:u(this,Za)?0:a,pageIndex:this.pageIndex,rect:s,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?(o.paths={lines:r,points:n},o.uuid=u(this,Nl),o.isCopy=!0):o.lines=r,u(this,gs)&&(o.accessibilityData={type:"Figure",alt:u(this,gs)}),o}static deserializeDraw(t,r,n,s,a,o){return o.areContours?ib.deserialize(t,r,n,s,a,o):Rf.deserialize(t,r,n,s,a,o)}static async deserialize(t,r,n){var a;const s=await super.deserialize(t,r,n);return T(s,Za,t.areContours),T(s,gs,((a=t.accessibilityData)==null?void 0:a.alt)||""),T(s,Nl,t.uuid),s}};Za=new WeakMap,gs=new WeakMap,Ka=new WeakMap,Nl=new WeakMap,Ie($n,"_type","signature"),Ie($n,"_editorType",ot.SIGNATURE),Ie($n,"_defaultDrawingOptions",null);let ub=$n;var lr,Vr,Qa,na,Ja,xc,ia,Ml,ms,ri,Ac,Ot,Eh,_h,zp,jp,Up,hb,Hp,ax;class cb extends tr{constructor(t){super({...t,name:"stampEditor"});N(this,Ot);N(this,lr,null);N(this,Vr,null);N(this,Qa,null);N(this,na,null);N(this,Ja,null);N(this,xc,"");N(this,ia,null);N(this,Ml,!1);N(this,ms,null);N(this,ri,!1);N(this,Ac,!1);T(this,na,t.bitmapUrl),T(this,Ja,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,r){tr.initialize(t,r)}static isHandlingMimeForPasting(t){return Xp.includes(t)}static paste(t,r){r.pasteEditor({mode:ot.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const r=t.get("hasAltText");return{hasAltText:r.get(!0)??0,hasNoAltText:r.get(!1)??0}}async mlGuessAltText(t=null,r=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:s,width:a,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await n.guess({name:"altText",request:{data:s,width:a,height:o,channels:s.length/(a*o)}});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 c=l.output;return await this.setGuessedAltText(c),r&&!this.hasAltTextData()&&(this.altTextData={alt:c,decorative:!1}),c}remove(){var t;u(this,Vr)&&(T(this,lr,null),this._uiManager.imageManager.deleteId(u(this,Vr)),(t=u(this,ia))==null||t.remove(),T(this,ia,null),u(this,ms)&&(clearTimeout(u(this,ms)),T(this,ms,null))),super.remove()}rebuild(){if(!this.parent){u(this,Vr)&&L(this,Ot,zp).call(this);return}super.rebuild(),this.div!==null&&(u(this,Vr)&&u(this,ia)===null&&L(this,Ot,zp).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(u(this,Qa)||u(this,lr)||u(this,na)||u(this,Ja)||u(this,Vr)||u(this,Ml))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let t,r;return this._isCopy&&(t=this.x,r=this.y),super.render(),this.div.hidden=!0,this.createAltText(),u(this,Ml)||(u(this,lr)?L(this,Ot,jp).call(this):L(this,Ot,zp).call(this)),this._isCopy&&this._moveAfterPaste(t,r),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,r){const{id:n,bitmap:s}=this._uiManager.imageManager.getFromCanvas(t,r);r.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(T(this,Vr,n),s&&T(this,lr,s),T(this,Ml,!1),L(this,Ot,jp).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;u(this,ms)!==null&&clearTimeout(u(this,ms)),T(this,ms,setTimeout(()=>{T(this,ms,null),L(this,Ot,hb).call(this)},200))}copyCanvas(t,r,n=!1){var g;t||(t=224);const{width:s,height:a}=u(this,lr),o=new Wi;let l=u(this,lr),c=s,h=a,d=null;if(r){if(s>r||a>r){const D=Math.min(r/s,r/a);c=Math.floor(s*D),h=Math.floor(a*D)}d=document.createElement("canvas");const y=d.width=Math.ceil(c*o.sx),b=d.height=Math.ceil(h*o.sy);u(this,ri)||(l=L(this,Ot,Up).call(this,y,b));const w=d.getContext("2d");w.filter=this._uiManager.hcmFilter;let v="white",A="#cfcfd8";this._uiManager.hcmFilter!=="none"?A="black":(g=window.matchMedia)!=null&&g.call(window,"(prefers-color-scheme: dark)").matches&&(v="#8f8f9d",A="#42414d");const E=15,_=E*o.sx,C=E*o.sy,I=new OffscreenCanvas(_*2,C*2),k=I.getContext("2d");k.fillStyle=v,k.fillRect(0,0,_*2,C*2),k.fillStyle=A,k.fillRect(0,0,_,C),k.fillRect(_,C,_,C),w.fillStyle=w.createPattern(I,"repeat"),w.fillRect(0,0,y,b),w.drawImage(l,0,0,l.width,l.height,0,0,y,b)}let p=null;if(n){let y,b;if(o.symmetric&&l.width<t&&l.height<t)y=l.width,b=l.height;else if(l=u(this,lr),s>t||a>t){const A=Math.min(t/s,t/a);y=Math.floor(s*A),b=Math.floor(a*A),u(this,ri)||(l=L(this,Ot,Up).call(this,y,b))}const v=new OffscreenCanvas(y,b).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,y,b),p={width:y,height:b,data:v.getImageData(0,0,y,b).data}}return{canvas:d,width:c,height:h,imageData:p}}static async deserialize(t,r,n){var w;let s=null,a=!1;if(t instanceof xw){const{data:{rect:v,rotation:A,id:E,structParent:_,popupRef:C},container:I,parent:{page:{pageNumber:k}},canvas:D}=t;let R,z;D?(delete t.canvas,{id:R,bitmap:z}=n.imageManager.getFromCanvas(I.id,D),D.remove()):(a=!0,t._hasNoCanvas=!0);const G=((w=await r._structTree.getAriaAttributes(`${Nb}${E}`))==null?void 0:w.get("aria-label"))||"";s=t={annotationType:ot.STAMP,bitmapId:R,bitmap:z,pageIndex:k-1,rect:v.slice(0),rotation:A,annotationElementId:E,id:E,deleted:!1,accessibilityData:{decorative:!1,altText:G},isSvg:!1,structParent:_,popupRef:C}}const o=await super.deserialize(t,r,n),{rect:l,bitmap:c,bitmapUrl:h,bitmapId:d,isSvg:p,accessibilityData:g}=t;a?(n.addMissingCanvas(t.id,o),T(o,Ml,!0)):d&&n.imageManager.isValidId(d)?(T(o,Vr,d),c&&T(o,lr,c)):T(o,na,h),T(o,ri,p);const[y,b]=o.pageDimensions;return o.width=(l[2]-l[0])/y,o.height=(l[3]-l[1])/b,g&&(o.altTextData=g),o._initialData=s,T(o,Ac,!!s),o}serialize(t=!1,r=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:ot.STAMP,bitmapId:u(this,Vr),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:u(this,ri),structTreeParentId:this._structTreeParentId};if(t)return n.bitmapUrl=L(this,Ot,Hp).call(this,!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;const{decorative:s,altText:a}=this.serializeAltText(!1);if(!s&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=L(this,Ot,ax).call(this,n);if(l.isSame)return null;l.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1}if(n.id=this.annotationElementId,r===null)return n;r.stamps||(r.stamps=new Map);const o=u(this,ri)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!r.stamps.has(u(this,Vr)))r.stamps.set(u(this,Vr),{area:o,serialized:n}),n.bitmap=L(this,Ot,Hp).call(this,!1);else if(u(this,ri)){const l=r.stamps.get(u(this,Vr));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=L(this,Ot,Hp).call(this,!1))}return n}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}lr=new WeakMap,Vr=new WeakMap,Qa=new WeakMap,na=new WeakMap,Ja=new WeakMap,xc=new WeakMap,ia=new WeakMap,Ml=new WeakMap,ms=new WeakMap,ri=new WeakMap,Ac=new WeakMap,Ot=new WeakSet,Eh=function(t,r=!1){if(!t){this.remove();return}T(this,lr,t.bitmap),r||(T(this,Vr,t.id),T(this,ri,t.isSvg)),t.file&&T(this,xc,t.file.name),L(this,Ot,jp).call(this)},_h=function(){if(T(this,Qa,null),this._uiManager.enableWaiting(!1),!!u(this,ia)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&u(this,lr)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&u(this,lr)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},zp=function(){if(u(this,Vr)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(u(this,Vr)).then(n=>L(this,Ot,Eh).call(this,n,!0)).finally(()=>L(this,Ot,_h).call(this));return}if(u(this,na)){const n=u(this,na);T(this,na,null),this._uiManager.enableWaiting(!0),T(this,Qa,this._uiManager.imageManager.getFromUrl(n).then(s=>L(this,Ot,Eh).call(this,s)).finally(()=>L(this,Ot,_h).call(this)));return}if(u(this,Ja)){const n=u(this,Ja);T(this,Ja,null),this._uiManager.enableWaiting(!0),T(this,Qa,this._uiManager.imageManager.getFromFile(n).then(s=>L(this,Ot,Eh).call(this,s)).finally(()=>L(this,Ot,_h).call(this)));return}const t=document.createElement("input");t.type="file",t.accept=Xp.join(",");const r=this._uiManager._signal;T(this,Qa,new Promise(n=>{t.addEventListener("change",async()=>{if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const s=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),L(this,Ot,Eh).call(this,s)}n()},{signal:r}),t.addEventListener("cancel",()=>{this.remove(),n()},{signal:r})}).finally(()=>L(this,Ot,_h).call(this))),t.click()},jp=function(){var d;const{div:t}=this;let{width:r,height:n}=u(this,lr);const[s,a]=this.pageDimensions,o=.75;if(this.width)r=this.width*s,n=this.height*a;else if(r>o*s||n>o*a){const p=Math.min(o*s/r,o*a/n);r*=p,n*=p}const[l,c]=this.parentDimensions;this.setDims(r*l/s,n*c/a),this._uiManager.enableWaiting(!1);const h=T(this,ia,document.createElement("canvas"));h.setAttribute("role","img"),this.addContainer(h),this.width=r/s,this.height=n/a,(d=this._initialOptions)!=null&&d.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),L(this,Ot,hb).call(this),u(this,Ac)||(this.parent.addUndoableEditor(this),T(this,Ac,!0)),this._reportTelemetry({action:"inserted_image"}),u(this,xc)&&this.div.setAttribute("aria-description",u(this,xc)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},Up=function(t,r){const{width:n,height:s}=u(this,lr);let a=n,o=s,l=u(this,lr);for(;a>2*t||o>2*r;){const c=a,h=o;a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*r&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const d=new OffscreenCanvas(a,o);d.getContext("2d").drawImage(l,0,0,c,h,0,0,a,o),l=d.transferToImageBitmap()}return l},hb=function(){const[t,r]=this.parentDimensions,{width:n,height:s}=this,a=new Wi,o=Math.ceil(n*t*a.sx),l=Math.ceil(s*r*a.sy),c=u(this,ia);if(!c||c.width===o&&c.height===l)return;c.width=o,c.height=l;const h=u(this,ri)?u(this,lr):L(this,Ot,Up).call(this,o,l),d=c.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,o,l)},Hp=function(t){if(t){if(u(this,ri)){const s=this._uiManager.imageManager.getSvgUrl(u(this,Vr));if(s)return s}const r=document.createElement("canvas");return{width:r.width,height:r.height}=u(this,lr),r.getContext("2d").drawImage(u(this,lr),0,0),r.toDataURL()}if(u(this,ri)){const[r,n]=this.pageDimensions,s=Math.round(this.width*r*da.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*da.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(s,a);return o.getContext("2d").drawImage(u(this,lr),0,0,u(this,lr).width,u(this,lr).height,0,0,s,a),o.transferToImageBitmap()}return structuredClone(u(this,lr))},ax=function(t){var o;const{pageIndex:r,accessibilityData:{altText:n}}=this._initialData,s=t.pageIndex===r,a=(((o=t.accessibilityData)==null?void 0:o.alt)||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&s&&a,isSameAltText:a}},Ie(cb,"_type","stamp"),Ie(cb,"_editorType",ot.STAMP);var Ll,Ec,bs,eo,sa,ni,to,_c,Ol,$i,aa,Gr,oa,ro,Cc,Ze,no,ur,ox,Ji,db,fb,$p;const Ii=class Ii{constructor({uiManager:e,pageIndex:t,div:r,structTreeLayer:n,accessibilityManager:s,annotationLayer:a,drawLayer:o,textLayer:l,viewport:c,l10n:h}){N(this,ur);N(this,Ll);N(this,Ec,!1);N(this,bs,null);N(this,eo,null);N(this,sa,null);N(this,ni,new Map);N(this,to,!1);N(this,_c,!1);N(this,Ol,!1);N(this,$i,null);N(this,aa,null);N(this,Gr,null);N(this,oa,null);N(this,ro,null);N(this,Cc,-1);N(this,Ze);const d=[...u(Ii,no).values()];if(!Ii._initialized){Ii._initialized=!0;for(const p of d)p.initialize(h,e)}e.registerEditorTypes(d),T(this,Ze,e),this.pageIndex=t,this.div=r,T(this,Ll,s),T(this,bs,a),this.viewport=c,T(this,Gr,l),this.drawLayer=o,this._structTree=n,u(this,Ze).addLayer(this)}get isEmpty(){return u(this,ni).size===0}get isInvisible(){return this.isEmpty&&u(this,Ze).getMode()===ot.NONE}updateToolbar(e){u(this,Ze).updateToolbar(e)}updateMode(e=u(this,Ze).getMode()){switch(L(this,ur,$p).call(this),e){case ot.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case ot.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case ot.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;for(const r of u(Ii,no).values())t.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var t;return e===((t=u(this,Gr))==null?void 0:t.div)}setEditingState(e){u(this,Ze).setEditingState(e)}addCommands(e){u(this,Ze).addCommands(e)}cleanUndoStack(e){u(this,Ze).cleanUndoStack(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var t;(t=u(this,bs))==null||t.div.classList.toggle("disabled",!e)}async enable(){var r;T(this,Ol,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),(r=u(this,ro))==null||r.abort(),T(this,ro,null);const e=new Set;for(const n of u(this,ni).values())n.enableEditing(),n.show(!0),n.annotationElementId&&(u(this,Ze).removeChangedExistingAnnotation(n),e.add(n.annotationElementId));if(!u(this,bs)){T(this,Ol,!1);return}const t=u(this,bs).getEditableAnnotations();for(const n of t){if(n.hide(),u(this,Ze).isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;const s=await this.deserialize(n);s&&(this.addOrRebuild(s),s.enableEditing())}T(this,Ol,!1)}disable(){var n;if(T(this,_c,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),u(this,Gr)&&!u(this,ro)){T(this,ro,new AbortController);const s=u(this,Ze).combinedSignal(u(this,ro));u(this,Gr).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:c,timeStamp:h}=a,d=u(this,Cc);if(h-d>500){T(this,Cc,h);return}T(this,Cc,-1);const{classList:p}=this.div;p.toggle("getElements",!0);const g=document.elementsFromPoint(l,c);if(p.toggle("getElements",!1),!this.div.contains(g[0]))return;let y;const b=new RegExp(`^${Q2}[0-9]+$`);for(const v of g)if(b.test(v.id)){y=v.id;break}if(!y)return;const w=u(this,ni).get(y);(w==null?void 0:w.annotationElementId)===null&&(a.stopPropagation(),a.preventDefault(),w.dblclick())},{signal:s,capture:!0})}const e=new Map,t=new Map;for(const s of u(this,ni).values())if(s.disableEditing(),!!s.annotationElementId){if(s.serialize()!==null){e.set(s.annotationElementId,s);continue}else t.set(s.annotationElementId,s);(n=this.getEditableAnnotation(s.annotationElementId))==null||n.show(),s.remove()}if(u(this,bs)){const s=u(this,bs).getEditableAnnotations();for(const a of s){const{id:o}=a.data;if(u(this,Ze).isDeletedAnnotationElement(o))continue;let l=t.get(o);if(l){l.resetAnnotationElement(a),l.show(!1),a.show();continue}l=e.get(o),l&&(u(this,Ze).addChangedExistingAnnotation(l),l.renderAnnotationElement(a)&&l.show(!1)),a.show()}}L(this,ur,$p).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const s of u(Ii,no).values())r.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),T(this,_c,!1)}getEditableAnnotation(e){var t;return((t=u(this,bs))==null?void 0:t.getEditableAnnotation(e))||null}setActiveEditor(e){u(this,Ze).getActive()!==e&&u(this,Ze).setActiveEditor(e)}enableTextSelection(){var e;if(this.div.tabIndex=-1,(e=u(this,Gr))!=null&&e.div&&!u(this,oa)){T(this,oa,new AbortController);const t=u(this,Ze).combinedSignal(u(this,oa));u(this,Gr).div.addEventListener("pointerdown",L(this,ur,ox).bind(this),{signal:t}),u(this,Gr).div.classList.add("highlighting")}}disableTextSelection(){var e;this.div.tabIndex=0,(e=u(this,Gr))!=null&&e.div&&u(this,oa)&&(u(this,oa).abort(),T(this,oa,null),u(this,Gr).div.classList.remove("highlighting"))}enableClick(){if(u(this,eo))return;T(this,eo,new AbortController);const e=u(this,Ze).combinedSignal(u(this,eo));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:e}),this.div.addEventListener("pointercancel",t,{signal:e})}disableClick(){var e;(e=u(this,eo))==null||e.abort(),T(this,eo,null)}attach(e){u(this,ni).set(e.id,e);const{annotationElementId:t}=e;t&&u(this,Ze).isDeletedAnnotationElement(t)&&u(this,Ze).removeDeletedAnnotationElement(e)}detach(e){var t;u(this,ni).delete(e.id),(t=u(this,Ll))==null||t.removePointerInTextLayer(e.contentDiv),!u(this,_c)&&e.annotationElementId&&u(this,Ze).addDeletedAnnotationElement(e)}remove(e){this.detach(e),u(this,Ze).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1}changeParent(e){var t;e.parent!==this&&(e.parent&&e.annotationElementId&&(u(this,Ze).addDeletedAnnotationElement(e.annotationElementId),tr.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(t=e.parent)==null||t.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),u(this,Ze).addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(!u(this,Ol)),u(this,Ze).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&!u(this,sa)&&(e._focusEventsAllowed=!1,T(this,sa,setTimeout(()=>{T(this,sa,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:u(this,Ze)._signal}),t.focus())},0))),e._structTreeParentId=(r=u(this,Ll))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const t=()=>e._uiManager.rebuild(e),r=()=>{e.remove()};this.addCommands({cmd:t,undo:r,mustExec:!1})}getNextId(){return u(this,Ze).getId()}combinedSignal(e){return u(this,Ze).combinedSignal(e)}canCreateNewEmptyEditor(){var e;return(e=u(this,ur,Ji))==null?void 0:e.canCreateNewEmptyEditor()}async pasteEditor(e,t){this.updateToolbar(e),await u(this,Ze).updateMode(e.mode);const{offsetX:r,offsetY:n}=L(this,ur,fb).call(this),s=this.getNextId(),a=L(this,ur,db).call(this,{parent:this,id:s,x:r,y:n,uiManager:u(this,Ze),isCentered:!0,...t});a&&this.add(a)}async deserialize(e){var t;return await((t=u(Ii,no).get(e.annotationType??e.annotationEditorType))==null?void 0:t.deserialize(e,this,u(this,Ze)))||null}createAndAddNewEditor(e,t,r={}){const n=this.getNextId(),s=L(this,ur,db).call(this,{parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:u(this,Ze),isCentered:t,...r});return s&&this.add(s),s}addNewEditor(e={}){this.createAndAddNewEditor(L(this,ur,fb).call(this),!0,e)}setSelected(e){u(this,Ze).setSelected(e)}toggleSelected(e){u(this,Ze).toggleSelected(e)}unselect(e){u(this,Ze).unselect(e)}pointerup(e){var n;const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div||!u(this,to)||(T(this,to,!1),(n=u(this,ur,Ji))!=null&&n.isDrawer&&u(this,ur,Ji).supportMultipleDrawings))return;if(!u(this,Ec)){T(this,Ec,!0);return}const r=u(this,Ze).getMode();if(r===ot.STAMP||r===ot.SIGNATURE){u(this,Ze).unselectAll();return}this.createAndAddNewEditor(e,!1)}pointerdown(e){var n;if(u(this,Ze).getMode()===ot.HIGHLIGHT&&this.enableTextSelection(),u(this,to)){T(this,to,!1);return}const{isMac:t}=qr.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;if(T(this,to,!0),(n=u(this,ur,Ji))!=null&&n.isDrawer){this.startDrawingSession(e);return}const r=u(this,Ze).getActive();T(this,Ec,!r||r.isEmpty())}startDrawingSession(e){if(this.div.focus({preventScroll:!0}),u(this,$i)){u(this,ur,Ji).startDrawing(this,u(this,Ze),!1,e);return}u(this,Ze).setCurrentDrawingSession(this),T(this,$i,new AbortController);const t=u(this,Ze).combinedSignal(u(this,$i));this.div.addEventListener("blur",({relatedTarget:r})=>{r&&!this.div.contains(r)&&(T(this,aa,null),this.commitOrRemove())},{signal:t}),u(this,ur,Ji).startDrawing(this,u(this,Ze),!1,e)}pause(e){if(e){const{activeElement:t}=document;this.div.contains(t)&&T(this,aa,t);return}u(this,aa)&&setTimeout(()=>{var t;(t=u(this,aa))==null||t.focus(),T(this,aa,null)},0)}endDrawingSession(e=!1){return u(this,$i)?(u(this,Ze).setCurrentDrawingSession(null),u(this,$i).abort(),T(this,$i,null),T(this,aa,null),u(this,ur,Ji).endDrawing(e)):null}findNewParent(e,t,r){const n=u(this,Ze).findParent(t,r);return n===null||n===this?!1:(n.changeParent(e),!0)}commitOrRemove(){return u(this,$i)?(this.endDrawingSession(),!0):!1}onScaleChanging(){u(this,$i)&&u(this,ur,Ji).onScaleChangingWhenDrawing(this)}destroy(){var e,t;this.commitOrRemove(),((e=u(this,Ze).getActive())==null?void 0:e.parent)===this&&(u(this,Ze).commitOrRemove(),u(this,Ze).setActiveEditor(null)),u(this,sa)&&(clearTimeout(u(this,sa)),T(this,sa,null));for(const r of u(this,ni).values())(t=u(this,Ll))==null||t.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,u(this,ni).clear(),u(this,Ze).removeLayer(this)}render({viewport:e}){this.viewport=e,so(this.div,e);for(const t of u(this,Ze).getEditors(this.pageIndex))this.add(t),t.rebuild();this.updateMode()}update({viewport:e}){u(this,Ze).commitOrRemove(),L(this,ur,$p).call(this);const t=this.viewport.rotation,r=e.rotation;if(this.viewport=e,so(this.div,{rotation:r}),t!==r)for(const n of u(this,ni).values())n.rotate(r)}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}get scale(){return u(this,Ze).viewParameters.realScale}};Ll=new WeakMap,Ec=new WeakMap,bs=new WeakMap,eo=new WeakMap,sa=new WeakMap,ni=new WeakMap,to=new WeakMap,_c=new WeakMap,Ol=new WeakMap,$i=new WeakMap,aa=new WeakMap,Gr=new WeakMap,oa=new WeakMap,ro=new WeakMap,Cc=new WeakMap,Ze=new WeakMap,no=new WeakMap,ur=new WeakSet,ox=function(e){u(this,Ze).unselectAll();const{target:t}=e;if(t===u(this,Gr).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent"))&&u(this,Gr).div.contains(t)){const{isMac:r}=qr.platform;if(e.button!==0||e.ctrlKey&&r)return;u(this,Ze).showAllEditors("highlight",!0,!0),u(this,Gr).div.classList.add("free"),this.toggleDrawing(),Kp.startHighlighting(this,u(this,Ze).direction==="ltr",{target:u(this,Gr).div,x:e.x,y:e.y}),u(this,Gr).div.addEventListener("pointerup",()=>{u(this,Gr).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:u(this,Ze)._signal}),e.preventDefault()}},Ji=function(){return u(Ii,no).get(u(this,Ze).getMode())},db=function(e){const t=u(this,ur,Ji);return t?new t.prototype.constructor(e):null},fb=function(){const{x:e,y:t,width:r,height:n}=this.div.getBoundingClientRect(),s=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+r),l=Math.min(window.innerHeight,t+n),c=(s+o)/2-e,h=(a+l)/2-t,[d,p]=this.viewport.rotation%180===0?[c,h]:[h,c];return{offsetX:d,offsetY:p}},$p=function(){for(const e of u(this,ni).values())e.isEmpty()&&e.remove()},Ie(Ii,"_initialized",!1),N(Ii,no,new Map([V0,nb,cb,Kp,ub].map(e=>[e._editorType,e])));let Jp=Ii;var Vi,En,Fl,_f,Eg,lx,As,pb,ux,gb;const Rr=class Rr{constructor({pageIndex:e}){N(this,As);N(this,Vi,null);N(this,En,new Map);N(this,Fl,new Map);this.pageIndex=e}setParent(e){if(!u(this,Vi)){T(this,Vi,e);return}if(u(this,Vi)!==e){if(u(this,En).size>0)for(const t of u(this,En).values())t.remove(),e.append(t);T(this,Vi,e)}}static get _svgFactory(){return Ct(this,"_svgFactory",new Lh)}draw(e,t=!1,r=!1){const n=bn(Rr,_f)._++,s=L(this,As,pb).call(this),a=Rr._svgFactory.createElement("defs");s.append(a);const o=Rr._svgFactory.createElement("path");a.append(o);const l=`path_p${this.pageIndex}_${n}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&u(this,Fl).set(n,o);const c=r?L(this,As,ux).call(this,a,l):null,h=Rr._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${l}`),this.updateProperties(s,e),u(this,En).set(n,s),{id:n,clipPathId:`url(#${c})`}}drawOutline(e,t){const r=bn(Rr,_f)._++,n=L(this,As,pb).call(this),s=Rr._svgFactory.createElement("defs");n.append(s);const a=Rr._svgFactory.createElement("path");s.append(a);const o=`path_p${this.pageIndex}_${r}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const d=Rr._svgFactory.createElement("mask");s.append(d),l=`mask_p${this.pageIndex}_${r}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const p=Rr._svgFactory.createElement("rect");d.append(p),p.setAttribute("width","1"),p.setAttribute("height","1"),p.setAttribute("fill","white");const g=Rr._svgFactory.createElement("use");d.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const c=Rr._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${o}`),l&&c.setAttribute("mask",`url(#${l})`);const h=c.cloneNode();return n.append(h),c.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,e),u(this,En).set(r,n),r}finalizeDraw(e,t){u(this,Fl).delete(e),this.updateProperties(e,t)}updateProperties(e,t){var l;if(!t)return;const{root:r,bbox:n,rootClass:s,path:a}=t,o=typeof e=="number"?u(this,En).get(e):e;if(o){if(r&&L(this,As,gb).call(this,o,r),n&&L(l=Rr,Eg,lx).call(l,o,n),s){const{classList:c}=o;for(const[h,d]of Object.entries(s))c.toggle(h,d)}if(a){const h=o.firstChild.firstChild;L(this,As,gb).call(this,h,a)}}}updateParent(e,t){if(t===this)return;const r=u(this,En).get(e);r&&(u(t,Vi).append(r),u(this,En).delete(e),u(t,En).set(e,r))}remove(e){u(this,Fl).delete(e),u(this,Vi)!==null&&(u(this,En).get(e).remove(),u(this,En).delete(e))}destroy(){T(this,Vi,null);for(const e of u(this,En).values())e.remove();u(this,En).clear(),u(this,Fl).clear()}};Vi=new WeakMap,En=new WeakMap,Fl=new WeakMap,_f=new WeakMap,Eg=new WeakSet,lx=function(e,[t,r,n,s]){const{style:a}=e;a.top=`${100*r}%`,a.left=`${100*t}%`,a.width=`${100*n}%`,a.height=`${100*s}%`},As=new WeakSet,pb=function(){const e=Rr._svgFactory.create(1,1,!0);return u(this,Vi).append(e),e.setAttribute("aria-hidden",!0),e},ux=function(e,t){const r=Rr._svgFactory.createElement("clipPath");e.append(r);const n=`clip_${t}`;r.setAttribute("id",n),r.setAttribute("clipPathUnits","objectBoundingBox");const s=Rr._svgFactory.createElement("use");return r.append(s),s.setAttribute("href",`#${t}`),s.classList.add("clip"),n},gb=function(e,t){for(const[r,n]of Object.entries(t))n===null?e.removeAttribute(r):e.setAttribute(r,n)},N(Rr,Eg),N(Rr,_f,0);let eg=Rr;globalThis._pdfjsTestingUtils={HighlightOutliner:q0};globalThis.pdfjsLib={AbortException:ha,AnnotationEditorLayer:Jp,AnnotationEditorParamsType:kt,AnnotationEditorType:ot,AnnotationEditorUIManager:ao,AnnotationLayer:$b,AnnotationMode:vs,AnnotationType:wr,build:uw,ColorPicker:Oh,createValidAbsoluteUrl:Pb,DOMSVGFactory:Lh,DrawLayer:eg,FeatureTest:qr,fetchData:Nc,getDocument:Bb,getFilenameFromUrl:i1,getPdfFilenameFromUrl:s1,getUuid:Ib,getXfaPageViewport:a1,GlobalWorkerOptions:yi,ImageKind:Th,InvalidPDFException:Wp,isDataScheme:kf,isPdfFile:kg,isValidExplicitDest:j1,MathClamp:dn,noContextMenu:Ei,normalizeUnicode:r1,OPS:Ph,OutputScale:Wi,PasswordResponses:e1,PDFDataRangeTransport:zb,PDFDateString:Dg,PDFWorker:Sc,PermissionFlag:J2,PixelsPerInch:da,RenderingCancelledException:Tg,ResponseException:Rh,setLayerDimensions:so,shadow:Ct,SignatureExtractor:ys,stopEvent:_r,SupportedImageMimeTypes:Xp,TextLayer:Nh,TouchManager:Ih,updateUrlHash:Rb,Util:Qe,VerbosityLevel:Cf,version:jb,XfaLayer:Ub};const nS=Object.freeze(Object.defineProperty({__proto__:null,AbortException:ha,AnnotationEditorLayer:Jp,AnnotationEditorParamsType:kt,AnnotationEditorType:ot,AnnotationEditorUIManager:ao,AnnotationLayer:$b,AnnotationMode:vs,AnnotationType:wr,ColorPicker:Oh,DOMSVGFactory:Lh,DrawLayer:eg,FeatureTest:qr,GlobalWorkerOptions:yi,ImageKind:Th,InvalidPDFException:Wp,MathClamp:dn,OPS:Ph,OutputScale:Wi,PDFDataRangeTransport:zb,PDFDateString:Dg,PDFWorker:Sc,PasswordResponses:e1,PermissionFlag:J2,PixelsPerInch:da,RenderingCancelledException:Tg,ResponseException:Rh,SignatureExtractor:ys,SupportedImageMimeTypes:Xp,TextLayer:Nh,TouchManager:Ih,Util:Qe,VerbosityLevel:Cf,XfaLayer:Ub,build:uw,createValidAbsoluteUrl:Pb,fetchData:Nc,getDocument:Bb,getFilenameFromUrl:i1,getPdfFilenameFromUrl:s1,getUuid:Ib,getXfaPageViewport:a1,isDataScheme:kf,isPdfFile:kg,isValidExplicitDest:j1,noContextMenu:Ei,normalizeUnicode:r1,setLayerDimensions:so,shadow:Ct,stopEvent:_r,updateUrlHash:Rb,version:jb},Symbol.toStringTag,{value:"Module"}));function cx(i){var e,t,r="";if(typeof i=="string"||typeof i=="number")r+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=cx(i[e]))&&(r&&(r+=" "),r+=t)}else for(t in i)i[t]&&(r&&(r+=" "),r+=t);return r}function Ig(){for(var i,e,t=0,r="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=cx(i))&&(r&&(r+=" "),r+=e);return r}var gy=Object.prototype.hasOwnProperty;function my(i,e,t){for(t of i.keys())if(bu(t,e))return t}function bu(i,e){var t,r,n;if(i===e)return!0;if(i&&e&&(t=i.constructor)===e.constructor){if(t===Date)return i.getTime()===e.getTime();if(t===RegExp)return i.toString()===e.toString();if(t===Array){if((r=i.length)===e.length)for(;r--&&bu(i[r],e[r]););return r===-1}if(t===Set){if(i.size!==e.size)return!1;for(r of i)if(n=r,n&&typeof n=="object"&&(n=my(e,n),!n)||!e.has(n))return!1;return!0}if(t===Map){if(i.size!==e.size)return!1;for(r of i)if(n=r[0],n&&typeof n=="object"&&(n=my(e,n),!n)||!bu(r[1],e.get(n)))return!1;return!0}if(t===ArrayBuffer)i=new Uint8Array(i),e=new Uint8Array(e);else if(t===DataView){if((r=i.byteLength)===e.byteLength)for(;r--&&i.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(i)){if((r=i.byteLength)===e.byteLength)for(;r--&&i[r]===e[r];);return r===-1}if(!t||typeof i=="object"){r=0;for(t in i)if(gy.call(i,t)&&++r&&!gy.call(e,t)||!(t in e)||!bu(i[t],e[t]))return!1;return Object.keys(e).length===r}}return i!==i&&e!==e}function If(i){let e=!1;return{promise:new Promise((r,n)=>{i.then(s=>!e&&r(s)).catch(s=>!e&&n(s))}),cancel(){e=!0}}}const iS=["onCopy","onCut","onPaste"],sS=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],aS=["onFocus","onBlur"],oS=["onInput","onInvalid","onReset","onSubmit"],lS=["onLoad","onError"],uS=["onKeyDown","onKeyPress","onKeyUp"],cS=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],hS=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],dS=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],fS=["onSelect"],pS=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],gS=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],mS=["onScroll"],bS=["onWheel"],vS=["onAnimationStart","onAnimationEnd","onAnimationIteration"],yS=["onTransitionEnd"],wS=["onToggle"],xS=["onChange"],AS=[...iS,...sS,...aS,...oS,...lS,...uS,...cS,...hS,...dS,...fS,...pS,...gS,...mS,...bS,...vS,...yS,...xS,...wS];function hx(i,e){const t={};for(const r of AS){const n=i[r];n&&(e?t[r]=s=>n(s,e(r)):t[r]=n)}return t}var ES=process.env.NODE_ENV==="production",ym="Invariant failed";function Qt(i,e){if(!i){if(ES)throw new Error(ym);var t=typeof e=="function"?e():e,r=t?"".concat(ym,": ").concat(t):ym;throw new Error(r)}}var _S=process.env.NODE_ENV!=="production",dx=function(){};if(_S){var CS=function(e,t){var r=arguments.length;t=new Array(r>1?r-1:0);for(var n=1;n<r;n++)t[n-1]=arguments[n];var s=0,a="Warning: "+e.replace(/%s/g,function(){return t[s++]});typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}};dx=function(i,e,t){var r=arguments.length;t=new Array(r>2?r-2:0);for(var n=2;n<r;n++)t[n-2]=arguments[n];if(e===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");i||CS.apply(null,[e].concat(t))}}var SS=dx;const fn=_g(SS),fx=Pe.createContext(null),TS="noopener noreferrer nofollow";class kS{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return Qt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(e){Qt(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise(t=>{Qt(this.pdfDocument,"PDF document not loaded."),Qt(e,"Destination is not specified."),typeof e=="string"?this.pdfDocument.getDestination(e).then(t):Array.isArray(e)?t(e):e.then(t)}).then(t=>{Qt(Array.isArray(t),`"${t}" is not a valid destination array.`);const r=t[0];new Promise(n=>{Qt(this.pdfDocument,"PDF document not loaded."),r instanceof Object?this.pdfDocument.getPageIndex(r).then(s=>{n(s)}).catch(()=>{Qt(!1,`"${r}" is not a valid page reference.`)}):typeof r=="number"?n(r):Qt(!1,`"${r}" is not a valid destination reference.`)}).then(n=>{const s=n+1;Qt(this.pdfViewer,"PDF viewer is not initialized."),Qt(s>=1&&s<=this.pagesCount,`"${s}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:n,pageNumber:s})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const t=e-1;Qt(this.pdfViewer,"PDF viewer is not initialized."),Qt(e>=1&&e<=this.pagesCount,`"${e}" is not a valid page number.`),this.pdfViewer.scrollPageIntoView({pageIndex:t,pageNumber:e})}addLinkAttributes(e,t,r){e.href=t,e.rel=this.externalLinkRel||TS,e.target=r?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}function vu({children:i,type:e}){return we.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:i})}const by={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};function DS(i,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return i}}function Tc(){return Pe.useReducer(DS,{value:void 0,error:void 0})}const Ng=typeof window<"u",px=Ng&&window.location.protocol==="file:";function PS(i){return typeof i<"u"}function xo(i){return PS(i)&&i!==null}function RS(i){return typeof i=="string"}function IS(i){return i instanceof ArrayBuffer}function NS(i){return Qt(Ng,"isBlob can only be used in a browser environment"),i instanceof Blob}function mb(i){return RS(i)&&/^data:/.test(i)}function vy(i){Qt(mb(i),"Invalid data URI.");const[e="",t=""]=i.split(",");return e.split(";").indexOf("base64")!==-1?atob(t):unescape(t)}function MS(){return Ng&&window.devicePixelRatio||1}const gx="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function yy(){fn(!px,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${gx}`)}function LS(){fn(!px,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${gx}`)}function Ul(i){i!=null&&i.cancel&&i.cancel()}function bb(i,e){return Object.defineProperty(i,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(i,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(i,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(i,"originalHeight",{get(){return this.view[3]},configurable:!0}),i}function OS(i){return i.name==="RenderingCancelledException"}function FS(i){return new Promise((e,t)=>{const r=new FileReader;r.onload=()=>{if(!r.result)return t(new Error("Error while reading a file."));e(r.result)},r.onerror=n=>{if(!n.target)return t(new Error("Error while reading a file."));const{error:s}=n.target;if(!s)return t(new Error("Error while reading a file."));switch(s.code){case s.NOT_FOUND_ERR:return t(new Error("Error while reading a file: File not found."));case s.SECURITY_ERR:return t(new Error("Error while reading a file: Security error."));case s.ABORT_ERR:return t(new Error("Error while reading a file: Aborted."));default:return t(new Error("Error while reading a file."))}},r.readAsArrayBuffer(i)})}const{PDFDataRangeTransport:BS}=nS,zS=(i,e)=>{switch(e){case by.NEED_PASSWORD:{const t=prompt("Enter the password to open this PDF file.");i(t);break}case by.INCORRECT_PASSWORD:{const t=prompt("Invalid password. Please try again.");i(t);break}}};function wy(i){return typeof i=="object"&&i!==null&&("data"in i||"range"in i||"url"in i)}const jS=Pe.forwardRef(function({children:e,className:t,error:r="Failed to load PDF file.",externalLinkRel:n,externalLinkTarget:s,file:a,inputRef:o,imageResourcesPath:l,loading:c="Loading PDF…",noData:h="No PDF file specified.",onItemClick:d,onLoadError:p,onLoadProgress:g,onLoadSuccess:y,onPassword:b=zS,onSourceError:w,onSourceSuccess:v,options:A,renderMode:E,rotate:_,scale:C,...I},k){const[D,R]=Tc(),{value:z,error:G}=D,[O,X]=Tc(),{value:S,error:J}=O,Y=Pe.useRef(new kS),W=Pe.useRef([]),fe=Pe.useRef(void 0),K=Pe.useRef(void 0);a&&a!==fe.current&&wy(a)&&(fn(!bu(a,fe.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),fe.current=a),A&&A!==K.current&&(fn(!bu(A,K.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),K.current=A);const be=Pe.useRef({scrollPageIntoView:Te=>{const{dest:x,pageNumber:U,pageIndex:B=U-1}=Te;if(d){d({dest:x,pageIndex:B,pageNumber:U});return}const F=W.current[B];if(F){F.scrollIntoView();return}fn(!1,`An internal link leading to page ${U} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});Pe.useImperativeHandle(k,()=>({linkService:Y,pages:W,viewer:be}),[]);function te(){v&&v()}function j(){G&&(fn(!1,G.toString()),w&&w(G))}function ie(){R({type:"RESET"})}Pe.useEffect(ie,[a,R]);const ae=Pe.useCallback(async()=>{if(!a)return null;if(typeof a=="string")return mb(a)?{data:vy(a)}:(yy(),{url:a});if(a instanceof BS)return{range:a};if(IS(a))return{data:a};if(Ng&&NS(a))return{data:await FS(a)};if(Qt(typeof a=="object","Invalid parameter in file, need either Uint8Array, string or a parameter object"),Qt(wy(a),"Invalid parameter object: need either .data, .range or .url"),"url"in a&&typeof a.url=="string"){if(mb(a.url)){const{url:Te,...x}=a;return{data:vy(Te),...x}}yy()}return a},[a]);Pe.useEffect(()=>{const Te=If(ae());return Te.promise.then(x=>{R({type:"RESOLVE",value:x})}).catch(x=>{R({type:"REJECT",error:x})}),()=>{Ul(Te)}},[ae,R]),Pe.useEffect(()=>{if(!(typeof z>"u")){if(z===!1){j();return}te()}},[z]);function H(){S&&(y&&y(S),W.current=new Array(S.numPages),Y.current.setDocument(S))}function se(){J&&(fn(!1,J.toString()),p&&p(J))}Pe.useEffect(function(){X({type:"RESET"})},[X,z]),Pe.useEffect(function(){if(!z)return;const x=A?{...z,...A}:z,U=Bb(x);g&&(U.onProgress=g),b&&(U.onPassword=b);const B=U,F=B.promise.then(M=>{X({type:"RESOLVE",value:M})}).catch(M=>{B.destroyed||X({type:"REJECT",error:M})});return()=>{F.finally(()=>B.destroy())}},[A,X,z]),Pe.useEffect(()=>{if(!(typeof S>"u")){if(S===!1){se();return}H()}},[S]),Pe.useEffect(function(){Y.current.setViewer(be.current),Y.current.setExternalLinkRel(n),Y.current.setExternalLinkTarget(s)},[n,s]);const le=Pe.useCallback((Te,x)=>{W.current[Te]=x},[]),oe=Pe.useCallback(Te=>{delete W.current[Te]},[]),ce=Pe.useMemo(()=>({imageResourcesPath:l,linkService:Y.current,onItemClick:d,pdf:S,registerPage:le,renderMode:E,rotate:_,scale:C,unregisterPage:oe}),[l,d,S,le,E,_,C,oe]),Ae=Pe.useMemo(()=>hx(I,()=>S),[I,S]);function Se(){function Te(U){return!!(U!=null&&U.pdf)}if(!Te(ce))throw new Error("pdf is undefined");const x=typeof e=="function"?e(ce):e;return we.jsx(fx.Provider,{value:ce,children:x})}function Ne(){return a?S==null?we.jsx(vu,{type:"loading",children:typeof c=="function"?c():c}):S===!1?we.jsx(vu,{type:"error",children:typeof r=="function"?r():r}):Se():we.jsx(vu,{type:"no-data",children:typeof h=="function"?h():h})}return we.jsx("div",{className:Ig("react-pdf__Document",t),ref:o,...Ae,children:Ne()})});function mx(){return Pe.useContext(fx)}function bx(){for(var i=[],e=0;e<arguments.length;e++)i[e]=arguments[e];var t=i.filter(Boolean);if(t.length<=1){var r=t[0];return r||null}return function(s){for(var a=0,o=t;a<o.length;a++){var l=o[a];typeof l=="function"?l(s):l&&(l.current=s)}}}const vx=Pe.createContext(null);function Mg(){return Pe.useContext(vx)}function US(){const i=mx(),e=Mg();Qt(e,"Unable to find Page context.");const t={...i,...e},{imageResourcesPath:r,linkService:n,onGetAnnotationsError:s,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:l,page:c,pdf:h,renderForms:d,rotate:p,scale:g=1}=t;Qt(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),Qt(c,"Attempted to load page annotations, but no page was specified."),Qt(n,"Attempted to load page annotations, but no linkService was specified.");const[y,b]=Tc(),{value:w,error:v}=y,A=Pe.useRef(null);fn(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function E(){w&&a&&a(w)}function _(){v&&(fn(!1,v.toString()),s&&s(v))}Pe.useEffect(function(){b({type:"RESET"})},[b,c]),Pe.useEffect(function(){if(!c)return;const R=If(c.getAnnotations()),z=R;return R.promise.then(G=>{b({type:"RESOLVE",value:G})}).catch(G=>{b({type:"REJECT",error:G})}),()=>{Ul(z)}},[b,c]),Pe.useEffect(()=>{if(w!==void 0){if(w===!1){_();return}E()}},[w]);function C(){l&&l()}function I(D){fn(!1,`${D}`),o&&o(D)}const k=Pe.useMemo(()=>c.getViewport({scale:g,rotation:p}),[c,p,g]);return Pe.useEffect(function(){if(!h||!c||!n||!w)return;const{current:R}=A;if(!R)return;const z=k.clone({dontFlip:!0}),G={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:R,l10n:null,page:c,structTreeLayer:null,viewport:z},O={annotations:w,annotationStorage:h.annotationStorage,div:R,imageResourcesPath:r,linkService:n,page:c,renderForms:d,viewport:z};R.innerHTML="";try{new $b(G).render(O),C()}catch(X){I(X)}return()=>{}},[w,r,n,c,h,d,k]),we.jsx("div",{className:Ig("react-pdf__Page__annotations","annotationLayer"),ref:A})}const yx={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},HS=/^H(\d+)$/;function $S(i){return i in yx}function Lg(i){return"children"in i}function wx(i){return Lg(i)?i.children.length===1&&0 in i.children&&"id"in i.children[0]:!1}function VS(i){const e={};if(Lg(i)){const{role:t}=i,r=t.match(HS);if(r)e.role="heading",e["aria-level"]=Number(r[1]);else if($S(t)){const n=yx[t];n&&(e.role=n)}}return e}function xx(i){const e={};if(Lg(i)){if(i.alt!==void 0&&(e["aria-label"]=i.alt),i.lang!==void 0&&(e.lang=i.lang),wx(i)){const[t]=i.children;if(t){const r=xx(t);return{...e,...r}}}}else"id"in i&&(e["aria-owns"]=i.id);return e}function GS(i){return i?{...VS(i),...xx(i)}:null}function Ax({className:i,node:e}){const t=Pe.useMemo(()=>GS(e),[e]),r=Pe.useMemo(()=>!Lg(e)||wx(e)?null:e.children.map((n,s)=>we.jsx(Ax,{node:n},s)),[e]);return we.jsx("span",{className:i,...t,children:r})}function qS(){const i=Mg();Qt(i,"Unable to find Page context.");const{onGetStructTreeError:e,onGetStructTreeSuccess:t}=i,[r,n]=Tc(),{value:s,error:a}=r,{customTextRenderer:o,page:l}=i;function c(){s&&t&&t(s)}function h(){a&&(fn(!1,a.toString()),e&&e(a))}return Pe.useEffect(function(){n({type:"RESET"})},[n,l]),Pe.useEffect(function(){if(o||!l)return;const p=If(l.getStructTree()),g=p;return p.promise.then(y=>{n({type:"RESOLVE",value:y})}).catch(y=>{n({type:"REJECT",error:y})}),()=>Ul(g)},[o,l,n]),Pe.useEffect(()=>{if(s!==void 0){if(s===!1){h();return}c()}},[s]),s?we.jsx(Ax,{className:"react-pdf__Page__structTree structTree",node:s}):null}const xy=vs;function WS(i){const e=Mg();Qt(e,"Unable to find Page context.");const t={...e,...i},{_className:r,canvasBackground:n,devicePixelRatio:s=MS(),onRenderError:a,onRenderSuccess:o,page:l,renderForms:c,renderTextLayer:h,rotate:d,scale:p}=t,{canvasRef:g}=i;Qt(l,"Attempted to render page canvas, but no page was specified.");const y=Pe.useRef(null);function b(){l&&o&&o(bb(l,p))}function w(_){OS(_)||(fn(!1,_.toString()),a&&a(_))}const v=Pe.useMemo(()=>l.getViewport({scale:p*s,rotation:d}),[s,l,d,p]),A=Pe.useMemo(()=>l.getViewport({scale:p,rotation:d}),[l,d,p]);Pe.useEffect(function(){if(!l)return;l.cleanup();const{current:C}=y;if(!C)return;C.width=v.width,C.height=v.height,C.style.width=`${Math.floor(A.width)}px`,C.style.height=`${Math.floor(A.height)}px`,C.style.visibility="hidden";const I={annotationMode:c?xy.ENABLE_FORMS:xy.ENABLE,canvasContext:C.getContext("2d",{alpha:!1}),viewport:v};n&&(I.background=n);const k=l.render(I),D=k;return k.promise.then(()=>{C.style.visibility="",b()}).catch(w),()=>Ul(D)},[n,l,c,v,A]);const E=Pe.useCallback(()=>{const{current:_}=y;_&&(_.width=0,_.height=0)},[]);return Pe.useEffect(()=>E,[E]),we.jsx("canvas",{className:`${r}__canvas`,dir:"ltr",ref:bx(g,y),style:{display:"block",userSelect:"none"},children:h?we.jsx(qS,{}):null})}function XS(i){return"str"in i}function YS(){const i=Mg();Qt(i,"Unable to find Page context.");const{customTextRenderer:e,onGetTextError:t,onGetTextSuccess:r,onRenderTextLayerError:n,onRenderTextLayerSuccess:s,page:a,pageIndex:o,pageNumber:l,rotate:c,scale:h}=i;Qt(a,"Attempted to load page text content, but no page was specified.");const[d,p]=Tc(),{value:g,error:y}=d,b=Pe.useRef(null);fn(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function w(){g&&r&&r(g)}function v(){y&&(fn(!1,y.toString()),t&&t(y))}Pe.useEffect(function(){p({type:"RESET"})},[a,p]),Pe.useEffect(function(){if(!a)return;const D=If(a.getTextContent()),R=D;return D.promise.then(z=>{p({type:"RESOLVE",value:z})}).catch(z=>{p({type:"REJECT",error:z})}),()=>Ul(R)},[a,p]),Pe.useEffect(()=>{if(g!==void 0){if(g===!1){v();return}w()}},[g]);const A=Pe.useCallback(()=>{s&&s()},[s]),E=Pe.useCallback(k=>{fn(!1,k.toString()),n&&n(k)},[n]);function _(){const k=b.current;k&&k.classList.add("selecting")}function C(){const k=b.current;k&&k.classList.remove("selecting")}const I=Pe.useMemo(()=>a.getViewport({scale:h,rotation:c}),[a,c,h]);return Pe.useLayoutEffect(function(){if(!a||!g)return;const{current:D}=b;if(!D)return;D.innerHTML="";const R=a.streamTextContent({includeMarkedContent:!0}),z={container:D,textContentSource:R,viewport:I},G=new Nh(z),O=G;return G.render().then(()=>{const X=document.createElement("div");X.className="endOfContent",D.append(X);const S=D.querySelectorAll('[role="presentation"]');if(e){let J=0;g.items.forEach((Y,W)=>{if(!XS(Y))return;const fe=S[J];if(!fe)return;const K=e({pageIndex:o,pageNumber:l,itemIndex:W,...Y});fe.innerHTML=K,J+=Y.str&&Y.hasEOL?2:1})}A()}).catch(E),()=>Ul(O)},[e,E,A,a,o,l,g,I]),we.jsx("div",{className:Ig("react-pdf__Page__textContent","textLayer"),onMouseUp:C,onMouseDown:_,ref:b})}const Ay=1;function ZS(i){const t={...mx(),...i},{_className:r="react-pdf__Page",_enableRegisterUnregisterPage:n=!0,canvasBackground:s,canvasRef:a,children:o,className:l,customRenderer:c,customTextRenderer:h,devicePixelRatio:d,error:p="Failed to load the page.",height:g,inputRef:y,loading:b="Loading page…",noData:w="No page specified.",onGetAnnotationsError:v,onGetAnnotationsSuccess:A,onGetStructTreeError:E,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:I,onLoadError:k,onLoadSuccess:D,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:z,onRenderError:G,onRenderSuccess:O,onRenderTextLayerError:X,onRenderTextLayerSuccess:S,pageIndex:J,pageNumber:Y,pdf:W,registerPage:fe,renderAnnotationLayer:K=!0,renderForms:be=!1,renderMode:te="canvas",renderTextLayer:j=!0,rotate:ie,scale:ae=Ay,unregisterPage:H,width:se,...le}=t,[oe,ce]=Tc(),{value:Ae,error:Se}=oe,Ne=Pe.useRef(null);Qt(W,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");const Te=xo(Y)?Y-1:J??null,x=Y??(xo(J)?J+1:null),U=ie??(Ae?Ae.rotate:null),B=Pe.useMemo(()=>{if(!Ae)return null;let $e=1;const Xe=ae??Ay;if(se||g){const Tt=Ae.getViewport({scale:1,rotation:U});se?$e=se/Tt.width:g&&($e=g/Tt.height)}return Xe*$e},[g,Ae,U,ae,se]);Pe.useEffect(function(){return()=>{xo(Te)&&n&&H&&H(Te)}},[n,W,Te,H]);function F(){if(D){if(!Ae||!B)return;D(bb(Ae,B))}if(n&&fe){if(!xo(Te)||!Ne.current)return;fe(Te,Ne.current)}}function M(){Se&&(fn(!1,Se.toString()),k&&k(Se))}Pe.useEffect(function(){ce({type:"RESET"})},[ce,W,Te]),Pe.useEffect(function(){if(!W||!x)return;const Xe=If(W.getPage(x)),Tt=Xe;return Xe.promise.then(nr=>{ce({type:"RESOLVE",value:nr})}).catch(nr=>{ce({type:"REJECT",error:nr})}),()=>Ul(Tt)},[ce,W,x]),Pe.useEffect(()=>{if(Ae!==void 0){if(Ae===!1){M();return}F()}},[Ae,B]);const q=Pe.useMemo(()=>xo(Te)&&x&&xo(U)&&xo(B)?{_className:r,canvasBackground:s,customTextRenderer:h,devicePixelRatio:d,onGetAnnotationsError:v,onGetAnnotationsSuccess:A,onGetStructTreeError:E,onGetStructTreeSuccess:_,onGetTextError:C,onGetTextSuccess:I,onRenderAnnotationLayerError:R,onRenderAnnotationLayerSuccess:z,onRenderError:G,onRenderSuccess:O,onRenderTextLayerError:X,onRenderTextLayerSuccess:S,page:Ae,pageIndex:Te,pageNumber:x,renderForms:be,renderTextLayer:j,rotate:U,scale:B}:null,[r,s,h,d,v,A,E,_,C,I,R,z,G,O,X,S,Ae,Te,x,be,j,U,B]),de=Pe.useMemo(()=>hx(le,()=>Ae&&(B?bb(Ae,B):void 0)),[le,Ae,B]),ye=`${Te}@${B}/${U}`;function ee(){switch(te){case"custom":return Qt(c,'renderMode was set to "custom", but no customRenderer was passed.'),we.jsx(c,{},`${ye}_custom`);case"none":return null;case"canvas":default:return we.jsx(WS,{canvasRef:a},`${ye}_canvas`)}}function Ee(){return j?we.jsx(YS,{},`${ye}_text`):null}function De(){return K?we.jsx(US,{},`${ye}_annotations`):null}function Ce(){function $e(Tt){return!!(Tt!=null&&Tt.page)}if(!$e(q))throw new Error("page is undefined");const Xe=typeof o=="function"?o(q):o;return we.jsxs(vx.Provider,{value:q,children:[ee(),Ee(),De(),Xe]})}function Me(){return x?W===null||Ae===void 0||Ae===null?we.jsx(vu,{type:"loading",children:typeof b=="function"?b():b}):W===!1||Ae===!1?we.jsx(vu,{type:"error",children:typeof p=="function"?p():p}):Ce():we.jsx(vu,{type:"no-data",children:typeof w=="function"?w():w})}return we.jsx("div",{className:Ig(r,l),"data-page-number":x,ref:bx(y,Ne),style:{"--scale-round-x":"1px","--scale-round-y":"1px","--scale-factor":"1","--user-unit":`${B}`,"--total-scale-factor":"calc(var(--scale-factor) * var(--user-unit))",backgroundColor:s||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"},...de,children:Me()})}LS();yi.workerSrc="pdf.worker.mjs";yi.workerSrc=`//unpkg.com/pdfjs-dist@${jb}/build/pdf.worker.min.mjs`;const KS=({onClose:i,src:e,title:t="PDF Viewer",className:r,onOpen:n})=>{const[s,a]=X2(),[o,l]=Y2(),[{currentPage:c,totalPages:h},d]=K2(),[{pan:p,isDragging:g},y]=Z2(),b=v=>{if(n?(console.debug("[PdfViewer] onOpen callback triggered",{hasHandler:!0}),n(v)):console.debug("[PdfViewer] open button clicked",{hasHandler:!1}),!v.defaultPrevented){if(!e){v.preventDefault();return}window.open(e,"_blank","noopener,noreferrer")}},w=we.jsx(Mt.IconButton,{variant:"text",color:"gray",onClick:b,children:we.jsx(W2,{className:"size-4"})});return we.jsxs("div",{className:zl("shadow rounded-t-lg flex flex-col h-full",r),children:[we.jsx(q2.Header,{onClose:i,right:w,children:t}),we.jsxs("div",{className:"grid grow h-full overflow-hidden",children:[we.jsx("div",{className:zl("col-start-1 row-start-1 bg-gray-200 h-full overflow-hidden select-none p-8",g?"cursor-grabbing":"cursor-grab"),onMouseDown:y.handleMouseDown,onMouseMove:y.handleMouseMove,onMouseUp:y.handleMouseUp,onMouseLeave:y.handleMouseUp,style:{userSelect:"none"},children:we.jsx("div",{style:{transform:`translate(${p.x}px, ${p.y}px)`,transition:g?"none":"transform 0.1s",pointerEvents:"none"},children:we.jsx(jS,{file:e,onLoadSuccess:({numPages:v})=>{d.setTotalPages(v)},scale:s/100,rotate:o,children:we.jsx(ZS,{pageNumber:c,renderTextLayer:!0,renderAnnotationLayer:!0})})})}),we.jsxs("div",{className:"col-start-1 row-start-1 self-end p-4 flex gap-2 justify-between w-full z-10",children:[we.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:a.zoomOut,children:we.jsx(vi.Icon,{icon:"lucide:minus"})}),we.jsx(Mt.Tooltip,{content:"Click to reset zoom and pan",children:we.jsxs("button",{className:"!bg-white text-center cursor-pointer w-[60px]",onClick:()=>{a.reset(),y.reset()},children:[s,"%"]})}),we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:a.zoomIn,children:we.jsx(vi.Icon,{icon:"lucide:plus"})})]}),we.jsxs(Mt.ButtonGroup,{className:"divide-x-0 h-[52px]",children:[we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.rotateClockwise,children:we.jsx(vi.Icon,{icon:"lucide:iteration-cw"})}),we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:l.rotateCounterClockwise,children:we.jsx(vi.Icon,{icon:"lucide:iteration-ccw"})})]}),we.jsxs(Mt.ButtonGroup,{className:"divide-x-0 ",children:[we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.prevPage,disabled:c===1,children:we.jsx(vi.Icon,{icon:"lucide:chevron-left"})}),we.jsx("input",{className:"bg-white pl-4 flex items-center w-[50px] text-center focus:outline-none w-[60px]",value:c,onChange:v=>{const A=parseInt(v.target.value);isNaN(A)||d.goToPage(A)},type:"number",min:"1",max:h}),we.jsxs("div",{className:"flex items-center bg-white px-2",children:["of ",h]}),we.jsx(Mt.IconButton,{variant:"filled",color:"white",className:"py-[26px]",onClick:d.nextPage,disabled:c===h,children:we.jsx(vi.Icon,{icon:"lucide:chevron-right"})})]})]})]})]})},QS=({...i})=>we.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...i,children:[we.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.16699 7.7334C4.91574 7.73357 6.33301 9.1516 6.33301 10.9004C6.33283 12.3905 5.30337 13.6386 3.91699 13.9756V15.25C3.91685 15.664 3.58098 15.9998 3.16699 16C2.75287 16 2.41713 15.6641 2.41699 15.25V13.9756C1.0303 13.6387 0.000177983 12.3906 0 10.9004C0 9.15149 1.41809 7.7334 3.16699 7.7334ZM3.16699 9.2334C2.24652 9.2334 1.5 9.97992 1.5 10.9004C1.50021 11.8207 2.24665 12.5664 3.16699 12.5664C4.08719 12.5662 4.8328 11.8206 4.83301 10.9004C4.83301 9.98002 4.08732 9.23357 3.16699 9.2334Z",fill:"currentColor"}),we.jsx("path",{d:"M11.8662 9.66699C12.2804 9.66699 12.6162 10.0028 12.6162 10.417V15.25C12.616 15.6641 12.2803 16 11.8662 16C11.4523 15.9998 11.1164 15.6639 11.1162 15.25V10.417C11.1162 10.0029 11.4522 9.66722 11.8662 9.66699Z",fill:"currentColor"}),we.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.8662 0C12.2804 0 12.6162 0.335786 12.6162 0.75V2.02344C14.0032 2.36025 15.0332 3.60999 15.0332 5.10059C15.0329 6.84904 13.6157 8.26633 11.8672 8.2666C10.1185 8.2666 8.70052 6.84921 8.7002 5.10059C8.7002 3.6104 9.7297 2.36066 11.1162 2.02344V0.75C11.1162 0.335929 11.4522 0.000230806 11.8662 0ZM11.8672 3.43359C10.9467 3.43359 10.2002 4.18011 10.2002 5.10059C10.2005 6.02078 10.9469 6.7666 11.8672 6.7666C12.7872 6.76633 13.5329 6.02062 13.5332 5.10059C13.5332 4.18028 12.7874 3.43387 11.8672 3.43359Z",fill:"currentColor"}),we.jsx("path",{d:"M3.16699 0C3.58107 0.000164881 3.91699 0.335888 3.91699 0.75V5.58301C3.91699 5.99712 3.58107 6.33284 3.16699 6.33301C2.75278 6.33301 2.41699 5.99722 2.41699 5.58301V0.75C2.41699 0.335786 2.75278 0 3.16699 0Z",fill:"currentColor"})]}),JS=()=>we.jsxs(Mt.Tabs,{className:"w-[800px]",children:[we.jsxs(Mt.TabsHeader,{children:[we.jsx(Mt.Tab,{value:"chats",children:"Chats"}),we.jsx(Mt.Tab,{value:"issues",children:"Issues"}),we.jsx("button",{className:"cursor-pointer mb-2 ml-auto rounded p-1 hover:bg-gray-100",children:we.jsx(QS,{className:"size-4"})})]}),we.jsxs(Mt.TabsBody,{children:[we.jsx(Mt.TabPanel,{value:"chats",children:"ChatsPanel"}),we.jsx(Mt.TabPanel,{value:"issues",children:"IssuesPanel"})]})]});var Ex={exports:{}},Nt={},br={};function eT(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r<i.length;r++)if(Xl(i,r)){var n=i[r];if(e.call(void 0,n,r,i))return n}}function Mc(i,e){return e===void 0&&(e=Object),e&&typeof e.getOwnPropertyDescriptors=="function"&&(i=e.create(null,e.getOwnPropertyDescriptors(i))),e&&typeof e.freeze=="function"?e.freeze(i):i}function Xl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}function tT(i,e){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var t in e)Xl(e,t)&&(i[t]=e[t]);return i}var _x=Mc({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function rT(i){return Xl(_x,i.toLowerCase())}var Cx=Mc({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function nT(i){return Xl(Cx,i.toLowerCase())}var Fh=Mc({script:!1,style:!1,textarea:!0,title:!0});function iT(i){var e=i.toLowerCase();return Xl(Fh,e)&&!Fh[e]}function sT(i){var e=i.toLowerCase();return Xl(Fh,e)&&Fh[e]}function Sx(i){return i===Bh.HTML}function aT(i){return Sx(i)||i===Bh.XML_XHTML_APPLICATION}var Bh=Mc({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),oT=Object.keys(Bh).map(function(i){return Bh[i]});function lT(i){return oT.indexOf(i)>-1}var uT=Mc({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});br.assign=tT;br.find=eT;br.freeze=Mc;br.HTML_BOOLEAN_ATTRIBUTES=_x;br.HTML_RAW_TEXT_ELEMENTS=Fh;br.HTML_VOID_ELEMENTS=Cx;br.hasDefaultHTMLNamespace=aT;br.hasOwn=Xl;br.isHTMLBooleanAttribute=rT;br.isHTMLRawTextElement=iT;br.isHTMLEscapableRawTextElement=sT;br.isHTMLMimeType=Sx;br.isHTMLVoidElement=nT;br.isValidMimeType=lT;br.MIME_TYPE=Bh;br.NAMESPACE=uT;var go={},cT=br;function Tx(i,e){i.prototype=Object.create(Error.prototype,{constructor:{value:i},name:{value:i.name,enumerable:!0,writable:e}})}var zh=cT.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),kx=Object.keys(zh);function Dx(i){return typeof i=="number"&&i>=1&&i<=25}function hT(i){return typeof i=="string"&&i.substring(i.length-zh.Error.length)===zh.Error}function Nf(i,e){Dx(i)?(this.name=kx[i],this.message=e||""):(this.message=i,this.name=hT(e)?e:zh.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Nf)}Tx(Nf,!0);Object.defineProperties(Nf.prototype,{code:{enumerable:!0,get:function(){var i=kx.indexOf(this.name);return Dx(i)?i:0}}});var Px={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},wm=Object.entries(Px);for(var op=0;op<wm.length;op++){var dT=wm[op][0];Nf[dT]=wm[op][1]}function qb(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,qb)}Tx(qb);go.DOMException=Nf;go.DOMExceptionName=zh;go.ExceptionCode=Px;go.ParseError=qb;var vr={},gt={};function Rx(i){try{typeof i!="function"&&(i=RegExp);var e=new i("𝌆","u").exec("𝌆");return!!e&&e[0].length===2}catch{}return!1}var Mf=Rx();function Hl(i){if(i.source[0]!=="[")throw new Error(i+" can not be used with chars");return i.source.slice(1,i.source.lastIndexOf("]"))}function kc(i,e){if(i.source[0]!=="[")throw new Error("/"+i.source+"/ can not be used with chars_without");if(!e||typeof e!="string")throw new Error(JSON.stringify(e)+" is not a valid search");if(i.source.indexOf(e)===-1)throw new Error('"'+e+'" is not is /'+i.source+"/");if(e==="-"&&i.source.indexOf(e)!==1)throw new Error('"'+e+'" is not at the first postion of /'+i.source+"/");return new RegExp(i.source.replace(e,""),Mf?"u":"")}function St(i){var e=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var r=typeof t=="string";if(r&&e===void 0&&t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return r?t:t.source}).join(""),Mf?"mu":"m")}function it(i){if(arguments.length===0)throw new Error("no parameters provided");return St.apply(it,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var fT="�",$l=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Mf&&($l=St("[",Hl($l),"\\u{10000}-\\u{10FFFF}","]"));var Wb=/[\x20\x09\x0D\x0A]/,pT=Hl(Wb),$t=St(Wb,"+"),dr=St(Wb,"*"),jh=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Mf&&(jh=St("[",Hl(jh),"\\u{10000}-\\u{10FFFF}","]"));var gT=Hl(jh),Xb=St("[",gT,Hl(/[-.0-9\xB7]/),Hl(/[\u0300-\u036F\u203F-\u2040]/),"]"),_i=St(jh,Xb,"*"),Ey=St(Xb,"+"),mT=St("&",_i,";"),bT=it(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Uh=it(mT,"|",bT),Hh=St("%",_i,";"),Yb=it(St('"',it(/[^%&"]/,"|",Hh,"|",Uh),"*",'"'),"|",St("'",it(/[^%&']/,"|",Hh,"|",Uh),"*","'")),vT=it('"',it(/[^<&"]/,"|",Uh),"*",'"',"|","'",it(/[^<&']/,"|",Uh),"*","'"),yT=kc(jh,":"),wT=kc(Xb,":"),_y=St(yT,wT,"*"),Lf=St(_y,it(":",_y),"?"),xT=St("^",Lf,"$"),AT=St("(",Lf,")"),$h=it(/"[^"]*"|'[^']*'/),ET=St(/^<\?/,"(",_i,")",it($t,"(",$l,"*?)"),"?",/\?>/),Cy=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Og=it('"',Cy,'*"',"|","'",kc(Cy,"'"),"*'"),Ix="<!--",Nx="-->",_T=St(Ix,it(kc($l,"-"),"|",St("-",kc($l,"-"))),"*",Nx),Sy="#PCDATA",CT=it(St(/\(/,dr,Sy,it(dr,/\|/,dr,Lf),"*",dr,/\)\*/),"|",St(/\(/,dr,Sy,dr,/\)/)),ST=/[?*+]?/,TT=St(/\([^>]+\)/,ST),kT=it("EMPTY","|","ANY","|",CT,"|",TT),DT="<!ELEMENT",PT=St(DT,$t,it(Lf,"|",Hh),$t,it(kT,"|",Hh),dr,">"),RT=St("NOTATION",$t,/\(/,dr,_i,it(dr,/\|/,dr,_i),"*",dr,/\)/),IT=St(/\(/,dr,Ey,it(dr,/\|/,dr,Ey),"*",dr,/\)/),NT=it(RT,"|",IT),MT=it(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",NT),LT=it(/#REQUIRED|#IMPLIED/,"|",it(it("#FIXED",$t),"?",vT)),OT=it($t,_i,$t,MT,$t,LT),FT="<!ATTLIST",BT=St(FT,$t,_i,OT,"*",dr,">"),vb="about:legacy-compat",zT=it('"'+vb+'"',"|","'"+vb+"'"),Zb="SYSTEM",Fg="PUBLIC",Bg=it(it(Zb,$t,$h),"|",it(Fg,$t,Og,$t,$h)),jT=St("^",it(it(Zb,$t,"(?<SystemLiteralOnly>",$h,")"),"|",it(Fg,$t,"(?<PubidLiteral>",Og,")",$t,"(?<SystemLiteral>",$h,")"))),UT=it($t,"NDATA",$t,_i),HT=it(Yb,"|",it(Bg,UT,"?")),Mx="<!ENTITY",$T=St(Mx,$t,_i,$t,HT,dr,">"),VT=it(Yb,"|",Bg),GT=St(Mx,$t,"%",$t,_i,$t,VT,dr,">"),qT=it($T,"|",GT),WT=St(Fg,$t,Og),XT=St("<!NOTATION",$t,_i,$t,it(Bg,"|",WT),dr,">"),Kb=St(dr,"=",dr),Ty=/1[.]\d+/,YT=St($t,"version",Kb,it("'",Ty,"'","|",'"',Ty,'"')),ky=/[A-Za-z][-A-Za-z0-9._]*/,ZT=it($t,"encoding",Kb,it('"',ky,'"',"|","'",ky,"'")),KT=it($t,"standalone",Kb,it("'",it("yes","|","no"),"'","|",'"',it("yes","|","no"),'"')),QT=St(/^<\?xml/,YT,ZT,"?",KT,"?",dr,/\?>/),JT="<!DOCTYPE",ek="<![CDATA[",tk="]]>",rk=/<!\[CDATA\[/,nk=/\]\]>/,ik=St($l,"*?",nk),sk=St(rk,ik);gt.chars=Hl;gt.chars_without=kc;gt.detectUnicodeSupport=Rx;gt.reg=St;gt.regg=it;gt.ABOUT_LEGACY_COMPAT=vb;gt.ABOUT_LEGACY_COMPAT_SystemLiteral=zT;gt.AttlistDecl=BT;gt.CDATA_START=ek;gt.CDATA_END=tk;gt.CDSect=sk;gt.Char=$l;gt.Comment=_T;gt.COMMENT_START=Ix;gt.COMMENT_END=Nx;gt.DOCTYPE_DECL_START=JT;gt.elementdecl=PT;gt.EntityDecl=qT;gt.EntityValue=Yb;gt.ExternalID=Bg;gt.ExternalID_match=jT;gt.Name=_i;gt.NotationDecl=XT;gt.Reference=Uh;gt.PEReference=Hh;gt.PI=ET;gt.PUBLIC=Fg;gt.PubidLiteral=Og;gt.QName=Lf;gt.QName_exact=xT;gt.QName_group=AT;gt.S=$t;gt.SChar_s=pT;gt.S_OPT=dr;gt.SYSTEM=Zb;gt.SystemLiteral=$h;gt.UNICODE_REPLACEMENT_CHARACTER=fT;gt.UNICODE_SUPPORT=Mf;gt.XMLDecl=QT;var xi=br,ws=xi.find,ak=xi.hasDefaultHTMLNamespace,Dc=xi.hasOwn,ok=xi.isHTMLMimeType,lk=xi.isHTMLRawTextElement,uk=xi.isHTMLVoidElement,Ch=xi.MIME_TYPE,xs=xi.NAMESPACE,Cn=Symbol(),Lx=go,et=Lx.DOMException,ck=Lx.DOMExceptionName,es=gt;function On(i){if(i!==Cn)throw new TypeError("Illegal constructor")}function hk(i){return i!==""}function dk(i){return i?i.split(/[\t\n\f\r ]+/).filter(hk):[]}function fk(i,e){return Dc(i,e)||(i[e]=!0),i}function Dy(i){if(!i)return[];var e=dk(i);return Object.keys(e.reduce(fk,{}))}function pk(i){return function(e){return i&&i.indexOf(e)!==-1}}function Ox(i){if(!es.QName_exact.test(i))throw new et(et.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+i+'"')}function yb(i,e){Ox(e),i=i||null;var t=null,r=e;if(e.indexOf(":")>=0){var n=e.split(":");t=n[0],r=n[1]}if(t!==null&&i===null)throw new et(et.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(t==="xml"&&i!==xi.NAMESPACE.XML)throw new et(et.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((t==="xmlns"||e==="xmlns")&&i!==xi.NAMESPACE.XMLNS)throw new et(et.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(i===xi.NAMESPACE.XMLNS&&t!=="xmlns"&&e!=="xmlns")throw new et(et.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[i,t,r]}function Lc(i,e){for(var t in i)Dc(i,t)&&(e[t]=i[t])}function Fn(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Lc(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var Bn={},Gi=Bn.ELEMENT_NODE=1,Pc=Bn.ATTRIBUTE_NODE=2,tg=Bn.TEXT_NODE=3,Fx=Bn.CDATA_SECTION_NODE=4,Bx=Bn.ENTITY_REFERENCE_NODE=5,gk=Bn.ENTITY_NODE=6,zx=Bn.PROCESSING_INSTRUCTION_NODE=7,jx=Bn.COMMENT_NODE=8,Vh=Bn.DOCUMENT_NODE=9,Ux=Bn.DOCUMENT_TYPE_NODE=10,oo=Bn.DOCUMENT_FRAGMENT_NODE=11,mk=Bn.NOTATION_NODE=12,fr=xi.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function Hx(i,e){if(e.length<i.length)return Hx(e,i);var t=null;for(var r in i){if(i[r]!==e[r])return t;t=i[r]}return t}function Py(i){return i.guid||(i.guid=Math.random()),i.guid}function Mr(){}Mr.prototype={length:0,item:function(i){return i>=0&&i<this.length?this[i]:null},toString:function(i){for(var e=[],t=0;t<this.length;t++)fu(this[t],e,i);return e.join("")},filter:function(i){return Array.prototype.filter.call(this,i)},indexOf:function(i){return Array.prototype.indexOf.call(this,i)}};Mr.prototype[Symbol.iterator]=function(){var i=this,e=0;return{next:function(){return e<i.length?{value:i[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Bl(i,e){this._node=i,this._refresh=e,zg(this)}function zg(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(eA(i,"length",t.length),!i.$$length||t.length<i.$$length)for(var r=t.length;r in i;r++)Dc(i,r)&&delete i[r];Lc(t,i),i._inc=e}}Bl.prototype.item=function(i){return zg(this),this[i]||null};Fn(Bl,Mr);function Rc(){}function $x(i,e){for(var t=0;t<i.length;){if(i[t]===e)return t;t++}}function bk(i,e,t,r){if(r?e[$x(e,r)]=t:(e[e.length]=t,e.length++),i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&qx(n,i,r),vk(n,i,t))}}function Ry(i,e,t){var r=$x(e,t);if(r>=0){for(var n=e.length-1;r<=n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&qx(s,i,t),t.ownerElement=null}}}Rc.prototype={length:0,item:Mr.prototype.item,getNamedItem:function(i){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase());for(var e=0;e<this.length;){var t=this[e];if(t.nodeName===i)return t;e++}return null},setNamedItem:function(i){var e=i.ownerElement;if(e&&e!==this._ownerElement)throw new et(et.INUSE_ATTRIBUTE_ERR);var t=this.getNamedItemNS(i.namespaceURI,i.localName);return t===i?i:(bk(this._ownerElement,this,i,t),t)},setNamedItemNS:function(i){return this.setNamedItem(i)},removeNamedItem:function(i){var e=this.getNamedItem(i);if(!e)throw new et(et.NOT_FOUND_ERR,i);return Ry(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);if(!t)throw new et(et.NOT_FOUND_ERR,i?i+" : "+e:e);return Ry(this._ownerElement,this,t),t},getNamedItemNS:function(i,e){i||(i=null);for(var t=0;t<this.length;){var r=this[t];if(r.localName===e&&r.namespaceURI===i)return r;t++}return null}};Rc.prototype[Symbol.iterator]=function(){var i=this,e=0;return{next:function(){return e<i.length?{value:i[e++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Vx(){}Vx.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=Ch.XML_APPLICATION;i===xs.HTML?r=Ch.XML_XHTML_APPLICATION:i===xs.SVG&&(r=Ch.XML_SVG_IMAGE);var n=new lo(Cn,{contentType:r});if(n.implementation=this,n.childNodes=new Mr,n.doctype=t||null,t&&n.appendChild(t),e){var s=n.createElementNS(i,e);n.appendChild(s)}return n},createDocumentType:function(i,e,t,r){Ox(i);var n=new Hg(Cn);return n.name=i,n.nodeName=i,n.publicId=e||"",n.systemId=t||"",n.internalSubset=r||"",n.childNodes=new Mr,n},createHTMLDocument:function(i){var e=new lo(Cn,{contentType:Ch.HTML});if(e.implementation=this,e.childNodes=new Mr,i!==!1){e.doctype=this.createDocumentType("html"),e.doctype.ownerDocument=e,e.appendChild(e.doctype);var t=e.createElement("html");e.appendChild(t);var r=e.createElement("head");if(t.appendChild(r),typeof i=="string"){var n=e.createElement("title");n.appendChild(e.createTextNode(i)),r.appendChild(n)}t.appendChild(e.createElement("body"))}return e}};function It(i){On(i)}It.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var i=this.getRootNode();return i&&i.nodeType===i.DOCUMENT_NODE},contains:function(i){if(!i)return!1;var e=i;do{if(this===e)return!0;e=i.parentNode}while(e);return!1},getRootNode:function(i){var e=this;do{if(!e.parentNode)return e;e=e.parentNode}while(e)},isEqualNode:function(i){if(!i||this.nodeType!==i.nodeType)return!1;switch(this.nodeType){case this.DOCUMENT_TYPE_NODE:if(this.name!==i.name||this.publicId!==i.publicId||this.systemId!==i.systemId)return!1;break;case this.ELEMENT_NODE:if(this.namespaceURI!==i.namespaceURI||this.prefix!==i.prefix||this.localName!==i.localName||this.attributes.length!==i.attributes.length)return!1;for(var e=0;e<this.attributes.length;e++){var t=this.attributes.item(e);if(!t.isEqualNode(i.getAttributeNodeNS(t.namespaceURI,t.localName)))return!1}break;case this.ATTRIBUTE_NODE:if(this.namespaceURI!==i.namespaceURI||this.localName!==i.localName||this.value!==i.value)return!1;break;case this.PROCESSING_INSTRUCTION_NODE:if(this.target!==i.target||this.data!==i.data)return!1;break;case this.TEXT_NODE:case this.COMMENT_NODE:if(this.data!==i.data)return!1;break}if(this.childNodes.length!==i.childNodes.length)return!1;for(var e=0;e<this.childNodes.length;e++)if(!this.childNodes[e].isEqualNode(i.childNodes[e]))return!1;return!0},isSameNode:function(i){return this===i},insertBefore:function(i,e){return rg(this,i,e)},replaceChild:function(i,e){rg(this,i,e,Zx),e&&this.removeChild(e)},removeChild:function(i){return Xx(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return wb(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==tg&&i.nodeType==tg?(this.removeChild(e),i.appendData(e.data)):(i.normalize(),i=e)}},isSupported:function(i,e){return this.ownerDocument.implementation.hasFeature(i,e)},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Dc(t,r)&&t[r]===i)return r}e=e.nodeType==Pc?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Dc(t,i))return t[i];e=e.nodeType==Pc?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null},compareDocumentPosition:function(i){if(this===i)return 0;var e=i,t=this,r=null,n=null;if(e instanceof Vl&&(r=e,e=r.ownerElement),t instanceof Vl&&(n=t,t=n.ownerElement,r&&e&&t===e))for(var s=0,a;a=t.attributes[s];s++){if(a===r)return fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+fr.DOCUMENT_POSITION_PRECEDING;if(a===n)return fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+fr.DOCUMENT_POSITION_FOLLOWING}if(!e||!t||t.ownerDocument!==e.ownerDocument)return fr.DOCUMENT_POSITION_DISCONNECTED+fr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(Py(t.ownerDocument)>Py(e.ownerDocument)?fr.DOCUMENT_POSITION_FOLLOWING:fr.DOCUMENT_POSITION_PRECEDING);if(n&&e===t)return fr.DOCUMENT_POSITION_CONTAINS+fr.DOCUMENT_POSITION_PRECEDING;if(r&&e===t)return fr.DOCUMENT_POSITION_CONTAINED_BY+fr.DOCUMENT_POSITION_FOLLOWING;for(var o=[],l=e.parentNode;l;){if(!n&&l===t)return fr.DOCUMENT_POSITION_CONTAINED_BY+fr.DOCUMENT_POSITION_FOLLOWING;o.push(l),l=l.parentNode}o.reverse();for(var c=[],h=t.parentNode;h;){if(!r&&h===e)return fr.DOCUMENT_POSITION_CONTAINS+fr.DOCUMENT_POSITION_PRECEDING;c.push(h),h=h.parentNode}c.reverse();var d=Hx(o,c);for(var p in d.childNodes){var g=d.childNodes[p];if(g===t)return fr.DOCUMENT_POSITION_FOLLOWING;if(g===e)return fr.DOCUMENT_POSITION_PRECEDING;if(c.indexOf(g)>=0)return fr.DOCUMENT_POSITION_FOLLOWING;if(o.indexOf(g)>=0)return fr.DOCUMENT_POSITION_PRECEDING}return 0}};function Gx(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}Lc(Bn,It);Lc(Bn,It.prototype);Lc(fr,It);Lc(fr,It.prototype);function kh(i,e){if(e(i))return!0;if(i=i.firstChild)do if(kh(i,e))return!0;while(i=i.nextSibling)}function lo(i,e){On(i);var t=e||{};this.ownerDocument=this,this.contentType=t.contentType||Ch.XML_APPLICATION,this.type=ok(this.contentType)?"html":"xml"}function vk(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===xs.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function qx(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===xs.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Wx(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t&&!t.nextSibling)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function Xx(i,e){if(i!==e.parentNode)throw new et(et.NOT_FOUND_ERR,"child's parent is not parent");var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,Wx(i.ownerDocument,i),e.parentNode=null,e.previousSibling=null,e.nextSibling=null,e}function yk(i){return i&&(i.nodeType===It.DOCUMENT_NODE||i.nodeType===It.DOCUMENT_FRAGMENT_NODE||i.nodeType===It.ELEMENT_NODE)}function wk(i){return i&&(i.nodeType===It.CDATA_SECTION_NODE||i.nodeType===It.COMMENT_NODE||i.nodeType===It.DOCUMENT_FRAGMENT_NODE||i.nodeType===It.DOCUMENT_TYPE_NODE||i.nodeType===It.ELEMENT_NODE||i.nodeType===It.PROCESSING_INSTRUCTION_NODE||i.nodeType===It.TEXT_NODE)}function uo(i){return i&&i.nodeType===It.DOCUMENT_TYPE_NODE}function la(i){return i&&i.nodeType===It.ELEMENT_NODE}function Yx(i){return i&&i.nodeType===It.TEXT_NODE}function Iy(i,e){var t=i.childNodes||[];if(ws(t,la)||uo(e))return!1;var r=ws(t,uo);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Ny(i,e){var t=i.childNodes||[];function r(s){return la(s)&&s!==e}if(ws(t,r))return!1;var n=ws(t,uo);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function xk(i,e,t){if(!yk(i))throw new et(et.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new et(et.NOT_FOUND_ERR,"child not in parent");if(!wk(e)||uo(e)&&i.nodeType!==It.DOCUMENT_NODE)throw new et(et.HIERARCHY_REQUEST_ERR,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function Ak(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===It.DOCUMENT_FRAGMENT_NODE){var s=n.filter(la);if(s.length>1||ws(n,Yx))throw new et(et.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!Iy(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(la(e)&&!Iy(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(uo(e)){if(ws(r,uo))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ws(r,la);if(t&&r.indexOf(a)<r.indexOf(t))throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!t&&a)throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function Zx(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===It.DOCUMENT_FRAGMENT_NODE){var s=n.filter(la);if(s.length>1||ws(n,Yx))throw new et(et.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!Ny(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(la(e)&&!Ny(i,t))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(uo(e)){if(ws(r,function(l){return uo(l)&&l!==t}))throw new et(et.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var a=ws(r,la);if(t&&r.indexOf(a)<r.indexOf(t))throw new et(et.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function rg(i,e,t,r){xk(i,e,t),i.nodeType===It.DOCUMENT_NODE&&(r||Ak)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===oo){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var o=t?t.previousSibling:i.lastChild;s.previousSibling=o,a.nextSibling=t,o?o.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return Wx(i.ownerDocument||i,i,e),e.nodeType==oo&&(e.firstChild=e.lastChild=null),e}lo.prototype={implementation:null,nodeName:"#document",nodeType:Vh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType===oo){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return rg(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===Gi&&(this.documentElement=i),i},removeChild:function(i){var e=Xx(this,i);return e===this.documentElement&&(this.documentElement=null),e},replaceChild:function(i,e){rg(this,i,e,Zx),i.ownerDocument=this,e&&this.removeChild(e),la(i)&&(this.documentElement=i)},importNode:function(i,e){return Jx(this,i,e)},getElementById:function(i){var e=null;return kh(this.documentElement,function(t){if(t.nodeType==Gi&&t.getAttribute("id")==i)return e=t,!0}),e},createElement:function(i){var e=new co(Cn);e.ownerDocument=this,this.type==="html"&&(i=i.toLowerCase()),ak(this.contentType)&&(e.namespaceURI=xs.HTML),e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new Mr;var t=e.attributes=new Rc;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Ff(Cn);return i.ownerDocument=this,i.childNodes=new Mr,i},createTextNode:function(i){var e=new Of(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createComment:function(i){var e=new jg(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createCDATASection:function(i){var e=new Ug(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Vg(Cn);return t.ownerDocument=this,t.childNodes=new Mr,t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){if(!es.QName_exact.test(i))throw new et(et.INVALID_CHARACTER_ERR,'invalid character in name "'+i+'"');return this.type==="html"&&(i=i.toLowerCase()),this._createAttribute(i)},_createAttribute:function(i){var e=new Vl(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){if(!es.Name.test(i))throw new et(et.INVALID_CHARACTER_ERR,'not a valid xml name "'+i+'"');if(this.type==="html")throw new et("document is an html document",ck.NotSupportedError);var e=new $g(Cn);return e.ownerDocument=this,e.childNodes=new Mr,e.nodeName=i,e},createElementNS:function(i,e){var t=yb(i,e),r=new co(Cn),n=r.attributes=new Rc;return r.childNodes=new Mr,r.ownerDocument=this,r.nodeName=e,r.tagName=e,r.namespaceURI=t[0],r.prefix=t[1],r.localName=t[2],n._ownerElement=r,r},createAttributeNS:function(i,e){var t=yb(i,e),r=new Vl(Cn);return r.ownerDocument=this,r.childNodes=new Mr,r.nodeName=e,r.name=e,r.specified=!0,r.namespaceURI=t[0],r.prefix=t[1],r.localName=t[2],r}};Fn(lo,It);function co(i){On(i),this._nsMap=Object.create(null)}co.prototype={nodeType:Gi,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===xs.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(i){return!!this.getAttributeNode(i)},getAttribute:function(i){var e=this.getAttributeNode(i);return e?e.value:null},getAttributeNode:function(i){return this._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase()),this.attributes.getNamedItem(i)},setAttribute:function(i,e){this._isInHTMLDocumentAndNamespace()&&(i=i.toLowerCase());var t=this.getAttributeNode(i);t?t.value=t.nodeValue=""+e:(t=this.ownerDocument._createAttribute(i),t.value=t.nodeValue=""+e,this.setAttributeNode(t))},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t?t.value:null},setAttributeNS:function(i,e,t){var r=yb(i,e),n=r[2],s=this.getAttributeNodeNS(i,n);s?s.value=s.nodeValue=""+t:(s=this.ownerDocument.createAttributeNS(i,e),s.value=s.nodeValue=""+t,this.setAttributeNode(s))},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByClassName:function(i){var e=Dy(i);return new Bl(this,function(t){var r=[];return e.length>0&&kh(t,function(n){if(n!==t&&n.nodeType===Gi){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var o=Dy(s);a=e.every(pk(o))}a&&r.push(n)}}}),r})},getElementsByTagName:function(i){var e=(this.nodeType===Vh?this:this.ownerDocument).type==="html",t=i.toLowerCase();return new Bl(this,function(r){var n=[];return kh(r,function(s){if(!(s===r||s.nodeType!==Gi))if(i==="*")n.push(s);else{var a=s.getQualifiedName(),o=e&&s.namespaceURI===xs.HTML?t:i;a===o&&n.push(s)}}),n})},getElementsByTagNameNS:function(i,e){return new Bl(this,function(t){var r=[];return kh(t,function(n){n!==t&&n.nodeType===Gi&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};lo.prototype.getElementsByClassName=co.prototype.getElementsByClassName;lo.prototype.getElementsByTagName=co.prototype.getElementsByTagName;lo.prototype.getElementsByTagNameNS=co.prototype.getElementsByTagNameNS;Fn(co,It);function Vl(i){On(i),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Vl.prototype.nodeType=Pc;Fn(Vl,It);function Oc(i){On(i)}Oc.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};Fn(Oc,It);function Of(i){On(i)}Of.prototype={nodeName:"#text",nodeType:tg,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Fn(Of,Oc);function jg(i){On(i)}jg.prototype={nodeName:"#comment",nodeType:jx};Fn(jg,Oc);function Ug(i){On(i)}Ug.prototype={nodeName:"#cdata-section",nodeType:Fx};Fn(Ug,Of);function Hg(i){On(i)}Hg.prototype.nodeType=Ux;Fn(Hg,It);function Qb(i){On(i)}Qb.prototype.nodeType=mk;Fn(Qb,It);function Jb(i){On(i)}Jb.prototype.nodeType=gk;Fn(Jb,It);function $g(i){On(i)}$g.prototype.nodeType=Bx;Fn($g,It);function Ff(i){On(i)}Ff.prototype.nodeName="#document-fragment";Ff.prototype.nodeType=oo;Fn(Ff,It);function Vg(i){On(i)}Vg.prototype.nodeType=zx;Fn(Vg,Oc);function Kx(){}Kx.prototype.serializeToString=function(i,e){return Qx.call(i,e)};It.prototype.toString=Qx;function Qx(i){var e=[],t=this.nodeType===Vh&&this.documentElement||this,r=t.prefix,n=t.namespaceURI;if(n&&r==null){var r=t.lookupPrefix(n);if(r==null)var s=[{namespace:n,prefix:null}]}return fu(this,e,i,s),e.join("")}function My(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===xs.XML||n===xs.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function xm(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Gx),'"')}function fu(i,e,t,r){r||(r=[]);var n=i.nodeType===Vh?i:i.ownerDocument,s=n.type==="html";if(t)if(i=t(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Gi:var a=i.attributes,o=a.length,E=i.firstChild,l=i.tagName,c=l;if(!s&&!i.prefix&&i.namespaceURI){for(var h,d=0;d<a.length;d++)if(a.item(d).name==="xmlns"){h=a.item(d).value;break}if(!h)for(var p=r.length-1;p>=0;p--){var g=r[p];if(g.prefix===""&&g.namespace===i.namespaceURI){h=g.namespace;break}}if(h!==i.namespaceURI)for(var p=r.length-1;p>=0;p--){var g=r[p];if(g.namespace===i.namespaceURI){g.prefix&&(c=g.prefix+":"+l);break}}}e.push("<",c);for(var y=0;y<o;y++){var b=a.item(y);b.prefix=="xmlns"?r.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&r.push({prefix:"",namespace:b.value})}for(var y=0;y<o;y++){var b=a.item(y);if(My(b,s,r)){var w=b.prefix||"",v=b.namespaceURI;xm(e,w?"xmlns:"+w:"xmlns",v),r.push({prefix:w,namespace:v})}fu(b,e,t,r)}if(l===c&&My(i,s,r)){var w=i.prefix||"",v=i.namespaceURI;xm(e,w?"xmlns:"+w:"xmlns",v),r.push({prefix:w,namespace:v})}var A=!E;if(A&&(s||i.namespaceURI===xs.HTML)&&(A=uk(l)),A)e.push("/>");else{if(e.push(">"),s&&lk(l))for(;E;)E.data?e.push(E.data):fu(E,e,t,r.slice()),E=E.nextSibling;else for(;E;)fu(E,e,t,r.slice()),E=E.nextSibling;e.push("</",c,">")}return;case Vh:case oo:for(var E=i.firstChild;E;)fu(E,e,t,r.slice()),E=E.nextSibling;return;case Pc:return xm(e,i.name,i.value);case tg:return e.push(i.data.replace(/[<&>]/g,Gx));case Fx:return e.push(es.CDATA_START,i.data,es.CDATA_END);case jx:return e.push(es.COMMENT_START,i.data,es.COMMENT_END);case Ux:var _=i.publicId,C=i.systemId;e.push(es.DOCTYPE_DECL_START," ",i.name),_?(e.push(" ",es.PUBLIC," ",_),C&&C!=="."&&e.push(" ",C)):C&&C!=="."&&e.push(" ",es.SYSTEM," ",C),i.internalSubset&&e.push(" [",i.internalSubset,"]"),e.push(">");return;case zx:return e.push("<?",i.target," ",i.data,"?>");case Bx:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Jx(i,e,t){var r;switch(e.nodeType){case Gi:r=e.cloneNode(!1),r.ownerDocument=i;case oo:break;case Pc:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(Jx(i,n,t)),n=n.nextSibling;return r}function wb(i,e,t){var r=new e.constructor(Cn);for(var n in e)if(Dc(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new Mr),r.ownerDocument=i,r.nodeType){case Gi:var a=e.attributes,o=r.attributes=new Rc,l=a.length;o._ownerElement=r;for(var c=0;c<l;c++)r.setAttributeNode(wb(i,a.item(c),!0));break;case Pc:t=!0}if(t)for(var h=e.firstChild;h;)r.appendChild(wb(i,h,t)),h=h.nextSibling;return r}function eA(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Gi:case oo:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Bl.prototype,"length",{get:function(){return zg(this),this.$$length}}),Object.defineProperty(It.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Gi:case oo:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),eA=function(e,t,r){e["$$"+t]=r}}}catch{}vr._updateLiveList=zg;vr.Attr=Vl;vr.CDATASection=Ug;vr.CharacterData=Oc;vr.Comment=jg;vr.Document=lo;vr.DocumentFragment=Ff;vr.DocumentType=Hg;vr.DOMImplementation=Vx;vr.Element=co;vr.Entity=Jb;vr.EntityReference=$g;vr.LiveNodeList=Bl;vr.NamedNodeMap=Rc;vr.Node=It;vr.NodeList=Mr;vr.Notation=Qb;vr.Text=Of;vr.ProcessingInstruction=Vg;vr.XMLSerializer=Kx;var Fc={},tA={};(function(i){var e=br.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
42
42
|
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),i.entityMap=i.HTML_ENTITIES})(tA);var Gg={},Bc=br,dt=gt,rA=go,Ek=Bc.isHTMLEscapableRawTextElement,_k=Bc.isHTMLMimeType,Ck=Bc.isHTMLRawTextElement,Gh=Bc.hasOwn,Ly=Bc.NAMESPACE,Oy=rA.ParseError,Sk=rA.DOMException,eh=0,ba=1,eu=2,th=3,tu=4,ru=5,rh=6,lp=7;function nA(){}nA.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),iA(e,e=Object.create(null)),Tk(i,e,t,r,this.errorHandler),r.endDocument()}};var ev=/&#?\w+;?/g;function Tk(i,e,t,r,n){var s=_k(r.mimeType);i.indexOf(dt.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function a(K){if(K>65535){K-=65536;var be=55296+(K>>10),te=56320+(K&1023);return String.fromCharCode(be,te)}else return String.fromCharCode(K)}function o(K){var be=K[K.length-1]===";"?K:K+";";if(!s&&be!==K)return n.error("EntityRef: expecting ;"),K;var te=dt.Reference.exec(be);if(!te||te[0].length!==be.length)return n.error("entity not matching Reference production: "+K),K;var j=be.slice(1,-1);return Gh(t,j)?t[j]:j.charAt(0)==="#"?a(parseInt(j.substring(1).replace("x","0x"))):(n.error("entity not found:"+K),K)}function l(K){if(K>w){var be=i.substring(w,K).replace(ev,o);p&&g(w),r.characters(be,0,K-w),w=K}}var c=0,h=0,d=/\r\n?|\n|$/g,p=r.locator;function g(K,be){for(;K>=h&&(be=d.exec(i));)c=h,h=be.index+be[0].length,p.lineNumber++;p.columnNumber=K-c+1}for(var y=[{currentNSMap:e}],b=[],w=0;;){try{var v=i.indexOf("<",w);if(v<0){if(!s&&b.length>0)return n.fatalError("unclosed xml tag(s): "+b.join(", "));if(!i.substring(w).match(/^\s*$/)){var A=r.doc,E=A.createTextNode(i.substring(w));if(A.documentElement)return n.error("Extra content at the end of the document");A.appendChild(E),r.currentElement=E}return}if(v>w){var _=i.substring(w,v);!s&&b.length===0&&(_=_.replace(new RegExp(dt.S_OPT.source,"g"),""),_&&n.error("Unexpected content outside root element: '"+_+"'")),l(v)}switch(i.charAt(v+1)){case"/":var S=i.indexOf(">",v+2),C=i.substring(v+2,S>0?S:void 0);if(!C)return n.fatalError("end tag name missing");var I=S>0&&dt.reg("^",dt.QName_group,dt.S_OPT,"$").exec(C);if(!I)return n.fatalError('end tag name contains invalid characters: "'+C+'"');if(!r.currentElement&&!r.doc.documentElement)return;var k=b[b.length-1]||r.currentElement.tagName||r.doc.documentElement.tagName||"";if(k!==I[1]){var D=I[1].toLowerCase();if(!s||k.toLowerCase()!==D)return n.fatalError('Opening and ending tag mismatch: "'+k+'" != "'+C+'"')}var R=y.pop();b.pop();var z=R.localNSMap;if(r.endElement(R.uri,R.localName,k),z)for(var G in z)Gh(z,G)&&r.endPrefixMapping(G);S++;break;case"?":p&&g(v),S=Rk(i,v,r,n);break;case"!":p&&g(v),S=aA(i,v,r,n,s);break;default:p&&g(v);var O=new oA,X=y[y.length-1].currentNSMap,S=kk(i,v,O,X,o,n,s),J=O.length;if(O.closed||(s&&Bc.isHTMLVoidElement(O.tagName)?O.closed=!0:b.push(O.tagName)),p&&J){for(var Y=Fy(p,{}),W=0;W<J;W++){var fe=O[W];g(fe.offset),fe.locator=Fy(p,{})}r.locator=Y,By(O,r,X)&&y.push(O),r.locator=p}else By(O,r,X)&&y.push(O);s&&!O.closed?S=Dk(i,S,O.tagName,o,r):S++}}catch(K){if(K instanceof Oy)throw K;if(K instanceof Sk)throw new Oy(K.name+": "+K.message,r.locator,K);n.error("element parse error: "+K),S=-1}S>w?w=S:l(Math.max(v,w)+1)}}function Fy(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function kk(i,e,t,r,n,s,a){function o(g,y,b){if(Gh(t.attributeNames,g))return s.fatalError("Attribute "+g+" redefined");if(!a&&y.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");t.addValue(g,y.replace(/[\t\n\r]/g," ").replace(ev,n),b)}for(var l,c,h=++e,d=eh;;){var p=i.charAt(h);switch(p){case"=":if(d===ba)l=i.slice(e,h),d=th;else if(d===eu)d=th;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===th||d===ba)if(d===ba&&(s.warning('attribute value must after "="'),l=i.slice(e,h)),e=h+1,h=i.indexOf(p,e),h>0)c=i.slice(e,h),o(l,c,e-1),d=ru;else throw new Error("attribute value no end '"+p+"' match");else if(d==tu)c=i.slice(e,h),o(l,c,e),s.warning('attribute "'+l+'" missed start quot('+p+")!!"),e=h+1,d=ru;else throw new Error('attribute value must after "="');break;case"/":switch(d){case eh:t.setTagName(i.slice(e,h));case ru:case rh:case lp:d=lp,t.closed=!0;case tu:case ba:break;case eu:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==eh&&t.setTagName(i.slice(e,h)),h;case">":switch(d){case eh:t.setTagName(i.slice(e,h));case ru:case rh:case lp:break;case tu:case ba:c=i.slice(e,h),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case eu:d===eu&&(c=l),d==tu?(s.warning('attribute "'+c+'" missed quot(")!'),o(l,c,e)):(a||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),o(c,c,e));break;case th:if(!a)return s.fatalError(`AttValue: ' or " expected`)}return h;case"":p=" ";default:if(p<=" ")switch(d){case eh:t.setTagName(i.slice(e,h)),d=rh;break;case ba:l=i.slice(e,h),d=eu;break;case tu:var c=i.slice(e,h);s.warning('attribute "'+c+'" missed quot(")!!'),o(l,c,e);case ru:d=rh;break}else switch(d){case eu:a||s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),o(l,l,e),e=h,d=ba;break;case ru:s.warning('attribute space is required"'+l+'"!!');case rh:d=ba,e=h;break;case th:d=tu,e=h;break;case lp:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function By(i,e,t){for(var r=i.tagName,n=null,d=i.length;d--;){var s=i[d],a=s.qName,o=s.value,p=a.indexOf(":");if(p>0)var l=s.prefix=a.slice(0,p),c=a.slice(p+1),h=l==="xmlns"&&c;else c=a,l=null,h=a==="xmlns"&&"";s.localName=c,h!==!1&&(n==null&&(n=Object.create(null),iA(t,t=Object.create(null))),t[h]=n[h]=o,s.uri=Ly.XMLNS,e.startPrefixMapping(h,o))}for(var d=i.length;d--;)s=i[d],s.prefix&&(s.prefix==="xml"&&(s.uri=Ly.XML),s.prefix!=="xmlns"&&(s.uri=t[s.prefix]));var p=r.indexOf(":");p>0?(l=i.prefix=r.slice(0,p),c=i.localName=r.slice(p+1)):(l=null,c=i.localName=r);var g=i.uri=t[l||""];if(e.startElement(g,c,r,i),i.closed){if(e.endElement(g,c,r),n)for(l in n)Gh(n,l)&&e.endPrefixMapping(l)}else return i.currentNSMap=t,i.localNSMap=n,!0}function Dk(i,e,t,r,n){var s=Ek(t);if(s||Ck(t)){var a=i.indexOf("</"+t+">",e),o=i.substring(e+1,a);return s&&(o=o.replace(ev,r)),n.characters(o,0,o.length),a}return e+1}function iA(i,e){for(var t in i)Gh(i,t)&&(e[t]=i[t])}function sA(i,e){var t=e;function r(h){return h=h||0,i.charAt(t+h)}function n(h){h=h||1,t+=h}function s(){for(var h=0;t<i.length;){var d=r();if(d!==" "&&d!==`
|
|
43
43
|
`&&d!==" "&&d!=="\r")return h;h++,n()}return-1}function a(){return i.substring(t)}function o(h){return i.substring(t,t+h.length)===h}function l(h){return i.substring(t,t+h.length).toUpperCase()===h.toUpperCase()}function c(h){var d=dt.reg("^",h),p=d.exec(a());return p?(n(p[0].length),p[0]):null}return{char:r,getIndex:function(){return t},getMatch:c,getSource:function(){return i},skip:n,skipBlanks:s,substringFromIndex:a,substringStartsWith:o,substringStartsWithCaseInsensitive:l}}function Pk(i,e){function t(o,l){var c=dt.PI.exec(o.substringFromIndex());return c?c[1].toLowerCase()==="xml"?l.fatalError("xml declaration is only allowed at the start of the document, but found at position "+o.getIndex()):(o.skip(c[0].length),c[0]):l.fatalError("processing instruction is not well-formed at position "+o.getIndex())}var r=i.getSource();if(i.char()==="["){i.skip(1);for(var n=i.getIndex();i.getIndex()<r.length;){if(i.skipBlanks(),i.char()==="]"){var s=r.substring(n,i.getIndex());return i.skip(1),s}var a=null;if(i.char()==="<"&&i.char(1)==="!")switch(i.char(2)){case"E":i.char(3)==="L"?a=i.getMatch(dt.elementdecl):i.char(3)==="N"&&(a=i.getMatch(dt.EntityDecl));break;case"A":a=i.getMatch(dt.AttlistDecl);break;case"N":a=i.getMatch(dt.NotationDecl);break;case"-":a=i.getMatch(dt.Comment);break}else if(i.char()==="<"&&i.char(1)==="?")a=t(i,e);else if(i.char()==="%")a=i.getMatch(dt.PEReference);else return e.fatalError("Error detected in Markup declaration");if(!a)return e.fatalError("Error in internal subset at position "+i.getIndex())}return e.fatalError("doctype internal subset is not well-formed, missing ]")}}function aA(i,e,t,r,n){var s=sA(i,e);switch(n?s.char(2).toUpperCase():s.char(2)){case"-":var a=s.getMatch(dt.Comment);return a?(t.comment(a,dt.COMMENT_START.length,a.length-dt.COMMENT_START.length-dt.COMMENT_END.length),s.getIndex()):r.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var o=s.getMatch(dt.CDSect);return o?!n&&!t.currentElement?r.fatalError("CDATA outside of element"):(t.startCDATA(),t.characters(o,dt.CDATA_START.length,o.length-dt.CDATA_START.length-dt.CDATA_END.length),t.endCDATA(),s.getIndex()):r.fatalError("Invalid CDATA starting at position "+e);case"D":{if(t.doc&&t.doc.documentElement)return r.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(n?!s.substringStartsWithCaseInsensitive(dt.DOCTYPE_DECL_START):!s.substringStartsWith(dt.DOCTYPE_DECL_START))return r.fatalError("Expected "+dt.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(dt.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return r.fatalError("Expected whitespace after "+dt.DOCTYPE_DECL_START+" at position "+s.getIndex());var l={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(l.name=s.getMatch(dt.Name),!l.name)return r.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(n&&l.name.toLowerCase()!=="html"&&r.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(dt.PUBLIC)||s.substringStartsWith(dt.SYSTEM)){var c=dt.ExternalID_match.exec(s.substringFromIndex());if(!c)return r.fatalError("doctype external id is not well-formed at position "+s.getIndex());c.groups.SystemLiteralOnly!==void 0?l.systemId=c.groups.SystemLiteralOnly:(l.systemId=c.groups.SystemLiteral,l.publicId=c.groups.PubidLiteral),s.skip(c[0].length)}else if(n&&s.substringStartsWithCaseInsensitive(dt.SYSTEM)){if(s.skip(dt.SYSTEM.length),s.skipBlanks()<1)return r.fatalError("Expected whitespace after "+dt.SYSTEM+" at position "+s.getIndex());if(l.systemId=s.getMatch(dt.ABOUT_LEGACY_COMPAT_SystemLiteral),!l.systemId)return r.fatalError("Expected "+dt.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+dt.SYSTEM+" at position "+s.getIndex())}return n&&l.systemId&&!dt.ABOUT_LEGACY_COMPAT_SystemLiteral.test(l.systemId)&&r.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),n||(s.skipBlanks(),l.internalSubset=Pk(s,r)),s.skipBlanks(),s.char()!==">"?r.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),t.startDTD(l.name,l.publicId,l.systemId,l.internalSubset),t.endDTD(),s.getIndex())}default:return r.fatalError('Not well-formed XML starting with "<!" at position '+e)}}function Rk(i,e,t,r){var n=i.substring(e).match(dt.PI);if(!n)return r.fatalError("Invalid processing instruction starting at position "+e);if(n[1].toLowerCase()==="xml"){if(e>0)return r.fatalError("processing instruction at position "+e+" is an xml declaration which is only at the start of the document");if(!dt.XMLDecl.test(i.substring(e)))return r.fatalError("xml declaration is not well-formed")}return t.processingInstruction(n[1],n[2]),e+n[0].length}function oA(){this.attributeNames=Object.create(null)}oA.prototype={setTagName:function(i){if(!dt.QName_exact.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!dt.QName_exact.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};Gg.XMLReader=nA;Gg.parseUtils=sA;Gg.parseDoctypeCommentOrCData=aA;var Yl=br,Ik=vr,Nk=go,zy=tA,Mk=Gg,Lk=Ik.DOMImplementation,Ok=Yl.hasDefaultHTMLNamespace,Fk=Yl.isHTMLMimeType,Bk=Yl.isValidMimeType,lA=Yl.MIME_TYPE,Am=Yl.NAMESPACE,jy=Nk.ParseError,zk=Mk.XMLReader;function uA(i){return i.replace(/\r[\n\u0085]/g,`
|
|
44
44
|
`).replace(/[\r\u0085\u2028\u2029]/g,`
|
package/dist/index.esm.js
CHANGED
|
@@ -20556,7 +20556,11 @@ const D5 = ({
|
|
|
20556
20556
|
onOpen: n
|
|
20557
20557
|
}) => {
|
|
20558
20558
|
const [s, a] = i1(), [o, l] = s1(), [{ currentPage: c, totalPages: h }, d] = o1(), [{ pan: p, isDragging: g }, y] = a1(), b = (v) => {
|
|
20559
|
-
if (n
|
|
20559
|
+
if (n ? (console.debug("[PdfViewer] onOpen callback triggered", {
|
|
20560
|
+
hasHandler: !0
|
|
20561
|
+
}), n(v)) : console.debug("[PdfViewer] open button clicked", {
|
|
20562
|
+
hasHandler: !1
|
|
20563
|
+
}), !v.defaultPrevented) {
|
|
20560
20564
|
if (!e) {
|
|
20561
20565
|
v.preventDefault();
|
|
20562
20566
|
return;
|
package/package.json
CHANGED
|
@@ -34,7 +34,16 @@ export const PdfViewer = ({
|
|
|
34
34
|
const [{ pan, isDragging }, panActions] = usePanning();
|
|
35
35
|
|
|
36
36
|
const handleOpen = (event: ReactMouseEvent<HTMLButtonElement>) => {
|
|
37
|
-
onOpen
|
|
37
|
+
if (onOpen) {
|
|
38
|
+
console.debug("[PdfViewer] onOpen callback triggered", {
|
|
39
|
+
hasHandler: true,
|
|
40
|
+
});
|
|
41
|
+
onOpen(event);
|
|
42
|
+
} else {
|
|
43
|
+
console.debug("[PdfViewer] open button clicked", {
|
|
44
|
+
hasHandler: false,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
38
47
|
if (event.defaultPrevented) {
|
|
39
48
|
return;
|
|
40
49
|
}
|