PageSourceSearch

https://internxt.com/_next/static/chunks/fcd35612-9cb824cef202f7b8.js

js internxt.com collected 2026-09-24 08:27:52 UTC 316,223 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8233],{53553:(t,e,i)=>{i.a(t,async(t,s)=>{try{i.d(e,{EA:()=>g,YE:()=>m,rE:()=>f});var a,r,n,o,l=i(82909).Buffer,h=i(99742),d={976:(t,e,i)=>{i.d(e,{AnnotationLayer:()=>H,FreeTextAnnotationElement:()=>T,InkAnnotationElement:()=>I,StampAnnotationElement:()=>N});var s=i(292),a=i(419),r=i(792);function n(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function o(t){return Math.max(0,Math.min(255,255*t))}class l{static CMYK_G([t,e,i,s]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+s)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=o(t),t,t]}static G_HTML([t]){let e=n(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(o)}static RGB_HTML(t){return`#${t.map(n).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,i+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,i,s]){return[o(1-Math.min(1,t+s)),o(1-Math.min(1,i+s)),o(1-Math.min(1,e+s))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){let s=1-t,a=1-e,r=1-i,n=Math.min(s,a,r);return["CMYK",s,a,r,n]}}var h=i(284);let d=new WeakSet;function c(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class u{static create(t){switch(t.data.annotationType){case s.AnnotationType.LINK:return new g(t);case s.AnnotationType.TEXT:return new m(t);case s.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new b(t);case"Btn":if(t.data.radioButton)return new y(t);if(t.data.checkBox)return new A(t);return new _(t);case"Ch":return new E(t);case"Sig":return new v(t)}return new f(t);case s.AnnotationType.POPUP:return new w(t);case s.AnnotationType.FREETEXT:return new T(t);case s.AnnotationType.LINE:return new S(t);case s.AnnotationType.SQUARE:return new C(t);case s.AnnotationType.CIRCLE:return new M(t);case s.AnnotationType.POLYLINE:return new P(t);case s.AnnotationType.CARET:return new k(t);case s.AnnotationType.INK:return new I(t);case s.AnnotationType.POLYGON:return new R(t);case s.AnnotationType.HIGHLIGHT:return new D(t);case s.AnnotationType.UNDERLINE:return new L(t);case s.AnnotationType.SQUIGGLY:return new F(t);case s.AnnotationType.STRIKEOUT:return new O(t);case s.AnnotationType.STAMP:return new N(t);case s.AnnotationType.FILEATTACHMENT:return new B(t);default:return new p(t)}}}class p{#t=null;#e=!1;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:i}){return!!(t?.str||e?.str||i?.str)}get hasPopupData(){return p._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#t||={rect:this.data.rect.slice(0)};let{rect:e}=t;e&&this.#i(e)}resetEdited(){this.#t&&(this.#i(this.#t.rect),this.#t=null)}#i(t){let{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:r,pageX:n,pageY:o}}}}=this;i?.splice(0,4,...t);let{width:l,height:h}=c(t);e.left=`${100*(t[0]-n)/a}%`,e.top=`${100*(r-t[3]+o)/r}%`,0===s?(e.width=`${100*l/a}%`,e.height=`${100*h/r}%`):this.setRotation(s)}_createContainer(t){let{data:e,parent:{page:i,viewport:a}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof f||(r.tabIndex=1e3);let{style:n}=r;if(n.zIndex=this.parent.zIndex++,e.popupRef&&r.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof w){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,r),r}let{width:o,height:l}=c(e.rect);if(!t&&e.borderStyle.width>0){n.borderWidth=`${e.borderStyle.width}px`;let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?n.borderRadius=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`:this instanceof y&&(n.borderRadius=`calc(${o}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`),e.borderStyle.style){case s.AnnotationBorderStyleType.SOLID:n.borderStyle="solid";break;case s.AnnotationBorderStyleType.DASHED:n.borderStyle="dashed";break;case s.AnnotationBorderStyleType.BEVELED:(0,s.warn)("Unimplemented border style: beveled");break;case s.AnnotationBorderStyleType.INSET:(0,s.warn)("Unimplemented border style: inset");break;case s.AnnotationBorderStyleType.UNDERLINE:n.borderBottomStyle="solid"}let a=e.borderColor||null;a?(this.#e=!0,n.borderColor=s.Util.makeHexColor(0|a[0],0|a[1],0|a[2])):n.borderWidth=0}let h=s.Util.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:d,pageHeight:u,pageX:p,pageY:g}=a.rawDims;n.left=`${100*(h[0]-p)/d}%`,n.top=`${100*(h[1]-g)/u}%`;let{rotation:m}=e;return e.hasOwnCanvas||0===m?(n.width=`${100*o/d}%`,n.height=`${100*l/u}%`):this.setRotation(m,r),r}setRotation(t,e=this.container){let i,s;if(!this.data.rect)return;let{pageWidth:a,pageHeight:r}=this.parent.viewport.rawDims,{width:n,height:o}=c(this.data.rect);t%180==0?(i=100*n/a,s=100*o/r):(i=100*o/a,s=100*n/r),e.style.width=`${i}%`,e.style.height=`${s}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let s=i.detail[t],a=s[0],r=s.slice(1);i.target.style[e]=l[`${a}_HTML`](r),this.annotationStorage.setValue(this.data.id,{[e]:l[`${a}_rgb`](r)})};return(0,s.shadow)(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>
1t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let s of Object.keys(e.detail)){let a=t[s]||i[s];a?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[s,a]of Object.entries(e)){let r=i[s];if(r){let i={detail:{[s]:a},target:t};r(i),delete e[s]}}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,s,a,r]=this.data.rect;if(1===e.length){let[,{x:t,y:n},{x:o,y:l}]=e[0];if(a===t&&r===n&&i===o&&s===l)return}let{style:n}=this.container;if(this.#e){let{borderColor:e,borderWidth:i}=n;n.borderWidth=0,t=["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="${e}" stroke-width="${i}">`],this.container.classList.add("hasBorder")}let o=a-i,l=r-s,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);let c=h.createElement("defs");d.append(c);let u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;for(let[,{x:s,y:a},{x:n,y:d}]of(u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),c.append(u),e)){let e=h.createElement("rect"),c=(n-i)/o,p=(r-a)/l,g=(s-n)/o,m=(a-d)/l;e.setAttribute("x",c),e.setAttribute("y",p),e.setAttribute("width",g),e.setAttribute("height",m),u.append(e),t?.push(`<rect vector-effect="non-scaling-stroke" x="${c}" y="${p}" width="${g}" height="${m}"/>`)}this.#e&&(t.push("</g></svg>')"),n.backgroundImage=t.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");let i=new w({data:{color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){(0,s.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let i=[];if(this._fieldObjects){let a=this._fieldObjects[t];if(a)for(let{page:t,id:r,exportValues:n}of a){if(-1===t||r===e)continue;let a="string"==typeof n?n:null,o=document.querySelector(`[data-element-id="${r}"]`);if(o&&!d.has(o)){(0,s.warn)(`_getElementsByName - element not allowed: ${r}`);continue}i.push({id:r,exportValue:a,domElement:o})}return i}for(let s of document.getElementsByName(t)){let{exportValue:t}=s,a=s.getAttribute("data-element-id");a!==e&&d.has(s)&&i.push({id:a,exportValue:t,domElement:s})}return i}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(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}}class g extends p{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?(this.#s(i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(this.#a(i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkA
1nnotation"),s&&this.container.append(i),this.container}#r(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#r()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#r()}#s(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#r()}#a(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#r()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let a=i.get(s);a&&(t[a]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}t.onclick||(t.onclick=()=>!1),this.#r()}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#r(),!this._fieldObjects){(0,s.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();let{fields:t,refs:a,include:r}=e,n=[];if(0!==t.length||0!==a.length){let e=new Set(a);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===r&&n.push(i)}else for(let t of Object.values(this._fieldObjects))n.push(...t);let o=this.annotationStorage,l=[];for(let t of n){let{id:e}=t;switch(l.push(e),t.type){case"text":{let i=t.defaultValue||"";o.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;o.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";o.setValue(e,{value:i});break}default:continue}let i=document.querySelector(`[data-element-id="${e}"]`);if(i){if(!d.has(i)){(0,s.warn)(`_bindResetFormAction - element not allowed: ${e}`);continue}i.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class m extends p{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class f extends p{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return s.FeatureTest.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,a){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}a&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(t)}})})}_setEventListeners(t,e,i,s){for(let[a,r]of i)("Action"===r||this.data.actions?.[r])&&(("Focus"===r||"Blur"===r)&&(e||={focused:!1}),this._setEventListener(t,e,a,r,s),"Focus"!==r||this.data.actions?.Blur?"Blur"!==r||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":s.Util.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e,{fontColor:i}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||9,r=t.style,n=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(s.LINE_FACTOR*a))||1;e=Math.min(a,n(t/i/s.LINE_FACTOR))}else{let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);e=Math.min(a,n(t/s.LINE_FACTOR))}r.fontSize=`calc(${e}px * var(--scale-factor))`,r.color=s.Util.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(r.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class b extends f{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,s){let a=this.annotationStorage;
1for(let r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=i),a.setValue(r.id,{[s]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let s=t.getValue(e,{value:this.data.fieldValue}),a=s.value||"",r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&a.length>r&&(a=a.slice(0,r));let n=s.formattedValue||this.data.textContent?.join("\n")||null;n&&this.data.comb&&(n=n.replaceAll(/\s+/g,""));let o={userValue:a,formattedValue:n,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=n??a,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type="text",i.setAttribute("value",n??a),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),d.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=1e3,this._setRequired(i,this.data.required),r&&(i.maxLength=r),i.addEventListener("input",s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),o.formattedValue=null}),i.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let l=t=>{let{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{if(o.focused)return;let{target:e}=t;o.userValue&&(e.value=o.userValue),o.lastCommittedValue=e.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target),this._dispatchEventFromSandbox({value(i){o.userValue=i.detail.value??"",t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){let{formattedValue:s}=i.detail;o.formattedValue=s,null!=s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{let{charLimit:s}=i.detail,{target:a}=i;if(0===s)return void a.removeAttribute("maxLength");a.setAttribute("maxLength",s);let r=o.userValue;r&&!(r.length<=s)&&(a.value=o.userValue=r=r.slice(0,s),t.setValue(e,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:a.selectionStart,selEnd:a.selectionEnd}}))}},i)}),i.addEventListener("keydown",t=>{o.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):i=2,-1===i)return;let{value:s}=t.target;o.lastCommittedValue!==s&&(o.lastCommittedValue=s,o.userValue=s,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});let s=l;l=null,i.addEventListener("blur",t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);let{value:i}=t.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),s(t)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",t=>{o.lastCommittedValue=null;let{data:i,target:s}=t,{value:a,selectionStart:r,selectionEnd:n}=s,l=r,h=n;switch(t.inputType){case"deleteWordBackward":{let t=a.substring(0,r).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}
1case"deleteWordForward":{let t=a.substring(r).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":r===n&&(l-=1);break;case"deleteContentForward":r===n&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,change:i||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(l&&i.addEventListener("blur",l),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else(i=document.createElement("div")).textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class v extends f{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class A extends f{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");return d.add(a),a.setAttribute("data-element-id",i),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.setAttribute("exportValue",e.exportValue),a.tabIndex=1e3,a.addEventListener("change",s=>{let{name:a,checked:r}=s.target;for(let s of this._getElementsByName(a,i)){let i=r&&s.exportValue===e.exportValue;s.domElement&&(s.domElement.checked=i),t.setValue(s.id,{value:i})}t.setValue(i,{value:r})}),a.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class y extends f{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(let s of this._getElementsByName(e.fieldName,i))t.setValue(s.id,{value:!1});let a=document.createElement("input");if(d.add(a),a.setAttribute("data-element-id",i),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.tabIndex=1e3,a.addEventListener("change",e=>{let{name:s,checked:a}=e.target;for(let e of this._getElementsByName(s,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:a})}),a.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let s=e.buttonValue;a.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let a=s===e.detail.value;for(let s of this._getElementsByName(e.target.name)){let e=a&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}},e)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}
1class _ extends g{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class E extends f{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");d.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=1e3;let a=this.data.combo&&this.data.options.length>0;for(let t of(!this.data.combo&&(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of s.options)t.selected=t.value===e}),this.data.options)){let e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),a=!1),s.append(e)}let r=null;if(a){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),r=()=>{t.remove(),s.removeEventListener("input",r),r=null},s.addEventListener("input",r)}let n=t=>{let e=t?"value":"textContent",{options:i,multiple:a}=s;return a?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},o=n(!1),l=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){r?.();let a=i.detail.value,l=new Set(Array.isArray(a)?a:[a]);for(let t of s.options)t.selected=l.has(t.value);t.setValue(e,{value:n(!0)}),o=n(!1)},multipleSelection(t){s.multiple=!0},remove(i){let a=s.options,r=i.detail.remove;if(a[r].selected=!1,s.remove(r),a.length>0){let t=Array.prototype.findIndex.call(a,t=>t.selected);-1===t&&(a[0].selected=!0)}t.setValue(e,{value:n(!0),items:l(i)}),o=n(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),o=n(!1)},insert(i){let{index:a,displayValue:r,exportValue:h}=i.detail.insert,d=s.children[a],c=document.createElement("option");c.textContent=r,c.value=h,d?d.before(c):s.append(c),t.setValue(e,{value:n(!0),items:l(i)}),o=n(!1)},items(i){let{items:a}=i.detail;for(;0!==s.length;)s.remove(0);for(let t of a){let{displayValue:e,exportValue:i}=t,a=document.createElement("option");a.textContent=e,a.value=i,s.append(a)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:n(!0),items:l(i)}),o=n(!1)},indices(i){let s=new Set(i.detail.indices);for(let t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:n(!0)}),o=n(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),s.addEventListener("input",i=>{let s=n(!0),a=n(!1);t.setValue(e,{value:s}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:a,changeEx:s,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):s.addEventListener("input",function(i){t.setValue(e,{value:n(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class w extends p{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:p._hasPopupData(e)}),this.elements=i}render(){this.container.classList.add("popupAnnotation");let t=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}),e=[];for(let i of this.elements)i.popup=t,e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(t=>`${s.AnnotationPrefix}${t}`).join(",")),this.container}}
1class x{#n=this.#o.bind(this);#l=this.#h.bind(this);#d=this.#c.bind(this);#u=this.#p.bind(this);#g=null;#m=null;#f=null;#b=null;#v=null;#A=null;#y=null;#_=!1;#E=null;#w=null;#x=null;#T=null;#S=!1;constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:r,contentsObj:n,richText:o,parent:l,rect:h,parentRect:d,open:c}){for(const c of(this.#m=t,this.#T=s,this.#f=n,this.#x=o,this.#A=l,this.#g=e,this.#w=h,this.#y=d,this.#v=i,this.#b=a.PDFDateString.toDateObject(r),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),this.trigger))c.addEventListener("click",this.#u),c.addEventListener("mouseenter",this.#d),c.addEventListener("mouseleave",this.#l),c.classList.add("popupTriggerArea");for(const t of i)t.container?.addEventListener("keydown",this.#n);this.#m.hidden=!0,c&&this.#p()}render(){if(this.#E)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:a,pageY:r}}}=this.#A,n=this.#E=document.createElement("div");if(n.className="popup",this.#g){let t=n.style.outlineColor=s.Util.makeHexColor(...this.#g);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?n.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`:n.style.backgroundColor=s.Util.makeHexColor(...this.#g.map(t=>Math.floor(.7*(255-t)+t)))}let o=document.createElement("span");o.className="header";let l=document.createElement("h1");if(o.append(l),{dir:l.dir,str:l.textContent}=this.#T,n.append(o),this.#b){let t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),t.setAttribute("data-l10n-args",JSON.stringify({date:this.#b.toLocaleDateString(),time:this.#b.toLocaleTimeString()})),o.append(t)}let d=this.#f,c=this.#x;if(c?.str&&(!d?.str||d.str===c.str))h.XfaLayer.render({xfaHtml:c.html,intent:"richText",div:n}),n.lastChild.classList.add("richText","popupContent");else{let t=this._formatContents(d);n.append(t)}let u=!!this.#y,p=u?this.#y:this.#w;for(let t of this.#v)if(!p||null!==s.Util.intersect(t.data.rect,p)){p=t.data.rect,u=!0;break}let g=s.Util.normalizeRect([p[0],t[3]-p[1]+t[1],p[2],t[3]-p[3]+t[1]]),m=u?p[2]-p[0]+5:0,f=g[0]+m,b=g[1],{style:v}=this.#m;v.left=`${100*(f-a)/e}%`,v.top=`${100*(b-r)/i}%`,this.#m.append(n)}_formatContents({str:t,dir:e}){let i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;let s=t.split(/(?:\r\n?|\n)/);for(let t=0,e=s.length;t<e;++t){let a=s[t];i.append(document.createTextNode(a)),t<e-1&&i.append(document.createElement("br"))}return i}#o(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#_)&&this.#p()}#p(){this.#_=!this.#_,this.#_?(this.#c(),this.#m.addEventListener("click",this.#u),this.#m.addEventListener("keydown",this.#n)):(this.#h(),this.#m.removeEventListener("click",this.#u),this.#m.removeEventListener("keydown",this.#n))}#c(){this.#E||this.render(),this.isVisible?this.#_&&this.#m.classList.add("focused"):(this.#m.hidden=!1,this.#m.style.zIndex=parseInt(this.#m.style.zIndex)+1e3)}#h(){this.#m.classList.remove("focused"),!this.#_&&this.isVisible&&(this.#m.hidden=!0,this.#m.style.zIndex=parseInt(this.#m.style.zIndex)-1e3)}forceHide(){this.#S=this.isVisible,this.#S&&(this.#m.hidden=!0)}maybeShow(){this.#S&&(this.#S=!1,this.#m.hidden=!1)}get isVisible(){return!1===this.#m.hidden}}class T extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=s.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=document.createElement("div");for(let e of(t.classList.add("annotationTextContent"),t.setAttribute("role","comment"),this.textContent)){let i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class S extends p{#C=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let t=this.data,{width:e,height:i}=c(t.rect),s=this.svgFactory.create(e,i,!0),a=this.#C=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#C}addHighlightArea(){this.container.classList.add("highlightArea")}}class C extends p{#M=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let t=this.data,{width:e,height:i}=c(t.rect),s=this.svgFactory.create(e,i,!0),a=t.borderStyle.width,r=this.#M=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",e-a
1),r.setAttribute("height",i-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#M}addHighlightArea(){this.container.classList.add("highlightArea")}}class M extends p{#P=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let t=this.data,{width:e,height:i}=c(t.rect),s=this.svgFactory.create(e,i,!0),a=t.borderStyle.width,r=this.#P=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",i/2),r.setAttribute("rx",e/2-a/2),r.setAttribute("ry",i/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#P}addHighlightArea(){this.container.classList.add("highlightArea")}}class P extends p{#R=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let t=this.data,{width:e,height:i}=c(t.rect),s=this.svgFactory.create(e,i,!0),a=[];for(let e of t.vertices){let i=e.x-t.rect[0],s=t.rect[3]-e.y;a.push(i+","+s)}a=a.join(" ");let r=this.#R=this.svgFactory.createElement(this.svgElementName);return r.setAttribute("points",a),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#R}addHighlightArea(){this.container.classList.add("highlightArea")}}class R extends P{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class k extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class I extends p{#k=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=s.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);let t=this.data,{width:e,height:i}=c(t.rect),s=this.svgFactory.create(e,i,!0);for(let e of t.inkLists){let i=[];for(let s of e){let e=s.x-t.rect[0],a=t.rect[3]-s.y;i.push(`${e},${a}`)}i=i.join(" ");let a=this.svgFactory.createElement(this.svgElementName);this.#k.push(a),a.setAttribute("points",i),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),!t.popupRef&&this.hasPopupData&&this._createPopup(),s.append(a)}return this.container.append(s),this.container}getElementsToTriggerPopup(){return this.#k}addHighlightArea(){this.container.classList.add("highlightArea")}}class D extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class L extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class F extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class O extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("str
1ikeoutAnnotation"),this.container}}class N extends p{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class B extends p{#I=null;constructor(t){super(t,{isRenderable:!0});const{filename:e,content:i}=this.data.file;this.filename=(0,a.getFilenameFromUrl)(e,!0),this.content=i,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:e,content:i})}render(){let t;this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this;i.hasAppearance||0===i.fillAlpha?t=document.createElement("div"):((t=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(t.style=`filter: opacity(${Math.round(100*i.fillAlpha)}%);`)),t.addEventListener("dblclick",this.#D.bind(this)),this.#I=t;let{isMac:a}=s.FeatureTest.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(a?t.metaKey:t.ctrlKey)&&this.#D()}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return this.#I}addHighlightArea(){this.container.classList.add("highlightArea")}#D(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class H{#L=null;#F=null;#O=new Map;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:a,viewport:r}){this.div=t,this.#L=e,this.#F=i,this.page=a,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=s}#N(t,e){let i=t.firstChild||t;i.id=`${s.AnnotationPrefix}${e}`,this.div.append(t),this.#L?.moveElementInDOM(this.div,t,i,!1)}async render(t){let{annotations:e}=t,i=this.div;(0,a.setLayerDimensions)(i,this.viewport);let n=new Map,o={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new a.DOMSVGFactory,annotationStorage:t.annotationStorage||new r.AnnotationStorage,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=t.annotationType===s.AnnotationType.POPUP;if(e){let e=n.get(t.id);if(!e)continue;o.elements=e}else{let{width:e,height:i}=c(t.rect);if(e<=0||i<=0)continue}o.data=t;let i=u.create(o);if(!i.isRenderable)continue;if(!e&&t.popupRef){let e=n.get(t.popupRef);e?e.push(i):n.set(t.popupRef,[i])}let a=i.render();t.hidden&&(a.style.visibility="hidden"),this.#N(a,t.id),i.annotationEditorType>0&&(this.#O.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}this.#B()}update({viewport:t}){let e=this.div;this.viewport=t,(0,a.setLayerDimensions)(e,{rotation:t.rotation}),this.#B(),e.hidden=!1}#B(){if(!this.#F)return;let t=this.div;for(let[e,i]of this.#F){let s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;i.className="annotationContent";let{firstChild:a}=s;a?"CANVAS"===a.nodeName?a.replaceWith(i):a.classList.contains("annotationContent")?a.after(i):a.before(i):s.append(i)}this.#F.clear()}getEditableAnnotations(){return Array.from(this.#O.values())}getEditableAnnotation(t){return this.#O.get(t)}}},792:(t,e,i)=>{i.d(e,{AnnotationStorage:()=>o,PrintAnnotationStorage:()=>l,SerializableEmpty:()=>n});var s=i(292),a=i(310),r=i(651);let n=Object.freeze({map:null,hash:"",transfer:void 0});class o{#H=!1;#U=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){let i=this.#U.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#U.get(t)}remove(t){if(this.#U.delete(t),0===this.#U.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let t of this.#U.values())if(t instanceof a.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=this.#U.get(t),s=!1;if(void 0!==i)for(let[t,a]of Object.entries(e))i[t]!==a&&(s=!0,i[t]=a);else s=!0,this.#U.set(t,e);s&&this.#z(),e instanceof a.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#U.has(t)}getAll(){return this.#U.size>0?(0,s.objectFromMap)(this.#U):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#U.size}#z(){this.#H||(this.#H=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#H&&(this.#H=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new l(this)}get serializable(){if(0===this.#U.size)return n;let t=new Map,e=new r.MurmurHash3_64,i=[],s=Object.create(null),o=!1;for(let[i,r]of this.#U){let n=r instanceof a.AnnotationEditor?r.serialize(!1,s):r;n&&(t.set(i,n),e.update(`${i}:${JSON.stringify(n)}`),o||=!!n.bitmap)}if(o)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:n}get editorStats(){let t=null,e=new Map;for(let i of this.#U.values()){if(!(i instanceof a.AnnotationEditor))continue;let s=i.telemetryFinalData;if(!s)continue;let{type:r}=s;e.has(r)||e.set(r,Object.getPrototypeOf(i).constructor),t||=Object.create(null);let n=t[r]||=new Map;for(let[t,e]of Object.entries(s)){if("type"===t)continue;let i=n.get(t);i||(i=new Map,n.set(t,i));let s=i.get(e)??0;i.set(e,s+1)}}for(let[i,s]of e)t[i]=s.computeTelemetryFinalData(t[i]);return t}}class l extends o{#$;constructor(t){super();const{map:e,hash:i,transfer:s}=t.serializable,a=structuredClone(e,s?{transfer:s}:null);this.#$={map:a,hash:i,transfer:s}}get print(){(0,s.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#$}}}
1,831:(t,e,i)=>{i.a(t,async(t,s)=>{try{i.d(e,{PDFDataRangeTransport:()=>R,PDFWorker:()=>F,build:()=>$,getDocument:()=>E,version:()=>z});var a=i(292),r=i(792),n=i(419),o=i(10),h=i(573),d=i(923),c=i(814),u=i(164),p=i(178),g=i(62),m=i(626),f=i(585),b=i(94),v=i(457),A=i(786),y=i(50),_=t([h,A]);[h,A]=_.then?(await _)():_;let T=a.isNodeJS?h.NodeCanvasFactory:n.DOMCanvasFactory,S=a.isNodeJS?h.NodeCMapReaderFactory:n.DOMCMapReaderFactory,C=a.isNodeJS?h.NodeFilterFactory:n.DOMFilterFactory,M=a.isNodeJS?h.NodeStandardFontDataFactory:n.DOMStandardFontDataFactory;function E(t){if("string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t}),"object"!=typeof t)throw Error("Invalid parameter in getDocument, need parameter object.");if(!t.url&&!t.data&&!t.range)throw Error("Invalid parameter object: need either .data, .range or .url");let e=new P,{docId:i}=e,s=t.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(a.isNodeJS&&"string"==typeof t)return t}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,r=t.data?function(t){if(a.isNodeJS&&void 0!==l&&t instanceof l)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return(0,a.stringToBytes)(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,o=t.httpHeaders||null,h=!0===t.withCredentials,d=t.password??null,c=t.range instanceof R?t.range:null,g=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536,m=t.worker instanceof F?t.worker:null,y=t.verbosity,_="string"!=typeof t.docBaseUrl||(0,n.isDataScheme)(t.docBaseUrl)?null:t.docBaseUrl,E="string"==typeof t.cMapUrl?t.cMapUrl:null,x=!1!==t.cMapPacked,k=t.CMapReaderFactory||S,I="string"==typeof t.standardFontDataUrl?t.standardFontDataUrl:null,D=t.StandardFontDataFactory||M,L=!0!==t.stopAtErrors,N=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,B=!1!==t.isEvalSupported,H="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!a.isNodeJS,U=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,z="boolean"==typeof t.disableFontFace?t.disableFontFace:a.isNodeJS,$=!0===t.fontExtraProperties,j=!0===t.enableXfa,G=t.ownerDocument||globalThis.document,V=!0===t.disableRange,q=!0===t.disableStream,W=!0===t.disableAutoFetch,K=!0===t.pdfBug,X=c?c.length:t.length??NaN,Y="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!a.isNodeJS&&!z,J="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:k===n.DOMCMapReaderFactory&&D===n.DOMStandardFontDataFactory&&E&&I&&(0,n.isValidFetchUrl)(E,document.baseURI)&&(0,n.isValidFetchUrl)(I,document.baseURI),Q=t.canvasFactory||new T({ownerDocument:G}),Z=t.filterFactory||new C({docId:i,ownerDocument:G});(0,a.setVerbosityLevel)(y);let tt={canvasFactory:Q,filterFactory:Z};if(J||(tt.cMapReaderFactory=new k({baseUrl:E,isCompressed:x}),tt.standardFontDataFactory=new D({baseUrl:I})),!m){let t={verbosity:y,port:u.GlobalWorkerOptions.workerPort};e._worker=m=t.port?F.fromPort(t):new F(t)}let te={docId:i,apiVersion:"4.2.67",data:r,password:d,disableAutoFetch:W,rangeChunkSize:g,length:X,docBaseUrl:_,enableXfa:j,evaluatorOptions:{maxImageSize:N,disableFontFace:z,ignoreErrors:L,isEvalSupported:B,isOffscreenCanvasSupported:H,canvasMaxAreaInBytes:U,fontExtraProperties:$,useSystemFonts:Y,cMapUrl:J?E:null,standardFontDataUrl:J?I:null}},ti={ignoreErrors:L,disableFontFace:z,fontExtraProperties:$,enableXfa:j,ownerDocument:G,disableAutoFetch:W,pdfBug:K,styleElement:null};return m.promise.then(function(){if(e.destroyed)throw Error("Loading aborted");let t=w(m,te),l=new Promise(function(t){let e;if(c)e=new f.PDFDataTransportStream(c,{disableRange:V,disableStream:q});else if(!r){var i;i={url:s,length:X,httpHeaders:o,withCredentials:h,rangeChunkSize:g,disableRange:V,disableStream:q},e=a.isNodeJS?"u">typeof fetch&&"u">typeof Response&&"body"in Response.prototype&&(0,n.isValidFetchUrl)(i.url)?new b.PDFFetchStream(i):new A.PDFNodeStream(i):(0,n.isValidFetchUrl)(i.url)?new b.PDFFetchStream(i):new v.PDFNetworkStream(i)}t(e)});return Promise.all([t,l]).then(function([t,s]){if(e.destroyed)throw Error("Loading aborted");let a=new p.MessageHandler(i,t,m.port),r=new O(a,e,s,ti,tt);e._transport=r,a.send("Ready",null)})}).catch(e._capability.reject),e}async function w(t,e){if(t.destroyed)throw Error("Worker was destroyed");
1let i=await t.messageHandler.sendWithPromise("GetDocRequest",e,e.data?[e.data.buffer]:null);if(t.destroyed)throw Error("Worker was destroyed");return i}function x(t){return"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}class P{static #j=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${P.#j++}`,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 R{constructor(t,e,i=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}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,e){for(let i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(let i of this._progressListeners)i(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(let e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){(0,a.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class k{constructor(t,e){this._pdfInfo=t,this._transport=e}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,a.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({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class I{#G=null;#V=!1;constructor(t,e,i,s=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new n.StatTimer:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new B,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:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:a=!1}={}){return new n.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}
1=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,a.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:e,intent:i="display",annotationMode:s=a.AnnotationMode.ENABLE,transform:r=null,background:n=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:d=null}){this._stats?.time("Overall");let c=this._transport.getRenderingIntent(i,s,d),{renderingIntent:u,cacheKey:p}=c;this.#V=!1,this.#q(),o||=this._transport.getOptionalContentConfig(u);let g=this._intentStates.get(p);g||(g=Object.create(null),this._intentStates.set(p,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);let m=!!(u&a.RenderingIntentFlag.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(c));let f=t=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||m)&&(this.#V=!0),this.#W(!m),t?(b.capability.reject(t),this._abortOperatorList({intentState:g,reason:t instanceof Error?t:Error(t)})):b.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},b=new U({callback:f,params:{canvasContext:t,viewport:e,transform:r,background:n},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:h});(g.renderTasks||=new Set).add(b);let v=b.task;return Promise.all([g.displayReadyCapability.promise,o]).then(([t,e])=>{if(this.destroyed)return void f();if(this._stats?.time("Rendering"),!(e.renderingIntent&u))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:t,optionalContentConfig:e}),b.operatorListChanged()}).catch(f),v}getOperatorList({intent:t="display",annotationMode:e=a.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){let s,r=this._transport.getRenderingIntent(t,e,i,!0),n=this._intentStates.get(r.cacheKey);return n||(n=Object.create(null),this._intentStates.set(r.cacheKey,n)),n.opListReadCapability||((s=Object.create(null)).operatorListChanged=function(){n.operatorList.lastChunk&&(n.opListReadCapability.resolve(n.operatorList),n.renderTasks.delete(s))},n.opListReadCapability=Promise.withResolvers(),(n.renderTasks||=new Set).add(s),n.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(r)),n.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(t=>y.XfaText.textContent(t));let e=this.streamTextContent(t);return new Promise(function(t,i){let s=e.getReader(),a={items:[],styles:Object.create(null)};!function e(){s.read().then(function({value:i,done:s}){s?t(a):(Object.assign(a.styles,i.styles),a.items.push(...i.items),e())},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#V=!1,this.#q(),Promise.all(t)}cleanup(t=!1){this.#V=!0;let e=this.#W(!1);
1return t&&e&&(this._stats&&=new n.StatTimer),e}#W(t=!1){if(this.#q(),!this.#V||this.destroyed)return!1;if(t)return this.#G=setTimeout(()=>{this.#G=null,this.#W(!1)},5e3),!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#V=!1,!0}#q(){this.#G&&(clearTimeout(this.#G),this.#G=null)}_startRenderPage(t,e){let i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);for(let i of(e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots,e.renderTasks))i.operatorListChanged();t.lastChunk&&this.#W(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i}){let{map:s,transfer:a}=i,r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s},a).getReader(),n=this._intentStates.get(e);n.streamReader=r;let o=()=>{r.read().then(({value:t,done:e})=>{if(e){n.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,n),o())},t=>{if(n.streamReader=null,!this._transport.destroyed){if(n.operatorList){for(let t of(n.operatorList.lastChunk=!0,n.renderTasks))t.operatorListChanged();this.#W(!0)}if(n.displayReadyCapability)n.displayReadyCapability.reject(t);else if(n.opListReadCapability)n.opListReadCapability.reject(t);else throw t}})};o()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof n.RenderingCancelledException){let i=100;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new a.AbortException(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class D{#K=new Set;#X=Promise.resolve();postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};this.#X.then(()=>{for(let t of this.#K)t.call(this,i)})}addEventListener(t,e){this.#K.add(e)}removeEventListener(t,e){this.#K.delete(e)}terminate(){this.#K.clear()}}let L={isWorkerDisabled:!1,fakeWorkerId:0};a.isNodeJS&&(L.isWorkerDisabled=!0,u.GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"),L.isSameOrigin=function(t,e){let i;try{if(!(i=new URL(t)).origin||"null"===i.origin)return!1}catch{return!1}let s=new URL(e,i);return i.origin===s.origin},L.createCDNWrapper=function(t){let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};class F{static #Y;constructor({name:t=null,port:e=null,verbosity:i=(0,a.getVerbosityLevel)()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(F.#Y?.has(e))throw Error("Cannot use more than one PDFWorker per port.");(F.#Y||=new WeakMap).set(e,this),this._initializeFromPort(e);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 p.MessageHandler("main","worker",t),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!L.isWorkerDisabled&&!F.#J){let{workerSrc:t}=F;try{L.isSameOrigin(window.location.href,t)||(t=L.createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new p.MessageHandler("main","worker",e),s=()=>{e.removeEventListener("error",a),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},a=()=>{this._webWorker||s()};e.addEventListener("error",a),i.on("test",t=>{(e.removeEventListener("error",a),this.destroyed)?s():t?(this._messageHandler=i,this._port=e,this._webWorker=e,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),e.terminate())}),i.on("ready",t=>{if(e.removeEventListener("error",a),this.destroyed)return void s();try{r()}catch{this._setupFakeWorker()}});let r=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};r();return}catch{(0,a.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){L.isWorkerDisabled||((0,a.warn)("Setting up fake worker."),L.isWorkerDisabled=!0),F._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this._readyCapability.reject(Error("Worker was destroyed"));let e=new D;this._port=e;let i=`fake${L.fakeWorkerId++}`,s=new p.MessageHandler(i+"_worker",i,e);t.setup(s,e);let a=new p.MessageHandler(i,i+"_worker",e);this._messageHandler=a,this._readyCapability.resolve(),a.send("configure",{verbosity:this.verbosity})}).catch(t=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),F.#Y?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw Error("PDFWorker.fromPort - invalid method signature.");let e=this.#Y?.get(t.port);
1if(e){if(e._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new F(t)}static get workerSrc(){if(u.GlobalWorkerOptions.workerSrc)return u.GlobalWorkerOptions.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get #J(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){let t=async()=>this.#J?this.#J:(await import(this.workerSrc)).WorkerMessageHandler;return(0,a.shadow)(this,"_setupFakeWorkerGlobal",t())}}class O{#Q=new Map;#Z=new Map;#tt=new Map;#te=new Map;#ti=null;constructor(t,e,i,s,a){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new B,this.fontLoader=new o.FontLoader({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this._params=s,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#ts(t,e=null){let i=this.#Q.get(t);if(i)return i;let s=this.messageHandler.sendWithPromise(t,e);return this.#Q.set(t,s),s}get annotationStorage(){return(0,a.shadow)(this,"annotationStorage",new r.AnnotationStorage)}getRenderingIntent(t,e=a.AnnotationMode.ENABLE,i=null,s=!1){let n=a.RenderingIntentFlag.DISPLAY,o=r.SerializableEmpty;switch(t){case"any":n=a.RenderingIntentFlag.ANY;break;case"display":break;case"print":n=a.RenderingIntentFlag.PRINT;break;default:(0,a.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case a.AnnotationMode.DISABLE:n+=a.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case a.AnnotationMode.ENABLE:break;case a.AnnotationMode.ENABLE_FORMS:n+=a.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case a.AnnotationMode.ENABLE_STORAGE:o=((n+=a.RenderingIntentFlag.ANNOTATIONS_STORAGE)&a.RenderingIntentFlag.PRINT&&i instanceof r.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,a.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}return s&&(n+=a.RenderingIntentFlag.OPLIST),{renderingIntent:n,cacheKey:`${n}_${o.hash}`,annotationStorageSerializable:o}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#ti?.reject(Error("Worker was destroyed during onPassword callback"));let t=[];for(let e of this.#Z.values())t.push(e._destroy());this.#Z.clear(),this.#tt.clear(),this.#te.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#Q.clear(),this.filterFactory.destroy(),(0,c.cleanupTextLayer)(),this._networkStream?.cancelAllRequests(new a.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{(0,a.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function({value:t,done:i}){i?e.close():((0,a.assert)(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",t=>{let i=Promise.withResolvers(),s=this._fullReader;return s.headersReady.then(()=>{s.isStreamingSupported&&s.isRangeSupported||(this._lastProgress&&e.onProgress?.(this._lastProgress),s.onProgress=t=>{e.onProgress?.({loaded:t.loaded,total:t.total})}),i.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},i.reject),i.promise}),t.on("GetRangeReader",(t,e)=>{(0,a.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function({value:t,done:i}){i?e.close():((0,a.assert)(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new k(t,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new a.PasswordException(t.message,t.code);break;case"InvalidPDFException":i=new a.InvalidPDFException(t.message);break;case"MissingPDFException":i=new a.MissingPDFException(t.message);break;case"UnexpectedResponseException":i=new a.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":i=new a.UnknownErrorException(t.message,t.details);break;default:(0,a.unreachable)("DocException - expected a valid Error.")}e._capability.reject(i)}
1),t.on("PasswordRequest",t=>{if(this.#ti=Promise.withResolvers(),e.onPassword){let i=t=>{t instanceof Error?this.#ti.reject(t):this.#ti.resolve({password:t})};try{e.onPassword(i,t.code)}catch(t){this.#ti.reject(t)}}else this.#ti.reject(new a.PasswordException(t.message,t.code));return this.#ti.promise}),t.on("DataLoaded",t=>{e.onProgress?.({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||this.#Z.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,i,s])=>{if(this.destroyed||this.commonObjs.has(e))return null;switch(i){case"Font":let r=this._params;if("error"in s){let t=s.error;(0,a.warn)(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}let n=r.pdfBug&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,l=new o.FontFaceObject(s,{disableFontFace:r.disableFontFace,ignoreErrors:r.ignoreErrors,inspectFont:n});this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>
1{!r.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(e,l)});break;case"CopyLocalImage":let{imageRef:h}=s;for(let t of((0,a.assert)(h,"The imageRef must be defined."),this.#Z.values()))for(let[,i]of t.objs)if(i.ref===h){if(!i.dataLen)return null;return this.commonObjs.resolve(e,structuredClone(i)),i.dataLen}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(e,s);break;default:throw Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([t,e,i,s])=>{if(this.destroyed)return;let r=this.#Z.get(e);if(!r.objs.has(t)){if(0===r._intentStates.size)return void s?.bitmap?.close();switch(i){case"Image":r.objs.resolve(t,s),s?.dataLen>a.MAX_IMAGE_SIZE_TO_CACHE&&(r._maybeCleanupAfterRender=!0);break;case"Pattern":r.objs.resolve(t,s);break;default:throw Error(`Got unknown object type ${i}`)}}}),t.on("DocProgress",t=>{this.destroyed||e.onProgress?.({loaded:t.loaded,total:t.total})}),t.on("FetchBuiltInCMap",t=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",t=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,a.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(Error("Invalid page request."));let e=t-1,i=this.#tt.get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw Error("Transport destroyed");i.refStr&&this.#te.set(i.refStr,t);let s=new I(e,i,this,this._params.pdfBug);return this.#Z.set(e,s),s});return this.#tt.set(e,s),s}getPageIndex(t){return x(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#ts("GetFieldObjects")}hasJSActions(){return this.#ts("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(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.#ts("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(t){return this.#ts("GetOptionalContentConfig").then(e=>new m.OptionalContentConfig(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=this.#Q.get(t);if(e)return e;
1let i=this.messageHandler.sendWithPromise(t,null).then(t=>({info:t[0],metadata:t[1]?new g.Metadata(t[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#Q.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#Z.values()))if(!t.cleanup())throw Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#Q.clear(),this.filterFactory.destroy(!0),(0,c.cleanupTextLayer)()}}cachedPageNumber(t){if(!x(t))return null;let e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;return this.#te.get(e)??null}get loadingParams(){let{disableAutoFetch:t,enableXfa:e}=this._params;return(0,a.shadow)(this,"loadingParams",{disableAutoFetch:t,enableXfa:e})}}let N=Symbol("INITIAL_DATA");class B{#ta=Object.create(null);#tr(t){return this.#ta[t]||={...Promise.withResolvers(),data:N}}get(t,e=null){if(e){let i=this.#tr(t);return i.promise.then(()=>e(i.data)),null}let i=this.#ta[t];if(!i||i.data===N)throw Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#ta[t];return!!e&&e.data!==N}resolve(t,e=null){let i=this.#tr(t);i.data=e,i.resolve()}clear(){for(let t in this.#ta){let{data:e}=this.#ta[t];e?.bitmap?.close()}this.#ta=Object.create(null)}*[Symbol.iterator](){for(let t in this.#ta){let{data:e}=this.#ta[t];e!==N&&(yield[t,e])}}}class H{#tn=null;constructor(t){this.#tn=t,this.onContinue=null}get promise(){return this.#tn.capability.promise}cancel(t=0){this.#tn.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this.#tn.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this.#tn;return t.form||t.canvas&&e?.size>0}}class U{static #to=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:a,operatorList:r,pageIndex:n,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:c=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=n,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=d,this.pageColors=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"u">typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new H(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(U.#to.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");U.#to.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());let{canvasContext:i,viewport:s,transform:a,background:r}=this.params;this.gfx=new d.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:s,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),U.#to.delete(this._canvas),this.callback(t||new n.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,e))}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)}
1):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(),U.#to.delete(this._canvas),this.callback())))}}let z="4.2.67",$="49b388101";s()}catch(t){s(t)}})},583:(t,e,i)=>{i.d(e,{BaseCMapReaderFactory:()=>n,BaseCanvasFactory:()=>r,BaseFilterFactory:()=>a,BaseSVGFactory:()=>l,BaseStandardFontDataFactory:()=>o});var s=i(292);class a{constructor(){this.constructor===a&&(0,s.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addHighlightHCMFilter(t,e,i,s,a){return"none"}destroy(t=!1){}}class r{constructor(){this.constructor===r&&(0,s.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d")}}reset(t,e,i){if(!t.canvas)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){(0,s.unreachable)("Abstract method `_createCanvas` called.")}}class n{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===n&&(0,s.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw Error("CMap name must be specified.");let e=this.baseUrl+t+(this.isCompressed?".bcmap":""),i=this.isCompressed?s.CMapCompressionType.BINARY:s.CMapCompressionType.NONE;return this._fetchData(e,i).catch(t=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){(0,s.unreachable)("Abstract method `_fetchData` called.")}}class o{constructor({baseUrl:t=null}){this.constructor===o&&(0,s.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw Error("Font filename must be specified.");let e=`${this.baseUrl}${t}`;return this._fetchData(e).catch(t=>{throw Error(`Unable to load font data at: ${e}`)})}_fetchData(t){(0,s.unreachable)("Abstract method `_fetchData` called.")}}class l{constructor(){this.constructor===l&&(0,s.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,e,i=!1){if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,s.unreachable)("Abstract method `_createSVG` called.")}}},923:(t,e,i)=>{i.d(e,{CanvasGraphics:()=>P});var s=i(292),a=i(419);let r="Fill",n="Stroke",o="Shading";function l(t,e){if(!e)return;let i=e[2]-e[0],s=e[3]-e[1],a=new Path2D;a.rect(e[0],e[1],i,s),t.clip(a)}class h{constructor(){this.constructor===h&&(0,s.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,s.unreachable)("Abstract method `getPattern` called.")}}class d extends h{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;for(let i of("axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,o){let h;if(o===n||o===r){let r=e.current.getClippedPathBoundingBox(o,(0,a.getCurrentTransform)(t))||[0,0,0,0],n=Math.ceil(r[2]-r[0])||1,d=Math.ceil(r[3]-r[1])||1,c=e.cachedCanvases.getCanvas("pattern",n,d,!0),u=c.context;u.clearRect(0,0,u.canvas.width,u.canvas.height),u.beginPath(),u.rect(0,0,u.canvas.width,u.canvas.height),u.translate(-r[0],-r[1]),i=s.Util.transform(i,[1,0,0,1,r[0],r[1]]),u.transform(...e.baseTransform),this.matrix&&u.transform(...this.matrix
1),l(u,this._bbox),u.fillStyle=this._createGradient(u),u.fill(),h=t.createPattern(c.canvas,"no-repeat");let p=new DOMMatrix(i);h.setTransform(p)}else l(t,this._bbox),h=this._createGradient(t);return h}}function c(t,e,i,s,a,r,n,o){let l,h,d,c,u,p,g,m,f,b=e.coords,v=e.colors,A=t.data,y=4*t.width;b[i+1]>b[s+1]&&(l=i,i=s,s=l,l=r,r=n,n=l),b[s+1]>b[a+1]&&(l=s,s=a,a=l,l=n,n=o,o=l),b[i+1]>b[s+1]&&(l=i,i=s,s=l,l=r,r=n,n=l);let _=(b[i]+e.offsetX)*e.scaleX,E=(b[i+1]+e.offsetY)*e.scaleY,w=(b[s]+e.offsetX)*e.scaleX,x=(b[s+1]+e.offsetY)*e.scaleY,T=(b[a]+e.offsetX)*e.scaleX,S=(b[a+1]+e.offsetY)*e.scaleY;if(E>=S)return;let C=v[r],M=v[r+1],P=v[r+2],R=v[n],k=v[n+1],I=v[n+2],D=v[o],L=v[o+1],F=v[o+2],O=Math.round(E),N=Math.round(S);for(let t=O;t<=N;t++){let e;if(t<x){let e=t<E?0:(E-t)/(E-x);h=_-(_-w)*e,d=C-(C-R)*e,c=M-(M-k)*e,u=P-(P-I)*e}else{let e;e=t>S?1:x===S?0:(x-t)/(x-S),h=w-(w-T)*e,d=R-(R-D)*e,c=k-(k-L)*e,u=I-(I-F)*e}e=t<E?0:t>S?1:(E-t)/(E-S),p=_-(_-T)*e,g=C-(C-D)*e,m=M-(M-L)*e,f=P-(P-F)*e;let i=Math.round(Math.min(h,p)),s=Math.round(Math.max(h,p)),a=y*t+4*i;for(let t=i;t<=s;t++)(e=(h-t)/(h-p))<0?e=0:e>1&&(e=1),A[a++]=d-(d-g)*e|0,A[a++]=c-(c-m)*e|0,A[a++]=u-(u-f)*e|0,A[a++]=255}}class u extends h{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){let s=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-s,n=Math.ceil(this._bounds[3])-a,o=Math.min(Math.ceil(Math.abs(r*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(n*t[1]*1.1)),3e3),h=r/o,d=n/l,u={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-a,scaleX:1/h,scaleY:1/d},p=o+4,g=l+4,m=i.getCanvas("mesh",p,g,!1),f=m.context,b=f.createImageData(o,l);if(e){let t=b.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(let t of this._figures)!function(t,e,i){let s,a,r=e.coords,n=e.colors;switch(e.type){case"lattice":let o=e.verticesPerRow,l=Math.floor(r.length/o)-1,h=o-1;for(s=0;s<l;s++){let e=s*o;for(let s=0;s<h;s++,e++)c(t,i,r[e],r[e+1],r[e+o],n[e],n[e+1],n[e+o]),c(t,i,r[e+o+1],r[e+1],r[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(s=0,a=r.length;s<a;s+=3)c(t,i,r[s],r[s+1],r[s+2],n[s],n[s+1],n[s+2]);break;default:throw Error("illegal figure")}}(b,t,u);return f.putImageData(b,2,2),{canvas:m.canvas,offsetX:s-2*h,offsetY:a-2*d,scaleX:h,scaleY:d}}getPattern(t,e,i,r){let n;if(l(t,this._bbox),r===o)n=s.Util.singularValueDecompose2dScale((0,a.getCurrentTransform)(t));else if(n=s.Util.singularValueDecompose2dScale(e.baseTransform),this.matrix){let t=s.Util.singularValueDecompose2dScale(this.matrix);n=[n[0]*t[0],n[1]*t[1]]}let h=this._createMeshCanvas(n,r===o?null:this._background,e.cachedCanvases);return r!==o&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(h.offsetX,h.offsetY),t.scale(h.scaleX,h.scaleY),t.createPattern(h.canvas,"no-repeat")}}class p extends h{getPattern(){return"hotpink"}}class g{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,s,a){this.operatorList=t[2],this.matrix=t[3]||[1,0,0,1,0,0],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=s,this.baseTransform=a}createPatternCanvas(t){let e=this.operatorList,i=this.bbox,r=this.xstep,n=this.ystep,o=this.paintType,l=this.tilingType,h=this.color,d=this.canvasGraphicsFactory;(0,s.info)("TilingType: "+l);let c=i[0],u=i[1],p=i[2],g=i[3],m=s.Util.singularValueDecompose2dScale(this.matrix),f=s.Util.singularValueDecompose2dScale(this.baseTransform),b=[m[0]*f[0],m[1]*f[1]],v=this.getSizeAndScale(r,this.ctx.canvas.width,b[0]),A=this.getSizeAndScale(n,this.ctx.canvas.height,b[1]),y=t.cachedCanvases.getCanvas("pattern",v.size,A.size,!0),_=y.context,E=d.createCanvasGraphics(_);E.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(E,o,h);let w=c,x=u,T=p,S=g;return c<0&&(w=0,T+=Math.abs(c)),u<0&&(x=0,S+=Math.abs(u)),_.translate(-(v.scale*w),-(A.scale*x)),E.transform(v.scale,0,0,A.scale,0,0),_.save(),this.clipBbox(E,w,x,T,S),E.baseTransform=(0,a.getCurrentTransform)(E.ctx),E.executeOperatorList(e),E.endDrawing(),{canvas:y.canvas,scaleX:v.scale,scaleY:A.scale,offsetX:w,offsetY:x}}getSizeAndScale(t,e,i){t=Math.abs(t);let s=Math.max(g.MAX_PATTERN_SIZE,e),a=Math.ceil(t*i);return a>=s?a=s:i=a/t,{scale:i,size:a}}clipBbox(t,e,i,s,r){let n=s-e,o=r-i;t.ctx.rect(e,i,n,o),t.current.updateRectMinMax((0,a.getCurrentTransform)(t.ctx),[e,i,s,r]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let a=t.ctx,r=t.current;switch(e){case 1:let n=this.ctx;a.fillStyle=n.fillStyle,a.strokeStyle=n.strokeStyle,r.fillColor=n.fillStyle,r.strokeColor=n.strokeStyle;break;case 2:let o=s.Util.makeHexColor(i[0],i[1],i[2]);a.fillStyle=o,a.strokeStyle=o,r.fillColor=o,r.strokeColor=o;break;default:throw new s.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,a){let r=i;a!==o&&(r=s.Util.transform(r,e.baseTransform),this.matrix&&(r=s.Util.transform(r,this.matrix
1)));let n=this.createPatternCanvas(e),l=new DOMMatrix(r);l=(l=l.translate(n.offsetX,n.offsetY)).scale(1/n.scaleX,1/n.scaleY);let h=t.createPattern(n.canvas,"repeat");return h.setTransform(l),h}}class m{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function f(t,e,i,s,r,n,o,l,h,d){let[c,u,p,g,m,f]=(0,a.getCurrentTransform)(t);if(0===u&&0===p){let a=Math.round(o*c+m),b=Math.round(l*g+f),v=Math.abs(Math.round((o+h)*c+m)-a)||1,A=Math.abs(Math.round((l+d)*g+f)-b)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(g),a,b),t.drawImage(e,i,s,r,n,0,0,v,A),t.setTransform(c,u,p,g,m,f),[v,A]}if(0===c&&0===g){let a=Math.round(l*p+m),b=Math.round(o*u+f),v=Math.abs(Math.round((l+d)*p+m)-a)||1,A=Math.abs(Math.round((o+h)*u+f)-b)||1;return t.setTransform(0,Math.sign(u),Math.sign(p),0,a,b),t.drawImage(e,i,s,r,n,0,0,A,v),t.setTransform(c,u,p,g,m,f),[A,v]}t.drawImage(e,i,s,r,n,o,l,h,d);let b=Math.hypot(c,u),v=Math.hypot(p,g);return[b*h,v*d]}class b{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=s.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=s.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=s.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,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){[e,i]=s.Util.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){let i=s.Util.applyTransform(e,t),a=s.Util.applyTransform(e.slice(2),t),r=s.Util.applyTransform([e[0],e[3]],t),n=s.Util.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],a[0],r[0],n[0]),this.minY=Math.min(this.minY,i[1],a[1],r[1],n[1]),this.maxX=Math.max(this.maxX,i[0],a[0],r[0],n[0]),this.maxY=Math.max(this.maxY,i[1],a[1],r[1],n[1])}updateScalingPathMinMax(t,e){s.Util.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,a,r,n,o,l,h,d){let c=s.Util.bezierBoundingBox(e,i,a,r,n,o,l,h,d);d||this.updateRectMinMax(t,c)}getPathBoundingBox(t=r,e=null){let i=[this.minX,this.minY,this.maxX,this.maxY];if(t===n){e||(0,s.unreachable)("Stroke bounding box must include transform.");let t=s.Util.singularValueDecompose2dScale(e),a=t[0]*this.lineWidth/2,r=t[1]*this.lineWidth/2;i[0]-=a,i[1]-=r,i[2]+=a,i[3]+=r}return i}updateClipFromPath(){let t=s.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=r,e=null){return s.Util.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function v(t,e){let i,a,r,n;if("u">typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);let o=e.height,l=e.width,h=o%16,d=(o-h)/16,c=0===h?d:d+1,u=t.createImageData(l,16),p=0,g,m=e.data,f=u.data;if(e.kind===s.ImageKind.GRAYSCALE_1BPP){let e=m.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),o=n.length,b=l+7>>3,v=s.FeatureTest.isLittleEndian?0xff000000:255;for(i=0;i<c;i++){for(r=i<d?16:h,g=0,a=0;a<r;a++){let t=e-p,i=0,s=t>b?l:8*t-7,a=-8&s,r=0,o=0;for(;i<a;i+=8)o=m[p++],n[g++]=128&o?0xffffffff:v,n[g++]=64&o?0xffffffff:v,n[g++]=32&o?0xffffffff:v,n[g++]=16&o?0xffffffff:v,n[g++]=8&o?0xffffffff:v,n[g++]=4&o?0xffffffff:v,n[g++]=2&o?0xffffffff:v,n[g++]=1&o?0xffffffff:v;for(;i<s;i++)0===r&&(o=m[p++],r=128),n[g++]=o&r?0xffffffff:v,r>>=1}for(;g<o;)n[g++]=0;t.putImageData(u,0,16*i)}}else if(e.kind===s.ImageKind.RGBA_32BPP){for(a=0,n=16*l*4,i=0;i<d;i++)f.set(m.subarray(p,p+n)),p+=n,t.putImageData(u,0,a),a+=16;i<c&&(n=l*h*4,f.set(m.subarray(p,p+n)),t.putImageData(u,0,a))}else if(e.kind===s.ImageKind.RGB_24BPP)for(r=16,n=l*r,i=0;i<c;i++){for(i>=d&&(r=h,n=l*r),g=0,a=n;a--;)f[g++]=m[p++],f[g++]=m[p++],f[g++]=m[p++],f[g++]=255;t.putImageData(u,0,16*i)}else throw Error(`bad image kind: ${e.kind}`)}function A(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);
1let i=e.height,a=e.width,r=i%16,n=(i-r)/16,o=0===r?n:n+1,l=t.createImageData(a,16),h=0,d=e.data,c=l.data;for(let e=0;e<o;e++){let i=e<n?16:r;({srcPos:h}=function({src:t,srcPos:e=0,dest:i,width:a,height:r,nonBlackColor:n=0xffffffff,inverseDecode:o=!1}){let l=s.FeatureTest.isLittleEndian?0xff000000:255,[h,d]=o?[n,l]:[l,n],c=a>>3,u=7&a,p=t.length;i=new Uint32Array(i.buffer);let g=0;for(let s=0;s<r;s++){for(let s=e+c;e<s;e++){let s=e<p?t[e]:255;i[g++]=128&s?d:h,i[g++]=64&s?d:h,i[g++]=32&s?d:h,i[g++]=16&s?d:h,i[g++]=8&s?d:h,i[g++]=4&s?d:h,i[g++]=2&s?d:h,i[g++]=1&s?d:h}if(0===u)continue;let s=e<p?t[e++]:255;for(let t=0;t<u;t++)i[g++]=s&1<<7-t?d:h}return{srcPos:e,destPos:g}}({src:d,srcPos:h,dest:c,width:a,height:i,nonBlackColor:0})),t.putImageData(l,0,16*e)}}function y(t,e){for(let i of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function _(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!s.isNodeJS){let{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function E(t,e,i){let s=t.length,a=1/255;for(let r=3;r<s;r+=4){let s=i?i[t[r]]:t[r];e[r]=e[r]*s*a|0}}function w(t,e,i){let s=t.length;for(let a=3;a<s;a+=4){let s=77*t[a-3]+152*t[a-2]+28*t[a-1];e[a]=i?e[a]*i[s>>8]>>8:e[a]*s>>16}}function x(t,e){if(e)return!0;let i=s.Util.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);let r=Math.fround((globalThis.devicePixelRatio||1)*a.PixelsPerInch.PDF_TO_CSS_UNITS);return i[0]<=r&&i[1]<=r}let T=["butt","round","square"],S=["miter","round","bevel"],C={},M={};class P{constructor(t,e,i,s,a,{optionalContentConfig:r,markedContentStack:n=null},o,l){this.ctx=t,this.current=new b(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=a,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=n||[],this.optionalContentConfig=r,this.cachedCanvases=new m(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:s=null}){let r=this.ctx.canvas.width,n=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,r,n),this.ctx.fillStyle=o,i){let t=this.cachedCanvases.getCanvas("transparent",r,n);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...(0,a.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),_(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=(0,a.getCurrentTransform)(this.ctx)}executeOperatorList(t,e,i,a){let r,n=t.argsArray,o=t.fnArray,l=e||0,h=n.length;if(h===l)return l;let d=h-l>10&&"function"==typeof i,c=d?Date.now()+15:0,u=0,p=this.commonObjs,g=this.objs;for(;;){if(void 0!==a&&l===a.nextBreakPoint)return a.breakIt(l,i),l;if((r=o[l])!==s.OPS.dependency)this[r].apply(this,n[l]);else for(let t of n[l]){let e=t.startsWith("g_")?p:g;if(!e.has(t))return e.get(t,i),l}if(++l===h)return l;if(d&&++u>10){if(Date.now()>c)return i(),l;u=0}}}#tl(){for(;this.stateStack.length||this.inSMaskMode;
1)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){for(let t of(this.#tl(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#th()}#th(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let i,s,a=t.width,r=t.height,n=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=a,h=r,d="prescale1";for(;n>2&&l>1||o>2&&h>1;){let e=l,a=h;n>2&&l>1&&(e=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),n/=l/e),o>2&&h>1&&(a=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/a),(s=(i=this.cachedCanvases.getCanvas(d,e,a)).context).clearRect(0,0,e,a),s.drawImage(t,0,0,l,h,0,0,e,a),t=i.canvas,l=e,h=a,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){let e,i,n,o,l=this.ctx,{width:h,height:d}=t,c=this.current.fillColor,u=this.current.patternFill,p=(0,a.getCurrentTransform)(l);if((t.bitmap||t.data)&&t.count>1){let s=t.bitmap||t.data.buffer;i=JSON.stringify(u?p:[p.slice(0,4),c]),(e=this._cachedBitmapsMap.get(s))||(e=new Map,this._cachedBitmapsMap.set(s,e));let a=e.get(i);if(a&&!u){let t=Math.round(Math.min(p[0],p[2])+p[4]),e=Math.round(Math.min(p[1],p[3])+p[5]);return{canvas:a,offsetX:t,offsetY:e}}n=a}n||(o=this.cachedCanvases.getCanvas("maskCanvas",h,d),A(o.context,t));let g=s.Util.transform(p,[1/h,0,0,-1/d,0,0]);g=s.Util.transform(g,[1,0,0,1,0,-d]);let[m,b,v,y]=s.Util.getAxialAlignedBoundingBox([0,0,h,d],g),_=Math.round(v-m)||1,E=Math.round(y-b)||1,w=this.cachedCanvases.getCanvas("fillCanvas",_,E),T=w.context;T.translate(-m,-b),T.transform(...g),!n&&(n=(n=this._scaleImage(o.canvas,(0,a.getCurrentTransformInverse)(T))).img,e&&u&&e.set(i,n)),T.imageSmoothingEnabled=x((0,a.getCurrentTransform)(T),t.interpolate),f(T,n,0,0,n.width,n.height,0,0,h,d),T.globalCompositeOperation="source-in";let S=s.Util.transform((0,a.getCurrentTransformInverse)(T),[1,0,0,1,-m,-b]);return T.fillStyle=u?c.getPattern(l,this,S,r):c,T.fillRect(0,0,h,d),e&&!u&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,w.canvas)),{canvas:w.canvas,offsetX:Math.round(m),offsetY:Math.round(b)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=T[t]}setLineJoin(t){this.ctx.lineJoin=S[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let[e,i]of t)switch(e){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)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;let r=this.ctx;r.setTransform(...(0,a.getCurrentTransform)(this.suspendedCtx)),y(this.suspendedCtx,r);var n=this.suspendedCtx;if(r._removeMirroring)throw Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){n.save(),this.__originalSave()}
1,r.restore=function(){n.restore(),this.__originalRestore()},r.translate=function(t,e){n.translate(t,e),this.__originalTranslate(t,e)},r.scale=function(t,e){n.scale(t,e),this.__originalScale(t,e)},r.transform=function(t,e,i,s,a,r){n.transform(t,e,i,s,a,r),this.__originalTransform(t,e,i,s,a,r)},r.setTransform=function(t,e,i,s,a,r){n.setTransform(t,e,i,s,a,r),this.__originalSetTransform(t,e,i,s,a,r)},r.resetTransform=function(){n.resetTransform(),this.__originalResetTransform()},r.rotate=function(t){n.rotate(t),this.__originalRotate(t)},r.clip=function(t){n.clip(t),this.__originalClip(t)},r.moveTo=function(t,e){n.moveTo(t,e),this.__originalMoveTo(t,e)},r.lineTo=function(t,e){n.lineTo(t,e),this.__originalLineTo(t,e)},r.bezierCurveTo=function(t,e,i,s,a,r){n.bezierCurveTo(t,e,i,s,a,r),this.__originalBezierCurveTo(t,e,i,s,a,r)},r.rect=function(t,e,i,s){n.rect(t,e,i,s),this.__originalRect(t,e,i,s)},r.closePath=function(){n.closePath(),this.__originalClosePath()},r.beginPath=function(){n.beginPath(),this.__originalBeginPath()},this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),y(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){var e,i,s;let a,r,n,o;if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let l=this.current.activeSMask;e=this.suspendedCtx,i=this.ctx,a=(s=t)[0],r=s[1],n=s[2]-a,o=s[3]-r,0!==n&&0!==o&&(!function(t,e,i,s,a,r,n,o,l,h,d){let c=!!r,u=c?r[0]:0,p=c?r[1]:0,g=c?r[2]:0,m="Luminosity"===a?w:E,f=Math.min(s,Math.ceil(1048576/i));for(let a=0;a<s;a+=f){let r=Math.min(f,s-a),b=t.getImageData(o-h,a+(l-d),i,r),v=e.getImageData(o,a+l,i,r);c&&function(t,e,i,s){let a=t.length;for(let r=3;r<a;r+=4){let a=t[r];if(0===a)t[r-3]=e,t[r-2]=i,t[r-1]=s;else if(a<255){let n=255-a;t[r-3]=t[r-3]*a+e*n>>8,t[r-2]=t[r-2]*a+i*n>>8,t[r-1]=t[r-1]*a+s*n>>8}}}(b.data,u,p,g),m(b.data,v.data,n),e.putImageData(v,o,a+l)}}(l.context,i,n,o,l.subtype,l.backdrop,l.transferMap,a,r,l.offsetX,l.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,0,0),e.restore()),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()}save(){this.inSMaskMode?(y(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),y(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,a,r){this.ctx.transform(t,e,i,s,a,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let r,n,o=this.ctx,l=this.current,h=l.x,d=l.y,c=(0,a.getCurrentTransform)(o),u=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],p=u?i.slice(0):null;for(let i=0,a=0,g=t.length;i<g;i++)switch(0|t[i]){case s.OPS.rectangle:h=e[a++],d=e[a++];let g=e[a++],m=e[a++],f=h+g,b=d+m;o.moveTo(h,d),0===g||0===m?o.lineTo(f,b):(o.lineTo(f,d),o.lineTo(f,b),o.lineTo(h,b)),u||l.updateRectMinMax(c,[h,d,f,b]),o.closePath();break;case s.OPS.moveTo:h=e[a++],d=e[a++],o.moveTo(h,d),u||l.updatePathMinMax(c,h,d);break;case s.OPS.lineTo:h=e[a++],d=e[a++],o.lineTo(h,d),u||l.updatePathMinMax(c,h,d);break;case s.OPS.curveTo:r=h,n=d,h=e[a+4],d=e[a+5],o.bezierCurveTo(e[a],e[a+1],e[a+2],e[a+3],h,d),l.updateCurvePathMinMax(c,r,n,e[a],e[a+1],e[a+2],e[a+3],h,d,p),a+=6;break;case s.OPS.curveTo2:r=h,n=d,o.bezierCurveTo(h,d,e[a],e[a+1],e[a+2],e[a+3]),l.updateCurvePathMinMax(c,r,n,h,d,e[a],e[a+1],e[a+2],e[a+3],p),h=e[a+2],d=e[a+3],a+=4;break;case s.OPS.curveTo3:r=h,n=d,h=e[a+2],d=e[a+3],o.bezierCurveTo(e[a],e[a+1],h,d,h,d),l.updateCurvePathMinMax(c,r,n,e[a],e[a+1],h,d,h,d,p),a+=4;break;case s.OPS.closePath:o.closePath()}u&&l.updateScalingPathMinMax(c,p),l.setCurrentPoint(h,d)}closePath(){this.ctx.closePath()}stroke(t=!0){let e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&i?.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,(0,a.getCurrentTransformInverse)(e),n),this.rescaleAndStroke(!1),e.restore(
1)):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill,n=!1;s&&(e.save(),e.fillStyle=i.getPattern(e,this,(0,a.getCurrentTransformInverse)(e),r),n=!0);let o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),t&&this.consumePath(o)}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=C}eoClip(){this.pendingClip=M}beginText(){this.current.textMatrix=s.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let t=this.pendingTextPaths,e=this.ctx;if(void 0===t)return void e.beginPath();for(let i of(e.save(),e.beginPath(),t))e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){let i=this.commonObjs.get(t),a=this.current;if(!i)throw Error(`Can't find font for ${t}`);if(a.fontMatrix=i.fontMatrix||s.FONT_IDENTITY_MATRIX,(0===a.fontMatrix[0]||0===a.fontMatrix[3])&&(0,s.warn)("Invalid font matrix for font "+t),e<0?(e=-e,a.fontDirection=-1):a.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;let r=i.loadedName||"sans-serif",n=i.systemFontInfo?.css||`"${r}", ${i.fallbackName}`,o="normal";i.black?o="900":i.bold&&(o="bold");let l=i.italic?"italic":"normal",h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${o} ${h}px ${n}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,s,a,r){this.current.textMatrix=[t,e,i,s,a,r],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,r){let n,o=this.ctx,l=this.current,h=l.font,d=l.textRenderingMode,c=l.fontSize/l.fontSizeScale,u=d&s.TextRenderingMode.FILL_STROKE_MASK,p=!!(d&s.TextRenderingMode.ADD_TO_PATH_FLAG),g=l.patternFill&&!h.missingFile;(h.disableFontFace||p||g)&&(n=h.getPathGenerator(this.commonObjs,t)),h.disableFontFace||g?(o.save(),o.translate(e,i),o.beginPath(),n(o,c),r&&o.setTransform(...r),(u===s.TextRenderingMode.FILL||u===s.TextRenderingMode.FILL_STROKE)&&o.fill(),(u===s.TextRenderingMode.STROKE||u===s.TextRenderingMode.FILL_STROKE)&&o.stroke(),o.restore()):((u===s.TextRenderingMode.FILL||u===s.TextRenderingMode.FILL_STROKE)&&o.fillText(t,e,i),(u===s.TextRenderingMode.STROKE||u===s.TextRenderingMode.FILL_STROKE)&&o.strokeText(t,e,i)),p&&(this.pendingTextPaths||=[]).push({transform:(0,a.getCurrentTransform)(o),x:e,y:i,fontSize:c,addToPath:n})}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return(0,s.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(t){let e,i=this.current,n=i.font;if(n.isType3Font)return this.showType3Text(t);let o=i.fontSize;if(0===o)return;let l=this.ctx,h=i.fontSizeScale,d=i.charSpacing,c=i.wordSpacing,u=i.fontDirection,p=i.textHScale*u,g=t.length,m=n.vertical,f=m?1:-1,b=n.defaultVMetrics,v=o*i.fontMatrix[0],A=i.textRenderingMode===s.TextRenderingMode.FILL&&!n.disableFontFace&&!i.patternFill;if(l.save(),l.transform(...i.textMatrix),l.translate(i.x,i.y+i.textRise),u>0?l.scale(p,-1):l.scale(p,1),i.patternFill){l.save();let t=i.fillColor.getPattern(l,this,(0,a.getCurrentTransformInverse)(l),r);
1e=(0,a.getCurrentTransform)(l),l.restore(),l.fillStyle=t}let y=i.lineWidth,_=i.textMatrixScale;if(0===_||0===y){let t=i.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;(t===s.TextRenderingMode.STROKE||t===s.TextRenderingMode.FILL_STROKE)&&(y=this.getSinglePixelWidth())}else y/=_;if(1!==h&&(l.scale(h,h),y/=h),l.lineWidth=y,n.isInvalidPDFjsFont){let e=[],s=0;for(let i of t)e.push(i.unicode),s+=i.width;l.fillText(e.join(""),0,0),i.x+=s*v*p,l.restore(),this.compose();return}let E=0,w;for(w=0;w<g;++w){let i,s,a=t[w];if("number"==typeof a){E+=f*a*o/1e3;continue}let r=!1,p=(a.isSpace?c:0)+d,g=a.fontChar,y=a.accent,_=a.width;if(m){let t=a.vmetric||b,e=-(a.vmetric?t[1]:.5*_)*v,r=t[2]*v;_=t?-t[0]:_,i=e/h,s=(E+r)/h}else i=E/h,s=0;if(n.remeasure&&_>0){let t=1e3*l.measureText(g).width/o*h;if(_<t&&this.isFontSubpixelAAEnabled){let e=_/t;r=!0,l.save(),l.scale(e,1),i/=e}else _!==t&&(i+=(_-t)/2e3*o/h)}if(this.contentVisible&&(a.isInFont||n.missingFile)){if(A&&!y)l.fillText(g,i,s);else if(this.paintChar(g,i,s,e),y){let t=i+o*y.offset.x/h,a=s-o*y.offset.y/h;this.paintChar(y.fontChar,t,a,e)}}let x=m?_*v-p*u:_*v+p*u;E+=x,r&&l.restore()}m?i.y-=E:i.x+=E*p,l.restore(),this.compose()}showType3Text(t){let e,i,a,r,n=this.ctx,o=this.current,l=o.font,h=o.fontSize,d=o.fontDirection,c=l.vertical?1:-1,u=o.charSpacing,p=o.wordSpacing,g=o.textHScale*d,m=o.fontMatrix||s.FONT_IDENTITY_MATRIX,f=t.length;if(o.textRenderingMode!==s.TextRenderingMode.INVISIBLE&&0!==h){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),n.transform(...o.textMatrix),n.translate(o.x,o.y),n.scale(g,d),e=0;e<f;++e){if(i=t[e],"number"==typeof i){r=c*i*h/1e3,this.ctx.translate(r,0),o.x+=r*g;continue}let d=(i.isSpace?p:0)+u,f=l.charProcOperatorList[i.operatorListId];if(!f){(0,s.warn)(`Type3 character "${i.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=i,this.save(),n.scale(h,h),n.transform(...m),this.executeOperatorList(f),this.restore()),a=s.Util.applyTransform([i.width,0],m)[0]*h+d,n.translate(a,0),o.x+=a*g}n.restore(),this.processingType3=null}}setCharWidth(t,e){}
1setCharWidthAndBounds(t,e,i,s,a,r){this.ctx.rect(i,s,a-i,r-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){let i=t[1],s=this.baseTransform||(0,a.getCurrentTransform)(this.ctx);e=new g(t,i,this.ctx,{createCanvasGraphics:t=>new P(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){let a=s.Util.makeHexColor(t,e,i);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,e,i){let a=s.Util.makeHexColor(t,e,i);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,e=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=function(t){switch(t[0]){case"RadialAxial":return new d(t);case"Mesh":return new u(t);case"Dummy":return new p}throw Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t)),this.cachedPatterns.set(t,i)),e&&(i.matrix=e),i}shadingFill(t){if(!this.contentVisible)return;let e=this.ctx;this.save(),e.fillStyle=this._getPattern(t).getPattern(e,this,(0,a.getCurrentTransformInverse)(e),o);let i=(0,a.getCurrentTransformInverse)(e);if(i){let{width:t,height:a}=e.canvas,[r,n,o,l]=s.Util.getAxialAlignedBoundingBox([0,0,t,a],i);this.ctx.fillRect(r,n,o-r,l-n)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,s.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,s.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(t)&&6===t.length&&this.transform(...t),this.baseTransform=(0,a.getCurrentTransform)(this.ctx),e)){let t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax((0,a.getCurrentTransform)(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let e=this.ctx;t.isolated||(0,s.info)("TODO: Support non-isolated groups."),t.knockout&&(0,s.warn)("Knockout groups not supported.");let i=(0,a.getCurrentTransform)(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let r=s.Util.getAxialAlignedBoundingBox(t.bbox,(0,a.getCurrentTransform)(e)),n=[0,0,e.canvas.width,e.canvas.height];r=s.Util.intersect(r,n)||[0,0,0,0];let o=Math.floor(r[0]),l=Math.floor(r[1]),h=Math.max(Math.ceil(r[2])-o,1),d=Math.max(Math.ceil(r[3])-l,1),c=1,u=1;h>4096&&(c=h/4096,h=4096),d>4096&&(u=d/4096,d=4096),this.current.startNewPathAndClipBox([0,0,h,d]);let p="groupAt"+this.groupLevel;t.smask&&(p+="_smask_"+this.smaskCounter++%2);let g=this.cachedCanvases.getCanvas(p,h,d),m=g.context;m.scale(1/c,1/u),m.translate(-o,-l),m.transform(...i),t.smask?this.smaskStack.push({canvas:g.canvas,context:m,offsetX:o,offsetY:l,scaleX:c,scaleY:u,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(o,l),e.scale(c,u),e.save()),y(e,m),this.ctx=m,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;let e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let t=(0,a.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);let i=s.Util.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}
1beginAnnotation(t,e,i,r,n){if(this.#tl(),_(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(e)&&4===e.length){let r=e[2]-e[0],o=e[3]-e[1];if(n&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=r,e[3]=o;let[n,l]=s.Util.singularValueDecompose2dScale((0,a.getCurrentTransform)(this.ctx)),{viewportScale:h}=this,d=Math.ceil(r*this.outputScaleX*h),c=Math.ceil(o*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(d,c);let{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(n,0,0,-l,0,o*l),_(this.ctx)}else _(this.ctx),this.ctx.rect(e[0],e[1],r,o),this.ctx.clip(),this.endPath()}this.current=new b(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#th(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;let e=t.count;(t=this.getObject(t.data,t)).count=e;let i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){let e,i,s,{width:a,height:r}=t;if(a>1e3||r>1e3)return null;let n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),o=a+1,l=new Uint8Array(o*(r+1)),h=a+7&-8,d=new Uint8Array(h*r),c=0;for(let e of t.data){let t=128;for(;t>0;)d[c++]=e&t?0:255,t>>=1}let u=0;for(c=0,0!==d[c]&&(l[0]=1,++u),i=1;i<a;i++)d[c]!==d[c+1]&&(l[i]=d[c]?2:1,++u),c++;for(0!==d[c]&&(l[i]=2,++u),e=1;e<r;e++){c=e*h,s=e*o,d[c-h]!==d[c]&&(l[s]=d[c]?1:8,++u);let t=4*!!d[c]+8*!!d[c-h];for(i=1;i<a;i++)n[t=(t>>2)+4*!!d[c+1]+8*!!d[c-h+1]]&&(l[s+i]=n[t],++u),c++;if(d[c-h]!==d[c]&&(l[s+i]=d[c]?2:4,++u),u>1e3)return null}for(c=h*(r-1),s=e*o,0!==d[c]&&(l[s]=8,++u),i=1;i<a;i++)d[c]!==d[c+1]&&(l[s+i]=d[c]?4:8,++u),c++;if(0!==d[c]&&(l[s+i]=4,++u),u>1e3)return null;let p=new Int32Array([0,o,-1,0,-o,0,0,0,1]),g=new Path2D;for(e=0;u&&e<=r;e++){let t=e*o,i=t+a;for(;t<i&&!l[t];)t++;if(t===i)continue;g.moveTo(t%o,e);let s=t,r=l[t];do{let e=p[r];do t+=e;while(!l[t]);let i=l[t];5!==i&&10!==i?(r=i,l[t]=0):(r=i&51*r>>4,l[t]&=r>>2|r<<2),g.lineTo(t%o,t/o|0),!l[t]&&--u}while(s!==t);--e}return d=null,l=null,function(t){t.save(),t.scale(1/a,-1/r),t.translate(0,-r),t.fill(g),t.beginPath(),t.restore()}}(t)),s.compiled))return void s.compiled(i);let a=this._createMaskCanvas(t),r=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,a.offsetX,a.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,r=0,n,o){if(!this.contentVisible)return;t=this.getObject(t.data,t);let l=this.ctx;l.save();let h=(0,a.getCurrentTransform)(l);l.transform(e,i,r,n,0,0);let d=this._createMaskCanvas(t);l.setTransform(1,0,0,1,d.offsetX-h[4],d.offsetY-h[5]);for(let t=0,a=o.length;t<a;t+=2){let a=s.Util.transform(h,[e,i,r,n,o[t],o[t+1]]),[c,u]=s.Util.applyTransform([0,0],a);l.drawImage(d.canvas,c,u)}l.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(let n of t){let{data:t,width:o,height:l,transform:h}=n,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),c=d.context;c.save();let u=this.getObject(t,n);A(c,u),c.globalCompositeOperation="source-in",c.fillStyle=s?i.getPattern(c,this,(0,a.getCurrentTransformInverse)(e),r):i,c.fillRect(0,0,o,l),c.restore(),e.save(),e.transform(...h),e.scale(1,-1),f(e,d.canvas,0,0,o,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;let e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,s.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,a){if(!this.contentVisible)return;let r=this.getObject(t);if(!r)return void(0,s.warn)("Dependent image isn't ready yet");let n=r.width,o=r.height,l=[];for(let t=0,s=a.length;t<s;t+=2)l.push({transform:[e,0,0,i,a[t],a[t+1]],x:0,y:0,w:n,h:o});this.paintInlineImageXObjectGroup(r,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;let{bitmap:e,width:i,height:s}=t,a=this.cachedCanvases.getCanvas("inlineImage",i,s),r=a.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",a.canvas}paintInlineImageXObject(t){let e;if(!this.contentVisible)return;let i=t.width,r=t.height,n=this.ctx;if(this.save(),!s.isNodeJS){let{filter:t}=n;"none"!==t&&""!==t&&(n.filter="none")}if(n.scale(1/i,-1/r),t.bitmap)e=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)e=t;else{let s=this.cachedCanvases.getCanvas("inlineImage",i,r).context;v(s,t),e=this.applyTransferMapsToCanvas(s)}let o=this._scaleImage(e,(0,a.getCurrentTransformInverse)(n));n.imageSmoothingEnabled=x((0,a.getCurrentTransform)(n),t.interpolate),f(n,o.img,0,0,o.paintWidth,o.paintHeight,0,-r,i,r),this.compose(),this.restore(
1)}paintInlineImageXObjectGroup(t,e){let i;if(!this.contentVisible)return;let s=this.ctx;if(t.bitmap)i=t.bitmap;else{let e=t.width,s=t.height,a=this.cachedCanvases.getCanvas("inlineImage",e,s).context;v(a,t),i=this.applyTransferMapsToCanvas(a)}for(let t of e)s.save(),s.transform(...t.transform),s.scale(1,-1),f(s,i,t.x,t.y,t.w,t.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){let e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);let i=this.ctx;this.pendingClip&&(e||(this.pendingClip===M?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=(0,a.getCurrentTransform)(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let t,e,{lineWidth:i}=this.current,{a:s,b:a,c:r,d:n}=this.ctx.getTransform();if(0===a&&0===r){let a=Math.abs(s),r=Math.abs(n);if(a===r)if(0===i)t=e=1/a;else{let s=a*i;t=e=s<1?1/s:1}else if(0===i)t=1/a,e=1/r;else{let s=a*i,n=r*i;t=s<1?1/s:1,e=n<1?1/n:1}}else{let o=Math.abs(s*n-a*r),l=Math.hypot(s,a),h=Math.hypot(r,n);if(0===i)t=h/o,e=l/o;else{let s=i*o;t=h>s?h/s:1,e=l>s?l/s:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t){let{ctx:e}=this,{lineWidth:i}=this.current,[s,a]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===a)return void e.stroke();let r=e.getLineDash();if(t&&e.save(),e.scale(s,a),r.length>0){let t=Math.max(s,a);e.setLineDash(r.map(e=>e/t)),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(let t in s.OPS)void 0!==P.prototype[t]&&(P.prototype[s.OPS[t]]=P.prototype[t])},419:(t,e,i)=>{let s;i.d(e,{DOMCMapReaderFactory:()=>c,DOMCanvasFactory:()=>h,DOMFilterFactory:()=>l,DOMSVGFactory:()=>p,DOMStandardFontDataFactory:()=>u,PDFDateString:()=>w,PageViewport:()=>g,PixelsPerInch:()=>o,RenderingCancelledException:()=>m,StatTimer:()=>y,fetchData:()=>d,getColorValues:()=>S,getCurrentTransform:()=>C,getCurrentTransformInverse:()=>M,getFilenameFromUrl:()=>v,getPdfFilenameFromUrl:()=>A,getRGB:()=>T,getXfaPageViewport:()=>x,isDataScheme:()=>f,isPdfFile:()=>b,isValidFetchUrl:()=>_,noContextMenu:()=>E,setLayerDimensions:()=>P});var a=i(583),r=i(292);let n="http://www.w3.org/2000/svg";class o{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class l extends a.BaseFilterFactory{#td;#tc;#j;#tu;#tp;#tg=0;constructor({docId:t,ownerDocument:e=globalThis.document}={}){super(),this.#j=t,this.#tu=e}get #tm(){return this.#td||=new Map}get #tf(){return this.#tp||=new Map}get #tb(){if(!this.#tc){let t=this.#tu.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let i=this.#tu.createElementNS(n,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#tc=this.#tu.createElementNS(n,"defs"),t.append(i),i.append(this.#tc),this.#tu.body.append(t)}return this.#tc}addFilter(t){let e,i,s,a;if(!t)return"none";let r=this.#tm.get(t);if(r)return r;if(1===t.length){let r=t[0],n=Array(256);for(let t=0;t<256;t++)n[t]=r[t]/255;a=e=i=s=n.join(",")}else{let[r,n,o]=t,l=Array(256),h=Array(256),d=Array(256);for(let t=0;t<256;t++)l[t]=r[t]/255,h[t]=n[t]/255,d[t]=o[t]/255;e=l.join(","),i=h.join(","),s=d.join(","),a=`${e}${i}${s}`}if(r=this.#tm.get(a))return this.#tm.set(t,r),r;let n=`g_${this.#j}_transfer_map_${this.#tg++}`,o=`url(#${n})`;this.#tm.set(t,o),this.#tm.set(a,o);let l=this.#tv(n);return this.#tA(e,i,s,l),o}addHCMFilter(t,e){let i=`${t}-${e}`,s="base",a=this.#tf.get(s);if(a?.key===i||(a?(a.filter?.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},this.#tf.set(s,a)),!t||!e))return a.url;let n=this.#ty(t);t=r.Util.makeHexColor(...n);let o=this.#ty(e);if(e=r.Util.makeHexColor(...o),this.#tb.style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;let l=Array(256);for(let t=0;t<=255;t++){let e=t/255;l[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let h=l.join(","),d=`g_${this.#j}_hcm_filter`,c=a.filter=this.#tv(d);this.#tA(h,h,h,c),this.#t_(c);let u=(t,e)=>{let i=n[t]/255,s=o[t]/255,a=Array(e+1);for(let t=0;t<=e;t++)a[t]=i+t/e*(s-i);return a.join(",")};return this.#tA(u(0,5),u(1,5),u(2,5),c),a.url=`url(#${d})`,a.url}addHighlightHCMFilter(t,e,i,s,a){let r=`${e}-${i}-${s}-${a}`,n=this.#tf.get(t);if(n?.key===r||(n?(n.filter?.remove(),n.key=r,n.url="none",n.filter=null):(n={key:r,url:"none",filter:null},this.#tf.set(t,n)),!e||!i))return n.url;let[o,l]=[e,i].map(this.#ty.bind(this)),h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[c,u]=[s,a].map(this.#ty.bind(this));d<h&&([h,d,c,u]=[d,h,u,c]),this.#tb.style.color="";let p=(t,e,i)=>{let s=Array(256),a=(d-h)/i,r=t/255,n=(e-t)/(255*i),o=0;for(let t=0;t<=i;t++){let e=Math.round(h+t*a),i=r+t*n;for(let t=o;t<=e;t++)s[t]=i;o=e+1}for(let t=o;t<256;t++)s[t]=s[o-1];return s.join(",")},g=`g_${this.#j}_hcm_${t}_filter`,m=n.filter=this.#tv(g);return this.#t_(m),this.#tA(p(c[0],u[0],5),p(c[1],u[1],5),p(c[2],u[2],5),m),n.url=`url(#${g})`,n.url}destroy(t=!1){t&&0!==this.#tf.size||(this.#tc&&(this.#tc.parentNode.parentNode.remove(),this.#tc=null),this.#td&&(this.#td.clear(),this.#td=null),this.#tg=0)}#t_(t){let e=this.#tu.createElementNS(n,"feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)}#tv(t){let e=this.#tu.createElementNS(n,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#tb.append(e),e}#tE(t,e,i){let s=this.#tu.createElementNS(n,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}#tA(t,e,i,s){let a=this.#tu.createElementNS(n,"feComponentTransfer");
1s.append(a),this.#tE(a,"feFuncR",t),this.#tE(a,"feFuncG",e),this.#tE(a,"feFuncB",i)}#ty(t){return this.#tb.style.color=t,T(getComputedStyle(this.#tb).getPropertyValue("color"))}}class h extends a.BaseCanvasFactory{constructor({ownerDocument:t=globalThis.document}={}){super(),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}async function d(t,e="text"){if(_(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{let a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(200===a.status||0===a.status){switch(e){case"arraybuffer":case"blob":case"json":i(a.response);return}i(a.responseText);return}s(Error(a.statusText))}},a.send(null)})}class c extends a.BaseCMapReaderFactory{_fetchData(t,e){return d(t,this.isCompressed?"arraybuffer":"text").then(t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):(0,r.stringToBytes)(t),compressionType:e}))}}class u extends a.BaseStandardFontDataFactory{_fetchData(t){return d(t,"arraybuffer").then(t=>new Uint8Array(t))}}class p extends a.BaseSVGFactory{_createSVG(t){return document.createElementNS(n,t)}}class g{constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:a=0,dontFlip:r=!1}){let n,o,l,h,d,c,u,p;this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=a;const g=(t[2]+t[0])/2,m=(t[3]+t[1])/2;switch((i%=360)<0&&(i+=360),i){case 180:n=-1,o=0,l=0,h=1;break;case 90:n=0,o=1,l=1,h=0;break;case 270:n=0,o=-1,l=-1,h=0;break;case 0:n=1,o=0,l=0,h=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(l=-l,h=-h),0===n?(d=Math.abs(m-t[1])*e+s,c=Math.abs(g-t[0])*e+a,u=(t[3]-t[1])*e,p=(t[2]-t[0])*e):(d=Math.abs(g-t[0])*e+s,c=Math.abs(m-t[1])*e+a,u=(t[2]-t[0])*e,p=(t[3]-t[1])*e),this.transform=[n*e,o*e,l*e,h*e,d-n*e*g-l*e*m,c-o*e*g-h*e*m],this.width=u,this.height=p}get rawDims(){let{viewBox:t}=this;return(0,r.shadow)(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}={}){return new g({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}convertToViewportPoint(t,e){return r.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=r.Util.applyTransform([t[0],t[1]],this.transform),i=r.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return r.Util.applyInverseTransform([t,e],this.transform)}}class m extends r.BaseException{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function f(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function b(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function v(t,e=!1){return e||([t]=t.split(/[#?]/,1)),t.substring(t.lastIndexOf("/")+1)}function A(t,e="document.pdf"){if("string"!=typeof t)return e;if(f(t))return(0,r.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t),a=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(a&&(a=a[0]).includes("%"))try{a=i.exec(decodeURIComponent(a))[0]}catch{}return a||e}class y{started=Object.create(null);times=[];time(t){t in this.started&&(0,r.warn)(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,r.warn)(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:t}of this.times)e=Math.max(t.length,e);for(let{name:i,start:s,end:a}of this.times)t.push(`${i.padEnd(e)} ${a-s}ms
2`);return t.join("")}}function _(t,e){try{let{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch{return!1}}function E(t){t.preventDefault()}class w{static toDateObject(t){if(!t||"string"!=typeof t)return null;let e=(s||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")).exec(t);if(!e)return null;let i=parseInt(e[1],10),a=parseInt(e[2],10);a=a>=1&&a<=12?a-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let n=parseInt(e[4],10);n=n>=0&&n<=23?n:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;let h=e[7]||"Z",d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let c=parseInt(e[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===h?(n+=d,o+=c):"+"===h&&(n-=d,o-=c),new Date(Date.UTC(i,a,r,n,o,l))}}function x(t,{scale:e=1,rotation:i=0}){let{width:s,height:a}=t.attributes.style,r=[0,0,parseInt(s),parseInt(a)];return new g({viewBox:r,scale:e,rotation:i})}function T(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(0xff0000&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):((0,r.warn)(`Not a valid color format: "${t}"`),[0,0,0])}function S(t){let e=document.createElement("span");for(let i of(e.style.visibility="hidden",document.body.append(e),t.keys())){e.style.color=i;let s=window.getComputedStyle(e).color;t.set(i,T(s))}e.remove()}function C(t){let{a:e,b:i,c:s,d:a,e:r,f:n}=t.getTransform();return[e,i,s,a,r,n]}function M(t){let{a:e,b:i,c:s,d:a,e:r,f:n}=t.getTransform().invertSelf();return[e,i,s,a,r,n]}function P(t,e,i=!1,s=!0){if(e instanceof g){let{pageWidth:s,pageHeight:a}=e.rawDims,{style:n}=t,o=r.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${s}px`,h=`var(--scale-factor) * ${a}px`,d=o?`round(${l}, 1px)`:`calc(${l})`,c=o?`round(${h}, 1px)`:`calc(${h})`;i&&e.rotation%180!=0?(n.width=c,n.height=d):(n.width=d,n.height=c)}s&&t.setAttribute("data-main-rotation",e.rotation)}},47:(t,e,i)=>{i.d(e,{DrawLayer:()=>r});var s=i(419),a=i(292);class r{#A=null;#tg=0;#tw=new Map;#tx=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#A){this.#A=t;return}if(this.#A!==t){if(this.#tw.size>0)for(let e of this.#tw.values())e.remove(),t.append(e);this.#A=t}}static get _svgFactory(){return(0,a.shadow)(this,"_svgFactory",new s.DOMSVGFactory)}static #tT(t,{x:e=0,y:i=0,width:s=1,height:a=1}={}){let{style:r}=t;r.top=`${100*i}%`,r.left=`${100*e}%`,r.width=`${100*s}%`,r.height=`${100*a}%`}#tS(t){let e=r._svgFactory.create(1,1,!0);return this.#A.append(e),e.setAttribute("aria-hidden",!0),r.#tT(e,t),e}#tC(t,e){let i=r._svgFactory.createElement("clipPath");t.append(i);let s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let a=r._svgFactory.createElement("use");return i.append(a),a.setAttribute("href",`#${e}`),a.classList.add("clip"),s}highlight(t,e,i,s=!1){let a=this.#tg++,n=this.#tS(t.box);n.classList.add("highlight"),t.free&&n.classList.add("free");let o=r._svgFactory.createElement("defs");n.append(o);let l=r._svgFactory.createElement("path");o.append(l);let h=`path_p${this.pageIndex}_${a}`;l.setAttribute("id",h),l.setAttribute("d",t.toSVGPath()),s&&this.#tx.set(a,l);let d=this.#tC(o,h),c=r._svgFactory.createElement("use");return n.append(c),n.setAttribute("fill",e),n.setAttribute("fill-opacity",i),c.setAttribute("href",`#${h}`),this.#tw.set(a,n),{id:a,clipPathId:`url(#${d})`}}highlightOutline(t){let e,i=this.#tg++,s=this.#tS(t.box);s.classList.add("highlightOutline");let a=r._svgFactory.createElement("defs");s.append(a);let n=r._svgFactory.createElement("path");a.append(n);let o=`path_p${this.pageIndex}_${i}`;if(n.setAttribute("id",o),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke"),t.free){s.classList.add("free");let t=r._svgFactory.createElement("mask");a.append(t),e=`mask_p${this.pageIndex}_${i}`,t.setAttribute("id",e),t.setAttribute("maskUnits","objectBoundingBox");let n=r._svgFactory.createElement("rect");t.append(n),n.setAttribute("width","1"),n.setAttribute("height","1"),n.setAttribute("fill","white");let l=r._svgFactory.createElement("use");t.append(l),l.setAttribute("href",`#${o}`),l.setAttribute("stroke","none"),l.setAttribute("fill","black"),l.setAttribute("fill-rule","nonzero"),l.classList.add("mask")}let l=r._svgFactory.createElement("use");s.append(l),l.setAttribute("href",`#${o}`),e&&l.setAttribute("mask",`url(#${e})`);let h=l.cloneNode();return s.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.#tw.set(i,s),i}finalizeLine(t,e){let i=this.#tx.get(t);this.#tx.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}
2updateLine(t,e){this.#tw.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),this.#tx.delete(t)}updatePath(t,e){this.#tx.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){r.#tT(this.#tw.get(t),e)}show(t,e){this.#tw.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#tw.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#tw.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#tw.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#tw.get(t).classList.add(e)}removeClass(t,e){this.#tw.get(t).classList.remove(e)}remove(t){null!==this.#A&&(this.#tw.get(t).remove(),this.#tw.delete(t))}destroy(){for(let t of(this.#A=null,this.#tw.values()))t.remove();this.#tw.clear()}}},731:(t,e,i)=>{i.d(e,{AnnotationEditorLayer:()=>m});var s=i(292),a=i(310),r=i(830),n=i(976);let o=/\r\n?|\n/g;class l extends a.AnnotationEditor{#tM=this.editorDivBlur.bind(this);#tP=this.editorDivFocus.bind(this);#tR=this.editorDivInput.bind(this);#tk=this.editorDivKeydown.bind(this);#tI=this.editorDivPaste.bind(this);#g;#tD="";#tL=`${this.id}-editor`;#tF;#tO=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=l.prototype,e=t=>t.isEmpty(),i=r.AnnotationEditorUIManager.TRANSLATE_SMALL,a=r.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,s.shadow)(this,"_keyboardManager",new r.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-a,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[a,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-a],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,a],checker:e}]]))}static _type="freetext";static _editorType=s.AnnotationEditorType.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#g=t.color||l._defaultColor||a.AnnotationEditor._defaultLineColor,this.#tF=t.fontSize||l._defaultFontSize}static initialize(t,e){a.AnnotationEditor.initialize(t,e,{strings:["pdfjs-free-text-default-content"]});let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case s.AnnotationEditorParamsType.FREETEXT_SIZE:l._defaultFontSize=e;break;case s.AnnotationEditorParamsType.FREETEXT_COLOR:l._defaultColor=e}}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.FREETEXT_SIZE:this.#tN(e);break;case s.AnnotationEditorParamsType.FREETEXT_COLOR:this.#tB(e)}}static get defaultPropertiesToUpdate(){return[[s.AnnotationEditorParamsType.FREETEXT_SIZE,l._defaultFontSize],[s.AnnotationEditorParamsType.FREETEXT_COLOR,l._defaultColor||a.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[s.AnnotationEditorParamsType.FREETEXT_SIZE,this.#tF],[s.AnnotationEditorParamsType.FREETEXT_COLOR,this.#g]]}#tN(t){let e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-this.#tF)*this.parentScale),this.#tF=t,this.#tH()},i=this.#tF;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#tB(t){let e=t=>{this.#g=this.editorDiv.style.color=t},i=this.#g;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-l._internalPadding*t,-(l._internalPadding+this.#tF)*t]}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(s.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.#tk),this.editorDiv.addEventListener("focus",this.#tP),this.editorDiv.addEventListener("blur",this.#tM),this.editorDiv.addEventListener("input",this.#tR),this.editorDiv.addEventListener("paste",this.#tI))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#tL),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#tk),this.editorDiv.removeEventListener("focus",this.#tP),this.editorDiv.removeEventListener("blur",this.#tM),this.editorDiv.removeEventListener("input",this.#tR),this.editorDiv.removeEventListener("paste",this.#tI),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(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()}#tU(){let t=[];
2for(let e of(this.editorDiv.normalize(),this.editorDiv.childNodes))t.push(l.#tz(e));return t.join("\n")}#tH(){let t,[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,s=i.style.display,a=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=s,i.classList.toggle("hidden",a)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#tD,e=this.#tD=this.#tU().trimEnd();if(t===e)return;let i=t=>{(this.#tD=t,t)?(this.#t$(),this._uiManager.rebuild(this),this.#tH()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#tH()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){l._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#tL),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),a.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then(t=>this.editorDiv?.setAttribute("default-content",t)),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#tF}px * var(--scale-factor))`,i.color=this.#g,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,r.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){let[i,s]=this.parentDimensions;if(this.annotationElementId){let a,r,{position:n}=this.#tO,[o,l]=this.getInitialTranslation();[o,l]=this.pageTranslationToScreen(o,l);let[h,d]=this.pageDimensions,[c,u]=this.pageTranslation;switch(this.rotation){case 0:a=t+(n[0]-c)/h,r=e+this.height-(n[1]-u)/d;break;case 90:a=t+(n[0]-c)/h,r=e-(n[1]-u)/d,[o,l]=[l,-o];break;case 180:a=t-this.width+(n[0]-c)/h,r=e-(n[1]-u)/d,[o,l]=[-o,-l];break;case 270:a=t+(n[0]-c-this.height*d)/h,r=e+(n[1]-u-this.width*h)/d,[o,l]=[-l,o]}this.setAt(a*i,r*s,o,l)}else this.setAt(t*i,e*s,this.width*i,this.height*s);this.#t$(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static #tz(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(o,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let s=l.#tj(e.getData("text")||"").replaceAll(o,"\n");if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let r=a.getRangeAt(0);
2if(!s.includes("\n")){r.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:n,startOffset:h}=r,d=[],c=[];if(n.nodeType===Node.TEXT_NODE){let t=n.parentElement;if(c.push(n.nodeValue.slice(h).replaceAll(o,"")),t!==this.editorDiv){let e=d;for(let i of this.editorDiv.childNodes){if(i===t){e=c;continue}e.push(l.#tz(i))}}d.push(n.nodeValue.slice(0,h).replaceAll(o,""))}else if(n===this.editorDiv){let t=d,e=0;for(let i of this.editorDiv.childNodes)e++===h&&(t=c),t.push(l.#tz(i))}this.#tD=`${d.join("\n")}${s}${c.join("\n")}`,this.#t$();let u=new Range,p=d.reduce((t,e)=>t+e.length,0);for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(p<=e){u.setStart(t,p),u.setEnd(t,p);break}p-=e}a.removeAllRanges(),a.addRange(u)}#t$(){if(this.editorDiv.replaceChildren(),this.#tD)for(let t of this.#tD.split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#tG(){return this.#tD.replaceAll("\xa0"," ")}static #tj(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let a=null;if(t instanceof n.FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:r,rotation:n,id:o},textContent:l,textPosition:h,parent:{page:{pageNumber:d}}}=t;if(!l||0===l.length)return null;a=t={annotationType:s.AnnotationEditorType.FREETEXT,color:Array.from(i),fontSize:e,value:l.join("\n"),position:h,pageIndex:d-1,rect:r.slice(0),rotation:n,id:o,deleted:!1}}let r=super.deserialize(t,e,i);return r.#tF=t.fontSize,r.#g=s.Util.makeHexColor(...t.color),r.#tD=l.#tj(t.value),r.annotationElementId=t.id||null,r.#tO=a,r}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};let e=l._internalPadding*this.parentScale,i=this.getRect(e,e),r=a.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#g),n={annotationType:s.AnnotationEditorType.FREETEXT,color:r,fontSize:this.#tF,value:this.#tG(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!this.#tV(n)?null:(n.id=this.annotationElementId,n)}#tV(t){let{value:e,fontSize:i,color:s,pageIndex:a}=this.#tO;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==a}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(this.deleted)return e;let{style:i}=e;for(let t of(i.fontSize=`calc(${this.#tF}px * var(--scale-factor))`,i.color=this.#g,e.replaceChildren(),this.#tD.split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}let s=l._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}var h=i(61),d=i(259),c=i(419);class u extends a.AnnotationEditor{#tq=null;#tW=0;#tK;#tX=null;#tY=null;#tJ=null;#tQ=null;#tZ=0;#t0=null;#t1=null;#tg=null;#t2=!1;#t3=this.#t5.bind(this);#t6=null;#t4;#t8=null;#t9="";#t7;#et="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _l10nPromise;static _type="highlight";static _editorType=s.AnnotationEditorType.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=u.prototype;return(0,s.shadow)(this,"_keyboardManager",new r.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||u._defaultColor,this.#t7=t.thickness||u._defaultThickness,this.#t4=t.opacity||u._defaultOpacity,this.#tK=t.boxes||null,this.#et=t.methodOfCreation||"",this.#t9=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#t2=!0,this.#ee(t),this.#ei()):(this.#tq=t.anchorNode,this.#tW=t.anchorOffset,this.#tQ=t.focusNode,this.#tZ=t.focusOffset,this.#es(),this.#ei(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#t2?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#t7,methodOfCreation:this.#et}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#es(){let t=new h.Outliner(this.#tK,.001);this.#t1=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#t1.box;let e=new h.Outliner(this.#tK,.0025,.001,"ltr"===this._uiManager.direction);this.#tJ=e.getOutlines();let{lastPoint:i}=this.#tJ.box;this.#t6=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#ee({highlightOutlines:t,highlightId:e,clipPathId:i}){if(this.#t1=t,this.#tJ=t.getNewOutline(this.#t7/2+1.5,.0025),e>=0)this.#tg=e,this.#tX=i,this.parent.drawLayer.finalizeLine(e,t),this.#t8=this.parent.drawLayer.highlightOutline(this.#tJ);else if(this.parent){let e=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#tg,t),this.parent.drawLayer.updateBox(this.#tg,u.#ea(this.#t1.box,(e-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#t8,this.#tJ),this.parent.drawLayer.updateBox(this.#t8,u.#ea(this.#tJ.box,e))}let{x:s,y:a,width:r,height:n}=t.box;switch(this.rotation){case 0:this.x=s,this.y=a,this.width=r,this.height=n;break;case 90:{let[t,e]=this.parentDimensions;this.x=a,this.y=1-s,this.width=r*e/t,this.height=n*t/e;break}case 180:this.x=1-s,this.y=1-a,this.width=r,this.height=n;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-a,this.y=s,this.width=r*e/t,this.height=n*t/e}}let{lastPoint:o}=this.#tJ.box;this.#t6=[(o[0]-s)/r,(o[1]-a)/n]}static initialize(t,e){a.AnnotationEditor.initialize(t,e),u._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:u._defaultColor=e;break;case s.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:u._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#t6}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.HIGHLIGHT_COLOR:this.#tB(e);break;case s.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:this.#er(e)}}static get defaultPropertiesToUpdate(){return[[s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR,u._defaultColor],[s.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,u._defaultThickness]]}get propertiesToUpdate(){return[[s.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.color||u._defaultColor],[s.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS,this.#t7||u._defaultThickness],[s.AnnotationEditorParamsType.HIGHLIGHT_FREE,this.#t2]]}#tB(t){let e=t=>{this.color=t,this.parent?.drawLayer.changeColor(this.#tg,t),this.#tY?.updateColor(t)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#er(t){let e=this.#t7,i=t=>{this.#t7=t,this.#en(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#tY=new d.ColorPicker({editor:this}),t.addColorPicker(this.#tY)),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#eo())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#eo())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#el(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.#ei(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#el():t&&(this.#ei(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#en(t){if(!this.#t2)return;this.#ee({highlightOutlines:this.#t1.getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#el(){null!==this.#tg&&this.parent&&(this.parent.drawLayer.remove(this.#tg),this.#tg=null,this.parent.drawLayer.remove(this.#t8),this.#t8=null)}#ei(t=this.parent){null===this.#tg&&({id:this.#tg,clipPathId:this.#tX}=t.drawLayer.highlight(this.#t1,this.color,this.#t4),this.#t8=t.drawLayer.highlightOutline(this.#tJ),this.#t0&&(this.#t0.style.clipPath=this.#tX))}static #ea({x:t,y:e,width:i,height:s},a){switch(a){case 90:return{x:1-e-s,y:t,width:s,height:i};case 180:return{x:1-t-i,y:1-e-s,width:i,height:s};case 270:return{x:e,y:1-t-i,width:s,height:i}}return{x:t,y:e,width:i,height:s}}rotate(t){let e,{drawLayer:i}
2=this.parent;this.#t2?(t=(t-this.rotation+360)%360,e=u.#ea(this.#t1.box,t)):e=u.#ea(this,t),i.rotate(this.#tg,t),i.rotate(this.#t8,t),i.updateBox(this.#tg,e),i.updateBox(this.#t8,u.#ea(this.#tJ.box,t))}render(){if(this.div)return this.div;let t=super.render();this.#t9&&(t.setAttribute("aria-label",this.#t9),t.setAttribute("role","mark")),this.#t2?t.classList.add("free"):this.div.addEventListener("keydown",this.#t3);let e=this.#t0=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#tX;let[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),(0,r.bindEvents)(this,this.#t0,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#t8,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#t8,"hovered")}#t5(t){u._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#eh(!0);break;case 1:case 3:this.#eh(!1)}}#eh(t){if(!this.#tq)return;let e=window.getSelection();t?e.setPosition(this.#tq,this.#tW):e.setPosition(this.#tQ,this.#tZ)}select(){super.select(),this.#t8&&(this.parent?.drawLayer.removeClass(this.#t8,"hovered"),this.parent?.drawLayer.addClass(this.#t8,"selected"))}unselect(){super.unselect(),this.#t8&&(this.parent?.drawLayer.removeClass(this.#t8,"selected"),this.#t2||this.#eh(!1))}get _mustFixPosition(){return!this.#t2}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#tg,t),this.parent.drawLayer.show(this.#t8,t))}#eo(){return this.#t2?this.rotation:0}#ed(){if(this.#t2)return null;let[t,e]=this.pageDimensions,i=this.#tK,s=Array(8*i.length),a=0;for(let{x:r,y:n,width:o,height:l}of i){let i=r*t,h=(1-n-l)*e;s[a]=s[a+4]=i,s[a+1]=s[a+3]=h,s[a+2]=s[a+6]=i+o*t,s[a+5]=s[a+7]=h+l*e,a+=8}return s}#ec(t){return this.#t1.serialize(t,this.#eo())}static startHighlighting(t,e,{target:i,x:s,y:a}){let{x:r,y:n,width:o,height:l}=i.getBoundingClientRect(),d=e=>{this.#eu(t,e)},u={capture:!0,passive:!1},p=t=>{t.preventDefault(),t.stopPropagation()},g=e=>{i.removeEventListener("pointermove",d),window.removeEventListener("blur",g),window.removeEventListener("pointerup",g),window.removeEventListener("pointerdown",p,u),window.removeEventListener("contextmenu",c.noContextMenu),this.#ep(t,e)};window.addEventListener("blur",g),window.addEventListener("pointerup",g),window.addEventListener("pointerdown",p,u),window.addEventListener("contextmenu",c.noContextMenu),i.addEventListener("pointermove",d),this._freeHighlight=new h.FreeOutliner({x:s,y:a},[r,n,o,l],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static #eu(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static #ep(t,e){this._freeHighlight.isEmpty()?t.drawLayer.removeFreeHighlight(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,i){let a=super.deserialize(t,e,i),{rect:[r,n,o,l],color:h,quadPoints:d}=t;a.color=s.Util.makeHexColor(...h),a.#t4=t.opacity;let[c,u]=a.pageDimensions;a.width=(o-r)/c,a.height=(l-n)/u;let p=a.#tK=[];for(let t=0;t<d.length;t+=8)p.push({x:(d[4]-o)/c,y:(l-(1-d[t+5]))/u,width:(d[t+2]-d[t])/c,height:(d[t+5]-d[t+1])/u});return a.#es(),a}serialize(t=!1){if(this.isEmpty()||t)return null;let e=this.getRect(0,0),i=a.AnnotationEditor._colorManager.convert(this.color);return{annotationType:s.AnnotationEditorType.HIGHLIGHT,color:i,opacity:this.#t4,thickness:this.#t7,quadPoints:this.#ed(),outlines:this.#ec(e),pageIndex:this.pageIndex,rect:e,rotation:this.#eo(),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}class p extends a.AnnotationEditor{#eg=0;#em=0;#ef=this.canvasPointermove.bind(this);#eb=this.canvasPointerleave.bind(this);#ev=this.canvasPointerup.bind(this);#eA=this.canvasPointerdown.bind(this);#ey=null;#e_=new Path2D;#eE=!1;#ew=!1;#ex=!1;#eT=null;#eS=0;#eC=0;#eM=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=s.AnnotationEditorType.INK;constructor(t){super({...t,name:"inkEditor"}),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.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(t,e){a.AnnotationEditor.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case s.AnnotationEditorParamsType.INK_THICKNESS:p._defaultThickness=e;break;case s.AnnotationEditorParamsType.INK_COLOR:p._defaultColor=e;break;case s.AnnotationEditorParamsType.INK_OPACITY:p._defaultOpacity=e/100}}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.INK_THICKNESS:this.#er(e);break;case s.AnnotationEditorParamsType.INK_COLOR:this.#tB(e);break;case s.AnnotationEditorParamsType.INK_OPACITY:this.#eP(e)}}static get defaultPropertiesToUpdate(){return[[s.AnnotationEditorParamsType.INK_THICKNESS,p._defaultThickness],[s.AnnotationEditorParamsType.INK_COLOR,p._defaultColor||a.AnnotationEditor._defaultLineColor],[s.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*p._defaultOpacity)]]}get propertiesToUpdate(){return[[s.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||p._defaultThickness],[s.AnnotationEditorParamsType.INK_COLOR,this.color||p._defaultColor||a.AnnotationEditor._defaultLineColor],[s.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??p._defaultOpacity))]]}#er(t){let e=t=>{this.thickness=t,this.#eR()},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#tB(t){let e=t=>{this.color=t,this.#ek()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#eP(t){let e=t=>{this.opacity=t,this.#ek()};t/=100;let i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:s.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#eI(),this.#eD()),this.isAttachedToDOM||(this.parent.add(this),this.#eL()),this.#eR()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#ey&&(clearTimeout(this.#ey),this.#ey=null),this.#eT.disconnect(),this.#eT=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){let[t,e]=this.parentDimensions,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){this.#eE||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#eA))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#eA))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#eF(){let{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}#eO(){let{ctx:t,color:e,opacity:i,thickness:s,parentScale:a,scaleFactor:n}=this;
2t.lineWidth=s*a/n,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${(0,r.opacityToHex)(i)}`}#eN(t,e){this.canvas.addEventListener("contextmenu",c.noContextMenu),this.canvas.addEventListener("pointerleave",this.#eb),this.canvas.addEventListener("pointermove",this.#ef),this.canvas.addEventListener("pointerup",this.#ev),this.canvas.removeEventListener("pointerdown",this.#eA),this.isEditing=!0,this.#ex||(this.#ex=!0,this.#eL(),this.thickness||=p._defaultThickness,this.color||=p._defaultColor||a.AnnotationEditor._defaultLineColor,this.opacity??=p._defaultOpacity),this.currentPath.push([t,e]),this.#ew=!1,this.#eO(),this.#eM=()=>{this.#eB(),this.#eM&&window.requestAnimationFrame(this.#eM)},window.requestAnimationFrame(this.#eM)}#eH(t,e){let[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;let a=this.currentPath,r=this.#e_;if(a.push([t,e]),this.#ew=!0,a.length<=2){r.moveTo(...a[0]),r.lineTo(t,e);return}3===a.length&&(this.#e_=r=new Path2D,r.moveTo(...a[0])),this.#eU(r,...a.at(-3),...a.at(-2),t,e)}#ez(){if(0===this.currentPath.length)return;let t=this.currentPath.at(-1);this.#e_.lineTo(...t)}#e$(t,e){let i;if(this.#eM=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#eH(t,e),this.#ez(),1!==this.currentPath.length)i=this.#ej();else{let s=[t,e];i=[[s,s.slice(),s.slice(),s]]}let s=this.#e_,a=this.currentPath;this.currentPath=[],this.#e_=new Path2D;let r=()=>{this.allRawPaths.push(a),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},n=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#eI(),this.#eD()),this.#eR())};this.addCommands({cmd:r,undo:n,mustExec:!0})}#eB(){if(!this.#ew)return;this.#ew=!1,this.thickness,this.parentScale;let t=this.currentPath.slice(-3);t.map(t=>t[0]),t.map(t=>t[1]);let{ctx:e}=this;for(let t of(e.save(),e.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))e.stroke(t);e.stroke(this.#e_),e.restore()}#eU(t,e,i,s,a,r,n){let o=(e+s)/2,l=(i+a)/2,h=(s+r)/2,d=(a+n)/2;t.bezierCurveTo(o+2*(s-o)/3,l+2*(a-l)/3,h+2*(s-h)/3,d+2*(a-d)/3,h,d)}#ej(){let t,e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let i=[],[s,a]=e[0];for(t=1;t<e.length-2;t++){let[r,n]=e[t],[o,l]=e[t+1],h=(r+o)/2,d=(n+l)/2,c=[s+2*(r-s)/3,a+2*(n-a)/3],u=[h+2*(r-h)/3,d+2*(n-d)/3];i.push([[s,a],c,u,[h,d]]),[s,a]=[h,d]}let[r,n]=e[t],[o,l]=e[t+1],h=[s+2*(r-s)/3,a+2*(n-a)/3];return i.push([[s,a],h,[o+2*(r-o)/3,l+2*(n-l)/3],[o,l]]),i}#ek(){if(this.isEmpty())return void this.#eG();this.#eO();let{canvas:t,ctx:e}=this;for(let i of(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#eG(),this.bezierPath2D))e.stroke(i)}commit(){this.#eE||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#eE=!0,this.div.classList.add("disabled"),this.#eR(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!this.#eE&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#eN(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#eH(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#eV(t)}canvasPointerleave(t){this.#eV(t)}#eV(t){this.canvas.removeEventListener("pointerleave",this.#eb),this.canvas.removeEventListener("pointermove",this.#ef),this.canvas.removeEventListener("pointerup",this.#ev),this.canvas.addEventListener("pointerdown",this.#eA),this.#ey&&clearTimeout(this.#ey),this.#ey=setTimeout(()=>{this.#ey=null,this.canvas.removeEventListener("contextmenu",c.noContextMenu)},10),this.#e$(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#eI(){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")}#eD(){this.#eT=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#eT.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#eE}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[i,s,a,r]=this.#eF();if(this.setAt(i,s,0,0),this.setDims(a,r),this.#eI(),this.width){let[i,s]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*s),this.setAt(t*i,e*s,this.width*i,this.height*s),this.#ex=!0,this.#eL(),this.setDims(this.width*i,this.height*s),this.#ek(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#eD(),this.div}#eL(){if(!this.#ex)return;let[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#eG()}setDimensions(t,e){let i=Math.round(t),s=Math.round(e);if(this.#eS===i&&this.#eC===s)return;this.#eS=i,this.#eC=s,this.canvas.style.visibility="hidden";let[a,r]=this.parentDimensions;this.width=t/a,this.height=e/r,this.fixAndSetPosition(),this.#eE&&this.#eq(t,e),this.#eL(),this.#ek(),this.canvas.style.visibility="visible",this.fixDims()}#eq(t,e){let i=this.#eW(),s=(t-i)/this.#em,a=(e-i)/this.#eg;this.scaleFactor=Math.min(s,a)}#eG(){let t=this.#eW()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}
2static #eK(t){let e=new Path2D;for(let i=0,s=t.length;i<s;i++){let[s,a,r,n]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(a[0],a[1],r[0],r[1],n[0],n[1])}return e}static #eX(t,e,i){let[s,a,r,n]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=n-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]+s,t[e+1]=i+a}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=r-t[e],t[e+1]+=a;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=r-t[e+1],t[e+1]=n-i}break;default:throw Error("Invalid rotation")}return t}static #eY(t,e,i){let[s,a,r,n]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=n-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]-a,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=r-t[e],t[e+1]-=a;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=n-t[e+1],t[e+1]=r-i}break;default:throw Error("Invalid rotation")}return t}#eJ(t,e,i,s){let a=[],r=this.thickness/2,n=t*e+r,o=t*i+r;for(let e of this.paths){let i=[],r=[];for(let s=0,a=e.length;s<a;s++){let[l,h,d,c]=e[s];if(l[0]===c[0]&&l[1]===c[1]&&1===a){let e=t*l[0]+n,s=t*l[1]+o;i.push(e,s),r.push(e,s);break}let u=t*l[0]+n,p=t*l[1]+o,g=t*h[0]+n,m=t*h[1]+o,f=t*d[0]+n,b=t*d[1]+o,v=t*c[0]+n,A=t*c[1]+o;0===s&&(i.push(u,p),r.push(u,p)),i.push(g,m,f,b,v,A),r.push(g,m),s===a-1&&r.push(v,A)}a.push({bezier:p.#eX(i,s,this.rotation),points:p.#eX(r,s,this.rotation)})}return a}#eQ(){let t=1/0,e=-1/0,i=1/0,a=-1/0;for(let r of this.paths)for(let[n,o,l,h]of r){let r=s.Util.bezierBoundingBox(...n,...o,...l,...h);t=Math.min(t,r[0]),i=Math.min(i,r[1]),e=Math.max(e,r[2]),a=Math.max(a,r[3])}return[t,i,e,a]}#eW(){return this.#eE?Math.ceil(this.thickness*this.parentScale):0}#eR(t=!1){if(this.isEmpty())return;if(!this.#eE)return void this.#ek();let e=this.#eQ(),i=this.#eW();this.#em=Math.max(a.AnnotationEditor.MIN_SIZE,e[2]-e[0]),this.#eg=Math.max(a.AnnotationEditor.MIN_SIZE,e[3]-e[1]);let s=Math.ceil(i+this.#em*this.scaleFactor),r=Math.ceil(i+this.#eg*this.scaleFactor),[n,o]=this.parentDimensions;this.width=s/n,this.height=r/o,this.setAspectRatio(s,r);let l=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#eL(),this.#ek(),this.#eS=s,this.#eC=r,this.setDims(s,r);let d=t?i/this.scaleFactor/2:0;this.translate(l-this.translationX-d,h-this.translationY-d)}static deserialize(t,e,i){if(t instanceof n.InkAnnotationElement)return null;let r=super.deserialize(t,e,i);r.thickness=t.thickness,r.color=s.Util.makeHexColor(...t.color),r.opacity=t.opacity;let[o,l]=r.pageDimensions,h=r.width*o,d=r.height*l,c=r.parentScale,u=t.thickness/2;r.#eE=!0,r.#eS=Math.round(h),r.#eC=Math.round(d);let{paths:g,rect:m,rotation:f}=t;for(let{bezier:t}of g){t=p.#eY(t,m,f);let e=[];r.paths.push(e);let i=c*(t[0]-u),s=c*(t[1]-u);for(let a=2,r=t.length;a<r;a+=6){let r=c*(t[a]-u),n=c*(t[a+1]-u),o=c*(t[a+2]-u),l=c*(t[a+3]-u),h=c*(t[a+4]-u),d=c*(t[a+5]-u);e.push([[i,s],[r,n],[o,l],[h,d]]),i=h,s=d}let a=this.#eK(e);r.bezierPath2D.push(a)}let b=r.#eQ();return r.#em=Math.max(a.AnnotationEditor.MIN_SIZE,b[2]-b[0]),r.#eg=Math.max(a.AnnotationEditor.MIN_SIZE,b[3]-b[1]),r.#eq(h,d),r}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),e=a.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:s.AnnotationEditorType.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#eJ(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class g extends a.AnnotationEditor{#eZ=null;#e0=null;#e1=null;#e2=null;#e3=null;#e5="";#e6=null;#eT=null;#e4=null;#e8=!1;#e9=!1;static _type="stamp";static _editorType=s.AnnotationEditorType.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#e2=t.bitmapUrl,this.#e3=t.bitmapFile}static initialize(t,e){a.AnnotationEditor.initialize(t,e)}static get supportedTypes(){return(0,s.shadow)(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>`image/${t}`))}static get supportedTypesStr(){return(0,s.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(s.AnnotationEditorType.STAMP,{bitmapFile:t.getAsFile()})}#e7(t,e=!1){t?(this.#eZ=t.bitmap,e||(this.#e0=t.id,this.#e8=t.isSvg),t.file&&(this.#e5=t.file.name),this.#eI()):this.remove()}#it(){this.#e1=null,this._uiManager.enableWaiting(!1),this.#e6&&this.div.focus()}
2#ie(){if(this.#e0){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e0).then(t=>this.#e7(t,!0)).finally(()=>this.#it());return}if(this.#e2){let t=this.#e2;this.#e2=null,this._uiManager.enableWaiting(!0),this.#e1=this._uiManager.imageManager.getFromUrl(t).then(t=>this.#e7(t)).finally(()=>this.#it());return}if(this.#e3){let t=this.#e3;this.#e3=null,this._uiManager.enableWaiting(!0),this.#e1=this._uiManager.imageManager.getFromFile(t).then(t=>this.#e7(t)).finally(()=>this.#it());return}let t=document.createElement("input");t.type="file",t.accept=g.supportedTypesStr,this.#e1=new Promise(e=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#e7(e)}else this.remove();e()}),t.addEventListener("cancel",()=>{this.remove(),e()})}).finally(()=>this.#it()),t.click()}remove(){this.#e0&&(this.#eZ=null,this._uiManager.imageManager.deleteId(this.#e0),this.#e6?.remove(),this.#e6=null,this.#eT?.disconnect(),this.#eT=null,this.#e4&&(clearTimeout(this.#e4),this.#e4=null)),super.remove()}rebuild(){if(!this.parent){this.#e0&&this.#ie();return}super.rebuild(),null!==this.div&&(this.#e0&&null===this.#e6&&this.#ie(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#e1||this.#eZ||this.#e2||this.#e3||this.#e0)}get isResizable(){return!0}render(){let t,e;if(this.div)return this.div;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#eZ?this.#eI():this.#ie(),this.width){let[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}#eI(){let{div:t}=this,{width:e,height:i}=this.#eZ,[s,a]=this.pageDimensions;if(this.width)e=this.width*s,i=this.height*a;else if(e>.75*s||i>.75*a){let t=Math.min(.75*s/e,.75*a/i);e*=t,i*=t}let[r,n]=this.parentDimensions;this.setDims(e*r/s,i*n/a),this._uiManager.enableWaiting(!1);let o=this.#e6=document.createElement("canvas");t.append(o),t.hidden=!1,this.#ii(e,i),this.#eD(),this.#e9||(this.parent.addUndoableEditor(this),this.#e9=!0),this._reportTelemetry({action:"inserted_image"}),this.#e5&&o.setAttribute("aria-label",this.#e5)}#is(t,e){let[i,s]=this.parentDimensions;this.width=t/i,this.height=e/s,this.setDims(t,e),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#e4&&clearTimeout(this.#e4),this.#e4=setTimeout(()=>{this.#e4=null,this.#ii(t,e)},200)}#ia(t,e){let{width:i,height:s}=this.#eZ,a=i,r=s,n=this.#eZ;for(;a>2*t||r>2*e;){let i=a,s=r;a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));let o=new OffscreenCanvas(a,r);o.getContext("2d").drawImage(n,0,0,i,s,0,0,a,r),n=o.transferToImageBitmap()}return n}#ii(t,e){t=Math.ceil(t),e=Math.ceil(e);let i=this.#e6;if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;let s=this.#e8?this.#eZ:this.#ia(t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){let i=new OffscreenCanvas(t,e);i.getContext("2d").drawImage(s,0,0,s.width,s.height,0,0,t,e),i.convertToBlob().then(t=>{let e=new FileReader;e.onload=()=>{let t=e.result;this._uiManager.mlGuess({service:"image-to-text",request:{imageData:t}}).then(t=>{let e=t?.output||"";this.parent&&e&&!this.hasAltText()&&(this.altTextData={altText:e,decorative:!1})})},e.readAsDataURL(t)})}let a=i.getContext("2d");a.filter=this._uiManager.hcmFilter,a.drawImage(s,0,0,s.width,s.height,0,0,t,e)}getImageForAltText(){return this.#e6}#ir(t){if(t){if(this.#e8){let t=this._uiManager.imageManager.getSvgUrl(this.#e0);if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#eZ,t.getContext("2d").drawImage(this.#eZ,0,0),t.toDataURL()}if(this.#e8){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*c.PixelsPerInch.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*c.PixelsPerInch.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(i,s);return a.getContext("2d").drawImage(this.#eZ,0,0,this.#eZ.width,this.#eZ.height,0,0,i,s),a.transferToImageBitmap()}return structuredClone(this.#eZ)}#eD(){this.#eT=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.#is(e.width,e.height)}),this.#eT.observe(this.div)}static deserialize(t,e,i){if(t instanceof n.StampAnnotationElement)return null;let s=super.deserialize(t,e,i),{rect:a,bitmapUrl:r,bitmapId:o,isSvg:l,accessibilityData:h}=t;o&&i.imageManager.isValidId(o)?s.#e0=o:s.#e2=r,s.#e8=l;let[d,c]=s.pageDimensions;return s.width=(a[2]-a[0])/d,s.height=(a[3]-a[1])/c,h&&(s.altTextData=h),s}serialize(t=!1,e=null){if(this.isEmpty())return null;let i={annotationType:s.AnnotationEditorType.STAMP,bitmapId:this.#e0,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#e8,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#ir(!0),i.accessibilityData=this.altTextData,i;let{decorative:a,altText:r}=this.altTextData;if(!a&&r&&(i.accessibilityData={type:"Figure",alt:r}),null===e)return i;e.stamps||=new Map;let n=this.#e8?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#e0)){if(this.#e8){let t=e.stamps.get(this.#e0);n>t.area&&(t.area=n,t.serialized.bitmap.close(),t.serialized.bitmap=this.#ir(!1))}}else e.stamps.set(this.#e0,{area:n,serialized:i}),i.bitmap=this.#ir(!1);return i}}class m{#L;#io=!1;#il=null;#ih=null;#id=null;#ic=null;#iu=null;#ip=new Map;#ig=!1;#im=!1;#ib=!1;#iv=null;#iA;static _initialized=!1;static #iy=new Map([l,p,g,u].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:i,accessibilityManager:s,annotationLayer:a,drawLayer:r,textLayer:n,viewport:o,l10n:l}){const h=[...m.#iy.values()];if(!m._initialized)for(const e of(m._initialized=!0,h))e.initialize(l,t);
2t.registerEditorTypes(h),this.#iA=t,this.pageIndex=e,this.div=i,this.#L=s,this.#il=a,this.viewport=o,this.#iv=n,this.drawLayer=r,this.#iA.addLayer(this)}get isEmpty(){return 0===this.#ip.size}get isInvisible(){return this.isEmpty&&this.#iA.getMode()===s.AnnotationEditorType.NONE}updateToolbar(t){this.#iA.updateToolbar(t)}updateMode(t=this.#iA.getMode()){switch(this.#i_(),t){case s.AnnotationEditorType.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case s.AnnotationEditorType.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case s.AnnotationEditorType.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;for(let i of m.#iy.values())e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#iv?.div}addInkEditorIfNeeded(t){if(this.#iA.getMode()===s.AnnotationEditorType.INK){if(!t){for(let t of this.#ip.values())if(t.isEmpty())return void t.setInBackground()}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#iA.setEditingState(t)}addCommands(t){this.#iA.addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#il?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let e of this.#ip.values())e.enableEditing(),e.show(!0),e.annotationElementId&&(this.#iA.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if(this.#il)for(let e of this.#il.getEditableAnnotations()){if(e.hide(),this.#iA.isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let i=this.deserialize(e);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){this.#ib=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Map,e=new Map;for(let i of this.#ip.values())if(i.disableEditing(),i.annotationElementId){if(null!==i.serialize()){t.set(i.annotationElementId,i);continue}e.set(i.annotationElementId,i),this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()}if(this.#il)for(let i of this.#il.getEditableAnnotations()){let{id:s}=i.data;if(this.#iA.isDeletedAnnotationElement(s))continue;let a=e.get(s);if(a){a.resetAnnotationElement(i),a.show(!1),i.show();continue}(a=t.get(s))&&(this.#iA.addChangedExistingAnnotation(a),a.renderAnnotationElement(i),a.show(!1)),i.show()}this.#i_(),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let t of m.#iy.values())i.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#ib=!1}getEditableAnnotation(t){return this.#il?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#iA.getActive()!==t&&this.#iA.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#iv?.div&&!this.#ic&&(this.#ic=this.#iE.bind(this),this.#iv.div.addEventListener("pointerdown",this.#ic),this.#iv.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#iv?.div&&this.#ic&&(this.#iv.div.removeEventListener("pointerdown",this.#ic),this.#ic=null,this.#iv.div.classList.remove("highlighting"))}#iE(t){if(this.#iA.unselectAll(),t.target===this.#iv.div){let{isMac:e}=s.FeatureTest.platform;0!==t.button||t.ctrlKey&&e||(this.#iA.showAllEditors("highlight",!0,!0),this.#iv.div.classList.add("free"),u.startHighlighting(this,"ltr"===this.#iA.direction,t),this.#iv.div.addEventListener("pointerup",()=>{this.#iv.div.classList.remove("free")},{once:!0}),t.preventDefault())}}enableClick(){this.#id||(this.#id=this.pointerdown.bind(this),this.#ih=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#id),this.div.addEventListener("pointerup",this.#ih))}disableClick(){this.#id&&(this.div.removeEventListener("pointerdown",this.#id),this.div.removeEventListener("pointerup",this.#ih),this.#id=null,this.#ih=null)}attach(t){this.#ip.set(t.id,t);let{annotationElementId:e}=t;e&&this.#iA.isDeletedAnnotationElement(e)&&this.#iA.removeDeletedAnnotationElement(t)}detach(t){this.#ip.delete(t.id),this.#L?.removePointerInTextLayer(t.contentDiv),!this.#ib&&t.annotationElementId&&this.#iA.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#iA.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#im||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#iA.addDeletedAnnotationElement(t.annotationElementId),a.AnnotationEditor.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#iA.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#iA.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#iu&&(t._focusEventsAllowed=!1,this.#iu=setTimeout(()=>{this.#iu=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus())},0)),t._structTreeParentId=this.#L?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return this.#iA.getId()}get #iw(){return m.#iy.get(this.#iA.getMode())}#ix(t){let e=this.#iw;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#iw?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#iA.updateToolbar(t),this.#iA.updateMode(t);let{offsetX:i,offsetY:s}=this.#iT(),a=this.getNextId(),r=this.#ix({parent:this,id:a,x:i,y:s,uiManager:this.#iA,isCentered:!0,...e});r&&this.add(r)}deserialize(t){return m.#iy.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#iA)||null}createAndAddNewEditor(t,e,i={}){let s=this.getNextId(),a=this.#ix({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:this.#iA,isCentered:e,...i});return a&&this.add(a),a}#iT(){let{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),a=Math.max(0,t),r=Math.max(0,e),n=Math.min(window.innerWidth,t+i),o=Math.min(window.innerHeight,e+s),l=(a+n)/2-t,h=(r+o)/2-e,[d,c]=this.viewport.rotation%180==0?[l,h]:[h,l];return{offsetX:d,offsetY:c}}addNewEditor(){this.createAndAddNewEditor(this.#iT(),!0)}setSelected(t){this.#iA.setSelected(t)}toggleSelected(t){this.#iA.toggleSelected(t)}isSelected(t){return this.#iA.isSelected(t)}unselect(t){this.#iA.unselect(t)}pointerup(t){let{isMac:e}=s.FeatureTest.platform;if(0===t.button&&(!t.ctrlKey||!e)&&t.target===this.div&&this.#ig){if(this.#ig=!1,!this.#io){this.#io=!0;return}if(this.#iA.getMode()===s.AnnotationEditorType.STAMP)return void this.#iA.unselectAll();this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(this.#iA.getMode()===s.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#ig){this.#ig=!1;return}let{isMac:e}=s.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;this.#ig=!0;let i=this.#iA.getActive();this.#io=!i||i.isEmpty()}findNewParent(t,e,i){let s=this.#iA.findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){for(let t of(this.#iA.getActive()?.parent===this&&(this.#iA.commitOrRemove(),this.#iA.setActiveEditor(null)),this.#iu&&(clearTimeout(this.#iu),this.#iu=null),this.#ip.values())
2)this.#L?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#ip.clear(),this.#iA.removeLayer(this)}#i_(){for(let t of(this.#im=!0,this.#ip.values()))t.isEmpty()&&t.remove();this.#im=!1}render({viewport:t}){for(let e of(this.viewport=t,(0,c.setLayerDimensions)(this.div,t),this.#iA.getEditors(this.pageIndex)))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#iA.commitOrRemove(),this.#i_();let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,(0,c.setLayerDimensions)(this.div,{rotation:i}),e!==i)for(let t of this.#ip.values())t.rotate(i);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#iA.viewParameters.realScale}}},259:(t,e,i)=>{i.d(e,{ColorPicker:()=>n});var s=i(292),a=i(830),r=i(419);class n{#n=this.#o.bind(this);#iS=this.#iC.bind(this);#iM=null;#iP=null;#iR;#ik=null;#iI=!1;#iD=!1;#iL=null;#iF;#iA=null;#iO;static get _keyboardManager(){return(0,s.shadow)(this,"_keyboardManager",new a.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:t=null,uiManager:e=null}){t?(this.#iD=!1,this.#iO=s.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.#iL=t):(this.#iD=!0,this.#iO=s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR),this.#iA=t?._uiManager||e,this.#iF=this.#iA._eventBus,this.#iR=t?.color||this.#iA?.highlightColors.values().next().value||"#FFFF98"}renderButton(){let t=this.#iM=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0),t.addEventListener("click",this.#iN.bind(this)),t.addEventListener("keydown",this.#n);let e=this.#iP=document.createElement("span");return e.className="swatch",e.setAttribute("aria-hidden",!0),e.style.backgroundColor=this.#iR,t.append(e),t}renderMainDropdown(){let t=this.#ik=this.#iB();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#iB(){let t=document.createElement("div");for(let[e,i]of(t.addEventListener("contextmenu",r.noContextMenu),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#iA.highlightColors)){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",i),s.title=e,s.setAttribute("data-l10n-id",`pdfjs-editor-colorpicker-${e}`);let a=document.createElement("span");s.append(a),a.className="swatch",a.style.backgroundColor=i,s.setAttribute("aria-selected",i===this.#iR),s.addEventListener("click",this.#iH.bind(this,i)),t.append(s)}return t.addEventListener("keydown",this.#n),t}#iH(t,e){e.stopPropagation(),this.#iF.dispatch("switchannotationeditorparams",{source:this,type:this.#iO,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#iM)return void this.#iN(t);let e=t.target.getAttribute("data-color");e&&this.#iH(e,t)}_moveToNext(t){this.#iU?t.target===this.#iM?this.#ik.firstChild?.focus():t.target.nextSibling?.focus():this.#iN(t)}_moveToPrevious(t){if(t.target===this.#ik?.firstChild||t.target===this.#iM){this.#iU&&this._hideDropdownFromKeyboard();return}this.#iU||this.#iN(t),t.target.previousSibling?.focus()}_moveToBeginning(t){this.#iU?this.#ik.firstChild?.focus():this.#iN(t)}_moveToEnd(t){this.#iU?this.#ik.lastChild?.focus():this.#iN(t)}#o(t){n._keyboardManager.exec(this,t)}#iN(t){if(this.#iU)return void this.hideDropdown();if(this.#iI=0===t.detail,window.addEventListener("pointerdown",this.#iS),this.#ik)return void this.#ik.classList.remove("hidden");let e=this.#ik=this.#iB();this.#iM.append(e)}#iC(t){this.#ik?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#ik?.classList.add("hidden"),window.removeEventListener("pointerdown",this.#iS)}get #iU(){return this.#ik&&!this.#ik.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#iD){if(!this.#iU)return void this.#iL?.unselect();this.hideDropdown(),this.#iM.focus({preventScroll:!0,focusVisible:this.#iI})}}updateColor(t){if(this.#iP&&(this.#iP.style.backgroundColor=t),!this.#ik)return;let e=this.#iA.highlightColors.values();for(let i of this.#ik.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#iM?.remove(),this.#iM=null,this.#iP=null,this.#ik?.remove(),this.#ik=null}}},310:(t,e,i)=>{i.d(e,{AnnotationEditor:()=>l});var s=i(830),a=i(292),r=i(419);class n{#iz="";#i$=!1;#ij=null;#iG=null;#iV=null;#iq=!1;#iL=null;static _l10nPromise=null;constructor(t){this.#iL=t}static initialize(t){n._l10nPromise||=t}async render(){let t=this.#ij=document.createElement("button");t.className="altText";let e=await n._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=e,t.setAttribute("aria-label",e),t.tabIndex="0",t.addEventListener("contextmenu",r.noContextMenu),t.addEventListener("pointerdown",t=>t.stopPropagation());let i=t=>{t.preventDefault(),this.#iL._uiManager.editAltText(this.#iL)};return t.addEventListener("click",i,{capture:!0}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#iq=!0,i(e))}),await this.#iW(),t}finish(){this.#ij&&(this.#ij.focus({focusVisible:this.#iq}),this.#iq=!1)}isEmpty(){return!this.#iz&&!this.#i$}get data(){return{altText:this.#iz,decorative:this.#i$}}set data({altText:t,decorative:e}){(this.#iz!==t||this.#i$!==e)&&(this.#iz=t,this.#i$=e,this.#iW())}toggle(t=!1){this.#ij&&(!t&&this.#iV&&(clearTimeout(this.#iV),this.#iV=null),this.#ij.disabled=!t)}destroy(){this.#ij?.remove(),this.#ij=null,this.#iG=null}async #iW(){let t=this.#ij;if(!t)return;if(!this.#iz&&!this.#i$){t.classList.remove("done"),this.#iG?.remove();return}t.classList.add("done"),n._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(e=>{t.setAttribute("aria-label",e)});let e=this.#iG;if(!e){this.#iG=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip");let i=e.id=`alt-text-tooltip-${this.#iL.id}`;t.setAttribute("aria-describedby",i),t.addEventListener("mouseenter",()=>{this.#iV=setTimeout(()=>{this.#iV=null,this.#iG.classList.add("show"),this.#iL._reportTelemetry({action:"alt_text_tooltip"})},100)}),t.addEventListener("mouseleave",()=>{this.#iV&&(clearTimeout(this.#iV),this.#iV=null),this.#iG?.classList.remove("show")})}e.innerText=this.#i$?await n._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#iz,e.parentNode||t.append(e);let i=this.#iL.getImageForAltText();i?.setAttribute("aria-describedby",e.id)}}var o=i(362);class l{#iK=null;#iz=null;#iX=!1;#iY=!1;#iJ=null;#iQ=null;#iZ=this.focusin.bind(this);#i0=this.focusout.bind(this);#i1=null;#i2="";#i3=!1;#i5=null;#i6=!1;#i4=!1;#i8=!1;#i9=null;#i7=0;#st=0;#se=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#si=!1;#ss=l._zIndex++;static _borderLineWidth=-1;static _colorManager=new s.ColorManager;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=l.prototype._resizeWithKeyboard,e=s.AnnotationEditorUIManager.TRANSLATE_SMALL,i=s.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,a.shadow)(this,"_resizerKeyboardManager",new s.KeyboardManager([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],l.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===l&&(0,a.unreachable)("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:r,pageY:n}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[r,n];const[o,h]=this.parentDimensions;this.x=t.x/o,this.y=t.y/h,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,a.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new h({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e,i){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(e=>[e,t.get(e.replaceAll(/([A-Z])/g,t=>`-${t.toLowerCase()}`))])),i?.strings)for(let e of i.strings)l._l10nPromise.set(e,t.get(e));if(-1!==l._borderLineWidth)return;let s=getComputedStyle(document.documentElement);l._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){(0,a.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#si}set _isDraggable(t){this.#si=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#ss}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#sa(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#i3?this.#i3=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let e=t.relatedTarget;!e?.closest(`#${this.id}`)&&(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){let[a,r]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/a,this.y=(e+s)/r,this.fixAndSetPosition()}#sr([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this.fixAndSetPosition()}translate(t,e){this.#sr(this.parentDimensions,t,e)}translateInPage(t,e){this.#i5||=[this.x,this.y],this.#sr(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#i5||=[this.x,this.y];let[i,s]=this.parentDimensions;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:r}=this,[n,o]=this.getBaseTranslation();a+=n,r+=o,this.div.style.left=`${(100*a).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#i5&&(this.#i5[0]!==this.x||this.#i5[1]!==this.y)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=l,s=i/t,a=i/e;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let[e,i]=this.pageDimensions,{x:s,y:a,width:r,height:n}=this;if(r*=e,n*=i,s*=e,a*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-r,s)),a=Math.max(0,Math.min(i-n,a));break;case 90:s=Math.max(0,Math.min(e-n,s)),a=Math.min(i,Math.max(r,a));break;case 180:s=Math.min(e,Math.max(r,s)),a=Math.min(i,Math.max(n,a));break;case 270:s=Math.min(e,Math.max(n,s)),a=Math.max(0,Math.min(i-r,a))}this.x=s/=e,this.y=a/=i;let[o,l]=this.getBaseTranslation();s+=o,a+=l;let{style:h}=this.div;h.left=`${(100*s).toFixed(2)}%`,h.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}static #sn(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return l.#sn(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return l.#sn(t,e,360-this.parentRotation)}#so(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,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(){let{parentScale:t,pageDimensions:[e,i]}=this,s=e*t,r=i*t;return a.FeatureTest.isCSSRoundSupported?[Math.round(s),Math.round(r)]:[s,r]}setDims(t,e){let[i,s]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#iY||(this.div.style.height=`${(100*e/s).toFixed(2)}%`)}fixDims(){let{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),a=!this.#iY&&e.endsWith("%");if(s&&a)return;let[r,n]=this.parentDimensions;s||(t.width=`${(100*parseFloat(i)/r).toFixed(2)}%`),this.#iY||a||(t.height=`${(100*parseFloat(e)/n).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#sl(){if(!this.#iJ){for(let t of(this.#iJ=document.createElement("div"),this.#iJ.classList.add("resizers"),this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"])){let e=document.createElement("div");this.#iJ.append(e),e.classList.add("resizer",t),e.setAttribute("data-resizer-name",t),e.addEventListener("pointerdown",this.#sh.bind(this,t)),e.addEventListener("contextmenu",r.noContextMenu),e.tabIndex=-1}this.div.prepend(this.#iJ)}}#sh(t,e){e.preventDefault();let{isMac:i}=a.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#iz?.toggle(!1);let s=this.#sd.bind(this,t),n=this._isDraggable;this._isDraggable=!1;let o={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",s,o),window.addEventListener("contextmenu",r.noContextMenu);let l=this.x,h=this.y,d=this.width,c=this.height,u=this.parent.div.style.cursor,p=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let g=()=>{this.parent.togglePointerEvents(!0),this.#iz?.toggle(!0),this._isDraggable=n,window.removeEventListener("pointerup",g),window.removeEventListener("blur",g),window.removeEventListener("pointermove",s,o),window.removeEventListener("contextmenu",r.noContextMenu),this.parent.div.style.cursor=u,this.div.style.cursor=p,this.#sc(l,h,d,c)};window.addEventListener("pointerup",g),window.addEventListener("blur",g)}#sc(t,e,i,s){let a=this.x,r=this.y,n=this.width,o=this.height;(a!==t||r!==e||n!==i||o!==s)&&this.addCommands({cmd:()=>{this.width=n,this.height=o,this.x=a,this.y=r;let[t,e]=this.parentDimensions;this.setDims(t*n,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;let[a,r]=this.parentDimensions;this.setDims(a*i,r*s),this.fixAndSetPosition()},mustExec:!0})}#sd(t,e){let i,s,a,r,[n,o]=this.parentDimensions,h=this.x,d=this.y,c=this.width,u=this.height,p=l.MIN_SIZE/n,g=l.MIN_SIZE/o,m=t=>Math.round(1e4*t)/1e4,f=this.#so(this.rotation),b=(t,e)=>[f[0]*t+f[2]*e,f[1]*t+f[3]*e],v=this.#so(360-this.rotation),A=!1,y=!1;switch(t){case"topLeft":A=!0,i=(t,e)=>
2[0,0],s=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],s=(t,e)=>[t/2,e];break;case"topRight":A=!0,i=(t,e)=>[t,0],s=(t,e)=>[0,e];break;case"middleRight":y=!0,i=(t,e)=>[t,e/2],s=(t,e)=>[0,e/2];break;case"bottomRight":A=!0,i=(t,e)=>[t,e],s=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],s=(t,e)=>[t/2,0];break;case"bottomLeft":A=!0,i=(t,e)=>[0,e],s=(t,e)=>[t,0];break;case"middleLeft":y=!0,i=(t,e)=>[0,e/2],s=(t,e)=>[t,e/2]}let _=i(c,u),E=s(c,u),w=b(...E),x=m(h+w[0]),T=m(d+w[1]),S=1,C=1,[M,P]=this.screenToPageTranslation(e.movementX,e.movementY);if([M,P]=(a=M/n,r=P/o,[v[0]*a+v[2]*r,v[1]*a+v[3]*r]),A){let t=Math.hypot(c,u);S=C=Math.max(Math.min(Math.hypot(E[0]-_[0]-M,E[1]-_[1]-P)/t,1/c,1/u),p/c,g/u)}else y?S=Math.max(p,Math.min(1,Math.abs(E[0]-_[0]-M)))/c:C=Math.max(g,Math.min(1,Math.abs(E[1]-_[1]-P)))/u;let R=m(c*S),k=m(u*C);w=b(...s(R,k));let I=x-w[0],D=T-w[1];this.width=R,this.height=k,this.x=I,this.y=D,this.setDims(n*R,o*k),this.fixAndSetPosition()}altTextFinish(){this.#iz?.finish()}async addEditToolbar(){return this.#i1||this.#i4||(this.#i1=new o.EditorToolbar(this),this.div.append(this.#i1.render()),this.#iz&&this.#i1.addAltTextButton(await this.#iz.render())),this.#i1}removeEditToolbar(){this.#i1&&(this.#i1.remove(),this.#i1=null,this.#iz?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#iz||(n.initialize(l._l10nPromise),this.#iz=new n(this),await this.addEditToolbar())}get altTextData(){return this.#iz?.data}set altTextData(t){this.#iz&&(this.#iz.data=t)}hasAltText(){return!this.#iz?.isEmpty()}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#iX?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",this.#iZ),this.div.addEventListener("focusout",this.#i0);let[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);let[i,a]=this.getInitialTranslation();return this.translate(i,a),(0,s.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=a.FeatureTest.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#i3=!0,this._isDraggable)?this.#su(t):this.#sp(t)}#sp(t){let{isMac:e}=a.FeatureTest.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#su(t){let e,i,s=this._uiManager.isSelected(this);this._uiManager.setUpDragSession(),s&&(this.div.classList.add("moving"),e={passive:!0,capture:!0},this.#i7=t.clientX,this.#st=t.clientY,i=t=>{let{clientX:e,clientY:i}=t,[s,a]=this.screenToPageTranslation(e-this.#i7,i-this.#st);this.#i7=e,this.#st=i,this._uiManager.dragSelectedEditors(s,a)},window.addEventListener("pointermove",i,e));let a=()=>{window.removeEventListener("pointerup",a),window.removeEventListener("blur",a),s&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",i,e)),this.#i3=!1,this._uiManager.endDragSession()||this.#sp(t)};window.addEventListener("pointerup",a),window.addEventListener("blur",a)}moveInDOM(){this.#i9&&clearTimeout(this.#i9),this.#i9=setTimeout(()=>{this.#i9=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e,i=this.rotation){let s=this.parentScale,[a,r]=this.pageDimensions,[n,o]=this.pageTranslation,l=t/s,h=e/s,d=this.x*a,c=this.y*r,u=this.width*a,p=this.height*r;switch(i){case 0:return[d+l+n,r-c-h-p+o,d+l+u+n,r-c-h+o];case 90:return[d+h+n,r-c+l+o,d+h+p+n,r-c+l+u+o];case 180:return[d-l-u+n,r-c+h+o,d-l+n,r-c+h+p+o];case 270:return[d-h-p+n,r-c-l-u+o,d-h+n,r-c-l+o];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,s,a,r]=t,n=a-i,o=r-s;switch(this.rotation){case 0:return[i,e-r,n,o];case 90:return[i,e-s,o,n];case 180:return[a,e-s,n,o];case 270:return[a,e-r,o,n];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#i4=!0}disableEditMode(){this.#i4=!1}isInEditMode(){return this.#i4}shouldGetKeyboardEvents(){return this.#i8}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#iZ),this.div?.addEventListener("focusout",this.#i0)}rotate(t){}serialize(t=!1,e=null){(0,a.unreachable)("An editor must be serializable")}static deserialize(t,e,i){let s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation;let[a,r]=s.pageDimensions,[n,o,l,h]=s.getRectInCurrentCoords(t.rect,r);
2return s.x=n/a,s.y=o/r,s.width=l/a,s.height=h/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.div.removeEventListener("focusin",this.#iZ),this.div.removeEventListener("focusout",this.#i0),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#i9&&(clearTimeout(this.#i9),this.#i9=null),this.#sa(),this.removeEditToolbar(),this.#se){for(let t of this.#se.values())clearTimeout(t);this.#se=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#sl(),this.#iJ.classList.remove("hidden"),(0,s.bindEvents)(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#iQ={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#iJ.children;if(!this.#iK){this.#iK=Array.from(e);let t=this.#sg.bind(this),i=this.#sm.bind(this);for(let e of this.#iK){let s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t),e.addEventListener("blur",i),e.addEventListener("focus",this.#sf.bind(this,s)),l._l10nPromise.get(`pdfjs-editor-resizer-label-${s}`).then(t=>e.setAttribute("aria-label",t))}}let i=this.#iK[0],s=0;for(let t of e){if(t===i)break;s++}let a=(360-this.rotation+this.parentRotation)%360/90*(this.#iK.length/4);if(a!==s){if(a<s)for(let t=0;t<s-a;t++)this.#iJ.append(this.#iJ.firstChild);else if(a>s)for(let t=0;t<a-s;t++)this.#iJ.firstChild.before(this.#iJ.lastChild);let t=0;for(let i of e){let e=this.#iK[t++].getAttribute("data-resizer-name");l._l10nPromise.get(`pdfjs-editor-resizer-label-${e}`).then(t=>i.setAttribute("aria-label",t))}}this.#sb(0),this.#i8=!0,this.#iJ.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#sg(t){l._resizerKeyboardManager.exec(this,t)}#sm(t){this.#i8&&t.relatedTarget?.parentNode!==this.#iJ&&this.#sa()}#sf(t){this.#i2=this.#i8?t:""}#sb(t){if(this.#iK)for(let e of this.#iK)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#i8&&this.#sd(this.#i2,{movementX:t,movementY:e})}#sa(){if(this.#i8=!1,this.#sb(-1),this.#iQ){let{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=this.#iQ;this.#sc(t,e,i,s),this.#iQ=null}}_stopResizingWithKeyboard(){this.#sa(),this.div.focus()}select(){(this.makeResizable(),this.div?.classList.add("selectedEditor"),this.#i1)?this.#i1?.show():this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#i1?.show()})}unselect(){this.#iJ?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#i1?.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#i6}set isEditing(t){this.#i6=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#iY=!0;let{style:i}=this.div;i.aspectRatio=t/e,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){this.#se||=new Map;let{action:e}=t,i=this.#se.get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#se.delete(e),0===this.#se.size&&(this.#se=null)},l._telemetryTimeout),this.#se.set(e,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#iX=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#iX=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstChild:e}=t.container;
2"DIV"===e.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}class h extends l{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},61:(t,e,i)=>{i.d(e,{FreeOutliner:()=>o,Outliner:()=>a});var s=i(292);class a{#sv;#sA=[];#sy=[];constructor(t,e=0,i=0,s=!0){let a=1/0,r=-1/0,n=1/0,o=-1/0;for(const{x:i,y:s,width:l,height:h}of t){const t=1e-4*Math.floor((i-e)/1e-4),d=1e-4*Math.ceil((i+l+e)/1e-4),c=1e-4*Math.floor((s-e)/1e-4),u=1e-4*Math.ceil((s+h+e)/1e-4),p=[t,c,u,!0],g=[d,c,u,!1];this.#sA.push(p,g),a=Math.min(a,t),r=Math.max(r,d),n=Math.min(n,c),o=Math.max(o,u)}const l=r-a+2*i,h=o-n+2*i,d=a-i,c=n-i,u=this.#sA.at(s?-1:-2),p=[u[0],u[2]];for(const t of this.#sA){const[e,i,s]=t;t[0]=(e-d)/l,t[1]=(i-c)/h,t[2]=(s-c)/h}this.#sv={x:d,y:c,width:l,height:h,lastPoint:p}}getOutlines(){this.#sA.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of this.#sA)e[3]?(t.push(...this.#s_(e)),this.#sE(e)):(this.#sw(e),t.push(...this.#s_(e)));return this.#sx(t)}#sx(t){let e,i=[],s=new Set;for(let e of t){let[t,s,a]=e;i.push([t,s,e],[t,a,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t<e;t+=2){let e=i[t][2],a=i[t+1][2];e.push(a),a.push(e),s.add(e),s.add(a)}let a=[];for(;s.size>0;){let t=s.values().next().value,[i,r,n,o,l]=t;s.delete(t);let h=i,d=r;for(e=[i,n],a.push(e);;){let t;if(s.has(o))t=o;else if(s.has(l))t=l;else break;s.delete(t),[i,r,n,o,l]=t,h!==i&&(e.push(h,d,i,d===r?r:n),h=i),d=d===r?n:r}e.push(h,d)}return new n(a,this.#sv)}#sT(t){let e=this.#sy,i=0,s=e.length-1;for(;i<=s;){let a=i+s>>1,r=e[a][0];if(r===t)return a;r<t?i=a+1:s=a-1}return s+1}#sE([,t,e]){let i=this.#sT(t);this.#sy.splice(i,0,[t,e])}#sw([,t,e]){let i=this.#sT(t);for(let s=i;s<this.#sy.length;s++){let[i,a]=this.#sy[s];if(i!==t)break;if(i===t&&a===e)return void this.#sy.splice(s,1)}for(let s=i-1;s>=0;s--){let[i,a]=this.#sy[s];if(i!==t)break;if(i===t&&a===e)return void this.#sy.splice(s,1)}}#s_(t){let[e,i,s]=t,a=[[e,i,s]],r=this.#sT(s);for(let t=0;t<r;t++){let[i,s]=this.#sy[t];for(let t=0,r=a.length;t<r;t++){let[,n,o]=a[t];if(!(s<=n)&&!(o<=i)){if(n>=i){if(o>s)a[t][1]=s;else{if(1===r)return[];a.splice(t,1),t--,r--}continue}a[t][2]=i,o>s&&a.push([e,s,o])}}}return a}}class r{toSVGPath(){throw Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof l}}class n extends r{#sv;#sS;constructor(t,e){super(),this.#sS=t,this.#sv=e}toSVGPath(){let t=[];for(let e of this.#sS){let[i,s]=e;t.push(`M${i} ${s}`);for(let a=2;a<e.length;a+=2){let r=e[a],n=e[a+1];r===i?(t.push(`V${n}`),s=n):n===s&&(t.push(`H${r}`),i=r)}t.push("Z")}return t.join(" ")}serialize([t,e,i,s],a){let r=[],n=i-t,o=s-e;for(let e of this.#sS){let i=Array(e.length);for(let a=0;a<e.length;a+=2)i[a]=t+e[a]*n,i[a+1]=s-e[a+1]*o;r.push(i)}return r}get box(){return this.#sv}}class o{#sv;#sC=[];#sM;#sP;#sR=[];#sk=new Float64Array(18);#sI;#sD;#sL;#sF;#sO;#t7;#sN=[];static #sB=8;static #sH=2;static #sU=o.#sB+o.#sH;constructor({x:t,y:e},i,s,a,r,n=0){this.#sv=i,this.#t7=a*s,this.#sP=r,this.#sk.set([NaN,NaN,NaN,NaN,t,e],6),this.#sM=n,this.#sF=o.#sB*s,this.#sL=o.#sU*s,this.#sO=s,this.#sN.push(t,e)}get free(){return!0}isEmpty(){return isNaN(this.#sk[8])}#sz(){let t=this.#sk.subarray(4,6),e=this.#sk.subarray(16,18),[i,s,a,r]=this.#sv;return[(this.#sI+(t[0]-e[0])/2-i)/a,(this.#sD+(t[1]-e[1])/2-s)/r,(this.#sI+(e[0]-t[0])/2-i)/a,(this.#sD+(e[1]-t[1])/2-s)/r]}add({x:t,y:e}){this.#sI=t,this.#sD=e;let[i,s,a,r]=this.#sv,[n,o,l,h]=this.#sk.subarray(8,12),d=t-l,c=e-h,u=Math.hypot(d,c);if(u<this.#sL)return!1;let p=u-this.#sF,g=p/u,m=g*d,f=g*c,b=n,v=o;n=l,o=h,l+=m,h+=f,this.#sN?.push(t,e);let A=-f/p*this.#t7,y=m/p*this.#t7;return(this.#sk.set(this.#sk.subarray(2,8),0),this.#sk.set([l+A,h+y],4),this.#sk.set(this.#sk.subarray(14,18),12),this.#sk.set([l-A,h-y],16),isNaN(this.#sk[6]))?(0===this.#sR.length&&(this.#sk.set([n+A,o+y],2),this.#s
2R.push(NaN,NaN,NaN,NaN,(n+A-i)/a,(o+y-s)/r),this.#sk.set([n-A,o-y],14),this.#sC.push(NaN,NaN,NaN,NaN,(n-A-i)/a,(o-y-s)/r)),this.#sk.set([b,v,n,o,l,h],6),!this.isEmpty()):((this.#sk.set([b,v,n,o,l,h],6),Math.abs(Math.atan2(v-o,b-n)-Math.atan2(f,m))<Math.PI/2)?([n,o,l,h]=this.#sk.subarray(2,6),this.#sR.push(NaN,NaN,NaN,NaN,((n+l)/2-i)/a,((o+h)/2-s)/r),[n,o,b,v]=this.#sk.subarray(14,18),this.#sC.push(NaN,NaN,NaN,NaN,((b+n)/2-i)/a,((v+o)/2-s)/r)):([b,v,n,o,l,h]=this.#sk.subarray(0,6),this.#sR.push(((b+5*n)/6-i)/a,((v+5*o)/6-s)/r,((5*n+l)/6-i)/a,((5*o+h)/6-s)/r,((n+l)/2-i)/a,((o+h)/2-s)/r),[l,h,n,o,b,v]=this.#sk.subarray(12,18),this.#sC.push(((b+5*n)/6-i)/a,((v+5*o)/6-s)/r,((5*n+l)/6-i)/a,((5*o+h)/6-s)/r,((n+l)/2-i)/a,((o+h)/2-s)/r)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=this.#sR,e=this.#sC,i=this.#sk.subarray(4,6),s=this.#sk.subarray(16,18),[a,r,n,o]=this.#sv,[l,h,d,c]=this.#sz();if(isNaN(this.#sk[6])&&!this.isEmpty())return`M${(this.#sk[2]-a)/n} ${(this.#sk[3]-r)/o} L${(this.#sk[4]-a)/n} ${(this.#sk[5]-r)/o} L${l} ${h} L${d} ${c} L${(this.#sk[16]-a)/n} ${(this.#sk[17]-r)/o} L${(this.#sk[14]-a)/n} ${(this.#sk[15]-r)/o} Z`;let u=[];u.push(`M${t[4]} ${t[5]}`);for(let e=6;e<t.length;e+=6)isNaN(t[e])?u.push(`L${t[e+4]} ${t[e+5]}`):u.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);u.push(`L${(i[0]-a)/n} ${(i[1]-r)/o} L${l} ${h} L${d} ${c} L${(s[0]-a)/n} ${(s[1]-r)/o}`);for(let t=e.length-6;t>=6;t-=6)isNaN(e[t])?u.push(`L${e[t+4]} ${e[t+5]}`):u.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);return u.push(`L${e[4]} ${e[5]} Z`),u.join(" ")}getOutlines(){let t=this.#sR,e=this.#sC,i=this.#sk,s=i.subarray(4,6),a=i.subarray(16,18),[r,n,o,h]=this.#sv,d=new Float64Array((this.#sN?.length??0)+2);for(let t=0,e=d.length-2;t<e;t+=2)d[t]=(this.#sN[t]-r)/o,d[t+1]=(this.#sN[t+1]-n)/h;d[d.length-2]=(this.#sI-r)/o,d[d.length-1]=(this.#sD-n)/h;let[c,u,p,g]=this.#sz();if(isNaN(i[6])&&!this.isEmpty()){let t=new Float64Array(36);return t.set([NaN,NaN,NaN,NaN,(i[2]-r)/o,(i[3]-n)/h,NaN,NaN,NaN,NaN,(i[4]-r)/o,(i[5]-n)/h,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(i[16]-r)/o,(i[17]-n)/h,NaN,NaN,NaN,NaN,(i[14]-r)/o,(i[15]-n)/h],0),new l(t,d,this.#sv,this.#sO,this.#sM,this.#sP)}let m=new Float64Array(this.#sR.length+24+this.#sC.length),f=t.length;for(let e=0;e<f;e+=2){if(isNaN(t[e])){m[e]=m[e+1]=NaN;continue}m[e]=t[e],m[e+1]=t[e+1]}m.set([NaN,NaN,NaN,NaN,(s[0]-r)/o,(s[1]-n)/h,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(a[0]-r)/o,(a[1]-n)/h],f),f+=24;for(let t=e.length-6;t>=6;t-=6)for(let i=0;i<6;i+=2){if(isNaN(e[t+i])){m[f]=m[f+1]=NaN,f+=2;continue}m[f]=e[t+i],m[f+1]=e[t+i+1],f+=2}return m.set([NaN,NaN,NaN,NaN,e[4],e[5]],f),new l(m,d,this.#sv,this.#sO,this.#sM,this.#sP)}}class l extends r{#sv;#s$=null;#sM;#sP;#sN;#sO;#sj;constructor(t,e,i,s,a,r){super(),this.#sj=t,this.#sN=e,this.#sv=i,this.#sO=s,this.#sM=a,this.#sP=r,this.#sG(r);const{x:n,y:o,width:l,height:h}=this.#s$;for(let e=0,i=t.length;e<i;e+=2)t[e]=(t[e]-n)/l,t[e+1]=(t[e+1]-o)/h;for(let t=0,i=e.length;t<i;t+=2)e[t]=(e[t]-n)/l,e[t+1]=(e[t+1]-o)/h}toSVGPath(){let t=[`M${this.#sj[4]} ${this.#sj[5]}`];for(let e=6,i=this.#sj.length;e<i;e+=6){if(isNaN(this.#sj[e])){t.push(`L${this.#sj[e+4]} ${this.#sj[e+5]}`);continue}t.push(`C${this.#sj[e]} ${this.#sj[e+1]} ${this.#sj[e+2]} ${this.#sj[e+3]} ${this.#sj[e+4]} ${this.#sj[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,i,s],a){let r,n,o=i-t,l=s-e;switch(a){case 0:r=this.#sV(this.#sj,t,s,o,-l),n=this.#sV(this.#sN,t,s,o,-l);break;case 90:r=this.#sq(this.#sj,t,e,o,l),n=this.#sq(this.#sN,t,e,o,l);break;case 180:r=this.#sV(this.#sj,i,e,-o,l),n=this.#sV(this.#sN,i,e,-o,l);break;case 270:r=this.#sq(this.#sj,i,s,-o,-l),n=this.#sq(this.#sN,i,s,-o,-l)}return{outline:Array.from(r),points:[Array.from(n)]}}#sV(t,e,i,s,a){let r=new Float64Array(t.length);for(let n=0,o=t.length;n<o;n+=2)r[n]=e+t[n]*s,r[n+1]=i+t[n+1]*a;return r}#sq(t,e,i,s,a){let r=new Float64Array(t.length);for(let n=0,o=t.length;n<o;n+=2)r[n]=e+t[n+1]*s,r[n+1]=i+t[n]*a;return r}#sG(t){let e=this.#sj,i=e[4],a=e[5],r=i,n=a,o=i,l=a,h=i,d=a,c=t?Math.max:Math.min;for(let t=6,u=e.length;t<u;t+=6){if(isNaN(e[t]))r=Math.min(r,e[t+4]),n=Math.min(n,e[t+5]),o=Math.max(o,e[t+4]),l=Math.max(l,e[t+5]),d<e[t+5]?(h=e[t+4],d=e[t+5]):d===e[t+5]&&(h=c(h,e[t+4]));else{let u=s.Util.bezierBoundingBox(i,a,...e.slice(t,t+6));r=Math.min(r,u[0]),n=Math.min(n,u[1]),o=Math.max(o,u[2]),l=Math.max(l,u[3]),d<u[3]?(h=u[2],d=u[3]):d===u[3]&&(h=c(h,u[2]))}i=e[t+4],a=e[t+5]}let u=r-this.#sM,p=n-this.#sM,g=o-r+2*this.#sM,m=l-n+2*this.#sM;this.#s$={x:u,y:p,width:g,height:m,lastPoint:[h,d]}}get box(){return this.#s$}getNewOutline(t,e){let{x:i,y:s,width:a,height:r}=this.#s$,[n,l,h,d]=this.#sv,c=a*h,u=r*d,p=i*h+n,g=s*d+l,m=new o({x:this.#sN[0]*c+p,y:this.#sN[1]*u+g},this.#sv,this.#sO,t,this.#sP,e??this.#sM);for(let t=2;t<this.#sN.length;t+=2)m.add({x:this.#sN[t]*c+p,y:this.#sN[t+1]*u+g});return m.getOutlines()}}},362:(t,e,i)=>{i.d(e,{EditorToolbar:()=>a,HighlightToolbar:()=>r});var s=i(419);class a{#sW=null;#tY=null;#iL;#sK=null;constructor(t){this.#iL=t}render(){let t=this.#sW=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",a.#iC);let e=this.#sK=document.createElement("div");e.className="buttons",t.append(e);let i=this.#iL.toolbarPosition;if(i){let{style:e}=t,s="ltr"===this.#iL._uiManager.direction?1-i[0]:i[0];e.insetInlineEnd=`${100*s}%`,e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return this.#sX(),t}static #iC(t){t.stopPropagation()}#sY(t){this.#iL._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#sJ(t){this.#iL._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#sQ(t){t.addEventListener("focusin",this.#sY.bind(this),{capture:!0}),t.addEventListener("focusout",this.#sJ.bind(this),{capture:!0}),t.addEventListener("contextmenu",s.noContextMenu)}hide(){this.#sW.classList.add("hidden"),this.#tY?.hideDropdown()}show(){this.#sW.classList.remove("hidden")}#sX(){let t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#iL.editorType}-button`),this.#sQ(t),t.addEventListener("click",t=>{this.#iL._uiManager.delete()}),this.#sK.append(t)}get #sZ(){let t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#sQ(t),this.#sK.prepend(t,this.#sZ)}addColorPicker(t){this.#tY=t;let e=t.renderButton();this.#sQ(e),this.#sK.prepend(e,this.#sZ)}remove(){this.#sW.remove(),this.#tY?.destroy(),this.#tY=null}}class r{#sK=null;#sW=null;#iA;constructor(t){this.#iA=t}#s0(){let t=this.#sW=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",s.noContextMenu);let e=this.#sK=document.createElement("div");return e.className="buttons",t.append(e),this.#s1(),t}
2#s2(t,e){let i=0,s=0;for(let a of t){let t=a.y+a.height;if(t<i)continue;let r=a.x+(e?a.width:0);if(t>i){s=r,i=t;continue}e?r>s&&(s=r):r<s&&(s=r)}return[e?1-s:s,i]}show(t,e,i){let[s,a]=this.#s2(e,i),{style:r}=this.#sW||=this.#s0();t.append(this.#sW),r.insetInlineEnd=`${100*s}%`,r.top=`calc(${100*a}% + var(--editor-toolbar-vert-offset))`}hide(){this.#sW.remove()}#s1(){let t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");let e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label"),t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("click",()=>{this.#iA.highlightSelection("floating_button")}),this.#sK.append(t)}}},830:(t,e,i)=>{i.d(e,{AnnotationEditorUIManager:()=>p,ColorManager:()=>u,KeyboardManager:()=>c,bindEvents:()=>n,opacityToHex:()=>o});var s=i(292),a=i(419),r=i(362);function n(t,e,i){for(let s of i)e.addEventListener(s,t[s].bind(t))}function o(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}class l{#tg=0;get id(){return`${s.AnnotationEditorPrefix}${this.#tg++}`}}class h{#s3=(0,s.getUuid)();#tg=0;#tm=null;static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d"),e=new Image;e.src='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>';let i=e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]));return(0,s.shadow)(this,"_isSVGFittingCanvas",i)}async #s5(t,e){this.#tm||=new Map;let i=this.#tm.get(t);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let t;if(i||={bitmap:null,id:`image_${this.#s3}_${this.#tg++}`,refCounter:0,isSvg:!1},"string"==typeof e?(i.url=e,t=await (0,a.fetchData)(e,"blob")):t=i.file=e,"image/svg+xml"===t.type){let e=h._isSVGFittingCanvas,s=new FileReader,a=new Image,r=new Promise((t,r)=>{a.onload=()=>{i.bitmap=a,i.isSvg=!0,t()},s.onload=async()=>{let t=i.svgUrl=s.result;a.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},a.onerror=s.onerror=r});s.readAsDataURL(t),await r}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){console.error(t),i=null}return this.#tm.set(t,i),i&&this.#tm.set(i.id,i),i}async getFromFile(t){let{lastModified:e,name:i,size:s,type:a}=t;return this.#s5(`${e}_${i}_${s}_${a}`,t)}async getFromUrl(t){return this.#s5(t,t)}async getFromId(t){this.#tm||=new Map;let e=this.#tm.get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){let e=this.#tm.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#tm||=new Map;let e=this.#tm.get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#s3}_`)}}class d{#s6=[];#s4=!1;#s8;#s9=-1;constructor(t=128){this.#s8=t}add({cmd:t,undo:e,post:i,mustExec:s,type:a=NaN,overwriteIfSameType:r=!1,keepUndo:n=!1}){if(s&&t(),this.#s4)return;let o={cmd:t,undo:e,post:i,type:a};if(-1===this.#s9){this.#s6.length>0&&(this.#s6.length=0),this.#s9=0,this.#s6.push(o);return}if(r&&this.#s6[this.#s9].type===a){n&&(o.undo=this.#s6[this.#s9].undo),this.#s6[this.#s9]=o;return}let l=this.#s9+1;l===this.#s8?this.#s6.splice(0,1):(this.#s9=l,l<this.#s6.length&&this.#s6.splice(l)),this.#s6.push(o)}undo(){if(-1===this.#s9)return;this.#s4=!0;let{undo:t,post:e}=this.#s6[this.#s9];t(),e?.(),this.#s4=!1,this.#s9-=1}redo(){if(this.#s9<this.#s6.length-1){this.#s9+=1,this.#s4=!0;let{cmd:t,post:e}=this.#s6[this.#s9];t(),e?.(),this.#s4=!1}}hasSomethingToUndo(){return -1!==this.#s9}hasSomethingToRedo(){return this.#s9<this.#s6.length-1}destroy(){this.#s6=null}}class c{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=s.FeatureTest.platform;for(const[i,s,a={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:a}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:a}),this.allKeys.add(t.split("+").at(-1)))}}#s7(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get(this.#s7(e));if(!i)return;let{callback:s,options:{bubbles:a=!1,args:r=[],checker:n=null}}=i;(!n||n(t,e))&&(s.bind(t,...r,e)(),a||(e.stopPropagation(),e.preventDefault()))}}class u{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return(0,a.getColorValues)(t),(0,s.shadow)(this,"_colors",t)}convert(t){let e=(0,a.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return u._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?s.Util.makeHexColor(...e):t}}class p{#at=null;#ae=new Map;#ai=new Map;#as=null;#aa=null;#ar=null;#an=new d;#ao=0;#al=new Set;#ah=null;#iy=null;#ad=new Set;#ac=!1;#au=null;#ap=null;#ag=null;#am=!1;#af=null;#ab=new l;#av=!1;#aA=!1;#ay=null;#a_=null;#aE=null;#aw=s.AnnotationEditorType.NONE;#ax=new Set;#aT=null;#aS=null;#aC=null;#aM=this.blur.bind(this);#aP=this.focus.bind(this);#aR=this.copy.bind(this);#ak=this.cut.bind(this);#aI=this.paste.bind(this);#t3=this.keydown.bind(this);#aD=this.keyup.bind(this);#aL=this.onEditingAction.bind(this);#aF=this.onPageChanging.bind(this);#aO=this.onScaleChanging.bind(this);#aN=this.#aB.bind(this);#aH=this.onRotationChanging.bind(this);#aU={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#az=[0,0];#a$=null;#m=null;#aj=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=p.prototype,e=t=>t.#m.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,{target:e})=>
2{if(e instanceof HTMLInputElement){let{type:t}=e;return"text"!==t&&"number"!==t}return!0},a=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return(0,s.shadow)(this,"_keyboardManager",new c([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#m.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#m.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}]]))}constructor(t,e,i,s,r,n,o,l,h){this.#m=t,this.#aj=e,this.#as=i,this._eventBus=s,this._eventBus._on("editingaction",this.#aL),this._eventBus._on("pagechanging",this.#aF),this._eventBus._on("scalechanging",this.#aO),this._eventBus._on("rotationchanging",this.#aH),this.#aG(),this.#aV(),this.#aa=r.annotationStorage,this.#au=r.filterFactory,this.#aS=n,this.#ag=o||null,this.#ac=l,this.#aE=h||null,this.viewParameters={realScale:a.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){for(let t of(this.#aq(),this.#aW(),this._eventBus._off("editingaction",this.#aL),this._eventBus._off("pagechanging",this.#aF),this._eventBus._off("scalechanging",this.#aO),this._eventBus._off("rotationchanging",this.#aH),this.#ai.values()))t.destroy();this.#ai.clear(),this.#ae.clear(),this.#ad.clear(),this.#at=null,this.#ax.clear(),this.#an.destroy(),this.#as?.destroy(),this.#af?.hide(),this.#af=null,this.#ap&&(clearTimeout(this.#ap),this.#ap=null),this.#a$&&(clearTimeout(this.#a$),this.#a$=null),this.#aK()}async mlGuess(t){return this.#aE?.guess(t)||null}get hasMLManager(){return!!this.#aE}get hcmFilter(){return(0,s.shadow)(this,"hcmFilter",this.#aS?this.#au.addHCMFilter(this.#aS.foreground,this.#aS.background):"none")}get direction(){return(0,s.shadow)(this,"direction",getComputedStyle(this.#m).direction)}get highlightColors(){return(0,s.shadow)(this,"highlightColors",this.#ag?new Map(this.#ag.split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return(0,s.shadow)(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#a_=t}editAltText(t){this.#as?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#ao=t-1}focusMainContainer(){this.#m.focus()}findParent(t,e){for(let i of this.#ai.values()){let{x:s,y:a,width:r,height:n}=i.div.getBoundingClientRect();if(t>=s&&t<=s+r&&e>=a&&e<=a+n)return i}return null}disableUserSelect(t=!1){this.#aj.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#ad.add(t)}removeShouldRescale(t){this.#ad.delete(t)}onScaleChanging({scale:t}){for(let e of(this.commitOrRemove(),this.viewParameters.realScale=t*a.PixelsPerInch.PDF_TO_CSS_UNITS,this.#ad))e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#aX({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){let e=document.getSelection();if(!e||e.isCollapsed)return;let{anchorNode:i,anchorOffset:a,focusNode:r,focusOffset:n}=e,o=e.toString(),l=this.#aX(e).closest(".textLayer"),h=this.getSelectionBoxes(l);if(h){for(let d of(e.empty(),this.#aw===s.AnnotationEditorType.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:s.AnnotationEditorType.HIGHLIGHT}
2),this.showAllEditors("highlight",!0,!0)),this.#ai.values()))if(d.hasTextLayer(l)){d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:a,focusNode:r,focusOffset:n,text:o});break}}}#aY(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=this.#aX(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#af||=new r.HighlightToolbar(this),this.#af.show(e,i,"ltr"===this.direction))}addToAnnotationStorage(t){t.isEmpty()||!this.#aa||this.#aa.has(t.id)||this.#aa.setValue(t.id,t)}#aB(){let t=document.getSelection();if(!t||t.isCollapsed){this.#aT&&(this.#af?.hide(),this.#aT=null,this.#aJ({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e!==this.#aT){if(!this.#aX(t).closest(".textLayer")){this.#aT&&(this.#af?.hide(),this.#aT=null,this.#aJ({hasSelectedText:!1}));return}if(this.#af?.hide(),this.#aT=e,this.#aJ({hasSelectedText:!0}),(this.#aw===s.AnnotationEditorType.HIGHLIGHT||this.#aw===s.AnnotationEditorType.NONE)&&(this.#aw===s.AnnotationEditorType.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#am=this.isShiftKeyDown,!this.isShiftKeyDown)){let t=e=>{("pointerup"!==e.type||0===e.button)&&(window.removeEventListener("pointerup",t),window.removeEventListener("blur",t),"pointerup"===e.type&&this.#aQ("main_toolbar"))};window.addEventListener("pointerup",t),window.addEventListener("blur",t)}}}#aQ(t=""){this.#aw===s.AnnotationEditorType.HIGHLIGHT?this.highlightSelection(t):this.#ac&&this.#aY()}#aG(){document.addEventListener("selectionchange",this.#aN)}#aK(){document.removeEventListener("selectionchange",this.#aN)}#aZ(){window.addEventListener("focus",this.#aP),window.addEventListener("blur",this.#aM)}#aW(){window.removeEventListener("focus",this.#aP),window.removeEventListener("blur",this.#aM)}blur(){if(this.isShiftKeyDown=!1,this.#am&&(this.#am=!1,this.#aQ("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#ax)if(e.div.contains(t)){this.#ay=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#ay)return;let[t,e]=this.#ay;this.#ay=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus()}#aV(){window.addEventListener("keydown",this.#t3),window.addEventListener("keyup",this.#aD)}#aq(){window.removeEventListener("keydown",this.#t3),window.removeEventListener("keyup",this.#aD)}#a0(){document.addEventListener("copy",this.#aR),document.addEventListener("cut",this.#ak),document.addEventListener("paste",this.#aI)}#a1(){document.removeEventListener("copy",this.#aR),document.removeEventListener("cut",this.#ak),document.removeEventListener("paste",this.#aI)}addEditListeners(){this.#aV(),this.#a0()}removeEditListeners(){this.#aq(),this.#a1()}copy(t){if(t.preventDefault(),this.#at?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let t of this.#ax){let i=t.serialize(!0);i&&e.push(i)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of this.#iy)if(e.isHandlingMimeForPasting(t.type))return void e.paste(t,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){(0,s.warn)(`paste: "${t.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let a=this.currentLayer;try{let t=[];for(let e of i){let i=a.deserialize(e);if(!i)return;t.push(i)}let e=()=>{for(let e of t)this.#a2(e);this.#a3(t)};this.addCommands({cmd:e,undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){(0,s.warn)(`paste: "${t.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#aw===s.AnnotationEditorType.NONE||this.isEditorHandlingKeyboard||p._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#am&&(this.#am=!1,this.#aQ("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#aJ(t){Object.entries(t).some(([t,e])=>this.#aU[t]!==e)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#aU,t)}),this.#aw===s.AnnotationEditorType.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#a5([[s.AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))}#a5(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#aZ(),this.#a0(),this.#aJ({isEditing:this.#aw!==s.AnnotationEditorType.NONE,isEmpty:this.#a6(),hasSomethingToUndo:this.#an.hasSomethingToUndo(),hasSomethingToRedo:this.#an.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#aW(),this.#a1(),this.#aJ({isEditing:!1}),this.disableUserSelect(!1))}
2registerEditorTypes(t){if(!this.#iy)for(let e of(this.#iy=t,this.#iy))this.#a5(e.defaultPropertiesToUpdate)}getId(){return this.#ab.id}get currentLayer(){return this.#ai.get(this.#ao)}getLayer(t){return this.#ai.get(t)}get currentPageIndex(){return this.#ao}addLayer(t){this.#ai.set(t.pageIndex,t),this.#av?t.enable():t.disable()}removeLayer(t){this.#ai.delete(t.pageIndex)}updateMode(t,e=null,i=!1){if(this.#aw!==t){if(this.#aw=t,t===s.AnnotationEditorType.NONE){this.setEditingState(!1),this.#a4();return}for(let e of(this.setEditingState(!0),this.#a8(),this.unselectAll(),this.#ai.values()))e.updateMode(t);if(!e&&i)return void this.addNewEditorFromKeyboard();if(e){for(let t of this.#ae.values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#aw&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(this.#iy){switch(t){case s.AnnotationEditorParamsType.CREATE:this.currentLayer.addNewEditor();return;case s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:this.#a_?.updateColor(e);break;case s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#aC||=new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of this.#ax)i.updateParams(t,e);for(let i of this.#iy)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let i of this.#ae.values())i.editorType===t&&i.show(e);(this.#aC?.get(s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#a5([[s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#aA!==t)for(let e of(this.#aA=t,this.#ai.values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}#a8(){if(!this.#av){for(let t of(this.#av=!0,this.#ai.values()))t.enable();for(let t of this.#ae.values())t.enable()}}#a4(){if(this.unselectAll(),this.#av){for(let t of(this.#av=!1,this.#ai.values()))t.disable();for(let t of this.#ae.values())t.disable()}}getEditors(t){let e=[];for(let i of this.#ae.values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return this.#ae.get(t)}addEditor(t){this.#ae.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#ap&&clearTimeout(this.#ap),this.#ap=setTimeout(()=>{this.focusMainContainer(),this.#ap=null},0)),this.#ae.delete(t.id),this.unselect(t),t.annotationElementId&&this.#al.has(t.annotationElementId)||this.#aa?.remove(t.id)}addDeletedAnnotationElement(t){this.#al.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#al.has(t)}removeDeletedAnnotationElement(t){this.#al.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#a2(t){let e=this.#ai.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#at!==t&&(this.#at=t,t&&this.#a5(t.propertiesToUpdate))}get #a9(){let t=null;for(t of this.#ax);return t}updateUI(t){this.#a9===t&&this.#a5(t.propertiesToUpdate)}toggleSelected(t){if(this.#ax.has(t)){this.#ax.delete(t),t.unselect(),this.#aJ({hasSelectedEditor:this.hasSelection});return}this.#ax.add(t),t.select(),this.#a5(t.propertiesToUpdate),this.#aJ({hasSelectedEditor:!0})}setSelected(t){for(let e of this.#ax)e!==t&&e.unselect();this.#ax.clear(),this.#ax.add(t),t.select(),this.#a5(t.propertiesToUpdate),this.#aJ({hasSelectedEditor:!0})}isSelected(t){return this.#ax.has(t)}get firstSelectedEditor(){return this.#ax.values().next().value}unselect(t){t.unselect(),this.#ax.delete(t),this.#aJ({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#ax.size}get isEnterHandled(){return 1===this.#ax.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#an.undo(),this.#aJ({hasSomethingToUndo:this.#an.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#a6()})}redo(){this.#an.redo(),this.#aJ({hasSomethingToUndo:!0,hasSomethingToRedo:this.#an.hasSomethingToRedo(),isEmpty:this.#a6()})}addCommands(t){this.#an.add(t),this.#aJ({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#a6()})}#a6(){if(0===this.#ae.size)return!0;
2if(1===this.#ae.size)for(let t of this.#ae.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let t=[...this.#ax],e=()=>{for(let e of t)this.#a2(e)};this.addCommands({cmd:()=>{for(let e of t)e.remove()},undo:e,mustExec:!0})}commitOrRemove(){this.#at?.commitOrRemove()}hasSomethingToControl(){return this.#at||this.hasSelection}#a3(t){for(let t of this.#ax)t.unselect();for(let e of(this.#ax.clear(),t))e.isEmpty()||(this.#ax.add(e),e.select());this.#aJ({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#ax)t.commit();this.#a3(this.#ae.values())}unselectAll(){if((!this.#at||(this.#at.commitOrRemove(),this.#aw===s.AnnotationEditorType.NONE))&&this.hasSelection){for(let t of this.#ax)t.unselect();this.#ax.clear(),this.#aJ({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#az[0]+=t,this.#az[1]+=e;let[s,a]=this.#az,r=[...this.#ax];for(let i of(this.#a$&&clearTimeout(this.#a$),this.#a$=setTimeout(()=>{this.#a$=null,this.#az[0]=this.#az[1]=0,this.addCommands({cmd:()=>{for(let t of r)this.#ae.has(t.id)&&t.translateInPage(s,a)},undo:()=>{for(let t of r)this.#ae.has(t.id)&&t.translateInPage(-s,-a)},mustExec:!1})},1e3),r))i.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),this.#ah=new Map,this.#ax))this.#ah.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#ah)return!1;this.disableUserSelect(!1);let t=this.#ah;this.#ah=null;let e=!1;for(let[{x:i,y:s,pageIndex:a},r]of t)r.newX=i,r.newY=s,r.newPageIndex=a,e||=i!==r.savedX||s!==r.savedY||a!==r.savedPageIndex;if(!e)return!1;let i=(t,e,i,s)=>{if(this.#ae.has(t.id)){let a=this.#ai.get(s);a?t._setParentAndPosition(a,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:s,newY:a,newPageIndex:r}]of t)i(e,s,a,r)},undo:()=>{for(let[e,{savedX:s,savedY:a,savedPageIndex:r}]of t)i(e,s,a,r)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#ah)for(let i of this.#ah.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#ax.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#at===t}getActive(){return this.#at}getMode(){return this.#aw}get imageManager(){return(0,s.shadow)(this,"imageManager",new h)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,s=i.rangeCount;e<s;e++)if(!t.contains(i.getRangeAt(e).commonAncestorContainer))return null;let{x:s,y:a,width:r,height:n}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,o)=>({x:(e-a)/n,y:1-(t+i-s)/r,width:o/n,height:i/r});break;case"180":e=(t,e,i,o)=>({x:1-(t+i-s)/r,y:1-(e+o-a)/n,width:i/r,height:o/n});break;case"270":e=(t,e,i,o)=>({x:1-(e+o-a)/n,y:(t-s)/r,width:o/n,height:i/r});break;default:e=(t,e,i,o)=>({x:(t-s)/r,y:(e-a)/n,width:i/r,height:o/n})}let o=[];for(let t=0,s=i.rangeCount;t<s;t++){let s=i.getRangeAt(t);if(!s.collapsed)for(let{x:t,y:i,width:a,height:r}of s.getClientRects())0!==a&&0!==r&&o.push(e(t,i,a,r))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#ar||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#ar?.delete(t)}renderAnnotationElement(t){let e=this.#ar?.get(t.data.id);if(!e)return;let i=this.#aa.getRawValue(e);!i||(this.#aw!==s.AnnotationEditorType.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}}},94:(t,e,i)=>{i.d(e,{PDFFetchStream:()=>l});var s=i(292),a=i(490);function r(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function n(t){let e=new Headers;for(let i in t){let s=t[i];void 0!==s&&e.append(i,s)}return e}function o(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:((0,s.warn)(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class l{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,s.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new h(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new d(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class h{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=n(this._stream.httpHeaders);const i=e.url;fetch(i,r(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,a.validateResponseStatus)(t.status))throw(0,a.createResponseStatusError)(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();let e=e=>t.headers.get(e),{allowRangeRequests:r,suggestedLength:n}=(0,a.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=n||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new s.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;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:o(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class d{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=n(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${i-1}`);const o=s.url;fetch(o,r(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,a.validateResponseStatus)(t.status))throw(0,a.createResponseStatusError)(t.status,o);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:o(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}},10:(t,e,i)=>{i.d(e,{FontFaceObject:()=>r,FontLoader:()=>a});var s=i(292);class a{#a7=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#a7.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}
2){if(!(!t||this.#a7.has(t.loadedName))){if((0,s.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:a,style:r}=t,n=new FontFace(i,a,r);this.addNativeFontFace(n);try{await n.load(),this.#a7.add(i),e?.(t)}catch{(0,s.warn)(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(n)}return}(0,s.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw(0,s.warn)(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return(0,s.shadow)(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return s.isNodeJS?t=!0:"u">typeof navigator&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(t=!0),(0,s.shadow)(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for((0,s.assert)(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){let t=e.shift();setTimeout(t.callback,0)}},callback:t};return e.push(i),i}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,s.shadow)(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){let i,a;function r(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function n(t,e,i,s){let a=t.substring(0,e),r=t.substring(e+i);return a+s+r}let o=this._document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d"),h=0,d=`lt${Date.now()}${this.loadTestFontId++}`,c=this._loadTestFont;c=n(c,976,d.length,d);let u=r(c,16);for(i=0,a=d.length-3;i<a;i+=4)u=u-0x58585858+r(d,i)|0;i<d.length&&(u=u-0x58585858+r(d+"XXX",i)|0),c=n(c,16,4,(0,s.string32)(u));let p=`url(data:font/opentype;base64,${btoa(c)});`,g=`@font-face {font-family:"${d}";src:${p}}`;this.insertRule(g);let m=this._document.createElement("div");for(let e of(m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,m.append(t)}this._document.body.append(m),function t(e,i){if(++h>30){(0,s.warn)("Load test font never loaded."),i();return}(l.font="30px "+e,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0)?i():setTimeout(t.bind(null,e,i))}(d,()=>{m.remove(),e.complete()})}}
2class r{constructor(t,{disableFontFace:e=!1,ignoreErrors:i=!1,inspectFont:s=null}){for(const e in this.compiledGlyphs=Object.create(null),t)this[e]=t[e];this.disableFontFace=!0===e,this.ignoreErrors=!0===i,this._inspectFont=s}createNativeFontFace(){let t;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){let t;if(!this.data||this.disableFontFace)return null;let e=(0,s.bytesToString)(this.data),i=`url(data:${this.mimetype};base64,${btoa(e)});`;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${i}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${i}}`;return this._inspectFont?.(this,i),t}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];try{i=t.get(this.loadedName+"_path_"+e)}catch(t){if(!this.ignoreErrors)throw t;(0,s.warn)(`getPathGenerator - ignoring character: "${t}".`)}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};let a=[];for(let t=0,e=i.length;t<e;)switch(i[t++]){case s.FontRenderOps.BEZIER_CURVE_TO:{let[e,s,r,n,o,l]=i.slice(t,t+6);a.push(t=>t.bezierCurveTo(e,s,r,n,o,l)),t+=6}break;case s.FontRenderOps.MOVE_TO:{let[e,s]=i.slice(t,t+2);a.push(t=>t.moveTo(e,s)),t+=2}break;case s.FontRenderOps.LINE_TO:{let[e,s]=i.slice(t,t+2);a.push(t=>t.lineTo(e,s)),t+=2}break;case s.FontRenderOps.QUADRATIC_CURVE_TO:{let[e,s,r,n]=i.slice(t,t+4);a.push(t=>t.quadraticCurveTo(e,s,r,n)),t+=4}break;case s.FontRenderOps.RESTORE:a.push(t=>t.restore());break;case s.FontRenderOps.SAVE:a.push(t=>t.save());break;case s.FontRenderOps.SCALE:(0,s.assert)(2===a.length,"Scale command is only valid at the third position.");break;case s.FontRenderOps.TRANSFORM:{let[e,s,r,n,o,l]=i.slice(t,t+6);a.push(t=>t.transform(e,s,r,n,o,l)),t+=6}break;case s.FontRenderOps.TRANSLATE:{let[e,s]=i.slice(t,t+2);a.push(t=>t.translate(e,s)),t+=2}}return this.compiledGlyphs[e]=function(t,e){a[0](t),a[1](t),t.scale(e,-e);for(let e=2,i=a.length;e<i;e++)a[e](t)}}}},62:(t,e,i)=>{i.d(e,{Metadata:()=>a});var s=i(292);class a{#rt;#re;constructor({parsedData:t,rawData:e}){this.#rt=t,this.#re=e}getRaw(){return this.#re}get(t){return this.#rt.get(t)??null}getAll(){return(0,s.objectFromMap)(this.#rt)}has(t){return this.#rt.has(t)}}},457:(t,e,i)=>{i.d(e,{PDFNetworkStream:()=>n});var s=i(292),a=i(490);class r{constructor(t,e={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){let s={begin:t,end:e};for(let t in i)s[t]=i[t];return this.request(s)}requestFull(t){return this.request(t)}request(t){let e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};for(let t in e.open("GET",this.url),e.withCredentials=this.withCredentials,this.httpHeaders){let i=this.httpHeaders[t];void 0!==i&&e.setRequestHeader(t,i)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){let i=this.pendingRequests[t];i&&i.onProgress?.(e)}onStateChange(t,e){let i,a=this.pendingRequests[t];if(!a)return;let r=a.xhr;if(r.readyState>=2&&a.onHeadersReceived&&(a.onHeadersReceived(),delete a.onHeadersReceived),4!==r.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===r.status&&this.isHttp)return void a.onError?.(r.status);let n=r.status||200;if((200!==n||206!==a.expectedStatus)&&n!==a.expectedStatus)return void a.onError?.(r.status);let o=(i=r.response,"string"!=typeof i?i:(0,s.stringToBytes)(i).buffer);if(206===n){let t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);a.onDone({begin:parseInt(e[1],10),chunk:o})}else o?a.onDone({begin:0,chunk:o}):a.onError?.(r.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
2abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class n{constructor(t){this._source=t,this._manager=new r(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return(0,s.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new o(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new l(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class o{constructor(t,e){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.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(){let t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=t=>e.getResponseHeader(t),{allowRangeRequests:s,suggestedLength:r}=(0,a.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){for(let e of(this._storedError=(0,a.createResponseStatusError)(t,this._url),this._headersReceivedCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.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};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let e of(this._done=!0,this._headersReceivedCapability.reject(t),this._requests))e.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(t,e,i){this._manager=t;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){let e=t.chunk;for(let t of(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){for(let e of(this._storedError=(0,a.createResponseStatusError)(t,this._url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest
2(this._requestId),this._close()}}},490:(t,e,i)=>{i.d(e,{createResponseStatusError:()=>o,extractFilenameFromHeader:()=>n,validateRangeRequestCapabilities:()=>r,validateResponseStatus:()=>l});var s=i(292),a=i(419);function r({getResponseHeader:t,isHttp:e,rangeChunkSize:i,disableRange:s}){let a={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(t("Content-Length"),10);if(!Number.isInteger(n)||(a.suggestedLength=n,n<=2*i||s||!e||"bytes"!==t("Accept-Ranges")))return a;let o=t("Content-Encoding")||"identity";return"identity"!==o||(a.allowRangeRequests=!0),a}function n(t){let e=t("Content-Disposition");if(e){let t=function(t){let e=!0,i=a("filename\\*","i").exec(t);if(i){i=i[1];let t=o(i);return t=unescape(t),t=l(t),t=h(t),n(t)}if(i=function(t){let e,i=[],s=a("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=s.exec(t));){let[,t,s,a]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[s,a]}let r=[];for(let t=0;t<i.length&&t in i;++t){let[e,s]=i[t];s=o(s),e&&(s=unescape(s),0===t&&(s=l(s))),r.push(s)}return r.join("")}(t)){let t=h(i);return n(t)}if(i=a("filename","i").exec(t)){i=i[1];let t=o(i);return t=h(t),n(t)}function a(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function r(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let a=new TextDecoder(t,{fatal:!0}),r=(0,s.stringToBytes)(i);i=a.decode(r),e=!1}catch{}}return i}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=r("utf-8",t),e&&(t=r("iso-8859-1",t))),t}function o(t){if(t.startsWith('"')){let e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){let i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function l(t){let e=t.indexOf("'");if(-1===e)return t;let i=t.slice(0,e),s=t.slice(e+1).replace(/^[^']*'/,"");return r(i,s)}function h(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,s){if("q"===i||"Q"===i)return s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}),r(e,s);try{s=atob(s)}catch{}return r(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if((0,a.isPdfFile)(t))return t}return null}function o(t,e){return 404===t||0===t&&e.startsWith("file:")?new s.MissingPDFException('Missing PDF "'+e+'".'):new s.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)}function l(t){return 200===t||206===t}},786:(t,e,i)=>{i.a(t,async(t,s)=>{try{let t,o,l,h;i.d(e,{PDFNodeStream:()=>c});var a=i(292),r=i(490);a.isNodeJS&&(t=await import("fs"),o=await import("http"),l=await import("https"),h=await import("url"));let d=/^file:\/\/\/[a-zA-Z]:\//;class c{constructor(t){this.source=t,this.url=function(t){let e=h.parse(t);return"file:"===e.protocol||e.host?e:/^[a-z]:[/\\]/i.test(t)?h.parse(`file:///${t}`):(e.host||(e.protocol="file:"),e)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,a.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new f(this):new g(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=this.isFsUrl?new b(this,t,e):new m(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeRequestReaders.slice(0)))e.cancel(t)}}class u{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new a.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class p{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.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;let t=this._readableStream.read();return null===t?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function n(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class g extends u{constructor(t){super(t);const e=e=>{if(404===e.statusCode){let t=new a.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t,this._headersCapability.reject(t);return}this._headersCapability.resolve(),this._setReadableStream(e);let i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:s,suggestedLength:n}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(i)};this._request=null,"http:"===this._url.protocol?this._request=o.request(n(this._url,t.httpHeaders),e):this._request=l.request(n(this._url,t.httpHeaders),e),this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class m extends p{constructor(t,e,i){for(const e in super(t),this._httpHeaders={},t.httpHeaders){const i=t.httpHeaders[e];void 0!==i&&(this._httpHeaders[e]=i)}this._httpHeaders.Range=`bytes=${e}-${i-1}`;const s=t=>{if(404===t.statusCode){let t=new a.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t;return}this._setReadableStream(t)};this._request=null,"http:"===this._url.protocol?this._request=o.request(n(this._url,this._httpHeaders),s):this._request=l.request(n(this._url,this._httpHeaders),s),this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class f extends u{constructor(e){super(e);let i=decodeURIComponent(this._url.path);d.test(this._url.href)&&(i=i.replace(/^\//,"")),t.promises.lstat(i).then(e=>{this._contentLength=e.size,this._setReadableStream(t.createReadStream(i)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new a.MissingPDFException(`Missing PDF "${i}".`)),this._storedError=t,this._headersCapability.reject(t)})}}class b extends p{constructor(e,i,s){super(e);let a=decodeURIComponent(this._url.path);d.test(this._url.href)&&(a=a.replace(/^\//,"")),this._setReadableStream(t.createReadStream(a,{start:i,end:s-1}))}}s()}catch(t){s(t)}},1)},573:(t,e,i)=>{i.a(t,async(t,s)=>{try{let t,r;i.d(e,{NodeCMapReaderFactory:()=>h,NodeCanvasFactory:()=>l,NodeFilterFactory:()=>o,NodeStandardFontDataFactory:()=>d});var a=i(583);if(i(292).isNodeJS){t=await import("fs");try{r=await import("canvas")}catch{}try{await import("path2d")}catch{}}let n=function(e){return t.promises.readFile(e).then(t=>new Uint8Array(t))};class o extends a.BaseFilterFactory{}class l extends a.BaseCanvasFactory{_createCanvas(t,e){return r.createCanvas(t,e)}}class h extends a.BaseCMapReaderFactory{_fetchData(t,e){return n(t).then(t=>({cMapData:t,compressionType:e}))}}class d extends a.BaseStandardFontDataFactory{_fetchData(t){return n(t)}}s()}catch(t){s(t)}},1)}
2,626:(t,e,i)=>{i.d(e,{OptionalContentConfig:()=>o});var s=i(292),a=i(651);let r=Symbol("INTERNAL");class n{#ri=!1;#rs=!1;#ra=!1;#rr=!0;constructor(t,{name:e,intent:i,usage:a}){this.#ri=!!(t&s.RenderingIntentFlag.DISPLAY),this.#rs=!!(t&s.RenderingIntentFlag.PRINT),this.name=e,this.intent=i,this.usage=a}get visible(){if(this.#ra)return this.#rr;if(!this.#rr)return!1;let{print:t,view:e}=this.usage;return this.#ri?e?.viewState!=="OFF":!this.#rs||t?.printState!=="OFF"}_setVisible(t,e,i=!1){t!==r&&(0,s.unreachable)("Internal method `_setVisible` called."),this.#ra=i,this.#rr=e}}class o{#rn=null;#ro=new Map;#rl=null;#rh=null;constructor(t,e=s.RenderingIntentFlag.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(const i of(this.name=t.name,this.creator=t.creator,this.#rh=t.order,t.groups))this.#ro.set(i.id,new n(e,i));if("OFF"===t.baseState)for(const t of this.#ro.values())t._setVisible(r,!1);for(const e of t.on)this.#ro.get(e)._setVisible(r,!0);for(const e of t.off)this.#ro.get(e)._setVisible(r,!1);this.#rl=this.getHash()}#rd(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let a=1;a<e;a++){let e,r=t[a];if(Array.isArray(r))e=this.#rd(r);else{if(!this.#ro.has(r))return(0,s.warn)(`Optional content group not found: ${r}`),!0;e=this.#ro.get(r).visible}switch(i){case"And":if(!e)return!1;break;case"Or":if(e)return!0;break;case"Not":return!e;default:return!0}}return"And"===i}isVisible(t){if(0===this.#ro.size)return!0;if(!t)return(0,s.info)("Optional content group not defined."),!0;if("OCG"===t.type)return this.#ro.has(t.id)?this.#ro.get(t.id).visible:((0,s.warn)(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#rd(t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!this.#ro.has(e)){(0,s.warn)(`Optional content group not found: ${e}`);break}if(!this.#ro.get(e).visible)return!1}return!0}else if("AnyOff"===t.policy){for(let e of t.ids){if(!this.#ro.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(!this.#ro.get(e).visible)return!0}return!1}else if("AllOff"===t.policy){for(let e of t.ids){if(!this.#ro.has(e)){(0,s.warn)(`Optional content group not found: ${e}`);break}if(this.#ro.get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!this.#ro.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(this.#ro.get(e).visible)return!0}return!1}return(0,s.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,s.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0){let i=this.#ro.get(t);i?(i._setVisible(r,!!e,!0),this.#rn=null):(0,s.warn)(`Optional content group not found: ${t}`)}setOCGState({state:t,preserveRB:e}){let i;for(let e of t){switch(e){case"ON":case"OFF":case"Toggle":i=e;continue}let t=this.#ro.get(e);if(t)switch(i){case"ON":t._setVisible(r,!0);break;case"OFF":t._setVisible(r,!1);break;case"Toggle":t._setVisible(r,!t.visible)}}this.#rn=null}get hasInitialVisibility(){return null===this.#rl||this.getHash()===this.#rl}getOrder(){return this.#ro.size?this.#rh?this.#rh.slice():[...this.#ro.keys()]:null}getGroups(){return this.#ro.size>0?(0,s.objectFromMap)(this.#ro):null}getGroup(t){return this.#ro.get(t)||null}getHash(){if(null!==this.#rn)return this.#rn;let t=new a.MurmurHash3_64;for(let[e,i]of this.#ro)t.update(`${e}:${i.visible}`);return this.#rn=t.hexdigest()}}},814:(t,e,i)=>{i.d(e,{cleanupTextLayer:()=>l,renderTextLayer:()=>c,updateTextLayer:()=>u});var s=i(292),a=i(419);let r=new Map,n=null;function o(){if(!n){let t=document.createElement("canvas");t.className="hiddenCanvasElement",document.body.append(t),n=t.getContext("2d",{alpha:!1})}return n}function l(){n?.canvas.remove(),n=null}function h(t){let{div:e,scale:i,properties:s,ctx:a,prevFontSize:r,prevFontFamily:n}=t,{style:o}=e,l="";if(0!==s.canvasWidth&&s.hasText){let{fontFamily:h}=o,{canvasWidth:d,fontSize:c}=s;(r!==c||n!==h)&&(a.font=`${c*i}px ${h}`,t.prevFontSize=c,t.prevFontFamily=h);let{width:u}=a.measureText(e.textContent);u>0&&(l=`scaleX(${d*i/u})`)}0!==s.angle&&(l=`rotate(${s.angle}deg) ${l}`),l.length>0&&(o.transform=l)}class d{constructor({textContentSource:t,container:e,viewport:i,textDivs:s,textDivProperties:r,textContentItemsStr:n}){this._textContentSource=t,this._isReadableStream=t instanceof ReadableStream,this._container=this._rootContainer=e,this._textDivs=s||[],this._textContentItemsStr=n||[],this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=r||new WeakMap,this._canceled=!1,this._capability=Promise.withResolvers(),this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:i.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:o()};const{pageWidth:l,pageHeight:h,pageX:d,pageY:c}=i.rawDims;this._transform=[1,0,0,-1,-d,c+h],this._pageWidth=l,this._pageHeight=h,(0,a.setLayerDimensions)(e,i),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new s.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new s.AbortException("TextLayer task cancelled."))}_processItems(t,e){for(let i of t){if(void 0===i.str){if("beginMarkedContentProps"===i.t
2ype||"beginMarkedContent"===i.type){let t=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==i.id&&this._container.setAttribute("id",`${i.id}`),t.append(this._container)}else"endMarkedContent"===i.type&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(i.str),function(t,e,i){let a,n,l=document.createElement("span"),h={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};t._textDivs.push(l);let d=s.Util.transform(t._transform,e.transform),c=Math.atan2(d[1],d[0]),u=i[e.fontName];u.vertical&&(c+=Math.PI/2);let p=t._fontInspectorEnabled&&u.fontSubstitution||u.fontFamily,g=Math.hypot(d[2],d[3]),m=g*function(t){let e=r.get(t);if(e)return e;let i=o(),s=i.font;i.canvas.width=i.canvas.height=30,i.font=`30px ${t}`;let a=i.measureText(""),n=a.fontBoundingBoxAscent,l=Math.abs(a.fontBoundingBoxDescent);if(n){let e=n/(n+l);return r.set(t,e),i.canvas.width=i.canvas.height=0,i.font=s,e}i.strokeStyle="red",i.clearRect(0,0,30,30),i.strokeText("g",0,0);let h=i.getImageData(0,0,30,30).data;l=0;for(let t=h.length-1-3;t>=0;t-=4)if(h[t]>0){l=Math.ceil(t/4/30);break}i.clearRect(0,0,30,30),i.strokeText("A",0,30),h=i.getImageData(0,0,30,30).data,n=0;for(let t=0,e=h.length;t<e;t+=4)if(h[t]>0){n=30-Math.floor(t/4/30);break}if(i.canvas.width=i.canvas.height=0,i.font=s,n){let e=n/(n+l);return r.set(t,e),e}return r.set(t,.8),.8}(p);0===c?(a=d[4],n=d[5]-m):(a=d[4]+m*Math.sin(c),n=d[5]-m*Math.cos(c));let f="calc(var(--scale-factor)*",b=l.style;t._container===t._rootContainer?(b.left=`${(100*a/t._pageWidth).toFixed(2)}%`,b.top=`${(100*n/t._pageHeight).toFixed(2)}%`):(b.left=`${f}${a.toFixed(2)}px)`,b.top=`${f}${n.toFixed(2)}px)`),b.fontSize=`${f}${g.toFixed(2)}px)`,b.fontFamily=p,h.fontSize=g,l.setAttribute("role","presentation"),l.textContent=e.str,l.dir=e.dir,t._fontInspectorEnabled&&(l.dataset.fontName=u.fontSubstitutionLoadedName||e.fontName),0!==c&&(h.angle=180/Math.PI*c);let v=!1;if(e.str.length>1)v=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){let t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(v=!0)}v&&(h.canvasWidth=u.vertical?e.height:e.width),t._textDivProperties.set(l,h),t._isReadableStream&&t._layoutText(l)}(this,i,e)}}_layoutText(t){let e=this._layoutTextParams.properties=this._textDivProperties.get(t);if(this._layoutTextParams.div=t,h(this._layoutTextParams),e.hasText&&this._container.append(t),e.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),this._container.append(t)}}_render(){let{promise:t,resolve:e,reject:i}=Promise.withResolvers(),s=Object.create(null);if(this._isReadableStream){let t=()=>{this._reader.read().then(({value:i,done:a})=>{a?e():(Object.assign(s,i.styles),this._processItems(i.items,s),t())},i)};this._reader=this._textContentSource.getReader(),t()}else if(this._textContentSource){let{items:t,styles:i}=this._textContentSource;this._processItems(t,i),e()}else throw Error('No "textContentSource" parameter specified.');t.then(()=>{s=null,function(t){if(t._canceled)return;let e=t._textDivs,i=t._capability;if(e.length>1e5)return i.resolve();if(!t._isReadableStream)for(let i of e)t._layoutText(i);i.resolve()}(this)},this._capability.reject)}}function c(t){let e=new d(t);return e._render(),e}function u({container:t,viewport:e,textDivs:i,textDivProperties:s,mustRotate:r=!0,mustRescale:n=!0}){if(r&&(0,a.setLayerDimensions)(t,{rotation:e.rotation}),n){let t=o(),a=e.scale*(globalThis.devicePixelRatio||1),r={prevFontSize:null,prevFontFamily:null,div:null,scale:a,properties:null,ctx:t};for(let t of i)r.properties=s.get(t),r.div=t,h(r)}}},585:(t,e,i)=>{i.d(e,{PDFDataTransportStream:()=>r});var s=i(292),a=i(419);class r{constructor(t,{disableRange:e=!1,disableStream:i=!1}){(0,s.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:r,progressiveDone:n,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=o,r?.length>0){const t=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){let i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(void 0===t)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{let e=this._rangeReaders.some(function(e){return e._begin===t&&(e._enqueue(i),!0)});(0,s.assert)(e,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){void 0===t.total?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){(0,s.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new n(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new o(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){for(let e of(this._fullRequestReader?.cancel(t),this._rangeReaders.slice(0)))e.cancel(t);this._pdfDataRangeTransport.abort()}}class n{constructor(t,e,i=!1,s=null){for(const r of(this._stream=t,this._done=i||!1,this._filename=(0,a.isPdfFile)(s)?s:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=r.byteLength;
2this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.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};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class o{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{for(let e of(this._requests.shift().resolve({value:t,done:!1}),this._requests))e.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){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},164:(t,e,i)=>{i.d(e,{GlobalWorkerOptions:()=>s});class s{static #rc=null;static #ru="";static get workerPort(){return this.#rc}static set workerPort(t){if(!("u">typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");this.#rc=t}static get workerSrc(){return this.#ru}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");this.#ru=t}}},284:(t,e,i)=>{i.d(e,{XfaLayer:()=>a});var s=i(50);class a{static setupStorage(t,e,i,s,a){let r=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(t.textContent=r.value),"print"===a)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?t.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===a)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==r.value&&t.setAttribute("value",r.value),"print"===a)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==r.value)for(let e of(t.setAttribute("value",r.value),i.children))e.attributes.value===r.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,a=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:a})})}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:a}){let{attributes:r}=e,n=t instanceof HTMLAnchorElement;for(let[e,i]of("radio"===r.type&&(r.name=`${r.name}-${s}`),Object.entries(r)))if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:n&&("href"===e||"newWindow"===e)||t.setAttribute(e,i)}n&&a.addLinkAttributes(t,r.href,r.newWindow),i&&r.dataId&&this.setupStorage(t,r.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,a=t.xfaHtml,r=t.intent||"display",n=document.createElement(a.name);a.attributes&&this.setAttributes({html:n,element:a,intent:r,linkService:i});let o="richText"!==r,l=t.div;if(l.append(n),t.viewport){let e=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=e}o&&l.setAttribute("class","xfaLayer xfaFont");let h=[];if(0===a.children.length){if(a.value){let t=document.createTextNode(a.value);n.append(t),o&&s.XfaText.shouldBuildText(a.name)&&h.push(t)}return{textDivs:h}}let d=[[a,-1,n]];for(;d.length>0;){let[t,a,n]=d.at(-1);if(a+1===t.children.length){d.pop();continue}let l=t.children[++d.at(-1)[1]];if(null===l)continue;let{name:c}=l;if("#text"===c){let t=document.createTextNode(l.value);h.push(t),n.append(t);continue}let u=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,c):document.createElement(c);if(n.append(u),l.attributes&&this.setAttributes({html:u,element:l,storage:e,intent:r,linkService:i}),l.children?.length>0)d.push([l,-1,u]);else if(l.value){let t=document.createTextNode(l.value);o&&s.XfaText.shouldBuildText(c)&&h.push(t),u.append(t)}}for(let t of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}},50:(t,e,i)=>{i.d(e,{XfaText:()=>s});class s{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){if(!i)return;let a=null,r=i.name;if("#text"===r)a=i.value;else{if(!s.shouldBuildText(r))return;i?.attributes?.textContent?a=i.attributes.textContent:i.value&&(
2a=i.value)}if(null!==a&&e.push({str:a}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return"textarea"!==t&&"input"!==t&&"option"!==t&&"select"!==t}}},228:(t,e,i)=>{i.a(t,async(t,s)=>{try{i.d(e,{AbortException:()=>a.AbortException,AnnotationEditorLayer:()=>l.AnnotationEditorLayer,AnnotationEditorParamsType:()=>a.AnnotationEditorParamsType,AnnotationEditorType:()=>a.AnnotationEditorType,AnnotationEditorUIManager:()=>h.AnnotationEditorUIManager,AnnotationLayer:()=>d.AnnotationLayer,AnnotationMode:()=>a.AnnotationMode,CMapCompressionType:()=>a.CMapCompressionType,ColorPicker:()=>c.ColorPicker,DOMSVGFactory:()=>n.DOMSVGFactory,DrawLayer:()=>u.DrawLayer,FeatureTest:()=>a.FeatureTest,GlobalWorkerOptions:()=>p.GlobalWorkerOptions,ImageKind:()=>a.ImageKind,InvalidPDFException:()=>a.InvalidPDFException,MissingPDFException:()=>a.MissingPDFException,OPS:()=>a.OPS,Outliner:()=>g.Outliner,PDFDataRangeTransport:()=>r.PDFDataRangeTransport,PDFDateString:()=>n.PDFDateString,PDFWorker:()=>r.PDFWorker,PasswordResponses:()=>a.PasswordResponses,PermissionFlag:()=>a.PermissionFlag,PixelsPerInch:()=>n.PixelsPerInch,RenderingCancelledException:()=>n.RenderingCancelledException,UnexpectedResponseException:()=>a.UnexpectedResponseException,Util:()=>a.Util,VerbosityLevel:()=>a.VerbosityLevel,XfaLayer:()=>m.XfaLayer,build:()=>r.build,createValidAbsoluteUrl:()=>a.createValidAbsoluteUrl,fetchData:()=>n.fetchData,getDocument:()=>r.getDocument,getFilenameFromUrl:()=>n.getFilenameFromUrl,getPdfFilenameFromUrl:()=>n.getPdfFilenameFromUrl,getXfaPageViewport:()=>n.getXfaPageViewport,isDataScheme:()=>n.isDataScheme,isPdfFile:()=>n.isPdfFile,noContextMenu:()=>n.noContextMenu,normalizeUnicode:()=>a.normalizeUnicode,renderTextLayer:()=>o.renderTextLayer,setLayerDimensions:()=>n.setLayerDimensions,shadow:()=>a.shadow,updateTextLayer:()=>o.updateTextLayer,version:()=>r.version});var a=i(292),r=i(831),n=i(419),o=i(814),l=i(731),h=i(830),d=i(976),c=i(259),u=i(47),p=i(164),g=i(61),m=i(284),f=t([r]);r=(f.then?(await f)():f)[0],s()}catch(t){s(t)}})},178:(t,e,i)=>{i.d(e,{MessageHandler:()=>r});var s=i(292);function a(t){switch(!(t instanceof Error||"object"==typeof t&&null!==t)&&(0,s.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new s.AbortException(t.message);case"MissingPDFException":return new s.MissingPDFException(t.message);case"PasswordException":return new s.PasswordException(t.message,t.code);case"UnexpectedResponseException":return new s.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new s.UnknownErrorException(t.message,t.details);default:return new s.UnknownErrorException(t.message,t.toString())}}
2class r{constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=t=>{let e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#rp(e);if(e.callback){let t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)i.resolve(e.data);else if(2===e.callback)i.reject(a(e.reason));else throw Error("Unexpected callback case");return}let s=this.actionHandler[e.action];if(!s)throw Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){let t=this.sourceName,r=e.sourceName;new Promise(function(t){t(s(e.data))}).then(function(s){i.postMessage({sourceName:t,targetName:r,callback:1,callbackId:e.callbackId,data:s})},function(s){i.postMessage({sourceName:t,targetName:r,callback:2,callbackId:e.callbackId,reason:a(s)})});return}e.streamId?this.#rg(e):s(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){let i=this.actionHandler;if(i[t])throw Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(t){a.reject(t)}return a.promise}sendWithStream(t,e,i,r){let n=this.streamId++,o=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:i=>{let s=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:s,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:o,targetName:l,action:t,streamId:n,data:e,desiredSize:i.desiredSize},r),s.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,h.postMessage({sourceName:o,targetName:l,stream:6,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{(0,s.assert)(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,h.postMessage({sourceName:o,targetName:l,stream:1,streamId:n,reason:a(t)}),e.promise}},i)}#rg(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,o=this,l=this.actionHandler[t.action],h={enqueue(t,s=1,a){if(this.isCancelled)return;let o=this.desiredSize;this.desiredSize-=s,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:r,stream:4,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:3,streamId:e}),delete o.streamSinks[e])},error(t){(0,s.assert)(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:5,streamId:e,reason:a(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};h.sinkCapability.resolve(),h.ready=h.sinkCapability.promise,this.streamSinks[e]=h,new Promise(function(e){e(l(t.data,h))}).then(function(){n.postMessage({sourceName:i,targetName:r,stream:8,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:8,streamId:e,reason:a(t)})})}#rp(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,o=this.streamControllers[e],l=this.streamSinks[e];switch(t.stream){case 8:t.success?o.startCall.resolve():o.startCall.reject(a(t.reason));break;case 7:t.success?o.pullCall.resolve():o.pullCall.reject(a(t.reason));break;case 6:if(!l){n.postMessage({sourceName:i,targetName:r,stream:7,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,new Promise(function(t){t(l.onPull?.())}).then(function(){n.postMessage({sourceName:i,targetName:r,stream
2:7,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:7,streamId:e,reason:a(t)})});break;case 4:if((0,s.assert)(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case 3:if((0,s.assert)(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),this.#rm(o,e);break;case 5:(0,s.assert)(o,"error should have stream controller"),o.controller.error(a(t.reason)),this.#rm(o,e);break;case 2:t.success?o.cancelCall.resolve():o.cancelCall.reject(a(t.reason)),this.#rm(o,e);break;case 1:if(!l)break;new Promise(function(e){e(l.onCancel?.(a(t.reason)))}).then(function(){n.postMessage({sourceName:i,targetName:r,stream:2,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:2,streamId:e,reason:a(t)})}),l.sinkCapability.reject(a(t.reason)),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async #rm(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},651:(t,e,i)=>{i.d(e,{MurmurHash3_64:()=>s});class s{constructor(t){this.h1=t?0|t:0xc3d2e1f0,this.h2=t?0|t:0xc3d2e1f0}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,a=t.length;s<a;s++){let a=t.charCodeAt(s);a<=255?e[i++]=a:(e[i++]=a>>>8,e[i++]=255&a)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,a=i-4*s,r=new Uint32Array(e.buffer,0,s),n=0,o=0,l=this.h1,h=this.h2;for(let t=0;t<s;t++)1&t?(n=0x1b873593*(n=(n=0xcc9e2d51*(n=r[t])&0xffff0000|11601*n&65535)<<15|n>>>17)&0xffff0000|13715*n&65535,l^=n,l=l<<13|l>>>19,l=5*l+0xe6546b64):(o=0x1b873593*(o=(o=0xcc9e2d51*(o=r[t])&0xffff0000|11601*o&65535)<<15|o>>>17)&0xffff0000|13715*o&65535,h^=o,h=h<<13|h>>>19,h=5*h+0xe6546b64);switch(n=0,a){case 3:n^=e[4*s+2]<<16;case 2:n^=e[4*s+1]<<8;case 1:n^=e[4*s],n=0x1b873593*(n=(n=0xcc9e2d51*n&0xffff0000|11601*n&65535)<<15|n>>>17)&0xffff0000|13715*n&65535,1&s?l^=n:h^=n}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=0xed558ccd*t&0xffff0000|36045*t&65535,e=0xff51afd7*e&0xffff0000|((e<<16|t>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,t=0x1a85ec53*t&0xffff0000|60499*t&65535,e=0xc4ceb9fe*e&0xffff0000|((e<<16|t>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}},292:(t,e,i)=>{i.d(e,{AbortException:()=>H,AnnotationBorderStyleType:()=>v,AnnotationEditorParamsType:()=>p,AnnotationEditorPrefix:()=>c,AnnotationEditorType:()=>u,AnnotationMode:()=>d,AnnotationPrefix:()=>J,AnnotationType:()=>b,BaseException:()=>I,CMapCompressionType:()=>y,FONT_IDENTITY_MATRIX:()=>r,FeatureTest:()=>G,FontRenderOps:()=>Q,FormatError:()=>B,IDENTITY_MATRIX:()=>a,ImageKind:()=>f,InvalidPDFException:()=>F,LINE_FACTOR:()=>o,MAX_IMAGE_SIZE_TO_CACHE:()=>n,MissingPDFException:()=>O,OPS:()=>_,PasswordException:()=>D,PasswordResponses:()=>E,PermissionFlag:()=>g,RenderingIntentFlag:()=>l,TextRenderingMode:()=>m,UnexpectedResponseException:()=>N,UnknownErrorException:()=>L,Util:()=>q,VerbosityLevel:()=>A,assert:()=>P,bytesToString:()=>U,createValidAbsoluteUrl:()=>R,getUuid:()=>Y,getVerbosityLevel:()=>T,info:()=>S,isNodeJS:()=>s,normalizeUnicode:()=>X,objectFromMap:()=>j,setVerbosityLevel:()=>x,shadow:()=>k,string32:()=>$,stringToBytes:()=>z,unreachable:()=>M,warn:()=>C});let s="object"==typeof h&&h+""=="[object process]"&&!h.versions.nw&&!(
2h.versions.electron&&h.type&&"browser"!==h.type),a=[1,0,0,1,0,0],r=[.001,0,0,.001,0,0],n=1e7,o=1.35,l={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},d={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},c="pdfjs_internal_editor_",u={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},p={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},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},m={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},f={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},b={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},v={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},A={ERRORS:0,WARNINGS:1,INFOS:5},y={NONE:0,BINARY:1},_={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},E={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},w=A.WARNINGS;function x(t){Number.isInteger(t)&&(w=t)}function T(){return w}function S(t){w>=A.INFOS&&console.log(`Info: ${t}`)}function C(t){w>=A.WARNINGS&&console.log(`Warning: ${t}`)}function M(t){throw Error(t)}function P(t,e){t||M(e)}function R(t,e=null,i=null){if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{var s;s=t,t=decodeURIComponent(escape(s))}catch{}}let a=e?new URL(t,e):new URL(t);if(function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch{}return null}function k(t,e,i,s=!1){return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}let I=function(){function t(e,i){this.constructor===t&&M("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=Error(),t.constructor=t,t}();class D extends I{constructor(t,e){super(t,"PasswordException"),this.code=e}}class L extends I{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class F extends I{constructor(t){super(t,"InvalidPDFException")}}class O extends I{constructor(t){super(t,"MissingPDFException")}}class N extends I{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class B extends I{constructor(t){super(t,"FormatError")}}class H extends I{constructor(t){super(t,"AbortException")}}function U(t){("object"!=typeof t||t?.length===void 0)&&M("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let s=0;s<e;s+=8192){let a=Math.min(s+8192,e),r=t.subarray(s,a);i.push(String.fromCharCode.apply(null,r))}return i.join("")}function z(t){"string"!=typeof t&&M("Invalid argument for stringToBytes");let e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function $(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}function j(t){let e=Object.create(null);for(let[i,s]of t)e[i]=s;return e}class G{static get isLittleEndian(){let t,e;return k(this,"isLittleEndian",((t=new Uint8Array(4))[0]=1,e=new Uint32Array(t.buffer,0,1),1===e[0]))}static get isEvalSupported(){return k(this,"isEvalSupported",function(){try{return Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return k(this,"isOffscreenCanvasSupported","u">typeof OffscreenCanvas)}static get platform(){return"u">typeof navigator&&"string"==typeof navigator?.platform?k(this,"platform",{isMac:navigator.platform.includes("Mac")}):k(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return k(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}let V=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class q{static makeHexColor(t,e,i){return`#${V[t]}${V[e]}${V[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){let i=t[0]*e[0]+t[1]*e[2]+e[4],s=t[0]*e[1]+t[1]*e[3]+e[5];return[i,s]}static applyInverseTransform(t,e){let i=e[0]*e[3]-e[1]*e[2],s=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,a=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i;return[s,a]}static getAxialAlignedBoundingBox(t,e){let i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),a=this.applyTransform([t[0],t[3]],e),r=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],a[0],r[0]),Math.min(i[1],s[1],a[1],r[1]),Math.max(i[0],s[0],a[0],r[0]),Math.max(i[1],s[1],a[1],r[1])]}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){let e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],a=t[2]*e[0]+t[3]*e[2],r=t[2]*e[1]+t[3]*e[3],n=(i+r)/2,o=Math.sqrt((i+r)**2-4*(i*r-a*s))/2;return[Math.sqrt(n+o||1),Math.sqrt(n-o||1)]}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;let a=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return a>r?null:[i,a,s,r]}static #rf(t,e,i,s,a,r,n,o,l,h){if(l<=0||l>=1)return;let d=1-l,c=l*l,u=c*l,p=d*(d*(d*t+3*l*e)+3*c*i)+u*s,g=d*(d*(d*a+3*l*r)+3*c*n)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],g)}static #rb(t,e,i,s,a,r,n,o,l,h,d,c){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#rf(t,e,i,s,a,r,n,o,-d/h,c);return}let u=h**2-4*d*l;if(u<0)return;let p=Math.sqrt(u),g=2*l;this.#rf(t,e,i,s,a,r,n,o,(-h+p)/g,c),this.#rf(t,e,i,s,a,r,n,o,(-h-p)/g,c)}static bezierBoundingBox(t,e,i,s,a,r,n,o,l){return l?(l[0]=Math.min(l[0],t,n),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,n),l[3]=Math.max(l[3],e,o)):l=[Math.min(t,n),Math.min(e,o),Math.max(t,n),Math.max(e,o)],this.#rb(t,i,a,n,e,s,r,o,3*(-t+3*(i-a)+n),6*(t-2*i+a),3*(i-t),l),this.#rb(t,i,a,n,e,s,r,o,3*(-e+3*(s-r)+o),6*(e-2*s+r),3*(s-e),l),l}}let W=null,K=null;function X(t){return W||(W=/([\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,K=new Map([["ſt","ſt"]])),t.replaceAll(W,(t,e,i)=>e?e.normalize("NFKC"):K.get(i))}function Y(){if("u">typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);if("u">typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(255*Math.random());return U(t)}let J="pdfjs_internal_id_",Q={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8}}},c={};function u(t){var e=c[t];if(void 0!==e)return e.exports;var i=c[t]={exports:{}};return d[t](i,i.exports,u),i.exports}a="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",r="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",n="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",o=t=>{t&&t.d<1&&(t.d=1,t.forEach(t=>t.r--),t.forEach(t=>t.r--?t.r++:t()))},u.a=(t,e,i)=>{i&&((s=[]).d=-1);var s,l,h,d,c=new Set,u=t.exports,p=new Promise((t,e)=>{d=e,h=t});p[r]=u,p[a]=t=>
2(s&&t(s),c.forEach(t),p.catch(t=>{})),t.exports=p,e(t=>{l=t.map(t=>{if(null!==t&&"object"==typeof t){if(t[a])return t;if(t.then){var e=[];e.d=0,t.then(t=>{i[r]=t,o(e)},t=>{i[n]=t,o(e)});var i={};return i[a]=t=>t(e),i}}var s={};return s[a]=t=>{},s[r]=t,s});var e,i=()=>l.map(t=>{if(t[n])throw t[n];return t[r]}),h=new Promise(t=>{(e=()=>t(i)).r=0;var r=t=>t!==s&&!c.has(t)&&(c.add(t),t&&!t.d&&(e.r++,t.push(e)));l.map(t=>t[a](r))});return e.r?h:i()},t=>(t?d(p[n]=t):h(u),o(s))),s&&s.d<0&&(s.d=0)},u.d=(t,e)=>{for(var i in e)u.o(e,i)&&!u.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},u.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var p=u(228);(p=globalThis.pdfjsLib=await (globalThis.pdfjsLibPromise=p)).AbortException,p.AnnotationEditorLayer,p.AnnotationEditorParamsType,p.AnnotationEditorType,p.AnnotationEditorUIManager,p.AnnotationLayer,p.AnnotationMode,p.CMapCompressionType,p.ColorPicker,p.DOMSVGFactory,p.DrawLayer,p.FeatureTest;var g=p.GlobalWorkerOptions;p.ImageKind,p.InvalidPDFException,p.MissingPDFException,p.OPS,p.Outliner,p.PDFDataRangeTransport,p.PDFDateString,p.PDFWorker,p.PasswordResponses,p.PermissionFlag,p.PixelsPerInch,p.RenderingCancelledException,p.UnexpectedResponseException,p.Util,p.VerbosityLevel,p.XfaLayer,p.build,p.createValidAbsoluteUrl,p.fetchData;var m=p.getDocument;p.getFilenameFromUrl,p.getPdfFilenameFromUrl,p.getXfaPageViewport,p.isDataScheme,p.isPdfFile,p.noContextMenu,p.normalizeUnicode,p.renderTextLayer,p.setLayerDimensions,p.shadow,p.updateTextLayer;var f=p.version;s()}catch(t){s(t)}},1)}}]);

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.