new pt(g,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};s=new L(n,a,this.ctx,l,h)}else s=this._getPattern(n[1],n[2]);return s}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(n,s,a){const h=d.Util.makeHexColor(n,s,a);this.ctx.strokeStyle=h,this.current.strokeColor=h}setFillRGBColor(n,s,a){const h=d.Util.makeHexColor(n,s,a);this.ctx.fillStyle=h,this.current.fillColor=h,this.current.patternFill=!1}_getPattern(n,s=null){let a;return this.cachedPatterns.has(n)?a=this.cachedPatterns.get(n):(a=y(this.getObject(n)),this.cachedPatterns.set(n,a)),s&&(a.matrix=s),a}shadingFill(n){if(!this.contentVisible)return;const s=this.ctx;this.save();const a=this._getPattern(n);s.fillStyle=a.getPattern(s,this,(0,Q.getCurrentTransformInverse)(s),H.SHADING);const h=(0,Q.getCurrentTransformInverse)(s);if(h){const{width:l,height:g}=s.canvas,[u,p,R,e]=d.Util.getAxialAlignedBoundingBox([0,0,l,g],h);this.ctx.fillRect(u,p,R-u,e-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,d.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,d.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(n,s){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(n)&&n.length===6&&this.transform(...n),this.baseTransform=(0,Q.getCurrentTransform)(this.ctx),s)){const a=s[2]-s[0],h=s[3]-s[1];this.ctx.rect(s[0],s[1],a,h),this.current.updateRectMinMax((0,Q.getCurrentTransform)(this.ctx),s),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(n){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const s=this.ctx;n.isolated||(0,d.info)("TODO: Support non-isolated groups."),n.knockout&&(0,d.warn)("Knockout groups not supported.");const a=(0,Q.getCurrentTransform)(s);if(n.matrix&&s.transform(...n.matrix),!n.bbox)throw new Error("Bounding box is required.");let h=d.Util.getAxialAlignedBoundingBox(n.bbox,(0,Q.getCurrentTransform)(s));const l=[0,0,s.canvas.width,s.canvas.height];h=d.Util.intersect(h,l)||[0,0,0,0];const g=Math.floor(h[0]),u=Math.floor(h[1]);let p=Math.max(Math.ceil(h[2])-g,1),R=Math.max(Math.ceil(h[3])-u,1),e=1,i=1;p>k&&(e=p/k,p=k),R>k&&(i=R/k,R=k),this.current.startNewPathAndClipBox([0,0,p,R]);let o="groupAt"+this.groupLevel;n.smask&&(o+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(o,p,R),M=m.context;M.scale(1/e,1/i),M.translate(-g,-u),M.transform(...a),n.smask?this.smaskStack.push({canvas:m.canvas,context:M,offsetX:g,offsetY:u,scaleX:e,scaleY:i,subtype:n.smask.subtype,backdrop:n.smask.backdrop,transferMap:n.smask.transferMap||null,startTransformInverse:null}):(s.setTransform(1,0,0,1,0,0),s.translate(g,u),s.scale(e,i),s.save()),Pt(s,M),this.ctx=M,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(s),this.groupLevel++}endGroup(n){if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,a=this.groupStack.pop();if(this.ctx=a,this.ctx.imageSmoothingEnabled=!1,n.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const h=(0,Q.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...h);const l=d.Util.getAxialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],h);this.ctx.drawImage(s.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(n,s,a,h,l){if(b(this,Zt,xi).call(this),Xt(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(s)&&s.length===4){const g=s[2]-s[0],u=s[3]-s[1];if(l&&this.annotationCanvasMap){a=a.slice(),a[4]-=s[0],a[5]-=s[1],s=s.slice(),s[0]=s[1]=0,s[2]=g,s[3]=u;const[p,R]=d.Util.singularValueDecompose2dScale((0,Q.getCurrentTransform)(this.ctx)),{viewportScale:e}=this,i=Math.ceil(g*this.outputScaleX*e),o=Math.ceil(u*this.outputScaleY*e);this.annotationCanvas=this.canvasFactory.create(i,o);const{canvas:m,context:M}=this.annotationCanvas;this.annotationCanvasMap.set(n,m),this.annotationCanvas.savedCtx=this.ctx,this.ctx=M,this.ctx.save(),this.ctx.setTransform(p,0,0,-R,0,u*R),Xt(this.ctx)}else Xt(this.ctx),this.ctx.rect(s[0],s[1],g,u),this.ctx.clip(),this.endPath()}this.current=new nt(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...a),this.transform(...h)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),b(this,Zt,Ei).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(n){if(!this.contentVisible)return;const s=n.count;n=this.getObject(n.data,n),n.count=s;const a=this.ctx,h=this.processingType3;if(h&&(h.compiled===void 0&&(h.compiled=ot(n)),h.compiled)){h.compiled(a);return}const l=this._createMaskCanvas(n),g=l.canvas;a.save(),a.setTransform(1,0,0,1,0,0),a.drawImage(g,l.offsetX,l.offsetY),a.restore(),this.compose()}paintImageMaskXObjectRepeat(n,s,a=0,h=0,l,g){if(!this.contentVisible)return;n=this.getObject(n.data,n);const u=this.ctx;u.save();const p=(0,Q.getCurrentTransform)(u);u.transform(s,a,h,l,0,0);const R=this._createMaskCanvas(n);u.setTransform(1,0,0,1,R.offsetX-p[4],R.offsetY-p[5]);for(let e=0,i=g.length;ei?e/i:1,u=R>i?R/i:1}}this._cachedScaleForStroking[0]=g,this._cachedScaleForStroking[1]=u}return this._cachedScaleForStroking}rescaleAndStroke(n){const{ctx:s}=this,{lineWidth:a}=this.current,[h,l]=this.getScaleForStroking();if(s.lineWidth=a||1,h===1&&l===1){s.stroke();return}const g=s.getLineDash();if(n&&s.save(),s.scale(h,l),g.length>0){const u=Math.max(h,l);s.setLineDash(g.map(p=>p/u)),s.lineDashOffset/=u}s.stroke(),n&&s.restore()}isContentVisible(){for(let n=this.markedContentStack.length-1;n>=0;n--)if(!this.markedContentStack[n].visible)return!1;return!0}};Zt=new WeakSet,xi=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},Ei=function(){if(this.pageColors){const n=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(n!=="none"){const s=this.ctx.filter;this.ctx.filter=n,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=s}}};let ee=pt;for(const S in d.OPS)ee.prototype[S]!==void 0&&(ee.prototype[d.OPS[S]]=ee.prototype[S])},419:(ie,$t,dt)=>{var Pt,Xt,ae,Jt,re,oe,Rt,ms,As,bs,Si,$s,Xs,Ms,Rs;dt.d($t,{DOMCMapReaderFactory:()=>I,DOMCanvasFactory:()=>z,DOMFilterFactory:()=>At,DOMSVGFactory:()=>E,DOMStandardFontDataFactory:()=>V,PDFDateString:()=>ht,PageViewport:()=>y,PixelsPerInch:()=>J,RenderingCancelledException:()=>D,StatTimer:()=>k,fetchData:()=>F,getColorValues:()=>Tt,getCurrentTransform:()=>ot,getCurrentTransformInverse:()=>nt,getFilenameFromUrl:()=>B,getPdfFilenameFromUrl:()=>K,getRGB:()=>bt,getXfaPageViewport:()=>st,isDataScheme:()=>L,isPdfFile:()=>Z,isValidFetchUrl:()=>O,noContextMenu:()=>C,setLayerDimensions:()=>Mt});var d=dt(583),Q=dt(292);const H="http://www.w3.org/2000/svg",It=class It{};he(It,"CSS",96),he(It,"PDF",72),he(It,"PDF_TO_CSS_UNITS",It.CSS/It.PDF);let J=It;class At extends d.BaseFilterFactory{constructor({docId:pt,ownerDocument:S=globalThis.document}={}){super();_(this,Rt);_(this,Pt);_(this,Xt);_(this,ae);_(this,Jt);_(this,re);_(this,oe,0);w(this,ae,pt),w(this,Jt,S)}addFilter(pt){if(!pt)return"none";let S=t(this,Rt,ms).get(pt);if(S)return S;let n,s,a,h;if(pt.length===1){const p=pt[0],R=new Array(256);for(let e=0;e<256;e++)R[e]=p[e]/255;h=n=s=a=R.join(",")}else{const[p,R,e]=pt,i=new Array(256),o=new Array(256),m=new Array(256);for(let M=0;M<256;M++)i[M]=p[M]/255,o[M]=R[M]/255,m[M]=e[M]/255;n=i.join(","),s=o.join(","),a=m.join(","),h=`${n}${s}${a}`}if(S=t(this,Rt,ms).get(h),S)return t(this,Rt,ms).set(pt,S),S;const l=`g_${t(this,ae)}_transfer_map_${Je(this,oe)._++}`,g=`url(#${l})`;t(this,Rt,ms).set(pt,g),t(this,Rt,ms).set(h,g);const u=b(this,Rt,$s).call(this,l);return b(this,Rt,Ms).call(this,n,s,a,u),g}addHCMFilter(pt,S){var i;const n=`${pt}-${S}`,s="base";let a=t(this,Rt,As).get(s);if((a==null?void 0:a.key)===n||(a?((i=a.filter)==null||i.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},t(this,Rt,As).set(s,a)),!pt||!S))return a.url;const h=b(this,Rt,Rs).call(this,pt);pt=Q.Util.makeHexColor(...h);const l=b(this,Rt,Rs).call(this,S);if(S=Q.Util.makeHexColor(...l),t(this,Rt,bs).style.color="",pt==="#000000"&&S==="#ffffff"||pt===S)return a.url;const g=new Array(256);for(let o=0;o<=255;o++){const m=o/255;g[o]=m<=.03928?m/12.92:((m+.055)/1.055)**2.4}const u=g.join(","),p=`g_${t(this,ae)}_hcm_filter`,R=a.filter=b(this,Rt,$s).call(this,p);b(this,Rt,Ms).call(this,u,u,u,R),b(this,Rt,Si).call(this,R);const e=(o,m)=>{const M=h[o]/255,$=l[o]/255,W=new Array(m+1);for(let tt=0;tt<=m;tt++)W[tt]=M+tt/m*($-M);return W.join(",")};return b(this,Rt,Ms).call(this,e(0,5),e(1,5),e(2,5),R),a.url=`url(#${p})`,a.url}addHighlightHCMFilter(pt,S,n,s,a){var $;const h=`${S}-${n}-${s}-${a}`;let l=t(this,Rt,As).get(pt);if((l==null?void 0:l.key)===h||(l?(($=l.filter)==null||$.remove(),l.key=h,l.url="none",l.filter=null):(l={key:h,url:"none",filter:null},t(this,Rt,As).set(pt,l)),!S||!n))return l.url;const[g,u]=[S,n].map(b(this,Rt,Rs).bind(this));let p=Math.round(.2126*g[0]+.7152*g[1]+.0722*g[2]),R=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),[e,i]=[s,a].map(b(this,Rt,Rs).bind(this));R{const it=new Array(256),_t=(R-p)/gt,Ot=W/255,jt=(tt-W)/(255*gt);let Gt=0;for(let Ut=0;Ut<=gt;Ut++){const lt=Math.round(p+Ut*_t),ut=Ot+Ut*jt;for(let T=Gt;T<=lt;T++)it[T]=ut;Gt=lt+1}for(let Ut=Gt;Ut<256;Ut++)it[Ut]=it[Gt-1];return it.join(",")},m=`g_${t(this,ae)}_hcm_${pt}_filter`,M=l.filter=b(this,Rt,$s).call(this,m);return b(this,Rt,Si).call(this,M),b(this,Rt,Ms).call(this,o(e[0],i[0],5),o(e[1],i[1],5),o(e[2],i[2],5),M),l.url=`url(#${m})`,l.url}destroy(pt=!1){pt&&t(this,Rt,As).size!==0||(t(this,Xt)&&(t(this,Xt).parentNode.parentNode.remove(),w(this,Xt,null)),t(this,Pt)&&(t(this,Pt).clear(),w(this,Pt,null)),w(this,oe,0))}}Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakMap,Rt=new WeakSet,ms=function(){return t(this,Pt)||w(this,Pt,new Map)},As=function(){return t(this,re)||w(this,re,new Map)},bs=function(){if(!t(this,Xt)){const pt=t(this,Jt).createElement("div"),{style:S}=pt;S.visibility="hidden",S.contain="strict",S.width=S.height=0,S.position="absolute",S.top=S.left=0,S.zIndex=-1;const n=t(this,Jt).createElementNS(H,"svg");n.setAttribute("width",0),n.setAttribute("height",0),w(this,Xt,t(this,Jt).createElementNS(H,"defs")),pt.append(n),n.append(t(this,Xt)),t(this,Jt).body.append(pt)}return t(this,Xt)},Si=function(pt){const S=t(this,Jt).createElementNS(H,"feColorMatrix");S.setAttribute("type","matrix"),S.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),pt.append(S)},$s=function(pt){const S=t(this,Jt).createElementNS(H,"filter");return S.setAttribute("color-interpolation-filters","sRGB"),S.setAttribute("id",pt),t(this,Rt,bs).append(S),S},Xs=function(pt,S,n){const s=t(this,Jt).createElementNS(H,S);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),pt.append(s)},Ms=function(pt,S,n,s){const a=t(this,Jt).createElementNS(H,"feComponentTransfer");s.append(a),b(this,Rt,Xs).call(this,a,"feFuncR",pt),b(this,Rt,Xs).call(this,a,"feFuncG",S),b(this,Rt,Xs).call(this,a,"feFuncB",n)},Rs=function(pt){return t(this,Rt,bs).style.color=pt,bt(getComputedStyle(t(this,Rt,bs)).getPropertyValue("color"))};class z extends d.BaseCanvasFactory{constructor({ownerDocument:mt=globalThis.document}={}){super(),this._document=mt}_createCanvas(mt,pt){const S=this._document.createElement("canvas");return S.width=mt,S.height=pt,S}}async function F(Nt,mt="text"){if(O(Nt,document.baseURI)){const pt=await fetch(Nt);if(!pt.ok)throw new Error(pt.statusText);switch(mt){case"arraybuffer":return pt.arrayBuffer();case"blob":return pt.blob();case"json":return pt.json()}return pt.text()}return new Promise((pt,S)=>{const n=new XMLHttpRequest;n.open("GET",Nt,!0),n.responseType=mt,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(mt){case"arraybuffer":case"blob":case"json":pt(n.response);return}pt(n.responseText);return}S(new Error(n.statusText))}},n.send(null)})}class I extends d.BaseCMapReaderFactory{_fetchData(mt,pt){return F(mt,this.isCompressed?"arraybuffer":"text").then(S=>({cMapData:S instanceof ArrayBuffer?new Uint8Array(S):(0,Q.stringToBytes)(S),compressionType:pt}))}}class V extends d.BaseStandardFontDataFactory{_fetchData(mt){return F(mt,"arraybuffer").then(pt=>new Uint8Array(pt))}}class E extends d.BaseSVGFactory{_createSVG(mt){return document.createElementNS(H,mt)}}class y{constructor({viewBox:mt,scale:pt,rotation:S,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}){this.viewBox=mt,this.scale=pt,this.rotation=S,this.offsetX=n,this.offsetY=s;const h=(mt[2]+mt[0])/2,l=(mt[3]+mt[1])/2;let g,u,p,R;switch(S%=360,S<0&&(S+=360),S){case 180:g=-1,u=0,p=0,R=1;break;case 90:g=0,u=1,p=1,R=0;break;case 270:g=0,u=-1,p=-1,R=0;break;case 0:g=1,u=0,p=0,R=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(p=-p,R=-R);let e,i,o,m;g===0?(e=Math.abs(l-mt[1])*pt+n,i=Math.abs(h-mt[0])*pt+s,o=(mt[3]-mt[1])*pt,m=(mt[2]-mt[0])*pt):(e=Math.abs(h-mt[0])*pt+n,i=Math.abs(l-mt[1])*pt+s,o=(mt[2]-mt[0])*pt,m=(mt[3]-mt[1])*pt),this.transform=[g*pt,u*pt,p*pt,R*pt,e-g*pt*h-p*pt*l,i-u*pt*h-R*pt*l],this.width=o,this.height=m}get rawDims(){const{viewBox:mt}=this;return(0,Q.shadow)(this,"rawDims",{pageWidth:mt[2]-mt[0],pageHeight:mt[3]-mt[1],pageX:mt[0],pageY:mt[1]})}clone({scale:mt=this.scale,rotation:pt=this.rotation,offsetX:S=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new y({viewBox:this.viewBox.slice(),scale:mt,rotation:pt,offsetX:S,offsetY:n,dontFlip:s})}convertToViewportPoint(mt,pt){return Q.Util.applyTransform([mt,pt],this.transform)}convertToViewportRectangle(mt){const pt=Q.Util.applyTransform([mt[0],mt[1]],this.transform),S=Q.Util.applyTransform([mt[2],mt[3]],this.transform);return[pt[0],pt[1],S[0],S[1]]}convertToPdfPoint(mt,pt){return Q.Util.applyInverseTransform([mt,pt],this.transform)}}class D extends Q.BaseException{constructor(mt,pt=0){super(mt,"RenderingCancelledException"),this.extraDelay=pt}}function L(Nt){const mt=Nt.length;let pt=0;for(;pt=1&&n<=12?n-1:0;let s=parseInt(pt[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(pt[4],10);a=a>=0&&a<=23?a:0;let h=parseInt(pt[5],10);h=h>=0&&h<=59?h:0;let l=parseInt(pt[6],10);l=l>=0&&l<=59?l:0;const g=pt[7]||"Z";let u=parseInt(pt[8],10);u=u>=0&&u<=23?u:0;let p=parseInt(pt[9],10)||0;return p=p>=0&&p<=59?p:0,g==="-"?(a+=u,h+=p):g==="+"&&(a-=u,h-=p),new Date(Date.UTC(S,n,s,a,h,l))}}function st(Nt,{scale:mt=1,rotation:pt=0}){const{width:S,height:n}=Nt.attributes.style,s=[0,0,parseInt(S),parseInt(n)];return new y({viewBox:s,scale:mt,rotation:pt})}function bt(Nt){if(Nt.startsWith("#")){const mt=parseInt(Nt.slice(1),16);return[(mt&16711680)>>16,(mt&65280)>>8,mt&255]}return Nt.startsWith("rgb(")?Nt.slice(4,-1).split(",").map(mt=>parseInt(mt)):Nt.startsWith("rgba(")?Nt.slice(5,-1).split(",").map(mt=>parseInt(mt)).slice(0,3):((0,Q.warn)(`Not a valid color format: "${Nt}"`),[0,0,0])}function Tt(Nt){const mt=document.createElement("span");mt.style.visibility="hidden",document.body.append(mt);for(const pt of Nt.keys()){mt.style.color=pt;const S=window.getComputedStyle(mt).color;Nt.set(pt,bt(S))}mt.remove()}function ot(Nt){const{a:mt,b:pt,c:S,d:n,e:s,f:a}=Nt.getTransform();return[mt,pt,S,n,s,a]}function nt(Nt){const{a:mt,b:pt,c:S,d:n,e:s,f:a}=Nt.getTransform().invertSelf();return[mt,pt,S,n,s,a]}function Mt(Nt,mt,pt=!1,S=!0){if(mt instanceof y){const{pageWidth:n,pageHeight:s}=mt.rawDims,{style:a}=Nt,h=Q.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${n}px`,g=`var(--scale-factor) * ${s}px`,u=h?`round(${l}, 1px)`:`calc(${l})`,p=h?`round(${g}, 1px)`:`calc(${g})`;!pt||mt.rotation%180===0?(a.width=u,a.height=p):(a.width=p,a.height=u)}S&&Nt.setAttribute("data-main-rotation",mt.rotation)}},47:(ie,$t,dt)=>{var J,At,z,F,I,Ci,E,Ti,ur;dt.d($t,{DrawLayer:()=>H});var d=dt(419),Q=dt(292);const L=class L{constructor({pageIndex:B}){_(this,E);_(this,J,null);_(this,At,0);_(this,z,new Map);_(this,F,new Map);this.pageIndex=B}setParent(B){if(!t(this,J)){w(this,J,B);return}if(t(this,J)!==B){if(t(this,z).size>0)for(const K of t(this,z).values())K.remove(),B.append(K);w(this,J,B)}}static get _svgFactory(){return(0,Q.shadow)(this,"_svgFactory",new d.DOMSVGFactory)}highlight(B,K,k,O=!1){const C=Je(this,At)._++,P=b(this,E,Ti).call(this,B.box);P.classList.add("highlight"),B.free&&P.classList.add("free");const ht=L._svgFactory.createElement("defs");P.append(ht);const st=L._svgFactory.createElement("path");ht.append(st);const bt=`path_p${this.pageIndex}_${C}`;st.setAttribute("id",bt),st.setAttribute("d",B.toSVGPath()),O&&t(this,F).set(C,st);const Tt=b(this,E,ur).call(this,ht,bt),ot=L._svgFactory.createElement("use");return P.append(ot),P.setAttribute("fill",K),P.setAttribute("fill-opacity",k),ot.setAttribute("href",`#${bt}`),t(this,z).set(C,P),{id:C,clipPathId:`url(#${Tt})`}}highlightOutline(B){const K=Je(this,At)._++,k=b(this,E,Ti).call(this,B.box);k.classList.add("highlightOutline");const O=L._svgFactory.createElement("defs");k.append(O);const C=L._svgFactory.createElement("path");O.append(C);const P=`path_p${this.pageIndex}_${K}`;C.setAttribute("id",P),C.setAttribute("d",B.toSVGPath()),C.setAttribute("vector-effect","non-scaling-stroke");let ht;if(B.free){k.classList.add("free");const Tt=L._svgFactory.createElement("mask");O.append(Tt),ht=`mask_p${this.pageIndex}_${K}`,Tt.setAttribute("id",ht),Tt.setAttribute("maskUnits","objectBoundingBox");const ot=L._svgFactory.createElement("rect");Tt.append(ot),ot.setAttribute("width","1"),ot.setAttribute("height","1"),ot.setAttribute("fill","white");const nt=L._svgFactory.createElement("use");Tt.append(nt),nt.setAttribute("href",`#${P}`),nt.setAttribute("stroke","none"),nt.setAttribute("fill","black"),nt.setAttribute("fill-rule","nonzero"),nt.classList.add("mask")}const st=L._svgFactory.createElement("use");k.append(st),st.setAttribute("href",`#${P}`),ht&&st.setAttribute("mask",`url(#${ht})`);const bt=st.cloneNode();return k.append(bt),st.classList.add("mainOutline"),bt.classList.add("secondaryOutline"),t(this,z).set(K,k),K}finalizeLine(B,K){const k=t(this,F).get(B);t(this,F).delete(B),this.updateBox(B,K.box),k.setAttribute("d",K.toSVGPath())}updateLine(B,K){t(this,z).get(B).firstChild.firstChild.setAttribute("d",K.toSVGPath())}removeFreeHighlight(B){this.remove(B),t(this,F).delete(B)}updatePath(B,K){t(this,F).get(B).setAttribute("d",K.toSVGPath())}updateBox(B,K){var k;b(k=L,I,Ci).call(k,t(this,z).get(B),K)}show(B,K){t(this,z).get(B).classList.toggle("hidden",!K)}rotate(B,K){t(this,z).get(B).setAttribute("data-main-rotation",K)}changeColor(B,K){t(this,z).get(B).setAttribute("fill",K)}changeOpacity(B,K){t(this,z).get(B).setAttribute("fill-opacity",K)}addClass(B,K){t(this,z).get(B).classList.add(K)}removeClass(B,K){t(this,z).get(B).classList.remove(K)}remove(B){t(this,J)!==null&&(t(this,z).get(B).remove(),t(this,z).delete(B))}destroy(){w(this,J,null);for(const B of t(this,z).values())B.remove();t(this,z).clear()}};J=new WeakMap,At=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakSet,Ci=function(B,{x:K=0,y:k=0,width:O=1,height:C=1}={}){const{style:P}=B;P.top=`${100*k}%`,P.left=`${100*K}%`,P.width=`${100*O}%`,P.height=`${100*C}%`},E=new WeakSet,Ti=function(B){var k;const K=L._svgFactory.create(1,1,!0);return t(this,J).append(K),K.setAttribute("aria-hidden",!0),b(k=L,I,Ci).call(k,K,B),K},ur=function(B,K){const k=L._svgFactory.createElement("clipPath");B.append(k);const O=`clip_${K}`;k.setAttribute("id",O),k.setAttribute("clipPathUnits","objectBoundingBox");const C=L._svgFactory.createElement("use");return k.append(C),C.setAttribute("href",`#${K}`),C.classList.add("clip"),O},_(L,I);let H=L},731:(ie,$t,dt)=>{var Z,B,K,k,O,C,P,ht,st,bt,Tt,pr,gr,fr,Ks,Pt,Ys,Js,mr,Mi,Ar,Qt,ue,Ae,Bt,le,ee,ce,Zt,Nt,mt,pt,S,n,s,a,h,l,g,u,p,Ri,Li,br,vr,yr,ki,Ls,W,vs,wr,Qs,ks,_r,xr,Er,Sr,ut,T,X,Y,vt,Et,Lt,Ht,te,de,be,we,Wt,v,f,x,Cr,Tr,Mr,Rr,Pi,Lr,Ii,kr,Pr,Ir,Dr,Fr,ls,Di,Zs,ti,ys,Fi,ei,De,Nr,Ni,Or,Hr,Oi,si,Ps,Ce,Pe,Qe,$e,Ze,ds,je,ns,qe,Ue,_s,ye,Is,Ds,ii,Hi,Br,Ur,Bi,ni,zr,rs,us,Ge,as,Xe,Ke,Ye,He,ts,ps,gs,Ne,ne,es,Fe,Vr,Ui,zi,Vi,ri;dt.d($t,{AnnotationEditorLayer:()=>L});var d=dt(292),Q=dt(310),H=dt(830),J=dt(976);const At=/\r\n?|\n/g,Rt=class Rt extends Q.AnnotationEditor{constructor(r){super({...r,name:"freeTextEditor"});_(this,Tt);_(this,Z,this.editorDivBlur.bind(this));_(this,B,this.editorDivFocus.bind(this));_(this,K,this.editorDivInput.bind(this));_(this,k,this.editorDivKeydown.bind(this));_(this,O,this.editorDivPaste.bind(this));_(this,C);_(this,P,"");_(this,ht,`${this.id}-editor`);_(this,st);_(this,bt,null);w(this,C,r.color||Rt._defaultColor||Q.AnnotationEditor._defaultLineColor),w(this,st,r.fontSize||Rt._defaultFontSize)}static get _keyboardManager(){const r=Rt.prototype,A=at=>at.isEmpty(),j=H.AnnotationEditorUIManager.TRANSLATE_SMALL,G=H.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,d.shadow)(this,"_keyboardManager",new H.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],r.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],r.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],r._translateEmpty,{args:[-j,0],checker:A}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],r._translateEmpty,{args:[-G,0],checker:A}],[["ArrowRight","mac+ArrowRight"],r._translateEmpty,{args:[j,0],checker:A}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],r._translateEmpty,{args:[G,0],checker:A}],[["ArrowUp","mac+ArrowUp"],r._translateEmpty,{args:[0,-j],checker:A}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],r._translateEmpty,{args:[0,-G],checker:A}],[["ArrowDown","mac+ArrowDown"],r._translateEmpty,{args:[0,j],checker:A}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],r._translateEmpty,{args:[0,G],checker:A}]]))}static initialize(r,A){Q.AnnotationEditor.initialize(r,A,{strings:["pdfjs-free-text-default-content"]});const j=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(j.getPropertyValue("--freetext-padding"))}static updateDefaultParams(r,A){switch(r){case d.AnnotationEditorParamsType.FREETEXT_SIZE:Rt._defaultFontSize=A;break;case d.AnnotationEditorParamsType.FREETEXT_COLOR:Rt._defaultColor=A;break}}updateParams(r,A){switch(r){case d.AnnotationEditorParamsType.FREETEXT_SIZE:b(this,Tt,pr).call(this,A);break;case d.AnnotationEditorParamsType.FREETEXT_COLOR:b(this,Tt,gr).call(this,A);break}}static get defaultPropertiesToUpdate(){return[[d.AnnotationEditorParamsType.FREETEXT_SIZE,Rt._defaultFontSize],[d.AnnotationEditorParamsType.FREETEXT_COLOR,Rt._defaultColor||Q.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[d.AnnotationEditorParamsType.FREETEXT_SIZE,t(this,st)],[d.AnnotationEditorParamsType.FREETEXT_COLOR,t(this,C)]]}_translateEmpty(r,A){this._uiManager.translateSelectedEditors(r,A,!0)}getInitialTranslation(){const r=this.parentScale;return[-Rt._internalPadding*r,-(Rt._internalPadding+t(this,st))*r]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(d.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",t(this,k)),this.editorDiv.addEventListener("focus",t(this,B)),this.editorDiv.addEventListener("blur",t(this,Z)),this.editorDiv.addEventListener("input",t(this,K)),this.editorDiv.addEventListener("paste",t(this,O)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",t(this,ht)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",t(this,k)),this.editorDiv.removeEventListener("focus",t(this,B)),this.editorDiv.removeEventListener("blur",t(this,Z)),this.editorDiv.removeEventListener("input",t(this,K)),this.editorDiv.removeEventListener("paste",t(this,O)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(r){this._focusEventsAllowed&&(super.focusin(r),r.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var r;this.width||(this.enableEditMode(),this.editorDiv.focus(),(r=this._initialOptions)!=null&&r.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const r=t(this,P),A=w(this,P,b(this,Tt,fr).call(this).trimEnd());if(r===A)return;const j=G=>{if(w(this,P,G),!G){this.remove();return}b(this,Tt,Js).call(this),this._uiManager.rebuild(this),b(this,Tt,Ks).call(this)};this.addCommands({cmd:()=>{j(A)},undo:()=>{j(r)},mustExec:!1}),b(this,Tt,Ks).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(r){this.enterInEditMode()}keydown(r){r.target===this.div&&r.key==="Enter"&&(this.enterInEditMode(),r.preventDefault())}editorDivKeydown(r){Rt._keyboardManager.exec(this,r)}editorDivFocus(r){this.isEditing=!0}editorDivBlur(r){this.isEditing=!1}editorDivInput(r){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let r,A;this.width&&(r=this.x,A=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",t(this,ht)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),Q.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then(G=>{var at;return(at=this.editorDiv)==null?void 0:at.setAttribute("default-content",G)}),this.editorDiv.contentEditable=!0;const{style:j}=this.editorDiv;if(j.fontSize=`calc(${t(this,st)}px * var(--scale-factor))`,j.color=t(this,C),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,H.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[G,at]=this.parentDimensions;if(this.annotationElementId){const{position:Ct}=t(this,bt);let[kt,wt]=this.getInitialTranslation();[kt,wt]=this.pageTranslationToScreen(kt,wt);const[qt,Vt]=this.pageDimensions,[pe,ge]=this.pageTranslation;let me,ve;switch(this.rotation){case 0:me=r+(Ct[0]-pe)/qt,ve=A+this.height-(Ct[1]-ge)/Vt;break;case 90:me=r+(Ct[0]-pe)/qt,ve=A-(Ct[1]-ge)/Vt,[kt,wt]=[wt,-kt];break;case 180:me=r-this.width+(Ct[0]-pe)/qt,ve=A-(Ct[1]-ge)/Vt,[kt,wt]=[-kt,-wt];break;case 270:me=r+(Ct[0]-pe-this.height*Vt)/qt,ve=A+(Ct[1]-ge-this.width*qt)/Vt,[kt,wt]=[-wt,kt];break}this.setAt(me*G,ve*at,kt,wt)}else this.setAt(r*G,A*at,this.width*G,this.height*at);b(this,Tt,Js).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(r){var me,ve,Ie;const A=r.clipboardData||window.clipboardData,{types:j}=A;if(j.length===1&&j[0]==="text/plain")return;r.preventDefault();const G=b(me=Rt,Pt,Mi).call(me,A.getData("text")||"").replaceAll(At,`
`);if(!G)return;const at=window.getSelection();if(!at.rangeCount)return;this.editorDiv.normalize(),at.deleteFromDocument();const Ct=at.getRangeAt(0);if(!G.includes(`
`)){Ct.insertNode(document.createTextNode(G)),this.editorDiv.normalize(),at.collapseToStart();return}const{startContainer:kt,startOffset:wt}=Ct,qt=[],Vt=[];if(kt.nodeType===Node.TEXT_NODE){const Te=kt.parentElement;if(Vt.push(kt.nodeValue.slice(wt).replaceAll(At,"")),Te!==this.editorDiv){let ke=qt;for(const Le of this.editorDiv.childNodes){if(Le===Te){ke=Vt;continue}ke.push(b(ve=Rt,Pt,Ys).call(ve,Le))}}qt.push(kt.nodeValue.slice(0,wt).replaceAll(At,""))}else if(kt===this.editorDiv){let Te=qt,ke=0;for(const Le of this.editorDiv.childNodes)ke++===wt&&(Te=Vt),Te.push(b(Ie=Rt,Pt,Ys).call(Ie,Le))}w(this,P,`${qt.join(`
`)}${G}${Vt.join(`
`)}`),b(this,Tt,Js).call(this);const pe=new Range;let ge=qt.reduce((Te,ke)=>Te+ke.length,0);for(const{firstChild:Te}of this.editorDiv.childNodes)if(Te.nodeType===Node.TEXT_NODE){const ke=Te.nodeValue.length;if(ge<=ke){pe.setStart(Te,ge),pe.setEnd(Te,ge);break}ge-=ke}at.removeAllRanges(),at.addRange(pe)}get contentDiv(){return this.editorDiv}static deserialize(r,A,j){var Ct;let G=null;if(r instanceof J.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:kt,fontColor:wt},rect:qt,rotation:Vt,id:pe},textContent:ge,textPosition:me,parent:{page:{pageNumber:ve}}}=r;if(!ge||ge.length===0)return null;G=r={annotationType:d.AnnotationEditorType.FREETEXT,color:Array.from(wt),fontSize:kt,value:ge.join(`
`),position:me,pageIndex:ve-1,rect:qt.slice(0),rotation:Vt,id:pe,deleted:!1}}const at=super.deserialize(r,A,j);return w(at,st,r.fontSize),w(at,C,d.Util.makeHexColor(...r.color)),w(at,P,b(Ct=Rt,Pt,Mi).call(Ct,r.value)),at.annotationElementId=r.id||null,w(at,bt,G),at}serialize(r=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const A=Rt._internalPadding*this.parentScale,j=this.getRect(A,A),G=Q.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:t(this,C)),at={annotationType:d.AnnotationEditorType.FREETEXT,color:G,fontSize:t(this,st),value:b(this,Tt,mr).call(this),pageIndex:this.pageIndex,rect:j,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return r?at:this.annotationElementId&&!b(this,Tt,Ar).call(this,at)?null:(at.id=this.annotationElementId,at)}renderAnnotationElement(r){const A=super.renderAnnotationElement(r);if(this.deleted)return A;const{style:j}=A;j.fontSize=`calc(${t(this,st)}px * var(--scale-factor))`,j.color=t(this,C),A.replaceChildren();for(const at of t(this,P).split(`
`)){const Ct=document.createElement("div");Ct.append(at?document.createTextNode(at):document.createElement("br")),A.append(Ct)}const G=Rt._internalPadding*this.parentScale;return r.updateEdited({rect:this.getRect(G,G)}),A}resetAnnotationElement(r){super.resetAnnotationElement(r),r.resetEdited()}};Z=new WeakMap,B=new WeakMap,K=new WeakMap,k=new WeakMap,O=new WeakMap,C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap,bt=new WeakMap,Tt=new WeakSet,pr=function(r){const A=G=>{this.editorDiv.style.fontSize=`calc(${G}px * var(--scale-factor))`,this.translate(0,-(G-t(this,st))*this.parentScale),w(this,st,G),b(this,Tt,Ks).call(this)},j=t(this,st);this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},gr=function(r){const A=G=>{w(this,C,this.editorDiv.style.color=G)},j=t(this,C);this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},fr=function(){var A;const r=[];this.editorDiv.normalize();for(const j of this.editorDiv.childNodes)r.push(b(A=Rt,Pt,Ys).call(A,j));return r.join(`
`)},Ks=function(){const[r,A]=this.parentDimensions;let j;if(this.isAttachedToDOM)j=this.div.getBoundingClientRect();else{const{currentLayer:G,div:at}=this,Ct=at.style.display,kt=at.classList.contains("hidden");at.classList.remove("hidden"),at.style.display="hidden",G.div.append(this.div),j=at.getBoundingClientRect(),at.remove(),at.style.display=Ct,at.classList.toggle("hidden",kt)}this.rotation%180===this.parentRotation%180?(this.width=j.width/r,this.height=j.height/A):(this.width=j.height/r,this.height=j.width/A),this.fixAndSetPosition()},Pt=new WeakSet,Ys=function(r){return(r.nodeType===Node.TEXT_NODE?r.nodeValue:r.innerText).replaceAll(At,"")},Js=function(){if(this.editorDiv.replaceChildren(),!!t(this,P))for(const r of t(this,P).split(`
`)){const A=document.createElement("div");A.append(r?document.createTextNode(r):document.createElement("br")),this.editorDiv.append(A)}},mr=function(){return t(this,P).replaceAll("\xA0"," ")},Mi=function(r){return r.replaceAll(" ","\xA0")},Ar=function(r){const{value:A,fontSize:j,color:G,pageIndex:at}=t(this,bt);return this._hasBeenMoved||r.value!==A||r.fontSize!==j||r.color.some((Ct,kt)=>Ct!==G[kt])||r.pageIndex!==at},_(Rt,Pt),he(Rt,"_freeTextDefaultContent",""),he(Rt,"_internalPadding",0),he(Rt,"_defaultColor",null),he(Rt,"_defaultFontSize",10),he(Rt,"_type","freetext"),he(Rt,"_editorType",d.AnnotationEditorType.FREETEXT);let z=Rt;var F=dt(61),I=dt(259),V=dt(419);const lt=class lt extends Q.AnnotationEditor{constructor(r){super({...r,name:"highlightEditor"});_(this,p);_(this,Qt,null);_(this,ue,0);_(this,Ae);_(this,Bt,null);_(this,le,null);_(this,ee,null);_(this,ce,null);_(this,Zt,0);_(this,Nt,null);_(this,mt,null);_(this,pt,null);_(this,S,!1);_(this,n,b(this,p,wr).bind(this));_(this,s,null);_(this,a);_(this,h,null);_(this,l,"");_(this,g);_(this,u,"");this.color=r.color||lt._defaultColor,w(this,g,r.thickness||lt._defaultThickness),w(this,a,r.opacity||lt._defaultOpacity),w(this,Ae,r.boxes||null),w(this,u,r.methodOfCreation||""),w(this,l,r.text||""),this._isDraggable=!1,r.highlightId>-1?(w(this,S,!0),b(this,p,Li).call(this,r),b(this,p,Ls).call(this)):(w(this,Qt,r.anchorNode),w(this,ue,r.anchorOffset),w(this,ce,r.focusNode),w(this,Zt,r.focusOffset),b(this,p,Ri).call(this),b(this,p,Ls).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const r=lt.prototype;return(0,d.shadow)(this,"_keyboardManager",new H.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],r._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],r._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],r._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],r._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:t(this,S)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:t(this,g),methodOfCreation:t(this,u)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(r){return{numberOfColors:r.get("color").size}}static initialize(r,A){var j;Q.AnnotationEditor.initialize(r,A),lt._defaultColor||(lt._defaultColor=((j=A.highlightColors)==null?void 0:j.values().next().value)||"#fff066")}static updateDefaultParams(r,A){switch(r){case d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:lt._defaultColor=A;break;case d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:lt._defaultThickness=A;break}}translateInPage(r,A){}get toolbarPosition(){return t(this,s)}updateParams(r,A){switch(r){case d.AnnotationEditorParamsType.HIGHLIGHT_COLOR:b(this,p,br).call(this,A);break;case d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:b(this,p,vr).call(this,A);break}}static get defaultPropertiesToUpdate(){return[[d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,lt._defaultColor],[d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,lt._defaultThickness]]}get propertiesToUpdate(){return[[d.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.color||lt._defaultColor],[d.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,t(this,g)||lt._defaultThickness],[d.AnnotationEditorParamsType.HIGHLIGHT_FREE,t(this,S)]]}async addEditToolbar(){const r=await super.addEditToolbar();return r?(this._uiManager.highlightColors&&(w(this,le,new I.ColorPicker({editor:this})),r.addColorPicker(t(this,le))),r):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,p,ks).call(this))}getBaseTranslation(){return[0,0]}getRect(r,A){return super.getRect(r,A,b(this,p,ks).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){b(this,p,ki).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,p,Ls).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(r){var j;let A=!1;this.parent&&!r?b(this,p,ki).call(this):r&&(b(this,p,Ls).call(this,r),A=!this.parent&&((j=this.div)==null?void 0:j.classList.contains("selectedEditor"))),super.setParent(r),this.show(this._isVisible),A&&this.select()}rotate(r){var G,at,Ct;const{drawLayer:A}=this.parent;let j;t(this,S)?(r=(r-this.rotation+360)%360,j=b(G=lt,W,vs).call(G,t(this,mt).box,r)):j=b(at=lt,W,vs).call(at,this,r),A.rotate(t(this,pt),r),A.rotate(t(this,h),r),A.updateBox(t(this,pt),j),A.updateBox(t(this,h),b(Ct=lt,W,vs).call(Ct,t(this,ee).box,r))}render(){if(this.div)return this.div;const r=super.render();t(this,l)&&(r.setAttribute("aria-label",t(this,l)),r.setAttribute("role","mark")),t(this,S)?r.classList.add("free"):this.div.addEventListener("keydown",t(this,n));const A=w(this,Nt,document.createElement("div"));r.append(A),A.setAttribute("aria-hidden","true"),A.className="internal",A.style.clipPath=t(this,Bt);const[j,G]=this.parentDimensions;return this.setDims(this.width*j,this.height*G),(0,H.bindEvents)(this,t(this,Nt),["pointerover","pointerleave"]),this.enableEditing(),r}pointerover(){this.parent.drawLayer.addClass(t(this,h),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(t(this,h),"hovered")}_moveCaret(r){switch(this.parent.unselect(this),r){case 0:case 2:b(this,p,Qs).call(this,!0);break;case 1:case 3:b(this,p,Qs).call(this,!1);break}}select(){var r,A;super.select(),t(this,h)&&((r=this.parent)==null||r.drawLayer.removeClass(t(this,h),"hovered"),(A=this.parent)==null||A.drawLayer.addClass(t(this,h),"selected"))}unselect(){var r;super.unselect(),t(this,h)&&((r=this.parent)==null||r.drawLayer.removeClass(t(this,h),"selected"),t(this,S)||b(this,p,Qs).call(this,!1))}get _mustFixPosition(){return!t(this,S)}show(r=this._isVisible){super.show(r),this.parent&&(this.parent.drawLayer.show(t(this,pt),r),this.parent.drawLayer.show(t(this,h),r))}static startHighlighting(r,A,{target:j,x:G,y:at}){const{x:Ct,y:kt,width:wt,height:qt}=j.getBoundingClientRect(),Vt=ve=>{b(this,W,Er).call(this,r,ve)},pe={capture:!0,passive:!1},ge=ve=>{ve.preventDefault(),ve.stopPropagation()},me=ve=>{j.removeEventListener("pointermove",Vt),window.removeEventListener("blur",me),window.removeEventListener("pointerup",me),window.removeEventListener("pointerdown",ge,pe),window.removeEventListener("contextmenu",V.noContextMenu),b(this,W,Sr).call(this,r,ve)};window.addEventListener("blur",me),window.addEventListener("pointerup",me),window.addEventListener("pointerdown",ge,pe),window.addEventListener("contextmenu",V.noContextMenu),j.addEventListener("pointermove",Vt),this._freeHighlight=new F.FreeOutliner({x:G,y:at},[Ct,kt,wt,qt],r.scale,this._defaultThickness/2,A,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=r.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(r,A,j){var ve;const G=super.deserialize(r,A,j),{rect:[at,Ct,kt,wt],color:qt,quadPoints:Vt}=r;G.color=d.Util.makeHexColor(...qt),w(G,a,r.opacity);const[pe,ge]=G.pageDimensions;G.width=(kt-at)/pe,G.height=(wt-Ct)/ge;const me=w(G,Ae,[]);for(let Ie=0;Ie=0)w(this,pt,A),w(this,Bt,j),this.parent.drawLayer.finalizeLine(A,r),w(this,h,this.parent.drawLayer.highlightOutline(t(this,ee)));else if(this.parent){const ge=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(t(this,pt),r),this.parent.drawLayer.updateBox(t(this,pt),b(Vt=lt,W,vs).call(Vt,t(this,mt).box,(ge-this.rotation+360)%360)),this.parent.drawLayer.updateLine(t(this,h),t(this,ee)),this.parent.drawLayer.updateBox(t(this,h),b(pe=lt,W,vs).call(pe,t(this,ee).box,ge))}const{x:at,y:Ct,width:kt,height:wt}=r.box;switch(this.rotation){case 0:this.x=at,this.y=Ct,this.width=kt,this.height=wt;break;case 90:{const[ge,me]=this.parentDimensions;this.x=Ct,this.y=1-at,this.width=kt*me/ge,this.height=wt*ge/me;break}case 180:this.x=1-at,this.y=1-Ct,this.width=kt,this.height=wt;break;case 270:{const[ge,me]=this.parentDimensions;this.x=1-Ct,this.y=at,this.width=kt*me/ge,this.height=wt*ge/me;break}}const{lastPoint:qt}=t(this,ee).box;w(this,s,[(qt[0]-at)/kt,(qt[1]-Ct)/wt])},br=function(r){const A=G=>{var at,Ct;this.color=G,(at=this.parent)==null||at.drawLayer.changeColor(t(this,pt),G),(Ct=t(this,le))==null||Ct.updateColor(G)},j=this.color;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(r)},!0)},vr=function(r){const A=t(this,g),j=G=>{w(this,g,G),b(this,p,yr).call(this,G)};this.addCommands({cmd:j.bind(this,r),undo:j.bind(this,A),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:r},!0)},yr=function(r){if(!t(this,S))return;b(this,p,Li).call(this,{highlightOutlines:t(this,mt).getNewOutline(r/2)}),this.fixAndSetPosition();const[A,j]=this.parentDimensions;this.setDims(this.width*A,this.height*j)},ki=function(){t(this,pt)===null||!this.parent||(this.parent.drawLayer.remove(t(this,pt)),w(this,pt,null),this.parent.drawLayer.remove(t(this,h)),w(this,h,null))},Ls=function(r=this.parent){t(this,pt)===null&&({id:Je(this,pt)._,clipPathId:Je(this,Bt)._}=r.drawLayer.highlight(t(this,mt),this.color,t(this,a)),w(this,h,r.drawLayer.highlightOutline(t(this,ee))),t(this,Nt)&&(t(this,Nt).style.clipPath=t(this,Bt)))},W=new WeakSet,vs=function({x:r,y:A,width:j,height:G},at){switch(at){case 90:return{x:1-A-G,y:r,width:G,height:j};case 180:return{x:1-r-j,y:1-A-G,width:j,height:G};case 270:return{x:A,y:1-r-j,width:G,height:j}}return{x:r,y:A,width:j,height:G}},wr=function(r){lt._keyboardManager.exec(this,r)},Qs=function(r){if(!t(this,Qt))return;const A=window.getSelection();r?A.setPosition(t(this,Qt),t(this,ue)):A.setPosition(t(this,ce),t(this,Zt))},ks=function(){return t(this,S)?this.rotation:0},_r=function(){if(t(this,S))return null;const[r,A]=this.pageDimensions,j=t(this,Ae),G=new Array(j.length*8);let at=0;for(const{x:Ct,y:kt,width:wt,height:qt}of j){const Vt=Ct*r,pe=(1-kt-qt)*A;G[at]=G[at+4]=Vt,G[at+1]=G[at+3]=pe,G[at+2]=G[at+6]=Vt+wt*r,G[at+5]=G[at+7]=pe+qt*A,at+=8}return G},xr=function(r){return t(this,mt).serialize(r,b(this,p,ks).call(this))},Er=function(r,A){this._freeHighlight.add(A)&&r.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},Sr=function(r,A){this._freeHighlight.isEmpty()?r.drawLayer.removeFreeHighlight(this._freeHighlightId):r.createAndAddNewEditor(A,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},_(lt,W),he(lt,"_defaultColor",null),he(lt,"_defaultOpacity",1),he(lt,"_defaultThickness",12),he(lt,"_l10nPromise"),he(lt,"_type","highlight"),he(lt,"_editorType",d.AnnotationEditorType.HIGHLIGHT),he(lt,"_freeHighlightId",-1),he(lt,"_freeHighlight",null),he(lt,"_freeHighlightClipId","");let E=lt;const _e=class _e extends Q.AnnotationEditor{constructor(r){super({...r,name:"inkEditor"});_(this,x);_(this,ut,0);_(this,T,0);_(this,X,this.canvasPointermove.bind(this));_(this,Y,this.canvasPointerleave.bind(this));_(this,vt,this.canvasPointerup.bind(this));_(this,Et,this.canvasPointerdown.bind(this));_(this,Lt,null);_(this,Ht,new Path2D);_(this,te,!1);_(this,de,!1);_(this,be,!1);_(this,we,null);_(this,Wt,0);_(this,v,0);_(this,f,null);this.color=r.color||null,this.thickness=r.thickness||null,this.opacity=r.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(r,A){Q.AnnotationEditor.initialize(r,A)}static updateDefaultParams(r,A){switch(r){case d.AnnotationEditorParamsType.INK_THICKNESS:_e._defaultThickness=A;break;case d.AnnotationEditorParamsType.INK_COLOR:_e._defaultColor=A;break;case d.AnnotationEditorParamsType.INK_OPACITY:_e._defaultOpacity=A/100;break}}updateParams(r,A){switch(r){case d.AnnotationEditorParamsType.INK_THICKNESS:b(this,x,Cr).call(this,A);break;case d.AnnotationEditorParamsType.INK_COLOR:b(this,x,Tr).call(this,A);break;case d.AnnotationEditorParamsType.INK_OPACITY:b(this,x,Mr).call(this,A);break}}static get defaultPropertiesToUpdate(){return[[d.AnnotationEditorParamsType.INK_THICKNESS,_e._defaultThickness],[d.AnnotationEditorParamsType.INK_COLOR,_e._defaultColor||Q.AnnotationEditor._defaultLineColor],[d.AnnotationEditorParamsType.INK_OPACITY,Math.round(_e._defaultOpacity*100)]]}get propertiesToUpdate(){return[[d.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||_e._defaultThickness],[d.AnnotationEditorParamsType.INK_COLOR,this.color||_e._defaultColor||Q.AnnotationEditor._defaultLineColor],[d.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??_e._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(b(this,x,Zs).call(this),b(this,x,ti).call(this)),this.isAttachedToDOM||(this.parent.add(this),b(this,x,ys).call(this)),b(this,x,Ps).call(this)))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,t(this,Lt)&&(clearTimeout(t(this,Lt)),w(this,Lt,null)),t(this,we).disconnect(),w(this,we,null),super.remove())}setParent(r){!this.parent&&r?this._uiManager.removeShouldRescale(this):this.parent&&r===null&&this._uiManager.addShouldRescale(this),super.setParent(r)}onScaleChanging(){const[r,A]=this.parentDimensions,j=this.width*r,G=this.height*A;this.setDimensions(j,G)}enableEditMode(){t(this,te)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",t(this,Et)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",t(this,Et)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){t(this,te)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),w(this,te,!0),this.div.classList.add("disabled"),b(this,x,Ps).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(r){this._focusEventsAllowed&&(super.focusin(r),this.enableEditMode())}canvasPointerdown(r){r.button!==0||!this.isInEditMode()||t(this,te)||(this.setInForeground(),r.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),b(this,x,Lr).call(this,r.offsetX,r.offsetY))}canvasPointermove(r){r.preventDefault(),b(this,x,Ii).call(this,r.offsetX,r.offsetY)}canvasPointerup(r){r.preventDefault(),b(this,x,Di).call(this,r)}canvasPointerleave(r){b(this,x,Di).call(this,r)}get isResizable(){return!this.isEmpty()&&t(this,te)}render(){if(this.div)return this.div;let r,A;this.width&&(r=this.x,A=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[j,G,at,Ct]=b(this,x,Rr).call(this);if(this.setAt(j,G,0,0),this.setDims(at,Ct),b(this,x,Zs).call(this),this.width){const[kt,wt]=this.parentDimensions;this.setAspectRatio(this.width*kt,this.height*wt),this.setAt(r*kt,A*wt,this.width*kt,this.height*wt),w(this,be,!0),b(this,x,ys).call(this),this.setDims(this.width*kt,this.height*wt),b(this,x,ls).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return b(this,x,ti).call(this),this.div}setDimensions(r,A){const j=Math.round(r),G=Math.round(A);if(t(this,Wt)===j&&t(this,v)===G)return;w(this,Wt,j),w(this,v,G),this.canvas.style.visibility="hidden";const[at,Ct]=this.parentDimensions;this.width=r/at,this.height=A/Ct,this.fixAndSetPosition(),t(this,te)&&b(this,x,Fi).call(this,r,A),b(this,x,ys).call(this),b(this,x,ls).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(r,A,j){var Ie,Te,ke;if(r instanceof J.InkAnnotationElement)return null;const G=super.deserialize(r,A,j);G.thickness=r.thickness,G.color=d.Util.makeHexColor(...r.color),G.opacity=r.opacity;const[at,Ct]=G.pageDimensions,kt=G.width*at,wt=G.height*Ct,qt=G.parentScale,Vt=r.thickness/2;w(G,te,!0),w(G,Wt,Math.round(kt)),w(G,v,Math.round(wt));const{paths:pe,rect:ge,rotation:me}=r;for(let{bezier:Le}of pe){Le=b(Ie=_e,De,Or).call(Ie,Le,ge,me);const We=[];G.paths.push(We);let Es=qt*(Le[0]-Vt),Ss=qt*(Le[1]-Vt);for(let Ve=2,gi=Le.length;Ve{this.thickness=G,b(this,x,Ps).call(this)},j=this.thickness;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Tr=function(r){const A=G=>{this.color=G,b(this,x,ls).call(this)},j=this.color;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Mr=function(r){const A=G=>{this.opacity=G,b(this,x,ls).call(this)};r/=100;const j=this.opacity;this.addCommands({cmd:A.bind(this,r),undo:A.bind(this,j),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:d.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Rr=function(){const{parentRotation:r,parentDimensions:[A,j]}=this;switch(r){case 90:return[0,j,j,A];case 180:return[A,j,A,j];case 270:return[A,0,j,A];default:return[0,0,A,j]}},Pi=function(){const{ctx:r,color:A,opacity:j,thickness:G,parentScale:at,scaleFactor:Ct}=this;r.lineWidth=G*at/Ct,r.lineCap="round",r.lineJoin="round",r.miterLimit=10,r.strokeStyle=`${A}${(0,H.opacityToHex)(j)}`},Lr=function(r,A){this.canvas.addEventListener("contextmenu",V.noContextMenu),this.canvas.addEventListener("pointerleave",t(this,Y)),this.canvas.addEventListener("pointermove",t(this,X)),this.canvas.addEventListener("pointerup",t(this,vt)),this.canvas.removeEventListener("pointerdown",t(this,Et)),this.isEditing=!0,t(this,be)||(w(this,be,!0),b(this,x,ys).call(this),this.thickness||(this.thickness=_e._defaultThickness),this.color||(this.color=_e._defaultColor||Q.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=_e._defaultOpacity)),this.currentPath.push([r,A]),w(this,de,!1),b(this,x,Pi).call(this),w(this,f,()=>{b(this,x,Ir).call(this),t(this,f)&&window.requestAnimationFrame(t(this,f))}),window.requestAnimationFrame(t(this,f))},Ii=function(r,A){const[j,G]=this.currentPath.at(-1);if(this.currentPath.length>1&&r===j&&A===G)return;const at=this.currentPath;let Ct=t(this,Ht);if(at.push([r,A]),w(this,de,!0),at.length<=2){Ct.moveTo(...at[0]),Ct.lineTo(r,A);return}at.length===3&&(w(this,Ht,Ct=new Path2D),Ct.moveTo(...at[0])),b(this,x,Dr).call(this,Ct,...at.at(-3),...at.at(-2),r,A)},kr=function(){if(this.currentPath.length===0)return;const r=this.currentPath.at(-1);t(this,Ht).lineTo(...r)},Pr=function(r,A){w(this,f,null),r=Math.min(Math.max(r,0),this.canvas.width),A=Math.min(Math.max(A,0),this.canvas.height),b(this,x,Ii).call(this,r,A),b(this,x,kr).call(this);let j;if(this.currentPath.length!==1)j=b(this,x,Fr).call(this);else{const wt=[r,A];j=[[wt,wt.slice(),wt.slice(),wt]]}const G=t(this,Ht),at=this.currentPath;this.currentPath=[],w(this,Ht,new Path2D);const Ct=()=>{this.allRawPaths.push(at),this.paths.push(j),this.bezierPath2D.push(G),this._uiManager.rebuild(this)},kt=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(b(this,x,Zs).call(this),b(this,x,ti).call(this)),b(this,x,Ps).call(this))};this.addCommands({cmd:Ct,undo:kt,mustExec:!0})},Ir=function(){if(!t(this,de))return;w(this,de,!1);const r=Math.ceil(this.thickness*this.parentScale),A=this.currentPath.slice(-3),j=A.map(Ct=>Ct[0]),G=A.map(Ct=>Ct[1]);Math.min(...j)-r,Math.max(...j)+r,Math.min(...G)-r,Math.max(...G)+r;const{ctx:at}=this;at.save(),at.clearRect(0,0,this.canvas.width,this.canvas.height);for(const Ct of this.bezierPath2D)at.stroke(Ct);at.stroke(t(this,Ht)),at.restore()},Dr=function(r,A,j,G,at,Ct,kt){const wt=(A+G)/2,qt=(j+at)/2,Vt=(G+Ct)/2,pe=(at+kt)/2;r.bezierCurveTo(wt+2*(G-wt)/3,qt+2*(at-qt)/3,Vt+2*(G-Vt)/3,pe+2*(at-pe)/3,Vt,pe)},Fr=function(){const r=this.currentPath;if(r.length<=2)return[[r[0],r[0],r.at(-1),r.at(-1)]];const A=[];let j,[G,at]=r[0];for(j=1;j{w(this,Lt,null),this.canvas.removeEventListener("contextmenu",V.noContextMenu)},10)),b(this,x,Pr).call(this,r.offsetX,r.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Zs=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},ti=function(){w(this,we,new ResizeObserver(r=>{const A=r[0].contentRect;A.width&&A.height&&this.setDimensions(A.width,A.height)})),t(this,we).observe(this.div)},ys=function(){if(!t(this,be))return;const[r,A]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*r),this.canvas.height=Math.ceil(this.height*A),b(this,x,ei).call(this)},Fi=function(r,A){const j=b(this,x,si).call(this),G=(r-j)/t(this,T),at=(A-j)/t(this,ut);this.scaleFactor=Math.min(G,at)},ei=function(){const r=b(this,x,si).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+r,this.translationY*this.scaleFactor+r)},De=new WeakSet,Nr=function(r){const A=new Path2D;for(let j=0,G=r.length;j`image/${A}`))}static get supportedTypesStr(){return(0,d.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(r){return this.supportedTypes.includes(r)}static paste(r,A){A.pasteEditor(d.AnnotationEditorType.STAMP,{bitmapFile:r.getAsFile()})}remove(){var r,A;t(this,Pe)&&(w(this,Ce,null),this._uiManager.imageManager.deleteId(t(this,Pe)),(r=t(this,je))==null||r.remove(),w(this,je,null),(A=t(this,ns))==null||A.disconnect(),w(this,ns,null),t(this,qe)&&(clearTimeout(t(this,qe)),w(this,qe,null))),super.remove()}rebuild(){if(!this.parent){t(this,Pe)&&b(this,ye,ii).call(this);return}super.rebuild(),this.div!==null&&(t(this,Pe)&&t(this,je)===null&&b(this,ye,ii).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(t(this,Qe)||t(this,Ce)||t(this,$e)||t(this,Ze)||t(this,Pe))}get isResizable(){return!0}render(){if(this.div)return this.div;let r,A;if(this.width&&(r=this.x,A=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),t(this,Ce)?b(this,ye,Hi).call(this):b(this,ye,ii).call(this),this.width){const[j,G]=this.parentDimensions;this.setAt(r*j,A*G,this.width*j,this.height*G)}return this.div}getImageForAltText(){return t(this,je)}static deserialize(r,A,j){if(r instanceof J.StampAnnotationElement)return null;const G=super.deserialize(r,A,j),{rect:at,bitmapUrl:Ct,bitmapId:kt,isSvg:wt,accessibilityData:qt}=r;kt&&j.imageManager.isValidId(kt)?w(G,Pe,kt):w(G,$e,Ct),w(G,Ue,wt);const[Vt,pe]=G.pageDimensions;return G.width=(at[2]-at[0])/Vt,G.height=(at[3]-at[1])/pe,qt&&(G.altTextData=qt),G}serialize(r=!1,A=null){if(this.isEmpty())return null;const j={annotationType:d.AnnotationEditorType.STAMP,bitmapId:t(this,Pe),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:t(this,Ue),structTreeParentId:this._structTreeParentId};if(r)return j.bitmapUrl=b(this,ye,ni).call(this,!0),j.accessibilityData=this.altTextData,j;const{decorative:G,altText:at}=this.altTextData;if(!G&&at&&(j.accessibilityData={type:"Figure",alt:at}),A===null)return j;A.stamps||(A.stamps=new Map);const Ct=t(this,Ue)?(j.rect[2]-j.rect[0])*(j.rect[3]-j.rect[1]):null;if(!A.stamps.has(t(this,Pe)))A.stamps.set(t(this,Pe),{area:Ct,serialized:j}),j.bitmap=b(this,ye,ni).call(this,!1);else if(t(this,Ue)){const kt=A.stamps.get(t(this,Pe));Ct>kt.area&&(kt.area=Ct,kt.serialized.bitmap.close(),kt.serialized.bitmap=b(this,ye,ni).call(this,!1))}return j}};Ce=new WeakMap,Pe=new WeakMap,Qe=new WeakMap,$e=new WeakMap,Ze=new WeakMap,ds=new WeakMap,je=new WeakMap,ns=new WeakMap,qe=new WeakMap,Ue=new WeakMap,_s=new WeakMap,ye=new WeakSet,Is=function(r,A=!1){if(!r){this.remove();return}w(this,Ce,r.bitmap),A||(w(this,Pe,r.id),w(this,Ue,r.isSvg)),r.file&&w(this,ds,r.file.name),b(this,ye,Hi).call(this)},Ds=function(){w(this,Qe,null),this._uiManager.enableWaiting(!1),t(this,je)&&this.div.focus()},ii=function(){if(t(this,Pe)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(t(this,Pe)).then(A=>b(this,ye,Is).call(this,A,!0)).finally(()=>b(this,ye,Ds).call(this));return}if(t(this,$e)){const A=t(this,$e);w(this,$e,null),this._uiManager.enableWaiting(!0),w(this,Qe,this._uiManager.imageManager.getFromUrl(A).then(j=>b(this,ye,Is).call(this,j)).finally(()=>b(this,ye,Ds).call(this)));return}if(t(this,Ze)){const A=t(this,Ze);w(this,Ze,null),this._uiManager.enableWaiting(!0),w(this,Qe,this._uiManager.imageManager.getFromFile(A).then(j=>b(this,ye,Is).call(this,j)).finally(()=>b(this,ye,Ds).call(this)));return}const r=document.createElement("input");r.type="file",r.accept=xs.supportedTypesStr,w(this,Qe,new Promise(A=>{r.addEventListener("change",async()=>{if(!r.files||r.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const j=await this._uiManager.imageManager.getFromFile(r.files[0]);b(this,ye,Is).call(this,j)}A()}),r.addEventListener("cancel",()=>{this.remove(),A()})}).finally(()=>b(this,ye,Ds).call(this))),r.click()},Hi=function(){const{div:r}=this;let{width:A,height:j}=t(this,Ce);const[G,at]=this.pageDimensions,Ct=.75;if(this.width)A=this.width*G,j=this.height*at;else if(A>Ct*G||j>Ct*at){const Vt=Math.min(Ct*G/A,Ct*at/j);A*=Vt,j*=Vt}const[kt,wt]=this.parentDimensions;this.setDims(A*kt/G,j*wt/at),this._uiManager.enableWaiting(!1);const qt=w(this,je,document.createElement("canvas"));r.append(qt),r.hidden=!1,b(this,ye,Bi).call(this,A,j),b(this,ye,zr).call(this),t(this,_s)||(this.parent.addUndoableEditor(this),w(this,_s,!0)),this._reportTelemetry({action:"inserted_image"}),t(this,ds)&&qt.setAttribute("aria-label",t(this,ds))},Br=function(r,A){var Ct;const[j,G]=this.parentDimensions;this.width=r/j,this.height=A/G,this.setDims(r,A),(Ct=this._initialOptions)!=null&&Ct.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,t(this,qe)!==null&&clearTimeout(t(this,qe)),w(this,qe,setTimeout(()=>{w(this,qe,null),b(this,ye,Bi).call(this,r,A)},200))},Ur=function(r,A){const{width:j,height:G}=t(this,Ce);let at=j,Ct=G,kt=t(this,Ce);for(;at>2*r||Ct>2*A;){const wt=at,qt=Ct;at>2*r&&(at=at>=16384?Math.floor(at/2)-1:Math.ceil(at/2)),Ct>2*A&&(Ct=Ct>=16384?Math.floor(Ct/2)-1:Math.ceil(Ct/2));const Vt=new OffscreenCanvas(at,Ct);Vt.getContext("2d").drawImage(kt,0,0,wt,qt,0,0,at,Ct),kt=Vt.transferToImageBitmap()}return kt},Bi=function(r,A){r=Math.ceil(r),A=Math.ceil(A);const j=t(this,je);if(!j||j.width===r&&j.height===A)return;j.width=r,j.height=A;const G=t(this,Ue)?t(this,Ce):b(this,ye,Ur).call(this,r,A);if(this._uiManager.hasMLManager&&!this.hasAltText()){const Ct=new OffscreenCanvas(r,A);Ct.getContext("2d").drawImage(G,0,0,G.width,G.height,0,0,r,A),Ct.convertToBlob().then(kt=>{const wt=new FileReader;wt.onload=()=>{const qt=wt.result;this._uiManager.mlGuess({service:"image-to-text",request:{imageData:qt}}).then(Vt=>{const pe=(Vt==null?void 0:Vt.output)||"";this.parent&&pe&&!this.hasAltText()&&(this.altTextData={altText:pe,decorative:!1})})},wt.readAsDataURL(kt)})}const at=j.getContext("2d");at.filter=this._uiManager.hcmFilter,at.drawImage(G,0,0,G.width,G.height,0,0,r,A)},ni=function(r){if(r){if(t(this,Ue)){const j=this._uiManager.imageManager.getSvgUrl(t(this,Pe));if(j)return j}const A=document.createElement("canvas");return{width:A.width,height:A.height}=t(this,Ce),A.getContext("2d").drawImage(t(this,Ce),0,0),A.toDataURL()}if(t(this,Ue)){const[A,j]=this.pageDimensions,G=Math.round(this.width*A*V.PixelsPerInch.PDF_TO_CSS_UNITS),at=Math.round(this.height*j*V.PixelsPerInch.PDF_TO_CSS_UNITS),Ct=new OffscreenCanvas(G,at);return Ct.getContext("2d").drawImage(t(this,Ce),0,0,t(this,Ce).width,t(this,Ce).height,0,0,G,at),Ct.transferToImageBitmap()}return structuredClone(t(this,Ce))},zr=function(){w(this,ns,new ResizeObserver(r=>{const A=r[0].contentRect;A.width&&A.height&&b(this,ye,Br).call(this,A.width,A.height)})),t(this,ns).observe(this.div)},he(xs,"_type","stamp"),he(xs,"_editorType",d.AnnotationEditorType.STAMP);let D=xs;const ze=class ze{constructor({uiManager:rt,pageIndex:r,div:A,accessibilityManager:j,annotationLayer:G,drawLayer:at,textLayer:Ct,viewport:kt,l10n:wt}){_(this,Fe);_(this,rs);_(this,us,!1);_(this,Ge,null);_(this,as,null);_(this,Xe,null);_(this,Ke,null);_(this,Ye,null);_(this,He,new Map);_(this,ts,!1);_(this,ps,!1);_(this,gs,!1);_(this,Ne,null);_(this,ne);const qt=[...t(ze,es).values()];if(!ze._initialized){ze._initialized=!0;for(const Vt of qt)Vt.initialize(wt,rt)}rt.registerEditorTypes(qt),w(this,ne,rt),this.pageIndex=r,this.div=A,w(this,rs,j),w(this,Ge,G),this.viewport=kt,w(this,Ne,Ct),this.drawLayer=at,t(this,ne).addLayer(this)}get isEmpty(){return t(this,He).size===0}get isInvisible(){return this.isEmpty&&t(this,ne).getMode()===d.AnnotationEditorType.NONE}updateToolbar(rt){t(this,ne).updateToolbar(rt)}updateMode(rt=t(this,ne).getMode()){switch(b(this,Fe,ri).call(this),rt){case d.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case d.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case d.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:r}=this.div;for(const A of t(ze,es).values())r.toggle(`${A._type}Editing`,rt===A._editorType);this.div.hidden=!1}hasTextLayer(rt){var r;return rt===((r=t(this,Ne))==null?void 0:r.div)}addInkEditorIfNeeded(rt){if(t(this,ne).getMode()===d.AnnotationEditorType.INK){if(!rt){for(const r of t(this,He).values())if(r.isEmpty()){r.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(rt){t(this,ne).setEditingState(rt)}addCommands(rt){t(this,ne).addCommands(rt)}togglePointerEvents(rt=!1){this.div.classList.toggle("disabled",!rt)}toggleAnnotationLayerPointerEvents(rt=!1){var r;(r=t(this,Ge))==null||r.div.classList.toggle("disabled",!rt)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const rt=new Set;for(const A of t(this,He).values())A.enableEditing(),A.show(!0),A.annotationElementId&&(t(this,ne).removeChangedExistingAnnotation(A),rt.add(A.annotationElementId));if(!t(this,Ge))return;const r=t(this,Ge).getEditableAnnotations();for(const A of r){if(A.hide(),t(this,ne).isDeletedAnnotationElement(A.data.id)||rt.has(A.data.id))continue;const j=this.deserialize(A);j&&(this.addOrRebuild(j),j.enableEditing())}}disable(){var j;w(this,gs,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const rt=new Map,r=new Map;for(const G of t(this,He).values())if(G.disableEditing(),!!G.annotationElementId){if(G.serialize()!==null){rt.set(G.annotationElementId,G);continue}else r.set(G.annotationElementId,G);(j=this.getEditableAnnotation(G.annotationElementId))==null||j.show(),G.remove()}if(t(this,Ge)){const G=t(this,Ge).getEditableAnnotations();for(const at of G){const{id:Ct}=at.data;if(t(this,ne).isDeletedAnnotationElement(Ct))continue;let kt=r.get(Ct);if(kt){kt.resetAnnotationElement(at),kt.show(!1),at.show();continue}kt=rt.get(Ct),kt&&(t(this,ne).addChangedExistingAnnotation(kt),kt.renderAnnotationElement(at),kt.show(!1)),at.show()}}b(this,Fe,ri).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:A}=this.div;for(const G of t(ze,es).values())A.remove(`${G._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),w(this,gs,!1)}getEditableAnnotation(rt){var r;return((r=t(this,Ge))==null?void 0:r.getEditableAnnotation(rt))||null}setActiveEditor(rt){t(this,ne).getActive()!==rt&&t(this,ne).setActiveEditor(rt)}enableTextSelection(){var rt;this.div.tabIndex=-1,(rt=t(this,Ne))!=null&&rt.div&&!t(this,Ke)&&(w(this,Ke,b(this,Fe,Vr).bind(this)),t(this,Ne).div.addEventListener("pointerdown",t(this,Ke)),t(this,Ne).div.classList.add("highlighting"))}disableTextSelection(){var rt;this.div.tabIndex=0,(rt=t(this,Ne))!=null&&rt.div&&t(this,Ke)&&(t(this,Ne).div.removeEventListener("pointerdown",t(this,Ke)),w(this,Ke,null),t(this,Ne).div.classList.remove("highlighting"))}enableClick(){t(this,Xe)||(w(this,Xe,this.pointerdown.bind(this)),w(this,as,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",t(this,Xe)),this.div.addEventListener("pointerup",t(this,as)))}disableClick(){t(this,Xe)&&(this.div.removeEventListener("pointerdown",t(this,Xe)),this.div.removeEventListener("pointerup",t(this,as)),w(this,Xe,null),w(this,as,null))}attach(rt){t(this,He).set(rt.id,rt);const{annotationElementId:r}=rt;r&&t(this,ne).isDeletedAnnotationElement(r)&&t(this,ne).removeDeletedAnnotationElement(rt)}detach(rt){var r;t(this,He).delete(rt.id),(r=t(this,rs))==null||r.removePointerInTextLayer(rt.contentDiv),!t(this,gs)&&rt.annotationElementId&&t(this,ne).addDeletedAnnotationElement(rt)}remove(rt){this.detach(rt),t(this,ne).removeEditor(rt),rt.div.remove(),rt.isAttachedToDOM=!1,t(this,ps)||this.addInkEditorIfNeeded(!1)}changeParent(rt){var r;rt.parent!==this&&(rt.parent&&rt.annotationElementId&&(t(this,ne).addDeletedAnnotationElement(rt.annotationElementId),Q.AnnotationEditor.deleteAnnotationElement(rt),rt.annotationElementId=null),this.attach(rt),(r=rt.parent)==null||r.detach(rt),rt.setParent(this),rt.div&&rt.isAttachedToDOM&&(rt.div.remove(),this.div.append(rt.div)))}add(rt){if(!(rt.parent===this&&rt.isAttachedToDOM)){if(this.changeParent(rt),t(this,ne).addEditor(rt),this.attach(rt),!rt.isAttachedToDOM){const r=rt.render();this.div.append(r),rt.isAttachedToDOM=!0}rt.fixAndSetPosition(),rt.onceAdded(),t(this,ne).addToAnnotationStorage(rt),rt._reportTelemetry(rt.telemetryInitialData)}}moveEditorInDOM(rt){var A;if(!rt.isAttachedToDOM)return;const{activeElement:r}=document;rt.div.contains(r)&&!t(this,Ye)&&(rt._focusEventsAllowed=!1,w(this,Ye,setTimeout(()=>{w(this,Ye,null),rt.div.contains(document.activeElement)?rt._focusEventsAllowed=!0:(rt.div.addEventListener("focusin",()=>{rt._focusEventsAllowed=!0},{once:!0}),r.focus())},0))),rt._structTreeParentId=(A=t(this,rs))==null?void 0:A.moveElementInDOM(this.div,rt.div,rt.contentDiv,!0)}addOrRebuild(rt){rt.needsToBeRebuilt()?(rt.parent||(rt.parent=this),rt.rebuild(),rt.show()):this.add(rt)}addUndoableEditor(rt){const r=()=>rt._uiManager.rebuild(rt),A=()=>{rt.remove()};this.addCommands({cmd:r,undo:A,mustExec:!1})}getNextId(){return t(this,ne).getId()}canCreateNewEmptyEditor(){var rt;return(rt=t(this,Fe,Ui))==null?void 0:rt.canCreateNewEmptyEditor()}pasteEditor(rt,r){t(this,ne).updateToolbar(rt),t(this,ne).updateMode(rt);const{offsetX:A,offsetY:j}=b(this,Fe,Vi).call(this),G=this.getNextId(),at=b(this,Fe,zi).call(this,{parent:this,id:G,x:A,y:j,uiManager:t(this,ne),isCentered:!0,...r});at&&this.add(at)}deserialize(rt){var r;return((r=t(ze,es).get(rt.annotationType??rt.annotationEditorType))==null?void 0:r.deserialize(rt,this,t(this,ne)))||null}createAndAddNewEditor(rt,r,A={}){const j=this.getNextId(),G=b(this,Fe,zi).call(this,{parent:this,id:j,x:rt.offsetX,y:rt.offsetY,uiManager:t(this,ne),isCentered:r,...A});return G&&this.add(G),G}addNewEditor(){this.createAndAddNewEditor(b(this,Fe,Vi).call(this),!0)}setSelected(rt){t(this,ne).setSelected(rt)}toggleSelected(rt){t(this,ne).toggleSelected(rt)}isSelected(rt){return t(this,ne).isSelected(rt)}unselect(rt){t(this,ne).unselect(rt)}pointerup(rt){const{isMac:r}=d.FeatureTest.platform;if(!(rt.button!==0||rt.ctrlKey&&r)&&rt.target===this.div&&t(this,ts)){if(w(this,ts,!1),!t(this,us)){w(this,us,!0);return}if(t(this,ne).getMode()===d.AnnotationEditorType.STAMP){t(this,ne).unselectAll();return}this.createAndAddNewEditor(rt,!1)}}pointerdown(rt){if(t(this,ne).getMode()===d.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),t(this,ts)){w(this,ts,!1);return}const{isMac:r}=d.FeatureTest.platform;if(rt.button!==0||rt.ctrlKey&&r||rt.target!==this.div)return;w(this,ts,!0);const A=t(this,ne).getActive();w(this,us,!A||A.isEmpty())}findNewParent(rt,r,A){const j=t(this,ne).findParent(r,A);return j===null||j===this?!1:(j.changeParent(rt),!0)}destroy(){var rt,r;((rt=t(this,ne).getActive())==null?void 0:rt.parent)===this&&(t(this,ne).commitOrRemove(),t(this,ne).setActiveEditor(null)),t(this,Ye)&&(clearTimeout(t(this,Ye)),w(this,Ye,null));for(const A of t(this,He).values())(r=t(this,rs))==null||r.removePointerInTextLayer(A.contentDiv),A.setParent(null),A.isAttachedToDOM=!1,A.div.remove();this.div=null,t(this,He).clear(),t(this,ne).removeLayer(this)}render({viewport:rt}){this.viewport=rt,(0,V.setLayerDimensions)(this.div,rt);for(const r of t(this,ne).getEditors(this.pageIndex))this.add(r),r.rebuild();this.updateMode()}update({viewport:rt}){t(this,ne).commitOrRemove(),b(this,Fe,ri).call(this);const r=this.viewport.rotation,A=rt.rotation;if(this.viewport=rt,(0,V.setLayerDimensions)(this.div,{rotation:A}),r!==A)for(const j of t(this,He).values())j.rotate(A);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:rt,pageHeight:r}=this.viewport.rawDims;return[rt,r]}get scale(){return t(this,ne).viewParameters.realScale}};rs=new WeakMap,us=new WeakMap,Ge=new WeakMap,as=new WeakMap,Xe=new WeakMap,Ke=new WeakMap,Ye=new WeakMap,He=new WeakMap,ts=new WeakMap,ps=new WeakMap,gs=new WeakMap,Ne=new WeakMap,ne=new WeakMap,es=new WeakMap,Fe=new WeakSet,Vr=function(rt){if(t(this,ne).unselectAll(),rt.target===t(this,Ne).div){const{isMac:r}=d.FeatureTest.platform;if(rt.button!==0||rt.ctrlKey&&r)return;t(this,ne).showAllEditors("highlight",!0,!0),t(this,Ne).div.classList.add("free"),E.startHighlighting(this,t(this,ne).direction==="ltr",rt),t(this,Ne).div.addEventListener("pointerup",()=>{t(this,Ne).div.classList.remove("free")},{once:!0}),rt.preventDefault()}},Ui=function(){return t(ze,es).get(t(this,ne).getMode())},zi=function(rt){const r=t(this,Fe,Ui);return r?new r.prototype.constructor(rt):null},Vi=function(){const{x:rt,y:r,width:A,height:j}=this.div.getBoundingClientRect(),G=Math.max(0,rt),at=Math.max(0,r),Ct=Math.min(window.innerWidth,rt+A),kt=Math.min(window.innerHeight,r+j),wt=(G+Ct)/2-rt,qt=(at+kt)/2-r,[Vt,pe]=this.viewport.rotation%180===0?[wt,qt]:[qt,wt];return{offsetX:Vt,offsetY:pe}},ri=function(){w(this,ps,!0);for(const rt of t(this,He).values())rt.isEmpty()&&rt.remove();w(this,ps,!1)},he(ze,"_initialized",!1),_(ze,es,new Map([z,y,D,E].map(rt=>[rt._editorType,rt])));let L=ze},259:(ie,$t,dt)=>{var At,z,F,I,V,E,y,D,L,Z,B,K,k,ji,qi,jr,cs,qr,ss;dt.d($t,{ColorPicker:()=>J});var d=dt(292),Q=dt(830),H=dt(419);const Tt=class Tt{constructor({editor:nt=null,uiManager:Mt=null}){_(this,k);_(this,At,b(this,k,jr).bind(this));_(this,z,b(this,k,qr).bind(this));_(this,F,null);_(this,I,null);_(this,V);_(this,E,null);_(this,y,!1);_(this,D,!1);_(this,L,null);_(this,Z);_(this,B,null);_(this,K);var It;nt?(w(this,D,!1),w(this,K,d.AnnotationEditorParamsType.HIGHLIGHT_COLOR),w(this,L,nt)):(w(this,D,!0),w(this,K,d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR)),w(this,B,(nt==null?void 0:nt._uiManager)||Mt),w(this,Z,t(this,B)._eventBus),w(this,V,(nt==null?void 0:nt.color)||((It=t(this,B))==null?void 0:It.highlightColors.values().next().value)||"#FFFF98")}static get _keyboardManager(){return(0,d.shadow)(this,"_keyboardManager",new Q.KeyboardManager([[["Escape","mac+Escape"],Tt.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Tt.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Tt.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Tt.prototype._moveToPrevious],[["Home","mac+Home"],Tt.prototype._moveToBeginning],[["End","mac+End"],Tt.prototype._moveToEnd]]))}renderButton(){const nt=w(this,F,document.createElement("button"));nt.className="colorPicker",nt.tabIndex="0",nt.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),nt.setAttribute("aria-haspopup",!0),nt.addEventListener("click",b(this,k,cs).bind(this)),nt.addEventListener("keydown",t(this,At));const Mt=w(this,I,document.createElement("span"));return Mt.className="swatch",Mt.setAttribute("aria-hidden",!0),Mt.style.backgroundColor=t(this,V),nt.append(Mt),nt}renderMainDropdown(){const nt=w(this,E,b(this,k,ji).call(this));return nt.setAttribute("aria-orientation","horizontal"),nt.setAttribute("aria-labelledby","highlightColorPickerLabel"),nt}_colorSelectFromKeyboard(nt){if(nt.target===t(this,F)){b(this,k,cs).call(this,nt);return}const Mt=nt.target.getAttribute("data-color");Mt&&b(this,k,qi).call(this,Mt,nt)}_moveToNext(nt){var Mt,It;if(!t(this,k,ss)){b(this,k,cs).call(this,nt);return}if(nt.target===t(this,F)){(Mt=t(this,E).firstChild)==null||Mt.focus();return}(It=nt.target.nextSibling)==null||It.focus()}_moveToPrevious(nt){var Mt,It;if(nt.target===((Mt=t(this,E))==null?void 0:Mt.firstChild)||nt.target===t(this,F)){t(this,k,ss)&&this._hideDropdownFromKeyboard();return}t(this,k,ss)||b(this,k,cs).call(this,nt),(It=nt.target.previousSibling)==null||It.focus()}_moveToBeginning(nt){var Mt;if(!t(this,k,ss)){b(this,k,cs).call(this,nt);return}(Mt=t(this,E).firstChild)==null||Mt.focus()}_moveToEnd(nt){var Mt;if(!t(this,k,ss)){b(this,k,cs).call(this,nt);return}(Mt=t(this,E).lastChild)==null||Mt.focus()}hideDropdown(){var nt;(nt=t(this,E))==null||nt.classList.add("hidden"),window.removeEventListener("pointerdown",t(this,z))}_hideDropdownFromKeyboard(){var nt;if(!t(this,D)){if(!t(this,k,ss)){(nt=t(this,L))==null||nt.unselect();return}this.hideDropdown(),t(this,F).focus({preventScroll:!0,focusVisible:t(this,y)})}}updateColor(nt){if(t(this,I)&&(t(this,I).style.backgroundColor=nt),!t(this,E))return;const Mt=t(this,B).highlightColors.values();for(const It of t(this,E).children)It.setAttribute("aria-selected",Mt.next().value===nt)}destroy(){var nt,Mt;(nt=t(this,F))==null||nt.remove(),w(this,F,null),w(this,I,null),(Mt=t(this,E))==null||Mt.remove(),w(this,E,null)}};At=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakMap,V=new WeakMap,E=new WeakMap,y=new WeakMap,D=new WeakMap,L=new WeakMap,Z=new WeakMap,B=new WeakMap,K=new WeakMap,k=new WeakSet,ji=function(){const nt=document.createElement("div");nt.addEventListener("contextmenu",H.noContextMenu),nt.className="dropdown",nt.role="listbox",nt.setAttribute("aria-multiselectable",!1),nt.setAttribute("aria-orientation","vertical"),nt.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[Mt,It]of t(this,B).highlightColors){const Pt=document.createElement("button");Pt.tabIndex="0",Pt.role="option",Pt.setAttribute("data-color",It),Pt.title=Mt,Pt.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${Mt}`);const Xt=document.createElement("span");Pt.append(Xt),Xt.className="swatch",Xt.style.backgroundColor=It,Pt.setAttribute("aria-selected",It===t(this,V)),Pt.addEventListener("click",b(this,k,qi).bind(this,It)),nt.append(Pt)}return nt.addEventListener("keydown",t(this,At)),nt},qi=function(nt,Mt){Mt.stopPropagation(),t(this,Z).dispatch("switchannotationeditorparams",{source:this,type:t(this,K),value:nt})},jr=function(nt){Tt._keyboardManager.exec(this,nt)},cs=function(nt){if(t(this,k,ss)){this.hideDropdown();return}if(w(this,y,nt.detail===0),window.addEventListener("pointerdown",t(this,z)),t(this,E)){t(this,E).classList.remove("hidden");return}const Mt=w(this,E,b(this,k,ji).call(this));t(this,F).append(Mt)},qr=function(nt){var Mt;(Mt=t(this,E))!=null&&Mt.contains(nt.target)||this.hideDropdown()},ss=function(){return t(this,E)&&!t(this,E).classList.contains("hidden")};let J=Tt},310:(ie,$t,dt)=>{var I,V,E,y,D,L,Z,B,Gi,O,C,P,ht,st,bt,Tt,ot,nt,Mt,It,Pt,Xt,ae,Jt,re,oe,Rt,Qt,ue,Ae,Bt,Wi,ee,$i,Xi,Gr,Wr,Ki,Yi,Ji,$r,Xr,Kr,Yr,Qi,Fs;dt.d($t,{AnnotationEditor:()=>z});var d=dt(830),Q=dt(292),H=dt(419);const k=class k{constructor(e){_(this,B);_(this,I,"");_(this,V,!1);_(this,E,null);_(this,y,null);_(this,D,null);_(this,L,!1);_(this,Z,null);w(this,Z,e)}static initialize(e){k._l10nPromise||(k._l10nPromise=e)}async render(){const e=w(this,E,document.createElement("button"));e.className="altText";const i=await k._l10nPromise.get("pdfjs-editor-alt-text-button-label");e.textContent=i,e.setAttribute("aria-label",i),e.tabIndex="0",e.addEventListener("contextmenu",H.noContextMenu),e.addEventListener("pointerdown",m=>m.stopPropagation());const o=m=>{m.preventDefault(),t(this,Z)._uiManager.editAltText(t(this,Z))};return e.addEventListener("click",o,{capture:!0}),e.addEventListener("keydown",m=>{m.target===e&&m.key==="Enter"&&(w(this,L,!0),o(m))}),await b(this,B,Gi).call(this),e}finish(){t(this,E)&&(t(this,E).focus({focusVisible:t(this,L)}),w(this,L,!1))}isEmpty(){return!t(this,I)&&!t(this,V)}get data(){return{altText:t(this,I),decorative:t(this,V)}}set data({altText:e,decorative:i}){t(this,I)===e&&t(this,V)===i||(w(this,I,e),w(this,V,i),b(this,B,Gi).call(this))}toggle(e=!1){t(this,E)&&(!e&&t(this,D)&&(clearTimeout(t(this,D)),w(this,D,null)),t(this,E).disabled=!e)}destroy(){var e;(e=t(this,E))==null||e.remove(),w(this,E,null),w(this,y,null)}};I=new WeakMap,V=new WeakMap,E=new WeakMap,y=new WeakMap,D=new WeakMap,L=new WeakMap,Z=new WeakMap,B=new WeakSet,Gi=async function(){var o,m;const e=t(this,E);if(!e)return;if(!t(this,I)&&!t(this,V)){e.classList.remove("done"),(o=t(this,y))==null||o.remove();return}e.classList.add("done"),k._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(M=>{e.setAttribute("aria-label",M)});let i=t(this,y);if(!i){w(this,y,i=document.createElement("span")),i.className="tooltip",i.setAttribute("role","tooltip");const M=i.id=`alt-text-tooltip-${t(this,Z).id}`;e.setAttribute("aria-describedby",M);const $=100;e.addEventListener("mouseenter",()=>{w(this,D,setTimeout(()=>{w(this,D,null),t(this,y).classList.add("show"),t(this,Z)._reportTelemetry({action:"alt_text_tooltip"})},$))}),e.addEventListener("mouseleave",()=>{var W;t(this,D)&&(clearTimeout(t(this,D)),w(this,D,null)),(W=t(this,y))==null||W.classList.remove("show")})}i.innerText=t(this,V)?await k._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):t(this,I),i.parentNode||e.append(i),(m=t(this,Z).getImageForAltText())==null||m.setAttribute("aria-describedby",i.id)},he(k,"_l10nPromise",null);let J=k;var At=dt(362);const p=class p{constructor(e){_(this,Bt);_(this,O,null);_(this,C,null);_(this,P,!1);_(this,ht,!1);_(this,st,null);_(this,bt,null);_(this,Tt,this.focusin.bind(this));_(this,ot,this.focusout.bind(this));_(this,nt,null);_(this,Mt,"");_(this,It,!1);_(this,Pt,null);_(this,Xt,!1);_(this,ae,!1);_(this,Jt,!1);_(this,re,null);_(this,oe,0);_(this,Rt,0);_(this,Qt,null);he(this,"_initialOptions",Object.create(null));he(this,"_isVisible",!0);he(this,"_uiManager",null);he(this,"_focusEventsAllowed",!0);he(this,"_l10nPromise",null);_(this,ue,!1);_(this,Ae,p._zIndex++);this.constructor===p&&(0,Q.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:i,rawDims:{pageWidth:o,pageHeight:m,pageX:M,pageY:$}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[o,m],this.pageTranslation=[M,$];const[W,tt]=this.parentDimensions;this.x=e.x/W,this.y=e.y/tt,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=p.prototype._resizeWithKeyboard,i=d.AnnotationEditorUIManager.TRANSLATE_SMALL,o=d.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,Q.shadow)(this,"_resizerKeyboardManager",new d.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-i,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-o,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[i,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[o,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-i]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-o]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,i]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,o]}],[["Escape","mac+Escape"],p.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,Q.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new F({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});i.annotationElementId=e.annotationElementId,i.deleted=!0,i._uiManager.addToAnnotationStorage(i)}static initialize(e,i,o){if(p._l10nPromise||(p._l10nPromise=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(M=>[M,e.get(M.replaceAll(/([A-Z])/g,$=>`-${$.toLowerCase()}`))]))),o==null?void 0:o.strings)for(const M of o.strings)p._l10nPromise.set(M,e.get(M));if(p._borderLineWidth!==-1)return;const m=getComputedStyle(document.documentElement);p._borderLineWidth=parseFloat(m.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){(0,Q.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return t(this,ue)}set _isDraggable(e){var i;w(this,ue,e),(i=this.div)==null||i.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,i]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*i/(e*2),this.y+=this.width*e/(i*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*i/(e*2),this.y-=this.width*e/(i*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=t(this,Ae)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):b(this,Bt,Fs).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(t(this,It)?w(this,It,!1):this.parent.setSelected(this))}focusout(e){var i,o;!this._focusEventsAllowed||!this.isAttachedToDOM||(i=e.relatedTarget)!=null&&i.closest(`#${this.id}`)||(e.preventDefault(),(o=this.parent)!=null&&o.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,o,m){const[M,$]=this.parentDimensions;[o,m]=this.screenToPageTranslation(o,m),this.x=(e+o)/M,this.y=(i+m)/$,this.fixAndSetPosition()}translate(e,i){b(this,Bt,Wi).call(this,this.parentDimensions,e,i)}translateInPage(e,i){t(this,Pt)||w(this,Pt,[this.x,this.y]),b(this,Bt,Wi).call(this,this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}drag(e,i){t(this,Pt)||w(this,Pt,[this.x,this.y]);const[o,m]=this.parentDimensions;if(this.x+=e/o,this.y+=i/m,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:gt,y:it}=this.div.getBoundingClientRect();this.parent.findNewParent(this,gt,it)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:M,y:$}=this;const[W,tt]=this.getBaseTranslation();M+=W,$+=tt,this.div.style.left=`${(100*M).toFixed(2)}%`,this.div.style.top=`${(100*$).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!t(this,Pt)&&(t(this,Pt)[0]!==this.x||t(this,Pt)[1]!==this.y)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:o}=p,m=o/e,M=o/i;switch(this.rotation){case 90:return[-m,M];case 180:return[m,M];case 270:return[m,-M];default:return[-m,-M]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[i,o]=this.pageDimensions;let{x:m,y:M,width:$,height:W}=this;if($*=i,W*=o,m*=i,M*=o,this._mustFixPosition)switch(e){case 0:m=Math.max(0,Math.min(i-$,m)),M=Math.max(0,Math.min(o-W,M));break;case 90:m=Math.max(0,Math.min(i-W,m)),M=Math.min(o,Math.max($,M));break;case 180:m=Math.min(i,Math.max($,m)),M=Math.min(o,Math.max(W,M));break;case 270:m=Math.min(i,Math.max(W,m)),M=Math.max(0,Math.min(o-$,M));break}this.x=m/=i,this.y=M/=o;const[tt,gt]=this.getBaseTranslation();m+=tt,M+=gt;const{style:it}=this.div;it.left=`${(100*m).toFixed(2)}%`,it.top=`${(100*M).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,i){var o;return b(o=p,ee,$i).call(o,e,i,this.parentRotation)}pageTranslationToScreen(e,i){var o;return b(o=p,ee,$i).call(o,e,i,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[i,o]}=this,m=i*e,M=o*e;return Q.FeatureTest.isCSSRoundSupported?[Math.round(m),Math.round(M)]:[m,M]}setDims(e,i){const[o,m]=this.parentDimensions;this.div.style.width=`${(100*e/o).toFixed(2)}%`,t(this,ht)||(this.div.style.height=`${(100*i/m).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:i,width:o}=e,m=o.endsWith("%"),M=!t(this,ht)&&i.endsWith("%");if(m&&M)return;const[$,W]=this.parentDimensions;m||(e.width=`${(100*parseFloat(o)/$).toFixed(2)}%`),!t(this,ht)&&!M&&(e.height=`${(100*parseFloat(i)/W).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=t(this,C))==null||e.finish()}async addEditToolbar(){return t(this,nt)||t(this,ae)?t(this,nt):(w(this,nt,new At.EditorToolbar(this)),this.div.append(t(this,nt).render()),t(this,C)&&t(this,nt).addAltTextButton(await t(this,C).render()),t(this,nt))}removeEditToolbar(){var e;t(this,nt)&&(t(this,nt).remove(),w(this,nt,null),(e=t(this,C))==null||e.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){t(this,C)||(J.initialize(p._l10nPromise),w(this,C,new J(this)),await this.addEditToolbar())}get altTextData(){var e;return(e=t(this,C))==null?void 0:e.data}set altTextData(e){t(this,C)&&(t(this,C).data=e)}hasAltText(){var e;return!((e=t(this,C))!=null&&e.isEmpty())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=t(this,P)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",t(this,Tt)),this.div.addEventListener("focusout",t(this,ot));const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[o,m]=this.getInitialTranslation();return this.translate(o,m),(0,d.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:i}=Q.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(w(this,It,!0),this._isDraggable){b(this,Bt,$r).call(this,e);return}b(this,Bt,Ji).call(this,e)}moveInDOM(){t(this,re)&&clearTimeout(t(this,re)),w(this,re,setTimeout(()=>{var e;w(this,re,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,i,o){e.changeParent(this),this.x=i,this.y=o,this.fixAndSetPosition()}getRect(e,i,o=this.rotation){const m=this.parentScale,[M,$]=this.pageDimensions,[W,tt]=this.pageTranslation,gt=e/m,it=i/m,_t=this.x*M,Ot=this.y*$,jt=this.width*M,Gt=this.height*$;switch(o){case 0:return[_t+gt+W,$-Ot-it-Gt+tt,_t+gt+jt+W,$-Ot-it+tt];case 90:return[_t+it+W,$-Ot+gt+tt,_t+it+Gt+W,$-Ot+gt+jt+tt];case 180:return[_t-gt-jt+W,$-Ot+it+tt,_t-gt+W,$-Ot+it+Gt+tt];case 270:return[_t-it-Gt+W,$-Ot-gt-jt+tt,_t-it+W,$-Ot-gt+tt];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[o,m,M,$]=e,W=M-o,tt=$-m;switch(this.rotation){case 0:return[o,i-$,W,tt];case 90:return[o,i-m,tt,W];case 180:return[M,i-m,W,tt];case 270:return[M,i-$,tt,W];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){w(this,ae,!0)}disableEditMode(){w(this,ae,!1)}isInEditMode(){return t(this,ae)}shouldGetKeyboardEvents(){return t(this,Jt)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var e,i;(e=this.div)==null||e.addEventListener("focusin",t(this,Tt)),(i=this.div)==null||i.addEventListener("focusout",t(this,ot))}rotate(e){}serialize(e=!1,i=null){(0,Q.unreachable)("An editor must be serializable")}static deserialize(e,i,o){const m=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:o});m.rotation=e.rotation;const[M,$]=m.pageDimensions,[W,tt,gt,it]=m.getRectInCurrentCoords(e.rect,$);return m.x=W/M,m.y=tt/$,m.width=gt/M,m.height=it/$,m}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",t(this,Tt)),this.div.removeEventListener("focusout",t(this,ot)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),t(this,re)&&(clearTimeout(t(this,re)),w(this,re,null)),b(this,Bt,Fs).call(this),this.removeEditToolbar(),t(this,Qt)){for(const e of t(this,Qt).values())clearTimeout(e);w(this,Qt,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Bt,Gr).call(this),t(this,st).classList.remove("hidden"),(0,d.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),w(this,bt,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const i=t(this,st).children;if(!t(this,O)){w(this,O,Array.from(i));const $=b(this,Bt,Xr).bind(this),W=b(this,Bt,Kr).bind(this);for(const tt of t(this,O)){const gt=tt.getAttribute("data-resizer-name");tt.setAttribute("role","spinbutton"),tt.addEventListener("keydown",$),tt.addEventListener("blur",W),tt.addEventListener("focus",b(this,Bt,Yr).bind(this,gt)),p._l10nPromise.get(`pdfjs-editor-resizer-label-${gt}`).then(it=>tt.setAttribute("aria-label",it))}}const o=t(this,O)[0];let m=0;for(const $ of i){if($===o)break;m++}const M=(360-this.rotation+this.parentRotation)%360/90*(t(this,O).length/4);if(M!==m){if(Mm)for(let W=0;WW.setAttribute("aria-label",gt))}}b(this,Bt,Qi).call(this,0),w(this,Jt,!0),t(this,st).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,i){t(this,Jt)&&b(this,Bt,Yi).call(this,t(this,Mt),{movementX:e,movementY:i})}_stopResizingWithKeyboard(){b(this,Bt,Fs).call(this),this.div.focus()}select(){var e,i;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!t(this,nt)){this.addEditToolbar().then(()=>{var o,m;(o=this.div)!=null&&o.classList.contains("selectedEditor")&&((m=t(this,nt))==null||m.show())});return}(i=t(this,nt))==null||i.show()}unselect(){var e,i,o,m;(e=t(this,st))==null||e.classList.add("hidden"),(i=this.div)==null||i.classList.remove("selectedEditor"),(o=this.div)!=null&&o.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(m=t(this,nt))==null||m.hide()}updateParams(e,i){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return t(this,Xt)}set isEditing(e){w(this,Xt,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,i){w(this,ht,!0);const o=e/i,{style:m}=this.div;m.aspectRatio=o,m.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,i=!1){if(i){t(this,Qt)||w(this,Qt,new Map);const{action:o}=e;let m=t(this,Qt).get(o);m&&clearTimeout(m),m=setTimeout(()=>{this._reportTelemetry(e),t(this,Qt).delete(o),t(this,Qt).size===0&&w(this,Qt,null)},p._telemetryTimeout),t(this,Qt).set(o,m);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),w(this,P,!1)}disable(){this.div&&(this.div.tabIndex=-1),w(this,P,!0)}renderAnnotationElement(e){let i=e.container.querySelector(".annotationContent");if(!i)i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),e.container.prepend(i);else if(i.nodeName==="CANVAS"){const o=i;i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),o.before(i)}return i}resetAnnotationElement(e){const{firstChild:i}=e.container;i.nodeName==="DIV"&&i.classList.contains("annotationContent")&&i.remove()}};O=new WeakMap,C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap,bt=new WeakMap,Tt=new WeakMap,ot=new WeakMap,nt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakMap,Rt=new WeakMap,Qt=new WeakMap,ue=new WeakMap,Ae=new WeakMap,Bt=new WeakSet,Wi=function([e,i],o,m){[o,m]=this.screenToPageTranslation(o,m),this.x+=o/e,this.y+=m/i,this.fixAndSetPosition()},ee=new WeakSet,$i=function(e,i,o){switch(o){case 90:return[i,-e];case 180:return[-e,-i];case 270:return[-i,e];default:return[e,i]}},Xi=function(e){switch(e){case 90:{const[i,o]=this.pageDimensions;return[0,-i/o,o/i,0]}case 180:return[-1,0,0,-1];case 270:{const[i,o]=this.pageDimensions;return[0,i/o,-o/i,0]}default:return[1,0,0,1]}},Gr=function(){if(t(this,st))return;w(this,st,document.createElement("div")),t(this,st).classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const i of e){const o=document.createElement("div");t(this,st).append(o),o.classList.add("resizer",i),o.setAttribute("data-resizer-name",i),o.addEventListener("pointerdown",b(this,Bt,Wr).bind(this,i)),o.addEventListener("contextmenu",H.noContextMenu),o.tabIndex=-1}this.div.prepend(t(this,st))},Wr=function(e,i){var Gt;i.preventDefault();const{isMac:o}=Q.FeatureTest.platform;if(i.button!==0||i.ctrlKey&&o)return;(Gt=t(this,C))==null||Gt.toggle(!1);const m=b(this,Bt,Yi).bind(this,e),M=this._isDraggable;this._isDraggable=!1;const $={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",m,$),window.addEventListener("contextmenu",H.noContextMenu);const W=this.x,tt=this.y,gt=this.width,it=this.height,_t=this.parent.div.style.cursor,Ot=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(i.target).cursor;const jt=()=>{var Ut;this.parent.togglePointerEvents(!0),(Ut=t(this,C))==null||Ut.toggle(!0),this._isDraggable=M,window.removeEventListener("pointerup",jt),window.removeEventListener("blur",jt),window.removeEventListener("pointermove",m,$),window.removeEventListener("contextmenu",H.noContextMenu),this.parent.div.style.cursor=_t,this.div.style.cursor=Ot,b(this,Bt,Ki).call(this,W,tt,gt,it)};window.addEventListener("pointerup",jt),window.addEventListener("blur",jt)},Ki=function(e,i,o,m){const M=this.x,$=this.y,W=this.width,tt=this.height;M===e&&$===i&&W===o&&tt===m||this.addCommands({cmd:()=>{this.width=W,this.height=tt,this.x=M,this.y=$;const[gt,it]=this.parentDimensions;this.setDims(gt*W,it*tt),this.fixAndSetPosition()},undo:()=>{this.width=o,this.height=m,this.x=e,this.y=i;const[gt,it]=this.parentDimensions;this.setDims(gt*o,it*m),this.fixAndSetPosition()},mustExec:!0})},Yi=function(e,i){const[o,m]=this.parentDimensions,M=this.x,$=this.y,W=this.width,tt=this.height,gt=p.MIN_SIZE/o,it=p.MIN_SIZE/m,_t=U=>Math.round(U*1e4)/1e4,Ot=b(this,Bt,Xi).call(this,this.rotation),jt=(U,q)=>[Ot[0]*U+Ot[2]*q,Ot[1]*U+Ot[3]*q],Gt=b(this,Bt,Xi).call(this,360-this.rotation),Ut=(U,q)=>[Gt[0]*U+Gt[2]*q,Gt[1]*U+Gt[3]*q];let lt,ut,T=!1,X=!1;switch(e){case"topLeft":T=!0,lt=(U,q)=>[0,0],ut=(U,q)=>[U,q];break;case"topMiddle":lt=(U,q)=>[U/2,0],ut=(U,q)=>[U/2,q];break;case"topRight":T=!0,lt=(U,q)=>[U,0],ut=(U,q)=>[0,q];break;case"middleRight":X=!0,lt=(U,q)=>[U,q/2],ut=(U,q)=>[0,q/2];break;case"bottomRight":T=!0,lt=(U,q)=>[U,q],ut=(U,q)=>[0,0];break;case"bottomMiddle":lt=(U,q)=>[U/2,q],ut=(U,q)=>[U/2,0];break;case"bottomLeft":T=!0,lt=(U,q)=>[0,q],ut=(U,q)=>[U,0];break;case"middleLeft":X=!0,lt=(U,q)=>[0,q/2],ut=(U,q)=>[U,q/2];break}const Y=lt(W,tt),vt=ut(W,tt);let Et=jt(...vt);const Lt=_t(M+Et[0]),Ht=_t($+Et[1]);let te=1,de=1,[be,we]=this.screenToPageTranslation(i.movementX,i.movementY);if([be,we]=Ut(be/o,we/m),T){const U=Math.hypot(W,tt);te=de=Math.max(Math.min(Math.hypot(vt[0]-Y[0]-be,vt[1]-Y[1]-we)/U,1/W,1/tt),gt/W,it/tt)}else X?te=Math.max(gt,Math.min(1,Math.abs(vt[0]-Y[0]-be)))/W:de=Math.max(it,Math.min(1,Math.abs(vt[1]-Y[1]-we)))/tt;const Wt=_t(W*te),v=_t(tt*de);Et=jt(...ut(Wt,v));const f=Lt-Et[0],x=Ht-Et[1];this.width=Wt,this.height=v,this.x=f,this.y=x,this.setDims(o*Wt,m*v),this.fixAndSetPosition()},Ji=function(e){const{isMac:i}=Q.FeatureTest.platform;e.ctrlKey&&!i||e.shiftKey||e.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)},$r=function(e){const i=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let o,m;i&&(this.div.classList.add("moving"),o={passive:!0,capture:!0},w(this,oe,e.clientX),w(this,Rt,e.clientY),m=$=>{const{clientX:W,clientY:tt}=$,[gt,it]=this.screenToPageTranslation(W-t(this,oe),tt-t(this,Rt));w(this,oe,W),w(this,Rt,tt),this._uiManager.dragSelectedEditors(gt,it)},window.addEventListener("pointermove",m,o));const M=()=>{window.removeEventListener("pointerup",M),window.removeEventListener("blur",M),i&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",m,o)),w(this,It,!1),this._uiManager.endDragSession()||b(this,Bt,Ji).call(this,e)};window.addEventListener("pointerup",M),window.addEventListener("blur",M)},Xr=function(e){p._resizerKeyboardManager.exec(this,e)},Kr=function(e){var i;t(this,Jt)&&((i=e.relatedTarget)==null?void 0:i.parentNode)!==t(this,st)&&b(this,Bt,Fs).call(this)},Yr=function(e){w(this,Mt,t(this,Jt)?e:"")},Qi=function(e){if(t(this,O))for(const i of t(this,O))i.tabIndex=e},Fs=function(){if(w(this,Jt,!1),b(this,Bt,Qi).call(this,-1),t(this,bt)){const{savedX:e,savedY:i,savedWidth:o,savedHeight:m}=t(this,bt);b(this,Bt,Ki).call(this,e,i,o,m),w(this,bt,null)}},_(p,ee),he(p,"_borderLineWidth",-1),he(p,"_colorManager",new d.ColorManager),he(p,"_zIndex",1),he(p,"_telemetryTimeout",1e3);let z=p;class F extends z{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},61:(ie,$t,dt)=>{var F,I,V,E,Jr,ai,Qr,Zr,Zi,K,k,O,C,P,ht,st,bt,Tt,ot,nt,Mt,It,Pt,Xt,ae,Jt,re,oe,tn,ue,Ae,Bt,le,ee,ce,Zt,Nt,Ns,Os,ta;dt.d($t,{FreeOutliner:()=>At,Outliner:()=>Q});var d=dt(292);class Q{constructor(s,a=0,h=0,l=!0){_(this,E);_(this,F);_(this,I,[]);_(this,V,[]);let g=1/0,u=-1/0,p=1/0,R=-1/0;const e=10**-4;for(const{x:tt,y:gt,width:it,height:_t}of s){const Ot=Math.floor((tt-a)/e)*e,jt=Math.ceil((tt+it+a)/e)*e,Gt=Math.floor((gt-a)/e)*e,Ut=Math.ceil((gt+_t+a)/e)*e,lt=[Ot,Gt,Ut,!0],ut=[jt,Gt,Ut,!1];t(this,I).push(lt,ut),g=Math.min(g,Ot),u=Math.max(u,jt),p=Math.min(p,Gt),R=Math.max(R,Ut)}const i=u-g+2*h,o=R-p+2*h,m=g-h,M=p-h,$=t(this,I).at(l?-1:-2),W=[$[0],$[2]];for(const tt of t(this,I)){const[gt,it,_t]=tt;tt[0]=(gt-m)/i,tt[1]=(it-M)/o,tt[2]=(_t-M)/o}w(this,F,{x:m,y:M,width:i,height:o,lastPoint:W})}getOutlines(){t(this,I).sort((a,h)=>a[0]-h[0]||a[1]-h[1]||a[2]-h[2]);const s=[];for(const a of t(this,I))a[3]?(s.push(...b(this,E,Zi).call(this,a)),b(this,E,Qr).call(this,a)):(b(this,E,Zr).call(this,a),s.push(...b(this,E,Zi).call(this,a)));return b(this,E,Jr).call(this,s)}}F=new WeakMap,I=new WeakMap,V=new WeakMap,E=new WeakSet,Jr=function(s){const a=[],h=new Set;for(const u of s){const[p,R,e]=u;a.push([p,R,u],[p,e,u])}a.sort((u,p)=>u[1]-p[1]||u[0]-p[0]);for(let u=0,p=a.length;u0;){const u=h.values().next().value;let[p,R,e,i,o]=u;h.delete(u);let m=p,M=R;for(g=[p,e],l.push(g);;){let $;if(h.has(i))$=i;else if(h.has(o))$=o;else break;h.delete($),[p,R,e,i,o]=$,m!==p&&(g.push(m,M,p,M===R?R:e),m=p),M=M===R?e:R}g.push(m,M)}return new J(l,t(this,F))},ai=function(s){const a=t(this,V);let h=0,l=a.length-1;for(;h<=l;){const g=h+l>>1,u=a[g][0];if(u===s)return g;u=0;l--){const[g,u]=t(this,V)[l];if(g!==s)break;if(g===s&&u===a){t(this,V).splice(l,1);return}}},Zi=function(s){const[a,h,l]=s,g=[[a,h,l]],u=b(this,E,ai).call(this,l);for(let p=0;p=R){if(M>e)g[i][1]=e;else{if(o===1)return[];g.splice(i,1),i--,o--}continue}g[i][2]=R,M>e&&g.push([a,e,M])}}}return g};class H{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(s,a){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof z}}class J extends H{constructor(a,h){super();_(this,K);_(this,k);w(this,k,a),w(this,K,h)}toSVGPath(){const a=[];for(const h of t(this,k)){let[l,g]=h;a.push(`M${l} ${g}`);for(let u=2;u=6;$-=6)isNaN(a[$])?M.push(`L${a[$+4]} ${a[$+5]}`):M.push(`C${a[$]} ${a[$+1]} ${a[$+2]} ${a[$+3]} ${a[$+4]} ${a[$+5]}`);return M.push(`L${a[4]} ${a[5]} Z`),M.join(" ")}getOutlines(){var gt;const s=t(this,st),a=t(this,C),h=t(this,bt),l=h.subarray(4,6),g=h.subarray(16,18),[u,p,R,e]=t(this,O),i=new Float64Array((((gt=t(this,Xt))==null?void 0:gt.length)??0)+2);for(let it=0,_t=i.length-2;it<_t;it+=2)i[it]=(t(this,Xt)[it]-u)/R,i[it+1]=(t(this,Xt)[it+1]-p)/e;i[i.length-2]=(t(this,Tt)-u)/R,i[i.length-1]=(t(this,ot)-p)/e;const[o,m,M,$]=b(this,oe,tn).call(this);if(isNaN(h[6])&&!this.isEmpty()){const it=new Float64Array(36);return it.set([NaN,NaN,NaN,NaN,(h[2]-u)/R,(h[3]-p)/e,NaN,NaN,NaN,NaN,(h[4]-u)/R,(h[5]-p)/e,NaN,NaN,NaN,NaN,o,m,NaN,NaN,NaN,NaN,M,$,NaN,NaN,NaN,NaN,(h[16]-u)/R,(h[17]-p)/e,NaN,NaN,NaN,NaN,(h[14]-u)/R,(h[15]-p)/e],0),new z(it,i,t(this,O),t(this,It),t(this,P),t(this,ht))}const W=new Float64Array(t(this,st).length+24+t(this,C).length);let tt=s.length;for(let it=0;it=6;it-=6)for(let _t=0;_t<6;_t+=2){if(isNaN(a[it+_t])){W[tt]=W[tt+1]=NaN,tt+=2;continue}W[tt]=a[it+_t],W[tt+1]=a[it+_t+1],tt+=2}return W.set([NaN,NaN,NaN,NaN,a[4],a[5]],tt),new z(W,i,t(this,O),t(this,It),t(this,P),t(this,ht))}};O=new WeakMap,C=new WeakMap,P=new WeakMap,ht=new WeakMap,st=new WeakMap,bt=new WeakMap,Tt=new WeakMap,ot=new WeakMap,nt=new WeakMap,Mt=new WeakMap,It=new WeakMap,Pt=new WeakMap,Xt=new WeakMap,ae=new WeakMap,Jt=new WeakMap,re=new WeakMap,oe=new WeakSet,tn=function(){const s=t(this,bt).subarray(4,6),a=t(this,bt).subarray(16,18),[h,l,g,u]=t(this,O);return[(t(this,Tt)+(s[0]-a[0])/2-h)/g,(t(this,ot)+(s[1]-a[1])/2-l)/u,(t(this,Tt)+(a[0]-s[0])/2-h)/g,(t(this,ot)+(a[1]-s[1])/2-l)/u]},_(Qt,ae,8),_(Qt,Jt,2),_(Qt,re,t(Qt,ae)+t(Qt,Jt));let At=Qt;class z extends H{constructor(a,h,l,g,u,p){super();_(this,Nt);_(this,ue);_(this,Ae,null);_(this,Bt);_(this,le);_(this,ee);_(this,ce);_(this,Zt);w(this,Zt,a),w(this,ee,h),w(this,ue,l),w(this,ce,g),w(this,Bt,u),w(this,le,p),b(this,Nt,ta).call(this,p);const{x:R,y:e,width:i,height:o}=t(this,Ae);for(let m=0,M=a.length;m{var J,At,z,F,I,ea,E,sa,ia,oi,na,en,k,O,C,P,ra,aa,oa;dt.d($t,{EditorToolbar:()=>Q,HighlightToolbar:()=>H});var d=dt(419);const K=class K{constructor(ot){_(this,E);_(this,J,null);_(this,At,null);_(this,z);_(this,F,null);w(this,z,ot)}render(){const ot=w(this,J,document.createElement("div"));ot.className="editToolbar",ot.setAttribute("role","toolbar"),ot.addEventListener("contextmenu",d.noContextMenu),ot.addEventListener("pointerdown",b(K,I,ea));const nt=w(this,F,document.createElement("div"));nt.className="buttons",ot.append(nt);const Mt=t(this,z).toolbarPosition;if(Mt){const{style:It}=ot,Pt=t(this,z)._uiManager.direction==="ltr"?1-Mt[0]:Mt[0];It.insetInlineEnd=`${100*Pt}%`,It.top=`calc(${100*Mt[1]}% + var(--editor-toolbar-vert-offset))`}return b(this,E,na).call(this),ot}hide(){var ot;t(this,J).classList.add("hidden"),(ot=t(this,At))==null||ot.hideDropdown()}show(){t(this,J).classList.remove("hidden")}addAltTextButton(ot){b(this,E,oi).call(this,ot),t(this,F).prepend(ot,t(this,E,en))}addColorPicker(ot){w(this,At,ot);const nt=ot.renderButton();b(this,E,oi).call(this,nt),t(this,F).prepend(nt,t(this,E,en))}remove(){var ot;t(this,J).remove(),(ot=t(this,At))==null||ot.destroy(),w(this,At,null)}};J=new WeakMap,At=new WeakMap,z=new WeakMap,F=new WeakMap,I=new WeakSet,ea=function(ot){ot.stopPropagation()},E=new WeakSet,sa=function(ot){t(this,z)._focusEventsAllowed=!1,ot.preventDefault(),ot.stopPropagation()},ia=function(ot){t(this,z)._focusEventsAllowed=!0,ot.preventDefault(),ot.stopPropagation()},oi=function(ot){ot.addEventListener("focusin",b(this,E,sa).bind(this),{capture:!0}),ot.addEventListener("focusout",b(this,E,ia).bind(this),{capture:!0}),ot.addEventListener("contextmenu",d.noContextMenu)},na=function(){const ot=document.createElement("button");ot.className="delete",ot.tabIndex=0,ot.setAttribute("data-l10n-id",`pdfjs-editor-remove-${t(this,z).editorType}-button`),b(this,E,oi).call(this,ot),ot.addEventListener("click",nt=>{t(this,z)._uiManager.delete()}),t(this,F).append(ot)},en=function(){const ot=document.createElement("div");return ot.className="divider",ot},_(K,I);let Q=K;class H{constructor(ot){_(this,P);_(this,k,null);_(this,O,null);_(this,C);w(this,C,ot)}show(ot,nt,Mt){const[It,Pt]=b(this,P,aa).call(this,nt,Mt),{style:Xt}=t(this,O)||w(this,O,b(this,P,ra).call(this));ot.append(t(this,O)),Xt.insetInlineEnd=`${100*It}%`,Xt.top=`calc(${100*Pt}% + var(--editor-toolbar-vert-offset))`}hide(){t(this,O).remove()}}k=new WeakMap,O=new WeakMap,C=new WeakMap,P=new WeakSet,ra=function(){const ot=w(this,O,document.createElement("div"));ot.className="editToolbar",ot.setAttribute("role","toolbar"),ot.addEventListener("contextmenu",d.noContextMenu);const nt=w(this,k,document.createElement("div"));return nt.className="buttons",ot.append(nt),b(this,P,oa).call(this),ot},aa=function(ot,nt){let Mt=0,It=0;for(const Pt of ot){const Xt=Pt.y+Pt.height;if(XtMt){It=ae,Mt=Xt;continue}nt?ae>It&&(It=ae):ae{t(this,C).highlightSelection("floating_button")}),t(this,k).append(ot)}},830:(ie,$t,dt)=>{var D,L,Z,B,K,sn,C,P,ht,st,bt,ha,nt,Mt,It,Pt,Xt,ae,Jt,re,oe,Rt,Qt,ue,Ae,Bt,le,ee,ce,Zt,Nt,mt,pt,S,n,s,a,h,l,g,u,p,R,e,i,o,m,M,$,W,tt,gt,it,_t,Ot,jt,Gt,Ut,lt,hi,la,ca,li,da,ua,pa,nn,rn,an,on,hn,Oe,is,ga,fa,ln,ma,Hs,cn;dt.d($t,{AnnotationEditorUIManager:()=>y,ColorManager:()=>E,KeyboardManager:()=>V,bindEvents:()=>J,opacityToHex:()=>At});var d=dt(292),Q=dt(419),H=dt(362);function J(Ft,c,N){for(const et of N)c.addEventListener(et,Ft[et].bind(Ft))}function At(Ft){return Math.round(Math.min(255,Math.max(1,255*Ft))).toString(16).padStart(2,"0")}class z{constructor(){_(this,D,0)}get id(){return`${d.AnnotationEditorPrefix}${Je(this,D)._++}`}}D=new WeakMap;const O=class O{constructor(){_(this,K);_(this,L,(0,d.getUuid)());_(this,Z,0);_(this,B,null)}static get _isSVGFittingCanvas(){const c='data:image/svg+xml;charset=UTF-8,',N=new OffscreenCanvas(1,3).getContext("2d"),et=new Image;et.src=c;const ct=et.decode().then(()=>(N.drawImage(et,0,0,1,1,0,0,1,3),new Uint32Array(N.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,d.shadow)(this,"_isSVGFittingCanvas",ct)}async getFromFile(c){const{lastModified:N,name:et,size:ct,type:St}=c;return b(this,K,sn).call(this,`${N}_${et}_${ct}_${St}`,c)}async getFromUrl(c){return b(this,K,sn).call(this,c,c)}async getFromId(c){t(this,B)||w(this,B,new Map);const N=t(this,B).get(c);return N?N.bitmap?(N.refCounter+=1,N):N.file?this.getFromFile(N.file):this.getFromUrl(N.url):null}getSvgUrl(c){const N=t(this,B).get(c);return N!=null&&N.isSvg?N.svgUrl:null}deleteId(c){t(this,B)||w(this,B,new Map);const N=t(this,B).get(c);N&&(N.refCounter-=1,N.refCounter===0&&(N.bitmap=null))}isValidId(c){return c.startsWith(`image_${t(this,L)}_`)}};L=new WeakMap,Z=new WeakMap,B=new WeakMap,K=new WeakSet,sn=async function(c,N){t(this,B)||w(this,B,new Map);let et=t(this,B).get(c);if(et===null)return null;if(et!=null&&et.bitmap)return et.refCounter+=1,et;try{et||(et={bitmap:null,id:`image_${t(this,L)}_${Je(this,Z)._++}`,refCounter:0,isSvg:!1});let ct;if(typeof N=="string"?(et.url=N,ct=await(0,Q.fetchData)(N,"blob")):ct=et.file=N,ct.type==="image/svg+xml"){const St=O._isSVGFittingCanvas,xt=new FileReader,Dt=new Image,Kt=new Promise((Yt,fe)=>{Dt.onload=()=>{et.bitmap=Dt,et.isSvg=!0,Yt()},xt.onload=async()=>{const Me=et.svgUrl=xt.result;Dt.src=await St?`${Me}#svgView(preserveAspectRatio(none))`:Me},Dt.onerror=xt.onerror=fe});xt.readAsDataURL(ct),await Kt}else et.bitmap=await createImageBitmap(ct);et.refCounter=1}catch(ct){console.error(ct),et=null}return t(this,B).set(c,et),et&&t(this,B).set(et.id,et),et};let F=O;class I{constructor(c=128){_(this,C,[]);_(this,P,!1);_(this,ht);_(this,st,-1);w(this,ht,c)}add({cmd:c,undo:N,post:et,mustExec:ct,type:St=NaN,overwriteIfSameType:xt=!1,keepUndo:Dt=!1}){if(ct&&c(),t(this,P))return;const Kt={cmd:c,undo:N,post:et,type:St};if(t(this,st)===-1){t(this,C).length>0&&(t(this,C).length=0),w(this,st,0),t(this,C).push(Kt);return}if(xt&&t(this,C)[t(this,st)].type===St){Dt&&(Kt.undo=t(this,C)[t(this,st)].undo),t(this,C)[t(this,st)]=Kt;return}const Yt=t(this,st)+1;Yt===t(this,ht)?t(this,C).splice(0,1):(w(this,st,Yt),YtSt===N[xt]))return ot._colorsMapping.get(et);return N}getHexCode(c){const N=this._colors.get(c);return N?d.Util.makeHexColor(...N):c}};he(ot,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let E=ot;const zt=class zt{constructor(c,N,et,ct,St,xt,Dt,Kt,Yt){_(this,lt);_(this,nt,null);_(this,Mt,new Map);_(this,It,new Map);_(this,Pt,null);_(this,Xt,null);_(this,ae,null);_(this,Jt,new I);_(this,re,0);_(this,oe,new Set);_(this,Rt,null);_(this,Qt,null);_(this,ue,new Set);_(this,Ae,!1);_(this,Bt,null);_(this,le,null);_(this,ee,null);_(this,ce,!1);_(this,Zt,null);_(this,Nt,new z);_(this,mt,!1);_(this,pt,!1);_(this,S,null);_(this,n,null);_(this,s,null);_(this,a,d.AnnotationEditorType.NONE);_(this,h,new Set);_(this,l,null);_(this,g,null);_(this,u,null);_(this,p,this.blur.bind(this));_(this,R,this.focus.bind(this));_(this,e,this.copy.bind(this));_(this,i,this.cut.bind(this));_(this,o,this.paste.bind(this));_(this,m,this.keydown.bind(this));_(this,M,this.keyup.bind(this));_(this,$,this.onEditingAction.bind(this));_(this,W,this.onPageChanging.bind(this));_(this,tt,this.onScaleChanging.bind(this));_(this,gt,b(this,lt,ca).bind(this));_(this,it,this.onRotationChanging.bind(this));_(this,_t,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});_(this,Ot,[0,0]);_(this,jt,null);_(this,Gt,null);_(this,Ut,null);w(this,Gt,c),w(this,Ut,N),w(this,Pt,et),this._eventBus=ct,this._eventBus._on("editingaction",t(this,$)),this._eventBus._on("pagechanging",t(this,W)),this._eventBus._on("scalechanging",t(this,tt)),this._eventBus._on("rotationchanging",t(this,it)),b(this,lt,da).call(this),b(this,lt,rn).call(this),w(this,Xt,St.annotationStorage),w(this,Bt,St.filterFactory),w(this,g,xt),w(this,ee,Dt||null),w(this,Ae,Kt),w(this,s,Yt||null),this.viewParameters={realScale:Q.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const c=zt.prototype,N=xt=>t(xt,Gt).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&xt.hasSomethingToControl(),et=(xt,{target:Dt})=>{if(Dt instanceof HTMLInputElement){const{type:Kt}=Dt;return Kt!=="text"&&Kt!=="number"}return!0},ct=this.TRANSLATE_SMALL,St=this.TRANSLATE_BIG;return(0,d.shadow)(this,"_keyboardManager",new V([[["ctrl+a","mac+meta+a"],c.selectAll,{checker:et}],[["ctrl+z","mac+meta+z"],c.undo,{checker:et}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],c.redo,{checker:et}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],c.delete,{checker:et}],[["Enter","mac+Enter"],c.addNewEditorFromKeyboard,{checker:(xt,{target:Dt})=>!(Dt instanceof HTMLButtonElement)&&t(xt,Gt).contains(Dt)&&!xt.isEnterHandled}],[[" ","mac+ "],c.addNewEditorFromKeyboard,{checker:(xt,{target:Dt})=>!(Dt instanceof HTMLButtonElement)&&t(xt,Gt).contains(document.activeElement)}],[["Escape","mac+Escape"],c.unselectAll],[["ArrowLeft","mac+ArrowLeft"],c.translateSelectedEditors,{args:[-ct,0],checker:N}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],c.translateSelectedEditors,{args:[-St,0],checker:N}],[["ArrowRight","mac+ArrowRight"],c.translateSelectedEditors,{args:[ct,0],checker:N}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],c.translateSelectedEditors,{args:[St,0],checker:N}],[["ArrowUp","mac+ArrowUp"],c.translateSelectedEditors,{args:[0,-ct],checker:N}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],c.translateSelectedEditors,{args:[0,-St],checker:N}],[["ArrowDown","mac+ArrowDown"],c.translateSelectedEditors,{args:[0,ct],checker:N}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],c.translateSelectedEditors,{args:[0,St],checker:N}]]))}destroy(){var c,N;b(this,lt,an).call(this),b(this,lt,nn).call(this),this._eventBus._off("editingaction",t(this,$)),this._eventBus._off("pagechanging",t(this,W)),this._eventBus._off("scalechanging",t(this,tt)),this._eventBus._off("rotationchanging",t(this,it));for(const et of t(this,It).values())et.destroy();t(this,It).clear(),t(this,Mt).clear(),t(this,ue).clear(),w(this,nt,null),t(this,h).clear(),t(this,Jt).destroy(),(c=t(this,Pt))==null||c.destroy(),(N=t(this,Zt))==null||N.hide(),w(this,Zt,null),t(this,le)&&(clearTimeout(t(this,le)),w(this,le,null)),t(this,jt)&&(clearTimeout(t(this,jt)),w(this,jt,null)),b(this,lt,ua).call(this)}async mlGuess(c){var N;return((N=t(this,s))==null?void 0:N.guess(c))||null}get hasMLManager(){return!!t(this,s)}get hcmFilter(){return(0,d.shadow)(this,"hcmFilter",t(this,g)?t(this,Bt).addHCMFilter(t(this,g).foreground,t(this,g).background):"none")}get direction(){return(0,d.shadow)(this,"direction",getComputedStyle(t(this,Gt)).direction)}get highlightColors(){return(0,d.shadow)(this,"highlightColors",t(this,ee)?new Map(t(this,ee).split(",").map(c=>c.split("=").map(N=>N.trim()))):null)}get highlightColorNames(){return(0,d.shadow)(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,c=>c.reverse())):null)}setMainHighlightColorPicker(c){w(this,n,c)}editAltText(c){var N;(N=t(this,Pt))==null||N.editAltText(this,c)}onPageChanging({pageNumber:c}){w(this,re,c-1)}focusMainContainer(){t(this,Gt).focus()}findParent(c,N){for(const et of t(this,It).values()){const{x:ct,y:St,width:xt,height:Dt}=et.div.getBoundingClientRect();if(c>=ct&&c<=ct+xt&&N>=St&&N<=St+Dt)return et}return null}disableUserSelect(c=!1){t(this,Ut).classList.toggle("noUserSelect",c)}addShouldRescale(c){t(this,ue).add(c)}removeShouldRescale(c){t(this,ue).delete(c)}onScaleChanging({scale:c}){this.commitOrRemove(),this.viewParameters.realScale=c*Q.PixelsPerInch.PDF_TO_CSS_UNITS;for(const N of t(this,ue))N.onScaleChanging()}onRotationChanging({pagesRotation:c}){this.commitOrRemove(),this.viewParameters.rotation=c}highlightSelection(c=""){const N=document.getSelection();if(!N||N.isCollapsed)return;const{anchorNode:et,anchorOffset:ct,focusNode:St,focusOffset:xt}=N,Dt=N.toString(),Kt=b(this,lt,hi).call(this,N).closest(".textLayer"),Yt=this.getSelectionBoxes(Kt);if(Yt){N.empty(),t(this,a)===d.AnnotationEditorType.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:d.AnnotationEditorType.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const fe of t(this,It).values())if(fe.hasTextLayer(Kt)){fe.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:c,boxes:Yt,anchorNode:et,anchorOffset:ct,focusNode:St,focusOffset:xt,text:Dt});break}}}addToAnnotationStorage(c){!c.isEmpty()&&t(this,Xt)&&!t(this,Xt).has(c.id)&&t(this,Xt).setValue(c.id,c)}blur(){if(this.isShiftKeyDown=!1,t(this,ce)&&(w(this,ce,!1),b(this,lt,li).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:c}=document;for(const N of t(this,h))if(N.div.contains(c)){w(this,S,[N,c]),N._focusEventsAllowed=!1;break}}focus(){if(!t(this,S))return;const[c,N]=t(this,S);w(this,S,null),N.addEventListener("focusin",()=>{c._focusEventsAllowed=!0},{once:!0}),N.focus()}addEditListeners(){b(this,lt,rn).call(this),b(this,lt,on).call(this)}removeEditListeners(){b(this,lt,an).call(this),b(this,lt,hn).call(this)}copy(c){var et;if(c.preventDefault(),(et=t(this,nt))==null||et.commitOrRemove(),!this.hasSelection)return;const N=[];for(const ct of t(this,h)){const St=ct.serialize(!0);St&&N.push(St)}N.length!==0&&c.clipboardData.setData("application/pdfjs",JSON.stringify(N))}cut(c){this.copy(c),this.delete()}paste(c){c.preventDefault();const{clipboardData:N}=c;for(const St of N.items)for(const xt of t(this,Qt))if(xt.isHandlingMimeForPasting(St.type)){xt.paste(St,this.currentLayer);return}let et=N.getData("application/pdfjs");if(!et)return;try{et=JSON.parse(et)}catch(St){(0,d.warn)(`paste: "${St.message}".`);return}if(!Array.isArray(et))return;this.unselectAll();const ct=this.currentLayer;try{const St=[];for(const Kt of et){const Yt=ct.deserialize(Kt);if(!Yt)return;St.push(Yt)}const xt=()=>{for(const Kt of St)b(this,lt,ln).call(this,Kt);b(this,lt,cn).call(this,St)},Dt=()=>{for(const Kt of St)Kt.remove()};this.addCommands({cmd:xt,undo:Dt,mustExec:!0})}catch(St){(0,d.warn)(`paste: "${St.message}".`)}}keydown(c){!this.isShiftKeyDown&&c.key==="Shift"&&(this.isShiftKeyDown=!0),t(this,a)!==d.AnnotationEditorType.NONE&&!this.isEditorHandlingKeyboard&&zt._keyboardManager.exec(this,c)}keyup(c){this.isShiftKeyDown&&c.key==="Shift"&&(this.isShiftKeyDown=!1,t(this,ce)&&(w(this,ce,!1),b(this,lt,li).call(this,"main_toolbar")))}onEditingAction({name:c}){switch(c){case"undo":case"redo":case"delete":case"selectAll":this[c]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(c){c?(b(this,lt,pa).call(this),b(this,lt,on).call(this),b(this,lt,Oe).call(this,{isEditing:t(this,a)!==d.AnnotationEditorType.NONE,isEmpty:b(this,lt,Hs).call(this),hasSomethingToUndo:t(this,Jt).hasSomethingToUndo(),hasSomethingToRedo:t(this,Jt).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,lt,nn).call(this),b(this,lt,hn).call(this),b(this,lt,Oe).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(c){if(!t(this,Qt)){w(this,Qt,c);for(const N of t(this,Qt))b(this,lt,is).call(this,N.defaultPropertiesToUpdate)}}getId(){return t(this,Nt).id}get currentLayer(){return t(this,It).get(t(this,re))}getLayer(c){return t(this,It).get(c)}get currentPageIndex(){return t(this,re)}addLayer(c){t(this,It).set(c.pageIndex,c),t(this,mt)?c.enable():c.disable()}removeLayer(c){t(this,It).delete(c.pageIndex)}updateMode(c,N=null,et=!1){if(t(this,a)!==c){if(w(this,a,c),c===d.AnnotationEditorType.NONE){this.setEditingState(!1),b(this,lt,fa).call(this);return}this.setEditingState(!0),b(this,lt,ga).call(this),this.unselectAll();for(const ct of t(this,It).values())ct.updateMode(c);if(!N&&et){this.addNewEditorFromKeyboard();return}if(N){for(const ct of t(this,Mt).values())if(ct.annotationElementId===N){this.setSelected(ct),ct.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(c){c!==t(this,a)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:c})}updateParams(c,N){var et;if(t(this,Qt)){switch(c){case d.AnnotationEditorParamsType.CREATE:this.currentLayer.addNewEditor();return;case d.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:(et=t(this,n))==null||et.updateColor(N);break;case d.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(t(this,u)||w(this,u,new Map)).set(c,N),this.showAllEditors("highlight",N);break}for(const ct of t(this,h))ct.updateParams(c,N);for(const ct of t(this,Qt))ct.updateDefaultParams(c,N)}}showAllEditors(c,N,et=!1){var ct;for(const St of t(this,Mt).values())St.editorType===c&&St.show(N);(((ct=t(this,u))==null?void 0:ct.get(d.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL))??!0)!==N&&b(this,lt,is).call(this,[[d.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,N]])}enableWaiting(c=!1){if(t(this,pt)!==c){w(this,pt,c);for(const N of t(this,It).values())c?N.disableClick():N.enableClick(),N.div.classList.toggle("waiting",c)}}getEditors(c){const N=[];for(const et of t(this,Mt).values())et.pageIndex===c&&N.push(et);return N}getEditor(c){return t(this,Mt).get(c)}addEditor(c){t(this,Mt).set(c.id,c)}removeEditor(c){var N;c.div.contains(document.activeElement)&&(t(this,le)&&clearTimeout(t(this,le)),w(this,le,setTimeout(()=>{this.focusMainContainer(),w(this,le,null)},0))),t(this,Mt).delete(c.id),this.unselect(c),(!c.annotationElementId||!t(this,oe).has(c.annotationElementId))&&((N=t(this,Xt))==null||N.remove(c.id))}addDeletedAnnotationElement(c){t(this,oe).add(c.annotationElementId),this.addChangedExistingAnnotation(c),c.deleted=!0}isDeletedAnnotationElement(c){return t(this,oe).has(c)}removeDeletedAnnotationElement(c){t(this,oe).delete(c.annotationElementId),this.removeChangedExistingAnnotation(c),c.deleted=!1}setActiveEditor(c){t(this,nt)!==c&&(w(this,nt,c),c&&b(this,lt,is).call(this,c.propertiesToUpdate))}updateUI(c){t(this,lt,ma)===c&&b(this,lt,is).call(this,c.propertiesToUpdate)}toggleSelected(c){if(t(this,h).has(c)){t(this,h).delete(c),c.unselect(),b(this,lt,Oe).call(this,{hasSelectedEditor:this.hasSelection});return}t(this,h).add(c),c.select(),b(this,lt,is).call(this,c.propertiesToUpdate),b(this,lt,Oe).call(this,{hasSelectedEditor:!0})}setSelected(c){for(const N of t(this,h))N!==c&&N.unselect();t(this,h).clear(),t(this,h).add(c),c.select(),b(this,lt,is).call(this,c.propertiesToUpdate),b(this,lt,Oe).call(this,{hasSelectedEditor:!0})}isSelected(c){return t(this,h).has(c)}get firstSelectedEditor(){return t(this,h).values().next().value}unselect(c){c.unselect(),t(this,h).delete(c),b(this,lt,Oe).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return t(this,h).size!==0}get isEnterHandled(){return t(this,h).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){t(this,Jt).undo(),b(this,lt,Oe).call(this,{hasSomethingToUndo:t(this,Jt).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,lt,Hs).call(this)})}redo(){t(this,Jt).redo(),b(this,lt,Oe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:t(this,Jt).hasSomethingToRedo(),isEmpty:b(this,lt,Hs).call(this)})}addCommands(c){t(this,Jt).add(c),b(this,lt,Oe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,lt,Hs).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const c=[...t(this,h)],N=()=>{for(const ct of c)ct.remove()},et=()=>{for(const ct of c)b(this,lt,ln).call(this,ct)};this.addCommands({cmd:N,undo:et,mustExec:!0})}commitOrRemove(){var c;(c=t(this,nt))==null||c.commitOrRemove()}hasSomethingToControl(){return t(this,nt)||this.hasSelection}selectAll(){for(const c of t(this,h))c.commit();b(this,lt,cn).call(this,t(this,Mt).values())}unselectAll(){if(!(t(this,nt)&&(t(this,nt).commitOrRemove(),t(this,a)!==d.AnnotationEditorType.NONE))&&this.hasSelection){for(const c of t(this,h))c.unselect();t(this,h).clear(),b(this,lt,Oe).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(c,N,et=!1){if(et||this.commitOrRemove(),!this.hasSelection)return;t(this,Ot)[0]+=c,t(this,Ot)[1]+=N;const[ct,St]=t(this,Ot),xt=[...t(this,h)];t(this,jt)&&clearTimeout(t(this,jt)),w(this,jt,setTimeout(()=>{w(this,jt,null),t(this,Ot)[0]=t(this,Ot)[1]=0,this.addCommands({cmd:()=>{for(const Kt of xt)t(this,Mt).has(Kt.id)&&Kt.translateInPage(ct,St)},undo:()=>{for(const Kt of xt)t(this,Mt).has(Kt.id)&&Kt.translateInPage(-ct,-St)},mustExec:!1})},1e3));for(const Kt of xt)Kt.translateInPage(c,N)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),w(this,Rt,new Map);for(const c of t(this,h))t(this,Rt).set(c,{savedX:c.x,savedY:c.y,savedPageIndex:c.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!t(this,Rt))return!1;this.disableUserSelect(!1);const c=t(this,Rt);w(this,Rt,null);let N=!1;for(const[{x:ct,y:St,pageIndex:xt},Dt]of c)Dt.newX=ct,Dt.newY=St,Dt.newPageIndex=xt,N||(N=ct!==Dt.savedX||St!==Dt.savedY||xt!==Dt.savedPageIndex);if(!N)return!1;const et=(ct,St,xt,Dt)=>{if(t(this,Mt).has(ct.id)){const Kt=t(this,It).get(Dt);Kt?ct._setParentAndPosition(Kt,St,xt):(ct.pageIndex=Dt,ct.x=St,ct.y=xt)}};return this.addCommands({cmd:()=>{for(const[ct,{newX:St,newY:xt,newPageIndex:Dt}]of c)et(ct,St,xt,Dt)},undo:()=>{for(const[ct,{savedX:St,savedY:xt,savedPageIndex:Dt}]of c)et(ct,St,xt,Dt)},mustExec:!0}),!0}dragSelectedEditors(c,N){if(t(this,Rt))for(const et of t(this,Rt).keys())et.drag(c,N)}rebuild(c){if(c.parent===null){const N=this.getLayer(c.pageIndex);N?(N.changeParent(c),N.addOrRebuild(c)):(this.addEditor(c),this.addToAnnotationStorage(c),c.rebuild())}else c.parent.addOrRebuild(c)}get isEditorHandlingKeyboard(){var c;return((c=this.getActive())==null?void 0:c.shouldGetKeyboardEvents())||t(this,h).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(c){return t(this,nt)===c}getActive(){return t(this,nt)}getMode(){return t(this,a)}get imageManager(){return(0,d.shadow)(this,"imageManager",new F)}getSelectionBoxes(c){if(!c)return null;const N=document.getSelection();for(let Yt=0,fe=N.rangeCount;Yt({x:(fe-ct)/xt,y:1-(Yt+Me-et)/St,width:Re/xt,height:Me/St});break;case"180":Dt=(Yt,fe,Me,Re)=>({x:1-(Yt+Me-et)/St,y:1-(fe+Re-ct)/xt,width:Me/St,height:Re/xt});break;case"270":Dt=(Yt,fe,Me,Re)=>({x:1-(fe+Re-ct)/xt,y:(Yt-et)/St,width:Re/xt,height:Me/St});break;default:Dt=(Yt,fe,Me,Re)=>({x:(Yt-et)/St,y:(fe-ct)/xt,width:Me/St,height:Re/xt});break}const Kt=[];for(let Yt=0,fe=N.rangeCount;Yt{Dt.type==="pointerup"&&Dt.button!==0||(window.removeEventListener("pointerup",xt),window.removeEventListener("blur",xt),Dt.type==="pointerup"&&b(this,lt,li).call(this,"main_toolbar"))};window.addEventListener("pointerup",xt),window.addEventListener("blur",xt)}}},li=function(c=""){t(this,a)===d.AnnotationEditorType.HIGHLIGHT?this.highlightSelection(c):t(this,Ae)&&b(this,lt,la).call(this)},da=function(){document.addEventListener("selectionchange",t(this,gt))},ua=function(){document.removeEventListener("selectionchange",t(this,gt))},pa=function(){window.addEventListener("focus",t(this,R)),window.addEventListener("blur",t(this,p))},nn=function(){window.removeEventListener("focus",t(this,R)),window.removeEventListener("blur",t(this,p))},rn=function(){window.addEventListener("keydown",t(this,m)),window.addEventListener("keyup",t(this,M))},an=function(){window.removeEventListener("keydown",t(this,m)),window.removeEventListener("keyup",t(this,M))},on=function(){document.addEventListener("copy",t(this,e)),document.addEventListener("cut",t(this,i)),document.addEventListener("paste",t(this,o))},hn=function(){document.removeEventListener("copy",t(this,e)),document.removeEventListener("cut",t(this,i)),document.removeEventListener("paste",t(this,o))},Oe=function(c){Object.entries(c).some(([N,et])=>t(this,_t)[N]!==et)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(t(this,_t),c)}),t(this,a)===d.AnnotationEditorType.HIGHLIGHT&&c.hasSelectedEditor===!1&&b(this,lt,is).call(this,[[d.AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))},is=function(c){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:c})},ga=function(){if(!t(this,mt)){w(this,mt,!0);for(const c of t(this,It).values())c.enable();for(const c of t(this,Mt).values())c.enable()}},fa=function(){if(this.unselectAll(),t(this,mt)){w(this,mt,!1);for(const c of t(this,It).values())c.disable();for(const c of t(this,Mt).values())c.disable()}},ln=function(c){const N=t(this,It).get(c.pageIndex);N?N.addOrRebuild(c):(this.addEditor(c),this.addToAnnotationStorage(c))},ma=function(){let c=null;for(c of t(this,h));return c},Hs=function(){if(t(this,Mt).size===0)return!0;if(t(this,Mt).size===1)for(const c of t(this,Mt).values())return c.isEmpty();return!1},cn=function(c){for(const N of t(this,h))N.unselect();t(this,h).clear();for(const N of c)N.isEmpty()||(t(this,h).add(N),N.select());b(this,lt,Oe).call(this,{hasSelectedEditor:this.hasSelection})},he(zt,"TRANSLATE_SMALL",1),he(zt,"TRANSLATE_BIG",10);let y=zt},94:(ie,$t,dt)=>{dt.d($t,{PDFFetchStream:()=>z});var d=dt(292),Q=dt(490);function H(V,E,y){return{method:"GET",headers:V,signal:y.signal,mode:"cors",credentials:E?"include":"same-origin",redirect:"follow"}}function J(V){const E=new Headers;for(const y in V){const D=V[y];D!==void 0&&E.append(y,D)}return E}function At(V){return V instanceof Uint8Array?V.buffer:V instanceof ArrayBuffer?V:((0,d.warn)(`getArrayBuffer - unexpected data format: ${V}`),new Uint8Array(V).buffer)}class z{constructor(E){this.source=E,this.isHttp=/^https?:/i.test(E.url),this.httpHeaders=this.isHttp&&E.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var E;return((E=this._fullRequestReader)==null?void 0:E._loaded)??0}getFullReader(){return(0,d.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new F(this),this._fullRequestReader}getRangeReader(E,y){if(y<=this._progressiveDataLength)return null;const D=new I(this,E,y);return this._rangeRequestReaders.push(D),D}cancelAllRequests(E){var y;(y=this._fullRequestReader)==null||y.cancel(E);for(const D of this._rangeRequestReaders.slice(0))D.cancel(E)}}class F{constructor(E){this._stream=E,this._reader=null,this._loaded=0,this._filename=null;const y=E.source;this._withCredentials=y.withCredentials||!1,this._contentLength=y.length,this._headersCapability=Promise.withResolvers(),this._disableRange=y.disableRange||!1,this._rangeChunkSize=y.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!y.disableStream,this._isRangeSupported=!y.disableRange,this._headers=J(this._stream.httpHeaders);const D=y.url;fetch(D,H(this._headers,this._withCredentials,this._abortController)).then(L=>{if(!(0,Q.validateResponseStatus)(L.status))throw(0,Q.createResponseStatusError)(L.status,D);this._reader=L.body.getReader(),this._headersCapability.resolve();const Z=k=>L.headers.get(k),{allowRangeRequests:B,suggestedLength:K}=(0,Q.validateRangeRequestCapabilities)({getResponseHeader:Z,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=B,this._contentLength=K||this._contentLength,this._filename=(0,Q.extractFilenameFromHeader)(Z),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new d.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var D;await this._headersCapability.promise;const{value:E,done:y}=await this._reader.read();return y?{value:E,done:y}:(this._loaded+=E.byteLength,(D=this.onProgress)==null||D.call(this,{loaded:this._loaded,total:this._contentLength}),{value:At(E),done:!1})}cancel(E){var y;(y=this._reader)==null||y.cancel(E),this._abortController.abort()}}class I{constructor(E,y,D){this._stream=E,this._reader=null,this._loaded=0;const L=E.source;this._withCredentials=L.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!L.disableStream,this._abortController=new AbortController,this._headers=J(this._stream.httpHeaders),this._headers.append("Range",`bytes=${y}-${D-1}`);const Z=L.url;fetch(Z,H(this._headers,this._withCredentials,this._abortController)).then(B=>{if(!(0,Q.validateResponseStatus)(B.status))throw(0,Q.createResponseStatusError)(B.status,Z);this._readCapability.resolve(),this._reader=B.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var D;await this._readCapability.promise;const{value:E,done:y}=await this._reader.read();return y?{value:E,done:y}:(this._loaded+=E.byteLength,(D=this.onProgress)==null||D.call(this,{loaded:this._loaded}),{value:At(E),done:!1})}cancel(E){var y;(y=this._reader)==null||y.cancel(E),this._abortController.abort()}}},10:(ie,$t,dt)=>{var J;dt.d($t,{FontFaceObject:()=>H,FontLoader:()=>Q});var d=dt(292);class Q{constructor({ownerDocument:z=globalThis.document,styleElement:F=null}){_(this,J,new Set);this._document=z,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(z){this.nativeFontFaces.add(z),this._document.fonts.add(z)}removeNativeFontFace(z){this.nativeFontFaces.delete(z),this._document.fonts.delete(z)}insertRule(z){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const F=this.styleElement.sheet;F.insertRule(z,F.cssRules.length)}clear(){for(const z of this.nativeFontFaces)this._document.fonts.delete(z);this.nativeFontFaces.clear(),t(this,J).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:z,_inspectFont:F}){if(!(!z||t(this,J).has(z.loadedName))){if((0,d.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:I,src:V,style:E}=z,y=new FontFace(I,V,E);this.addNativeFontFace(y);try{await y.load(),t(this,J).add(I),F==null||F(z)}catch{(0,d.warn)(`Cannot load system font: ${z.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(y)}return}(0,d.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(z){if(z.attached||z.missingFile&&!z.systemFontInfo)return;if(z.attached=!0,z.systemFontInfo){await this.loadSystemFont(z);return}if(this.isFontLoadingAPISupported){const I=z.createNativeFontFace();if(I){this.addNativeFontFace(I);try{await I.loaded}catch(V){throw(0,d.warn)(`Failed to load font '${I.family}': '${V}'.`),z.disableFontFace=!0,V}}return}const F=z.createFontFaceRule();if(F){if(this.insertRule(F),this.isSyncFontLoadingSupported)return;await new Promise(I=>{const V=this._queueLoadingCallback(I);this._prepareFontLoadEvent(z,V)})}}get isFontLoadingAPISupported(){var F;const z=!!((F=this._document)!=null&&F.fonts);return(0,d.shadow)(this,"isFontLoadingAPISupported",z)}get isSyncFontLoadingSupported(){let z=!1;return(d.isNodeJS||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(z=!0),(0,d.shadow)(this,"isSyncFontLoadingSupported",z)}_queueLoadingCallback(z){function F(){for((0,d.assert)(!V.done,"completeRequest() cannot be called twice."),V.done=!0;I.length>0&&I[0].done;){const E=I.shift();setTimeout(E.callback,0)}}const{loadingRequests:I}=this,V={done:!1,complete:F,callback:z};return I.push(V),V}get _loadTestFont(){const z=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,d.shadow)(this,"_loadTestFont",z)}_prepareFontLoadEvent(z,F){function I(Tt,ot){return Tt.charCodeAt(ot)<<24|Tt.charCodeAt(ot+1)<<16|Tt.charCodeAt(ot+2)<<8|Tt.charCodeAt(ot+3)&255}function V(Tt,ot,nt,Mt){const It=Tt.substring(0,ot),Pt=Tt.substring(ot+nt);return It+Mt+Pt}let E,y;const D=this._document.createElement("canvas");D.width=1,D.height=1;const L=D.getContext("2d");let Z=0;function B(Tt,ot){if(++Z>30){(0,d.warn)("Load test font never loaded."),ot();return}if(L.font="30px "+Tt,L.fillText(".",0,20),L.getImageData(0,0,1,1).data[3]>0){ot();return}setTimeout(B.bind(null,Tt,ot))}const K=`lt${Date.now()}${this.loadTestFontId++}`;let k=this._loadTestFont;k=V(k,976,K.length,K);const O=16,C=1482184792;let P=I(k,O);for(E=0,y=K.length-3;E{bt.remove(),F.complete()})}}J=new WeakMap;class H{constructor(z,{disableFontFace:F=!1,ignoreErrors:I=!1,inspectFont:V=null}){this.compiledGlyphs=Object.create(null);for(const E in z)this[E]=z[E];this.disableFontFace=F===!0,this.ignoreErrors=I===!0,this._inspectFont=V}createNativeFontFace(){var F;if(!this.data||this.disableFontFace)return null;let z;if(!this.cssFontInfo)z=new FontFace(this.loadedName,this.data,{});else{const I={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(I.style=`oblique ${this.cssFontInfo.italicAngle}deg`),z=new FontFace(this.cssFontInfo.fontFamily,this.data,I)}return(F=this._inspectFont)==null||F.call(this,this),z}createFontFaceRule(){var V;if(!this.data||this.disableFontFace)return null;const z=(0,d.bytesToString)(this.data),F=`url(data:${this.mimetype};base64,${btoa(z)});`;let I;if(!this.cssFontInfo)I=`@font-face {font-family:"${this.loadedName}";src:${F}}`;else{let E=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(E+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),I=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${E}src:${F}}`}return(V=this._inspectFont)==null||V.call(this,this,F),I}getPathGenerator(z,F){if(this.compiledGlyphs[F]!==void 0)return this.compiledGlyphs[F];let I;try{I=z.get(this.loadedName+"_path_"+F)}catch(E){if(!this.ignoreErrors)throw E;(0,d.warn)(`getPathGenerator - ignoring character: "${E}".`)}if(!Array.isArray(I)||I.length===0)return this.compiledGlyphs[F]=function(E,y){};const V=[];for(let E=0,y=I.length;EO.bezierCurveTo(D,L,Z,B,K,k)),E+=6}break;case d.FontRenderOps.MOVE_TO:{const[D,L]=I.slice(E,E+2);V.push(Z=>Z.moveTo(D,L)),E+=2}break;case d.FontRenderOps.LINE_TO:{const[D,L]=I.slice(E,E+2);V.push(Z=>Z.lineTo(D,L)),E+=2}break;case d.FontRenderOps.QUADRATIC_CURVE_TO:{const[D,L,Z,B]=I.slice(E,E+4);V.push(K=>K.quadraticCurveTo(D,L,Z,B)),E+=4}break;case d.FontRenderOps.RESTORE:V.push(D=>D.restore());break;case d.FontRenderOps.SAVE:V.push(D=>D.save());break;case d.FontRenderOps.SCALE:(0,d.assert)(V.length===2,"Scale command is only valid at the third position.");break;case d.FontRenderOps.TRANSFORM:{const[D,L,Z,B,K,k]=I.slice(E,E+6);V.push(O=>O.transform(D,L,Z,B,K,k)),E+=6}break;case d.FontRenderOps.TRANSLATE:{const[D,L]=I.slice(E,E+2);V.push(Z=>Z.translate(D,L)),E+=2}break}return this.compiledGlyphs[F]=function(E,y){V[0](E),V[1](E),E.scale(y,-y);for(let D=2,L=V.length;D{var H,J;dt.d($t,{Metadata:()=>Q});var d=dt(292);class Q{constructor({parsedData:z,rawData:F}){_(this,H);_(this,J);w(this,H,z),w(this,J,F)}getRaw(){return t(this,J)}get(z){return t(this,H).get(z)??null}getAll(){return(0,d.objectFromMap)(t(this,H))}has(z){return t(this,H).has(z)}}H=new WeakMap,J=new WeakMap},457:(ie,$t,dt)=>{dt.d($t,{PDFNetworkStream:()=>F});var d=dt(292),Q=dt(490);const H=200,J=206;function At(E){const y=E.response;return typeof y!="string"?y:(0,d.stringToBytes)(y).buffer}class z{constructor(y,D={}){this.url=y,this.isHttp=/^https?:/i.test(y),this.httpHeaders=this.isHttp&&D.httpHeaders||Object.create(null),this.withCredentials=D.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(y,D,L){const Z={begin:y,end:D};for(const B in L)Z[B]=L[B];return this.request(Z)}requestFull(y){return this.request(y)}request(y){const D=new XMLHttpRequest,L=this.currXhrId++,Z=this.pendingRequests[L]={xhr:D};D.open("GET",this.url),D.withCredentials=this.withCredentials;for(const B in this.httpHeaders){const K=this.httpHeaders[B];K!==void 0&&D.setRequestHeader(B,K)}return this.isHttp&&"begin"in y&&"end"in y?(D.setRequestHeader("Range",`bytes=${y.begin}-${y.end-1}`),Z.expectedStatus=J):Z.expectedStatus=H,D.responseType="arraybuffer",y.onError&&(D.onerror=function(B){y.onError(D.status)}),D.onreadystatechange=this.onStateChange.bind(this,L),D.onprogress=this.onProgress.bind(this,L),Z.onHeadersReceived=y.onHeadersReceived,Z.onDone=y.onDone,Z.onError=y.onError,Z.onProgress=y.onProgress,D.send(null),L}onProgress(y,D){var Z;const L=this.pendingRequests[y];L&&((Z=L.onProgress)==null||Z.call(L,D))}onStateChange(y,D){var k,O,C;const L=this.pendingRequests[y];if(!L)return;const Z=L.xhr;if(Z.readyState>=2&&L.onHeadersReceived&&(L.onHeadersReceived(),delete L.onHeadersReceived),Z.readyState!==4||!(y in this.pendingRequests))return;if(delete this.pendingRequests[y],Z.status===0&&this.isHttp){(k=L.onError)==null||k.call(L,Z.status);return}const B=Z.status||H;if(!(B===H&&L.expectedStatus===J)&&B!==L.expectedStatus){(O=L.onError)==null||O.call(L,Z.status);return}const K=At(Z);if(B===J){const P=Z.getResponseHeader("Content-Range"),ht=/bytes (\d+)-(\d+)\/(\d+)/.exec(P);L.onDone({begin:parseInt(ht[1],10),chunk:K})}else K?L.onDone({begin:0,chunk:K}):(C=L.onError)==null||C.call(L,Z.status)}getRequestXhr(y){return this.pendingRequests[y].xhr}isPendingRequest(y){return y in this.pendingRequests}abortRequest(y){const D=this.pendingRequests[y].xhr;delete this.pendingRequests[y],D.abort()}}class F{constructor(y){this._source=y,this._manager=new z(y.url,{httpHeaders:y.httpHeaders,withCredentials:y.withCredentials}),this._rangeChunkSize=y.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(y){const D=this._rangeRequestReaders.indexOf(y);D>=0&&this._rangeRequestReaders.splice(D,1)}getFullReader(){return(0,d.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new I(this._manager,this._source),this._fullRequestReader}getRangeReader(y,D){const L=new V(this._manager,y,D);return L.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(L),L}cancelAllRequests(y){var D;(D=this._fullRequestReader)==null||D.cancel(y);for(const L of this._rangeRequestReaders.slice(0))L.cancel(y)}}class I{constructor(y,D){this._manager=y;const L={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=D.url,this._fullRequestId=y.requestFull(L),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=D.disableRange||!1,this._contentLength=D.length,this._rangeChunkSize=D.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const y=this._fullRequestId,D=this._manager.getRequestXhr(y),L=K=>D.getResponseHeader(K),{allowRangeRequests:Z,suggestedLength:B}=(0,Q.validateRangeRequestCapabilities)({getResponseHeader:L,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});Z&&(this._isRangeSupported=!0),this._contentLength=B||this._contentLength,this._filename=(0,Q.extractFilenameFromHeader)(L),this._isRangeSupported&&this._manager.abortRequest(y),this._headersReceivedCapability.resolve()}_onDone(y){if(y&&(this._requests.length>0?this._requests.shift().resolve({value:y.chunk,done:!1}):this._cachedChunks.push(y.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const D of this._requests)D.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(y){this._storedError=(0,Q.createResponseStatusError)(y,this._url),this._headersReceivedCapability.reject(this._storedError);for(const D of this._requests)D.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(y){var D;(D=this.onProgress)==null||D.call(this,{loaded:y.loaded,total:y.lengthComputable?y.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const y=Promise.withResolvers();return this._requests.push(y),y.promise}cancel(y){this._done=!0,this._headersReceivedCapability.reject(y);for(const D of this._requests)D.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class V{constructor(y,D,L){this._manager=y;const Z={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=y.url,this._requestId=y.requestRange(D,L,Z),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var y;(y=this.onClosed)==null||y.call(this,this)}_onDone(y){const D=y.chunk;this._requests.length>0?this._requests.shift().resolve({value:D,done:!1}):this._queuedChunk=D,this._done=!0;for(const L of this._requests)L.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(y){this._storedError=(0,Q.createResponseStatusError)(y,this._url);for(const D of this._requests)D.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(y){var D;this.isStreamingSupported||((D=this.onProgress)==null||D.call(this,{loaded:y.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const D=this._queuedChunk;return this._queuedChunk=null,{value:D,done:!1}}if(this._done)return{value:void 0,done:!0};const y=Promise.withResolvers();return this._requests.push(y),y.promise}cancel(y){this._done=!0;for(const D of this._requests)D.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},490:(ie,$t,dt)=>{dt.d($t,{createResponseStatusError:()=>z,extractFilenameFromHeader:()=>At,validateRangeRequestCapabilities:()=>J,validateResponseStatus:()=>F});var d=dt(292);function Q(I){let V=!0,E=y("filename\\*","i").exec(I);if(E){E=E[1];let O=B(E);return O=unescape(O),O=K(O),O=k(O),L(O)}if(E=Z(I),E){const O=k(E);return L(O)}if(E=y("filename","i").exec(I),E){E=E[1];let O=B(E);return O=k(O),L(O)}function y(O,C){return new RegExp("(?:^|;)\\s*"+O+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',C)}function D(O,C){if(O){if(!/^[\x00-\xFF]+$/.test(C))return C;try{const P=new TextDecoder(O,{fatal:!0}),ht=(0,d.stringToBytes)(C);C=P.decode(ht),V=!1}catch{}}return C}function L(O){return V&&/[\x80-\xff]/.test(O)&&(O=D("utf-8",O),V&&(O=D("iso-8859-1",O))),O}function Z(O){const C=[];let P;const ht=y("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(P=ht.exec(O))!==null;){let[,bt,Tt,ot]=P;if(bt=parseInt(bt,10),bt in C){if(bt===0)break;continue}C[bt]=[Tt,ot]}const st=[];for(let bt=0;bt{dt.a(ie,async(d,Q)=>{try{let At=function(C){const P=E.parse(C);return P.protocol==="file:"||P.host?P:/^[a-z]:[/\\]/i.test(C)?E.parse(`file:///${C}`):(P.host||(P.protocol="file:"),P)},z=function(C,P){return{protocol:C.protocol,auth:C.auth,host:C.hostname,port:C.port,path:C.path,method:"GET",headers:P}};dt.d($t,{PDFNodeStream:()=>D});var H=dt(292),J=dt(490);let F,I,V,E;H.isNodeJS&&(F=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])),I=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])),V=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])),E=await os(()=>import("./index-71ZZmCGz.js").then(async C=>(await C.__tla,C)).then(C=>C.a0),__vite__mapDeps([0,1])));const y=/^file:\/\/\/[a-zA-Z]:\//;class D{constructor(P){this.source=P,this.url=At(P.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&P.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var P;return((P=this._fullRequestReader)==null?void 0:P._loaded)??0}getFullReader(){return(0,H.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new k(this):new B(this),this._fullRequestReader}getRangeReader(P,ht){if(ht<=this._progressiveDataLength)return null;const st=this.isFsUrl?new O(this,P,ht):new K(this,P,ht);return this._rangeRequestReaders.push(st),st}cancelAllRequests(P){var ht;(ht=this._fullRequestReader)==null||ht.cancel(P);for(const st of this._rangeRequestReaders.slice(0))st.cancel(P)}}class L{constructor(P){this._url=P.url,this._done=!1,this._storedError=null,this.onProgress=null;const ht=P.source;this._contentLength=ht.length,this._loaded=0,this._filename=null,this._disableRange=ht.disableRange||!1,this._rangeChunkSize=ht.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!ht.disableStream,this._isRangeSupported=!ht.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var ht;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const P=this._readableStream.read();return P===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=P.length,(ht=this.onProgress)==null||ht.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){if(!this._readableStream){this._error(P);return}this._readableStream.destroy(P)}_error(P){this._storedError=P,this._readCapability.resolve()}_setReadableStream(P){this._readableStream=P,P.on("readable",()=>{this._readCapability.resolve()}),P.on("end",()=>{P.destroy(),this._done=!0,this._readCapability.resolve()}),P.on("error",ht=>{this._error(ht)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new H.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Z{constructor(P){this._url=P.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const ht=P.source;this._isStreamingSupported=!ht.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var ht;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const P=this._readableStream.read();return P===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=P.length,(ht=this.onProgress)==null||ht.call(this,{loaded:this._loaded}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){if(!this._readableStream){this._error(P);return}this._readableStream.destroy(P)}_error(P){this._storedError=P,this._readCapability.resolve()}_setReadableStream(P){this._readableStream=P,P.on("readable",()=>{this._readCapability.resolve()}),P.on("end",()=>{P.destroy(),this._done=!0,this._readCapability.resolve()}),P.on("error",ht=>{this._error(ht)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class B extends L{constructor(P){super(P);const ht=st=>{if(st.statusCode===404){const nt=new H.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=nt,this._headersCapability.reject(nt);return}this._headersCapability.resolve(),this._setReadableStream(st);const bt=nt=>this._readableStream.headers[nt.toLowerCase()],{allowRangeRequests:Tt,suggestedLength:ot}=(0,J.validateRangeRequestCapabilities)({getResponseHeader:bt,isHttp:P.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=Tt,this._contentLength=ot||this._contentLength,this._filename=(0,J.extractFilenameFromHeader)(bt)};this._request=null,this._url.protocol==="http:"?this._request=I.request(z(this._url,P.httpHeaders),ht):this._request=V.request(z(this._url,P.httpHeaders),ht),this._request.on("error",st=>{this._storedError=st,this._headersCapability.reject(st)}),this._request.end()}}class K extends Z{constructor(P,ht,st){super(P),this._httpHeaders={};for(const Tt in P.httpHeaders){const ot=P.httpHeaders[Tt];ot!==void 0&&(this._httpHeaders[Tt]=ot)}this._httpHeaders.Range=`bytes=${ht}-${st-1}`;const bt=Tt=>{if(Tt.statusCode===404){const ot=new H.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=ot;return}this._setReadableStream(Tt)};this._request=null,this._url.protocol==="http:"?this._request=I.request(z(this._url,this._httpHeaders),bt):this._request=V.request(z(this._url,this._httpHeaders),bt),this._request.on("error",Tt=>{this._storedError=Tt}),this._request.end()}}class k extends L{constructor(P){super(P);let ht=decodeURIComponent(this._url.path);y.test(this._url.href)&&(ht=ht.replace(/^\//,"")),F.promises.lstat(ht).then(st=>{this._contentLength=st.size,this._setReadableStream(F.createReadStream(ht)),this._headersCapability.resolve()},st=>{st.code==="ENOENT"&&(st=new H.MissingPDFException(`Missing PDF "${ht}".`)),this._storedError=st,this._headersCapability.reject(st)})}}class O extends Z{constructor(P,ht,st){super(P);let bt=decodeURIComponent(this._url.path);y.test(this._url.href)&&(bt=bt.replace(/^\//,"")),this._setReadableStream(F.createReadStream(bt,{start:ht,end:st-1}))}}Q()}catch(At){Q(At)}},1)},573:(ie,$t,dt)=>{dt.a(ie,async(d,Q)=>{try{dt.d($t,{NodeCMapReaderFactory:()=>y,NodeCanvasFactory:()=>E,NodeFilterFactory:()=>V,NodeStandardFontDataFactory:()=>D});var H=dt(583),J=dt(292);let At,z,F;if(J.isNodeJS){At=await os(()=>import("./index-71ZZmCGz.js").then(async L=>(await L.__tla,L)).then(L=>L.a0),__vite__mapDeps([0,1]));try{z=await os(()=>import("./index-71ZZmCGz.js").then(async L=>(await L.__tla,L)).then(L=>L.a0),__vite__mapDeps([0,1]))}catch{}try{F=await os(()=>import("./index-B9fWrEk-.js"),[])}catch{}}const I=function(L){return At.promises.readFile(L).then(Z=>new Uint8Array(Z))};class V extends H.BaseFilterFactory{}class E extends H.BaseCanvasFactory{_createCanvas(Z,B){return z.createCanvas(Z,B)}}class y extends H.BaseCMapReaderFactory{_fetchData(Z,B){return I(Z).then(K=>({cMapData:K,compressionType:B}))}}class D extends H.BaseStandardFontDataFactory{_fetchData(Z){return I(Z)}}Q()}catch(At){Q(At)}},1)},626:(ie,$t,dt)=>{var z,F,I,V,E,y,D,L,Z,dn;dt.d($t,{OptionalContentConfig:()=>At});var d=dt(292),Q=dt(651);const H=Symbol("INTERNAL");class J{constructor(k,{name:O,intent:C,usage:P}){_(this,z,!1);_(this,F,!1);_(this,I,!1);_(this,V,!0);w(this,z,!!(k&d.RenderingIntentFlag.DISPLAY)),w(this,F,!!(k&d.RenderingIntentFlag.PRINT)),this.name=O,this.intent=C,this.usage=P}get visible(){if(t(this,I))return t(this,V);if(!t(this,V))return!1;const{print:k,view:O}=this.usage;return t(this,z)?(O==null?void 0:O.viewState)!=="OFF":t(this,F)?(k==null?void 0:k.printState)!=="OFF":!0}_setVisible(k,O,C=!1){k!==H&&(0,d.unreachable)("Internal method `_setVisible` called."),w(this,I,C),w(this,V,O)}}z=new WeakMap,F=new WeakMap,I=new WeakMap,V=new WeakMap;class At{constructor(k,O=d.RenderingIntentFlag.DISPLAY){_(this,Z);_(this,E,null);_(this,y,new Map);_(this,D,null);_(this,L,null);if(this.renderingIntent=O,this.name=null,this.creator=null,k!==null){this.name=k.name,this.creator=k.creator,w(this,L,k.order);for(const C of k.groups)t(this,y).set(C.id,new J(O,C));if(k.baseState==="OFF")for(const C of t(this,y).values())C._setVisible(H,!1);for(const C of k.on)t(this,y).get(C)._setVisible(H,!0);for(const C of k.off)t(this,y).get(C)._setVisible(H,!1);w(this,D,this.getHash())}}isVisible(k){if(t(this,y).size===0)return!0;if(!k)return(0,d.info)("Optional content group not defined."),!0;if(k.type==="OCG")return t(this,y).has(k.id)?t(this,y).get(k.id).visible:((0,d.warn)(`Optional content group not found: ${k.id}`),!0);if(k.type==="OCMD"){if(k.expression)return b(this,Z,dn).call(this,k.expression);if(!k.policy||k.policy==="AnyOn"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(t(this,y).get(O).visible)return!0}return!1}else if(k.policy==="AllOn"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(!t(this,y).get(O).visible)return!1}return!0}else if(k.policy==="AnyOff"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(!t(this,y).get(O).visible)return!0}return!1}else if(k.policy==="AllOff"){for(const O of k.ids){if(!t(this,y).has(O))return(0,d.warn)(`Optional content group not found: ${O}`),!0;if(t(this,y).get(O).visible)return!1}return!0}return(0,d.warn)(`Unknown optional content policy ${k.policy}.`),!0}return(0,d.warn)(`Unknown group type ${k.type}.`),!0}setVisibility(k,O=!0){const C=t(this,y).get(k);if(!C){(0,d.warn)(`Optional content group not found: ${k}`);return}C._setVisible(H,!!O,!0),w(this,E,null)}setOCGState({state:k,preserveRB:O}){let C;for(const P of k){switch(P){case"ON":case"OFF":case"Toggle":C=P;continue}const ht=t(this,y).get(P);if(ht)switch(C){case"ON":ht._setVisible(H,!0);break;case"OFF":ht._setVisible(H,!1);break;case"Toggle":ht._setVisible(H,!ht.visible);break}}w(this,E,null)}get hasInitialVisibility(){return t(this,D)===null||this.getHash()===t(this,D)}getOrder(){return t(this,y).size?t(this,L)?t(this,L).slice():[...t(this,y).keys()]:null}getGroups(){return t(this,y).size>0?(0,d.objectFromMap)(t(this,y)):null}getGroup(k){return t(this,y).get(k)||null}getHash(){if(t(this,E)!==null)return t(this,E);const k=new Q.MurmurHash3_64;for(const[O,C]of t(this,y))k.update(`${O}:${C.visible}`);return w(this,E,k.hexdigest())}}E=new WeakMap,y=new WeakMap,D=new WeakMap,L=new WeakMap,Z=new WeakSet,dn=function(k){const O=k.length;if(O<2)return!0;const C=k[0];for(let P=1;P{dt.d($t,{cleanupTextLayer:()=>V,renderTextLayer:()=>B,updateTextLayer:()=>K});var d=dt(292),Q=dt(419);const H=1e5,J=30,At=.8,z=new Map;let F=null;function I(){if(!F){const k=document.createElement("canvas");k.className="hiddenCanvasElement",document.body.append(k),F=k.getContext("2d",{alpha:!1})}return F}function V(){F==null||F.canvas.remove(),F=null}function E(k){const O=z.get(k);if(O)return O;const C=I(),P=C.font;C.canvas.width=C.canvas.height=J,C.font=`${J}px ${k}`;const ht=C.measureText("");let st=ht.fontBoundingBoxAscent,bt=Math.abs(ht.fontBoundingBoxDescent);if(st){const ot=st/(st+bt);return z.set(k,ot),C.canvas.width=C.canvas.height=0,C.font=P,ot}C.strokeStyle="red",C.clearRect(0,0,J,J),C.strokeText("g",0,0);let Tt=C.getImageData(0,0,J,J).data;bt=0;for(let ot=Tt.length-1-3;ot>=0;ot-=4)if(Tt[ot]>0){bt=Math.ceil(ot/4/J);break}C.clearRect(0,0,J,J),C.strokeText("A",0,J),Tt=C.getImageData(0,0,J,J).data,st=0;for(let ot=0,nt=Tt.length;ot0){st=J-Math.floor(ot/4/J);break}if(C.canvas.width=C.canvas.height=0,C.font=P,st){const ot=st/(st+bt);return z.set(k,ot),ot}return z.set(k,At),At}function y(k,O,C){const P=document.createElement("span"),ht={angle:0,canvasWidth:0,hasText:O.str!=="",hasEOL:O.hasEOL,fontSize:0};k._textDivs.push(P);const st=d.Util.transform(k._transform,O.transform);let bt=Math.atan2(st[1],st[0]);const Tt=C[O.fontName];Tt.vertical&&(bt+=Math.PI/2);const ot=k._fontInspectorEnabled&&Tt.fontSubstitution||Tt.fontFamily,nt=Math.hypot(st[2],st[3]),Mt=nt*E(ot);let It,Pt;bt===0?(It=st[4],Pt=st[5]-Mt):(It=st[4]+Mt*Math.sin(bt),Pt=st[5]-Mt*Math.cos(bt));const Xt="calc(var(--scale-factor)*",ae=P.style;k._container===k._rootContainer?(ae.left=`${(100*It/k._pageWidth).toFixed(2)}%`,ae.top=`${(100*Pt/k._pageHeight).toFixed(2)}%`):(ae.left=`${Xt}${It.toFixed(2)}px)`,ae.top=`${Xt}${Pt.toFixed(2)}px)`),ae.fontSize=`${Xt}${nt.toFixed(2)}px)`,ae.fontFamily=ot,ht.fontSize=nt,P.setAttribute("role","presentation"),P.textContent=O.str,P.dir=O.dir,k._fontInspectorEnabled&&(P.dataset.fontName=Tt.fontSubstitutionLoadedName||O.fontName),bt!==0&&(ht.angle=bt*(180/Math.PI));let Jt=!1;if(O.str.length>1)Jt=!0;else if(O.str!==" "&&O.transform[0]!==O.transform[3]){const re=Math.abs(O.transform[0]),oe=Math.abs(O.transform[3]);re!==oe&&Math.max(re,oe)/Math.min(re,oe)>1.5&&(Jt=!0)}Jt&&(ht.canvasWidth=Tt.vertical?O.height:O.width),k._textDivProperties.set(P,ht),k._isReadableStream&&k._layoutText(P)}function D(k){const{div:O,scale:C,properties:P,ctx:ht,prevFontSize:st,prevFontFamily:bt}=k,{style:Tt}=O;let ot="";if(P.canvasWidth!==0&&P.hasText){const{fontFamily:nt}=Tt,{canvasWidth:Mt,fontSize:It}=P;(st!==It||bt!==nt)&&(ht.font=`${It*C}px ${nt}`,k.prevFontSize=It,k.prevFontFamily=nt);const{width:Pt}=ht.measureText(O.textContent);Pt>0&&(ot=`scaleX(${Mt*C/Pt})`)}P.angle!==0&&(ot=`rotate(${P.angle}deg) ${ot}`),ot.length>0&&(Tt.transform=ot)}function L(k){if(k._canceled)return;const O=k._textDivs,C=k._capability;if(O.length>H){C.resolve();return}if(!k._isReadableStream)for(const P of O)k._layoutText(P);C.resolve()}class Z{constructor({textContentSource:O,container:C,viewport:P,textDivs:ht,textDivProperties:st,textContentItemsStr:bt}){var It;this._textContentSource=O,this._isReadableStream=O instanceof ReadableStream,this._container=this._rootContainer=C,this._textDivs=ht||[],this._textContentItemsStr=bt||[],this._fontInspectorEnabled=!!((It=globalThis.FontInspector)!=null&&It.enabled),this._reader=null,this._textDivProperties=st||new WeakMap,this._canceled=!1,this._capability=Promise.withResolvers(),this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:P.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:I()};const{pageWidth:Tt,pageHeight:ot,pageX:nt,pageY:Mt}=P.rawDims;this._transform=[1,0,0,-1,-nt,Mt+ot],this._pageWidth=Tt,this._pageHeight=ot,(0,Q.setLayerDimensions)(C,P),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new d.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new d.AbortException("TextLayer task cancelled."))}_processItems(O,C){for(const P of O){if(P.str===void 0){if(P.type==="beginMarkedContentProps"||P.type==="beginMarkedContent"){const ht=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),P.id!==null&&this._container.setAttribute("id",`${P.id}`),ht.append(this._container)}else P.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(P.str),y(this,P,C)}}_layoutText(O){const C=this._layoutTextParams.properties=this._textDivProperties.get(O);if(this._layoutTextParams.div=O,D(this._layoutTextParams),C.hasText&&this._container.append(O),C.hasEOL){const P=document.createElement("br");P.setAttribute("role","presentation"),this._container.append(P)}}_render(){const{promise:O,resolve:C,reject:P}=Promise.withResolvers();let ht=Object.create(null);if(this._isReadableStream){const st=()=>{this._reader.read().then(({value:bt,done:Tt})=>{if(Tt){C();return}Object.assign(ht,bt.styles),this._processItems(bt.items,ht),st()},P)};this._reader=this._textContentSource.getReader(),st()}else if(this._textContentSource){const{items:st,styles:bt}=this._textContentSource;this._processItems(st,bt),C()}else throw new Error('No "textContentSource" parameter specified.');O.then(()=>{ht=null,L(this)},this._capability.reject)}}function B(k){const O=new Z(k);return O._render(),O}function K({container:k,viewport:O,textDivs:C,textDivProperties:P,mustRotate:ht=!0,mustRescale:st=!0}){if(ht&&(0,Q.setLayerDimensions)(k,{rotation:O.rotation}),st){const bt=I(),Tt={prevFontSize:null,prevFontFamily:null,div:null,scale:O.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:bt};for(const ot of C)Tt.properties=P.get(ot),Tt.div=ot,D(Tt)}}},585:(ie,$t,dt)=>{dt.d($t,{PDFDataTransportStream:()=>H});var d=dt(292),Q=dt(419);class H{constructor(F,{disableRange:I=!1,disableStream:V=!1}){(0,d.assert)(F,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:E,initialData:y,progressiveDone:D,contentDispositionFilename:L}=F;if(this._queuedChunks=[],this._progressiveDone=D,this._contentDispositionFilename=L,(y==null?void 0:y.length)>0){const Z=y instanceof Uint8Array&&y.byteLength===y.buffer.byteLength?y.buffer:new Uint8Array(y).buffer;this._queuedChunks.push(Z)}this._pdfDataRangeTransport=F,this._isStreamingSupported=!V,this._isRangeSupported=!I,this._contentLength=E,this._fullRequestReader=null,this._rangeReaders=[],F.addRangeListener((Z,B)=>{this._onReceiveData({begin:Z,chunk:B})}),F.addProgressListener((Z,B)=>{this._onProgress({loaded:Z,total:B})}),F.addProgressiveReadListener(Z=>{this._onReceiveData({chunk:Z})}),F.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),F.transportReady()}_onReceiveData({begin:F,chunk:I}){const V=I instanceof Uint8Array&&I.byteLength===I.buffer.byteLength?I.buffer:new Uint8Array(I).buffer;if(F===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(V):this._queuedChunks.push(V);else{const E=this._rangeReaders.some(function(y){return y._begin!==F?!1:(y._enqueue(V),!0)});(0,d.assert)(E,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var F;return((F=this._fullRequestReader)==null?void 0:F._loaded)??0}_onProgress(F){var I,V,E,y;F.total===void 0?(V=(I=this._rangeReaders[0])==null?void 0:I.onProgress)==null||V.call(I,{loaded:F.loaded}):(y=(E=this._fullRequestReader)==null?void 0:E.onProgress)==null||y.call(E,{loaded:F.loaded,total:F.total})}_onProgressiveDone(){var F;(F=this._fullRequestReader)==null||F.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(F){const I=this._rangeReaders.indexOf(F);I>=0&&this._rangeReaders.splice(I,1)}getFullReader(){(0,d.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const F=this._queuedChunks;return this._queuedChunks=null,new J(this,F,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(F,I){if(I<=this._progressiveDataLength)return null;const V=new At(this,F,I);return this._pdfDataRangeTransport.requestDataRange(F,I),this._rangeReaders.push(V),V}cancelAllRequests(F){var I;(I=this._fullRequestReader)==null||I.cancel(F);for(const V of this._rangeReaders.slice(0))V.cancel(F);this._pdfDataRangeTransport.abort()}}class J{constructor(F,I,V=!1,E=null){this._stream=F,this._done=V||!1,this._filename=(0,Q.isPdfFile)(E)?E:null,this._queuedChunks=I||[],this._loaded=0;for(const y of this._queuedChunks)this._loaded+=y.byteLength;this._requests=[],this._headersReady=Promise.resolve(),F._fullRequestReader=this,this.onProgress=null}_enqueue(F){this._done||(this._requests.length>0?this._requests.shift().resolve({value:F,done:!1}):this._queuedChunks.push(F),this._loaded+=F.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const F=Promise.withResolvers();return this._requests.push(F),F.promise}cancel(F){this._done=!0;for(const I of this._requests)I.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class At{constructor(F,I,V){this._stream=F,this._begin=I,this._end=V,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(F){if(!this._done){if(this._requests.length===0)this._queuedChunk=F;else{this._requests.shift().resolve({value:F,done:!1});for(const I of this._requests)I.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const I=this._queuedChunk;return this._queuedChunk=null,{value:I,done:!1}}if(this._done)return{value:void 0,done:!0};const F=Promise.withResolvers();return this._requests.push(F),F.promise}cancel(F){this._done=!0;for(const I of this._requests)I.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},164:(ie,$t,dt)=>{var Q,H;dt.d($t,{GlobalWorkerOptions:()=>d});class d{static get workerPort(){return t(this,Q)}static set workerPort(At){if(!(typeof Worker<"u"&&At instanceof Worker)&&At!==null)throw new Error("Invalid `workerPort` type.");w(this,Q,At)}static get workerSrc(){return t(this,H)}static set workerSrc(At){if(typeof At!="string")throw new Error("Invalid `workerSrc` type.");w(this,H,At)}}Q=new WeakMap,H=new WeakMap,_(d,Q,null),_(d,H,"")},284:(ie,$t,dt)=>{dt.d($t,{XfaLayer:()=>Q});var d=dt(50);class Q{static setupStorage(J,At,z,F,I){const V=F.getValue(At,{value:null});switch(z.name){case"textarea":if(V.value!==null&&(J.textContent=V.value),I==="print")break;J.addEventListener("input",E=>{F.setValue(At,{value:E.target.value})});break;case"input":if(z.attributes.type==="radio"||z.attributes.type==="checkbox"){if(V.value===z.attributes.xfaOn?J.setAttribute("checked",!0):V.value===z.attributes.xfaOff&&J.removeAttribute("checked"),I==="print")break;J.addEventListener("change",E=>{F.setValue(At,{value:E.target.checked?E.target.getAttribute("xfaOn"):E.target.getAttribute("xfaOff")})})}else{if(V.value!==null&&J.setAttribute("value",V.value),I==="print")break;J.addEventListener("input",E=>{F.setValue(At,{value:E.target.value})})}break;case"select":if(V.value!==null){J.setAttribute("value",V.value);for(const E of z.children)E.attributes.value===V.value?E.attributes.selected=!0:E.attributes.hasOwnProperty("selected")&&delete E.attributes.selected}J.addEventListener("input",E=>{const y=E.target.options,D=y.selectedIndex===-1?"":y[y.selectedIndex].value;F.setValue(At,{value:D})});break}}static setAttributes({html:J,element:At,storage:z=null,intent:F,linkService:I}){const{attributes:V}=At,E=J instanceof HTMLAnchorElement;V.type==="radio"&&(V.name=`${V.name}-${F}`);for(const[y,D]of Object.entries(V))if(D!=null)switch(y){case"class":D.length&&J.setAttribute(y,D.join(" "));break;case"dataId":break;case"id":J.setAttribute("data-element-id",D);break;case"style":Object.assign(J.style,D);break;case"textContent":J.textContent=D;break;default:(!E||y!=="href"&&y!=="newWindow")&&J.setAttribute(y,D)}E&&I.addLinkAttributes(J,V.href,V.newWindow),z&&V.dataId&&this.setupStorage(J,V.dataId,At,z)}static render(J){var Z,B;const At=J.annotationStorage,z=J.linkService,F=J.xfaHtml,I=J.intent||"display",V=document.createElement(F.name);F.attributes&&this.setAttributes({html:V,element:F,intent:I,linkService:z});const E=I!=="richText",y=J.div;if(y.append(V),J.viewport){const K=`matrix(${J.viewport.transform.join(",")})`;y.style.transform=K}E&&y.setAttribute("class","xfaLayer xfaFont");const D=[];if(F.children.length===0){if(F.value){const K=document.createTextNode(F.value);V.append(K),E&&d.XfaText.shouldBuildText(F.name)&&D.push(K)}return{textDivs:D}}const L=[[F,-1,V]];for(;L.length>0;){const[K,k,O]=L.at(-1);if(k+1===K.children.length){L.pop();continue}const C=K.children[++L.at(-1)[1]];if(C===null)continue;const{name:P}=C;if(P==="#text"){const st=document.createTextNode(C.value);D.push(st),O.append(st);continue}const ht=(Z=C==null?void 0:C.attributes)!=null&&Z.xmlns?document.createElementNS(C.attributes.xmlns,P):document.createElement(P);if(O.append(ht),C.attributes&&this.setAttributes({html:ht,element:C,storage:At,intent:I,linkService:z}),((B=C.children)==null?void 0:B.length)>0)L.push([C,-1,ht]);else if(C.value){const st=document.createTextNode(C.value);E&&d.XfaText.shouldBuildText(P)&&D.push(st),ht.append(st)}}for(const K of y.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))K.setAttribute("readOnly",!0);return{textDivs:D}}static update(J){const At=`matrix(${J.viewport.transform.join(",")})`;J.div.style.transform=At,J.div.hidden=!1}}},50:(ie,$t,dt)=>{dt.d($t,{XfaText:()=>d});class d{static textContent(H){const J=[],At={items:J,styles:Object.create(null)};function z(F){var E;if(!F)return;let I=null;const V=F.name;if(V==="#text")I=F.value;else if(d.shouldBuildText(V))(E=F==null?void 0:F.attributes)!=null&&E.textContent?I=F.attributes.textContent:F.value&&(I=F.value);else return;if(I!==null&&J.push({str:I}),!!F.children)for(const y of F.children)z(y)}return z(H),At}static shouldBuildText(H){return!(H==="textarea"||H==="input"||H==="option"||H==="select")}}},228:(ie,$t,dt)=>{dt.a(ie,async(d,Q)=>{try{dt.d($t,{AbortException:()=>H.AbortException,AnnotationEditorLayer:()=>F.AnnotationEditorLayer,AnnotationEditorParamsType:()=>H.AnnotationEditorParamsType,AnnotationEditorType:()=>H.AnnotationEditorType,AnnotationEditorUIManager:()=>I.AnnotationEditorUIManager,AnnotationLayer:()=>V.AnnotationLayer,AnnotationMode:()=>H.AnnotationMode,CMapCompressionType:()=>H.CMapCompressionType,ColorPicker:()=>E.ColorPicker,DOMSVGFactory:()=>At.DOMSVGFactory,DrawLayer:()=>y.DrawLayer,FeatureTest:()=>H.FeatureTest,GlobalWorkerOptions:()=>D.GlobalWorkerOptions,ImageKind:()=>H.ImageKind,InvalidPDFException:()=>H.InvalidPDFException,MissingPDFException:()=>H.MissingPDFException,OPS:()=>H.OPS,Outliner:()=>L.Outliner,PDFDataRangeTransport:()=>J.PDFDataRangeTransport,PDFDateString:()=>At.PDFDateString,PDFWorker:()=>J.PDFWorker,PasswordResponses:()=>H.PasswordResponses,PermissionFlag:()=>H.PermissionFlag,PixelsPerInch:()=>At.PixelsPerInch,RenderingCancelledException:()=>At.RenderingCancelledException,UnexpectedResponseException:()=>H.UnexpectedResponseException,Util:()=>H.Util,VerbosityLevel:()=>H.VerbosityLevel,XfaLayer:()=>Z.XfaLayer,build:()=>J.build,createValidAbsoluteUrl:()=>H.createValidAbsoluteUrl,fetchData:()=>At.fetchData,getDocument:()=>J.getDocument,getFilenameFromUrl:()=>At.getFilenameFromUrl,getPdfFilenameFromUrl:()=>At.getPdfFilenameFromUrl,getXfaPageViewport:()=>At.getXfaPageViewport,isDataScheme:()=>At.isDataScheme,isPdfFile:()=>At.isPdfFile,noContextMenu:()=>At.noContextMenu,normalizeUnicode:()=>H.normalizeUnicode,renderTextLayer:()=>z.renderTextLayer,setLayerDimensions:()=>At.setLayerDimensions,shadow:()=>H.shadow,updateTextLayer:()=>z.updateTextLayer,version:()=>J.version});var H=dt(292),J=dt(831),At=dt(419),z=dt(814),F=dt(731),I=dt(830),V=dt(976),E=dt(259),y=dt(47),D=dt(164),L=dt(61),Z=dt(284),B=d([J]);J=(B.then?(await B)():B)[0];const K="4.2.67",k="49b388101";Q()}catch(K){Q(K)}})},178:(ie,$t,dt)=>{var z,Aa,ba,ci;dt.d($t,{MessageHandler:()=>At});var d=dt(292);const Q={UNKNOWN:0,DATA:1,ERROR:2},H={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function J(E){switch(E instanceof Error||typeof E=="object"&&E!==null||(0,d.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),E.name){case"AbortException":return new d.AbortException(E.message);case"MissingPDFException":return new d.MissingPDFException(E.message);case"PasswordException":return new d.PasswordException(E.message,E.code);case"UnexpectedResponseException":return new d.UnexpectedResponseException(E.message,E.status);case"UnknownErrorException":return new d.UnknownErrorException(E.message,E.details);default:return new d.UnknownErrorException(E.message,E.toString())}}class At{constructor(y,D,L){_(this,z);this.sourceName=y,this.targetName=D,this.comObj=L,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=Z=>{const B=Z.data;if(B.targetName!==this.sourceName)return;if(B.stream){b(this,z,ba).call(this,B);return}if(B.callback){const k=B.callbackId,O=this.callbackCapabilities[k];if(!O)throw new Error(`Cannot resolve callback ${k}`);if(delete this.callbackCapabilities[k],B.callback===Q.DATA)O.resolve(B.data);else if(B.callback===Q.ERROR)O.reject(J(B.reason));else throw new Error("Unexpected callback case");return}const K=this.actionHandler[B.action];if(!K)throw new Error(`Unknown action from worker: ${B.action}`);if(B.callbackId){const k=this.sourceName,O=B.sourceName;new Promise(function(C){C(K(B.data))}).then(function(C){L.postMessage({sourceName:k,targetName:O,callback:Q.DATA,callbackId:B.callbackId,data:C})},function(C){L.postMessage({sourceName:k,targetName:O,callback:Q.ERROR,callbackId:B.callbackId,reason:J(C)})});return}if(B.streamId){b(this,z,Aa).call(this,B);return}K(B.data)},L.addEventListener("message",this._onComObjOnMessage)}on(y,D){const L=this.actionHandler;if(L[y])throw new Error(`There is already an actionName called "${y}"`);L[y]=D}send(y,D,L){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:y,data:D},L)}sendWithPromise(y,D,L){const Z=this.callbackId++,B=Promise.withResolvers();this.callbackCapabilities[Z]=B;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:y,callbackId:Z,data:D},L)}catch(K){B.reject(K)}return B.promise}sendWithStream(y,D,L,Z){const B=this.streamId++,K=this.sourceName,k=this.targetName,O=this.comObj;return new ReadableStream({start:C=>{const P=Promise.withResolvers();return this.streamControllers[B]={controller:C,startCall:P,pullCall:null,cancelCall:null,isClosed:!1},O.postMessage({sourceName:K,targetName:k,action:y,streamId:B,data:D,desiredSize:C.desiredSize},Z),P.promise},pull:C=>{const P=Promise.withResolvers();return this.streamControllers[B].pullCall=P,O.postMessage({sourceName:K,targetName:k,stream:H.PULL,streamId:B,desiredSize:C.desiredSize}),P.promise},cancel:C=>{(0,d.assert)(C instanceof Error,"cancel must have a valid reason");const P=Promise.withResolvers();return this.streamControllers[B].cancelCall=P,this.streamControllers[B].isClosed=!0,O.postMessage({sourceName:K,targetName:k,stream:H.CANCEL,streamId:B,reason:J(C)}),P.promise}},L)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}z=new WeakSet,Aa=function(y){const D=y.streamId,L=this.sourceName,Z=y.sourceName,B=this.comObj,K=this,k=this.actionHandler[y.action],O={enqueue(C,P=1,ht){if(this.isCancelled)return;const st=this.desiredSize;this.desiredSize-=P,st>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),B.postMessage({sourceName:L,targetName:Z,stream:H.ENQUEUE,streamId:D,chunk:C},ht)},close(){this.isCancelled||(this.isCancelled=!0,B.postMessage({sourceName:L,targetName:Z,stream:H.CLOSE,streamId:D}),delete K.streamSinks[D])},error(C){(0,d.assert)(C instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,B.postMessage({sourceName:L,targetName:Z,stream:H.ERROR,streamId:D,reason:J(C)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:y.desiredSize,ready:null};O.sinkCapability.resolve(),O.ready=O.sinkCapability.promise,this.streamSinks[D]=O,new Promise(function(C){C(k(y.data,O))}).then(function(){B.postMessage({sourceName:L,targetName:Z,stream:H.START_COMPLETE,streamId:D,success:!0})},function(C){B.postMessage({sourceName:L,targetName:Z,stream:H.START_COMPLETE,streamId:D,reason:J(C)})})},ba=function(y){const D=y.streamId,L=this.sourceName,Z=y.sourceName,B=this.comObj,K=this.streamControllers[D],k=this.streamSinks[D];switch(y.stream){case H.START_COMPLETE:y.success?K.startCall.resolve():K.startCall.reject(J(y.reason));break;case H.PULL_COMPLETE:y.success?K.pullCall.resolve():K.pullCall.reject(J(y.reason));break;case H.PULL:if(!k){B.postMessage({sourceName:L,targetName:Z,stream:H.PULL_COMPLETE,streamId:D,success:!0});break}k.desiredSize<=0&&y.desiredSize>0&&k.sinkCapability.resolve(),k.desiredSize=y.desiredSize,new Promise(function(O){var C;O((C=k.onPull)==null?void 0:C.call(k))}).then(function(){B.postMessage({sourceName:L,targetName:Z,stream:H.PULL_COMPLETE,streamId:D,success:!0})},function(O){B.postMessage({sourceName:L,targetName:Z,stream:H.PULL_COMPLETE,streamId:D,reason:J(O)})});break;case H.ENQUEUE:if((0,d.assert)(K,"enqueue should have stream controller"),K.isClosed)break;K.controller.enqueue(y.chunk);break;case H.CLOSE:if((0,d.assert)(K,"close should have stream controller"),K.isClosed)break;K.isClosed=!0,K.controller.close(),b(this,z,ci).call(this,K,D);break;case H.ERROR:(0,d.assert)(K,"error should have stream controller"),K.controller.error(J(y.reason)),b(this,z,ci).call(this,K,D);break;case H.CANCEL_COMPLETE:y.success?K.cancelCall.resolve():K.cancelCall.reject(J(y.reason)),b(this,z,ci).call(this,K,D);break;case H.CANCEL:if(!k)break;new Promise(function(O){var C;O((C=k.onCancel)==null?void 0:C.call(k,J(y.reason)))}).then(function(){B.postMessage({sourceName:L,targetName:Z,stream:H.CANCEL_COMPLETE,streamId:D,success:!0})},function(O){B.postMessage({sourceName:L,targetName:Z,stream:H.CANCEL_COMPLETE,streamId:D,reason:J(O)})}),k.sinkCapability.reject(J(y.reason)),k.isCancelled=!0,delete this.streamSinks[D];break;default:throw new Error("Unexpected stream case")}},ci=async function(y,D){var L,Z,B;await Promise.allSettled([(L=y.startCall)==null?void 0:L.promise,(Z=y.pullCall)==null?void 0:Z.promise,(B=y.cancelCall)==null?void 0:B.promise]),delete this.streamControllers[D]}},651:(ie,$t,dt)=>{dt.d($t,{MurmurHash3_64:()=>J});const d=3285377520,Q=4294901760,H=65535;class J{constructor(z){this.h1=z?z&4294967295:d,this.h2=z?z&4294967295:d}update(z){let F,I;if(typeof z=="string"){F=new Uint8Array(z.length*2),I=0;for(let P=0,ht=z.length;P>>8,F[I++]=st&255)}}else if(ArrayBuffer.isView(z))F=z.slice(),I=F.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const V=I>>2,E=I-V*4,y=new Uint32Array(F.buffer,0,V);let D=0,L=0,Z=this.h1,B=this.h2;const K=3432918353,k=461845907,O=K&H,C=k&H;for(let P=0;P>>17,D=D*k&Q|D*C&H,Z^=D,Z=Z<<13|Z>>>19,Z=Z*5+3864292196):(L=y[P],L=L*K&Q|L*O&H,L=L<<15|L>>>17,L=L*k&Q|L*C&H,B^=L,B=B<<13|B>>>19,B=B*5+3864292196);switch(D=0,E){case 3:D^=F[V*4+2]<<16;case 2:D^=F[V*4+1]<<8;case 1:D^=F[V*4],D=D*K&Q|D*O&H,D=D<<15|D>>>17,D=D*k&Q|D*C&H,V&1?Z^=D:B^=D}this.h1=Z,this.h2=B}hexdigest(){let z=this.h1,F=this.h2;return z^=F>>>1,z=z*3981806797&Q|z*36045&H,F=F*4283543511&Q|((F<<16|z>>>16)*2950163797&Q)>>>16,z^=F>>>1,z=z*444984403&Q|z*60499&H,F=F*3301882366&Q|((F<<16|z>>>16)*3120437893&Q)>>>16,z^=F>>>1,(z>>>0).toString(16).padStart(8,"0")+(F>>>0).toString(16).padStart(8,"0")}}},292:(ie,$t,dt)=>{var u,di,un;dt.d($t,{AbortException:()=>ue,AnnotationBorderStyleType:()=>B,AnnotationEditorParamsType:()=>E,AnnotationEditorPrefix:()=>I,AnnotationEditorType:()=>V,AnnotationMode:()=>F,AnnotationPrefix:()=>l,AnnotationType:()=>Z,BaseException:()=>Xt,CMapCompressionType:()=>k,FONT_IDENTITY_MATRIX:()=>H,FeatureTest:()=>Nt,FontRenderOps:()=>g,FormatError:()=>Qt,IDENTITY_MATRIX:()=>Q,ImageKind:()=>L,InvalidPDFException:()=>re,LINE_FACTOR:()=>At,MAX_IMAGE_SIZE_TO_CACHE:()=>J,MissingPDFException:()=>oe,OPS:()=>O,PasswordException:()=>ae,PasswordResponses:()=>C,PermissionFlag:()=>y,RenderingIntentFlag:()=>z,TextRenderingMode:()=>D,UnexpectedResponseException:()=>Rt,UnknownErrorException:()=>Jt,Util:()=>pt,VerbosityLevel:()=>K,assert:()=>nt,bytesToString:()=>Ae,createValidAbsoluteUrl:()=>It,getUuid:()=>h,getVerbosityLevel:()=>st,info:()=>bt,isNodeJS:()=>d,normalizeUnicode:()=>a,objectFromMap:()=>ee,setVerbosityLevel:()=>ht,shadow:()=>Pt,string32:()=>le,stringToBytes:()=>Bt,unreachable:()=>ot,warn:()=>Tt});const d=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Q=[1,0,0,1,0,0],H=[.001,0,0,.001,0,0],J=1e7,At=1.35,z={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},F={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},I="pdfjs_internal_editor_",V={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},E={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},y={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},D={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},L={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Z={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},B={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},K={ERRORS:0,WARNINGS:1,INFOS:5},k={NONE:0,BINARY:1},O={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},C={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let P=K.WARNINGS;function ht(e){Number.isInteger(e)&&(P=e)}function st(){return P}function bt(e){P>=K.INFOS&&console.log(`Info: ${e}`)}function Tt(e){P>=K.WARNINGS&&console.log(`Warning: ${e}`)}function ot(e){throw new Error(e)}function nt(e,i){e||ot(i)}function Mt(e){switch(e==null?void 0:e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function It(e,i=null,o=null){var m;if(!e)return null;try{if(o&&typeof e=="string"&&(o.addDefaultProtocol&&e.startsWith("www.")&&((m=e.match(/\./g))==null?void 0:m.length)>=2&&(e=`http://${e}`),o.tryConvertEncoding))try{e=S(e)}catch{}const M=i?new URL(e,i):new URL(e);if(Mt(M))return M}catch{}return null}function Pt(e,i,o,m=!1){return Object.defineProperty(e,i,{value:o,enumerable:!m,configurable:!0,writable:!1}),o}const Xt=function(){function e(i,o){this.constructor===e&&ot("Cannot initialize BaseException."),this.message=i,this.name=o}return e.prototype=new Error,e.constructor=e,e}();class ae extends Xt{constructor(i,o){super(i,"PasswordException"),this.code=o}}class Jt extends Xt{constructor(i,o){super(i,"UnknownErrorException"),this.details=o}}class re extends Xt{constructor(i){super(i,"InvalidPDFException")}}class oe extends Xt{constructor(i){super(i,"MissingPDFException")}}class Rt extends Xt{constructor(i,o){super(i,"UnexpectedResponseException"),this.status=o}}class Qt extends Xt{constructor(i){super(i,"FormatError")}}class ue extends Xt{constructor(i){super(i,"AbortException")}}function Ae(e){(typeof e!="object"||(e==null?void 0:e.length)===void 0)&&ot("Invalid argument for bytesToString");const i=e.length,o=8192;if(i>24&255,e>>16&255,e>>8&255,e&255)}function ee(e){const i=Object.create(null);for(const[o,m]of e)i[o]=m;return i}function ce(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function Zt(){try{return new Function(""),!0}catch{return!1}}class Nt{static get isLittleEndian(){return Pt(this,"isLittleEndian",ce())}static get isEvalSupported(){return Pt(this,"isEvalSupported",Zt())}static get isOffscreenCanvasSupported(){return Pt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="string"?Pt(this,"platform",{isMac:navigator.platform.includes("Mac")}):Pt(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var i,o;return Pt(this,"isCSSRoundSupported",(o=(i=globalThis.CSS)==null?void 0:i.supports)==null?void 0:o.call(i,"width: round(1.5px, 1px)"))}}const mt=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class pt{static makeHexColor(i,o,m){return`#${mt[i]}${mt[o]}${mt[m]}`}static scaleMinMax(i,o){let m;i[0]?(i[0]<0&&(m=o[0],o[0]=o[2],o[2]=m),o[0]*=i[0],o[2]*=i[0],i[3]<0&&(m=o[1],o[1]=o[3],o[3]=m),o[1]*=i[3],o[3]*=i[3]):(m=o[0],o[0]=o[1],o[1]=m,m=o[2],o[2]=o[3],o[3]=m,i[1]<0&&(m=o[1],o[1]=o[3],o[3]=m),o[1]*=i[1],o[3]*=i[1],i[2]<0&&(m=o[0],o[0]=o[2],o[2]=m),o[0]*=i[2],o[2]*=i[2]),o[0]+=i[4],o[1]+=i[5],o[2]+=i[4],o[3]+=i[5]}static transform(i,o){return[i[0]*o[0]+i[2]*o[1],i[1]*o[0]+i[3]*o[1],i[0]*o[2]+i[2]*o[3],i[1]*o[2]+i[3]*o[3],i[0]*o[4]+i[2]*o[5]+i[4],i[1]*o[4]+i[3]*o[5]+i[5]]}static applyTransform(i,o){const m=i[0]*o[0]+i[1]*o[2]+o[4],M=i[0]*o[1]+i[1]*o[3]+o[5];return[m,M]}static applyInverseTransform(i,o){const m=o[0]*o[3]-o[1]*o[2],M=(i[0]*o[3]-i[1]*o[2]+o[2]*o[5]-o[4]*o[3])/m,$=(-i[0]*o[1]+i[1]*o[0]+o[4]*o[1]-o[5]*o[0])/m;return[M,$]}static getAxialAlignedBoundingBox(i,o){const m=this.applyTransform(i,o),M=this.applyTransform(i.slice(2,4),o),$=this.applyTransform([i[0],i[3]],o),W=this.applyTransform([i[2],i[1]],o);return[Math.min(m[0],M[0],$[0],W[0]),Math.min(m[1],M[1],$[1],W[1]),Math.max(m[0],M[0],$[0],W[0]),Math.max(m[1],M[1],$[1],W[1])]}static inverseTransform(i){const o=i[0]*i[3]-i[1]*i[2];return[i[3]/o,-i[1]/o,-i[2]/o,i[0]/o,(i[2]*i[5]-i[4]*i[3])/o,(i[4]*i[1]-i[5]*i[0])/o]}static singularValueDecompose2dScale(i){const o=[i[0],i[2],i[1],i[3]],m=i[0]*o[0]+i[1]*o[2],M=i[0]*o[1]+i[1]*o[3],$=i[2]*o[0]+i[3]*o[2],W=i[2]*o[1]+i[3]*o[3],tt=(m+W)/2,gt=Math.sqrt((m+W)**2-4*(m*W-$*M))/2,it=tt+gt||1,_t=tt-gt||1;return[Math.sqrt(it),Math.sqrt(_t)]}static normalizeRect(i){const o=i.slice(0);return i[0]>i[2]&&(o[0]=i[2],o[2]=i[0]),i[1]>i[3]&&(o[1]=i[3],o[3]=i[1]),o}static intersect(i,o){const m=Math.max(Math.min(i[0],i[2]),Math.min(o[0],o[2])),M=Math.min(Math.max(i[0],i[2]),Math.max(o[0],o[2]));if(m>M)return null;const $=Math.max(Math.min(i[1],i[3]),Math.min(o[1],o[3])),W=Math.min(Math.max(i[1],i[3]),Math.max(o[1],o[3]));return $>W?null:[m,$,M,W]}static bezierBoundingBox(i,o,m,M,$,W,tt,gt,it){return it?(it[0]=Math.min(it[0],i,tt),it[1]=Math.min(it[1],o,gt),it[2]=Math.max(it[2],i,tt),it[3]=Math.max(it[3],o,gt)):it=[Math.min(i,tt),Math.min(o,gt),Math.max(i,tt),Math.max(o,gt)],b(this,u,un).call(this,i,m,$,tt,o,M,W,gt,3*(-i+3*(m-$)+tt),6*(i-2*m+$),3*(m-i),it),b(this,u,un).call(this,i,m,$,tt,o,M,W,gt,3*(-o+3*(M-W)+gt),6*(o-2*M+W),3*(M-o),it),it}}u=new WeakSet,di=function(i,o,m,M,$,W,tt,gt,it,_t){if(it<=0||it>=1)return;const Ot=1-it,jt=it*it,Gt=jt*it,Ut=Ot*(Ot*(Ot*i+3*it*o)+3*jt*m)+Gt*M,lt=Ot*(Ot*(Ot*$+3*it*W)+3*jt*tt)+Gt*gt;_t[0]=Math.min(_t[0],Ut),_t[1]=Math.min(_t[1],lt),_t[2]=Math.max(_t[2],Ut),_t[3]=Math.max(_t[3],lt)},un=function(i,o,m,M,$,W,tt,gt,it,_t,Ot,jt){if(Math.abs(it)<1e-12){Math.abs(_t)>=1e-12&&b(this,u,di).call(this,i,o,m,M,$,W,tt,gt,-Ot/_t,jt);return}const Gt=_t**2-4*Ot*it;if(Gt<0)return;const Ut=Math.sqrt(Gt),lt=2*it;b(this,u,di).call(this,i,o,m,M,$,W,tt,gt,(-_t+Ut)/lt,jt),b(this,u,di).call(this,i,o,m,M,$,W,tt,gt,(-_t-Ut)/lt,jt)},_(pt,u);function S(e){return decodeURIComponent(escape(e))}let n=null,s=null;function a(e){return n||(n=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,s=new Map([["\uFB05","\u017Ft"]])),e.replaceAll(n,(i,o,m)=>o?o.normalize("NFKC"):s.get(m))}function h(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const e=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(e);else for(let i=0;i<32;i++)e[i]=Math.floor(Math.random()*255);return Ae(e)}const l="pdfjs_internal_id_",g={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8}}},Ee={};function Se(ie){var $t=Ee[ie];if($t!==void 0)return $t.exports;var dt=Ee[ie]={exports:{}};return xe[ie](dt,dt.exports,Se),dt.exports}(()=>{var ie=typeof Symbol=="function"?Symbol("webpack queues"):"__webpack_queues__",$t=typeof Symbol=="function"?Symbol("webpack exports"):"__webpack_exports__",dt=typeof Symbol=="function"?Symbol("webpack error"):"__webpack_error__",d=H=>{H&&H.d<1&&(H.d=1,H.forEach(J=>J.r--),H.forEach(J=>J.r--?J.r++:J()))},Q=H=>H.map(J=>{if(J!==null&&typeof J=="object"){if(J[ie])return J;if(J.then){var At=[];At.d=0,J.then(I=>{z[$t]=I,d(At)},I=>{z[dt]=I,d(At)});var z={};return z[ie]=I=>I(At),z}}var F={};return F[ie]=I=>{},F[$t]=J,F});Se.a=(H,J,At)=>{var z;At&&((z=[]).d=-1);var F=new Set,I=H.exports,V,E,y,D=new Promise((L,Z)=>{y=Z,E=L});D[$t]=I,D[ie]=L=>(z&&L(z),F.forEach(L),D.catch(Z=>{})),H.exports=D,J(L=>{V=Q(L);var Z,B=()=>V.map(k=>{if(k[dt])throw k[dt];return k[$t]}),K=new Promise(k=>{Z=()=>k(B),Z.r=0;var O=C=>C!==z&&!F.has(C)&&(F.add(C),C&&!C.d&&(Z.r++,C.push(Z)));V.map(C=>C[ie](O))});return Z.r?K:B()},L=>(L?y(D[dt]=L):E(I),d(z))),z&&z.d<0&&(z.d=0)}})(),Se.d=(ie,$t)=>{for(var dt in $t)Se.o($t,dt)&&!Se.o(ie,dt)&&Object.defineProperty(ie,dt,{enumerable:!0,get:$t[dt]})},Se.o=(ie,$t)=>Object.prototype.hasOwnProperty.call(ie,$t);var se=Se(228);se=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=se),mn=se.AbortException,An=se.AnnotationEditorLayer,bn=se.AnnotationEditorParamsType,vn=se.AnnotationEditorType,yn=se.AnnotationEditorUIManager,wn=se.AnnotationLayer,_n=se.AnnotationMode,xn=se.CMapCompressionType,En=se.ColorPicker,Sn=se.DOMSVGFactory,Cn=se.DrawLayer,Tn=se.FeatureTest,Mn=se.GlobalWorkerOptions,Rn=se.ImageKind,Ln=se.InvalidPDFException,kn=se.MissingPDFException,Pn=se.OPS,In=se.Outliner,Dn=se.PDFDataRangeTransport,Fn=se.PDFDateString,Nn=se.PDFWorker,On=se.PasswordResponses,Hn=se.PermissionFlag,Bn=se.PixelsPerInch,Un=se.RenderingCancelledException,zn=se.UnexpectedResponseException,Vn=se.Util,jn=se.VerbosityLevel,qn=se.XfaLayer,Gn=se.build,Wn=se.createValidAbsoluteUrl,$n=se.fetchData,Xn=se.getDocument,Kn=se.getFilenameFromUrl,Yn=se.getPdfFilenameFromUrl,Jn=se.getXfaPageViewport,Qn=se.isDataScheme,Zn=se.isPdfFile,tr=se.noContextMenu,er=se.normalizeUnicode,sr=se.renderTextLayer,ir=se.setLayerDimensions,nr=se.shadow,rr=se.updateTextLayer,ar=se.version});export{mn as AbortException,An as AnnotationEditorLayer,bn as AnnotationEditorParamsType,vn as AnnotationEditorType,yn as AnnotationEditorUIManager,wn as AnnotationLayer,_n as AnnotationMode,xn as CMapCompressionType,En as ColorPicker,Sn as DOMSVGFactory,Cn as DrawLayer,Tn as FeatureTest,Mn as GlobalWorkerOptions,Rn as ImageKind,Ln as InvalidPDFException,kn as MissingPDFException,Pn as OPS,In as Outliner,Dn as PDFDataRangeTransport,Fn as PDFDateString,Nn as PDFWorker,On as PasswordResponses,Hn as PermissionFlag,Bn as PixelsPerInch,Un as RenderingCancelledException,zn as UnexpectedResponseException,Vn as Util,jn as VerbosityLevel,qn as XfaLayer,Sa as __tla,Gn as build,Wn as createValidAbsoluteUrl,$n as fetchData,Xn as getDocument,Kn as getFilenameFromUrl,Yn as getPdfFilenameFromUrl,Jn as getXfaPageViewport,Qn as isDataScheme,Zn as isPdfFile,tr as noContextMenu,er as normalizeUnicode,sr as renderTextLayer,ir as setLayerDimensions,nr as shadow,rr as updateTextLayer,ar as version};