1var b_=Object.defineProperty;var _A=d=>{throw TypeError(d)};var y_=(d,t,e)=>t in d?b_(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e;var T=(d,t,e)=>y_(d,typeof t!="symbol"?t+"":t,e),Zb=(d,t,e)=>t.has(d)||_A("Cannot "+e);var n=(d,t,e)=>(Zb(d,t,"read from private field"),e?e.call(d):t.get(d)),m=(d,t,e)=>t.has(d)?_A("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(d):t.set(d,e),f=(d,t,e,i)=>(Zb(d,t,"write to private field"),i?i.call(d,e):t.set(d,e),e),g=(d,t,e)=>(Zb(d,t,"access private method"),e);var kt=(d,t,e,i)=>({set _(s){f(d,t,s,e)},get _(){return n(d,t,i)}});import{_ as w_}from"./chevron-left-RdFi786O.js";import{d as v_,I as A_,G as E_,o as S_,J as x_,r as tu,C as __,a6 as C_,c as xh,b as _h,e as Jb,h as eu,i as P_,j as T_,a as k_,t as CA,F as M_,f as I_}from"./app-Ct_R7I7V.js";import{_ as ty}from"./Skeleton.vue_vue_type_script_setup_true_lang-BwXnwykN.js";/* empty css */(function(){try{var d=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};d.SENTRY_RELEASE={id:"252d68b4fa88039c840f6cf67f1b9df423005c12"}}catch{}})();try{(function(){var d=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new d.Error().stack;t&&(d._sentryDebugIds=d._sentryDebugIds||{},d._sentryDebugIds[t]="8ece21aa-f18f-490d-8e1c-445ca561fc73",d._sentryDebugIdIdentifier="sentry-dbid-8ece21aa-f18f-490d-8e1c-445ca561fc73")})()}catch{}const Ni=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),_r=[1/0,1/0,-1/0,-1/0],ko=new Float32Array(_r),by=[.001,0,0,.001,0,0],Je="http://www.w3.org/2000/svg",Ri={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Or={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Fh="pdfjs_internal_id_",zd="pdfjs_internal_editor_",Z={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ot={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},D_={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},he={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},zg={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Vt={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,RICHMEDIA:27},Th={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Rb={ERRORS:0,WARNINGS:1,INFOS:5},Bs={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},iu={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},L_={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Nb=Rb.WARNINGS;function R_(d){Number.isInteger(d)&&(Nb=d)}function N_(){return Nb}function Fb(d){Nb>=Rb.INFOS&&console.info(`Info: ${d}`)}
1function J(d){Nb>=Rb.WARNINGS&&console.warn(`Warning: ${d}`)}function lt(d){throw new Error(d)}function Xt(d,t){d||lt(t)}function F_(d){switch(d==null?void 0:d.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function $E(d,t=null,e=null){if(!d)return null;if(e&&typeof d=="string"){if(e.addDefaultProtocol&&d.startsWith("www.")){const s=d.match(/\./g);(s==null?void 0:s.length)>=2&&(d=`http://${d}`)}if(e.tryConvertEncoding)try{d=j_(d)}catch{}}const i=t?URL.parse(d,t):URL.parse(d);return F_(i)?i:null}function VE(d,t,e=!1){const i=URL.parse(d);return i?(i.hash=t,i.href):e&&$E(d,"http://example.com")?d.split("#",1)[0]+`${t?`#${t}`:""}`:""}function yy(d){return d.substring(d.lastIndexOf("/")+1)}function Y(d,t,e,i=!1){return Object.defineProperty(d,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}const Eh=function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();let wy=class extends Eh{constructor(t,e){super(t,"PasswordException"),this.code=e}};class ey extends Eh{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}let vy=class extends Eh{constructor(t){super(t,"InvalidPDFException")}},zm=class extends Eh{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}};class O_ extends Eh{constructor(t){super(t,"FormatError")}}let co=class extends Eh{constructor(t){super(t,"AbortException")}};function B_(d){(typeof d!="object"||(d==null?void 0:d.length)===void 0)&<("Invalid argument for bytesToString");const t=d.length,e=8192;if(t<e)return String.fromCharCode.apply(null,d);const i=[];for(let s=0;s<t;s+=e){const r=Math.min(s+e,t),a=d.subarray(s,r);i.push(String.fromCharCode.apply(null,a))}return i.join("")}function Ob(d){typeof d!="string"&<("Invalid argument for stringToBytes");const t=d.length,e=new Uint8Array(t);for(let i=0;i<t;++i)e[i]=d.charCodeAt(i)&255;return e}let xt=class{static get isLittleEndian(){const t=new Uint8Array(4);t[0]=1;const e=new Uint32Array(t.buffer,0,1);return Y(this,"isLittleEndian",e[0]===1)}static get isOffscreenCanvasSupported(){return Y(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Y(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Y(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Y(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:t,userAgent:e}=navigator;return Y(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCanvasFilterSupported(){let t;return this.isOffscreenCanvasSupported?t=new OffscreenCanvas(1,1).getContext("2d"):typeof document<"u"&&(t=document.createElement("canvas").getContext("2d")),Y(this,"isCanvasFilterSupported",(t==null?void 0:t.filter)!==void 0)}static get isAlphaColorInputSupported(){if(typeof document>"u")return Y(this,"isAlphaColorInputSupported",!1);const t=document.createElement("input");return t.type="color",t.setAttribute("alpha",""),t.value="#ff000080",Y(this,"isAlphaColorInputSupported",t.value!=="#ff0000")}static get isBackdropFilterSupported(){return Y(this,"isBackdropFilterSupported",typeof CSS<"u"&&CSS.supports("backdrop-filter","blur(1px)"))}};var Pr,py,Wg,Ay;let N=(py=class{static get hexNums(){return Y(this,"hexNums",Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0")))}static makeHexColor(t,e,i){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[i]}`}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,i=0){const s=t[i],r=t[i+1];t[i]=s*e[0]+r*e[2]+e[4],t[i+1]=s*e[1]+r*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){const s=e[0],r=e[1],a=e[2],o=e[3],l=e[4],h=e[5];for(let c=0;c<6;c+=2){const u=t[i+c],p=t[i+c+1];t[i+c]=u*s+p*a+l,t[i+c+1]=u*r+p*o+h}}static applyInverseTransform(t,e){const i=t[0],s=t[1],r=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-s*e[2]+e[2]*e[5]-e[4]*e[3])/r,t[1]=(-i*e[1]+s*e[0]+e[4]*e[1]-e[5]*e[0])/r}static axialAlignedBoundingBox(t,e,i){const s=e[0],r=e[1],a=e[2],o=e[3],l=e[4],h=e[5],c=t[0],u=t[1],p=t[2],b=t[3];let y=s*c+l,w=y,v=s*p+l,A=v,E=o*u+h,S=E,x=o*b+h,_=x;if(r!==0||a!==0){const C=r*c,k=r*p,D=a*u,P=a*b;y+=D,A+=D,v+=P,w+=P,E+=C,_+=C,x+=k,S+=k}i[0]=Math.min(i[0],y,v,w,A),i[1]=Math.min(i[1],E,x,S,_),i[2]=Math.max(i[2],y,v,w,A),i[3]=Math.max(i[3],E,x,S,_)}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){const i=t[0],s=t[1],r=t[2],a=t[3],o=i**2+s**2,l=i*r+s*a,h=r**2+
1a**2,c=(o+h)/2,u=Math.sqrt(c**2-(o*h-l**2));e[0]=Math.sqrt(c+u||1),e[1]=Math.sqrt(c-u||1)}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>a?null:[i,r,s,a]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,s,r){r[0]=Math.min(r[0],t,i),r[1]=Math.min(r[1],e,s),r[2]=Math.max(r[2],t,i),r[3]=Math.max(r[3],e,s)}static bezierBoundingBox(t,e,i,s,r,a,o,l,h){h[0]=Math.min(h[0],t,o),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,o),h[3]=Math.max(h[3],e,l),g(this,Pr,Ay).call(this,t,i,r,o,e,s,a,l,3*(-t+3*(i-r)+o),6*(t-2*i+r),3*(i-t),h),g(this,Pr,Ay).call(this,t,i,r,o,e,s,a,l,3*(-e+3*(s-a)+l),6*(e-2*s+a),3*(s-e),h)}},Pr=new WeakSet,Wg=function(t,e,i,s,r,a,o,l,h,c){if(h<=0||h>=1)return;const u=1-h,p=h*h,b=p*h,y=u*(u*(u*t+3*h*e)+3*p*i)+b*s,w=u*(u*(u*r+3*h*a)+3*p*o)+b*l;c[0]=Math.min(c[0],y),c[1]=Math.min(c[1],w),c[2]=Math.max(c[2],y),c[3]=Math.max(c[3],w)},Ay=function(t,e,i,s,r,a,o,l,h,c,u,p){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&g(this,Pr,Wg).call(this,t,e,i,s,r,a,o,l,-u/c,p);return}const b=c**2-4*u*h;if(b<0)return;const y=Math.sqrt(b),w=2*h;g(this,Pr,Wg).call(this,t,e,i,s,r,a,o,l,(-c+y)/w,p),g(this,Pr,Wg).call(this,t,e,i,s,r,a,o,l,(-c-y)/w,p)},m(py,Pr),py);function j_(d){return decodeURIComponent(escape(d))}let iy=null,PA=null;function U_(d){return iy||(iy=/([\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,PA=new Map([["ï¬
","ſt"]])),d.replaceAll(iy,(t,e,i)=>e?e.normalize("NFKC"):PA.get(i))}function HE(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const d=new Uint8Array(32);return crypto.getRandomValues(d),B_(d)}function $_(d,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[i,s,...r]=e;if(!d(i)&&!Number.isInteger(i)||!t(s))return!1;const a=r.length;let o=!0;switch(s.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return a===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(a!==4)return!1;o=!1;break;default:return!1}for(const l of r)if(!(typeof l=="number"||o&&l===null))return!1;return!0}const Zd=()=>[],sA=()=>new Map,Ey=()=>Object.create(null),V_=()=>new Set;typeof Iterator.prototype.join!="function"&&(Iterator.prototype.join=function(d){return[...this].join(d)});function Nt(d,t,e){return Math.min(Math.max(d,t),e)}class Cg{constructor({viewBox:t,userUnit:e,scale:i,rotation:s,offsetX:r=0,offsetY:a=0,dontFlip:o=!1}){this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=s,this.offsetX=r,this.offsetY=a,i*=e;const l=(t[2]+t[0])/2,h=(t[3]+t[1])/2;let c,u,p,b;switch(s%=360,s<0&&(s+=360),s){case 180:c=-1,u=0,p=0,b=1;break;case 90:c=0,u=1,p=1,b=0;break;case 270:c=0,u=-1,p=-1,b=0;break;case 0:c=1,u=0,p=0,b=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(p=-p,b=-b);let y,w,v,A;c===0?(y=Math.abs(h-t[1])*i+r,w=Math.abs(l-t[0])*i+a,v=(t[3]-t[1])*i,A=(t[2]-t[0])*i):(y=Math.abs(l-t[0])*i+r,w=Math.abs(h-t[1])*i+a,v=(t[2]-t[0])*i,A=(t[3]-t[1])*i),this.transform=[c*i,u*i,p*i,b*i,y-c*i*l-p*i*h,w-u*i*l-b*i*h],this.width=v,this.height=A}get rawDims(){const t=this.viewBox;return Y(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:r=!1}={}){return new Cg({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:r})}convertToViewportPoint(t,e){const i=[t,e];return N.applyTransform(i,this.transform),i}convertToPdfPoint(t,e){const i=[t,e];return N.applyInverseTransform(i,this.transform),i}}class Bu{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};function s(r){var l;if(!r)return;let a=null;const o=r.name;if(o==="#text")a=r.value;
1else if(Bu.shouldBuildText(o))(l=r==null?void 0:r.attributes)!=null&&l.textContent?a=r.attributes.textContent:r.value&&(a=r.value);else return;if(a!==null&&e.push({str:a}),!!r.children)for(const h of r.children)s(h)}return s(t),i}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const H_=/url\(|image-set\(/i,z_=/^on/i;var Xu,gy,Sy;let zE=(gy=class{static get _allowedHtmlElements(){return Y(this,"_allowedHtmlElements",new Set(["a","b","br","button","div","i","img","input","label","li","ol","option","p","select","span","sub","sup","textarea","ul"]))}static get _allowedSvgElements(){return Y(this,"_allowedSvgElements",new Set(["ellipse","line","path","rect","svg"]))}static get _allowedRichTextElements(){return Y(this,"_allowedRichTextElements",new Set(["a","b","br","div","i","li","ol","p","span","sub","sup","ul"]))}static get _allowedRichTextAttributes(){return Y(this,"_allowedRichTextAttributes",new Set(["class","dir","style"]))}static get _allowedRichTextStyles(){return Y(this,"_allowedRichTextStyles",new Set(["color","font","fontFamily","fontSize","fontStretch","fontStyle","fontWeight","kerningMode","letterSpacing","lineHeight","margin","marginBottom","marginLeft","marginRight","marginTop","orphans","paddingLeft","paddingRight","breakAfter","breakBefore","breakInside","tabInterval","tabStop","textAlign","textDecoration","textIndent","transform","verticalAlign","widows"]))}static setupStorage(t,e,i,s,r){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(a.value!==null&&(t.textContent=a.value),r==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),r==="print")break;t.addEventListener("change",o=>{s.setValue(e,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(a.value!==null&&t.setAttribute("value",a.value),r==="print")break;t.addEventListener("input",o=>{s.setValue(e,{value:o.target.value})})}break;case"select":if(a.value!==null){t.setAttribute("value",a.value);for(const o of i.children)o.attributes.value===a.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}t.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:r}){const{attributes:a}=e,o=t instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${s}`);for(const[l,h]of Object.entries(a))if(h!=null&&!z_.test(l)&&!(s==="richText"&&!this._allowedRichTextAttributes.has(l)))switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":if(s==="richText"){const c=this._allowedRichTextStyles;for(const[u,p]of Object.entries(h))c.has(u)&&!H_.test(p)&&(t.style[u]=p)}else Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}o&&(r==null||r.addLinkAttributes(t,a.href,a.newWindow)),i&&a.dataId&&this.setupStorage(t,a.dataId,e,i)}static render(t){var u,p,b;const e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,r=t.intent||"display",a=g(this,Xu,Sy).call(this,s.name,(u=s.attributes)==null?void 0:u.xmlns,r)??document.createElement("div");s.attributes&&this.setAttributes({html:a,element:s,intent:r,linkService:i});const o=r!=="richText",l=t.div;if(l.append(a),t.viewport){const y=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=y}o&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(s.children.length===0){if(s.value){const y=document.createTextNode(s.value);a.append(y),o&&Bu.shouldBuildText(s.name)&&h.push(y)}return{textDivs:h}}const c=[[s,-1,a]];for(;c.length>0;){const[y,w,v]=c.at(-1);if(w+1===y.children.length){c.pop();continue}const A=y.children[++c.at(-1)[1]];if(A===null)continue;const{name:E}=A;if(E==="#text"){const x=document.createTextNode(A.value);h.push(x),v.append(x);continue}const S=g(this,Xu,Sy).call(this,E,(p=A.attributes)==null?void 0:p.xmlns,r);if(S){if(v.append(S),A.attributes&&this.setAttributes({html:S,element:A,storage:e,intent:r,linkService:i}),((b=A.children)==null?void 0:b.length)>0)c.push([A,-1,S]);else if(A.value){const x=document.createTextNode(A.value);o&&Bu.shouldBuildText(E)&&h.push(x),S.append(x)}}}for(const y of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))y.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}static getPageViewport(t,{scale:e=1,rotation:i=0}){const{width:s,height:r}=t.attributes.style;return new Cg({viewBox:[0,0,parseInt(s,10),parseInt(r,10)],userUnit:1,scale:e,rotation:i})}}
1,Xu=new WeakSet,Sy=function(t,e,i){return i==="richText"?!e&&this._allowedRichTextElements.has(t)?document.createElement(t):null:e?e===Je&&this._allowedSvgElements.has(t)?document.createElementNS(Je,t):null:this._allowedHtmlElements.has(t)?document.createElement(t):null},m(gy,Xu),gy);var yn;let Wd=(yn=class{},T(yn,"CSS",96),T(yn,"PDF",72),T(yn,"PDF_TO_CSS_UNITS",yn.CSS/yn.PDF),yn);async function nA(d,t="text"){if(Lu(d,document.baseURI)){const e=await fetch(d);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,i)=>{const s=new XMLHttpRequest;s.open("GET",d,!0),s.responseType=t==="bytes"?"arraybuffer":t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(t){case"bytes":e(new Uint8Array(s.response));return;case"blob":case"json":e(s.response);return}e(s.responseText);return}i(new Error(s.statusText))}},s.send(null)})}let rA=class extends Eh{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};function Bb(d){const t=d.length;let e=0;for(;e<t&&d[e].trim()==="";)e++;return d.substring(e,e+5).toLowerCase()==="data:"}function aA(d){return typeof d=="string"&&/\.pdf$/i.test(d)}function W_(d){return[d]=d.split(/[#?]/,1),yy(d)}function G_(d,t="document.pdf"){if(typeof d!="string")return t;if(Bb(d))return J('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=(o=>{try{return new URL(o)}catch{}try{return new URL(decodeURIComponent(o))}catch{}try{return new URL(o,"https://foo.bar")}catch{}try{return new URL(decodeURIComponent(o),"https://foo.bar")}catch{}return null})(d);if(!i)return t;const s=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=yy(l),l.length===4&&r.test(l))?o:l}catch{return o}},r=/\.pdf$/i,a=yy(i.pathname);if(r.test(a))return s(a);if(i.searchParams.size>0){const o=h=>[...h].findLast(c=>r.test(c)),l=o(i.searchParams.values())??o(i.searchParams.keys());if(l)return s(l)}if(i.hash){const{hash:o}=i;let l=-1;for(const{index:h}of o.matchAll(/\.pdf\b/gi))l=h;if(l>0){let h=l;for(;h>0&&!"/?#=".includes(o[h-1]);)h--;if(h<l)return s(o.slice(h,l+4))}}return t}var jr;class TA{constructor(){m(this,jr,new Map);T(this,"times",[])}time(t){n(this,jr).has(t)&&J(`Timer is already running for ${t}`),n(this,jr).set(t,Date.now())}timeEnd(t){n(this,jr).has(t)||J(`Timer has not been started for ${t}`),this.times.push({name:t,start:n(this,jr).get(t),end:Date.now()}),n(this,jr).delete(t)}toString(){const t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms 2`).join("")}}jr=new WeakMap;function Lu(d,t){const e=t?URL.parse(d,t):URL.parse(d);return/https?:/.test((e==null?void 0:e.protocol)??"")}function Is(d){d.preventDefault()}function fe(d){d.preventDefault(),d.stopPropagation()}var my,Yu;let xy=(my=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;n(this,Yu)||f(this,Yu,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+\\-])?(\\d{2})?'?(\\d{2})?'?"));const e=n(this,Yu).exec(t);if(!e)return null;const i=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,h==="-"?(a+=c,o+=u):h==="+"&&(a-=c,o-=u),new Date(Date.UTC(i,s,r,a,o,l))}},Yu=new WeakMap,m(my,Yu),my);function Pg(d){if(d.startsWith("#")){const e=d.slice(1);return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),e.length>=8?parseInt(e.slice(6,8),16)/255:1]}if(d.startsWith("rgb(")){const[e,i,s]=d.slice(4,-1).split(",").map(r=>parseInt(r,10));return[e,i,s,1]}if(d.startsWith("rgba(")){const e=d.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}const t=d.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return t?[Math.round(parseFloat(t[1])*255),Math.round(parseFloat(t[2])*255),Math.round(parseFloat(t[3])*255),t[4]!==void 0&&t[4]!=="none"?parseFloat(t[4]):1]:null}function Tg(d){const t=Pg(d);return t?t.slice(0,3):(J(`Not a valid color format: "${d}"`),[0,0,0])}function X_(d){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of d.keys()){t.style.color=e;const i=window.getComputedStyle(t).color;d.set(e,Tg(i))}t.remove()}function It(d){const{a:t,b:e,c:i,d:s,e:r,f:a}=d.getTransform();return[t,e,i,s,r,a]}function Ls(d){const{a:t,b:e,c:i,d:s,e:r,f:a}=d.getTransform().invertSelf();return[t,e,i,s,r,a]}function yh(d,t,e=!1,i=!0){if(t instanceof Cg){const{pageWidth:s,pageHeight:r}=t.rawDims,{style:a}=d,o=`round(down, var(--total-scale-factor) * ${s}px, var(--scale-round-x))`,l=`round(down, var(--total-scale-factor) * ${r}px, var(--scale-round-y))`;!e||t.rotation%180===0?(a.width=o,a.height=l):(a.width=l,a.height=o
2)}i&&d.setAttribute("data-main-rotation",t.rotation)}let uo=class _y{constructor(){const{pixelRatio:t}=_y;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,s,r=-1){let a=1/0,o=1/0,l=1/0;i=_y.capPixels(i,r),i>0&&(a=Math.sqrt(i/(t*e))),s!==-1&&(o=s/t,l=s/e);const h=Math.min(a,o,l);return this.sx>h||this.sy>h?(this.sx=h,this.sy=h,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}};const Cy=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class Y_{static get isDarkMode(){var t;return Y(this,"isDarkMode",!!((t=window==null?void 0:window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches))}}let K_=class{static get commentForegroundColor(){const t=document.createElement("span");t.classList.add("comment","sidebar");const{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);const{color:i}=window.getComputedStyle(t);return t.remove(),Y(this,"commentForegroundColor",Tg(i))}};function q_(d,t){t=Nt(t??1,0,1);const e=255*(1-t);return d.map(i=>Math.round(i*t+e))}function kA(d,t){const e=d[0]/255,i=d[1]/255,s=d[2]/255,r=Math.max(e,i,s),a=Math.min(e,i,s),o=(r+a)/2;if(r===a)t[0]=t[1]=0;else{const l=r-a;switch(t[1]=o<.5?l/(r+a):l/(2-r-a),r){case e:t[0]=((i-s)/l+(i<s?6:0))*60;break;case i:t[0]=((s-e)/l+2)*60;break;case s:t[0]=((e-i)/l+4)*60;break}}t[2]=o}function Py(d,t){const e=d[0],i=d[1],s=d[2],r=(1-Math.abs(2*s-1))*i,a=r*(1-Math.abs(e/60%2-1)),o=s-r/2;switch(Math.floor(e/60)){case 0:t[0]=r+o,t[1]=a+o,t[2]=o;break;case 1:t[0]=a+o,t[1]=r+o,t[2]=o;break;case 2:t[0]=o,t[1]=r+o,t[2]=a+o;break;case 3:t[0]=o,t[1]=a+o,t[2]=r+o;break;case 4:t[0]=a+o,t[1]=o,t[2]=r+o;break;case 5:case 6:t[0]=r+o,t[1]=o,t[2]=a+o;break}}function Ty(d){return d<=.03928?d/12.92:((d+.055)/1.055)**2.4}function MA(d,t,e){Py(d,e),e.map(Ty);const i=.2126*e[0]+.7152*e[1]+.0722*e[2];Py(t,e),e.map(Ty);const s=.2126*e[0]+.7152*e[1]+.0722*e[2];return i>s?(i+.05)/(s+.05):(s+.05)/(i+.05)}const IA=new Map;function Q_(d,t){const e=d[0]+d[1]*256+d[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776;let i=IA.get(e);if(i)return i;const s=new Float32Array(9),r=s.subarray(0,3),a=s.subarray(3,6);kA(d,a);const o=s.subarray(6,9);kA(t,o);const l=o[2]<.5,h=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),MA(a,o,r)<h){let c,u;l?(c=a[2],u=1):(c=0,u=a[2]);const p=.005;for(;u-c>p;){const b=a[2]=(c+u)/2;l===MA(a,o,r)<h?c=b:u=b}a[2]=l?u:c}return Py(a,r),i=N.makeHexColor(Math.round(r[0]*255),Math.round(r[1]*255),Math.round(r[2]*255)),IA.set(e,i),i}function WE({html:d,dir:t,className:e},i){const s=document.createDocumentFragment();if(typeof d=="string"){const r=document.createElement("p");r.dir=t||"auto";const a=d.split(/\r\n?|\n/);for(let o=0,l=a.length;o<l;++o){const h=a[o];r.append(document.createTextNode(h)),o<l-1&&r.append(document.createElement("br"))}s.append(r)}else zE.render({xfaHtml:d,div:s,intent:"richText"});s.firstElementChild.classList.add("richText",e),i.append(s)}function GE(d){const t=new Path2D;if(!d)return t;for(let e=0,i=d.length;e<i;)switch(d[e++]){case iu.moveTo:t.moveTo(d[e++],d[e++]);break;case iu.lineTo:t.lineTo(d[e++],d[e++]);break;case iu.curveTo:t.bezierCurveTo(d[e++],d[e++],d[e++],d[e++],d[e++],d[e++]);break;case iu.quadraticCurveTo:t.quadraticCurveTo(d[e++],d[e++],d[e++],d[e++]);break;case iu.closePath:t.closePath();break;default:J(`Unrecognized drawing path operator: ${d[e-1]}`);break}return t}var Ur,$r,zi,Wi,Ku,Vr,Vh,Hh,qu,eb,XE,Le,YE,KE,kh,ou;const Cn=class Cn{constructor(t){m(this,Le);m(this,Ur,null);m(this,$r,null);m(this,zi);m(this,Wi,null);m(this,Ku,null);m(this,Vr,null);m(this,Vh,null);m(this,Hh,null);f(this,zi,t),n(Cn,qu)||f(Cn,qu,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){const t=f(this,Ur,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=n(this,zi)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Is,{signal:e}),t.addEventListener("pointerdown",g(Cn,eb,XE),{signal:e}));const i=f(this,Wi,document.createElement("div"));i.className="buttons",t.append(i);const s=n(this,zi).toolbarPosition;if(s){const{style:r}=t,a=n(this,zi)._uiManager.direction==="ltr"?1-s[0]:s[0];r.insetInlineEnd=`${100*a}%`,r.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return n(this,Ur)}hide(){var t;n(this,Ur).classList.add("hidden"),(t=n(this,$r))==null||t.hideDropdown()}show(){var t,e;n(this,Ur).classList.remove("hidden"),(t=n(this,Ku))==null||t.shown(),(e=n(this,Vr))==null||e.shown()}
2addDeleteButton(){const{editorType:t,_uiManager:e}=n(this,zi),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",n(Cn,qu)[t]),g(this,Le,kh).call(this,i)&&i.addEventListener("click",s=>{e.delete()},{signal:e._signal}),n(this,Wi).append(i)}async addAltText(t){const e=await t.render();g(this,Le,kh).call(this,e),n(this,Wi).append(e,n(this,Le,ou)),f(this,Ku,t)}addComment(t,e=null){if(n(this,Vr))return;const i=t.renderForToolbar();if(!i)return;g(this,Le,kh).call(this,i);const s=f(this,Vh,n(this,Le,ou));e?(n(this,Wi).insertBefore(i,e),n(this,Wi).insertBefore(s,e)):n(this,Wi).append(i,s),f(this,Vr,t),t.toolbar=this}addColorPicker(t){if(n(this,$r))return;f(this,$r,t);const e=t.renderButton();g(this,Le,kh).call(this,e),n(this,Wi).append(e,n(this,Le,ou))}async addEditSignatureButton(t){const e=f(this,Hh,await t.renderEditButton(n(this,zi)));g(this,Le,kh).call(this,e),n(this,Wi).append(e,n(this,Le,ou))}removeButton(t){var e,i;switch(t){case"comment":(e=n(this,Vr))==null||e.removeToolbarCommentButton(),f(this,Vr,null),(i=n(this,Vh))==null||i.remove(),f(this,Vh,null);break}}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,i){if(!e&&t==="comment")return;const s=n(this,Wi).querySelector(i);s&&t==="comment"&&this.addComment(e,s)}updateEditSignatureButton(t){n(this,Hh)&&(n(this,Hh).title=t)}remove(){var t;n(this,Ur).remove(),(t=n(this,$r))==null||t.destroy(),f(this,$r,null)}};Ur=new WeakMap,$r=new WeakMap,zi=new WeakMap,Wi=new WeakMap,Ku=new WeakMap,Vr=new WeakMap,Vh=new WeakMap,Hh=new WeakMap,qu=new WeakMap,eb=new WeakSet,XE=function(t){t.stopPropagation()},Le=new WeakSet,YE=function(t){n(this,zi)._focusEventsAllowed=!1,fe(t)},KE=function(t){n(this,zi)._focusEventsAllowed=!0,fe(t)},kh=function(t){const e=n(this,zi)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",g(this,Le,YE).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",g(this,Le,KE).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Is,{signal:e}),!0)},ou=function(){const t=document.createElement("div");return t.className="divider",t},m(Cn,eb),m(Cn,qu,null);let ky=Cn;var Qu,Mo,js,kr,qE,QE,My;class Z_{constructor(t){m(this,kr);m(this,Qu,null);m(this,Mo,null);m(this,js);f(this,js,t)}show(t,e,i){const[s,r]=g(this,kr,QE).call(this,e,i),{style:a}=n(this,Mo)||f(this,Mo,g(this,kr,qE).call(this));t.append(n(this,Mo)),a.insetInlineEnd=`${100*s}%`,a.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){n(this,Mo).remove()}}Qu=new WeakMap,Mo=new WeakMap,js=new WeakMap,kr=new WeakSet,qE=function(){const t=f(this,Mo,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.dir=n(this,js).direction;const e=n(this,js)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",Is,{signal:e});const i=f(this,Qu,document.createElement("div"));return i.className="buttons",t.append(i),n(this,js).hasCommentManager()&&g(this,kr,My).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{n(this,js).commentSelection("floating_button")}),g(this,kr,My).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{n(this,js).highlightSelection("floating_button")}),t},QE=function(t,e){let i=0,s=0;for(const r of t){const a=r.y+r.height;if(a<i)continue;const o=r.x+(e?r.width:0);if(a>i){s=o,i=a;continue}e?o>s&&(s=o):o<s&&(s=o)}return[e?1-s:s,i]},My=function(t,e,i,s){const r=document.createElement("button");r.classList.add("basic",t),r.tabIndex=0,r.setAttribute("data-l10n-id",e);const a=document.createElement("span");r.append(a),a.className="visuallyHidden",a.setAttribute("data-l10n-id",i);const o=n(this,js)._signal;o instanceof AbortSignal&&!o.aborted&&(r.addEventListener("contextmenu",Is,{signal:o}
2),r.addEventListener("click",s,{signal:o})),n(this,Qu).append(r)};const J_="59968104-cc61-4cf9-b570-014b35b3709c",sy=Object.freeze({internal:J_});function ZE(d,t,e){for(const i of e)t.addEventListener(i,d[i].bind(d))}var Io,Do,zh,Lo;const wt=class wt{static initializeAndAddPointerId(t){(n(wt,Do)||f(wt,Do,new Set)).add(t)}static setPointer(t,e){n(wt,Io)||f(wt,Io,e),n(wt,Lo)??f(wt,Lo,t)}static setTimeStamp(t){f(wt,zh,t)}static isSamePointerId(t){return n(wt,Io)===t}static isSamePointerIdOrRemove(t){var e;return n(wt,Io)===t?!0:((e=n(wt,Do))==null||e.delete(t),!1)}static isSamePointerType(t){return n(wt,Lo)===t}static isInitializedAndDifferentPointerType(t){return n(wt,Lo)!==null&&!wt.isSamePointerType(t)}static isSameTimeStamp(t){return n(wt,zh)===t}static isUsingMultiplePointers(){var t;return((t=n(wt,Do))==null?void 0:t.size)>=1}static clearPointerType(){f(wt,Lo,null)}static clearPointerIds(){f(wt,Io,NaN),f(wt,Do,null)}static clearTimeStamp(){f(wt,zh,NaN)}};Io=new WeakMap,Do=new WeakMap,zh=new WeakMap,Lo=new WeakMap,m(wt,Io,NaN),m(wt,Do,null),m(wt,zh,NaN),m(wt,Lo,null);let Oe=wt;var ib;class tC{constructor(){m(this,ib,0)}get id(){return`${zd}${kt(this,ib)._++}`}}ib=new WeakMap;var Wh,Zu,Be,Gh,Gg;const yA=class yA{constructor(){m(this,Gh);m(this,Wh,HE());m(this,Zu,0);m(this,Be,null)}static get _isSVGFittingCanvas(){const t=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="${Je}"><rect width="1" height="1" style="fill:red;"/></svg>`,i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=t;const r=s.decode().then(()=>(i.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return Y(this,"_isSVGFittingCanvas",r)}async getFromFile(t){const{lastModified:e,name:i,size:s,type:r}=t;return g(this,Gh,Gg).call(this,`${e}_${i}_${s}_${r}`,t)}async getFromUrl(t){return g(this,Gh,Gg).call(this,t,t)}async getFromBlob(t,e){const i=await e;return g(this,Gh,Gg).call(this,t,i)}async getFromId(t){n(this,Be)||f(this,Be,new Map);const e=n(this,Be).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:i}=e;return delete e.blobPromise,this.getFromBlob(e.id,i)}return this.getFromUrl(e.url)}getFromCanvas(t,e){n(this,Be)||f(this,Be,new Map);let i=n(this,Be).get(t);if(i!=null&&i.bitmap)return i.refCounter+=1,i;const s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),i={bitmap:s.transferToImageBitmap(),id:`image_${n(this,Wh)}_${kt(this,Zu)._++}`,refCounter:1,isSvg:!1},n(this,Be).set(t,i),n(this,Be).set(i.id,i),i}getSvgUrl(t){const e=n(this,Be).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var s;n(this,Be)||f(this,Be,new Map);const e=n(this,Be).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:i}=e;if(!e.url&&!e.file){const r=new OffscreenCanvas(i.width,i.height);r.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=r.convertToBlob()}(s=i.close)==null||s.call(i),e.bitmap=null}isValidId(t){return t.startsWith(`image_${n(this,Wh)}_`)}};Wh=new WeakMap,Zu=new WeakMap,Be=new WeakMap,Gh=new WeakSet,Gg=async function(t,e){n(this,Be)||f(this,Be,new Map);let i=n(this,Be).get(t);if(i===null)return null;if(i!=null&&i.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${n(this,Wh)}_${kt(this,Zu)._++}`,refCounter:0,isSvg:!1});let s;if(typeof e=="string"?(i.url=e,s=await nA(e,"blob")):e instanceof File?s=i.file=e:e instanceof Blob&&(s=e),s.type==="image/svg+xml"){const r=yA._isSVGFittingCanvas,a=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>{i.bitmap=o,i.isSvg=!0,h()},a.onload=async()=>{const u=i.svgUrl=a.result;o.src=await r?`${u}#svgView(preserveAspectRatio(none))`:u},o.onerror=a.onerror=c});a.readAsDataURL(s),await l}else i.bitmap=await createImageBitmap(s);i.refCounter=1}catch(s){J(s),i=null}return n(this,Be).set(t,i),i&&n(this,Be).set(i.id,i),i};let Iy=yA;var Qt,Hr,Ju,Ht;class eC{constructor(t=128){m(this,Qt,[]);m(this,Hr,!1);m(this,Ju);m(this,Ht,-1);f(this,Ju,t)}add({cmd:t,undo:e,post:i,mustExec:s,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:o=!1}){if(s&&t(),n(this,Hr))return;const l={cmd:t,undo:e,post:i,type:r};if(n(this,Ht)===-1){n(this,Qt).length>0&&(n(this,Qt).length=0),f(this,Ht,0),n(this,Qt).push(l);return}if(a&&n(this,Qt)[n(this,Ht)].type===r){o&&(l.undo=n(this,Qt)[n(this,Ht)].undo),n(this,Qt)[n(this,Ht)]=l;return}const h=n(this,Ht)+1;h===n(this,Ju)?n(this,Qt).splice(0,1):(f(this,Ht,h),h<n(this,Qt).length&&n(this,Qt).splice(h)),n(this,Qt).push(l)}undo(){if(n(this,Ht)===-1)return;f(this,Hr,!0);const{undo:t,post:e}=n(this,Qt)[n(this,Ht)];t(),e==null||e(),f(this,Hr,!1),f(this,Ht,n(this,Ht)-1)}redo(){if(n(this,Ht)<n(this,Qt).length-1){f(this,Ht,n(this,Ht)+1),f(this,Hr,!0);const{cmd:t,post:e}=n(this,Qt)[n(this,Ht)];t(),e==null||e(),f(this,Hr,!1)}}hasSomethingToUndo(){return n(this,Ht)!==-1}hasSomethingToRedo(){return n(this,Ht)<n(this,Qt).length-1}cleanType(t){if(n(this,Ht)!==-1){for(let e=n(this,Ht);e>=0;e--)if(n(this,Qt)[e].type!==t){n(this,Qt).splice(e+1,n(this,Ht)-e),f(this,Ht,e);return}n(this,Qt).length=0,f(this,Ht,-1)}}destroy(){f(this,Qt,null)}}
2Qt=new WeakMap,Hr=new WeakMap,Ju=new WeakMap,Ht=new WeakMap;var Yd,JE,t0;const oi=class oi{constructor(t){var i;this.callbacks=new Map;const{isMac:e}=xt.platform;for(const[s,r,a={}]of t){const o=s.some(l=>l.startsWith("mac+"));for(const l of s){let h=l;if(o){const p=l.startsWith("mac+");if(e!==p)continue;p&&(h=l.slice(4))}const[c,u]=g(i=oi,Yd,JE).call(i,h);c!==null&&this.callbacks.getOrInsertComputed(c,Zd).push({callback:r,options:a,modifiers:u})}}}exec(t,e){var c;let i=this.callbacks.get(e.key);if(!i){if(/^[a-z]$/i.test(e.key))return;const u=g(c=oi,Yd,t0).call(c,e.code);if(u===null||u===e.key||(i=this.callbacks.get(u),!i))return}const s=(e.altKey?oi.ALT:0)|(e.ctrlKey?oi.CTRL:0)|(e.metaKey?oi.META:0)|(e.shiftKey?oi.SHIFT:0),r=i.find(u=>u.modifiers===s);if(!r)return;const{callback:a,options:{bubbles:o=!1,args:l=[],checker:h=null}}=r;h&&!h(t,e)||(a.bind(t,...l,e)(),o||fe(e))}};Yd=new WeakSet,JE=function(t){let e=null,i=0;for(let s of t.split("+")){if(s=s.trim(),!s)continue;const r=s.toUpperCase(),a=oi[r];if(a){i|=a;continue}if(e!==null){J(`KeyboardManager: multiple keys in shortcut "${t}"`);break}e=r==="SPACE"?" ":s}return e===null&&J(`KeyboardManager: no key found in shortcut "${t}"`),[e,i]},t0=function(t){var i;const e=/^(?:Key([A-Z])|(?:Digit|Numpad)(\d))$/.exec(t);return e?((i=e[1])==null?void 0:i.toLowerCase())??e[2]:null},m(oi,Yd),T(oi,"ALT",1),T(oi,"CTRL",2),T(oi,"META",4),T(oi,"SHIFT",8);let wh=oi;const sb=class sb{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return X_(t),Y(this,"_colors",t)}convert(t){const e=Tg(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,s]of this._colors)if(s.every((r,a)=>r===e[a]))return sb._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?N.makeHexColor(...e):t}};T(sb,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Dy=sb;var Xh,wi,Yh,Ft,zt,Kh,qh,Qh,je,Zh,Gi,be,zr,Wr,Gr,Xr,Us,Xi,Ro,tf,ef,Jh,sf,$s,Yr,tc,Kr,Vs,nb,kn,ec,nf,qr,No,ic,Qr,rf,ee,vt,Mn,Zr,Jr,af,sc,of,ta,Hs,In,lf,hf,Yi,xr,B,Xg,Ly,e0,i0,lu,s0,n0,r0,Ry,a0,o0,l0,h0,We,Sn,c0,d0,Ny,u0,hu,Fy;let ju=(xr=class{constructor(t,e,i,s,r,a,o,l,h,c,u,p,b,y,w,v){m(this,B);m(this,Xh,new AbortController);m(this,wi,null);m(this,Yh,null);m(this,Ft,new Map);m(this,zt,new Map);m(this,Kh,null);m(this,qh,null);m(this,Qh,null);m(this,je,null);m(this,Zh,null);m(this,Gi,new eC);m(this,be,null);m(this,zr,null);m(this,Wr,null);m(this,Gr,0);m(this,Xr,new Set);m(this,Us,null);m(this,Xi,null);m(this,Ro,new Set);T(this,"_editorUndoBar",null);m(this,tf,!1);m(this,ef,!1);m(this,Jh,!1);m(this,sf,null);m(this,$s,null);m(this,Yr,null);m(this,tc,null);m(this,Kr,!1);m(this,Vs,null);m(this,nb,new tC);m(this,kn,!1);m(this,ec,!1);m(this,nf,!1);m(this,qr,null);m(this,No,null);m(this,ic,null);m(this,Qr,null);m(this,rf,null);m(this,ee,Z.NONE);m(this,vt,new Set);m(this,Mn,null);m(this,Zr,null);m(this,Jr,null);m(this,af,null);m(this,sc,null);m(this,of,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});m(this,ta,[0,0]);m(this,Hs,null);m(this,In,null);m(this,lf,null);m(this,hf,null);m(this,Yi,null);const A=this._signal=n(this,Xh).signal;f(this,In,t),f(this,lf,e),f(this,hf,i),f(this,Qh,s),f(this,be,r),f(this,Zr,a),f(this,sc,l),this._eventBus=o;const E={signal:A,...sy};o.on("editingaction",this.onEditingAction.bind(this),E),o.on("pagechanging",this.onPageChanging.bind(this),E),o.on("scalechanging",this.onScaleChanging.bind(this),E),o.on("rotationchanging",this.onRotationChanging.bind(this),E),o.on("setpreference",this.onSetPreference.bind(this),E),o.on("switchannotationeditorparams",S=>this.updateParams(S.type,S.value),E),window.addEventListener("pointerdown",()=>{f(this,ec,!0)},{capture:!0,signal:A}),window.addEventListener("pointerup",()=>{f(this,ec,!1)},{capture:!0,signal:A}),window.addEventListener("beforeunload",this.endCurrentEditing.bind(this),{capture:!0,signal:A}),g(this,B,s0).call(this),g(this,B,h0).call(this),g(this,B,Ry).call(this),f(this,je,l.annotationStorage),f(this,sf,l.filterFactory),f(this,Jr,h),f(this,tc,c||null),f(this,tf,u),f(this,ef,p),f(this,Jh,b),f(this,rf,y||null),this.viewParameters={realScale:Wd.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=w||null,this._supportsPinchToZoom=v!==!1,r==null||r.setSidebarUiManager(this)}static get _keyboardManager(){const t=xr.prototype,e=a=>n(a,In).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),i=(a,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},s=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return Y(this,"_keyboardManager",new wh([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&n(a,In).contains(o)&&!a.isEnterHandled}],[["Space"],t.addNewEditorFromKeyboard,{checker:(a,{target:o})=>!(o instanceof HTMLButtonElement)&&n(a,In).contains(document.activeElement)}],[["Escape"],t.unselectAll],[["ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}destroy(){var t,e,i,s,r,a,o,l,h;(t=n(this,Yi))==null||t.resolve(),f(this,Yi,null),(e=n(this,Xh))==null||e.abort(),f(this,Xh,null),this._signal=null;for(const c of n(this,zt).values())c.destroy();n(this,zt).clear(),n(this,Ft).clear(),n(this,Ro).clear(),(i=n(this,Qr))==null||i.clear(),f(this,wi,null),n(this,vt).clear(),n(this,Gi).destroy(),(s=n(this,Qh))==null||s.destroy(),(r=n(this,be))==null||r.destroy(),(a=n(this,Zr))==null||a.destroy(),(o=n(this,Vs))==null||o.hide(),f(this,Vs,null),(l=n(this,ic))==null||l.destroy(),f(this,ic,null),f(this,Yh,null),n(this,$s)&&(clearTimeout(n(this,$s)),f(this,$s,null)),n(this,Hs)&&(clearTimeout(n(this,Hs)),f(this,Hs,null)),(h=this._editorUndoBar)==null||h.destroy(),f(this,sc,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return n(this,rf)}get useNewAltTextFlow(){return n(this,ef)}get useNewAltTextWhenAddingImage(){return n(this,Jh)}get hcmFilter(){return Y(this,"hcmFilter",n(this,Jr)?n(this,sf).addHCMFilter(n(this,Jr).foreground,n(this,Jr).background):"none")}get direction(){return Y(this,"direction",getComputedStyle(n(this,In)).direction)}get _highlightColors(){return Y(this,"_highlightColors",n(this,tc)?new Map(n(this,tc).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){const{_highlightColors:t}=this;if(!t)return Y(this,"highlightColors",null);const e=new Map,i=!!n(this,Jr);for(const[s,r]of t){const a=s.endsWith("_HCM");if(i&&a){e.set(s.replace("_HCM",""),r);continue}!i&&!a&&e.set(s,r)}return Y(this,"highlightColors",e)}get highlightColorNames(){return Y(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;const e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),f(this,Wr,t)}setMainHighlightColorPicker(t){f(this,ic,t)}editAltText(t,e=!1){var i;(i=n(this,Qh))==null||i.editAltText(this,t,e)}hasCommentManager(){return!!n(this,be)}editComment(t,e,i,s){var r;(r=n(this,be))==null||r.showDialog(this,t,e,i,s)}selectComment(t,e){const i=n(this,zt).get(t),s=i==null?void 0:i.getEditorByUID(e);s==null||s.toggleComment(!0,!0)}updateComment(t){var e;(e=n(this,be))==null||e.updateComment(t.getData())}updatePopupColor(t){var e;(e=n(this,be))==null||e.updatePopupColor(t)}
2removeComment(t){var e;(e=n(this,be))==null||e.removeComments([t.uid])}deleteComment(t,e){const i=()=>{t.comment=e},s=()=>{var r;(r=this._editorUndoBar)==null||r.show(i,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:s,undo:i,mustExec:!0})}toggleComment(t,e,i=void 0){var s;(s=n(this,be))==null||s.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){var i;return t&&((i=n(this,be))==null?void 0:i.makeCommentColor(t,e))||null}getCommentDialogElement(){var t;return((t=n(this,be))==null?void 0:t.dialogElement)||null}async waitForEditorsRendered(t){if(n(this,zt).has(t-1))return;const{resolve:e,promise:i}=Promise.withResolvers(),s=r=>{r.pageNumber===t&&(this._eventBus.off("editorsrendered",s),e())};this._eventBus.on("editorsrendered",s,sy),await i}getSignature(t){var e;(e=n(this,Zr))==null||e.getSignature({uiManager:this,editor:t})}get signatureManager(){return n(this,Zr)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal,...sy}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){switch(t){case"enableNewAltTextWhenAddingImage":f(this,Jh,e);break}}onPageChanging({pageNumber:t}){f(this,Gr,t-1)}deletePage(t){for(const e of this.getEditors(t))e.remove();n(this,zt).delete(t),n(this,Gr)===t&&f(this,Gr,0)}focusMainContainer(){n(this,In).focus()}findParent(t,e){for(const i of n(this,zt).values()){const{x:s,y:r,width:a,height:o}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=r&&e<=r+o)return i}return null}disableUserSelect(t=!1){n(this,lf).classList.toggle("noUserSelect",t)}addShouldRescale(t){n(this,Ro).add(t)}removeShouldRescale(t){n(this,Ro).delete(t)}onScaleChanging({scale:t}){var e;this.commitOrRemove(),this.viewParameters.realScale=t*Wd.PDF_TO_CSS_UNITS;for(const i of n(this,Ro))i.onScaleChanging();(e=n(this,Wr))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:s,anchorOffset:r,focusNode:a,focusOffset:o}=i,l=i.toString(),c=g(this,B,Xg).call(this,i).closest(".textLayer"),u=this.getSelectionBoxes(c);if(!u)return;i.empty();const p=g(this,B,Ly).call(this,c),b=n(this,ee)===Z.NONE,y=()=>{const w=p==null?void 0:p.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:u,anchorNode:s,anchorOffset:r,focusNode:a,focusOffset:o,text:l});b&&this.showAllEditors("highlight",!0,!0),e&&(w==null||w.editComment())};if(b){this.switchToMode(Z.HIGHLIGHT,y);return}y()}commentSelection(t=""){this.highlightSelection(t,!0)}endCurrentEditing(){var t;this.commitOrRemove(),(t=this.currentLayer)==null||t.endDrawingSession(!1)}getAndRemoveDataFromAnnotationStorage(t){if(!n(this,je))return null;const e=`${zd}${t}`,i=n(this,je).getRawValue(e);return i&&n(this,je).remove(e),i}addToAnnotationStorage(t){!t.isEmpty()&&n(this,je)&&!n(this,je).has(t.id)&&n(this,je).setValue(t.id,t)}a11yAlert(t,e=null){const i=n(this,hf);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,n(this,Kr)&&(f(this,Kr,!1),g(this,B,lu).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of n(this,vt))if(e.div.contains(t)){f(this,No,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!n(this,No))return;const[t,e]=n(this,No);f(this,No,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){g(this,B,Ry).call(this),this.setEditingState(!0)}removeEditListeners(){g(this,B,a0).call(this),this.setEditingState(!1)}dragOver(t){for(const{type:e}of t.dataTransfer.items)for(const i of n(this,Xi))if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const e of t.dataTransfer.items)for(const i of n(this,Xi))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var i;if(t.preventDefault(),(i=n(this,wi))==null||i.commitOrRemove(),!this.hasSelection)return;const e=[];
2for(const s of n(this,vt)){const r=s.serialize(!0);r&&e.push(r)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();const{clipboardData:e}=t;for(const r of e.items)for(const a of n(this,Xi))if(a.isHandlingMimeForPasting(r.type)){a.paste(r,this.currentLayer);return}let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(r){J(`paste: "${r.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const r=[];for(const l of i){const h=await s.deserialize(l);if(!h)return;r.push(h)}const a=()=>{for(const l of r)g(this,B,Ny).call(this,l);g(this,B,Fy).call(this,r)},o=()=>{for(const l of r)l.remove()};this.addCommands({cmd:a,undo:o,mustExec:!0})}catch(r){J(`paste: "${r.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),n(this,ee)!==Z.NONE&&!this.isEditorHandlingKeyboard&&xr._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,n(this,Kr)&&(f(this,Kr,!1),g(this,B,lu).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(t,e){for(const s of n(this,qh).get(t)||[])s.pageIndex=e;const i=n(this,Kh).get(t);i&&(i.pageIndex=e,n(this,zt).set(e,i),n(this,kn)?i.enable():i.disable())}startUpdatePages(){f(this,Kh,new Map(n(this,zt))),n(this,zt).clear();const t=f(this,qh,new Map),e=i=>{t.getOrInsertComputed(i.pageIndex,Zd).push(i)};for(const i of n(this,Ft).values())e(i);for(const[i,s]of n(this,je))i.startsWith(zd)&&!n(this,Ft).has(i)&&Number.isInteger(s==null?void 0:s.pageIndex)&&e(s)}endUpdatePages(){f(this,Kh,null),f(this,qh,null)}clonePage(t,e){for(const i of this.getEditors(t)){const s=i.serialize(i.mode!==Z.HIGHLIGHT);s&&(s.pageIndex=e,s.id=this.getId(),s.isClone=!0,delete s.popupRef,n(this,je).setValue(s.id,s))}}findClonesForPage(t){const e=[],{pageIndex:i}=t;for(const[s,r]of n(this,je))r.pageIndex===i&&r.isClone&&(n(this,je).remove(s),e.push(t.deserialize(r).then(a=>{a&&(a.isClone=!0,t.addOrRebuild(a))})));return Promise.all(e)}setEditingState(t){t?(g(this,B,n0).call(this),g(this,B,o0).call(this),g(this,B,We).call(this,{isEditing:n(this,ee)!==Z.NONE,isEmpty:g(this,B,hu).call(this),hasSomethingToUndo:n(this,Gi).hasSomethingToUndo(),hasSomethingToRedo:n(this,Gi).hasSomethingToRedo(),hasSelectedEditor:!1})):(g(this,B,r0).call(this),g(this,B,l0).call(this),g(this,B,We).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!n(this,Xi)){f(this,Xi,t);for(const e of n(this,Xi))g(this,B,Sn).call(this,e.defaultPropertiesToUpdate)}}getId(){return n(this,nb).id}get currentLayer(){return n(this,zt).get(n(this,Gr))}getLayer(t){return n(this,zt).get(t)}get currentPageIndex(){return n(this,Gr)}addLayer(t){n(this,zt).set(t.pageIndex,t),n(this,kn)?t.enable():t.disable()}removeLayer(t){n(this,zt).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,s=!1,r=!1,a=!1){var o,l,h,c,u,p;if(n(this,ee)!==t&&!(n(this,Yi)&&(await n(this,Yi).promise,!n(this,Yi)))){if(f(this,Yi,Promise.withResolvers()),(o=n(this,Wr))==null||o.commitOrRemove(),n(this,ee)===Z.POPUP&&((l=n(this,be))==null||l.hideSidebar()),(h=n(this,be))==null||h.destroyPopup(),f(this,ee,t),t===Z.NONE){this.setEditingState(!1),g(this,B,d0).call(this);for(const b of n(this,Ft).values())b.hideStandaloneCommentButton();(c=this._editorUndoBar)==null||c.hide(),this.toggleComment(null),n(this,Yi).resolve();return}for(const b of n(this,Ft).values())b.addStandaloneCommentButton();t===Z.SIGNATURE&&await((u=n(this,Zr))==null?void 0:u.loadSignatures()),i&&Oe.clearPointerType(),this.setEditingState(!0),await g(this,B,c0).call(this),this.unselectAll();for(const b of n(this,zt).values())b.updateMode(t);if(t===Z.POPUP){n(this,Yh)||f(this,Yh,await n(this,sc).getAnnotationsByType(new Set(n(this,Xi).map(w=>w._editorType))));const b=new Set,y=[];for(const w of n(this,Ft).values()){const{annotationElementId:v,hasComment:A,deleted:E}=w;v&&b.add(v),A&&!E&&y.push(w.getData())}for(const w of n(this,Yh)){const{id:v,popupRef:A,contentsObj:E}=w;A&&(E!=null&&E.str)&&!b.has(v)&&!n(this,Xr).has(v)&&y.push(w)}(p=n(this,be))==null||p.showSidebar(y)}if(!e){s&&this.addNewEditorFromKeyboard(),n(this,Yi).resolve();return}for(const b of n(this,Ft).values())b.uid===e?(this.setSelected(b),a?b.editComment():r?b.enterInEditMode():b.focus()):b.unselect();n(this,Yi).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==n(this,ee)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(n(this,Xi)){switch(t){case ot.CREATE:this.currentLayer.addNewEditor(e);return;case ot.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(n(this,af)||f(this,af,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(const i of n(this,vt))i.updateParams(t,e);else for(const i of n(this,Xi))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){var r;for(const a of n(this,Ft).values())a.editorType===t&&a.show(e);(((r=n(this,af))==null?void 0:r.get(ot.HIGHLIGHT_SHOW_ALL))??!0)!==e&&g(this,B,Sn).call(this,[[ot.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(n(this,nf)!==t){f(this,nf,t);for(const e of n(this,zt).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(const e of n(this,Ft).values())e.pageIndex===t&&(yield e)}getEditor(t){return n(this,Ft).get(t)}addEditor(t){n(this,Ft).set(t.id,t)}removeEditor(t){var e,i;t.div.contains(document.activeElement)&&(n(this,$s)&&clearTimeout(n(this,$s)),f(this,$s,setTimeout(()=>{this.focusMainContainer(),f(this,$s,null)},0))),n(this,Ft).delete(t.id),t.annotationElementId&&((e=n(this,Qr))==null||e.delete(t.annotationElementId)),this.unselect(t),(!t.annotationElementId||!n(this,Xr).has(t.annotationElementId))&&((i=n(this,je))==null||i.remove(t.id))}addDeletedAnnotationElement(t){n(this,Xr).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}
2isDeletedAnnotationElement(t){return n(this,Xr).has(t)}removeDeletedAnnotationElement(t){n(this,Xr).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){n(this,wi)!==t&&(f(this,wi,t),t&&g(this,B,Sn).call(this,t.propertiesToUpdate))}updateUI(t){n(this,B,u0)===t&&g(this,B,Sn).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){g(this,B,Sn).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(n(this,vt).has(t)){n(this,vt).delete(t),t.unselect(),g(this,B,We).call(this,{hasSelectedEditor:this.hasSelection});return}n(this,vt).add(t),t.select(),g(this,B,Sn).call(this,t.propertiesToUpdate),g(this,B,We).call(this,{hasSelectedEditor:!0})}setSelected(t){var e,i;this.updateToolbar({mode:t.mode,editId:t.uid}),(e=n(this,Wr))==null||e.commitOrRemove();for(const s of n(this,vt))s!==t&&s.unselect();(i=n(this,be))==null||i.destroyPopup(),n(this,vt).clear(),n(this,vt).add(t),t.select(),g(this,B,Sn).call(this,t.propertiesToUpdate),g(this,B,We).call(this,{hasSelectedEditor:!0})}get firstSelectedEditor(){return n(this,vt).values().next().value}unselect(t){t.unselect(),n(this,vt).delete(t),g(this,B,We).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return n(this,vt).size!==0}get isEnterHandled(){return n(this,vt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var t;n(this,Gi).undo(),g(this,B,We).call(this,{hasSomethingToUndo:n(this,Gi).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:g(this,B,hu).call(this)}),(t=this._editorUndoBar)==null||t.hide()}redo(){n(this,Gi).redo(),g(this,B,We).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:n(this,Gi).hasSomethingToRedo(),isEmpty:g(this,B,hu).call(this)})}addCommands(t){n(this,Gi).add(t),g(this,B,We).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:g(this,B,hu).call(this)})}cleanUndoStack(t){n(this,Gi).cleanType(t)}delete(){var r;this.commitOrRemove();const t=(r=this.currentLayer)==null?void 0:r.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...n(this,vt)],i=()=>{var a;(a=this._editorUndoBar)==null||a.show(s,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},s=()=>{for(const a of e)g(this,B,Ny).call(this,a)};this.addCommands({cmd:i,undo:s,mustExec:!0})}commitOrRemove(){var t;(t=n(this,wi))==null||t.commitOrRemove()}hasSomethingToControl(){return n(this,wi)||this.hasSelection}selectAll(){for(const t of n(this,vt))t.commit();g(this,B,Fy).call(this,n(this,Ft).values())}unselectAll(){var t,e;if(!(n(this,wi)&&(n(this,wi).commitOrRemove(),n(this,ee)!==Z.NONE))&&!((t=n(this,Wr))!=null&&t.commitOrRemove())&&((e=n(this,be))==null||e.destroyPopup(),!!this.hasSelection)){for(const i of n(this,vt))i.unselect();n(this,vt).clear(),g(this,B,We).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;n(this,ta)[0]+=t,n(this,ta)[1]+=e;const[s,r]=n(this,ta),a=[...n(this,vt)],o=1e3;n(this,Hs)&&clearTimeout(n(this,Hs)),f(this,Hs,setTimeout(()=>{f(this,Hs,null),n(this,ta)[0]=n(this,ta)[1]=0,this.addCommands({cmd:()=>{for(const l of a)n(this,Ft).has(l.id)&&(l.translateInPage(s,r),l.translationDone())},undo:()=>{for(const l of a)n(this,Ft).has(l.id)&&(l.translateInPage(-s,-r),l.translationDone())},mustExec:!1})},o));for(const l of a)l.translateInPage(t,e),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),f(this,Us,new Map);for(const t of n(this,vt))n(this,Us).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!n(this,Us))return!1;this.disableUserSelect(!1);const t=n(this,Us);f(this,Us,null);let e=!1;for(const[{x:s,y:r,pageIndex:a},o]of t)o.newX=s,o.newY=r,o.newPageIndex=a,e||(e=s!==o.savedX||r!==o.savedY||a!==o.savedPageIndex);if(!e)return!1;const i=(s,r,a,o)=>{if(n(this,Ft).has(s.id)){const l=n(this,zt).get(o);l?s._setParentAndPosition(l,r,a):(s.pageIndex=o,s.x=r,s.y=a)}};return this.addCommands({cmd:()=>{for(const[s,{newX:r,newY:a,newPageIndex:o}]of t)i(s,r,a,o)},undo:()=>{for(const[s,{savedX:r,savedY:a,savedPageIndex:o}]of t)i(s,r,a,o)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(n(this,Us))for(const i of n(this,Us).keys())i.drag(t,e)}rebuild(t){if(t.parent===null){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return((t=this.getActive())==null?void 0:t.shouldGetKeyboardEvents())||n(this,vt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return n(this,wi)===t}getActive(){return n(this,wi)}getMode(){return n(this,ee)}isEditingMode(){return n(this,ee)!==Z.NONE}get imageManager(){return Y(this,"imageManager",new Iy)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,c=e.rangeCount;h<c;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:i,y:s,width:r,height:a}=t.getBoundingClientRect();let o;switch(t.getAttribute("data-main-rotation")){case"90":o=(h,c,u,p)=>({x:(c-s)/a,y:1-(h+u-i)/r,width:p/a,height:u/r});break;case"180":o=(h,c,u,p)=>({x:1-(h+u-i)/r,y:1-(c+p-s)/a,width:u/r,height:p/a});break;case"270":o=(h,c,u,p)=>({x:1-(c+p-s)/a,y:(h-i)/r,width:p/a,height:u/r});break;default:o=(h,c,u,p)=>({x:(h-i)/r,y:(c-s)/a,width:u/r,height:p/a});break}const l=[];for(let h=0,c=e.rangeCount;h<c;h++){const u=e.getRangeAt(h);if(!u.collapsed)for(const{x:p,y:b,width:y,height:w}of u.getClientRects())y===0||w===0||l.push(o(p,b,y,w))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:t,id:e}){(n(this,Zh)||f(this,Zh,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){var e;(e=n(this,Zh))==null||e.delete(t)}renderAnnotationElement(t){var s;const e=(s=n(this,Zh))==null?void 0:s.get(t.data.id);if(!e)return;const i=n(this,je).getRawValue(e);
2i&&(n(this,ee)===Z.NONE&&!i.hasBeenModified||i.renderAnnotationElement(t))}setMissingCanvas(t,e,i){var r;const s=(r=n(this,Qr))==null?void 0:r.get(t);s&&(s.setCanvas(e,i),n(this,Qr).delete(t))}addMissingCanvas(t,e){(n(this,Qr)||f(this,Qr,new Map)).set(t,e)}},Xh=new WeakMap,wi=new WeakMap,Yh=new WeakMap,Ft=new WeakMap,zt=new WeakMap,Kh=new WeakMap,qh=new WeakMap,Qh=new WeakMap,je=new WeakMap,Zh=new WeakMap,Gi=new WeakMap,be=new WeakMap,zr=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Xr=new WeakMap,Us=new WeakMap,Xi=new WeakMap,Ro=new WeakMap,tf=new WeakMap,ef=new WeakMap,Jh=new WeakMap,sf=new WeakMap,$s=new WeakMap,Yr=new WeakMap,tc=new WeakMap,Kr=new WeakMap,Vs=new WeakMap,nb=new WeakMap,kn=new WeakMap,ec=new WeakMap,nf=new WeakMap,qr=new WeakMap,No=new WeakMap,ic=new WeakMap,Qr=new WeakMap,rf=new WeakMap,ee=new WeakMap,vt=new WeakMap,Mn=new WeakMap,Zr=new WeakMap,Jr=new WeakMap,af=new WeakMap,sc=new WeakMap,of=new WeakMap,ta=new WeakMap,Hs=new WeakMap,In=new WeakMap,lf=new WeakMap,hf=new WeakMap,Yi=new WeakMap,B=new WeakSet,Xg=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},Ly=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of n(this,zt).values())if(i.hasTextLayer(t))return i;return null},e0=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const i=g(this,B,Xg).call(this,t).closest(".textLayer"),s=this.getSelectionBoxes(i);s&&(n(this,Vs)||f(this,Vs,new Z_(this)),n(this,Vs).show(i,s,this.direction==="ltr"))},i0=function(){var r,a,o;const t=document.getSelection();if(!t||t.isCollapsed){n(this,Mn)&&((r=n(this,Vs))==null||r.hide(),f(this,Mn,null),g(this,B,We).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=t;if(e===n(this,Mn))return;const s=g(this,B,Xg).call(this,t).closest(".textLayer");if(!s){n(this,Mn)&&((a=n(this,Vs))==null||a.hide(),f(this,Mn,null),g(this,B,We).call(this,{hasSelectedText:!1}));return}if((o=n(this,Vs))==null||o.hide(),f(this,Mn,e),g(this,B,We).call(this,{hasSelectedText:!0}),!(n(this,ee)!==Z.HIGHLIGHT&&n(this,ee)!==Z.NONE)&&(n(this,ee)===Z.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),f(this,Kr,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=n(this,ee)===Z.HIGHLIGHT?g(this,B,Ly).call(this,s):null;if(l==null||l.toggleDrawing(),n(this,ec)){const h=new AbortController,c=this.combinedSignal(h),u=p=>{p.type==="pointerup"&&p.button!==0||(h.abort(),l==null||l.toggleDrawing(!0),p.type==="pointerup"&&g(this,B,lu).call(this,"main_toolbar"))};window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("blur",u,{signal:c})}else l==null||l.toggleDrawing(!0),g(this,B,lu).call(this,"main_toolbar")}},lu=function(t=""){n(this,ee)===Z.HIGHLIGHT?this.highlightSelection(t):n(this,tf)&&g(this,B,e0).call(this)},s0=function(){document.addEventListener("selectionchange",g(this,B,i0).bind(this),{signal:this._signal})},n0=function(){if(n(this,Yr))return;f(this,Yr,new AbortController);const t=this.combinedSignal(n(this,Yr));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},r0=function(){var t;(t=n(this,Yr))==null||t.abort(),f(this,Yr,null)},Ry=function(){if(n(this,qr))return;f(this,qr,new AbortController);const t=this.combinedSignal(n(this,qr));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},a0=function(){var t;(t=n(this,qr))==null||t.abort(),f(this,qr,null)},o0=function(){if(n(this,zr))return;f(this,zr,new AbortController);const t=this.combinedSignal(n(this,zr));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},l0=function(){var t;(t=n(this,zr))==null||t.abort(),f(this,zr,null)},h0=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},We=function(t){Object.entries(t).some(([i,s])=>n(this,of)[i]!==s)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(n(this,of),t)}
2),n(this,ee)===Z.HIGHLIGHT&&t.hasSelectedEditor===!1&&g(this,B,Sn).call(this,[[ot.HIGHLIGHT_FREE,!0]]))},Sn=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},c0=async function(){if(!n(this,kn)){f(this,kn,!0);const t=[];for(const e of n(this,zt).values())t.push(e.enable());await Promise.all(t);for(const e of n(this,Ft).values())e.enable()}},d0=function(){if(this.unselectAll(),n(this,kn)){f(this,kn,!1);for(const t of n(this,zt).values())t.disable();for(const t of n(this,Ft).values())t.disable()}},Ny=function(t){const e=n(this,zt).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},u0=function(){let t=null;for(t of n(this,vt));return t},hu=function(){if(n(this,Ft).size===0)return!0;if(n(this,Ft).size===1)for(const t of n(this,Ft).values())return t.isEmpty();return!1},Fy=function(t){for(const e of n(this,vt))e.unselect();n(this,vt).clear();for(const e of t)e.isEmpty()||(n(this,vt).add(e),e.select());g(this,B,We).call(this,{hasSelectedEditor:this.hasSelection})},T(xr,"TRANSLATE_SMALL",1),T(xr,"TRANSLATE_BIG",10),xr);var ye,zs,fs,nc,Ws,vi,rc,Gs,li,Dn,Fo,Xs,ea,Ms,cu,Yg;const Ge=class Ge{constructor(t){m(this,Ms);m(this,ye,null);m(this,zs,!1);m(this,fs,null);m(this,nc,null);m(this,Ws,null);m(this,vi,null);m(this,rc,!1);m(this,Gs,null);m(this,li,null);m(this,Dn,null);m(this,Fo,null);m(this,Xs,!1);f(this,li,t),f(this,Xs,t._uiManager.useNewAltTextFlow),n(Ge,ea)||f(Ge,ea,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){Ge._l10n??(Ge._l10n=t)}async render(){const t=f(this,fs,document.createElement("button"));t.className="altText",t.tabIndex="0";const e=f(this,nc,document.createElement("span"));t.append(e),n(this,Xs)?(t.classList.add("new"),t.setAttribute("data-l10n-id",n(Ge,ea).missing),e.setAttribute("data-l10n-id",n(Ge,ea)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=n(this,li)._uiManager._signal;t.addEventListener("contextmenu",Is,{signal:i}),t.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:i});const s=r=>{r.preventDefault(),n(this,li)._uiManager.editAltText(n(this,li)),n(this,Xs)&&n(this,li)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:n(this,Ms,cu)}})};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",r=>{r.target===t&&r.key==="Enter"&&(f(this,rc,!0),s(r))},{signal:i}),await g(this,Ms,Yg).call(this),t}finish(){n(this,fs)&&(n(this,fs).focus({focusVisible:n(this,rc)}),f(this,rc,!1))}isEmpty(){return n(this,Xs)?n(this,ye)===null:!n(this,ye)&&!n(this,zs)}hasData(){return n(this,Xs)?n(this,ye)!==null||!!n(this,Dn):this.isEmpty()}get guessedText(){return n(this,Dn)}async setGuessedText(t){n(this,ye)===null&&(f(this,Dn,t),f(this,Fo,await Ge._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),g(this,Ms,Yg).call(this))}toggleAltTextBadge(t=!1){var e;if(!n(this,Xs)||n(this,ye)){(e=n(this,Gs))==null||e.remove(),f(this,Gs,null);return}if(!n(this,Gs)){const i=f(this,Gs,document.createElement("div"));i.className="noAltTextBadge",n(this,li).div.append(i)}n(this,Gs).classList.toggle("hidden",!t)}serialize(t){let e=n(this,ye);return!t&&n(this,Dn)===e&&(e=n(this,Fo)),{altText:e,decorative:n(this,zs),guessedText:n(this,Dn),textWithDisclaimer:n(this,Fo)}}get data(){return{altText:n(this,ye),decorative:n(this,zs)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:s,cancel:r=!1}){i&&(f(this,Dn,i),f(this,Fo,s)),!(n(this,ye)===t&&n(this,zs)===e)&&(r||(f(this,ye,t),f(this,zs,e)),g(this,Ms,Yg).call(this))}toggle(t=!1){n(this,fs)&&(!t&&n(this,vi)&&(clearTimeout(n(this,vi)),f(this,vi,null)),n(this,fs).disabled=!t)}shown(){n(this,li)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:n(this,Ms,cu)}})}destroy(){var t,e;(t=n(this,fs))==null||t.remove(),f(this,fs,null),f(this,nc,null),f(this,Ws,null),(e=n(this,Gs))==null||e.remove(),f(this,Gs,null)}};ye=new WeakMap,zs=new WeakMap,fs=new WeakMap,nc=new WeakMap,Ws=new WeakMap,vi=new WeakMap,rc=new WeakMap,Gs=new WeakMap,li=new WeakMap,Dn=new WeakMap,Fo=new WeakMap,Xs=new WeakMap,ea=new WeakMap,Ms=new WeakSet,cu=function(){return n(this,ye)&&"added"||n(this,ye)===null&&this.guessedText&&"review"||"missing"},Yg=async function(){var s,r,a;const t=n(this,fs);if(!t)return;
2if(n(this,Xs)){if(t.classList.toggle("done",!!n(this,ye)),t.setAttribute("data-l10n-id",n(Ge,ea)[n(this,Ms,cu)]),(s=n(this,nc))==null||s.setAttribute("data-l10n-id",n(Ge,ea)[`${n(this,Ms,cu)}-label`]),!n(this,ye)){(r=n(this,Ws))==null||r.remove();return}}else{if(!n(this,ye)&&!n(this,zs)){t.classList.remove("done"),(a=n(this,Ws))==null||a.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=n(this,Ws);if(!e){f(this,Ws,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${n(this,li).id}`;const o=100,l=n(this,li)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(n(this,vi)),f(this,vi,null)},{once:!0}),t.addEventListener("mouseenter",()=>{f(this,vi,setTimeout(()=>{f(this,vi,null),n(this,Ws).classList.add("show"),n(this,li)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),t.addEventListener("mouseleave",()=>{var h;n(this,vi)&&(clearTimeout(n(this,vi)),f(this,vi,null)),(h=n(this,Ws))==null||h.classList.remove("show")},{signal:l})}n(this,zs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=n(this,ye)),e.parentNode||t.append(e);const i=n(this,li).getElementForAltText();i==null||i.setAttribute("aria-describedby",e.id)},m(Ge,ea,null),T(Ge,"_l10n",null);let Wm=Ge;var _e,Ki,Oo,Mt,cf,ia,qi,sa,na,Bo,df,Oy;class Mg{constructor(t){m(this,df);m(this,_e,null);m(this,Ki,null);m(this,Oo,!1);m(this,Mt,null);m(this,cf,null);m(this,ia,null);m(this,qi,null);m(this,sa,null);m(this,na,!1);m(this,Bo,null);f(this,Mt,t)}renderForToolbar(){const t=f(this,Ki,document.createElement("button"));return t.className="comment",g(this,df,Oy).call(this,t,!1)}renderForStandalone(){const t=f(this,_e,document.createElement("button"));t.className="annotationCommentButton";const e=n(this,Mt).commentButtonPosition;if(e){const{style:i}=t;i.insetInlineEnd=`calc(${100*(n(this,Mt)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;const s=n(this,Mt).commentButtonColor;s&&(i.backgroundColor=s)}return g(this,df,Oy).call(this,t,!0)}focusButton(){setTimeout(()=>{var t;(t=n(this,_e)??n(this,Ki))==null||t.focus()},0)}onUpdatedColor(){if(!n(this,_e))return;const t=n(this,Mt).commentButtonColor;t&&(n(this,_e).style.backgroundColor=t),n(this,Mt)._uiManager.updatePopupColor(n(this,Mt))}get commentButtonWidth(){var t;return(((t=n(this,_e))==null?void 0:t.getBoundingClientRect().width)??0)/n(this,Mt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(n(this,Bo))return n(this,Bo);if(!n(this,_e))return null;const{x:t,y:e,height:i}=n(this,_e).getBoundingClientRect(),{x:s,y:r,width:a,height:o}=n(this,Mt).parent.boundingClientRect;return[(t-s)/a,(e+i-r)/o]}set commentPopupPositionInLayer(t){f(this,Bo,t)}hasDefaultPopupPosition(){return n(this,Bo)===null}removeStandaloneCommentButton(){var t;(t=n(this,_e))==null||t.remove(),f(this,_e,null)}removeToolbarCommentButton(){var t;(t=n(this,Ki))==null||t.remove(),f(this,Ki,null)}setCommentButtonStates({selected:t,hasPopup:e}){n(this,_e)&&(n(this,_e).classList.toggle("selected",t),n(this,_e).ariaExpanded=e)}edit(t){const e=this.commentPopupPositionInLayer;let i,s;if(e)[i,s]=e;else{[i,s]=n(this,Mt).commentButtonPosition;const{width:c,height:u,x:p,y:b}=n(this,Mt);i=p+i*c,s=b+s*u}const r=n(this,Mt).parent.boundingClientRect,{x:a,y:o,width:l,height:h}=r;n(this,Mt)._uiManager.editComment(n(this,Mt),a+i*l,o+s*h,{...t,parentDimensions:r})}finish(){n(this,Ki)&&(n(this,Ki).focus({focusVisible:n(this,Oo)}),f(this,Oo,!1))}isDeleted(){return n(this,na)||n(this,qi)===""}isEmpty(){return n(this,qi)===null}hasBeenEdited(){return this.isDeleted()||n(this,qi)!==n(this,cf)}serialize(){return this.data}get data(){return{text:n(this,qi),richText:n(this,ia),date:n(this,sa),deleted:this.isDeleted()}}set data(t){if(t!==n(this,qi)&&f(this,ia,null),t===null){f(this,qi,""),f(this,na,!0);return}f(this,qi,t),f(this,sa,new Date),f(this,na,!1)}restoreData({text:t,richText:e,date:i}){f(this,qi,t),f(this,ia,e),f(this,sa,i),f(this,na,!1)}setInitialText(t,e=null){f(this,cf,t),this.data=t,f(this,sa,null),f(this,ia,e)}shown(){}destroy(){var t,e;(t=n(this,Ki))==null||t.remove(),f(this,Ki,null),(e=n(this,_e))==null||e.remove(),f(this,_e,null),f(this,qi,""),f(this,ia,null),f(this,sa,null),f(this,Mt,null),f(this,Oo,!1),f(this,na,!1)}}_e=new WeakMap,Ki=new WeakMap,Oo=new WeakMap,Mt=new WeakMap,cf=ne
2w WeakMap,ia=new WeakMap,qi=new WeakMap,sa=new WeakMap,na=new WeakMap,Bo=new WeakMap,df=new WeakSet,Oy=function(t,e){if(!n(this,Mt)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[n(this,Mt)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const i=n(this,Mt)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",Is,{signal:i}),e&&(t.addEventListener("focusin",r=>{n(this,Mt)._focusEventsAllowed=!1,fe(r)},{capture:!0,signal:i}),t.addEventListener("focusout",r=>{n(this,Mt)._focusEventsAllowed=!0,fe(r)},{capture:!0,signal:i})),t.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:i});const s=r=>{r.preventDefault(),t===n(this,Ki)?this.edit():n(this,Mt).toggleComment(!0)};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",r=>{r.target===t&&r.key==="Enter"&&(f(this,Oo,!0),s(r))},{signal:i}),t.addEventListener("pointerenter",()=>{n(this,Mt).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{n(this,Mt).toggleComment(!1,!1)},{signal:i}),t};function DA(d){d.preventDefault()}const LA=1e-4;function ny(d){return d.cancelable?(fe(d),!0):(d.stopPropagation(),!1)}var ac,ra,uf,ff,pf,gf,mf,jo,aa,Ln,Uo,Ys,Rn,$o,Nn,oa,Ut,p0,By,jy,Uy,Kg,g0,m0,$y,BE;let f0=(BE=class{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:s=null,onPinching:r=null,onPinchEnd:a=null,onPanning:o=null,signal:l}){m(this,Ut);m(this,ac);m(this,ra,!1);m(this,uf,null);m(this,ff);m(this,pf);m(this,gf);m(this,mf);m(this,jo);m(this,aa,!1);m(this,Ln,null);m(this,Uo);m(this,Ys,new Set);m(this,Rn,null);m(this,$o);m(this,Nn,null);m(this,oa,0);f(this,ac,t),f(this,uf,i),f(this,ff,e),f(this,pf,s),f(this,gf,r),f(this,mf,a),f(this,jo,o),f(this,$o,new AbortController),f(this,Uo,AbortSignal.any([l,n(this,$o).signal])),t.addEventListener("touchstart",g(this,Ut,p0).bind(this),{passive:!1,signal:n(this,Uo)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/uo.pixelRatio}get MIN_TOUCH_DISTANCE_TO_SCALE(){return 4/uo.pixelRatio}destroy(){var t,e;g(this,Ut,$y).call(this),n(this,Ys).clear(),(t=n(this,$o))==null||t.abort(),f(this,$o,null),(e=n(this,Ln))==null||e.abort(),f(this,Ln,null)}},ac=new WeakMap,ra=new WeakMap,uf=new WeakMap,ff=new WeakMap,pf=new WeakMap,gf=new WeakMap,mf=new WeakMap,jo=new WeakMap,aa=new WeakMap,Ln=new WeakMap,Uo=new WeakMap,Ys=new WeakMap,Rn=new WeakMap,$o=new WeakMap,Nn=new WeakMap,oa=new WeakMap,Ut=new WeakSet,p0=function(t){var i,s;if((i=n(this,ff))!=null&&i.call(this))return;g(this,Ut,jy).call(this,t);const e=n(this,Ys);for(const{identifier:r}of t.changedTouches)e.add(r);if(e.size===1){g(this,Ut,By).call(this);return}if(!n(this,Nn)){f(this,Nn,new AbortController);const r=AbortSignal.any([n(this,Uo),n(this,Nn).signal]),a=n(this,ac),o={signal:r,capture:!1,passive:!1};a.addEventListener("touchmove",g(this,Ut,g0).bind(this),o);const l=g(this,Ut,m0).bind(this);a.addEventListener("touchend",l,o),a.addEventListener("touchcancel",l,o),o.capture=!0,a.addEventListener("pointerdown",fe,o),a.addEventListener("pointermove",fe,o),a.addEventListener("pointercancel",DA,o),a.addEventListener("pointerup",DA,o),(s=n(this,pf))==null||s.call(this)}f(this,aa,ny(t)),g(this,Ut,Kg).call(this,t)},By=function(){if(n(this,Ln))return;const t=f(this,Ln,new AbortController),e=AbortSignal.any([n(this,Uo),t.signal]),i=n(this,ac),s={capture:!0,signal:e,passive:!1},r=a=>{var o;a.pointerType==="touch"&&((o=n(this,Ln))==null||o.abort(),f(this,Ln,null))};i.addEventListener("pointerdown",a=>{a.pointerType==="touch"&&(fe(a),r(a))},s),i.addEventListener("pointerup",r,s),i.addEventListener("pointercancel",r,s)},jy=function(t){const e=n(this,Ys);if(e.size===0)return;const i=f(this,Ys,new Set);for(const{identifier:s}of t.touches)e.has(s)&&i.add(s)},Uy=function(t){const e=n(this,Ys),i=[];for(const s of t.touches)e.has(s.identifier)&&i.push(s);return i},Kg=function(t){var r;const e=g(this,Ut,Uy).call(this,t);if(e.length!==2||(r=n(this,uf))!=null&&r.call(this)){f(this,Rn,null);return}const[i,s]=e;f(this,Rn,{touch0X:i.screenX,touch0Y:i.screenY,touch1X:s.screenX,touch1Y:s.screenY,panX:(i.clientX+s.clientX)/2,panY:(i.clientY+s.clientY)/2,screenPanX:(i.screenX+s.screenX)/2,screenPanY:(i.screenY+s.screenY)/2})},g0=function(t){var R,j,nt,gt;if(!n(this,Rn))return;const e=g(this,Ut,Uy).call(this,t);if(e.length!==2)return;const i=n(this,aa);if(f(this,aa,ny(t)),!n(this,aa))return;if(!i){g(this,Ut,Kg).call(this,t);return}const[s,r]=e,{screenX:a,screenY:o}=s,{screenX:l,screenY:h}=r,c=n(this,Rn),{touch0X:u,touch0Y:p,touch1X:b,touch1Y:y,panX:w,panY:v}=c,A=b-u,E=y-p,S=l-a,x=h-o,_=(s.clientX+r.clientX)/2,C=(s.clientY+r.clientY)/2;c.panX=_,c.panY=C;const k=_-w,D=C-v,P=(a+l)/2,I=(o+h)/2,L=Math.hypot(P-c.screenPanX,I-c.screenPanY);c.screenPanX=P,c.screenPanY=I;const O=Math.hypot(S,x),H=Math.hypot(A,E),W=n(this,ra)?this.MIN_TOUCH_DISTANCE_TO_SCALE:this.MIN_TOUCH_DISTANCE_TO_PINCH+2*L;if(O<LA||H<LA||Math.abs(H-O)<=W){(k||D)&&((R=n(this,jo))==null||R.call(this,k,D));return}c.touch0X=a,c.touch0Y=o,c.touch1X=l,c.touch1Y=h;const pt=Math.sign(O-H);if(!n(this,ra)){f(this,ra,!0),f(this,oa,pt),(k||D)&&((j=n(this,jo))==null||j.call(this,k,D));return}if(n(this,oa)){const ze=n(this,oa);if(f(this,oa,0),pt!==ze&&Math.abs(O-H)<=2*L){f(this,ra,!1),(k||D)&&((nt=n(this,jo))==null||nt.call(this,k,D));return}}(gt=n(this,gf))==null||gt.call(this,[w,v],H,O,k,D)},m0=function(t){if(g(this,Ut,jy).call(this,t),n(this,Ys).size>=2){g(this,Ut,Kg).call(this,t);return}const e=!!n(this,Rn);g(this,Ut,$y).call(this),n(this,Ys).size===1&&g(this,Ut,By).call(this),e&&ny(t)},$y=function(){var t;f(this,Rn,null),f(this,ra,!1),f(this,oa,0),f(this,aa,!1),n(this,Nn)&&(n(this,Nn).abort(),f(this,Nn,null),(t=n(this,mf))==null||t.call(this))},BE);var Vo,ps,Ot,mt,Fn,oc,la,bf,Ce,Ho,On,Qi,ha,yf,zo,Ai,wf,Wo,Bn,Ks,lc,hc,Zi,ca,vf,rb,K,Vy,Af,Hy,qg,b0,y0,zy,Qg,Wy,w0,v0,A0,Gy,E0,Xy,Yy,S0,x0,_0,Ky,du;const Q=class Q{constructor(t){m(this,K);m(this,Vo,null);m(this,ps,null);m(this,Ot,null);m(this,mt,null);m(this,Fn,null);m(this,oc,!1);m(this,la,null);m(this,bf,"");m(this,Ce,null);m(this,Ho,null);m(this,On,null);m(this,Qi,null);m(this,ha,null);m(this,yf,"");m(this,zo,!1);m(this,Ai,null);m(this,wf,!1);m(this,Wo,!1);m(this,Bn,!1);m(this,Ks,null);m(this,lc,0);m(this,hc,0);m(this,Zi,null);m(this,ca,null);T(this,"isSelected",!1);T(this,"_isCopy",!1);T(this,"_editToolbar",null);T(this,"_initialOptions",Object.create(null));T(this,"_initialData",null);T(this,"_isVisible",!0);T(this,"_uiManager",null);T(this,"_focusEventsAllowed",!0);m(this,vf,!1);m(this,rb,Q._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;const{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:r,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[r,a];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=Q.prototype._resizeWithKeyboard,e=ju.TRANSLATE_SMALL,i=ju.TRANSLATE_BIG;return Y(this,"_resizerKeyboardManager",new wh([[["ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape"],Q.prototype._stopResizingWithKeyboard]]))}updatePageIndex(t){this.pageIndex=t}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Y(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new iC({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(Q._l10n??(Q._l10n=t),Q._l10nAlert??(Q._l10nAlert=Object.freeze({highlight:"pdfjs-editor-highlight-added-alert",freetext:"pdfjs-editor-freetext-added-alert",ink:"pdfjs-editor-ink-added-alert",stamp:"pdfjs-editor-stamp-added-alert",signature:"pdfjs-editor-signature-added-alert"})),Q._l10nResizer??(Q._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),Q._borderLineWidth!==-1)return;const i=getComputedStyle(document.documentElement);Q._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){lt("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return n(this,vf)}set _isDraggable(t){var e;f(this,vf,t),(e=this.div)==null||e.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=n(this,rb)}setParent(t){var e;t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(g(this,K,du).call(this),(e=n(this,Qi))==null||e.remove(),f(this,Qi,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(n(this,zo)?f(this,zo,!1):this.parent.setSelected(this))}focusout(t){var i;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=t.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(t.preventDefault(),(i=this.parent)!=null&&i.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){const[r,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/r,this.y=(e+s)/a,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s),this._onTranslated()}translate(t,e){g(this,K,Vy).call(this,this.parentDimensions,t,e)}translateInPage(t,e){n(this,Ai)||f(this,Ai,[this.x,this.y,this.width,this.height]),g(this,K,Vy).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){n(this,Ai)||f(this,Ai,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[s,r]}=this;if(this.x+=t/s,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:p}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,p)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:o}=this;const[l,h]=this.getBaseTranslation();a+=l,o+=h;const{style:c}=i;c.left=`${(100*a).toFixed(2)}%`,c.top=`${(100*o).toFixed(2)}%`,this._onTranslating(a,o)}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!n(this,Ai)&&(n(this,Ai)[0]!==this.x||n(this,Ai)[1]!==this.y)}get _hasBeenResized(){return!!n(this,Ai)&&(n(this,Ai)[2]!==this.width||n(this,Ai)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=Q,s=i/t,r=i/e;switch(this.rotation){case 90:return[-s,r];case 180:return[s,r];case 270:return[s,-r];default:return[-s,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[i,s]}=this;let{x:r,y:a,width:o,height:l}=this;if(o*=i,l*=s,r*=i,a*=s,this._mustFixPosition)switch(t){case 0:r=Nt(r,0,i-o),a=Nt(a,0,s-l);break;case 90:r=Nt(r,0,i-l),a=Nt(a,o,s);break;case 180:r=Nt(r,o,i),a=Nt(a,l,s);break;case 270:r=Nt(r,l,i),a=Nt(a,0,s-o);break}this.x=r/=i,this.y=a/=s;const[h,c]=this.getBaseTranslation();r+=h,a+=c,e.left=`${(100*r).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var i;return g(i=Q,Af,Hy).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return g(i=Q,Af,Hy).call(i,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){const{div:{style:t},width:e,height:i}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=n(this,Ot))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||n(this,Wo))return this._editToolbar;this._editToolbar=new ky(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){var t;(t=this._editToolbar)==null||t.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}
2removeCommentButtonFromToolbar(){var t;(t=this._editToolbar)==null||t.removeButton("comment")}removeEditToolbar(){var t,e;(t=this._editToolbar)==null||t.remove(),this._editToolbar=null,(e=n(this,Ot))==null||e.destroy()}addContainer(t){var i;const e=(i=this._editToolbar)==null?void 0:i.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return n(this,Ot)||(Wm.initialize(Q._l10n),f(this,Ot,new Wm(this)),n(this,Vo)&&(n(this,Ot).data=n(this,Vo),f(this,Vo,null))),n(this,Ot)}get altTextData(){var t;return(t=n(this,Ot))==null?void 0:t.data}set altTextData(t){n(this,Ot)&&(n(this,Ot).data=t)}get guessedAltText(){var t;return(t=n(this,Ot))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=n(this,Ot))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=n(this,Ot))==null?void 0:e.serialize(t)}hasAltText(){return!!n(this,Ot)&&!n(this,Ot).isEmpty()}hasAltTextData(){var t;return((t=n(this,Ot))==null?void 0:t.hasData())??!1}focusCommentButton(){var t;(t=n(this,mt))==null||t.focusButton()}addCommentButton(){return this.canAddComment?n(this,mt)||f(this,mt,new Mg(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(n(this,Fn)){this._uiManager.isEditingMode()&&n(this,Fn).classList.remove("hidden");return}this.hasComment&&(f(this,Fn,n(this,mt).renderForStandalone()),this.div.append(n(this,Fn)))}}removeStandaloneCommentButton(){n(this,mt).removeStandaloneCommentButton(),f(this,Fn,null)}hideStandaloneCommentButton(){var t;(t=n(this,Fn))==null||t.classList.add("hidden")}get comment(){if(!n(this,mt))return null;const{data:{richText:t,text:e,date:i,deleted:s}}=n(this,mt);return{text:e,richText:t,date:i,deleted:s,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){n(this,mt)||f(this,mt,new Mg(this)),typeof t=="object"&&t!==null?n(this,mt).restoreData(t):n(this,mt).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:i}){if(!e||(n(this,mt)||f(this,mt,new Mg(this)),n(this,mt).setInitialText(t,i),!this.annotationElementId))return;const s=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);s&&this.updateFromAnnotationLayer(s)}get hasEditedComment(){var t;return(t=n(this,mt))==null?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return(t=n(this,mt))==null?void 0:t.isDeleted()}get hasComment(){return!!n(this,mt)&&!n(this,mt).isEmpty()&&!n(this,mt).isDeleted()}async editComment(t){n(this,mt)||f(this,mt,new Mg(this)),n(this,mt).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){n(this,mt).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const[,,,s]=t.rect,[r]=this.pageDimensions,[a]=this.pageTranslation,o=a+r+1,l=s-100,h=o+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[o,l,h,s]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){n(this,mt).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var a;const t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=n(this,oc)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),g(this,K,Xy).call(this);const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*i/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[s,r]=this.getInitialTranslation();return this.translate(s,r),ZE(this,t,["keydown","pointerdown","dblclick"]),g(this,K,Yy).call(this),this.addStandaloneCommentButton(),(a=this._uiManager._editorUndoBar)==null||a.hide(),t}pointerdown(t){const{isMac:e}=xt.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(f(this,zo,!0),this._isDraggable){g(this,K,E0).call(this,t);return}g(this,K,Gy).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){n(this,Ks)&&clearTimeout(n(this,Ks)),f(this,Ks,setTimeout(()=>{var t;f(this,Ks,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}
2_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,i=this.rotation){const s=this.parentScale,[r,a]=this.pageDimensions,[o,l]=this.pageTranslation,h=t/s,c=e/s,u=this.x*r,p=this.y*a,b=this.width*r,y=this.height*a;switch(i){case 0:return[u+h+o,a-p-c-y+l,u+h+b+o,a-p-c+l];case 90:return[u+c+o,a-p+h+l,u+c+y+o,a-p+h+b+l];case 180:return[u-h-b+o,a-p+c+l,u-h+o,a-p+c+y+l];case 270:return[u-c-y+o,a-p-h-b+l,u-c+o,a-p-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,s,r,a]=t,o=r-i,l=a-s;switch(this.rotation){case 0:return[i,e-a,o,l];case 90:return[i,e-s,l,o];case 180:return[r,e-s,o,l];case 270:return[r,e-a,l,o];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Q._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;(t=n(this,mt))==null||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:i,opacity:s,deleted:r,richText:a},uid:o,pageIndex:l,creationDate:h,modificationDate:c}=this;return{id:o,pageIndex:l,rect:this.getPDFRect(),richText:a,contentsObj:{str:t},creationDate:h,modificationDate:i||c,popupRef:!r,color:e,opacity:s}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),f(this,Wo,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),f(this,Wo,!1),!0):!1}isInEditMode(){return n(this,Wo)}shouldGetKeyboardEvents(){return n(this,Bn)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:i,right:s}=this.getClientDimensions(),{innerHeight:r,innerWidth:a}=window;return e<a&&s>0&&t<r&&i>0}rebuild(){g(this,K,Xy).call(this),g(this,K,Yy).call(this)}rotate(t){}resize(){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((t=this._initialData)==null?void 0:t.popupRef)||""}}serialize(t=!1,e=null){var i;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((i=this._initialData)==null?void 0:i.popupRef)||""}}static async deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:i.getId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});s.rotation=t.rotation,f(s,Vo,t.accessibilityData),s._isCopy=t.isCopy||!1;const[r,a]=s.pageDimensions,[o,l,h,c]=s.getRectInCurrentCoords(t.rect,a);return s.x=o/r,s.y=l/a,s.width=h/r,s.height=c/a,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e,i;if((t=n(this,ha))==null||t.abort(),f(this,ha,null),this.isEmpty()||this.commit(),(e=n(this,ca))==null||e.destroy(),f(this,ca,null),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),n(this,Ks)&&(clearTimeout(n(this,Ks)),f(this,Ks,null)),g(this,K,du).call(this),this.removeEditToolbar(),n(this,Zi)){for(const s of n(this,Zi).values())clearTimeout(s);f(this,Zi,null)}this.parent=null,(i=n(this,Qi))==null||i.remove(),f(this,Qi,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(g(this,K,b0).call(this),n(this,Ce).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){const{commentButtonPosition:[t,e]}=this,[i,s,r,a]=this.getPDFRect();return[Q._round(i+(r-i)*t),Q._round(s+(a-s)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return n(this,mt).commentPopupPositionInLayer}set commentPopupPosition(t){n(this,mt).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return n(this,mt).hasDefaultPopupPosition()}get commentButtonWidth(){return n(this,mt).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){var e;(e=n(this,mt))==null||e.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),f(this,On,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=n(this,Ce).children;if(!n(this,ps)){f(this,ps,Array.from(e));const a=g(this,K,S0).bind(this),o=g(this,K,x0).bind(this),l=this._uiManager._signal;for(const h of n(this,ps)){const c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",a,{signal:l}),h.addEventListener("blur",o,{signal:l}),h.addEventListener("focus",g(this,K,_0).bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",Q._l10nResizer[c])}}const i=n(this,ps)[0];let s=0;for(const a of e){if(a===i)break;s++}const r=(360-this.rotation+this.parentRotation)%360/90*(n(this,ps).length/4);if(r!==s){if(r<s)for(let o=0;o<s-r;o++)n(this,Ce).append(n(this,Ce).firstElementChild);else if(r>s)for(let o=0;o<r-s;o++)n(this,Ce).firstElementChild.before(n(this,Ce).lastElementChild);let a=0;for(const o of e){const h=n(this,ps)[a++].getAttribute("data-resizer-name");o.setAttribute("data-l10n-id",Q._l10nResizer[h])}}g(this,K,Ky).call(this,0),f(this,Bn,!0),n(this,Ce).firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){n(this,Bn)&&g(this,K,Wy).call(this,n(this,yf),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){g(this,K,du).call(this),this.div.focus()}select(){var t,e,i;if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),(t=this.div)==null||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var s,r;(s=this.div)!=null&&s.classList.contains("selectedEditor")&&((r=this._editToolbar)==null||r.show())});return}(e=this._editToolbar)==null||e.show(),(i=n(this,Ot))==null||i.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>{var t;return(t=this.div)==null?void 0:t.focus({preventScroll:!0})},0)}unselect(){var t,e,i,s,r;this.isSelected&&(this.isSelected=!1,(t=n(this,Ce))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(i=this.div)!=null&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(s=this._editToolbar)==null||s.hide(),(r=n(this,Ot))==null||r.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return n(this,wf)}set isEditing(t){f(this,wf,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){n(this,Zi)||f(this,Zi,new Map);const{action:i}=t;let s=n(this,Zi).get(i);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(t),n(this,Zi).delete(i),n(this,Zi).size===0&&f(this,Zi,null)},Q._telemetryTimeout),n(this,Zi).set(i,s);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
2show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),f(this,oc,!1)}disable(){this.div&&(this.div.tabIndex=-1),f(this,oc,!0)}updateFakeAnnotationElement(t){if(!n(this,Qi)&&!this.deleted){f(this,Qi,t.addFakeAnnotation(this));return}if(this.deleted){n(this,Qi).remove(),f(this,Qi,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&n(this,Qi).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){const i=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),i.before(e)}return e}resetAnnotationElement(t){const{firstElementChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};Vo=new WeakMap,ps=new WeakMap,Ot=new WeakMap,mt=new WeakMap,Fn=new WeakMap,oc=new WeakMap,la=new WeakMap,bf=new WeakMap,Ce=new WeakMap,Ho=new WeakMap,On=new WeakMap,Qi=new WeakMap,ha=new WeakMap,yf=new WeakMap,zo=new WeakMap,Ai=new WeakMap,wf=new WeakMap,Wo=new WeakMap,Bn=new WeakMap,Ks=new WeakMap,lc=new WeakMap,hc=new WeakMap,Zi=new WeakMap,ca=new WeakMap,vf=new WeakMap,rb=new WeakMap,K=new WeakSet,Vy=function([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},Af=new WeakSet,Hy=function(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},qg=function(t){switch(t){case 90:{const[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}},b0=function(){if(n(this,Ce))return;f(this,Ce,document.createElement("div")),n(this,Ce).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const s=document.createElement("div");n(this,Ce).append(s),s.classList.add("resizer",i),s.setAttribute("data-resizer-name",i),s.addEventListener("pointerdown",g(this,K,y0).bind(this,i),{signal:e}),s.addEventListener("contextmenu",Is,{signal:e}),s.tabIndex=-1}this.div.prepend(n(this,Ce))},y0=function(t,e){var c;e.preventDefault();const{isMac:i}=xt.platform;if(e.button!==0||e.ctrlKey&&i)return;(c=n(this,Ot))==null||c.toggle(!1);const s=this._isDraggable;this._isDraggable=!1,f(this,Ho,[e.screenX,e.screenY]);const r=new AbortController,a=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",g(this,K,Wy).bind(this,t),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",fe,{passive:!1,signal:a}),window.addEventListener("contextmenu",Is,{signal:a}),f(this,On,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const o=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const h=()=>{var u;r.abort(),this.parent.togglePointerEvents(!0),(u=n(this,Ot))==null||u.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=o,this.div.style.cursor=l,g(this,K,Qg).call(this)};window.addEventListener("pointerup",h,{signal:a}),window.addEventListener("blur",h,{signal:a})},zy=function(t,e,i,s){this.width=i,this.height=s,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Qg=function(){if(!n(this,On))return;const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=n(this,On);f(this,On,null);const r=this.x,a=this.y,o=this.width,l=this.height;r===t&&a===e&&o===i&&l===s||this.addCommands({cmd:g(this,K,zy).bind(this,r,a,o,l),undo:g(this,K,zy).bind(this,t,e,i,s),mustExec:!0})},Wy=function(t,e){const[i,s]=this.parentDimensions,r=this.x,a=this.y,o=this.width,l=this.height,h=Q.MIN_SIZE/i,c=Q.MIN_SIZE/s,u=g(this,K,qg).call(this,this.rotation),p=(R,j)=>[u[0]*R+u[2]*j,u[1]*R+u[3]*j],b=g(this,K,qg).call(this,360-this.rotation),y=(R,j)=>[b[0]*R+b[2]*j,b[1]*R+b[3]*j];let w,v,A=!1,E=!1;switch(t){case"topLeft":A=!0,w=(R,j)=>[0,0],v=(R,j)=>[R,j];break;case"topMiddle":w=(R,j)=>[R/2,0],v=(R,j)=>[R/2,j];break;case"topRight":A=!0,w=(R,j)=>[R,0],v=(R,j)=>[0,j];break;case"middleRight":E=!0,w=(R,j)=>[R,j/2],v=(R,j)=>[0,j/2];break;case"bottomRight":A=!0,w=(R,j)=>[R,j],v=(R,j)=>[0,0];break;case"bottomMiddle":w=(R,j)=>[R/2,j],v=(R,j)=>[R/2,0];break;case"bottomLeft":A=!0,w=(R,j)=>[0,j],v=(R,j)=>[R,0];break;case"middleLeft":E=!0,w=(R,j)=>[0,j/2],v=(R,j)=>[R,j/2];break}const S=w(o,l),x=v(o,l);let _=p(...x);const C=Q._round(r+_[0]),k=Q._round(a+_[1]);let D=1,P=1,I,L;if(e.fromKeyboard)({deltaX:I,deltaY:L}=e);else{const{screenX:R,screenY:j}=e,[nt,gt]=n(this,Ho);[I,L]=this.screenToPageTranslation(R-nt,j-gt),n(this,Ho)[0]=R,n(this,Ho)[1]=j}if([I,L]=y(I/i,L/s),A){const R=Math.hypot(o,l);D=P=Math.max(Math.min(Math.hypot(x[0]-S[0]-I,x[1]-S[1]-L)/R,1/o,1/l),h/o,c/l)}else E?D=Nt(Math.abs(x[0]-S[0]-I),h,1)/o:P=Nt(Math.abs(x[1]-S[1]-L),c,1)/l;const O=Q._round(o*D),H=Q._round(l*P);_=p(...v(O,H));const W=C-_[0],pt=k-_[1];n(this,Ai)||f(this,Ai,[this.x,this.y,this.width,this.height]),this.width=O,this.height=H,this.x=W,this.y=pt,this.setDims(),this.fixAndSetPosition(),this._onResizing()},w0=function(){var t;f(this,On,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(t=n(this,Ot))==null||t.toggle(!1),this.parent.togglePointerEvents(!1)}
2,v0=function(t,e,i){let r=.7*(i/e)+1-.7;if(r===1)return;const a=g(this,K,qg).call(this,this.rotation),o=(C,k)=>[a[0]*C+a[2]*k,a[1]*C+a[3]*k],[l,h]=this.parentDimensions,c=this.x,u=this.y,p=this.width,b=this.height,y=Q.MIN_SIZE/l,w=Q.MIN_SIZE/h;r=Math.max(Math.min(r,1/p,1/b),y/p,w/b);const v=Q._round(p*r),A=Q._round(b*r);if(v===p&&A===b)return;n(this,Ai)||f(this,Ai,[c,u,p,b]);const E=o(p/2,b/2),S=Q._round(c+E[0]),x=Q._round(u+E[1]),_=o(v/2,A/2);this.x=S-_[0],this.y=x-_[1],this.width=v,this.height=A,this.setDims(),this.fixAndSetPosition(),this._onResizing()},A0=function(){var t;(t=n(this,Ot))==null||t.toggle(!0),this.parent.togglePointerEvents(!0),g(this,K,Qg).call(this)},Gy=function(t){const{isMac:e}=xt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},E0=function(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const s=new AbortController,r=this._uiManager.combinedSignal(s),a={capture:!0,passive:!1,signal:r},o=h=>{s.abort(),f(this,la,null),f(this,zo,!1),this._uiManager.endDragSession()||g(this,K,Gy).call(this,h),i&&this._onStopDragging()};e&&(f(this,lc,t.clientX),f(this,hc,t.clientY),f(this,la,t.pointerId),f(this,bf,t.pointerType),window.addEventListener("pointermove",h=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:c,clientY:u,pointerId:p}=h;if(p!==n(this,la)){fe(h);return}const[b,y]=this.screenToPageTranslation(c-n(this,lc),u-n(this,hc));f(this,lc,c),f(this,hc,u),this._uiManager.dragSelectedEditors(b,y),this.div.scrollIntoView({block:"nearest"})},a),window.addEventListener("touchmove",fe,a),window.addEventListener("pointerdown",h=>{h.pointerType===n(this,bf)&&(n(this,ca)||h.isPrimary)&&o(h),fe(h)},a));const l=h=>{if(!n(this,la)||n(this,la)===h.pointerId){o(h);return}fe(h)};window.addEventListener("pointerup",l,{signal:r}),window.addEventListener("blur",l,{signal:r})},Xy=function(){if(n(this,ha)||!this.div)return;f(this,ha,new AbortController);const t=this._uiManager.combinedSignal(n(this,ha));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},Yy=function(){n(this,ca)||!this.div||!this.isResizable||!this._uiManager._supportsPinchToZoom||f(this,ca,new f0({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:g(this,K,w0).bind(this),onPinching:g(this,K,v0).bind(this),onPinchEnd:g(this,K,A0).bind(this),signal:this._uiManager._signal}))},S0=function(t){Q._resizerKeyboardManager.exec(this,t)},x0=function(t){var e;n(this,Bn)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==n(this,Ce)&&g(this,K,du).call(this)},_0=function(t){f(this,yf,n(this,Bn)?t:"")},Ky=function(t){if(n(this,ps))for(const e of n(this,ps))e.tabIndex=t},du=function(){f(this,Bn,!1),g(this,K,Ky).call(this,-1),g(this,K,Qg).call(this)},m(Q,Af),T(Q,"_l10n",null),T(Q,"_l10nAlert",null),T(Q,"_l10nResizer",null),T(Q,"_borderLineWidth",-1),T(Q,"_colorManager",new Dy),T(Q,"_zIndex",1),T(Q,"_telemetryTimeout",1e3);let Ct=Q;class iC extends Ct{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const RA=3285377520,Vi=4294901760,Rs=65535;class qy{constructor(t){this.h1=t?t&4294967295:RA,this.h2=t?t&4294967295:RA}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let w=0,v=t.length;w<v;w++){const A=t.charCodeAt(w);A<=255?e[i++]=A:(e[i++]=A>>>8,e[i++]=A&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),i=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const s=i>>2,r=i-s*4,a=new Uint32Array(e.buffer,0,s);let o=0,l=0,h=this.h1,c=this.h2;const u=3432918353,p=461845907,b=u&Rs,y=p&Rs;for(let w=0;w<s;w++)w&1?(o=a[w],o=o*u&Vi|o*b&Rs,o=o<<15|o>>>17,o=o*p&Vi|o*y&Rs,h^=o,h=h<<13|h>>>19,h=h*5+3864292196):(l=a[w],l=l*u&Vi|l*b&Rs,l=l<<15|l>>>17,l=l*p&Vi|l*y&Rs,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(o=0,r){case 3:o^=e[s*4+2]<<16;case 2:o^=e[s*4+1]<<8;case 1:o^=e[s*4],o=o*u&Vi|o*b&Rs,o=o<<15|o>>>17,o=o*p&Vi|o*y&Rs,s&1?h^=o:c^=o}this.h1=h,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Vi|t*36045&Rs,e=e*4283543511&Vi|((e<<16|t>>>16)*2950163797&Vi)>>>16,t^=e>>>1,t=t*444984403&Vi|t*60499&Rs,e=e*3301882366&Vi|((e<<16|t>>>16)*3120437893&Vi)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Uu=Object.freeze({map:null,hash:"",transfer:void 0});var Go,Xo,jn,Pe,ab,C0;class oA{constructor(){m(this,ab);m(this,Go,!1);m(this,Xo,null);m(this,jn,null);m(this,Pe,new Map);T(this,"onSetModified",null);T(this,"onResetModified",null);T(this,"onAnnotationEditor",null)}getValue(t,e){const i=n(this,Pe).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return n(this,Pe).get(t)}remove(t){var i;const e=n(this,Pe).get(t);e!==void 0&&(e instanceof Ct&&n(this,jn).delete(e.annotationElementId),n(this,Pe).delete(t),n(this,Pe).size===0&&this.resetModified(),!n(this,Pe).values().some(s=>s instanceof Ct)&&((i=this.onAnnotationEditor)==null||i.call(this,null)))}setValue(t,e){var r;const i=n(this,Pe).get(t);let s=!1;
2if(i!==void 0)for(const[a,o]of Object.entries(e))i[a]!==o&&(s=!0,i[a]=o);else s=!0,n(this,Pe).set(t,e);s&&g(this,ab,C0).call(this),e instanceof Ct&&((n(this,jn)||f(this,jn,new Map)).set(e.annotationElementId,e),(r=this.onAnnotationEditor)==null||r.call(this,e.constructor._type))}has(t){return n(this,Pe).has(t)}get size(){return n(this,Pe).size}resetModified(){var t;n(this,Go)&&(f(this,Go,!1),(t=this.onResetModified)==null||t.call(this))}get print(){return new P0(this)}get serializable(){if(n(this,Pe).size===0)return Uu;const t=new Map,e=new qy,i=[],s=Object.create(null);let r=!1;for(const[a,o]of n(this,Pe)){const l=o instanceof Ct?o.serialize(!1,s):o;o.page&&(o.pageIndex=o.page._pageIndex,delete o.page),l&&(t.set(a,l),e.update(`${a}:${JSON.stringify(l)}`),r||(r=!!l.bitmap))}if(r)for(const a of t.values())a.bitmap&&i.push(a.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Uu}get editorStats(){let t=null;const e=new Map;let i=0,s=0;for(const r of n(this,Pe).values()){if(!(r instanceof Ct)){r.popup&&(r.popup.deleted?s+=1:i+=1);continue}r.isCommentDeleted?s+=1:r.hasEditedComment&&(i+=1);const a=r.telemetryFinalData;if(!a)continue;const{type:o}=a;e.getOrInsertComputed(o,()=>Object.getPrototypeOf(r).constructor),t||(t=Object.create(null));const l=t[o]||(t[o]=new Map);for(const[h,c]of Object.entries(a)){if(h==="type")continue;const u=l.getOrInsertComputed(h,sA);u.set(c,(u.get(c)??0)+1)}}if((s>0||i>0)&&(t||(t=Object.create(null)),t.comments={deleted:s,edited:i}),!t)return null;for(const[r,a]of e)t[r]=a.computeTelemetryFinalData(t[r]);return t}resetModifiedIds(){f(this,Xo,null)}updateEditor(t,e){var s;const i=(s=n(this,jn))==null?void 0:s.get(t);return i?(i.updateFromAnnotationLayer(e),!0):!1}getEditor(t){var e;return((e=n(this,jn))==null?void 0:e.get(t))||null}get modifiedIds(){if(n(this,Xo))return n(this,Xo);const t=[];if(n(this,jn))for(const i of n(this,jn).values())i.serialize()&&t.push(i.annotationElementId);let e="";if(t.length){const i=new qy;i.update(t.join(",")),e=i.hexdigest()}return f(this,Xo,{ids:new Set(t),hash:e})}[Symbol.iterator](){return n(this,Pe).entries()}}Go=new WeakMap,Xo=new WeakMap,jn=new WeakMap,Pe=new WeakMap,ab=new WeakSet,C0=function(){var t;n(this,Go)||(f(this,Go,!0),(t=this.onSetModified)==null||t.call(this))};var Ef;class P0 extends oA{constructor(e){super();m(this,Ef,Uu);const{serializable:i}=e;if(i===Uu)return;const{map:s,hash:r,transfer:a}=i,o=structuredClone(s,a?{transfer:a}:null);f(this,Ef,{map:o,hash:r,transfer:[]})}get print(){lt("Should not call PrintAnnotationStorage.print")}get serializable(){return n(this,Ef)}get modifiedIds(){return Y(this,"modifiedIds",{ids:new Set,hash:""})}}Ef=new WeakMap;const Ch="__forcedDependency",{floor:NA,ceil:FA}=Math;function OA(d,t,e,i,s,r){d[t*4+0]=Math.min(d[t*4+0],e),d[t*4+1]=Math.min(d[t*4+1],i),d[t*4+2]=Math.max(d[t*4+2],s),d[t*4+3]=Math.max(d[t*4+3],r)}function sC(d,t,e,i,s){let r;d?(d<0&&(r=s[0],s[0]=s[2],s[2]=r),s[0]*=d,s[2]*=d,t<0&&(r=s[1],s[1]=s[3],s[3]=r),s[1]*=t,s[3]*=t):s.fill(0),s[0]+=e,s[1]+=i,s[2]+=e,s[3]+=i}const Qy=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var cc,da;class nC{constructor(t,e){m(this,cc);m(this,da);f(this,cc,t),f(this,da,e)}get length(){return n(this,cc).length}isEmpty(t){return n(this,cc)[t]===Qy}minX(t){return n(this,da)[t*4+0]/256}minY(t){return n(this,da)[t*4+1]/256}maxX(t){return(n(this,da)[t*4+2]+1)/256}maxY(t){return(n(this,da)[t*4+3]+1)/256}}cc=new WeakMap,da=new WeakMap;const BA=(d,t)=>d==null?void 0:d.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1}));var Un,ut,Lt,Yo,Ko,qo,Ue,Sf,Zy;class rC{constructor(t,e){m(this,Sf);m(this,Un,[[1,0,0,1,0,0]]);m(this,ut,[-1/0,-1/0,1/0,1/0]);m(this,Lt,new Float64Array(_r));T(this,"_pendingBBoxIdx",-1);m(this,Yo);m(this,Ko);m(this,qo);m(this,Ue);T(this,"_savesStack",[]);T(this,"_markedContentStack",[]);f(this,Yo,t.width),f(this,Ko,t.height),g(this,Sf,Zy).call(this,e)}growOperationsCount(t){t>=n(this,Ue).length&&g(this,Sf,Zy).call(this,t,n(this,Ue))}get clipBox(){return n(this,ut)}save(t){return f(this,ut,{__proto__:n(this,ut)}),this._savesStack.push(t),this}restore(t,e){const i=Object.getPrototypeOf(n(this,ut));if(i===null)return this;f(this,ut,i);const s=this._savesStack.pop();return s!==void 0&&(e==null||e(s,t),n(this,Ue)[t]=n(this,Ue)[s]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){const i=this._savesStack.pop();return i!==void 0&&(e==null||e(i,t),n(this,Ue)[t]=n(this,Ue)[i]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){const i=this._markedContentStack.pop();return i!==void 0&&(e==null||e(i,t),n(this,Ue)[t]=n(this,Ue)[i]),this}pushBaseTransform(t){return n(this,Un).push(N.multiplyByDOMMatrix(n(this,Un).at(-1),t.getTransform())),this}popBaseTransform(){return n(this,Un).length>1&&n(this,Un).pop(),this}
2resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,n(this,Lt).set(_r,0)),this}recordClipBox(t,e,i,s,r,a){const o=N.multiplyByDOMMatrix(n(this,Un).at(-1),e.getTransform()),l=_r.slice();N.axialAlignedBoundingBox([i,r,s,a],o,l);const h=N.intersect(n(this,ut),l);return h?(n(this,ut)[0]=h[0],n(this,ut)[1]=h[1],n(this,ut)[2]=h[2],n(this,ut)[3]=h[3]):(n(this,ut)[0]=n(this,ut)[1]=1/0,n(this,ut)[2]=n(this,ut)[3]=-1/0),this}recordBBox(t,e,i,s,r,a){const o=n(this,ut);if(o[0]===1/0)return this;const l=N.multiplyByDOMMatrix(n(this,Un).at(-1),e.getTransform());if(o[0]===-1/0)return N.axialAlignedBoundingBox([i,r,s,a],l,n(this,Lt)),this;const h=_r.slice();return N.axialAlignedBoundingBox([i,r,s,a],l,h),n(this,Lt)[0]=Nt(h[0],o[0],n(this,Lt)[0]),n(this,Lt)[1]=Nt(h[1],o[1],n(this,Lt)[1]),n(this,Lt)[2]=Nt(h[2],n(this,Lt)[2],o[2]),n(this,Lt)[3]=Nt(h[3],n(this,Lt)[3],o[3]),this}recordFullPageBBox(t){return n(this,Lt)[0]=Math.max(0,n(this,ut)[0]),n(this,Lt)[1]=Math.max(0,n(this,ut)[1]),n(this,Lt)[2]=Math.min(n(this,Yo),n(this,ut)[2]),n(this,Lt)[3]=Math.min(n(this,Ko),n(this,ut)[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;const s=NA(n(this,Lt)[0]*256/n(this,Yo)),r=NA(n(this,Lt)[1]*256/n(this,Ko)),a=FA(n(this,Lt)[2]*256/n(this,Yo)),o=FA(n(this,Lt)[3]*256/n(this,Ko));if(OA(n(this,qo),t,s,r,a,o),i)for(const l of i)for(const h of l)h!==t&&OA(n(this,qo),h,s,r,a,o);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,n(this,ut)[0]=Math.max(n(this,ut)[0],n(this,Lt)[0]),n(this,ut)[1]=Math.max(n(this,ut)[1],n(this,Lt)[1]),n(this,ut)[2]=Math.min(n(this,ut)[2],n(this,Lt)[2]),n(this,ut)[3]=Math.min(n(this,ut)[3],n(this,Lt)[3])),this}take(){return new nC(n(this,Ue),n(this,qo))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,i,s=1,r=0,a=0,o){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}}Un=new WeakMap,ut=new WeakMap,Lt=new WeakMap,Yo=new WeakMap,Ko=new WeakMap,qo=new WeakMap,Ue=new WeakMap,Sf=new WeakSet,Zy=function(t,e){const i=new ArrayBuffer(t*4);f(this,qo,new Uint8ClampedArray(i)),f(this,Ue,new Uint32Array(i)),e&&e.length>0?(n(this,Ue).set(e),n(this,Ue).fill(Qy,e.length)):n(this,Ue).fill(Qy)};var hi,ci,Qo,gs,dc,ua,fa,At;class aC{constructor(t,e=!1){m(this,hi,{__proto__:null});m(this,ci,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Ch]:[]});m(this,Qo,new Map);m(this,gs,new Set);m(this,dc,new Map);m(this,ua);m(this,fa);m(this,At);f(this,At,t),e&&(f(this,ua,new Map),f(this,fa,(i,s)=>{BA(n(this,ua),s).dependencies.add(i)}))}get clipBox(){return n(this,At).clipBox}growOperationsCount(t){n(this,At).growOperationsCount(t)}save(t){return f(this,hi,{__proto__:n(this,hi)}),f(this,ci,{__proto__:n(this,ci),transform:{__proto__:n(this,ci).transform},moveText:{__proto__:n(this,ci).moveText},sameLineText:{__proto__:n(this,ci).sameLineText},[Ch]:{__proto__:n(this,ci)[Ch]}}),n(this,At).save(t),this}restore(t){n(this,At).restore(t,n(this,fa));const e=Object.getPrototypeOf(n(this,hi));return e===null?this:(f(this,hi,e),f(this,ci,Object.getPrototypeOf(n(this,ci))),this)}recordOpenMarker(t){return n(this,At).recordOpenMarker(t,n(this,fa)),this}getOpenMarker(){return n(this,At).getOpenMarker()}recordCloseMarker(t){return n(this,At).recordCloseMarker(t,n(this,fa)),this}beginMarkedContent(t){return n(this,At).beginMarkedContent(t),this}endMarkedContent(t){return n(this,At).endMarkedContent(t,n(this,fa)),this}pushBaseTransform(t){return n(this,At).pushBaseTransform(t),this}popBaseTransform(){return n(this,At).popBaseTransform(),this}recordSimpleData(t,e){return n(this,hi)[t]=e,this}recordIncrementalData(t,e){return n(this,ci)[t].push(e),this}resetIncrementalData(t,e){return n(this,ci)[t].length=0,this}recordNamedData(t,e){return n(this,Qo).set(t,e),this}
2recordSimpleDataFromNamed(t,e,i){n(this,hi)[t]=n(this,Qo).get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Ch,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in n(this,hi)&&this.recordFutureForcedDependency(e,n(this,hi)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of n(this,gs))this.recordFutureForcedDependency(Ch,t);return this}resetBBox(t){return n(this,At).resetBBox(t),this}recordClipBox(t,e,i,s,r,a){return n(this,At).recordClipBox(t,e,i,s,r,a),this}recordBBox(t,e,i,s,r,a){return n(this,At).recordBBox(t,e,i,s,r,a),this}recordCharacterBBox(t,e,i,s=1,r=0,a=0,o){const l=i.bbox;let h,c;if(l&&(h=l[2]!==l[0]&&l[3]!==l[1]&&n(this,dc).get(i),h!==!1&&(c=[0,0,0,0],N.axialAlignedBoundingBox(l,i.fontMatrix,c),(s!==1||r!==0||a!==0)&&sC(s,-s,r,a,c),h)))return this.recordBBox(t,e,c[0],c[2],c[1],c[3]);if(!o)return this.recordFullPageBBox(t);const u=o();return l&&c&&h===void 0&&(h=c[0]<=r-u.actualBoundingBoxLeft&&c[2]>=r+u.actualBoundingBoxRight&&c[1]<=a-u.actualBoundingBoxAscent&&c[3]>=a+u.actualBoundingBoxDescent,n(this,dc).set(i,h),h)?this.recordBBox(t,e,c[0],c[2],c[1],c[3]):this.recordBBox(t,e,r-u.actualBoundingBoxLeft,r+u.actualBoundingBoxRight,a-u.actualBoundingBoxAscent,a+u.actualBoundingBoxDescent)}recordFullPageBBox(t){return n(this,At).recordFullPageBBox(t),this}getSimpleIndex(t){return n(this,hi)[t]}recordDependencies(t,e){const i=n(this,gs),s=n(this,hi),r=n(this,ci);for(const a of e)a in n(this,hi)?i.add(s[a]):a in r&&r[a].forEach(i.add,i);return this}recordNamedDependency(t,e){return n(this,Qo).has(e)&&n(this,gs).add(n(this,Qo).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Ch]),n(this,ua)){const s=BA(n(this,ua),t),{dependencies:r}=s;n(this,gs).forEach(r.add,r),n(this,At)._savesStack.forEach(r.add,r),n(this,At)._markedContentStack.forEach(r.add,r),r.delete(t),s.isRenderingOperation=!0}const i=!e&&t===n(this,At)._pendingBBoxIdx;return n(this,At).recordOperation(t,e,[n(this,gs),n(this,At)._savesStack,n(this,At)._markedContentStack]),i&&n(this,gs).clear(),this}recordShowTextOperation(t,e=!1){const i=Array.from(n(this,gs));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const s of i)this.recordIncrementalData("sameLineText",s);return this}bboxToClipBoxDropOperation(t,e=!1){const i=!e&&t===n(this,At)._pendingBBoxIdx;return n(this,At).bboxToClipBoxDropOperation(t),i&&n(this,gs).clear(),this}take(){return n(this,dc).clear(),n(this,At).take()}takeDebugMetadata(){return n(this,ua)}}hi=new WeakMap,ci=new WeakMap,Qo=new WeakMap,gs=new WeakMap,dc=new WeakMap,ua=new WeakMap,fa=new WeakMap,At=new WeakMap;var Et,Yt,ms,uc,fc;const wA=class wA{constructor(t,e,i){m(this,Et);m(this,Yt);m(this,ms);m(this,uc,0);m(this,fc,0);if(t instanceof wA&&n(t,ms)===!!i)return t;f(this,Et,t),f(this,Yt,e),f(this,ms,!!i)}get clipBox(){return n(this,Et).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return kt(this,fc)._++,n(this,Et).save(n(this,Yt)),this}restore(t){return n(this,fc)>0&&(n(this,Et).restore(n(this,Yt)),kt(this,fc)._--),this}recordOpenMarker(t){return kt(this,uc)._++,this}getOpenMarker(){return n(this,uc)>0?n(this,Yt):n(this,Et).getOpenMarker()}recordCloseMarker(t){return kt(this,uc)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return n(this,Et).pushBaseTransform(t),this}popBaseTransform(){return n(this,Et).popBaseTransform(),this}recordSimpleData(t,e){return n(this,Et).recordSimpleData(t,n(this,Yt)),this}recordIncrementalData(t,e){return n(this,Et).recordIncrementalData(t,n(this,Yt)),this}resetIncrementalData(t,e){return n(this,Et).resetIncrementalData(t,n(this,Yt)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return n(this,Et).recordSimpleDataFromNamed(t,e,n(this,Yt)),this}recordFutureForcedDependency(t,e){return n(this,Et).recordFutureForcedDependency(t,n(this,Yt)),this}inheritSimpleDataAsFutureForcedDependencies(t){return n(this,Et).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return n(this,Et).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return n(this,ms)||n(this,Et).resetBBox(n(this,Yt)),this}recordClipBox(t,e,i,s,r,a){return n(this,ms)||n(this,Et).recordClipBox(n(this,Yt),e,i,s,r,a),this}recordBBox(t,e,i,s,r,a){return n(this,ms)||n(this,Et).recordBBox(n(this,Yt),e,i,s,r,a),this}recordCharacterBBox(t,e,i,s,r,a,o){return n(this,ms)||n(this,Et).recordCharacterBBox(n(this,Yt),e,i,s,r,a,o),this}recordFullPageBBox(t){return n(this,ms)||n(this,Et).recordFullPageBBox(n(this,Yt)),this}getSimpleIndex(t){return n(this,Et).getSimpleIndex(t)}recordDependencies(t,e){return n(this,Et).recordDependencies(n(this,Yt),e),this}recordNamedDependency(t,e){return n(this,Et).recordNamedDependency(n(this,Yt),e),this}recordOperation(t){return n(this,Et).recordOperation(n(this,Yt),!0),this}recordShowTextOperation(t){return n(this,Et).recordShowTextOperation(n(this,Yt),!0),this}bboxToClipBoxDropOperation(t){return n(this,ms)||n(this,Et).bboxToClipBoxDropOperation(n(this,Yt),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};Et=new WeakMap,Yt=new WeakMap,ms=new WeakMap,uc=new WeakMap,fc=new WeakMap;let $u=wA;const Hi={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["f
2ilter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]};var Zo,Jo,tl,el,il,xf;const Fu=class Fu{constructor(t){m(this,Zo);m(this,Jo);m(this,tl,4);m(this,el,0);m(this,il,new(n(Fu,xf))(n(this,tl)*6));f(this,Zo,t.width),f(this,Jo,t.height)}record(t,e,i,s){if(n(this,el)===n(this,tl)){f(this,tl,n(this,tl)*2);const o=new(n(Fu,xf))(n(this,tl)*6);o.set(n(this,il)),f(this,il,o)}const r=It(t);let a;if(s[0]!==1/0){const o=_r.slice();N.axialAlignedBoundingBox([0,-i,e,0],r,o);const l=N.intersect(s,o);if(!l)return;const[h,c,u,p]=l;if(h!==o[0]||c!==o[1]||u!==o[2]||p!==o[3]){const b=Math.atan2(r[1],r[0]),y=Math.abs(Math.sin(b)),w=Math.abs(Math.cos(b));if(y<1e-6||w<1e-6||Math.abs(y-w)<1e-6)a=[h,c,h,p,u,c];else{const v=u-h,A=p-c,E=y*y,S=w*w,x=w*y,_=S-E,C=(A*S-v*x)/_,k=(A*x-v*E)/_;a=[h+k,c,h,c+C,u,p-C]}}}a||(a=[0,-i,0,0,e,-i],N.applyTransform(a,r,0),N.applyTransform(a,r,2),N.applyTransform(a,r,4)),a[0]/=n(this,Zo),a[1]/=n(this,Jo),a[2]/=n(this,Zo),a[3]/=n(this,Jo),a[4]/=n(this,Zo),a[5]/=n(this,Jo),n(this,il).set(a,n(this,el)*6),kt(this,el)._++}take(){return n(this,il).subarray(0,n(this,el)*6)}};Zo=new WeakMap,Jo=new WeakMap,tl=new WeakMap,el=new WeakMap,il=new WeakMap,xf=new WeakMap,m(Fu,xf,xt.isFloat16ArraySupported?Float16Array:Float32Array);let Jy=Fu;const jA=new RegExp("\\p{Cc}","u");function oC(d){const t=d[0];if(d.length<2||t!=='"'&&t!=="'"||d.at(-1)!==t)return!1;const e=d.length-1;for(let i=1;i<e;i++){const s=d[i];if(s===t||jA.test(s)||s==="\\"&&(++i>=e||jA.test(d[i])))return!1}return!0}function UA(d){return oC(d)?d:`"${d.replaceAll(/["\\\p{Cc}]/gu,e=>e==='"'||e==="\\"?`\\${e}`:`\\${e.codePointAt(0).toString(16)} `)}"`}var pc,bs,ob,T0;class lC{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){m(this,ob);m(this,pc,new Set);m(this,bs,null);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){const e=g(this,ob,T0).call(this);e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);if(this.nativeFontFaces.clear(),n(this,pc).clear(),n(this,bs)){const{adoptedStyleSheets:t}=this._document;t!=null&&t.includes(n(this,bs))&&(this._document.adoptedStyleSheets=t.filter(e=>e!==n(this,bs))),f(this,bs,null)}this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||n(this,pc).has(t.loadedName))){if(Xt(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:s,src:r,style:a}=t,o=new FontFace(s,r,a);this.addNativeFontFace(o);try{await o.load(),n(this,pc).add(s),i==null||i(t)}catch{J(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(o)}return}lt("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const i=t.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(s){throw J(`Failed to load font '${i.family}': '${s}'.`),t.disableFontFace=!0,s}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(i=>{const s=this._queueLoadingCallback(i);this._prepareFontLoadEvent(t,s)})}}get isFontLoadingAPISupported(){var e;const t=!!((e=this._document)!=null&&e.fonts);return Y(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return Y(this,"isSyncFontLoadingSupported",Ni||xt.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Xt(!s.done,"completeRequest() cannot be called twice."),s.done=!0;
2i.length>0&&i[0].done;){const r=i.shift();setTimeout(r.callback,0)}}const{loadingRequests:i}=this,s={done:!1,complete:e,callback:t};return i.push(s),s}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Y(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(_,C){return _.charCodeAt(C)<<24|_.charCodeAt(C+1)<<16|_.charCodeAt(C+2)<<8|_.charCodeAt(C+3)&255}function s(_){return String.fromCharCode(_>>24&255,_>>16&255,_>>8&255,_&255)}function r(_,C,k,D){const P=_.substring(0,C),I=_.substring(C+k);return P+D+I}let a,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const h=l.getContext("2d");let c=0;function u(_,C){if(++c>30){J("Load test font never loaded."),C();return}if(h.font="30px "+_,h.fillText(".",0,20),h.getImageData(0,0,1,1).data[3]>0){C();return}setTimeout(u.bind(null,_,C))}const p=`lt${Date.now()}${this.loadTestFontId++}`;let b=this._loadTestFont;b=r(b,976,p.length,p);const w=16,v=1482184792;let A=i(b,w);for(a=0,o=p.length-3;a<o;a+=4)A=A-v+i(p,a)|0;a<p.length&&(A=A-v+i(p+"XXX",a)|0),b=r(b,w,4,s(A));const E=`url(data:font/opentype;base64,${btoa(b)});`,S=`@font-face {font-family:"${p}";src:${E}}`;this.insertRule(S);const x=this._document.createElement("div");x.style.visibility="hidden",x.style.width=x.style.height="10px",x.style.position="absolute",x.style.top=x.style.left="0px";for(const _ of[t.loadedName,p]){const C=this._document.createElement("span");C.textContent="Hi",C.style.fontFamily=_,x.append(C)}this._document.body.append(x),u(p,()=>{x.remove(),e.complete()})}}pc=new WeakMap,bs=new WeakMap,ob=new WeakSet,T0=function(){var e;if(n(this,bs))return n(this,bs);const t=((e=this._document.defaultView)==null?void 0:e.CSSStyleSheet)||globalThis.CSSStyleSheet;if(!this.styleElement&&t){const{adoptedStyleSheets:i}=this._document;if(i){const s=new t;return i.push(s),f(this,bs,s)}}return this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)),f(this,bs,this.styleElement.sheet)};var St;class hC{constructor(t,e=null,i,s){T(this,"compiledGlyphs",Object.create(null));m(this,St);f(this,St,t),this._inspectFont=e,i&&(this.charProcOperatorList=i),s&&Object.assign(this,s)}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const i={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(i.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(UA(this.cssFontInfo.fontFamily),this.data,i)}return(e=this._inspectFont)==null||e.call(this,this),t}createFontFaceRule(){var i;if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:${UA(this.cssFontInfo.fontFamily)};${s}src:${t}}`}return(i=this._inspectFont)==null||i.call(this,this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let s;try{s=t.get(i)}catch(a){J(`getPathGenerator - ignoring character: "${a}".`)}const r=GE(s==null?void 0:s.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=r}get black(){return n(this,St).black}get bold(){return n(this,St).bold}get disableFontFace(){return n(this,St).disableFontFace}set disableFontFace(t){Y(this,"disableFontFace",!!t)}get fontExtraProperties(){return n(this,St).fontExtraProperties}get isInvalidPDFjsFont(){return n(this,St).isInvalidPDFjsFont}get isType3Font(){return n(this,St).isType3Font}get italic(){return n(this,St).italic}get missingFile(){return n(this,St).missingFile}get remeasure(){return n(this,St).remeasure}get vertical(){return n(this,St).vertical}get ascent(){return n(this,St).ascent}get defaultWidth(){return n(this,St).defaultWidth}get descent(){return n(this,St).descent}get bbox(){return n(this,St).bbox}get fontMatrix(){return n(this,St).fontMatrix}get fallbackName(){return n(this,St).fallbackName}get loadedName(){return n(this,St).loadedName}get mimetype(){return n(this,St).mimetype}get name(){return n(this,St).name}get data(){return n(this,St).data}clearData(){n(this,St).clearData()}get cssFontInfo(){return n(this,St).cssFontInfo}get systemFontInfo(){return n(this,St).systemFontInfo}get defaultVMetrics(){return n(this,St).defaultVMetrics}}St=new WeakMap;class k0{}T(k0,"strings",["fontFamily","fontWeight","italicAngle"]);class M0{}T(M0,"strings",["css","loadedName","baseFontName","src"]);const Fe=class Fe{};
2T(Fe,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),T(Fe,"numbers",["ascent","defaultWidth","descent"]),T(Fe,"strings",["fallbackName","loadedName","mimetype","name"]),T(Fe,"OFFSET_NUMBERS",Math.ceil(Fe.bools.length*2/8)),T(Fe,"OFFSET_BBOX",Fe.OFFSET_NUMBERS+Fe.numbers.length*8),T(Fe,"OFFSET_FONT_MATRIX",Fe.OFFSET_BBOX+1+2*4),T(Fe,"OFFSET_DEFAULT_VMETRICS",Fe.OFFSET_FONT_MATRIX+1+8*6),T(Fe,"OFFSET_STRINGS",Fe.OFFSET_DEFAULT_VMETRICS+1+2*3);let bi=Fe;class ti{}T(ti,"KIND",0),T(ti,"HAS_BBOX",1),T(ti,"HAS_BACKGROUND",2),T(ti,"SHADING_TYPE",3),T(ti,"N_COORD",4),T(ti,"N_COLOR",8),T(ti,"N_STOP",12),T(ti,"N_FIGURES",16);class Gm{static get decoder(){return Y(this,"decoder",new TextDecoder)}static get encoder(){return Y(this,"encoder",new TextEncoder)}}var _f,gc,mc,Zg;class cC{constructor(t){m(this,mc);m(this,_f);m(this,gc);f(this,_f,t),f(this,gc,new DataView(t))}get fontFamily(){return g(this,mc,Zg).call(this,0)}get fontWeight(){return g(this,mc,Zg).call(this,1)}get italicAngle(){return g(this,mc,Zg).call(this,2)}}_f=new WeakMap,gc=new WeakMap,mc=new WeakSet,Zg=function(t){Xt(t<k0.strings.length,"Invalid string index");const{decoder:e}=Gm;let i=0;for(let r=0;r<t;r++)i+=n(this,gc).getUint32(i)+4;const s=n(this,gc).getUint32(i);return e.decode(new Uint8Array(n(this,_f),i+4,s))};var sl,qs,nl,uu;class dC{constructor(t){m(this,nl);m(this,sl);m(this,qs);f(this,sl,t),f(this,qs,new DataView(t))}get guessFallback(){return n(this,qs).getUint8(0)!==0}get css(){return g(this,nl,uu).call(this,0)}get loadedName(){return g(this,nl,uu).call(this,1)}get baseFontName(){return g(this,nl,uu).call(this,2)}get src(){return g(this,nl,uu).call(this,3)}get style(){const{decoder:t}=Gm;let e=1;e+=4+n(this,qs).getUint32(e);const i=n(this,qs).getUint32(e),s=t.decode(new Uint8Array(n(this,sl),e+4,i));e+=4+i;const r=n(this,qs).getUint32(e),a=t.decode(new Uint8Array(n(this,sl),e+4,r));return{style:s,weight:a}}}sl=new WeakMap,qs=new WeakMap,nl=new WeakSet,uu=function(t){Xt(t<M0.strings.length,"Invalid string index");const{decoder:e}=Gm;let i=5;for(let r=0;r<t;r++)i+=n(this,qs).getUint32(i)+4;const s=n(this,qs).getUint32(i);return e.decode(new Uint8Array(n(this,sl),i+4,s))};var ys,Zt,bt,us,Jg,tm,fu,tw;class uC{constructor({buffer:t,extra:e}){m(this,bt);m(this,ys);m(this,Zt);f(this,ys,t),f(this,Zt,new DataView(t)),e&&Object.assign(this,e)}get black(){return g(this,bt,us).call(this,0)}get bold(){return g(this,bt,us).call(this,1)}get disableFontFace(){return g(this,bt,us).call(this,2)}get fontExtraProperties(){return g(this,bt,us).call(this,3)}get isInvalidPDFjsFont(){return g(this,bt,us).call(this,4)}get isType3Font(){return g(this,bt,us).call(this,5)}get italic(){return g(this,bt,us).call(this,6)}get missingFile(){return g(this,bt,us).call(this,7)}get remeasure(){return g(this,bt,us).call(this,8)}get vertical(){return g(this,bt,us).call(this,9)}get ascent(){return g(this,bt,Jg).call(this,0)}get defaultWidth(){return g(this,bt,Jg).call(this,1)}get descent(){return g(this,bt,Jg).call(this,2)}get bbox(){return g(this,bt,tm).call(this,bi.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return g(this,bt,tm).call(this,bi.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return g(this,bt,tm).call(this,bi.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return g(this,bt,fu).call(this,0)}get loadedName(){return g(this,bt,fu).call(this,1)}get mimetype(){return g(this,bt,fu).call(this,2)}get name(){return g(this,bt,fu).call(this,3)}get data(){const{offset:t,length:e}=g(this,bt,tw).call(this);return e===0?void 0:new Uint8Array(n(this,ys),t+4,e)}clearData(){const{offset:t,length:e}=g(this,bt,tw).call(this);e!==0&&(n(this,Zt).setUint32(t,0),f(this,ys,new Uint8Array(n(this,ys),0,t+4).slice().buffer),f(this,Zt,new DataView(n(this,ys))))}get cssFontInfo(){let t=bi.OFFSET_STRINGS;const e=n(this,Zt).getUint32(t);t+=4+e;const i=n(this,Zt).getUint32(t);t+=4+i;const s=n(this,Zt).getUint32(t);if(s===0)return null;const r=new Uint8Array(s);
2return r.set(new Uint8Array(n(this,ys),t+4,s)),new cC(r.buffer)}get systemFontInfo(){let t=bi.OFFSET_STRINGS;const e=n(this,Zt).getUint32(t);t+=4+e;const i=n(this,Zt).getUint32(t);if(i===0)return null;const s=new Uint8Array(i);return s.set(new Uint8Array(n(this,ys),t+4,i)),new dC(s.buffer)}}ys=new WeakMap,Zt=new WeakMap,bt=new WeakSet,us=function(t){Xt(t<bi.bools.length,"Invalid boolean index");const e=Math.floor(t/4),i=t*2%8,s=n(this,Zt).getUint8(e)>>i&3;return s===0?void 0:s===2},Jg=function(t){return Xt(t<bi.numbers.length,"Invalid number index"),n(this,Zt).getFloat64(bi.OFFSET_NUMBERS+t*8)},tm=function(t,e,i,s){const r=n(this,Zt).getUint8(t);if(r===0)return;Xt(r===e,"Invalid array length."),t+=1;const a=new Array(r);for(let o=0;o<r;o++)a[o]=n(this,Zt)[i](t,!0),t+=s;return a},fu=function(t){Xt(t<bi.strings.length,"Invalid string index");const{decoder:e}=Gm;let i=bi.OFFSET_STRINGS+4;for(let r=0;r<t;r++)i+=n(this,Zt).getUint32(i)+4;const s=n(this,Zt).getUint32(i);return e.decode(new Uint8Array(n(this,ys),i+4,s))},tw=function(){let t=bi.OFFSET_STRINGS;const e=n(this,Zt).getUint32(t);t+=4+e;const i=n(this,Zt).getUint32(t);t+=4+i;const s=n(this,Zt).getUint32(t);t+=4+s;const r=n(this,Zt).getUint32(t);return{offset:t,length:r}};class fC{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){const t=this.view,e=this.data[ti.KIND],i=!!this.data[ti.HAS_BBOX],s=!!this.data[ti.HAS_BACKGROUND],r=t.getUint32(ti.N_COORD,!0),a=t.getUint32(ti.N_COLOR,!0),o=t.getUint32(ti.N_STOP,!0);let l=20;const h=new Float32Array(this.buffer,l,r*2);l+=r*8;const c=new Uint8Array(this.buffer,l,a*4);l+=a*4;const u=[];for(let y=0;y<o;++y){const w=t.getFloat32(l,!0);l+=4;const v=t.getUint32(l,!0);l+=4,u.push([w,`#${v.toString(16).padStart(6,"0")}`])}let p=null;if(i){p=[];for(let y=0;y<4;++y)p.push(t.getFloat32(l,!0)),l+=4}let b=null;if(s&&(b=new Uint8Array(this.buffer,l,3),l+=3),e===1)return["RadialAxial","axial",p,u,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",p,u,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(e===3){const y=this.data[ti.SHADING_TYPE];let w=null;if(h.length>0){w=_r.slice();for(let v=0,A=h.length;v<A;v+=2)N.pointBoundingBox(h[v],h[v+1],w)}return["Mesh",y,h,c,r,w,p,b]}throw new Error(`Unsupported pattern kind: ${e}`)}}var bc;class pC{constructor(t){m(this,bc);f(this,bc,t)}get path(){return xt.isFloat16ArraySupported?new Float16Array(n(this,bc)):new Float32Array(n(this,bc))}}bc=new WeakMap;function gC(d){if(d instanceof URL)return d;if(typeof d=="string"){if(Ni){if(/^[a-z][a-z0-9\-+.]+:/i.test(d))return new URL(d);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(d))}const t=URL.parse(d,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function mC(d){if(Ni&&typeof Buffer<"u"&&d instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength)return d;if(typeof d=="string")return Ob(d);if(d instanceof ArrayBuffer||ArrayBuffer.isView(d)||typeof d=="object"&&!isNaN(d==null?void 0:d.length))return new Uint8Array(d);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Ig(d){if(typeof d!="string")return null;if(d.endsWith("/"))return d;throw new Error(`Invalid factory url: "${d}" must include trailing slash.`)}const ew=d=>typeof d=="object"&&Number.isInteger(d==null?void 0:d.num)&&d.num>=0&&Number.isInteger(d==null?void 0:d.gen)&&d.gen>=0,bC=d=>typeof d=="object"&&typeof(d==null?void 0:d.name)=="string",yC=$_.bind(null,ew,bC);var $n,lb;class wC{constructor(){m(this,$n,new Map);m(this,lb,Promise.resolve())}postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};n(this,lb).then(()=>{for(const[s]of n(this,$n))s.call(this,i)})}addEventListener(t,e,i=null){let s=null;if((i==null?void 0:i.signal)instanceof AbortSignal){const{signal:r}=i;if(r.aborted){J("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(t,e);s=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}n(this,$n).set(e,s)}removeEventListener(t,e){const i=n(this,$n).get(e);i==null||i(),n(this,$n).delete(e)}terminate(){for(const[,t]of n(this,$n))t==null||t();n(this,$n).clear()}}$n=new WeakMap,lb=new WeakMap;const Dg={DATA:1,ERROR:2},te={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function $A(){}function ri(d){if(d instanceof co||d instanceof vy||d instanceof wy||d instanceof zm||d instanceof ey)return d;switch(d instanceof Error||typeof d=="object"&&d!==null||lt('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),d.name){case"AbortException":return new co(d.message);case"InvalidPDFException":return new vy(d.message);case"PasswordException":return new wy(d.message,d.code);
2case"ResponseException":return new zm(d.message,d.status,d.missing);case"UnknownErrorException":return new ey(d.message,d.details)}return new ey(d.message,d.toString())}var yc,ds,I0,D0,L0,em;class pu{constructor(t,e,i){m(this,ds);m(this,yc,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",g(this,ds,I0).bind(this),{signal:n(this,yc).signal})}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){r.reject(a)}return r.promise}sendWithStream(t,e,i,s){const r=this.streamId++,a=this.sourceName,o=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const c=Promise.withResolvers();return this.streamControllers[r]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:a,targetName:o,action:t,streamId:r,data:e,desiredSize:h.desiredSize},s),c.promise},pull:h=>{const c=Promise.withResolvers();return this.streamControllers[r].pullCall=c,l.postMessage({sourceName:a,targetName:o,stream:te.PULL,streamId:r,desiredSize:h.desiredSize}),c.promise},cancel:h=>{Xt(h instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[r].cancelCall=c,this.streamControllers[r].isClosed=!0,l.postMessage({sourceName:a,targetName:o,stream:te.CANCEL,streamId:r,reason:ri(h)}),c.promise}},i)}destroy(){var t;(t=n(this,yc))==null||t.abort(),f(this,yc,null)}}yc=new WeakMap,ds=new WeakSet,I0=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){g(this,ds,L0).call(this,t);return}if(t.callback){const i=t.callbackId,s=this.callbackCapabilities[i];if(!s)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],t.callback===Dg.DATA)s.resolve(t.data);else if(t.callback===Dg.ERROR)s.reject(ri(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const i=this.sourceName,s=t.sourceName,r=this.comObj;Promise.try(e,t.data).then(function(a){r.postMessage({sourceName:i,targetName:s,callback:Dg.DATA,callbackId:t.callbackId,data:a})},function(a){r.postMessage({sourceName:i,targetName:s,callback:Dg.ERROR,callbackId:t.callbackId,reason:ri(a)})});return}if(t.streamId){g(this,ds,D0).call(this,t);return}e(t.data)},D0=function(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,r=this.comObj,a=this,o=this.actionHandler[t.action],l={enqueue(h,c=1,u){if(this.isCancelled)return;const p=this.desiredSize;this.desiredSize-=c,p>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:s,stream:te.ENQUEUE,streamId:e,chunk:h},u)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:te.CLOSE,streamId:e}),delete a.streamSinks[e])},error(h){Xt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:te.ERROR,streamId:e,reason:ri(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,Promise.try(o,t.data,l).then(function(){r.postMessage({sourceName:i,targetName:s,stream:te.START_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:i,targetName:s,stream:te.START_COMPLETE,streamId:e,reason:ri(h)})})},L0=function(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,r=this.comObj,a=this.streamControllers[e],o=this.streamSinks[e];switch(t.stream){case te.START_COMPLETE:t.success?a.startCall.resolve():a.startCall.reject(ri(t.reason));break;case te.PULL_COMPLETE:t.success?a.pullCall.resolve():a.pullCall.reject(ri(t.reason));break;case te.PULL:if(!o){r.postMessage({sourceName:i,targetName:s,stream:te.PULL_COMPLETE,streamId:e,success:!0});break}o.desiredSize<=0&&t.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=t.desiredSize,Promise.try(o.onPull||$A).then(function(){r.postMessage({sourceName:i,targetName:s,stream:te.PULL_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:i,targetName:s,stream:te.PULL_COMPLETE,streamId:e,reason:ri(h)})});break;case te.ENQUEUE:if(Xt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case te.CLOSE:if(Xt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),g(this,ds,em).call(this,a,e);break;case te.ERROR:Xt(a,"error should have stream controller"),a.controller.error(ri(t.reason)),g(this,ds,em).call(this,a,e);break;case te.CANCEL_COMPLETE:t.success?a.cancelCall.resolve():a.cancelCall.reject(ri(t.reason)),g(this,ds,em).call(this,a,e);break;case te.CANCEL:if(!o)break;const l=ri(t.reason);Promise.try(o.onCancel||$A,l).then(function(){r.postMessage({sourceName:i,targetName:s,stream:te.CANCEL_COMPLETE,streamId:e,success:!0})},function(h){r.postMessage({sourceName:i,targetName:s,stream:te.CANCEL_COMPLETE,streamId:e,reason:ri(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},em=async function(t,e){var i,s,r;await Promise.allSettled([(i=t.startCall)==null?void 0:i.promise,(s=t.pullCall)==null?void 0:s.promise,(r=t.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[e]};var hb;class R0{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){m(this,hb,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=i}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:lt(`Not implemented: ${t}`)}const i=this[t];if(!i)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);const s=`${i}${e}`;return this._fetch(s,t).catch(r=>{throw new Error(`Unable to load ${n(this,hb)[t]} data at: ${s}`)})}async _fetch(t,e){lt("Abstract method `_fetch` called.")}}hb=new WeakMap;class VA extends R0{async _fetch(t,e){const i=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",s=await nA(t,i);return s instanceof Uint8Array?s:Ob(s)}}var Cf;class N0{constructor({enableHWA:t=!1}){m(this,Cf,!1);f(this,Cf,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!n(this,Cf)})}}reset({canvas:t},e,i){if(!t)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.width=e,t.height=i}destroy(t){const{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){lt("Abstract method `_createCanvas` called.")}}Cf=new WeakMap;class vC extends N0{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}class F0{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addKnockoutFilter(t=0){return"none"}addHighlightHCMFilter(t,e,i,s,r){return"none"}addSelectionHCMFilter(t,e){return"none"}addSelectionFilter(){return"none"}createSelectionStyle(t=null){return null}destroy(t=!1){}}var rl,wc,Vn,Qs,we,al,pa,F,me,gu,Ns,im,mo,O0,iw,bo,mu,bu,sw,yu,B0,nw,j0;class AC extends F0{constructor({docId:e,ownerDocument:i=globalThis.document}){super();m(this,F);m(this,rl);m(this,wc);m(this,Vn);m(this,Qs);m(this,we);m(this,al);m(this,pa,0);f(this,Qs,e),f(this,we,i)}addFilter(e){if(!e)return"none";let i=n(this,F,me).get(e);if(i)return i;const[s,r,a]=g(this,F,im).call(this,e),o=e.length===1?s:`${s}${r}${a}`;if(i=n(this,F,me).get(o),i)return n(this,F,me).set(e,i),i;const l=`g_${n(this,Qs)}_transfer_map_${kt(this,pa)._++}`,h=g(this,F,mo).call(this,l);n(this,F,me).set(e,h),n(this,F,me).set(o,h);const c=g(this,F,bo).call(this,l);return g(this,F,bu).call(this,s,r,a,c),h}addHCMFilter(e,i){var y;const s=`${e}-${i}`,r="base";let a=n(this,F,gu).get(r);if((a==null?void 0:a.key)===s||(a?((y=a.filter)==null||y.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},n(this,F,gu).set(r,a)),!e||!i))return a.url;const o=g(this,F,yu).call(this,e);e=N.makeHexColor(...o);const l=g(this,F,yu).call(this,i);if(i=N.makeHexColor(...l),g(this,F,nw).call(this),e==="#000000"&&i==="#ffffff"||e===i)return a.url;const c=Array.from({length:256},(w,v)=>Ty(v/255)).join(","),u=`g_${n(this,Qs)}_hcm_filter`,p=a.filter=g(this,F,bo).call(this,u);g(this,F,bu).call(this,c,c,c,p),g(this,F,iw).call(this,p);const b=(w,v)=>{const A=o[w]/255,E=l[w]/255,S=new Array(v+1);for(let x=0;x<=v;x++)S[x]=A+x/v*(E-A);return S.join(",")};return g(this,F,bu).call(this,b(0,5),b(1,5),b(2,5),p),a.url=g(this,F,mo).call(this,u),a.url}addSelectionHCMFilter(e,i){return this.addHighlightHCMFilter("selection",e,i,"HighlightText","Highlight")}addSelectionFilter(){return this.addHighlightHCMFilter("selection_default","black","white","HighlightText","Highlight")}createSelectionStyle(e=null){const i=e?this.addSelectionHCMFilter(e.foreground,e.background):this.addSelectionFilter();return i==="none"||!xt.platform.isFirefox?null:{"backdrop-filter":i,"background-color":"transparent"}}addAlphaFilter(e){let i=n(this,F,me).get(e);if(i)return i;const[s]=g(this,F,im).call(this,[e]),r=`alpha_${s}`;if(i=n(this,F,me).get(r),i)return n(this,F,me).set(e,i),i;const a=`g_${n(this,Qs)}_alpha_map_${kt(this,pa)._++}`,o=g(this,F,mo).call(this,a);n(this,F,me).set(e,o),n(this,F,me).set(r,o);const l=g(this,F,bo).call(this,a);return g(this,F,sw).call(this,s,l),o}addLuminosityFilter(e){let i=n(this,F,me).get(e||"luminosity");if(i)return i;let s,r;if(e?([s]=g(this,F,im).call(this,[e]),r=`luminosity_${s}`):r="luminosity",i=n(this,F,me).get(r),i)return n(this,F,me).set(e,i),i;const a=`g_${n(this,Qs)}_luminosity_map_${kt(this,pa)._++}`,o=g(this,F,mo).call(this,a);n(this,F,me).set(e,o),n(this,F,me).set(r,o);const l=g(this,F,bo).call(this,a);return g(this,F,O0).call(this,l),e&&g(this,F,sw).call(this,s,l),o}addKnockoutFilter(e=0){const i=e>0?Math.min(1/e,1e6):1e6,s=`knockout_${i}`,r=n(this,F,me).get(s);if(r)return r;const a=`g_${n(this,Qs)}_knockout_filter_${kt(this,pa)._++}`,o=g(this,F,mo).call(this,a);n(this,F,me).set(s,o);
2const l=g(this,F,bo).call(this,a),h=n(this,we).createElementNS(Je,"feComponentTransfer");l.append(h);const c=n(this,we).createElementNS(Je,"feFuncA");return c.setAttribute("type","linear"),c.setAttribute("slope",`${i}`),c.setAttribute("intercept","0"),h.append(c),o}addHighlightHCMFilter(e,i,s,r,a){var E;const o=`${i}-${s}-${r}-${a}`;let l=n(this,F,gu).get(e);if((l==null?void 0:l.key)===o||(l?((E=l.filter)==null||E.remove(),l.key=o,l.url="none",l.filter=null):(l={key:o,url:"none",filter:null},n(this,F,gu).set(e,l)),!i||!s))return l.url;const[h,c]=[i,s].map(g(this,F,yu).bind(this));let u=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),p=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[b,y]=[r,a].map(g(this,F,j0).bind(this));p<u&&([u,p,b,y]=[p,u,y,b]),g(this,F,nw).call(this);const w=(S,x,_)=>{const C=new Array(256),k=(p-u)/_,D=S/255,P=(x-S)/(255*_);let I=0;for(let L=0;L<=_;L++){const O=Math.round(u+L*k),H=D+L*P;for(let W=I;W<=O;W++)C[W]=H;I=O+1}for(let L=I;L<256;L++)C[L]=C[I-1];return C.join(",")},v=`g_${n(this,Qs)}_hcm_${e}_filter`,A=l.filter=g(this,F,bo).call(this,v);return g(this,F,iw).call(this,A),g(this,F,bu).call(this,w(b[0],y[0],5),w(b[1],y[1],5),w(b[2],y[2],5),A),l.url=g(this,F,mo).call(this,v),l.url}destroy(e=!1){var i,s,r,a;e&&((i=n(this,al))!=null&&i.size)||((s=n(this,Vn))==null||s.parentNode.parentNode.remove(),f(this,Vn,null),(r=n(this,wc))==null||r.clear(),f(this,wc,null),(a=n(this,al))==null||a.clear(),f(this,al,null),f(this,pa,0))}}rl=new WeakMap,wc=new WeakMap,Vn=new WeakMap,Qs=new WeakMap,we=new WeakMap,al=new WeakMap,pa=new WeakMap,F=new WeakSet,me=function(){return n(this,wc)||f(this,wc,new Map)},gu=function(){return n(this,al)||f(this,al,new Map)},Ns=function(){if(!n(this,Vn)){const e=n(this,we).createElement("div"),{style:i}=e;i.colorScheme="only light",i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;
2const s=n(this,we).createElementNS(Je,"svg");s.setAttribute("width",0),s.setAttribute("height",0),f(this,Vn,n(this,we).createElementNS(Je,"defs")),e.append(s),s.append(n(this,Vn)),n(this,we).body.append(e)}return n(this,Vn)},im=function(e){if(e.length===1){const h=e[0],c=new Array(256);for(let p=0;p<256;p++)c[p]=h[p]/255;const u=c.join(",");return[u,u,u]}const[i,s,r]=e,a=new Array(256),o=new Array(256),l=new Array(256);for(let h=0;h<256;h++)a[h]=i[h]/255,o[h]=s[h]/255,l[h]=r[h]/255;return[a.join(","),o.join(","),l.join(",")]},mo=function(e){if(n(this,rl)===void 0){f(this,rl,"");const i=n(this,we).URL;i!==n(this,we).baseURI&&(Bb(i)?J('#createUrl: ignore "data:"-URL for performance reasons.'):f(this,rl,VE(i,"")))}return`url(${n(this,rl)}#${e})`},O0=function(e){const i=n(this,we).createElementNS(Je,"feColorMatrix");i.setAttribute("type","matrix"),i.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(i)},iw=function(e){const i=n(this,we).createElementNS(Je,"feColorMatrix");i.setAttribute("type","matrix"),i.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"),e.append(i)}
2,bo=function(e){const i=n(this,we).createElementNS(Je,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),n(this,F,Ns).append(i),i},mu=function(e,i,s){const r=n(this,we).createElementNS(Je,i);r.setAttribute("type","discrete"),r.setAttribute("tableValues",s),e.append(r)},bu=function(e,i,s,r){const a=n(this,we).createElementNS(Je,"feComponentTransfer");r.append(a),g(this,F,mu).call(this,a,"feFuncR",e),g(this,F,mu).call(this,a,"feFuncG",i),g(this,F,mu).call(this,a,"feFuncB",s)},sw=function(e,i){const s=n(this,we).createElementNS(Je,"feComponentTransfer");i.append(s),g(this,F,mu).call(this,s,"feFuncA",e)},yu=function(e){return n(this,F,Ns).style.color="CanvasText",n(this,F,Ns).style.backgroundColor=e,Tg(getComputedStyle(n(this,F,Ns)).getPropertyValue("background-color"))},B0=function(e){return n(this,F,Ns).style.color="CanvasText",n(this,F,Ns).style.backgroundColor=e,Pg(getComputedStyle(n(this,F,Ns)).getPropertyValue("background-color"))},nw=function(){n(this,F,Ns).style.color="",n(this,F,Ns).style.backgroundColor=""},j0=function(e){const[i,s,r,a]=g(this,F,B0).call(this,e);if(a===1)return[i,s,r];const[o,l,h]=g(this,F,yu).call(this,"Canvas");return[ry(i,o,a),ry(s,l,a),ry(r,h,a)]};function ry(d,t,e){return Math.round(e*d+(1-e)*t)}Ni&&J("Please use the `legacy` build in Node.js environments.");async function EC(d){const e=await process.getBuiltinModule("fs/promises").readFile(d);return new Uint8Array(e)}class SC extends F0{}class xC extends N0{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class _C extends R0{async _fetch(t,e){return EC(t)}}function U0({src:d,srcPos:t=0,dest:e,width:i,height:s,nonBlackColor:r=4294967295,inverseDecode:a=!1}){const o=xt.isLittleEndian?4278190080:255,[l,h]=a?[r,o]:[o,r],c=i>>3,u=i&7,p=l^h,b=d.length;e=new Uint32Array(e.buffer);let y=0;for(let w=0;w<s;++w){for(const A=t+c;t<A;++t,y+=8){const E=d[t];e[y]=l^-(E>>7&1)&p,e[y+1]=l^-(E>>6&1)&p,e[y+2]=l^-(E>>5&1)&p,e[y+3]=l^-(E>>4&1)&p,e[y+4]=l^-(E>>3&1)&p,e[y+5]=l^-(E>>2&1)&p,e[y+6]=l^-(E>>1&1)&p,e[y+7]=l^-(E&1)&p}if(u===0)continue;const v=t<b?d[t++]:255;for(let A=0;A<u;++A,++y)e[y]=l^-(v>>7-A&1)&p}return{srcPos:t,destPos:y}}function CC({src:d,srcPos:t=0,dest:e,destPos:i=0,width:s,height:r}){let a=0;const o=s*r*3,l=o>>2,h=new Uint32Array(d.buffer,t,l),c=xt.isLittleEndian?4278190080:255;if(xt.isLittleEndian){for(;a<l-2;a+=3,i+=4){const u=h[a],p=h[a+1],b=h[a+2];e[i]=u|c,e[i+1]=u>>>24|p<<8|c,e[i+2]=p>>>16|b<<16|c,e[i+3]=b>>>8|c}for(let u=a*4,p=t+o;u<p;u+=3)e[i++]=d[u]|d[u+1]<<8|d[u+2]<<16|c}else{for(;a<l-2;a+=3,i+=4){const u=h[a],p=h[a+1],b=h[a+2];e[i]=u|c,e[i+1]=u<<24|p>>>8|c,e[i+2]=p<<16|b>>>16|c,e[i+3]=b<<8|c}for(let u=a*4,p=t+o;u<p;u+=3)e[i++]=d[u]<<24|d[u+1]<<16|d[u+2]<<8|c}return{srcPos:t+o,destPos:i}}const PC=` 3struct Uniforms { 4 offsetX : f32, 5 offsetY : f32, 6 scaleX : f32, 7 scaleY : f32, 8 paddedWidth : f32, 9 paddedHeight : f32, 10 borderSize : f32, 11 _pad : f32, 12}; 13 14@group(0) @binding(0) var<uniform> u : Uniforms; 15 16struct VertexInput { 17 @location(0) position : vec2<f32>, 18 @location(1) color : vec4<f32>, 19}; 20 21struct VertexOutput { 22 @builtin(position) position : vec4<f32>, 23 @location(0) color : vec3<f32>, 24}; 25 26@vertex 27fn vs_main(in : VertexInput) -> VertexOutput { 28 var out : VertexOutput; 29 let cx = (in.position.x + u.offsetX) * u.scaleX; 30 let cy = (in.position.y + u.offsetY) * u.scaleY; 31 out.position = vec4<f32>( 32 ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0, 33 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0, 34 0.0, 35 1.0 36 ); 37 out.color = in.color.rgb; 38 return out; 39} 40 41@fragment 42fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> { 43 return vec4<f32>(in.color, 1.0); 44} 45`;
45var cb,Hn,ol,vc,db,$0;class TC{constructor(){m(this,db);m(this,cb,null);m(this,Hn,null);m(this,ol,null);m(this,vc,null)}init(){return n(this,cb)||f(this,cb,g(this,db,$0).call(this))}get isReady(){return n(this,Hn)!==null}loadMeshShader(){if(!n(this,Hn)||n(this,ol))return;const t=n(this,Hn).createShaderModule({code:PC});f(this,ol,n(this,Hn).createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:2*4,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:n(this,vc)}]},primitive:{topology:"triangle-list"}}))}draw(t,e,i,s,r,a,o,l){this.loadMeshShader();const h=n(this,Hn),{offsetX:c,offsetY:u,scaleX:p,scaleY:b}=s,y=h.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&h.queue.writeBuffer(y,0,t);const w=h.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&h.queue.writeBuffer(w,0,e);const v=h.createBuffer({size:8*4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});h.queue.writeBuffer(v,0,new Float32Array([c,u,p,b,a,o,l,0]));const A=h.createBindGroup({layout:n(this,ol).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:v}}]}),E=new OffscreenCanvas(a,o),S=E.getContext("webgpu");S.configure({device:h,format:n(this,vc),alphaMode:r?"opaque":"premultiplied"});const x=r?{r:r[0]/255,g:r[1]/255,b:r[2]/255,a:1}:{r:0,g:0,b:0,a:0},_=h.createCommandEncoder(),C=_.beginRenderPass({colorAttachments:[{view:S.getCurrentTexture().createView(),clearValue:x,loadOp:"clear",storeOp:"store"}]});return i>0&&(C.setPipeline(n(this,ol)),C.setBindGroup(0,A),C.setVertexBuffer(0,y),C.setVertexBuffer(1,w),C.draw(i)),C.end(),h.queue.submit([_.finish()]),y.destroy(),w.destroy(),v.destroy(),E.transferToImageBitmap()}}cb=new WeakMap,Hn=new WeakMap,ol=new WeakMap,vc=new WeakMap,db=new WeakSet,$0=async function(){var t;if(!((t=globalThis.navigator)!=null&&t.gpu))return!1;try{const e=await navigator.gpu.requestAdapter();return e?(f(this,vc,navigator.gpu.getPreferredCanvasFormat()),f(this,Hn,await e.requestDevice()),!0):!1}catch{return!1}};const jb=new TC;function kC(){return jb.init()}function MC(){return jb.isReady}function IC(){jb.loadMeshShader()}function DC(d,t,e,i,s,r,a,o){return jb.draw(d,t,e,i,s,r,a,o)}const Ie={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function sm(d,t){if(!t)return;const e=t[2]-t[0],i=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],e,i),d.clip(s)}class lA{constructor(){T(this,"matrix",null)}isModifyingCurrentTransform(){return!1}getPattern(){lt("Abstract method `getPattern` called.")}}class LC extends lA{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7]}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}areConic(){if(!this.isRadial())return!1;const t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let i,s=this._p0,r=this._p1;if(e&&(s=s.slice(),r=r.slice(),N.applyTransform(s,e),N.applyTransform(r,e)),this._type==="axial")i=t.createLinearGradient(s[0],s[1],r[0],r[1]);else if(this._type==="radial"){let a=this._r0,o=this._r1;if(e){const l=new Float32Array(2);N.singularValueDecompose2dScale(e,l),a*=l[0],o*=l[0]}i=t.createRadialGradient(s[0],s[1],a,r[0],r[1],o)}for(const a of this._colorStops)i.addColorStop(a[0],a[1]);return i}_createReversedGradient(t,e=null){let i=this._p1,s=this._p0;e&&(i=i.slice(),s=s.slice(),N.applyTransform(i,e),N.applyTransform(s,e));let r=this._r1,a=this._r0;if(e){const h=new Float32Array(2);N.singularValueDecompose2dScale(e,h),r*=h[0],a*=h[0]}const o=t.createRadialGradient(i[0],i[1],r,s[0],s[1],a),l=this._colorStops.map(([h,c])=>[1-h,c]).reverse();for(const[h,c]of l)o.addColorStop(h,c);return o}getPattern(t,e,i,s){let r;if(s===Ie.STROKE||s===Ie.FILL){if(this.isOriginBased()){let p=N.transform(i,e.baseTransform);
45this.matrix&&(p=N.transform(p,this.matrix));const b=.001,y=Math.hypot(p[0],p[1]),w=Math.hypot(p[2],p[3]),v=(p[0]*p[2]+p[1]*p[3])/(y*w);if(Math.abs(v)<b)if(this.isRadial()){if(Math.abs(y-w)<b)return this._createGradient(t,p)}else return this._createGradient(t,p)}const a=e.current.getClippedPathBoundingBox(s,It(t))||[0,0,0,0],o=Math.ceil(a[2]-a[0])||1,l=Math.ceil(a[3]-a[1])||1,h=e.canvasFactory.create(o,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-a[0],-a[1]),i=N.transform(i,[1,0,0,1,a[0],a[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),sm(c,this._bbox),this.areConic()&&(c.fillStyle=this._createReversedGradient(c),c.fill()),c.fillStyle=this._createGradient(c),c.fill(),r=t.createPattern(h.canvas,"no-repeat"),e.canvasFactory.destroy(h);const u=new DOMMatrix(i);r.setTransform(u)}else this.areConic()&&(t.save(),sm(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),sm(t,this._bbox),r=this._createGradient(t);return r}}function RC(d,t,e,i,s,r,a,o){const l=t.coords,h=t.colors,c=d.data,u=d.width*4;let p;l[e*2+1]>l[i*2+1]&&(p=e,e=i,i=p,p=r,r=a,a=p),l[i*2+1]>l[s*2+1]&&(p=i,i=s,s=p,p=a,a=o,o=p),l[e*2+1]>l[i*2+1]&&(p=e,e=i,i=p,p=r,r=a,a=p);const b=(l[e*2]+t.offsetX)*t.scaleX,y=(l[e*2+1]+t.offsetY)*t.scaleY,w=(l[i*2]+t.offsetX)*t.scaleX,v=(l[i*2+1]+t.offsetY)*t.scaleY,A=(l[s*2]+t.offsetX)*t.scaleX,E=(l[s*2+1]+t.offsetY)*t.scaleY;if(y>=E)return;const S=h[r*4],x=h[r*4+1],_=h[r*4+2],C=h[a*4],k=h[a*4+1],D=h[a*4+2],P=h[o*4],I=h[o*4+1],L=h[o*4+2],O=Math.round(y),H=Math.round(E);let W,pt,R,j,nt,gt,ze,xe;for(let Jt=O;Jt<=H;Jt++){if(Jt<v){const Tt=Jt<y?0:(y-Jt)/(y-v);W=b-(b-w)*Tt,pt=S-(S-C)*Tt,R=x-(x-k)*Tt,j=_-(_-D)*Tt}else{let Tt;Jt>E?Tt=1:v===E?Tt=0:Tt=(v-Jt)/(v-E),W=w-(w-A)*Tt,pt=C-(C-P)*Tt,R=k-(k-I)*Tt,j=D-(D-L)*Tt}let yt;Jt<y?yt=0:Jt>E?yt=1:yt=(y-Jt)/(y-E),nt=b-(b-A)*yt,gt=S-(S-P)*yt,ze=x-(x-I)*yt,xe=_-(_-L)*yt;const Ds=Math.round(Math.min(W,nt)),Jd=Math.round(Math.max(W,nt));let ge=u*Jt+Ds*4;for(let Tt=Ds;Tt<=Jd;Tt++)yt=(W-Tt)/(W-nt),yt<0?yt=0:yt>1&&(yt=1),c[ge++]=pt-(pt-gt)*yt|0,c[ge++]=R-(R-ze)*yt|0,c[ge++]=j-(j-xe)*yt|0,c[ge++]=255}}class NC extends lA{constructor(t){super(),this._posData=t[2],this._colData=t[3],this._vertexCount=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],IC()}_createMeshCanvas(t,e,i){const o=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-o,c=Math.ceil(this._bounds[3])-l,u=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3)||1,p=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3)||1,b=h?h/u:1,y=c?c/p:1,w={coords:this._posData,colors:this._colData,offsetX:-o,offsetY:-l,scaleX:1/b,scaleY:1/y},v=u+2*2,A=p+2*2,E=i.create(v,A);if(MC()&&this._vertexCount>48)E.context.drawImage(DC(this._posData,this._colData,this._vertexCount,w,e,v,A,2),0,0);else{const S=E.context.createImageData(u,p);if(e){const x=S.data;for(let _=0,C=x.length;_<C;_+=4)x[_]=e[0],x[_+1]=e[1],x[_+2]=e[2],x[_+3]=255}for(let x=0,_=this._vertexCount;x<_;x+=3)RC(S,w,x,x+1,x+2,x,x+1,x+2);E.context.putImageData(S,2,2)}return{canvas:E.canvas,offsetX:o-2*b,offsetY:l-2*y,scaleX:b,scaleY:y}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,s){sm(t,this._bbox);const r=new Float32Array(2);if(s===Ie.SHADING)N.singularValueDecompose2dScale(It(t),r);else if(this.matrix){N.singularValueDecompose2dScale(this.matrix,r);const[l,h]=r;N.singularValueDecompose2dScale(e.baseTransform,r),r[0]*=l,r[1]*=h}else N.singularValueDecompose2dScale(e.baseTransform,r);const a=this._createMeshCanvas(r,s===Ie.SHADING?null:this._background,e.canvasFactory);s!==Ie.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(a.offsetX,a.offsetY),t.scale(a.scaleX,a.scaleY);const o=t.createPattern(a.canvas,"no-repeat");return e.canvasFactory.destroy(a),o}}class FC extends lA{getPattern(){return"hotpink"}}function OC(d){switch(d[0]){case"RadialAxial":return new LC(d);case"Mesh":return new NC(d);case"Dummy":return new FC}throw new Error(`Unknown IR type: ${d[0]}`)}const HA={COLORED:1,UNCOLORED:2}
45,ub=class ub{constructor(t,e,i,s){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.needsIsolation=t[9]??!0,this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=s,this.patternBaseMatrix=this.matrix?N.transform(s,this.matrix):s}canSkipPatternCanvas([t,e,i,s]){const[r,a,o,l]=this.bbox,h=Math.abs(this.xstep),c=Math.abs(this.ystep);if(t>h+1e-6||e>c+1e-6)return null;const u=Math.floor((i-o)/h)+1,p=Math.ceil((i+t-r)/h)-1,b=Math.floor((s-l)/c)+1,y=Math.ceil((s+e-a)/c)-1;return p<=u&&y<=b?[u,b]:null}updatePatternDims(t,e){const i=N.inverseTransform(this.patternBaseMatrix),s=[t[0],t[1]],r=[t[2],t[3]];N.applyTransform(s,i),N.applyTransform(r,i),e[0]=Math.abs(r[0]-s[0]),e[1]=Math.abs(r[1]-s[1]),e[2]=Math.min(s[0],r[0]),e[3]=Math.min(s[1],r[1])}_renderTileCanvas(t,e,i,s){var p,b;const[r,a,o,l]=this.bbox,h=t.canvasFactory.create(i.size,s.size),c=h.context,u=this.canvasGraphicsFactory.createCanvasGraphics(c,e);return u.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(u,this.paintType,this.color),c.translate(-i.scale*r,-s.scale*a),u.transform(0,i.scale,0,0,s.scale,0,0),c.save(),(p=u.dependencyTracker)==null||p.save(),this.clipBbox(u,r,a,o,l),u.baseTransform=It(u.ctx),u.executeOperatorList(this.operatorList),u.endDrawing(),(b=u.dependencyTracker)==null||b.restore(),c.restore(),h}_getCombinedScales(){const t=new Float32Array(2);N.singularValueDecompose2dScale(this.matrix,t);const[e,i]=t;return N.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],i*t[1]]}drawPattern(t,e,i=!1,[s,r],a){const[o,l,h,c]=this.bbox,u=t.dependencyTracker;if(u&&(t.dependencyTracker=new $u(u,a)),t.save(),i?t.ctx.clip(e,"evenodd"):t.ctx.clip(e),t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(s*this.xstep,r*this.ystep),this.needsIsolation||t.ctx.globalAlpha!==1||t.ctx.globalCompositeOperation!=="source-over"||t.inSMaskMode){const p=h-o,b=c-l,[y,w]=this._getCombinedScales(),v=this.getSizeAndScale(p,this.ctx.canvas.width,y),A=this.getSizeAndScale(b,this.ctx.canvas.height,w),E=this._renderTileCanvas(t,a,v,A);t.ctx.drawImage(E.canvas,o,l,p,b),t.canvasFactory.destroy(E)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,o,l,h,c),t.baseTransformStack.push(t.baseTransform),t.baseTransform=It(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();t.restore(),u&&(t.dependencyTracker=u)}createPatternCanvas(t,e){const[i,s,r,a]=this.bbox,o=r-i,l=a-s;let{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),Fb("TilingType: "+this.tilingType);const[u,p]=this._getCombinedScales();let b=o,y=l,w=!1,v=!1;Math.ceil(h*u)>=Math.ceil(o*u)?b=h:w=!0,Math.ceil(c*p)>=Math.ceil(l*p)?y=c:v=!0;const A=this.getSizeAndScale(b,this.ctx.canvas.width,u),E=this.getSizeAndScale(y,this.ctx.canvas.height,p),S=this._renderTileCanvas(t,e,A,E);if(w||v){const x=S.canvas;w&&(b=h),v&&(y=c);const _=this.getSizeAndScale(b,this.ctx.canvas.width,u),C=this.getSizeAndScale(y,this.ctx.canvas.height,p),k=_.size,D=C.size,P=t.canvasFactory.create(k,D),I=P.context,L=w?Math.floor(o/h):0,O=v?Math.floor(l/c):0;for(let H=0;H<=L;H++)for(let W=0;W<=O;W++)I.drawImage(x,k*H,D*W,k,D,0,0,k,D);return t.canvasFactory.destroy(S),{canvas:P.canvas,canvasEntry:P,scaleX:_.scale,scaleY:C.scale,offsetX:i,offsetY:s}}return{canvas:S.canvas,canvasEntry:S,scaleX:A.scale,scaleY:E.scale,offsetX:i,offsetY:s}}getSizeAndScale(t,e,i){const s=Math.max(ub.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*i);return r>=s?r=s:i=r/t,{scale:i,size:r}}clipBbox(t,e,i,s,r){const a=s-e,o=r-i,l=new Path2D;l.rect(e,i,a,o),N.axialAlignedBoundingBox([e,i,s,r],It(t.ctx),t.current.minMax),t.ctx.clip(l),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,i){const s=t.ctx,r=t.current;switch(r.patternFill=r.patternStroke=!1,e){case HA.COLORED:const{fillStyle:a,strokeStyle:o}=this.ctx;s.fillStyle=r.fillColor=a,s.strokeStyle=r.strokeColor=o;break;case HA.UNCOLORED:s.fillStyle=s.strokeStyle=i,r.fillColor=r.strokeColor=i;break;default:throw new O_(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,s,r){const a=s!==Ie.SHADING?N.transform(i,this.patternBaseMatrix):i,o=this.createPatternCanvas(e,r);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const h=t.createPattern(o.canvas,"repeat");return e.canvasFactory.destroy(o.canvasEntry),h.setTransform(l),h}};T(ub,"MAX_PATTERN_SIZE",3e3);let Ru=ub;const BC=16,jC=100,UC=15,zA=10,gi=16,Fi=new Float32Array(2);function WA(d,t){if(d._removeMirroring)throw new Error("Context is already forwarding operations.");const e=new Map;for(const i of["save","restore","rotate","scale","translate","transform","setTransform","resetTransform","clip","moveTo","lineTo","bezierCurveTo","quadraticCurveTo","arc","arcTo","ellipse","rect","roundRect","closePath","beginPath"]){const s=d[i];typeof s!="function"||typeof t[i]!="function"||(e.set(i,s),d[i]=function(...r){return t[i](...r),s.apply(this,r)})}d._removeMirroring=()=>{for(const[i,s]of e)d[i]=s;delete d._removeMirroring}}function Lg(d,t,e,i,s,r,a,o,l,h){const[c,u,p,b,y,w]=It(d);if(u===0&&p===0){const E=a*c+y,S=Math.round(E),x=o*b+w,_=Math.round(x),C=(a+l)*c+y,k=Math.abs(Math.round(C)-S)||1,D=(o+h)*b+w,P=Math.abs(Math.round(D)-_)||1;return d.setTransform(Math.sign(c),0,0,Math.sign(b),S,_),d.drawImage(t,e,i,s,r,0,0,k,P),d.setTransform(c,u,p,b,y,w),[k,P]}if(c===0&&b===0){const E=o*p+y,S=Math.round(E),x=a*u+w,_=Math.round(x),C=(o+h)*p+y,k=Math.abs(Math.round(C)-S)||1,D=(a+l)*u+w,P=Math.abs(Math.round(D)-_)||1;return d.setTransform(0,Math.sign(u),Math.sign(p),0,S,_),d.drawImage(t,e,i,s,r,0,0,P,k),d.setTransform(c,u,p,b,y,w),[P,k]}d.drawImage(t,e,i,s,r,a,o,l,h);const v=Math.hypot(c,u),A=Math.hypot(p,b);return[v*l,A*h]}class GA{constructor(t,e){T(this,"alphaIsShape",!1);T(this,"fontSize",0);T(this,"fontSizeScale",1);T(this,"textMatrix",null);T(this,"textMatrixScale",1);T(this,"fontMatrix",by);T(this,"leading",0);T(this,"x",0);T(this,"y",0);T(this,"lineX",0);T(this,"lineY",0);T(this,"charSpacing",0);T(this,"wordSpacing",0);T(this,"textHScale",1);T(this,"textRenderingMode",he.FILL);T(this,"textRise",0);T(this,"fillColor","#000000");T(this,"strokeColor","#000000");T(this,"tilingPatternDims",null);T(this,"patternFill",!1);T(this,"patternStroke",!1);T(this,"fillAlpha",1);T(this,"strokeAlpha",1);T(this,"lineWidth",1);T(this,"activeSMask",null);T(this,"transferMaps","none");T(this,"minMax",ko.slice());this.clipBox=new Float32Array([0,0,t,e])}clone(){var e;const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t.tilingPatternDims=(e=this.tilingPatternDims)==null?void 0:e.slice(),t}getPathBoundingBox(t=Ie.FILL,e=null){const i=this.minMax.slice();if(t===Ie.STROKE){e||lt("Stroke bounding box must include transform."),N.singularValueDecompose2dScale(e,Fi);const s=Fi[0]*this.lineWidth/2,r=Fi[1]*this.lineWidth/2;i[0]-=s,i[1]-=r,i[2]+=s,i[3]+=r}return i}updateClipFromPath(){const t=N.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(ko,0)}getClippedPathBoundingBox(t=Ie.FILL,e=null){return N.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function XA(d,t){const{width:e,height:i,kind:s}=t,r=i%gi,a=(i-r)/gi,o=r===0?a:a+1,l=d.createImageData(e,gi);let h=0;const c=t.data,u=l.data;let p;if(s===zg.GRAYSCALE_1BPP)for(p=0;p<o;p++)({srcPos:h}=U0({src:c,srcPos:h,dest:u,width:e,height:p<a?gi:r})),d.putImageData(l,0,p*gi);else if(s===zg.RGBA_32BPP){let b=0,y=e*gi*4;
45for(p=0;p<a;p++)u.set(c.subarray(h,h+y)),h+=y,d.putImageData(l,0,b),b+=gi;p<o&&(y=e*r*4,u.set(c.subarray(h,h+y)),d.putImageData(l,0,b))}else if(s===zg.RGB_24BPP)for(p=0;p<o;p++)({srcPos:h}=CC({src:c,srcPos:h,dest:new Uint32Array(u.buffer),width:e,height:p<a?gi:r})),d.putImageData(l,0,p*gi);else throw new Error(`bad image kind: ${s}`)}function YA(d,t){if(t.bitmap){d.drawImage(t.bitmap,0,0);return}const{width:e,height:i}=t,s=i%gi,r=(i-s)/gi,a=s===0?r:r+1,o=d.createImageData(e,gi);let l=0;const h=t.data,c=o.data;for(let u=0;u<a;u++)({srcPos:l}=U0({src:h,srcPos:l,dest:c,width:e,height:u<r?gi:s,nonBlackColor:0})),d.putImageData(o,0,u*gi)}function po(d,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of e)d[i]!==void 0&&(t[i]=d[i]);d.setLineDash!==void 0&&(t.setLineDash(d.getLineDash()),t.lineDashOffset=d.lineDashOffset)}function Rg(d){d.strokeStyle=d.fillStyle="#000000",d.fillRule="nonzero",d.globalAlpha=1,d.lineWidth=1,d.lineCap="butt",d.lineJoin="miter",d.miterLimit=10,d.globalCompositeOperation="source-over",d.font="10px sans-serif",d.setLineDash!==void 0&&(d.setLineDash([]),d.lineDashOffset=0);const{filter:t}=d;t!=="none"&&t!==""&&(d.filter="none")}function KA(d,t){if(t)return!0;N.singularValueDecompose2dScale(d,Fi);const e=Math.fround(uo.pixelRatio*Wd.PDF_TO_CSS_UNITS);return Fi[0]<=e&&Fi[1]<=e}const $C=["butt","round","square"],VC=["miter","round","bevel"],HC={},qA={};var fb,Ei,ga,ll,hl,cl,dl,ul,fl,pl,Zs,X,rw,aw,ow,lw,hw,ni,Ne,cw,V0,nm;const _o=class _o{constructor(t,e,i,s,r,{optionalContentConfig:a,markedContentStack:o=null},l,h,c,u){m(this,X);m(this,Ei,0);m(this,ga,0);m(this,ll,null);m(this,hl,null);m(this,cl,null);m(this,dl,null);m(this,ul,1);m(this,fl);m(this,pl,null);m(this,Zs,[]);this.ctx=t,this.current=new GA(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=r,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=o||[],this.optionalContentConfig=a,this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=c??null,this.imagesTracker=u??null}getObject(t,e,i=null){var s;return typeof e=="string"?((s=this.dependencyTracker)==null||s.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:s=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,i){const l=this.transparentCanvasEntry=this.canvasFactory.create(r,a);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=l,this.ctx.save(),this.ctx.transform(...It(this.compositeCtx))}this.ctx.save(),Rg(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[3]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=It(this.ctx)}executeOperatorList(t,e,i,s,r){var A;const a=t.argsArray,o=t.fnArray;let l=e||0;const h=a.length;if(h===l)return l;const c=h-l>zA&&typeof i=="function",u=c?Date.now()+UC:0;let p=0;const b=this.commonObjs,y=this.objs;let w,v;for(;;){if(s!==void 0){if(l===s.nextBreakPoint)return s.breakIt(l,i),l;if(s.shouldSkip(l)){if(++l===h)return l;continue}}if(!r||r(l))if(w=o[l],v=a[l]??null,w!==Bs.dependency)v===null?this[w](l):this[w](l,...v);else for(const E of v){(A=this.dependencyTracker)==null||A.recordNamedData(E,l);const S=E.startsWith("g_")?b:y;if(!S.has(E))return S.get(E,i),l}if(l++,l===h)return l;if(c&&++p>zA){if(Date.now()>u)return i(),l;p=0}}}endDrawing(){g(this,X,rw).call(this);for(const t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0;for(const t of n(this,Zs))g(this,X,nm).call(this,t);n(this,Zs).length=0,f(this,ll,null),f(this,hl,null),f(this,cl,null),f(this,dl,null),f(this,ul,1),f(this,pl,null),f(this,ga,0),f(this,Ei,0),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),g(this,X,aw).call(this)}
45_scaleImage(t,e){const i=t.width??t.displayWidth,s=t.height??t.displayHeight,r=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),o=[];let l=r,h=a,c=i,u=s;for(;l>2&&c>1||h>2&&u>1;){let A=c,E=u;l>2&&c>1&&(A=Math.ceil(c/2),l/=c/A),h>2&&u>1&&(E=Math.ceil(u/2),h/=u/E),o.push({newWidth:A,newHeight:E}),c=A,u=E}if(o.length===0)return{img:t,paintWidth:i,paintHeight:s,tmpCanvas:null};if(o.length===1){const{newWidth:A,newHeight:E}=o[0],S=this.canvasFactory.create(A,E);return S.context.drawImage(t,0,0,i,s,0,0,A,E),{img:S.canvas,paintWidth:A,paintHeight:E,tmpCanvas:S}}let p=this.canvasFactory.create(1,1),b=this.canvasFactory.create(1,1),y=i,w=s,v=t;for(const{newWidth:A,newHeight:E}of o)this.canvasFactory.reset(b,A,E),b.context.drawImage(v,0,0,y,w,0,0,A,E),[p,b]=[b,p],v=p.canvas,y=A,w=E;return this.canvasFactory.destroy(b),{img:p.canvas,paintWidth:y,paintHeight:w,tmpCanvas:p}}_createMaskCanvas(t,e){var L,O;const i=this.ctx,{width:s,height:r}=e,a=this.current.fillColor,o=this.current.patternFill,l=It(i);let h,c,u,p;if((e.bitmap||e.data)&&e.count>1){const H=e.bitmap||e.data.buffer;c=JSON.stringify(o?l:[l.slice(0,4),a]),h=this._cachedBitmapsMap.getOrInsertComputed(H,sA);const W=h.get(c);if(W&&!o){const pt=Math.round(Math.min(l[0],l[2])+l[4]),R=Math.round(Math.min(l[1],l[3])+l[5]);return(L=this.dependencyTracker)==null||L.recordDependencies(t,Hi.transformAndFill),{canvas:W,offsetX:pt,offsetY:R}}u=W}u||(p=this.canvasFactory.create(s,r),YA(p.context,e));let b=N.transform(l,[1/s,0,0,-1/r,0,0]);b=N.transform(b,[1,0,0,1,0,-r]);const y=ko.slice();N.axialAlignedBoundingBox([0,0,s,r],b,y);const[w,v,A,E]=y,S=Math.round(A-w)||1,x=Math.round(E-v)||1,_=this.canvasFactory.create(S,x),C=_.context,k=w,D=v;C.translate(-k,-D),C.transform(...b);let P=null;if(!u){const H=this._scaleImage(p.canvas,Ls(C));u=H.img,P=H.tmpCanvas,u!==p.canvas&&(this.canvasFactory.destroy(p),p=null),h&&o&&(h.set(c,u),P=null,p=null)}C.imageSmoothingEnabled=KA(It(C),e.interpolate),Lg(C,u,0,0,u.width,u.height,0,0,s,r),P&&this.canvasFactory.destroy(P),p&&this.canvasFactory.destroy(p),C.globalCompositeOperation="source-in";const I=N.transform(Ls(C),[1,0,0,1,-k,-D]);return C.fillStyle=o?a.getPattern(i,this,I,Ie.FILL,t):a,C.fillRect(0,0,s,r),h&&!o&&h.set(c,_.canvas),(O=this.dependencyTracker)==null||O.recordDependencies(t,Hi.transformAndFill),{canvas:_.canvas,canvasEntry:h&&!o?null:_,offsetX:Math.round(k),offsetY:Math.round(D)}}setLineWidth(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("lineCap",t),this.ctx.lineCap=$C[e]}setLineJoin(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("lineJoin",t),this.ctx.lineJoin=VC[e]}setMiterLimit(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){var r;(r=this.dependencyTracker)==null||r.recordSimpleData("dash",t);const s=this.ctx;s.setLineDash!==void 0&&(s.setLineDash(e),s.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var i,s,r,a,o;for(const[l,h]of e)switch(l){case"LW":this.setLineWidth(t,h);break;case"LC":this.setLineCap(t,h);break;case"LJ":this.setLineJoin(t,h);break;case"ML":this.setMiterLimit(t,h);break;case"D":this.setDash(t,h[0],h[1]);break;case"RI":this.setRenderingIntent(t,h);break;case"FL":this.setFlatness(t,h);break;case"Font":this.setFont(t,h[0],h[1]);break;case"CA":(i=this.dependencyTracker)==null||i.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=h;break;case"ca":(s=this.dependencyTracker)==null||s.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=h;break;case"BM":(r=this.dependencyTracker)==null||r.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=h;break;case"SMask":(a=this.dependencyTracker)==null||a.recordSimpleData("SMask",t),this.current.activeSMask=h?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(t);break;case"TR":(o=this.dependencyTracker)==null||o.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(h);break}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.smaskPreparedOOBAlpha=null}_ensurePreparedSMask(t){t!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(t))}checkSMaskState(t){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode(t):!this.current.activeSMask&&e?this.endSMaskMode():this.current.activeSMask&&e&&this._ensurePreparedSMask(this.current.activeSMask)}_prepareSMaskCanvas(t){const{canvas:e,subtype:i,backdrop:s,transferMap:r}=t,a=i==="Luminosity"||i==="Alpha"&&r;if(!a&&!(i==="Luminosity"&&s)){this.smaskPreparedFor=t;return}let o;if(i==="Luminosity"&&s){const[E,S,x]=Pg(s),_=Math.round(.3*E+.59*S+.11*x);o=(r==null?void 0:r[_])??_}else o=(r==null?void 0:r[0])??0;const l=4,{width:h,height:c}=this.ctx.canvas,u=e.width*e.height,p=h*c<l*u,b=a?{url:i==="Alpha"?this.filterFactory.addAlphaFilter(r):this.filterFactory.addLuminosityFilter(r),subtype:i,transferMap:r}:null,y=i==="Luminosity"?s:null;let w,v,A;p?(w=this._bakeSMaskCanvas(e,t.offsetX,t.offsetY,h,c,y,b),v=0,A=0):(w=this._bakeSMaskCanvas(e,0,0,e.width,e.height,y,b),v=t.offsetX,A=t.offsetY),this.smaskPreparedEntry=w,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=v,this.smaskPreparedOffsetY=A,this.smaskPreparedOOBAlpha=!p&&o!==0?o:null}_bakeSMaskCanvas(t,e,i,s,r,a,o){!a&&!o&<("_bakeSMaskCanvas with
45neither backdrop nor filter");const l=this.canvasFactory.create(s,r),h=l.context;if(h.drawImage(t,e,i),a&&(h.globalCompositeOperation="destination-atop",h.fillStyle=a,h.fillRect(0,0,s,r)),!o)return l;const c=this.canvasFactory.create(s,r),u=c.context;u.filter=o.url;const p=xt.isCanvasFilterSupported&&u.filter!=="none"&&u.filter!=="";if(u.drawImage(l.canvas,0,0),xt.isCanvasFilterSupported&&(u.filter="none"),!p){const b=u.getImageData(0,0,s,r),{data:y}=b,{transferMap:w}=o;if(o.subtype==="Luminosity")for(let v=0,A=y.length;v<A;v+=4){const E=.3*y[v]+.59*y[v+1]+.11*y[v+2]+.5|0;y[v]=y[v+1]=y[v+2]=0,y[v+3]=(w==null?void 0:w[E])??E}else for(let v=3,A=y.length;v<A;v+=4)y[v]=w[y[v]];u.putImageData(b,0,0)}return this.canvasFactory.destroy(l),c}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const{width:e,height:i}=this.ctx.canvas,s=this.canvasFactory.create(e,i);this.smaskScratchCanvas=s,this.suspendedCtx=this.ctx;const r=this.ctx=s.context;r.setTransform(this.suspendedCtx.getTransform()),po(this.suspendedCtx,r),WA(r,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),po(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}compose(t){if(!this.current.activeSMask)return;t=t?[Math.floor(t[0]),Math.floor(t[1]),Math.ceil(t[2]),Math.ceil(t[3])]:[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx,s=n(this,ga)>0&&i===this.ctx;this.composeSMask(s?null:i,e,this.ctx,t),!s&&(this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(t,e,i,s){const r=s[0],a=s[1],o=s[2]-r,l=s[3]-a;if(o===0||l===0)return;const h=this.smaskPreparedEntry;if(h){let c=r,u=a,p=o,b=l;const y=this.smaskPreparedOOBAlpha,w=y!==null;if(w){c=Math.max(r,e.offsetX),u=Math.max(a,e.offsetY);const v=Math.min(r+o,e.offsetX+e.canvas.width),A=Math.min(a+l,e.offsetY+e.canvas.height);p=v-c,b=A-u}if(p>0&&b>0){const v=c-this.smaskPreparedOffsetX,A=u-this.smaskPreparedOffsetY;i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0);const E=new Path2D;E.rect(c,u,p,b),i.clip(E),i.globalCompositeOperation="destination-in",i.drawImage(h.canvas,v,A,p,b,c,u,p,b),i.restore()}w&&y<255&&this._applySMaskOOBAlpha(i,r,a,o,l,c,u,c+p,u+b,y)}else this.genericComposeSMask(e,i,o,l,r,a);t&&(t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,r,a,o,l,r,a,o,l),t.restore())}_applySMaskOOBAlpha(t,e,i,s,r,a,o,l,h,c){const u=a<l&&o<h;if(u&&a===e&&o===i&&l===e+s&&h===i+r)return;const p=new Path2D;p.rect(e,i,s,r),u&&p.rect(a,o,l-a,h-o),t.save(),t.globalAlpha=c/255,t.setTransform(1,0,0,1,0,0),t.clip(p,"evenodd"),t.globalCompositeOperation="destination-in",t.fillStyle="#000000",t.fillRect(e,i,s,r),t.restore()}genericComposeSMask(t,e,i,s,r,a){const{context:o,offsetX:l,offsetY:h}=t;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const c=new Path2D;c.rect(r,a,i,s),e.clip(c),e.globalCompositeOperation="destination-in",e.drawImage(o.canvas,r-l,a-h,i,s,r,a,i,s),e.restore()}save(t){var i;this.inSMaskMode&&po(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone(),(i=this.dependencyTracker)==null||i.save(t)}restore(t){var e;if((e=this.dependencyTracker)==null||e.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(po(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(t),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,i,s,r,a,o){var l;(l=this.dependencyTracker)==null||l.recordIncrementalData("transform",t),this.ctx.transform(e,i,s,r,a,o),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,s){let[r]=i;if(!s){r||(r=i[0]=new Path2D),e!==Bs.stroke&&e!==Bs.closeStroke&&(this.current.tilingPatternDims=null),this[e](t,r);return}if(this.dependencyTracker!==null){const o=e===Bs.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,s[0]-o,s[2]+o,s[1]-o,s[3]+o).recordDependencies(t,["transform"])}r instanceof Path2D||(r=i[0]=GE(r)),N.axialAlignedBoundingBox(s,It(this.ctx),this.current.minMax);const a=this.current.tilingPatternDims;if(a&&e!==Bs.stroke&&e!==Bs.closeStroke&&this.current.fillColor instanceof Ru){const o=N.intersect(this.current.clipBox,this.current.minMax);o?this.current.fillColor.updatePatternDims(o,a):this.current.tilingPatternDims=null}this[e](t,r),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,i=!0){var o;const s=i&&g(this,X,ni).call(this,this.current.strokeAlpha),r=this.ctx,a=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof a=="object"&&(a!=null&&a.getPattern)){const l=a.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=a.getPattern(r,this,Ls(r),Ie.STROKE,t),l){const h=new Path2D;h.addPath(e,r.getTransform().invertSelf().multiplySelf(l)),e=h}
45this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);(o=this.dependencyTracker)==null||o.recordDependencies(t,Hi.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Ie.STROKE,It(this.ctx))),r.globalAlpha=this.current.fillAlpha,g(this,X,Ne).call(this,s)}closeStroke(t,e){this.stroke(t,e)}fill(t,e,i=!0){var c,u,p;const s=i&&g(this,X,ni).call(this,this.current.fillAlpha),r=this.ctx,a=this.current.fillColor,o=this.current.patternFill;let l=!1;const h=this.current.getClippedPathBoundingBox();if((c=this.dependencyTracker)==null||c.recordDependencies(t,Hi.fill),o){const b=this.current.tilingPatternDims,y=b&&a.canSkipPatternCanvas(b);if(y){a.drawPattern(this,e,this.pendingEOFill,y,t),this.pendingEOFill=!1,i&&this.consumePath(t,e,h),this.current.tilingPatternDims=null,g(this,X,Ne).call(this,s);return}const w=a.isModifyingCurrentTransform()?r.getTransform():null;if((u=this.dependencyTracker)==null||u.save(t),r.save(),r.fillStyle=a.getPattern(r,this,Ls(r),Ie.FILL,t),w){const v=new Path2D;v.addPath(e,r.getTransform().invertSelf().multiplySelf(w)),e=v}l=!0}this.contentVisible&&h!==null&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),l&&(r.restore(),(p=this.dependencyTracker)==null||p.restore(t)),i&&this.consumePath(t,e,h),g(this,X,Ne).call(this,s)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){const i=g(this,X,ni).call(this,Math.min(this.current.fillAlpha,this.current.strokeAlpha));this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e),g(this,X,Ne).call(this,i)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){var s;const i=g(this,X,ni).call(this,this.current.fillAlpha);this.ctx.fill(e),(s=this.dependencyTracker)==null||s.recordDependencies(t,Hi.rawFillPath).recordOperation(t),g(this,X,Ne).call(this,i)}clip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=HC}eoClip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=qA}beginText(t){var e;this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,(e=this.dependencyTracker)==null||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){const{dependencyTracker:s}=this;e!==void 0&&s.recordFutureForcedDependency("textClip",s.getOpenMarker()).recordFutureForcedDependency("textClip",t),s.recordCloseMarker(t)}if(e!==void 0){const s=new Path2D,r=i.getTransform().invertSelf();for(const{transform:a,x:o,y:l,fontSize:h,path:c}of e)c&&s.addPath(c,new DOMMatrix(a).preMultiplySelf(r).translate(o,l).scale(h,-h));i.clip(s)}delete this.pendingTextPaths}setCharSpacing(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){var u,p;(u=this.dependencyTracker)==null||u.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const s=this.commonObjs.get(e),r=this.current;if(!s)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=s.fontMatrix||by,(r.fontMatrix[0]===0||r.fontMatrix[3]===0)&&J("Invalid font matrix for font "+e),i<0?(i=-i,r.fontDirection=-1):r.fontDirection=1,this.current.font=s,this.current.fontSize=i,s.isType3Font)return;const a=s.loadedName||"sans-serif",o=((p=s.systemFontInfo)==null?void 0:p.css)||`"${a}", ${s.fallbackName}`;let l="normal";s.black?l="900":s.bold&&(l="bold");const h=s.italic?"italic":"normal",c=Nt(i,BC,jC);this.current.fontSizeScale=i/c,this.ctx.font=`${h} ${l} ${c}px ${o}`}setTextRenderingMode(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){var s;(s=this.dependencyTracker)==null||s.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){var s;(s=this.dependencyTracker)==null||s.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);const{current:i}=this;i.textMatrix=e,i.textMatrixScale=Math.hypot(e[0],e[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(t){var e;this.moveText(t,0,this.current.leading),(e=this.dependencyTracker)==null||e.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}
45paintChar(t,e,i,s,r,a){var A,E,S,x;const o=this.ctx,l=this.current,h=l.font,c=l.textRenderingMode,u=l.fontSize/l.fontSizeScale,p=c&he.FILL_STROKE_MASK,b=!!(c&he.ADD_TO_PATH_FLAG),y=l.patternFill&&!h.missingFile,w=l.patternStroke&&!h.missingFile;let v;if((h.disableFontFace||b||y||w)&&!h.missingFile&&(v=h.getPathGenerator(this.commonObjs,e)),v&&(h.disableFontFace||y||w)){o.save(),o.translate(i,s),o.scale(u,-u),(A=this.dependencyTracker)==null||A.recordCharacterBBox(t,o,h);let _;if(p===he.FILL||p===he.FILL_STROKE)if(r){_=o.getTransform(),o.setTransform(...r);const C=g(this,X,cw).call(this,v,_,r);o.fill(C)}else o.fill(v);if(p===he.STROKE||p===he.FILL_STROKE)if(a){_||(_=o.getTransform()),o.setTransform(...a);const{a:C,b:k,c:D,d:P}=_,I=N.inverseTransform(a),L=N.transform([C,k,D,P,0,0],I);N.singularValueDecompose2dScale(L,Fi),o.lineWidth*=Math.max(Fi[0],Fi[1])/u,o.stroke(g(this,X,cw).call(this,v,_,a))}else o.lineWidth/=u,o.stroke(v);o.restore()}else(p===he.FILL||p===he.FILL_STROKE)&&(o.fillText(e,i,s),(E=this.dependencyTracker)==null||E.recordCharacterBBox(t,o,h,u,i,s,()=>o.measureText(e))),(p===he.STROKE||p===he.FILL_STROKE)&&(this.dependencyTracker&&((S=this.dependencyTracker)==null||S.recordCharacterBBox(t,o,h,u,i,s,()=>o.measureText(e)).recordDependencies(t,Hi.stroke)),o.strokeText(e,i,s));b&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:It(o),x:i,y:s,fontSize:u,path:v}),(x=this.dependencyTracker)==null||x.recordCharacterBBox(t,o,h,u,i,s))}get isFontSubpixelAAEnabled(){const t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);const i=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let s=!1;for(let r=3;r<i.length;r+=4)if(i[r]>0&&i[r]<255){s=!0;break}return Y(this,"isFontSubpixelAAEnabled",s)}showText(t,e){var O,H,W,pt;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Hi.showText).resetBBox(t),this.current.textRenderingMode&he.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const i=this.current,s=i.font;if(s.isType3Font){const R=g(this,X,ni).call(this,i.fillAlpha);this.showType3Text(t,e),(O=this.dependencyTracker)==null||O.recordShowTextOperation(t),g(this,X,Ne).call(this,R);return}const r=i.fontSize;if(r===0){(H=this.dependencyTracker)==null||H.recordOperation(t);return}const a=g(this,X,ni).call(this,i.fillAlpha),o=this.ctx,l=i.fontSizeScale,h=i.charSpacing,c=i.wordSpacing,u=i.fontDirection,p=i.textHScale*u,b=e.length,y=s.vertical,w=y?1:-1,v=s.defaultVMetrics,A=r*i.fontMatrix[0],E=i.textRenderingMode===he.FILL&&!s.disableFontFace&&!i.patternFill;o.save(),i.textMatrix&&o.transform(...i.textMatrix),o.translate(i.x,i.y+i.textRise),u>0?o.scale(p,-1):o.scale(p,1);let S,x;const _=i.textRenderingMode&he.FILL_STROKE_MASK,C=_===he.FILL||_===he.FILL_STROKE,k=_===he.STROKE||_===he.FILL_STROKE;let D=i.lineWidth;const P=i.textMatrixScale;if(P===0||D===0?k&&(D=this.getSinglePixelWidth()):D/=P,l!==1&&(o.scale(l,l),D/=l),o.lineWidth=D,C&&i.patternFill){o.save();const R=i.fillColor.getPattern(o,this,Ls(o),Ie.FILL,t);S=It(o),o.restore(),o.fillStyle=R}if(k&&i.patternStroke){o.save();const R=i.strokeColor.getPattern(o,this,Ls(o),Ie.STROKE,t);x=It(o),o.restore(),o.strokeStyle=R}if(s.isInvalidPDFjsFont){const R=[];let j=0;for(const gt of e)R.push(gt.unicode),j+=gt.width;const nt=R.join("");if(o.fillText(nt,0,0),this.dependencyTracker!==null){const gt=o.measureText(nt);this.dependencyTracker.recordBBox(t,this.ctx,-gt.actualBoundingBoxLeft,gt.actualBoundingBoxRight,-gt.actualBoundingBoxAscent,gt.actualBoundingBoxDescent).recordShowTextOperation(t)}i.x+=j*A*p,o.restore(),this.compose(),g(this,X,Ne).call(this,a);return}let I=0,L;for(L=0;L<b;++L){const R=e[L];if(typeof R=="number"){I+=w*R*r/1e3;continue}let j=!1;const nt=(R.isSpace?c:0)+h,gt=R.fontChar,ze=R.accent;let xe,Jt,yt=R.width;if(y){const ge=R.vmetric||v,Tt=-(R.vmetric?ge[1]:yt*.5)*A,Kb=ge[2]*A;yt=ge?-ge[0]:yt,xe=Tt/l,Jt=(I+Kb)/l}else xe=I/l,Jt=0;let Ds;if(s.remeasure&&yt>0){Ds=o.measureText(gt);const ge=Ds.width*1e3/r*l;if(yt<ge&&this.isFontSubpixelAAEnabled){const Tt=yt/ge;j=!0,o.save(),o.scale(Tt,1),xe/=Tt}else yt!==ge&&(xe+=(yt-ge)/2e3*r/l)}if(this.contentVisible&&(R.isInFont||s.missingFile)){if(E&&!ze)o.fillText(gt,xe,Jt),(W=this.dependencyTracker)==null||W.recordCharacterBBox(t,o,Ds?{bbox:null}:s,r/l,xe,Jt,()=>Ds??o.measureText(gt));else if(this.paintChar(t,gt,xe,Jt,S,x),ze){const ge=xe+r*ze.offset.x/l,Tt=Jt-r*ze.offset.y/l;this.paintChar(t,ze.fontChar,ge,Tt,S,x)}}const Jd=y?yt*A-nt*u:yt*A+nt*u;
45I+=Jd,j&&o.restore()}y?i.y-=I:i.x+=I*p,o.restore(),this.compose(),(pt=this.dependencyTracker)==null||pt.recordShowTextOperation(t),g(this,X,Ne).call(this,a)}showType3Text(t,e){const i=this.ctx,s=this.current,r=s.font,a=s.fontSize,o=s.fontDirection,l=r.vertical?1:-1,h=s.charSpacing,c=s.wordSpacing,u=s.textHScale*o,p=s.fontMatrix||by,b=e.length,y=s.textRenderingMode===he.INVISIBLE;let w,v,A,E;if(y||a===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),s.textMatrix&&i.transform(...s.textMatrix),i.translate(s.x,s.y+s.textRise),i.scale(u,o);const S=this.dependencyTracker;for(this.dependencyTracker=S?new $u(S,t):null,w=0;w<b;++w){if(v=e[w],typeof v=="number"){E=l*v*a/1e3,this.ctx.translate(E,0),s.x+=E*u;continue}const x=(v.isSpace?c:0)+h,_=r.charProcOperatorList.get(v.operatorListId);_?this.contentVisible&&(this.save(),_.fnArray[0]===Bs.setCharWidth&&(s.fillAlpha=s.strokeAlpha=1,i.globalAlpha=1),i.scale(a,a),i.transform(...p),this.executeOperatorList(_),this.restore()):J(`Type3 character "${v.operatorListId}" is not available.`);const C=[v.width,0];N.applyTransform(C,p),A=C[0]*a+x,i.translate(A,0),s.x+=A*u}
45i.restore(),S&&(this.dependencyTracker=S)}setCharWidth(t,e,i){}setCharWidthAndBounds(t,e,i,s,r,a,o){var h;const l=new Path2D;l.rect(s,r,a-s,o-r),this.ctx.clip(l),(h=this.dependencyTracker)==null||h.recordBBox(t,this.ctx,s,a,r,o).recordClipBox(t,this.ctx,s,a,r,o),this.endPath(t)}getColorN_Pattern(t,e){let i;if(e[0]==="TilingPattern"){const s=this.baseTransform||It(this.ctx),r={createCanvasGraphics:(a,o)=>new _o(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new $u(this.dependencyTracker,o,!0):null)};i=new Ru(e,this.ctx,r,s)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t,...e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("fillColor",t);const i=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=i instanceof Ru?[0,0,0,0]:null}setStrokeRGBColor(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}
45setStrokeTransparent(t){var e;(e=this.dependencyTracker)==null||e.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){var i;(i=this.dependencyTracker)==null||i.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(t){var e;(e=this.dependencyTracker)==null||e.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(t,e,i=null){const s=this.cachedPatterns.getOrInsertComputed(e,()=>OC(this.getObject(t,e)));return i&&(s.matrix=i),s}shadingFill(t,e){var o;if(!this.contentVisible)return;const i=g(this,X,ni).call(this,this.current.fillAlpha),s=this.ctx;this.save(t);const r=this._getPattern(t,e);s.fillStyle=r.getPattern(s,this,Ls(s),Ie.SHADING,t);const a=Ls(s);if(a){const{width:l,height:h}=s.canvas,c=ko.slice();N.axialAlignedBoundingBox([0,0,l,h],a,c);const[u,p,b,y]=c;this.ctx.fillRect(u,p,b-u,y-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(o=this.dependencyTracker)==null||o.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Hi.transform).recordDependencies(t,Hi.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t),g(this,X,Ne).call(this,i)}beginInlineImage(){lt("Should not call beginInlineImage")}beginImageData(){lt("Should not call beginImageData")}
45paintFormXObjectBegin(t,e,i){var s;if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=It(this.ctx),i)){N.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[r,a,o,l]=i,h=new Path2D;h.rect(r,a,o-r,l-a),this.ctx.clip(h),(s=this.dependencyTracker)==null||s.recordClipBox(t,this.ctx,r,o,a,l),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var x;if(!this.contentVisible)return;this.save(t);const{inSMaskMode:i}=this;i&&(this.endSMaskMode(),this.current.activeSMask=null);const s=this.ctx;if((!e.needsIsolation||!e.isolated&&!e.hasSoftMask)&&!e.knockout&&!e.isGray&&n(this,Ei)===0&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&!i){if(e.bbox){let _=new Path2D;const[C,k,D,P]=e.bbox;if(_.rect(C,k,D-C,P-k),e.matrix){const I=new Path2D;I.addPath(_,new DOMMatrix(e.matrix)),_=I}s.clip(_)}this.groupStack.push(null),n(this,Zs).push(null),this.groupLevel++;return}!e.isolated&&!e.knockout&&n(this,Ei)===0&&Fb("TODO: Fully support non-isolated non-knockout groups.");const r=It(s);e.matrix&&s.transform(...e.matrix);const a=[0,0,s.canvas.width,s.canvas.height];let o;e.bbox?(o=ko.slice(),N.axialAlignedBoundingBox(e.bbox,It(s),o),o=N.intersect(o,a)||[0,0,0,0]):o=a;const l=Math.floor(o[0]),h=Math.floor(o[1]),c=Math.max(Math.ceil(o[2])-l,1),u=Math.max(Math.ceil(o[3])-h,1);this.current.startNewPathAndClipBox([0,0,c,u]);const p=this.canvasFactory.create(c,u);e.smask&&this.smaskGroupCanvases.push(p);const b=p.context,y=e.knockout&&!e.isolated?s:null,w=!e.isolated&&!e.knockout&&!e.smask&&e.needsIsolation&&n(this,Ei)>0,v=e.knockout?this.canvasFactory.create(c,u):null,A=n(this,Ei);e.knockout?kt(this,Ei)._++:f(this,Ei,0),b.translate(-l,-h),b.transform(...r);const E=!e.isolated&&!e.smask&&e.needsIsolation,S=E&&!i&&A===0&&!e.knockout&&!e.isGray&&e.hasSoftMask&&s.globalAlpha===1&&s.globalCompositeOperation==="source-over"&&this.current.transferMaps==="none";if(E&&(i||S)&&(b.save(),b.setTransform(1,0,0,1,0,0),b.drawImage(s.canvas,-l,-h),b.restore()),e.bbox){let _=new Path2D;const[C,k,D,P]=e.bbox;if(_.rect(C,k,D-C,P-k),e.matrix){const I=new Path2D;I.addPath(_,new DOMMatrix(e.matrix)),_=I}b.clip(_)}e.smask&&this.smaskStack.push({canvas:p.canvas,context:b,offsetX:l,offsetY:h,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null}),(!e.smask||this.dependencyTracker)&&(s.setTransform(1,0,0,1,0,0),s.translate(l,h),s.save()),po(s,b),this.ctx=b,(x=this.dependencyTracker)==null||x.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(s),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(s),n(this,Zs).push({backdropCtx:y,savedKnockoutLevel:A,offsetX:l,offsetY:h,hasInnerBackdrop:w,replaceBackdrop:S,knockoutMaskEntry:v,knockoutTempEntry:null,knockoutBackdropEntry:null}),this.groupLevel++}endGroup(t,e){var a;if(!this.contentVisible)return;this.groupLevel--;const i=this.ctx,s=this.groupStack.pop(),r=n(this,Zs).pop();if(r&&f(this,Ei,r.savedKnockoutLevel),s===null){this.restore(t);return}if(e.isGray&&g(this,X,V0).call(this,i),this.ctx=s,this.ctx.imageSmoothingEnabled=!1,(a=this.dependencyTracker)==null||a.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform())),g(this,X,nm).call(this,r);else{this.ctx.restore();const o=It(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...o);const l=ko.slice();N.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],o,l);const h=n(this,Zs).at(-1);if(n(this,Ei)>0)if(r.hasInnerBackdrop){const{width:c,height:u}=i.canvas,p=this.canvasFactory.create(c,u),b=p.context;b.drawImage(s.canvas,r.offsetX,r.offsetY,c,u,0,0,c,u),b.globalCompositeOperation="source-over",b.drawImage(i.canvas,0,0);const y=g(this,X,ow).call(this,i.canvas);b.globalCompositeOperation="destination-in",b.drawImage(y.canvas,0,0);const w=this.ctx.globalCompositeOperation,v=this.ctx.globalAlpha,A=this.ctx.filter;this.ctx.save(),this.ctx.setTransform(...o),this.ctx.globalAlpha=1,xt.isCanvasFilterSupported&&(this.ctx.filter="none"),this.ctx.globalCompositeOperation="destination-out",this.ctx.drawImage(y.canvas,0,0),this.ctx.globalCompositeOperation=w,this.ctx.globalAlpha=v,xt.isCanvasFilterSupported&&(this.ctx.filter=A??"none"),this.ctx.drawImage(p.canvas,0,0),this.ctx.restore(
45),this.canvasFactory.destroy(y),this.canvasFactory.destroy(p)}else{const c=(h==null?void 0:h.backdropCtx)??null;g(this,X,hw).call(this,this.ctx,i.canvas,{backdropCanvas:(c==null?void 0:c.canvas)??null,destTransform:o,backdropOffset:c?[h.offsetX+r.offsetX,h.offsetY+r.offsetY]:[0,0],sourceAlpha:this.ctx.globalAlpha,sourceFilter:this.ctx.filter})}else{if(r.replaceBackdrop){const c=new Path2D;c.rect(0,0,i.canvas.width,i.canvas.height),this.ctx.clip(c),this.ctx.globalCompositeOperation="copy"}this.ctx.drawImage(i.canvas,0,0)}this.ctx.restore(),this.canvasFactory.destroy({canvas:i.canvas,context:i}),g(this,X,nm).call(this,r),this.compose(l)}}beginAnnotation(t,e,i,s,r,a,o){if(g(this,X,rw).call(this),Rg(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const l=i[2]-i[0],h=i[3]-i[1];if(a&&this.annotationCanvasMap){s=s.slice(),s[4]-=i[0],s[5]-=i[1],N.singularValueDecompose2dScale(It(this.ctx),Fi);const{viewportScale:c}=this,u=Math.ceil(l*this.outputScaleX*c),p=Math.ceil(h*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,p);const{canvas:b,context:y}=this.annotationCanvas;if(o){const w=this.annotationCanvasMap.getOrInsertComputed(e,Zd);b.setAttribute("data-canvas-name",o);const v=w.findIndex(A=>A.getAttribute("data-canvas-name")===o);v===-1?w.push(b):w[v]=b}else this.annotationCanvasMap.set(e,b);this.annotationCanvas.savedCtx=this.ctx,this.ctx=y,this.ctx.save(),this.ctx.setTransform(Fi[0],0,0,-Fi[1],0,h*Fi[1]),Rg(this.ctx)}else{Rg(this.ctx),this.endPath(t);const c=new Path2D;c.rect(i[0],i[1],l,h),this.ctx.clip(c)}}this.current=new GA(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...s),this.transform(t,...r),this.baseTransform=It(this.ctx)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),g(this,X,aw).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){var l;if(!this.contentVisible)return;const i=e.count;e=this.getObject(t,e.data,e),e.count=i;const s=g(this,X,ni).call(this,this.current.fillAlpha),r=this.ctx,a=this._createMaskCanvas(t,e),o=a.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(o,a.offsetX,a.offsetY),(l=this.dependencyTracker)==null||l.resetBBox(t).recordBBox(t,this.ctx,a.offsetX,a.offsetX+o.width,a.offsetY,a.offsetY+o.height).recordOperation(t),r.restore(),a.canvasEntry&&this.canvasFactory.destroy(a.canvasEntry),this.compose(),g(this,X,Ne).call(this,s)}paintImageMaskXObjectRepeat(t,e,i,s=0,r=0,a,o){var p,b,y;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const l=g(this,X,ni).call(this,this.current.fillAlpha),h=this.ctx;h.save();const c=It(h);h.transform(i,s,r,a,0,0);const u=this._createMaskCanvas(t,e);h.setTransform(1,0,0,1,u.offsetX-c[4],u.offsetY-c[5]),(p=this.dependencyTracker)==null||p.resetBBox(t);for(let w=0,v=o.length;w<v;w+=2){const A=N.transform(c,[i,s,r,a,o[w],o[w+1]]);h.drawImage(u.canvas,A[4],A[5]),(b=this.dependencyTracker)==null||b.recordBBox(t,this.ctx,A[4],A[4]+u.canvas.width,A[5],A[5]+u.canvas.height)}h.restore(),u.canvasEntry&&this.canvasFactory.destroy(u.canvasEntry),this.compose(),(y=this.dependencyTracker)==null||y.recordOperation(t),g(this,X,Ne).call(this,l)}paintImageMaskXObjectGroup(t,e){var o,l,h;if(!this.contentVisible)return;const i=g(this,X,ni).call(this,this.current.fillAlpha),s=this.ctx,r=this.current.fillColor,a=this.current.patternFill;(o=this.dependencyTracker)==null||o.resetBBox(t).recordDependencies(t,Hi.transformAndFill);for(const c of e){const{data:u,width:p,height:b,transform:y}=c,w=this.canvasFactory.create(p,b),v=w.context;v.save();const A=this.getObject(t,u,c);YA(v,A),v.globalCompositeOperation="source-in",v.fillStyle=a?r.getPattern(v,this,Ls(s),Ie.FILL,t):r,v.fillRect(0,0,p,b),v.restore(),s.save(),s.transform(...y),s.scale(1,-1),Lg(s,w.canvas,0,0,p,b,0,-1,1,1),this.canvasFactory.destroy(w),(l=this.dependencyTracker)==null||l.recordBBox(t,s,0,p,0,b),s.restore()}this.compose(),(h=this.dependencyTracker)==null||h.recordOperation(t),g(this,X,Ne).call(this,i)}paintImageXObject(t,e){if(!this.contentVisible)return;const i=this.getObject(t,e);if(!i){J("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,i)}paintImageXObjectRepeat(t,e,i,s,r){if(!this.contentVisible)return;const a=this.getObject(t,e);if(!a){J("Dependent image isn't ready yet");return}const o=a.width,l=a.height,h=[];for(let c=0,u=r.length;c<u;c+=2)h.push({transform:[i,0,0,s,r[c],r[c+1]],x:0,y:0,w:o,h:l});this.paintInlineImageXObjectGroup(t,a,h)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return{img:t.bitmap,canvasEntry:null};const{bitmap:e,width:i,height:s}=t,r=this.canvasFactory.create(i,s),a=r.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",{img:r.canvas,canvasEntry:r}}paintInlineImageXObject(t,e){var u;if(!this.contentVisible)return;
45const i=e.width,s=e.height,r=g(this,X,ni).call(this,this.current.fillAlpha),a=this.ctx;this.save(t);const{filter:o}=a;o!=="none"&&o!==""&&(a.filter="none"),a.scale(1/i,-1/s);let l,h=null;if(e.bitmap){const p=this.applyTransferMapsToBitmap(e);l=p.img,h=p.canvasEntry}else{const p=this.canvasFactory.create(i,s);XA(p.context,e),l=this.applyTransferMapsToCanvas(p.context),h=p}const c=this._scaleImage(l,Ls(a));a.imageSmoothingEnabled=KA(It(a),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,a,0,i,-s,0).recordDependencies(t,Hi.imageXObject).recordOperation(t),(u=this.imagesTracker)==null||u.record(a,i,s,this.dependencyTracker.clipBox)),Lg(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-s,i,s),c.tmpCanvas&&this.canvasFactory.destroy(c.tmpCanvas),h&&this.canvasFactory.destroy(h),this.compose(),this.restore(t),g(this,X,Ne).call(this,r)}paintInlineImageXObjectGroup(t,e,i){var l,h,c;if(!this.contentVisible)return;const s=g(this,X,ni).call(this,this.current.fillAlpha),r=this.ctx;let a,o=null;if(e.bitmap)a=e.bitmap;else{const u=e.width,p=e.height,b=this.canvasFactory.create(u,p);XA(b.context,e),a=this.applyTransferMapsToCanvas(b.context),o=b}(l=this.dependencyTracker)==null||l.resetBBox(t);for(const u of i)r.save(),r.transform(...u.transform),r.scale(1,-1),Lg(r,a,u.x,u.y,u.w,u.h,0,-1,1,1),(h=this.dependencyTracker)==null||h.recordBBox(t,r,0,1,-1,0),r.restore();o&&this.canvasFactory.destroy(o),(c=this.dependencyTracker)==null||c.recordOperation(t),this.compose(),g(this,X,Ne).call(this,s)}paintSolidColorImageMask(t){var i;if(!this.contentVisible)return;const e=g(this,X,ni).call(this,this.current.fillAlpha);(i=this.dependencyTracker)==null||i.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Hi.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose(),g(this,X,Ne).call(this,e)}markPoint(t,e){}
45markPointProps(t,e,i){}beginMarkedContent(t,e){var i;(i=this.dependencyTracker)==null||i.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){var e;(e=this.dependencyTracker)==null||e.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){var a,o;const s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const r=this.ctx;this.pendingClip?(s||(this.pendingClip===qA?r.clip(e,"evenodd"):r.clip(e)),this.pendingClip=null,(a=this.dependencyTracker)==null||a.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):(o=this.dependencyTracker)==null||o.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=It(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:i,c:s,d:r}=this.ctx.getTransform();let a,o;if(i===0&&s===0){const l=Math.abs(e),h=Math.abs(r);if(l===h)if(t===0)a=o=1/l;else{const c=l*t;a=o=c<1?1/c:1}else if(t===0)a=1/l,o=1/h;else{const c=l*t,u=h*t;a=c<1?1/c:1,o=u<1?1/u:1}}else{const l=Math.abs(e*r-i*s),h=Math.hypot(e,i),c=Math.hypot(s,r);if(t===0)a=c/l,o=h/l;else{const u=t*l;a=c>u?c/u:1,o=h>u?h/u:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:i,current:{lineWidth:s}}=this,[r,a]=this.getScaleForStroking();if(r===a){i.lineWidth=(s||1)*r,i.stroke(t);return}const o=n(_o,fb)??f(_o,fb,new DOMMatrix),l=i.getLineDash();e&&i.save(),i.scale(r,a),o.a=1/r,o.d=1/a;const h=new Path2D;if(h.addPath(t,o),l.length>0){const c=Math.max(r,a);i.setLineDash(l.map(u=>u/c)),i.lineDashOffset/=c}i.lineWidth=s||1,i.stroke(h),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};fb=new WeakMap,Ei=new WeakMap,ga=new WeakMap,ll=new WeakMap,hl=new WeakMap,cl=new WeakMap,dl=new WeakMap,ul=new WeakMap,fl=new WeakMap,pl=new WeakMap,Zs=new WeakMap,X=new WeakSet,rw=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},aw=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},ow=function(t,e=null,i=1){const{width:s,height:r}=t,a=e??this.canvasFactory.create(s,r),o=a.context;i=Math.round(i*255)/255;const l=i<1;l&&n(this,fl)===void 0&&f(this,fl,xt.isCanvasFilterSupported?new Map:"none");let h="none";if(l&&n(this,fl)instanceof Map&&(h=n(this,fl).getOrInsertComputed(i,()=>this.filterFactory.addKnockoutFilter(i))),!l||h!=="none")return e&&(o.save(),o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,s,r),o.restore()),o.filter=h,o.drawImage(t,0,0),o.filter="none",a;const c=t.getContext("2d",{willReadFrequently:!0}).getImageData(0,0,s,r),u=o.createImageData(s,r),p=c.data,b=u.data,y=i>0?1/i:1e6;for(let w=3,v=p.length;w<v;w+=4)b[w]=Math.min(Math.round(p[w]*y),255);return o.putImageData(u,0,0),a}
45,lw=function(t,e,i,s){let r=(t==null?void 0:t[e])??null;if(r&&(r.canvas.width!==i||r.canvas.height!==s)&&(this.canvasFactory.destroy(r),r=null),!r)return r=this.canvasFactory.create(i,s),t&&(t[e]=r),r;const a=r.context;return a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,i,s),a.restore(),r},hw=function(t,e,i={}){const{backdropCanvas:s=null,destTransform:r=[1,0,0,1,0,0],backdropOffset:a=[0,0],reuseMaskEntry:o=null,poolMeta:l=null,sourceAlpha:h=1,sourceFilter:c="none",knockoutAlpha:u=1}=i,{width:p,height:b}=e,y=g(this,X,ow).call(this,e,o,u),w=t.globalCompositeOperation;if(t.save(),t.setTransform(...r),t.globalAlpha=1,xt.isCanvasFilterSupported&&(t.filter="none"),t.globalCompositeOperation="destination-out",t.drawImage(y.canvas,0,0),s){const[v,A]=a,E=g(this,X,lw).call(this,l,"knockoutBackdropEntry",p,b),S=E.context;S.drawImage(s,v,A,p,b,0,0,p,b),S.globalCompositeOperation="destination-in",S.drawImage(y.canvas,0,0),S.globalCompositeOperation="source-over",t.globalCompositeOperation="destination-over",t.drawImage(E.canvas,0,0),l||this.canvasFactory.destroy(E)}t.globalCompositeOperation=w,t.globalAlpha=h,xt.isCanvasFilterSupported&&(t.filter=c??"none"),t.drawImage(e,0,0),t.restore(),o||this.canvasFactory.destroy(y)},ni=function(t=1){if(n(this,Ei)===0||n(this,ga)>0||!this.contentVisible)return!1;kt(this,ga)._++,f(this,ul,t);const e=n(this,Zs).at(-1),{canvas:i}=this.ctx,s=g(this,X,lw).call(this,e,"knockoutTempEntry",i.width,i.height);f(this,ll,s);const r=s.context;return r.save(),r.setTransform(this.ctx.getTransform()),po(this.ctx,r),f(this,dl,r.globalCompositeOperation),r.globalCompositeOperation="source-over",WA(r,this.ctx),f(this,pl,e),f(this,hl,this.ctx),f(this,cl,this.suspendedCtx),this.ctx=r,this.inSMaskMode&&(this.suspendedCtx=r),!0},Ne=function(t){var l;if(!t)return;const e=n(this,ll),i=n(this,hl),s=n(this,cl),r=e.context;f(this,ll,null),f(this,hl,null),f(this,cl,null),this.inSMaskMode&&this.suspendedCtx===r&&this.ctx!==r&&this.endSMaskMode(),this.inSMaskMode&&(this.suspendedCtx=s),this.ctx._removeMirroring(),this.ctx.globalCompositeOperation=n(this,dl),f(this,dl,null),po(this.ctx,i),this.ctx=i;const a=n(this,pl);f(this,pl,null);const o=n(this,ul);f(this,ul,1);try{g(this,X,hw).call(this,s??i,e.canvas,{backdropCanvas:((l=a==null?void 0:a.backdropCtx)==null?void 0:l.canvas)??null,backdropOffset:a!=null&&a.backdropCtx?[a.offsetX,a.offsetY]:[0,0],reuseMaskEntry:(a==null?void 0:a.knockoutMaskEntry)??null,poolMeta:a,knockoutAlpha:o})}finally{r.restore(),kt(this,ga)._--,a||this.canvasFactory.destroy(e)}},cw=function(t,e,i){const s=new Path2D;return s.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),s},V0=function(t){const{canvas:e}=t,{width:i,height:s}=e;if(xt.isCanvasFilterSupported){t.save(),t.setTransform(1,0,0,1,0,0),t.filter="grayscale(1)",t.globalAlpha=1,t.globalCompositeOperation="copy",t.drawImage(e,0,0),t.restore();return}const r=t.getImageData(0,0,i,s),{data:a}=r;for(let o=0,l=a.length;o<l;o+=4){const h=a[o]*.2126+a[o+1]*.7152+a[o+2]*.0722+.5|0;a[o]=a[o+1]=a[o+2]=h}t.putImageData(r,0,0)},nm=function(t){t&&(t.knockoutMaskEntry&&(this.canvasFactory.destroy(t.knockoutMaskEntry),t.knockoutMaskEntry=null),t.knockoutTempEntry&&(this.canvasFactory.destroy(t.knockoutTempEntry),t.knockoutTempEntry=null),t.knockoutBackdropEntry&&(this.canvasFactory.destroy(t.knockoutBackdropEntry),t.knockoutBackdropEntry=null))},m(_o,fb,null);let jh=_o;for(const d in Bs)jh.prototype[d]!==void 0&&(jh.prototype[Bs[d]]=jh.prototype[d]);var Pf,Tf;class Ub{constructor(t,e,i){m(this,Pf,null);m(this,Tf,null);T(this,"_fullReader",null);T(this,"_rangeReaders",new Set);T(this,"_source",null);this._source=t,f(this,Pf,e),f(this,Tf,i)}get _progressiveDataLength(){var t;return((t=this._fullReader)==null?void 0:t._loaded)??0}getFullReader(){return Xt(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(n(this,Pf))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new(n(this,Tf))(this,t,e);return this._rangeReaders.add(i),i}cancelAllRequests(t){var e;(e=this._fullReader)==null||e.cancel(t);for(const i of new Set(this._rangeReaders))i.cancel(t)}}Pf=new WeakMap,Tf=new WeakMap;class $b{constructor(t){T(this,"onProgress",null);T(this,"_contentLength",0);T(this,"_filename",null);T(this,"_headersCapability",Promise.withResolvers());T(this,"_isRangeSupported",!1);T(this,"_isStreamingSupported",!1);T(this,"_loaded",0);T(this,"_stream",null);this._stream=t}_callOnProgress(){var t;(t=this.onProgress)==null||t.call(this,{loaded:this._loaded,total:this._contentLength})}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(){lt("Abstract method `read` called")}cancel(t){lt("Abstract method `cancel` called")}}class Vb{constructor(t,e,i){T(this,"_stream",null);this._stream=t}async read(){lt("Abstract method `read` called")}cancel(t){lt("Abstract method `cancel` called")}}function zC(d){let t=!0,e=i("filename\\*","i").exec(d);if(e){e=e[1];let c=o(e);return c=unescape(c),c=l(c),c=h(c),r(c)}if(e=a(d),e){const c=h(e);return r(c)}
45if(e=i("filename","i").exec(d),e){e=e[1];let c=o(e);return c=h(c),r(c)}function i(c,u){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function s(c,u){if(c){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const p=new TextDecoder(c,{fatal:!0}),b=Ob(u);u=p.decode(b),t=!1}catch{}}return u}function r(c){return t&&/[\x80-\xff]/.test(c)&&(c=s("utf-8",c),t&&(c=s("iso-8859-1",c))),c}function a(c){const u=[];let p;const b=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(p=b.exec(c))!==null;){let[,w,v,A]=p;if(w=parseInt(w,10),w in u){if(w===0)break;continue}u[w]=[v,A]}const y=[];for(let w=0;w<u.length&&w in u;++w){let[v,A]=u[w];A=o(A),v&&(A=unescape(A),w===0&&(A=l(A))),y.push(A)}return y.join("")}function o(c){if(c.startsWith('"')){const u=c.slice(1).split('\\"');for(let p=0;p<u.length;++p){const b=u[p].indexOf('"');b!==-1&&(u[p]=u[p].slice(0,b),u.length=p+1),u[p]=u[p].replaceAll(/\\(.)/g,"$1")}c=u.join('"')}return c}function l(c){const u=c.indexOf("'");if(u===-1)return c;const p=c.slice(0,u),y=c.slice(u+1).replace(/^[^']*'/,"");return s(p,y)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QB])\?((?:[^?]|\?(?!=))*)\?=/gi,function(u,p,b,y){if(b==="q"||b==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-f]{2})/gi,function(w,v){return String.fromCharCode(parseInt(v,16))}),s(p,y);try{y=atob(y)}catch{}return s(p,y)})}return""}function H0(d,t){const e=new Headers;if(!d||!t||typeof t!="object")return e;for(const i in t){const s=t[i];s!==void 0&&e.append(i,s)}return e}function WC(d){let t=d.length;for(;t>0&&d[t-1]!==" "&&/\s/.test(d[t-1]);)t--;return d.slice(0,t)}function Hb(d){var t;return((t=URL.parse(d))==null?void 0:t.origin)??null}function z0({responseHeaders:d,isHttp:t,rangeChunkSize:e,disableRange:i}){const s={contentLength:0,isRangeSupported:!1},r=parseInt(d.get("Content-Length"),10);return!Number.isInteger(r)||(s.contentLength=r,r<=2*e)||i||!t||d.get("Accept-Ranges")!=="bytes"||(d.get("Content-Encoding")||"identity")==="identity"&&(s.isRangeSupported=!0),s}function W0(d){const t=d.get("Content-Disposition");if(t){let e=zC(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(aA(e))return e}return null}function zb(d,t){return new zm(`Unexpected server response (${d}) while retrieving PDF "${t.href}".`,d,d===404||d===0&&t.protocol==="file:")}function G0(d,t){if(d!==t)throw new Error(`Expected range response-origin "${d}" to match "${t}".`)}function X0(d,t,e,i){return fetch(d,{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function Y0(d,t){if(d!==200&&d!==206)throw zb(d,t)}function Wb(d){if(d instanceof Uint8Array)return d.buffer;if(d instanceof ArrayBuffer)return d;throw new Error(`getArrayBuffer - unexpected data: ${d}`)}class GC extends Ub{constructor(e){super(e,XC,YC);T(this,"_responseOrigin",null);const{httpHeaders:i,url:s}=e;Xt(/https?:/.test(s.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=H0(!0,i)}}class XC extends $b{constructor(e){super(e);T(this,"_abortController",new AbortController);T(this,"_reader",null);const{disableRange:i,disableStream:s,rangeChunkSize:r,url:a,withCredentials:o}=e._source;this._isStreamingSupported=!s;const l=new Headers(e.headers);X0(a,l,o,this._abortController).then(h=>{e._responseOrigin=Hb(h.url),Y0(h.status,a),this._reader=h.body.getReader();const c=h.headers,{contentLength:u,isRangeSupported:p}=z0({responseHeaders:c,isHttp:!0,rangeChunkSize:r,disableRange:i});this._contentLength=u,this._isRangeSupported=p,this._filename=W0(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new co("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:Wb(e),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}class YC extends Vb{constructor(e,i,s){super(e,i,s);T(this,"_abortController",new AbortController);T(this,"_readCapability",Promise.withResolvers());T(this,"_reader",null);const{url:r,withCredentials:a}=e._source,o=new Headers(e.headers);o.append("Range",`bytes=${i}-${s-1}`),X0(r,o,a,this._abortController).then(l=>{const h=Hb(l.url);G0(h,e._responseOrigin),Y0(l.status,r),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:{value:Wb(e),done:!1}}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}function QA(d){return d instanceof Uint8Array&&d.byteLength===d.buffer.byteLength?d.buffer:new Uint8Array(d).buffer}function Gb(){for(const d of this._requests)d.resolve({value:void 0,done:!0});this._requests.length=0}var pb,K0;class KC extends Ub{constructor(e){super(e,qC,QC);m(this,pb);T(this,"_progressiveDone",!1);T(this,"_queuedChunks",[]);const{pdfDataRangeTransport:i}=e,{initialData:s,progressiveDone:r}=i;if((s==null?void 0:s.length)>0){const o=QA(s);this._queuedChunks.push(o)}this._progressiveDone=r;const a=o=>{var l;switch(o.type){case"range":case"progressiveRead":g(this,pb,K0).call(this,o.begin,o.chunk);break;case"progressiveDone":(l=this._fullReader)==null||l.progressiveDone(),this._progressiveDone=!0;break}};i.transportReady(a)}getFullReader(){const e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,i){const s=super.getRangeReader(e,i);return s&&(s.onDone=()=>this._rangeReaders.delete(s),this._source.pdfDataRangeTransport.requestDataRange(e,i)),s}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}}pb=new WeakSet,K0=function(e,i){const s=QA(i);if(e===void 0)this._fullReader?this._fullReader._enqueue(s):this._queuedChunks.push(s);else{const r=this._rangeReaders.keys().find(a=>a._begin===e);Xt(r,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),r._enqueue(s)}};var kf;class qC extends $b{constructor(e){super(e);m(this,kf,Gb.bind(this));T(this,"_done",!1);T(this,"_queuedChunks",null);T(this,"_requests",[]);const{pdfDataRangeTransport:i,disableRange:s,disableStream:r}=e._source,{length:a,contentDispositionFilename:o}=i;this._queuedChunks=e._queuedChunks||[];for(const h of this._queuedChunks)this._loaded+=h.byteLength;this._done=e._progressiveDone,this._contentLength=a,this._isStreamingSupported=!r,this._isRangeSupported=!s,aA(o)&&(this._filename=o),this._headersCapability.resolve();const l=this._loaded;Promise.resolve().then(()=>{l>0&&this._loaded===l&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,n(this,kf).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&n(this,kf).call(this)}}kf=new WeakMap;var Mf;class QC extends Vb{constructor(e,i,s){super(e,i,s);m(this,Mf,Gb.bind(this));T(this,"onDone",null);T(this,"_begin",-1);T(this,"_done",!1);T(this,"_queuedChunk",null);T(this,"_requests",[]);this._begin=i}_enqueue(e){var i;this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),n(this,Mf).call(this)),this._done=!0,(i=this.onDone)==null||i.call(this))}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 e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){var i;this._done=!0,n(this,Mf).call(this),(i=this.onDone)==null||i.call(this)}}Mf=new WeakMap;const ay=200,ZA=206;function ZC(d){return typeof d!="string"?d:Ob(d).buffer}var Js,Kd,q0,Q0;class JC extends Ub{constructor(e){super(e,tP,eP);m(this,Kd);m(this,Js,new WeakMap);T(this,"_responseOrigin",null);const{httpHeaders:i,url:s}=e;this.url=s,this.isHttp=/https?:/.test(s.protocol),this.headers=H0(this.isHttp,i)}_request(e){const i=new XMLHttpRequest,s={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};n(this,Js).set(i,s),i.open("GET",this.url),i.withCredentials=this._source.withCredentials;for(const[r,a]of this.headers)i.setRequestHeader(r,a);return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),s.validateStatus=r=>r===ZA||r===ay):s.validateStatus=r=>r===ay,i.responseType="arraybuffer",Xt(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>e.onError(i.status),i.onreadystatechange=g(this,Kd,Q0).bind(this,i),i.onprogress=g(this,Kd,q0).bind(this,i),i.send(null),i}
45_abortRequest(e){n(this,Js).has(e)&&(n(this,Js).delete(e),e.abort())}getRangeReader(e,i){const s=super.getRangeReader(e,i);return s&&(s.onClosed=()=>this._rangeReaders.delete(s)),s}}Js=new WeakMap,Kd=new WeakSet,q0=function(e,i){var r;const s=n(this,Js).get(e);(r=s==null?void 0:s.onProgress)==null||r.call(s,i)},Q0=function(e,i){const s=n(this,Js).get(e);if(!s||(e.readyState>=2&&s.onHeadersReceived&&(s.onHeadersReceived(),delete s.onHeadersReceived),e.readyState!==4)||!n(this,Js).has(e))return;if(n(this,Js).delete(e),e.status===0&&this.isHttp){s.onError(e.status);return}const r=e.status||ay;if(!s.validateStatus(r)){s.onError(e.status);return}const a=ZC(e.response);if(r===ZA){const o=e.getResponseHeader("Content-Range");/bytes \d+-\d+\/\d+/.test(o)?s.onDone(a):(J('Missing or invalid "Content-Range" header.'),s.onError(0))}else a?s.onDone(a):s.onError(e.status)};var If,An,Z0,J0,tS,eS;class tP extends $b{constructor(e){super(e);m(this,An);m(this,If,Gb.bind(this));T(this,"_cachedChunks",[]);T(this,"_done",!1);T(this,"_requests",[]);T(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:g(this,An,Z0).bind(this),onDone:g(this,An,J0).bind(this),onError:g(this,An,tS).bind(this),onProgress:g(this,An,eS).bind(this)})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),n(this,If).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}If=new WeakMap,An=new WeakSet,Z0=function(){const e=this._stream,{disableRange:i,rangeChunkSize:s}=e._source,r=this._fullRequestXhr;e._responseOrigin=Hb(r.responseURL);const a=r.getAllResponseHeaders(),o=new Headers(a?WC(a.trimStart()).split(/[\r\n]+/).map(c=>{const[u,...p]=c.split(": ");return[u,p.join(": ")]}):[]),{contentLength:l,isRangeSupported:h}=z0({responseHeaders:o,isHttp:e.isHttp,rangeChunkSize:s,disableRange:i});this._contentLength=l,this._isRangeSupported=h,this._filename=W0(o),this._isRangeSupported&&e._abortRequest(r),this._headersCapability.resolve()},J0=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&n(this,If).call(this)},tS=function(e){this._storedError=zb(e,this._stream.url),this._headersCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},eS=function(e){var i;(i=this.onProgress)==null||i.call(this,{loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};var Df,Mr,iS,sS,dw;class eP extends Vb{constructor(e,i,s){super(e,i,s);m(this,Mr);m(this,Df,Gb.bind(this));T(this,"onClosed",null);T(this,"_done",!1);T(this,"_queuedChunk",null);T(this,"_requests",[]);T(this,"_storedError",null);this._requestXhr=e._request({begin:i,end:s,onHeadersReceived:g(this,Mr,iS).bind(this),onDone:g(this,Mr,sS).bind(this),onError:g(this,Mr,dw).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){var i;this._done=!0,n(this,Df).call(this),this._stream._abortRequest(this._requestXhr),(i=this.onClosed)==null||i.call(this)}}Df=new WeakMap,Mr=new WeakSet,iS=function(){var i;const e=Hb((i=this._requestXhr)==null?void 0:i.responseURL);try{G0(e,this._stream._responseOrigin)}catch(s){this._storedError=s,g(this,Mr,dw).call(this,0)}},sS=function(e){var i;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,n(this,Df).call(this),(i=this.onClosed)==null||i.call(this)},dw=function(e){this._storedError??(this._storedError=zb(e,this._stream.url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};function nS(d,t=null){const e=process.getBuiltinModule("fs"),{Readable:i}=process.getBuiltinModule("stream"),s=e.createReadStream(d,t);return i.toWeb(s)}class iP extends Ub{constructor(t){super(t,sP,nP);const{url:e}=t;Xt(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class sP extends $b{constructor(e){super(e);T(this,"_reader",null);const{disableRange:i,disableStream:s,rangeChunkSize:r,url:a}=e._source;this._isStreamingSupported=!s,process.getBuiltinModule("fs/promises").lstat(a).then(l=>{const h=nS(a);this._reader=h.getReader();const{size:c}=l;this._contentLength=c,this._isRangeSupported=!i&&c>2*r,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new co("Streaming is disabled.")),this._headersCapability.resolve()}).catch(l=>{l.code==="ENOENT"&&(l=zb(0,a)),this._headersCapability.reject(l)})}async read(){await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:Wb(e),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e)}}class nP extends Vb{constructor(e,i,s){super(e,i,s);T(this,"_readCapability",Promise.withResolvers());T(this,"_reader",null);const{url:r}=e._source;try{const a=nS(r,{start:i,end:s-1});this._reader=a.getReader(),this._readCapability.resolve()}catch(a){this._readCapability.reject(a)}}async read(){await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:{value:Wb(e),done:!1}}cancel(e){var i;(i=this._reader)==null||i.cancel(e)}}function rP(d){return Lu(d)?GC:Ni?iP:JC}var Hg,Lf,Rf;let Br=(Hg=class{static get workerPort(){return n(this,Lf)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");f(this,Lf,t)}static get workerSrc(){return n(this,Rf)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");f(this,Rf,t)}},Lf=new WeakMap,Rf=new WeakMap,m(Hg,Lf,null),m(Hg,Rf,""),Hg);var Ac,Nf;class aP{constructor({parsedData:t,rawData:e}){m(this,Ac);m(this,Nf);f(this,Ac,t),f(this,Nf,e)}getRaw(){return n(this,Nf)}get(t){return n(this,Ac).get(t)??null}
45[Symbol.iterator](){return n(this,Ac).entries()}}Ac=new WeakMap,Nf=new WeakMap;const yo=Symbol("INTERNAL");var Ff,Of,Ec,gl;class oP{constructor(t,{name:e,intent:i,usage:s,rbGroups:r}){m(this,Ff,!1);m(this,Of,!1);m(this,Ec,!1);m(this,gl,!0);f(this,Ff,!!(t&Ri.DISPLAY)),f(this,Of,!!(t&Ri.PRINT)),this.name=e,this.intent=i,this.usage=s,this.rbGroups=r}get visible(){if(n(this,Ec))return n(this,gl);if(!n(this,gl))return!1;const{print:t,view:e}=this.usage;return n(this,Ff)?(e==null?void 0:e.viewState)!=="OFF":n(this,Of)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,i=!1){t!==yo&<("Internal method `_setVisible` called."),f(this,Ec,i),f(this,gl,e)}get serializable(){return{userSet:n(this,Ec),visible:n(this,gl)}}}Ff=new WeakMap,Of=new WeakMap,Ec=new WeakMap,gl=new WeakMap;var ma,dt,Sc,xc,Bf,jf,fw;const vA=class vA{constructor(t,e=Ri.DISPLAY,i=null){m(this,jf);m(this,ma,null);m(this,dt,new Map);m(this,Sc,null);m(this,xc,null);m(this,Bf);T(this,"creator",null);T(this,"name",null);if(f(this,Bf,t),this.renderingIntent=e,t!==null){this.name=t.name,this.creator=t.creator,f(this,xc,t.order);for(const s of t.groups)n(this,dt).set(s.id,new oP(e,s));if(i){i.size!==n(this,dt).size&<("Incorrect serialized groupState.");for(const[s,r]of i)n(this,dt).get(s)._setVisible(yo,r.visible,r.userSet)}else{if(t.baseState==="OFF")for(const s of n(this,dt).values())s._setVisible(yo,!1);for(const s of t.on)n(this,dt).get(s)._setVisible(yo,!0);for(const s of t.off)n(this,dt).get(s)._setVisible(yo,!1)}f(this,Sc,this.getHash())}}isVisible(t){if(n(this,dt).size===0)return!0;if(!t)return Fb("Optional content group not defined."),!0;if(t.type==="OCG")return n(this,dt).has(t.id)?n(this,dt).get(t.id).visible:(J(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return g(this,jf,fw).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!n(this,dt).has(e))return J(`Optional content group not found: ${e}`),!0;if(n(this,dt).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!n(this,dt).has(e))return J(`Optional content group not found: ${e}`),!0;if(!n(this,dt).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!n(this,dt).has(e))return J(`Optional content group not found: ${e}`),!0;if(!n(this,dt).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!n(this,dt).has(e))return J(`Optional content group not found: ${e}`),!0;if(n(this,dt).get(e).visible)return!1}return!0}return J(`Unknown optional content policy ${t.policy}.`),!0}return J(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){var r;const s=n(this,dt).get(t);if(!s){J(`Optional content group not found: ${t}`);return}if(i&&e&&s.rbGroups.length)for(const a of s.rbGroups)for(const o of a)o!==t&&((r=n(this,dt).get(o))==null||r._setVisible(yo,!1,!0));s._setVisible(yo,!!e,!0),f(this,ma,null)}setOCGState({state:t,preserveRB:e}){let i;for(const s of t){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}const r=n(this,dt).get(s);if(r)switch(i){case"ON":this.setVisibility(s,!0,e);break;case"OFF":this.setVisibility(s,!1,e);break;case"Toggle":this.setVisibility(s,!r.visible,e);break}}f(this,ma,null)}get hasInitialVisibility(){return n(this,Sc)===null||this.getHash()===n(this,Sc)}getOrder(){return n(this,dt).size?n(this,xc)?n(this,xc).slice():[...n(this,dt).keys()]:null}getGroup(t){return n(this,dt).get(t)||null}getHash(){if(n(this,ma)!==null)return n(this,ma);const t=new qy;for(const[e,i]of n(this,dt))t.update(`${e}:${i.visible}`);return f(this,ma,t.hexdigest())}[Symbol.iterator](){return n(this,dt).entries()}get serializable(){const t=new Map;for(const[e,i]of n(this,dt))t.set(e,i.serializable);return{data:n(this,Bf),renderingIntent:this.renderingIntent,groupState:t}}static fromSerializable({data:t,renderingIntent:e,groupState:i}){return new vA(t,e,i)}};ma=new WeakMap,dt=new WeakMap,Sc=new WeakMap,xc=new WeakMap,Bf=new WeakMap,jf=new WeakSet,fw=function(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const r=t[s];let a;
45if(Array.isArray(r))a=g(this,jf,fw).call(this,r);else if(n(this,dt).has(r))a=n(this,dt).get(r).visible;else return J(`Optional content group not found: ${r}`),!0;switch(i){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return i==="And"};let uw=vA;var Wt,Ji,ce,ml,tn,Re,wu,rm,pw,gw;class lP{constructor(){m(this,Re);m(this,Wt,null);m(this,Ji,null);m(this,ce,0);m(this,ml,null);m(this,tn,null)}get pagesNumber(){return n(this,ce)}set pagesNumber(t){n(this,ce)!==t&&(f(this,ce,t),f(this,Wt,null),f(this,Ji,null))}movePages(t,e,i){g(this,Re,wu).call(this);const s=n(this,Wt),r=e.length,a=new Uint32Array(r);let o=0;for(let p=0;p<r;p++){const b=e[p]-1;a[p]=s[b],b<i&&o++}const l=n(this,ce),h=l-r,c=new Int32Array(l),u=Nt(i-o,0,h);for(let p=0,b=0;p<l;p++)t.has(p+1)||(s[b]=s[p],c[b++]=p+1);s.copyWithin(u+r,u,h),s.set(a,u),c.copyWithin(u+r,u,h),c.set(e,u),f(this,Ji,c),s.every((p,b)=>p===b+1)&&f(this,Wt,null)}deletePages(t){g(this,Re,wu).call(this);const e=n(this,Wt),i=g(this,Re,rm).call(this);f(this,tn,{pageNumberToId:e.slice(),pagesNumber:n(this,ce),prevPageNumbers:n(this,Ji).slice()});const s=n(this,ce)-t.length;f(this,ce,s);const r=f(this,Wt,new Uint32Array(s));f(this,Ji,new Int32Array(s));let a=0,o=0;for(const l of t){const h=l-1;h!==a&&(r.set(e.subarray(a,h),o),o+=h-a),a=h+1}a<e.length&&r.set(e.subarray(a),o),g(this,Re,pw).call(this,i,new Set(t))}cancelDelete(){n(this,tn)&&(f(this,Wt,n(this,tn).pageNumberToId),f(this,ce,n(this,tn).pagesNumber),f(this,Ji,n(this,tn).prevPageNumbers),f(this,tn,null))}cleanSavedData(){f(this,tn,null)}copyPages(t){g(this,Re,wu).call(this),f(this,ml,{pageNumbers:t,pageIds:t.map(e=>n(this,Wt)[e-1])})}cancelCopy(){f(this,ml,null)}pastePages(t){g(this,Re,wu).call(this);const e=n(this,Wt),i=g(this,Re,rm).call(this),{pageNumbers:s,pageIds:r}=n(this,ml),a=n(this,ce)+s.length;f(this,ce,a);const o=f(this,Wt,new Uint32Array(a));f(this,Ji,new Int32Array(a)),o.set(e.subarray(0,t),0),o.set(r,t),o.set(e.subarray(t),t+s.length),g(this,Re,pw).call(this,i,null,t,s),f(this,ml,null)}hasBeenAltered(){return n(this,Wt)!==null}getPageMappingForSaving(t=null,e=g(this,Re,gw).call(this)){t??(t=g(this,Re,rm).call(this));let i=0;for(const r of t.values())i=Math.max(i,r.length);const s=new Array(i);for(let r=0;r<i;r++)s[r]={document:null,pageIndices:[],includePages:[]};for(const[r,a]of t)for(let o=0,l=a.length;o<l;o++)s[o].includePages.push([r-1,a[o]-1]);for(const{includePages:r,pageIndices:a}of s){r.sort((o,l)=>o[0]-l[0]);for(let o=0,l=r.length;o<l;o++)a.push(r[o][1]),r[o]=r[o][0]}return{pageInfos:s,copyLevels:e}}extractPages(t){t=Array.from(t).sort((i,s)=>i-s);const e=new Map;for(let i=0,s=t.length;i<s;i++){const r=this.getPageId(t[i]);e.getOrInsertComputed(r,Zd).push(i+1)}return this.getPageMappingForSaving(e,g(this,Re,gw).call(this,t))}getPrevPageNumber(t){var e;return((e=n(this,Ji))==null?void 0:e[t-1])??0}getPageNumber(t){if(!n(this,Wt))return t;const e=n(this,Wt);for(let i=0,s=n(this,ce);i<s;i++)if(e[i]===t)return i+1;return 0}getPageId(t){var e;return((e=n(this,Wt))==null?void 0:e[t-1])??t}getMapping(){var t;return(t=n(this,Wt))==null?void 0:t.subarray(0,this.pagesNumber)}}Wt=new WeakMap,Ji=new WeakMap,ce=new WeakMap,ml=new WeakMap,tn=new WeakMap,Re=new WeakSet,wu=function(){if(n(this,Wt))return;const t=n(this,ce),e=f(this,Wt,new Uint32Array(t));for(let i=0;i<t;i++)e[i]=i+1;f(this,Ji,new Int32Array(e))},rm=function(){const t=new Map,e=n(this,Wt);for(let i=0,s=n(this,ce);i<s;i++){const r=e[i],a=t.get(r);a?a.push(i+1):t.set(r,[i+1])}return t},pw=function(t,e=null,i=-1,s=null){const r=n(this,Ji),a=n(this,Wt),o=i+((s==null?void 0:s.length)??0),l=new Map;for(let h=0,c=n(this,ce);h<c;h++){if(h>=i&&h<o){r[h]=-s[h-i];continue}const u=a[h],p=t.get(u);let b=l.get(u)||0;if(e&&p)for(;b<p.length&&e.has(p[b]);)b++;r[h]=p==null?void 0:p[b],l.set(u,b+1)}},gw=function(t=null){if(!n(this,Wt))return null;const e=new Int32Array(n(this,ce)).fill(-1),i=new Map;if(t)for(const s of t){const r=this.getPageId(s),a=i.get(r)??0;i.set(r,a+1),e[s-1]=a}else for(let s=0,r=n(this,ce);s<r;s++){const a=n(this,Wt)[s],o=i.get(a)??0;i.set(a,o+1),e[s]=o}return e};const Mh=Symbol("INITIAL_DATA"),JA=()=>({...Promise.withResolvers(),data:Mh});var ts;class rS{constructor(){m(this,ts,new Map)}get(t,e=null){if(e){const s=n(this,ts).getOrInsertComputed(t,JA);return s.promise.then(()=>e(s.data)),null}const i=n(this,ts).get(t);if(!i||i.data===Mh)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=n(this,ts).get(t);return!!e&&e.data!==Mh}delete(t){const e=n(this,ts).get(t);return!e||e.data===Mh?!1:(n(this,ts).delete(t),!0)}resolve(t,e=null){const i=n(this,ts).getOrInsertComputed(t,JA);if(i.data!==Mh)throw new Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){var t;for(const{data:e}
45of n(this,ts).values())(t=e==null?void 0:e.bitmap)==null||t.close();n(this,ts).clear()}*[Symbol.iterator](){for(const[t,{data:e}]of n(this,ts))e!==Mh&&(yield[t,e])}}ts=new WeakMap;const hP=1e5,tE=30;var jE,ba,Ye,Uf,$f,_c,bl,zn,Vf,Hf,yl,zf,Cc,ya,Pc,Wf,Tc,wl,Gf,Xf,ae,kc,vl,Yf,Mc,Ic,Ir,aS,oS,mw,Bi,am,bw,lS,hS;let Xm=(ae=class{constructor({textContentSource:t,images:e,container:i,viewport:s}){m(this,Ir);m(this,ba,Promise.withResolvers());m(this,Ye,null);m(this,Uf,!1);m(this,$f,!!((jE=globalThis.FontInspector)!=null&&jE.enabled));m(this,_c,null);m(this,bl,null);m(this,zn,null);m(this,Vf,0);m(this,Hf,0);m(this,yl,null);m(this,zf,null);m(this,Cc,0);m(this,ya,0);m(this,Pc,Object.create(null));m(this,Wf,[]);m(this,Tc,null);m(this,wl,[]);m(this,Gf,new WeakMap);m(this,Xf,null);var h;if(t instanceof ReadableStream)f(this,Tc,t);else if(typeof t=="object")f(this,Tc,new ReadableStream({start(c){c.enqueue(t),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');f(this,Ye,f(this,zf,i)),f(this,_c,e),f(this,ya,s.scale*uo.pixelRatio),f(this,Cc,s.rotation),f(this,zn,{div:null,properties:null,ctx:null});const{pageWidth:r,pageHeight:a,pageX:o,pageY:l}=s.rawDims;f(this,Xf,[1,0,0,-1,-o,l+a]),f(this,Hf,r),f(this,Vf,a),g(h=ae,Bi,lS).call(h),i.style.setProperty("--min-font-size",n(ae,Mc)),yh(i,s),n(this,ba).promise.finally(()=>{n(ae,Ic).delete(this),f(this,zn,null),f(this,Pc,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=xt.platform;return Y(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){n(this,_c)&&n(this,Ye).append(n(this,_c).render());const t=()=>{n(this,yl).read().then(({value:e,done:i})=>{if(i){n(this,ba).resolve();return}n(this,bl)??f(this,bl,e.lang),Object.assign(n(this,Pc),e.styles),g(this,Ir,aS).call(this,e.items),t()},n(this,ba).reject)};return f(this,yl,n(this,Tc).getReader()),n(ae,Ic).add(this),t(),n(this,ba).promise}update({viewport:t,onBefore:e=null}){var r;const i=t.scale*uo.pixelRatio,s=t.rotation;if(s!==n(this,Cc)&&(e==null||e(),f(this,Cc,s),yh(n(this,zf),{rotation:s})),i!==n(this,ya)){e==null||e(),f(this,ya,i);const a={div:null,properties:null,ctx:g(r=ae,Bi,am).call(r,n(this,bl))};for(const o of n(this,wl))a.properties=n(this,Gf).get(o),a.div=o,g(this,Ir,mw).call(this,a)}}cancel(){var e;const t=new co("TextLayer task cancelled.");(e=n(this,yl))==null||e.cancel(t).catch(()=>{}),f(this,yl,null),n(this,ba).reject(t)}get textDivs(){return n(this,wl)}get textContentItemsStr(){return n(this,Wf)}static cleanup(){if(!(n(this,Ic).size>0)){n(this,kc).clear();for(const{canvas:t}of n(this,vl).values())t.remove();n(this,vl).clear()}}},ba=new WeakMap,Ye=new WeakMap,Uf=new WeakMap,$f=new WeakMap,_c=new WeakMap,bl=new WeakMap,zn=new WeakMap,Vf=new WeakMap,Hf=new WeakMap,yl=new WeakMap,zf=new WeakMap,Cc=new WeakMap,ya=new WeakMap,Pc=new WeakMap,Wf=new WeakMap,Tc=new WeakMap,wl=new WeakMap,Gf=new WeakMap,Xf=new WeakMap,kc=new WeakMap,vl=new WeakMap,Yf=new WeakMap,Mc=new WeakMap,Ic=new WeakMap,Ir=new WeakSet,aS=function(t){var s,r;if(n(this,Uf))return;(r=n(this,zn)).ctx??(r.ctx=g(s=ae,Bi,am).call(s,n(this,bl)));const e=n(this,wl),i=n(this,Wf);for(const a of t){if(e.length>hP){J("Ignoring additional textDivs for performance reasons."),f(this,Uf,!0);return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const o=n(this,Ye);f(this,Ye,document.createElement("span")),n(this,Ye).classList.add("markedContent"),a.id&&n(this,Ye).setAttribute("id",a.id),a.tag==="Artifact"&&(n(this,Ye).ariaHidden=!0),o.append(n(this,Ye))}else a.type==="endMarkedContent"&&f(this,Ye,n(this,Ye).parentNode);continue}i.push(a.str),g(this,Ir,oS).call(this,a)}},oS=function(t){var y;const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};n(this,wl).push(e);const s=N.transform(n(this,Xf),t.transform);let r=Math.atan2(s[1],s[0]);const a=n(this,Pc)[t.fontName];a.vertical&&(r+=Math.PI/2);let o=n(this,$f)&&a.fontSubstitution||a.fontFamily;o=ae.fontFamilyMap.get(o)||o;const l=Math.hypot(s[2],s[3]),h=l*g(y=ae,Bi,hS).call(y,o,a,n(this,bl));let c,u;r===0?(c=s[4],u=s[5]-h):(c=s[4]+h*Math.sin(r),u=s[5]-h*Math.cos(r));const p=e.style;p.left=`${(100*c/n(this,Hf)).toFixed(2)}%`,p.top=`${(100*u/n(this,Vf)).toFixed(2)}%`,p.setProperty("--font-height",`${l.toFixed(2)}px`),p.fontFamily=o,i.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,n(this,$f)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||t.fontName),r!==0&&(i.angle=r*(180/Math.PI));let b=!1;if(t.str.length>1)b=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),v=Math.abs(t.transform[3]);w!==v&&Math.max(w,v)/Math.min(w,v)>1.5&&(b=!0)}if(b&&(i.canvasWidth=a.vertical?t.height:t.width),n(this,Gf).set(e,i),n(this,zn).div=e,n(this,zn).properties=i,g(this,Ir,mw).call(this,n(this,zn)),i.hasText&&n(this,Ye).append(e),i.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),n(this,Ye).append(w)}},mw=function(t){var a;const{div:e,properties:i,ctx:s}=t,{style:r}=e;if(i.canvasWidth!==0&&i.hasText){const{fontFamily:o}=r,{canvasWidth:l,fontSize:h}=i;g(a=ae,Bi,bw).call(a,s,h*n(this,ya),o);const{width:c}=s.measureText(e.textContent);c>0&&r.setProperty("--scale-x",l*n(this,ya)/c)}i.angle!==0&&r.setProperty("--rotate",`${i.angle}deg`)},Bi=new WeakSet,am=function(t=null){let e=n(this,vl).get(t||(t=""));if(!e){const i=document.createElement("canvas");i.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none;letter-spacing:normal;word-spacing:normal",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),n(this,vl).set(t,e),n(this,Yf).set(e,{size:0,family:""})}return e}
45,bw=function(t,e,i){const s=n(this,Yf).get(t);e===s.size&&i===s.family||(t.font=`${e}px ${i}`,s.size=e,s.family=i)},lS=function(){if(n(this,Mc)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),f(this,Mc,t.getBoundingClientRect().height),t.remove()},hS=function(t,e,i){const s=n(this,kc).get(t);if(s)return s;const r=g(this,Bi,am).call(this,i);r.canvas.width=r.canvas.height=tE,g(this,Bi,bw).call(this,r,tE,t);const a=r.measureText(""),o=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);r.canvas.width=r.canvas.height=0;let h=.8;return o?h=o/(o+l):(xt.platform.isFirefox&&J("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?h=e.ascent:e.descent&&(h=1+e.descent)),n(this,kc).set(t,h),h},m(ae,Bi),m(ae,kc,new Map),m(ae,vl,new Map),m(ae,Yf,new WeakMap),m(ae,Mc,null),m(ae,Ic,new Set),ae);const cP=100;function cS(d={}){const t=new yw,{docId:e}=t,i=d.url?gC(d.url):null,s=d.data?mC(d.data):null,r=d.httpHeaders||null,a=d.withCredentials===!0,o=d.password??null,l=d.range instanceof dS?d.range:null,h=Number.isInteger(d.rangeChunkSize)&&d.rangeChunkSize>0?d.rangeChunkSize:2**16;let c=d.worker instanceof vw?d.worker:null;const u=d.verbosity,p=typeof d.docBaseUrl=="string"&&!Bb(d.docBaseUrl)?d.docBaseUrl:null,b=Ig(d.cMapUrl),y=d.cMapPacked!==!1,w=Ig(d.iccUrl),v=Ig(d.standardFontDataUrl),A=Ig(d.wasmUrl),E=d.stopAtErrors!==!0,S=Number.isInteger(d.maxImageSize)&&d.maxImageSize>-1?d.maxImageSize:-1,x=typeof d.isOffscreenCanvasSupported=="boolean"?d.isOffscreenCanvasSupported:!Ni,_=typeof d.isImageDecoderSupported=="boolean"?d.isImageDecoderSupported:!Ni,C=Number.isInteger(d.canvasMaxAreaInBytes)?d.canvasMaxAreaInBytes:-1,k=typeof d.disableFontFace=="boolean"?d.disableFontFace:Ni,D=d.fontExtraProperties===!0,P=d.enableXfa===!0,I=d.ownerDocument||globalThis.document,L=d.disableRange===!0,O=d.disableStream===!0,H=d.disableAutoFetch===!0,W=d.pdfBug===!0,pt=d.CanvasFactory||(Ni?xC:vC),R=d.FilterFactory||(Ni?SC:AC),j=d.BinaryDataFactory||(Ni?_C:VA),nt=d.enableHWA===!0,ze=d.enableWebGPU===!0?kC():Promise.resolve(!1),xe=d.useWasm!==!1,Jt=d.pagesMapper||new lP,yt=typeof d.useSystemFonts=="boolean"?d.useSystemFonts:!Ni&&!k,Ds=typeof d.useWorkerFetch=="boolean"?d.useWorkerFetch:!!(j===VA&&b&&y&&v&&A&&Lu(b,document.baseURI)&&Lu(v,document.baseURI)&&Lu(A,document.baseURI)),Jd=null;R_(u);const ge={canvasFactory:new pt({ownerDocument:I,enableHWA:nt}),filterFactory:new R({docId:e,ownerDocument:I}),binaryDataFactory:Ds?null:new j({cMapUrl:b,standardFontDataUrl:v,wasmUrl:A})};c||(c=vw.create({verbosity:u,port:Br.workerPort}),t._worker=c);const Tt={docId:e,apiVersion:"6.3.289",data:s,password:o,disableAutoFetch:H,rangeChunkSize:h,docBaseUrl:p,enableXfa:P,evaluatorOptions:{maxImageSize:S,disableFontFace:k,ignoreErrors:E,isOffscreenCanvasSupported:x,isImageDecoderSupported:_,canvasMaxAreaInBytes:C,fontExtraProperties:D,useSystemFonts:yt,useWasm:xe,useWorkerFetch:Ds,cMapUrl:b,cMapPacked:y,iccUrl:w,standardFontDataUrl:v,wasmUrl:A,hasGPU:!1}},Kb={ownerDocument:I,pdfBug:W,styleElement:Jd,enableHWA:nt,loadingParams:{disableAutoFetch:H,enableXfa:P}};return Promise.all([c.promise,ze]).then(function([,p_]){if(c.destroyed)throw new Error("Worker was destroyed");Tt.evaluatorOptions.hasGPU=p_;const g_=c.messageHandler.sendWithPromise("GetDocRequest",Tt,s?[s.buffer]:null);let qb;if(!s)if(l)qb=new KC({pdfDataRangeTransport:l,disableRange:L,disableStream:O});else if(i){const Qb=rP(i);qb=new Qb({url:i,httpHeaders:r,withCredentials:a,rangeChunkSize:h,disableRange:L,disableStream:O})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return g_.then(Qb=>{if(c.destroyed)throw new Error("Worker was destroyed");const xA=new pu(e,Qb,c.port),m_=new uP(xA,t,qb,Kb,ge,Jt);if(t._transport=m_,t.destroyed)throw new Error("Loading aborted");xA.send("Ready",null)})}).catch(t._capability.reject).finally(t._setupCapability.resolve),t}var gb;const mb=class mb{constructor(){T(this,"_capability",Promise.withResolvers());T(this,"_setupCapability",Promise.withResolvers());T(this,"_transport",null);T(this,"_worker",null);T(this,"docId",`d${kt(mb,gb)._++}`);T(this,"destroyed",!1);T(this,"onPassword",null);T(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,i,s;this.destroyed=!0,this._capability.promise.catch(()=>{});try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await this._setupCapability.promise,await((e=this._transport)==null?void 0:e.destroy())}catch(r){throw(i=this._worker)!=null&&i.port&&delete this._worker._pendingDestroy,r}this._transport=null,(s=this._worker)==null||s.destroy(),this._worker=null}async getData(){return this._transport.getData()}};gb=new WeakMap,m(mb,gb,0);let yw=mb;var Dc,Al,UE;let dS=(UE=class{constructor(t,e,i=!1,s=null){m(this,Dc,Promise.withResolvers());m(this,Al,null);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s}onDataRange(t,e){n(this,Al).call(this,{type:"range",begin:t,chunk:e})}onDataProgressiveRead(t){n(this,Dc).promise.then(()=>{n(this,Al).call(this,{type:"progressiveRead",chunk:t})})}onDataProgressiveDone(){n(this,Dc).promise.then(()=>{n(this,Al).call(this,{type:"progressiveDone"})})}transportReady(t){f(this,Al,t),n(this,Dc).resolve()}requestDataRange(t,e){lt("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},Dc=new WeakMap,Al=new WeakMap,UE);class dP{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Y(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAttachmentContent(t){return this._transport.getAttachmentContent(t)}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}
45=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(t,e=null){return this._transport.extractPages(t,e)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}getSignatures(){return this._transport.getSignatures()}getSignatureData(t){return this._transport.getSignatureData(t)}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Wn,El,Sl,vu;const AA=class AA{constructor(t,e,i,s,r=!1){m(this,Sl);m(this,Wn,!1);m(this,El,null);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=r?new TA:null,this._pdfBug=r,this.commonObjs=i.commonObjs,this.objs=new rS,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,f(this,El,s),this.imageCoordinates=null}clone(t){const e=new AA(t,this._pageInfo,this._transport,n(this,El),this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:r=!1}={}){return new Cg({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:r})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Y(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}
45render({canvasContext:t,canvas:e=t.canvas,viewport:i,intent:s="display",annotationMode:r=Or.ENABLE,transform:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:u=null,isEditing:p=!1,recordImages:b=!1,recordOperations:y=!1,operationsFilter:w=null}){var H,W,pt;(H=this._stats)==null||H.time("Overall");const v=this._transport.getRenderingIntent(s,r,u,p),{renderingIntent:A,cacheKey:E}=v;f(this,Wn,!1),l||(l=this._transport.getOptionalContentConfig(A));const S=this._intentStates.getOrInsertComputed(E,Ey);S.streamReaderCancelTimeout&&(clearTimeout(S.streamReaderCancelTimeout),S.streamReaderCancelTimeout=null);const x=!!(A&Ri.PRINT);S.displayReadyCapability||(S.displayReadyCapability=Promise.withResolvers(),S.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(W=this._stats)==null||W.time("Page Request"),this._pumpOperatorList(v));const _=!!(this._pdfBug&&((pt=globalThis.StepperManager)!=null&&pt.enabled)),C=!!e&&!this.recordedBBoxes&&(y||_),k=!!e&&!this.imageCoordinates&&b,D=R=>{var j,nt,gt,ze;if(S.renderTasks.delete(L),C){const xe=(j=L.gfx)==null?void 0:j.dependencyTracker.take();xe&&((nt=L.stepper)==null||nt.setOperatorBBoxes(xe,L.gfx.dependencyTracker.takeDebugMetadata()),y&&(this.recordedBBoxes=xe))}k&&!R&&(this.imageCoordinates=(gt=L.gfx)==null?void 0:gt.imagesTracker.take()),x&&f(this,Wn,!0),g(this,Sl,vu).call(this),R?(L.capability.reject(R),this._abortOperatorList({intentState:S,reason:R instanceof Error?R:new Error(R)})):L.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(ze=globalThis.Stats)!=null&&ze.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))};let P=null,I=null;(C||k)&&(I=new rC(e,S.operatorList.length)),C&&(P=new aC(I,_));const L=new Aw({callback:D,params:{canvas:e,canvasContext:t,dependencyTracker:P??I,imagesTracker:k?new Jy(e):null,viewport:i,transform:a,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:S.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!x,pdfBug:this._pdfBug,pageColors:c,enableHWA:this._transport.enableHWA,operationsFilter:w});(S.renderTasks||(S.renderTasks=new Set)).add(L);const O=L.task;return Promise.all([S.displayReadyCapability.promise,l]).then(([R,j])=>{var nt;if(this.destroyed){D();return}if((nt=this._stats)==null||nt.time("Rendering"),!(j.renderingIntent&A))throw new Error("Mu
45st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");L.initializeGraphics({transparency:R,optionalContentConfig:j}),L.operatorListChanged()}).catch(D),O}getOperatorList({intent:t="display",annotationMode:e=Or.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}={}){var h;function r(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(l))}const a=this._transport.getRenderingIntent(t,e,i,s,!0),o=this._intentStates.getOrInsertComputed(a.cacheKey,Ey);let l;return o.opListReadCapability||(l=Object.create(null),l.operatorListChanged=r,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||(o.renderTasks=new Set)).add(l),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:n(this,El).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(s){return s.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(s=>Bu.textContent(s));const e=this.streamTextContent(t),i={items:[],styles:Object.create(null),lang:null};for await(const s of e)i.lang??(i.lang=s.lang),Object.assign(i.styles,s.styles),i.items.push(...s.items);return i}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),f(this,Wn,!1),Promise.all(t)}cleanup(t=!1){f(this,Wn,!0);const e=g(this,Sl,vu).call(this);return t&&e&&this._stats&&(this._stats=new TA),e}_startRenderPage(t,e){var s,r;const i=this._intentStates.get(e);i&&((s=this._stats)==null||s.timeEnd("Page Request"),(r=i.displayReadyCapability)==null||r.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&g(this,Sl,vu).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:s}){const{map:r,transfer:a}=i,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:n(this,El).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:r,modifiedIds:s},void 0,a).getReader(),h=this._intentStates.get(e);h.streamReader=l;const c=()=>{l.read().then(({value:u,done:p})=>{if(p){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(u,h),c())},u=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const p of h.renderTasks)p.operatorListChanged();g(this,Sl,vu).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(u);else if(h.opListReadCapability)h.opListReadCapability.reject(u);else throw u}})};c()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof rA){let s=cP;e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},s);return}}if(t.streamReader.cancel(new co(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[s,r]of this._intentStates)if(r===t){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}};Wn=new WeakMap,El=new WeakMap,Sl=new WeakSet,vu=function(){if(!n(this,Wn)||this.destroyed)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),f(this,Wn,!1),!0};let ww=AA;var wa,ws,Gn,xl,Rt,bb,_l,Cl,ii,om,uS,fS,Au,Lc,lm;let vw=(Rt=class{constructor({name:t=null,port:e=null,verbosity:i=N_()}={}){m(this,ii);m(this,wa,Promise.withResolvers());m(this,ws,null);m(this,Gn,null);m(this,xl,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(n(Rt,Cl).has(e))throw new Error("Cannot use more than one PDFWorker per port.");n(Rt,Cl).set(e,this),g(this,ii,uS).call(this,e)}
45else g(this,ii,fS).call(this)}get promise(){return n(this,wa).promise}get port(){return n(this,Gn)}get messageHandler(){return n(this,ws)}destroy(){var t,e;this.destroyed=!0,(t=n(this,xl))==null||t.terminate(),f(this,xl,null),n(Rt,Cl).delete(n(this,Gn)),f(this,Gn,null),(e=n(this,ws))==null||e.destroy(),f(this,ws,null)}static create(t){const e=n(this,Cl).get(t==null?void 0:t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Rt(t)}static get workerSrc(){if(Br.workerSrc)return Br.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Y(this,"_setupFakeWorkerGlobal",(async()=>n(this,Lc,lm)?n(this,Lc,lm):(await import(this.workerSrc)).WorkerMessageHandler)())}},wa=new WeakMap,ws=new WeakMap,Gn=new WeakMap,xl=new WeakMap,bb=new WeakMap,_l=new WeakMap,Cl=new WeakMap,ii=new WeakSet,om=function(){n(this,wa).resolve(),n(this,ws).send("configure",{verbosity:this.verbosity})},uS=function(t){f(this,Gn,t),f(this,ws,new pu("main","worker",t)),n(this,ws).on("ready",()=>{}),g(this,ii,om).call(this)},fS=function(){if(n(Rt,_l)||n(Rt,Lc,lm)){g(this,ii,Au).call(this);return}let{workerSrc:t}=Rt;try{Rt._isSameOrigin(window.location,t)||(t=Rt._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new pu("main","worker",e),s=()=>{r.abort(),i.destroy(),e.terminate(),this.destroyed?n(this,wa).reject(new Error("Worker was destroyed")):g(this,ii,Au).call(this)},r=new AbortController;e.addEventListener("error",()=>{n(this,xl)||s()},{signal:r.signal}),i.on("test",o=>{if(r.abort(),this.destroyed||!o){s();return}f(this,ws,i),f(this,Gn,e),f(this,xl,e),g(this,ii,om).call(this)}),i.on("ready",o=>{if(r.abort(),this.destroyed){s();return}try{a()}catch{g(this,ii,Au).call(this)}});const a=()=>{const o=new Uint8Array;i.send("test",o,[o.buffer])};a();return}catch{Fb("The worker has been disabled.")}g(this,ii,Au).call(this)},Au=function(){n(Rt,_l)||(J("Setting up fake worker."),f(Rt,_l,!0)),Rt._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){n(this,wa).reject(new Error("Worker was destroyed"));return}const e=new wC;f(this,Gn,e);const i=`fake${kt(Rt,bb)._++}`,s=new pu(i+"_worker",i,e);t.setup(s,e),f(this,ws,new pu(i,i+"_worker",e)),g(this,ii,om).call(this)}).catch(t=>{n(this,wa).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Lc=new WeakSet,lm=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},m(Rt,Lc),m(Rt,bb,0),m(Rt,_l,!1),m(Rt,Cl,new WeakMap),Ni&&(f(Rt,_l,!0),Br.workerSrc||(Br.workerSrc="./pdf.worker.mjs")),Rt._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(!(i!=null&&i.origin)||i.origin==="null")return!1;const s=new URL(e,i);return i.origin===s.origin},Rt._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Rt);var Si,Pl,Xn,vs,Tl,Rc,Yn,cs,Ih,hm;class uP{constructor(t,e,i,s,r,a){m(this,cs);T(this,"downloadInfoCapability",Promise.withResolvers());m(this,Si,null);m(this,Pl,new Map);m(this,Xn,null);m(this,vs,new Map);m(this,Tl,new Map);m(this,Rc,new Map);m(this,Yn,null);this.messageHandler=t,this.loadingTask=e,f(this,Xn,i),this.commonObjs=new rS,this.fontLoader=new lC({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.enableHWA=s.enableHWA,this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.binaryDataFactory=r.binaryDataFactory,this.pagesMapper=a,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){const{_pageIndex:e}=t;n(this,vs).set(e,t),n(this,Tl).set(e,Promise.resolve(t))}get annotationStorage(){return Y(this,"annotationStorage",new oA)}getRenderingIntent(t,e=Or.ENABLE,i=null,s=!1,r=!1){let a=Ri.DISPLAY,o=Uu;switch(t){case"any":a=Ri.ANY;break;case"display":break;case"print":a=Ri.PRINT;break;default:J(`getRenderingIntent - invalid intent: ${t}`)}const l=a&Ri.PRINT&&i instanceof P0?i:this.annotationStorage;switch(e){case Or.DISABLE:a+=Ri.ANNOTATIONS_DISABLE;break;case Or.ENABLE:break;case Or.ENABLE_FORMS:a+=Ri.ANNOTATIONS_FORMS;break;case Or.ENABLE_STORAGE:a+=Ri.ANNOTATIONS_STORAGE,o=l.serializable;break;default:J(`getRenderingIntent - invalid annotationMode: ${e}`)}s&&(a+=Ri.IS_EDITING),r&&(a+=Ri.OPLIST);const{ids:h,hash:c}=l.modifiedIds,u=[a,o.hash,c];
45return{renderingIntent:a,cacheKey:u.join("_"),annotationStorageSerializable:o,modifiedIds:h}}destroy(){var i;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(i=n(this,Yn))==null||i.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const s of n(this,vs).values())t.push(s._destroy());n(this,vs).clear(),n(this,Tl).clear(),n(this,Rc).clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{var s,r;this.commonObjs.clear(),this.fontLoader.clear(),n(this,Pl).clear(),this.filterFactory.destroy(),Xm.cleanup(),(s=n(this,Xn))==null||s.cancelAllRequests(new co("Worker was terminated.")),(r=this.messageHandler)==null||r.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(i,s)=>{Xt(n(this,Xn),"GetReader - no `BasePDFStream` instance available."),f(this,Si,n(this,Xn).getFullReader()),n(this,Si).onProgress=r=>g(this,cs,hm).call(this,r),s.onPull=()=>{n(this,Si).read().then(function({value:r,done:a}){if(a){s.close();return}Xt(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{s.error(r)})},s.onCancel=r=>{n(this,Si).cancel(r),s.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("ReaderHeadersReady",async i=>{await n(this,Si).headersReady;const{isStreamingSupported:s,isRangeSupported:r,contentLength:a}=n(this,Si);return s&&r&&(n(this,Si).onProgress=null),{isStreamingSupported:s,isRangeSupported:r,contentLength:a}}),t.on("GetRangeReader",(i,s)=>{Xt(n(this,Xn),"GetRangeReader - no `BasePDFStream` instance available.");const r=n(this,Xn).getRangeReader(i.begin,i.end);if(!r){s.close();return}s.onPull=()=>{r.read().then(function({value:a,done:o}){if(o){s.close();return}Xt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a])}).catch(a=>{s.error(a)})},s.onCancel=a=>{r.cancel(a),s.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("GetDoc",({pdfInfo:i})=>{this.pagesMapper.pagesNumber=i.numPages,this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new dP(i,this))}),t.on("DocException",i=>{e._capability.reject(ri(i))}),t.on("PasswordRequest",i=>{f(this,Yn,Promise.withResolvers());try{if(!e.onPassword)throw ri(i);const s=r=>{r instanceof Error?n(this,Yn).reject(r):n(this,Yn).resolve({password:r})};e.onPassword(s,i.code)}catch(s){n(this,Yn).reject(s)}return n(this,Yn).promise}),t.on("DataLoaded",i=>{g(this,cs,hm).call(this,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;n(this,vs).get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),t.on("commonobj",([i,s,r])=>{var a;if(this.destroyed||this.commonObjs.has(i))return null;switch(s){case"Font":if("error"in r){const p=r.error;J(`Error during font loading: ${p}`),this.commonObjs.resolve(i,p);break}const o=new uC(r),l=this._params.pdfBug&&((a=globalThis.FontInspector)!=null&&a.enabled)?(p,b)=>globalThis.FontInspector.fontAdded(p,b):null,h=new hC(o,l,r.charProcOperatorList,r.extra);this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{h.fontExtraProperties||h.clearData(),this.commonObjs.resolve(i,h)});break;case"CopyLocalImage":const{imageRef:c}=r;Xt(c,"The imageRef must be defined.");for(const p of n(this,vs).values())for(const[,b]of p.objs){if((b==null?void 0:b.ref)!==c)continue;if(!b.dataLen)return null;const y=structuredClone(b);return this.commonObjs.resolve(i,y),b.dataLen}break;case"FontPath":this.commonObjs.resolve(i,new pC(r));break;case"Image":this.commonObjs.resolve(i,r);break;case"Pattern":const u=new fC(r);this.commonObjs.resolve(i,u.getIR());break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),t.on("obj",([i,s,r,a])=>{var l;if(this.destroyed)return;const o=n(this,vs).get(s);if(!o.objs.has(i)){if(o._intentStates.size===0){(l=a==null?void 0:a.bitmap)==null||l.close();return}switch(r){case"Image":case"Pattern":o.objs.resolve(i,a);break;default:throw new Error(`Got unknown object type ${r}`)}}}),t.on("DocProgress",i=>{this.destroyed||g(this,cs,hm).call(this,i)}),t.on("FetchBinaryData",async i=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(i)})}
45getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var i;this.annotationStorage.size<=0&&J("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:((i=n(this,Si))==null?void 0:i.filename)??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t,e=null){var a;const i={pageInfos:t};let s;const r=globalThis.ImageBitmap;if(typeof r=="function"){const o=Array.isArray(t)?t:[t];for(const l of o)(l==null?void 0:l.image)instanceof r&&(s||(s=[])).push(l.image)}if(this.annotationStorage.size>0){const o=this.annotationStorage.serializable;let{map:l}=o;(a=o.transfer)!=null&&a.length&&(s?s.push(...o.transfer):s=o.transfer);const h=this.pagesMapper.getMapping();if(h){const c=new Map;for(const[u,p]of l){if((p==null?void 0:p.pageIndex)!==void 0&&p.pageIndex>=0&&p.pageIndex<h.length){const b=(e==null?void 0:e[p.pageIndex])??0,y=h[p.pageIndex]-1;if(y!==p.pageIndex||b!==0){c.set(u,{...p,pageIndex:y,copyLevel:b});continue}}c.set(u,p)}l=c}i.annotationStorage=l}return this.messageHandler.sendWithPromise("ExtractPages",i,s).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=this.pagesMapper.getPageId(t)-1,s=n(this,Tl).get(e);if(s)return s;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(a=>{if(this.destroyed)throw new Error("Transport destroyed");a.refStr&&n(this,Rc).set(a.refStr,i);const o=new ww(e,a,this,this.pagesMapper,this._params.pdfBug);return n(this,vs).set(e,o),o});return n(this,Tl).set(e,r),r}async getPageIndex(t){if(!ew(t))throw new Error("Invalid pageIndex request.");const e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),i=this.pagesMapper.getPageNumber(e+1);if(i===0)throw new Error("GetPageIndex: page has been removed.");return i-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return g(this,cs,Ih).call(this,"GetFieldObjects")}getSignatures(){return g(this,cs,Ih).call(this,"GetSignatures")}getSignatureData(t){return this.messageHandler.sendWithPromise("GetSignatureData",t)}hasJSActions(){return g(this,cs,Ih).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAttachmentContent(t){return this.messageHandler.sendWithPromise("GetAttachmentContent",t)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return g(this,cs,Ih).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return g(this,cs,Ih).call(this,"GetOptionalContentConfig").then(e=>new uw(e,t))}
45getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata";return n(this,Pl).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>{var i,s;return{info:e[0],metadata:e[1]?new aP(e[1]):null,contentDispositionFilename:((i=n(this,Si))==null?void 0:i.filename)??null,contentLength:((s=n(this,Si))==null?void 0:s.contentLength)??null,hasStructTree:e[2]}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of n(this,vs).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),n(this,Pl).clear(),this.filterFactory.destroy(!0),Xm.cleanup()}}cachedPageNumber(t){if(!ew(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,i=n(this,Rc).get(e);if(i>=0){const s=this.pagesMapper.getPageNumber(i+1);if(s!==0)return s}return null}}Si=new WeakMap,Pl=new WeakMap,Xn=new WeakMap,vs=new WeakMap,Tl=new WeakMap,Rc=new WeakMap,Yn=new WeakMap,cs=new WeakSet,Ih=function(t,e=null){return n(this,Pl).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},hm=function({loaded:t,total:e}){var i,s;(s=(i=this.loadingTask).onProgress)==null||s.call(i,{loaded:t,total:e,percent:e?Nt(Math.round(t/e*100),0,100):NaN})};class fP{constructor(t){T(this,"_internalRenderTask",null);T(this,"onContinue",null);T(this,"onError",null);this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&(e==null?void 0:e.size)>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}var va,kl;const Co=class Co{constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:r,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:p=null,enableHWA:b=!1,operationsFilter:y=null}){m(this,va,null);this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=u,this.pageColors=p,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new fP(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=b,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=y}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var h,c;if(this.cancelled)return;if(this._canvas){if(n(Co,kl).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");n(Co,kl).add(this._canvas)}this._pdfBug&&((h=globalThis.StepperManager)!=null&&h.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:i,transform:s,background:r,dependencyTracker:a,imagesTracker:o}=this.params,l=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new jh(l,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,a,o),this.gfx.beginDrawing({transform:s,viewport:i,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,(c=this.graphicsReadyCallback)==null||c.call(this)}cancel(t=null,e=0){var i,s,r;this.running=!1,this.cancelled=!0,(i=this.gfx)==null||i.endDrawing(),n(this,va)&&(window.cancelAnimationFrame(n(this,va)),f(this,va,null)),n(Co,kl).delete(this._canvas),t||(t=new rA(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),(r=(s=this.task).onError)==null||r.call(s,t)}operatorListChanged(){var t,e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(t=this.gfx.dependencyTracker)==null||t.growOperationsCount(this.operatorList.fnArray.length),(e=this.stepper)==null||e.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?f(this,va,window.requestAnimationFrame(()=>{f(this,va,null),this._nextBound().catch(this._cancelBound)}
45)):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),n(Co,kl).delete(this._canvas),this.callback())))}};va=new WeakMap,kl=new WeakMap,m(Co,kl,new WeakSet);let Aw=Co;const pP="6.3.289",gP="1c8020a7d";var xi,Ml,Nc,de,Kf,Fc,Kn,qf,Aa,As,Me,Qf,_t,Ew,Sw,xw,wo,gS,Lr;let pS=(Me=class{constructor({editor:t=null,uiManager:e=null}){m(this,_t);m(this,xi,null);m(this,Ml,null);m(this,Nc);m(this,de,null);m(this,Kf,!1);m(this,Fc,!1);m(this,Kn,null);m(this,qf);m(this,Aa,null);m(this,As,null);var i,s;t?(f(this,Fc,!1),f(this,Kn,t)):f(this,Fc,!0),f(this,As,(t==null?void 0:t._uiManager)||e),f(this,qf,n(this,As)._eventBus),f(this,Nc,((i=t==null?void 0:t.color)==null?void 0:i.toUpperCase())||((s=n(this,As))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),n(Me,Qf)||f(Me,Qf,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Y(this,"_keyboardManager",new wh([[["Escape"],Me.prototype._hideDropdownFromKeyboard],[["Space"],Me.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight"],Me.prototype._moveToNext],[["ArrowUp","ArrowLeft"],Me.prototype._moveToPrevious],[["Home"],Me.prototype._moveToBeginning],[["End"],Me.prototype._moveToEnd]]))}renderButton(){const t=f(this,xi,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",n(this,Kn)&&(t.ariaControls=`${n(this,Kn).id}_colorpicker_dropdown`);const e=n(this,As)._signal;t.addEventListener("click",g(this,_t,wo).bind(this),{signal:e}),t.addEventListener("keydown",g(this,_t,xw).bind(this),{signal:e});const i=f(this,Ml,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=n(this,Nc),t.append(i),t}renderMainDropdown(){const t=f(this,de,g(this,_t,Ew).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===n(this,xi)){g(this,_t,wo).call(this,t);return}const e=t.target.getAttribute("data-color");e&&g(this,_t,Sw).call(this,e,t)}_moveToNext(t){var e,i;if(!n(this,_t,Lr)){g(this,_t,wo).call(this,t);return}if(t.target===n(this,xi)){(e=n(this,de).firstElementChild)==null||e.focus();return}(i=t.target.nextSibling)==null||i.focus()}_moveToPrevious(t){var e,i;if(t.target===((e=n(this,de))==null?void 0:e.firstElementChild)||t.target===n(this,xi)){n(this,_t,Lr)&&this._hideDropdownFromKeyboard();return}n(this,_t,Lr)||g(this,_t,wo).call(this,t),(i=t.target.previousSibling)==null||i.focus()}_moveToBeginning(t){var e;if(!n(this,_t,Lr)){g(this,_t,wo).call(this,t);return}(e=n(this,de).firstElementChild)==null||e.focus()}_moveToEnd(t){var e;if(!n(this,_t,Lr)){g(this,_t,wo).call(this,t);return}(e=n(this,de).lastElementChild)==null||e.focus()}hideDropdown(){var t,e;(t=n(this,de))==null||t.classList.add("hidden"),n(this,xi).ariaExpanded="false",(e=n(this,Aa))==null||e.abort(),f(this,Aa,null)}_hideDropdownFromKeyboard(){var t;if(!n(this,Fc)){if(!n(this,_t,Lr)){(t=n(this,Kn))==null||t.unselect();return}this.hideDropdown(),n(this,xi).focus({preventScroll:!0,focusVisible:n(this,Kf)})}}update(t){if(n(this,Ml)&&(n(this,Ml).style.backgroundColor=t),!n(this,de))return;const e=n(this,As).highlightColors.values();for(const i of n(this,de).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){var t,e;(t=n(this,xi))==null||t.remove(),f(this,xi,null),f(this,Ml,null),(e=n(this,de))==null||e.remove(),f(this,de,null)}},xi=new WeakMap,Ml=new WeakMap,Nc=new WeakMap,de=new WeakMap,Kf=new WeakMap,Fc=new WeakMap,Kn=new WeakMap,qf=new WeakMap,Aa=new WeakMap,As=new WeakMap,Qf=new WeakMap,_t=new WeakSet,Ew=function(){const t=document.createElement("div"),e=n(this,As)._signal;t.addEventListener("contextmenu",Is,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),n(this,Kn)&&(t.id=`${n(this,Kn).id}_colorpicker_dropdown`);for(const[i,s]of n(this,As).highlightColors){const r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",s),r.title=i,r.setAttribute("data-l10n-id",n(Me,Qf)[i]);const a=document.createElement("span");r.append(a),a.className="swatch",a.style.backgroundColor=s,r.ariaSelected=s===n(this,Nc),r.addEventListener("click",g(this,_t,Sw).bind(this,s),{signal:e}),t.append(r)}return t.addEventListener("keydown",g(this,_t,xw).bind(this),{signal:e}),t},Sw=function(t,e){e.stopPropagation(),n(this,qf).dispatch("switchannotationeditorparams",{source:this,type:ot.HIGHLIGHT_COLOR,value:t}),this.update(t)},xw=function(t){Me._keyboardManager.exec(this,t)},wo=function(t){if(n(this,_t,Lr)){this.hideDropdown();return}if(f(this,Kf,t.detail===0),n(this,Aa)||(f(this,Aa,new AbortController),window.addEventListener("pointerdown",g(this,_t,gS).bind(this),{signal:n(this,As).combinedSignal(n(this,Aa))})),n(this,xi).ariaExpanded="true",n(this,de)){n(this,de).classList.remove("hidden");return}const e=f(this,de,g(this,_t,Ew).call(this));n(this,xi).append(e)},gS=function(t){var e;(e=n(this,de))!=null&&e.contains(t.target)||this.hideDropdown()},Lr=function(){return n(this,de)&&!n(this,de).classList.contains("hidden")},m(Me,Qf,null),Me);var _i,Oc,Il,qn,Zf;const Po=class Po{constructor(t){m(this,_i,null);m(this,Oc,!1);m(this,Il,null);m(this,qn,null);f(this,Il,t),f(this,qn,t._uiManager),n(Po,Zf)||f(Po,Zf,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}
45renderButton(){if(n(this,_i))return n(this,_i);const{editorType:t,colorType:e,colorAndOpacityType:i,opacityType:s,color:r,opacity:a}=n(this,Il),o=f(this,Oc,xt.isAlphaColorInputSupported&&s!==void 0),l=f(this,_i,document.createElement("input"));if(l.type="color",o){l.setAttribute("alpha","");const h=N.hexNums[Math.round((a??1)*255)];l.value=(r||"#000000")+h}else l.value=r||"#000000";return l.className="basicColorPicker",l.tabIndex=0,l.setAttribute("data-l10n-id",n(Po,Zf)[t]),l.addEventListener("input",()=>{if(o){const h=Pg(l.value);if(!h)return;const[c,u,p,b]=h,y=N.makeHexColor(c,u,p);i!==void 0?n(this,qn).updateParams(i,{color:y,opacity:b}):(n(this,qn).updateParams(e,y),n(this,qn).updateParams(s,b))}else n(this,qn).updateParams(e,l.value)},{signal:n(this,qn)._signal}),l}update(t){if(n(this,_i))if(n(this,Oc)){const e=N.hexNums[Math.round(n(this,Il).opacity*255)];n(this,_i).value=t+e}else n(this,_i).value=t}updateOpacity(t){if(!n(this,_i)||!n(this,Oc))return;const e=N.hexNums[Math.round(t*255)];n(this,_i).value=n(this,Il).color+e}destroy(){var t;(t=n(this,_i))==null||t.remove(),f(this,_i,null)}hideDropdown(){}};_i=new WeakMap,Oc=new WeakMap,Il=new WeakMap,qn=new WeakMap,Zf=new WeakMap,m(Po,Zf,null);let Ym=Po;function eE(d){return Math.floor(Nt(d,0,1)*255).toString(16).padStart(2,"0")}function su(d){return Nt(d,0,1)*255}class iE{static CMYK_G([t,e,i,s]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+s)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=su(t),[t,t,t]}static G_HTML([t]){const e=eE(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(su)}static RGB_HTML(t){return`#${t.map(eE).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,i+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,i,s]){return[su(1-Math.min(1,t+s)),su(1-Math.min(1,i+s)),su(1-Math.min(1,e+s))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){const s=1-t,r=1-e,a=1-i,o=Math.min(s,r,a);return["CMYK",s,r,a,o]}}class mP{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){lt("Abstract method `_createSVG` called.")}}let Km=class extends mP{_createSVG(t){return document.createElementNS(Je,t)}};const bP=9,vh=new WeakSet,yP=new Date().getTimezoneOffset()*60*1e3;class oy{static create(t){switch(t.data.annotationType){case Vt.LINK:return new hA(t);case Vt.TEXT:return new vP(t);case Vt.WIDGET:switch(t.data.fieldType){case"Tx":return new AP(t);case"Btn":return t.data.radioButton?new xP(t):t.data.checkBox?new SP(t):new _P(t);case"Ch":return new CP(t);case"Sig":return new EP(t)}return new Sh(t);case Vt.POPUP:return new Cw(t);case Vt.FREETEXT:return new ES(t);case Vt.LINE:return new TP(t);case Vt.SQUARE:return new kP(t);case Vt.CIRCLE:return new MP(t);case Vt.POLYLINE:return new SS(t);case Vt.CARET:return new DP(t);case Vt.INK:return new cA(t);case Vt.POLYGON:return new IP(t);case Vt.HIGHLIGHT:return new xS(t);case Vt.UNDERLINE:return new LP(t);case Vt.SQUIGGLY:return new RP(t);case Vt.STRIKEOUT:return new NP(t);case Vt.STAMP:return new _S(t);case Vt.FILEATTACHMENT:return new FP(t);case Vt.RICHMEDIA:case Vt.SCREEN:case Vt.SOUND:return new CS(t);default:return new jt(t)}}}var Dl,Bc,es,Jf,_w;const EA=class EA{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){m(this,Jf);m(this,Dl,null);m(this,Bc,!1);m(this,es,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t!=null&&t.str||e!=null&&e.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return EA._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var i;const{data:t}=this,e=(i=this.annotationStorage)==null?void 0:i.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
45get commentButtonPosition(){var o;const t=(o=this.annotationStorage)==null?void 0:o.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;const{quadPoints:e,inkLists:i,rect:s}=this.data;let r=-1/0,a=-1/0;if((e==null?void 0:e.length)>=8){for(let l=0;l<e.length;l+=8)e[l+1]>a?(a=e[l+1],r=e[l+2]):e[l+1]===a&&(r=Math.max(r,e[l+2]));return[r,a]}if((i==null?void 0:i.length)>=1){for(const l of i)for(let h=0,c=l.length;h<c;h+=2)l[h+1]>a?(a=l[h+1],r=l[h]):l[h+1]===a&&(r=Math.max(r,l[h]));if(r!==1/0)return[r,a]}return s?[s[2],s[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:s,pageX:r,pageY:a}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-r)/i,t[1]=100*(t[1]-a)/s,t}get commentText(){var e,i,s;const{data:t}=this;return((i=(e=this.annotationStorage.getRawValue(`${zd}${t.id}`))==null?void 0:e.popup)==null?void 0:i.contents)||((s=t.contentsObj)==null?void 0:s.str)||""}set commentText(t){const{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue(`${zd}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;(e=((t=n(this,es))==null?void 0:t.popup)||this.popup)==null||e.remove(),f(this,es,this.popup=null)}updateEdited(t){var r;if(!this.container)return;t.rect&&(n(this,Dl)||f(this,Dl,{rect:this.data.rect.slice(0)}));const{rect:e,popup:i}=t;e&&g(this,Jf,_w).call(this,e);let s=((r=n(this,es))==null?void 0:r.popup)||this.popup;!s&&(i!=null&&i.text)&&(this._createPopup(i),s=n(this,es).popup),s&&(s.updateEdited(t),i!=null&&i.deleted&&(s.remove(),f(this,es,null),this.popup=null))}resetEdited(){var t;n(this,Dl)&&(g(this,Jf,_w).call(this,n(this,Dl).rect),(t=n(this,es))==null||t.popup.resetEdited(),f(this,Dl,null))}_createContainer(t){const{data:e,parent:{page:i,viewport:s}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),!(this instanceof Sh)&&!(this instanceof hA)&&!(this instanceof CS)&&(r.tabIndex=0);const{style:a}=r;if(a.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof Cw){const{rotation:w}=e;return!e.hasOwnCanvas&&w!==0&&this.setRotation(w,r),r}const{width:o,height:l}=this;if(!t&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const w=e.borderStyle.horizontalCornerRadius,v=e.borderStyle.verticalCornerRadius;if(w>0||v>0){const E=`calc(${w}px * var(--total-scale-factor)) / calc(${v}px * var(--total-scale-factor))`;a.borderRadius=E}switch(e.borderStyle.style){case Th.SOLID:a.borderStyle="solid";break;case Th.DASHED:a.borderStyle="dashed";break;case Th.BEVELED:J("Unimplemented border style: beveled");break;case Th.INSET:J("Unimplemented border style: inset");break;case Th.UNDERLINE:a.borderBottomStyle="solid";break}const A=e.borderColor||null;A?(f(this,Bc,!0),a.borderColor=N.makeHexColor(...A)):a.borderWidth=0}const h=N.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:u,pageX:p,pageY:b}=s.rawDims;a.left=`${100*(h[0]-p)/c}%`,a.top=`${100*(h[1]-b)/u}%`;const{rotation:y}=e;return e.hasOwnCanvas||y===0?(a.width=`${100*o/c}%`,a.height=`${100*l/u}%`):this.setRotation(y,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims;let{width:r,height:a}=this;t%180!==0&&([r,a]=[a,r]),e.style.width=`${100*r/i}%`,e.style.height=`${100*a/s}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,i,s)=>{const r=s.detail[e],a=r[0],o=r.slice(1);s.target.style[i]=iE[`${a}_HTML`](o),this.annotationStorage.setValue(this.data.id,{[i]:iE[`${a}_rgb`](o)})};return Y(this,"_commonActions",{display:e=>{const{display:i}=e.detail,s=i%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:i===1||i===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:i}=e.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:e=>{setTimeout(()=>
45e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const i=e.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const s of Object.keys(e.detail)){const r=t[s]||i[s];r==null||r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[s,r]of Object.entries(e)){const a=i[s];if(a){const o={detail:{[s]:r},target:t};a(o),delete e[s]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,s,r]=this.data.rect.map(Math.fround);if(t.length===8){const[w,v,A,E]=t.subarray(2,6);if(s===w&&r===v&&e===A&&i===E)return}const{style:a}=this.container;let o;if(n(this,Bc)){const{borderColor:w,borderWidth:v}=a;a.borderWidth=0,o=["url('data:image/svg+xml;utf8,",`<svg xmlns="${Je}" preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${w}" stroke-width="${v}">`],this.container.classList.add("hasBorder")}const l=s-e,h=r-i,{svgFactory:c}=this,u=c.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const p=c.createElement("defs");u.append(p);const b=c.createElement("clipPath"),y=`clippath_${this.data.id}`;b.setAttribute("id",y),b.setAttribute("clipPathUnits","objectBoundingBox"),p.append(b);for(let w=2,v=t.length;w<v;w+=8){const A=t[w],E=t[w+1],S=t[w+2],x=t[w+3],_=c.createElement("rect"),C=(S-e)/l,k=(r-E)/h,D=(A-S)/l,P=(E-x)/h;_.setAttribute("x",C),_.setAttribute("y",k),_.setAttribute("width",D),_.setAttribute("height",P),b.append(_),o==null||o.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${k}" width="${D}" height="${P}"/>`)}n(this,Bc)&&(o.push("</g></svg>')"),a.backgroundImage=o.join("")),this.container.append(u),this.container.style.clipPath=`url(#${y})`}_createPopup(t=null){const{data:e}=this;let i,s;t?(i={str:t.text},s=t.date):(i=e.contentsObj,s=e.modificationDate),f(this,es,new Cw({data:{color:e.color,titleObj:e.titleObj,modificationDate:s,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(n(this,es)||this.popup||this.data.popupRef)}get extraPopupElement(){return n(this,es)}render(){lt("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects.get(t)||[];for(const{page:r,id:a,exportValues:o}of s){if(r===-1||a===e)continue;const l=typeof o=="string"?o:null,h=document.querySelector(`[data-element-id="${a}"]`);if(h&&!vh.has(h)){J(`_getElementsByName - element not allowed: ${a}`);continue}i.push({id:a,exportValue:l,domElement:h})}return i}for(const s of document.getElementsByName(t)){const{exportValue:r}=s,a=s.getAttribute("data-element-id");a!==e&&vh.has(s)&&i.push({id:a,exportValue:r,domElement:s})}return i}show(){var t;this.container&&(this.container.hidden=!1),(t=this.popup)==null||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),(t=this.popup)==null||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;(i=this.linkService.eventBus)==null||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}updateOC(t){if(!this.data.oc||!t)return;t.isVisible(this.data.oc)?this.show():this.hide()}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}
45_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":N.makeHexColor(...e)}};Dl=new WeakMap,Bc=new WeakMap,es=new WeakMap,Jf=new WeakSet,_w=function(t){const{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:l}}}}=this;i==null||i.splice(0,4,...t),e.left=`${100*(t[0]-o)/r}%`,e.top=`${100*(a-t[3]+l)/a}%`,s===0?(e.width=`${100*(t[2]-t[0])/r}%`,e.height=`${100*(t[3]-t[1])/a}%`):this.setRotation(s)};let jt=EA;class wP extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){const{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}var Oi,vo,mS,bS;class hA extends jt{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!(i!=null&&i.ignoreBorder),createQuadrilaterals:!0});m(this,Oi);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:i}=this,s=document.createElement("a");s.setAttribute("data-element-id",e.id);let r=!1;return e.url?(i.addLinkAttributes(s,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(s,e.action,e.overlaidText),r=!0):e.attachment?(g(this,Oi,mS).call(this,s,e.attachmentId,e.attachment,e.overlaidText,e.attachmentDest),r=!0):e.setOCGState?(g(this,Oi,bS).call(this,s,e.setOCGState,e.overlaidText),r=!0):e.dest?(this._bindLink(s,e.dest,e.overlaidText),r=!0):(e.actions&&(e.actions.has("Action")||e.actions.has("Mouse Up")||e.actions.has("Mouse Down"))&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,e),r=!0),e.resetForm?(this._bindResetFormAction(s,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(s,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&(this.contentElement=s,this.container.append(s)),this.container}_bindLink(e,i,s=""){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&g(this,Oi,vo).call(this),s&&(e.title=s)}_bindNamedAction(e,i,s=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),s&&(e.title=s),g(this,Oi,vo).call(this)}_bindJSAction(e,{actions:i,id:s,overlaidText:r}){e.href=this.linkService.getAnchorUrl("");const a=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of i.keys()){const l=a.get(o);l&&(e[l]=()=>{var h;return(h=this.linkService.eventBus)==null||h.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:o}}),!1})}r&&(e.title=r),e.onclick||(e.onclick=()=>!1),g(this,Oi,vo).call(this)}_bindResetFormAction(e,i){const s=e.onclick;if(s||(e.href=this.linkService.getAnchorUrl("")),g(this,Oi,vo).call(this),!this._fieldObjects){J('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(e.onclick=()=>!1);return}e.onclick=()=>{var u;s==null||s();const{fields:r,refs:a,include:o}=i,l=[];if(r.length!==0||a.length!==0){const p=new Set(a);for(const b of r){const y=this._fieldObjects.get(b)||[];for(const{id:w}of y)p.add(w)}for(const b of this._fieldObjects.values())for(const y of b)p.has(y.id)===o&&l.push(y)}else for(const p of this._fieldObjects.values())l.push(...p);const h=this.annotationStorage,c=[];for(const p of l){const{id:b}=p;switch(c.push(b),p.type){case"text":{const w=p.defaultValue||"";h.setValue(b,{value:w});break}case"checkbox":case"radiobutton":{const w=p.defaultValue===p.exportValues;h.setValue(b,{value:w});break}case"combobox":case"listbox":{const w=p.defaultValue||"";h.setValue(b,{value:w});break}default:continue}const y=document.querySelector(`[data-element-id="${b}"]`);if(y){if(!vh.has(y)){J(`_bindResetFormAction - element not allowed: ${b}`);continue}}else continue;y.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((u=this.linkService.eventBus)==null||u.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}})),!1}}}Oi=new WeakSet,vo=function(){this.container.setAttribute("data-internal-link","")},mS=function(e,i,s,r="",a=null){e.href=this.linkService.getAnchorUrl(""),s.description?e.title=s.description:r&&(e.title=r);const o=async()=>{var h;const l=await this.linkService.getAttachmentContent(i);l&&((h=this.downloadManager)==null||h.openOrDownloadData(l,s.filename,a))};e.onclick=()=>(o(),!1),g(this,Oi,vo).call(this)},bS=function(e,i,s=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),s&&(e.title=s),g(this,Oi,vo).call(this)};class vP extends jt{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}}
45class Sh extends jt{render(){return this.container}_getKeyModifier(t){return xt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,r){i.includes("mouse")?t.addEventListener(i,a=>{var o;(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):t.addEventListener(i,a=>{var o;if(i==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(i==="focus"){if(e.focused)return;e.focused=!0}r&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(a)}}))})}_setEventListeners(t,e,i,s){const{actions:r}=this.data;for(const[a,o]of i)(o==="Action"||r!=null&&r.has(o))&&((o==="Focus"||o==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,a,o,s),o==="Focus"&&!(r!=null&&r.has("Blur"))?this._setEventListener(t,e,"blur","Blur",null):o==="Blur"&&!(r!=null&&r.has("Focus"))&&this._setEventListener(t,e,"focus","Focus",null))}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||bP,r=t.style;let a;const o=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o),c=Math.round(h/(1.35*s))||1,u=h/c;a=Math.min(s,l(u/1.35))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-o);a=Math.min(s,l(h/1.35))}r.fontSize=`calc(${a}px * var(--total-scale-factor))`,r.color=N.makeHexColor(...i),this.data.textAlignment!==null&&!this.data.comb&&(r.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class AP extends Sh{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,s){const r=this.annotationStorage;
45for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),r.setValue(a.id,{[s]:i})}render(){var s,r;const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=t.getValue(e,{value:this.data.fieldValue});let o=a.value||"";const l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&o.length>l&&(o=o.slice(0,l));let h=a.formattedValue||((s=this.data.textContent)==null?void 0:s.join(` 46`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=h??o,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",h??o),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(this.container.classList.add("hasOwnCanvas"),t.has(e)&&this.container.classList.add("sandboxModified")),vh.add(i),this.contentElement=i,i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;const{datetimeFormat:u,datetimeType:p,timeStep:b}=this.data,y=!!p&&this.enableScripting;u&&(i.title=u),this._setRequired(i,this.data.required),l&&(i.maxLength=l),i.addEventListener("input",v=>{t.setValue(e,{value:v.target.value}),this.setPropertyOnSiblings(i,"value",v.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",v=>{const A=this.data.defaultFieldValue??"";i.value=c.userValue=A,c.formattedValue=null});let w=v=>{const{formattedValue:A}=c;A!=null&&(v.target.value=A),v.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",A=>{var S;if(c.focused)return;const{target:E}=A;if(y&&(E.type=p,b&&(E.step=b)),c.userValue){const x=c.userValue;if(y)if(p==="time"){const _=new Date(x),C=[_.getHours(),_.getMinutes(),_.getSeconds()];E.value=C.map(k=>k.toString().padStart(2,"0")).join(":")}else E.value=new Date(x-yP).toISOString().split(p==="date"?"T":".",1)[0];else E.value=x}c.lastCommittedValue=E.value,c.commitKey=1,(S=this.data.actions)!=null&&S.has("Focus")||(c.focused=!0)}),i.addEventListener("updatefromsandbox",A=>{this.container.classList.add("sandboxModified");const E={value(S){c.userValue=S.detail.value??"",y||t.setValue(e,{value:c.userValue.toString()}),S.target.value=c.userValue},formattedValue(S){const{formattedValue:x}=S.detail;c.formattedValue=x,x!=null&&S.target!==document.activeElement&&(S.target.value=x);const _={formattedValue:x};y&&(_.value=x),t.setValue(e,_)},selRange(S){S.target.setSelectionRange(...S.detail.selRange)},charLimit:S=>{var k;const{charLimit:x}=S.detail,{target:_}=S;if(x===0){_.removeAttribute("maxLength");return}_.setAttribute("maxLength",x);let C=c.userValue;!C||C.length<=x||(C=C.slice(0,x),_.value=c.userValue=C,t.setValue(e,{value:C}),(k=this.linkService.eventBus)==null||k.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:C,willCommit:!0,commitKey:1,selStart:_.selectionStart,selEnd:_.selectionEnd}}))}};this._dispatchEventFromSandbox(E,A)}),i.addEventListener("keydown",A=>{var x;c.commitKey=1;let E=-1;if(A.key==="Escape"?E=0:A.key==="Enter"&&!this.data.multiLine?E=2:A.key==="Tab"&&(c.commitKey=3),E===-1)return;const{value:S}=A.target;c.lastCommittedValue!==S&&(c.lastCommittedValue=S,c.userValue=S,(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:S,willCommit:!0,commitKey:E,selStart:A.target.selectionStart,selEnd:A.target.selectionEnd}}))});const v=w;w=null,i.addEventListener("blur",A=>{var x,_;if(!c.focused||!A.relatedTarget)return;(x=this.data.actions)!=null&&x.has("Blur")||(c.focused=!1);const{target:E}=A;let{value:S}=E;if(y){if(S&&p==="time"){const C=S.split(":").map(k=>parseInt(k,10));S=new Date(2e3,0,1,C[0],C[1],C[2]||0).valueOf(),E.step=""}else S.includes("T")||(S=`${S}T00:00`),S=new Date(S).valueOf();E.type="text"}c.userValue=S,c.lastCommittedValue!==S&&((_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:S,willCommit:!0,
46commitKey:c.commitKey,selStart:A.target.selectionStart,selEnd:A.target.selectionEnd}})),v(A)}),(r=this.data.actions)!=null&&r.has("Keystroke")&&i.addEventListener("beforeinput",A=>{var P;c.lastCommittedValue=null;const{data:E,target:S}=A,{value:x,selectionStart:_,selectionEnd:C}=S;let k=_,D=C;switch(A.inputType){case"deleteWordBackward":{const I=/\w/;for(;k>0&&!I.test(x[k-1]);)k--;for(;k>0&&I.test(x[k-1]);)k--;break}case"deleteWordForward":{const I=x.substring(_).match(/^\W*\w*/);I&&(D+=I[0].length);break}case"deleteContentBackward":_===C&&(k-=1);break;case"deleteContentForward":_===C&&(D+=1);break}A.preventDefault(),(P=this.linkService.eventBus)==null||P.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:x,change:E||"",willCommit:!1,selStart:k,selEnd:D}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],A=>A.target.value)}if(w&&i.addEventListener("blur",w),this.data.comb){const A=(this.data.rect[2]-this.data.rect[0])/l;i.classList.add("comb"),i.style.setProperty("--comb-width",`calc(${A}px * var(--total-scale-factor))`);const E=this.data.textAlignment;if(E===1||E===2){const S=()=>{const x=l-i.value.length;i.style.setProperty("--comb-offset",`${E===1?x>>1:x}`)};S();for(const x of["input","blur","resetform","updatefromsandbox"])i.addEventListener(x,S)}}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class EP extends Sh{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class SP extends Sh{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return vh.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=0,r.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,i)){const c=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=c),t.setValue(h.id,{value:c})}t.setValue(i,{value:l})}),r.addEventListener("resetform",a=>{const o=e.defaultFieldValue||"Off";a.target.checked=o===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",a=>{const o={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(i,{value:l.target.checked})}};this._dispatchEventFromSandbox(o,a)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class xP extends Sh{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.buttonValue!==null&&e.fieldValue===e.buttonValue}).value;if(typeof s=="string"&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const r=document.createElement("input");if(vh.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.tabIndex=0,r.addEventListener("change",a=>{const{name:o,checked:l}=a.target;for(const h of this._getElementsByName(o,i))t.setValue(h.id,{value:!1});t.setValue(i,{value:l})}),r.addEventListener("resetform",a=>{const o=e.defaultFieldValue;a.target.checked=o!=null&&o===e.buttonValue}),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;r.addEventListener("updatefromsandbox",o=>{const l={value:h=>{const c=a===h.detail.value;for(const u of this._getElementsByName(h.target.name)){const p=c&&u.id===i;u.domElement&&(u.domElement.checked=p),t.setValue(u.id,{value:p})}}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}
46class _P extends hA{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({},i)})),t}}class CP extends Sh{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");vh.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=0;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",u=>{const p=this.data.defaultFieldValue;for(const b of s.options)b.selected=b.value===p});const a=(u,p)=>{const b=p.replaceAll(" ","Â ");u.textContent=b,b!==p&&u.setAttribute("display-value",p)};for(const u of this.data.options){const p=document.createElement("option");a(p,u.displayValue),p.value=u.exportValue,i.value.includes(u.exportValue)&&(p.setAttribute("selected",!0),r=!1),s.append(p)}let o=null;if(r){const u=document.createElement("option");u.value=" ",u.setAttribute("hidden",!0),u.setAttribute("selected",!0),s.prepend(u),o=()=>{u.remove(),s.removeEventListener("input",o),o=null},s.addEventListener("input",o)}const l=u=>{const p=u?"value":"textContent",{options:b,multiple:y}=s;return y?Array.prototype.filter.call(b,w=>w.selected).map(w=>w[p]):b.selectedIndex===-1?null:b[b.selectedIndex][p]};let h=l(!1);const c=u=>{const p=u.target.options;return Array.prototype.map.call(p,b=>({displayValue:b.getAttribute("display-value")||b.textContent,exportValue:b.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",u=>{const p={value(b){o==null||o();const y=b.detail.value,w=new Set(Array.isArray(y)?y:[y]);for(const v of s.options)v.selected=w.has(v.value);t.setValue(e,{value:l(!0)}),h=l(!1)},multipleSelection(b){s.multiple=!0},remove(b){const y=s.options,w=b.detail.remove;y[w].selected=!1,s.remove(w),y.length>0&&Array.prototype.findIndex.call(y,A=>A.selected)===-1&&(y[0].selected=!0),t.setValue(e,{value:l(!0),items:c(b)}),h=l(!1)},clear(b){for(;s.length!==0;)s.remove(0);t.setValue(e,{value:null,items:[]}),h=l(!1)},insert(b){const{index:y,displayValue:w,exportValue:v}=b.detail.insert,A=s.children[y],E=document.createElement("option");a(E,w),E.value=v,A?A.before(E):s.append(E),t.setValue(e,{value:l(!0),items:c(b)}),h=l(!1)},items(b){const{items:y}=b.detail;for(;s.length!==0;)s.remove(0);for(const w of y){const{displayValue:v,exportValue:A}=w,E=document.createElement("option");a(E,v),E.value=A,s.append(E)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:l(!0),items:c(b)}),h=l(!1)},indices(b){const y=new Set(b.detail.indices);for(const w of b.target.options)w.selected=y.has(w.index);t.setValue(e,{value:l(!0)}),h=l(!1)},editable(b){b.target.disabled=!b.detail.editable}};this._dispatchEventFromSandbox(p,u)}),s.addEventListener("input",u=>{var y;const p=l(!0),b=l(!1);t.setValue(e,{value:p}),u.preventDefault(),(y=this.linkService.eventBus)==null||y.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:h,change:b,changeEx:p,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],u=>u.target.value)):s.addEventListener("input",function(u){t.setValue(e,{value:l(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}var tp,Pw;class Cw extends jt{constructor(e){const{data:i,elements:s,parent:r}=e,a=!!r._commentManager;super(e,{isRenderable:!a&&jt._hasPopupData(i)});
46m(this,tp);if(this.elements=s,a&&jt._hasPopupData(i)){const o=this.popup=g(this,tp,Pw).call(this);for(const l of s)l.popup=o}else this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const i=this.popup=g(this,tp,Pw).call(this),s=[];for(const r of this.elements)r.popup=i,r.container.ariaHasPopup="dialog",s.push(r.data.id),r.addHighlightArea();return this.container.setAttribute("aria-controls",s.map(r=>`${Fh}${r}`).join(",")),this.container}}tp=new WeakSet,Pw=function(){return new PP({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};var Ci,Ea,yb,wb,jc,Uc,Kt,en,Sa,Ll,$c,Vc,sn,Pi,Qn,Zn,qt,Jn,xa,ep,tr,Hc,Rl,_a,ve,Ca,st,cm,Tw,kw,Mw,dm,Iw,yS,wS,vS,AS,um,fm,Dw;class PP{constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:u,commentManager:p=null}){m(this,st);m(this,Ci,null);m(this,Ea,g(this,st,vS).bind(this));m(this,yb,g(this,st,Dw).bind(this));m(this,wb,g(this,st,fm).bind(this));m(this,jc,g(this,st,um).bind(this));m(this,Uc,null);m(this,Kt,null);m(this,en,null);m(this,Sa,null);m(this,Ll,null);m(this,$c,null);m(this,Vc,null);m(this,sn,!1);m(this,Pi,null);m(this,Qn,null);m(this,Zn,null);m(this,qt,null);m(this,Jn,null);m(this,xa,null);m(this,ep,null);m(this,tr,null);m(this,Hc,null);m(this,Rl,null);m(this,_a,!1);m(this,ve,null);m(this,Ca,null);f(this,Kt,t),f(this,Hc,s),f(this,en,a),f(this,tr,o),f(this,$c,l),f(this,Uc,e),f(this,ep,h),f(this,Vc,c),f(this,Ll,i),f(this,Ci,p),f(this,ve,i[0]),f(this,Sa,xy.toDateObject(r)),this.trigger=i.flatMap(b=>b.getElementsToTriggerPopup()),p||(g(this,st,cm).call(this),n(this,Kt).hidden=!0,u&&g(this,st,um).call(this))}renderCommentButton(){if(n(this,qt)){n(this,qt).parentNode||n(this,ve).container.after(n(this,qt));return}if(n(this,Jn)||g(this,st,Tw).call(this),!n(this,Jn))return;const{signal:t}=f(this,Qn,new AbortController),e=n(this,ve).hasOwnCommentButton,i=()=>{n(this,Ci).toggleCommentPopup(this,!0,void 0,!e)},s=()=>{n(this,Ci).toggleCommentPopup(this,!1,!0,!e)},r=()=>{n(this,Ci).toggleCommentPopup(this,!1,!1)};if(e){f(this,qt,n(this,ve).container);for(const a of this.trigger)a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.addEventListener("keydown",n(this,Ea),{signal:t}),a.addEventListener("click",i,{signal:t}),a.addEventListener("pointerenter",s,{signal:t}),a.addEventListener("pointerleave",r,{signal:t}),a.classList.add("popupTriggerArea")}else{const a=f(this,qt,document.createElement("button"));a.className="annotationCommentButton";const o=n(this,ve).container;a.style.zIndex=parseInt(o.style.zIndex,10)+1,a.tabIndex=0,a.ariaHasPopup="dialog",a.ariaControls="commentPopup",a.setAttribute("data-l10n-id","pdfjs-show-comment-button"),g(this,st,Mw).call(this),g(this,st,kw).call(this),a.addEventListener("keydown",n(this,Ea),{signal:t}),a.addEventListener("click",i,{signal:t}),a.addEventListener("pointerenter",s,{signal:t}),a.addEventListener("pointerleave",r,{signal:t}),o.after(a)}}get commentButtonColor(){const{color:t,opacity:e}=n(this,ve).commentData;return t?n(this,$c)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;(t=n(this,qt))==null||t.focus()},0)}getData(){const{richText:t,color:e,opacity:i,creationDate:s,modificationDate:r}=n(this,ve).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:s,modificationDate:r}}get elementBeforePopup(){return n(this,qt)}get comment(){return n(this,Ca)||f(this,Ca,n(this,ve).commentText),n(this,Ca)}set comment(t){t!==this.comment&&(n(this,ve).commentText=f(this,Ca,t))}focus(){var t;(t=n(this,ve).container)==null||t.focus()}get parentBoundingClientRect(){return n(this,ve).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){n(this,qt)&&(n(this,qt).classList.toggle("selected",t),n(this,qt).ariaExpanded=e)}setSelectedCommentButton(t){n(this,qt).classList.toggle("selected",t)}get commentPopupPosition(){if(n(this,xa))return n(this,xa);const{x:t,y:e,height:i}=n(this,qt).getBoundingClientRect(),{x:s,y:r,width:a,height:o}=n(this,ve).layer.getBoundingClientRect();return[(t-s)/a,(e+i-r)/o]}set commentPopupPosition(t){f(this,xa,t)}hasDefaultPopupPosition(){return n(this,xa)===null}get commentButtonPosition(){return n(this,Jn)}get commentButtonWidth(){return n(this,qt).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,i]=n(this,xa)||this.commentButtonPosition.map(h=>h/100),s=this.parentBoundingClientRect,{x:r,y:a,width:o,height:l}=s;n(this,Ci).showDialog(null,this,r+e*o,a+i*l,{...t,parentDimensions:s})}render(){var i,s;if(n(this,Pi))return;const t=f(this,Pi,document.createElement("div"));if(t.className="popup",n(this,Uc)){const r=t.style.outlineColor=N.makeHexColor(...n(this,Uc));t.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`}const e=document.createElement("span");if(e.className="header",(i=n(this,Hc))!=null&&i.str){const r=document.createElement("span");r.className="title",e.append(r),{dir:r.dir,str:r.textContent}=n(this,Hc)}if(t.append(e),n(this,Sa)){const r=document.createElement("time");r.className="popupDate",r.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),r.setAttribute("data-l10n-args",JSON.stringify({dateObj:n(this,Sa).valueOf()})),r.dateTime=n(this,Sa).toISOString(),e.append(r)}WE({html:n(this,st,dm)||n(this,en).str,dir:(s=n(this,en))==null?void 0:s.dir,className:"popupContent"},t),n(this,Kt).append(t)}updateEdited({rect:t,popup:e,deleted:i}){var s;if(n(this,Ci)){i?(this.remove(),f(this,Ca,null)):e&&(e.deleted?this.remove():(g(this,st,Mw).call(this),f(this,Ca,e.text))),t&&(f(this,Jn,null),g(this,st,Tw).call(this),g(this,st,kw).call(this));return}if(i||e!=null&&e.deleted){this.remove();return}g(this,st,cm).call(this),n(this,Rl)||f(this,Rl,{contentsObj:n(this,en),richText:n(this,tr)}),t&&f(this,Zn,null),e&&e.text&&(f(this,tr,g(this,st,wS).call(this,e.text)),f(this,Sa,xy.toDateObject(e.date)),f(this,en,null)),(s=n(this,Pi))==null||s.remove(),f(this,Pi,null)}resetEdited(){var t;n(this,Rl)&&({contentsObj:kt(this,en)._,richText:kt(this,tr)._}=n(this,Rl),f(this,Rl,null),(t=n(this,Pi))==null||t.remove(),f(this,Pi,null),f(this,Zn,null))}remove(){var t,e,i;if((t=n(this,Qn))==null||t.abort(),f(this,Qn,null),(e=n(this,Pi))==null||e.remove(),f(this,Pi,null),f(this,_a,!1),f(this,sn,!1),(i=n(this,qt))==null||i.remove(),f(this,qt,null),this.trigger)for(const s of this.trigger)s.classList.remove("popupTriggerArea")}forceHide(){f(this,_a,this.isVisible),n(this,_a)&&(n(this,Kt).hidden=!0)}maybeShow(){n(this,Ci)||(g(this,st,cm).call(this),n(this,_a)&&(n(this,Pi)||g(this,st,fm).call(this),f(this,_a,!1),n(this,Kt).hidden=!1))}get isVisible(){return!n(this,Ci)&&n(this,Kt).hidden===!1}}Ci=new WeakMap,Ea=new WeakMap,yb=new WeakMap,wb=new WeakMap,jc=new WeakMap,Uc=new WeakMap,Kt=ne
46w WeakMap,en=new WeakMap,Sa=new WeakMap,Ll=new WeakMap,$c=new WeakMap,Vc=new WeakMap,sn=new WeakMap,Pi=new WeakMap,Qn=new WeakMap,Zn=new WeakMap,qt=new WeakMap,Jn=new WeakMap,xa=new WeakMap,ep=new WeakMap,tr=new WeakMap,Hc=new WeakMap,Rl=new WeakMap,_a=new WeakMap,ve=new WeakMap,Ca=new WeakMap,st=new WeakSet,cm=function(){var e;if(n(this,Qn))return;f(this,Qn,new AbortController);const{signal:t}=n(this,Qn);for(const i of this.trigger)i.addEventListener("click",n(this,jc),{signal:t}),i.addEventListener("pointerenter",n(this,wb),{signal:t}),i.addEventListener("pointerleave",n(this,yb),{signal:t}),i.classList.add("popupTriggerArea");for(const i of n(this,Ll))(e=i.container)==null||e.addEventListener("keydown",n(this,Ea),{signal:t})},Tw=function(){const t=n(this,Ll).find(e=>e.hasCommentButton);t&&f(this,Jn,t._normalizePoint(t.commentButtonPosition))},kw=function(){if(n(this,ve).extraPopupElement&&!n(this,ve).editor)return;n(this,qt)||this.renderCommentButton();const[t,e]=n(this,Jn),{style:i}=n(this,qt);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},Mw=function(){n(this,ve).extraPopupElement||(n(this,qt)||this.renderCommentButton(),n(this,qt).style.backgroundColor=this.commentButtonColor||"")},dm=function(){const t=n(this,tr),e=n(this,en);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&n(this,tr).html||null},Iw=function(){var t,e,i;return((i=(e=(t=n(this,st,dm))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.fontSize)||0},yS=function(){var t,e,i;return((i=(e=(t=n(this,st,dm))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.color)||null},wS=function(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:n(this,st,yS),fontSize:n(this,st,Iw)?`calc(${n(this,st,Iw)}px * var(--total-scale-factor))`:""}};for(const r of t.split(` 47`))e.push({name:"span",value:r,attributes:s});return i},vS=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&n(this,sn))&&g(this,st,um).call(this)},AS=function(){if(n(this,Zn)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:r}}}=n(this,$c);let a=!!n(this,Vc),o=a?n(this,Vc):n(this,ep);for(const y of n(this,Ll))if(!o||N.intersect(y.data.rect,o)!==null){o=y.data.rect,a=!0;break}const l=N.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),c=a?o[2]-o[0]+5:0,u=l[0]+c,p=l[1];f(this,Zn,[100*(u-s)/e,100*(p-r)/i]);const{style:b}=n(this,Kt);b.left=`${n(this,Zn)[0]}%`,b.top=`${n(this,Zn)[1]}%`},um=function(){if(n(this,Ci)){n(this,Ci).toggleCommentPopup(this,!1);return}f(this,sn,!n(this,sn)),n(this,sn)?(g(this,st,fm).call(this),n(this,Kt).addEventListener("click",n(this,jc)),n(this,Kt).addEventListener("keydown",n(this,Ea))):(g(this,st,Dw).call(this),n(this,Kt).removeEventListener("click",n(this,jc)),n(this,Kt).removeEventListener("keydown",n(this,Ea)))},fm=function(){n(this,Pi)||this.render(),this.isVisible?n(this,sn)&&n(this,Kt).classList.add("focused"):(g(this,st,AS).call(this),n(this,Kt).hidden=!1,n(this,Kt).style.zIndex=parseInt(n(this,Kt).style.zIndex,10)+1e3)},Dw=function(){n(this,Kt).classList.remove("focused"),!(n(this,sn)||!this.isVisible)&&(n(this,Kt).hidden=!0,n(this,Kt).style.zIndex=parseInt(n(this,Kt).style.zIndex,10)-1e3)};class ES extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Z.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var ip;class TP extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,ip,null)}render(){this.container.classList.add("lineAnnotation");const{data:e,width:i,height:s}=this,r=this.svgFactory.create(i,s,!0),a=f(this,ip,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.re
47ct[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,ip)}addHighlightArea(){this.container.classList.add("highlightArea")}}ip=new WeakMap;var sp;class kP extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,sp,null)}render(){this.container.classList.add("squareAnnotation");const{data:e,width:i,height:s}=this,r=this.svgFactory.create(i,s,!0),a=e.borderStyle.width,o=f(this,sp,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",i-a),o.setAttribute("height",s-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,sp)}addHighlightArea(){this.container.classList.add("highlightArea")}}sp=new WeakMap;var np;class MP extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,np,null)}render(){this.container.classList.add("circleAnnotation");const{data:e,width:i,height:s}=this,r=this.svgFactory.create(i,s,!0),a=e.borderStyle.width,o=f(this,np,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",i/2),o.setAttribute("cy",s/2),o.setAttribute("rx",i/2-a/2),o.setAttribute("ry",s/2-a/2),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,np)}addHighlightArea(){this.container.classList.add("highlightArea")}}np=new WeakMap;var rp;class SS extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,rp,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:i,borderStyle:s,popupRef:r},width:a,height:o}=this;if(!i)return this.container;const l=this.svgFactory.create(a,o,!0);let h=[];for(let u=0,p=i.length;u<p;u+=2){const b=i[u]-e[0],y=e[3]-i[u+1];h.push(`${b},${y}`)}h=h.join(" ");const c=f(this,rp,this.svgFactory.createElement(this.svgElementName));return c.setAttribute("points",h),c.setAttribute("stroke-width",s.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),l.append(c),this.container.append(l),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,rp)}addHighlightArea(){this.container.classList.add("highlightArea")}}rp=new WeakMap;class IP extends SS{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class DP extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}var ap,Nl,op,Lw;class cA extends jt{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});m(this,op);m(this,ap,null);m(this,Nl,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Z.HIGHLIGHT:Z.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:i,inkLists:s,borderStyle:r,popupRef:a}}=this,{transform:o,width:l,height:h}=g(this,op,Lw).call(this,i,e),c=this.svgFactory.create(l,h,!0),u=f(this,ap,this.svgFactory.createElement("svg:g"));c.append(u),u.setAttribute("stroke-width",r.width||1),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round"),u.setAttribute("stroke-miterlimit",10),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),u.setAttribute("transform",o);for(const p of s){const b=this.svgFactory.createElement(this.svgElementName);n(this,Nl).push(b),b.setAttribute("points",p.join(",")),u.append(b)}return!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:i,points:s,rect:r}=e,a=n(this,ap);if(i>=0&&a.setAttribute("stroke-width",i||1),s)for(let o=0,l=n(this,Nl).length;o<l;o++)n(this,Nl)[o].setAttribute("points",s[o].join(","));if(r){const{transform:o,width:l,height:h}=g(this,op,Lw).call(this,this.data.rotation,r);a.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),a.setAttribute("transform",o)}}getElementsToTriggerPopup(){return n(this,Nl)}addHighlightArea(){this.container.classList.add("highlightArea")}}ap=new WeakMap,Nl=new WeakMap,op=new WeakSet,Lw=function(e,i){switch(e){case 90:return{transform:`rotate(90) translate(${-i[0]},${i[1]}) scale(1,-1)`,width:i[3]-i[1],height:i[2]-i[0]};case 180:return{transform:`rotate(180) translate(${-i[2]},${i[1]}) scale(1,-1)`,width:i[2]-i[0],height:i[3]-i[1]};case 270:return{transform:`rotate(270) translate(${-i[2]},${i[3]}) scale(1,-1)`,width:i[3]-i[1],height:i[2]-i[0]};default:return{transform:`translate(${-i[0]},${i[3]}) scale(1,-1)`,width:i[2]-i[0],height:i[3]-i[1]}}};class xS extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Z.HIGHLIGHT}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){const i=document.createElement("mark");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}
47class LP extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){const i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class RP extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){const i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class NP extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){const{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){const i=document.createElement("s");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}}class _S extends jt{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Z.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var lp,hp,Rw;class FP extends jt{constructor(e){var r;super(e,{isRenderable:!0});m(this,hp);m(this,lp,null);const{fileId:i,file:s}=this.data;this.filename=s.filename,this.content=s.content,this.fileId=i,(r=this.linkService.eventBus)==null||r.dispatch("fileattachmentannotation",{source:this,attachmentId:this.fileId,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:i}=this;let s;i.hasAppearance||i.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(i.fillAlpha*100)}%);`)),s.addEventListener("dblclick",g(this,hp,Rw).bind(this)),f(this,lp,s);const{isMac:r}=xt.platform;return e.addEventListener("keydown",a=>{a.key==="Enter"&&(r?a.metaKey:a.ctrlKey)&&g(this,hp,Rw).call(this)}),!i.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):s.classList.add("popupTriggerArea"),e.append(s),e}getElementsToTriggerPopup(){return n(this,lp)}addHighlightArea(){this.container.classList.add("highlightArea")}}lp=new WeakMap,hp=new WeakSet,Rw=async function(){var a;const{fileId:e,filename:i,content:s}=this,r=await this.linkService.getAttachmentContent(e)||s;r&&((a=this.downloadManager)==null||a.openOrDownloadData(r,i))};var zc,Fl,er,Ah,PS,Nw;class CS extends jt{constructor(e){super(e,{isRenderable:!!e.data.richMedia});m(this,Ah);m(this,zc,new AbortController);m(this,Fl,null);m(this,er,null)}render(){this.container.classList.add("mediaAnnotation");const{filename:e}=this.data.richMedia,i=document.createElement("button");return i.className="mediaPlayButton",i.type="button",i.title=i.ariaLabel=e,i.addEventListener("click",()=>g(this,Ah,PS).call(this,i),{signal:n(this,zc).signal}),this.container.append(i),this.container}destroy(){n(this,zc).abort(),n(this,er)&&(n(this,er).pause(),n(this,er).removeAttribute("src"),n(this,er).load(),f(this,er,null)),g(this,Ah,Nw).call(this)}}zc=new WeakMap,Fl=new WeakMap,er=new WeakMap,Ah=new WeakSet,PS=async function(e){const{fileId:i,filename:s,contentType:r}=this.data.richMedia;e.disabled=!0;let a;try{a=await this.linkService.getAttachmentContent(i)}catch{return}finally{e.disabled=!1}if(!a||!e.isConnected)return;const{signal:o}=n(this,zc),l=URL.createObjectURL(new Blob([a],{type:r}));f(this,Fl,l);const h=r.startsWith("audio/"),c=document.createElement(h?"audio":"video");
47if(f(this,er,c),c.className="mediaContent",this._setBackgroundColor(c),c.src=l,c.title=s,c.controls=!0,c.autoplay=!0,c.tabIndex=0,h){let u=!1,p=!1;const b=()=>{c.controls=u||p};this.container.addEventListener("pointerenter",()=>{u=!0,b()},{signal:o}),this.container.addEventListener("pointerleave",()=>{u=!1,b()},{signal:o}),this.container.addEventListener("focusin",()=>{p=!0,b()},{signal:o}),this.container.addEventListener("focusout",()=>{p=!1,b()},{signal:o})}c.addEventListener("emptied",()=>g(this,Ah,Nw).call(this,l),{once:!0,signal:o}),e.replaceWith(c),c.play().catch(()=>{})},Nw=function(e=n(this,Fl)){e&&e===n(this,Fl)&&(URL.revokeObjectURL(e),f(this,Fl,null))};var Pa,Ol,Wc,ir,Gc,Bl,$e,cp,vn,pm,gm,Xc;let TS=(Xc=class{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:r,viewport:a,structTreeLayer:o,commentManager:l,linkService:h,annotationStorage:c}){m(this,vn);m(this,Pa,null);m(this,Ol,null);m(this,Wc,null);m(this,ir,new Map);m(this,Gc,null);m(this,Bl,null);m(this,$e,[]);m(this,cp,!1);T(this,"zIndex",0);this.div=t,f(this,Pa,e),f(this,Ol,i),f(this,Gc,o||null),f(this,Bl,h||null),f(this,Wc,c||new oA),this.page=r,this.viewport=a,this._annotationEditorUIManager=s,this._commentManager=l||null}hasEditableAnnotations(){return n(this,ir).size>0}async render(t){var l;const{annotations:e,optionalContentConfig:i}=t,s=this.div;yh(s,this.viewport);const r=new Map,a=[],o={data:null,layer:s,linkService:n(this,Bl),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Km,annotationStorage:n(this,Wc),enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const h of e){if(h.noHTML)continue;const c=h.annotationType===Vt.POPUP;if(c){const b=r.get(h.id);if(!b)continue;if(!this._commentManager){a.push(h);continue}o.elements=b}else if(h.rect[2]===h.rect[0]||h.rect[3]===h.rect[1])continue;o.data=h;const u=oy.create(o);if(!u.isRenderable)continue;c||(n(this,$e).push(u),h.popupRef&&r.getOrInsertComputed(h.popupRef,Zd).push(u));const p=u.render();h.hidden&&(p.style.visibility="hidden"),u.updateOC(i),u._isEditable&&(n(this,ir).set(u.data.id,u),(l=this._annotationEditorUIManager)==null||l.renderAnnotationElement(u))}await g(this,vn,pm).call(this);for(const h of a){const c=o.elements=r.get(h.id);o.data=h;const u=oy.create(o);if(!u.isRenderable)continue;const p=u.render();u.contentElement.id=`${Fh}${h.id}`,h.hidden&&(p.style.visibility="hidden"),c.at(-1).container.after(p)}g(this,vn,gm).call(this)}async addLinkAnnotations(t){const e={data:null,layer:this.div,linkService:n(this,Bl),svgFactory:new Km,parent:this};for(const i of t){i.borderStyle||(i.borderStyle=Xc._defaultBorderStyle),e.data=i;const s=oy.create(e);s.isRenderable&&(s.render(),s.contentElement.id=`${Fh}${i.id}`,n(this,$e).push(s))}await g(this,vn,pm).call(this)}update({viewport:t,optionalContentConfig:e}){const i=this.div;this.viewport=t,yh(i,{rotation:t.rotation});for(const s of n(this,$e))s.updateOC(e);g(this,vn,gm).call(this),i.hidden=!1}destroy(){var t,e;for(const i of n(this,$e))(t=i.destroy)==null||t.call(i),(e=n(this,Pa))==null||e.removePointerInTextLayer(i.contentElement);n(this,$e).length=0,n(this,ir).clear(),this.div.replaceChildren()}refreshCanvases(){g(this,vn,gm).call(this)}getEditableAnnotations(){return n(this,ir).values()}getEditableAnnotation(t){return n(this,ir).get(t)}addFakeAnnotation(t){const{div:e}=this,{id:i,rotation:s}=t,r=new wP({data:{id:i,rect:t.getPDFRect(),rotation:s},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:n(this,Bl),annotationStorage:n(this,Wc)});return r.render(),r.contentElement.id=`${Fh}${i}`,r.createOrUpdatePopup(),n(this,$e).push(r),r}removeAnnotation(t){var s;const e=n(this,$e).findIndex(r=>r.data.id===t);if(e<0)return;const[i]=n(this,$e).splice(e,1);(s=n(this,Pa))==null||s.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(const e of t)e.updateFakeAnnotationElement(this);g(this,vn,pm).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return Y(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Th.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Pa=new WeakMap,Ol=new WeakMap,Wc=new WeakMap,ir=new WeakMap,Gc=new WeakMap,Bl=new WeakMap,$e=new WeakMap,cp=new WeakMap,vn=new WeakSet,pm=async function(){var i,s,r,a;if(n(this,$e).length===0)return;this.div.replaceChildren();const t=[];if(!n(this,cp)){f(this,cp,!0);for(const{contentElement:o,data:{hidden:l,id:h,oc:c}}of n(this,$e)){const u=o.id=`${Fh}${h}`,p=o.localName==="a"&&!l&&!c;t.push((i=n(this,Gc))==null?void 0:i.getAriaAttributes(u,{enableLinkOwnership:p}).then(b=>{if(b)for(const[y,w]of b)o.setAttribute(y,w)}))}}n(this,$e).sort(({data:{rect:[o,l,h,c]}},{data:{rect:[u,p,b,y]}})=>{if(o===h&&l===c)return 1;if(u===b&&p===y)return-1;
47const w=c,v=l,A=(l+c)/2,E=y,S=p,x=(p+y)/2;if(A>=E&&x<=v)return-1;if(x>=w&&A<=S)return 1;const _=(o+h)/2,C=(u+b)/2;return _-C});const e=document.createDocumentFragment();for(const o of n(this,$e))e.append(o.container),this._commentManager?(r=((s=o.extraPopupElement)==null?void 0:s.popup)||o.popup)==null||r.renderCommentButton():o.extraPopupElement&&e.append(o.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),n(this,Pa)){const o=await((a=n(this,Gc))==null?void 0:a.getAnnotationIds());for(const{contentElement:l}of n(this,$e))o!=null&&o.has(l.id)||n(this,Pa).addPointerInTextLayer(l,!1)}},gm=function(){var e;if(!n(this,Ol))return;const t=this.div;for(const[i,s]of n(this,Ol)){const r=t.querySelector(`[data-annotation-id="${i}"]`);if(!r)continue;if(Array.isArray(s))for(const c of s)c.className="annotationContent",c.ariaHidden=!0;else s.className="annotationContent",s.ariaHidden=!0;const a=[];for(const c of r.children)c.nodeName==="CANVAS"&&a.push(c);for(const c of a)c.remove();const o=Array.isArray(s)?s[0]:s,{firstChild:l}=r;if(l?l.classList.contains("annotationContent")?l.after(o):l.before(o):r.append(o),Array.isArray(s)){let c=o;for(let u=1,p=s.length;u<p;u++)c.after(s[u]),c=s[u]}n(this,Ol).delete(i);const h=n(this,ir).get(i);h&&(h._hasNoCanvas?((e=this._annotationEditorUIManager)==null||e.setMissingCanvas(i,r.id,s),h._hasNoCanvas=!1):h.canvas=s)}},Xc);const Ng=/\r\n?|\n/g;var Ti,dp,jl,ki,le,kS,MS,IS,mm,Tr,bm,ym,DS,Ow,LS;const Dt=class Dt extends Ct{constructor(e){super({...e,name:"freeTextEditor"});m(this,le);m(this,Ti,"");m(this,dp,`${this.id}-editor`);m(this,jl,null);m(this,ki);T(this,"_colorPicker",null);this.color=e.color||Dt._defaultColor||Ct._defaultLineColor,f(this,ki,e.fontSize||Dt._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert(Ct._l10nAlert.freetext),this.canAddComment=!1}static get _keyboardManager(){const e=Dt.prototype,i=a=>a.isEmpty(),s=ju.TRANSLATE_SMALL,r=ju.TRANSLATE_BIG;return Y(this,"_keyboardManager",new wh([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter"],e.commitOrRemove],[["Escape"],e.commitOrRemove],[["ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:i}],[["ArrowRight"],e._translateEmpty,{args:[s,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:i}],[["ArrowUp"],e._translateEmpty,{args:[0,-s],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:i}],[["ArrowDown"],e._translateEmpty,{args:[0,s],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:i}]]))}static initialize(e,i){Ct.initialize(e,i);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case ot.FREETEXT_SIZE:Dt._defaultFontSize=i;break;case ot.FREETEXT_COLOR:Dt._defaultColor=i;break}}updateParams(e,i){switch(e){case ot.FREETEXT_SIZE:g(this,le,kS).call(this,i);break;case ot.FREETEXT_COLOR:g(this,le,MS).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[ot.FREETEXT_SIZE,Dt._defaultFontSize],[ot.FREETEXT_COLOR,Dt._defaultColor||Ct._defaultLineColor]]}get propertiesToUpdate(){return[[ot.FREETEXT_SIZE,n(this,ki)],[ot.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Ym(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ot.FREETEXT_COLOR}onUpdatedColor(){var e;this.editorDiv.style.color=this.color,(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}_translateEmpty(e,i){this._uiManager.translateSelectedEditors(e,i,!0)}getInitialTranslation(){const e=this.parentScale;return[-Dt._internalPadding*e,-(Dt._internalPadding+n(this,ki))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),f(this,jl,new AbortController);const e=this._uiManager.combinedSignal(n(this,jl));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){var e;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",n(this,dp)),this._isDraggable=!0,(e=n(this,jl))==null||e.abort(),f(this,jl,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){var i;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(i=this._initialOptions)!=null&&i.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 e=n(this,Ti),i=f(this,Ti,g(this,le,IS).call(this).trimEnd());if(e===i)return;const s=r=>{if(f(this,Ti,r),!r){this.remove();return}
47g(this,le,ym).call(this),this._uiManager.rebuild(this),g(this,le,mm).call(this)};this.addCommands({cmd:()=>{s(i)},undo:()=>{s(e)},mustExec:!1}),g(this,le,mm).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Dt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,i;(this._isCopy||this.annotationElementId)&&(e=this.x,i=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",n(this,dp)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:s}=this.editorDiv;if(s.fontSize=`calc(${n(this,ki)}px * var(--total-scale-factor))`,s.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){const[r,a]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[c,u]=this.pageDimensions,[p,b]=this.pageTranslation;let y,w;switch(this.rotation){case 0:y=e+(o[0]-p)/c,w=i+this.height-(o[1]-b)/u;break;case 90:y=e+(o[0]-p)/c,w=i-(o[1]-b)/u,[l,h]=[h,-l];break;case 180:y=e-this.width+(o[0]-p)/c,w=i-(o[1]-b)/u,[l,h]=[-l,-h];break;case 270:y=e+(o[0]-p-this.height*u)/c,w=i+(o[1]-b-this.width*c)/u,[l,h]=[-h,l];break}this.setAt(y*r,w*a,l,h)}else this._moveAfterPaste(e,i);g(this,le,ym).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,w,v;const i=e.clipboardData||window.clipboardData,{types:s}=i;if(s.length===1&&s[0]==="text/plain")return;e.preventDefault();const r=g(y=Dt,Tr,Ow).call(y,i.getData("text")||"").replaceAll(Ng,` 48`);if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!r.includes(` 49`)){o.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,c=[],u=[];if(l.nodeType===Node.TEXT_NODE){const A=l.parentElement;if(u.push(l.nodeValue.slice(h).replaceAll(Ng,"")),A!==this.editorDiv){let E=c;for(const S of this.editorDiv.childNodes){if(S===A){E=u;continue}E.push(g(w=Dt,Tr,bm).call(w,S))}}c.push(l.nodeValue.slice(0,h).replaceAll(Ng,""))}else if(l===this.editorDiv){let A=c,E=0;for(const S of this.editorDiv.childNodes)E++===h&&(A=u),A.push(g(v=Dt,Tr,bm).call(v,S))}f(this,Ti,`${c.join(` 50`)}${r}${u.join(` 51`)}`),g(this,le,ym).call(this);const p=new Range;let b=Math.sumPrecise(c.map(A=>A.length));for(const{firstChild:A}of this.editorDiv.childNodes)if(A.nodeType===Node.TEXT_NODE){const E=A.nodeValue.length;if(b<=E){p.setStart(A,b),p.setEnd(A,b);break}b-=E}a.removeAllRanges(),a.addRange(p)}get contentDiv(){return this.editorDiv}getPDFRect(){const e=Dt._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,s){var o;let r=null;if(e instanceof ES){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:u,id:p,popupRef:b,richText:y,contentsObj:w,creationDate:v,modificationDate:A},textContent:E,textPosition:S,parent:{page:{pageNumber:x}}}=e;if(!(E!=null&&E.length))return null;r=e={annotationType:Z.FREETEXT,color:Array.from(h),fontSize:l,value:E.join(` 52`),position:S,pageIndex:x-1,rect:c.slice(0),rotation:u,annotationElementId:p,id:p,deleted:!1,popupRef:b,comment:(w==null?void 0:w.str)||null,richText:y,creationDate:v,modificationDate:A}}const a=await super.deserialize(e,i,s);return f(a,ki,e.fontSize),a.color=N.makeHexColor(...e.color),f(a,Ti,g(o=Dt,Tr,Ow).call(o,e.value)),a._initialData=r,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=Ct._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),s=Object.assign(super.serialize(e),{color:i,fontSize:n(this,ki),value:g(this,le,DS).call(this)});return this.addComment(s),e?(s.isCopy=!0,s):this.annotationElementId&&!g(this,le,LS).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(e){const i=super.renderAnnotationElement(e);
52if(!i)return null;const{style:s}=i;s.fontSize=`calc(${n(this,ki)}px * var(--total-scale-factor))`,s.color=this.color,i.replaceChildren();for(const r of n(this,Ti).split(` 53`)){const a=document.createElement("div");a.append(r?document.createTextNode(r):document.createElement("br")),i.append(a)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:n(this,Ti)}}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Ti=new WeakMap,dp=new WeakMap,jl=new WeakMap,ki=new WeakMap,le=new WeakSet,kS=function(e){const i=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--total-scale-factor))`,this.translate(0,-(r-n(this,ki))*this.parentScale),f(this,ki,r),g(this,le,mm).call(this)},s=n(this,ki);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ot.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},MS=function(e){const i=r=>{this.color=r,this.onUpdatedColor()},s=this.color;this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ot.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},IS=function(){var s;const e=[];this.editorDiv.normalize();let i=null;for(const r of this.editorDiv.childNodes)(i==null?void 0:i.nodeType)===Node.TEXT_NODE&&r.nodeName==="BR"||(e.push(g(s=Dt,Tr,bm).call(s,r)),i=r);return e.join(` 54`)},mm=function(){const[e,i]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:r,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",r.div.append(this.div),s=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=s.width/e,this.height=s.height/i):(this.width=s.height/e,this.height=s.width/i),this.fixAndSetPosition()},Tr=new WeakSet,bm=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Ng,"")},ym=function(){if(this.editorDiv.replaceChildren(),!!n(this,Ti))for(const e of n(this,Ti).split(` 55`)){const i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},DS=function(){return n(this,Ti).replaceAll("Â "," ")},Ow=function(e){return e.replaceAll(" ","Â ")},LS=function(e){const{value:i,fontSize:s,color:r,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==i||e.fontSize!==s||e.color.some((o,l)=>o!==r[l])||e.pageIndex!==a},m(Dt,Tr),T(Dt,"_freeTextDefaultContent",""),T(Dt,"_internalPadding",0),T(Dt,"_defaultColor",null),T(Dt,"_defaultFontSize",10),T(Dt,"_type","freetext"),T(Dt,"_editorType",Z.FREETEXT);let Fw=Dt;var Ul;class dA{constructor(){m(this,Ul,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){n(this,Ul)[t]=e}toSVGProperties(){const t=n(this,Ul);return f(this,Ul,Object.create(null)),{root:t}}reset(){f(this,Ul,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){lt("Not implemented")}}Ul=new WeakMap;var Yc,Kc,ie,$l,Vl,qc,q,Bw,jw,Uw,$w,Eu,Vw,Hw,zw,Su,RS,wm,xu,Dh;const tt=class tt extends Ct{constructor(e){super(e);m(this,q);m(this,Yc,null);m(this,Kc);T(this,"_clipPathId",null);T(this,"_colorPicker",null);T(this,"_drawId",null);T(this,"_drawOutlines",null);T(this,"_focusDrawId",null);f(this,Kc,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){var e;(e=this._colorPicker)==null||e.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var e,i;(i=(e=this._colorPicker)==null?void 0:e.updateOpacity)==null||i.call(e,this.opacity)}_addOutlines(e){e.drawOutlines&&(g(this,q,Bw).call(this,e),g(this,q,Su).call(this))}static _mergeSVGProperties(e,i){const s=new Set(Object.keys(e));for(const[r,a]of Object.entries(i))s.has(r)?Object.assign(e[r],a):e[r]=a;return e}static getDefaultDrawingOptions(e){lt("Not implemented")}static get typesMap(){lt("Not implemented")}static get isDrawer(){return!0}static get _hasClipPath(){return!1}static get _hasDrawClass(){return!0}static get supportMultipleDrawings(){return!1}get _drawRotation(){return this.rotation}get _opacityName(){return this.constructor.typesMap.get(this.opacityType)}static updateDefaultParams(e,i){const s=this.typesMap.get(e);s&&this._defaultDrawingOptions.updateProperty(s,i),this._currentParent&&(n(tt,ie).updateProperty(s,i),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,i){const s=this.constructor.typesMap.get(e);s&&this._updateProperty(e,s,i)}static get defaultPropertiesToUpdate(){const e=[],i=this._defaultDrawingOptions;for(const[s,r]of this.typesMap)e.push([s,i[r]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:i}=this;for(const[s,r]of this.constructor.typesMap)e.push([s,i[r]]);return e}_updateProperty(e,i,s){const r=this._drawingOptions,a=r[i],o=l=>{var c;r.updateProperty(i,l);const h=this._drawOutlines.updateProperty(i,l);h&&g(this,q,xu).call(this,h),(c=this.parent)==null||c.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),e===this.colorType?this.onUpdatedColor():e===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,s),undo:o.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(e,i,s=this.colorAndOpacityType){const r=this.constructor.typesMap.get(this.colorType),a=this._opacityName,o=this._drawingOptions,l=o[r],h=o[a],c=(u,p)=>{var b;o.updateProperty(r,u),o.updateProperty(a,p),this._drawOutlines.updateProperty(r,u),this._drawOutlines.updateProperty(a,p),(b=this.parent)==null||b.drawLayer.updateProperties(this._drawId,o.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:c.bind(this,e,i),undo:c.bind(this,l,h),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,tt._mergeSVGProperties(this._drawOutlines.getPathResizingSVGProperties(g(this,q,wm).call(this)),{bbox:g(this,q,Dh).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,tt._mergeSVGProperties(this._drawOutlines.getPathResizedSVGProperties(g(this,q,wm).call(this)),{bbox:g(this,q,Dh).call(this)})),g(this,q,$w).call(this)}_onTranslating(e,i){var s;(s=this.parent)==null||s.drawLayer.updateProperties(this._drawId,{bbox:g(this,q,Dh).call(this)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,tt._mergeSVGProperties(this._drawOutlines.getPathTranslatedSVGProperties(g(this,q,wm).call(this),this.parentDimensions),{bbox:g(this,q,Dh).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}get _mustBeDisabledOnCommit(){return!0}commit(){super.commit(),this._mustBeDisabledOnCommit&&(this.disableEditMode(),this.disableEditing())}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,n(this,Kc)&&(f(this,Kc,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){this._uiManager.removeShouldRescale(this),g(this,q,zw).c
55all(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(g(this,q,Su).call(this),g(this,q,xu).call(this,this._drawOutlines.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var s;let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),g(this,q,zw).call(this)):e&&(this._uiManager.addShouldRescale(this),g(this,q,Su).call(this,e),i=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(e),g(this,q,Vw).call(this),i&&this.select()}rotate(e=this.parentRotation){if(!this.parent||this._drawId===null)return;const i=(e-this._drawRotation+360)%360;this.parent.drawLayer.updateProperties(this._drawId,tt._mergeSVGProperties({bbox:g(this,q,Dh).call(this,e)},this._drawOutlines.updateRotation(i))),g(this,q,$w).call(this,i)}show(e=this._isVisible){super.show(e),g(this,q,Vw).call(this)}select(){super.select(),g(this,q,Eu).call(this,{hovered:!1,selected:!0})}unselect(){super.unselect(),g(this,q,Eu).call(this,{selected:!1})}pointerover(){this.isSelected||g(this,q,Eu).call(this,{hovered:!0})}pointerleave(){this.isSelected||g(this,q,Eu).call(this,{hovered:!1})}onScaleChanging(){if(!this.parent)return;const e=this._drawOutlines.updateParentDimensions(this.parentDimensions,this.parent.scale);e&&g(this,q,xu).call(this,e)}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,i;this._isCopy&&(e=this.x,i=this.y);const s=super.render();this.constructor._hasDrawClass&&s.classList.add("draw");const r=f(this,Yc,document.createElement("div"));return s.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",this._clipPathId&&(r.style.clipPath=this._clipPathId),ZE(this,r,["pointerover","pointerleave"]),this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,i),s}static createDrawerInstance(e){lt("Not implemented")}static _getDrawingTarget(e,{target:i}){return i}static _getPointerCoords({offsetX:e,offsetY:i,clientX:s,clientY:r},a=null){if(!a)return[e,i];let o=s-a.clientX,l=r-a.clientY;switch(this._currentParent.viewport.rotation){case 90:[o,l]=[l,-o];break;case 180:[o,l]=[-o,-l];break;case 270:[o,l]=[-l,o];break}return[a.offsetX+o,a.offsetY+l]}static _addDrawingListeners(e,i){}static _endDrawingSession(e=!1){return this._currentParent.endDrawingSession(e)}static startDrawing(e,i,s,r){var x;const{pointerId:a,pointerType:o}=r;if(Oe.isInitializedAndDifferentPointerType(o))return;const l=this._getDrawingTarget(e,r),[h,c]=this._getPointerCoords(r),{viewport:{rotation:u}}=e,{x:p,y:b,width:y,height:w}=l.getBoundingClientRect(),v=f(tt,$l,new AbortController),A=e.combinedSignal(v);if(Oe.setPointer(o,a),window.addEventListener("pointerup",_=>{Oe.isSamePointerIdOrRemove(_.pointerId)&&this._endDraw(_)},{signal:A}),window.addEventListener("pointercancel",_=>{Oe.isSamePointerIdOrRemove(_.pointerId)&&this._endDrawingSession()},{signal:A}),window.addEventListener("pointerdown",_=>{Oe.isSamePointerType(_.pointerType)&&(Oe.initializeAndAddPointerId(_.pointerId),n(tt,ie).isCancellable()&&(n(tt,ie).removeLastElement(),n(tt,ie).isEmpty()?this._endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:A}),window.addEventListener("contextmenu",Is,{signal:A}),l.addEventListener("pointermove",this._drawMove.bind(this),{signal:A}),l.addEventListener("touchmove",_=>{Oe.isSameTimeStamp(_.timeStamp)&&fe(_)},{signal:A}),this._addDrawingListeners(l,A),e.toggleDrawing(),(x=i._editorUndoBar)==null||x.hide(),n(tt,ie)){e.drawLayer.updateProperties(this._currentDrawId,n(tt,ie).startNew(h,c,y,w,u));return}i.updateUIForDefaultProperties(this),f(tt,ie,this.createDrawerInstance({x:h,y:c,box:[p,b,y,w],rotation:u,parent:e,isLTR:s})),f(tt,Vl,this.getDefaultDrawingOptions()),this._currentParent=e;const{id:E,clipPathId:S}=e.drawLayer.draw(this._mergeSVGProperties(n(tt,Vl).toSVGProperties(),n(tt,ie).defaultSVGProperties),!0,this._hasClipPath);this._currentDrawId=E,f(tt,qc,this._hasClipPath?S:null)}static _drawMove(e){var r;if(Oe.isSameTimeStamp(e.timeStamp),!n(tt,ie)||!Oe.isSamePointerId(e.pointerId))return;if(Oe.isUsingMultiplePointers()){this._endDraw(e);return}let i;const s=(r=e.getCoalescedEvents)==null?void 0:r.call(e);
55if(s!=null&&s.length){const a=[];for(const o of s)a.push(...this._getPointerCoords(o,e));i=n(tt,ie).addPoints(a)}else i=n(tt,ie).add(...this._getPointerCoords(e));this._currentParent.drawLayer.updateProperties(this._currentDrawId,i),Oe.setTimeStamp(e.timeStamp),fe(e)}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,f(tt,ie,null),f(tt,Vl,null),f(tt,qc,null),Oe.clearTimeStamp()),n(tt,$l)&&(n(tt,$l).abort(),f(tt,$l,null),Oe.clearPointerIds())}static _endDraw(e){const i=this._currentParent;if(i){if(i.toggleDrawing(!0),this._cleanup(!1),i.drawLayer.updateProperties(this._currentDrawId,(e==null?void 0:e.target)===i.div?n(tt,ie).end(...this._getPointerCoords(e)):n(tt,ie).end()),this.supportMultipleDrawings){const s=n(tt,ie),r=this._currentDrawId,a=s.getLastElement();i.addCommands({cmd:()=>{i.drawLayer.updateProperties(r,s.setLastElement(a))},undo:()=>{i.drawLayer.updateProperties(r,s.removeLastElement())},mustExec:!1,type:ot.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){const i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(ot.DRAW_STEP),!n(tt,ie).isEmpty()){const{pageDimensions:[s,r],scale:a}=i,o=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,clipPathId:n(tt,qc),drawOutlines:n(tt,ie).getOutlines(s*a,r*a,a,this._INNER_MARGIN),drawingOptions:n(tt,Vl),mustBeCommitted:!e});return this._cleanup(!0),o}return i.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,i,s,r,a,o,l){lt("Not implemented")}static async deserialize(e,i,s){var u,p;const{rawDims:{pageWidth:r,pageHeight:a,pageX:o,pageY:l}}=i.viewport,h=this.deserializeDraw(o,l,r,a,this._INNER_MARGIN,e,s),c=await super.deserialize(e,i,s);return c.createDrawingOptions(e),g(u=c,q,Bw).call(u,{drawOutlines:h}),g(p=c,q,Su).call(p),c.onScaleChanging(),c.rotate(),c}serializeDraw(e){const[i,s]=this.pageTranslation,[r,a]=this.pageDimensions;return this._drawOutlines.serialize([i,s,r,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Yc=new WeakMap,Kc=new WeakMap,ie=new WeakMap,$l=new WeakMap,Vl=new WeakMap,qc=new WeakMap,q=new WeakSet,Bw=function({drawOutlines:e,drawId:i,drawingOptions:s,clipPathId:r}){this._drawOutlines=e,this._drawingOptions||(this._drawingOptions=s),this.annotationElementId||this._uiManager.a11yAlert(Ct._l10nAlert[this.editorType]),i>=0?(this._drawId=i,this._clipPathId=r??null,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties),g(this,q,Uw).call(this,this.parent)):this._drawId=g(this,q,jw).call(this,e,this.parent),g(this,q,xu).call(this,e.box)},jw=function(e,i){const{id:s,clipPathId:r}=i.drawLayer.draw(tt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,this.constructor._hasClipPath);return this.constructor._hasClipPath&&(this._clipPathId=r),g(this,q,Uw).call(this,i),s},Uw=function(e){const i=this._drawOutlines.getFocusSVGProperties(n(this,q,Hw));i&&(this._focusDrawId=e.drawLayer.drawOutline(i,this._drawOutlines.focusMustRemoveSelfIntersections))},$w=function(e=n(this,q,Hw)){var i;this._focusDrawId!==null&&((i=this.parent)==null||i.drawLayer.updateProperties(this._focusDrawId,this._drawOutlines.getFocusSVGProperties(e)))},Eu=function(e){var i;this._focusDrawId!==null&&((i=this.parent)==null||i.drawLayer.updateProperties(this._focusDrawId,{rootClass:e}))},Vw=function(){const{parent:e,_drawId:i,_focusDrawId:s,_isVisible:r}=this;if(!e||i===null)return;const a={hidden:!r};e.drawLayer.updateProperties(i,{rootClass:a}),s!==null&&e.drawLayer.updateProperties(s,{rootClass:a})},Hw=function(){return(this.parentRotation-this._drawRotation+360)%360},zw=function(){if(this._drawId===null||!this.parent)return;const{drawLayer:e}=this.parent;e.remove(this._drawId),this._drawId=null,this._focusDrawId!==null&&(e.remove(this._focusDrawId),this._focusDrawId=null),this._drawingOptions.reset()},Su=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){const{drawLayer:i}=this.parent;i.updateParent(this._drawId,e.drawLayer),this._focusDrawId!==null&&i.updateParent(this._focusDrawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=g(this,q,jw).call(this,this._drawOutlines,e),this._clipPathId&&n(this,Yc)&&(n(this,Yc).style.clipPath=this._clipPathId)}},RS=function([e,i,s,r]){const{parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[i,1-e,s*(o/a),r*(a/o)];case 180:return[1-e,1-i,s,r];case 270:return[1-i,e,s*(o/a),r*(a/o)];default:return[e,i,s,r]}},wm=function(){const{x:e,y:i,width:s,height:r,parentDimensions:[a,o],_drawRotation:l}=this;switch(l){case 90:return[1-i,e,s*(a/o),r*(o/a)];case 180:return[1-e,1-i,s,r];case 270:return[i,1-e,s*(a/o),r*(o/a)];default:return[e,i,s,r]}},xu=function(e){[this.x,this.y,this.width,this.height]=g(this,q,RS).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Dh=function(e=this.parentRotation){const{x:i,y:s,width:r,height:a,_drawRotation:o,parentDimensions:[l,h]}=this;switch((o*4+e)/90){case 1:return[1-s-a,i,a,r];case 2:return[1-i-r,1-s-a,r,a];case 3:return[s,1-i-r,a,r];case 4:return[i,s-r*(l/h),a*(h/l),r*(l/h)];case 5:return[1-s,i,r*(l/h),a*(h/l)];case 6:return[1-i-a*(h/l),1-s,a*(h/l),r*(l/h)];case 7:return[s-r*(l/h),1-i-a*(h/l),r*(l/h),a*(h/l)];case 8:return[i-r,s-a,r,a];case 9:return[1-s,i-r,a,r];case 10:return[1-i,1-s,r,a];case 11:return[s-a,1-i,a,r];case 12:return[i-a*(h/l),s,a*(h/l),r*(l/h)];case 13:return[1-s-r*(l/h),i-a*(h/l),r*(l/h),a*(h/l)];case 14:return[1-i,1-s-r*(l/h),a*(h/l),r*(l/h)];case 15:return[s,1-i,r*(l/h),a*(h/l)];default:return[i,s,r,a]}},T(tt,"_currentDrawId",-1),T(tt,"_currentParent",null),m(tt,ie,null),m(tt,$l,null),m(tt,Vl,null),m(tt,qc,null),T(tt,"_INNER_MARGIN",3);let Vu=tt;class U{constructor(){T(this,"focusOutline",null)}toSVGPath(){lt("Abstract method `toSVGPath` must be implemented.")}get box(){lt("Abstract getter `box` must be implemented.")}serialize(t,e){lt("Abstract method `serialize` must be implemented.")}get defaultSVGProperties(){lt("Abstract getter `defaultSVGProperties` must be implemented.")}get defaultProperties(){return this.defaultSVGProperties}getFocusSVGProperties(t){return null}get focusMustRemoveSelfIntersections(){return!1}updateProperty(t,e){return null}updateParentDimensions(t,e){return null}serializeQuadPoints(t,e){return null}updateRotation(t){return{}}getPathResizingSVGProperties(t){return{}}getPathResizedSVGProperties(t){return{}}getPathTranslatedSVGProperties(t,e){return{}}static _rotateBox([t,e,i,s],r){switch(r){case 90:return[1-e-s,t,s,i];case 180:return[1-t-i,1-e-s,i,s];case 270:return[e,1-t-i,s,i]}return[t,e,i,s]}static _rescale(t,e,i,s,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*s,a[o+1]=i+t[o+1]*r;return a}static _rescaleAndSwap(t,e,i,s,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*s,a[o+1]=i+t[o]*r;return a}static _translate(t,e,i,s){s||(s=new Float32Array(t.length));for(let r=0,a=t.length;r<a;r+=2)s[r]=e+t[r],s[r+1]=i+t[r+1];return s}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,i,s,r){switch(r){case 90:return[1-e/i,t/s];case 180:return[1-t/i,1-e/s];case 270:return[e/i,1-t/s];default:return[t/i,e/s]}}static createBezierPoints(t,e,i,s,r,a){return[(t+5*i)/6,(e+5*s)/6,(5*i+r)/6,(5*s+a)/6,(i+r)/2,(s+a)/2]}}T(U,"PRECISION",1e-4);var Mi,is,Qc,Zc,Es,rt,Hl,zl,up,fp,Jc,td,nn,pp,vb,Ab,pe,_u,NS,FS,OS,BS,jS,US;const Pn=class Pn{constructor(t,e,i,s,r,a,o=0){m(this,pe);m(this,Mi);m(this,is,[]);m(this,Qc);m(this,Zc);m(this,Es,[]);m(this,rt,new Float32Array(18));m(this,Hl);m(this,zl);m(this,up);m(this,fp);m(this,Jc);m(this,td);m(this,nn,[]);f(this,Mi,i),f(this,td,r*s),f(this,Zc,a),n(this,rt).set([NaN,NaN,NaN,NaN,t,e],6),f(this,Qc,o),f(this,fp,n(Pn,pp)*s),f(this,up,n(Pn,Ab)*s),f(this,Jc,s),n(this,nn).push(t,e)}isEmpty(){return isNaN(n(this,rt)[8])}isCancellable(){return n(this,nn).length<=10}removeLastElement(){return n(this,rt).fill(NaN),n(this,Es).length=n(this,is).length=n(this,nn).length=0,{path:{d:""}}}add(t,e){var P;f(this,Hl,t),f(this,zl,e);const[i,s,r,a]=n(this,Mi);let[o,l,h,c]=n(this,rt).subarray(8,12);const u=t-h,p=e-c,b=Math.hypot(u,p);if(b<n(this,up))return!1;const y=b-n(this,fp),w=y/b,v=w*u,A=w*p;let E=o,S=l;o=h,l=c,h+=v,c+=A,(P=n(this,nn))==null||P.push(t,e);const x=-A/y,_=v/y,C=x*n(this,td),k=_*n(this,td);return n(this,rt).set(n(this,rt).subarray(2,8),0),n(this,rt).set([h+C,c+k],4),n(this,rt).set(n(this,rt).subarray(14,18),12),n(this,rt).set([h-C,c-k],16),isNaN(n(this,rt)[6])?(n(this,Es).length===0&&(n(this,rt).set([o+C,l+k],2),n(this,Es).push(NaN,NaN,NaN,NaN,(o+C-i)/r,(l+k-s)/a),n(this,rt).set([o-C,l-k],14),n(this,is).push(NaN,NaN,NaN,NaN,(o-C-i)/r,(l-k-s)/a)),n(this,rt).set([E,S,o,l,h,c],6),!this.isEmpty()):(n(this,rt).set([E,S,o,l,h,c],6),Math.abs(Math.atan2(S-l,E-o)-Math.atan2(A,v))<Math.PI/2?([o,l,h,c]=n(this,rt).subarray(2,6),n(this,Es).push(NaN,NaN,NaN,NaN,((o+
55h)/2-i)/r,((l+c)/2-s)/a),[o,l,E,S]=n(this,rt).subarray(14,18),n(this,is).push(NaN,NaN,NaN,NaN,((E+o)/2-i)/r,((S+l)/2-s)/a),!0):([E,S,o,l,h,c]=n(this,rt).subarray(0,6),n(this,Es).push(((E+5*o)/6-i)/r,((S+5*l)/6-s)/a,((5*o+h)/6-i)/r,((5*l+c)/6-s)/a,((o+h)/2-i)/r,((l+c)/2-s)/a),[h,c,o,l,E,S]=n(this,rt).subarray(12,18),n(this,is).push(((E+5*o)/6-i)/r,((S+5*l)/6-s)/a,((5*o+h)/6-i)/r,((5*l+c)/6-s)/a,((o+h)/2-i)/r,((l+c)/2-s)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=n(this,Es),e=n(this,is);if(isNaN(n(this,rt)[6])&&!this.isEmpty())return g(this,pe,NS).call(this);const i=[];i.push(`M${t[4]} ${t[5]}`);for(let s=6;s<t.length;s+=6)isNaN(t[s])?i.push(`L${t[s+4]} ${t[s+5]}`):i.push(`C${t[s]} ${t[s+1]} ${t[s+2]} ${t[s+3]} ${t[s+4]} ${t[s+5]}`);g(this,pe,OS).call(this,i);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?i.push(`L${e[s+4]} ${e[s+5]}`):i.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);return g(this,pe,FS).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,r,a){return new $S(t,e,i,s,r,a)}getOutlines(){var u;const t=n(this,Es),e=n(this,is),i=n(this,rt),[s,r,a,o]=n(this,Mi),l=new Float32Array((((u=n(this,nn))==null?void 0:u.length)??0)+2);for(let p=0,b=l.length-2;p<b;p+=2)l[p]=(n(this,nn)[p]-s)/a,l[p+1]=(n(this,nn)[p+1]-r)/o;if(l[l.length-2]=(n(this,Hl)-s)/a,l[l.length-1]=(n(this,zl)-r)/o,isNaN(i[6])&&!this.isEmpty())return g(this,pe,BS).call(this,l);const h=new Float32Array(n(this,Es).length+24+n(this,is).length);let c=t.length;for(let p=0;p<c;p+=2){if(isNaN(t[p])){h[p]=h[p+1]=NaN;continue}h[p]=t[p],h[p+1]=t[p+1]}c=g(this,pe,US).call(this,h,c);for(let p=e.length-6;p>=6;p-=6)for(let b=0;b<6;b+=2){if(isNaN(e[p+b])){h[c]=h[c+1]=NaN,c+=2;continue}h[c]=e[p+b],h[c+1]=e[p+b+1],c+=2}return g(this,pe,jS).call(this,h,c),this.newFreeDrawOutline(h,l,n(this,Mi),n(this,Jc),n(this,Qc),n(this,Zc))}};Mi=new WeakMap,is=new WeakMap,Qc=new WeakMap,Zc=new WeakMap,Es=new WeakMap,rt=new WeakMap,Hl=new WeakMap,zl=new WeakMap,up=new WeakMap,fp=new WeakMap,Jc=new WeakMap,td=new WeakMap,nn=new WeakMap,pp=new WeakMap,vb=new WeakMap,Ab=new WeakMap,pe=new WeakSet,_u=function(){const t=n(this,rt).subarray(4,6),e=n(this,rt).subarray(16,18),[i,s,r,a]=n(this,Mi);return[(n(this,Hl)+(t[0]-e[0])/2-i)/r,(n(this,zl)+(t[1]-e[1])/2-s)/a,(n(this,Hl)+(e[0]-t[0])/2-i)/r,(n(this,zl)+(e[1]-t[1])/2-s)/a]},NS=function(){const[t,e,i,s]=n(this,Mi),[r,a,o,l]=g(this,pe,_u).call(this);return`M${(n(this,rt)[2]-t)/i} ${(n(this,rt)[3]-e)/s} L${(n(this,rt)[4]-t)/i} ${(n(this,rt)[5]-e)/s} L${r} ${a} L${o} ${l} L${(n(this,rt)[16]-t)/i} ${(n(this,rt)[17]-e)/s} L${(n(this,rt)[14]-t)/i} ${(n(this,rt)[15]-e)/s} Z`},FS=function(t){const e=n(this,is);t.push(`L${e[4]} ${e[5]} Z`)},OS=function(t){const[e,i,s,r]=n(this,Mi),a=n(this,rt).subarray(4,6),o=n(this,rt).subarray(16,18),[l,h,c,u]=g(this,pe,_u).call(this);t.push(`L${(a[0]-e)/s} ${(a[1]-i)/r} L${l} ${h} L${c} ${u} L${(o[0]-e)/s} ${(o[1]-i)/r}`)},BS=function(t){const e=n(this,rt),[i,s,r,a]=n(this,Mi),[o,l,h,c]=g(this,pe,_u).call(this),u=new Float32Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-i)/r,(e[3]-s)/a,NaN,NaN,NaN,NaN,(e[4]-i)/r,(e[5]-s)/a,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(e[16]-i)/r,(e[17]-s)/a,NaN,NaN,NaN,NaN,(e[14]-i)/r,(e[15]-s)/a],0),this.newFreeDrawOutline(u,t,n(this,Mi),n(this,Jc),n(this,Qc),n(this,Zc))},jS=function(t,e){const i=n(this,is);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},US=function(t,e){const i=n(this,rt).subarray(4,6),s=n(this,rt).subarray(16,18),[r,a,o,l]=n(this,Mi),[h,c,u,p]=g(this,pe,_u).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-r)/o,(i[1]-a)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,u,p,NaN,NaN,NaN,NaN,(s[0]-r)/o,(s[1]-a)/l],e),e+=24},m(Pn,pp,8),m(Pn,vb,2),m(Pn,Ab,n(Pn,pp)+n(Pn,vb));let qm=Pn;var ed,rn,sr,gp,Ss,mp,Gt,Eb,VS;class $S extends U{constructor(e,i,s,r,a,o){super();m(this,Eb);m(this,ed);m(this,rn,new Float32Array(4));m(this,sr);m(this,gp);m(this,Ss);m(this,mp);m(this,Gt);f(this,Gt,e),f(this,Ss,i),f(this,ed,s),f(this,mp,r),f(this,sr,a),f(this,gp,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],g(this,Eb,VS).call(this,o);const[l,h,c,u]=n(this,rn);for(let p=0,b=e.length;p<b;p+=2)e[p]=(e[p]-l)/c,e[p+1]=(e[p+1]-h)/u;for(let p=0,b=i.length;p<b;p+=2)i[p]=(i[p]-l)/c,i[p+1]=(i[p+1]-h)/u}toSVGPath(){const e=[`M${n(this,Gt)[4]} ${n(this,Gt)[5]}`];for(let i=6,s=n(this,Gt).length;i<s;i+=6){if(isNaN(n(this,Gt)[i])){e.push(`L${n(this,Gt)[i+4]} ${n(this,Gt)[i+5]}`);continue}e.push(`C${n(this,Gt)[i]} ${n(this,Gt)[i+1]} ${n(this,Gt)[i+2]} ${n(this,Gt)[i+3]} ${n(this,Gt)[i+4]} ${n(this,Gt)[i+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,i,s,r],a){const o=s-e,l=r-i;let h,c;switch(a){case 0:h=U._rescale(n(this,Gt),e,r,o,-l),c=U._rescale(n(this,Ss),e,r,o,-l);break;case 90:h=U._rescaleAndSwap(n(this,Gt),e,i,o,l),c=U._rescaleAndSwap(n(this,Ss),e,i,o,l);break;case 180:h=U._rescale(n(this,Gt),s,i,-o,l),c=U._rescale(n(this,Ss),s,i,-o,l);break;case 270:h=U._rescaleAndSwap(n(this,Gt),s,r,-o,-l),c=U._rescaleAndSwap(n(this,Ss),s,r,-o,-l);break}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return n(this,rn)}newOutliner(e,i,s,r,a,o,l=0){return new qm(e,i,s,r,a,o,l)}updateThickness(e){const i=this.getNewOutline(e);return f(this,Gt,n(i,Gt)),f(this,Ss,n(i,Ss)),n(this,rn).set(n(i,rn)),this.firstPoint=i.firstPoint,this.lastPoint=i.lastPoint,n(this,rn)}getNewOutline(e,i){const[s,r,a,o]=n(this,rn),[l,h,c,u]=n(this,ed),p=a*c,b=o*u,y=s*c+l,w=r*u+h,v=n(this,Ss),A=this.newOutliner(v[0]*p+y,v[1]*b+w,n(this,ed),n(this,mp),e,n(this,gp),i??n(this,sr));for(let E=2,S=v.length;E<S;E+=2)A.add(v[E]*p+y,v[E+1]*b+w);return A.getOutlines()}}ed=new WeakMap,rn=new WeakMap,sr=new WeakMap,gp=new WeakMap,Ss=new WeakMap,mp=new WeakMap,Gt=new WeakMap,Eb=new WeakSet,VS=function(e){const i=n(this,Gt);let s=i[4],r=i[5];const a=[s,r,s,r];let o=s,l=r,h=s,c=r;const u=e?Math.max:Math.min,p=new Float32Array(4);for(let y=6,w=i.length;y<w;y+=6){const v=i[y+4],A=i[y+5];isNaN(i[y])?(N.pointBoundingBox(v,A,a),l>A?(o=v,l=A):l===A&&(o=u(o,v)),c<A?(h=v,c=A):c===A&&(h=u(h,v))):(p.set(_r,0),N.bezierBoundingBox(s,r,...i.slice(y,y+6),p),N.rectBoundingBox(...p,a),l>p[1]?(o=p[0],l=p[1]):l===p[1]&&(o=u(o,p[0])),c<p[3]?(h=p[2],c=p[3]):c===p[3]&&(h=u(h,p[2]))),s=v,r=A}const b=n(this,rn);b[0]=a[0]-n(this,sr),b[1]=a[1]-n(this,sr),b[2]=a[2]-a[0]+2*n(this,sr),b[3]=a[3]-a[1]+2*n(this,sr),this.firstPoint=[o,l],this.lastPoint=[h,c]};function HS(d){return{bbox:d.box,root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:d.isFree},path:{d:d.toSVGPath()}}}function zS(d,t){const{focusOutline:e}=d;return{bbox:U._rotateBox(e.box,t),root:{"data-main-rotation":t},rootClass:{highlightOutline:!0,free:d.isFree},path:{d:e.toSVGPath()}}}var bp,yp,wp,Ta,xs,si,WS,vm,GS,XS,Gw;class Ww{constructor(t,e=0,i=0,s=!0){m(this,si);m(this,bp);m(this,yp);m(this,wp);m(this,Ta,[]);m(this,xs,[]);const r=_r.slice(),a=10**-4;for(const{x:w,y:v,width:A,height:E}of t){const S=Math.floor((w-e)/a)*a,x=Math.ceil((w+A+e)/a)*a,_=Math.floor((v-e)/a)*a,C=Math.ceil((v+E+e)/a)*a,k=[S,_,C,!0],D=[x,_,C,!1];n(this,Ta).push(k,D),N.rectBoundingBox(S,_,x,C,r)}const o=r[2]-r[0]+2*i,l=r[3]-r[1]+2*i,h=r[0]-i,c=r[1]-i;let u=s?-1/0:1/0,p=1/0;const b=n(this,Ta).at(s?-1:-2),y=[b[0],b[2]];for(const w of n(this,Ta)){const[v,A,E,S]=w;!S&&s?A<p?(p=A,u=v):A===p&&(u=Math.max(u,v)):S&&!s&&(A<p?(p=A,u=v):A===p&&(u=Math.min(u,v))),w[0]=(v-h)/o,w[1]=(A-c)/l,w[2]=(E-c)/l}f(this,bp,new Float32Array([h,c,o,l])),f(this,yp,[u,p]),f(this,wp,y)}getOutlines(){n(this,Ta).sort((e,i)=>e[0]-i[0]||e[1]-i[1]||e[2]-i[2]);const t=[];for(const e of n(this,Ta))e[3]?(t.push(...g(this,si,Gw).call(this,e)),g(this,si,G
55S).call(this,e)):(g(this,si,XS).call(this,e),t.push(...g(this,si,Gw).call(this,e)));return g(this,si,WS).call(this,t)}}bp=new WeakMap,yp=new WeakMap,wp=new WeakMap,Ta=new WeakMap,xs=new WeakMap,si=new WeakSet,WS=function(t){const e=[],i=new Set;for(const a of t){const[o,l,h]=a;e.push([o,l,a],[o,h,a])}e.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=e.length;a<o;a+=2){const l=e[a][2],h=e[a+1][2];l.push(h),h.push(l),i.add(l),i.add(h)}const s=[];let r;for(;i.size>0;){const a=i.values().next().value;let[o,l,h,c,u]=a;i.delete(a);let p=o,b=l;for(r=[o,h],s.push(r);;){let y;if(i.has(c))y=c;else if(i.has(u))y=u;else break;i.delete(y),[o,l,h,c,u]=y,p!==o&&(r.push(p,b,o,b===l?l:h),p=o),b=b===l?h:l}r.push(p,b)}return new Xw(s,n(this,bp),n(this,yp),n(this,wp))},vm=function(t){const e=n(this,xs);let i=0,s=e.length-1;for(;i<=s;){const r=i+s>>1,a=e[r][0];if(a===t)return r;a<t?i=r+1:s=r-1}return s+1},GS=function([,t,e]){const i=g(this,si,vm).call(this,t);n(this,xs).splice(i,0,[t,e])},XS=function([,t,e]){const i=g(this,si,vm).call(this,t);for(let s=i;s<n(this,xs).length;s++){const[r,a]=n(this,xs)[s];if(r!==t)break;if(r===t&&a===e){n(this,xs).splice(s,1);return}}for(let s=i-1;s>=0;s--){const[r,a]=n(this,xs)[s];if(r!==t)break;if(r===t&&a===e){n(this,xs).splice(s,1);return}}},Gw=function(t){const[e,i,s]=t,r=[[e,i,s]],a=g(this,si,vm).call(this,s);for(let o=0;o<a;o++){const[l,h]=n(this,xs)[o];for(let c=0,u=r.length;c<u;c++){const[,p,b]=r[c];if(!(h<=p||b<=l)){if(p>=l){if(b>h)r[c][1]=h;else{if(u===1)return[];r.splice(c,1),c--,u--}continue}r[c][2]=l,b>h&&r.push([e,h,b])}}}return r};var vp,Ap,id;class Xw extends U{constructor(e,i,s,r){super();m(this,vp);m(this,Ap,null);m(this,id);f(this,id,e),f(this,vp,i),this.firstPoint=s,this.lastPoint=r}static build(e,i){const s=new Ww(e,.001).getOutlines();return f(s,Ap,e),s.focusOutline=new Ww(e,.0025,.001,i).getOutlines(),s}get isFree(){return!1}get defaultSVGProperties(){return HS(this)}getFocusSVGProperties(e){return zS(this,e)}updateRotation(e){return{root:{"data-main-rotation":e}}}serializeQuadPoints([e,i],[s,r]){const a=n(this,Ap),o=new Float32Array(a.length*8);let l=0;for(const{x:h,y:c,width:u,height:p}of a){const b=h*s+e,y=(1-c)*r+i;o[l]=o[l+4]=b,o[l+1]=o[l+3]=y,o[l+2]=o[l+6]=b+u*s,o[l+5]=o[l+7]=y-p*r,l+=8}return o}toSVGPath(){const e=[];for(const i of n(this,id)){let[s,r]=i;e.push(`M${s} ${r}`);for(let a=2;a<i.length;a+=2){const o=i[a],l=i[a+1];o===s?(e.push(`V${l}`),r=l):l===r&&(e.push(`H${o}`),s=o)}e.push("Z")}return e.join(" ")}serialize([e,i,s,r],a){const o=[],l=s-e,h=r-i;for(const c of n(this,id)){const u=new Array(c.length);for(let p=0;p<c.length;p+=2)u[p]=e+c[p]*l,u[p+1]=r-c[p+1]*h;o.push(u)}return o}get box(){return n(this,vp)}}vp=new WeakMap,Ap=new WeakMap,id=new WeakMap;class uA extends qm{newFreeDrawOutline(t,e,i,s,r,a){return new Yw(t,e,i,s,r,a)}}var Ii,Ep;class OP{constructor(t,e,i,s,r,a,o){m(this,Ii);m(this,Ep);f(this,Ii,new uA(t,e,i,s,r,a,o)),f(this,Ep,r)}add(t,e){return n(this,Ii).add(t,e)?{path:{d:n(this,Ii).toSVGPath()}}:null}addPoints(t){let e=!1;for(let i=0,s=t.length;i<s;i+=2)e=n(this,Ii).add(t[i],t[i+1])||e;return e?{path:{d:n(this,Ii).toSVGPath()}}:null}end(t,e){return t===void 0?null:this.add(t,e)}isEmpty(){return n(this,Ii).isEmpty()}isCancellable(){return n(this,Ii).isCancellable()}removeLastElement(){return n(this,Ii).removeLastElement()}updateProperty(t,e){return null}getOutlines(){const t=n(this,Ii).getOutlines();return t.buildFocusOutline(2*n(this,Ep)),t}get defaultSVGProperties(){return{bbox:[0,0,1,1],root:{viewBox:"0 0 1 1"},rootClass:{highlight:!0,free:!0},path:{d:n(this,Ii).toSVGPath()}}}}Ii=new WeakMap,Ep=new WeakMap;var Sb;const xb=class xb extends $S{newOutliner(t,e,i,s,r,a,o=0){return new uA(t,e,i,s,r,a,o)}get isFree(){return!0}buildFocusOutline(t){this.focusOutline=this.getNewOutline(t/2+n(xb,Sb),.0025)}get defaultSVGProperties(){return HS(this)}getFocusSVGProperties(t){return zS(this,t)}get focusMustRemoveSelfIntersections(){return!0}updateRotation(t){return{root:{"data-main-rotation":t}}}updateProperty(t,e){if(t!=="thickness")return null;const i=this.updateThickness(e/2);return this.buildFocusOutline(e),i}getPathResizedSVGProperties(){return{path:{d:this.toSVGPath()}}}};Sb=new WeakMap,m(xb,Sb,1.5);let Yw=xb;class fA extends dA{constructor(t=null){super(),super.updateProperties(t)}updateSVGProperty(t,e){t!=="thickness"&&super.updateSVGProperty(t,e)}clone(){const t=new fA;return t.updateAll(this),t}}var sd,Sp,xp,_p,Cp,nd,ji,Kw,YS,Am,KS;const Xe=class Xe extends Vu{constructor(e){var i;super({...e,name:"highlightEditor"});m(this,ji);m(this,sd,null);m(this,Sp,0);m(this,xp,null);m(this,_p,0);m(this,Cp,"");m(this,nd,"");f(this,sd,e.anchorNode||null),f(this,Sp,e.anchorOffset||0),f(this,xp,e.focusNode||null),f(this,_p,e.focusOffset||0),f(this,Cp,e.methodOfCreation||((i=this._drawOutlines)!=null&&i.isFree?"main_toolbar":"")),f(this,nd,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",this.rotate()}static get _keyboardManager(){const e=Xe.prototype;return Y(this,"_keyboardManager",new wh([[["ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown"],e._moveCaret,{args:[3]}]]))}static initialize(e,i){var s;Ct.initialize(e,i),this._defaultDrawingOptions||(this._defaultDrawingOptions=new fA({fill:((s=i.highlightColors)==null?void 0:s.values().next().value)||"#fff066","fill-opacity":Xe._DEFAULT_OPACITY,thickness:Xe._DEFAULT_THICKNESS}))}static getDefaultDrawingOptions(e){const i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get typesMap(){return Y(this,"typesMap",new Map([[ot.HIGHLIGHT_COLOR,"fill"],[ot.HIGHLIGHT_THICKNESS,"thickness"]]))}static get isDrawer(){return!1}static get _hasClipPath(){return!0}static get _hasDrawClass(){return!1}_addOutlines(e){const{boxes:i,drawOutlines:s}=e;!i&&!s||(this._drawingOptions||(this._drawingOptions=e.drawingOptions||Xe.getDefaultDrawingOptions()),i&&(e={...e,drawOutlines:Xw.build(i,this._uiManager.direction==="ltr")}),super._addOutlines(e))}get colorType(){return ot.HIGHLIGHT_COLOR}get color(){return this._drawingOptions.fill}get opacity(){return this._drawingOptions["fill-opacity"]}get _opacityName(){return"fill-opacity"}get _drawRotation(){var e;return(e=this._drawOutlines)!=null&&e.isFree?this.rotation:0}get isResizable(){return!1}get _mustBeDisabledOnCommit(){return!1}get _mustFixPosition(){var e;return!((e=this._drawOutlines)!=null&&e.isFree)}get telemetryInitialData(){return{action:"added",type:this._drawOutlines.isFree?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this._drawingOptions.thickness,methodOfCreation:n(this,Cp)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("
55color").size}}translateInPage(e,i){}get toolbarPosition(){return g(this,ji,Kw).call(this,this._drawOutlines.focusOutline.lastPoint)}get commentButtonPosition(){return g(this,ji,Kw).call(this,this._drawOutlines.firstPoint)}updateParams(e,i){switch(e){case ot.HIGHLIGHT_COLOR:this._updateColorAndOpacity(i,Xe._DEFAULT_OPACITY,e),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(i)},!0);break;case ot.HIGHLIGHT_THICKNESS:super.updateParams(e,i),this._reportTelemetry({action:"thickness_changed",thickness:i},!0);break}}get propertiesToUpdate(){const e=super.propertiesToUpdate;return e.push([ot.HIGHLIGHT_FREE,this._drawOutlines.isFree]),e}get toolbarButtons(){return this._uiManager.highlightColors?(this._colorPicker=new pS({editor:this}),[["colorPicker",this._colorPicker]]):super.toolbarButtons}fixAndSetPosition(){return super.fixAndSetPosition(this._drawRotation)}getRect(e,i){return super.getRect(e,i,this._drawRotation)}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){this._reportTelemetry({action:"deleted"}),super.remove()}render(){if(this.div)return this.div;const e=super.render();return n(this,nd)&&(e.setAttribute("aria-label",n(this,nd)),e.setAttribute("role","mark")),this._drawOutlines.isFree?e.classList.add("free"):e.addEventListener("keydown",g(this,ji,YS).bind(this),{signal:this._uiManager._signal}),this.enableEditing(),e}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:g(this,ji,Am).call(this,!0);break;case 1:case 3:g(this,ji,Am).call(this,!1);break}}unselect(){super.unselect(),this._drawOutlines.isFree||g(this,ji,Am).call(this,!1)}static createDrawerInstance({x:e,y:i,box:s,parent:r,isLTR:a}){return new OP(e,i,s,r.scale,this._defaultDrawingOptions.thickness/2,a,.001)}static _getDrawingTarget(e,{target:i}){return i.closest(".textLayer")}static _getPointerCoords({x:e,y:i}){return[e,i]}static _addDrawingListeners(e,i){e.classList.add("free"),i.addEventListener("abort",()=>e.classList.remove("free"),{once:!0}),window.addEventListener("blur",()=>this._endDraw(null),{signal:i}),window.addEventListener("pointerdown",fe,{capture:!0,passive:!1,signal:i})}static _endDrawingSession(e=!1){return this.endDrawing(e)}createDrawingOptions({color:e,opacity:i,thickness:s}){const{_defaultDrawingOptions:r,_DEFAULT_OPACITY:a}=Xe;this._drawingOptions=Xe.getDefaultDrawingOptions({fill:N.makeHexColor(...e),"fill-opacity":i||a,thickness:s||r.thickness})}static deserializeDraw(e,i,s,r,a,o,l){const{quadPoints:h}=o;if(h){const y=[];for(let w=0,v=h.length;w<v;w+=8)y.push({x:(h[w]-e)/s,y:1-(h[w+1]-i)/r,width:(h[w+2]-h[w])/s,height:(h[w+1]-h[w+5])/r});return Xw.build(y,l.direction==="ltr")}const c=o.thickness||this._defaultDrawingOptions.thickness,u=(o.inkLists||o.outlines.points)[0],p=new uA(u[0]-e,r-(u[1]-i),[0,0,s,r],1,c/2,!0,.001);for(let y=0,w=u.length;y<w;y+=2)p.add(u[y]-e,r-(u[y+1]-i));const b=p.getOutlines();return b.buildFocusOutline(c),b}static async deserialize(e,i,s){let r=null;if(e instanceof xS){const{data:{quadPoints:o,rect:l,rotation:h,id:c,color:u,opacity:p,popupRef:b,richText:y,contentsObj:w,creationDate:v,modificationDate:A},parent:{page:{pageNumber:E}}}=e;r=e={annotationType:Z.HIGHLIGHT,color:Array.from(u),opacity:p,quadPoints:o,pageIndex:E-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:b,richText:y,comment:(w==null?void 0:w.str)||null,creationDate:v,modificationDate:A}}else if(e instanceof cA){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,borderStyle:{rawWidth:p},popupRef:b,richText:y,contentsObj:w,creationDate:v,modificationDate:A},parent:{page:{pageNumber:E}}}=e;r=e={annotationType:Z.HIGHLIGHT,color:Array.from(u),thickness:p,inkLists:o,pageIndex:E-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:b,richText:y,comment:(w==null?void 0:w.str)||null,creationDate:v,modificationDate:A}}const a=await super.deserialize(e,i,s);return a._initialData=r,e.comment&&a.setCommentData(e),a}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const i=super.serialize(e);return Object.assign(i,{color:Ct._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),opacity:this.opacity,thickness:this._drawingOptions.thickness,quadPoints:this._drawOutlines.serializeQuadPoints(this.pageTranslation,this.pageDimensions),outlines:this._drawOutlines.serialize(i.rect,this._drawRotation)}),this.addComment(i),this.annotationElementId&&!g(this,ji,KS).call(this,i)?null:(i.id=this.annotationElementId,i)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};sd=new WeakMap,Sp=new WeakMap,xp=new WeakMap,_p=new WeakMap,Cp=new WeakMap,nd=new WeakMap,ji=new WeakSet,Kw=function([e,i]){const[s,r,a,o]=this._drawOutlines.box;return[(e-s)/a,(i-r)/o]},YS=function(e){Xe._keyboardManager.exec(this,e)},Am=function(e){if(!n(this,sd))return;const i=window.getSelection();
55e?i.setPosition(n(this,sd),n(this,Sp)):i.setPosition(n(this,xp),n(this,_p))},KS=function(e){const{color:i}=this._initialData;return this.hasEditedComment||e.color.some((s,r)=>s!==i[r])},T(Xe,"_DEFAULT_OPACITY",1),T(Xe,"_DEFAULT_THICKNESS",12),T(Xe,"_defaultDrawingOptions",null),T(Xe,"_type","highlight"),T(Xe,"_editorType",Z.HIGHLIGHT);let Qm=Xe;var an,ka,se,Te,Wl,rd,ke,ne,ss,Gl,Xl,Yl,Ui,Em,Sm,qw;class BP{constructor(t,e,i,s,r,a){m(this,Ui);m(this,an,new Float64Array(6));m(this,ka,new Float64Array(2));m(this,se);m(this,Te);m(this,Wl);m(this,rd);m(this,ke);m(this,ne,"");m(this,ss,0);m(this,Gl,new kg);m(this,Xl);m(this,Yl);f(this,Xl,i),f(this,Yl,s),f(this,Wl,r),f(this,rd,a),[t,e]=g(this,Ui,Em).call(this,t,e);const o=f(this,se,[NaN,NaN,NaN,NaN,t,e]);f(this,ke,[t,e]),f(this,Te,[{line:o,points:n(this,ke)}]),n(this,an).set(o,0),n(this,ka).set([t,e],0)}updateProperty(t,e){t==="stroke-width"&&f(this,rd,e)}isEmpty(){var t;return!((t=n(this,Te))!=null&&t.length)}isCancellable(){return n(this,ke).length<=10}add(t,e){return g(this,Ui,Sm).call(this,t,e)&&this.toSVGPath(),{path:{d:g(this,Ui,qw).call(this)}}}addPoints(t){let e=!1;for(let i=0,s=t.length;i<s;i+=2)g(this,Ui,Sm).call(this,t[i],t[i+1])&&(e=!0,n(this,ke).length<=6&&(this.toSVGPath(),e=!1));return e&&this.toSVGPath(),{path:{d:g(this,Ui,qw).call(this)}}}end(t,e){return t!==void 0&&g(this,Ui,Sm).call(this,t,e)?{path:{d:this.toSVGPath()}}:n(this,ke).length===2?{path:{d:this.toSVGPath()}}:{path:{d:n(this,ne)}}}startNew(t,e,i,s,r){f(this,Xl,i),f(this,Yl,s),f(this,Wl,r),[t,e]=g(this,Ui,Em).call(this,t,e);const a=f(this,se,[NaN,NaN,NaN,NaN,t,e]);f(this,ke,[t,e]),n(this,ka).set([t,e],0);const o=n(this,Te).at(-1);return o&&(o.line=new Float32Array(o.line),o.points=new Float32Array(o.points)),n(this,Te).push({line:a,points:n(this,ke)}),n(this,an).set(a,0),f(this,ss,0),this.toSVGPath(),null}getLastElement(){return n(this,Te).at(-1)}setLastElement(t){return n(this,Te)?(n(this,Te).push(t),f(this,se,t.line),f(this,ke,t.points),f(this,ss,0),{path:{d:this.toSVGPath()}}):n(this,Gl).setLastElement(t)}removeLastElement(){if(!n(this,Te))return n(this,Gl).removeLastElement();n(this,Te).pop(),f(this,ne,"");for(let t=0,e=n(this,Te).length;t<e;t++){const{line:i,points:s}=n(this,Te)[t];f(this,se,i),f(this,ke,s),f(this,ss,0),this.toSVGPath()}return{path:{d:n(this,ne)}}}toSVGPath(){const t=U.svgRound(n(this,se)[4]),e=U.svgRound(n(this,se)[5]);if(n(this,ke).length===2)return f(this,ne,`${n(this,ne)} M ${t} ${e} Z`),n(this,ne);if(n(this,ke).length<=6){const s=n(this,ne).lastIndexOf("M");f(this,ne,`${n(this,ne).slice(0,s)} M ${t} ${e}`),f(this,ss,6)}if(n(this,ke).length===4){const s=U.svgRound(n(this,se)[10]),r=U.svgRound(n(this,se)[11]);return f(this,ne,`${n(this,ne)} L ${s} ${r}`),f(this,ss,12),n(this,ne)}const i=[];n(this,ss)===0&&(i.push(`M ${t} ${e}`),f(this,ss,6));for(let s=n(this,ss),r=n(this,se).length;s<r;s+=6){const[a,o,l,h,c,u]=n(this,se).slice(s,s+6).map(U.svgRound);i.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}return f(this,ne,n(this,ne)+i.join(" ")),f(this,ss,n(this,se).length),n(this,ne)}getOutlines(t,e,i,s){const r=n(this,Te).at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),n(this,Gl).build(n(this,Te),t,e,i,n(this,Wl),n(this,rd),s),f(this,an,null),f(this,se,null),f(this,Te,null),f(this,ne,null),n(this,Gl)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}an=new WeakMap,ka=new WeakMap,se=new WeakMap,Te=new WeakMap,Wl=new WeakMap,rd=new WeakMap,ke=new WeakMap,ne=new WeakMap,ss=new WeakMap,Gl=new WeakMap,Xl=new WeakMap,Yl=new WeakMap,Ui=new WeakSet,Em=function(t,e){return U._normalizePoint(t,e,n(this,Xl),n(this,Yl),n(this,Wl))},Sm=function(t,e){[t,e]=g(this,Ui,Em).call(this,t,e),n(this,ka).set([t,e],0);const[i,s,r,a]=n(this,an).subarray(2,6),o=t-r,l=e-a;return Math.hypot(n(this,Xl)*o,n(this,Yl)*l)<=2?!1:(n(this,ke).push(t,e),isNaN(i)?(n(this,an).set([r,a,t,e],2),n(this,se).push(NaN,NaN,NaN,NaN,t,e),!0):(isNaN(n(this,an)[0])&&n(this,se).splice(6,6),n(this,an).set([i,s,r,a,t,e],0),n(this,se).push(...U.createBezierPoints(i,s,r,a,t,e)),!0))},qw=function(){const t=U.svgRound(n(this,ka)[0]),e=U.svgRound(n(this,ka)[1]);if(n(this,ke).length===2){const i=U.svgRound(n(this,se)[4]),s=U.svgRound(n(this,se)[5]);return`${n(this,ne)} M ${i} ${s} L ${t} ${e}`}return`${n(this,ne)} L ${t} ${e}`};var Ke,Pp,Tp,Di,on,ln,ad,od,Kl,De,xn,qS,QS,ZS;class kg extends U{constructor(){super(...arguments);m(this,De);m(this,Ke);m(this,Pp,0);m(this,Tp);m(this,Di);m(this,on);m(this,ln);m(this,ad);m(this,od);m(this,Kl)}build(e,i,s,r,a,o,l){f(this,on,i),f(this,ln,s),f(this,ad,r),f(this,od,a),f(this,Kl,o),f(this,Tp,l??0),f(this,Di,e),g(this,De,QS).call(this)}get thickness(){return n(this,Kl)}setLastElement(e){return n(this,Di).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return n(this,Di).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:i}of n(this,Di)){if(e.push(`M${U.svgRound(i[4])} ${U.svgRound(i[5])}`),i.length===6){e.push("Z");continue}if(i.length===12&&isNaN(i[6])){e.push(`L${U.svgRound(i[10])} ${U.svgRound(i[11])}`);continue}for(let s=6,r=i.length;s<r;s+=6){const[a,o,l,h,c,u]=i.subarray(s,s+6).map(U.svgRound);e.push(`C${a} ${o} ${l} ${h} ${c} ${u}`)}}return e.join("")}serialize([e,i,s,r],a){const o=[],l=[],[h,c,u,p]=g(this,De,qS).call(this);let b,y,w,v,A,E,S,x,_;switch(n(this,od)){case 0:_=U._rescale,b=e,y=i+r,w=s,v=-r,A=e+h*s,E=i+(1-c-p)*r,S=e+(h+u)*s,x=i+(1-c)*r;break;case 90:_=U._rescaleAndSwap,b=e,y=i,w=s,v=r,A=e+c*s,E=i+h*r,S=e+(c+p)*s,x=i+(h+u)*r;break;case 180:_=U._rescale,b=e+s,y=i,w=-s,v=r,A=e+(1-h-u)*s,E=i+c*r,S=e+(1-h)*s,x=i+(c+p)*r;break;case 270:_=U._rescaleAndSwap,b=e+s,y=i+r,w=-s,v=-r,A=e+(1-c-p)*s,E=i+(1-h-u)*r,S=e+(1-c)*s,x=i+(1-h)*r;break}for(const{line:C,points:k}of n(this,Di))o.push(_(C,b,y,w,v,a?new Array(C.length):null)),l.push(_(k,b,y,w,v,a?new Array(k.length):null));return{lines:o,points:l,rect:[A,E,S,x]}}static deserialize(e,i,s,r,a,{paths:{lines:o,points:l},rotation:h,thickness:c}){const u=[];let p,b,y,w,v;switch(h){case 0:v=U._rescale,p=-e/s,b=i/r+1,y=1/s,w=-1/r;break;case 90:v=U._rescaleAndSwap,p=-i/r,b=-e/s,y=1/r,w=1/s;break;case 180:v=U._rescale,p=e/s+1,b=-i/r,y=-1/s,w=1/r;break;case 270:v=U._rescaleAndSwap,p=i/r+1,b=e/s+1,y=-1/r,w=-1/s;break}if(!o){o=[];for(const E of l){const S=E.length;if(S===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,E[0],E[1]]));continue}if(S===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,E[0],E[1],NaN,NaN,NaN,NaN,E[2],E[3]]));continue}const x=new Float32Array(3*(S-2));o.push(x);let[_,C,k,D]=E.subarray(0,4);x.set([NaN,NaN,NaN,NaN,_,C],0);for(let P=4;P<S;P+=2){const I=E[P],L=E[P+1];x.set(U.createBezierPoints(_,C,k,D,I,L),(P-2)*3),[_,C,k,D]=[k,D,I,L]}}}for(let E=0,S=o.length;E<S;E++)u.push({line:v(o[E].map(x=>x??NaN),p,b,y,w),points:v(l[E].map(x=>x??NaN),p,b,y,w)});const A=new this.prototype.constructor;return A.build(u,s,r,1,h,c,a),A}get box(){return n(this,Ke)}updateProperty(e,i){return e==="stroke-width"?g(this,De,ZS).call(this,i):null}updateParentDimensions([e,i],s){const[r,a]=g(this,De,xn).call(this);f(this,on,e),f(this,ln,i),f(this,ad,s);const[o,l]=g(this,De,xn).call(this),h=o-r,c=l-a,u=n(this,Ke);return u[0]-=h,u[1]-=c,u[2]+=2*h,u[3]+=2*c,u}updateRotation(e){return f(this,Pp,e),{path:{transform:this.rotationTransform}}}get viewBox(){return n(this,Ke).map(U.svgRound).join(" ")}get defaultProperties(){const[e,i]=n(this,Ke);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`}}}get rotationTransform(){const[,,e,i]=n(this,Ke);let s=0,r=0,a=0,o=0,l=0,h=0;switch(n(this,Pp)){case 90:r=i/e,a=-e/i,l=e;break;case 180:s=-1,o=-1,l=e,h=i;break;case 270:r=-i/e,a=e/i,h=i;break;default:return""}return`matrix(${s} ${r} ${a} ${o} ${U.svgRound(l)} ${U.svgRound(h)})`}getPathResizingSVGProperties([e,i,s,r]){const[a,o]=g(this,De,xn).call(this),[l,h,c,u]=n(this,Ke);if(Math.abs(c-a)<=U.PRECISION||Math.abs(u-o)<=U.PRECISION){const v=e+s/2-(l+c/2),A=i+r/2-(h+u/2);return{path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`,transform:`${this.rotationTransform} translate(${v} ${A})`}}}const p=(s-2*a)/(c-2*a),b=(r-2*o)/(u-2*o),y=c/s,w=u/r;return{path:{"transform-origin":`${U.svgRound(l)} ${U.svgRound(h)}`,transform:`${this.rotationTransform} scale(${y} ${w}) translate(${U.svgRound(a)} ${U.svgRound(o)}) scale(${p} ${b}) translate(${U.svgRound(-a)} ${U.svgRound(-o)})`}}}getPathResizedSVGProperties([e,i,s,r]){const[a,o]=g(this,De,xn).call(this),l=n(this,Ke),[h,c,u,p]=l;if(l[0]=e,l[1]=i,l[2]=s,l[3]=r,Math.abs(u-a)<=U.PRECISION||Math.abs(p-o)<=U.PRECISION){const A=e+s/2-(h+u/2),E=i+r/2-(c+p/2);for(const{line:S,points:x}of n(this,Di))U._translate(S,A,E,S),U._translate(x,A,E,x);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const b=(s-2*a)/(u-2*a),y=(r-2*o)/(p-2*o),w=-b*(h+a)+e+a,v=-y*(c+o)+i+o;if(b!==1||y!==1||w!==0||v!==0)for(const{line:A,points:E}of n(this,Di))U._rescale(A,w,v,b,y,A),U._rescale(E,w,v,b,y,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],s){const[r,a]=s,o=n(this,Ke),l=e-o[0],h=i-o[1];if(n(this,on)===r&&n(this,ln)===a)for(const{line:c,points:u}of n(this,Di))U._translate(c,l,h,c),U._translate(u,l,h,u);else{const c=n(this,on)/r,u=n(this,ln)/a;f(this,on,r),f(this,ln,a);for(const{line:p,points:b}of n(this,Di))U._rescale(p,l,h,c,u,p),U._rescale(b,l,h,c,u,b);o[2]*=c,o[3]*=u}return o[0]=e,o[1]=i,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`}}}get defaultSVGProperties(){const e=n(this,Ke);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${U.svgRound(e[0])} ${U.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}}Ke=new WeakMap,Pp=new WeakMap,Tp=new WeakMap,Di=new WeakMap,on=new WeakMap,ln=new WeakMap,ad=new WeakMap,od=new WeakMap,Kl=new WeakMap,De=new WeakSet,xn=function(e=n(this,Kl)){const i=n(this,Tp)+e/2*n(this,ad);return n(this,od)%180===0?[i/n(this,on),i/n(this,ln)]:[i/n(this,ln),i/n(this,on)]},qS=function(){const[e,i,s,r]=n(this,Ke),[a,o]=g(this,De,xn).call(this,0);return[e+a,i+o,s-2*a,r-2*o]},QS=function(){const e=f(this,Ke,ko.slice());for(const{line:r}of n(this,Di)){if(r.length<=12){for(let l=4,h=r.length;l<h;l+=6)N.pointBoundingBox(r[l],r[l+1],e);continue}let a=r[4],o=r[5];for(let l=6,h=r.length;l<h;l+=6){const[c,u,p,b,y,w]=r.subarray(l,l+6);N.bezierBoundingBox(a,o,c,u,p,b,y,w,e),a=y,o=w}}const[i,s]=g(this,De,xn).call(this);e[0]=Nt(e[0]-i,0,1),e[1]=Nt(e[1]-s,0,1),e[2]=Nt(e[2]+i,0,1),e[3]=Nt(e[3]+s,0,1),e[2]-=e[0],e[3]-=e[1]},ZS=function(e){const[i,s]=g(this,De,xn).call(this);f(this,Kl,e);const[r,a]=g(this,De,xn).call(this),[o,l]=[r-i,a-s],h=n(this,Ke);return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h};class Xb extends dA{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Ct._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){const t=new Xb(this._viewParameters);return t.updateAll(this),t}}var _b,JS;const Oh=class Oh extends Vu{constructor(e){super({...e,name:"inkEditor"});m(this,_b);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,i){Ct.initialize(e,i),this._defaultDrawingOptions=new Xb(i.viewParameters)}static getDefaultDrawingOptions(e){const i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!0}static get typesMap(){return Y(this,"typesMap",new Map([[ot.INK_THICKNESS,"stroke-width"],[ot.INK_COLOR,"stroke"],[ot.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance({x:e,y:i,box:[,,s,r],rotation:a}){return new BP(e,i,s,r,a,this._defaultDrawingOptions["stroke-width"])}
55static deserializeDraw(e,i,s,r,a,o){return kg.deserialize(e,i,s,r,a,o)}static async deserialize(e,i,s){let r=null;if(e instanceof cA){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:u,opacity:p,borderStyle:{rawWidth:b},popupRef:y,richText:w,contentsObj:v,creationDate:A,modificationDate:E},parent:{page:{pageNumber:S}}}=e;r=e={annotationType:Z.INK,color:Array.from(u),thickness:b,opacity:p,paths:{points:o},boxes:null,pageIndex:S-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:y,richText:w,comment:(v==null?void 0:v.str)||null,creationDate:A,modificationDate:E}}const a=await super.deserialize(e,i,s);return a._initialData=r,e.comment&&a.setCommentData(e),a}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new Ym(this)),[["colorPicker",this._colorPicker]]}get colorType(){return ot.INK_COLOR}get colorAndOpacityType(){return ot.INK_COLOR_AND_OPACITY}get opacityType(){return ot.INK_OPACITY}updateParams(e,i){if(e===ot.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(i.color,i.opacity);return}super.updateParams(e,i)}static updateDefaultParams(e,i){if(e===ot.INK_COLOR_AND_OPACITY){super.updateDefaultParams(ot.INK_COLOR,i.color),super.updateDefaultParams(ot.INK_OPACITY,i.opacity);return}super.updateDefaultParams(e,i)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:i,parent:s}=this;i.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(e,i.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:i,opacity:s}){this._drawingOptions=Oh.getDefaultDrawingOptions({stroke:N.makeHexColor(...e),"stroke-width":i,"stroke-opacity":s})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:i,points:s}=this.serializeDraw(e),{_drawingOptions:{stroke:r,"stroke-opacity":a,"stroke-width":o}}=this,l=Object.assign(super.serialize(e),{color:Ct._colorManager.convert(r),opacity:a,thickness:o,paths:{lines:i,points:s}});return this.addComment(l),e?(l.isCopy=!0,l):this.annotationElementId&&!g(this,_b,JS).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;const{points:i,rect:s}=this.serializeDraw(!1);return e.updateEdited({rect:s,thickness:this._drawingOptions["stroke-width"],points:i,popup:this.comment}),null}};_b=new WeakSet,JS=function(e){const{color:i,thickness:s,opacity:r,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((o,l)=>o!==i[l])||e.thickness!==s||e.opacity!==r||e.pageIndex!==a},T(Oh,"_type","ink"),T(Oh,"_editorType",Z.INK),T(Oh,"_defaultDrawingOptions",null);let Qw=Oh;class Zw extends kg{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}const Fg=8,nu=3;var au,ql,ft,Jw,_s,tx,ex,tv,xm,ix,sx,nx,ev,iv,rx;let Lh=(au=class{static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:s},r,a,o,l){let h=new OffscreenCanvas(1,1),c=h.getContext("2d",{alpha:!1});const u=200,p=c.font=`${i} ${s} ${u}px ${e}`,{actualBoundingBoxLeft:b,actualBoundingBoxRight:y,actualBoundingBoxAscent:w,actualBoundingBoxDescent:v,fontBoundingBoxAscent:A,fontBoundingBoxDescent:E,width:S}=c.measureText(t),x=1.5,_=Math.ceil(Math.max(Math.abs(b)+Math.abs(y)||0,S)*x),C=Math.ceil(Math.max(Math.abs(w)+Math.abs(v)||u,Math.abs(A)+Math.abs(E)||u)*x);h=new OffscreenCanvas(_,C),c=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=p,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,_,C),c.fillStyle="black",c.fillText(t,_*(x-1)/2,C*(3-x)/2);const k=g(this,ft,ev).call(this,c.getImageData(0,0,_,C).data),D=g(this,ft,nx).call(this,k),P=g(this,ft,iv).call(this,D),I=g(this,ft,tv).call(this,k,_,C,P);return this.processDrawnLines({lines:{curves:I,width:_,height:C},pageWidth:r,pageHeight:a,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}
55static process(t,e,i,s,r){const[a,o,l]=g(this,ft,rx).call(this,t),[h,c]=g(this,ft,sx).call(this,a,o,l,Math.hypot(o,l)*n(this,ql).sigmaSFactor,n(this,ql).sigmaR,n(this,ql).kernelSize),u=g(this,ft,iv).call(this,c),p=g(this,ft,tv).call(this,h,o,l,u);return this.processDrawnLines({lines:{curves:p,width:o,height:l},pageWidth:e,pageHeight:i,rotation:s,innerMargin:r,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:s,innerMargin:r,mustSmooth:a,areContours:o}){s%180!==0&&([e,i]=[i,e]);const{curves:l,width:h,height:c}=t,u=t.thickness??0,p=[],b=Math.min(e/h,i/c),y=b/e,w=b/i,v=[];for(const{points:E}of l){const S=a?g(this,ft,ix).call(this,E):E;if(!S)continue;v.push(S);const x=S.length,_=new Float32Array(x),C=new Float32Array(3*(x===2?2:x-2));if(p.push({line:C,points:_}),x===2){_[0]=S[0]*y,_[1]=S[1]*w,C.set([NaN,NaN,NaN,NaN,_[0],_[1]],0);continue}let[k,D,P,I]=S;k*=y,D*=w,P*=y,I*=w,_.set([k,D,P,I],0),C.set([NaN,NaN,NaN,NaN,k,D],0);for(let L=4;L<x;L+=2){const O=_[L]=S[L]*y,H=_[L+1]=S[L+1]*w;C.set(U.createBezierPoints(k,D,P,I,O,H),(L-2)*3),[k,D,P,I]=[P,I,O,H]}}if(p.length===0)return null;const A=o?new Zw:new kg;return A.build(p,e,i,1,s,o?0:u,r),{outline:A,newCurves:v,areContours:o,thickness:u,width:h,height:c}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:s,height:r}){let a=1/0,o=-1/0,l=0;for(const E of t){l+=E.length;for(let S=2,x=E.length;S<x;S++){const _=E[S]-E[S-2];a=Math.min(a,_),o=Math.max(o,_)}}let h;a>=-128&&o<=127?h=Int8Array:a>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const c=t.length,u=Fg+nu*c,p=new Uint32Array(u);let b=0;p[b++]=u*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*h.BYTES_PER_ELEMENT,p[b++]=0,p[b++]=s,p[b++]=r,p[b++]=e?0:1,p[b++]=Math.max(0,Math.floor(i??0)),p[b++]=c,p[b++]=h.BYTES_PER_ELEMENT;for(const E of t)p[b++]=E.length-2,p[b++]=E[0],p[b++]=E[1];const y=new CompressionStream("deflate-raw"),w=y.writable.getWriter();await w.ready,w.write(p);const v=h.prototype.constructor;for(const E of t){const S=new v(E.length-2);for(let x=2,_=E.length;x<_;x++)S[x-2]=E[x]-E[x-2];w.write(S)}return w.close(),(await new Response(y.readable).bytes()).toBase64()}static async decompressSignature(t){try{const e=Uint8Array.fromBase64(t),{readable:i,writable:s}=new DecompressionStream("deflate-raw"),r=s.getWriter();await r.ready,r.write(e).then(async()=>{await r.ready,await r.close()}).catch(()=>{});let a=null,o=0;for await(const S of i)a||(a=new Uint8Array(new Uint32Array(S.buffer,0,4)[0])),a.set(S,o),o+=S.length;const l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const c=l[2],u=l[3],p=l[4]===0,b=l[5],y=l[6],w=l[7],v=[],A=(Fg+nu*y)*Uint32Array.BYTES_PER_ELEMENT;let E;switch(w){case Int8Array.BYTES_PER_ELEMENT:E=new Int8Array(a.buffer,A);break;case Int16Array.BYTES_PER_ELEMENT:E=new Int16Array(a.buffer,A);break;case Int32Array.BYTES_PER_ELEMENT:E=new Int32Array(a.buffer,A);break}o=0;for(let S=0;S<y;S++){const x=l[nu*S+Fg],_=new Float32Array(x+2);v.push(_);for(let C=0;C<nu-1;C++)_[C]=l[nu*S+Fg+C+1];for(let C=0;C<x;C++)_[C+2]=_[C]+E[o++]}return{areContours:p,thickness:b,outlines:v,width:c,height:u}}catch(e){return J(`decompressSignature: ${e}`),null}}},ql=new WeakMap,ft=new WeakSet,Jw=function(t,e,i,s){return i-=t,s-=e,i===0?s>0?0:4:i===1?s+6:2-s},_s=new WeakMap,tx=function(t,e,i,s,r,a,o){const l=g(this,ft,Jw).call(this,i,s,r,a);for(let h=0;h<8;h++){const c=(-h+l-o+16)%8,u=n(this,_s)[2*c],p=n(this,_s)[2*c+1];if(t[(i+u)*e+(s+p)]!==0)return c}return-1},ex=function(t,e,i,s,r,a,o){const l=g(this,ft,Jw).call(this,i,s,r,a);for(let h=0;h<8;h++){const c=(h+l+o+16)%8,u=n(this,_s)[2*c],p=n(this,_s)[2*c+1];if(t[(i+u)*e+(s+p)]!==0)return c}return-1},tv=function(t,e,i,s){const r=t.length,a=new Int32Array(r);for(let c=0;c<r;c++)a[c]=t[c]<=s?1:0;for(let c=1;c<i-1;c++)a[c*e]=a[c*e+e-1]=0;for(let c=0;c<e;c++)a[c]=a[e*i-1-c]=0;let o=1,l;const h=[];for(let c=1;c<i-1;c++){l=1;for(let u=1;u<e-1;u++){const p=c*e+u,b=a[p];if(b===0)continue;let y=c,w=u;if(b===1&&a[p-1]===0)o+=1,w-=1;else if(b>=1&&a[p+1]===0)o+=1,w+=1,b>1&&(l=b);else{b!==1&&(l=Math.abs(b));continue}const v=[u,c],A=w===u+1,E={isHole:A,points:v,id:o,parent:0};h.push(E);let S;for(const L of h)if(L.id===l){S=L;break}S?S.isHole?E.parent=A?S.parent:l:E.parent=A?l:S.parent:E.parent=A?l:0;const x=g(this,ft,tx).call(this,a,e,c,u,y,w,0);if(x===-1){a[p]=-o,a[p]!==1&&(l=Math.abs(a[p]));continue}let _=n(this,_s)[2*x],C=n(this,_s)[2*x+1];const k=c+_,D=u+C;y=k,w=D;let P=c,I=u;for(;;){const L=g(this,ft,ex).call(this,a,e,P,I,y,w,1);_=n(this,_s)[2*L],C=n(this,_s)[2*L+1];const O=P+_,H=I+C;v.push(H,O);const W=P*e+I;if(a[W+1]===0?a[W]=-o:a[W]===1&&(a[W]=o),O===c&&H===u&&P===k&&I===D){a[p]!==1&&(l=Math.abs(a[p]));break}else y=P,w=I,P=O,I=H}}}return h}
55,xm=function(t,e,i,s){if(i-e<=4){for(let k=e;k<i-2;k+=2)s.push(t[k],t[k+1]);return}const r=t[e],a=t[e+1],o=t[i-4]-r,l=t[i-3]-a,h=Math.hypot(o,l),c=o/h,u=l/h,p=c*a-u*r,b=l/o,y=1/h,w=Math.atan(b),v=Math.cos(w),A=Math.sin(w),E=y*(Math.abs(v)+Math.abs(A)),S=y*(1-E+E**2),x=Math.max(Math.atan(Math.abs(A+v)*S),Math.atan(Math.abs(A-v)*S));let _=0,C=e;for(let k=e+2;k<i-2;k+=2){const D=Math.abs(p-c*t[k+1]+u*t[k]);D>_&&(C=k,_=D)}_>(h*x)**2?(g(this,ft,xm).call(this,t,e,C+2,s),g(this,ft,xm).call(this,t,C,i,s)):s.push(r,a)},ix=function(t){const e=[],i=t.length;return g(this,ft,xm).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},sx=function(t,e,i,s,r,a){const o=new Float32Array(a**2),l=-2*s**2,h=a>>1;for(let w=0;w<a;w++){const v=(w-h)**2;for(let A=0;A<a;A++)o[w*a+A]=Math.exp((v+(A-h)**2)/l)}const c=new Float32Array(256),u=-2*r**2;for(let w=0;w<256;w++)c[w]=Math.exp(w**2/u);const p=t.length,b=new Uint8Array(p),y=new Uint32Array(256);for(let w=0;w<i;w++)for(let v=0;v<e;v++){const A=w*e+v,E=t[A];let S=0,x=0;for(let C=0;C<a;C++){const k=w+C-h;if(!(k<0||k>=i))for(let D=0;D<a;D++){const P=v+D-h;if(P<0||P>=e)continue;const I=t[k*e+P],L=o[C*a+D]*c[Math.abs(I-E)];S+=I*L,x+=L}}const _=b[A]=Math.round(S/x);y[_]++}return[b,y]},nx=function(t){const e=new Uint32Array(256);for(const i of t)e[i]++;return e},ev=function(t){const e=t.length,i=new Uint8ClampedArray(e>>2);let s=-1/0,r=1/0;for(let o=0,l=i.length;o<l;o++){const h=i[o]=t[o<<2];s=Math.max(s,h),r=Math.min(r,h)}const a=255/(s-r);for(let o=0,l=i.length;o<l;o++)i[o]=(i[o]-r)*a;return i},iv=function(t){let e,i=-1/0,s=-1/0;const r=t.findIndex(l=>l!==0);let a=r,o=r;for(e=r;e<256;e++){const l=t[e];l>i&&(e-a>s&&(s=e-a,o=e-1),i=l,a=e)}for(e=o-1;e>=0&&!(t[e]>t[e+1]);e--);return e},rx=function(t){const e=t,{width:i,height:s}=t,{maxDim:r}=n(this,ql);let a=i,o=s;if(i>r||s>r){let p=i,b=s,y=Math.log2(Math.max(i,s)/r);const w=Math.floor(y);y=y===w?w-1:w;for(let A=0;A<y;A++){a=Math.ceil(p/2),o=Math.ceil(b/2);const E=new OffscreenCanvas(a,o);E.getContext("2d").drawImage(t,0,0,p,b,0,0,a,o),p=a,b=o,t!==e&&t.close(),t=E.transferToImageBitmap()}const v=Math.min(r/a,r/o);a=Math.round(a*v),o=Math.round(o*v)}const h=new OffscreenCanvas(a,o).getContext("2d",{willReadFrequently:!0});h.fillStyle="white",h.fillRect(0,0,a,o),h.filter="grayscale(1)",h.drawImage(t,0,0,t.width,t.height,0,0,a,o);const c=h.getImageData(0,0,a,o).data;return[g(this,ft,ev).call(this,c),a,o]},m(au,ft),m(au,ql,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),m(au,_s,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])),au);class pA extends dA{constructor(){super(),super.updateProperties({fill:Ct._defaultLineColor,"stroke-width":0})}clone(){const t=new pA;return t.updateAll(this),t}}class gA extends Xb{constructor(t){super(t),super.updateProperties({stroke:Ct._defaultLineColor,"stroke-width":1})}clone(){const t=new gA(this._viewParameters);return t.updateAll(this),t}}var Ma,hn,Ia,Ql;const yi=class yi extends Vu{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});m(this,Ma,!1);m(this,hn,null);m(this,Ia,null);m(this,Ql,null);this._willKeepAspectRatio=!0,f(this,Ia,e.signatureData||null),f(this,hn,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,i){Ct.initialize(e,i),this._defaultDrawingOptions=new pA,this._defaultDrawnSignatureOptions=new gA(i.viewParameters)}static getDefaultDrawingOptions(e){const i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!1}static get typesMap(){return Y(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!n(this,hn)}}static computeTelemetryFinalData(e){const i=e.get("hasDescription");return{hasAltText:i.get(!0)??0,hasNoAltText:i.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,i;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,e=this.x,i=this.y),super.render(),this._drawId===null)if(n(this,Ia)){const{lines:r,mustSmooth:a,areContours:o,description:l,uuid:h,heightInPage:c}=n(this,Ia),{rawDims:{pageWidth:u,pageHeight:p},rotation:b}=this.parent.viewport,y=Lh.processDrawnLines({lines:r,pageWidth:u,pageHeight:p,rotation:b,innerMargin:yi._INNER_MARGIN,mustSmooth:a,areContours:o});this.addSignature(y,c,l,h)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:n(this,hn)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(e,i)),this.div}setUuid(e){f(this,Ql,e),this.addEditToolbar()}getUuid(){return n(this,Ql)}get description(){return n(this,hn)}set description(e){f(this,hn,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(i=>{i==null||i.updateEditSignatureButton(e)}))}getSignaturePreview(){const{newCurves:e,areContours:i,thickness:s,width:r,height:a}=n(this,Ia),o=Math.max(r,a),l=Lh.processDrawnLines({lines:{curves:e.map(h=>({points:h})),thickness:s,width:r,height:a},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:i});return{areContours:i,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,i,s,r){const{x:a,y:o}=this,{outline:l}=f(this,Ia,e);f(this,Ma,l instanceof Zw),this.description=s;let h;n(this,Ma)?h=yi.getDefaultDrawingOptions():(h=yi._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[,c]=this.pageDimensions;let u=i/c;u=u>=1?.5:u,this.width*=u/this.height,this.width>=1&&(u*=.9/this.width,this.width=.9),this.height=u,this.setDims(),this.x=a,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(r),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!r,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(e){const{rawDims:{pageWidth:i,pageHeight:s},rotation:r}=this.parent.viewport;return Lh.process(e,i,s,r,yi._INNER_MARGIN)}getFromText(e,i){const{rawDims:{pageWidth:s,pageHeight:r},rotation:a}=this.parent.viewport;return Lh.extractContoursFromText(e,i,s,r,a,yi._INNER_MARGIN)}getDrawnSignature(e){const{rawDims:{pageWidth:i,pageHeight:s},rotation:r}=this.parent.viewport;return Lh.processDrawnLines({lines:e,pageWidth:i,pageHeight:s,rotation:r,innerMargin:yi._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=yi.getDefaultDrawingOptions():(this._drawingOptions=yi._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(e=!1){if(this.isEmpty())return null;const{lines:i,points:s}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":r}}=this,a=Object.assign(super.serialize(e),{isSignature:!0,areContours:n(this,Ma),color:[0,0,0],thickness:n(this,Ma)?0:r});return this.addComment(a),e?(a.paths={lines:i,points:s},a.uuid=n(this,Ql),a.isCopy=!0):a.lines=i,n(this,hn)&&(a.accessibilityData={type:"Figure",alt:n(this,hn)}),a}static deserializeDraw(e,i,s,r,a,o){return o.areContours?Zw.deserialize(e,i,s,r,a,o):kg.deserialize(e,i,s,r,a,o)}static async deserialize(e,i,s){var a;const r=await super.deserialize(e,i,s);return f(r,Ma,e.areContours),r.description=((a=e.accessibilityData)==null?void 0:a.alt)||"",f(r,Ql,e.uuid),r}};Ma=new WeakMap,hn=new WeakMap,Ia=new WeakMap,Ql=new WeakMap,T(yi,"_type","signature"),T(yi,"_editorType",Z.SIGNATURE),T(yi,"_defaultDrawingOptions",null);let sv=yi;var Bt,Ae,Da,nr,La,ld,rr,Zl,cn,Li,hd,ht,Cu,Pu,_m,Cm,Pm,rv,Tm,ax;
55class nv extends Ct{constructor(e){super({...e,name:"stampEditor"});m(this,ht);m(this,Bt,null);m(this,Ae,null);m(this,Da,null);m(this,nr,null);m(this,La,null);m(this,ld,"");m(this,rr,null);m(this,Zl,!1);m(this,cn,null);m(this,Li,!1);m(this,hd,!1);f(this,nr,e.bitmapUrl),f(this,La,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){Ct.initialize(e,i)}static isHandlingMimeForPasting(e){return Cy.includes(e)}static paste(e,i){i.pasteEditor({mode:Z.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){const i=e.get("hasAltText");return{hasAltText:i.get(!0)??0,hasNoAltText:i.get(!1)??0}}async mlGuessAltText(e=null,i=!0){if(this.hasAltTextData())return null;const{mlManager:s}=this._uiManager;if(!s)throw new Error("No ML.");if(!await s.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:r,width:a,height:o}=e||this.copyCanvas(null,null,!0).imageData,l=await s.guess({name:"altText",request:{data:r,width:a,height:o,channels:r.length/(a*o)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return await this.setGuessedAltText(h),i&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var e;n(this,Ae)&&(f(this,Bt,null),this._uiManager.imageManager.deleteId(n(this,Ae)),(e=n(this,rr))==null||e.remove(),f(this,rr,null),n(this,cn)&&(clearTimeout(n(this,cn)),f(this,cn,null))),super.remove()}rebuild(){if(!this.parent){n(this,Ae)&&g(this,ht,_m).call(this);return}super.rebuild(),this.div!==null&&(n(this,Ae)&&n(this,rr)===null&&g(this,ht,_m).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(n(this,Da)||n(this,Bt)||n(this,nr)||n(this,La)||n(this,Ae)||n(this,Zl))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,i;return this._isCopy&&(e=this.x,i=this.y),super.render(),this.div.hidden=!0,this.createAltText(),n(this,Zl)||(n(this,Bt)?g(this,ht,Cm).call(this):g(this,ht,_m).call(this)),this._isCopy&&this._moveAfterPaste(e,i),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,i){const{id:s,bitmap:r}=this._uiManager.imageManager.getFromCanvas(e,i);i.remove(),s&&this._uiManager.imageManager.isValidId(s)&&(f(this,Ae,s),r&&f(this,Bt,r),f(this,Zl,!1),g(this,ht,Cm).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;n(this,cn)!==null&&clearTimeout(n(this,cn)),f(this,cn,setTimeout(()=>{f(this,cn,null),g(this,ht,rv).call(this)},200))}copyCanvas(e,i,s=!1){e||(e=224);const{width:r,height:a}=n(this,Bt),o=new uo;let l=n(this,Bt),h=r,c=a,u=null;if(i){if(r>i||a>i){const k=Math.min(i/r,i/a);h=Math.floor(r*k),c=Math.floor(a*k)}u=document.createElement("canvas");const b=u.width=Math.ceil(h*o.sx),y=u.height=Math.ceil(c*o.sy);n(this,Li)||(l=g(this,ht,Pm).call(this,b,y));const w=u.getContext("2d");w.filter=this._uiManager.hcmFilter;let v="white",A="#cfcfd8";this._uiManager.hcmFilter!=="none"?A="black":Y_.isDarkMode&&(v="#8f8f9d",A="#42414d");const E=15,S=E*o.sx,x=E*o.sy,_=new OffscreenCanvas(S*2,x*2),C=_.getContext("2d");C.fillStyle=v,C.fillRect(0,0,S*2,x*2),C.fillStyle=A,C.fillRect(0,0,S,x),C.fillRect(S,x,S,x),w.fillStyle=w.createPattern(_,"repeat"),w.fillRect(0,0,b,y),w.drawImage(l,0,0,l.width,l.height,0,0,b,y)}let p=null;if(s){let b,y;if(o.symmetric&&l.width<e&&l.height<e)b=l.width,y=l.height;else if(l=n(this,Bt),r>e||a>e){const A=Math.min(e/r,e/a);b=Math.floor(r*A),y=Math.floor(a*A),n(this,Li)||(l=g(this,ht,Pm).call(this,b,y))}const v=new OffscreenCanvas(b,y).getContext("2d",{willReadFrequently:!0});v.drawImage(l,0,0,l.width,l.height,0,0,b,y),p={width:b,height:y,data:v.getImageData(0,0,b,y).data}}return{canvas:u,width:h,height:c,imageData:p}}static async deserialize(e,i,s){var v;let r=null,a=!1;if(e instanceof _S){const{data:{rect:A,rotation:E,id:S,structParent:x,popupRef:_,richText:C,contentsObj:k,creationDate:D,modificationDate:P},container:I,parent:{page:{pageNumber:L}},canvas:O}=e;let H,W;O?(delete e.canvas,{id:H,bitmap:W}=s.imageManager.getFromCanvas(I.id,O),O.remove()):(a=!0,e._hasNoCanvas=!0);const pt=((v=await i._structTree.getAriaAttributes(`${Fh}${S}`))==null?void 0:v.get("aria-label"))||"";r=e={annotationType:Z.STAMP,bitmapId:H,bitmap:W,pageIndex:L-1,rect:A.slice(0),rotation:E,annotationElementId:S,id:S,deleted:!1,accessibilityData:{decorative:!1,altText:pt},isSvg:!1,structParent:x,popupRef:_,richText:C,comment:(k==null?void 0:k.str)||null,creationDate:D,modificationDate:P}}const o=await super.deserialize(e,i,s),{rect:l,bitmap:h,bitmapUrl:c,bitmapId:u,isSvg:p,accessibilityData:b}=e;a?(s.addMissingCanvas(e.id,o),f(o,Zl,!0)):u&&s.imageManager.isValidId(u)?(f(o,Ae,u),h&&f(o,Bt,h)):f(o,nr,c),f(o,Li,p);const[y,w]=o.pageDimensions;return o.width=(l[2]-l[0])/y,o.height=(l[3]-l[1])/w,b&&(o.altTextData=b),o._initialData=r,e.comment&&o.setCommentData(e),f(o,hd,!!r),o}serialize(e=!1,i=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Object.assign(super.serialize(e),{bitmapId:n(this,Ae),isSvg:n(this,Li)});if(this.addComment(s),e)return s.bitmapUrl=g(this,ht,Tm).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:r,altText:a}=this.serializeAltText(!1);if(!r&&a&&(s.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const l=g(this,ht,ax).call(this,s);return l.isSame?null:(l.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=this._initialData.structParent??-1,s.id=this.annotationElementId,delete s.bitmapId,s)}if(i===null)return s;i.stamps||(i.stamps=new Map);const o=n(this,Li)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!i.stamps.has(n(this,Ae)))i.stamps.set(n(this,Ae),{area:o,serialized:s}),s.bitmap=g(this,ht,Tm).call(this,!1);else if(n(this,Li)){const l=i.stamps.get(n(this,Ae));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=g(this,ht,Tm).call(this,!1))}return s}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Bt=new WeakMap,Ae=new WeakMap,Da=new WeakMap,nr=new WeakMap,La=new WeakMap,ld=new WeakMap,rr=new WeakMap,Zl=new WeakMap,cn=new WeakMap,Li=new WeakMap,hd=new WeakMap,ht=new WeakSet,Cu=function(e,i=!1){if(!e){this.remove();return}f(this,Bt,e.bitmap),i||(f(this,Ae,e.id),f(this,Li,e.isSvg)),e.file&&f(this,ld,e.file.name),g(this,ht,Cm).call(this)},Pu=function(){if(f(this,Da,null),this._uiManager.enableWaiting(!1),!!n(this,rr)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&n(this,Bt)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&n(this,Bt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},_m=function(){if(n(this,Ae)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(n(this,Ae)).then(s=>g(this,ht,Cu).call(this,s,!0)).finally(()=>g(this,ht,Pu).call(this));return}if(n(this,nr)){const s=n(this,nr);f(this,nr,null),this._uiManager.enableWaiting(!0),f(this,Da,this._uiManager.imageManager.getFromUrl(s).then(r=>g(this,ht,Cu).call(this,r)).finally(()=>g(this,ht,Pu).call(this)));return}if(n(this,La)){const s=n(this,La);f(this,La,null),this._uiManager.enableWaiting(!0),f(this,Da,this._uiManager.imageManager.getFromFile(s).then(r=>g(this,ht,Cu).call(this,r)).finally(()=>g(this,ht,Pu).call(this)));return}const e=document.createElement("input");e.type="file",e.accept=Cy.join(",");const i=this._uiManager._signal;f(this,Da,new Promise(s=>{e.addEventListener("change",async()=>
55{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const r=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),g(this,ht,Cu).call(this,r)}s()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),s()},{signal:i})}).finally(()=>g(this,ht,Pu).call(this))),e.click()},Cm=function(){var h;const{div:e}=this;let{width:i,height:s}=n(this,Bt);const[r,a]=this.pageDimensions,o=.75;if(this.width)i=this.width*r,s=this.height*a;else if(i>o*r||s>o*a){const c=Math.min(o*r/i,o*a/s);i*=c,s*=c}this._uiManager.enableWaiting(!1);const l=f(this,rr,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=i/r,this.height=s/a,this.setDims(),(h=this._initialOptions)!=null&&h.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),g(this,ht,rv).call(this),n(this,hd)||(this.parent.addUndoableEditor(this),f(this,hd,!0)),this._reportTelemetry({action:"inserted_image"}),n(this,ld)&&this.div.setAttribute("aria-description",n(this,ld)),this.annotationElementId||this._uiManager.a11yAlert(Ct._l10nAlert.stamp)},Pm=function(e,i){const{width:s,height:r}=n(this,Bt);let a=s,o=r,l=n(this,Bt);for(;a>2*e||o>2*i;){const h=a,c=o;a>2*e&&(a=Math.ceil(a/2)),o>2*i&&(o=Math.ceil(o/2));const u=new OffscreenCanvas(a,o);u.getContext("2d").drawImage(l,0,0,h,c,0,0,a,o),l=u.transferToImageBitmap()}return l},rv=function(){const[e,i]=this.parentDimensions,{width:s,height:r}=this,a=new uo,o=Math.ceil(s*e*a.sx),l=Math.ceil(r*i*a.sy),h=n(this,rr);if(!h||h.width===o&&h.height===l)return;h.width=o,h.height=l;const c=n(this,Li)?n(this,Bt):g(this,ht,Pm).call(this,o,l),u=h.getContext("2d");u.filter=this._uiManager.hcmFilter,u.drawImage(c,0,0,c.width,c.height,0,0,o,l)},Tm=function(e){if(e){if(n(this,Li)){const r=this._uiManager.imageManager.getSvgUrl(n(this,Ae));if(r)return r}const i=document.createElement("canvas");return{width:i.width,height:i.height}=n(this,Bt),i.getContext("2d").drawImage(n(this,Bt),0,0),i.toDataURL()}if(n(this,Li)){const[i,s]=this.pageDimensions,r=Math.round(this.width*i*Wd.PDF_TO_CSS_UNITS),a=Math.round(this.height*s*Wd.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(r,a);return o.getContext("2d").drawImage(n(this,Bt),0,0,n(this,Bt).width,n(this,Bt).height,0,0,r,a),o.transferToImageBitmap()}return structuredClone(n(this,Bt))},ax=function(e){var o;const{pageIndex:i,accessibilityData:{altText:s}}=this._initialData,r=e.pageIndex===i,a=(((o=e.accessibilityData)==null?void 0:o.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&a,isSameAltText:a}},T(nv,"_type","stamp"),T(nv,"_editorType",Z.STAMP);var Jl,cd,Ra,Na,ar,di,Fa,dd,ud,Cs,or,ui,lr,Oa,fd,V,mi,Ba,Pt,av,ox,Fs,ov,lv,km;let jP=(mi=class{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:s,accessibilityManager:r,annotationLayer:a,drawLayer:o,textLayer:l,viewport:h,l10n:c}){m(this,Pt);m(this,Jl);m(this,cd,!1);m(this,Ra,null);m(this,Na,null);m(this,ar,null);m(this,di,new Map);m(this,Fa,!1);m(this,dd,!1);m(this,ud,!1);m(this,Cs,null);m(this,or,null);m(this,ui,null);m(this,lr,null);m(this,Oa,null);m(this,fd,-1);m(this,V);const u=[...n(mi,Ba).values()];if(!mi._initialized){mi._initialized=!0;for(const p of u)p.initialize(c,t)}t.registerEditorTypes(u),f(this,V,t),this.pageIndex=e,this.div=i,f(this,Jl,r),f(this,Ra,a),this.viewport=h,f(this,ui,l),this.drawLayer=o,this._structTree=s,n(this,V).addLayer(this)}get isEmpty(){return n(this,di).size===0}get isInvisible(){return this.isEmpty&&n(this,V).getMode()===Z.NONE}updateToolbar(t){n(this,V).updateToolbar(t)}updateMode(t=n(this,V).getMode()){switch(g(this,Pt,km).call(this),t){case Z.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Z.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Z.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===Z.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(const i of n(mi,Ba).values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){var e;return t===((e=n(this,ui))==null?void 0:e.div)}setEditingState(t){n(this,V).setEditingState(t)}addCommands(t){n(this,V).addCommands(t)}cleanUndoStack(t){n(this,V).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){var e;(e=n(this,Ra))==null||e.togglePointerEvents(t)}async enable(){var i;f(this,ud,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(i=n(this,Oa))==null||i.abort(),f(this,Oa,null);const t=new Set;for(const s of n(this,Pt,av))s.enableEditing(),s.show(!0),s.annotationElementId&&(n(this,V).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));const e=n(this,Ra);if(e)for(const s of e.getEditableAnnotations()){if(s.hide(),n(this,V).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const r=await this.deserialize(s);r&&(this.addOrRebuild(r),r.enableEditing())}f(this,ud,!1),n(this,V)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var s;if(f(this,dd,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),n(this,ui)&&!n(this,Oa)){f(this,Oa,new AbortController);const r=n(this,V).combinedSignal(n(this,Oa));n(this,ui).div.addEventListener("pointerdown",a=>{const{clientX:l,clientY:h,timeStamp:c}=a,u=n(this,fd);if(c-u>500){f(this,fd,c);return}f(this,fd,-1);const{classList:p}=this.div;p.toggle("getElements",!0);const b=document.elementsFromPoint(l,h);if(p.toggle("getElements",!1),!this.div.contains(b[0]))return;let y;const w=new RegExp(`^${zd}[0-9]+$`);for(const A of b)if(w.test(A.id)){y=A.id;break}if(!y)return;const v=n(this,di).get(y);(v==null?void 0:v.annotationElementId)===null&&(fe(a),v.dblclick(a))},{signal:r,capture:!0})}const t=n(this,Ra),e=[];
55if(t){const r=new Map,a=new Map;for(const o of n(this,Pt,av)){if(o.disableEditing(),!o.annotationElementId){e.push(o);continue}if(o.serialize()!==null){r.set(o.annotationElementId,o);continue}else a.set(o.annotationElementId,o);(s=this.getEditableAnnotation(o.annotationElementId))==null||s.show(),o.remove()}for(const o of t.getEditableAnnotations()){const{id:l}=o.data;if(n(this,V).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let h=a.get(l);if(h){h.resetAnnotationElement(o),h.show(!1),o.show();continue}h=r.get(l),h&&(n(this,V).addChangedExistingAnnotation(h),h.renderAnnotationElement(o)&&h.show(!1)),o.show()}}g(this,Pt,km).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const r of n(mi,Ba).values())i.remove(`${r._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t==null||t.updateFakeAnnotations(e),f(this,dd,!1)}getEditableAnnotation(t){var e;return((e=n(this,Ra))==null?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){n(this,V).getActive()!==t&&n(this,V).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(t=n(this,ui))!=null&&t.div&&!n(this,lr)){f(this,lr,new AbortController);const e=n(this,V).combinedSignal(n(this,lr));n(this,ui).div.addEventListener("pointerdown",g(this,Pt,ox).bind(this),{signal:e}),n(this,ui).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(t=n(this,ui))!=null&&t.div&&n(this,lr)&&(n(this,lr).abort(),f(this,lr,null),n(this,ui).div.classList.remove("highlighting"))}enableClick(){if(n(this,Na))return;f(this,Na,new AbortController);const t=n(this,V).combinedSignal(n(this,Na));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){var t;(t=n(this,Na))==null||t.abort(),f(this,Na,null)}attach(t){n(this,di).set(t.id,t);const{annotationElementId:e}=t;e&&n(this,V).isDeletedAnnotationElement(e)&&n(this,V).removeDeletedAnnotationElement(t)}detach(t){var e;n(this,di).delete(t.id),(e=n(this,Jl))==null||e.removePointerInTextLayer(t.contentDiv),!n(this,dd)&&t.annotationElementId&&n(this,V).addDeletedAnnotationElement(t)}remove(t){this.detach(t),n(this,V).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&(n(this,V).addDeletedAnnotationElement(t),Ct.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),(e=t.parent)==null||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),n(this,V).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!n(this,ud)),n(this,V).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var i;if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!n(this,ar)&&(t._focusEventsAllowed=!1,f(this,ar,setTimeout(()=>{f(this,ar,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:n(this,V)._signal}),e.focus())},0))),t._structTreeParentId=(i=n(this,Jl))==null?void 0:i.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),i=()=>{t.remove()};this.addCommands({cmd:e,undo:i,mustExec:!1})}getEditorByUID(t){for(const e of n(this,di).values())if(e.uid===t)return e;return null}combinedSignal(t){return n(this,V).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return(t=n(this,Pt,Fs))==null?void 0:t.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await n(this,V).updateMode(t.mode);const{offsetX:i,offsetY:s}=g(this,Pt,lv).call(this),r=n(this,V).getId(),a=g(this,Pt,ov).call(this,{parent:this,id:r,x:i,y:s,uiManager:n(this,V),isCentered:!0,...e});a&&this.add(a)}async deserialize(t){var e;return await((e=n(mi,Ba).get(t.annotationType??t.annotationEditorType))==null?void 0:e.deserialize(t,this,n(this,V)))||null}createAndAddNewEditor(t,e,i={}){const s=n(this,V).getId(),r=g(this,Pt,ov).call(this,{parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:n(this,V),isCentered:e,...i});return r&&this.add(r),r}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(g(this,Pt,lv).call(this),!0,t)}setSelected(t){n(this,V).setSelected(t)}toggleSelected(t){n(this,V).toggleSelected(t)}unselect(t){n(this,V).unselect(t)}pointerup(t){var s;const{isMac:e}=xt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!n(this,Fa)||(f(this,Fa,!1),(s=n(this,Pt,Fs))!=null&&s.isDrawer&&n(this,Pt,Fs).supportMultipleDrawings))return;if(!n(this,cd)){f(this,cd,!0);return}const i=n(this,V).getMode();if(i===Z.STAMP||i===Z.POPUP||i===Z.SIGNATURE){n(this,V).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){var s;if(n(this,V).getMode()===Z.HIGHLIGHT&&this.enableTextSelection(),n(this,Fa)){f(this,Fa,!1);return}const{isMac:e}=xt.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(f(this,Fa,!0),(s=n(this,Pt,Fs))!=null&&s.isDrawer){this.startDrawingSession(t);return}const i=n(this,V).getActive();f(this,cd,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),n(this,Cs)){n(this,Pt,Fs).startDrawing(this,n(this,V),!1,t);return}n(this,V).setCurrentDrawingSession(this),f(this,Cs,new AbortController);const e=n(this,V).combinedSignal(n(this,Cs));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(f(this,or,null),this.commitOrRemove())},{signal:e}),n(this,Pt,Fs).startDrawing(this,n(this,V),!1,t)}pause(t){if(t){const{activeElement:e}=document;this.div.contains(e)&&f(this,or,e);return}n(this,or)&&setTimeout(()=>{var e;(e=n(this,or))==null||e.focus(),f(this,or,null)},0)}endDrawingSession(t=!1){return n(this,Cs)?(n(this,V).setCurrentDrawingSession(null),n(this,Cs).abort(),f(this,Cs,null),f(this,or,null),n(this,Pt,Fs).endDrawing(t)):null}findNewParent(t,e,i){const s=n(this,V).findParent(e,i);return s===null||s===this?!1:(s.changeParent(t),!0)}commitOrRemove(){return n(this,Cs)?(this.endDrawingSession(),!0):!1}onScaleChanging(){n(this,Cs)&&n(this,Pt,Fs).onScaleChangingWhenDrawing(this)}destroy(){var t,e;this.commitOrRemove(),((t=n(this,V).getActive())==null?void 0:t.parent)===this&&(n(this,V).commitOrRemove(),n(this,V).setA
55ctiveEditor(null)),n(this,ar)&&(clearTimeout(n(this,ar)),f(this,ar,null));for(const i of n(this,di).values())(e=n(this,Jl))==null||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,n(this,di).clear(),n(this,V).removeLayer(this)}async render({viewport:t}){this.viewport=t,yh(this.div,t);for(const e of n(this,V).getEditors(this.pageIndex))this.add(e),e.rebuild();await n(this,V).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){n(this,V).commitOrRemove(),g(this,Pt,km).call(this);const e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,yh(this.div,{rotation:i}),e!==i)for(const s of n(this,di).values())s.rotate(i)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return n(this,V).viewParameters.realScale}},Jl=new WeakMap,cd=new WeakMap,Ra=new WeakMap,Na=new WeakMap,ar=new WeakMap,di=new WeakMap,Fa=new WeakMap,dd=new WeakMap,ud=new WeakMap,Cs=new WeakMap,or=new WeakMap,ui=new WeakMap,lr=new WeakMap,Oa=new WeakMap,fd=new WeakMap,V=new WeakMap,Ba=new WeakMap,Pt=new WeakSet,av=function(){return n(this,di).size!==0?n(this,di).values():n(this,V).getEditors(this.pageIndex)},ox=function(t){n(this,V).unselectAll();const{target:e}=t;if(e===n(this,ui).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent")||e.classList.contains("textLayerImages")||e.classList.contains("textLayerImagePlaceholder"))&&n(this,ui).div.contains(e)){const{isMac:i}=xt.platform;if(t.button!==0||t.ctrlKey&&i)return;n(this,V).showAllEditors("highlight",!0,!0),Qm.startDrawing(this,n(this,V),n(this,V).direction==="ltr",t),t.preventDefault()}},Fs=function(){return n(mi,Ba).get(n(this,V).getMode())},ov=function(t){const e=n(this,Pt,Fs);return e?new e.prototype.constructor(t):null},lv=function(){const{x:t,y:e,width:i,height:s}=this.boundingClientRect,r=Math.max(0,t),a=Math.max(0,e),o=Math.min(window.innerWidth,t+i),l=Math.min(window.innerHeight,e+s),h=(r+o)/2-t,c=(a+l)/2-e,[u,p]=this.viewport.rotation%180===0?[h,c]:[c,h];return{offsetX:u,offsetY:p}},km=function(){for(const t of n(this,di).values())t.isEmpty()&&t.remove()},T(mi,"_initialized",!1),m(mi,Ba,new Map([Fw,Qw,nv,Qm,sv].map(t=>[t._editorType,t]))),mi);function UP(d,t){return d===t?0:d.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function Og(d){var t;return d?d.nodeType===Node.ELEMENT_NODE?d.closest(".textLayer"):((t=d.parentElement)==null?void 0:t.closest(".textLayer"))||null:null}function $P(d,t,e,i){if(d===e)return t<=i;const s=d.compareDocumentPosition(e);return s&Node.DOCUMENT_POSITION_FOLLOWING?!0:s&Node.DOCUMENT_POSITION_PRECEDING?!1:null}function sE(d,t,e){if(d.nodeType!==Node.ELEMENT_NODE||!d.classList.contains("textLayer")||t!==d.childNodes.length)return{container:d,offset:t};let i=d.lastChild;return(i==null?void 0:i.nodeType)===Node.ELEMENT_NODE&&i.classList.contains("endOfContent")&&(i=i.previousSibling),!i||!e.contains(i)?null:i.nodeType===Node.TEXT_NODE?{container:i,offset:i.textContent.length}:{container:i,offset:i.childNodes.length}}var qe,Qe,ns,kp,Mp,th,eh,G,Ip,Cb,ja,Ua,$a,Va,hr,He,hv,cv,lx,Mm,hx,En,dv,cx,uv;let VP=(G=class{constructor({filterFactory:t=null,pageColors:e=null,pageIndex:i,textLayer:s=null}){m(this,En);m(this,qe,null);m(this,Qe,new Map);m(this,ns,null);m(this,kp,null);m(this,Mp,null);m(this,th,null);m(this,eh,new Map);if(this.pageIndex=i,f(this,kp,t),f(this,Mp,e),s){const r=n(G,hr).get(s);if(r!=null&&r.selectionDiv&&(r.selectionDiv.remove(),n(G,Ua).delete(r.selectionDiv)),n(G,hr).set(s,{drawLayer:this}),n(G,Va).add(s),f(this,ns,s),f(this,th,new MutationObserver(a=>{var o,l,h;if(!(!n(this,qe)||!((o=n(this,ns))!=null&&o.isConnected)||!g(l=G,He,cv).call(l))){for(const{addedNodes:c}of a)for(const u of c)if(u.nodeType===Node.ELEMENT_NODE&&u.classList.contains("endOfContent")){g(h=G,He,Mm).call(h);return}}})),n(this,th).observe(s,{childList:!0}),n(G,ja)===null){f(G,ja,new AbortController);const{signal:a}=n(G,ja);document.addEventListener("selectionchange",g(G,He,Mm).bind(G),{signal:a}),document.addEventListener("pointerdown",()=>{f(G,$a,!0)},{signal:a}),document.addEventListener("pointerup",()=>{f(G,$a,!1)},{signal:a}),window.addEventListener("blur",()=>{f(G,$a,!1)},{signal:a})}}}setParent(t){var e,i,s;if(!n(this,qe)){f(this,qe,t),(e=n(this,ns))!=null&&e.isConnected&&g(i=G,He,cv).call(i)&&g(s=G,He,Mm).call(s);return}if(n(this,qe)!==t){if(n(this,Qe).size>0)for(const r of n(this,Qe).values())r.remove(),t.append(r);f(this,qe,t)}}static get _svgFactory(){return Y(this,"_svgFactory",new Km)}draw(t,e=!1,i=!1){const s=kt(G,Ip)._++,r=g(this,En,dv).call(this),a=G._svgFactory.createElement("defs");r.append(a);const o=G._svgFactory.createElement("path");a.append(o);const l=`path_${s}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),e&&n(this,eh).set(s,o);const h=i?g(this,En,cx).call(this,a,l):null,c=G._svgFactory.createElement("use");return r.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(r,t),n(this,Qe).set(s,r),{id:s,clipPathId:`url(#${h})`}}drawOutline(t,e){const i=kt(G,Ip)._++,s=g(this,En,dv).call(this),r=G._svgFactory.createElement("defs");s.append(r);const a=G._svgFactory.createElement("path");r.append(a);const o=`path_${i}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke");let l;if(e){const u=G._svgFactory.createElement("mask");r.append(u),l=`mask_${i}`,u.setAttribute("id",l),u.setAttribute("maskUnits","objectBoundingBox");const p=G._svgFactory.createElement("rect");u.append(p),p.setAttribute("width","1"),p.setAttribute("height","1"),p.setAttribute("fill","white");const b=G._svgFactory.createElement("use");u.append(b),b.setAttribute("href",`#${o}`),b.setAttribute("stroke","none"),b.setAttribute("fill","black"),b.setAttribute("fill-rule","nonzero"),b.classList.add("mask")}const h=G._svgFactory.createElement("use");s.append(h),h.setAttribute("href",`#${o}`),l&&h.setAttribute("mask",`url(#${l})`);const c=h.cloneNode();return s.append(c),h.classList.add("mainOutline"),c.classList.add("secondaryOutline"),this.updateProperties(s,t),n(this,Qe).set(i,s),i}finalizeDraw(t,e){n(this,eh).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var l;if(!e)return;const{root:i,bbox:s,rootClass:r,path:a}=e,o=typeof t=="number"?n(this,Qe).get(t):t;if(o){if(i&&g(this,En,uv).call(this,o,i),s&&g(l=G,He,hx).call(l,o,s),r){const{classList:h}=o;for(const[c,u]of Object.entries(r))h.toggle(c,u)}if(a){const c=o.firstElementChild.firstElementChild;g(this,En,uv).call(this,c,a)}}}updateParent(t,e){if(e===this)return;const i=n(this,Qe).get(t);i&&(n(e,qe).append(i),n(this,Qe).delete(t),n(e,Qe).set(t,i))}remove(t){n(this,eh).delete(t),n(this,qe)!==null&&(n(this,Qe).get(t).remove(),n(this,Qe).delete(t))}destroy(){var t,e,i;f(this,qe,null);for(const s of n(this,Qe).values())s.remove();if(n(this,Qe).clear(),n(this,eh).clear(),(t=n(this,th))==null||t.disconnect(),f(this,th,null),n(this,ns)){const s=n(G,hr).get(n(this,ns));(s==null?void 0:s.drawLayer)===this&&(g(e=G,He,hv).call(e,n(this,ns)),n(G,hr).delete(n(this,ns)),n(G,Va).delete(n(this,ns)),n(G,Va).size===0&&((i=n(G,ja))==null||i.abort(),f(G,ja,null),f(G,$a,!1))),f(this,ns,null)}}},qe=new WeakMap,Qe=new WeakMap,ns=new WeakMap,kp=new WeakMap,Mp=new WeakMap,th=new WeakMap,eh=new WeakMap,Ip=new WeakMap,Cb=new WeakMap,ja=new WeakMap,Ua=new WeakMap,$a=new WeakMap,Va=new WeakMap,hr=ne
55w WeakMap,He=new WeakSet,hv=function(t){const e=n(this,hr).get(t);e!=null&&e.selectionDiv&&(e.selectionDiv.remove(),n(this,Ua).delete(e.selectionDiv),e.selectionDiv=null,e.path=null)},cv=function(){const t=document.getSelection();return!!t&&!t.isCollapsed},lx=function(){return n(this,Va).keys().filter(t=>t.isConnected).toArray().sort(UP)},Mm=function(){var a;const t=document.getSelection();if(!t||t.isCollapsed){for(const o of n(this,Ua))o.remove();n(this,Ua).clear();return}const e=new WeakMap,i=g(this,He,lx).call(this),s=[];for(let o=0,l=t.rangeCount;o<l;o++){const h=t.getRangeAt(o);if(h.collapsed)continue;let{startContainer:c,startOffset:u,endContainer:p,endOffset:b}=h,y=Og(c),w=Og(p);const v=y===null,A=w===null;if(n(this,$a)&&v!==A)return;if(t.rangeCount===1){const{anchorNode:x,anchorOffset:_,focusNode:C,focusOffset:k}=t,D=Og(x),P=Og(C),I=$P(x,_,C,k);D&&P&&I!==null&&(I?(c=x,u=_,y=D,p=C,b=k,w=P):(c=C,u=k,y=P,p=x,b=_,w=D))}const E=i.filter(x=>h.intersectsNode(x));if(E.length===0)continue;let S=!1;if(y||(y=E[0],c=y,u=0,S=!0),w||(w=E.at(-1),p=w,b=w.childNodes.length,S=!0),p.nodeType===Node.ELEMENT_NODE){if(p.classList.contains("endOfContent")){const x=p.previousSibling;if(!x)continue;p=x,b=x.nodeType===Node.TEXT_NODE?x.textContent.length:x.childNodes.length}else if(p.classList.contains("textLayer")&&p.childNodes.length===b){const x=sE(p,b,w);if(!x)continue;p=x.container,b=x.offset}}if(c.nodeType===Node.ELEMENT_NODE){const x=sE(c,u,y);if(!x)continue;c=x.container,u=x.offset}if(y===w&&!S&&E.includes(y)){s.push([h,y]);continue}for(const x of E){const _=x.firstChild;if(!_)continue;const C=document.createRange();if(x===y?C.setStart(c,u):C.setStartBefore(_),x===w)C.setEnd(p,b);
55else{const k=x.lastChild;if(!k)continue;if(k.nodeType===Node.ELEMENT_NODE&&k.classList.contains("endOfContent")){const D=k.previousSibling;if(!D)continue;C.setEndAfter(D)}else C.setEndAfter(k)}C.collapsed||s.push([C,x])}}const r=new Set(s.map(o=>o[1]));for(const o of n(this,Va))r.has(o)||g(this,He,hv).call(this,o);for(const[o,l]of s){const h=n(G,hr).get(l);if(!h)continue;let c=e.get(l);if(!c){const w=l.getBoundingClientRect();c=(v,A,E,S)=>({x:(v-w.x)/w.width,y:(A-w.y)/w.height,width:E/w.width,height:S/w.height}),e.set(l,c)}const u=[];for(let{x:w,y:v,width:A,height:E}of o.getClientRects())A===0||E===0||({x:w,y:v,width:A,height:E}=c(w,v,A,E),!(A===1&&E===1)&&u.push(`M${w} ${v} h${A} v${E} h-${A} Z`));if(u.length===0)continue;const p=h.drawLayer;let b=h.selectionDiv,y=h.path;if(!b){const w=`clip_selection_${kt(G,Cb)._++}`;b=document.createElement("div"),b.className="selection",b.style.clipPath=`url(#${w})`;const v=(a=n(p,kp))==null?void 0:a.createSelectionStyle(n(p,Mp));if(v)for(const[S,x]of Object.entries(v))b.style.setProperty(S,x);const A=G._svgFactory.create(1,1,!0);A.setAttribute("aria-hidden","true"),A.setAttribute("width","100%"),A.setAttribute("height","100%");const E=G._svgFactory.createElement("clipPath");E.setAttribute("id",w),E.setAttribute("clipPathUnits","objectBoundingBox"),y=G._svgFactory.createElement("path"),E.append(y),A.append(E),b.append(A),h.path=y,h.selectionDiv=b}n(p,qe)&&b.parentNode!==n(p,qe)&&(n(p,qe).append(b),n(this,Ua).add(b)),y.setAttribute("d",u.join(" "))}},hx=function(t,[e,i,s,r]){const{style:a}=t;a.top=`${100*i}%`,a.left=`${100*e}%`,a.width=`${100*s}%`,a.height=`${100*r}%`},En=new WeakSet,dv=function(){const t=G._svgFactory.create(1,1,!0);return n(this,qe).append(t),t.setAttribute("aria-hidden","true"),t},cx=function(t,e){const i=G._svgFactory.createElement("clipPath");t.append(i);const s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const r=G._svgFactory.createElement("use");return i.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),s},uv=function(t,e){for(const[i,s]of Object.entries(e))s===null?t.removeAttribute(i):t.setAttribute(i,s)},m(G,He),m(G,Ip,0),m(G,Cb,0),m(G,ja,null),m(G,Ua,new Set),m(G,$a,!1),m(G,Va,new Set),m(G,hr,new WeakMap),G);function Bg(d){return`${(d*100).toFixed(2)}%`}var pd,Dp,Lp,gd,dn,un,ho,Rp,Pb,dx;let HP=(ho=class{constructor(t,e,i,s){m(this,Pb);m(this,pd,[]);m(this,Dp,new Map);m(this,Lp,null);m(this,gd,0);m(this,dn,0);m(this,un,0);f(this,gd,t),f(this,pd,e),f(this,dn,i.rawDims.pageWidth),f(this,un,i.rawDims.pageHeight),f(this,Lp,s)}render(){const t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<n(this,pd).length;e+=6){const i=g(this,Pb,dx).call(this,n(this,pd).subarray(e,e+6));i&&t.append(i)}return t.addEventListener("contextmenu",e=>{var A;if(!(e.target instanceof HTMLCanvasElement))return;const i=e.target,s=n(this,Dp).get(i);if(!s)return;const r=(A=n(ho,Rp))==null?void 0:A.deref();if(r===i)return;r&&(r.width=0,r.height=0),f(ho,Rp,new WeakRef(i));const{inverseTransform:a,x1:o,y1:l,width:h,height:c}=s,u=n(this,Lp).call(this),p=Math.ceil(o*u.width),b=Math.ceil(l*u.height),y=Math.floor((o+h/n(this,dn))*u.width),w=Math.floor((l+c/n(this,un))*u.height);i.width=y-p,i.height=w-b;const v=i.getContext("2d");v.setTransform(...a),v.translate(-p,-b),v.drawImage(u,0,0)}),t}},pd=new WeakMap,Dp=new WeakMap,Lp=new WeakMap,gd=new WeakMap,dn=new WeakMap,un=new WeakMap,Rp=new WeakMap,Pb=new WeakSet,dx=function([t,e,i,s,r,a]){const o=Math.hypot((r-t)*n(this,dn),(a-e)*n(this,un)),l=Math.hypot((i-t)*n(this,dn),(s-e)*n(this,un));if(o<n(this,gd)||l<n(this,gd))return null;const h=[(r-t)*n(this,dn)/o,(a-e)*n(this,un)/o,(i-t)*n(this,dn)/l,(s-e)*n(this,un)/l,0,0],c=N.inverseTransform(h),u=document.createElement("canvas");return u.className="textLayerImagePlaceholder",u.width=0,u.height=0,Object.assign(u.style,{opacity:0,position:"absolute",left:Bg(t),top:Bg(e),width:Bg(o/n(this,dn)),height:Bg(l/n(this,un)),transformOrigin:"0% 0%",transform:`matrix(${h.join(",")})`}),n(this,Dp).set(u,{inverseTransform:c,width:o,height:l,x1:t,y1:e}),u},m(ho,Rp,null),ho);globalThis._pdfjsTestingUtils={HighlightOutliner:Ww};globalThis.pdfjsLib={AbortException:co,AnnotationEditorLayer:jP,AnnotationEditorParamsType:ot,AnnotationEditorType:Z,AnnotationEditorUIManager:ju,AnnotationLayer:TS,AnnotationMode:Or,AnnotationType:Vt,applyOpacity:q_,build:gP,ColorPicker:pS,createValidAbsoluteUrl:$E,CSSConstants:K_,DOMSVGFactory:Km,DrawLayer:VP,FeatureTest:xt,fetchData:nA,findContrastColor:Q_,getDocument:cS,getFilenameFromUrl:W_,getPdfFilenameFromUrl:G_,getRGB:Tg,getRGBA:Pg,getUuid:HE,GlobalWorkerOptions:Br,ImageKind:zg,InvalidPDFException:vy,isDataScheme:Bb,isPdfFile:aA,isValidExplicitDest:yC,makeArr:Zd,makeMap:sA,makeObj:Ey,makeSet:V_,MathClamp:Nt,noContextMenu:Is,normalizeUnicode:U_,OPS:Bs,OutputScale:uo,PasswordException:wy,PasswordResponses:L_,PDFDataRangeTransport:dS,PDFDateString:xy,PDFWorker:vw,PermissionFlag:D_,PixelsPerInch:Wd,RenderingCancelledException:rA,renderRichText:WE,ResponseException:zm,setLayerDimensions:yh,shadow:Y,SignatureExtractor:Lh,stopEvent:fe,SupportedImageMimeTypes:Cy,TextLayer:Xm,TextLayerImages:HP,TouchManager:f0,updateUrlHash:VE,Util:N,VerbosityLevel:Rb,ver
55sion:pP,XfaLayer:zE};const{AbortException:zP,AnnotationEditorLayer:WP,AnnotationEditorParamsType:Ek,AnnotationEditorType:ai,AnnotationEditorUIManager:GP,AnnotationLayer:XP,AnnotationMode:wn,AnnotationType:ux,applyOpacity:Sk,build:xk,ColorPicker:_k,createValidAbsoluteUrl:fx,CSSConstants:Ck,DOMSVGFactory:Pk,DrawLayer:YP,FeatureTest:mA,fetchData:nE,findContrastColor:Tk,getDocument:kk,getFilenameFromUrl:Mk,getPdfFilenameFromUrl:KP,getRGB:Ik,getRGBA:Dk,getUuid:qP,GlobalWorkerOptions:Lk,ImageKind:Rk,InvalidPDFException:Nk,isDataScheme:Fk,isPdfFile:QP,isValidExplicitDest:ZP,makeArr:JP,makeMap:rE,makeObj:Ok,makeSet:tT,MathClamp:eT,noContextMenu:Bk,normalizeUnicode:iT,OPS:jk,OutputScale:Im,PasswordException:sT,PasswordResponses:Uk,PDFDataRangeTransport:$k,PDFDateString:Vk,PDFWorker:Hk,PermissionFlag:Ph,PixelsPerInch:Tn,RenderingCancelledException:fv,renderRichText:zk,ResponseException:Wk,setLayerDimensions:px,shadow:Hu,SignatureExtractor:Gk,stopEvent:pv,SupportedImageMimeTypes:Xk,TextLayer:nT,TextLayerImages:rT,TouchManager:Yk,updateUrlHash:aT,Util:bA,VerbosityLevel:Kk,version:aE,XfaLayer:oE}=globalThis.pdfjsLib;let lE=null,hE=null;function cE(d,t){hE||(hE=new Intl.Segmenter(void 0,{granularity:"grapheme"}));const e=hE.segment(d),i=e.containing(t);if(i.index!==t)return!1;lE||(lE=new Intl.Segmenter(void 0,{granularity:"word"}));const s=e.containing(t-1).segment;return lE.segment(s+i.segment).containing(s.length).index===s.length}function oT(d,t,e){const i=t+e;return(t===0||cE(d,t))&&(i===d.length||cE(d,i))}let go;function lT(){if(!go){const d=[],t=[],e=new RegExp("^\\p{M}$","u");for(let s=0;s<65536;s++){if(s>=55296&&s<=57343)continue;const r=String.fromCharCode(s);if(r.normalize("NFKC")!==r&&!e.test(r)){if(t.length!==2){t[0]=t[1]=s;continue}t[1]+1!==s?(t[0]===t[1]?d.push(String.fromCharCode(t[0])):d.push(`${String.fromCharCode(t[0])}-${String.fromCharCode(t[1])}`),t[0]=t[1]=s):t[1]=s}}const i=d.join("");if(!go)go=i;else if(i!==go){for(let s=1;s<i.length;s++)if(i[s]!==go[s]){console.log(`Difference at index ${s}: U+${i.charCodeAt(s).toString(16).toUpperCase().padStart(4,"0")}!== U+${go.charCodeAt(s).toString(16).toUpperCase().padStart(4,"0")}`);break}throw new Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.")}}return go}const Uh={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},bn={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},at={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Ve={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function hT(d,t){let e=d.offsetParent;if(!e){console.error("offsetParent is not set -- cannot scroll");return}let i=d.offsetTop+d.clientTop,s=d.offsetLeft+d.clientLeft;for(;e.clientHeight===e.scrollHeight&&e.clientWidth===e.scrollWidth;)if(i+=e.offsetTop,s+=e.offsetLeft,e=e.offsetParent,!e)return;t&&(t.top!==void 0&&(i+=t.top),t.left!==void 0&&(s+=t.left,e.scrollLeft=s)),e.scrollTop=i}function cT(d,t,e=void 0){function i(){r=null;const a=d.scrollLeft,o=s.lastX;a!==o&&(s.right=a>o),s.lastX=a;const l=d.scrollTop,h=s.lastY;l!==h&&(s.down=l>h),s.lastY=l,t(s)}const s={right:!0,down:!0,lastX:d.scrollLeft,lastY:d.scrollTop};let r=null;return d.addEventListener("scroll",()=>{r??(r=window.requestAnimationFrame(i))},{useCapture:!0,signal:e}),e==null||e.addEventListener("abort",()=>window.cancelAnimationFrame(r),{once:!0}),s}function Yb(d){const t=new Map;for(const[e,i]of new URLSearchParams(d))t.set(e.toLowerCase(),i);return t}const dE=/[\x00-\x1F]/g;function xo(d,t=!1){return dE.test(d)?t?d.replaceAll(dE,e=>e==="\0"?"":" "):d.replaceAll("\0",""):d}function zu(d,t,e=0){let i=e,s=d.length-1;if(s<0||!t(d[s]))return d.length;if(t(d[i]))return i;for(;i<s;){const r=i+s>>1,a=d[r];t(a)?s=r:i=r+1}return i}function uE(d){if(Math.floor(d)===d)return[d,1];const t=1/d,e=8;if(t>e)return[1,e];if(Math.floor(t)===t)return[1,t];const i=d>1?t:d;let s=0,r=1,a=1,o=1;for(;;){const l=s+a,h=r+o;if(h>e)break;i<=l/h?(a=l,o=h):(s=l,r=h)}return i-s/r<a/o-i?i===d?[s,r]:[r,s]:i===d?[a,o]:[o,a]}function jg(d,t){return d-d%t}function dT(d,t,e){if(d<2)return d;let i=t[d].div,s=i.offsetTop+i.clientTop;s>=e&&(i=t[d-1].div,s=i.offsetTop+i.clientTop);
55for(let r=d-2;r>=0&&(i=t[r].div,!(i.offsetTop+i.clientTop+i.clientHeight<=s));--r)d=r;return d}function uT(d,t){const e=d.percent-t.percent;return Math.abs(e)>.001?-e:d.id-t.id}function fT({scrollEl:d,views:t,sortByVisibility:e=!1,horizontal:i=!1,rtl:s=!1}){const r=d.scrollTop,a=r+d.clientHeight,o=d.scrollLeft,l=o+d.clientWidth;function h(E){const S=E.div;return S.offsetTop+S.clientTop+S.clientHeight>r}function c(E){const S=E.div,x=S.offsetLeft+S.clientLeft,_=x+S.clientWidth;return s?x<l:_>o}const u=[],p=new Set,b=t.length;let y=zu(t,i?c:h);y>0&&y<b&&!i&&(y=dT(y,t,r));let w=i?l:-1;for(let E=y;E<b;E++){const S=t[E],x=S.div,_=x.offsetLeft+x.clientLeft,C=x.offsetTop+x.clientTop,k=x.clientWidth,D=x.clientHeight,P=_+k,I=C+D;if(w===-1)I>=a&&(w=I);else if((i?_:C)>w)break;if(I<=r||C>=a||P<=o||_>=l)continue;const L=Math.max(0,r-C),O=Math.max(0,o-_),H=L+Math.max(0,I-a),W=O+Math.max(0,P-l),pt=(D-H)/D,R=(k-W)/k,j=pt*R*100|0;u.push({id:S.id,x:_,y:C,visibleArea:j===100?null:{minX:O,minY:L,maxX:Math.min(P,l)-_,maxY:Math.min(I,a)-C},view:S,percent:j,widthPercent:R*100|0}),p.add(S.id)}const v=u[0],A=u.at(-1);return e&&u.sort(uT),{first:v,last:A,views:u,ids:p}}function gx(d){return Number.isInteger(d)&&d%90===0}function pT(d){return Number.isInteger(d)&&Object.values(at).includes(d)&&d!==at.UNKNOWN}function gT(d){return Number.isInteger(d)&&Object.values(Ve).includes(d)&&d!==Ve.UNKNOWN}function fE(d){return d.width<=d.height}new Promise(function(d){window.requestAnimationFrame(d)});const mT=document.documentElement.style;var Ha,ih,za,md,sh;class bT{constructor(t){m(this,Ha,null);m(this,ih,null);m(this,za,0);m(this,md,null);m(this,sh,!0);f(this,Ha,t.classList),f(this,md,t.style)}get percent(){return n(this,za)}set percent(t){if(f(this,za,t),isNaN(t)){n(this,Ha).add("indeterminate");return}n(this,Ha).remove("indeterminate"),n(this,md).setProperty("--progressBar-percent",`${n(this,za)}%`)}setWidth(t){if(!t)return;const i=t.parentNode.offsetWidth-t.offsetWidth;i>0&&n(this,md).setProperty("--progressBar-end-offset",`${i}px`)}setDisableAutoFetch(t=5e3){n(this,za)===100||isNaN(n(this,za))||(n(this,ih)&&clearTimeout(n(this,ih)),this.show(),f(this,ih,setTimeout(()=>{f(this,ih,null),this.hide()},t)))}hide(){n(this,sh)&&(f(this,sh,!1),n(this,Ha).add("hidden"))}show(){n(this,sh)||(f(this,sh,!0),n(this,Ha).remove("hidden"))}}Ha=new WeakMap,ih=new WeakMap,za=new WeakMap,md=new WeakMap,sh=new WeakMap;function yT(d){let t=at.VERTICAL,e=Ve.NONE;switch(d){case"SinglePage":t=at.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=at.PAGE;case"TwoColumnLeft":e=Ve.ODD;break;case"TwoPageRight":t=at.PAGE;case"TwoColumnRight":e=Ve.EVEN;break}return{scrollMode:t,spreadMode:e}}const Ug=function(){const d=document.createElement("div");return d.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",d.style.width==="calc(1320px)"?Math.fround:t=>t}(),mx="59968104-cc61-4cf9-b570-014b35b3709c",ei=Object.freeze({internal:mx}),Rr={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},pE=new Map([["â","-"],["â","'"],["â","'"],["â","'"],["â","'"],["â",'"'],["â",'"'],["â",'"'],["â",'"'],["¼","1/4"],["½","1/2"],["¾","3/4"]]),gE=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let mE;const wT=new RegExp("\\p{M}+","gu"),vT=new RegExp("([+^$|])|(\\p{P}+)|(\\s+)|(\\p{M})|(\\p{L})","gu"),AT=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,bE=new Map,ET="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",ST=new Map;let ly=null,hy=null;function Dm(d,t={}){const e=[];let i;for(;(i=AT.exec(d))!==null;){let{index:E}=i;for(const S of i[0]){let x=bE.get(S);x||(x=S.normalize("NFD").length,bE.set(S,x)),e.push([x,E++])}}const s=e.length>0,r=t.ignoreDashEOL??!1;let a;if(!s&&ly)a=ly;else if(s&&hy)a=hy;else{const E=pE.keys().join(""),S=lT(),k=[`[${E}]`,`[${S}]`,"(?:ã|ã)\\n","\\p{M}+(?:-\\n)?","\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})","\\S-\\n","(?:\\p{Ideographic}|[ã-ã¿])\\n","\\n",s?ET:"\\u0000"];a=new RegExp(k.map(D=>`(${D})`).join("|"),"gmu"),s?hy=a:ly=a}const o=[];for(;(i=wT.exec(d))!==null;)o.push([i[0].length,i.index]);let l=d.normalize("NFD");const h=[0,0];let c=0,u=0,p=0,b=0,y=0,w=!1;l=l.replace(a,(E,S,x,_,C,k,D,P,I,L,O)=>{var H,W,pt;if(O-=b,S){const R=pE.get(S),j=R.length;for(let nt=1;nt<j;nt++)h.push(O-p+nt,p-nt);return p-=j-1,R}if(x){const R=ST.getOrInsertComputed(x,()=>x.normalize("NFKC")),j=R.length;for(let nt=1;nt<j;nt++)h.push(O-p+nt,p-nt);return p-=j-1,R}if(_)return w=!0,O+y===((H=o[c])==null?void 0:H[1])?++c:(h.push(O-1-p+1,p-1),p-=1,b+=1),h.push(O-p+1,p),b+=1,y+=1,_.charAt(0);if(C){const R=C.endsWith(` 56`),j=R?C.length-2:C.length;w=!0;let nt=j;O+y===((W=o[c])==null?void 0:W[1])&&(nt-=o[c][0],++c);for(let gt=1;gt<=nt;gt++)h.push(O-1-p+gt,p-gt);return p-=nt,b+=nt,R?(O+=j-1,h.push(O-p+1,1+p),p+=1,b+=1,y+=1,C.slice(0,j)):C}if(k){if(r)return b+=1,y+=1,k.slice(0,-1);const R=k.length-2;return h.push(O-p+R,1+p),p+=1,b+=1,y+=1,k.slice(0,-2)}if(D)return b+=1,y+=1,D.slice(0,-1);if(P){const R=P.length-1;return h.push(O-p+R,p),b+=1,y+=1,P.slice(0,-1)}if(I)return h.push(O-p+1,p-1),p-=1,b+=1,y+=1," ";if(O+y===((pt=e[u])==null?void 0:pt[1])){const R=e[u][0]-1;++u;for(let j=1;j<=R;j++)h.push(O-(p-j),p-j);p-=R,b+=R}return L}),h.push(l.length,p);const v=new Uint32Array(h.length>>1),A=new Int32Array(h.length>>1);for(let E=0,S=h.length;E<S;E+=2)v[E>>1]=h[E],A[E>>1]=h[E+1];return[l,[v,A],w]}function bx(d,t,e){if(!d)return[t,e];const[i,s]=d,r=t,a=t+e-1;let o=zu(i,p=>p>=r);i[o]>r&&--o;let l=zu(i,p=>p>=a,o);i[l]>a&&--l;const h=r+s[o],u=a+s[l]+1-h;return[h,u]}var re,bd,Np,nh,fn,cr,z,yx,gv,mv,wx,bv,vx,Ax,Lm,Tu,Ao,Ex,yv,wv,Rm,Sx,xx,vv,Av,ku;class xT{constructor({linkService:t,eventBus:e,delay:i=250,updateMatchesCountOnProgress:s=!0}){m(this,z);m(this,re,null);m(this,bd,!0);m(this,Np,0);m(this,nh,0);m(this,fn,null);m(this,cr,null);this._linkService=t,this._eventBus=e,f(this,bd,s),f(this,Np,i),this.onIsPageVisible=null,g(this,z,gv).call(this),e.on("find",g(this,z,yx).bind(this),ei),e.on("findbarclose",g(this,z,xx).bind(this),ei),e.on("pagesedited",g(this,z,Sx).bind(this),ei)}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return n(this,re)}setDocument(t){this._pdfDocument&&g(this,z,gv).call(this),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}scrollMatchIntoView({element:t=null,pageIndex:e=-1,matchIndex:i=-1}){if(!(!this._scrollMatches||!t)){{if(i===-1||i!==this._selected.matchIdx)return;if(e===-1||e!==this._selected.pageIdx)return}this._scrollMatches=!1,t.scrollIntoView({block:"start",inline:"center"})}}match(t,e,i){const s=this._hasDiacritics[i];let r=!1;if(typeof t=="string"?[r,t]=g(this,z,bv).call(this,t,s):t=t.sort().reverse().map(u=>{const[p,b]=g(this,z,bv).call(this,u,s);return r||(r=p),`(${b})`}).join("|"),!t)return;const{caseSensitive:a,entireWord:o}=n(this,re),l=`g${r?"u":""}${a?"":"i"}`;t=new RegExp(t,l);const h=[];let c;for(;(c=t.exec(e))!==null;)o&&!oT(e,c.index,c[0].length)||h.push({index:c.index,length:c[0].length});return h}}re=new WeakMap,bd=new WeakMap,Np=new WeakMap,nh=new WeakMap,fn=new WeakMap,cr=new WeakMap,z=new WeakSet,yx=function(t){if(!t)return;const e=this._pdfDocument,{type:i}=t;(n(this,re)===null||g(this,z,wx).call(this,t))&&(this._dirtyMatch=!0),f(this,re,t),i!=="highlightallchange"&&g(this,z,ku).call(this,Rr.PENDING),this._firstPageCapability.promise.then(()=>
56{if(!this._pdfDocument||e&&this._pdfDocument!==e)return;g(this,z,Ax).call(this);const s=!this._highlightMatches,r=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?g(this,z,Ao).call(this):i==="again"?(g(this,z,Ao).call(this),s&&n(this,re).highlightAll&&g(this,z,Tu).call(this)):i==="highlightallchange"?(r?g(this,z,Ao).call(this):this._highlightMatches=!0,g(this,z,Tu).call(this)):g(this,z,Ao).call(this):this._findTimeout=setTimeout(()=>{g(this,z,Ao).call(this),this._findTimeout=null},n(this,Np))})},gv=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],f(this,nh,0),f(this,re,null),this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,f(this,fn,null),this._firstPageCapability=Promise.withResolvers()},mv=function(){const{query:t}=n(this,re);return typeof t=="string"?(t!==this._rawQuery&&(this._rawQuery=t,[this._normalizedQuery]=Dm(t)),this._normalizedQuery):(t||[]).filter(Boolean).map(e=>Dm(e)[0])},wx=function(t){var a;const e=t.query,i=n(this,re).query,s=typeof e;if(s!==typeof i)return!0;if(s==="string"){if(e!==i)return!0}else if(JSON.stringify(e)!==JSON.stringify(i))return!0;switch(t.type){case"again":const o=this._selected.pageIdx+1,l=this._linkService;return o>=1&&o<=l.pagesCount&&o!==l.page&&!(((a=this.onIsPageVisible)==null?void 0:a.call(this,o))??!0);case"highlightallchange":return!1}return!0},bv=function(t,e){const{matchDiacritics:i}=n(this,re);let s=!1;const r=(o,l)=>o===t?l:t.startsWith(o)?`${l}[ ]*`:t.endsWith(o)?`[ ]*${l}`:`[ ]*${l}[ ]*`;t=t.replaceAll(vT,(o,l,h,c,u,p)=>l?r(l,RegExp.escape(l)):h?r(h,RegExp.escape(h)):c?"[ ]+":i?u||p:u?gE.has(u.charCodeAt(0))?u:"":e?(s=!0,`${p}\\p{M}*`):p);const a="[ ]*";return t.endsWith(a)&&(t=t.slice(0,t.length-a.length)),i&&e&&(mE||(mE=String.fromCharCode(...gE)),s=!0,t=`${t}(?=[${mE}]|[^\\p{M}]|$)`),[s,t]},vx=function(t){if(!n(this,re))return;const e=n(this,z,mv);if(e.length===0)return;const i=this._pageContents[t],s=this.match(e,i,t),r=this._pageMatches[t]=[],a=this._pageMatchesLength[t]=[],o=this._pageDiffs[t];s==null||s.forEach(({index:h,length:c})=>{const[u,p]=bx(o,h,c);p&&(r.push(u),a.push(p))}),n(this,re).highlightAll&&g(this,z,Lm).call(this,t),this._resumePageIdx===t&&(this._resumePageIdx=null,g(this,z,yv).call(this));const l=r.length;this._matchesCountTotal+=l,n(this,bd)?l>0&&g(this,z,Av).call(this):++kt(this,nh)._===this._linkService.pagesCount&&g(this,z,Av).call(this)},Ax=function(){if(this._extractTextPromises.length>0)return;let t=Promise.resolve();const e={disableNormalization:!0},i=this._pdfDocument;for(let s=0,r=this._linkService.pagesCount;s<r;s++){const{promise:a,resolve:o}=Promise.withResolvers();this._extractTextPromises[s]=a,t=t.then(async()=>{if(i!==this._pdfDocument){o();return}try{const h=await(await i.getPage(s+1)).getTextContent(e);if(i!==this._pdfDocument){o();return}const c=[];for(const u of h.items)c.push(u.str),u.hasEOL&&c.push(` 57`);[this._pageContents[s],this._pageDiffs[s],this._hasDiacritics[s]]=Dm(c.join(""))}catch(l){if(i!==this._pdfDocument){o();return}console.error(`Unable to get text content for page ${s+1}`,l),[this._pageContents[s],this._pageDiffs[s],this._hasDiacritics[s]]=["",null,!1]}o()})}},Lm=function(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})},Tu=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},Ao=function(){const t=n(this,re).findPrevious,e=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=e,this._offset.matchI
57dx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,f(this,nh,0),this._matchesCountTotal=0,g(this,z,Tu).call(this);for(let a=0;a<i;a++)this._pendingFindMatches.has(a)||(this._pendingFindMatches.add(a),this._extractTextPromises[a].then(()=>{this._pendingFindMatches.delete(a),g(this,z,vx).call(this,a)}))}if(n(this,z,mv).length===0){g(this,z,ku).call(this,Rr.FOUND);return}if(this._resumePageIdx)return;const r=this._offset;if(this._pagesToSearch=i,r.matchIdx!==null){const a=this._pageMatches[r.pageIdx].length;if(!t&&r.matchIdx+1<a||t&&r.matchIdx>0){r.matchIdx=t?r.matchIdx-1:r.matchIdx+1,g(this,z,Rm).call(this,!0);return}g(this,z,wv).call(this,t)}g(this,z,yv).call(this)},Ex=function(t){const e=this._offset,i=t.length,s=n(this,re).findPrevious;return i?(e.matchIdx=s?i-1:0,g(this,z,Rm).call(this,!0),!0):(g(this,z,wv).call(this,s),e.wrapped&&(e.matchIdx=null,this._pagesToSearch<0)?(g(this,z,Rm).call(this,!1),!0):!1)},yv=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let t=null;do{const e=this._offset.pageIdx;if(t=this._pageMatches[e],!t){this._resumePageIdx=e;break}}while(!g(this,z,Ex).call(this,t))},wv=function(t){const e=this._offset,i=this._linkService.pagesCount;e.pageIdx=t?e.pageIdx-1:e.pageIdx+1,e.matchIdx=null,this._pagesToSearch--,(e.pageIdx>=i||e.pageIdx<0)&&(e.pageIdx=t?i-1:0,e.wrapped=!0)},Rm=function(t=!1){let e=Rr.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,t){const s=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,e=i?Rr.WRAPPED:Rr.FOUND,s!==-1&&s!==this._selected.pageIdx&&g(this,z,Lm).call(this,s)}g(this,z,ku).call(this,e,n(this,re).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,g(this,z,Lm).call(this,this._selected.pageIdx))},Sx=function({pagesMapper:t,type:e,pageNumbers:i}){var p,b,y,w;if(this._extractTextPromises.length===0)return;if(e==="copy"){const v=new Map,A=new Map,E=new Map,S=new Map;for(const x of i)v.set(x,this._extractTextPromises[x-1]),A.set(x,this._pageContents[x-1]),E.set(x,this._pageDiffs[x-1]),S.set(x,this._hasDiacritics[x-1]);f(this,fn,{promises:v,contents:A,diffs:E,diacritics:S});return}if(e==="cancelCopy"){f(this,fn,null);return}if(e==="delete"&&f(this,cr,{promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics}),e==="cancelDelete"){this._extractTextPromises=n(this,cr).promises,this._pageContents=n(this,cr).contents,this._pageDiffs=n(this,cr).diffs,this._hasDiacritics=n(this,cr).diacritics;return}if(e==="cleanSavedData"){f(this,cr,null);return}this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx=null,this._dirtyMatch=!0;const s=this._extractTextPromises,r=this._pageContents,a=this._pageDiffs,o=this._hasDiacritics,l=this._extractTextPromises=[],h=this._pageContents=[],c=this._pageDiffs=[],u=this._hasDiacritics=[];for(let v=1,A=t.pagesNumber;v<=A;v++){const E=t.getPrevPageNumber(v);if(E<0){const S=-E;l.push(((p=n(this,fn))==null?void 0:p.promises.get(S))||Promise.resolve()),h.push(((b=n(this,fn))==null?void 0:b.contents.get(S))??""),c.push(((y=n(this,fn))==null?void 0:y.diffs.get(S))??null),u.push(((w=n(this,fn))==null?void 0:w.diacritics.get(S))??!1);continue}l.push(s[E-1]||Promise.resolve()),h.push(r[E-1]??""),c.push(a[E-1]??null),u.push(o[E-1]??!1)}n(this,re)&&g(this,z,Ao).call(this)},xx=function(t){const e=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||e&&this._pdfDocument!==e||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),g(this,z,ku).call(this,Rr.FOUND),this._highlightMatches=!1,g(this,z,Tu).call(this))})},vv=function(){var r;const{pageIdx:t,matchIdx:e}=this._selected;let i=0,s=this._matchesCountTotal;if(e!==-1){for(let a=0;a<t;a++)i+=((r=this._pageMatches[a])==null?void 0:r.length)||0;i+=e+1}return(i<1||i>s)&&(i=s=0),{current:i,total:s}},Av=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:g(this,z,vv).call(this)})},ku=function(t,e=!1){var i,s;!n(this,bd)&&(n(this,nh)!==this._linkService.pagesCount||t===Rr.PENDING)||this._eventBus.dispatch("updatefindcontrol
57state",{source:this,state:t,previous:e,entireWord:((i=n(this,re))==null?void 0:i.entireWord)??null,matchesCount:g(this,z,vv).call(this),rawQuery:((s=n(this,re))==null?void 0:s.query)??null})};const _T="noopener noreferrer nofollow",Eo={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class _x{constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:i=null,ignoreDestinationZoom:s=!1}={}){T(this,"externalLinkEnabled",!0);this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=i,this._ignoreDestinationZoom=s,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(t,e=null){this.baseUrl=e,this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setHistory(t){this.pdfHistory=t}get pagesCount(){var t;return((t=this.pdfDocument)==null?void 0:t.pagesMapper.pagesNumber)||0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(t){this.pdfDocument&&(this.pdfViewer.currentPageNumber=t)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(t){this.pdfDocument&&(this.pdfViewer.pagesRotation=t)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}async goToDestination(t){if(!this.pdfDocument)return;let e,i,s;if(typeof t=="string"?(e=t,i=await this.pdfDocument.getDestination(t)):(e=null,i=await t),!Array.isArray(i)){console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${t}".`);return}const[r]=i;if(r&&typeof r=="object"){if(s=this.pdfDocument.cachedPageNumber(r),!s)try{s=await this.pdfDocument.getPageIndex(r)+1}catch{console.error(`goToDestination: "${r}" is not a valid page reference, for dest="${t}".`);return}}else Number.isInteger(r)&&(s=r+1);if(!s||s<1||s>this.pagesCount){console.error(`goToDestination: "${s}" is not a valid page number, for dest="${t}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:e,explicitDest:i,pageNumber:s})),this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom});const a=new AbortController;this.eventBus.on("textlayerrendered",o=>{o.pageNumber===s&&(o.source.textLayer.div.focus(),a.abort())},{signal:a.signal,...ei})}goToPage(t){if(!this.pdfDocument)return;const e=typeof t=="string"&&this.pdfViewer.pageLabelToPageNumber(t)||t|0;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${t}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(e)),this.pdfViewer.scrollPageIntoView({pageNumber:e})}goToXY(t,e,i,s={}){this.pdfViewer.scrollPageIntoView({pageNumber:t,destArray:[null,{name:"XYZ"},e,i],ignoreDestinationZoom:!0,...s})}async getAttachmentContent(t){var e;try{return await((e=this.pdfDocument)==null?void 0:e.getAttachmentContent(t))}catch(i){i instanceof sT||console.warn(`Unable to load attachment content: ${i}`)}return null}addLinkAttributes(t,e,i=!1){if(!e||typeof e!="string")throw new Error('A valid "url" parameter must provided.');const s=i?Eo.BLANK:this.externalLinkTarget,r=this.externalLinkRel;let a=e;const o=URL.parse(e);(o!=null&&o.username||o!=null&&o.password)&&(o.username=o.password="",a=o.href),this.externalLinkEnabled?(t.href=e,t.title=a):(t.href="",t.title=`Disabled: ${a}`,t.onclick=()=>!1);let l="";switch(s){case Eo.NONE:break;case Eo.SELF:l="_self";break;case Eo.BLANK:l="_blank";break;case Eo.PARENT:l="_parent";break;case Eo.TOP:l="_top";break}t.target=l,t.rel=typeof r=="string"?r:_T}getDestinationHash(t){if(typeof t=="string"){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){const e=JSON.stringify(t);if(e.length>0)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(t){return this.baseUrl?this.baseUrl+t:t}setHash(t){if(!this.pdfDocument)return;let e,i;if(t.includes("=")){const s=Yb(t);if(s.has("search")){const r=s.get("search").replaceAll('"',""),a=s.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:a?r:r.match(/\S+/g)})}if(s.has("page")&&(e=s.get("page")|0||1),s.has("zoom")){const r=s.get("zoom").split(","),a=r[0],o=parseFloat(a);a.includes("Fit")?a==="Fit"||a==="FitB"?i=[null,{name:a}]:a==="FitH"||a==="FitBH"||a==="FitV"||a==="FitBV"?i=[null,{name:a},r.length>1?r[1]|0:null]:a==="FitR"?r.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:a},r[1]|0,r[2]|0,r[3]|0,r[4]|0]:console.error(`PDFLinkService.setHash: "${a}" is not a valid zoom value.`):i=[null,{name:"XYZ"},r.length>1?r[1]|0:null,r.length>2?r[2]|0:null,o?o/100:a]}i?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:i,allowNegativeOffset:!0}):e&&(this.page=e),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"));return}i=unescape(t);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}if(typeof i=="string"||ZP(i)){this.goToDestination(i);return}console.error(`PDFLinkService.setHash: "${unescape(t)}" is not a valid destination.`)}executeNamedAction(t){var e,i;if(this.pdfDocument){switch(t){case"GoBack":(e=this.pdfHistory)==null||e.back();break;case"GoForward":(i=this.pdfHistory)==null||i.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break}this.eventBus.dispatch("namedaction",{source:this,action:t})}}async executeSetOCGState(t){if(!this.pdfDocument)return;const e=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;e===this.pdfDocument&&(i.setOCGState(t),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i))}}class Wu extends _x{setDocument(t,e=null){}}var Wa,Fp,Op,Ga,Bp,Dr,Px,Ev,Tx;class Cx{constructor({pdfPage:t,linkService:e,downloadManager:i,annotationStorage:s=null,imageResourcesPath:r="",renderForms:a=!0,enableComment:o=!1,commentManager:l=null,enableScripting:h=!1,hasJSActionsProm
57ise:c=null,fieldObjectsPromise:u=null,annotationCanvasMap:p=null,accessibilityManager:b=null,annotationEditorUIManager:y=null,onAppend:w=null}){m(this,Dr);m(this,Wa,null);m(this,Fp,null);m(this,Op,null);m(this,Ga,null);m(this,Bp,!1);this.pdfPage=t,this.linkService=e,this.downloadManager=i,this.imageResourcesPath=r,this.renderForms=a,this.annotationStorage=s,this.enableComment=o,f(this,Fp,l),this.enableScripting=h,this._hasJSActionsPromise=c||Promise.resolve(!1),this._fieldObjectsPromise=u||Promise.resolve(null),this._annotationCanvasMap=p,this._accessibilityManager=b,this._annotationEditorUIManager=y,f(this,Op,w),this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}async render({viewport:t,intent:e="display",structTreeLayer:i=null,optionalContentConfigPromise:s=null}){var c,u;if(this.div){const p=await s;if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0}),optionalContentConfig:p});return}const[r,a,o,l]=await Promise.all([this.pdfPage.getAnnotations({intent:e}),this._hasJSActionsPromise,this._fieldObjectsPromise,s]);if(this._cancelled)return;const h=this.div=document.createElement("div");if(h.className="annotationLayer",(c=n(this,Op))==null||c.call(this,h),g(this,Dr,Px).call(this,t,i),r.length===0){f(this,Wa,r),px(this.div,t);return}await this.annotationLayer.render({annotations:r,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:a,fieldObjects:o,optionalContentConfig:l}),f(this,Wa,r),this.linkService.isInPresentationMode&&g(this,Dr,Ev).call(this,Uh.FULLSCREEN),n(this,Ga)||(f(this,Ga,new AbortController),(u=this._eventBus)==null||u.on("presentationmodechanged",p=>{g(this,Dr,Ev).call(this,p.state)},{signal:n(this,Ga).signal,...ei}))}cancel(){var t,e;this._cancelled=!0,(t=n(this,Ga))==null||t.abort(),f(this,Ga,null),(e=this.annotationLayer)==null||e.destroy()}refreshCanvases(){var t;(t=this.annotationLayer)==null||t.refreshCanvases()}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){var t;return!!((t=this.annotationLayer)!=null&&t.hasEditableAnnotations())}async injectLinkAnnotations(t){if(n(this,Wa)===null)throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||n(this,Bp))return;f(this,Bp,!0);const e=n(this,Wa).length?g(this,Dr,Tx).call(this,t):t;e.length&&await this.annotationLayer.addLinkAnnotations(e)}}Wa=new WeakMap,Fp=new WeakMap,Op=new WeakMap,Ga=new WeakMap,Bp=new WeakMap,Dr=new WeakSet,Px=function(t,e){this.annotationLayer=new XP({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:t.clone({dontFlip:!0}),structTreeLayer:e,commentManager:n(this,Fp),linkService:this.linkService})},Ev=function(t){if(!this.div)return;let e=!1;switch(t){case Uh.FULLSCREEN:e=!0;break;case Uh.NORMAL:break;default:return}for(const i of this.div.childNodes)i.hasAttribute("data-internal-link")||i.classList.contains("mediaAnnotation")||(i.inert=e)},Tx=function(t){function e(r){if(!r.quadPoints)return[r.rect];const a=[];for(let o=2,l=r.quadPoints.length;o<l;o+=8){const h=r.quadPoints[o],c=r.quadPoints[o+1],u=r.quadPoints[o+2],p=r.quadPoints[o+3];a.push([u,p,h,c])}return a}function i(r,a){const o=[],l=e(r),h=e(a);for(const c of l)for(const u of h){const p=bA.intersect(c,u);p&&o.push(p)}return o}function s(r){let a=0;for(const o of r)a+=Math.abs((o[2]-o[0])*(o[3]-o[1]));return a}return t.filter(r=>{let a;for(const o of n(this,Wa)){if(o.annotationType!==ux.LINK)continue;const l=i(o,r);if(l.length!==0&&(a??(a=s(e(r))),s(l)/a>.5))return!1}return!0})};var jp;class CT{constructor(){m(this,jp,new WeakMap)}_triggerDownload(t,e,i,s=!1){throw new Error("Not implemented: _triggerDownload")}_getOpenDataUrl(t,e,i=null){throw new Error("Not implemented: _getOpenDataUrl")}downloadData(t,e,i){const s=URL.createObjectURL(new Blob([t],{type:i}));this._triggerDownload(s,s,e,!0)}
57openOrDownloadData(t,e,i=null){const s=QP(e),r=s?"application/pdf":"";if(s){const a=n(this,jp).getOrInsertComputed(t,()=>URL.createObjectURL(new Blob([t],{type:r})));try{const o=this._getOpenDataUrl(a,e,i);return window.open(o),!0}catch(o){console.error("openOrDownloadData:",o),URL.revokeObjectURL(a),n(this,jp).delete(t)}}return this.downloadData(t,e,r),!1}download(t,e,i){const s=t?URL.createObjectURL(new Blob([t],{type:"application/pdf"})):null;this._triggerDownload(s,e,i)}}jp=new WeakMap;class PT extends CT{_triggerDownload(t,e,i,s=!1){if(!t&&!s){if(!fx(e,"http://example.com"))throw new Error(`_triggerDownload - not a valid URL: ${e}`);t=e+"#pdfjs.action=download"}const r=document.createElement("a");r.href=t,r.target="_parent","download"in r&&(r.download=i),(document.body||document.documentElement).append(r),r.click(),r.remove()}_getOpenDataUrl(t,e,i=null){throw new Error("Opening data is not supported in `COMPONENTS` builds.")}}const yE={EVENT:"event",TIMEOUT:"timeout"};async function TT({target:d,name:t,delay:e=0}){if(typeof d!="object"||!(Number.isInteger(e)&&e>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:i,resolve:s}=Promise.withResolvers(),r=new AbortController;function a(c){r.abort(),clearTimeout(h),s(c)}const o=d instanceof Sv?"on":"addEventListener",l=d instanceof Sv?{signal:r.signal,...ei}:{signal:r.signal};d[o](t,a.bind(null,yE.EVENT),l);const h=setTimeout(a.bind(null,yE.TIMEOUT),e);return i}var yd;class Sv{constructor(){m(this,yd,new Map);Object.seal(this)}on(t,e,i=null){let s=null;if((i==null?void 0:i.signal)instanceof AbortSignal){const{signal:r}=i;if(r.aborted){console.error("Cannot use an `aborted` signal.");return}const a=()=>this.off(t,e);s=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}n(this,yd).getOrInsertComputed(t,tT).add({listener:e,internal:(i==null?void 0:i.internal)===mx,once:(i==null?void 0:i.once)===!0,rmAbort:s})}off(t,e,i=null){var a;const s=n(this,yd).get(t),r=s==null?void 0:s.keys().find(o=>o.listener===e);r&&((a=r.rmAbort)==null||a.call(r),s.delete(r))}dispatch(t,e){const i=n(this,yd).get(t);if(!(i!=null&&i.size))return;let s;for(const{listener:r,internal:a,once:o}of new Set(i)){if(o&&this.off(t,r),!a){(s??(s=[])).push(r);continue}r(e)}if(s)for(const r of s)r(e)}}yd=new WeakMap;class $h{constructor(t){this.value=t}valueOf(){return this.value}}class oe extends $h{constructor(t="???"){super(t)}toString(t){return`{${this.value}}`}}class Cr extends $h{constructor(t,e={}){super(t),this.opts=e}toString(t){if(t)try{return t.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return this.value.toString(10)}}class fo extends $h{static supportsValue(t){if(typeof t=="number"||t instanceof Date)return!0;if(t instanceof $h)return fo.supportsValue(t.valueOf());if("Temporal"in globalThis){const e=globalThis.Temporal;if(t instanceof e.Instant||t instanceof e.PlainDateTime||t instanceof e.PlainDate||t instanceof e.PlainMonthDay||t instanceof e.PlainTime||t instanceof e.PlainYearMonth)return!0}return!1}constructor(t,e={}){t instanceof fo?(e={...t.opts,...e},t=t.value):t instanceof $h&&(t=t.valueOf()),typeof t=="object"&&"calendarId"in t&&e.calendar===void 0&&(e={...e,calendar:t.calendarId}),super(t),this.opts=e}[Symbol.toPrimitive](t){return t==="string"?this.toString():this.toNumber()}toNumber(){const t=this.value;if(typeof t=="number")return t;if(t instanceof Date)return t.getTime();if("epochMilliseconds"in t)return t.epochMilliseconds;if("toZonedDateTime"in t)return t.toZonedDateTime("UTC").epochMilliseconds;throw new TypeError("Unwrapping a non-number value as a number")}toString(t){if(t)try{return t.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(e){t.reportError(e)}return typeof this.value=="number"||this.value instanceof Date?new Date(this.value).toISOString():this.value.toString()}}const wE=100,kT="â¨",MT="â©";function IT(d,t,e){if(e===t||e instanceof Cr&&t instanceof Cr&&e.value===t.value)return!0;if(t instanceof Cr&&typeof e=="string"){let i=d.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value);if(e===i)return!0}return!1}function vE(d,t,e){return t[e]?Gd(d,t[e].value):(d.reportError(new RangeError("No default")),new oe)}function xv(d,t){const e=[],i=Object.create(null);for(const s of t)s.type==="narg"?i[s.name]=Gu(d,s.value):e.push(Gu(d,s));return{positional:e,named:i}}function Gu(d,t){switch(t.type){case"str":return t.value;case"num":return new Cr(t.value,{minimumFractionDigits:t.precision});case"var":return DT(d,t);case"mesg":return LT(d,t);case"term":return RT(d,t);case"func":return NT(d,t);case"select":return FT(d,t);default:return new oe}}function DT(d,{name:t}){let e;if(d.params)if(Object.prototype.hasOwnProperty.call(d.params,t))e=d.params[t];else return new oe(`$${t}`);else if(d.args&&Object.prototype.hasOwnProperty.call(d.args,t))e=d.args[t];else return d.reportError(new ReferenceError(`Unknown variable: $${t}`)),new oe(`$${t}`);if(e instanceof $h)return e;switch(typeof e){case"string":return e;case"number":return new Cr(e);case"object":if(fo.supportsValue(e))return new fo(e);default:return d.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof e}`)),new oe(`$${t}`)}}function LT(d,{name:t,attr:e}){const i=d.bundle._messages.get(t);if(!i)return d.reportError(new ReferenceError(`Unknown message: ${t}`)),new oe(t);if(e){const s=i.attributes[e];return s?Gd(d,s):(d.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new oe(`${t}.${e}`))}return i.value?Gd(d,i.value):(d.reportError(new ReferenceError(`No value: ${t}`)),new oe(t))}function RT(d,{name:t,attr:e,args:i}){const s=`-${t}`,r=d.bundle._terms.get(s);if(!r)return d.reportError(new ReferenceError(`Unknown term: ${s}`)),new oe(s);if(e){const o=r.attributes[e];if(o){d.params=xv(d,i).named;const l=Gd(d,o);return d.params=null,l}return d.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new oe(`${s}.${e}`)}d.params=xv(d,i).named;const a=Gd(d,r.value);return d.params=null,a}function NT(d,{name:t,args:e}){let i=d.bundle._functions[t];if(!i)return d.reportError(new ReferenceError(`Unknown function: ${t}()`)),new oe(`${t}()`);if(typeof i!="function")return d.reportError(new TypeError(`Function ${t}() is not callable`)),new oe(`${t}()`);try{let s=xv(d,e);return i(s.positional,s.named)}catch(s){return d.reportError(s),new oe(`${t}()`)}}function FT(d,{selector:t,variants:e,star:i}){let s=Gu(d,t);if(s instanceof oe)return vE(d,e,i);for(const r of e){const a=Gu(d,r.key);if(IT(d,s,a))return Gd(d,r.value)}return vE(d,e,i)}function kx(d,t){if(d.dirty.has(t))return d.reportError(new RangeError("Cyclic reference")),new oe;d.dirty.add(t);const e=[],i=d.bundle._useIsolating&&t.length>1;for(const s of t){if(typeof s=="string"){e.push(d.bundle._transform(s));continue}if(d.placeables++,d.placeables>wE)throw d.dirty.delete(t),new RangeError(`Too many placeables expanded: ${d.placeables}, max allowed is ${wE}`);i&&e.push(kT),e.push(Gu(d,s).toString(d)),i&&e.push(MT)}return d.dirty.delete(t),e.join("")}function Gd(d,t){return typeof t=="string"?d.bundle._transform(t):kx(d,t)}class OT{constructor(t,e,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=i}reportError(t){if(!this.errors||!(t instanceof Error))throw t;this.errors.push(t)}
vendor: 6,872 bytes, lines 57-58
57memoizeIntlObject(t,e){let i=this.bundle._intls.get(t);i||(i={},this.bundle._intls.set(t,i));let s=JSON.stringify(e);return i[s]||(i[s]=new t(this.bundle.locales,e)),i[s]}}function _v(d,t){const e=Object.create(null);for(const[i,s]of Object.entries(d))t.includes(i)&&(e[i]=s.valueOf());return e}const AE=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function BT(d,t){let e=d[0];if(e instanceof oe)return new oe(`NUMBER(${e.valueOf()})`);if(e instanceof Cr)return new Cr(e.valueOf(),{...e.opts,..._v(t,AE)});if(e instanceof fo)return new Cr(e.toNumber(),{..._v(t,AE)});throw new TypeError("Invalid argument to NUMBER")}const jT=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function UT(d,t){let e=d[0];if(e instanceof oe)return new oe(`DATETIME(${e.valueOf()})`);if(e instanceof fo||e instanceof Cr)return new fo(e,_v(t,jT));throw new TypeError("Invalid argument to DATETIME")}const EE=new Map;function $T(d){const t=Array.isArray(d)?d.join(" "):d;let e=EE.get(t);return e===void 0&&(e=new Map,EE.set(t,e)),e}class VT{constructor(t,{functions:e,useIsolating:i=!0,transform:s=r=>r}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions={NUMBER:BT,DATETIME:UT,...e},this._useIsolating=i,this._transform=s,this._intls=$T(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){const i=[];for(let s=0;s<t.body.length;s++){let r=t.body[s];if(r.id.startsWith("-")){if(e===!1&&this._terms.has(r.id)){i.push(new Error(`Attempt to override an existing term: "${r.id}"`));continue}this._terms.set(r.id,r)}else{if(e===!1&&this._messages.has(r.id)){i.push(new Error(`Attempt to override an existing message: "${r.id}"`));continue}this._messages.set(r.id,r)}}return i}formatPattern(t,e=null,i=null){if(typeof t=="string")return this._transform(t);let s=new OT(this,i,e);try{return kx(s,t).toString(s)}catch(r){if(s.errors&&r instanceof Error)return s.errors.push(r),new oe().toString(s);throw r}}}const cy=/^(-?[a-zA-Z][\w-]*) *= */gm,SE=/\.([a-zA-Z][\w-]*) *= */y,HT=/\*?\[/y,dy=/(-?[0-9]+(?:\.([0-9]+))?)/y,zT=/([a-zA-Z][\w-]*)/y,xE=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,WT=/^[A-Z][A-Z0-9_-]*$/,$g=/([^{}\n\r]+)/y,GT=/([^\\"\n\r]*)/y,_E=/\\([\\"])/y,CE=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,XT=/^\n+/,PE=/ +$/,YT=/ *\r?\n/g,KT=/( *)$/,qT=/{\s*/y,TE=/\s*}/y,QT=/\[\s*/y,ZT=/\s*] */y,JT=/\s*\(\s*/y,t1=/\s*->\s*/y,e1=/\s*:\s*/y,i1=/\s*,?\s*/y,s1=/\s+/y;class n1{constructor(t){this.body=[],cy.lastIndex=0;let e=0;for(;;){let P=cy.exec(t);if(P===null)break;e=cy.lastIndex;try{this.body.push(l(P[1]))}catch(I){if(I instanceof SyntaxError)continue;throw I}}function i(P){return P.lastIndex=e,P.test(t)}function s(P,I){if(t[e]===P)return e++,!0;if(I)throw new I(`Expected ${P}`);return!1}function r(P,I){if(i(P))return e=P.lastIndex,!0;if(I)throw new I(`Expected ${P.toString()}`);return!1}function a(P){P.lastIndex=e;let I=P.exec(t);if(I===null)throw new SyntaxError(`Expected ${P.toString()}`);return e=P.lastIndex,I}function o(P){return a(P)[1]}function l(P){let I=c(),L=h();if(I===null&&Object.keys(L).length===0)throw new SyntaxError("Expected message value or attributes");return{id:P,value:I,attributes:L}}function h(){let P=Object.create(null);for(;i(SE);){let I=o(SE),L=c();if(L===null)throw new SyntaxError("Expected attribute value");P[I]=L}return P}function c(){let P;if(i($g)&&(P=o($g)),t[e]==="{"||t[e]==="}")return u(P?[P]:[],1/0);let I=C();return I?P?u([P,I],I.length):(I.value=k(I.value,XT),u([I],I.length)):P?k(P,PE):null}function u(P=[],I){for(;;){if(i($g)){P.push(o($g));continue}if(t[e]==="{"){P.push(p());continue}if(t[e]==="}")throw new SyntaxError("Unbalanced closing brace");let W=C();if(W){P.push(W),I=Math.min(I,W.length);continue}break}let L=P.length-1,O=P[L];typeof O=="string"&&(P[L]=k(O,PE));let H=[];for(let W of P)W instanceof kE&&(W=W.value.slice(0,W.value.length-I)),W&&H.push(W);return H}function p(){r(qT,SyntaxError);let P=b();if(r(TE))return P;if(r(t1)){let I=v();return r(TE,SyntaxError),{type:"select",selector:P,...I}}throw new SyntaxError("Unclosed placeable")}function b(){if(t[e]==="{")return p();if(i(xE)){let[,P,I,L=null]=a(xE);if(P==="$")return{type:"var",name:I};if(r(JT)){let O=y();if(P==="-")return{type:"term",name:I,attr:L,args:O};if(WT.test(I))return{type:"func",name:I,args:O};throw new SyntaxError("Function names must be all upper-case")}return P==="-"?{type:"term",name:I,attr:L,args:[]}:{type:"mesg",name:I,attr:L}}return E()}function y(){let P=[];for(;;){switch(t[e]){case")":return e++,P;case void 0:throw new SyntaxError("Unclosed argument list")}P.push(w()),r(i1)}}function w(){let P=b();return P.type!=="mesg"?P:r(e1)?{type:"narg",name:P.name,value:E()}:P}function v(){let P=[],I=0,L;for(;i(HT);){s("*")&&(L=I);let O=A(),H=c();if(H===null)throw new SyntaxError("Expected variant value");P[I++]={key:O,value:H}}if(I===0)return null;if(L===void 0)throw new SyntaxError("Expected default variant");return{variants:P,star:L}}function A(){r(QT,SyntaxError);let P;return i(dy)?P=S():P={type:"str",value:o(zT)},r(ZT,SyntaxError),P}function E(){if(i(dy))return S();if(t[e]==='"')return x();throw new SyntaxError("Invalid expression")}function S(){let[,P,I=""]=a(dy),L=I.length;return{type:"num",value:parseFloat(P),precision:L}}function x(){s('"',SyntaxError);let P="";for(;;){if(P+=o(GT),t[e]==="\\"){P+=_();continue}if(s('"'))return{type:"str",value:P};throw new SyntaxError("Unclosed string literal")}}function _(){if(i(_E))return o(_E);if(i(CE)){let[,P,I]=a(CE),L=parseInt(P||I,16);return L<=55295||57344<=L?String.fromCodePoint(L):"�"}throw new SyntaxError("Unknown escape sequence")}function C(){let P=e;switch(r(s1),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return D(t.slice(P,e))}return t[e-1]===" "?D(t.slice(P,e)):!1}function k(P,I){return P.replace(I,"")}function D(P){let I=P.replace(YT,` 58`),L=KT.exec(P)[1].length;return new kE(I,L)}}}class kE{constructor(t,e){this.value=t,this.length=e}}const r1=/<|&#?\w+;/,a1={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},o1={"http://www.w3.org/1999/xhtml":{global:["title","aria-description","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","t
58itle","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function l1(d,t){const{value:e}=t;if(typeof e=="string")if(d.localName==="title"&&d.namespaceURI==="http://www.w3.org/1999/xhtml")d.textContent=e;else if(!r1.test(e))d.textContent=e;else{const i=d.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");i.innerHTML=e,h1(i.content,d)}Mx(t,d)}function h1(d,t){for(const e of d.childNodes)if(e.nodeType!==e.TEXT_NODE){if(e.hasAttribute("data-l10n-name")){const i=d1(t,e);d.replaceChild(i,e);continue}if(f1(e)){const i=u1(e);d.replaceChild(i,e);continue}console.warn(`An element of forbidden type "${e.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),d.replaceChild(Cv(e),e)}t.textContent="",t.appendChild(d)}function c1(d,t){if(!d)return!1;for(let e of d)if(e.name===t)return!0;return!1}function Mx(d,t){const e=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(i=>i.trim()):null;for(const i of Array.from(t.attributes))ME(i.name,t,e)&&!c1(d.attributes,i.name)&&t.removeAttribute(i.name);if(d.attributes)for(const i of Array.from(d.attributes))ME(i.name,t,e)&&t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value)}function d1(d,t){const e=t.getAttribute("data-l10n-name"),i=d.querySelector(`[data-l10n-name="${e}"]`);if(!i)return console.warn(`An element named "${e}" wasn't found in the source.`),Cv(t);if(i.localName!==t.localName)return console.warn(`An element named "${e}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${i.localName}).`),Cv(t);d.removeChild(i);const s=i.cloneNode(!1);return Ix(t,s)}function u1(d){const t=d.ownerDocument.createElement(d.localName);return Ix(d,t)}function Cv(d){return d.ownerDocument.createTextNode(d.textContent)}function f1(d){const t=a1[d.namespaceURI];return t&&t.includes(d.localName)}function ME(d,t,e=null){if(e&&e.includes(d))return!0;const i=o1[t.namespaceURI];if(!i)return!1;const s=d.toLowerCase(),r=t.localName;if(i.global.includes(s))return!0;if(!i[r])return!1;if(i[r].includes(s))return!0;if(t.namespaceURI==="http://www.w3.org/1999/xhtml"&&r==="input"&&s==="value"){const a=t.type.toLowerCase();if(a==="submit"||a==="button"||a==="reset")return!0}return!1}function Ix(d,t){return t.textContent=d.textContent,Mx(d,t),t}class p1 extends Array{static from(t){return t instanceof this?t:new this(t)}}class g1 extends p1{constructor(t){if(super(),Symbol.asyncIterator in Object(t))this.iterator=t[Symbol.asyncIterator]();else if(Symbol.iterator in Object(t))this.iterator=t[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.asyncIterator](){const t=this;let e=0;return{async next(){return t.length<=e&&t.push(t.iterator.next()),t[e++]}}}async touchNext(t=1){let e=0;for(;e++<t;){const i=this[this.length-1];if(i&&(await i).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class m1{constructor(t=[],e){this.resourceIds=t,this.generateBundles=e,this.onChange(!0)}addResourceIds(t,e=!1){return this.resourceIds.push(...t),this.onChange(e),this.resourceIds.length}removeResourceIds(t){return this.resourceIds=this.resourceIds.filter(e=>!t.includes(e)),this.onChange(),this.resourceIds.length}async formatWithFallback(t,e){const i=[];let s=!1;for await(const r of this.bundles){s=!0;const a=w1(e,r,t,i);if(a.size===0)break;if(typeof console<"u"){const o=r.locales[0],l=Array.from(a).join(", ");console.warn(`[fluent] Missing translations in ${o}: ${l}`)}}return!s&&typeof console<"u"&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated. 59 keys: ${JSON.stringify(t)}. 60 resourceIds: ${JSON.stringify(this.resourceIds)}.`),i}formatMessages(t){return this.formatWithFallback(t,y1)}formatValues(t){return this.formatWithFallback(t,b1)}async formatValue(t,e){const[i]=await this.formatValues([{id:t,args:e}]);return i}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=g1.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}}function b1(d,t,e,i){return e.value?d.formatPattern(e.value,i,t):null}function y1(d,t,e,i){const s={value:null,attributes:null};e.value&&(s.value=d.formatPattern(e.value,i,t));let r=Object.keys(e.attributes);if(r.length>0){s.attributes=new Array(r.length);for(let[a,o]of r.entries()){let l=d.formatPattern(e.attributes[o],i,t);s.attributes[a]={name:o,value:l}}}return s}function w1(d,t,e,i){const s=[],r=new Set;return e.forEach(({id:a,args:o},l)=>{if(i[l]!==void 0)return;
60let h=t.getMessage(a);if(h){if(s.length=0,i[l]=d(t,s,h,o),s.length>0&&typeof console<"u"){const c=t.locales[0],u=s.join(", ");console.warn(`[fluent][resolver] errors in ${c}/${a}: ${u}.`)}}else r.add(a)}),r}const So="data-l10n-id",ru="data-l10n-args",v1=`[${So}]`;class A1 extends m1{constructor(t,e){super(t,e),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[So,ru]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,i){return t.setAttribute(So,e),i?t.setAttribute(ru,JSON.stringify(i)):t.removeAttribute(ru),t}getAttributes(t){return{id:t.getAttribute(So),args:JSON.parse(t.getAttribute(ru)||null)}}connectRoot(t){for(const e of this.roots)if(e===t||e.contains(t)||t.contains(e))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==t.ownerDocument.defaultView)throw new Error(`Cannot connect a root: 61 DOMLocalization already has a root from a different window.`)}else this.windowElement=t.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(t),this.mutationObserver.observe(t,this.observerConfig)}disconnectRoot(t){return this.roots.delete(t),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){const t=Array.from(this.roots);return Promise.all(t.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(const t of this.roots)this.mutationObserver.observe(t,this.observerConfig)}translateMutations(t){for(const e of t)switch(e.type){case"attributes":e.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(e.target);break;case"childList":for(const i of e.addedNodes)if(i.nodeType===i.ELEMENT_NODE)if(i.childElementCount)for(const s of this.getTranslatables(i))this.pendingElements.add(s);else i.hasAttribute(So)&&this.pendingElements.add(i);break}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(t){return this.translateElements(this.getTranslatables(t))}async translateElements(t){if(!t.length)return;const e=t.map(this.getKeysForElement),i=await this.formatMessages(e);return this.applyTranslations(t,i)}applyTranslations(t,e){this.pauseObserving();for(let i=0;i<t.length;i++)e[i]!==void 0&&l1(t[i],e[i]);this.resumeObserving()}getTranslatables(t){const e=Array.from(t.querySelectorAll(v1));return typeof t.hasAttribute=="function"&&t.hasAttribute(So)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(So),args:JSON.parse(t.getAttribute(ru)||null)}}}var Up,Xa,wd,fi,qd,Dx,Lx;const Ou=class Ou{constructor({lang:t,isRTL:e},i=null){m(this,Up);m(this,Xa);m(this,wd);m(this,fi);var s,r;f(this,wd,g(s=Ou,qd,Dx).call(s,t)),f(this,fi,i),f(this,Up,e??g(r=Ou,qd,Lx).call(r,n(this,wd))?"rtl":"ltr")}_setL10n(t){f(this,fi,t)}getLanguage(){return n(this,wd)}getDirection(){return n(this,Up)}async get(t,e=null,i){var r;return Array.isArray(t)?(t=t.map(o=>({id:o})),(await n(this,fi).formatMessages(t)).map(o=>o.value)):((r=(await n(this,fi).formatMessages([{id:t,args:e}]))[0])==null?void 0:r.value)||i}async translate(t){(n(this,Xa)||f(this,Xa,new Set)).add(t);try{n(this,fi).connectRoot(t),await n(this,fi).translateRoots()}catch{}}async translateOnce(t){try{await n(this,fi).translateElements([t])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(n(this,Xa)){for(const t of n(this,Xa))n(this,fi).disconnectRoot(t);n(this,Xa).clear(),f(this,Xa,null)}n(this,fi).pauseObserving()}pause(){n(this,fi).pauseObserving()}resume(){n(this,fi).resumeObserving()}};Up=new WeakMap,Xa=new WeakMap,wd=new WeakMap,fi=new WeakMap,qd=new WeakSet,Dx=function(t){return t=(t==null?void 0:t.toLowerCase())||"en-us",{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[t]||t},Lx=function(t){const e=t.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(e)},m(Ou,qd);let Pv=Ou;function E1(){const{isAndroid:d,isLinux:t,isMac:e,isWindows:i}=mA.platform;return t?"linux":i?"windows":e?"macos":d?"android":"other"}function IE(d,t){const e=new n1(t),i=new VT(d,{functions:{PLATFORM:E1}}),s=i.addResource(e);return s.length&&console.error("L10n errors",s),i}var $i,Rx,Nx,Fx,Ox,Tv;const To=class To extends Pv{constructor(t){super({lang:t});const e=t?g(To,$i,Rx).bind(To,"en-us",this.getLanguage()):g(To,$i,Ox).bind(To,this.getLanguage());this._setL10n(new A1([],e))}};$i=new WeakSet,Rx=async function*(t,e){const{baseURL:i,paths:s}=await g(this,$i,Fx).call(this),r=[e];if(t!==e){const o=e.split("-",1)[0];o!==e&&r.push(o),r.push(t)}const a=r.map(o=>[o,g(this,$i,Nx).call(this,o,i,s)]);for(const[o,l]of a){const h=await l;h?yield h:o==="en-us"&&(yield g(this,$i,Tv).call(this,o))}}
61,Nx=async function(t,e,i){const s=i[t];if(!s)return null;const r=new URL(s,e),a=await nE(r,"text");return IE(t,a)},Fx=async function(){try{const{href:t}=document.querySelector('link[type="application/l10n"]'),e=await nE(t,"json");return{baseURL:t.substring(0,t.lastIndexOf("/")+1)||"./",paths:e}}catch{}return{baseURL:"./",paths:Object.create(null)}},Ox=async function*(t){yield g(this,$i,Tv).call(this,t)},Tv=async function(t){return IE(t
vendor: 24,953 bytes, lines 61-596
61,`pdfjs-previous-button = 62 .title = Previous Page 63pdfjs-previous-button-label = Previous 64pdfjs-next-button = 65 .title = Next Page 66pdfjs-next-button-label = Next 67pdfjs-page-input = 68 .title = Page 69pdfjs-of-pages = of { $pagesCount } 70pdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount }) 71pdfjs-zoom-out-button = 72 .title = Zoom Out 73pdfjs-zoom-out-button-label = Zoom Out 74pdfjs-zoom-in-button = 75 .title = Zoom In 76pdfjs-zoom-in-button-label = Zoom In 77pdfjs-zoom-select = 78 .title = Zoom 79pdfjs-presentation-mode-button = 80 .title = Switch to Presentation Mode 81pdfjs-presentation-mode-button-label = Presentation Mode 82pdfjs-open-file-button = 83 .title = Open File 84pdfjs-open-file-button-label = Open 85pdfjs-print-button = 86 .title = Print 87pdfjs-print-button-label = Print 88pdfjs-save-button = 89 .title = Save 90pdfjs-save-button-label = Save 91pdfjs-download-button = 92 .title = Download 93pdfjs-download-button-label = Download 94pdfjs-bookmark-button = 95 .title = Current Page (View URL from Current Page) 96pdfjs-bookmark-button-label = Current Page 97pdfjs-tools-button = 98 .title = Tools 99pdfjs-tools-button-label = Tools 100pdfjs-first-page-button = 101 .title = Go to First Page 102pdfjs-first-page-button-label = Go to First Page 103pdfjs-last-page-button = 104 .title = Go to Last Page 105pdfjs-last-page-button-label = Go to Last Page 106pdfjs-page-rotate-cw-button = 107 .title = Rotate Clockwise 108pdfjs-page-rotate-cw-button-label = Rotate Clockwise 109pdfjs-page-rotate-ccw-button = 110 .title = Rotate Counterclockwise 111pdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise 112pdfjs-cursor-text-select-tool-button = 113 .title = Enable Text Selection Tool 114pdfjs-cursor-text-select-tool-button-label = Text Selection Tool 115pdfjs-cursor-hand-tool-button = 116 .title = Enable Hand Tool 117pdfjs-cursor-hand-tool-button-label = Hand Tool 118pdfjs-scroll-page-button = 119 .title = Use Page Scrolling 120pdfjs-scroll-page-button-label = Page Scrolling 121pdfjs-scroll-vertical-button = 122 .title = Use Vertical Scrolling 123pdfjs-scroll-vertical-button-label = Vertical Scrolling 124pdfjs-scroll-horizontal-button = 125 .title = Use Horizontal Scrolling 126pdfjs-scroll-horizontal-button-label = Horizontal Scrolling 127pdfjs-scroll-wrapped-button = 128 .title = Use Wrapped Scrolling 129pdfjs-scroll-wrapped-button-label = Wrapped Scrolling 130pdfjs-spread-none-button = 131 .title = Do not join page spreads 132pdfjs-spread-none-button-label = No Spreads 133pdfjs-spread-odd-button = 134 .title = Join page spreads starting with odd-numbered pages 135pdfjs-spread-odd-button-label = Odd Spreads 136pdfjs-spread-even-button = 137 .title = Join page spreads starting with even-numbered pages 138pdfjs-spread-even-button-label = Even Spreads 139pdfjs-document-properties-button = 140 .title = Document Properties⦠141pdfjs-document-properties-button-label = Document Properties⦠142pdfjs-document-properties-file-name = File name: 143pdfjs-document-properties-file-size = File size: 144pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes) 145pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes) 146pdfjs-document-properties-title = Title: 147pdfjs-document-properties-author = Author: 148pdfjs-document-properties-subject = Subject: 149pdfjs-document-properties-keywords = Keywords: 150pdfjs-document-properties-creation-date = Creation Date: 151pdfjs-document-properties-modification-date = Modification Date: 152pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") } 153pdfjs-document-properties-creator = Creator: 154pdfjs-document-properties-producer = PDF Producer: 155pdfjs-document-properties-version = PDF Version: 156pdfjs-document-properties-page-count = Page Count: 157pdfjs-document-properties-page-size = Page Size: 158pdfjs-document-properties-page-size-unit-inches = in 159pdfjs-document-properties-page-size-unit-millimeters = mm 160pdfjs-document-properties-page-size-orientation-portrait = portrait 161pdfjs-document-properties-page-size-orientation-landscape = landscape 162pdfjs-document-properties-page-size-name-a-three = A3 163pdfjs-document-properties-page-size-name-a-four = A4 164pdfjs-document-properties-page-size-name-letter = Letter 165pdfjs-document-properties-page-size-name-legal = Legal 166pdfjs-document-properties-page-size-dimension-string = { $width } à { $height } { $unit } ({ $orientation }) 167pdfjs-document-properties-page-size-dimension-name-string = { $width } à { $height } { $unit } ({ $name }, { $orientation }) 168pdfjs-document-properties-linearized = Fast Web View: 169pdfjs-document-properties-linearized-yes = Yes 170pdfjs-document-properties-linearized-no = No 171pdfjs-document-properties-close-button = Close 172pdfjs-print-progress-message = Preparing document for printing⦠173pdfjs-print-progress-percent = { $progress }% 174pdfjs-print-progress-close-button = Cancel 175pdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser. 176pdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing. 177pdfjs-current-outline-item-button = 178 .title = Find Current Outline Item 179pdfjs-current-outline-item-button-label = Current Outline Item 180pdfjs-findbar-button = 181 .title = Find in Document 182pdfjs-findbar-button-label = Find 183pdfjs-additional-layers = Additional Layers 184pdfjs-thumb-page-title1 = 185 .title = Page { $page } of { $total } 186pdfjs-thumb-page-canvas = 187 .aria-label = Thumbnail of Page { $page } 188pdfjs-thumb-page-checkbox1 = 189 .title = Select page { $page } 190pdfjs-find-input = 191 .title = Find 192 .placeholder = Find in document⦠193pdfjs-find-previous-button = 194 .title = Find the previous occurrence of the phrase 195pdfjs-find-previous-button-label = Previous 196pdfjs-find-next-button = 197 .title = Find the next occurrence of the phrase 198pdfjs-find-next-button-label = Next 199pdfjs-find-highlight-checkbox = Highlight All 200pdfjs-find-match-case-checkbox-label = Match Case 201pdfjs-find-match-diacritics-checkbox-label = Match Diacritics 202pdfjs-find-entire-word-checkbox-label = Whole Words 203pdfjs-find-reached-top = Reached top of document, continued from bottom 204pdfjs-find-reached-bottom = Reached end of document, continued from top 205pdfjs-find-match-count = 206 { $total -> 207 [one] { $current } of { $total } match 208 *[other] { $current } of { $total } matches 209 } 210pdfjs-find-match-count-limit = 211 { $limit -> 212 [one] More than { $limit } match 213 *[other] More than { $limit } matches 214 } 215pdfjs-find-not-found = Phrase not found 216pdfjs-page-scale-width = Page Width 217pdfjs-page-scale-fit = Page Fit 218pdfjs-page-scale-auto = Automatic Zoom 219pdfjs-page-scale-actual = Actual Size 220pdfjs-page-scale-percent = { $scale }% 221pdfjs-page-landmark = 222 .aria-label = Page { $page } 223pdfjs-loading-error = An error occurred while loading the PDF. 224pdfjs-invalid-file-error = Invalid or corrupted PDF file. 225pdfjs-missing-file-error = Missing PDF file. 226pdfjs-unexpected-response-error = Unexpected server response. 227pdfjs-rendering-error = An error occurred while rendering the page. 228pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") } 229pdfjs-text-annotation-type = 230 .alt = [{ $type } Annotation] 231pdfjs-password-label = Enter the password to open this PDF file. 232pdfjs-password-invalid = Invalid password. Please try again. 233pdfjs-password-ok-button = OK 234pdfjs-password-cancel-button = Cancel 235pdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts. 236pdfjs-editor-free-text-button = 237 .title = Text 238pdfjs-editor-color-picker-free-text-input = 239 .title = Change text color 240pdfjs-editor-free-text-button-label = Text 241pdfjs-editor-ink-button = 242 .title = Draw 243pdfjs-editor-color-picker-ink-input = 244 .title = Change drawing color 245pdfjs-editor-ink-button-label = Draw 246pdfjs-editor-stamp-button = 247 .title = Add or edit images 248pdfjs-editor-stamp-button-label = Add or edit images 249pdfjs-editor-highlight-button = 250 .title = Highlight 251pdfjs-editor-highlight-button-label = Highlight 252pdfjs-highlight-floating-button1 = 253 .title = Highlight 254 .aria-label = Highlight 255pdfjs-highlight-floating-button-label = Highlight 256pdfjs-comment-floating-button = 257 .title = Comment 258 .aria-label = Comment 259pdfjs-comment-floating-button-label = Comment 260pdfjs-editor-comment-button = 261 .title = Comment 262 .aria-label = Comment 263pdfjs-editor-comment-button-label = Comment 264pdfjs-editor-signature-button = 265 .title = Add signature 266pdfjs-editor-signature-button-label = Add signature 267pdfjs-editor-highlight-editor = 268 .aria-label = Highlight editor 269pdfjs-editor-ink-editor = 270 .aria-label = Drawing editor 271pdfjs-editor-signature-editor1 = 272 .aria-description = Signature editor: { $description } 273pdfjs-editor-stamp-editor = 274 .aria-label = Image editor 275pdfjs-editor-remove-ink-button = 276 .title = Remove drawing 277pdfjs-editor-remove-freetext-button = 278 .title = Remove text 279pdfjs-editor-remove-stamp-button = 280 .title = Remove image 281pdfjs-editor-remove-highlight-button = 282 .title = Remove highlight 283pdfjs-editor-remove-signature-button = 284 .title = Remove signature 285pdfjs-editor-free-text-color-input = Color 286pdfjs-editor-free-text-size-input = Size 287pdfjs-editor-ink-color-input = Color 288pdfjs-editor-ink-thickness-input = Thickness 289pdfjs-editor-ink-opacity-input = Opacity 290pdfjs-editor-stamp-add-image-button = 291 .title = Add image 292pdfjs-editor-stamp-add-image-button-label = Add image 293pdfjs-editor-free-highlight-thickness-input = Thickness 294pdfjs-editor-free-highlight-thickness-title = 295 .title = Change thickness when highlighting items other than text 296pdfjs-editor-add-signature-container = 297 .aria-label = Signature controls and saved signatures 298pdfjs-editor-signature-add-signature-button = 299 .title = Add new signature 300pdfjs-editor-signature-add-signature-button-label = Add new signature 301pdfjs-editor-add-saved-signature-button = 302 .title = Saved signature: { $description } 303pdfjs-free-text2 = 304 .aria-label = Text Editor 305 .default-content = Start typing⦠306pdfjs-editor-comments-sidebar-title = 307 { $count -> 308 [one] Comment 309 *[other] Comments 310 } 311pdfjs-editor-comments-sidebar-close-button = 312 .title = Close the sidebar 313 .aria-label = Close the sidebar 314pdfjs-editor-comments-sidebar-close-button-label = Close the sidebar 315pdfjs-editor-comments-sidebar-no-comments1 = See something noteworthy? Highlight it and leave a comment. 316pdfjs-editor-comments-sidebar-no-comments-link = Learn more 317pdfjs-editor-alt-text-button = 318 .aria-label = Alt text 319pdfjs-editor-alt-text-button-label = Alt text 320pdfjs-editor-alt-text-edit-button = 321 .aria-label = Edit alt text 322pdfjs-editor-alt-text-dialog-label = Choose an option 323pdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people canât see the image or when it doesnât load. 324pdfjs-editor-alt-text-add-description-label = Add a description 325pdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions. 326pdfjs-editor-alt-text-mark-decorative-label = Mark as decorative 327pdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks. 328pdfjs-editor-alt-text-cancel-button = Cancel 329pdfjs-editor-alt-text-save-button = Save 330pdfjs-editor-alt-text-decorative-tooltip = Marked as decorative 331pdfjs-editor-alt-text-textarea = 332 .placeholder = For example, âA young man sits down at a table to eat a mealâ 333pdfjs-editor-resizer-top-left = 334 .aria-label = Top left corner â resize 335pdfjs-editor-resizer-top-middle = 336 .aria-label = Top middle â resize 337pdfjs-editor-resizer-top-right = 338 .aria-label = Top right corner â resize 339pdfjs-editor-resizer-middle-right = 340 .aria-label = Middle right â resize 341pdfjs-editor-resizer-bottom-right = 342 .aria-label = Bottom right corner â resize 343pdfjs-editor-resizer-bottom-middle = 344 .aria-label = Bottom middle â resize 345pdfjs-editor-resizer-bottom-left = 346 .aria-label = Bottom left corner â resize 347pdfjs-editor-resizer-middle-left = 348 .aria-label = Middle left â resize 349pdfjs-editor-highlight-colorpicker-label = Highlight color 350pdfjs-editor-colorpicker-button = 351 .title = Change color 352pdfjs-editor-colorpicker-dropdown = 353 .aria-label = Color choices 354pdfjs-editor-colorpicker-yellow = 355 .title = Yellow 356pdfjs-editor-colorpicker-green = 357 .title = Green 358pdfjs-editor-colorpicker-blue = 359 .title = Blue 360pdfjs-editor-colorpicker-pink = 361 .title = Pink 362pdfjs-editor-colorpicker-red = 363 .title = Red 364pdfjs-editor-highlight-show-all-button-label = Show all 365pdfjs-editor-highlight-show-all-button = 366 .title = Show all 367pdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description) 368pdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description) 369pdfjs-editor-new-alt-text-textarea = 370 .placeholder = Write your description here⦠371pdfjs-editor-new-alt-text-description = Short description for people who canât see the image or when the image doesnât load. 372pdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate. 373pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more 374pdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically 375pdfjs-editor-new-alt-text-not-now-button = Not now 376pdfjs-editor-new-alt-text-error-title = Couldnât create alt text automatically 377pdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later. 378pdfjs-editor-new-alt-text-error-close-button = Close 379pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB) 380 .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB) 381pdfjs-editor-new-alt-text-added-button = 382 .aria-label = Alt text added 383pdfjs-editor-new-alt-text-added-button-label = Alt text added 384pdfjs-editor-new-alt-text-missing-button = 385 .aria-label = Missing alt text 386pdfjs-editor-new-alt-text-missing-button-label = Missing alt text 387pdfjs-editor-new-alt-text-to-review-button = 388 .aria-label = Review alt text 389pdfjs-editor-new-alt-text-to-review-button-label = Review alt text 390pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText } 391pdfjs-image-alt-text-settings-button = 392 .title = Image alt text settings 393pdfjs-image-alt-text-settings-button-label = Image alt text settings 394pdfjs-editor-alt-text-settings-dialog-label = Image alt text settings 395pdfjs-editor-alt-text-settings-automatic-title = Automatic alt text 396pdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically 397pdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who canât see the image or when the image doesnât load. 398pdfjs-editor-alt-text-settings-editor-title = Alt text editor 399pdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image 400pdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text. 401pdfjs-editor-alt-text-settings-close-button = Close 402pdfjs-editor-highlight-added-alert = Highlight added 403pdfjs-editor-freetext-added-alert = Text added 404pdfjs-editor-ink-added-alert = Drawing added 405pdfjs-editor-stamp-added-alert = Image added 406pdfjs-editor-signature-added-alert = Signature added 407pdfjs-editor-undo-bar-message-highlight = Highlight removed 408pdfjs-editor-undo-bar-message-freetext = Text removed 409pdfjs-editor-undo-bar-message-ink = Drawing removed 410pdfjs-editor-undo-bar-message-stamp = Image removed 411pdfjs-editor-undo-bar-message-signature = Signature removed 412pdfjs-editor-undo-bar-message-comment = Comment removed 413pdfjs-editor-undo-bar-message-multiple = 414 { $count -> 415 [one] { $count } annotation removed 416 *[other] { $count } annotations removed 417 } 418pdfjs-editor-undo-bar-undo-button = 419 .title = Undo 420pdfjs-editor-undo-bar-undo-button-label = Undo 421pdfjs-editor-undo-bar-close-button = 422 .title = Close 423pdfjs-editor-undo-bar-close-button-label = Close 424pdfjs-editor-add-signature-dialog-label = This modal allows the user to create a signature to add to a PDF document. The user can edit the name (which also serves as the alt text), and optionally save the signature for repeated use. 425pdfjs-editor-add-signature-dialog-title = Add a signature 426pdfjs-editor-add-signature-type-button = Type 427 .title = Type 428pdfjs-editor-add-signature-draw-button = Draw 429 .title = Draw 430pdfjs-editor-add-signature-image-button = Image 431 .title = Image 432pdfjs-editor-add-signature-type-input = 433 .aria-label = Type your signature 434 .placeholder = Type your signature 435pdfjs-editor-add-signature-draw-placeholder = Draw your signature 436pdfjs-editor-add-signature-draw-thickness-range-label = Thickness 437pdfjs-editor-add-signature-draw-thickness-range = 438 .title = Drawing thickness: { $thickness } 439pdfjs-editor-add-signature-image-placeholder = Drag a file here to upload 440pdfjs-editor-add-signature-image-browse-link = 441 { PLATFORM() -> 442 [macos] Or choose image files 443 *[other] Or browse image files 444 } 445pdfjs-editor-add-signature-description-label = Description (alt text) 446pdfjs-editor-add-signature-description-input = 447 .title = Description (alt text) 448pdfjs-editor-add-signature-description-default-when-drawing = Signature 449pdfjs-editor-add-signature-clear-button-label = Clear signature 450pdfjs-editor-add-signature-clear-button = 451 .title = Clear signature 452pdfjs-editor-add-signature-save-checkbox = Save signature 453pdfjs-editor-add-signature-save-warning-message = Youâve reached the limit of 5 saved signatures. Remove one to save more. 454pdfjs-editor-add-signature-image-upload-error-title = Couldnât upload image 455pdfjs-editor-add-signature-image-upload-error-description = Check your network connection or try another image. 456pdfjs-editor-add-signature-image-no-data-error-title = Canât convert this image into a signature 457pdfjs-editor-add-signature-image-no-data-error-description = Please try uploading a different image. 458pdfjs-editor-add-signature-error-close-button = Close 459pdfjs-editor-add-signature-cancel-button = Cancel 460pdfjs-editor-add-signature-add-button = Add 461pdfjs-editor-delete-signature-button1 = 462 .title = Remove saved signature 463pdfjs-editor-delete-signature-button-label1 = Remove saved signature 464pdfjs-editor-add-signature-edit-button-label = Edit description 465pdfjs-editor-edit-signature-dialog-title = Edit description 466pdfjs-editor-edit-signature-update-button = Update 467pdfjs-show-comment-button = 468 .title = Show comment 469pdfjs-editor-edit-comment-popup-button-label = Edit comment 470pdfjs-editor-edit-comment-popup-button = 471 .title = Edit comment 472pdfjs-editor-delete-comment-popup-button-label = Remove comment 473pdfjs-editor-delete-comment-popup-button = 474 .title = Remove comment 475pdfjs-editor-edit-comment-dialog-title-when-editing = Edit comment 476pdfjs-editor-edit-comment-dialog-save-button-when-editing = Update 477pdfjs-editor-edit-comment-dialog-title-when-adding = Add comment 478pdfjs-editor-edit-comment-dialog-save-button-when-adding = Add 479pdfjs-editor-edit-comment-dialog-text-input = 480 .placeholder = Start typing⦠481pdfjs-editor-edit-comment-dialog-cancel-button = Cancel 482pdfjs-editor-add-comment-button = 483 .title = Add comment 484pdfjs-toggle-views-manager-button1 = 485 .title = Manage pages 486pdfjs-toggle-views-manager-notification-button = 487 .title = Toggle Sidebar (document contains thumbnails/outline/attachments/layers) 488pdfjs-toggle-views-manager-button1-label = Manage pages 489pdfjs-views-manager-sidebar = 490 .aria-label = Sidebar 491pdfjs-views-manager-sidebar-resizer = 492 .aria-label = Sidebar resizer 493pdfjs-views-manager-view-selector-button = 494 .title = Views 495pdfjs-views-manager-view-selector-button-label = Views 496pdfjs-views-manager-pages-title = Pages 497pdfjs-views-manager-outlines-title1 = Document outline 498 .title = Document outline (double-click to expand/collapse all items) 499pdfjs-views-manager-attachments-title = Attachments 500pdfjs-views-manager-layers-title1 = Layers 501 .title = Layers (double-click to reset all layers to the default state) 502pdfjs-views-manager-pages-option-label = Pages 503pdfjs-views-manager-outlines-option-label = Document outline 504pdfjs-views-manager-attachments-option-label = Attachments 505pdfjs-views-manager-layers-option-label = Layers 506pdfjs-views-manager-add-file-button = 507 .title = Add file 508pdfjs-views-manager-add-file-button-label = Add file 509pdfjs-views-manager-pages-status-action-label = 510 { $count -> 511 [one] { $count } selected 512 *[other] { $count } selected 513 } 514pdfjs-views-manager-pages-status-none-action-label = Select pages 515pdfjs-views-manager-pages-status-action-button-label = Manage 516pdfjs-views-manager-pages-status-copy-button-label = Copy 517pdfjs-views-manager-pages-status-cut-button-label = Cut 518pdfjs-views-manager-pages-status-delete-button-label = Delete 519pdfjs-views-manager-pages-status-export-selected-button-label = Export selected⦠520pdfjs-views-manager-status-undo-cut-label = 521 { $count -> 522 [one] 1 page cut 523 *[other] { $count } pages cut 524 } 525pdfjs-views-manager-pages-status-undo-copy-label = 526 { $count -> 527 [one] 1 page copied 528 *[other] { $count } pages copied 529 } 530pdfjs-views-manager-pages-status-undo-delete-label = 531 { $count -> 532 [one] 1 page deleted 533 *[other] { $count } pages deleted 534 } 535pdfjs-views-manager-status-undo-button-label = Undo 536pdfjs-views-manager-status-done-button-label = Done 537pdfjs-views-manager-status-close-button = 538 .title = Close 539pdfjs-views-manager-status-close-button-label = Close 540pdfjs-views-manager-paste-button-label = Paste 541pdfjs-views-manager-paste-button-before = 542 .title = Paste before the first page 543pdfjs-views-manager-paste-button-after = 544 .title = Paste after page { $page } 545pdfjs-new-badge-content = NEW 546pdfjs-views-manager-waiting-for-file = Uploading file⦠547pdfjs-digital-signature-properties-button = 548 .title = Digital signature properties 549 .aria-label = Digital signature properties 550pdfjs-digital-signature-properties-button-label = Digital signature properties 551pdfjs-digital-signature-properties-banner-verified = Document was signed with a valid digital signature 552pdfjs-digital-signature-properties-banner-unknown = 553 { $count -> 554 [one] Document signed but { $count } digital signature could not be verified 555 *[other] Document signed but { $count } digital signatures could not be verified 556 } 557pdfjs-digital-signature-properties-banner-untrusted = 558 { $count -> 559 [one] Document signed with { $count } certificate that is not trusted 560 *[other] Document signed with { $count } certificates that are not trusted 561 } 562pdfjs-digital-signature-properties-banner-expired = 563 { $count -> 564 [one] Document signed with { $count } expired certificate 565 *[other] Document signed with { $count } expired certificates 566 } 567pdfjs-digital-signature-properties-banner-invalid = 568 { $count -> 569 [one] Document has { $count } invalid digital signature 570 *[other] Document has { $count } invalid digital signatures 571 } 572pdfjs-digital-signature-properties-banner-revoked = 573 { $count -> 574 [one] Document signed with { $count } revoked certificate 575 *[other] Document signed with { $count } revoked certificates 576 } 577pdfjs-digital-signature-properties-status-verified = Status: Signature verified 578pdfjs-digital-signature-properties-status-invalid = Status: Signature invalid 579pdfjs-digital-signature-properties-status-unknown = Status: Unable to verify (unsupported) 580pdfjs-digital-signature-properties-certificate-trusted = Certificate: Trusted ({ $issuer }) 581pdfjs-digital-signature-properties-certificate-unknown = Certificate: Unavailable 582pdfjs-digital-signature-properties-certificate-untrusted = Certificate: Untrusted 583pdfjs-digital-signature-properties-certificate-untrusted-unknown-issuer = Certificate: Unknown issuer ({ $issuer }) 584pdfjs-digital-signature-properties-certificate-untrusted-self-signed = Certificate: Self-signed ({ $issuer }) 585pdfjs-digital-signature-properties-certificate-untrusted-untrusted-issuer = Certificate: Untrusted issuer ({ $issuer }) 586pdfjs-digital-signature-properties-certificate-expired = Certificate: Expired 587pdfjs-digital-signature-properties-certificate-expired-with-date = Certificate: Expired ({ DATETIME($dateObj, dateStyle: "medium") }) 588pdfjs-digital-signature-properties-certificate-revoked = Certificate: Revoked 589pdfjs-digital-signature-properties-view-certificate = View certificate 590pdfjs-digital-signature-properties-reason = Reason: { $reason } 591pdfjs-digital-signature-properties-timestamp = Timestamp: { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") } 592pdfjs-digital-signature-properties-sub-signatures = 593 { $count -> 594 [one] Sub-signature ({ $count }) 595 *[other] Sub-signatures ({ $count }) 596 }`)}
596,m(To,$i);let Xd=To;const S1=1e3,x1=50,_1=1e3;function uy(){return document.location.hash}var Ya,et,_n,Nm,Fm,Mu,Om,kv,Bx,jx,Mv,Ux,$x;class C1{constructor({linkService:t,eventBus:e}){m(this,et);m(this,Ya,null);this.linkService=t,this.eventBus=e,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus.on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus.on("pagesloaded",i=>{this._isPagesLoaded=!!i.pagesCount},{once:!0,...ei})},ei)}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:i=!1}){if(!t||typeof t!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const s=this._fingerprint!==""&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=i===!0,this._initialized=!0,g(this,et,Ux
596).call(this);const r=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=uy(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!g(this,et,Mu).call(this,r,!0)||e){const{hash:o,page:l,rotation:h}=g(this,et,kv).call(this,!0);if(!o||s||e){g(this,et,_n).call(this,null,!0);return}g(this,et,_n).call(this,{hash:o,page:l,rotation:h},!0);return}const a=r.destination;g(this,et,Om).call(this,a,r.uid,!0),a.rotation!==void 0&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(g(this,et,Mv).call(this),this._initialized=!1,g(this,et,$x).call(this)),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:i}){if(!this._initialized)return;if(t&&typeof t!="string"){console.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);return}else if(Array.isArray(e)){if(!g(this,et,Fm).call(this,i)&&(i!==null||this._destination)){console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${e}" is not a valid explicitDest parameter.`);return}const s=t||JSON.stringify(e);if(!s)return;let r=!1;if(this._destination&&(P1(this._destination.hash,s)||T1(this._destination.dest,e))){if(this._destination.page)return;r=!0}this._popStateInProgress&&!r||(g(this,et,_n).call(this,{dest:e,hash:s,page:i,rotation:this.linkService.rotation},r),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){var e;if(this._initialized){if(!g(this,et,Fm).call(this,t)){console.error(`PDFHistory.pushPage: "${t}" is not a valid page number.`);return}((e=this._destination)==null?void 0:e.page)!==t&&(this._popStateInProgress||(g(this,et,_n).call(this,{dest:null,hash:`page=${t}`,page:t,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||g(this,et,Nm).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;g(this,et,Mu).call(this,t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;g(this,et,Mu).call(this,t)&&t.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}}Ya=new WeakMap,et=new WeakSet,_n=function(t,e=!1){const i=e||!this._destination,s={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};g(this,et,Om).call(this,t,s.uid);let r;if(this._updateUrl&&(t!=null&&t.hash)){const{href:a,protocol:o}=document.location;o!=="file:"&&(r=aT(a,t.hash))}i?window.history.replaceState(s,"",r):window.history.pushState(s,"",r)},Nm=function(t=!1){if(!this._position)return;let e=this._position;if(t&&(e=Object.assign(Object.create(null),this._position),e.temporary=!0),!this._destination){g(this,et,_n).call(this,e);return}if(this._destination.temporary){g(this,et,_n).call(this,e,!0);return}if(this._destination.hash===e.hash||!this._destination.page&&this._numPositionUpdates<=x1)return;let i=!1;if(this._destination.page>=e.first&&this._destination.page<=e.page){if(this._destination.dest!==void 0||!this._destination.first)return;i=!0}g(this,et,_n).call(this,e,i)},Fm=function(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount},Mu=function(t,e=!1){if(!t)return!1;if(t.fingerprint!==this._fingerprint)if(e){if(typeof t.fingerprint!="string"||t.fingerprint.length!==this._fingerprint.length)return!1;const[i]=performance.getEntriesByType("navigation");if((i==null?void 0:i.type)!=="reload")return!1}else return!1;return!(!Number.isInteger(t.uid)||t.uid<0||t.destination===null||typeof t.destination!="object")}
596,Om=function(t,e,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&(t!=null&&t.temporary)&&delete t.temporary,this._destination=t,this._uid=e,this._maxUid=Math.max(this._maxUid,e),this._numPositionUpdates=0},kv=function(t=!1){const e=unescape(uy()).substring(1),i=Yb(e),s=i.get("nameddest")||"";let r=i.get("page")|0;return(!g(this,et,Fm).call(this,r)||t&&s.length>0)&&(r=null),{hash:e,page:r,rotation:this.linkService.rotation}},Bx=function({location:t}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||g(this,et,Nm).call(this,!0),this._updateViewareaTimeout=null},_1))},jx=function({state:t}){const e=uy(),i=this._currentHash!==e;if(this._currentHash=e,!t){this._uid++;const{hash:r,page:a,rotation:o}=g(this,et,kv).call(this);g(this,et,_n).call(this,{hash:r,page:a,rotation:o},!0);return}if(!g(this,et,Mu).call(this,t))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,TT({target:window,name:"hashchange",delay:S1}).then(()=>{this._blockHashChange--}));const s=t.destination;g(this,et,Om).call(this,s,t.uid,!0),gx(s.rotation)&&(this.linkService.rotation=s.rotation),s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})},Mv=function(){(!this._destination||this._destination.temporary)&&g(this,et,Nm).call(this)},Ux=function(){if(n(this,Ya))return;f(this,Ya,new AbortController);const{signal:t}=n(this,Ya);this.eventBus.on("updateviewarea",g(this,et,Bx).bind(this),{signal:t,...ei}),window.addEventListener("popstate",g(this,et,jx).bind(this),{signal:t}),window.addEventListener("pagehide",g(this,et,Mv).bind(this),{signal:t})},$x=function(){var t;(t=n(this,Ya))==null||t.abort(),f(this,Ya,null)};function P1(d,t){return typeof d!="string"||typeof t!="string"?!1:d===t||Yb(d).get("nameddest")===t}function T1(d,t){function e(i,s){if(typeof i!=typeof s||Array.isArray(i)||Array.isArray(s))return!1;if(i!==null&&typeof i=="object"&&s!==null){if(Object.keys(i).length!==Object.keys(s).length)return!1;for(const r in i)if(!e(i[r],s[r]))return!1;return!0}return i===s||Number.isNaN(i)&&Number.isNaN(s)}if(!(Array.isArray(d)&&Array.isArray(t))||d.length!==t.length)return!1;for(let i=0,s=d.length;i<s;i++)if(!e(d[i],t[i]))return!1;return!0}var $p,Vp,Hp,zp,Wp,vd;class k1{constructor(t){m(this,$p,null);m(this,Vp,null);m(this,Hp,null);m(this,zp,null);m(this,Wp,null);m(this,vd);this.pageIndex=t.pageIndex,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||(this.l10n=new Xd),this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,f(this,vd,t.uiManager),f(this,$p,t.annotationLayer||null),f(this,Wp,t.textLayer||null),f(this,Vp,t.drawLayer||null),f(this,Hp,t.onAppend||null),f(this,zp,t.structTreeLayer||null)}updatePageIndex(t){var e;this.pageIndex=t,(e=this.annotationEditorLayer)==null||e.updatePageIndex(t)}async render({viewport:t,intent:e="display"}){var a;if(e!=="display"||this._cancelled)return;const i=t.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i}),this.show();return}const s=this.div=document.createElement("div");s.className="annotationEditorLayer",s.hidden=!0,s.dir=n(this,vd).direction,(a=n(this,Hp))==null||a.call(this,s),this.annotationEditorLayer=new WP({uiManager:n(this,vd),div:s,structTreeLayer:n(this,zp),accessibilityManager:this.accessibilityManager,pageIndex:this.pageIndex,l10n:this.l10n,viewport:i,annotationLayer:n(this,$p),textLayer:n(this,Wp),drawLayer:n(this,Vp)});const r={viewport:i,div:s,annotations:null,intent:e};await this.annotationEditorLayer.render(r),this.show()}update(t){this.div&&this.annotationEditorLayer.update({viewport:t.clone({dontFlip:!0})})}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.annotationEditorLayer.pause(!0),this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1,this.annotationEditorLayer.pause(!1))}}$p=new WeakMap,Vp=new WeakMap,Hp=new WeakMap,zp=new WeakMap,Wp=new WeakMap,vd=new WeakMap;{var Iv=new Map;const{maxTouchPoints:d,platform:t,userAgent:e}=navigator,i=/Android/.test(e);(/\b(?:iPad|iPhone|iPod)(?=;)/.test(e)||t==="MacIntel"&&d>1||i)&&Iv.set("maxCanvasPixels",5242880),i&&Iv.set("useSystemFonts",!1)}const M={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},Dv={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},fy=new Map([["allowedGlobalEvents",{value:null,kind:M.BROWSER}],["canvasMaxAreaInBytes",{value:-1,kind:M.BROWSER+M.API}],["isInAutomation",{value:!1,kind:M.BROWSER}],["localeProperties",{value:{lang:navigator.language||"en-US"},kind:M.BROWSER}],["maxCanvasDim",{value:32767,kind:M.BROWSER+M.VIEWER}],["nimbusDataStr",{value:"",kind:M.BROWSER}],["supportsCaretBrowsingMode",{value:!1,kind:M.BROWSER}],["supportsDocumentFonts",{value:!0,kind:M.BROWSER}],["supportsDownloading",{value:!0,kind:M.BROWSER}],["supportsIntegratedFind",{value:!1,kind:M.BROWSER}
vendor: 4,287 bytes, line 596
596],["supportsMouseWheelZoomCtrlKey",{value:!0,kind:M.BROWSER}],["supportsMouseWheelZoomMetaKey",{value:!0,kind:M.BROWSER}],["supportsPinchToZoom",{value:!0,kind:M.BROWSER}],["supportsPrinting",{value:!0,kind:M.BROWSER}],["toolbarDensity",{value:0,kind:M.BROWSER+M.EVENT_DISPATCH}],["altTextLearnMoreUrl",{value:"",kind:M.VIEWER+M.PREFERENCE}],["annotationEditorMode",{value:0,kind:M.VIEWER+M.PREFERENCE}],["annotationMode",{value:2,kind:M.VIEWER+M.PREFERENCE}],["capCanvasAreaFactor",{value:200,kind:M.VIEWER+M.PREFERENCE}],["commentLearnMoreUrl",{value:"",kind:M.VIEWER+M.PREFERENCE}],["cursorToolOnLoad",{value:0,kind:M.VIEWER+M.PREFERENCE}],["debuggerSrc",{value:"./debugger.mjs",kind:M.VIEWER}],["defaultUrl",{value:"compressed.tracemonkey-pldi-09.pdf",kind:M.VIEWER}],["defaultZoomDelay",{value:400,kind:M.VIEWER+M.PREFERENCE}],["defaultZoomValue",{value:"",kind:M.VIEWER+M.PREFERENCE}],["disableHistory",{value:!1,kind:M.VIEWER}],["disablePageLabels",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["disablePreferences",{value:!1,kind:M.VIEWER}],["enableAltText",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableAltTextModelDownload",{value:!0,kind:M.VIEWER+M.PREFERENCE+M.EVENT_DISPATCH}],["enableAutoLinking",{value:!0,kind:M.VIEWER+M.PREFERENCE}],["enableComment",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableDetailCanvas",{value:!0,kind:M.VIEWER}],["enableGuessAltText",{value:!0,kind:M.VIEWER+M.PREFERENCE+M.EVENT_DISPATCH}],["enableHighlightFloatingButton",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableMerge",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableNewAltTextWhenAddingImage",{value:!0,kind:M.VIEWER+M.PREFERENCE}],["enableNewBadge",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableNova",{value:!0,kind:M.VIEWER+M.PREFERENCE}],["enableOptimizedPartialRendering",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enablePermissions",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enablePrintAutoRotate",{value:!0,kind:M.VIEWER+M.PREFERENCE}],["enableScripting",{value:!0,kind:M.VIEWER+M.PREFERENCE}],["enableSelectionRendering",{value:!0,kind:M.VIEWER+M.PREFERENCE}],["enableSignatureEditor",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableSignatureVerification",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableSplitMerge",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["enableUpdatedAddImage",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["externalLinkRel",{value:"noopener noreferrer nofollow",kind:M.VIEWER}],["externalLinkTarget",{value:0,kind:M.VIEWER+M.PREFERENCE}],["highlightEditorColors",{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F,yellow_HCM=#FFFFCC,green_HCM=#53FFBC,blue_HCM=#80EBFF,pink_HCM=#F6B8FF,red_HCM=#C50043",kind:M.VIEWER+M.PREFERENCE}],["historyUpdateUrl",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["ignoreDestinationZoom",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["imageResourcesPath",{value:"./images/",kind:M.VIEWER}],["imagesRightClickMinSize",{value:-1,kind:M.VIEWER+M.PREFERENCE}],["maxCanvasPixels",{value:2**25,kind:M.VIEWER}],["minDurationToUpdateCanvas",{value:500,kind:M.VIEWER}],["forcePageColors",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["pageColorsBackground",{value:"Canvas",kind:M.VIEWER+M.PREFERENCE}],["pageColorsForeground",{value:"CanvasText",kind:M.VIEWER+M.PREFERENCE}],["pdfBugEnabled",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["postMessageAfterPrintCallback",{value:!1,kind:M.VIEWER+M.PREFERENCE}],["printResolution",{value:150,kind:M.VIEWER}],["sandboxBundleSrc",{value:"../build/pdf.sandbox.mjs",kind:M.VIEWER}],["sidebarViewOnLoad",{value:-1,kind:M.VIEWER+M.PREFERENCE}],["scrollModeOnLoad",{value:-1,kind:M.VIEWER+M.PREFERENCE}],["spreadModeOnLoad",{value:-1,kind:M.VIEWER+M.PREFERENCE}],["textLayerMode",{value:1,kind:M.VIEWER+M.PREFERENCE}],["viewerCssTheme",{value:0,kind:M.VIEWER+M.PREFERENCE}],["viewOnLoad",{value:0,kind:M.VIEWER+M.PREFERENCE}],["cMapPacked",{value:!0,kind:M.API}],["cMapUrl",{value:"../web/cmaps/",kind:M.API}],["disableAutoFetch",{value:!1,kind:M.API+M.PREFERENCE}],["disableFontFace",{value:!1,kind:M.API+M.PREFERENCE}],["disableRange",{value:!1,kind:M.API+M.PREFERENCE}],["disableStream",{value:!1,kind:M.API+M.PREFERENCE}],["docBaseUrl",{value:"",kind:M.API}],["enableHWA",{value:!0,kind:M.API+M.PREFERENCE}],["enableWebGPU",{value:!0,kind:M.API+M.PREFERENCE}],["enableXfa",{value:!0,kind:M.API+M.PREFERENCE}
596],["fontExtraProperties",{value:!1,kind:M.API}],["iccUrl",{value:"../web/iccs/",kind:M.API}],["isOffscreenCanvasSupported",{value:!0,kind:M.API}],["maxImageSize",{value:-1,kind:M.API}],["pdfBug",{value:!1,kind:M.API}],["standardFontDataUrl",{value:"../web/standard_fonts/",kind:M.API}],["useSystemFonts",{value:void 0,kind:M.API,type:Dv.BOOLEAN+Dv.UNDEFINED}],["verbosity",{value:1,kind:M.API}],["wasmUrl",{value:"../web/wasm/",kind:M.API}],["workerPort",{value:null,kind:M.WORKER}],["workerSrc",{value:"../build/pdf.worker.mjs",kind:M.WORKER}]]);var Ka;const Os=class Os{static get(t){return n(this,Ka).get(t)}static getAll(t=null,e=!1){const i=Object.create(null);for(const[s,r]of fy)t&&!(t&r.kind)||(i[s]=e?r.value:n(this,Ka).get(s));return i}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){this._hasInvokedSet||(this._hasInvokedSet=!0);let i;for(const s in t){const r=fy.get(s),a=t[s];if(!r||!(typeof a==typeof r.value||Dv[(typeof a).toUpperCase()]&r.type))continue;const{kind:o}=r;e&&!(o&M.BROWSER||o&M.PREFERENCE)||(this.eventBus&&o&M.EVENT_DISPATCH&&(i??(i=new Map)).set(s,a),n(this,Ka).set(s,a))}i==null||i.forEach((s,r)=>{this.eventBus.dispatch(r.toLowerCase(),{source:this,value:s})})}};Ka=new WeakMap,T(Os,"eventBus"),m(Os,Ka,new Map),(()=>{for(const[t,e]of fy)n(Os,Ka).set(t,e.value);for(const[t,e]of Iv)n(Os,Ka).set(t,e);Os._hasInvokedSet=!1,Os._checkDisablePreferences=()=>Os.get("disablePreferences")?!0:(Os._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();let Nu=Os;function DE({width:d,height:t,left:e,top:i},s){if(d===0||t===0)return null;const r=s.textLayer.div.getBoundingClientRect(),a=s.getPagePoint(e-r.left,i-r.top),o=s.getPagePoint(e-r.left+d,i-r.top+t);return bA.normalizeRect([a[0],a[1],o[0],o[1]])}function M1(d,t){const e=d.getClientRects();if(e.length===1)return{rect:DE(e[0],t)};const i=[1/0,1/0,-1/0,-1/0],s=[];let r=0;for(const a of e){const o=DE(a,t);o!==null&&(s[r]=s[r+4]=o[0],s[r+1]=s[r+3]=o[3],s[r+2]=s[r+6]=o[2],s[r+5]=s[r+7]=o[1],bA.rectBoundingBox(...o,i),r+=8)}return{quadPoints:s,rect:i}}function LE(d,t){let e=d;do{if(e.nodeType===Node.TEXT_NODE){const i=e.textContent.length;if(t<=i)return[e,t];t-=i}else if(e.firstChild){e=e.firstChild;continue}for(;!e.nextSibling&&e!==d;)e=e.parentNode;e!==d&&(e=e.nextSibling)}while(e!==d);throw new Error("Offset is bigger than container's contents length.")}function I1({url:d,index:t,length:e},i,s){const r=i._textHighlighter,[{begin:a,end:o}]=r._convertMatches([t],[e]),l=new Range;return l.setStart(...LE(r.textDivs[a.divIdx],a.offset)),l.setEnd(...LE(r.textDivs[o.divIdx],o.offset)),{id:`inferred_link_${s}`,unsafeUrl:d,url:d,annotationType:ux.LINK,rotation:0,...M1(l,i),borderStyle:null}}var Tb,Gp,Xp;class Bm{static findLinks(t){var a;n(this,Gp)??f(this,Gp,new RegExp("\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|(?=\\p{L})[\\S--[@\\p{Ps}\\p{Pe}<>]]{1,64}@([\\S--[[\\p{P}--\\-]<>]]{1,63}(?:\\.[\\S--[[\\p{P}--\\-]<>]]{1,63})+)","gv"));const[e,i]=Dm(t,{ignoreDashEOL:!0}),s=e.matchAll(n(this,Gp)),r=[];for(const o of s){const[l,h]=o;let c;if(l.startsWith("www.")||l.startsWith("http://")||l.startsWith("https://"))c=l;else if(h){const p=(a=URL.parse(`http://${h}`))==null?void 0:a.hostname;if(!p||(n(this,Xp)??f(this,Xp,/\.\d+$/),n(this,Xp).test(p)))continue}c??(c=l.startsWith("mailto:")?l:`mailto:${l}`);const u=fx(c,null,{addDefaultProtocol:!0});if(u){const[p,b]=bx(i,o.index,l.length);r.push({url:u.href,index:p,length:b})}}return r}static processLinks(t){return this.findLinks(t._textHighlighter.textContentItemsStr.join(` 597`)).map(e=>I1(e,t,kt(this,Tb)._++))}}Tb=new WeakMap,Gp=new WeakMap,Xp=new WeakMap,m(Bm,Tb,0),m(Bm,Gp),m(Bm,Xp);const ct={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};class D1{constructor(){T(this,"renderingId","");T(this,"renderTask",null);T(this,"resume",null)}get renderingState(){throw new Error("Abstract getter `renderingState` accessed")}set renderingState(t){throw new Error("Abstract setter `renderingState` accessed")}async draw(){throw new Error("Not implemented: draw")}}var qa,Ad,Ed,dr,Qa,ur,kb,Yp,Lv;class Vx extends D1{constructor(e){super();m(this,Yp);m(this,qa,null);m(this,Ad,null);m(this,Ed,ct.INITIAL);m(this,dr,null);
597m(this,Qa,0);m(this,ur,null);T(this,"canvas",null);T(this,"div",null);T(this,"enableOptimizedPartialRendering",!1);T(this,"enableSelectionRendering",!0);T(this,"imagesRightClickMinSize",-1);T(this,"eventBus",null);T(this,"id",null);T(this,"imageCoordinates",null);T(this,"pageColors",null);T(this,"recordedBBoxes",null);T(this,"renderingQueue",null);m(this,kb,e=>{var i;if((i=n(this,dr))==null||i.call(this,!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=ct.PAUSED,this.resume=()=>{this.renderingState=ct.RUNNING,e()};return}e()});this.eventBus=e.eventBus,this.id=e.id,this.pageColors=e.pageColors||null,this.renderingQueue=e.renderingQueue,this.enableOptimizedPartialRendering=e.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=e.enableSelectionRendering!==!1&&mA.isBackdropFilterSupported,this.imagesRightClickMinSize=e.imagesRightClickMinSize??-1,this.minDurationToUpdateCanvas=e.minDurationToUpdateCanvas??500}get renderingState(){return n(this,Ed)}set renderingState(e){var i;if(e!==n(this,Ed))switch(f(this,Ed,e),n(this,qa)&&(clearTimeout(n(this,qa)),f(this,qa,null)),e){case ct.PAUSED:this.div.classList.remove("loading"),f(this,Qa,0
597),(i=n(this,dr))==null||i.call(this,!1);break;case ct.RUNNING:this.div.classList.add("loadingIcon"),f(this,qa,setTimeout(()=>{this.div.classList.add("loading"),f(this,qa,null)},0)),f(this,Qa,Date.now());break;case ct.INITIAL:case ct.FINISHED:this.div.classList.remove("loadingIcon","loading"),f(this,Qa,0);break}}_createCanvas(e,i=!1){const{pageColors:s}=this,r=!!(s!=null&&s.background&&(s!=null&&s.foreground)),a=this.canvas,o=!a&&!r&&!i;let l=this.canvas=document.createElement("canvas");return f(this,dr,h=>{if(o){let c=n(this,ur);if(!h&&this.minDurationToUpdateCanvas>0){if(Date.now()-n(this,Qa)<this.minDurationToUpdateCanvas)return;c||(c=f(this,ur,l),l=this.canvas=l.cloneNode(!1),e(l))}if(c){l.getContext("2d",{alpha:!1}).drawImage(c,0,0),h?g(this,Yp,Lv).call(this):f(this,Qa,Date.now());return}e(l),f(this,dr,null);return}h&&(a?(a.replaceWith(l),a.width=a.height=0):e(l))}),{canvas:l,prevCanvas:a}}_resetCanvas(){const{canvas:e}=this;e&&(e.remove(),e.width=e.height=0,this.canvas=null,g(this,Yp,Lv).call(this))}async _drawCanvas(e,i,s){var o,l;const r=this.renderTask=this.pdfPage.render(e);r.onContinue=n(this,kb),r.onError=h=>{h instanceof fv&&(i(),f(this,Ad,null))};let a=null;try{await r.promise,(o=n(this,dr))==null||o.call(this,!0)}catch(h){if(h instanceof fv)return;a=h,(l=n(this,dr))==null||l.call(this,!0)}finally{f(this,Ad,a),r===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??(this.recordedBBoxes=r.recordedBBoxes)),this.imagesRightClickMinSize!==-1&&(this.imageCoordinates??(this.imageCoordinates=this.pdfPage.imageCoordinates)))}if(this.renderingState=ct.FINISHED,s(r),a)throw a}cancelRendering({cancelExtraDelay:e=0}={}){this.renderTask&&(this.renderTask.cancel(e),this.renderTask=null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(e,i){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:e,isDetailView:i,timestamp:performance.now(),error:n(this,Ad)})}}qa=new WeakMap,Ad=new WeakMap,Ed=new WeakMap,dr=new WeakMap,Qa=new WeakMap,ur=new WeakMap,kb=new WeakMap,Yp=new WeakSet,Lv=function(){n(this,ur)&&(n(this,ur).width=n(this,ur).height=0,f(this,ur,null))};var fr;class L1{constructor(t){m(this,fr,null);this.pageIndex=t.pageIndex,this.textLayer=t.textLayer||null,this.filterFactory=t.filterFactory||null,this.pageColors=t.pageColors||null}async render({intent:t="display"}){t!=="display"||n(this,fr)||this._cancelled||f(this,fr,new YP({pageIndex:this.pageIndex,textLayer:this.textLayer,filterFactory:this.filterFactory,pageColors:this.pageColors}))}cancel(){var t;this._cancelled=!0,(t=n(this,fr))==null||t.destroy(),f(this,fr,null)}setParent(t){var e;(e=n(this,fr))==null||e.setParent(t)}getDrawLayer(){return n(this,fr)}}fr=new WeakMap;var rs,Mb,Hx;class R1 extends Vx{constructor({pageView:e}){super(e);m(this,Mb);m(this,rs,null);T(this,"renderingCancelled",!1);this.pageView=e,this.renderingId="detail"+this.id,this.div=e.div}setPdfPage(e){this.pageView.setPdfPage(e)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(e){this.renderingCancelled=!1,super.renderingState=e}reset({keepCanvas:e=!1}={}){const i=this.renderingCancelled||this.renderingState===ct.RUNNING||this.renderingState===ct.PAUSED;this.cancelRendering(),this.renderingState=ct.INITIAL,this.renderingCancelled=i,e||this._resetCanvas()}update({visibleArea:e=null,underlyingViewUpdated:i=!1}={}){if(i){this.cancelRendering(),this.renderingState=ct.INITIAL;return}if(!g(this,Mb,Hx).call(this,e))return;const{viewport:s,maxCanvasPixels:r,capCanvasAreaFactor:a}=this.pageView,o=e.maxX-e.minX,l=e.maxY-e.minY,h=o*l*Im.pixelRatio**2,u=(Math.sqrt(Im.capPixels(r,a)/h)-1)/2;let p=Math.min(1,u);p<0&&(p=0);const b=o*p,y=l*p,w=Math.max(0,e.minX-b),v=Math.min(s.width,e.maxX+b),A=Math.max(0,e.minY-y),E=Math.min(s.height,e.maxY+y),S=v-w,x=E-A;f(this,rs,{minX:w,minY:A,width:S,height:x,scale:s.scale}),this.reset({keepCanvas:!0})}_getRenderingContext(e,i){const s=this.pageView._getRenderingContext(e,i,!1),r=this.pdfPage.recordedBBoxes;if(!r||!this.enableOptimizedPartialRendering)return s;const{viewport:{width:a,height:o}}=this.pageView,{width:l,height:h,minX:c,minY:u}=n(this,rs),p=c/a,b=u/o,y=(c+l)/a,w=(u+h)/o;return{...s,operationsFilter(v){return r.isEmpty(v)?!1:r.minX(v)<=y&&r.maxX(v)>=p&&r.minY(v)<=w&&r.maxY(v)>=b}}}
597async draw(){if(this.pageView.detailView!==this)return;const e=this.pageView.renderingState===ct.FINISHED||this.renderingState===ct.FINISHED;this.renderingState!==ct.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:i,pdfPage:s,viewport:r}=this.pageView;if(!s)throw this.renderingState=ct.FINISHED,new Error("pdfPage is not loaded");this.renderingState=ct.RUNNING;const a=this.pageView._ensureCanvasWrapper(),{canvas:o,prevCanvas:l}=this._createCanvas(v=>{var A;((A=a.firstElementChild)==null?void 0:A.tagName)==="CANVAS"?a.firstElementChild.after(v):a.prepend(v)},e);o.ariaHidden=!0,this.enableOptimizedPartialRendering&&(o.className="detailView");const{width:h,height:c}=r,u=n(this,rs),{pixelRatio:p}=Im,b=[p,0,0,p,-u.minX*p,-u.minY*p];o.width=u.width*p,o.height=u.height*p;const{style:y}=o;y.width=`${u.width*100/h}%`,y.height=`${u.height*100/c}%`,y.top=`${u.minY*100/c}%`,y.left=`${u.minX*100/h}%`;const w=this._drawCanvas(this._getRenderingContext(o,b),()=>{var v;(v=this.canvas)==null||v.remove(),this.canvas=l},()=>{this.pageView._refreshAnnotationLayer(),this.dispatchPageRendered(!1,!0)});return i.setAttribute("data-loaded",!0),this.dispatchPageRender(),w}}rs=new WeakMap,Mb=new WeakSet,Hx=function(e){if(!n(this,rs))return!0;const i=n(this,rs).minX,s=n(this,rs).minY,r=n(this,rs).width+i,a=n(this,rs).height+s;if(e.minX<i||e.minY<s||e.maxX>r||e.maxY>a)return!0;const{width:o,height:l,scale:h}=this.pageView.viewport;if(n(this,rs).scale!==h)return!0;const c=e.minX-i,u=r-e.maxX,p=e.minY-s,b=a-e.maxY,y=.5,w=(1+y)/y;return i>0&&u/c>w||r<o&&c/u>w||s>0&&b/p>w||a<l&&p/b>w};const RE={Document:null,DocumentFragment:null,Part:"group",Art:"article",Sect:"group",Div:"group",BlockQuote:"blockquote",Aside:"note",NonStruct:"none",P:"paragraph",H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:"emphasis",Strong:"strong",Note:"note",Code:"code",Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"rowgroup",TBody:"rowgroup",TFoot:"rowgroup",Caption:"caption",Figure:"figure",Formula:null,Artifact:null},N1=new Set(["caption","code","emphasis","generic","none","paragraph","strong"]),zx=new Set(["math","merror","mfrac","mi","mmultiscripts","mn","mo","mover","mpadded","mprescripts","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msubsup","msup","mtable","mtd","mtext","mtr","munder","munderover","semantics"]),Zm="http://www.w3.org/1998/Math/MathML";class NE{static get sanitizer(){return Hu(this,"sanitizer",mA.isSanitizerSupported?new Sanitizer({elements:Array.from(zx.keys(),t=>({name:t,namespace:Zm})),replaceWithChildrenElements:[{name:"maction",namespace:Zm}],attributes:["dir","displaystyle","mathbackground","mathcolor","mathsize","scriptlevel","encoding","display","linethickness","intent","arg","form","fence","separator","lspace","rspace","stretchy","symmetric","maxsize","minsize","largeop","movablelimits","width","height","depth","voffset","accent","accentunder","columnspan","rowspan"],comments:!1}):null)}}const F1=/^H(\d+)$/;var Sd,Ps,xd,Kp,_d,Cd,Ib,qp,Qp,Pd,Td,Za,Ja,pn,$t,Rv,Nv,Fv,Gx,Ov,Xx,Bv,jv;class Wx{constructor(t,e){m(this,$t);m(this,Sd);m(this,Ps,null);m(this,xd);
597m(this,Kp,new Set);m(this,_d,new Map);m(this,Cd,new Map);m(this,Ib,0);m(this,qp,`pdfjs_internal_struct_${qP()}_`);m(this,Qp,new Map);m(this,Pd,new Map);m(this,Td);m(this,Za,null);m(this,Ja,null);m(this,pn,null);f(this,Sd,t.getStructTree()),f(this,Td,e)}async render(){var s;if(n(this,xd))return n(this,xd);const{promise:t,resolve:e,reject:i}=Promise.withResolvers();f(this,xd,t);try{const r=await n(this,Sd);g(this,$t,Rv).call(this,r),g(this,$t,Nv).call(this,r),f(this,Ps,g(this,$t,jv).call(this,r))}catch(r){i(r)}return f(this,Sd,null),(s=n(this,Ps))==null||s.classList.add("structTree"),e(n(this,Ps)),t}async getAriaAttributes(t,{enableLinkOwnership:e=!1}={}){try{await this.render();const i=n(this,Cd).get(t);if(i&&e){const{element:s,ids:r}=i;s.removeAttribute("role"),r.length>0&&n(this,_d).getOrInsertComputed(t,rE).set("aria-owns",r.join(" ")),n(this,Cd).delete(t)}return n(this,_d).get(t)}catch{}return null}async getAnnotationIds(){try{return await this.render(),n(this,Kp)}catch{}return null}hide(){n(this,Ps)&&!n(this,Ps).hidden&&(n(this,Ps).hidden=!0)}show(){var t;(t=n(this,Ps))!=null&&t.hidden&&(n(this,Ps).hidden=!1)}updateTextLayer(){var t;if(n(this,Za)){for(const[e,i]of n(this,Za))(t=document.getElementById(e))==null||t.append(i);n(this,Za).clear(),f(this,Za,null)}if(n(this,Ja)){for(const e of n(this,Ja)){const i=document.getElementById(e);i&&(i.ariaHidden=!0)}n(this,Ja).length=0,f(this,Ja,null)}if(n(this,pn)){for(let e=0,i=n(this,pn).length;e<i;e+=2){const s=n(this,pn)[e],r=n(this,pn)[e+1];let a="";for(const o of r){const l=document.getElementById(o);l&&(a+=l.textContent.trim()||"",l.ariaHidden="true")}a&&(s.textContent=a)}n(this,pn).length=0,f(this,pn,null)}}}Sd=new WeakMap,Ps=new WeakMap,xd=new WeakMap,Kp=new WeakMap,_d=new WeakMap,Cd=new WeakMap,Ib=new WeakMap,qp=new WeakMap,Qp=new WeakMap,Pd=new WeakMap,Td=new WeakMap,Za=new WeakMap,Ja=new WeakMap,pn=new WeakMap,$t=new WeakSet,Rv=function(t){if(t){t.structId&&n(this,Pd).getOrInsert(t.structId,t);for(const e of t.children||[])g(this,$t,Rv).call(this,e)}},Nv=function(t){if(t){if(t.type==="annotation"){n(this,Kp).add(t.id);return}for(const e of t.children||[])g(this,$t,Nv).call(this,e)}},Fv=function(t){return n(this,Qp).getOrInsertComputed(t,()=>`${n(this,qp)}${n(this,Qp).size}`)},Gx=function(t){const e=[],i=new Set,s=t.toReversed();for(;s.length>0;){const r=s.pop();if(i.has(r))continue;i.add(r);const a=n(this,Pd).get(r);if((a==null?void 0:a.role)==="TH"&&(e.push(g(this,$t,Fv).call(this,r)),a.headers))for(let o=a.headers.length-1;o>=0;o--)s.push(a.headers[o])}return e},Ov=function(t,e){const{alt:i,colSpan:s,headers:r,id:a,lang:o,rowSpan:l,short:h,structId:c,summary:u}=t;if(i!==void 0){let p=!1;const b=xo(i);for(const w of t.children)w.type==="annotation"&&(n(this,_d).getOrInsertComputed(w.id,rE).set("aria-label",b),p=!0);const y=e.getAttribute("role")||(e.localName==="span"?"generic":null);!p&&y!=="none"&&e.setAttribute(N1.has(y)?"aria-description":"aria-label",b)}if(a!==void 0&&e.setAttribute("aria-owns",a),c!==void 0&&n(this,Pd).get(c)===t){const p=g(this,$t,Fv).call(this,c);if(h!==void 0){const b=document.createElement("span");b.setAttribute("id",p),b.setAttribute("aria-hidden","true"),b.textContent=xo(h),e.append(b)}else e.setAttribute("id",p)}if(o!==void 0&&e.setAttribute("lang",xo(o,!0)),l!==void 0&&e.setAttribute("aria-rowspan",l),s!==void 0&&e.setAttribute("aria-colspan",s),(r==null?void 0:r.length)>0){const p=g(this,$t,Gx).call(this,r);p.length>0&&e.setAttribute("aria-describedby",p.join(" "))}u!==void 0&&e.setAttribute("aria-description",xo(u))},Xx=function(t,e){const{alt:i,bbox:s,children:r}=t,a=r==null?void 0:r[0];if(!n(this,Td)||!i||!s||(a==null?void 0:a.type)!=="content")return!1;const{id:o}=a;if(!o)return!1;e.setAttribute("aria-owns",o);const l=document.createElement("span");(n(this,Za)||f(this,Za,new Map)).set(o,l),l.setAttribute("role","img"),l.setAttribute("aria-label",xo(i));const{pageHeight:h,pageX:c,pageY:u}=n(this,Td),p="calc(var(--total-scale-factor) *",{style:b}=l;return b.width=`${p}${s[2]-s[0]}px)`,b.height=`${p}${s[3]-s[1]}px)`,b.left=`${p}${s[0]-c}px)`,b.top=`${p}${h-s[3]+u}px)`,!0},Bv=function(t,e){if(t){"id"in t&&e.push(t.id);for(const i of t.children||[])g(this,$t,Bv).call(this,i,e)}},jv=function(t,e=[]){var r,a,o,l;if(!t)return null;let i,s=!0;if("role"in t){const{role:h}=t;if(zx.has(h)){i=document.createElementNS(Zm,h);const u=[];(n(this,pn)||f(this,pn,[])).push(i,u);for(const{type:p,id:b}of t.children||[])p==="content"&&b&&u.push(b)}else i=document.createElement("span");const c=h.match(F1);if(c)i.setAttribute("role","heading"),i.setAttribute("aria-level",c[1]);else if(RE[h]){let u=RE[h];if(h==="TH")t.scope==="Row"?u="rowheader":t.scope==="Column"?u="columnheader":((r=e.at(-1))==null?void 0:r.role)==="TR"&&((a=e.at(-2))==null?void 0:a.role)==="TBody"&&(u="rowheader");else if(h==="Caption"){const p=(o=e.at(-1))==null?void 0:o.role;p!=="Table"&&p!=="Figure"&&(u=null)}u&&i.setAttribute("role",u)}
597if(h==="Figure"&&g(this,$t,Xx).call(this,t,i))return i;h==="Formula"&&(t.mathML&&NE.sanitizer&&(s=!1,i.setHTML(t.mathML,{sanitizer:NE.sanitizer}),g(this,$t,Bv).call(this,t,n(this,Ja)||f(this,Ja,[])),delete t.alt),!t.mathML&&t.children.length===1&&t.children[0].role!=="math"&&(i=document.createElementNS(Zm,"math"),delete t.alt))}if(i||(i=document.createElement("span")),g(this,$t,Ov).call(this,t,i),t.children){if(t.children.length===1&&!("role"in t.children[0])&&"id"in t.children[0]&&i.getAttribute("role")!=="none")g(this,$t,Ov).call(this,t.children[0],i);else if(s){e.push(t);for(const h of t.children)i.append(g(this,$t,jv).call(this,h,e));e.pop()}}if(t.role==="Link"){const h=(l=t.children)==null?void 0:l.filter(c=>c.type==="annotation");if((h==null?void 0:h.length)===1){const c=h[0],u=[];for(const p of i.children)p.getAttribute("aria-owns")!==c.id&&(p.id||(p.id=`${n(this,qp)}link_${kt(this,Ib)._++}`),u.push(p.id));n(this,Cd).set(c.id,{element:i,ids:u})}}return i};var pr,as,gr,to,kd,jm,Zp,$v;const Bh=class Bh{constructor(){m(this,Zp);m(this,pr,!1);m(this,as,null);m(this,gr,new Map);m(this,to,new Map)}setTextMapping(t){f(this,as,t)}enable(){if(n(this,pr))throw new Error("TextAccessibilityManager is already enabled.");if(!n(this,as))throw new Error("Text divs and strings have not been set.");if(f(this,pr,!0),f(this,as,n(this,as).slice()),n(this,as).sort(g(Bh,kd,jm)),n(this,gr).size>0){const t=n(this,as);for(const[e,i]of n(this,gr)){if(!document.getElementById(e)){n(this,gr).delete(e);continue}g(this,Zp,$v).call(this,e,t[i])}}for(const[t,e]of n(this,to))this.addPointerInTextLayer(t,e);n(this,to).clear()}disable(){n(this,pr)&&(n(this,to).clear(),f(this,as,null),f(this,pr,!1))}removePointerInTextLayer(t){if(!n(this,pr)){n(this,to).delete(t);return}const e=n(this,as);if(!(e!=null&&e.length))return;const{id:i}=t,s=n(this,gr).get(i);if(s===void 0)return;const r=e[s];n(this,gr).delete(i);let a=r.getAttribute("aria-owns");a!=null&&a.includes(i)&&(a=a.split(" ").filter(o=>o!==i).join(" "),a?r.setAttribute("aria-owns",a):(r.removeAttribute("aria-owns"),r.setAttribute("role","presentation")))}addPointerInTextLayer(t,e){const{id:i}=t;if(!i)return null;if(!n(this,pr))return n(this,to).set(t,e),null;e&&this.removePointerInTextLayer(t);const s=n(this,as);if(!(s!=null&&s.length))return null;const r=zu(s,h=>{var c;return g(c=Bh,kd,jm).call(c,t,h)<0}),a=Math.max(0,r-1),o=s[a];g(this,Zp,$v).call(this,i,o),n(this,gr).set(i,a);const l=o.parentNode;return l!=null&&l.classList.contains("markedContent")?l.id:null}moveElementInDOM(t,e,i,s){const r=this.addPointerInTextLayer(i,s);if(!t.hasChildNodes())return t.append(e),r;const a=Array.from(t.childNodes).filter(l=>l!==e);if(a.length===0)return r;const o=zu(a,l=>{var h;return g(h=Bh,kd,jm).call(h,e,l)<0});return o===0?a[0].before(e):a[o-1].after(e),r}};pr=new WeakMap,as=new WeakMap,gr=new WeakMap,to=new WeakMap,kd=new WeakSet,jm=function(t,e){const i=t.getBoundingClientRect(),s=e.getBoundingClientRect();if(i.width===0&&i.height===0)return 1;if(s.width===0&&s.height===0)return-1;const r=i.y,a=i.y+i.height,o=i.y+i.height/2,l=s.y,h=s.y+s.height,c=s.y+s.height/2;if(o<=l&&c>=a)return-1;if(c<=r&&o>=h)return 1;const u=i.x+i.width/2,p=s.x+s.width/2;return u-p},Zp=new WeakSet,$v=function(t,e){const i=e.getAttribute("aria-owns");i!=null&&i.includes(t)||e.setAttribute("aria-owns",i?`${i} ${t}`:t),e.removeAttribute("role")},m(Bh,kd);let Uv=Bh;var eo;class O1{constructor({findController:t,eventBus:e,pageIndex:i}){m(this,eo,null);this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=i,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(t,e){this.textDivs=t,this.textContentItemsStr=e}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,n(this,eo)||(f(this,eo,new AbortController),this.eventBus.on("updatetextlayermatches",t=>{(t.pageIndex===this.pageIdx||t.pageIndex===-1)&&this._updateMatches()},{signal:n(this,eo).signal,...ei})),this._updateMatches()}disable(){var t;this.enabled&&(this.enabled=!1,(t=n(this,eo))==null||t.abort(),f(this,eo,null),this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];const{textContentItemsStr:i}=this;let s=0,r=0;const a=i.length-1,o=[];for(let l=0,h=t.length;l<h;l++){let c=t[l];for(;s!==a&&c>=r+i[s].length;)r+=i[s].length,s++;s===i.length&&console.error("Could not find a matching mapping");const u={begin:{divIdx:s,offset:c-r}};for(c+=e[l];s!==a&&c>r+i[s].length;)r+=i[s].length,s++;u.end={divIdx:s,offset:c-r},o.push(u)}return o}_renderMatches(t){if(t.length===0)return;const{findController:e,pageIdx:i}=this,{textContentItemsStr:s,textDivs:r}=this,a=i===e.selected.pageIdx,o=e.selected.matchIdx,l=e.state.highlightAll;let h=null;const c={offset:void 0};function u(A,E){const S=A.divIdx;return r[S].textContent="",p(S,0,A.offset,E)}function p(A,E,S,x){let _=r[A];
597if(_.nodeType===Node.TEXT_NODE){const D=document.createElement("span");_.before(D),D.append(_),r[A]=D,_=D}const C=s[A].substring(E,S),k=document.createTextNode(C);if(x){const D=document.createElement("span");return D.className=`${x} appended`,D.append(k),_.append(D),x.includes("selected")?D:null}return _.append(k),0}let b=o,y=b+1;if(l)b=0,y=t.length;else if(!a)return;let w=-1,v=-1;for(let A=b;A<y;A++){const E=t[A],S=E.begin;if(S.divIdx===w&&S.offset===v)continue;w=S.divIdx,v=S.offset;const x=E.end,_=a&&A===o,C=_?" selected":"";let k=null;if(!h||S.divIdx!==h.divIdx?(h!==null&&p(h.divIdx,h.offset,c.offset),u(S)):p(h.divIdx,h.offset,S.offset),S.divIdx===x.divIdx)k=p(S.divIdx,S.offset,x.offset,"highlight"+C);else{k=p(S.divIdx,S.offset,c.offset,"highlight begin"+C);for(let D=S.divIdx+1,P=x.divIdx;D<P;D++)r[D].className="highlight middle"+C;u(x,"highlight end"+C)}h=x,_&&e.scrollMatchIntoView({element:k,pageIndex:i,matchIndex:o})}h&&p(h.divIdx,h.offset,c.offset)}_updateMatches(t=!1){if(!this.enabled&&!t)return;const{findController:e,matches:i,pageIdx:s}=this,{textContentItemsStr:r,textDivs:a}=this;let o=-1;for(const c of i){const u=Math.max(o,c.begin.divIdx);for(let p=u,b=c.end.divIdx;p<=b;p++){const y=a[p];y.textContent=r[p],y.className=""}o=c.end.divIdx+1}if(!(e!=null&&e.highlightMatches)||t)return;const l=e.pageMatches[s]||null,h=e.pageMatchesLength[s]||null;this.matches=this._convertMatches(l,h),this._renderMatches(this.matches)}}eo=new WeakMap;var Jp,tg,eg,io,gn,pi,mr,Db,Yx,Qd,Kx,qx;const Fr=class Fr{constructor({pdfPage:t,highlighter:e=null,accessibilityManager:i=null,enablePermissions:s=!1,onAppend:r=null,abortSignal:a=null}){m(this,Db);m(this,Jp,null);m(this,tg,!1);m(this,eg,null);m(this,io,!1);m(this,gn,null);this.pdfPage=t,this.highlighter=e,this.accessibilityManager=i,f(this,tg,s===!0),f(this,eg,r),f(this,Jp,a),this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}async render({viewport:t,images:e,textContentParams:i=null}){var o,l,h,c,u;if(n(this,io)&&n(this,gn)){n(this,gn).update({viewport:t,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),f(this,gn,new nT({textContentSource:this.pdfPage.streamTextContent(i||{includeMarkedContent:!0,disableNormalization:!0}),images:e,container:this.div,viewport:t}));const{textDivs:s,textContentItemsStr:r}=n(this,gn);(o=this.highlighter)==null||o.setTextMapping(s,r),(l=this.accessibilityManager)==null||l.setTextMapping(s),await n(this,gn).render(),f(this,io,!0);const a=document.createElement("div");a.className="endOfContent",this.div.append(a),g(this,Db,Yx).call(this,a),(h=n(this,eg))==null||h.call(this,this.div),(c=this.highlighter)==null||c.enable(),(u=this.accessibilityManager)==null||u.enable()}hide(){var t;!this.div.hidden&&n(this,io)&&((t=this.highlighter)==null||t.disable(),this.div.hidden=!0)}show(){var t;this.div.hidden&&n(this,io)&&(this.div.hidden=!1,(t=this.highlighter)==null||t.enable())}cancel(){var t,e,i,s;(t=n(this,gn))==null||t.cancel(),f(this,gn,null),f(this,io,!1),this.div.replaceChildren(),(e=this.highlighter)==null||e.disable(),(i=this.accessibilityManager)==null||i.disable(),g(s=Fr,Qd,Kx).call(s,this.div)}};Jp=new WeakMap,tg=new WeakMap,eg=new WeakMap,io=new WeakMap,gn=new WeakMap,pi=new WeakMap,mr=new WeakMap,Db=new WeakSet,Yx=function(t){var r;const{div:e}=this,i=n(this,Jp),s=i?{signal:i}:null;e.addEventListener("mousedown",()=>{e.classList.add("selecting")},s),e.addEventListener("copy",a=>{if(!n(this,tg)){const o=document.getSelection();a.clipboardData.setData("text/plain",xo(iT(o.toString())))}pv(a)},s),n(Fr,pi).set(e,t),g(r=Fr,Qd,qx).call(r,i)},Qd=new WeakSet,Kx=function(t){var e;n(this,pi).delete(t),n(this,pi).size===0&&((e=n(this,mr))==null||e.abort(),f(this,mr,null))},qx=function(t){if(n(this,mr))return;f(this,mr,new AbortController);const e=t?AbortSignal.any([n(this,mr).signal,t]):n(this,mr).signal,i=(o,l)=>{l.append(o),o.style.width="",o.style.height="",l.classList.remove("selecting")};let s=!1;document.addEventListener("pointerdown",()=>{s=!0},{signal:e}),document.addEventListener("pointerup",()=>
597{s=!1,n(this,pi).forEach(i)},{signal:e}),window.addEventListener("blur",()=>{s=!1,n(this,pi).forEach(i)},{signal:e}),document.addEventListener("keyup",()=>{s||n(this,pi).forEach(i)},{signal:e});var r,a;document.addEventListener("selectionchange",()=>{var y,w,v,A;const o=document.getSelection();if(o.rangeCount===0){n(this,pi).forEach(i);return}const l=new Set;for(let E=0;E<o.rangeCount;E++){const S=o.getRangeAt(E);for(const x of n(this,pi).keys())!l.has(x)&&S.intersectsNode(x)&&l.add(x)}for(const[E,S]of n(this,pi))l.has(E)?E.classList.add("selecting"):i(S,E);if(r===void 0&&(r=getComputedStyle(n(this,pi).values().next().value).getPropertyValue("-moz-user-select")==="none",!r)){const E=navigator.userAgentData?(y=navigator.userAgentData.brands.find(({brand:S})=>S==="Chromium"))==null?void 0:y.version:(w=/\bChrome\/(\d+)\b/.exec(navigator.userAgent))==null?void 0:w[1];r=!!E&&parseInt(E,10)>=148}if(r)return;const h=o.getRangeAt(0),c=a&&(h.compareBoundaryPoints(Range.END_TO_END,a)===0||h.compareBoundaryPoints(Range.START_TO_END,a)===0);let u=c?h.startContainer:h.endContainer;if(u.nodeType===Node.TEXT_NODE&&(u=u.parentNode),(v=u.classList)!=null&&v.contains("highlight")&&(u=u.parentNode),!c&&h.endOffset===0)do{for(;!u.previousSibling;)u=u.parentNode;u=u.previousSibling}while(!u.childNodes.length);const p=(A=u.parentElement)==null?void 0:A.closest(".textLayer"),b=n(this,pi).get(p);b&&(b.style.width=p.style.width,b.style.height=p.style.height,b.style.userSelect="text",u.parentElement.insertBefore(b,c?u:u.nextSibling)),a=h.cloneRange()},{signal:e})},m(Fr,Qd),m(Fr,pi,new Map),m(Fr,mr,null);let Jm=Fr;var ig;class Qx{constructor({pdfPage:t,annotationStorage:e=null,linkService:i,xfaHtml:s=null}){m(this,ig,!1);T(this,"div",null);this.pdfPage=t,this.annotationStorage=e,this.linkService=i,this.xfaHtml=s}async render({viewport:t,intent:e="display"}){let i;if(e==="print")i=this.xfaHtml;else if(i=await this.pdfPage.getXfa(),n(this,ig)||!i)return{textDivs:[]};const s=!!this.div,r={viewport:t.clone({dontFlip:!0}),div:this.div??(this.div=document.createElement("div")),xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return s?oE.update(r):oE.render(r)}cancel(){f(this,ig,!0)}hide(){this.div&&(this.div.hidden=!0)}}ig=new WeakMap;const B1={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new Wu}},j1=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var Md,br,so,Id,Dd,Ld,sg,Ts,yr,Rd,ng,rg,ag,rh,og,wr,no,it,Rh,Um,Nh,Vv,Hv,zv,Wv,Gv,Zx,Jx,t_,Xv;const SA=class SA extends Vx{constructor(e){var a,o;super(e);m(this,it);m(this,Md,null);m(this,br,wn.ENABLE_FORMS);m(this,so,null);m(this,Id,null);m(this,Dd,!0);m(this,Ld,!1);m(this,sg,!1);m(this,Ts,null);m(this,yr,!1);m(this,Rd,null);m(this,ng,null);m(this,rg,1);m(this,ag,1);m(this,rh,bn.ENABLE);m(this,og,1);m(this,wr,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0});m(this,no,[null,null,null,null]);const{container:i,defaultViewport:s}=e;this.renderingId="page"+this.id,f(this,Ts,e.layerProperties||B1),f(this,Md,e.abortSignal||null),this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||1,this.viewport=s,this.pdfPageRotate=s.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,f(this,rh,e.textLayerMode??bn.ENABLE),f(this,br,e.annotationMode??wn.ENABLE_FORMS),this.imageResourcesPath=e.imageResourcesPath||"",this.enableDetailCanvas=e.enableDetailCanvas??!0,this.maxCanvasPixels=e.maxCanvasPixels??Nu.get("maxCanvasPixels"),this.maxCanvasDim=e.maxCanvasDim||Nu.get("maxCanvasDim"),this.capCanvasAreaFactor=e.capCanvasAreaFactor??Nu.get("capCanvasAreaFactor"),f(this,Dd,e.enableAutoLinking!==!1),f(this,Id,e.commentManager||null),this.l10n=e.l10n,this.l10n||(this.l10n=new Xd),this._isStandalone=!((a=this.renderingQueue)!=null&&a.hasViewer()),this._container=i,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailVie
597w=null;const r=document.createElement("div");if(r.className="page",r.setAttribute("data-page-number",this.id),r.setAttribute("role","region"),r.setAttribute("data-l10n-id","pdfjs-page-landmark"),r.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=r,g(this,it,Um).call(this),i==null||i.append(r),this._isStandalone){i==null||i.style.setProperty("--scale-factor",this.scale*Tn.PDF_TO_CSS_UNITS),(o=this.pageColors)!=null&&o.background&&(i==null||i.style.setProperty("--page-bg-color",this.pageColors.background));const{optionalContentConfigPromise:l}=e;l&&l.then(h=>{l===this._optionalContentConfigPromise&&(n(this,wr).initialOptionalContent=h.hasInitialVisibility)}),e.l10n||this.l10n.translate(this.div)}}clone(e){const i=new SA({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:e,layerProperties:n(this,Ts),abortSignal:n(this,Md),scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:n(this,rh),annotationMode:n(this,br),imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:n(this,Dd),commentManager:n(this,Id),l10n:this.l10n});return i.setPdfPage(this.pdfPage.clone(e-1)),i}updatePageNumber(e){var s;const i=this.id;if(i!==e){this.id=e,this.renderingId=`page${e}`,this.pdfPage&&(this.pdfPage.pageNumber=e),this.setPageLabel(this.pageLabel);const{div:r}=this;r.setAttribute("data-page-number",e),r.setAttribute("data-l10n-args",JSON.stringify({page:e})),this._textHighlighter.pageIdx=e-1}(s=n(this,Ts).annotationEditorUIManager)==null||s.updatePageIndex(i-1,e-1)}setPdfPage(e){var s,r,a,o;this._isStandalone&&(((s=this.pageColors)==null?void 0:s.foreground)==="CanvasText"||((r=this.pageColors)==null?void 0:r.background)==="Canvas")&&((a=this._container)==null||a.style.setProperty("--hcm-highlight-filter",e.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),(o=this._container)==null||o.style.setProperty("--hcm-highlight-selected-filter",e.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=e,this.pdfPageRotate=e.rotate;const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*Tn.PDF_TO_CSS_UNITS,rotation:i}
597),g(this,it,Um).call(this),this.reset()}destroy(){var e;this.reset(),(e=this.pdfPage)==null||e.cleanup()}deleteMe(e){var i;if(e){this.div.remove();return}this.destroy(),(i=n(this,Ts).annotationEditorUIManager)==null||i.deletePage(this.id)}hasEditableAnnotations(){var e;return!!((e=this.annotationLayer)!=null&&e.hasEditableAnnotations())}get _textHighlighter(){return Hu(this,"_textHighlighter",new O1({pageIndex:this.id-1,eventBus:this.eventBus,findController:n(this,Ts).findController}))}_refreshAnnotationLayer(){var e,i;(e=this._annotationCanvasMap)!=null&&e.size&&((i=this.annotationLayer)==null||i.refreshCanvases())}_resetCanvas(){super._resetCanvas(),f(this,Rd,null)}reset({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:s=!1,keepTextLayer:r=!1,keepCanvasWrapper:a=!1,preserveDetailViewState:o=!1}={}){var v,A,E,S,x,_,C;const l=((v=this.pdfPage)==null?void 0:v._pdfBug)??!1;this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:i,keepXfaLayer:s,keepTextLayer:r}),this.renderingState=ct.INITIAL;const h=this.div,c=h.childNodes,u=e&&((A=this.annotationLayer)==null?void 0:A.div)||null,p=i&&((E=this.annotationEditorLayer)==null?void 0:E.div)||null,b=s&&((S=this.xfaLayer)==null?void 0:S.div)||null,y=r&&((x=this.textLayer)==null?void 0:x.div)||null,w=a&&n(this,so)||null;for(let k=c.length-1;k>=0;k--){const D=c[k];switch(D){case u:case p:case b:case y:case w:continue}if(l&&D.classList.contains("pdfBugGroupsLayer"))continue;D.remove();const P=n(this,no).indexOf(D);P>=0&&(n(this,no)[P]=null)}h.removeAttribute("data-loaded"),u&&this.annotationLayer.hide(),p&&this.annotationEditorLayer.hide(),b&&this.xfaLayer.hide(),y&&this.textLayer.hide(),(_=this.structTreeLayer)==null||_.hide(),!a&&n(this,so)&&(f(this,so,null),this._resetCanvas()),o||((C=this.detailView)==null||C.reset({keepCanvas:a}),a||(this.detailView=null))}toggleEditingMode(e){f(this,sg,e),this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(e){this.enableDetailCanvas&&(n(this,yr)&&this.maxCanvasPixels>0&&e?(this.detailView??(this.detailView=new R1({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1})),this.detailView.update({visibleArea:e})):this.detailView&&(this.detailView.reset(),this.detailView=null))}update({scale:e=0,rotation:i=null,optionalContentConfigPromise:s=null,drawingDelay:r=-1}){var o,l,h,c;this.scale=e||this.scale,typeof i=="number"&&(this.rotation=i),s instanceof Promise&&(this._optionalContentConfigPromise=s,s.then(u=>{s===this._optionalContentConfigPromise&&(n(this,wr).initialOptionalContent=u.hasInitialVisibility)})),n(this,wr).directDrawing=!0;const a=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*Tn.PDF_TO_CSS_UNITS,rotation:a}
597),g(this,it,Um).call(this),this._isStandalone&&((o=this._container)==null||o.style.setProperty("--scale-factor",this.viewport.scale)),g(this,it,Xv).call(this),this.canvas){const u=n(this,Ld)&&n(this,yr),p=r>=0&&r<1e3;if(p||u){p&&!u&&this.renderingState!==ct.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=ct.FINISHED,n(this,wr).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!p,hideTextLayer:p}),p||((l=this.detailView)==null||l.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),(h=this.annotationEditorLayer)==null||h.update(this.viewport),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),(c=this.detailView)==null||c.update({underlyingViewUpdated:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:s=!1,keepTextLayer:r=!1,cancelExtraDelay:a=0}={}){var o;super.cancelRendering({cancelExtraDelay:a}),this.textLayer&&(!r||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!e||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!i||!this.annotationEditorLayer.div||!this.textLayer)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.drawLayer&&!this.textLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.xfaLayer&&(!s||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(o=this._textHighlighter)==null||o.disable())}cssTransform({redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:s=!1,redrawTextLayer:r=!1,hideTextLayer:a=!1}){var h;const{canvas:o}=this;if(!o)return;const l=n(this,Rd);if(this.viewport!==l){const c=(360+this.viewport.rotation-l.rotation)%360;if(c===90||c===270){const{width:u,height:p}=this.viewport,b=p/u,y=u/p;o.style.transform=`rotate(${c}deg) scale(${b},${y})`}else o.style.transform=c===0?"":`rotate(${c}deg)`}e&&this.annotationLayer&&g(this,it,Vv).call(this),i&&this.annotationEditorLayer&&(this.drawLayer&&g(this,it,zv).call(this),g(this,it,Hv).call(this)),s&&this.xfaLayer&&g(this,it,Wv).call(this),this.textLayer&&(a?(this.textLayer.hide(),(h=this.structTreeLayer)==null||h.hide()):r&&g(this,it,Gv).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,i){return this.viewport.convertToPdfPoint(e,i)}_ensureCanvasWrapper(){let e=n(this,so);return e||(e=f(this,so,document.createElement("div")),e.classList.add("canvasWrapper"),g(this,it,Rh).call(this,e,"canvasWrapper")),e}_getRenderingContext(e,i,s,r){return{canvas:e,transform:i,viewport:this.viewport,annotationMode:n(this,br),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:n(this,sg),recordOperations:s,recordImages:r}}async draw(){this.renderingState!==ct.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,l10n:i,pdfPage:s,viewport:r}=this;if(!s)throw this.renderingState=ct.FINISHED,new Error("pdfPage is not loaded");this.renderingState=ct.RUNNING;const a=this._ensureCanvasWrapper();if(!this.textLayer&&n(this,rh)!==bn.DISABLE&&!s.isPureXfa&&(this._accessibilityManager||(this._accessibilityManager=new Uv),this.textLayer=new Jm({pdfPage:s,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:n(this,rh)===bn.ENABLE_PERMISSIONS,onAppend:C=>{this.l10n.pause(),g(this,it,Rh).call(this,C,"textLayer"),this.l10n.resume()},abortSignal:n(this,Md)}),this.enableSelectionRendering&&this.textLayer.div.classList.add("selectionRendering")),!this.annotationLayer&&n(this,br)!==wn.DISABLE){const{annotationStorage:C,annotationEditorUIManager:k,downloadManager:D,enableComment:P,enableScripting:I,fieldObjectsPromise:L,hasJSActionsProm
597ise:O,linkService:H}=n(this,Ts);this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer=new Cx({pdfPage:s,annotationStorage:C,imageResourcesPath:this.imageResourcesPath,renderForms:n(this,br)===wn.ENABLE_FORMS,linkService:H,downloadManager:D,enableComment:P,enableScripting:I,hasJSActionsPromise:O,fieldObjectsPromise:L,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:k,commentManager:n(this,Id),onAppend:W=>{g(this,it,Rh).call(this,W,"annotationLayer")}})}const{width:o,height:l}=r;f(this,Rd,r);const{canvas:h,prevCanvas:c}=this._createCanvas(C=>{a.prepend(C)});h.setAttribute("role","presentation"),this.outputScale||g(this,it,Xv).call(this);const{outputScale:u}=this;f(this,Ld,n(this,yr));const p=uE(u.sx),b=uE(u.sy),y=h.width=jg(Ug(o*u.sx),p[0]),w=h.height=jg(Ug(l*u.sy),b[0]),v=jg(Ug(o),p[1]),A=jg(Ug(l),b[1]);u.sx=y/v,u.sy=w/A,n(this,rg)!==p[1]&&(e.style.setProperty("--scale-round-x",`${p[1]}px`),f(this,rg,p[1])),n(this,ag)!==b[1]&&(e.style.setProperty("--scale-round-y",`${b[1]}px`),f(this,ag,b[1]));const E=this.enableOptimizedPartialRendering&&n(this,Ld)&&!this.recordedBBoxes,S=this.imagesRightClickMinSize!==-1&&!this.imageCoordinates,x=u.scaled?[u.sx,0,0,u.sy,0,0]:null,_=this._drawCanvas(this._getRenderingContext(h,x,E,S),()=>{c==null||c.remove(),this._resetCanvas()},C=>{n(this,wr).regularAnnotations=!C.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{var D,P,I;if(this.renderingState!==ct.FINISHED)return;this.structTreeLayer||(this.structTreeLayer=new Wx(s,r.rawDims));const C=this.textLayer?g(this,it,Gv).call(this):null;this.annotationLayer&&await g(this,it,Vv).call(this,C),this.drawLayer||(this.drawLayer=new L1({pageIndex:this.id,textLayer:this.enableSelectionRendering?(D=this.textLayer)==null?void 0:D.div:null,filterFactory:(P=this.pdfPage)==null?void 0:P.filterFactory,pageColors:this.pageColors})),await g(this,it,zv).call(this),this.drawLayer.setParent(a);const{annotationEditorUIManager:k}=n(this,Ts);k&&(this.annotationLayer||n(this,br)===wn.DISABLE)&&(this.annotationEditorLayer||(this.annotationEditorLayer=new k1({uiManager:k,pageIndex:this.id-1,l10n:i,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:(I=this.annotationLayer)==null?void 0:I.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:L=>{g(this,it,Rh).call(this,L,"annotationEditorLayer")}})),g(this,it,Hv).call(this))});if(s.isPureXfa){if(!this.xfaLayer){const{annotationStorage:C,linkService:k}=n(this,Ts);this.xfaLayer=new Qx({pdfPage:s,annotationStorage:C,linkService:k})}g(this,it,Wv).call(this)}return e.setAttribute("data-loaded",!0),this.dispatchPageRender(),_}setPageLabel(e){this.pageLabel=typeof e=="string"?e:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:i,regularAnnotations:s}=n(this,wr);return e&&i&&s?this.canvas:null}};Md=new WeakMap,br=new WeakMap,so=new WeakMap,Id=new WeakMap,Dd=new WeakMap,Ld=new WeakMap,sg=new WeakMap,Ts=new WeakMap,yr=new WeakMap,Rd=new WeakMap,ng=new WeakMap,rg=new WeakMap,ag=new WeakMap,rh=new WeakMap,og=new WeakMap,wr=new WeakMap,no=new WeakMap,it=new WeakSet,Rh=function(e,i){const s=j1.get(i),r=n(this,no)[s];if(n(this,no)[s]=e,r){r.replaceWith(e);return}for(let a=s-1;a>=0;a--){const o=n(this,no)[a];if(o){o.after(e);return}}this.div.prepend(e)},Um=function(){const{div:e,viewport:i}=this;if(i.userUnit!==n(this,og)&&(i.userUnit!==1?e.style.setProperty("--user-unit",i.userUnit):e.style.removeProperty("--user-unit"),f(this,og,i.userUnit)),this.pdfPage){if(n(this,ng)===i.rotation)return;f(this,ng,i.rotation)}px(e,i,!0,!1)},Nh=function(e,i){this.eventBus.dispatch(e,{source:this,pageNumber:this.id,error:i})},Vv=async function(e=null){const{annotationLayer:i,textLayer:s}=this;let r=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer,optionalContentConfigPromise:this._optionalContentConfigPromise})}catch(a){console.error("#renderAnnotationLayer:",a),r=a}finally{g(this,it,Nh).call(this,"annotationlayerrendered",r)}n(this,Dd)&&e&&g(this,it,t_).call(this,e,i,s)},Hv=async function(){let e=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(i){console.error("#renderAnnotationEditorLayer:",i),e=i}finally{g(this,it,Nh).call(this,"annotationeditorlayerrendered",e)}},zv=async function(){try{await this.drawLayer.render({intent:"display"})}catch(e){console.error("#renderDrawLayer:",e)}},Wv=async function(){var i;let e=null;try{const s=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});s!=null&&s.textDivs&&this._textHighlighter&&g(this,it,Jx).call(this,s.textDivs)}catch(s){console.error("#renderXfaLayer:",s),e=s}finally{(i=this.xfaLayer)!=null&&i.div&&(this.l10n.pause(),g(this,it,Rh).call(this,this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),g(this,it,Nh).call(this,"xfalayerrendered",e)}},Gv=async function(){let e=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new rT(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(i){if(i instanceof zP)return;console.error("#renderTextLayer:",i),e=i}g(this,it,Nh).call(this,"textlayerrendered",e),g(this,it,Zx).call(this)},Zx=async function(){var i,s,r;const e=await((i=this.structTreeLayer)==null?void 0:i.render());e&&(this.l10n.pause(),(s=this.structTreeLayer)==null||s.updateTextLayer(),this.canvas&&e.parentNode!==this.canvas&&this.canvas.append(e),this.l10n.resume()),(r=this.structTreeLayer)==null||r.show()},Jx=async function(e){const i=await this.pdfPage.getTextContent(),s=[];for(const r of i.items)s.push(r.str);this._textHighlighter.setTextMapping(e,s),this._textHighlighter.enable()},t_=async function(e,i,s){let r=null;try{if(await e,i!==this.annotationLayer||s!==this.textLayer)return;await i.injectLinkAnnotations(Bm.processLinks(this))}catch(a){console.error("#injectLinkAnnotations:",a),r=a}g(this,it,Nh).call(this,"linkannotationsadded",r)},Xv=function(){const{width:e,height:i}=this.viewport,s=this.outputScale=new Im;if(this.maxCanvasPixels===0){const r=1/this.scale;s.sx*=r,s.sy*=r,f(this,yr,!0)}else if(f(this,yr,s.limitCanvas(e,i,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor)),n(this,yr)&&this.enableDetailCanvas){const r=this.enableOptimizedPartialRendering?4:2;s.sx/=r,s.sy/=r}};let tb=SA;async function U1(d){const t="",e="",{info:i,metadata:s,contentDispositionFilename:r,contentLength:a}=await d.getMetadata();return{...i,baseURL:e,filesize:a||(await d.getDownloadInfo()).length,filename:r||KP(t),metadata:s==null?void 0:s.getRaw(),authors:s==null?void 0:s.get("dc:creator"),numPages:d.numPages,URL:t}}class $1{constructor(t,e){this._ready=new Promise((i,s)=>{import(t).then(a=>{i(a.QuickJSSandbox(new URL(e,location.href).href))}).catch(s)})}async createSandbox(t){(await this._ready).create(t)}async dispatchEventInSandbox(t){const e=await this._ready;setTimeout(()=>
597e.dispatchEvent(t),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}var mn,ah,lg,oh,lh,hg,hh,Ze,vr,Nd,ue,os,Se,e_,$m,Yv,i_,Iu;class V1{constructor({eventBus:t,externalServices:e=null,docProperties:i=null}){m(this,Se);m(this,mn,null);m(this,ah,null);m(this,lg,null);m(this,oh,null);m(this,lh,null);m(this,hg,null);m(this,hh,null);m(this,Ze,null);m(this,vr,null);m(this,Nd,!1);m(this,ue,null);m(this,os,null);f(this,lh,t),f(this,hg,e),f(this,lg,i)}setViewer(t){f(this,vr,t)}async setDocument(t){var o;if(n(this,Ze)&&await g(this,Se,Iu).call(this),f(this,Ze,t),!t)return;const[e,i,s]=await Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!e&&!s){await g(this,Se,Iu).call(this);return}if(t!==n(this,Ze))return;if(e){f(this,hh,new Set);for(const l of e.values())for(const{id:h}of l)n(this,hh).add(h)}try{f(this,ue,g(this,Se,i_).call(this))}catch(l){console.error("setDocument:",l),await g(this,Se,Iu).call(this);return}const r=n(this,lh);f(this,oh,new AbortController);const a={signal:n(this,oh).signal,...ei};r.on("updatefromsandbox",l=>{(l==null?void 0:l.source)===window&&g(this,Se,e_).call(this,l.detail)},a),r.on("dispatcheventinsandbox",l=>{var h;(h=n(this,ue))==null||h.dispatchEventInSandbox(l.detail)},a),r.on("pagechanging",({pageNumber:l,previous:h})=>{l!==h&&(g(this,Se,Yv).call(this,h),g(this,Se,$m).call(this,l))},a),r.on("pagerendered",({pageNumber:l})=>{this._pageOpenPending.has(l)&&l===n(this,vr).currentPageNumber&&g(this,Se,$m).call(this,l)},a),r.on("pagesdestroy",async()=>{var l,h;await g(this,Se,Yv).call(this,n(this,vr).currentPageNumber),await((l=n(this,ue))==null?void 0:l.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(h=n(this,mn))==null||h.resolve()},a);try{const l=await n(this,lg).call(this,t);if(t!==n(this,Ze))return;await n(this,ue).createSandbox({objects:e,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...l,actions:s}}),r.dispatch("sandboxcreated",{source:this})}catch(l){console.error("setDocument:",l),await g(this,Se,Iu).call(this);return}await((o=n(this,ue))==null?void 0:o.dispatchEventInSandbox({id:"doc",name:"Open"})),await g(this,Se,$m).call(this,n(this,vr).currentPageNumber,!0),Promise.resolve().then(()=>{t===n(this,Ze)&&f(this,Nd,!0)})}async dispatchWillSave(){var t;return(t=n(this,ue))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){var t;return(t=n(this,ue))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){var t;if(n(this,ue)){await((t=n(this,os))==null?void 0:t.promise),f(this,os,Promise.withResolvers());try{await n(this,ue).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){throw n(this,os).resolve(),f(this,os,null),e}await n(this,os).promise}}async dispatchDidPrint(){var t;return(t=n(this,ue))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var t;return((t=n(this,ah))==null?void 0:t.promise)||null}get ready(){return n(this,Nd)}get _pageOpenPending(){return Hu(this,"_pageOpenPending",new Set)}get _visitedPages(){return Hu(this,"_visitedPages",new Map)}}mn=new WeakMap,ah=new WeakMap,lg=new WeakMap,oh=new WeakMap,lh=new WeakMap,hg=new WeakMap,hh=new WeakMap,Ze=new WeakMap,vr=new WeakMap,Nd=new WeakMap,ue=new WeakMap,os=new WeakMap,Se=new WeakSet,e_=async function(t){var h,c,u;const e=n(this,vr),i=e.isInPresentationMode||e.isChangingPresentationMode,{id:s,siblings:r,command:a,value:o}=t;if(!s){switch(a){case"clear":console.clear();break;case"error":console.error(o);break;case"layout":if(!i){const p=yT(o);e.spreadMode=p.spreadMode}break;case"page-num":e.currentPageNumber=o+1;break;case"print":await e.pagesPromise,n(this,lh).dispatch("print",{source:this});break;case"println":console.log(o);break;case"zoom":i||(e.currentScaleValue=o);break;case"SaveAs":n(this,lh).dispatch("download",{source:this});break;case"FirstPage":e.currentPageNumber=1;break;case"LastPage":e.currentPageNumber=e.pagesCount;break;case"NextPage":e.nextPage();break;case"PrevPage":e.previousPage();break;case"ZoomViewIn":i||e.increaseScale();break;case"ZoomViewOut":i||e.decreaseScale();break;case"WillPrintFinished":(h=n(this,os))==null||h.resolve(),f(this,os,null);break}return}
597if(i&&t.focus)return;delete t.id,delete t.siblings;const l=r?[s,...r]:[s];for(const p of l){if(!((c=n(this,hh))!=null&&c.has(p)))continue;const b=document.querySelector(`[data-element-id="${p}"]`);b?b.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):(u=n(this,Ze))==null||u.annotationStorage.setValue(p,t)}},$m=async function(t,e=!1){const i=n(this,Ze),s=this._visitedPages;if(e&&f(this,mn,Promise.withResolvers()),!n(this,mn))return;const r=n(this,vr).getPageView(t-1);if((r==null?void 0:r.renderingState)!==ct.FINISHED){this._pageOpenPending.add(t);return}this._pageOpenPending.delete(t);const a=(async()=>{var l,h;const o=await(s.has(t)?null:(l=r.pdfPage)==null?void 0:l.getJSActions());i===n(this,Ze)&&await((h=n(this,ue))==null?void 0:h.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:o}))})();s.set(t,a)},Yv=async function(t){var r;const e=n(this,Ze),i=this._visitedPages;if(!n(this,mn)||this._pageOpenPending.has(t))return;const s=i.get(t);s&&(i.set(t,null),await s,e===n(this,Ze)&&await((r=n(this,ue))==null?void 0:r.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t})))},i_=function(){if(f(this,ah,Promise.withResolvers()),n(this,ue))throw new Error("#initScripting: Scripting already exists.");return n(this,hg).createScripting()},Iu=async function(){var t,e,i,s;if(f(this,hh,null),!n(this,ue)){f(this,Ze,null),(t=n(this,ah))==null||t.resolve();return}n(this,mn)&&(await Promise.race([n(this,mn).promise,new Promise(r=>{setTimeout(r,1e3)})]).catch(()=>{}),f(this,mn,null)),f(this,Ze,null);try{await n(this,ue).destroySandbox()}catch{}(e=n(this,os))==null||e.reject(new Error("Scripting destroyed.")),f(this,os,null),(i=n(this,oh))==null||i.abort(),f(this,oh,null),this._pageOpenPending.clear(),this._visitedPages.clear(),f(this,ue,null),f(this,Nd,!1),(s=n(this,ah))==null||s.resolve()};class H1 extends V1{constructor(t){t.externalServices||window.addEventListener("updatefromsandbox",e=>{t.eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}),t.externalServices||(t.externalServices={createScripting:()=>new $1(t.sandboxBundleSrc,t.wasmUrl)}),t.docProperties||(t.docProperties=e=>U1(e)),super(t)}}const z1=3e4;var ch,dh,cg,Fd;class W1{constructor(){m(this,ch,null);m(this,dh,null);m(this,cg,null);m(this,Fd,null);T(this,"isThumbnailViewEnabled",!1);T(this,"onIdle",null);T(this,"printing",!1);Object.defineProperty(this,"hasViewer",{value:()=>!!n(this,Fd)})}setViewer(t){f(this,Fd,t)}setThumbnailViewer(t){f(this,cg,t)}isHighestPriority(t){return n(this,ch)===t.renderingId}renderHighestPriority(t){var e;n(this,dh)&&(clearTimeout(n(this,dh)),f(this,dh,null)),!n(this,Fd).forceRendering(t)&&(this.isThumbnailViewEnabled&&((e=n(this,cg))!=null&&e.forceRendering())||this.printing||this.onIdle&&f(this,dh,setTimeout(this.onIdle.bind(this),z1)))}getHighestPriority(t,e,i,s=!1,r=!1){const a=t.views,o=a.length;if(o===0)return null;for(let p=0;p<o;p++){const b=a[p].view;if(!this.isViewFinished(b))return b}if(!r)for(let p=0;p<o;p++){const{detailView:b}=a[p].view;if(b&&!this.isViewFinished(b))return b}const l=t.first.id,h=t.last.id;if(h-l+1>o){const p=t.ids;for(let b=1,y=h-l;b<y;b++){const w=i?l+b:h-b;if(p.has(w))continue;const v=e[w-1];if(!this.isViewFinished(v))return v}}let c=i?h:l-2,u=e[c];return u&&!this.isViewFinished(u)||s&&(c+=i?1:-1,u=e[c],u&&!this.isViewFinished(u))?u:null}isViewFinished(t){return t.renderingState===ct.FINISHED}renderView(t){switch(t.renderingState){case ct.FINISHED:return!1;case ct.PAUSED:f(this,ch,t.renderingId),t.resume();break;case ct.RUNNING:f(this,ch,t.renderingId);break;case ct.INITIAL:f(this,ch,t.renderingId),t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof fv||console.error("renderView:",e)});break}return!0}}ch=new WeakMap,dh=new WeakMap,cg=new WeakMap,Fd=new WeakMap;const FE=10,Vg={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function OE(d){return Object.values(ai).includes(d)&&d!==ai.DISABLE}var Ar,uh,dg,Kv;class G1{constructor(t){m(this,dg);m(this,Ar,new Set);m(this,uh,0);f(this,uh,t)}push(t){const e=n(this,Ar);e.has(t)&&e.delete(t),e.add(t),e.size>n(this,uh)&&g(this,dg,Kv).call(this)}resize(t,e=null){f(this,uh,t);const i=n(this,Ar);if(e){const s=i.size;let r=1;for(const a of i)if(e.has(a.id)&&(i.delete(a),i.add(a)),++r>s)break}for(;i.size>n(this,uh);)g(this,dg,Kv).call(this)}has(t){return n(this,Ar).has(t)}[Symbol.iterator](){return n(this,Ar).keys()}}Ar=new WeakMap,uh=new WeakMap,dg=new WeakSet,Kv=function(){const t=n(this,Ar).keys().next().value;t==null||t.destroy(),n(this,Ar).delete(t)};var Er,ug,fg,ls,Ee,fh,ph,pg,gg,mg,bg,yg,wg,vg,Ag,ro,Eg,Od,Lb,Bd,ks,jd,gh,mh,Ud,ao,Sg,$d,bh,Sr,Vd,xg,Hd,_g,oo,hs,lo,$,qv,n_,r_,a_,Du,Vm,o_,l_,Qv,h_,Nr,Zv,c_,d_,u_,Jv,tA,f_,eA,Hm,iA;class s_{constructor(t){m(this,$);m(this,Er,null);m(this,ug,null);m(this,fg,null);m(this,ls,ai.NONE);m(this,Ee,null);m(this,fh,wn.ENABLE_FORMS);m(this,ph,null);m(this,pg,null);m(this,gg,null);m(this,mg,!1);m(this,bg,!1);m(this,yg,!1);m(this,wg,!1);m(this,vg,!0);m(this,Ag,null);m(this,ro,null);m(this,Eg,0);m(this,Od,null);m(this,Lb,[NaN,NaN]);m(this,Bd,!0);m(this,ks,null);m(this,jd,!1);m(this,gh,null);m(this,mh,null);m(this,Ud,!1);m(this,ao,null);m(this,Sg,0);m(this,$d,new ResizeObserver(g(this,$,f_).bind(this)));m(this,bh,null);m(this,Sr,null);m(this,Vd,null);m(this,xg,!0);m(this,Hd,bn.ENABLE);m(this,_g,null);m(this,oo,null);m(this,hs,null);m(this,lo,null);var s,r;const e="6.3.289";if(aE!==e)throw new Error(`The API version "${aE}" does not match the Viewer version "${e}".`);if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,f(this,_g,t.viewerAlert||null),((s=this.container)==null?void 0:s.tagName)!=="DIV"||((r=this.viewer)==null?void 0:r.tagName)!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");
597if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");n(this,$d).observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new Wu,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,f(this,ug,t.altTextManager||null),f(this,ph,t.commentManager||null),f(this,Vd,t.signatureManager||null),f(this,gg,t.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=a=>this._getVisiblePages().ids.has(a)),this._scriptingManager=t.scriptingManager||null,f(this,Hd,t.textLayerMode??bn.ENABLE),f(this,fh,t.annotationMode??wn.ENABLE_FORMS),f(this,ls,t.annotationEditorMode??ai.NONE),f(this,fg,t.annotationEditorHighlightColors||null),f(this,mg,t.enableHighlightFloatingButton===!0),f(this,yg,t.enableUpdatedAddImage===!0),f(this,wg,t.enableNewAltTextWhenAddingImage===!0),this.imageResourcesPath=t.imageResourcesPath||"",this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.removePageBorders=t.removePageBorders||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.maxCanvasDim=t.maxCanvasDim,this.capCanvasAreaFactor=t.capCanvasAreaFactor,this.enableDetailCanvas=t.enableDetailCanvas??!0,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.enableSelectionRendering=t.enableSelectionRendering!==!1,this.imagesRightClickMinSize=t.imagesRightClickMinSize??-1,this.l10n=t.l10n,this.l10n||(this.l10n=new Xd),f(this,bg,t.enablePermissions||!1),this.pageColors=t.pageColors||null,f(this,Od,t.mlManager||null),f(this,xg,t.supportsPinchToZoom!==!1),f(this,vg,t.enableAutoLinking!==!1),f(this,Eg,t.minDurationToUpdateCanvas??500),this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new W1,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;const{abortSignal:i}=t;f(this,Ag,i||null),i==null||i.addEventListener("abort",()=>{n(this,$d).disconnect(),f(this,$d,null)},{once:!0}),this.scroll=cT(this.container,this._scrollUpdate.bind(this),i),this.presentationModeState=Uh.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),g(this,$,tA).call(this),this.eventBus.on("thumbnailrendered",({pageNumber:a,pdfPage:o})=>{const l=this._pages[a-1];n(this,Er).has(l)||o==null||o.cleanup()},ei),t.l10n||this.l10n.translate(this.container)}get printingAllowed(){return n(this,Bd)}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(n(this,Er))}get pageViewsReady(){return this._pages.every(t=>t==null?void 0:t.pdfPage)}clearSelection(){var e,i;const t=document.getSelection();if(!(!t||t.isCollapsed)){for(let s=0,r=t.rangeCount;s<r;s++)if(t.getRangeAt(s).intersectsNode(this.viewer)){(e=t.removeAllRanges)==null||e.call(t),(i=t.empty)==null||i.call(t);return}}}get renderForms(){return n(this,fh)===wn.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");this.pdfDocument&&(this._currentPageNumber!==t&&this.clearSelection(),this._setCurrentPageNumber(t,!0)||console.error(`currentPageNumber: "${t}" is not a valid page.`))}_setCurrentPageNumber(t,e=!1){var s;if(this._currentPageNumber===t)return e&&g(this,$,Zv).call(this),!0;if(!(0<t&&t<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=t,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:((s=this._pageLabels)==null?void 0:s[t-1])??null,previous:i}),e&&g(this,$,Zv).call(this),!0}get currentPageLabel(){var t;return((t=this._pageLabels)==null?void 0:t[this._currentPageNumber-1])??null}set currentPageLabel(t){if(!this.pdfDocument)return;let e=t|0;if(this._pageLabels){const i=this._pageLabels.indexOf(t);i>=0&&(e=i+1)}this._currentPageNumber!==e&&this.clearSelection(),this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}get currentScale(){return this._currentScale!==0?this._currentScale:1}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&g(this,$,Nr).call(this,t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&g(this,$,Nr).call(this,t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!gx(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(t%=360,t<0&&(t+=360),this._pagesRotation===t))return;this.clearSelection(),this._pagesRotation=t;const e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&g(this,$,Nr).call(this,this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:e}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const t=this;return Hu(this,"_layerProperties",{get annotationEditorUIManager(){return n(t,Ee)},get annotationStorage(){var e;return(e=t.pdfDocument)==null?void 0:e.annotationStorage},get downloadManager(){return t.downloadManager},get enableComment(){return!!n(t,ph)},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){var e;return(e=t.pdfDocument)==null?void 0:e.getFieldObjects()},get findController(){return t.findController}
597,get hasJSActionsPromise(){var e;return(e=t.pdfDocument)==null?void 0:e.hasJSActions()},get linkService(){return t.linkService}})}async getAllText(t=null){const e=[],i=[];for(let s=1,r=this.pdfDocument.numPages;s<=r;++s){if(t!=null&&t.aborted)return null;i.length=0;const a=await this.pdfDocument.getPage(s),{items:o}=await a.getTextContent();for(const l of o)l.str&&i.push(l.str),l.hasEOL&&i.push(` 598`);e.push(xo(i.join("")))}return e.join(` 599`)}setDocument(t){var b,y,w;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(b=this.findController)==null||b.setDocument(null),(y=this._scriptingManager)==null||y.setDocument(null),(w=n(this,Ee))==null||w.destroy(),f(this,Ee,null),f(this,ls,ai.NONE),f(this,Bd,!0)),this.pdfDocument=t,!t)return;const e=t.numPages,i=t.getPage(1),s=t.getOptionalContentConfig({intent:"display"}),r=n(this,bg)?t.getPermissions():Promise.resolve(),{eventBus:a,pageColors:o,viewer:l}=this;f(this,ro,new AbortController);const{signal:h}=n(this,ro),c={signal:h,...ei};if(e>Vg.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const v=this._scrollMode=at.PAGE;a.dispatch("scrollmodechanged",{source:this,mode:v})}this._pagesCapability.promise.then(()=>{a.dispatch("pagesloaded",{source:this,pagesCount:e})},()=>{});const u=v=>{const A=this._pages[v.pageNumber-1];A&&n(this,Er).push(A)};a.on("pagerender",u,c);const p=v=>{v.cssTransform||v.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:v.timestamp}),a.off("pagerendered",p))};a.on("pagerendered",p,c),Promise.all([i,r]).then(([v,A])=>{var D;if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(v),this._optionalContentConfigPromise=s;const{annotationEditorMode:E,annotationMode:S,textLayerMode:x}=g(this,$,n_).call(this,A);if(x!==bn.DISABLE){const P=f(this,ao,document.createElement("div"));P.id="hiddenCopyElement",P.style.cssText="position:absolute;top:0;left:0;width:0;height:0;display:none",l.before(P)}if(E!==ai.DISABLE){const P=E;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):OE(P)?(f(this,Ee,new GP(this.container,l,n(this,_g),n(this,ug),n(this,ph),n(this,Vd),a,t,o,n(this,fg),n(this,mg),n(this,yg),n(this,wg),n(this,Od),n(this,gg),n(this,xg))),a.dispatch("annotationeditoruimanager",{source:this,uiManager:n(this,Ee)}),P!==ai.NONE&&(g(this,$,iA).call(this,P),n(this,Ee).updateMode(P))):console.error(`Invalid AnnotationEditor mode: ${P}`)}const _=this._scrollMode===at.PAGE?null:l,C=this.currentScale,k=v.getViewport({scale:C*Tn.PDF_TO_CSS_UNITS});l.style.setProperty("--scale-factor",k.scale),o!=null&&o.background&&l.style.setProperty("--page-bg-color",o.background),((o==null?void 0:o.foreground)==="CanvasText"||(o==null?void 0:o.background)==="Canvas")&&(l.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),l.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let P=1;P<=e;++P){const I=new tb({container:_,eventBus:a,id:P,scale:C,defaultViewport:k.clone(),optionalContentConfigPromise:s,renderingQueue:this.renderingQueue,textLayerMode:x,annotationMode:S,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,enableSelectionRendering:this.enableSelectionRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:o,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:n(this,vg),minDurationToUpdateCanvas:n(this,Eg),commentManager:n(this,ph),abortSignal:n(this,Ag)});this._pages.push(I)}(D=this._pages[0])==null||D.setPdfPage(v),this._scrollMode===at.PAGE?g(this,$,Du).call(this):this._spreadMode!==Ve.NONE&&this._updateSpreadMode(),a.on("annotationeditorlayerrendered",P=>{n(this,Ee)&&a.dispatch("annotationeditormodechanged",{source:this,mode:n(this,ls)})},{once:!0,signal:h,...ei}),g(this,$,r_).call(this,h).then(async()=>{var I,L;if(t!==this.pdfDocument)return;if((I=this.findController)==null||I.setDocument(t),(L=this._scriptingManager)==null||L.setDocument(t),n(this,ao)&&document.addEventListener("copy",g(this,$,a_).bind(this,x),{signal:h}),t.loadingParams.disableAutoFetch||e>Vg.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let P=e-1;if(P<=0){this._pagesCapability.resolve();return}for(let O=2;O<=e;++O){const H=t.getPage(O).then(W=>{const pt=this._pages[O-1];pt.pdfPage||pt.setPdfPage(W),--P===0&&this._pagesCapability.resolve()},W=>{console.error(`Unable to get page ${O} to initialize viewer`,W),--P===0&&this._pagesCapability.resolve()});O%Vg.PAUSE_EAGER_PAGE_INIT===0&&await H}}),a.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:P})=>{t===this.pdfDocument&&P.Language&&(l.lang=P.Language)}),this.defaultRenderingQueue&&this.update()}).catch(v=>{console.error("Unable to initialize viewer",v),this._pagesCapability.reject(v)})}onPagesEdited({pagesMapper:t,type:e,hasBeenCut:i,pageNumbers:s}){var h,c,u,p,b;if(e==="copy"){f(this,oo,new Map);for(const y of s)n(this,oo).set(y,this._pages[y-1]);return}if(e==="cancelCopy"){f(this,oo,null);return}if((e==="cut"||e==="delete")&&(f(this,hs,this._pages),f(this,lo,s)),e==="cancelDelete"){if(f(this,lo,null),!n(this,hs))return;const y=this._scrollMode===at.PAGE?null:this.viewer;
599if(y){(h=n(this,Ee))==null||h.startUpdatePages();const w=document.createDocumentFragment();for(let v=0,A=n(this,hs).length;v<A;v++){const E=n(this,hs)[v];E.updatePageNumber(v+1),w.append(E.div)}y.replaceChildren(w),(c=n(this,Ee))==null||c.endUpdatePages()}this._pages=n(this,hs),f(this,hs,null);return}if(e==="cleanSavedData"){if(n(this,lo)){if(n(this,hs)){for(const y of n(this,lo))n(this,hs)[y-1].deleteMe();f(this,hs,null)}f(this,lo,null)}return}this._currentPageNumber=0;const a=this._pages,o=this._pages=[];(u=n(this,Ee))==null||u.startUpdatePages();for(let y=1,w=t.pagesNumber;y<=w;y++){const v=t.getPrevPageNumber(y);if(v<0){let E=n(this,oo).get(-v);i?E.updatePageNumber(y):((p=n(this,Ee))==null||p.clonePage(-v-1,y-1),E=E.clone(y)),o.push(E);continue}const A=a[v-1];o.push(A),A.updatePageNumber(y)}(b=n(this,Ee))==null||b.endUpdatePages(),e==="paste"&&f(this,oo,null);const l=this._scrollMode===at.PAGE?null:this.viewer;if(l){const y=document.createDocumentFragment();for(const{div:w}of o)y.append(w);l.replaceChildren(y)}setTimeout(()=>{this.forceRendering()})}setPageLabels(t){var e;if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let i=0,s=this._pages.length;i<s;i++)this._pages[i].setPageLabel(((e=this._pageLabels)==null?void 0:e[i])??null)}}_resetView(){var t,e;this._pages=[],this._currentPageNumber=1,this._currentScale=0,this._currentScaleValue=null,this._pageLabels=null,f(this,Er,new G1(FE)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=at.VERTICAL,this._previousScrollMode=at.UNKNOWN,this._spreadMode=Ve.NONE,f(this,bh,{previousPageNumber:1,scrollDown:!0,pages:[]}),(t=n(this,ro))==null||t.abort(),f(this,ro,null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),(e=n(this,ao))==null||e.remove(),f(this,ao,null),g(this,$,eA).call(this),g(this,$,Hm).call(this)}_scrollUpdate(){this.pagesCount!==0&&(n(this,ks)&&clearTimeout(n(this,ks)),f(this,ks,setTimeout(()=>{f(this,ks,null),this.update()},100)),this.update())}panBy(t,e){const{container:i}=this,s=n(this,Lb),{scrollLeft:r,scrollTop:a}=i,o=(Math.abs(r-s[0])<1?s[0]:r)-t,l=(Math.abs(a-s[1])<1?s[1]:a)-e;s[0]=o,s[1]=l,i.scrollLeft=o,i.scrollTop=l,f(this,jd,!0)}pageLabelToPageNumber(t){if(!this._pageLabels)return null;const e=this._pageLabels.indexOf(t);return e<0?null:e+1}scrollPageIntoView({pageNumber:t,destArray:e=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:s=!1,center:r=null}){if(!this.pdfDocument)return;const a=Number.isInteger(t)&&this._pages[t-1];if(!a){console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!e){this._setCurrentPageNumber(t,!0);return}let o=0,l=0,h=0,c=0,u,p;const b=a.rotation%180!==0,y=(b?a.height:a.width)/a.scale/Tn.PDF_TO_CSS_UNITS,w=(b?a.width:a.height)/a.scale/Tn.PDF_TO_CSS_UNITS;let v=0;switch(e[1].name){case"XYZ":o=e[2],l=e[3],v=e[4],o=o!==null?o:0,l=l!==null?l:w;break;case"Fit":case"FitB":v="page-fit";break;case"FitH":case"FitBH":l=e[2],v="page-width",l===null&&this._location?(o=this._location.left,l=this._location.top):(typeof l!="number"||l<0)&&(l=w);break;case"FitV":case"FitBV":o=e[2],h=y,c=w,v="page-height";break;case"FitR":o=e[2],l=e[3],h=e[4]-o,c=e[5]-l;let x=40,_=5;this.removePageBorders&&(x=_=0),u=(this.container.clientWidth-x)/h/Tn.PDF_TO_CSS_UNITS,p=(this.container.clientHeight-_)/c/Tn.PDF_TO_CSS_UNITS,v=Math.min(Math.abs(u),Math.abs(p));break;default:console.error(`scrollPageIntoView: "${e[1].name}" is not a valid destination type.`);return}if(s||(v&&v!==this._currentScale?this.currentScaleValue=v:this._currentScale===0&&(this.currentScaleValue="auto")),v==="page-fit"&&!e[4]){g(this,$,Vm).call(this,a);return}const A=[a.viewport.convertToViewportPoint(o,l),a.viewport.convertToViewportPoint(o+h,l+c)];let E=Math.min(A[0][0],A[1][0]),S=Math.min(A[0][1],A[1][1]);r?((r==="both"||r==="vertical")&&(S-=(this.container.clientHeight-Math.abs(A[1][1]-A[0][1]))/2),(r==="both"||r==="horizontal")&&(E-=(this.container.clientWidth-Math.abs(A[1][0]-A[0][0]))/2)):i||(E=Math.max(E,0),S=Math.max(S,0)),g(this,$,Vm).call(this,a,{left:E,top:S})}_updateLocation(t){f(this,jd,!1);const e=this._currentScale,i=this._currentScaleValue,s=parseFloat(i)===e?Math.round(e*1e4)/100:i,r=t.id,a=this._pages[r-1],o=this.container,l=a.getPagePoint(o.scrollLeft-t.x,o.scrollTop-t.y),[h,c]=l;let u=`#page=${r}`;this.isInPresentationMode||(u+=`&zoom=${s},${Math.round(h)},${Math.round(c)}`),this._location={pageNumber:r,scale:s,top:c,left:h,rotation:this._pagesRotation,pdfOpenParams:u}}update(){const t=this._getVisiblePages(),e=t.views,i=e.length;if(i===0)return;const s=Math.max(FE,2*i+1);n(this,Er).resize(s,t.ids);for(const{view:l,visibleArea:h}of e)l.updateVisibleArea(h);for(const l of n(this,Er))t.ids.has(l.id)||l.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const r=this._spreadMode===Ve.NONE&&(this._scrollMode===at.PAGE||this._scrollMode===at.VERTICAL),a=this._currentPageNumber;let o=!1;for(const l of e){if(l.percent<100)break;if(l.id===a&&r){o=!0;break}}this._setCurrentPageNumber(o?this._currentPageNumber:e[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(t){return this.container.contains(t)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===Uh.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===Uh.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const t=this._scrollMode===at.PAGE?n(this,bh).pages:this._pages,e=this._scrollMode===at.HORIZONTAL,i=e&&this._isContainerRtl;return fT({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:i})}cleanup(){for(const t of this._pages)t.renderingState!==ct.FINISHED&&t.reset()}_cancelRendering(){for(const t of this._pages)t.cancelRendering()}forceRendering(t){const e=t||this._getVisiblePages(),i=g(this,$,u_).call(this,e),s=this._spreadMode!==Ve.NONE&&this._scrollMode!==at.HORIZONTAL,r=n(this,Sr)!==null||n(this,ks)!==null&&e.views.some(o=>{var l;
599return(l=o.detailView)==null?void 0:l.renderingCancelled}),a=this.renderingQueue.getHighestPriority(e,this._pages,i,s,r);return a?(g(this,$,d_).call(this,a).then(()=>{this.renderingQueue.renderView(a)}),!0):!1}get hasEqualPageSizes(){const t=this._pages[0];for(let e=1,i=this._pages.length;e<i;++e){const s=this._pages[e];if(s.width!==t.width||s.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{const i=e.pdfPage.getViewport({scale:1}),s=fE(i);if(t===void 0)t=s;else if(this.enablePrintAutoRotate&&s!==t)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(t){if(!(t instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${t}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=t,this.refresh(!1,{optionalContentConfigPromise:t}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t}))}get scrollMode(){return this._scrollMode}set scrollMode(t){if(this._scrollMode!==t){if(!pT(t))throw new Error(`Invalid scroll mode: ${t}`);this.pagesCount>Vg.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this.clearSelection(),this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){const e=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",e===at.HORIZONTAL),i.classList.toggle("scrollWrapped",e===at.WRAPPED),!(!this.pdfDocument||!t)&&(e===at.PAGE?g(this,$,Du).call(this):this._previousScrollMode===at.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&g(this,$,Nr).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(t){if(this._spreadMode!==t){if(!gT(t))throw new Error(`Invalid spread mode: ${t}`);this.clearSelection(),this._spreadMode=t,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(t=null){if(!this.pdfDocument)return;const e=this.viewer,i=this._pages;if(this._scrollMode===at.PAGE)g(this,$,Du).call(this);else if(e.textContent="",this._spreadMode===Ve.NONE)for(const s of this._pages)e.append(s.div);else{const s=this._spreadMode-1;let r=null;for(let a=0,o=i.length;a<o;++a)r===null?(r=document.createElement("div"),r.className="spread",e.append(r)):a%2===s&&(r=r.cloneNode(!1),e.append(r)),r.append(i[a].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&g(this,$,Nr).call(this,this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}nextPage(){const t=this._currentPageNumber,e=this.pagesCount;if(t>=e)return!1;const i=g(this,$,Jv).call(this,t,!1)||1;return this.currentPageNumber=Math.min(t+i,e),!0}previousPage(){const t=this._currentPageNumber;if(t<=1)return!1;const e=g(this,$,Jv).call(this,t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:i=null,origin:s,pan:r=null}){if(i===null&&e===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let a=this._currentScale;if(e>0&&e!==1)a=Math.round(a*e*100)/100;else if(i){const o=i>0?1.1:.9090909090909091,l=i>0?Math.ceil:Math.floor;i=Math.abs(i);do a=l((a*o).toFixed(2)*10)/10;while(--i>0)}a=eT(a,.1,25),g(this,$,Nr).call(this,a,{noScroll:!1,drawingDelay:t,origin:s,pan:r})}increaseScale(t={}){this.updateScale({...t,steps:t.steps??1})}decreaseScale(t={}){this.updateScale({...t,steps:-(t.steps??1)})}get containerTopLeft(){return n(this,pg)||f(this,pg,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return n(this,Ee)?n(this,ls):ai.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:i=!1,mustEnterInEditMode:s=!1,editComment:r=!1}){if(!n(this,Ee))throw new Error("The AnnotationEditor is not enabled.");
599if(n(this,ls)===t)return;if(!OE(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;g(this,$,iA).call(this,t);const{eventBus:a,pdfDocument:o}=this,l=async()=>{g(this,$,Hm).call(this),f(this,ls,t),await n(this,Ee).updateMode(t,e,!0,i,s,r),!(t!==n(this,ls)||o!==this.pdfDocument)&&a.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===ai.NONE||n(this,ls)===ai.NONE){const h=t!==ai.NONE;h||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(const u of this._pages)u.toggleEditingMode(h);const c=g(this,$,c_).call(this);if(h&&c){g(this,$,Hm).call(this),f(this,gh,new AbortController);const u=AbortSignal.any([n(this,ro).signal,n(this,gh).signal]);a.on("pagerendered",({pageNumber:p})=>{c.delete(p),c.size===0&&f(this,mh,setTimeout(l,0))},{signal:u,...ei});return}}l()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(const i of this._pages)i.update(e);g(this,$,eA).call(this),t||this.update()}}}Er=new WeakMap,ug=new WeakMap,fg=new WeakMap,ls=new WeakMap,Ee=new WeakMap,fh=new WeakMap,ph=new WeakMap,pg=new WeakMap,gg=new WeakMap,mg=new WeakMap,bg=new WeakMap,yg=new WeakMap,wg=new WeakMap,vg=new WeakMap,Ag=new WeakMap,ro=new WeakMap,Eg=new WeakMap,Od=new WeakMap,Lb=new WeakMap,Bd=new WeakMap,ks=new WeakMap,jd=new WeakMap,gh=new WeakMap,mh=new WeakMap,Ud=new WeakMap,ao=new WeakMap,Sg=new WeakMap,$d=new WeakMap,bh=new WeakMap,Sr=new WeakMap,Vd=new WeakMap,xg=new WeakMap,Hd=new WeakMap,_g=new WeakMap,oo=new WeakMap,hs=new WeakMap,lo=new WeakMap,$=new WeakSet,qv=function(t){f(this,Bd,t),this.eventBus.dispatch("printingallowed",{source:this,isAllowed:t})},n_=function(t){const e={annotationEditorMode:n(this,ls),annotationMode:n(this,fh),textLayerMode:n(this,Hd)};return t?(g(this,$,qv).call(this,t.has(Ph.PRINT_HIGH_QUALITY)||t.has(Ph.PRINT)),!t.has(Ph.COPY)&&n(this,Hd)===bn.ENABLE&&(e.textLayerMode=bn.ENABLE_PERMISSIONS),t.has(Ph.MODIFY_CONTENTS)||(e.annotationEditorMode=ai.DISABLE),!t.has(Ph.MODIFY_ANNOTATIONS)&&!t.has(Ph.FILL_INTERACTIVE_FORMS)&&n(this,fh)===wn.ENABLE_FORMS&&(e.annotationMode=wn.ENABLE),e):(g(this,$,qv).call(this,!0),e)},r_=async function(t){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const e=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e.resolve()},{signal:AbortSignal.any([t,i.signal])}),await Promise.race([this._onePageRenderedCapability.promise,e.promise]),i.abort()},a_=function(t,e){const i=document.getSelection(),{focusNode:s,anchorNode:r}=i;if(r&&s&&i.containsNode(n(this,ao))){if(n(this,Ud)||t===bn.ENABLE_PERMISSIONS){pv(e);return}f(this,Ud,!0);const{classList:a}=this.viewer;a.add("copyAll");const o=new AbortController,l=new AbortController;window.addEventListener("keydown",h=>{h.key==="Escape"&&l.abort()},{signal:o.signal}),this.getAllText(l.signal).then(async h=>{h!==null&&await navigator.clipboard.writeText(h)}).catch(h=>{console.warn(`Something goes wrong when extracting the text: ${h.message}`)}).finally(()=>{f(this,Ud,!1),o.abort(),a.remove("copyAll")}),pv(e)}},Du=function(){if(this._scrollMode!==at.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const t=this._currentPageNumber,e=n(this,bh),i=this.viewer;if(i.textContent="",e.pages.length=0,this._spreadMode===Ve.NONE&&!this.isInPresentationMode){const s=this._pages[t-1];i.append(s.div),e.pages.push(s)}else{const s=new Set,r=this._spreadMode-1;r===-1?s.add(t-1):t%2!==r?(s.add(t-1),s.add(t)):(s.add(t-2),s.add(t-1));const a=document.createElement("div");if(a.className="spread",this.isInPresentationMode){const o=document.createElement("div");o.className="dummyPage",a.append(o)}for(const o of s){const l=this._pages[o];l&&(a.append(l.div),e.pages.push(l))}i.append(a)}e.scrollDown=t>=e.previousPageNumber,e.previousPageNumber=t},Vm=function(t,e=null){const{div:i,id:s}=t;if(this._currentPageNumber!==s&&this._setCurrentPageNumber(s),this._scrollMode===at.PAGE&&(g(this,$,Du).call(this),this.update()),!e&&!this.isInPresentationMode){const r=i.offsetLeft+i.clientLeft,a=r+i.clientWidth,{scrollLeft:o,clientWidth:l}=this.container;(this._scrollMode===at.HORIZONTAL||r<o||a>o+l)&&(e={left:0,top:0})}hT(i,e),!this._currentScaleValue&&this._location&&(this._location=null)},o_=function(t){return t===this._currentScale||Math.abs(t-this._currentScale)<1e-15},l_=function(){if(!n(this,jd))return;const{first:t}=this._getVisiblePages();t&&this._updateLocation(t)}
599,Qv=function(t,e,{noScroll:i=!1,preset:s=!1,drawingDelay:r=-1,origin:a=null,pan:o=null}){if(this._currentScaleValue=e.toString(),g(this,$,o_).call(this,t)){o&&!i&&this.panBy(o[0],o[1]),s&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:e});return}this.clearSelection(),this.viewer.style.setProperty("--scale-factor",t*Tn.PDF_TO_CSS_UNITS);const l=r>=0&&r<1e3;this.refresh(!0,{scale:t,drawingDelay:l?r:-1}),l&&f(this,Sr,setTimeout(()=>{f(this,Sr,null),this.refresh()},r));const h=this._currentScale;if(this._currentScale=t,!i){g(this,$,l_).call(this);let c=this._currentPageNumber,u;this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(c=this._location.pageNumber,u=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:c,destArray:u,allowNegativeOffset:!0});let p=(o==null?void 0:o[0])??0,b=(o==null?void 0:o[1])??0;if(Array.isArray(a)){const y=t/h-1,[w,v]=this.containerTopLeft;p-=(a[0]-v)*y,b-=(a[1]-w)*y}(p||b)&&this.panBy(p,b)}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:s?e:void 0}),this.defaultRenderingQueue&&this.update()},h_=function(){return this._spreadMode!==Ve.NONE&&this._scrollMode!==at.HORIZONTAL?2:1},Nr=function(t,e){let i=parseFloat(t);if(i>0)e.preset=!1,g(this,$,Qv).call(this,i,t,e);else{const s=this._pages[this._currentPageNumber-1];if(!s)return;let r=40,a=5;this.isInPresentationMode?(r=a=4,this._spreadMode!==Ve.NONE&&(r*=2)):this.removePageBorders?r=a=0:this._scrollMode===at.HORIZONTAL&&([r,a]=[a,r]);const o=(this.container.clientWidth-r)/s.width*s.scale/n(this,$,h_),l=(this.container.clientHeight-a)/s.height*s.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const h=fE(s)?o:Math.min(l,o);i=Math.min(1.25,h);break;default:console.error(`#setScale: "${t}" is an unknown zoom value.`);return}e.preset=!0,g(this,$,Qv).call(this,i,t,e)}},Zv=function(){const t=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&g(this,$,Nr).call(this,this._currentScaleValue,{noScroll:!0}),g(this,$,Vm).call(this,t)},c_=function(){const t=this._getVisiblePages(),e=[],{ids:i,views:s}=t;for(const r of s){const{view:a}=r;if(!a.hasEditableAnnotations()){i.delete(a.id);continue}e.push(r)}return e.length===0?null:(this.renderingQueue.renderHighestPriority({first:e[0],last:e.at(-1),views:e,ids:i}),i)},d_=async function(t){if(t.pdfPage)return t.pdfPage;try{const e=await this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(e){return console.error("Unable to get page for page view",e),null}},u_=function(t){var e,i;if(((e=t.first)==null?void 0:e.id)===1)return!0;if(((i=t.last)==null?void 0:i.id)===this.pagesCount)return!1;switch(this._scrollMode){case at.PAGE:return n(this,bh).scrollDown;case at.HORIZONTAL:return this.scroll.right}return this.scroll.down},Jv=function(t,e=!1){switch(this._scrollMode){case at.WRAPPED:{const{views:i}=this._getVisiblePages(),s=new Map;for(const{id:r,y:a,percent:o,widthPercent:l}of i)o===0||l<100||s.getOrInsertComputed(a,JP).push(r);for(const r of s.values()){const a=r.indexOf(t);if(a===-1)continue;const o=r.length;if(o===1)break;if(e)for(let l=a-1,h=0;l>=h;l--){const c=r[l],u=r[l+1]-1;if(c<u)return t-u}else for(let l=a+1,h=o;l<h;l++){const c=r[l],u=r[l-1]+1;if(c>u)return u-t}if(e){const l=r[0];if(l<t)return t-l+1}else{const l=r[o-1];if(l>t)return l-t+1}break}break}case at.HORIZONTAL:break;case at.PAGE:case at.VERTICAL:{if(this._spreadMode===Ve.NONE)break;const i=this._spreadMode-1;if(e&&t%2!==i)break;if(!e&&t%2===i)break;const{views:s}=this._getVisiblePages(),r=e?t-1:t+1;for(const{id:a,percent:o,widthPercent:l}of s)if(a===r){if(o>0&&l===100)return 2;break}break}}return 1},tA=function(t=this.container.clientHeight){t!==n(this,Sg)&&(f(this,Sg,t),mT.setProperty("--viewer-container-height",`${t}px`))},f_=function(t){for(const e of t)if(e.target===this.container){g(this,$,tA).call(this,Math.floor(e.borderBoxSize[0].blockSize)),f(this,pg,null);break}},eA=function(){n(this,Sr)!==null&&(clearTimeout(n(this,Sr)),f(this,Sr,null)),n(this,ks)!==null&&(clearTimeout(n(this,ks)),f(this,ks,null))},Hm=function(){var t;(t=n(this,gh))==null||t.abort(),f(this,gh,null),n(this,mh)!==null&&(clearTimeout(n(this,mh)),f(this,mh,null))},iA=function(t){var e,i;switch(t){case ai.STAMP:(e=n(this,Od))==null||e.loadModel("altText");break;case ai.SIGNATURE:(i=n(this,Vd))==null||i.loadSignatures();break}};class X1 extends s_{_resetView(){super._resetView(),this._scrollMode=at.PAGE,this._spreadMode=Ve.NONE}set scrollMode(t){}_updateScrollMode(){}set spreadMode(t){}_updateSpreadMode(){}}globalThis.pdfjsViewer={AnnotationLayerBuilder:Cx,DownloadManager:PT,EventBus:Sv,FindState:Rr,GenericL10n:Xd,LinkTarget:Eo,parseQueryString:Yb,PDFFindController:xT,PDFHistory:C1,PDFLinkService:_x,PDFPageView:tb,PDFScriptingManager:H1,PDFSinglePageViewer:X1,PDFViewer:s_,ProgressBar:bT,RenderingStates:ct,ScrollMode:
599at,SimpleLinkService:Wu,SpreadMode:Ve,StructTreeLayerBuilder:Wx,TextLayerBuilder:Jm,XfaLayerBuilder:Qx};const Y1="/build/assets/pdf.worker.min-Dswkl-cV.mjs",K1={class:"flex justify-center mb-4"},q1={class:"w-full max-w-3xl"},Q1={key:0,class:"flex justify-center"},Z1={class:"w-full max-w-3xl"},J1={key:1,class:"flex justify-center"},tk={key:0,class:"text-lg text-danger-600 dark:text-danger-400"},ek=["innerHTML"],qk=v_({__name:"Display",setup(d){Br.workerSrc=Y1;const t=tu(""),e=tu(!1),i=tu(!0),s=tu(!1),{selectedLocale:r}=A_(),{isDark:a}=E_(),o=x_(),l=tu(null);let h=null;async function c(u){h=cS({data:u});const p=await h.promise,b=p.numPages,y=l.value;if(y)for(let w=1;w<=b;w++){const v=await p.getPage(w),A=1.5,E=v.getViewport({scale:A}),S=window.devicePixelRatio||1,x=document.createElement("div");x.className="pdf-page-wrapper",x.style.setProperty("--total-scale-factor",String(A)),x.style.setProperty("--scale-round-x","1px"),x.style.setProperty("--scale-round-y","1px");const _=document.createElement("canvas"),C=_.getContext("2d");_.width=Math.floor(E.width*S),_.height=Math.floor(E.height*S),_.style.width=Math.floor(E.width)+"px",_.style.height=Math.floor(E.height)+"px",_.className="pdf-canvas";const k=S!==1?[S,0,0,S,0,0]:void 0,D=a.value?{background:getComputedStyle(document.documentElement).getPropertyValue("--p-surface-100").trim()||"#1a1a1a",foreground:getComputedStyle(document.documentElement).getPropertyValue("--p-surface-800").trim()||"#ffffff"}:void 0;await v.render({canvas:_,canvasContext:C,transform:k,viewport:E,pageColors:D}).promise;const P=document.createElement("div");P.className="textLayer";const I=await v.getTextContent();await new Xm({textContentSource:I,container:P,viewport:E}).render();const O=await v.getAnnotations();let H=null;O.length>0&&(H=document.createElement("div"),H.className="annotationLayer",await new TS({div:H,accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,page:v,viewport:E,structTreeLayer:null,commentManager:null,linkService:new Wu,annotationStorage:null}).render({annotations:O,imageResourcesPath:"",renderForms:!1,downloadManager:void 0,enableScripting:!1,hasJSActions:!1,fieldObjects:null,optionalContentConfig:null,viewport:E,div:H,page:v,linkService:new Wu})),x.appendChild(_),x.appendChild(P),H&&x.appendChild(H),y.appendChild(x)}}return S_(async()=>{try{const u=await fetch(`/ajax/raw-policies/${r.value}/${o.params.policy}`);if(!u.ok)throw new Error("Network response was not ok");if((u.headers.get("content-type")??"").includes("application/pdf")){e.value=!0,i.value=!1,await __();const b=await u.arrayBuffer();await c(b)}else{let b=await u.text();const y=document.createElement("div");y.innerHTML=b;const w=y.querySelector("*:first-child");w&&(w.style.paddingTop="0",w.style.marginTop="0"),t.value=y.innerHTML}}catch(u){console.error("There has been a problem with your fetch operation:",u),s.value=!0}finally{i.value=!1}}),C_(()=>{h&&h.destroy()}),(u,p)=>{const b=w_,y=T_("RouterLink");return _h(),xh(M_,null,[Jb("div",K1,[Jb("div",q1,[eu(y,{to:{name:"policies"},class:"flex flex-row justify-start items-center gap-1 text-lg"},{default:P_(()=>[eu(b),I_(CA(u.$t("pages.policies.back_to_index")),1)]),_:1})])]),i.value?(_h(),xh("div",Q1,[Jb("div",Z1,[eu(ty,{width:"100px",height:"32px",class:"mb-4 mt-1"}),eu(ty,{width:"100%",height:"16px",class:"mb-2"}),eu(ty,{width:"150px",height:"16px",class:"mb-2"})])])):(_h(),xh("div",J1,[s.value?(_h(),xh("div",tk,CA(u.$t("pages.policies.error_loading")),1)):k_("",!0),e.value?(_h(),xh("div",{key:1,ref_key:"pdfContainer",ref:l,class:"w-full max-w-3xl flex flex-col items-center"},null,512)):(_h(),xh("div",{key:2,class:"w-full max-w-3xl policy-container",innerHTML:t.value},null,8,ek))]))],64)}}});export{qk as default}; 600//# sourceMappingURL=Display-DT7ZtaR1.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.