PageSourceSearch

https://thunderbit.com/_next/static/chunks/1b6ee9ba.8b1e021ea6e7416e.js

js thunderbit.com collected 2026-09-24 09:02:04 UTC 318,760 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1718],{46690:function(t,e,i){i.a(t,async function(t,s){try{i.r(e),i.d(e,{AbortException:function(){return m},AnnotationEditorLayer:function(){return f},AnnotationEditorParamsType:function(){return b},AnnotationEditorType:function(){return A},AnnotationEditorUIManager:function(){return v},AnnotationLayer:function(){return y},AnnotationMode:function(){return _},CMapCompressionType:function(){return E},ColorPicker:function(){return w},DOMSVGFactory:function(){return x},DrawLayer:function(){return T},FeatureTest:function(){return S},GlobalWorkerOptions:function(){return C},ImageKind:function(){return M},InvalidPDFException:function(){return P},MissingPDFException:function(){return R},OPS:function(){return L},Outliner:function(){return k},PDFDataRangeTransport:function(){return I},PDFDateString:function(){return D},PDFWorker:function(){return F},PasswordResponses:function(){return O},PermissionFlag:function(){return N},PixelsPerInch:function(){return B},RenderingCancelledException:function(){return H},UnexpectedResponseException:function(){return U},Util:function(){return z},VerbosityLevel:function(){return $},XfaLayer:function(){return j},build:function(){return G},createValidAbsoluteUrl:function(){return V},fetchData:function(){return q},getDocument:function(){return W},getFilenameFromUrl:function(){return K},getPdfFilenameFromUrl:function(){return X},getXfaPageViewport:function(){return Y},isDataScheme:function(){return J},isPdfFile:function(){return Q},noContextMenu:function(){return Z},normalizeUnicode:function(){return tt},renderTextLayer:function(){return te},setLayerDimensions:function(){return ti},shadow:function(){return ts},updateTextLayer:function(){return tr},version:function(){return ta}});var r,a,n,o,l,h=i(35684).Buffer,d=i(24549),c={976:(t,e,i)=>{i.d(e,{AnnotationLayer:()=>H,FreeTextAnnotationElement:()=>T,InkAnnotationElement:()=>k,StampAnnotationElement:()=>N});var s=i(292),r=i(419),a=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,r=1-e,a=1-i;return["CMYK",s,r,a,Math.min(s,r,a)]}}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 v(t);return new _(t);case"Ch":return new E(t);case"Sig":return new A(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 L(t);case s.AnnotationType.INK:return new k(t);case s.AnnotationType.POLYGON:return new R(t);case s.AnnotationType.HIGHLIGHT:return new I(t);case s.AnnotationType.UNDERLINE:return new D(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:r,pageHeight:a,pageX:n,pageY:o}}}}=this;i?.splice(0,4,...t);let{width:l,height:h}=c(t);e.left=`${100*(t[0]-n)/r}%`,e.top=`${100*(a-t[3]+o)/a}%`,0===s?(e.width=`${100*l/r}%`,e.height=`${100*h/a}%`):this.setRotation(s)}_createContainer(t){let{data:e,parent:{page:i,viewport:r}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",e.id),this instanceof f||(a.tabIndex=1e3);let{style:n}=a;if(n.zIndex=this.parent.zIndex++,e.popupRef&&a.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate"),!e.rect||this instanceof w){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,a),a}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;if(t>0||i>0){let e=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;n.borderRadius=e}else if(this instanceof y){let t=`calc(${o}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;n.borderRadius=t}switch(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 r=e.borderColor||null;r?(this.#e=!0,n.borderColor=s.Util.makeHexColor(0|r[0],0|r[1],0|r[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}=r.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,a),a}setRotation(t,e=this.container){let i,s;if(!this.data.rect)return;let{pageWidth:r,pageHeight:a}=this.parent.viewport.rawDims,{width:n,height:o}=c(this.data.rect);t%180==0?(i=100*n/r,s=100*o/a):(i=100*o/r,s=100*n/a),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],r=s[0],a=s.slice(1);i.target.style[e]=l[`${r}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[e]:l[`${r}_rgb`](a)})};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 r=t[s]||i[s];r?.(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,r]of Object.entries(e)){let a=i[s];if(a){let i={detail:{[s]:r},target:t};a(i),delete e[s]}}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,s,r,a]=this.data.rect;if(1===e.length){let[,{x:t,y:n},{x:o,y:l}]=e[0];if(r===t&&a===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=r-i,l=a-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:r},{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=(a-r)/l,g=(s-n)/o,m=(r-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 r=this._fieldObjects[t];if(r)for(let{page:t,id:a,exportValues:n}of r){if(-1===t||a===e)continue;let r="string"==typeof n?n:null,o=document.querySelector(`[data-element-id="${a}"]`);if(o&&!d.has(o)){(0,s.warn)(`_getElementsByName - element not allowed: ${a}`);continue}i.push({id:a,exportValue:r,domElement:o})}return i}for(let s of document.getElementsByName(t)){let{exportValue:t}=s,r=s.getAttribute("data-element-id");r!==e&&d.has(s)&&i.push({id:r,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.#r(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}#a(){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.#a()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#a()}#s(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#a()}#r(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#a()}_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 r=i.get(s);r&&(t[r]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}t.onclick||(t.onclick=()=>!1),this.#a()}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#a(),!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:r,include:a}=e,n=[];if(0!==t.length||0!==r.length){let e=new Set(r);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)===a&&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,r){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(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}r&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:r(t)}})})}_setEventListeners(t,e,i,s){for(let[r,a]of i)("Action"===a||this.data.actions?.[a])&&(("Focus"===a||"Blur"===a)&&(e||={focused:!1}),this._setEventListener(t,e,r,a,s),"Focus"!==a||this.data.actions?.Blur?"Blur"!==a||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;let{fontColor:i}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||9,a=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*r))||1;e=Math.min(r,n(t/i/s.LINE_FACTOR))}else{let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2);e=Math.min(r,n(t/s.LINE_FACTOR))}a.fontSize=`calc(${e}
1px * var(--scale-factor))`,a.color=s.Util.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(a.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){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,s){let r=this.annotationStorage;for(let a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),r.setValue(a.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}),r=s.value||"",a=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;a&&r.length>a&&(r=r.slice(0,a));let n=s.formattedValue||this.data.textContent?.join("\n")||null;n&&this.data.comb&&(n=n.replaceAll(/\s+/g,""));let o={userValue:r,formattedValue:n,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=n??r,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type="text",i.setAttribute("value",n??r),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),a&&(i.maxLength=a),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:r}=i;if(0===s){r.removeAttribute("maxLength");return}r.setAttribute("maxLength",s);let a=o.userValue;a&&!(a.length<=s)&&(a=a.slice(0,s),r.value=o.userValue=a,t.setValue(e,{value:a}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:r.selectionStart,selEnd:r.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:r,selectionStart:a,selectionEnd:n}=s,l=a,h=n;switch(t.inputType){case"deleteWordBackward":{let t=r.substring(0,a).match(/\w*[^\
1w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{let t=r.substring(a).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":a===n&&(l-=1);break;case"deleteContentForward":a===n&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,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])/a;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 A extends f{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class v 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 r=document.createElement("input");return d.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=1e3,r.addEventListener("change",s=>{let{name:r,checked:a}=s.target;for(let s of this._getElementsByName(r,i)){let i=a&&s.exportValue===e.exportValue;s.domElement&&(s.domElement.checked=i),t.setValue(s.id,{value:i})}t.setValue(i,{value:a})}),r.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(r,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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),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 r=document.createElement("input");if(d.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,s&&r.setAttribute("checked",!0),r.tabIndex=1e3,r.addEventListener("change",e=>{let{name:s,checked:r}=e.target;for(let e of this._getElementsByName(s,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:r})}),r.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let s=e.buttonValue;r.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let r=s===e.detail.value;for(let s of this._getElementsByName(e.target.name)){let e=r&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}},e)}),this._setEventListeners(r,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)}
1return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class _ 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 r=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),r=!1),s.append(e)}let a=null;if(r){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),a=()=>{t.remove(),s.removeEventListener("input",a),a=null},s.addEventListener("input",a)}let n=t=>{let e=t?"value":"textContent",{options:i,multiple:r}=s;return r?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){a?.();let r=i.detail.value,l=new Set(Array.isArray(r)?r:[r]);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 r=s.options,a=i.detail.remove;if(r[a].selected=!1,s.remove(a),r.length>0){let t=Array.prototype.findIndex.call(r,t=>t.selected);-1===t&&(r[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:r,displayValue:a,exportValue:h}=i.detail.insert,d=s.children[r],c=document.createElement("option");c.textContent=a,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:r}=i.detail;for(;0!==s.length;)s.remove(0);for(let t of r){let{displayValue:e,exportValue:i}=t,r=document.createElement("option");r.textContent=e,r.value=i,s.append(r)}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),r=n(!1);t.setValue(e,{value:s}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,change:r,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){let{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;#A=null;#v=null;#y=null;#_=!1;#E=null;#w=null;#x=null;#T=null;#S=!1;constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:a,contentsObj:n,richText:o,parent:l,rect:h,parentRect:d,open:c}){for(let c of(this.#m=t,this.#T=s,this.#f=n,this.#x=o,this.#v=l,this.#g=e,this.#w=h,this.#y=d,this.#A=i,this.#b=r.PDFDateString.toDateObject(a),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(let 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:r,pageY:a}}}=this.#v,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.#A)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:A}=this.#m;A.left=`${100*(f-r)/e}%`,A.top=`${100*(b-a)/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 r=s[t];i.append(document.createTextNode(r)),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),r=this.#C=this.svgFactory.createElement("svg:line");return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),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),r=t.borderStyle.width,a=this.#M=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",r/2),a.setAttribute("y",r/2),a.setAttribute("width",e-r),a.setAttribute("height",i-r),a.setAttribute("stroke-width",r||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.#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),r=t.borderStyle.width,a=this.#P=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",e/2),a.setAttribute("cy",i/2),a.setAttribute("rx",e/2-r/2),a.setAttribute("ry",i/2-r/2),a.setAttribute("stroke-width",r||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.#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),r=[];for(let e of t.vertices){let i=e.x-t.rect[0],s=t.rect[3]-e.y;r.push(i+","+s)}r=r.join(" ");let a=this.#R=this.svgFactory.createElement(this.svgElementName);return a.setAttribute("points",r),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.#R}addHighlightArea(){this.container.classList.add("highlightArea")}}class R extends P{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class L 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}}
1class k extends p{#L=[];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],r=t.rect[3]-s.y;i.push(`${e},${r}`)}i=i.join(" ");let r=this.svgFactory.createElement(this.svgElementName);this.#L.push(r),r.setAttribute("points",i),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),!t.popupRef&&this.hasPopupData&&this._createPopup(),s.append(r)}return this.container.append(s),this.container}getElementsToTriggerPopup(){return this.#L}addHighlightArea(){this.container.classList.add("highlightArea")}}class I 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 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("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("strikeoutAnnotation"),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{#k=null;constructor(t){super(t,{isRenderable:!0});let{filename:e,content:i}=this.data.file;this.filename=(0,r.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.#I.bind(this)),this.#k=t;let{isMac:r}=s.FeatureTest.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(r?t.metaKey:t.ctrlKey)&&this.#I()}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return this.#k}addHighlightArea(){this.container.classList.add("highlightArea")}#I(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class H{#D=null;#F=null;#O=new Map;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:r,viewport:
1a}){this.div=t,this.#D=e,this.#F=i,this.page=r,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=s}#N(t,e){let i=t.firstChild||t;i.id=`${s.AnnotationPrefix}${e}`,this.div.append(t),this.#D?.moveElementInDOM(this.div,t,i,!1)}async render(t){let{annotations:e}=t,i=this.div;(0,r.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 r.DOMSVGFactory,annotationStorage:t.annotationStorage||new a.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 r=i.render();t.hidden&&(r.style.visibility="hidden"),this.#N(r,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,r.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:r}=s;r?"CANVAS"===r.nodeName?r.replaceWith(i):r.classList.contains("annotationContent")?r.after(i):r.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),r=i(310),a=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 r.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=this.#U.get(t),s=!1;if(void 0!==i)for(let[t,r]of Object.entries(e))i[t]!==r&&(s=!0,i[t]=r);else s=!0,this.#U.set(t,e);s&&this.#z(),e instanceof r.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 a.MurmurHash3_64,i=[],s=Object.create(null),o=!1;for(let[i,a]of this.#U){let n=a instanceof r.AnnotationEditor?a.serialize(!1,s):a;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 r.AnnotationEditor))continue;let s=i.telemetryFinalData;if(!s)continue;let{type:a}=s;e.has(a)||e.set(a,Object.getPrototypeOf(i).constructor),t||=Object.create(null);let n=t[a]||=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();let{map:e,hash:i,transfer:s}=t.serializable,r=structuredClone(e,s?{transfer:s}:null);this.#$={map:r,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 r=i(292),a=i(792),n=i(419),o=i(10),l=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),A=i(457),v=i(786),y=i(50),_=t([l,v]);[l,v]=_.then?(await _)():_;let T=r.isNodeJS?l.NodeCanvasFactory:n.DOMCanvasFactory,S=r.isNodeJS?l.NodeCMapReaderFactory:n.DOMCMapReaderFactory,C=r.isNodeJS?l.NodeFilterFactory:n.DOMFilterFactory,M=r.isNodeJS?l.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(r.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,a=t.data?function(t){if(r.isNodeJS&&void 0!==h&&t instanceof h)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,r.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,l=!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,L=t.CMapReaderFactory||S,k="string"==typeof t.standardFontDataUrl?t.standardFontDataUrl:null,I=t.StandardFontDataFactory||M,D=!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:!r.isNodeJS,U=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,z="boolean"==typeof t.disableFontFace?t.disableFontFace:r.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:!r.isNodeJS&&!z,J="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:L===n.DOMCMapReaderFactory&&I===n.DOMStandardFontDataFactory&&E&&k&&(0,n.isValidFetchUrl)(E,document.baseURI)&&(0,n.isValidFetchUrl)(k,document.baseURI),Q=t.canvasFactory||new T({ownerDocument:G}),Z=t.filterFactory||new C({docId:i,ownerDocument:G});(0,r.setVerbosityLevel)(y);let tt={canvasFactory:Q,filterFactory:Z};if(J||(tt.cMapReaderFactory=new L({baseUrl:E,isCompressed:x}),tt.standardFontDataFactory=new I({baseUrl:k})),!m){let t={verbosity:y,port:u.GlobalWorkerOptions.workerPort};m=t.port?F.fromPort(t):new F(t),e._worker=m}let te={docId:i,apiVersion:"4.2.67",data:a,password:d,disableAutoFetch:W,rangeChunkSize:g,length:X,docBaseUrl:_,enableXfa:j,evaluatorOptions:{maxImageSize:N,disableFontFace:z,ignoreErrors:D,isEvalSupported:B,isOffscreenCanvasSupported:H,canvasMaxAreaInBytes:U,fontExtraProperties:$,useSystemFonts:Y,cMapUrl:J?E:null,standardFontDataUrl:J?k:null}},ti={ignoreErrors:D,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),h=new Promise(function(t){let e;if(c)e=new f.PDFDataTransportStream(c,{disableRange:V,disableStream:q});else if(!a){var i;i={url:s,length:X,httpHeaders:o,withCredentials:l,rangeChunkSize:g,disableRange:V,disableStream:q},e=r.isNodeJS?"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&(0,n.isValidFetchUrl)(i.url)?new b.PDFFetchStream(i):new v.PDFNodeStream(i):(0,n.isValidFetchUrl)(i.url)?new b.PDFFetchStream(i):new A.PDFNetworkStream(i)}t(e)});return Promise.all([t,h]).then(function([t,s]){if(e.destroyed)throw Error("Loading aborted");let r=new p.MessageHandler(i,t,m.port),a=new O(r,e,s,ti,tt);e._transport=a,r.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,r.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class L{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,r.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 k{#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:r=!1}={}){return new n.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:r})}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,r.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=r.AnnotationMode.ENABLE,transform:a=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&r.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:a,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 A=b.task;return Promise.all([g.displayReadyCapability.promise,o]).then(([t,e])=>{if(this.destroyed){f();return}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),A}getOperatorList({intent:t="display",annotationMode:e=r.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){let s;let a=this._transport.getRenderingIntent(t,e,i,!0),n=this._intentStates.get(a.cacheKey);return n||(n=Object.create(null),this._intentStates.set(a.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(a)),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(),r={items:[],styles:Object.create(null)};!function e(){s.read().then(function({value:i,done:s}){if(s){t(r);return}Object.assign(r.styles,i.styles),r.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:r}=i,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s},r).getReader(),n=this._intentStates.get(e);n.streamReader=a;let o=()=>{a.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 r.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 I{#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 D={isWorkerDisabled:!1,fakeWorkerId:0};r.isNodeJS&&(D.isWorkerDisabled=!0,u.GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"),D.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},D.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,r.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(!D.isWorkerDisabled&&!F.#J){let{workerSrc:t}=F;try{D.isSameOrigin(window.location.href,t)||(t=D.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",r),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},r=()=>{this._webWorker||s()};e.addEventListener("error",r),i.on("test",t=>{if(e.removeEventListener("error",r),this.destroyed){s();return}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",r),this.destroyed){s();return}try{a()}catch{this._setupFakeWorker()}});let a=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};a();return}catch{(0,r.info)("The worker has been disabled.")}}this._setupFakeWorker()}
1_setupFakeWorker(){D.isWorkerDisabled||((0,r.warn)("Setting up fake worker."),D.isWorkerDisabled=!0),F._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let e=new I;this._port=e;let i=`fake${D.fakeWorkerId++}`,s=new p.MessageHandler(i+"_worker",i,e);t.setup(s,e);let r=new p.MessageHandler(i,i+"_worker",e);this._messageHandler=r,this._readyCapability.resolve(),r.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);if(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,r.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,r){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=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.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,r.shadow)(this,"annotationStorage",new a.AnnotationStorage)}getRenderingIntent(t,e=r.AnnotationMode.ENABLE,i=null,s=!1){let n=r.RenderingIntentFlag.DISPLAY,o=a.SerializableEmpty;switch(t){case"any":n=r.RenderingIntentFlag.ANY;break;case"display":break;case"print":n=r.RenderingIntentFlag.PRINT;break;default:(0,r.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case r.AnnotationMode.DISABLE:n+=r.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case r.AnnotationMode.ENABLE:break;case r.AnnotationMode.ENABLE_FORMS:n+=r.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case r.AnnotationMode.ENABLE_STORAGE:o=((n+=r.RenderingIntentFlag.ANNOTATIONS_STORAGE)&r.RenderingIntentFlag.PRINT&&i instanceof a.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,r.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}return s&&(n+=r.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 r.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,r.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}){if(i){e.close();return}(0,r.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,r.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let i=this._networkStream.getRangeReader(t.begin,t.end);if(!i){e.close();return}e.onPull=()=>{i.read().then(function({value:t,done:i}){if(i){e.close();return}(0,r.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})}}),t.on("GetDoc",({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new L(t,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new r.PasswordException(t.message,t.code);break;case"InvalidPDFException":i=new r.InvalidPDFException(t.message);break;case"MissingPDFException":i=new r.MissingPDFException(t.message);break;case"UnexpectedResponseException":i=new r.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":i=new r.UnknownErrorException(t.message,t.details);break;default:(0,r.unreachable)("DocException - expected a valid Error.")}e._capability.reject(i)}
1),t.on("PasswordRequest",t=>{if(this.#ti=Promise.withResolvers(),e.onPassword)try{e.onPassword(t=>{t instanceof Error?this.#ti.reject(t):this.#ti.resolve({password:t})},t.code)}catch(t){this.#ti.reject(t)}else this.#ti.reject(new r.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 a=this._params;if("error"in s){let t=s.error;(0,r.warn)(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}let n=a.pdfBug&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,l=new o.FontFaceObject(s,{disableFontFace:a.disableFontFace,ignoreErrors:a.ignoreErrors,inspectFont:n});this.fontLoader.bind(l).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{!a.fontExtraProperties&&l.data&&(l.data=null),this.commonObjs.resolve(e,l)});break;case"CopyLocalImage":let{imageRef:h}=s;for(let t of((0,r.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 a=this.#Z.get(e);if(!a.objs.has(t)){if(0===a._intentStates.size){s?.bitmap?.close();return}switch(i){case"Image":a.objs.resolve(t,s),s?.dataLen>r.MAX_IMAGE_SIZE_TO_CACHE&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.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,r.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 k(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})}
1getPageLabels(){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;let 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,r.shadow)(this,"loadingParams",{disableAutoFetch:t,enableXfa:e})}}let N=Symbol("INITIAL_DATA");class B{#tr=Object.create(null);#ta(t){return this.#tr[t]||={...Promise.withResolvers(),data:N}}get(t,e=null){if(e){let i=this.#ta(t);return i.promise.then(()=>e(i.data)),null}let i=this.#tr[t];if(!i||i.data===N)throw Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#tr[t];return!!e&&e.data!==N}resolve(t,e=null){let i=this.#ta(t);i.data=e,i.resolve()}clear(){for(let t in this.#tr){let{data:e}=this.#tr[t];e?.bitmap?.close()}this.#tr=Object.create(null)}*[Symbol.iterator](){for(let t in this.#tr){let{data:e}=this.#tr[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:r,operatorList:a,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=r,this.operatorListIdx=null,this.operatorList=a,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&&"undefined"!=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:r,background:a}=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:r,viewport:s,transparency:t,background:a}),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:()=>a,BaseFilterFactory:()=>r,BaseSVGFactory:()=>l,BaseStandardFontDataFactory:()=>o});var s=i(292);class r{constructor(){this.constructor===r&&(0,s.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addHighlightHCMFilter(t,e,i,s,r){return"none"}destroy(t=!1){}}class a{constructor(){this.constructor===a&&(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:()=>M});var s=i(292),r=i(419);let a={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function n(t,e){if(!e)return;let i=e[2]-e[0],s=e[3]-e[1],r=new Path2D;r.rect(e[0],e[1],i,s),t.clip(r)}class o{constructor(){this.constructor===o&&(0,s.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,s.unreachable)("Abstract method `getPattern` called.")}}class l extends o{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 l;if(o===a.STROKE||o===a.FILL){let a=e.current.getClippedPathBoundingBox(o,(0,r.getCurrentTransform)(t))||[0,0,0,0],h=Math.ceil(a[2]-a[0])||1,d=Math.ceil(a[3]-a[1])||1,c=e.cachedCanvases.getCanvas("pattern",h,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(-a[0],-a[1]),i=s.Util.transform(i,[1,0,0,1,a[0],a[1]]),u.transform(...e.baseTransform),this.matrix&&u.transform(...this.matrix
1),n(u,this._bbox),u.fillStyle=this._createGradient(u),u.fill(),l=t.createPattern(c.canvas,"no-repeat");let p=new DOMMatrix(i);l.setTransform(p)}else n(t,this._bbox),l=this._createGradient(t);return l}}function h(t,e,i,s,r,a,n,o){let l,h,d,c,u,p,g,m,f;let b=e.coords,A=e.colors,v=t.data,y=4*t.width;b[i+1]>b[s+1]&&(l=i,i=s,s=l,l=a,a=n,n=l),b[s+1]>b[r+1]&&(l=s,s=r,r=l,l=n,n=o,o=l),b[i+1]>b[s+1]&&(l=i,i=s,s=l,l=a,a=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[r]+e.offsetX)*e.scaleX,S=(b[r+1]+e.offsetY)*e.scaleY;if(E>=S)return;let C=A[a],M=A[a+1],P=A[a+2],R=A[n],L=A[n+1],k=A[n+2],I=A[o],D=A[o+1],F=A[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-L)*e,u=P-(P-k)*e}else{let e;e=t>S?1:x===S?0:(x-t)/(x-S),h=w-(w-T)*e,d=R-(R-I)*e,c=L-(L-D)*e,u=k-(k-F)*e}e=t<E?0:t>S?1:(E-t)/(E-S),p=_-(_-T)*e,g=C-(C-I)*e,m=M-(M-D)*e,f=P-(P-F)*e;let i=Math.round(Math.min(h,p)),s=Math.round(Math.max(h,p)),r=y*t+4*i;for(let t=i;t<=s;t++)(e=(h-t)/(h-p))<0?e=0:e>1&&(e=1),v[r++]=d-(d-g)*e|0,v[r++]=c-(c-m)*e|0,v[r++]=u-(u-f)*e|0,v[r++]=255}}class d extends o{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]),r=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-s,n=Math.ceil(this._bounds[3])-r,o=Math.min(Math.ceil(Math.abs(a*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(n*t[1]*1.1)),3e3),d=a/o,c=n/l,u={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-r,scaleX:1/d,scaleY:1/c},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,r;let a=e.coords,n=e.colors;switch(e.type){case"lattice":let o=e.verticesPerRow,l=Math.floor(a.length/o)-1,d=o-1;for(s=0;s<l;s++){let e=s*o;for(let s=0;s<d;s++,e++)h(t,i,a[e],a[e+1],a[e+o],n[e],n[e+1],n[e+o]),h(t,i,a[e+o+1],a[e+1],a[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(s=0,r=a.length;s<r;s+=3)h(t,i,a[s],a[s+1],a[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*d,offsetY:r-2*c,scaleX:d,scaleY:c}}getPattern(t,e,i,o){let l;if(n(t,this._bbox),o===a.SHADING)l=s.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(t));else if(l=s.Util.singularValueDecompose2dScale(e.baseTransform),this.matrix){let t=s.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*t[0],l[1]*t[1]]}let h=this._createMeshCanvas(l,o===a.SHADING?null:this._background,e.cachedCanvases);return o!==a.SHADING&&(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 c extends o{getPattern(){return"hotpink"}}let u={COLORED:1,UNCOLORED:2};class p{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,s,r){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=r}createPatternCanvas(t){let e=this.operatorList,i=this.bbox,a=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]],A=this.getSizeAndScale(a,this.ctx.canvas.width,b[0]),v=this.getSizeAndScale(n,this.ctx.canvas.height,b[1]),y=t.cachedCanvases.getCanvas("pattern",A.size,v.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(-(A.scale*w),-(v.scale*x)),E.transform(A.scale,0,0,v.scale,0,0),_.save(),this.clipBbox(E,w,x,T,S),E.baseTransform=(0,r.getCurrentTransform)(E.ctx),E.executeOperatorList(e),E.endDrawing(),{canvas:y.canvas,scaleX:A.scale,scaleY:v.scale,offsetX:w,offsetY:x}}getSizeAndScale(t,e,i){t=Math.abs(t);let s=Math.max(p.MAX_PATTERN_SIZE,e),r=Math.ceil(t*i);return r>=s?r=s:i=r/t,{scale:i,size:r}}clipBbox(t,e,i,s,a){let n=s-e,o=a-i;t.ctx.rect(e,i,n,o),t.current.updateRectMinMax((0,r.getCurrentTransform)(t.ctx),[e,i,s,a]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let r=t.ctx,a=t.current;switch(e){case u.COLORED:let n=this.ctx;r.fillStyle=n.fillStyle,r.strokeStyle=n.strokeStyle,a.fillColor=n.fillStyle,a.strokeColor=n.strokeStyle;break;case u.UNCOLORED:let o=s.Util.makeHexColor(i[0],i[1],i[2]);r.fillStyle=o,r.strokeStyle=o,a.fillColor=o,a.strokeColor=o;break;default:throw new s.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,r){let n=i;r!==a.SHADING&&(n=s.Util.transform(n,e.baseTransform),this.matrix&&(n=s.Util.transform(n,this.matrix
1)));let o=this.createPatternCanvas(e),l=new DOMMatrix(n);l=(l=l.translate(o.offsetX,o.offsetY)).scale(1/o.scaleX,1/o.scaleY);let h=t.createPattern(o.canvas,"repeat");return h.setTransform(l),h}}class g{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 m(t,e,i,s,a,n,o,l,h,d){let[c,u,p,g,m,f]=(0,r.getCurrentTransform)(t);if(0===u&&0===p){let r=Math.round(o*c+m),b=Math.round(l*g+f),A=Math.abs(Math.round((o+h)*c+m)-r)||1,v=Math.abs(Math.round((l+d)*g+f)-b)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(g),r,b),t.drawImage(e,i,s,a,n,0,0,A,v),t.setTransform(c,u,p,g,m,f),[A,v]}if(0===c&&0===g){let r=Math.round(l*p+m),b=Math.round(o*u+f),A=Math.abs(Math.round((l+d)*p+m)-r)||1,v=Math.abs(Math.round((o+h)*u+f)-b)||1;return t.setTransform(0,Math.sign(u),Math.sign(p),0,r,b),t.drawImage(e,i,s,a,n,0,0,v,A),t.setTransform(c,u,p,g,m,f),[v,A]}t.drawImage(e,i,s,a,n,o,l,h,d);let b=Math.hypot(c,u),A=Math.hypot(p,g);return[b*h,A*d]}class f{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),r=s.Util.applyTransform(e.slice(2),t),a=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],r[0],a[0],n[0]),this.minY=Math.min(this.minY,i[1],r[1],a[1],n[1]),this.maxX=Math.max(this.maxX,i[0],r[0],a[0],n[0]),this.maxY=Math.max(this.maxY,i[1],r[1],a[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,r,a,n,o,l,h,d){let c=s.Util.bezierBoundingBox(e,i,r,a,n,o,l,h,d);d||this.updateRectMinMax(t,c)}getPathBoundingBox(t=a.FILL,e=null){let i=[this.minX,this.minY,this.maxX,this.maxY];if(t===a.STROKE){e||(0,s.unreachable)("Stroke bounding box must include transform.");let t=s.Util.singularValueDecompose2dScale(e),r=t[0]*this.lineWidth/2,a=t[1]*this.lineWidth/2;i[0]-=r,i[1]-=a,i[2]+=r,i[3]+=a}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=a.FILL,e=null){return s.Util.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function b(t,e){let i,r,a,n;if("undefined"!=typeof ImageData&&e instanceof ImageData){t.putImageData(e,0,0);return}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,A=s.FeatureTest.isLittleEndian?4278190080:255;for(i=0;i<c;i++){for(r=0,a=i<d?16:h,g=0;r<a;r++){let t=e-p,i=0,s=t>b?l:8*t-7,r=-8&s,a=0,o=0;for(;i<r;i+=8)o=m[p++],n[g++]=128&o?4294967295:A,n[g++]=64&o?4294967295:A,n[g++]=32&o?4294967295:A,n[g++]=16&o?4294967295:A,n[g++]=8&o?4294967295:A,n[g++]=4&o?4294967295:A,n[g++]=2&o?4294967295:A,n[g++]=1&o?4294967295:A;for(;i<s;i++)0===a&&(o=m[p++],a=128),n[g++]=o&a?4294967295:A,a>>=1}for(;g<o;)n[g++]=0;t.putImageData(u,0,16*i)}}else if(e.kind===s.ImageKind.RGBA_32BPP){for(i=0,r=0,n=64*l;i<d;i++)f.set(m.subarray(p,p+n)),p+=n,t.putImageData(u,0,r),r+=16;i<c&&(n=l*h*4,f.set(m.subarray(p,p+n)),t.putImageData(u,0,r))}else if(e.kind===s.ImageKind.RGB_24BPP)for(i=0,a=16,n=l*a;i<c;i++){for(i>=d&&(a=h,n=l*a),g=0,r=n;r--;)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){t.drawImage(e.bitmap,0,0);return}
1let i=e.height,r=e.width,a=i%16,n=(i-a)/16,o=0===a?n:n+1,l=t.createImageData(r,16),h=0,d=e.data,c=l.data;for(let e=0;e<o;e++){let i=e<n?16:a;({srcPos:h}=function({src:t,srcPos:e=0,dest:i,width:r,height:a,nonBlackColor:n=4294967295,inverseDecode:o=!1}){let l=s.FeatureTest.isLittleEndian?4278190080:255,[h,d]=o?[n,l]:[l,n],c=r>>3,u=7&r,p=t.length;i=new Uint32Array(i.buffer);let g=0;for(let s=0;s<a;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:r,height:i,nonBlackColor:0})),t.putImageData(l,0,16*e)}}function v(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 y(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 _(t,e,i){let s=t.length,r=1/255;for(let a=3;a<s;a+=4){let s=i?i[t[a]]:t[a];e[a]=e[a]*s*r|0}}function E(t,e,i){let s=t.length;for(let r=3;r<s;r+=4){let s=77*t[r-3]+152*t[r-2]+28*t[r-1];e[r]=i?e[r]*i[s>>8]>>8:e[r]*s>>16}}function w(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 a=Math.fround((globalThis.devicePixelRatio||1)*r.PixelsPerInch.PDF_TO_CSS_UNITS);return i[0]<=a&&i[1]<=a}let x=["butt","round","square"],T=["miter","round","bevel"],S={},C={};class M{constructor(t,e,i,s,r,{optionalContentConfig:a,markedContentStack:n=null},o,l){this.ctx=t,this.current=new f(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=r,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=a,this.cachedCanvases=new g(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 a=this.ctx.canvas.width,n=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,n),this.ctx.fillStyle=o,i){let t=this.cachedCanvases.getCanvas("transparent",a,n);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...(0,r.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),y(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,r.getCurrentTransform)(this.ctx)}executeOperatorList(t,e,i,r){let a;let 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!==r&&l===r.nextBreakPoint)return r.breakIt(l,i),l;if((a=o[l])!==s.OPS.dependency)this[a].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())"undefined"!=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;let r=t.width,a=t.height,n=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=r,h=a,d="prescale1";for(;n>2&&l>1||o>2&&h>1;){let e=l,r=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&&(r=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/r),(s=(i=this.cachedCanvases.getCanvas(d,e,r)).context).clearRect(0,0,e,r),s.drawImage(t,0,0,l,h,0,0,e,r),t=i.canvas,l=e,h=r,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:h}}_createMaskCanvas(t){let e,i,n,o;let l=this.ctx,{width:h,height:d}=t,c=this.current.fillColor,u=this.current.patternFill,p=(0,r.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 r=e.get(i);if(r&&!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:r,offsetX:t,offsetY:e}}n=r}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[f,b,v,y]=s.Util.getAxialAlignedBoundingBox([0,0,h,d],g),_=this.cachedCanvases.getCanvas("fillCanvas",Math.round(v-f)||1,Math.round(y-b)||1),E=_.context;E.translate(-f,-b),E.transform(...g),!n&&(n=(n=this._scaleImage(o.canvas,(0,r.getCurrentTransformInverse)(E))).img,e&&u&&e.set(i,n)),E.imageSmoothingEnabled=w((0,r.getCurrentTransform)(E),t.interpolate),m(E,n,0,0,n.width,n.height,0,0,h,d),E.globalCompositeOperation="source-in";let x=s.Util.transform((0,r.getCurrentTransformInverse)(E),[1,0,0,1,-f,-b]);return E.fillStyle=u?c.getPattern(l,this,x,a.FILL):c,E.fillRect(0,0,h,d),e&&!u&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,_.canvas)),{canvas:_.canvas,offsetX:Math.round(f),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=x[t]}setLineJoin(t){this.ctx.lineJoin=T[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 a=this.ctx;a.setTransform(...(0,r.getCurrentTransform)(this.suspendedCtx)),v(this.suspendedCtx,a),function(t,e){if(t._removeMirroring)throw Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()}
1,t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,s,r,a,n){e.transform(t,i,s,r,a,n),this.__originalTransform(t,i,s,r,a,n)},t.setTransform=function(t,i,s,r,a,n){e.setTransform(t,i,s,r,a,n),this.__originalSetTransform(t,i,s,r,a,n)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,s,r,a,n){e.bezierCurveTo(t,i,s,r,a,n),this.__originalBezierCurveTo(t,i,s,r,a,n)},t.rect=function(t,i,s,r){e.rect(t,i,s,r),this.__originalRect(t,i,s,r)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(a,this.suspendedCtx),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(),v(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;!function(t,e,i,s){let r=s[0],a=s[1],n=s[2]-r,o=s[3]-a;0!==n&&0!==o&&(function(t,e,i,s,r,a,n,o,l,h,d){let c=!!a,u=c?a[0]:0,p=c?a[1]:0,g=c?a[2]:0,m="Luminosity"===r?E:_,f=Math.min(s,Math.ceil(1048576/i));for(let r=0;r<s;r+=f){let a=Math.min(f,s-r),b=t.getImageData(o-h,r+(l-d),i,a),A=e.getImageData(o,r+l,i,a);c&&function(t,e,i,s){let r=t.length;for(let a=3;a<r;a+=4){let r=t[a];if(0===r)t[a-3]=e,t[a-2]=i,t[a-1]=s;else if(r<255){let n=255-r;t[a-3]=t[a-3]*r+e*n>>8,t[a-2]=t[a-2]*r+i*n>>8,t[a-1]=t[a-1]*r+s*n>>8}}}(b.data,u,p,g),m(b.data,A.data,n),e.putImageData(A,o,r+l)}}(e.context,i,n,o,e.subtype,e.backdrop,e.transferMap,r,a,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}(i,e,this.ctx,t),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?(v(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(),v(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,r,a){this.ctx.transform(t,e,i,s,r,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let a,n;let o=this.ctx,l=this.current,h=l.x,d=l.y,c=(0,r.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,r=0,g=t.length;i<g;i++)switch(0|t[i]){case s.OPS.rectangle:h=e[r++],d=e[r++];let g=e[r++],m=e[r++],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[r++],d=e[r++],o.moveTo(h,d),u||l.updatePathMinMax(c,h,d);break;case s.OPS.lineTo:h=e[r++],d=e[r++],o.lineTo(h,d),u||l.updatePathMinMax(c,h,d);break;case s.OPS.curveTo:a=h,n=d,h=e[r+4],d=e[r+5],o.bezierCurveTo(e[r],e[r+1],e[r+2],e[r+3],h,d),l.updateCurvePathMinMax(c,a,n,e[r],e[r+1],e[r+2],e[r+3],h,d,p),r+=6;break;case s.OPS.curveTo2:a=h,n=d,o.bezierCurveTo(h,d,e[r],e[r+1],e[r+2],e[r+3]),l.updateCurvePathMinMax(c,a,n,h,d,e[r],e[r+1],e[r+2],e[r+3],p),h=e[r+2],d=e[r+3],r+=4;break;case s.OPS.curveTo3:a=h,n=d,h=e[r+2],d=e[r+3],o.bezierCurveTo(e[r],e[r+1],h,d,h,d),l.updateCurvePathMinMax(c,a,n,e[r],e[r+1],h,d,h,d,p),r+=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,r.getCurrentTransformInverse)(e),a.STROKE),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,r.getCurrentTransformInverse)(e),a.FILL),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=S}eoClip(){this.pendingClip=C}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){e.beginPath();return}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),r=this.current;if(!i)throw Error(`Can't find font for ${t}`);if(r.fontMatrix=i.fontMatrix||s.FONT_IDENTITY_MATRIX,(0===r.fontMatrix[0]||0===r.fontMatrix[3])&&(0,s.warn)("Invalid font matrix for font "+t),e<0?(e=-e,r.fontDirection=-1):r.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;let a=i.loadedName||"sans-serif",n=i.systemFontInfo?.css||`"${a}", ${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,r,a){this.current.textMatrix=[t,e,i,s,r,a],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,a){let n;let 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),a&&o.setTransform(...a),(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,r.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;let 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,A=o*i.fontMatrix[0],v=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,r.getCurrentTransformInverse)(l),a.FILL);
1e=(0,r.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*A*p,l.restore(),this.compose();return}let E=0,w;for(w=0;w<g;++w){let i,s;let r=t[w];if("number"==typeof r){E+=f*r*o/1e3;continue}let a=!1,p=(r.isSpace?c:0)+d,g=r.fontChar,y=r.accent,_=r.width;if(m){let t=r.vmetric||b,e=-(r.vmetric?t[1]:.5*_)*A,a=t[2]*A;_=t?-t[0]:_,i=e/h,s=(E+a)/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;a=!0,l.save(),l.scale(e,1),i/=e}else _!==t&&(i+=(_-t)/2e3*o/h)}if(this.contentVisible&&(r.isInFont||n.missingFile)){if(v&&!y)l.fillText(g,i,s);else if(this.paintChar(g,i,s,e),y){let t=i+o*y.offset.x/h,r=s-o*y.offset.y/h;this.paintChar(y.fontChar,t,r,e)}}let x=m?_*A-p*u:_*A+p*u;E+=x,a&&l.restore()}m?i.y-=E:i.x+=E*p,l.restore(),this.compose()}showType3Text(t){let e,i,r,a;let 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){a=c*i*h/1e3,this.ctx.translate(a,0),o.x+=a*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()),r=s.Util.applyTransform([i.width,0],m)[0]*h+d,n.translate(r,0),o.x+=r*g}n.restore(),this.processingType3=null}}setCharWidth(t,e){}
1setCharWidthAndBounds(t,e,i,s,r,a){this.ctx.rect(i,s,r-i,a-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){let i=t[1],s=this.baseTransform||(0,r.getCurrentTransform)(this.ctx);e=new p(t,i,this.ctx,{createCanvasGraphics:t=>new M(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 r=s.Util.makeHexColor(t,e,i);this.ctx.strokeStyle=r,this.current.strokeColor=r}setFillRGBColor(t,e,i){let r=s.Util.makeHexColor(t,e,i);this.ctx.fillStyle=r,this.current.fillColor=r,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 l(t);case"Mesh":return new d(t);case"Dummy":return new c}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();let i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,(0,r.getCurrentTransformInverse)(e),a.SHADING);let n=(0,r.getCurrentTransformInverse)(e);if(n){let{width:t,height:i}=e.canvas,[r,a,o,l]=s.Util.getAxialAlignedBoundingBox([0,0,t,i],n);this.ctx.fillRect(r,a,o-r,l-a)}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,r.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,r.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,r.getCurrentTransform)(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let a=s.Util.getAxialAlignedBoundingBox(t.bbox,(0,r.getCurrentTransform)(e)),n=[0,0,e.canvas.width,e.canvas.height];a=s.Util.intersect(a,n)||[0,0,0,0];let o=Math.floor(a[0]),l=Math.floor(a[1]),h=Math.max(Math.ceil(a[2])-o,1),d=Math.max(Math.ceil(a[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()),v(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,r.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,a,n){if(this.#tl(),y(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(e)&&4===e.length){let a=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]=a,e[3]=o;let[n,l]=s.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(this.ctx)),{viewportScale:h}=this,d=Math.ceil(a*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),y(this.ctx)}else y(this.ctx),this.ctx.rect(e[0],e[1],a,o),this.ctx.clip(),this.endPath()}this.current=new f(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...a)}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;let{width:r,height:a}=t;if(r>1e3||a>1e3)return null;let n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),o=r+1,l=new Uint8Array(o*(a+1)),h=r+7&-8,d=new Uint8Array(h*a),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<r;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<a;e++){c=e*h,s=e*o,d[c-h]!==d[c]&&(l[s]=d[c]?1:8,++u);let t=(d[c]?4:0)+(d[c-h]?8:0);for(i=1;i<r;i++)n[t=(t>>2)+(d[c+1]?4:0)+(d[c-h+1]?8:0)]&&(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*(a-1),s=e*o,0!==d[c]&&(l[s]=8,++u),i=1;i<r;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<=a;e++){let t=e*o,i=t+r;for(;t<i&&!l[t];)t++;if(t===i)continue;g.moveTo(t%o,e);let s=t,a=l[t];do{let e=p[a];do t+=e;while(!l[t]);let i=l[t];5!==i&&10!==i?(a=i,l[t]=0):(a=i&51*a>>4,l[t]&=a>>2|a<<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/r,-1/a),t.translate(0,-a),t.fill(g),t.beginPath(),t.restore()}}(t)),s.compiled)){s.compiled(i);return}let r=this._createMaskCanvas(t),a=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,r.offsetX,r.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,a=0,n,o){if(!this.contentVisible)return;t=this.getObject(t.data,t);let l=this.ctx;l.save();let h=(0,r.getCurrentTransform)(l);l.transform(e,i,a,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,r=o.length;t<r;t+=2){let r=s.Util.transform(h,[e,i,a,n,o[t],o[t+1]]),[c,u]=s.Util.applyTransform([0,0],r);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,r.getCurrentTransformInverse)(e),a.FILL):i,c.fillRect(0,0,o,l),c.restore(),e.save(),e.transform(...h),e.scale(1,-1),m(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);if(!e){(0,s.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,i,r){if(!this.contentVisible)return;let a=this.getObject(t);if(!a){(0,s.warn)("Dependent image isn't ready yet");return}let n=a.width,o=a.height,l=[];for(let t=0,s=r.length;t<s;t+=2)l.push({transform:[e,0,0,i,r[t],r[t+1]],x:0,y:0,w:n,h:o});this.paintInlineImageXObjectGroup(a,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,r=this.cachedCanvases.getCanvas("inlineImage",i,s),a=r.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",r.canvas}paintInlineImageXObject(t){let e;if(!this.contentVisible)return;let i=t.width,a=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/a),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,a).context;b(s,t),e=this.applyTransferMapsToCanvas(s)}let o=this._scaleImage(e,(0,r.getCurrentTransformInverse)(n));n.imageSmoothingEnabled=w((0,r.getCurrentTransform)(n),t.interpolate),m(n,o.img,0,0,o.paintWidth,o.paintHeight,0,-a,i,a),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,r=this.cachedCanvases.getCanvas("inlineImage",e,s).context;b(r,t),i=this.applyTransferMapsToCanvas(r)}for(let t of e)s.save(),s.transform(...t.transform),s.scale(1,-1),m(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===C?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=(0,r.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;let{lineWidth:i}=this.current,{a:s,b:r,c:a,d:n}=this.ctx.getTransform();if(0===r&&0===a){let r=Math.abs(s),a=Math.abs(n);if(r===a){if(0===i)t=e=1/r;else{let s=r*i;t=e=s<1?1/s:1}}else if(0===i)t=1/r,e=1/a;else{let s=r*i,n=a*i;t=s<1?1/s:1,e=n<1?1/n:1}}else{let o=Math.abs(s*n-r*a),l=Math.hypot(s,r),h=Math.hypot(a,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,r]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===r){e.stroke();return}let a=e.getLineDash();if(t&&e.save(),e.scale(s,r),a.length>0){let t=Math.max(s,r);e.setLineDash(a.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!==M.prototype[t]&&(M.prototype[s.OPS[t]]=M.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:()=>A,getPdfFilenameFromUrl:()=>v,getRGB:()=>T,getXfaPageViewport:()=>x,isDataScheme:()=>f,isPdfFile:()=>b,isValidFetchUrl:()=>_,noContextMenu:()=>E,setLayerDimensions:()=>P});var r=i(583),a=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 r.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,r;if(!t)return"none";let a=this.#tm.get(t);if(a)return a;if(1===t.length){let a=t[0],n=Array(256);for(let t=0;t<256;t++)n[t]=a[t]/255;r=e=i=s=n.join(",")}else{let[a,n,o]=t,l=Array(256),h=Array(256),d=Array(256);for(let t=0;t<256;t++)l[t]=a[t]/255,h[t]=n[t]/255,d[t]=o[t]/255;e=l.join(","),i=h.join(","),s=d.join(","),r=`${e}${i}${s}`}if(a=this.#tm.get(r))return this.#tm.set(t,a),a;let n=`g_${this.#j}_transfer_map_${this.#tg++}`,o=`url(#${n})`;this.#tm.set(t,o),this.#tm.set(r,o);let l=this.#tA(n);return this.#tv(e,i,s,l),o}addHCMFilter(t,e){let i=`${t}-${e}`,s="base",r=this.#tf.get(s);if(r?.key===i||(r?(r.filter?.remove(),r.key=i,r.url="none",r.filter=null):(r={key:i,url:"none",filter:null},this.#tf.set(s,r)),!t||!e))return r.url;let n=this.#ty(t);t=a.Util.makeHexColor(...n);let o=this.#ty(e);if(e=a.Util.makeHexColor(...o),this.#tb.style.color="","#000000"===t&&"#ffffff"===e||t===e)return r.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=r.filter=this.#tA(d);this.#tv(h,h,h,c),this.#t_(c);let u=(t,e)=>{let i=n[t]/255,s=o[t]/255,r=Array(e+1);for(let t=0;t<=e;t++)r[t]=i+t/e*(s-i);return r.join(",")};return this.#tv(u(0,5),u(1,5),u(2,5),c),r.url=`url(#${d})`,r.url}addHighlightHCMFilter(t,e,i,s,r){let a=`${e}-${i}-${s}-${r}`,n=this.#tf.get(t);if(n?.key===a||(n?(n.filter?.remove(),n.key=a,n.url="none",n.filter=null):(n={key:a,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,r].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),r=(d-h)/i,a=t/255,n=(e-t)/(255*i),o=0;for(let t=0;t<=i;t++){let e=Math.round(h+t*r),i=a+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.#tA(g);return this.#t_(m),this.#tv(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)}#tA(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)}#tv(t,e,i,s){let r=this.#tu.createElementNS(n,"feComponentTransfer");
1s.append(r),this.#tE(r,"feFuncR",t),this.#tE(r,"feFuncG",e),this.#tE(r,"feFuncB",i)}#ty(t){return this.#tb.style.color=t,T(getComputedStyle(this.#tb).getPropertyValue("color"))}}class h extends r.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 r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType=e,r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){switch(e){case"arraybuffer":case"blob":case"json":i(r.response);return}i(r.responseText);return}s(Error(r.statusText))}},r.send(null)})}class c extends r.BaseCMapReaderFactory{_fetchData(t,e){return d(t,this.isCompressed?"arraybuffer":"text").then(t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):(0,a.stringToBytes)(t),compressionType:e}))}}class u extends r.BaseStandardFontDataFactory{_fetchData(t){return d(t,"arraybuffer").then(t=>new Uint8Array(t))}}class p extends r.BaseSVGFactory{_createSVG(t){return document.createElementNS(n,t)}}class g{constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:r=0,dontFlip:a=!1}){let n,o,l,h,d,c,u,p;this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=r;let 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.")}a&&(l=-l,h=-h),0===n?(d=Math.abs(m-t[1])*e+s,c=Math.abs(g-t[0])*e+r,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+r,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,a.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:r=!1}={}){return new g({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:r})}convertToViewportPoint(t,e){return a.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=a.Util.applyTransform([t[0],t[1]],this.transform),i=a.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return a.Util.applyInverseTransform([t,e],this.transform)}}class m extends a.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 A(t,e=!1){return e||([t]=t.split(/[#?]/,1)),t.substring(t.lastIndexOf("/")+1)}function v(t,e="document.pdf"){if("string"!=typeof t)return e;if(f(t))return(0,a.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t),r=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(r&&(r=r[0]).includes("%"))try{r=i.exec(decodeURIComponent(r))[0]}catch{}return r||e}class y{started=Object.create(null);times=[];time(t){t in this.started&&(0,a.warn)(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,a.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:r}of this.times)t.push(`${i.padEnd(e)} ${r-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),r=parseInt(e[2],10);r=r>=1&&r<=12?r-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a: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,r,a,n,o,l))}}function x(t,{scale:e=1,rotation:i=0}){let{width:s,height:r}=t.attributes.style,a=[0,0,parseInt(s),parseInt(r)];return new g({viewBox:a,scale:e,rotation:i})}function T(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(16711680&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,a.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:r,e:a,f:n}=t.getTransform();return[e,i,s,r,a,n]}function M(t){let{a:e,b:i,c:s,d:r,e:a,f:n}=t.getTransform().invertSelf();return[e,i,s,r,a,n]}function P(t,e,i=!1,s=!0){if(e instanceof g){let{pageWidth:s,pageHeight:r}=e.rawDims,{style:n}=t,o=a.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${s}px`,h=`var(--scale-factor) * ${r}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:()=>a});var s=i(419),r=i(292);class a{#v=null;#tg=0;#tw=new Map;#tx=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#v){this.#v=t;return}if(this.#v!==t){if(this.#tw.size>0)for(let e of this.#tw.values())e.remove(),t.append(e);this.#v=t}}static get _svgFactory(){return(0,r.shadow)(this,"_svgFactory",new s.DOMSVGFactory)}static #tT(t,{x:e=0,y:i=0,width:s=1,height:r=1}={}){let{style:a}=t;a.top=`${100*i}%`,a.left=`${100*e}%`,a.width=`${100*s}%`,a.height=`${100*r}%`}#tS(t){let e=a._svgFactory.create(1,1,!0);return this.#v.append(e),e.setAttribute("aria-hidden",!0),a.#tT(e,t),e}#tC(t,e){let i=a._svgFactory.createElement("clipPath");t.append(i);let s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let r=a._svgFactory.createElement("use");return i.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),s}highlight(t,e,i,s=!1){let r=this.#tg++,n=this.#tS(t.box);n.classList.add("highlight"),t.free&&n.classList.add("free");let o=a._svgFactory.createElement("defs");n.append(o);let l=a._svgFactory.createElement("path");o.append(l);let h=`path_p${this.pageIndex}_${r}`;l.setAttribute("id",h),l.setAttribute("d",t.toSVGPath()),s&&this.#tx.set(r,l);let d=this.#tC(o,h),c=a._svgFactory.createElement("use");return n.append(c),n.setAttribute("fill",e),n.setAttribute("fill-opacity",i),c.setAttribute("href",`#${h}`),this.#tw.set(r,n),{id:r,clipPathId:`url(#${d})`}}highlightOutline(t){let e;let i=this.#tg++,s=this.#tS(t.box);s.classList.add("highlightOutline");let r=a._svgFactory.createElement("defs");s.append(r);let n=a._svgFactory.createElement("path");r.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=a._svgFactory.createElement("mask");r.append(t),e=`mask_p${this.pageIndex}_${i}`,t.setAttribute("id",e),t.setAttribute("maskUnits","objectBoundingBox");let n=a._svgFactory.createElement("rect");t.append(n),n.setAttribute("width","1"),n.setAttribute("height","1"),n.setAttribute("fill","white");let l=a._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=a._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){a.#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.#v&&(this.#tw.get(t).remove(),this.#tw.delete(t))}destroy(){for(let t of(this.#v=null,this.#tw.values()))t.remove();this.#tw.clear()}}},731:(t,e,i)=>{i.d(e,{AnnotationEditorLayer:()=>m});var s=i(292),r=i(310),a=i(830),n=i(976);let o=/\r\n?|\n/g;class l extends r.AnnotationEditor{#tM=this.editorDivBlur.bind(this);#tP=this.editorDivFocus.bind(this);#tR=this.editorDivInput.bind(this);#tL=this.editorDivKeydown.bind(this);#tk=this.editorDivPaste.bind(this);#g;#tI="";#tD=`${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=a.AnnotationEditorUIManager.TRANSLATE_SMALL,r=a.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,s.shadow)(this,"_keyboardManager",new a.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:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,r],checker:e}]]))}static _type="freetext";static _editorType=s.AnnotationEditorType.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#g=t.color||l._defaultColor||r.AnnotationEditor._defaultLineColor,this.#tF=t.fontSize||l._defaultFontSize}static initialize(t,e){r.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||r.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.#tL),this.editorDiv.addEventListener("focus",this.#tP),this.editorDiv.addEventListener("blur",this.#tM),this.editorDiv.addEventListener("input",this.#tR),this.editorDiv.addEventListener("paste",this.#tk))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#tD),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#tL),this.editorDiv.removeEventListener("focus",this.#tP),this.editorDiv.removeEventListener("blur",this.#tM),this.editorDiv.removeEventListener("input",this.#tR),this.editorDiv.removeEventListener("paste",this.#tk),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;let[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,s=i.style.display,r=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",r)}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.#tI,e=this.#tI=this.#tU().trimEnd();if(t===e)return;let i=t=>{if(this.#tI=t,!t){this.remove();return}this.#t$(),this._uiManager.rebuild(this),this.#tH()};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.#tD),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),r.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,a.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){let[i,s]=this.parentDimensions;if(this.annotationElementId){let r,a;let{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:r=t+(n[0]-c)/h,a=e+this.height-(n[1]-u)/d;break;case 90:r=t+(n[0]-c)/h,a=e-(n[1]-u)/d,[o,l]=[l,-o];break;case 180:r=t-this.width+(n[0]-c)/h,a=e-(n[1]-u)/d,[o,l]=[-o,-l];break;case 270:r=t+(n[0]-c-this.height*d)/h,a=e+(n[1]-u-this.width*h)/d,[o,l]=[-l,o]}this.setAt(r*i,a*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 r=window.getSelection();if(!r.rangeCount)return;this.editorDiv.normalize(),r.deleteFromDocument();let a=r.getRangeAt(0);if(!s.includes("\n")){a.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),r.collapseToStart();return}let{startContainer:n,startOffset:h}=a,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.#tI=`${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}r.removeAllRanges(),r.addRange(u)}#t$(){if(this.editorDiv.replaceChildren(),this.#tI)for(let t of this.#tI.split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#tG(){return this.#tI.replaceAll("\xa0"," ")}static #tj(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let r=null;if(t instanceof n.FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:a,rotation:n,id:o},textContent:l,textPosition:h,parent:{page:{pageNumber:d}}}=t;if(!l||0===l.length)return null;r=t={annotationType:s.AnnotationEditorType.FREETEXT,color:Array.from(i),fontSize:e,value:l.join("\n"),position:h,pageIndex:d-1,rect:a.slice(0),rotation:n,id:o,deleted:!1}}let a=super.deserialize(t,e,i);return a.#tF=t.fontSize,a.#g=s.Util.makeHexColor(...t.color),a.#tI=l.#tj(t.value),a.annotationElementId=t.id||null,a.#tO=r,a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0}
2;let e=l._internalPadding*this.parentScale,i=this.getRect(e,e),a=r.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#g),n={annotationType:s.AnnotationEditorType.FREETEXT,color:a,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:r}=this.#tO;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==r}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.#tI.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 r.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);#t4=null;#t6;#t9=null;#t8="";#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 a.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.#t6=t.opacity||u._defaultOpacity,this.#tK=t.boxes||null,this.#et=t.methodOfCreation||"",this.#t8=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.#t4=[(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.#t9=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.#er(this.#t1.box,(e-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#t9,this.#tJ),this.parent.drawLayer.updateBox(this.#t9,u.#er(this.#tJ.box,e))}let{x:s,y:r,width:a,height:n}=t.box;switch(this.rotation){case 0:this.x=s,this.y=r,this.width=a,this.height=n;break;case 90:{let[t,e]=this.parentDimensions;this.x=r,this.y=1-s,this.width=a*e/t,this.height=n*t/e;break}case 180:this.x=1-s,this.y=1-r,this.width=a,this.height=n;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-r,this.y=s,this.width=a*e/t,this.height=n*t/e}}let{lastPoint:o}=this.#tJ.box;this.#t4=[(o[0]-s)/a,(o[1]-r)/n]}static initialize(t,e){r.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.#t4}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.HIGHLIGHT_COLOR:this.#tB(e);break;case s.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:this.#ea(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)}#ea(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.#t9),this.#t9=null)}#ei(t=this.parent){null===this.#tg&&({id:this.#tg,clipPathId:this.#tX}=t.drawLayer.highlight(this.#t1,this.color,this.#t6),this.#t9=t.drawLayer.highlightOutline(this.#tJ),this.#t0&&(this.#t0.style.clipPath=this.#tX))}static #er({x:t,y:e,width:i,height:s},r){switch(r){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;let{drawLayer:i}
2=this.parent;this.#t2?(t=(t-this.rotation+360)%360,e=u.#er(this.#t1.box,t)):e=u.#er(this,t),i.rotate(this.#tg,t),i.rotate(this.#t9,t),i.updateBox(this.#tg,e),i.updateBox(this.#t9,u.#er(this.#tJ.box,t))}render(){if(this.div)return this.div;let t=super.render();this.#t8&&(t.setAttribute("aria-label",this.#t8),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,a.bindEvents)(this,this.#t0,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#t9,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#t9,"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.#t9&&(this.parent?.drawLayer.removeClass(this.#t9,"hovered"),this.parent?.drawLayer.addClass(this.#t9,"selected"))}unselect(){super.unselect(),this.#t9&&(this.parent?.drawLayer.removeClass(this.#t9,"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.#t9,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),r=0;for(let{x:a,y:n,width:o,height:l}of i){let i=a*t,h=(1-n-l)*e;s[r]=s[r+4]=i,s[r+1]=s[r+3]=h,s[r+2]=s[r+6]=i+o*t,s[r+5]=s[r+7]=h+l*e,r+=8}return s}#ec(t){return this.#t1.serialize(t,this.#eo())}static startHighlighting(t,e,{target:i,x:s,y:r}){let{x:a,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:r},[a,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 r=super.deserialize(t,e,i),{rect:[a,n,o,l],color:h,quadPoints:d}=t;r.color=s.Util.makeHexColor(...h),r.#t6=t.opacity;let[c,u]=r.pageDimensions;r.width=(o-a)/c,r.height=(l-n)/u;let p=r.#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 r.#es(),r}serialize(t=!1){if(this.isEmpty()||t)return null;let e=this.getRect(0,0),i=r.AnnotationEditor._colorManager.convert(this.color);return{annotationType:s.AnnotationEditorType.HIGHLIGHT,color:i,opacity:this.#t6,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 r.AnnotationEditor{#eg=0;#em=0;#ef=this.canvasPointermove.bind(this);#eb=this.canvasPointerleave.bind(this);#eA=this.canvasPointerup.bind(this);#ev=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){r.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.#ea(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||r.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||r.AnnotationEditor._defaultLineColor],[s.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??p._defaultOpacity))]]}#ea(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.#eL()},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.#eL()};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.#ek(),this.#eI()),this.isAttachedToDOM||(this.parent.add(this),this.#eD()),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.#ev))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#ev))}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:r,scaleFactor:n}=this;
2t.lineWidth=s*r/n,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${(0,a.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.#eA),this.canvas.removeEventListener("pointerdown",this.#ev),this.isEditing=!0,this.#ex||(this.#ex=!0,this.#eD(),this.thickness||=p._defaultThickness,this.color||=p._defaultColor||r.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 r=this.currentPath,a=this.#e_;if(r.push([t,e]),this.#ew=!0,r.length<=2){a.moveTo(...r[0]),a.lineTo(t,e);return}3===r.length&&(this.#e_=a=new Path2D,a.moveTo(...r[0])),this.#eU(a,...r.at(-3),...r.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_,r=this.currentPath;this.currentPath=[],this.#e_=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(r),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#ek(),this.#eI()),this.#eR())},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,r,a,n){let o=(e+s)/2,l=(i+r)/2,h=(s+a)/2,d=(r+n)/2;t.bezierCurveTo(o+2*(s-o)/3,l+2*(r-l)/3,h+2*(s-h)/3,d+2*(r-d)/3,h,d)}#ej(){let t;let e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let i=[],[s,r]=e[0];for(t=1;t<e.length-2;t++){let[a,n]=e[t],[o,l]=e[t+1],h=(a+o)/2,d=(n+l)/2,c=[s+2*(a-s)/3,r+2*(n-r)/3],u=[h+2*(a-h)/3,d+2*(n-d)/3];i.push([[s,r],c,u,[h,d]]),[s,r]=[h,d]}let[a,n]=e[t],[o,l]=e[t+1],h=[s+2*(a-s)/3,r+2*(n-r)/3];return i.push([[s,r],h,[o+2*(a-o)/3,l+2*(n-l)/3],[o,l]]),i}#eL(){if(this.isEmpty()){this.#eG();return}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.#eA),this.canvas.addEventListener("pointerdown",this.#ev),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()}#ek(){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")}#eI(){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,r,a]=this.#eF();if(this.setAt(i,s,0,0),this.setDims(r,a),this.#ek(),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.#eD(),this.setDims(this.width*i,this.height*s),this.#eL(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#eI(),this.div}#eD(){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[r,a]=this.parentDimensions;this.width=t/r,this.height=e/a,this.fixAndSetPosition(),this.#eE&&this.#eq(t,e),this.#eD(),this.#eL(),this.canvas.style.visibility="visible",this.fixDims()}#eq(t,e){let i=this.#eW(),s=(t-i)/this.#em,r=(e-i)/this.#eg;this.scaleFactor=Math.min(s,r)}#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,r,a,n]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(r[0],r[1],a[0],a[1],n[0],n[1])}return e}static #eX(t,e,i){let[s,r,a,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+r}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]+=r;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=a-t[e+1],t[e+1]=n-i}break;default:throw Error("Invalid rotation")}return t}static #eY(t,e,i){let[s,r,a,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]-r,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]-=r;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]=a-i}break;default:throw Error("Invalid rotation")}return t}#eJ(t,e,i,s){let r=[],a=this.thickness/2,n=t*e+a,o=t*i+a;for(let e of this.paths){let i=[],a=[];for(let s=0,r=e.length;s<r;s++){let[l,h,d,c]=e[s];if(l[0]===c[0]&&l[1]===c[1]&&1===r){let e=t*l[0]+n,s=t*l[1]+o;i.push(e,s),a.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,A=t*c[0]+n,v=t*c[1]+o;0===s&&(i.push(u,p),a.push(u,p)),i.push(g,m,f,b,A,v),a.push(g,m),s===r-1&&a.push(A,v)}r.push({bezier:p.#eX(i,s,this.rotation),points:p.#eX(a,s,this.rotation)})}return r}#eQ(){let t=1/0,e=-1/0,i=1/0,r=-1/0;for(let a of this.paths)for(let[n,o,l,h]of a){let a=s.Util.bezierBoundingBox(...n,...o,...l,...h);t=Math.min(t,a[0]),i=Math.min(i,a[1]),e=Math.max(e,a[2]),r=Math.max(r,a[3])}return[t,i,e,r]}#eW(){return this.#eE?Math.ceil(this.thickness*this.parentScale):0}#eR(t=!1){if(this.isEmpty())return;if(!this.#eE){this.#eL();return}let e=this.#eQ(),i=this.#eW();this.#em=Math.max(r.AnnotationEditor.MIN_SIZE,e[2]-e[0]),this.#eg=Math.max(r.AnnotationEditor.MIN_SIZE,e[3]-e[1]);let s=Math.ceil(i+this.#em*this.scaleFactor),a=Math.ceil(i+this.#eg*this.scaleFactor),[n,o]=this.parentDimensions;this.width=s/n,this.height=a/o,this.setAspectRatio(s,a);let l=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#eD(),this.#eL(),this.#eS=s,this.#eC=a,this.setDims(s,a);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 a=super.deserialize(t,e,i);a.thickness=t.thickness,a.color=s.Util.makeHexColor(...t.color),a.opacity=t.opacity;let[o,l]=a.pageDimensions,h=a.width*o,d=a.height*l,c=a.parentScale,u=t.thickness/2;a.#eE=!0,a.#eS=Math.round(h),a.#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=[];a.paths.push(e);let i=c*(t[0]-u),s=c*(t[1]-u);for(let r=2,a=t.length;r<a;r+=6){let a=c*(t[r]-u),n=c*(t[r+1]-u),o=c*(t[r+2]-u),l=c*(t[r+3]-u),h=c*(t[r+4]-u),d=c*(t[r+5]-u);e.push([[i,s],[a,n],[o,l],[h,d]]),i=h,s=d}let r=this.#eK(e);a.bezierPath2D.push(r)}let b=a.#eQ();return a.#em=Math.max(r.AnnotationEditor.MIN_SIZE,b[2]-b[0]),a.#eg=Math.max(r.AnnotationEditor.MIN_SIZE,b[3]-b[1]),a.#eq(h,d),a}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),e=r.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 r.AnnotationEditor{#eZ=null;#e0=null;#e1=null;#e2=null;#e3=null;#e5="";#e4=null;#eT=null;#e6=null;#e9=!1;#e8=!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){r.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){if(!t){this.remove();return}this.#eZ=t.bitmap,e||(this.#e0=t.id,this.#e9=t.isSvg),t.file&&(this.#e5=t.file.name),this.#ek()}#it(){this.#e1=null,this._uiManager.enableWaiting(!1),this.#e4&&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.#e4?.remove(),this.#e4=null,this.#eT?.disconnect(),this.#eT=null,this.#e6&&(clearTimeout(this.#e6),this.#e6=null)),super.remove()}rebuild(){if(!this.parent){this.#e0&&this.#ie();return}super.rebuild(),null!==this.div&&(this.#e0&&null===this.#e4&&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.#ek():this.#ie(),this.width){let[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}#ek(){let{div:t}=this,{width:e,height:i}=this.#eZ,[s,r]=this.pageDimensions;if(this.width)e=this.width*s,i=this.height*r;else if(e>.75*s||i>.75*r){let t=Math.min(.75*s/e,.75*r/i);e*=t,i*=t}let[a,n]=this.parentDimensions;this.setDims(e*a/s,i*n/r),this._uiManager.enableWaiting(!1);let o=this.#e4=document.createElement("canvas");t.append(o),t.hidden=!1,this.#ii(e,i),this.#eI(),this.#e8||(this.parent.addUndoableEditor(this),this.#e8=!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.#e6&&clearTimeout(this.#e6),this.#e6=setTimeout(()=>{this.#e6=null,this.#ii(t,e)},200)}#ir(t,e){let{width:i,height:s}=this.#eZ,r=i,a=s,n=this.#eZ;for(;r>2*t||a>2*e;){let i=r,s=a;r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2)),a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));let o=new OffscreenCanvas(r,a);o.getContext("2d").drawImage(n,0,0,i,s,0,0,r,a),n=o.transferToImageBitmap()}return n}#ii(t,e){t=Math.ceil(t),e=Math.ceil(e);let i=this.#e4;if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;let s=this.#e9?this.#eZ:this.#ir(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 r=i.getContext("2d");r.filter=this._uiManager.hcmFilter,r.drawImage(s,0,0,s.width,s.height,0,0,t,e)}getImageForAltText(){return this.#e4}#ia(t){if(t){if(this.#e9){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.#e9){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),r=new OffscreenCanvas(i,s);return r.getContext("2d").drawImage(this.#eZ,0,0,this.#eZ.width,this.#eZ.height,0,0,i,s),r.transferToImageBitmap()}return structuredClone(this.#eZ)}#eI(){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:r,bitmapUrl:a,bitmapId:o,isSvg:l,accessibilityData:h}=t;o&&i.imageManager.isValidId(o)?s.#e0=o:s.#e2=a,s.#e9=l;let[d,c]=s.pageDimensions;return s.width=(r[2]-r[0])/d,s.height=(r[3]-r[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.#e9,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#ia(!0),i.accessibilityData=this.altTextData,i;let{decorative:r,altText:a}=this.altTextData;if(!r&&a&&(i.accessibilityData={type:"Figure",alt:a}),null===e)return i;e.stamps||=new Map;let n=this.#e9?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#e0)){if(this.#e9){let t=e.stamps.get(this.#e0);n>t.area&&(t.area=n,t.serialized.bitmap.close(),t.serialized.bitmap=this.#ia(!1))}}else e.stamps.set(this.#e0,{area:n,serialized:i}),i.bitmap=this.#ia(!1);return i}}class m{#D;#io=!1;#il=null;#ih=null;#id=null;#ic=null;#iu=null;#ip=new Map;#ig=!1;#im=!1;#ib=!1;#iA=null;#iv;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:r,drawLayer:a,textLayer:n,viewport:o,l10n:l}){let h=[...m.#iy.values()];if(!m._initialized)for(let e of(m._initialized=!0,h))e.initialize(l,t);
2t.registerEditorTypes(h),this.#iv=t,this.pageIndex=e,this.div=i,this.#D=s,this.#il=r,this.viewport=o,this.#iA=n,this.drawLayer=a,this.#iv.addLayer(this)}get isEmpty(){return 0===this.#ip.size}get isInvisible(){return this.isEmpty&&this.#iv.getMode()===s.AnnotationEditorType.NONE}updateToolbar(t){this.#iv.updateToolbar(t)}updateMode(t=this.#iv.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.#iA?.div}addInkEditorIfNeeded(t){if(this.#iv.getMode()===s.AnnotationEditorType.INK){if(!t){for(let t of this.#ip.values())if(t.isEmpty()){t.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){this.#iv.setEditingState(t)}addCommands(t){this.#iv.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.#iv.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if(this.#il)for(let e of this.#il.getEditableAnnotations()){if(e.hide(),this.#iv.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.#iv.isDeletedAnnotationElement(s))continue;let r=e.get(s);if(r){r.resetAnnotationElement(i),r.show(!1),i.show();continue}(r=t.get(s))&&(this.#iv.addChangedExistingAnnotation(r),r.renderAnnotationElement(i),r.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.#iv.getActive()!==t&&this.#iv.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#iA?.div&&!this.#ic&&(this.#ic=this.#iE.bind(this),this.#iA.div.addEventListener("pointerdown",this.#ic),this.#iA.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#iA?.div&&this.#ic&&(this.#iA.div.removeEventListener("pointerdown",this.#ic),this.#ic=null,this.#iA.div.classList.remove("highlighting"))}#iE(t){if(this.#iv.unselectAll(),t.target===this.#iA.div){let{isMac:e}=s.FeatureTest.platform;0!==t.button||t.ctrlKey&&e||(this.#iv.showAllEditors("highlight",!0,!0),this.#iA.div.classList.add("free"),u.startHighlighting(this,"ltr"===this.#iv.direction,t),this.#iA.div.addEventListener("pointerup",()=>{this.#iA.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.#iv.isDeletedAnnotationElement(e)&&this.#iv.removeDeletedAnnotationElement(t)}detach(t){this.#ip.delete(t.id),this.#D?.removePointerInTextLayer(t.contentDiv),!this.#ib&&t.annotationElementId&&this.#iv.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#iv.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#im||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#iv.addDeletedAnnotationElement(t.annotationElementId),r.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.#iv.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#iv.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.#D?.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.#iv.getId()}get #iw(){return m.#iy.get(this.#iv.getMode())}#ix(t){let e=this.#iw;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#iw?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#iv.updateToolbar(t),this.#iv.updateMode(t);let{offsetX:i,offsetY:s}
2=this.#iT(),r=this.getNextId(),a=this.#ix({parent:this,id:r,x:i,y:s,uiManager:this.#iv,isCentered:!0,...e});a&&this.add(a)}deserialize(t){return m.#iy.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#iv)||null}createAndAddNewEditor(t,e,i={}){let s=this.getNextId(),r=this.#ix({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:this.#iv,isCentered:e,...i});return r&&this.add(r),r}#iT(){let{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),r=Math.min(window.innerWidth,t+i),a=Math.min(window.innerHeight,e+s),n=(Math.max(0,t)+r)/2-t,o=(Math.max(0,e)+a)/2-e,[l,h]=this.viewport.rotation%180==0?[n,o]:[o,n];return{offsetX:l,offsetY:h}}addNewEditor(){this.createAndAddNewEditor(this.#iT(),!0)}setSelected(t){this.#iv.setSelected(t)}toggleSelected(t){this.#iv.toggleSelected(t)}isSelected(t){return this.#iv.isSelected(t)}unselect(t){this.#iv.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.#iv.getMode()===s.AnnotationEditorType.STAMP){this.#iv.unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if(this.#iv.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.#iv.getActive();this.#io=!i||i.isEmpty()}findNewParent(t,e,i){let s=this.#iv.findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){for(let t of(this.#iv.getActive()?.parent===this&&(this.#iv.commitOrRemove(),this.#iv.setActiveEditor(null)),this.#iu&&(clearTimeout(this.#iu),this.#iu=null),this.#ip.values()))this.#D?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#ip.clear(),this.#iv.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.#iv.getEditors(this.pageIndex)))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#iv.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.#iv.viewParameters.realScale}}},259:(t,e,i)=>{i.d(e,{ColorPicker:()=>n});var s=i(292),r=i(830),a=i(419);class n{#n=this.#o.bind(this);#iS=this.#iC.bind(this);#iM=null;#iP=null;#iR;#iL=null;#ik=!1;#iI=!1;#iD=null;#iF;#iv=null;#iO;static get _keyboardManager(){return(0,s.shadow)(this,"_keyboardManager",new r.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.#iI=!1,this.#iO=s.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.#iD=t):(this.#iI=!0,this.#iO=s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR),this.#iv=t?._uiManager||e,this.#iF=this.#iv._eventBus,this.#iR=t?.color||this.#iv?.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.#iL=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",a.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.#iv.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 r=document.createElement("span");s.append(r),r.className="swatch",r.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){this.#iN(t);return}let e=t.target.getAttribute("data-color");e&&this.#iH(e,t)}_moveToNext(t){if(!this.#iU){this.#iN(t);return}if(t.target===this.#iM){this.#iL.firstChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===this.#iL?.firstChild||t.target===this.#iM){this.#iU&&this._hideDropdownFromKeyboard();return}this.#iU||this.#iN(t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#iU){this.#iN(t);return}this.#iL.firstChild?.focus()}_moveToEnd(t){if(!this.#iU){this.#iN(t);return}this.#iL.lastChild?.focus()}#o(t){n._keyboardManager.exec(this,t)}#iN(t){if(this.#iU){this.hideDropdown();return}if(this.#ik=0===t.detail,window.addEventListener("pointerdown",this.#iS),this.#iL){this.#iL.classList.remove("hidden");return}let e=this.#iL=this.#iB();this.#iM.append(e)}#iC(t){this.#iL?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#iL?.classList.add("hidden"),window.removeEventListener("pointerdown",this.#iS)}get #iU(){return this.#iL&&!this.#iL.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#iI){if(!this.#iU){this.#iD?.unselect();return}this.hideDropdown(),this.#iM.focus({preventScroll:!0,focusVisible:this.#ik})}}updateColor(t){if(this.#iP&&(this.#iP.style.backgroundColor=t),!this.#iL)return;let e=this.#iv.highlightColors.values();for(let i of this.#iL.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#iM?.remove(),this.#iM=null,this.#iP=null,this.#iL?.remove(),this.#iL=null}}},310:(t,e,i)=>{i.d(e,{AnnotationEditor:()=>l});var s=i(830),r=i(292),a=i(419);class n{#iz="";#i$=!1;#ij=null;#iG=null;#iV=null;#iq=!1;#iD=null;static _l10nPromise=null;constructor(t){this.#iD=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",a.noContextMenu),t.addEventListener("pointerdown",t=>t.stopPropagation());let i=t=>{t.preventDefault(),this.#iD._uiManager.editAltText(this.#iD)};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.#iD.id}`;t.setAttribute("aria-describedby",i),t.addEventListener("mouseenter",()=>{this.#iV=setTimeout(()=>{this.#iV=null,this.#iG.classList.add("show"),this.#iD._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.#iD.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;#i4=!1;#i6=!1;#i9=!1;#i8=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,r.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,r.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;let{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:n}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[a,n];let[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,r.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,r.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.#sr(),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[r,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/r,this.y=(e+s)/a,this.fixAndSetPosition()}#sa([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this.fixAndSetPosition()}translate(t,e){this.#sa(this.parentDimensions,t,e)}translateInPage(t,e){this.#i5||=[this.x,this.y],this.#sa(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:r,y:a}=this,[n,o]=this.getBaseTranslation();r+=n,a+=o,this.div.style.left=`${(100*r).toFixed(2)}%`,this.div.style.top=`${(100*a).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,r=i/e;switch(this.rotation){case 90:return[-s,r];case 180:return[s,r];case 270:return[s,-r];default:return[-s,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let[e,i]=this.pageDimensions,{x:s,y:r,width:a,height:n}=this;if(a*=e,n*=i,s*=e,r*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-a,s)),r=Math.max(0,Math.min(i-n,r));break;case 90:s=Math.max(0,Math.min(e-n,s)),r=Math.min(i,Math.max(a,r));break;case 180:s=Math.min(e,Math.max(a,s)),r=Math.min(i,Math.max(n,r));break;case 270:s=Math.min(e,Math.max(n,s)),r=Math.max(0,Math.min(i-a,r))}this.x=s/=e,this.y=r/=i;let[o,l]=this.getBaseTranslation();s+=o,r+=l;let{style:h}=this.div;h.left=`${(100*s).toFixed(2)}%`,h.top=`${(100*r).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,a=i*t;return r.FeatureTest.isCSSRoundSupported?[Math.round(s),Math.round(a)]:[s,a]}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("%"),r=!this.#iY&&e.endsWith("%");if(s&&r)return;let[a,n]=this.parentDimensions;s||(t.width=`${(100*parseFloat(i)/a).toFixed(2)}%`),this.#iY||r||(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",a.noContextMenu),e.tabIndex=-1}this.div.prepend(this.#iJ)}}#sh(t,e){e.preventDefault();let{isMac:i}=r.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",a.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",a.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 r=this.x,a=this.y,n=this.width,o=this.height;(r!==t||a!==e||n!==i||o!==s)&&this.addCommands({cmd:()=>{this.width=n,this.height=o,this.x=r,this.y=a;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[r,a]=this.parentDimensions;this.setDims(r*i,a*s),this.fixAndSetPosition()},mustExec:!0})}#sd(t,e){let i,s,r,a;let[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],A=this.#so(360-this.rotation),v=!1,y=!1;switch(t){case"topLeft":v=!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":v=!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":v=!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":v=!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]=(r=M/n,a=P/o,[A[0]*r+A[2]*a,A[1]*r+A[3]*a]),v){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),L=m(u*C);w=b(...s(R,L));let k=x-w[0],I=T-w[1];this.width=R,this.height=L,this.x=k,this.y=I,this.setDims(n*R,o*L),this.fixAndSetPosition()}altTextFinish(){this.#iz?.finish()}async addEditToolbar(){return this.#i1||this.#i6||(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,r]=this.getInitialTranslation();return this.translate(i,r),(0,s.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=r.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e){t.preventDefault();return}if(this.#i3=!0,this._isDraggable){this.#su(t);return}this.#sp(t)}#sp(t){let{isMac:e}=r.FeatureTest.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#su(t){let e,i;let 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,r]=this.screenToPageTranslation(e-this.#i7,i-this.#st);this.#i7=e,this.#st=i,this._uiManager.dragSelectedEditors(s,r)},window.addEventListener("pointermove",i,e));let r=()=>{window.removeEventListener("pointerup",r),window.removeEventListener("blur",r),s&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",i,e)),this.#i3=!1,this._uiManager.endDragSession()||this.#sp(t)};window.addEventListener("pointerup",r),window.addEventListener("blur",r)}moveInDOM(){this.#i8&&clearTimeout(this.#i8),this.#i8=setTimeout(()=>{this.#i8=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,[r,a]=this.pageDimensions,[n,o]=this.pageTranslation,l=t/s,h=e/s,d=this.x*r,c=this.y*a,u=this.width*r,p=this.height*a;switch(i){case 0:return[d+l+n,a-c-h-p+o,d+l+u+n,a-c-h+o];case 90:return[d+h+n,a-c+l+o,d+h+p+n,a-c+l+u+o];case 180:return[d-l-u+n,a-c+h+o,d-l+n,a-c+h+p+o];case 270:return[d-h-p+n,a-c-l-u+o,d-h+n,a-c-l+o];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,s,r,a]=t,n=r-i,o=a-s;switch(this.rotation){case 0:return[i,e-a,n,o];case 90:return[i,e-s,o,n];case 180:return[r,e-s,n,o];case 270:return[r,e-a,o,n];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#i6=!0}disableEditMode(){this.#i6=!1}
2isInEditMode(){return this.#i6}shouldGetKeyboardEvents(){return this.#i9}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,r.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[r,a]=s.pageDimensions,[n,o,l,h]=s.getRectInCurrentCoords(t.rect,a);return s.x=n/r,s.y=o/a,s.width=l/r,s.height=h/a,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.#i8&&(clearTimeout(this.#i8),this.#i8=null),this.#sr(),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 r=(360-this.rotation+this.parentRotation)%360/90*(this.#iK.length/4);if(r!==s){if(r<s)for(let t=0;t<s-r;t++)this.#iJ.append(this.#iJ.firstChild);else if(r>s)for(let t=0;t<r-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.#i9=!0,this.#iJ.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#sg(t){l._resizerKeyboardManager.exec(this,t)}#sm(t){this.#i9&&t.relatedTarget?.parentNode!==this.#iJ&&this.#sr()}#sf(t){this.#i2=this.#i9?t:""}#sb(t){if(this.#iK)for(let e of this.#iK)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#i9&&this.#sd(this.#i2,{movementX:t,movementY:e})}#sr(){if(this.#i9=!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.#sr(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#i1){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#i1?.show()});return}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.#i4}set isEditing(t){this.#i4=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}})}
2show(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;"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:()=>r});var s=i(292);class r{#sA;#sv=[];#sy=[];constructor(t,e=0,i=0,s=!0){let r=1/0,a=-1/0,n=1/0,o=-1/0;for(let{x:i,y:s,width:l,height:h}of t){let 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.#sv.push(p,g),r=Math.min(r,t),a=Math.max(a,d),n=Math.min(n,c),o=Math.max(o,u)}let l=a-r+2*i,h=o-n+2*i,d=r-i,c=n-i,u=this.#sv.at(s?-1:-2),p=[u[0],u[2]];for(let t of this.#sv){let[e,i,s]=t;t[0]=(e-d)/l,t[1]=(i-c)/h,t[2]=(s-c)/h}this.#sA={x:d,y:c,width:l,height:h,lastPoint:p}}getOutlines(){this.#sv.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of this.#sv)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;let i=[],s=new Set;for(let e of t){let[t,s,r]=e;i.push([t,s,e],[t,r,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],r=i[t+1][2];e.push(r),r.push(e),s.add(e),s.add(r)}let r=[];for(;s.size>0;){let t=s.values().next().value,[i,a,n,o,l]=t;s.delete(t);let h=i,d=a;for(e=[i,n],r.push(e);;){let t;if(s.has(o))t=o;else if(s.has(l))t=l;else break;s.delete(t),[i,a,n,o,l]=t,h!==i&&(e.push(h,d,i,d===a?a:n),h=i),d=d===a?n:a}e.push(h,d)}return new n(r,this.#sA)}#sT(t){let e=this.#sy,i=0,s=e.length-1;for(;i<=s;){let r=i+s>>1,a=e[r][0];if(a===t)return r;a<t?i=r+1:s=r-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,r]=this.#sy[s];if(i!==t)break;if(i===t&&r===e){this.#sy.splice(s,1);return}}for(let s=i-1;s>=0;s--){let[i,r]=this.#sy[s];if(i!==t)break;if(i===t&&r===e){this.#sy.splice(s,1);return}}}#s_(t){let[e,i,s]=t,r=[[e,i,s]],a=this.#sT(s);for(let t=0;t<a;t++){let[i,s]=this.#sy[t];for(let t=0,a=r.length;t<a;t++){let[,n,o]=r[t];if(!(s<=n)&&!(o<=i)){if(n>=i){if(o>s)r[t][1]=s;else{if(1===a)return[];r.splice(t,1),t--,a--}continue}r[t][2]=i,o>s&&r.push([e,s,o])}}}return r}}class a{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 a{#sA;#sS;constructor(t,e){super(),this.#sS=t,this.#sA=e}toSVGPath(){let t=[];for(let e of this.#sS){let[i,s]=e;t.push(`M${i} ${s}`);for(let r=2;r<e.length;r+=2){let a=e[r],n=e[r+1];a===i?(t.push(`V${n}`),s=n):n===s&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize([t,e,i,s],r){let a=[],n=i-t,o=s-e;for(let e of this.#sS){let i=Array(e.length);for(let r=0;r<e.length;r+=2)i[r]=t+e[r]*n,i[r+1]=s-e[r+1]*o;a.push(i)}return a}get box(){return this.#sA}}class o{#sA;#sC=[];#sM;#sP;#sR=[];#sL=new Float64Array(18);#sk;#sI;#sD;#sF;#sO;#t7;#sN=[];static #sB=8;static #sH=2;static #sU=o.#sB+o.#sH;constructor({x:t,y:e},i,s,r,a,n=0){this.#sA=i,this.#t7=r*s,this.#sP=a,this.#sL.set([NaN,NaN,NaN,NaN,t,e],6),this.#sM=n,this.#sF=o.#sB*s,this.#sD=o.#sU*s,this.#sO=s,this.#sN.push(t,e)}get free(){return!0}isEmpty(){return isNaN(this.#sL[8])}#sz(){let t=this.#sL.subarray(4,6),e=this.#sL.subarray(16,18),[i,s,r,a]=this.#sA;return[(this.#sk+(t[0]-e[0])/2-i)/r,(this.#sI+(t[1]-e[1])/2-s)/a,(this.#sk+(e[0]-t[0])/2-i)/r,(this.#sI+(e[1]-t[1])/2-s)/a]}add({x:t,y:e}){this.#sk=t,this.#sI=e;let[i,s,r,a]=this.#sA,[n,o,l,h]=this.#sL.subarray(8,12),d=t-l,c=e-h,u=Math.hypot(d,c);if(u<this.#sD)return!1;let p=u-this.#sF,g=p/u,m=g*d,f=g*c,b=n,A=o;n=l,o=h,l+=m,h+=f,this.#sN?.push(t,e);let v=-f/p*this.#t7,y=m/p*this.#t7;return(this.#sL.set(this.#sL.subarray(2,8),0),this.#sL.set([l+v,h+y],4),this.#sL.set(this.#sL.subarray(14,18),12),this.#sL.set([l-v,h-y],16),isNaN(this.#sL[6]))?(0===this.#sR.length&&(this.#sL.set([n+v,o+y],2),this.#s
2R.push(NaN,NaN,NaN,NaN,(n+v-i)/r,(o+y-s)/a),this.#sL.set([n-v,o-y],14),this.#sC.push(NaN,NaN,NaN,NaN,(n-v-i)/r,(o-y-s)/a)),this.#sL.set([b,A,n,o,l,h],6),!this.isEmpty()):((this.#sL.set([b,A,n,o,l,h],6),Math.abs(Math.atan2(A-o,b-n)-Math.atan2(f,m))<Math.PI/2)?([n,o,l,h]=this.#sL.subarray(2,6),this.#sR.push(NaN,NaN,NaN,NaN,((n+l)/2-i)/r,((o+h)/2-s)/a),[n,o,b,A]=this.#sL.subarray(14,18),this.#sC.push(NaN,NaN,NaN,NaN,((b+n)/2-i)/r,((A+o)/2-s)/a)):([b,A,n,o,l,h]=this.#sL.subarray(0,6),this.#sR.push(((b+5*n)/6-i)/r,((A+5*o)/6-s)/a,((5*n+l)/6-i)/r,((5*o+h)/6-s)/a,((n+l)/2-i)/r,((o+h)/2-s)/a),[l,h,n,o,b,A]=this.#sL.subarray(12,18),this.#sC.push(((b+5*n)/6-i)/r,((A+5*o)/6-s)/a,((5*n+l)/6-i)/r,((5*o+h)/6-s)/a,((n+l)/2-i)/r,((o+h)/2-s)/a)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=this.#sR,e=this.#sC,i=this.#sL.subarray(4,6),s=this.#sL.subarray(16,18),[r,a,n,o]=this.#sA,[l,h,d,c]=this.#sz();if(isNaN(this.#sL[6])&&!this.isEmpty())return`M${(this.#sL[2]-r)/n} ${(this.#sL[3]-a)/o} L${(this.#sL[4]-r)/n} ${(this.#sL[5]-a)/o} L${l} ${h} L${d} ${c} L${(this.#sL[16]-r)/n} ${(this.#sL[17]-a)/o} L${(this.#sL[14]-r)/n} ${(this.#sL[15]-a)/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]-r)/n} ${(i[1]-a)/o} L${l} ${h} L${d} ${c} L${(s[0]-r)/n} ${(s[1]-a)/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.#sL,s=i.subarray(4,6),r=i.subarray(16,18),[a,n,o,h]=this.#sA,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]-a)/o,d[t+1]=(this.#sN[t+1]-n)/h;d[d.length-2]=(this.#sk-a)/o,d[d.length-1]=(this.#sI-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]-a)/o,(i[3]-n)/h,NaN,NaN,NaN,NaN,(i[4]-a)/o,(i[5]-n)/h,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(i[16]-a)/o,(i[17]-n)/h,NaN,NaN,NaN,NaN,(i[14]-a)/o,(i[15]-n)/h],0),new l(t,d,this.#sA,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]-a)/o,(s[1]-n)/h,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(r[0]-a)/o,(r[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.#sA,this.#sO,this.#sM,this.#sP)}}class l extends a{#sA;#s$=null;#sM;#sP;#sN;#sO;#sj;constructor(t,e,i,s,r,a){super(),this.#sj=t,this.#sN=e,this.#sA=i,this.#sO=s,this.#sM=r,this.#sP=a,this.#sG(a);let{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],r){let a,n;let o=i-t,l=s-e;switch(r){case 0:a=this.#sV(this.#sj,t,s,o,-l),n=this.#sV(this.#sN,t,s,o,-l);break;case 90:a=this.#sq(this.#sj,t,e,o,l),n=this.#sq(this.#sN,t,e,o,l);break;case 180:a=this.#sV(this.#sj,i,e,-o,l),n=this.#sV(this.#sN,i,e,-o,l);break;case 270:a=this.#sq(this.#sj,i,s,-o,-l),n=this.#sq(this.#sN,i,s,-o,-l)}return{outline:Array.from(a),points:[Array.from(n)]}}#sV(t,e,i,s,r){let a=new Float64Array(t.length);for(let n=0,o=t.length;n<o;n+=2)a[n]=e+t[n]*s,a[n+1]=i+t[n+1]*r;return a}#sq(t,e,i,s,r){let a=new Float64Array(t.length);for(let n=0,o=t.length;n<o;n+=2)a[n]=e+t[n+1]*s,a[n+1]=i+t[n]*r;return a}#sG(t){let e=this.#sj,i=e[4],r=e[5],a=i,n=r,o=i,l=r,h=i,d=r,c=t?Math.max:Math.min;for(let t=6,u=e.length;t<u;t+=6){if(isNaN(e[t]))a=Math.min(a,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,r,...e.slice(t,t+6));a=Math.min(a,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],r=e[t+5]}let u=a-this.#sM,p=n-this.#sM,g=o-a+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:r,height:a}=this.#s$,[n,l,h,d]=this.#sA,c=r*h,u=a*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.#sA,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:()=>r,HighlightToolbar:()=>a});var s=i(419);class r{#sW=null;#tY=null;#iD;#sK=null;constructor(t){this.#iD=t}render(){let t=this.#sW=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",r.#iC);let e=this.#sK=document.createElement("div");e.className="buttons",t.append(e);let i=this.#iD.toolbarPosition;if(i){let{style:e}=t,s="ltr"===this.#iD._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.#iD._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#sJ(t){this.#iD._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.#iD.editorType}-button`),this.#sQ(t),t.addEventListener("click",t=>{this.#iD._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 a{#sK=null;#sW=null;#iv;constructor(t){this.#iv=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 r of t){let t=r.y+r.height;if(t<i)continue;let a=r.x+(e?r.width:0);if(t>i){s=a,i=t;continue}e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]}show(t,e,i){let[s,r]=this.#s2(e,i),{style:a}=this.#sW||=this.#s0();t.append(this.#sW),a.insetInlineEnd=`${100*s}%`,a.top=`calc(${100*r}% + 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.#iv.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),r=i(419),a=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;constructor(){}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,r.fetchData)(e,"blob")):t=i.file=e,"image/svg+xml"===t.type){let e=h._isSVGFittingCanvas,s=new FileReader,r=new Image,a=new Promise((t,a)=>{r.onload=()=>{i.bitmap=r,i.isSvg=!0,t()},s.onload=async()=>{let t=i.svgUrl=s.result;r.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},r.onerror=s.onerror=a});s.readAsDataURL(t),await a}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:r}=t;return this.#s5(`${e}_${i}_${s}_${r}`,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{#s4=[];#s6=!1;#s9;#s8=-1;constructor(t=128){this.#s9=t}add({cmd:t,undo:e,post:i,mustExec:s,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:n=!1}){if(s&&t(),this.#s6)return;let o={cmd:t,undo:e,post:i,type:r};if(-1===this.#s8){this.#s4.length>0&&(this.#s4.length=0),this.#s8=0,this.#s4.push(o);return}if(a&&this.#s4[this.#s8].type===r){n&&(o.undo=this.#s4[this.#s8].undo),this.#s4[this.#s8]=o;return}let l=this.#s8+1;l===this.#s9?this.#s4.splice(0,1):(this.#s8=l,l<this.#s4.length&&this.#s4.splice(l)),this.#s4.push(o)}undo(){if(-1===this.#s8)return;this.#s6=!0;let{undo:t,post:e}=this.#s4[this.#s8];t(),e?.(),this.#s6=!1,this.#s8-=1}redo(){if(this.#s8<this.#s4.length-1){this.#s8+=1,this.#s6=!0;let{cmd:t,post:e}=this.#s4[this.#s8];t(),e?.(),this.#s6=!1}}hasSomethingToUndo(){return -1!==this.#s8}hasSomethingToRedo(){return this.#s8<this.#s4.length-1}destroy(){this.#s4=null}}class c{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=s.FeatureTest.platform;for(let[i,s,r={}]of t)for(let t of i){let i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:r}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:r}),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:r=!1,args:a=[],checker:n=null}}=i;(!n||n(t,e))&&(s.bind(t,...a,e)(),r||(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,r.getColorValues)(t),(0,s.shadow)(this,"_colors",t)}convert(t){let e=(0,r.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{#rt=null;#re=new Map;#ri=new Map;#rs=null;#rr=null;#ra=null;#rn=new d;#ro=0;#rl=new Set;#rh=null;#iy=null;#rd=new Set;#rc=!1;#ru=null;#rp=null;#rg=null;#rm=!1;#rf=null;#rb=new l;#rA=!1;#rv=!1;
2#ry=null;#r_=null;#rE=null;#rw=s.AnnotationEditorType.NONE;#rx=new Set;#rT=null;#rS=null;#rC=null;#rM=this.blur.bind(this);#rP=this.focus.bind(this);#rR=this.copy.bind(this);#rL=this.cut.bind(this);#rk=this.paste.bind(this);#t3=this.keydown.bind(this);#rI=this.keyup.bind(this);#rD=this.onEditingAction.bind(this);#rF=this.onPageChanging.bind(this);#rO=this.onScaleChanging.bind(this);#rN=this.#rB.bind(this);#rH=this.onRotationChanging.bind(this);#rU={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#rz=[0,0];#r$=null;#m=null;#rj=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})=>{if(e instanceof HTMLInputElement){let{type:t}=e;return"text"!==t&&"number"!==t}return!0},r=this.TRANSLATE_SMALL,a=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:[-r,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}]]))}constructor(t,e,i,s,a,n,o,l,h){this.#m=t,this.#rj=e,this.#rs=i,this._eventBus=s,this._eventBus._on("editingaction",this.#rD),this._eventBus._on("pagechanging",this.#rF),this._eventBus._on("scalechanging",this.#rO),this._eventBus._on("rotationchanging",this.#rH),this.#rG(),this.#rV(),this.#rr=a.annotationStorage,this.#ru=a.filterFactory,this.#rS=n,this.#rg=o||null,this.#rc=l,this.#rE=h||null,this.viewParameters={realScale:r.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){for(let t of(this.#rq(),this.#rW(),this._eventBus._off("editingaction",this.#rD),this._eventBus._off("pagechanging",this.#rF),this._eventBus._off("scalechanging",this.#rO),this._eventBus._off("rotationchanging",this.#rH),this.#ri.values()))t.destroy();this.#ri.clear(),this.#re.clear(),this.#rd.clear(),this.#rt=null,this.#rx.clear(),this.#rn.destroy(),this.#rs?.destroy(),this.#rf?.hide(),this.#rf=null,this.#rp&&(clearTimeout(this.#rp),this.#rp=null),this.#r$&&(clearTimeout(this.#r$),this.#r$=null),this.#rK()}async mlGuess(t){return this.#rE?.guess(t)||null}get hasMLManager(){return!!this.#rE}get hcmFilter(){return(0,s.shadow)(this,"hcmFilter",this.#rS?this.#ru.addHCMFilter(this.#rS.foreground,this.#rS.background):"none")}get direction(){return(0,s.shadow)(this,"direction",getComputedStyle(this.#m).direction)}get highlightColors(){return(0,s.shadow)(this,"highlightColors",this.#rg?new Map(this.#rg.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.#r_=t}editAltText(t){this.#rs?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#ro=t-1}focusMainContainer(){this.#m.focus()}findParent(t,e){for(let i of this.#ri.values()){let{x:s,y:r,width:a,height:n}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=r&&e<=r+n)return i}return null}disableUserSelect(t=!1){this.#rj.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#rd.add(t)}removeShouldRescale(t){this.#rd.delete(t)}onScaleChanging({scale:t}){for(let e of(this.commitOrRemove(),this.viewParameters.realScale=t*r.PixelsPerInch.PDF_TO_CSS_UNITS,this.#rd))e.onScaleChanging()}
2onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#rX({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:r,focusNode:a,focusOffset:n}=e,o=e.toString(),l=this.#rX(e).closest(".textLayer"),h=this.getSelectionBoxes(l);if(h){for(let d of(e.empty(),this.#rw===s.AnnotationEditorType.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:s.AnnotationEditorType.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0)),this.#ri.values()))if(d.hasTextLayer(l)){d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:r,focusNode:a,focusOffset:n,text:o});break}}}#rY(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=this.#rX(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#rf||=new a.HighlightToolbar(this),this.#rf.show(e,i,"ltr"===this.direction))}addToAnnotationStorage(t){t.isEmpty()||!this.#rr||this.#rr.has(t.id)||this.#rr.setValue(t.id,t)}#rB(){let t=document.getSelection();if(!t||t.isCollapsed){this.#rT&&(this.#rf?.hide(),this.#rT=null,this.#rJ({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e!==this.#rT){if(!this.#rX(t).closest(".textLayer")){this.#rT&&(this.#rf?.hide(),this.#rT=null,this.#rJ({hasSelectedText:!1}));return}if(this.#rf?.hide(),this.#rT=e,this.#rJ({hasSelectedText:!0}),(this.#rw===s.AnnotationEditorType.HIGHLIGHT||this.#rw===s.AnnotationEditorType.NONE)&&(this.#rw===s.AnnotationEditorType.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#rm=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.#rQ("main_toolbar"))};window.addEventListener("pointerup",t),window.addEventListener("blur",t)}}}#rQ(t=""){this.#rw===s.AnnotationEditorType.HIGHLIGHT?this.highlightSelection(t):this.#rc&&this.#rY()}#rG(){document.addEventListener("selectionchange",this.#rN)}#rK(){document.removeEventListener("selectionchange",this.#rN)}#rZ(){window.addEventListener("focus",this.#rP),window.addEventListener("blur",this.#rM)}#rW(){window.removeEventListener("focus",this.#rP),window.removeEventListener("blur",this.#rM)}blur(){if(this.isShiftKeyDown=!1,this.#rm&&(this.#rm=!1,this.#rQ("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#rx)if(e.div.contains(t)){this.#ry=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#ry)return;let[t,e]=this.#ry;this.#ry=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0}),e.focus()}#rV(){window.addEventListener("keydown",this.#t3),window.addEventListener("keyup",this.#rI)}#rq(){window.removeEventListener("keydown",this.#t3),window.removeEventListener("keyup",this.#rI)}#r0(){document.addEventListener("copy",this.#rR),document.addEventListener("cut",this.#rL),document.addEventListener("paste",this.#rk)}#r1(){document.removeEventListener("copy",this.#rR),document.removeEventListener("cut",this.#rL),document.removeEventListener("paste",this.#rk)}addEditListeners(){this.#rV(),this.#r0()}removeEditListeners(){this.#rq(),this.#r1()}copy(t){if(t.preventDefault(),this.#rt?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let t of this.#rx){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)){e.paste(t,this.currentLayer);return}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 r=this.currentLayer;try{let t=[];for(let e of i){let i=r.deserialize(e);if(!i)return;t.push(i)}this.addCommands({cmd:()=>{for(let e of t)this.#r2(e);this.#r3(t)},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.#rw===s.AnnotationEditorType.NONE||this.isEditorHandlingKeyboard||p._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#rm&&(this.#rm=!1,this.#rQ("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#rJ(t){Object.entries(t).some(([t,e])=>this.#rU[t]!==e)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#rU,t)}),this.#rw===s.AnnotationEditorType.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#r5([[s.AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))}#r5(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#rZ(),this.#r0(),this.#rJ({isEditing:this.#rw!==s.AnnotationEditorType.NONE,isEmpty:this.#r4(),hasSomethingToUndo:this.#rn.hasSomethingToUndo(),hasSomethingToRedo:this.#rn.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#rW(),this.#r1(),this.#rJ({isEditing:!1}),this.disableUserSelect(!1))}
2registerEditorTypes(t){if(!this.#iy)for(let e of(this.#iy=t,this.#iy))this.#r5(e.defaultPropertiesToUpdate)}getId(){return this.#rb.id}get currentLayer(){return this.#ri.get(this.#ro)}getLayer(t){return this.#ri.get(t)}get currentPageIndex(){return this.#ro}addLayer(t){this.#ri.set(t.pageIndex,t),this.#rA?t.enable():t.disable()}removeLayer(t){this.#ri.delete(t.pageIndex)}updateMode(t,e=null,i=!1){if(this.#rw!==t){if(this.#rw=t,t===s.AnnotationEditorType.NONE){this.setEditingState(!1),this.#r6();return}for(let e of(this.setEditingState(!0),this.#r9(),this.unselectAll(),this.#ri.values()))e.updateMode(t);if(!e&&i){this.addNewEditorFromKeyboard();return}if(e){for(let t of this.#re.values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#rw&&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.#r_?.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.#rC||=new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of this.#rx)i.updateParams(t,e);for(let i of this.#iy)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let i of this.#re.values())i.editorType===t&&i.show(e);(this.#rC?.get(s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#r5([[s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#rv!==t)for(let e of(this.#rv=t,this.#ri.values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}#r9(){if(!this.#rA){for(let t of(this.#rA=!0,this.#ri.values()))t.enable();for(let t of this.#re.values())t.enable()}}#r6(){if(this.unselectAll(),this.#rA){for(let t of(this.#rA=!1,this.#ri.values()))t.disable();for(let t of this.#re.values())t.disable()}}getEditors(t){let e=[];for(let i of this.#re.values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return this.#re.get(t)}addEditor(t){this.#re.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#rp&&clearTimeout(this.#rp),this.#rp=setTimeout(()=>{this.focusMainContainer(),this.#rp=null},0)),this.#re.delete(t.id),this.unselect(t),t.annotationElementId&&this.#rl.has(t.annotationElementId)||this.#rr?.remove(t.id)}addDeletedAnnotationElement(t){this.#rl.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#rl.has(t)}removeDeletedAnnotationElement(t){this.#rl.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#r2(t){let e=this.#ri.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#rt!==t&&(this.#rt=t,t&&this.#r5(t.propertiesToUpdate))}get #r8(){let t=null;for(t of this.#rx);return t}updateUI(t){this.#r8===t&&this.#r5(t.propertiesToUpdate)}toggleSelected(t){if(this.#rx.has(t)){this.#rx.delete(t),t.unselect(),this.#rJ({hasSelectedEditor:this.hasSelection});return}this.#rx.add(t),t.select(),this.#r5(t.propertiesToUpdate),this.#rJ({hasSelectedEditor:!0})}setSelected(t){for(let e of this.#rx)e!==t&&e.unselect();this.#rx.clear(),this.#rx.add(t),t.select(),this.#r5(t.propertiesToUpdate),this.#rJ({hasSelectedEditor:!0})}isSelected(t){return this.#rx.has(t)}get firstSelectedEditor(){return this.#rx.values().next().value}unselect(t){t.unselect(),this.#rx.delete(t),this.#rJ({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#rx.size}get isEnterHandled(){return 1===this.#rx.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#rn.undo(),this.#rJ({hasSomethingToUndo:this.#rn.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#r4()})}redo(){this.#rn.redo(),this.#rJ({hasSomethingToUndo:!0,hasSomethingToRedo:this.#rn.hasSomethingToRedo(),isEmpty:this.#r4()})}addCommands(t){this.#rn.add(t),this.#rJ({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#r4()})}
2#r4(){if(0===this.#re.size)return!0;if(1===this.#re.size)for(let t of this.#re.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let t=[...this.#rx];this.addCommands({cmd:()=>{for(let e of t)e.remove()},undo:()=>{for(let e of t)this.#r2(e)},mustExec:!0})}commitOrRemove(){this.#rt?.commitOrRemove()}hasSomethingToControl(){return this.#rt||this.hasSelection}#r3(t){for(let t of this.#rx)t.unselect();for(let e of(this.#rx.clear(),t))e.isEmpty()||(this.#rx.add(e),e.select());this.#rJ({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#rx)t.commit();this.#r3(this.#re.values())}unselectAll(){if((!this.#rt||(this.#rt.commitOrRemove(),this.#rw===s.AnnotationEditorType.NONE))&&this.hasSelection){for(let t of this.#rx)t.unselect();this.#rx.clear(),this.#rJ({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#rz[0]+=t,this.#rz[1]+=e;let[s,r]=this.#rz,a=[...this.#rx];for(let i of(this.#r$&&clearTimeout(this.#r$),this.#r$=setTimeout(()=>{this.#r$=null,this.#rz[0]=this.#rz[1]=0,this.addCommands({cmd:()=>{for(let t of a)this.#re.has(t.id)&&t.translateInPage(s,r)},undo:()=>{for(let t of a)this.#re.has(t.id)&&t.translateInPage(-s,-r)},mustExec:!1})},1e3),a))i.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),this.#rh=new Map,this.#rx))this.#rh.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#rh)return!1;this.disableUserSelect(!1);let t=this.#rh;this.#rh=null;let e=!1;for(let[{x:i,y:s,pageIndex:r},a]of t)a.newX=i,a.newY=s,a.newPageIndex=r,e||=i!==a.savedX||s!==a.savedY||r!==a.savedPageIndex;if(!e)return!1;let i=(t,e,i,s)=>{if(this.#re.has(t.id)){let r=this.#ri.get(s);r?t._setParentAndPosition(r,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:s,newY:r,newPageIndex:a}]of t)i(e,s,r,a)},undo:()=>{for(let[e,{savedX:s,savedY:r,savedPageIndex:a}]of t)i(e,s,r,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#rh)for(let i of this.#rh.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.#rx.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#rt===t}getActive(){return this.#rt}getMode(){return this.#rw}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:r,width:a,height:n}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,o)=>({x:(e-r)/n,y:1-(t+i-s)/a,width:o/n,height:i/a});break;case"180":e=(t,e,i,o)=>({x:1-(t+i-s)/a,y:1-(e+o-r)/n,width:i/a,height:o/n});break;case"270":e=(t,e,i,o)=>({x:1-(e+o-r)/n,y:(t-s)/a,width:o/n,height:i/a});break;default:e=(t,e,i,o)=>({x:(t-s)/a,y:(e-r)/n,width:i/a,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:r,height:a}of s.getClientRects())0!==r&&0!==a&&o.push(e(t,i,r,a))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#ra||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#ra?.delete(t)}renderAnnotationElement(t){let e=this.#ra?.get(t.data.id);if(!e)return;let i=this.#rr.getRawValue(e);i&&(this.#rw!==s.AnnotationEditorType.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}}},94:(t,e,i)=>{i.d(e,{PDFFetchStream:()=>l});var s=i(292),r=i(490);function a(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;let 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);let i=e.url;fetch(i,a(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,r.validateResponseStatus)(t.status))throw(0,r.createResponseStatusError)(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();let e=e=>t.headers.get(e),{allowRangeRequests:a,suggestedLength:n}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=n||this._contentLength,this._filename=(0,r.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;let 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}`);let o=s.url;fetch(o,a(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,r.validateResponseStatus)(t.status))throw(0,r.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:()=>a,FontLoader:()=>r});var s=i(292);class r{#r7=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.#r7.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}
2){if(!(!t||this.#r7.has(t.loadedName))){if((0,s.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:i,src:r,style:a}=t,n=new FontFace(i,r,a);this.addNativeFontFace(n);try{await n.load(),this.#r7.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){await this.loadSystemFont(t);return}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:"undefined"!=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,r;function a(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 r=t.substring(0,e),a=t.substring(e+i);return r+s+a}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=a(c,16);for(i=0,r=d.length-3;i<r;i+=4)u=u-1482184792+a(d,i)|0;i<d.length&&(u=u-1482184792+a(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}if(l.font="30px "+e,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){i();return}setTimeout(t.bind(null,e,i))}(d,()=>{m.remove(),e.complete()})}}class a{constructor(t,{disableFontFace:e=!1,ignoreErrors:i=!1,inspectFont:s=null}){for(let 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 r=[];for(let t=0,e=i.length;t<e;)switch(i[t++]){case s.FontRenderOps.BEZIER_CURVE_TO:{let[e,s,a,n,o,l]=i.slice(t,t+6);r.push(t=>t.bezierCurveTo(e,s,a,n,o,l)),t+=6}break;case s.FontRenderOps.MOVE_TO:{let[e,s]=i.slice(t,t+2);r.push(t=>t.moveTo(e,s)),t+=2}break;case s.FontRenderOps.LINE_TO:{let[e,s]=i.slice(t,t+2);r.push(t=>t.lineTo(e,s)),t+=2}break;case s.FontRenderOps.QUADRATIC_CURVE_TO:{let[e,s,a,n]=i.slice(t,t+4);r.push(t=>t.quadraticCurveTo(e,s,a,n)),t+=4}break;case s.FontRenderOps.RESTORE:r.push(t=>
2t.restore());break;case s.FontRenderOps.SAVE:r.push(t=>t.save());break;case s.FontRenderOps.SCALE:(0,s.assert)(2===r.length,"Scale command is only valid at the third position.");break;case s.FontRenderOps.TRANSFORM:{let[e,s,a,n,o,l]=i.slice(t,t+6);r.push(t=>t.transform(e,s,a,n,o,l)),t+=6}break;case s.FontRenderOps.TRANSLATE:{let[e,s]=i.slice(t,t+2);r.push(t=>t.translate(e,s)),t+=2}}return this.compiledGlyphs[e]=function(t,e){r[0](t),r[1](t),t.scale(e,-e);for(let e=2,i=r.length;e<i;e++)r[e](t)}}}},62:(t,e,i)=>{i.d(e,{Metadata:()=>r});var s=i(292);class r{#at;#ae;constructor({parsedData:t,rawData:e}){this.#at=t,this.#ae=e}getRaw(){return this.#ae}get(t){return this.#at.get(t)??null}getAll(){return(0,s.objectFromMap)(this.#at)}has(t){return this.#at.has(t)}}},457:(t,e,i)=>{i.d(e,{PDFNetworkStream:()=>n});var s=i(292),r=i(490);class a{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=this.pendingRequests[t];if(!i)return;let r=i.xhr;if(r.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==r.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===r.status&&this.isHttp){i.onError?.(r.status);return}let a=r.status||200;if(!(200===a&&206===i.expectedStatus)&&a!==i.expectedStatus){i.onError?.(r.status);return}let n=function(t){let e=t.response;return"string"!=typeof e?e:(0,s.stringToBytes)(e).buffer}(r);if(206===a){let t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:n})}else n?i.onDone({begin:0,chunk:n}):i.onError?.(r.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class n{constructor(t){this._source=t,this._manager=new a(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;let 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:a}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(i),this._isRangeSupported&&this._manager.abortRequest
2(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,r.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;let 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,r.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(this._requestId),this._close()}}},490:(t,e,i)=>{i.d(e,{createResponseStatusError:()=>o,extractFilenameFromHeader:()=>n,validateRangeRequestCapabilities:()=>a,validateResponseStatus:()=>l});var s=i(292),r=i(419);function a({getResponseHeader:t,isHttp:e,rangeChunkSize:i,disableRange:s}){let r={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(t("Content-Length"),10);if(!Number.isInteger(a)||(r.suggestedLength=a,a<=2*i||s||!e||"bytes"!==t("Accept-Ranges")))return r;let n=t("Content-Encoding")||"identity";return"identity"!==n||(r.allowRangeRequests=!0),r}function n(t){let e=t("Content-Disposition");if(e){let t=function(t){let e=!0,i=r("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;let i=[],s=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=s.exec(t));){let[,t,s,r]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[s,r]}let a=[];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))),a.push(s)}return a.join("")}(t)){let t=h(i);return n(t)}if(i=r("filename","i").exec(t)){i=i[1];let t=o(i);return t=h(t),n(t)}function r(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function a(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let r=new TextDecoder(t,{fatal:!0}),a=(0,s.stringToBytes)(i);i=r.decode(a),e=!1}catch{}}return i}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=a("utf-8",t),e&&(t=a("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 a(i,s)}function h(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,
2i,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))}),a(e,s);try{s=atob(s)}catch{}return a(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if((0,r.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 r=i(292),a=i(490);r.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,r.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;let 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){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(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 r.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();let 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){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(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);let e=e=>{if(404===e.statusCode){let t=new r.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,a.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=(0,a.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(let e in super(t),this._httpHeaders={},t.httpHeaders){let i=t.httpHeaders[e];void 0!==i&&(this._httpHeaders[e]=i)}this._httpHeaders.Range=`bytes=${e}-${i-1}`;let s=t=>{if(404===t.statusCode){let t=new r.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 r.MissingPDFException(`Missing PDF "${i}".`)),this._storedError=t,this._headersCapability.reject(t)})}}class b extends p{constructor(e,i,s){super(e);let r=decodeURIComponent(this._url.path);d.test(this._url.href)&&(r=r.replace(/^\//,"")),this._setReadableStream(t.createReadStream(r,{start:i,end:s-1}))}}s()}catch(t){s(t)}},1)},573:(t,e,i)=>{i.a(t,async(t,s)=>{try{let t,a;i.d(e,{NodeCMapReaderFactory:()=>h,NodeCanvasFactory:()=>l,NodeFilterFactory:()=>o,NodeStandardFontDataFactory:()=>d});var r=i(583);if(i(292).isNodeJS){t=await import("fs");try{a=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 r.BaseFilterFactory{}class l extends r.BaseCanvasFactory{_createCanvas(t,e){return a.createCanvas(t,e)}}class h extends r.BaseCMapReaderFactory{_fetchData(t,e){return n(t).then(t=>({cMapData:t,compressionType:e}))}}class d extends r.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),r=i(651);let a=Symbol("INTERNAL");class n{#ai=!1;#as=!1;#ar=!1;#aa=!0;constructor(t,{name:e,intent:i,usage:r}){this.#ai=!!(t&s.RenderingIntentFlag.DISPLAY),this.#as=!!(t&s.RenderingIntentFlag.PRINT),this.name=e,this.intent=i,this.usage=r}get visible(){if(this.#ar)return this.#aa;if(!this.#aa)return!1;let{print:t,view:e}=this.usage;return this.#ai?e?.viewState!=="OFF":!this.#as||t?.printState!=="OFF"}_setVisible(t,e,i=!1){t!==a&&(0,s.unreachable)("Internal method `_setVisible` called."),this.#ar=i,this.#aa=e}}class o{#an=null;#ao=new Map;#al=null;#ah=null;constructor(t,e=s.RenderingIntentFlag.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(let i of(this.name=t.name,this.creator=t.creator,this.#ah=t.order,t.groups))this.#ao.set(i.id,new n(e,i));if("OFF"===t.baseState)for(let t of this.#ao.values())t._setVisible(a,!1);for(let e of t.on)this.#ao.get(e)._setVisible(a,!0);for(let e of t.off)this.#ao.get(e)._setVisible(a,!1);this.#al=this.getHash()}#ad(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let r=1;r<e;r++){let e;let a=t[r];if(Array.isArray(a))e=this.#ad(a);else{if(!this.#ao.has(a))return(0,s.warn)(`Optional content group not found: ${a}`),!0;e=this.#ao.get(a).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.#ao.size)return!0;if(!t)return(0,s.info)("Optional content group not defined."),!0;if("OCG"===t.type)return this.#ao.has(t.id)?this.#ao.get(t.id).visible:((0,s.warn)(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#ad(t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!this.#ao.has(e)){(0,s.warn)(`Optional content group not found: ${e}`);break}if(!this.#ao.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(let e of t.ids){if(!this.#ao.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(!this.#ao.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(let e of t.ids){if(!this.#ao.has(e)){(0,s.warn)(`Optional content group not found: ${e}`);break}if(this.#ao.get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!this.#ao.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(this.#ao.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.#ao.get(t);if(!i){(0,s.warn)(`Optional content group not found: ${t}`);return}i._setVisible(a,!!e,!0),this.#an=null}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.#ao.get(e);if(t)switch(i){case"ON":t._setVisible(a,!0);break;case"OFF":t._setVisible(a,!1);break;case"Toggle":t._setVisible(a,!t.visible)}}this.#an=null}get hasInitialVisibility(){return null===this.#al||this.getHash()===this.#al}getOrder(){return this.#ao.size?this.#ah?this.#ah.slice():[...this.#ao.keys()]:null}getGroups(){return this.#ao.size>0?(0,s.objectFromMap)(this.#ao):null}getGroup(t){return this.#ao.get(t)||null}getHash(){if(null!==this.#an)return this.#an;let t=new r.MurmurHash3_64;for(let[e,i]of this.#ao)t.update(`${e}:${i.visible}`);return this.#an=t.hexdigest()}}},814:(t,e,i)=>{i.d(e,{cleanupTextLayer:()=>l,renderTextLayer:()=>c,updateTextLayer:()=>u});var s=i(292),r=i(419);let a=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:r,prevFontSize:a,prevFontFamily:n}=t,{style:o}=e,l="";if(0!==s.canvasWidth&&s.hasText){let{fontFamily:h}=o,{canvasWidth:d,fontSize:c}=s;(a!==c||n!==h)&&(r.font=`${c*i}px ${h}`,t.prevFontSize=c,t.prevFontFamily=h);let{width:u}=r.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:a,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=a||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()};let{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,r.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 r,n;let 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=a.get(t);if(e)return e;let i=o(),s=i.font;i.canvas.width=i.canvas.height=30,i.font=`30px ${t}`;let r=i.measureText(""),n=r.fontBoundingBoxAscent,l=Math.abs(r.fontBoundingBoxDescent);if(n){let e=n/(n+l);return a.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 a.set(t,e),e}return a.set(t,.8),.8}(p);0===c?(r=d[4],n=d[5]-m):(r=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*r/t._pageWidth).toFixed(2)}%`,b.top=`${(100*n/t._pageHeight).toFixed(2)}%`):(b.left=`${f}${r.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 A=!1;if(e.str.length>1)A=!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&&(A=!0)}A&&(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:r})=>{if(r){e();return}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){i.resolve();return}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:a=!0,mustRescale:n=!0}){if(a&&(0,r.setLayerDimensions)(t,{rotation:e.rotation}),n){let t=o(),r=e.scale*(globalThis.devicePixelRatio||1),a={prevFontSize:null,prevFontFamily:null,div:null,scale:r,properties:null,ctx:t};for(let t of i)a.properties=s.get(t),a.div=t,h(a)}}},585:(t,e,i)=>{i.d(e,{PDFDataTransportStream:()=>a});var s=i(292),r=i(419);class a{constructor(t,{disableRange:e=!1,disableStream:i=!1}){(0,s.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:r,initialData:a,progressiveDone:n,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=o,a?.length>0){let t=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=r,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(let a of(this._stream=t,this._done=i||!1,this._filename=(0,r.isPdfFile)(s)?s:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=a.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 #ac=null;static #au="";static get workerPort(){return this.#ac}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");this.#ac=t}static get workerSrc(){return this.#au}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");this.#au=t}}},284:(t,e,i)=>{i.d(e,{XfaLayer:()=>r});var s=i(50);class r{static setupStorage(t,e,i,s,r){let a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===r)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(a.value===i.attributes.xfaOn?t.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===r)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==a.value&&t.setAttribute("value",a.value),"print"===r)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==a.value)for(let e of(t.setAttribute("value",a.value),i.children))e.attributes.value===a.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,r=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:r})})}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:r}){let{attributes:a}=e,n=t instanceof HTMLAnchorElement;for(let[e,i]of("radio"===a.type&&(a.name=`${a.name}-${s}`),Object.entries(a)))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&&r.addLinkAttributes(t,a.href,a.newWindow),i&&a.dataId&&this.setupStorage(t,a.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,r=t.xfaHtml,a=t.intent||"display",n=document.createElement(r.name);r.attributes&&this.setAttributes({html:n,element:r,intent:a,linkService:i});let o="richText"!==a,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===r.children.length){if(r.value){let t=document.createTextNode(r.value);n.append(t),o&&s.XfaText.shouldBuildText(r.name)&&h.push(t)}return{textDivs:h}}let d=[[r,-1,n]];for(;d.length>0;){let[t,r,n]=d.at(-1);if(r+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:a,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 r=null,a=i.name;if("#text"===a)r=i.value;else{if(!s.shouldBuildText(a))return;i?.attributes?.textContent?r=i.attributes.textContent:i.value&&(r=i.value)}if(null!==r&&e.push({str:r}),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:()=>r.AbortException,AnnotationEditorLayer:()=>l.AnnotationEditorLayer,AnnotationEditorParamsType:()=>r.AnnotationEditorParamsType,AnnotationEditorType:()=>r.AnnotationEditorType,AnnotationEditorUIManager:()=>h.AnnotationEditorUIManager,AnnotationLayer:()=>d.AnnotationLayer,AnnotationMode:()=>
2r.AnnotationMode,CMapCompressionType:()=>r.CMapCompressionType,ColorPicker:()=>c.ColorPicker,DOMSVGFactory:()=>n.DOMSVGFactory,DrawLayer:()=>u.DrawLayer,FeatureTest:()=>r.FeatureTest,GlobalWorkerOptions:()=>p.GlobalWorkerOptions,ImageKind:()=>r.ImageKind,InvalidPDFException:()=>r.InvalidPDFException,MissingPDFException:()=>r.MissingPDFException,OPS:()=>r.OPS,Outliner:()=>g.Outliner,PDFDataRangeTransport:()=>a.PDFDataRangeTransport,PDFDateString:()=>n.PDFDateString,PDFWorker:()=>a.PDFWorker,PasswordResponses:()=>r.PasswordResponses,PermissionFlag:()=>r.PermissionFlag,PixelsPerInch:()=>n.PixelsPerInch,RenderingCancelledException:()=>n.RenderingCancelledException,UnexpectedResponseException:()=>r.UnexpectedResponseException,Util:()=>r.Util,VerbosityLevel:()=>r.VerbosityLevel,XfaLayer:()=>m.XfaLayer,build:()=>a.build,createValidAbsoluteUrl:()=>r.createValidAbsoluteUrl,fetchData:()=>n.fetchData,getDocument:()=>a.getDocument,getFilenameFromUrl:()=>n.getFilenameFromUrl,getPdfFilenameFromUrl:()=>n.getPdfFilenameFromUrl,getXfaPageViewport:()=>n.getXfaPageViewport,isDataScheme:()=>n.isDataScheme,isPdfFile:()=>n.isPdfFile,noContextMenu:()=>n.noContextMenu,normalizeUnicode:()=>r.normalizeUnicode,renderTextLayer:()=>o.renderTextLayer,setLayerDimensions:()=>n.setLayerDimensions,shadow:()=>r.shadow,updateTextLayer:()=>o.updateTextLayer,version:()=>a.version});var r=i(292),a=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([a]);a=(f.then?(await f)():f)[0],s()}catch(t){s(t)}})},178:(t,e,i)=>{i.d(e,{MessageHandler:()=>o});var s=i(292);let r={DATA:1,ERROR:2},a={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function n(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())}}class o{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){this.#ap(e);return}if(e.callback){let t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===r.DATA)i.resolve(e.data);else if(e.callback===r.ERROR)i.reject(n(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,a=e.sourceName;new Promise(function(t){t(s(e.data))}).then(function(s){i.postMessage({sourceName:t,targetName:a,callback:r.DATA,callbackId:e.callbackId,data:s})},function(s){i.postMessage({sourceName:t,targetName:a,callback:r.ERROR,callbackId:e.callbackId,reason:n(s)})});return}if(e.streamId){this.#ag(e);return}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++,r=Promise.withResolvers();this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(t){r.reject(t)}return r.promise}sendWithStream(t,e,i,r){let o=this.streamId++,l=this.sourceName,h=this.targetName,d=this.comObj;return new ReadableStream({start:i=>{let s=Promise.withResolvers();return this.streamControllers[o]={controller:i,startCall:s,pullCall:null,cancelCall:null,isClosed:!1}
2,d.postMessage({sourceName:l,targetName:h,action:t,streamId:o,data:e,desiredSize:i.desiredSize},r),s.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[o].pullCall=e,d.postMessage({sourceName:l,targetName:h,stream:a.PULL,streamId:o,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[o].cancelCall=e,this.streamControllers[o].isClosed=!0,d.postMessage({sourceName:l,targetName:h,stream:a.CANCEL,streamId:o,reason:n(t)}),e.promise}},i)}#ag(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,l=this,h=this.actionHandler[t.action],d={enqueue(t,s=1,n){if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=s,l>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:r,stream:a.ENQUEUE,streamId:e,chunk:t},n)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:a.CLOSE,streamId:e}),delete l.streamSinks[e])},error(t){(0,s.assert)(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:a.ERROR,streamId:e,reason:n(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[e]=d,new Promise(function(e){e(h(t.data,d))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:a.START_COMPLETE,streamId:e,success:!0})},function(t){o.postMessage({sourceName:i,targetName:r,stream:a.START_COMPLETE,streamId:e,reason:n(t)})})}#ap(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,l=this.streamControllers[e],h=this.streamSinks[e];switch(t.stream){case a.START_COMPLETE:t.success?l.startCall.resolve():l.startCall.reject(n(t.reason));break;case a.PULL_COMPLETE:t.success?l.pullCall.resolve():l.pullCall.reject(n(t.reason));break;case a.PULL:if(!h){o.postMessage({sourceName:i,targetName:r,stream:a.PULL_COMPLETE,streamId:e,success:!0});break}h.desiredSize<=0&&t.desiredSize>0&&h.sinkCapability.resolve(),h.desiredSize=t.desiredSize,new Promise(function(t){t(h.onPull?.())}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:a.PULL_COMPLETE,streamId:e,success:!0})},function(t){o.postMessage({sourceName:i,targetName:r,stream:a.PULL_COMPLETE,streamId:e,reason:n(t)})});break;case a.ENQUEUE:if((0,s.assert)(l,"enqueue should have stream controller"),l.isClosed)break;l.controller.enqueue(t.chunk);break;case a.CLOSE:if((0,s.assert)(l,"close should have stream controller"),l.isClosed)break;l.isClosed=!0,l.controller.close(),this.#am(l,e);break;case a.ERROR:(0,s.assert)(l,"error should have stream controller"),l.controller.error(n(t.reason)),this.#am(l,e);break;case a.CANCEL_COMPLETE:t.success?l.cancelCall.resolve():l.cancelCall.reject(n(t.reason)),this.#am(l,e);break;case a.CANCEL:if(!h)break;new Promise(function(e){e(h.onCancel?.(n(t.reason)))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:a.CANCEL_COMPLETE,streamId:e,success:!0})},function(t){o.postMessage({sourceName:i,targetName:r,stream:a.CANCEL_COMPLETE,streamId:e,reason:n(t)})}),h.sinkCapability.reject(n(t.reason)),h.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async #am(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?4294967295&t:3285377520,this.h2=t?4294967295&t:3285377520}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,r=t.length;s<r;s++){let r=t.charCodeAt(s);r<=255?e[i++]=r:(e[i++]=r>>>8,e[i++]=255&r)}}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,r=i-4*s,a=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=461845907*(n=(n=3432918353*(n=a[t])&4294901760|11601*n&65535)<<15|n>>>17)&4294901760|13715*n&65535,l^=n,l=l<<13|l>>>19,l=5*l+3864292196):(o=461845907*(o=(o=3432918353*(o=a[t])&4294901760|11601*o&65535)<<15|o>>>17)&4294901760|13715*o&65535,h^=o,h=h<<13|h>>>19,h=5*h+3864292196);switch(n=0,r){case 3:n^=e[4*s+2]<<16;case 2:n^=e[4*s+1]<<8;case 1:n^=e[4*s],n=461845907*(n=(n=3432918353*n&4294901760|11601*n&65535)<<15|n>>>17)&4294901760|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=3981806797*t&4294901760|36045*t&65535,e=4283543511*e&4294901760|((e<<16|t>>>16)*2950163797&4294901760)>>>16,t^=e>>>1,t=444984403*t&4294901760|60499*t&65535,e=3301882366*e&4294901760|((e<<16|t>>>16)*3120437893&4294901760)>>>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:()=>A,AnnotationEditorParamsType:()=>p,AnnotationEditorPrefix:()=>c,AnnotationEditorType:()=>u,AnnotationMode:()=>h,AnnotationPrefix:()=>J,AnnotationType:()=>b,BaseException:()=>k,CMapCompressionType:()=>y,FONT_IDENTITY_MATRIX:()=>a,FeatureTest:()=>G,FontRenderOps:()=>Q,FormatError:()=>B,IDENTITY_MATRIX:()=>r,ImageKind:()=>f,InvalidPDFException:()=>F,LINE_FACTOR:()=>o,MAX_IMAGE_SIZE_TO_CACHE:()=>n,MissingPDFException:()=>O,OPS:()=>_,PasswordException:()=>I,PasswordResponses:()=>E,PermissionFlag:()=>g,RenderingIntentFlag:()=>l,TextRenderingMode:()=>m,UnexpectedResponseException:()=>N,UnknownErrorException:()=>D,Util:()=>q,VerbosityLevel:()=>v,assert:()=>P,bytesToString:()=>U,createValidAbsoluteUrl:()=>R,getUuid:()=>Y,getVerbosityLevel:()=>T,info:()=>S,isNodeJS:()=>s,normalizeUnicode:()=>X,objectFromMap:()=>j,setVerbosityLevel:()=>x,shadow:()=>L,string32:()=>$,stringToBytes:()=>z,unreachable:()=>M,warn:()=>C});let s="object"==typeof d&&d+""=="[object process]"&&!d.versions.nw&&!(d.versions.electron&&d.type&&"browser"!==d.type),r=[1,0,0,1,0,0],a=[.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,OP
2LIST:256},h={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},A={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},v={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=v.WARNINGS;function x(t){Number.isInteger(t)&&(w=t)}function T(){return w}function S(t){w>=v.INFOS&&console.log(`Info: ${t}`)}function C(t){w>=v.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 r=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}}(r))return r}catch{}return null}function L(t,e,i,s=!1){return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}let k=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 I extends k{constructor(t,e){super(t,"PasswordException"),this.code=e}}class D extends k{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class F extends k{constructor(t){super(t,"InvalidPDFException")}}class O extends k{constructor(t){super(t,"MissingPDFException")}}class N extends k{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class B extends k{constructor(t){super(t,"FormatError")}}class H extends k{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 r=Math.min(s+8192,e),a=t.subarray(s,r);i.push(String.fromCharCode.apply(null,a))}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(){return L(this,"isLittleEndian",function(){let t=new Uint8Array(4);t[0]=1;let e=new Uint32Array(t.buffer,0,1);return 1===e[0]}())}static get isEvalSupported(){return L(this,"isEvalSupported",function(){try{return Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return L(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?L(this,"platform",{isMac:navigator.platform.includes("Mac")}):L(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return L(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,r=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i;return[s,r]}static getAxialAlignedBoundingBox(t,e){let i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),r=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],r[0],a[0]),Math.min(i[1],s[1],r[1],a[1]),Math.max(i[0],s[0],r[0],a[0]),Math.max(i[1],s[1],r[1],a[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],r=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],n=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-r*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 r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>a?null:[i,r,s,a]}static #af(t,e,i,s,r,a,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*r+3*l*a)+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 #ab(t,e,i,s,r,a,n,o,l,h,d,c){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#af(t,e,i,s,r,a,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.#af(t,e,i,s,r,a,n,o,(-h+p)/g,c),this.#af(t,e,i,s,r,a,n,o,(-h-p)/g,c)}static bezierBoundingBox(t,e,i,s,r,a,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.#ab(t,i,r,n,e,s,a,o,3*(-t+3*(i-r)+n),6*(t-2*i+r),3*(i-t),l),this.#ab(t,i,r,n,e,s,a,o,3*(-e+3*(s-a)+o),6*(e-2*s+a),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("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);if("undefined"!=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}}},u={};function p(t){var e=u[t];if(void 0!==e)return e.exports;var i=u[t]={exports:{}};return c[t](i,i.exports,p),i.exports}r="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",a="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()))},l=t=>t.map(t=>{if(null!==t&&"object"==typeof t){if(t[r])return t;if(t.then){var e=[];e.d=0,t.then(t=>{i[a]=t,o(e)},t=>{i[n]=t,o(e)});var i={};return i[r]=t=>t(e),i}}var s={};return s[r]=t=>{},s[a]=t,s}),p.a=(t,e,i)=>{i&&((s=[]).d=-1);var s,h,d,c,u=new Set,p=t.exports,g=new Promise((t,e)=>{c=e,d=t});g[a]=p,g[r]=t=>(s&&t(s),u.forEach(t),g.catch(t=>{})),t.exports=g,e(t=>{h=l(t);var e,i=()=>h.map(t=>{if(t[n])throw t[n];return t[a]}),o=new Promise(t=>{(e=()=>t(i)).r=0;var a=t=>t!==s&&!u.has(t)&&(u.add(t),t&&!t.d&&(e.r++,t.push(e)));h.map(t=>t[r](a))});return e.r?o:i()},t=>(t?c(g[n]=t):d(p),o(s))),s&&s.d<0&&(s.d=0)},p.d=(t,e)=>{for(var i in e)p.o(e,i)&&!p.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},p.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var g=p(228),m=(g=globalThis.pdfjsLib=await (globalThis.pdfjsLibPromise=g)).AbortException,f=g.AnnotationEditorLayer,b=g.AnnotationEditorParamsType,A=g.AnnotationEditorType,v=g.AnnotationEditorUIManager,y=g.AnnotationLayer,_=g.AnnotationMode,E=g.CMapCompressionType,w=g.ColorPicker,x=g.DOMSVGFactory,T=g.DrawLayer,S=g.FeatureTest,C=g.GlobalWorkerOptions,M=g.ImageKind,P=g.InvalidPDFException,R=g.MissingPDFException,L=g.OPS,k=g.Outliner,I=g.PDFDataRangeTransport,D=g.PDFDateString,F=g.PDFWorker,O=g.PasswordResponses,N=g.PermissionFlag,B=g.PixelsPerInch,H=g.RenderingCancelledException,U=g.UnexpectedResponseException,z=g.Util,$=g.VerbosityLevel,j=g.XfaLayer,G=g.build,V=g.createValidAbsoluteUrl,q=g.fetchData,W=g.getDocument,K=g.getFilenameFromUrl,X=g.getPdfFilenameFromUrl,Y=g.getXfaPageViewport,J=g.isDataScheme,Q=g.isPdfFile,Z=g.noContextMenu,tt=g.normalizeUnicode,te=g.renderTextLayer,ti=g.setLayerDimensions,ts=g.shadow,tr=g.updateTextLayer,ta=g.ver
2sion;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.