1import{p as yE,y as AE}from"../base-Ci7vLHE_.js";import"../preload-helper-BVLnHgTN.js";var _E=Object.defineProperty,mA=i=>{throw TypeError(i)},EE=(i,t,e)=>t in i?_E(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,S=(i,t,e)=>EE(i,typeof t!="symbol"?t+"":t,e),Ub=(i,t,e)=>t.has(i)||mA("Cannot "+e),n=(i,t,e)=>(Ub(i,t,"read from private field"),e?e.call(i):t.get(i)),f=(i,t,e)=>t.has(i)?mA("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,e),u=(i,t,e,s)=>(Ub(i,t,"write to private field"),t.set(i,e),e),m=(i,t,e)=>(Ub(i,t,"access private method"),e),jt=(i,t,e,s)=>({set _(a){u(i,t,a)},get _(){return n(i,t,s)}});const vi=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),En=[1/0,1/0,-1/0,-1/0],oo=new Float32Array(En),Hv=[.001,0,0,.001,0,0],jm=1.35,gi={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},fa={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},yu="pdfjs_internal_editor_",V={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},K={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},xE={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},se={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},Fp={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Gt={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},qo={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},_m={ERRORS:0,WARNINGS:1,INFOS:5},un={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},Ih={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},kE={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Em=_m.WARNINGS;function SE(i){Number.isInteger(i)&&(Em=i)}function ME(){return Em}function xm(i){Em>=_m.INFOS&&console.info(`Info: ${i}`)}function Y(i){Em>=_m.WARNINGS&&console.warn(`Warning: ${i}`)}function at(i){throw new Error(i)}function Tt(i,t){i||at(t)}function CE(i){switch(i==null?void 0:i.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function vA(i,t=null,e=null){if(!i)return null;if(e&&typeof i=="string"){if(e.addDefaultProtocol&&i.startsWith("www.")){const a=i.match(/\./g);(a==null?void 0:a.length)>=2&&(i=`http://${i}`)}if(e.tryConvertEncoding)try{i=DE(i)}catch{}}const s=t?URL.parse(i,t):URL.parse(i);return CE(s)?s:null}function wA(i,t,e=!1){const s=URL.parse(i);return s?(s.hash=t,s.href):e&&vA(i,"http://example.com")?i.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Vv(i){return i.substring(i.lastIndexOf("/")+1)}function G(i,t,e,s=!1){return Object.defineProperty(i,t,{value:e,enumerable:!s,configurable:!0,writable:!1}),e}const _o=function(){function i(t,e){this.message=t,this.name=e}return i.prototype=new Error,i.constructor=i,i}();class l0 extends _o{constructor(t,e){super(t,"PasswordException"),this.code=e}}class $m extends _o{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}let zv=class extends _o{constructor(i){super(i,"InvalidPDFException")}},$f=class extends _o{constructor(i,t,e){super(i,"ResponseException"),this.status=t,this.missing=e}};class PE extends _o{constructor(t){super(t,"FormatError")}}let Fa=class extends _o{constructor(i){super(i,"AbortException")}};function TE(i){(typeof i!="object"||(i==null?void 0:i.length)===void 0)&&at("Invalid argument for bytesToString");const t=i.length,e=8192;if(t<e)return String.fromCharCode.apply(null,i);const s=[];for(let a=0;a<t;a+=e){const r=Math.min(a+e,t),o=i.subarray(a,r);s.push(String.fromCharCode.apply(null,o))}return s.join("")}
1function km(i){typeof i!="string"&&at("Invalid argument for stringToBytes");const t=i.length,e=new Uint8Array(t);for(let s=0;s<t;++s)e[s]=i.charCodeAt(s)&255;return e}function IE(){const i=new Uint8Array(4);return i[0]=1,new Uint32Array(i.buffer,0,1)[0]===1}let Jt=class{static get isLittleEndian(){return G(this,"isLittleEndian",IE())}static get isOffscreenCanvasSupported(){return G(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return G(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return G(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return G(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){const{platform:i,userAgent:t}=navigator;return G(this,"platform",{isAndroid:t.includes("Android"),isLinux:i.includes("Linux"),isMac:i.includes("Mac"),isWindows:i.includes("Win"),isFirefox:t.includes("Firefox")})}static get isCSSRoundSupported(){var i,t;return G(this,"isCSSRoundSupported",(t=(i=globalThis.CSS)==null?void 0:i.supports)==null?void 0:t.call(i,"width: round(1.5px, 1px)"))}static get isAlphaColorInputSupported(){return G(this,"isAlphaColorInputSupported",(()=>{if(typeof document>"u")return!1;const i=document.createElement("input");return i.type="color",i.setAttribute("alpha",""),i.value="#ff000080",i.value!=="#ff0000"})())}};var Wa,Um,Iu,Hm;let R=(Um=class{static get hexNums(){return G(this,"hexNums",Array.from(Array(256).keys(),i=>i.toString(16).padStart(2,"0")))}static makeHexColor(i,t,e){return`#${this.hexNums[i]}${this.hexNums[t]}${this.hexNums[e]}`}static domMatrixToTransform(i){return[i.a,i.b,i.c,i.d,i.e,i.f]}static scaleMinMax(i,t){let e;i[0]?(i[0]<0&&(e=t[0],t[0]=t[2],t[2]=e),t[0]*=i[0],t[2]*=i[0],i[3]<0&&(e=t[1],t[1]=t[3],t[3]=e),t[1]*=i[3],t[3]*=i[3]):(e=t[0],t[0]=t[1],t[1]=e,e=t[2],t[2]=t[3],t[3]=e,i[1]<0&&(e=t[1],t[1]=t[3],t[3]=e),t[1]*=i[1],t[3]*=i[1],i[2]<0&&(e=t[0],t[0]=t[2],t[2]=e),t[0]*=i[2],t[2]*=i[2]),t[0]+=i[4],t[1]+=i[5],t[2]+=i[4],t[3]+=i[5]}static transform(i,t){return[i[0]*t[0]+i[2]*t[1],i[1]*t[0]+i[3]*t[1],i[0]*t[2]+i[2]*t[3],i[1]*t[2]+i[3]*t[3],i[0]*t[4]+i[2]*t[5]+i[4],i[1]*t[4]+i[3]*t[5]+i[5]]}static multiplyByDOMMatrix(i,t){return[i[0]*t.a+i[2]*t.b,i[1]*t.a+i[3]*t.b,i[0]*t.c+i[2]*t.d,i[1]*t.c+i[3]*t.d,i[0]*t.e+i[2]*t.f+i[4],i[1]*t.e+i[3]*t.f+i[5]]}static applyTransform(i,t,e=0){const s=i[e],a=i[e+1];i[e]=s*t[0]+a*t[2]+t[4],i[e+1]=s*t[1]+a*t[3]+t[5]}static applyTransformToBezier(i,t,e=0){const s=t[0],a=t[1],r=t[2],o=t[3],l=t[4],h=t[5];for(let c=0;c<6;c+=2){const d=i[e+c],p=i[e+c+1];i[e+c]=d*s+p*r+l,i[e+c+1]=d*a+p*o+h}}static applyInverseTransform(i,t){const e=i[0],s=i[1],a=t[0]*t[3]-t[1]*t[2];i[0]=(e*t[3]-s*t[2]+t[2]*t[5]-t[4]*t[3])/a,i[1]=(-e*t[1]+s*t[0]+t[4]*t[1]-t[5]*t[0])/a}static axialAlignedBoundingBox(i,t,e){const s=t[0],a=t[1],r=t[2],o=t[3],l=t[4],h=t[5],c=i[0],d=i[1],p=i[2],g=i[3];let v=s*c+l,w=v,b=s*p+l,y=b,A=o*d+h,_=A,E=o*g+h,x=E;if(a!==0||r!==0){const k=a*c,C=a*p,I=r*d,P=r*g;v+=I,y+=I,b+=P,w+=P,A+=k,x+=k,E+=C,_+=C}e[0]=Math.min(e[0],v,b,w,y),e[1]=Math.min(e[1],A,E,_,x),e[2]=Math.max(e[2],v,b,w,y),e[3]=Math.max(e[3],A,E,_,x)}static inverseTransform(i){const t=i[0]*i[3]-i[1]*i[2];return[i[3]/t,-i[1]/t,-i[2]/t,i[0]/t,(i[2]*i[5]-i[4]*i[3])/t,(i[4]*i[1]-i[5]*i[0])/t]}static singularValueDecompose2dScale(i,t){const e=i[0],s=i[1],a=i[2],r=i[3],o=e**2+s**2,l=e*a+s*r,h=a**2+r**2,c=(o+h)/2,d=Math.sqrt(c**2-(o*h-l**2));t[0]=Math.sqrt(c+d||1),t[1]=Math.sqrt(c-d||1)}static normalizeRect(i){const t=i.slice(0);return i[0]>i[2]&&(t[0]=i[2],t[2]=i[0]),i[1]>i[3]&&(t[1]=i[3],t[3]=i[1]),t}static intersect(i,t){const e=Math.max(Math.min(i[0],i[2]),Math.min(t[0],t[2])),s=Math.min(Math.max(i[0],i[2]),Math.max(t[0],t[2]));if(e>s)return null;const a=Math.max(Math.min(i[1],i[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(i[1],i[3]),Math.max(t[1],t[3]));return a>r?null:[e,a,s,r]}static pointBoundingBox(i,t,e){e[0]=Math.min(e[0],i),e[1]=Math.min(e[1],t),e[2]=Math.max(e[2],i),e[3]=Math.max(e[3],t)}static rectBoundingBox(i,t,e,s,a){a[0]=Math.min(a[0],i,e),a[1]=Math.min(a[1],t,s),a[2]=Math.max(a[2],i,e),a[3]=Math.max(a[3],t,s)}static bezierBoundingBox(i,t,e,s,a,r,o,l,h){h[0]=Math.min(h[0],i,o),h[1]=Math.min(h[1],t,l),h[2]=Math.max(h[2],i,o),h[3]=Math.max(h[3],t,l),m(this,Wa,Hm).call(this,i,e,a,o,t,s,r,l,3*(-i+3*(e-a)+o),6*(i-2*e+a),3*(e-i),h),m(this,Wa,Hm).call(this,i,e,a,o,t,s,r,l,3*(-t+3*(s-r)+l),6*(t-2*s+r),3*(s-t),h)}},Wa=new WeakSet,Iu=function(i,t,e,s,a,r,o,l,h,c){if(h<=0||h>=1)return;
1const d=1-h,p=h*h,g=p*h,v=d*(d*(d*i+3*h*t)+3*p*e)+g*s,w=d*(d*(d*a+3*h*r)+3*p*o)+g*l;c[0]=Math.min(c[0],v),c[1]=Math.min(c[1],w),c[2]=Math.max(c[2],v),c[3]=Math.max(c[3],w)},Hm=function(i,t,e,s,a,r,o,l,h,c,d,p){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&m(this,Wa,Iu).call(this,i,t,e,s,a,r,o,l,-d/c,p);return}const g=c**2-4*d*h;if(g<0)return;const v=Math.sqrt(g),w=2*h;m(this,Wa,Iu).call(this,i,t,e,s,a,r,o,l,(-c+v)/w,p),m(this,Wa,Iu).call(this,i,t,e,s,a,r,o,l,(-c-v)/w,p)},f(Um,Wa),Um);function DE(i){return decodeURIComponent(escape(i))}let Vm=null,h0=null;function LE(i){return Vm||(Vm=/([\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,h0=new Map([["ï¬
","ſt"]])),i.replaceAll(Vm,(t,e,s)=>e?e.normalize("NFKC"):h0.get(s))}function bA(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const i=new Uint8Array(32);return crypto.getRandomValues(i),TE(i)}const Gl="pdfjs_internal_id_";function RE(i,t,e){if(!Array.isArray(e)||e.length<2)return!1;const[s,a,...r]=e;if(!i(s)&&!Number.isInteger(s)||!t(a))return!1;const o=r.length;let l=!0;switch(a.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;l=!1;break;default:return!1}for(const h of r)if(!(typeof h=="number"||l&&h===null))return!1;return!0}const Hb=()=>[],Vb=()=>new Map,Gv=()=>Object.create(null);function xt(i,t,e){return Math.min(Math.max(i,t),e)}class Au{static textContent(t){const e=[],s={items:e,styles:Object.create(null)};function a(r){var o;if(!r)return;let l=null;const h=r.name;if(h==="#text")l=r.value;else if(Au.shouldBuildText(h))(o=r==null?void 0:r.attributes)!=null&&o.textContent?l=r.attributes.textContent:r.value&&(l=r.value);else return;if(l!==null&&e.push({str:l}),!!r.children)for(const c of r.children)a(c)}return a(t),s}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}let yA=class{static setupStorage(i,t,e,s,a){const r=s.getValue(t,{value:null});switch(e.name){case"textarea":if(r.value!==null&&(i.textContent=r.value),a==="print")break;i.addEventListener("input",o=>{s.setValue(t,{value:o.target.value})});break;case"input":if(e.attributes.type==="radio"||e.attributes.type==="checkbox"){if(r.value===e.attributes.xfaOn?i.setAttribute("checked",!0):r.value===e.attributes.xfaOff&&i.removeAttribute("checked"),a==="print")break;i.addEventListener("change",o=>{s.setValue(t,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&i.setAttribute("value",r.value),a==="print")break;i.addEventListener("input",o=>{s.setValue(t,{value:o.target.value})})}break;case"select":if(r.value!==null){i.setAttribute("value",r.value);for(const o of e.children)o.attributes.value===r.value?o.attributes.selected=!0:Object.hasOwn(o.attributes,"selected")&&delete o.attributes.selected}i.addEventListener("input",o=>{const l=o.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(t,{value:h})});break}}static setAttributes({html:i,element:t,storage:e=null,intent:s,linkService:a}){const{attributes:r}=t,o=i instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${s}`);for(const[l,h]of Object.entries(r))if(h!=null)switch(l){case"class":h.length&&i.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":i.setAttribute("data-element-id",h);break;case"style":Object.assign(i.style,h);break;case"textContent":i.textContent=h;break;default:(!o||l!=="href"&&l!=="newWindow")&&i.setAttribute(l,h)}o&&a.addLinkAttributes(i,r.href,r.newWindow),e&&r.dataId&&this.setupStorage(i,r.dataId,t,e)}static render(i){var t,e;const s=i.annotationStorage,a=i.linkService,r=i.xfaHtml,o=i.intent||"display",l=document.createElement(r.name);r.attributes&&this.setAttributes({html:l,element:r,intent:o,linkService:a});const h=o!=="richText",c=i.div;if(c.append(l),i.viewport){const g=`matrix(${i.viewport.transform.join(",")})`;c.style.transform=g}h&&c.setAttribute("class","xfaLayer xfaFont");const d=[];if(r.children.length===0){if(r.value){const g=document.createTextNode(r.value);l.append(g),h&&Au.shouldBuildText(r.name)&&d.push(g)}return{textDivs:d}}const p=[[r,-1,l]];for(;p.length>0;){const[g,v,w]=p.at(-1);if(v+1===g.children.length){p.pop();continue}const b=g.children[++p.at(-1)[1]];if(b===null)continue;const{name:y}=b;if(y==="#text"){const _=document.createTextNode(b.value);d.push(_),w.append(_);continue}const A=(t=b==null?void 0:b.attributes)!=null&&t.xmlns?document.createElementNS(b.attributes.xmlns,y):document.createElement(y);if(w.append(A),b.attributes&&this.setAttributes({html:A,element:b,storage:s,intent:o,linkService:a}),((e=b.children)==null?void 0:e.length)>0)p.push([b,-1,A]);else if(b.value){const _=document.createTextNode(b.value);h&&Au.shouldBuildText(y)&&d.push(_),A.append(_)}}for(const g of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:d}}static update(i){const t=`matrix(${i.viewport.transform.join(",")})`;i.div.style.transform=t,i.div.hidden=!1}};const Hs="http://www.w3.org/2000/svg";var Ba;let wo=(Ba=class{},S(Ba,"CSS",96),S(Ba,"PDF",72),S(Ba,"PDF_TO_CSS_UNITS",Ba.CSS/Ba.PDF),Ba);async function zb(i,t="text"){if(Wd(i,document.baseURI)){const e=await fetch(i);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,s)=>{const a=new XMLHttpRequest;a.open("GET",i,!0),a.responseType=t==="bytes"?"arraybuffer":t,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(t){case"bytes":e(new Uint8Array(a.response));return;case"blob":case"json":e(a.response);return}e(a.responseText);return}s(new Error(a.statusText))}},a.send(null)})}class Mu{constructor({viewBox:t,userUnit:e,scale:s,rotation:a,offsetX:r=0,offsetY:o=0,dontFlip:l=!1}){this.viewBox=t,this.userUnit=e,this.scale=s,this.rotation=a,this.offsetX=r,this.offsetY=o,s*=e;const h=(t[2]+t[0])/2,c=(t[3]+t[1])/2;let d,p,g,v;switch(a%=360,a<0&&(a+=360),a){case 180:d=-1,p=0,g=0,v=1;break;case 90:d=0,p=1,g=1,v=0;break;case 270:d=0,p=-1,g=-1,v=0;break;case 0:d=1,p=0,g=0,v=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(g=-g,v=-v);let w,b,y,A;
1d===0?(w=Math.abs(c-t[1])*s+r,b=Math.abs(h-t[0])*s+o,y=(t[3]-t[1])*s,A=(t[2]-t[0])*s):(w=Math.abs(h-t[0])*s+r,b=Math.abs(c-t[1])*s+o,y=(t[2]-t[0])*s,A=(t[3]-t[1])*s),this.transform=[d*s,p*s,g*s,v*s,w-d*s*h-g*s*c,b-p*s*h-v*s*c],this.width=y,this.height=A}get rawDims(){const t=this.viewBox;return G(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:s=this.offsetX,offsetY:a=this.offsetY,dontFlip:r=!1}={}){return new Mu({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:a,dontFlip:r})}convertToViewportPoint(t,e){const s=[t,e];return R.applyTransform(s,this.transform),s}convertToViewportRectangle(t){const e=[t[0],t[1]];R.applyTransform(e,this.transform);const s=[t[2],t[3]];return R.applyTransform(s,this.transform),[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){const s=[t,e];return R.applyInverseTransform(s,this.transform),s}}let Gb=class extends _o{constructor(i,t=0){super(i,"RenderingCancelledException"),this.extraDelay=t}};function Sm(i){const t=i.length;let e=0;for(;e<t&&i[e].trim()==="";)e++;return i.substring(e,e+5).toLowerCase()==="data:"}function Xb(i){return typeof i=="string"&&/\.pdf$/i.test(i)}function NE(i){return[i]=i.split(/[#?]/,1),Vv(i)}function FE(i,t="document.pdf"){if(typeof i!="string")return t;if(Sm(i))return Y('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const e=(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}}}}})(i);if(!e)return t;const s=o=>{try{let l=decodeURIComponent(o);return l.includes("/")&&(l=Vv(l),/^\.pdf$/i.test(l))?o:l}catch{return o}},a=/\.pdf$/i,r=Vv(e.pathname);if(a.test(r))return s(r);if(e.searchParams.size>0){const o=h=>[...h].findLast(c=>a.test(c)),l=o(e.searchParams.values())??o(e.searchParams.keys());if(l)return s(l)}if(e.hash){const o=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(e.hash);if(o)return s(o[0])}return t}var pr;class c0{constructor(){f(this,pr,new Map),S(this,"times",[])}time(t){n(this,pr).has(t)&&Y(`Timer is already running for ${t}`),n(this,pr).set(t,Date.now())}timeEnd(t){n(this,pr).has(t)||Y(`Timer has not been started for ${t}`),this.times.push({name:t,start:n(this,pr).get(t),end:Date.now()}),n(this,pr).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("")}}pr=new WeakMap;function Wd(i,t){const e=t?URL.parse(i,t):URL.parse(i);return/https?:/.test((e==null?void 0:e.protocol)??"")}function Bi(i){i.preventDefault()}function Pt(i){i.preventDefault(),i.stopPropagation()}function OE(i){console.log("Deprecated API usage: "+i)}var zm,Dh;let Xv=(zm=class{static toDateObject(i){if(i instanceof Date)return i;if(!i||typeof i!="string")return null;n(this,Dh)||u(this,Dh,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=n(this,Dh).exec(i);if(!t)return null;const e=parseInt(t[1],10);let s=parseInt(t[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(t[3],10);a=a>=1&&a<=31?a:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const h=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(t[9],10)||0;return d=d>=0&&d<=59?d:0,h==="-"?(r+=c,o+=d):h==="+"&&(r-=c,o-=d),new Date(Date.UTC(e,s,a,r,o,l))}},Dh=new WeakMap,f(zm,Dh),zm);function WE(i,{scale:t=1,rotation:e=0}){const{width:s,height:a}=i.attributes.style,r=[0,0,parseInt(s,10),parseInt(a,10)];return new Mu({viewBox:r,userUnit:1,scale:t,rotation:e})}function Yb(i){if(i.startsWith("#")){const e=i.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(i.startsWith("rgb(")){const[e,s,a]=i.slice(4,-1).split(",").map(r=>parseInt(r,10));return[e,s,a,1]}if(i.startsWith("rgba(")){const e=i.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}const t=i.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 Cu(i){const t=Yb(i);return t?t.slice(0,3):(Y(`Not a valid color format: "${i}"`),[0,0,0])}function BE(i){const t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(const e of i.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;i.set(e,Cu(s))}t.remove()}function vt(i){const{a:t,b:e,c:s,d:a,e:r,f:o}=i.getTransform();return[t,e,s,a,r,o]}function ls(i){const{a:t,b:e,c:s,d:a,e:r,f:o}=i.getTransform().invertSelf();return[t,e,s,a,r,o]}function bo(i,t,e=!1,s=!0){if(t instanceof Mu){const{pageWidth:a,pageHeight:r}=t.rawDims,{style:o}=i,l=Jt.isCSSRoundSupported,h=`var(--total-scale-factor) * ${a}px`,c=`var(--total-scale-factor) * ${r}px`,d=l?`round(down, ${h}, var(--scale-round-x))`:`calc(${h})`,p=l?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!e||t.rotation%180===0?(o.width=d,o.height=p):(o.width=p,o.height=d)}s&&i.setAttribute("data-main-rotation",t.rotation)}let yo=class Yv{constructor(){const{pixelRatio:t}=Yv;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,s,a,r=-1){let o=1/0,l=1/0,h=1/0;s=Yv.capPixels(s,r),s>
20&&(o=Math.sqrt(s/(t*e))),a!==-1&&(l=a/t,h=a/e);const c=Math.min(o,l,h);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){const s=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,s):s}return t}};const Kb=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class jE{static get isDarkMode(){var t;return G(this,"isDarkMode",!!((t=window==null?void 0:window.matchMedia)!=null&&t.call(window,"(prefers-color-scheme: dark)").matches))}}let $E=class{static get commentForegroundColor(){const i=document.createElement("span");i.classList.add("comment","sidebar");const{style:t}=i;t.width=t.height="0",t.display="none",t.color="var(--comment-fg-color)",document.body.append(i);const{color:e}=window.getComputedStyle(i);return i.remove(),G(this,"commentForegroundColor",Cu(e))}};function UE(i,t){t=xt(t??1,0,1);const e=255*(1-t);return i.map(s=>Math.round(s*t+e))}function d0(i,t){const e=i[0]/255,s=i[1]/255,a=i[2]/255,r=Math.max(e,s,a),o=Math.min(e,s,a),l=(r+o)/2;if(r===o)t[0]=t[1]=0;else{const h=r-o;switch(t[1]=l<.5?h/(r+o):h/(2-r-o),r){case e:t[0]=((s-a)/h+(s<a?6:0))*60;break;case s:t[0]=((a-e)/h+2)*60;break;case a:t[0]=((e-s)/h+4)*60;break}}t[2]=l}function Kv(i,t){const e=i[0],s=i[1],a=i[2],r=(1-Math.abs(2*a-1))*s,o=r*(1-Math.abs(e/60%2-1)),l=a-r/2;switch(Math.floor(e/60)){case 0:t[0]=r+l,t[1]=o+l,t[2]=l;break;case 1:t[0]=o+l,t[1]=r+l,t[2]=l;break;case 2:t[0]=l,t[1]=r+l,t[2]=o+l;break;case 3:t[0]=l,t[1]=o+l,t[2]=r+l;break;case 4:t[0]=o+l,t[1]=l,t[2]=r+l;break;case 5:case 6:t[0]=r+l,t[1]=l,t[2]=o+l;break}}function u0(i){return i<=.03928?i/12.92:((i+.055)/1.055)**2.4}function p0(i,t,e){Kv(i,e),e.map(u0);const s=.2126*e[0]+.7152*e[1]+.0722*e[2];Kv(t,e),e.map(u0);const a=.2126*e[0]+.7152*e[1]+.0722*e[2];return s>a?(s+.05)/(a+.05):(a+.05)/(s+.05)}const g0=new Map;function HE(i,t){const e=i[0]+i[1]*256+i[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776;let s=g0.get(e);if(s)return s;const a=new Float32Array(9),r=a.subarray(0,3),o=a.subarray(3,6);d0(i,o);const l=a.subarray(6,9);d0(t,l);const h=l[2]<.5,c=h?12:4.5;if(o[2]=h?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),p0(o,l,r)<c){let d,p;h?(d=o[2],p=1):(d=0,p=o[2]);const g=.005;for(;p-d>g;){const v=o[2]=(d+p)/2;h===p0(o,l,r)<c?d=v:p=v}o[2]=h?p:d}return Kv(o,r),s=R.makeHexColor(Math.round(r[0]*255),Math.round(r[1]*255),Math.round(r[2]*255)),g0.set(e,s),s}function AA({html:i,dir:t,className:e},s){const a=document.createDocumentFragment();if(typeof i=="string"){const r=document.createElement("p");r.dir=t||"auto";const o=i.split(/(?:\r\n?|\n)/);for(let l=0,h=o.length;l<h;++l){const c=o[l];r.append(document.createTextNode(c)),l<h-1&&r.append(document.createElement("br"))}a.append(r)}else yA.render({xfaHtml:i,div:a,intent:"richText"});a.firstElementChild.classList.add("richText",e),s.append(a)}function _A(i){const t=new Path2D;if(!i)return t;for(let e=0,s=i.length;e<s;)switch(i[e++]){case Ih.moveTo:t.moveTo(i[e++],i[e++]);break;case Ih.lineTo:t.lineTo(i[e++],i[e++]);break;case Ih.curveTo:t.bezierCurveTo(i[e++],i[e++],i[e++],i[e++],i[e++],i[e++]);break;case Ih.quadraticCurveTo:t.quadraticCurveTo(i[e++],i[e++],i[e++],i[e++]);break;case Ih.closePath:t.closePath();break;default:Y(`Unrecognized drawing path operator: ${i[e-1]}`);break}return t}var gr,fr,ss,Gi,Op,mr,kc,Sc,Bd,qv,EA,pi,f0,m0,Qo,Mc;const Qv=class Cc{constructor(t){f(this,pi),f(this,gr,null),f(this,fr,null),f(this,ss),f(this,Gi,null),f(this,Op,null),f(this,mr,null),f(this,kc,null),f(this,Sc,null),u(this,ss,t),n(Cc,Bd)||u(Cc,Bd,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=u(this,gr,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=n(this,ss)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Bi,{signal:e}),t.addEventListener("pointerdown",m(Cc,qv,EA),{signal:e}));const s=u(this,Gi,document.createElement("div"));s.className="buttons",t.append(s);const a=n(this,ss).toolbarPosition;if(a){const{style:r}=t,o=n(this,ss)._uiManager.direction==="ltr"?1-a[0]:a[0];r.insetInlineEnd=`${100*o}%`,r.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return n(this,gr)}hide(){var t;n(this,gr).classList.add("hidden"),(t=n(this,fr))==null||t.hideDropdown()}show(){var t,e;n(this,gr).classList.remove("hidden"),(t=n(this,Op))==null||t.shown(),(e=n(this,mr))==null||e.shown()}
2addDeleteButton(){const{editorType:t,_uiManager:e}=n(this,ss),s=document.createElement("button");s.classList.add("basic","deleteButton"),s.tabIndex=0,s.setAttribute("data-l10n-id",n(Cc,Bd)[t]),m(this,pi,Qo).call(this,s)&&s.addEventListener("click",a=>{e.delete()},{signal:e._signal}),n(this,Gi).append(s)}async addAltText(t){const e=await t.render();m(this,pi,Qo).call(this,e),n(this,Gi).append(e,n(this,pi,Mc)),u(this,Op,t)}addComment(t,e=null){if(n(this,mr))return;const s=t.renderForToolbar();if(!s)return;m(this,pi,Qo).call(this,s);const a=u(this,kc,n(this,pi,Mc));e?(n(this,Gi).insertBefore(s,e),n(this,Gi).insertBefore(a,e)):n(this,Gi).append(s,a),u(this,mr,t),t.toolbar=this}addColorPicker(t){if(n(this,fr))return;u(this,fr,t);const e=t.renderButton();m(this,pi,Qo).call(this,e),n(this,Gi).append(e,n(this,pi,Mc))}async addEditSignatureButton(t){const e=u(this,Sc,await t.renderEditButton(n(this,ss)));m(this,pi,Qo).call(this,e),n(this,Gi).append(e,n(this,pi,Mc))}removeButton(t){var e,s;switch(t){case"comment":(e=n(this,mr))==null||e.removeToolbarCommentButton(),u(this,mr,null),(s=n(this,kc))==null||s.remove(),u(this,kc,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,s){if(!e&&t==="comment")return;const a=n(this,Gi).querySelector(s);a&&t==="comment"&&this.addComment(e,a)}updateEditSignatureButton(t){n(this,Sc)&&(n(this,Sc).title=t)}remove(){var t;n(this,gr).remove(),(t=n(this,fr))==null||t.destroy(),u(this,fr,null)}};gr=new WeakMap,fr=new WeakMap,ss=new WeakMap,Gi=new WeakMap,Op=new WeakMap,mr=new WeakMap,kc=new WeakMap,Sc=new WeakMap,Bd=new WeakMap,qv=new WeakSet,EA=function(i){i.stopPropagation()},pi=new WeakSet,f0=function(i){n(this,ss)._focusEventsAllowed=!1,Pt(i)},m0=function(i){n(this,ss)._focusEventsAllowed=!0,Pt(i)},Qo=function(i){const t=n(this,ss)._uiManager._signal;return!(t instanceof AbortSignal)||t.aborted?!1:(i.addEventListener("focusin",m(this,pi,f0).bind(this),{capture:!0,signal:t}),i.addEventListener("focusout",m(this,pi,m0).bind(this),{capture:!0,signal:t}),i.addEventListener("contextmenu",Bi,{signal:t}),!0)},Mc=function(){const i=document.createElement("div");return i.className="divider",i},f(Qv,qv),f(Qv,Bd,null);let VE=Qv;var Wp,Zr,la,fh,xA,kA,Gm;class zE{constructor(t){f(this,fh),f(this,Wp,null),f(this,Zr,null),f(this,la),u(this,la,t)}show(t,e,s){const[a,r]=m(this,fh,kA).call(this,e,s),{style:o}=n(this,Zr)||u(this,Zr,m(this,fh,xA).call(this));t.append(n(this,Zr)),o.insetInlineEnd=`${100*a}%`,o.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){n(this,Zr).remove()}}Wp=new WeakMap,Zr=new WeakMap,la=new WeakMap,fh=new WeakSet,xA=function(){const i=u(this,Zr,document.createElement("div"));i.className="editToolbar",i.setAttribute("role","toolbar");const t=n(this,la)._signal;t instanceof AbortSignal&&!t.aborted&&i.addEventListener("contextmenu",Bi,{signal:t});const e=u(this,Wp,document.createElement("div"));return e.className="buttons",i.append(e),n(this,la).hasCommentManager()&&m(this,fh,Gm).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{n(this,la).commentSelection("floating_button")}),m(this,fh,Gm).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{n(this,la).highlightSelection("floating_button")}),i},kA=function(i,t){let e=0,s=0;for(const a of i){const r=a.y+a.height;if(r<e)continue;const o=a.x+(t?a.width:0);if(r>e){s=o,e=r;continue}t?o>s&&(s=o):o<s&&(s=o)}return[t?1-s:s,e]},Gm=function(i,t,e,s){const a=document.createElement("button");a.classList.add("basic",i),a.tabIndex=0,a.setAttribute("data-l10n-id",t);const r=document.createElement("span");a.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id",e);const o=n(this,la)._signal;o instanceof AbortSignal&&!o.aborted&&(a.addEventListener("contextmenu",Bi,{signal:o}
2),a.addEventListener("click",s,{signal:o})),n(this,Wp).append(a)};function SA(i,t,e){for(const s of e)t.addEventListener(s,i[s].bind(i))}var to,eo,jd,io;const Pc=class Ht{static initializeAndAddPointerId(t){(n(Ht,eo)||u(Ht,eo,new Set)).add(t)}static setPointer(t,e){n(Ht,to)||u(Ht,to,e),n(Ht,io)??u(Ht,io,t)}static setTimeStamp(t){u(Ht,jd,t)}static isSamePointerId(t){return n(Ht,to)===t}static isSamePointerIdOrRemove(t){var e;return n(Ht,to)===t?!0:((e=n(Ht,eo))==null||e.delete(t),!1)}static isSamePointerType(t){return n(Ht,io)===t}static isInitializedAndDifferentPointerType(t){return n(Ht,io)!==null&&!Ht.isSamePointerType(t)}static isSameTimeStamp(t){return n(Ht,jd)===t}static isUsingMultiplePointers(){var t;return((t=n(Ht,eo))==null?void 0:t.size)>=1}static clearPointerType(){u(Ht,io,null)}static clearPointerIds(){u(Ht,to,NaN),u(Ht,eo,null)}static clearTimeStamp(){u(Ht,jd,NaN)}};to=new WeakMap,eo=new WeakMap,jd=new WeakMap,io=new WeakMap,f(Pc,to,NaN),f(Pc,eo,null),f(Pc,jd,NaN),f(Pc,io,null);let Xe=Pc;var Jv;class GE{constructor(){f(this,Jv,0)}get id(){return`${yu}${jt(this,Jv)._++}`}}Jv=new WeakMap;var $d,Uf,ae,Tc,Bp;const MA=class{constructor(){f(this,Tc),f(this,$d,bA()),f(this,Uf,0),f(this,ae,null)}static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',e=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=t;const a=s.decode().then(()=>(e.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]===0));return G(this,"_isSVGFittingCanvas",a)}async getFromFile(t){const{lastModified:e,name:s,size:a,type:r}=t;return m(this,Tc,Bp).call(this,`${e}_${s}_${a}_${r}`,t)}async getFromUrl(t){return m(this,Tc,Bp).call(this,t,t)}async getFromBlob(t,e){const s=await e;return m(this,Tc,Bp).call(this,t,s)}async getFromId(t){n(this,ae)||u(this,ae,new Map);const e=n(this,ae).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:s}=e;return delete e.blobPromise,this.getFromBlob(e.id,s)}return this.getFromUrl(e.url)}getFromCanvas(t,e){n(this,ae)||u(this,ae,new Map);let s=n(this,ae).get(t);if(s!=null&&s.bitmap)return s.refCounter+=1,s;const a=new OffscreenCanvas(e.width,e.height);return a.getContext("2d").drawImage(e,0,0),s={bitmap:a.transferToImageBitmap(),id:`image_${n(this,$d)}_${jt(this,Uf)._++}`,refCounter:1,isSvg:!1},n(this,ae).set(t,s),n(this,ae).set(s.id,s),s}getSvgUrl(t){const e=n(this,ae).get(t);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(t){var e;n(this,ae)||u(this,ae,new Map);const s=n(this,ae).get(t);if(!s||(s.refCounter-=1,s.refCounter!==0))return;const{bitmap:a}=s;if(!s.url&&!s.file){const r=new OffscreenCanvas(a.width,a.height);r.getContext("bitmaprenderer").transferFromImageBitmap(a),s.blobPromise=r.convertToBlob()}(e=a.close)==null||e.call(a),s.bitmap=null}isValidId(t){return t.startsWith(`image_${n(this,$d)}_`)}};$d=new WeakMap,Uf=new WeakMap,ae=new WeakMap,Tc=new WeakSet,Bp=async function(i,t){n(this,ae)||u(this,ae,new Map);let e=n(this,ae).get(i);if(e===null)return null;if(e!=null&&e.bitmap)return e.refCounter+=1,e;try{e||(e={bitmap:null,id:`image_${n(this,$d)}_${jt(this,Uf)._++}`,refCounter:0,isSvg:!1});let s;if(typeof t=="string"?(e.url=t,s=await zb(t,"blob")):t instanceof File?s=e.file=t:t instanceof Blob&&(s=t),s.type==="image/svg+xml"){const a=MA._isSVGFittingCanvas,r=new FileReader,o=new Image,l=new Promise((h,c)=>{o.onload=()=>{e.bitmap=o,e.isSvg=!0,h()},r.onload=async()=>{const d=e.svgUrl=r.result;o.src=await a?`${d}#svgView(preserveAspectRatio(none))`:d},o.onerror=r.onerror=c});r.readAsDataURL(s),await l}else e.bitmap=await createImageBitmap(s);e.refCounter=1}catch(s){Y(s),e=null}return n(this,ae).set(i,e),e&&n(this,ae).set(e.id,e),e};let XE=MA;var Vt,vr,jp,At;class YE{constructor(t=128){f(this,Vt,[]),f(this,vr,!1),f(this,jp),f(this,At,-1),u(this,jp,t)}add({cmd:t,undo:e,post:s,mustExec:a,type:r=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(a&&t(),n(this,vr))return;const h={cmd:t,undo:e,post:s,type:r};if(n(this,At)===-1){n(this,Vt).length>0&&(n(this,Vt).length=0),u(this,At,0),n(this,Vt).push(h);return}if(o&&n(this,Vt)[n(this,At)].type===r){l&&(h.undo=n(this,Vt)[n(this,At)].undo),n(this,Vt)[n(this,At)]=h;return}const c=n(this,At)+1;c===n(this,jp)?n(this,Vt).splice(0,1):(u(this,At,c),c<n(this,Vt).length&&n(this,Vt).splice(c)),n(this,Vt).push(h)}undo(){if(n(this,At)===-1)return;u(this,vr,!0);const{undo:t,post:e}=n(this,Vt)[n(this,At)];t(),e==null||e(),u(this,vr,!1),u(this,At,n(this,At)-1)}redo(){if(n(this,At)<n(this,Vt).length-1){u(this,At,n(this,At)+1),u(this,vr,!0);const{cmd:t,post:e}=n(this,Vt)[n(this,At)];t(),e==null||e(),u(this,vr,!1)}}hasSomethingToUndo(){return n(this,At)!==-1}hasSomethingToRedo(){return n(this,At)<n(this,Vt).length-1}cleanType(t){if(n(this,At)!==-1){for(let e=n(this,At);e>=0;e--)if(n(this,Vt)[e].type!==t){n(this,Vt).splice(e+1,n(this,At)-e),u(this,At,e);return}n(this,Vt).length=0,u(this,At,-1)}}destroy(){u(this,Vt,null)}}Vt=new WeakMap,vr=new WeakMap,jp=new WeakMap,At=new WeakMap;var Zv,CA;class Pu{constructor(t){f(this,Zv),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=Jt.platform;for(const[s,a,r={}]of t)for(const o of s){const l=o.startsWith("mac+");e&&l?(this.callbacks.set(o.slice(4),{callback:a,options:r}),this.allKeys.add(o.split("+").at(-1))):!e&&!l&&(this.callbacks.set(o,{callback:a,options:r}),this.allKeys.add(o.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(m(this,Zv,CA).call(this,e));if(!s)return;const{callback:a,options:{bubbles:r=!1,args:o=[],checker:l=null}}=s;l&&!l(t,e)||(a.bind(t,...o,e)(),r||Pt(e))}}Zv=new WeakSet,CA=function(i){i.altKey&&this.buffer.push("alt"),i.ctrlKey&&this.buffer.push("ctrl"),i.metaKey&&this.buffer.push("meta"),i.shiftKey&&this.buffer.push("shift"),this.buffer.push(i.key);const t=this.buffer.join("+");return this.buffer.length=0,t};const PA=class TA{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return BE(t),G(this,"_colors",t)}convert(t){const e=Cu(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[s,a]of this._colors)if(a.every((r,o)=>r===e[o]))return TA._colorsMapping.get(s);return e}getHexCode(t){const e=this._colors.get(t);return e?R.makeHexColor(...e):t}};S(PA,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let KE=PA;
2var Lh,bi,ko,Rt,It,Rh,Nh,Ve,So,ji,ce,ja,$a,Ua,Ha,Fs,$i,Mo,Du,Lu,Fh,Ru,Os,Va,Oh,za,hs,Xm,Sn,Wh,Nu,Ga,Co,Bh,Mn,Fu,te,lt,Cn,Xa,Ya,jh,$h,Ou,Ka,Ws,Pn,Wu,Bu,Ui,Po,U,ju,Ym,v0,w0,b0,Uh,y0,A0,_0,Km,E0,x0,k0,S0,Fe,Bs,M0,C0,qm,P0,Hh,Qm;let _u=(Po=class{constructor(i,t,e,s,a,r,o,l,h,c,d,p,g,v,w,b){f(this,U),f(this,Lh,new AbortController),f(this,bi,null),f(this,ko,null),f(this,Rt,new Map),f(this,It,new Map),f(this,Rh,null),f(this,Nh,null),f(this,Ve,null),f(this,So,null),f(this,ji,new YE),f(this,ce,null),f(this,ja,null),f(this,$a,null),f(this,Ua,0),f(this,Ha,new Set),f(this,Fs,null),f(this,$i,null),f(this,Mo,new Set),S(this,"_editorUndoBar",null),f(this,Du,!1),f(this,Lu,!1),f(this,Fh,!1),f(this,Ru,null),f(this,Os,null),f(this,Va,null),f(this,Oh,null),f(this,za,!1),f(this,hs,null),f(this,Xm,new GE),f(this,Sn,!1),f(this,Wh,!1),f(this,Nu,!1),f(this,Ga,null),f(this,Co,null),f(this,Bh,null),f(this,Mn,null),f(this,Fu,null),f(this,te,V.NONE),f(this,lt,new Set),f(this,Cn,null),f(this,Xa,null),f(this,Ya,null),f(this,jh,null),f(this,$h,null),f(this,Ou,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),f(this,Ka,[0,0]),f(this,Ws,null),f(this,Pn,null),f(this,Wu,null),f(this,Bu,null),f(this,Ui,null);const y=this._signal=n(this,Lh).signal;u(this,Pn,i),u(this,Wu,t),u(this,Bu,e),u(this,Nh,s),u(this,ce,a),u(this,Xa,r),u(this,$h,l),this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:y}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:y}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:y}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:y}),o._on("setpreference",this.onSetPreference.bind(this),{signal:y}),o._on("switchannotationeditorparams",A=>this.updateParams(A.type,A.value),{signal:y}),window.addEventListener("pointerdown",()=>{u(this,Wh,!0)},{capture:!0,signal:y}),window.addEventListener("pointerup",()=>{u(this,Wh,!1)},{capture:!0,signal:y}),window.addEventListener("beforeunload",m(this,U,v0).bind(this),{capture:!0,signal:y}),m(this,U,y0).call(this),m(this,U,S0).call(this),m(this,U,Km).call(this),u(this,Ve,l.annotationStorage),u(this,Ru,l.filterFactory),u(this,Ya,h),u(this,Oh,c||null),u(this,Du,d),u(this,Lu,p),u(this,Fh,g),u(this,Fu,v||null),this.viewParameters={realScale:wo.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=w||null,this._supportsPinchToZoom=b!==!1,a==null||a.setSidebarUiManager(this)}static get _keyboardManager(){const i=Po.prototype,t=r=>n(r,Pn).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&r.hasSomethingToControl(),e=(r,{target:o})=>{if(o instanceof HTMLInputElement){const{type:l}=o;return l!=="text"&&l!=="number"}return!0},s=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return G(this,"_keyboardManager",new Pu([[["ctrl+a","mac+meta+a"],i.selectAll,{checker:e}],[["ctrl+z","mac+meta+z"],i.undo,{checker:e}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],i.redo,{checker:e}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],i.delete,{checker:e}],[["Enter","mac+Enter"],i.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&n(r,Pn).contains(o)&&!r.isEnterHandled}],[[" ","mac+ "],i.addNewEditorFromKeyboard,{checker:(r,{target:o})=>!(o instanceof HTMLButtonElement)&&n(r,Pn).contains(document.activeElement)}],[["Escape","mac+Escape"],i.unselectAll],[["ArrowLeft","mac+ArrowLeft"],i.translateSelectedEditors,{args:[-s,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],i.translateSelectedEditors,{args:[-a,0],checker:t}],[["ArrowRight","mac+ArrowRight"],i.translateSelectedEditors,{args:[s,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],i.translateSelectedEditors,{args:[a,0],checker:t}],[["ArrowUp","mac+ArrowUp"],i.translateSelectedEditors,{args:[0,-s],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],i.translateSelectedEditors,{args:[0,-a],checker:t}],[["ArrowDown","mac+ArrowDown"],i.translateSelectedEditors,{args:[0,s],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],i.translateSelectedEditors,{args:[0,a],checker:t}]]))}destroy(){var i,t,e,s,a,r,o,l,h;(i=n(this,Ui))==null||i.resolve(),u(this,Ui,null),(t=n(this,Lh))==null||t.abort(),u(this,Lh,null),this._signal=null;for(const c of n(this,It).values())c.destroy();n(this,It).clear(),n(this,Rt).clear(),n(this,Mo).clear(),(e=n(this,Mn))==null||e.clear(),u(this,bi,null),n(this,lt).clear(),n(this,ji).destroy(),(s=n(this,Nh))==null||s.destroy(),(a=n(this,ce))==null||a.destroy(),(r=n(this,Xa))==null||r.destroy(),(o=n(this,hs))==null||o.hide(),u(this,hs,null),(l=n(this,Bh))==null||l.destroy(),u(this,Bh,null),u(this,ko,null),n(this,Os)&&(clearTimeout(n(this,Os)),u(this,Os,null)),n(this,Ws)&&(clearTimeout(n(this,Ws)),u(this,Ws,null)),(h=this._editorUndoBar)==null||h.destroy(),u(this,$h,null)}combinedSignal(i){return AbortSignal.any([this._signal,i.signal])}get mlManager(){return n(this,Fu)}get useNewAltTextFlow(){return n(this,Lu)}get useNewAltTextWhenAddingImage(){return n(this,Fh)}get hcmFilter(){return G(this,"hcmFilter",n(this,Ya)?n(this,Ru).addHCMFilter(n(this,Ya).foreground,n(this,Ya).background):"none")}get direction(){return G(this,"direction",getComputedStyle(n(this,Pn)).direction)}get _highlightColors(){return G(this,"_highlightColors",n(this,Oh)?new Map(n(this,Oh).split(",").map(i=>(i=i.split("=").map(t=>t.trim()),i[1]=i[1].toUpperCase(),i))):null)}get highlightColors(){const{_highlightColors:i}=this;if(!i)return G(this,"highlightColors",null);const t=new Map,e=!!n(this,Ya);for(const[s,a]of i){const r=s.endsWith("_HCM");if(e&&r){t.set(s.replace("_HCM",""),a);continue}!e&&!r&&t.set(s,a)}return G(this,"highlightColors",t)}get highlightColorNames(){return G(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,i=>i.reverse())):null)}getNonHCMColor(i){if(!this._highlightColors)return i;const t=this.highlightColorNames.get(i);return this._highlightColors.get(t)||i}getNonHCMColorName(i){return this.highlightColorNames.get(i)||i}setCurrentDrawingSession(i){i?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),u(this,$a,i)}setMainHighlightColorPicker(i){u(this,Bh,i)}editAltText(i,t=!1){var e;(e=n(this,Nh))==null||e.editAltText(this,i,t)}hasCommentManager(){return!!n(this,ce)}editComment(i,t,e,s){var a;(a=n(this,ce))==null||a.showDialog(this,i,t,e,s)}selectComment(i,t){const e=n(this,It).get(i),s=e==null?void 0:e.getEditorByUID(t);s==null||s.toggleComment(!0,!0)}updateComment(i){var t;(t=n(this,ce))==null||t.updateComment(i.getData())}updatePopupColor(i){var t;(t=n(this,ce))==null||t.updatePopupColor(i)}
2removeComment(i){var t;(t=n(this,ce))==null||t.removeComments([i.uid])}deleteComment(i,t){const e=()=>{i.comment=t},s=()=>{var a;(a=this._editorUndoBar)==null||a.show(e,"comment"),this.toggleComment(null),i.comment=null};this.addCommands({cmd:s,undo:e,mustExec:!0})}toggleComment(i,t,e=void 0){var s;(s=n(this,ce))==null||s.toggleCommentPopup(i,t,e)}makeCommentColor(i,t){var e;return i&&((e=n(this,ce))==null?void 0:e.makeCommentColor(i,t))||null}getCommentDialogElement(){var i;return((i=n(this,ce))==null?void 0:i.dialogElement)||null}async waitForEditorsRendered(i){if(n(this,It).has(i-1))return;const{resolve:t,promise:e}=Promise.withResolvers(),s=a=>{a.pageNumber===i&&(this._eventBus._off("editorsrendered",s),t())};this._eventBus.on("editorsrendered",s),await e}getSignature(i){var t;(t=n(this,Xa))==null||t.getSignature({uiManager:this,editor:i})}get signatureManager(){return n(this,Xa)}switchToMode(i,t){this._eventBus.on("annotationeditormodechanged",t,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:i})}setPreference(i,t){this._eventBus.dispatch("setpreference",{source:this,name:i,value:t})}onSetPreference({name:i,value:t}){switch(i){case"enableNewAltTextWhenAddingImage":u(this,Fh,t);break}}onPageChanging({pageNumber:i}){u(this,Ua,i-1)}deletePage(i){for(const t of this.getEditors(i))t.remove();n(this,It).delete(i),n(this,Ua)===i&&u(this,Ua,0)}focusMainContainer(){n(this,Pn).focus()}findParent(i,t){for(const e of n(this,It).values()){const{x:s,y:a,width:r,height:o}=e.div.getBoundingClientRect();if(i>=s&&i<=s+r&&t>=a&&t<=a+o)return e}return null}disableUserSelect(i=!1){n(this,Wu).classList.toggle("noUserSelect",i)}addShouldRescale(i){n(this,Mo).add(i)}removeShouldRescale(i){n(this,Mo).delete(i)}onScaleChanging({scale:i}){var t;this.commitOrRemove(),this.viewParameters.realScale=i*wo.PDF_TO_CSS_UNITS;for(const e of n(this,Mo))e.onScaleChanging();(t=n(this,$a))==null||t.onScaleChanging()}onRotationChanging({pagesRotation:i}){this.commitOrRemove(),this.viewParameters.rotation=i}highlightSelection(i="",t=!1){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:o}=e,l=e.toString(),h=m(this,U,ju).call(this,e).closest(".textLayer"),c=this.getSelectionBoxes(h);if(!c)return;e.empty();const d=m(this,U,Ym).call(this,h),p=n(this,te)===V.NONE,g=()=>{const v=d==null?void 0:d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:i,boxes:c,anchorNode:s,anchorOffset:a,focusNode:r,focusOffset:o,text:l});p&&this.showAllEditors("highlight",!0,!0),t&&(v==null||v.editComment())};if(p){this.switchToMode(V.HIGHLIGHT,g);return}g()}commentSelection(i=""){this.highlightSelection(i,!0)}getAndRemoveDataFromAnnotationStorage(i){if(!n(this,Ve))return null;const t=`${yu}${i}`,e=n(this,Ve).getRawValue(t);return e&&n(this,Ve).remove(t),e}addToAnnotationStorage(i){!i.isEmpty()&&n(this,Ve)&&!n(this,Ve).has(i.id)&&n(this,Ve).setValue(i.id,i)}a11yAlert(i,t=null){const e=n(this,Bu);e&&(e.setAttribute("data-l10n-id",i),t?e.setAttribute("data-l10n-args",JSON.stringify(t)):e.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,n(this,za)&&(u(this,za,!1),m(this,U,Uh).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:i}=document;for(const t of n(this,lt))if(t.div.contains(i)){u(this,Co,[t,i]),t._focusEventsAllowed=!1;break}}focus(){if(!n(this,Co))return;const[i,t]=n(this,Co);u(this,Co,null),t.addEventListener("focusin",()=>{i._focusEventsAllowed=!0},{once:!0,signal:this._signal}),t.focus()}addEditListeners(){m(this,U,Km).call(this),this.setEditingState(!0)}removeEditListeners(){m(this,U,E0).call(this),this.setEditingState(!1)}dragOver(i){for(const{type:t}of i.dataTransfer.items)for(const e of n(this,$i))if(e.isHandlingMimeForPasting(t)){i.dataTransfer.dropEffect="copy",i.preventDefault();return}}drop(i){for(const t of i.dataTransfer.items)for(const e of n(this,$i))if(e.isHandlingMimeForPasting(t.type)){e.paste(t,this.currentLayer),i.preventDefault();return}}copy(i){var t;if(i.preventDefault(),(t=n(this,bi))==null||t.commitOrRemove(),!this.hasSelection)return;const e=[];for(const s of n(this,lt)){const a=s.serialize(!0);a&&e.push(a)}e.length!==0&&i.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(i){this.copy(i),this.delete()}async paste(i){i.preventDefault();const{clipboardData:t}=i;for(const a of t.items)for(const r of n(this,$i))if(r.isHandlingMimeForPasting(a.type)){r.paste(a,this.currentLayer);return}let e=t.getData("application/pdfjs");if(!e)return;try{e=JSON.parse(e)}catch(a){Y(`paste: "${a.message}".`);return}if(!Array.isArray(e))return;this.unselectAll();const s=this.currentLayer;try{const a=[];for(const l of e){const h=await s.deserialize(l);if(!h)return;a.push(h)}const r=()=>{for(const l of a)m(this,U,qm).call(this,l);m(this,U,Qm).call(this,a)},o=()=>{for(const l of a)l.remove()};this.addCommands({cmd:r,undo:o,mustExec:!0})}catch(a){Y(`paste: "${a.message}".`)}}keydown(i){!this.isShiftKeyDown&&i.key==="Shift"&&(this.isShiftKeyDown=!0),n(this,te)!==V.NONE&&!this.isEditorHandlingKeyboard&&Po._keyboardManager.exec(this,i)}keyup(i){this.isShiftKeyDown&&i.key==="Shift"&&(this.isShiftKeyDown=!1,n(this,za)&&(u(this,za,!1),m(this,U,Uh).call(this,"main_toolbar")))}onEditingAction({name:i}){switch(i){case"undo":case"redo":case"delete":case"selectAll":this[i]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(i,t){for(const s of this.getEditors(i))s.pageIndex=t;const e=n(this,Rh).get(i);e&&(e.pageIndex=t,n(this,It).set(t,e),n(this,Sn)?e.enable():e.disable())}startUpdatePages(){u(this,Rh,new Map(n(this,It))),n(this,It).clear()}endUpdatePages(){u(this,Rh,null)}clonePage(i,t){for(const e of this.getEditors(i)){const s=e.serialize(e.mode!==V.HIGHLIGHT);s&&(s.pageIndex=t,s.id=this.getId(),s.isClone=!0,delete s.popupRef,n(this,Ve).setValue(s.id,s))}}findClonesForPage(i){const t=[],{pageIndex:e}=i;for(const[s,a]of n(this,Ve))a.pageIndex===e&&a.isClone&&(n(this,Ve).remove(s),t.push(i.deserialize(a).then(r=>{r&&(r.isClone=!0,i.addOrRebuild(r))})));return Promise.all(t)}setEditingState(i){i?(m(this,U,A0).call(this),m(this,U,x0).call(this),m(this,U,Fe).call(this,{isEditing:n(this,te)!==V.NONE,isEmpty:m(this,U,Hh).call(this),hasSomethingToUndo:n(this,ji).hasSomethingToUndo(),hasSomethingToRedo:n(this,ji).hasSomethingToRedo(),hasSelectedEditor:!1})):(m(this,U,_0).call(this),m(this,U,k0).call(this),m(this,U,Fe).call(this,{isEditing:!1}),this.disableUserSelect(!1))}
2registerEditorTypes(i){if(!n(this,$i)){u(this,$i,i);for(const t of n(this,$i))m(this,U,Bs).call(this,t.defaultPropertiesToUpdate)}}getId(){return n(this,Xm).id}get currentLayer(){return n(this,It).get(n(this,Ua))}getLayer(i){return n(this,It).get(i)}get currentPageIndex(){return n(this,Ua)}addLayer(i){n(this,It).set(i.pageIndex,i),n(this,Sn)?i.enable():i.disable()}removeLayer(i){n(this,It).delete(i.pageIndex)}async updateMode(i,t=null,e=!1,s=!1,a=!1,r=!1){var o,l,h,c,d,p;if(n(this,te)!==i&&!(n(this,Ui)&&(await n(this,Ui).promise,!n(this,Ui)))){if(u(this,Ui,Promise.withResolvers()),(o=n(this,$a))==null||o.commitOrRemove(),n(this,te)===V.POPUP&&((l=n(this,ce))==null||l.hideSidebar()),(h=n(this,ce))==null||h.destroyPopup(),u(this,te,i),i===V.NONE){this.setEditingState(!1),m(this,U,C0).call(this);for(const g of n(this,Rt).values())g.hideStandaloneCommentButton();(c=this._editorUndoBar)==null||c.hide(),this.toggleComment(null),n(this,Ui).resolve();return}for(const g of n(this,Rt).values())g.addStandaloneCommentButton();i===V.SIGNATURE&&await((d=n(this,Xa))==null?void 0:d.loadSignatures()),e&&Xe.clearPointerType(),this.setEditingState(!0),await m(this,U,M0).call(this),this.unselectAll();for(const g of n(this,It).values())g.updateMode(i);if(i===V.POPUP){n(this,ko)||u(this,ko,await n(this,$h).getAnnotationsByType(new Set(n(this,$i).map(w=>w._editorType))));const g=new Set,v=[];for(const w of n(this,Rt).values()){const{annotationElementId:b,hasComment:y,deleted:A}=w;b&&g.add(b),y&&!A&&v.push(w.getData())}for(const w of n(this,ko)){const{id:b,popupRef:y,contentsObj:A}=w;y&&A!=null&&A.str&&!g.has(b)&&!n(this,Ha).has(b)&&v.push(w)}(p=n(this,ce))==null||p.showSidebar(v)}if(!t){s&&this.addNewEditorFromKeyboard(),n(this,Ui).resolve();return}for(const g of n(this,Rt).values())g.uid===t?(this.setSelected(g),r?g.editComment():a?g.enterInEditMode():g.focus()):g.unselect();n(this,Ui).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(i){i.mode!==n(this,te)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...i})}updateParams(i,t){if(n(this,$i)){switch(i){case K.CREATE:this.currentLayer.addNewEditor(t);return;case K.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(n(this,jh)||u(this,jh,new Map)).set(i,t),this.showAllEditors("highlight",t);break}if(this.hasSelection)for(const e of n(this,lt))e.updateParams(i,t);else for(const e of n(this,$i))e.updateDefaultParams(i,t)}}showAllEditors(i,t,e=!1){var s;for(const a of n(this,Rt).values())a.editorType===i&&a.show(t);(((s=n(this,jh))==null?void 0:s.get(K.HIGHLIGHT_SHOW_ALL))??!0)!==t&&m(this,U,Bs).call(this,[[K.HIGHLIGHT_SHOW_ALL,t]])}enableWaiting(i=!1){if(n(this,Nu)!==i){u(this,Nu,i);for(const t of n(this,It).values())i?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",i)}}*getEditors(i){for(const t of n(this,Rt).values())t.pageIndex===i&&(yield t)}getEditor(i){return n(this,Rt).get(i)}addEditor(i){n(this,Rt).set(i.id,i)}removeEditor(i){var t,e;i.div.contains(document.activeElement)&&(n(this,Os)&&clearTimeout(n(this,Os)),u(this,Os,setTimeout(()=>{this.focusMainContainer(),u(this,Os,null)},0))),n(this,Rt).delete(i.id),i.annotationElementId&&((t=n(this,Mn))==null||t.delete(i.annotationElementId)),this.unselect(i),(!i.annotationElementId||!n(this,Ha).has(i.annotationElementId))&&((e=n(this,Ve))==null||e.remove(i.id))}addDeletedAnnotationElement(i){n(this,Ha).add(i.annotationElementId),this.addChangedExistingAnnotation(i),i.deleted=!0}isDeletedAnnotationElement(i){return n(this,Ha).has(i)}removeDeletedAnnotationElement(i){n(this,Ha).delete(i.annotationElementId),this.removeChangedExistingAnnotation(i),i.deleted=!1}setActiveEditor(i){n(this,bi)!==i&&(u(this,bi,i),i&&m(this,U,Bs).call(this,i.propertiesToUpdate))}updateUI(i){n(this,U,P0)===i&&m(this,U,Bs).call(this,i.propertiesToUpdate)}updateUIForDefaultProperties(i){m(this,U,Bs).call(this,i.defaultPropertiesToUpdate)}toggleSelected(i){if(n(this,lt).has(i)){n(this,lt).delete(i),i.unselect(),m(this,U,Fe).call(this,{hasSelectedEditor:this.hasSelection});return}n(this,lt).add(i),i.select(),m(this,U,Bs).call(this,i.propertiesToUpdate),m(this,U,Fe).call(this,{hasSelectedEditor:!0})}setSelected(i){var t,e;this.updateToolbar({mode:i.mode,editId:i.uid}),(t=n(this,$a))==null||t.commitOrRemove();for(const s of n(this,lt))s!==i&&s.unselect();(e=n(this,ce))==null||e.destroyPopup(),n(this,lt).clear(),n(this,lt).add(i),i.select(),m(this,U,Bs).call(this,i.propertiesToUpdate),m(this,U,Fe).call(this,{hasSelectedEditor:!0})}isSelected(i){return n(this,lt).has(i)}get firstSelectedEditor(){return n(this,lt).values().next().value}unselect(i){i.unselect(),n(this,lt).delete(i),m(this,U,Fe).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return n(this,lt).size!==0}get isEnterHandled(){return n(this,lt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var i;n(this,ji).undo(),m(this,U,Fe).call(this,{hasSomethingToUndo:n(this,ji).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:m(this,U,Hh).call(this)}),(i=this._editorUndoBar)==null||i.hide()}redo(){n(this,ji).redo(),m(this,U,Fe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:n(this,ji).hasSomethingToRedo(),isEmpty:m(this,U,Hh).call(this)})}addCommands(i){n(this,ji).add(i),m(this,U,Fe).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:m(this,U,Hh).call(this)})}cleanUndoStack(i){n(this,ji).cleanType(i)}delete(){var i;this.commitOrRemove();const t=(i=this.currentLayer)==null?void 0:i.endDrawingSession(!0);if(!this.hasSelection&&!t)return;const e=t?[t]:[...n(this,lt)],s=()=>{var r;(r=this._editorUndoBar)==null||r.show(a,e.length===1?e[0].editorType:e.length);for(const o of e)o.remove()},a=()=>{for(const r of e)m(this,U,qm).call(this,r)};this.addCommands({cmd:s,undo:a,mustExec:!0})}commitOrRemove(){var i;(i=n(this,bi))==null||i.commitOrRemove()}hasSomethingToControl(){return n(this,bi)||this.hasSelection}selectAll(){for(const i of n(this,lt))i.commit();m(this,U,Qm).call(this,n(this,Rt).values())}unselectAll(){var i,t;if(!(n(this,bi)&&(n(this,bi).commitOrRemove(),n(this,te)!==V.NONE))&&!((i=n(this,$a))!=null&&i.commitOrRemove())&&((t=n(this,ce))==null||t.destroyPopup(),!!this.hasSelection)){for(const e of n(this,lt))e.unselect();n(this,lt).clear(),m(this,U,Fe).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(i,t,e=!1){if(e||this.commitOrRemove(),!this.hasSelection)return;n(this,Ka)[0]+=i,n(this,Ka)[1]+=t;const[s,a]=n(this,Ka),r=[...n(this,lt)];n(this,Ws)&&clearTimeout(n(this,Ws)),u(this,Ws,setTimeout(()=>{u(this,Ws,null),n(this,Ka)[0]=n(this,Ka)[1]=0,this.addCommands({cmd:()=>{for(const l of r)n(this,Rt).has(l.id)&&(l.translateInPage(s,a),l.translationDone())},undo:()=>{for(const l of r)n(this,Rt).has(l.id)&&(l.translateInPage(-s,-a
2),l.translationDone())},mustExec:!1})},1e3));for(const l of r)l.translateInPage(i,t),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),u(this,Fs,new Map);for(const i of n(this,lt))n(this,Fs).set(i,{savedX:i.x,savedY:i.y,savedPageIndex:i.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!n(this,Fs))return!1;this.disableUserSelect(!1);const i=n(this,Fs);u(this,Fs,null);let t=!1;for(const[{x:s,y:a,pageIndex:r},o]of i)o.newX=s,o.newY=a,o.newPageIndex=r,t||(t=s!==o.savedX||a!==o.savedY||r!==o.savedPageIndex);if(!t)return!1;const e=(s,a,r,o)=>{if(n(this,Rt).has(s.id)){const l=n(this,It).get(o);l?s._setParentAndPosition(l,a,r):(s.pageIndex=o,s.x=a,s.y=r)}};return this.addCommands({cmd:()=>{for(const[s,{newX:a,newY:r,newPageIndex:o}]of i)e(s,a,r,o)},undo:()=>{for(const[s,{savedX:a,savedY:r,savedPageIndex:o}]of i)e(s,a,r,o)},mustExec:!0}),!0}dragSelectedEditors(i,t){if(n(this,Fs))for(const e of n(this,Fs).keys())e.drag(i,t)}rebuild(i){if(i.parent===null){const t=this.getLayer(i.pageIndex);t?(t.changeParent(i),t.addOrRebuild(i)):(this.addEditor(i),this.addToAnnotationStorage(i),i.rebuild())}else i.parent.addOrRebuild(i)}get isEditorHandlingKeyboard(){var i;return((i=this.getActive())==null?void 0:i.shouldGetKeyboardEvents())||n(this,lt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(i){return n(this,bi)===i}getActive(){return n(this,bi)}getMode(){return n(this,te)}isEditingMode(){return n(this,te)!==V.NONE}get imageManager(){return G(this,"imageManager",new XE)}getSelectionBoxes(i){if(!i)return null;const t=document.getSelection();for(let h=0,c=t.rangeCount;h<c;h++)if(!i.contains(t.getRangeAt(h).commonAncestorContainer))return null;const{x:e,y:s,width:a,height:r}=i.getBoundingClientRect();let o;switch(i.getAttribute("data-main-rotation")){case"90":o=(h,c,d,p)=>({x:(c-s)/r,y:1-(h+d-e)/a,width:p/r,height:d/a});break;case"180":o=(h,c,d,p)=>({x:1-(h+d-e)/a,y:1-(c+p-s)/r,width:d/a,height:p/r});break;case"270":o=(h,c,d,p)=>({x:1-(c+p-s)/r,y:(h-e)/a,width:p/r,height:d/a});break;default:o=(h,c,d,p)=>({x:(h-e)/a,y:(c-s)/r,width:d/a,height:p/r});break}const l=[];for(let h=0,c=t.rangeCount;h<c;h++){const d=t.getRangeAt(h);if(!d.collapsed)for(const{x:p,y:g,width:v,height:w}of d.getClientRects())v===0||w===0||l.push(o(p,g,v,w))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:i,id:t}){(n(this,So)||u(this,So,new Map)).set(i,t)}removeChangedExistingAnnotation({annotationElementId:i}){var t;(t=n(this,So))==null||t.delete(i)}renderAnnotationElement(i){var t;const e=(t=n(this,So))==null?void 0:t.get(i.data.id);if(!e)return;const s=n(this,Ve).getRawValue(e);s&&(n(this,te)===V.NONE&&!s.hasBeenModified||s.renderAnnotationElement(i))}setMissingCanvas(i,t,e){var s;const a=(s=n(this,Mn))==null?void 0:s.get(i);a&&(a.setCanvas(t,e),n(this,Mn).delete(i))}addMissingCanvas(i,t){(n(this,Mn)||u(this,Mn,new Map)).set(i,t)}},Lh=new WeakMap,bi=new WeakMap,ko=new WeakMap,Rt=new WeakMap,It=new WeakMap,Rh=new WeakMap,Nh=new WeakMap,Ve=new WeakMap,So=new WeakMap,ji=new WeakMap,ce=new WeakMap,ja=new WeakMap,$a=new WeakMap,Ua=new WeakMap,Ha=new WeakMap,Fs=new WeakMap,$i=new WeakMap,Mo=new WeakMap,Du=new WeakMap,Lu=new WeakMap,Fh=new WeakMap,Ru=new WeakMap,Os=new WeakMap,Va=new WeakMap,Oh=new WeakMap,za=new WeakMap,hs=new WeakMap,Xm=new WeakMap,Sn=new WeakMap,Wh=new WeakMap,Nu=new WeakMap,Ga=new WeakMap,Co=new WeakMap,Bh=new WeakMap,Mn=new WeakMap,Fu=new WeakMap,te=new WeakMap,lt=new WeakMap,Cn=new WeakMap,Xa=new WeakMap,Ya=new WeakMap,jh=new WeakMap,$h=new WeakMap,Ou=new WeakMap,Ka=new WeakMap,Ws=new WeakMap,Pn=new WeakMap,Wu=new WeakMap,Bu=new WeakMap,Ui=new WeakMap,U=new WeakSet,ju=function({anchorNode:i}){return i.nodeType===Node.TEXT_NODE?i.parentElement:i},Ym=function(i){const{currentLayer:t}=this;if(t.hasTextLayer(i))return t;for(const e of n(this,It).values())if(e.hasTextLayer(i))return e;return null},v0=function(i){var t;this.commitOrRemove(),(t=this.currentLayer)==null||t.endDrawingSession(!1)},w0=function(){const i=document.getSelection();if(!i||i.isCollapsed)return;const t=m(this,U,ju).call(this,i).closest(".textLayer"),e=this.getSelectionBoxes(t);e&&(n(this,hs)||u(this,hs,new zE(this)),n(this,hs).show(t,e,this.direction==="ltr"))},b0=function(){var i,t,e;const s=document.getSelection();if(!s||s.isCollapsed){n(this,Cn)&&((i=n(this,hs))==null||i.hide(),u(this,Cn,null),m(this,U,Fe).call(this,{hasSelectedText:!1}));return}const{anchorNode:a}=s;
2if(a===n(this,Cn))return;const r=m(this,U,ju).call(this,s).closest(".textLayer");if(!r){n(this,Cn)&&((t=n(this,hs))==null||t.hide(),u(this,Cn,null),m(this,U,Fe).call(this,{hasSelectedText:!1}));return}if((e=n(this,hs))==null||e.hide(),u(this,Cn,a),m(this,U,Fe).call(this,{hasSelectedText:!0}),!(n(this,te)!==V.HIGHLIGHT&&n(this,te)!==V.NONE)&&(n(this,te)===V.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),u(this,za,this.isShiftKeyDown),!this.isShiftKeyDown)){const o=n(this,te)===V.HIGHLIGHT?m(this,U,Ym).call(this,r):null;if(o==null||o.toggleDrawing(),n(this,Wh)){const l=new AbortController,h=this.combinedSignal(l),c=d=>{d.type==="pointerup"&&d.button!==0||(l.abort(),o==null||o.toggleDrawing(!0),d.type==="pointerup"&&m(this,U,Uh).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:h}),window.addEventListener("blur",c,{signal:h})}else o==null||o.toggleDrawing(!0),m(this,U,Uh).call(this,"main_toolbar")}},Uh=function(i=""){n(this,te)===V.HIGHLIGHT?this.highlightSelection(i):n(this,Du)&&m(this,U,w0).call(this)},y0=function(){document.addEventListener("selectionchange",m(this,U,b0).bind(this),{signal:this._signal})},A0=function(){if(n(this,Va))return;u(this,Va,new AbortController);const i=this.combinedSignal(n(this,Va));window.addEventListener("focus",this.focus.bind(this),{signal:i}),window.addEventListener("blur",this.blur.bind(this),{signal:i})},_0=function(){var i;(i=n(this,Va))==null||i.abort(),u(this,Va,null)},Km=function(){if(n(this,Ga))return;u(this,Ga,new AbortController);const i=this.combinedSignal(n(this,Ga));window.addEventListener("keydown",this.keydown.bind(this),{signal:i}),window.addEventListener("keyup",this.keyup.bind(this),{signal:i})},E0=function(){var i;(i=n(this,Ga))==null||i.abort(),u(this,Ga,null)},x0=function(){if(n(this,ja))return;u(this,ja,new AbortController);const i=this.combinedSignal(n(this,ja));document.addEventListener("copy",this.copy.bind(this),{signal:i}),document.addEventListener("cut",this.cut.bind(this),{signal:i}),document.addEventListener("paste",this.paste.bind(this),{signal:i})},k0=function(){var i;(i=n(this,ja))==null||i.abort(),u(this,ja,null)},S0=function(){const i=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:i}),document.addEventListener("drop",this.drop.bind(this),{signal:i})},Fe=function(i){Object.entries(i).some(([t,e])=>n(this,Ou)[t]!==e)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(n(this,Ou),i)}),n(this,te)===V.HIGHLIGHT&&i.hasSelectedEditor===!1&&m(this,U,Bs).call(this,[[K.HIGHLIGHT_FREE,!0]]))},Bs=function(i){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:i})},M0=async function(){if(!n(this,Sn)){u(this,Sn,!0);const i=[];for(const t of n(this,It).values())i.push(t.enable());await Promise.all(i);for(const t of n(this,Rt).values())t.enable()}},C0=function(){if(this.unselectAll(),n(this,Sn)){u(this,Sn,!1);for(const i of n(this,It).values())i.disable();for(const i of n(this,Rt).values())i.disable()}},qm=function(i){const t=n(this,It).get(i.pageIndex);t?t.addOrRebuild(i):(this.addEditor(i),this.addToAnnotationStorage(i))},P0=function(){let i=null;for(i of n(this,lt));return i},Hh=function(){if(n(this,Rt).size===0)return!0;if(n(this,Rt).size===1)for(const i of n(this,Rt).values())return i.isEmpty();return!1},Qm=function(i){for(const t of n(this,lt))t.unselect();n(this,lt).clear();for(const t of i)t.isEmpty()||(n(this,lt).add(t),t.select());m(this,U,Fe).call(this,{hasSelectedEditor:this.hasSelection})},S(Po,"TRANSLATE_SMALL",1),S(Po,"TRANSLATE_BIG",10),Po);var ye,pn,xs,Ud,rn,Di,Ic,Vs,fi,$n,Jo,on,Ca,gn,Hd,$p;const Dc=class Un{constructor(t){f(this,gn),f(this,ye,null),f(this,pn,!1),f(this,xs,null),f(this,Ud,null),f(this,rn,null),f(this,Di,null),f(this,Ic,!1),f(this,Vs,null),f(this,fi,null),f(this,$n,null),f(this,Jo,null),f(this,on,!1),u(this,fi,t),u(this,on,t._uiManager.useNewAltTextFlow),n(Un,Ca)||u(Un,Ca,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){Un._l10n??(Un._l10n=t)}async render(){const t=u(this,xs,document.createElement("button"));t.className="altText",t.tabIndex="0";
2const e=u(this,Ud,document.createElement("span"));t.append(e),n(this,on)?(t.classList.add("new"),t.setAttribute("data-l10n-id",n(Un,Ca).missing),e.setAttribute("data-l10n-id",n(Un,Ca)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=n(this,fi)._uiManager._signal;t.addEventListener("contextmenu",Bi,{signal:s}),t.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:s});const a=r=>{r.preventDefault(),n(this,fi)._uiManager.editAltText(n(this,fi)),n(this,on)&&n(this,fi)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:n(this,gn,Hd)}})};return t.addEventListener("click",a,{capture:!0,signal:s}),t.addEventListener("keydown",r=>{r.target===t&&r.key==="Enter"&&(u(this,Ic,!0),a(r))},{signal:s}),await m(this,gn,$p).call(this),t}finish(){n(this,xs)&&(n(this,xs).focus({focusVisible:n(this,Ic)}),u(this,Ic,!1))}isEmpty(){return n(this,on)?n(this,ye)===null:!n(this,ye)&&!n(this,pn)}hasData(){return n(this,on)?n(this,ye)!==null||!!n(this,$n):this.isEmpty()}get guessedText(){return n(this,$n)}async setGuessedText(t){n(this,ye)===null&&(u(this,$n,t),u(this,Jo,await Un._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),m(this,gn,$p).call(this))}toggleAltTextBadge(t=!1){var e;if(!n(this,on)||n(this,ye)){(e=n(this,Vs))==null||e.remove(),u(this,Vs,null);return}if(!n(this,Vs)){const s=u(this,Vs,document.createElement("div"));s.className="noAltTextBadge",n(this,fi).div.append(s)}n(this,Vs).classList.toggle("hidden",!t)}serialize(t){let e=n(this,ye);return!t&&n(this,$n)===e&&(e=n(this,Jo)),{altText:e,decorative:n(this,pn),guessedText:n(this,$n),textWithDisclaimer:n(this,Jo)}}get data(){return{altText:n(this,ye),decorative:n(this,pn)}}set data({altText:t,decorative:e,guessedText:s,textWithDisclaimer:a,cancel:r=!1}){s&&(u(this,$n,s),u(this,Jo,a)),!(n(this,ye)===t&&n(this,pn)===e)&&(r||(u(this,ye,t),u(this,pn,e)),m(this,gn,$p).call(this))}toggle(t=!1){n(this,xs)&&(!t&&n(this,Di)&&(clearTimeout(n(this,Di)),u(this,Di,null)),n(this,xs).disabled=!t)}shown(){n(this,fi)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:n(this,gn,Hd)}})}destroy(){var t,e;(t=n(this,xs))==null||t.remove(),u(this,xs,null),u(this,Ud,null),u(this,rn,null),(e=n(this,Vs))==null||e.remove(),u(this,Vs,null)}};ye=new WeakMap,pn=new WeakMap,xs=new WeakMap,Ud=new WeakMap,rn=new WeakMap,Di=new WeakMap,Ic=new WeakMap,Vs=new WeakMap,fi=new WeakMap,$n=new WeakMap,Jo=new WeakMap,on=new WeakMap,Ca=new WeakMap,gn=new WeakSet,Hd=function(){return n(this,ye)&&"added"||n(this,ye)===null&&this.guessedText&&"review"||"missing"},$p=async function(){var i,t,e;const s=n(this,xs);if(!s)return;if(n(this,on)){if(s.classList.toggle("done",!!n(this,ye)),s.setAttribute("data-l10n-id",n(Dc,Ca)[n(this,gn,Hd)]),(i=n(this,Ud))==null||i.setAttribute("data-l10n-id",n(Dc,Ca)[`${n(this,gn,Hd)}-label`]),!n(this,ye)){(t=n(this,rn))==null||t.remove();return}}else{if(!n(this,ye)&&!n(this,pn)){s.classList.remove("done"),(e=n(this,rn))==null||e.remove();return}s.classList.add("done"),s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let a=n(this,rn);if(!a){u(this,rn,a=document.createElement("span")),a.className="tooltip",a.setAttribute("role","tooltip"),a.id=`alt-text-tooltip-${n(this,fi).id}`;const o=100,l=n(this,fi)._uiManager._signal;l.addEventListener("abort",()=>{clearTimeout(n(this,Di)),u(this,Di,null)},{once:!0}),s.addEventListener("mouseenter",()=>{u(this,Di,setTimeout(()=>{u(this,Di,null),n(this,rn).classList.add("show"),n(this,fi)._reportTelemetry({action:"alt_text_tooltip"})},o))},{signal:l}),s.addEventListener("mouseleave",()=>{var h;n(this,Di)&&(clearTimeout(n(this,Di)),u(this,Di,null)),(h=n(this,rn))==null||h.classList.remove("show")},{signal:l})}n(this,pn)?a.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(a.removeAttribute("data-l10n-id"),a.textContent=n(this,ye)),a.parentNode||s.append(a);const r=n(this,fi).getElementForAltText();
2r==null||r.setAttribute("aria-describedby",a.id)},f(Dc,Ca,null),S(Dc,"_l10n",null);let T0=Dc;var Ee,es,Xl,wt,Up,wr,Xi,br,yr,Zo,Hp,tw;class $u{constructor(t){f(this,Hp),f(this,Ee,null),f(this,es,null),f(this,Xl,!1),f(this,wt,null),f(this,Up,null),f(this,wr,null),f(this,Xi,null),f(this,br,null),f(this,yr,!1),f(this,Zo,null),u(this,wt,t)}renderForToolbar(){const t=u(this,es,document.createElement("button"));return t.className="comment",m(this,Hp,tw).call(this,t,!1)}renderForStandalone(){const t=u(this,Ee,document.createElement("button"));t.className="annotationCommentButton";const e=n(this,wt).commentButtonPosition;if(e){const{style:s}=t;s.insetInlineEnd=`calc(${100*(n(this,wt)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,s.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;const a=n(this,wt).commentButtonColor;a&&(s.backgroundColor=a)}return m(this,Hp,tw).call(this,t,!0)}focusButton(){setTimeout(()=>{var t;(t=n(this,Ee)??n(this,es))==null||t.focus()},0)}onUpdatedColor(){if(!n(this,Ee))return;const t=n(this,wt).commentButtonColor;t&&(n(this,Ee).style.backgroundColor=t),n(this,wt)._uiManager.updatePopupColor(n(this,wt))}get commentButtonWidth(){var t;return(((t=n(this,Ee))==null?void 0:t.getBoundingClientRect().width)??0)/n(this,wt).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(n(this,Zo))return n(this,Zo);if(!n(this,Ee))return null;const{x:t,y:e,height:s}=n(this,Ee).getBoundingClientRect(),{x:a,y:r,width:o,height:l}=n(this,wt).parent.boundingClientRect;return[(t-a)/o,(e+s-r)/l]}set commentPopupPositionInLayer(t){u(this,Zo,t)}hasDefaultPopupPosition(){return n(this,Zo)===null}removeStandaloneCommentButton(){var t;(t=n(this,Ee))==null||t.remove(),u(this,Ee,null)}removeToolbarCommentButton(){var t;(t=n(this,es))==null||t.remove(),u(this,es,null)}setCommentButtonStates({selected:t,hasPopup:e}){n(this,Ee)&&(n(this,Ee).classList.toggle("selected",t),n(this,Ee).ariaExpanded=e)}edit(t){const e=this.commentPopupPositionInLayer;let s,a;if(e)[s,a]=e;else{[s,a]=n(this,wt).commentButtonPosition;const{width:d,height:p,x:g,y:v}=n(this,wt);s=g+s*d,a=v+a*p}const r=n(this,wt).parent.boundingClientRect,{x:o,y:l,width:h,height:c}=r;n(this,wt)._uiManager.editComment(n(this,wt),o+s*h,l+a*c,{...t,parentDimensions:r})}finish(){n(this,es)&&(n(this,es).focus({focusVisible:n(this,Xl)}),u(this,Xl,!1))}isDeleted(){return n(this,yr)||n(this,Xi)===""}isEmpty(){return n(this,Xi)===null}hasBeenEdited(){return this.isDeleted()||n(this,Xi)!==n(this,Up)}serialize(){return this.data}get data(){return{text:n(this,Xi),richText:n(this,wr),date:n(this,br),deleted:this.isDeleted()}}set data(t){if(t!==n(this,Xi)&&u(this,wr,null),t===null){u(this,Xi,""),u(this,yr,!0);return}u(this,Xi,t),u(this,br,new Date),u(this,yr,!1)}restoreData({text:t,richText:e,date:s}){u(this,Xi,t),u(this,wr,e),u(this,br,s),u(this,yr,!1)}setInitialText(t,e=null){u(this,Up,t),this.data=t,u(this,br,null),u(this,wr,e)}shown(){}destroy(){var t,e;(t=n(this,es))==null||t.remove(),u(this,es,null),(e=n(this,Ee))==null||e.remove(),u(this,Ee,null),u(this,Xi,""),u(this,wr,null),u(this,br,null),u(this,wt,null),u(this,Xl,!1),u(this,yr,!1)}}Ee=new WeakMap,es=new WeakMap,Xl=new WeakMap,wt=new WeakMap,Up=new WeakMap,wr=new WeakMap,Xi=new WeakMap,br=new WeakMap,yr=new WeakMap,Zo=new WeakMap,Hp=new WeakSet,tw=function(i,t){if(!n(this,wt)._uiManager.hasCommentManager())return null;i.tabIndex="0",i.ariaHasPopup="dialog",t?(i.ariaControls="commentPopup",i.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(i.ariaControlsElements=[n(this,wt)._uiManager.getCommentDialogElement()],i.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));const e=n(this,wt)._uiManager._signal;if(!(e instanceof AbortSignal)||e.aborted)return i;i.addEventListener("contextmenu",Bi,{signal:e}),t&&(i.addEventListener("focusin",a=>{n(this,wt)._focusEventsAllowed=!1,Pt(a)},{capture:!0,signal:e}),i.addEventListener("focusout",a=>{n(this,wt)._focusEventsAllowed=!0,Pt(a)},{capture:!0,signal:e})),i.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:e});const s=a=>{a.preventDefault(),i===n(this,es)?this.edit():n(this,wt).toggleComment(!0)};
2return i.addEventListener("click",s,{capture:!0,signal:e}),i.addEventListener("keydown",a=>{a.target===i&&a.key==="Enter"&&(u(this,Xl,!0),s(a))},{signal:e}),i.addEventListener("pointerenter",()=>{n(this,wt).toggleComment(!1,!0)},{signal:e}),i.addEventListener("pointerleave",()=>{n(this,wt).toggleComment(!1,!1)},{signal:e}),i};var Vh,To,Uu,Hu,Vu,zu,Gu,Tn,Io,In,Do,Dn,zh,I0,D0,L0,Jm;let IA=(Jm=class{constructor({container:i,isPinchingDisabled:t=null,isPinchingStopped:e=null,onPinchStart:s=null,onPinching:a=null,onPinchEnd:r=null,signal:o}){f(this,zh),f(this,Vh),f(this,To,!1),f(this,Uu,null),f(this,Hu),f(this,Vu),f(this,zu),f(this,Gu),f(this,Tn,null),f(this,Io),f(this,In,null),f(this,Do),f(this,Dn,null),u(this,Vh,i),u(this,Uu,e),u(this,Hu,t),u(this,Vu,s),u(this,zu,a),u(this,Gu,r),u(this,Do,new AbortController),u(this,Io,AbortSignal.any([o,n(this,Do).signal])),i.addEventListener("touchstart",m(this,zh,I0).bind(this),{passive:!1,signal:n(this,Io)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/yo.pixelRatio}destroy(){var i,t;(i=n(this,Do))==null||i.abort(),u(this,Do,null),(t=n(this,Tn))==null||t.abort(),u(this,Tn,null)}},Vh=new WeakMap,To=new WeakMap,Uu=new WeakMap,Hu=new WeakMap,Vu=new WeakMap,zu=new WeakMap,Gu=new WeakMap,Tn=new WeakMap,Io=new WeakMap,In=new WeakMap,Do=new WeakMap,Dn=new WeakMap,zh=new WeakSet,I0=function(i){var t,e,s;if((t=n(this,Hu))!=null&&t.call(this))return;if(i.touches.length===1){if(n(this,Tn))return;const o=u(this,Tn,new AbortController),l=AbortSignal.any([n(this,Io),o.signal]),h=n(this,Vh),c={capture:!0,signal:l,passive:!1},d=p=>{var g;p.pointerType==="touch"&&((g=n(this,Tn))==null||g.abort(),u(this,Tn,null))};h.addEventListener("pointerdown",p=>{p.pointerType==="touch"&&(Pt(p),d(p))},c),h.addEventListener("pointerup",d,c),h.addEventListener("pointercancel",d,c);return}if(!n(this,Dn)){u(this,Dn,new AbortController);const o=AbortSignal.any([n(this,Io),n(this,Dn).signal]),l=n(this,Vh),h={signal:o,capture:!1,passive:!1};l.addEventListener("touchmove",m(this,zh,D0).bind(this),h);const c=m(this,zh,L0).bind(this);l.addEventListener("touchend",c,h),l.addEventListener("touchcancel",c,h),h.capture=!0,l.addEventListener("pointerdown",Pt,h),l.addEventListener("pointermove",Pt,h),l.addEventListener("pointercancel",Pt,h),l.addEventListener("pointerup",Pt,h),(e=n(this,Vu))==null||e.call(this)}if(Pt(i),i.touches.length!==2||(s=n(this,Uu))!=null&&s.call(this)){u(this,In,null);return}let[a,r]=i.touches;a.identifier>r.identifier&&([a,r]=[r,a]),u(this,In,{touch0X:a.screenX,touch0Y:a.screenY,touch1X:r.screenX,touch1Y:r.screenY})},D0=function(i){var t;if(!n(this,In)||i.touches.length!==2)return;Pt(i);let[e,s]=i.touches;e.identifier>s.identifier&&([e,s]=[s,e]);const{screenX:a,screenY:r}=e,{screenX:o,screenY:l}=s,h=n(this,In),{touch0X:c,touch0Y:d,touch1X:p,touch1Y:g}=h,v=p-c,w=g-d,b=o-a,y=l-r,A=Math.hypot(b,y)||1,_=Math.hypot(v,w)||1;if(!n(this,To)&&Math.abs(_-A)<=Jm.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(h.touch0X=a,h.touch0Y=r,h.touch1X=o,h.touch1Y=l,!n(this,To)){u(this,To,!0);return}const E=[(a+o)/2,(r+l)/2];(t=n(this,zu))==null||t.call(this,E,_,A)},L0=function(i){var t;i.touches.length>=2||(n(this,Dn)&&(n(this,Dn).abort(),u(this,Dn,null),(t=n(this,Gu))==null||t.call(this)),n(this,In)&&(Pt(i),u(this,In,null),u(this,To,!1)))},Jm);var tl,Ms,Mt,it,Hn,Lc,Ar,Vp,Te,el,ha,Yi,lo,Hf,Yl,Pe,zp,il,Pa,zs,Rc,Nc,xi,so,Gp,ew,et,iw,Vf,sw,Xu,DA,R0,Zm,Yu,nw,LA,RA,NA,aw,FA,rw,OA,WA,BA,ow,Vd;const Ft=class zt{constructor(t){f(this,et),f(this,tl,null),f(this,Ms,null),f(this,Mt,null),f(this,it,null),f(this,Hn,null),f(this,Lc,!1),f(this,Ar,null),f(this,Vp,""),f(this,Te,null),f(this,el,null),f(this,ha,null),f(this,Yi,null),f(this,lo,null),f(this,Hf,""),f(this,Yl,!1),f(this,Pe,null),f(this,zp,!1),f(this,il,!1),f(this,Pa,!1),f(this,zs,null),f(this,Rc,0),f(this,Nc,0),f(this,xi,null),f(this,so,null),S(this,"isSelected",!1),S(this,"_isCopy",!1),S(this,"_editToolbar",null),S(this,"_initialOptions",Object.create(null)),S(this,"_initialData",null),S(this,"_isVisible",!0),S(this,"_uiManager",null),S(this,"_focusEventsAllowed",!0),f(this,Gp,!1),f(this,ew,zt._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:s,pageHeight:a,pageX:r,pageY:o}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[s,a],this.pageTranslation=[r,o];const[l,h]=this.parentDimensions;this.x=t.x/l,this.y=t.y/h,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const t=zt.prototype._resizeWithKeyboard,e=_u.TRANSLATE_SMALL,s=_u.TRANSLATE_BIG;return G(this,"_resizerKeyboardManager",new Pu([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-s,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[s,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-s]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,s]}],[["Escape","mac+Escape"],zt.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 G(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new qE({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(zt._l10n??(zt._l10n=t),zt._l10nResizer||(zt._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"})),zt._borderLineWidth!==-1)return;const s=getComputedStyle(document.documentElement);zt._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){at("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return n(this,Gp)}set _isDraggable(t){var e;
2u(this,Gp,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}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=n(this,ew)}setParent(t){var e;t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(m(this,et,Vd).call(this),(e=n(this,Yi))==null||e.remove(),u(this,Yi,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(n(this,Yl)?u(this,Yl,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const s=t.relatedTarget;s!=null&&s.closest(`#${this.id}`)||(t.preventDefault(),(e=this.parent)!=null&&e.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,s,a){const[r,o]=this.parentDimensions;[s,a]=this.screenToPageTranslation(s,a),this.x=(t+s)/r,this.y=(e+a)/o,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}const[s,a]=this.parentDimensions;this.setAt(t*s,e*a,this.width*s,this.height*a),this._onTranslated()}translate(t,e){m(this,et,iw).call(this,this.parentDimensions,t,e)}translateInPage(t,e){n(this,Pe)||u(this,Pe,[this.x,this.y,this.width,this.height]),m(this,et,iw).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){n(this,Pe)||u(this,Pe,[this.x,this.y,this.width,this.height]);const{div:s,parentDimensions:[a,r]}=this;if(this.x+=t/a,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:p,y:g}=this.div.getBoundingClientRect();this.parent.findNewParent(this,p,g)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:l}=this;const[h,c]=this.getBaseTranslation();o+=h,l+=c;const{style:d}=s;d.left=`${(100*o).toFixed(2)}%`,d.top=`${(100*l).toFixed(2)}%`,this._onTranslating(o,l),s.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!n(this,Pe)&&(n(this,Pe)[0]!==this.x||n(this,Pe)[1]!==this.y)}get _hasBeenResized(){return!!n(this,Pe)&&(n(this,Pe)[2]!==this.width||n(this,Pe)[3]!==this.height)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:s}=zt,a=s/t,r=s/e;switch(this.rotation){case 90:return[-a,r];case 180:return[a,r];case 270:return[a,-r];default:return[-a,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const{div:{style:e},pageDimensions:[s,a]}=this;let{x:r,y:o,width:l,height:h}=this;if(l*=s,h*=a,r*=s,o*=a,this._mustFixPosition)switch(t){case 0:r=xt(r,0,s-l),o=xt(o,0,a-h);break;case 90:r=xt(r,0,s-h),o=xt(o,l,a);break;case 180:r=xt(r,l,s),o=xt(o,h,a);break;case 270:r=xt(r,h,s),o=xt(o,0,a-l);break}this.x=r/=s,this.y=o/=a;const[c,d]=this.getBaseTranslation();r+=c,o+=d,e.left=`${(100*r).toFixed(2)}%`,e.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var s;return m(s=zt,Vf,sw).call(s,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var s;return m(s=zt,Vf,sw).call(s,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,s]}=this;return[e*t,s*t]}setDims(){const{div:{style:t},width:e,height:s}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*s).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){var t;(t=n(this,Mt))==null||t.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||n(this,il))return this._editToolbar;
2this._editToolbar=new VE(this),this.div.append(this._editToolbar.render());const{toolbarButtons:t}=this;if(t)for(const[e,s]of t)await this._editToolbar.addButton(e,s);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")}removeCommentButtonFromToolbar(){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,Mt))==null||e.destroy()}addContainer(t){var e;const s=(e=this._editToolbar)==null?void 0:e.div;s?s.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return n(this,Mt)||(T0.initialize(zt._l10n),u(this,Mt,new T0(this)),n(this,tl)&&(n(this,Mt).data=n(this,tl),u(this,tl,null))),n(this,Mt)}get altTextData(){var t;return(t=n(this,Mt))==null?void 0:t.data}set altTextData(t){n(this,Mt)&&(n(this,Mt).data=t)}get guessedAltText(){var t;return(t=n(this,Mt))==null?void 0:t.guessedText}async setGuessedAltText(t){var e;await((e=n(this,Mt))==null?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return(e=n(this,Mt))==null?void 0:e.serialize(t)}hasAltText(){return!!n(this,Mt)&&!n(this,Mt).isEmpty()}hasAltTextData(){var t;return((t=n(this,Mt))==null?void 0:t.hasData())??!1}focusCommentButton(){var t;(t=n(this,it))==null||t.focusButton()}addCommentButton(){return this.canAddComment?n(this,it)||u(this,it,new $u(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(n(this,Hn)){this._uiManager.isEditingMode()&&n(this,Hn).classList.remove("hidden");return}this.hasComment&&(u(this,Hn,n(this,it).renderForStandalone()),this.div.append(n(this,Hn)))}}removeStandaloneCommentButton(){n(this,it).removeStandaloneCommentButton(),u(this,Hn,null)}hideStandaloneCommentButton(){var t;(t=n(this,Hn))==null||t.classList.add("hidden")}get comment(){if(!n(this,it))return null;const{data:{richText:t,text:e,date:s,deleted:a}}=n(this,it);return{text:e,richText:t,date:s,deleted:a,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){n(this,it)||u(this,it,new $u(this)),typeof t=="object"&&t!==null?n(this,it).restoreData(t):n(this,it).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:s}){if(!e||(n(this,it)||u(this,it,new $u(this)),n(this,it).setInitialText(t,s),!this.annotationElementId))return;const a=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);a&&this.updateFromAnnotationLayer(a)}get hasEditedComment(){var t;return(t=n(this,it))==null?void 0:t.hasBeenEdited()}get hasDeletedComment(){var t;return(t=n(this,it))==null?void 0:t.isDeleted()}get hasComment(){return!!n(this,it)&&!n(this,it).isEmpty()&&!n(this,it).isDeleted()}async editComment(t){n(this,it)||u(this,it,new $u(this)),n(this,it).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){n(this,it).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){const[,,,e]=t.rect,[s]=this.pageDimensions,[a]=this.pageTranslation,r=a+s+1,o=e-100,l=r+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[r,o,l,e]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){n(this,it).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){var t;const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=n(this,Lc)?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),m(this,et,rw).call(this);const[s,a]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*a/s).toFixed(2)}%`,e.style.maxHeight=`${(100*s/a).toFixed(2)}%`);const[r,o]=this.getInitialTranslation();return this.translate(r,o),SA(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(n(this,so)||u(this,so,new IA({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:m(this,et,LA).bind(this),onPinching:m(this,et,RA).bind(this),onPinchEnd:m(this,et,NA).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),(t=this._uiManager._editorUndoBar)==null||t.hide(),e}pointerdown(t){const{isMac:e}=Jt.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(u(this,Yl,!0),this._isDraggable){m(this,et,FA).call(this,t);return}m(this,et,aw).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){n(this,zs)&&clearTimeout(n(this,zs)),u(this,zs,setTimeout(()=>{var t;u(this,zs,null),(t=this.parent)==null||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,s){t.changeParent(this),this.x=e,this.y=s,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,s=this.rotation){const a=this.parentScale,[r,o]=this.pageDimensions,[l,h]=this.pageTranslation,c=t/a,d=e/a,p=this.x*r,g=this.y*o,v=this.width*r,w=this.height*o;switch(s){case 0:return[p+c+l,o-g-d-w+h,p+c+v+l,o-g-d+h];case 90:return[p+d+l,o-g+c+h,p+d+w+l,o-g+c+v+h];case 180:return[p-c-v+l,o-g+d+h,p-c+l,o-g+d+w+h];case 270:return[p-d-w+l,o-g-c-v+h,p-d+l,o-g-c+h];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,a,r,o]=t,l=r-s,h=o-a;switch(this.rotation){case 0:return[s,e-o,l,h];case 90:return[s,e-a,h,l];case 180:return[r,e-a,l,h];case 270:return[r,e-o,h,l];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&zt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){var t;(t=n(this,it))==null||t.onUpdatedColor()}getData(){const{comment:{text:t,color:e,date:s,opacity:a,deleted:r,richText:o},uid:l,pageIndex:h,creationDate:c,modificationDate:d}=this;return{id:l,pageIndex:h,rect:this.getPDFRect(),richText:o,contentsObj:{str:t},creationDate:c,modificationDate:s||d,popupRef:!r,color:e,opacity:a}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),u(this,il,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),u(this,il,!1),!0):!1}isInEditMode(){return n(this,il)}shouldGetKeyboardEvents(){return n(this,Pa)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:t,left:e,bottom:s,right:a}=this.getClientDimensions(),{innerHeight:r,innerWidth:o}=window;return e<o&&a>0&&t<r&&s>0}rebuild(){m(this,et,rw).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 s;return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:((s=this._initialData)==null?void 0:s.popupRef)||""}}static async deserialize(t,e,s){const a=new this.prototype.constructor({parent:e,id:s.getId(),uiManager:s,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});a.rotation=t.rotation,u(a,tl,t.accessibilityData),a._isCopy=t.isCopy||!1;const[r,o]=a.pageDimensions,[l,h,c,d]=a.getRectInCurrentCoords(t.rect,o);return a.x=l/r,a.y=h/o,a.width=c/r,a.height=d/o,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var t,e,s;if((t=n(this,lo))==null||t.abort(),u(this,lo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),n(this,zs)&&(clearTimeout(n(this,zs)),u(this,zs,null)),m(this,et,Vd).call(this),this.removeEditToolbar(),n(this,xi)){for(const a of n(this,xi).values())clearTimeout(a);u(this,xi,null)}this.parent=null,(e=n(this,so))==null||e.destroy(),u(this,so,null),(s=n(this,Yi))==null||s.remove(),u(this,Yi,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(m(this,et,DA).call(this),n(this,Te).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,[s,a,r,o]=this.getPDFRect();return[zt._round(s+(r-s)*t),zt._round(a+(o-a)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return n(this,it).commentPopupPositionInLayer}set commentPopupPosition(t){n(this,it).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return n(this,it).hasDefaultPopupPosition()}get commentButtonWidth(){return n(this,it).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){var e;(e=n(this,it))==null||e.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),u(this,ha,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=n(this,Te).children;if(!n(this,Ms)){u(this,Ms,Array.from(e));const o=m(this,et,OA).bind(this),l=m(this,et,WA).bind(this),h=this._uiManager._signal;for(const c of n(this,Ms)){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",o,{signal:h}),c.addEventListener("blur",l,{signal:h}),c.addEventListener("focus",m(this,et,BA).bind(this,d),{signal:h}),c.setAttribute("data-l10n-id",zt._l10nResizer[d])}}const s=n(this,Ms)[0];let a=0;for(const o of e){if(o===s)break;a++}const r=(360-this.rotation+this.parentRotation)%360/90*(n(this,Ms).length/4);if(r!==a){if(r<a)for(let l=0;l<a-r;l++)n(this,Te).append(n(this,Te).firstElementChild);else if(r>a)for(let l=0;l<r-a;l++)n(this,Te).firstElementChild.before(n(this,Te).lastElementChild);let o=0;for(const l of e){const h=n(this,Ms)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",zt._l10nResizer[h])}}m(this,et,ow).call(this,0),u(this,Pa,!0),n(this,Te).firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){n(this,Pa)&&m(this,et,nw).call(this,n(this,Hf),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){m(this,et,Vd).call(this),this.div.focus()}select(){var t,e,s;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 a,r;(a=this.div)!=null&&a.classList.contains("selectedEditor")&&((r=this._editToolbar)==null||r.show())});return}(e=this._editToolbar)==null||e.show(),(s=n(this,Mt))==null||s.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,s,a,r;this.isSelected&&(this.isSelected=!1,(t=n(this,Te))==null||t.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(s=this.div)!=null&&s.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(a=this._editToolbar)==null||a.hide(),(r=n(this,Mt))==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,zp)}set isEditing(t){u(this,zp,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,xi)||u(this,xi,new Map);const{action:s}=t;let a=n(this,xi).get(s);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),n(this,xi).delete(s),n(this,xi).size===0&&u(this,xi,null)},zt._telemetryTimeout),n(this,xi).set(s,a);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),u(this,Lc,!1)}disable(){this.div&&(this.div.tabIndex=-1),u(this,Lc,!0)}updateFakeAnnotationElement(t){if(!n(this,Yi)&&!this.deleted){u(this,Yi,t.addFakeAnnotation(this));return}if(this.deleted){n(this,Yi).remove(),u(this,Yi,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&n(this,Yi).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 s=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.before(e)}return e}resetAnnotationElement(t){const{firstElementChild:e}=t.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};tl=new WeakMap,Ms=new WeakMap,Mt=new WeakMap,it=new WeakMap,Hn=new WeakMap,Lc=new WeakMap,Ar=new WeakMap,Vp=new WeakMap,Te=new WeakMap,el=new WeakMap,ha=new WeakMap,Yi=new WeakMap,lo=new WeakMap,Hf=new WeakMap,Yl=new WeakMap,Pe=new WeakMap,zp=new WeakMap,il=new WeakMap,Pa=new WeakMap,zs=new WeakMap,Rc=new WeakMap,Nc=new WeakMap,xi=new WeakMap,so=new WeakMap,Gp=new WeakMap,ew=new WeakMap,et=new WeakSet,iw=function([i,t],e,s){[e,s]=this.screenToPageTranslation(e,s),this.x+=e/i,this.y+=s/t,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},Vf=new WeakSet,sw=function(i,t,e){switch(e){case 90:return[t,-i];case 180:return[-i,-t];case 270:return[-t,i];default:return[i,t]}},Xu=function(i){switch(i){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}},DA=function(){if(n(this,Te))return;u(this,Te,document.createElement("div")),n(this,Te).classList.add("resizers");const i=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],t=this._uiManager._signal;for(const e of i){const s=document.createElement("div");n(this,Te).append(s),s.classList.add("resizer",e),s.setAttribute("data-resizer-name",e),s.addEventListener("pointerdown",m(this,et,R0).bind(this,e),{signal:t}),s.addEventListener("contextmenu",Bi,{signal:t}),s.tabIndex=-1}this.div.prepend(n(this,Te))},R0=function(i,t){var e;t.preventDefault();const{isMac:s}=Jt.platform;if(t.button!==0||t.ctrlKey&&s)return;(e=n(this,Mt))==null||e.toggle(!1);const a=this._isDraggable;this._isDraggable=!1,u(this,el,[t.screenX,t.screenY]);const r=new AbortController,o=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",m(this,et,nw).bind(this,i),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Pt,{passive:!1,signal:o}),window.addEventListener("contextmenu",Bi,{signal:o}),u(this,ha,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const l=this.parent.div.style.cursor,h=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const c=()=>{var d;r.abort(),this.parent.togglePointerEvents(!0),(d=n(this,Mt))==null||d.toggle(!0),this._isDraggable=a,this.parent.div.style.cursor=l,this.div.style.cursor=h,m(this,et,Yu).call(this)};window.addEventListener("pointerup",c,{signal:o}),window.addEventListener("blur",c,{signal:o})},Zm=function(i,t,e,s){this.width=e,this.height=s,this.x=i,this.y=t,this.setDims(),this.fixAndSetPosition(),this._onResized()},Yu=function(){if(!n(this,ha))return;const{savedX:i,savedY:t,savedWidth:e,savedHeight:s}=n(this,ha);u(this,ha,null);const a=this.x,r=this.y,o=this.width,l=this.height;a===i&&r===t&&o===e&&l===s||this.addCommands({cmd:m(this,et,Zm).bind(this,a,r,o,l),undo:m(this,et,Zm).bind(this,i,t,e,s),mustExec:!0})},nw=function(i,t){const[e,s]=this.parentDimensions,a=this.x,r=this.y,o=this.width,l=this.height,h=Ft.MIN_SIZE/e,c=Ft.MIN_SIZE/s,d=m(this,et,Xu).call(this,this.rotation),p=(F,N)=>[d[0]*F+d[2]*N,d[1]*F+d[3]*N],g=m(this,et,Xu).call(this,360-this.rotation),v=(F,N)=>[g[0]*F+g[2]*N,g[1]*F+g[3]*N];let w,b,y=!1,A=!1;switch(i){case"topLeft":y=!0,w=(F,N)=>[0,0],b=(F,N)=>[F,N];break;case"topMiddle":w=(F,N)=>[F/2,0],b=(F,N)=>[F/2,N];break;case"topRight":y=!0,w=(F,N)=>[F,0],b=(F,N)=>[0,N];break;case"middleRight":A=!0,w=(F,N)=>[F,N/2],b=(F,N)=>[0,N/2];break;case"bottomRight":y=!0,w=(F,N)=>[F,N],b=(F,N)=>[0,0];break;case"bottomMiddle":w=(F,N)=>[F/2,N],b=(F,N)=>[F/2,0];break;case"bottomLeft":y=!0,w=(F,N)=>[0,N],b=(F,N)=>[F,0];break;case"middleLeft":A=!0,w=(F,N)=>[0,N/2],b=(F,N)=>[F,N/2];break}const _=w(o,l),E=b(o,l);let x=p(...E);const k=Ft._round(a+x[0]),C=Ft._round(r+x[1]);let I=1,P=1,M,D;if(t.fromKeyboard)({deltaX:M,deltaY:D}=t);else{const{screenX:F,screenY:N}=t,[Q,X]=n(this,el);[M,D]=this.screenToPageTranslation(F-Q,N-X),n(this,el)[0]=F,n(this,el)[1]=N}if([M,D]=v(M/e,D/s),y){const F=Math.hypot(o,l);I=P=Math.max(Math.min(Math.hypot(E[0]-_[0]-M,E[1]-_[1]-D)/F,1/o,1/l),h/o,c/l)}else A?I=xt(Math.abs(E[0]-_[0]-M),h,1)/o:P=xt(Math.abs(E[1]-_[1]-D),c,1)/l;const L=Ft._round(o*I),W=Ft._round(l*P);x=p(...b(L,W));const $=k-x[0],j=C-x[1];n(this,Pe)||u(this,Pe,[this.x,this.y,this.width,this.height]),this.width=L,this.height=W,this.x=$,this.y=j,this.setDims(),this.fixAndSetPosition(),this._onResizing()},LA=function(){var i;u(this,ha,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(i=n(this,Mt))==null||i.toggle(!1),this.parent.togglePointerEvents(!1)},RA=function(i,t,e){let s=.7*(e/t)+1-.7;
2if(s===1)return;const a=m(this,et,Xu).call(this,this.rotation),r=(x,k)=>[a[0]*x+a[2]*k,a[1]*x+a[3]*k],[o,l]=this.parentDimensions,h=this.x,c=this.y,d=this.width,p=this.height,g=Ft.MIN_SIZE/o,v=Ft.MIN_SIZE/l;s=Math.max(Math.min(s,1/d,1/p),g/d,v/p);const w=Ft._round(d*s),b=Ft._round(p*s);if(w===d&&b===p)return;n(this,Pe)||u(this,Pe,[h,c,d,p]);const y=r(d/2,p/2),A=Ft._round(h+y[0]),_=Ft._round(c+y[1]),E=r(w/2,b/2);this.x=A-E[0],this.y=_-E[1],this.width=w,this.height=b,this.setDims(),this.fixAndSetPosition(),this._onResizing()},NA=function(){var i;(i=n(this,Mt))==null||i.toggle(!0),this.parent.togglePointerEvents(!0),m(this,et,Yu).call(this)},aw=function(i){const{isMac:t}=Jt.platform;i.ctrlKey&&!t||i.shiftKey||i.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)},FA=function(i){const{isSelected:t}=this;this._uiManager.setUpDragSession();let e=!1;const s=new AbortController,a=this._uiManager.combinedSignal(s),r={capture:!0,passive:!1,signal:a},o=h=>{s.abort(),u(this,Ar,null),u(this,Yl,!1),this._uiManager.endDragSession()||m(this,et,aw).call(this,h),e&&this._onStopDragging()};t&&(u(this,Rc,i.clientX),u(this,Nc,i.clientY),u(this,Ar,i.pointerId),u(this,Vp,i.pointerType),window.addEventListener("pointermove",h=>{e||(e=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());const{clientX:c,clientY:d,pointerId:p}=h;if(p!==n(this,Ar)){Pt(h);return}const[g,v]=this.screenToPageTranslation(c-n(this,Rc),d-n(this,Nc));u(this,Rc,c),u(this,Nc,d),this._uiManager.dragSelectedEditors(g,v)},r),window.addEventListener("touchmove",Pt,r),window.addEventListener("pointerdown",h=>{h.pointerType===n(this,Vp)&&(n(this,so)||h.isPrimary)&&o(h),Pt(h)},r));const l=h=>{if(!n(this,Ar)||n(this,Ar)===h.pointerId){o(h);return}Pt(h)};window.addEventListener("pointerup",l,{signal:a}),window.addEventListener("blur",l,{signal:a})},rw=function(){if(n(this,lo)||!this.div)return;u(this,lo,new AbortController);const i=this._uiManager.combinedSignal(n(this,lo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:i}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:i})},OA=function(i){Ft._resizerKeyboardManager.exec(this,i)},WA=function(i){var t;n(this,Pa)&&((t=i.relatedTarget)==null?void 0:t.parentNode)!==n(this,Te)&&m(this,et,Vd).call(this)},BA=function(i){u(this,Hf,n(this,Pa)?i:"")},ow=function(i){if(n(this,Ms))for(const t of n(this,Ms))t.tabIndex=i},Vd=function(){u(this,Pa,!1),m(this,et,ow).call(this,-1),m(this,et,Yu).call(this)},f(Ft,Vf),S(Ft,"_l10n",null),S(Ft,"_l10nResizer",null),S(Ft,"_borderLineWidth",-1),S(Ft,"_colorManager",new KE),S(Ft,"_zIndex",1),S(Ft,"_telemetryTimeout",1e3);let kt=Ft;class qE extends kt{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const N0=3285377520,yi=4294901760,cs=65535;class lw{constructor(t){this.h1=t?t&4294967295:N0,this.h2=t?t&4294967295:N0}update(t){let e,s;if(typeof t=="string"){e=new Uint8Array(t.length*2),s=0;for(let b=0,y=t.length;b<y;b++){const A=t.charCodeAt(b);A<=255?e[s++]=A:(e[s++]=A>>>8,e[s++]=A&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),s=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=s>>2,r=s-a*4,o=new Uint32Array(e.buffer,0,a);let l=0,h=0,c=this.h1,d=this.h2;const p=3432918353,g=461845907,v=p&cs,w=g&cs;for(let b=0;b<a;b++)b&1?(l=o[b],l=l*p&yi|l*v&cs,l=l<<15|l>>>17,l=l*g&yi|l*w&cs,c^=l,c=c<<13|c>>>19,c=c*5+3864292196):(h=o[b],h=h*p&yi|h*v&cs,h=h<<15|h>>>17,h=h*g&yi|h*w&cs,d^=h,d=d<<13|d>>>19,d=d*5+3864292196);switch(l=0,r){case 3:l^=e[a*4+2]<<16;case 2:l^=e[a*4+1]<<8;case 1:l^=e[a*4],l=l*p&yi|l*v&cs,l=l<<15|l>>>17,l=l*g&yi|l*w&cs,a&1?c^=l:d^=l}this.h1=c,this.h2=d}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&yi|t*36045&cs,e=e*4283543511&yi|((e<<16|t>>>16)*2950163797&yi)>>>16,t^=e>>>1,t=t*444984403&yi|t*60499&cs,e=e*3301882366&yi|((e<<16|t>>>16)*3120437893&yi)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Eu=Object.freeze({map:null,hash:"",transfer:void 0});var mh,sl,Gs,xe,hw,jA;class qb{constructor(){f(this,hw),f(this,mh,!1),f(this,sl,null),f(this,Gs,null),f(this,xe,new Map),S(this,"onSetModified",null),S(this,"onResetModified",null),S(this,"onAnnotationEditor",null)}getValue(t,e){const s=n(this,xe).get(t);return s===void 0?e:Object.assign(e,s)}getRawValue(t){return n(this,xe).get(t)}remove(t){var e;const s=n(this,xe).get(t);s!==void 0&&(s instanceof kt&&n(this,Gs).delete(s.annotationElementId),n(this,xe).delete(t),n(this,xe).size===0&&this.resetModified(),!n(this,xe).values().some(a=>a instanceof kt)&&((e=this.onAnnotationEditor)==null||e.call(this,null)))}setValue(t,e){var s;const a=n(this,xe).get(t);let r=!1;if(a!==void 0)for(const[o,l]of Object.entries(e))a[o]!==l&&(r=!0,a[o]=l);else r=!0,n(this,xe).set(t,e);r&&m(this,hw,jA).call(this),e instanceof kt&&((n(this,Gs)||u(this,Gs,new Map)).set(e.annotationElementId,e),(s=this.onAnnotationEditor)==null||s.call(this,e.constructor._type))}has(t){return n(this,xe).has(t)}get size(){return n(this,xe).size}resetModified(){var t;n(this,mh)&&(u(this,mh,!1),(t=this.onResetModified)==null||t.call(this))}get print(){return new $A(this)}get serializable(){if(n(this,xe).size===0)return Eu;const t=new Map,e=new lw,s=[],a=Object.create(null);let r=!1;for(const[o,l]of n(this,xe)){const h=l instanceof kt?l.serialize(!1,a):l;l.page&&(l.pageIndex=l.page._pageIndex,delete l.page),h&&(t.set(o,h),e.update(`${o}:${JSON.stringify(h)}`),r||(r=!!h.bitmap))}if(r)for(const o of t.values())o.bitmap&&s.push(o.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:s}:Eu}get editorStats(){let t=null;const e=new Map;let s=0,a=0;for(const r of n(this,xe).values()){if(!(r instanceof kt)){r.popup&&(r.popup.deleted?a+=1:s+=1);continue}r.isCommentDeleted?a+=1:r.hasEditedComment&&(s+=1);const o=r.telemetryFinalData;if(!o)continue;const{type:l}=o;e.has(l)||e.set(l,Object.getPrototypeOf(r).constructor),t||(t=Object.create(null));const h=t[l]||(t[l]=new Map);for(const[c,d]of Object.entries(o)){if(c==="type")continue;const p=h.getOrInsertComputed(c,Vb);p.set(d,(p.get(d)??0)+1)}}if((a>0||s>0)&&(t||(t=Object.create(null)),t.comments={deleted:a,edited:s}),!t)return null;for(const[r,o]of e)t[r]=o.computeTelemetryFinalData(t[r]);return t}resetModifiedIds(){u(this,sl,null)}updateEditor(t,e){var s;const a=(s=n(this,Gs))==null?void 0:s.get(t);return a?(a.updateFromAnnotationLayer(e),!0):!1}getEditor(t){var e;return((e=n(this,Gs))==null?void 0:e.get(t))||null}get modifiedIds(){if(n(this,sl))return n(this,sl);const t=[];
2if(n(this,Gs))for(const s of n(this,Gs).values())s.serialize()&&t.push(s.annotationElementId);let e="";if(t.length){const s=new lw;s.update(t.join(",")),e=s.hexdigest()}return u(this,sl,{ids:new Set(t),hash:e})}[Symbol.iterator](){return n(this,xe).entries()}}mh=new WeakMap,sl=new WeakMap,Gs=new WeakMap,xe=new WeakMap,hw=new WeakSet,jA=function(){var i;n(this,mh)||(u(this,mh,!0),(i=this.onSetModified)==null||i.call(this))};var Xp;class $A extends qb{constructor(t){super(),f(this,Xp,Eu);const{serializable:e}=t;if(e===Eu)return;const{map:s,hash:a,transfer:r}=e,o=structuredClone(s,r?{transfer:r}:null);u(this,Xp,{map:o,hash:a,transfer:[]})}get print(){at("Should not call PrintAnnotationStorage.print")}get serializable(){return n(this,Xp)}get modifiedIds(){return G(this,"modifiedIds",{ids:new Set,hash:""})}}Xp=new WeakMap;const Lo="__forcedDependency",{floor:F0,ceil:O0}=Math;function W0(i,t,e,s,a,r){i[t*4+0]=Math.min(i[t*4+0],e),i[t*4+1]=Math.min(i[t*4+1],s),i[t*4+2]=Math.max(i[t*4+2],a),i[t*4+3]=Math.max(i[t*4+3],r)}const cw=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];var Fc,_r;class QE{constructor(t,e){f(this,Fc),f(this,_r),u(this,Fc,t),u(this,_r,e)}get length(){return n(this,Fc).length}isEmpty(t){return n(this,Fc)[t]===cw}minX(t){return n(this,_r)[t*4+0]/256}minY(t){return n(this,_r)[t*4+1]/256}maxX(t){return(n(this,_r)[t*4+2]+1)/256}maxY(t){return(n(this,_r)[t*4+3]+1)/256}}Fc=new WeakMap,_r=new WeakMap;const B0=(i,t)=>i==null?void 0:i.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1}));var Vn,rt,_t,nl,al,Kl,je,Yp,dw;class JE{constructor(t,e){f(this,Yp),f(this,Vn,[[1,0,0,1,0,0]]),f(this,rt,[-1/0,-1/0,1/0,1/0]),f(this,_t,new Float64Array(En)),S(this,"_pendingBBoxIdx",-1),f(this,nl),f(this,al),f(this,Kl),f(this,je),S(this,"_savesStack",[]),S(this,"_markedContentStack",[]),u(this,nl,t.width),u(this,al,t.height),m(this,Yp,dw).call(this,e)}growOperationsCount(t){t>=n(this,je).length&&m(this,Yp,dw).call(this,t,n(this,je))}get clipBox(){return n(this,rt)}save(t){return u(this,rt,{__proto__:n(this,rt)}),this._savesStack.push(t),this}restore(t,e){const s=Object.getPrototypeOf(n(this,rt));if(s===null)return this;u(this,rt,s);const a=this._savesStack.pop();return a!==void 0&&(e==null||e(a,t),n(this,je)[t]=n(this,je)[a]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){const s=this._savesStack.pop();return s!==void 0&&(e==null||e(s,t),n(this,je)[t]=n(this,je)[s]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){const s=this._markedContentStack.pop();return s!==void 0&&(e==null||e(s,t),n(this,je)[t]=n(this,je)[s]),this}pushBaseTransform(t){return n(this,Vn).push(R.multiplyByDOMMatrix(n(this,Vn).at(-1),t.getTransform())),this}popBaseTransform(){return n(this,Vn).length>1&&n(this,Vn).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,n(this,_t).set(En,0)),this}recordClipBox(t,e,s,a,r,o){const l=R.multiplyByDOMMatrix(n(this,Vn).at(-1),e.getTransform()),h=En.slice();R.axialAlignedBoundingBox([s,r,a,o],l,h);const c=R.intersect(n(this,rt),h);return c?(n(this,rt)[0]=c[0],n(this,rt)[1]=c[1],n(this,rt)[2]=c[2],n(this,rt)[3]=c[3]):(n(this,rt)[0]=n(this,rt)[1]=1/0,n(this,rt)[2]=n(this,rt)[3]=-1/0),this}recordBBox(t,e,s,a,r,o){const l=n(this,rt);if(l[0]===1/0)return this;const h=R.multiplyByDOMMatrix(n(this,Vn).at(-1),e.getTransform());if(l[0]===-1/0)return R.axialAlignedBoundingBox([s,r,a,o],h,n(this,_t)),this;const c=En.slice();return R.axialAlignedBoundingBox([s,r,a,o],h,c),n(this,_t)[0]=xt(c[0],l[0],n(this,_t)[0]),n(this,_t)[1]=xt(c[1],l[1],n(this,_t)[1]),n(this,_t)[2]=xt(c[2],n(this,_t)[2],l[2]),n(this,_t)[3]=xt(c[3],n(this,_t)[3],l[3]),this}recordFullPageBBox(t){return n(this,_t)[0]=Math.max(0,n(this,rt)[0]),n(this,_t)[1]=Math.max(0,n(this,rt)[1]),n(this,_t)[2]=Math.min(n(this,nl),n(this,rt)[2]),n(this,_t)[3]=Math.min(n(this,al),n(this,rt)[3]),this}recordOperation(t,e=!1,s){if(this._pendingBBoxIdx!==t)return this;const a=F0(n(this,_t)[0]*256/n(this,nl)),r=F0(n(this,_t)[1]*256/n(this,al)),o=O0(n(this,_t)[2]*256/n(this,nl)),l=O0(n(this,_t)[3]*256/n(this,al));if(W0(n(this,Kl),t,a,r,o,l),s)for(const h of s)for(const c of h)c!==t&&W0(n(this,Kl),c,a,r,o,l);
2return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,n(this,rt)[0]=Math.max(n(this,rt)[0],n(this,_t)[0]),n(this,rt)[1]=Math.max(n(this,rt)[1],n(this,_t)[1]),n(this,rt)[2]=Math.min(n(this,rt)[2],n(this,_t)[2]),n(this,rt)[3]=Math.min(n(this,rt)[3],n(this,_t)[3])),this}take(){return new QE(n(this,je),n(this,Kl))}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,s){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,s,a=1,r=0,o=0,l){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}}Vn=new WeakMap,rt=new WeakMap,_t=new WeakMap,nl=new WeakMap,al=new WeakMap,Kl=new WeakMap,je=new WeakMap,Yp=new WeakSet,dw=function(i,t){const e=new ArrayBuffer(i*4);u(this,Kl,new Uint8ClampedArray(e)),u(this,je,new Uint32Array(e)),t&&t.length>0?(n(this,je).set(t),n(this,je).fill(cw,t.length)):n(this,je).fill(cw)};var ri,oi,rl,vs,Oc,Er,xr,ut;class ZE{constructor(t,e=!1){f(this,ri,{__proto__:null}),f(this,oi,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Lo]:[]}),f(this,rl,new Map),f(this,vs,new Set),f(this,Oc,new Map),f(this,Er),f(this,xr),f(this,ut),u(this,ut,t),e&&(u(this,Er,new Map),u(this,xr,(s,a)=>{B0(n(this,Er),a).dependencies.add(s)}))}get clipBox(){return n(this,ut).clipBox}growOperationsCount(t){n(this,ut).growOperationsCount(t)}save(t){return u(this,ri,{__proto__:n(this,ri)}),u(this,oi,{__proto__:n(this,oi),transform:{__proto__:n(this,oi).transform},moveText:{__proto__:n(this,oi).moveText},sameLineText:{__proto__:n(this,oi).sameLineText},[Lo]:{__proto__:n(this,oi)[Lo]}}),n(this,ut).save(t),this}restore(t){n(this,ut).restore(t,n(this,xr));const e=Object.getPrototypeOf(n(this,ri));return e===null?this:(u(this,ri,e),u(this,oi,Object.getPrototypeOf(n(this,oi))),this)}recordOpenMarker(t){return n(this,ut).recordOpenMarker(t,n(this,xr)),this}getOpenMarker(){return n(this,ut).getOpenMarker()}recordCloseMarker(t){return n(this,ut).recordCloseMarker(t,n(this,xr)),this}beginMarkedContent(t){return n(this,ut).beginMarkedContent(t),this}endMarkedContent(t){return n(this,ut).endMarkedContent(t,n(this,xr)),this}pushBaseTransform(t){return n(this,ut).pushBaseTransform(t),this}popBaseTransform(){return n(this,ut).popBaseTransform(),this}recordSimpleData(t,e){return n(this,ri)[t]=e,this}recordIncrementalData(t,e){return n(this,oi)[t].push(e),this}resetIncrementalData(t,e){return n(this,oi)[t].length=0,this}recordNamedData(t,e){return n(this,rl).set(t,e),this}recordSimpleDataFromNamed(t,e,s){n(this,ri)[t]=n(this,rl).get(e)??s}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Lo,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(const e of t)e in n(this,ri)&&this.recordFutureForcedDependency(e,n(this,ri)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(const t of n(this,vs))this.recordFutureForcedDependency(Lo,t);return this}resetBBox(t){return n(this,ut).resetBBox(t),this}recordClipBox(t,e,s,a,r,o){return n(this,ut).recordClipBox(t,e,s,a,r,o),this}recordBBox(t,e,s,a,r,o){return n(this,ut).recordBBox(t,e,s,a,r,o),this}recordCharacterBBox(t,e,s,a=1,r=0,o=0,l){const h=s.bbox;let c,d;
2if(h&&(c=h[2]!==h[0]&&h[3]!==h[1]&&n(this,Oc).get(s),c!==!1&&(d=[0,0,0,0],R.axialAlignedBoundingBox(h,s.fontMatrix,d),(a!==1||r!==0||o!==0)&&R.scaleMinMax([a,0,0,-a,r,o],d),c)))return this.recordBBox(t,e,d[0],d[2],d[1],d[3]);if(!l)return this.recordFullPageBBox(t);const p=l();return h&&d&&c===void 0&&(c=d[0]<=r-p.actualBoundingBoxLeft&&d[2]>=r+p.actualBoundingBoxRight&&d[1]<=o-p.actualBoundingBoxAscent&&d[3]>=o+p.actualBoundingBoxDescent,n(this,Oc).set(s,c),c)?this.recordBBox(t,e,d[0],d[2],d[1],d[3]):this.recordBBox(t,e,r-p.actualBoundingBoxLeft,r+p.actualBoundingBoxRight,o-p.actualBoundingBoxAscent,o+p.actualBoundingBoxDescent)}recordFullPageBBox(t){return n(this,ut).recordFullPageBBox(t),this}getSimpleIndex(t){return n(this,ri)[t]}recordDependencies(t,e){const s=n(this,vs),a=n(this,ri),r=n(this,oi);for(const o of e)o in n(this,ri)?s.add(a[o]):o in r&&r[o].forEach(s.add,s);return this}recordNamedDependency(t,e){return n(this,rl).has(e)&&n(this,vs).add(n(this,rl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Lo]),n(this,Er)){const a=B0(n(this,Er),t),{dependencies:r}=a;n(this,vs).forEach(r.add,r),n(this,ut)._savesStack.forEach(r.add,r),n(this,ut)._markedContentStack.forEach(r.add,r),r.delete(t),a.isRenderingOperation=!0}const s=!e&&t===n(this,ut)._pendingBBoxIdx;return n(this,ut).recordOperation(t,e,[n(this,vs),n(this,ut)._savesStack,n(this,ut)._markedContentStack]),s&&n(this,vs).clear(),this}recordShowTextOperation(t,e=!1){const s=Array.from(n(this,vs));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(const a of s)this.recordIncrementalData("sameLineText",a);return this}bboxToClipBoxDropOperation(t,e=!1){const s=!e&&t===n(this,ut)._pendingBBoxIdx;return n(this,ut).bboxToClipBoxDropOperation(t),s&&n(this,vs).clear(),this}take(){return n(this,Oc).clear(),n(this,ut).take()}takeDebugMetadata(){return n(this,Er)}}ri=new WeakMap,oi=new WeakMap,rl=new WeakMap,vs=new WeakMap,Oc=new WeakMap,Er=new WeakMap,xr=new WeakMap,ut=new WeakMap;var pt,Ot,ws,Wc,Bc;const tx=class UA{constructor(t,e,s){if(f(this,pt),f(this,Ot),f(this,ws),f(this,Wc,0),f(this,Bc,0),t instanceof UA&&n(t,ws)===!!s)return t;u(this,pt,t),u(this,Ot,e),u(this,ws,!!s)}get clipBox(){return n(this,pt).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return jt(this,Bc)._++,n(this,pt).save(n(this,Ot)),this}restore(t){return n(this,Bc)>0&&(n(this,pt).restore(n(this,Ot)),jt(this,Bc)._--),this}recordOpenMarker(t){return jt(this,Wc)._++,this}getOpenMarker(){return n(this,Wc)>0?n(this,Ot):n(this,pt).getOpenMarker()}recordCloseMarker(t){return jt(this,Wc)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return n(this,pt).pushBaseTransform(t),this}popBaseTransform(){return n(this,pt).popBaseTransform(),this}recordSimpleData(t,e){return n(this,pt).recordSimpleData(t,n(this,Ot)),this}recordIncrementalData(t,e){return n(this,pt).recordIncrementalData(t,n(this,Ot)),this}resetIncrementalData(t,e){return n(this,pt).resetIncrementalData(t,n(this,Ot)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,s){return n(this,pt).recordSimpleDataFromNamed(t,e,n(this,Ot)),this}recordFutureForcedDependency(t,e){return n(this,pt).recordFutureForcedDependency(t,n(this,Ot)),this}inheritSimpleDataAsFutureForcedDependencies(t){return n(this,pt).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return n(this,pt).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return n(this,ws)||n(this,pt).resetBBox(n(this,Ot)),this}recordClipBox(t,e,s,a,r,o){return n(this,ws)||n(this,pt).recordClipBox(n(this,Ot),e,s,a,r,o),this}recordBBox(t,e,s,a,r,o){return n(this,ws)||n(this,pt).recordBBox(n(this,Ot),e,s,a,r,o),this}recordCharacterBBox(t,e,s,a,r,o,l){return n(this,ws)||n(this,pt).recordCharacterBBox(n(this,Ot),e,s,a,r,o,l),this}recordFullPageBBox(t){return n(this,ws)||n(this,pt).recordFullPageBBox(n(this,Ot)),this}getSimpleIndex(t){return n(this,pt).getSimpleIndex(t)}recordDependencies(t,e){return n(this,pt).recordDependencies(n(this,Ot),e),this}recordNamedDependency(t,e){return n(this,pt).recordNamedDependency(n(this,Ot),e),this}recordOperation(t){return n(this,pt).recordOperation(n(this,Ot),!0),this}recordShowTextOperation(t){return n(this,pt).recordShowTextOperation(n(this,Ot),!0),this}bboxToClipBoxDropOperation(t){return n(this,ws)||n(this,pt).bboxToClipBoxDropOperation(n(this,Ot),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};pt=new WeakMap,Ot=new WeakMap,ws=new WeakMap,Wc=new WeakMap,Bc=new WeakMap;let uw=tx;const Ai={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 ol,ll,kr,hl,cl,zf;const HA=class pw{constructor(t){f(this,ol),f(this,ll),f(this,kr,4),f(this,hl,0),f(this,cl,new(n(pw,zf))(n(this,kr)*6)),u(this,ol,t.width),u(this,ll,t.height)}record(t,e,s,a){if(n(this,hl)===n(this,kr)){u(this,kr,n(this,kr)*2);const l=new(n(pw,zf))(n(this,kr)*6);l.set(n(this,cl)),u(this,cl,l)}const r=R.domMatrixToTransform(t.getTransform());let o;if(a[0]!==1/0){const l=En.slice();R.axialAlignedBoundingBox([0,-s,e,0],r,l);const h=R.intersect(a,l);if(!h)return;const[c,d,p,g]=h;if(c!==l[0]||d!==l[1]||p!==l[2]||g!==l[3]){const v=Math.atan2(r[1],r[0]),w=Math.abs(Math.sin(v)),b=Math.abs(Math.cos(v));if(w<1e-6||b<1e-6||Math.abs(w-b)<1e-6)o=[c,d,c,g,p,d];else{const y=p-c,A=g-d,_=w*w,E=b*b,x=b*w,k=E-_,C=(A*E-y*x)/k,I=(A*x-y*_)/k;o=[c+I,d,c,d+C,p,g-C]}}}o||(o=[0,-s,0,0,e,-s],R.applyTransform(o,r,0),R.applyTransform(o,r,2),R.applyTransform(o,r,4)),o[0]/=n(this,ol),o[1]/=n(this,ll),o[2]/=n(this,ol),o[3]/=n(this,ll),o[4]/=n(this,ol),o[5]/=n(this,ll),n(this,cl).set(o,n(this,hl)*6),jt(this,hl)._++}take(){return n(this,cl).subarray(0,n(this,hl)*6)}};ol=new WeakMap,ll=new WeakMap,kr=new WeakMap,hl=new WeakMap,cl=new WeakMap,zf=new WeakMap,f(HA,zf,Jt.isFloat16ArraySupported?Float16Array:Float32Array);let ex=HA;var jc;class ix{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){f(this,jc,new Set),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){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),n(this,jc).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:s}){if(!(!t||n(this,jc).has(t.loadedName))){if(Tt(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:a,src:r,style:o}=t,l=new FontFace(a,r,o);this.addNativeFontFace(l);try{await l.load(),n(this,jc).add(a),s==null||s(t)}catch{Y(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}at("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 s=t.createNativeFontFace();if(s){this.addNativeFontFace(s);try{await s.loaded}catch(a){throw Y(`Failed to load font '${s.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const a=this._queueLoadingCallback(s);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){var t;const e=!!((t=this._document)!=null&&t.fonts);return G(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return G(this,"isSyncFontLoadingSupported",vi||Jt.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Tt(!a.done,"completeRequest() cannot be called twice."),a.done=!0;s.length>0&&s[0].done;){const r=s.shift();setTimeout(r.callback,0)}}const{loadingRequests:s}=this,a={done:!1,complete:e,callback:t};return s.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return G(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function s(x,k){return x.charCodeAt(k)<<24|x.charCodeAt(k+1)<<16|x.charCodeAt(k+2)<<8|x.charCodeAt(k+3)&255}function a(x){return String.fromCharCode(x>>24&255,x>>16&255,x>>
28&255,x&255)}function r(x,k,C,I){const P=x.substring(0,k),M=x.substring(k+C);return P+I+M}let o,l;const h=this._document.createElement("canvas");h.width=1,h.height=1;const c=h.getContext("2d");let d=0;function p(x,k){if(++d>30){Y("Load test font never loaded."),k();return}if(c.font="30px "+x,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){k();return}setTimeout(p.bind(null,x,k))}const g=`lt${Date.now()}${this.loadTestFontId++}`;let v=this._loadTestFont;v=r(v,976,g.length,g);const w=16,b=1482184792;let y=s(v,w);for(o=0,l=g.length-3;o<l;o+=4)y=y-b+s(g,o)|0;o<g.length&&(y=y-b+s(g+"XXX",o)|0),v=r(v,w,4,a(y));const A=`url(data:font/opentype;base64,${btoa(v)});`,_=`@font-face {font-family:"${g}";src:${A}}`;this.insertRule(_);const E=this._document.createElement("div");E.style.visibility="hidden",E.style.width=E.style.height="10px",E.style.position="absolute",E.style.top=E.style.left="0px";for(const x of[t.loadedName,g]){const k=this._document.createElement("span");k.textContent="Hi",k.style.fontFamily=x,E.append(k)}this._document.body.append(E),p(g,()=>{E.remove(),e.complete()})}}jc=new WeakMap;var gt;class sx{constructor(t,e=null,s,a){S(this,"compiledGlyphs",Object.create(null)),f(this,gt),u(this,gt,t),this._inspectFont=e,s&&(this.charProcOperatorList=s),a&&Object.assign(this,a)}createNativeFontFace(){var t;if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const s={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(s.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,s)}return(t=this._inspectFont)==null||t.call(this,this),e}createFontFaceRule(){var t;if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;let s;if(!this.cssFontInfo)s=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),s=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${e}}`}return(t=this._inspectFont)==null||t.call(this,this,e),s}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const s=this.loadedName+"_path_"+e;let a;try{a=t.get(s)}catch(o){Y(`getPathGenerator - ignoring character: "${o}".`)}const r=_A(a==null?void 0:a.path);return this.fontExtraProperties||t.delete(s),this.compiledGlyphs[e]=r}get black(){return n(this,gt).black}get bold(){return n(this,gt).bold}get disableFontFace(){return n(this,gt).disableFontFace}set disableFontFace(t){G(this,"disableFontFace",!!t)}get fontExtraProperties(){return n(this,gt).fontExtraProperties}get isInvalidPDFjsFont(){return n(this,gt).isInvalidPDFjsFont}get isType3Font(){return n(this,gt).isType3Font}get italic(){return n(this,gt).italic}get missingFile(){return n(this,gt).missingFile}get remeasure(){return n(this,gt).remeasure}get vertical(){return n(this,gt).vertical}get ascent(){return n(this,gt).ascent}get defaultWidth(){return n(this,gt).defaultWidth}get descent(){return n(this,gt).descent}get bbox(){return n(this,gt).bbox}get fontMatrix(){return n(this,gt).fontMatrix}get fallbackName(){return n(this,gt).fallbackName}get loadedName(){return n(this,gt).loadedName}get mimetype(){return n(this,gt).mimetype}get name(){return n(this,gt).name}get data(){return n(this,gt).data}clearData(){n(this,gt).clearData()}get cssFontInfo(){return n(this,gt).cssFontInfo}get systemFontInfo(){return n(this,gt).systemFontInfo}get defaultVMetrics(){return n(this,gt).defaultVMetrics}}gt=new WeakMap;class VA{}S(VA,"strings",["fontFamily","fontWeight","italicAngle"]);class zA{}S(zA,"strings",["css","loadedName","baseFontName","src"]);const Oe=class{};S(Oe,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),S(Oe,"numbers",["ascent","defaultWidth","descent"]),S(Oe,"strings",["fallbackName","loadedName","mimetype","name"]),S(Oe,"OFFSET_NUMBERS",Math.ceil(Oe.bools.length*2/8)),S(Oe,"OFFSET_BBOX",Oe.OFFSET_NUMBERS+Oe.numbers.length*8),S(Oe,"OFFSET_FONT_MATRIX",Oe.OFFSET_BBOX+1+2*4),S(Oe,"OFFSET_DEFAULT_VMETRICS",Oe.OFFSET_FONT_MATRIX+1+8*6),S(Oe,"OFFSET_STRINGS",Oe.OFFSET_DEFAULT_VMETRICS+1+2*3);let rs=Oe;class Ue{}S(Ue,"KIND",0),S(Ue,"HAS_BBOX",1),S(Ue,"HAS_BACKGROUND",2),S(Ue,"SHADING_TYPE",3),S(Ue,"N_COORD",4),S(Ue,"N_COLOR",8),S(Ue,"N_STOP",12),S(Ue,"N_FIGURES",16);var Gf,gw,zd,$c,Kp;
2class nx{constructor(t){f(this,$c),f(this,Gf),f(this,gw,new TextDecoder),f(this,zd),u(this,Gf,t),u(this,zd,new DataView(t))}get fontFamily(){return m(this,$c,Kp).call(this,0)}get fontWeight(){return m(this,$c,Kp).call(this,1)}get italicAngle(){return m(this,$c,Kp).call(this,2)}}Gf=new WeakMap,gw=new WeakMap,zd=new WeakMap,$c=new WeakSet,Kp=function(i){Tt(i<VA.strings.length,"Invalid string index");let t=0;for(let s=0;s<i;s++)t+=n(this,zd).getUint32(t)+4;const e=n(this,zd).getUint32(t);return n(this,gw).decode(new Uint8Array(n(this,Gf),t+4,e))};var ql,Gd,fn,dl,Uc;class ax{constructor(t){f(this,dl),f(this,ql),f(this,Gd,new TextDecoder),f(this,fn),u(this,ql,t),u(this,fn,new DataView(t))}get guessFallback(){return n(this,fn).getUint8(0)!==0}get css(){return m(this,dl,Uc).call(this,0)}get loadedName(){return m(this,dl,Uc).call(this,1)}get baseFontName(){return m(this,dl,Uc).call(this,2)}get src(){return m(this,dl,Uc).call(this,3)}get style(){let t=1;t+=4+n(this,fn).getUint32(t);const e=n(this,fn).getUint32(t),s=n(this,Gd).decode(new Uint8Array(n(this,ql),t+4,e));t+=4+e;const a=n(this,fn).getUint32(t),r=n(this,Gd).decode(new Uint8Array(n(this,ql),t+4,a));return{style:s,weight:r}}}ql=new WeakMap,Gd=new WeakMap,fn=new WeakMap,dl=new WeakSet,Uc=function(i){Tt(i<zA.strings.length,"Invalid string index");let t=5;for(let s=0;s<i;s++)t+=n(this,fn).getUint32(t)+4;const e=n(this,fn).getUint32(t);return n(this,Gd).decode(new Uint8Array(n(this,ql),t+4,e))};var ks,fw,Qt,Et,Ki,qp,Qp,Hc,mw;class rx{constructor({buffer:t,extra:e}){f(this,Et),f(this,ks),f(this,fw,new TextDecoder),f(this,Qt),u(this,ks,t),u(this,Qt,new DataView(t)),e&&Object.assign(this,e)}get black(){return m(this,Et,Ki).call(this,0)}get bold(){return m(this,Et,Ki).call(this,1)}get disableFontFace(){return m(this,Et,Ki).call(this,2)}get fontExtraProperties(){return m(this,Et,Ki).call(this,3)}get isInvalidPDFjsFont(){return m(this,Et,Ki).call(this,4)}get isType3Font(){return m(this,Et,Ki).call(this,5)}get italic(){return m(this,Et,Ki).call(this,6)}get missingFile(){return m(this,Et,Ki).call(this,7)}get remeasure(){return m(this,Et,Ki).call(this,8)}get vertical(){return m(this,Et,Ki).call(this,9)}get ascent(){return m(this,Et,qp).call(this,0)}get defaultWidth(){return m(this,Et,qp).call(this,1)}get descent(){return m(this,Et,qp).call(this,2)}get bbox(){return m(this,Et,Qp).call(this,rs.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return m(this,Et,Qp).call(this,rs.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return m(this,Et,Qp).call(this,rs.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return m(this,Et,Hc).call(this,0)}get loadedName(){return m(this,Et,Hc).call(this,1)}get mimetype(){return m(this,Et,Hc).call(this,2)}get name(){return m(this,Et,Hc).call(this,3)}get data(){const{offset:t,length:e}=m(this,Et,mw).call(this);return e===0?void 0:new Uint8Array(n(this,ks),t+4,e)}clearData(){const{offset:t,length:e}=m(this,Et,mw).call(this);e!==0&&(n(this,Qt).setUint32(t,0),u(this,ks,new Uint8Array(n(this,ks),0,t+4).slice().buffer),u(this,Qt,new DataView(n(this,ks))))}get cssFontInfo(){let t=rs.OFFSET_STRINGS;const e=n(this,Qt).getUint32(t);t+=4+e;const s=n(this,Qt).getUint32(t);t+=4+s;const a=n(this,Qt).getUint32(t);if(a===0)return null;const r=new Uint8Array(a);return r.set(new Uint8Array(n(this,ks),t+4,a)),new nx(r.buffer)}get systemFontInfo(){let t=rs.OFFSET_STRINGS;const e=n(this,Qt).getUint32(t);t+=4+e;const s=n(this,Qt).getUint32(t);if(s===0)return null;const a=new Uint8Array(s);return a.set(new Uint8Array(n(this,ks),t+4,s)),new ax(a.buffer)}}ks=new WeakMap,fw=new WeakMap,Qt=new WeakMap,Et=new WeakSet,Ki=function(i){Tt(i<rs.bools.length,"Invalid boolean index");const t=Math.floor(i/4),e=i*2%8,s=n(this,Qt).getUint8(t)>>e&3;return s===0?void 0:s===2},qp=function(i){return Tt(i<rs.numbers.length,"Invalid number index"),n(this,Qt).getFloat64(rs.OFFSET_NUMBERS+i*8)},Qp=function(i,t,e,s){const a=n(this,Qt).getUint8(i);if(a===0)return;Tt(a===t,"Invalid array length."),i+=1;const r=new Array(a);for(let o=0;o<a;o++)r[o]=n(this,Qt)[e](i,!0),i+=s;return r},Hc=function(i){Tt(i<rs.strings.length,"Invalid string index");let t=rs.OFFSET_STRINGS+4;for(let s=0;s<i;s++)t+=n(this,Qt).getUint32(t)+4;const e=n(this,Qt).getUint32(t);return n(this,fw).decode(new Uint8Array(n(this,ks),t+4,e))},mw=function(){let i=rs.OFFSET_STRINGS;const t=n(this,Qt).getUint32(i);i+=4+t;const e=n(this,Qt).getUint32(i);i+=4+e;const s=n(this,Qt).getUint32(i);i+=4+s;const a=n(this,Qt).getUint32(i);return{offset:i,length:a}};class ox{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){const t=this.view,e=this.data[Ue.KIND],s=!!this.data[Ue.HAS_BBOX],a=!!this.data[Ue.HAS_BACKGROUND],r=t.getUint32(Ue.N_COORD,!0),o=t.getUint32(Ue.N_COLOR,!0),l=t.getUint32(Ue.N_STOP,!0);let h=20;const c=new Float32Array(this.buffer,h,r*2);h+=r*8;const d=new Uint8Array(this.buffer,h,o*4);h+=o*4;const p=[];for(let w=0;w<l;++w){const b=t.getFloat32(h,!0);h+=4;const y=t.getUint32(h,!0);h+=4,p.push([b,`#${y.toString(16).padStart(6,"0")}`])}let g=null;if(s){g=[];for(let w=0;w<4;++w)g.push(t.getFloat32(h,!0)),h+=4}let v=null;if(a&&(v=new Uint8Array(this.buffer,h,3),h+=3),e===1)return["RadialAxial","axial",g,p,Array.from(c.slice(0,2)),Array.from(c.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",g,p,[c[0],c[1]],[c[3],c[4]],c[2],c[5]];if(e===3){const w=this.data[Ue.SHADING_TYPE];let b=null;if(c.length>0){b=En.slice();for(let y=0,A=c.length;y<A;y+=2)R.pointBoundingBox(c[y],c[y+1],b)}return["Mesh",w,c,d,r,b,g,v]}throw new Error(`Unsupported pattern kind: ${e}`)}}var Vc;class lx{constructor(t){f(this,Vc),u(this,Vc,t)}get path(){return Jt.isFloat16ArraySupported?new Float16Array(n(this,Vc)):new Float32Array(n(this,Vc))}}Vc=new WeakMap;function hx(i){if(i instanceof URL)return i;if(typeof i=="string"){if(vi){if(/^[a-z][a-z0-9\-+.]+:/i.test(i))return new URL(i);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(i))}const t=URL.parse(i,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 cx(i){if(vi&&typeof Buffer<"u"&&i instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength)return i;if(typeof i=="string")return km(i);if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)||typeof i=="object"&&!isNaN(i==null?void 0:i.length))return new Uint8Array(i);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}
2function Ku(i){if(typeof i!="string")return null;if(i.endsWith("/"))return i;throw new Error(`Invalid factory url: "${i}" must include trailing slash.`)}const vw=i=>typeof i=="object"&&Number.isInteger(i==null?void 0:i.num)&&i.num>=0&&Number.isInteger(i==null?void 0:i.gen)&&i.gen>=0,dx=i=>typeof i=="object"&&typeof(i==null?void 0:i.name)=="string",ux=RE.bind(null,vw,dx);var zn,ww;class px{constructor(){f(this,zn,new Map),f(this,ww,Promise.resolve())}postMessage(t,e){const s={data:structuredClone(t,e?{transfer:e}:null)};n(this,ww).then(()=>{for(const[a]of n(this,zn))a.call(this,s)})}addEventListener(t,e,s=null){let a=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:r}=s;if(r.aborted){Y("LoopbackPort - cannot use an `aborted` signal.");return}const o=()=>this.removeEventListener(t,e);a=()=>r.removeEventListener("abort",o),r.addEventListener("abort",o)}n(this,zn).set(e,a)}removeEventListener(t,e){const s=n(this,zn).get(e);s==null||s(),n(this,zn).delete(e)}terminate(){for(const[,t]of n(this,zn))t==null||t();n(this,zn).clear()}}zn=new WeakMap,ww=new WeakMap;const qu={DATA:1,ERROR:2},Xt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function j0(){}function Qe(i){if(i instanceof Fa||i instanceof zv||i instanceof l0||i instanceof $f||i instanceof $m)return i;switch(i instanceof Error||typeof i=="object"&&i!==null||at('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),i.name){case"AbortException":return new Fa(i.message);case"InvalidPDFException":return new zv(i.message);case"PasswordException":return new l0(i.message,i.code);case"ResponseException":return new $f(i.message,i.status,i.missing);case"UnknownErrorException":return new $m(i.message,i.details)}return new $m(i.message,i.toString())}var zc,ca,GA,$0,U0,Qu;class Gc{constructor(t,e,s){f(this,ca),f(this,zc,new AbortController),this.sourceName=t,this.targetName=e,this.comObj=s,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),s.addEventListener("message",m(this,ca,GA).bind(this),{signal:n(this,zc).signal})}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const a=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[a]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:e},s)}catch(o){r.reject(o)}return r.promise}sendWithStream(t,e,s,a){const r=this.streamId++,o=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:c=>{const d=Promise.withResolvers();return this.streamControllers[r]={controller:c,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:o,targetName:l,action:t,streamId:r,data:e,desiredSize:c.desiredSize},a),d.promise},pull:c=>{const d=Promise.withResolvers();return this.streamControllers[r].pullCall=d,h.postMessage({sourceName:o,targetName:l,stream:Xt.PULL,streamId:r,desiredSize:c.desiredSize}),d.promise},cancel:c=>{Tt(c instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[r].cancelCall=d,this.streamControllers[r].isClosed=!0,h.postMessage({sourceName:o,targetName:l,stream:Xt.CANCEL,streamId:r,reason:Qe(c)}),d.promise}},s)}destroy(){var t;(t=n(this,zc))==null||t.abort(),u(this,zc,null)}}zc=new WeakMap,ca=new WeakSet,GA=function({data:i}){if(i.targetName!==this.sourceName)return;if(i.stream){m(this,ca,U0).call(this,i);return}if(i.callback){const e=i.callbackId,s=this.callbackCapabilities[e];if(!s)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],i.callback===qu.DATA)s.resolve(i.data);else if(i.callback===qu.ERROR)s.reject(Qe(i.reason));else throw new Error("Unexpected callback case");return}const t=this.actionHandler[i.action];if(!t)throw new Error(`Unknown action from worker: ${i.action}`);if(i.callbackId){const e=this.sourceName,s=i.sourceName,a=this.comObj;Promise.try(t,i.data).then(function(r){a.postMessage({sourceName:e,targetName:s,callback:qu.DATA,callbackId:i.callbackId,data:r})},function(r){a.postMessage({sourceName:e,targetName:s,callback:qu.ERROR,callbackId:i.callbackId,reason:Qe(r)})});return}if(i.streamId){m(this,ca,$0).call(this,i);return}t(i.data)},$0=function(i){const t=i.streamId,e=this.sourceName,s=i.sourceName,a=this.comObj,r=this,o=this.actionHandler[i.action],l={enqueue(h,c=1,d){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),a.postMessage({sourceName:e,targetName:s,stream:Xt.ENQUEUE,streamId:t,chunk:h},d)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:e,targetName:s,stream:Xt.CLOSE,streamId:t}),delete r.streamSinks[t])},error(h){Tt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:e,targetName:s,stream:Xt.ERROR,streamId:t,reason:Qe(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:i.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[t]=l,Promise.try(o,i.data,l).then(function(){a.postMessage({sourceName:e,targetName:s,stream:Xt.START_COMPLETE,streamId:t,success:!0})},function(h){a.postMessage({sourceName:e,targetName:s,stream:Xt.START_COMPLETE,streamId:t,reason:Qe(h)})})},U0=function(i){const t=i.streamId,e=this.sourceName,s=i.sourceName,a=this.comObj,r=this.streamControllers[t],o=this.streamSinks[t];switch(i.stream){case Xt.START_COMPLETE:i.success?r.startCall.resolve():r.startCall.reject(Qe(i.reason));break;case Xt.PULL_COMPLETE:i.success?r.pullCall.resolve():r.pullCall.reject(Qe(i.reason));break;case Xt.PULL:if(!o){a.postMessage({sourceName:e,targetName:s,stream:Xt.PULL_COMPLETE,streamId:t,success:!0});break}o.desiredSize<=0&&i.desiredSize>0&&o.sinkCapability.resolve(),o.desiredSize=i.desiredSize,Promise.try(o.onPull||j0).then(function(){a.postMessage({sourceName:e,targetName:s,stream:Xt.PULL_COMPLETE,streamId:t,success:!0})},function(h){a.postMessage({sourceName:e,targetName:s,stream:Xt.PULL_COMPLETE,streamId:t,reason:Qe(h)})});break;case Xt.ENQUEUE:if(Tt(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(i.chunk);break;case Xt.CLOSE:if(Tt(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),m(this,ca,Qu).call(this,r,t);break;case Xt.ERROR:Tt(r,"error should have stream controller"),r.controller.error(Qe(i.reason)),m(this,ca,Qu).call(this,r,t);break;
2case Xt.CANCEL_COMPLETE:i.success?r.cancelCall.resolve():r.cancelCall.reject(Qe(i.reason)),m(this,ca,Qu).call(this,r,t);break;case Xt.CANCEL:if(!o)break;const l=Qe(i.reason);Promise.try(o.onCancel||j0,l).then(function(){a.postMessage({sourceName:e,targetName:s,stream:Xt.CANCEL_COMPLETE,streamId:t,success:!0})},function(h){a.postMessage({sourceName:e,targetName:s,stream:Xt.CANCEL_COMPLETE,streamId:t,reason:Qe(h)})}),o.sinkCapability.reject(l),o.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}},Qu=async function(i,t){var e,s,a;await Promise.allSettled([(e=i.startCall)==null?void 0:e.promise,(s=i.pullCall)==null?void 0:s.promise,(a=i.cancelCall)==null?void 0:a.promise]),delete this.streamControllers[t]};var bw;class XA{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:s=null}){f(this,bw,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"})),this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=s}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:at(`Not implemented: ${t}`)}const s=this[t];if(!s)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);const a=`${s}${e}`;return this._fetch(a,t).catch(r=>{throw new Error(`Unable to load ${n(this,bw)[t]} data at: ${a}`)})}async _fetch(t,e){at("Abstract method `_fetch` called.")}}bw=new WeakMap;class H0 extends XA{async _fetch(t,e){const s=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",a=await zb(t,s);return a instanceof Uint8Array?a:km(a)}}var Jp;class YA{constructor({enableHWA:t=!1}){f(this,Jp,!1),u(this,Jp,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d",{willReadFrequently:!n(this,Jp)})}}reset({canvas:t},e,s){if(!t)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.width=e,t.height=s}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){at("Abstract method `_createCanvas` called.")}}Jp=new WeakMap;class gx extends YA{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}class KA{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,s,a,r){return"none"}destroy(t=!1){}}var ul,vh,ma,Gn,We,ho,pl,H,ke,Xc,Ql,Zp,gl,qA,yw,fl,Gh,Yc,Aw,Kc;class fx extends KA{constructor({docId:t,ownerDocument:e=globalThis.document}){super(),f(this,H),f(this,ul),f(this,vh),f(this,ma),f(this,Gn),f(this,We),f(this,ho),f(this,pl,0),u(this,Gn,t),u(this,We,e)}addFilter(t){if(!t)return"none";let e=n(this,H,ke).get(t);if(e)return e;const[s,a,r]=m(this,H,Zp).call(this,t),o=t.length===1?s:`${s}${a}${r}`;if(e=n(this,H,ke).get(o),e)return n(this,H,ke).set(t,e),e;const l=`g_${n(this,Gn)}_transfer_map_${jt(this,pl)._++}`,h=m(this,H,gl).call(this,l);n(this,H,ke).set(t,h),n(this,H,ke).set(o,h);const c=m(this,H,fl).call(this,l);return m(this,H,Yc).call(this,s,a,r,c),h}addHCMFilter(t,e){var s;const a=`${t}-${e}`,r="base";let o=n(this,H,Xc).get(r);if((o==null?void 0:o.key)===a||(o?((s=o.filter)==null||s.remove(),o.key=a,o.url="none",o.filter=null):(o={key:a,url:"none",filter:null},n(this,H,Xc).set(r,o)),!t||!e))return o.url;const l=m(this,H,Kc).call(this,t);t=R.makeHexColor(...l);const h=m(this,H,Kc).call(this,e);if(e=R.makeHexColor(...h),n(this,H,Ql).style.color="",t==="#000000"&&e==="#ffffff"||t===e)return o.url;const c=new Array(256);for(let w=0;w<=255;w++){const b=w/255;c[w]=b<=.03928?b/12.92:((b+.055)/1.055)**2.4}const d=c.join(","),p=`g_${n(this,Gn)}_hcm_filter`,g=o.filter=m(this,H,fl).call(this,p);m(this,H,Yc).call(this,d,d,d,g),m(this,H,yw).call(this,g);const v=(w,b)=>{const y=l[w]/255,A=h[w]/255,_=new Array(b+1);for(let E=0;E<=b;E++)_[E]=y+E/b*(A-y);return _.join(",")};return m(this,H,Yc).call(this,v(0,5),v(1,5),v(2,5),g),o.url=m(this,H,gl).call(this,p),o.url}addAlphaFilter(t){let e=n(this,H,ke).get(t);if(e)return e;const[s]=m(this,H,Zp).call(this,[t]),a=`alpha_${s}`;if(e=n(this,H,ke).get(a),e)return n(this,H,ke).set(t,e),e;const r=`g_${n(this,Gn)}_alpha_map_${jt(this,pl)._++}`,o=m(this,H,gl).call(this,r);
2n(this,H,ke).set(t,o),n(this,H,ke).set(a,o);const l=m(this,H,fl).call(this,r);return m(this,H,Aw).call(this,s,l),o}addLuminosityFilter(t){let e=n(this,H,ke).get(t||"luminosity");if(e)return e;let s,a;if(t?([s]=m(this,H,Zp).call(this,[t]),a=`luminosity_${s}`):a="luminosity",e=n(this,H,ke).get(a),e)return n(this,H,ke).set(t,e),e;const r=`g_${n(this,Gn)}_luminosity_map_${jt(this,pl)._++}`,o=m(this,H,gl).call(this,r);n(this,H,ke).set(t,o),n(this,H,ke).set(a,o);const l=m(this,H,fl).call(this,r);return m(this,H,qA).call(this,l),t&&m(this,H,Aw).call(this,s,l),o}addHighlightHCMFilter(t,e,s,a,r){var o;const l=`${e}-${s}-${a}-${r}`;let h=n(this,H,Xc).get(t);if((h==null?void 0:h.key)===l||(h?((o=h.filter)==null||o.remove(),h.key=l,h.url="none",h.filter=null):(h={key:l,url:"none",filter:null},n(this,H,Xc).set(t,h)),!e||!s))return h.url;const[c,d]=[e,s].map(m(this,H,Kc).bind(this));let p=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),g=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[v,w]=[a,r].map(m(this,H,Kc).bind(this));g<p&&([p,g,v,w]=[g,p,w,v]),n(this,H,Ql).style.color="";const b=(_,E,x)=>{const k=new Array(256),C=(g-p)/x,I=_/255,P=(E-_)/(255*x);let M=0;for(let D=0;D<=x;D++){const L=Math.round(p+D*C),W=I+D*P;for(let $=M;$<=L;$++)k[$]=W;M=L+1}for(let D=M;D<256;D++)k[D]=k[M-1];return k.join(",")},y=`g_${n(this,Gn)}_hcm_${t}_filter`,A=h.filter=m(this,H,fl).call(this,y);return m(this,H,yw).call(this,A),m(this,H,Yc).call(this,b(v[0],w[0],5),b(v[1],w[1],5),b(v[2],w[2],5),A),h.url=m(this,H,gl).call(this,y),h.url}destroy(t=!1){var e,s,a,r;t&&(e=n(this,ho))!=null&&e.size||((s=n(this,ma))==null||s.parentNode.parentNode.remove(),u(this,ma,null),(a=n(this,vh))==null||a.clear(),u(this,vh,null),(r=n(this,ho))==null||r.clear(),u(this,ho,null),u(this,pl,0))}}ul=new WeakMap,vh=new WeakMap,ma=new WeakMap,Gn=new WeakMap,We=new WeakMap,ho=new WeakMap,pl=new WeakMap,H=new WeakSet,ke=function(){return n(this,vh)||u(this,vh,new Map)},Xc=function(){return n(this,ho)||u(this,ho,new Map)},Ql=function(){if(!n(this,ma)){const i=n(this,We).createElement("div"),{style:t}=i;t.visibility="hidden",t.contain="strict",t.width=t.height=0,t.position="absolute",t.top=t.left=0,t.zIndex=-1;const e=n(this,We).createElementNS(Hs,"svg");e.setAttribute("width",0),e.setAttribute("height",0),u(this,ma,n(this,We).createElementNS(Hs,"defs")),i.append(e),e.append(n(this,ma)),n(this,We).body.append(i)}return n(this,ma)},Zp=function(i){if(i.length===1){const l=i[0],h=new Array(256);for(let d=0;d<256;d++)h[d]=l[d]/255;const c=h.join(",");return[c,c,c]}const[t,e,s]=i,a=new Array(256),r=new Array(256),o=new Array(256);for(let l=0;l<256;l++)a[l]=t[l]/255,r[l]=e[l]/255,o[l]=s[l]/255;return[a.join(","),r.join(","),o.join(",")]},gl=function(i){if(n(this,ul)===void 0){u(this,ul,"");const t=n(this,We).URL;t!==n(this,We).baseURI&&(Sm(t)?Y('#createUrl: ignore "data:"-URL for performance reasons.'):u(this,ul,wA(t,"")))}return`url(${n(this,ul)}#${i})`},qA=function(i){const t=n(this,We).createElementNS(Hs,"feColorMatrix");t.setAttribute("type","matrix"),t.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"),i.append(t)},yw=function(i){const t=n(this,We).createElementNS(Hs,"feColorMatrix");t.setAttribute("type","matrix"),t.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"),i.append(t)},fl=function(i){const t=n(this,We).createElementNS(Hs,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",i),n(this,H,Ql).append(t),t},Gh=function(i,t,e){const s=n(this,We).createElementNS(Hs,t);s.setAttribute("type","discrete"),s.setAttribute("tableValues",e),i.append(s)},Yc=function(i,t,e,s){const a=n(this,We).createElementNS(Hs,"feComponentTransfer");
2s.append(a),m(this,H,Gh).call(this,a,"feFuncR",i),m(this,H,Gh).call(this,a,"feFuncG",t),m(this,H,Gh).call(this,a,"feFuncB",e)},Aw=function(i,t){const e=n(this,We).createElementNS(Hs,"feComponentTransfer");t.append(e),m(this,H,Gh).call(this,e,"feFuncA",i)},Kc=function(i){return n(this,H,Ql).style.color=i,Cu(getComputedStyle(n(this,H,Ql)).getPropertyValue("color"))};vi&&Y("Please use the `legacy` build in Node.js environments.");async function mx(i){const t=await process.getBuiltinModule("fs/promises").readFile(i);return new Uint8Array(t)}class vx extends KA{}class wx extends YA{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t,e)}}class bx extends XA{async _fetch(t,e){return mx(t)}}const yx=` 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`;var tg,da,ml,Xd,_w,QA;class Ax{constructor(){f(this,_w),f(this,tg,null),f(this,da,null),f(this,ml,null),f(this,Xd,null)}init(){return n(this,tg)||u(this,tg,m(this,_w,QA).call(this))}get isReady(){return n(this,da)!==null}loadMeshShader(){if(!n(this,da)||n(this,ml))return;const t=n(this,da).createShaderModule({code:yx});u(this,ml,n(this,da).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,Xd)}]},primitive:{topology:"triangle-list"}}))}draw(t,e,s,a,r,o,l,h){this.loadMeshShader();const c=n(this,da),{offsetX:d,offsetY:p,scaleX:g,scaleY:v}=a,w=c.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&c.queue.writeBuffer(w,0,t);const b=c.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&c.queue.writeBuffer(b,0,e);const y=c.createBuffer({size:8*4,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});c.queue.writeBuffer(y,0,new Float32Array([d,p,g,v,o,l,h,0]));const A=c.createBindGroup({layout:n(this,ml).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:y}}]}),_=new OffscreenCanvas(o,l),E=_.getContext("webgpu");E.configure({device:c,format:n(this,Xd),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},k=c.createCommandEncoder(),C=k.beginRenderPass({colorAttachments:[{view:E.getCurrentTexture().createView(),clearValue:x,loadOp:"clear",storeOp:"store"}]});return s>0&&(C.setPipeline(n(this,ml)),C.setBindGroup(0,A),C.setVertexBuffer(0,w),C.setVertexBuffer(1,b),C.draw(s)),C.end(),c.queue.submit([k.finish()]),w.destroy(),b.destroy(),y.destroy(),_.transferToImageBitmap()}}tg=new WeakMap,da=new WeakMap,ml=new WeakMap,Xd=new WeakMap,_w=new WeakSet,QA=async function(){var i;if(!((i=globalThis.navigator)!=null&&i.gpu))return!1;try{const t=await navigator.gpu.requestAdapter();return t?(u(this,Xd,navigator.gpu.getPreferredCanvasFormat()),u(this,da,await t.requestDevice()),!0):!1}catch{return!1}};const Mm=new Ax;function _x(){return Mm.init()}function Ex(){return Mm.isReady}function xx(){Mm.loadMeshShader()}function kx(i,t,e,s,a,r,o,l){return Mm.draw(i,t,e,s,a,r,o,l)}const Ae={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function eg(i,t){if(!t)return;const e=t[2]-t[0],s=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],e,s),i.clip(a)}class Qb{isModifyingCurrentTransform(){return!1}getPattern(){at("Abstract method `getPattern` called.")}}class Sx extends Qb{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],this.matrix=null}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 s,a=this._p0,r=this._p1;
45if(e&&(a=a.slice(),r=r.slice(),R.applyTransform(a,e),R.applyTransform(r,e)),this._type==="axial")s=t.createLinearGradient(a[0],a[1],r[0],r[1]);else if(this._type==="radial"){let o=this._r0,l=this._r1;if(e){const h=new Float32Array(2);R.singularValueDecompose2dScale(e,h),o*=h[0],l*=h[0]}s=t.createRadialGradient(a[0],a[1],o,r[0],r[1],l)}for(const o of this._colorStops)s.addColorStop(o[0],o[1]);return s}_createReversedGradient(t,e=null){let s=this._p1,a=this._p0;e&&(s=s.slice(),a=a.slice(),R.applyTransform(s,e),R.applyTransform(a,e));let r=this._r1,o=this._r0;if(e){const c=new Float32Array(2);R.singularValueDecompose2dScale(e,c),r*=c[0],o*=c[0]}const l=t.createRadialGradient(s[0],s[1],r,a[0],a[1],o),h=this._colorStops.map(([c,d])=>[1-c,d]).reverse();for(const[c,d]of h)l.addColorStop(c,d);return l}getPattern(t,e,s,a){let r;if(a===Ae.STROKE||a===Ae.FILL){if(this.isOriginBased()){let g=R.transform(s,e.baseTransform);this.matrix&&(g=R.transform(g,this.matrix));const v=.001,w=Math.hypot(g[0],g[1]),b=Math.hypot(g[2],g[3]),y=(g[0]*g[2]+g[1]*g[3])/(w*b);if(Math.abs(y)<v)if(this.isRadial()){if(Math.abs(w-b)<v)return this._createGradient(t,g)}else return this._createGradient(t,g)}const o=e.current.getClippedPathBoundingBox(a,vt(t))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,h=Math.ceil(o[3]-o[1])||1,c=e.canvasFactory.create(l,h),d=c.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-o[0],-o[1]),s=R.transform(s,[1,0,0,1,o[0],o[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),eg(d,this._bbox),this.areConic()&&(d.fillStyle=this._createReversedGradient(d),d.fill()),d.fillStyle=this._createGradient(d),d.fill(),r=t.createPattern(c.canvas,"no-repeat"),e.canvasFactory.destroy(c);const p=new DOMMatrix(s);r.setTransform(p)}else this.areConic()&&(t.save(),eg(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),eg(t,this._bbox),r=this._createGradient(t);return r}}function Mx(i,t,e,s,a,r,o,l){const h=t.coords,c=t.colors,d=i.data,p=i.width*4;let g;h[e*2+1]>h[s*2+1]&&(g=e,e=s,s=g,g=r,r=o,o=g),h[s*2+1]>h[a*2+1]&&(g=s,s=a,a=g,g=o,o=l,l=g),h[e*2+1]>h[s*2+1]&&(g=e,e=s,s=g,g=r,r=o,o=g);const v=(h[e*2]+t.offsetX)*t.scaleX,w=(h[e*2+1]+t.offsetY)*t.scaleY,b=(h[s*2]+t.offsetX)*t.scaleX,y=(h[s*2+1]+t.offsetY)*t.scaleY,A=(h[a*2]+t.offsetX)*t.scaleX,_=(h[a*2+1]+t.offsetY)*t.scaleY;if(w>=_)return;const E=c[r*4],x=c[r*4+1],k=c[r*4+2],C=c[o*4],I=c[o*4+1],P=c[o*4+2],M=c[l*4],D=c[l*4+1],L=c[l*4+2],W=Math.round(w),$=Math.round(_);let j,F,N,Q,X,oe,_e,Re;for(let yt=W;yt<=$;yt++){if(yt<y){const Ut=yt<w?0:(w-yt)/(w-y);j=v-(v-b)*Ut,F=E-(E-C)*Ut,N=x-(x-I)*Ut,Q=k-(k-P)*Ut}else{let Ut;yt>_?Ut=1:y===_?Ut=0:Ut=(y-yt)/(y-_),j=b-(b-A)*Ut,F=C-(C-M)*Ut,N=I-(I-D)*Ut,Q=P-(P-L)*Ut}let St;yt<w?St=0:yt>_?St=1:St=(w-yt)/(w-_),X=v-(v-A)*St,oe=E-(E-M)*St,_e=x-(x-D)*St,Re=k-(k-L)*St;const xo=Math.round(Math.min(j,X)),Ne=Math.round(Math.max(j,X));let He=p*yt+xo*4;for(let Ut=xo;Ut<=Ne;Ut++)St=(j-Ut)/(j-X),St<0?St=0:St>1&&(St=1),d[He++]=F-(F-oe)*St|0,d[He++]=N-(N-_e)*St|0,d[He++]=Q-(Q-Re)*St|0,d[He++]=255}}class Cx extends Qb{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],this.matrix=null,xx()}_createMeshCanvas(t,e,s){const a=Math.floor(this._bounds[0]),r=Math.floor(this._bounds[1]),o=Math.ceil(this._bounds[2])-a,l=Math.ceil(this._bounds[3])-r,h=Math.min(Math.ceil(Math.abs(o*t[0]*1.1)),3e3)||1,c=Math.min(Math.ceil(Math.abs(l*t[1]*1.1)),3e3)||1,d=o?o/h:1,p=l?l/c:1,g={coords:this._posData,colors:this._colData,offsetX:-a,offsetY:-r,scaleX:1/d,scaleY:1/p},v=h+2*2,w=c+2*2,b=s.create(v,w);if(Ex()&&this._vertexCount>48)b.context.drawImage(kx(this._posData,this._colData,this._vertexCount,g,e,v,w,2),0,0);else{const y=b.context.createImageData(h,c);if(e){const A=y.data;for(let _=0,E=A.length;_<E;_+=4)A[_]=e[0],A[_+1]=e[1],A[_+2]=e[2],A[_+3]=255}for(let A=0,_=this._vertexCount;A<_;A+=3)Mx(y,g,A,A+1,A+2,A,A+1,A+2);b.context.putImageData(y,2,2)}return{canvas:b.canvas,offsetX:a-2*d,offsetY:r-2*p,scaleX:d,scaleY:p}}isModifyingCurrentTransform(){return!0}getPattern(t,e,s,a){eg(t,this._bbox);const r=new Float32Array(2);if(a===Ae.SHADING)R.singularValueDecompose2dScale(vt(t),r);
45else if(this.matrix){R.singularValueDecompose2dScale(this.matrix,r);const[h,c]=r;R.singularValueDecompose2dScale(e.baseTransform,r),r[0]*=h,r[1]*=c}else R.singularValueDecompose2dScale(e.baseTransform,r);const o=this._createMeshCanvas(r,a===Ae.SHADING?null:this._background,e.canvasFactory);a!==Ae.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(o.offsetX,o.offsetY),t.scale(o.scaleX,o.scaleY);const l=t.createPattern(o.canvas,"no-repeat");return e.canvasFactory.destroy(o),l}}class Px extends Qb{getPattern(){return"hotpink"}}function Tx(i){switch(i[0]){case"RadialAxial":return new Sx(i);case"Mesh":return new Cx(i);case"Dummy":return new Px}throw new Error(`Unknown IR type: ${i[0]}`)}const V0={COLORED:1,UNCOLORED:2},JA=class ZA{constructor(t,e,s,a){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=s,this.baseTransform=a,this.patternBaseMatrix=this.matrix?R.transform(a,this.matrix):a}canSkipPatternCanvas([t,e,s,a]){const[r,o,l,h]=this.bbox,c=Math.abs(this.xstep),d=Math.abs(this.ystep);if(t>c+1e-6||e>d+1e-6)return null;const p=Math.floor((s-l)/c)+1,g=Math.ceil((s+t-r)/c)-1,v=Math.floor((a-h)/d)+1,w=Math.ceil((a+e-o)/d)-1;return g<=p&&w<=v?[p,v]:null}updatePatternDims(t,e){const s=R.inverseTransform(this.patternBaseMatrix),a=[t[0],t[1]],r=[t[2],t[3]];R.applyTransform(a,s),R.applyTransform(r,s),e[0]=Math.abs(r[0]-a[0]),e[1]=Math.abs(r[1]-a[1]),e[2]=Math.min(a[0],r[0]),e[3]=Math.min(a[1],r[1])}_renderTileCanvas(t,e,s,a){var r,o;const[l,h,c,d]=this.bbox,p=t.canvasFactory.create(s.size,a.size),g=p.context,v=this.canvasGraphicsFactory.createCanvasGraphics(g,e);return v.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(v,this.paintType,this.color),g.translate(-s.scale*l,-a.scale*h),v.transform(0,s.scale,0,0,a.scale,0,0),g.save(),(r=v.dependencyTracker)==null||r.save(),this.clipBbox(v,l,h,c,d),v.baseTransform=vt(v.ctx),v.executeOperatorList(this.operatorList),v.endDrawing(),(o=v.dependencyTracker)==null||o.restore(),g.restore(),p}_getCombinedScales(){const t=new Float32Array(2);R.singularValueDecompose2dScale(this.matrix,t);const[e,s]=t;return R.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],s*t[1]]}drawPattern(t,e,s=!1,[a,r],o){const[l,h,c,d]=this.bbox,p=t.dependencyTracker;if(p&&(t.dependencyTracker=new uw(p,o)),t.save(),s?t.ctx.clip(e,"evenodd"):t.ctx.clip(e),t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(a*this.xstep,r*this.ystep),this.needsIsolation||t.ctx.globalAlpha!==1||t.ctx.globalCompositeOperation!=="source-over"||t.inSMaskMode){const g=c-l,v=d-h,[w,b]=this._getCombinedScales(),y=this.getSizeAndScale(g,this.ctx.canvas.width,w),A=this.getSizeAndScale(v,this.ctx.canvas.height,b),_=this._renderTileCanvas(t,o,y,A);t.ctx.drawImage(_.canvas,l,h,g,v),t.canvasFactory.destroy(_)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,l,h,c,d),t.baseTransformStack.push(t.baseTransform),t.baseTransform=vt(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();t.restore(),p&&(t.dependencyTracker=p)}createPatternCanvas(t,e){const[s,a,r,o]=this.bbox,l=r-s,h=o-a;let{xstep:c,ystep:d}=this;c=Math.abs(c),d=Math.abs(d),xm("TilingType: "+this.tilingType);const[p,g]=this._getCombinedScales();let v=l,w=h,b=!1,y=!1;Math.ceil(c*p)>=Math.ceil(l*p)?v=c:b=!0,Math.ceil(d*g)>=Math.ceil(h*g)?w=d:y=!0;const A=this.getSizeAndScale(v,this.ctx.canvas.width,p),_=this.getSizeAndScale(w,this.ctx.canvas.height,g),E=this._renderTileCanvas(t,e,A,_);if(b||y){const x=E.canvas;b&&(v=c),y&&(w=d);const k=this.getSizeAndScale(v,this.ctx.canvas.width,p),C=this.getSizeAndScale(w,this.ctx.canvas.height,g),I=k.size,P=C.size,M=t.canvasFactory.create(I,P),D=M.context,L=b?Math.floor(l/c):0,W=y?Math.floor(h/d):0;for(let $=0;$<=L;$++)for(let j=0;j<=W;j++)D.drawImage(x,I*$,P*j,I,P,0,0,I,P);return t.canvasFactory.destroy(E),{canvas:M.canvas,canvasEntry:M,scaleX:k.scale,scaleY:C.scale,offsetX:s,offsetY:a}}return{canvas:E.canvas,canvasEntry:E,scaleX:A.scale,scaleY:_.scale,offsetX:s,offsetY:a}}getSizeAndScale(t,e,s){const a=Math.max(ZA.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*s);return r>=a?r=a:s=r/t,{scale:s,size:r}}clipBbox(t,e,s,a,r){const o=a-e,l=r-s,h=new Path2D;h.rect(e,s,o,l),R.axialAlignedBoundingBox([e,s,a,r],vt(t.ctx),t.current.minMax),t.ctx.clip(h),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,s){const a=t.ctx,r=t.current;switch(r.patternFill=r.patternStroke=!1,e){case V0.COLORED:const{fillStyle:o,strokeStyle:l}=this.ctx;a.fillStyle=r.fillColor=o,a.strokeStyle=r.strokeColor=l;break;case V0.UNCOLORED:a.fillStyle=a.strokeStyle=s,r.fillColor=r.strokeColor=s;break;default:throw new PE(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,s,a,r){const o=a!==Ae.SHADING?R.transform(s,this.patternBaseMatrix):s,l=this.createPatternCanvas(e,r);let h=new DOMMatrix(o);h=h.translate(l.offsetX,l.offsetY),h=h.scale(1/l.scaleX,1/l.scaleY);const c=t.createPattern(l.canvas,"repeat");return e.canvasFactory.destroy(l.canvasEntry),c.setTransform(h),c}};S(JA,"MAX_PATTERN_SIZE",3e3);let tv=JA;function Ix({src:i,srcPos:t=0,dest:e,width:s,height:a,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const l=Jt.isLittleEndian?4278190080:255,[h,c]=o?[r,l]:[l,r],d=s>>3,p=s&7,g=h^c,v=i.length;
45e=new Uint32Array(e.buffer);let w=0;for(let b=0;b<a;++b){for(const A=t+d;t<A;++t,w+=8){const _=i[t];e[w]=h^-(_>>7&1)&g,e[w+1]=h^-(_>>6&1)&g,e[w+2]=h^-(_>>5&1)&g,e[w+3]=h^-(_>>4&1)&g,e[w+4]=h^-(_>>3&1)&g,e[w+5]=h^-(_>>2&1)&g,e[w+6]=h^-(_>>1&1)&g,e[w+7]=h^-(_&1)&g}if(p===0)continue;const y=t<v?i[t++]:255;for(let A=0;A<p;++A,++w)e[w]=h^-(y>>7-A&1)&g}return{srcPos:t,destPos:w}}const z0=16,G0=100,Dx=15,X0=10,ti=16,ev=new DOMMatrix,wi=new Float32Array(2);function Lx(i,t){if(i._removeMirroring)throw new Error("Context is already forwarding operations.");i.__originalSave=i.save,i.__originalRestore=i.restore,i.__originalRotate=i.rotate,i.__originalScale=i.scale,i.__originalTranslate=i.translate,i.__originalTransform=i.transform,i.__originalSetTransform=i.setTransform,i.__originalResetTransform=i.resetTransform,i.__originalClip=i.clip,i.__originalMoveTo=i.moveTo,i.__originalLineTo=i.lineTo,i.__originalBezierCurveTo=i.bezierCurveTo,i.__originalRect=i.rect,i.__originalClosePath=i.closePath,i.__originalBeginPath=i.beginPath,i._removeMirroring=()=>{i.save=i.__originalSave,i.restore=i.__originalRestore,i.rotate=i.__originalRotate,i.scale=i.__originalScale,i.translate=i.__originalTranslate,i.transform=i.__originalTransform,i.setTransform=i.__originalSetTransform,i.resetTransform=i.__originalResetTransform,i.clip=i.__originalClip,i.moveTo=i.__originalMoveTo,i.lineTo=i.__originalLineTo,i.bezierCurveTo=i.__originalBezierCurveTo,i.rect=i.__originalRect,i.closePath=i.__originalClosePath,i.beginPath=i.__originalBeginPath,delete i._removeMirroring},i.save=function(){t.save(),this.__originalSave()},i.restore=function(){t.restore(),this.__originalRestore()},i.translate=function(e,s){t.translate(e,s),this.__originalTranslate(e,s)},i.scale=function(e,s){t.scale(e,s),this.__originalScale(e,s)},i.transform=function(e,s,a,r,o,l){t.transform(e,s,a,r,o,l),this.__originalTransform(e,s,a,r,o,l)},i.setTransform=function(e,s,a,r,o,l){s===void 0?(t.setTransform(e),this.__originalSetTransform(e)):(t.setTransform(e,s,a,r,o,l),this.__originalSetTransform(e,s,a,r,o,l))},i.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},i.rotate=function(e){t.rotate(e),this.__originalRotate(e)},i.clip=function(e){t.clip(e),this.__originalClip(e)},i.moveTo=function(e,s){t.moveTo(e,s),this.__originalMoveTo(e,s)},i.lineTo=function(e,s){t.lineTo(e,s),this.__originalLineTo(e,s)},i.bezierCurveTo=function(e,s,a,r,o,l){t.bezierCurveTo(e,s,a,r,o,l),this.__originalBezierCurveTo(e,s,a,r,o,l)},i.rect=function(e,s,a,r){t.rect(e,s,a,r),this.__originalRect(e,s,a,r)},i.closePath=function(){t.closePath(),this.__originalClosePath()},i.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}function Ju(i,t,e,s,a,r,o,l,h,c){const[d,p,g,v,w,b]=vt(i);if(p===0&&g===0){const _=o*d+w,E=Math.round(_),x=l*v+b,k=Math.round(x),C=(o+h)*d+w,I=Math.abs(Math.round(C)-E)||1,P=(l+c)*v+b,M=Math.abs(Math.round(P)-k)||1;return i.setTransform(Math.sign(d),0,0,Math.sign(v),E,k),i.drawImage(t,e,s,a,r,0,0,I,M),i.setTransform(d,p,g,v,w,b),[I,M]}if(d===0&&v===0){const _=l*g+w,E=Math.round(_),x=o*p+b,k=Math.round(x),C=(l+c)*g+w,I=Math.abs(Math.round(C)-E)||1,P=(o+h)*p+b,M=Math.abs(Math.round(P)-k)||1;return i.setTransform(0,Math.sign(p),Math.sign(g),0,E,k),i.drawImage(t,e,s,a,r,0,0,M,I),i.setTransform(d,p,g,v,w,b),[M,I]}i.drawImage(t,e,s,a,r,o,l,h,c);const y=Math.hypot(d,p),A=Math.hypot(g,v);return[y*h,A*c]}class Y0{constructor(t,e){S(this,"alphaIsShape",!1),S(this,"fontSize",0),S(this,"fontSizeScale",1),S(this,"textMatrix",null),S(this,"textMatrixScale",1),S(this,"fontMatrix",Hv),S(this,"leading",0),S(this,"x",0),S(this,"y",0),S(this,"lineX",0),S(this,"lineY",0),S(this,"charSpacing",0),S(this,"wordSpacing",0),S(this,"textHScale",1),S(this,"textRenderingMode",se.FILL),S(this,"textRise",0),S(this,"fillColor","#000000"),S(this,"strokeColor","#000000"),S(this,"tilingPatternDims",null),S(this,"patternFill",!1),S(this,"patternStroke",!1),S(this,"fillAlpha",1),S(this,"strokeAlpha",1),S(this,"lineWidth",1),S(this,"activeSMask",null),S(this,"transferMaps","none"),S(this,"minMax",oo.slice()),this.clipBox=new Float32Array([0,0,t,e])}clone(){var t;const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e.tilingPatternDims=(t=this.tilingPatternDims)==null?void 0:t.slice(),e}getPathBoundingBox(t=Ae.FILL,e=null){const s=this.minMax.slice();if(t===Ae.STROKE){e||at("Stroke bounding box must include transform."),R.singularValueDecompose2dScale(e,wi);const a=wi[0]*this.lineWidth/2,r=wi[1]*this.lineWidth/2;s[0]-=a,s[1]-=r,s[2]+=a,s[3]+=r}return s}updateClipFromPath(){const t=R.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(oo,0)}getClippedPathBoundingBox(t=Ae.FILL,e=null){return R.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function K0(i,t){if(t instanceof ImageData){i.putImageData(t,0,0);return}const e=t.height,s=t.width,a=e%ti,r=(e-a)/ti,o=a===0?r:r+1,l=i.createImageData(s,ti);let h=0,c;const d=t.data,p=l.data;let g,v,w,b;if(t.kind===Fp.GRAYSCALE_1BPP){const y=d.byteLength,A=new Uint32Array(p.buffer,0,p.byteLength>>2),_=A.length,E=s+7>>3,x=4294967295,k=Jt.isLittleEndian?4278190080:255;for(g=0;g<o;g++){for(w=g<r?ti:a,c=0,v=0;v<w;v++){const C=y-h;let I=0;const P=C>E?s:C*8-7,M=P&-8;let D=0,L=0;for(;I<M;I+=8)L=d[h++],A[c++]=L&128?x:k,A[c++]=L&64?x:k,A[c++]=L&32?x:k,A[c++]=L&16?x:k,A[c++]=L&8?x:k,A[c++]=L&4?x:k,A[c++]=L&2?x:k,A[c++]=L&1?x:k;for(;I<P;I++)D===0&&(L=d[h++],D=128),A[c++]=L&D?x:k,D>>=1}for(;c<_;)A[c++]=0;i.putImageData(l,0,g*ti)}}else if(t.kind===Fp.RGBA_32BPP){for(v=0,b=s*ti*4,g=0;g<r;g++)p.set(d.subarray(h,h+b)),h+=b,i.putImageData(l,0,v),v+=ti;g<o&&(b=s*a*4,p.set(d.subarray(h,h+b)),i.putImageData(l,0,v))}else if(t.kind===Fp.RGB_24BPP)for(w=ti,b=s*w,g=0;g<o;g++){for(g>=r&&(w=a,b=s*w),c=0,v=b;v--;)p[c++]=d[h++],p[c++]=d[h++],p[c++]=d[h++],p[c++]=255;i.putImageData(l,0,g*ti)}else throw new Error(`bad image kind: ${t.kind}`)}function q0(i,t){if(t.bitmap){i.drawImage(t.bitmap,0,0);return}const e=t.height,s=t.width,a=e%ti,r=(e-a)/ti,o=a===0?r:r+1,l=i.createImageData(s,ti);let h=0;const c=t.data,d=l.data;for(let p=0;p<o;p++){const g=p<r?ti:a;({srcPos:h}=Ix({src:c,srcPos:h,dest:d,width:s,height:g,nonBlackColor:0})),i.putImageData(l,0,p*ti)}}function Xh(i,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of e)i[s]!==void 0&&(t[s]=i[s]);
45i.setLineDash!==void 0&&(t.setLineDash(i.getLineDash()),t.lineDashOffset=i.lineDashOffset)}function Zu(i){i.strokeStyle=i.fillStyle="#000000",i.fillRule="nonzero",i.globalAlpha=1,i.lineWidth=1,i.lineCap="butt",i.lineJoin="miter",i.miterLimit=10,i.globalCompositeOperation="source-over",i.font="10px sans-serif",i.setLineDash!==void 0&&(i.setLineDash([]),i.lineDashOffset=0);const{filter:t}=i;t!=="none"&&t!==""&&(i.filter="none")}function Q0(i,t){if(t)return!0;R.singularValueDecompose2dScale(i,wi);const e=Math.fround(yo.pixelRatio*wo.PDF_TO_CSS_UNITS);return wi[0]<=e&&wi[1]<=e}const Rx=["butt","round","square"],Nx=["miter","round","bevel"],Fx={},J0={};var Xn,Ew,xw,kw;const Ox=class t1{constructor(t,e,s,a,r,{optionalContentConfig:o,markedContentStack:l=null},h,c,d,p){f(this,Xn),this.ctx=t,this.current=new Y0(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=s,this.canvasFactory=a,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.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=o,this.cachedPatterns=new Map,this.annotationCanvasMap=h,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=d??null,this.imagesTracker=p??null}getObject(t,e,s=null){var a;return typeof e=="string"?((a=this.dependencyTracker)==null||a.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):s}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:a=null}){const r=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,r,o),this.ctx.fillStyle=l,s){const h=this.transparentCanvasEntry=this.canvasFactory.create(r,o);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=h,this.ctx.save(),this.ctx.transform(...vt(this.compositeCtx))}this.ctx.save(),Zu(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=vt(this.ctx)}executeOperatorList(t,e,s,a,r){var o;const l=t.argsArray,h=t.fnArray;let c=e||0;const d=l.length;if(d===c)return c;const p=d-c>X0&&typeof s=="function",g=p?Date.now()+Dx:0;let v=0;const w=this.commonObjs,b=this.objs;let y,A;for(;;){if(a!==void 0){if(c===a.nextBreakPoint)return a.breakIt(c,s),c;if(a.shouldSkip(c)){if(++c===d)return c;continue}}if(!r||r(c))if(y=h[c],A=l[c]??null,y!==un.dependency)A===null?this[y](c):this[y](c,...A);else for(const _ of A){(o=this.dependencyTracker)==null||o.recordNamedData(_,c);const E=_.startsWith("g_")?w:b;if(!E.has(_))return E.get(_,s),c}if(c++,c===d)return c;if(p&&++v>X0){if(Date.now()>g)return s(),c;v=0}}}endDrawing(){m(this,Xn,Ew).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,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(),m(this,Xn,xw).call(this)}_scaleImage(t,e){const s=t.width??t.displayWidth,a=t.height??t.displayHeight,r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=[];let h=r,c=o,d=s,p=a;for(;h>2&&d>1||c>2&&p>1;){let A=d,_=p;h>2&&d>1&&(A=Math.ceil(d/2),h/=d/A),c>2&&p>1&&(_=Math.ceil(p/2),c/=p/_),l.push({newWidth:A,newHeight:_}),d=A,p=_}if(l.length===0)return{img:t,paintWidth:s,paintHeight:a,tmpCanvas:null};if(l.length===1){const{newWidth:A,newHeight:_}=l[0],E=this.canvasFactory.create(A,_);return E.context.drawImage(t,0,0,s,a,0,0,A,_),{img:E.canvas,paintWidth:A,paintHeight:_,tmpCanvas:E}}let g=this.canvasFactory.create(1,1),v=this.canvasFactory.create(1,1),w=s,b=a,y=t;for(const{newWidth:A,newHeight:_}of l)this.canvasFactory.reset(v,A,_),v.context.drawImage(y,0,0,w,b,0,0,A,_),[g,v]=[v,g],y=g.canvas,w=A,b=_;return this.canvasFactory.destroy(v),{img:g.canvas,paintWidth:w,paintHeight:b,tmpCanvas:g}}_createMaskCanvas(t,e){var s,a;const r=this.ctx,{width:o,height:l}=e,h=this.current.fillColor,c=this.current.patternFill,d=vt(r);let p,g,v,w;if((e.bitmap||e.data)&&e.count>1){const $=e.bitmap||e.data.buffer;g=JSON.stringify(c?d:[d.slice(0,4),h]),p=this._cachedBitmapsMap.getOrInsertComputed($,Vb);const j=p.get(g);if(j&&!c){const F=Math.round(Math.min(d[0],d[2])+d[4]),N=Math.round(Math.min(d[1],d[3])+d[5]);return(s=this.dependencyTracker)==null||s.recordDependencies(t,Ai.transformAndFill),{canvas:j,offsetX:F,offsetY:N}}v=j}v||(w=this.canvasFactory.create(o,l),q0(w.context,e));let b=R.transform(d,[1/o,0,0,-1/l,0,0]);b=R.transform(b,[1,0,0,1,0,-l]);const y=oo.slice();R.axialAlignedBoundingBox([0,0,o,l],b,y);const[A,_,E,x]=y,k=Math.round(E-A)||1,C=Math.round(x-_)||1,I=this.canvasFactory.create(k,C),P=I.context,M=A,D=_;P.translate(-M,-D),P.transform(...b);let L=null;if(!v){const $=this._scaleImage(w.canvas,ls(P));v=$.img,L=$.tmpCanvas,v!==w.canvas&&(this.canvasFactory.destroy(w),w=null),p&&c&&(p.set(g,v),L=null,w=null)}P.imageSmoothingEnabled=Q0(vt(P),e.interpolate),Ju(P,v,0,0,v.width,v.height,0,0,o,l),L&&this.canvasFactory.destroy(L),w&&this.canvasFactory.destroy(w),P.globalCompositeOperation="source-in";const W=R.transform(ls(P),[1,0,0,1,-M,-D]);return P.fillStyle=c?h.getPattern(r,this,W,Ae.FILL,t):h,P.fillRect(0,0,o,l),p&&!c&&p.set(g,I.canvas),(a=this.dependencyTracker)==null||a.recordDependencies(t,Ai.transformAndFill),{canvas:I.canvas,canvasEntry:p&&!c?null:I,offsetX:Math.round(M),offsetY:Math.round(D)}}setLineWidth(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineCap",t),this.ctx.lineCap=Rx[e]}setLineJoin(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("lineJoin",t),this.ctx.lineJoin=Nx[e]}setMiterLimit(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,s){var a;(a=this.dependencyTracker)==null||a.recordSimpleData("dash",t);const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(e),r.lineDashOffset=s)}
45setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){var s,a,r,o,l;for(const[h,c]of e)switch(h){case"LW":this.setLineWidth(t,c);break;case"LC":this.setLineCap(t,c);break;case"LJ":this.setLineJoin(t,c);break;case"ML":this.setMiterLimit(t,c);break;case"D":this.setDash(t,c[0],c[1]);break;case"RI":this.setRenderingIntent(t,c);break;case"FL":this.setFlatness(t,c);break;case"Font":this.setFont(t,c[0],c[1]);break;case"CA":(s=this.dependencyTracker)==null||s.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=c;break;case"ca":(a=this.dependencyTracker)==null||a.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=c;break;case"BM":(r=this.dependencyTracker)==null||r.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=c;break;case"SMask":(o=this.dependencyTracker)==null||o.recordSimpleData("SMask",t),this.current.activeSMask=c?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(t);break;case"TR":(l=this.dependencyTracker)==null||l.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(c);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}_ensurePreparedSMask(t,e,s){t!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(t,e,s))}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,this.ctx.canvas.width,this.ctx.canvas.height)}_prepareSMaskCanvas(t,e,s){const{canvas:a,subtype:r,backdrop:o,transferMap:l}=t,h=r==="Luminosity"||r==="Alpha"&&l;if(!o&&!h){this.smaskPreparedFor=t;return}let c,d,p;if(o&&h){const g=this.canvasFactory.create(e,s),v=g.context;v.drawImage(a,t.offsetX,t.offsetY),v.globalCompositeOperation="destination-atop",v.fillStyle=o,v.fillRect(0,0,e,s),v.globalCompositeOperation="source-over",c=this.canvasFactory.create(e,s);const w=c.context;w.filter=r==="Alpha"?this.filterFactory.addAlphaFilter(l):this.filterFactory.addLuminosityFilter(l),w.drawImage(g.canvas,0,0),w.filter="none",this.canvasFactory.destroy(g),d=p=0}else if(h){c=this.canvasFactory.create(a.width,a.height);const g=c.context;g.filter=r==="Alpha"?this.filterFactory.addAlphaFilter(l):this.filterFactory.addLuminosityFilter(l),g.drawImage(a,0,0),g.filter="none",{offsetX:d,offsetY:p}=t}else{c=this.canvasFactory.create(e,s);const g=c.context;g.drawImage(a,t.offsetX,t.offsetY),g.globalCompositeOperation="destination-atop",g.fillStyle=o,g.fillRect(0,0,e,s),g.globalCompositeOperation="source-over",d=p=0}this.smaskPreparedEntry=c,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=d,this.smaskPreparedOffsetY=p}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const{width:e,height:s}=this.ctx.canvas,a=this.canvasFactory.create(e,s);this.smaskScratchCanvas=a,this.suspendedCtx=this.ctx;const r=this.ctx=a.context;r.setTransform(this.suspendedCtx.getTransform()),Xh(this.suspendedCtx,r),Lx(r,this.suspendedCtx),this._ensurePreparedSMask(this.current.activeSMask,e,s),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Xh(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[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,s=this.suspendedCtx;this.composeSMask(s,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(t[0],t[1],t[2]-t[0],t[3]-t[1]),this.ctx.restore(
45)}composeSMask(t,e,s,a){const r=a[0],o=a[1],l=a[2]-r,h=a[3]-o;if(l===0||h===0)return;const c=this.smaskPreparedEntry;if(c){const d=r-this.smaskPreparedOffsetX,p=o-this.smaskPreparedOffsetY;s.save(),s.globalAlpha=1,s.setTransform(1,0,0,1,0,0);const g=new Path2D;g.rect(r,o,l,h),s.clip(g),s.globalCompositeOperation="destination-in",s.drawImage(c.canvas,d,p,l,h,r,o,l,h),s.restore()}else this.genericComposeSMask(e.context,s,l,h,r,o,e.offsetX,e.offsetY);t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,r,o,l,h,r,o,l,h),t.restore()}genericComposeSMask(t,e,s,a,r,o,l,h){const c=t.canvas,d=r-l,p=o-h;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const g=new Path2D;g.rect(r,o,s,a),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(c,d,p,s,a,r,o,s,a),e.restore()}save(t){var e;this.inSMaskMode&&Xh(this.ctx,this.suspendedCtx),this.ctx.save();const s=this.current;this.stateStack.push(s),this.current=s.clone(),(e=this.dependencyTracker)==null||e.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&&(Xh(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,s,a,r,o,l){var h;(h=this.dependencyTracker)==null||h.recordIncrementalData("transform",t),this.ctx.transform(e,s,a,r,o,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s,a){let[r]=s;if(!a){r||(r=s[0]=new Path2D),e!==un.stroke&&e!==un.closeStroke&&(this.current.tilingPatternDims=null),this[e](t,r);return}if(this.dependencyTracker!==null){const l=e===un.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,a[0]-l,a[2]+l,a[1]-l,a[3]+l).recordDependencies(t,["transform"])}r instanceof Path2D||(r=s[0]=_A(r)),R.axialAlignedBoundingBox(a,vt(this.ctx),this.current.minMax);const o=this.current.tilingPatternDims;if(o&&e!==un.stroke&&e!==un.closeStroke&&this.current.fillColor instanceof tv){const l=R.intersect(this.current.clipBox,this.current.minMax);l?this.current.fillColor.updatePatternDims(l,o):this.current.tilingPatternDims=null}this[e](t,r),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,s=!0){var a;const r=this.ctx,o=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof o=="object"&&o!=null&&o.getPattern){const l=o.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=o.getPattern(r,this,ls(r),Ae.STROKE,t),l){const h=new Path2D;h.addPath(e,r.getTransform().invertSelf().multiplySelf(l)),e=h}this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);(a=this.dependencyTracker)==null||a.recordDependencies(t,Ai.stroke),s&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Ae.STROKE,vt(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,s=!0){var a,r,o;const l=this.ctx,h=this.current.fillColor,c=this.current.patternFill;let d=!1;const p=this.current.getClippedPathBoundingBox();if((a=this.dependencyTracker)==null||a.recordDependencies(t,Ai.fill),c){const g=this.current.tilingPatternDims,v=g&&h.canSkipPatternCanvas(g);if(v){h.drawPattern(this,e,this.pendingEOFill,v,t),this.pendingEOFill=!1,s&&this.consumePath(t,e,p),this.current.tilingPatternDims=null;return}const w=h.isModifyingCurrentTransform()?l.getTransform():null;if((r=this.dependencyTracker)==null||r.save(t),l.save(),l.fillStyle=h.getPattern(l,this,ls(l),Ae.FILL,t),w){const b=new Path2D;b.addPath(e,l.getTransform().invertSelf().multiplySelf(w)),e=b}d=!0}this.contentVisible&&p!==null&&(this.pendingEOFill?(l.fill(e,"evenodd"),this.pendingEOFill=!1):l.fill(e)),d&&(l.restore(),(o=this.dependencyTracker)==null||o.restore(t)),s&&this.consumePath(t,e,p)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}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;this.ctx.fill(e),(s=this.dependencyTracker)==null||s.recordDependencies(t,Ai.rawFillPath).recordOperation(t)}clip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=Fx}eoClip(t){var e;(e=this.dependencyTracker)==null||e.recordFutureForcedDependency("clipMode",t),this.pendingClip=J0}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,
45(e=this.dependencyTracker)==null||e.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){const e=this.pendingTextPaths,s=this.ctx;if(this.dependencyTracker){const{dependencyTracker:a}=this;e!==void 0&&a.recordFutureForcedDependency("textClip",a.getOpenMarker()).recordFutureForcedDependency("textClip",t),a.recordCloseMarker(t)}if(e!==void 0){const a=new Path2D,r=s.getTransform().invertSelf();for(const{transform:o,x:l,y:h,fontSize:c,path:d}of e)d&&a.addPath(d,new DOMMatrix(o).preMultiplySelf(r).translate(l,h).scale(c,-c));s.clip(a)}delete this.pendingTextPaths}setCharSpacing(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,s){var a,r;(a=this.dependencyTracker)==null||a.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);const o=this.commonObjs.get(e),l=this.current;if(!o)throw new Error(`Can't find font for ${e}`);if(l.fontMatrix=o.fontMatrix||Hv,(l.fontMatrix[0]===0||l.fontMatrix[3]===0)&&Y("Invalid font matrix for font "+e),s<0?(s=-s,l.fontDirection=-1):l.fontDirection=1,this.current.font=o,this.current.fontSize=s,o.isType3Font)return;const h=o.loadedName||"sans-serif",c=((r=o.systemFontInfo)==null?void 0:r.css)||`"${h}", ${o.fallbackName}`;let d="normal";o.black?d="900":o.bold&&(d="bold");const p=o.italic?"italic":"normal";let g=s;s<z0?g=z0:s>G0&&(g=G0),this.current.fontSizeScale=s/g,this.ctx.font=`${p} ${d} ${g}px ${c}`}setTextRenderingMode(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){var s;(s=this.dependencyTracker)==null||s.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,s){var a;(a=this.dependencyTracker)==null||a.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=s}setLeadingMoveText(t,e,s){this.setLeading(t,-s),this.moveText(t,e,s)}setTextMatrix(t,e){var s;(s=this.dependencyTracker)==null||s.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);const{current:a}=this;a.textMatrix=e,a.textMatrixScale=Math.hypot(e[0],e[1]),a.x=a.lineX=0,a.y=a.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)}paintChar(t,e,s,a,r,o){var l,h,c,d;const p=this.ctx,g=this.current,v=g.font,w=g.textRenderingMode,b=g.fontSize/g.fontSizeScale,y=w&se.FILL_STROKE_MASK,A=!!(w&se.ADD_TO_PATH_FLAG),_=g.patternFill&&!v.missingFile,E=g.patternStroke&&!v.missingFile;let x;if((v.disableFontFace||A||_||E)&&!v.missingFile&&(x=v.getPathGenerator(this.commonObjs,e)),x&&(v.disableFontFace||_||E)){p.save(),p.translate(s,a),p.scale(b,-b),(l=this.dependencyTracker)==null||l.recordCharacterBBox(t,p,v);let k;if(y===se.FILL||y===se.FILL_STROKE)if(r){k=p.getTransform(),p.setTransform(...r);const C=m(this,Xn,kw).call(this,x,k,r);p.fill(C)}else p.fill(x);if(y===se.STROKE||y===se.FILL_STROKE)if(o){k||(k=p.getTransform()),p.setTransform(...o);const{a:C,b:I,c:P,d:M}=k,D=R.inverseTransform(o),L=R.transform([C,I,P,M,0,0],D);R.singularValueDecompose2dScale(L,wi),p.lineWidth*=Math.max(wi[0],wi[1])/b,p.stroke(m(this,Xn,kw).call(this,x,k,o))}else p.lineWidth/=b,p.stroke(x);p.restore()}else(y===se.FILL||y===se.FILL_STROKE)&&(p.fillText(e,s,a),(h=this.dependencyTracker)==null||h.recordCharacterBBox(t,p,v,b,s,a,()=>p.measureText(e))),(y===se.STROKE||y===se.FILL_STROKE)&&(this.dependencyTracker&&((c=this.dependencyTracker)==null||c.recordCharacterBBox(t,p,v,b,s,a,()=>p.measureText(e)).recordDependencies(t,Ai.stroke)),p.strokeText(e,s,a));A&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:vt(p),x:s,y:a,fontSize:b,path:x}),(d=this.dependencyTracker)==null||d.recordCharacterBBox(t,p,v,b,s,a))}get isFontSubpixelAAEnabled(){const t=this.canvasFactory.create(10,
4510),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);const s=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let a=!1;for(let r=3;r<s.length;r+=4)if(s[r]>0&&s[r]<255){a=!0;break}return G(this,"isFontSubpixelAAEnabled",a)}showText(t,e){var s,a,r,o;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Ai.showText).resetBBox(t),this.current.textRenderingMode&se.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());const l=this.current,h=l.font;if(h.isType3Font){this.showType3Text(t,e),(s=this.dependencyTracker)==null||s.recordShowTextOperation(t);return}const c=l.fontSize;if(c===0){(a=this.dependencyTracker)==null||a.recordOperation(t);return}const d=this.ctx,p=l.fontSizeScale,g=l.charSpacing,v=l.wordSpacing,w=l.fontDirection,b=l.textHScale*w,y=e.length,A=h.vertical,_=A?1:-1,E=h.defaultVMetrics,x=c*l.fontMatrix[0],k=l.textRenderingMode===se.FILL&&!h.disableFontFace&&!l.patternFill;d.save(),l.textMatrix&&d.transform(...l.textMatrix),d.translate(l.x,l.y+l.textRise),w>0?d.scale(b,-1):d.scale(b,1);let C,I;const P=l.textRenderingMode&se.FILL_STROKE_MASK,M=P===se.FILL||P===se.FILL_STROKE,D=P===se.STROKE||P===se.FILL_STROKE;let L=l.lineWidth;const W=l.textMatrixScale;if(W===0||L===0?D&&(L=this.getSinglePixelWidth()):L/=W,p!==1&&(d.scale(p,p),L/=p),d.lineWidth=L,M&&l.patternFill){d.save();const F=l.fillColor.getPattern(d,this,ls(d),Ae.FILL,t);C=vt(d),d.restore(),d.fillStyle=F}if(D&&l.patternStroke){d.save();const F=l.strokeColor.getPattern(d,this,ls(d),Ae.STROKE,t);I=vt(d),d.restore(),d.strokeStyle=F}if(h.isInvalidPDFjsFont){const F=[];let N=0;for(const X of e)F.push(X.unicode),N+=X.width;const Q=F.join("");if(d.fillText(Q,0,0),this.dependencyTracker!==null){const X=d.measureText(Q);this.dependencyTracker.recordBBox(t,this.ctx,-X.actualBoundingBoxLeft,X.actualBoundingBoxRight,-X.actualBoundingBoxAscent,X.actualBoundingBoxDescent).recordShowTextOperation(t)}l.x+=N*x*b,d.restore(),this.compose();return}let $=0,j;for(j=0;j<y;++j){const F=e[j];if(typeof F=="number"){$+=_*F*c/1e3;continue}let N=!1;const Q=(F.isSpace?v:0)+g,X=F.fontChar,oe=F.accent;let _e,Re,yt=F.width;if(A){const Ne=F.vmetric||E,He=-(F.vmetric?Ne[1]:yt*.5)*x,Ut=Ne[2]*x;yt=Ne?-Ne[0]:yt,_e=He/p,Re=($+Ut)/p}else _e=$/p,Re=0;let St;if(h.remeasure&&yt>0){St=d.measureText(X);const Ne=St.width*1e3/c*p;if(yt<Ne&&this.isFontSubpixelAAEnabled){const He=yt/Ne;N=!0,d.save(),d.scale(He,1),_e/=He}else yt!==Ne&&(_e+=(yt-Ne)/2e3*c/p)}if(this.contentVisible&&(F.isInFont||h.missingFile)){if(k&&!oe)d.fillText(X,_e,Re),(r=this.dependencyTracker)==null||r.recordCharacterBBox(t,d,St?{bbox:null}:h,c/p,_e,Re,()=>St??d.measureText(X));else if(this.paintChar(t,X,_e,Re,C,I),oe){const Ne=_e+c*oe.offset.x/p,He=Re-c*oe.offset.y/p;this.paintChar(t,oe.fontChar,Ne,He,C,I)}}const xo=A?yt*x-Q*w:yt*x+Q*w;$+=xo,N&&d.restore()}A?l.y-=$:l.x+=$*b,d.restore(),this.compose(),(o=this.dependencyTracker)==null||o.recordShowTextOperation(t)}showType3Text(t,e){const s=this.ctx,a=this.current,r=a.font,o=a.fontSize,l=a.fontDirection,h=r.vertical?1:-1,c=a.charSpacing,d=a.wordSpacing,p=a.textHScale*l,g=a.fontMatrix||Hv,v=e.length,w=a.textRenderingMode===se.INVISIBLE;let b,y,A,_;if(w||o===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,s.save(),a.textMatrix&&s.transform(...a.textMatrix),s.translate(a.x,a.y+a.textRise),s.scale(p,l);const E=this.dependencyTracker;for(this.dependencyTracker=E?new uw(E,t):null,b=0;b<v;++b){if(y=e[b],typeof y=="number"){_=h*y*o/1e3,this.ctx.translate(_,0),a.x+=_*p;continue}const x=(y.isSpace?d:0)+c,k=r.charProcOperatorList[y.operatorListId];k?this.contentVisible&&(this.save(),s.scale(o,o),s.transform(...g),this.executeOperatorList(k),this.restore()):Y(`Type3 character "${y.operatorListId}" is not available.`);const C=[y.width,0];R.applyTransform(C,g),A=C[0]*o+x,s.translate(A,0),a.x+=A*p}s.restore(),E&&(this.dependencyTracker=E)}setCharWidth(t,e,s){}setCharWidthAndBounds(t,e,s,a,r,o,l){var h;const c=new Path2D;c.rect(a,r,o-a,l-r),this.ctx.clip(c),(h=this.dependencyTracker)==null||h.recordBBox(t,this.ctx,a,o,r,l).recordClipBox(t,this.ctx,a,o,r,l),this.endPath(t)}getColorN_Pattern(t,e){let s;if(e[0]==="TilingPattern"){const a=this.baseTransform||vt(this.ctx),r={createCanvasGraphics:(o,l)=>new t1(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new uw(this.dependencyTracker,l,!0):null)};s=new tv(e,this.ctx,r,a)}else s=this._getPattern(t,e[1],e[2]);return s}setStrokeColorN(t,...e){var s;(s=this.dependencyTracker)==null||s.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 a=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=a instanceof tv?[0,0,0,0]:null}setStrokeRGBColor(t,e){var s;(s=this.dependencyTracker)==null||s.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 s;(s=this.dependencyTracker)==null||s.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,s=null){let a;return this.cachedPatterns.has(e)?a=this.cachedPatterns.get(e):(a=Tx(this.getObject(t,e)),this.cachedPatterns.set(e,a)),s&&(a.matrix=s),a}shadingFill(t,e){var s;if(!this.contentVisible)return;const a=this.ctx;this.save(t);const r=this._getPattern(t,e);a.fillStyle=r.getPattern(a,this,ls(a),Ae.SHADING,t);const o=ls(a);if(o){const{width:l,height:h}=a.canvas,c=oo.slice();R.axialAlignedBoundingBox([0,0,l,h],o,c);const[d,p,g,v]=c;this.ctx.fillRect(d,p,g-d,v-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);(s=this.dependencyTracker)==null||s.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,Ai.transform).recordDependencies(t,Ai.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){at("Should not call beginInlineImage")}beginImageData(){at("Should not call beginImageData")}paintFormXObjectBegin(t,e,s){var a;if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=vt(this.ctx),s)){R.axialAlignedBoundingBox(s,this.baseTransform,this.current.minMax);const[r,o,l,h]=s,c=new Path2D;c.rect(r,o,l-r,h-o),this.ctx.clip(c),(a=this.dependencyTracker)==null||a.recordClipBox(t,this.ctx,r,l,o,h),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){var s;if(!this.contentVisible)return;this.save(t);const{inSMaskMode:a}=this;a&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;
45if(e.isolated||xm("TODO: Support non-isolated groups."),e.knockout&&Y("Knockout groups not supported."),!e.needsIsolation&&r.globalAlpha===1&&r.globalCompositeOperation==="source-over"&&!a){if(e.bbox){let b=new Path2D;const[y,A,_,E]=e.bbox;if(b.rect(y,A,_-y,E-A),e.matrix){const x=new Path2D;x.addPath(b,new DOMMatrix(e.matrix)),b=x}r.clip(b)}this.groupStack.push(null),this.groupLevel++;return}const o=vt(r);e.matrix&&r.transform(...e.matrix);const l=[0,0,r.canvas.width,r.canvas.height];let h;e.bbox?(h=oo.slice(),R.axialAlignedBoundingBox(e.bbox,vt(r),h),h=R.intersect(h,l)||[0,0,0,0]):h=l;const c=Math.floor(h[0]),d=Math.floor(h[1]),p=Math.max(Math.ceil(h[2])-c,1),g=Math.max(Math.ceil(h[3])-d,1);this.current.startNewPathAndClipBox([0,0,p,g]);const v=this.canvasFactory.create(p,g);e.smask&&this.smaskGroupCanvases.push(v);const w=v.context;if(w.translate(-c,-d),w.transform(...o),!e.isolated&&!e.smask&&a&&e.needsIsolation&&(w.save(),w.setTransform(1,0,0,1,0,0),w.drawImage(r.canvas,-c,-d),w.restore()),e.bbox){let b=new Path2D;const[y,A,_,E]=e.bbox;if(b.rect(y,A,_-y,E-A),e.matrix){const x=new Path2D;x.addPath(b,new DOMMatrix(e.matrix)),b=x}w.clip(b)}e.smask&&this.smaskStack.push({canvas:v.canvas,context:w,offsetX:c,offsetY:d,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null}),(!e.smask||this.dependencyTracker)&&(r.setTransform(1,0,0,1,0,0),r.translate(c,d),r.save()),Xh(r,w),this.ctx=w,(s=this.dependencyTracker)==null||s.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(r),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(r),this.groupLevel++}endGroup(t,e){var s;if(!this.contentVisible)return;this.groupLevel--;const a=this.ctx,r=this.groupStack.pop();if(r===null){this.restore(t);return}if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,(s=this.dependencyTracker)==null||s.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform()));else{this.ctx.restore();const o=vt(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...o);const l=oo.slice();R.axialAlignedBoundingBox([0,0,a.canvas.width,a.canvas.height],o,l),this.ctx.drawImage(a.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy({canvas:a.canvas,context:a}),this.compose(l)}}beginAnnotation(t,e,s,a,r,o){if(m(this,Xn,Ew).call(this),Zu(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),s){const l=s[2]-s[0],h=s[3]-s[1];if(o&&this.annotationCanvasMap){a=a.slice(),a[4]-=s[0],a[5]-=s[1],s=s.slice(),s[0]=s[1]=0,s[2]=l,s[3]=h,R.singularValueDecompose2dScale(vt(this.ctx),wi);const{viewportScale:c}=this,d=Math.ceil(l*this.outputScaleX*c),p=Math.ceil(h*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,p);const{canvas:g,context:v}=this.annotationCanvas;this.annotationCanvasMap.set(e,g),this.annotationCanvas.savedCtx=this.ctx,this.ctx=v,this.ctx.save(),this.ctx.setTransform(wi[0],0,0,-wi[1],0,h*wi[1]),Zu(this.ctx)}else{Zu(this.ctx),this.endPath(t);const c=new Path2D;c.rect(s[0],s[1],l,h),this.ctx.clip(c)}}this.current=new Y0(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...a),this.transform(t,...r),this.baseTransform=vt(this.ctx)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),m(this,Xn,xw).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){var s;if(!this.contentVisible)return;const a=e.count;e=this.getObject(t,e.data,e),e.count=a;const r=this.ctx,o=this._createMaskCanvas(t,e),l=o.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(l,o.offsetX,o.offsetY),(s=this.dependencyTracker)==null||s.resetBBox(t).recordBBox(t,this.ctx,o.offsetX,o.offsetX+l.width,o.offsetY,o.offsetY+l.height).recordOperation(t),r.restore(
45),o.canvasEntry&&this.canvasFactory.destroy(o.canvasEntry),this.compose()}paintImageMaskXObjectRepeat(t,e,s,a=0,r=0,o,l){var h,c,d;if(!this.contentVisible)return;e=this.getObject(t,e.data,e);const p=this.ctx;p.save();const g=vt(p);p.transform(s,a,r,o,0,0);const v=this._createMaskCanvas(t,e);p.setTransform(1,0,0,1,v.offsetX-g[4],v.offsetY-g[5]),(h=this.dependencyTracker)==null||h.resetBBox(t);for(let w=0,b=l.length;w<b;w+=2){const y=R.transform(g,[s,a,r,o,l[w],l[w+1]]);p.drawImage(v.canvas,y[4],y[5]),(c=this.dependencyTracker)==null||c.recordBBox(t,this.ctx,y[4],y[4]+v.canvas.width,y[5],y[5]+v.canvas.height)}p.restore(),v.canvasEntry&&this.canvasFactory.destroy(v.canvasEntry),this.compose(),(d=this.dependencyTracker)==null||d.recordOperation(t)}paintImageMaskXObjectGroup(t,e){var s,a,r;if(!this.contentVisible)return;const o=this.ctx,l=this.current.fillColor,h=this.current.patternFill;(s=this.dependencyTracker)==null||s.resetBBox(t).recordDependencies(t,Ai.transformAndFill);for(const c of e){const{data:d,width:p,height:g,transform:v}=c,w=this.canvasFactory.create(p,g),b=w.context;b.save();const y=this.getObject(t,d,c);q0(b,y),b.globalCompositeOperation="source-in",b.fillStyle=h?l.getPattern(b,this,ls(o),Ae.FILL,t):l,b.fillRect(0,0,p,g),b.restore(),o.save(),o.transform(...v),o.scale(1,-1),Ju(o,w.canvas,0,0,p,g,0,-1,1,1),this.canvasFactory.destroy(w),(a=this.dependencyTracker)==null||a.recordBBox(t,o,0,p,0,g),o.restore()}this.compose(),(r=this.dependencyTracker)==null||r.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;const s=this.getObject(t,e);if(!s){Y("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,s)}paintImageXObjectRepeat(t,e,s,a,r){if(!this.contentVisible)return;const o=this.getObject(t,e);if(!o){Y("Dependent image isn't ready yet");return}const l=o.width,h=o.height,c=[];for(let d=0,p=r.length;d<p;d+=2)c.push({transform:[s,0,0,a,r[d],r[d+1]],x:0,y:0,w:l,h});this.paintInlineImageXObjectGroup(t,o,c)}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:s,height:a}=t,r=this.canvasFactory.create(s,a),o=r.context;return o.filter=this.current.transferMaps,o.drawImage(e,0,0),o.filter="none",{img:r.canvas,canvasEntry:r}}paintInlineImageXObject(t,e){var s;if(!this.contentVisible)return;const a=e.width,r=e.height,o=this.ctx;this.save(t);const{filter:l}=o;l!=="none"&&l!==""&&(o.filter="none"),o.scale(1/a,-1/r);let h,c=null;if(e.bitmap){const p=this.applyTransferMapsToBitmap(e);h=p.img,c=p.canvasEntry}else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)h=e;else{const p=this.canvasFactory.create(a,r);K0(p.context,e),h=this.applyTransferMapsToCanvas(p.context),c=p}const d=this._scaleImage(h,ls(o));o.imageSmoothingEnabled=Q0(vt(o),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,o,0,a,-r,0).recordDependencies(t,Ai.imageXObject).recordOperation(t),(s=this.imagesTracker)==null||s.record(o,a,r,this.dependencyTracker.clipBox)),Ju(o,d.img,0,0,d.paintWidth,d.paintHeight,0,-r,a,r),d.tmpCanvas&&this.canvasFactory.destroy(d.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,s){var a,r,o;if(!this.contentVisible)return;const l=this.ctx;let h,c=null;if(e.bitmap)h=e.bitmap;else{const d=e.width,p=e.height,g=this.canvasFactory.create(d,p);K0(g.context,e),h=this.applyTransferMapsToCanvas(g.context),c=g}(a=this.dependencyTracker)==null||a.resetBBox(t);for(const d of s)l.save(),l.transform(...d.transform),l.scale(1,-1),Ju(l,h,d.x,d.y,d.w,d.h,0,-1,1,1),(r=this.dependencyTracker)==null||r.recordBBox(t,l,0,1,-1,0),l.restore();c&&this.canvasFactory.destroy(c),(o=this.dependencyTracker)==null||o.recordOperation(t),this.compose()}paintSolidColorImageMask(t){var e;this.contentVisible&&((e=this.dependencyTracker)==null||e.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,Ai.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,s){}beginMarkedContent(t,e){var s;(s=this.dependencyTracker)==null||s.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,s){var a;(a=this.dependencyTracker)==null||a.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):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,s){var a,r;const o=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const l=this.ctx;this.pendingClip?(o||(this.pendingClip===J0?l.clip(e,"evenodd"):l.clip(e)),this.pendingClip=null,(a=this.dependencyTracker)==null||a.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):(r=this.dependencyTracker)==null||r.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=vt(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]),s=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,a)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:e,b:s,c:a,d:r}=this.ctx.getTransform();let o,l;if(s===0&&a===0){const h=Math.abs(e),c=Math.abs(r);if(h===c)if(t===0)o=l=1/h;else{const d=h*t;o=l=d<1?1/d:1}else if(t===0)o=1/h,l=1/c;else{const d=h*t,p=c*t;o=d<1?1/d:1,l=p<1?1/p:1}}else{const h=Math.abs(e*r-s*a),c=Math.hypot(e,s),d=Math.hypot(a,r);if(t===0)o=d/h,l=c/h;else{const p=t*h;o=d>p?d/p:1,l=c>p?c/p:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(t,e){const{ctx:s,current:{lineWidth:a}}=this,[r,o]=this.getScaleForStroking();if(r===o){s.lineWidth=(a||1)*r,s.stroke(t);return}const l=s.getLineDash();e&&s.save(),s.scale(r,o),ev.a=1/r,ev.d=1/o;const h=new Path2D;if(h.addPath(t,ev),l.length>0){const c=Math.max(r,o);
45s.setLineDash(l.map(d=>d/c)),s.lineDashOffset/=c}s.lineWidth=a||1,s.stroke(h),e&&s.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Xn=new WeakSet,Ew=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)},xw=function(){if(this.pageColors){const i=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(i!=="none"){const t=this.ctx.filter;this.ctx.filter=i,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}},kw=function(i,t,e){const s=new Path2D;return s.addPath(i,new DOMMatrix(e).invertSelf().multiplySelf(t)),s};let ig=Ox;for(const i in un)ig.prototype[i]!==void 0&&(ig.prototype[un[i]]=ig.prototype[i]);var sg,ng;class Cm{constructor(t,e,s){f(this,sg,null),f(this,ng,null),S(this,"_fullReader",null),S(this,"_rangeReaders",new Set),S(this,"_source",null),this._source=t,u(this,sg,e),u(this,ng,s)}get _progressiveDataLength(){var t;return((t=this._fullReader)==null?void 0:t._loaded)??0}getFullReader(){return Tt(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(n(this,sg))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new(n(this,ng))(this,t,e);return this._rangeReaders.add(s),s}cancelAllRequests(t){var e;(e=this._fullReader)==null||e.cancel(t);for(const s of new Set(this._rangeReaders))s.cancel(t)}}sg=new WeakMap,ng=new WeakMap;class Pm{constructor(t){S(this,"onProgress",null),S(this,"_contentLength",0),S(this,"_filename",null),S(this,"_headersCapability",Promise.withResolvers()),S(this,"_isRangeSupported",!1),S(this,"_isStreamingSupported",!1),S(this,"_loaded",0),S(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(){at("Abstract method `read` called")}cancel(t){at("Abstract method `cancel` called")}}class Tm{constructor(t,e,s){S(this,"_stream",null),this._stream=t}async read(){at("Abstract method `read` called")}cancel(t){at("Abstract method `cancel` called")}}function Wx(i){let t=!0,e=s("filename\\*","i").exec(i);if(e){e=e[1];let d=l(e);return d=unescape(d),d=h(d),d=c(d),r(d)}if(e=o(i),e){const d=c(e);return r(d)}if(e=s("filename","i").exec(i),e){e=e[1];let d=l(e);return d=c(d),r(d)}function s(d,p){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',p)}function a(d,p){if(d){if(!/^[\x00-\xFF]+$/.test(p))return p;try{const g=new TextDecoder(d,{fatal:!0}),v=km(p);p=g.decode(v),t=!1}catch{}}return p}function r(d){return t&&/[\x80-\xff]/.test(d)&&(d=a("utf-8",d),t&&(d=a("iso-8859-1",d))),d}function o(d){const p=[];let g;const v=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(g=v.exec(d))!==null;){let[,b,y,A]=g;if(b=parseInt(b,10),b in p){if(b===0)break;continue}p[b]=[y,A]}const w=[];for(let b=0;b<p.length&&b in p;++b){let[y,A]=p[b];A=l(A),y&&(A=unescape(A),b===0&&(A=h(A))),w.push(A)}return w.join("")}function l(d){if(d.startsWith('"')){const p=d.slice(1).split('\\"');for(let g=0;g<p.length;++g){const v=p[g].indexOf('"');v!==-1&&(p[g]=p[g].slice(0,v),p.length=g+1),p[g]=p[g].replaceAll(/\\(.)/g,"$1")}d=p.join('"')}return d}function h(d){const p=d.indexOf("'");if(p===-1)return d;const g=d.slice(0,p),v=d.slice(p+1).replace(/^[^']*'/,"");return a(g,v)}function c(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(p,g,v,w){if(v==="q"||v==="Q")return w=w.replaceAll("_"," "),w=w.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,y){return String.fromCharCode(parseInt(y,16))}),a(g,w);try{w=atob(w)}catch{}return a(g,w)})}return""}function e1(i,t){const e=new Headers;if(!i||!t||typeof t!="object")return e;for(const s in t){const a=t[s];a!==void 0&&e.append(s,a)}return e}function Im(i){var t;return((t=URL.parse(i))==null?void 0:t.origin)??null}function i1({responseHeaders:i,isHttp:t,rangeChunkSize:e,disableRange:s}){const a={contentLength:0,isRangeSupported:!1},r=parseInt(i.get("Content-Length"),10);return!Number.isInteger(r)||(a.contentLength=r,r<=2*e)||s||!t||i.get("Accept-Ranges")!=="bytes"||(i.get("Content-Encoding")||"identity")==="identity"&&(a.isRangeSupported=!0),a}function s1(i){const t=i.get("Content-Disposition");if(t){let e=Wx(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Xb(e))return e}return null}
45function Dm(i,t){return new $f(`Unexpected server response (${i}) while retrieving PDF "${t.href}".`,i,i===404||i===0&&t.protocol==="file:")}function n1(i,t){if(i!==t)throw new Error(`Expected range response-origin "${i}" to match "${t}".`)}function a1(i,t,e,s){return fetch(i,{method:"GET",headers:t,signal:s.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function r1(i,t){if(i!==200&&i!==206)throw Dm(i,t)}function Lm(i){if(i instanceof Uint8Array)return i.buffer;if(i instanceof ArrayBuffer)return i;throw new Error(`getArrayBuffer - unexpected data: ${i}`)}class Bx extends Cm{constructor(t){super(t,jx,$x),S(this,"_responseOrigin",null);const{httpHeaders:e,url:s}=t;Tt(/https?:/.test(s.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=e1(!0,e)}}class jx extends Pm{constructor(t){super(t),S(this,"_abortController",new AbortController),S(this,"_reader",null);const{disableRange:e,disableStream:s,rangeChunkSize:a,url:r,withCredentials:o}=t._source;this._isStreamingSupported=!s;const l=new Headers(t.headers);a1(r,l,o,this._abortController).then(h=>{t._responseOrigin=Im(h.url),r1(h.status,r),this._reader=h.body.getReader();const c=h.headers,{contentLength:d,isRangeSupported:p}=i1({responseHeaders:c,isHttp:!0,rangeChunkSize:a,disableRange:e});this._contentLength=d,this._isRangeSupported=p,this._filename=s1(c),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Fa("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:Lm(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}class $x extends Tm{constructor(t,e,s){super(t,e,s),S(this,"_abortController",new AbortController),S(this,"_readCapability",Promise.withResolvers()),S(this,"_reader",null);const{url:a,withCredentials:r}=t._source,o=new Headers(t.headers);o.append("Range",`bytes=${e}-${s-1}`),a1(a,o,r,this._abortController).then(l=>{const h=Im(l.url);n1(h,t._responseOrigin),r1(l.status,a),this._reader=l.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:Lm(t),done:!1}}cancel(t){var e;(e=this._reader)==null||e.cancel(t),this._abortController.abort()}}function o1(i){return i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer}function Rm(){for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}var Sw,l1;class Ux extends Cm{constructor(t){super(t,Hx,Vx),f(this,Sw),S(this,"_progressiveDone",!1),S(this,"_queuedChunks",[]);const{pdfDataRangeTransport:e}=t,{initialData:s,progressiveDone:a}=e;if((s==null?void 0:s.length)>0){const o=o1(s);this._queuedChunks.push(o)}this._progressiveDone=a;const r=o=>{var l;switch(o.type){case"range":case"progressiveRead":m(this,Sw,l1).call(this,o.begin,o.chunk);break;case"progressiveDone":(l=this._fullReader)==null||l.progressiveDone(),this._progressiveDone=!0;break}};e.transportReady(r)}getFullReader(){const t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){const s=super.getRangeReader(t,e);return s&&(s.onDone=()=>this._rangeReaders.delete(s),this._source.pdfDataRangeTransport.requestDataRange(t,e)),s}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}Sw=new WeakSet,l1=function(i,t){const e=o1(t);if(i===void 0)this._fullReader?this._fullReader._enqueue(e):this._queuedChunks.push(e);else{const s=this._rangeReaders.keys().find(a=>a._begin===i);Tt(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(e)}};var ag;class Hx extends Pm{constructor(t){super(t),f(this,ag,Rm.bind(this)),S(this,"_done",!1),S(this,"_queuedChunks",null),S(this,"_requests",[]);const{pdfDataRangeTransport:e,disableRange:s,disableStream:a}=t._source,{length:r,contentDispositionFilename:o}=e;this._queuedChunks=t._queuedChunks||[];for(const h of this._queuedChunks)this._loaded+=h.byteLength;this._done=t._progressiveDone,this._contentLength=r,this._isStreamingSupported=!a,this._isRangeSupported=!s,Xb(o)&&(this._filename=o),this._headersCapability.resolve();const l=this._loaded;Promise.resolve().then(()=>{l>0&&this._loaded===l&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,n(this,ag).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&n(this,ag).call(this)}}
45ag=new WeakMap;var rg;class Vx extends Tm{constructor(t,e,s){super(t,e,s),f(this,rg,Rm.bind(this)),S(this,"onDone",null),S(this,"_begin",-1),S(this,"_done",!1),S(this,"_queuedChunk",null),S(this,"_requests",[]),this._begin=e}_enqueue(t){var e;this._done||(this._requests.length===0?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),n(this,rg).call(this)),this._done=!0,(e=this.onDone)==null||e.call(this))}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var e;this._done=!0,n(this,rg).call(this),(e=this.onDone)==null||e.call(this)}}rg=new WeakMap;const Mw=200,h1=206;function zx(i){return typeof i!="string"?i:km(i).buffer}var wn,og,c1,d1;class Gx extends Cm{constructor(t){super(t,Xx,Yx),f(this,og),f(this,wn,new WeakMap),S(this,"_responseOrigin",null);const{httpHeaders:e,url:s}=t;this.url=s,this.isHttp=/https?:/.test(s.protocol),this.headers=e1(this.isHttp,e)}_request(t){const e=new XMLHttpRequest,s={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};n(this,wn).set(e,s),e.open("GET",this.url),e.withCredentials=this._source.withCredentials;for(const[a,r]of this.headers)e.setRequestHeader(a,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.validateStatus=a=>a===h1||a===Mw):s.validateStatus=a=>a===Mw,e.responseType="arraybuffer",Tt(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=m(this,og,d1).bind(this,e),e.onprogress=m(this,og,c1).bind(this,e),e.send(null),e}_abortRequest(t){n(this,wn).has(t)&&(n(this,wn).delete(t),t.abort())}getRangeReader(t,e){const s=super.getRangeReader(t,e);return s&&(s.onClosed=()=>this._rangeReaders.delete(s)),s}}wn=new WeakMap,og=new WeakSet,c1=function(i,t){var e;const s=n(this,wn).get(i);(e=s==null?void 0:s.onProgress)==null||e.call(s,t)},d1=function(i,t){const e=n(this,wn).get(i);if(!e||(i.readyState>=2&&e.onHeadersReceived&&(e.onHeadersReceived(),delete e.onHeadersReceived),i.readyState!==4)||!n(this,wn).has(i))return;if(n(this,wn).delete(i),i.status===0&&this.isHttp){e.onError(i.status);return}const s=i.status||Mw;if(!e.validateStatus(s)){e.onError(i.status);return}const a=zx(i.response);if(s===h1){const r=i.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(r)?e.onDone(a):(Y('Missing or invalid "Content-Range" header.'),e.onError(0))}else a?e.onDone(a):e.onError(i.status)};var Xf,vl,u1,p1,g1,f1;class Xx extends Pm{constructor(t){super(t),f(this,vl),f(this,Xf,Rm.bind(this)),S(this,"_cachedChunks",[]),S(this,"_done",!1),S(this,"_requests",[]),S(this,"_storedError",null),this._fullRequestXhr=t._request({onHeadersReceived:m(this,vl,u1).bind(this),onDone:m(this,vl,p1).bind(this),onError:m(this,vl,g1).bind(this),onProgress:m(this,vl,f1).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 t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t),n(this,Xf).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}Xf=new WeakMap,vl=new WeakSet,u1=function(){const i=this._stream,{disableRange:t,rangeChunkSize:e}=i._source,s=this._fullRequestXhr;i._responseOrigin=Im(s.responseURL);const a=s.getAllResponseHeaders(),r=new Headers(a?a.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(h=>{const[c,...d]=h.split(": ");return[c,d.join(": ")]}):[]),{contentLength:o,isRangeSupported:l}=i1({responseHeaders:r,isHttp:i.isHttp,rangeChunkSize:e,disableRange:t});this._contentLength=o,this._isRangeSupported=l,this._filename=s1(r),this._isRangeSupported&&i._abortRequest(s),this._headersCapability.resolve()},p1=function(i){this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._cachedChunks.push(i),this._done=!0,this._cachedChunks.length===0&&n(this,Xf).call(this)},g1=function(i){this._storedError=Dm(i,this._stream.url),this._headersCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},f1=function(i){var t;(t=this.onProgress)==null||t.call(this,{loaded:i.loaded,total:i.lengthComputable?i.total:this._contentLength})};var Yf,Jl,m1,v1,Cw;class Yx extends Tm{constructor(t,e,s){super(t,e,s),f(this,Jl),f(this,Yf,Rm.bind(this)),S(this,"onClosed",null),S(this,"_done",!1),S(this,"_queuedChunk",null),S(this,"_requests",[]),S(this,"_storedError",null),this._requestXhr=t._request({begin:e,end:s,onHeadersReceived:m(this,Jl,m1).bind(this),onDone:m(this,Jl,v1).bind(this),onError:m(this,Jl,Cw).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){var e;
45this._done=!0,n(this,Yf).call(this),this._stream._abortRequest(this._requestXhr),(e=this.onClosed)==null||e.call(this)}}Yf=new WeakMap,Jl=new WeakSet,m1=function(){var i;const t=Im((i=this._requestXhr)==null?void 0:i.responseURL);try{n1(t,this._stream._responseOrigin)}catch(e){this._storedError=e,m(this,Jl,Cw).call(this,0)}},v1=function(i){var t;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0,n(this,Yf).call(this),(t=this.onClosed)==null||t.call(this)},Cw=function(i){this._storedError??(this._storedError=Dm(i,this._stream.url));for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};function w1(i,t=null){const e=process.getBuiltinModule("fs"),{Readable:s}=process.getBuiltinModule("stream"),a=e.createReadStream(i,t);return s.toWeb(a)}class Kx extends Cm{constructor(t){super(t,qx,Qx);const{url:e}=t;Tt(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}}class qx extends Pm{constructor(t){super(t),S(this,"_reader",null);const{disableRange:e,disableStream:s,rangeChunkSize:a,url:r}=t._source;this._isStreamingSupported=!s,process.getBuiltinModule("fs/promises").lstat(r).then(o=>{const l=w1(r);this._reader=l.getReader();const{size:h}=o;this._contentLength=h,this._isRangeSupported=!e&&h>2*a,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Fa("Streaming is disabled.")),this._headersCapability.resolve()}).catch(o=>{o.code==="ENOENT"&&(o=Dm(0,r)),this._headersCapability.reject(o)})}async read(){await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:Lm(t),done:!1})}cancel(t){var e;(e=this._reader)==null||e.cancel(t)}}class Qx extends Tm{constructor(t,e,s){super(t,e,s),S(this,"_readCapability",Promise.withResolvers()),S(this,"_reader",null);const{url:a}=t._source;try{const r=w1(a,{start:e,end:s-1});this._reader=r.getReader(),this._readCapability.resolve()}catch(r){this._readCapability.reject(r)}}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:Lm(t),done:!1}}cancel(t){var e;(e=this._reader)==null||e.cancel(t)}}function Jx(i){return Wd(i)?Bx:vi?Kx:Gx}var tp,ep,ip;let Ta=(tp=class{static get workerPort(){return n(this,ep)}static set workerPort(i){if(!(typeof Worker<"u"&&i instanceof Worker)&&i!==null)throw new Error("Invalid `workerPort` type.");u(this,ep,i)}static get workerSrc(){return n(this,ip)}static set workerSrc(i){if(typeof i!="string")throw new Error("Invalid `workerSrc` type.");u(this,ip,i)}},ep=new WeakMap,ip=new WeakMap,f(tp,ep,null),f(tp,ip,""),tp);var qc,lg;class Zx{constructor({parsedData:t,rawData:e}){f(this,qc),f(this,lg),u(this,qc,t),u(this,lg,e)}getRaw(){return n(this,lg)}get(t){return n(this,qc).get(t)??null}[Symbol.iterator](){return n(this,qc).entries()}}qc=new WeakMap,lg=new WeakMap;const wl=Symbol("INTERNAL");var hg,cg,dg,Qc;class tk{constructor(t,{name:e,intent:s,usage:a,rbGroups:r}){f(this,hg,!1),f(this,cg,!1),f(this,dg,!1),f(this,Qc,!0),u(this,hg,!!(t&gi.DISPLAY)),u(this,cg,!!(t&gi.PRINT)),this.name=e,this.intent=s,this.usage=a,this.rbGroups=r}get visible(){if(n(this,dg))return n(this,Qc);if(!n(this,Qc))return!1;const{print:t,view:e}=this.usage;return n(this,hg)?(e==null?void 0:e.viewState)!=="OFF":n(this,cg)?(t==null?void 0:t.printState)!=="OFF":!0}_setVisible(t,e,s=!1){t!==wl&&at("Internal method `_setVisible` called."),u(this,dg,s),u(this,Qc,e)}}hg=new WeakMap,cg=new WeakMap,dg=new WeakMap,Qc=new WeakMap;var Sr,ft,Jc,Zc,Kf,Pw;class ek{constructor(t,e=gi.DISPLAY){if(f(this,Kf),f(this,Sr,null),f(this,ft,new Map),f(this,Jc,null),f(this,Zc,null),this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,u(this,Zc,t.order);for(const s of t.groups)n(this,ft).set(s.id,new tk(e,s));if(t.baseState==="OFF")for(const s of n(this,ft).values())s._setVisible(wl,!1);for(const s of t.on)n(this,ft).get(s)._setVisible(wl,!0);for(const s of t.off)n(this,ft).get(s)._setVisible(wl,!1);u(this,Jc,this.getHash())}}isVisible(t){if(n(this,ft).size===0)return!0;
45if(!t)return xm("Optional content group not defined."),!0;if(t.type==="OCG")return n(this,ft).has(t.id)?n(this,ft).get(t.id).visible:(Y(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return m(this,Kf,Pw).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const e of t.ids){if(!n(this,ft).has(e))return Y(`Optional content group not found: ${e}`),!0;if(n(this,ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const e of t.ids){if(!n(this,ft).has(e))return Y(`Optional content group not found: ${e}`),!0;if(!n(this,ft).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const e of t.ids){if(!n(this,ft).has(e))return Y(`Optional content group not found: ${e}`),!0;if(!n(this,ft).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const e of t.ids){if(!n(this,ft).has(e))return Y(`Optional content group not found: ${e}`),!0;if(n(this,ft).get(e).visible)return!1}return!0}return Y(`Unknown optional content policy ${t.policy}.`),!0}return Y(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,s=!0){var a;const r=n(this,ft).get(t);if(!r){Y(`Optional content group not found: ${t}`);return}if(s&&e&&r.rbGroups.length)for(const o of r.rbGroups)for(const l of o)l!==t&&((a=n(this,ft).get(l))==null||a._setVisible(wl,!1,!0));r._setVisible(wl,!!e,!0),u(this,Sr,null)}setOCGState({state:t,preserveRB:e}){let s;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":s=a;continue}const r=n(this,ft).get(a);if(r)switch(s){case"ON":this.setVisibility(a,!0,e);break;case"OFF":this.setVisibility(a,!1,e);break;case"Toggle":this.setVisibility(a,!r.visible,e);break}}u(this,Sr,null)}get hasInitialVisibility(){return n(this,Jc)===null||this.getHash()===n(this,Jc)}getOrder(){return n(this,ft).size?n(this,Zc)?n(this,Zc).slice():[...n(this,ft).keys()]:null}getGroup(t){return n(this,ft).get(t)||null}getHash(){if(n(this,Sr)!==null)return n(this,Sr);const t=new lw;for(const[e,s]of n(this,ft))t.update(`${e}:${s.visible}`);return u(this,Sr,t.hexdigest())}[Symbol.iterator](){return n(this,ft).entries()}}Sr=new WeakMap,ft=new WeakMap,Jc=new WeakMap,Zc=new WeakMap,Kf=new WeakSet,Pw=function(i){const t=i.length;if(t<2)return!0;const e=i[0];for(let s=1;s<t;s++){const a=i[s];let r;if(Array.isArray(a))r=m(this,Kf,Pw).call(this,a);else if(n(this,ft).has(a))r=n(this,ft).get(a).visible;else return Y(`Optional content group not found: ${a}`),!0;switch(e){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return e==="And"};var Kt,Cs,Ce,bl,Xs,li,td,ed,ug;class ik{constructor(){f(this,li),f(this,Kt,null),f(this,Cs,null),f(this,Ce,0),f(this,bl,null),f(this,Xs,null)}get pagesNumber(){return n(this,Ce)}set pagesNumber(t){n(this,Ce)!==t&&(u(this,Ce,t),u(this,Kt,null),u(this,Cs,null))}movePages(t,e,s){m(this,li,td).call(this);const a=n(this,Kt),r=m(this,li,ed).call(this),o=e.length,l=new Uint32Array(o);let h=0;for(let g=0;g<o;g++){const v=e[g]-1;l[g]=a[v],v<s&&h++}const c=n(this,Ce),d=c-o,p=xt(s-h,0,d);for(let g=0,v=0;g<c;g++)t.has(g+1)||(a[v++]=a[g]);a.copyWithin(p+o,p,d),a.set(l,p),m(this,li,ug).call(this,r),a.every((g,v)=>g===v+1)&&u(this,Kt,null)}deletePages(t){m(this,li,td).call(this);const e=n(this,Kt),s=m(this,li,ed).call(this);u(this,Xs,{pageNumberToId:e.slice(),pagesNumber:n(this,Ce),prevPageNumbers:n(this,Cs).slice()});const a=n(this,Ce)-t.length;u(this,Ce,a);const r=u(this,Kt,new Uint32Array(a));u(this,Cs,new Int32Array(a));let o=0,l=0;for(const h of t){const c=h-1;c!==o&&(r.set(e.subarray(o,c),l),l+=c-o),o=c+1}o<e.length&&r.set(e.subarray(o),l),m(this,li,ug).call(this,s,new Set(t))}cancelDelete(){n(this,Xs)&&(u(this,Kt,n(this,Xs).pageNumberToId),u(this,Ce,n(this,Xs).pagesNumber),u(this,Cs,n(this,Xs).prevPageNumbers),u(this,Xs,null))}cleanSavedData(){u(this,Xs,null)}copyPages(t){m(this,li,td).call(this),u(this,bl,{pageNumbers:t,pageIds:t.map(e=>n(this,Kt)[e-1])})}cancelCopy(){u(this,bl,null)}pastePages(t){m(this,li,td).call(this);const e=n(this,Kt),s=m(this,li,ed).call(this),{pageNumbers:a,pageIds:r}=n(this,bl),o=n(this,Ce)+a.length;u(this,Ce,o);const l=u(this,Kt,new Uint32Array(o));u(this,Cs,new Int32Array(o)),l.set(e.subarray(0,t),0),l.set(r,t),l.set(e.subarray(t),t+a.length),m(this,li,ug).call(this,s,null,t,a),u(this,bl,null)}hasBeenAltered(){return n(this,Kt)!==null}getPageMappingForSaving(t=null){t??(t=m(this,li,ed).call(this));let e=0;for(const a of t.values())e=Math.max(e,a.length);const s=new Array(e);for(let a=0;a<e;a++)s[a]={document:null,pageIndices:[],includePages:[]};for(const[a,r]of t)for(let o=0,l=r.length;o<l;o++)s[o].includePages.push([a-1,r[o]-1]);for(const{includePages:a,pageIndices:r}of s){a.sort((o,l)=>o[0]-l[0]);for(let o=0,l=a.length;o<l;o++)r.push(a[o][1]),a[o]=a[o][0]}return s}extractPages(t){t=Array.from(t).sort((s,a)=>s-a);const e=new Map;for(let s=0,a=t.length;s<a;s++){const r=this.getPageId(t[s]);e.getOrInsertComputed(r,Hb).push(s+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){var e;return((e=n(this,Cs))==null?void 0:e[t-1])??0}getPageNumber(t){if(!n(this,Kt))return t;const e=n(this,Kt);for(let s=0,a=n(this,Ce);s<a;s++)if(e[s]===t)return s+1;return 0}getPageId(t){var e;return((e=n(this,Kt))==null?void 0:e[t-1])??t}getMapping(){var t;return(t=n(this,Kt))==null?void 0:t.subarray(0,this.pagesNumber)}}Kt=new WeakMap,Cs=new WeakMap,Ce=new WeakMap,bl=new WeakMap,Xs=new WeakMap,li=new WeakSet,td=function(){if(n(this,Kt))return;const i=n(this,Ce),t=u(this,Kt,new Uint32Array(i));for(let e=0;e<i;e++)t[e]=e+1;u(this,Cs,new Int32Array(t))},ed=function(){const i=new Map,t=n(this,Kt);for(let e=0,s=n(this,Ce);e<s;e++){const a=t[e],r=i.get(a);r?r.push(e+1):i.set(a,[e+1])}return i},ug=function(i,t=null,e=-1,s=null){const a=n(this,Cs),r=n(this,Kt),o=e+((s==null?void 0:s.length)??0),l=new Map;for(let h=0,c=n(this,Ce);h<c;h++){if(h>=e&&h<o){a[h]=-s[h-e];continue}const d=r[h],p=i.get(d);let g=l.get(d)||0;if(t&&p)for(;g<p.length&&t.has(p[g]);)g++;a[h]=p==null?void 0:p[g],l.set(d,g+1)}};const yl=Symbol("INITIAL_DATA"),Z0=()=>({...Promise.withResolvers(),data:yl});var qi;class b1{constructor(){f(this,qi,new Map)}get(t,e=null){if(e){const a=n(this,qi).getOrInsertComputed(t,Z0);return a.promise.then(()=>e(a.data)),null}const s=n(this,qi).get(t);if(!s||s.data===yl)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=n(this,qi).get(t);return!!e&&e.data!==yl}delete(t){const e=n(this,qi).get(t);return!e||e.data===yl?!1:(n(this,qi).delete(t),!0)}resolve(t,e=null){const s=n(this,qi).getOrInsertComputed(t,Z0);if(s.data!==yl)throw new Error(`Object already resolved ${t}.`);s.data=e,s.resolve()}clear(){var t;for(const{data:e}
45of n(this,qi).values())(t=e==null?void 0:e.bitmap)==null||t.close();n(this,qi).clear()}*[Symbol.iterator](){for(const[t,{data:e}]of n(this,qi))e!==yl&&(yield[t,e])}}qi=new WeakMap;const sk=1e5,ty=30;var ey,qa,ze,sp,np,Yh,Qa,Ln,ap,rp,Ro,op,Kh,Ja,qh,lp,Qh,No,hp,cp,de,Jh,Fo,dp,Zh,tc,Oo,iy,sy,iv,js,up,sv,ny,ay;let Tw=(de=class{constructor({textContentSource:i,images:t,container:e,viewport:s}){f(this,Oo),f(this,qa,Promise.withResolvers()),f(this,ze,null),f(this,sp,!1),f(this,np,!!((ey=globalThis.FontInspector)!=null&&ey.enabled)),f(this,Yh,null),f(this,Qa,null),f(this,Ln,null),f(this,ap,0),f(this,rp,0),f(this,Ro,null),f(this,op,null),f(this,Kh,0),f(this,Ja,0),f(this,qh,Object.create(null)),f(this,lp,[]),f(this,Qh,null),f(this,No,[]),f(this,hp,new WeakMap),f(this,cp,null);var a;if(i instanceof ReadableStream)u(this,Qh,i);else if(typeof i=="object")u(this,Qh,new ReadableStream({start(c){c.enqueue(i),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');u(this,ze,u(this,op,e)),u(this,Yh,t),u(this,Ja,s.scale*yo.pixelRatio),u(this,Kh,s.rotation),u(this,Ln,{div:null,properties:null,ctx:null});const{pageWidth:r,pageHeight:o,pageX:l,pageY:h}=s.rawDims;u(this,cp,[1,0,0,-1,-l,h+o]),u(this,rp,r),u(this,ap,o),m(a=de,js,ny).call(a),e.style.setProperty("--min-font-size",n(de,Zh)),bo(e,s),n(this,qa).promise.finally(()=>{n(de,tc).delete(this),u(this,Ln,null),u(this,qh,null)}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:i,isFirefox:t}=Jt.platform;return G(this,"fontFamilyMap",new Map([["sans-serif",`${i&&t?"Calibri, ":""}sans-serif`],["monospace",`${i&&t?"Lucida Console, ":""}monospace`]]))}render(){n(this,Yh)&&n(this,ze).append(n(this,Yh).render());const i=()=>{n(this,Ro).read().then(({value:t,done:e})=>{if(e){n(this,qa).resolve();return}n(this,Qa)??u(this,Qa,t.lang),Object.assign(n(this,qh),t.styles),m(this,Oo,iy).call(this,t.items),i()},n(this,qa).reject)};return u(this,Ro,n(this,Qh).getReader()),n(de,tc).add(this),i(),n(this,qa).promise}update({viewport:i,onBefore:t=null}){var e;const s=i.scale*yo.pixelRatio,a=i.rotation;if(a!==n(this,Kh)&&(t==null||t(),u(this,Kh,a),bo(n(this,op),{rotation:a})),s!==n(this,Ja)){t==null||t(),u(this,Ja,s);const r={div:null,properties:null,ctx:m(e=de,js,up).call(e,n(this,Qa))};for(const o of n(this,No))r.properties=n(this,hp).get(o),r.div=o,m(this,Oo,iv).call(this,r)}}cancel(){var i;const t=new Fa("TextLayer task cancelled.");(i=n(this,Ro))==null||i.cancel(t).catch(()=>{}),u(this,Ro,null),n(this,qa).reject(t)}get textDivs(){return n(this,No)}get textContentItemsStr(){return n(this,lp)}static cleanup(){if(!(n(this,tc).size>0)){n(this,Jh).clear();for(const{canvas:i}of n(this,Fo).values())i.remove();n(this,Fo).clear()}}},qa=new WeakMap,ze=new WeakMap,sp=new WeakMap,np=new WeakMap,Yh=new WeakMap,Qa=new WeakMap,Ln=new WeakMap,ap=new WeakMap,rp=new WeakMap,Ro=new WeakMap,op=new WeakMap,Kh=new WeakMap,Ja=new WeakMap,qh=new WeakMap,lp=new WeakMap,Qh=new WeakMap,No=new WeakMap,hp=new WeakMap,cp=new WeakMap,Jh=new WeakMap,Fo=new WeakMap,dp=new WeakMap,Zh=new WeakMap,tc=new WeakMap,Oo=new WeakSet,iy=function(i){var t,e;if(n(this,sp))return;(e=n(this,Ln)).ctx??(e.ctx=m(t=de,js,up).call(t,n(this,Qa)));const s=n(this,No),a=n(this,lp);for(const r of i){if(s.length>sk){Y("Ignoring additional textDivs for performance reasons."),u(this,sp,!0);return}if(r.str===void 0){if(r.type==="beginMarkedContentProps"||r.type==="beginMarkedContent"){const o=n(this,ze);u(this,ze,document.createElement("span")),n(this,ze).classList.add("markedContent"),r.id&&n(this,ze).setAttribute("id",`${r.id}`),r.tag==="Artifact"&&(n(this,ze).ariaHidden=!0),o.append(n(this,ze))}else r.type==="endMarkedContent"&&u(this,ze,n(this,ze).parentNode);continue}a.push(r.str),m(this,Oo,sy).call(this,r)}},sy=function(i){var t;const e=document.createElement("span"),s={angle:0,canvasWidth:0,hasText:i.str!=="",hasEOL:i.hasEOL,fontSize:0};n(this,No).push(e);const a=R.transform(n(this,cp),i.transform);let r=Math.atan2(a[1],a[0]);const o=n(this,qh)[i.fontName];o.vertical&&(r+=Math.PI/2);let l=n(this,np)&&o.fontSubstitution||o.fontFamily;l=de.fontFamilyMap.get(l)||l;const h=Math.hypot(a[2],a[3]),c=h*m(t=de,js,ay).call(t,l,o,n(this,Qa));let d,p;r===0?(d=a[4],p=a[5]-c):(d=a[4]+c*Math.sin(r),p=a[5]-c*Math.cos(r));const g=e.style;g.left=`${(100*d/n(this,rp)).toFixed(2)}%`,g.top=`${(100*p/n(this,ap)).toFixed(2)}%`,g.setProperty("--font-height",`${h.toFixed(2)}px`),g.fontFamily=l,s.fontSize=h,e.setAttribute("role","presentation"),e.textContent=i.str,e.dir=i.dir,n(this,np)&&(e.dataset.fontName=o.fontSubstitutionLoadedName||i.fontName),r!==0&&(s.angle=r*(180/Math.PI));let v=!1;if(i.str.length>1)v=!0;else if(i.str!==" "&&i.transform[0]!==i.transform[3]){const w=Math.abs(i.transform[0]),b=Math.abs(i.transform[3]);w!==b&&Math.max(w,b)/Math.min(w,b)>1.5&&(v=!0)}if(v&&(s.canvasWidth=o.vertical?i.height:i.width),n(this,hp).set(e,s),n(this,Ln).div=e,n(this,Ln).properties=s,m(this,Oo,iv).call(this,n(this,Ln)),s.hasText&&n(this,ze).append(e),s.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),n(this,ze).append(w)}},iv=function(i){var t;const{div:e,properties:s,ctx:a}=i,{style:r}=e;if(s.canvasWidth!==0&&s.hasText){const{fontFamily:o}=r,{canvasWidth:l,fontSize:h}=s;m(t=de,js,sv).call(t,a,h*n(this,Ja),o);const{width:c}=a.measureText(e.textContent);c>0&&r.setProperty("--scale-x",l*n(this,Ja)/c)}s.angle!==0&&r.setProperty("--rotate",`${s.angle}deg`)},js=new WeakSet,up=function(i=null){let t=n(this,Fo).get(i||(i=""));if(!t){const e=document.createElement("canvas");e.className="hiddenCanvasElement",e.lang=i,document.body.append(e),t=e.getContext("2d",{alpha:!1,willReadFrequently:!0}),n(this,Fo).set(i,t),n(this,dp).set(t,{size:0,family:""})}return t},sv=function(i,t,e){const s=n(this,dp).get(i);t===s.size&&e===s.family||(i.font=`${t}px ${e}`,s.size=t,s.family=e)},ny=function(){if(n(this,Zh)!==null)return;const i=document.createElement("div");
45i.style.opacity=0,i.style.lineHeight=1,i.style.fontSize="1px",i.style.position="absolute",i.textContent="X",document.body.append(i),u(this,Zh,i.getBoundingClientRect().height),i.remove()},ay=function(i,t,e){const s=n(this,Jh).get(i);if(s)return s;const a=m(this,js,up).call(this,e);a.canvas.width=a.canvas.height=ty,m(this,js,sv).call(this,a,ty,i);const r=a.measureText(""),o=r.fontBoundingBoxAscent,l=Math.abs(r.fontBoundingBoxDescent);a.canvas.width=a.canvas.height=0;let h=.8;return o?h=o/(o+l):(Jt.platform.isFirefox&&Y("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),t.ascent?h=t.ascent:t.descent&&(h=1+t.descent)),n(this,Jh).set(i,h),h},f(de,js),f(de,Jh,new Map),f(de,Fo,new Map),f(de,dp,new WeakMap),f(de,Zh,null),f(de,tc,new Set),de);const nk=100;function y1(i={}){typeof i=="string"||i instanceof URL?i={url:i}:(i instanceof ArrayBuffer||ArrayBuffer.isView(i))&&(i={data:i});const t=new ak,{docId:e}=t,s=i.url?hx(i.url):null,a=i.data?cx(i.data):null,r=i.httpHeaders||null,o=i.withCredentials===!0,l=i.password??null,h=i.range instanceof E1?i.range:null,c=Number.isInteger(i.rangeChunkSize)&&i.rangeChunkSize>0?i.rangeChunkSize:2**16;let d=i.worker instanceof Dw?i.worker:null;const p=i.verbosity,g=typeof i.docBaseUrl=="string"&&!Sm(i.docBaseUrl)?i.docBaseUrl:null,v=Ku(i.cMapUrl),w=i.cMapPacked!==!1,b=Ku(i.iccUrl),y=Ku(i.standardFontDataUrl),A=Ku(i.wasmUrl),_=i.stopAtErrors!==!0,E=Number.isInteger(i.maxImageSize)&&i.maxImageSize>-1?i.maxImageSize:-1,x=typeof i.isOffscreenCanvasSupported=="boolean"?i.isOffscreenCanvasSupported:!vi,k=typeof i.isImageDecoderSupported=="boolean"?i.isImageDecoderSupported:!vi&&(Jt.platform.isFirefox||!globalThis.chrome),C=Number.isInteger(i.canvasMaxAreaInBytes)?i.canvasMaxAreaInBytes:-1,I=typeof i.disableFontFace=="boolean"?i.disableFontFace:vi,P=i.fontExtraProperties===!0,M=i.enableXfa===!0,D=i.ownerDocument||globalThis.document,L=i.disableRange===!0,W=i.disableStream===!0,$=i.disableAutoFetch===!0,j=i.pdfBug===!0,F=i.CanvasFactory||(vi?wx:gx),N=i.FilterFactory||(vi?vx:fx),Q=i.BinaryDataFactory||(vi?bx:H0),X=i.enableHWA===!0,oe=i.enableWebGPU===!0?_x():Promise.resolve(!1),_e=i.useWasm!==!1,Re=i.pagesMapper||new ik,yt=typeof i.useSystemFonts=="boolean"?i.useSystemFonts:!vi&&!I,St=typeof i.useWorkerFetch=="boolean"?i.useWorkerFetch:!!(Q===H0&&v&&w&&y&&A&&Wd(v,document.baseURI)&&Wd(y,document.baseURI)&&Wd(A,document.baseURI)),xo=null;SE(p);const Ne={canvasFactory:new F({ownerDocument:D,enableHWA:X}),filterFactory:new N({docId:e,ownerDocument:D}),binaryDataFactory:St?null:new Q({cMapUrl:v,standardFontDataUrl:y,wasmUrl:A})};d||(d=Dw.create({verbosity:p,port:Ta.workerPort}),t._worker=d);const He={docId:e,apiVersion:"5.7.284",data:a,password:l,disableAutoFetch:$,rangeChunkSize:c,docBaseUrl:g,enableXfa:M,evaluatorOptions:{maxImageSize:E,disableFontFace:I,ignoreErrors:_,isOffscreenCanvasSupported:x,isImageDecoderSupported:k,canvasMaxAreaInBytes:C,fontExtraProperties:P,useSystemFonts:yt,useWasm:_e,useWorkerFetch:St,cMapUrl:v,cMapPacked:w,iccUrl:b,standardFontDataUrl:y,wasmUrl:A,hasGPU:!1}},Ut={ownerDocument:D,pdfBug:j,styleElement:xo,enableHWA:X,loadingParams:{disableAutoFetch:$,enableXfa:M}};return Promise.all([d.promise,oe]).then(function([,vE]){if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");He.evaluatorOptions.hasGPU=vE;const wE=d.messageHandler.sendWithPromise("GetDocRequest",He,a?[a.buffer]:null);let Wm;if(!a)if(h)Wm=new Ux({pdfDataRangeTransport:h,disableRange:L,disableStream:W});else if(s){const Bm=Jx(s);Wm=new Bm({url:s,httpHeaders:r,withCredentials:o,rangeChunkSize:c,disableRange:L,disableStream:W})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return wE.then(Bm=>{if(t.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const o0=new Gc(e,Bm,d.port),bE=new hk(o0,t,Wm,Ut,Ne,Re);t._transport=bE,o0.send("Ready",null)})}).catch(t._capability.reject),t}var Iw;const A1=class _1{constructor(){S(this,"_capability",Promise.withResolvers()),S(this,"_transport",null),S(this,"_worker",null),S(this,"docId",`d${jt(_1,Iw)._++}`),S(this,"destroyed",!1),S(this,"onPassword",null),S(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){var t,e,s,a;this.destroyed=!0;try{(t=this._worker)!=null&&t.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(r){throw(s=this._worker)!=null&&s.port&&delete this._worker._pendingDestroy,r}this._transport=null,(a=this._worker)==null||a.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Iw=new WeakMap,f(A1,Iw,0);let ak=A1;var ec,Wo,ry;let E1=(ry=class{constructor(i,t,e=!1,s=null){f(this,ec,Promise.withResolvers()),f(this,Wo,null),this.length=i,this.initialData=t,this.progressiveDone=e,this.contentDispositionFilename=s,Object.defineProperty(this,"onDataProgress",{value:()=>{OE("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}onDataRange(i,t){n(this,Wo).call(this,{type:"range",begin:i,chunk:t})}onDataProgressiveRead(i){n(this,ec).promise.then(()=>{n(this,Wo).call(this,{type:"progressiveRead",chunk:i})})}onDataProgressiveDone(){n(this,ec).promise.then(()=>{n(this,Wo).call(this,{type:"progressiveDone"})})}transportReady(i){u(this,Wo,i),n(this,ec).resolve()}requestDataRange(i,t){at("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},ec=new WeakMap,Wo=new WeakMap,ry);class rk{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 G(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()}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){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var va,Al,_l,id;const ok=class x1{constructor(t,e,s,a,r=!1){f(this,_l),f(this,va,!1),f(this,Al,null),this._pageIndex=t,this._pageInfo=e,this._transport=s,this._stats=r?new c0:null,this._pdfBug=r,this.commonObjs=s.commonObjs,this.objs=new b1,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,u(this,Al,a),this.imageCoordinates=null}clone(t){const e=new x1(t,this._pageInfo,this._transport,n(this,Al),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:s=0,offsetY:a=0,dontFlip:r=!1}={}){return new Mu({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:s,offsetY:a,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 G(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:s,intent:a="display",annotationMode:r=fa.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:h=null,annotationCanvasMap:c=null,pageColors:d=null,printAnnotationStorage:p=null,isEditing:g=!1,recordImages:v=!1,recordOperations:w=!1,operationsFilter:b=null}){var y,A,_;(y=this._stats)==null||y.time("Overall");const E=this._transport.getRenderingIntent(a,r,p,g),{renderingIntent:x,cacheKey:k}=E;u(this,va,!1),h||(h=this._transport.getOptionalContentConfig(x));const C=this._intentStates.getOrInsertComputed(k,Gv);C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);const I=!!(x&gi.PRINT);C.displayReadyCapability||(C.displayReadyCapability=Promise.withResolvers(),C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(A=this._stats)==null||A.time("Page Request"),this._pumpOperatorList(E));const P=!!(this._pdfBug&&(_=globalThis.StepperManager)!=null&&_.enabled),M=!!e&&!this.recordedBBoxes&&(w||P),D=!!e&&!this.imageCoordinates&&v,L=N=>{var Q,X,oe,_e;if(C.renderTasks.delete(j),M){const Re=(Q=j.gfx)==null?void 0:Q.dependencyTracker.take();Re&&((X=j.stepper)==null||X.setOperatorBBoxes(Re,j.gfx.dependencyTracker.takeDebugMetadata()),w&&(this.recordedBBoxes=Re))}D&&!N&&(this.imageCoordinates=(oe=j.gfx)==null?void 0:oe.imagesTracker.take()),I&&u(this,va,!0),m(this,_l,id).call(this),N?(j.capability.reject(N),this._abortOperatorList({intentState:C,reason:N instanceof Error?N:new Error(N)})):j.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(_e=globalThis.Stats)!=null&&_e.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))};let W=null,$=null;(M||D)&&($=new JE(e,C.operatorList.length)),M&&(W=new ZE($,P));const j=new dk({callback:L,params:{canvas:e,canvasContext:t,dependencyTracker:W??$,imagesTracker:D?new ex(e):null,viewport:s,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!I,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA,operationsFilter:b});(C.renderTasks||(C.renderTasks=new Set)).add(j);const F=j.task;return Promise.all([C.displayReadyCapability.promise,h]).then(([N,Q])=>{var X;if(this.destroyed){L();return}if((X=this._stats)==null||X.time("Rendering"),!(Q.renderingIntent&x))throw new Error("Mu
45st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");j.initializeGraphics({transparency:N,optionalContentConfig:Q}),j.operatorListChanged()}).catch(L),F}getOperatorList({intent:t="display",annotationMode:e=fa.ENABLE,printAnnotationStorage:s=null,isEditing:a=!1}={}){var r;function o(){h.operatorList.lastChunk&&(h.opListReadCapability.resolve(h.operatorList),h.renderTasks.delete(c))}const l=this._transport.getRenderingIntent(t,e,s,a,!0),h=this._intentStates.getOrInsertComputed(l.cacheKey,Gv);let c;return h.opListReadCapability||(c=Object.create(null),c.operatorListChanged=o,h.opListReadCapability=Promise.withResolvers(),(h.renderTasks||(h.renderTasks=new Set)).add(c),h.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(r=this._stats)==null||r.time("Page Request"),this._pumpOperatorList(l)),h.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:n(this,Al).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(a=>Au.textContent(a));const e=this.streamTextContent(t),s={items:[],styles:Object.create(null),lang:null};for await(const a of e)s.lang??(s.lang=a.lang),Object.assign(s.styles,a.styles),s.items.push(...a.items);return s}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 s of e.renderTasks)t.push(s.completed),s.cancel();return this.objs.clear(),u(this,va,!1),Promise.all(t)}cleanup(t=!1){u(this,va,!0);const e=m(this,_l,id).call(this);return t&&e&&this._stats&&(this._stats=new c0),e}_startRenderPage(t,e){var s,a;const r=this._intentStates.get(e);r&&((s=this._stats)==null||s.timeEnd("Page Request"),(a=r.displayReadyCapability)==null||a.resolve(t))}_renderPageChunk(t,e){for(let s=0,a=t.length;s<a;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&m(this,_l,id).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:s,modifiedIds:a}){const{map:r,transfer:o}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:n(this,Al).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:r,modifiedIds:a},void 0,o).getReader(),h=this._intentStates.get(e);h.streamReader=l;const c=()=>{l.read().then(({value:d,done:p})=>{if(p){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,h),c())},d=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const p of h.renderTasks)p.operatorListChanged();m(this,_l,id).call(this)}if(h.displayReadyCapability)h.displayReadyCapability.reject(d);else if(h.opListReadCapability)h.opListReadCapability.reject(d);else throw d}})};c()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!s){if(t.renderTasks.size>0)return;if(e instanceof Gb){let a=nk;e.extraDelay>0&&e.extraDelay<1e3&&(a+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},a);return}}if(t.streamReader.cancel(new Fa(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,r]of this._intentStates)if(r===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}};va=new WeakMap,Al=new WeakMap,_l=new WeakSet,id=function(){if(!n(this,va)||this.destroyed)return!1;for(const{renderTasks:i,operatorList:t}of this._intentStates.values())if(i.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),u(this,va,!1),!0};let lk=ok;var Za,ds,Rn,Bo,Dt,nv,jo,$o,Hi,pp,oy,ly,ic,sc,gp;let Dw=(Dt=class{constructor({name:i=null,port:t=null,verbosity:e=ME()}={}){if(f(this,Hi),f(this,Za,Promise.withResolvers()),f(this,ds,null),f(this,Rn,null),f(this,Bo,null),this.name=i,this.destroyed=!1,this.verbosity=e,t){if(n(Dt,$o).has(t))throw new Error("Cannot use more than one PDFWorker per port.");n(Dt,$o).set(t,this),m(this,Hi,oy).call(this,t)}else m(this,Hi,ly).call(this)}get promise(){return n(this,Za).promise}get port(){return n(this,Rn)}get messageHandler(){return n(this,ds)}destroy(){var i,t;this.destroyed=!0,(i=n(this,Bo))==null||i.terminate(),u(this,Bo,null),n(Dt,$o).delete(n(this,Rn)),u(this,Rn,null),(t=n(this,ds))==null||t.destroy(),u(this,ds,null)}static create(i){const t=n(this,$o).get(i==null?void 0:i.port);
45if(t){if(t._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new Dt(i)}static get workerSrc(){if(Ta.workerSrc)return Ta.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return G(this,"_setupFakeWorkerGlobal",(async()=>n(this,sc,gp)?n(this,sc,gp):(await import(this.workerSrc)).WorkerMessageHandler)())}},Za=new WeakMap,ds=new WeakMap,Rn=new WeakMap,Bo=new WeakMap,nv=new WeakMap,jo=new WeakMap,$o=new WeakMap,Hi=new WeakSet,pp=function(){n(this,Za).resolve(),n(this,ds).send("configure",{verbosity:this.verbosity})},oy=function(i){u(this,Rn,i),u(this,ds,new Gc("main","worker",i)),n(this,ds).on("ready",()=>{}),m(this,Hi,pp).call(this)},ly=function(){if(n(Dt,jo)||n(Dt,sc,gp)){m(this,Hi,ic).call(this);return}let{workerSrc:i}=Dt;try{Dt._isSameOrigin(window.location,i)||(i=Dt._createCDNWrapper(new URL(i,window.location).href));const t=new Worker(i,{type:"module"}),e=new Gc("main","worker",t),s=()=>{a.abort(),e.destroy(),t.terminate(),this.destroyed?n(this,Za).reject(new Error("Worker was destroyed")):m(this,Hi,ic).call(this)},a=new AbortController;t.addEventListener("error",()=>{n(this,Bo)||s()},{signal:a.signal}),e.on("test",o=>{if(a.abort(),this.destroyed||!o){s();return}u(this,ds,e),u(this,Rn,t),u(this,Bo,t),m(this,Hi,pp).call(this)}),e.on("ready",o=>{if(a.abort(),this.destroyed){s();return}try{r()}catch{m(this,Hi,ic).call(this)}});const r=()=>{const o=new Uint8Array;e.send("test",o,[o.buffer])};r();return}catch{xm("The worker has been disabled.")}m(this,Hi,ic).call(this)},ic=function(){n(Dt,jo)||(Y("Setting up fake worker."),u(Dt,jo,!0)),Dt._setupFakeWorkerGlobal.then(i=>{if(this.destroyed){n(this,Za).reject(new Error("Worker was destroyed"));return}const t=new px;u(this,Rn,t);const e=`fake${jt(Dt,nv)._++}`,s=new Gc(e+"_worker",e,t);i.setup(s,t),u(this,ds,new Gc(e,e+"_worker",t)),m(this,Hi,pp).call(this)}).catch(i=>{n(this,Za).reject(new Error(`Setting up fake worker failed: "${i.message}".`))})},sc=new WeakSet,gp=function(){var i;try{return((i=globalThis.pdfjsWorker)==null?void 0:i.WorkerMessageHandler)||null}catch{return null}},f(Dt,sc),f(Dt,nv,0),f(Dt,jo,!1),f(Dt,$o,new WeakMap),vi&&(u(Dt,jo,!0),Ta.workerSrc||(Ta.workerSrc="./pdf.worker.mjs")),Dt._isSameOrigin=(i,t)=>{const e=URL.parse(i);if(!(e!=null&&e.origin)||e.origin==="null")return!1;const s=new URL(t,e);return e.origin===s.origin},Dt._createCDNWrapper=i=>{const t=`await import("${i}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))},Dt);var ki,Zl,Yn,bs,El,sd,Kn,Ys,nd,pg;class hk{constructor(t,e,s,a,r,o){f(this,Ys),S(this,"downloadInfoCapability",Promise.withResolvers()),f(this,ki,null),f(this,Zl,new Map),f(this,Yn,null),f(this,bs,new Map),f(this,El,new Map),f(this,sd,new Map),f(this,Kn,null),this.messageHandler=t,this.loadingTask=e,u(this,Yn,s),this.commonObjs=new b1,this.fontLoader=new ix({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.enableHWA=a.enableHWA,this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.binaryDataFactory=r.binaryDataFactory,this.pagesMapper=o,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){const{_pageIndex:e}=t;n(this,bs).set(e,t),n(this,El).set(e,Promise.resolve(t))}get annotationStorage(){return G(this,"annotationStorage",new qb)}getRenderingIntent(t,e=fa.ENABLE,s=null,a=!1,r=!1){let o=gi.DISPLAY,l=Eu;switch(t){case"any":o=gi.ANY;break;case"display":break;case"print":o=gi.PRINT;break;default:Y(`getRenderingIntent - invalid intent: ${t}`)}const h=o&gi.PRINT&&s instanceof $A?s:this.annotationStorage;switch(e){case fa.DISABLE:o+=gi.ANNOTATIONS_DISABLE;break;case fa.ENABLE:break;case fa.ENABLE_FORMS:o+=gi.ANNOTATIONS_FORMS;break;case fa.ENABLE_STORAGE:o+=gi.ANNOTATIONS_STORAGE,l=h.serializable;break;default:Y(`getRenderingIntent - invalid annotationMode: ${e}`)}a&&(o+=gi.IS_EDITING),r&&(o+=gi.OPLIST);const{ids:c,hash:d}=h.modifiedIds,p=[o,l.hash,d];return{renderingIntent:o,cacheKey:p.join("_"),annotationStorageSerializable:l,modifiedIds:c}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(t=n(this,Kn))==null||t.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const a of n(this,bs).values())e.push(a._destroy());n(this,bs).clear(),n(this,El).clear(),n(this,sd).clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();
45const s=this.messageHandler.sendWithPromise("Terminate",null);return e.push(s),Promise.all(e).then(()=>{var a,r;this.commonObjs.clear(),this.fontLoader.clear(),n(this,Zl).clear(),this.filterFactory.destroy(),Tw.cleanup(),(a=n(this,Yn))==null||a.cancelAllRequests(new Fa("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",(s,a)=>{Tt(n(this,Yn),"GetReader - no `BasePDFStream` instance available."),u(this,ki,n(this,Yn).getFullReader()),n(this,ki).onProgress=r=>m(this,Ys,pg).call(this,r),a.onPull=()=>{n(this,ki).read().then(function({value:r,done:o}){if(o){a.close();return}Tt(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{a.error(r)})},a.onCancel=r=>{n(this,ki).cancel(r),a.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",async s=>{await n(this,ki).headersReady;const{isStreamingSupported:a,isRangeSupported:r,contentLength:o}=n(this,ki);return a&&r&&(n(this,ki).onProgress=null),{isStreamingSupported:a,isRangeSupported:r,contentLength:o}}),t.on("GetRangeReader",(s,a)=>{Tt(n(this,Yn),"GetRangeReader - no `BasePDFStream` instance available.");const r=n(this,Yn).getRangeReader(s.begin,s.end);if(!r){a.close();return}a.onPull=()=>{r.read().then(function({value:o,done:l}){if(l){a.close();return}Tt(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{a.error(o)})},a.onCancel=o=>{r.cancel(o),a.ready.catch(l=>{if(!this.destroyed)throw l})}}),t.on("GetDoc",({pdfInfo:s})=>{this.pagesMapper.pagesNumber=s.numPages,this._numPages=s.numPages,this._htmlForXfa=s.htmlForXfa,delete s.htmlForXfa,e._capability.resolve(new rk(s,this))}),t.on("DocException",s=>{e._capability.reject(Qe(s))}),t.on("PasswordRequest",s=>{u(this,Kn,Promise.withResolvers());try{if(!e.onPassword)throw Qe(s);const a=r=>{r instanceof Error?n(this,Kn).reject(r):n(this,Kn).resolve({password:r})};e.onPassword(a,s.code)}catch(a){n(this,Kn).reject(a)}return n(this,Kn).promise}),t.on("DataLoaded",s=>{m(this,Ys,pg).call(this,{loaded:s.length,total:s.length}),this.downloadInfoCapability.resolve(s)}),t.on("StartRenderPage",s=>{this.destroyed||n(this,bs).get(s.pageIndex)._startRenderPage(s.transparency,s.cacheKey)}),t.on("commonobj",([s,a,r])=>{var o;if(this.destroyed||this.commonObjs.has(s))return null;switch(a){case"Font":if("error"in r){const g=r.error;Y(`Error during font loading: ${g}`),this.commonObjs.resolve(s,g);break}const l=new rx(r),h=this._params.pdfBug&&(o=globalThis.FontInspector)!=null&&o.enabled?(g,v)=>globalThis.FontInspector.fontAdded(g,v):null,c=new sx(l,h,r.charProcOperatorList,r.extra);this.fontLoader.bind(c).catch(()=>t.sendWithPromise("FontFallback",{id:s})).finally(()=>{c.fontExtraProperties||c.clearData(),this.commonObjs.resolve(s,c)});break;case"CopyLocalImage":const{imageRef:d}=r;Tt(d,"The imageRef must be defined.");for(const g of n(this,bs).values())for(const[,v]of g.objs){if((v==null?void 0:v.ref)!==d)continue;if(!v.dataLen)return null;const w=structuredClone(v);return this.commonObjs.resolve(s,w),v.dataLen}break;case"FontPath":this.commonObjs.resolve(s,new lx(r));break;case"Image":this.commonObjs.resolve(s,r);break;case"Pattern":const p=new ox(r);this.commonObjs.resolve(s,p.getIR());break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([s,a,r,o])=>{var l;if(this.destroyed)return;const h=n(this,bs).get(a);if(!h.objs.has(s)){if(h._intentStates.size===0){(l=o==null?void 0:o.bitmap)==null||l.close();return}switch(r){case"Image":case"Pattern":h.objs.resolve(s,o);break;default:throw new Error(`Got unknown object type ${r}`)}}}),t.on("DocProgress",s=>{this.destroyed||m(this,Ys,pg).call(this,s)}),t.on("FetchBinaryData",async s=>{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(s)})}
45getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t;this.annotationStorage.size<=0&&Y("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:((t=n(this,ki))==null?void 0:t.filename)??null},s).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){const e={pageInfos:t};let s;if(this.annotationStorage.size>0){const{map:a,transfer:r}=this.annotationStorage.serializable;e.annotationStorage=a,s=r}return this.messageHandler.sendWithPromise("ExtractPages",e,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,s=this.pagesMapper.getPageId(t)-1,a=n(this,El).get(e);if(a)return a;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:s}).then(o=>{if(this.destroyed)throw new Error("Transport destroyed");o.refStr&&n(this,sd).set(o.refStr,s);const l=new lk(e,o,this,this.pagesMapper,this._params.pdfBug);return n(this,bs).set(e,l),l});return n(this,El).set(e,r),r}async getPageIndex(t){if(!vw(t))throw new Error("Invalid pageIndex request.");const e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),s=this.pagesMapper.getPageNumber(e+1);if(s===0)throw new Error("GetPageIndex: page has been removed.");return s-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return m(this,Ys,nd).call(this,"GetFieldObjects")}hasJSActions(){return m(this,Ys,nd).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)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return m(this,Ys,nd).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 m(this,Ys,nd).call(this,"GetOptionalContentConfig").then(e=>new ek(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata";return n(this,Zl).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>{var s,a;return{info:e[0],metadata:e[1]?new Zx(e[1]):null,contentDispositionFilename:((s=n(this,ki))==null?void 0:s.filename)??null,contentLength:((a=n(this,ki))==null?void 0:a.contentLength)??null,hasStructTree:e[2]}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of n(this,bs).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),n(this,Zl).clear(),this.filterFactory.destroy(!0),Tw.cleanup()}}cachedPageNumber(t){if(!vw(t))return null;const e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,s=n(this,sd).get(e);if(s>=0){const a=this.pagesMapper.getPageNumber(s+1);if(a!==0)return a}return null}}ki=new WeakMap,Zl=new WeakMap,Yn=new WeakMap,bs=new WeakMap,El=new WeakMap,sd=new WeakMap,Kn=new WeakMap,Ys=new WeakSet,nd=function(i,t=null){return n(this,Zl).getOrInsertComputed(i,()=>
45this.messageHandler.sendWithPromise(i,t))},pg=function({loaded:i,total:t}){var e,s;(s=(e=this.loadingTask).onProgress)==null||s.call(e,{loaded:i,total:t,percent:t?xt(Math.round(i/t*100),0,100):NaN})};class ck{constructor(t){S(this,"_internalRenderTask",null),S(this,"onContinue",null),S(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 Mr,th;const k1=class ad{constructor({callback:t,params:e,objs:s,commonObjs:a,annotationCanvasMap:r,operatorList:o,pageIndex:l,canvasFactory:h,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:p=!1,pageColors:g=null,enableHWA:v=!1,operationsFilter:w=null}){f(this,Mr,null),this.callback=t,this.params=e,this.objs=s,this.commonObjs=a,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=h,this.filterFactory=c,this._pdfBug=p,this.pageColors=g,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ck(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=v,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=w}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){var s,a;if(this.cancelled)return;if(this._canvas){if(n(ad,th).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(ad,th).add(this._canvas)}this._pdfBug&&(s=globalThis.StepperManager)!=null&&s.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:o,background:l,dependencyTracker:h,imagesTracker:c}=this.params,d=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new ig(d,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,h,c),this.gfx.beginDrawing({transform:o,viewport:r,transparency:t,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,(a=this.graphicsReadyCallback)==null||a.call(this)}cancel(t=null,e=0){var s,a,r;this.running=!1,this.cancelled=!0,(s=this.gfx)==null||s.endDrawing(),n(this,Mr)&&(window.cancelAnimationFrame(n(this,Mr)),u(this,Mr,null)),n(ad,th).delete(this._canvas),t||(t=new Gb(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),(r=(a=this.task).onError)==null||r.call(a,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?u(this,Mr,window.requestAnimationFrame(()=>{u(this,Mr,null),this._nextBound().catch(this._cancelBound)})):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(ad,th).delete(this._canvas),this.callback())))}};
45Mr=new WeakMap,th=new WeakMap,f(k1,th,new WeakSet);let dk=k1;const uk="5.7.284",pk="7e5b36c2d";var _i,Uo,nc,le,fp,ac,Nn,mp,tr,us,si,rc,Lt,av,rv,ov,er,hy,Fn;let S1=(si=class{constructor({editor:i=null,uiManager:t=null}){f(this,Lt),f(this,_i,null),f(this,Uo,null),f(this,nc),f(this,le,null),f(this,fp,!1),f(this,ac,!1),f(this,Nn,null),f(this,mp),f(this,tr,null),f(this,us,null);var e,s;i?(u(this,ac,!1),u(this,Nn,i)):u(this,ac,!0),u(this,us,(i==null?void 0:i._uiManager)||t),u(this,mp,n(this,us)._eventBus),u(this,nc,((e=i==null?void 0:i.color)==null?void 0:e.toUpperCase())||((s=n(this,us))==null?void 0:s.highlightColors.values().next().value)||"#FFFF98"),n(si,rc)||u(si,rc,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 G(this,"_keyboardManager",new Pu([[["Escape","mac+Escape"],si.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],si.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],si.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],si.prototype._moveToPrevious],[["Home","mac+Home"],si.prototype._moveToBeginning],[["End","mac+End"],si.prototype._moveToEnd]]))}renderButton(){const i=u(this,_i,document.createElement("button"));i.className="colorPicker",i.tabIndex="0",i.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),i.ariaHasPopup="true",n(this,Nn)&&(i.ariaControls=`${n(this,Nn).id}_colorpicker_dropdown`);const t=n(this,us)._signal;i.addEventListener("click",m(this,Lt,er).bind(this),{signal:t}),i.addEventListener("keydown",m(this,Lt,ov).bind(this),{signal:t});const e=u(this,Uo,document.createElement("span"));return e.className="swatch",e.ariaHidden="true",e.style.backgroundColor=n(this,nc),i.append(e),i}renderMainDropdown(){const i=u(this,le,m(this,Lt,av).call(this));return i.ariaOrientation="horizontal",i.ariaLabelledBy="highlightColorPickerLabel",i}_colorSelectFromKeyboard(i){if(i.target===n(this,_i)){m(this,Lt,er).call(this,i);return}const t=i.target.getAttribute("data-color");t&&m(this,Lt,rv).call(this,t,i)}_moveToNext(i){var t,e;if(!n(this,Lt,Fn)){m(this,Lt,er).call(this,i);return}if(i.target===n(this,_i)){(t=n(this,le).firstElementChild)==null||t.focus();return}(e=i.target.nextSibling)==null||e.focus()}_moveToPrevious(i){var t,e;if(i.target===((t=n(this,le))==null?void 0:t.firstElementChild)||i.target===n(this,_i)){n(this,Lt,Fn)&&this._hideDropdownFromKeyboard();return}n(this,Lt,Fn)||m(this,Lt,er).call(this,i),(e=i.target.previousSibling)==null||e.focus()}_moveToBeginning(i){var t;if(!n(this,Lt,Fn)){m(this,Lt,er).call(this,i);return}(t=n(this,le).firstElementChild)==null||t.focus()}_moveToEnd(i){var t;if(!n(this,Lt,Fn)){m(this,Lt,er).call(this,i);return}(t=n(this,le).lastElementChild)==null||t.focus()}hideDropdown(){var i,t;(i=n(this,le))==null||i.classList.add("hidden"),n(this,_i).ariaExpanded="false",(t=n(this,tr))==null||t.abort(),u(this,tr,null)}_hideDropdownFromKeyboard(){var i;if(!n(this,ac)){if(!n(this,Lt,Fn)){(i=n(this,Nn))==null||i.unselect();return}this.hideDropdown(),n(this,_i).focus({preventScroll:!0,focusVisible:n(this,fp)})}}updateColor(i){if(n(this,Uo)&&(n(this,Uo).style.backgroundColor=i),!n(this,le))return;const t=n(this,us).highlightColors.values();for(const e of n(this,le).children)e.ariaSelected=t.next().value===i.toUpperCase()}destroy(){var i,t;(i=n(this,_i))==null||i.remove(),u(this,_i,null),u(this,Uo,null),(t=n(this,le))==null||t.remove(),u(this,le,null)}},_i=new WeakMap,Uo=new WeakMap,nc=new WeakMap,le=new WeakMap,fp=new WeakMap,ac=new WeakMap,Nn=new WeakMap,mp=new WeakMap,tr=new WeakMap,us=new WeakMap,rc=new WeakMap,Lt=new WeakSet,av=function(){const i=document.createElement("div"),t=n(this,us)._signal;i.addEventListener("contextmenu",Bi,{signal:t}),i.className="dropdown",i.role="listbox",i.ariaMultiSelectable="false",i.ariaOrientation="vertical",i.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),n(this,Nn)&&(i.id=`${n(this,Nn).id}_colorpicker_dropdown`);for(const[e,s]of n(this,us).highlightColors){const a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",s),a.title=e,a.setAttribute("data-l10n-id",n(si,rc)[e]);const r=document.createElement("span");a.append(r),r.className="swatch",r.style.backgroundColor=s,a.ariaSelected=s===n(this,nc),a.addEventListener("click",m(this,Lt,rv).bind(this,s),{signal:t}),i.append(a)}return i.addEventListener("keydown",m(this,Lt,ov).bind(this),{signal:t}),i},rv=function(i,t){t.stopPropagation(),n(this,mp).dispatch("switchannotationeditorparams",{source:this,type:K.HIGHLIGHT_COLOR,value:i}),this.updateColor(i)},ov=function(i){si._keyboardManager.exec(this,i)},er=function(i){if(n(this,Lt,Fn)){this.hideDropdown();return}if(u(this,fp,i.detail===0),n(this,tr)||(u(this,tr,new AbortController),window.addEventListener("pointerdown",m(this,Lt,hy).bind(this),{signal:n(this,us).combinedSignal(n(this,tr))})),n(this,_i).ariaExpanded="true",n(this,le)){n(this,le).classList.remove("hidden");return}const t=u(this,le,m(this,Lt,av).call(this));n(this,_i).append(t)},hy=function(i){var t;(t=n(this,le))!=null&&t.contains(i.target)||this.hideDropdown()},Fn=function(){return n(this,le)&&!n(this,le).classList.contains("hidden")},f(si,rc,null),si);var Si,rd,xl,qn,Yd;const M1=class gg{constructor(t){f(this,Si,null),f(this,rd,!1),f(this,xl,null),f(this,qn,null),u(this,xl,t),u(this,qn,t._uiManager),n(gg,Yd)||u(gg,Yd,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(n(this,Si))return n(this,Si);const{editorType:t,colorType:e,colorAndOpacityType:s,opacityType:a,color:r,opacity:o}=n(this,xl),l=u(this,rd,Jt.isAlphaColorInputSupported&&a!==void 0),h=u(this,Si,document.createElement("input"));if(h.type="color",l){h.setAttribute("alpha","");const c=R.hexNums[Math.round((o??1)*255)];h.value=(r||"#000000")+c}else h.value=r||"#000000";return h.className="basicColorPicker",h.tabIndex=0,h.setAttribute("data-l10n-id",n(gg,Yd)[t]),h.addEventListener("input",()=>{if(l){const c=Yb(h.value);if(!c)return;const[d,p,g,v]=c,w=R.makeHexColor(d,p,g);s!==void 0?n(this,qn).updateParams(s,{color:w,opacity:v}):(n(this,qn).updateParams(e,w),n(this,qn).updateParams(a,v))}else n(this,qn).updateParams(e,h.value)},{signal:n(this,qn)._signal}),h}update(t){if(n(this,Si))if(n(this,rd)){const e=R.hexNums[Math.round(n(this,xl).opacity*255)];n(this,Si).value=t+e}else n(this,Si).value=t}updateOpacity(t){if(!n(this,Si)||!n(this,rd))return;const e=R.hexNums[Math.round(t*255)];n(this,Si).value=n(this,xl).color+e}destroy(){var t;(t=n(this,Si))==null||t.remove(),u(this,Si,null)}hideDropdown(){}};Si=new WeakMap,rd=new WeakMap,xl=new WeakMap,qn=new WeakMap,Yd=new WeakMap,f(M1,Yd,null);let C1=M1;function cy(i){return Math.floor(xt(i,0,1)*255).toString(16).padStart(2,"0")}function oc(i){return xt(i,0,1)*255}class dy{static CMYK_G([t,e,s,a]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+a
45)]}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=oc(t),[t,t,t]}static G_HTML([t]){const e=cy(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_rgb(t){return t.map(oc)}static RGB_HTML(t){return`#${t.map(cy).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,s,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,s+a),1-Math.min(1,e+a)]}static CMYK_rgb([t,e,s,a]){return[oc(1-Math.min(1,t+a)),oc(1-Math.min(1,s+a)),oc(1-Math.min(1,e+a))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const a=1-t,r=1-e,o=1-s,l=Math.min(a,r,o);return["CMYK",a,r,o,l]}}class gk{create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");return a.setAttribute("version","1.1"),s||(a.setAttribute("width",`${t}px`),a.setAttribute("height",`${e}px`)),a.setAttribute("preserveAspectRatio","none"),a.setAttribute("viewBox",`0 0 ${t} ${e}`),a}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){at("Abstract method `_createSVG` called.")}}let qf=class extends gk{_createSVG(i){return document.createElementNS(Hs,i)}};const fk=9,Ao=new WeakSet,mk=new Date().getTimezoneOffset()*60*1e3;class lv{static create(t){switch(t.data.annotationType){case Gt.LINK:return new Jb(t);case Gt.TEXT:return new bk(t);case Gt.WIDGET:switch(t.data.fieldType){case"Tx":return new yk(t);case"Btn":return t.data.radioButton?new D1(t):t.data.checkBox?new _k(t):new Ek(t);case"Ch":return new xk(t);case"Sig":return new Ak(t)}return new Eo(t);case Gt.POPUP:return new Nw(t);case Gt.FREETEXT:return new N1(t);case Gt.LINE:return new Sk(t);case Gt.SQUARE:return new Mk(t);case Gt.CIRCLE:return new Ck(t);case Gt.POLYLINE:return new F1(t);case Gt.CARET:return new Tk(t);case Gt.INK:return new Zb(t);case Gt.POLYGON:return new Pk(t);case Gt.HIGHLIGHT:return new O1(t);case Gt.UNDERLINE:return new Ik(t);case Gt.SQUIGGLY:return new Dk(t);case Gt.STRIKEOUT:return new Lk(t);case Gt.STAMP:return new W1(t);case Gt.FILEATTACHMENT:return new Rk(t);default:return new $t(t)}}}var Cr,od,Qi,fg,Lw;const vk=class P1{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:a=!1}={}){f(this,fg),f(this,Cr,null),f(this,od,!1),f(this,Qi,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(s)),a&&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 P1._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){var t;const{data:e}=this,s=(t=this.annotationStorage)==null?void 0:t.getEditor(e.id);return s?s.getData():e}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
45get commentButtonPosition(){var t;const e=(t=this.annotationStorage)==null?void 0:t.getEditor(this.data.id);if(e)return e.commentButtonPositionInPage;const{quadPoints:s,inkLists:a,rect:r}=this.data;let o=-1/0,l=-1/0;if((s==null?void 0:s.length)>=8){for(let h=0;h<s.length;h+=8)s[h+1]>l?(l=s[h+1],o=s[h+2]):s[h+1]===l&&(o=Math.max(o,s[h+2]));return[o,l]}if((a==null?void 0:a.length)>=1){for(const h of a)for(let c=0,d=h.length;c<d;c+=2)h[c+1]>l?(l=h[c+1],o=h[c]):h[c+1]===l&&(o=Math.max(o,h[c]));if(o!==1/0)return[o,l]}return r?[r[2],r[3]]:null}_normalizePoint(t){const{page:{view:e},viewport:{rawDims:{pageWidth:s,pageHeight:a,pageX:r,pageY:o}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-r)/s,t[1]=100*(t[1]-o)/a,t}get commentText(){var t,e,s;const{data:a}=this;return((e=(t=this.annotationStorage.getRawValue(`${yu}${a.id}`))==null?void 0:t.popup)==null?void 0:e.contents)||((s=a.contentsObj)==null?void 0:s.str)||""}set commentText(t){const{data:e}=this,s={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:s})||this.annotationStorage.setValue(`${yu}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:s,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){var t,e;(e=((t=n(this,Qi))==null?void 0:t.popup)||this.popup)==null||e.remove(),u(this,Qi,this.popup=null)}updateEdited(t){var e;if(!this.container)return;t.rect&&(n(this,Cr)||u(this,Cr,{rect:this.data.rect.slice(0)}));const{rect:s,popup:a}=t;s&&m(this,fg,Lw).call(this,s);let r=((e=n(this,Qi))==null?void 0:e.popup)||this.popup;!r&&a!=null&&a.text&&(this._createPopup(a),r=n(this,Qi).popup),r&&(r.updateEdited(t),a!=null&&a.deleted&&(r.remove(),u(this,Qi,null),this.popup=null))}resetEdited(){var t;n(this,Cr)&&(m(this,fg,Lw).call(this,n(this,Cr).rect),(t=n(this,Qi))==null||t.popup.resetEdited(),u(this,Cr,null))}_createContainer(t){const{data:e,parent:{page:s,viewport:a}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),!(this instanceof Eo)&&!(this instanceof Jb)&&(r.tabIndex=0);const{style:o}=r;if(o.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof Nw){const{rotation:b}=e;return!e.hasOwnCanvas&&b!==0&&this.setRotation(b,r),r}const{width:l,height:h}=this;if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;const b=e.borderStyle.horizontalCornerRadius,y=e.borderStyle.verticalCornerRadius;if(b>0||y>0){const _=`calc(${b}px * var(--total-scale-factor)) / calc(${y}px * var(--total-scale-factor))`;o.borderRadius=_}else if(this instanceof D1){const _=`calc(${l}px * var(--total-scale-factor)) / calc(${h}px * var(--total-scale-factor))`;o.borderRadius=_}switch(e.borderStyle.style){case qo.SOLID:o.borderStyle="solid";break;case qo.DASHED:o.borderStyle="dashed";break;case qo.BEVELED:Y("Unimplemented border style: beveled");break;case qo.INSET:Y("Unimplemented border style: inset");break;case qo.UNDERLINE:o.borderBottomStyle="solid";break}const A=e.borderColor||null;A?(u(this,od,!0),o.borderColor=R.makeHexColor(...A)):o.borderWidth=0}const c=R.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]),{pageWidth:d,pageHeight:p,pageX:g,pageY:v}=a.rawDims;o.left=`${100*(c[0]-g)/d}%`,o.top=`${100*(c[1]-v)/p}%`;const{rotation:w}=e;return e.hasOwnCanvas||w===0?(o.width=`${100*l/d}%`,o.height=`${100*h/p}%`):this.setRotation(w,r),r}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:a}=this.parent.viewport.rawDims;let{width:r,height:o}=this;t%180!==0&&([r,o]=[o,r]),e.style.width=`${100*r/s}%`,e.style.height=`${100*o/a}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,s,a)=>{const r=a.detail[e],o=r[0],l=r.slice(1);a.target.style[s]=dy[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[s]:dy[`${o}_rgb`](l)})};return G(this,"_commonActions",{display:e=>{const{display:s}=e.detail,a=s%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:s===1||s===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:s}=e.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},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 s=e.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const a of Object.keys(e.detail)){const r=t[a]||s[a];r==null||r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[a,r]of Object.entries(e)){const o=s[a];if(o){const l={detail:{[a]:r},target:t};o(l),delete e[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,s,a,r]=this.data.rect.map(b=>Math.fround(b));if(t.length===8){const[b,y,A,_]=t.subarray(2,6);if(a===b&&r===y&&e===A&&s===_)return}const{style:o}=this.container;let l;if(n(this,od)){const{borderColor:b,borderWidth:y}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${b}" stroke-width="${y}">`],this.container.classList.add("hasBorder")}const h=a-e,c=r-s,{svgFactory:d}=this,p=d.createElement("svg");p.classList.add("quadrilateralsContainer"),p.setAttribute("width",0),p.setAttribute("height",0),p.role="none";const g=d.createElement("defs");p.append(g);const v=d.createElement("clipPath"),w=`clippath_${this.data.id}`;v.setAttribute("id",w),v.setAttribute("clipPathUnits","objectBoundingBox"),g.append(v);for(let b=2,y=t.length;b<y;b+=8){const A=t[b],_=t[b+1],E=t[b+2],x=t[b+3],k=d.createElement("rect"),C=(E-e)/h,I=(r-_)/c,P=(A-E)/h,M=(_-x)/c;k.setAttribute("x",C),k.setAttribute("y",I),k.setAttribute("width",P),k.setAttribute("height",M),v.append(k),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${I}" width="${P}" height="${M}"/>`)}n(this,od)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(p),this.container.style.clipPath=`url(#${w})`}_createPopup(t=null){const{data:e}=this;let s,a;t?(s={str:t.text},a=t.date):(s=e.contentsObj,a=e.modificationDate),u(this,Qi,new Nw({data:{color:e.color,titleObj:e.titleObj,modificationDate:a,contentsObj:s,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,Qi)||this.popup||this.data.popupRef)}get extraPopupElement(){return n(this,Qi)}render(){at("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:r,id:o,exportValues:l}of a){if(r===-1||o===e)continue;const h=typeof l=="string"?l:null,c=document.querySelector(`[data-element-id="${o}"]`);if(c&&!Ao.has(c)){Y(`_getElementsByName - element not allowed: ${o}`);continue}s.push({id:o,exportValue:h,domElement:c})}return s}for(const a of document.getElementsByName(t)){const{exportValue:r}=a,o=a.getAttribute("data-element-id");o!==e&&Ao.has(a)&&s.push({id:o,exportValue:r,domElement:a})}return s}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 s;(s=this.linkService.eventBus)==null||s.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};Cr=new WeakMap,od=new WeakMap,Qi=new WeakMap,fg=new WeakSet,Lw=function(i){const{container:{style:t},data:{rect:e,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:r,pageX:o,pageY:l}}}}=this;e==null||e.splice(0,4,...i),t.left=`${100*(i[0]-o)/a}%`,t.top=`${100*(r-i[3]+l)/r}%`,s===0?(t.width=`${100*(i[2]-i[0])/a}%`,t.height=`${100*(i[3]-i[1])/r}%`):this.setRotation(s)};let $t=vk;class wk extends $t{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}
45get 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 Ps,co,T1,I1;class Jb extends $t{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!(e!=null&&e.ignoreBorder),createQuadrilaterals:!0}),f(this,Ps),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,s=document.createElement("a");s.setAttribute("data-element-id",t.id);let a=!1;return t.url?(e.addLinkAttributes(s,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(s,t.action,t.overlaidText),a=!0):t.attachment?(m(this,Ps,T1).call(this,s,t.attachment,t.overlaidText,t.attachmentDest),a=!0):t.setOCGState?(m(this,Ps,I1).call(this,s,t.setOCGState,t.overlaidText),a=!0):t.dest?(this._bindLink(s,t.dest,t.overlaidText),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,t),a=!0),t.resetForm?(this._bindResetFormAction(s,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(s,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&(this.contentElement=s,this.container.append(s)),this.container}_bindLink(t,e,s=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||e==="")&&m(this,Ps,co).call(this),s&&(t.title=s)}_bindNamedAction(t,e,s=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),s&&(t.title=s),m(this,Ps,co).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(e.actions)){const r=s.get(a);r&&(t[r]=()=>{var o;return(o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:a}}),!1})}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),m(this,Ps,co).call(this)}_bindResetFormAction(t,e){const s=t.onclick;if(s||(t.href=this.linkService.getAnchorUrl("")),m(this,Ps,co).call(this),!this._fieldObjects){Y('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(t.onclick=()=>!1);return}t.onclick=()=>{var a;s==null||s();const{fields:r,refs:o,include:l}=e,h=[];if(r.length!==0||o.length!==0){const p=new Set(o);for(const g of r){const v=this._fieldObjects[g]||[];for(const{id:w}of v)p.add(w)}for(const g of Object.values(this._fieldObjects))for(const v of g)p.has(v.id)===l&&h.push(v)}else for(const p of Object.values(this._fieldObjects))h.push(...p);const c=this.annotationStorage,d=[];for(const p of h){const{id:g}=p;switch(d.push(g),p.type){case"text":{const w=p.defaultValue||"";c.setValue(g,{value:w});break}case"checkbox":case"radiobutton":{const w=p.defaultValue===p.exportValues;c.setValue(g,{value:w});break}case"combobox":case"listbox":{const w=p.defaultValue||"";c.setValue(g,{value:w});break}default:continue}const v=document.querySelector(`[data-element-id="${g}"]`);if(v){if(!Ao.has(v)){Y(`_bindResetFormAction - element not allowed: ${g}`);continue}}else continue;v.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}Ps=new WeakSet,co=function(){this.container.setAttribute("data-internal-link","")},T1=function(i,t,e="",s=null){i.href=this.linkService.getAnchorUrl(""),t.description?i.title=t.description:e&&(i.title=e),i.onclick=()=>{var a;return(a=this.downloadManager)==null||a.openOrDownloadData(t.content,t.filename,s),!1},m(this,Ps,co).call(this)},I1=function(i,t,e=""){i.href=this.linkService.getAnchorUrl(""),i.onclick=()=>(this.linkService.executeSetOCGState(t),!1),e&&(i.title=e),m(this,Ps,co).call(this)};class bk extends $t{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 Eo extends $t{render(){return this.container}showElementAndHideCanvas(t){var e;this.data.hasOwnCanvas&&(((e=t.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Jt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,s,a,r){s.includes("mouse")?t.addEventListener(s,o=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:r(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):t.addEventListener(s,o=>{var l;if(s==="blur"){if(!e.focused||!o.relatedTarget)return;e.focused=!1}else if(s==="focus"){if(e.focused)return;e.focused=!0}r&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:r(o)}}))})}_setEventListeners(t,e,s,a){var r,o,l;for(const[h,c]of s)(c==="Action"||(r=this.data.actions)!=null&&r[c])&&((c==="Focus"||c==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,h,c,a),c==="Focus"&&!((o=this.data.actions)!=null&&o.Blur)?this._setEventListener(t,e,"blur","Blur",null):c==="Blur"&&!((l=this.data.actions)!=null&&l.Focus)&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":R.makeHexColor(...e)}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||fk,r=t.style;let o;const l=2,h=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-l),d=Math.round(c/(jm*a))||1,p=c/d;o=Math.min(a,h(p/jm))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(a,h(c/jm))}r.fontSize=`calc(${o}px * var(--total-scale-factor))`,r.color=R.makeHexColor(...s),this.data.textAlignment!==null&&(r.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class yk extends Eo{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,s,a){const r=this.annotationStorage;
45for(const o of this._getElementsByName(t.name,t.id))o.domElement&&(o.domElement[e]=s),r.setValue(o.id,{[a]:s})}render(){var t,e;const s=this.annotationStorage,a=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const o=s.getValue(a,{value:this.data.fieldValue});let l=o.value||"";const h=s.getValue(a,{charLimit:this.data.maxLen}).charLimit;h&&l.length>h&&(l=l.slice(0,h));let c=o.formattedValue||((t=this.data.textContent)==null?void 0:t.join(` 46`))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=c??l,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",c??l),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),Ao.add(r),this.contentElement=r,r.setAttribute("data-element-id",a),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const{datetimeFormat:p,datetimeType:g,timeStep:v}=this.data,w=!!g&&this.enableScripting;p&&(r.title=p),this._setRequired(r,this.data.required),h&&(r.maxLength=h),r.addEventListener("input",y=>{s.setValue(a,{value:y.target.value}),this.setPropertyOnSiblings(r,"value",y.target.value,"value"),d.formattedValue=null}),r.addEventListener("resetform",y=>{const A=this.data.defaultFieldValue??"";r.value=d.userValue=A,d.formattedValue=null});let b=y=>{const{formattedValue:A}=d;A!=null&&(y.target.value=A),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",A=>{var _;if(d.focused)return;const{target:E}=A;if(w&&(E.type=g,v&&(E.step=v)),d.userValue){const x=d.userValue;if(w)if(g==="time"){const k=new Date(x),C=[k.getHours(),k.getMinutes(),k.getSeconds()];E.value=C.map(I=>I.toString().padStart(2,"0")).join(":")}else E.value=new Date(x-mk).toISOString().split(g==="date"?"T":".",1)[0];else E.value=x}d.lastCommittedValue=E.value,d.commitKey=1,(_=this.data.actions)!=null&&_.Focus||(d.focused=!0)}),r.addEventListener("updatefromsandbox",A=>{this.showElementAndHideCanvas(A.target);const _={value(E){d.userValue=E.detail.value??"",w||s.setValue(a,{value:d.userValue.toString()}),E.target.value=d.userValue},formattedValue(E){const{formattedValue:x}=E.detail;d.formattedValue=x,x!=null&&E.target!==document.activeElement&&(E.target.value=x);const k={formattedValue:x};w&&(k.value=x),s.setValue(a,k)},selRange(E){E.target.setSelectionRange(...E.detail.selRange)},charLimit:E=>{var x;const{charLimit:k}=E.detail,{target:C}=E;if(k===0){C.removeAttribute("maxLength");return}C.setAttribute("maxLength",k);let I=d.userValue;!I||I.length<=k||(I=I.slice(0,k),C.value=d.userValue=I,s.setValue(a,{value:I}),(x=this.linkService.eventBus)==null||x.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:I,willCommit:!0,commitKey:1,selStart:C.selectionStart,selEnd:C.selectionEnd}}))}};this._dispatchEventFromSandbox(_,A)}),r.addEventListener("keydown",A=>{var _;d.commitKey=1;let E=-1;if(A.key==="Escape"?E=0:A.key==="Enter"&&!this.data.multiLine?E=2:A.key==="Tab"&&(d.commitKey=3),E===-1)return;const{value:x}=A.target;d.lastCommittedValue!==x&&(d.lastCommittedValue=x,d.userValue=x,(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:x,willCommit:!0,commitKey:E,selStart:A.target.selectionStart,selEnd:A.target.selectionEnd}}))});const y=b;b=null,r.addEventListener("blur",A=>{var _,E;if(!d.focused||!A.relatedTarget)return;(_=this.data.actions)!=null&&_.Blur||(d.focused=!1);const{target:x}=A;let{value:k}=x;if(w){if(k&&g==="time"){const C=k.split(":").map(I=>parseInt(I,10));k=new Date(2e3,0,1,C[0],C[1],C[2]||0).valueOf(),x.step=""}else k.includes("T")||(k=`${k}T00:00`),k=new Date(k).valueOf();x.type="text"}d.userValue=k,d.lastCommittedValue!==k&&((E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:k,willCommit:!0,
46commitKey:d.commitKey,selStart:A.target.selectionStart,selEnd:A.target.selectionEnd}})),y(A)}),(e=this.data.actions)!=null&&e.Keystroke&&r.addEventListener("beforeinput",A=>{var _;d.lastCommittedValue=null;const{data:E,target:x}=A,{value:k,selectionStart:C,selectionEnd:I}=x;let P=C,M=I;switch(A.inputType){case"deleteWordBackward":{const D=k.substring(0,C).match(/\w*[^\w]*$/);D&&(P-=D[0].length);break}case"deleteWordForward":{const D=k.substring(C).match(/^[^\w]*\w*/);D&&(M+=D[0].length);break}case"deleteContentBackward":C===I&&(P-=1);break;case"deleteContentForward":C===I&&(M+=1);break}A.preventDefault(),(_=this.linkService.eventBus)==null||_.dispatch("dispatcheventinsandbox",{source:this,detail:{id:a,name:"Keystroke",value:k,change:E||"",willCommit:!1,selStart:P,selEnd:M}})}),this._setEventListeners(r,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],A=>A.target.value)}if(b&&r.addEventListener("blur",b),this.data.comb){const y=(this.data.rect[2]-this.data.rect[0])/h;r.classList.add("comb"),r.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Ak extends Eo{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class _k extends Eo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let a=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;typeof a=="string"&&(a=a!=="Off",t.setValue(s,{value:a})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return Ao.add(r),r.setAttribute("data-element-id",s),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,a&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=0,r.addEventListener("change",o=>{const{name:l,checked:h}=o.target;for(const c of this._getElementsByName(l,s)){const d=h&&c.exportValue===e.exportValue;c.domElement&&(c.domElement.checked=d),t.setValue(c.id,{value:d})}t.setValue(s,{value:h})}),r.addEventListener("resetform",o=>{const l=e.defaultFieldValue||"Off";o.target.checked=l===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",o=>{const l={value(h){h.target.checked=h.detail.value!=="Off",t.setValue(s,{value:h.target.checked})}};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)),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class D1 extends Eo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,s=e.id;let a=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;if(typeof a=="string"&&(a=a!==e.buttonValue,t.setValue(s,{value:a})),a)for(const o of this._getElementsByName(e.fieldName,s))t.setValue(o.id,{value:!1});const r=document.createElement("input");if(Ao.add(r),r.setAttribute("data-element-id",s),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,a&&r.setAttribute("checked",!0),r.tabIndex=0,r.addEventListener("change",o=>{const{name:l,checked:h}=o.target;for(const c of this._getElementsByName(l,s))t.setValue(c.id,{value:!1});t.setValue(s,{value:h})}),r.addEventListener("resetform",o=>{const l=e.defaultFieldValue;o.target.checked=l!=null&&l===e.buttonValue}),this.enableScripting&&this.hasJSActions){const o=e.buttonValue;r.addEventListener("updatefromsandbox",l=>{const h={value:c=>{const d=o===c.detail.value;for(const p of this._getElementsByName(c.target.name)){const g=d&&p.id===s;p.domElement&&(p.domElement.checked=g),t.setValue(p.id,{value:g})}}};this._dispatchEventFromSandbox(h,l)}),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}
46return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Ek extends Jb{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",s=>{this._dispatchEventFromSandbox({},s)})),t}}class xk extends Eo{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),a=document.createElement("select");Ao.add(a),a.setAttribute("data-element-id",e),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=0;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(a.size=this.data.options.length,this.data.multiSelect&&(a.multiple=!0)),a.addEventListener("resetform",p=>{const g=this.data.defaultFieldValue;for(const v of a.options)v.selected=v.value===g});const o=(p,g)=>{const v=g.replaceAll(" ","Â ");p.textContent=v,v!==g&&p.setAttribute("display-value",g)};for(const p of this.data.options){const g=document.createElement("option");o(g,p.displayValue),g.value=p.exportValue,s.value.includes(p.exportValue)&&(g.setAttribute("selected",!0),r=!1),a.append(g)}let l=null;if(r){const p=document.createElement("option");p.value=" ",p.setAttribute("hidden",!0),p.setAttribute("selected",!0),a.prepend(p),l=()=>{p.remove(),a.removeEventListener("input",l),l=null},a.addEventListener("input",l)}const h=p=>{const g=p?"value":"textContent",{options:v,multiple:w}=a;return w?Array.prototype.filter.call(v,b=>b.selected).map(b=>b[g]):v.selectedIndex===-1?null:v[v.selectedIndex][g]};let c=h(!1);const d=p=>{const g=p.target.options;return Array.prototype.map.call(g,v=>({displayValue:v.getAttribute("display-value")||v.textContent,exportValue:v.value}))};return this.enableScripting&&this.hasJSActions?(a.addEventListener("updatefromsandbox",p=>{const g={value(v){l==null||l();const w=v.detail.value,b=new Set(Array.isArray(w)?w:[w]);for(const y of a.options)y.selected=b.has(y.value);t.setValue(e,{value:h(!0)}),c=h(!1)},multipleSelection(v){a.multiple=!0},remove(v){const w=a.options,b=v.detail.remove;w[b].selected=!1,a.remove(b),w.length>0&&Array.prototype.findIndex.call(w,y=>y.selected)===-1&&(w[0].selected=!0),t.setValue(e,{value:h(!0),items:d(v)}),c=h(!1)},clear(v){for(;a.length!==0;)a.remove(0);t.setValue(e,{value:null,items:[]}),c=h(!1)},insert(v){const{index:w,displayValue:b,exportValue:y}=v.detail.insert,A=a.children[w],_=document.createElement("option");o(_,b),_.value=y,A?A.before(_):a.append(_),t.setValue(e,{value:h(!0),items:d(v)}),c=h(!1)},items(v){const{items:w}=v.detail;for(;a.length!==0;)a.remove(0);for(const b of w){const{displayValue:y,exportValue:A}=b,_=document.createElement("option");o(_,y),_.value=A,a.append(_)}a.options.length>0&&(a.options[0].selected=!0),t.setValue(e,{value:h(!0),items:d(v)}),c=h(!1)},indices(v){const w=new Set(v.detail.indices);for(const b of v.target.options)b.selected=w.has(b.index);t.setValue(e,{value:h(!0)}),c=h(!1)},editable(v){v.target.disabled=!v.detail.editable}};this._dispatchEventFromSandbox(g,p)}),a.addEventListener("input",p=>{var g;const v=h(!0),w=h(!1);t.setValue(e,{value:v}),p.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:c,change:w,changeEx:v,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(a,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],p=>p.target.value)):a.addEventListener("input",function(p){t.setValue(e,{value:h(!0)})}),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}var mg,Rw;class Nw extends $t{constructor(t){const{data:e,elements:s,parent:a}=t,r=!!a._commentManager;if(super(t,{isRenderable:!r&&$t._hasPopupData(e)}),f(this,mg),this.elements=s,r&&$t._hasPopupData(e)){const o=this.popup=m(this,mg,Rw).call(this);for(const l of s)l.popup=o}else this.popup=null}render(){const{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";
46const e=this.popup=m(this,mg,Rw).call(this),s=[];for(const a of this.elements)a.popup=e,a.container.ariaHasPopup="dialog",s.push(a.data.id),a.addHighlightArea();return this.container.setAttribute("aria-controls",s.map(a=>`${Gl}${a}`).join(",")),this.container}}mg=new WeakSet,Rw=function(){return new kk({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 Ii,uo,Fw,Ow,ld,hd,Bt,ln,Pr,eh,Kd,qd,hn,Ci,Ia,wa,Wt,ba,Tr,Qf,ya,cd,Ir,Dr,we,Qn,dt,vg,Ww,Bw,jw,wg,hv,uy,L1,R1,py,Jf,Zf,$w;class kk{constructor({container:t,color:e,elements:s,titleObj:a,modificationDate:r,contentsObj:o,richText:l,parent:h,rect:c,parentRect:d,open:p,commentManager:g=null}){f(this,dt),f(this,Ii,null),f(this,uo,m(this,dt,R1).bind(this)),f(this,Fw,m(this,dt,$w).bind(this)),f(this,Ow,m(this,dt,Zf).bind(this)),f(this,ld,m(this,dt,Jf).bind(this)),f(this,hd,null),f(this,Bt,null),f(this,ln,null),f(this,Pr,null),f(this,eh,null),f(this,Kd,null),f(this,qd,null),f(this,hn,!1),f(this,Ci,null),f(this,Ia,null),f(this,wa,null),f(this,Wt,null),f(this,ba,null),f(this,Tr,null),f(this,Qf,null),f(this,ya,null),f(this,cd,null),f(this,Ir,null),f(this,Dr,!1),f(this,we,null),f(this,Qn,null),u(this,Bt,t),u(this,cd,a),u(this,ln,o),u(this,ya,l),u(this,Kd,h),u(this,hd,e),u(this,Qf,c),u(this,qd,d),u(this,eh,s),u(this,Ii,g),u(this,we,s[0]),u(this,Pr,Xv.toDateObject(r)),this.trigger=s.flatMap(v=>v.getElementsToTriggerPopup()),g||(m(this,dt,vg).call(this),n(this,Bt).hidden=!0,p&&m(this,dt,Jf).call(this))}renderCommentButton(){if(n(this,Wt)){n(this,Wt).parentNode||n(this,we).container.after(n(this,Wt));return}if(n(this,ba)||m(this,dt,Ww).call(this),!n(this,ba))return;const{signal:t}=u(this,Ia,new AbortController),e=n(this,we).hasOwnCommentButton,s=()=>{n(this,Ii).toggleCommentPopup(this,!0,void 0,!e)},a=()=>{n(this,Ii).toggleCommentPopup(this,!1,!0,!e)},r=()=>{n(this,Ii).toggleCommentPopup(this,!1,!1)};if(e){u(this,Wt,n(this,we).container);for(const o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",n(this,uo),{signal:t}),o.addEventListener("click",s,{signal:t}),o.addEventListener("pointerenter",a,{signal:t}),o.addEventListener("pointerleave",r,{signal:t}),o.classList.add("popupTriggerArea")}else{const o=u(this,Wt,document.createElement("button"));o.className="annotationCommentButton";const l=n(this,we).container;o.style.zIndex=parseInt(l.style.zIndex,10)+1,o.tabIndex=0,o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.setAttribute("data-l10n-id","pdfjs-show-comment-button"),m(this,dt,jw).call(this),m(this,dt,Bw).call(this),o.addEventListener("keydown",n(this,uo),{signal:t}),o.addEventListener("click",s,{signal:t}),o.addEventListener("pointerenter",a,{signal:t}),o.addEventListener("pointerleave",r,{signal:t}),l.after(o)}}get commentButtonColor(){const{color:t,opacity:e}
46=n(this,we).commentData;return t?n(this,Kd)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{var t;(t=n(this,Wt))==null||t.focus()},0)}getData(){const{richText:t,color:e,opacity:s,creationDate:a,modificationDate:r}=n(this,we).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:s,creationDate:a,modificationDate:r}}get elementBeforePopup(){return n(this,Wt)}get comment(){return n(this,Qn)||u(this,Qn,n(this,we).commentText),n(this,Qn)}set comment(t){t!==this.comment&&(n(this,we).commentText=u(this,Qn,t))}focus(){var t;(t=n(this,we).container)==null||t.focus()}get parentBoundingClientRect(){return n(this,we).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){n(this,Wt)&&(n(this,Wt).classList.toggle("selected",t),n(this,Wt).ariaExpanded=e)}setSelectedCommentButton(t){n(this,Wt).classList.toggle("selected",t)}get commentPopupPosition(){if(n(this,Tr))return n(this,Tr);const{x:t,y:e,height:s}=n(this,Wt).getBoundingClientRect(),{x:a,y:r,width:o,height:l}=n(this,we).layer.getBoundingClientRect();return[(t-a)/o,(e+s-r)/l]}set commentPopupPosition(t){u(this,Tr,t)}hasDefaultPopupPosition(){return n(this,Tr)===null}get commentButtonPosition(){return n(this,ba)}get commentButtonWidth(){return n(this,Wt).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){const[e,s]=n(this,Tr)||this.commentButtonPosition.map(c=>c/100),a=this.parentBoundingClientRect,{x:r,y:o,width:l,height:h}=a;n(this,Ii).showDialog(null,this,r+e*l,o+s*h,{...t,parentDimensions:a})}render(){var t,e;if(n(this,Ci))return;const s=u(this,Ci,document.createElement("div"));if(s.className="popup",n(this,hd)){const r=s.style.outlineColor=R.makeHexColor(...n(this,hd));s.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`}const a=document.createElement("span");if(a.className="header",(t=n(this,cd))!=null&&t.str){const r=document.createElement("span");r.className="title",a.append(r),{dir:r.dir,str:r.textContent}=n(this,cd)}if(s.append(a),n(this,Pr)){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,Pr).valueOf()})),r.dateTime=n(this,Pr).toISOString(),a.append(r)}AA({html:n(this,dt,wg)||n(this,ln).str,dir:(e=n(this,ln))==null?void 0:e.dir,className:"popupContent"},s),n(this,Bt).append(s)}updateEdited({rect:t,popup:e,deleted:s}){var a;if(n(this,Ii)){s?(this.remove(),u(this,Qn,null)):e&&(e.deleted?this.remove():(m(this,dt,jw).call(this),u(this,Qn,e.text))),t&&(u(this,ba,null),m(this,dt,Ww).call(this),m(this,dt,Bw).call(this));return}if(s||e!=null&&e.deleted){this.remove();return}m(this,dt,vg).call(this),n(this,Ir)||u(this,Ir,{contentsObj:n(this,ln),richText:n(this,ya)}),t&&u(this,wa,null),e&&e.text&&(u(this,ya,m(this,dt,L1).call(this,e.text)),u(this,Pr,Xv.toDateObject(e.date)),u(this,ln,null)),(a=n(this,Ci))==null||a.remove(),u(this,Ci,null)}resetEdited(){var t;n(this,Ir)&&({contentsObj:jt(this,ln)._,richText:jt(this,ya)._}=n(this,Ir),u(this,Ir,null),(t=n(this,Ci))==null||t.remove(),u(this,Ci,null),u(this,wa,null))}remove(){var t,e,s;if((t=n(this,Ia))==null||t.abort(),u(this,Ia,null),(e=n(this,Ci))==null||e.remove(),u(this,Ci,null),u(this,Dr,!1),u(this,hn,!1),(s=n(this,Wt))==null||s.remove(),u(this,Wt,null),this.trigger)for(const a of this.trigger)a.classList.remove("popupTriggerArea")}forceHide(){u(this,Dr,this.isVisible),n(this,Dr)&&(n(this,Bt).hidden=!0)}maybeShow(){n(this,Ii)||(m(this,dt,vg).call(this),n(this,Dr)&&(n(this,Ci)||m(this,dt,Zf).call(this),u(this,Dr,!1),n(this,Bt).hidden=!1))}get isVisible(){return n(this,Ii)?!1:n(this,Bt).hidden===!1}}Ii=new WeakMap,uo=new WeakMap,Fw=new WeakMap,Ow=new WeakMap,ld=new WeakMap,hd=new WeakMap,Bt=new WeakMap,ln=new WeakMap,Pr=new WeakMap,eh=new WeakMap,Kd=new WeakMap,qd=new WeakMap,hn=new WeakMap,Ci=new WeakMap,Ia=new WeakMap,wa=new WeakMap,Wt=new WeakMap,ba=new WeakMap,Tr=new WeakMap,Qf=new WeakMap,ya=new WeakMap,cd=new WeakMap,Ir=new WeakMap,Dr=new WeakMap,we=new WeakMap,Qn=new WeakMap,dt=new WeakSet,vg=function(){var i;if(n(this,Ia))return;u(this,Ia,new AbortController);const{signal:t}=n(this,Ia);for(const e of this.trigger)e.addEventListener("click",n(this,ld),{signal:t}),e.addEventListener("pointerenter",n(this,Ow),{signal:t}),e.addEventListener("pointerleave",n(this,Fw),{signal:t}),e.classList.add("popupTriggerArea");for(const e of n(this,eh))(i=e.container)==null||i.addEventListener("keydown",n(this,uo),{signal:t})},Ww=function(){const i=n(this,eh).find(t=>t.hasCommentButton);i&&u(this,ba,i._normalizePoint(i.commentButtonPosition))},Bw=function(){if(n(this,we).extraPopupElement&&!n(this,we).editor)return;n(this,Wt)||this.renderCommentButton();const[i,t]=n(this,ba),{style:e}=n(this,Wt);e.left=`calc(${i}%)`,e.top=`calc(${t}% - var(--comment-button-dim))`},jw=function(){n(this,we).extraPopupElement||(n(this,Wt)||this.renderCommentButton(),n(this,Wt).style.backgroundColor=this.commentButtonColor||"")},wg=function(){const i=n(this,ya),t=n(this,ln);return i!=null&&i.str&&(!(t!=null&&t.str)||t.str===i.str)&&n(this,ya).html||null},hv=function(){var i,t,e;return((e=(t=(i=n(this,dt,wg))==null?void 0:i.attributes)==null?void 0:t.style)==null?void 0:e.fontSize)||0},uy=function(){var i,t,e;return((e=(t=(i=n(this,dt,wg))==null?void 0:i.attributes)==null?void 0:t.style)==null?void 0:e.color)||null},L1=function(i){const t=[],e={str:i,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:t}]}},s={style:{color:n(this,dt,uy),fontSize:n(this,dt,hv)?`calc(${n(this,dt,hv)}px * var(--total-scale-factor))`:""}};for(const a of i.split(` 47`))t.push({name:"span",value:a,attributes:s});return e},R1=function(i){i.altKey||i.shiftKey||i.ctrlKey||i.metaKey||(i.key==="Enter"||i.key==="Escape"&&n(this,hn))&&m(this,dt,Jf).call(this)},py=function(){if(n(this,wa)!==null)return;const{page:{view:i},viewport:{rawDims:{pageWidth:t,pageHeight:e,pageX:s,pageY:a}}}=n(this,Kd);let r=!!n(this,qd),o=r?n(this,qd):n(this,Qf);for(const g of n(this,eh))if(!o||R.intersect(g.data.rect,o)!==null){o=g.data.rect,r=!0;break}const l=R.normalizeRect([o[0],i[3]-o[1]+i[1],o[2],i[3]-o[3]+i[1]]),h=r?o[2]-o[0]+5:0,c=l[0]+h,d=l[1];u(this,wa,[100*(c-s)/t,100*(d-a)/e]);const{style:p}=n(this,Bt);
47p.left=`${n(this,wa)[0]}%`,p.top=`${n(this,wa)[1]}%`},Jf=function(){if(n(this,Ii)){n(this,Ii).toggleCommentPopup(this,!1);return}u(this,hn,!n(this,hn)),n(this,hn)?(m(this,dt,Zf).call(this),n(this,Bt).addEventListener("click",n(this,ld)),n(this,Bt).addEventListener("keydown",n(this,uo))):(m(this,dt,$w).call(this),n(this,Bt).removeEventListener("click",n(this,ld)),n(this,Bt).removeEventListener("keydown",n(this,uo)))},Zf=function(){n(this,Ci)||this.render(),this.isVisible?n(this,hn)&&n(this,Bt).classList.add("focused"):(m(this,dt,py).call(this),n(this,Bt).hidden=!1,n(this,Bt).style.zIndex=parseInt(n(this,Bt).style.zIndex,10)+1e3)},$w=function(){n(this,Bt).classList.remove("focused"),!(n(this,hn)||!this.isVisible)&&(n(this,Bt).hidden=!0,n(this,Bt).style.zIndex=parseInt(n(this,Bt).style.zIndex,10)-1e3)};class N1 extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=V.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 s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}var bg;class Sk extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),f(this,bg,null)}render(){this.container.classList.add("lineAnnotation");const{data:t,width:e,height:s}=this,a=this.svgFactory.create(e,s,!0),r=u(this,bg,this.svgFactory.createElement("svg:line"));return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),a.append(r),this.container.append(a),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,bg)}addHighlightArea(){this.container.classList.add("highlightArea")}}bg=new WeakMap;var yg;class Mk extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),f(this,yg,null)}render(){this.container.classList.add("squareAnnotation");const{data:t,width:e,height:s}=this,a=this.svgFactory.create(e,s,!0),r=t.borderStyle.width,o=u(this,yg,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",r/2),o.setAttribute("y",r/2),o.setAttribute("width",e-r),o.setAttribute("height",s-r),o.setAttribute("stroke-width",r||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),a.append(o),this.container.append(a),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,yg)}addHighlightArea(){this.container.classList.add("highlightArea")}}yg=new WeakMap;var Ag;class Ck extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),f(this,Ag,null)}render(){this.container.classList.add("circleAnnotation");const{data:t,width:e,height:s}=this,a=this.svgFactory.create(e,s,!0),r=t.borderStyle.width,o=u(this,Ag,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",e/2),o.setAttribute("cy",s/2),o.setAttribute("rx",e/2-r/2),o.setAttribute("ry",s/2-r/2),o.setAttribute("stroke-width",r||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),a.append(o),this.container.append(a),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,Ag)}addHighlightArea(){this.container.classList.add("highlightArea")}}Ag=new WeakMap;var _g;class F1 extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),f(this,_g,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:s,popupRef:a},width:r,height:o}=this;if(!e)return this.container;const l=this.svgFactory.create(r,o,!0);let h=[];for(let d=0,p=e.length;d<p;d+=2){const g=e[d]-t[0],v=t[3]-e[d+1];h.push(`${g},${v}`)}h=h.join(" ");const c=u(this,_g,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),!a&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return n(this,_g)}addHighlightArea(){this.container.classList.add("highlightArea")}}_g=new WeakMap;class Pk extends F1{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Tk extends $t{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}}
47var Eg,kl,xg,Uw;class Zb extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),f(this,xg),f(this,Eg,null),f(this,kl,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?V.HIGHLIGHT:V.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,rotation:e,inkLists:s,borderStyle:a,popupRef:r}}=this,{transform:o,width:l,height:h}=m(this,xg,Uw).call(this,e,t),c=this.svgFactory.create(l,h,!0),d=u(this,Eg,this.svgFactory.createElement("svg:g"));c.append(d),d.setAttribute("stroke-width",a.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",o);for(let p=0,g=s.length;p<g;p++){const v=this.svgFactory.createElement(this.svgElementName);n(this,kl).push(v),v.setAttribute("points",s[p].join(",")),d.append(v)}return!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(c),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);const{thickness:e,points:s,rect:a}=t,r=n(this,Eg);if(e>=0&&r.setAttribute("stroke-width",e||1),s)for(let o=0,l=n(this,kl).length;o<l;o++)n(this,kl)[o].setAttribute("points",s[o].join(","));if(a){const{transform:o,width:l,height:h}=m(this,xg,Uw).call(this,this.data.rotation,a);r.parentElement.setAttribute("viewBox",`0 0 ${l} ${h}`),r.setAttribute("transform",o)}}getElementsToTriggerPopup(){return n(this,kl)}addHighlightArea(){this.container.classList.add("highlightArea")}}Eg=new WeakMap,kl=new WeakMap,xg=new WeakSet,Uw=function(i,t){switch(i){case 90:return{transform:`rotate(90) translate(${-t[0]},${t[1]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};case 180:return{transform:`rotate(180) translate(${-t[2]},${t[1]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]};case 270:return{transform:`rotate(270) translate(${-t[2]},${t[3]}) scale(1,-1)`,width:t[3]-t[1],height:t[2]-t[0]};default:return{transform:`translate(${-t[0]},${t[3]}) scale(1,-1)`,width:t[2]-t[0],height:t[3]-t[1]}}};class O1 extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=V.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 s=document.createElement("mark");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class Ik extends $t{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 s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class Dk extends $t{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 s=document.createElement("u");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class Lk extends $t{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 s=document.createElement("s");s.classList.add("overlaidText"),s.textContent=t,this.container.append(s)}return this.container}}class W1 extends $t{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=V.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}}
47var kg,Sg,Hw;class Rk extends $t{constructor(t){var e;super(t,{isRenderable:!0}),f(this,Sg),f(this,kg,null);const{file:s}=this.data;this.filename=s.filename,this.content=s.content,(e=this.linkService.eventBus)==null||e.dispatch("fileattachmentannotation",{source:this,...s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let s;e.hasAppearance||e.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(e.fillAlpha*100)}%);`)),s.addEventListener("dblclick",m(this,Sg,Hw).bind(this)),u(this,kg,s);const{isMac:a}=Jt.platform;return t.addEventListener("keydown",r=>{r.key==="Enter"&&(a?r.metaKey:r.ctrlKey)&&m(this,Sg,Hw).call(this)}),!e.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):s.classList.add("popupTriggerArea"),t.append(s),t}getElementsToTriggerPopup(){return n(this,kg)}addHighlightArea(){this.container.classList.add("highlightArea")}}kg=new WeakMap,Sg=new WeakSet,Hw=function(){var i;(i=this.downloadManager)==null||i.openOrDownloadData(this.content,this.filename)};var Ho,Vo,lc,ir,vp,zo,Ei,wp,sr,bp,cv,dv;let Nk=(dv=class{constructor({div:i,accessibilityManager:t,annotationCanvasMap:e,annotationEditorUIManager:s,page:a,viewport:r,structTreeLayer:o,commentManager:l,linkService:h,annotationStorage:c}){f(this,sr),f(this,Ho,null),f(this,Vo,null),f(this,lc,null),f(this,ir,new Map),f(this,vp,null),f(this,zo,null),f(this,Ei,[]),f(this,wp,!1),S(this,"zIndex",0),this.div=i,u(this,Ho,t),u(this,Vo,e),u(this,vp,o||null),u(this,zo,h||null),u(this,lc,c||new qb),this.page=a,this.viewport=r,this._annotationEditorUIManager=s,this._commentManager=l||null}hasEditableAnnotations(){return n(this,ir).size>0}async render(i){var t;const{annotations:e}=i,s=this.div;bo(s,this.viewport);const a=new Map,r=[],o={data:null,layer:s,linkService:n(this,zo),downloadManager:i.downloadManager,imageResourcesPath:i.imageResourcesPath||"",renderForms:i.renderForms!==!1,svgFactory:new qf,annotationStorage:n(this,lc),enableComment:i.enableComment===!0,enableScripting:i.enableScripting===!0,hasJSActions:i.hasJSActions,fieldObjects:i.fieldObjects,parent:this,elements:null};for(const l of e){if(l.noHTML)continue;const h=l.annotationType===Gt.POPUP;if(h){const p=a.get(l.id);if(!p)continue;if(!this._commentManager){r.push(l);continue}o.elements=p}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;o.data=l;const c=lv.create(o);if(!c.isRenderable)continue;h||(n(this,Ei).push(c),l.popupRef&&a.getOrInsertComputed(l.popupRef,Hb).push(c));const d=c.render();l.hidden&&(d.style.visibility="hidden"),c._isEditable&&(n(this,ir).set(c.data.id,c),(t=this._annotationEditorUIManager)==null||t.renderAnnotationElement(c))}await m(this,sr,bp).call(this);for(const l of r){const h=o.elements=a.get(l.id);o.data=l;const c=lv.create(o);if(!c.isRenderable)continue;const d=c.render();c.contentElement.id=`${Gl}${l.id}`,l.hidden&&(d.style.visibility="hidden"),h.at(-1).container.after(d)}m(this,sr,cv).call(this)}async addLinkAnnotations(i){const t={data:null,layer:this.div,linkService:n(this,zo),svgFactory:new qf,parent:this};for(const e of i){e.borderStyle||(e.borderStyle=dv._defaultBorderStyle),t.data=e;const s=lv.create(t);s.isRenderable&&(s.render(),s.contentElement.id=`${Gl}${e.id}`,n(this,Ei).push(s))}await m(this,sr,bp).call(this)}update({viewport:i}){const t=this.div;this.viewport=i,bo(t,{rotation:i.rotation}),m(this,sr,cv).call(this),t.hidden=!1}getEditableAnnotations(){return n(this,ir).values()}getEditableAnnotation(i){return n(this,ir).get(i)}addFakeAnnotation(i){const{div:t}=this,{id:e,rotation:s}=i,a=new wk({data:{id:e,rect:i.getPDFRect(),rotation:s},editor:i,layer:t,parent:this,enableComment:!!this._commentManager,linkService:n(this,zo),annotationStorage:n(this,lc)});return a.render(),a.contentElement.id=`${Gl}${e}`,a.createOrUpdatePopup(),n(this,Ei).push(a),a}removeAnnotation(i){var t;const e=n(this,Ei).findIndex(a=>a.data.id===i);if(e<0)return;const[s]=n(this,Ei).splice(e,1);(t=n(this,Ho))==null||t.removePointerInTextLayer(s.contentElement)}updateFakeAnnotations(i){if(i.length!==0){for(const t of i)t.updateFakeAnnotationElement(this);m(this,sr,bp).call(this)}}togglePointerEvents(i=!1){this.div.classList.toggle("disabled",!i)}static get _defaultBorderStyle(){return G(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:qo.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}},Ho=new WeakMap,Vo=new WeakMap,lc=new WeakMap,ir=new WeakMap,vp=new WeakMap,zo=new WeakMap,Ei=new WeakMap,wp=new WeakMap,sr=new WeakSet,bp=async function(){var i,t,e;if(n(this,Ei).length===0)return;this.div.replaceChildren();const s=[];if(!n(this,wp)){u(this,wp,!0);for(const{contentElement:r,data:{id:o}}of n(this,Ei)){const l=r.id=`${Gl}${o}`;
47s.push((i=n(this,vp))==null?void 0:i.getAriaAttributes(l).then(h=>{if(h)for(const[c,d]of h)r.setAttribute(c,d)}))}}n(this,Ei).sort(({data:{rect:[r,o,l,h]}},{data:{rect:[c,d,p,g]}})=>{if(r===l&&o===h)return 1;if(c===p&&d===g)return-1;const v=h,w=o,b=(o+h)/2,y=g,A=d,_=(d+g)/2;if(b>=y&&_<=w)return-1;if(_>=v&&b<=A)return 1;const E=(r+l)/2,x=(c+p)/2;return E-x});const a=document.createDocumentFragment();for(const r of n(this,Ei))a.append(r.container),this._commentManager?(e=((t=r.extraPopupElement)==null?void 0:t.popup)||r.popup)==null||e.renderCommentButton():r.extraPopupElement&&a.append(r.extraPopupElement.render());if(this.div.append(a),await Promise.all(s),n(this,Ho))for(const r of n(this,Ei))n(this,Ho).addPointerInTextLayer(r.contentElement,!1)},cv=function(){var i;if(!n(this,Vo))return;const t=this.div;for(const[e,s]of n(this,Vo)){const a=t.querySelector(`[data-annotation-id="${e}"]`);if(!a)continue;s.className="annotationContent";const{firstChild:r}=a;r?r.nodeName==="CANVAS"?r.replaceWith(s):r.classList.contains("annotationContent")?r.after(s):r.before(s):a.append(s);const o=n(this,ir).get(e);o&&(o._hasNoCanvas?((i=this._annotationEditorUIManager)==null||i.setMissingCanvas(e,a.id,s),o._hasNoCanvas=!1):o.canvas=s)}n(this,Vo).clear()},dv);const Mg=/\r\n?|\n/g;var Li,Cg,Sl,Ri,di,B1,j1,$1,tm,po,em,Pg,U1,Vw,H1;const Ks=class Se extends kt{constructor(t){super({...t,name:"freeTextEditor"}),f(this,di),f(this,Li,""),f(this,Cg,`${this.id}-editor`),f(this,Sl,null),f(this,Ri),S(this,"_colorPicker",null),this.color=t.color||Se._defaultColor||kt._defaultLineColor,u(this,Ri,t.fontSize||Se._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){const t=Se.prototype,e=r=>r.isEmpty(),s=_u.TRANSLATE_SMALL,a=_u.TRANSLATE_BIG;return G(this,"_keyboardManager",new Pu([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-a,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[a,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-a],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,a],checker:e}]]))}static initialize(t,e){kt.initialize(t,e);const s=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(s.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case K.FREETEXT_SIZE:Se._defaultFontSize=e;break;case K.FREETEXT_COLOR:Se._defaultColor=e;break}}updateParams(t,e){switch(t){case K.FREETEXT_SIZE:m(this,di,B1).call(this,e);break;case K.FREETEXT_COLOR:m(this,di,j1).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[K.FREETEXT_SIZE,Se._defaultFontSize],[K.FREETEXT_COLOR,Se._defaultColor||kt._defaultLineColor]]}get propertiesToUpdate(){return[[K.FREETEXT_SIZE,n(this,Ri)],[K.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new C1(this)),[["colorPicker",this._colorPicker]]}get colorType(){return K.FREETEXT_COLOR}onUpdatedColor(){var t;this.editorDiv.style.color=this.color,(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-Se._internalPadding*t,-(Se._internalPadding+n(this,Ri))*t]}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"),u(this,Sl,new AbortController);const t=this._uiManager.combinedSignal(n(this,Sl));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){var t;return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",n(this,Cg)),this._isDraggable=!0,(t=n(this,Sl))==null||t.abort(),u(this,Sl,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){var e;this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),(e=this._initialOptions)!=null&&e.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 t=n(this,Li),e=u(this,Li,m(this,di,$1).call(this).trimEnd());if(t===e)return;const s=a=>
47{if(u(this,Li,a),!a){this.remove();return}m(this,di,Pg).call(this),this._uiManager.rebuild(this),m(this,di,tm).call(this)};this.addCommands({cmd:()=>{s(e)},undo:()=>{s(t)},mustExec:!1}),m(this,di,tm).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Se._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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 t,e;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",n(this,Cg)),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,Ri)}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[a,r]=this.parentDimensions;if(this.annotationElementId){const{position:o}=this._initialData;let[l,h]=this.getInitialTranslation();[l,h]=this.pageTranslationToScreen(l,h);const[c,d]=this.pageDimensions,[p,g]=this.pageTranslation;let v,w;switch(this.rotation){case 0:v=t+(o[0]-p)/c,w=e+this.height-(o[1]-g)/d;break;case 90:v=t+(o[0]-p)/c,w=e-(o[1]-g)/d,[l,h]=[h,-l];break;case 180:v=t-this.width+(o[0]-p)/c,w=e-(o[1]-g)/d,[l,h]=[-l,-h];break;case 270:v=t+(o[0]-p-this.height*d)/c,w=e+(o[1]-g-this.width*c)/d,[l,h]=[-h,l];break}this.setAt(v*a,w*r,l,h)}else this._moveAfterPaste(t,e);m(this,di,Pg).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){var e,s,a;const r=t.clipboardData||window.clipboardData,{types:o}=r;if(o.length===1&&o[0]==="text/plain")return;t.preventDefault();const l=m(e=Se,po,Vw).call(e,r.getData("text")||"").replaceAll(Mg,` 48`);if(!l)return;const h=window.getSelection();if(!h.rangeCount)return;this.editorDiv.normalize(),h.deleteFromDocument();const c=h.getRangeAt(0);if(!l.includes(` 49`)){c.insertNode(document.createTextNode(l)),this.editorDiv.normalize(),h.collapseToStart();return}const{startContainer:d,startOffset:p}=c,g=[],v=[];if(d.nodeType===Node.TEXT_NODE){const y=d.parentElement;if(v.push(d.nodeValue.slice(p).replaceAll(Mg,"")),y!==this.editorDiv){let A=g;for(const _ of this.editorDiv.childNodes){if(_===y){A=v;continue}A.push(m(s=Se,po,em).call(s,_))}}g.push(d.nodeValue.slice(0,p).replaceAll(Mg,""))}else if(d===this.editorDiv){let y=g,A=0;for(const _ of this.editorDiv.childNodes)A++===p&&(y=v),y.push(m(a=Se,po,em).call(a,_))}u(this,Li,`${g.join(` 50`)}${l}${v.join(` 51`)}`),m(this,di,Pg).call(this);const w=new Range;let b=Math.sumPrecise(g.map(y=>y.length));for(const{firstChild:y}of this.editorDiv.childNodes)if(y.nodeType===Node.TEXT_NODE){const A=y.nodeValue.length;if(b<=A){w.setStart(y,b),w.setEnd(y,b);break}b-=A}h.removeAllRanges(),h.addRange(w)}get contentDiv(){return this.editorDiv}getPDFRect(){const t=Se._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,s){var a;let r=null;if(t instanceof N1){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:d,id:p,popupRef:g,richText:v,contentsObj:w,creationDate:b,modificationDate:y},textContent:A,textPosition:_,parent:{page:{pageNumber:E}}}=t;if(!A||A.length===0)return null;r=t={annotationType:V.FREETEXT,color:Array.from(h),fontSize:l,value:A.join(` 52`),position:_,pageIndex:E-1,rect:c.slice(0),rotation:d,annotationElementId:p,id:p,deleted:!1,popupRef:g,comment:(w==null?void 0:w.str)||null,richText:v,creationDate:b,modificationDate:y}}const o=await super.deserialize(t,e,s);
52return u(o,Ri,t.fontSize),o.color=R.makeHexColor(...t.color),u(o,Li,m(a=Se,po,Vw).call(a,t.value)),o._initialData=r,t.comment&&o.setCommentData(t),o}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=kt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),s=Object.assign(super.serialize(t),{color:e,fontSize:n(this,Ri),value:m(this,di,U1).call(this)});return this.addComment(s),t?(s.isCopy=!0,s):this.annotationElementId&&!m(this,di,H1).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(!e)return null;const{style:s}=e;s.fontSize=`calc(${n(this,Ri)}px * var(--total-scale-factor))`,s.color=this.color,e.replaceChildren();for(const a of n(this,Li).split(` 53`)){const r=document.createElement("div");r.append(a?document.createTextNode(a):document.createElement("br")),e.append(r)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:n(this,Li)}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}};Li=new WeakMap,Cg=new WeakMap,Sl=new WeakMap,Ri=new WeakMap,di=new WeakSet,B1=function(i){const t=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-n(this,Ri))*this.parentScale),u(this,Ri,s),m(this,di,tm).call(this)},e=n(this,Ri);this.addCommands({cmd:t.bind(this,i),undo:t.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},j1=function(i){const t=s=>{this.color=s,this.onUpdatedColor()},e=this.color;this.addCommands({cmd:t.bind(this,i),undo:t.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},$1=function(){var i;const t=[];this.editorDiv.normalize();let e=null;for(const s of this.editorDiv.childNodes)(e==null?void 0:e.nodeType)===Node.TEXT_NODE&&s.nodeName==="BR"||(t.push(m(i=Ks,po,em).call(i,s)),e=s);return t.join(` 54`)},tm=function(){const[i,t]=this.parentDimensions;let e;if(this.isAttachedToDOM)e=this.div.getBoundingClientRect();else{const{currentLayer:s,div:a}=this,r=a.style.display,o=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",s.div.append(this.div),e=a.getBoundingClientRect(),a.remove(),a.style.display=r,a.classList.toggle("hidden",o)}this.rotation%180===this.parentRotation%180?(this.width=e.width/i,this.height=e.height/t):(this.width=e.height/i,this.height=e.width/t),this.fixAndSetPosition()},po=new WeakSet,em=function(i){return(i.nodeType===Node.TEXT_NODE?i.nodeValue:i.innerText).replaceAll(Mg,"")},Pg=function(){if(this.editorDiv.replaceChildren(),!!n(this,Li))for(const i of n(this,Li).split(` 55`)){const t=document.createElement("div");t.append(i?document.createTextNode(i):document.createElement("br")),this.editorDiv.append(t)}},U1=function(){return n(this,Li).replaceAll("Â "," ")},Vw=function(i){return i.replaceAll(" ","Â ")},H1=function(i){const{value:t,fontSize:e,color:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||i.value!==t||i.fontSize!==e||i.color.some((r,o)=>r!==s[o])||i.pageIndex!==a},f(Ks,po),S(Ks,"_freeTextDefaultContent",""),S(Ks,"_internalPadding",0),S(Ks,"_defaultColor",null),S(Ks,"_defaultFontSize",10),S(Ks,"_type","freetext"),S(Ks,"_editorType",V.FREETEXT);let Fk=Ks;class O{toSVGPath(){at("Abstract method `toSVGPath` must be implemented.")}get box(){at("Abstract getter `box` must be implemented.")}serialize(t,e){at("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,a,r,o){o||(o=new Float32Array(t.length));for(let l=0,h=t.length;l<h;l+=2)o[l]=e+t[l]*a,o[l+1]=s+t[l+1]*r;return o}static _rescaleAndSwap(t,e,s,a,r,o){o||(o=new Float32Array(t.length));for(let l=0,h=t.length;l<h;l+=2)o[l]=e+t[l+1]*a,o[l+1]=s+t[l]*r;return o}static _translate(t,e,s,a){a||(a=new Float32Array(t.length));for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r],a[r+1]=s+t[r+1];return a}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,a,r){switch(r){case 90:return[1-e/s,t/a];case 180:return[1-t/s,1-e/a];case 270:return[e/s,1-t/a];default:return[t/s,e/a]}}static _normalizePagePoint(t,e,s){switch(s){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,s,a,r,o){return[(t+5*s)/6,(e+5*a)/6,(5*s+r)/6,(5*a+o)/6,(s+r)/2,(a+o)/2]}}S(O,"PRECISION",1e-4);var Fi,Ts,Qd,Jd,qs,J,wh,bh,Tg,Ig,Zd,dd,Lr,Dg,uv,zw,Oi,hc,V1,z1,G1,X1,Y1,K1;const Ml=class Gw{constructor({x:t,y:e},s,a,r,o,l=0){f(this,Oi),f(this,Fi),f(this,Ts,[]),f(this,Qd),f(this,Jd),f(this,qs,[]),f(this,J,new Float32Array(18)),f(this,wh),f(this,bh),f(this,Tg),f(this,Ig),f(this,Zd),f(this,dd),f(this,Lr,[]),u(this,Fi,s),u(this,dd,r*a),u(this,Jd,o),n(this,J).set([NaN,NaN,NaN,NaN,t,e],6),u(this,Qd,l),u(this,Ig,n(Gw,Dg)*a),u(this,Tg,n(Gw,zw)*a),u(this,Zd,a),n(this,Lr).push(t,e)}isEmpty(){return isNaN(n(this,J)[8])}add({x:t,y:e}){var s;u(this,wh,t),u(this,bh,e);const[a,r,o,l]=n(this,Fi);let[h,c,d,p]=n(this,J).subarray(8,12);const g=t-d,v=e-p,w=Math.hypot(g,v);if(w<n(this,Tg))return!1;const b=w-n(this,Ig),y=b/w,A=y*g,_=y*v;let E=h,x=c;h=d,c=p,d+=A,p+=_,(s=n(this,Lr))==null||s.push(t,e);const k=-_/b,C=A/b,I=k*n(this,dd),P=C*n(this,dd);return n(this,J).set(n(this,J).subarray(2,8),0),n(this,J).set([d+I,p+P],4),n(this,J).set(n(this,J).subarray(14,18),12),n(this,J).set([d-I,p-P],16),isNaN(n(this,J)[6])?(n(this,qs).length===0&&(n(this,J).set([h+I,c+P],2),n(this,qs).push(NaN,NaN,NaN,NaN,(h+I-a)/o,(c+P-r)/l),n(this,J).set([h-I,c-P],14),n(this,Ts).push(NaN,NaN,NaN,NaN,(h-I-a)/o,(c-P-r)/l)),n(this,J).set([E,x,h,c,d,p],6),!this.isEmpty()):(n(this,J).set([E,x,h,c,d,p],6),Math.abs(Math.atan2(x-c,E-h)-Math.atan2(_,A))<Math.PI/2?([h,c,d,p]=n(this,J).subarray(2,6),n(this,qs).push(NaN,NaN,NaN,NaN,((h+d)/2-a)
55/o,((c+p)/2-r)/l),[h,c,E,x]=n(this,J).subarray(14,18),n(this,Ts).push(NaN,NaN,NaN,NaN,((E+h)/2-a)/o,((x+c)/2-r)/l),!0):([E,x,h,c,d,p]=n(this,J).subarray(0,6),n(this,qs).push(((E+5*h)/6-a)/o,((x+5*c)/6-r)/l,((5*h+d)/6-a)/o,((5*c+p)/6-r)/l,((h+d)/2-a)/o,((c+p)/2-r)/l),[d,p,h,c,E,x]=n(this,J).subarray(12,18),n(this,Ts).push(((E+5*h)/6-a)/o,((x+5*c)/6-r)/l,((5*h+d)/6-a)/o,((5*c+p)/6-r)/l,((h+d)/2-a)/o,((c+p)/2-r)/l),!0))}toSVGPath(){if(this.isEmpty())return"";const t=n(this,qs),e=n(this,Ts);if(isNaN(n(this,J)[6])&&!this.isEmpty())return m(this,Oi,V1).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let a=6;a<t.length;a+=6)isNaN(t[a])?s.push(`L${t[a+4]} ${t[a+5]}`):s.push(`C${t[a]} ${t[a+1]} ${t[a+2]} ${t[a+3]} ${t[a+4]} ${t[a+5]}`);m(this,Oi,G1).call(this,s);for(let a=e.length-6;a>=6;a-=6)isNaN(e[a])?s.push(`L${e[a+4]} ${e[a+5]}`):s.push(`C${e[a]} ${e[a+1]} ${e[a+2]} ${e[a+3]} ${e[a+4]} ${e[a+5]}`);return m(this,Oi,z1).call(this,s),s.join(" ")}newFreeDrawOutline(t,e,s,a,r,o){return new J1(t,e,s,a,r,o)}getOutlines(){var t;const e=n(this,qs),s=n(this,Ts),a=n(this,J),[r,o,l,h]=n(this,Fi),c=new Float32Array((((t=n(this,Lr))==null?void 0:t.length)??0)+2);for(let g=0,v=c.length-2;g<v;g+=2)c[g]=(n(this,Lr)[g]-r)/l,c[g+1]=(n(this,Lr)[g+1]-o)/h;if(c[c.length-2]=(n(this,wh)-r)/l,c[c.length-1]=(n(this,bh)-o)/h,isNaN(a[6])&&!this.isEmpty())return m(this,Oi,X1).call(this,c);const d=new Float32Array(n(this,qs).length+24+n(this,Ts).length);let p=e.length;for(let g=0;g<p;g+=2){if(isNaN(e[g])){d[g]=d[g+1]=NaN;continue}d[g]=e[g],d[g+1]=e[g+1]}p=m(this,Oi,K1).call(this,d,p);for(let g=s.length-6;g>=6;g-=6)for(let v=0;v<6;v+=2){if(isNaN(s[g+v])){d[p]=d[p+1]=NaN,p+=2;continue}d[p]=s[g+v],d[p+1]=s[g+v+1],p+=2}return m(this,Oi,Y1).call(this,d,p),this.newFreeDrawOutline(d,c,n(this,Fi),n(this,Zd),n(this,Qd),n(this,Jd))}};Fi=new WeakMap,Ts=new WeakMap,Qd=new WeakMap,Jd=new WeakMap,qs=new WeakMap,J=new WeakMap,wh=new WeakMap,bh=new WeakMap,Tg=new WeakMap,Ig=new WeakMap,Zd=new WeakMap,dd=new WeakMap,Lr=new WeakMap,Dg=new WeakMap,uv=new WeakMap,zw=new WeakMap,Oi=new WeakSet,hc=function(){const i=n(this,J).subarray(4,6),t=n(this,J).subarray(16,18),[e,s,a,r]=n(this,Fi);return[(n(this,wh)+(i[0]-t[0])/2-e)/a,(n(this,bh)+(i[1]-t[1])/2-s)/r,(n(this,wh)+(t[0]-i[0])/2-e)/a,(n(this,bh)+(t[1]-i[1])/2-s)/r]},V1=function(){const[i,t,e,s]=n(this,Fi),[a,r,o,l]=m(this,Oi,hc).call(this);return`M${(n(this,J)[2]-i)/e} ${(n(this,J)[3]-t)/s} L${(n(this,J)[4]-i)/e} ${(n(this,J)[5]-t)/s} L${a} ${r} L${o} ${l} L${(n(this,J)[16]-i)/e} ${(n(this,J)[17]-t)/s} L${(n(this,J)[14]-i)/e} ${(n(this,J)[15]-t)/s} Z`},z1=function(i){const t=n(this,Ts);i.push(`L${t[4]} ${t[5]} Z`)},G1=function(i){const[t,e,s,a]=n(this,Fi),r=n(this,J).subarray(4,6),o=n(this,J).subarray(16,18),[l,h,c,d]=m(this,Oi,hc).call(this);i.push(`L${(r[0]-t)/s} ${(r[1]-e)/a} L${l} ${h} L${c} ${d} L${(o[0]-t)/s} ${(o[1]-e)/a}`)},X1=function(i){const t=n(this,J),[e,s,a,r]=n(this,Fi),[o,l,h,c]=m(this,Oi,hc).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(t[2]-e)/a,(t[3]-s)/r,NaN,NaN,NaN,NaN,(t[4]-e)/a,(t[5]-s)/r,NaN,NaN,NaN,NaN,o,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(t[16]-e)/a,(t[17]-s)/r,NaN,NaN,NaN,NaN,(t[14]-e)/a,(t[15]-s)/r],0),this.newFreeDrawOutline(d,i,n(this,Fi),n(this,Zd),n(this,Qd),n(this,Jd))},Y1=function(i,t){const e=n(this,Ts);return i.set([NaN,NaN,NaN,NaN,e[4],e[5]],t),t+=6},K1=function(i,t){const e=n(this,J).subarray(4,6),s=n(this,J).subarray(16,18),[a,r,o,l]=n(this,Fi),[h,c,d,p]=m(this,Oi,hc).call(this);return i.set([NaN,NaN,NaN,NaN,(e[0]-a)/o,(e[1]-r)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,d,p,NaN,NaN,NaN,NaN,(s[0]-a)/o,(s[1]-r)/l],t),t+=24},f(Ml,Dg,8),f(Ml,uv,2),f(Ml,zw,n(Ml,Dg)+n(Ml,uv));let q1=Ml;var ud,ih,Aa,Lg,Mi,Rg,Yt,Xw,Q1;class J1 extends O{constructor(t,e,s,a,r,o){super(),f(this,Xw),f(this,ud),f(this,ih,new Float32Array(4)),f(this,Aa),f(this,Lg),f(this,Mi),f(this,Rg),f(this,Yt),u(this,Yt,t),u(this,Mi,e),u(this,ud,s),u(this,Rg,a),u(this,Aa,r),u(this,Lg,o),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],m(this,Xw,Q1).call(this,o);const[l,h,c,d]=n(this,ih);for(let p=0,g=t.length;p<g;p+=2)t[p]=(t[p]-l)/c,t[p+1]=(t[p+1]-h)/d;for(let p=0,g=e.length;p<g;p+=2)e[p]=(e[p]-l)/c,e[p+1]=(e[p+1]-h)/d}toSVGPath(){const t=[`M${n(this,Yt)[4]} ${n(this,Yt)[5]}`];for(let e=6,s=n(this,Yt).length;e<s;e+=6){if(isNaN(n(this,Yt)[e])){t.push(`L${n(this,Yt)[e+4]} ${n(this,Yt)[e+5]}`);continue}t.push(`C${n(this,Yt)[e]} ${n(this,Yt)[e+1]} ${n(this,Yt)[e+2]} ${n(this,Yt)[e+3]} ${n(this,Yt)[e+4]} ${n(this,Yt)[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,s,a],r){const o=s-t,l=a-e;let h,c;switch(r){case 0:h=O._rescale(n(this,Yt),t,a,o,-l),c=O._rescale(n(this,Mi),t,a,o,-l);break;case 90:h=O._rescaleAndSwap(n(this,Yt),t,e,o,l),c=O._rescaleAndSwap(n(this,Mi),t,e,o,l);break;case 180:h=O._rescale(n(this,Yt),s,e,-o,l),c=O._rescale(n(this,Mi),s,e,-o,l);break;case 270:h=O._rescaleAndSwap(n(this,Yt),s,a,-o,-l),c=O._rescaleAndSwap(n(this,Mi),s,a,-o,-l);break}return{outline:Array.from(h),points:[Array.from(c)]}}get box(){return n(this,ih)}newOutliner(t,e,s,a,r,o=0){return new q1(t,e,s,a,r,o)}getNewOutline(t,e){const[s,a,r,o]=n(this,ih),[l,h,c,d]=n(this,ud),p=r*c,g=o*d,v=s*c+l,w=a*d+h,b=this.newOutliner({x:n(this,Mi)[0]
55*p+v,y:n(this,Mi)[1]*g+w},n(this,ud),n(this,Rg),t,n(this,Lg),e??n(this,Aa));for(let y=2;y<n(this,Mi).length;y+=2)b.add({x:n(this,Mi)[y]*p+v,y:n(this,Mi)[y+1]*g+w});return b.getOutlines()}}ud=new WeakMap,ih=new WeakMap,Aa=new WeakMap,Lg=new WeakMap,Mi=new WeakMap,Rg=new WeakMap,Yt=new WeakMap,Xw=new WeakSet,Q1=function(i){const t=n(this,Yt);let e=t[4],s=t[5];const a=[e,s,e,s];let r=e,o=s,l=e,h=s;const c=i?Math.max:Math.min,d=new Float32Array(4);for(let g=6,v=t.length;g<v;g+=6){const w=t[g+4],b=t[g+5];isNaN(t[g])?(R.pointBoundingBox(w,b,a),o>b?(r=w,o=b):o===b&&(r=c(r,w)),h<b?(l=w,h=b):h===b&&(l=c(l,w))):(d.set(En,0),R.bezierBoundingBox(e,s,...t.slice(g,g+6),d),R.rectBoundingBox(...d,a),o>d[1]?(r=d[0],o=d[1]):o===d[1]&&(r=c(r,d[0])),h<d[3]?(l=d[2],h=d[3]):h===d[3]&&(l=c(l,d[2]))),e=w,s=b}const p=n(this,ih);p[0]=a[0]-n(this,Aa),p[1]=a[1]-n(this,Aa),p[2]=a[2]-a[0]+2*n(this,Aa),p[3]=a[3]-a[1]+2*n(this,Aa),this.firstPoint=[r,o],this.lastPoint=[l,h]};var im,sm,nm,Rr,ys,Ds,Z1,yp,t_,e_,Yw;class Kw{constructor(t,e=0,s=0,a=!0){f(this,Ds),f(this,im),f(this,sm),f(this,nm),f(this,Rr,[]),f(this,ys,[]);const r=En.slice(),o=10**-4;for(const{x:b,y,width:A,height:_}of t){const E=Math.floor((b-e)/o)*o,x=Math.ceil((b+A+e)/o)*o,k=Math.floor((y-e)/o)*o,C=Math.ceil((y+_+e)/o)*o,I=[E,k,C,!0],P=[x,k,C,!1];n(this,Rr).push(I,P),R.rectBoundingBox(E,k,x,C,r)}const l=r[2]-r[0]+2*s,h=r[3]-r[1]+2*s,c=r[0]-s,d=r[1]-s;let p=a?-1/0:1/0,g=1/0;const v=n(this,Rr).at(a?-1:-2),w=[v[0],v[2]];for(const b of n(this,Rr)){const[y,A,_,E]=b;!E&&a?A<g?(g=A,p=y):A===g&&(p=Math.max(p,y)):E&&!a&&(A<g?(g=A,p=y):A===g&&(p=Math.min(p,y))),b[0]=(y-c)/l,b[1]=(A-d)/h,b[2]=(_-d)/h}u(this,im,new Float32Array([c,d,l,h])),u(this,sm,[p,g]),u(this,nm,w)}getOutlines(){n(this,Rr).sort((e,s)=>e[0]-s[0]||e[1]-s[1]||e[2]-s[2]);const t=[];for(const e of n(this,Rr))e[3]?(t.push(...m(this,Ds,Yw).call(this,e)),m(this,Ds,t_).call(this,e)):(m(this,Ds,e_).call(this,e),t.push(...m(this,Ds,Yw).call(this,e)));return m(this,Ds,Z1).call(this,t)}}im=new WeakMap,sm=new WeakMap,nm=new WeakMap,Rr=new WeakMap,ys=new WeakMap,Ds=new WeakSet,Z1=function(i){const t=[],e=new Set;for(const r of i){const[o,l,h]=r;t.push([o,l,r],[o,h,r])}t.sort((r,o)=>r[1]-o[1]||r[0]-o[0]);for(let r=0,o=t.length;r<o;r+=2){const l=t[r][2],h=t[r+1][2];l.push(h),h.push(l),e.add(l),e.add(h)}const s=[];let a;for(;e.size>0;){const r=e.values().next().value;let[o,l,h,c,d]=r;e.delete(r);let p=o,g=l;for(a=[o,h],s.push(a);;){let v;if(e.has(c))v=c;else if(e.has(d))v=d;else break;e.delete(v),[o,l,h,c,d]=v,p!==o&&(a.push(p,g,o,g===l?l:h),p=o),g=g===l?h:l}a.push(p,g)}return new Ok(s,n(this,im),n(this,sm),n(this,nm))},yp=function(i){const t=n(this,ys);let e=0,s=t.length-1;for(;e<=s;){const a=e+s>>1,r=t[a][0];if(r===i)return a;r<i?e=a+1:s=a-1}return s+1},t_=function([,i,t]){const e=m(this,Ds,yp).call(this,i);n(this,ys).splice(e,0,[i,t])},e_=function([,i,t]){const e=m(this,Ds,yp).call(this,i);for(let s=e;s<n(this,ys).length;s++){const[a,r]=n(this,ys)[s];if(a!==i)break;if(a===i&&r===t){n(this,ys).splice(s,1);return}}for(let s=e-1;s>=0;s--){const[a,r]=n(this,ys)[s];if(a!==i)break;if(a===i&&r===t){n(this,ys).splice(s,1);return}}},Yw=function(i){const[t,e,s]=i,a=[[t,e,s]],r=m(this,Ds,yp).call(this,s);for(let o=0;o<r;o++){const[l,h]=n(this,ys)[o];for(let c=0,d=a.length;c<d;c++){const[,p,g]=a[c];if(!(h<=p||g<=l)){if(p>=l){if(g>h)a[c][1]=h;else{if(d===1)return[];a.splice(c,1),c--,d--}continue}a[c][2]=l,g>h&&a.push([t,h,g])}}}return a};var Ng,pd;class Ok extends O{constructor(t,e,s,a){super(),f(this,Ng),f(this,pd),u(this,pd,t),u(this,Ng,e),this.firstPoint=s,this.lastPoint=a}toSVGPath(){const t=[];for(const e of n(this,pd)){let[s,a]=e;t.push(`M${s} ${a}`);for(let r=2;r<e.length;r+=2){const o=e[r],l=e[r+1];o===s?(t.push(`V${l}`),a=l):l===a&&(t.push(`H${o}`),s=o)}t.push("Z")}return t.join(" ")}serialize([t,e,s,a],r){const o=[],l=s-t,h=a-e;for(const c of n(this,pd)){const d=new Array(c.length);for(let p=0;p<c.length;p+=2)d[p]=t+c[p]*l,d[p+1]=a-c[p+1]*h;o.push(d)}return o}get box(){return n(this,Ng)}get classNamesForOutlining(){return["highlightOutline"]}}Ng=new WeakMap,pd=new WeakMap;class qw extends q1{newFreeDrawOutline(t,e,s,a,r,o){return new Wk(t,e,s,a,r,o)}}class Wk extends J1{newOutliner(t,e,s,a,r,o=0){return new qw(t,e,s,a,r,o)}}var tu,am,Da,sh,Fg,ui,rm,om,yh,Pi,Ni,Ie,eu,iu,$e,gd,ns,Og,ct,Qw,lm,i_,s_,gy,Jw,Nr,bn,Ah,n_,Wg,hm,a_,r_,o_,l_,h_;const Ye=class Me extends kt{constructor(t){super({...t,name:"highlightEditor"}),f(this,ct),f(this,tu,null),f(this,am,0),f(this,Da),f(this,sh,null),f(this,Fg,null),f(this,ui,null),f(this,rm,null),f(this,om,0),f(this,yh,null),f(this,Pi,null),f(this,Ni,null),f(this,Ie,!1),f(this,eu,null),f(this,iu,null),f(this,$e,null),f(this,gd,""),f(this,ns),f(this,Og,""),this.color=t.color||Me._defaultColor,u(this,ns,t.thickness||Me._defaultThickness),this.opacity=t.opacity||Me._defaultOpacity,u(this,Da,t.boxes||null),u(this,Og,t.methodOfCreation||""),u(this,gd,t.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(u(this,Ie,!0),m(this,ct,lm).call(this,t),m(this,ct,Nr).call(this)):n(this,Da)&&(u(this,tu,t.anchorNode),u(this,am,t.anchorOffset),u(this,rm,t.focusNode),u(this,om,t.focusOffset),m(this,ct,Qw).call(this),m(this,ct,Nr).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){const t=Me.prototype;return G(this,"_keyboardManager",new Pu([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:n(this,Ie)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:n(this,ns),methodOfCreation:n(this,Og)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var s;kt.initialize(t,e),Me._defaultColor||(Me._defaultColor=((s=e.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case K.HIGHLIGHT_COLOR:Me._defaultColor=e;break;case K.HIGHLIGHT_THICKNESS:Me._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return n(this,iu)}get commentButtonPosition(){return n(this,eu)}updateParams(t,e){switch(t){case K.HIGHLIGHT_COLOR:m(this,ct,i_).call(this,e);break;case K.HIGHLIGHT_THICKNESS:m(this,ct,s_).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[K.HIGHLIGHT_COLOR,Me._defaultColor],[K.HIGHLIGHT_THICKNESS,Me._defaultThickness]]}get propertiesToUpdate(){return[[K.HIGHLIGHT_COLOR,this.color||Me._defaultColor],[K.HIGHLIGHT_THICKNESS,n(this,ns)||Me._defaultThickness],[K.HIGHLIGHT_FREE,n(this,Ie)]]}onUpdatedColor(){var t,e;(t=this.parent)==null||t.drawLayer.updateProperties(n(this,Ni),{root:{fill:this.color,"fill-opacity":this.opacity}}),(e=n(this,Fg))==null||e.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",u(this,Fg,new S1({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(m(this,ct,hm).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,m(this,ct,hm).call(this))}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){m(this,ct,Jw).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(m(this,ct,Nr).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var e;let s=!1;this.parent&&!t?m(this,ct,Jw).call(this):t&&(m(this,ct,Nr).call(this,t),s=!this.parent&&((e=this.div)==null?void 0:e.classList.contains("selectedEditor"))),super.setParent(t),this.show(this._isVisible),s&&this.select()}rotate(t){var e,s,a;const{drawLayer:r}=this.parent;let o;n(this,Ie)?(t=(t-this.rotation+360)%360,o=m(e=Me,bn,Ah).call(e,n(this,Pi).box,t)):o=m(s=Me,bn,Ah).call(s,[this.x,this.y,this.width,this.height],t),r.updateProperties(n(this,Ni),{bbox:o,root:{"data-main-rotation":t}}),r.updateProperties(n(this,$e),{bbox:m(a=Me,bn,Ah).call(a,n(this,ui).box,t),root:{"data-main-rotation":t}})}
55render(){if(this.div)return this.div;const t=super.render();n(this,gd)&&(t.setAttribute("aria-label",n(this,gd)),t.setAttribute("role","mark")),n(this,Ie)?t.classList.add("free"):this.div.addEventListener("keydown",m(this,ct,n_).bind(this),{signal:this._uiManager._signal});const e=u(this,yh,document.createElement("div"));return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=n(this,sh),this.setDims(),SA(this,n(this,yh),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(n(this,$e),{rootClass:{hovered:!0}})}pointerleave(){var t;this.isSelected||(t=this.parent)==null||t.drawLayer.updateProperties(n(this,$e),{rootClass:{hovered:!1}})}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:m(this,ct,Wg).call(this,!0);break;case 1:case 3:m(this,ct,Wg).call(this,!1);break}}select(){var t;super.select(),n(this,$e)&&((t=this.parent)==null||t.drawLayer.updateProperties(n(this,$e),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var t;super.unselect(),n(this,$e)&&((t=this.parent)==null||t.drawLayer.updateProperties(n(this,$e),{rootClass:{selected:!1}}),n(this,Ie)||m(this,ct,Wg).call(this,!1))}get _mustFixPosition(){return!n(this,Ie)}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(n(this,Ni),{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(n(this,$e),{rootClass:{hidden:!t}}))}static startHighlighting(t,e,{target:s,x:a,y:r}){const{x:o,y:l,width:h,height:c}=s.getBoundingClientRect(),d=new AbortController,p=t.combinedSignal(d),g=v=>{d.abort(),m(this,bn,l_).call(this,t,v)};window.addEventListener("blur",g,{signal:p}),window.addEventListener("pointerup",g,{signal:p}),window.addEventListener("pointerdown",Pt,{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",Bi,{signal:p}),s.addEventListener("pointermove",m(this,bn,o_).bind(this,t),{signal:p}),this._freeHighlight=new qw({x:a,y:r},[o,l,h,c],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(t,e,s){var a,r,o,l;let h=null;if(t instanceof O1){const{data:{quadPoints:E,rect:x,rotation:k,id:C,color:I,opacity:P,popupRef:M,richText:D,contentsObj:L,creationDate:W,modificationDate:$},parent:{page:{pageNumber:j}}}=t;h=t={annotationType:V.HIGHLIGHT,color:Array.from(I),opacity:P,quadPoints:E,boxes:null,pageIndex:j-1,rect:x.slice(0),rotation:k,annotationElementId:C,id:C,deleted:!1,popupRef:M,richText:D,comment:(L==null?void 0:L.str)||null,creationDate:W,modificationDate:$}}else if(t instanceof Zb){const{data:{inkLists:E,rect:x,rotation:k,id:C,color:I,borderStyle:{rawWidth:P},popupRef:M,richText:D,contentsObj:L,creationDate:W,modificationDate:$},parent:{page:{pageNumber:j}}}=t;h=t={annotationType:V.HIGHLIGHT,color:Array.from(I),thickness:P,inkLists:E,boxes:null,pageIndex:j-1,rect:x.slice(0),rotation:k,annotationElementId:C,id:C,deleted:!1,popupRef:M,richText:D,comment:(L==null?void 0:L.str)||null,creationDate:W,modificationDate:$}}const{color:c,quadPoints:d,inkLists:p,outlines:g,opacity:v}=t,w=await super.deserialize(t,e,s);w.color=R.makeHexColor(...c),w.opacity=v||1,p&&u(w,ns,t.thickness),w._initialData=h,t.comment&&w.setCommentData(t);const[b,y]=w.pageDimensions,[A,_]=w.pageTranslation;if(d){const E=u(w,Da,[]);for(let x=0;x<d.length;x+=8)E.push({x:(d[x]-A)/b,y:1-(d[x+1]-_)/y,width:(d[x+2]-d[x])/b,height:(d[x+1]-d[x+5])/y});m(a=w,ct,Qw).call(a),m(r=w,ct,Nr).call(r),w.rotate(w.rotation)}else if(p||g){u(w,Ie,!0);const E=(p||g.points)[0],x={x:E[0]-A,y:y-(E[1]-_)},k=new qw(x,[0,0,b,y],1,n(w,ns)/2,!0,.001);for(let P=0,M=E.length;P<M;P+=2)x.x=E[P]-A,x.y=y-(E[P+1]-_),k.add(x);const{id:C,clipPathId:I}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:w.color,"fill-opacity":w._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:k.toSVGPath()}},!0,!0);m(o=w,ct,lm).call(o,{highlightOutlines:k.getOutlines(),highlightId:C,clipPathId:I}),m(l=w,ct,Nr).call(l),w.rotate(w.parentRotation)}return w}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=kt._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),s=super.serialize(t);return Object.assign(s,{color:e,opacity:this.opacity,thickness:n(this,ns),quadPoints:m(this,ct,a_).call(this),outlines:m(this,ct,r_).call(this,s.rect)}),this.addComment(s),this.annotationElementId&&!m(this,ct,h_).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};tu=new WeakMap,am=new WeakMap,Da=new WeakMap,sh=new WeakMap,Fg=new WeakMap,ui=new WeakMap,rm=new WeakMap,om=new WeakMap,yh=new WeakMap,Pi=new WeakMap,Ni=new WeakMap,Ie=new WeakMap,eu=new WeakMap,iu=new WeakMap,$e=new WeakMap,gd=new WeakMap,ns=new WeakMap,Og=new WeakMap,ct=new WeakSet,Qw=function(){const i=new Kw(n(this,Da),.001);u(this,Pi,i.getOutlines()),[this.x,this.y,this.width,this.height]=n(this,Pi).box;const t=new Kw(n(this,Da),.0025,.001,this._uiManager.direction==="ltr");u(this,ui,t.getOutlines());const{firstPoint:e}=n(this,Pi);u(this,eu,[(e[0]-this.x)/this.width,(e[1]-this.y)/this.height]);const{lastPoint:s}=n(this,ui);u(this,iu,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},lm=function({highlightOutlines:i,highlightId:t,clipPathId:e}){var s,a;if(u(this,Pi,i),u(this,ui,i.getNewOutline(n(this,ns)/2+1.5,.0025)),t>=0)u(this,Ni,t),u(this,sh,e),this.parent.drawLayer.finalizeDraw(t,{bbox:i.box,path:{d:i.toSVGPath()}}),u(this,$e,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:n(this,ui).box,path:{d:n(this,ui).toSVGPath()}},!0));else if(this.parent){const p=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(n(this,Ni),{bbox:m(s=Ye,bn,Ah).call(s,n(this,Pi).box,(p-this.rotation+360)%360),path:{d:i.toSVGPath()}}),this.parent.drawLayer.updateProperties(n(this,$e),{bbox:m(a=Ye,bn,Ah).call(a,n(this,ui).box,p),path:{d:n(this,ui).toSVGPath()}})}const[r,o,l,h]=i.box;switch(this.rotation){case 0:this.x=r,this.y=o,this.width=l,this.height=h;break;case 90:{const[p,g]=this.parentDimensions;this.x=o,this.y=1-r,this.width=l*g/p,this.height=h*p/g;break}case 180:this.x=1-r,this.y=1-o,this.width=l,this.height=h;break;case 270:{const[p,g]=this.parentDimensions;this.x=1-o,this.y=r,this.width=l*g/p,this.height=h*p/g;break}}const{firstPoint:c}=i;u(this,eu,[(c[0]-r)/l,(c[1]-o)/h]);const{lastPoint:d}=n(this,ui);u(this,iu,[(d[0]-r)/l,(d[1]-o)/h])},i_=function(i){const t=(a,r)=>{this.color=a,this.opacity=r,this.onUpdatedColor()},e=this.color,s=this.opacity;this.addCommands({cmd:t.bind(this,i,Ye._defaultOpacity),undo:t.bind(this,e,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(i)},!0)},s_=function(i){const t=n(this,ns),e=s=>{u(this,ns,s),m(this,ct,gy).call(this,s)};this.addCommands({cmd:e.bind(this,i),undo:e.bind(this,t),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:i},!0)},gy=function(i){n(this,Ie)&&(m(this,ct,lm).call(this,{highlightOutlines:n(this,Pi).getNewOutline(i/2)}),this.fixAndSetPosition(),this.setDims())},Jw=function(){n(this,Ni)===null||!this.parent||(this.parent.drawLayer.remove(n(this,Ni)),u(this,Ni,null),this.parent.drawLayer.remove(n(this,$e)),u(this,$e,null))},Nr=function(i=this.parent){n(this,Ni)===null&&({id:jt(this,Ni)._,clipPathId:jt(this,sh)._}=i.drawLayer.draw({bbox:n(this,Pi).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:n(this,Ie)},path:{d:n(this,Pi).toSVGPath()}},!1,!0),u(this,$e,i.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:n(this,Ie)},bbox:n(this,ui).box,path:{d:n(this,ui).toSVGPath()}},n(this,Ie))),n(this,yh)&&(n(this,yh).style.clipPath=n(this,sh)))},bn=new WeakSet,Ah=function([i,t,e,s],a){switch(a){case 90:return[1-t-s,i,s,e];case 180:return[1-i-e,1-t-s,e,s];case 270:return[t,1-i-e,s,e]}return[i,t,e,s]},n_=function(i){Ye._keyboardManager.exec(this,i)},Wg=function(i){if(!n(this,tu))return;const t=window.getSelection();i?t.setPosition(n(this,tu),n(this,am)):t.setPosition(n(this,rm),n(this,om))},hm=function(){return n(this,Ie)?this.rotation:0},a_=function(){if(n(this,Ie))return null;const[i,t]=this.pageDimensions,[e,s]=this.pageTranslation,a=n(this,Da),r=new Float32Array(a.length*8);let o=0;for(const{x:l,y:h,width:c,height:d}of a){const p=l*i+e,g=(1-h)*t+s;r[o]=r[o+4]=p,r[o+1]=r[o+3]=g,r[o+2]=r[o+6]=p+c*i,r[o+5]=r[o+7]=g-d*t,o+=8}return r},r_=function(i){return n(this,Pi).serialize(i,m(this,ct,hm).call(this))},o_=function(i,t){this._freeHighlight.add(t)&&i.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},l_=function(i,t){this._freeHighlight.isEmpty()?i.drawLayer.remove(this._freeHighlightId):i.createAndAddNewEditor(t,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},h_=function(i){const{color:t}=this._initialData;
55return this.hasEditedComment||i.color.some((e,s)=>e!==t[s])},f(Ye,bn),S(Ye,"_defaultColor",null),S(Ye,"_defaultOpacity",1),S(Ye,"_defaultThickness",12),S(Ye,"_type","highlight"),S(Ye,"_editorType",V.HIGHLIGHT),S(Ye,"_freeHighlightId",-1),S(Ye,"_freeHighlight",null),S(Ye,"_freeHighlightClipId","");let fy=Ye;var Cl;class c_{constructor(){f(this,Cl,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(const[e,s]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,s)}updateSVGProperty(t,e){n(this,Cl)[t]=e}toSVGProperties(){const t=n(this,Cl);return u(this,Cl,Object.create(null)),{root:t}}reset(){u(this,Cl,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){at("Not implemented")}}Cl=new WeakMap;var Je,fd,ve,nh,ah,mt,Zw,pv,tb,md,my,Bg,su,Pl;const Jn=class ht extends kt{constructor(t){super(t),f(this,mt),f(this,Je,null),f(this,fd),S(this,"_colorPicker",null),S(this,"_drawId",null),u(this,fd,t.mustBeCommitted||!1),this._addOutlines(t)}onUpdatedColor(){var t;(t=this._colorPicker)==null||t.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){var t,e;(e=(t=this._colorPicker)==null?void 0:t.updateOpacity)==null||e.call(t,this.opacity)}_addOutlines(t){t.drawOutlines&&(m(this,mt,Zw).call(this,t),m(this,mt,md).call(this))}static _mergeSVGProperties(t,e){const s=new Set(Object.keys(t));for(const[a,r]of Object.entries(e))s.has(a)?Object.assign(t[a],r):t[a]=r;return t}static getDefaultDrawingOptions(t){at("Not implemented")}static get typesMap(){at("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){const s=this.typesMap.get(t);s&&this._defaultDrawingOptions.updateProperty(s,e),this._currentParent&&(n(ht,ve).updateProperty(s,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){const s=this.constructor.typesMap.get(t);s&&this._updateProperty(t,s,e)}static get defaultPropertiesToUpdate(){const t=[],e=this._defaultDrawingOptions;for(const[s,a]of this.typesMap)t.push([s,e[a]]);return t}get propertiesToUpdate(){const t=[],{_drawingOptions:e}=this;for(const[s,a]of this.constructor.typesMap)t.push([s,e[a]]);return t}_updateProperty(t,e,s){const a=this._drawingOptions,r=a[e],o=l=>{var h;a.updateProperty(e,l);const c=n(this,Je).updateProperty(e,l);c&&m(this,mt,su).call(this,c),(h=this.parent)==null||h.drawLayer.updateProperties(this._drawId,a.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,s),undo:o.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,e){const s=this.constructor.typesMap.get(this.colorType),a=this.constructor.typesMap.get(this.opacityType),r=this._drawingOptions,o=r[s],l=r[a],h=(c,d)=>{var p;r.updateProperty(s,c),r.updateProperty(a,d),n(this,Je).updateProperty(s,c),n(this,Je).updateProperty(a,d),(p=this.parent)==null||p.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:h.bind(this,t,e),undo:h.bind(this,o,l),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,ht._mergeSVGProperties(n(this,Je).getPathResizingSVGProperties(m(this,mt,Bg).call(this)),{bbox:m(this,mt,Pl).call(this)}))}_onResized(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,ht._mergeSVGProperties(n(this,Je).getPathResizedSVGProperties(m(this,mt,Bg).call(this)),{bbox:m(this,mt,Pl).call(this)}))}_onTranslating(t,e){var s;(s=this.parent)==null||s.drawLayer.updateProperties(this._drawId,{bbox:m(this,mt,Pl).call(this)})}_onTranslated(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,ht._mergeSVGProperties(n(this,Je).getPathTranslatedSVGProperties(m(this,mt,Bg).call(this),this.parentDimensions),{bbox:m(this,mt,Pl).call(this)}))}_onStartDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var t;(t=this.parent)==null||t.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,n(this,fd)&&(u(this,fd,!1),this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){m(this,mt,tb).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(m(this,mt,md).call(this),m(this,mt,su).call(this,n(this,Je).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){var e;let s=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),m(this,mt,tb).call(this)):t&&(this._uiManager.addShouldRescale(this),m(this,mt,md).call(this,t),s=!this.parent&&((e=this.div)==null?void 0:e.classList.contains("selectedEditor"))),super.setParent(t),s&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,ht._mergeSVGProperties({bbox:m(this,mt,Pl).call(this)},n(this,Je).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&m(this,mt,su).call(this,n(this,Je).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}
55render(){if(this.div)return this.div;let t,e;this._isCopy&&(t=this.x,e=this.y);const s=super.render();s.classList.add("draw");const a=document.createElement("div");return s.append(a),a.setAttribute("aria-hidden","true"),a.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),s}static createDrawerInstance(t,e,s,a,r){at("Not implemented")}static startDrawing(t,e,s,a){var r;const{target:o,offsetX:l,offsetY:h,pointerId:c,pointerType:d}=a;if(Xe.isInitializedAndDifferentPointerType(d))return;const{viewport:{rotation:p}}=t,{width:g,height:v}=o.getBoundingClientRect(),w=u(ht,nh,new AbortController),b=t.combinedSignal(w);if(Xe.setPointer(d,c),window.addEventListener("pointerup",y=>{Xe.isSamePointerIdOrRemove(y.pointerId)&&this._endDraw(y)},{signal:b}),window.addEventListener("pointercancel",y=>{Xe.isSamePointerIdOrRemove(y.pointerId)&&this._currentParent.endDrawingSession()},{signal:b}),window.addEventListener("pointerdown",y=>{Xe.isSamePointerType(y.pointerType)&&(Xe.initializeAndAddPointerId(y.pointerId),n(ht,ve).isCancellable()&&(n(ht,ve).removeLastElement(),n(ht,ve).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:b}),window.addEventListener("contextmenu",Bi,{signal:b}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:b}),o.addEventListener("touchmove",y=>{Xe.isSameTimeStamp(y.timeStamp)&&Pt(y)},{signal:b}),t.toggleDrawing(),(r=e._editorUndoBar)==null||r.hide(),n(ht,ve)){t.drawLayer.updateProperties(this._currentDrawId,n(ht,ve).startNew(l,h,g,v,p));return}e.updateUIForDefaultProperties(this),u(ht,ve,this.createDrawerInstance(l,h,g,v,p)),u(ht,ah,this.getDefaultDrawingOptions()),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(n(ht,ah).toSVGProperties(),n(ht,ve).defaultSVGProperties),!0,!1)}static _drawMove(t){if(Xe.isSameTimeStamp(t.timeStamp),!n(ht,ve))return;const{offsetX:e,offsetY:s,pointerId:a}=t;if(Xe.isSamePointerId(a)){if(Xe.isUsingMultiplePointers()){this._endDraw(t);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,n(ht,ve).add(e,s)),Xe.setTimeStamp(t.timeStamp),Pt(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,u(ht,ve,null),u(ht,ah,null),Xe.clearTimeStamp()),n(ht,nh)&&(n(ht,nh).abort(),u(ht,nh,null),Xe.clearPointerIds())}static _endDraw(t){const e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),(t==null?void 0:t.target)===e.div&&e.drawLayer.updateProperties(this._currentDrawId,n(ht,ve).end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){const s=n(ht,ve),a=this._currentDrawId,r=s.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(a,s.setLastElement(r))},undo:()=>{e.drawLayer.updateProperties(a,s.removeLastElement())},mustExec:!1,type:K.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){const e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(K.DRAW_STEP),!n(ht,ve).isEmpty()){const{pageDimensions:[s,a],scale:r}=e,o=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:n(ht,ve).getOutlines(s*r,a*r,r,this._INNER_MARGIN),drawingOptions:n(ht,ah),mustBeCommitted:!t});return this._cleanup(!0),o}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,s,a,r,o){at("Not implemented")}static async deserialize(t,e,s){var a,r;const{rawDims:{pageWidth:o,pageHeight:l,pageX:h,pageY:c}}=e.viewport,d=this.deserializeDraw(h,c,o,l,this._INNER_MARGIN,t),p=await super.deserialize(t,e,s);return p.createDrawingOptions(t),m(a=p,mt,Zw).call(a,{drawOutlines:d}),m(r=p,mt,md).call(r),p.onScaleChanging(),p.rotate(),p}serializeDraw(t){const[e,s]=this.pageTranslation,[a,r]=this.pageDimensions;return n(this,Je).serialize([e,s,a,r],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Je=new WeakMap,fd=new WeakMap,ve=new WeakMap,nh=new WeakMap,ah=new WeakMap,mt=new WeakSet,Zw=function({drawOutlines:i,drawId:t,drawingOptions:e}){u(this,Je,i),this._drawingOptions||(this._drawingOptions=e),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),t>=0?(this._drawId=t,this.parent.drawLayer.finalizeDraw(t,i.defaultProperties)):this._drawId=m(this,mt,pv).call(this,i,this.parent),m(this,mt,su).call(this,i.box)},pv=function(i,t){const{id:e}=t.drawLayer.draw(Jn._mergeSVGProperties(this._drawingOptions.toSVGProperties(),i.defaultSVGProperties),!1,!1);return e},tb=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},md=function(i=this.parent){if(!(this._drawId!==null&&this.parent===i)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,i.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=m(this,mt,pv).call(this,n(this,Je),i)}},my=function([i,t,e,s]){const{parentDimensions:[a,r],rotation:o}=this;switch(o){case 90:return[t,1-i,e*(r/a),s*(a/r)];case 180:return[1-i,1-t,e,s];case 270:return[1-t,i,e*(r/a),s*(a/r)];default:return[i,t,e,s]}},Bg=function(){const{x:i,y:t,width:e,height:s,parentDimensions:[a,r],rotation:o}=this;switch(o){case 90:return[1-t,i,e*(a/r),s*(r/a)];case 180:return[1-i,1-t,e,s];case 270:return[t,1-i,e*(a/r),s*(r/a)];default:return[i,t,e,s]}},su=function(i){[this.x,this.y,this.width,this.height]=m(this,mt,my).call(this,i),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Pl=function(){const{x:i,y:t,width:e,height:s,rotation:a,parentRotation:r,parentDimensions:[o,l]}=this;switch((a*4+r)/90){case 1:return[1-t-s,i,s,e];case 2:return[1-i-e,1-t-s,e,s];case 3:return[t,1-i-e,s,e];case 4:return[i,t-e*(o/l),s*(l/o),e*(o/l)];case 5:return[1-t,i,e*(o/l),s*(l/o)];case 6:return[1-i-s*(l/o),1-t,s*(l/o),e*(o/l)];case 7:return[t-e*(o/l),1-i-s*(l/o),e*(o/l),s*(l/o)];case 8:return[i-e,t-s,e,s];case 9:return[1-t,i-e,s,e];case 10:return[1-i,1-t,e,s];case 11:return[t-s,1-i,s,e];case 12:return[i-s*(l/o),t,s*(l/o),e*(o/l)];case 13:return[1-t-e*(o/l),i-s*(l/o),e*(o/l),s*(l/o)];case 14:return[1-i,1-t-e*(o/l),s*(l/o),e*(o/l)];case 15:return[t,1-i,e*(o/l),s*(l/o)];default:return[i,t,e,s]}},S(Jn,"_currentDrawId",-1),S(Jn,"_currentParent",null),f(Jn,ve,null),f(Jn,nh,null),f(Jn,ah,null),S(Jn,"_INNER_MARGIN",3);let d_=Jn;var Qs,pe,ge,rh,vd,Ke,fe,Ji,Tl,oh,lh,wd,jg;class Bk{constructor(t,e,s,a,r,o){f(this,wd),f(this,Qs,new Float64Array(6)),f(this,pe),f(this,ge),f(this,rh),f(this,vd),f(this,Ke),f(this,fe,""),f(this,Ji,0),f(this,Tl,new Tu),f(this,oh),f(this,lh),u(this,oh,s),u(this,lh,a),u(this,rh,r),u(this,vd,o),[t,e]=m(this,wd,jg).call(this,t,e);const l=u(this,pe,[NaN,NaN,NaN,NaN,t,e]);u(this,Ke,[t,e]),u(this,ge,[{line:l,points:n(this,Ke)}]),n(this,Qs).set(l,0)}updateProperty(t,e){t==="stroke-width"&&u(this,vd,e)}isEmpty(){return!n(this,ge)||n(this,ge).length===0}isCancellable(){return n(this,Ke).length<=10}add(t,e){[t,e]=m(this,wd,jg).call(this,t,e);const[s,a,r,o]=n(this,Qs).subarray(2,6),l=t-r,h=e-o;return Math.hypot(n(this,oh)*l,n(this,lh)*h)<=2?null:(n(this,Ke).push(t,e),isNaN(s)?(n(this,Qs).set([r,o,t,e],2),n(this,pe).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(n(this,Qs)[0])&&n(this,pe).splice(6,6),n(this,Qs).set([s,a,r,o,t,e],0),n(this,pe).push(...O.createBezierPoints(s,a,r,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){return this.add(t,e)||(n(this,Ke).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,s,a,r){u(this,oh,s),u(this,lh,a),u(this,rh,r),[t,e]=m(this,wd,jg).call(this,t,e);const o=u(this,pe,[NaN,NaN,NaN,NaN,t,e]);u(this,Ke,[t,e]);const l=n(this,ge).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),n(this,ge).push({line:o,points:n(this,Ke)}),n(this,Qs).set(o,0),u(this,Ji,0),this.toSVGPath(),null}getLastElement(){return n(this,ge).at(-1)}setLastElement(t){return n(this,ge)?(n(this,ge).push(t),u(this,pe,t.line),u(this,Ke,t.points),u(this,Ji,0),{path:{d:this.toSVGPath()}}):n(this,Tl).setLastElement(t)}removeLastElement(){if(!n(this,ge))return n(this,Tl).removeLastElement();n(this,ge).pop(),u(this,fe,"");for(let t=0,e=n(this,ge).length;t<e;t++){const{line:s,points:a}=n(this,ge)[t];u(this,pe,s),u(this,Ke,a),u(this,Ji,0),this.toSVGPath()}return{path:{d:n(this,fe)}}}toSVGPath(){const t=O.svgRound(n(this,pe)[4]),e=O.svgRound(n(this,pe)[5]);if(n(this,Ke).length===2)return u(this,fe,`${n(this,fe)} M ${t} ${e} Z`),n(this,fe);if(n(this,Ke).length<=6){const a=n(this,fe).lastIndexOf("M");u(this,fe,`${n(this,fe).slice(0,a)} M ${t} ${e}`),u(this,Ji,6)}if(n(this,Ke).length===4){const a=O.svgRound(n(this,pe)[10]),r=O.svgRound(n(this,pe)[11]);return u(this,fe,`${n(this,fe)} L ${a} ${r}`),u(this,Ji,12),n(this,fe)}const s=[];n(this,Ji)===0&&(s.push(`M ${t} ${e}`),u(this,Ji,6));for(let a=n(this,Ji),r=n(this,pe).length;a<r;a+=6){const[o,l,h,c,d,p]=n(this,pe).slice(a,a+6).map(O.svgRound);s.push(`C${o} ${l} ${h} ${c} ${d} ${p}`)}return u(this,fe,n(this,fe)+s.join(" ")),u(this,Ji,n(this,pe).length),n(this,fe)}getOutlines(t,e,s,a){const r=n(this,ge).at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),n(this,Tl).build(n(this,ge),t,e,s,n(this,rh),n(this,vd),a),u(this,Qs,null),u(this,pe,null),u(this,ge,null),u(this,fe,null),n(this,Tl)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Qs=new WeakMap,pe=new WeakMap,ge=new WeakMap,rh=new WeakMap,vd=new WeakMap,Ke=new WeakMap,fe=new WeakMap,Ji=new WeakMap,Tl=new WeakMap,oh=new WeakMap,lh=new WeakMap,wd=new WeakSet,jg=function(i,t){return O._normalizePoint(i,t,n(this,oh),n(this,lh),n(this,rh))};var Ze,$g,cm,Ti,mn,vn,nu,au,_h,mi,yn,u_,p_,g_;class Tu extends O{constructor(){super(...arguments),f(this,mi),f(this,Ze),f(this,$g,0),f(this,cm),f(this,Ti),f(this,mn),f(this,vn),f(this,nu),f(this,au),f(this,_h)}build(t,e,s,a,r,o,l){u(this,mn,e),u(this,vn,s),u(this,nu,a),u(this,au,r),u(this,_h,o),u(this,cm,l??0),u(this,Ti,t),m(this,mi,p_).call(this)}get thickness(){return n(this,_h)}setLastElement(t){return n(this,Ti).push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return n(this,Ti).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const t=[];for(const{line:e}of n(this,Ti)){if(t.push(`M${O.svgRound(e[4])} ${O.svgRound(e[5])}`),e.length===6){t.push("Z");continue}if(e.length===12&&isNaN(e[6])){t.push(`L${O.svgRound(e[10])} ${O.svgRound(e[11])}`);continue}for(let s=6,a=e.length;s<a;s+=6){const[r,o,l,h,c,d]=e.subarray(s,s+6).map(O.svgRound);t.push(`C${r} ${o} ${l} ${h} ${c} ${d}`)}}return t.join("")}serialize([t,e,s,a],r){const o=[],l=[],[h,c,d,p]=m(this,mi,u_).call(this);let g,v,w,b,y,A,_,E,x;switch(n(this,au)){case 0:x=O._rescale,g=t,v=e+a,w=s,b=-a,y=t+h*s,A=e+(1-c-p)*a,_=t+(h+d)*s,E=e+(1-c)*a;break;
55case 90:x=O._rescaleAndSwap,g=t,v=e,w=s,b=a,y=t+c*s,A=e+h*a,_=t+(c+p)*s,E=e+(h+d)*a;break;case 180:x=O._rescale,g=t+s,v=e,w=-s,b=a,y=t+(1-h-d)*s,A=e+c*a,_=t+(1-h)*s,E=e+(c+p)*a;break;case 270:x=O._rescaleAndSwap,g=t+s,v=e+a,w=-s,b=-a,y=t+(1-c-p)*s,A=e+(1-h-d)*a,_=t+(1-c)*s,E=e+(1-h)*a;break}for(const{line:k,points:C}of n(this,Ti))o.push(x(k,g,v,w,b,r?new Array(k.length):null)),l.push(x(C,g,v,w,b,r?new Array(C.length):null));return{lines:o,points:l,rect:[y,A,_,E]}}static deserialize(t,e,s,a,r,{paths:{lines:o,points:l},rotation:h,thickness:c}){const d=[];let p,g,v,w,b;switch(h){case 0:b=O._rescale,p=-t/s,g=e/a+1,v=1/s,w=-1/a;break;case 90:b=O._rescaleAndSwap,p=-e/a,g=-t/s,v=1/a,w=1/s;break;case 180:b=O._rescale,p=t/s+1,g=-e/a,v=-1/s,w=1/a;break;case 270:b=O._rescaleAndSwap,p=e/a+1,g=t/s+1,v=-1/a,w=-1/s;break}if(!o){o=[];for(const A of l){const _=A.length;if(_===2){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1]]));continue}if(_===4){o.push(new Float32Array([NaN,NaN,NaN,NaN,A[0],A[1],NaN,NaN,NaN,NaN,A[2],A[3]]));continue}const E=new Float32Array(3*(_-2));o.push(E);let[x,k,C,I]=A.subarray(0,4);E.set([NaN,NaN,NaN,NaN,x,k],0);for(let P=4;P<_;P+=2){const M=A[P],D=A[P+1];E.set(O.createBezierPoints(x,k,C,I,M,D),(P-2)*3),[x,k,C,I]=[C,I,M,D]}}}for(let A=0,_=o.length;A<_;A++)d.push({line:b(o[A].map(E=>E??NaN),p,g,v,w),points:b(l[A].map(E=>E??NaN),p,g,v,w)});const y=new this.prototype.constructor;return y.build(d,s,a,1,h,c,r),y}get box(){return n(this,Ze)}updateProperty(t,e){return t==="stroke-width"?m(this,mi,g_).call(this,e):null}updateParentDimensions([t,e],s){const[a,r]=m(this,mi,yn).call(this);u(this,mn,t),u(this,vn,e),u(this,nu,s);const[o,l]=m(this,mi,yn).call(this),h=o-a,c=l-r,d=n(this,Ze);return d[0]-=h,d[1]-=c,d[2]+=2*h,d[3]+=2*c,d}updateRotation(t){return u(this,$g,t),{path:{transform:this.rotationTransform}}}get viewBox(){return n(this,Ze).map(O.svgRound).join(" ")}get defaultProperties(){const[t,e]=n(this,Ze);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`}}}get rotationTransform(){const[,,t,e]=n(this,Ze);let s=0,a=0,r=0,o=0,l=0,h=0;switch(n(this,$g)){case 90:a=e/t,r=-t/e,l=t;break;case 180:s=-1,o=-1,l=t,h=e;break;case 270:a=-e/t,r=t/e,h=e;break;default:return""}return`matrix(${s} ${a} ${r} ${o} ${O.svgRound(l)} ${O.svgRound(h)})`}getPathResizingSVGProperties([t,e,s,a]){const[r,o]=m(this,mi,yn).call(this),[l,h,c,d]=n(this,Ze);if(Math.abs(c-r)<=O.PRECISION||Math.abs(d-o)<=O.PRECISION){const b=t+s/2-(l+c/2),y=e+a/2-(h+d/2);return{path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:`${this.rotationTransform} translate(${b} ${y})`}}}const p=(s-2*r)/(c-2*r),g=(a-2*o)/(d-2*o),v=c/s,w=d/a;return{path:{"transform-origin":`${O.svgRound(l)} ${O.svgRound(h)}`,transform:`${this.rotationTransform} scale(${v} ${w}) translate(${O.svgRound(r)} ${O.svgRound(o)}) scale(${p} ${g}) translate(${O.svgRound(-r)} ${O.svgRound(-o)})`}}}getPathResizedSVGProperties([t,e,s,a]){const[r,o]=m(this,mi,yn).call(this),l=n(this,Ze),[h,c,d,p]=l;if(l[0]=t,l[1]=e,l[2]=s,l[3]=a,Math.abs(d-r)<=O.PRECISION||Math.abs(p-o)<=O.PRECISION){const y=t+s/2-(h+d/2),A=e+a/2-(c+p/2);for(const{line:_,points:E}of n(this,Ti))O._translate(_,y,A,_),O._translate(E,y,A,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const g=(s-2*r)/(d-2*r),v=(a-2*o)/(p-2*o),w=-g*(h+r)+t+r,b=-v*(c+o)+e+o;if(g!==1||v!==1||w!==0||b!==0)for(const{line:y,points:A}of n(this,Ti))O._rescale(y,w,b,g,v,y),O._rescale(A,w,b,g,v,A);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],s){const[a,r]=s,o=n(this,Ze),l=t-o[0],h=e-o[1];if(n(this,mn)===a&&n(this,vn)===r)for(const{line:c,points:d}of n(this,Ti))O._translate(c,l,h,c),O._translate(d,l,h,d);else{const c=n(this,mn)/a,d=n(this,vn)/r;u(this,mn,a),u(this,vn,r);for(const{line:p,points:g}of n(this,Ti))O._rescale(p,l,h,c,d,p),O._rescale(g,l,h,c,d,g);o[2]*=c,o[3]*=d}return o[0]=t,o[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${O.svgRound(t)} ${O.svgRound(e)}`}}}get defaultSVGProperties(){const t=n(this,Ze);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${O.svgRound(t[0])} ${O.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}Ze=new WeakMap,$g=new WeakMap,cm=new WeakMap,Ti=new WeakMap,mn=new WeakMap,vn=new WeakMap,nu=new WeakMap,au=new WeakMap,_h=new WeakMap,mi=new WeakSet,yn=function(i=n(this,_h)){const t=n(this,cm)+i/2*n(this,nu);return n(this,au)%180===0?[t/n(this,mn),t/n(this,vn)]:[t/n(this,vn),t/n(this,mn)]},u_=function(){const[i,t,e,s]=n(this,Ze),[a,r]=m(this,mi,yn).call(this,0);return[i+a,t+r,e-2*a,s-2*r]},p_=function(){const i=u(this,Ze,oo.slice());for(const{line:s}of n(this,Ti)){if(s.length<=12){for(let o=4,l=s.length;o<l;o+=6)R.pointBoundingBox(s[o],s[o+1],i);continue}let a=s[4],r=s[5];for(let o=6,l=s.length;o<l;o+=6){const[h,c,d,p,g,v]=s.subarray(o,o+6);R.bezierBoundingBox(a,r,h,c,d,p,g,v,i),a=g,r=v}}
55const[t,e]=m(this,mi,yn).call(this);i[0]=xt(i[0]-t,0,1),i[1]=xt(i[1]-e,0,1),i[2]=xt(i[2]+t,0,1),i[3]=xt(i[3]+e,0,1),i[2]-=i[0],i[3]-=i[1]},g_=function(i){const[t,e]=m(this,mi,yn).call(this);u(this,_h,i);const[s,a]=m(this,mi,yn).call(this),[r,o]=[s-t,a-e],l=n(this,Ze);return l[0]-=r,l[1]-=o,l[2]+=2*r,l[3]+=2*o,l};class Nm extends c_{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:kt._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 Nm(this._viewParameters);return t.updateAll(this),t}}var eb,f_;const Ug=class m_ extends d_{constructor(t){super({...t,name:"inkEditor"}),f(this,eb),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){kt.initialize(t,e),this._defaultDrawingOptions=new Nm(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return G(this,"typesMap",new Map([[K.INK_THICKNESS,"stroke-width"],[K.INK_COLOR,"stroke"],[K.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,s,a,r){return new Bk(t,e,s,a,r,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,s,a,r,o){return Tu.deserialize(t,e,s,a,r,o)}static async deserialize(t,e,s){let a=null;if(t instanceof Zb){const{data:{inkLists:o,rect:l,rotation:h,id:c,color:d,opacity:p,borderStyle:{rawWidth:g},popupRef:v,richText:w,contentsObj:b,creationDate:y,modificationDate:A},parent:{page:{pageNumber:_}}}=t;a=t={annotationType:V.INK,color:Array.from(d),thickness:g,opacity:p,paths:{points:o},boxes:null,pageIndex:_-1,rect:l.slice(0),rotation:h,annotationElementId:c,id:c,deleted:!1,popupRef:v,richText:w,comment:(b==null?void 0:b.str)||null,creationDate:y,modificationDate:A}}const r=await super.deserialize(t,e,s);return r._initialData=a,t.comment&&r.setCommentData(t),r}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new C1(this)),[["colorPicker",this._colorPicker]]}get colorType(){return K.INK_COLOR}get colorAndOpacityType(){return K.INK_COLOR_AND_OPACITY}get opacityType(){return K.INK_OPACITY}updateParams(t,e){if(t===K.INK_COLOR_AND_OPACITY){this._updateColorAndOpacity(e.color,e.opacity);return}super.updateParams(t,e)}static updateDefaultParams(t,e){if(t===K.INK_COLOR_AND_OPACITY){super.updateDefaultParams(K.INK_COLOR,e.color),super.updateDefaultParams(K.INK_OPACITY,e.opacity);return}super.updateDefaultParams(t,e)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:t,_drawingOptions:e,parent:s}=this;e.updateSVGProperty("stroke-width"),s.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){const t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:e,opacity:s}){this._drawingOptions=m_.getDefaultDrawingOptions({stroke:R.makeHexColor(...t),"stroke-width":e,"stroke-opacity":s})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:e,points:s}=this.serializeDraw(t),{_drawingOptions:{stroke:a,"stroke-opacity":r,"stroke-width":o}}=this,l=Object.assign(super.serialize(t),{color:kt._colorManager.convert(a),opacity:r,thickness:o,paths:{lines:e,points:s}});return this.addComment(l),t?(l.isCopy=!0,l):this.annotationElementId&&!m(this,eb,f_).call(this,l)?null:(l.id=this.annotationElementId,l)}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;const{points:e,rect:s}=this.serializeDraw(!1);return t.updateEdited({rect:s,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}};eb=new WeakSet,f_=function(i){const{color:t,thickness:e,opacity:s,pageIndex:a}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||i.color.some((r,o)=>r!==t[o])||i.thickness!==e||i.opacity!==s||i.pageIndex!==a},S(Ug,"_type","ink"),S(Ug,"_editorType",V.INK),S(Ug,"_defaultDrawingOptions",null);let jk=Ug;class ib extends Tu{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}const Ap=8,cc=3;var dc,Go,ee,gv,ps,vy,wy,fv,_p,by,yy,Ay,mv,vv,_y;let Il=(dc=class{static extractContoursFromText(i,{fontFamily:t,fontStyle:e,fontWeight:s},a,r,o,l){let h=new OffscreenCanvas(1,1),c=h.getContext("2d",{alpha:!1});const d=200,p=c.font=`${e} ${s} ${d}px ${t}`,{actualBoundingBoxLeft:g,actualBoundingBoxRight:v,actualBoundingBoxAscent:w,actualBoundingBoxDescent:b,fontBoundingBoxAscent:y,fontBoundingBoxDescent:A,width:_}=c.measureText(i),E=1.5,x=Math.ceil(Math.max(Math.abs(g)+Math.abs(v)||0,_)*E),k=Math.ceil(Math.max(Math.abs(w)+Math.abs(b)||d,Math.abs(y)+Math.abs(A)||d)*E);h=new OffscreenCanvas(x,k),c=h.getContext("2d",{alpha:!0,willReadFrequently:!0}),c.font=p,c.filter="grayscale(1)",c.fillStyle="white",c.fillRect(0,0,x,k),c.fillStyle="black",c.fillText(i,x*(E-1)/2,k*(3-E)/2);const C=m(this,ee,mv).call(this,c.getImageData(0,0,x,k).data),I=m(this,ee,Ay).call(this,C),P=m(this,ee,vv).call(this,I),M=m(this,ee,fv).call(this,C,x,k,P);return this.processDrawnLines({lines:{curves:M,width:x,height:k},pageWidth:a,pageHeight:r,rotation:o,innerMargin:l,mustSmooth:!0,areContours:!0})}static process(i,t,e,s,a){const[r,o,l]=m(this,ee,_y).call(this,i),[h,c]=m(this,ee,yy).call(this,r,o,l,Math.hypot(o,l)*n(this,Go).sigmaSFactor,n(this,Go).sigmaR,n(this,Go).kernelSize),d=m(this,ee,vv).call(this,c),p=m(this,ee,fv).call(this,h,o,l,d);return this.processDrawnLines({lines:{curves:p,width:o,height:l},pageWidth:t,pageHeight:e,rotation:s,innerMargin:a,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:i,pageWidth:t,pageHeight:e,rotation:s,innerMargin:a,mustSmooth:r,areContours:o}){s%180!==0&&([t,e]=[e,t]);const{curves:l,width:h,height:c}=i,d=i.thickness??0,p=[],g=Math.min(t/h,e/c),v=g/t,w=g/e,b=[];for(const{points:A}of l){const _=r?m(this,ee,by).call(this,A):A;if(!_)continue;b.push(_);const E=_.length,x=new Float32Array(E),k=new Float32Array(3*(E===2?2:E-2));if(p.push({line:k,points:x}),E===2){x[0]=_[0]*v,x[1]=_[1]*w,k.set([NaN,NaN,NaN,NaN,x[0],x[1]],0);continue}let[C,I,P,M]=_;C*=v,I*=w,P*=v,M*=w,x.set([C,I,P,M],0),k.set([NaN,NaN,NaN,NaN,C,I],0);for(let D=4;D<E;D+=2){const L=x[D]=_[D]*v,W=x[D+1]=_[D+1]*w;k.set(O.createBezierPoints(C,I,P,M,L,W),(D-2)*3),[C,I,P,M]=[P,M,L,W]}}if(p.length===0)return null;const y=o?new ib:new Tu;return y.build(p,t,e,1,s,o?0:d,a),{outline:y,newCurves:b,areContours:o,thickness:d,width:h,height:c}}static async compressSignature({outlines:i,areContours:t,thickness:e,width:s,height:a}){let r=1/0,o=-1/0,l=0;for(const y of i){l+=y.length;for(let A=2,_=y.length;A<_;A++){const E=y[A]-y[A-2];r=Math.min(r,E),o=Math.max(o,E)}}let h;r>=-128&&o<=127?h=Int8Array:r>=-32768&&o<=32767?h=Int16Array:h=Int32Array;const c=i.length,d=Ap+cc*c,p=new Uint32Array(d);let g=0;p[g++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*c)*h.BYTES_PER_ELEMENT,p[g++]=0,p[g++]=s,p[g++]=a,p[g++]=t?0:1,p[g++]=Math.max(0,Math.floor(e??0)),p[g++]=c,p[g++]=h.BYTES_PER_ELEMENT;for(const y of i)p[g++]=y.length-2,p[g++]=y[0],p[g++]=y[1];const v=new CompressionStream("deflate-raw"),w=v.writable.getWriter();await w.ready,w.write(p);const b=h.prototype.constructor;for(const y of i){const A=new b(y.length-2);for(let _=2,E=y.length;_<E;_++)A[_-2]=y[_]-y[_-2];w.write(A)}return w.close(),(await new Response(v.readable).bytes()).toBase64()}static async decompressSignature(i){try{const t=Uint8Array.fromBase64(i),{readable:e,writable:s}=new DecompressionStream("deflate-raw"),a=s.getWriter();await a.ready,a.write(t).then(async()=>{await a.ready,await a.close()}).catch(()=>{});let r=null,o=0;for await(const _ of e)r||(r=new Uint8Array(new Uint32Array(_.buffer,0,4)[0])),r.set(_,o),o+=_.length;const l=new Uint32Array(r.buffer,0,r.length>>2),h=l[1];if(h!==0)throw new Error(`Invalid version: ${h}`);const c=l[2],d=l[3],p=l[4]===0,g=l[5],v=l[6],w=l[7],b=[],y=(Ap+cc*v)*Uint32Array.BYTES_PER_ELEMENT;let A;switch(w){case Int8Array.BYTES_PER_ELEMENT:A=new Int8Array(r.buffer,y);break;case Int16Array.BYTES_PER_ELEMENT:A=new Int16Array(r.buffer,y);break;case Int32Array.BYTES_PER_ELEMENT:A=new Int32Array(r.buffer,y);break}o=0;for(let _=0;_<v;_++){const E=l[cc*_+Ap],x=new Float32Array(E+2);b.push(x);for(let k=0;k<cc-1;k++)x[k]=l[cc*_+Ap+k+1];for(let k=0;k<E;k++)x[k+2]=x[k]+A[o++]}return{areContours:p,thickness:g,outlines:b,width:c,height:d}}catch(t){return Y(`decompressSignature: ${t}`),null}}},Go=new WeakMap,ee=new WeakSet,gv=function(i,t,e,s){return e-=i,s-=t,e===0?s>0?0:4:e===1?s+6:2-s},ps=new WeakMap,vy=function(i,t,e,s,a,r,o){const l=m(this,ee,gv).call(this,e,s,a,r);for(let h=0;h<8;
55h++){const c=(-h+l-o+16)%8,d=n(this,ps)[2*c],p=n(this,ps)[2*c+1];if(i[(e+d)*t+(s+p)]!==0)return c}return-1},wy=function(i,t,e,s,a,r,o){const l=m(this,ee,gv).call(this,e,s,a,r);for(let h=0;h<8;h++){const c=(h+l+o+16)%8,d=n(this,ps)[2*c],p=n(this,ps)[2*c+1];if(i[(e+d)*t+(s+p)]!==0)return c}return-1},fv=function(i,t,e,s){const a=i.length,r=new Int32Array(a);for(let c=0;c<a;c++)r[c]=i[c]<=s?1:0;for(let c=1;c<e-1;c++)r[c*t]=r[c*t+t-1]=0;for(let c=0;c<t;c++)r[c]=r[t*e-1-c]=0;let o=1,l;const h=[];for(let c=1;c<e-1;c++){l=1;for(let d=1;d<t-1;d++){const p=c*t+d,g=r[p];if(g===0)continue;let v=c,w=d;if(g===1&&r[p-1]===0)o+=1,w-=1;else if(g>=1&&r[p+1]===0)o+=1,w+=1,g>1&&(l=g);else{g!==1&&(l=Math.abs(g));continue}const b=[d,c],y=w===d+1,A={isHole:y,points:b,id:o,parent:0};h.push(A);let _;for(const D of h)if(D.id===l){_=D;break}_?_.isHole?A.parent=y?_.parent:l:A.parent=y?l:_.parent:A.parent=y?l:0;const E=m(this,ee,vy).call(this,r,t,c,d,v,w,0);if(E===-1){r[p]=-o,r[p]!==1&&(l=Math.abs(r[p]));continue}let x=n(this,ps)[2*E],k=n(this,ps)[2*E+1];const C=c+x,I=d+k;v=C,w=I;let P=c,M=d;for(;;){const D=m(this,ee,wy).call(this,r,t,P,M,v,w,1);x=n(this,ps)[2*D],k=n(this,ps)[2*D+1];const L=P+x,W=M+k;b.push(W,L);const $=P*t+M;if(r[$+1]===0?r[$]=-o:r[$]===1&&(r[$]=o),L===c&&W===d&&P===C&&M===I){r[p]!==1&&(l=Math.abs(r[p]));break}else v=P,w=M,P=L,M=W}}}return h},_p=function(i,t,e,s){if(e-t<=4){for(let C=t;C<e-2;C+=2)s.push(i[C],i[C+1]);return}const a=i[t],r=i[t+1],o=i[e-4]-a,l=i[e-3]-r,h=Math.hypot(o,l),c=o/h,d=l/h,p=c*r-d*a,g=l/o,v=1/h,w=Math.atan(g),b=Math.cos(w),y=Math.sin(w),A=v*(Math.abs(b)+Math.abs(y)),_=v*(1-A+A**2),E=Math.max(Math.atan(Math.abs(y+b)*_),Math.atan(Math.abs(y-b)*_));let x=0,k=t;for(let C=t+2;C<e-2;C+=2){const I=Math.abs(p-c*i[C+1]+d*i[C]);I>x&&(k=C,x=I)}x>(h*E)**2?(m(this,ee,_p).call(this,i,t,k+2,s),m(this,ee,_p).call(this,i,k,e,s)):s.push(a,r)},by=function(i){const t=[],e=i.length;return m(this,ee,_p).call(this,i,0,e,t),t.push(i[e-2],i[e-1]),t.length<=4?null:t},yy=function(i,t,e,s,a,r){const o=new Float32Array(r**2),l=-2*s**2,h=r>>1;for(let w=0;w<r;w++){const b=(w-h)**2;for(let y=0;y<r;y++)o[w*r+y]=Math.exp((b+(y-h)**2)/l)}const c=new Float32Array(256),d=-2*a**2;for(let w=0;w<256;w++)c[w]=Math.exp(w**2/d);const p=i.length,g=new Uint8Array(p),v=new Uint32Array(256);for(let w=0;w<e;w++)for(let b=0;b<t;b++){const y=w*t+b,A=i[y];let _=0,E=0;for(let k=0;k<r;k++){const C=w+k-h;if(!(C<0||C>=e))for(let I=0;I<r;I++){const P=b+I-h;if(P<0||P>=t)continue;const M=i[C*t+P],D=o[k*r+I]*c[Math.abs(M-A)];_+=M*D,E+=D}}const x=g[y]=Math.round(_/E);v[x]++}return[g,v]},Ay=function(i){const t=new Uint32Array(256);for(const e of i)t[e]++;return t},mv=function(i){const t=i.length,e=new Uint8ClampedArray(t>>2);let s=-1/0,a=1/0;for(let o=0,l=e.length;o<l;o++){const h=e[o]=i[o<<2];s=Math.max(s,h),a=Math.min(a,h)}const r=255/(s-a);for(let o=0,l=e.length;o<l;o++)e[o]=(e[o]-a)*r;return e},vv=function(i){let t,e=-1/0,s=-1/0;const a=i.findIndex(l=>l!==0);let r=a,o=a;for(t=a;t<256;t++){const l=i[t];l>e&&(t-r>s&&(s=t-r,o=t-1),e=l,r=t)}for(t=o-1;t>=0&&!(i[t]>i[t+1]);t--);return t},_y=function(i){const t=i,{width:e,height:s}=i,{maxDim:a}=n(this,Go);let r=e,o=s;if(e>a||s>a){let c=e,d=s,p=Math.log2(Math.max(e,s)/a);const g=Math.floor(p);p=p===g?g-1:g;for(let w=0;w<p;w++){r=Math.ceil(c/2),o=Math.ceil(d/2);const b=new OffscreenCanvas(r,o);b.getContext("2d").drawImage(i,0,0,c,d,0,0,r,o),c=r,d=o,i!==t&&i.close(),i=b.transferToImageBitmap()}const v=Math.min(a/r,a/o);r=Math.round(r*v),o=Math.round(o*v)}const l=new OffscreenCanvas(r,o).getContext("2d",{willReadFrequently:!0});l.fillStyle="white",l.fillRect(0,0,r,o),l.filter="grayscale(1)",l.drawImage(i,0,0,i.width,i.height,0,0,r,o);const h=l.getImageData(0,0,r,o).data;return[m(this,ee,mv).call(this,h),r,o]},f(dc,ee),f(dc,Go,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),f(dc,ps,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1])),dc);class t0 extends c_{constructor(){super(),super.updateProperties({fill:kt._defaultLineColor,"stroke-width":0})}clone(){const t=new t0;return t.updateAll(this),t}}class e0 extends Nm{constructor(t){super(t),super.updateProperties({stroke:kt._defaultLineColor,"stroke-width":1})}clone(){const t=new e0(this._viewParameters);return t.updateAll(this),t}}var Fr,Js,Or,Dl;const Hg=class Zs extends d_{constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),f(this,Fr,!1),f(this,Js,null),f(this,Or,null),f(this,Dl,null),this._willKeepAspectRatio=!0,u(this,Or,t.signatureData||null),u(this,Js,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){kt.initialize(t,e),this._defaultDrawingOptions=new t0,this._defaultDrawnSignatureOptions=new e0(e.viewParameters)}static getDefaultDrawingOptions(t){const e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return G(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!n(this,Js)}}static computeTelemetryFinalData(t){const e=t.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}
55render(){if(this.div)return this.div;let t,e;const{_isCopy:s}=this;if(s&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),this._drawId===null)if(n(this,Or)){const{lines:a,mustSmooth:r,areContours:o,description:l,uuid:h,heightInPage:c}=n(this,Or),{rawDims:{pageWidth:d,pageHeight:p},rotation:g}=this.parent.viewport,v=Il.processDrawnLines({lines:a,pageWidth:d,pageHeight:p,rotation:g,innerMargin:Zs._INNER_MARGIN,mustSmooth:r,areContours:o});this.addSignature(v,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,Js)||""}));return s&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){u(this,Dl,t),this.addEditToolbar()}getUuid(){return n(this,Dl)}get description(){return n(this,Js)}set description(t){u(this,Js,t),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{e==null||e.updateEditSignatureButton(t)}))}getSignaturePreview(){const{newCurves:t,areContours:e,thickness:s,width:a,height:r}=n(this,Or),o=Math.max(a,r),l=Il.processDrawnLines({lines:{curves:t.map(h=>({points:h})),thickness:s,width:a,height:r},pageWidth:o,pageHeight:o,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:l.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,s,a){const{x:r,y:o}=this,{outline:l}=u(this,Or,t);u(this,Fr,l instanceof ib),this.description=s;let h;n(this,Fr)?h=Zs.getDefaultDrawingOptions():(h=Zs._defaultDrawnSignatureOptions.clone(),h.updateProperties({"stroke-width":l.thickness})),this._addOutlines({drawOutlines:l,drawingOptions:h});const[,c]=this.pageDimensions;let d=e/c;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=r,this.y=o,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(a),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!a,hasDescription:!!s}}),this.div.hidden=!1}getFromImage(t){const{rawDims:{pageWidth:e,pageHeight:s},rotation:a}=this.parent.viewport;return Il.process(t,e,s,a,Zs._INNER_MARGIN)}getFromText(t,e){const{rawDims:{pageWidth:s,pageHeight:a},rotation:r}=this.parent.viewport;return Il.extractContoursFromText(t,e,s,a,r,Zs._INNER_MARGIN)}getDrawnSignature(t){const{rawDims:{pageWidth:e,pageHeight:s},rotation:a}=this.parent.viewport;return Il.processDrawnLines({lines:t,pageWidth:e,pageHeight:s,rotation:a,innerMargin:Zs._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=Zs.getDefaultDrawingOptions():(this._drawingOptions=Zs._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;const{lines:e,points:s}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":a}}=this,r=Object.assign(super.serialize(t),{isSignature:!0,areContours:n(this,Fr),color:[0,0,0],thickness:n(this,Fr)?0:a});return this.addComment(r),t?(r.paths={lines:e,points:s},r.uuid=n(this,Dl),r.isCopy=!0):r.lines=e,n(this,Js)&&(r.accessibilityData={type:"Figure",alt:n(this,Js)}),r}static deserializeDraw(t,e,s,a,r,o){return o.areContours?ib.deserialize(t,e,s,a,r,o):Tu.deserialize(t,e,s,a,r,o)}static async deserialize(t,e,s){var a;const r=await super.deserialize(t,e,s);return u(r,Fr,t.areContours),r.description=((a=t.accessibilityData)==null?void 0:a.alt)||"",u(r,Dl,t.uuid),r}};Fr=new WeakMap,Js=new WeakMap,Or=new WeakMap,Dl=new WeakMap,S(Hg,"_type","signature"),S(Hg,"_editorType",V.SIGNATURE),S(Hg,"_defaultDrawingOptions",null);let $k=Hg;var Ct,be,no,La,go,bd,Ra,Ll,tn,Wi,ru,bt,uc,pc,Vg,dm,um,sb,zg,v_;class nb extends kt{constructor(t){super({...t,name:"stampEditor"}),f(this,bt),f(this,Ct,null),f(this,be,null),f(this,no,null),f(this,La,null),f(this,go,null),f(this,bd,""),f(this,Ra,null),f(this,Ll,!1),f(this,tn,null),f(this,Wi,!1),f(this,ru,!1),u(this,La,t.bitmapUrl),u(this,go,t.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){kt.initialize(t,e)}static isHandlingMimeForPasting(t){return Kb.includes(t)}static paste(t,e){e.pasteEditor({mode:V.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!((t=this.altTextData)!=null&&t.altText)}}static computeTelemetryFinalData(t){const e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}async mlGuessAltText(t=null,e=!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:a,width:r,height:o}=t||this.copyCanvas(null,null,!0).imageData,l=await s.guess({name:"altText",request:{data:a,width:r,height:o,channels:a.length/(r*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),e&&!this.hasAltTextData()&&(this.altTextData={alt:h,decorative:!1}),h}remove(){var t;n(this,be)&&(u(this,Ct,null),this._uiManager.imageManager.deleteId(n(this,be)),(t=n(this,Ra))==null||t.remove(),u(this,Ra,null),n(this,tn)&&(clearTimeout(n(this,tn)),u(this,tn,null))),super.remove()}rebuild(){if(!this.parent){n(this,be)&&m(this,bt,Vg).call(this);return}super.rebuild(),this.div!==null&&(n(this,be)&&n(this,Ra)===null&&m(this,bt,Vg).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(n(this,no)||n(this,Ct)||n(this,La)||n(this,go)||n(this,be)||n(this,Ll))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}
55render(){if(this.div)return this.div;let t,e;return this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),n(this,Ll)||(n(this,Ct)?m(this,bt,dm).call(this):m(this,bt,Vg).call(this)),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this),this.div}setCanvas(t,e){const{id:s,bitmap:a}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),s&&this._uiManager.imageManager.isValidId(s)&&(u(this,be,s),a&&u(this,Ct,a),u(this,Ll,!1),m(this,bt,dm).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(n(this,tn)!==null&&clearTimeout(n(this,tn)),u(this,tn,setTimeout(()=>{u(this,tn,null),m(this,bt,sb).call(this)},200)))}copyCanvas(t,e,s=!1){t||(t=224);const{width:a,height:r}=n(this,Ct),o=new yo;let l=n(this,Ct),h=a,c=r,d=null;if(e){if(a>e||r>e){const C=Math.min(e/a,e/r);h=Math.floor(a*C),c=Math.floor(r*C)}d=document.createElement("canvas");const g=d.width=Math.ceil(h*o.sx),v=d.height=Math.ceil(c*o.sy);n(this,Wi)||(l=m(this,bt,um).call(this,g,v));const w=d.getContext("2d");w.filter=this._uiManager.hcmFilter;let b="white",y="#cfcfd8";this._uiManager.hcmFilter!=="none"?y="black":jE.isDarkMode&&(b="#8f8f9d",y="#42414d");const A=15,_=A*o.sx,E=A*o.sy,x=new OffscreenCanvas(_*2,E*2),k=x.getContext("2d");k.fillStyle=b,k.fillRect(0,0,_*2,E*2),k.fillStyle=y,k.fillRect(0,0,_,E),k.fillRect(_,E,_,E),w.fillStyle=w.createPattern(x,"repeat"),w.fillRect(0,0,g,v),w.drawImage(l,0,0,l.width,l.height,0,0,g,v)}let p=null;if(s){let g,v;if(o.symmetric&&l.width<t&&l.height<t)g=l.width,v=l.height;else if(l=n(this,Ct),a>t||r>t){const b=Math.min(t/a,t/r);g=Math.floor(a*b),v=Math.floor(r*b),n(this,Wi)||(l=m(this,bt,um).call(this,g,v))}const w=new OffscreenCanvas(g,v).getContext("2d",{willReadFrequently:!0});w.drawImage(l,0,0,l.width,l.height,0,0,g,v),p={width:g,height:v,data:w.getImageData(0,0,g,v).data}}return{canvas:d,width:h,height:c,imageData:p}}static async deserialize(t,e,s){var a;let r=null,o=!1;if(t instanceof W1){const{data:{rect:y,rotation:A,id:_,structParent:E,popupRef:x,richText:k,contentsObj:C,creationDate:I,modificationDate:P},container:M,parent:{page:{pageNumber:D}},canvas:L}=t;let W,$;L?(delete t.canvas,{id:W,bitmap:$}=s.imageManager.getFromCanvas(M.id,L),L.remove()):(o=!0,t._hasNoCanvas=!0);const j=((a=await e._structTree.getAriaAttributes(`${Gl}${_}`))==null?void 0:a.get("aria-label"))||"";r=t={annotationType:V.STAMP,bitmapId:W,bitmap:$,pageIndex:D-1,rect:y.slice(0),rotation:A,annotationElementId:_,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:j},isSvg:!1,structParent:E,popupRef:x,richText:k,comment:(C==null?void 0:C.str)||null,creationDate:I,modificationDate:P}}const l=await super.deserialize(t,e,s),{rect:h,bitmap:c,bitmapUrl:d,bitmapId:p,isSvg:g,accessibilityData:v}=t;o?(s.addMissingCanvas(t.id,l),u(l,Ll,!0)):p&&s.imageManager.isValidId(p)?(u(l,be,p),c&&u(l,Ct,c)):u(l,La,d),u(l,Wi,g);const[w,b]=l.pageDimensions;return l.width=(h[2]-h[0])/w,l.height=(h[3]-h[1])/b,v&&(l.altTextData=v),l._initialData=r,t.comment&&l.setCommentData(t),u(l,ru,!!r),l}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=Object.assign(super.serialize(t),{bitmapId:n(this,be),isSvg:n(this,Wi)});if(this.addComment(s),t)return s.bitmapUrl=m(this,bt,zg).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s.isCopy=!0,s;const{decorative:a,altText:r}=this.serializeAltText(!1);if(!a&&r&&(s.accessibilityData={type:"Figure",alt:r}),this.annotationElementId){const l=m(this,bt,v_).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(e===null)return s;e.stamps||(e.stamps=new Map);const o=n(this,Wi)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!e.stamps.has(n(this,be)))e.stamps.set(n(this,be),{area:o,serialized:s}),s.bitmap=m(this,bt,zg).call(this,!1);else if(n(this,Wi)){const l=e.stamps.get(n(this,be));o>l.area&&(l.area=o,l.serialized.bitmap.close(),l.serialized.bitmap=m(this,bt,zg).call(this,!1))}return s}renderAnnotationElement(t){return this.deleted?(t.hide(),null):(t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}}Ct=new WeakMap,be=new WeakMap,no=new WeakMap,La=new WeakMap,go=new WeakMap,bd=new WeakMap,Ra=new WeakMap,Ll=new WeakMap,tn=new WeakMap,Wi=new WeakMap,ru=new WeakMap,bt=new WeakSet,uc=function(i,t=!1){if(!i){this.remove();return}u(this,Ct,i.bitmap),t||(u(this,be,i.id),u(this,Wi,i.isSvg)),i.file&&u(this,bd,i.file.name),m(this,bt,dm).call(this)},pc=function(){if(u(this,no,null),this._uiManager.enableWaiting(!1),!!n(this,Ra)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&n(this,Ct)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&n(this,Ct)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},Vg=function(){if(n(this,be)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(n(this,be)).then(e=>m(this,bt,uc).call(this,e,!0)).finally(()=>m(this,bt,pc).call(this));return}if(n(this,La)){const e=n(this,La);u(this,La,null),this._uiManager.enableWaiting(!0),u(this,no,this._uiManager.imageManager.getFromUrl(e).then(s=>m(this,bt,uc).call(this,s)).finally(()=>m(this,bt,pc).call(this)));return}if(n(this,go)){const e=n(this,go);u(this,go,null),this._uiManager.enableWaiting(!0),u(this,no,this._uiManager.imageManager.getFromFile(e).then(s=>m(this,bt,uc).call(this,s)).finally(()=>m(this,bt,pc).call(this)));return}const i=document.createElement("input");i.type="file",i.accept=Kb.join(",");const t=this._uiManager._signal;u(this,no,new Promise(e=>{i.addEventListener("change",async()=>
55{if(!i.files||i.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const s=await this._uiManager.imageManager.getFromFile(i.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),m(this,bt,uc).call(this,s)}e()},{signal:t}),i.addEventListener("cancel",()=>{this.remove(),e()},{signal:t})}).finally(()=>m(this,bt,pc).call(this))),i.click()},dm=function(){var i;const{div:t}=this;let{width:e,height:s}=n(this,Ct);const[a,r]=this.pageDimensions,o=.75;if(this.width)e=this.width*a,s=this.height*r;else if(e>o*a||s>o*r){const h=Math.min(o*a/e,o*r/s);e*=h,s*=h}this._uiManager.enableWaiting(!1);const l=u(this,Ra,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this.width=e/a,this.height=s/r,this.setDims(),(i=this._initialOptions)!=null&&i.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),m(this,bt,sb).call(this),n(this,ru)||(this.parent.addUndoableEditor(this),u(this,ru,!0)),this._reportTelemetry({action:"inserted_image"}),n(this,bd)&&this.div.setAttribute("aria-description",n(this,bd)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},um=function(i,t){const{width:e,height:s}=n(this,Ct);let a=e,r=s,o=n(this,Ct);for(;a>2*i||r>2*t;){const l=a,h=r;a>2*i&&(a=Math.ceil(a/2)),r>2*t&&(r=Math.ceil(r/2));const c=new OffscreenCanvas(a,r);c.getContext("2d").drawImage(o,0,0,l,h,0,0,a,r),o=c.transferToImageBitmap()}return o},sb=function(){const[i,t]=this.parentDimensions,{width:e,height:s}=this,a=new yo,r=Math.ceil(e*i*a.sx),o=Math.ceil(s*t*a.sy),l=n(this,Ra);if(!l||l.width===r&&l.height===o)return;l.width=r,l.height=o;const h=n(this,Wi)?n(this,Ct):m(this,bt,um).call(this,r,o),c=l.getContext("2d");c.filter=this._uiManager.hcmFilter,c.drawImage(h,0,0,h.width,h.height,0,0,r,o)},zg=function(i){if(i){if(n(this,Wi)){const e=this._uiManager.imageManager.getSvgUrl(n(this,be));if(e)return e}const t=document.createElement("canvas");return{width:t.width,height:t.height}=n(this,Ct),t.getContext("2d").drawImage(n(this,Ct),0,0),t.toDataURL()}if(n(this,Wi)){const[t,e]=this.pageDimensions,s=Math.round(this.width*t*wo.PDF_TO_CSS_UNITS),a=Math.round(this.height*e*wo.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(s,a);return r.getContext("2d").drawImage(n(this,Ct),0,0,n(this,Ct).width,n(this,Ct).height,0,0,s,a),r.transferToImageBitmap()}return structuredClone(n(this,Ct))},v_=function(i){var t;const{pageIndex:e,accessibilityData:{altText:s}}=this._initialData,a=i.pageIndex===e,r=(((t=i.accessibilityData)==null?void 0:t.alt)||"")===s;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&a&&r,isSameAltText:r}},S(nb,"_type","stamp"),S(nb,"_editorType",V.STAMP);var Xo,gc,nr,ar,On,ni,rr,fc,mc,gs,Wn,ue,Bn,or,vc,B,Vi,lr,Nt,wv,Ey,fs,bv,yv,Ep;let Uk=(Vi=class{constructor({uiManager:i,pageIndex:t,div:e,structTreeLayer:s,accessibilityManager:a,annotationLayer:r,drawLayer:o,textLayer:l,viewport:h,l10n:c}){f(this,Nt),f(this,Xo),f(this,gc,!1),f(this,nr,null),f(this,ar,null),f(this,On,null),f(this,ni,new Map),f(this,rr,!1),f(this,fc,!1),f(this,mc,!1),f(this,gs,null),f(this,Wn,null),f(this,ue,null),f(this,Bn,null),f(this,or,null),f(this,vc,-1),f(this,B);const d=[...n(Vi,lr).values()];if(!Vi._initialized){Vi._initialized=!0;for(const p of d)p.initialize(c,i)}i.registerEditorTypes(d),u(this,B,i),this.pageIndex=t,this.div=e,u(this,Xo,a),u(this,nr,r),this.viewport=h,u(this,ue,l),this.drawLayer=o,this._structTree=s,n(this,B).addLayer(this)}get isEmpty(){return n(this,ni).size===0}get isInvisible(){return this.isEmpty&&n(this,B).getMode()===V.NONE}updateToolbar(i){n(this,B).updateToolbar(i)}updateMode(i=n(this,B).getMode()){switch(m(this,Nt,Ep).call(this),i){case V.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case V.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case V.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:t}=this.div;if(t.toggle("nonEditing",!1),i===V.POPUP)t.toggle("commentEditing",!0);else{t.toggle("commentEditing",!1);for(const e of n(Vi,lr).values())t.toggle(`${e._type}Editing`,i===e._editorType)}this.div.hidden=!1}hasTextLayer(i){var t;return i===((t=n(this,ue))==null?void 0:t.div)}setEditingState(i){n(this,B).setEditingState(i)}addCommands(i){n(this,B).addCommands(i)}cleanUndoStack(i){n(this,B).cleanUndoStack(i)}toggleDrawing(i=!1){this.div.classList.toggle("drawing",!i)}togglePointerEvents(i=!1){this.div.classList.toggle("disabled",!i)}toggleAnnotationLayerPointerEvents(i=!1){var t;(t=n(this,nr))==null||t.togglePointerEvents(i)}async enable(){var i;u(this,mc,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),(i=n(this,or))==null||i.abort(),u(this,or,null);const t=new Set;for(const s of n(this,Nt,wv))s.enableEditing(),s.show(!0),s.annotationElementId&&(n(this,B).removeChangedExistingAnnotation(s),t.add(s.annotationElementId));const e=n(this,nr);if(e)for(const s of e.getEditableAnnotations()){if(s.hide(),n(this,B).isDeletedAnnotationElement(s.data.id)||t.has(s.data.id))continue;const a=await this.deserialize(s);a&&(this.addOrRebuild(a),a.enableEditing())}u(this,mc,!1),n(this,B)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){var i;if(u(this,fc,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),n(this,ue)&&!n(this,or)){u(this,or,new AbortController);const a=n(this,B).combinedSignal(n(this,or));n(this,ue).div.addEventListener("pointerdown",r=>{const{clientX:o,clientY:l,timeStamp:h}=r,c=n(this,vc);if(h-c>500){u(this,vc,h);return}u(this,vc,-1);const{classList:d}=this.div;d.toggle("getElements",!0);const p=document.elementsFromPoint(o,l);if(d.toggle("getElements",!1),!this.div.contains(p[0]))return;let g;const v=new RegExp(`^${yu}[0-9]+$`);for(const b of p)if(v.test(b.id)){g=b.id;break}if(!g)return;const w=n(this,ni).get(g);(w==null?void 0:w.annotationElementId)===null&&(Pt(r),w.dblclick(r))},{signal:a,capture:!0})}const t=n(this,nr),e=[];
55if(t){const a=new Map,r=new Map;for(const o of n(this,Nt,wv)){if(o.disableEditing(),!o.annotationElementId){e.push(o);continue}if(o.serialize()!==null){a.set(o.annotationElementId,o);continue}else r.set(o.annotationElementId,o);(i=this.getEditableAnnotation(o.annotationElementId))==null||i.show(),o.remove()}for(const o of t.getEditableAnnotations()){const{id:l}=o.data;if(n(this,B).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let h=r.get(l);if(h){h.resetAnnotationElement(o),h.show(!1),o.show();continue}h=a.get(l),h&&(n(this,B).addChangedExistingAnnotation(h),h.renderAnnotationElement(o)&&h.show(!1)),o.show()}}m(this,Nt,Ep).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:s}=this.div;for(const a of n(Vi,lr).values())s.remove(`${a._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t==null||t.updateFakeAnnotations(e),u(this,fc,!1)}getEditableAnnotation(i){var t;return((t=n(this,nr))==null?void 0:t.getEditableAnnotation(i))||null}setActiveEditor(i){n(this,B).getActive()!==i&&n(this,B).setActiveEditor(i)}enableTextSelection(){var i;if(this.div.tabIndex=-1,(i=n(this,ue))!=null&&i.div&&!n(this,Bn)){u(this,Bn,new AbortController);const t=n(this,B).combinedSignal(n(this,Bn));n(this,ue).div.addEventListener("pointerdown",m(this,Nt,Ey).bind(this),{signal:t}),n(this,ue).div.classList.add("highlighting")}}disableTextSelection(){var i;this.div.tabIndex=0,(i=n(this,ue))!=null&&i.div&&n(this,Bn)&&(n(this,Bn).abort(),u(this,Bn,null),n(this,ue).div.classList.remove("highlighting"))}enableClick(){if(n(this,ar))return;u(this,ar,new AbortController);const i=n(this,B).combinedSignal(n(this,ar));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:i});const t=this.pointerup.bind(this);this.div.addEventListener("pointerup",t,{signal:i}),this.div.addEventListener("pointercancel",t,{signal:i})}disableClick(){var i;(i=n(this,ar))==null||i.abort(),u(this,ar,null)}attach(i){n(this,ni).set(i.id,i);const{annotationElementId:t}=i;t&&n(this,B).isDeletedAnnotationElement(t)&&n(this,B).removeDeletedAnnotationElement(i)}detach(i){var t;n(this,ni).delete(i.id),(t=n(this,Xo))==null||t.removePointerInTextLayer(i.contentDiv),!n(this,fc)&&i.annotationElementId&&n(this,B).addDeletedAnnotationElement(i)}remove(i){this.detach(i),n(this,B).removeEditor(i),i.div.remove(),i.isAttachedToDOM=!1}changeParent(i){var t;i.parent!==this&&(i.parent&&i.annotationElementId&&(n(this,B).addDeletedAnnotationElement(i),kt.deleteAnnotationElement(i),i.annotationElementId=null),this.attach(i),(t=i.parent)==null||t.detach(i),i.setParent(this),i.div&&i.isAttachedToDOM&&(i.div.remove(),this.div.append(i.div)))}add(i){if(!(i.parent===this&&i.isAttachedToDOM)){if(this.changeParent(i),n(this,B).addEditor(i),this.attach(i),!i.isAttachedToDOM){const t=i.render();this.div.append(t),i.isAttachedToDOM=!0}i.fixAndSetPosition(),i.onceAdded(!n(this,mc)),n(this,B).addToAnnotationStorage(i),i._reportTelemetry(i.telemetryInitialData)}}moveEditorInDOM(i){var t;if(!i.isAttachedToDOM)return;const{activeElement:e}=document;i.div.contains(e)&&!n(this,On)&&(i._focusEventsAllowed=!1,u(this,On,setTimeout(()=>{u(this,On,null),i.div.contains(document.activeElement)?i._focusEventsAllowed=!0:(i.div.addEventListener("focusin",()=>{i._focusEventsAllowed=!0},{once:!0,signal:n(this,B)._signal}),e.focus())},0))),i._structTreeParentId=(t=n(this,Xo))==null?void 0:t.moveElementInDOM(this.div,i.div,i.contentDiv,!0)}addOrRebuild(i){i.needsToBeRebuilt()?(i.parent||(i.parent=this),i.rebuild(),i.show()):this.add(i)}addUndoableEditor(i){const t=()=>i._uiManager.rebuild(i),e=()=>{i.remove()};this.addCommands({cmd:t,undo:e,mustExec:!1})}getEditorByUID(i){for(const t of n(this,ni).values())if(t.uid===i)return t;return null}combinedSignal(i){return n(this,B).combinedSignal(i)}canCreateNewEmptyEditor(){var i;return(i=n(this,Nt,fs))==null?void 0:i.canCreateNewEmptyEditor()}async pasteEditor(i,t){this.updateToolbar(i),await n(this,B).updateMode(i.mode);const{offsetX:e,offsetY:s}=m(this,Nt,yv).call(this),a=n(this,B).getId(),r=m(this,Nt,bv).call(this,{parent:this,id:a,x:e,y:s,uiManager:n(this,B),isCentered:!0,...t});r&&this.add(r)}async deserialize(i){var t;return await((t=n(Vi,lr).get(i.annotationType??i.annotationEditorType))==null?void 0:t.deserialize(i,this,n(this,B)))||null}createAndAddNewEditor(i,t,e={}){const s=n(this,B).getId(),a=m(this,Nt,bv).call(this,{parent:this,id:s,x:i.offsetX,y:i.offsetY,uiManager:n(this,B),isCentered:t,...e});return a&&this.add(a),a}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(i={}){this.createAndAddNewEditor(m(this,Nt,yv).call(this),!0,i)}setSelected(i){n(this,B).setSelected(i)}toggleSelected(i){n(this,B).toggleSelected(i)}unselect(i){n(this,B).unselect(i)}pointerup(i){var t;const{isMac:e}=Jt.platform;if(i.button!==0||i.ctrlKey&&e||i.target!==this.div||!n(this,rr)||(u(this,rr,!1),(t=n(this,Nt,fs))!=null&&t.isDrawer&&n(this,Nt,fs).supportMultipleDrawings))return;if(!n(this,gc)){u(this,gc,!0);return}const s=n(this,B).getMode();if(s===V.STAMP||s===V.POPUP||s===V.SIGNATURE){n(this,B).unselectAll();return}this.createAndAddNewEditor(i,!1)}pointerdown(i){var t;if(n(this,B).getMode()===V.HIGHLIGHT&&this.enableTextSelection(),n(this,rr)){u(this,rr,!1);return}const{isMac:e}=Jt.platform;if(i.button!==0||i.ctrlKey&&e||i.target!==this.div)return;if(u(this,rr,!0),(t=n(this,Nt,fs))!=null&&t.isDrawer){this.startDrawingSession(i);return}const s=n(this,B).getActive();u(this,gc,!s||s.isEmpty())}startDrawingSession(i){if(this.div.focus({preventScroll:!0}),n(this,gs)){n(this,Nt,fs).startDrawing(this,n(this,B),!1,i);return}n(this,B).setCurrentDrawingSession(this),u(this,gs,new AbortController);const t=n(this,B).combinedSignal(n(this,gs));this.div.addEventListener("blur",({relatedTarget:e})=>{e&&!this.div.contains(e)&&(u(this,Wn,null),this.commitOrRemove())},{signal:t}),n(this,Nt,fs).startDrawing(this,n(this,B),!1,i)}pause(i){if(i){const{activeElement:t}=document;this.div.contains(t)&&u(this,Wn,t);return}n(this,Wn)&&setTimeout(()=>{var t;(t=n(this,Wn))==null||t.focus(),u(this,Wn,null)},0)}endDrawingSession(i=!1){return n(this,gs)?(n(this,B).setCurrentDrawingSession(null),n(this,gs).abort(),u(this,gs,null),u(this,Wn,null),n(this,Nt,fs).endDrawing(i)):null}findNewParent(i,t,e){const s=n(this,B).findParent(t,e);return s===null||s===this?!1:(s.changeParent(i),!0)}commitOrRemove(){return n(this,gs)?(this.endDrawingSession(),!0):!1}onScaleChanging(){n(this,gs)&&n(this,Nt,fs).onScaleChangingWhenDrawing(this)}destroy(){var i,t;this.commitOrRemove(),((i=n(this,B).getActive())==null?void 0:i.parent)===this&&(n(this,B).commitOrRemove(),n(this,B).setActiveEditor(null)),n(this,On)&&(clearTimeout(n(this,On)),u(this,On,null));for(const e of n(this,ni).values())(t=n(this,Xo))==null||t.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,n(this,ni).clear(),n(this,B).removeLayer(this)}async render({viewport:i}){this.viewport=i,bo(this.div,i);for(const t of n(this,B).getEditors(this.pageIndex))this.add(t),t.rebuild();await n(this,B).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:i}){n(this,B).commitOrRemove(),m(this,Nt,Ep).call(this);const t=this.viewport.rotation,e=i.rotation;if(this.viewport=i,bo(this.div,{rotation:e}),t!==e)for(const s of n(this,ni).values())s.rotate(e)}get pageDimensions(){const{pageWidth:i,pageHeight:t}=this.viewport.rawDims;return[i,t]}get scale(){return n(this,B).viewParameters.realScale}},Xo=new WeakMap,gc=new WeakMap,nr=new WeakMap,ar=new WeakMap,On=new WeakMap,ni=new WeakMap,rr=new WeakMap,fc=new WeakMap,mc=new WeakMap,gs=new WeakMap,Wn=new WeakMap,ue=new WeakMap,Bn=new WeakMap,or=new WeakMap,vc=new WeakMap,B=new WeakMap,lr=new WeakMap,Nt=ne
55w WeakSet,wv=function(){return n(this,ni).size!==0?n(this,ni).values():n(this,B).getEditors(this.pageIndex)},Ey=function(i){n(this,B).unselectAll();const{target:t}=i;if(t===n(this,ue).div||(t.getAttribute("role")==="img"||t.classList.contains("endOfContent")||t.classList.contains("textLayerImagePlaceholder"))&&n(this,ue).div.contains(t)){const{isMac:e}=Jt.platform;if(i.button!==0||i.ctrlKey&&e)return;n(this,B).showAllEditors("highlight",!0,!0),n(this,ue).div.classList.add("free"),this.toggleDrawing(),fy.startHighlighting(this,n(this,B).direction==="ltr",{target:n(this,ue).div,x:i.x,y:i.y}),n(this,ue).div.addEventListener("pointerup",()=>{n(this,ue).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:n(this,B)._signal}),i.preventDefault()}},fs=function(){return n(Vi,lr).get(n(this,B).getMode())},bv=function(i){const t=n(this,Nt,fs);return t?new t.prototype.constructor(i):null},yv=function(){const{x:i,y:t,width:e,height:s}=this.boundingClientRect,a=Math.max(0,i),r=Math.max(0,t),o=Math.min(window.innerWidth,i+e),l=Math.min(window.innerHeight,t+s),h=(a+o)/2-i,c=(r+l)/2-t,[d,p]=this.viewport.rotation%180===0?[h,c]:[c,h];return{offsetX:d,offsetY:p}},Ep=function(){for(const i of n(this,ni).values())i.isEmpty()&&i.remove()},S(Vi,"_initialized",!1),f(Vi,lr,new Map([Fk,jk,nb,fy,$k].map(i=>[i._editorType,i]))),Vi);var ms,Ge,Yo,ie,xp,Av,xy,hr,_v,ky,Ev;let Hk=(ie=class{constructor(){f(this,hr),f(this,ms,null),f(this,Ge,new Map),f(this,Yo,new Map)}setParent(i){if(!n(this,ms)){u(this,ms,i);return}if(n(this,ms)!==i){if(n(this,Ge).size>0)for(const t of n(this,Ge).values())t.remove(),i.append(t);u(this,ms,i)}}static get _svgFactory(){return G(this,"_svgFactory",new qf)}draw(i,t=!1,e=!1){const s=jt(ie,xp)._++,a=m(this,hr,_v).call(this),r=ie._svgFactory.createElement("defs");a.append(r);const o=ie._svgFactory.createElement("path");r.append(o);const l=`path_${s}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke"),t&&n(this,Yo).set(s,o);const h=e?m(this,hr,ky).call(this,r,l):null,c=ie._svgFactory.createElement("use");return a.append(c),c.setAttribute("href",`#${l}`),this.updateProperties(a,i),n(this,Ge).set(s,a),{id:s,clipPathId:`url(#${h})`}}drawOutline(i,t){const e=jt(ie,xp)._++,s=m(this,hr,_v).call(this),a=ie._svgFactory.createElement("defs");s.append(a);const r=ie._svgFactory.createElement("path");a.append(r);const o=`path_${e}`;r.setAttribute("id",o),r.setAttribute("vector-effect","non-scaling-stroke");let l;if(t){const d=ie._svgFactory.createElement("mask");a.append(d),l=`mask_${e}`,d.setAttribute("id",l),d.setAttribute("maskUnits","objectBoundingBox");const p=ie._svgFactory.createElement("rect");d.append(p),p.setAttribute("width","1"),p.setAttribute("height","1"),p.setAttribute("fill","white");const g=ie._svgFactory.createElement("use");d.append(g),g.setAttribute("href",`#${o}`),g.setAttribute("stroke","none"),g.setAttribute("fill","black"),g.setAttribute("fill-rule","nonzero"),g.classList.add("mask")}const h=ie._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,i),n(this,Ge).set(e,s),e}finalizeDraw(i,t){n(this,Yo).delete(i),this.updateProperties(i,t)}updateProperties(i,t){var e;if(!t)return;const{root:s,bbox:a,rootClass:r,path:o}=t,l=typeof i=="number"?n(this,Ge).get(i):i;if(l){if(s&&m(this,hr,Ev).call(this,l,s),a&&m(e=ie,Av,xy).call(e,l,a),r){const{classList:h}=l;for(const[c,d]of Object.entries(r))h.toggle(c,d)}if(o){const h=l.firstElementChild.firstElementChild;m(this,hr,Ev).call(this,h,o)}}}updateParent(i,t){if(t===this)return;const e=n(this,Ge).get(i);e&&(n(t,ms).append(e),n(this,Ge).delete(i),n(t,Ge).set(i,e))}remove(i){n(this,Yo).delete(i),n(this,ms)!==null&&(n(this,Ge).get(i).remove(),n(this,Ge).delete(i))}destroy(){u(this,ms,null);for(const i of n(this,Ge).values())i.remove();n(this,Ge).clear(),n(this,Yo).clear()}},ms=new WeakMap,Ge=new WeakMap,Yo=new WeakMap,xp=new WeakMap,Av=new WeakSet,xy=function(i,[t,e,s,a]){const{style:r}=i;r.top=`${100*e}%`,r.left=`${100*t}%`,r.width=`${100*s}%`,r.height=`${100*a}%`},hr=new WeakSet,_v=function(){const i=ie._svgFactory.create(1,1,!0);return n(this,ms).append(i),i.setAttribute("aria-hidden",!0),i},ky=function(i,t){const e=ie._svgFactory.createElement("clipPath");i.append(e);const s=`clip_${t}`;e.setAttribute("id",s),e.setAttribute("clipPathUnits","objectBoundingBox");const a=ie._svgFactory.createElement("use");return e.append(a),a.setAttribute("href",`#${t}`),a.classList.add("clip"),s},Ev=function(i,t){for(const[e,s]of Object.entries(t))s===null?i.removeAttribute(e):i.setAttribute(e,s)},f(ie,Av),f(ie,xp,0),ie);function kp(i){return`${(i*100).toFixed(2)}%`}var wc,Sp,Mp,bc,$s,Us,yc,Cp,xv,Sy;let Vk=(yc=class{constructor(i,t,e,s){f(this,xv),f(this,wc,[]),f(this,Sp,new Map),f(this,Mp,null),f(this,bc,0),f(this,$s,0),f(this,Us,0),u(this,bc,i),u(this,wc,t),u(this,$s,e.rawDims.pageWidth),u(this,Us,e.rawDims.pageHeight),u(this,Mp,s)}render(){const i=document.createElement("div");i.className="textLayerImages";for(let t=0;t<n(this,wc).length;t+=6){const e=m(this,xv,Sy).call(this,n(this,wc).subarray(t,t+6));e&&i.append(e)}return i.addEventListener("contextmenu",t=>{var e;if(!(t.target instanceof HTMLCanvasElement))return;const s=t.target,a=n(this,Sp).get(s);if(!a)return;const r=(e=n(yc,Cp))==null?void 0:e.deref();if(r===s)return;r&&(r.width=0,r.height=0),u(yc,Cp,new WeakRef(s));const{inverseTransform:o,x1:l,y1:h,width:c,height:d}=a,p=n(this,Mp).call(this),g=Math.ceil(l*p.width),v=Math.ceil(h*p.height),w=Math.floor((l+c/n(this,$s))*p.width),b=Math.floor((h+d/n(this,Us))*p.height);s.width=w-g,s.height=b-v;const y=s.getContext("2d");y.setTransform(...o),y.translate(-g,-v),y.drawImage(p,0,0)}),i}},wc=new WeakMap,Sp=new WeakMap,Mp=new WeakMap,bc=new WeakMap,$s=new WeakMap,Us=new WeakMap,Cp=new WeakMap,xv=new WeakSet,Sy=function([i,t,e,s,a,r]){const o=Math.hypot((a-i)*n(this,$s),(r-t)*n(this,Us)),l=Math.hypot((e-i)*n(this,$s),(s-t)*n(this,Us));if(o<n(this,bc)||l<n(this,bc))return null;const h=[(a-i)*n(this,$s)/o,(r-t)*n(this,Us)/o,(e-i)*n(this,$s)/l,(s-t)*n(this,Us)/l,0,0],c=R.inverseTransform(h),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:kp(i),top:kp(t),width:kp(o/n(this,$s)),height:kp(l/n(this,Us)),transformOrigin:"0% 0%",transform:`matrix(${h.join(",")})`}),n(this,Sp).set(d,{inverseTransform:c,width:o,height:l,x1:i,y1:t}),d},f(yc,Cp,null),yc);globalThis._pdfjsTestingUtils={HighlightOutliner:Kw};globalThis.pdfjsLib={AbortException:Fa,AnnotationEditorLayer:Uk,AnnotationEditorParamsType:K,AnnotationEditorType:V,AnnotationEditorUIManager:_u,AnnotationLayer:Nk,AnnotationMode:fa,AnnotationType:Gt,applyOpacity:UE,build:pk,ColorPicker:S1,createValidAbsoluteUrl:vA,CSSConstants:$E,DOMSVGFactory:qf,DrawLayer:Hk,FeatureTest:Jt,fetchData:zb,findContrastColor:HE,getDocument:y1,getFilenameFromUrl:NE,getPdfFilenameFromUrl:FE,getRGB:Cu,getRGBA:Yb,getUuid:bA,getXfaPageViewport:WE,GlobalWorkerOptions:Ta,ImageKind:Fp,InvalidPDFException:zv,isDataScheme:Sm,isPdfFile:Xb,isValidExplicitDest:ux,makeArr:Hb,makeMap:Vb,makeObj:Gv,MathClamp:xt,noContextMenu:Bi,normalizeUnicode:LE,OPS:un,OutputScale:yo,PasswordResponses:kE,PDFDataRangeTransport:E1,PDFDateString:Xv,PDFWorker:Dw,PermissionFlag:xE,PixelsPerInch:wo,RenderingCancelledException:Gb,renderRichText:AA,ResponseException:$f,setLayerDimensions:bo,shadow:G,SignatureExtractor:Il,stopEvent:Pt,Supp
55ortedImageMimeTypes:Kb,TextLayer:Tw,TextLayerImages:Vk,TouchManager:IA,updateUrlHash:wA,Util:R,VerbosityLevel:_m,version:uk,XfaLayer:yA};const{AbortException:zk,AnnotationEditorLayer:Gk,AnnotationEditorParamsType:pC,AnnotationEditorType:ei,AnnotationEditorUIManager:Xk,AnnotationLayer:Yk,AnnotationMode:Rs,AnnotationType:w_,applyOpacity:gC,build:fC,ColorPicker:mC,createValidAbsoluteUrl:b_,CSSConstants:vC,DOMSVGFactory:wC,DrawLayer:Kk,FeatureTest:y_,fetchData:My,findContrastColor:bC,getDocument:yC,getFilenameFromUrl:AC,getPdfFilenameFromUrl:qk,getRGB:_C,getRGBA:EC,getUuid:xC,getXfaPageViewport:kC,GlobalWorkerOptions:SC,ImageKind:MC,InvalidPDFException:CC,isDataScheme:PC,isPdfFile:Qk,isValidExplicitDest:Jk,makeArr:Zk,makeMap:tS,makeObj:TC,MathClamp:eS,noContextMenu:IC,normalizeUnicode:iS,OPS:DC,OutputScale:Gg,PasswordResponses:LC,PDFDataRangeTransport:RC,PDFDateString:NC,PDFWorker:FC,PermissionFlag:Ko,PixelsPerInch:An,RenderingCancelledException:ab,renderRichText:OC,ResponseException:WC,setLayerDimensions:A_,shadow:xu,SignatureExtractor:BC,stopEvent:rb,SupportedImageMimeTypes:jC,TextLayer:sS,TextLayerImages:nS,TouchManager:$C,updateUrlHash:aS,Util:i0,VerbosityLevel:UC,version:Cy,XfaLayer:kv}=globalThis.pdfjsLib,zi={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function rS(i){return i<11904}function oS(i){return(i&65408)===0}function lS(i){return i>=97&&i<=122||i>=65&&i<=90}function hS(i){return i>=48&&i<=57}function cS(i){return i===32||i===9||i===13||i===10}function dS(i){return i>=13312&&i<=40959||i>=63744&&i<=64255}function uS(i){return i>=12448&&i<=12543}function pS(i){return i>=12352&&i<=12447}function gS(i){return i>=65376&&i<=65439}function fS(i){return(i&65408)===3584}function Pp(i){return rS(i)?oS(i)?cS(i)?zi.SPACE:lS(i)||hS(i)||i===95?zi.ALPHA_LETTER:zi.PUNCT:fS(i)?zi.THAI_LETTER:i===160?zi.SPACE:zi.ALPHA_LETTER:dS(i)?zi.HAN_LETTER:uS(i)?zi.KATAKA
55NA_LETTER:pS(i)?zi.HIRAGANA_LETTER:gS(i)?zi.HALFWIDTH_KATAKANA_LETTER:zi.ALPHA_LETTER}let cr;function mS(){if(!cr){const i=[],t=[],e=new RegExp("^\\p{M}$","u");for(let a=0;a<65536;a++){if(a>=55296&&a<=57343)continue;const r=String.fromCharCode(a);if(r.normalize("NFKC")!==r&&!e.test(r)){if(t.length!==2){t[0]=t[1]=a;continue}t[1]+1!==a?(t[0]===t[1]?i.push(String.fromCharCode(t[0])):i.push(`${String.fromCharCode(t[0])}-${String.fromCharCode(t[1])}`),t[0]=t[1]=a):t[1]=a}}const s=i.join("");if(!cr)cr=s;else if(s!==cr){for(let a=1;a<s.length;a++)if(s[a]!==cr[a]){console.log(`Difference at index ${a}: U+${s.charCodeAt(a).toString(16).toUpperCase().padStart(4,"0")}!== U+${cr.charCodeAt(a).toString(16).toUpperCase().padStart(4,"0")}`);break}throw new Error("getNormalizeWithNFKC - update the `NormalizeWithNFKC` string.")}}return cr}const vS="auto",__=1,Py=1.1,wS=.1,bS=25,Sv=0,yS=1.25,E_=40,x_=5,Eh={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},Ns={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},tt={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},Le={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function AS(i,t){let e=i.offsetParent;if(!e){console.error("offsetParent is not set -- cannot scroll");return}let s=i.offsetTop+i.clientTop,a=i.offsetLeft+i.clientLeft;for(;e.clientHeight===e.scrollHeight&&e.clientWidth===e.scrollWidth;)if(s+=e.offsetTop,a+=e.offsetLeft,e=e.offsetParent,!e)return;t&&(t.top!==void 0&&(s+=t.top),t.left!==void 0&&(a+=t.left,e.scrollLeft=a)),e.scrollTop=s}function _S(i,t,e=void 0){const s=function(o){r||(r=window.requestAnimationFrame(function(){r=null;const l=i.scrollLeft,h=a.lastX;l!==h&&(a.right=l>h),a.lastX=l;const c=i.scrollTop,d=a.lastY;c!==d&&(a.down=c>d),a.lastY=c,t(a)}))},a={right:!0,down:!0,lastX:i.scrollLeft,lastY:i.scrollTop,_eventHandler:s};let r=null;return i.addEventListener("scroll",s,{useCapture:!0,signal:e}),e==null||e.addEventListener("abort",()=>window.cancelAnimationFrame(r),{once:!0}),a}function Fm(i){const t=new Map;for(const[e,s]of new URLSearchParams(i))t.set(e.toLowerCase(),s);return t}const Ty=/[\x00-\x1F]/g;function ou(i,t=!1){return Ty.test(i)?t?i.replaceAll(Ty,e=>e==="\0"?"":" "):i.replaceAll("\0",""):i}function ku(i,t,e=0){let s=e,a=i.length-1;if(a<0||!t(i[a]))return i.length;if(t(i[s]))return s;for(;s<a;){const r=s+a>>1,o=i[r];t(o)?a=r:s=r+1}return s}function Iy(i){if(Math.floor(i)===i)return[i,1];const t=1/i,e=8;if(t>e)return[1,e];if(Math.floor(t)===t)return[1,t];const s=i>1?t:i;let a=0,r=1,o=1,l=1;for(;;){const c=a+o,d=r+l;if(d>e)break;s<=c/d?(o=c,l=d):(a=c,r=d)}let h;return s-a/r<o/l-s?h=s===i?[a,r]:[r,a]:h=s===i?[o,l]:[l,o],h}function Tp(i,t){return i-i%t}function ES(i,t,e){if(i<2)return i;let s=t[i].div,a=s.offsetTop+s.clientTop;a>=e&&(s=t[i-1].div,a=s.offsetTop+s.clientTop);for(let r=i-2;r>=0&&(s=t[r].div,!(s.offsetTop+s.clientTop+s.clientHeight<=a));--r)i=r;return i}function xS({scrollEl:i,views:t,sortByVisibility:e=!1,horizontal:s=!1,rtl:a=!1}){const r=i.scrollTop,o=r+i.clientHeight,l=i.scrollLeft,h=l+i.clientWidth;function c(_){const E=_.div;return E.offsetTop+E.clientTop+E.clientHeight>r}function d(_){const E=_.div,x=E.offsetLeft+E.clientLeft,k=x+E.clientWidth;return a?x<h:k>l}const p=[],g=new Set,v=t.length;let w=ku(t,s?d:c);w>0&&w<v&&!s&&(w=ES(w,t,r));let b=s?h:-1;for(let _=w;_<v;_++){const E=t[_],x=E.div,k=x.offsetLeft+x.clientLeft,C=x.offsetTop+x.clientTop,I=x.clientWidth,P=x.clientHeight,M=k+I,D=C+P;if(b===-1)D>=o&&(b=D);else if((s?k:C)>b)break;if(D<=r||C>=o||M<=l||k>=h)continue;const L=Math.max(0,r-C),W=Math.max(0,l-k),$=L+Math.max(0,D-o),j=W+Math.max(0,M-h),F=(P-$)/P,N=(I-j)/I,Q=F*N*100|0;p.push({id:E.id,x:k,y:C,visibleArea:Q===100?null:{minX:W,minY:L,maxX:Math.min(M,h)-k,maxY:Math.min(D,o)-C},view:E,percent:Q,widthPercent:N*100|0}),g.add(E.id)}const y=p[0],A=p.at(-1);return e&&p.sort(function(_,E){const x=_.percent-E.percent;return Math.abs(x)>.001?-x:_.id-E.id}),{first:y,last:A,views:p,ids:g}}function k_(i){return Number.isInteger(i)&&i%90===0}function kS(i){return Number.isInteger(i)&&Object.values(tt).includes(i)&&i!==tt.UNKNOWN}function SS(i){return Number.isInteger(i)&&Object.values(Le).includes(i)&&i!==Le.UNKNOWN}function S_(i){return i.width<=i.height}new Promise(function(i){window.requestAnimationFrame(i)});const MS=document.documentElement.style;var Wr,Rl,Br,yd,Nl;class CS{constructor(t){f(this,Wr,null),f(this,Rl,null),f(this,Br,0),f(this,yd,null),f(this,Nl,!0),u(this,Wr,t.classList),u(this,yd,t.style)}
55get percent(){return n(this,Br)}set percent(t){if(u(this,Br,t),isNaN(t)){n(this,Wr).add("indeterminate");return}n(this,Wr).remove("indeterminate"),n(this,yd).setProperty("--progressBar-percent",`${n(this,Br)}%`)}setWidth(t){if(!t)return;const e=t.parentNode.offsetWidth-t.offsetWidth;e>0&&n(this,yd).setProperty("--progressBar-end-offset",`${e}px`)}setDisableAutoFetch(t=5e3){n(this,Br)===100||isNaN(n(this,Br))||(n(this,Rl)&&clearTimeout(n(this,Rl)),this.show(),u(this,Rl,setTimeout(()=>{u(this,Rl,null),this.hide()},t)))}hide(){n(this,Nl)&&(u(this,Nl,!1),n(this,Wr).add("hidden"))}show(){n(this,Nl)||(u(this,Nl,!0),n(this,Wr).remove("hidden"))}}Wr=new WeakMap,Rl=new WeakMap,Br=new WeakMap,yd=new WeakMap,Nl=new WeakMap;function PS(i){let t=tt.VERTICAL,e=Le.NONE;switch(i){case"SinglePage":t=tt.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=tt.PAGE;case"TwoColumnLeft":e=Le.ODD;break;case"TwoPageRight":t=tt.PAGE;case"TwoColumnRight":e=Le.EVEN;break}return{scrollMode:t,spreadMode:e}}const Ip=function(){const i=document.createElement("div");return i.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",
55i.style.width==="calc(1320px)"?Math.fround:t=>t}(),Zn={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},TS=250,Dy={"â":"-","â":"'","â":"'","â":"'","â":"'","â":'"',"â":'"',"â":'"',"â":'"',"¼":"1/4","½":"1/2","¾":"3/4"},Ly=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 Mv;const IS=new RegExp("\\p{M}+","gu"),DS=new RegExp("([+^$|])|(\\p{P}+)|(\\s+)|(\\p{M})|(\\p{L})","gu"),LS=new RegExp("([^\\p{M}])\\p{M}*$","u"),RS=new RegExp("^\\p{M}*([^\\p{M}])","u"),NS=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,Ry=new Map,FS="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",Ny=new Map;let Cv=null,Pv=null;function Xg(i,t={}){const e=[];let s;for(;(s=NS.exec(i))!==null;){let{index:_}=s;for(const E of s[0]){let x=Ry.get(E);x||(x=E.normalize("NFD").length,Ry.set(E,x)),e.push([x,_++])}}const a=e.length>0,r=t.ignoreDashEOL??!1;let o;if(!a&&Cv)o=Cv;else if(a&&Pv)o=Pv;else{const _=Object.keys(Dy).join(""),E=mS(),x=[`[${_}]`,`[${E}]`,"(?:ã|ã)\\n","\\p{M}+(?:-\\n)?","\\p{Ll}-\\n(?=\\p{Ll})|\\p{Lu}-\\n(?=\\p{L})","\\S-\\n","(?:\\p{Ideographic}|[ã-ã¿])\\n","\\n",a?FS:"\\u0000"];o=new RegExp(x.map(k=>`(${k})`).join("|"),"gum"),a?Pv=o:Cv=o}const l=[];for(;(s=IS.exec(i))!==null;)l.push([s[0].length,s.index]);let h=i.normalize("NFD");const c=[0,0];let d=0,p=0,g=0,v=0,w=0,b=!1;h=h.replace(o,(_,E,x,k,C,I,P,M,D,L,W)=>{var $,j,F;if(W-=v,E){const N=Dy[E],Q=N.length;for(let X=1;X<Q;X++)c.push(W-g+X,g-X);return g-=Q-1,N}if(x){let N=Ny.get(x);N||(N=x.normalize("NFKC"),Ny.set(x,N));const Q=N.length;for(let X=1;X<Q;X++)c.push(W-g+X,g-X);return g-=Q-1,N}if(k)return b=!0,W+w===(($=l[d])==null?void 0:$[1])?++d:(c.push(W-1-g+1,g-1),g-=1,v+=1),c.push(W-g+1,g),v+=1,w+=1,k.charAt(0);if(C){const N=C.endsWith(` 56`),Q=N?C.length-2:C.length;b=!0;let X=Q;W+w===((j=l[d])==null?void 0:j[1])&&(X-=l[d][0],++d);for(let oe=1;oe<=X;oe++)c.push(W-1-g+oe,g-oe);return g-=X,v+=X,N?(W+=Q-1,c.push(W-g+1,1+g),g+=1,v+=1,w+=1,C.slice(0,Q)):C}if(I){if(r)return v+=1,w+=1,I.slice(0,-1);const N=I.length-2;return c.push(W-g+N,1+g),g+=1,v+=1,w+=1,I.slice(0,-2)}if(P)return v+=1,w+=1,P.slice(0,-1);if(M){const N=M.length-1;return c.push(W-g+N,g),v+=1,w+=1,M.slice(0,-1)}if(D)return c.push(W-g+1,g-1),g-=1,v+=1,w+=1," ";if(W+w===((F=e[p])==null?void 0:F[1])){const N=e[p][0]-1;++p;for(let Q=1;Q<=N;Q++)c.push(W-(g-Q),g-Q);g-=N,v+=N}return L}),c.push(h.length,g);const y=new Uint32Array(c.length>>1),A=new Int32Array(c.length>>1);for(let _=0,E=c.length;_<E;_+=2)y[_>>1]=c[_],A[_>>1]=c[_+1];return[h,[y,A],b]}function M_(i,t,e){if(!i)return[t,e];const[s,a]=i,r=t,o=t+e-1;let l=ku(s,p=>p>=r);s[l]>r&&--l;let h=ku(s,p=>p>=o,l);s[h]>o&&--h;const c=r+a[l],d=o+a[h]+1-c;return[c,d]}var ne,lu,Fl,en,ta,z,C_,ob,Tv,Fy,P_,lb,Oy,Wy,Dp,Ac,dr,By,Iv,Dv,Lp,T_,I_,Lv,Rv,_c;class D_{constructor({linkService:t,eventBus:e,updateMatchesCountOnProgress:s=!0}){f(this,z),f(this,ne,null),f(this,lu,!0),f(this,Fl,0),f(this,en,null),f(this,ta,null),this._linkService=t,this._eventBus=e,u(this,lu,s),this.onIsPageVisible=null,m(this,z,ob).call(this),e._on("find",m(this,z,C_).bind(this)),e._on("findbarclose",m(this,z,I_).bind(this)),e._on("pagesedited",m(this,z,T_).bind(this))}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,ne)}setDocument(t){this._pdfDocument&&m(this,z,ob).call(this),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}scrollMatchIntoView({element:t=null,pageIndex:e=-1,matchIndex:s=-1}){if(!(!this._scrollMatches||!t)){if(s===-1||s!==this._selected.matchIdx||e===-1||e!==this._selected.pageIdx)return;this._scrollMatches=!1,t.scrollIntoView({block:"start",inline:"center"})}}match(t,e,s){const a=this._hasDiacritics[s];let r=!1;if(typeof t=="string"?[r,t]=m(this,z,lb).call(this,t,a):t=t.sort().reverse().map(p=>{const[g,v]=m(this,z,lb).call(this,p,a);return r||(r=g),`(${v})`}).join("|"),!t)return;const{caseSensitive:o,entireWord:l}=n(this,ne),h=`g${r?"u":""}${o?"":"i"}`;t=new RegExp(t,h);const c=[];let d;for(;(d=t.exec(e))!==null;)l&&!m(this,z,P_).call(this,e,d.index,d[0].length)||c.push({index:d.index,length:d[0].length});return c}}ne=new WeakMap,lu=new WeakMap,Fl=new WeakMap,en=new WeakMap,ta=new WeakMap,z=new WeakSet,C_=function(i){if(!i)return;const t=this._pdfDocument,{type:e}=i;(n(this,ne)===null||m(this,z,Fy).call(this,i))&&(this._dirtyMatch=!0),u(this,ne,i),e!=="highlightallchange"&&m(this,z,_c).call(this,Zn.PENDING),this._firstPageCapability.promise.then(()=>
56{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;m(this,z,Wy).call(this);const s=!this._highlightMatches,a=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),e?this._dirtyMatch?m(this,z,dr).call(this):e==="again"?(m(this,z,dr).call(this),s&&n(this,ne).highlightAll&&m(this,z,Ac).call(this)):e==="highlightallchange"?(a?m(this,z,dr).call(this):this._highlightMatches=!0,m(this,z,Ac).call(this)):m(this,z,dr).call(this):this._findTimeout=setTimeout(()=>{m(this,z,dr).call(this),this._findTimeout=null},TS)})},ob=function(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],u(this,Fl,0),u(this,ne,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,u(this,en,null),this._firstPageCapability=Promise.withResolvers()},Tv=function(){const{query:i}=n(this,ne);return typeof i=="string"?(i!==this._rawQuery&&(this._rawQuery=i,[this._normalizedQuery]=Xg(i)),this._normalizedQuery):(i||[]).filter(t=>!!t).map(t=>Xg(t)[0])},Fy=function(i){var t;const e=i.query,s=n(this,ne).query,a=typeof e;if(a!==typeof s)return!0;if(a==="string"){if(e!==s)return!0}else if(JSON.stringify(e)!==JSON.stringify(s))return!0;switch(i.type){case"again":const r=this._selected.pageIdx+1,o=this._linkService;return r>=1&&r<=o.pagesCount&&r!==o.page&&!(((t=this.onIsPageVisible)==null?void 0:t.call(this,r))??!0);case"highlightallchange":return!1}return!0},P_=function(i,t,e){let s=i.slice(0,t).match(LS);if(s){const a=i.charCodeAt(t),r=s[1].charCodeAt(0);if(Pp(a)===Pp(r))return!1}if(s=i.slice(t+e).match(RS),s){const a=i.charCodeAt(t+e-1),r=s[1].charCodeAt(0);if(Pp(a)===Pp(r))return!1}return!0},lb=function(i,t){const{matchDiacritics:e}=n(this,ne);let s=!1;const a=(o,l)=>o===i?l:i.startsWith(o)?`${l}[ ]*`:i.endsWith(o)?`[ ]*${l}`:`[ ]*${l}[ ]*`;i=i.replaceAll(DS,(o,l,h,c,d,p)=>l?a(l,RegExp.escape(l)):h?a(h,RegExp.escape(h)):c?"[ ]+":e?d||p:d?Ly.has(d.charCodeAt(0))?d:"":t?(s=!0,`${p}\\p{M}*`):p);const r="[ ]*";return i.endsWith(r)&&(i=i.slice(0,i.length-r.length)),e&&t&&(Mv||(Mv=String.fromCharCode(...Ly)),s=!0,i=`${i}(?=[${Mv}]|[^\\p{M}]|$)`),[s,i]},Oy=function(i){if(!n(this,ne))return;const t=n(this,z,Tv);if(t.length===0)return;const e=this._pageContents[i],s=this.match(t,e,i),a=this._pageMatches[i]=[],r=this._pageMatchesLength[i]=[],o=this._pageDiffs[i];s==null||s.forEach(({index:h,length:c})=>{const[d,p]=M_(o,h,c);p&&(a.push(d),r.push(p))}),n(this,ne).highlightAll&&m(this,z,Dp).call(this,i),this._resumePageIdx===i&&(this._resumePageIdx=null,m(this,z,Iv).call(this));const l=a.length;this._matchesCountTotal+=l,n(this,lu)?l>0&&m(this,z,Rv).call(this):++jt(this,Fl)._===this._linkService.pagesCount&&m(this,z,Rv).call(this)},Wy=function(){if(this._extractTextPromises.length>0)return;let i=Promise.resolve();const t={disableNormalization:!0},e=this._pdfDocument;for(let s=0,a=this._linkService.pagesCount;s<a;s++){const{promise:r,resolve:o}=Promise.withResolvers();this._extractTextPromises[s]=r,i=i.then(async()=>{if(e!==this._pdfDocument){o();return}await e.getPage(s+1).then(l=>l.getTextContent(t)).then(l=>{const h=[];for(const c of l.items)h.push(c.str),c.hasEOL&&h.push(` 57`);[this._pageContents[s],this._pageDiffs[s],this._hasDiacritics[s]]=Xg(h.join("")),o()},l=>{console.error(`Unable to get text content for page ${s+1}`,l),this._pageContents[s]="",this._pageDiffs[s]=null,this._hasDiacritics[s]=!1,o()})})}},Dp=function(i){this._scrollMatches&&this._selected.pageIdx===i&&(this._linkService.page=i+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:i})},Ac=function(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})},dr=function(){const i=n(this,ne).findPrevious,t=this._linkService.page-1,e=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchI
57dx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,u(this,Fl,0),this._matchesCountTotal=0,m(this,z,Ac).call(this);for(let a=0;a<e;a++)this._pendingFindMatches.has(a)||(this._pendingFindMatches.add(a),this._extractTextPromises[a].then(()=>{this._pendingFindMatches.delete(a),m(this,z,Oy).call(this,a)}))}if(n(this,z,Tv).length===0){m(this,z,_c).call(this,Zn.FOUND);return}if(this._resumePageIdx)return;const s=this._offset;if(this._pagesToSearch=e,s.matchIdx!==null){const a=this._pageMatches[s.pageIdx].length;if(!i&&s.matchIdx+1<a||i&&s.matchIdx>0){s.matchIdx=i?s.matchIdx-1:s.matchIdx+1,m(this,z,Lp).call(this,!0);return}m(this,z,Dv).call(this,i)}m(this,z,Iv).call(this)},By=function(i){const t=this._offset,e=i.length,s=n(this,ne).findPrevious;return e?(t.matchIdx=s?e-1:0,m(this,z,Lp).call(this,!0),!0):(m(this,z,Dv).call(this,s),t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0)?(m(this,z,Lp).call(this,!1),!0):!1)},Iv=function(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let i=null;do{const t=this._offset.pageIdx;if(i=this._pageMatches[t],!i){this._resumePageIdx=t;break}}while(!m(this,z,By).call(this,i))},Dv=function(i){const t=this._offset,e=this._linkService.pagesCount;t.pageIdx=i?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=e||t.pageIdx<0)&&(t.pageIdx=i?e-1:0,t.wrapped=!0)},Lp=function(i=!1){let t=Zn.NOT_FOUND;const e=this._offset.wrapped;if(this._offset.wrapped=!1,i){const s=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=e?Zn.WRAPPED:Zn.FOUND,s!==-1&&s!==this._selected.pageIdx&&m(this,z,Dp).call(this,s)}m(this,z,_c).call(this,t,n(this,ne).findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,m(this,z,Dp).call(this,this._selected.pageIdx))},T_=function({pagesMapper:i,type:t,pageNumbers:e}){var s,a,r,o;if(this._extractTextPromises.length===0)return;if(t==="copy"){const b=new Map,y=new Map,A=new Map,_=new Map;for(const E of e)b.set(E,this._extractTextPromises[E-1]),y.set(E,this._pageContents[E-1]),A.set(E,this._pageDiffs[E-1]),_.set(E,this._hasDiacritics[E-1]);u(this,en,{promises:b,contents:y,diffs:A,diacritics:_});return}if(t==="cancelCopy"){u(this,en,null);return}if(t==="delete"&&u(this,ta,{promises:this._extractTextPromises,contents:this._pageContents,diffs:this._pageDiffs,diacritics:this._hasDiacritics}),t==="cancelDelete"){this._extractTextPromises=n(this,ta).promises,this._pageContents=n(this,ta).contents,this._pageDiffs=n(this,ta).diffs,this._hasDiacritics=n(this,ta).diacritics;return}if(t==="cleanSavedData"){u(this,ta,null);return}this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx=null,this._dirtyMatch=!0;const l=this._extractTextPromises,h=this._pageContents,c=this._pageDiffs,d=this._hasDiacritics,p=this._extractTextPromises=[],g=this._pageContents=[],v=this._pageDiffs=[],w=this._hasDiacritics=[];for(let b=1,y=i.pagesNumber;b<=y;b++){const A=i.getPrevPageNumber(b);if(A<0){const _=-A;p.push(((s=n(this,en))==null?void 0:s.promises.get(_))||Promise.resolve()),g.push(((a=n(this,en))==null?void 0:a.contents.get(_))??""),v.push(((r=n(this,en))==null?void 0:r.diffs.get(_))??null),w.push(((o=n(this,en))==null?void 0:o.diacritics.get(_))??!1);continue}p.push(l[A-1]||Promise.resolve()),g.push(h[A-1]??""),v.push(c[A-1]??null),w.push(d[A-1]??!1)}n(this,ne)&&m(this,z,dr).call(this)},I_=function(i){const t=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),m(this,z,_c).call(this,Zn.FOUND),this._highlightMatches=!1,m(this,z,Ac).call(this))})},Lv=function(){var i;const{pageIdx:t,matchIdx:e}=this._selected;let s=0,a=this._matchesCountTotal;if(e!==-1){for(let r=0;r<t;r++)s+=((i=this._pageMatches[r])==null?void 0:i.length)||0;s+=e+1}return(s<1||s>a)&&(s=a=0),{current:s,total:a}},Rv=function(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:m(this,z,Lv).call(this)})},_c=function(i,t=!1){var e,s;!n(this,lu)&&(n(this,Fl)!==this._linkService.pagesCount||i===Zn.PENDING)||this._eventBus.dispatch("updatefindcontrol
57state",{source:this,state:i,previous:t,entireWord:((e=n(this,ne))==null?void 0:e.entireWord)??null,matchesCount:m(this,z,Lv).call(this),rawQuery:((s=n(this,ne))==null?void 0:s.query)??null})};const OS="noopener noreferrer nofollow",jr={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class s0{constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:s=null,ignoreDestinationZoom:a=!1}={}){S(this,"externalLinkEnabled",!0),this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=s,this._ignoreDestinationZoom=a,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,s,a;if(typeof t=="string"?(e=t,s=await this.pdfDocument.getDestination(t)):(e=null,s=await t),!Array.isArray(s)){console.error(`goToDestination: "${s}" is not a valid destination array, for dest="${t}".`);return}const[r]=s;if(r&&typeof r=="object"){if(a=this.pdfDocument.cachedPageNumber(r),!a)try{a=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)&&(a=r+1);if(!a||a<1||a>this.pagesCount){console.error(`goToDestination: "${a}" is not a valid page number, for dest="${t}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:e,explicitDest:s,pageNumber:a})),this.pdfViewer.scrollPageIntoView({pageNumber:a,destArray:s,ignoreDestinationZoom:this._ignoreDestinationZoom});const o=new AbortController;this.eventBus._on("textlayerrendered",l=>{l.pageNumber===a&&(l.source.textLayer.div.focus(),o.abort())},{signal:o.signal})}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,s,a={}){this.pdfViewer.scrollPageIntoView({pageNumber:t,destArray:[null,{name:"XYZ"},e,s],ignoreDestinationZoom:!0,...a})}addLinkAttributes(t,e,s=!1){if(!e||typeof e!="string")throw new Error('A valid "url" parameter must provided.');const a=s?jr.BLANK:this.externalLinkTarget,r=this.externalLinkRel;let o=e;const l=URL.parse(e);(l!=null&&l.username||l!=null&&l.password)&&(l.username=l.password="",o=l.href),this.externalLinkEnabled?(t.href=e,t.title=o):(t.href="",t.title=`Disabled: ${o}`,t.onclick=()=>!1);let h="";switch(a){case jr.NONE:break;case jr.SELF:h="_self";break;case jr.BLANK:h="_blank";break;case jr.PARENT:h="_parent";break;case jr.TOP:h="_top";break}t.target=h,t.rel=typeof r=="string"?r:OS}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,s;if(t.includes("=")){const a=Fm(t);if(a.has("search")){const r=a.get("search").replaceAll('"',""),o=a.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:o?r:r.match(/\S+/g)})}if(a.has("page")&&(e=a.get("page")|0||1),a.has("zoom")){const r=a.get("zoom").split(","),o=r[0],l=parseFloat(o);o.includes("Fit")?o==="Fit"||o==="FitB"?s=[null,{name:o}]:o==="FitH"||o==="FitBH"||o==="FitV"||o==="FitBV"?s=[null,{name:o},r.length>1?r[1]|0:null]:o==="FitR"?r.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):s=[null,{name:o},r[1]|0,r[2]|0,r[3]|0,r[4]|0]:console.error(`PDFLinkService.setHash: "${o}" is not a valid zoom value.`):s=[null,{name:"XYZ"},r.length>1?r[1]|0:null,r.length>2?r[2]|0:null,l?l/100:o]}s?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:s,allowNegativeOffset:!0}):e&&(this.page=e),a.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:a.get("pagemode")}),a.has("nameddest")&&this.goToDestination(a.get("nameddest"));return}s=unescape(t);
57try{s=JSON.parse(s),Array.isArray(s)||(s=s.toString())}catch{}if(typeof s=="string"||Jk(s)){this.goToDestination(s);return}console.error(`PDFLinkService.setHash: "${unescape(t)}" is not a valid destination.`)}executeNamedAction(t){var e,s;if(this.pdfDocument){switch(t){case"GoBack":(e=this.pdfHistory)==null||e.back();break;case"GoForward":(s=this.pdfHistory)==null||s.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,s=await this.pdfViewer.optionalContentConfigPromise;e===this.pdfDocument&&(s.setOCGState(t),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(s))}}class n0 extends s0{setDocument(t,e=null){}}var ao,pm,Yg,Kg,$r,qg,Ol,L_,hb,R_;class N_{constructor({pdfPage:t,linkService:e,downloadManager:s,annotationStorage:a=null,imageResourcesPath:r="",renderForms:o=!0,enableComment:l=!1,commentManager:h=null,enableScripting:c=!1,hasJSActionsPromise:d=null,fieldObjectsPromise:p=null,annotationCanvasMap:g=null,accessibilityManager:v=null,annotationEditorUIManager:w=null,onAppend:b=null}){f(this,Ol),f(this,ao,null),f(this,pm,null),f(this,Yg,!1),f(this,Kg,null),f(this,$r,null),f(this,qg,!1),this.pdfPage=t,this.linkService=e,this.downloadManager=s,this.imageResourcesPath=r,this.renderForms=o,this.annotationStorage=a,this.enableComment=l,u(this,pm,h),this.enableScripting=c,this._hasJSActionsPromise=d||Promise.resolve(!1),this._fieldObjectsPromise=p||Promise.resolve(null),this._annotationCanvasMap=g,this._accessibilityManager=v,this._annotationEditorUIManager=w,u(this,Kg,b),this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}async render({viewport:t,intent:e="display",structTreeLayer:s=null}){var a,r;if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0})});return}const[o,l,h]=await Promise.all([this.pdfPage.getAnnotations({intent:e}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const c=this.div=document.createElement("div");if(c.className="annotationLayer",(a=n(this,Kg))==null||a.call(this,c),m(this,Ol,L_).call(this,t,s),o.length===0){u(this,ao,o),A_(this.div,t);return}await this.annotationLayer.render({annotations:o,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,downloadManager:this.downloadManager,enableComment:this.enableComment,enableScripting:this.enableScripting,hasJSActions:l,fieldObjects:h}),u(this,ao,o),this.linkService.isInPresentationMode&&m(this,Ol,hb).call(this,Eh.FULLSCREEN),n(this,$r)||(u(this,$r,new AbortController),(r=this._eventBus)==null||r._on("presentationmodechanged",d=>{m(this,Ol,hb).call(this,d.state)},{signal:n(this,$r).signal}))}cancel(){var t;this._cancelled=!0,(t=n(this,$r))==null||t.abort(),u(this,$r,null)}hide(t=!1){u(this,Yg,!t),this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){var t;return!!((t=this.annotationLayer)!=null&&t.hasEditableAnnotations())}async injectLinkAnnotations(t){if(n(this,ao)===null)throw new Error("`render` method must be called before `injectLinkAnnotations`.");if(this._cancelled||n(this,qg))return;u(this,qg,!0);const e=n(this,ao).length?m(this,Ol,R_).call(this,t):t;e.length&&(await this.annotationLayer.addLinkAnnotations(e),n(this,Yg)||(this.div.hidden=!1))}}ao=new WeakMap,pm=new WeakMap,Yg=new WeakMap,Kg=new WeakMap,$r=new WeakMap,qg=new WeakMap,Ol=new WeakSet,L_=function(i,t){this.annotationLayer=new Yk({div:this.div,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,annotationStorage:this.annotationStorage,page:this.pdfPage,viewport:i.clone({dontFlip:!0}),structTreeLayer:t,commentManager:n(this,pm),linkService:this.linkService})},hb=function(i){if(!this.div)return;let t=!1;switch(i){case Eh.FULLSCREEN:t=!0;break;case Eh.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)},R_=function(i){function t(a){if(!a.quadPoints)return[a.rect];const r=[];for(let o=2,l=a.quadPoints.length;o<l;o+=8){const h=a.quadPoints[o],c=a.quadPoints[o+1],d=a.quadPoints[o+2],p=a.quadPoints[o+3];r.push([d,p,h,c])}return r}function e(a,r){const o=[],l=t(a),h=t(r);for(const c of l)for(const d of h){const p=i0.intersect(c,d);p&&o.push(p)}return o}function s(a){let r=0;for(const o of a)r+=Math.abs((o[2]-o[0])*(o[3]-o[1]));return r}return i.filter(a=>{let r;for(const o of n(this,ao)){if(o.annotationType!==w_.LINK||!o.url)continue;const l=e(o,a);if(l.length!==0&&(r??(r=s(t(a))),s(l)/r>.5))return!1}return!0})};var Qg;class WS{constructor(){f(this,Qg,new WeakMap)}_triggerDownload(t,e,s,a=!1){throw new Error("Not implemented: _triggerDownload")}_getOpenDataUrl(t,e,s=null){throw new Error("Not implemented: _getOpenDataUrl")}downloadData(t,e,s){const a=URL.createObjectURL(new Blob([t],{type:s}));this._triggerDownload(a,a,e,!0)}openOrDownloadData(t,e,s=null){const a=Qk(e),r=a?"application/pdf":"";if(a){const o=n(this,Qg).getOrInsertComputed(t,()=>URL.createObjectURL(new Blob([t],{type:r})));try{const l=this._getOpenDataUrl(o,e,s);return window.open(l),!0}catch(l){console.error("openOrDownloadData:",l),URL.revokeObjectURL(o),n(this,Qg).delete(t)}}return this.downloadData(t,e,r),!1}download(t,e,s){const a=t?URL.createObjectURL(new Blob([t],{type:"application/pdf"})):null;this._triggerDownload(a,e,s)}}Qg=new WeakMap;class BS extends WS{_triggerDownload(t,e,s,a=!1){if(!t&&!a){if(!b_(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=s),(document.body||document.documentElement).append(r),r.click(),r.remove()}_getOpenDataUrl(t,e,s=null){throw new Error("Opening data is not supported in `COMPONENTS` builds.")}}const jy={EVENT:"event",TIMEOUT:"timeout"};async function jS({target:i,name:t,delay:e=0}){if(typeof i!="object"||!(Number.isInteger(e)&&e>
57=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:s,resolve:a}=Promise.withResolvers(),r=new AbortController;function o(c){r.abort(),clearTimeout(h),a(c)}const l=i instanceof a0?"_on":"addEventListener";i[l](t,o.bind(null,jy.EVENT),{signal:r.signal});const h=setTimeout(o.bind(null,jy.TIMEOUT),e);return s}var Ad;class a0{constructor(){f(this,Ad,Object.create(null))}on(t,e,s=null){this._on(t,e,{external:!0,once:s==null?void 0:s.once,signal:s==null?void 0:s.signal})}off(t,e,s=null){this._off(t,e)}dispatch(t,e){const s=n(this,Ad)[t];if(!s||s.length===0)return;let a;for(const{listener:r,external:o,once:l}of s.slice(0)){if(l&&this._off(t,r),o){(a||(a=[])).push(r);continue}r(e)}if(a){for(const r of a)r(e);a=null}}_on(t,e,s=null){var a;let r=null;if((s==null?void 0:s.signal)instanceof AbortSignal){const{signal:o}=s;if(o.aborted){console.error("Cannot use an `aborted` signal.");return}const l=()=>this._off(t,e);r=()=>o.removeEventListener("abort",l),o.addEventListener("abort",l)}((a=n(this,Ad))[t]||(a[t]=[])).push({listener:e,external:(s==null?void 0:s.external)===!0,once:(s==null?void 0:s.once)===!0,rmAbort:r})}_off(t,e,s=null){var a;const r=n(this,Ad)[t];if(r)for(let o=0,l=r.length;o<l;o++){const h=r[o];if(h.listener===e){(a=h.rmAbort)==null||a.call(h),r.splice(o,1);return}}}}Ad=new WeakMap;class xh{constructor(t){this.value=t}valueOf(){return this.value}}class Zt extends xh{constructor(t="???"){super(t)}toString(t){return`{${this.value}}`}}class xn extends xh{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 Oa extends xh{static supportsValue(t){if(typeof t=="number"||t instanceof Date)return!0;if(t instanceof xh)return Oa.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 Oa?(e={...t.opts,...e},t=t.value):t instanceof xh&&(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 $y=100,$S="â¨",US="â©";function HS(i,t,e){if(e===t||e instanceof xn&&t instanceof xn&&e.value===t.value)return!0;if(t instanceof xn&&typeof e=="string"){let s=i.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value);if(e===s)return!0}return!1}function Uy(i,t,e){return t[e]?Th(i,t[e].value):(i.reportError(new RangeError("No default")),new Zt)}function cb(i,t){const e=[],s=Object.create(null);for(const a of t)a.type==="narg"?s[a.name]=Su(i,a.value):e.push(Su(i,a));return{positional:e,named:s}}function Su(i,t){switch(t.type){case"str":return t.value;case"num":return new xn(t.value,{minimumFractionDigits:t.precision});case"var":return VS(i,t);case"mesg":return zS(i,t);case"term":return GS(i,t);case"func":return XS(i,t);case"select":return YS(i,t);default:return new Zt}}function VS(i,{name:t}){let e;if(i.params)if(Object.prototype.hasOwnProperty.call(i.params,t))e=i.params[t];else return new Zt(`$${t}`);else if(i.args&&Object.prototype.hasOwnProperty.call(i.args,t))e=i.args[t];else return i.reportError(new ReferenceError(`Unknown variable: $${t}`)),new Zt(`$${t}`);if(e instanceof xh)return e;switch(typeof e){case"string":return e;case"number":return new xn(e);case"object":if(Oa.supportsValue(e))return new Oa(e);default:return i.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof e}`)),new Zt(`$${t}`)}}function zS(i,{name:t,attr:e}){const s=i.bundle._messages.get(t);if(!s)return i.reportError(new ReferenceError(`Unknown message: ${t}`)),new Zt(t);if(e){const a=s.attributes[e];return a?Th(i,a):(i.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new Zt(`${t}.${e}`))}return s.value?Th(i,s.value):(i.reportError(new ReferenceError(`No value: ${t}`)),new Zt(t))}function GS(i,{name:t,attr:e,args:s}){const a=`-${t}`,r=i.bundle._terms.get(a);if(!r)return i.reportError(new ReferenceError(`Unknown term: ${a}`)),new Zt(a);if(e){const l=r.attributes[e];if(l){i.params=cb(i,s).named;const h=Th(i,l);return i.params=null,h}return i.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new Zt(`${a}.${e}`)}i.params=cb(i,s).named;const o=Th(i,r.value);return i.params=null,o}function XS(i,{name:t,args:e}){let s=i.bundle._functions[t];if(!s)return i.reportError(new ReferenceError(`Unknown function: ${t}()`)),new Zt(`${t}()`);if(typeof s!="function")return i.reportError(new TypeError(`Function ${t}() is not callable`)),new Zt(`${t}()`);try{let a=cb(i,e);return s(a.positional,a.named)}catch(a){return i.reportError(a),new Zt(`${t}()`)}}function YS(i,{selector:t,variants:e,star:s}){let a=Su(i,t);if(a instanceof Zt)return Uy(i,e,s);for(const r of e){const o=Su(i,r.key);if(HS(i,a,o))return Th(i,r.value)}return Uy(i,e,s)}function F_(i,t){if(i.dirty.has(t))return i.reportError(new RangeError("Cyclic reference")),new Zt;i.dirty.add(t);const e=[],s=i.bundle._useIsolating&&t.length>1;
vendor: 7,471 bytes, lines 57-58
57for(const a of t){if(typeof a=="string"){e.push(i.bundle._transform(a));continue}if(i.placeables++,i.placeables>$y)throw i.dirty.delete(t),new RangeError(`Too many placeables expanded: ${i.placeables}, max allowed is ${$y}`);s&&e.push($S),e.push(Su(i,a).toString(i)),s&&e.push(US)}return i.dirty.delete(t),e.join("")}function Th(i,t){return typeof t=="string"?i.bundle._transform(t):F_(i,t)}class KS{constructor(t,e,s){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=s}reportError(t){if(!this.errors||!(t instanceof Error))throw t;this.errors.push(t)}memoizeIntlObject(t,e){let s=this.bundle._intls.get(t);s||(s={},this.bundle._intls.set(t,s));let a=JSON.stringify(e);return s[a]||(s[a]=new t(this.bundle.locales,e)),s[a]}}function db(i,t){const e=Object.create(null);for(const[s,a]of Object.entries(i))t.includes(s)&&(e[s]=a.valueOf());return e}const Hy=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function qS(i,t){let e=i[0];if(e instanceof Zt)return new Zt(`NUMBER(${e.valueOf()})`);if(e instanceof xn)return new xn(e.valueOf(),{...e.opts,...db(t,Hy)});if(e instanceof Oa)return new xn(e.toNumber(),{...db(t,Hy)});throw new TypeError("Invalid argument to NUMBER")}const QS=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function JS(i,t){let e=i[0];if(e instanceof Zt)return new Zt(`DATETIME(${e.valueOf()})`);if(e instanceof Oa||e instanceof xn)return new Oa(e,db(t,QS));throw new TypeError("Invalid argument to DATETIME")}const Vy=new Map;function ZS(i){const t=Array.isArray(i)?i.join(" "):i;let e=Vy.get(t);return e===void 0&&(e=new Map,Vy.set(t,e)),e}class tM{constructor(t,{functions:e,useIsolating:s=!0,transform:a=r=>r}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions={NUMBER:qS,DATETIME:JS,...e},this._useIsolating=s,this._transform=a,this._intls=ZS(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){const s=[];for(let a=0;a<t.body.length;a++){let r=t.body[a];if(r.id.startsWith("-")){if(e===!1&&this._terms.has(r.id)){s.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)){s.push(new Error(`Attempt to override an existing message: "${r.id}"`));continue}this._messages.set(r.id,r)}}return s}formatPattern(t,e=null,s=null){if(typeof t=="string")return this._transform(t);let a=new KS(this,s,e);try{return F_(a,t).toString(a)}catch(r){if(a.errors&&r instanceof Error)return a.errors.push(r),new Zt().toString(a);throw r}}}const Nv=/^(-?[a-zA-Z][\w-]*) *= */gm,zy=/\.([a-zA-Z][\w-]*) *= */y,eM=/\*?\[/y,Fv=/(-?[0-9]+(?:\.([0-9]+))?)/y,iM=/([a-zA-Z][\w-]*)/y,Gy=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,sM=/^[A-Z][A-Z0-9_-]*$/,Rp=/([^{}\n\r]+)/y,nM=/([^\\"\n\r]*)/y,Xy=/\\([\\"])/y,Yy=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,aM=/^\n+/,Ky=/ +$/,rM=/ *\r?\n/g,oM=/( *)$/,lM=/{\s*/y,qy=/\s*}/y,hM=/\[\s*/y,cM=/\s*] */y,dM=/\s*\(\s*/y,uM=/\s*->\s*/y,pM=/\s*:\s*/y,gM=/\s*,?\s*/y,fM=/\s+/y;class mM{constructor(t){this.body=[],Nv.lastIndex=0;let e=0;for(;;){let M=Nv.exec(t);if(M===null)break;e=Nv.lastIndex;try{this.body.push(h(M[1]))}catch(D){if(D instanceof SyntaxError)continue;throw D}}function s(M){return M.lastIndex=e,M.test(t)}function a(M,D){if(t[e]===M)return e++,!0;if(D)throw new D(`Expected ${M}`);return!1}function r(M,D){if(s(M))return e=M.lastIndex,!0;if(D)throw new D(`Expected ${M.toString()}`);return!1}function o(M){M.lastIndex=e;let D=M.exec(t);if(D===null)throw new SyntaxError(`Expected ${M.toString()}`);return e=M.lastIndex,D}function l(M){return o(M)[1]}function h(M){let D=d(),L=c();if(D===null&&Object.keys(L).length===0)throw new SyntaxError("Expected message value or attributes");return{id:M,value:D,attributes:L}}function c(){let M=Object.create(null);for(;s(zy);){let D=l(zy),L=d();if(L===null)throw new SyntaxError("Expected attribute value");M[D]=L}return M}function d(){let M;if(s(Rp)&&(M=l(Rp)),t[e]==="{"||t[e]==="}")return p(M?[M]:[],1/0);let D=C();return D?M?p([M,D],D.length):(D.value=I(D.value,aM),p([D],D.length)):M?I(M,Ky):null}function p(M=[],D){for(;;){if(s(Rp)){M.push(l(Rp));continue}if(t[e]==="{"){M.push(g());continue}if(t[e]==="}")throw new SyntaxError("Unbalanced closing brace");let j=C();if(j){M.push(j),D=Math.min(D,j.length);continue}break}let L=M.length-1,W=M[L];typeof W=="string"&&(M[L]=I(W,Ky));let $=[];for(let j of M)j instanceof Qy&&(j=j.value.slice(0,j.value.length-D)),j&&$.push(j);return $}function g(){r(lM,SyntaxError);let M=v();if(r(qy))return M;if(r(uM)){let D=y();return r(qy,SyntaxError),{type:"select",selector:M,...D}}throw new SyntaxError("Unclosed placeable")}function v(){if(t[e]==="{")return g();if(s(Gy)){let[,M,D,L=null]=o(Gy);if(M==="$")return{type:"var",name:D};if(r(dM)){let W=w();if(M==="-")return{type:"term",name:D,attr:L,args:W};if(sM.test(D))return{type:"func",name:D,args:W};throw new SyntaxError("Function names must be all upper-case")}return M==="-"?{type:"term",name:D,attr:L,args:[]}:{type:"mesg",name:D,attr:L}}return _()}function w(){let M=[];for(;;){switch(t[e]){case")":return e++,M;case void 0:throw new SyntaxError("Unclosed argument list")}M.push(b()),r(gM)}}function b(){let M=v();return M.type!=="mesg"?M:r(pM)?{type:"narg",name:M.name,value:_()}:M}function y(){let M=[],D=0,L;for(;s(eM);){a("*")&&(L=D);let W=A(),$=d();if($===null)throw new SyntaxError("Expected variant value");M[D++]={key:W,value:$}}if(D===0)return null;if(L===void 0)throw new SyntaxError("Expected default variant");return{variants:M,star:L}}function A(){r(hM,SyntaxError);let M;return s(Fv)?M=E():M={type:"str",value:l(iM)},r(cM,SyntaxError),M}function _(){if(s(Fv))return E();if(t[e]==='"')return x();throw new SyntaxError("Invalid expression")}function E(){let[,M,D=""]=o(Fv),L=D.length;return{type:"num",value:parseFloat(M),precision:L}}function x(){a('"',SyntaxError);let M="";for(;;){if(M+=l(nM),t[e]==="\\"){M+=k();continue}if(a('"'))return{type:"str",value:M};throw new SyntaxError("Unclosed string literal")}}function k(){if(s(Xy))return l(Xy);if(s(Yy)){let[,M,D]=o(Yy),L=parseInt(M||D,16);return L<=55295||57344<=L?String.fromCodePoint(L):"�"}throw new SyntaxError("Unknown escape sequence")}function C(){let M=e;switch(r(fM),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return P(t.slice(M,e))}return t[e-1]===" "?P(t.slice(M,e)):!1}function I(M,D){return M.replace(D,"")}function P(M){let D=M.replace(rM,` 58`),L=oM.exec(M)[1].length;return new Qy(D,L)}}}class Qy{constructor(t,e){this.value=t,this.length=e}}const vM=/<|&#?\w+;/,wM={"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"]},bM={"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 yM(i,t){const{value:e}=t;if(typeof e=="string")if(i.localName==="title"&&i.namespaceURI==="http://www.w3.org/1999/xhtml")i.textContent=e;else if(!vM.test(e))i.textContent=e;else{const s=i.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");s.innerHTML=e,AM(s.content,i)}O_(t,i)}function AM(i,t){for(const e of i.childNodes)if(e.nodeType!==e.TEXT_NODE){if(e.hasAttribute("data-l10n-name")){const s=EM(t,e);i.replaceChild(s,e);continue}if(kM(e)){const s=xM(e);i.replaceChild(s,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.`),i.replaceChild(ub(e),e)}t.textContent="",t.appendChild(i)}function _M(i,t){if(!i)return!1;for(let e of i)if(e.name===t)return!0;return!1}function O_(i,t){const e=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(s=>s.trim()):null;for(const s of Array.from(t.attributes))Jy(s.name,t,e)&&!_M(i.attributes,s.name)&&t.removeAttribute(s.name);if(i.attributes)for(const s of Array.from(i.attributes))Jy(s.name,t,e)&&t.getAttribute(s.name)!==s.value&&t.setAttribute(s.name,s.value)}function EM(i,t){const e=t.getAttribute("data-l10n-name"),s=i.querySelector(`[data-l10n-name="${e}"]`);if(!s)return console.warn(`An element named "${e}" wasn't found in the source.`),ub(t);if(s.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 (${s.localName}).`),ub(t);i.removeChild(s);const a=s.cloneNode(!1);return W_(t,a)}function xM(i){const t=i.ownerDocument.createElement(i.localName);return W_(i,t)}function ub(i){return i.ownerDocument.createTextNode(i.textContent)}function kM(i){const t=wM[i.namespaceURI];return t&&t.includes(i.localName)}function Jy(i,t,e=null){if(e&&e.includes(i))return!0;const s=bM[t.namespaceURI];if(!s)return!1;const a=i.toLowerCase(),r=t.localName;if(s.global.includes(a))return!0;if(!s[r])return!1;if(s[r].includes(a))return!0;if(t.namespaceURI==="http://www.w3.org/1999/xhtml"&&r==="input"&&a==="value"){const o=t.type.toLowerCase();if(o==="submit"||o==="button"||o==="reset")return!0}return!1}function W_(i,t){return t.textContent=i.textContent,O_(i,t),t}class SM extends Array{static from(t){return t instanceof this?t:new this(t)}}class MM extends SM{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 s=this[this.length-1];if(s&&(await s).done)break;this.push(this.iterator.next())}return this[this.length-1]}}class CM{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 s=[];let a=!1;for await(const r of this.bundles){a=!0;const o=IM(e,r,t,s);if(o.size===0)break;if(typeof console<"u"){const l=r.locales[0],h=Array.from(o).join(", ");console.warn(`[fluent] Missing translations in ${l}: ${h}`)}}return!a&&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)}.`),s}formatMessages(t){return this.formatWithFallback(t,TM)}formatValues(t){return this.formatWithFallback(t,PM)}async formatValue(t,e){const[s]=await this.formatValues([{id:t,args:e}]);return s}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=MM.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}}function PM(i,t,e,s){return e.value?i.formatPattern(e.value,s,t):null}function TM(i,t,e,s){const a={value:null,attributes:null};
60e.value&&(a.value=i.formatPattern(e.value,s,t));let r=Object.keys(e.attributes);if(r.length>0){a.attributes=new Array(r.length);for(let[o,l]of r.entries()){let h=i.formatPattern(e.attributes[l],s,t);a.attributes[o]={name:l,value:h}}}return a}function IM(i,t,e,s){const a=[],r=new Set;return e.forEach(({id:o,args:l},h)=>{if(s[h]!==void 0)return;let c=t.getMessage(o);if(c){if(a.length=0,s[h]=i(t,a,c,l),a.length>0&&typeof console<"u"){const d=t.locales[0],p=a.join(", ");console.warn(`[fluent][resolver] errors in ${d}/${o}: ${p}.`)}}else r.add(o)}),r}const Ur="data-l10n-id",Ec="data-l10n-args",DM=`[${Ur}]`;class LM extends CM{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:[Ur,Ec]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,s){return t.setAttribute(Ur,e),s?t.setAttribute(Ec,JSON.stringify(s)):t.removeAttribute(Ec),t}getAttributes(t){return{id:t.getAttribute(Ur),args:JSON.parse(t.getAttribute(Ec)||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 s of e.addedNodes)if(s.nodeType===s.ELEMENT_NODE)if(s.childElementCount)for(const a of this.getTranslatables(s))this.pendingElements.add(a);else s.hasAttribute(Ur)&&this.pendingElements.add(s);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),s=await this.formatMessages(e);return this.applyTranslations(t,s)}applyTranslations(t,e){this.pauseObserving();for(let s=0;s<t.length;s++)e[s]!==void 0&&yM(t[s],e[s]);this.resumeObserving()}getTranslatables(t){const e=Array.from(t.querySelectorAll(DM));return typeof t.hasAttribute=="function"&&t.hasAttribute(Ur)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(Ur),args:JSON.parse(t.getAttribute(Ec)||null)}}}var Jg,ea,_d,hi,gm,B_,j_;const $_=class pb{constructor({lang:t,isRTL:e},s=null){f(this,Jg),f(this,ea),f(this,_d),f(this,hi);var a,r;u(this,_d,m(a=pb,gm,B_).call(a,t)),u(this,hi,s),u(this,Jg,e??m(r=pb,gm,j_).call(r,n(this,_d))?"rtl":"ltr")}_setL10n(t){u(this,hi,t)}getLanguage(){return n(this,_d)}getDirection(){return n(this,Jg)}async get(t,e=null,s){var a;return Array.isArray(t)?(t=t.map(r=>({id:r})),(await n(this,hi).formatMessages(t)).map(r=>r.value)):((a=(await n(this,hi).formatMessages([{id:t,args:e}]))[0])==null?void 0:a.value)||s}async translate(t){(n(this,ea)||u(this,ea,new Set)).add(t);try{n(this,hi).connectRoot(t),await n(this,hi).translateRoots()}catch{}}async translateOnce(t){try{await n(this,hi).translateElements([t])}catch(e){console.error("translateOnce:",e)}}async destroy(){if(n(this,ea)){for(const t of n(this,ea))n(this,hi).disconnectRoot(t);n(this,ea).clear(),u(this,ea,null)}n(this,hi).pauseObserving()}pause(){n(this,hi).pauseObserving()}resume(){n(this,hi).resumeObserving()}};Jg=new WeakMap,ea=new WeakMap,_d=new WeakMap,hi=new WeakMap,gm=new WeakSet,B_=function(i){return i=(i==null?void 0:i.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"}[i]||i},j_=function(i){const t=i.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(t)},f($_,gm);let RM=$_;function NM(){const{isAndroid:i,isLinux:t,isMac:e,isWindows:s}=y_.platform;return t?"linux":s?"windows":e?"macos":i?"android":"other"}function Zy(i,t){const e=new mM(t),s=new tM(i,{functions:{PLATFORM:NM}}),a=s.addResource(e);return a.length&&console.error("L10n errors",a),s}var ua,U_,tA,eA,H_,Ov;const V_=class Ed extends RM{constructor(t){super({lang:t});const e=t?m(Ed,ua,U_).bind(Ed,"en-us",this.getLanguage()):m(Ed,ua,H_).bind(Ed,this.getLanguage());this._setL10n(new LM([],e))}};ua=new WeakSet,U_=async function*(i,t){const{baseURL:e,paths:s}=await m(this,ua,eA).call(this),a=[t];if(i!==t){const o=t.split("-",1)[0];o!==t&&a.push(o),a.push(i)}const r=a.map(o=>[o,m(this,ua,tA).call(this,o,e,s)]);for(const[o,l]of r){const h=await l;h?yield h:o==="en-us"&&(yield m(this,ua,Ov).call(this,o))}},tA=async function(i,t,e){const s=e[i];if(!s)return null;const a=new URL(s,t),r=await My(a,"text");return Zy(i,r)},eA=async function(){try{const{href:i}=document.querySelector('link[type="application/l10n"]'),t=await My(i,"json");return{baseURL:i.substring(0,i.lastIndexOf("/")+1)||"./",paths:t}}catch{}return{baseURL:"./",paths:Object.create(null)}},H_=async function*(i){yield m(this,ua,Ov).call(this,i)},Ov=async function(i){return Zy(i
vendor: 21,475 bytes, lines 61-535
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-
535pages-status-waiting-ready-label = Getting your file ready⦠536pdfjs-views-manager-pages-status-waiting-uploading-label = Uploading file⦠537pdfjs-views-manager-status-warning-cut-label = Couldnât cut. Refresh page and try again. 538pdfjs-views-manager-status-warning-copy-label = Couldnât copy. Refresh page and try again. 539pdfjs-views-manager-status-warning-delete-label = Couldnât delete. Refresh page and try again. 540pdfjs-views-manager-status-warning-save-label = Couldnât save. Refresh page and try again. 541pdfjs-views-manager-status-undo-button-label = Undo 542pdfjs-views-manager-status-done-button-label = Done 543pdfjs-views-manager-status-close-button = 544 .title = Close 545pdfjs-views-manager-status-close-button-label = Close 546pdfjs-views-manager-paste-button-label = Paste 547pdfjs-views-manager-paste-button-before = 548 .title = Paste before the first page 549pdfjs-views-manager-paste-button-after = 550 .title = Paste after page { $page } 551pdfjs-new-badge-content = NEW 552pdfjs-views-manager-waiting-for-file = Uploading fileâ¦`)},f(V_,ua);let Om=V_;const FM=1e3,OM=50,WM=1e3;function gb(){return document.location.hash}var Hr,nt,_n,Zg,fm,hu,tf,fb,iA,sA,mb,z_,G_;class BM{constructor({linkService:t,eventBus:e}){f(this,nt),f(this,Hr,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",s=>{this._isPagesLoaded=!!s.pagesCount},{once:!0})})}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:s=!1}){if(!t||typeof t!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const a=this._fingerprint!==""&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=s===!0,this._initialized=!0,m(this,nt,z_).call(this);const r=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=gb(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!m(this,nt,hu).call(this,r,!0)||e){const{hash:l,page:h,rotation:c}=m(this,nt,fb).call(this,!0);if(!l||a||e){m(this,nt,_n).call(this,null,!0);return}m(this,nt,_n).call(this,{hash:l,page:h,rotation:c},!0);return}const o=r.destination;m(this,nt,tf).call(this,o,r.uid,!0),o.rotation!==void 0&&(this._initialRotation=o.rotation),o.dest?(this._initialBookmark=JSON.stringify(o.dest),this._destination.page=null):o.hash?this._initialBookmark=o.hash:o.page&&(this._initialBookmark=`page=${o.page}`)}reset(){this._initialized&&(m(this,nt,mb).call(this),this._initialized=!1,m(this,nt,G_).call(this)),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:s}){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(!m(this,nt,fm).call(this,s)&&(s!==null||this._destination)){console.error(`PDFHistory.push: "${s}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${e}" is not a valid explicitDest parameter.`);return}const a=t||JSON.stringify(e);if(!a)return;let r=!1;if(this._destination&&(jM(this._destination.hash,a)||$M(this._destination.dest,e))){if
552(this._destination.page)return;r=!0}this._popStateInProgress&&!r||(m(this,nt,_n).call(this,{dest:e,hash:a,page:s,rotation:this.linkService.rotation},r),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){var e;if(this._initialized){if(!m(this,nt,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||(m(this,nt,_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||m(this,nt,Zg).call(this)}back(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;m(this,nt,hu).call(this,t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;m(this,nt,hu).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}}Hr=new WeakMap,nt=new WeakSet,_n=function(i,t=!1){const e=t||!this._destination,s={fingerprint:this._fingerprint,uid:e?this._uid:this._uid+1,destination:i};m(this,nt,tf).call(this,i,s.uid);let a;if(this._updateUrl&&i!=null&&i.hash){const{href:r,protocol:o}=document.location;o!=="file:"&&(a=aS(r,i.hash))}e?window.history.replaceState(s,"",a):window.history.pushState(s,"",a)},Zg=function(i=!1){if(!this._position)return;let t=this._position;if(i&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination){m(this,nt,_n).call(this,t);return}if(this._destination.temporary){m(this,nt,_n).call(this,t,!0);return}if(this._destination.hash===t.hash||!this._destination.page&&this._numPositionUpdates<=OM)return;let e=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(this._destination.dest!==void 0||!this._destination.first)return;e=!0}m(this,nt,_n).call(this,t,e)},fm=function(i){return Number.isInteger(i)&&i>0&&i<=this.linkService.pagesCount},hu=function(i,t=!1){if(!i)return!1;if(i.fingerprint!==this._fingerprint)if(t){if(typeof i.fingerprint!="string"||i.fingerprint.length!==this._fingerprint.length)return!1;const[e]=performance.getEntriesByType("navigation");if((e==null?void 0:e.type)!=="reload")return!1}else return!1;return!(!Number.isInteger(i.uid)||i.uid<0||i.destination===null||typeof i.destination!="object")},tf=function(i,t,e=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),e&&i!=null&&i.temporary&&delete i.temporary,this._destination=i,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0},fb=function(i=!1){const t=unescape(gb()).substring(1),e=Fm(t),s=e.get("nameddest")||"";let a=e.get("page")|0;return(!m(this,nt,fm).call(this,a)||i&&s.length>0)&&(a=null),{hash:t,page:a,rotation:this.linkService.rotation}},iA=function({location:i}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:i.pdfOpenParams.substring(1),page:this.linkService.page,first:i.pageNumber,rotation:i.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||m(this,nt,Zg).call(this,!0),this._updateViewareaTimeout=null},WM))},sA=function({state:i}){const t=gb(),e=this._currentHash!==t;if(this._currentHash=t,!i){this._uid++;const{hash:a,page:r,rotation:o}=m(this,nt,fb).call(this);m(this,nt,_n).call(this,{hash:a,page:r,rotation:o},!0);return}if(!m(this,nt,hu).call(this,i))return;this._popStateInProgress=!0,e&&(this._blockHashChange++,jS({target:window,name:"hashchange",delay:FM}).then(()=>{this._blockHashChange--}));const s=i.destination;m(this,nt,tf).call(this,s,i.uid,!0),k_(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})},mb=function(){(!this._destination||this._destination.temporary)&&m(this,nt,Zg).call(this)},z_=function(){if(n(this,Hr))return;u(this,Hr,new AbortController);const{signal:i}=n(this,Hr);this.eventBus._on("updateviewarea",m(this,nt,iA).bind(this),{signal:i}),window.addEventListener("popstate",m(this,nt,sA).bind(this),{signal:i}),window.addEventListener("pagehide",m(this,nt,mb).bind(this),{signal:i})},G_=function(){var i;(i=n(this,Hr))==null||i.abort(),u(this,Hr,null)};
552function jM(i,t){return typeof i!="string"||typeof t!="string"?!1:i===t||Fm(i).get("nameddest")===t}function $M(i,t){function e(s,a){if(typeof s!=typeof a||Array.isArray(s)||Array.isArray(a))return!1;if(s!==null&&typeof s=="object"&&a!==null){if(Object.keys(s).length!==Object.keys(a).length)return!1;for(const r in s)if(!e(s[r],a[r]))return!1;return!0}return s===a||Number.isNaN(s)&&Number.isNaN(a)}if(!(Array.isArray(i)&&Array.isArray(t))||i.length!==t.length)return!1;for(let s=0,a=i.length;s<a;s++)if(!e(i[s],t[s]))return!1;return!0}var ef,sf,nf,af,rf,xd;class UM{constructor(t){f(this,ef,null),f(this,sf,null),f(this,nf,null),f(this,af,null),f(this,rf,null),f(this,xd),this.pageIndex=t.pageIndex,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||(this.l10n=new Om),this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,u(this,xd,t.uiManager),u(this,ef,t.annotationLayer||null),u(this,rf,t.textLayer||null),u(this,sf,t.drawLayer||null),u(this,nf,t.onAppend||null),u(this,af,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 s;if(e!=="display"||this._cancelled)return;const a=t.clone({dontFlip:!0});
552if(this.div){this.annotationEditorLayer.update({viewport:a}),this.show();return}const r=this.div=document.createElement("div");r.className="annotationEditorLayer",r.hidden=!0,r.dir=n(this,xd).direction,(s=n(this,nf))==null||s.call(this,r),this.annotationEditorLayer=new Gk({uiManager:n(this,xd),div:r,structTreeLayer:n(this,af),accessibilityManager:this.accessibilityManager,pageIndex:this.pageIndex,l10n:this.l10n,viewport:a,annotationLayer:n(this,ef),textLayer:n(this,rf),drawLayer:n(this,sf)});const o={viewport:a,div:r,annotations:null,intent:e};await this.annotationEditorLayer.render(o),this.show()}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))}}ef=new WeakMap,sf=new WeakMap,nf=new WeakMap,af=new WeakMap,rf=new WeakMap,xd=new WeakMap;{var vb=new Map;const{maxTouchPoints:i,platform:t,userAgent:e}=navigator,s=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||t==="MacIntel"&&i>1||s)&&vb.set("maxCanvasPixels",5242880),s&&vb.set("useSystemFonts",!1)}const T={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},wb={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},kn={allowedGlobalEvents:{value:null,kind:T.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:T.BROWSER+T.API},isInAutomation:{value:!1,kind:T.BROWSER},localeProperties:{value:{lang:navigator.language||"en-US"},kind:T.BROWSER},maxCanvasDim:{value:32767,kind:T.BROWSER+T.VIEWER},nimbusDataStr:{value:"",kind:T.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:T.BROWSER},supportsDocumentFonts:{value:!0,kind:T.BROWSER},supportsIntegratedFind:{value:!1,kind:T.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:T.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:T.BROWSER},supportsPinchToZoom:{value:!0,kind:T.BROWSER},supportsPrinting:{value:!0,kind:T.BROWSER},toolbarDensity:{value:0,kind:T.BROWSER+T.EVENT_DISPATCH},altTextLearnMoreUrl:{value:"",kind:T.VIEWER+T.PREFERENCE},annotationEditorMode:{value:0,kind:T.VIEWER+T.PREFERENCE},annotationMode:{value:2,kind:T.VIEWER+T.PREFERENCE},capCanvasAreaFactor:{value:200,kind:T.VIEWER+T.PREFERENCE},commentLearnMoreUrl:{value:"",kind:T.VIEWER+T.PREFERENCE},cursorToolOnLoad:{value:0,kind:T.VIEWER+T.PREFERENCE},debuggerSrc:{value:"./debugger.mjs",kind:T.VIEWER},defaultZoomDelay:{value:400,kind:T.VIEWER+T.PREFERENCE},defaultZoomValue:{value:"",kind:T.VIEWER+T.PREFERENCE},disableHistory:{value:!1,kind:T.VIEWER},disablePageLabels:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableAltText:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:T.VIEWER+T.PREFERENCE+T.EVENT_DISPATCH},enableAutoLinking:{value:!0,kind:T.VIEWER+T.PREFERENCE},enableComment:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableDetailCanvas:{value:!0,kind:T.VIEWER},enableGuessAltText:{value:!0,kind:T.VIEWER+T.PREFERENCE+T.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableMerge:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:T.VIEWER+T.PREFERENCE},enableNewBadge:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableOptimizedPartialRendering:{value:!1,kind:T.VIEWER+T.PREFERENCE},enablePermissions:{value:!1,kind:T.VIEWER+T.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:T.VIEWER+T.PREFERENCE},enableScripting:{value:!0,kind:T.VIEWER+T.PREFERENCE},enableSignatureEditor:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableSplitMerge:{value:!1,kind:T.VIEWER+T.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:T.VIEWER+T.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:T.VIEWER},externalLinkTarget:{value:0,kind:T.VIEWER+T.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:T.VIEWER+T.PREFERENCE},historyUpdateUrl:{value:!1,kind:T.VIEWER+T.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:T.VIEWER+T.PREFERENCE},imageResourcesPath:{value:"./images/",kind:T.VIEWER},imagesRightClickMinSize:{value:-1,kind:T.VIEWER+T.PREFERENCE},maxCanvasPixels:{value:2**25,kind:T.VIEWER},minDurationToUpdateCanvas:{value:500,kind:T.VIEWER},forcePageColors:{value:!1,kind:T.VIEWER+T.PREFERENCE}
552,pageColorsBackground:{value:"Canvas",kind:T.VIEWER+T.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:T.VIEWER+T.PREFERENCE},pdfBugEnabled:{value:!1,kind:T.VIEWER+T.PREFERENCE},printResolution:{value:150,kind:T.VIEWER},sidebarViewOnLoad:{value:-1,kind:T.VIEWER+T.PREFERENCE},scrollModeOnLoad:{value:-1,kind:T.VIEWER+T.PREFERENCE},spreadModeOnLoad:{value:-1,kind:T.VIEWER+T.PREFERENCE},textLayerMode:{value:1,kind:T.VIEWER+T.PREFERENCE},viewerCssTheme:{value:0,kind:T.VIEWER+T.PREFERENCE},viewOnLoad:{value:0,kind:T.VIEWER+T.PREFERENCE},cMapPacked:{value:!0,kind:T.API},cMapUrl:{value:"../web/cmaps/",kind:T.API},disableAutoFetch:{value:!1,kind:T.API+T.PREFERENCE},disableFontFace:{value:!1,kind:T.API+T.PREFERENCE},disableRange:{value:!1,kind:T.API+T.PREFERENCE},disableStream:{value:!1,kind:T.API+T.PREFERENCE},docBaseUrl:{value:"",kind:T.API},enableHWA:{value:!0,kind:T.API+T.PREFERENCE},enableWebGPU:{value:!0,kind:T.API+T.PREFERENCE},enableXfa:{value:!0,kind:T.API+T.PREFERENCE},fontExtraProperties:{value:!1,kind:T.API},iccUrl:{value:"../web/iccs/",kind:T.API},isOffscreenCanvasSupported:{value:!0,kind:T.API},maxImageSize:{value:-1,kind:T.API},pdfBug:{value:!1,kind:T.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:T.API},useSystemFonts:{value:void 0,kind:T.API,type:wb.BOOLEAN+wb.UNDEFINED},verbosity:{value:1,kind:T.API},wasmUrl:{value:"../web/wasm/",kind:T.API},workerPort:{value:null,kind:T.WORKER},workerSrc:{value:"../build/pdf.worker.mjs",kind:T.WORKER}};kn.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:T.VIEWER},kn.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:T.VIEWER},kn.enableFakeMLManager={value:!0,kind:T.VIEWER};kn.disablePreferences={value:!1,kind:T.VIEWER};var fo;const sn=class{static get(t){return n(this,fo).get(t)}static getAll(t=null,e=!1){const s=Object.create(null);for(const a in kn){const r=kn[a];t&&!(t&r.kind)||(s[a]=e?r.value:n(this,fo).get(a))}return s}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){this._hasInvokedSet||(this._hasInvokedSet=!0);let s;for(const a in t){const r=kn[a],o=t[a];if(!r||!(typeof o==typeof r.value||wb[(typeof o).toUpperCase()]&r.type))continue;const{kind:l}=r;e&&!(l&T.BROWSER||l&T.PREFERENCE)||(this.eventBus&&l&T.EVENT_DISPATCH&&(s||(s=new Map)).set(a,o),n(this,fo).set(a,o))}if(s)for(const[a,r]of s)this.eventBus.dispatch(a.toLowerCase(),{source:this,value:r})}};fo=new WeakMap,S(sn,"eventBus"),f(sn,fo,new Map),(()=>{for(const i in kn)n(sn,fo).set(i,kn[i].value);for(const[i,t]of vb)n(sn,fo).set(i,t);sn._hasInvokedSet=!1,sn._checkDisablePreferences=()=>sn.get("disablePreferences")?!0:(sn._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();let Wv=sn;function nA({width:i,height:t,left:e,top:s},a){if(i===0||t===0)return null;const r=a.textLayer.div.getBoundingClientRect(),o=a.getPagePoint(e-r.left,s-r.top),l=a.getPagePoint(e-r.left+i,s-r.top+t);return i0.normalizeRect([o[0],o[1],l[0],l[1]])}function HM(i,t){const e=i.getClientRects();if(e.length===1)return{rect:nA(e[0],t)};const s=[1/0,1/0,-1/0,-1/0],a=[];let r=0;for(const o of e){const l=nA(o,t);l!==null&&(a[r]=a[r+4]=l[0],a[r+1]=a[r+3]=l[3],a[r+2]=a[r+6]=l[2],a[r+5]=a[r+7]=l[1],i0.rectBoundingBox(...l,s),r+=8)}return{quadPoints:a,rect:s}}function aA(i,t){let e=i;do{if(e.nodeType===Node.TEXT_NODE){const s=e.textContent.length;if(t<=s)return[e,t];t-=s}else if(e.firstChild){e=e.firstChild;continue}for(;!e.nextSibling&&e!==i;)e=e.parentNode;e!==i&&(e=e.nextSibling)}while(e!==i);throw new Error("Offset is bigger than container's contents length.")}function VM({url:i,index:t,length:e},s,a){const r=s._textHighlighter,[{begin:o,end:l}]=r._convertMatches([t],[e]),h=new Range;return h.setStart(...aA(r.textDivs[o.divIdx],o.offset)),h.setEnd(...aA(r.textDivs[l.divIdx],l.offset)),{id:`inferred_link_${a}`,unsafeUrl:i,url:i,annotationType:w_.LINK,rotation:0,...HM(h,s),borderStyle:null}}var bb,cu,du;class of{static findLinks(t){var e;n(this,cu)??u(this,cu,new RegExp("\\b(?:https?:\\/\\/|mailto:|www\\.)(?:[\\S--[\\p{P}<>]]|\\/|[\\S--[\\[\\]]]+[\\S--[\\p{P}<>]])+|(?=\\p{L})[\\S--[@\\p{Ps}\\p{Pe}<>]]+@([\\S--[[\\p{P}--\\-]<>]]+(?:\\.[\\S--[[\\p{P}--\\-]<>]]+)+)","gmv"));const[s,a]=Xg(t,{ignoreDashEOL:!0}),r=s.matchAll(n(this,cu)),o=[];for(const l of r){const[h,c]=l;let d;if(h.startsWith("www.")||h.startsWith("http://")||h.startsWith("https://"))d=h;else if(c){const g=(e=URL.parse(`http://${c}`))==null?void 0:e.hostname;if(!g||(n(this,du)??u(this,du,/\.\d+$/),n(this,du).test(g)))continue}d??(d=h.startsWith("mailto:")?h:`mailto:${h}`);const p=b_(d,null,{addDefaultProtocol:!0});if(p){const[g,v]=M_(a,l.index,h.length);o.push({url:p.href,index:g,length:v})}}return o}static processLinks(t){return this.findLinks(t._textHighlighter.textContentItemsStr.join(` 553`)).map(e=>VM(e,t,jt(this,bb)._++))}}bb=new WeakMap,cu=new WeakMap,du=new WeakMap,f(of,bb,0),f(of,cu),f(of,du);const st={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};class zM{constructor(){S(this,"renderingId",""),S(this,"renderTask",null),S(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 Vr,kd,Sd,ia,zr,_a,yb,lf,Ab;class X_ extends zM{constructor(t){super(),f(this,lf),f(this,Vr,null),f(this,kd,null),f(this,Sd,st.INITIAL),f(this,ia,null),f(this,zr,0),f(this,_a,null),S(this,"canvas",null),S(this,"div",null),S(this,"enableOptimizedPartialRendering",!1),S(this,"imagesRightClickMinSize",-1),S(this,"eventBus",null),S(this,"id",null),S(this,"imageCoordinates",null),S(this,"pageColors",null),S(this,"recordedBBoxes",null),S(this,"renderingQueue",null),f(this,yb,e=>{var s;if((s=n(this,ia))==null||s.call(this,!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=st.PAUSED,this.resume=()=>{this.renderingState=st.RUNNING,e()};return}e()}),this.eventBus=t.eventBus,this.id=t.id,this.pageColors=t.pageColors||null,this.renderingQueue=t.renderingQueue,this.enableOptimizedPartialRendering=t.enableOptimizedPartialRendering??!1,this.imagesRightClickMinSize=t.imagesRightClickMinSize??-1,this.minDurationToUpdateCanvas=t.minDurationToUpdateCanvas??500}get renderingState(){return n(this,Sd)}set renderingState(t){var e;if(t!==n(this,Sd))switch(u(this,Sd,t),n(this,Vr)&&(clearTimeout(n(this,Vr)),u(this,Vr,null)),t){case st.PAUSED:this.div.classList.remove("loading"),u(this,zr,0),(e=n(this,ia))==null||e.call(this,!1);break;case st.RUNNING:this.div.classList.add("loadingIcon"),u(this,Vr,setTimeout(()=>{this.div.classList.add("loading"),u(this,Vr,null)},0)),u(this,zr,Date.now());break;case st.INITIAL:case st.FINISHED:this.div.classList.remove("loadingIcon","loading"),u(this,zr,0);break}}_createCanvas(t,e=!1){const{pageColors:s}=this,a=!!(s!=null&&s.background&&s!=null&&s.foreground),r=this.canvas,o=!r&&!a&&!e;let l=this.canvas=document.createElement("canvas");return u(this,ia,h=>
553{if(o){let c=n(this,_a);if(!h&&this.minDurationToUpdateCanvas>0){if(Date.now()-n(this,zr)<this.minDurationToUpdateCanvas)return;c||(c=u(this,_a,l),l=this.canvas=l.cloneNode(!1),t(l))}if(c){l.getContext("2d",{alpha:!1}).drawImage(c,0,0),h?m(this,lf,Ab).call(this):u(this,zr,Date.now());return}t(l),u(this,ia,null);return}h&&(r?(r.replaceWith(l),r.width=r.height=0):t(l))}),{canvas:l,prevCanvas:r}}_resetCanvas(){const{canvas:t}=this;t&&(t.remove(),t.width=t.height=0,this.canvas=null,m(this,lf,Ab).call(this))}async _drawCanvas(t,e,s){var a,r;const o=this.renderTask=this.pdfPage.render(t);o.onContinue=n(this,yb),o.onError=h=>{h instanceof ab&&(e(),u(this,kd,null))};let l=null;try{await o.promise,(a=n(this,ia))==null||a.call(this,!0)}catch(h){if(h instanceof ab)return;l=h,(r=n(this,ia))==null||r.call(this,!0)}finally{u(this,kd,l),o===this.renderTask&&(this.renderTask=null,this.enableOptimizedPartialRendering&&(this.recordedBBoxes??(this.recordedBBoxes=o.recordedBBoxes)),this.imagesRightClickMinSize!==-1&&(this.imageCoordinates??(this.imageCoordinates=this.pdfPage.imageCoordinates)))}if(this.renderingState=st.FINISHED,s(o),l)throw l}cancelRendering({cancelExtraDelay:t=0}={}){this.renderTask&&(this.renderTask.cancel(t),this.renderTask=null),this.resume=null}dispatchPageRender(){this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id})}dispatchPageRendered(t,e){this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:t,isDetailView:e,timestamp:performance.now(),error:n(this,kd)})}}Vr=new WeakMap,kd=new WeakMap,Sd=new WeakMap,ia=new WeakMap,zr=new WeakMap,_a=new WeakMap,yb=new WeakMap,lf=new WeakSet,Ab=function(){n(this,_a)&&(n(this,_a).width=n(this,_a).height=0,u(this,_a,null))};var nn;class GM{constructor(){f(this,nn,null)}async render({intent:t="display"}){t!=="display"||n(this,nn)||this._cancelled||u(this,nn,new Kk)}cancel(){this._cancelled=!0,n(this,nn)&&(n(this,nn).destroy(),u(this,nn,null))}setParent(t){var e;(e=n(this,nn))==null||e.setParent(t)}getDrawLayer(){return n(this,nn)}}nn=new WeakMap;var as,_b,Y_;class XM extends X_{constructor({pageView:t}){super(t),f(this,_b),f(this,as,null),S(this,"renderingCancelled",!1),this.pageView=t,this.renderingId="detail"+this.id,this.div=t.div}setPdfPage(t){this.pageView.setPdfPage(t)}get pdfPage(){return this.pageView.pdfPage}get renderingState(){return super.renderingState}set renderingState(t){this.renderingCancelled=!1,super.renderingState=t}reset({keepCanvas:t=!1}={}){const e=this.renderingCancelled||this.renderingState===st.RUNNING||this.renderingState===st.PAUSED;this.cancelRendering(),this.renderingState=st.INITIAL,this.renderingCancelled=e,t||this._resetCanvas()}update({visibleArea:t=null,underlyingViewUpdated:e=!1}={}){if(e){this.cancelRendering(),this.renderingState=st.INITIAL;return}if(!m(this,_b,Y_).call(this,t))return;const{viewport:s,maxCanvasPixels:a,capCanvasAreaFactor:r}=this.pageView,o=t.maxX-t.minX,l=t.maxY-t.minY,h=o*l*Gg.pixelRatio**2,c=(Math.sqrt(Gg.capPixels(a,r)/h)-1)/2;let d=Math.min(1,c);d<0&&(d=0);const p=o*d,g=l*d,v=Math.max(0,t.minX-p),w=Math.min(s.width,t.maxX+p),b=Math.max(0,t.minY-g),y=Math.min(s.height,t.maxY+g),A=w-v,_=y-b;u(this,as,{minX:v,minY:b,width:A,height:_,scale:s.scale}),this.reset({keepCanvas:!0})}_getRenderingContext(t,e){const s=this.pageView._getRenderingContext(t,e,!1),a=this.pdfPage.recordedBBoxes;if(!a||!this.enableOptimizedPartialRendering)return s;const{viewport:{width:r,height:o}}=this.pageView,{width:l,height:h,minX:c,minY:d}=n(this,as),p=c/r,g=d/o,v=(c+l)/r,w=(d+h)/o;return{...s,operationsFilter(b){return a.isEmpty(b)?!1:a.minX(b)<=v&&a.maxX(b)>=p&&a.minY(b)<=w&&a.maxY(b)>=g}}}async draw(){if(this.pageView.detailView!==this)return;const t=this.pageView.renderingState===st.FINISHED||this.renderingState===st.FINISHED;this.renderingState!==st.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,pdfPage:s,viewport:a}=this.pageView;if(!s)throw this.renderingState=st.FINISHED,new Error("pdfPage is not loaded");this.renderingState=st.RUNNING;const r=this.pageView._ensureCanvasWrapper(),{canvas:o,prevCanvas:l}=this._createCanvas(b=>{var y;((y=r.firstElementChild)==null?void 0:y.tagName)==="CANVAS"?r.firstElementChild.after(b):r.prepe
553nd(b)},t);o.ariaHidden=!0,this.enableOptimizedPartialRendering&&(o.className="detailView");const{width:h,height:c}=a,d=n(this,as),{pixelRatio:p}=Gg,g=[p,0,0,p,-d.minX*p,-d.minY*p];o.width=d.width*p,o.height=d.height*p;const{style:v}=o;v.width=`${d.width*100/h}%`,v.height=`${d.height*100/c}%`,v.top=`${d.minY*100/c}%`,v.left=`${d.minX*100/h}%`;const w=this._drawCanvas(this._getRenderingContext(o,g),()=>{var b;(b=this.canvas)==null||b.remove(),this.canvas=l},()=>{this.dispatchPageRendered(!1,!0)});return e.setAttribute("data-loaded",!0),this.dispatchPageRender(),w}}as=new WeakMap,_b=new WeakSet,Y_=function(i){if(!n(this,as))return!0;const t=n(this,as).minX,e=n(this,as).minY,s=n(this,as).width+t,a=n(this,as).height+e;if(i.minX<t||i.minY<e||i.maxX>s||i.maxY>a)return!0;const{width:r,height:o,scale:l}=this.pageView.viewport;if(n(this,as).scale!==l)return!0;const h=i.minX-t,c=s-i.maxX,d=i.minY-e,p=a-i.maxY,g=.5,v=(1+g)/g;return t>0&&c/h>v||s<r&&h/c>v||e>0&&p/d>v||a<o&&d/p>v};const rA={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"rowgroup",TBody:"rowgroup",TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},K_=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"]),mm="http://www.w3.org/1998/Math/MathML";class oA{static get sanitizer(){return xu(this,"sanitizer",y_.isSanitizerSupported?new Sanitizer({elements:[...K_].map(t=>({name:t,namespace:mm})),replaceWithChildrenElements:[{name:"maction",namespace:mm}],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 YM=/^H(\d+)$/;var Md,As,Cd,vm,uu,Ea,xa,Is,cn,Bv,lA,jv,Eb;class q_{constructor(t,e){f(this,cn),f(this,Md),f(this,As,null),f(this,Cd),f(this,vm,new Map),f(this,uu),f(this,Ea,null),f(this,xa,null),f(this,Is,null),u(this,Md,t.getStructTree()),u(this,uu,e)}async render(){var t;if(n(this,Cd))return n(this,Cd);const{promise:e,resolve:s,reject:a}=Promise.withResolvers();u(this,Cd,e);try{u(this,As,m(this,cn,Eb).call(this,await n(this,Md)))}catch(r){a(r)}return u(this,Md,null),(t=n(this,As))==null||t.classList.add("structTree"),s(n(this,As)),e}async getAriaAttributes(t){try{return await this.render(),n(this,vm).get(t)}catch{}return null}hide(){n(this,As)&&!n(this,As).hidden&&(n(this,As).hidden=!0)}show(){var t;(t=n(this,As))!=null&&t.hidden&&(n(this,As).hidden=!1)}updateTextLayer(){var t;if(n(this,Ea)){for(const[e,s]of n(this,Ea))(t=document.getElementById(e))==null||t.append(s);n(this,Ea).clear(),u(this,Ea,null)}if(n(this,xa)){for(const e of n(this,xa)){const s=document.getElementById(e);s&&(s.ariaHidden=!0)}n(this,xa).length=0,u(this,xa,null)}if(n(this,Is)){for(let e=0,s=n(this,Is).length;e<s;e+=2){const a=n(this,Is)[e],r=n(this,Is)[e+1];let o="";for(const l of r){const h=document.getElementById(l);h&&(o+=h.textContent.trim()||"",h.ariaHidden="true")}o&&(a.textContent=o)}n(this,Is).length=0,u(this,Is,null)}}}Md=new WeakMap,As=new WeakMap,Cd=new WeakMap,vm=new WeakMap,uu=new WeakMap,Ea=new WeakMap,xa=new WeakMap,Is=new WeakMap,cn=new WeakSet,Bv=function(i,t){const{alt:e,id:s,lang:a}=i;if(e!==void 0){let r=!1;const o=ou(e);for(const l of i.children)l.type==="annotation"&&(n(this,vm).getOrInsertComputed(l.id,tS).set("aria-label",o),r=!0);r||t.setAttribute("aria-label",o)}s!==void 0&&t.setAttribute("aria-owns",s),a!==void 0&&t.setAttribute("lang",ou(a,!0))},lA=function(i,t){const{alt:e,bbox:s,children:a}=i,r=a==null?void 0:a[0];if(!n(this,uu)||!e||!s||(r==null?void 0:r.type)!=="content")return!1;const{id:o}=r;if(!o)return!1;t.setAttribute("aria-owns",o);const l=document.createElement("span");(n(this,Ea)||u(this,Ea,new Map)).set(o,l),l.setAttribute("role","img"),l.setAttribute("aria-label",ou(e));const{pageHeight:h,pageX:c,pageY:d}=n(this,uu),p="calc(var(--total-scale-factor) *",{style:g}=l;return g.width=`${p}${s[2]-s[0]}px)`,g.height=`${p}${s[3]-s[1]}px)`,g.left=`${p}${s[0]-c}px)`,g.top=`${p}${h-s[3]+d}px)`,!0}
553,jv=function(i,t){if(i){"id"in i&&t.push(i.id);for(const e of i.children||[])m(this,cn,jv).call(this,e,t)}},Eb=function(i,t=[]){var e,s;if(!i)return null;let a,r=!0;if("role"in i){const{role:o}=i;if(K_.has(o)){a=document.createElementNS(mm,o);const h=[];(n(this,Is)||u(this,Is,[])).push(a,h);for(const{type:c,id:d}of i.children||[])c==="content"&&d&&h.push(d)}else a=document.createElement("span");const l=o.match(YM);if(l?(a.setAttribute("role","heading"),a.setAttribute("aria-level",l[1])):rA[o]&&a.setAttribute("role",o==="TH"&&((e=t.at(-1))==null?void 0:e.role)==="TR"&&((s=t.at(-2))==null?void 0:s.role)==="TBody"?"rowheader":rA[o]),o==="Figure"&&m(this,cn,lA).call(this,i,a))return a;o==="Formula"&&(i.mathML&&oA.sanitizer&&(r=!1,a.setHTML(i.mathML,{sanitizer:oA.sanitizer}),m(this,cn,jv).call(this,i,n(this,xa)||u(this,xa,[])),delete i.alt),!i.mathML&&i.children.length===1&&i.children[0].role!=="math"&&(a=document.createElementNS(mm,"math"),delete i.alt))}if(a||(a=document.createElement("span")),m(this,cn,Bv).call(this,i,a),i.children){if(i.children.length===1&&"id"in i.children[0])m(this,cn,Bv).call(this,i.children[0],a);else if(r){t.push(i);for(const o of i.children)a.append(m(this,cn,Eb).call(this,o,t));t.pop()}}return a};var sa,Zi,na,Gr,pu,hf,cf,xb;const Q_=class df{constructor(){f(this,cf),f(this,sa,!1),f(this,Zi,null),f(this,na,new Map),f(this,Gr,new Map)}setTextMapping(t){u(this,Zi,t)}enable(){if(n(this,sa))throw new Error("TextAccessibilityManager is already enabled.");if(!n(this,Zi))throw new Error("Text divs and strings have not been set.");if(u(this,sa,!0),u(this,Zi,n(this,Zi).slice()),n(this,Zi).sort(m(df,pu,hf)),n(this,na).size>0){const t=n(this,Zi);for(const[e,s]of n(this,na)){if(!document.getElementById(e)){n(this,na).delete(e);continue}m(this,cf,xb).call(this,e,t[s])}}for(const[t,e]of n(this,Gr))this.addPointerInTextLayer(t,e);n(this,Gr).clear()}disable(){n(this,sa)&&(n(this,Gr).clear(),u(this,Zi,null),u(this,sa,!1))}removePointerInTextLayer(t){if(!n(this,sa)){n(this,Gr).delete(t);return}const e=n(this,Zi);if(!e||e.length===0)return;const{id:s}=t,a=n(this,na).get(s);if(a===void 0)return;const r=e[a];n(this,na).delete(s);let o=r.getAttribute("aria-owns");o!=null&&o.includes(s)&&(o=o.split(" ").filter(l=>l!==s).join(" "),o?r.setAttribute("aria-owns",o):(r.removeAttribute("aria-owns"),r.setAttribute("role","presentation")))}addPointerInTextLayer(t,e){const{id:s}=t;if(!s)return null;if(!n(this,sa))return n(this,Gr).set(t,e),null;e&&this.removePointerInTextLayer(t);const a=n(this,Zi);if(!a||a.length===0)return null;const r=ku(a,c=>{var d;return m(d=df,pu,hf).call(d,t,c)<0}),o=Math.max(0,r-1),l=a[o];m(this,cf,xb).call(this,s,l),n(this,na).set(s,o);const h=l.parentNode;return h!=null&&h.classList.contains("markedContent")?h.id:null}moveElementInDOM(t,e,s,a){const r=this.addPointerInTextLayer(s,a);if(!t.hasChildNodes())return t.append(e),r;const o=Array.from(t.childNodes).filter(h=>h!==e);if(o.length===0)return r;const l=ku(o,h=>{var c;return m(c=df,pu,hf).call(c,e,h)<0});return l===0?o[0].before(e):o[l-1].after(e),r}};sa=new WeakMap,Zi=new WeakMap,na=new WeakMap,Gr=new WeakMap,pu=new WeakSet,hf=function(i,t){const e=i.getBoundingClientRect(),s=t.getBoundingClientRect();if(e.width===0&&e.height===0)return 1;if(s.width===0&&s.height===0)return-1;const a=e.y,r=e.y+e.height,o=e.y+e.height/2,l=s.y,h=s.y+s.height,c=s.y+s.height/2;if(o<=l&&c>=r)return-1;if(c<=a&&o>=h)return 1;const d=e.x+e.width/2,p=s.x+s.width/2;return d-p},cf=new WeakSet,xb=function(i,t){const e=t.getAttribute("aria-owns");e!=null&&e.includes(i)||t.setAttribute("aria-owns",e?`${e} ${i}`:i),t.removeAttribute("role")},f(Q_,pu);let KM=Q_;var Xr;class qM{constructor({findController:t,eventBus:e,pageIndex:s}){f(this,Xr,null),this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=s,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,Xr)||(u(this,Xr,new AbortController),this.eventBus._on("updatetextlayermatches",t=>{(t.pageIndex===this.pageIdx||t.pageIndex===-1)&&this._updateMatches()},{signal:n(this,Xr).signal})),this._updateMatches()}disable(){var t;this.enabled&&(this.enabled=!1,(t=n(this,Xr))==null||t.abort(),u(this,Xr,null),this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];const{textContentItemsStr:s}=this;let a=0,r=0;const o=s.length-1,l=[];for(let h=0,c=t.length;h<c;h++){let d=t[h];for(;a!==o&&d>=r+s[a].length;)r+=s[a].length,a++;a===s.length&&console.error("Could not find a matching mapping");const p={begin:{divIdx:a,offset:d-r}};for(d+=e[h];a!==o&&d>r+s[a].length;)r+=s[a].length,a++;p.end={divIdx:a,offset:d-r},l.push(p)}return l}_renderMatches(t){if(t.length===0)return;const{findController:e,pageIdx:s}=this,{textContentItemsStr:a,textDivs:r}=this,o=s===e.selected.pageIdx,l=e.selected.matchIdx,h=e.state.highlightAll;let c=null;const d={offset:void 0};function p(A,_){const E=A.divIdx;return r[E].textContent="",g(E,0,A.offset,_)}function g(A,_,E,x){let k=r[A];if(k.nodeType===Node.TEXT_NODE){const P=document.createElement("span");k.before(P),P.append(k),r[A]=P,k=P}const C=a[A].substring(_,E),I=document.createTextNode(C);if(x){const P=document.createElement("span");return P.className=`${x} appended`,P.append(I),k.append(P),x.includes("selected")?P:null}return k.append(I),0}let v=l,w=v+1;if(h)v=0,w=t.length;else if(!o)return;let b=-1,y=-1;for(let A=v;A<w;A++){const _=t[A],E=_.begin;if(E.divIdx===b&&E.offset===y)continue;b=E.divIdx,y=E.offset;const x=_.end,k=o&&A===l,C=k?" selected":"";let I=null;if(!c||E.divIdx!==c.divIdx?(c!==null&&g(c.divIdx,c.offset,d.offset),p(E)):g(c.divIdx,c.offset,E.offset),E.divIdx===x.divIdx)I=g(E.divIdx,E.offset,x.offset,"highlight"+C);else{I=g(E.divIdx,E.offset,d.offset,"highlight begin"+C);for(let P=E.divIdx+1,M=x.divIdx;P<M;P++)r[P].className="highlight middle"+C;p(x,"highlight end"+C)}c=x,k&&e.scrollMatchIntoView({element:I,pageIndex:s,matchIndex:l})}c&&g(c.divIdx,c.offset,d.offset)}_updateMatches(t=!1){if(!this.enabled&&!t)return;const{findController:e,matches:s,pageIdx:a}=this,{textContentItemsStr:r,textDivs:o}=this;let l=-1;for(const d of s){const p=Math.max(l,d.begin.divIdx);for(let g=p,v=d.end.divIdx;g<=v;g++){const w=o[g];w.textContent=r[g],w.className=""}l=d.end.divIdx+1}if(!(e!=null&&e.highlightMatches)||t)return;const h=e.pageMatches[a]||null,c=e.pageMatchesLength[a]||null;this.matches=this._convertMatches(h,c),this._renderMatches(this.matches)}}Xr=new WeakMap;var wm,bm,uf,Wl,an,ai,jn,kb,J_,pf,Z_,hA;const Bl=class tE{constructor({pdfPage:t,highlighter:e=null,accessibilityManager:s=null,enablePermissions:a=!1,onAppend:r=null,abortSignal:o=null}){f(this,kb),f(this,wm,null),f(this,bm,!1),f(this,uf,null),f(this,Wl,!1),f(this,an,null),this.pdfPage=t,this.highlighter=e,this.accessibilityManager=s,u(this,bm,a===!0),u(this,uf,r),u(this,wm,o),this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}
553async render({viewport:t,images:e,textContentParams:s=null}){var a,r,o,l,h;if(n(this,Wl)&&n(this,an)){n(this,an).update({viewport:t,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),u(this,an,new sS({textContentSource:this.pdfPage.streamTextContent(s||{includeMarkedContent:!0,disableNormalization:!0}),images:e,container:this.div,viewport:t}));const{textDivs:c,textContentItemsStr:d}=n(this,an);(a=this.highlighter)==null||a.setTextMapping(c,d),(r=this.accessibilityManager)==null||r.setTextMapping(c),await n(this,an).render(),u(this,Wl,!0);const p=document.createElement("div");p.className="endOfContent",this.div.append(p),m(this,kb,J_).call(this,p),(o=n(this,uf))==null||o.call(this,this.div),(l=this.highlighter)==null||l.enable(),(h=this.accessibilityManager)==null||h.enable()}hide(){var t;!this.div.hidden&&n(this,Wl)&&((t=this.highlighter)==null||t.disable(),this.div.hidden=!0)}show(){var t;this.div.hidden&&n(this,Wl)&&(this.div.hidden=!1,(t=this.highlighter)==null||t.enable())}cancel(){var t,e,s,a;(t=n(this,an))==null||t.cancel(),u(this,an,null),(e=this.highlighter)==null||e.disable(),(s=this.accessibilityManager)==null||s.disable(),m(a=tE,pf,Z_).call(a,this.div)}};wm=new WeakMap,bm=new WeakMap,uf=new WeakMap,Wl=new WeakMap,an=new WeakMap,ai=new WeakMap,jn=new WeakMap,kb=new WeakSet,J_=function(i){var t;const{div:e}=this,s=n(this,wm),a=s?{signal:s}:null;e.addEventListener("mousedown",()=>{e.classList.add("selecting")},a),e.addEventListener("copy",r=>{if(!n(this,bm)){const o=document.getSelection();r.clipboardData.setData("text/plain",ou(iS(o.toString())))}rb(r)},a),n(Bl,ai).set(e,i),m(t=Bl,pf,hA).call(t,s)},pf=new WeakSet,Z_=function(i){var t;n(this,ai).delete(i),n(this,ai).size===0&&((t=n(this,jn))==null||t.abort(),u(this,jn,null))},hA=function(i){if(n(this,jn))return;u(this,jn,new AbortController);const t=i?AbortSignal.any([n(this,jn).signal,i]):n(this,jn).signal,e=(o,l)=>{l.append(o),o.style.width="",o.style.height="",l.classList.remove("selecting")};let s=!1;document.addEventListener("pointerdown",()=>{s=!0},{signal:t}),document.addEventListener("pointerup",()=>
553{s=!1,n(this,ai).forEach(e)},{signal:t}),window.addEventListener("blur",()=>{s=!1,n(this,ai).forEach(e)},{signal:t}),document.addEventListener("keyup",()=>{s||n(this,ai).forEach(e)},{signal:t});var a,r;document.addEventListener("selectionchange",()=>{var o,l;const h=document.getSelection();if(h.rangeCount===0){n(this,ai).forEach(e);return}const c=new Set;for(let b=0;b<h.rangeCount;b++){const y=h.getRangeAt(b);for(const A of n(this,ai).keys())!c.has(A)&&y.intersectsNode(A)&&c.add(A)}for(const[b,y]of n(this,ai))c.has(b)?b.classList.add("selecting"):e(y,b);if(a??(a=getComputedStyle(n(this,ai).values().next().value).getPropertyValue("-moz-user-select")==="none"),a)return;const d=h.getRangeAt(0),p=r&&(d.compareBoundaryPoints(Range.END_TO_END,r)===0||d.compareBoundaryPoints(Range.START_TO_END,r)===0);let g=p?d.startContainer:d.endContainer;if(g.nodeType===Node.TEXT_NODE&&(g=g.parentNode),(o=g.classList)!=null&&o.contains("highlight")&&(g=g.parentNode),!p&&d.endOffset===0)do{for(;!g.previousSibling;)g=g.parentNode;g=g.previousSibling}while(!g.childNodes.length);const v=(l=g.parentElement)==null?void 0:l.closest(".textLayer"),w=n(this,ai).get(v);w&&(w.style.width=v.style.width,w.style.height=v.style.height,w.style.userSelect="text",g.parentElement.insertBefore(w,p?g:g.nextSibling)),r=d.cloneRange()},{signal:t})},f(Bl,pf),f(Bl,ai,new Map),f(Bl,jn,null);let eE=Bl;class iE{constructor({pdfPage:t,annotationStorage:e=null,linkService:s,xfaHtml:a=null}){this.pdfPage=t,this.annotationStorage=e,this.linkService=s,this.xfaHtml=a,this.div=null,this._cancelled=!1}async render({viewport:t,intent:e="display"}){if(e==="print"){const r={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div=document.createElement("div"),r.div=this.div,kv.render(r)}const s=await this.pdfPage.getXfa();if(this._cancelled||!s)return{textDivs:[]};const a={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:s,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div?kv.update(a):(this.div=document.createElement("div"),a.div=this.div,kv.render(a))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}const QM={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new n0}},JM=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);var Pd,aa,Yr,Td,Id,Dd,gf,_s,Na,Ld,ff,mf,vf,jl,wf,ra,mo,ot,hh,bf,xc,Sb,Mb,Cb,Pb,Tb,cA,dA,sE,Ib;const ZM=class nE extends X_{constructor(t){var e,s;super(t),f(this,ot),f(this,Pd,null),f(this,aa,Rs.ENABLE_FORMS),f(this,Yr,null),f(this,Td,null),f(this,Id,!0),f(this,Dd,!1),f(this,gf,!1),f(this,_s,null),f(this,Na,!1),f(this,Ld,null),f(this,ff,null),f(this,mf,1),f(this,vf,1),f(this,jl,Ns.ENABLE),f(this,wf,1),f(this,ra,{directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0}),f(this,mo,[null,null,null,null]);const{container:a,defaultViewport:r}=t;this.renderingId="page"+this.id,u(this,_s,t.layerProperties||QM),u(this,Pd,t.abortSignal||null),this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=t.scale||__,this.viewport=r,this.pdfPageRotate=r.rotation,this._optionalContentConfigPromise=t.optionalContentConfigPromise||null,u(this,jl,t.textLayerMode??Ns.ENABLE),u(this,aa,t.annotationMode??Rs.ENABLE_FORMS),this.imageResourcesPath=t.imageResourcesPath||"",this.enableDetailCanvas=t.enableDetailCanvas??!0,this.maxCanvasPixels=t.maxCanvasPixels??Wv.get("maxCanvasPixels"),this.maxCanvasDim=t.maxCanvasDim||Wv.get("maxCanvasDim"),this.capCanvasAreaFactor=t.capCanvasAreaFactor??Wv.get("capCanvasAreaFactor"),u(this,Id,t.enableAutoLinking!==!1),u(this,Td,t.commentManager||null),this.l10n=t.l10n,this.l10n||(this.l10n=new Om),this._isStandalone=!((e=this.renderingQueue)!=null&&e.hasViewer()),this._container=a,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null,this.detailVie
553w=null;const o=document.createElement("div");if(o.className="page",o.setAttribute("data-page-number",this.id),o.setAttribute("role","region"),o.setAttribute("data-l10n-id","pdfjs-page-landmark"),o.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=o,m(this,ot,bf).call(this),a==null||a.append(o),this._isStandalone){a==null||a.style.setProperty("--scale-factor",this.scale*An.PDF_TO_CSS_UNITS),(s=this.pageColors)!=null&&s.background&&(a==null||a.style.setProperty("--page-bg-color",this.pageColors.background));const{optionalContentConfigPromise:l}=t;l&&l.then(h=>{l===this._optionalContentConfigPromise&&(n(this,ra).initialOptionalContent=h.hasInitialVisibility)}),t.l10n||this.l10n.translate(this.div)}}clone(t){const e=new nE({container:null,eventBus:this.eventBus,pagesColors:this.pageColors,renderingQueue:this.renderingQueue,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,minDurationToUpdateCanvas:this.minDurationToUpdateCanvas,defaultViewport:this.viewport,id:t,layerProperties:n(this,_s),abortSignal:n(this,Pd),scale:this.scale,optionalContentConfigPromise:this._optionalContentConfigPromise,textLayerMode:n(this,jl),annotationMode:n(this,aa),imageResourcesPath:this.imageResourcesPath,enableDetailCanvas:this.enableDetailCanvas,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableAutoLinking:n(this,Id),commentManager:n(this,Td),l10n:this.l10n});return e.setPdfPage(this.pdfPage.clone(t-1)),e}updatePageNumber(t){var e;if(this.id===t)return;const s=this.id;this.id=t,this.renderingId=`page${t}`,this.pdfPage&&(this.pdfPage.pageNumber=t),this.setPageLabel(this.pageLabel);const{div:a}=this;a.setAttribute("data-page-number",t),a.setAttribute("data-l10n-args",JSON.stringify({page:t})),this._textHighlighter.pageIdx=t-1,(e=n(this,_s).annotationEditorUIManager)==null||e.updatePageIndex(s-1,t-1)}setPdfPage(t){var e,s,a,r;this._isStandalone&&(((e=this.pageColors)==null?void 0:e.foreground)==="CanvasText"||((s=this.pageColors)==null?void 0:s.background)==="Canvas")&&((a=this._container)==null||a.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),(r=this._container)==null||r.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=t,this.pdfPageRotate=t.rotate;const o=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:this.scale*An.PDF_TO_CSS_UNITS,rotation:o}),m(this,ot,bf).call(this),this.reset()}destroy(){var t;this.reset(),(t=this.pdfPage)==null||t.cleanup()}deleteMe(t){var e;if(t){this.div.remove();return}this.destroy(),(e=n(this,_s).annotationEditorUIManager)==null||e.deletePage(this.id)}hasEditableAnnotations(){var t;return!!((t=this.annotationLayer)!=null&&t.hasEditableAnnotations())}get _textHighlighter(){return xu(this,"_textHighlighter",new qM({pageIndex:this.id-1,eventBus:this.eventBus,findController:n(this,_s).findController}))}_resetCanvas(){super._resetCanvas(),u(this,Ld,null)}reset({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:s=!1,keepTextLayer:a=!1,keepCanvasWrapper:r=!1,preserveDetailViewState:o=!1}={}){var l,h,c,d,p,g,v;const w=((l=this.pdfPage)==null?void 0:l._pdfBug)??!1;this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:e,keepXfaLayer:s,keepTextLayer:a}),this.renderingState=st.INITIAL;const b=this.div,y=b.childNodes,A=t&&((h=this.annotationLayer)==null?void 0:h.div)||null,_=e&&((c=this.annotationEditorLayer)==null?void 0:c.div)||null,E=s&&((d=this.xfaLayer)==null?void 0:d.div)||null,x=a&&((p=this.textLayer)==null?void 0:p.div)||null,k=r&&n(this,Yr)||null;for(let C=y.length-1;C>=0;C--){const I=y[C];switch(I){case A:case _:case E:case x:case k:continue}if(w&&I.classList.contains("pdfBugGroupsLayer"))continue;I.remove();const P=n(this,mo).indexOf(I);P>=0&&(n(this,mo)[P]=null)}b.removeAttribute("data-loaded"),A&&this.annotationLayer.hide(),_&&this.annotationEditorLayer.hide(),E&&this.xfaLayer.hide(),x&&this.textLayer.hide(),(g=this.structTreeLayer)==null||g.hide(),!r&&n(this,Yr)&&(u(this,Yr,null),this._resetCanvas()),o||((v=this.detailVie
553w)==null||v.reset({keepCanvas:r}),r||(this.detailView=null))}toggleEditingMode(t){u(this,gf,t),this.hasEditableAnnotations()&&this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0})}updateVisibleArea(t){this.enableDetailCanvas&&(n(this,Na)&&this.maxCanvasPixels>0&&t?(this.detailView??(this.detailView=new XM({pageView:this,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:-1})),this.detailView.update({visibleArea:t})):this.detailView&&(this.detailView.reset(),this.detailView=null))}update({scale:t=0,rotation:e=null,optionalContentConfigPromise:s=null,drawingDelay:a=-1}){var r,o,l;this.scale=t||this.scale,typeof e=="number"&&(this.rotation=e),s instanceof Promise&&(this._optionalContentConfigPromise=s,s.then(c=>{s===this._optionalContentConfigPromise&&(n(this,ra).initialOptionalContent=c.hasInitialVisibility)})),n(this,ra).directDrawing=!0;const h=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*An.PDF_TO_CSS_UNITS,rotation:h}),m(this,ot,bf).call(this),this._isStandalone&&((r=this._container)==null||r.style.setProperty("--scale-factor",this.viewport.scale)),m(this,ot,Ib).call(this),this.canvas){const c=n(this,Dd)&&n(this,Na),d=a>=0&&a<1e3;if(d||c){d&&!c&&this.renderingState!==st.FINISHED&&(this.cancelRendering({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:a}),this.renderingState=st.FINISHED,n(this,ra).directDrawing=!1),this.cssTransform({redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!d,hideTextLayer:d}),d||((o=this.detailView)==null||o.update({underlyingViewUpdated:!0}),this.dispatchPageRendered(!0,!1));return}}this.cssTransform({}),this.reset({keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,keepCanvasWrapper:!0,preserveDetailViewState:!0}),(l=this.detailView)==null||l.update({underlyingViewUpdated:!0})}cancelRendering({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:s=!1,keepTextLayer:a=!1,cancelExtraDelay:r=0}={}){var o;super.cancelRendering({cancelExtraDelay:r}),this.textLayer&&(!a||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!t||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!e||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!s||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,(o=this._textHighlighter)==null||o.disable())}cssTransform({redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:e=!1,redrawXfaLayer:s=!1,redrawTextLayer:a=!1,hideTextLayer:r=!1}){var o;const{canvas:l}=this;if(!l)return;const h=n(this,Ld);if(this.viewport!==h){const c=(360+this.viewport.rotation-h.rotation)%360;if(c===90||c===270){const{width:d,height:p}=this.viewport,g=p/d,v=d/p;l.style.transform=`rotate(${c}deg) scale(${g},${v})`}else l.style.transform=c===0?"":`rotate(${c}deg)`}t&&this.annotationLayer&&m(this,ot,Sb).call(this),e&&this.annotationEditorLayer&&(this.drawLayer&&m(this,ot,Cb).call(this),m(this,ot,Mb).call(this)),s&&this.xfaLayer&&m(this,ot,Pb).call(this),this.textLayer&&(r?(this.textLayer.hide(),(o=this.structTreeLayer)==null||o.hide()):a&&m(this,ot,Tb).call(this))}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(t,e){return this.viewport.convertToPdfPoint(t,e)}_ensureCanvasWrapper(){let t=n(this,Yr);return t||(t=u(this,Yr,document.createElement("div")),t.classList.add("canvasWrapper"),m(this,ot,hh).call(this,t,"canvasWrapper")),t}_getRenderingContext(t,e,s,a){return{canvas:t,transform:e,viewport:this.viewport,annotationMode:n(this,aa),optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors,isEditing:n(this,gf),recordOperations:s,recordImages:a}}async draw(){this.renderingState!==st.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());
553const{div:t,l10n:e,pdfPage:s,viewport:a}=this;if(!s)throw this.renderingState=st.FINISHED,new Error("pdfPage is not loaded");this.renderingState=st.RUNNING;const r=this._ensureCanvasWrapper();if(!this.textLayer&&n(this,jl)!==Ns.DISABLE&&!s.isPureXfa&&(this._accessibilityManager||(this._accessibilityManager=new KM),this.textLayer=new eE({pdfPage:s,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:n(this,jl)===Ns.ENABLE_PERMISSIONS,onAppend:k=>{this.l10n.pause(),m(this,ot,hh).call(this,k,"textLayer"),this.l10n.resume()},abortSignal:n(this,Pd)})),!this.annotationLayer&&n(this,aa)!==Rs.DISABLE){const{annotationStorage:k,annotationEditorUIManager:C,downloadManager:I,enableComment:P,enableScripting:M,fieldObjectsPromise:D,hasJSActionsPromise:L,linkService:W}=n(this,_s);this._annotationCanvasMap||(this._annotationCanvasMap=new Map),this.annotationLayer=new N_({pdfPage:s,annotationStorage:k,imageResourcesPath:this.imageResourcesPath,renderForms:n(this,aa)===Rs.ENABLE_FORMS,linkService:W,downloadManager:I,enableComment:P,enableScripting:M,hasJSActionsPromise:L,fieldObjectsPromise:D,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:C,commentManager:n(this,Td),onAppend:$=>{m(this,ot,hh).call(this,$,"annotationLayer")}})}const{width:o,height:l}=a;u(this,Ld,a);const{canvas:h,prevCanvas:c}=this._createCanvas(k=>{r.prepend(k)});h.setAttribute("role","presentation"),this.outputScale||m(this,ot,Ib).call(this);const{outputScale:d}=this;u(this,Dd,n(this,Na));const p=Iy(d.sx),g=Iy(d.sy),v=h.width=Tp(Ip(o*d.sx),p[0]),w=h.height=Tp(Ip(l*d.sy),g[0]),b=Tp(Ip(o),p[1]),y=Tp(Ip(l),g[1]);d.sx=v/b,d.sy=w/y,n(this,mf)!==p[1]&&(t.style.setProperty("--scale-round-x",`${p[1]}px`),u(this,mf,p[1])),n(this,vf)!==g[1]&&(t.style.setProperty("--scale-round-y",`${g[1]}px`),u(this,vf,g[1]));const A=this.enableOptimizedPartialRendering&&n(this,Dd)&&!this.recordedBBoxes,_=this.imagesRightClickMinSize!==-1&&!this.imageCoordinates,E=d.scaled?[d.sx,0,0,d.sy,0,0]:null,x=this._drawCanvas(this._getRenderingContext(h,E,A,_),()=>{c==null||c.remove(),this._resetCanvas()},k=>{n(this,ra).regularAnnotations=!k.separateAnnots,this.dispatchPageRendered(!1,!1)}).then(async()=>{var k;if(this.renderingState!==st.FINISHED)return;this.structTreeLayer||(this.structTreeLayer=new q_(s,a.rawDims));const C=m(this,ot,Tb).call(this);this.annotationLayer&&(await m(this,ot,Sb).call(this),n(this,Id)&&this.annotationLayer&&this.textLayer&&await m(this,ot,sE).call(this,C));const{annotationEditorUIManager:I}=n(this,_s);I&&(this.drawLayer||(this.drawLayer=new GM),await m(this,ot,Cb).call(this),this.drawLayer.setParent(r),(this.annotationLayer||n(this,aa)===Rs.DISABLE)&&(this.annotationEditorLayer||(this.annotationEditorLayer=new UM({uiManager:I,pageIndex:this.id-1,l10n:e,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:(k=this.annotationLayer)==null?void 0:k.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:P=>{m(this,ot,hh).call(this,P,"annotationEditorLayer")}})),m(this,ot,Mb).call(this)))});if(s.isPureXfa){if(!this.xfaLayer){const{annotationStorage:k,linkService:C}=n(this,_s);this.xfaLayer=new iE({pdfPage:s,annotationStorage:k,linkService:C})}m(this,ot,Pb).call(this)}return t.setAttribute("data-loaded",!0),this.dispatchPageRender(),x}setPageLabel(t){this.pageLabel=typeof t=="string"?t: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:t,initialOptionalContent:e,regularAnnotations:s}=n(this,ra);return t&&e&&s?this.canvas:null}};Pd=new WeakMap,aa=new WeakMap,Yr=new WeakMap,Td=new WeakMap,Id=new WeakMap,Dd=new WeakMap,gf=new WeakMap,_s=new WeakMap,Na=new WeakMap,Ld=new WeakMap,ff=new WeakMap,mf=new WeakMap,vf=new WeakMap,jl=new WeakMap,wf=new WeakMap,ra=new WeakMap,mo=new WeakMap,ot=new WeakSet,hh=function(i,t){const e=JM.get(t),s=n(this,mo)[e];if(n(this,mo)[e]=i,s){s.replaceWith(i);return}for(let a=e-1;a>=0;a--){const r=n(this,mo)[a];if(r){r.after(i);return}}this.div.prepend(i)},bf=function(){const{div:i,viewport:t}=this;if(t.userUnit!==n(this,wf)&&(t.userUnit!==1?i.style.setProperty("--user-unit",t.userUnit):i.style.removeProperty("--user-unit"),u(this,wf,t.userUnit)),this.pdfPage){if(n(this,ff)===t.rotation)return;u(this,ff,t.rotation)}A_(i,t,!0,!1)},xc=function(i,t){this.eventBus.dispatch(i,{source:this,pageNumber:this.id,error:t})},Sb=async function(){let i=null;try{await this.annotationLayer.render({viewport:this.viewport,intent:"display",structTreeLayer:this.structTreeLayer})}catch(t){console.error("#renderAnnotationLayer:",t),i=t}finally{m(this,ot,xc).call(this,"annotationlayerrendered",i)}},Mb=async function(){let i=null;try{await this.annotationEditorLayer.render({viewport:this.viewport,intent:"display"})}catch(t){console.error("#renderAnnotationEditorLayer:",t),i=t}finally{m(this,ot,xc).call(this,"annotationeditorlayerrendered",i)}},Cb=async function(){try{await this.drawLayer.render({intent:"display"})}catch(i){console.error("#renderDrawLayer:",i)}},Pb=async function(){var i;let t=null;try{const e=await this.xfaLayer.render({viewport:this.viewport,intent:"display"});e!=null&&e.textDivs&&this._textHighlighter&&m(this,ot,dA).call(this,e.textDivs)}catch(e){console.error("#renderXfaLayer:",e),t=e}finally{(i=this.xfaLayer)!=null&&i.div&&(this.l10n.pause(),m(this,ot,hh).call(this,this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),m(this,ot,xc).call(this,"xfalayerrendered",t)}},Tb=async function(){if(!this.textLayer)return;let i=null;try{await this.textLayer.render({viewport:this.viewport,images:this.imageCoordinates?new nS(this.imagesRightClickMinSize,this.imageCoordinates,this.viewport,()=>this.canvas):null})}catch(t){if(t instanceof zk)return;console.error("#renderTextLayer:",t),i=t}m(this,ot,xc).call(this,"textlayerrendered",i),m(this,ot,cA).call(this)},cA=async function(){var i,t,e;if(!this.textLayer)return;const s=await((i=this.structTreeLayer)==null?void 0:i.render());s&&(this.l10n.pause(),(t=this.structTreeLayer)==null||t.updateTextLayer(),this.canvas&&s.parentNode!==this.canvas&&this.canvas.append(s),this.l10n.resume()),(e=this.structTreeLayer)==null||e.show()},dA=async function(i){const t=await this.pdfPage.getTextContent(),e=[];for(const s of t.items)e.push(s.str);this._textHighlighter.setTextMapping(i,e),this._textHighlighter.enable()},sE=async function(i){try{if(await i,!this.annotationLayer)return;await this.annotationLayer.injectLinkAnnotations(of.processLinks(this))}catch(t){console.error("#injectLinkAnnotations:",t)}},Ib=function(){const{width:i,height:t}=this.viewport,e=this.outputScale=new Gg;if(this.maxCanvasPixels===0){const s=1/this.scale;e.sx*=s,e.sy*=s,u(this,Na,!0)}else if(u(this,Na,e.limitCanvas(i,t,this.maxCanvasPixels,this.maxCanvasDim,this.capCanvasAreaFactor)),n(this,Na)&&this.enableDetailCanvas){const s=this.enableOptimizedPartialRendering?4:2;e.sx/=s,e.sy/=s}};let aE=ZM;async function tC(i){const t="",e="",{info:s,metadata:a,contentDispositionFilename:r,contentLength:o}=await i.getMetadata();return{...s,baseURL:e,filesize:o||(await i.getDownloadInfo()).length,filename:r||qk(t),metadata:a==null?void 0:a.getRaw(),authors:a==null?void 0:a.get("dc:creator"),numPages:i.numPages,URL:t}}class eC{constructor(t,e){this._ready=new Promise((s,a)=>{import(t).then(r=>{s(r.QuickJSSandbox(new URL(e,location.href).href))}).catch(a)})}async createSandbox(t){(await this._ready).create(t)}async dispatchEventInSandbox(t){const e=await this._ready;setTimeout(()=>
553e.dispatchEvent(t),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}var dn,ch,yf,kh,Sh,ym,ii,ka,gu,he,os,ci,rE,Af,Db,oE,Rd;class iC{constructor({eventBus:t,externalServices:e=null,docProperties:s=null}){f(this,ci),f(this,dn,null),f(this,ch,null),f(this,yf,null),f(this,kh,null),f(this,Sh,null),f(this,ym,null),f(this,ii,null),f(this,ka,null),f(this,gu,!1),f(this,he,null),f(this,os,null),u(this,Sh,t),u(this,ym,e),u(this,yf,s)}setViewer(t){u(this,ka,t)}async setDocument(t){var e;if(n(this,ii)&&await m(this,ci,Rd).call(this),u(this,ii,t),!t)return;const[s,a,r]=await Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!s&&!r){await m(this,ci,Rd).call(this);return}if(t!==n(this,ii))return;try{u(this,he,m(this,ci,oE).call(this))}catch(h){console.error("setDocument:",h),await m(this,ci,Rd).call(this);return}const o=n(this,Sh);u(this,kh,new AbortController);const{signal:l}=n(this,kh);o._on("updatefromsandbox",h=>{(h==null?void 0:h.source)===window&&m(this,ci,rE).call(this,h.detail)},{signal:l}),o._on("dispatcheventinsandbox",h=>{var c;(c=n(this,he))==null||c.dispatchEventInSandbox(h.detail)},{signal:l}),o._on("pagechanging",({pageNumber:h,previous:c})=>{h!==c&&(m(this,ci,Db).call(this,c),m(this,ci,Af).call(this,h))},{signal:l}),o._on("pagerendered",({pageNumber:h})=>{this._pageOpenPending.has(h)&&h===n(this,ka).currentPageNumber&&m(this,ci,Af).call(this,h)},{signal:l}),o._on("pagesdestroy",async()=>{var h,c;await m(this,ci,Db).call(this,n(this,ka).currentPageNumber),await((h=n(this,he))==null?void 0:h.dispatchEventInSandbox({id:"doc",name:"WillClose"})),(c=n(this,dn))==null||c.resolve()},{signal:l});try{const h=await n(this,yf).call(this,t);if(t!==n(this,ii))return;await n(this,he).createSandbox({objects:s,calculationOrder:a,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...h,actions:r}}),o.dispatch("sandboxcreated",{source:this})}catch(h){console.error("setDocument:",h),await m(this,ci,Rd).call(this);return}await((e=n(this,he))==null?void 0:e.dispatchEventInSandbox({id:"doc",name:"Open"})),await m(this,ci,Af).call(this,n(this,ka).currentPageNumber,!0),Promise.resolve().then(()=>{t===n(this,ii)&&u(this,gu,!0)})}async dispatchWillSave(){var t;return(t=n(this,he))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){var t;return(t=n(this,he))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){var t;if(n(this,he)){await((t=n(this,os))==null?void 0:t.promise),u(this,os,Promise.withResolvers());try{await n(this,he).dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){throw n(this,os).resolve(),u(this,os,null),e}await n(this,os).promise}}async dispatchDidPrint(){var t;return(t=n(this,he))==null?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var t;return((t=n(this,ch))==null?void 0:t.promise)||null}get ready(){return n(this,gu)}get _pageOpenPending(){return xu(this,"_pageOpenPending",new Set)}get _visitedPages(){return xu(this,"_visitedPages",new Map)}}dn=new WeakMap,ch=new WeakMap,yf=new WeakMap,kh=new WeakMap,Sh=new WeakMap,ym=new WeakMap,ii=new WeakMap,ka=new WeakMap,gu=new WeakMap,he=new WeakMap,os=new WeakMap,ci=new WeakSet,rE=async function(i){var t,e;const s=n(this,ka),a=s.isInPresentationMode||s.isChangingPresentationMode,{id:r,siblings:o,command:l,value:h}=i;if(!r){switch(l){case"clear":console.clear();break;case"error":console.error(h);break;case"layout":if(!a){const d=PS(h);s.spreadMode=d.spreadMode}break;case"page-num":s.currentPageNumber=h+1;break;case"print":await s.pagesPromise,n(this,Sh).dispatch("print",{source:this});break;case"println":console.log(h);break;case"zoom":a||(s.currentScaleValue=h);break;case"SaveAs":n(this,Sh).dispatch("download",{source:this});break;case"FirstPage":s.currentPageNumber=1;break;case"LastPage":s.currentPageNumber=s.pagesCount;break;case"NextPage":s.nextPage();break;case"PrevPage":s.previousPage();break;case"ZoomViewIn":a||s.increaseScale();break;case"ZoomViewOut":a||s.decreaseScale();break;case"WillPrintFinished":(t=n(this,os))==null||t.resolve(),u(this,os,null);break}return}if(a&&i.focus)return;delete i.id,delete i.siblings;const c=o?[r,...o]:[r];for(const d of c){const p=document.querySelector(`[data-element-id="${d}"]`);p?p.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:i})):(e=n(this,ii))==null||e.annotationStorage.setValue(d,i)}},Af=async function(i,t=!1){const e=n(this,ii),s=this._visitedPages;if(t&&u(this,dn,Promise.withResolvers()),!n(this,dn))return;const a=n(this,ka).getPageView(i-1);if((a==null?void 0:a.renderingState)!==st.FINISHED){this._pageOpenPending.add(i);return}this._pageOpenPending.delete(i);const r=(async()=>{var o,l;const h=await(s.has(i)?null:(o=a.pdfPage)==null?void 0:o.getJSActions());e===n(this,ii)&&await((l=n(this,he))==null?void 0:l.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:i,actions:h}))})();s.set(i,r)},Db=async function(i){var t;const e=n(this,ii),s=this._visitedPages;if(!n(this,dn)||this._pageOpenPending.has(i))return;const a=s.get(i);a&&(s.set(i,null),await a,e===n(this,ii)&&await((t=n(this,he))==null?void 0:t.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:i})))},oE=function(){if(u(this,ch,Promise.withResolvers()),n(this,he))throw new Error("#initScripting: Scripting already exists.");return n(this,ym).createScripting()},Rd=async function(){var i,t,e,s;if(!n(this,he)){u(this,ii,null),(i=n(this,ch))==null||i.resolve();return}n(this,dn)&&(await Promise.race([n(this,dn).promise,new Promise(a=>{setTimeout(a,1e3)})]).catch(()=>{}),u(this,dn,null)),u(this,ii,null);try{await n(this,he).destroySandbox()}catch{}(t=n(this,os))==null||t.reject(new Error("Scripting destroyed.")),u(this,os,null),(e=n(this,kh))==null||e.abort(),u(this,kh,null),this._pageOpenPending.clear(),this._visitedPages.clear(),u(this,he,null),u(this,gu,!1),(s=n(this,ch))==null||s.resolve()};class lE extends iC{constructor(t){t.externalServices||window.addEventListener("updatefromsandbox",e=>{t.eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}),t.externalServices||(t.externalServices={createScripting:()=>new eC(t.sandboxBundleSrc,t.wasmUrl)}),t.docProperties||(t.docProperties=e=>tC(e)),super(t)}}const sC=3e4;var $l,Ul,_f,Nd;
553class nC{constructor(){f(this,$l,null),f(this,Ul,null),f(this,_f,null),f(this,Nd,null),S(this,"isThumbnailViewEnabled",!1),S(this,"onIdle",null),S(this,"printing",!1),Object.defineProperty(this,"hasViewer",{value:()=>!!n(this,Nd)})}setViewer(t){u(this,Nd,t)}setThumbnailViewer(t){u(this,_f,t)}isHighestPriority(t){return n(this,$l)===t.renderingId}renderHighestPriority(t){var e;n(this,Ul)&&(clearTimeout(n(this,Ul)),u(this,Ul,null)),!n(this,Nd).forceRendering(t)&&(this.isThumbnailViewEnabled&&(e=n(this,_f))!=null&&e.forceRendering()||this.printing||this.onIdle&&u(this,Ul,setTimeout(this.onIdle.bind(this),sC)))}getHighestPriority(t,e,s,a=!1,r=!1){const o=t.views,l=o.length;if(l===0)return null;for(let g=0;g<l;g++){const v=o[g].view;if(!this.isViewFinished(v))return v}if(!r)for(let g=0;g<l;g++){const{detailView:v}=o[g].view;if(v&&!this.isViewFinished(v))return v}const h=t.first.id,c=t.last.id;if(c-h+1>l){const g=t.ids;for(let v=1,w=c-h;v<w;v++){const b=s?h+v:c-v;if(g.has(b))continue;const y=e[b-1];if(!this.isViewFinished(y))return y}}let d=s?c:h-2,p=e[d];return p&&!this.isViewFinished(p)||a&&(d+=s?1:-1,p=e[d],p&&!this.isViewFinished(p))?p:null}isViewFinished(t){return t.renderingState===st.FINISHED}renderView(t){switch(t.renderingState){case st.FINISHED:return!1;case st.PAUSED:u(this,$l,t.renderingId),t.resume();break;case st.RUNNING:u(this,$l,t.renderingId);break;case st.INITIAL:u(this,$l,t.renderingId),t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof ab||console.error("renderView:",e)});break}return!0}}$l=new WeakMap,Ul=new WeakMap,_f=new WeakMap,Nd=new WeakMap;const uA=10,Np={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function pA(i){return Object.values(ei).includes(i)&&i!==ei.DISABLE}var Sa,Hl,Ef,Lb;class aC{constructor(t){f(this,Ef),f(this,Sa,new Set),f(this,Hl,0),u(this,Hl,t)}push(t){const e=n(this,Sa);e.has(t)&&e.delete(t),e.add(t),e.size>n(this,Hl)&&m(this,Ef,Lb).call(this)}resize(t,e=null){u(this,Hl,t);const s=n(this,Sa);if(e){const a=s.size;let r=1;for(const o of s)if(e.has(o.id)&&(s.delete(o),s.add(o)),++r>a)break}for(;s.size>n(this,Hl);)m(this,Ef,Lb).call(this)}has(t){return n(this,Sa).has(t)}[Symbol.iterator](){return n(this,Sa).keys()}}Sa=new WeakMap,Hl=new WeakMap,Ef=new WeakSet,Lb=function(){const i=n(this,Sa).keys().next().value;i==null||i.destroy(),n(this,Sa).delete(i)};var oa,xf,kf,is,me,Mh,Vl,fu,Sf,Mf,Cf,Pf,Tf,If,Df,Kr,Lf,mu,Ma,Ls,Ch,dh,Fd,ro,Rf,Od,Ph,pa,vu,Nf,wu,Ff,qr,ts,Qr,q,hE,cE,dE,bu,Am,gA,$v,fA,ga,Rb,uE,pE,gE,Nb,Fb,fE,Ob,Of,Wb;class r0{constructor(t){f(this,q),f(this,oa,null),f(this,xf,null),f(this,kf,null),f(this,is,ei.NONE),f(this,me,null),f(this,Mh,Rs.ENABLE_FORMS),f(this,Vl,null),f(this,fu,null),f(this,Sf,null),f(this,Mf,!1),f(this,Cf,!1),f(this,Pf,!1),f(this,Tf,!1),f(this,If,!0),f(this,Df,null),f(this,Kr,null),f(this,Lf,0),f(this,mu,null),f(this,Ma,!0),f(this,Ls,null),f(this,Ch,null),f(this,dh,null),f(this,Fd,!1),f(this,ro,null),f(this,Rf,0),f(this,Od,new ResizeObserver(m(this,q,fE).bind(this))),f(this,Ph,null),f(this,pa,null),f(this,vu,null),f(this,Nf,!0),f(this,wu,Ns.ENABLE),f(this,Ff,null),f(this,qr,null),f(this,ts,null),f(this,Qr,null);var e,s;const a="5.7.284";if(Cy!==a)throw new Error(`The API version "${Cy}" does not match the Viewer version "${a}".`);if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,u(this,Ff,t.viewerAlert||null),((e=this.container)==null?void 0:e.tagName)!=="DIV"||((s=this.viewer)==null?void 0:s.tagName)!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");n(this,Od).observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new n0,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,u(this,xf,t.altTextManager||null),u(this,Vl,t.commentManager||null),u(this,vu,t.signatureManager||null),u(this,Sf,t.editorUndoBar||null),this.findController&&(this.findController.onIsPageVisible=o=>this._getVisiblePages().ids.has(o)),this._scriptingManager=t.scriptingManager||null,u(this,wu,t.textLayerMode??Ns.ENABLE),u(this,Mh,t.annotationMode??Rs.ENABLE_FORMS),u(this,is,t.annotationEditorMode??ei.NONE),u(this,kf,t.annotationEditorHighlightColors||null),u(this,Mf,t.enableHighlightFloatingButton===!0),u(this,Pf,t.enableUpdatedAddImage===!0),u(this,Tf,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.imagesRightClickMinSize=t.imagesRightClickMinSize??-1,this.l10n=t.l10n,this.l10n||(this.l10n=new Om),u(this,Cf,t.enablePermissions||!1),this.pageColors=t.pageColors||null,u(this,mu,t.mlManager||null),u(this,Nf,t.supportsPinchToZoom!==!1),u(this,If,t.enableAutoLinking!==!1),u(this,Lf,t.minDurationToUpdateCanvas??500),this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new nC,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;
553const{abortSignal:r}=t;u(this,Df,r||null),r==null||r.addEventListener("abort",()=>{n(this,Od).disconnect(),u(this,Od,null)},{once:!0}),this.scroll=_S(this.container,this._scrollUpdate.bind(this),r),this.presentationModeState=Eh.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),m(this,q,Fb).call(this),this.eventBus._on("thumbnailrendered",({pageNumber:o,pdfPage:l})=>{const h=this._pages[o-1];n(this,oa).has(h)||l==null||l.cleanup()}),t.l10n||this.l10n.translate(this.container)}get printingAllowed(){return n(this,Ma)}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(n(this,oa))}get pageViewsReady(){return this._pages.every(t=>t==null?void 0:t.pdfPage)}get renderForms(){return n(this,Mh)===Rs.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._setCurrentPageNumber(t,!0)||console.error(`currentPageNumber: "${t}" is not a valid page.`))}_setCurrentPageNumber(t,e=!1){var s;if(this._currentPageNumber===t)return e&&m(this,q,Rb).call(this),!0;if(!(0<t&&t<=this.pagesCount))return!1;const a=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:a}),e&&m(this,q,Rb).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 s=this._pageLabels.indexOf(t);s>=0&&(e=s+1)}this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}get currentScale(){return this._currentScale!==Sv?this._currentScale:__}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&m(this,q,ga).call(this,t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&m(this,q,ga).call(this,t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!k_(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(t%=360,t<0&&(t+=360),this._pagesRotation===t))return;this._pagesRotation=t;const e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&m(this,q,ga).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 xu(this,"_layerProperties",{get annotationEditorUIManager(){return n(t,me)},get annotationStorage(){var e;return(e=t.pdfDocument)==null?void 0:e.annotationStorage},get downloadManager(){return t.downloadManager},get enableComment(){return!!n(t,Vl)},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){var e;return(e=t.pdfDocument)==null?void 0:e.getFieldObjects()},get findController(){return t.findController},get hasJSActionsPromise(){var e;return(e=t.pdfDocument)==null?void 0:e.hasJSActions()},get linkService(){return t.linkService}})}async getAllText(t=null){const e=[],s=[];for(let a=1,r=this.pdfDocument.numPages;a<=r;++a){if(t!=null&&t.aborted)return null;s.length=0;const o=await this.pdfDocument.getPage(a),{items:l}=await o.getTextContent();for(const h of l)h.str&&s.push(h.str),h.hasEOL&&s.push(` 554`);e.push(ou(s.join("")))}return e.join(` 555`)}setDocument(t){var e,s,a;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),(e=this.findController)==null||e.setDocument(null),(s=this._scriptingManager)==null||s.setDocument(null),(a=n(this,me))==null||a.destroy(),u(this,me,null),u(this,is,ei.NONE),u(this,Ma,!0)),this.pdfDocument=t,!t)return;const r=t.numPages,o=t.getPage(1),l=t.getOptionalContentConfig({intent:"display"}),h=n(this,Cf)?t.getPermissions():Promise.resolve(),{eventBus:c,pageColors:d,viewer:p}=this;u(this,Kr,new AbortController);const{signal:g}=n(this,Kr);if(r>Np.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const b=this._scrollMode=tt.PAGE;c.dispatch("scrollmodechanged",{source:this,mode:b})}this._pagesCapability.promise.then(()=>{c.dispatch("pagesloaded",{source:this,pagesCount:r})},()=>{});const v=b=>{const y=this._pages[b.pageNumber-1];y&&n(this,oa).push(y)};c._on("pagerender",v,{signal:g});const w=b=>
555{b.cssTransform||b.isDetailView||(this._onePageRenderedCapability.resolve({timestamp:b.timestamp}),c._off("pagerendered",w))};c._on("pagerendered",w,{signal:g}),Promise.all([o,h]).then(([b,y])=>{var A;if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(b),this._optionalContentConfigPromise=l;const{annotationEditorMode:_,annotationMode:E,textLayerMode:x}=m(this,q,hE).call(this,y);if(x!==Ns.DISABLE){const P=u(this,ro,document.createElement("div"));P.id="hiddenCopyElement",p.before(P)}if(_!==ei.DISABLE){const P=_;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):pA(P)?(u(this,me,new Xk(this.container,p,n(this,Ff),n(this,xf),n(this,Vl),n(this,vu),c,t,d,n(this,kf),n(this,Mf),n(this,Pf),n(this,Tf),n(this,mu),n(this,Sf),n(this,Nf))),c.dispatch("annotationeditoruimanager",{source:this,uiManager:n(this,me)}),P!==ei.NONE&&(m(this,q,Wb).call(this,P),n(this,me).updateMode(P))):console.error(`Invalid AnnotationEditor mode: ${P}`)}const k=this._scrollMode===tt.PAGE?null:p,C=this.currentScale,I=b.getViewport({scale:C*An.PDF_TO_CSS_UNITS});p.style.setProperty("--scale-factor",I.scale),d!=null&&d.background&&p.style.setProperty("--page-bg-color",d.background),((d==null?void 0:d.foreground)==="CanvasText"||(d==null?void 0:d.background)==="Canvas")&&(p.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),p.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let P=1;P<=r;++P){const M=new aE({container:k,eventBus:c,id:P,scale:C,defaultViewport:I.clone(),optionalContentConfigPromise:l,renderingQueue:this.renderingQueue,textLayerMode:x,annotationMode:E,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,maxCanvasDim:this.maxCanvasDim,capCanvasAreaFactor:this.capCanvasAreaFactor,enableDetailCanvas:this.enableDetailCanvas,enableOptimizedPartialRendering:this.enableOptimizedPartialRendering,imagesRightClickMinSize:this.imagesRightClickMinSize,pageColors:d,l10n:this.l10n,layerProperties:this._layerProperties,enableAutoLinking:n(this,If),minDurationToUpdateCanvas:n(this,Lf),commentManager:n(this,Vl),abortSignal:n(this,Df)});this._pages.push(M)}(A=this._pages[0])==null||A.setPdfPage(b),this._scrollMode===tt.PAGE?m(this,q,bu).call(this):this._spreadMode!==Le.NONE&&this._updateSpreadMode(),c._on("annotationeditorlayerrendered",P=>{n(this,me)&&c.dispatch("annotationeditormodechanged",{source:this,mode:n(this,is)})},{once:!0,signal:g}),m(this,q,cE).call(this,g).then(async()=>{var P,M;if(t!==this.pdfDocument)return;if((P=this.findController)==null||P.setDocument(t),(M=this._scriptingManager)==null||M.setDocument(t),n(this,ro)&&document.addEventListener("copy",m(this,q,dE).bind(this,x),{signal:g}),t.loadingParams.disableAutoFetch||r>Np.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let D=r-1;if(D<=0){this._pagesCapability.resolve();return}for(let L=2;L<=r;++L){const W=t.getPage(L).then($=>{const j=this._pages[L-1];j.pdfPage||j.setPdfPage($),--D===0&&this._pagesCapability.resolve()},$=>{console.error(`Unable to get page ${L} to initialize viewer`,$),--D===0&&this._pagesCapability.resolve()});L%Np.PAUSE_EAGER_PAGE_INIT===0&&await W}}),c.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:P})=>{t===this.pdfDocument&&P.Language&&(p.lang=P.Language)}),this.defaultRenderingQueue&&this.update()}).catch(b=>{console.error("Unable to initialize viewer",b),this._pagesCapability.reject(b)})}onPagesEdited({pagesMapper:t,type:e,hasBeenCut:s,pageNumbers:a}){var r,o,l,h,c;if(e==="copy"){u(this,qr,new Map);for(const v of a)n(this,qr).set(v,this._pages[v-1]);return}if(e==="cancelCopy"){u(this,qr,null);return}if((e==="cut"||e==="delete")&&(u(this,ts,this._pages),u(this,Qr,a)),e==="cancelDelete"){if(u(this,Qr,null),!n(this,ts))return;const v=this._scrollMode===tt.PAGE?null:this.viewer;
555if(v){(r=n(this,me))==null||r.startUpdatePages();const w=document.createDocumentFragment();for(let b=0,y=n(this,ts).length;b<y;b++){const A=n(this,ts)[b];A.updatePageNumber(b+1),w.append(A.div)}v.replaceChildren(w),(o=n(this,me))==null||o.endUpdatePages()}this._pages=n(this,ts),u(this,ts,null);return}if(e==="cleanSavedData"){if(n(this,Qr)){if(n(this,ts)){for(const v of n(this,Qr))n(this,ts)[v-1].deleteMe();u(this,ts,null)}u(this,Qr,null)}return}this._currentPageNumber=0;const d=this._pages,p=this._pages=[];(l=n(this,me))==null||l.startUpdatePages();for(let v=1,w=t.pagesNumber;v<=w;v++){const b=t.getPrevPageNumber(v);if(b<0){let A=n(this,qr).get(-b);s?A.updatePageNumber(v):((h=n(this,me))==null||h.clonePage(-b-1,v-1),A=A.clone(v)),p.push(A);continue}const y=d[b-1];p.push(y),y.updatePageNumber(v)}(c=n(this,me))==null||c.endUpdatePages(),e==="paste"&&u(this,qr,null);const g=this._scrollMode===tt.PAGE?null:this.viewer;if(g){const v=document.createDocumentFragment();for(const{div:w}of p)v.append(w);g.replaceChildren(v)}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 s=0,a=this._pages.length;s<a;s++)this._pages[s].setPageLabel(((e=this._pageLabels)==null?void 0:e[s])??null)}}_resetView(){var t,e;this._pages=[],this._currentPageNumber=1,this._currentScale=Sv,this._currentScaleValue=null,this._pageLabels=null,u(this,oa,new aC(uA)),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=tt.VERTICAL,this._previousScrollMode=tt.UNKNOWN,this._spreadMode=Le.NONE,u(this,Ph,{previousPageNumber:1,scrollDown:!0,pages:[]}),(t=n(this,Kr))==null||t.abort(),u(this,Kr,null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),(e=n(this,ro))==null||e.remove(),u(this,ro,null),m(this,q,Ob).call(this),m(this,q,Of).call(this)}_scrollUpdate(){this.pagesCount!==0&&(n(this,Ls)&&clearTimeout(n(this,Ls)),u(this,Ls,setTimeout(()=>{u(this,Ls,null),this.update()},100)),this.update())}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:s=!1,ignoreDestinationZoom:a=!1,center:r=null}){if(!this.pdfDocument)return;const o=Number.isInteger(t)&&this._pages[t-1];if(!o){console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!e){this._setCurrentPageNumber(t,!0);return}let l=0,h=0,c=0,d=0,p,g;const v=o.rotation%180!==0,w=(v?o.height:o.width)/o.scale/An.PDF_TO_CSS_UNITS,b=(v?o.width:o.height)/o.scale/An.PDF_TO_CSS_UNITS;let y=0;switch(e[1].name){case"XYZ":l=e[2],h=e[3],y=e[4],l=l!==null?l:0,h=h!==null?h:b;break;case"Fit":case"FitB":y="page-fit";break;case"FitH":case"FitBH":h=e[2],y="page-width",h===null&&this._location?(l=this._location.left,h=this._location.top):(typeof h!="number"||h<0)&&(h=b);break;case"FitV":case"FitBV":l=e[2],c=w,d=b,y="page-height";break;case"FitR":l=e[2],h=e[3],c=e[4]-l,d=e[5]-h;let x=E_,k=x_;this.removePageBorders&&(x=k=0),p=(this.container.clientWidth-x)/c/An.PDF_TO_CSS_UNITS,g=(this.container.clientHeight-k)/d/An.PDF_TO_CSS_UNITS,y=Math.min(Math.abs(p),Math.abs(g));break;default:console.error(`scrollPageIntoView: "${e[1].name}" is not a valid destination type.`);return}if(a||(y&&y!==this._currentScale?this.currentScaleValue=y:this._currentScale===Sv&&(this.currentScaleValue=vS)),y==="page-fit"&&!e[4]){m(this,q,Am).call(this,o);return}const A=[o.viewport.convertToViewportPoint(l,h),o.viewport.convertToViewportPoint(l+c,h+d)];let _=Math.min(A[0][0],A[1][0]),E=Math.min(A[0][1],A[1][1]);r?((r==="both"||r==="vertical")&&(E-=(this.container.clientHeight-Math.abs(A[1][1]-A[0][1]))/2),(r==="both"||r==="horizontal")&&(_-=(this.container.clientWidth-Math.abs(A[1][0]-A[0][0]))/2)):s||(_=Math.max(_,0),E=Math.max(E,0)),m(this,q,Am).call(this,o,{left:_,top:E})}_updateLocation(t){const e=this._currentScale,s=this._currentScaleValue,a=parseFloat(s)===e?Math.round(e*1e4)/100:s,r=t.id,o=this._pages[r-1],l=this.container,h=o.getPagePoint(l.scrollLeft-t.x,l.scrollTop-t.y),c=Math.round(h[0]),d=Math.round(h[1]);let p=`#page=${r}`;this.isInPresentationMode||(p+=`&zoom=${a},${c},${d}`),this._location={pageNumber:r,scale:a,top:d,left:c,rotation:this._pagesRotation,pdfOpenParams:p}}update(){const t=this._getVisiblePages(),e=t.views,s=e.length;if(s===0)return;const a=Math.max(uA,2*s+1);n(this,oa).resize(a,t.ids);for(const{view:h,visibleArea:c}of e)h.updateVisibleArea(c);for(const h of n(this,oa))t.ids.has(h.id)||h.updateVisibleArea(null);this.renderingQueue.renderHighestPriority(t);const r=this._spreadMode===Le.NONE&&(this._scrollMode===tt.PAGE||this._scrollMode===tt.VERTICAL),o=this._currentPageNumber;let l=!1;for(const h of e){if(h.percent<100)break;if(h.id===o&&r){l=!0;break}}this._setCurrentPageNumber(l?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===E
555h.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===Eh.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===tt.PAGE?n(this,Ph).pages:this._pages,e=this._scrollMode===tt.HORIZONTAL,s=e&&this._isContainerRtl;return xS({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:s})}cleanup(){for(const t of this._pages)t.renderingState!==st.FINISHED&&t.reset()}_cancelRendering(){for(const t of this._pages)t.cancelRendering()}forceRendering(t){const e=t||this._getVisiblePages(),s=m(this,q,gE).call(this,e),a=this._spreadMode!==Le.NONE&&this._scrollMode!==tt.HORIZONTAL,r=n(this,pa)!==null||n(this,Ls)!==null&&e.views.some(l=>{var h;return(h=l.detailView)==null?void 0:h.renderingCancelled}),o=this.renderingQueue.getHighestPriority(e,this._pages,s,a,r);return o?(m(this,q,pE).call(this,o).then(()=>{this.renderingQueue.renderView(o)}),!0):!1}get hasEqualPageSizes(){const t=this._pages[0];for(let e=1,s=this._pages.length;e<s;++e){const a=this._pages[e];if(a.width!==t.width||a.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{const s=e.pdfPage.getViewport({scale:1}),a=S_(s);if(t===void 0)t=a;else if(this.enablePrintAutoRotate&&a!==t)return{width:s.height,height:s.width,rotation:(s.rotation-90)%360};return{width:s.width,height:s.height,rotation:s.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(!kS(t))throw new Error(`Invalid scroll mode: ${t}`);this.pagesCount>Np.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){const e=this._scrollMode,s=this.viewer;s.classList.toggle("scrollHorizontal",e===tt.HORIZONTAL),s.classList.toggle("scrollWrapped",e===tt.WRAPPED),!(!this.pdfDocument||!t)&&(e===tt.PAGE?m(this,q,bu).call(this):this._previousScrollMode===tt.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&m(this,q,ga).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(!SS(t))throw new Error(`Invalid spread mode: ${t}`);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,s=this._pages;if(this._scrollMode===tt.PAGE)m(this,q,bu).call(this);else if(e.textContent="",this._spreadMode===Le.NONE)for(const a of this._pages)e.append(a.div);else{const a=this._spreadMode-1;let r=null;for(let o=0,l=s.length;o<l;++o)r===null?(r=document.createElement("div"),r.className="spread",e.append(r)):o%2===a&&(r=r.cloneNode(!1),e.append(r)),r.append(s[o].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&m(this,q,ga).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 s=m(this,q,Nb).call(this,t,!1)||1;return this.currentPageNumber=Math.min(t+s,e),!0}previousPage(){const t=this._currentPageNumber;if(t<=1)return!1;const e=m(this,q,Nb).call(this,t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:s=null,origin:a}
555){if(s===null&&e===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let r=this._currentScale;if(e>0&&e!==1)r=Math.round(r*e*100)/100;else if(s){const o=s>0?Py:1/Py,l=s>0?Math.ceil:Math.floor;s=Math.abs(s);do r=l((r*o).toFixed(2)*10)/10;while(--s>0)}r=eS(r,wS,bS),m(this,q,ga).call(this,r,{noScroll:!1,drawingDelay:t,origin:a})}increaseScale(t={}){this.updateScale({...t,steps:t.steps??1})}decreaseScale(t={}){this.updateScale({...t,steps:-(t.steps??1)})}get containerTopLeft(){return n(this,fu)||u(this,fu,[this.container.offsetTop,this.container.offsetLeft])}get annotationEditorMode(){return n(this,me)?n(this,is):ei.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:s=!1,mustEnterInEditMode:a=!1,editComment:r=!1}){if(!n(this,me))throw new Error("The AnnotationEditor is not enabled.");if(n(this,is)===t)return;if(!pA(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;m(this,q,Wb).call(this,t);const{eventBus:o,pdfDocument:l}=this,h=async()=>{m(this,q,Of).call(this),u(this,is,t),await n(this,me).updateMode(t,e,!0,s,a,r),!(t!==n(this,is)||l!==this.pdfDocument)&&o.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===ei.NONE||n(this,is)===ei.NONE){const c=t!==ei.NONE;c||this.pdfDocument.annotationStorage.resetModifiedIds(),this.cleanup();for(const p of this._pages)p.toggleEditingMode(c);const d=m(this,q,uE).call(this);if(c&&d){m(this,q,Of).call(this),u(this,Ch,new AbortController);const p=AbortSignal.any([n(this,Kr).signal,n(this,Ch).signal]);o._on("pagerendered",({pageNumber:g})=>{d.delete(g),d.size===0&&u(this,dh,setTimeout(h,0))},{signal:p});return}}h()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(const s of this._pages)s.update(e);m(this,q,Ob).call(this),t||this.update()}}}oa=new WeakMap,xf=new WeakMap,kf=new WeakMap,is=new WeakMap,me=new WeakMap,Mh=new WeakMap,Vl=new WeakMap,fu=new WeakMap,Sf=new WeakMap,Mf=new WeakMap,Cf=new WeakMap,Pf=new WeakMap,Tf=new WeakMap,If=new WeakMap,Df=new WeakMap,Kr=new WeakMap,Lf=new WeakMap,mu=new WeakMap,Ma=new WeakMap,Ls=new WeakMap,Ch=new WeakMap,dh=new WeakMap,Fd=new WeakMap,ro=new WeakMap,Rf=new WeakMap,Od=new WeakMap,Ph=new WeakMap,pa=new WeakMap,vu=new WeakMap,Nf=new WeakMap,wu=new WeakMap,Ff=new WeakMap,qr=new WeakMap,ts=new WeakMap,Qr=new WeakMap,q=new WeakSet,hE=function(i){const t={annotationEditorMode:n(this,is),annotationMode:n(this,Mh),textLayerMode:n(this,wu)};return i?(u(this,Ma,i.includes(Ko.PRINT_HIGH_QUALITY)||i.includes(Ko.PRINT)),this.eventBus.dispatch("printingallowed",{source:this,isAllowed:n(this,Ma)}),!i.includes(Ko.COPY)&&n(this,wu)===Ns.ENABLE&&(t.textLayerMode=Ns.ENABLE_PERMISSIONS),i.includes(Ko.MODIFY_CONTENTS)||(t.annotationEditorMode=ei.DISABLE),!i.includes(Ko.MODIFY_ANNOTATIONS)&&!i.includes(Ko.FILL_INTERACTIVE_FORMS)&&n(this,Mh)===Rs.ENABLE_FORMS&&(t.annotationMode=Rs.ENABLE),t):(u(this,Ma,!0),this.eventBus.dispatch("printingallowed",{source:this,isAllowed:n(this,Ma)}),t)},cE=async function(i){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;const t=Promise.withResolvers(),e=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&t.resolve()},{signal:AbortSignal.any([i,e.signal])}),await Promise.race([this._onePageRenderedCapability.promise,t.promise]),e.abort()},dE=function(i,t){const e=document.getSelection(),{focusNode:s,anchorNode:a}=e;if(a&&s&&e.containsNode(n(this,ro))){if(n(this,Fd)||i===Ns.ENABLE_PERMISSIONS){rb(t);return}u(this,Fd,!0);const{classList:r}=this.viewer;r.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(()=>{u(this,Fd,!1),o.abort(),r.remove("copyAll")}),rb(t)}},bu=function(){if(this._scrollMode!==tt.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const i=this._currentPageNumber,t=n(this,Ph),e=this.viewer;if(e.textContent="",t.pages.length=0,this._spreadMode===Le.NONE&&!this.isInPresentationMode){const s=this._pages[i-1];e.append(s.div),t.pages.push(s)}else{const s=new Set,a=this._spreadMode-1;a===-1?s.add(i-1):i%2!==a?(s.add(i-1),s.add(i)):(s.add(i-2),s.add(i-1));const r=document.createElement("div");if(r.className="spread",this.isInPresentationMode){const o=document.createElement("div");o.className="dummyPage",r.append(o)}for(const o of s){const l=this._pages[o];l&&(r.append(l.div),t.pages.push(l))}e.append(r)}t.scrollDown=i>=t.previousPageNumber,t.previousPageNumber=i},Am=function(i,t=null){const{div:e,id:s}=i;
555if(this._currentPageNumber!==s&&this._setCurrentPageNumber(s),this._scrollMode===tt.PAGE&&(m(this,q,bu).call(this),this.update()),!t&&!this.isInPresentationMode){const a=e.offsetLeft+e.clientLeft,r=a+e.clientWidth,{scrollLeft:o,clientWidth:l}=this.container;(this._scrollMode===tt.HORIZONTAL||a<o||r>o+l)&&(t={left:0,top:0})}AS(e,t),!this._currentScaleValue&&this._location&&(this._location=null)},gA=function(i){return i===this._currentScale||Math.abs(i-this._currentScale)<1e-15},$v=function(i,t,{noScroll:e=!1,preset:s=!1,drawingDelay:a=-1,origin:r=null}){if(this._currentScaleValue=t.toString(),m(this,q,gA).call(this,i)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:i,presetValue:t});return}this.viewer.style.setProperty("--scale-factor",i*An.PDF_TO_CSS_UNITS);const o=a>=0&&a<1e3;this.refresh(!0,{scale:i,drawingDelay:o?a:-1}),o&&u(this,pa,setTimeout(()=>{u(this,pa,null),this.refresh()},a));const l=this._currentScale;if(this._currentScale=i,!e){let h=this._currentPageNumber,c;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(h=this._location.pageNumber,c=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:h,destArray:c,allowNegativeOffset:!0}),Array.isArray(r)){const d=i/l-1,[p,g]=this.containerTopLeft;this.container.scrollLeft+=(r[0]-g)*d,this.container.scrollTop+=(r[1]-p)*d}}this.eventBus.dispatch("scalechanging",{source:this,scale:i,presetValue:s?t:void 0}),this.defaultRenderingQueue&&this.update()},fA=function(){return this._spreadMode!==Le.NONE&&this._scrollMode!==tt.HORIZONTAL?2:1},ga=function(i,t){let e=parseFloat(i);if(e>0)t.preset=!1,m(this,q,$v).call(this,e,i,t);else{const s=this._pages[this._currentPageNumber-1];if(!s)return;let a=E_,r=x_;this.isInPresentationMode?(a=r=4,this._spreadMode!==Le.NONE&&(a*=2)):this.removePageBorders?a=r=0:this._scrollMode===tt.HORIZONTAL&&([a,r]=[r,a]);const o=(this.container.clientWidth-a)/s.width*s.scale/n(this,q,fA),l=(this.container.clientHeight-r)/s.height*s.scale;switch(i){case"page-actual":e=1;break;case"page-width":e=o;break;case"page-height":e=l;break;case"page-fit":e=Math.min(o,l);break;case"auto":const h=S_(s)?o:Math.min(l,o);e=Math.min(yS,h);break;default:console.error(`#setScale: "${i}" is an unknown zoom value.`);return}t.preset=!0,m(this,q,$v).call(this,e,i,t)}},Rb=function(){const i=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&m(this,q,ga).call(this,this._currentScaleValue,{noScroll:!0}),m(this,q,Am).call(this,i)},uE=function(){const i=this._getVisiblePages(),t=[],{ids:e,views:s}=i;for(const a of s){const{view:r}=a;if(!r.hasEditableAnnotations()){e.delete(r.id);continue}t.push(a)}return t.length===0?null:(this.renderingQueue.renderHighestPriority({first:t[0],last:t.at(-1),views:t,i
555ds:e}),e)},pE=async function(i){if(i.pdfPage)return i.pdfPage;try{const t=await this.pdfDocument.getPage(i.id);return i.pdfPage||i.setPdfPage(t),t}catch(t){return console.error("Unable to get page for page view",t),null}},gE=function(i){var t,e;if(((t=i.first)==null?void 0:t.id)===1)return!0;if(((e=i.last)==null?void 0:e.id)===this.pagesCount)return!1;switch(this._scrollMode){case tt.PAGE:return n(this,Ph).scrollDown;case tt.HORIZONTAL:return this.scroll.right}return this.scroll.down},Nb=function(i,t=!1){switch(this._scrollMode){case tt.WRAPPED:{const{views:e}=this._getVisiblePages(),s=new Map;for(const{id:a,y:r,percent:o,widthPercent:l}of e)o===0||l<100||s.getOrInsertComputed(r,Zk).push(a);for(const a of s.values()){const r=a.indexOf(i);if(r===-1)continue;const o=a.length;if(o===1)break;if(t)for(let l=r-1,h=0;l>=h;l--){const c=a[l],d=a[l+1]-1;if(c<d)return i-d}else for(let l=r+1,h=o;l<h;l++){const c=a[l],d=a[l-1]+1;if(c>d)return d-i}if(t){const l=a[0];if(l<i)return i-l+1}else{const l=a[o-1];if(l>i)return l-i+1}break}break}case tt.HORIZONTAL:break;case tt.PAGE:case tt.VERTICAL:{if(this._spreadMode===Le.NONE)break;const e=this._spreadMode-1;if(t&&i%2!==e||!t&&i%2===e)break;const{views:s}=this._getVisiblePages(),a=t?i-1:i+1;for(const{id:r,percent:o,widthPercent:l}of s)if(r===a){if(o>0&&l===100)return 2;break}break}}return 1},Fb=function(i=this.container.clientHeight){i!==n(this,Rf)&&(u(this,Rf,i),MS.setProperty("--viewer-container-height",`${i}px`))},fE=function(i){for(const t of i)if(t.target===this.container){m(this,q,Fb).call(this,Math.floor(t.borderBoxSize[0].blockSize)),u(this,fu,null);break}},Ob=function(){n(this,pa)!==null&&(clearTimeout(n(this,pa)),u(this,pa,null)),n(this,Ls)!==null&&(clearTimeout(n(this,Ls)),u(this,Ls,null))},Of=function(){var i;(i=n(this,Ch))==null||i.abort(),u(this,Ch,null),n(this,dh)!==null&&(clearTimeout(n(this,dh)),u(this,dh,null))},Wb=function(i){var t,e;switch(i){case ei.STAMP:(t=n(this,mu))==null||t.loadModel("altText");break;case ei.SIGNATURE:(e=n(this,vu))==null||e.loadSignatures();break}};class rC extends r0{_resetView(){super._resetView(),this._scrollMode=tt.PAGE,this._spreadMode=Le.NONE}set scrollMode(t){}_updateScrollMode(){}set spreadMode(t){}_updateSpreadMode(){}}globalThis.pdfjsViewer={AnnotationLayerBuilder:N_,DownloadManager:BS,EventBus:a0,FindState:Zn,GenericL10n:Om,LinkTarget:jr,parseQueryString:Fm,PDFFindController:D_,PDFHistory:BM,PDFLinkService:s0,PDFPageView:aE,PDFScriptingManager:lE,PDFSinglePageViewer:rC,PDFViewer:r0,ProgressBar:CS,RenderingStates:st,ScrollMode:tt,SimpleLinkService:n0,SpreadMode:Le,StructTreeLayerBuilder:q_,TextLayerBuilder:eE,XfaLayerBuilder:iE};const oC=new URL("/apps/framework/build/other/pdf.worker.min-iDqQPrd3.mjs",import.meta.url),lC=new URL("/apps/framework/build/other/pdf.sandbox.min-Dxt28d6K.mjs",import.meta.url);let ur=Object.hasOwn(HTMLElement.prototype,"popover");var Be,Es,Bb,De,uh,ph,qt,Ss,Jr,qe,vo,Wf,Z,re,jb,$b,zl,mE,gh,Uv;const Bf=class jf extends yE{constructor(){super(),f(this,re),f(this,Be),f(this,Es),f(this,Bb,["auto","page-actual","page-width","page-fit",50,75,100,125,150,200,300,400]),f(this,De,1),f(this,uh,1),f(this,ph,null),f(this,qt,"auto"),f(this,Ss),f(this,Jr),f(this,qe,["prev-next","pages","zoom","context:download","context:presentation"]),f(this,vo,!1),f(this,Wf),f(this,Z,{eventBus:null,controls:null,viewer:null,document:null,linkService:null,findController:null,scriptingManager:null});const{resolve:t,promise:e}=Promise.withResolvers();this.addEventListener("load",t,{once:!0}),u(this,Wf,e),u(this,Be,AE()),u(this,Jr,this.ownerDocument.createElement("div")),n(this,Jr).classList.add("pdfViewer"),u(this,Ss,this.ownerDocument.createElement("div")),n(this,Ss).classList.add("viewer-container"),n(this,Ss).addEventListener("fullscreenchange",()=>{this.ownerDocument.fullscreenElement?m(this,re,zl).call(this,"page-fit"):m(this,re,zl).call(this,n(this,qt))}),n(this,Ss).appendChild(n(this,Jr)),this.shadowRoot.appendChild(n(this,Ss)),u(this,Es,new ResizeObserver(()=>{n(this,Es).calls++,n(this,Es).calls>1&&!this.ownerDocument.fullscreenElement&&m(this,re,zl).call(this,n(this,qt))}
555)),n(this,Es).calls=0,Ta.workerSrc||(Ta.workerSrc=new URL(oC,import.meta.url).toString())}static get observedAttributes(){return["src","page"]}connectedCallback(){if(u(this,ph,new URL(this.getAttribute("src"),this.ownerDocument.baseURI)),this.hasAttribute("page")&&(u(this,De,parseInt(this.getAttribute("page"))),n(this,De)<1&&u(this,De,1)),this.hasAttribute("zoom")){const t=this.getAttribute("zoom");Number.isInteger(Number(t))&&Number(t)>0?u(this,qt,parseInt(t)):u(this,qt,t)}this.hasAttribute("controls")&&u(this,qe,this.getAttribute("controls").split(" ").filter(t=>!!t)),m(this,re,mE).call(this),n(this,Wf).then(async()=>{const t=new a0;t.on("pagechanging",e=>{u(this,De,e.pageNumber),m(this,re,gh).call(this)}),n(this,Z).scriptingManager=new lE({eventBus:t,sandboxBundleSrc:new URL(lC,import.meta.url).toString()}),n(this,Z).linkService=new s0({eventBus:t}),n(this,Z).findController=new D_({eventBus:t,linkService:n(this,Z).linkService}),n(this,Z).viewer=new r0({eventBus:t,container:n(this,Ss),viewer:n(this,Jr),linkService:n(this,Z).linkService,findController:n(this,Z).findController,scriptingManager:n(this,Z).scriptingManager}),this.hasAttribute("spread")&&(this.getAttribute("spread")==="odd"&&(n(this,Z).viewer.spreadMode=1),this.getAttribute("spread")==="even"&&(n(this,Z).viewer.spreadMode=2)),n(this,Z).viewer.currentScaleValue=n(this,qt),n(this,Z).linkService.setViewer(n(this,Z).viewer),n(this,Z).scriptingManager.setViewer(n(this,Z).viewer),t.on("pagesinit",async()=>{await m(this,re,zl).call(this,n(this,qt))}),t.on("pagesloaded",async()=>{n(this,Es).calls=0,n(this,Es).observe(n(this,Jr))}),await m(this,re,jb).call(this),n(this,De)!==1&&await m(this,re,$b).call(this)})}disconnectedCallback(){n(this,Es).disconnect()}attributeChangedCallback(t,e,s){n(this,ph)&&(t==="src"&&(n(this,Es).disconnect(),m(this,re,jb).call(this)),t==="page"&&this.setPage(parseInt(s)))}async setPage(t){!n(this,vo)||t>n(this,uh)||t<1||(u(this,De,t),await m(this,re,$b).call(this))}async nextPage(){await this.setPage(n(this,De)+1)}async previousPage(){await this.setPage(n(this,De)-1)}async setZoom(t){!n(this,vo)||t>jf.MAX_ZOOM||t<jf.MIN_ZOOM||(u(this,qt,t),await m(this,re,zl).call(this,n(this,qt)),m(this,re,gh).call(this))}async zoomIn(){await this.setZoom(Number.isInteger(n(this,qt))?n(this,qt)+10:110)}async zoomOut(){await this.setZoom(Number.isInteger(n(this,qt))?n(this,qt)-10:90)}downloadPdf(){const t=this.ownerDocument.createElement("a");t.download="download",t.href=n(this,ph),t.click()}async requestFullscreenPdf(t){this.ownerDocument.fullscreenElement&&await this.ownerDocument.exitFullscreen(),await n(this,Ss).requestFullscreen(t)}static register(){customElements.get("g2ui-pdf-viewer")||customElements.define("g2ui-pdf-viewer",jf)}};Be=new WeakMap,Es=new WeakMap,Bb=new WeakMap,De=new WeakMap,uh=new WeakMap,ph=new WeakMap,qt=new WeakMap,Ss=new WeakMap,Jr=new WeakMap,qe=new WeakMap,vo=new WeakMap,Wf=new WeakMap,Z=new WeakMap,re=new WeakSet,jb=async function(){var i;u(this,vo,!1),m(this,re,gh).call(this);const t=y1({url:n(this,ph),wasmUrl:"https://static.genkgo.com/pdfjs/5.7.284/wasm/"});(i=n(this,Z).document)==null||i.destroy(),n(this,Z).document=await t.promise,n(this,Z).viewer.setDocument(n(this,Z).document),n(this,Z).linkService.setDocument(n(this,Z).document,null),await n(this,Z).scriptingManager.setDocument(n(this,Z).document),u(this,uh,n(this,Z).document.numPages),u(this,vo,!0),m(this,re,gh).call(this)},$b=async function(){const i=await n(this,Z).document.getPage(n(this,De));n(this,Z).viewer.scrollPageIntoView({pageNumber:i.pageNumber,ignoreDestinationZoom:!0}),m(this,re,gh).call(this)},zl=async function(i){if(Number.isInteger(i)){const t=(await n(this,Z).document.getPage(n(this,De))).getViewport({scale:1}),e=n(this,Ss).clientWidth/t.width;n(this,Z).viewer.currentScale=i/100*e/wo.PDF_TO_CSS_UNITS}else n(this,Z).viewer.currentScaleValue=i},mE=function(){var i;(i=this.shadowRoot.querySelector("menu"))==null||i.remove();const t=this.ownerDocument.createElement("div");t.classList.add("controls");const e=this.ownerDocument.createElement("menu");if(e.classList.add("pagination"),n(this,qe).includes("prev-next")){const r=this.ownerDocument.createElement("li"),o=this.ownerDocument.createElement("button");o.classList.add("prev"),o.type="button",o.textContent=n(this,Be).lookup("prev"),o.disabled=!0,o.addEventListener("click",()=>this.previousPage()),r.appendChild(o),e.appendChild(r);const l=this.ownerDocument.createElement("li"),h=this.ownerDocument.createElement("button");h.classList.add("next"),h.type="button",h.textContent=n(this,Be).lookup("next"),h.disabled=!0,h.addEventListener("click",()=>this.nextPage()),l.appendChild(h),e.appendChild(l)}if(n(this,qe).includes("pages")){const r=this.ownerDocument.createElement("li"),o=this.ownerDocument.createElement("label");o.classList.add("pages");const l=this.ownerDocument.createElement("input");l.classList.add("page"),l.type="text",l.value=n(this,De).toString(),l.addEventListener("input",()=>this.setPage(parseInt(l.value))),l.disabled=!0;const h=this.ownerDocument.createElement("span");h.textContent=` ${n(this,Be).lookup("pages_of")} `;const c=this.ownerDocument.createElement("span");c.classList.add("total"),c.textContent="1",o.appendChild(l),o.appendChild(h),o.appendChild(c),r.appendChild(o),e.appendChild(r)}t.appendChild(e);const s=this.ownerDocument.createElement("menu");if(s.classList.add("zoom"),n(this,qe).includes("zoom")){const r=this.ownerDocument.createElement("li"),o=this.ownerDocument.createElement("button");o.classList.add("zoom-in"),o.type="button",o.textContent=n(this,Be).lookup("zoom_in"),o.disabled=!0,o.addEventListener("click",()=>this.zoomIn()),r.appendChild(o);const l=this.ownerDocument.createElement("li"),h=this.ownerDocument.createElement("button");h.classList.add("zoom-out"),h.type="button",h.textContent=n(this,Be).lookup("zoom_out"),h.disabled=!0,h.addEventListener("click",()=>this.zoomOut()),l.appendChild(h);const c=this.ownerDocument.createElement("li"),d=this.ownerDocument.createElement("div");d.classList.add("zoom-level"),c.appendChild(d);const p=this.ownerDocument.createElement("span");p.classList.add("zoom-value"),p.textContent=Number.isInteger(n(this,qt))?`${n(this,qt)}%`:n(this,Be).lookup(`zoom_option_${n(this,qt)}`),p.addEventListener("click",v=>{v.stopPropagation(),ur?g.togglePopover():(m(this,re,Uv).call(this,[g]),g.hidden=!g.hidden)}),d.appendChild(p);const g=this.ownerDocument.createElement("ul");ur?g.popover="auto":g.hidden=!0;for(const v of n(this,Bb)){const w=this.ownerDocument.createElement("li");w.textContent=Number.isInteger(v)?`${v}%`:n(this,Be).lookup(`zoom_option_${v}`),w.addEventListener("click",()=>{ur?g.togglePopover(!1):g.hidden=!0,this.setZoom(v)}),g.appendChild(w)}d.appendChild(g),s.appendChild(r),s.appendChild(c),s.appendChild(l)}if(t.appendChild(s),n(this,qe).filter(r=>r.startsWith("context:")).length>0){const r=this.ownerDocument.createElement("menu");r.classList.add("context");const o=this.ownerDocument.createElement("ul");ur?o.popover="auto":o.hidden=!0;const l=this.ownerDocument.createElement("li"),h=this.ownerDocument.createElement("button");if(h.type="button",h.textContent="...",h.classList.add("collapse"),h.addEventListener("click",c=>{c.stopPropagation(),ur?o.togglePopover():(m(this,re,Uv).call(this,[o]),o.hidden=!o.hidden)}),l.appendChild(h),n(this,qe).includes("context:download")){const c=this.ownerDocument.createElement("li"),d=this.ownerDocument.createElement("button");d.classList.add("download"),d.type="button",d.textContent=n(this,Be).lookup("download"),d.disabled=!0,d.addEventListener("click",()=>{ur?o.togglePopover(!1):o.hidden=!0,this.downloadPdf()}),c.appendChild(d),o.appendChild(c)}if(n(this,qe).includes("context:presentation")){const c=this.ownerDocument.createElement("li"),d=this.ownerDocument.createElement("button");d.classList.add("presentation"),d.type="button",d.textContent=n(this,Be).lookup("fullscreen"),d.disabled=!0,d.addEventListener("click",async()=>{ur?o.togglePopover(!1):o.hidden=!0,await this.requestFullscreenPdf()}),c.appendChild(d),o.appendChild(c)}r.appendChild(l),l.appendChild(o),t.appendChild(r)}const a=this.ownerDocument.createElement("menu");if(a.classList.add("actions"),n(this,qe).includes("download")){const r=this.ownerDocument.createElement("li"),o=this.ownerDocument.createElement("button");o.classList.add("download"),o.type="button",o.textContent=n(this,Be).lookup("download"),o.disabled=!0,o.addEventListener("click",()=>this.downloadPdf()),r.appendChild(o),a.appendChild(r)}if(n(this,qe).includes("presentation")){const r=this.ownerDocument.createElement("li"),o=this.ownerDocument.createElement("button");o.classList.add("presentation"),o.type="button",o.textContent=n(this,Be).lookup("fullscreen"),o.disabled=!0,o.addEventListener("click",async()=>await this.requestFullscreenPdf()),r.appendChild(o),a.appendChild(r)}a.children.length>0&&t.appendChild(a),this.shadowRoot.appendChild(t),n(this,Z).controls=t},gh=function(){n(this,Z).controls.querySelectorAll("button,input").forEach(i=>
555i.disabled=!n(this,vo)),n(this,qe).includes("prev-next")&&(n(this,Z).controls.querySelector(".prev").disabled=n(this,De)===1,n(this,Z).controls.querySelector(".next").disabled=n(this,De)===n(this,uh)),n(this,qe).includes("pages")&&(this.shadowRoot.querySelector(".total").textContent=n(this,uh).toString(),n(this,Z).controls.querySelector(".page").value=n(this,De)),n(this,qe).includes("zoom")&&(n(this,Z).controls.querySelector(".zoom-value").textContent=Number.isInteger(n(this,qt))?`${n(this,qt)}%`:n(this,Be).lookup(`zoom_option_${n(this,qt)}`))},Uv=function(i=[]){this.shadowRoot.querySelectorAll(".controls menu ul").forEach(t=>{i.includes(t)||(t.hidden=!0)})},S(Bf,"MAX_ZOOM",400),S(Bf,"MIN_ZOOM",50),S(Bf,"adopt",[new URL("/apps/framework/build/css/g2ui-pdf-viewer-BemMGhvt.css",import.meta.url)]);let VC=Bf;export{VC as default};
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.