PageSourceSearch

https://researchmonkey.ai/assets/pdf-DoYtu9le.js

js researchmonkey.ai collected 2026-10-05 00:51:41 UTC 293,444 bytes, 7 lines download raw bytes

1import{_ as Lt}from"./index-BGIpxRCe.js";var Vt={640:(ut,Z,U)=>{U.d(Z,{AnnotationLayer:()=>ht,FreeTextAnnotationElement:()=>Y,InkAnnotationElement:()=>Q,StampAnnotationElement:()=>gt});var A=U(266),V=U(473),C=U(780);function N(J){return Math.floor(Math.max(0,Math.min(1,J))*255).toString(16).padStart(2,"0")}function R(J){return Math.max(0,Math.min(255,255*J))}class L{static CMYK_G([d,o,s,t]){return["G",1-Math.min(1,.3*d+.59*s+.11*o+t)]}static G_CMYK([d]){return["CMYK",0,0,0,1-d]}static G_RGB([d]){return["RGB",d,d,d]}static G_rgb([d]){return d=R(d),[d,d,d]}static G_HTML([d]){const o=N(d);return`#${o}${o}${o}`}static RGB_G([d,o,s]){return["G",.3*d+.59*o+.11*s]}static RGB_rgb(d){return d.map(R)}static RGB_HTML(d){return`#${d.map(N).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([d,o,s,t]){return["RGB",1-Math.min(1,d+t),1-Math.min(1,s+t),1-Math.min(1,o+t)]}static CMYK_rgb([d,o,s,t]){return[R(1-Math.min(1,d+t)),R(1-Math.min(1,s+t)),R(1-Math.min(1,o+t))]}static CMYK_HTML(d){const o=this.CMYK_RGB(d).slice(1);return this.RGB_HTML(o)}static RGB_CMYK([d,o,s]){const t=1-d,i=1-o,a=1-s,h=Math.min(t,i,a);return["CMYK",t,i,a,h]}}var w=U(160);const v=1e3,l=9,u=new WeakSet;function g(J){return{width:J[2]-J[0],height:J[3]-J[1]}}class r{static create(d){switch(d.data.annotationType){case A.AnnotationType.LINK:return new e(d);case A.AnnotationType.TEXT:return new n(d);case A.AnnotationType.WIDGET:switch(d.data.fieldType){case"Tx":return new b(d);case"Btn":return d.data.radioButton?new E(d):d.data.checkBox?new k(d):new P(d);case"Ch":return new z(d);case"Sig":return new m(d)}return new c(d);case A.AnnotationType.POPUP:return new B(d);case A.AnnotationType.FREETEXT:return new Y(d);case A.AnnotationType.LINE:return new tt(d);case A.AnnotationType.SQUARE:return new rt(d);case A.AnnotationType.CIRCLE:return new j(d);case A.AnnotationType.POLYLINE:return new _(d);case A.AnnotationType.CARET:return new q(d);case A.AnnotationType.INK:return new Q(d);case A.AnnotationType.POLYGON:return new H(d);case A.AnnotationType.HIGHLIGHT:return new K(d);case A.AnnotationType.UNDERLINE:return new ft(d);case A.AnnotationType.SQUIGGLY:return new ot(d);case A.AnnotationType.STRIKEOUT:return new at(d);case A.AnnotationType.STAMP:return new gt(d);case A.AnnotationType.FILEATTACHMENT:return new ct(d);default:return new p(d)}}}class p{#t=!1;constructor(d,{isRenderable:o=!1,ignoreBorder:s=!1,createQuadrilaterals:t=!1}={}){this.isRenderable=o,this.data=d.data,this.layer=d.layer,this.linkService=d.linkService,this.downloadManager=d.downloadManager,this.imageResourcesPath=d.imageResourcesPath,this.renderForms=d.renderForms,this.svgFactory=d.svgFactory,this.annotationStorage=d.annotationStorage,this.enableScripting=d.enableScripting,this.hasJSActions=d.hasJSActions,this._fieldObjects=d.fieldObjects,this.parent=d.parent,o&&(this.container=this._createContainer(s)),t&&this._createQuadrilaterals()}static _hasPopupData({titleObj:d,contentsObj:o,richText:s}){return!!(d?.str||o?.str||s?.str)}get hasPopupData(){return p._hasPopupData(this.data)}_createContainer(d){const{data:o,parent:{page:s,viewport:t}}=this,i=document.createElement("section");i.setAttribute("data-annotation-id",o.id),this instanceof c||(i.tabIndex=v),i.style.zIndex=this.parent.zIndex++,this.data.popupRef&&i.setAttribute("aria-haspopup","dialog"),o.noRotate&&i.classList.add("norotate");const{pageWidth:a,pageHeight:h,pageX:f,pageY:y}=t.rawDims;if(!o.rect||this instanceof B){const{rotation:O}=o;return!o.hasOwnCanvas&&O!==0&&this.setRotation(O,i),i}const{width:x,height:T}=g(o.rect),F=A.Util.normalizeRect([o.rect[0],s.view[3]-o.rect[1]+s.view[1],o.rect[2],s.view[3]-o.rect[3]+s.view[1]]);if(!d&&o.borderStyle.width>0){i.style.borderWidth=`${o.borderStyle.width}px`;const O=o.borderStyle.horizontalCornerRadius,D=o.borderStyle.verticalCornerRadius;if(O>0||D>0){const M=`calc(${O}px * var(--scale-factor)) / calc(${D}px * var(--scale-factor))`;i.style.borderRadius=M}else if(this instanceof E){const M=`calc(${x}px * var(--scale-factor)) / calc(${T}px * var(--scale-factor))`;i.style.borderRadius=M}switch(o.borderStyle.style){case A.AnnotationBorderStyleType.SOLID:i.style.borderStyle="solid";break;case A.AnnotationBorderStyleType.DASHED:i.style.borderStyle="dashed";break;case A.AnnotationBorderStyleType.BEVELED:(0,A.warn)("Unimplemented border style: beveled");break;
1case A.AnnotationBorderStyleType.INSET:(0,A.warn)("Unimplemented border style: inset");break;case A.AnnotationBorderStyleType.UNDERLINE:i.style.borderBottomStyle="solid";break}const S=o.borderColor||null;S?(this.#t=!0,i.style.borderColor=A.Util.makeHexColor(S[0]|0,S[1]|0,S[2]|0)):i.style.borderWidth=0}i.style.left=`${100*(F[0]-f)/a}%`,i.style.top=`${100*(F[1]-y)/h}%`;const{rotation:I}=o;return o.hasOwnCanvas||I===0?(i.style.width=`${100*x/a}%`,i.style.height=`${100*T/h}%`):this.setRotation(I,i),i}setRotation(d,o=this.container){if(!this.data.rect)return;const{pageWidth:s,pageHeight:t}=this.parent.viewport.rawDims,{width:i,height:a}=g(this.data.rect);let h,f;d%180===0?(h=100*i/s,f=100*a/t):(h=100*a/s,f=100*i/t),o.style.width=`${h}%`,o.style.height=`${f}%`,o.setAttribute("data-main-rotation",(360-d)%360)}get _commonActions(){const d=(o,s,t)=>{const i=t.detail[o],a=i[0],h=i.slice(1);t.target.style[s]=L[`${a}_HTML`](h),this.annotationStorage.setValue(this.data.id,{[s]:L[`${a}_rgb`](h)})};return(0,A.shadow)(this,"_commonActions",{display:o=>{const{display:s}=o.detail,t=s%2===1;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:t,noPrint:s===1||s===2})},print:o=>{this.annotationStorage.setValue(this.data.id,{noPrint:!o.detail.print})},hidden:o=>{const{hidden:s}=o.detail;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:s,noView:s})},focus:o=>{setTimeout(()=>o.target.focus({preventScroll:!1}),0)},userName:o=>{o.target.title=o.detail.userName},readonly:o=>{o.target.disabled=o.detail.readonly},required:o=>{this._setRequired(o.target,o.detail.required)},bgColor:o=>{d("bgColor","backgroundColor",o)},fillColor:o=>{d("fillColor","backgroundColor",o)},fgColor:o=>{d("fgColor","color",o)},textColor:o=>{d("textColor","color",o)},borderColor:o=>{d("borderColor","borderColor",o)},strokeColor:o=>{d("strokeColor","borderColor",o)},rotation:o=>{const s=o.detail.rotation;this.setRotation(s),this.annotationStorage.setValue(this.data.id,{rotation:s})}})}_dispatchEventFromSandbox(d,o){const s=this._commonActions;for(const t of Object.keys(o.detail))(d[t]||s[t])?.(o)}_setDefaultPropertiesFromJS(d){if(!this.enableScripting)return;const o=this.annotationStorage.getRawValue(this.data.id);if(!o)return;const s=this._commonActions;for(const[t,i]of Object.entries(o)){const a=s[t];if(a){const h={detail:{[t]:i},target:d};a(h),delete o[t]}}}
1_createQuadrilaterals(){if(!this.container)return;const{quadPoints:d}=this.data;if(!d)return;const[o,s,t,i]=this.data.rect;if(d.length===1){const[,{x:D,y:S},{x:M,y:$}]=d[0];if(t===D&&i===S&&o===M&&s===$)return}const{style:a}=this.container;let h;if(this.#t){const{borderColor:D,borderWidth:S}=a;a.borderWidth=0,h=["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="${D}" stroke-width="${S}">`],this.container.classList.add("hasBorder")}const f=t-o,y=i-s,{svgFactory:x}=this,T=x.createElement("svg");T.classList.add("quadrilateralsContainer"),T.setAttribute("width",0),T.setAttribute("height",0);const F=x.createElement("defs");T.append(F);const I=x.createElement("clipPath"),O=`clippath_${this.data.id}`;I.setAttribute("id",O),I.setAttribute("clipPathUnits","objectBoundingBox"),F.append(I);for(const[,{x:D,y:S},{x:M,y:$}]of d){const G=x.createElement("rect"),W=(M-o)/f,et=(i-S)/y,st=(D-M)/f,nt=(S-$)/y;G.setAttribute("x",W),G.setAttribute("y",et),G.setAttribute("width",st),G.setAttribute("height",nt),I.append(G),h?.push(`<rect vector-effect="non-scaling-stroke" x="${W}" y="${et}" width="${st}" height="${nt}"/>`)}this.#t&&(h.push("</g></svg>')"),a.backgroundImage=h.join("")),this.container.append(T),this.container.style.clipPath=`url(#${O})`}_createPopup(){const{container:d,data:o}=this;d.setAttribute("aria-haspopup","dialog");const s=new B({data:{color:o.color,titleObj:o.titleObj,modificationDate:o.modificationDate,contentsObj:o.contentsObj,richText:o.richText,parentRect:o.rect,borderStyle:0,id:`popup_${o.id}`,rotation:o.rotation},parent:this.parent,elements:[this]});this.parent.div.append(s.render())}render(){(0,A.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(d,o=null){const s=[];if(this._fieldObjects){const t=this._fieldObjects[d];if(t)for(const{page:i,id:a,exportValues:h}of t){if(i===-1||a===o)continue;const f=typeof h=="string"?h:null,y=document.querySelector(`[data-element-id="${a}"]`);if(y&&!u.has(y)){(0,A.warn)(`_getElementsByName - element not allowed: ${a}`);continue}s.push({id:a,exportValue:f,domElement:y})}return s}for(const t of document.getElementsByName(d)){const{exportValue:i}=t,a=t.getAttribute("data-element-id");a!==o&&u.has(t)&&s.push({id:a,exportValue:i,domElement:t})}return s}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const d=this.getElementsToTriggerPopup();if(Array.isArray(d))for(const o of d)o.classList.add("highlightArea");else d.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:d,data:{id:o}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:d,editId:o})})}}class e extends p{constructor(d,o=null){super(d,{isRenderable:!0,ignoreBorder:!!o?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=d.data.isTooltipOnly}render(){const{data:d,linkService:o}=this,s=document.createElement("a");s.setAttribute("data-element-id",d.id);let t=!1;return d.url?(o.addLinkAttributes(s,d.url,d.newWindow),t=!0):d.action?(this._bindNamedAction(s,d.action),t=!0):d.attachment?(this.#e(s,d.attachment,d.attachmentDest),t=!0):d.setOCGState?(this.#s(s,d.setOCGState),t=!0):d.dest?(this._bindLink(s,d.dest),t=!0):(d.actions&&(d.actions.Action||d.actions["Mouse Up"]||d.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,d),t=!0),d.resetForm?(this._bindResetFormAction(s,d.resetForm),t=!0):this.isTooltipOnly&&!t&&(this._bindLink(s,""),t=!0)),this.container.classList.add("linkAnnotation"),t&&this.container.append(s),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(d,o){d.href=this.linkService.getDestinationHash(o),d.onclick=()=>(o&&this.linkService.goToDestination(o),!1),(o||o==="")&&this.#t()}_bindNamedAction(d,o){d.href=this.linkService.getAnchorUrl(""),d.onclick=()=>(this.linkService.executeNamedAction(o),!1),this.#t()}#e(d,o,s=null){d.href=this.linkService.getAnchorUrl(""),d.onclick=()=>(this.downloadManager?.openOrDownloadData(o.content,o.filename,s),!1),this.#t()}#s(d,o){d.href=this.linkService.getAnchorUrl(""),d.onclick=()=>
1(this.linkService.executeSetOCGState(o),!1),this.#t()}_bindJSAction(d,o){d.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const t of Object.keys(o.actions)){const i=s.get(t);i&&(d[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o.id,name:t}}),!1))}d.onclick||(d.onclick=()=>!1),this.#t()}_bindResetFormAction(d,o){const s=d.onclick;if(s||(d.href=this.linkService.getAnchorUrl("")),this.#t(),!this._fieldObjects){(0,A.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),s||(d.onclick=()=>!1);return}d.onclick=()=>{s?.();const{fields:t,refs:i,include:a}=o,h=[];if(t.length!==0||i.length!==0){const x=new Set(i);for(const T of t){const F=this._fieldObjects[T]||[];for(const{id:I}of F)x.add(I)}for(const T of Object.values(this._fieldObjects))for(const F of T)x.has(F.id)===a&&h.push(F)}else for(const x of Object.values(this._fieldObjects))h.push(...x);const f=this.annotationStorage,y=[];for(const x of h){const{id:T}=x;switch(y.push(T),x.type){case"text":{const I=x.defaultValue||"";f.setValue(T,{value:I});break}case"checkbox":case"radiobutton":{const I=x.defaultValue===x.exportValues;f.setValue(T,{value:I});break}case"combobox":case"listbox":{const I=x.defaultValue||"";f.setValue(T,{value:I});break}default:continue}const F=document.querySelector(`[data-element-id="${T}"]`);if(F){if(!u.has(F)){(0,A.warn)(`_bindResetFormAction - element not allowed: ${T}`);continue}}else continue;F.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:y,name:"ResetForm"}}),!1}}}class n extends p{constructor(d){super(d,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const d=document.createElement("img");return d.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",d.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),d.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(d),this.container}}class c extends p{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(d){this.data.hasOwnCanvas&&(d.previousSibling?.nodeName==="CANVAS"&&(d.previousSibling.hidden=!0),d.hidden=!1)}_getKeyModifier(d){return A.FeatureTest.platform.isMac?d.metaKey:d.ctrlKey}_setEventListener(d,o,s,t,i){s.includes("mouse")?d.addEventListener(s,a=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:t,value:i(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})}):d.addEventListener(s,a=>{if(s==="blur"){if(!o.focused||!a.relatedTarget)return;o.focused=!1}else if(s==="focus"){if(o.focused)return;o.focused=!0}i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:t,value:i(a)}})})}_setEventListeners(d,o,s,t){for(const[i,a]of s)(a==="Action"||this.data.actions?.[a])&&((a==="Focus"||a==="Blur")&&(o||={focused:!1}),this._setEventListener(d,o,i,a,t),a==="Focus"&&!this.data.actions?.Blur?this._setEventListener(d,o,"blur","Blur",null):a==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(d,o,"focus","Focus",null))}_setBackgroundColor(d){const o=this.data.backgroundColor||null;d.style.backgroundColor=o===null?"transparent":A.Util.makeHexColor(o[0],o[1],o[2])}_setTextStyle(d){const o=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,t=this.data.defaultAppearanceData.fontSize||l,i=d.style;let a;const h=2,f=y=>Math.round(10*y)/10;
1if(this.data.multiLine){const y=Math.abs(this.data.rect[3]-this.data.rect[1]-h),x=Math.round(y/(A.LINE_FACTOR*t))||1,T=y/x;a=Math.min(t,f(T/A.LINE_FACTOR))}else{const y=Math.abs(this.data.rect[3]-this.data.rect[1]-h);a=Math.min(t,f(y/A.LINE_FACTOR))}i.fontSize=`calc(${a}px * var(--scale-factor))`,i.color=A.Util.makeHexColor(s[0],s[1],s[2]),this.data.textAlignment!==null&&(i.textAlign=o[this.data.textAlignment])}_setRequired(d,o){o?d.setAttribute("required",!0):d.removeAttribute("required"),d.setAttribute("aria-required",o)}}class b extends c{constructor(d){const o=d.renderForms||d.data.hasOwnCanvas||!d.data.hasAppearance&&!!d.data.fieldValue;super(d,{isRenderable:o})}setPropertyOnSiblings(d,o,s,t){const i=this.annotationStorage;for(const a of this._getElementsByName(d.name,d.id))a.domElement&&(a.domElement[o]=s),i.setValue(a.id,{[t]:s})}render(){const d=this.annotationStorage,o=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const t=d.getValue(o,{value:this.data.fieldValue});let i=t.value||"";const a=d.getValue(o,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let h=t.formattedValue||this.data.textContent?.join(`
2`)||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const f={userValue:i,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h??i,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",h??i),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),u.add(s),s.setAttribute("data-element-id",o),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=v,this._setRequired(s,this.data.required),a&&(s.maxLength=a),s.addEventListener("input",x=>{d.setValue(o,{value:x.target.value}),this.setPropertyOnSiblings(s,"value",x.target.value,"value"),f.formattedValue=null}),s.addEventListener("resetform",x=>{const T=this.data.defaultFieldValue??"";s.value=f.userValue=T,f.formattedValue=null});let y=x=>{const{formattedValue:T}=f;T!=null&&(x.target.value=T),x.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",T=>{if(f.focused)return;const{target:F}=T;f.userValue&&(F.value=f.userValue),f.lastCommittedValue=F.value,f.commitKey=1,this.data.actions?.Focus||(f.focused=!0)}),s.addEventListener("updatefromsandbox",T=>{this.showElementAndHideCanvas(T.target);const F={value(I){f.userValue=I.detail.value??"",d.setValue(o,{value:f.userValue.toString()}),I.target.value=f.userValue},formattedValue(I){const{formattedValue:O}=I.detail;f.formattedValue=O,O!=null&&I.target!==document.activeElement&&(I.target.value=O),d.setValue(o,{formattedValue:O})},selRange(I){I.target.setSelectionRange(...I.detail.selRange)},charLimit:I=>{const{charLimit:O}=I.detail,{target:D}=I;if(O===0){D.removeAttribute("maxLength");return}D.setAttribute("maxLength",O);let S=f.userValue;!S||S.length<=O||(S=S.slice(0,O),D.value=f.userValue=S,d.setValue(o,{value:S}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:S,willCommit:!0,commitKey:1,selStart:D.selectionStart,selEnd:D.selectionEnd}}))}};this._dispatchEventFromSandbox(F,T)}),s.addEventListener("keydown",T=>{f.commitKey=1;let F=-1;if(T.key==="Escape"?F=0:T.key==="Enter"&&!this.data.multiLine?F=2:T.key==="Tab"&&(f.commitKey=3),F===-1)return;const{value:I}=T.target;f.lastCommittedValue!==I&&(f.lastCommittedValue=I,f.userValue=I,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:I,willCommit:!0,commitKey:F,selStart:T.target.selectionStart,selEnd:T.target.selectionEnd}}))});const x=y;y=null,s.addEventListener("blur",T=>{if(!f.focused||!T.relatedTarget)return;this.data.actions?.Blur||(f.focused=!1);const{value:F}=T.target;f.userValue=F,f.lastCommittedValue!==F&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:F,willCommit:!0,commitKey:f.commitKey,selStart:T.target.selectionStart,selEnd:T.target.selectionEnd}}),x(T)}),this.data.actions?.Keystroke&&s.addEventListener("beforeinput",T=>
vendor: 4,359 bytes, line 2
2{f.lastCommittedValue=null;const{data:F,target:I}=T,{value:O,selectionStart:D,selectionEnd:S}=I;let M=D,$=S;switch(T.inputType){case"deleteWordBackward":{const G=O.substring(0,D).match(/\w*[^\w]*$/);G&&(M-=G[0].length);break}case"deleteWordForward":{const G=O.substring(D).match(/^[^\w]*\w*/);G&&($+=G[0].length);break}case"deleteContentBackward":D===S&&(M-=1);break;case"deleteContentForward":D===S&&($+=1);break}T.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:O,change:F||"",willCommit:!1,selStart:M,selEnd:$}})}),this._setEventListeners(s,f,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],T=>T.target.value)}if(y&&s.addEventListener("blur",y),this.data.comb){const T=(this.data.rect[2]-this.data.rect[0])/a;s.classList.add("comb"),s.style.letterSpacing=`calc(${T}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class m extends c{constructor(d){super(d,{isRenderable:!!d.data.hasOwnCanvas})}}class k extends c{constructor(d){super(d,{isRenderable:d.renderForms})}render(){const d=this.annotationStorage,o=this.data,s=o.id;let t=d.getValue(s,{value:o.exportValue===o.fieldValue}).value;typeof t=="string"&&(t=t!=="Off",d.setValue(s,{value:t})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const i=document.createElement("input");return u.add(i),i.setAttribute("data-element-id",s),i.disabled=o.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=o.fieldName,t&&i.setAttribute("checked",!0),i.setAttribute("exportValue",o.exportValue),i.tabIndex=v,i.addEventListener("change",a=>{const{name:h,checked:f}=a.target;for(const y of this._getElementsByName(h,s)){const x=f&&y.exportValue===o.exportValue;y.domElement&&(y.domElement.checked=x),d.setValue(y.id,{value:x})}d.setValue(s,{value:f})}),i.addEventListener("resetform",a=>{const h=o.defaultFieldValue||"Off";a.target.checked=h===o.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",a=>{const h={value(f){f.target.checked=f.detail.value!=="Off",d.setValue(s,{value:f.target.checked})}};this._dispatchEventFromSandbox(h,a)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class E extends c{constructor(d){super(d,{isRenderable:d.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const d=this.annotationStorage,o=this.data,s=o.id;let t=d.getValue(s,{value:o.fieldValue===o.buttonValue}).value;if(typeof t=="string"&&(t=t!==o.buttonValue,d.setValue(s,{value:t})),t)for(const a of this._getElementsByName(o.fieldName,s))d.setValue(a.id,{value:!1});const i=document.createElement("input");if(u.add(i),i.setAttribute("data-element-id",s),i.disabled=o.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=o.fieldName,t&&i.setAttribute("checked",!0),i.tabIndex=v,i.addEventListener("change",a=>{const{name:h,checked:f}=a.target;for(const y of this._getElementsByName(h,s))d.setValue(y.id,{value:!1});d.setValue(s,{value:f})}),i.addEventListener("resetform",a=>{const h=o.defaultFieldValue;a.target.checked=h!=null&&h===o.buttonValue}),this.enableScripting&&this.hasJSActions){const a=o.buttonValue;i.addEventListener("updatefromsandbox",h=>{const f={value:y=>{const x=a===y.detail.value;for(const T of this._getElementsByName(y.target.name)){const F=x&&T.id===s;T.domElement&&(T.domElement.checked=F),d.setValue(T.id,{value:F})}}};this._dispatchEventFromSandbox(f,h)}),this._setEventListeners(i,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],h=>h.target.checked)}
2return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class P extends e{constructor(d){super(d,{ignoreBorder:d.data.hasAppearance})}render(){const d=super.render();d.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(d.title=this.data.alternativeText);const o=d.lastChild;return this.enableScripting&&this.hasJSActions&&o&&(this._setDefaultPropertiesFromJS(o),o.addEventListener("updatefromsandbox",s=>{this._dispatchEventFromSandbox({},s)})),d}}class z extends c{constructor(d){super(d,{isRenderable:d.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const d=this.annotationStorage,o=this.data.id,s=d.getValue(o,{value:this.data.fieldValue}),t=document.createElement("select");u.add(t),t.setAttribute("data-element-id",o),t.disabled=this.data.readOnly,this._setRequired(t,this.data.required),t.name=this.data.fieldName,t.tabIndex=v;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(t.size=this.data.options.length,this.data.multiSelect&&(t.multiple=!0)),t.addEventListener("resetform",x=>{const T=this.data.defaultFieldValue;for(const F of t.options)F.selected=F.value===T});for(const x of this.data.options){const T=document.createElement("option");T.textContent=x.displayValue,T.value=x.exportValue,s.value.includes(x.exportValue)&&(T.setAttribute("selected",!0),i=!1),t.append(T)}let a=null;if(i){const x=document.createElement("option");x.value=" ",x.setAttribute("hidden",!0),x.setAttribute("selected",!0),t.prepend(x),a=()=>{x.remove(),t.removeEventListener("input",a),a=null},t.addEventListener("input",a)}const h=x=>{const T=x?"value":"textContent",{options:F,multiple:I}=t;return I?Array.prototype.filter.call(F,O=>O.selected).map(O=>O[T]):F.selectedIndex===-1?null:F[F.selectedIndex][T]};let f=h(!1);const y=x=>{const T=x.target.options;return Array.prototype.map.call(T,F=>({displayValue:F.textContent,exportValue:F.value}))};return this.enableScripting&&this.hasJSActions?(t.addEventListener("updatefromsandbox",x=>{const T={value(F){a?.();const I=F.detail.value,O=new Set(Array.isArray(I)?I:[I]);for(const D of t.options)D.selected=O.has(D.value);d.setValue(o,{value:h(!0)}),f=h(!1)},multipleSelection(F){t.multiple=!0},remove(F){const I=t.options,O=F.detail.remove;I[O].selected=!1,t.remove(O),I.length>0&&Array.prototype.findIndex.call(I,S=>S.selected)===-1&&(I[0].selected=!0),d.setValue(o,{value:h(!0),items:y(F)}),f=h(!1)},clear(F){for(;t.length!==0;)t.remove(0);d.setValue(o,{value:null,items:[]}),f=h(!1)},insert(F){const{index:I,displayValue:O,exportValue:D}=F.detail.insert,S=t.children[I],M=document.createElement("option");M.textContent=O,M.value=D,S?S.before(M):t.append(M),d.setValue(o,{value:h(!0),items:y(F)}),f=h(!1)},items(F){const{items:I}=F.detail;for(;t.length!==0;)t.remove(0);for(const O of I){const{displayValue:D,exportValue:S}=O,M=document.createElement("option");M.textContent=D,M.value=S,t.append(M)}t.options.length>0&&(t.options[0].selected=!0),d.setValue(o,{value:h(!0),items:y(F)}),f=h(!1)},indices(F){const I=new Set(F.detail.indices);for(const O of F.target.options)O.selected=I.has(O.index);d.setValue(o,{value:h(!0)}),f=h(!1)},editable(F){F.target.disabled=!F.detail.editable}};this._dispatchEventFromSandbox(T,x)}),t.addEventListener("input",x=>{const T=h(!0);d.setValue(o,{value:T}),x.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:f,changeEx:T,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(t,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],x=>x.target.value)):t.addEventListener("input",function(x){d.setValue(o,{value:h(!0)})}),this.data.combo&&this._setTextStyle(t),this._setBackgroundColor(t),this._setDefaultPropertiesFromJS(t),this.container.append(t),this.container}}class B extends p{constructor(d){const{data:o,elements:s}=d;super(d,{isRenderable:p._hasPopupData(o)}),this.elements=s}render(){this.container.classList.add("popupAnnotation");const d=new X({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,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}),o=[];for(const s of this.elements)s.popup=d,o.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",o.map(s=>`${A.AnnotationPrefix}${s}`).join(",")),this.container}}
2class X{#t=this.#A.bind(this);#e=this.#g.bind(this);#s=this.#v.bind(this);#i=this.#y.bind(this);#n=null;#r=null;#o=null;#l=null;#h=null;#c=null;#f=null;#u=!1;#d=null;#a=null;#p=null;#m=null;#b=!1;constructor({container:d,color:o,elements:s,titleObj:t,modificationDate:i,contentsObj:a,richText:h,parent:f,rect:y,parentRect:x,open:T}){this.#r=d,this.#m=t,this.#o=a,this.#p=h,this.#c=f,this.#n=o,this.#a=y,this.#f=x,this.#h=s,this.#l=V.PDFDateString.toDateObject(i),this.trigger=s.flatMap(F=>F.getElementsToTriggerPopup());for(const F of this.trigger)F.addEventListener("click",this.#i),F.addEventListener("mouseenter",this.#s),F.addEventListener("mouseleave",this.#e),F.classList.add("popupTriggerArea");for(const F of s)F.container?.addEventListener("keydown",this.#t);this.#r.hidden=!0,T&&this.#y()}render(){if(this.#d)return;const{page:{view:d},viewport:{rawDims:{pageWidth:o,pageHeight:s,pageX:t,pageY:i}}}=this.#c,a=this.#d=document.createElement("div");if(a.className="popup",this.#n){const G=a.style.outlineColor=A.Util.makeHexColor(...this.#n);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?a.style.backgroundColor=`color-mix(in srgb, ${G} 30%, white)`:a.style.backgroundColor=A.Util.makeHexColor(...this.#n.map(et=>Math.floor(.7*(255-et)+et)))}const h=document.createElement("span");h.className="header";const f=document.createElement("h1");if(h.append(f),{dir:f.dir,str:f.textContent}=this.#m,a.append(h),this.#l){const G=document.createElement("span");G.classList.add("popupDate"),G.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),G.setAttribute("data-l10n-args",JSON.stringify({date:this.#l.toLocaleDateString(),time:this.#l.toLocaleTimeString()})),h.append(G)}const y=this.#o,x=this.#p;if(x?.str&&(!y?.str||y.str===x.str))w.XfaLayer.render({xfaHtml:x.html,intent:"richText",div:a}),a.lastChild.classList.add("richText","popupContent");else{const G=this._formatContents(y);a.append(G)}let T=!!this.#f,F=T?this.#f:this.#a;for(const G of this.#h)if(!F||A.Util.intersect(G.data.rect,F)!==null){F=G.data.rect,T=!0;break}const I=A.Util.normalizeRect([F[0],d[3]-F[1]+d[1],F[2],d[3]-F[3]+d[1]]),D=T?F[2]-F[0]+5:0,S=I[0]+D,M=I[1],{style:$}=this.#r;$.left=`${100*(S-t)/o}%`,$.top=`${100*(M-i)/s}%`,this.#r.append(a)}_formatContents({str:d,dir:o}){const s=document.createElement("p");s.classList.add("popupContent"),s.dir=o;const t=d.split(/(?:\r\n?|\n)/);for(let i=0,a=t.length;i<a;++i){const h=t[i];s.append(document.createTextNode(h)),i<a-1&&s.append(document.createElement("br"))}return s}#A(d){d.altKey||d.shiftKey||d.ctrlKey||d.metaKey||(d.key==="Enter"||d.key==="Escape"&&this.#u)&&this.#y()}#y(){this.#u=!this.#u,this.#u?(this.#v(),this.#r.addEventListener("click",this.#i),this.#r.addEventListener("keydown",this.#t)):(this.#g(),this.#r.removeEventListener("click",this.#i),this.#r.removeEventListener("keydown",this.#t))}#v(){this.#d||this.render(),this.isVisible?this.#u&&this.#r.classList.add("focused"):(this.#r.hidden=!1,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)+1e3)}#g(){this.#r.classList.remove("focused"),!(this.#u||!this.isVisible)&&(this.#r.hidden=!0,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)-1e3)}forceHide(){this.#b=this.isVisible,this.#b&&(this.#r.hidden=!0)}maybeShow(){this.#b&&(this.#b=!1,this.#r.hidden=!1)}get isVisible(){return this.#r.hidden===!1}}class Y extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0}),this.textContent=d.data.textContent,this.textPosition=d.data.textPosition,this.annotationEditorType=A.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const d=document.createElement("div");d.classList.add("annotationTextContent"),d.setAttribute("role","comment");for(const o of this.textContent){const s=document.createElement("span");s.textContent=o,d.append(s)}this.container.append(d)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class tt extends p{#t=null;constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const d=this.data,{width:o,height:s}=g(d.rect),t=this.svgFactory.create(o,s,!0),i=this.#t=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",d.rect[2]-d.lineCoordinates[0]),i.setAttribute("y1",d.rect[3]-d.lineCoordinates[1]),i.setAttribute("x2",d.rect[2]-d.lineCoordinates[2]),i.setAttribute("y2",d.rect[3]-d.lineCoordinates[3]),i.setAttribute("stroke-width",d.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),t.append(i),this.container.append(t),!d.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class rt extends p{#t=null;constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const d=this.data,{width:o,height:s}=g(d.rect),t=this.svgFactory.create(o,s,!0),i=d.borderStyle.width,a=this.#t=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",i/2),a.setAttribute("y",i/2),a.setAttribute("width",o-i),a.setAttribute("height",s-i),a.setAttribute("stroke-width",i||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),t.append(a),this.container.append(t),!d.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class j extends p{#t=null;constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const d=this.data,{width:o,height:s}=g(d.rect),t=this.svgFactory.create(o,s,!0),i=d.borderStyle.width,a=this.#t=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",o/2),a.setAttribute("cy",s/2),a.setAttribute("rx",o/2-i/2),a.setAttribute("ry",s/2-i/2),a.setAttribute("stroke-width",i||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),t.append(a),this.container.append(t),!d.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class _ extends p{#t=null;constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const d=this.data,{width:o,height:s}=g(d.rect),t=this.svgFactory.create(o,s,!0);let i=[];for(const h of d.vertices){const f=h.x-d.rect[0],y=d.rect[3]-h.y;i.push(f+","+y)}i=i.join(" ");const a=this.#t=this.svgFactory.createElement(this.svgElementName);return a.setAttribute("points",i),a.setAttribute("stroke-width",d.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),t.append(a),this.container.append(t),!d.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}
2class H extends _{constructor(d){super(d),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class q extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class Q extends p{#t=[];constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=A.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const d=this.data,{width:o,height:s}=g(d.rect),t=this.svgFactory.create(o,s,!0);for(const i of d.inkLists){let a=[];for(const f of i){const y=f.x-d.rect[0],x=d.rect[3]-f.y;a.push(`${y},${x}`)}a=a.join(" ");const h=this.svgFactory.createElement(this.svgElementName);this.#t.push(h),h.setAttribute("points",a),h.setAttribute("stroke-width",d.borderStyle.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),!d.popupRef&&this.hasPopupData&&this._createPopup(),t.append(h)}return this.container.append(t),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class K extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class ft extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class ot extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class at extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class gt extends p{constructor(d){super(d,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class ct extends p{#t=null;constructor(d){super(d,{isRenderable:!0});const{filename:o,content:s}=this.data.file;this.filename=(0,V.getFilenameFromUrl)(o,!0),this.content=s,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:o,content:s})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:d,data:o}=this;let s;o.hasAppearance||o.fillAlpha===0?s=document.createElement("div"):(s=document.createElement("img"),s.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(o.name)?"paperclip":"pushpin"}.svg`,o.fillAlpha&&o.fillAlpha<1&&(s.style=`filter: opacity(${Math.round(o.fillAlpha*100)}%);`)),s.addEventListener("dblclick",this.#e.bind(this)),this.#t=s;const{isMac:t}=A.FeatureTest.platform;return d.addEventListener("keydown",i=>{i.key==="Enter"&&(t?i.metaKey:i.ctrlKey)&&this.#e()}),!o.popupRef&&this.hasPopupData?this._createPopup():s.classList.add("popupTriggerArea"),d.append(s),d}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}#e(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class ht{#t=null;#e=null;#s=new Map;constructor({div:d,accessibilityManager:o,annotationCanvasMap:s,page:t,viewport:i}){this.div=d,this.#t=o,this.#e=s,this.page=t,this.viewport=i,this.zIndex=0}#i(d,o){const s=d.firstChild||d;s.id=`${A.AnnotationPrefix}${o}`,this.div.append(d),this.#t?.moveElementInDOM(this.div,d,s,!1)}async render(d){const{annotations:o}=d,s=this.div;(0,V.setLayerDimensions)(s,this.viewport);const t=new Map,i={data:null,layer:s,linkService:d.linkService,downloadManager:d.downloadManager,imageResourcesPath:d.imageResourcesPath||"",renderForms:d.renderForms!==!1,svgFactory:new V.DOMSVGFactory,annotationStorage:d.annotationStorage||new C.AnnotationStorage,enableScripting:d.enableScripting===!0,hasJSActions:d.hasJSActions,fieldObjects:d.fieldObjects,parent:this,elements:null};for(const a of o){if(a.noHTML)continue;const h=a.annotationType===A.AnnotationType.POPUP;if(h){const x=t.get(a.id);if(!x)continue;i.elements=x}else{const{width:x,height:T}=g(a.rect);if(x<=0||T<=0)continue}i.data=a;const f=r.create(i);if(!f.isRenderable)continue;if(!h&&a.popupRef){const x=t.get(a.popupRef);x?x.push(f):t.set(a.popupRef,[f])}f.annotationEditorType>0&&this.#s.set(f.data.id,f);const y=f.render();a.hidden&&(y.style.visibility="hidden"),this.#i(y,a.id)}this.#n()}update({viewport:d}){const o=this.div;this.viewport=d,(0,V.setLayerDimensions)(o,{rotation:d.rotation}),this.#n(),o.hidden=!1}#n(){if(!this.#e)return;const d=this.div;for(const[o,s]of this.#e){const t=d.querySelector(`[data-annotation-id="${o}"]`);if(!t)continue;const{firstChild:i}=t;i?i.nodeName==="CANVAS"?i.replaceWith(s):i.before(s):t.append(s)}this.#e.clear()}getEditableAnnotations(){return Array.from(this.#s.values())}getEditableAnnotation(d){return this.#s.get(d)}}},780:(ut,Z,U)=>{U.d(Z,{AnnotationStorage:()=>R,PrintAnnotationStorage:()=>L,SerializableEmpty:()=>N});
2var A=U(266),V=U(115),C=U(825);const N=Object.freeze({map:null,hash:"",transfer:void 0});class R{#t=!1;#e=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(v,l){const u=this.#e.get(v);return u===void 0?l:Object.assign(l,u)}getRawValue(v){return this.#e.get(v)}remove(v){if(this.#e.delete(v),this.#e.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const l of this.#e.values())if(l instanceof V.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(v,l){const u=this.#e.get(v);let g=!1;if(u!==void 0)for(const[r,p]of Object.entries(l))u[r]!==p&&(g=!0,u[r]=p);else g=!0,this.#e.set(v,l);g&&this.#s(),l instanceof V.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(l.constructor._type)}has(v){return this.#e.has(v)}getAll(){return this.#e.size>0?(0,A.objectFromMap)(this.#e):null}setAll(v){for(const[l,u]of Object.entries(v))this.setValue(l,u)}get size(){return this.#e.size}#s(){this.#t||(this.#t=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#t&&(this.#t=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new L(this)}get serializable(){if(this.#e.size===0)return N;const v=new Map,l=new C.MurmurHash3_64,u=[],g=Object.create(null);let r=!1;for(const[p,e]of this.#e){const n=e instanceof V.AnnotationEditor?e.serialize(!1,g):e;n&&(v.set(p,n),l.update(`${p}:${JSON.stringify(n)}`),r||=!!n.bitmap)}if(r)for(const p of v.values())p.bitmap&&u.push(p.bitmap);return v.size>0?{map:v,hash:l.hexdigest(),transfer:u}:N}}class L extends R{#t;constructor(v){super();const{map:l,hash:u,transfer:g}=v.serializable,r=structuredClone(l,g?{transfer:g}:null);this.#t={map:r,hash:u,transfer:g}}get print(){(0,A.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}}},406:(ut,Z,U)=>{U.a(ut,async(A,V)=>{try{let tt=function(s){if(typeof s=="string"||s instanceof URL?s={url:s}:(0,C.isArrayBuffer)(s)&&(s={data:s}),typeof s!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!s.url&&!s.data&&!s.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const t=new H,{docId:i}=t,a=s.url?j(s.url):null,h=s.data?_(s.data):null,f=s.httpHeaders||null,y=s.withCredentials===!0,x=s.password??null,T=s.range instanceof q?s.range:null,F=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:k;let I=s.worker instanceof at?s.worker:null;const O=s.verbosity,D=typeof s.docBaseUrl=="string"&&!(0,R.isDataScheme)(s.docBaseUrl)?s.docBaseUrl:null,S=typeof s.cMapUrl=="string"?s.cMapUrl:null,M=s.cMapPacked!==!1,$=s.CMapReaderFactory||B,G=typeof s.standardFontDataUrl=="string"?s.standardFontDataUrl:null,W=s.StandardFontDataFactory||Y,et=s.stopAtErrors!==!0,st=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,nt=s.isEvalSupported!==!1,it=typeof s.isOffscreenCanvasSupported=="boolean"?s.isOffscreenCanvasSupported:!C.isNodeJS,lt=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,mt=typeof s.disableFontFace=="boolean"?s.disableFontFace:C.isNodeJS,bt=s.fontExtraProperties===!0,At=s.enableXfa===!0,pt=s.ownerDocument||globalThis.document,Et=s.disableRange===!0,St=s.disableStream===!0,Tt=s.disableAutoFetch===!0,vt=s.pdfBug===!0,wt=T?T.length:s.length??NaN,yt=typeof s.useSystemFonts=="boolean"?s.useSystemFonts:!C.isNodeJS&&!mt,kt=typeof s.useWorkerFetch=="boolean"?s.useWorkerFetch:$===R.DOMCMapReaderFactory&&W===R.DOMStandardFontDataFactory&&S&&G&&(0,R.isValidFetchUrl)(S,document.baseURI)&&(0,R.isValidFetchUrl)(G,document.baseURI),Rt=s.canvasFactory||new z({ownerDocument:pt}),_t=s.filterFactory||new X({docId:i,ownerDocument:pt}),Ot=null;(0,C.setVerbosityLevel)(O);const Ft={canvasFactory:Rt,filterFactory:_t};if(kt||(Ft.cMapReaderFactory=new $({baseUrl:S,isCompressed:M}),Ft.standardFontDataFactory=new W({baseUrl:G})),!I){const Pt={verbosity:O,port:l.GlobalWorkerOptions.workerPort};I=Pt.port?at.fromPort(Pt):new at(Pt),t._worker=I}const Ct={docId:i,apiVersion:"4.0.379",data:h,password:x,disableAutoFetch:Tt,rangeChunkSize:F,length:wt,docBaseUrl:D,enableXfa:At,evaluatorOptions:{maxImageSize:st,disableFontFace:mt,ignoreErrors:et,isEvalSupported:nt,isOffscreenCanvasSupported:it,canvasMaxAreaInBytes:lt,fontExtraProperties:bt,useSystemFonts:yt,cMapUrl:kt?S:null,standardFontDataUrl:kt?G:null}},Ht={ignoreErrors:et,isEvalSupported:nt,disableFontFace:mt,fontExtraProperties:bt,enableXfa:At,ownerDocument:pt,disableAutoFetch:Tt,pdfBug:vt,styleElement:Ot};return I.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");const Pt=rt(I,Ct),It=new Promise(function(xt){let Nt;
2T?Nt=new p.PDFDataTransportStream({length:wt,initialData:T.initialData,progressiveDone:T.progressiveDone,contentDispositionFilename:T.contentDispositionFilename,disableRange:Et,disableStream:St},T):h||(Nt=(Dt=>C.isNodeJS?new c.PDFNodeStream(Dt):(0,R.isValidFetchUrl)(Dt.url)?new e.PDFFetchStream(Dt):new n.PDFNetworkStream(Dt))({url:a,length:wt,httpHeaders:f,withCredentials:y,rangeChunkSize:F,disableRange:Et,disableStream:St})),xt(Nt)});return Promise.all([Pt,It]).then(function([xt,Nt]){if(t.destroyed)throw new Error("Loading aborted");const zt=new u.MessageHandler(i,xt,I.port),Dt=new gt(zt,t,Nt,Ht,Ft);t._transport=Dt,zt.send("Ready",null)})}).catch(t._capability.reject),t},j=function(s){if(s instanceof URL)return s.href;try{return new URL(s,window.location).href}catch{if(C.isNodeJS&&typeof s=="string")return s}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")},_=function(s){if(C.isNodeJS&&typeof Buffer<"u"&&s instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength)return s;if(typeof s=="string")return(0,C.stringToBytes)(s);if(typeof s=="object"&&!isNaN(s?.length)||(0,C.isArrayBuffer)(s))return new Uint8Array(s);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")};U.d(Z,{PDFDataRangeTransport:()=>q,PDFWorker:()=>at,build:()=>o,getDocument:()=>tt,version:()=>d});var C=U(266),N=U(780),R=U(473),L=U(742),w=U(738),v=U(250),l=U(368),u=U(694),g=U(472),r=U(890),p=U(92),e=U(171),n=U(474),c=U(498),b=U(521),m=A([w,c]);[w,c]=m.then?(await m)():m;const k=65536,E=100,P=5e3,z=C.isNodeJS?w.NodeCanvasFactory:R.DOMCanvasFactory,B=C.isNodeJS?w.NodeCMapReaderFactory:R.DOMCMapReaderFactory,X=C.isNodeJS?w.NodeFilterFactory:R.DOMFilterFactory,Y=C.isNodeJS?w.NodeStandardFontDataFactory:R.DOMStandardFontDataFactory;async function rt(s,t){if(s.destroyed)throw new Error("Worker was destroyed");const i=await s.messageHandler.sendWithPromise("GetDocRequest",t,t.data?[t.data.buffer]:null);if(s.destroyed)throw new Error("Worker was destroyed");return i}class H{static#t=0;constructor(){this._capability=new C.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${H.#t++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}class q{constructor(t,i,a=!1,h=null){this.length=t,this.initialData=i,this.progressiveDone=a,this.contentDispositionFilename=h,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new C.PromiseCapability}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,i){for(const a of this._rangeListeners)a(t,i)}onDataProgress(t,i){this._readyCapability.promise.then(()=>{for(const a of this._progressListeners)a(t,i)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const i of this._progressiveReadListeners)i(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,i){(0,C.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Q{constructor(t,i){this._pdfInfo=t,this._transport=i}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,C.shadow)(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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}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()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}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()}}class K{#t=null;#e=!1;constructor(t,i,a,h=!1){this._pageIndex=t,this._pageInfo=i,this._transport=a,this._stats=h?new R.StatTimer:null,this._pdfBug=h,this.commonObjs=a.commonObjs,this.objs=new ct,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:i=this.rotate,offsetX:a=0,offsetY:h=0,dontFlip:f=!1}={}){return new R.PageViewport({viewBox:this.view,scale:t,rotation:i,offsetX:a,offsetY:h,dontFlip:f})}getAnnotations({intent:t="display"}={}
2){const i=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,i.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,C.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:i,intent:a="display",annotationMode:h=C.AnnotationMode.ENABLE,transform:f=null,background:y=null,optionalContentConfigPromise:x=null,annotationCanvasMap:T=null,pageColors:F=null,printAnnotationStorage:I=null}){this._stats?.time("Overall");const O=this._transport.getRenderingIntent(a,h,I);this.#e=!1,this.#i(),x||(x=this._transport.getOptionalContentConfig());let D=this._intentStates.get(O.cacheKey);D||(D=Object.create(null),this._intentStates.set(O.cacheKey,D)),D.streamReaderCancelTimeout&&(clearTimeout(D.streamReaderCancelTimeout),D.streamReaderCancelTimeout=null);const S=!!(O.renderingIntent&C.RenderingIntentFlag.PRINT);D.displayReadyCapability||(D.displayReadyCapability=new C.PromiseCapability,D.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(O));const M=W=>{D.renderTasks.delete($),(this._maybeCleanupAfterRender||S)&&(this.#e=!0),this.#s(!S),W?($.capability.reject(W),this._abortOperatorList({intentState:D,reason:W instanceof Error?W:new Error(W)})):$.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},$=new J({callback:M,params:{canvasContext:t,viewport:i,transform:f,background:y},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:T,operatorList:D.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!S,pdfBug:this._pdfBug,pageColors:F});(D.renderTasks||=new Set).add($);const G=$.task;return Promise.all([D.displayReadyCapability.promise,x]).then(([W,et])=>{if(this.destroyed){M();return}this._stats?.time("Rendering"),$.initializeGraphics({transparency:W,optionalContentConfig:et}),$.operatorListChanged()}).catch(M),G}getOperatorList({intent:t="display",annotationMode:i=C.AnnotationMode.ENABLE,printAnnotationStorage:a=null}={}){function h(){y.operatorList.lastChunk&&(y.opListReadCapability.resolve(y.operatorList),y.renderTasks.delete(x))}const f=this._transport.getRenderingIntent(t,i,a,!0);let y=this._intentStates.get(f.cacheKey);y||(y=Object.create(null),this._intentStates.set(f.cacheKey,y));let x;return y.opListReadCapability||(x=Object.create(null),x.operatorListChanged=h,y.opListReadCapability=new C.PromiseCapability,(y.renderTasks||=new Set).add(x),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(f)),y.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:i=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:i===!0},{highWaterMark:100,size(h){return h.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(a=>b.XfaText.textContent(a));const i=this.streamTextContent(t);return new Promise(function(a,h){function f(){y.read().then(function({value:T,done:F}){if(F){a(x);return}Object.assign(x.styles,T.styles),x.items.push(...T.items),f()},h)}const y=i.getReader(),x={items:[],styles:Object.create(null)};f()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const i of this._intentStates.values())if(this._abortOperatorList({intentState:i,reason:new Error("Page was destroyed."),force:!0}),!i.opListReadCapability)for(const a of i.renderTasks)t.push(a.completed),a.cancel();return this.objs.clear(),this.#e=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#e=!0;const i=this.#s(!1);return t&&i&&(this._stats&&=new R.StatTimer),i}#s(t=!1){if(this.#i(),!this.#e||this.destroyed)return!1;if(t)return this.#t=setTimeout(()=>{this.#t=null,this.#s(!1)},P),!1;for(const{renderTasks:i,operatorList:a}of this._intentStates.values())if(i.size>0||!a.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}#i(){this.#t&&(clearTimeout(this.#t),this.#t=null)}_startRenderPage(t,i){const a=this._intentStates.get(i);a&&(this._stats?.timeEnd("Page Request"),a.displayReadyCapability?.resolve(t))}_renderPageChunk(t,i){for(let a=0,h=t.length;a<h;a++)i.operatorList.fnArray.push(t.fnArray[a]),i.operatorList.argsArray.push(t.argsArray[a]);i.operatorList.lastChunk=t.lastChunk,i.operatorList.separateAnnots=t.separateAnnots;for(const a of i.renderTasks)a.operatorListChanged();
2t.lastChunk&&this.#s(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:i,annotationStorageSerializable:a}){const{map:h,transfer:f}=a,x=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:i,annotationStorage:h},f).getReader(),T=this._intentStates.get(i);T.streamReader=x;const F=()=>{x.read().then(({value:I,done:O})=>{if(O){T.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(I,T),F())},I=>{if(T.streamReader=null,!this._transport.destroyed){if(T.operatorList){T.operatorList.lastChunk=!0;for(const O of T.renderTasks)O.operatorListChanged();this.#s(!0)}if(T.displayReadyCapability)T.displayReadyCapability.reject(I);else if(T.opListReadCapability)T.opListReadCapability.reject(I);else throw I}})};F()}_abortOperatorList({intentState:t,reason:i,force:a=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!a){if(t.renderTasks.size>0)return;if(i instanceof R.RenderingCancelledException){let h=E;i.extraDelay>0&&i.extraDelay<1e3&&(h+=i.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:i,force:!0})},h);return}}if(t.streamReader.cancel(new C.AbortException(i.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[h,f]of this._intentStates)if(f===t){this._intentStates.delete(h);break}this.cleanup()}}}get stats(){return this._stats}}class ft{#t=new Set;#e=Promise.resolve();postMessage(t,i){const a={data:structuredClone(t,i?{transfer:i}:null)};this.#e.then(()=>{for(const h of this.#t)h.call(this,a)})}addEventListener(t,i){this.#t.add(i)}removeEventListener(t,i){this.#t.delete(i)}terminate(){this.#t.clear()}}const ot={isWorkerDisabled:!1,fakeWorkerId:0};C.isNodeJS&&(ot.isWorkerDisabled=!0,l.GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"),ot.isSameOrigin=function(s,t){let i;try{if(i=new URL(s),!i.origin||i.origin==="null")return!1}catch{return!1}const a=new URL(t,i);return i.origin===a.origin},ot.createCDNWrapper=function(s){const t=`await import("${s}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class at{static#t;constructor({name:t=null,port:i=null,verbosity:a=(0,C.getVerbosityLevel)()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=a,this._readyCapability=new C.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,i){if(at.#t?.has(i))throw new Error("Cannot use more than one PDFWorker per port.");(at.#t||=new WeakMap).set(i,this),this._initializeFromPort(i);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new u.MessageHandler("main","worker",t),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!ot.isWorkerDisabled&&!at.#e){let{workerSrc:t}=at;try{ot.isSameOrigin(window.location.href,t)||(t=ot.createCDNWrapper(new URL(t,window.location).href));const i=new Worker(t,{type:"module"}),a=new u.MessageHandler("main","worker",i),h=()=>{i.removeEventListener("error",f),a.destroy(),i.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},f=()=>{this._webWorker||h()};i.addEventListener("error",f),a.on("test",x=>{if(i.removeEventListener("error",f),this.destroyed){h();return}x?(this._messageHandler=a,this._port=i,this._webWorker=i,this._readyCapability.resolve(),a.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),a.destroy(),i.terminate())}),a.on("ready",x=>{if(i.removeEventListener("error",f),this.destroyed){h();return}try{y()}catch{this._setupFakeWorker()}});const y=()=>{const x=new Uint8Array;a.send("test",x,[x.buffer])};y();return}catch{(0,C.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){ot.isWorkerDisabled||((0,C.warn)("Setting up fake worker."),ot.isWorkerDisabled=!0),at._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const i=new ft;this._port=i;const a=`fake${ot.fakeWorkerId++}`,h=new u.MessageHandler(a+"_worker",a,i);t.setup(h,i);const f=new u.MessageHandler(a,a+"_worker",i);this._messageHandler=f,this._readyCapability.resolve(),f.send("configure",{verbosity:this.verbosity})}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),at.#t?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const i=this.#t?.get(t.port);
2if(i){if(i._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new at(t)}static get workerSrc(){if(l.GlobalWorkerOptions.workerSrc)return l.GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#e(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const t=async()=>this.#e?this.#e:(await import(this.workerSrc)).WorkerMessageHandler;return(0,C.shadow)(this,"_setupFakeWorkerGlobal",t())}}class gt{#t=new Map;#e=new Map;#s=new Map;#i=null;constructor(t,i,a,h,f){this.messageHandler=t,this.loadingTask=i,this.commonObjs=new ct,this.fontLoader=new L.FontLoader({ownerDocument:h.ownerDocument,styleElement:h.styleElement}),this._params=h,this.canvasFactory=f.canvasFactory,this.filterFactory=f.filterFactory,this.cMapReaderFactory=f.cMapReaderFactory,this.standardFontDataFactory=f.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=a,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new C.PromiseCapability,this.setupMessageHandler()}#n(t,i=null){const a=this.#t.get(t);if(a)return a;const h=this.messageHandler.sendWithPromise(t,i);return this.#t.set(t,h),h}get annotationStorage(){return(0,C.shadow)(this,"annotationStorage",new N.AnnotationStorage)}getRenderingIntent(t,i=C.AnnotationMode.ENABLE,a=null,h=!1){let f=C.RenderingIntentFlag.DISPLAY,y=N.SerializableEmpty;switch(t){case"any":f=C.RenderingIntentFlag.ANY;break;case"display":break;case"print":f=C.RenderingIntentFlag.PRINT;break;default:(0,C.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(i){case C.AnnotationMode.DISABLE:f+=C.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case C.AnnotationMode.ENABLE:break;case C.AnnotationMode.ENABLE_FORMS:f+=C.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case C.AnnotationMode.ENABLE_STORAGE:f+=C.RenderingIntentFlag.ANNOTATIONS_STORAGE,y=(f&C.RenderingIntentFlag.PRINT&&a instanceof N.PrintAnnotationStorage?a:this.annotationStorage).serializable;break;default:(0,C.warn)(`getRenderingIntent - invalid annotationMode: ${i}`)}return h&&(f+=C.RenderingIntentFlag.OPLIST),{renderingIntent:f,cacheKey:`${f}_${y.hash}`,annotationStorageSerializable:y}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new C.PromiseCapability,this.#i?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const a of this.#e.values())t.push(a._destroy());this.#e.clear(),this.#s.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return t.push(i),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new C.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:i}=this;t.on("GetReader",(a,h)=>{(0,C.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=f=>{this._lastProgress={loaded:f.loaded,total:f.total}},h.onPull=()=>{this._fullReader.read().then(function({value:f,done:y}){if(y){h.close();return}(0,C.assert)(f instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),h.enqueue(new Uint8Array(f),1,[f])}).catch(f=>{h.error(f)})},h.onCancel=f=>{this._fullReader.cancel(f),h.ready.catch(y=>{if(!this.destroyed)throw y})}}),t.on("ReaderHeadersReady",a=>{const h=new C.PromiseCapability,f=this._fullReader;return f.headersReady.then(()=>{(!f.isStreamingSupported||!f.isRangeSupported)&&(this._lastProgress&&i.onProgress?.(this._lastProgress),f.onProgress=y=>{i.onProgress?.({loaded:y.loaded,total:y.total})}),h.resolve({isStreamingSupported:f.isStreamingSupported,isRangeSupported:f.isRangeSupported,contentLength:f.contentLength})},h.reject),h.promise}),t.on("GetRangeReader",(a,h)=>{(0,C.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const f=this._networkStream.getRangeReader(a.begin,a.end);if(!f){h.close();return}h.onPull=()=>{f.read().then(function({value:y,done:x}){if(x){h.close();return}(0,C.assert)(y instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),h.enqueue(new Uint8Array(y),1,[y])}).catch(y=>{h.error(y)})},h.onCancel=y=>{f.cancel(y),h.ready.catch(x=>
2{if(!this.destroyed)throw x})}}),t.on("GetDoc",({pdfInfo:a})=>{this._numPages=a.numPages,this._htmlForXfa=a.htmlForXfa,delete a.htmlForXfa,i._capability.resolve(new Q(a,this))}),t.on("DocException",function(a){let h;switch(a.name){case"PasswordException":h=new C.PasswordException(a.message,a.code);break;case"InvalidPDFException":h=new C.InvalidPDFException(a.message);break;case"MissingPDFException":h=new C.MissingPDFException(a.message);break;case"UnexpectedResponseException":h=new C.UnexpectedResponseException(a.message,a.status);break;case"UnknownErrorException":h=new C.UnknownErrorException(a.message,a.details);break;default:(0,C.unreachable)("DocException - expected a valid Error.")}i._capability.reject(h)}),t.on("PasswordRequest",a=>{if(this.#i=new C.PromiseCapability,i.onPassword){const h=f=>{f instanceof Error?this.#i.reject(f):this.#i.resolve({password:f})};try{i.onPassword(h,a.code)}catch(f){this.#i.reject(f)}}else this.#i.reject(new C.PasswordException(a.message,a.code));return this.#i.promise}),t.on("DataLoaded",a=>{i.onProgress?.({loaded:a.length,total:a.length}),this.downloadInfoCapability.resolve(a)}),t.on("StartRenderPage",a=>{if(this.destroyed)return;this.#e.get(a.pageIndex)._startRenderPage(a.transparency,a.cacheKey)}),t.on("commonobj",([a,h,f])=>{if(this.destroyed||this.commonObjs.has(a))return null;switch(h){case"Font":const y=this._params;if("error"in f){const I=f.error;(0,C.warn)(`Error during font loading: ${I}`),this.commonObjs.resolve(a,I);break}const x=y.pdfBug&&globalThis.FontInspector?.enabled?(I,O)=>globalThis.FontInspector.fontAdded(I,O):null,T=new L.FontFaceObject(f,{isEvalSupported:y.isEvalSupported,disableFontFace:y.disableFontFace,ignoreErrors:y.ignoreErrors,inspectFont:x});this.fontLoader.bind(T).catch(I=>t.sendWithPromise("FontFallback",{id:a})).finally(()=>{!y.fontExtraProperties&&T.data&&(T.data=null),this.commonObjs.resolve(a,T)});break;case"CopyLocalImage":const{imageRef:F}=f;(0,C.assert)(F,"The imageRef must be defined.");for(const I of this.#e.values())for(const[,O]of I.objs)if(O.ref===F)return O.dataLen?(this.commonObjs.resolve(a,structuredClone(O)),O.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(a,f);break;default:throw new Error(`Got unknown common object type ${h}`)}return null}),t.on("obj",([a,h,f,y])=>{if(this.destroyed)return;const x=this.#e.get(h);if(!x.objs.has(a)){if(x._intentStates.size===0){y?.bitmap?.close();return}switch(f){case"Image":x.objs.resolve(a,y),y?.dataLen>C.MAX_IMAGE_SIZE_TO_CACHE&&(x._maybeCleanupAfterRender=!0);break;case"Pattern":x.objs.resolve(a,y);break;default:throw new Error(`Got unknown object type ${f}`)}}}),t.on("DocProgress",a=>{this.destroyed||i.onProgress?.({loaded:a.loaded,total:a.total})}),t.on("FetchBuiltInCMap",a=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(a):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",a=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(a):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,C.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:i}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},i).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const i=t-1,a=this.#s.get(i);if(a)return a;const h=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(f=>{if(this.destroyed)throw new Error("Transport destroyed");const y=new K(i,f,this,this._params.pdfBug);return this.#e.set(i,y),y});return this.#s.set(i,h),h}getPageIndex(t){return typeof t!="object"||t===null||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithProm
2ise("GetPageIndex",{num:t.num,gen:t.gen})}getAnnotations(t,i){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:i})}getFieldObjects(){return this.#n("GetFieldObjects")}hasJSActions(){return this.#n("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)}getDocJSActions(){return this.#n("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(t=>new r.OptionalContentConfig(t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",i=this.#t.get(t);if(i)return i;const a=this.messageHandler.sendWithPromise(t,null).then(h=>({info:h[0],metadata:h[1]?new g.Metadata(h[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#t.set(t,a),a}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const i of this.#e.values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:t,enableXfa:i}=this._params;return(0,C.shadow)(this,"loadingParams",{disableAutoFetch:t,enableXfa:i})}}class ct{#t=Object.create(null);#e(t){return this.#t[t]||={capability:new C.PromiseCapability,data:null}}get(t,i=null){if(i){const h=this.#e(t);return h.capability.promise.then(()=>i(h.data)),null}const a=this.#t[t];if(!a?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return a.data}has(t){return this.#t[t]?.capability.settled??!1}resolve(t,i=null){const a=this.#e(t);a.data=i,a.capability.resolve()}clear(){for(const t in this.#t){const{data:i}=this.#t[t];i?.bitmap?.close()}this.#t=Object.create(null)}*[Symbol.iterator](){for(const t in this.#t){const{capability:i,data:a}=this.#t[t];i.settled&&(yield[t,a])}}}class ht{#t=null;constructor(t){this.#t=t,this.onContinue=null}get promise(){return this.#t.capability.promise}cancel(t=0){this.#t.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#t.operatorList;if(!t)return!1;const{annotationCanvasMap:i}=this.#t;return t.form||t.canvas&&i?.size>0}}class J{static#t=new WeakSet;constructor({callback:t,params:i,objs:a,commonObjs:h,annotationCanvasMap:f,operatorList:y,pageIndex:x,canvasFactory:T,filterFactory:F,useRequestAnimationFrame:I=!1,pdfBug:O=!1,pageColors:D=null}){this.callback=t,this.params=i,this.objs=a,this.commonObjs=h,this.annotationCanvasMap=f,this.operatorListIdx=null,this.operatorList=y,this._pageIndex=x,this.canvasFactory=T,this.filterFactory=F,this._pdfBug=O,this.pageColors=D,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=I===!0&&typeof window<"u",this.cancelled=!1,this.capability=new C.PromiseCapability,this.task=new ht(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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:i}){if(this.cancelled)return;
2if(this._canvas){if(J.#t.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.");J.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:h,transform:f,background:y}=this.params;this.gfx=new v.CanvasGraphics(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:f,viewport:h,transparency:t,background:y}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,i=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),J.#t.delete(this._canvas),this.callback(t||new R.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,i))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.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?window.requestAnimationFrame(()=>{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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),J.#t.delete(this._canvas),this.callback())))}}const d="4.0.379",o="9e14d04fd";V()}catch(k){V(k)}})},822:(ut,Z,U)=>{U.d(Z,{BaseCMapReaderFactory:()=>N,BaseCanvasFactory:()=>C,BaseFilterFactory:()=>V,BaseSVGFactory:()=>L,BaseStandardFontDataFactory:()=>R});var A=U(266);class V{constructor(){this.constructor===V&&(0,A.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(v){return"none"}addHCMFilter(v,l){return"none"}addHighlightHCMFilter(v,l,u,g){return"none"}destroy(v=!1){}}class C{constructor(){this.constructor===C&&(0,A.unreachable)("Cannot initialize BaseCanvasFactory.")}create(v,l){if(v<=0||l<=0)throw new Error("Invalid canvas size");const u=this._createCanvas(v,l);return{canvas:u,context:u.getContext("2d")}}reset(v,l,u){if(!v.canvas)throw new Error("Canvas is not specified");if(l<=0||u<=0)throw new Error("Invalid canvas size");v.canvas.width=l,v.canvas.height=u}destroy(v){if(!v.canvas)throw new Error("Canvas is not specified");v.canvas.width=0,v.canvas.height=0,v.canvas=null,v.context=null}_createCanvas(v,l){(0,A.unreachable)("Abstract method `_createCanvas` called.")}}class N{constructor({baseUrl:v=null,isCompressed:l=!0}){this.constructor===N&&(0,A.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=v,this.isCompressed=l}async fetch({name:v}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!v)throw new Error("CMap name must be specified.");const l=this.baseUrl+v+(this.isCompressed?".bcmap":""),u=this.isCompressed?A.CMapCompressionType.BINARY:A.CMapCompressionType.NONE;return this._fetchData(l,u).catch(g=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${l}`)})}_fetchData(v,l){(0,A.unreachable)("Abstract method `_fetchData` called.")}}class R{constructor({baseUrl:v=null}){this.constructor===R&&(0,A.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=v}async fetch({filename:v}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!v)throw new Error("Font filename must be specified.");const l=`${this.baseUrl}${v}`;return this._fetchData(l).catch(u=>{throw new Error(`Unable to load font data at: ${l}`)})}_fetchData(v){(0,A.unreachable)("Abstract method `_fetchData` called.")}}class L{constructor(){this.constructor===L&&(0,A.unreachable)("Cannot initialize BaseSVGFactory.")}create(v,l,u=!1){if(v<=0||l<=0)throw new Error("Invalid SVG dimensions");const g=this._createSVG("svg:svg");return g.setAttribute("version","1.1"),u||(g.setAttribute("width",`${v}px`),g.setAttribute("height",`${l}px`)),g.setAttribute("preserveAspectRatio","none"),g.setAttribute("viewBox",`0 0 ${v} ${l}`),g}createElement(v){if(typeof v!="string")throw new Error("Invalid SVG element type");return this._createSVG(v)}_createSVG(v){(0,A.unreachable)("Abstract method `_createSVG` called.")}}},250:(ut,Z,U)=>{U.d(Z,{CanvasGraphics:()=>d});var A=U(266),V=U(473);const C={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function N(o,s){if(!s)return;const t=s[2]-s[0],i=s[3]-s[1],a=new Path2D;a.rect(s[0],s[1],t,i),o.clip(a)}class R{constructor(){this.constructor===R&&(0,A.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,A.unreachable)("Abstract method `getPattern` called.")}}class L extends R{constructor(s){super(),this._type=s[1],this._bbox=s[2],this._colorStops=s[3],this._p0=s[4],this._p1=s[5],this._r0=s[6],this._r1=s[7],this.matrix=null}_createGradient(s){let t;this._type==="axial"?t=s.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(t=s.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)t.addColorStop(i[0],i[1]);return t}getPattern(s,t,i,a){let h;if(a===C.STROKE||a===C.FILL){const f=t.current.getClippedPathBoundingBox(a,(0,V.getCurrentTransform)(s))||[0,0,0,0],y=Math.ceil(f[2]-f[0])||1,x=Math.ceil(f[3]-f[1])||1,T=t.cachedCanvases.getCanvas("pattern",y,x,!0),F=T.context;F.clearRect(0,0,F.canvas.width,F.canvas.height),F.beginPath(),F.rect(0,0,F.canvas.width,F.canvas.height),F.translate(-f[0],-f[1]),i=A.Util.transform(i,[1,0,0,1,f[0],f[1]]),F.transform(...t.baseTransform),this.matrix&&F.transform(...this.matrix
2),N(F,this._bbox),F.fillStyle=this._createGradient(F),F.fill(),h=s.createPattern(T.canvas,"no-repeat");const I=new DOMMatrix(i);h.setTransform(I)}else N(s,this._bbox),h=this._createGradient(s);return h}}function w(o,s,t,i,a,h,f,y){const x=s.coords,T=s.colors,F=o.data,I=o.width*4;let O;x[t+1]>x[i+1]&&(O=t,t=i,i=O,O=h,h=f,f=O),x[i+1]>x[a+1]&&(O=i,i=a,a=O,O=f,f=y,y=O),x[t+1]>x[i+1]&&(O=t,t=i,i=O,O=h,h=f,f=O);const D=(x[t]+s.offsetX)*s.scaleX,S=(x[t+1]+s.offsetY)*s.scaleY,M=(x[i]+s.offsetX)*s.scaleX,$=(x[i+1]+s.offsetY)*s.scaleY,G=(x[a]+s.offsetX)*s.scaleX,W=(x[a+1]+s.offsetY)*s.scaleY;if(S>=W)return;const et=T[h],st=T[h+1],nt=T[h+2],it=T[f],lt=T[f+1],mt=T[f+2],bt=T[y],At=T[y+1],pt=T[y+2],Et=Math.round(S),St=Math.round(W);let Tt,vt,wt,yt,kt,Rt,_t,Ot;for(let Ft=Et;Ft<=St;Ft++){if(Ft<$){const xt=Ft<S?0:(S-Ft)/(S-$);Tt=D-(D-M)*xt,vt=et-(et-it)*xt,wt=st-(st-lt)*xt,yt=nt-(nt-mt)*xt}else{let xt;Ft>W?xt=1:$===W?xt=0:xt=($-Ft)/($-W),Tt=M-(M-G)*xt,vt=it-(it-bt)*xt,wt=lt-(lt-At)*xt,yt=mt-(mt-pt)*xt}let Ct;Ft<S?Ct=0:Ft>W?Ct=1:Ct=(S-Ft)/(S-W),kt=D-(D-G)*Ct,Rt=et-(et-bt)*Ct,_t=st-(st-At)*Ct,Ot=nt-(nt-pt)*Ct;const Ht=Math.round(Math.min(Tt,kt)),Pt=Math.round(Math.max(Tt,kt));let It=I*Ft+Ht*4;for(let xt=Ht;xt<=Pt;xt++)Ct=(Tt-xt)/(Tt-kt),Ct<0?Ct=0:Ct>1&&(Ct=1),F[It++]=vt-(vt-Rt)*Ct|0,F[It++]=wt-(wt-_t)*Ct|0,F[It++]=yt-(yt-Ot)*Ct|0,F[It++]=255}}function v(o,s,t){const i=s.coords,a=s.colors;let h,f;switch(s.type){case"lattice":const y=s.verticesPerRow,x=Math.floor(i.length/y)-1,T=y-1;for(h=0;h<x;h++){let F=h*y;for(let I=0;I<T;I++,F++)w(o,t,i[F],i[F+1],i[F+y],a[F],a[F+1],a[F+y]),w(o,t,i[F+y+1],i[F+1],i[F+y],a[F+y+1],a[F+1],a[F+y])}break;case"triangles":for(h=0,f=i.length;h<f;h+=3)w(o,t,i[h],i[h+1],i[h+2],a[h],a[h+1],a[h+2]);break;default:throw new Error("illegal figure")}}class l extends R{constructor(s){super(),this._coords=s[2],this._colors=s[3],this._figures=s[4],this._bounds=s[5],this._bbox=s[7],this._background=s[8],this.matrix=null}_createMeshCanvas(s,t,i){const y=Math.floor(this._bounds[0]),x=Math.floor(this._bounds[1]),T=Math.ceil(this._bounds[2])-y,F=Math.ceil(this._bounds[3])-x,I=Math.min(Math.ceil(Math.abs(T*s[0]*1.1)),3e3),O=Math.min(Math.ceil(Math.abs(F*s[1]*1.1)),3e3),D=T/I,S=F/O,M={coords:this._coords,colors:this._colors,offsetX:-y,offsetY:-x,scaleX:1/D,scaleY:1/S},$=I+2*2,G=O+2*2,W=i.getCanvas("mesh",$,G,!1),et=W.context,st=et.createImageData(I,O);if(t){const it=st.data;for(let lt=0,mt=it.length;lt<mt;lt+=4)it[lt]=t[0],it[lt+1]=t[1],it[lt+2]=t[2],it[lt+3]=255}for(const it of this._figures)v(st,it,M);return et.putImageData(st,2,2),{canvas:W.canvas,offsetX:y-2*D,offsetY:x-2*S,scaleX:D,scaleY:S}}getPattern(s,t,i,a){N(s,this._bbox);let h;if(a===C.SHADING)h=A.Util.singularValueDecompose2dScale((0,V.getCurrentTransform)(s));else if(h=A.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){const y=A.Util.singularValueDecompose2dScale(this.matrix);h=[h[0]*y[0],h[1]*y[1]]}const f=this._createMeshCanvas(h,a===C.SHADING?null:this._background,t.cachedCanvases);return a!==C.SHADING&&(s.setTransform(...t.baseTransform),this.matrix&&s.transform(...this.matrix)),s.translate(f.offsetX,f.offsetY),s.scale(f.scaleX,f.scaleY),s.createPattern(f.canvas,"no-repeat")}}class u extends R{getPattern(){return"hotpink"}}function g(o){switch(o[0]){case"RadialAxial":return new L(o);case"Mesh":return new l(o);case"Dummy":return new u}throw new Error(`Unknown IR type: ${o[0]}`)}const r={COLORED:1,UNCOLORED:2};class p{static MAX_PATTERN_SIZE=3e3;constructor(s,t,i,a,h){this.operatorList=s[2],this.matrix=s[3]||[1,0,0,1,0,0],this.bbox=s[4],this.xstep=s[5],this.ystep=s[6],this.paintType=s[7],this.tilingType=s[8],this.color=t,this.ctx=i,this.canvasGraphicsFactory=a,this.baseTransform=h}createPatternCanvas(s){const t=this.operatorList,i=this.bbox,a=this.xstep,h=this.ystep,f=this.paintType,y=this.tilingType,x=this.color,T=this.canvasGraphicsFactory;(0,A.info)("TilingType: "+y);const F=i[0],I=i[1],O=i[2],D=i[3],S=A.Util.singularValueDecompose2dScale(this.matrix),M=A.Util.singularValueDecompose2dScale(this.baseTransform),$=[S[0]*M[0],S[1]*M[1]],G=this.getSizeAndScale(a,this.ctx.canvas.width,$[0]),W=this.getSizeAndScale(h,this.ctx.canvas.height,$[1]),et=s.cachedCanvases.getCanvas("pattern",G.size,W.size,!0),st=et.context,nt=T.createCanvasGraphics(st);nt.groupLevel=s.groupLevel,this.setFillAndStrokeStyleToContext(nt,f,x);let it=F,lt=I,mt=O,bt=D;return F<0&&(it=0,mt+=Math.abs(F)),I<0&&(lt=0,bt+=Math.abs(I)),st.translate(-(G.scale*it),-(W.scale*lt)),nt.transform(G.scale,0,0,W.scale,0,0),st.save(),this.clipBbox(nt,it,lt,mt,bt),nt.baseTransform=(0,V.getCurrentTransform)(nt.ctx),nt.executeOperatorList(t),nt.endDrawing(),{canvas:et.canvas,scaleX:G.scale,scaleY:W.scale,offsetX:it,offsetY:lt}}getSizeAndScale(s,t,i){s=Math.abs(s);const a=Math.max(p.MAX_PATTERN_SIZE,t);let h=Math.ceil(s*i);return h>=a?h=a:i=h/s,{scale:i,size:h}}clipBbox(s,t,i,a,h){const f=a-t,y=h-i;s.ctx.rect(t,i,f,y),s.current.updateRectMinMax((0,V.getCurrentTransform)(s.ctx),[t,i,a,h]),s.clip(),s.endPath()}setFillAndStrokeStyleToContext(s,t,i){const a=s.ctx,h=s.current;switch(t){case r.COLORED:const f=this.ctx;a.fillStyle=f.fillStyle,a.strokeStyle=f.strokeStyle,h.fillColor=f.fillStyle,h.strokeColor=f.strokeStyle;break;case r.UNCOLORED:const y=A.Util.makeHexColor(i[0],i[1],i[2]);a.fillStyle=y,a.strokeStyle=y,h.fillColor=y,h.strokeColor=y;break;default:throw new A.FormatError(`Unsupported paint type: ${t}`)}}getPattern(s,t,i,a){let h=i;a!==C.SHADING&&(h=A.Util.transform(h,t.baseTransform),this.matrix&&(h=A.Util.transform(h,this.matrix
2)));const f=this.createPatternCanvas(t);let y=new DOMMatrix(h);y=y.translate(f.offsetX,f.offsetY),y=y.scale(1/f.scaleX,1/f.scaleY);const x=s.createPattern(f.canvas,"repeat");return x.setTransform(y),x}}function e({src:o,srcPos:s=0,dest:t,width:i,height:a,nonBlackColor:h=4294967295,inverseDecode:f=!1}){const y=A.FeatureTest.isLittleEndian?4278190080:255,[x,T]=f?[h,y]:[y,h],F=i>>3,I=i&7,O=o.length;t=new Uint32Array(t.buffer);let D=0;for(let S=0;S<a;S++){for(const $=s+F;s<$;s++){const G=s<O?o[s]:255;t[D++]=G&128?T:x,t[D++]=G&64?T:x,t[D++]=G&32?T:x,t[D++]=G&16?T:x,t[D++]=G&8?T:x,t[D++]=G&4?T:x,t[D++]=G&2?T:x,t[D++]=G&1?T:x}if(I===0)continue;const M=s<O?o[s++]:255;for(let $=0;$<I;$++)t[D++]=M&1<<7-$?T:x}return{srcPos:s,destPos:D}}const n=16,c=100,b=4096,m=15,k=10,E=1e3,P=16;function z(o,s){if(o._removeMirroring)throw new Error("Context is already forwarding operations.");o.__originalSave=o.save,o.__originalRestore=o.restore,o.__originalRotate=o.rotate,o.__originalScale=o.scale,o.__originalTranslate=o.translate,o.__originalTransform=o.transform,o.__originalSetTransform=o.setTransform,o.__originalResetTransform=o.resetTransform,o.__originalClip=o.clip,o.__originalMoveTo=o.moveTo,o.__originalLineTo=o.lineTo,o.__originalBezierCurveTo=o.bezierCurveTo,o.__originalRect=o.rect,o.__originalClosePath=o.closePath,o.__originalBeginPath=o.beginPath,o._removeMirroring=()=>{o.save=o.__originalSave,o.restore=o.__originalRestore,o.rotate=o.__originalRotate,o.scale=o.__originalScale,o.translate=o.__originalTranslate,o.transform=o.__originalTransform,o.setTransform=o.__originalSetTransform,o.resetTransform=o.__originalResetTransform,o.clip=o.__originalClip,o.moveTo=o.__originalMoveTo,o.lineTo=o.__originalLineTo,o.bezierCurveTo=o.__originalBezierCurveTo,o.rect=o.__originalRect,o.closePath=o.__originalClosePath,o.beginPath=o.__originalBeginPath,delete o._removeMirroring},o.save=function(){s.save(),this.__originalSave()},o.restore=function(){s.restore(),this.__originalRestore()},o.translate=function(i,a){s.translate(i,a),this.__originalTranslate(i,a)},o.scale=function(i,a){s.scale(i,a),this.__originalScale(i,a)},o.transform=function(i,a,h,f,y,x){s.transform(i,a,h,f,y,x),this.__originalTransform(i,a,h,f,y,x)},o.setTransform=function(i,a,h,f,y,x){s.setTransform(i,a,h,f,y,x),this.__originalSetTransform(i,a,h,f,y,x)},o.resetTransform=function(){s.resetTransform(),this.__originalResetTransform()},o.rotate=function(i){s.rotate(i),this.__originalRotate(i)},o.clip=function(i){s.clip(i),this.__originalClip(i)},o.moveTo=function(t,i){s.moveTo(t,i),this.__originalMoveTo(t,i)},o.lineTo=function(t,i){s.lineTo(t,i),this.__originalLineTo(t,i)},o.bezierCurveTo=function(t,i,a,h,f,y){s.bezierCurveTo(t,i,a,h,f,y),this.__originalBezierCurveTo(t,i,a,h,f,y)},o.rect=function(t,i,a,h){s.rect(t,i,a,h),this.__originalRect(t,i,a,h)},o.closePath=function(){s.closePath(),this.__originalClosePath()},o.beginPath=function(){s.beginPath(),this.__originalBeginPath()}}class B{constructor(s){this.canvasFactory=s,this.cache=Object.create(null)}getCanvas(s,t,i){let a;return this.cache[s]!==void 0?(a=this.cache[s],this.canvasFactory.reset(a,t,i)):(a=this.canvasFactory.create(t,i),this.cache[s]=a),a}delete(s){delete this.cache[s]}clear(){for(const s in this.cache){const t=this.cache[s];this.canvasFactory.destroy(t),delete this.cache[s]}}}function X(o,s,t,i,a,h,f,y,x,T){const[F,I,O,D,S,M]=(0,V.getCurrentTransform)(o);if(I===0&&O===0){const W=f*F+S,et=Math.round(W),st=y*D+M,nt=Math.round(st),it=(f+x)*F+S,lt=Math.abs(Math.round(it)-et)||1,mt=(y+T)*D+M,bt=Math.abs(Math.round(mt)-nt)||1;return o.setTransform(Math.sign(F),0,0,Math.sign(D),et,nt),o.drawImage(s,t,i,a,h,0,0,lt,bt),o.setTransform(F,I,O,D,S,M),[lt,bt]}if(F===0&&D===0){const W=y*O+S,et=Math.round(W),st=f*I+M,nt=Math.round(st),it=(y+T)*O+S,lt=Math.abs(Math.round(it)-et)||1,mt=(f+x)*I+M,bt=Math.abs(Math.round(mt)-nt)||1;return o.setTransform(0,Math.sign(I),Math.sign(O),0,et,nt),o.drawImage(s,t,i,a,h,0,0,bt,lt),o.setTransform(F,I,O,D,S,M),[bt,lt]}o.drawImage(s,t,i,a,h,f,y,x,T);const $=Math.hypot(F,I),G=Math.hypot(O,D);return[$*x,G*T]}function Y(o){const{width:s,height:t}=o;if(s>E||t>E)return null;const i=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),h=s+1;let f=new Uint8Array(h*(t+1)),y,x,T;const F=s+7&-8;let I=new Uint8Array(F*t),O=0;for(const G of o.data){let W=128;for(;W>0;)I[O++]=G&W?0:255,W>>=1}let D=0;for(O=0,I[O]!==0&&(f[0]=1,++D),x=1;x<s;x++)I[O]!==I[O+1]&&(f[x]=I[O]?2:1,++D),O++;for(I[O]!==0&&(f[x]=2,++D),y=1;y<t;y++){O=y*F,T=y*h,I[O-F]!==I[O]&&(f[T]=I[O]?1:8,++D);let G=(I[O]?4:0)+(I[O-F]?8:0);for(x=1;x<s;x++)G=(G>>2)+(I[O+1]?4:0)+(I[O-F+1]?8:0),a[G]&&(f[T+x]=a[G],++D),O++;if(I[O-F]!==I[O]&&(f[T+x]=I[O]?2:4,++D),D>i)return null}for(O=F*(t-1),T=y*h,I[O]!==0&&(f[T]=8,++D),x=1;x<s;x++)I[O]!==I[O+1]&&(f[T+x]=I[O]?4:8,++D),O++;if(I[O]!==0&&(f[T+x]=4,++D),D>i)return null;const S=new Int32Array([0,h,-1,0,-h,0,0,0,1]),M=new Path2D;for(y=0;D&&y<=t;y++){let G=y*h;const W=G+s;for(;G<W&&!f[G];)G++;if(G===W)continue;M.moveTo(G%h,y);const et=G;let st=f[G];do{const nt=S[st];do G+=nt;while(!f[G]);const it=f[G];it!==5&&it!==10?(st=it,f[G]=0):(st=it&51*st>>4,f[G]&=st>>2|st<<2),M.lineTo(G%h,G/h|0),f[G]||--D}while(et!==G);--y}return I=null,f=null,function(G){G.save(),G.scale(1/s,-1/t),G.translate(0,-t),G.fill(M),G.beginPath(),G.restore(
2)}}class tt{constructor(s,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=A.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=A.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=A.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,s,t])}clone(){const s=Object.create(this);return s.clipBox=this.clipBox.slice(),s}setCurrentPoint(s,t){this.x=s,this.y=t}updatePathMinMax(s,t,i){[t,i]=A.Util.applyTransform([t,i],s),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(s,t){const i=A.Util.applyTransform(t,s),a=A.Util.applyTransform(t.slice(2),s),h=A.Util.applyTransform([t[0],t[3]],s),f=A.Util.applyTransform([t[2],t[1]],s);this.minX=Math.min(this.minX,i[0],a[0],h[0],f[0]),this.minY=Math.min(this.minY,i[1],a[1],h[1],f[1]),this.maxX=Math.max(this.maxX,i[0],a[0],h[0],f[0]),this.maxY=Math.max(this.maxY,i[1],a[1],h[1],f[1])}updateScalingPathMinMax(s,t){A.Util.scaleMinMax(s,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(s,t,i,a,h,f,y,x,T,F){const I=A.Util.bezierBoundingBox(t,i,a,h,f,y,x,T);if(F){F[0]=Math.min(F[0],I[0],I[2]),F[1]=Math.max(F[1],I[0],I[2]),F[2]=Math.min(F[2],I[1],I[3]),F[3]=Math.max(F[3],I[1],I[3]);return}this.updateRectMinMax(s,I)}getPathBoundingBox(s=C.FILL,t=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(s===C.STROKE){t||(0,A.unreachable)("Stroke bounding box must include transform.");const a=A.Util.singularValueDecompose2dScale(t),h=a[0]*this.lineWidth/2,f=a[1]*this.lineWidth/2;i[0]-=h,i[1]-=f,i[2]+=h,i[3]+=f}return i}updateClipFromPath(){const s=A.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(s||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(s){this.clipBox=s,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(s=C.FILL,t=null){return A.Util.intersect(this.clipBox,this.getPathBoundingBox(s,t))}}function rt(o,s){if(typeof ImageData<"u"&&s instanceof ImageData){o.putImageData(s,0,0);return}const t=s.height,i=s.width,a=t%P,h=(t-a)/P,f=a===0?h:h+1,y=o.createImageData(i,P);let x=0,T;const F=s.data,I=y.data;let O,D,S,M;if(s.kind===A.ImageKind.GRAYSCALE_1BPP){const $=F.byteLength,G=new Uint32Array(I.buffer,0,I.byteLength>>2),W=G.length,et=i+7>>3,st=4294967295,nt=A.FeatureTest.isLittleEndian?4278190080:255;for(O=0;O<f;O++){for(S=O<h?P:a,T=0,D=0;D<S;D++){const it=$-x;let lt=0;const mt=it>et?i:it*8-7,bt=mt&-8;let At=0,pt=0;for(;lt<bt;lt+=8)pt=F[x++],G[T++]=pt&128?st:nt,G[T++]=pt&64?st:nt,G[T++]=pt&32?st:nt,G[T++]=pt&16?st:nt,G[T++]=pt&8?st:nt,G[T++]=pt&4?st:nt,G[T++]=pt&2?st:nt,G[T++]=pt&1?st:nt;for(;lt<mt;lt++)At===0&&(pt=F[x++],At=128),G[T++]=pt&At?st:nt,At>>=1}for(;T<W;)G[T++]=0;o.putImageData(y,0,O*P)}}else if(s.kind===A.ImageKind.RGBA_32BPP){for(D=0,M=i*P*4,O=0;O<h;O++)I.set(F.subarray(x,x+M)),x+=M,o.putImageData(y,0,D),D+=P;O<f&&(M=i*a*4,I.set(F.subarray(x,x+M)),o.putImageData(y,0,D))}else if(s.kind===A.ImageKind.RGB_24BPP)for(S=P,M=i*S,O=0;O<f;O++){for(O>=h&&(S=a,M=i*S),T=0,D=M;D--;)I[T++]=F[x++],I[T++]=F[x++],I[T++]=F[x++],I[T++]=255;o.putImageData(y,0,O*P)}else throw new Error(`bad image kind: ${s.kind}`)}function j(o,s){if(s.bitmap){o.drawImage(s.bitmap,0,0);return}const t=s.height,i=s.width,a=t%P,h=(t-a)/P,f=a===0?h:h+1,y=o.createImageData(i,P);let x=0;const T=s.data,F=y.data;for(let I=0;I<f;I++){const O=I<h?P:a;({srcPos:x}=e({src:T,srcPos:x,dest:F,width:i,height:O,nonBlackColor:0})),o.putImageData(y,0,I*P)}}function _(o,s){const t=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of t)o[i]!==void 0&&(s[i]=o[i]);o.setLineDash!==void 0&&(s.setLineDash(o.getLineDash()),s.lineDashOffset=o.lineDashOffset)}
2function H(o){if(o.strokeStyle=o.fillStyle="#000000",o.fillRule="nonzero",o.globalAlpha=1,o.lineWidth=1,o.lineCap="butt",o.lineJoin="miter",o.miterLimit=10,o.globalCompositeOperation="source-over",o.font="10px sans-serif",o.setLineDash!==void 0&&(o.setLineDash([]),o.lineDashOffset=0),!A.isNodeJS){const{filter:s}=o;s!=="none"&&s!==""&&(o.filter="none")}}function q(o,s,t,i){const a=o.length;for(let h=3;h<a;h+=4){const f=o[h];if(f===0)o[h-3]=s,o[h-2]=t,o[h-1]=i;else if(f<255){const y=255-f;o[h-3]=o[h-3]*f+s*y>>8,o[h-2]=o[h-2]*f+t*y>>8,o[h-1]=o[h-1]*f+i*y>>8}}}function Q(o,s,t){const i=o.length,a=1/255;for(let h=3;h<i;h+=4){const f=t?t[o[h]]:o[h];s[h]=s[h]*f*a|0}}function K(o,s,t){const i=o.length;for(let a=3;a<i;a+=4){const h=o[a-3]*77+o[a-2]*152+o[a-1]*28;s[a]=t?s[a]*t[h>>8]>>8:s[a]*h>>16}}function ft(o,s,t,i,a,h,f,y,x,T,F){const I=!!h,O=I?h[0]:0,D=I?h[1]:0,S=I?h[2]:0,M=a==="Luminosity"?K:Q,G=Math.min(i,Math.ceil(1048576/t));for(let W=0;W<i;W+=G){const et=Math.min(G,i-W),st=o.getImageData(y-T,W+(x-F),t,et),nt=s.getImageData(y,W+x,t,et);I&&q(st.data,O,D,S),M(st.data,nt.data,f),s.putImageData(nt,y,W+x)}}function ot(o,s,t,i){const a=i[0],h=i[1],f=i[2]-a,y=i[3]-h;f===0||y===0||(ft(s.context,t,f,y,s.subtype,s.backdrop,s.transferMap,a,h,s.offsetX,s.offsetY),o.save(),o.globalAlpha=1,o.globalCompositeOperation="source-over",o.setTransform(1,0,0,1,0,0),o.drawImage(t.canvas,0,0),o.restore())}function at(o,s){const t=A.Util.singularValueDecompose2dScale(o);t[0]=Math.fround(t[0]),t[1]=Math.fround(t[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*V.PixelsPerInch.PDF_TO_CSS_UNITS);return s!==void 0?s:t[0]<=i||t[1]<=i}const gt=["butt","round","square"],ct=["miter","round","bevel"],ht={},J={};class d{constructor(s,t,i,a,h,{optionalContentConfig:f,markedContentStack:y=null},x,T){this.ctx=s,this.current=new tt(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=i,this.canvasFactory=a,this.filterFactory=h,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=y||[],this.optionalContentConfig=f,this.cachedCanvases=new B(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=x,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=T,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(s,t=null){return typeof s=="string"?s.startsWith("g_")?this.commonObjs.get(s):this.objs.get(s):t}beginDrawing({transform:s,viewport:t,transparency:i=!1,background:a=null}){const h=this.ctx.canvas.width,f=this.ctx.canvas.height,y=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,h,f),this.ctx.fillStyle=y,i){const x=this.cachedCanvases.getCanvas("transparent",h,f);this.compositeCtx=this.ctx,this.transparentCanvas=x.canvas,this.ctx=x.context,this.ctx.save(),this.ctx.transform(...(0,V.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),H(this.ctx),s&&(this.ctx.transform(...s),this.outputScaleX=s[0],this.outputScaleY=s[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,V.getCurrentTransform)(this.ctx)}executeOperatorList(s,t,i,a){const h=s.argsArray,f=s.fnArray;let y=t||0;const x=h.length;if(x===y)return y;const T=x-y>k&&typeof i=="function",F=T?Date.now()+m:0;let I=0;const O=this.commonObjs,D=this.objs;let S;for(;;){if(a!==void 0&&y===a.nextBreakPoint)return a.breakIt(y,i),y;if(S=f[y],S!==A.OPS.dependency)this[S].apply(this,h[y]);else for(const M of h[y]){const $=M.startsWith("g_")?O:D;if(!$.has(M))return $.get(M,i),y}if(y++,y===x)return y;if(T&&++I>k){if(Date.now()>F)return i(),y;I=0}}}#t(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(
2),this.transparentCanvas=null)}endDrawing(){this.#t(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const s of this._cachedBitmapsMap.values()){for(const t of s.values())typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);s.clear()}this._cachedBitmapsMap.clear(),this.#e()}#e(){if(this.pageColors){const s=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(s!=="none"){const t=this.ctx.filter;this.ctx.filter=s,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(s,t){const i=s.width,a=s.height;let h=Math.max(Math.hypot(t[0],t[1]),1),f=Math.max(Math.hypot(t[2],t[3]),1),y=i,x=a,T="prescale1",F,I;for(;h>2&&y>1||f>2&&x>1;){let O=y,D=x;h>2&&y>1&&(O=y>=16384?Math.floor(y/2)-1||1:Math.ceil(y/2),h/=y/O),f>2&&x>1&&(D=x>=16384?Math.floor(x/2)-1||1:Math.ceil(x)/2,f/=x/D),F=this.cachedCanvases.getCanvas(T,O,D),I=F.context,I.clearRect(0,0,O,D),I.drawImage(s,0,0,y,x,0,0,O,D),s=F.canvas,y=O,x=D,T=T==="prescale1"?"prescale2":"prescale1"}return{img:s,paintWidth:y,paintHeight:x}}_createMaskCanvas(s){const t=this.ctx,{width:i,height:a}=s,h=this.current.fillColor,f=this.current.patternFill,y=(0,V.getCurrentTransform)(t);let x,T,F,I;if((s.bitmap||s.data)&&s.count>1){const mt=s.bitmap||s.data.buffer;T=JSON.stringify(f?y:[y.slice(0,4),h]),x=this._cachedBitmapsMap.get(mt),x||(x=new Map,this._cachedBitmapsMap.set(mt,x));const bt=x.get(T);if(bt&&!f){const At=Math.round(Math.min(y[0],y[2])+y[4]),pt=Math.round(Math.min(y[1],y[3])+y[5]);return{canvas:bt,offsetX:At,offsetY:pt}}F=bt}F||(I=this.cachedCanvases.getCanvas("maskCanvas",i,a),j(I.context,s));let O=A.Util.transform(y,[1/i,0,0,-1/a,0,0]);O=A.Util.transform(O,[1,0,0,1,0,-a]);const[D,S,M,$]=A.Util.getAxialAlignedBoundingBox([0,0,i,a],O),G=Math.round(M-D)||1,W=Math.round($-S)||1,et=this.cachedCanvases.getCanvas("fillCanvas",G,W),st=et.context,nt=D,it=S;st.translate(-nt,-it),st.transform(...O),F||(F=this._scaleImage(I.canvas,(0,V.getCurrentTransformInverse)(st)),F=F.img,x&&f&&x.set(T,F)),st.imageSmoothingEnabled=at((0,V.getCurrentTransform)(st),s.interpolate),X(st,F,0,0,F.width,F.height,0,0,i,a),st.globalCompositeOperation="source-in";const lt=A.Util.transform((0,V.getCurrentTransformInverse)(st),[1,0,0,1,-nt,-it]);return st.fillStyle=f?h.getPattern(t,this,lt,C.FILL):h,st.fillRect(0,0,i,a),x&&!f&&(this.cachedCanvases.delete("fillCanvas"),x.set(T,et.canvas)),{canvas:et.canvas,offsetX:Math.round(nt),offsetY:Math.round(it)}}setLineWidth(s){s!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=s,this.ctx.lineWidth=s}setLineCap(s){this.ctx.lineCap=gt[s]}setLineJoin(s){this.ctx.lineJoin=ct[s]}setMiterLimit(s){this.ctx.miterLimit=s}setDash(s,t){const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(s),i.lineDashOffset=t)}setRenderingIntent(s){}setFlatness(s){}setGState(s){for(const[t,i]of s)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const s=this.inSMaskMode;this.current.activeSMask&&!s?this.beginSMaskMode():!this.current.activeSMask&&s&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const s=this.ctx.canvas.width,t=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(i,s,t);this.suspendedCtx=this.ctx,this.ctx=a.context;const h=this.ctx;h.setTransform(...(0,V.getCurrentTransform)(this.suspendedCtx)),_(this.suspendedCtx,h),z(h,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),_(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(s){if(!this.current.activeSMask)return;s?(s[0]=Math.floor(s[0]),s[1]=Math.floor(s[1]),s[2]=Math.ceil(s[2]),s[3]=Math.ceil(s[3])):s=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask,i=this.suspendedCtx;ot(i,t,this.ctx,s),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore(
2)}save(){this.inSMaskMode?(_(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const s=this.current;this.stateStack.push(s),this.current=s.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),_(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(s,t,i,a,h,f){this.ctx.transform(s,t,i,a,h,f),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(s,t,i){const a=this.ctx,h=this.current;let f=h.x,y=h.y,x,T;const F=(0,V.getCurrentTransform)(a),I=F[0]===0&&F[3]===0||F[1]===0&&F[2]===0,O=I?i.slice(0):null;for(let D=0,S=0,M=s.length;D<M;D++)switch(s[D]|0){case A.OPS.rectangle:f=t[S++],y=t[S++];const $=t[S++],G=t[S++],W=f+$,et=y+G;a.moveTo(f,y),$===0||G===0?a.lineTo(W,et):(a.lineTo(W,y),a.lineTo(W,et),a.lineTo(f,et)),I||h.updateRectMinMax(F,[f,y,W,et]),a.closePath();break;case A.OPS.moveTo:f=t[S++],y=t[S++],a.moveTo(f,y),I||h.updatePathMinMax(F,f,y);break;case A.OPS.lineTo:f=t[S++],y=t[S++],a.lineTo(f,y),I||h.updatePathMinMax(F,f,y);break;case A.OPS.curveTo:x=f,T=y,f=t[S+4],y=t[S+5],a.bezierCurveTo(t[S],t[S+1],t[S+2],t[S+3],f,y),h.updateCurvePathMinMax(F,x,T,t[S],t[S+1],t[S+2],t[S+3],f,y,O),S+=6;break;case A.OPS.curveTo2:x=f,T=y,a.bezierCurveTo(f,y,t[S],t[S+1],t[S+2],t[S+3]),h.updateCurvePathMinMax(F,x,T,f,y,t[S],t[S+1],t[S+2],t[S+3],O),f=t[S+2],y=t[S+3],S+=4;break;case A.OPS.curveTo3:x=f,T=y,f=t[S+2],y=t[S+3],a.bezierCurveTo(t[S],t[S+1],f,y,f,y),h.updateCurvePathMinMax(F,x,T,t[S],t[S+1],f,y,f,y,O),S+=4;break;case A.OPS.closePath:a.closePath();break}I&&h.updateScalingPathMinMax(F,O),h.setCurrentPoint(f,y)}closePath(){this.ctx.closePath()}stroke(s=!0){const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof i=="object"&&i?.getPattern?(t.save(),t.strokeStyle=i.getPattern(t,this,(0,V.getCurrentTransformInverse)(t),C.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),s&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(s=!0){const t=this.ctx,i=this.current.fillColor,a=this.current.patternFill;let h=!1;a&&(t.save(),t.fillStyle=i.getPattern(t,this,(0,V.getCurrentTransformInverse)(t),C.FILL),h=!0);const f=this.current.getClippedPathBoundingBox();this.contentVisible&&f!==null&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),h&&t.restore(),s&&this.consumePath(f)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=ht}eoClip(){this.pendingClip=J}beginText(){this.current.textMatrix=A.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const s=this.pendingTextPaths,t=this.ctx;if(s===void 0){t.beginPath();return}t.save(),t.beginPath();for(const i of s)t.setTransform(...i.transform),t.translate(i.x,i.y),i.addToPath(t,i.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(s){this.current.charSpacing=s}setWordSpacing(s){this.current.wordSpacing=s}setHScale(s){this.current.textHScale=s/100}setLeading(s){this.current.leading=-s}setFont(s,t){const i=this.commonObjs.get(s),a=this.current;if(!i)throw new Error(`Can't find font for ${s}`);if(a.fontMatrix=i.fontMatrix||A.FONT_IDENTITY_MATRIX,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&(0,A.warn)("Invalid font matrix for font "+s),t<0?(t=-t,a.fontDirection=-1):a.fontDirection=1,this.current.font=i,this.current.fontSize=t,i.isType3Font)return;const h=i.loadedName||"sans-serif",f=i.systemFontInfo?.css||`"${h}", ${i.fallbackName}`;let y="normal";i.black?y="900":i.bold&&(y="bold");const x=i.italic?"italic":"normal";let T=t;t<n?T=n:t>c&&(T=c),this.current.fontSizeScale=t/T,this.ctx.font=`${x} ${y} ${T}px ${f}`}setTextRenderingMode(s){this.current.textRenderingMode=s}setTextRise(s){this.current.textRise=s}moveText(s,t){this.current.x=this.current.lineX+=s,this.current.y=this.current.lineY+=t}setLeadingMoveText(s,t){this.setLeading(-t),this.moveText(s,t)}setTextMatrix(s,t,i,a,h,f){this.current.textMatrix=[s,t,i,a,h,f],this.current.textMatrixScale=Math.hypot(s,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(s,t,i,a){const h=this.ctx,f=this.current,y=f.font,x=f.textRenderingMode,T=f.fontSize/f.fontSizeScale,F=x&A.TextRenderingMode.FILL_STROKE_MASK,I=!!(x&A.TextRenderingMode.ADD_TO_PATH_FLAG),O=f.patternFill&&!y.missingFile;let D;(y.disableFontFace||I||O)&&(D=y.getPathGenerator(this.commonObjs,s)),y.disableFontFace||O?(h.save(),h.translate(t,i),h.beginPath(),D(h,T),a&&h.setTransform(...a),(F===A.TextRenderingMode.FILL||F===A.TextRenderingMode.FILL_STROKE)&&h.fill(),(F===A.TextRenderingMode.STROKE||F===A.TextRenderingMode.FILL_STROKE)&&h.stroke(),h.restore(
2)):((F===A.TextRenderingMode.FILL||F===A.TextRenderingMode.FILL_STROKE)&&h.fillText(s,t,i),(F===A.TextRenderingMode.STROKE||F===A.TextRenderingMode.FILL_STROKE)&&h.strokeText(s,t,i)),I&&(this.pendingTextPaths||=[]).push({transform:(0,V.getCurrentTransform)(h),x:t,y:i,fontSize:T,addToPath:D})}get isFontSubpixelAAEnabled(){const{context:s}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);s.scale(1.5,1),s.fillText("I",0,10);const t=s.getImageData(0,0,10,10).data;let i=!1;for(let a=3;a<t.length;a+=4)if(t[a]>0&&t[a]<255){i=!0;break}return(0,A.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(s){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(s);const a=t.fontSize;if(a===0)return;const h=this.ctx,f=t.fontSizeScale,y=t.charSpacing,x=t.wordSpacing,T=t.fontDirection,F=t.textHScale*T,I=s.length,O=i.vertical,D=O?1:-1,S=i.defaultVMetrics,M=a*t.fontMatrix[0],$=t.textRenderingMode===A.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;h.save(),h.transform(...t.textMatrix),h.translate(t.x,t.y+t.textRise),T>0?h.scale(F,-1):h.scale(F,1);let G;if(t.patternFill){h.save();const it=t.fillColor.getPattern(h,this,(0,V.getCurrentTransformInverse)(h),C.FILL);G=(0,V.getCurrentTransform)(h),h.restore(),h.fillStyle=it}let W=t.lineWidth;const et=t.textMatrixScale;if(et===0||W===0){const it=t.textRenderingMode&A.TextRenderingMode.FILL_STROKE_MASK;(it===A.TextRenderingMode.STROKE||it===A.TextRenderingMode.FILL_STROKE)&&(W=this.getSinglePixelWidth())}else W/=et;if(f!==1&&(h.scale(f,f),W/=f),h.lineWidth=W,i.isInvalidPDFjsFont){const it=[];let lt=0;for(const mt of s)it.push(mt.unicode),lt+=mt.width;h.fillText(it.join(""),0,0),t.x+=lt*M*F,h.restore(),this.compose();return}let st=0,nt;for(nt=0;nt<I;++nt){const it=s[nt];if(typeof it=="number"){st+=D*it*a/1e3;continue}let lt=!1;const mt=(it.isSpace?x:0)+y,bt=it.fontChar,At=it.accent;let pt,Et,St=it.width;if(O){const vt=it.vmetric||S,wt=-(it.vmetric?vt[1]:St*.5)*M,yt=vt[2]*M;St=vt?-vt[0]:St,pt=wt/f,Et=(st+yt)/f}else pt=st/f,Et=0;if(i.remeasure&&St>0){const vt=h.measureText(bt).width*1e3/a*f;if(St<vt&&this.isFontSubpixelAAEnabled){const wt=St/vt;lt=!0,h.save(),h.scale(wt,1),pt/=wt}else St!==vt&&(pt+=(St-vt)/2e3*a/f)}if(this.contentVisible&&(it.isInFont||i.missingFile)){if($&&!At)h.fillText(bt,pt,Et);else if(this.paintChar(bt,pt,Et,G),At){const vt=pt+a*At.offset.x/f,wt=Et-a*At.offset.y/f;this.paintChar(At.fontChar,vt,wt,G)}}const Tt=O?St*M-mt*T:St*M+mt*T;st+=Tt,lt&&h.restore()}O?t.y-=st:t.x+=st*F,h.restore(),this.compose()}showType3Text(s){const t=this.ctx,i=this.current,a=i.font,h=i.fontSize,f=i.fontDirection,y=a.vertical?1:-1,x=i.charSpacing,T=i.wordSpacing,F=i.textHScale*f,I=i.fontMatrix||A.FONT_IDENTITY_MATRIX,O=s.length,D=i.textRenderingMode===A.TextRenderingMode.INVISIBLE;let S,M,$,G;if(!(D||h===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...i.textMatrix),t.translate(i.x,i.y),t.scale(F,f),S=0;S<O;++S){if(M=s[S],typeof M=="number"){G=y*M*h/1e3,this.ctx.translate(G,0),i.x+=G*F;continue}const W=(M.isSpace?T:0)+x,et=a.charProcOperatorList[M.operatorListId];if(!et){(0,A.warn)(`Type3 character "${M.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=M,this.save(),t.scale(h,h),t.transform(...I),this.executeOperatorList(et),this.restore()),$=A.Util.applyTransform([M.width,0],I)[0]*h+W,t.translate($,0),i.x+=$*F}t.restore(),this.processingType3=null}}setCharWidth(s,t){}setCharWidthAndBounds(s,t,i,a,h,f){this.ctx.rect(i,a,h-i,f-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(s){let t;if(s[0]==="TilingPattern"){const i=s[1],a=this.baseTransform||(0,V.getCurrentTransform)(this.ctx),h={createCanvasGraphics:f=>new d(f,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new p(s,i,this.ctx,h,a)}else t=this._getPattern(s[1],s[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(s,t,i){const a=A.Util.makeHexColor(s,t,i);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(s,t,i){const a=A.Util.makeHexColor(s,t,i);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(s,t=null){let i;return this.cachedPatterns.has(s)?i=this.cachedPatterns.get(s):(i=g(this.getObject(s)),this.cachedPatterns.set(s,i)),t&&(i.matrix=t),i}shadingFill(s){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(s);t.fillStyle=i.getPattern(t,this,(0,V.getCurrentTransformInverse)(t),C.SHADING);const a=(0,V.getCurrentTransformInverse)(t);if(a){const{width:h,height:f}=t.canvas,[y,x,T,F]=A.Util.getAxialAlignedBoundingBox([0,0,h,f],a);this.ctx.fillRect(y,x,T-y,F-x)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore(
2)}beginInlineImage(){(0,A.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,A.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(s,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(s)&&s.length===6&&this.transform(...s),this.baseTransform=(0,V.getCurrentTransform)(this.ctx),t)){const i=t[2]-t[0],a=t[3]-t[1];this.ctx.rect(t[0],t[1],i,a),this.current.updateRectMinMax((0,V.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(s){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;s.isolated||(0,A.info)("TODO: Support non-isolated groups."),s.knockout&&(0,A.warn)("Knockout groups not supported.");const i=(0,V.getCurrentTransform)(t);if(s.matrix&&t.transform(...s.matrix),!s.bbox)throw new Error("Bounding box is required.");let a=A.Util.getAxialAlignedBoundingBox(s.bbox,(0,V.getCurrentTransform)(t));const h=[0,0,t.canvas.width,t.canvas.height];a=A.Util.intersect(a,h)||[0,0,0,0];const f=Math.floor(a[0]),y=Math.floor(a[1]);let x=Math.max(Math.ceil(a[2])-f,1),T=Math.max(Math.ceil(a[3])-y,1),F=1,I=1;x>b&&(F=x/b,x=b),T>b&&(I=T/b,T=b),this.current.startNewPathAndClipBox([0,0,x,T]);let O="groupAt"+this.groupLevel;s.smask&&(O+="_smask_"+this.smaskCounter++%2);const D=this.cachedCanvases.getCanvas(O,x,T),S=D.context;S.scale(1/F,1/I),S.translate(-f,-y),S.transform(...i),s.smask?this.smaskStack.push({canvas:D.canvas,context:S,offsetX:f,offsetY:y,scaleX:F,scaleY:I,subtype:s.smask.subtype,backdrop:s.smask.backdrop,transferMap:s.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(f,y),t.scale(F,I),t.save()),_(t,S),this.ctx=S,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(s){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,s.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=(0,V.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const h=A.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],a);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(h)}}beginAnnotation(s,t,i,a,h){if(this.#t(),H(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&t.length===4){const f=t[2]-t[0],y=t[3]-t[1];if(h&&this.annotationCanvasMap){i=i.slice(),i[4]-=t[0],i[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=f,t[3]=y;const[x,T]=A.Util.singularValueDecompose2dScale((0,V.getCurrentTransform)(this.ctx)),{viewportScale:F}=this,I=Math.ceil(f*this.outputScaleX*F),O=Math.ceil(y*this.outputScaleY*F);this.annotationCanvas=this.canvasFactory.create(I,O);const{canvas:D,context:S}=this.annotationCanvas;this.annotationCanvasMap.set(s,D),this.annotationCanvas.savedCtx=this.ctx,this.ctx=S,this.ctx.save(),this.ctx.setTransform(x,0,0,-T,0,y*T),H(this.ctx)}else H(this.ctx),this.ctx.rect(t[0],t[1],f,y),this.ctx.clip(),this.endPath()}this.current=new tt(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#e(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(s){if(!this.contentVisible)return;const t=s.count;s=this.getObject(s.data,s),s.count=t;const i=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=Y(s)),a.compiled)){a.compiled(i);return}const h=this._createMaskCanvas(s),f=h.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(f,h.offsetX,h.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(s,t,i=0,a=0,h,f){if(!this.contentVisible)return;s=this.getObject(s.data,s);const y=this.ctx;y.save();const x=(0,V.getCurrentTransform)(y);
2y.transform(t,i,a,h,0,0);const T=this._createMaskCanvas(s);y.setTransform(1,0,0,1,T.offsetX-x[4],T.offsetY-x[5]);for(let F=0,I=f.length;F<I;F+=2){const O=A.Util.transform(x,[t,i,a,h,f[F],f[F+1]]),[D,S]=A.Util.applyTransform([0,0],O);y.drawImage(T.canvas,D,S)}y.restore(),this.compose()}paintImageMaskXObjectGroup(s){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,a=this.current.patternFill;for(const h of s){const{data:f,width:y,height:x,transform:T}=h,F=this.cachedCanvases.getCanvas("maskCanvas",y,x),I=F.context;I.save();const O=this.getObject(f,h);j(I,O),I.globalCompositeOperation="source-in",I.fillStyle=a?i.getPattern(I,this,(0,V.getCurrentTransformInverse)(t),C.FILL):i,I.fillRect(0,0,y,x),I.restore(),t.save(),t.transform(...T),t.scale(1,-1),X(t,F.canvas,0,0,y,x,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(s){if(!this.contentVisible)return;const t=this.getObject(s);if(!t){(0,A.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(s,t,i,a){if(!this.contentVisible)return;const h=this.getObject(s);if(!h){(0,A.warn)("Dependent image isn't ready yet");return}const f=h.width,y=h.height,x=[];for(let T=0,F=a.length;T<F;T+=2)x.push({transform:[t,0,0,i,a[T],a[T+1]],x:0,y:0,w:f,h:y});this.paintInlineImageXObjectGroup(h,x)}applyTransferMapsToCanvas(s){return this.current.transferMaps!=="none"&&(s.filter=this.current.transferMaps,s.drawImage(s.canvas,0,0),s.filter="none"),s.canvas}applyTransferMapsToBitmap(s){if(this.current.transferMaps==="none")return s.bitmap;const{bitmap:t,width:i,height:a}=s,h=this.cachedCanvases.getCanvas("inlineImage",i,a),f=h.context;return f.filter=this.current.transferMaps,f.drawImage(t,0,0),f.filter="none",h.canvas}paintInlineImageXObject(s){if(!this.contentVisible)return;const t=s.width,i=s.height,a=this.ctx;if(this.save(),!A.isNodeJS){const{filter:y}=a;y!=="none"&&y!==""&&(a.filter="none")}a.scale(1/t,-1/i);let h;if(s.bitmap)h=this.applyTransferMapsToBitmap(s);else if(typeof HTMLElement=="function"&&s instanceof HTMLElement||!s.data)h=s;else{const x=this.cachedCanvases.getCanvas("inlineImage",t,i).context;rt(x,s),h=this.applyTransferMapsToCanvas(x)}const f=this._scaleImage(h,(0,V.getCurrentTransformInverse)(a));a.imageSmoothingEnabled=at((0,V.getCurrentTransform)(a),s.interpolate),X(a,f.img,0,0,f.paintWidth,f.paintHeight,0,-i,t,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(s,t){if(!this.contentVisible)return;const i=this.ctx;let a;if(s.bitmap)a=s.bitmap;else{const h=s.width,f=s.height,x=this.cachedCanvases.getCanvas("inlineImage",h,f).context;rt(x,s),a=this.applyTransferMapsToCanvas(x)}for(const h of t)i.save(),i.transform(...h.transform),i.scale(1,-1),X(i,a,h.x,h.y,h.w,h.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(s){}markPointProps(s,t){}beginMarkedContent(s){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(s,t){s==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(s){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const i=this.ctx;this.pendingClip&&(t||(this.pendingClip===J?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const s=(0,V.getCurrentTransform)(this.ctx);if(s[1]===0&&s[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(s[0]),Math.abs(s[3]));else{const t=Math.abs(s[0]*s[3]-s[2]*s[1]),i=Math.hypot(s[0],s[2]),a=Math.hypot(s[1],s[3]);this._cachedGetSinglePixelWidth=Math.max(i,a)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:s}=this.current,{a:t,b:i,c:a,d:h}=this.ctx.getTransform();let f,y;if(i===0&&a===0){const x=Math.abs(t),T=Math.abs(h);if(x===T)if(s===0)f=y=1/x;else{const F=x*s;f=y=F<1?1/F:1}
2else if(s===0)f=1/x,y=1/T;else{const F=x*s,I=T*s;f=F<1?1/F:1,y=I<1?1/I:1}}else{const x=Math.abs(t*h-i*a),T=Math.hypot(t,i),F=Math.hypot(a,h);if(s===0)f=F/x,y=T/x;else{const I=s*x;f=F>I?F/I:1,y=T>I?T/I:1}}this._cachedScaleForStroking[0]=f,this._cachedScaleForStroking[1]=y}return this._cachedScaleForStroking}rescaleAndStroke(s){const{ctx:t}=this,{lineWidth:i}=this.current,[a,h]=this.getScaleForStroking();if(t.lineWidth=i||1,a===1&&h===1){t.stroke();return}const f=t.getLineDash();if(s&&t.save(),t.scale(a,h),f.length>0){const y=Math.max(a,h);t.setLineDash(f.map(x=>x/y)),t.lineDashOffset/=y}t.stroke(),s&&t.restore()}isContentVisible(){for(let s=this.markedContentStack.length-1;s>=0;s--)if(!this.markedContentStack[s].visible)return!1;return!0}}for(const o in A.OPS)d.prototype[o]!==void 0&&(d.prototype[A.OPS[o]]=d.prototype[o])},473:(ut,Z,U)=>{U.d(Z,{DOMCMapReaderFactory:()=>v,DOMCanvasFactory:()=>L,DOMFilterFactory:()=>R,DOMSVGFactory:()=>u,DOMStandardFontDataFactory:()=>l,PDFDateString:()=>P,PageViewport:()=>g,PixelsPerInch:()=>N,RenderingCancelledException:()=>r,StatTimer:()=>b,fetchData:()=>w,getColorValues:()=>X,getCurrentTransform:()=>Y,getCurrentTransformInverse:()=>tt,getFilenameFromUrl:()=>n,getPdfFilenameFromUrl:()=>c,getRGB:()=>B,getXfaPageViewport:()=>z,isDataScheme:()=>p,isPdfFile:()=>e,isValidFetchUrl:()=>m,noContextMenu:()=>k,setLayerDimensions:()=>rt});var A=U(822),V=U(266);const C="http://www.w3.org/2000/svg";class N{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class R extends A.BaseFilterFactory{#t;#e;#s;#i;#n;#r;#o;#l;#h;#c;#f=0;constructor({docId:_,ownerDocument:H=globalThis.document}={}){super(),this.#s=_,this.#i=H}get#u(){return this.#t||=new Map}get#d(){if(!this.#e){const _=this.#i.createElement("div"),{style:H}=_;H.visibility="hidden",H.contain="strict",H.width=H.height=0,H.position="absolute",H.top=H.left=0,H.zIndex=-1;const q=this.#i.createElementNS(C,"svg");q.setAttribute("width",0),q.setAttribute("height",0),this.#e=this.#i.createElementNS(C,"defs"),_.append(q),q.append(this.#e),this.#i.body.append(_)}return this.#e}addFilter(_){if(!_)return"none";let H=this.#u.get(_);if(H)return H;let q,Q,K,ft;if(_.length===1){const ct=_[0],ht=new Array(256);for(let J=0;J<256;J++)ht[J]=ct[J]/255;ft=q=Q=K=ht.join(",")}else{const[ct,ht,J]=_,d=new Array(256),o=new Array(256),s=new Array(256);for(let t=0;t<256;t++)d[t]=ct[t]/255,o[t]=ht[t]/255,s[t]=J[t]/255;q=d.join(","),Q=o.join(","),K=s.join(","),ft=`${q}${Q}${K}`}if(H=this.#u.get(ft),H)return this.#u.set(_,H),H;const ot=`g_${this.#s}_transfer_map_${this.#f++}`,at=`url(#${ot})`;this.#u.set(_,at),this.#u.set(ft,at);const gt=this.#p(ot);return this.#b(q,Q,K,gt),at}addHCMFilter(_,H){const q=`${_}-${H}`;if(this.#r===q)return this.#o;if(this.#r=q,this.#o="none",this.#n?.remove(),!_||!H)return this.#o;const Q=this.#A(_);_=V.Util.makeHexColor(...Q);const K=this.#A(H);if(H=V.Util.makeHexColor(...K),this.#d.style.color="",_==="#000000"&&H==="#ffffff"||_===H)return this.#o;const ft=new Array(256);for(let ht=0;ht<=255;ht++){const J=ht/255;ft[ht]=J<=.03928?J/12.92:((J+.055)/1.055)**2.4}const ot=ft.join(","),at=`g_${this.#s}_hcm_filter`,gt=this.#l=this.#p(at);this.#b(ot,ot,ot,gt),this.#a(gt);const ct=(ht,J)=>{const d=Q[ht]/255,o=K[ht]/255,s=new Array(J+1);for(let t=0;t<=J;t++)s[t]=d+t/J*(o-d);return s.join(",")};return this.#b(ct(0,5),ct(1,5),ct(2,5),gt),this.#o=`url(#${at})`,this.#o}addHighlightHCMFilter(_,H,q,Q){const K=`${_}-${H}-${q}-${Q}`;if(this.#h===K)return this.#c;if(this.#h=K,this.#c="none",this.#l?.remove(),!_||!H)return this.#c;const[ft,ot]=[_,H].map(this.#A.bind(this));let at=Math.round(.2126*ft[0]+.7152*ft[1]+.0722*ft[2]),gt=Math.round(.2126*ot[0]+.7152*ot[1]+.0722*ot[2]),[ct,ht]=[q,Q].map(this.#A.bind(this));gt<at&&([at,gt,ct,ht]=[gt,at,ht,ct]),this.#d.style.color="";const J=(s,t,i)=>{const a=new Array(256),h=(gt-at)/i,f=s/255,y=(t-s)/(255*i);let x=0;for(let T=0;T<=i;T++){const F=Math.round(at+T*h),I=f+T*y;for(let O=x;O<=F;O++)a[O]=I;x=F+1}for(let T=x;T<256;T++)a[T]=a[x-1];return a.join(",")},d=`g_${this.#s}_hcm_highlight_filter`,o=this.#l=this.#p(d);return this.#a(o),this.#b(J(ct[0],ht[0],5),J(ct[1],ht[1],5),J(ct[2],ht[2],5),o),this.#c=`url(#${d})`,this.#c}destroy(_=!1){_&&(this.#o||this.#c)||(this.#e&&(this.#e.parentNode.parentNode.remove(),this.#e=null),this.#t&&(this.#t.clear(),this.#t=null),this.#f=0)}#a(_){const H=this.#i.createElementNS(C,"feColorMatrix");H.setAttribute("type","matrix"),H.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"),_.append(H)}#p(_){const H=this.#i.createElementNS(C,"filter");return H.setAttribute("color-interpolation-filters","sRGB"),H.setAttribute("id",_),this.#d.append(H),H}#m(_,H,q){const Q=this.#i.createElementNS(C,H);Q.setAttribute("type","discrete"),Q.setAttribute("tableValues",q),_.append(Q)}#b(_,H,q,Q){const K=this.#i.createElementNS(C,"feComponentTransfer");Q.append(K),this.#m(K,"feFuncR",_),this.#m(K,"feFuncG",H),this.#m(K,"feFuncB",q)}#A(_){return this.#d.style.color=_,B(getComputedStyle(this.#d).getPropertyValue("color"))}}class L extends A.BaseCanvasFactory{constructor({ownerDocument:_=globalThis.document}={}){super(),this._document=_}_createCanvas(_,H){const q=this._document.createElement("canvas");return q.width=_,q.height=H,q}}async function w(j,_="text"){if(m(j,document.baseURI)){const H=await fetch(j);if(!H.ok)throw new Error(H.statusText);switch(_){case"arraybuffer":return H.arrayBuffer();case"blob":return H.blob();case"json":return H.json()}return H.text()}return new Promise((H,q)=>{const Q=new XMLHttpRequest;Q.open("GET",j,!0),Q.responseType=_,Q.onreadystatechange=()=>{if(Q.readyState===XMLHttpRequest.DONE){if(Q.status===200||Q.status===0){let K;switch(_){case"arraybuffer":case"blob":case"json":K=Q.response;break;default:K=Q.responseText;break}if(K){H(K);return}}q(new Error(Q.statusText))}},Q.send(null)})}class v extends A.BaseCMapReaderFactory{_fetchData(_,H){return w(_,this.isCompressed?"arraybuffer":"text").then(q=>({cMapData:q instanceof ArrayBuffer?new Uint8Array(q):(0,V.stringToBytes)(q),compressionType:H}))}}class l extends A.BaseStandardFontDataFactory{_fetchData(_){return w(_,"arraybuffer").then(H=>new Uint8Array(H))}}class u extends A.BaseSVGFactory{_createSVG(_){return document.createElementNS(C,_)}}class g{constructor({viewBox:_,scale:H,rotation:q,offsetX:Q=0,offsetY:K=0,dontFlip:ft=!1}){this.viewBox=_,this.scale=H,this.rotation=q,this.offsetX=Q,this.offsetY=K;const ot=(_[2]+_[0])/2,at=(_[3]+_[1])/2;let gt,ct,ht,J;switch(q%=360,q<0&&(q+=360),q){case 180:gt=-1,ct=0,ht=0,J=1;break;case 90:gt=0,ct=1,ht=1,J=0;break;case 270:gt=0,ct=-1,ht=-1,J=0;break;case 0:gt=1,ct=0,ht=0,J=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}ft&&(ht=-ht,J=-J);let d,o,s,t;gt===0?(d=Math.abs(at-_[1])*H+Q,o=Math.abs(ot-_[0])*H+K,s=(_[3]-_[1])*H,t=(_[2]-_[0])*H):(d=Math.abs(ot-_[0])*H+Q,o=Math.abs(at-_[1])*H+K,s=(_[2]-_[0])*H,t=(_[3]-_[1])*H),this.transform=[gt*H,ct*H,ht*H,J*H,d-gt*H*ot-ht*H*at,o-ct*H*ot-J*H*at],this.width=s,this.height=t}get rawDims(){const{viewBox:_}=this;return(0,V.shadow)(this,"rawDims",{pageWidth:_[2]-_[0],pageHeight:_[3]-_[1],pageX:_[0],pageY:_[1]})}clone({scale:_=this.scale,rotation:H=this.rotation,offsetX:q=this.offsetX,offsetY:Q=this.offsetY,dontFlip:K=!1}={}){return new g({viewBox:this.viewBox.slice(),scale:_,rotation:H,offsetX:q,offsetY:Q,dontFlip:K})}convertToViewportPoint(_,H){return V.Util.applyTransform([_,H],this.transform)}convertToViewportRectangle(_){const H=V.Util.applyTransform([_[0],_[1]],this.transform),q=V.Util.applyTransform([_[2],_[3]],this.transform);return[H[0],H[1],q[0],q[1]]}convertToPdfPoint(_,H){return V.Util.applyInverseTransform([_,H],this.transform)}}class r extends V.BaseException{constructor(_,H=0){super(_,"RenderingCancelledException"),this.extraDelay=H}}function p(j){const _=j.length;let H=0;for(;H<_&&j[H].trim()==="";)H++;return j.substring(H,H+5).toLowerCase()==="data:"}function e(j){return typeof j=="string"&&/\.pdf$/i.test(j)}function n(j,_=!1){return _||([j]=j.split(/[#?]/,1)),j.substring(j.lastIndexOf("/")+1)}
2function c(j,_="document.pdf"){if(typeof j!="string")return _;if(p(j))return(0,V.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),_;const H=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,q=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,Q=H.exec(j);let K=q.exec(Q[1])||q.exec(Q[2])||q.exec(Q[3]);if(K&&(K=K[0],K.includes("%")))try{K=q.exec(decodeURIComponent(K))[0]}catch{}return K||_}class b{started=Object.create(null);times=[];time(_){_ in this.started&&(0,V.warn)(`Timer is already running for ${_}`),this.started[_]=Date.now()}timeEnd(_){_ in this.started||(0,V.warn)(`Timer has not been started for ${_}`),this.times.push({name:_,start:this.started[_],end:Date.now()}),delete this.started[_]}toString(){const _=[];let H=0;for(const{name:q}of this.times)H=Math.max(q.length,H);for(const{name:q,start:Q,end:K}of this.times)_.push(`${q.padEnd(H)} ${K-Q}ms
3`);return _.join("")}}function m(j,_){try{const{protocol:H}=_?new URL(j,_):new URL(j);return H==="http:"||H==="https:"}catch{return!1}}function k(j){j.preventDefault()}let E;class P{static toDateObject(_){if(!_||typeof _!="string")return null;E||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const H=E.exec(_);if(!H)return null;const q=parseInt(H[1],10);let Q=parseInt(H[2],10);Q=Q>=1&&Q<=12?Q-1:0;let K=parseInt(H[3],10);K=K>=1&&K<=31?K:1;let ft=parseInt(H[4],10);ft=ft>=0&&ft<=23?ft:0;let ot=parseInt(H[5],10);ot=ot>=0&&ot<=59?ot:0;let at=parseInt(H[6],10);at=at>=0&&at<=59?at:0;const gt=H[7]||"Z";let ct=parseInt(H[8],10);ct=ct>=0&&ct<=23?ct:0;let ht=parseInt(H[9],10)||0;return ht=ht>=0&&ht<=59?ht:0,gt==="-"?(ft+=ct,ot+=ht):gt==="+"&&(ft-=ct,ot-=ht),new Date(Date.UTC(q,Q,K,ft,ot,at))}}function z(j,{scale:_=1,rotation:H=0}){const{width:q,height:Q}=j.attributes.style,K=[0,0,parseInt(q),parseInt(Q)];return new g({viewBox:K,scale:_,rotation:H})}function B(j){if(j.startsWith("#")){const _=parseInt(j.slice(1),16);return[(_&16711680)>>16,(_&65280)>>8,_&255]}return j.startsWith("rgb(")?j.slice(4,-1).split(",").map(_=>parseInt(_)):j.startsWith("rgba(")?j.slice(5,-1).split(",").map(_=>parseInt(_)).slice(0,3):((0,V.warn)(`Not a valid color format: "${j}"`),[0,0,0])}function X(j){const _=document.createElement("span");_.style.visibility="hidden",document.body.append(_);for(const H of j.keys()){_.style.color=H;const q=window.getComputedStyle(_).color;j.set(H,B(q))}_.remove()}function Y(j){const{a:_,b:H,c:q,d:Q,e:K,f:ft}=j.getTransform();return[_,H,q,Q,K,ft]}function tt(j){const{a:_,b:H,c:q,d:Q,e:K,f:ft}=j.getTransform().invertSelf();return[_,H,q,Q,K,ft]}function rt(j,_,H=!1,q=!0){if(_ instanceof g){const{pageWidth:Q,pageHeight:K}=_.rawDims,{style:ft}=j,ot=V.FeatureTest.isCSSRoundSupported,at=`var(--scale-factor) * ${Q}px`,gt=`var(--scale-factor) * ${K}px`,ct=ot?`round(${at}, 1px)`:`calc(${at})`,ht=ot?`round(${gt}, 1px)`:`calc(${gt})`;!H||_.rotation%180===0?(ft.width=ct,ft.height=ht):(ft.width=ht,ft.height=ct)}q&&j.setAttribute("data-main-rotation",_.rotation)}},423:(ut,Z,U)=>{U.d(Z,{DrawLayer:()=>C});var A=U(473),V=U(266);class C{#t=null;#e=0;#s=new Map;constructor({pageIndex:R}){this.pageIndex=R}setParent(R){if(!this.#t){this.#t=R;return}if(this.#t!==R){if(this.#s.size>0)for(const L of this.#s.values())L.remove(),R.append(L);this.#t=R}}static get _svgFactory(){return(0,V.shadow)(this,"_svgFactory",new A.DOMSVGFactory)}static#i(R,{x:L,y:w,width:v,height:l}){const{style:u}=R;u.top=`${100*w}%`,u.left=`${100*L}%`,u.width=`${100*v}%`,u.height=`${100*l}%`}#n(R){const L=C._svgFactory.create(1,1,!0);return this.#t.append(L),C.#i(L,R),L}highlight({outlines:R,box:L},w,v){const l=this.#e++,u=this.#n(L);u.classList.add("highlight");const g=C._svgFactory.createElement("defs");u.append(g);const r=C._svgFactory.createElement("path");g.append(r);const p=`path_p${this.pageIndex}_${l}`;r.setAttribute("id",p),r.setAttribute("d",C.#r(R));const e=C._svgFactory.createElement("clipPath");g.append(e);const n=`clip_${p}`;e.setAttribute("id",n),e.setAttribute("clipPathUnits","objectBoundingBox");const c=C._svgFactory.createElement("use");e.append(c),c.setAttribute("href",`#${p}`),c.classList.add("clip");const b=C._svgFactory.createElement("use");return u.append(b),u.setAttribute("fill",w),u.setAttribute("fill-opacity",v),b.setAttribute("href",`#${p}`),this.#s.set(l,u),{id:l,clipPathId:`url(#${n})`}}highlightOutline({outlines:R,box:L}){const w=this.#e++,v=this.#n(L);v.classList.add("highlightOutline");const l=C._svgFactory.createElement("defs");v.append(l);const u=C._svgFactory.createElement("path");l.append(u);const g=`path_p${this.pageIndex}_${w}`;u.setAttribute("id",g),u.setAttribute("d",C.#r(R)),u.setAttribute("vector-effect","non-scaling-stroke");const r=C._svgFactory.createElement("use");v.append(r),r.setAttribute("href",`#${g}`);const p=r.cloneNode();return v.append(p),r.classList.add("mainOutline"),p.classList.add("secondaryOutline"),this.#s.set(w,v),w}static#r(R){const L=[];for(const w of R){let[v,l]=w;L.push(`M${v} ${l}`);for(let u=2;u<w.length;u+=2){const g=w[u],r=w[u+1];g===v?(L.push(`V${r}`),l=r):r===l&&(L.push(`H${g}`),v=g)}L.push("Z")}return L.join(" ")}updateBox(R,L){C.#i(this.#s.get(R),L)}rotate(R,L){this.#s.get(R).setAttribute("data-main-rotation",L)}changeColor(R,L){this.#s.get(R).setAttribute("fill",L)}changeOpacity(R,L){this.#s.get(R).setAttribute("fill-opacity",L)}addClass(R,L){this.#s.get(R).classList.add(L)}removeClass(R,L){this.#s.get(R).classList.remove(L)}remove(R){this.#t!==null&&(this.#s.get(R).remove(),this.#s.delete(R))}destroy(){this.#t=null;for(const R of this.#s.values())R.remove();this.#s.clear()}}},629:(ut,Z,U)=>{U.d(Z,{AnnotationEditorLayer:()=>r});
3var A=U(266),V=U(115),C=U(812),N=U(640);class R extends V.AnnotationEditor{#t=this.editorDivBlur.bind(this);#e=this.editorDivFocus.bind(this);#s=this.editorDivInput.bind(this);#i=this.editorDivKeydown.bind(this);#n;#r="";#o=`${this.id}-editor`;#l;#h=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=R.prototype,n=m=>m.isEmpty(),c=C.AnnotationEditorUIManager.TRANSLATE_SMALL,b=C.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,A.shadow)(this,"_keyboardManager",new C.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-c,0],checker:n}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-b,0],checker:n}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[c,0],checker:n}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[b,0],checker:n}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-c],checker:n}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-b],checker:n}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,c],checker:n}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,b],checker:n}]]))}static _type="freetext";static _editorType=A.AnnotationEditorType.FREETEXT;constructor(e){super({...e,name:"freeTextEditor"}),this.#n=e.color||R._defaultColor||V.AnnotationEditor._defaultLineColor,this.#l=e.fontSize||R._defaultFontSize}static initialize(e){V.AnnotationEditor.initialize(e,{strings:["pdfjs-free-text-default-content"]});const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,n){switch(e){case A.AnnotationEditorParamsType.FREETEXT_SIZE:R._defaultFontSize=n;break;case A.AnnotationEditorParamsType.FREETEXT_COLOR:R._defaultColor=n;break}}updateParams(e,n){switch(e){case A.AnnotationEditorParamsType.FREETEXT_SIZE:this.#c(n);break;case A.AnnotationEditorParamsType.FREETEXT_COLOR:this.#f(n);break}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.FREETEXT_SIZE,R._defaultFontSize],[A.AnnotationEditorParamsType.FREETEXT_COLOR,R._defaultColor||V.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.FREETEXT_SIZE,this.#l],[A.AnnotationEditorParamsType.FREETEXT_COLOR,this.#n]]}#c(e){const n=b=>{this.editorDiv.style.fontSize=`calc(${b}px * var(--scale-factor))`,this.translate(0,-(b-this.#l)*this.parentScale),this.#l=b,this.#d()},c=this.#l;this.addCommands({cmd:()=>{n(e)},undo:()=>{n(c)},mustExec:!0,type:A.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#f(e){const n=this.#n;this.addCommands({cmd:()=>{this.#n=this.editorDiv.style.color=e},undo:()=>{this.#n=this.editorDiv.style.color=n},mustExec:!0,type:A.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,n){this._uiManager.translateSelectedEditors(e,n,!0)}getInitialTranslation(){const e=this.parentScale;return[-R._internalPadding*e,-(R._internalPadding+this.#l)*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(A.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#i),this.editorDiv.addEventListener("focus",this.#e),this.editorDiv.addEventListener("blur",this.#t),this.editorDiv.addEventListener("input",this.#s))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#o),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#i),this.editorDiv.removeEventListener("focus",this.#e),this.editorDiv.removeEventListener("blur",this.#t),this.editorDiv.removeEventListener("input",this.#s),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){if(this.width){this.#m();return}this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.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()}#u(){const e=this.editorDiv.getElementsByTagName("div");if(e.length===0)return this.editorDiv.innerText;const n=[];for(const c of e)n.push(c.innerText.replace(/\r\n?|\n/,""));return n.join(`
4`)}#d(){const[e,n]=this.parentDimensions;let c;if(this.isAttachedToDOM)c=this.div.getBoundingClientRect();else{const{currentLayer:b,div:m}=this,k=m.style.display;m.style.display="hidden",b.div.append(this.div),c=m.getBoundingClientRect(),m.remove(),m.style.display=k}this.rotation%180===this.parentRotation%180?(this.width=c.width/e,this.height=c.height/n):(this.width=c.height/e,this.height=c.width/n),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#r,n=this.#r=this.#u().trimEnd();if(e===n)return;const c=b=>{if(this.#r=b,!b){this.remove();return}this.#a(),this._uiManager.rebuild(this),this.#d()};this.addCommands({cmd:()=>{c(n)},undo:()=>{c(e)},mustExec:!1}),this.#d()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){R._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}
4render(){if(this.div)return this.div;let e,n;this.width&&(e=this.x,n=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#o),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),V.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then(b=>this.editorDiv?.setAttribute("default-content",b)),this.editorDiv.contentEditable=!0;const{style:c}=this.editorDiv;if(c.fontSize=`calc(${this.#l}px * var(--scale-factor))`,c.color=this.#n,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,C.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[b,m]=this.parentDimensions;if(this.annotationElementId){const{position:k}=this.#h;let[E,P]=this.getInitialTranslation();[E,P]=this.pageTranslationToScreen(E,P);const[z,B]=this.pageDimensions,[X,Y]=this.pageTranslation;let tt,rt;switch(this.rotation){case 0:tt=e+(k[0]-X)/z,rt=n+this.height-(k[1]-Y)/B;break;case 90:tt=e+(k[0]-X)/z,rt=n-(k[1]-Y)/B,[E,P]=[P,-E];break;case 180:tt=e-this.width+(k[0]-X)/z,rt=n-(k[1]-Y)/B,[E,P]=[-E,-P];break;case 270:tt=e+(k[0]-X-this.height*B)/z,rt=n+(k[1]-Y-this.width*z)/B,[E,P]=[-P,E];break}this.setAt(tt*b,rt*m,E,P)}else this.setAt(e*b,n*m,this.width*b,this.height*m);this.#a(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#a(){if(this.editorDiv.replaceChildren(),!!this.#r)for(const e of this.#r.split(`
5`)){const n=document.createElement("div");n.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(n)}}get contentDiv(){return this.editorDiv}static deserialize(e,n,c){let b=null;if(e instanceof N.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:k,fontColor:E},rect:P,rotation:z,id:B},textContent:X,textPosition:Y,parent:{page:{pageNumber:tt}}}=e;if(!X||X.length===0)return null;b=e={annotationType:A.AnnotationEditorType.FREETEXT,color:Array.from(E),fontSize:k,value:X.join(`
6`),position:Y,pageIndex:tt-1,rect:P,rotation:z,id:B,deleted:!1}}const m=super.deserialize(e,n,c);return m.#l=e.fontSize,m.#n=A.Util.makeHexColor(...e.color),m.#r=e.value,m.annotationElementId=e.id||null,m.#h=b,m}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const n=R._internalPadding*this.parentScale,c=this.getRect(n,n),b=V.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#n),m={annotationType:A.AnnotationEditorType.FREETEXT,color:b,fontSize:this.#l,value:this.#r,pageIndex:this.pageIndex,rect:c,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?m:this.annotationElementId&&!this.#p(m)?null:(m.id=this.annotationElementId,m)}#p(e){const{value:n,fontSize:c,color:b,rect:m,pageIndex:k}=this.#h;return e.value!==n||e.fontSize!==c||e.rect.some((E,P)=>Math.abs(E-m[P])>=1)||e.color.some((E,P)=>E!==b[P])||e.pageIndex!==k}#m(e=!1){if(!this.annotationElementId)return;if(this.#d(),!e&&(this.width===0||this.height===0)){setTimeout(()=>this.#m(!0),0);return}const n=R._internalPadding*this.parentScale;this.#h.rect=this.getRect(n,n)}}var L=U(97),w=U(405);class v extends V.AnnotationEditor{#t;#e=null;#s=null;#i=null;#n=null;#r=null;#o=null;#l=null;#h;#c=null;static _defaultColor=null;static _defaultOpacity=1;static _l10nPromise;static _type="highlight";static _editorType=A.AnnotationEditorType.HIGHLIGHT;constructor(e){super({...e,name:"highlightEditor"}),v._defaultColor||=this._uiManager.highlightColors?.values().next().value||"#fff066",this.color=e.color||v._defaultColor,this.#h=e.opacity||v._defaultOpacity,this.#t=e.boxes||null,this._isDraggable=!1,this.#f(),this.#a(),this.rotate(this.rotation)}#f(){const e=new w.Outliner(this.#t,.001);this.#r=e.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#r.box;const n=new w.Outliner(this.#t,.0025,.001,this._uiManager.direction==="ltr");this.#i=n.getOutlines();const{lastPoint:c}=this.#i.box;this.#l=[(c[0]-this.x)/this.width,(c[1]-this.y)/this.height]}static initialize(e){V.AnnotationEditor.initialize(e)}static updateDefaultParams(e,n){switch(e){case A.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:v._defaultColor=n;break}}get toolbarPosition(){return this.#l}updateParams(e,n){switch(e){case A.AnnotationEditorParamsType.HIGHLIGHT_COLOR:this.#u(n);break}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,v._defaultColor]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.color||v._defaultColor]]}#u(e){const n=this.color;this.addCommands({cmd:()=>{this.color=e,this.parent.drawLayer.changeColor(this.#o,e),this.#s?.updateColor(e)},undo:()=>{this.color=n,this.parent.drawLayer.changeColor(this.#o,n),this.#s?.updateColor(n)},mustExec:!0,type:A.AnnotationEditorParamsType.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(this.#s=new L.ColorPicker({editor:this}),e.addColorPicker(this.#s)),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(0)}getRect(e,n){return super.getRect(e,n,0)}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){super.remove(),this.#d()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#a(),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let n=!1;this.parent&&!e?this.#d():e&&(this.#a(e),n=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),n&&this.select()}#d(){this.#o===null||!this.parent||(this.parent.drawLayer.remove(this.#o),this.#o=null,this.parent.drawLayer.remove(this.#c),this.#c=null)}#a(e=this.parent){this.#o===null&&({id:this.#o,clipPathId:this.#e}=e.drawLayer.highlight(this.#r,this.color,this.#h),this.#n&&(this.#n.style.clipPath=this.#e),this.#c=e.drawLayer.highlightOutline(this.#i))}static#p({x:e,y:n,width:c,height:b},m){switch(m){case 90:return{x:1-n-b,y:e,width:b,height:c};case 180:return{x:1-e-c,y:1-n-b,width:c,height:b};case 270:return{x:n,y:1-e-c,width:b,height:c}}return{x:e,y:n,width:c,height:b}}rotate(e){const{drawLayer:n}=this.parent;n.rotate(this.#o,e),n.rotate(this.#c,e),n.updateBox(this.#o,v.#p(this,e)),n.updateBox(this.#c,v.#p(this.#i.box,e))}
6render(){if(this.div)return this.div;const e=super.render(),n=this.#n=document.createElement("div");e.append(n),n.className="internal",n.style.clipPath=this.#e;const[c,b]=this.parentDimensions;return this.setDims(this.width*c,this.height*b),(0,C.bindEvents)(this,this.#n,["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.parent.drawLayer.addClass(this.#c,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#c,"hovered")}select(){super.select(),this.parent?.drawLayer.removeClass(this.#c,"hovered"),this.parent?.drawLayer.addClass(this.#c,"selected")}unselect(){super.unselect(),this.parent?.drawLayer.removeClass(this.#c,"selected")}#m(){const[e,n]=this.pageDimensions,c=this.#t,b=new Array(c.length*8);let m=0;for(const{x:k,y:E,width:P,height:z}of c){const B=k*e,X=(1-E-z)*n;b[m]=b[m+4]=B,b[m+1]=b[m+3]=X,b[m+2]=b[m+6]=B+P*e,b[m+5]=b[m+7]=X+z*n,m+=8}return b}#b(){const[e,n]=this.pageDimensions,c=this.width*e,b=this.height*n,m=this.x*e,k=(1-this.y-this.height)*n,E=[];for(const P of this.#r.outlines){const z=new Array(P.length);for(let B=0;B<P.length;B+=2)z[B]=m+P[B]*c,z[B+1]=k+(1-P[B+1])*b;E.push(z)}return E}static deserialize(e,n,c){const b=super.deserialize(e,n,c),{rect:m,color:k,quadPoints:E}=e;b.color=A.Util.makeHexColor(...k),b.#h=e.opacity;const[P,z]=b.pageDimensions;b.width=(m[2]-m[0])/P,b.height=(m[3]-m[1])/z;const B=b.#t=[];for(let X=0;X<E.length;X+=8)B.push({x:E[4]/P,y:1-E[X+5]/z,width:(E[X+2]-E[X])/P,height:(E[X+5]-E[X+1])/z});return b.#f(),b}serialize(e=!1){if(this.isEmpty()||e)return null;const n=this.getRect(0,0),c=V.AnnotationEditor._colorManager.convert(this.color);return{annotationType:A.AnnotationEditorType.HIGHLIGHT,color:c,opacity:this.#h,quadPoints:this.#m(),outlines:this.#b(),pageIndex:this.pageIndex,rect:n,rotation:0,structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}var l=U(473);class u extends V.AnnotationEditor{#t=0;#e=0;#s=this.canvasPointermove.bind(this);#i=this.canvasPointerleave.bind(this);#n=this.canvasPointerup.bind(this);#r=this.canvasPointerdown.bind(this);#o=null;#l=new Path2D;#h=!1;#c=!1;#f=!1;#u=null;#d=0;#a=0;#p=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=A.AnnotationEditorType.INK;constructor(e){super({...e,name:"inkEditor"}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e){V.AnnotationEditor.initialize(e)}static updateDefaultParams(e,n){switch(e){case A.AnnotationEditorParamsType.INK_THICKNESS:u._defaultThickness=n;break;case A.AnnotationEditorParamsType.INK_COLOR:u._defaultColor=n;break;case A.AnnotationEditorParamsType.INK_OPACITY:u._defaultOpacity=n/100;break}}updateParams(e,n){switch(e){case A.AnnotationEditorParamsType.INK_THICKNESS:this.#m(n);break;case A.AnnotationEditorParamsType.INK_COLOR:this.#b(n);break;case A.AnnotationEditorParamsType.INK_OPACITY:this.#A(n);break}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.INK_THICKNESS,u._defaultThickness],[A.AnnotationEditorParamsType.INK_COLOR,u._defaultColor||V.AnnotationEditor._defaultLineColor],[A.AnnotationEditorParamsType.INK_OPACITY,Math.round(u._defaultOpacity*100)]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||u._defaultThickness],[A.AnnotationEditorParamsType.INK_COLOR,this.color||u._defaultColor||V.AnnotationEditor._defaultLineColor],[A.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??u._defaultOpacity))]]}#m(e){const n=this.thickness;this.addCommands({cmd:()=>{this.thickness=e,this.#R()},undo:()=>{this.thickness=n,this.#R()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#b(e){const n=this.color;this.addCommands({cmd:()=>{this.color=e,this.#w()},undo:()=>{this.color=n,this.#w()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#A(e){e/=100;const n=this.opacity;this.addCommands({cmd:()=>{this.opacity=e,this.#w()},undo:()=>{this.opacity=n,this.#w()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#E(),this.#S()),this.isAttachedToDOM||(this.parent.add(this),this.#P()),this.#R()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#o&&(clearTimeout(this.#o),this.#o=null),this.#u.disconnect(),this.#u=null,super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){const[e,n]=this.parentDimensions,c=this.width*e,b=this.height*n;this.setDimensions(c,b)}enableEditMode(){this.#h||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#r))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#r))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#y(){const{parentRotation:e,parentDimensions:[n,c]}=this;switch(e){case 90:return[0,c,c,n];case 180:return[n,c,n,c];case 270:return[n,0,c,n];default:return[0,0,n,c]}}#v(){const{ctx:e,color:n,opacity:c,thickness:b,parentScale:m,scaleFactor:k}=this;e.lineWidth=b*m/k,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${n}
6${(0,C.opacityToHex)(c)}`}#g(e,n){this.canvas.addEventListener("contextmenu",l.noContextMenu),this.canvas.addEventListener("pointerleave",this.#i),this.canvas.addEventListener("pointermove",this.#s),this.canvas.addEventListener("pointerup",this.#n),this.canvas.removeEventListener("pointerdown",this.#r),this.isEditing=!0,this.#f||(this.#f=!0,this.#P(),this.thickness||=u._defaultThickness,this.color||=u._defaultColor||V.AnnotationEditor._defaultLineColor,this.opacity??=u._defaultOpacity),this.currentPath.push([e,n]),this.#c=!1,this.#v(),this.#p=()=>{this.#I(),this.#p&&window.requestAnimationFrame(this.#p)},window.requestAnimationFrame(this.#p)}#C(e,n){const[c,b]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===c&&n===b)return;const m=this.currentPath;let k=this.#l;if(m.push([e,n]),this.#c=!0,m.length<=2){k.moveTo(...m[0]),k.lineTo(e,n);return}m.length===3&&(this.#l=k=new Path2D,k.moveTo(...m[0])),this.#N(k,...m.at(-3),...m.at(-2),e,n)}#L(){if(this.currentPath.length===0)return;const e=this.currentPath.at(-1);this.#l.lineTo(...e)}#M(e,n){this.#p=null,e=Math.min(Math.max(e,0),this.canvas.width),n=Math.min(Math.max(n,0),this.canvas.height),this.#C(e,n),this.#L();let c;if(this.currentPath.length!==1)c=this.#_();else{const P=[e,n];c=[[P,P.slice(),P.slice(),P]]}const b=this.#l,m=this.currentPath;this.currentPath=[],this.#l=new Path2D;const k=()=>{this.allRawPaths.push(m),this.paths.push(c),this.bezierPath2D.push(b),this.rebuild()},E=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#E(),this.#S()),this.#R())};this.addCommands({cmd:k,undo:E,mustExec:!0})}#I(){if(!this.#c)return;this.#c=!1;const e=Math.ceil(this.thickness*this.parentScale),n=this.currentPath.slice(-3),c=n.map(k=>k[0]),b=n.map(k=>k[1]);Math.min(...c)-e,Math.max(...c)+e,Math.min(...b)-e,Math.max(...b)+e;const{ctx:m}=this;m.save(),m.clearRect(0,0,this.canvas.width,this.canvas.height);for(const k of this.bezierPath2D)m.stroke(k);m.stroke(this.#l),m.restore()}#N(e,n,c,b,m,k,E){const P=(n+b)/2,z=(c+m)/2,B=(b+k)/2,X=(m+E)/2;e.bezierCurveTo(P+2*(b-P)/3,z+2*(m-z)/3,B+2*(b-B)/3,X+2*(m-X)/3,B,X)}#_(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const n=[];let c,[b,m]=e[0];for(c=1;c<e.length-2;c++){const[Y,tt]=e[c],[rt,j]=e[c+1],_=(Y+rt)/2,H=(tt+j)/2,q=[b+2*(Y-b)/3,m+2*(tt-m)/3],Q=[_+2*(Y-_)/3,H+2*(tt-H)/3];n.push([[b,m],q,Q,[_,H]]),[b,m]=[_,H]}const[k,E]=e[c],[P,z]=e[c+1],B=[b+2*(k-b)/3,m+2*(E-m)/3],X=[P+2*(k-P)/3,z+2*(E-z)/3];return n.push([[b,m],B,X,[P,z]]),n}#w(){if(this.isEmpty()){this.#T();return}this.#v();const{canvas:e,ctx:n}=this;n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,e.width,e.height),this.#T();for(const c of this.bezierPath2D)n.stroke(c)}commit(){this.#h||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#h=!0,this.div.classList.add("disabled"),this.#R(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||this.#h||(this.setInForeground(),e.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#g(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#C(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#D(e)}canvasPointerleave(e){this.#D(e)}#D(e){this.canvas.removeEventListener("pointerleave",this.#i),this.canvas.removeEventListener("pointermove",this.#s),this.canvas.removeEventListener("pointerup",this.#n),this.canvas.addEventListener("pointerdown",this.#r),this.#o&&clearTimeout(this.#o),this.#o=setTimeout(()=>{this.#o=null,this.canvas.removeEventListener("contextmenu",l.noContextMenu)},10),this.#M(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#E(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#S(){this.#u=new ResizeObserver(e=>{const n=e[0].contentRect;n.width&&n.height&&this.setDimensions(n.width,n.height)}),this.#u.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#h}
6render(){if(this.div)return this.div;let e,n;this.width&&(e=this.x,n=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[c,b,m,k]=this.#y();if(this.setAt(c,b,0,0),this.setDims(m,k),this.#E(),this.width){const[E,P]=this.parentDimensions;this.setAspectRatio(this.width*E,this.height*P),this.setAt(e*E,n*P,this.width*E,this.height*P),this.#f=!0,this.#P(),this.setDims(this.width*E,this.height*P),this.#w(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#S(),this.div}#P(){if(!this.#f)return;const[e,n]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*n),this.#T()}setDimensions(e,n){const c=Math.round(e),b=Math.round(n);if(this.#d===c&&this.#a===b)return;this.#d=c,this.#a=b,this.canvas.style.visibility="hidden";const[m,k]=this.parentDimensions;this.width=e/m,this.height=n/k,this.fixAndSetPosition(),this.#h&&this.#H(e,n),this.#P(),this.#w(),this.canvas.style.visibility="visible",this.fixDims()}#H(e,n){const c=this.#O(),b=(e-c)/this.#e,m=(n-c)/this.#t;this.scaleFactor=Math.min(b,m)}#T(){const e=this.#O()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#F(e){const n=new Path2D;for(let c=0,b=e.length;c<b;c++){const[m,k,E,P]=e[c];c===0&&n.moveTo(...m),n.bezierCurveTo(k[0],k[1],E[0],E[1],P[0],P[1])}return n}static#k(e,n,c){const[b,m,k,E]=n;switch(c){case 0:for(let P=0,z=e.length;P<z;
6P+=2)e[P]+=b,e[P+1]=E-e[P+1];break;case 90:for(let P=0,z=e.length;P<z;P+=2){const B=e[P];e[P]=e[P+1]+b,e[P+1]=B+m}break;case 180:for(let P=0,z=e.length;P<z;P+=2)e[P]=k-e[P],e[P+1]+=m;break;case 270:for(let P=0,z=e.length;P<z;P+=2){const B=e[P];e[P]=k-e[P+1],e[P+1]=E-B}break;default:throw new Error("Invalid rotation")}return e}static#B(e,n,c){const[b,m,k,E]=n;switch(c){case 0:for(let P=0,z=e.length;P<z;P+=2)e[P]-=b,e[P+1]=E-e[P+1];break;case 90:for(let P=0,z=e.length;P<z;P+=2){const B=e[P];e[P]=e[P+1]-m,e[P+1]=B-b}break;case 180:for(let P=0,z=e.length;P<z;P+=2)e[P]=k-e[P],e[P+1]-=m;break;case 270:for(let P=0,z=e.length;P<z;P+=2){const B=e[P];e[P]=E-e[P+1],e[P+1]=k-B}break;default:throw new Error("Invalid rotation")}return e}#G(e,n,c,b){const m=[],k=this.thickness/2,E=e*n+k,P=e*c+k;for(const z of this.paths){const B=[],X=[];for(let Y=0,tt=z.length;Y<tt;Y++){const[rt,j,_,H]=z[Y],q=e*rt[0]+E,Q=e*rt[1]+P,K=e*j[0]+E,ft=e*j[1]+P,ot=e*_[0]+E,at=e*_[1]+P,gt=e*H[0]+E,ct=e*H[1]+P;Y===0&&(B.push(q,Q),X.push(q,Q)),B.push(K,ft,ot,at,gt,ct),X.push(K,ft),Y===tt-1&&X.push(gt,ct)}m.push({bezier:u.#k(B,b,this.rotation),points:u.#k(X,b,this.rotation)})}return m}#z(){let e=1/0,n=-1/0,c=1/0,b=-1/0;for(const m of this.paths)for(const[k,E,P,z]of m){const B=A.Util.bezierBoundingBox(...k,...E,...P,...z);e=Math.min(e,B[0]),c=Math.min(c,B[1]),n=Math.max(n,B[2]),b=Math.max(b,B[3])}return[e,c,n,b]}#O(){return this.#h?Math.ceil(this.thickness*this.parentScale):0}#R(e=!1){if(this.isEmpty())return;if(!this.#h){this.#w();return}const n=this.#z(),c=this.#O();this.#e=Math.max(V.AnnotationEditor.MIN_SIZE,n[2]-n[0]),this.#t=Math.max(V.AnnotationEditor.MIN_SIZE,n[3]-n[1]);const b=Math.ceil(c+this.#e*this.scaleFactor),m=Math.ceil(c+this.#t*this.scaleFactor),[k,E]=this.parentDimensions;this.width=b/k,this.height=m/E,this.setAspectRatio(b,m);const P=this.translationX,z=this.translationY;this.translationX=-n[0],this.translationY=-n[1],this.#P(),this.#w(),this.#d=b,this.#a=m,this.setDims(b,m);const B=e?c/this.scaleFactor/2:0;this.translate(P-this.translationX-B,z-this.translationY-B)}static deserialize(e,n,c){if(e instanceof N.InkAnnotationElement)return null;const b=super.deserialize(e,n,c);b.thickness=e.thickness,b.color=A.Util.makeHexColor(...e.color),b.opacity=e.opacity;const[m,k]=b.pageDimensions,E=b.width*m,P=b.height*k,z=b.parentScale,B=e.thickness/2;b.#h=!0,b.#d=Math.round(E),b.#a=Math.round(P);const{paths:X,rect:Y,rotation:tt}=e;for(let{bezier:j}of X){j=u.#B(j,Y,tt);const _=[];b.paths.push(_);let H=z*(j[0]-B),q=z*(j[1]-B);for(let K=2,ft=j.length;K<ft;K+=6){const ot=z*(j[K]-B),at=z*(j[K+1]-B),gt=z*(j[K+2]-B),ct=z*(j[K+3]-B),ht=z*(j[K+4]-B),J=z*(j[K+5]-B);_.push([[H,q],[ot,at],[gt,ct],[ht,J]]),H=ht,q=J}const Q=this.#F(_);b.bezierPath2D.push(Q)}const rt=b.#z();return b.#e=Math.max(V.AnnotationEditor.MIN_SIZE,rt[2]-rt[0]),b.#t=Math.max(V.AnnotationEditor.MIN_SIZE,rt[3]-rt[1]),b.#H(E,P),b}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),n=V.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:A.AnnotationEditorType.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:this.#G(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class g extends V.AnnotationEditor{#t=null;#e=null;#s=null;#i=null;#n=null;#r="";#o=null;#l=null;#h=null;#c=!1;#f=!1;static _type="stamp";static _editorType=A.AnnotationEditorType.STAMP;constructor(e){super({...e,name:"stampEditor"}),this.#i=e.bitmapUrl,this.#n=e.bitmapFile}static initialize(e){V.AnnotationEditor.initialize(e)}static get supportedTypes(){const e=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,A.shadow)(this,"supportedTypes",e.map(n=>`image/${n}`))}static get supportedTypesStr(){return(0,A.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,n){n.pasteEditor(A.AnnotationEditorType.STAMP,{bitmapFile:e.getAsFile()})}#u(e,n=!1){if(!e){this.remove();return}this.#t=e.bitmap,n||(this.#e=e.id,this.#c=e.isSvg),e.file&&(this.#r=e.file.name),this.#p()}#d(){this.#s=null,this._uiManager.enableWaiting(!1),this.#o&&this.div.focus()}#a(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(n=>this.#u(n,!0)).finally(()=>this.#d());return}if(this.#i){const n=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromUrl(n).then(c=>this.#u(c)).finally(()=>this.#d());return}if(this.#n){const n=this.#n;this.#n=null,this._uiManager.enableWaiting(!0),this.#s=this._uiManager.imageManager.getFromFile(n).then(c=>this.#u(c)).finally(()=>this.#d());return}const e=document.createElement("input");
6e.type="file",e.accept=g.supportedTypesStr,this.#s=new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const c=await this._uiManager.imageManager.getFromFile(e.files[0]);this.#u(c)}n()}),e.addEventListener("cancel",()=>{this.remove(),n()})}).finally(()=>this.#d()),e.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#o?.remove(),this.#o=null,this.#l?.disconnect(),this.#l=null,this.#h&&(clearTimeout(this.#h),this.#h=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#a();return}super.rebuild(),this.div!==null&&(this.#e&&this.#a(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#s||this.#t||this.#i||this.#n)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,n;if(this.width&&(e=this.x,n=this.y),super.render(),this.div.hidden=!0,this.#t?this.#p():this.#a(),this.width){const[c,b]=this.parentDimensions;this.setAt(e*c,n*b,this.width*c,this.height*b)}return this.div}#p(){const{div:e}=this;let{width:n,height:c}=this.#t;const[b,m]=this.pageDimensions,k=.75;if(this.width)n=this.width*b,c=this.height*m;else if(n>k*b||c>k*m){const B=Math.min(k*b/n,k*m/c);n*=B,c*=B}const[E,P]=this.parentDimensions;this.setDims(n*E/b,c*P/m),this._uiManager.enableWaiting(!1);const z=this.#o=document.createElement("canvas");e.append(z),e.hidden=!1,this.#A(n,c),this.#v(),this.#f||(this.parent.addUndoableEditor(this),this.#f=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton(),this.#r&&z.setAttribute("aria-label",this.#r)}#m(e,n){const[c,b]=this.parentDimensions;this.width=e/c,this.height=n/b,this.setDims(e,n),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#h!==null&&clearTimeout(this.#h);const m=200;this.#h=setTimeout(()=>{this.#h=null,this.#A(e,n)},m)}#b(e,n){const{width:c,height:b}=this.#t;let m=c,k=b,E=this.#t;for(;m>2*e||k>2*n;){const P=m,z=k;m>2*e&&(m=m>=16384?Math.floor(m/2)-1:Math.ceil(m/2)),k>2*n&&(k=k>=16384?Math.floor(k/2)-1:Math.ceil(k/2));const B=new OffscreenCanvas(m,k);B.getContext("2d").drawImage(E,0,0,P,z,0,0,m,k),E=B.transferToImageBitmap()}return E}#A(e,n){e=Math.ceil(e),n=Math.ceil(n);const c=this.#o;if(!c||c.width===e&&c.height===n)return;c.width=e,c.height=n;const b=this.#c?this.#t:this.#b(e,n),m=c.getContext("2d");m.filter=this._uiManager.hcmFilter,m.drawImage(b,0,0,b.width,b.height,0,0,e,n)}getImageForAltText(){return this.#o}#y(e){if(e){if(this.#c){const b=this._uiManager.imageManager.getSvgUrl(this.#e);if(b)return b}const n=document.createElement("canvas");return{width:n.width,height:n.height}=this.#t,n.getContext("2d").drawImage(this.#t,0,0),n.toDataURL()}if(this.#c){const[n,c]=this.pageDimensions,b=Math.round(this.width*n*l.PixelsPerInch.PDF_TO_CSS_UNITS),m=Math.round(this.height*c*l.PixelsPerInch.PDF_TO_CSS_UNITS),k=new OffscreenCanvas(b,m);return k.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,b,m),k.transferToImageBitmap()}return structuredClone(this.#t)}#v(){this.#l=new ResizeObserver(e=>{const n=e[0].contentRect;n.width&&n.height&&this.#m(n.width,n.height)}),this.#l.observe(this.div)}static deserialize(e,n,c){if(e instanceof N.StampAnnotationElement)return null;const b=super.deserialize(e,n,c),{rect:m,bitmapUrl:k,bitmapId:E,isSvg:P,accessibilityData:z}=e;E&&c.imageManager.isValidId(E)?b.#e=E:b.#i=k,b.#c=P;const[B,X]=b.pageDimensions;return b.width=(m[2]-m[0])/B,b.height=(m[3]-m[1])/X,z&&(b.altTextData=z),b}serialize(e=!1,n=null){if(this.isEmpty())return null;const c={annotationType:A.AnnotationEditorType.STAMP,bitmapId:this.#e,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#c,structTreeParentId:this._structTreeParentId};if(e)return c.bitmapUrl=this.#y(!0),c.accessibilityData=this.altTextData,c;const{decorative:b,altText:m}=this.altTextData;if(!b&&m&&(c.accessibilityData={type:"Figure",alt:m}),n===null)return c;n.stamps||=new Map;const k=this.#c?(c.rect[2]-c.rect[0])*(c.rect[3]-c.rect[1]):null;if(!n.stamps.has(this.#e))n.stamps.set(this.#e,{area:k,serialized:c}),c.bitmap=this.#y(!1);else if(this.#c){const E=n.stamps.get(this.#e);k>E.area&&(E.area=k,E.serialized.bitmap.close(),E.serialized.bitmap=this.#y(!1))}return c}}class r{#t;#e=!1;#s=null;#i=this.pointerup.bind(this);#n=this.pointerUpAfterSelection.bind(this);#r=this.pointerdown.bind(this);#o=null;#l=this.selectionStart.bind(this);#h=new Map;#c=!1;#f=!1;#u=!1;#d=null;#a;static _initialized=!1;static#p=new Map([R,u,g,v].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:n,div:c,accessibilityManager:b,annotationLayer:m,drawLayer:k,textLayer:E,viewport:P,l10n:z}){const B=[...r.#p.values()];if(!r._initialized){r._initialized=!0;for(const X of B)X.initialize(z)}
6e.registerEditorTypes(B),this.#a=e,this.pageIndex=n,this.div=c,this.#t=b,this.#s=m,this.viewport=P,this.#d=E,this.drawLayer=k,this.#a.addLayer(this)}get isEmpty(){return this.#h.size===0}updateToolbar(e){this.#a.updateToolbar(e)}updateMode(e=this.#a.getMode()){switch(this.#v(),e){case A.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;case A.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case A.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}if(e!==A.AnnotationEditorType.NONE){const{classList:n}=this.div;for(const c of r.#p.values())n.toggle(`${c._type}Editing`,e===c._editorType);this.div.hidden=!1}}addInkEditorIfNeeded(e){if(this.#a.getMode()!==A.AnnotationEditorType.INK)return;if(!e){for(const c of this.#h.values())if(c.isEmpty()){c.setInBackground();return}}this.#A({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){this.#a.setEditingState(e)}addCommands(e){this.#a.addCommands(e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}enable(){this.togglePointerEvents(!0);const e=new Set;for(const c of this.#h.values())c.enableEditing(),c.annotationElementId&&e.add(c.annotationElementId);if(!this.#s)return;const n=this.#s.getEditableAnnotations();for(const c of n){if(c.hide(),this.#a.isDeletedAnnotationElement(c.data.id)||e.has(c.data.id))continue;const b=this.deserialize(c);b&&(this.addOrRebuild(b),b.enableEditing())}}disable(){this.#u=!0,this.togglePointerEvents(!1);const e=new Set;for(const c of this.#h.values()){if(c.disableEditing(),!c.annotationElementId||c.serialize()!==null){e.add(c.annotationElementId);continue}this.getEditableAnnotation(c.annotationElementId)?.show(),c.remove()}if(this.#s){const c=this.#s.getEditableAnnotations();for(const b of c){const{id:m}=b.data;e.has(m)||this.#a.isDeletedAnnotationElement(m)||b.show()}}this.#v(),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const c of r.#p.values())n.remove(`${c._type}Editing`);this.disableTextSelection(),this.#u=!1}getEditableAnnotation(e){return this.#s?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#a.getActive()!==e&&this.#a.setActiveEditor(e)}enableTextSelection(){this.#d?.div&&document.addEventListener("selectstart",this.#l)}disableTextSelection(){this.#d?.div&&document.removeEventListener("selectstart",this.#l)}enableClick(){this.div.addEventListener("pointerdown",this.#r),this.div.addEventListener("pointerup",this.#i)}disableClick(){this.div.removeEventListener("pointerdown",this.#r),this.div.removeEventListener("pointerup",this.#i)}attach(e){this.#h.set(e.id,e);const{annotationElementId:n}=e;n&&this.#a.isDeletedAnnotationElement(n)&&this.#a.removeDeletedAnnotationElement(e)}detach(e){this.#h.delete(e.id),this.#t?.removePointerInTextLayer(e.contentDiv),!this.#u&&e.annotationElementId&&this.#a.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#a.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,this.#f||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.annotationElementId&&(this.#a.addDeletedAnnotationElement(e.annotationElementId),V.AnnotationEditor.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.changeParent(e),this.#a.addEditor(e),this.attach(e),!e.isAttachedToDOM){const n=e.render();this.div.append(n),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#a.addToAnnotationStorage(e)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:n}=document;e.div.contains(n)&&!this.#o&&(e._focusEventsAllowed=!1,this.#o=setTimeout(()=>{this.#o=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0}),n.focus())},0)),e._structTreeParentId=this.#t?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild()):this.add(e)}addUndoableEditor(e){const n=()=>e._uiManager.rebuild(e),c=()=>{e.remove()};this.addCommands({cmd:n,undo:c,mustExec:!1})}getNextId(){return this.#a.getId()}get#m(){return r.#p.get(this.#a.getMode())}#b(e){const n=this.#m;return n?new n.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#m?.canCreateNewEmptyEditor()}pasteEditor(e,n){this.#a.updateToolbar(e),this.#a.updateMode(e);const{offsetX:c,offsetY:b}=this.#y(),m=this.getNextId(),k=this.#b({parent:this,id:m,x:c,y:b,uiManager:this.#a,isCentered:!0,...n});k&&this.add(k)}deserialize(e){return r.#p.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#a)||null}#A(e,n,c={}){const b=this.getNextId(),m=this.#b({parent:this,id:b,x:e.offsetX,y:e.offsetY,uiManager:this.#a,isCentered:n,...c});return m&&this.add(m),m}#y(){const{x:e,y:n,width:c,height:b}=this.div.getBoundingClientRect(),m=Math.max(0,e),k=Math.max(0,n),E=Math.min(window.innerWidth,e+c),P=Math.min(window.innerHeight,n+b),z=(m+E)/2-e,B=(k+P)/2-n,[X,Y]=this.viewport.rotation%180===0?[z,B]:[B,z];return{offsetX:X,offsetY:Y}}addNewEditor(){this.#A(this.#y(),!0)}setSelected(e){this.#a.setSelected(e)}toggleSelected(e){this.#a.toggleSelected(e)}isSelected(e){return this.#a.isSelected(e)}unselect(e){this.#a.unselect(e)}selectionStart(e){this.#d?.div.addEventListener("pointerup",this.#n,{once:!0})}pointerUpAfterSelection(e){const n=document.getSelection();if(n.rangeCount===0)return;const c=n.getRangeAt(0);if(c.collapsed||!this.#d?.div.contains(c.commonAncestorContainer))return;const{x:b,y:m,width:k,height:E}=this.#d.div.getBoundingClientRect(),P=c.getClientRects();let z;switch(this.viewport.rotation){case 90:z=(X,Y,tt,rt)=>({x:(Y-m)/E,y:1-(X+tt-b)/k,width:rt/E,height:tt/k});break;case 180:z=(X,Y,tt,rt)=>({x:1-(X+tt-b)/k,y:1-(Y+rt-m)/E,width:tt/k,height:rt/E});break;case 270:z=(X,Y,tt,rt)=>({x:1-(Y+rt-m)/E,y:(X-b)/k,width:rt/E,height:tt/k});break;default:z=(X,Y,tt,rt)=>({x:(X-b)/k,y:(Y-m)/E,width:tt/k,height:rt/E});break}const B=[];for(const{x:X,y:Y,width:tt,height:rt}of P)tt===0||rt===0||B.push(z(X,Y,tt,rt));B.length!==0&&this.#A(e,!1,{boxes:B}),n.empty()}pointerup(e){const{isMac:n}=A.FeatureTest.platform;if(!(e.button!==0||e.ctrlKey&&n)&&e.target===this.div&&this.#c){if(this.#c=!1,!this.#e){this.#e=!0;return}if(this.#a.getMode()===A.AnnotationEditorType.STAMP){this.#a.unselectAll();return}this.#A(e,!1)}}pointerdown(e){if(this.#a.getMode()===A.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#c){this.#c=!1;return}const{isMac:n}=A.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&n||e.target!==this.div)return;this.#c=!0;const c=this.#a.getActive();this.#e=!c||c.isEmpty()}findNewParent(e,n,c){const b=this.#a.findParent(n,c);return b===null||b===this?!1:(b.changeParent(e),!0)}destroy(){this.#a.getActive()?.parent===this&&(this.#a.commitOrRemove(),this.#a.setActiveEditor(null)),this.#o&&(clearTimeout(this.#o),this.#o=null);for(const e of this.#h.values())this.#t?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#h.clear(),this.#a.removeLayer(this)}#v(){this.#f=!0;for(const e of this.#h.values())e.isEmpty()&&e.remove();this.#f=!1}render({viewport:e}){this.viewport=e,(0,l.setLayerDimensions)(this.div,e);for(const n of this.#a.getEditors(this.pageIndex))this.add(n);this.updateMode()}update({viewport:e}){this.#a.commitOrRemove();const n=this.viewport.rotation,c=e.rotation;if(this.viewport=e,(0,l.setLayerDimensions)(this.div,{rotation:c}),n!==c)for(const b of this.#h.values())b.rotate(c);this.updateMode()}get pageDimensions(){const{pageWidth:e,pageHeight:n}=this.viewport.rawDims;return[e,n]}}},97:(ut,Z,U)=>{U.d(Z,{ColorPicker:()=>N});var A=U(266),V=U(812),C=U(473);class N{#t=this.#u.bind(this);#e=null;#s=null;#i;#n=null;#r=!1;#o=!1;#l;#h=null;static get _keyboardManager(){return(0,A.shadow)(this,"_keyboardManager",new V.KeyboardManager([[["Escape","mac+Escape"],N.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],N.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],N.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],N.prototype._moveToPrevious],[["Home","mac+Home"],N.prototype._moveToBeginning],[["End","mac+End"],N.prototype._moveToEnd]]))}constructor({editor:L=null,uiManager:w=null}){this.#o=!L,this.#h=L?._uiManager||w,this.#l=this.#h._eventBus,this.#i=L?.color||this.#h?.highlightColors.values().next().value||"#FFFF98"}renderButton(){const L=this.#e=document.createElement("button");
6L.className="colorPicker",L.tabIndex="0",L.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),L.setAttribute("aria-haspopup",!0),L.addEventListener("click",this.#d.bind(this));const w=this.#s=document.createElement("span");return w.className="swatch",w.style.backgroundColor=this.#i,L.append(w),L}renderMainDropdown(){const L=this.#n=this.#c(A.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR);return L.setAttribute("aria-orientation","horizontal"),L.setAttribute("aria-labelledby","highlightColorPickerLabel"),L}#c(L){const w=document.createElement("div");w.addEventListener("contextmenu",C.noContextMenu),w.className="dropdown",w.role="listbox",w.setAttribute("aria-multiselectable",!1),w.setAttribute("aria-orientation","vertical"),w.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[v,l]of this.#h.highlightColors){const u=document.createElement("button");u.tabIndex="0",u.role="option",u.setAttribute("data-color",l),u.title=v,u.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${v}`);const g=document.createElement("span");u.append(g),g.className="swatch",g.style.backgroundColor=l,u.setAttribute("aria-selected",l===this.#i),u.addEventListener("click",this.#f.bind(this,L,l)),w.append(u)}return w.addEventListener("keydown",this.#t),w}#f(L,w,v){v.stopPropagation(),this.#l.dispatch("switchannotationeditorparams",{source:this,type:L,value:w})}_colorSelectFromKeyboard(L){const w=L.target.getAttribute("data-color");w&&this.#f(w,L)}_moveToNext(L){if(L.target===this.#e){this.#n.firstChild?.focus();return}L.target.nextSibling?.focus()}_moveToPrevious(L){L.target.previousSibling?.focus()}_moveToBeginning(){this.#n.firstChild?.focus()}_moveToEnd(){this.#n.lastChild?.focus()}#u(L){N._keyboardManager.exec(this,L)}#d(L){if(this.#n&&!this.#n.classList.contains("hidden")){this.hideDropdown();return}if(this.#e.addEventListener("keydown",this.#t),this.#r=L.detail===0,this.#n){this.#n.classList.remove("hidden");return}const w=this.#n=this.#c(A.AnnotationEditorParamsType.HIGHLIGHT_COLOR);this.#e.append(w)}hideDropdown(){this.#n?.classList.add("hidden")}_hideDropdownFromKeyboard(){this.#o||!this.#n||this.#n.classList.contains("hidden")||(this.hideDropdown(),this.#e.removeEventListener("keydown",this.#t),this.#e.focus({preventScroll:!0,focusVisible:this.#r}))}updateColor(L){if(this.#s&&(this.#s.style.backgroundColor=L),!this.#n)return;const w=this.#h.highlightColors.values();for(const v of this.#n.children)v.setAttribute("aria-selected",w.next().value===L)}destroy(){this.#e?.remove(),this.#e=null,this.#s=null,this.#n?.remove(),this.#n=null}}},115:(ut,Z,U)=>{U.d(Z,{AnnotationEditor:()=>L});var A=U(812),V=U(266),C=U(473);class N{#t="";#e=!1;#s=null;#i=null;#n=null;#r=!1;#o=null;static _l10nPromise=null;constructor(l){this.#o=l}static initialize(l){N._l10nPromise||=l}async render(){const l=this.#s=document.createElement("button");l.className="altText";const u=await N._l10nPromise.get("pdfjs-editor-alt-text-button-label");l.textContent=u,l.setAttribute("aria-label",u),l.tabIndex="0",l.addEventListener("contextmenu",C.noContextMenu),l.addEventListener("pointerdown",r=>r.stopPropagation());const g=r=>{r.preventDefault(),this.#o._uiManager.editAltText(this.#o)};return l.addEventListener("click",g,{capture:!0}),l.addEventListener("keydown",r=>{r.target===l&&r.key==="Enter"&&(this.#r=!0,g(r))}),await this.#l(),l}finish(){this.#s&&(this.#s.focus({focusVisible:this.#r}),this.#r=!1)}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:l,decorative:u}){this.#t===l&&this.#e===u||(this.#t=l,this.#e=u,this.#l())}toggle(l=!1){this.#s&&(!l&&this.#n&&(clearTimeout(this.#n),this.#n=null),this.#s.disabled=!l)}destroy(){this.#s?.remove(),this.#s=null,this.#i=null}async#l(){const l=this.#s;if(!l)return;if(!this.#t&&!this.#e){l.classList.remove("done"),this.#i?.remove();return}l.classList.add("done"),N._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(r=>{l.setAttribute("aria-label",r)});let u=this.#i;if(!u){this.#i=u=document.createElement("span"),u.className="tooltip",u.setAttribute("role","tooltip");const r=u.id=`alt-text-tooltip-${this.#o.id}`;l.setAttribute("aria-describedby",r);const p=100;l.addEventListener("mouseenter",()=>{this.#n=setTimeout(()=>{this.#n=null,this.#i.classList.add("show"),this.#o._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.#o.editorType,data:{action:"alt_text_tooltip"}}})},p)}),l.addEventListener("mouseleave",()=>{this.#n&&(clearTimeout(this.#n),this.#n=null),this.#i?.classList.remove("show")})}u.innerText=this.#e?await N._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#t,u.parentNode||l.append(u),this.#o.getImageForAltText()?.setAttribute("aria-describedby",u.id)}}class R{#t=null;#e=null;#s;#i=null;constructor(l){this.#s=l}render(){const l=this.#t=document.createElement("div");l.className="editToolbar",l.addEventListener("contextmenu",C.noContextMenu),l.addEventListener("pointerdown",R.#n);const u=this.#i=document.createElement("div");u.className="buttons",l.append(u);const g=this.#s.toolbarPosition;if(g){const{style:r}=l,p=this.#s._uiManager.direction==="ltr"?1-g[0]:g[0];r.insetInlineEnd=`${100*p}%`,r.top=`calc(${100*g[1]}% + var(--editor-toolbar-vert-offset))`}return this.#h(),l}static#n(l){l.stopPropagation()}#r(l){this.#s._focusEventsAllowed=!1,l.preventDefault(),l.stopPropagation()}#o(l){this.#s._focusEventsAllowed=!0,l.preventDefault(),l.stopPropagation()}#l(l){l.addEventListener("focusin",this.#r.bind(this),{capture:!0}),l.addEventListener("focusout",this.#o.bind(this),{capture:!0}),l.addEventListener("contextmenu",C.noContextMenu)}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden")}#h(){const l=document.createElement("button");l.className="delete",l.tabIndex=0,l.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#s.editorType}-button`),this.#l(l),l.addEventListener("click",u=>{this.#s._uiManager.delete()}),this.#i.append(l)}get#c(){const l=document.createElement("div");return l.className="divider",l}addAltTextButton(l){this.#l(l),this.#i.prepend(l,this.#c)}addColorPicker(l){this.#e=l;const u=l.renderButton();this.#l(u),this.#i.prepend(u,this.#c)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}}class L{#t=null;#e=null;#s=!1;#i=null;#n=null;#r=this.focusin.bind(this);#o=this.focusout.bind(this);#l=null;#h="";#c=!1;#f=!1;#u=!1;#d=!1;#a=null;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#p=!1;#m=L._zIndex++;static _borderLineWidth=-1;static _colorManager=new A.ColorManager;static _zIndex=1;static get _resizerKeyboardManager(){const l=L.prototype._resizeWithKeyboard,u=A.AnnotationEditorUIManager.TRANSLATE_SMALL,g=A.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,V.shadow)(this,"_resizerKeyboardManager",new A.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],l,{args:[-u,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],l,{args:[-g,0]}],[["ArrowRight","mac+ArrowRight"],l,{args:[u,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],l,{args:[g,0]}],[["ArrowUp","mac+ArrowUp"],l,{args:[0,-u]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],l,{args:[0,-g]}],[["ArrowDown","mac+ArrowDown"],l,{args:[0,u]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],l,{args:[0,g]}],[["Escape","mac+Escape"],L.prototype._stopResizingWithKeyboard]]))}constructor(l){this.constructor===L&&(0,V.unreachable)("Cannot initialize AnnotationEditor."),this.parent=l.parent,this.id=l.id,this.width=this.height=null,this.pageIndex=l.parent.pageIndex,this.name=l.name,this.div=null,this._uiManager=l.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=l.isCentered,this._structTreeParentId=null;const{rotation:u,rawDims:{pageWidth:g,pageHeight:r,pageX:p,pageY:e}}=this.parent.viewport;this.rotation=u,this.pageRotation=(360+u-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[g,r],this.pageTranslation=[p,e];const[n,c]=this.parentDimensions;this.x=l.x/n,this.y=l.y/c,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,V.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(l){const u=new w({id:l.parent.getNextId(),parent:l.parent,uiManager:l._uiManager});u.annotationElementId=l.annotationElementId,u.deleted=!0,u._uiManager.addToAnnotationStorage(u)}static initialize(l,u=null){if(L._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(r=>[r,l.get(r.replaceAll(/([A-Z])/g,p=>
6`-${p.toLowerCase()}`))])),u?.strings)for(const r of u.strings)L._l10nPromise.set(r,l.get(r));if(L._borderLineWidth!==-1)return;const g=getComputedStyle(document.documentElement);L._borderLineWidth=parseFloat(g.getPropertyValue("--outline-width"))||0}static updateDefaultParams(l,u){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(l){return!1}static paste(l,u){(0,V.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#p}set _isDraggable(l){this.#p=l,this.div?.classList.toggle("draggable",l)}get isEnterHandled(){return!0}center(){const[l,u]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*u/(l*2),this.y+=this.width*l/(u*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*u/(l*2),this.y-=this.width*l/(u*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(l){this._uiManager.addCommands(l)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#m}setParent(l){l!==null?(this.pageIndex=l.pageIndex,this.pageDimensions=l.pageDimensions):this.#S(),this.parent=l}focusin(l){this._focusEventsAllowed&&(this.#c?this.#c=!1:this.parent.setSelected(this))}focusout(l){!this._focusEventsAllowed||!this.isAttachedToDOM||l.relatedTarget?.closest(`#${this.id}`)||(l.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(l,u,g,r){const[p,e]=this.parentDimensions;[g,r]=this.screenToPageTranslation(g,r),this.x=(l+g)/p,this.y=(u+r)/e,this.fixAndSetPosition()}#b([l,u],g,r){[g,r]=this.screenToPageTranslation(g,r),this.x+=g/l,this.y+=r/u,this.fixAndSetPosition()}translate(l,u){this.#b(this.parentDimensions,l,u)}translateInPage(l,u){this.#b(this.pageDimensions,l,u),this.div.scrollIntoView({block:"nearest"})}drag(l,u){const[g,r]=this.parentDimensions;if(this.x+=l/g,this.y+=u/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:b,y:m}=this.div.getBoundingClientRect();this.parent.findNewParent(this,b,m)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:p,y:e}=this;const[n,c]=this.#A();p+=n,e+=c,this.div.style.left=`${(100*p).toFixed(2)}%`,this.div.style.top=`${(100*e).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#A(){const[l,u]=this.parentDimensions,{_borderLineWidth:g}=L,r=g/l,p=g/u;switch(this.rotation){case 90:return[-r,p];case 180:return[r,p];case 270:return[r,-p];default:return[-r,-p]}}fixAndSetPosition(l=this.rotation){const[u,g]=this.pageDimensions;let{x:r,y:p,width:e,height:n}=this;switch(e*=u,n*=g,r*=u,p*=g,l){case 0:r=Math.max(0,Math.min(u-e,r)),p=Math.max(0,Math.min(g-n,p));break;case 90:r=Math.max(0,Math.min(u-n,r)),p=Math.min(g,Math.max(e,p));break;case 180:r=Math.min(u,Math.max(e,r)),p=Math.min(g,Math.max(n,p));break;case 270:r=Math.min(u,Math.max(n,r)),p=Math.max(0,Math.min(g-e,p));break}this.x=r/=u,this.y=p/=g;const[c,b]=this.#A();r+=c,p+=b;const{style:m}=this.div;m.left=`${(100*r).toFixed(2)}%`,m.top=`${(100*p).toFixed(2)}%`,this.moveInDOM()}static#y(l,u,g){switch(g){case 90:return[u,-l];case 180:return[-l,-u];case 270:return[-u,l];default:return[l,u]}}screenToPageTranslation(l,u){return L.#y(l,u,this.parentRotation)}pageTranslationToScreen(l,u){return L.#y(l,u,360-this.parentRotation)}#v(l){switch(l){case 90:{const[u,g]=this.pageDimensions;return[0,-u/g,g/u,0]}case 180:return[-1,0,0,-1];case 270:{const[u,g]=this.pageDimensions;return[0,u/g,-g/u,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:l,pageDimensions:[u,g]}=this,r=u*l,p=g*l;return V.FeatureTest.isCSSRoundSupported?[Math.round(r),Math.round(p)]:[r,p]}setDims(l,u){const[g,r]=this.parentDimensions;this.div.style.width=`${(100*l/g).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*u/r).toFixed(2)}%`)}fixDims(){const{style:l}=this.div,{height:u,width:g}=l,r=g.endsWith("%"),p=!this.#s&&u.endsWith("%");if(r&&p)return;const[e,n]=this.parentDimensions;r||(l.width=`${(100*parseFloat(g)/e).toFixed(2)}%`),!this.#s&&!p&&(l.height=`${(100*parseFloat(u)/n).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}
6#g(){if(this.#i)return;this.#i=document.createElement("div"),this.#i.classList.add("resizers");const l=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const u of l){const g=document.createElement("div");this.#i.append(g),g.classList.add("resizer",u),g.setAttribute("data-resizer-name",u),g.addEventListener("pointerdown",this.#C.bind(this,u)),g.addEventListener("contextmenu",C.noContextMenu),g.tabIndex=-1}this.div.prepend(this.#i)}#C(l,u){u.preventDefault();const{isMac:g}=V.FeatureTest.platform;if(u.button!==0||u.ctrlKey&&g)return;this.#e?.toggle(!1);const r=this.#M.bind(this,l),p=this._isDraggable;this._isDraggable=!1;const e={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",r,e);const n=this.x,c=this.y,b=this.width,m=this.height,k=this.parent.div.style.cursor,E=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(u.target).cursor;const P=()=>{this.parent.togglePointerEvents(!0),this.#e?.toggle(!0),this._isDraggable=p,window.removeEventListener("pointerup",P),window.removeEventListener("blur",P),window.removeEventListener("pointermove",r,e),this.parent.div.style.cursor=k,this.div.style.cursor=E,this.#L(n,c,b,m)};window.addEventListener("pointerup",P),window.addEventListener("blur",P)}#L(l,u,g,r){const p=this.x,e=this.y,n=this.width,c=this.height;p===l&&e===u&&n===g&&c===r||this.addCommands({cmd:()=>{this.width=n,this.height=c,this.x=p,this.y=e;const[b,m]=this.parentDimensions;this.setDims(b*n,m*c),this.fixAndSetPosition()},undo:()=>{this.width=g,this.height=r,this.x=l,this.y=u;const[b,m]=this.parentDimensions;this.setDims(b*g,m*r),this.fixAndSetPosition()},mustExec:!0})}#M(l,u){const[g,r]=this.parentDimensions,p=this.x,e=this.y,n=this.width,c=this.height,b=L.MIN_SIZE/g,m=L.MIN_SIZE/r,k=d=>Math.round(d*1e4)/1e4,E=this.#v(this.rotation),P=(d,o)=>[E[0]*d+E[2]*o,E[1]*d+E[3]*o],z=this.#v(360-this.rotation),B=(d,o)=>[z[0]*d+z[2]*o,z[1]*d+z[3]*o];let X,Y,tt=!1,rt=!1;switch(l){case"topLeft":tt=!0,X=(d,o)=>[0,0],Y=(d,o)=>[d,o];break;case"topMiddle":X=(d,o)=>[d/2,0],Y=(d,o)=>[d/2,o];break;case"topRight":tt=!0,X=(d,o)=>[d,0],Y=(d,o)=>[0,o];break;case"middleRight":rt=!0,X=(d,o)=>[d,o/2],Y=(d,o)=>[0,o/2];break;case"bottomRight":tt=!0,X=(d,o)=>[d,o],Y=(d,o)=>[0,0];break;case"bottomMiddle":X=(d,o)=>[d/2,o],Y=(d,o)=>[d/2,0];break;case"bottomLeft":tt=!0,X=(d,o)=>[0,o],Y=(d,o)=>[d,0];break;case"middleLeft":rt=!0,X=(d,o)=>[0,o/2],Y=(d,o)=>[d,o/2];break}const j=X(n,c),_=Y(n,c);let H=P(..._);const q=k(p+H[0]),Q=k(e+H[1]);let K=1,ft=1,[ot,at]=this.screenToPageTranslation(u.movementX,u.movementY);if([ot,at]=B(ot/g,at/r),tt){const d=Math.hypot(n,c);K=ft=Math.max(Math.min(Math.hypot(_[0]-j[0]-ot,_[1]-j[1]-at)/d,1/n,1/c),b/n,m/c)}else rt?K=Math.max(b,Math.min(1,Math.abs(_[0]-j[0]-ot)))/n:ft=Math.max(m,Math.min(1,Math.abs(_[1]-j[1]-at)))/c;const gt=k(n*K),ct=k(c*ft);H=P(...Y(gt,ct));const ht=q-H[0],J=Q-H[1];this.width=gt,this.height=ct,this.x=ht,this.y=J,this.setDims(g*gt,r*ct),this.fixAndSetPosition()}altTextFinish(){this.#e?.finish()}async addEditToolbar(){return this.#l||this.#u?this.#l:(this.#l=new R(this),this.div.append(this.#l.render()),this.#e&&this.#l.addAltTextButton(await this.#e.render()),this.#l)}removeEditToolbar(){this.#l&&(this.#l.remove(),this.#l=null,this.#e?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#e||(N.initialize(L._l10nPromise),this.#e=new N(this),await this.addEditToolbar())}get altTextData(){return this.#e?.data}set altTextData(l){this.#e&&(this.#e.data=l)}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#r),this.div.addEventListener("focusout",this.#o);const[l,u]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*u/l).toFixed(2)}%`,this.div.style.maxHeight=`${(100*l/u).toFixed(2)}%`);const[g,r]=this.getInitialTranslation();return this.translate(g,r),(0,A.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(l){const{isMac:u}=V.FeatureTest.platform;if(l.button!==0||l.ctrlKey&&u){l.preventDefault();return}if(this.#c=!0,this._isDraggable){this.#N(l);return}this.#I(l)}#I(l){const{isMac:u}=V.FeatureTest.platform;l.ctrlKey&&!u||l.shiftKey||l.metaKey&&u?this.parent.toggleSelected(this):this.parent.setSelected(this)}#N(l){const u=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let g,r;u&&(g={passive:!0,capture:!0},r=e=>{const[n,c]=this.screenToPageTranslation(e.movementX,e.movementY);this._uiManager.dragSelectedEditors(n,c)},window.addEventListener("pointermove",r,g));const p=()=>{window.removeEventListener("pointerup",p),window.removeEventListener("blur",p),u&&window.removeEventListener("pointermove",r,g),this.#c=!1,this._uiManager.endDragSession()||this.#I(l)};window.addEventListener("pointerup",p),window.addEventListener("blur",p)}moveInDOM(){this.#a&&clearTimeout(this.#a),this.#a=setTimeout(()=>{this.#a=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(l,u,g){l.changeParent(this),this.x=u,this.y=g,this.fixAndSetPosition()}getRect(l,u,g=this.rotation){const r=this.parentScale,[p,e]=this.pageDimensions,[n,c]=this.pageTranslation,b=l/r,m=u/r,k=this.x*p,E=this.y*e,P=this.width*p,z=this.height*e;switch(g){case 0:return[k+b+n,e-E-m-z+c,k+b+P+n,e-E-m+c];case 90:return[k+m+n,e-E+b+c,k+m+z+n,e-E+b+P+c];case 180:return[k-b-P+n,e-E+m+c,k-b+n,e-E+m+z+c];case 270:return[k-m-z+n,e-E-b-P+c,k-m+n,e-E-b+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(l,u){const[g,r,p,e]=l,n=p-g,c=e-r;switch(this.rotation){case 0:return[g,u-e,n,c];case 90:return[g,u-r,c,n];case 180:return[p,u-r,n,c];case 270:return[p,u-e,c,n];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#u=!0}disableEditMode(){this.#u=!1}isInEditMode(){return this.#u}shouldGetKeyboardEvents(){return this.#d}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#r),this.div?.addEventListener("focusout",this.#o)}rotate(l){}
6serialize(l=!1,u=null){(0,V.unreachable)("An editor must be serializable")}static deserialize(l,u,g){const r=new this.prototype.constructor({parent:u,id:u.getNextId(),uiManager:g});r.rotation=l.rotation;const[p,e]=r.pageDimensions,[n,c,b,m]=r.getRectInCurrentCoords(l.rect,e);return r.x=n/p,r.y=c/e,r.width=b/p,r.height=m/e,r}remove(){this.div.removeEventListener("focusin",this.#r),this.div.removeEventListener("focusout",this.#o),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#a&&(clearTimeout(this.#a),this.#a=null),this.#S(),this.removeEditToolbar()}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#g(),this.#i.classList.remove("hidden"),(0,A.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(l){if(!this.isResizable||l.target!==this.div||l.key!=="Enter")return;this._uiManager.setSelected(this),this.#n={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const u=this.#i.children;if(!this.#t){this.#t=Array.from(u);const e=this.#_.bind(this),n=this.#w.bind(this);for(const c of this.#t){const b=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",e),c.addEventListener("blur",n),c.addEventListener("focus",this.#D.bind(this,b)),L._l10nPromise.get(`pdfjs-editor-resizer-label-${b}`).then(m=>c.setAttribute("aria-label",m))}}const g=this.#t[0];let r=0;for(const e of u){if(e===g)break;r++}const p=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(p!==r){if(p<r)for(let n=0;n<r-p;n++)this.#i.append(this.#i.firstChild);else if(p>r)for(let n=0;n<p-r;n++)this.#i.firstChild.before(this.#i.lastChild);let e=0;for(const n of u){const b=this.#t[e++].getAttribute("data-resizer-name");L._l10nPromise.get(`pdfjs-editor-resizer-label-${b}`).then(m=>n.setAttribute("aria-label",m))}}this.#E(0),this.#d=!0,this.#i.firstChild.focus({focusVisible:!0}),l.preventDefault(),l.stopImmediatePropagation()}#_(l){L._resizerKeyboardManager.exec(this,l)}#w(l){this.#d&&l.relatedTarget?.parentNode!==this.#i&&this.#S()}#D(l){this.#h=this.#d?l:""}#E(l){if(this.#t)for(const u of this.#t)u.tabIndex=l}_resizeWithKeyboard(l,u){this.#d&&this.#M(this.#h,{movementX:l,movementY:u})}#S(){if(this.#d=!1,this.#E(-1),this.#n){const{savedX:l,savedY:u,savedWidth:g,savedHeight:r}=this.#n;this.#L(l,u,g,r),this.#n=null}}_stopResizingWithKeyboard(){this.#S(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#l){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#l?.show()});return}this.#l?.show()}unselect(){this.#i?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus(),this.#l?.hide()}updateParams(l,u){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(l){this.#f=l,this.parent&&(l?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(l,u){this.#s=!0;const g=l/u,{style:r}=this.div;r.aspectRatio=g,r.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}}class w extends L{constructor(l){super(l),this.annotationElementId=l.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},405:(ut,Z,U)=>{U.d(Z,{Outliner:()=>A});class A{#t;#e=[];#s=[];constructor(C,N=0,R=0,L=!0){let w=1/0,v=-1/0,l=1/0,u=-1/0;const r=10**-4;for(const{x:k,y:E,width:P,height:z}of C){const B=Math.floor((k-N)/r)*r,X=Math.ceil((k+P+N)/r)*r,Y=Math.floor((E-N)/r)*r,tt=Math.ceil((E+z+N)/r)*r,rt=[B,Y,tt,!0],j=[X,Y,tt,!1];this.#e.push(rt,j),w=Math.min(w,B),v=Math.max(v,X),l=Math.min(l,Y),u=Math.max(u,tt)}const p=v-w+2*R,e=u-l+2*R,n=w-R,c=l-R,b=this.#e.at(L?-1:-2),m=[b[0],b[2]];for(const k of this.#e){const[E,P,z]=k;k[0]=(E-n)/p,k[1]=(P-c)/e,k[2]=(z-c)/e}this.#t={x:n,y:c,width:p,height:e,lastPoint:m}}getOutlines(){this.#e.sort((N,R)=>N[0]-R[0]||N[1]-R[1]||N[2]-R[2]);const C=[];for(const N of this.#e)N[3]?(C.push(...this.#l(N)),this.#r(N)):(this.#o(N),C.push(...this.#l(N)));return this.#i(C)}#i(C){const N=[],R=new Set;for(const v of C){const[l,u,g]=v;N.push([l,u,v],[l,g,v])}N.sort((v,l)=>v[1]-l[1]||v[0]-l[0]);for(let v=0,l=N.length;v<l;v+=2){const u=N[v][2],g=N[v+1][2];u.push(g),g.push(u),R.add(u),R.add(g)}const L=[];let w;for(;R.size>0;){const v=R.values().next().value;let[l,u,g,r,p]=v;R.delete(v);let e=l,n=u;for(w=[l,g],L.push(w);;){let c;if(R.has(r))c=r;else if(R.has(p))c=p;else break;R.delete(c),[l,u,g,r,p]=c,e!==l&&(w.push(e,n,l,n===u?u:g),e=l),n=n===u?g:u}w.push(e,n)}return{outlines:L,box:this.#t}}#n(C){const N=this.#s;let R=0,L=N.length-1;for(;R<=L;){const w=R+L>>1,v=N[w][0];if(v===C)return w;v<C?R=w+1:L=w-1}return L+1}#r([,C,N]){const R=this.#n(C);this.#s.splice(R,0,[C,N])}#o([,C,N]){const R=this.#n(C);for(let L=R;L<this.#s.length;L++){const[w,v]=this.#s[L];if(w!==C)break;if(w===C&&v===N){this.#s.splice(L,1);return}}for(let L=R-1;L>=0;L--){const[w,v]=this.#s[L];if(w!==C)break;if(w===C&&v===N){this.#s.splice(L,1);return}}}#l(C){const[N,R,L]=C,w=[[N,R,L]],v=this.#n(L);for(let l=0;l<v;l++){const[u,g]=this.#s[l];for(let r=0,p=w.length;r<p;r++){const[,e,n]=w[r];if(!(g<=e||n<=u)){if(e>=u){if(n>g)w[r][1]=g;else{if(p===1)return[];w.splice(r,1),r--,p--}continue}w[r][2]=u,n>g&&w.push([N,g,n])}}}return w}}},812:(ut,Z,U)=>{U.d(Z,{AnnotationEditorUIManager:()=>u,ColorManager:()=>l,KeyboardManager:()=>v,bindEvents:()=>C,opacityToHex:()=>N});var A=U(266),V=U(473);function C(g,r,p){for(const e of p)r.addEventListener(e,g[e].bind(g))}function N(g){return Math.round(Math.min(255,Math.max(1,255*g))).toString(16).padStart(2,"0")}class R{#t=0;getId(){return`${A.AnnotationEditorPrefix}${this.#t++}`}}class L{#t=(0,A.getUuid)();#e=0;#s=null;static get _isSVGFittingCanvas(){const r='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"),n=new Image;n.src=r;const c=n.decode().then(()=>
6(e.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,A.shadow)(this,"_isSVGFittingCanvas",c)}async#i(r,p){this.#s||=new Map;let e=this.#s.get(r);if(e===null)return null;if(e?.bitmap)return e.refCounter+=1,e;try{e||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let n;if(typeof p=="string"?(e.url=p,n=await(0,V.fetchData)(p,"blob")):n=e.file=p,n.type==="image/svg+xml"){const c=L._isSVGFittingCanvas,b=new FileReader,m=new Image,k=new Promise((E,P)=>{m.onload=()=>{e.bitmap=m,e.isSvg=!0,E()},b.onload=async()=>{const z=e.svgUrl=b.result;m.src=await c?`${z}#svgView(preserveAspectRatio(none))`:z},m.onerror=b.onerror=P});b.readAsDataURL(n),await k}else e.bitmap=await createImageBitmap(n);e.refCounter=1}catch(n){console.error(n),e=null}return this.#s.set(r,e),e&&this.#s.set(e.id,e),e}async getFromFile(r){const{lastModified:p,name:e,size:n,type:c}=r;return this.#i(`${p}_${e}_${n}_${c}`,r)}async getFromUrl(r){return this.#i(r,r)}async getFromId(r){this.#s||=new Map;const p=this.#s.get(r);return p?p.bitmap?(p.refCounter+=1,p):p.file?this.getFromFile(p.file):this.getFromUrl(p.url):null}getSvgUrl(r){const p=this.#s.get(r);return p?.isSvg?p.svgUrl:null}deleteId(r){this.#s||=new Map;const p=this.#s.get(r);p&&(p.refCounter-=1,p.refCounter===0&&(p.bitmap=null))}isValidId(r){return r.startsWith(`image_${this.#t}_`)}}class w{#t=[];#e=!1;#s;#i=-1;constructor(r=128){this.#s=r}add({cmd:r,undo:p,mustExec:e,type:n=NaN,overwriteIfSameType:c=!1,keepUndo:b=!1}){if(e&&r(),this.#e)return;const m={cmd:r,undo:p,type:n};if(this.#i===-1){this.#t.length>0&&(this.#t.length=0),this.#i=0,this.#t.push(m);return}if(c&&this.#t[this.#i].type===n){b&&(m.undo=this.#t[this.#i].undo),this.#t[this.#i]=m;return}const k=this.#i+1;k===this.#s?this.#t.splice(0,1):(this.#i=k,k<this.#t.length&&this.#t.splice(k)),this.#t.push(m)}undo(){this.#i!==-1&&(this.#e=!0,this.#t[this.#i].undo(),this.#e=!1,this.#i-=1)}redo(){this.#i<this.#t.length-1&&(this.#i+=1,this.#e=!0,this.#t[this.#i].cmd(),this.#e=!1)}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#t.length-1}destroy(){this.#t=null}}class v{constructor(r){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:p}=A.FeatureTest.platform;for(const[e,n,c={}]of r)for(const b of e){const m=b.startsWith("mac+");p&&m?(this.callbacks.set(b.slice(4),{callback:n,options:c}),this.allKeys.add(b.split("+").at(-1))):!p&&!m&&(this.callbacks.set(b,{callback:n,options:c}),this.allKeys.add(b.split("+").at(-1)))}}#t(r){r.altKey&&this.buffer.push("alt"),r.ctrlKey&&this.buffer.push("ctrl"),r.metaKey&&this.buffer.push("meta"),r.shiftKey&&this.buffer.push("shift"),this.buffer.push(r.key);const p=this.buffer.join("+");return this.buffer.length=0,p}exec(r,p){if(!this.allKeys.has(p.key))return;const e=this.callbacks.get(this.#t(p));if(!e)return;const{callback:n,options:{bubbles:c=!1,args:b=[],checker:m=null}}=e;m&&!m(r,p)||(n.bind(r,...b,p)(),c||(p.stopPropagation(),p.preventDefault()))}}class l{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const r=new Map([["CanvasText",null],["Canvas",null]]);return(0,V.getColorValues)(r),(0,A.shadow)(this,"_colors",r)}convert(r){const p=(0,V.getRGB)(r);if(!window.matchMedia("(forced-colors: active)").matches)return p;for(const[e,n]of this._colors)if(n.every((c,b)=>c===p[b]))return l._colorsMapping.get(e);return p}getHexCode(r){const p=this._colors.get(r);return p?A.Util.makeHexColor(...p):r}}class u{#t=null;#e=new Map;#s=new Map;#i=null;#n=null;#r=new w;#o=0;#l=new Set;#h=null;#c=null;#f=new Set;#u=null;#d=null;#a=null;#p=new R;#m=!1;#b=!1;#A=null;#y=null;#v=A.AnnotationEditorType.NONE;#g=new Set;#C=null;#L=this.blur.bind(this);#M=this.focus.bind(this);#I=this.copy.bind(this);#N=this.cut.bind(this);#_=this.paste.bind(this);#w=this.keydown.bind(this);#D=this.onEditingAction.bind(this);#E=this.onPageChanging.bind(this);#S=this.onScaleChanging.bind(this);#P=this.onRotationChanging.bind(this);#H={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#T=[0,0];#F=null;#k=null;#B=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const r=u.prototype,p=b=>b.#k.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&b.hasSomethingToControl(),e=(b,{target:m})=>
6{if(m instanceof HTMLInputElement){const{type:k}=m;return k!=="text"&&k!=="number"}return!0},n=this.TRANSLATE_SMALL,c=this.TRANSLATE_BIG;return(0,A.shadow)(this,"_keyboardManager",new v([[["ctrl+a","mac+meta+a"],r.selectAll,{checker:e}],[["ctrl+z","mac+meta+z"],r.undo,{checker:e}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],r.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"],r.delete,{checker:e}],[["Enter","mac+Enter"],r.addNewEditorFromKeyboard,{checker:(b,{target:m})=>!(m instanceof HTMLButtonElement)&&b.#k.contains(m)&&!b.isEnterHandled}],[[" ","mac+ "],r.addNewEditorFromKeyboard,{checker:b=>b.#k.contains(document.activeElement)}],[["Escape","mac+Escape"],r.unselectAll],[["ArrowLeft","mac+ArrowLeft"],r.translateSelectedEditors,{args:[-n,0],checker:p}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],r.translateSelectedEditors,{args:[-c,0],checker:p}],[["ArrowRight","mac+ArrowRight"],r.translateSelectedEditors,{args:[n,0],checker:p}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],r.translateSelectedEditors,{args:[c,0],checker:p}],[["ArrowUp","mac+ArrowUp"],r.translateSelectedEditors,{args:[0,-n],checker:p}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],r.translateSelectedEditors,{args:[0,-c],checker:p}],[["ArrowDown","mac+ArrowDown"],r.translateSelectedEditors,{args:[0,n],checker:p}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],r.translateSelectedEditors,{args:[0,c],checker:p}]]))}constructor(r,p,e,n,c,b,m){this.#k=r,this.#B=p,this.#i=e,this._eventBus=n,this._eventBus._on("editingaction",this.#D),this._eventBus._on("pagechanging",this.#E),this._eventBus._on("scalechanging",this.#S),this._eventBus._on("rotationchanging",this.#P),this.#n=c.annotationStorage,this.#u=c.filterFactory,this.#C=b,this.#a=m||null,this.viewParameters={realScale:V.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#R(),this.#z(),this._eventBus._off("editingaction",this.#D),this._eventBus._off("pagechanging",this.#E),this._eventBus._off("scalechanging",this.#S),this._eventBus._off("rotationchanging",this.#P);for(const r of this.#s.values())r.destroy();this.#s.clear(),this.#e.clear(),this.#f.clear(),this.#t=null,this.#g.clear(),this.#r.destroy(),this.#i?.destroy(),this.#d&&(clearTimeout(this.#d),this.#d=null),this.#F&&(clearTimeout(this.#F),this.#F=null)}get hcmFilter(){return(0,A.shadow)(this,"hcmFilter",this.#C?this.#u.addHCMFilter(this.#C.foreground,this.#C.background):"none")}get direction(){return(0,A.shadow)(this,"direction",getComputedStyle(this.#k).direction)}get highlightColors(){return(0,A.shadow)(this,"highlightColors",this.#a?new Map(this.#a.split(",").map(r=>r.split("=").map(p=>p.trim()))):null)}setMainHighlightColorPicker(r){this.#y=r}editAltText(r){this.#i?.editAltText(this,r)}onPageChanging({pageNumber:r}){this.#o=r-1}focusMainContainer(){this.#k.focus()}findParent(r,p){for(const e of this.#s.values()){const{x:n,y:c,width:b,height:m}=e.div.getBoundingClientRect();if(r>=n&&r<=n+b&&p>=c&&p<=c+m)return e}return null}disableUserSelect(r=!1){this.#B.classList.toggle("noUserSelect",r)}addShouldRescale(r){this.#f.add(r)}removeShouldRescale(r){this.#f.delete(r)}onScaleChanging({scale:r}){this.commitOrRemove(),this.viewParameters.realScale=r*V.PixelsPerInch.PDF_TO_CSS_UNITS;for(const p of this.#f)p.onScaleChanging()}onRotationChanging({pagesRotation:r}){this.commitOrRemove(),this.viewParameters.rotation=r}addToAnnotationStorage(r){!r.isEmpty()&&this.#n&&!this.#n.has(r.id)&&this.#n.setValue(r.id,r)}#G(){window.addEventListener("focus",this.#M),window.addEventListener("blur",this.#L)}#z(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#L)}blur(){if(!this.hasSelection)return;const{activeElement:r}=document;for(const p of this.#g)if(p.div.contains(r)){this.#A=[p,r],p._focusEventsAllowed=!1;break}}focus(){if(!this.#A)return;const[r,p]=this.#A;this.#A=null,p.addEventListener("focusin",()=>{r._focusEventsAllowed=!0},{once:!0}),p.focus()}#O(){window.addEventListener("keydown",this.#w)}#R(){window.removeEventListener("keydown",this.#w)}#X(){document.addEventListener("copy",this.#I),document.addEventListener("cut",this.#N
6),document.addEventListener("paste",this.#_)}#$(){document.removeEventListener("copy",this.#I),document.removeEventListener("cut",this.#N),document.removeEventListener("paste",this.#_)}addEditListeners(){this.#O(),this.#X()}removeEditListeners(){this.#R(),this.#$()}copy(r){if(r.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const p=[];for(const e of this.#g){const n=e.serialize(!0);n&&p.push(n)}p.length!==0&&r.clipboardData.setData("application/pdfjs",JSON.stringify(p))}cut(r){this.copy(r),this.delete()}paste(r){r.preventDefault();const{clipboardData:p}=r;for(const c of p.items)for(const b of this.#c)if(b.isHandlingMimeForPasting(c.type)){b.paste(c,this.currentLayer);return}let e=p.getData("application/pdfjs");if(!e)return;try{e=JSON.parse(e)}catch(c){(0,A.warn)(`paste: "${c.message}".`);return}if(!Array.isArray(e))return;this.unselectAll();const n=this.currentLayer;try{const c=[];for(const k of e){const E=n.deserialize(k);if(!E)return;c.push(E)}const b=()=>{for(const k of c)this.#Y(k);this.#j(c)},m=()=>{for(const k of c)k.remove()};this.addCommands({cmd:b,undo:m,mustExec:!0})}catch(c){(0,A.warn)(`paste: "${c.message}".`)}}keydown(r){this.isEditorHandlingKeyboard||u._keyboardManager.exec(this,r)}onEditingAction(r){["undo","redo","delete","selectAll"].includes(r.name)&&this[r.name]()}#x(r){Object.entries(r).some(([e,n])=>this.#H[e]!==n)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#H,r)})}#V(r){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:r})}setEditingState(r){r?(this.#G(),this.#O(),this.#X(),this.#x({isEditing:this.#v!==A.AnnotationEditorType.NONE,isEmpty:this.#U(),hasSomethingToUndo:this.#r.hasSomethingToUndo(),hasSomethingToRedo:this.#r.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#z(),this.#R(),this.#$(),this.#x({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(r){if(!this.#c){this.#c=r;for(const p of this.#c)this.#V(p.defaultPropertiesToUpdate)}}getId(){return this.#p.getId()}get currentLayer(){return this.#s.get(this.#o)}getLayer(r){return this.#s.get(r)}get currentPageIndex(){return this.#o}addLayer(r){this.#s.set(r.pageIndex,r),this.#m?r.enable():r.disable()}removeLayer(r){this.#s.delete(r.pageIndex)}updateMode(r,p=null,e=!1){if(this.#v!==r){if(this.#v=r,r===A.AnnotationEditorType.NONE){this.setEditingState(!1),this.#W();return}this.setEditingState(!0),this.#q(),this.unselectAll();for(const n of this.#s.values())n.updateMode(r);if(!p&&e){this.addNewEditorFromKeyboard();return}if(p){for(const n of this.#e.values())if(n.annotationElementId===p){this.setSelected(n),n.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(r){r!==this.#v&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:r})}updateParams(r,p){if(this.#c){switch(r){case A.AnnotationEditorParamsType.CREATE:this.currentLayer.addNewEditor();return;case A.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:this.#y?.updateColor(p);break}for(const e of this.#g)e.updateParams(r,p);for(const e of this.#c)e.updateDefaultParams(r,p)}}enableWaiting(r=!1){if(this.#b!==r){this.#b=r;for(const p of this.#s.values())r?p.disableClick():p.enableClick(),p.div.classList.toggle("waiting",r)}}#q(){if(!this.#m){this.#m=!0;for(const r of this.#s.values())r.enable()}}#W(){if(this.unselectAll(),this.#m){this.#m=!1;for(const r of this.#s.values())r.disable()}}getEditors(r){const p=[];for(const e of this.#e.values())e.pageIndex===r&&p.push(e);return p}getEditor(r){return this.#e.get(r)}addEditor(r){this.#e.set(r.id,r)}removeEditor(r){r.div.contains(document.activeElement)&&(this.#d&&clearTimeout(this.#d),this.#d=setTimeout(()=>{this.focusMainContainer(),this.#d=null},0)),this.#e.delete(r.id),this.unselect(r),(!r.annotationElementId||!this.#l.has(r.annotationElementId))&&this.#n?.remove(r.id)}addDeletedAnnotationElement(r){this.#l.add(r.annotationElementId),r.deleted=!0}isDeletedAnnotationElement(r){return this.#l.has(r)}removeDeletedAnnotationElement(r){this.#l.delete(r.annotationElementId),r.deleted=!1}#Y(r){const p=this.#s.get(r.pageIndex);p?p.addOrRebuild(r):this.addEditor(r)}setActiveEditor(r){this.#t!==r&&(this.#t=r,r&&this.#V(r.propertiesToUpdate))}toggleSelected(r){if(this.#g.has(r)){this.#g.delete(r),r.unselect(),this.#x({hasSelectedEditor:this.hasSelection});return}this.#g.add(r),r.select(),this.#V(r.propertiesToUpdate),this.#x({hasSelectedEditor:!0})}setSelected(r){for(const p of this.#g)p!==r&&p.unselect();this.#g.clear(),this.#g.add(r),r.select(),this.#V(r.propertiesToUpdate),this.#x({hasSelectedEditor:!0})}isSelected(r){return this.#g.has(r)}get firstSelectedEditor(){return this.#g.values().next().value}unselect(r){r.unselect(),this.#g.delete(r),this.#x({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#g.size!==0}get isEnterHandled(){return this.#g.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#r.undo(),this.#x({hasSomethingToUndo:this.#r.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#U()})}redo(){this.#r.redo(),this.#x({hasSomethingToUndo:!0,hasSomethingToRedo:this.#r.hasSomethingToRedo(),isEmpty:this.#U()})}addCommands(r){this.#r.add(r),this.#x({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#U()})}#U(){if(this.#e.size===0)return!0;
6if(this.#e.size===1)for(const r of this.#e.values())return r.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const r=[...this.#g],p=()=>{for(const n of r)n.remove()},e=()=>{for(const n of r)this.#Y(n)};this.addCommands({cmd:p,undo:e,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#j(r){this.#g.clear();for(const p of r)p.isEmpty()||(this.#g.add(p),p.select());this.#x({hasSelectedEditor:!0})}selectAll(){for(const r of this.#g)r.commit();this.#j(this.#e.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#v!==A.AnnotationEditorType.NONE))&&this.hasSelection){for(const r of this.#g)r.unselect();this.#g.clear(),this.#x({hasSelectedEditor:!1})}}translateSelectedEditors(r,p,e=!1){if(e||this.commitOrRemove(),!this.hasSelection)return;this.#T[0]+=r,this.#T[1]+=p;const[n,c]=this.#T,b=[...this.#g],m=1e3;this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#T[0]=this.#T[1]=0,this.addCommands({cmd:()=>{for(const k of b)this.#e.has(k.id)&&k.translateInPage(n,c)},undo:()=>{for(const k of b)this.#e.has(k.id)&&k.translateInPage(-n,-c)},mustExec:!1})},m);for(const k of b)k.translateInPage(r,p)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(const r of this.#g)this.#h.set(r,{savedX:r.x,savedY:r.y,savedPageIndex:r.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);const r=this.#h;this.#h=null;let p=!1;for(const[{x:n,y:c,pageIndex:b},m]of r)m.newX=n,m.newY=c,m.newPageIndex=b,p||=n!==m.savedX||c!==m.savedY||b!==m.savedPageIndex;if(!p)return!1;const e=(n,c,b,m)=>{if(this.#e.has(n.id)){const k=this.#s.get(m);k?n._setParentAndPosition(k,c,b):(n.pageIndex=m,n.x=c,n.y=b)}};return this.addCommands({cmd:()=>{for(const[n,{newX:c,newY:b,newPageIndex:m}]of r)e(n,c,b,m)},undo:()=>{for(const[n,{savedX:c,savedY:b,savedPageIndex:m}]of r)e(n,c,b,m)},mustExec:!0}),!0}dragSelectedEditors(r,p){if(this.#h)for(const e of this.#h.keys())e.drag(r,p)}rebuild(r){if(r.parent===null){const p=this.getLayer(r.pageIndex);p?(p.changeParent(r),p.addOrRebuild(r)):(this.addEditor(r),this.addToAnnotationStorage(r),r.rebuild())}else r.parent.addOrRebuild(r)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#g.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(r){return this.#t===r}getActive(){return this.#t}getMode(){return this.#v}get imageManager(){return(0,A.shadow)(this,"imageManager",new L)}}},171:(ut,Z,U)=>{U.d(Z,{PDFFetchStream:()=>L});var A=U(266),V=U(253);function C(l,u,g){return{method:"GET",headers:l,signal:g.signal,mode:"cors",credentials:u?"include":"same-origin",redirect:"follow"}}function N(l){const u=new Headers;for(const g in l){const r=l[g];r!==void 0&&u.append(g,r)}return u}function R(l){return l instanceof Uint8Array?l.buffer:l instanceof ArrayBuffer?l:((0,A.warn)(`getArrayBuffer - unexpected data format: ${l}`),new Uint8Array(l).buffer)}class L{constructor(u){this.source=u,this.isHttp=/^https?:/i.test(u.url),this.httpHeaders=this.isHttp&&u.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new w(this),this._fullRequestReader}getRangeReader(u,g){if(g<=this._progressiveDataLength)return null;const r=new v(this,u,g);return this._rangeRequestReaders.push(r),r}cancelAllRequests(u){this._fullRequestReader?.cancel(u);for(const g of this._rangeRequestReaders.slice(0))g.cancel(u)}}class w{constructor(u){this._stream=u,this._reader=null,this._loaded=0,this._filename=null;const g=u.source;this._withCredentials=g.withCredentials||!1,this._contentLength=g.length,this._headersCapability=new A.PromiseCapability,this._disableRange=g.disableRange||!1,this._rangeChunkSize=g.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!g.disableStream,this._isRangeSupported=!g.disableRange,this._headers=N(this._stream.httpHeaders);const r=g.url;fetch(r,C(this._headers,this._withCredentials,this._abortController)).then(p=>{if(!(0,V.validateResponseStatus)(p.status))throw(0,V.createResponseStatusError)(p.status,r);this._reader=p.body.getReader(),this._headersCapability.resolve();const e=b=>p.headers.get(b),{allowRangeRequests:n,suggestedLength:c}=(0,V.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=c||this._contentLength,this._filename=(0,V.extractFilenameFromHeader)(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new A.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:u,done:g}=await this._reader.read();return g?{value:u,done:g}:(this._loaded+=u.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:R(u),done:!1})}cancel(u){this._reader?.cancel(u),this._abortController.abort()}}class v{constructor(u,g,r){this._stream=u,this._reader=null,this._loaded=0;const p=u.source;this._withCredentials=p.withCredentials||!1,this._readCapability=new A.PromiseCapability,this._isStreamingSupported=!p.disableStream,this._abortController=new AbortController,this._headers=N(this._stream.httpHeaders),this._headers.append("Range",`bytes=${g}-${r-1}`);const e=p.url;fetch(e,C(this._headers,this._withCredentials,this._abortController)).then(n=>{if(!(0,V.validateResponseStatus)(n.status))throw(0,V.createResponseStatusError)(n.status,e);this._readCapability.resolve(),this._reader=n.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:u,done:g}=await this._reader.read();return g?{value:u,done:g}:(this._loaded+=u.byteLength,this.onProgress?.({loaded:this._loaded}),{value:R(u),done:!1})}cancel(u){this._reader?.cancel(u),this._abortController.abort()}}},742:(ut,Z,U)=>{U.d(Z,{FontFaceObject:()=>C,FontLoader:()=>V});var A=U(266);class V{#t=new Set;constructor({ownerDocument:R=globalThis.document,styleElement:L=null}){this._document=R,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(R){this.nativeFontFaces.add(R),this._document.fonts.add(R)}removeNativeFontFace(R){this.nativeFontFaces.delete(R),this._document.fonts.delete(R)}insertRule(R){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const L=this.styleElement.sheet;L.insertRule(R,L.cssRules.length)}clear(){for(const R of this.nativeFontFaces)this._document.fonts.delete(R);this.nativeFontFaces.clear(),this.#t.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:R,_inspectFont:L}
6){if(!(!R||this.#t.has(R.loadedName))){if((0,A.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:w,src:v,style:l}=R,u=new FontFace(w,v,l);this.addNativeFontFace(u);try{await u.load(),this.#t.add(w),L?.(R)}catch{(0,A.warn)(`Cannot load system font: ${R.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(u)}return}(0,A.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(R){if(R.attached||R.missingFile&&!R.systemFontInfo)return;if(R.attached=!0,R.systemFontInfo){await this.loadSystemFont(R);return}if(this.isFontLoadingAPISupported){const w=R.createNativeFontFace();if(w){this.addNativeFontFace(w);try{await w.loaded}catch(v){throw(0,A.warn)(`Failed to load font '${w.family}': '${v}'.`),R.disableFontFace=!0,v}}return}const L=R.createFontFaceRule();if(L){if(this.insertRule(L),this.isSyncFontLoadingSupported)return;await new Promise(w=>{const v=this._queueLoadingCallback(w);this._prepareFontLoadEvent(R,v)})}}get isFontLoadingAPISupported(){const R=!!this._document?.fonts;return(0,A.shadow)(this,"isFontLoadingAPISupported",R)}get isSyncFontLoadingSupported(){let R=!1;return(A.isNodeJS||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(R=!0),(0,A.shadow)(this,"isSyncFontLoadingSupported",R)}_queueLoadingCallback(R){function L(){for((0,A.assert)(!v.done,"completeRequest() cannot be called twice."),v.done=!0;w.length>0&&w[0].done;){const l=w.shift();setTimeout(l.callback,0)}}const{loadingRequests:w}=this,v={done:!1,complete:L,callback:R};return w.push(v),v}get _loadTestFont(){const R=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,A.shadow)(this,"_loadTestFont",R)}_prepareFontLoadEvent(R,L){function w(X,Y){return X.charCodeAt(Y)<<24|X.charCodeAt(Y+1)<<16|X.charCodeAt(Y+2)<<8|X.charCodeAt(Y+3)&255}function v(X,Y,tt,rt){const j=X.substring(0,Y),_=X.substring(Y+tt);return j+rt+_}let l,u;const g=this._document.createElement("canvas");g.width=1,g.height=1;const r=g.getContext("2d");let p=0;function e(X,Y){if(++p>30){(0,A.warn)("Load test font never loaded."),Y();return}if(r.font="30px "+X,r.fillText(".",0,20),r.getImageData(0,0,1,1).data[3]>0){Y();return}setTimeout(e.bind(null,X,Y))}const n=`lt${Date.now()}${this.loadTestFontId++}`;let c=this._loadTestFont;c=v(c,976,n.length,n);const m=16,k=1482184792;let E=w(c,m);for(l=0,u=n.length-3;l<u;l+=4)E=E-k+w(n,l)|0;l<n.length&&(E=E-k+w(n+"XXX",l)|0),c=v(c,m,4,(0,A.string32)(E));const P=`url(data:font/opentype;base64,${btoa(c)});`,z=`@font-face {font-family:"${n}";src:${P}}`;this.insertRule(z);const B=this._document.createElement("div");B.style.visibility="hidden",B.style.width=B.style.height="10px",B.style.position="absolute",B.style.top=B.style.left="0px";for(const X of[R.loadedName,n]){const Y=this._document.createElement("span");Y.textContent="Hi",Y.style.fontFamily=X,B.append(Y)}this._document.body.append(B),e(n,()=>{B.remove(),L.complete()})}}class C{constructor(R,{isEvalSupported:L=!0,disableFontFace:w=!1,ignoreErrors:v=!1,inspectFont:l=null}){this.compiledGlyphs=Object.create(null);for(const u in R)this[u]=R[u];this.isEvalSupported=L!==!1,this.disableFontFace=w===!0,this.ignoreErrors=v===!0,this._inspectFont=l}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let R;if(!this.cssFontInfo)R=new FontFace(this.loadedName,this.data,{});else{const L={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(L.style=`oblique ${this.cssFontInfo.italicAngle}deg`),R=new FontFace(this.cssFontInfo.fontFamily,this.data,L)}return this._inspectFont?.(this),R}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const R=(0,A.bytesToString)(this.data),L=`url(data:${this.mimetype};base64,${btoa(R)});`;let w;if(!this.cssFontInfo)w=`@font-face {font-family:"${this.loadedName}";src:${L}}`;else{let v=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(v+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),w=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${v}src:${L}}`}return this._inspectFont?.(this,L),w}getPathGenerator(R,L){if(this.compiledGlyphs[L]!==void 0)return this.compiledGlyphs[L];let w;try{w=R.get(this.loadedName+"_path_"+L)}catch(v){if(!this.ignoreErrors)throw v;
6return(0,A.warn)(`getPathGenerator - ignoring character: "${v}".`),this.compiledGlyphs[L]=function(l,u){}}if(this.isEvalSupported&&A.FeatureTest.isEvalSupported){const v=[];for(const l of w){const u=l.args!==void 0?l.args.join(","):"";v.push("c.",l.cmd,"(",u,`);
7`)}return this.compiledGlyphs[L]=new Function("c","size",v.join(""))}return this.compiledGlyphs[L]=function(v,l){for(const u of w)u.cmd==="scale"&&(u.args=[l,-l]),v[u.cmd].apply(v,u.args)}}}},472:(ut,Z,U)=>{U.d(Z,{Metadata:()=>V});var A=U(266);class V{#t;#e;constructor({parsedData:N,rawData:R}){this.#t=N,this.#e=R}getRaw(){return this.#e}get(N){return this.#t.get(N)??null}getAll(){return(0,A.objectFromMap)(this.#t)}has(N){return this.#t.has(N)}}},474:(ut,Z,U)=>{U.d(Z,{PDFNetworkStream:()=>w});var A=U(266),V=U(253);const C=200,N=206;function R(u){const g=u.response;return typeof g!="string"?g:(0,A.stringToBytes)(g).buffer}class L{constructor(g,r={}){this.url=g,this.isHttp=/^https?:/i.test(g),this.httpHeaders=this.isHttp&&r.httpHeaders||Object.create(null),this.withCredentials=r.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(g,r,p){const e={begin:g,end:r};for(const n in p)e[n]=p[n];return this.request(e)}requestFull(g){return this.request(g)}request(g){const r=new XMLHttpRequest,p=this.currXhrId++,e=this.pendingRequests[p]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const n in this.httpHeaders){const c=this.httpHeaders[n];c!==void 0&&r.setRequestHeader(n,c)}return this.isHttp&&"begin"in g&&"end"in g?(r.setRequestHeader("Range",`bytes=${g.begin}-${g.end-1}`),e.expectedStatus=N):e.expectedStatus=C,r.responseType="arraybuffer",g.onError&&(r.onerror=function(n){g.onError(r.status)}),r.onreadystatechange=this.onStateChange.bind(this,p),r.onprogress=this.onProgress.bind(this,p),e.onHeadersReceived=g.onHeadersReceived,e.onDone=g.onDone,e.onError=g.onError,e.onProgress=g.onProgress,r.send(null),p}onProgress(g,r){const p=this.pendingRequests[g];p&&p.onProgress?.(r)}onStateChange(g,r){const p=this.pendingRequests[g];if(!p)return;const e=p.xhr;if(e.readyState>=2&&p.onHeadersReceived&&(p.onHeadersReceived(),delete p.onHeadersReceived),e.readyState!==4||!(g in this.pendingRequests))return;if(delete this.pendingRequests[g],e.status===0&&this.isHttp){p.onError?.(e.status);return}const n=e.status||C;if(!(n===C&&p.expectedStatus===N)&&n!==p.expectedStatus){p.onError?.(e.status);return}const b=R(e);if(n===N){const m=e.getResponseHeader("Content-Range"),k=/bytes (\d+)-(\d+)\/(\d+)/.exec(m);p.onDone({begin:parseInt(k[1],10),chunk:b})}else b?p.onDone({begin:0,chunk:b}):p.onError?.(e.status)}getRequestXhr(g){return this.pendingRequests[g].xhr}isPendingRequest(g){return g in this.pendingRequests}abortRequest(g){const r=this.pendingRequests[g].xhr;delete this.pendingRequests[g],r.abort()}}class w{constructor(g){this._source=g,this._manager=new L(g.url,{httpHeaders:g.httpHeaders,withCredentials:g.withCredentials}),this._rangeChunkSize=g.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(g){const r=this._rangeRequestReaders.indexOf(g);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new v(this._manager,this._source),this._fullRequestReader}getRangeReader(g,r){const p=new l(this._manager,g,r);return p.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(p),p}cancelAllRequests(g){this._fullRequestReader?.cancel(g);for(const r of this._rangeRequestReaders.slice(0))r.cancel(g)}}class v{constructor(g,r){this._manager=g;const p={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url,this._fullRequestId=g.requestFull(p),this._headersReceivedCapability=new A.PromiseCapability,this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const g=this._fullRequestId,r=this._manager.getRequestXhr(g),p=c=>r.getResponseHeader(c),{allowRangeRequests:e,suggestedLength:n}=(0,V.validateRangeRequestCapabilities)({getResponseHeader:p,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});e&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=(0,V.extractFilenameFromHeader)(p),this._isRangeSupported&&this._manager.abortRequest
7(g),this._headersReceivedCapability.resolve()}_onDone(g){if(g&&(this._requests.length>0?this._requests.shift().resolve({value:g.chunk,done:!1}):this._cachedChunks.push(g.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(g){this._storedError=(0,V.createResponseStatusError)(g,this._url),this._headersReceivedCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(g){this.onProgress?.({loaded:g.loaded,total:g.lengthComputable?g.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const g=new A.PromiseCapability;return this._requests.push(g),g.promise}cancel(g){this._done=!0,this._headersReceivedCapability.reject(g);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class l{constructor(g,r,p){this._manager=g;const e={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=g.url,this._requestId=g.requestRange(r,p,e),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(g){const r=g.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const p of this._requests)p.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(g){this._storedError=(0,V.createResponseStatusError)(g,this._url);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(g){this.isStreamingSupported||this.onProgress?.({loaded:g.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const g=new A.PromiseCapability;return this._requests.push(g),g.promise}cancel(g){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},253:(ut,Z,U)=>{U.d(Z,{createResponseStatusError:()=>L,extractFilenameFromHeader:()=>R,validateRangeRequestCapabilities:()=>N,validateResponseStatus:()=>w});var A=U(266);function V(v){let l=!0,u=g("filename\\*","i").exec(v);if(u){u=u[1];let m=n(u);return m=unescape(m),m=c(m),m=b(m),p(m)}if(u=e(v),u){const m=b(u);return p(m)}if(u=g("filename","i").exec(v),u){u=u[1];let m=n(u);return m=b(m),p(m)}function g(m,k){return new RegExp("(?:^|;)\\s*"+m+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',k)}function r(m,k){if(m){if(!/^[\x00-\xFF]+$/.test(k))return k;try{const E=new TextDecoder(m,{fatal:!0}),P=(0,A.stringToBytes)(k);k=E.decode(P),l=!1}catch{}}return k}function p(m){return l&&/[\x80-\xff]/.test(m)&&(m=r("utf-8",m),l&&(m=r("iso-8859-1",m))),m}function e(m){const k=[];let E;const P=g("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(E=P.exec(m))!==null;){let[,B,X,Y]=E;if(B=parseInt(B,10),B in k){if(B===0)break;continue}k[B]=[X,Y]}const z=[];for(let B=0;B<k.length&&B in k;++B){let[X,Y]=k[B];Y=n(Y),X&&(Y=unescape(Y),B===0&&(Y=c(Y))),z.push(Y)}return z.join("")}function n(m){if(m.startsWith('"')){const k=m.slice(1).split('\\"');for(let E=0;E<k.length;++E){const P=k[E].indexOf('"');P!==-1&&(k[E]=k[E].slice(0,P),k.length=E+1),k[E]=k[E].replaceAll(/\\(.)/g,"$1")}m=k.join('"')}return m}function c(m){const k=m.indexOf("'");if(k===-1)return m;const E=m.slice(0,k),z=m.slice(k+1).replace(/^[^']*'/,"");return r(E,z)}function b(m){return!m.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(m)?m:m.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(k,E,P,z){if(P==="q"||P==="Q")return z=z.replaceAll("_"," "),z=z.replaceAll(/=([0-9a-fA-F]{2})/g,function(B,X){return String.fromCharCode(parseInt(X,16))}),r(E,z);try{z=atob(z)}catch{}return r(E,z)}
7)}return""}var C=U(473);function N({getResponseHeader:v,isHttp:l,rangeChunkSize:u,disableRange:g}){const r={allowRangeRequests:!1,suggestedLength:void 0},p=parseInt(v("Content-Length"),10);return!Number.isInteger(p)||(r.suggestedLength=p,p<=2*u)||g||!l||v("Accept-Ranges")!=="bytes"||(v("Content-Encoding")||"identity")!=="identity"||(r.allowRangeRequests=!0),r}function R(v){const l=v("Content-Disposition");if(l){let u=V(l);if(u.includes("%"))try{u=decodeURIComponent(u)}catch{}if((0,C.isPdfFile)(u))return u}return null}function L(v,l){return v===404||v===0&&l.startsWith("file:")?new A.MissingPDFException('Missing PDF "'+l+'".'):new A.UnexpectedResponseException(`Unexpected server response (${v}) while retrieving PDF "${l}".`,v)}function w(v){return v===200||v===206}},498:(ut,Z,U)=>{U.a(ut,async(A,V)=>{try{let u=function(k){const E=v.parse(k);return E.protocol==="file:"||E.host?E:/^[a-z]:[/\\]/i.test(k)?v.parse(`file:///${k}`):(E.host||(E.protocol="file:"),E)},e=function(k,E){return{protocol:k.protocol,auth:k.auth,host:k.hostname,port:k.port,path:k.path,method:"GET",headers:E}};U.d(Z,{PDFNodeStream:()=>g});
7var C=U(266),N=U(253);let R,L,w,v;C.isNodeJS&&(R=await Lt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),L=await Lt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),w=await Lt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]),v=await Lt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]));const l=/^file:\/\/\/[a-zA-Z]:\//;class g{constructor(E){this.source=E,this.url=u(E.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&E.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,C.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new b(this):new n(this),this._fullRequestReader}getRangeReader(E,P){if(P<=this._progressiveDataLength)return null;const z=this.isFsUrl?new m(this,E,P):new c(this,E,P);return this._rangeRequestReaders.push(z),z}cancelAllRequests(E){this._fullRequestReader?.cancel(E);for(const P of this._rangeRequestReaders.slice(0))P.cancel(E)}}
7class r{constructor(E){this._url=E.url,this._done=!1,this._storedError=null,this.onProgress=null;const P=E.source;this._contentLength=P.length,this._loaded=0,this._filename=null,this._disableRange=P.disableRange||!1,this._rangeChunkSize=P.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!P.disableStream,this._isRangeSupported=!P.disableRange,this._readableStream=null,this._readCapability=new C.PromiseCapability,this._headersCapability=new C.PromiseCapability}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const E=this._readableStream.read();return E===null?(this._readCapability=new C.PromiseCapability,this.read()):(this._loaded+=E.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(E).buffer,done:!1})}cancel(E){if(!this._readableStream){this._error(E);return}this._readableStream.destroy(E)}_error(E){this._storedError=E,this._readCapability.resolve()}_setReadableStream(E){this._readableStream=E,E.on("readable",()=>{this._readCapability.resolve()}),E.on("end",()=>{E.destroy(),this._done=!0,this._readCapability.resolve()}),E.on("error",P=>{this._error(P)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new C.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class p{constructor(E){this._url=E.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new C.PromiseCapability;const P=E.source;this._isStreamingSupported=!P.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const E=this._readableStream.read();return E===null?(this._readCapability=new C.PromiseCapability,this.read()):(this._loaded+=E.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(E).buffer,done:!1})}cancel(E){if(!this._readableStream){this._error(E);return}this._readableStream.destroy(E)}_error(E){this._storedError=E,this._readCapability.resolve()}_setReadableStream(E){this._readableStream=E,E.on("readable",()=>{this._readCapability.resolve()}),E.on("end",()=>{E.destroy(),this._done=!0,this._readCapability.resolve()}),E.on("error",P=>{this._error(P)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class n extends r{constructor(E){super(E);const P=z=>{if(z.statusCode===404){const tt=new C.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=tt,this._headersCapability.reject(tt);return}this._headersCapability.resolve(),this._setReadableStream(z);const B=tt=>this._readableStream.headers[tt.toLowerCase()],{allowRangeRequests:X,suggestedLength:Y}=(0,N.validateRangeRequestCapabilities)({getResponseHeader:B,isHttp:E.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=X,this._contentLength=Y||this._contentLength,this._filename=(0,N.extractFilenameFromHeader)(B)};this._request=null,this._url.protocol==="http:"?this._request=L.request(e(this._url,E.httpHeaders),P):this._request=w.request(e(this._url,E.httpHeaders),P),this._request.on("error",z=>{this._storedError=z,this._headersCapability.reject(z)}),this._request.end()}}class c extends p{constructor(E,P,z){super(E),this._httpHeaders={};for(const X in E.httpHeaders){const Y=E.httpHeaders[X];Y!==void 0&&(this._httpHeaders[X]=Y)}this._httpHeaders.Range=`bytes=${P}-${z-1}`;const B=X=>{if(X.statusCode===404){const Y=new C.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=Y;return}this._setReadableStream(X)};this._request=null,this._url.protocol==="http:"?this._request=L.request(e(this._url,this._httpHeaders),B):this._request=w.request(e(this._url,this._httpHeaders),B),this._request.on("error",X=>{this._storedError=X}
7),this._request.end()}}class b extends r{constructor(E){super(E);let P=decodeURIComponent(this._url.path);l.test(this._url.href)&&(P=P.replace(/^\//,"")),R.lstat(P,(z,B)=>{if(z){z.code==="ENOENT"&&(z=new C.MissingPDFException(`Missing PDF "${P}".`)),this._storedError=z,this._headersCapability.reject(z);return}this._contentLength=B.size,this._setReadableStream(R.createReadStream(P)),this._headersCapability.resolve()})}}class m extends p{constructor(E,P,z){super(E);let B=decodeURIComponent(this._url.path);l.test(this._url.href)&&(B=B.replace(/^\//,"")),this._setReadableStream(R.createReadStream(B,{start:P,end:z-1}))}}V()}catch(R){V(R)}},1)},738:(ut,Z,U)=>{U.a(ut,async(A,V)=>{try{U.d(Z,{NodeCMapReaderFactory:()=>g,NodeCanvasFactory:()=>u,NodeFilterFactory:()=>l,NodeStandardFontDataFactory:()=>r});var C=U(822),N=U(266);let R,L,w;if(N.isNodeJS){R=await Lt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]);try{L=await Lt(()=>import("./__vite-browser-external-BIHI7g3E.js"),[])}catch{}try{w=await Lt(()=>import("./path2d-polyfill.esm-Bqvoz_29.js"),[])}catch{}}const v=function(p){return new Promise((e,n)=>{R.readFile(p,(c,b)=>{if(c||!b){n(new Error(c));return}e(new Uint8Array(b))})})};class l extends C.BaseFilterFactory{}class u extends C.BaseCanvasFactory{_createCanvas(e,n){return L.createCanvas(e,n)}}class g extends C.BaseCMapReaderFactory{_fetchData(e,n){return v(e).then(c=>({cMapData:c,compressionType:n}))}}class r extends C.BaseStandardFontDataFactory{_fetchData(e){return v(e)}}V()}catch(R){V(R)}},1)},890:(ut,Z,U)=>{U.d(Z,{OptionalContentConfig:()=>R});var A=U(266),V=U(825);const C=Symbol("INTERNAL");class N{#t=!0;constructor(w,v){this.name=w,this.intent=v}get visible(){return this.#t}_setVisible(w,v){w!==C&&(0,A.unreachable)("Internal method `_setVisible` called."),this.#t=v}}class R{#t=null;#e=new Map;#s=null;#i=null;constructor(w){if(this.name=null,this.creator=null,w!==null){this.name=w.name,this.creator=w.creator,this.#i=w.order;for(const v of w.groups)this.#e.set(v.id,new N(v.name,v.intent));if(w.baseState==="OFF")for(const v of this.#e.values())v._setVisible(C,!1);for(const v of w.on)this.#e.get(v)._setVisible(C,!0);for(const v of w.off)this.#e.get(v)._setVisible(C,!1);this.#s=this.getHash()}}#n(w){const v=w.length;if(v<2)return!0;const l=w[0];for(let u=1;u<v;u++){const g=w[u];let r;if(Array.isArray(g))r=this.#n(g);else if(this.#e.has(g))r=this.#e.get(g).visible;else return(0,A.warn)(`Optional content group not found: ${g}`),!0;switch(l){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return l==="And"}isVisible(w){if(this.#e.size===0)return!0;if(!w)return(0,A.warn)("Optional content group not defined."),!0;if(w.type==="OCG")return this.#e.has(w.id)?this.#e.get(w.id).visible:((0,A.warn)(`Optional content group not found: ${w.id}`),!0);if(w.type==="OCMD"){if(w.expression)return this.#n(w.expression);if(!w.policy||w.policy==="AnyOn"){for(const v of w.ids){if(!this.#e.has(v))return(0,A.warn)(`Optional content group not found: ${v}`),!0;if(this.#e.get(v).visible)return!0}return!1}else if(w.policy==="AllOn"){for(const v of w.ids){if(!this.#e.has(v))return(0,A.warn)(`Optional content group not found: ${v}`),!0;if(!this.#e.get(v).visible)return!1}return!0}else if(w.policy==="AnyOff"){for(const v of w.ids){if(!this.#e.has(v))return(0,A.warn)(`Optional content group not found: ${v}`),!0;if(!this.#e.get(v).visible)return!0}return!1}else if(w.policy==="AllOff"){for(const v of w.ids){if(!this.#e.has(v))return(0,A.warn)(`Optional content group not found: ${v}`),!0;if(this.#e.get(v).visible)return!1}return!0}return(0,A.warn)(`Unknown optional content policy ${w.policy}.`),!0}return(0,A.warn)(`Unknown group type ${w.type}.`),!0}setVisibility(w,v=!0){if(!this.#e.has(w)){(0,A.warn)(`Optional content group not found: ${w}`);return}this.#e.get(w)._setVisible(C,!!v),this.#t=null}get hasInitialVisibility(){return this.#s===null||this.getHash()===this.#s}getOrder(){return this.#e.size?this.#i?this.#i.slice():[...this.#e.keys()]:null}getGroups(){return this.#e.size>0?(0,A.objectFromMap)(this.#e):null}getGroup(w){return this.#e.get(w)||null}getHash(){if(this.#t!==null)return this.#t;const w=new V.MurmurHash3_64;
7for(const[v,l]of this.#e)w.update(`${v}:${l.visible}`);return this.#t=w.hexdigest()}}},739:(ut,Z,U)=>{U.d(Z,{renderTextLayer:()=>p,updateTextLayer:()=>e});var A=U(266),V=U(473);const C=1e5,N=30,R=.8,L=new Map;function w(n,c){let b;if(c&&A.FeatureTest.isOffscreenCanvasSupported)b=new OffscreenCanvas(n,n).getContext("2d",{alpha:!1});else{const m=document.createElement("canvas");m.width=m.height=n,b=m.getContext("2d",{alpha:!1})}return b}function v(n,c){const b=L.get(n);if(b)return b;const m=w(N,c);m.font=`${N}px ${n}`;const k=m.measureText("");let E=k.fontBoundingBoxAscent,P=Math.abs(k.fontBoundingBoxDescent);if(E){const B=E/(E+P);return L.set(n,B),m.canvas.width=m.canvas.height=0,B}m.strokeStyle="red",m.clearRect(0,0,N,N),m.strokeText("g",0,0);let z=m.getImageData(0,0,N,N).data;P=0;for(let B=z.length-1-3;B>=0;B-=4)if(z[B]>0){P=Math.ceil(B/4/N);break}m.clearRect(0,0,N,N),m.strokeText("A",0,N),z=m.getImageData(0,0,N,N).data,E=0;for(let B=0,X=z.length;B<X;B+=4)if(z[B]>0){E=N-Math.floor(B/4/N);break}if(m.canvas.width=m.canvas.height=0,E){const B=E/(E+P);return L.set(n,B),B}return L.set(n,R),R}function l(n,c,b){const m=document.createElement("span"),k={angle:0,canvasWidth:0,hasText:c.str!=="",hasEOL:c.hasEOL,fontSize:0};n._textDivs.push(m);const E=A.Util.transform(n._transform,c.transform);let P=Math.atan2(E[1],E[0]);const z=b[c.fontName];z.vertical&&(P+=Math.PI/2);const B=n._fontInspectorEnabled&&z.fontSubstitution||z.fontFamily,X=Math.hypot(E[2],E[3]),Y=X*v(B,n._isOffscreenCanvasSupported);let tt,rt;P===0?(tt=E[4],rt=E[5]-Y):(tt=E[4]+Y*Math.sin(P),rt=E[5]-Y*Math.cos(P));const j="calc(var(--scale-factor)*",_=m.style;n._container===n._rootContainer?(_.left=`${(100*tt/n._pageWidth).toFixed(2)}%`,_.top=`${(100*rt/n._pageHeight).toFixed(2)}%`):(_.left=`${j}${tt.toFixed(2)}px)`,_.top=`${j}${rt.toFixed(2)}px)`),_.fontSize=`${j}${X.toFixed(2)}px)`,_.fontFamily=B,k.fontSize=X,m.setAttribute("role","presentation"),m.textContent=c.str,m.dir=c.dir,n._fontInspectorEnabled&&(m.dataset.fontName=z.fontSubstitutionLoadedName||c.fontName),P!==0&&(k.angle=P*(180/Math.PI));let H=!1;if(c.str.length>1)H=!0;else if(c.str!==" "&&c.transform[0]!==c.transform[3]){const q=Math.abs(c.transform[0]),Q=Math.abs(c.transform[3]);q!==Q&&Math.max(q,Q)/Math.min(q,Q)>1.5&&(H=!0)}H&&(k.canvasWidth=z.vertical?c.height:c.width),n._textDivProperties.set(m,k),n._isReadableStream&&n._layoutText(m)}function u(n){const{div:c,scale:b,properties:m,ctx:k,prevFontSize:E,prevFontFamily:P}=n,{style:z}=c;let B="";if(m.canvasWidth!==0&&m.hasText){const{fontFamily:X}=z,{canvasWidth:Y,fontSize:tt}=m;(E!==tt||P!==X)&&(k.font=`${tt*b}px ${X}`,n.prevFontSize=tt,n.prevFontFamily=X);const{width:rt}=k.measureText(c.textContent);rt>0&&(B=`scaleX(${Y*b/rt})`)}m.angle!==0&&(B=`rotate(${m.angle}deg) ${B}`),B.length>0&&(z.transform=B)}function g(n){if(n._canceled)return;const c=n._textDivs,b=n._capability;if(c.length>C){b.resolve();return}if(!n._isReadableStream)for(const k of c)n._layoutText(k);b.resolve()}class r{constructor({textContentSource:c,container:b,viewport:m,textDivs:k,textDivProperties:E,textContentItemsStr:P,isOffscreenCanvasSupported:z}){this._textContentSource=c,this._isReadableStream=c instanceof ReadableStream,this._container=this._rootContainer=b,this._textDivs=k||[],this._textContentItemsStr=P||[],this._isOffscreenCanvasSupported=z,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=E||new WeakMap,this._canceled=!1,this._capability=new A.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:m.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:w(0,z)};const{pageWidth:B,pageHeight:X,pageX:Y,pageY:tt}=m.rawDims;this._transform=[1,0,0,-1,-Y,tt+X],this._pageWidth=B,this._pageHeight=X,(0,V.setLayerDimensions)(b,m),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new A.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new A.AbortException("TextLayer task cancelled."))}_processItems(c,b){for(const m of c){if(m.str===void 0){if(m.type==="beginMarkedContentProps"||m.type==="beginMarkedContent"){const k=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),m.id!==null&&this._container.setAttribute("id",`${m.id}`),k.append(this._container)}else m.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(m.str),l(this,m,b)}}_layoutText(c){const b=this._layoutTextParams.properties=this._textDivProperties.get(c);if(this._layoutTextParams.div=c,u(this._layoutTextParams),b.hasText&&this._container.append(c),b.hasEOL){const m=d
7ocument.createElement("br");m.setAttribute("role","presentation"),this._container.append(m)}}_render(){const c=new A.PromiseCapability;let b=Object.create(null);if(this._isReadableStream){const m=()=>{this._reader.read().then(({value:k,done:E})=>{if(E){c.resolve();return}Object.assign(b,k.styles),this._processItems(k.items,b),m()},c.reject)};this._reader=this._textContentSource.getReader(),m()}else if(this._textContentSource){const{items:m,styles:k}=this._textContentSource;this._processItems(m,k),c.resolve()}else throw new Error('No "textContentSource" parameter specified.');c.promise.then(()=>{b=null,g(this)},this._capability.reject)}}function p(n){const c=new r(n);return c._render(),c}function e({container:n,viewport:c,textDivs:b,textDivProperties:m,isOffscreenCanvasSupported:k,mustRotate:E=!0,mustRescale:P=!0}){if(E&&(0,V.setLayerDimensions)(n,{rotation:c.rotation}),P){const z=w(0,k),X={prevFontSize:null,prevFontFamily:null,div:null,scale:c.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:z};for(const Y of b)X.properties=m.get(Y),X.div=Y,u(X)}}},92:(ut,Z,U)=>{U.d(Z,{PDFDataTransportStream:()=>C});var A=U(266),V=U(473);class C{constructor({length:w,initialData:v,progressiveDone:l=!1,contentDispositionFilename:u=null,disableRange:g=!1,disableStream:r=!1},p){if((0,A.assert)(p,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=l,this._contentDispositionFilename=u,v?.length>0){const e=v instanceof Uint8Array&&v.byteLength===v.buffer.byteLength?v.buffer:new Uint8Array(v).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=p,this._isStreamingSupported=!r,this._isRangeSupported=!g,this._contentLength=w,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((e,n)=>{this._onReceiveData({begin:e,chunk:n})}),this._pdfDataRangeTransport.addProgressListener((e,n)=>{this._onProgress({loaded:e,total:n})}),this._pdfDataRangeTransport.addProgressiveReadListener(e=>{this._onReceiveData({chunk:e})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:w,chunk:v}){const l=v instanceof Uint8Array&&v.byteLength===v.buffer.byteLength?v.buffer:new Uint8Array(v).buffer;if(w===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(l):this._queuedChunks.push(l);else{const u=this._rangeReaders.some(function(g){return g._begin!==w?!1:(g._enqueue(l),!0)});(0,A.assert)(u,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(w){w.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:w.loaded}):this._fullRequestReader?.onProgress?.({loaded:w.loaded,total:w.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(w){const v=this._rangeReaders.indexOf(w);v>=0&&this._rangeReaders.splice(v,1)}getFullReader(){(0,A.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const w=this._queuedChunks;return this._queuedChunks=null,new N(this,w,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(w,v){if(v<=this._progressiveDataLength)return null;const l=new R(this,w,v);return this._pdfDataRangeTransport.requestDataRange(w,v),this._rangeReaders.push(l),l}cancelAllRequests(w){this._fullRequestReader?.cancel(w);for(const v of this._rangeReaders.slice(0))v.cancel(w);this._pdfDataRangeTransport.abort()}}class N{constructor(w,v,l=!1,u=null){this._stream=w,this._done=l||!1,this._filename=(0,V.isPdfFile)(u)?u:null,this._queuedChunks=v||[],this._loaded=0;for(const g of this._queuedChunks)this._loaded+=g.byteLength;this._requests=[],this._headersReady=Promise.resolve(),w._fullRequestReader=this,this.onProgress=null}_enqueue(w){this._done||(this._requests.length>0?this._requests.shift().resolve({value:w,done:!1}):this._queuedChunks.push(w),this._loaded+=w.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const w=new A.PromiseCapability;return this._requests.push(w),w.promise}cancel(w){this._done=!0;for(const v of this._requests)v.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class R{constructor(w,v,l){this._stream=w,this._begin=v,this._end=l,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(w){if(!this._done){if(this._requests.length===0)this._queuedChunk=w;else{this._requests.shift().resolve({value:w,done:!1});for(const l of this._requests)l.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const v=this._queuedChunk;return this._queuedChunk=null,{value:v,done:!1}}if(this._done)return{value:void 0,done:!0};const w=new A.PromiseCapability;return this._requests.push(w),w.promise}cancel(w){this._done=!0;for(const v of this._requests)v.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},368:(ut,Z,U)=>{U.d(Z,{GlobalWorkerOptions:()=>A});const A=Object.create(null);A.workerPort=null,A.workerSrc=""},160:(ut,Z,U)=>{U.d(Z,{XfaLayer:()=>V});var A=U(521);class V{static setupStorage(N,R,L,w,v){const l=w.getValue(R,{value:null});switch(L.name){case"textarea":if(l.value!==null&&(N.textContent=l.value),v==="print")break;N.addEventListener("input",u=>{w.setValue(R,{value:u.target.value})});break;case"input":if(L.attributes.type==="radio"||L.attributes.type==="checkbox"){if(l.value===L.attributes.xfaOn?N.setAttribute("checked",!0):l.value===L.attributes.xfaOff&&N.removeAttribute("checked"),v==="print")break;N.addEventListener("change",u=>{w.setValue(R,{value:u.target.checked?u.target.getAttribute("xfaOn"):u.target.getAttribute("xfaOff")})})}else{if(l.value!==null&&N.setAttribute("value",l.value),v==="print")break;N.addEventListener("input",u=>{w.setValue(R,{value:u.target.value})})}break;case"select":if(l.value!==null){N.setAttribute("value",l.value);for(const u of L.children)u.attributes.value===l.value?u.attributes.selected=!0:u.attributes.hasOwnProperty("selected")&&delete u.attributes.selected}N.addEventListener("input",u=>{const g=u.target.options,r=g.selectedIndex===-1?"":g[g.selectedIndex].value;w.setValue(R,{value:r})});break}}static setAttributes({html:N,element:R,storage:L=null,intent:w,linkService:v}){const{attributes:l}=R,u=N instanceof HTMLAnchorElement;l.type==="radio"&&(l.name=`${l.name}-${w}`);for(const[g,r]of Object.entries(l))if(r!=null)switch(g){case"class":r.length&&N.setAttribute(g,r.join(" "));break;case"dataId":break;case"id":N.setAttribute("data-element-id",r);break;case"style":Object.assign(N.style,r);break;case"textContent":N.textContent=r;break;default:(!u||g!=="href"&&g!=="newWindow")&&N.setAttribute(g,r)}u&&v.addLinkAttributes(N,l.href,l.newWindow),L&&l.dataId&&this.setupStorage(N,l.dataId,R,L)}static render(N){const R=N.annotationStorage,L=N.linkService,w=N.xfaHtml,v=N.intent||"display",l=document.createElement(w.name);w.attributes&&this.setAttributes({html:l,element:w,intent:v,linkService:L});const u=v!=="richText",g=N.div;if(g.append(l),N.viewport){const e=`matrix(${N.viewport.transform.join(",")})`;g.style.transform=e}u&&g.setAttribute("class","xfaLayer xfaFont");const r=[];if(w.children.length===0){if(w.value){const e=document.createTextNode(w.value);l.append(e),u&&A.XfaText.shouldBuildText(w.name)&&r.push(e)}return{textDivs:r}}const p=[[w,-1,l]];for(;p.length>0;){const[e,n,c]=p.at(-1);if(n+1===e.children.length){p.pop();continue}const b=e.children[++p.at(-1)[1]];if(b===null)continue;const{name:m}=b;if(m==="#text"){const E=document.createTextNode(b.value);r.push(E),c.append(E);continue}const k=b?.attributes?.xmlns?document.createElementNS(b.attributes.xmlns,m):document.createElement(m);if(c.append(k),b.attributes&&this.setAttributes({html:k,element:b,storage:R,intent:v,linkService:L}),b.children?.length>0)p.push([b,-1,k]);else if(b.value){const E=document.createTextNode(b.value);u&&A.XfaText.shouldBuildText(m)&&r.push(E),k.append(E)}}for(const e of g.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:r}}static update(N){const R=`matrix(${N.viewport.transform.join(",")})`;N.div.style.transform=R,N.div.hidden=!1}}},521:(ut,Z,U)=>{U.d(Z,{XfaText:()=>A});class A{static textContent(C){const N=[],R={items:N,styles:Object.create(null)};function L(w){if(!w)return;let v=null;const l=w.name;if(l==="#text")v=w.value;else if(A.shouldBuildText(l))w?.attributes?.textContent?v=w.attributes.textContent:w.value&&(v=w.value);else return;if(v!==null&&N.push({str:v}),!!w.children)for(const u of w.children)L(u)}return L(C),R}static shouldBuildText(C){return!(C==="textarea"||C==="input"||C==="option"||C==="select")}}},907:(ut,Z,U)=>{U.a(ut,async(A,V)=>{try{U.d(Z,{AbortException:()=>C.AbortException,AnnotationEditorLayer:()=>w.AnnotationEditorLayer,AnnotationEditorParamsType:()=>C.AnnotationEditorParamsType,AnnotationEditorType:()=>C.AnnotationEditorType,AnnotationEditorUIManager:()=>v.AnnotationEditorUIManager,AnnotationLayer:()=>l.AnnotationLayer,AnnotationMode:()=>
7C.AnnotationMode,CMapCompressionType:()=>C.CMapCompressionType,ColorPicker:()=>u.ColorPicker,DOMSVGFactory:()=>R.DOMSVGFactory,DrawLayer:()=>g.DrawLayer,FeatureTest:()=>C.FeatureTest,GlobalWorkerOptions:()=>r.GlobalWorkerOptions,ImageKind:()=>C.ImageKind,InvalidPDFException:()=>C.InvalidPDFException,MissingPDFException:()=>C.MissingPDFException,OPS:()=>C.OPS,Outliner:()=>p.Outliner,PDFDataRangeTransport:()=>N.PDFDataRangeTransport,PDFDateString:()=>R.PDFDateString,PDFWorker:()=>N.PDFWorker,PasswordResponses:()=>C.PasswordResponses,PermissionFlag:()=>C.PermissionFlag,PixelsPerInch:()=>R.PixelsPerInch,PromiseCapability:()=>C.PromiseCapability,RenderingCancelledException:()=>R.RenderingCancelledException,UnexpectedResponseException:()=>C.UnexpectedResponseException,Util:()=>C.Util,VerbosityLevel:()=>C.VerbosityLevel,XfaLayer:()=>e.XfaLayer,build:()=>N.build,createValidAbsoluteUrl:()=>C.createValidAbsoluteUrl,fetchData:()=>R.fetchData,getDocument:()=>N.getDocument,getFilenameFromUrl:()=>R.getFilenameFromUrl,getPdfFilenameFromUrl:()=>R.getPdfFilenameFromUrl,getXfaPageViewport:()=>R.getXfaPageViewport,isDataScheme:()=>R.isDataScheme,isPdfFile:()=>R.isPdfFile,noContextMenu:()=>R.noContextMenu,normalizeUnicode:()=>C.normalizeUnicode,renderTextLayer:()=>L.renderTextLayer,setLayerDimensions:()=>R.setLayerDimensions,shadow:()=>C.shadow,updateTextLayer:()=>L.updateTextLayer,version:()=>N.version});var C=U(266),N=U(406),R=U(473),L=U(739),w=U(629),v=U(812),l=U(640),u=U(97),g=U(423),r=U(368),p=U(405),e=U(160),n=A([N]);N=(n.then?(await n)():n)[0];const c="4.0.379",b="9e14d04fd";V()}catch(c){V(c)}})},694:(ut,Z,U)=>{U.d(Z,{MessageHandler:()=>R});var A=U(266);const V={UNKNOWN:0,DATA:1,ERROR:2},C={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function N(L){switch(L instanceof Error||typeof L=="object"&&L!==null||(0,A.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),L.name){case"AbortException":return new A.AbortException(L.message);case"MissingPDFException":return new A.MissingPDFException(L.message);case"PasswordException":return new A.PasswordException(L.message,L.code);case"UnexpectedResponseException":return new A.UnexpectedResponseException(L.message,L.status);case"UnknownErrorException":return new A.UnknownErrorException(L.message,L.details);default:return new A.UnknownErrorException(L.message,L.toString())}}class R{constructor(w,v,l){this.sourceName=w,this.targetName=v,this.comObj=l,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=u=>{const g=u.data;if(g.targetName!==this.sourceName)return;if(g.stream){this.#e(g);return}if(g.callback){const p=g.callbackId,e=this.callbackCapabilities[p];if(!e)throw new Error(`Cannot resolve callback ${p}`);if(delete this.callbackCapabilities[p],g.callback===V.DATA)e.resolve(g.data);else if(g.callback===V.ERROR)e.reject(N(g.reason));else throw new Error("Unexpected callback case");return}const r=this.actionHandler[g.action];if(!r)throw new Error(`Unknown action from worker: ${g.action}`);if(g.callbackId){const p=this.sourceName,e=g.sourceName;new Promise(function(n){n(r(g.data))}).then(function(n){l.postMessage({sourceName:p,targetName:e,callback:V.DATA,callbackId:g.callbackId,data:n})},function(n){l.postMessage({sourceName:p,targetName:e,callback:V.ERROR,callbackId:g.callbackId,reason:N(n)})});return}if(g.streamId){this.#t(g);return}r(g.data)},l.addEventListener("message",this._onComObjOnMessage)}on(w,v){const l=this.actionHandler;if(l[w])throw new Error(`There is already an actionName called "${w}"`);l[w]=v}send(w,v,l){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:w,data:v},l)}sendWithPromise(w,v,l){const u=this.callbackId++,g=new A.PromiseCapability;this.callbackCapabilities[u]=g;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:w,callbackId:u,data:v},l)}catch(r){g.reject(r)}return g.promise}sendWithStream(w,v,l,u){const g=this.streamId++,r=this.sourceName,p=this.targetName,e=this.comObj;return new ReadableStream({start:n=>{const c=new A.PromiseCapability;return this.streamControllers[g]={controller:n,startCall:c,pullCall:null,cancelCall:null,isClosed:!1}
7,e.postMessage({sourceName:r,targetName:p,action:w,streamId:g,data:v,desiredSize:n.desiredSize},u),c.promise},pull:n=>{const c=new A.PromiseCapability;return this.streamControllers[g].pullCall=c,e.postMessage({sourceName:r,targetName:p,stream:C.PULL,streamId:g,desiredSize:n.desiredSize}),c.promise},cancel:n=>{(0,A.assert)(n instanceof Error,"cancel must have a valid reason");const c=new A.PromiseCapability;return this.streamControllers[g].cancelCall=c,this.streamControllers[g].isClosed=!0,e.postMessage({sourceName:r,targetName:p,stream:C.CANCEL,streamId:g,reason:N(n)}),c.promise}},l)}#t(w){const v=w.streamId,l=this.sourceName,u=w.sourceName,g=this.comObj,r=this,p=this.actionHandler[w.action],e={enqueue(n,c=1,b){if(this.isCancelled)return;const m=this.desiredSize;this.desiredSize-=c,m>0&&this.desiredSize<=0&&(this.sinkCapability=new A.PromiseCapability,this.ready=this.sinkCapability.promise),g.postMessage({sourceName:l,targetName:u,stream:C.ENQUEUE,streamId:v,chunk:n},b)},close(){this.isCancelled||(this.isCancelled=!0,g.postMessage({sourceName:l,targetName:u,stream:C.CLOSE,streamId:v}),delete r.streamSinks[v])},error(n){(0,A.assert)(n instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,g.postMessage({sourceName:l,targetName:u,stream:C.ERROR,streamId:v,reason:N(n)}))},sinkCapability:new A.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:w.desiredSize,ready:null};e.sinkCapability.resolve(),e.ready=e.sinkCapability.promise,this.streamSinks[v]=e,new Promise(function(n){n(p(w.data,e))}).then(function(){g.postMessage({sourceName:l,targetName:u,stream:C.START_COMPLETE,streamId:v,success:!0})},function(n){g.postMessage({sourceName:l,targetName:u,stream:C.START_COMPLETE,streamId:v,reason:N(n)})})}#e(w){const v=w.streamId,l=this.sourceName,u=w.sourceName,g=this.comObj,r=this.streamControllers[v],p=this.streamSinks[v];switch(w.stream){case C.START_COMPLETE:w.success?r.startCall.resolve():r.startCall.reject(N(w.reason));break;case C.PULL_COMPLETE:w.success?r.pullCall.resolve():r.pullCall.reject(N(w.reason));break;case C.PULL:if(!p){g.postMessage({sourceName:l,targetName:u,stream:C.PULL_COMPLETE,streamId:v,success:!0});break}p.desiredSize<=0&&w.desiredSize>0&&p.sinkCapability.resolve(),p.desiredSize=w.desiredSize,new Promise(function(e){e(p.onPull?.())}).then(function(){g.postMessage({sourceName:l,targetName:u,stream:C.PULL_COMPLETE,streamId:v,success:!0})},function(e){g.postMessage({sourceName:l,targetName:u,stream:C.PULL_COMPLETE,streamId:v,reason:N(e)})});break;case C.ENQUEUE:if((0,A.assert)(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(w.chunk);break;case C.CLOSE:if((0,A.assert)(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#s(r,v);break;case C.ERROR:(0,A.assert)(r,"error should have stream controller"),r.controller.error(N(w.reason)),this.#s(r,v);break;case C.CANCEL_COMPLETE:w.success?r.cancelCall.resolve():r.cancelCall.reject(N(w.reason)),this.#s(r,v);break;case C.CANCEL:if(!p)break;new Promise(function(e){e(p.onCancel?.(N(w.reason)))}).then(function(){g.postMessage({sourceName:l,targetName:u,stream:C.CANCEL_COMPLETE,streamId:v,success:!0})},function(e){g.postMessage({sourceName:l,targetName:u,stream:C.CANCEL_COMPLETE,streamId:v,reason:N(e)})}),p.sinkCapability.reject(N(w.reason)),p.isCancelled=!0,delete this.streamSinks[v];break;default:throw new Error("Unexpected stream case")}}async#s(w,v){await Promise.allSettled([w.startCall?.promise,w.pullCall?.promise,w.cancelCall?.promise]),delete this.streamControllers[v]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},825:(ut,Z,U)=>{U.d(Z,{MurmurHash3_64:()=>R});var A=U(266);const V=3285377520,C=4294901760,N=65535;class R{constructor(w){this.h1=w?w&4294967295:V,this.h2=w?w&4294967295:V}update(w){let v,l;if(typeof w=="string"){v=new Uint8Array(w.length*2),l=0;for(let P=0,z=w.length;P<z;P++){const B=w.charCodeAt(P);B<=255?v[l++]=B:(v[l++]=B>>>8,v[l++]=B&255)}}else if((0,A.isArrayBuffer)(w))v=w.slice(),l=v.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const u=l>>2,g=l-u*4,r=new Uint32Array(v.buffer,0,u);let p=0,e=0,n=this.h1,c=this.h2;const b=3432918353,m=461845907,k=b&N,E=m&N;for(let P=0;P<u;P++)P&1?(p=r[P],p=p*b&C|p*k&N,p=p<<15|p>>>17,p=p*m&C|p*E&N,n^=p,n=n<<13|n>>>19,n=n*5+3864292196):(e=r[P],e=e*b&C|e*k&N,e=e<<15|e>>>17,e=e*m&C|e*E&N,c^=e,c=c<<13|c>>>19,c=c*5+3864292196);switch(p=0,g){case 3:p^=v[u*4+2]<<16;case 2:p^=v[u*4+1]<<8;case 1:p^=v[u*4],p=p*b&C|p*k&N,p=p<<15|p>>>17,p=p*m&C|p*E&N,u&1?n^=p:c^=p}this.h1=n,this.h2=c}hexdigest(){let w=this.h1,v=this.h2;return w^=v>>>1,w=w*3981806797&C|w*36045&N,v=v*4283543511&C|((v<<16|w>>>16)*2950163797&C)>>>16,w^=v>>>1,w=w*444984403&C|w*60499&N,v=v*3301882366&C|((v<<16|w>>>16)*3120437893&C)>>>16,w^=v>>>1,(w>>>0).toString(16).padStart(8,"0")+(v>>>0).toString(16).padStart(8,"0")}}},266:(ut,Z,U)=>{U.d(Z,{AbortException:()=>gt,AnnotationBorderStyleType:()=>n,AnnotationEditorParamsType:()=>u,AnnotationEditorPrefix:()=>v,AnnotationEditorType:()=>l,AnnotationMode:()=>w,AnnotationPrefix:()=>O,AnnotationType:()=>e,BaseException:()=>H,CMapCompressionType:()=>b,FONT_IDENTITY_MATRIX:()=>C,FeatureTest:()=>t,FormatError:()=>at,IDENTITY_MATRIX:()=>V,ImageKind:()=>p,InvalidPDFException:()=>K,LINE_FACTOR:()=>R,MAX_IMAGE_SIZE_TO_CACHE:()=>N,MissingPDFException:()=>ft,OPS:()=>m,PasswordException:()=>q,PasswordResponses:()=>k,PermissionFlag:()=>g,PromiseCapability:()=>y,RenderingIntentFlag:()=>L,TextRenderingMode:()=>r,UnexpectedResponseException:()=>ot,UnknownErrorException:()=>Q,Util:()=>a,VerbosityLevel:()=>c,assert:()=>tt,bytesToString:()=>ct,createValidAbsoluteUrl:()=>j,getUuid:()=>I,getVerbosityLevel:()=>z,info:()=>B,isArrayBuffer:()=>f,isNodeJS:()=>A,normalizeUnicode:()=>F,objectFromMap:()=>d,setVerbosityLevel:()=>P,shadow:()=>_,string32:()=>J,stringToBytes:()=>ht,unreachable:()=>Y,warn:()=>X});const A=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),V=[1,0,0,1,0,0],C=[.001,0,0,.001,0,0],N=1e7,R=1.35,L={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OP
7LIST:256},w={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},v="pdfjs_internal_editor_",l={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},u={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32},g={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},r={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},p={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},e={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},n={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},c={ERRORS:0,WARNINGS:1,INFOS:5},b={NONE:0,BINARY:1},m={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},k={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let E=c.WARNINGS;function P(D){Number.isInteger(D)&&(E=D)}function z(){return E}function B(D){E>=c.INFOS&&console.log(`Info: ${D}`)}function X(D){E>=c.WARNINGS&&console.log(`Warning: ${D}`)}function Y(D){throw new Error(D)}function tt(D,S){D||Y(S)}function rt(D){switch(D?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function j(D,S=null,M=null){if(!D)return null;
7try{if(M&&typeof D=="string"&&(M.addDefaultProtocol&&D.startsWith("www.")&&D.match(/\./g)?.length>=2&&(D=`http://${D}`),M.tryConvertEncoding))try{D=h(D)}catch{}const $=S?new URL(D,S):new URL(D);if(rt($))return $}catch{}return null}function _(D,S,M,$=!1){return Object.defineProperty(D,S,{value:M,enumerable:!$,configurable:!0,writable:!1}),M}const H=function(){function S(M,$){this.constructor===S&&Y("Cannot initialize BaseException."),this.message=M,this.name=$}return S.prototype=new Error,S.constructor=S,S}();class q extends H{constructor(S,M){super(S,"PasswordException"),this.code=M}}class Q extends H{constructor(S,M){super(S,"UnknownErrorException"),this.details=M}}class K extends H{constructor(S){super(S,"InvalidPDFException")}}class ft extends H{constructor(S){super(S,"MissingPDFException")}}class ot extends H{constructor(S,M){super(S,"UnexpectedResponseException"),this.status=M}}class at extends H{constructor(S){super(S,"FormatError")}}class gt extends H{constructor(S){super(S,"AbortException")}}function ct(D){(typeof D!="object"||D?.length===void 0)&&Y("Invalid argument for bytesToString");const S=D.length,M=8192;if(S<M)return String.fromCharCode.apply(null,D);const $=[];for(let G=0;G<S;G+=M){const W=Math.min(G+M,S),et=D.subarray(G,W);$.push(String.fromCharCode.apply(null,et))}return $.join("")}function ht(D){typeof D!="string"&&Y("Invalid argument for stringToBytes");const S=D.length,M=new Uint8Array(S);for(let $=0;$<S;++$)M[$]=D.charCodeAt($)&255;return M}function J(D){return String.fromCharCode(D>>24&255,D>>16&255,D>>8&255,D&255)}function d(D){const S=Object.create(null);for(const[M,$]of D)S[M]=$;return S}function o(){const D=new Uint8Array(4);return D[0]=1,new Uint32Array(D.buffer,0,1)[0]===1}function s(){try{return new Function(""),!0}catch{return!1}}class t{static get isLittleEndian(){return _(this,"isLittleEndian",o())}static get isEvalSupported(){return _(this,"isEvalSupported",s())}static get isOffscreenCanvasSupported(){return _(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?_(this,"platform",{isMac:navigator.platform.includes("Mac")}):_(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return _(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const i=[...Array(256).keys()].map(D=>D.toString(16).padStart(2,"0"));class a{static makeHexColor(S,M,$){return`#${i[S]}${i[M]}${i[$]}`}static scaleMinMax(S,M){let $;S[0]?(S[0]<0&&($=M[0],M[0]=M[1],M[1]=$),M[0]*=S[0],M[1]*=S[0],S[3]<0&&($=M[2],M[2]=M[3],M[3]=$),M[2]*=S[3],M[3]*=S[3]):($=M[0],M[0]=M[2],M[2]=$,$=M[1],M[1]=M[3],M[3]=$,S[1]<0&&($=M[2],M[2]=M[3],M[3]=$),M[2]*=S[1],M[3]*=S[1],S[2]<0&&($=M[0],M[0]=M[1],M[1]=$),M[0]*=S[2],M[1]*=S[2]),M[0]+=S[4],M[1]+=S[4],M[2]+=S[5],M[3]+=S[5]}
7static transform(S,M){return[S[0]*M[0]+S[2]*M[1],S[1]*M[0]+S[3]*M[1],S[0]*M[2]+S[2]*M[3],S[1]*M[2]+S[3]*M[3],S[0]*M[4]+S[2]*M[5]+S[4],S[1]*M[4]+S[3]*M[5]+S[5]]}static applyTransform(S,M){const $=S[0]*M[0]+S[1]*M[2]+M[4],G=S[0]*M[1]+S[1]*M[3]+M[5];return[$,G]}static applyInverseTransform(S,M){const $=M[0]*M[3]-M[1]*M[2],G=(S[0]*M[3]-S[1]*M[2]+M[2]*M[5]-M[4]*M[3])/$,W=(-S[0]*M[1]+S[1]*M[0]+M[4]*M[1]-M[5]*M[0])/$;return[G,W]}static getAxialAlignedBoundingBox(S,M){const $=this.applyTransform(S,M),G=this.applyTransform(S.slice(2,4),M),W=this.applyTransform([S[0],S[3]],M),et=this.applyTransform([S[2],S[1]],M);return[Math.min($[0],G[0],W[0],et[0]),Math.min($[1],G[1],W[1],et[1]),Math.max($[0],G[0],W[0],et[0]),Math.max($[1],G[1],W[1],et[1])]}static inverseTransform(S){const M=S[0]*S[3]-S[1]*S[2];return[S[3]/M,-S[1]/M,-S[2]/M,S[0]/M,(S[2]*S[5]-S[4]*S[3])/M,(S[4]*S[1]-S[5]*S[0])/M]}static singularValueDecompose2dScale(S){const M=[S[0],S[2],S[1],S[3]],$=S[0]*M[0]+S[1]*M[2],G=S[0]*M[1]+S[1]*M[3],W=S[2]*M[0]+S[3]*M[2],et=S[2]*M[1]+S[3]*M[3],st=($+et)/2,nt=Math.sqrt(($+et)**2-4*($*et-W*G))/2,it=st+nt||1,lt=st-nt||1;return[Math.sqrt(it),Math.sqrt(lt)]}static normalizeRect(S){const M=S.slice(0);return S[0]>S[2]&&(M[0]=S[2],M[2]=S[0]),S[1]>S[3]&&(M[1]=S[3],M[3]=S[1]),M}static intersect(S,M){const $=Math.max(Math.min(S[0],S[2]),Math.min(M[0],M[2])),G=Math.min(Math.max(S[0],S[2]),Math.max(M[0],M[2]));if($>G)return null;const W=Math.max(Math.min(S[1],S[3]),Math.min(M[1],M[3])),et=Math.min(Math.max(S[1],S[3]),Math.max(M[1],M[3]));return W>et?null:[$,W,G,et]}static bezierBoundingBox(S,M,$,G,W,et,st,nt){const it=[],lt=[[],[]];let mt,bt,At,pt,Et,St,Tt,vt;for(let Rt=0;Rt<2;++Rt){if(Rt===0?(bt=6*S-12*$+6*W,mt=-3*S+9*$-9*W+3*st,At=3*$-3*S):(bt=6*M-12*G+6*et,mt=-3*M+9*G-9*et+3*nt,At=3*G-3*M),Math.abs(mt)<1e-12){if(Math.abs(bt)<1e-12)continue;pt=-At/bt,0<pt&&pt<1&&it.push(pt);continue}Tt=bt*bt-4*At*mt,vt=Math.sqrt(Tt),!(Tt<0)&&(Et=(-bt+vt)/(2*mt),0<Et&&Et<1&&it.push(Et),St=(-bt-vt)/(2*mt),0<St&&St<1&&it.push(St))}let wt=it.length,yt;const kt=wt;for(;wt--;)pt=it[wt],yt=1-pt,lt[0][wt]=yt*yt*yt*S+3*yt*yt*pt*$+3*yt*pt*pt*W+pt*pt*pt*st,lt[1][wt]=yt*yt*yt*M+3*yt*yt*pt*G+3*yt*pt*pt*et+pt*pt*pt*nt;return lt[0][kt]=S,lt[1][kt]=M,lt[0][kt+1]=st,lt[1][kt+1]=nt,lt[0].length=lt[1].length=kt+2,[Math.min(...lt[0]),Math.min(...lt[1]),Math.max(...lt[0]),Math.max(...lt[1])]}}function h(D){return decodeURIComponent(escape(D))}function f(D){return typeof D=="object"&&D?.byteLength!==void 0}class y{#t=!1;constructor(){this.promise=new Promise((S,M)=>{this.resolve=$=>{this.#t=!0,S($)},this.reject=$=>{this.#t=!0,M($)}})}get settled(){return this.#t}}let x=null,T=null;function F(D){return x||(x=/([\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,T=new Map([["ſt","ſt"]])),D.replaceAll(x,(S,M,$)=>M?M.normalize("NFKC"):T.get($))}function I(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const D=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(D);else for(let S=0;S<32;S++)D[S]=Math.floor(Math.random()*255);return ct(D)}const O="pdfjs_internal_id_"}},Bt={};function Mt(ut){var Z=Bt[ut];if(Z!==void 0)return Z.exports;var U=Bt[ut]={exports:{}};return Vt[ut](U,U.exports,Mt),U.exports}(()=>{var ut=typeof Symbol=="function"?Symbol("webpack queues"):"__webpack_queues__",Z=typeof Symbol=="function"?Symbol("webpack exports"):"__webpack_exports__",U=typeof Symbol=="function"?Symbol("webpack error"):"__webpack_error__",A=C=>{C&&C.d<1&&(C.d=1,C.forEach(N=>N.r--),C.forEach(N=>N.r--?N.r++:N()))},V=C=>C.map(N=>{if(N!==null&&typeof N=="object"){if(N[ut])return N;if(N.then){var R=[];R.d=0,N.then(v=>{L[Z]=v,A(R)},v=>{L[U]=v,A(R)});var L={};return L[ut]=v=>v(R),L}}var w={};return w[ut]=v=>{},w[Z]=N,w});Mt.a=(C,N,R)=>{var L;R&&((L=[]).d=-1);var w=new Set,v=C.exports,l,u,g,r=new Promise((p,e)=>{g=e,u=p});r[Z]=v,r[ut]=p=>
7(L&&p(L),w.forEach(p),r.catch(e=>{})),C.exports=r,N(p=>{l=V(p);var e,n=()=>l.map(b=>{if(b[U])throw b[U];return b[Z]}),c=new Promise(b=>{e=()=>b(n),e.r=0;var m=k=>k!==L&&!w.has(k)&&(w.add(k),k&&!k.d&&(e.r++,k.push(e)));l.map(k=>k[ut](m))});return e.r?c:n()},p=>(p?g(r[U]=p):u(v),A(L))),L&&L.d<0&&(L.d=0)}})();Mt.d=(ut,Z)=>{for(var U in Z)Mt.o(Z,U)&&!Mt.o(ut,U)&&Object.defineProperty(ut,U,{enumerable:!0,get:Z[U]})};Mt.o=(ut,Z)=>Object.prototype.hasOwnProperty.call(ut,Z);var dt=Mt(907);dt=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=dt);var Gt=dt.AbortException,Xt=dt.AnnotationEditorLayer,$t=dt.AnnotationEditorParamsType,Yt=dt.AnnotationEditorType,jt=dt.AnnotationEditorUIManager,qt=dt.AnnotationLayer,Wt=dt.AnnotationMode,Jt=dt.CMapCompressionType,Qt=dt.ColorPicker,Kt=dt.DOMSVGFactory,Zt=dt.DrawLayer,te=dt.FeatureTest,ee=dt.GlobalWorkerOptions,se=dt.ImageKind,ie=dt.InvalidPDFException,ne=dt.MissingPDFException,re=dt.OPS,ae=dt.Outliner,oe=dt.PDFDataRangeTransport,le=dt.PDFDateString,he=dt.PDFWorker,ce=dt.PasswordResponses,de=dt.PermissionFlag,ue=dt.PixelsPerInch,fe=dt.PromiseCapability,pe=dt.RenderingCancelledException,ge=dt.UnexpectedResponseException,me=dt.Util,be=dt.VerbosityLevel,Ae=dt.XfaLayer,ve=dt.build,ye=dt.createValidAbsoluteUrl,we=dt.fetchData,Se=dt.getDocument,xe=dt.getFilenameFromUrl,Ce=dt.getPdfFilenameFromUrl,Ee=dt.getXfaPageViewport,Te=dt.isDataScheme,Fe=dt.isPdfFile,ke=dt.noContextMenu,Re=dt.normalizeUnicode,Pe=dt.renderTextLayer,Le=dt.setLayerDimensions,Me=dt.shadow,Ie=dt.updateTextLayer,De=dt.version;export{Gt as AbortException,Xt as AnnotationEditorLayer,$t as AnnotationEditorParamsType,Yt as AnnotationEditorType,jt as AnnotationEditorUIManager,qt as AnnotationLayer,Wt as AnnotationMode,Jt as CMapCompressionType,Qt as ColorPicker,Kt as DOMSVGFactory,Zt as DrawLayer,te as FeatureTest,ee as GlobalWorkerOptions,se as ImageKind,ie as InvalidPDFException,ne as MissingPDFException,re as OPS,ae as Outliner,oe as PDFDataRangeTransport,le as PDFDateString,he as PDFWorker,ce as PasswordResponses,de as PermissionFlag,ue as PixelsPerInch,fe as PromiseCapability,pe as RenderingCancelledException,ge as UnexpectedResponseException,me as Util,be as VerbosityLevel,Ae as XfaLayer,ve as build,ye as createValidAbsoluteUrl,we as fetchData,Se as getDocument,xe as getFilenameFromUrl,Ce as getPdfFilenameFromUrl,Ee as getXfaPageViewport,Te as isDataScheme,Fe as isPdfFile,ke as noContextMenu,Re as normalizeUnicode,Pe as renderTextLayer,Le as setLayerDimensions,Me as shadow,Ie as updateTextLayer,De as version};

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.