PageSourceSearch

https://simmons-simmons.de/js/pdfjs-dist.4628c348.js

js simmons-simmons.de collected 2026-10-02 23:01:23 UTC 321,757 bytes, 23 lines download raw bytes

1"use strict";(self["webpackChunkOnlinePlatformWebsite"]=self["webpackChunkOnlinePlatformWebsite"]||[]).push([[8747],{39887:function(t,e,i){i.a(t,(async function(t,s){try{i.d(e,{Cu:function(){return Y},Do:function(){return E},EA:function(){return A},Fd:function(){return B},G6:function(){return S},Gz:function(){return G},HF:function(){return K},Hw:function(){return U},J0:function(){return L},N5:function(){return l},Qh:function(){return b},SS:function(){return M},TF:function(){return x},TV:function(){return v},Tm:function(){return T},Tw:function(){return F},UU:function(){return g},YE:function(){return H},Z7:function(){return w},ZH:function(){return V},_i:function(){return P},_p:function(){return $},dU:function(){return u},dm:function(){return j},e3:function(){return o},ew:function(){return _},iX:function(){return h},j_:function(){return W},ji:function(){return I},jq:function(){return O},lJ:function(){return z},lf:function(){return k},mQ:function(){return D},nS:function(){return C},ng:function(){return p},pt:function(){return q},r7:function(){return X},rE:function(){return J},s4:function(){return c},sk:function(){return m},vP:function(){return d},wW:function(){return R},xd:function(){return f},yI:function(){return y},z7:function(){return N}});
2/**
3 * @licstart The following is the entire license notice for the
4 * JavaScript code in this page
5 *
6 * Copyright 2023 Mozilla Foundation
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 *     http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 * @licend The above is the entire license notice for the
21 * JavaScript code in this page
22 */var n={976:(t,e,i)=>{i.d(e,{AnnotationLayer:()=>z,FreeTextAnnotationElement:()=>C,InkAnnotationElement:()=>D,StampAnnotationElement:()=>H});var s=i(292),n=i(419),a=i(792);function r(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 h{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,t]}static G_HTML([t]){const e=r(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(r).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){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){const s=1-t,n=1-e,a=1-i,r=Math.min(s,n,a);return["CMYK",s,n,a,r]}}var l=i(284);const d=1e3,c=9,u=new WeakSet;function p(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class g{static create(t){const e=t.data.annotationType;switch(e){case s.AnnotationType.LINK:return new f(t);case s.AnnotationType.TEXT:return new b(t);case s.AnnotationType.WIDGET:const e=t.data.fieldType;switch(e){case"Tx":return new A(t);case"Btn":return t.data.radioButton?new _(t):t.data.checkBox?new w(t):new E(t);case"Ch":return new x(t);case"Sig":return new y(t)}return new v(t);case s.AnnotationType.POPUP:return new T(t);case s.AnnotationType.FREETEXT:return new C(t);case s.AnnotationType.LINE:return new M(t);case s.AnnotationType.SQUARE:return new P(t);case s.AnnotationType.CIRCLE:return new k(t);case s.AnnotationType.POLYLINE:return new I(t);case s.AnnotationType.CARET:return new L(t);case s.AnnotationType.INK:return new D(t);case s.AnnotationType.POLYGON:return new R(t);case s.AnnotationType.HIGHLIGHT:return new F(t);case s.AnnotationType.UNDERLINE:return new O(t);case s.AnnotationType.SQUIGGLY:return new N(t);case s.AnnotationType.STRIKEOUT:return new B(t);case s.AnnotationType.STAMP:return new H(t);case s.AnnotationType.FILEATTACHMENT:return new U(t);default:return new m(t)}}}class m{#t=!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 m._hasPopupData(this.data)}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,a=document.createElement("section");
22a.setAttribute("data-annotation-id",e.id),this instanceof v||(a.tabIndex=d),a.style.zIndex=this.parent.zIndex++,e.popupRef&&a.setAttribute("aria-haspopup","dialog"),e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate");const{pageWidth:r,pageHeight:o,pageX:h,pageY:l}=n.rawDims;if(!e.rect||this instanceof T){const{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,a),a}const{width:c,height:u}=p(e.rect),g=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]]);if(!t&&e.borderStyle.width>0){a.style.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;if(t>0||i>0){const e=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;a.style.borderRadius=e}else if(this instanceof _){const t=`calc(${c}px * var(--scale-factor)) / calc(${u}px * var(--scale-factor))`;a.style.borderRadius=t}switch(e.borderStyle.style){case s.AnnotationBorderStyleType.SOLID:a.style.borderStyle="solid";break;case s.AnnotationBorderStyleType.DASHED:a.style.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:a.style.borderBottomStyle="solid";break;default:break}const n=e.borderColor||null;n?(this.#t=!0,a.style.borderColor=s.Util.makeHexColor(0|n[0],0|n[1],0|n[2])):a.style.borderWidth=0}
22a.style.left=100*(g[0]-h)/r+"%",a.style.top=100*(g[1]-l)/o+"%";const{rotation:m}=e;return e.hasOwnCanvas||0===m?(a.style.width=100*c/r+"%",a.style.height=100*u/o+"%"):this.setRotation(m,a),a}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims,{width:n,height:a}=p(this.data.rect);let r,o;t%180===0?(r=100*n/i,o=100*a/s):(r=100*a/i,o=100*n/s),e.style.width=`${r}%`,e.style.height=`${o}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const s=i.detail[t],n=s[0],a=s.slice(1);i.target.style[e]=h[`${n}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[e]:h[`${n}_rgb`](a)})};return(0,s.shadow)(this,"_commonActions",{display:t=>{const{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=>{const{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout((()=>t.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=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const s of Object.keys(e.detail)){const n=t[s]||i[s];n?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[s,n]of Object.entries(e)){const a=i[s];if(a){const i={detail:{[s]:n},target:t};a(i),delete e[s]}}}
22_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,s,n]=this.data.rect;if(1===t.length){const[,{x:a,y:r},{x:o,y:h}]=t[0];if(s===a&&n===r&&e===o&&i===h)return}const{style:a}=this.container;let r;if(this.#t){const{borderColor:t,borderWidth:e}=a;a.borderWidth=0,r=["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="${t}" stroke-width="${e}">`],this.container.classList.add("hasBorder")}const o=s-e,h=n-i,{svgFactory:l}=this,d=l.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);const c=l.createElement("defs");d.append(c);const u=l.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),c.append(u);for(const[,{x:g,y:m},{x:f,y:b}]of t){const t=l.createElement("rect"),i=(f-e)/o,s=(n-m)/h,a=(g-f)/o,d=(m-b)/h;t.setAttribute("x",i),t.setAttribute("y",s),t.setAttribute("width",a),t.setAttribute("height",d),u.append(t),r?.push(`<rect vector-effect="non-scaling-stroke" x="${i}" y="${s}" width="${a}" height="${d}"/>`)}this.#t&&(r.push("</g></svg>')"),a.backgroundImage=r.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(){const{container:t,data:e}=this;t.setAttribute("aria-haspopup","dialog");const i=new T({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){const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:t,id:a,exportValues:r}of n){if(-1===t)continue;if(a===e)continue;const n="string"===typeof r?r:null,o=document.querySelector(`[data-element-id="${a}"]`);!o||u.has(o)?i.push({id:a,exportValue:n,domElement:o}):(0,s.warn)(`_getElementsByName - element not allowed: ${a}`)}return i}for(const s of document.getElementsByName(t)){const{exportValue:t}=s,n=s.getAttribute("data-element-id");n!==e&&(u.has(s)&&i.push({id:n,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(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})}))}}class f extends m{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{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.#e(i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(this.#i(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("linkAnnotation"),s&&this.container.append(i),this.container}#s(){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.#s()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#s()}#e(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#s()}#i(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#s()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const s of Object.keys(e.actions)){const n=i.get(s);n&&(t[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}t.onclick||(t.onclick=()=>!1),this.#s()}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#s(),!this._fieldObjects)return(0,s.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{i?.();const{fields:t,refs:n,include:a}=e,r=[];if(0!==t.length||0!==n.length){const e=new Set(n);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===a&&r.push(i)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const o=this.annotationStorage,h=[];for(const e of r){const{id:t}=e;switch(h.push(t),e.type){case"text":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(u.has(i)?i.dispatchEvent(new Event("resetform")):(0,s.warn)(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}}class b extends m{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}
22class v extends m{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&("CANVAS"===t.previousSibling?.nodeName&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return s.FeatureTest.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,(t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(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}n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(t)}})}))}_setEventListeners(t,e,i,s){for(const[n,a]of i)("Action"===a||this.data.actions?.[a])&&("Focus"!==a&&"Blur"!==a||(e||={focused:!1}),this._setEventListener(t,e,n,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){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":s.Util.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||c,a=t.style;let r;const o=2,h=t=>Math.round(10*t)/10;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]-o),e=Math.round(t/(s.LINE_FACTOR*n))||1,i=t/e;r=Math.min(n,h(i/s.LINE_FACTOR))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]-o);r=Math.min(n,h(t/s.LINE_FACTOR))}a.fontSize=`calc(${r}px * var(--scale-factor))`,a.color=s.Util.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(a.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class A extends v{constructor(t){const e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,s){const n=this.annotationStorage;
22for(const a of this._getElementsByName(t.name,t.id))a.domElement&&(a.domElement[e]=i),n.setValue(a.id,{[s]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const s=t.getValue(e,{value:this.data.fieldValue});let n=s.value||"";const a=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;a&&n.length>a&&(n=n.slice(0,a));let r=s.formattedValue||this.data.textContent?.join("\n")||null;r&&this.data.comb&&(r=r.replaceAll(/\s+/g,""));const o={userValue:n,formattedValue:r,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=r??n,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",r??n),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),u.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=d,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=>{const e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null}));let h=t=>{const{formattedValue:e}=o;null!==e&&void 0!==e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(t=>{if(o.focused)return;const{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);const s={value(i){o.userValue=i.detail.value??"",t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){const{formattedValue:s}=i.detail;o.formattedValue=s,null!==s&&void 0!==s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{const{charLimit:s}=i.detail,{target:n}=i;if(0===s)return void n.removeAttribute("maxLength");n.setAttribute("maxLength",s);let a=o.userValue;!a||a.length<=s||(a=a.slice(0,s),n.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:n.selectionStart,selEnd:n.selectionEnd}}))}};this._dispatchEventFromSandbox(s,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;const{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}}))}));const s=h;h=null,i.addEventListener("blur",(t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);const{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;const{data:i,target:s}=t,{value:n,selectionStart:a,selectionEnd:r}=s;let h=a,l=r;switch(t.inputType){case"deleteWordBackward":{const t=n.substring(0,a).match(/\w*[^\w]*$/);t&&(h-=t[0].length);break}
22case"deleteWordForward":{const t=n.substring(a).match(/^[^\w]*\w*/);t&&(l+=t[0].length);break}case"deleteContentBackward":a===r&&(h-=1);break;case"deleteContentForward":a===r&&(l+=1);break}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,change:i||"",willCommit:!1,selStart:h,selEnd:l}})})),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(h&&i.addEventListener("blur",h),this.data.comb){const t=this.data.rect[2]-this.data.rect[0],e=t/a;i.classList.add("comb"),i.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class y extends v{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class w extends v{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"===typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const n=document.createElement("input");return u.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=d,n.addEventListener("change",(s=>{const{name:n,checked:a}=s.target;for(const r of this._getElementsByName(n,i)){const i=a&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:a})})),n.addEventListener("resetform",(t=>{const i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue})),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",(e=>{const s={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}};this._dispatchEventFromSandbox(s,e)})),this._setEventListeners(n,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(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class _ extends v{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"===typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(const a of this._getElementsByName(e.fieldName,i))t.setValue(a.id,{value:!1});const n=document.createElement("input");if(u.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=d,n.addEventListener("change",(e=>{const{name:s,checked:n}=e.target;for(const a of this._getElementsByName(s,i))t.setValue(a.id,{value:!1});t.setValue(i,{value:n})})),n.addEventListener("resetform",(t=>{const i=e.defaultFieldValue;t.target.checked=null!==i&&void 0!==i&&i===e.buttonValue})),this.enableScripting&&this.hasJSActions){const s=e.buttonValue;n.addEventListener("updatefromsandbox",(e=>{const n={value:e=>{const n=s===e.detail.value;for(const s of this._getElementsByName(e.target.name)){const e=n&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}};this._dispatchEventFromSandbox(n,e)})),this._setEventListeners(n,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))}
22return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class E extends f{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",(t=>{this._dispatchEventFromSandbox({},t)}))),t}}class x extends v{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");u.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=d;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",(t=>{const e=this.data.defaultFieldValue;for(const i of s.options)i.selected=i.value===e}));for(const l of this.data.options){const t=document.createElement("option");t.textContent=l.displayValue,t.value=l.exportValue,i.value.includes(l.exportValue)&&(t.setAttribute("selected",!0),n=!1),s.append(t)}let a=null;if(n){const 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)}const r=t=>{const e=t?"value":"textContent",{options:i,multiple:n}=s;return n?Array.prototype.filter.call(i,(t=>t.selected)).map((t=>t[e])):-1===i.selectedIndex?null:i[i.selectedIndex][e]};let o=r(!1);const h=t=>{const 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=>{const n={value(i){a?.();const n=i.detail.value,h=new Set(Array.isArray(n)?n:[n]);for(const t of s.options)t.selected=h.has(t.value);t.setValue(e,{value:r(!0)}),o=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){const n=s.options,a=i.detail.remove;if(n[a].selected=!1,s.remove(a),n.length>0){const t=Array.prototype.findIndex.call(n,(t=>t.selected));-1===t&&(n[0].selected=!0)}t.setValue(e,{value:r(!0),items:h(i)}),o=r(!1)},clear(i){while(0!==s.length)s.remove(0);t.setValue(e,{value:null,items:[]}),o=r(!1)},insert(i){const{index:n,displayValue:a,exportValue:l}=i.detail.insert,d=s.children[n],c=document.createElement("option");c.textContent=a,c.value=l,d?d.before(c):s.append(c),t.setValue(e,{value:r(!0),items:h(i)}),o=r(!1)},items(i){const{items:n}=i.detail;while(0!==s.length)s.remove(0);for(const t of n){const{displayValue:e,exportValue:i}=t,n=document.createElement("option");n.textContent=e,n.value=i,s.append(n)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:h(i)}),o=r(!1)},indices(i){const s=new Set(i.detail.indices);for(const t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),o=r(!1)},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(n,i)})),s.addEventListener("input",(i=>{const s=r(!0);t.setValue(e,{value:s}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,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:r(!0)})})),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class T extends m{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:m._hasPopupData(e)}),this.elements=i}render(){this.container.classList.add("popupAnnotation");const t=new S({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(const 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}}
22class S{#n=this.#a.bind(this);#r=this.#o.bind(this);#h=this.#l.bind(this);#d=this.#c.bind(this);#u=null;#p=null;#g=null;#m=null;#f=null;#b=null;#v=null;#A=!1;#y=null;#w=null;#_=null;#E=null;#x=!1;constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:a,contentsObj:r,richText:o,parent:h,rect:l,parentRect:d,open:c}){this.#p=t,this.#E=s,this.#g=r,this.#_=o,this.#b=h,this.#u=e,this.#w=l,this.#v=d,this.#f=i,this.#m=n.PDFDateString.toDateObject(a),this.trigger=i.flatMap((t=>t.getElementsToTriggerPopup()));for(const n of this.trigger)n.addEventListener("click",this.#d),n.addEventListener("mouseenter",this.#h),n.addEventListener("mouseleave",this.#r),n.classList.add("popupTriggerArea");for(const n of i)n.container?.addEventListener("keydown",this.#n);this.#p.hidden=!0,c&&this.#c()}render(){if(this.#y)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:a}}}=this.#b,r=this.#y=document.createElement("div");if(r.className="popup",this.#u){const t=r.style.outlineColor=s.Util.makeHexColor(...this.#u);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))r.style.backgroundColor=`color-mix(in srgb, ${t} 30%, white)`;else{const t=.7;r.style.backgroundColor=s.Util.makeHexColor(...this.#u.map((e=>Math.floor(t*(255-e)+e))))}}const o=document.createElement("span");o.className="header";const h=document.createElement("h1");if(o.append(h),({dir:h.dir,str:h.textContent}=this.#E),r.append(o),this.#m){const 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.#m.toLocaleDateString(),time:this.#m.toLocaleTimeString()})),o.append(t)}const d=this.#g,c=this.#_;if(!c?.str||d?.str&&d.str!==c.str){const t=this._formatContents(d);r.append(t)}else l.XfaLayer.render({xfaHtml:c.html,intent:"richText",div:r}),r.lastChild.classList.add("richText","popupContent");let u=!!this.#v,p=u?this.#v:this.#w;for(const l of this.#f)if(!p||null!==s.Util.intersect(l.data.rect,p)){p=l.data.rect,u=!0;break}const g=s.Util.normalizeRect([p[0],t[3]-p[1]+t[1],p[2],t[3]-p[3]+t[1]]),m=5,f=u?p[2]-p[0]+m:0,b=g[0]+f,v=g[1],{style:A}=this.#p;A.left=100*(b-n)/e+"%",A.top=100*(v-a)/i+"%",this.#p.append(r)}_formatContents({str:t,dir:e}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;const s=t.split(/(?:\r\n?|\n)/);for(let n=0,a=s.length;n<a;++n){const t=s[n];i.append(document.createTextNode(t)),n<a-1&&i.append(document.createElement("br"))}return i}#a(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#A)&&this.#c()}#c(){this.#A=!this.#A,this.#A?(this.#l(),this.#p.addEventListener("click",this.#d),this.#p.addEventListener("keydown",this.#n)):(this.#o(),this.#p.removeEventListener("click",this.#d),this.#p.removeEventListener("keydown",this.#n))}#l(){this.#y||this.render(),this.isVisible?this.#A&&this.#p.classList.add("focused"):(this.#p.hidden=!1,this.#p.style.zIndex=parseInt(this.#p.style.zIndex)+1e3)}#o(){this.#p.classList.remove("focused"),!this.#A&&this.isVisible&&(this.#p.hidden=!0,this.#p.style.zIndex=parseInt(this.#p.style.zIndex)-1e3)}forceHide(){this.#x=this.isVisible,this.#x&&(this.#p.hidden=!0)}maybeShow(){this.#x&&(this.#x=!1,this.#p.hidden=!1)}get isVisible(){return!1===this.#p.hidden}}class C extends m{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){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class M extends m{#T=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:i}=p(t.rect),s=this.svgFactory.create(e,i,!0),n=this.#T=this.svgFactory.createElement("svg:line");return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#T}addHighlightArea(){this.container.classList.add("highlightArea")}}class P extends m{#S=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:i}=p(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=this.#S=this.svgFactory.createElement("svg:rect");return a.setAttribute("x",n/2),a.setAttribute("y",n/2),a.setAttribute("width",e-n),a.setAttribute("height",i-n),a.setAttribute("stroke-width",n||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.#S}addHighlightArea(){this.container.classList.add("highlightArea")}}class k extends m{#C=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:i}=p(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,a=this.#C=this.svgFactory.createElement("svg:ellipse");return a.setAttribute("cx",e/2),a.setAttribute("cy",i/2),a.setAttribute("rx",e/2-n/2),a.setAttribute("ry",i/2-n/2),a.setAttribute("stroke-width",n||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#C}addHighlightArea(){this.container.classList.add("highlightArea")}}class I extends m{#M=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const t=this.data,{width:e,height:i}=p(t.rect),s=this.svgFactory.create(e,i,!0);let n=[];for(const r of t.vertices){const e=r.x-t.rect[0],i=t.rect[3]-r.y;n.push(e+","+i)}n=n.join(" ");const a=this.#M=this.svgFactory.createElement(this.svgElementName);return a.setAttribute("points",n),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.#M}addHighlightArea(){this.container.classList.add("highlightArea")}}class R extends I{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class L extends m{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
22class D extends m{#P=[];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);const t=this.data,{width:e,height:i}=p(t.rect),s=this.svgFactory.create(e,i,!0);for(const n of t.inkLists){let e=[];for(const s of n){const i=s.x-t.rect[0],n=t.rect[3]-s.y;e.push(`${i},${n}`)}e=e.join(" ");const i=this.svgFactory.createElement(this.svgElementName);this.#P.push(i),i.setAttribute("points",e),i.setAttribute("stroke-width",t.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),!t.popupRef&&this.hasPopupData&&this._createPopup(),s.append(i)}return this.container.append(s),this.container}getElementsToTriggerPopup(){return this.#P}addHighlightArea(){this.container.classList.add("highlightArea")}}class F extends m{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 O extends m{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 N extends m{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 B extends m{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 H extends m{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 U extends m{#k=null;constructor(t){super(t,{isRenderable:!0});const{filename:e,content:i}=this.data.file;this.filename=(0,n.getFilenameFromUrl)(e,!0),this.content=i,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:e,content:i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*e.fillAlpha)}%);`)),i.addEventListener("dblclick",this.#I.bind(this)),this.#k=i;const{isMac:n}=s.FeatureTest.platform;return t.addEventListener("keydown",(t=>{"Enter"===t.key&&(n?t.metaKey:t.ctrlKey)&&this.#I()})),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return this.#k}addHighlightArea(){this.container.classList.add("highlightArea")}#I(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class z{#R=null;#L=null;#D=new Map;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,page:s,viewport:n}){this.div=t,this.#R=e,this.#L=i,this.page=s,this.viewport=n,this.zIndex=0}#F(t,e){const i=t.firstChild||t;i.id=`${s.AnnotationPrefix}${e}`,this.div.append(t),this.#R?.moveElementInDOM(this.div,t,i,!1)}async render(t){const{annotations:e}=t,i=this.div;(0,n.setLayerDimensions)(i,this.viewport);const r=new Map,o={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new n.DOMSVGFactory,annotationStorage:t.annotationStorage||new a.AnnotationStorage,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const n of e){if(n.noHTML)continue;const t=n.annotationType===s.AnnotationType.POPUP;if(t){const t=r.get(n.id);if(!t)continue;o.elements=t}else{const{width:t,height:e}=p(n.rect);if(t<=0||e<=0)continue}o.data=n;const e=g.create(o);if(!e.isRenderable)continue;if(!t&&n.popupRef){const t=r.get(n.popupRef);t?t.push(e):r.set(n.popupRef,[e])}e.annotationEditorType>0&&this.#D.set(e.data.id,e);const i=e.render();n.hidden&&(i.style.visibility="hidden"),this.#F(i,n.id)}this.#O()}update({viewport:t}){const e=this.div;this.viewport=t,(0,n.setLayerDimensions)(e,{rotation:t.rotation}),this.#O(),e.hidden=!1}#O(){if(!this.#L)return;const t=this.div;for(const[e,i]of this.#L){const s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;const{firstChild:n}=s;n?"CANVAS"===n.nodeName?n.replaceWith(i):n.before(i):s.append(i)}this.#L.clear()}getEditableAnnotations(){return Array.from(this.#D.values())}getEditableAnnotation(t){return this.#D.get(t)}}},792:(t,e,i)=>{i.d(e,{AnnotationStorage:()=>o,PrintAnnotationStorage:()=>
22h,SerializableEmpty:()=>r});var s=i(292),n=i(310),a=i(651);const r=Object.freeze({map:null,hash:"",transfer:void 0});class o{#N=!1;#B=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=this.#B.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#B.get(t)}remove(t){if(this.#B.delete(t),0===this.#B.size&&this.resetModified(),"function"===typeof this.onAnnotationEditor){for(const t of this.#B.values())if(t instanceof n.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=this.#B.get(t);let s=!1;if(void 0!==i)for(const[n,a]of Object.entries(e))i[n]!==a&&(s=!0,i[n]=a);else s=!0,this.#B.set(t,e);s&&this.#H(),e instanceof n.AnnotationEditor&&"function"===typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#B.has(t)}getAll(){return this.#B.size>0?(0,s.objectFromMap)(this.#B):null}setAll(t){for(const[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#B.size}#H(){this.#N||(this.#N=!0,"function"===typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#N&&(this.#N=!1,"function"===typeof this.onResetModified&&this.onResetModified())}get print(){return new h(this)}get serializable(){if(0===this.#B.size)return r;const t=new Map,e=new a.MurmurHash3_64,i=[],s=Object.create(null);let o=!1;for(const[a,r]of this.#B){const i=r instanceof n.AnnotationEditor?r.serialize(!1,s):r;i&&(t.set(a,i),e.update(`${a}:${JSON.stringify(i)}`),o||=!!i.bitmap)}if(o)for(const n of t.values())n.bitmap&&i.push(n.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:r}get editorStats(){let t=null;const e=new Map;for(const i of this.#B.values()){if(!(i instanceof n.AnnotationEditor))continue;const s=i.telemetryFinalData;if(!s)continue;const{type:a}=s;e.has(a)||e.set(a,Object.getPrototypeOf(i).constructor),t||=Object.create(null);const r=t[a]||=new Map;for(const[t,e]of Object.entries(s)){if("type"===t)continue;let i=r.get(t);i||(i=new Map,r.set(t,i));const s=i.get(e)??0;i.set(e,s+1)}}for(const[i,s]of e)t[i]=s.computeTelemetryFinalData(t[i]);return t}}class h extends o{#U;constructor(t){super();const{map:e,hash:i,transfer:s}=t.serializable,n=structuredClone(e,s?{transfer:s}:null);this.#U={map:n,hash:i,transfer:s}}get print(){(0,s.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#U}}},831:(t,e,i)=>{i.a(t,(async(t,s)=>{try{i.d(e,{PDFDataRangeTransport:()=>D,PDFWorker:()=>H,build:()=>W,getDocument:()=>P,version:()=>$});var n=i(292),a=i(792),r=i(419),o=i(10),h=i(573),l=i(923),d=i(814),c=i(164),u=i(178),p=i(62),g=i(626),m=i(585),f=i(94),b=i(457),v=i(786),A=i(50),y=t([h,v]);[h,v]=y.then?(await y)():y;const _=65536,E=100,x=5e3,T=n.isNodeJS?h.NodeCanvasFactory:r.DOMCanvasFactory,S=n.isNodeJS?h.NodeCMapReaderFactory:r.DOMCMapReaderFactory,C=n.isNodeJS?h.NodeFilterFactory:r.DOMFilterFactory,M=n.isNodeJS?h.NodeStandardFontDataFactory:r.DOMStandardFontDataFactory;function P(t){if("string"===typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t}),"object"!==typeof t)throw new Error("Invalid parameter in getDocument, need parameter object.");if(!t.url&&!t.data&&!t.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const e=new L,{docId:i}=e,s=t.url?I(t.url):null,a=t.data?R(t.data):null,o=t.httpHeaders||null,h=!0===t.withCredentials,l=t.password??null,d=t.range instanceof D?t.range:null,p=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:_;let g=t.worker instanceof H?t.worker:null;const A=t.verbosity,y="string"!==typeof t.docBaseUrl||(0,r.isDataScheme)(t.docBaseUrl)?null:t.docBaseUrl,w="string"===typeof t.cMapUrl?t.cMapUrl:null,E=!1!==t.cMapPacked,x=t.CMapReaderFactory||S,P="string"===typeof t.standardFontDataUrl?t.standardFontDataUrl:null,F=t.StandardFontDataFactory||M,O=!0!==t.stopAtErrors,N=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,B=!1!==t.isEvalSupported,z="boolean"===typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!n.isNodeJS,j=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,G="boolean"===typeof t.disableFontFace?t.disableFontFace:n.isNodeJS,V=!0===t.fontE
22xtraProperties,$=!0===t.enableXfa,W=t.ownerDocument||globalThis.document,q=!0===t.disableRange,K=!0===t.disableStream,X=!0===t.disableAutoFetch,Y=!0===t.pdfBug,J=d?d.length:t.length??NaN,Q="boolean"===typeof t.useSystemFonts?t.useSystemFonts:!n.isNodeJS&&!G,Z="boolean"===typeof t.useWorkerFetch?t.useWorkerFetch:x===r.DOMCMapReaderFactory&&F===r.DOMStandardFontDataFactory&&w&&P&&(0,r.isValidFetchUrl)(w,document.baseURI)&&(0,r.isValidFetchUrl)(P,document.baseURI),tt=t.canvasFactory||new T({ownerDocument:W}),et=t.filterFactory||new C({docId:i,ownerDocument:W}),it=null;(0,n.setVerbosityLevel)(A);const st={canvasFactory:tt,filterFactory:et};if(Z||(st.cMapReaderFactory=new x({baseUrl:w,isCompressed:E}),st.standardFontDataFactory=new F({baseUrl:P})),!g){const t={verbosity:A,port:c.GlobalWorkerOptions.workerPort};g=t.port?H.fromPort(t):new H(t),e._worker=g}const nt={docId:i,apiVersion:"4.1.392",data:a,password:l,disableAutoFetch:X,rangeChunkSize:p,length:J,docBaseUrl:y,enableXfa:$,evaluatorOptions:{maxImageSize:N,disableFontFace:G,ignoreErrors:O,isEvalSupported:B,isOffscreenCanvasSupported:z,canvasMaxAreaInBytes:j,fontExtraProperties:V,useSystemFonts:Q,cMapUrl:Z?w:null,standardFontDataUrl:Z?P:null}},at={ignoreErrors:O,isEvalSupported:B,disableFontFace:G,fontExtraProperties:V,enableXfa:$,ownerDocument:W,disableAutoFetch:X,pdfBug:Y,styleElement:it};return g.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");const t=k(g,nt),l=new Promise((function(t){let e;if(d)e=new m.PDFDataTransportStream(d,{disableRange:q,disableStream:K});else if(!a){const t=t=>{if(n.isNodeJS){const e=function(){return"undefined"!==typeof fetch&&"undefined"!==typeof Response&&"body"in Response.prototype};return e()&&(0,r.isValidFetchUrl)(t.url)?new f.PDFFetchStream(t):new v.PDFNodeStream(t)}return(0,r.isValidFetchUrl)(t.url)?new f.PDFFetchStream(t):new b.PDFNetworkStream(t)};e=t({url:s,length:J,httpHeaders:o,withCredentials:h,rangeChunkSize:p,disableRange:q,disableStream:K})}t(e)}));return Promise.all([t,l]).then((function([t,s]){if(e.destroyed)throw new Error("Loading aborted");const n=new u.MessageHandler(i,t,g.port),a=new U(n,e,s,at,st);e._transport=a,n.send("Ready",null)}))})).catch(e._capability.reject),e}async function k(t,e){if(t.destroyed)throw new Error("Worker was destroyed");const i=await t.messageHandler.sendWithPromise("GetDocRequest",e,e.data?[e.data.buffer]:null);if(t.destroyed)throw new Error("Worker was destroyed");return i}function I(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(n.isNodeJS&&"string"===typeof t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function R(t){if(n.isNodeJS&&"undefined"!==typeof Buffer&&t instanceof Buffer)throw new 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,n.stringToBytes)(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"===typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class L{static#z=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+L.#z++,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 D{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(const i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(t,e)}))}onDataProgressiveRead(t){this._readyCapability.promise.then((()=>{for(const e of this._progressiveReadListeners)e(t)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const t of this._progressiveDoneListeners)t()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){(0,n.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class F{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,n.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"}={}){const{renderingIntent:e}
22=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()}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 O{#j=null;#G=!1;constructor(t,e,i,s=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new r.StatTimer:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new j,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:n=!1}={}){return new r.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,n.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=n.AnnotationMode.ENABLE,transform:a=null,background:r=null,optionalContentConfigPromise:o=null,annotationCanvasMap:h=null,pageColors:l=null,printAnnotationStorage:d=null}){this._stats?.time("Overall");const c=this._transport.getRenderingIntent(i,s,d),{renderingIntent:u,cacheKey:p}=c;this.#G=!1,this.#V(),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);const m=!!(u&n.RenderingIntentFlag.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(c));const f=t=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||m)&&(this.#G=!0),this.#$(!m),t?(b.capability.reject(t),this._abortOperatorList({intentState:g,reason:t instanceof Error?t:new Error(t)})):b.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},b=new V({callback:f,params:{canvasContext:t,viewport:e,transform:a,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:l});(g.renderTasks||=new Set).add(b);const v=b.task;return Promise.all([g.displayReadyCapability.promise,o]).then((([t,e])=>{if(this.destroyed)f();else{if(this._stats?.time("Rendering"),!(e.renderingIntent&u))throw new Error("Mu
22st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");b.initializeGraphics({transparency:t,optionalContentConfig:e}),b.operatorListChanged()}})).catch(f),v}getOperatorList({intent:t="display",annotationMode:e=n.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){function s(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(r))}const a=this._transport.getRenderingIntent(t,e,i,!0);let r,o=this._intentStates.get(a.cacheKey);return o||(o=Object.create(null),this._intentStates.set(a.cacheKey,o)),o.opListReadCapability||(r=Object.create(null),r.operatorListChanged=s,o.opListReadCapability=Promise.withResolvers(),(o.renderTasks||=new Set).add(r),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a)),o.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){const i=100;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:i,size(t){return t.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then((t=>A.XfaText.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,i){function s(){n.read().then((function({value:e,done:i}){i?t(a):(Object.assign(a.styles,e.styles),a.items.push(...e.items),s())}),i)}const n=e.getReader(),a={items:[],styles:Object.create(null)};s()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#G=!1,this.#V(),Promise.all(t)}cleanup(t=!1){this.#G=!0;const e=this.#$(!1);return t&&e&&(this._stats&&=new r.StatTimer),e}#$(t=!1){if(this.#V(),!this.#G||this.destroyed)return!1;if(t)return this.#j=setTimeout((()=>{this.#j=null,this.#$(!1)}),x),!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#G=!1,!0}#V(){this.#j&&(clearTimeout(this.#j),this.#j=null)}_startRenderPage(t,e){const 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]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&this.#$(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i}){const{map:s,transfer:n}=i,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s},n),r=a.getReader(),o=this._intentStates.get(e);o.streamReader=r;const h=()=>{r.read().then((({value:t,done:e})=>{e?o.streamReader=null:this._transport.destroyed||(this._renderPageChunk(t,o),h())}),(t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(const t of o.renderTasks)t.operatorListChanged();this.#$(!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else{if(!o.opListReadCapability)throw t;o.opListReadCapability.reject(t)}}}))};h()}_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 r.RenderingCancelledException){let i=E;return e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),void(t.streamReaderCancelTimeout=setTimeout((()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})}),i))}}if(t.streamReader.cancel(new n.AbortException(e.message)).catch((()=>{})),t.streamReader=null,!this._transport.destroyed){for(const[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class N{#W=new Set;#q=Promise.resolve();postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};this.#q.then((()=>{for(const t of this.#W)t.call(this,i)}))}addEventListener(t,e){this.#W.add(e)}removeEventListener(t,e){this.#W.delete(e)}terminate(){this.#W.clear()}}const B={isWorkerDisabled:!1,fakeWorkerId:0};n.isNodeJS&&(B.isWorkerDisabled=!0,c.GlobalWorkerOptions.workerSrc||="./pdf.worker.mjs"),B.isSameOrigin=function(t,e){let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch{return!1}const s=new URL(e,i);return i.origin===s.origin},B.createCDNWrapper=function(t){const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};class H{static#K;constructor({name:t=null,port:e=null,verbosity:i=(0,n.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(H.#K?.has(e))throw new Error("Cannot use more than one PDFWorker per port.");return(H.#K||=new WeakMap).set(e,this),void this._initializeFromPort(e)}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new u.MessageHandler("main","worker",t),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!B.isWorkerDisabled&&!H.#X){let{workerSrc:t}=H;try{B.isSameOrigin(window.location.href,t)||(t=B.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new u.MessageHandler("main","worker",e),s=()=>{e.removeEventListener("error",n),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=()=>{this._webWorker||s()};e.addEventListener("error",n),i.on("test",(t=>{e.removeEventListener("error",n),this.destroyed?s():t?(this._messageHandler=i,this._port=e,this._webWorker=e,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),e.terminate())})),i.on("ready",(t=>{if(e.removeEventListener("error",n),this.destroyed)s();else try{a()}catch{this._setupFakeWorker()}}));const a=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void a()}catch{(0,n.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){B.isWorkerDisabled||((0,n.warn)("Setting up fake worker."),B.isWorkerDisabled=!0),H._setupFakeWorkerGlobal.then((t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new N;this._port=e;const i="fake"+B.fakeWorkerId++,s=new u.MessageHandler(i+"_worker",i,e);t.setup(s,e);const n=new u.MessageHandler(i,i+"_worker",e);this._messageHandler=n,this._readyCapability.resolve(),n.send("configure",{verbosity:this.verbosity})})).catch((t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),H.#K?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const e=this.#K?.get(t.port);
22if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new H(t)}static get workerSrc(){if(c.GlobalWorkerOptions.workerSrc)return c.GlobalWorkerOptions.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#X(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const t=async()=>{if(this.#X)return this.#X;const t=await import(this.workerSrc);return t.WorkerMessageHandler};return(0,n.shadow)(this,"_setupFakeWorkerGlobal",t())}}class U{#Y=new Map;#J=new Map;#Q=new Map;#Z=null;constructor(t,e,i,s,n){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new j,this.fontLoader=new o.FontLoader({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#tt(t,e=null){const i=this.#Y.get(t);if(i)return i;const s=this.messageHandler.sendWithPromise(t,e);return this.#Y.set(t,s),s}get annotationStorage(){return(0,n.shadow)(this,"annotationStorage",new a.AnnotationStorage)}getRenderingIntent(t,e=n.AnnotationMode.ENABLE,i=null,s=!1){let r=n.RenderingIntentFlag.DISPLAY,o=a.SerializableEmpty;switch(t){case"any":r=n.RenderingIntentFlag.ANY;break;case"display":break;case"print":r=n.RenderingIntentFlag.PRINT;break;default:(0,n.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case n.AnnotationMode.DISABLE:r+=n.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case n.AnnotationMode.ENABLE:break;case n.AnnotationMode.ENABLE_FORMS:r+=n.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case n.AnnotationMode.ENABLE_STORAGE:r+=n.RenderingIntentFlag.ANNOTATIONS_STORAGE;const t=r&n.RenderingIntentFlag.PRINT&&i instanceof a.PrintAnnotationStorage?i:this.annotationStorage;o=t.serializable;break;default:(0,n.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}return s&&(r+=n.RenderingIntentFlag.OPLIST),{renderingIntent:r,cacheKey:`${r}_${o.hash}`,annotationStorageSerializable:o}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#Z?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of this.#J.values())t.push(i._destroy());this.#J.clear(),this.#Q.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#Y.clear(),this.filterFactory.destroy(),(0,d.cleanupTextLayer)(),this._networkStream?.cancelAllRequests(new n.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",((t,e)=>{(0,n.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then((function({value:t,done:i}){i?e.close():((0,n.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=>{const 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,n.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then((function({value:t,done:i}){i?e.close():((0,n.assert)(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{i.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new F(t,this))})),t.on("DocException",(function(t){let i;switch(t.name){case"PasswordException":i=new n.PasswordException(t.message,t.code);break;case"InvalidPDFException":i=new n.InvalidPDFException(t.message);break;case"MissingPDFException":i=new n.MissingPDFException(t.message);break;case"UnexpectedResponseException":i=new n.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":i=new n.UnknownErrorException(t.message,t.details);break;default:(0,n.unreachable)("DocException - expected a valid Error.")}e._capability.reject(i)})),t.on("PasswordRequest",(t=>
22{if(this.#Z=Promise.withResolvers(),e.onPassword){const s=t=>{t instanceof Error?this.#Z.reject(t):this.#Z.resolve({password:t})};try{e.onPassword(s,t.code)}catch(i){this.#Z.reject(i)}}else this.#Z.reject(new n.PasswordException(t.message,t.code));return this.#Z.promise})),t.on("DataLoaded",(t=>{e.onProgress?.({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{if(this.destroyed)return;const e=this.#J.get(t.pageIndex);e._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(([e,i,s])=>{if(this.destroyed)return null;if(this.commonObjs.has(e))return null;switch(i){case"Font":const a=this._params;if("error"in s){const t=s.error;(0,n.warn)(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}const r=a.pdfBug&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,h=new o.FontFaceObject(s,{isEvalSupported:a.isEvalSupported,disableFontFace:a.disableFontFace,ignoreErrors:a.ignoreErrors,inspectFont:r});this.fontLoader.bind(h).catch((()=>t.sendWithPromise("FontFallback",{id:e}))).finally((()=>{!a.fontExtraProperties&&h.data&&(h.data=null),this.commonObjs.resolve(e,h)}));break;case"CopyLocalImage":const{imageRef:l}=s;(0,n.assert)(l,"The imageRef must be defined.");for(const t of this.#J.values())for(const[,i]of t.objs)if(i.ref===l)return i.dataLen?(this.commonObjs.resolve(e,structuredClone(i)),i.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(e,s);break;default:throw new Error(`Got unknown common object type ${i}`)}return null})),t.on("obj",(([t,e,i,s])=>{if(this.destroyed)return;const a=this.#J.get(e);if(!a.objs.has(t))if(0!==a._intentStates.size)switch(i){case"Image":a.objs.resolve(t,s),s?.dataLen>n.MAX_IMAGE_SIZE_TO_CACHE&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(t,s);break;default:throw new Error(`Got unknown object type ${i}`)}else s?.bitmap?.close()})),t.on("DocProgress",(t=>{this.destroyed||e.onProgress?.({loaded:t.loaded,total:t.total})})),t.on("FetchBuiltInCMap",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.")))),t.on("FetchStandardFontData",(t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,n.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally((()=>{this.annotationStorage.resetModified()}))}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=this.#Q.get(e);if(i)return i;const s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((t=>{if(this.destroyed)throw new Error("Transport destroyed");const i=new O(e,t,this,this._params.pdfBug);return this.#J.set(e,i),i}));return this.#Q.set(e,s),s}getPageIndex(t){return"object"!==typeof t||null===t||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen})}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#tt("GetFieldObjects")}hasJSActions(){return this.#tt("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!==typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithProm
22ise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#tt("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.#tt("GetOptionalContentConfig").then((e=>new g.OptionalContentConfig(e,t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=this.#Y.get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then((t=>({info:t[0],metadata:t[1]?new p.Metadata(t[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#Y.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const t of this.#J.values()){const e=t.cleanup();if(!e)throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`)}this.commonObjs.clear(),t||this.fontLoader.clear(),this.#Y.clear(),this.filterFactory.destroy(!0),(0,d.cleanupTextLayer)()}}get loadingParams(){const{disableAutoFetch:t,enableXfa:e}=this._params;return(0,n.shadow)(this,"loadingParams",{disableAutoFetch:t,enableXfa:e})}}const z=Symbol("INITIAL_DATA");class j{#et=Object.create(null);#it(t){return this.#et[t]||={...Promise.withResolvers(),data:z}}get(t,e=null){if(e){const i=this.#it(t);return i.promise.then((()=>e(i.data))),null}const i=this.#et[t];if(!i||i.data===z)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=this.#et[t];return!!e&&e.data!==z}resolve(t,e=null){const i=this.#it(t);i.data=e,i.resolve()}clear(){for(const t in this.#et){const{data:e}=this.#et[t];e?.bitmap?.close()}this.#et=Object.create(null)}*[Symbol.iterator](){for(const t in this.#et){const{data:e}=this.#et[t];e!==z&&(yield[t,e])}}}class G{#st=null;constructor(t){this.#st=t,this.onContinue=null}get promise(){return this.#st.capability.promise}cancel(t=0){this.#st.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#st.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this.#st;return t.form||t.canvas&&e?.size>0}}class V{static#nt=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:n,operatorList:a,pageIndex:r,canvasFactory:o,filterFactory:h,useRequestAnimationFrame:l=!1,pdfBug:d=!1,pageColors:c=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=r,this.canvasFactory=o,this.filterFactory=h,this._pdfBug=d,this.pageColors=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===l&&"undefined"!==typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new G(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(V.#nt.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");V.#nt.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:i,viewport:s,transform:n,background:a}=this.params;this.gfx=new l.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,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(),V.#nt.delete(this._canvas),this.callback(t||new r.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_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)}
22)):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(),V.#nt.delete(this._canvas),this.callback())))}}const $="4.1.392",W="fcb76a78d";s()}catch(w){s(w)}}))},583:(t,e,i)=>{i.d(e,{BaseCMapReaderFactory:()=>r,BaseCanvasFactory:()=>a,BaseFilterFactory:()=>n,BaseSVGFactory:()=>h,BaseStandardFontDataFactory:()=>o});var s=i(292);class n{constructor(){this.constructor===n&&(0,s.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addHighlightHCMFilter(t,e,i,s,n){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 new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d")}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new 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 r{constructor({baseUrl:t=null,isCompressed:e=!0}){this.constructor===r&&(0,s.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":""),i=this.isCompressed?s.CMapCompressionType.BINARY:s.CMapCompressionType.NONE;return this._fetchData(e,i).catch((t=>{throw new 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 new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetchData(e).catch((t=>{throw new Error(`Unable to load font data at: ${e}`)}))}_fetchData(t){(0,s.unreachable)("Abstract method `_fetchData` called.")}}class h{constructor(){this.constructor===h&&(0,s.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if("string"!==typeof t)throw new 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:()=>G});var s=i(292),n=i(419);const a={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function r(t,e){if(!e)return;const i=e[2]-e[0],s=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,s),t.clip(n)}class o{constructor(){this.constructor===o&&(0,s.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,s.unreachable)("Abstract method `getPattern` called.")}}class h 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;"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));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,o){let h;if(o===a.STROKE||o===a.FILL){const a=e.current.getClippedPathBoundingBox(o,(0,n.getCurrentTransform)(t))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,d=Math.ceil(a[3]-a[1])||1,c=e.cachedCanvases.getCanvas("pattern",l,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
22),r(u,this._bbox),u.fillStyle=this._createGradient(u),u.fill(),h=t.createPattern(c.canvas,"no-repeat");const p=new DOMMatrix(i);h.setTransform(p)}else r(t,this._bbox),h=this._createGradient(t);return h}}function l(t,e,i,s,n,a,r,o){const h=e.coords,l=e.colors,d=t.data,c=4*t.width;let u;h[i+1]>h[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u),h[s+1]>h[n+1]&&(u=s,s=n,n=u,u=r,r=o,o=u),h[i+1]>h[s+1]&&(u=i,i=s,s=u,u=a,a=r,r=u);const p=(h[i]+e.offsetX)*e.scaleX,g=(h[i+1]+e.offsetY)*e.scaleY,m=(h[s]+e.offsetX)*e.scaleX,f=(h[s+1]+e.offsetY)*e.scaleY,b=(h[n]+e.offsetX)*e.scaleX,v=(h[n+1]+e.offsetY)*e.scaleY;if(g>=v)return;const A=l[a],y=l[a+1],w=l[a+2],_=l[r],E=l[r+1],x=l[r+2],T=l[o],S=l[o+1],C=l[o+2],M=Math.round(g),P=Math.round(v);let k,I,R,L,D,F,O,N;for(let B=M;B<=P;B++){if(B<f){const t=B<g?0:(g-B)/(g-f);k=p-(p-m)*t,I=A-(A-_)*t,R=y-(y-E)*t,L=w-(w-x)*t}else{let t;t=B>v?1:f===v?0:(f-B)/(f-v),k=m-(m-b)*t,I=_-(_-T)*t,R=E-(E-S)*t,L=x-(x-C)*t}let t;t=B<g?0:B>v?1:(g-B)/(g-v),D=p-(p-b)*t,F=A-(A-T)*t,O=y-(y-S)*t,N=w-(w-C)*t;const e=Math.round(Math.min(k,D)),i=Math.round(Math.max(k,D));let s=c*B+4*e;for(let n=e;n<=i;n++)t=(k-n)/(k-D),t<0?t=0:t>1&&(t=1),d[s++]=I-(I-F)*t|0,d[s++]=R-(R-O)*t|0,d[s++]=L-(L-N)*t|0,d[s++]=255}}function d(t,e,i){const s=e.coords,n=e.colors;let a,r;switch(e.type){case"lattice":const o=e.verticesPerRow,h=Math.floor(s.length/o)-1,d=o-1;for(a=0;a<h;a++){let e=a*o;for(let a=0;a<d;a++,e++)l(t,i,s[e],s[e+1],s[e+o],n[e],n[e+1],n[e+o]),l(t,i,s[e+o+1],s[e+1],s[e+o],n[e+o+1],n[e+1],n[e+o])}break;case"triangles":for(a=0,r=s.length;a<r;a+=3)l(t,i,s[a],s[a+1],s[a+2],n[a],n[a+1],n[a+2]);break;default:throw new Error("illegal figure")}}class c 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){const s=1.1,n=3e3,a=2,r=Math.floor(this._bounds[0]),o=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-r,l=Math.ceil(this._bounds[3])-o,c=Math.min(Math.ceil(Math.abs(h*t[0]*s)),n),u=Math.min(Math.ceil(Math.abs(l*t[1]*s)),n),p=h/c,g=l/u,m={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-o,scaleX:1/p,scaleY:1/g},f=c+2*a,b=u+2*a,v=i.getCanvas("mesh",f,b,!1),A=v.context,y=A.createImageData(c,u);if(e){const t=y.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(const _ of this._figures)d(y,_,m);A.putImageData(y,a,a);const w=v.canvas;return{canvas:w,offsetX:r-a*p,offsetY:o-a*g,scaleX:p,scaleY:g}}getPattern(t,e,i,o){let h;if(r(t,this._bbox),o===a.SHADING)h=s.Util.singularValueDecompose2dScale((0,n.getCurrentTransform)(t));else if(h=s.Util.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=s.Util.singularValueDecompose2dScale(this.matrix);h=[h[0]*t[0],h[1]*t[1]]}const l=this._createMeshCanvas(h,o===a.SHADING?null:this._background,e.cachedCanvases);return o!==a.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(l.offsetX,l.offsetY),t.scale(l.scaleX,l.scaleY),t.createPattern(l.canvas,"no-repeat")}}class u extends o{getPattern(){return"hotpink"}}function p(t){switch(t[0]){case"RadialAxial":return new h(t);case"Mesh":return new c(t);case"Dummy":return new u}throw new Error(`Unknown IR type: ${t[0]}`)}const g={COLORED:1,UNCOLORED:2};class m{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,s,n){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=n}createPatternCanvas(t){const e=this.operatorList,i=this.bbox,a=this.xstep,r=this.ystep,o=this.paintType,h=this.tilingType,l=this.color,d=this.canvasGraphicsFactory;(0,s.info)("TilingType: "+h);const c=i[0],u=i[1],p=i[2],g=i[3],m=s.Util.singularValueDecompose2dScale(this.matrix),f=s.Util.singularValueDecompose2dScale(this.baseTransform),b=[m[0]*f[0],m[1]*f[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,b[0]),A=this.getSizeAndScale(r,this.ctx.canvas.height,b[1]),y=t.cachedCanvases.getCanvas("pattern",v.size,A.size,!0),w=y.context,_=d.createCanvasGraphics(w);_.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(_,o,l);let E=c,x=u,T=p,S=g;return c<0&&(E=0,T+=Math.abs(c)),u<0&&(x=0,S+=Math.abs(u)),w.translate(-v.scale*E,-A.scale*x),_.transform(v.scale,0,0,A.scale,0,0),w.save(),this.clipBbox(_,E,x,T,S),_.baseTransform=(0,n.getCurrentTransform)(_.ctx),_.executeOperatorList(e),_.endDrawing(),{canvas:y.canvas,scaleX:v.scale,scaleY:A.scale,offsetX:E,offsetY:x}}getSizeAndScale(t,e,i){t=Math.abs(t);const s=Math.max(m.MAX_PATTERN_SIZE,e);let n=Math.ceil(t*i);return n>=s?n=s:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,s,a){const r=s-e,o=a-i;t.ctx.rect(e,i,r,o),t.current.updateRectMinMax((0,n.getCurrentTransform)(t.ctx),[e,i,s,a]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const n=t.ctx,a=t.current;switch(e){case g.COLORED:const t=this.ctx;n.fillStyle=t.fillStyle,n.strokeStyle=t.strokeStyle,a.fillColor=t.fillStyle,a.strokeColor=t.strokeStyle;break;case g.UNCOLORED:const r=s.Util.makeHexColor(i[0],i[1],i[2]);n.fillStyle=r,n.strokeStyle=r,a.fillColor=r,a.strokeColor=r;break;default:throw new s.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,n){let r=i;n!==a.SHADING&&(r=s.Util.transform(r,e.baseTransform),this.matrix&&(r=s.Util.transform(r,this.matrix
22)));const o=this.createPatternCanvas(e);let h=new DOMMatrix(r);h=h.translate(o.offsetX,o.offsetY),h=h.scale(1/o.scaleX,1/o.scaleY);const l=t.createPattern(o.canvas,"repeat");return l.setTransform(h),l}}function f({src:t,srcPos:e=0,dest:i,width:n,height:a,nonBlackColor:r=4294967295,inverseDecode:o=!1}){const h=s.FeatureTest.isLittleEndian?4278190080:255,[l,d]=o?[r,h]:[h,r],c=n>>3,u=7&n,p=t.length;i=new Uint32Array(i.buffer);let g=0;for(let s=0;s<a;s++){for(const n=e+c;e<n;e++){const s=e<p?t[e]:255;i[g++]=128&s?d:l,i[g++]=64&s?d:l,i[g++]=32&s?d:l,i[g++]=16&s?d:l,i[g++]=8&s?d:l,i[g++]=4&s?d:l,i[g++]=2&s?d:l,i[g++]=1&s?d:l}if(0===u)continue;const s=e<p?t[e++]:255;for(let t=0;t<u;t++)i[g++]=s&1<<7-t?d:l}return{srcPos:e,destPos:g}}const b=16,v=100,A=4096,y=15,w=10,_=1e3,E=16;function x(t,e){if(t._removeMirroring)throw new 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()},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,n,a,r){e.transform(t,i,s,n,a,r),this.__originalTransform(t,i,s,n,a,r)},t.setTransform=function(t,i,s,n,a,r){e.setTransform(t,i,s,n,a,r),this.__originalSetTransform(t,i,s,n,a,r)},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,n,a,r){e.bezierCurveTo(t,i,s,n,a,r),this.__originalBezierCurveTo(t,i,s,n,a,r)},t.rect=function(t,i,s,n){e.rect(t,i,s,n),this.__originalRect(t,i,s,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class T{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(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function S(t,e,i,s,a,r,o,h,l,d){const[c,u,p,g,m,f]=(0,n.getCurrentTransform)(t);if(0===u&&0===p){const n=o*c+m,b=Math.round(n),v=h*g+f,A=Math.round(v),y=(o+l)*c+m,w=Math.abs(Math.round(y)-b)||1,_=(h+d)*g+f,E=Math.abs(Math.round(_)-A)||1;return t.setTransform(Math.sign(c),0,0,Math.sign(g),b,A),t.drawImage(e,i,s,a,r,0,0,w,E),t.setTransform(c,u,p,g,m,f),[w,E]}if(0===c&&0===g){const n=h*p+m,b=Math.round(n),v=o*u+f,A=Math.round(v),y=(h+d)*p+m,w=Math.abs(Math.round(y)-b)||1,_=(o+l)*u+f,E=Math.abs(Math.round(_)-A)||1;return t.setTransform(0,Math.sign(u),Math.sign(p),0,b,A),t.drawImage(e,i,s,a,r,0,0,E,w),t.setTransform(c,u,p,g,m,f),[E,w]}t.drawImage(e,i,s,a,r,o,h,l,d);const b=Math.hypot(c,u),v=Math.hypot(p,g);return[b*l,v*d]}function C(t){const{width:e,height:i}=t;if(e>_||i>_)return null;const s=1e3,n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=e+1;let r,o,h,l=new Uint8Array(a*(i+1));const d=e+7&-8;let c=new Uint8Array(d*i),u=0;for(const b of t.data){let t=128;while(t>0)c[u++]=b&t?0:255,t>>=1}let p=0;for(u=0,0!==c[u]&&(l[0]=1,++p),o=1;o<e;
22o++)c[u]!==c[u+1]&&(l[o]=c[u]?2:1,++p),u++;for(0!==c[u]&&(l[o]=2,++p),r=1;r<i;r++){u=r*d,h=r*a,c[u-d]!==c[u]&&(l[h]=c[u]?1:8,++p);let t=(c[u]?4:0)+(c[u-d]?8:0);for(o=1;o<e;o++)t=(t>>2)+(c[u+1]?4:0)+(c[u-d+1]?8:0),n[t]&&(l[h+o]=n[t],++p),u++;if(c[u-d]!==c[u]&&(l[h+o]=c[u]?2:4,++p),p>s)return null}for(u=d*(i-1),h=r*a,0!==c[u]&&(l[h]=8,++p),o=1;o<e;o++)c[u]!==c[u+1]&&(l[h+o]=c[u]?4:8,++p),u++;if(0!==c[u]&&(l[h+o]=4,++p),p>s)return null;const g=new Int32Array([0,a,-1,0,-a,0,0,0,1]),m=new Path2D;for(r=0;p&&r<=i;r++){let t=r*a;const i=t+e;while(t<i&&!l[t])t++;if(t===i)continue;m.moveTo(t%a,r);const s=t;let n=l[t];do{const e=g[n];do{t+=e}while(!l[t]);const i=l[t];5!==i&&10!==i?(n=i,l[t]=0):(n=i&51*n>>4,l[t]&=n>>2|n<<2),m.lineTo(t%a,t/a|0),l[t]||--p}while(s!==t);--r}c=null,l=null;const f=function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(m),t.beginPath(),t.restore()};return f}class M{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(){const 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){const i=s.Util.applyTransform(e,t),n=s.Util.applyTransform(e.slice(2),t),a=s.Util.applyTransform([e[0],e[3]],t),r=s.Util.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],n[0],a[0],r[0]),this.minY=Math.min(this.minY,i[1],n[1],a[1],r[1]),this.maxX=Math.max(this.maxX,i[0],n[0],a[0],r[0]),this.maxY=Math.max(this.maxY,i[1],n[1],a[1],r[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,n,a,r,o,h,l,d){const c=s.Util.bezierBoundingBox(e,i,n,a,r,o,h,l,d);d||this.updateRectMinMax(t,c)}getPathBoundingBox(t=a.FILL,e=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===a.STROKE){e||(0,s.unreachable)("Stroke bounding box must include transform.");const t=s.Util.singularValueDecompose2dScale(e),n=t[0]*this.lineWidth/2,a=t[1]*this.lineWidth/2;i[0]-=n,i[1]-=a,i[2]+=n,i[3]+=a}return i}updateClipFromPath(){const 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 P(t,e){if("undefined"!==typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,n=e.width,a=i%E,r=(i-a)/E,o=0===a?r:r+1,h=t.createImageData(n,E);let l,d=0;const c=e.data,u=h.data;let p,g,m,f;if(e.kind===s.ImageKind.GRAYSCALE_1BPP){const e=c.byteLength,i=new Uint32Array(u.buffer,0,u.byteLength>>2),f=i.length,b=n+7>>3,v=4294967295,A=s.FeatureTest.isLittleEndian?4278190080:255;for(p=0;p<o;p++){for(m=p<r?E:a,l=0,g=0;g<m;g++){const t=e-d;let s=0;const a=t>b?n:8*t-7,r=-8&a;let o=0,h=0;for(;s<r;s+=8)h=c[d++],i[l++]=128&h?v:A,i[l++]=64&h?v:A,i[l++]=32&h?v:A,i[l++]=16&h?v:A,i[l++]=8&h?v:A,i[l++]=4&h?v:A,i[l++]=2&h?v:A,i[l++]=1&h?v:A;for(;s<a;s++)0===o&&(h=c[d++],o=128),i[l++]=h&o?v:A,o>>=1}while(l<f)i[l++]=0;t.putImageData(h,0,p*E)}}else if(e.kind===s.ImageKind.RGBA_32BPP){for(g=0,f=n*E*4,p=0;p<r;p++)u.set(c.subarray(d,d+f)),d+=f,t.putImageData(h,0,g),g+=E;p<o&&(f=n*a*4,u.set(c.subarray(d,d+f)),t.putImageData(h,0,g))}else{if(e.kind!==s.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);for(m=E,f=n*m,p=0;p<o;p++){for(p>=r&&(m=a,f=n*m),l=0,g=f;g--;)u[l++]=c[d++],u[l++]=c[d++],u[l++]=c[d++],u[l++]=255;t.putImageData(h,0,p*E)}}}function k(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,s=e.width,n=i%E,a=(i-n)/E,r=0===n?a:a+1,o=t.createImageData(s,E);let h=0;const l=e.data,d=o.data;for(let c=0;c<r;c++){const e=c<a?E:n;({srcPos:h}=f({src:l,srcPos:h,dest:d,width:s,height:e,nonBlackColor:0})),t.putImageData(o,0,c*E)}}function I(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const s of i)void 0!==t[s]&&(e[s]=t[s]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function R(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miter
22Limit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!s.isNodeJS){const{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function L(t,e,i,s){const n=t.length;for(let a=3;a<n;a+=4){const n=t[a];if(0===n)t[a-3]=e,t[a-2]=i,t[a-1]=s;else if(n<255){const r=255-n;t[a-3]=t[a-3]*n+e*r>>8,t[a-2]=t[a-2]*n+i*r>>8,t[a-1]=t[a-1]*n+s*r>>8}}}function D(t,e,i){const s=t.length,n=1/255;for(let a=3;a<s;a+=4){const s=i?i[t[a]]:t[a];e[a]=e[a]*s*n|0}}function F(t,e,i){const s=t.length;for(let n=3;n<s;n+=4){const s=77*t[n-3]+152*t[n-2]+28*t[n-1];e[n]=i?e[n]*i[s>>8]>>8:e[n]*s>>16}}function O(t,e,i,s,n,a,r,o,h,l,d){const c=!!a,u=c?a[0]:0,p=c?a[1]:0,g=c?a[2]:0,m="Luminosity"===n?F:D,f=1048576,b=Math.min(s,Math.ceil(f/i));for(let v=0;v<s;v+=b){const n=Math.min(b,s-v),a=t.getImageData(o-l,v+(h-d),i,n),f=e.getImageData(o,v+h,i,n);c&&L(a.data,u,p,g),m(a.data,f.data,r),e.putImageData(f,o,v+h)}}function N(t,e,i,s){const n=s[0],a=s[1],r=s[2]-n,o=s[3]-a;0!==r&&0!==o&&(O(e.context,i,r,o,e.subtype,e.backdrop,e.transferMap,n,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())}function B(t,e){const i=s.Util.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const a=Math.fround((globalThis.devicePixelRatio||1)*n.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==e?e:i[0]<=a||i[1]<=a}const H=["butt","round","square"],U=["miter","round","bevel"],z={},j={};class G{constructor(t,e,i,s,n,{optionalContentConfig:a,markedContentStack:r=null},o,h){this.ctx=t,this.current=new M(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=n,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=r||[],this.optionalContentConfig=a,this.cachedCanvases=new T(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,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}){const a=this.ctx.canvas.width,r=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,a,r),this.ctx.fillStyle=o,i){const t=this.cachedCanvases.getCanvas("transparent",a,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...(0,n.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),R(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,n.getCurrentTransform)(this.ctx)}executeOperatorList(t,e,i,n){const a=t.argsArray,r=t.fnArray;let o=e||0;const h=a.length;if(h===o)return o;const l=h-o>w&&"function"===typeof i,d=l?Date.now()+y:0;let c=0;const u=this.commonObjs,p=this.objs;let g;while(1){if(void 0!==n&&o===n.nextBreakPoint)return n.breakIt(o,i),o;if(g=r[o],g!==s.OPS.dependency)this[g].apply(this,a[o]);else for(const t of a[o]){const e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,i),o}if(o++,o===h)return o;if(l&&++c>w){if(Date.now()>d)return i(),o;c=0}}}#at(){while(this.stateStack.length||this.inSMaskMode)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#at(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#rt()}#rt(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}
22_scaleImage(t,e){const i=t.width,s=t.height;let n,a,r=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),h=i,l=s,d="prescale1";while(r>2&&h>1||o>2&&l>1){let e=h,i=l;r>2&&h>1&&(e=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),r/=h/e),o>2&&l>1&&(i=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,o/=l/i),n=this.cachedCanvases.getCanvas(d,e,i),a=n.context,a.clearRect(0,0,e,i),a.drawImage(t,0,0,h,l,0,0,e,i),t=n.canvas,h=e,l=i,d="prescale1"===d?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:r}=t,o=this.current.fillColor,h=this.current.patternFill,l=(0,n.getCurrentTransform)(e);let d,c,u,p;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer;c=JSON.stringify(h?l:[l.slice(0,4),o]),d=this._cachedBitmapsMap.get(e),d||(d=new Map,this._cachedBitmapsMap.set(e,d));const i=d.get(c);if(i&&!h){const t=Math.round(Math.min(l[0],l[2])+l[4]),e=Math.round(Math.min(l[1],l[3])+l[5]);return{canvas:i,offsetX:t,offsetY:e}}u=i}u||(p=this.cachedCanvases.getCanvas("maskCanvas",i,r),k(p.context,t));let g=s.Util.transform(l,[1/i,0,0,-1/r,0,0]);g=s.Util.transform(g,[1,0,0,1,0,-r]);const[m,f,b,v]=s.Util.getAxialAlignedBoundingBox([0,0,i,r],g),A=Math.round(b-m)||1,y=Math.round(v-f)||1,w=this.cachedCanvases.getCanvas("fillCanvas",A,y),_=w.context,E=m,x=f;_.translate(-E,-x),_.transform(...g),u||(u=this._scaleImage(p.canvas,(0,n.getCurrentTransformInverse)(_)),u=u.img,d&&h&&d.set(c,u)),_.imageSmoothingEnabled=B((0,n.getCurrentTransform)(_),t.interpolate),S(_,u,0,0,u.width,u.height,0,0,i,r),_.globalCompositeOperation="source-in";const T=s.Util.transform((0,n.getCurrentTransformInverse)(_),[1,0,0,1,-E,-x]);return _.fillStyle=h?o.getPattern(e,this,T,a.FILL):o,_.fillRect(0,0,i,r),d&&!h&&(this.cachedCanvases.delete("fillCanvas"),d.set(c,w.canvas)),{canvas:w.canvas,offsetX:Math.round(E),offsetY:Math.round(x)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=H[t]}setLineJoin(t){this.ctx.lineJoin=U[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[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);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const 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;const a=this.ctx;a.setTransform(...(0,n.getCurrentTransform)(this.suspendedCtx)),I(this.suspendedCtx,a),x(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),I(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];const e=this.current.activeSMask,i=this.suspendedCtx;N(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(
22)}save(){this.inSMaskMode?(I(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const 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(),I(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,n,a){this.ctx.transform(t,e,i,s,n,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const a=this.ctx,r=this.current;let o,h,l=r.x,d=r.y;const c=(0,n.getCurrentTransform)(a),u=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],p=u?i.slice(0):null;for(let n=0,g=0,m=t.length;n<m;n++)switch(0|t[n]){case s.OPS.rectangle:l=e[g++],d=e[g++];const t=e[g++],i=e[g++],n=l+t,m=d+i;a.moveTo(l,d),0===t||0===i?a.lineTo(n,m):(a.lineTo(n,d),a.lineTo(n,m),a.lineTo(l,m)),u||r.updateRectMinMax(c,[l,d,n,m]),a.closePath();break;case s.OPS.moveTo:l=e[g++],d=e[g++],a.moveTo(l,d),u||r.updatePathMinMax(c,l,d);break;case s.OPS.lineTo:l=e[g++],d=e[g++],a.lineTo(l,d),u||r.updatePathMinMax(c,l,d);break;case s.OPS.curveTo:o=l,h=d,l=e[g+4],d=e[g+5],a.bezierCurveTo(e[g],e[g+1],e[g+2],e[g+3],l,d),r.updateCurvePathMinMax(c,o,h,e[g],e[g+1],e[g+2],e[g+3],l,d,p),g+=6;break;case s.OPS.curveTo2:o=l,h=d,a.bezierCurveTo(l,d,e[g],e[g+1],e[g+2],e[g+3]),r.updateCurvePathMinMax(c,o,h,l,d,e[g],e[g+1],e[g+2],e[g+3],p),l=e[g+2],d=e[g+3],g+=4;break;case s.OPS.curveTo3:o=l,h=d,l=e[g+2],d=e[g+3],a.bezierCurveTo(e[g],e[g+1],l,d,l,d),r.updateCurvePathMinMax(c,o,h,e[g],e[g+1],l,d,l,d,p),g+=4;break;case s.OPS.closePath:a.closePath();break}u&&r.updateScalingPathMinMax(c,p),r.setCurrentPoint(l,d)}closePath(){this.ctx.closePath()}stroke(t=!0){const 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,n.getCurrentTransformInverse)(e),a.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;let r=!1;s&&(e.save(),e.fillStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),a.FILL),r=!0);const o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),r&&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=z}eoClip(){this.pendingClip=j}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(){const t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save(),e.beginPath();for(const i of 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}else e.beginPath()}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){const i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||s.FONT_IDENTITY_MATRIX,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||(0,s.warn)("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;const a=i.loadedName||"sans-serif",r=i.systemFontInfo?.css||`"${a}", ${i.fallbackName}`;let o="normal";i.black?o="900":i.bold&&(o="bold");const h=i.italic?"italic":"normal";let l=e;e<b?l=b:e>v&&(l=v),this.current.fontSizeScale=e/l,this.ctx.font=`${h} ${o} ${l}px ${r}`}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,n,a){this.current.textMatrix=[t,e,i,s,n,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){const r=this.ctx,o=this.current,h=o.font,l=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,c=l&s.TextRenderingMode.FILL_STROKE_MASK,u=!!(l&s.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!h.missingFile;let g;if((h.disableFontFace||u||p)&&(g=h.getPathGenerator(this.commonObjs,t)),h.disableFontFace||p?(r.save(),r.translate(e,i),r.beginPath(),g(r,d),a&&r.setTransform(...a),c!==s.TextRenderingMode.FILL&&c!==s.TextRenderingMode.FILL_STROKE||r.fill(),c!==s.TextRenderingMode.STROKE&&c!==s.TextRenderingMode.FILL_STROKE||r.stroke(),r.restore(
22)):(c!==s.TextRenderingMode.FILL&&c!==s.TextRenderingMode.FILL_STROKE||r.fillText(t,e,i),c!==s.TextRenderingMode.STROKE&&c!==s.TextRenderingMode.FILL_STROKE||r.strokeText(t,e,i)),u){const t=this.pendingTextPaths||=[];t.push({transform:(0,n.getCurrentTransform)(r),x:e,y:i,fontSize:d,addToPath:g})}}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return(0,s.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const r=e.fontSize;if(0===r)return;const o=this.ctx,h=e.fontSizeScale,l=e.charSpacing,d=e.wordSpacing,c=e.fontDirection,u=e.textHScale*c,p=t.length,g=i.vertical,m=g?1:-1,f=i.defaultVMetrics,b=r*e.fontMatrix[0],v=e.textRenderingMode===s.TextRenderingMode.FILL&&!i.disableFontFace&&!e.patternFill;let A;if(o.save(),o.transform(...e.textMatrix),o.translate(e.x,e.y+e.textRise),c>0?o.scale(u,-1):o.scale(u,1),e.patternFill){o.save();const t=e.fillColor.getPattern(o,this,(0,n.getCurrentTransformInverse)(o),a.FILL);A=(0,n.getCurrentTransform)(o),o.restore(),o.fillStyle=t}let y=e.lineWidth;const w=e.textMatrixScale;if(0===w||0===y){const t=e.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;t!==s.TextRenderingMode.STROKE&&t!==s.TextRenderingMode.FILL_STROKE||(y=this.getSinglePixelWidth())}else y/=w;if(1!==h&&(o.scale(h,h),y/=h),o.lineWidth=y,i.isInvalidPDFjsFont){const i=[];let s=0;for(const e of t)i.push(e.unicode),s+=e.width;
22return o.fillText(i.join(""),0,0),e.x+=s*b*u,o.restore(),void this.compose()}let _,E=0;for(_=0;_<p;++_){const e=t[_];if("number"===typeof e){E+=m*e*r/1e3;continue}let s=!1;const n=(e.isSpace?d:0)+l,a=e.fontChar,u=e.accent;let p,y,w=e.width;if(g){const t=e.vmetric||f,i=-(e.vmetric?t[1]:.5*w)*b,s=t[2]*b;w=t?-t[0]:w,p=i/h,y=(E+s)/h}else p=E/h,y=0;if(i.remeasure&&w>0){const t=1e3*o.measureText(a).width/r*h;if(w<t&&this.isFontSubpixelAAEnabled){const e=w/t;s=!0,o.save(),o.scale(e,1),p/=e}else w!==t&&(p+=(w-t)/2e3*r/h)}if(this.contentVisible&&(e.isInFont||i.missingFile))if(v&&!u)o.fillText(a,p,y);else if(this.paintChar(a,p,y,A),u){const t=p+r*u.offset.x/h,e=y-r*u.offset.y/h;this.paintChar(u.fontChar,t,e,A)}const x=g?w*b-n*c:w*b+n*c;E+=x,s&&o.restore()}g?e.y-=E:e.x+=E*u,o.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,n=i.font,a=i.fontSize,r=i.fontDirection,o=n.vertical?1:-1,h=i.charSpacing,l=i.wordSpacing,d=i.textHScale*r,c=i.fontMatrix||s.FONT_IDENTITY_MATRIX,u=t.length,p=i.textRenderingMode===s.TextRenderingMode.INVISIBLE;let g,m,f,b;if(!p&&0!==a){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(d,r),g=0;g<u;++g){if(m=t[g],"number"===typeof m){b=o*m*a/1e3,this.ctx.translate(b,0),i.x+=b*d;continue}const r=(m.isSpace?l:0)+h,u=n.charProcOperatorList[m.operatorListId];if(!u){(0,s.warn)(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),e.scale(a,a),e.transform(...c),this.executeOperatorList(u),this.restore());const p=s.Util.applyTransform([m.width,0],c);f=p[0]*a+r,e.translate(f,0),i.x+=f*d}e.restore(),this.processingType3=null}}setCharWidth(t,e){}
22setCharWidthAndBounds(t,e,i,s,n,a){this.ctx.rect(i,s,n-i,a-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],s=this.baseTransform||(0,n.getCurrentTransform)(this.ctx),a={createCanvasGraphics:t=>new G(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new m(t,i,this.ctx,a,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){const n=s.Util.makeHexColor(t,e,i);this.ctx.strokeStyle=n,this.current.strokeColor=n}setFillRGBColor(t,e,i){const n=s.Util.makeHexColor(t,e,i);this.ctx.fillStyle=n,this.current.fillColor=n,this.current.patternFill=!1}_getPattern(t,e=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=p(this.getObject(t)),this.cachedPatterns.set(t,i)),e&&(i.matrix=e),i}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),a.SHADING);const r=(0,n.getCurrentTransformInverse)(e);if(r){const{width:t,height:i}=e.canvas,[n,a,o,h]=s.Util.getAxialAlignedBoundingBox([0,0,t,i],r);this.ctx.fillRect(n,a,o-n,h-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,n.getCurrentTransform)(this.ctx),e)){const t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax((0,n.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);const e=this.ctx;t.isolated||(0,s.info)("TODO: Support non-isolated groups."),t.knockout&&(0,s.warn)("Knockout groups not supported.");const i=(0,n.getCurrentTransform)(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=s.Util.getAxialAlignedBoundingBox(t.bbox,(0,n.getCurrentTransform)(e));const r=[0,0,e.canvas.width,e.canvas.height];a=s.Util.intersect(a,r)||[0,0,0,0];const o=Math.floor(a[0]),h=Math.floor(a[1]);let l=Math.max(Math.ceil(a[2])-o,1),d=Math.max(Math.ceil(a[3])-h,1),c=1,u=1;l>A&&(c=l/A,l=A),d>A&&(u=d/A,d=A),this.current.startNewPathAndClipBox([0,0,l,d]);let p="groupAt"+this.groupLevel;t.smask&&(p+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(p,l,d),m=g.context;m.scale(1/c,1/u),m.translate(-o,-h),m.transform(...i),t.smask?this.smaskStack.push({canvas:g.canvas,context:m,offsetX:o,offsetY:h,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,h),e.scale(c,u),e.save()),I(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--;const 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();const t=(0,n.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const 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)}}beginAnnotation(t,e,i,a,r){if(this.#at(),R(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(e)&&4===e.length){const a=e[2]-e[0],o=e[3]-e[1];if(r&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=a,e[3]=o;const[r,h]=s.Util.singularValueDecompose2dScale((0,n.getCurrentTransform)(this.ctx)),{viewportScale:l}=this,d=Math.ceil(a*this.outputScaleX*l),c=Math.ceil(o*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(d,c);const{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(r,0,0,-h,0,o*h),R(this.ctx)}else R(this.ctx),this.ctx.rect(e[0],e[1],a,o),this.ctx.clip(),this.endPath()}
22this.current=new M(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#rt(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;t=this.getObject(t.data,t),t.count=e;const i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=C(t)),s.compiled))return void s.compiled(i);const n=this._createMaskCanvas(t),a=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,n.offsetX,n.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,a=0,r,o){if(!this.contentVisible)return;t=this.getObject(t.data,t);const h=this.ctx;h.save();const l=(0,n.getCurrentTransform)(h);h.transform(e,i,a,r,0,0);const d=this._createMaskCanvas(t);h.setTransform(1,0,0,1,d.offsetX-l[4],d.offsetY-l[5]);for(let n=0,c=o.length;n<c;n+=2){const t=s.Util.transform(l,[e,i,a,r,o[n],o[n+1]]),[c,u]=s.Util.applyTransform([0,0],t);h.drawImage(d.canvas,c,u)}h.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(const r of t){const{data:t,width:o,height:h,transform:l}=r,d=this.cachedCanvases.getCanvas("maskCanvas",o,h),c=d.context;c.save();const u=this.getObject(t,r);k(c,u),c.globalCompositeOperation="source-in",c.fillStyle=s?i.getPattern(c,this,(0,n.getCurrentTransformInverse)(e),a.FILL):i,c.fillRect(0,0,o,h),c.restore(),e.save(),e.transform(...l),e.scale(1,-1),S(e,d.canvas,0,0,o,h,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,s.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n){if(!this.contentVisible)return;const a=this.getObject(t);if(!a)return void(0,s.warn)("Dependent image isn't ready yet");const r=a.width,o=a.height,h=[];for(let s=0,l=n.length;s<l;s+=2)h.push({transform:[e,0,0,i,n[s],n[s+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(a,h)}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;const{bitmap:e,width:i,height:s}=t,n=this.cachedCanvases.getCanvas("inlineImage",i,s),a=n.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,a=this.ctx;if(this.save(),!s.isNodeJS){const{filter:t}=a;"none"!==t&&""!==t&&(a.filter="none")}let r;if(a.scale(1/e,-1/i),t.bitmap)r=this.applyTransferMapsToBitmap(t);else if("function"===typeof HTMLElement&&t instanceof HTMLElement||!t.data)r=t;else{const s=this.cachedCanvases.getCanvas("inlineImage",e,i),n=s.context;P(n,t),r=this.applyTransferMapsToCanvas(n)}const o=this._scaleImage(r,(0,n.getCurrentTransformInverse)(a));a.imageSmoothingEnabled=B((0,n.getCurrentTransform)(a),t.interpolate),S(a,o.img,0,0,o.paintWidth,o.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let s;if(t.bitmap)s=t.bitmap;else{const e=t.width,i=t.height,n=this.cachedCanvases.getCanvas("inlineImage",e,i),a=n.context;P(a,t),s=this.applyTransferMapsToCanvas(a)}for(const n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),S(i,s,n.x,n.y,n.w,n.h,0,-1,1,1),i.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){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(e||(this.pendingClip===j?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=(0,n.getCurrentTransform)(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:s,d:n}=this.ctx.getTransform();let a,r;if(0===i&&0===s){const i=Math.abs(e),s=Math.abs(n);if(i===s)if(0===t)a=r=1/i;else{const e=i*t;a=r=e<1?1/e:1}else if(0===t)a=1/i,r=1/s;else{const e=i*t,n=s*t;a=e<1?1/e:1,r=n<1?1/n:1}}else{const o=Math.abs(e*n-i*s),h=Math.hypot(e,i),l=Math.hypot(s,n);if(0===t)a=l/o,r=h/o;else{const e=t*o;a=l>e?l/e:1,r=h>e?h/e:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=r}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[s,n]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===n)return void e.stroke();const a=e.getLineDash();if(t&&e.save(),e.scale(s,n),a.length>0){const t=Math.max(s,n);e.setLineDash(a.map((e=>e/t))),e.lineDashOffset/=t}
22e.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(const V in s.OPS)void 0!==G.prototype[V]&&(G.prototype[s.OPS[V]]=G.prototype[V])},419:(t,e,i)=>{i.d(e,{DOMCMapReaderFactory:()=>d,DOMCanvasFactory:()=>h,DOMFilterFactory:()=>o,DOMSVGFactory:()=>u,DOMStandardFontDataFactory:()=>c,PDFDateString:()=>E,PageViewport:()=>p,PixelsPerInch:()=>r,RenderingCancelledException:()=>g,StatTimer:()=>A,fetchData:()=>l,getColorValues:()=>S,getCurrentTransform:()=>C,getCurrentTransformInverse:()=>M,getFilenameFromUrl:()=>b,getPdfFilenameFromUrl:()=>v,getRGB:()=>T,getXfaPageViewport:()=>x,isDataScheme:()=>m,isPdfFile:()=>f,isValidFetchUrl:()=>y,noContextMenu:()=>w,setLayerDimensions:()=>P});var s=i(583),n=i(292);const a="http://www.w3.org/2000/svg";class r{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class o extends s.BaseFilterFactory{#ot;#ht;#z;#lt;#dt;#ct=0;constructor({docId:t,ownerDocument:e=globalThis.document}={}){super(),this.#z=t,this.#lt=e}get#ut(){return this.#ot||=new Map}get#pt(){return this.#dt||=new Map}get#gt(){if(!this.#ht){const t=this.#lt.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;const i=this.#lt.createElementNS(a,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#ht=this.#lt.createElementNS(a,"defs"),t.append(i),i.append(this.#ht),this.#lt.body.append(t)}return this.#ht}addFilter(t){if(!t)return"none";let e,i,s,n,a=this.#ut.get(t);if(a)return a;if(1===t.length){const a=t[0],r=new Array(256);for(let t=0;t<256;t++)r[t]=a[t]/255;n=e=i=s=r.join(",")}else{const[a,r,o]=t,h=new Array(256),l=new Array(256),d=new Array(256);for(let t=0;t<256;t++)h[t]=a[t]/255,l[t]=r[t]/255,d[t]=o[t]/255;e=h.join(","),i=l.join(","),s=d.join(","),n=`${e}${i}${s}`}if(a=this.#ut.get(n),a)return this.#ut.set(t,a),a;const r=`g_${this.#z}_transfer_map_${this.#ct++}`,o=`url(#${r})`;this.#ut.set(t,o),this.#ut.set(n,o);const h=this.#mt(r);return this.#ft(e,i,s,h),o}addHCMFilter(t,e){const i=`${t}-${e}`,s="base";let a=this.#pt.get(s);if(a?.key===i)return a.url;if(a?(a.filter?.remove(),a.key=i,a.url="none",a.filter=null):(a={key:i,url:"none",filter:null},this.#pt.set(s,a)),!t||!e)return a.url;const r=this.#bt(t);t=n.Util.makeHexColor(...r);const o=this.#bt(e);if(e=n.Util.makeHexColor(...o),this.#gt.style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;const h=new Array(256);for(let n=0;n<=255;n++){const t=n/255;h[n]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const l=h.join(","),d=`g_${this.#z}_hcm_filter`,c=a.filter=this.#mt(d);this.#ft(l,l,l,c),this.#vt(c);const u=(t,e)=>{const i=r[t]/255,s=o[t]/255,n=new Array(e+1);for(let a=0;a<=e;a++)n[a]=i+a/e*(s-i);return n.join(",")};return this.#ft(u(0,5),u(1,5),u(2,5),c),a.url=`url(#${d})`,a.url}addHighlightHCMFilter(t,e,i,s,n){const a=`${e}-${i}-${s}-${n}`;let r=this.#pt.get(t);if(r?.key===a)return r.url;if(r?(r.filter?.remove(),r.key=a,r.url="none",r.filter=null):(r={key:a,url:"none",filter:null},this.#pt.set(t,r)),!e||!i)return r.url;const[o,h]=[e,i].map(this.#bt.bind(this));let l=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[c,u]=[s,n].map(this.#bt.bind(this));d<l&&([l,d,c,u]=[d,l,u,c]),this.#gt.style.color="";const p=(t,e,i)=>{const s=new Array(256),n=(d-l)/i,a=t/255,r=(e-t)/(255*i);let o=0;for(let h=0;h<=i;h++){const t=Math.round(l+h*n),e=a+h*r;for(let i=o;i<=t;i++)s[i]=e;o=t+1}for(let h=o;h<256;h++)s[h]=s[o-1];return s.join(",")},g=`g_${this.#z}_hcm_${t}_filter`,m=r.filter=this.#mt(g);return this.#vt(m),this.#ft(p(c[0],u[0],5),p(c[1],u[1],5),p(c[2],u[2],5),m),r.url=`url(#${g})`,r.url}destroy(t=!1){t&&0!==this.#pt.size||(this.#ht&&(this.#ht.parentNode.parentNode.remove(),this.#ht=null),this.#ot&&(this.#ot.clear(),this.#ot=null),this.#ct=0)}#vt(t){const e=this.#lt.createElementNS(a,"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)}#mt(t){const e=this.#lt.createElementNS(a,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#gt.append(e),e}#At(t,e,i){const s=this.#lt.createElementNS(a,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}#ft(t,e,i,s){const n=this.#lt.createElementNS(a,"feComponentTransfer");
22s.append(n),this.#At(n,"feFuncR",t),this.#At(n,"feFuncG",e),this.#At(n,"feFuncB",i)}#bt(t){return this.#gt.style.color=t,T(getComputedStyle(this.#gt).getPropertyValue("color"))}}class h extends s.BaseCanvasFactory{constructor({ownerDocument:t=globalThis.document}={}){super(),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}async function l(t,e="text"){if(y(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new 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)=>{const n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType=e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(200!==n.status&&0!==n.status)s(new Error(n.statusText));else{switch(e){case"arraybuffer":case"blob":case"json":return void i(n.response)}i(n.responseText)}},n.send(null)}))}class d extends s.BaseCMapReaderFactory{_fetchData(t,e){return l(t,this.isCompressed?"arraybuffer":"text").then((t=>({cMapData:t instanceof ArrayBuffer?new Uint8Array(t):(0,n.stringToBytes)(t),compressionType:e})))}}class c extends s.BaseStandardFontDataFactory{_fetchData(t){return l(t,"arraybuffer").then((t=>new Uint8Array(t)))}}class u extends s.BaseSVGFactory{_createSVG(t){return document.createElementNS(a,t)}}class p{constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:n=0,dontFlip:a=!1}){this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=n;const r=(t[2]+t[0])/2,o=(t[3]+t[1])/2;let h,l,d,c,u,p,g,m;switch(i%=360,i<0&&(i+=360),i){case 180:h=-1,l=0,d=0,c=1;break;case 90:h=0,l=1,d=1,c=0;break;case 270:h=0,l=-1,d=-1,c=0;break;case 0:h=1,l=0,d=0,c=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(d=-d,c=-c),0===h?(u=Math.abs(o-t[1])*e+s,p=Math.abs(r-t[0])*e+n,g=(t[3]-t[1])*e,m=(t[2]-t[0])*e):(u=Math.abs(r-t[0])*e+s,p=Math.abs(o-t[1])*e+n,g=(t[2]-t[0])*e,m=(t[3]-t[1])*e),this.transform=[h*e,l*e,d*e,c*e,u-h*e*r-d*e*o,p-l*e*r-c*e*o],this.width=g,this.height=m}get rawDims(){const{viewBox:t}=this;return(0,n.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:n=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}convertToViewportPoint(t,e){return n.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=n.Util.applyTransform([t[0],t[1]],this.transform),i=n.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return n.Util.applyInverseTransform([t,e],this.transform)}}class g extends n.BaseException{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function m(t){const e=t.length;let i=0;while(i<e&&""===t[i].trim())i++;return"data:"===t.substring(i,i+5).toLowerCase()}function f(t){return"string"===typeof t&&/\.pdf$/i.test(t)}function b(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(m(t))return(0,n.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,a=i.exec(t);let r=s.exec(a[1])||s.exec(a[2])||s.exec(a[3]);if(r&&(r=r[0],r.includes("%")))try{r=s.exec(decodeURIComponent(r))[0]}catch{}return r||e}class A{started=Object.create(null);times=[];time(t){t in this.started&&(0,n.warn)(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,n.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(){const t=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:s,end:n}of this.times)t.push(`${i.padEnd(e)} ${n-s}ms\n`);return t.join("")}}function y(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch{return!1}}function w(t){t.preventDefault()}let _;class E{static toDateObject(t){if(!t||"string"!==typeof t)return null;_||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const e=_.exec(t);if(!e)return null;const i=parseInt(e[1],10);let s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;const h=e[7]||"Z";let l=parseInt(e[8],10);l=l>=0&&l<=23?l:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===h?(a+=l,r+=d):"+"===h&&(a-=l,r-=d),new Date(Date.UTC(i,s,n,a,r,o))}}function x(t,{scale:e=1,rotation:i=0}){const{width:s,height:n}=t.attributes.style,a=[0,0,parseInt(s),parseInt(n)];return new p({viewBox:a,scale:e,rotation:i})}function T(t){if(t.startsWith("#")){const 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,n.warn)(`Not a valid color format: "${t}"`),[0,0,0])}function S(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of t.keys()){e.style.color=i;const s=window.getComputedStyle(e).color;t.set(i,T(s))}e.remove()}function C(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform();return[e,i,s,n,a,r]}function M(t){const{a:e,b:i,c:s,d:n,e:a,f:r}=t.getTransform().invertSelf();return[e,i,s,n,a,r]}function P(t,e,i=!1,s=!0){if(e instanceof p){const{pageWidth:s,pageHeight:a}=e.rawDims,{style:r}=t,o=n.FeatureTest.isCSSRoundSupported,h=`var(--scale-factor) * ${s}px`,l=`var(--scale-factor) * ${a}px`,d=o?`round(${h}, 1px)`:`calc(${h})`,c=o?`round(${l}, 1px)`:`calc(${l})`;i&&e.rotation%180!==0?(r.width=c,r.height=d):(r.width=d,r.height=c)}s&&t.setAttribute("data-main-rotation",e.rotation)}},47:(t,e,i)=>{i.d(e,{DrawLayer:()=>a});var s=i(419),n=i(292);class a{#b=null;#ct=0;#yt=new Map;#wt=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(this.#b){if(this.#b!==t){if(this.#yt.size>0)for(const e of this.#yt.values())e.remove(),t.append(e);this.#b=t}}else this.#b=t}static get _svgFactory(){return(0,n.shadow)(this,"_svgFactory",new s.DOMSVGFactory)}static#_t(t,{x:e=0,y:i=0,width:s=1,height:n=1}={}){const{style:a}=t;a.top=100*i+"%",a.left=100*e+"%",a.width=100*s+"%",a.height=100*n+"%"}#Et(t){const e=a._svgFactory.create(1,1,!0);return this.#b.append(e),e.setAttribute("aria-hidden",!0),a.#_t(e,t),e}#xt(t,e){const i=a._svgFactory.createElement("clipPath");t.append(i);const s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");const n=a._svgFactory.createElement("use");return i.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),s}highlight(t,e,i,s=!1){const n=this.#ct++,r=this.#Et(t.box);r.classList.add("highlight"),t.free&&r.classList.add("free");const o=a._svgFactory.createElement("defs");r.append(o);const h=a._svgFactory.createElement("path");o.append(h);const l=`path_p${this.pageIndex}_${n}`;h.setAttribute("id",l),h.setAttribute("d",t.toSVGPath()),s&&this.#wt.set(n,h);const d=this.#xt(o,l),c=a._svgFactory.createElement("use");return r.append(c),r.setAttribute("fill",e),r.setAttribute("fill-opacity",i),c.setAttribute("href",`#${l}`),this.#yt.set(n,r),{id:n,clipPathId:`url(#${d})`}}highlightOutline(t){const e=this.#ct++,i=this.#Et(t.box);i.classList.add("highlightOutline");const s=a._svgFactory.createElement("defs");i.append(s);const n=a._svgFactory.createElement("path");s.append(n);const r=`path_p${this.pageIndex}_${e}`;let o;if(n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke"),t.free){i.classList.add("free");const t=a._svgFactory.createElement("mask");s.append(t),o=`mask_p${this.pageIndex}_${e}`,t.setAttribute("id",o),t.setAttribute("maskUnits","objectBoundingBox");const n=a._svgFactory.createElement("rect");t.append(n),n.setAttribute("width","1"),n.setAttribute("height","1"),n.setAttribute("fill","white");const h=a._svgFactory.createElement("use");t.append(h),h.setAttribute("href",`#${r}`),h.setAttribute("stroke","none"),h.setAttribute("fill","black"),h.setAttribute("fill-rule","nonzero"),h.classList.add("mask")}const h=a._svgFactory.createElement("use");i.append(h),h.setAttribute("href",`#${r}`),o&&h.setAttribute("mask",`url(#${o})`);const l=h.cloneNode();return i.append(l),h.classList.add("mainOutline"),l.classList.add("secondaryOutline"),this.#yt.set(e,i),e}finalizeLine(t,e){const i=this.#wt.get(t);this.#wt.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){const i=this.#yt.get(t),s=i.firstChild,n=s.firstChild;n.setAttribute("d",e.toSVGPath())}removeFreeHighlight(t){this.remove(t),this.#wt.delete(t)}updatePath(t,e){this.#wt.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){a.#_t(this.#yt.get(t),e)}show(t,e){this.#yt.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#yt.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#yt.get(t).setAttribute("fill",e)}
22changeOpacity(t,e){this.#yt.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#yt.get(t).classList.add(e)}removeClass(t,e){this.#yt.get(t).classList.remove(e)}remove(t){null!==this.#b&&(this.#yt.get(t).remove(),this.#yt.delete(t))}destroy(){this.#b=null;for(const t of this.#yt.values())t.remove();this.#yt.clear()}}},731:(t,e,i)=>{i.d(e,{AnnotationEditorLayer:()=>m});var s=i(292),n=i(310),a=i(830),r=i(976);const o=/\r\n?|\n/g;class h extends n.AnnotationEditor{#Tt=this.editorDivBlur.bind(this);#St=this.editorDivFocus.bind(this);#Ct=this.editorDivInput.bind(this);#Mt=this.editorDivKeydown.bind(this);#Pt=this.editorDivPaste.bind(this);#u;#kt="";#It=`${this.id}-editor`;#Rt;#Lt=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=h.prototype,e=t=>t.isEmpty(),i=a.AnnotationEditorUIManager.TRANSLATE_SMALL,n=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:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}static _type="freetext";static _editorType=s.AnnotationEditorType.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#u=t.color||h._defaultColor||n.AnnotationEditor._defaultLineColor,this.#Rt=t.fontSize||h._defaultFontSize}static initialize(t,e){n.AnnotationEditor.initialize(t,e,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case s.AnnotationEditorParamsType.FREETEXT_SIZE:h._defaultFontSize=e;break;case s.AnnotationEditorParamsType.FREETEXT_COLOR:h._defaultColor=e;break}}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Dt(e);break;case s.AnnotationEditorParamsType.FREETEXT_COLOR:this.#Ft(e);break}}static get defaultPropertiesToUpdate(){return[[s.AnnotationEditorParamsType.FREETEXT_SIZE,h._defaultFontSize],[s.AnnotationEditorParamsType.FREETEXT_COLOR,h._defaultColor||n.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[s.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Rt],[s.AnnotationEditorParamsType.FREETEXT_COLOR,this.#u]]}#Dt(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-this.#Rt)*this.parentScale),this.#Rt=t,this.#Ot()},i=this.#Rt;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})}#Ft(t){const e=t=>{this.#u=this.editorDiv.style.color=t},i=this.#u;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(){const t=this.parentScale;return[-h._internalPadding*t,-(h._internalPadding+this.#Rt)*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.#Mt),this.editorDiv.addEventListener("focus",this.#St),this.editorDiv.addEventListener("blur",this.#Tt),this.editorDiv.addEventListener("input",this.#Ct),this.editorDiv.addEventListener("paste",this.#Pt))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#It),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#Mt),this.editorDiv.removeEventListener("focus",this.#St),this.editorDiv.removeEventListener("blur",this.#Tt),this.editorDiv.removeEventListener("input",this.#Ct),this.editorDiv.removeEventListener("paste",this.#Pt),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()}#Nt(){const t=[];
22this.editorDiv.normalize();for(const e of this.editorDiv.childNodes)t.push(h.#Bt(e));return t.join("\n")}#Ot(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:t,div:e}=this,s=e.style.display;e.style.display="hidden",t.div.append(this.div),i=e.getBoundingClientRect(),e.remove(),e.style.display=s}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#kt,e=this.#kt=this.#Nt().trimEnd();if(t===e)return;const i=t=>{this.#kt=t,t?(this.#Ht(),this._uiManager.rebuild(this),this.#Ot()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#Ot()}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){h._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(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#It),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),n.AnnotationEditor._l10nPromise.get("pdfjs-free-text-default-content").then((t=>this.editorDiv?.setAttribute("default-content",t))),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#Rt}px * var(--scale-factor))`,i.color=this.#u,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){const[i,s]=this.parentDimensions;if(this.annotationElementId){const{position:n}=this.#Lt;let[a,r]=this.getInitialTranslation();[a,r]=this.pageTranslationToScreen(a,r);const[o,h]=this.pageDimensions,[l,d]=this.pageTranslation;let c,u;switch(this.rotation){case 0:c=t+(n[0]-l)/o,u=e+this.height-(n[1]-d)/h;break;case 90:c=t+(n[0]-l)/o,u=e-(n[1]-d)/h,[a,r]=[r,-a];break;case 180:c=t-this.width+(n[0]-l)/o,u=e-(n[1]-d)/h,[a,r]=[-a,-r];break;case 270:c=t+(n[0]-l-this.height*h)/o,u=e+(n[1]-d-this.width*o)/h,[a,r]=[-r,a];break}this.setAt(c*i,u*s,a,r)}else this.setAt(t*i,e*s,this.width*i,this.height*s);this.#Ht(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#Bt(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(o,"")}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const s=h.#Ut(e.getData("text")||"").replaceAll(o,"\n");if(!s)return;const n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();const a=n.getRangeAt(0);if(!s.includes("\n"))return a.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),void n.collapseToStart();const{startContainer:r,startOffset:l}=a,d=[],c=[];if(r.nodeType===Node.TEXT_NODE){const t=r.parentElement;if(c.push(r.nodeValue.slice(l).replaceAll(o,"")),t!==this.editorDiv){let e=d;for(const i of this.editorDiv.childNodes)i!==t?e.push(h.#Bt(i)):e=c}d.push(r.nodeValue.slice(0,l).replaceAll(o,""))}else if(r===this.editorDiv){let t=d,e=0;for(const i of this.editorDiv.childNodes)e++===l&&(t=c),t.push(h.#Bt(i))}this.#kt=`${d.join("\n")}${s}${c.join("\n")}`,this.#Ht();const u=new Range;let p=d.reduce(((t,e)=>t+e.length),0);for(const{firstChild:o}of this.editorDiv.childNodes)if(o.nodeType===Node.TEXT_NODE){const t=o.nodeValue.length;if(p<=t){u.setStart(o,p),u.setEnd(o,p);break}p-=t}n.removeAllRanges(),n.addRange(u)}#Ht(){if(this.editorDiv.replaceChildren(),this.#kt)for(const t of this.#kt.split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#zt(){return this.#kt.replaceAll(" "," ")}static#Ut(t){return t.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){let n=null;if(t instanceof r.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:a,rotation:r,id:o},textContent:h,textPosition:l,parent:{page:{pageNumber:d}}}=t;if(!h||0===h.length)return null;n=t={annotationType:s.AnnotationEditorType.FREETEXT,color:Array.from(i),fontSize:e,value:h.join("\n"),position:l,pageIndex:d-1,rect:a,rotation:r,id:o,deleted:!1}}const a=super.deserialize(t,e,i);return a.#Rt=t.fontSize,a.#u=s.Util.makeHexColor(...t.color),a.#kt=h.#Ut(t.value),a.annotationElementId=t.id||null,a.#Lt=n,a}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0}
22;const e=h._internalPadding*this.parentScale,i=this.getRect(e,e),a=n.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#u),r={annotationType:s.AnnotationEditorType.FREETEXT,color:a,fontSize:this.#Rt,value:this.#zt(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?r:this.annotationElementId&&!this.#jt(r)?null:(r.id=this.annotationElementId,r)}#jt(t){const{value:e,fontSize:i,color:s,pageIndex:n}=this.#Lt;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some(((t,e)=>t!==s[e]))||t.pageIndex!==n}}var l=i(61),d=i(259),c=i(419);class u extends n.AnnotationEditor{#Gt=null;#Vt=0;#$t;#Wt=null;#qt=null;#Kt=null;#Xt=null;#Yt=0;#Jt=null;#Qt=null;#ct=null;#Zt=!1;#te=this.#ee.bind(this);#ie=null;#se;#ne=null;#ae="";#re;#oe="";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(){const 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.#re=t.thickness||u._defaultThickness,this.#se=t.opacity||u._defaultOpacity,this.#$t=t.boxes||null,this.#oe=t.methodOfCreation||"",this.#ae=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#Zt=!0,this.#he(t),this.#le()):(this.#Gt=t.anchorNode,this.#Vt=t.anchorOffset,this.#Xt=t.focusNode,this.#Yt=t.focusOffset,this.#de(),this.#le(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#Zt?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#re,methodOfCreation:this.#oe}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#de(){const t=new l.Outliner(this.#$t,.001);this.#Qt=t.getOutlines(),({x:this.x,y:this.y,width:this.width,height:this.height}=this.#Qt.box);const e=new l.Outliner(this.#$t,.0025,.001,"ltr"===this._uiManager.direction);this.#Kt=e.getOutlines();const{lastPoint:i}=this.#Kt.box;this.#ie=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#he({highlightOutlines:t,highlightId:e,clipPathId:i}){this.#Qt=t;const s=1.5;if(this.#Kt=t.getNewOutline(this.#re/2+s,.0025),e>=0)this.#ct=e,this.#Wt=i,this.parent.drawLayer.finalizeLine(e,t),this.#ne=this.parent.drawLayer.highlightOutline(this.#Kt);else if(this.parent){const e=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#ct,t),this.parent.drawLayer.updateBox(this.#ct,u.#ce(this.#Qt.box,(e-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#ne,this.#Kt),this.parent.drawLayer.updateBox(this.#ne,u.#ce(this.#Kt.box,e))}const{x:n,y:a,width:r,height:o}=t.box;switch(this.rotation){case 0:this.x=n,this.y=a,this.width=r,this.height=o;break;case 90:{const[t,e]=this.parentDimensions;this.x=a,this.y=1-n,this.width=r*e/t,this.height=o*t/e;break}case 180:this.x=1-n,this.y=1-a,this.width=r,this.height=o;break;case 270:{const[t,e]=this.parentDimensions;this.x=1-a,this.y=n,this.width=r*e/t,this.height=o*t/e;break}}const{lastPoint:h}=this.#Kt.box;this.#ie=[(h[0]-n)/r,(h[1]-a)/o]}static initialize(t,e){n.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;break}}translateInPage(t,e){}get toolbarPosition(){return this.#ie}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.HIGHLIGHT_COLOR:this.#Ft(e);break;case s.AnnotationEditorParamsType.HIGHLIGHT_THICKNESS:this.#ue(e);break}}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.#re||u._defaultThickness],[s.AnnotationEditorParamsType.HIGHLIGHT_FREE,this.#Zt]]}#Ft(t){const e=t=>{this.color=t,this.parent?.drawLayer.changeColor(this.#ct,t),this.#qt?.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)}#ue(t){const e=this.#re,i=t=>{this.#re=t,this.#pe(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(){const t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&(this.#qt=new d.ColorPicker({editor:this}),t.addColorPicker(this.#qt)),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.#ge())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#ge())}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#me(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#le(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#me():t&&(this.#le(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#pe(t){if(!this.#Zt)return;this.#he({highlightOutlines:this.#Qt.getNewOutline(t/2)}),this.fixAndSetPosition();const[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#me(){null!==this.#ct&&this.parent&&(this.parent.drawLayer.remove(this.#ct),this.#ct=null,this.parent.drawLayer.remove(this.#ne),this.#ne=null)}#le(t=this.parent){null===this.#ct&&(({id:this.#ct,clipPathId:this.#Wt}=t.drawLayer.highlight(this.#Qt,this.color,this.#se)),this.#ne=t.drawLayer.highlightOutline(this.#Kt),this.#Jt&&(this.#Jt.style.clipPath=this.#Wt))}static#ce({x:t,y:e,width:i,height:s},n){switch(n){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){const{drawLayer:e}=this.parent;let i;this.#Zt?(t=(t-this.rotation+360)%360,i=u.#ce(this.#Qt.box,t)):i=u.#ce(this,t),e.rotate(this.#ct,t),e.rotate(this.#ne,t),e.updateBox(this.#ct,i),e.updateBox(this.#ne,u.#ce(this.#Kt.box,t))}
22render(){if(this.div)return this.div;const t=super.render();this.#ae&&(t.setAttribute("aria-label",this.#ae),t.setAttribute("role","mark")),this.#Zt?t.classList.add("free"):this.div.addEventListener("keydown",this.#te);const e=this.#Jt=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#Wt;const[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),(0,a.bindEvents)(this,this.#Jt,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.parent.drawLayer.addClass(this.#ne,"hovered")}pointerleave(){this.parent.drawLayer.removeClass(this.#ne,"hovered")}#ee(t){u._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#fe(!0);break;case 1:case 3:this.#fe(!1);break}}#fe(t){if(!this.#Gt)return;const e=window.getSelection();t?e.setPosition(this.#Gt,this.#Vt):e.setPosition(this.#Xt,this.#Yt)}select(){super.select(),this.#ne&&(this.parent?.drawLayer.removeClass(this.#ne,"hovered"),this.parent?.drawLayer.addClass(this.#ne,"selected"))}unselect(){super.unselect(),this.#ne&&(this.parent?.drawLayer.removeClass(this.#ne,"selected"),this.#Zt||this.#fe(!1))}get _mustFixPosition(){return!this.#Zt}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#ct,t),this.parent.drawLayer.show(this.#ne,t))}#ge(){return this.#Zt?this.rotation:0}#be(){if(this.#Zt)return null;const[t,e]=this.pageDimensions,i=this.#$t,s=new Array(8*i.length);let n=0;for(const{x:a,y:r,width:o,height:h}of i){const i=a*t,l=(1-r-h)*e;s[n]=s[n+4]=i,s[n+1]=s[n+3]=l,s[n+2]=s[n+6]=i+o*t,s[n+5]=s[n+7]=l+h*e,n+=8}return s}#ve(t){return this.#Qt.serialize(t,this.#ge())}static startHighlighting(t,e,{target:i,x:s,y:n}){const{x:a,y:r,width:o,height:h}=i.getBoundingClientRect(),d=e=>{this.#Ae(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.#ye(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 l.FreeOutliner({x:s,y:n},[a,r,o,h],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static#Ae(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#ye(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){const n=super.deserialize(t,e,i),{rect:[a,r,o,h],color:l,quadPoints:d}=t;n.color=s.Util.makeHexColor(...l),n.#se=t.opacity;const[c,u]=n.pageDimensions;n.width=(o-a)/c,n.height=(h-r)/u;const p=n.#$t=[];for(let s=0;s<d.length;s+=8)p.push({x:(d[4]-o)/c,y:(h-(1-d[s+5]))/u,width:(d[s+2]-d[s])/c,height:(d[s+5]-d[s+1])/u});return n.#de(),n}serialize(t=!1){if(this.isEmpty()||t)return null;const e=this.getRect(0,0),i=n.AnnotationEditor._colorManager.convert(this.color);return{annotationType:s.AnnotationEditorType.HIGHLIGHT,color:i,opacity:this.#se,thickness:this.#re,quadPoints:this.#be(),outlines:this.#ve(e),pageIndex:this.pageIndex,rect:e,rotation:this.#ge(),structTreeParentId:this._structTreeParentId}}static canCreateNewEmptyEditor(){return!1}}class p extends n.AnnotationEditor{#we=0;#_e=0;#Ee=this.canvasPointermove.bind(this);#xe=this.canvasPointerleave.bind(this);#Te=this.canvasPointerup.bind(this);#Se=this.canvasPointerdown.bind(this);#Ce=null;#Me=new Path2D;#Pe=!1;#ke=!1;#Ie=!1;#Re=null;#Le=0;#De=0;#Fe=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){n.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;break}}updateParams(t,e){switch(t){case s.AnnotationEditorParamsType.INK_THICKNESS:this.#ue(e);break;case s.AnnotationEditorParamsType.INK_COLOR:this.#Ft(e);break;case s.AnnotationEditorParamsType.INK_OPACITY:this.#Oe(e);break}}static get defaultPropertiesToUpdate(){return[[s.AnnotationEditorParamsType.INK_THICKNESS,p._defaultThickness],[s.AnnotationEditorParamsType.INK_COLOR,p._defaultColor||n.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||n.AnnotationEditor._defaultLineColor],[s.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??p._defaultOpacity))]]}#ue(t){const e=t=>{this.thickness=t,this.#Ne()},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})}#Ft(t){const e=t=>{this.color=t,this.#Be()},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})}#Oe(t){const e=t=>{this.opacity=t,this.#Be()};t/=100;const 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.#He(),this.#Ue()),this.isAttachedToDOM||(this.parent.add(this),this.#ze()),this.#Ne()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#Ce&&(clearTimeout(this.#Ce),this.#Ce=null),this.#Re.disconnect(),this.#Re=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){this.#Pe||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#Se))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#Se))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#je(){const{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]}}#Ge(){const{ctx:t,color:e,opacity:i,thickness:s,parentScale:n,scaleFactor:r}=this;
22t.lineWidth=s*n/r,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${(0,a.opacityToHex)(i)}`}#Ve(t,e){this.canvas.addEventListener("contextmenu",c.noContextMenu),this.canvas.addEventListener("pointerleave",this.#xe),this.canvas.addEventListener("pointermove",this.#Ee),this.canvas.addEventListener("pointerup",this.#Te),this.canvas.removeEventListener("pointerdown",this.#Se),this.isEditing=!0,this.#Ie||(this.#Ie=!0,this.#ze(),this.thickness||=p._defaultThickness,this.color||=p._defaultColor||n.AnnotationEditor._defaultLineColor,this.opacity??=p._defaultOpacity),this.currentPath.push([t,e]),this.#ke=!1,this.#Ge(),this.#Fe=()=>{this.#$e(),this.#Fe&&window.requestAnimationFrame(this.#Fe)},window.requestAnimationFrame(this.#Fe)}#We(t,e){const[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;const n=this.currentPath;let a=this.#Me;if(n.push([t,e]),this.#ke=!0,n.length<=2)return a.moveTo(...n[0]),void a.lineTo(t,e);3===n.length&&(this.#Me=a=new Path2D,a.moveTo(...n[0])),this.#qe(a,...n.at(-3),...n.at(-2),t,e)}#Ke(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);this.#Me.lineTo(...t)}#Xe(t,e){let i;if(this.#Fe=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#We(t,e),this.#Ke(),1!==this.currentPath.length)i=this.#Ye();else{const s=[t,e];i=[[s,s.slice(),s.slice(),s]]}const s=this.#Me,n=this.currentPath;this.currentPath=[],this.#Me=new Path2D;const a=()=>{this.allRawPaths.push(n),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},r=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#He(),this.#Ue()),this.#Ne())};this.addCommands({cmd:a,undo:r,mustExec:!0})}#$e(){if(!this.#ke)return;this.#ke=!1;const t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),i=e.map((t=>t[0])),s=e.map((t=>t[1])),{ctx:n}=(Math.min(...i),Math.max(...i),Math.min(...s),Math.max(...s),this);n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const a of this.bezierPath2D)n.stroke(a);n.stroke(this.#Me),n.restore()}#qe(t,e,i,s,n,a,r){const o=(e+s)/2,h=(i+n)/2,l=(s+a)/2,d=(n+r)/2;t.bezierCurveTo(o+2*(s-o)/3,h+2*(n-h)/3,l+2*(s-l)/3,d+2*(n-d)/3,l,d)}#Ye(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let i,[s,n]=t[0];for(i=1;i<t.length-2;i++){const[a,r]=t[i],[o,h]=t[i+1],l=(a+o)/2,d=(r+h)/2,c=[s+2*(a-s)/3,n+2*(r-n)/3],u=[l+2*(a-l)/3,d+2*(r-d)/3];e.push([[s,n],c,u,[l,d]]),[s,n]=[l,d]}const[a,r]=t[i],[o,h]=t[i+1],l=[s+2*(a-s)/3,n+2*(r-n)/3],d=[o+2*(a-o)/3,h+2*(r-h)/3];return e.push([[s,n],l,d,[o,h]]),e}#Be(){if(this.isEmpty())return void this.#Je();this.#Ge();const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#Je();for(const i of this.bezierPath2D)e.stroke(i)}commit(){this.#Pe||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Pe=!0,this.div.classList.add("disabled"),this.#Ne(!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.#Pe&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#Ve(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#We(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#Qe(t)}canvasPointerleave(t){this.#Qe(t)}#Qe(t){this.canvas.removeEventListener("pointerleave",this.#xe),this.canvas.removeEventListener("pointermove",this.#Ee),this.canvas.removeEventListener("pointerup",this.#Te),this.canvas.addEventListener("pointerdown",this.#Se),this.#Ce&&clearTimeout(this.#Ce),this.#Ce=setTimeout((()=>{this.#Ce=null,this.canvas.removeEventListener("contextmenu",c.noContextMenu)}),10),this.#Xe(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#He(){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")}#Ue(){this.#Re=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),this.#Re.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#Pe}
22render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,s,n,a]=this.#je();if(this.setAt(i,s,0,0),this.setDims(n,a),this.#He(),this.width){const[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.#Ie=!0,this.#ze(),this.setDims(this.width*i,this.height*s),this.#Be(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#Ue(),this.div}#ze(){if(!this.#Ie)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#Je()}setDimensions(t,e){const i=Math.round(t),s=Math.round(e);if(this.#Le===i&&this.#De===s)return;this.#Le=i,this.#De=s,this.canvas.style.visibility="hidden";const[n,a]=this.parentDimensions;this.width=t/n,this.height=e/a,this.fixAndSetPosition(),this.#Pe&&this.#Ze(t,e),this.#ze(),this.#Be(),this.canvas.style.visibility="visible",this.fixDims()}#Ze(t,e){const i=this.#ti(),s=(t-i)/this.#_e,n=(e-i)/this.#we;this.scaleFactor=Math.min(s,n)}#Je(){const t=this.#ti()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#ei(t){const e=new Path2D;for(let i=0,s=t.length;i<s;i++){const[s,n,a,r]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(n[0],n[1],a[0],a[1],r[0],r[1])}return e}static#ii(t,e,i){const[s,n,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]+s,t[e+1]=i+n}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=a-t[e],t[e+1]+=n;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=a-t[e+1],t[e+1]=r-i}break;default:throw new Error("Invalid rotation")}return t}static#si(t,e,i){const[s,n,a,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=t[e+1]-n,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]-=n;break;case 270:for(let e=0,i=t.length;e<i;e+=2){const i=t[e];t[e]=r-t[e+1],t[e+1]=a-i}break;default:throw new Error("Invalid rotation")}return t}#ni(t,e,i,s){const n=[],a=this.thickness/2,r=t*e+a,o=t*i+a;for(const h of this.paths){const e=[],i=[];for(let s=0,n=h.length;s<n;s++){const[a,l,d,c]=h[s];if(a[0]===c[0]&&a[1]===c[1]&&1===n){const s=t*a[0]+r,n=t*a[1]+o;e.push(s,n),i.push(s,n);break}const u=t*a[0]+r,p=t*a[1]+o,g=t*l[0]+r,m=t*l[1]+o,f=t*d[0]+r,b=t*d[1]+o,v=t*c[0]+r,A=t*c[1]+o;0===s&&(e.push(u,p),i.push(u,p)),e.push(g,m,f,b,v,A),i.push(g,m),s===n-1&&i.push(v,A)}n.push({bezier:p.#ii(e,s,this.rotation),points:p.#ii(i,s,this.rotation)})}return n}#ai(){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const a of this.paths)for(const[r,o,h,l]of a){const a=s.Util.bezierBoundingBox(...r,...o,...h,...l);t=Math.min(t,a[0]),i=Math.min(i,a[1]),e=Math.max(e,a[2]),n=Math.max(n,a[3])}return[t,i,e,n]}#ti(){return this.#Pe?Math.ceil(this.thickness*this.parentScale):0}#Ne(t=!1){if(this.isEmpty())return;if(!this.#Pe)return void this.#Be();const e=this.#ai(),i=this.#ti();this.#_e=Math.max(n.AnnotationEditor.MIN_SIZE,e[2]-e[0]),this.#we=Math.max(n.AnnotationEditor.MIN_SIZE,e[3]-e[1]);const s=Math.ceil(i+this.#_e*this.scaleFactor),a=Math.ceil(i+this.#we*this.scaleFactor),[r,o]=this.parentDimensions;this.width=s/r,this.height=a/o,this.setAspectRatio(s,a);const h=this.translationX,l=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#ze(),this.#Be(),this.#Le=s,this.#De=a,this.setDims(s,a);const d=t?i/this.scaleFactor/2:0;this.translate(h-this.translationX-d,l-this.translationY-d)}static deserialize(t,e,i){if(t instanceof r.InkAnnotationElement)return null;const a=super.deserialize(t,e,i);a.thickness=t.thickness,a.color=s.Util.makeHexColor(...t.color),a.opacity=t.opacity;const[o,h]=a.pageDimensions,l=a.width*o,d=a.height*h,c=a.parentScale,u=t.thickness/2;a.#Pe=!0,a.#Le=Math.round(l),a.#De=Math.round(d);const{paths:g,rect:m,rotation:f}=t;for(let{bezier:s}of g){s=p.#si(s,m,f);const t=[];a.paths.push(t);let e=c*(s[0]-u),i=c*(s[1]-u);for(let a=2,r=s.length;a<r;a+=6){const n=c*(s[a]-u),r=c*(s[a+1]-u),o=c*(s[a+2]-u),h=c*(s[a+3]-u),l=c*(s[a+4]-u),d=c*(s[a+
225]-u);t.push([[e,i],[n,r],[o,h],[l,d]]),e=l,i=d}const n=this.#ei(t);a.bezierPath2D.push(n)}const b=a.#ai();return a.#_e=Math.max(n.AnnotationEditor.MIN_SIZE,b[2]-b[0]),a.#we=Math.max(n.AnnotationEditor.MIN_SIZE,b[3]-b[1]),a.#Ze(l,d),a}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=n.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:s.AnnotationEditorType.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#ni(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class g extends n.AnnotationEditor{#ri=null;#oi=null;#hi=null;#li=null;#di=null;#ci="";#ui=null;#Re=null;#pi=null;#gi=!1;#mi=!1;static _type="stamp";static _editorType=s.AnnotationEditorType.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#li=t.bitmapUrl,this.#di=t.bitmapFile}static initialize(t,e){n.AnnotationEditor.initialize(t,e)}static get supportedTypes(){const t=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,s.shadow)(this,"supportedTypes",t.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()})}#fi(t,e=!1){t?(this.#ri=t.bitmap,e||(this.#oi=t.id,this.#gi=t.isSvg),t.file&&(this.#ci=t.file.name),this.#He()):this.remove()}#bi(){this.#hi=null,this._uiManager.enableWaiting(!1),this.#ui&&this.div.focus()}#vi(){if(this.#oi)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#oi).then((t=>this.#fi(t,!0))).finally((()=>this.#bi()));if(this.#li){const t=this.#li;return this.#li=null,this._uiManager.enableWaiting(!0),void(this.#hi=this._uiManager.imageManager.getFromUrl(t).then((t=>this.#fi(t))).finally((()=>this.#bi())))}if(this.#di){const t=this.#di;return this.#di=null,this._uiManager.enableWaiting(!0),void(this.#hi=this._uiManager.imageManager.getFromFile(t).then((t=>this.#fi(t))).finally((()=>this.#bi())))}const t=document.createElement("input");t.type="file",t.accept=g.supportedTypesStr,this.#hi=new Promise((e=>{t.addEventListener("change",(async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);const e=await this._uiManager.imageManager.getFromFile(t.files[0]);this.#fi(e)}else this.remove();e()})),t.addEventListener("cancel",(()=>{this.remove(),e()}))})).finally((()=>this.#bi())),t.click()}remove(){this.#oi&&(this.#ri=null,this._uiManager.imageManager.deleteId(this.#oi),this.#ui?.remove(),this.#ui=null,this.#Re?.disconnect(),this.#Re=null,this.#pi&&(clearTimeout(this.#pi),this.#pi=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#oi&&null===this.#ui&&this.#vi(),this.isAttachedToDOM||this.parent.add(this))):this.#oi&&this.#vi()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#hi||this.#ri||this.#li||this.#di||this.#oi)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),this.#ri?this.#He():this.#vi(),this.width){const[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}#He(){const{div:t}=this;let{width:e,height:i}=this.#ri;const[s,n]=this.pageDimensions,a=.75;if(this.width)e=this.width*s,i=this.height*n;else if(e>a*s||i>a*n){const t=Math.min(a*s/e,a*n/i);e*=t,i*=t}const[r,o]=this.parentDimensions;this.setDims(e*r/s,i*o/n),this._uiManager.enableWaiting(!1);const h=this.#ui=document.createElement("canvas");t.append(h),t.hidden=!1,this.#Ai(e,i),this.#Ue(),this.#mi||(this.parent.addUndoableEditor(this),this.#mi=!0),this._reportTelemetry({action:"inserted_image"}),this.#ci&&h.setAttribute("aria-label",this.#ci)}#yi(t,e){const[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.#pi&&clearTimeout(this.#pi);const n=200;this.#pi=setTimeout((()=>{this.#pi=null,this.#Ai(t,e)}),n)}#wi(t,e){const{width:i,height:s}=this.#ri;let n=i,a=s,r=this.#ri;while(n>2*t||a>2*e){const i=n,s=a;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));const o=new OffscreenCanvas(n,a),h=o.getContext("2d");h.drawImage(r,0,0,i,s,0,0,n,a),r=o.transferToImageBitmap()}return r}#Ai(t,e){t=Math.ceil(t),e=Math.ceil(e);const i=this.#ui;if(!i||i.width===t&&i.height===e)return;i.width=t,i.height=e;const s=this.#gi?this.#ri:this.#wi(t,e);if(this._uiManager.hasMLManager&&!this.hasAltText()){const i=new OffscreenCanvas(t,e),n=i.getContext("2d");n.drawImage(s,0,0,s.width,s.height,0,0,t,e),i.convertToBlob().then((t=>{const e=new FileReader;e.onload=()=>{const t=e.result;this._uiManager.mlGuess({service:"image-to-text",request:{imageData:t}}).then((t=>{const e=t?.output||"";this.parent&&e&&!this.hasAltText()&&(this.altTextData={altText:e,decorative:!1})}
22))},e.readAsDataURL(t)}))}const n=i.getContext("2d");n.filter=this._uiManager.hcmFilter,n.drawImage(s,0,0,s.width,s.height,0,0,t,e)}getImageForAltText(){return this.#ui}#_i(t){if(t){if(this.#gi){const t=this._uiManager.imageManager.getSvgUrl(this.#oi);if(t)return t}const t=document.createElement("canvas");({width:t.width,height:t.height}=this.#ri);const e=t.getContext("2d");return e.drawImage(this.#ri,0,0),t.toDataURL()}if(this.#gi){const[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),n=new OffscreenCanvas(i,s),a=n.getContext("2d");return a.drawImage(this.#ri,0,0,this.#ri.width,this.#ri.height,0,0,i,s),n.transferToImageBitmap()}return structuredClone(this.#ri)}#Ue(){this.#Re=new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.#yi(e.width,e.height)})),this.#Re.observe(this.div)}static deserialize(t,e,i){if(t instanceof r.StampAnnotationElement)return null;const s=super.deserialize(t,e,i),{rect:n,bitmapUrl:a,bitmapId:o,isSvg:h,accessibilityData:l}=t;o&&i.imageManager.isValidId(o)?s.#oi=o:s.#li=a,s.#gi=h;const[d,c]=s.pageDimensions;return s.width=(n[2]-n[0])/d,s.height=(n[3]-n[1])/c,l&&(s.altTextData=l),s}serialize(t=!1,e=null){if(this.isEmpty())return null;const i={annotationType:s.AnnotationEditorType.STAMP,bitmapId:this.#oi,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#gi,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#_i(!0),i.accessibilityData=this.altTextData,i;const{decorative:n,altText:a}=this.altTextData;if(!n&&a&&(i.accessibilityData={type:"Figure",alt:a}),null===e)return i;e.stamps||=new Map;const r=this.#gi?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#oi)){if(this.#gi){const t=e.stamps.get(this.#oi);r>t.area&&(t.area=r,t.serialized.bitmap.close(),t.serialized.bitmap=this.#_i(!1))}}else e.stamps.set(this.#oi,{area:r,serialized:i}),i.bitmap=this.#_i(!1);return i}}class m{#R;#Ei=!1;#xi=null;#Ti=null;#Si=null;#Ci=null;#Mi=null;#Pi=new Map;#ki=!1;#Ii=!1;#Ri=!1;#Li=null;#Di;static _initialized=!1;static#Fi=new Map([h,p,g,u].map((t=>[t._editorType,t])));constructor({uiManager:t,pageIndex:e,div:i,accessibilityManager:s,annotationLayer:n,drawLayer:a,textLayer:r,viewport:o,l10n:h}){const l=[...m.#Fi.values()];if(!m._initialized){m._initialized=!0;for(const e of l)e.initialize(h,t)}t.registerEditorTypes(l),this.#Di=t,this.pageIndex=e,this.div=i,this.#R=s,this.#xi=n,this.viewport=o,this.#Li=r,this.drawLayer=a,this.#Di.addLayer(this)}get isEmpty(){return 0===this.#Pi.size}get isInvisible(){return this.isEmpty&&this.#Di.getMode()===s.AnnotationEditorType.NONE}updateToolbar(t){this.#Di.updateToolbar(t)}updateMode(t=this.#Di.getMode()){switch(this.#Oi(),t){case s.AnnotationEditorType.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();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);const{classList:e}=this.div;for(const i of m.#Fi.values())e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#Li?.div}addInkEditorIfNeeded(t){if(this.#Di.getMode()!==s.AnnotationEditorType.INK)return;if(!t)for(const i of this.#Pi.values())if(i.isEmpty())return void i.setInBackground();const e=this.createAndAddNewEditor({offsetX:0,offsetY:0},!1);e.setInBackground()}setEditingState(t){this.#Di.setEditingState(t)}addCommands(t){this.#Di.addCommands(t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#xi?.div.classList.toggle("disabled",!t)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const t=new Set;for(const i of this.#Pi.values())i.enableEditing(),i.annotationElementId&&t.add(i.annotationElementId);if(!this.#xi)return;const e=this.#xi.getEditableAnnotations();for(const i of e){if(i.hide(),this.#Di.isDeletedAnnotationElement(i.data.id))continue;if(t.has(i.data.id))continue;const e=this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}}disable(){this.#Ri=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const t=new Set;for(const i of this.#Pi.values())i.disableEditing(),i.annotationElementId&&null===i.serialize()?(this.getEditableAnnotation(i.annotationElementId)?.show(),i.remove()):t.add(i.annotationElementId);if(this.#xi){const e=this.#xi.getEditableAnnotations();for(const i of e){const{id:e}=i.data;t.has(e)||this.#Di.isDeletedAnnotationElement(e)||i.show()}}this.#Oi(),this.isEmpty&&(this.div.hidden=!0);const{classList:e}=this.div;for(const i of m.#Fi.values())e.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#Ri=!1}getEditableAnnotation(t){return this.#xi?.getEditableAnnotation(t)||null}setActiveEditor(t){const e=this.#Di.getActive();e!==t&&this.#Di.setActiveEditor(t)}enableTextSelection(){this.div.tabIndex=-1,this.#Li?.div&&!this.#Ci&&(this.#Ci=this.#Ni.bind(this),this.#Li.div.addEventListener("pointerdown",this.#Ci),this.#Li.div.classList.add("highlighting"))}disableTextSelection(){this.div.tabIndex=0,this.#Li?.div&&this.#Ci&&(this.#Li.div.removeEventListener("pointerdown",this.#Ci),this.#Ci=null,this.#Li.div.classList.remove("highlighting"))}#Ni(t){if(this.#Di.unselectAll(),t.target===this.#Li.div){const{isMac:e}=s.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e)return;this.#Di.showAllEditors("highlight",!0,!0),this.#Li.div.classList.add("free"),u.startHighlighting(this,"ltr"===this.#Di.direction,t),this.#Li.div.addEventListener("pointerup",(()=>{this.#Li.div.classList.remove("free")}),{once:!0}),t.preventDefault()}}enableClick(){this.#Si||(this.#Si=this.pointerdown.bind(this),this.#Ti=this.pointerup.bind(this),this.div.addEventListener("pointerdown",this.#Si),this.div.addEventListener("pointerup",this.#Ti))}disableClick(){this.#Si&&(this.div.removeEventListener("pointerdown",this.#Si),this.div.removeEventListener("pointerup",this.#Ti),this.#Si=null,this.#Ti=null)}attach(t){this.#Pi.set(t.id,t);const{annotationElementId:e}=t;e&&this.#Di.isDeletedAnnotationElement(e)&&this.#Di.removeDeletedAnnotationElement(t)}detach(t){this.#Pi.delete(t.id),this.#R?.removePointerInTextLayer(t.contentDiv),!this.#Ri&&t.annotationElementId&&this.#Di.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#Di.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,this.#Ii||this.addInkEditorIfNeeded(!1)}changeParent(t){t.parent!==this&&(t.annotationElementId&&(this.#Di.addDeletedAnnotationElement(t.annotationElementId),n.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.#Di.addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),this.#Di.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;const{activeElement:e}=document;t.div.contains(e)&&!this.#Mi&&(t._focusEventsAllowed=!1,this.#Mi=setTimeout((()=>{this.#Mi=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0}),e.focus())}),0)),t._structTreeParentId=this.#R?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){const e=()=>t._uiManager.rebuild(t),i=()=>{t.remove()};this.addCommands({cmd:e,undo:i,mustExec:!1})}getNextId(){return this.#Di.getId()}get#Bi(){return m.#Fi.get(this.#Di.getMode())}#Hi(t){const e=this.#Bi;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#Bi?.canCreateNewEmptyEditor()}pasteEditor(t,e){this.#Di.updateToolbar(t),this.#Di.updateMode(t);const{offsetX:i,offsetY:s}=this.#Ui(),n=this.getNextId(),a=this.#Hi({parent:this,id:n,x:i,y:s,uiManager:this.#Di,isCentered:!0,...e});a&&this.add(a)}deserialize(t){return m.#Fi.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#Di)||null}createAndAddNewEditor(t,e,i={}){const s=this.getNextId(),n=this.#Hi({parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:this.#Di,isCentered:e,...i});return n&&this.add(n),n}#Ui(){const{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),n=Math.max(0,t),a=Math.max(0,e),r=Math.min(window.innerWidth,t+i),o=Math.min(window.innerHeight,e+s),h=(n+r)/2-t,l=(a+o)/2-e,[d,c]=this.viewport.rotation%180===0?[h,l]:[l,h];return{offsetX:d,offsetY:c}}addNewEditor(){this.createAndAddNewEditor(this.#Ui(),!0)}setSelected(t){this.#Di.setSelected(t)}toggleSelected(t){this.#Di.toggleSelected(t)}isSelected(t){return this.#Di.isSelected(t)}unselect(t){this.#Di.unselect(t)}pointerup(t){const{isMac:e}=s.FeatureTest.platform;0!==t.button||t.ctrlKey&&e||t.target===this.div&&this.#ki&&(this.#ki=!1,this.#Ei?this.#Di.getMode()!==s.AnnotationEditorType.STAMP?this.createAndAddNewEditor(t,!1):this.#Di.unselectAll():this.#Ei=!0)}pointerdown(t){if(this.#Di.getMode()===s.AnnotationEditorType.HIGHLIGHT&&this.enableTextSelection(),this.#ki)return void(this.#ki=!1);const{isMac:e}=s.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;this.#ki=!0;const i=this.#Di.getActive();this.#Ei=!i||i.isEmpty()}findNewParent(t,e,i){const s=this.#Di.findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){this.#Di.getActive()?.parent===this&&(this.#Di.commitOrRemove(),this.#Di.setActiveEditor(null)),this.#Mi&&(clearTimeout(this.#Mi),this.#Mi=null);for(const t of this.#Pi.values())this.#R?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#Pi.clear(),this.#Di.removeLayer(this)}#Oi(){this.#Ii=!0;for(const t of this.#Pi.values())t.isEmpty()&&t.remove();this.#Ii=!1}render({viewport:t}){this.viewport=t,(0,c.setLayerDimensions)(this.div,t);for(const e of this.#Di.getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:t}){this.#Di.commitOrRemove(),this.#Oi();const e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,(0,c.setLayerDimensions)(this.div,{rotation:i}),e!==i)for(const s of this.#Pi.values())s.rotate(i);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#Di.viewParameters.realScale}}},259:(t,e,i)=>{i.d(e,{ColorPicker:()=>r});var s=i(292),n=i(830),a=i(419);class r{#n=this.#a.bind(this);#zi=this.#ji.bind(this);#Gi=null;#Vi=null;#$i;#Wi=null;#qi=!1;#Ki=!1;#Xi=null;#Yi;#Di=null;#Ji;static get _keyboardManager(){return(0,s.shadow)(this,"_keyboardManager",new n.KeyboardManager([[["Escape","mac+Escape"],r.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],r.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],r.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],r.prototype._moveToPrevious],[["Home","mac+Home"],r.prototype._moveToBeginning],[["End","mac+End"],r.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#Ki=!1,this.#Ji=s.AnnotationEditorParamsType.HIGHLIGHT_COLOR,this.#Xi=t):(this.#Ki=!0,this.#Ji=s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR),this.#Di=t?._uiManager||e,this.#Yi=this.#Di._eventBus,this.#$i=t?.color||this.#Di?.highlightColors.values().next().value||"#FFFF98"}renderButton(){const t=this.#Gi=document.createElement("button");
22t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0),t.addEventListener("click",this.#Qi.bind(this)),t.addEventListener("keydown",this.#n);const e=this.#Vi=document.createElement("span");return e.className="swatch",e.setAttribute("aria-hidden",!0),e.style.backgroundColor=this.#$i,t.append(e),t}renderMainDropdown(){const t=this.#Wi=this.#Zi();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#Zi(){const t=document.createElement("div");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");for(const[e,i]of this.#Di.highlightColors){const 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}`);const n=document.createElement("span");s.append(n),n.className="swatch",n.style.backgroundColor=i,s.setAttribute("aria-selected",i===this.#$i),s.addEventListener("click",this.#ts.bind(this,i)),t.append(s)}return t.addEventListener("keydown",this.#n),t}#ts(t,e){e.stopPropagation(),this.#Yi.dispatch("switchannotationeditorparams",{source:this,type:this.#Ji,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#Gi)return void this.#Qi(t);const e=t.target.getAttribute("data-color");e&&this.#ts(e,t)}_moveToNext(t){this.#es?t.target!==this.#Gi?t.target.nextSibling?.focus():this.#Wi.firstChild?.focus():this.#Qi(t)}_moveToPrevious(t){t.target!==this.#Wi?.firstChild&&t.target!==this.#Gi?(this.#es||this.#Qi(t),t.target.previousSibling?.focus()):this.#es&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){this.#es?this.#Wi.firstChild?.focus():this.#Qi(t)}_moveToEnd(t){this.#es?this.#Wi.lastChild?.focus():this.#Qi(t)}#a(t){r._keyboardManager.exec(this,t)}#Qi(t){if(this.#es)return void this.hideDropdown();if(this.#qi=0===t.detail,window.addEventListener("pointerdown",this.#zi),this.#Wi)return void this.#Wi.classList.remove("hidden");const e=this.#Wi=this.#Zi();this.#Gi.append(e)}#ji(t){this.#Wi?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#Wi?.classList.add("hidden"),window.removeEventListener("pointerdown",this.#zi)}get#es(){return this.#Wi&&!this.#Wi.classList.contains("hidden")}_hideDropdownFromKeyboard(){this.#Ki||(this.#es?(this.hideDropdown(),this.#Gi.focus({preventScroll:!0,focusVisible:this.#qi})):this.#Xi?.unselect())}updateColor(t){if(this.#Vi&&(this.#Vi.style.backgroundColor=t),!this.#Wi)return;const e=this.#Di.highlightColors.values();for(const i of this.#Wi.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#Gi?.remove(),this.#Gi=null,this.#Vi=null,this.#Wi?.remove(),this.#Wi=null}}},310:(t,e,i)=>{i.d(e,{AnnotationEditor:()=>h});var s=i(830),n=i(292),a=i(419);class r{#is="";#ss=!1;#ns=null;#as=null;#rs=null;#os=!1;#Xi=null;static _l10nPromise=null;constructor(t){this.#Xi=t}static initialize(t){r._l10nPromise||=t}async render(){const t=this.#ns=document.createElement("button");t.className="altText";const e=await r._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()));const i=t=>{t.preventDefault(),this.#Xi._uiManager.editAltText(this.#Xi)};return t.addEventListener("click",i,{capture:!0}),t.addEventListener("keydown",(e=>{e.target===t&&"Enter"===e.key&&(this.#os=!0,i(e))})),await this.#hs(),t}finish(){this.#ns&&(this.#ns.focus({focusVisible:this.#os}),this.#os=!1)}isEmpty(){return!this.#is&&!this.#ss}get data(){return{altText:this.#is,decorative:this.#ss}}set data({altText:t,decorative:e}){this.#is===t&&this.#ss===e||(this.#is=t,this.#ss=e,this.#hs())}toggle(t=!1){this.#ns&&(!t&&this.#rs&&(clearTimeout(this.#rs),this.#rs=null),this.#ns.disabled=!t)}destroy(){this.#ns?.remove(),this.#ns=null,this.#as=null}async#hs(){const t=this.#ns;if(!t)return;if(!this.#is&&!this.#ss)return t.classList.remove("done"),void this.#as?.remove();t.classList.add("done"),r._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then((e=>{t.setAttribute("aria-label",e)}));let e=this.#as;if(!e){this.#as=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip");const i=e.id=`alt-text-tooltip-${this.#Xi.id}`;t.setAttribute("aria-describedby",i);const s=100;t.addEventListener("mouseenter",(()=>{this.#rs=setTimeout((()=>{this.#rs=null,this.#as.classList.add("show"),this.#Xi._reportTelemetry({action:"alt_text_tooltip"})}),s)})),t.addEventListener("mouseleave",(()=>{this.#rs&&(clearTimeout(this.#rs),this.#rs=null),this.#as?.classList.remove("show")}))}e.innerText=this.#ss?await r._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#is,e.parentNode||t.append(e);const i=this.#Xi.getImageForAltText();i?.setAttribute("aria-describedby",e.id)}}var o=i(362);class h{#ls=null;#is=null;#ds=!1;#cs=!1;#us=null;#ps=null;#gs=this.focusin.bind(this);#ms=this.focusout.bind(this);#fs=null;#bs="";#vs=!1;#As=null;#ys=!1;#ws=!1;#_s=!1;#Es=null;#xs=0;#Ts=0;#Ss=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#Cs=!1;#Ms=h._zIndex++;static _borderLineWidth=-1;static _colorManager=new s.ColorManager;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=h.prototype._resizeWithKeyboard,e=s.AnnotationEditorUIManager.TRANSLATE_SMALL,i=s.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,n.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"],h.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===h&&(0,n.unreachable)("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[a,r];const[o,l]=this.parentDimensions;this.x=t.x/o,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,n.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new l({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(h._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(const n of i.strings)h._l10nPromise.set(n,t.get(n));if(-1!==h._borderLineWidth)return;const s=getComputedStyle(document.documentElement);h._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,n.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#Cs}set _isDraggable(t){this.#Cs=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[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;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
22setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#Ms}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#Ps(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#vs?this.#vs=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const 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){const[n,a]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/n,this.y=(e+s)/a,this.fixAndSetPosition()}#ks([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this.fixAndSetPosition()}translate(t,e){this.#ks(this.parentDimensions,t,e)}translateInPage(t,e){this.#As||=[this.x,this.y],this.#ks(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#As||=[this.x,this.y];const[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)){const{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:n,y:a}=this;const[r,o]=this.getBaseTranslation();n+=r,a+=o,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#As&&(this.#As[0]!==this.x||this.#As[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=h,s=i/t,n=i/e;switch(this.rotation){case 90:return[-s,n];case 180:return[s,n];case 270:return[s,-n];default:return[-s,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,i]=this.pageDimensions;let{x:s,y:n,width:a,height:r}=this;if(a*=e,r*=i,s*=e,n*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-a,s)),n=Math.max(0,Math.min(i-r,n));break;case 90:s=Math.max(0,Math.min(e-r,s)),n=Math.min(i,Math.max(a,n));break;case 180:s=Math.min(e,Math.max(a,s)),n=Math.min(i,Math.max(r,n));break;case 270:s=Math.min(e,Math.max(r,s)),n=Math.max(0,Math.min(i-a,n));break}this.x=s/=e,this.y=n/=i;const[o,h]=this.getBaseTranslation();s+=o,n+=h;const{style:l}=this.div;l.left=`${(100*s).toFixed(2)}%`,l.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#Is(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 h.#Is(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return h.#Is(t,e,360-this.parentRotation)}#Rs(t){switch(t){case 90:{const[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[e,i]}=this,s=e*t,a=i*t;return n.FeatureTest.isCSSRoundSupported?[Math.round(s),Math.round(a)]:[s,a]}setDims(t,e){const[i,s]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#cs||(this.div.style.height=`${(100*e/s).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),n=!this.#cs&&e.endsWith("%");if(s&&n)return;const[a,r]=this.parentDimensions;s||(t.width=`${(100*parseFloat(i)/a).toFixed(2)}%`),this.#cs||n||(t.height=`${(100*parseFloat(e)/r).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#Ls(){if(this.#us)return;this.#us=document.createElement("div"),this.#us.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"];for(const e of t){const t=document.createElement("div");this.#us.append(t),t.classList.add("resizer",e),t.setAttribute("data-resizer-name",e),t.addEventListener("pointerdown",this.#Ds.bind(this,e)),t.addEventListener("contextmenu",a.noContextMenu),t.tabIndex=-1}this.div.prepend(this.#us)}#Ds(t,e){e.preventDefault();const{isMac:i}=n.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#is?.toggle(!1);const s=this.#Fs.bind(this,t),a=this._isDraggable;this._isDraggable=!1;const r={passive:!0,capture:!0};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",s,r);const o=this.x,h=this.y,l=this.width,d=this.height,c=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const p=()=>{this.parent.togglePointerEvents(!0),this.#is?.toggle(!0),this._isDraggable=a,window.removeEventListener("pointerup",p),window.removeEventListener("blur",p),window.removeEventListener("pointermove",s,r),this.parent.div.style.cursor=c,this.div.style.cursor=u,this.#Os(o,h,l,d)};window.addEventListener("pointerup",p),window.addEventListener("blur",p)}#Os(t,e,i,s){const n=this.x,a=this.y,r=this.width,o=this.height;n===t&&a===e&&r===i&&o===s||this.addCommands({cmd:()=>{this.width=r,this.height=o,this.x=n,this.y=a;const[t,e]=this.parentDimensions;this.setDims(t*r,e*o),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;const[n,a]=this.parentDimensions;this.setDims(n*i,a*s),this.fixAndSetPosition()},mustExec:!0})}#Fs(t,e){const[i,s]=this.parentDimensions,n=this.x,a=this.y,r=this.width,o=this.height,l=h.MIN_SIZE/i,d=h.MIN_SIZE/s,c=t=>Math.round(1e4*t)/1e4,u=this.#Rs(this.rotation),p=(t,e)=>[u[0]*t+u[2]*e,u[1]*t+u[3]*e],g=this.#Rs(360-this.rotation),m=(t,e)=>[g[0]*t+g[2]*e,g[1]*t+g[3]*e];let f,b,v=!1,A=!1;switch(t){case"topLeft":v=!0,f=(t,e)=>
22[0,0],b=(t,e)=>[t,e];break;case"topMiddle":f=(t,e)=>[t/2,0],b=(t,e)=>[t/2,e];break;case"topRight":v=!0,f=(t,e)=>[t,0],b=(t,e)=>[0,e];break;case"middleRight":A=!0,f=(t,e)=>[t,e/2],b=(t,e)=>[0,e/2];break;case"bottomRight":v=!0,f=(t,e)=>[t,e],b=(t,e)=>[0,0];break;case"bottomMiddle":f=(t,e)=>[t/2,e],b=(t,e)=>[t/2,0];break;case"bottomLeft":v=!0,f=(t,e)=>[0,e],b=(t,e)=>[t,0];break;case"middleLeft":A=!0,f=(t,e)=>[0,e/2],b=(t,e)=>[t,e/2];break}const y=f(r,o),w=b(r,o);let _=p(...w);const E=c(n+_[0]),x=c(a+_[1]);let T=1,S=1,[C,M]=this.screenToPageTranslation(e.movementX,e.movementY);if([C,M]=m(C/i,M/s),v){const t=Math.hypot(r,o);T=S=Math.max(Math.min(Math.hypot(w[0]-y[0]-C,w[1]-y[1]-M)/t,1/r,1/o),l/r,d/o)}else A?T=Math.max(l,Math.min(1,Math.abs(w[0]-y[0]-C)))/r:S=Math.max(d,Math.min(1,Math.abs(w[1]-y[1]-M)))/o;const P=c(r*T),k=c(o*S);_=p(...b(P,k));const I=E-_[0],R=x-_[1];this.width=P,this.height=k,this.x=I,this.y=R,this.setDims(i*P,s*k),this.fixAndSetPosition()}altTextFinish(){this.#is?.finish()}async addEditToolbar(){return this.#fs||this.#ws||(this.#fs=new o.EditorToolbar(this),this.div.append(this.#fs.render()),this.#is&&this.#fs.addAltTextButton(await this.#is.render())),this.#fs}removeEditToolbar(){this.#fs&&(this.#fs.remove(),this.#fs=null,this.#is?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#is||(r.initialize(h._l10nPromise),this.#is=new r(this),await this.addEditToolbar())}get altTextData(){return this.#is?.data}set altTextData(t){this.#is&&(this.#is.data=t)}hasAltText(){return!this.#is?.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.#ds?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.div.addEventListener("focusin",this.#gs),this.div.addEventListener("focusout",this.#ms);const[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)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),(0,s.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=n.FeatureTest.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#vs=!0,this._isDraggable?this.#Ns(t):this.#Bs(t))}#Bs(t){const{isMac:e}=n.FeatureTest.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#Ns(t){const e=this._uiManager.isSelected(this);let i,s;this._uiManager.setUpDragSession(),e&&(this.div.classList.add("moving"),i={passive:!0,capture:!0},this.#xs=t.clientX,this.#Ts=t.clientY,s=t=>{const{clientX:e,clientY:i}=t,[s,n]=this.screenToPageTranslation(e-this.#xs,i-this.#Ts);this.#xs=e,this.#Ts=i,this._uiManager.dragSelectedEditors(s,n)},window.addEventListener("pointermove",s,i));const n=()=>{window.removeEventListener("pointerup",n),window.removeEventListener("blur",n),e&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",s,i)),this.#vs=!1,this._uiManager.endDragSession()||this.#Bs(t)};window.addEventListener("pointerup",n),window.addEventListener("blur",n)}moveInDOM(){this.#Es&&clearTimeout(this.#Es),this.#Es=setTimeout((()=>{this.#Es=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){const s=this.parentScale,[n,a]=this.pageDimensions,[r,o]=this.pageTranslation,h=t/s,l=e/s,d=this.x*n,c=this.y*a,u=this.width*n,p=this.height*a;switch(i){case 0:return[d+h+r,a-c-l-p+o,d+h+u+r,a-c-l+o];case 90:return[d+l+r,a-c+h+o,d+l+p+r,a-c+h+u+o];case 180:return[d-h-u+r,a-c+l+o,d-h+r,a-c+l+p+o];case 270:return[d-l-p+r,a-c-h-u+o,d-l+r,a-c-h+o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,s,n,a]=t,r=n-i,o=a-s;switch(this.rotation){case 0:return[i,e-a,r,o];case 90:return[i,e-s,o,r];case 180:return[n,e-s,r,o];case 270:return[n,e-a,o,r];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#ws=!0}disableEditMode(){this.#ws=!1}isInEditMode(){return this.#ws}shouldGetKeyboardEvents(){return this.#_s}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#gs),this.div?.addEventListener("focusout",this.#ms)}rotate(t){}serialize(t=!1,e=null){(0,n.unreachable)("An editor must be serializable")}static deserialize(t,e,i){const s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation;const[n,a]=s.pageDimensions,[r,o,h,l]=s.getRectInCurrentCoords(t.rect,a);return s.x=r/n,s.y=o/a,s.width=h/n,s.height=l/a,s}remove(){if(this.div.removeEventListener("focusin",this.#gs),this.div.removeEventListener("focusout",this.#ms),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#Es&&(clearTimeout(this.#Es),this.#Es=null),this.#Ps(),this.removeEditToolbar(),this.#Ss){for(const t of this.#Ss.values())clearTimeout(t);this.#Ss=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#Ls(),this.#us.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.#ps={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#us.children;if(!this.#ls){this.#ls=Array.from(e);const t=this.#Hs.bind(this),i=this.#Us.bind(this);for(const e of this.#ls){const s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t),e.addEventListener("blur",i),e.addEventListener("focus",this.#zs.bind(this,s)),h._l10nPromise.get(`pdfjs-editor-resizer-label-${s}`).then((t=>e.setAttribute("aria-label",t)))}}const i=this.#ls[0];let s=0;for(const a of e){if(a===i)break;s++}const n=(360-this.rotation+this.parentRotation)%360/90*(this.#ls.length/4);if(n!==s){if(n<s)for(let e=0;e<s-n;e++)this.#us.append(this.#us.firstChild);else if(n>s)for(let e=0;e<n-s;e++)this.#us.firstChild.before(this.#us.lastChild);let t=0;for(const i of e){const e=this.#ls[t++],s=e.getAttribute("data-resizer-name");h._l10nPromise.get(`pdfjs-editor-resizer-label-${s}`).then((t=>i.setAttribute("aria-label",t)))}}this.#js(0),this.#_s=!0,this.#us.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#Hs(t){h._resizerKeyboardManager.exec(this,t)}#Us(t){this.#_s&&t.relatedTarget?.parentNode!==this.#us&&this.#Ps()}#zs(t){this.#bs=this.#_s?t:""}#js(t){if(this.#ls)for(const e of this.#ls)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#_s&&this.#Fs(this.#bs,{movementX:t,movementY:e})}#Ps(){if(this.#_s=!1,this.#js(-1),this.#ps){const{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=this.#ps;this.#Os(t,e,i,s),this.#ps=null}}_stopResizingWithKeyboard(){this.#Ps(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this.#fs?this.#fs?.show():this.addEditToolbar().then((()=>{this.div?.classList.contains("selectedEditor")&&this.#fs?.show()}))}unselect(){this.#us?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#fs?.hide()}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#ys}set isEditing(t){this.#ys=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#cs=!0;const i=t/e,{style:s}=this.div;s.aspectRatio=i,s.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.#Ss||=new Map;const{action:e}=t;let i=this.#Ss.get(e);return i&&clearTimeout(i),i=setTimeout((()=>{this._reportTelemetry(t),this.#Ss.delete(e),0===this.#Ss.size&&(this.#Ss=null)}),h._telemetryTimeout),void this.#Ss.set(e,i)}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
22show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#ds=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#ds=!0}}class l extends h{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:()=>n});var s=i(292);class n{#Gs;#Vs=[];#$s=[];constructor(t,e=0,i=0,s=!0){let n=1/0,a=-1/0,r=1/0,o=-1/0;const h=4,l=10**-h;for(const{x:f,y:b,width:v,height:A}of t){const t=Math.floor((f-e)/l)*l,i=Math.ceil((f+v+e)/l)*l,s=Math.floor((b-e)/l)*l,h=Math.ceil((b+A+e)/l)*l,d=[t,s,h,!0],c=[i,s,h,!1];this.#Vs.push(d,c),n=Math.min(n,t),a=Math.max(a,i),r=Math.min(r,s),o=Math.max(o,h)}const d=a-n+2*i,c=o-r+2*i,u=n-i,p=r-i,g=this.#Vs.at(s?-1:-2),m=[g[0],g[2]];for(const f of this.#Vs){const[t,e,i]=f;f[0]=(t-u)/d,f[1]=(e-p)/c,f[2]=(i-p)/c}this.#Gs={x:u,y:p,width:d,height:c,lastPoint:m}}getOutlines(){this.#Vs.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]));const t=[];for(const e of this.#Vs)e[3]?(t.push(...this.#Ws(e)),this.#qs(e)):(this.#Ks(e),t.push(...this.#Ws(e)));return this.#Xs(t)}#Xs(t){const e=[],i=new Set;for(const a of t){const[t,i,s]=a;e.push([t,i,a],[t,s,a])}e.sort(((t,e)=>t[1]-e[1]||t[0]-e[0]));for(let a=0,r=e.length;a<r;a+=2){const t=e[a][2],s=e[a+1][2];t.push(s),s.push(t),i.add(t),i.add(s)}const s=[];let n;while(i.size>0){const t=i.values().next().value;let[e,a,r,o,h]=t;i.delete(t);let l=e,d=a;n=[e,r],s.push(n);while(1){let t;if(i.has(o))t=o;else{if(!i.has(h))break;t=h}i.delete(t),[e,a,r,o,h]=t,l!==e&&(n.push(l,d,e,d===a?a:r),l=e),d=d===a?r:a}n.push(l,d)}return new r(s,this.#Gs)}#Ys(t){const e=this.#$s;let i=0,s=e.length-1;while(i<=s){const n=i+s>>1,a=e[n][0];if(a===t)return n;a<t?i=n+1:s=n-1}return s+1}#qs([,t,e]){const i=this.#Ys(t);this.#$s.splice(i,0,[t,e])}#Ks([,t,e]){const i=this.#Ys(t);for(let s=i;s<this.#$s.length;s++){const[i,n]=this.#$s[s];if(i!==t)break;if(i===t&&n===e)return void this.#$s.splice(s,1)}for(let s=i-1;s>=0;s--){const[i,n]=this.#$s[s];if(i!==t)break;if(i===t&&n===e)return void this.#$s.splice(s,1)}}#Ws(t){const[e,i,s]=t,n=[[e,i,s]],a=this.#Ys(s);for(let r=0;r<a;r++){const[t,i]=this.#$s[r];for(let s=0,a=n.length;s<a;s++){const[,r,o]=n[s];if(!(i<=r||o<=t))if(r>=t)if(o>i)n[s][1]=i;else{if(1===a)return[];n.splice(s,1),s--,a--}else n[s][2]=t,o>i&&n.push([e,i,o])}}return n}}class a{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(t,e){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof h}}class r extends a{#Gs;#Js;constructor(t,e){super(),this.#Js=t,this.#Gs=e}toSVGPath(){const t=[];for(const e of this.#Js){let[i,s]=e;t.push(`M${i} ${s}`);for(let n=2;n<e.length;n+=2){const a=e[n],r=e[n+1];a===i?(t.push(`V${r}`),s=r):r===s&&(t.push(`H${a}`),i=a)}t.push("Z")}return t.join(" ")}serialize([t,e,i,s],n){const a=[],r=i-t,o=s-e;for(const h of this.#Js){const e=new Array(h.length);for(let i=0;i<h.length;i+=2)e[i]=t+h[i]*r,e[i+1]=s-h[i+1]*o;a.push(e)}return a}get box(){return this.#Gs}}class o{#Gs;#Qs=[];#Zs;#tn;#en=[];#in=new Float64Array(18);#sn;#nn;#an;#rn;#on;#re;#hn=[];static#ln=8;static#dn=2;static#cn=o.#ln+o.#dn;constructor({x:t,y:e},i,s,n,a,r=0){this.#Gs=i,this.#re=n*s,this.#tn=a,this.#in.set([NaN,NaN,NaN,NaN,t,e],6),this.#Zs=r,this.#rn=o.#ln*s,this.#an=o.#cn*s,this.#on=s,this.#hn.push(t,e)}get free(){return!0}isEmpty(){return isNaN(this.#in[8])}#un(){const t=this.#in.subarray(4,6),e=this.#in.subarray(16,18),[i,s,n,a]=this.#Gs;return[(this.#sn+(t[0]-e[0])/2-i)/n,(this.#nn+(t[1]-e[1])/2-s)/a,(this.#sn+(e[0]-t[0])/2-i)/n,(this.#nn+(e[1]-t[1])/2-s)/a]}add({x:t,y:e}){this.#sn=t,this.#nn=e;const[i,s,n,a]=this.#Gs;let[r,o,h,l]=this.#in.subarray(8,12);const d=t-h,c=e-l,u=Math.hypot(d,c);if(u<this.#an)return!1;const p=u-this.#rn,g=p/u,m=g*d,f=g*c;let b=r,v=o;r=h,o=l,h+=m,l+=f,this.#hn?.push(t,e);const A=-f/p,y=m/p,w=A*this.#re,_=y*this.#re;if(this.#in.set(this.#in.subarray(2,8),0),this.#in.set([h+w,l+_],4),this.#in.set(this.#in.subarray(14,18),12),this.#in.set([h-w,l-_],16),isNaN(this.#in[6]))return 0===this.#en.length&&(this.#in.set([r+w,o+_],2),this.#en.push(NaN,NaN,NaN,NaN,(r+w-i)/n,(o+_-s)/a),this.#in.set([r-w,o-_],14),this.#Qs.push(NaN,NaN,NaN,NaN,(r-w-i)/n,(o-_-s)/a)),this.#in.set([b,v,r,o,h,l],6),!this.isEmpty();this.#in.set([b,v,r,o,h,l],6);const E=Math.abs(Math.atan2(v-o,b-r)-Math.atan2(f,m));return E<Math.PI/2?([r,o,h,l]=this.#in.subarray(2,6),this.#en.push(NaN,NaN,NaN,NaN,((r+h)/2-i)/n,((o+l)/2-s)/a),[r,o,b,v]=this.#in.subarray(14,18),this.#Qs.push(NaN,NaN,NaN,NaN,((b+r)/2-i)/n,((v+o)/2-s)/a),!0):([b,v,r,o,h,l]=this.#in.subarray(0,6),this.#en.push(((b+5*r)/6-i)/n,((v+5*o)/6-s)/a,((5*r+h)/6-i)/n,((5*o+l)/6-s)/a,((r+h)/2-i)/n,((o+l)/2-s)/a),[h,l,r,o,b,v]=this.#in.subarray(12,18),this.#Qs.push(((b+5*r)/6-i)/n,((v+5*o)/6-s)/a,((5*r+h)/6-i)/n,((5*o+l)/6-s)/a,((r+h)/2-i)/n,((o+l)/2-s)/a),!0)}toSVGPath(){if(this.isEmpty())return"";const t=this.#en,e=this.#Qs,i=this.#in.subarray(4,6),s=this.#in.subarray(16,18),[n,a,r,o]=this.#Gs,[h,l,d,c]=this.#un();if(isNaN(this.#in[6])&&!this.isEmpty())return`M${(this.#in[2]-n)/r} ${(this.#in[3]-a)/o} L${(this.#in[4]-n)/r} ${(this.#in[5]-a)/o} L${h} ${l} L${d} ${c} L${(this.#in[16]-n)/r} ${(this.#in[17]-a)/o} L${(this.#in[14]-n)/r} ${(this.#in[15]-a)/o} Z`;const u=[];u.push(`M${t[4]} ${t[5]}`);for(let p=6;p<t.length;p+=6)isNaN(t[p])?u.push(`L${t[p+4]} ${t[p+5]}`):u.push(`C${t[p]} ${t[p+1]} ${t[p+2]} ${t[p+3]} ${t[p+4]} ${t[p+5]}`);u.push(`L${(i[0]-n)/r} ${(i[1]-a)/o} L${h} ${l} L${d} ${c} L${(s[0]-n)/r} ${(s[1]-a)/o}`);for(let p=e.length-6;p>=6;p-=6)isNaN(e[p])?u.push(`L${e[p+4]} ${e[p+5]}`):u.push(`C${e[p]} ${e[p+1]} ${e[p+2]} ${e[p+3]} ${e[p+4]} ${e[p+5]}`);return u.push(`L${e[4]} ${e[5]} Z`),u.join(" ")}getOutlines(){const t=this.#en,e=this.#Qs,i=this.#in,s=i.subarray(4,6),n=i.subarray(16,18),[a,r,o,l]=this.#Gs,d=new Float64Array((this.#hn?.length??0)+2);for(let h=0,b=d.length-2;h<b;h+=2)d[h]=(this.#hn[h]-a)/o,d[h+1]=(this.#hn[h+1]-r)/l;d[d.length-2]=(this.#sn-a)/o,d[d.length-1]=(this.#nn-r)/l;const[c,u,p,g]=this.#un();if(isNaN(i[6])&&!this.isEmpty()){const t=new Float64Array(36);return t.set([NaN,NaN,NaN,NaN,(i[2]-a)/o,(i[3]-r)/l,NaN,NaN,NaN,NaN,(i[4]-a)/o,(i[5]-r)/l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(i[16]-a)/o,(i[17]-r)/l,NaN,NaN,NaN,NaN,(i[14]-a)/o,(i[15]-r)/l],0),new h(t,d,this.#Gs,this.#on,this.#Zs,this.#tn)}const m=new Float64Array(this.#en.length+24+this.#Qs.length);let f=t.length;for(let h=0;h<f;h+=2)isNaN(t[h])?m[h]=m[h+1]=NaN:(m[h]=t[h],m[h+1]=t[h+1]);m.set([NaN,NaN,NaN,NaN,(s[0]-a)/o,(s[1]-r)/l,NaN,NaN,NaN,NaN,c,u,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(n[0]-a)/o,(n[1]-r)/l],f),f+=24;for(let h=e.length-6;h>=6;h-=6)for(let t=0;t<6;t+=2)isNaN(e[h+t])?(m[f]=m[f+1]=NaN,f+=2):(m[f]=e[h+t],m[f+1]=e[h+t
22+1],f+=2);return m.set([NaN,NaN,NaN,NaN,e[4],e[5]],f),new h(m,d,this.#Gs,this.#on,this.#Zs,this.#tn)}}class h extends a{#Gs;#pn=null;#Zs;#tn;#hn;#on;#gn;constructor(t,e,i,s,n,a){super(),this.#gn=t,this.#hn=e,this.#Gs=i,this.#on=s,this.#Zs=n,this.#tn=a,this.#mn(a);const{x:r,y:o,width:h,height:l}=this.#pn;for(let d=0,c=t.length;d<c;d+=2)t[d]=(t[d]-r)/h,t[d+1]=(t[d+1]-o)/l;for(let d=0,c=e.length;d<c;d+=2)e[d]=(e[d]-r)/h,e[d+1]=(e[d+1]-o)/l}toSVGPath(){const t=[`M${this.#gn[4]} ${this.#gn[5]}`];for(let e=6,i=this.#gn.length;e<i;e+=6)isNaN(this.#gn[e])?t.push(`L${this.#gn[e+4]} ${this.#gn[e+5]}`):t.push(`C${this.#gn[e]} ${this.#gn[e+1]} ${this.#gn[e+2]} ${this.#gn[e+3]} ${this.#gn[e+4]} ${this.#gn[e+5]}`);return t.push("Z"),t.join(" ")}serialize([t,e,i,s],n){const a=i-t,r=s-e;let o,h;switch(n){case 0:o=this.#fn(this.#gn,t,s,a,-r),h=this.#fn(this.#hn,t,s,a,-r);break;case 90:o=this.#bn(this.#gn,t,e,a,r),h=this.#bn(this.#hn,t,e,a,r);break;case 180:o=this.#fn(this.#gn,i,e,-a,r),h=this.#fn(this.#hn,i,e,-a,r);break;case 270:o=this.#bn(this.#gn,i,s,-a,-r),h=this.#bn(this.#hn,i,s,-a,-r);break}return{outline:Array.from(o),points:[Array.from(h)]}}#fn(t,e,i,s,n){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r]*s,a[r+1]=i+t[r+1]*n;return a}#bn(t,e,i,s,n){const a=new Float64Array(t.length);for(let r=0,o=t.length;r<o;r+=2)a[r]=e+t[r+1]*s,a[r+1]=i+t[r]*n;return a}#mn(t){const e=this.#gn;let i=e[4],n=e[5],a=i,r=n,o=i,h=n,l=i,d=n;const c=t?Math.max:Math.min;for(let f=6,b=e.length;f<b;f+=6){if(isNaN(e[f]))a=Math.min(a,e[f+4]),r=Math.min(r,e[f+5]),o=Math.max(o,e[f+4]),h=Math.max(h,e[f+5]),d<e[f+5]?(l=e[f+4],d=e[f+5]):d===e[f+5]&&(l=c(l,e[f+4]));else{const t=s.Util.bezierBoundingBox(i,n,...e.slice(f,f+6));a=Math.min(a,t[0]),r=Math.min(r,t[1]),o=Math.max(o,t[2]),h=Math.max(h,t[3]),d<t[3]?(l=t[2],d=t[3]):d===t[3]&&(l=c(l,t[2]))}i=e[f+4],n=e[f+5]}const u=a-this.#Zs,p=r-this.#Zs,g=o-a+2*this.#Zs,m=h-r+2*this.#Zs;this.#pn={x:u,y:p,width:g,height:m,lastPoint:[l,d]}}get box(){return this.#pn}getNewOutline(t,e){const{x:i,y:s,width:n,height:a}=this.#pn,[r,h,l,d]=this.#Gs,c=n*l,u=a*d,p=i*l+r,g=s*d+h,m=new o({x:this.#hn[0]*c+p,y:this.#hn[1]*u+g},this.#Gs,this.#on,t,this.#tn,e??this.#Zs);for(let o=2;o<this.#hn.length;o+=2)m.add({x:this.#hn[o]*c+p,y:this.#hn[o+1]*u+g});return m.getOutlines()}}},362:(t,e,i)=>{i.d(e,{EditorToolbar:()=>n,HighlightToolbar:()=>a});var s=i(419);class n{#vn=null;#qt=null;#Xi;#An=null;constructor(t){this.#Xi=t}render(){const t=this.#vn=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",s.noContextMenu),t.addEventListener("pointerdown",n.#ji);const e=this.#An=document.createElement("div");e.className="buttons",t.append(e);const i=this.#Xi.toolbarPosition;if(i){const{style:e}=t,s="ltr"===this.#Xi._uiManager.direction?1-i[0]:i[0];e.insetInlineEnd=100*s+"%",e.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return this.#yn(),t}static#ji(t){t.stopPropagation()}#wn(t){this.#Xi._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#_n(t){this.#Xi._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#En(t){t.addEventListener("focusin",this.#wn.bind(this),{capture:!0}),t.addEventListener("focusout",this.#_n.bind(this),{capture:!0}),t.addEventListener("contextmenu",s.noContextMenu)}hide(){this.#vn.classList.add("hidden"),this.#qt?.hideDropdown()}show(){this.#vn.classList.remove("hidden")}#yn(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#Xi.editorType}-button`),this.#En(t),t.addEventListener("click",(t=>{this.#Xi._uiManager.delete()})),this.#An.append(t)}get#xn(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#En(t),this.#An.prepend(t,this.#xn)}addColorPicker(t){this.#qt=t;const e=t.renderButton();this.#En(e),this.#An.prepend(e,this.#xn)}remove(){this.#vn.remove(),this.#qt?.destroy(),this.#qt=null}}class a{#An=null;#vn=null;#Di;constructor(t){this.#Di=t}#Tn(){const t=this.#vn=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",s.noContextMenu);const e=this.#An=document.createElement("div");return e.className="buttons",t.append(e),this.#Sn(),t}#Cn(t,e){let i=0,s=0;for(const n of t){const t=n.y+n.height;if(t<i)continue;const a=n.x+(e?n.width:0);t>i?(s=a,i=t):e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]}
22show(t,e,i){const[s,n]=this.#Cn(e,i),{style:a}=this.#vn||=this.#Tn();t.append(this.#vn),a.insetInlineEnd=100*s+"%",a.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){this.#vn.remove()}#Sn(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const 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.#Di.highlightSelection("floating_button")})),this.#An.append(t)}}},830:(t,e,i)=>{i.d(e,{AnnotationEditorUIManager:()=>p,ColorManager:()=>u,KeyboardManager:()=>c,bindEvents:()=>r,opacityToHex:()=>o});var s=i(292),n=i(419),a=i(362);function r(t,e,i){for(const 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 h{#ct=0;constructor(){}get id(){return`${s.AnnotationEditorPrefix}${this.#ct++}`}}class l{#Mn=(0,s.getUuid)();#ct=0;#ut=null;static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',e=new OffscreenCanvas(1,3),i=e.getContext("2d"),n=new Image;n.src=t;const a=n.decode().then((()=>(i.drawImage(n,0,0,1,1,0,0,1,3),0===new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0])));return(0,s.shadow)(this,"_isSVGFittingCanvas",a)}async#Pn(t,e){this.#ut||=new Map;let i=this.#ut.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.#Mn}_${this.#ct++}`,refCounter:0,isSvg:!1},"string"===typeof e?(i.url=e,t=await(0,n.fetchData)(e,"blob")):t=i.file=e,"image/svg+xml"===t.type){const e=l._isSVGFittingCanvas,s=new FileReader,n=new Image,a=new Promise(((t,a)=>{n.onload=()=>{i.bitmap=n,i.isSvg=!0,t()},s.onload=async()=>{const t=i.svgUrl=s.result;n.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},n.onerror=s.onerror=a}));s.readAsDataURL(t),await a}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(s){console.error(s),i=null}return this.#ut.set(t,i),i&&this.#ut.set(i.id,i),i}async getFromFile(t){const{lastModified:e,name:i,size:s,type:n}=t;return this.#Pn(`${e}_${i}_${s}_${n}`,t)}async getFromUrl(t){return this.#Pn(t,t)}async getFromId(t){this.#ut||=new Map;const e=this.#ut.get(t);return e?e.bitmap?(e.refCounter+=1,e):e.file?this.getFromFile(e.file):this.getFromUrl(e.url):null}getSvgUrl(t){const e=this.#ut.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#ut||=new Map;const e=this.#ut.get(t);e&&(e.refCounter-=1,0===e.refCounter&&(e.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#Mn}_`)}}class d{#kn=[];#In=!1;#Rn;#Ln=-1;constructor(t=128){this.#Rn=t}add({cmd:t,undo:e,post:i,mustExec:s,type:n=NaN,overwriteIfSameType:a=!1,keepUndo:r=!1}){if(s&&t(),this.#In)return;const o={cmd:t,undo:e,post:i,type:n};if(-1===this.#Ln)return this.#kn.length>0&&(this.#kn.length=0),this.#Ln=0,void this.#kn.push(o);if(a&&this.#kn[this.#Ln].type===n)return r&&(o.undo=this.#kn[this.#Ln].undo),void(this.#kn[this.#Ln]=o);const h=this.#Ln+1;h===this.#Rn?this.#kn.splice(0,1):(this.#Ln=h,h<this.#kn.length&&this.#kn.splice(h)),this.#kn.push(o)}undo(){if(-1===this.#Ln)return;this.#In=!0;const{undo:t,post:e}=this.#kn[this.#Ln];t(),e?.(),this.#In=!1,this.#Ln-=1}redo(){if(this.#Ln<this.#kn.length-1){this.#Ln+=1,this.#In=!0;const{cmd:t,post:e}=this.#kn[this.#Ln];t(),e?.(),this.#In=!1}}hasSomethingToUndo(){return-1!==this.#Ln}hasSomethingToRedo(){return this.#Ln<this.#kn.length-1}destroy(){this.#kn=null}}class c{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=s.FeatureTest.platform;for(const[i,s,n={}]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:n}),this.allKeys.add(t.split("+").at(-1)))}}#Dn(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);const e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(this.#Dn(e));if(!i)return;const{callback:s,options:{bubbles:n=!1,args:a=[],checker:r=null}}=i;r&&!r(t,e)||(s.bind(t,...a,e)(),n||(e.stopPropagation(),e.preventDefault()))}}class u{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return(0,n.getColorValues)(t),(0,s.shadow)(this,"_colors",t)}convert(t){const e=(0,n.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,s]of this._colors)if(s.every(((t,i)=>t===e[i])))return u._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?s.Util.makeHexColor(...e):t}}class p{#Fn=null;#On=new Map;#Nn=new Map;#Bn=null;#Hn=null;#Un=new d;#zn=0;#jn=new Set;#Gn=null;#Fi=null;#Vn=new Set;#$n=!1;#Wn=null;#qn=null;#Kn=null;#Xn=!1;#Yn=null;#Jn=new h;#Qn=!1;#Zn=!1;#ta=null;#ea=null;#ia=null;#sa=s.AnnotationEditorType.NONE;#na=new Set;#aa=null;#ra=null;#oa=null;#ha=this.blur.bind(this);#la=this.focus.bind(this);#da=this.copy.bind(this);#ca=this.cut.bind(this);#ua=this.paste.bind(this);#te=this.keydown.bind(this);#pa=this.keyup.bind(this);#ga=this.onEditingAction.bind(this);#ma=this.onPageChanging.bind(this);#fa=this.onScaleChanging.bind(this);#ba=this.#va.bind(this);#Aa=this.onRotationChanging.bind(this);#ya={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#wa=[0,0];#_a=null;#p=null;#Ea=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=p.prototype,e=t=>t.#p.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,{target:e})=>
22{if(e instanceof HTMLInputElement){const{type:t}=e;return"text"!==t&&"number"!==t}return!0},n=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.#p.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#p.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}]]))}constructor(t,e,i,s,a,r,o,h,l){this.#p=t,this.#Ea=e,this.#Bn=i,this._eventBus=s,this._eventBus._on("editingaction",this.#ga),this._eventBus._on("pagechanging",this.#ma),this._eventBus._on("scalechanging",this.#fa),this._eventBus._on("rotationchanging",this.#Aa),this.#xa(),this.#Ta(),this.#Hn=a.annotationStorage,this.#Wn=a.filterFactory,this.#ra=r,this.#Kn=o||null,this.#$n=h,this.#ia=l||null,this.viewParameters={realScale:n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#Sa(),this.#Ca(),this._eventBus._off("editingaction",this.#ga),this._eventBus._off("pagechanging",this.#ma),this._eventBus._off("scalechanging",this.#fa),this._eventBus._off("rotationchanging",this.#Aa);for(const t of this.#Nn.values())t.destroy();this.#Nn.clear(),this.#On.clear(),this.#Vn.clear(),this.#Fn=null,this.#na.clear(),this.#Un.destroy(),this.#Bn?.destroy(),this.#Yn?.hide(),this.#Yn=null,this.#qn&&(clearTimeout(this.#qn),this.#qn=null),this.#_a&&(clearTimeout(this.#_a),this.#_a=null),this.#Ma()}async mlGuess(t){return this.#ia?.guess(t)||null}get hasMLManager(){return!!this.#ia}get hcmFilter(){return(0,s.shadow)(this,"hcmFilter",this.#ra?this.#Wn.addHCMFilter(this.#ra.foreground,this.#ra.background):"none")}get direction(){return(0,s.shadow)(this,"direction",getComputedStyle(this.#p).direction)}get highlightColors(){return(0,s.shadow)(this,"highlightColors",this.#Kn?new Map(this.#Kn.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.#ea=t}editAltText(t){this.#Bn?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#zn=t-1}focusMainContainer(){this.#p.focus()}findParent(t,e){for(const i of this.#Nn.values()){const{x:s,y:n,width:a,height:r}=i.div.getBoundingClientRect();if(t>=s&&t<=s+a&&e>=n&&e<=n+r)return i}return null}disableUserSelect(t=!1){this.#Ea.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#Vn.add(t)}removeShouldRescale(t){this.#Vn.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*n.PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of this.#Vn)e.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#Pa({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:r}=e,o=e.toString(),h=this.#Pa(e),l=h.closest(".textLayer"),d=this.getSelectionBoxes(l);if(d){e.empty(),this.#sa===s.AnnotationEditorType.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:s.AnnotationEditorType.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const e of this.#Nn.values())if(e.hasTextLayer(l)){e.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:n,focusNode:a,focusOffset:r,text:o});break}}}#ka(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=this.#Pa(t),i=e.closest(".textLayer"),s=this.getSelectionBoxes(i);s&&(this.#Yn||=new a.HighlightToolbar(this),this.#Yn.show(i,s,"ltr"===this.direction))}addToAnnotationStorage(t){t.isEmpty()||!this.#Hn||this.#Hn.has(t.id)||this.#Hn.setValue(t.id,t)}#va(){const t=document.getSelection();if(!t||t.isCollapsed)return void(this.#aa&&(this.#Yn?.hide(),this.#aa=null,this.#Ia({hasSelectedText:!1})));const{anchorNode:e}=t;if(e===this.#aa)return;const i=this.#Pa(t),n=i.closest(".textLayer");if(n){if(this.#Yn?.hide(),this.#aa=e,this.#Ia({hasSelectedText:!0}),(this.#sa===s.AnnotationEditorType.HIGHLIGHT||this.#sa===s.AnnotationEditorType.NONE)&&(this.#sa===s.AnnotationEditorType.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#Xn=this.isShiftKeyDown,!this.isShiftKeyDown)){const t=e=>{"pointerup"===e.type&&0!==e.button||(window.removeEventListener("pointerup",t),window.removeEventListener("blur",t),"pointerup"===e.type&&this.#Ra("main_toolbar"))};window.addEventListener("pointerup",t),window.addEventListener("blur",t)}}else this.#aa&&(this.#Yn?.hide(),this.#aa=null,this.#Ia({hasSelectedText:!1}))}#Ra(t=""){this.#sa===s.AnnotationEditorType.HIGHLIGHT?this.highlightSelection(t):this.#$n&&this.#ka()}#xa(){document.addEventListener("selectionchange",this.#ba)}#Ma(){document.removeEventListener("selectionchange",this.#ba)}#La(){window.addEventListener("focus",this.#la),window.addEventListener("blur",this.#ha)}#Ca(){window.removeEventListener("focus",this.#la),window.removeEventListener("blur",this.#ha)}blur(){if(this.isShiftKeyDown=!1,this.#Xn&&(this.#Xn=!1,this.#Ra("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const e of this.#na)if(e.div.contains(t)){this.#ta=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#ta)return;const[t,e]=this.#ta;this.#ta=null,e.addEventListener("focusin",(()=>{t._focusEventsAllowed=!0}),{once:!0}),e.focus()}#Ta(){window.addEventListener("keydown",this.#te),window.addEventListener("keyup",this.#pa)}#Sa(){window.removeEventListener("keydown",this.#te),window.removeEventListener("keyup",this.#pa)}#Da(){document.addEventListener("copy",this.#da),document.addEventListener("cut",this.#ca),document.addEventListener("paste",this.#ua)}#Fa(){document.removeEventListener("copy",this.#da),document.removeEventListener("cut",this.#ca),document.removeEventListener("paste",this.#ua)}addEditListeners(){this.#Ta(),this.#Da()}removeEditListeners(){this.#Sa(),this.#Fa()}copy(t){if(t.preventDefault(),this.#Fn?.commitOrRemove(),!this.hasSelection)return;const e=[];
22for(const i of this.#na){const t=i.serialize(!0);t&&e.push(t)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:e}=t;for(const s of e.items)for(const t of this.#Fi)if(t.isHandlingMimeForPasting(s.type))return void t.paste(s,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(a){return void(0,s.warn)(`paste: "${a.message}".`)}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const t=[];for(const a of i){const e=n.deserialize(a);if(!e)return;t.push(e)}const e=()=>{for(const e of t)this.#Oa(e);this.#Na(t)},s=()=>{for(const e of t)e.remove()};this.addCommands({cmd:e,undo:s,mustExec:!0})}catch(a){(0,s.warn)(`paste: "${a.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#sa===s.AnnotationEditorType.NONE||this.isEditorHandlingKeyboard||p._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#Xn&&(this.#Xn=!1,this.#Ra("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}#Ia(t){const e=Object.entries(t).some((([t,e])=>this.#ya[t]!==e));e&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#ya,t)}),this.#sa===s.AnnotationEditorType.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#Ba([[s.AnnotationEditorParamsType.HIGHLIGHT_FREE,!0]]))}#Ba(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#La(),this.#Da(),this.#Ia({isEditing:this.#sa!==s.AnnotationEditorType.NONE,isEmpty:this.#Ha(),hasSomethingToUndo:this.#Un.hasSomethingToUndo(),hasSomethingToRedo:this.#Un.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Ca(),this.#Fa(),this.#Ia({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#Fi){this.#Fi=t;for(const t of this.#Fi)this.#Ba(t.defaultPropertiesToUpdate)}}getId(){return this.#Jn.id}get currentLayer(){return this.#Nn.get(this.#zn)}getLayer(t){return this.#Nn.get(t)}get currentPageIndex(){return this.#zn}addLayer(t){this.#Nn.set(t.pageIndex,t),this.#Qn?t.enable():t.disable()}removeLayer(t){this.#Nn.delete(t.pageIndex)}updateMode(t,e=null,i=!1){if(this.#sa!==t){if(this.#sa=t,t===s.AnnotationEditorType.NONE)return this.setEditingState(!1),void this.#Ua();this.setEditingState(!0),this.#za(),this.unselectAll();for(const e of this.#Nn.values())e.updateMode(t);if(e||!i){if(e)for(const t of this.#On.values())if(t.annotationElementId===e){this.setSelected(t),t.enterInEditMode();break}}else this.addNewEditorFromKeyboard()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#sa&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if(this.#Fi){switch(t){case s.AnnotationEditorParamsType.CREATE:return void this.currentLayer.addNewEditor();case s.AnnotationEditorParamsType.HIGHLIGHT_DEFAULT_COLOR:this.#ea?.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.#oa||=new Map).set(t,e),this.showAllEditors("highlight",e);break}for(const i of this.#na)i.updateParams(t,e);for(const i of this.#Fi)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(const s of this.#On.values())s.editorType===t&&s.show(e);const n=this.#oa?.get(s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL)??!0;n!==e&&this.#Ba([[s.AnnotationEditorParamsType.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#Zn!==t){this.#Zn=t;for(const e of this.#Nn.values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}#za(){if(!this.#Qn){this.#Qn=!0;for(const t of this.#Nn.values())t.enable();for(const t of this.#On.values())t.enable()}}#Ua(){if(this.unselectAll(),this.#Qn){this.#Qn=!1;for(const t of this.#Nn.values())t.disable();for(const t of this.#On.values())t.disable()}}getEditors(t){const e=[];for(const i of this.#On.values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return this.#On.get(t)}addEditor(t){this.#On.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#qn&&clearTimeout(this.#qn),this.#qn=setTimeout((()=>{this.focusMainContainer(),this.#qn=null}),0)),this.#On.delete(t.id),this.unselect(t),t.annotationElementId&&this.#jn.has(t.annotationElementId)||this.#Hn?.remove(t.id)}addDeletedAnnotationElement(t){this.#jn.add(t.annotationElementId),t.deleted=!0}
22isDeletedAnnotationElement(t){return this.#jn.has(t)}removeDeletedAnnotationElement(t){this.#jn.delete(t.annotationElementId),t.deleted=!1}#Oa(t){const e=this.#Nn.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#Fn!==t&&(this.#Fn=t,t&&this.#Ba(t.propertiesToUpdate))}get#ja(){let t=null;for(t of this.#na);return t}updateUI(t){this.#ja===t&&this.#Ba(t.propertiesToUpdate)}toggleSelected(t){if(this.#na.has(t))return this.#na.delete(t),t.unselect(),void this.#Ia({hasSelectedEditor:this.hasSelection});this.#na.add(t),t.select(),this.#Ba(t.propertiesToUpdate),this.#Ia({hasSelectedEditor:!0})}setSelected(t){for(const e of this.#na)e!==t&&e.unselect();this.#na.clear(),this.#na.add(t),t.select(),this.#Ba(t.propertiesToUpdate),this.#Ia({hasSelectedEditor:!0})}isSelected(t){return this.#na.has(t)}get firstSelectedEditor(){return this.#na.values().next().value}unselect(t){t.unselect(),this.#na.delete(t),this.#Ia({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#na.size}get isEnterHandled(){return 1===this.#na.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#Un.undo(),this.#Ia({hasSomethingToUndo:this.#Un.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Ha()})}redo(){this.#Un.redo(),this.#Ia({hasSomethingToUndo:!0,hasSomethingToRedo:this.#Un.hasSomethingToRedo(),isEmpty:this.#Ha()})}addCommands(t){this.#Un.add(t),this.#Ia({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Ha()})}#Ha(){if(0===this.#On.size)return!0;if(1===this.#On.size)for(const t of this.#On.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#na],e=()=>{for(const e of t)e.remove()},i=()=>{for(const e of t)this.#Oa(e)};this.addCommands({cmd:e,undo:i,mustExec:!0})}commitOrRemove(){this.#Fn?.commitOrRemove()}hasSomethingToControl(){return this.#Fn||this.hasSelection}#Na(t){for(const e of this.#na)e.unselect();this.#na.clear();for(const e of t)e.isEmpty()||(this.#na.add(e),e.select());this.#Ia({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#na)t.commit();this.#Na(this.#On.values())}unselectAll(){if((!this.#Fn||(this.#Fn.commitOrRemove(),this.#sa===s.AnnotationEditorType.NONE))&&this.hasSelection){for(const t of this.#na)t.unselect();this.#na.clear(),this.#Ia({hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#wa[0]+=t,this.#wa[1]+=e;const[s,n]=this.#wa,a=[...this.#na],r=1e3;this.#_a&&clearTimeout(this.#_a),this.#_a=setTimeout((()=>{this.#_a=null,this.#wa[0]=this.#wa[1]=0,this.addCommands({cmd:()=>{for(const t of a)this.#On.has(t.id)&&t.translateInPage(s,n)},undo:()=>{for(const t of a)this.#On.has(t.id)&&t.translateInPage(-s,-n)},mustExec:!1})}),r);for(const o of a)o.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#Gn=new Map;for(const t of this.#na)this.#Gn.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#Gn)return!1;this.disableUserSelect(!1);const t=this.#Gn;this.#Gn=null;let e=!1;for(const[{x:s,y:n,pageIndex:a},r]of t)r.newX=s,r.newY=n,r.newPageIndex=a,e||=s!==r.savedX||n!==r.savedY||a!==r.savedPageIndex;if(!e)return!1;const i=(t,e,i,s)=>{if(this.#On.has(t.id)){const n=this.#Nn.get(s);n?t._setParentAndPosition(n,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(const[e,{newX:s,newY:n,newPageIndex:a}]of t)i(e,s,n,a)},undo:()=>{for(const[e,{savedX:s,savedY:n,savedPageIndex:a}]of t)i(e,s,n,a)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#Gn)for(const i of this.#Gn.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){const e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#na.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#Fn===t}getActive(){return this.#Fn}getMode(){return this.#sa}get imageManager(){return(0,s.shadow)(this,"imageManager",new l)}getSelectionBoxes(t){if(!t)return null;const e=document.getSelection();for(let h=0,l=e.rangeCount;h<l;h++)if(!t.contains(e.getRangeAt(h).commonAncestorContainer))return null;const{x:i,y:s,width:n,height:a}=t.getBoundingClientRect();let r;switch(t.getAttribute("data-main-rotation")){case"90":r=(t,e,r,o)=>({x:(e-s)/a,y:1-(t+r-i)/n,width:o/a,height:r/n});break;case"180":r=(t,e,r,o)=>({x:1-(t+r-i)/n,y:1-(e+o-s)/a,width:r/n,height:o/a});break;case"270":r=(t,e,r,o)=>({x:1-(e+o-s)/a,y:(t-i)/n,width:o/a,height:r/n});break;default:r=(t,e,r,o)=>
22({x:(t-i)/n,y:(e-s)/a,width:r/n,height:o/a});break}const o=[];for(let h=0,l=e.rangeCount;h<l;h++){const t=e.getRangeAt(h);if(!t.collapsed)for(const{x:e,y:i,width:s,height:n}of t.getClientRects())0!==s&&0!==n&&o.push(r(e,i,s,n))}return 0===o.length?null:o}}},94:(t,e,i)=>{i.d(e,{PDFFetchStream:()=>h});var s=i(292),n=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 r(t){const e=new Headers;for(const i in t){const 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 h{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 l(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new d(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class l{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=r(this._stream.httpHeaders);const i=e.url;fetch(i,a(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,n.validateResponseStatus)(t.status))throw(0,n.createResponseStatusError)(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:a,suggestedLength:r}=(0,n.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=r||this._contentLength,this._filename=(0,n.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;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:o(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class d{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=r(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${i-1}`);const o=s.url;fetch(o,a(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,n.validateResponseStatus)(t.status))throw(0,n.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;const{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:()=>n});var s=i(292);class n{#Ga=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));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#Ga.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:e}){if(t&&!this.#Ga.has(t.loadedName))if((0,s.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:a}=t,r=new FontFace(i,n,a);this.addNativeFontFace(r);try{await r.load(),this.#Ga.add(i),e?.(t)}catch{(0,s.warn)(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else(0,s.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){const 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}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((e=>{const i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)}))}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return(0,s.shadow)(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(s.isNodeJS||"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){function e(){(0,s.assert)(!n.done,"completeRequest() cannot be called twice."),n.done=!0;while(i.length>0&&i[0].done){const t=i.shift();setTimeout(t.callback,0)}}const{loadingRequests:i}=this,n={done:!1,complete:e,callback:t};return i.push(n),n}get _loadTestFont(){const 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){function i(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){const n=t.substring(0,e),a=t.substring(e+i);return n+s+a}let a,r;const o=this._document.createElement("canvas");o.width=1,o.height=1;const h=o.getContext("2d");let l=0;function d(t,e){if(++l>30)return(0,s.warn)("Load test font never loaded."),void e();h.font="30px "+t,h.fillText(".",0,20);const i=h.getImageData(0,0,1,1);i.data[3]>0?e():setTimeout(d.bind(null,t,e))}const c=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;const p=976;u=n(u,p,c.length,c);const g=16,m=1482184792;let f=i(u,g);for(a=0,r=c.length-3;a<r;a+=4)f=f-m+i(c,a)|0;a<c.length&&(f=f-m+i(c+"XXX",a)|0),u=n(u,g,4,(0,s.string32)(f));const b=`url(data:font/opentype;base64,${btoa(u)});`,v=`@font-face {font-family:"${c}";src:${b}}`;this.insertRule(v);const A=this._document.createElement("div");A.style.visibility="hidden",A.style.width=A.style.height="10px",A.style.position="absolute",A.style.top=A.style.left="0px";for(const s of[t.loadedName,c]){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=s,A.append(t)}this._document.body.append(A),d(c,(()=>{A.remove(),e.complete()}
22))}}class a{constructor(t,{isEvalSupported:e=!0,disableFontFace:i=!1,ignoreErrors:s=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.isEvalSupported=!1!==e,this.disableFontFace=!0===i,this.ignoreErrors=!0===s,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const 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(){if(!this.data||this.disableFontFace)return null;const t=(0,s.bytesToString)(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let i;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(n){if(!this.ignoreErrors)throw n;return(0,s.warn)(`getPathGenerator - ignoring character: "${n}".`),this.compiledGlyphs[e]=function(t,e){}}if(this.isEvalSupported&&s.FeatureTest.isEvalSupported){const t=[];for(const e of i){const i=void 0!==e.args?e.args.join(","):"";t.push("c.",e.cmd,"(",i,");\n")}return this.compiledGlyphs[e]=new Function("c","size",t.join(""))}return this.compiledGlyphs[e]=function(t,e){for(const s of i)"scale"===s.cmd&&(s.args=[e,-e]),t[s.cmd].apply(t,s.args)}}}},62:(t,e,i)=>{i.d(e,{Metadata:()=>n});var s=i(292);class n{#Va;#$a;constructor({parsedData:t,rawData:e}){this.#Va=t,this.#$a=e}getRaw(){return this.#$a}get(t){return this.#Va.get(t)??null}getAll(){return(0,s.objectFromMap)(this.#Va)}has(t){return this.#Va.has(t)}}},457:(t,e,i)=>{i.d(e,{PDFNetworkStream:()=>l});var s=i(292),n=i(490);const a=200,r=206;function o(t){const e=t.response;return"string"!==typeof e?e:(0,s.stringToBytes)(e).buffer}class h{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){const s={begin:t,end:e};for(const n in i)s[n]=i[n];return this.request(s)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const n in this.httpHeaders){const t=this.httpHeaders[n];void 0!==t&&e.setRequestHeader(n,t)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.expectedStatus=r):s.expectedStatus=a,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){const i=this.pendingRequests[t];i&&i.onProgress?.(e)}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===s.status&&this.isHttp)return void i.onError?.(s.status);const n=s.status||a,h=n===a&&i.expectedStatus===r;if(!h&&n!==i.expectedStatus)return void i.onError?.(s.status);const l=o(s);if(n===r){const t=s.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:l})}else l?i.onDone({begin:0,chunk:l}):i.onError?.(s.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
22abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class l{constructor(t){this._source=t,this._manager=new h(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const 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 d(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new c(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class d{constructor(t,e){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=t=>e.getResponseHeader(t),{allowRangeRequests:s,suggestedLength:a}=(0,n.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,n.extractFilenameFromHeader)(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t)if(this._requests.length>0){const e=this._requests.shift();e.resolve({value:t.chunk,done:!1})}else this._cachedChunks.push(t.chunk);if(this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=(0,n.createResponseStatusError)(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of 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){const t=this._cachedChunks.shift();return{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const e of 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 c{constructor(t,e,i){this._manager=t;const s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const e=t.chunk;if(this._requests.length>0){const t=this._requests.shift();t.resolve({value:e,done:!1})}else this._queuedChunk=e;this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=(0,n.createResponseStatusError)(t,this._url);for(const e of 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){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest
22(this._requestId),this._close()}}},490:(t,e,i)=>{i.d(e,{createResponseStatusError:()=>h,extractFilenameFromHeader:()=>o,validateRangeRequestCapabilities:()=>r,validateResponseStatus:()=>l});var s=i(292);function n(t){let e=!0,i=n("filename\\*","i").exec(t);if(i){i=i[1];let t=h(i);return t=unescape(t),t=l(t),t=d(t),r(t)}if(i=o(t),i){const t=d(i);return r(t)}if(i=n("filename","i").exec(t),i){i=i[1];let t=h(i);return t=d(t),r(t)}function n(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function a(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const n=new TextDecoder(t,{fatal:!0}),a=(0,s.stringToBytes)(i);i=n.decode(a),e=!1}catch{}}return i}function r(t){return e&&/[\x80-\xff]/.test(t)&&(t=a("utf-8",t),e&&(t=a("iso-8859-1",t))),t}function o(t){const e=[];let i;const s=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");while(null!==(i=s.exec(t))){let[,t,s,n]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[s,n]}const a=[];for(let n=0;n<e.length;++n){if(!(n in e))break;let[t,i]=e[n];i=h(i),t&&(i=unescape(i),0===n&&(i=l(i))),a.push(i)}return a.join("")}function h(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const 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){const e=t.indexOf("'");if(-1===e)return t;const i=t.slice(0,e),s=t.slice(e+1),n=s.replace(/^[^']*'/,"");return a(i,n)}function d(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(t,e,i,s){if("q"===i||"Q"===i)return s=s.replaceAll("_"," "),s=s.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""}var a=i(419);function r({getResponseHeader:t,isHttp:e,rangeChunkSize:i,disableRange:s}){const n={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(t("Content-Length"),10);if(!Number.isInteger(a))return n;if(n.suggestedLength=a,a<=2*i)return n;if(s||!e)return n;if("bytes"!==t("Accept-Ranges"))return n;const r=t("Content-Encoding")||"identity";return"identity"!==r||(n.allowRangeRequests=!0),n}function o(t){const e=t("Content-Disposition");if(e){let t=n(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if((0,a.isPdfFile)(t))return t}return null}function h(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{i.d(e,{PDFNodeStream:()=>p});var n=i(292),a=i(490);let o,h,l,d;n.isNodeJS&&(o=await import("fs"),h=await import("http"),l=await import("https"),d=await import("url"));const c=/^file:\/\/\/[a-zA-Z]:\//;function u(t){const e=d.parse(t);return"file:"===e.protocol||e.host?e:/^[a-z]:[/\\]/i.test(t)?d.parse(`file:///${t}`):(e.host||(e.protocol="file:"),e)}class p{constructor(t){this.source=t,this.url=u(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,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new A(this):new b(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new y(this,t,e):new v(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class g{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();if(null===t)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength});const e=new Uint8Array(t).buffer;return{value:e,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class m{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();if(null===t)return this._readCapability=Promise.withResolvers(),this.read();this._loaded+=t.length,this.onProgress?.({loaded:this._loaded});const e=new Uint8Array(t).buffer;return{value:e,done:!1}}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",(()=>{this._readCapability.resolve()})),t.on("end",(()=>{t.destroy(),this._done=!0,this._readCapability.resolve()})),t.on("error",(t=>{this._error(t)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function f(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class b extends g{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:s,suggestedLength:r}=(0,a.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=r||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(i)};this._request=null,"http:"===this._url.protocol?this._request=h.request(f(this._url,t.httpHeaders),e):this._request=l.request(f(this._url,t.httpHeaders),e),this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class v extends m{constructor(t,e,i){super(t),this._httpHeaders={};for(const n in t.httpHeaders){const e=t.httpHeaders[n];void 0!==e&&(this._httpHeaders[n]=e)}this._httpHeaders.Range=`bytes=${e}-${i-1}`;const s=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t}};this._request=null,"http:"===this._url.protocol?this._request=h.request(f(this._url,this._httpHeaders),s):this._request=l.request(f(this._url,this._httpHeaders),s),this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class A extends g{constructor(t){super(t);let e=decodeURIComponent(this._url.path);c.test(this._url.href)&&(e=e.replace(/^\//,"")),o.promises.lstat(e).then((t=>{this._contentLength=t.size,this._setReadableStream(o.createReadStream(e)),this._headersCapability.resolve()}),(t=>{"ENOENT"===t.code&&(t=new n.MissingPDFException(`Missing PDF "${e}".`)),this._storedError=t,this._headersCapability.reject(t)}))}}class y extends m{constructor(t,e,i){super(t);let s=decodeURIComponent(this._url.path);c.test(this._url.href)&&(s=s.replace(/^\//,"")),this._setReadableStream(o.createReadStream(s,{start:e,end:i-1}))}}s()}catch(r){s(r)}}),1)},573:(t,e,i)=>{i.a(t,(async(t,s)=>{try{i.d(e,{NodeCMapReaderFactory:()=>c,NodeCanvasFactory:()=>d,NodeFilterFactory:()=>l,NodeStandardFontDataFactory:()=>u});var n=i(583),a=i(292);let t,r,o;if(a.isNodeJS){t=await import("fs");try{r=await import("canvas")}catch{}try{o=await import("path2d")}catch{}}const h=function(e){return t.promises.readFile(e).then((t=>new Uint8Array(t)))};class l extends n.BaseFilterFactory{}class d extends n.BaseCanvasFactory{_createCanvas(t,e){return r.createCanvas(t,e)}}class c extends n.BaseCMapReaderFactory{_fetchData(t,e){return h(t).then((t=>({cMapData:t,compressionType:e})))}}class u extends n.BaseStandardFontDataFactory{_fetchData(t){return h(t)}}s()}catch(r){s(r)}}),1)}
22,626:(t,e,i)=>{i.d(e,{OptionalContentConfig:()=>o});var s=i(292),n=i(651);const a=Symbol("INTERNAL");class r{#Wa=!1;#qa=!1;#Ka=!1;#Xa=!0;constructor(t,{name:e,intent:i,usage:n}){this.#Wa=!!(t&s.RenderingIntentFlag.DISPLAY),this.#qa=!!(t&s.RenderingIntentFlag.PRINT),this.name=e,this.intent=i,this.usage=n}get visible(){if(this.#Ka)return this.#Xa;if(!this.#Xa)return!1;const{print:t,view:e}=this.usage;return this.#Wa?"OFF"!==e?.viewState:!this.#qa||"OFF"!==t?.printState}_setVisible(t,e,i=!1){t!==a&&(0,s.unreachable)("Internal method `_setVisible` called."),this.#Ka=i,this.#Xa=e}}class o{#Ya=null;#Ja=new Map;#Qa=null;#Za=null;constructor(t,e=s.RenderingIntentFlag.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,this.#Za=t.order;for(const i of t.groups)this.#Ja.set(i.id,new r(e,i));if("OFF"===t.baseState)for(const t of this.#Ja.values())t._setVisible(a,!1);for(const e of t.on)this.#Ja.get(e)._setVisible(a,!0);for(const e of t.off)this.#Ja.get(e)._setVisible(a,!1);this.#Qa=this.getHash()}}#tr(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n<e;n++){const e=t[n];let a;if(Array.isArray(e))a=this.#tr(e);else{if(!this.#Ja.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;a=this.#Ja.get(e).visible}switch(i){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return"And"===i}isVisible(t){if(0===this.#Ja.size)return!0;if(!t)return(0,s.info)("Optional content group not defined."),!0;if("OCG"===t.type)return this.#Ja.has(t.id)?this.#Ja.get(t.id).visible:((0,s.warn)(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#tr(t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!this.#Ja.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(this.#Ja.get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!this.#Ja.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(!this.#Ja.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!this.#Ja.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(!this.#Ja.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!this.#Ja.has(e))return(0,s.warn)(`Optional content group not found: ${e}`),!0;if(this.#Ja.get(e).visible)return!1}return!0}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){const i=this.#Ja.get(t);i?(i._setVisible(a,!!e,!0),this.#Ya=null):(0,s.warn)(`Optional content group not found: ${t}`)}setOCGState({state:t,preserveRB:e}){let i;for(const s of t){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}const t=this.#Ja.get(s);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);break}}this.#Ya=null}get hasInitialVisibility(){return null===this.#Qa||this.getHash()===this.#Qa}getOrder(){return this.#Ja.size?this.#Za?this.#Za.slice():[...this.#Ja.keys()]:null}getGroups(){return this.#Ja.size>0?(0,s.objectFromMap)(this.#Ja):null}getGroup(t){return this.#Ja.get(t)||null}getHash(){if(null!==this.#Ya)return this.#Ya;const t=new n.MurmurHash3_64;for(const[e,i]of this.#Ja)t.update(`${e}:${i.visible}`);return this.#Ya=t.hexdigest()}}},814:(t,e,i)=>{i.d(e,{cleanupTextLayer:()=>c,renderTextLayer:()=>b,updateTextLayer:()=>v});var s=i(292),n=i(419);const a=1e5,r=30,o=.8,h=new Map;let l=null;function d(){if(!l){const t=document.createElement("canvas");t.className="hiddenCanvasElement",document.body.append(t),l=t.getContext("2d",{alpha:!1})}return l}function c(){l?.canvas.remove(),l=null}function u(t){const e=h.get(t);if(e)return e;const i=d(),s=i.font;i.canvas.width=i.canvas.height=r,i.font=`${r}px ${t}`;const n=i.measureText("");let a=n.fontBoundingBoxAscent,l=Math.abs(n.fontBoundingBoxDescent);if(a){const e=a/(a+l);return h.set(t,e),i.canvas.width=i.canvas.height=0,i.font=s,e}i.strokeStyle="red",i.clearRect(0,0,r,r),i.strokeText("g",0,0);let c=i.getImageData(0,0,r,r).data;l=0;for(let o=c.length-1-3;o>=0;o-=4)if(c[o]>0){l=Math.ceil(o/4/r);break}i.clearRect(0,0,r,r),i.strokeText("A",0,r),c=i.getImageData(0,0,r,r).data,a=0;for(let o=0,h=c.length;o<h;o+=4)if(c[o]>0){a=r-Math.floor(o/4/r);break}if(i.canvas.width=i.canvas.height=0,i.font=s,a){const e=a/(a+l);return h.set(t,e),e}return h.set(t,o),o}
22function p(t,e,i){const n=document.createElement("span"),a={angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};t._textDivs.push(n);const r=s.Util.transform(t._transform,e.transform);let o=Math.atan2(r[1],r[0]);const h=i[e.fontName];h.vertical&&(o+=Math.PI/2);const l=t._fontInspectorEnabled&&h.fontSubstitution||h.fontFamily,d=Math.hypot(r[2],r[3]),c=d*u(l);let p,g;0===o?(p=r[4],g=r[5]-c):(p=r[4]+c*Math.sin(o),g=r[5]-c*Math.cos(o));const m="calc(var(--scale-factor)*",f=n.style;t._container===t._rootContainer?(f.left=`${(100*p/t._pageWidth).toFixed(2)}%`,f.top=`${(100*g/t._pageHeight).toFixed(2)}%`):(f.left=`${m}${p.toFixed(2)}px)`,f.top=`${m}${g.toFixed(2)}px)`),f.fontSize=`${m}${d.toFixed(2)}px)`,f.fontFamily=l,a.fontSize=d,n.setAttribute("role","presentation"),n.textContent=e.str,n.dir=e.dir,t._fontInspectorEnabled&&(n.dataset.fontName=h.fontSubstitutionLoadedName||e.fontName),0!==o&&(a.angle=o*(180/Math.PI));let b=!1;if(e.str.length>1)b=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(b=!0)}b&&(a.canvasWidth=h.vertical?e.height:e.width),t._textDivProperties.set(n,a),t._isReadableStream&&t._layoutText(n)}function g(t){const{div:e,scale:i,properties:s,ctx:n,prevFontSize:a,prevFontFamily:r}=t,{style:o}=e;let h="";if(0!==s.canvasWidth&&s.hasText){const{fontFamily:l}=o,{canvasWidth:d,fontSize:c}=s;a===c&&r===l||(n.font=`${c*i}px ${l}`,t.prevFontSize=c,t.prevFontFamily=l);const{width:u}=n.measureText(e.textContent);u>0&&(h=`scaleX(${d*i/u})`)}0!==s.angle&&(h=`rotate(${s.angle}deg) ${h}`),h.length>0&&(o.transform=h)}function m(t){if(t._canceled)return;const e=t._textDivs,i=t._capability,s=e.length;if(s>a)i.resolve();else{if(!t._isReadableStream)for(const i of e)t._layoutText(i);i.resolve()}}class f{constructor({textContentSource:t,container:e,viewport:i,textDivs:s,textDivProperties:a,textContentItemsStr:r}){this._textContentSource=t,this._isReadableStream=t instanceof ReadableStream,this._container=this._rootContainer=e,this._textDivs=s||[],this._textContentItemsStr=r||[],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:d()};const{pageWidth:o,pageHeight:h,pageX:l,pageY:c}=i.rawDims;this._transform=[1,0,0,-1,-l,c+h],this._pageWidth=o,this._pageHeight=h,(0,n.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(const i of t)if(void 0!==i.str)this._textContentItemsStr.push(i.str),p(this,i,e);else if("beginMarkedContentProps"===i.type||"beginMarkedContent"===i.type){const 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)}_layoutText(t){const e=this._layoutTextParams.properties=this._textDivProperties.get(t);if(this._layoutTextParams.div=t,g(this._layoutTextParams),e.hasText&&this._container.append(t),e.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this._container.append(t)}}_render(){const{promise:t,resolve:e,reject:i}=Promise.withResolvers();let s=Object.create(null);if(this._isReadableStream){const t=()=>{this._reader.read().then((({value:i,done:n})=>{n?e():(Object.assign(s,i.styles),this._processItems(i.items,s),t())}),i)};this._reader=this._textContentSource.getReader(),t()}else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');{const{items:t,styles:i}=this._textContentSource;this._processItems(t,i),e()}}t.then((()=>{s=null,m(this)}),this._capability.reject)}}function b(t){const e=new f(t);return e._render(),e}function v({container:t,viewport:e,textDivs:i,textDivProperties:s,mustRotate:a=!0,mustRescale:r=!0}
22){if(a&&(0,n.setLayerDimensions)(t,{rotation:e.rotation}),r){const t=d(),n=e.scale*(globalThis.devicePixelRatio||1),a={prevFontSize:null,prevFontFamily:null,div:null,scale:n,properties:null,ctx:t};for(const e of i)a.properties=s.get(e),a.div=e,g(a)}}},585:(t,e,i)=>{i.d(e,{PDFDataTransportStream:()=>a});var s=i(292),n=i(419);class a{constructor(t,{disableRange:e=!1,disableStream:i=!1}){(0,s.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:a,progressiveDone:r,contentDispositionFilename:o}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=o,a?.length>0){const 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=n,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}){const 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{const 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){const 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.");const t=this._queuedChunks;return this._queuedChunks=null,new r(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new o(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}}
22class r{constructor(t,e,i=!1,s=null){this._stream=t,this._done=i||!1,this._filename=(0,n.isPdfFile)(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length>0){const e=this._requests.shift();e.resolve({value:t,done:!1})}else 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){const t=this._queuedChunks.shift();return{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.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{const e=this._requests.shift();e.resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.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#er=null;static#ir="";static get workerPort(){return this.#er}static set workerPort(t){if(!("undefined"!==typeof Worker&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");this.#er=t}static get workerSrc(){return this.#ir}static set workerSrc(t){if("string"!==typeof t)throw new Error("Invalid `workerSrc` type.");this.#ir=t}}},284:(t,e,i)=>{i.d(e,{XfaLayer:()=>n});var s=i(50);class n{static setupStorage(t,e,i,s,n){const a=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==a.value&&(t.textContent=a.value),"print"===n)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"===n)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"===n)break;t.addEventListener("input",(t=>{s.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==a.value){t.setAttribute("value",a.value);for(const t of i.children)t.attributes.value===a.value?t.attributes.selected=!0:t.attributes.hasOwnProperty("selected")&&delete t.attributes.selected}t.addEventListener("input",(t=>{const i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:n})}));break}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:n}){const{attributes:a}=e,r=t instanceof HTMLAnchorElement;"radio"===a.type&&(a.name=`${a.name}-${s}`);for(const[o,h]of Object.entries(a))if(null!==h&&void 0!==h)switch(o){case"class":h.length&&t.setAttribute(o,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!r||"href"!==o&&"newWindow"!==o)&&t.setAttribute(o,h)}r&&n.addLinkAttributes(t,a.href,a.newWindow),i&&a.dataId&&this.setupStorage(t,a.dataId,e,i)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,a=t.intent||"display",r=document.createElement(n.name);n.attributes&&this.setAttributes({html:r,element:n,intent:a,linkService:i});const o="richText"!==a,h=t.div;if(h.append(r),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;h.style.transform=e}o&&h.setAttribute("class","xfaLayer xfaFont");const l=[];
22if(0===n.children.length){if(n.value){const t=document.createTextNode(n.value);r.append(t),o&&s.XfaText.shouldBuildText(n.name)&&l.push(t)}return{textDivs:l}}const d=[[n,-1,r]];while(d.length>0){const[t,n,r]=d.at(-1);if(n+1===t.children.length){d.pop();continue}const h=t.children[++d.at(-1)[1]];if(null===h)continue;const{name:c}=h;if("#text"===c){const t=document.createTextNode(h.value);l.push(t),r.append(t);continue}const u=h?.attributes?.xmlns?document.createElementNS(h.attributes.xmlns,c):document.createElement(c);if(r.append(u),h.attributes&&this.setAttributes({html:u,element:h,storage:e,intent:a,linkService:i}),h.children?.length>0)d.push([h,-1,u]);else if(h.value){const t=document.createTextNode(h.value);o&&s.XfaText.shouldBuildText(c)&&l.push(t),u.append(t)}}for(const s of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))s.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){const 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){const e=[],i={items:e,styles:Object.create(null)};function n(t){if(!t)return;let i=null;const a=t.name;if("#text"===a)i=t.value;else{if(!s.shouldBuildText(a))return;t?.attributes?.textContent?i=t.attributes.textContent:t.value&&(i=t.value)}if(null!==i&&e.push({str:i}),t.children)for(const e of t.children)n(e)}return n(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:()=>n.AbortException,AnnotationEditorLayer:()=>h.AnnotationEditorLayer,AnnotationEditorParamsType:()=>n.AnnotationEditorParamsType,AnnotationEditorType:()=>n.AnnotationEditorType,AnnotationEditorUIManager:()=>l.AnnotationEditorUIManager,AnnotationLayer:()=>d.AnnotationLayer,AnnotationMode:()=>n.AnnotationMode,CMapCompressionType:()=>n.CMapCompressionType,ColorPicker:()=>c.ColorPicker,DOMSVGFactory:()=>r.DOMSVGFactory,DrawLayer:()=>u.DrawLayer,FeatureTest:()=>n.FeatureTest,GlobalWorkerOptions:()=>p.GlobalWorkerOptions,ImageKind:()=>n.ImageKind,InvalidPDFException:()=>n.InvalidPDFException,MissingPDFException:()=>n.MissingPDFException,OPS:()=>n.OPS,Outliner:()=>g.Outliner,PDFDataRangeTransport:()=>a.PDFDataRangeTransport,PDFDateString:()=>r.PDFDateString,PDFWorker:()=>a.PDFWorker,PasswordResponses:()=>n.PasswordResponses,PermissionFlag:()=>n.PermissionFlag,PixelsPerInch:()=>r.PixelsPerInch,RenderingCancelledException:()=>r.RenderingCancelledException,UnexpectedResponseException:()=>n.UnexpectedResponseException,Util:()=>n.Util,VerbosityLevel:()=>n.VerbosityLevel,XfaLayer:()=>m.XfaLayer,build:()=>a.build,createValidAbsoluteUrl:()=>n.createValidAbsoluteUrl,fetchData:()=>r.fetchData,getDocument:()=>a.getDocument,getFilenameFromUrl:()=>r.getFilenameFromUrl,getPdfFilenameFromUrl:()=>r.getPdfFilenameFromUrl,getXfaPageViewport:()=>r.getXfaPageViewport,isDataScheme:()=>r.isDataScheme,isPdfFile:()=>r.isPdfFile,noContextMenu:()=>r.noContextMenu,normalizeUnicode:()=>n.normalizeUnicode,renderTextLayer:()=>o.renderTextLayer,setLayerDimensions:()=>r.setLayerDimensions,shadow:()=>n.shadow,updateTextLayer:()=>o.updateTextLayer,version:()=>a.version});var n=i(292),a=i(831),r=i(419),o=i(814),h=i(731),l=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(b){s(b)}}))},178:(t,e,i)=>{i.d(e,{MessageHandler:()=>o});var s=i(292);const n={UNKNOWN:0,DATA:1,ERROR:2},a={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function r(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=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#sr(e);if(e.callback){const t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===n.DATA)i.resolve(e.data);else{if(e.callback!==n.ERROR)throw new Error("Unexpected callback case");i.reject(r(e.reason))}return}const s=this.actionHandler[e.action];if(!s)throw new Error(`Unknown action from worker: ${e.action}`);
22if(e.callbackId){const t=this.sourceName,a=e.sourceName;new Promise((function(t){t(s(e.data))})).then((function(s){i.postMessage({sourceName:t,targetName:a,callback:n.DATA,callbackId:e.callbackId,data:s})}),(function(s){i.postMessage({sourceName:t,targetName:a,callback:n.ERROR,callbackId:e.callbackId,reason:r(s)})}))}else e.streamId?this.#nr(e):s(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(a){n.reject(a)}return n.promise}sendWithStream(t,e,i,n){const o=this.streamId++,h=this.sourceName,l=this.targetName,d=this.comObj;return new ReadableStream({start:i=>{const s=Promise.withResolvers();return this.streamControllers[o]={controller:i,startCall:s,pullCall:null,cancelCall:null,isClosed:!1},d.postMessage({sourceName:h,targetName:l,action:t,streamId:o,data:e,desiredSize:i.desiredSize},n),s.promise},pull:t=>{const e=Promise.withResolvers();return this.streamControllers[o].pullCall=e,d.postMessage({sourceName:h,targetName:l,stream:a.PULL,streamId:o,desiredSize:t.desiredSize}),e.promise},cancel:t=>{(0,s.assert)(t instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[o].cancelCall=e,this.streamControllers[o].isClosed=!0,d.postMessage({sourceName:h,targetName:l,stream:a.CANCEL,streamId:o,reason:r(t)}),e.promise}},i)}#nr(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,o=this.comObj,h=this,l=this.actionHandler[t.action],d={enqueue(t,s=1,r){if(this.isCancelled)return;const h=this.desiredSize;this.desiredSize-=s,h>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:n,stream:a.ENQUEUE,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:n,stream:a.CLOSE,streamId:e}),delete h.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:n,stream:a.ERROR,streamId:e,reason:r(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(l(t.data,d))})).then((function(){o.postMessage({sourceName:i,targetName:n,stream:a.START_COMPLETE,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:n,stream:a.START_COMPLETE,streamId:e,reason:r(t)})}))}#sr(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,o=this.comObj,h=this.streamControllers[e],l=this.streamSinks[e];switch(t.stream){case a.START_COMPLETE:t.success?h.startCall.resolve():h.startCall.reject(r(t.reason));break;case a.PULL_COMPLETE:t.success?h.pullCall.resolve():h.pullCall.reject(r(t.reason));break;case a.PULL:if(!l){o.postMessage({sourceName:i,targetName:n,stream:a.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,new Promise((function(t){t(l.onPull?.())})).then((function(){o.postMessage({sourceName:i,targetName:n,stream:a.PULL_COMPLETE,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:n,stream:a.PULL_COMPLETE,streamId:e,reason:r(t)})}));break;case a.ENQUEUE:if((0,s.assert)(h,"enqueue should have stream controller"),h.isClosed)break;h.controller.enqueue(t.chunk);break;case a.CLOSE:if((0,s.assert)(h,"close should have stream controller"),h.isClosed)break;h.isClosed=!0,h.controller.close(),this.#ar(h,e);break;case a.ERROR:(0,s.assert)(h,"error should have stream controller"),h.controller.error(r(t.reason)),this.#ar(h,e);break;case a.CANCEL_COMPLETE:t.success?h.cancelCall.resolve():h.cancelCall.reject(r(t.reason)),this.#ar(h,e);break;case a.CANCEL:if(!l)break;new Promise((function(e){e(l.onCancel?.(r(t.reason)))})).then((function(){o.postMessage({sourceName:i,targetName:n,stream:a.CANCEL_COMPLETE,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:n,stream:a.CANCEL_COMPLETE,streamId:e,reason:r(t)})})),l.sinkCapability.reject(r(t.reason)),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#ar(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:()=>r});const s=3285377520,n=4294901760,a=65535;
22class r{constructor(t){this.h1=t?4294967295&t:s,this.h2=t?4294967295&t:s}update(t){let e,i;if("string"===typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,n=t.length;s<n;s++){const n=t.charCodeAt(s);n<=255?e[i++]=n:(e[i++]=n>>>8,e[i++]=255&n)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const s=i>>2,r=i-4*s,o=new Uint32Array(e.buffer,0,s);let h=0,l=0,d=this.h1,c=this.h2;const u=3432918353,p=461845907,g=u&a,m=p&a;for(let f=0;f<s;f++)1&f?(h=o[f],h=h*u&n|h*g&a,h=h<<15|h>>>17,h=h*p&n|h*m&a,d^=h,d=d<<13|d>>>19,d=5*d+3864292196):(l=o[f],l=l*u&n|l*g&a,l=l<<15|l>>>17,l=l*p&n|l*m&a,c^=l,c=c<<13|c>>>19,c=5*c+3864292196);switch(h=0,r){case 3:h^=e[4*s+2]<<16;case 2:h^=e[4*s+1]<<8;case 1:h^=e[4*s],h=h*u&n|h*g&a,h=h<<15|h>>>17,h=h*p&n|h*m&a,1&s?d^=h:c^=h}this.h1=d,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&n|36045*t&a,e=4283543511*e&n|(2950163797*(e<<16|t>>>16)&n)>>>16,t^=e>>>1,t=444984403*t&n|60499*t&a,e=3301882366*e&n|(3120437893*(e<<16|t>>>16)&n)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}},292:(t,e,i)=>{i.d(e,{AbortException:()=>H,AnnotationBorderStyleType:()=>b,AnnotationEditorParamsType:()=>u,AnnotationEditorPrefix:()=>d,AnnotationEditorType:()=>c,AnnotationMode:()=>l,AnnotationPrefix:()=>tt,AnnotationType:()=>f,BaseException:()=>R,CMapCompressionType:()=>A,FONT_IDENTITY_MATRIX:()=>a,FeatureTest:()=>W,FormatError:()=>B,IDENTITY_MATRIX:()=>n,ImageKind:()=>m,InvalidPDFException:()=>F,LINE_FACTOR:()=>o,MAX_IMAGE_SIZE_TO_CACHE:()=>r,MissingPDFException:()=>O,OPS:()=>y,PasswordException:()=>L,PasswordResponses:()=>w,PermissionFlag:()=>p,RenderingIntentFlag:()=>h,TextRenderingMode:()=>g,UnexpectedResponseException:()=>N,UnknownErrorException:()=>D,Util:()=>K,VerbosityLevel:()=>v,assert:()=>M,bytesToString:()=>U,createValidAbsoluteUrl:()=>k,getUuid:()=>Z,getVerbosityLevel:()=>x,info:()=>T,isNodeJS:()=>s,normalizeUnicode:()=>Q,objectFromMap:()=>G,setVerbosityLevel:()=>E,shadow:()=>I,string32:()=>j,stringToBytes:()=>z,unreachable:()=>C,warn:()=>S});const s="object"===typeof process&&process+""==="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),n=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],r=1e7,o=1.35,h={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},l={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},d="pdfjs_internal_editor_",c={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},u={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},p={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},g={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},m={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},f={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},b={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},v={ERRORS:0,WARNINGS:1,INFOS:5},A={NONE:0,BINARY:1},y={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},w={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let _=v.WARNINGS;function E(t){Number.isInteger(t)&&(_=t)}function x(){return _}function T(t){_>=v.INFOS&&console.log(`Info: ${t}`)}function S(t){_>=v.WARNINGS&&console.log(`Warning: ${t}`)}function C(t){throw new Error(t)}function M(t,e){t||C(e)}function P(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function k(t,e=null,i=null){if(!t)return null;try{if(i&&"string"===typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=X(t)}catch{}}const s=e?new URL(t,e):new URL(t);if(P(s))return s}catch{}return null}function I(t,e,i,s=!1){return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}const R=function(){function t(e,i){this.constructor===t&&C("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class L extends R{constructor(t,e){super(t,"PasswordException"),this.code=e}}class D extends R{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class F extends R{constructor(t){super(t,"InvalidPDFException")}}class O extends R{constructor(t){super(t,"MissingPDFException")}}class N extends R{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class B extends R{constructor(t){super(t,"FormatError")}}class H extends R{constructor(t){super(t,"AbortException")}}function U(t){"object"===typeof t&&void 0!==t?.length||C("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const s=[];for(let n=0;n<e;n+=i){const a=Math.min(n+i,e),r=t.subarray(n,a);s.push(String.fromCharCode.apply(null,r))}return s.join("")}function z(t){"string"!==typeof t&&C("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function j(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)}function G(t){const e=Object.create(null);for(const[i,s]of t)e[i]=s;return e}function V(){const t=new Uint8Array(4);t[0]=1;const e=new Uint32Array(t.buffer,0,1);return 1===e[0]}function $(){try{return new Function(""),!0}catch{return!1}}class W{static get isLittleEndian(){return I(this,"isLittleEndian",V())}static get isEvalSupported(){return I(this,"isEvalSupported",$())}static get isOffscreenCanvasSupported(){return I(this,"isOffscreenCanvasSupported","undefined"!==typeof OffscreenCanvas)}static get platform(){return"undefined"!==typeof navigator&&"string"===typeof navigator?.platform?I(this,"platform",{isMac:navigator.platform.includes("Mac")}):I(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return I(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const q=Array.from(Array(256).keys(),(t=>t.toString(16).padStart(2,"0")));class K{static makeHexColor(t,e,i){return`#${q[t]}${q[e]}${q[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){const 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){const 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,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i;return[s,n]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),a=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],n[0],a[0]),Math.min(i[1],s[1],n[1],a[1]),Math.max(i[0],s[0],n[0],a[0]),Math.max(i[1],s[1],n[1],a[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const 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],n=t[2]*e[0]+t[3]*e[2],a=t[2]*e[1]+t[3]*e[3],r=(i+a)/2,o=Math.sqrt((i+a)**2-4*(i*a-n*s))/2,h=r+o||1,l=r-o||1;return[Math.sqrt(h),Math.sqrt(l)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;const n=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 n>a?null:[i,n,s,a]}static#rr(t,e,i,s,n,a,r,o,h,l){if(h<=0||h>=1)return;const d=1-h,c=h*h,u=c*h,p=d*(d*(d*t+3*h*e)+3*c*i)+u*s,g=d*(d*(d*n+3*h*a)+3*c*r)+u*o;l[0]=Math.min(l[0],p),l[1]=Math.min(l[1],g),l[2]=Math.max(l[2],p),l[3]=Math.max(l[3],g)}static#or(t,e,i,s,n,a,r,o,h,l,d,c){if(Math.abs(h)<1e-12)return void(Math.abs(l)>=1e-12&&this.#rr(t,e,i,s,n,a,r,o,-d/l,c));const u=l**2-4*d*h;if(u<0)return;const p=Math.sqrt(u),g=2*h;this.#rr(t,e,i,s,n,a,r,o,(-l+p)/g,c),this.#rr(t,e,i,s,n,a,r,o,(-l-p)/g,c)}static bezierBoundingBox(t,e,i,s,n,a,r,o,h){return h?(h[0]=Math.min(h[0],t,r),h[1]=Math.min(h[1],e,o),h[2]=Math.max(h[2],t,r),h[3]=Math.max(h[3],e,o)):h=[Math.min(t,r),Math.min(e,o),Math.max(t,r),Math.max(e,o)],this.#or(t,i,n,r,e,s,a,o,3*(3*(i-n)-t+r),6*(t-2*i+n),3*(i-t),h),this.#or(t,i,n,r,e,s,a,o,3*(3*(s-a)-e+o),6*(e-2*s+a),3*(s-e),h),h}}function X(t){return decodeURIComponent(escape(t))}let Y=null,J=null;function Q(t){return Y||(Y=/([\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,J=new Map([["ſt","ſt"]])),t.replaceAll(Y,((t,e,i)=>e?e.normalize("NFKC"):J.get(i)))}function Z(){if("undefined"!==typeof crypto&&"function"===typeof crypto?.randomUUID)return crypto.randomUUID();const 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)}const tt="pdfjs_internal_id_"}},a={};function Z(t){var e=a[t];
22if(void 0!==e)return e.exports;var i=a[t]={exports:{}};return n[t](i,i.exports,Z),i.exports}(()=>{var t="function"===typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",e="function"===typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",i="function"===typeof Symbol?Symbol("webpack error"):"__webpack_error__",s=t=>{t&&t.d<1&&(t.d=1,t.forEach((t=>t.r--)),t.forEach((t=>t.r--?t.r++:t())))},n=n=>n.map((n=>{if(null!==n&&"object"===typeof n){if(n[t])return n;if(n.then){var a=[];a.d=0,n.then((t=>{r[e]=t,s(a)}),(t=>{r[i]=t,s(a)}));var r={};return r[t]=t=>t(a),r}}var o={};return o[t]=t=>{},o[e]=n,o}));Z.a=(a,r,o)=>{var h;o&&((h=[]).d=-1);var l,d,c,u=new Set,p=a.exports,g=new Promise(((t,e)=>{c=e,d=t}));g[e]=p,g[t]=t=>(h&&t(h),u.forEach(t),g["catch"]((t=>{}))),a.exports=g,r((s=>{var a;l=n(s);var r=()=>l.map((t=>{if(t[i])throw t[i];return t[e]})),o=new Promise((e=>{a=()=>e(r),a.r=0;var i=t=>t!==h&&!u.has(t)&&(u.add(t),t&&!t.d&&(a.r++,t.push(a)));l.map((e=>e[t](i)))}));return a.r?o:r()}),(t=>(t?c(g[i]=t):d(p),s(h)))),h&&h.d<0&&(h.d=0)}})(),(()=>{Z.d=(t,e)=>{for(var i in e)Z.o(e,i)&&!Z.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})}})(),(()=>{Z.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})();var r=Z(228);r=globalThis.pdfjsLib=await(globalThis.pdfjsLibPromise=r);var o=r.AbortException,h=r.AnnotationEditorLayer,l=r.AnnotationEditorParamsType,d=r.AnnotationEditorType,c=r.AnnotationEditorUIManager,u=r.AnnotationLayer,p=r.AnnotationMode,g=r.CMapCompressionType,m=r.ColorPicker,f=r.DOMSVGFactory,b=r.DrawLayer,v=r.FeatureTest,A=r.GlobalWorkerOptions,y=r.ImageKind,w=r.InvalidPDFException,_=r.MissingPDFException,E=r.OPS,x=r.Outliner,T=r.PDFDataRangeTransport,S=r.PDFDateString,C=r.PDFWorker,M=r.PasswordResponses,P=r.PermissionFlag,k=r.PixelsPerInch,I=r.RenderingCancelledException,R=r.UnexpectedResponseException,L=r.Util,D=r.VerbosityLevel,F=r.XfaLayer,O=r.build,N=r.createValidAbsoluteUrl,B=r.fetchData,H=r.getDocument,U=r.getFilenameFromUrl,z=r.getPdfFilenameFromUrl,j=r.getXfaPageViewport,G=r.isDataScheme,V=r.isPdfFile,$=r.noContextMenu,W=r.normalizeUnicode,q=r.renderTextLayer,K=r.setLayerDimensions,X=r.shadow,Y=r.updateTextLayer,J=r.version;s()}catch(Q){s(Q)}}),1)},60989:function(t,e,i){i.a(t,(async function(t,s){try{i.r(e),i.d(e,{AbortException:function(){return n.e3},AnnotationEditorLayer:function(){return n.iX},AnnotationEditorParamsType:function(){return n.N5},AnnotationEditorType:function(){return n.vP},AnnotationEditorUIManager:function(){return n.s4},AnnotationLayer:function(){return n.dU},AnnotationMode:function(){return n.ng},CMapCompressionType:function(){return n.UU},ColorPicker:function(){return n.sk},DOMSVGFactory:function(){return n.xd},DrawLayer:function(){return n.Qh},FeatureTest:function(){return n.TV},GlobalWorkerOptions:function(){return n.EA},ImageKind:function(){return n.yI},InvalidPDFException:function(){return n.Z7},MissingPDFException:function(){return n.ew},OPS:function(){return n.Do},Outliner:function(){return n.TF},PDFDataRangeTransport:function(){return n.Tm},PDFDateString:function(){return n.G6},PDFWorker:function(){return n.nS},PasswordResponses:function(){return n.SS},PermissionFlag:function(){return n._i},PixelsPerInch:function(){return n.lf},RenderingCancelledException:function(){return n.ji},UnexpectedResponseException:function(){return n.wW},Util:function(){return n.J0},VerbosityLevel:function(){return n.mQ},XfaLayer:function(){return n.Tw},build:function(){return n.jq},createValidAbsoluteUrl:function(){return n.z7},fetchData:function(){return n.Fd},getDocument:function(){return n.YE},getFilenameFromUrl:function(){return n.Hw},getPdfFilenameFromUrl:function(){return n.lJ},getXfaPageViewport:function(){return n.dm},isDataScheme:function(){return n.Gz},isPdfFile:function(){return n.ZH},noContextMenu:function(){return n._p},normalizeUnicode:function(){return n.j_},renderTextLayer:function(){return n.pt},setLayerDimensions:function(){return n.HF},shadow:function(){return n.r7},updateTextLayer:function(){return n.Cu},version:function(){return n.rE}});var n=i(39887),a=t([n]);n=(a.then?(await a)():a)[0],"undefined"!==typeof window&&"Worker"
22in window&&(n.EA.workerPort=new Worker(new URL(i.p+i.u(2665),i.b),{type:void 0})),s()}catch(r){s(r)}}))}}]);
23//# sourceMappingURL=pdfjs-dist.4628c348.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.