1var xf=Object.defineProperty;var Vd=u=>{throw TypeError(u)};var _f=(u,s,e)=>s in u?xf(u,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):u[s]=e;var et=(u,s,e)=>_f(u,typeof s!="symbol"?s+"":s,e),sc=(u,s,e)=>s.has(u)||Vd("Cannot "+e);var o=(u,s,e)=>(sc(u,s,"read from private field"),e?e.call(u):s.get(u)),y=(u,s,e)=>s.has(u)?Vd("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(u):s.set(u,e),v=(u,s,e,i)=>(sc(u,s,"write to private field"),i?i.call(u,e):s.set(u,e),e),A=(u,s,e)=>(sc(u,s,"access private method"),e);var be=(u,s,e,i)=>({set _(n){v(u,s,n,e)},get _(){return o(u,s,i)}});import{_ as Sf}from"./PM00KlGD.js";import{_ as Ef}from"./BlRCviZe.js";import{d as Cf,i as Mt,S as za,k as Au,Q as Ua,l as Be,o as fe,n as dc,m as Z,y as ln,w as kf,v as Tf,t as Us,_ as Sd,p as Rr,q as Bl,F as Rf,x as Mf,b as wu,e as hn,W as Pf,g as If,ae as Df,I as Lf,b4 as Hl,s as Gd,au as jl}from"./D1FcBL9p.js";import{p as Ff,q as Nf,r as Of,s as Bf,g as Hf,c as jf,u as $f,t as zf,b as Uf,a as Vf,n as Gf,o as qf,m as Wf,h as Xf}from"./DaI1dtU0.js";import Yf from"./B-3PLJnv.js";/* empty css */import{_ as Kf}from"./EgekFmNJ.js";import{a as Qf,S as Jf}from"./skxs2esw.js";import{c as Zf,P as tg}from"./D0etmG_Y.js";import{m as Os,s as eg}from"./C43kgiy-.js";import{I as sg}from"./CROPNIdg.js";import{u as ig}from"./C8uHJLGK.js";import{u as ng}from"./qJlnEoVS.js";import"./DnzarRWK.js";import"./CXXDZoq4.js";const qd='<svg class="swiper-navigation-icon" width="11" height="20" viewBox="0 0 11 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.38296 20.0762C0.111788 19.805 0.111788 19.3654 0.38296 19.0942L9.19758 10.2796L0.38296 1.46497C0.111788 1.19379 0.111788 0.754138 0.38296 0.482966C0.654131 0.211794 1.09379 0.211794 1.36496 0.482966L10.4341 9.55214C10.8359 9.9539 10.8359 10.6053 10.4341 11.007L1.36496 20.0762C1.09379 20.3474 0.654131 20.3474 0.38296 20.0762Z" fill="currentColor"/></svg>';function rg({swiper:u,extendParams:s,on:e,emit:i}){s({navigation:{nextEl:null,prevEl:null,addIcons:!0,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),u.navigation={nextEl:null,prevEl:null,arrowSvg:qd};function n(f){let m;return f&&typeof f=="string"&&u.isElement&&(m=u.el.querySelector(f)||u.hostEl.querySelector(f),m)?m:(f&&(typeof f=="string"&&(m=[...document.querySelectorAll(f)]),u.params.uniqueNavElements&&typeof f=="string"&&m&&m.length>1&&u.el.querySelectorAll(f).length===1?m=u.el.querySelector(f):m&&m.length===1&&(m=m[0])),f&&!m?f:m)}function r(f,m){const b=u.params.navigation;f=Os(f),f.forEach(w=>{w&&(w.classList[m?"add":"remove"](...b.disabledClass.split(" ")),w.tagName==="BUTTON"&&(w.disabled=m),u.params.watchOverflow&&u.enabled&&w.classList[u.isLocked?"add":"remove"](b.lockClass))})}function a(){const{nextEl:f,prevEl:m}=u.navigation;if(u.params.loop){r(m,!1),r(f,!1);return}r(m,u.isBeginning&&!u.params.rewind),r(f,u.isEnd&&!u.params.rewind)}function l(f){f.preventDefault(),!(u.isBeginning&&!u.params.loop&&!u.params.rewind)&&(u.slidePrev(),i("navigationPrev"))}function h(f){f.preventDefault(),!(u.isEnd&&!u.params.loop&&!u.params.rewind)&&(u.slideNext(),i("navigationNext"))}function c(){const f=u.params.navigation;if(u.params.navigation=Zf(u,u.originalParams.navigation,u.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(f.nextEl||f.prevEl))return;let m=n(f.nextEl),b=n(f.prevEl);Object.assign(u.navigation,{nextEl:m,prevEl:b}),m=Os(m),b=Os(b);const w=(x,_)=>{if(x){if(f.addIcons&&x.matches(".swiper-button-next,.swiper-button-prev")&&!x.querySelector("svg")){const S=document.createElement("div");eg(S,qd),x.appendChild(S.querySelector("svg")),S.remove()}x.addEventListener("click",_==="next"?h:l)}!u.enabled&&x&&x.classList.add(...f.lockClass.split(" "))};m.forEach(x=>w(x,"next")),b.forEach(x=>w(x,"prev"))}function d(){let{nextEl:f,prevEl:m}=u.navigation;f=Os(f),m=Os(m);const b=(w,x)=>{w.removeEventListener("click",x==="next"?h:l),w.classList.remove(...u.params.navigation.disabledClass.split(" "))};f.forEach(w=>b(w,"next")),m.forEach(w=>b(w,"prev"))}e("init",()=>{u.params.navigation.enabled===!1?g():(c(),a())}),e("toEdge fromEdge lock unlock",()=>{a()}),e("destroy",()=>{d()}),e("enable disable",()=>{let{nextEl:f,prevEl:m}=u.navigation;if(f=Os(f),m=Os(m),u.enabled){a();return}[...f,...m].filter(b=>!!b).forEach(b=>b.classList.add(u.params.navigation.lockClass))}),e("click",(f,m)=>{let{nextEl:b,prevEl:w}=u.navigation;b=Os(b),w=Os(w);const x=m.target;let _=w.includes(x)||b.includes(x);if(u.isElement&&!_){const S=m.path||m.composedPath&&m.composedPath();S&&(_=S.find(E=>b.includes(E)||w.includes(E)))}if(u.params.navigation.hideOnClick&&!_){if(u.pagination&&u.params.pagination&&u.params.pagination.clickable&&(u.pagination.el===x||u.pagination.el.contains(x)))return;let S;b.length?S=b[0].classList.contains(u.params.navigation.hiddenClass):w.length&&(S=w[0].classList.contains(u.params.navigation.hiddenClass)),i(S===!0?"navigationShow":"navigationHide"),[...b,...w].filter(E=>
1!!E).forEach(E=>E.classList.toggle(u.params.navigation.hiddenClass))}});const p=()=>{u.el.classList.remove(...u.params.navigation.navigationDisabledClass.split(" ")),c(),a()},g=()=>{u.el.classList.add(...u.params.navigation.navigationDisabledClass.split(" ")),d()};Object.assign(u.navigation,{enable:p,disable:g,update:a,init:c,destroy:d})}const ag="data:image/svg+xml,%3csvg%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M11.4584%202.00009C12.2485%202.00542%2013.0822%202.24383%2013.656%202.77125C14.6831%203.71542%2015.0589%204.86113%2014.9926%205.99424C14.9275%207.10735%2014.4397%208.18712%2013.7841%209.06981C12.8643%2010.3083%2011.4842%2011.5194%2010.3616%2012.4062C9.79566%2012.8533%209.28539%2013.2252%208.91632%2013.4858C8.73178%2013.6162%208.58212%2013.7193%208.47806%2013.7898C8.43741%2013.8173%208.40341%2013.8398%208.37715%2013.8573L8.35697%2013.8707C8.3492%2013.8758%208.34247%2013.8805%208.33675%2013.8845L8.32494%2013.8926C8.32135%2013.8949%208.31837%2013.8965%208.31635%2013.8979C8.13641%2014.0155%207.90334%2014.0316%207.71247%2013.941L7.63357%2013.8956L7.62185%2013.8873L7.5906%2013.8661C7.56384%2013.8478%207.51978%2013.8176%207.47342%2013.7852C7.37239%2013.7147%207.22717%2013.6117%207.04765%2013.4813C6.68885%2013.2206%206.19213%2012.8488%205.6399%2012.4017C4.54422%2011.5146%203.19489%2010.3049%202.27754%209.06981C1.62775%208.19489%201.11167%207.12065%201.01588%206.01012C0.918153%204.87647%201.26267%203.72214%202.29707%202.77125C2.87089%202.2438%203.70447%202.00543%204.49464%202.00009C5.28891%201.99473%206.14322%202.22315%206.77188%202.75462L6.97656%202.94212C7.39061%203.34601%207.72825%203.84076%207.97652%204.26216C8.26468%203.77305%208.67332%203.1846%209.18194%202.75462L9.30225%202.6586C9.91688%202.19569%2010.7139%201.99513%2011.4584%202.00009Z'%20fill='%23E60013'/%3e%3c/svg%3e",og="data:image/svg+xml,%3csvg%20width='15'%20height='12'%20viewBox='0%200%2015%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M10.5624%209.20673e-05C11.3525%200.00542307%2012.1862%200.243829%2012.76%200.771251C13.7871%201.71542%2014.1629%202.86113%2014.0966%203.99424C14.0315%205.10735%2013.5437%206.18712%2012.8881%207.06981C11.9683%208.30828%2010.5882%209.51939%209.46558%2010.4062C8.89966%2010.8533%208.3894%2011.2252%208.02033%2011.4858C7.83578%2011.6162%207.68613%2011.7193%207.58207%2011.7898C7.53005%2011.825%207.48893%2011.8521%207.46098%2011.8707C7.447%2011.88%207.43641%2011.8877%207.42895%2011.8926C7.42536%2011.8949%207.42237%2011.8965%207.42035%2011.8979C7.41947%2011.8984%207.41857%2011.899%207.41801%2011.8994L7.41723%2011.9001H7.41645C7.23651%2012.0178%207.00734%2012.0316%206.81647%2011.941L6.73757%2011.8956L6.73679%2011.8948C6.73625%2011.8945%206.73535%2011.894%206.73445%2011.8933C6.73246%2011.892%206.72947%2011.8897%206.72585%2011.8873C6.71862%2011.8824%206.70809%2011.8754%206.6946%2011.8661C6.66749%2011.8475%206.62792%2011.8205%206.57742%2011.7852C6.47639%2011.7147%206.33117%2011.6117%206.15166%2011.4813C5.79286%2011.2206%205.29613%2010.8488%204.7439%2010.4017C3.64822%209.5146%202.2989%208.30492%201.38155%207.06981C0.731749%206.19489%200.215677%205.12065%200.11988%204.01012C0.0221569%202.87648%200.366671%201.72214%201.40108%200.771251C1.97489%200.243796%202.80848%200.00542827%203.59864%209.20673e-05C4.39291%20-0.00526799%205.24722%200.22315%205.87589%200.754619L6.08057%200.942116C6.49461%201.34601%206.83225%201.84076%207.08052%202.26216C7.36868%201.77305%207.77732%201.1846%208.28594%200.754619L8.40625%200.658602C9.02089%200.195693%209.8179%20-0.00487487%2010.5624%209.20673e-05ZM10.5546%201.16137C10.0508%201.15797%209.56976%201.28785%209.21793%201.52275L9.07497%201.62936C8.67308%201.96915%208.31386%202.49496%208.04533%202.97132C7.91457%203.20329%207.81199%203.41185%207.74222%203.56179C7.70743%203.63655%207.68063%203.69627%207.66331%203.73643C7.65466%203.7565%207.64859%203.77214%207.64456%203.7818C7.64261%203.78649%207.64069%203.78965%207.63988%203.79163L7.63909%203.79238L7.63988%203.79314C7.55001%204.01597%207.32769%204.16284%207.08052%204.16284C6.8336%204.16278%206.61193%204.0164%206.52195%203.79389L6.52117%203.79163C6.52035%203.78962%206.51843%203.78646%206.51649%203.7818C6.51246%203.77214%206.50639%203.7565%206.49774%203.73643C6.48042%203.69628%206.45437%203.63648%206.41962%203.56179C6.34983%203.41181%206.24656%203.20343%206.11572%202.97132C5.84717%202.49492%205.48801%201.96915%205.08608%201.62936C4.72868%201.32726%204.18286%201.15752%203.60723%201.16137C3.02738%201.16528%202.52048%201.34426%202.2276%201.61348C1.48205%202.29888%201.24546%203.09588%201.31592%203.91335C1.3884%204.75391%201.79029%205.63107%202.35572%206.3924C3.18347%207.50681%204.44013%208.64149%205.51418%209.51106C6.0468%209.94226%206.52615%2010.3017%206.87194%2010.5529C6.94995%2010.6096%207.02
1185%2010.6597%207.08521%2010.7048C7.15228%2010.6584%207.22922%2010.6072%207.31255%2010.5483C7.66828%2010.2971%208.16123%209.93768%208.70702%209.50652C9.80821%208.63661%2011.0886%207.50354%2011.9139%206.3924C12.4736%205.63876%2012.8492%204.76656%2012.8982%203.92847C12.9461%203.11053%2012.6863%202.30553%2011.9334%201.61348C11.6406%201.34431%2011.1343%201.16533%2010.5546%201.16137Z'%20fill='%23E60013'/%3e%3c/svg%3e",lg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAHlBMVEUUkeRHcEwTkeQTj+MQj+YUkeQUkeQTkOUTkOQTkeR0PiP3AAAACnRSTlP+AOFFI8SAZJClzLvqWgAAAJ5JREFUeJyl0T0OgkAQhuEvYzDauQlBy6m0lcLeJbGg4wjiDTQW2ll4AI7Mhp8wM9AQKJ8smy/vwpkPi+ARpQoOwErBFYgUnAEouAMk4RIOrAXkOFZUDpDwxsW+3/F577nZ0EEGKigVS6twfSmncztxAFgowi9PCRnA5AXE33/CW6975M1sGeiGkwn0gg30mwikeridPTGKPHoGs2MG1ICOJ9UNqdMQAAAAAElFTkSuQmCC",hg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAAG1BMVEVHcEwQj+QTkOUTj+QTkeQUj+QUkeQTj+MUkeSSxTdxAAAACHRSTlMAHqB76GDIRD6WDzoAAACASURBVHicPc+9CoNAEATgMSSmNZDiSgsFS/EsLBV8AJsDS0Wx1s7WH3Af2zv1dqoPpphdQOcHTlRYOXvpPXwdc/zwnwvLumKWEKGajD4bBNE+wkmCBV+l0gYukW86NzfdxXfDFD5Tr1hmIzPymD2Yg76FqJNSJquepTut+eYOcAKt4R7kLn5Y5gAAAABJRU5ErkJggg==",cg="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUBAMAAAB/pwA+AAAAG1BMVEWoqKhHcEynp6eoqKioqKinp6eoqKioqKioqKhTMlL7AAAACXRSTlP9AB59nV3Zuj1Aa3aiAAAAgElEQVR4nD3OsQrCMBDG8Q91cOwV0/ns4JyQPkCzOKuQByiF4mgE9/bNzZHm/sPHbzoOlOtlCDLju7IFKi/n1e28TVz5eCoX4l98Cc2RGMCGdrgfyMRoEzogyaluAocmCJsEdoUclKtT2k05XpUfUi6Zs52998OJYFD65h/6EtEfs8caCsQhbvAAAAAASUVORK5CYII=";var dg={9306:(u,s,e)=>{var i=e(4901),n=e(6823),r=TypeError;u.exports=function(a){if(i(a))return a;throw new r(n(a)+" is not a function")}},3506:(u,s,e)=>{var i=e(3925),n=String,r=TypeError;u.exports=function(a){if(i(a))return a;throw new r("Can't set "+n(a)+" as a prototype")}},7080:(u,s,e)=>{var i=e(4402).has;u.exports=function(n){return i(n),n}},679:(u,s,e)=>{var i=e(1625),n=TypeError;u.exports=function(r,a){if(i(a,r))return r;throw new n("Incorrect invocation")}},8551:(u,s,e)=>{var i=e(34),n=String,r=TypeError;u.exports=function(a){if(i(a))return a;throw new r(n(a)+" is not an object")}},7811:u=>{u.exports=typeof ArrayBuffer<"u"&&typeof DataView<"u"},7394:(u,s,e)=>{var i=e(4576),n=e(6706),r=e(2195),a=i.ArrayBuffer,l=i.TypeError;u.exports=a&&n(a.prototype,"byteLength","get")||function(h){if(r(h)!=="ArrayBuffer")throw new l("ArrayBuffer expected");return h.byteLength}},3238:(u,s,e)=>{var i=e(4576),n=e(7476),r=e(7394),a=i.ArrayBuffer,l=a&&a.prototype,h=l&&n(l.slice);u.exports=function(c){if(r(c)!==0||!h)return!1;try{return h(c,0,0),!1}catch{return!0}}},5169:(u,s,e)=>{var i=e(3238),n=TypeError;u.exports=function(r){if(i(r))throw new n("ArrayBuffer is detached");return r}},5636:(u,s,e)=>{var i=e(4576),n=e(9504),r=e(6706),a=e(7696),l=e(5169),h=e(7394),c=e(4483),d=e(1548),p=i.structuredClone,g=i.ArrayBuffer,f=i.DataView,m=Math.min,b=g.prototype,w=f.prototype,x=n(b.slice),_=r(b,"resizable","get"),S=r(b,"maxByteLength","get"),E=n(w.getInt8),C=n(w.setInt8);u.exports=(d||c)&&function(T,k,I){var P,N=h(T),O=k===void 0?N:a(k),Y=!_||!_(T);if(l(T),d&&(T=p(T,{transfer:[T]}),N===O&&(I||Y)))return T;if(N>=O&&(!I||Y))P=x(T,0,O);else{var K=I&&!Y&&S?{maxByteLength:S(T)}:void 0;P=new g(O,K);for(var V=new f(T),it=new f(P),rt=m(O,N),j=0;j<rt;j++)C(it,j,E(V,j))}return d||c(T),P}},4644:(u,s,e)=>{var i,n,r,a=e(7811),l=e(3724),h=e(4576),c=e(4901),d=e(34),p=e(9297),g=e(6955),f=e(6823),m=e(6699),b=e(6840),w=e(2106),x=e(1625),_=e(2787),S=e(2967),E=e(8227),C=e(3392),T=e(1181),k=T.enforce,I=T.get,P=h.Int8Array,N=P&&P.prototype,O=h.Uint8ClampedArray,Y=O&&O.prototype,K=P&&_(P),V=N&&_(N),it=Object.prototype,rt=h.TypeError,j=E("toStringTag"),H=C("TYPED_ARRAY_TAG"),xt="TypedArrayConstructor",vt=a&&!!S&&g(h.opera)!=="Opera",Yt=!1,ut={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},R={BigInt64Array:8,BigUint64Array:8},M=function(L){var $=_(L);if(d($)){var G=I($);return G&&p(G,xt)?G[xt]:M($)}},D=function(L){if(!d(L))return!1;var $=g(L);return p(ut,$)||p(R,$)};for(i in ut)(r=(n=h[i])&&n.prototype)?k(r)[xt]=n:vt=!1;for(i in R)(r=(n=h[i])&&n.prototype)&&(k(r)[xt]=n);if((!vt||!c(K)||K===Function.prototype)&&(K=function(){throw new rt("Incorrect invocation")},vt))for(i in ut)h[i]&&S(h[i],K);if((!vt||!V||V===it)&&(V=K.prototype,vt))for(i in ut)h[i]&&S(h[i].prototype,V);if(vt&&_(Y)!==V&&S(Y,V),l&&!p(V,j)){Yt=!0,w(V,j,{configurable:!0,get:function(){return d(this)?this[H]:void 0}});for(i in ut)h[i]&&m(h[i],H,i)}u.exports={NATIVE_ARRAY_BUFFER_VIEWS:vt,TYPED_ARRAY_TAG:Yt&&H,aTypedArray:function(L){if(D(L))return L;throw new rt("Target is not a typed array")},aTypedArrayConstructor:function(L){if(c(L)&&(!S||x(K,L)))return L;throw new rt(f(L)+" is not a typed array constructor")},exportTypedArrayMethod:function(L,$,G,_t){if(l){if(G)for(var ft in ut){var zt=h[ft];if(zt&&p(zt.prototype,L))try{delete zt.prototype[L]}catch{try{zt.prototype[L]=$}catch{}}}V[L]&&!G||b(V,L,G?$:vt&&N[L]||$,_t)}},exportTypedArrayStaticMethod:function(L,$,G){var _t,ft;if(l){if(S){if(G){for(_t in ut)if((ft=h[_t])&&p(ft,L))try{delete ft[L]}catch{}}if(K[L]&&!G)return;try{return b(K,L,G?$:vt&&K[L]||$)}catch{}}
1for(_t in ut)!(ft=h[_t])||ft[L]&&!G||b(ft,L,$)}},getTypedArrayConstructor:M,isView:function($){if(!d($))return!1;var G=g($);return G==="DataView"||p(ut,G)||p(R,G)},isTypedArray:D,TypedArray:K,TypedArrayPrototype:V}},5370:(u,s,e)=>{var i=e(6198);u.exports=function(n,r,a){for(var l=0,h=arguments.length>2?a:i(r),c=new n(h);h>l;)c[l]=r[l++];return c}},9617:(u,s,e)=>{var i=e(5397),n=e(5610),r=e(6198),a=function(l){return function(h,c,d){var p=i(h),g=r(p);if(g===0)return!l&&-1;var f,m=n(d,g);if(l&&c!=c){for(;g>m;)if((f=p[m++])!=f)return!0}else for(;g>m;m++)if((l||m in p)&&p[m]===c)return l||m||0;return!l&&-1}};u.exports={includes:a(!0),indexOf:a(!1)}},4527:(u,s,e)=>{var i=e(3724),n=e(4376),r=TypeError,a=Object.getOwnPropertyDescriptor,l=i&&!(function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(h){return h instanceof TypeError}})();u.exports=l?function(h,c){if(n(h)&&!a(h,"length").writable)throw new r("Cannot set read only .length");return h.length=c}:function(h,c){return h.length=c}},7680:(u,s,e)=>{var i=e(9504);u.exports=i([].slice)},7628:(u,s,e)=>{var i=e(6198);u.exports=function(n,r){for(var a=i(n),l=new r(a),h=0;h<a;h++)l[h]=n[a-h-1];return l}},9928:(u,s,e)=>{var i=e(6198),n=e(1291),r=RangeError;u.exports=function(a,l,h,c){var d=i(a),p=n(h),g=p<0?d+p:p;if(g>=d||g<0)throw new r("Incorrect index");for(var f=new l(d),m=0;m<d;m++)f[m]=m===g?c:a[m];return f}},6319:(u,s,e)=>{var i=e(8551),n=e(9539);u.exports=function(r,a,l,h){try{return h?a(i(l)[0],l[1]):a(l)}catch(c){n(r,"throw",c)}}},2195:(u,s,e)=>{var i=e(9504),n=i({}.toString),r=i("".slice);u.exports=function(a){return r(n(a),8,-1)}},6955:(u,s,e)=>{var i=e(2140),n=e(4901),r=e(2195),a=e(8227)("toStringTag"),l=Object,h=r((function(){return arguments})())==="Arguments";u.exports=i?r:function(c){var d,p,g;return c===void 0?"Undefined":c===null?"Null":typeof(p=(function(f,m){try{return f[m]}catch{}})(d=l(c),a))=="string"?p:h?r(d):(g=r(d))==="Object"&&n(d.callee)?"Arguments":g}},7740:(u,s,e)=>{var i=e(9297),n=e(5031),r=e(7347),a=e(4913);u.exports=function(l,h,c){for(var d=n(h),p=a.f,g=r.f,f=0;f<d.length;f++){var m=d[f];i(l,m)||c&&i(c,m)||p(l,m,g(h,m))}}},2211:(u,s,e)=>{var i=e(9039);u.exports=!i((function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype}))},2529:u=>{u.exports=function(s,e){return{value:s,done:e}}},6699:(u,s,e)=>{var i=e(3724),n=e(4913),r=e(6980);u.exports=i?function(a,l,h){return n.f(a,l,r(1,h))}:function(a,l,h){return a[l]=h,a}},6980:u=>{u.exports=function(s,e){return{enumerable:!(1&s),configurable:!(2&s),writable:!(4&s),value:e}}},4659:(u,s,e)=>{var i=e(3724),n=e(4913),r=e(6980);u.exports=function(a,l,h){i?n.f(a,l,r(0,h)):a[l]=h}},2106:(u,s,e)=>{var i=e(283),n=e(4913);u.exports=function(r,a,l){return l.get&&i(l.get,a,{getter:!0}),l.set&&i(l.set,a,{setter:!0}),n.f(r,a,l)}},6840:(u,s,e)=>{var i=e(4901),n=e(4913),r=e(283),a=e(9433);u.exports=function(l,h,c,d){d||(d={});var p=d.enumerable,g=d.name!==void 0?d.name:h;if(i(c)&&r(c,g,d),d.global)p?l[h]=c:a(h,c);else{try{d.unsafe?l[h]&&(p=!0):delete l[h]}catch{}p?l[h]=c:n.f(l,h,{value:c,enumerable:!1,configurable:!d.nonConfigurable,writable:!d.nonWritable})}return l}},6279:(u,s,e)=>{var i=e(6840);u.exports=function(n,r,a){for(var l in r)i(n,l,r[l],a);return n}},9433:(u,s,e)=>{var i=e(4576),n=Object.defineProperty;u.exports=function(r,a){try{n(i,r,{value:a,configurable:!0,writable:!0})}catch{i[r]=a}return a}},3724:(u,s,e)=>{var i=e(9039);u.exports=!i((function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}))},4483:(u,s,e)=>{var i,n,r,a,l=e(4576),h=e(9429),c=e(1548),d=l.structuredClone,p=l.ArrayBuffer,g=l.MessageChannel,f=!1;if(c)f=function(m){d(m,{transfer:[m]})};else if(p)try{g||(i=h("worker_threads"))&&(g=i.MessageChannel),g&&(n=new g,r=new p(2),a=function(m){n.port1.postMessage(null,[m])},r.byteLength===2&&(a(r),r.byteLength===0&&(f=a)))}catch{}u.exports=f},4055:(u,s,e)=>{var i=e(4576),n=e(34),r=i.document,a=n(r)&&n(r.createElement);u.exports=function(l){return a?r.createElement(l):{}}},6837:u=>{var s=TypeError;u.exports=function(e){if(e>9007199254740991)throw s("Maximum allowed index exceeded");return e}},5002:u=>{u.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1}
1,NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727:u=>{u.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193:(u,s,e)=>{var i=e(4215);u.exports=i==="NODE"},2839:(u,s,e)=>{var i=e(4576).navigator,n=i&&i.userAgent;u.exports=n?String(n):""},9519:(u,s,e)=>{var i,n,r=e(4576),a=e(2839),l=r.process,h=r.Deno,c=l&&l.versions||h&&h.version,d=c&&c.v8;d&&(n=(i=d.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!n&&a&&(!(i=a.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=a.match(/Chrome\/(\d+)/))&&(n=+i[1]),u.exports=n},4215:(u,s,e)=>{var i=e(4576),n=e(2839),r=e(2195),a=function(l){return n.slice(0,l.length)===l};u.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":i.Bun&&typeof Bun.version=="string"?"BUN":i.Deno&&typeof Deno.version=="object"?"DENO":r(i.process)==="process"?"NODE":i.window&&i.document?"BROWSER":"REST"},8574:(u,s,e)=>{var i=e(9504),n=Error,r=i("".replace),a=String(new n("zxcasd").stack),l=/\n\s*at [^:]*:[^\n]*/,h=l.test(a);u.exports=function(c,d){if(h&&typeof c=="string"&&!n.prepareStackTrace)for(;d--;)c=r(c,l,"");return c}},6518:(u,s,e)=>{var i=e(4576),n=e(7347).f,r=e(6699),a=e(6840),l=e(9433),h=e(7740),c=e(2796);u.exports=function(d,p){var g,f,m,b,w,x=d.target,_=d.global,S=d.stat;if(g=_?i:S?i[x]||l(x,{}):i[x]&&i[x].prototype)for(f in p){if(b=p[f],m=d.dontCallGetSet?(w=n(g,f))&&w.value:g[f],!c(_?f:x+(S?".":"#")+f,d.forced)&&m!==void 0){if(typeof b==typeof m)continue;h(b,m)}(d.sham||m&&m.sham)&&r(b,"sham",!0),a(g,f,b,d)}}},9039:u=>{u.exports=function(s){try{return!!s()}catch{return!0}}},8745:(u,s,e)=>{var i=e(616),n=Function.prototype,r=n.apply,a=n.call;u.exports=typeof Reflect=="object"&&Reflect.apply||(i?a.bind(r):function(){return a.apply(r,arguments)})},6080:(u,s,e)=>{var i=e(7476),n=e(9306),r=e(616),a=i(i.bind);u.exports=function(l,h){return n(l),h===void 0?l:r?a(l,h):function(){return l.apply(h,arguments)}}},616:(u,s,e)=>{var i=e(9039);u.exports=!i((function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")}))},9565:(u,s,e)=>{var i=e(616),n=Function.prototype.call;u.exports=i?n.bind(n):function(){return n.apply(n,arguments)}},350:(u,s,e)=>{var i=e(3724),n=e(9297),r=Function.prototype,a=i&&Object.getOwnPropertyDescriptor,l=n(r,"name"),h=l&&function(){}.name==="something",c=l&&(!i||i&&a(r,"name").configurable);u.exports={EXISTS:l,PROPER:h,CONFIGURABLE:c}},6706:(u,s,e)=>{var i=e(9504),n=e(9306);u.exports=function(r,a,l){try{return i(n(Object.getOwnPropertyDescriptor(r,a)[l]))}catch{}}},7476:(u,s,e)=>{var i=e(2195),n=e(9504);u.exports=function(r){if(i(r)==="Function")return n(r)}},9504:(u,s,e)=>{var i=e(616),n=Function.prototype,r=n.call,a=i&&n.bind.bind(r,r);u.exports=i?a:function(l){return function(){return r.apply(l,arguments)}}},9429:(u,s,e)=>{var i=e(4576),n=e(6193);u.exports=function(r){if(n){try{return i.process.getBuiltinModule(r)}catch{}try{return Function('return require("'+r+'")')()}catch{}}}},7751:(u,s,e)=>{var i=e(4576),n=e(4901);u.exports=function(r,a){return arguments.length<2?(l=i[r],n(l)?l:void 0):i[r]&&i[r][a];var l}},1767:u=>{u.exports=function(s){return{iterator:s,next:s.next,done:!1}}},8646:(u,s,e)=>{var i=e(9565),n=e(8551),r=e(1767),a=e(851);u.exports=function(l,h){h&&typeof l=="string"||n(l);var c=a(l);return r(n(c!==void 0?i(c,l):l))}},851:(u,s,e)=>{var i=e(6955),n=e(5966),r=e(4117),a=e(6269),l=e(8227)("iterator");u.exports=function(h){if(!r(h))return n(h,l)||n(h,"@@iterator")||a[i(h)]}},81:(u,s,e)=>{var i=e(9565),n=e(9306),r=e(8551),a=e(6823),l=e(851),h=TypeError;u.exports=function(c,d){var p=arguments.length<2?l(c):d;if(n(p))return r(i(p,c));throw new h(a(c)+" is not iterable")}},5966:(u,s,e)=>{var i=e(9306),n=e(4117);u.exports=function(r,a){var l=r[a];return n(l)?void 0:i(l)}},3789:(u,s,e)=>{var i=e(9306),n=e(8551),r=e(9565),a=e(1291),l=e(1767),h="Invalid size",c=RangeError,d=TypeError,p=Math.max,g=function(f,m){this.set=f,this.size=p(m,0),this.has=i(f.has),this.keys=i(f.keys)};g.prototype={getIterator:function(){return l(n(r(this.keys,this.set)))},includes:function(f){return r(this.has,this.set,f)}},u.exports=function(f){n(f);var m=+f.size;if(m!=m)throw new d(h);var b=a(m);if(b<0)throw new c(h);return new g(f,b)}},4576:function(u){var s=function(e){return e&&e.Math===Math&&e};u.exports=s(typeof globalThis=="object"&&globalThis)||s(typeof window=="object"&&window)||s(typeof self=="object"&&self)||s(typeof global=="object"&&global)||s(typeof this=="object"&&this)||(function(){return this})()||Function("return this")()},9297:(u,s,e)=>{var i=e(9504),n=e(8981),r=i({}.hasOwnProperty);u.exports=Object.hasOwn||function(l,h){return r(n(l),h)}},421:u=>{u.exports={}},397:(u,s,e)=>{var i=e(7751);u.exports=i("document","documentElement")},5917:(u,s,e)=>{var i=e(3724),n=e(9039),r=e(4055);u.exports=!i&&!n((function(){return Object.defineProperty(r("div"),"a",{get:function(){return 7}}).a!==7}))},7055:(u,s,e)=>{var i=e(9504),n=e(9039),r=e(2195),a=Object,l=i("".split);u.exports=n((function(){return!a("z").propertyIsEnumerable(0)}))?function(h){return r(h)==="String"?l(h,""):a(h)}:a},3167:(u,s,e)=>{var i=e(4901),n=e(34),r=e(2967);u.exports=function(a,l,h){var c,d;return r&&i(c=l.constructor)&&c!==h&&n(d=c.prototype)&&d!==h.prototype&&r(a,d),a}},3706:(u,s,e)=>{var i=e(9504),n=e(4901),r=e(7629),a=i(Function.toString);n(r.inspectSource)||(r.inspectSource=function(l){return a(l)}),u.exports=r.inspectSource},1181:(u,s,e)=>{var i,n,r,a=e(8622),l=e(4576),h=e(34),c=e(6699),d=e(9297),p=e(7629),g=e(6119),f=e(421),m="Object already initialized",b=l.TypeError,w=l.WeakMap;if(a||p.state){var x=p.state||(p.state=new w);
1x.get=x.get,x.has=x.has,x.set=x.set,i=function(S,E){if(x.has(S))throw new b(m);return E.facade=S,x.set(S,E),E},n=function(S){return x.get(S)||{}},r=function(S){return x.has(S)}}else{var _=g("state");f[_]=!0,i=function(S,E){if(d(S,_))throw new b(m);return E.facade=S,c(S,_,E),E},n=function(S){return d(S,_)?S[_]:{}},r=function(S){return d(S,_)}}u.exports={set:i,get:n,has:r,enforce:function(S){return r(S)?n(S):i(S,{})},getterFor:function(S){return function(E){var C;if(!h(E)||(C=n(E)).type!==S)throw new b("Incompatible receiver, "+S+" required");return C}}}},4209:(u,s,e)=>{var i=e(8227),n=e(6269),r=i("iterator"),a=Array.prototype;u.exports=function(l){return l!==void 0&&(n.Array===l||a[r]===l)}},4376:(u,s,e)=>{var i=e(2195);u.exports=Array.isArray||function(r){return i(r)==="Array"}},1108:(u,s,e)=>{var i=e(6955);u.exports=function(n){var r=i(n);return r==="BigInt64Array"||r==="BigUint64Array"}},4901:u=>{var s=typeof document=="object"&&document.all;u.exports=s===void 0&&s!==void 0?function(e){return typeof e=="function"||e===s}:function(e){return typeof e=="function"}},2796:(u,s,e)=>{var i=e(9039),n=e(4901),r=/#|\.prototype\./,a=function(p,g){var f=h[l(p)];return f===d||f!==c&&(n(g)?i(g):!!g)},l=a.normalize=function(p){return String(p).replace(r,".").toLowerCase()},h=a.data={},c=a.NATIVE="N",d=a.POLYFILL="P";u.exports=a},4117:u=>{u.exports=function(s){return s==null}},34:(u,s,e)=>{var i=e(4901);u.exports=function(n){return typeof n=="object"?n!==null:i(n)}},3925:(u,s,e)=>{var i=e(34);u.exports=function(n){return i(n)||n===null}},6395:u=>{u.exports=!1},757:(u,s,e)=>{var i=e(7751),n=e(4901),r=e(1625),a=e(7040),l=Object;u.exports=a?function(h){return typeof h=="symbol"}:function(h){var c=i("Symbol");return n(c)&&r(c.prototype,l(h))}},507:(u,s,e)=>{var i=e(9565);u.exports=function(n,r,a){for(var l,h,c=a?n:n.iterator,d=n.next;!(l=i(d,c)).done;)if((h=r(l.value))!==void 0)return h}},2652:(u,s,e)=>{var i=e(6080),n=e(9565),r=e(8551),a=e(6823),l=e(4209),h=e(6198),c=e(1625),d=e(81),p=e(851),g=e(9539),f=TypeError,m=function(w,x){this.stopped=w,this.result=x},b=m.prototype;u.exports=function(w,x,_){var S,E,C,T,k,I,P,N=_&&_.that,O=!(!_||!_.AS_ENTRIES),Y=!(!_||!_.IS_RECORD),K=!(!_||!_.IS_ITERATOR),V=!(!_||!_.INTERRUPTED),it=i(x,N),rt=function(H){return S&&g(S,"normal",H),new m(!0,H)},j=function(H){return O?(r(H),V?it(H[0],H[1],rt):it(H[0],H[1])):V?it(H,rt):it(H)};if(Y)S=w.iterator;else if(K)S=w;else{if(!(E=p(w)))throw new f(a(w)+" is not iterable");if(l(E)){for(C=0,T=h(w);T>C;C++)if((k=j(w[C]))&&c(b,k))return k;return new m(!1)}S=d(w,E)}for(I=Y?w.next:S.next;!(P=n(I,S)).done;){try{k=j(P.value)}catch(H){g(S,"throw",H)}if(typeof k=="object"&&k&&c(b,k))return k}return new m(!1)}},9539:(u,s,e)=>{var i=e(9565),n=e(8551),r=e(5966);u.exports=function(a,l,h){var c,d;n(a);try{if(!(c=r(a,"return"))){if(l==="throw")throw h;return h}c=i(c,a)}catch(p){d=!0,c=p}if(l==="throw")throw h;if(d)throw c;return n(c),h}},9462:(u,s,e)=>{var i=e(9565),n=e(2360),r=e(6699),a=e(6279),l=e(8227),h=e(1181),c=e(5966),d=e(7657).IteratorPrototype,p=e(2529),g=e(9539),f=l("toStringTag"),m="IteratorHelper",b="WrapForValidIterator",w=h.set,x=function(E){var C=h.getterFor(E?b:m);return a(n(d),{next:function(){var k=C(this);if(E)return k.nextHandler();try{var I=k.done?void 0:k.nextHandler();return p(I,k.done)}catch(P){throw k.done=!0,P}},return:function(){var T=C(this),k=T.iterator;if(T.done=!0,E){var I=c(k,"return");return I?i(I,k):p(void 0,!0)}if(T.inner)try{g(T.inner.iterator,"normal")}catch(P){return g(k,"throw",P)}return k&&g(k,"normal"),p(void 0,!0)}})},_=x(!0),S=x(!1);r(S,f,"Iterator Helper"),u.exports=function(E,C){var T=function(I,P){P?(P.iterator=I.iterator,P.next=I.next):P=I,P.type=C?b:m,P.nextHandler=E,P.counter=0,P.done=!1,w(this,P)};return T.prototype=C?_:S,T}},713:(u,s,e)=>{var i=e(9565),n=e(9306),r=e(8551),a=e(1767),l=e(9462),h=e(6319),c=l((function(){var d=this.iterator,p=r(i(this.next,d));if(!(this.done=!!p.done))return h(d,this.mapper,[p.value,this.counter++],!0)}));u.exports=function(p){return r(this),n(p),new c(a(this),{mapper:p})}},7657:(u,s,e)=>{var i,n,r,a=e(9039),l=e(4901),h=e(34),c=e(2360),d=e(2787),p=e(6840),g=e(8227),f=e(6395),m=g("iterator"),b=!1;[].keys&&("next"in(r=[].keys())?(n=d(d(r)))!==Object.prototype&&(i=n):b=!0),!h(i)||a((function(){var w={};return i[m].call(w)!==w}))?i={}:f&&(i=c(i)),l(i[m])||p(i,m,(function(){return this})),u.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:b}},6269:u=>{u.exports={}},6198:(u,s,e)=>{var i=e(8014);u.exports=function(n){return i(n.length)}},283:(u,s,e)=>{var i=e(9504),n=e(9039),r=e(4901),a=e(9297),l=e(3724),h=e(350).CONFIGURABLE,c=e(3706),d=e(1181),p=d.enforce,g=d.get,f=String,m=Object.defineProperty,b=i("".slice),w=i("".replace),x=i([].join),_=l&&!n((function(){return m((function(){}),"length",{value:8}).length!==8})),S=String(String).split("String"),E=u.exports=function(C,T,k){b(f(T),0,7)==="Symbol("&&(T="["+w(f(T),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),k&&k.getter&&(T="get "+T),k&&k.setter&&(T="set "+T),(!a(C,"n
1ame")||h&&C.name!==T)&&(l?m(C,"name",{value:T,configurable:!0}):C.name=T),_&&k&&a(k,"arity")&&C.length!==k.arity&&m(C,"length",{value:k.arity});try{k&&a(k,"constructor")&&k.constructor?l&&m(C,"prototype",{writable:!1}):C.prototype&&(C.prototype=void 0)}catch{}var I=p(C);return a(I,"source")||(I.source=x(S,typeof T=="string"?T:"")),C};Function.prototype.toString=E((function(){return r(this)&&g(this).source||c(this)}),"toString")},741:u=>{var s=Math.ceil,e=Math.floor;u.exports=Math.trunc||function(n){var r=+n;return(r>0?e:s)(r)}},6043:(u,s,e)=>{var i=e(9306),n=TypeError,r=function(a){var l,h;this.promise=new a((function(c,d){if(l!==void 0||h!==void 0)throw new n("Bad Promise constructor");l=c,h=d})),this.resolve=i(l),this.reject=i(h)};u.exports.f=function(a){return new r(a)}},2603:(u,s,e)=>{var i=e(655);u.exports=function(n,r){return n===void 0?arguments.length<2?"":r:i(n)}},4149:u=>{var s=RangeError;u.exports=function(e){if(e==e)return e;throw new s("NaN is not allowed")}},2360:(u,s,e)=>{var i,n=e(8551),r=e(6801),a=e(8727),l=e(421),h=e(397),c=e(4055),d=e(6119),p="prototype",g="script",f=d("IE_PROTO"),m=function(){},b=function(_){return"<"+g+">"+_+"</"+g+">"},w=function(_){_.write(b("")),_.close();var S=_.parentWindow.Object;return _=null,S},x=function(){try{i=new ActiveXObject("htmlfile")}catch{}x=typeof document<"u"?document.domain&&i?w(i):(function(){var S,E=c("iframe"),C="java"+g+":";return E.style.display="none",h.appendChild(E),E.src=String(C),(S=E.contentWindow.document).open(),S.write(b("document.F=Object")),S.close(),S.F})():w(i);for(var _=a.length;_--;)delete x[p][a[_]];return x()};l[f]=!0,u.exports=Object.create||function(S,E){var C;return S!==null?(m[p]=n(S),C=new m,m[p]=null,C[f]=S):C=x(),E===void 0?C:r.f(C,E)}},6801:(u,s,e)=>{var i=e(3724),n=e(8686),r=e(4913),a=e(8551),l=e(5397),h=e(1072);s.f=i&&!n?Object.defineProperties:function(d,p){a(d);for(var g,f=l(p),m=h(p),b=m.length,w=0;b>w;)r.f(d,g=m[w++],f[g]);return d}},4913:(u,s,e)=>{var i=e(3724),n=e(5917),r=e(8686),a=e(8551),l=e(6969),h=TypeError,c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,p="enumerable",g="configurable",f="writable";s.f=i?r?function(b,w,x){if(a(b),w=l(w),a(x),typeof b=="function"&&w==="prototype"&&"value"in x&&f in x&&!x[f]){var _=d(b,w);_&&_[f]&&(b[w]=x.value,x={configurable:g in x?x[g]:_[g],enumerable:p in x?x[p]:_[p],writable:!1})}return c(b,w,x)}:c:function(b,w,x){if(a(b),w=l(w),a(x),n)try{return c(b,w,x)}catch{}if("get"in x||"set"in x)throw new h("Accessors not supported");return"value"in x&&(b[w]=x.value),b}},7347:(u,s,e)=>{var i=e(3724),n=e(9565),r=e(8773),a=e(6980),l=e(5397),h=e(6969),c=e(9297),d=e(5917),p=Object.getOwnPropertyDescriptor;s.f=i?p:function(f,m){if(f=l(f),m=h(m),d)try{return p(f,m)}catch{}if(c(f,m))return a(!n(r.f,f,m),f[m])}},8480:(u,s,e)=>{var i=e(1828),n=e(8727).concat("length","prototype");s.f=Object.getOwnPropertyNames||function(a){return i(a,n)}},3717:(u,s)=>{s.f=Object.getOwnPropertySymbols},2787:(u,s,e)=>{var i=e(9297),n=e(4901),r=e(8981),a=e(6119),l=e(2211),h=a("IE_PROTO"),c=Object,d=c.prototype;u.exports=l?c.getPrototypeOf:function(p){var g=r(p);if(i(g,h))return g[h];var f=g.constructor;return n(f)&&g instanceof f?f.prototype:g instanceof c?d:null}},1625:(u,s,e)=>{var i=e(9504);u.exports=i({}.isPrototypeOf)},1828:(u,s,e)=>{var i=e(9504),n=e(9297),r=e(5397),a=e(9617).indexOf,l=e(421),h=i([].push);u.exports=function(c,d){var p,g=r(c),f=0,m=[];for(p in g)!n(l,p)&&n(g,p)&&h(m,p);for(;d.length>f;)n(g,p=d[f++])&&(~a(m,p)||h(m,p));return m}}
1,1072:(u,s,e)=>{var i=e(1828),n=e(8727);u.exports=Object.keys||function(a){return i(a,n)}},8773:(u,s)=>{var e={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,n=i&&!e.call({1:2},1);s.f=n?function(a){var l=i(this,a);return!!l&&l.enumerable}:e},2967:(u,s,e)=>{var i=e(6706),n=e(34),r=e(7750),a=e(3506);u.exports=Object.setPrototypeOf||("__proto__"in{}?(function(){var l,h=!1,c={};try{(l=i(Object.prototype,"__proto__","set"))(c,[]),h=c instanceof Array}catch{}return function(p,g){return r(p),a(g),n(p)&&(h?l(p,g):p.__proto__=g),p}})():void 0)},4270:(u,s,e)=>{var i=e(9565),n=e(4901),r=e(34),a=TypeError;u.exports=function(l,h){var c,d;if(h==="string"&&n(c=l.toString)&&!r(d=i(c,l))||n(c=l.valueOf)&&!r(d=i(c,l))||h!=="string"&&n(c=l.toString)&&!r(d=i(c,l)))return d;throw new a("Can't convert object to primitive value")}},5031:(u,s,e)=>{var i=e(7751),n=e(9504),r=e(8480),a=e(3717),l=e(8551),h=n([].concat);u.exports=i("Reflect","ownKeys")||function(d){var p=r.f(l(d)),g=a.f;return g?h(p,g(d)):p}},8235:(u,s,e)=>{var i=e(9504),n=e(9297),r=SyntaxError,a=parseInt,l=String.fromCharCode,h=i("".charAt),c=i("".slice),d=i(/./.exec),p={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":` 2`,"\\r":"\r","\\t":" "},g=/^[\da-f]{4}$/i,f=/^[\u0000-\u001F]$/;u.exports=function(m,b){for(var w=!0,x="";b<m.length;){var _=h(m,b);if(_==="\\"){var S=c(m,b,b+2);if(n(p,S))x+=p[S],b+=2;else{if(S!=="\\u")throw new r('Unknown escape sequence: "'+S+'"');var E=c(m,b+=2,b+4);if(!d(g,E))throw new r("Bad Unicode escape at: "+b);x+=l(a(E,16)),b+=4}}else{if(_==='"'){w=!1,b++;break}if(d(f,_))throw new r("Bad control character in string literal at: "+b);x+=_,b++}}if(w)throw new r("Unterminated string at: "+b);return{value:x,end:b}}},1103:u=>{u.exports=function(s){try{return{error:!1,value:s()}}catch(e){return{error:!0,value:e}}}},7750:(u,s,e)=>{var i=e(4117),n=TypeError;u.exports=function(r){if(i(r))throw new n("Can't call method on "+r);return r}},9286:(u,s,e)=>{var i=e(4402),n=e(8469),r=i.Set,a=i.add;u.exports=function(l){var h=new r;return n(l,(function(c){a(h,c)})),h}},3440:(u,s,e)=>{var i=e(7080),n=e(4402),r=e(9286),a=e(5170),l=e(3789),h=e(8469),c=e(507),d=n.has,p=n.remove;u.exports=function(f){var m=i(this),b=l(f),w=r(m);return a(m)<=b.size?h(m,(function(x){b.includes(x)&&p(w,x)})):c(b.getIterator(),(function(x){d(m,x)&&p(w,x)})),w}},4402:(u,s,e)=>{var i=e(9504),n=Set.prototype;u.exports={Set,add:i(n.add),has:i(n.has),remove:i(n.delete),proto:n}},8750:(u,s,e)=>{var i=e(7080),n=e(4402),r=e(5170),a=e(3789),l=e(8469),h=e(507),c=n.Set,d=n.add,p=n.has;u.exports=function(f){var m=i(this),b=a(f),w=new c;return r(m)>b.size?h(b.getIterator(),(function(x){p(m,x)&&d(w,x)})):l(m,(function(x){b.includes(x)&&d(w,x)})),w}},4449:(u,s,e)=>{var i=e(7080),n=e(4402).has,r=e(5170),a=e(3789),l=e(8469),h=e(507),c=e(9539);u.exports=function(p){var g=i(this),f=a(p);if(r(g)<=f.size)return l(g,(function(b){if(f.includes(b))return!1}),!0)!==!1;var m=f.getIterator();return h(m,(function(b){if(n(g,b))return c(m,"normal",!1)}))!==!1}},3838:(u,s,e)=>{var i=e(7080),n=e(5170),r=e(8469),a=e(3789);u.exports=function(h){var c=i(this),d=a(h);return!(n(c)>d.size)&&r(c,(function(p){if(!d.includes(p))return!1}),!0)!==!1}},8527:(u,s,e)=>{var i=e(7080),n=e(4402).has,r=e(5170),a=e(3789),l=e(507),h=e(9539);u.exports=function(d){var p=i(this),g=a(d);if(r(p)<g.size)return!1;var f=g.getIterator();return l(f,(function(m){if(!n(p,m))return h(f,"normal",!1)}))!==!1}},8469:(u,s,e)=>{var i=e(9504),n=e(507),r=e(4402),a=r.Set,l=r.proto,h=i(l.forEach),c=i(l.keys),d=c(new a).next;u.exports=function(p,g,f){return f?n({iterator:c(p),next:d},g):h(p,g)}},4916:(u,s,e)=>{var i=e(7751),n=function(r){return{size:r,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};u.exports=function(r){var a=i("Set");try{new a()[r](n(0));try{return new a()[r](n(-1)),!1}catch{return!0}}catch{return!1}}},5170:(u,s,e)=>{var i=e(6706),n=e(4402);u.exports=i(n.proto,"size","get")||function(r){return r.size}},3650:(u,s,e)=>{var i=e(7080),n=e(4402),r=e(9286),a=e(3789),l=e(507),h=n.add,c=n.has,d=n.remove;u.exports=function(g){var f=i(this),m=a(g).getIterator(),b=r(f);return l(m,(function(w){c(f,w)?d(b,w):h(b,w)}
2)),b}},4204:(u,s,e)=>{var i=e(7080),n=e(4402).add,r=e(9286),a=e(3789),l=e(507);u.exports=function(c){var d=i(this),p=a(c).getIterator(),g=r(d);return l(p,(function(f){n(g,f)})),g}},6119:(u,s,e)=>{var i=e(5745),n=e(3392),r=i("keys");u.exports=function(a){return r[a]||(r[a]=n(a))}},7629:(u,s,e)=>{var i=e(6395),n=e(4576),r=e(9433),a="__core-js_shared__",l=u.exports=n[a]||r(a,{});(l.versions||(l.versions=[])).push({version:"3.39.0",mode:i?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745:(u,s,e)=>{var i=e(7629);u.exports=function(n,r){return i[n]||(i[n]=r||{})}},1548:(u,s,e)=>{var i=e(4576),n=e(9039),r=e(9519),a=e(4215),l=i.structuredClone;u.exports=!!l&&!n((function(){if(a==="DENO"&&r>92||a==="NODE"&&r>94||a==="BROWSER"&&r>97)return!1;var h=new ArrayBuffer(8),c=l(h,{transfer:[h]});return h.byteLength!==0||c.byteLength!==8}))},4495:(u,s,e)=>{var i=e(9519),n=e(9039),r=e(4576).String;u.exports=!!Object.getOwnPropertySymbols&&!n((function(){var a=Symbol("symbol detection");return!r(a)||!(Object(a)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},5610:(u,s,e)=>{var i=e(1291),n=Math.max,r=Math.min;u.exports=function(a,l){var h=i(a);return h<0?n(h+l,0):r(h,l)}},5854:(u,s,e)=>{var i=e(2777),n=TypeError;u.exports=function(r){var a=i(r,"number");if(typeof a=="number")throw new n("Can't convert number to bigint");return BigInt(a)}},7696:(u,s,e)=>{var i=e(1291),n=e(8014),r=RangeError;u.exports=function(a){if(a===void 0)return 0;var l=i(a),h=n(l);if(l!==h)throw new r("Wrong length or index");return h}},5397:(u,s,e)=>{var i=e(7055),n=e(7750);u.exports=function(r){return i(n(r))}},1291:(u,s,e)=>{var i=e(741);u.exports=function(n){var r=+n;return r!=r||r===0?0:i(r)}},8014:(u,s,e)=>{var i=e(1291),n=Math.min;u.exports=function(r){var a=i(r);return a>0?n(a,9007199254740991):0}},8981:(u,s,e)=>{var i=e(7750),n=Object;u.exports=function(r){return n(i(r))}},9590:(u,s,e)=>{var i=e(1291),n=RangeError;u.exports=function(r){var a=i(r);if(a<0)throw new n("The argument can't be less than 0");return a}},2777:(u,s,e)=>{var i=e(9565),n=e(34),r=e(757),a=e(5966),l=e(4270),h=e(8227),c=TypeError,d=h("toPrimitive");u.exports=function(p,g){if(!n(p)||r(p))return p;var f,m=a(p,d);if(m){if(g===void 0&&(g="default"),f=i(m,p,g),!n(f)||r(f))return f;throw new c("Can't convert object to primitive value")}return g===void 0&&(g="number"),l(p,g)}},6969:(u,s,e)=>{var i=e(2777),n=e(757);u.exports=function(r){var a=i(r,"string");return n(a)?a:a+""}},2140:(u,s,e)=>{var i={};i[e(8227)("toStringTag")]="z",u.exports=String(i)==="[object z]"},655:(u,s,e)=>{var i=e(6955),n=String;u.exports=function(r){if(i(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return n(r)}},6823:u=>{var s=String;u.exports=function(e){try{return s(e)}catch{return"Object"}}},3392:(u,s,e)=>{var i=e(9504),n=0,r=Math.random(),a=i(1 .toString);u.exports=function(l){return"Symbol("+(l===void 0?"":l)+")_"+a(++n+r,36)}},7040:(u,s,e)=>{var i=e(4495);u.exports=i&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},8686:(u,s,e)=>{var i=e(3724),n=e(9039);u.exports=i&&n((function(){return Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype!==42}))},2812:u=>{var s=TypeError;u.exports=function(e,i){if(e<i)throw new s("Not enough arguments");return e}},8622:(u,s,e)=>{var i=e(4576),n=e(4901),r=i.WeakMap;u.exports=n(r)&&/native code/.test(String(r))},8227:(u,s,e)=>{var i=e(4576),n=e(5745),r=e(9297),a=e(3392),l=e(4495),h=e(7040),c=i.Symbol,d=n("wks"),p=h?c.for||c:c&&c.withoutSetter||a;u.exports=function(g){return r(d,g)||(d[g]=l&&r(c,g)?c[g]:p("Symbol."+g)),d[g]}},6573:(u,s,e)=>{var i=e(3724),n=e(2106),r=e(3238),a=ArrayBuffer.prototype;i&&!("detached"in a)&&n(a,"detached",{configurable:!0,get:function(){return r(this)}})},7936:(u,s,e)=>{var i=e(6518),n=e(5636);n&&i({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return n(this,arguments.length?arguments[0]:void 0,!1)}})},8100:(u,s,e)=>{var i=e(6518),n=e(5636);n&&i({target:"ArrayBuffer",proto:!0},{transfer:function(){return n(this,arguments.length?arguments[0]:void 0,!0)}})},4114:(u,s,e)=>{var i=e(6518),n=e(8981),r=e(6198),a=e(4527),l=e(6837);i({target:"Array",proto:!0,arity:1,forced:e(9039)((function(){return[].push.call({length:4294967296},1)!==4294967297}))||!(function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(h){return h instanceof TypeError}})()},{push:function(c){var d=n(this),p=r(d),g=arguments.length;l(p+g);for(var f=0;f<g;f++)d[p]=arguments[f],p++;return a(d,p),p}})},8111:(u,s,e)=>{var i=e(6518),n=e(4576),r=e(679),a=e(8551),l=e(4901),h=e(2787),c=e(2106),d=e(4659),p=e(9039),g=e(9297),f=e(8227),m=e(7657).IteratorPrototype,b=e(3724),w=e(6395),x="constructor",_="Iterator",S=f("toStringTag"),E=TypeError,C=n[_],T=w||!l(C)||C.prototype!==m||!p((function(){C({})})),k=function(){if(r(this,m),h(this)===m)throw new E("Abstract class Iterator not directly constructable")},I=function(P,N){b?c(m,P,{configurable:!0,get:function(){return N},set:function(O){if(a(this),this===m)throw new E("You can't redefine this property");g(this,P)?this[P]=O:d(this,P,O)}}):m[P]=N};g(m,S)||I(S,_),!T&&g(m,x)&&m[x]!==Object||I(x,k),k.prototype=m,i({global:!0,constructor:!0,forced:T},{Iterator:k})},9314:(u,s,e)=>{var i=e(6518),n=e(9565),r=e(8551),a=e(1767),l=e(4149),h=e(9590),c=e(9462),d=e(6395),p=c((function(){for(var g,f=this.iterator,m=this.next;this.remaining;)if(this.remaining--,g=r(n(m,f)),this.done=!!g.done)return;if(g=r(n(m,f)),!(this.done=!!g.done))return g.value}));i({target:"Iterator",proto:!0,real:!0,forced:d},{drop:function(f){r(this);var m=h(l(+f));return new p(a(this),{remaining:m})}})},1148:(u,s,e)=>{var i=e(6518),n=e(2652),r=e(9306),a=e(8551),l=e(1767);i({target:"Iterator",proto:!0,real:!0},{every:function(c){a(this),r(c);var d=l(this),p=0;return!n(d,(function(g,f){if(!c(g,p++))return f()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489:(u,s,e)=>{var i=e(6518),n=e(9565),r=e(9306),a=e(8551),l=e(1767),h=e(9462),c=e(6319),d=e(6395),p=h((function(){for(var g,f,m=this.iterator,b=this.predicate,w=this.next;;){if(g=a(n(w,m)),this.done=!!g.done)return;if(f=g.value,c(m,b,[f,this.counter++],!0))return f}}));i({target:"Iterator",proto:!0,real:!0,forced:d},{filter:function(f){return a(this),r(f),new p(l(this),{predicate:f})}})},531:(u,s,e)=>{var i=e(6518),n=e(9565),r=e(9306),a=e(8551),l=e(1767),h=e(8646),c=e(9462),d=e(9539),p=e(6395),g=c((function(){for(var f,m,b=this.iterator,w=this.mapper;;){if(m=this.inner)try{if(!(f=a(n(m.next,m.iterator))).done)return f.value;this.inner=null}catch(x){d(b,"throw",x)}if(f=a(n(this.next,b)),this.done=!!f.done)return;try{this.inner=h(w(f.value,this.counter++),!1)}catch(x){d(b,"throw",x)}}}));i({target:"Iterator",proto:!0,real:!0,forced:p},{flatMap:function(m){return a(this),r(m),new g(l(this),{mapper:m,inner:null})}})},1701:(u,s,e)=>{var i=e(6518),n=e(713);i({target:"Iterator",proto:!0,real:!0,forced:e(6395)},{map:n})},3579:(u,s,e)=>{var i=e(6518),n=e(2652),r=e(9306),a=e(8551),l=e(1767);i({target:"Iterator",proto:!0,real:!0},{some:function(c){a(this),r(c);var d=l(this),p=0;return n(d,(function(g,f){if(c(g,p++))return f()}),{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1689:(u,s,e)=>{var i=e(6518),n=e(4576),r=e(8745),a=e(7680),l=e(6043),h=e(9306),c=e(1103),d=n.Promise,p=!1;i({target:"Promise",stat:!0,forced:!d||!d.try||c((function(){d.try((function(g){p=g===8}),8)})).error||!p},{try:function(g){var f=arguments.length>
21?a(arguments,1):[],m=l.f(this),b=c((function(){return r(h(g),void 0,f)}));return(b.error?m.reject:m.resolve)(b.value),m.promise}})},4628:(u,s,e)=>{var i=e(6518),n=e(6043);i({target:"Promise",stat:!0},{withResolvers:function(){var a=n.f(this);return{promise:a.promise,resolve:a.resolve,reject:a.reject}}})},7642:(u,s,e)=>{var i=e(6518),n=e(3440);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("difference")},{difference:n})},8004:(u,s,e)=>{var i=e(6518),n=e(9039),r=e(8750);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("intersection")||n((function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"}))},{intersection:r})},3853:(u,s,e)=>{var i=e(6518),n=e(4449);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("isDisjointFrom")},{isDisjointFrom:n})},5876:(u,s,e)=>{var i=e(6518),n=e(3838);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("isSubsetOf")},{isSubsetOf:n})},2475:(u,s,e)=>{var i=e(6518),n=e(8527);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("isSupersetOf")},{isSupersetOf:n})},5024:(u,s,e)=>{var i=e(6518),n=e(3650);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("symmetricDifference")},{symmetricDifference:n})},1698:(u,s,e)=>{var i=e(6518),n=e(4204);i({target:"Set",proto:!0,real:!0,forced:!e(4916)("union")},{union:n})},7467:(u,s,e)=>{var i=e(7628),n=e(4644),r=n.aTypedArray,a=n.exportTypedArrayMethod,l=n.getTypedArrayConstructor;a("toReversed",(function(){return i(r(this),l(this))}))},4732:(u,s,e)=>{var i=e(4644),n=e(9504),r=e(9306),a=e(5370),l=i.aTypedArray,h=i.getTypedArrayConstructor,c=i.exportTypedArrayMethod,d=n(i.TypedArrayPrototype.sort);c("toSorted",(function(g){g!==void 0&&r(g);var f=l(this),m=a(h(f),f);return d(m,g)}))},9577:(u,s,e)=>{var i=e(9928),n=e(4644),r=e(1108),a=e(1291),l=e(5854),h=n.aTypedArray,c=n.getTypedArrayConstructor,d=n.exportTypedArrayMethod,p=!!(function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(g){return g===8}})();d("with",function(g,f){var m=h(this),b=a(g),w=r(m)?l(f):+f;return i(m,c(m),b,w)},!p)},8992:(u,s,e)=>{e(8111)},4743:(u,s,e)=>{e(9314)},3215:(u,s,e)=>{e(1148)},4520:(u,s,e)=>{e(2489)},670:(u,s,e)=>{e(531)},1454:(u,s,e)=>{e(1701)},7550:(u,s,e)=>{e(3579)},8335:(u,s,e)=>{var i=e(6518),n=e(3724),r=e(4576),a=e(7751),l=e(9504),h=e(9565),c=e(4901),d=e(34),p=e(4376),g=e(9297),f=e(655),m=e(6198),b=e(4659),w=e(9039),x=e(8235),_=e(4495),S=r.JSON,E=r.Number,C=r.SyntaxError,T=S&&S.parse,k=a("Object","keys"),I=Object.getOwnPropertyDescriptor,P=l("".charAt),N=l("".slice),O=l(/./.exec),Y=l([].push),K=/^\d$/,V=/^[1-9]$/,it=/^[\d-]$/,rt=/^[\t\n\r ]$/,j=function(R,M,D,L){var $,G,_t,ft,zt,Ze=R[M],ec=L&&Ze===L.value,wf=ec&&typeof L.source=="string"?{source:L.source}:{};if(d(Ze)){var Ud=p(Ze),Ol=ec?L.nodes:Ud?[]:{};if(Ud)for($=Ol.length,_t=m(Ze),ft=0;ft<_t;ft++)H(Ze,ft,j(Ze,""+ft,D,ft<$?Ol[ft]:void 0));else for(G=k(Ze),_t=m(G),ft=0;ft<_t;ft++)zt=G[ft],H(Ze,zt,j(Ze,zt,D,g(Ol,zt)?Ol[zt]:void 0))}return h(D,R,M,Ze,wf)},H=function(R,M,D){if(n){var L=I(R,M);if(L&&!L.configurable)return}D===void 0?delete R[M]:b(R,M,D)},xt=function(R,M,D,L){this.value=R,this.end=M,this.source=D,this.nodes=L},vt=function(R,M){this.source=R,this.index=M};vt.prototype={fork:function(R){return new vt(this.source,R)},parse:function(){var R=this.source,M=this.skip(rt,this.index),D=this.fork(M),L=P(R,M);if(O(it,L))return D.number();switch(L){case"{":return D.object();case"[":return D.array();case'"':return D.string();case"t":return D.keyword(!0);case"f":return D.keyword(!1);case"n":return D.keyword(null)}throw new C('Unexpected character: "'+L+'" at: '+M)},node:function(R,M,D,L,$){return new xt(M,L,R?null:N(this.source,D,L),$)},object:function(){for(var R=this.source,M=this.index+1,D=!1,L={},$={};M<R.length;){if(M=this.until(['"',"}"],M),P(R,M)==="}"&&!D){M++;break}var G=this.fork(M).string(),_t=G.value;M=G.end,M=this.until([":"],M)+1,M=this.skip(rt,M),G=this.fork(M).parse(),b($,_t,G),b(L,_t,G.value),M=this.until([",","}"],G.end);var ft=P(R,M);if(ft===",")D=!0,M++;else if(ft==="}"){M++;break}}return this.node(1,L,this.index,M,$)},array:function(){for(var R=this.source,M=this.index+1,D=!1,L=[],$=[];M<R.length;){if(M=this.skip(rt,M),P(R,M)==="]"&&!D){M++;break}var G=this.fork(M).parse();if(Y($,G),Y(L,G.value),M=this.until([",","]"],G.end),P(R,M)===",")D=!0,M++;else if(P(R,M)==="]"){M++;break}}return this.node(1,L,this.index,M,$)},string:function(){var R=this.index,M=x(this.source,this.index+1);return this.node(0,M.value,R,M.end)},number:function(){var R=this.source,M=this.index,D=M;if(P(R,D)==="-"&&D++,P(R,D)==="0")D++;
2else{if(!O(V,P(R,D)))throw new C("Failed to parse number at: "+D);D=this.skip(K,D+1)}if(P(R,D)==="."&&(D=this.skip(K,D+1)),(P(R,D)==="e"||P(R,D)==="E")&&(D++,P(R,D)!=="+"&&P(R,D)!=="-"||D++,D===(D=this.skip(K,D))))throw new C("Failed to parse number's exponent value at: "+D);return this.node(0,E(N(R,M,D)),M,D)},keyword:function(R){var M=""+R,D=this.index,L=D+M.length;if(N(this.source,D,L)!==M)throw new C("Failed to parse value at: "+D);return this.node(0,R,D,L)},skip:function(R,M){for(var D=this.source;M<D.length&&O(R,P(D,M));M++);return M},until:function(R,M){M=this.skip(rt,M);for(var D=P(this.source,M),L=0;L<R.length;L++)if(R[L]===D)return M;throw new C('Unexpected character: "'+D+'" at: '+M)}};var Yt=w((function(){var R,M="9007199254740993";return T(M,(function(D,L,$){R=$.source})),R!==M})),ut=_&&!w((function(){return 1/T("-0 ")!=-1/0}));i({target:"JSON",stat:!0,forced:Yt},{parse:function(M,D){return ut&&!c(D)?T(M):(function(L,$){L=f(L);var G=new vt(L,0),_t=G.parse(),ft=_t.value,zt=G.skip(rt,_t.end);if(zt<L.length)throw new C('Unexpected extra character: "'+P(L,zt)+'" after the parsed data at: '+zt);return c($)?j({"":ft},"",$,_t):ft})(M,D)}})},5247:(u,s,e)=>{e(1689)},4979:(u,s,e)=>{var i=e(6518),n=e(4576),r=e(7751),a=e(6980),l=e(4913).f,h=e(9297),c=e(679),d=e(3167),p=e(2603),g=e(5002),f=e(8574),m=e(3724),b=e(6395),w="DOMException",x=r("Error"),_=r(w),S=function(){c(this,E);var rt=arguments.length,j=p(rt<1?void 0:arguments[0]),H=p(rt<2?void 0:arguments[1],"Error"),xt=new _(j,H),vt=new x(j);return vt.name=w,l(xt,"stack",a(1,f(vt.stack,1))),d(xt,this,S),xt},E=S.prototype=_.prototype,C="stack"in new x(w),T="stack"in new _(1,2),k=_&&m&&Object.getOwnPropertyDescriptor(n,w),I=!(!k||k.writable&&k.configurable),P=C&&!I&&!T;i({global:!0,constructor:!0,forced:b||P},{DOMException:P?S:_});var N=r(w),O=N.prototype;if(O.constructor!==N){b||l(O,"constructor",a(1,N));for(var Y in g)if(h(g,Y)){var K=g[Y],V=K.s;h(N,V)||l(N,V,a(6,K.c))}}},4603:(u,s,e)=>{var i=e(6840),n=e(9504),r=e(655),a=e(2812),l=URLSearchParams,h=l.prototype,c=n(h.append),d=n(h.delete),p=n(h.forEach),g=n([].push),f=new l("a=1&a=2&b=3");f.delete("a",1),f.delete("b",void 0),f+""!="a=2"&&i(h,"delete",(function(m){var b=arguments.length,w=b<2?void 0:arguments[1];if(b&&w===void 0)return d(this,m);var x=[];p(this,(function(P,N){g(x,{key:N,value:P})})),a(b,1);for(var _,S=r(m),E=r(w),C=0,T=0,k=!1,I=x.length;C<I;)_=x[C++],k||_.key===S?(k=!0,d(this,_.key)):T++;for(;T<I;)(_=x[T++]).key===S&&_.value===E||c(this,_.key,_.value)}),{enumerable:!0,unsafe:!0})},7566:(u,s,e)=>{var i=e(6840),n=e(9504),r=e(655),a=e(2812),l=URLSearchParams,h=l.prototype,c=n(h.getAll),d=n(h.has),p=new l("a=1");!p.has("a",2)&&p.has("a",void 0)||i(h,"has",(function(f){var m=arguments.length,b=m<2?void 0:arguments[1];if(m&&b===void 0)return d(this,f);var w=c(this,f);a(m,1);for(var x=r(b),_=0;_<w.length;)if(w[_++]===x)return!0;return!1}),{enumerable:!0,unsafe:!0})},8721:(u,s,e)=>{var i=e(3724),n=e(9504),r=e(2106),a=URLSearchParams.prototype,l=n(a.forEach);i&&!("size"in a)&&r(a,"size",{get:function(){var c=0;return l(this,(function(){c++})),c},configurable:!0,enumerable:!0})}},Wd={};function ht(u){var s=Wd[u];if(s!==void 0)return s.exports;var e=Wd[u]={exports:{}};return dg[u].call(e.exports,e,e.exports,ht),e.exports}ht.d=(u,s)=>{for(var e in s)ht.o(s,e)&&!ht.o(u,e)&&Object.defineProperty(u,e,{enumerable:!0,get:s[e]})};ht.o=(u,s)=>Object.prototype.hasOwnProperty.call(u,s);var Q=globalThis.pdfjsLib={};ht.d(Q,{AbortException:()=>Zi,AnnotationEditorLayer:()=>bd,AnnotationEditorParamsType:()=>lt,AnnotationEditorType:()=>st,AnnotationEditorUIManager:()=>mr,AnnotationLayer:()=>l0,AnnotationMode:()=>wi,ColorPicker:()=>Rh,DOMSVGFactory:()=>Fd,DrawLayer:()=>wd,FeatureTest:()=>ge,GlobalWorkerOptions:()=>an,ImageKind:()=>ql,InvalidPDFException:()=>pc,MissingPDFException:()=>lo,OPS:()=>es,OutputScale:()=>mc,PDFDataRangeTransport:()=>_p,PDFDateString:()=>Eu,PDFWorker:()=>Pr,PasswordResponses:()=>Ug,PermissionFlag:()=>bg,PixelsPerInch:()=>Oa,RenderingCancelledException:()=>Td,TextLayer:()=>ho,TouchManager:()=>Ch,UnexpectedResponseException:()=>_h,Util:()=>W,VerbosityLevel:()=>Wh,XfaLayer:()=>Ep,build:()=>Um,createValidAbsoluteUrl:()=>qg,fetchData:()=>Qh,getDocument:()=>Nm,getFilenameFromUrl:()=>Yg,getPdfFilenameFromUrl:()=>Kg,getXfaPageViewport:()=>Qg,isDataScheme:()=>Jh,isPdfFile:()=>Rd,noContextMenu:()=>gs,normalizeUnicode:()=>Xg,setLayerDimensions:()=>gr,shadow:()=>ot,stopEvent:()=>je,version:()=>zm});ht(4114),ht(6573),ht(8100),ht(7936),ht(7467),ht(4732),ht(9577),ht(5247),ht(4979),ht(4603),ht(7566),ht(8721);const le=!(typeof process!="object"||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&process.type!=="browser"),xu=[1,0,0,1,0,0],uc=[.001,0,0,.001,0,0],ic=1.35,ug=1,Ed=2,xh=4,pg=16,fg=32,gg=64,mg=128,vg=256,wi={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},st={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15}
2,lt={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,DRAW_STEP:41},bg={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Gl=0,nc=1,Ba=2,yg=3,Xd=3,Ag=4,ql={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},wg=1,xg=2,_g=3,Sg=4,Eg=5,Cg=6,kg=7,Tg=8,Rg=9,Mg=10,Pg=11,Ig=12,Dg=13,Lg=14,Fg=15,_u=16,Ng=17,Og=20,Bg=1,Hg=2,jg=3,$g=4,zg=5,Wh={ERRORS:0,WARNINGS:1,INFOS:5},es={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},Ug={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Xh=Wh.WARNINGS;function Vg(u){Number.isInteger(u)&&(Xh=u)}function Gg(){return Xh}function Yh(u){Xh>=Wh.INFOS&&console.log(`Info: ${u}`)}function J(u){Xh>=Wh.WARNINGS&&console.log(`Warning: ${u}`)}function At(u){throw new Error(u)}function Nt(u,s){u||At(s)}function qg(u,s=null,e=null){if(!u)return null;try{if(e&&typeof u=="string"){if(e.addDefaultProtocol&&u.startsWith("www.")){const n=u.match(/\./g);(n==null?void 0:n.length)>=2&&(u=`http://${u}`)}if(e.tryConvertEncoding)try{u=(function(r){return decodeURIComponent(escape(r))})(u)}catch{}}const i=s?new URL(u,s):new URL(u);if((function(r){switch(r==null?void 0:r.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}})(i))return i}catch{}return null}function ot(u,s,e,i=!1){return Object.defineProperty(u,s,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}const en=(function(){function s(e,i){this.message=e,this.name=i}return s.prototype=new Error,s.constructor=s,s})();class Yd extends en{constructor(s,e){super(s,"PasswordException"),this.code=e}}class rc extends en{constructor(s,e){super(s,"UnknownErrorException"),this.details=e}}class pc extends en{constructor(s){super(s,"InvalidPDFException")}}class lo extends en{constructor(s){super(s,"MissingPDFException")}}class _h extends en{constructor(s,e){super(s,"UnexpectedResponseException"),this.status=e}}class Wg extends en{constructor(s){super(s,"FormatError")}}class Zi extends en{constructor(s){super(s,"AbortException")}}function Su(u){typeof u=="object"&&(u==null?void 0:u.length)!==void 0||At("Invalid argument for bytesToString");const s=u.length,e=8192;if(s<e)return String.fromCharCode.apply(null,u);const i=[];for(let n=0;n<s;n+=e){const r=Math.min(n+e,s),a=u.subarray(n,r);i.push(String.fromCharCode.apply(null,a))}return i.join("")}function Kh(u){typeof u!="string"&&At("Invalid argument for stringToBytes");const s=u.length,e=new Uint8Array(s);for(let i=0;i<s;++i)e[i]=255&u.charCodeAt(i);return e}function Cd(u){const s=Object.create(null);for(const[e,i]of u)s[e]=i;return s}class ge{static get isLittleEndian(){return ot(this,"isLittleEndian",(function(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1})())}static get isEvalSupported(){return ot(this,"isEvalSupported",(function(){try{return new Function(""),!0}catch{return!1}})())}static get isOffscreenCanvasSupported(){return ot(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return ot(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){return typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.platform)=="str
2ing"?ot(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof(navigator==null?void 0:navigator.userAgent)=="string"&&navigator.userAgent.includes("Firefox")}):ot(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var s,e;return ot(this,"isCSSRoundSupported",(e=(s=globalThis.CSS)==null?void 0:s.supports)==null?void 0:e.call(s,"width: round(1.5px, 1px)"))}}const ac=Array.from(Array(256).keys(),(u=>u.toString(16).padStart(2,"0")));var gi,Wl,fc;class W{static makeHexColor(s,e,i){return`#${ac[s]}${ac[e]}${ac[i]}`}static scaleMinMax(s,e){let i;s[0]?(s[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=s[0],e[2]*=s[0],s[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=s[3],e[3]*=s[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,s[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=s[1],e[3]*=s[1],s[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=s[2],e[2]*=s[2]),e[0]+=s[4],e[1]+=s[5],e[2]+=s[4],e[3]+=s[5]}static transform(s,e){return[s[0]*e[0]+s[2]*e[1],s[1]*e[0]+s[3]*e[1],s[0]*e[2]+s[2]*e[3],s[1]*e[2]+s[3]*e[3],s[0]*e[4]+s[2]*e[5]+s[4],s[1]*e[4]+s[3]*e[5]+s[5]]}static applyTransform(s,e){return[s[0]*e[0]+s[1]*e[2]+e[4],s[0]*e[1]+s[1]*e[3]+e[5]]}static applyInverseTransform(s,e){const i=e[0]*e[3]-e[1]*e[2];return[(s[0]*e[3]-s[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-s[0]*e[1]+s[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(s,e){const i=this.applyTransform(s,e),n=this.applyTransform(s.slice(2,4),e),r=this.applyTransform([s[0],s[3]],e),a=this.applyTransform([s[2],s[1]],e);return[Math.min(i[0],n[0],r[0],a[0]),Math.min(i[1],n[1],r[1],a[1]),Math.max(i[0],n[0],r[0],a[0]),Math.max(i[1],n[1],r[1],a[1])]}static inverseTransform(s){const e=s[0]*s[3]-s[1]*s[2];return[s[3]/e,-s[1]/e,-s[2]/e,s[0]/e,(s[2]*s[5]-s[4]*s[3])/e,(s[4]*s[1]-s[5]*s[0])/e]}static singularValueDecompose2dScale(s){const e=[s[0],s[2],s[1],s[3]],i=s[0]*e[0]+s[1]*e[2],n=s[0]*e[1]+s[1]*e[3],r=s[2]*e[0]+s[3]*e[2],a=s[2]*e[1]+s[3]*e[3],l=(i+a)/2,h=Math.sqrt((i+a)**2-4*(i*a-r*n))/2,c=l+h||1,d=l-h||1;return[Math.sqrt(c),Math.sqrt(d)]}static normalizeRect(s){const e=s.slice(0);return s[0]>s[2]&&(e[0]=s[2],e[2]=s[0]),s[1]>s[3]&&(e[1]=s[3],e[3]=s[1]),e}static intersect(s,e){const i=Math.max(Math.min(s[0],s[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(s[0],s[2]),Math.max(e[0],e[2]));if(i>n)return null;const r=Math.max(Math.min(s[1],s[3]),Math.min(e[1],e[3])),a=Math.min(Math.max(s[1],s[3]),Math.max(e[1],e[3]));return r>a?null:[i,r,n,a]}static bezierBoundingBox(s,e,i,n,r,a,l,h,c){return c?(c[0]=Math.min(c[0],s,l),c[1]=Math.min(c[1],e,h),c[2]=Math.max(c[2],s,l),c[3]=Math.max(c[3],e,h)):c=[Math.min(s,l),Math.min(e,h),Math.max(s,l),Math.max(e,h)],A(this,gi,fc).call(this,s,i,r,l,e,n,a,h,3*(3*(i-r)-s+l),6*(s-2*i+r),3*(i-s),c),A(this,gi,fc).call(this,s,i,r,l,e,n,a,h,3*(3*(n-a)-e+h),6*(e-2*n+a),3*(n-e),c),c}}gi=new WeakSet,Wl=function(s,e,i,n,r,a,l,h,c,d){if(c<=0||c>=1)return;const p=1-c,g=c*c,f=g*c,m=p*(p*(p*s+3*c*e)+3*g*i)+f*n,b=p*(p*(p*r+3*c*a)+3*g*l)+f*h;d[0]=Math.min(d[0],m),d[1]=Math.min(d[1],b),d[2]=Math.max(d[2],m),d[3]=Math.max(d[3],b)},fc=function(s,e,i,n,r,a,l,h,c,d,p,g){if(Math.abs(c)<1e-12){Math.abs(d)>=1e-12&&A(this,gi,Wl).call(this,s,e,i,n,r,a,l,h,-p/d,g);return}const f=d**2-4*p*c;if(f<0)return;const m=Math.sqrt(f),b=2*c;A(this,gi,Wl).call(this,s,e,i,n,r,a,l,h,(-d+m)/b,g),A(this,gi,Wl).call(this,s,e,i,n,r,a,l,h,(-d-m)/b,g)},y(W,gi);let oc=null,Kd=null;function Xg(u){return oc||(oc=/([\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,Kd=new Map([["ï¬
","ſt"]])),u.replaceAll(oc,((s,e,i)=>e?e.normalize("NFKC"):Kd.get(i)))}const kd="pdfjs_internal_id_";ht(4628),ht(7642),ht(8004),ht(3853),ht(5876),ht(2475),ht(5024),ht(1698),ht(1454),ht(8992),ht(4743),ht(3215),ht(7550),ht(8335);const Bs="http://www.w3.org/2000/svg";class Oa{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function Qh(u,s="text"){if(Va(u,document.baseURI)){const e=await fetch(u);if(!e.ok)throw new Error(e.statusText);switch(s){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise(((e,i)=>{const n=new XMLHttpRequest;n.open("GET",u,!0),n.responseType=s,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE)if(n.status!==200&&n.status!==0)i(new Error(n.statusText));else{switch(s){case"arraybuffer":case"blob":case"json":e(n.response);return}e(n.responseText)}},n.send(null)}))}class Ll{constructor({viewBox:s,userUnit:e,scale:i,rotation:n,offsetX:r=0,offsetY:a=0,dontFlip:l=!1}){this.viewBox=s,this.userUnit=e,this.scale=i,this.rotation=n,this.offsetX=r,this.offsetY=a,i*=e;const h=(s[2]+s[0])/2,c=(s[3]+s[1])/2;let d,p,g,f,m,b,w,x;switch((n%=360)<0&&(n+=360),n){case 180:d=-1,p=0,g=0,f=1;break;case 90:d=0,p=1,g=1,f=0;break;case 270:d=0,p=-1,g=-1,f=0;break;case 0:d=1,p=0,g=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}
2l&&(g=-g,f=-f),d===0?(m=Math.abs(c-s[1])*i+r,b=Math.abs(h-s[0])*i+a,w=(s[3]-s[1])*i,x=(s[2]-s[0])*i):(m=Math.abs(h-s[0])*i+r,b=Math.abs(c-s[1])*i+a,w=(s[2]-s[0])*i,x=(s[3]-s[1])*i),this.transform=[d*i,p*i,g*i,f*i,m-d*i*h-g*i*c,b-p*i*h-f*i*c],this.width=w,this.height=x}get rawDims(){const{userUnit:s,viewBox:e}=this,i=e.map((n=>n*s));return ot(this,"rawDims",{pageWidth:i[2]-i[0],pageHeight:i[3]-i[1],pageX:i[0],pageY:i[1]})}clone({scale:s=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:r=!1}={}){return new Ll({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:s,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}convertToViewportPoint(s,e){return W.applyTransform([s,e],this.transform)}convertToViewportRectangle(s){const e=W.applyTransform([s[0],s[1]],this.transform),i=W.applyTransform([s[2],s[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(s,e){return W.applyInverseTransform([s,e],this.transform)}}class Td extends en{constructor(s,e=0){super(s,"RenderingCancelledException"),this.extraDelay=e}}function Jh(u){const s=u.length;let e=0;for(;e<s&&u[e].trim()==="";)e++;return u.substring(e,e+5).toLowerCase()==="data:"}function Rd(u){return typeof u=="string"&&/\.pdf$/i.test(u)}function Yg(u){return[u]=u.split(/[#?]/,1),u.substring(u.lastIndexOf("/")+1)}function Kg(u,s="document.pdf"){if(typeof u!="string")return s;if(Jh(u))return J('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),s;const e=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(u);let n=e.exec(i[1])||e.exec(i[2])||e.exec(i[3]);if(n&&(n=n[0],n.includes("%")))try{n=e.exec(decodeURIComponent(n))[0]}catch{}return n||s}class Qd{started=Object.create(null);times=[];time(s){s in this.started&&J(`Timer is already running for ${s}`),this.started[s]=Date.now()}timeEnd(s){s in this.started||J(`Timer has not been started for ${s}`),this.times.push({name:s,start:this.started[s],end:Date.now()}),delete this.started[s]}toString(){const s=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:n,end:r}of this.times)s.push(`${i.padEnd(e)} ${r-n}ms 3`);return s.join("")}}function Va(u,s){try{const{protocol:e}=s?new URL(u,s):new URL(u);return e==="http:"||e==="https:"}catch{return!1}}function gs(u){u.preventDefault()}function je(u){u.preventDefault(),u.stopPropagation()}class Eu{static#t;static toDateObject(s){if(!s||typeof s!="string")return null;this.#t||(this.#t=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=this.#t.exec(s);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let l=parseInt(e[5],10);l=l>=0&&l<=59?l:0;let h=parseInt(e[6],10);h=h>=0&&h<=59?h:0;const c=e[7]||"Z";let d=parseInt(e[8],10);d=d>=0&&d<=23?d:0;let p=parseInt(e[9],10)||0;return p=p>=0&&p<=59?p:0,c==="-"?(a+=d,l+=p):c==="+"&&(a-=d,l-=p),new Date(Date.UTC(i,n,r,a,l,h))}}function Qg(u,{scale:s=1,rotation:e=0}){const{width:i,height:n}=u.attributes.style,r=[0,0,parseInt(i),parseInt(n)];return new Ll({viewBox:r,userUnit:1,scale:s,rotation:e})}function gc(u){if(u.startsWith("#")){const s=parseInt(u.slice(1),16);return[(16711680&s)>>16,(65280&s)>>8,255&s]}return u.startsWith("rgb(")?u.slice(4,-1).split(",").map((s=>parseInt(s))):u.startsWith("rgba(")?u.slice(5,-1).split(",").map((s=>parseInt(s))).slice(0,3):(J(`Not a valid color format: "${u}"`),[0,0,0])}function Ct(u){const{a:s,b:e,c:i,d:n,e:r,f:a}=u.getTransform();return[s,e,i,n,r,a]}function vs(u){const{a:s,b:e,c:i,d:n,e:r,f:a}=u.getTransform().invertSelf();return[s,e,i,n,r,a]}function gr(u,s,e=!1,i=!0){if(s instanceof Ll){const{pageWidth:n,pageHeight:r}=s.rawDims,{style:a}=u,l=ge.isCSSRoundSupported,h=`var(--scale-factor) * ${n}px`,c=`var(--scale-factor) * ${r}px`,d=l?`round(down, ${h}, var(--scale-round-x, 1px))`:`calc(${h})`,p=l?`round(down, ${c}, var(--scale-round-y, 1px))`:`calc(${c})`;e&&s.rotation%180!=0?(a.width=p,a.height=d):(a.width=d,a.height=p)}i&&u.setAttribute("data-main-rotation",s.rotation)}class mc{constructor(){const s=window.devicePixelRatio||1;this.sx=s,this.sy=s}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var xi,dn,ss,un,uo,po,Ih,Cu,me,ku,Tu,Xl,Ru,bc;const $s=class $s{constructor(s){y(this,me);y(this,xi,null);y(this,dn,null);y(this,ss);y(this,un,null);y(this,uo,null);v(this,ss,s),o($s,po)||v($s,po,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const s=v(this,xi,document.createElement("div"));s.classList.add("editToolbar","hidden"),s.setAttribute("role","toolbar");const e=o(this,ss)._uiManager._signal;s.addEventListener("contextmenu",gs,{signal:e}),s.addEventListener("pointerdown",A($s,Ih,Cu),{signal:e});const i=v(this,un,document.createElement("div"));i.className="buttons",s.append(i);const n=o(this,ss).toolbarPosition;if(n){const{style:r}=s,a=o(this,ss)._uiManager.direction==="ltr"?1-n[0]:n[0];r.insetInlineEnd=100*a+"%",r.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return A(this,me,Ru).call(this),s}get div(){return o(this,xi)}hide(){var s;o(this,xi).classList.add("hidden"),(s=o(this,dn))==null||s.hideDropdown()}show(){var s;o(this,xi).classList.remove("hidden"),(s=o(this,uo))==null||s.shown()}async addAltText(s){const e=await s.render();A(this,me,Xl).call(this,e),o(this,un).prepend(e,o(this,me,bc)),v(this,uo,s)}addColorPicker(s){v(this,dn,s);const e=s.renderButton();A(this,me,Xl).call(this,e),o(this,un).prepend(e,o(this,me,bc))}remove(){var s;o(this,xi).remove(),(s=o(this,dn))==null||s.destroy(),v(this,dn,null)}};xi=new WeakMap,dn=new WeakMap,ss=new WeakMap,un=new WeakMap,uo=new WeakMap,po=new WeakMap,Ih=new WeakSet,Cu=function(s){s.stopPropagation()},me=new WeakSet,ku=function(s){o(this,ss)._focusEventsAllowed=!1,je(s)},Tu=function(s){o(this,ss)._focusEventsAllowed=!0,je(s)},Xl=function(s){const e=o(this,ss)._uiManager._signal;s.addEventListener("focusin",A(this,me,ku).bind(this),{capture:!0,signal:e}),s.addEventListener("focusout",A(this,me,Tu).bind(this),{capture:!0,signal:e}),s.addEventListener("contextmenu",gs,{signal:e})},Ru=function(){const{editorType:s,_uiManager:e}=o(this,ss),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",o($s,po)[s]),A(this,me,Xl).call(this,i),i.addEventListener("click",(n=>{e.delete()}),{signal:e._signal}),o(this,un).append(i)},bc=function(){const s=document.createElement("div");return s.className="divider",s},y($s,Ih),y($s,po,null);let vc=$s;var fo,pn,fn,tn,Mu,Pu,Iu;
3class Jg{constructor(s){y(this,tn);y(this,fo,null);y(this,pn,null);y(this,fn);v(this,fn,s)}show(s,e,i){const[n,r]=A(this,tn,Pu).call(this,e,i),{style:a}=o(this,pn)||v(this,pn,A(this,tn,Mu).call(this));s.append(o(this,pn)),a.insetInlineEnd=100*n+"%",a.top=`calc(${100*r}% + var(--editor-toolbar-vert-offset))`}hide(){o(this,pn).remove()}}fo=new WeakMap,pn=new WeakMap,fn=new WeakMap,tn=new WeakSet,Mu=function(){const s=v(this,pn,document.createElement("div"));s.className="editToolbar",s.setAttribute("role","toolbar"),s.addEventListener("contextmenu",gs,{signal:o(this,fn)._signal});const e=v(this,fo,document.createElement("div"));return e.className="buttons",s.append(e),A(this,tn,Iu).call(this),s},Pu=function(s,e){let i=0,n=0;for(const r of s){const a=r.y+r.height;if(a<i)continue;const l=r.x+(e?r.width:0);a>i?(n=l,i=a):e?l>n&&(n=l):l<n&&(n=l)}return[e?1-n:n,i]},Iu=function(){const s=document.createElement("button");s.className="highlightButton",s.tabIndex=0,s.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");s.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=o(this,fn)._signal;s.addEventListener("contextmenu",gs,{signal:i}),s.addEventListener("click",(()=>{o(this,fn).highlightSelection("floating_button")}),{signal:i}),o(this,fo).append(s)};function Sh(u,s,e){for(const i of e)s.addEventListener(i,u[i].bind(u))}var Dh;class Zg{constructor(){y(this,Dh,0)}get id(){return"pdfjs_internal_editor_"+be(this,Dh)._++}}Dh=new WeakMap;var Ir,go,ne,Dr,Yl;const Od=class Od{constructor(){y(this,Dr);y(this,Ir,(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=new Uint8Array(32);return crypto.getRandomValues(e),Su(e)})());y(this,go,0);y(this,ne,null)}static get _isSVGFittingCanvas(){const s=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',ot(this,"_isSVGFittingCanvas",e.decode().then((()=>(s.drawImage(e,0,0,1,1,0,0,1,3),new Uint32Array(s.getImageData(0,0,1,1).data.buffer)[0]===0))))}async getFromFile(s){const{lastModified:e,name:i,size:n,type:r}=s;return A(this,Dr,Yl).call(this,`${e}_${i}_${n}_${r}`,s)}async getFromUrl(s){return A(this,Dr,Yl).call(this,s,s)}async getFromBlob(s,e){const i=await e;return A(this,Dr,Yl).call(this,s,i)}async getFromId(s){o(this,ne)||v(this,ne,new Map);const e=o(this,ne).get(s);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){const{blobPromise:i}=e;return delete e.blobPromise,this.getFromBlob(e.id,i)}return this.getFromUrl(e.url)}getFromCanvas(s,e){o(this,ne)||v(this,ne,new Map);let i=o(this,ne).get(s);if(i!=null&&i.bitmap)return i.refCounter+=1,i;const n=new OffscreenCanvas(e.width,e.height);return n.getContext("2d").drawImage(e,0,0),i={bitmap:n.transferToImageBitmap(),id:`image_${o(this,Ir)}_${be(this,go)._++}`,refCounter:1,isSvg:!1},o(this,ne).set(s,i),o(this,ne).set(i.id,i),i}getSvgUrl(s){const e=o(this,ne).get(s);return e!=null&&e.isSvg?e.svgUrl:null}deleteId(s){var n;o(this,ne)||v(this,ne,new Map);const e=o(this,ne).get(s);if(!e||(e.refCounter-=1,e.refCounter!==0))return;const{bitmap:i}=e;if(!e.url&&!e.file){const r=new OffscreenCanvas(i.width,i.height);r.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=r.convertToBlob()}(n=i.close)==null||n.call(i),e.bitmap=null}isValidId(s){return s.startsWith(`image_${o(this,Ir)}_`)}};Ir=new WeakMap,go=new WeakMap,ne=new WeakMap,Dr=new WeakSet,Yl=async function(s,e){o(this,ne)||v(this,ne,new Map);let i=o(this,ne).get(s);if(i===null)return null;if(i!=null&&i.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${o(this,Ir)}_${be(this,go)._++}`,refCounter:0,isSvg:!1});let n;if(typeof e=="string"?(i.url=e,n=await Qh(e,"blob")):e instanceof File?n=i.file=e:e instanceof Blob&&(n=e),n.type==="image/svg+xml"){const r=Od._isSVGFittingCanvas,a=new FileReader,l=new Image,h=new Promise(((c,d)=>{l.onload=()=>{i.bitmap=l,i.isSvg=!0,c()},a.onload=async()=>{const p=i.svgUrl=a.result;l.src=await r?`${p}#svgView(preserveAspectRatio(none))`:p},l.onerror=a.onerror=d}));a.readAsDataURL(n),await h}else i.bitmap=await createImageBitmap(n);i.refCounter=1}catch(n){J(n),i=null}return o(this,ne).set(s,i),i&&o(this,ne).set(i.id,i),i};let yc=Od;var Dt,_i,mo,Tt;class tm{constructor(s=128){y(this,Dt,[]);y(this,_i,!1);y(this,mo);y(this,Tt,-1);v(this,mo,s)}add({cmd:s,undo:e,post:i,mustExec:n,type:r=NaN,overwriteIfSameType:a=!1,keepUndo:l=!1}
3){if(n&&s(),o(this,_i))return;const h={cmd:s,undo:e,post:i,type:r};if(o(this,Tt)===-1){o(this,Dt).length>0&&(o(this,Dt).length=0),v(this,Tt,0),o(this,Dt).push(h);return}if(a&&o(this,Dt)[o(this,Tt)].type===r){l&&(h.undo=o(this,Dt)[o(this,Tt)].undo),o(this,Dt)[o(this,Tt)]=h;return}const c=o(this,Tt)+1;c===o(this,mo)?o(this,Dt).splice(0,1):(v(this,Tt,c),c<o(this,Dt).length&&o(this,Dt).splice(c)),o(this,Dt).push(h)}undo(){if(o(this,Tt)===-1)return;v(this,_i,!0);const{undo:s,post:e}=o(this,Dt)[o(this,Tt)];s(),e==null||e(),v(this,_i,!1),v(this,Tt,o(this,Tt)-1)}redo(){if(o(this,Tt)<o(this,Dt).length-1){v(this,Tt,o(this,Tt)+1),v(this,_i,!0);const{cmd:s,post:e}=o(this,Dt)[o(this,Tt)];s(),e==null||e(),v(this,_i,!1)}}hasSomethingToUndo(){return o(this,Tt)!==-1}hasSomethingToRedo(){return o(this,Tt)<o(this,Dt).length-1}cleanType(s){if(o(this,Tt)!==-1){for(let e=o(this,Tt);e>=0;e--)if(o(this,Dt)[e].type!==s){o(this,Dt).splice(e+1,o(this,Tt)-e),v(this,Tt,e);return}o(this,Dt).length=0,v(this,Tt,-1)}}destroy(){v(this,Dt,null)}}Dt=new WeakMap,_i=new WeakMap,mo=new WeakMap,Tt=new WeakMap;var Lh,Du;class Fl{constructor(s){y(this,Lh);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=ge.platform;for(const[i,n,r={}]of s)for(const a of i){const l=a.startsWith("mac+");e&&l?(this.callbacks.set(a.slice(4),{callback:n,options:r}),this.allKeys.add(a.split("+").at(-1))):!e&&!l&&(this.callbacks.set(a,{callback:n,options:r}),this.allKeys.add(a.split("+").at(-1)))}}exec(s,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(A(this,Lh,Du).call(this,e));if(!i)return;const{callback:n,options:{bubbles:r=!1,args:a=[],checker:l=null}}=i;(!l||l(s,e))&&(n.bind(s,...a,e)(),r||je(e))}}Lh=new WeakSet,Du=function(s){s.altKey&&this.buffer.push("alt"),s.ctrlKey&&this.buffer.push("ctrl"),s.metaKey&&this.buffer.push("meta"),s.shiftKey&&this.buffer.push("shift"),this.buffer.push(s.key);const e=this.buffer.join("+");return this.buffer.length=0,e};class Md{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const s=new Map([["CanvasText",null],["Canvas",null]]);return(function(i){const n=document.createElement("span");n.style.visibility="hidden",document.body.append(n);for(const r of i.keys()){n.style.color=r;const a=window.getComputedStyle(n).color;i.set(r,gc(a))}n.remove()})(s),ot(this,"_colors",s)}convert(s){const e=gc(s);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,n]of this._colors)if(n.every(((r,a)=>r===e[a])))return Md._colorsMapping.get(i);return e}getHexCode(s){const e=this._colors.get(s);return e?W.makeHexColor(...e):s}}var Lr,Ce,Ht,Kt,Fr,Vs,Nr,Ue,Si,gn,Or,mn,ys,is,vn,vo,bo,Br,yo,As,Ei,Hr,Ci,ws,Fh,ki,Ao,Ti,bn,wo,xo,Ut,gt,Gs,yn,_o,So,Ri,xs,qs,Eo,Ve,F,Kl,Ac,Lu,Fu,Ql,Nu,Ou,Bu,wc,Hu,xc,_c,ju,he,Hs,$u,zu,Sc,Uu,Ga,Ec;const kr=class kr{constructor(s,e,i,n,r,a,l,h,c,d,p,g,f){y(this,F);y(this,Lr,new AbortController);y(this,Ce,null);y(this,Ht,new Map);y(this,Kt,new Map);y(this,Fr,null);y(this,Vs,null);y(this,Nr,null);y(this,Ue,new tm);y(this,Si,null);y(this,gn,null);y(this,Or,0);y(this,mn,new Set);y(this,ys,null);y(this,is,null);y(this,vn,new Set);et(this,"_editorUndoBar",null);y(this,vo,!1);y(this,bo,!1);y(this,Br,!1);y(this,yo,null);y(this,As,null);y(this,Ei,null);y(this,Hr,null);y(this,Ci,!1);y(this,ws,null);y(this,Fh,new Zg);y(this,ki,!1);y(this,Ao,!1);y(this,Ti,null);y(this,bn,null);y(this,wo,null);y(this,xo,null);y(this,Ut,st.NONE);y(this,gt,new Set);y(this,Gs,null);y(this,yn,null);y(this,_o,null);y(this,So,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});y(this,Ri,[0,0]);y(this,xs,null);y(this,qs,null);y(this,Eo,null);y(this,Ve,null);const m=this._signal=o(this,Lr).signal;v(this,qs,s),v(this,Eo,e),v(this,Fr,i),this._eventBus=n,n._on("editingaction",this.onEditingAction.bind(this),{signal:m}),n._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),n._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),n._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),n._on("setpreference",this.onSetPreference.bind(this),{signal:m}),n._on("switchannotationeditorparams",(b=>this.updateParams(b.type,b.value)),{signal:m}),A(this,F,Nu).call(this),A(this,F,ju).call(this),A(this,F,wc).call(this),v(this,Vs,r.annotationStorage),v(this,yo,r.filterFactory),v(this,yn,a),v(this,Hr,l||null),v(this,vo,h),v(this,bo,c),v(this,Br,d),v(this,xo,p||null),this.viewParameters={realScale:Oa.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=f!==!1}static get _keyboardManager(){const s=kr.prototype,e=a=>o(a,qs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),i=(a,{target:l})=>
3{if(l instanceof HTMLInputElement){const{type:h}=l;return h!=="text"&&h!=="number"}return!0},n=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return ot(this,"_keyboardManager",new Fl([[["ctrl+a","mac+meta+a"],s.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],s.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],s.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"],s.delete,{checker:i}],[["Enter","mac+Enter"],s.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&o(a,qs).contains(l)&&!a.isEnterHandled}],[[" ","mac+ "],s.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&o(a,qs).contains(document.activeElement)}],[["Escape","mac+Escape"],s.unselectAll],[["ArrowLeft","mac+ArrowLeft"],s.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],s.translateSelectedEditors,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],s.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],s.translateSelectedEditors,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],s.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],s.translateSelectedEditors,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],s.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],s.translateSelectedEditors,{args:[0,r],checker:e}]]))}destroy(){var s,e,i,n,r;(s=o(this,Ve))==null||s.resolve(),v(this,Ve,null),(e=o(this,Lr))==null||e.abort(),v(this,Lr,null),this._signal=null;for(const a of o(this,Kt).values())a.destroy();o(this,Kt).clear(),o(this,Ht).clear(),o(this,vn).clear(),v(this,Ce,null),o(this,gt).clear(),o(this,Ue).destroy(),(i=o(this,Fr))==null||i.destroy(),(n=o(this,ws))==null||n.hide(),v(this,ws,null),o(this,As)&&(clearTimeout(o(this,As)),v(this,As,null)),o(this,xs)&&(clearTimeout(o(this,xs)),v(this,xs,null)),(r=this._editorUndoBar)==null||r.destroy()}combinedSignal(s){return AbortSignal.any([this._signal,s.signal])}get mlManager(){return o(this,xo)}get useNewAltTextFlow(){return o(this,bo)}get useNewAltTextWhenAddingImage(){return o(this,Br)}get hcmFilter(){return ot(this,"hcmFilter",o(this,yn)?o(this,yo).addHCMFilter(o(this,yn).foreground,o(this,yn).background):"none")}get direction(){return ot(this,"direction",getComputedStyle(o(this,qs)).direction)}get highlightColors(){return ot(this,"highlightColors",o(this,Hr)?new Map(o(this,Hr).split(",").map((s=>s.split("=").map((e=>e.trim()))))):null)}get highlightColorNames(){return ot(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,(s=>s.reverse()))):null)}setCurrentDrawingSession(s){s?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),v(this,gn,s)}setMainHighlightColorPicker(s){v(this,wo,s)}editAltText(s,e=!1){var i;(i=o(this,Fr))==null||i.editAltText(this,s,e)}switchToMode(s,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:s})}setPreference(s,e){this._eventBus.dispatch("setpreference",{source:this,name:s,value:e})}onSetPreference({name:s,value:e}){s==="enableNewAltTextWhenAddingImage"&&v(this,Br,e)}onPageChanging({pageNumber:s}){v(this,Or,s-1)}focusMainContainer(){o(this,qs).focus()}findParent(s,e){for(const i of o(this,Kt).values()){const{x:n,y:r,width:a,height:l}=i.div.getBoundingClientRect();if(s>=n&&s<=n+a&&e>=r&&e<=r+l)return i}return null}disableUserSelect(s=!1){o(this,Eo).classList.toggle("noUserSelect",s)}addShouldRescale(s){o(this,vn).add(s)}removeShouldRescale(s){o(this,vn).delete(s)}onScaleChanging({scale:s}){var e;this.commitOrRemove(),this.viewParameters.realScale=s*Oa.PDF_TO_CSS_UNITS;for(const i of o(this,vn))i.onScaleChanging();(e=o(this,gn))==null||e.onScaleChanging()}onRotationChanging({pagesRotation:s}){this.commitOrRemove(),this.viewParameters.rotation=s}highlightSelection(s=""){const e=document.getSelection();if(!e||e.isCollapsed)return;const{anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:a}=e,l=e.toString(),h=A(this,F,Kl).call(this,e).closest(".textLayer"),c=this.getSelectionBoxes(h);if(!c)return;e.empty();const d=A(this,F,Ac).call(this,h),p=o(this,Ut)===st.NONE,g=()=>{d==null||d.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:s,boxes:c,anchorNode:i,anchorOffset:n,focusNode:r,focusOffset:a,text:l}),p&&this.showAllEditors("highlight",!0,!0)};p?this.switchToMode(st.HIGHLIGHT,g):g()}addToAnnotationStorage(s){s.isEmpty()||!o(this,Vs)||o(this,Vs).has(s.id)||o(this,Vs).setValue(s.id,s)}blur(){if(this.isShiftKeyDown=!1,o(this,Ci)&&(v(this,Ci,!1),A(this,F,Ql).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:s}=document;for(const e of o(this,gt))if(e.div.contains(s)){v(this,bn,[e,s]),e._focusEventsAllowed=!1;break}}focus(){if(!o(this,bn))return;const[s,e]=o(this,bn);v(this,bn,null),e.addEventListener("focusin",(()=>{s._focusEventsAllowed=!0}),{once:!0,signal:this._signal}),e.focus()}addEditListeners(){A(this,F,wc).call(this),A(this,F,xc).call(this)}removeEditListeners(){A(this,F,Hu).call(this),A(this,F,_c).call(this)}dragOver(s){for(const{type:e}of s.dataTransfer.items)for(const i of o(this,is))if(i.isHandlingMimeForPasting(e)){s.dataTransfer.dropEffect="copy",s.preventDefault();return}}drop(s){for(const e of s.dataTransfer.items)for(const i of o(this,is))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),s.preventDefault();return}}copy(s){var i;if(s.preventDefault(),(i=o(this,Ce))==null||i.commitOrRemove(),!this.hasSelection)return;const e=[];
3for(const n of o(this,gt)){const r=n.serialize(!0);r&&e.push(r)}e.length!==0&&s.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(s){this.copy(s),this.delete()}async paste(s){s.preventDefault();const{clipboardData:e}=s;for(const r of e.items)for(const a of o(this,is))if(a.isHandlingMimeForPasting(r.type)){a.paste(r,this.currentLayer);return}let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(r){J(`paste: "${r.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();const n=this.currentLayer;try{const r=[];for(const h of i){const c=await n.deserialize(h);if(!c)return;r.push(c)}const a=()=>{for(const h of r)A(this,F,Sc).call(this,h);A(this,F,Ec).call(this,r)},l=()=>{for(const h of r)h.remove()};this.addCommands({cmd:a,undo:l,mustExec:!0})}catch(r){J(`paste: "${r.message}".`)}}keydown(s){this.isShiftKeyDown||s.key!=="Shift"||(this.isShiftKeyDown=!0),o(this,Ut)===st.NONE||this.isEditorHandlingKeyboard||kr._keyboardManager.exec(this,s)}keyup(s){this.isShiftKeyDown&&s.key==="Shift"&&(this.isShiftKeyDown=!1,o(this,Ci)&&(v(this,Ci,!1),A(this,F,Ql).call(this,"main_toolbar")))}onEditingAction({name:s}){switch(s){case"undo":case"redo":case"delete":case"selectAll":this[s]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(s){s?(A(this,F,Ou).call(this),A(this,F,xc).call(this),A(this,F,he).call(this,{isEditing:o(this,Ut)!==st.NONE,isEmpty:A(this,F,Ga).call(this),hasSomethingToUndo:o(this,Ue).hasSomethingToUndo(),hasSomethingToRedo:o(this,Ue).hasSomethingToRedo(),hasSelectedEditor:!1})):(A(this,F,Bu).call(this),A(this,F,_c).call(this),A(this,F,he).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(s){if(!o(this,is)){v(this,is,s);for(const e of o(this,is))A(this,F,Hs).call(this,e.defaultPropertiesToUpdate)}}getId(){return o(this,Fh).id}get currentLayer(){return o(this,Kt).get(o(this,Or))}getLayer(s){return o(this,Kt).get(s)}get currentPageIndex(){return o(this,Or)}addLayer(s){o(this,Kt).set(s.pageIndex,s),o(this,ki)?s.enable():s.disable()}removeLayer(s){o(this,Kt).delete(s.pageIndex)}async updateMode(s,e=null,i=!1){var n;if(o(this,Ut)!==s){if(o(this,Ve)&&(await o(this,Ve).promise,!o(this,Ve)))return;if(v(this,Ve,Promise.withResolvers()),v(this,Ut,s),s!==st.NONE){this.setEditingState(!0),await A(this,F,$u).call(this),this.unselectAll();for(const r of o(this,Kt).values())r.updateMode(s);if(e){for(const r of o(this,Ht).values())r.annotationElementId===e?(this.setSelected(r),r.enterInEditMode()):r.unselect();o(this,Ve).resolve()}else i&&this.addNewEditorFromKeyboard(),o(this,Ve).resolve()}else this.setEditingState(!1),A(this,F,zu).call(this),(n=this._editorUndoBar)==null||n.hide(),o(this,Ve).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(s){s!==o(this,Ut)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:s})}updateParams(s,e){var i;if(o(this,is)){switch(s){case lt.CREATE:this.currentLayer.addNewEditor();return;case lt.HIGHLIGHT_DEFAULT_COLOR:(i=o(this,wo))==null||i.updateColor(e);break;case lt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(o(this,_o)||v(this,_o,new Map)).set(s,e),this.showAllEditors("highlight",e)}for(const n of o(this,gt))n.updateParams(s,e);for(const n of o(this,is))n.updateDefaultParams(s,e)}}showAllEditors(s,e,i=!1){var n,r;for(const a of o(this,Ht).values())a.editorType===s&&a.show(e);((r=(n=o(this,_o))==null?void 0:n.get(lt.HIGHLIGHT_SHOW_ALL))!=null?r:!0)!==e&&A(this,F,Hs).call(this,[[lt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(s=!1){if(o(this,Ao)!==s){v(this,Ao,s);for(const e of o(this,Kt).values())s?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",s)}}getEditors(s){const e=[];for(const i of o(this,Ht).values())i.pageIndex===s&&e.push(i);return e}getEditor(s){return o(this,Ht).get(s)}addEditor(s){o(this,Ht).set(s.id,s)}removeEditor(s){var e;s.div.contains(document.activeElement)&&(o(this,As)&&clearTimeout(o(this,As)),v(this,As,setTimeout((()=>{this.focusMainContainer(),v(this,As,null)}),0))),o(this,Ht).delete(s.id),this.unselect(s),s.annotationElementId&&o(this,mn).has(s.annotationElementId)||
3((e=o(this,Vs))==null||e.remove(s.id))}addDeletedAnnotationElement(s){o(this,mn).add(s.annotationElementId),this.addChangedExistingAnnotation(s),s.deleted=!0}isDeletedAnnotationElement(s){return o(this,mn).has(s)}removeDeletedAnnotationElement(s){o(this,mn).delete(s.annotationElementId),this.removeChangedExistingAnnotation(s),s.deleted=!1}setActiveEditor(s){o(this,Ce)!==s&&(v(this,Ce,s),s&&A(this,F,Hs).call(this,s.propertiesToUpdate))}updateUI(s){o(this,F,Uu)===s&&A(this,F,Hs).call(this,s.propertiesToUpdate)}updateUIForDefaultProperties(s){A(this,F,Hs).call(this,s.defaultPropertiesToUpdate)}toggleSelected(s){o(this,gt).has(s)?(o(this,gt).delete(s),s.unselect(),A(this,F,he).call(this,{hasSelectedEditor:this.hasSelection})):(o(this,gt).add(s),s.select(),A(this,F,Hs).call(this,s.propertiesToUpdate),A(this,F,he).call(this,{hasSelectedEditor:!0}))}setSelected(s){var e;(e=o(this,gn))==null||e.commitOrRemove();for(const i of o(this,gt))i!==s&&i.unselect();o(this,gt).clear(),o(this,gt).add(s),s.select(),A(this,F,Hs).call(this,s.propertiesToUpdate),A(this,F,he).call(this,{hasSelectedEditor:!0})}isSelected(s){return o(this,gt).has(s)}get firstSelectedEditor(){return o(this,gt).values().next().value}unselect(s){s.unselect(),o(this,gt).delete(s),A(this,F,he).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return o(this,gt).size!==0}get isEnterHandled(){return o(this,gt).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){var s;o(this,Ue).undo(),A(this,F,he).call(this,{hasSomethingToUndo:o(this,Ue).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:A(this,F,Ga).call(this)}),(s=this._editorUndoBar)==null||s.hide()}redo(){o(this,Ue).redo(),A(this,F,he).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:o(this,Ue).hasSomethingToRedo(),isEmpty:A(this,F,Ga).call(this)})}addCommands(s){o(this,Ue).add(s),A(this,F,he).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:A(this,F,Ga).call(this)})}cleanUndoStack(s){o(this,Ue).cleanType(s)}delete(){var n;this.commitOrRemove();const s=(n=this.currentLayer)==null?void 0:n.endDrawingSession(!0);if(!this.hasSelection&&!s)return;const e=s?[s]:[...o(this,gt)],i=()=>{for(const r of e)A(this,F,Sc).call(this,r)};this.addCommands({cmd:()=>{var r;(r=this._editorUndoBar)==null||r.show(i,e.length===1?e[0].editorType:e.length);for(const a of e)a.remove()},undo:i,mustExec:!0})}commitOrRemove(){var s;(s=o(this,Ce))==null||s.commitOrRemove()}hasSomethingToControl(){return o(this,Ce)||this.hasSelection}selectAll(){for(const s of o(this,gt))s.commit();A(this,F,Ec).call(this,o(this,Ht).values())}unselectAll(){var s;if(!(o(this,Ce)&&(o(this,Ce).commitOrRemove(),o(this,Ut)!==st.NONE))&&!((s=o(this,gn))!=null&&s.commitOrRemove())&&this.hasSelection){for(const e of o(this,gt))e.unselect();o(this,gt).clear(),A(this,F,he).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(s,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;o(this,Ri)[0]+=s,o(this,Ri)[1]+=e;const[n,r]=o(this,Ri),a=[...o(this,gt)];o(this,xs)&&clearTimeout(o(this,xs)),v(this,xs,setTimeout((()=>{v(this,xs,null),o(this,Ri)[0]=o(this,Ri)[1]=0,this.addCommands({cmd:()=>{for(const l of a)o(this,Ht).has(l.id)&&l.translateInPage(n,r)},undo:()=>{for(const l of a)o(this,Ht).has(l.id)&&l.translateInPage(-n,-r)},mustExec:!1})}),1e3));for(const l of a)l.translateInPage(s,e)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),v(this,ys,new Map);for(const s of o(this,gt))o(this,ys).set(s,{savedX:s.x,savedY:s.y,savedPageIndex:s.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!o(this,ys))return!1;this.disableUserSelect(!1);const s=o(this,ys);v(this,ys,null);let e=!1;for(const[{x:n,y:r,pageIndex:a},l]of s)l.newX=n,l.newY=r,l.newPageIndex=a,e||(e=n!==l.savedX||r!==l.savedY||a!==l.savedPageIndex);if(!e)return!1;const i=(n,r,a,l)=>{if(o(this,Ht).has(n.id)){const h=o(this,Kt).get(l);h?n._setParentAndPosition(h,r,a):(n.pageIndex=l,n.x=r,n.y=a)}};return this.addCommands({cmd:()=>{for(const[n,{newX:r,newY:a,newPageIndex:l}]of s)i(n,r,a,l)},undo:()=>{for(const[n,{savedX:r,savedY:a,savedPageIndex:l}]of s)i(n,r,a,l)},mustExec:!0}),!0}dragSelectedEditors(s,e){if(o(this,ys))for(const i of o(this,ys).keys())i.drag(s,e)}rebuild(s){if(s.parent===null){const e=this.getLayer(s.pageIndex);e?(e.changeParent(s),e.addOrRebuild(s)):(this.addEditor(s),this.addToAnnotationStorage(s),s.rebuild())}else s.parent.addOrRebuild(s)}get isEditorHandlingKeyboard(){var s;return((s=this.getActive())==null?void 0:s.shouldGetKeyboardEvents())||o(this,gt).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(s){return o(this,Ce)===s}getActive(){return o(this,Ce)}getMode(){return o(this,Ut)}get imageManager(){return ot(this,"imageManager",new yc)}getSelectionBoxes(s){if(!s)return null;const e=document.getSelection();for(let c=0,d=e.rangeCount;c<d;c++)if(!s.contains(e.getRangeAt(c).commonAncestorContainer))return null;const{x:i,y:n,width:r,height:a}=s.getBoundingClientRect();let l;switch(s.getAttribute("data-main-rotation")){case"90":l=(c,d,p,g)=>({x:(d-n)/a,y:1-(c+p-i)/r,width:g/a,height:p/r});break;case"180":l=(c,d,p,g)=>({x:1-(c+p-i)/r,y:1-(d+g-n)/a,width:p/r,height:g/a});break;case"270":l=(c,d,p,g)=>({x:1-(d+g-n)/a,y:(c-i)/r,width:g/a,height:p/r});break;default:l=(c,d,p,g)=>({x:(c-i)/r,y:(d-n)/a,width:p/r,height:g/a})}const h=[];for(let c=0,d=e.rangeCount;c<d;c++){const p=e.getRangeAt(c);if(!p.collapsed)for(const{x:g,y:f,width:m,height:b}of p.getClientRects())m!==0&&b!==0&&h.push(l(g,f,m,b))}return h.length===0?null:h}addChangedExistingAnnotation({annotationElementId:s,id:e}){(o(this,Nr)||v(this,Nr,new Map)).set(s,e)}removeChangedExistingAnnotation({annotationElementId:s}){var e;(e=o(this,Nr))==null||e.delete(s)}renderAnnotationElement(s){var n;const e=(n=o(this,Nr))==null?void 0:n.get(s.data.id);if(!e)return;const i=o(this,Vs).getRawValue(e);
3i&&(o(this,Ut)!==st.NONE||i.hasBeenModified)&&i.renderAnnotationElement(s)}};Lr=new WeakMap,Ce=new WeakMap,Ht=new WeakMap,Kt=new WeakMap,Fr=new WeakMap,Vs=new WeakMap,Nr=new WeakMap,Ue=new WeakMap,Si=new WeakMap,gn=new WeakMap,Or=new WeakMap,mn=new WeakMap,ys=new WeakMap,is=new WeakMap,vn=new WeakMap,vo=new WeakMap,bo=new WeakMap,Br=new WeakMap,yo=new WeakMap,As=new WeakMap,Ei=new WeakMap,Hr=new WeakMap,Ci=new WeakMap,ws=new WeakMap,Fh=new WeakMap,ki=new WeakMap,Ao=new WeakMap,Ti=new WeakMap,bn=new WeakMap,wo=new WeakMap,xo=new WeakMap,Ut=new WeakMap,gt=new WeakMap,Gs=new WeakMap,yn=new WeakMap,_o=new WeakMap,So=new WeakMap,Ri=new WeakMap,xs=new WeakMap,qs=new WeakMap,Eo=new WeakMap,Ve=new WeakMap,F=new WeakSet,Kl=function({anchorNode:s}){return s.nodeType===Node.TEXT_NODE?s.parentElement:s},Ac=function(s){const{currentLayer:e}=this;if(e.hasTextLayer(s))return e;for(const i of o(this,Kt).values())if(i.hasTextLayer(s))return i;return null},Lu=function(){const s=document.getSelection();if(!s||s.isCollapsed)return;const e=A(this,F,Kl).call(this,s).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(o(this,ws)||v(this,ws,new Jg(this)),o(this,ws).show(e,i,this.direction==="ltr"))},Fu=function(){var n,r,a;const s=document.getSelection();if(!s||s.isCollapsed){o(this,Gs)&&((n=o(this,ws))==null||n.hide(),v(this,Gs,null),A(this,F,he).call(this,{hasSelectedText:!1}));return}const{anchorNode:e}=s;if(e===o(this,Gs))return;const i=A(this,F,Kl).call(this,s).closest(".textLayer");if(i){if((r=o(this,ws))==null||r.hide(),v(this,Gs,e),A(this,F,he).call(this,{hasSelectedText:!0}),(o(this,Ut)===st.HIGHLIGHT||o(this,Ut)===st.NONE)&&(o(this,Ut)===st.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),v(this,Ci,this.isShiftKeyDown),!this.isShiftKeyDown)){const l=o(this,Ut)===st.HIGHLIGHT?A(this,F,Ac).call(this,i):null;l==null||l.toggleDrawing();const h=new AbortController,c=this.combinedSignal(h),d=p=>{(p.type!=="pointerup"||p.button===0)&&(h.abort(),l==null||l.toggleDrawing(!0),p.type==="pointerup"&&A(this,F,Ql).call(this,"main_toolbar"))};window.addEventListener("pointerup",d,{signal:c}),window.addEventListener("blur",d,{signal:c})}}else o(this,Gs)&&((a=o(this,ws))==null||a.hide(),v(this,Gs,null),A(this,F,he).call(this,{hasSelectedText:!1}))},Ql=function(s=""){o(this,Ut)===st.HIGHLIGHT?this.highlightSelection(s):o(this,vo)&&A(this,F,Lu).call(this)},Nu=function(){document.addEventListener("selectionchange",A(this,F,Fu).bind(this),{signal:this._signal})},Ou=function(){if(o(this,Ei))return;v(this,Ei,new AbortController);const s=this.combinedSignal(o(this,Ei));window.addEventListener("focus",this.focus.bind(this),{signal:s}),window.addEventListener("blur",this.blur.bind(this),{signal:s})},Bu=function(){var s;(s=o(this,Ei))==null||s.abort(),v(this,Ei,null)},wc=function(){if(o(this,Ti))return;v(this,Ti,new AbortController);const s=this.combinedSignal(o(this,Ti));window.addEventListener("keydown",this.keydown.bind(this),{signal:s}),window.addEventListener("keyup",this.keyup.bind(this),{signal:s})},Hu=function(){var s;(s=o(this,Ti))==null||s.abort(),v(this,Ti,null)},xc=function(){if(o(this,Si))return;v(this,Si,new AbortController);const s=this.combinedSignal(o(this,Si));document.addEventListener("copy",this.copy.bind(this),{signal:s}),document.addEventListener("cut",this.cut.bind(this),{signal:s}),document.addEventListener("paste",this.paste.bind(this),{signal:s})},_c=function(){var s;(s=o(this,Si))==null||s.abort(),v(this,Si,null)},ju=function(){const s=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:s}),document.addEventListener("drop",this.drop.bind(this),{signal:s})},he=function(s){Object.entries(s).some((([e,i])=>o(this,So)[e]!==i))&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(o(this,So),s)}),o(this,Ut)===st.HIGHLIGHT&&s.hasSelectedEditor===!1&&A(this,F,Hs).call(this,[[lt.HIGHLIGHT_FREE,!0]]))},Hs=function(s){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:s})},$u=async function(){if(!o(this,ki)){v(this,ki,!0);const s=[];for(const e of o(this,Kt).values())s.push(e.enable());await Promise.all(s);for(const e of o(this,Ht).values())e.enable()}},zu=function(){if(this.unselectAll(),o(this,ki)){v(this,ki,!1);for(const s of o(this,Kt).values())s.disable();for(const s of o(this,Ht).values())s.disable()}},Sc=function(s){const e=o(this,Kt).get(s.pageIndex);e?e.addOrRebuild(s):(this.addEditor(s),this.addToAnnotationStorage(s))},Uu=function(){let s=null;for(s of o(this,gt));return s},Ga=function(){if(o(this,Ht).size===0)return!0;
3if(o(this,Ht).size===1)for(const s of o(this,Ht).values())return s.isEmpty();return!1},Ec=function(s){for(const e of o(this,gt))e.unselect();o(this,gt).clear();for(const e of s)e.isEmpty()||(o(this,gt).add(e),e.select());A(this,F,he).call(this,{hasSelectedEditor:this.hasSelection})},et(kr,"TRANSLATE_SMALL",1),et(kr,"TRANSLATE_BIG",10);let mr=kr;var Vt,_s,ns,jr,Ss,ke,$r,Es,xe,Ws,An,Cs,Mi,fs,qa,Jl;const ce=class ce{constructor(s){y(this,fs);y(this,Vt,null);y(this,_s,!1);y(this,ns,null);y(this,jr,null);y(this,Ss,null);y(this,ke,null);y(this,$r,!1);y(this,Es,null);y(this,xe,null);y(this,Ws,null);y(this,An,null);y(this,Cs,!1);v(this,xe,s),v(this,Cs,s._uiManager.useNewAltTextFlow),o(ce,Mi)||v(ce,Mi,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(s){var e;(e=ce._l10n)!=null||(ce._l10n=s)}async render(){const s=v(this,ns,document.createElement("button"));s.className="altText",s.tabIndex="0";const e=v(this,jr,document.createElement("span"));s.append(e),o(this,Cs)?(s.classList.add("new"),s.setAttribute("data-l10n-id",o(ce,Mi).missing),e.setAttribute("data-l10n-id",o(ce,Mi)["missing-label"])):(s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const i=o(this,xe)._uiManager._signal;s.addEventListener("contextmenu",gs,{signal:i}),s.addEventListener("pointerdown",(r=>r.stopPropagation()),{signal:i});const n=r=>{r.preventDefault(),o(this,xe)._uiManager.editAltText(o(this,xe)),o(this,Cs)&&o(this,xe)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:o(this,fs,qa)}})};return s.addEventListener("click",n,{capture:!0,signal:i}),s.addEventListener("keydown",(r=>{r.target===s&&r.key==="Enter"&&(v(this,$r,!0),n(r))}),{signal:i}),await A(this,fs,Jl).call(this),s}finish(){o(this,ns)&&(o(this,ns).focus({focusVisible:o(this,$r)}),v(this,$r,!1))}isEmpty(){return o(this,Cs)?o(this,Vt)===null:!o(this,Vt)&&!o(this,_s)}hasData(){return o(this,Cs)?o(this,Vt)!==null||!!o(this,Ws):this.isEmpty()}get guessedText(){return o(this,Ws)}async setGuessedText(s){o(this,Vt)===null&&(v(this,Ws,s),v(this,An,await ce._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:s})),A(this,fs,Jl).call(this))}toggleAltTextBadge(s=!1){var e;if(o(this,Cs)&&!o(this,Vt)){if(!o(this,Es)){const i=v(this,Es,document.createElement("div"));i.className="noAltTextBadge",o(this,xe).div.append(i)}o(this,Es).classList.toggle("hidden",!s)}else(e=o(this,Es))==null||e.remove(),v(this,Es,null)}serialize(s){let e=o(this,Vt);return s||o(this,Ws)!==e||(e=o(this,An)),{altText:e,decorative:o(this,_s),guessedText:o(this,Ws),textWithDisclaimer:o(this,An)}}get data(){return{altText:o(this,Vt),decorative:o(this,_s)}}set data({altText:s,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:r=!1}){i&&(v(this,Ws,i),v(this,An,n)),(o(this,Vt)!==s||o(this,_s)!==e)&&(r||(v(this,Vt,s),v(this,_s,e)),A(this,fs,Jl).call(this))}toggle(s=!1){o(this,ns)&&(!s&&o(this,ke)&&(clearTimeout(o(this,ke)),v(this,ke,null)),o(this,ns).disabled=!s)}shown(){o(this,xe)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:o(this,fs,qa)}})}destroy(){var s,e;(s=o(this,ns))==null||s.remove(),v(this,ns,null),v(this,jr,null),v(this,Ss,null),(e=o(this,Es))==null||e.remove(),v(this,Es,null)}};Vt=new WeakMap,_s=new WeakMap,ns=new WeakMap,jr=new WeakMap,Ss=new WeakMap,ke=new WeakMap,$r=new WeakMap,Es=new WeakMap,xe=new WeakMap,Ws=new WeakMap,An=new WeakMap,Cs=new WeakMap,Mi=new WeakMap,fs=new WeakSet,qa=function(){return(o(this,Vt)?"added":o(this,Vt)===null&&this.guessedText&&"review")||"missing"},Jl=async function(){var n,r,a;const s=o(this,ns);if(!s)return;if(o(this,Cs)){if(s.classList.toggle("done",!!o(this,Vt)),s.setAttribute("data-l10n-id",o(ce,Mi)[o(this,fs,qa)]),(n=o(this,jr))==null||n.setAttribute("data-l10n-id",o(ce,Mi)[`${o(this,fs,qa)}-label`]),!o(this,Vt)){(r=o(this,Ss))==null||r.remove();return}}else{if(!o(this,Vt)&&!o(this,_s)){s.classList.remove("done"),(a=o(this,Ss))==null||a.remove();return}s.classList.add("done"),s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=o(this,Ss);if(!e){v(this,Ss,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${o(this,xe).id}`;const l=100,h=o(this,xe)._uiManager._signal;h.addEventListener("abort",(()=>{clearTimeout(o(this,ke)),v(this,ke,null)}),{once:!0}),s.addEventListener("mouseenter",(()=>{v(this,ke,setTimeout((()=>{v(this,ke,null),o(this,Ss).classList.add("show"),o(this,xe)._reportTelemetry({action:"alt_text_tooltip"})}),l))}),{signal:h}),s.addEventListener("mouseleave",(()=>{var c;o(this,ke)&&(clearTimeout(o(this,ke)),v(this,ke,null)),(c=o(this,Ss))==null||c.classList.remove("show")}),{signal:h})}o(this,_s)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=o(this,Vt)),e.parentNode||s.append(e);const i=o(this,xe).getImageForAltText();i==null||i.setAttribute("aria-describedby",e.id)},y(ce,Mi,null),et(ce,"_l10n",null);let Eh=ce;var Co,wn,ko,To,Ro,Mo,Po,zr,Xs,xn,Pi,vi,Vu,Gu,Cc;const Bd=class Bd{constructor({container:s,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:r=null,onPinchEnd:a=null,signal:l}){y(this,vi);
3y(this,Co);y(this,wn,!1);y(this,ko,null);y(this,To);y(this,Ro);y(this,Mo);y(this,Po);y(this,zr);y(this,Xs,null);y(this,xn);y(this,Pi,null);v(this,Co,s),v(this,ko,i),v(this,To,e),v(this,Ro,n),v(this,Mo,r),v(this,Po,a),v(this,xn,new AbortController),v(this,zr,AbortSignal.any([l,o(this,xn).signal])),s.addEventListener("touchstart",A(this,vi,Vu).bind(this),{passive:!1,signal:o(this,zr)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return ot(this,"MIN_TOUCH_DISTANCE_TO_PINCH",35/(window.devicePixelRatio||1))}destroy(){var s;(s=o(this,xn))==null||s.abort(),v(this,xn,null)}};Co=new WeakMap,wn=new WeakMap,ko=new WeakMap,To=new WeakMap,Ro=new WeakMap,Mo=new WeakMap,Po=new WeakMap,zr=new WeakMap,Xs=new WeakMap,xn=new WeakMap,Pi=new WeakMap,vi=new WeakSet,Vu=function(s){var n,r,a;if((n=o(this,To))!=null&&n.call(this)||s.touches.length<2)return;if(!o(this,Pi)){v(this,Pi,new AbortController);const l=AbortSignal.any([o(this,zr),o(this,Pi).signal]),h=o(this,Co),c={signal:l,passive:!1};h.addEventListener("touchmove",A(this,vi,Gu).bind(this),c),h.addEventListener("touchend",A(this,vi,Cc).bind(this),c),h.addEventListener("touchcancel",A(this,vi,Cc).bind(this),c),(r=o(this,Ro))==null||r.call(this)}if(je(s),s.touches.length!==2||(a=o(this,ko))!=null&&a.call(this)){v(this,Xs,null);return}let[e,i]=s.touches;e.identifier>i.identifier&&([e,i]=[i,e]),v(this,Xs,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},Gu=function(s){var E;if(!o(this,Xs)||s.touches.length!==2)return;let[e,i]=s.touches;e.identifier>i.identifier&&([e,i]=[i,e]);const{screenX:n,screenY:r}=e,{screenX:a,screenY:l}=i,h=o(this,Xs),{touch0X:c,touch0Y:d,touch1X:p,touch1Y:g}=h,f=p-c,m=g-d,b=a-n,w=l-r,x=Math.hypot(b,w)||1,_=Math.hypot(f,m)||1;if(!o(this,wn)&&Math.abs(_-x)<=Bd.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(h.touch0X=n,h.touch0Y=r,h.touch1X=a,h.touch1Y=l,s.preventDefault(),!o(this,wn)){v(this,wn,!0);return}const S=[(n+a)/2,(r+l)/2];(E=o(this,Mo))==null||E.call(this,S,_,x)},Cc=function(s){var e;o(this,Pi).abort(),v(this,Pi,null),(e=o(this,Po))==null||e.call(this),o(this,Xs)&&(s.preventDefault(),v(this,Xs,null),v(this,wn,!1))};let Ch=Bd;var _n,rs,St,Ur,Ii,Io,Sn,Qt,En,Ys,Di,Do,Cn,Te,Lo,kn,Ks,ks,Vr,Gr,Ge,Tn,Fo,Nh,X,kc,No,Tc,Zl,qu,Wu,Rc,th,Mc,Xu,Yu,Ku,Pc,Qu,Ic,Ju,Zu,tp,Dc,Wa;const nt=class nt{constructor(s){y(this,X);y(this,_n,null);y(this,rs,null);y(this,St,null);y(this,Ur,!1);y(this,Ii,null);y(this,Io,"");y(this,Sn,!1);y(this,Qt,null);y(this,En,null);y(this,Ys,null);y(this,Di,null);y(this,Do,"");y(this,Cn,!1);y(this,Te,null);y(this,Lo,!1);y(this,kn,!1);y(this,Ks,!1);y(this,ks,null);y(this,Vr,0);y(this,Gr,0);y(this,Ge,null);y(this,Tn,null);et(this,"_editToolbar",null);et(this,"_initialOptions",Object.create(null));et(this,"_initialData",null);et(this,"_isVisible",!0);et(this,"_uiManager",null);et(this,"_focusEventsAllowed",!0);y(this,Fo,!1);y(this,Nh,nt._zIndex++);this.parent=s.parent,this.id=s.id,this.width=this.height=null,this.pageIndex=s.parent.pageIndex,this.name=s.name,this.div=null,this._uiManager=s.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=s.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:a}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[r,a];const[l,h]=this.parentDimensions;this.x=s.x/l,this.y=s.y/h,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const s=nt.prototype._resizeWithKeyboard,e=mr.TRANSLATE_SMALL,i=mr.TRANSLATE_BIG;return ot(this,"_resizerKeyboardManager",new Fl([[["ArrowLeft","mac+ArrowLeft"],s,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],s,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],s,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],s,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],s,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],s,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],s,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],s,{args:[0,i]}],[["Escape","mac+Escape"],nt.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get isDrawer(){return!1}static get _defaultLineColor(){return ot(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(s){const e=new em({id:s.parent.getNextId(),parent:s.parent,uiManager:s._uiManager});e.annotationElementId=s.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(s,e){var n;if((n=nt._l10n)!=null||(nt._l10n=s),nt._l10nResizer||(nt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),nt._borderLineWidth!==-1)return;const i=getComputedStyle(document.documentElement);nt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(s,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(s){return!1}static paste(s,e){At("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return o(this,Fo)}set _isDraggable(s){var e;v(this,Fo,s),(e=this.div)==null||e.classList.toggle("draggable",s)}get isEnterHandled(){return!0}center(){const[s,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*s),this.y+=this.width*s/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*s),this.y-=this.width*s/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(s){this._uiManager.addCommands(s)}get currentLayer(){return this._uiManager.currentLayer}
3setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=o(this,Nh)}setParent(s){s!==null?(this.pageIndex=s.pageIndex,this.pageDimensions=s.pageDimensions):A(this,X,Wa).call(this),this.parent=s}focusin(s){this._focusEventsAllowed&&(o(this,Cn)?v(this,Cn,!1):this.parent.setSelected(this))}focusout(s){var i;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const e=s.relatedTarget;e!=null&&e.closest(`#${this.id}`)||(s.preventDefault(),(i=this.parent)!=null&&i.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(s,e,i,n){const[r,a]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(s+i)/r,this.y=(e+n)/a,this.fixAndSetPosition()}translate(s,e){A(this,X,kc).call(this,this.parentDimensions,s,e)}translateInPage(s,e){o(this,Te)||v(this,Te,[this.x,this.y,this.width,this.height]),A(this,X,kc).call(this,this.pageDimensions,s,e),this.div.scrollIntoView({block:"nearest"})}drag(s,e){o(this,Te)||v(this,Te,[this.x,this.y,this.width,this.height]);const{div:i,parentDimensions:[n,r]}=this;if(this.x+=s/n,this.y+=e/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:p,y:g}=this.div.getBoundingClientRect();this.parent.findNewParent(this,p,g)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:l}=this;const[h,c]=this.getBaseTranslation();a+=h,l+=c;const{style:d}=i;d.left=`${(100*a).toFixed(2)}%`,d.top=`${(100*l).toFixed(2)}%`,this._onTranslating(a,l),i.scrollIntoView({block:"nearest"})}_onTranslating(s,e){}_onTranslated(s,e){}get _hasBeenMoved(){return!!o(this,Te)&&(o(this,Te)[0]!==this.x||o(this,Te)[1]!==this.y)}get _hasBeenResized(){return!!o(this,Te)&&(o(this,Te)[2]!==this.width||o(this,Te)[3]!==this.height)}getBaseTranslation(){const[s,e]=this.parentDimensions,{_borderLineWidth:i}=nt,n=i/s,r=i/e;switch(this.rotation){case 90:return[-n,r];case 180:return[n,r];case 270:return[n,-r];default:return[-n,-r]}}get _mustFixPosition(){return!0}fixAndSetPosition(s=this.rotation){const{div:{style:e},pageDimensions:[i,n]}=this;let{x:r,y:a,width:l,height:h}=this;if(l*=i,h*=n,r*=i,a*=n,this._mustFixPosition)switch(s){case 0:r=Math.max(0,Math.min(i-l,r)),a=Math.max(0,Math.min(n-h,a));break;case 90:r=Math.max(0,Math.min(i-h,r)),a=Math.min(n,Math.max(l,a));break;case 180:r=Math.min(i,Math.max(l,r)),a=Math.min(n,Math.max(h,a));break;case 270:r=Math.min(i,Math.max(h,r)),a=Math.max(0,Math.min(n-l,a))}this.x=r/=i,this.y=a/=n;const[c,d]=this.getBaseTranslation();r+=c,a+=d,e.left=`${(100*r).toFixed(2)}%`,e.top=`${(100*a).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(s,e){var i;return A(i=nt,No,Tc).call(i,s,e,this.parentRotation)}pageTranslationToScreen(s,e){var i;return A(i=nt,No,Tc).call(i,s,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:s,pageDimensions:[e,i]}=this;return[e*s,i*s]}setDims(s,e){const[i,n]=this.parentDimensions,{style:r}=this.div;r.width=`${(100*s/i).toFixed(2)}%`,o(this,Sn)||(r.height=`${(100*e/n).toFixed(2)}%`)}fixDims(){const{style:s}=this.div,{height:e,width:i}=s,n=i.endsWith("%"),r=!o(this,Sn)&&e.endsWith("%");if(n&&r)return;const[a,l]=this.parentDimensions;n||(s.width=`${(100*parseFloat(i)/a).toFixed(2)}%`),o(this,Sn)||r||(s.height=`${(100*parseFloat(e)/l).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}_onResized(){}static _round(s){return Math.round(1e4*s)/1e4}_onResizing(){}altTextFinish(){var s;(s=o(this,St))==null||s.finish()}async addEditToolbar(){return this._editToolbar||o(this,kn)?this._editToolbar:(this._editToolbar=new vc(this),this.div.append(this._editToolbar.render()),o(this,St)&&await this._editToolbar.addAltText(o(this,St)),this._editToolbar)}removeEditToolbar(){var s;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(s=o(this,St))==null||s.destroy())}addContainer(s){var i;const e=(i=this._editToolbar)==null?void 0:i.div;e?e.before(s):this.div.append(s)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){o(this,St)||(Eh.initialize(nt._l10n),v(this,St,new Eh(this)),o(this,_n)&&(o(this,St).data=o(this,_n),v(this,_n,null)),await this.addEditToolbar())}get altTextData(){var s;return(s=o(this,St))==null?void 0:s.data}set altTextData(s){o(this,St)&&(o(this,St).data=s)}get guessedAltText(){var s;return(s=o(this,St))==null?void 0:s.guessedText}async setGuessedAltText(s){var e;await((e=o(this,St))==null?void 0:e.setGuessedText(s))}serializeAltText(s){var e;return(e=o(this,St))==null?void 0:e.serialize(s)}hasAltText(){return!!o(this,St)&&!o(this,St).isEmpty()}hasAltTextData(){var s,e;return(e=(s=o(this,St))==null?void 0:s.hasData())!=null?e:!1}render(){var r;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=o(this,Ur)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),A(this,X,Ic).call(this);const[s,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/s).toFixed(2)}%`,this.div.style.maxHeight=`${(100*s/e).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),Sh(this,this.div,["pointerdown"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(o(this,Tn)||v(this,Tn,new Ch({container:this.div,isPinchingDisabled:()=>!this.isSelected,onPinchStart:A(this,X,Xu).bind(this),onPinching:A(this,X,Yu).bind(this),onPinchEnd:A(this,X,Ku).bind(this),signal:this._uiManager._signal}))),(r=this._uiManager._editorUndoBar)==null||r.hide(),this.div}pointerdown(s){const{isMac:e}=ge.platform;s.button!==0||s.ctrlKey&&e?s.preventDefault():(v(this,Cn,!0),this._isDraggable?A(this,X,Qu).call(this,s):A(this,X,Pc).call(this,s))}get isSelected(){return this._uiManager.isSelected(this)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){o(this,ks)&&clearTimeout(o(this,ks)),v(this,ks,setTimeout((()=>{var s;v(this,ks,null),(s=this.parent)==null||s.moveEditorInDOM(this)}),0))}
3_setParentAndPosition(s,e,i){s.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(s,e,i=this.rotation){const n=this.parentScale,[r,a]=this.pageDimensions,[l,h]=this.pageTranslation,c=s/n,d=e/n,p=this.x*r,g=this.y*a,f=this.width*r,m=this.height*a;switch(i){case 0:return[p+c+l,a-g-d-m+h,p+c+f+l,a-g-d+h];case 90:return[p+d+l,a-g+c+h,p+d+m+l,a-g+c+f+h];case 180:return[p-c-f+l,a-g+d+h,p-c+l,a-g+d+m+h];case 270:return[p-d-m+l,a-g-c-f+h,p-d+l,a-g-c+h];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(s,e){const[i,n,r,a]=s,l=r-i,h=a-n;switch(this.rotation){case 0:return[i,e-a,l,h];case 90:return[i,e-n,h,l];case 180:return[r,e-n,l,h];case 270:return[r,e-a,h,l];default:throw new Error("Invalid rotation")}}onceAdded(s){}isEmpty(){return!1}enableEditMode(){v(this,kn,!0)}disableEditMode(){v(this,kn,!1)}isInEditMode(){return o(this,kn)}shouldGetKeyboardEvents(){return o(this,Ks)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:s,left:e,bottom:i,right:n}=this.getClientDimensions(),{innerHeight:r,innerWidth:a}=window;return e<a&&n>0&&s<r&&i>0}rebuild(){A(this,X,Ic).call(this)}rotate(s){}resize(){}serializeDeleted(){var s;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:((s=this._initialData)==null?void 0:s.popupRef)||""}}serialize(s=!1,e=null){At("An editor must be serializable")}static async deserialize(s,e,i){const n=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});n.rotation=s.rotation,v(n,_n,s.accessibilityData);const[r,a]=n.pageDimensions,[l,h,c,d]=n.getRectInCurrentCoords(s.rect,a);return n.x=l/r,n.y=h/a,n.width=c/r,n.height=d/a,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var s,e;if((s=o(this,Di))==null||s.abort(),v(this,Di,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),o(this,ks)&&(clearTimeout(o(this,ks)),v(this,ks,null)),A(this,X,Wa).call(this),this.removeEditToolbar(),o(this,Ge)){for(const i of o(this,Ge).values())clearTimeout(i);v(this,Ge,null)}this.parent=null,(e=o(this,Tn))==null||e.destroy(),v(this,Tn,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(A(this,X,qu).call(this),o(this,Qt).classList.remove("hidden"),Sh(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(s){if(!this.isResizable||s.target!==this.div||s.key!=="Enter")return;this._uiManager.setSelected(this),v(this,Ys,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const e=o(this,Qt).children;if(!o(this,rs)){v(this,rs,Array.from(e));const a=A(this,X,Ju).bind(this),l=A(this,X,Zu).bind(this),h=this._uiManager._signal;for(const c of o(this,rs)){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",a,{signal:h}),c.addEventListener("blur",l,{signal:h}),c.addEventListener("focus",A(this,X,tp).bind(this,d),{signal:h}),c.setAttribute("data-l10n-id",nt._l10nResizer[d])}}const i=o(this,rs)[0];let n=0;for(const a of e){if(a===i)break;n++}const r=(360-this.rotation+this.parentRotation)%360/90*(o(this,rs).length/4);if(r!==n){if(r<n)for(let l=0;l<n-r;l++)o(this,Qt).append(o(this,Qt).firstChild);else if(r>n)for(let l=0;l<r-n;l++)o(this,Qt).firstChild.before(o(this,Qt).lastChild);let a=0;for(const l of e){const h=o(this,rs)[a++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",nt._l10nResizer[h])}}A(this,X,Dc).call(this,0),v(this,Ks,!0),o(this,Qt).firstChild.focus({focusVisible:!0}),s.preventDefault(),s.stopImmediatePropagation()}_resizeWithKeyboard(s,e){o(this,Ks)&&A(this,X,Mc).call(this,o(this,Do),{deltaX:s,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){A(this,X,Wa).call(this),this.div.focus()}select(){var s,e,i;this.makeResizable(),(s=this.div)==null||s.classList.add("selectedEditor"),this._editToolbar?((e=this._editToolbar)==null||e.show(),(i=o(this,St))==null||i.toggleAltTextBadge(!1)):this.addEditToolbar().then((()=>{var n,r;(n=this.div)!=null&&n.classList.contains("selectedEditor")&&((r=this._editToolbar)==null||r.show())}))}unselect(){var s,e,i,n,r;(s=o(this,Qt))==null||s.classList.add("hidden"),(e=this.div)==null||e.classList.remove("selectedEditor"),(i=this.div)!=null&&i.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(n=this._editToolbar)==null||n.hide(),(r=o(this,St))==null||r.toggleAltTextBadge(!0)}updateParams(s,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return o(this,Lo)}set isEditing(s){v(this,Lo,s),this.parent&&(s?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(s,e){v(this,Sn,!0);const i=s/e,{style:n}=this.div;n.aspectRatio=i,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(s,e=!1){if(e){o(this,Ge)||v(this,Ge,new Map);const{action:i}=s;let n=o(this,Ge).get(i);n&&clearTimeout(n),n=setTimeout((()=>{this._reportTelemetry(s),o(this,Ge).delete(i),o(this,Ge).size===0&&v(this,Ge,null)}),nt._telemetryTimeout),o(this,Ge).set(i,n)}else s.type||(s.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:s}})}show(s=this._isVisible){this.div.classList.toggle("hidden",!s),this._isVisible=s}enable(){this.div&&(this.div.tabIndex=0),v(this,Ur,!1)}disable(){this.div&&(this.div.tabIndex=-1),v(this,Ur,!0)}renderAnnotationElement(s){let e=s.container.querySelector(".annotationContent");
3if(e){if(e.nodeName==="CANVAS"){const i=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),i.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),s.container.prepend(e);return e}resetAnnotationElement(s){const{firstChild:e}=s.container;(e==null?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};_n=new WeakMap,rs=new WeakMap,St=new WeakMap,Ur=new WeakMap,Ii=new WeakMap,Io=new WeakMap,Sn=new WeakMap,Qt=new WeakMap,En=new WeakMap,Ys=new WeakMap,Di=new WeakMap,Do=new WeakMap,Cn=new WeakMap,Te=new WeakMap,Lo=new WeakMap,kn=new WeakMap,Ks=new WeakMap,ks=new WeakMap,Vr=new WeakMap,Gr=new WeakMap,Ge=new WeakMap,Tn=new WeakMap,Fo=new WeakMap,Nh=new WeakMap,X=new WeakSet,kc=function([s,e],i,n){[i,n]=this.screenToPageTranslation(i,n),this.x+=i/s,this.y+=n/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},No=new WeakSet,Tc=function(s,e,i){switch(i){case 90:return[e,-s];case 180:return[-s,-e];case 270:return[-e,s];default:return[s,e]}},Zl=function(s){switch(s){case 90:{const[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}},qu=function(){if(o(this,Qt))return;v(this,Qt,document.createElement("div")),o(this,Qt).classList.add("resizers");const s=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of s){const n=document.createElement("div");o(this,Qt).append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",A(this,X,Wu).bind(this,i),{signal:e}),n.addEventListener("contextmenu",gs,{signal:e}),n.tabIndex=-1}this.div.prepend(o(this,Qt))},Wu=function(s,e){var d;e.preventDefault();const{isMac:i}=ge.platform;if(e.button!==0||e.ctrlKey&&i)return;(d=o(this,St))==null||d.toggle(!1);const n=this._isDraggable;this._isDraggable=!1,v(this,En,[e.screenX,e.screenY]);const r=new AbortController,a=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",A(this,X,Mc).bind(this,s),{passive:!0,capture:!0,signal:a}),window.addEventListener("touchmove",je,{passive:!1,signal:a}),window.addEventListener("contextmenu",gs,{signal:a}),v(this,Ys,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const l=this.parent.div.style.cursor,h=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const c=()=>{var p;r.abort(),this.parent.togglePointerEvents(!0),(p=o(this,St))==null||p.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=l,this.div.style.cursor=h,A(this,X,th).call(this)};window.addEventListener("pointerup",c,{signal:a}),window.addEventListener("blur",c,{signal:a})},Rc=function(s,e,i,n){this.width=i,this.height=n,this.x=s,this.y=e;const[r,a]=this.parentDimensions;this.setDims(r*i,a*n),this.fixAndSetPosition(),this._onResized()},th=function(){if(!o(this,Ys))return;const{savedX:s,savedY:e,savedWidth:i,savedHeight:n}=o(this,Ys);v(this,Ys,null);const r=this.x,a=this.y,l=this.width,h=this.height;r===s&&a===e&&l===i&&h===n||this.addCommands({cmd:A(this,X,Rc).bind(this,r,a,l,h),undo:A(this,X,Rc).bind(this,s,e,i,n),mustExec:!0})},Mc=function(s,e){const[i,n]=this.parentDimensions,r=this.x,a=this.y,l=this.width,h=this.height,c=nt.MIN_SIZE/i,d=nt.MIN_SIZE/n,p=A(this,X,Zl).call(this,this.rotation),g=(j,H)=>[p[0]*j+p[2]*H,p[1]*j+p[3]*H],f=A(this,X,Zl).call(this,360-this.rotation);let m,b,w=!1,x=!1;switch(s){case"topLeft":w=!0,m=(j,H)=>[0,0],b=(j,H)=>[j,H];break;case"topMiddle":m=(j,H)=>[j/2,0],b=(j,H)=>[j/2,H];break;case"topRight":w=!0,m=(j,H)=>[j,0],b=(j,H)=>[0,H];break;case"middleRight":x=!0,m=(j,H)=>[j,H/2],b=(j,H)=>[0,H/2];break;case"bottomRight":w=!0,m=(j,H)=>[j,H],b=(j,H)=>[0,0];break;case"bottomMiddle":m=(j,H)=>[j/2,H],b=(j,H)=>[j/2,0];break;case"bottomLeft":w=!0,m=(j,H)=>[0,H],b=(j,H)=>[j,0];break;case"middleLeft":x=!0,m=(j,H)=>[0,H/2],b=(j,H)=>[j,H/2]}const _=m(l,h),S=b(l,h);let E=g(...S);const C=nt._round(r+E[0]),T=nt._round(a+E[1]);let k,I,P=1,N=1;if(e.fromKeyboard)({deltaX:k,deltaY:I}=e);else{const{screenX:j,screenY:H}=e,[xt,vt]=o(this,En);[k,I]=this.screenToPageTranslation(j-xt,H-vt),o(this,En)[0]=j,o(this,En)[1]=H}[k,I]=(O=k/i,Y=I/n,[f[0]*O+f[2]*Y,f[1]*O+f[3]*Y]);var O,Y;if(w){const j=Math.hypot(l,h);P=N=Math.max(Math.min(Math.hypot(S[0]-_[0]-k,S[1]-_[1]-I)/j,1/l,1/h),c/l,d/h)}else x?P=Math.max(c,Math.min(1,Math.abs(S[0]-_[0]-k)))/l:N=Math.max(d,Math.min(1,Math.abs(S[1]-_[1]-I)))/h;const K=nt._round(l*P),V=nt._round(h*N);E=g(...b(K,V));const it=C-E[0],rt=T-E[1];o(this,Te)||v(this,Te,[this.x,this.y,this.width,this.height]),this.width=K,this.height=V,this.x=it,this.y=rt,this.setDims(i*K,n*V),this.fixAndSetPosition(),this._onResizing()},Xu=function(){var s;v(this,Ys,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),(s=o(this,St))==null||s.toggle(!1),this.parent.togglePointerEvents(!1)},Yu=function(s,e,i){let n=i/e*.7+1-.7;
3if(n===1)return;const r=A(this,X,Zl).call(this,this.rotation),a=(C,T)=>[r[0]*C+r[2]*T,r[1]*C+r[3]*T],[l,h]=this.parentDimensions,c=this.x,d=this.y,p=this.width,g=this.height,f=nt.MIN_SIZE/l,m=nt.MIN_SIZE/h;n=Math.max(Math.min(n,1/p,1/g),f/p,m/g);const b=nt._round(p*n),w=nt._round(g*n);if(b===p&&w===g)return;o(this,Te)||v(this,Te,[c,d,p,g]);const x=a(p/2,g/2),_=nt._round(c+x[0]),S=nt._round(d+x[1]),E=a(b/2,w/2);this.x=_-E[0],this.y=S-E[1],this.width=b,this.height=w,this.setDims(l*b,h*w),this.fixAndSetPosition(),this._onResizing()},Ku=function(){var s;(s=o(this,St))==null||s.toggle(!0),this.parent.togglePointerEvents(!0),A(this,X,th).call(this)},Pc=function(s){const{isMac:e}=ge.platform;s.ctrlKey&&!e||s.shiftKey||s.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Qu=function(s){const{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1;const n=new AbortController,r=this._uiManager.combinedSignal(n),a={capture:!0,passive:!1,signal:r},l=c=>{n.abort(),v(this,Ii,null),v(this,Cn,!1),this._uiManager.endDragSession()||A(this,X,Pc).call(this,c),i&&this._onStopDragging()};e&&(v(this,Vr,s.clientX),v(this,Gr,s.clientY),v(this,Ii,s.pointerId),v(this,Io,s.pointerType),window.addEventListener("pointermove",(c=>{i||(i=!0,this._onStartDragging());const{clientX:d,clientY:p,pointerId:g}=c;if(g!==o(this,Ii)){je(c);return}const[f,m]=this.screenToPageTranslation(d-o(this,Vr),p-o(this,Gr));v(this,Vr,d),v(this,Gr,p),this._uiManager.dragSelectedEditors(f,m)}),a),window.addEventListener("touchmove",je,a),window.addEventListener("pointerdown",(c=>{c.pointerType===o(this,Io)&&(o(this,Tn)||c.isPrimary)&&l(c),je(c)}),a));const h=c=>{o(this,Ii)&&o(this,Ii)!==c.pointerId?je(c):l(c)};window.addEventListener("pointerup",h,{signal:r}),window.addEventListener("blur",h,{signal:r})},Ic=function(){if(o(this,Di)||!this.div)return;v(this,Di,new AbortController);const s=this._uiManager.combinedSignal(o(this,Di));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:s}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:s})},Ju=function(s){nt._resizerKeyboardManager.exec(this,s)},Zu=function(s){var e;o(this,Ks)&&((e=s.relatedTarget)==null?void 0:e.parentNode)!==o(this,Qt)&&A(this,X,Wa).call(this)},tp=function(s){v(this,Do,o(this,Ks)?s:"")},Dc=function(s){if(o(this,rs))for(const e of o(this,rs))e.tabIndex=s},Wa=function(){v(this,Ks,!1),A(this,X,Dc).call(this,-1),A(this,X,th).call(this)},y(nt,No),et(nt,"_l10n",null),et(nt,"_l10nResizer",null),et(nt,"_borderLineWidth",-1),et(nt,"_colorManager",new Md),et(nt,"_zIndex",1),et(nt,"_telemetryTimeout",1e3);let Pt=nt;class em extends Pt{constructor(s){super(s),this.annotationElementId=s.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Jd=3285377520,ze=4294901760,yi=65535;class ep{constructor(s){this.h1=s?4294967295&s:Jd,this.h2=s?4294967295&s:Jd}update(s){let e,i;if(typeof s=="string"){e=new Uint8Array(2*s.length),i=0;for(let b=0,w=s.length;b<w;b++){const x=s.charCodeAt(b);x<=255?e[i++]=x:(e[i++]=x>>>8,e[i++]=255&x)}}else{if(!ArrayBuffer.isView(s))throw new Error("Invalid data format, must be a string or TypedArray.");e=s.slice(),i=e.byteLength}const n=i>>2,r=i-4*n,a=new Uint32Array(e.buffer,0,n);let l=0,h=0,c=this.h1,d=this.h2;const p=3432918353,g=461845907,f=11601,m=13715;for(let b=0;b<n;b++)1&b?(l=a[b],l=l*p&ze|l*f&yi,l=l<<15|l>>>17,l=l*g&ze|l*m&yi,c^=l,c=c<<13|c>>>19,c=5*c+3864292196):(h=a[b],h=h*p&ze|h*f&yi,h=h<<15|h>>>17,h=h*g&ze|h*m&yi,d^=h,d=d<<13|d>>>19,d=5*d+3864292196);switch(l=0,r){case 3:l^=e[4*n+2]<<16;case 2:l^=e[4*n+1]<<8;case 1:l^=e[4*n],l=l*p&ze|l*f&yi,l=l<<15|l>>>17,l=l*g&ze|l*m&yi,1&n?c^=l:d^=l}this.h1=c,this.h2=d}hexdigest(){let s=this.h1,e=this.h2;return s^=e>>>1,s=3981806797*s&ze|36045*s&yi,e=4283543511*e&ze|(2950163797*(e<<16|s>>>16)&ze)>>>16,s^=e>>>1,s=444984403*s&ze|60499*s&yi,e=3301882366*e&ze|(3120437893*(e<<16|s>>>16)&ze)>>>16,s^=e>>>1,(s>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Lc=Object.freeze({map:null,hash:"",transfer:void 0});var Rn,Mn,Gt,Oh,sp;class Pd{constructor(){y(this,Oh);y(this,Rn,!1);
3y(this,Mn,null);y(this,Gt,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(s,e){const i=o(this,Gt).get(s);return i===void 0?e:Object.assign(e,i)}getRawValue(s){return o(this,Gt).get(s)}remove(s){if(o(this,Gt).delete(s),o(this,Gt).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const e of o(this,Gt).values())if(e instanceof Pt)return;this.onAnnotationEditor(null)}}setValue(s,e){const i=o(this,Gt).get(s);let n=!1;if(i!==void 0)for(const[r,a]of Object.entries(e))i[r]!==a&&(n=!0,i[r]=a);else n=!0,o(this,Gt).set(s,e);n&&A(this,Oh,sp).call(this),e instanceof Pt&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(s){return o(this,Gt).has(s)}getAll(){return o(this,Gt).size>0?Cd(o(this,Gt)):null}setAll(s){for(const[e,i]of Object.entries(s))this.setValue(e,i)}get size(){return o(this,Gt).size}resetModified(){o(this,Rn)&&(v(this,Rn,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new ip(this)}get serializable(){if(o(this,Gt).size===0)return Lc;const s=new Map,e=new ep,i=[],n=Object.create(null);let r=!1;for(const[a,l]of o(this,Gt)){const h=l instanceof Pt?l.serialize(!1,n):l;h&&(s.set(a,h),e.update(`${a}:${JSON.stringify(h)}`),r||(r=!!h.bitmap))}if(r)for(const a of s.values())a.bitmap&&i.push(a.bitmap);return s.size>0?{map:s,hash:e.hexdigest(),transfer:i}:Lc}get editorStats(){var i;let s=null;const e=new Map;for(const n of o(this,Gt).values()){if(!(n instanceof Pt))continue;const r=n.telemetryFinalData;if(!r)continue;const{type:a}=r;e.has(a)||e.set(a,Object.getPrototypeOf(n).constructor),s||(s=Object.create(null));const l=s[a]||(s[a]=new Map);for(const[h,c]of Object.entries(r)){if(h==="type")continue;let d=l.get(h);d||(d=new Map,l.set(h,d));const p=(i=d.get(c))!=null?i:0;d.set(c,p+1)}}for(const[n,r]of e)s[n]=r.computeTelemetryFinalData(s[n]);return s}resetModifiedIds(){v(this,Mn,null)}get modifiedIds(){if(o(this,Mn))return o(this,Mn);const s=[];for(const e of o(this,Gt).values())e instanceof Pt&&e.annotationElementId&&e.serialize()&&s.push(e.annotationElementId);return v(this,Mn,{ids:new Set(s),hash:s.join(",")})}}Rn=new WeakMap,Mn=new WeakMap,Gt=new WeakMap,Oh=new WeakSet,sp=function(){o(this,Rn)||(v(this,Rn,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var Oo;class ip extends Pd{constructor(e){super();y(this,Oo);const{map:i,hash:n,transfer:r}=e.serializable,a=structuredClone(i,r?{transfer:r}:null);v(this,Oo,{map:a,hash:n,transfer:r})}get print(){At("Should not call PrintAnnotationStorage.print")}get serializable(){return o(this,Oo)}get modifiedIds(){return ot(this,"modifiedIds",{ids:new Set,hash:""})}}Oo=new WeakMap;var qr;class sm{constructor({ownerDocument:s=globalThis.document,styleElement:e=null}){y(this,qr,new Set);this._document=s,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(s){this.nativeFontFaces.add(s),this._document.fonts.add(s)}removeNativeFontFace(s){this.nativeFontFaces.delete(s),this._document.fonts.delete(s)}insertRule(s){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(s,e.cssRules.length)}clear(){for(const s of this.nativeFontFaces)this._document.fonts.delete(s);this.nativeFontFaces.clear(),o(this,qr).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:s,_inspectFont:e}){if(s&&!o(this,qr).has(s.loadedName))if(Nt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:n,style:r}=s,a=new FontFace(i,n,r);this.addNativeFontFace(a);try{await a.load(),o(this,qr).add(i),e==null||e(s)}catch{J(`Cannot load system font: ${s.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}}else At("Not implemented: loadSystemFont without the Font Loading API.")}async bind(s){if(s.attached||s.missingFile&&!s.systemFontInfo)return;if(s.attached=!0,s.systemFontInfo){await this.loadSystemFont(s);return}if(this.isFontLoadingAPISupported){const i=s.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(n){throw J(`Failed to load font '${i.family}': '${n}'.`),s.disableFontFace=!0,n}}return}const e=s.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((i=>{const n=this._queueLoadingCallback(i);this._prepareFontLoadEvent(s,n)}))}}get isFontLoadingAPISupported(){var s;return ot(this,"isFontLoadingAPISupported",!!((s=this._document)!=null&&s.fonts))}get isSyncFontLoadingSupported(){let s=!1;return(le||typeof navigator<"u"&&typeof(navigator==null?void 0:navigator.userAgent)=="str
3ing"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(s=!0),ot(this,"isSyncFontLoadingSupported",s)}_queueLoadingCallback(s){const{loadingRequests:e}=this,i={done:!1,complete:function(){for(Nt(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;){const r=e.shift();setTimeout(r.callback,0)}},callback:s};return e.push(i),i}get _loadTestFont(){return ot(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(s,e){function i(w,x){return w.charCodeAt(x)<<24|w.charCodeAt(x+1)<<16|w.charCodeAt(x+2)<<8|255&w.charCodeAt(x+3)}function n(w,x,_,S){return w.substring(0,x)+S+w.substring(x+_)}let r,a;const l=this._document.createElement("canvas");l.width=1,l.height=1;const h=l.getContext("2d");let c=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let p=this._loadTestFont;p=n(p,976,d.length,d);const g=1482184792;let f=i(p,16);for(r=0,a=d.length-3;r<a;r+=4)f=f-g+i(d,r)|0;r<d.length&&(f=f-g+i(d+"XXX",r)|0),p=n(p,16,4,(function(x){return String.fromCharCode(x>>24&255,x>>16&255,x>>8&255,255&x)})(f));const m=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(p)});`}}`;this.insertRule(m);const b=this._document.createElement("div");b.style.visibility="hidden",b.style.width=b.style.height="10px",b.style.position="absolute",b.style.top=b.style.left="0px";for(const w of[s.loadedName,d]){const x=this._document.createElement("span");x.textContent="Hi",x.style.fontFamily=w,b.append(x)}this._document.body.append(b),(function w(x,_){if(++c>30){J("Load test font never loaded."),_();return}h.font="30px "+x,h.fillText(".",0,20),h.getImageData(0,0,1,1).data[3]>0?_():setTimeout(w.bind(null,x,_))})(d,(()=>{b.remove(),e.complete()}))}}qr=new WeakMap;class im{constructor(s,{disableFontFace:e=!1,fontExtraProperties:i=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const r in s)this[r]=s[r];this.disableFontFace=e===!0,this.fontExtraProperties=i===!0,this._inspectFont=n}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let s;if(this.cssFontInfo){const i={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(i.style=`oblique ${this.cssFontInfo.italicAngle}deg`),s=new FontFace(this.cssFontInfo.fontFamily,this.data,i)}else s=new FontFace(this.loadedName,this.data,{});return(e=this._inspectFont)==null||e.call(this,this),s}createFontFaceRule(){var i;if(!this.data||this.disableFontFace)return null;const s=`url(data:${this.mimetype};base64,${(function(r){return Uint8Array.prototype.toBase64?r.toBase64():btoa(Su(r))})(this.data)});`;let e;if(this.cssFontInfo){let n=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(n+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${n}src:${s}}`}else e=`@font-face {font-family:"${this.loadedName}";src:${s}}`;return(i=this._inspectFont)==null||i.call(this,this,s),e}getPathGenerator(s,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];const i=this.loadedName+"_path_"+e;let n;try{n=s.get(i)}catch(a){J(`getPathGenerator - ignoring character: "${a}".`)}const r=new Path2D(n||"");return this.fontExtraProperties||s.delete(i),this.compiledGlyphs[e]=r}}const Zd=1,tu=2,eu=1,lc=2,su=3,iu=4,nu=5,ru=6,$l=7,hc=8;function au(){}function Ae(u){if(u instanceof Zi||u instanceof pc||u instanceof lo||u instanceof Yd||u instanceof _h||u instanceof rc)return u;switch(u instanceof Error||typeof u=="object"&&u!==null||At('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),u.name){case"AbortException":return new Zi(u.message);case"InvalidPDFException":return new pc(u.message);case"MissingPDFException":return new lo(u.message);case"PasswordException":return new Yd(u.message,u.code);case"UnexpectedResponseException":return new _h(u.message,u.status);case"UnknownErrorException":return new rc(u.message,u.details)}return new rc(u.message,u.toString())}var Wr,Je,np,rp,ap,eh;class Xa{constructor(s,e,i){y(this,Je);y(this,Wr,new AbortController);this.sourceName=s,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),i.addEventListener("message",A(this,Je,np).bind(this),{signal:o(this,Wr).signal})}on(s,e){const i=this.actionHandler;if(i[s])throw new Error(`There is already an actionName called "${s}"`);i[s]=e}send(s,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:s,data:e},i)}
3sendWithPromise(s,e,i){const n=this.callbackId++,r=Promise.withResolvers();this.callbackCapabilities[n]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:s,callbackId:n,data:e},i)}catch(a){r.reject(a)}return r.promise}sendWithStream(s,e,i,n){const r=this.streamId++,a=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:c=>{const d=Promise.withResolvers();return this.streamControllers[r]={controller:c,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:a,targetName:l,action:s,streamId:r,data:e,desiredSize:c.desiredSize},n),d.promise},pull:c=>{const d=Promise.withResolvers();return this.streamControllers[r].pullCall=d,h.postMessage({sourceName:a,targetName:l,stream:ru,streamId:r,desiredSize:c.desiredSize}),d.promise},cancel:c=>{Nt(c instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[r].cancelCall=d,this.streamControllers[r].isClosed=!0,h.postMessage({sourceName:a,targetName:l,stream:eu,streamId:r,reason:Ae(c)}),d.promise}},i)}destroy(){var s;(s=o(this,Wr))==null||s.abort(),v(this,Wr,null)}}Wr=new WeakMap,Je=new WeakSet,np=function({data:s}){if(s.targetName!==this.sourceName)return;if(s.stream){A(this,Je,ap).call(this,s);return}if(s.callback){const i=s.callbackId,n=this.callbackCapabilities[i];if(!n)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],s.callback===Zd)n.resolve(s.data);else{if(s.callback!==tu)throw new Error("Unexpected callback case");n.reject(Ae(s.reason))}return}const e=this.actionHandler[s.action];if(!e)throw new Error(`Unknown action from worker: ${s.action}`);if(s.callbackId){const i=this.sourceName,n=s.sourceName,r=this.comObj;Promise.try(e,s.data).then((function(a){r.postMessage({sourceName:i,targetName:n,callback:Zd,callbackId:s.callbackId,data:a})}),(function(a){r.postMessage({sourceName:i,targetName:n,callback:tu,callbackId:s.callbackId,reason:Ae(a)})}))}else s.streamId?A(this,Je,rp).call(this,s):e(s.data)},rp=function(s){const e=s.streamId,i=this.sourceName,n=s.sourceName,r=this.comObj,a=this,l=this.actionHandler[s.action],h={enqueue(c,d=1,p){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=d,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:n,stream:iu,streamId:e,chunk:c},p)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:n,stream:su,streamId:e}),delete a.streamSinks[e])},error(c){Nt(c instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:n,stream:nu,streamId:e,reason:Ae(c)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:s.desiredSize,ready:null};h.sinkCapability.resolve(),h.ready=h.sinkCapability.promise,this.streamSinks[e]=h,Promise.try(l,s.data,h).then((function(){r.postMessage({sourceName:i,targetName:n,stream:hc,streamId:e,success:!0})}),(function(c){r.postMessage({sourceName:i,targetName:n,stream:hc,streamId:e,reason:Ae(c)})}))},ap=function(s){const e=s.streamId,i=this.sourceName,n=s.sourceName,r=this.comObj,a=this.streamControllers[e],l=this.streamSinks[e];switch(s.stream){case hc:s.success?a.startCall.resolve():a.startCall.reject(Ae(s.reason));break;case $l:s.success?a.pullCall.resolve():a.pullCall.reject(Ae(s.reason));break;case ru:if(!l){r.postMessage({sourceName:i,targetName:n,stream:$l,streamId:e,success:!0});break}l.desiredSize<=0&&s.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=s.desiredSize,Promise.try(l.onPull||au).then((function(){r.postMessage({sourceName:i,targetName:n,stream:$l,streamId:e,success:!0})}),(function(c){r.postMessage({sourceName:i,targetName:n,stream:$l,streamId:e,reason:Ae(c)})}));break;case iu:if(Nt(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(s.chunk);break;case su:if(Nt(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),A(this,Je,eh).call(this,a,e);break;case nu:Nt(a,"error should have stream controller"),a.controller.error(Ae(s.reason)),A(this,Je,eh).call(this,a,e);break;case lc:s.success?a.cancelCall.resolve():a.cancelCall.reject(Ae(s.reason)),A(this,Je,eh).call(this,a,e);break;case eu:if(!l)break;const h=Ae(s.reason);Promise.try(l.onCancel||au,h).then((function(){r.postMessage({sourceName:i,targetName:n,stream:lc,streamId:e,success:!0})}),(function(c){r.postMessage({sourceName:i,targetName:n,stream:lc,streamId:e,reason:Ae(c)})})),l.sinkCapability.reject(h),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},eh=async function(s,e){var i,n,r;await Promise.allSettled([(i=s.startCall)==null?void 0:i.promise,(n=s.pullCall)==null?void 0:n.promise,(r=s.cancelCall)==null?void 0:r.promise]),delete this.streamControllers[e]};var Bo;class ou{constructor({enableHWA:s=!1}){y(this,Bo,!1);v(this,Bo,s)}create(s,e){if(s<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(s,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!o(this,Bo)})}}reset(s,e,i){if(!s.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");s.canvas.width=e,s.canvas.height=i}destroy(s){if(!s.canvas)throw new Error("Canvas is not specified");s.canvas.width=0,s.canvas.height=0,s.canvas=null,s.context=null}_createCanvas(s,e){At("Abstract method `_createCanvas` called.")}}Bo=new WeakMap;class op{constructor({baseUrl:s=null,isCompressed:e=!0}){this.baseUrl=s,this.isCompressed=e}async fetch({name:s}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!s)throw new Error("CMap name must be specified.");const e=this.baseUrl+s+(this.isCompressed?".bcmap":"");return this._fetch(e).then((i=>({cMapData:i,isCompressed:this.isCompressed}
vendor: 4,709 bytes, line 3
3))).catch((i=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)}))}async _fetch(s){At("Abstract method `_fetch` called.")}}class lp extends op{async _fetch(s){const e=await Qh(s,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Kh(e)}}ht(4520);class lu{addFilter(s){return"none"}addHCMFilter(s,e){return"none"}addAlphaFilter(s){return"none"}addLuminosityFilter(s){return"none"}addHighlightHCMFilter(s,e,i,n,r){return"none"}destroy(s=!1){}}class hp{constructor({baseUrl:s=null}){this.baseUrl=s}async fetch({filename:s}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!s)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${s}`;return this._fetch(e).catch((i=>{throw new Error(`Unable to load font data at: ${e}`)}))}async _fetch(s){At("Abstract method `_fetch` called.")}}class cp extends hp{async _fetch(s){const e=await Qh(s,"arraybuffer");return new Uint8Array(e)}}if(le){let u;try{const s=process.getBuiltinModule("module").createRequire(import.meta.url);try{u=s("@napi-rs/canvas")}catch(e){J(`Cannot load "@napi-rs/canvas" package: "${e}".`)}}catch(s){J(`Cannot access the \`require\` function: "${s}".`)}globalThis.DOMMatrix||(u!=null&&u.DOMMatrix?globalThis.DOMMatrix=u.DOMMatrix:J("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(u!=null&&u.ImageData?globalThis.ImageData=u.ImageData:J("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(u!=null&&u.Path2D?globalThis.Path2D=u.Path2D:J("Cannot polyfill `Path2D`, rendering may be broken."))}async function dp(u){const s=process.getBuiltinModule("fs"),e=await s.promises.readFile(u);return new Uint8Array(e)}const cn="Fill",kh="Stroke",ao="Shading";function Fc(u,s){if(!s)return;const e=s[2]-s[0],i=s[3]-s[1],n=new Path2D;n.rect(s[0],s[1],e,i),u.clip(n)}class Id{getPattern(){At("Abstract method `getPattern` called.")}}class nm extends Id{constructor(s){super(),this._type=s[1],this._bbox=s[2],this._colorStops=s[3],this._p0=s[4],this._p1=s[5],this._r0=s[6],this._r1=s[7],this.matrix=null}_createGradient(s){let e;this._type==="axial"?e=s.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=s.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(s,e,i,n){let r;if(n===kh||n===cn){const a=e.current.getClippedPathBoundingBox(n,Ct(s))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,h=Math.ceil(a[3]-a[1])||1,c=e.cachedCanvases.getCanvas("pattern",l,h),d=c.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-a[0],-a[1]),i=W.transform(i,[1,0,0,1,a[0],a[1]]),d.transform(...e.baseTransform),this.matrix&&d.transform(...this.matrix),Fc(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),r=s.createPattern(c.canvas,"no-repeat");const p=new DOMMatrix(i);r.setTransform(p)}else Fc(s,this._bbox),r=this._createGradient(s);return r}}function cc(u,s,e,i,n,r,a,l){const h=s.coords,c=s.colors,d=u.data,p=4*u.width;let g;h[e+1]>h[i+1]&&(g=e,e=i,i=g,g=r,r=a,a=g),h[i+1]>h[n+1]&&(g=i,i=n,n=g,g=a,a=l,l=g),h[e+1]>h[i+1]&&(g=e,e=i,i=g,g=r,r=a,a=g);const f=(h[e]+s.offsetX)*s.scaleX,m=(h[e+1]+s.offsetY)*s.scaleY,b=(h[i]+s.offsetX)*s.scaleX,w=(h[i+1]+s.offsetY)*s.scaleY,x=(h[n]+s.offsetX)*s.scaleX,_=(h[n+1]+s.offsetY)*s.scaleY;if(m>=_)return;const S=c[r],E=c[r+1],C=c[r+2],T=c[a],k=c[a+1],I=c[a+2],P=c[l],N=c[l+1],O=c[l+2],Y=Math.round(m),K=Math.round(_);let V,it,rt,j,H,xt,vt,Yt;for(let ut=Y;ut<=K;ut++){if(ut<w){const $=ut<m?0:(m-ut)/(m-w);V=f-(f-b)*$,it=S-(S-T)*$,rt=E-(E-k)*$,j=C-(C-I)*$}else{let $;$=ut>_?1:w===_?0:(w-ut)/(w-_),V=b-(b-x)*$,it=T-(T-P)*$,rt=k-(k-N)*$,j=I-(I-O)*$}let R;R=ut<m?0:ut>_?1:(m-ut)/(m-_),H=f-(f-x)*R,xt=S-(S-P)*R,vt=E-(E-N)*R,Yt=C-(C-O)*R;const M=Math.round(Math.min(V,H)),D=Math.round(Math.max(V,H));let L=p*ut+4*M;for(let $=M;$<=D;$++)R=(V-$)/(V-H),R<0?R=0:R>1&&(R=1),d[L++]=it-(it-xt)*R|0,d[L++]=rt-(rt-vt)*R|0,d[L++]=j-(j-Yt)*R|0,d[L++]=255}}function rm(u,s,e){const i=s.coords,n=s.colors;let r,a;switch(s.type){case"lattice":const l=s.verticesPerRow,h=Math.floor(i.length/l)-1,c=l-1;for(r=0;r<h;r++){let d=r*l;for(let p=0;p<c;p++,d++)cc(u,e,i[d],i[d+1],i[d+l],n[d],n[d+1],n[d+l]),cc(u,e,i[d+l+1],i[d+1],i[d+l],n[d+l+1],n[d+1],n[d+l])}break;case"triangles":for(r=0,a=i.length;r<a;r+=3)cc(u,e,i[r],i[r+1],i[r+2],n[r],n[r+1],n[r+2]);break;default:throw new Error("illegal figure")}}class am extends Id{constructor(s){super(),this._coords=s[2],this._colors=s[3],this._figures=s[4],this._bounds=s[5
3],this._bbox=s[7],this._background=s[8],this.matrix=null}_createMeshCanvas(s,e,i){const n=Math.floor(this._bounds[0]),r=Math.floor(this._bounds[1]),a=Math.ceil(this._bounds[2])-n,l=Math.ceil(this._bounds[3])-r,h=Math.min(Math.ceil(Math.abs(a*s[0]*1.1)),3e3),c=Math.min(Math.ceil(Math.abs(l*s[1]*1.1)),3e3),d=a/h,p=l/c,g={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-r,scaleX:1/d,scaleY:1/p},f=h+4,m=c+4,b=i.getCanvas("mesh",f,m),w=b.context,x=w.createImageData(h,c);if(e){const _=x.data;for(let S=0,E=_.length;S<E;S+=4)_[S]=e[0],_[S+1]=e[1],_[S+2]=e[2],_[S+3]=255}for(const _ of this._figures)rm(x,_,g);return w.putImageData(x,2,2),{canvas:b.canvas,offsetX:n-2*d,offsetY:r-2*p,scaleX:d,scaleY:p}}getPattern(s,e,i,n){Fc(s,this._bbox);let r;if(n===ao)r=W.singularValueDecompose2dScale(Ct(s));else if(r=W.singularValueDecompose2dScale(e.baseTransform),this.matrix){const l=W.singularValueDecompose2dScale(this.matrix);r=[r[0]*l[0],r[1]*l[1]]}const a=this._createMeshCanvas(r,n===ao?null:this._background,e.cachedCanvases);return n!==ao&&(s.setTransform(...e.baseTransform),this.matrix&&s.transform(...this.matrix)),s.translate(a.offsetX,a.offsetY),s.scale(a.scaleX,a.scaleY),s.createPattern(a.canvas,"no-repeat")}}class om extends Id{getPattern(){return"hotpink"}}const lm=1,hm=2;class Dd{static MAX_PATTERN_SIZE=3e3;constructor(s,e,i,n,r){this.operatorList=s[2],this.matrix=s[3],this.bbox=s[4],this.xstep=s[5],this.ystep=s[6],this.paintType=s[7],this.tilingType=s[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=n,this.baseTransform=r}createPatternCanvas(s){const{bbox:e,operatorList:i,paintType:n,tilingType:r,color:a,canvasGraphicsFactory:l}=this;let{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),Yh("TilingType: "+r);const d=e[0],p=e[1],g=e[2],f=e[3],m=g-d,b=f-p,w=W.singularValueDecompose2dScale(this.matrix),x=W.singularValueDecompose2dScale(this.baseTransform),_=w[0]*x[0],S=w[1]*x[1];let E=m,C=b,T=!1,k=!1;const I=Math.ceil(h*_),P=Math.ceil(c*S);I>=Math.ceil(m*_)?E=h:T=!0,P>=Math.ceil(b*S)?C=c:k=!0;const N=this.getSizeAndScale(E,this.ctx.canvas.width,_),O=this.getSizeAndScale(C,this.ctx.canvas.height,S),Y=s.cachedCanvases.getCanvas("pattern",N.size,O.size),K=Y.context,V=l.createCanvasGraphics(K);if(V.groupLevel=s.groupLevel,this.setFillAndStrokeStyleToContext(V,n,a),K.translate(-N.scale*d,-O.scale*p),V.transform(N.scale,0,0,O.scale,0,0),K.save(),this.clipBbox(V,d,p,g,f),V.baseTransform=Ct(V.ctx),V.executeOperatorList(i),V.endDrawing(),K.restore(),T||k){const it=Y.canvas;T&&(E=h),k&&(C=c);const rt=this.getSizeAndScale(E,this.ctx.canvas.width,_),j=this.getSizeAndScale(C,this.ctx.canvas.height,S),H=rt.size,xt=j.size,vt=s.cachedCanvases.getCanvas("pattern-workaround",H,xt),Yt=vt.context,ut=T?Math.floor(m/h):0,R=k?Math.floor(b/c):0;for(let M=0;M<=ut;M++)for(let D=0;D<=R;D++)Yt.drawImage(it,H*M,xt*D,H,xt,0,0,H,xt);return{canvas:vt.canvas,scaleX:rt.scale,scaleY:j.scale,offsetX:d,offsetY:p}}return{canvas:Y.canvas,scaleX:N.scale,scaleY:O.scale,offsetX:d,offsetY:p}}getSizeAndScale(s,e,i){const n=Math.max(Dd.MAX_PATTERN_SIZE,e);let r=Math.ceil(s*i);return r>=n?r=n:i=r/s,{scale:i,size:r}}clipBbox(s,e,i,n,r){const a=n-e,l=r-i;s.ctx.rect(e,i,a,l),s.current.updateRectMinMax(Ct(s.ctx),[e,i,n,r]),s.clip(),s.endPath()}setFillAndStrokeStyleToContext(s,e,i){const n=s.ctx,r=s.current;switch(e){case lm:const a=this.ctx;n.fillStyle=a.fillStyle,n.strokeStyle=a.strokeStyle,r.fillColor=a.fillStyle,r.strokeColor=a.strokeStyle;break;case hm:const l=W.makeHexColor(i[0],i[1],i[2]);n.fillStyle=l,n.strokeStyle=l,r.fillColor=l,r.strokeColor=l;break;default:throw new Wg(`Unsupported paint type: ${e}`)}}getPattern(s,e,i,n){let r=i;n!==ao&&(r=W.transform(r,e.baseTransform),this.matrix&&(r=W.transform(r,this.matrix)));const a=this.createPatternCanvas(e);let l=new DOMMatrix(r);l=l.translate(a.offsetX,a.offsetY),l=l.scale(1/a.scaleX,1/a.scaleY);const h=s.createPattern(a.canvas,"repeat");return h.setTransform(l),h}}function cm({src:u,srcPos:s=0,dest:e,width:i,height:n,nonBlackColor:r=4294967295,inverseDecode:a=!1}){const l=ge.isLittleEndian?4278190080:255,[h,c]=a?[r,l]:[l,r],d=i>>3,p=7&i,g=u.length;
3e=new Uint32Array(e.buffer);let f=0;for(let m=0;m<n;m++){for(const w=s+d;s<w;s++){const x=s<g?u[s]:255;e[f++]=128&x?c:h,e[f++]=64&x?c:h,e[f++]=32&x?c:h,e[f++]=16&x?c:h,e[f++]=8&x?c:h,e[f++]=4&x?c:h,e[f++]=2&x?c:h,e[f++]=1&x?c:h}if(p===0)continue;const b=s<g?u[s++]:255;for(let w=0;w<p;w++)e[f++]=b&1<<7-w?c:h}return{srcPos:s,destPos:f}}const Ee=16;class dm{constructor(s){this.canvasFactory=s,this.cache=Object.create(null)}getCanvas(s,e,i){let n;return this.cache[s]!==void 0?(n=this.cache[s],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[s]=n),n}delete(s){delete this.cache[s]}clear(){for(const s in this.cache){const e=this.cache[s];this.canvasFactory.destroy(e),delete this.cache[s]}}}function zl(u,s,e,i,n,r,a,l,h,c){const[d,p,g,f,m,b]=Ct(u);if(p===0&&g===0){const w=a*d+m,x=Math.round(w),_=l*f+b,S=Math.round(_),E=(a+h)*d+m,C=Math.abs(Math.round(E)-x)||1,T=(l+c)*f+b,k=Math.abs(Math.round(T)-S)||1;return u.setTransform(Math.sign(d),0,0,Math.sign(f),x,S),u.drawImage(s,e,i,n,r,0,0,C,k),u.setTransform(d,p,g,f,m,b),[C,k]}if(d===0&&f===0){const w=l*g+m,x=Math.round(w),_=a*p+b,S=Math.round(_),E=(l+c)*g+m,C=Math.abs(Math.round(E)-x)||1,T=(a+h)*p+b,k=Math.abs(Math.round(T)-S)||1;return u.setTransform(0,Math.sign(p),Math.sign(g),0,x,S),u.drawImage(s,e,i,n,r,0,0,k,C),u.setTransform(d,p,g,f,m,b),[k,C]}return u.drawImage(s,e,i,n,r,a,l,h,c),[Math.hypot(d,p)*h,Math.hypot(g,f)*c]}class hu{constructor(s,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=xu,this.textMatrixScale=1,this.fontMatrix=uc,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=Gl,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.patternStroke=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,s,e])}clone(){const s=Object.create(this);return s.clipBox=this.clipBox.slice(),s}setCurrentPoint(s,e){this.x=s,this.y=e}updatePathMinMax(s,e,i){[e,i]=W.applyTransform([e,i],s),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(s,e){const i=W.applyTransform(e,s),n=W.applyTransform(e.slice(2),s),r=W.applyTransform([e[0],e[3]],s),a=W.applyTransform([e[2],e[1]],s);this.minX=Math.min(this.minX,i[0],n[0],r[0],a[0]),this.minY=Math.min(this.minY,i[1],n[1],r[1],a[1]),this.maxX=Math.max(this.maxX,i[0],n[0],r[0],a[0]),this.maxY=Math.max(this.maxY,i[1],n[1],r[1],a[1])}updateScalingPathMinMax(s,e){W.scaleMinMax(s,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(s,e,i,n,r,a,l,h,c,d){const p=W.bezierBoundingBox(e,i,n,r,a,l,h,c,d);d||this.updateRectMinMax(s,p)}getPathBoundingBox(s=cn,e=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(s===kh){e||At("Stroke bounding box must include transform.");const n=W.singularValueDecompose2dScale(e),r=n[0]*this.lineWidth/2,a=n[1]*this.lineWidth/2;i[0]-=r,i[1]-=a,i[2]+=r,i[3]+=a}return i}updateClipFromPath(){const s=W.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(s||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(s){this.clipBox=s,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(s=cn,e=null){return W.intersect(this.clipBox,this.getPathBoundingBox(s,e))}}function cu(u,s){if(s instanceof ImageData){u.putImageData(s,0,0);return}const e=s.height,i=s.width,n=e%Ee,r=(e-n)/Ee,a=n===0?r:r+1,l=u.createImageData(i,Ee);let h,c=0;const d=s.data,p=l.data;let g,f,m,b;if(s.kind===ql.GRAYSCALE_1BPP){const w=d.byteLength,x=new Uint32Array(p.buffer,0,p.byteLength>>2),_=x.length,S=i+7>>3,E=4294967295,C=ge.isLittleEndian?4278190080:255;for(g=0;g<a;g++){for(m=g<r?Ee:n,h=0,f=0;f<m;f++){const T=w-c;let k=0;const I=T>S?i:8*T-7,P=-8&I;let N=0,O=0;for(;k<P;k+=8)O=d[c++],x[h++]=128&O?E:C,x[h++]=64&O?E:C,x[h++]=32&O?E:C,x[h++]=16&O?E:C,x[h++]=8&O?E:C,x[h++]=4&O?E:C,x[h++]=2&O?E:C,x[h++]=1&O?E:C;for(;k<I;k++)N===0&&(O=d[c++],N=128),x[h++]=O&N?E:C,N>>=1}for(;h<_;)x[h++]=0;u.putImageData(l,0,g*Ee)}}else if(s.kind===ql.RGBA_32BPP){for(f=0,b=i*Ee*4,g=0;g<r;g++)p.set(d.subarray(c,c+b)),c+=b,u.putImageData(l,0,f),f+=Ee;g<a&&(b=i*n*4,p.set(d.subarray(c,c+b)),u.putImageData(l,0,f))}else{if(s.kind!==ql.RGB_24BPP)throw new Error(`bad image kind: ${s.kind}`);for(m=Ee,b=i*m,g=0;g<a;g++){for(g>=r&&(m=n,b=i*m),h=0,f=b;f--;)p[h++]=d[c++],p[h++]=d[c++],p[h++]=d[c++],p[h++]=255;u.putImageData(l,0,g*Ee)}}}function du(u,s){if(s.bitmap){u.drawImage(s.bitmap,0,0);return}const e=s.height,i=s.width,n=e%Ee,r=(e-n)/Ee,a=n===0?r:r+1,l=u.createImageData(i,Ee);let h=0;const c=s.data,d=l.data;for(let p=0;p<a;p++){const g=p<r?Ee:n;({srcPos:h}=cm({src:c,srcPos:h,dest:d,width:i,height:g,nonBlackColor:0})),u.putImageData(l,0,p*Ee)}}function Ha(u,s){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of e)u[i]!==void 0&&(s[i]=u[i]);u.setLineDash!==void 0&&(s.setLineDash(u.getLineDash()),s.lineDashOffset=u.lineDashOffset)}function Ul(u){if(u.strokeStyle=u.fillStyle="#000000",u.fillRule="nonzero",u.globalAlpha=1,u.lineWidth=1,u.lineCap="butt",u.lineJoin="miter",u.miterLimit=10,u.globalCompositeOperation="source-over",u.font="10px sans-serif",u.setLineDash!==void 0&&(u.setLineDash([]),u.lineDashOffset=0),!le){const{filter:s}=u;s!=="none"&&s!==""&&(u.filter="none")}}function uu(u,s){if(s)return!0;const e=W.singularValueDecompose2dScale(u);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*Oa.PDF_TO_CSS_UNITS);return e[0]<=i&&e[1]<=i}const um=["butt","round","square"],pm=["miter","round","bevel"],fm={},pu={};var ms,Nc,Oc,Bc;const Hd=class Hd{constructor(s,e,i,n,r,{optionalContentConfig:a,markedContentStack:l=null},h,c){y(this,ms);
3this.ctx=s,this.current=new hu(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=n,this.filterFactory=r,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=a,this.cachedCanvases=new dm(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=h,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(s,e=null){return typeof s=="string"?s.startsWith("g_")?this.commonObjs.get(s):this.objs.get(s):e}beginDrawing({transform:s,viewport:e,transparency:i=!1,background:n=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=l,i){const h=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=h.canvas,this.ctx=h.context,this.ctx.save(),this.ctx.transform(...Ct(this.compositeCtx))}this.ctx.save(),Ul(this.ctx),s&&(this.ctx.transform(...s),this.outputScaleX=s[0],this.outputScaleY=s[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=Ct(this.ctx)}executeOperatorList(s,e,i,n){const r=s.argsArray,a=s.fnArray;let l=e||0;const h=r.length;if(h===l)return l;const c=h-l>10&&typeof i=="function",d=c?Date.now()+15:0;let p=0;const g=this.commonObjs,f=this.objs;let m;for(;;){if(n!==void 0&&l===n.nextBreakPoint)return n.breakIt(l,i),l;if(m=a[l],m!==es.dependency)this[m].apply(this,r[l]);else for(const b of r[l]){const w=b.startsWith("g_")?g:f;if(!w.has(b))return w.get(b,i),l}if(l++,l===h)return l;if(c&&++p>10){if(Date.now()>d)return i(),l;p=0}}}endDrawing(){A(this,ms,Nc).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const s of this._cachedBitmapsMap.values()){for(const e of s.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);s.clear()}this._cachedBitmapsMap.clear(),A(this,ms,Oc).call(this)}_scaleImage(s,e){var g,f;const i=(g=s.width)!=null?g:s.displayWidth,n=(f=s.height)!=null?f:s.displayHeight;let r,a,l=Math.max(Math.hypot(e[0],e[1]),1),h=Math.max(Math.hypot(e[2],e[3]),1),c=i,d=n,p="prescale1";for(;l>2&&c>1||h>2&&d>1;){let m=c,b=d;l>2&&c>1&&(m=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),l/=c/m),h>2&&d>1&&(b=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,h/=d/b),r=this.cachedCanvases.getCanvas(p,m,b),a=r.context,a.clearRect(0,0,m,b),a.drawImage(s,0,0,c,d,0,0,m,b),s=r.canvas,c=m,d=b,p=p==="prescale1"?"prescale2":"prescale1"}return{img:s,paintWidth:c,paintHeight:d}}_createMaskCanvas(s){const e=this.ctx,{width:i,height:n}=s,r=this.current.fillColor,a=this.current.patternFill,l=Ct(e);let h,c,d,p;if((s.bitmap||s.data)&&s.count>1){const I=s.bitmap||s.data.buffer;c=JSON.stringify(a?l:[l.slice(0,4),r]),h=this._cachedBitmapsMap.get(I),h||(h=new Map,this._cachedBitmapsMap.set(I,h));const P=h.get(c);if(P&&!a)return{canvas:P,offsetX:Math.round(Math.min(l[0],l[2])+l[4]),offsetY:Math.round(Math.min(l[1],l[3])+l[5])};d=P}d||(p=this.cachedCanvases.getCanvas("maskCanvas",i,n),du(p.context,s));let g=W.transform(l,[1/i,0,0,-1/n,0,0]);g=W.transform(g,[1,0,0,1,0,-n]);const[f,m,b,w]=W.getAxialAlignedBoundingBox([0,0,i,n],g),x=Math.round(b-f)||1,_=Math.round(w-m)||1,S=this.cachedCanvases.getCanvas("fillCanvas",x,_),E=S.context,C=f,T=m;E.translate(-C,-T),E.transform(...g),d||(d=this._scaleImage(p.canvas,vs(E)),d=d.img,h&&a&&h.set(c,d)),E.imageSmoothingEnabled=uu(Ct(E),s.interpolate),zl(E,d,0,0,d.width,d.height,0,0,i,n),E.globalCompositeOperation="source-in";const k=W.transform(vs(E),[1,0,0,1,-C,-T]);return E.fillStyle=a?r.getPattern(e,this,k,cn):r,E.fillRect(0,0,i,n),h&&!a&&(this.cachedCanvases.delete("fillCanvas"),h.set(c,S.canvas)),{canvas:S.canvas,offsetX:Math.round(C),offsetY:Math.round(T)}}setLineWidth(s){s!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=s,this.ctx.lineWidth=s}setLineCap(s){this.ctx.lineCap=um[s]}setLineJoin(s){this.ctx.lineJoin=pm[s]}setMiterLimit(s){this.ctx.miterLimit=s}setDash(s,e){const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(s),i.lineDashOffset=e)}
3setRenderingIntent(s){}setFlatness(s){}setGState(s){for(const[e,i]of s)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const s=this.inSMaskMode;this.current.activeSMask&&!s?this.beginSMaskMode():!this.current.activeSMask&&s&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const s=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(i,s,e);this.suspendedCtx=this.ctx,this.ctx=n.context;const r=this.ctx;r.setTransform(...Ct(this.suspendedCtx)),Ha(this.suspendedCtx,r),(function(l,h){if(l._removeMirroring)throw new Error("Context is already forwarding operations.");l.__originalSave=l.save,l.__originalRestore=l.restore,l.__originalRotate=l.rotate,l.__originalScale=l.scale,l.__originalTranslate=l.translate,l.__originalTransform=l.transform,l.__originalSetTransform=l.setTransform,l.__originalResetTransform=l.resetTransform,l.__originalClip=l.clip,l.__originalMoveTo=l.moveTo,l.__originalLineTo=l.lineTo,l.__originalBezierCurveTo=l.bezierCurveTo,l.__originalRect=l.rect,l.__originalClosePath=l.closePath,l.__originalBeginPath=l.beginPath,l._removeMirroring=()=>{l.save=l.__originalSave,l.restore=l.__originalRestore,l.rotate=l.__originalRotate,l.scale=l.__originalScale,l.translate=l.__originalTranslate,l.transform=l.__originalTransform,l.setTransform=l.__originalSetTransform,l.resetTransform=l.__originalResetTransform,l.clip=l.__originalClip,l.moveTo=l.__originalMoveTo,l.lineTo=l.__originalLineTo,l.bezierCurveTo=l.__originalBezierCurveTo,l.rect=l.__originalRect,l.closePath=l.__originalClosePath,l.beginPath=l.__originalBeginPath,delete l._removeMirroring},l.save=function(){h.save(),this.__originalSave()},l.restore=function(){h.restore(),this.__originalRestore()},l.translate=function(d,p){h.translate(d,p),this.__originalTranslate(d,p)},l.scale=function(d,p){h.scale(d,p),this.__originalScale(d,p)},l.transform=function(d,p,g,f,m,b){h.transform(d,p,g,f,m,b),this.__originalTransform(d,p,g,f,m,b)},l.setTransform=function(d,p,g,f,m,b){h.setTransform(d,p,g,f,m,b),this.__originalSetTransform(d,p,g,f,m,b)},l.resetTransform=function(){h.resetTransform(),this.__originalResetTransform()},l.rotate=function(d){h.rotate(d),this.__originalRotate(d)},l.clip=function(d){h.clip(d),this.__originalClip(d)},l.moveTo=function(c,d){h.moveTo(c,d),this.__originalMoveTo(c,d)},l.lineTo=function(c,d){h.lineTo(c,d),this.__originalLineTo(c,d)},l.bezierCurveTo=function(c,d,p,g,f,m){h.bezierCurveTo(c,d,p,g,f,m),this.__originalBezierCurveTo(c,d,p,g,f,m)},l.rect=function(c,d,p,g){h.rect(c,d,p,g),this.__originalRect(c,d,p,g)},l.closePath=function(){h.closePath(),this.__originalClosePath()},l.beginPath=function(){h.beginPath(),this.__originalBeginPath()}})(r,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(),Ha(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(s){if(!this.current.activeSMask)return;s?(s[0]=Math.floor(s[0]),s[1]=Math.floor(s[1]),s[2]=Math.ceil(s[2]),s[3]=Math.ceil(s[3])):s=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,s),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore(
3)}composeSMask(s,e,i,n){const r=n[0],a=n[1],l=n[2]-r,h=n[3]-a;l!==0&&h!==0&&(this.genericComposeSMask(e.context,i,l,h,e.subtype,e.backdrop,e.transferMap,r,a,e.offsetX,e.offsetY),s.save(),s.globalAlpha=1,s.globalCompositeOperation="source-over",s.setTransform(1,0,0,1,0,0),s.drawImage(i.canvas,0,0),s.restore())}genericComposeSMask(s,e,i,n,r,a,l,h,c,d,p){let g=s.canvas,f=h-d,m=c-p;if(a){const w=W.makeHexColor(...a);if(f<0||m<0||f+i>g.width||m+n>g.height){const x=this.cachedCanvases.getCanvas("maskExtension",i,n),_=x.context;_.drawImage(g,-f,-m),_.globalCompositeOperation="destination-atop",_.fillStyle=w,_.fillRect(0,0,i,n),_.globalCompositeOperation="source-over",g=x.canvas,f=m=0}else{s.save(),s.globalAlpha=1,s.setTransform(1,0,0,1,0,0);const x=new Path2D;x.rect(f,m,i,n),s.clip(x),s.globalCompositeOperation="destination-atop",s.fillStyle=w,s.fillRect(f,m,i,n),s.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),r==="Alpha"&&l?e.filter=this.filterFactory.addAlphaFilter(l):r==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(l));const b=new Path2D;b.rect(h,c,i,n),e.clip(b),e.globalCompositeOperation="destination-in",e.drawImage(g,f,m,i,n,h,c,i,n),e.restore()}save(){this.inSMaskMode?(Ha(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const s=this.current;this.stateStack.push(s),this.current=s.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Ha(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(s,e,i,n,r,a){this.ctx.transform(s,e,i,n,r,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(s,e,i){const n=this.ctx,r=this.current;let a,l,h=r.x,c=r.y;const d=Ct(n),p=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,g=p?i.slice(0):null;for(let f=0,m=0,b=s.length;f<b;f++)switch(0|s[f]){case es.rectangle:h=e[m++],c=e[m++];const w=e[m++],x=e[m++],_=h+w,S=c+x;n.moveTo(h,c),w===0||x===0?n.lineTo(_,S):(n.lineTo(_,c),n.lineTo(_,S),n.lineTo(h,S)),p||r.updateRectMinMax(d,[h,c,_,S]),n.closePath();break;case es.moveTo:h=e[m++],c=e[m++],n.moveTo(h,c),p||r.updatePathMinMax(d,h,c);break;case es.lineTo:h=e[m++],c=e[m++],n.lineTo(h,c),p||r.updatePathMinMax(d,h,c);break;case es.curveTo:a=h,l=c,h=e[m+4],c=e[m+5],n.bezierCurveTo(e[m],e[m+1],e[m+2],e[m+3],h,c),r.updateCurvePathMinMax(d,a,l,e[m],e[m+1],e[m+2],e[m+3],h,c,g),m+=6;break;case es.curveTo2:a=h,l=c,n.bezierCurveTo(h,c,e[m],e[m+1],e[m+2],e[m+3]),r.updateCurvePathMinMax(d,a,l,h,c,e[m],e[m+1],e[m+2],e[m+3],g),h=e[m+2],c=e[m+3],m+=4;break;case es.curveTo3:a=h,l=c,h=e[m+2],c=e[m+3],n.bezierCurveTo(e[m],e[m+1],h,c,h,c),r.updateCurvePathMinMax(d,a,l,e[m],e[m+1],h,c,h,c,g),m+=4;break;case es.closePath:n.closePath()}p&&r.updateScalingPathMinMax(d,g),r.setCurrentPoint(h,c)}closePath(){this.ctx.closePath()}stroke(s=!0){const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof i=="object"&&(i!=null&&i.getPattern)?(e.save(),e.strokeStyle=i.getPattern(e,this,vs(e),kh),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),s&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(s=!0){const e=this.ctx,i=this.current.fillColor;let n=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,vs(e),cn),n=!0);const r=this.current.getClippedPathBoundingBox();this.contentVisible&&r!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),s&&this.consumePath(r)}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=fm}eoClip(){this.pendingClip=pu}beginText(){this.current.textMatrix=xu,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const s=this.pendingTextPaths,e=this.ctx;if(s===void 0){e.beginPath();return}const i=new Path2D,n=e.getTransform().invertSelf();for(const{transform:r,x:a,y:l,fontSize:h,path:c}of s)i.addPath(c,new DOMMatrix(r).preMultiplySelf(n).translate(a,l).scale(h,-h));e.clip(i),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(s){this.current.charSpacing=s}setWordSpacing(s){this.current.wordSpacing=s}setHScale(s){this.current.textHScale=s/100}setLeading(s){this.current.leading=-s}setFont(s,e){var d;const i=this.commonObjs.get(s),n=this.current;if(!i)throw new Error(`Can't find font for ${s}`);if(n.fontMatrix=i.fontMatrix||uc,n.fontMatrix[0]!==0&&n.fontMatrix[3]!==0||J("Invalid font matrix for font "+s),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;const r=i.loadedName||"sans-serif",a=((d=i.systemFontInfo)==null?void 0:d.css)||`"${r}", ${i.fallbackName}`;let l="normal";i.black?l="900":i.bold&&(l="bold");const h=i.italic?"italic":"normal";let c=e;e<16?c=16:e>100&&(c=100),this.current.fontSizeScale=e/c,this.ctx.font=`${h} ${l} ${c}px ${a}`}setTextRenderingMode(s){this.current.textRenderingMode=s}setTextRise(s){this.current.textRise=s}moveText(s,e){this.current.x=this.current.lineX+=s,this.current.y=this.current.lineY+=e}setLeadingMoveText(s,e){this.setLeading(-e),this.moveText(s,e)}setTextMatrix(s,e,i,n,r,a){this.current.textMatrix=[s,e,i,n,r,a],this.current.textMatrixScale=Math.hypot(s,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(s,e,i,n,r){const a=this.ctx,l=this.current,h=l.font,c=l.textRenderingMode,d=l.fontSize/l.fontSizeScale,p=c&Xd,g=!!(c&Ag),f=l.patternFill&&!h.missingFile,m=l.patternStroke&&!h.missingFile;let b;if((h.disableFontFace||g||f||m)&&(b=h.getPathGenerator(this.commonObjs,s)),h.disableFontFace||f||m){if(a.save(),a.translate(e,i),a.scale(d,-d
3),p===Gl||p===Ba)if(n){const w=a.getTransform();a.setTransform(...n),a.fill(A(this,ms,Bc).call(this,b,w,n))}else a.fill(b);if(p===nc||p===Ba)if(r){const w=a.getTransform();a.setTransform(...r),a.stroke(A(this,ms,Bc).call(this,b,w,r))}else a.lineWidth/=d,a.stroke(b);a.restore()}else p!==Gl&&p!==Ba||a.fillText(s,e,i),p!==nc&&p!==Ba||a.strokeText(s,e,i);g&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ct(a),x:e,y:i,fontSize:d,path:b})}get isFontSubpixelAAEnabled(){const{context:s}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);s.scale(1.5,1),s.fillText("I",0,10);const e=s.getImageData(0,0,10,10).data;let i=!1;for(let n=3;n<e.length;n+=4)if(e[n]>0&&e[n]<255){i=!0;break}return ot(this,"isFontSubpixelAAEnabled",i)}showText(s){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(s);const n=e.fontSize;if(n===0)return;const r=this.ctx,a=e.fontSizeScale,l=e.charSpacing,h=e.wordSpacing,c=e.fontDirection,d=e.textHScale*c,p=s.length,g=i.vertical,f=g?1:-1,m=i.defaultVMetrics,b=n*e.fontMatrix[0],w=e.textRenderingMode===Gl&&!i.disableFontFace&&!e.patternFill;r.save(),r.transform(...e.textMatrix),r.translate(e.x,e.y+e.textRise),c>0?r.scale(d,-1):r.scale(d,1);let x,_;if(e.patternFill){r.save();const k=e.fillColor.getPattern(r,this,vs(r),cn);x=Ct(r),r.restore(),r.fillStyle=k}if(e.patternStroke){r.save();const k=e.strokeColor.getPattern(r,this,vs(r),kh);_=Ct(r),r.restore(),r.strokeStyle=k}let S=e.lineWidth;const E=e.textMatrixScale;if(E===0||S===0){const k=e.textRenderingMode&Xd;k!==nc&&k!==Ba||(S=this.getSinglePixelWidth())}else S/=E;if(a!==1&&(r.scale(a,a),S/=a),r.lineWidth=S,i.isInvalidPDFjsFont){const k=[];let I=0;for(const P of s)k.push(P.unicode),I+=P.width;r.fillText(k.join(""),0,0),e.x+=I*b*d,r.restore(),this.compose();return}let C,T=0;for(C=0;C<p;++C){const k=s[C];if(typeof k=="number"){T+=f*k*n/1e3;continue}let I=!1;const P=(k.isSpace?h:0)+l,N=k.fontChar,O=k.accent;let Y,K,V=k.width;if(g){const it=k.vmetric||m,rt=-(k.vmetric?it[1]:.5*V)*b,j=it[2]*b;V=it?-it[0]:V,Y=rt/a,K=(T+j)/a}else Y=T/a,K=0;if(i.remeasure&&V>0){const it=1e3*r.measureText(N).width/n*a;if(V<it&&this.isFontSubpixelAAEnabled){const rt=V/it;I=!0,r.save(),r.scale(rt,1),Y/=rt}else V!==it&&(Y+=(V-it)/2e3*n/a)}if(this.contentVisible&&(k.isInFont||i.missingFile)){if(w&&!O)r.fillText(N,Y,K);else if(this.paintChar(N,Y,K,x,_),O){const it=Y+n*O.offset.x/a,rt=K-n*O.offset.y/a;this.paintChar(O.fontChar,it,rt,x,_)}}T+=g?V*b-P*c:V*b+P*c,I&&r.restore()}g?e.y-=T:e.x+=T*d,r.restore(),this.compose()}showType3Text(s){const e=this.ctx,i=this.current,n=i.font,r=i.fontSize,a=i.fontDirection,l=n.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,d=i.textHScale*a,p=i.fontMatrix||uc,g=s.length;let f,m,b,w;if(i.textRenderingMode!==yg&&r!==0){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(d,a),f=0;f<g;++f){if(m=s[f],typeof m=="number"){w=l*m*r/1e3,this.ctx.translate(w,0),i.x+=w*d;continue}const x=(m.isSpace?c:0)+h,_=n.charProcOperatorList[m.operatorListId];if(!_){J(`Type3 character "${m.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=m,this.save(),e.scale(r,r),e.transform(...p),this.executeOperatorList(_),this.restore()),b=W.applyTransform([m.width,0],p)[0]*r+x,e.translate(b,0),i.x+=b*d}e.restore(),this.processingType3=null}}setCharWidth(s,e){}setCharWidthAndBounds(s,e,i,n,r,a){this.ctx.rect(i,n,r-i,a-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(s){let e;if(s[0]==="TilingPattern"){const i=s[1],n=this.baseTransform||Ct(this.ctx),r={createCanvasGraphics:a=>new Hd(a,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new Dd(s,i,this.ctx,r,n)}else e=this._getPattern(s[1],s[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(s,e,i){this.ctx.strokeStyle=this.current.strokeColor=W.makeHexColor(s,e,i),this.current.patternStroke=!1}
3setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(s,e,i){this.ctx.fillStyle=this.current.fillColor=W.makeHexColor(s,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(s,e=null){let i;return this.cachedPatterns.has(s)?i=this.cachedPatterns.get(s):(i=(function(r){switch(r[0]){case"RadialAxial":return new nm(r);case"Mesh":return new am(r);case"Dummy":return new om}throw new Error(`Unknown IR type: ${r[0]}`)})(this.getObject(s)),this.cachedPatterns.set(s,i)),e&&(i.matrix=e),i}shadingFill(s){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(s);e.fillStyle=i.getPattern(e,this,vs(e),ao);const n=vs(e);if(n){const{width:r,height:a}=e.canvas,[l,h,c,d]=W.getAxialAlignedBoundingBox([0,0,r,a],n);this.ctx.fillRect(l,h,c-l,d-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){At("Should not call beginInlineImage")}beginImageData(){At("Should not call beginImageData")}paintFormXObjectBegin(s,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),s&&this.transform(...s),this.baseTransform=Ct(this.ctx),e)){const i=e[2]-e[0],n=e[3]-e[1];this.ctx.rect(e[0],e[1],i,n),this.current.updateRectMinMax(Ct(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(s){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;s.isolated||Yh("TODO: Support non-isolated groups."),s.knockout&&J("Knockout groups not supported.");const i=Ct(e);if(s.matrix&&e.transform(...s.matrix),!s.bbox)throw new Error("Bounding box is required.");let n=W.getAxialAlignedBoundingBox(s.bbox,Ct(e));const r=[0,0,e.canvas.width,e.canvas.height];n=W.intersect(n,r)||[0,0,0,0];const a=Math.floor(n[0]),l=Math.floor(n[1]),h=Math.max(Math.ceil(n[2])-a,1),c=Math.max(Math.ceil(n[3])-l,1);this.current.startNewPathAndClipBox([0,0,h,c]);let d="groupAt"+this.groupLevel;s.smask&&(d+="_smask_"+this.smaskCounter++%2);const p=this.cachedCanvases.getCanvas(d,h,c),g=p.context;g.translate(-a,-l),g.transform(...i),s.smask?this.smaskStack.push({canvas:p.canvas,context:g,offsetX:a,offsetY:l,subtype:s.smask.subtype,backdrop:s.smask.backdrop,transferMap:s.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(a,l),e.save()),Ha(e,g),this.ctx=g,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(s){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,s.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const n=Ct(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...n);const r=W.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],n);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(r)}}beginAnnotation(s,e,i,n,r){if(A(this,ms,Nc).call(this),Ul(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const a=e[2]-e[0],l=e[3]-e[1];if(r&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=a,e[3]=l;const[h,c]=W.singularValueDecompose2dScale(Ct(this.ctx)),{viewportScale:d}=this,p=Math.ceil(a*this.outputScaleX*d),g=Math.ceil(l*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(p,g);const{canvas:f,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(s,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(h,0,0,-c,0,l*c),Ul(this.ctx)}else Ul(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],a,l),this.ctx.clip(),this.ctx.beginPath()}this.current=new hu(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...n)}
3endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),A(this,ms,Oc).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(s){if(!this.contentVisible)return;const e=s.count;(s=this.getObject(s.data,s)).count=e;const i=this.ctx,n=this.processingType3;if(n&&(n.compiled===void 0&&(n.compiled=(function(h){const{width:c,height:d}=h;if(c>1e3||d>1e3)return null;const p=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),g=c+1;let f,m,b,w=new Uint8Array(g*(d+1));const x=c+7&-8;let _=new Uint8Array(x*d),S=0;for(const k of h.data){let I=128;for(;I>0;)_[S++]=k&I?0:255,I>>=1}let E=0;for(S=0,_[S]!==0&&(w[0]=1,++E),m=1;m<c;m++)_[S]!==_[S+1]&&(w[m]=_[S]?2:1,++E),S++;for(_[S]!==0&&(w[m]=2,++E),f=1;f<d;f++){S=f*x,b=f*g,_[S-x]!==_[S]&&(w[b]=_[S]?1:8,++E);let k=(_[S]?4:0)+(_[S-x]?8:0);for(m=1;m<c;m++)k=(k>>2)+(_[S+1]?4:0)+(_[S-x+1]?8:0),p[k]&&(w[b+m]=p[k],++E),S++;if(_[S-x]!==_[S]&&(w[b+m]=_[S]?2:4,++E),E>1e3)return null}for(S=x*(d-1),b=f*g,_[S]!==0&&(w[b]=8,++E),m=1;m<c;m++)_[S]!==_[S+1]&&(w[b+m]=_[S]?4:8,++E),S++;if(_[S]!==0&&(w[b+m]=4,++E),E>1e3)return null;const C=new Int32Array([0,g,-1,0,-g,0,0,0,1]),T=new Path2D;for(f=0;E&&f<=d;f++){let k=f*g;const I=k+c;for(;k<I&&!w[k];)k++;if(k===I)continue;T.moveTo(k%g,f);const P=k;let N=w[k];do{const O=C[N];do k+=O;while(!w[k]);const Y=w[k];Y!==5&&Y!==10?(N=Y,w[k]=0):(N=Y&51*N>>4,w[k]&=N>>2|N<<2),T.lineTo(k%g,k/g|0),w[k]||--E}while(P!==k);--f}return _=null,w=null,function(k){k.save(),k.scale(1/c,-1/d),k.translate(0,-d),k.fill(T),k.beginPath(),k.restore()}})(s)),n.compiled)){n.compiled(i);return}const r=this._createMaskCanvas(s),a=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(a,r.offsetX,r.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(s,e,i=0,n=0,r,a){if(!this.contentVisible)return;s=this.getObject(s.data,s);const l=this.ctx;l.save();const h=Ct(l);l.transform(e,i,n,r,0,0);const c=this._createMaskCanvas(s);l.setTransform(1,0,0,1,c.offsetX-h[4],c.offsetY-h[5]);for(let d=0,p=a.length;d<p;d+=2){const g=W.transform(h,[e,i,n,r,a[d],a[d+1]]),[f,m]=W.applyTransform([0,0],g);l.drawImage(c.canvas,f,m)}l.restore(),this.compose()}paintImageMaskXObjectGroup(s){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const r of s){const{data:a,width:l,height:h,transform:c}=r,d=this.cachedCanvases.getCanvas("maskCanvas",l,h),p=d.context;p.save(),du(p,this.getObject(a,r)),p.globalCompositeOperation="source-in",p.fillStyle=n?i.getPattern(p,this,vs(e),cn):i,p.fillRect(0,0,l,h),p.restore(),e.save(),e.transform(...c),e.scale(1,-1),zl(e,d.canvas,0,0,l,h,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(s){if(!this.contentVisible)return;const e=this.getObject(s);e?this.paintInlineImageXObject(e):J("Dependent image isn't ready yet")}paintImageXObjectRepeat(s,e,i,n){if(!this.contentVisible)return;const r=this.getObject(s);if(!r){J("Dependent image isn't ready yet");return}const a=r.width,l=r.height,h=[];for(let c=0,d=n.length;c<d;c+=2)h.push({transform:[e,0,0,i,n[c],n[c+1]],x:0,y:0,w:a,h:l});this.paintInlineImageXObjectGroup(r,h)}applyTransferMapsToCanvas(s){return this.current.transferMaps!=="none"&&(s.filter=this.current.transferMaps,s.drawImage(s.canvas,0,0),s.filter="none"),s.canvas}applyTransferMapsToBitmap(s){if(this.current.transferMaps==="none")return s.bitmap;const{bitmap:e,width:i,height:n}=s,r=this.cachedCanvases.getCanvas("inlineImage",i,n),a=r.context;return a.filter=this.current.transferMaps,a.drawImage(e,0,0),a.filter="none",r.canvas}paintInlineImageXObject(s){if(!this.contentVisible)return;const e=s.width,i=s.height,n=this.ctx;if(this.save(),!le){const{filter:l}=n;l!=="none"&&l!==""&&(n.filter="none")}n.scale(1/e,-1/i);let r;if(s.bitmap)r=this.applyTransferMapsToBitmap(s);else if(typeof HTMLElement=="function"&&s instanceof HTMLElement||!s.data)r=s;else{const l=this.cachedCanvases.getCanvas("inlineImage",e,i).context;cu(l,s),r=this.applyTransferMapsToCanvas(l)}const a=this._scaleImage(r,vs(n));n.imageSmoothingEnabled=uu(Ct(n),s.interpolate),zl(n,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,e,i),this.compose(),this.restore(
3)}paintInlineImageXObjectGroup(s,e){if(!this.contentVisible)return;const i=this.ctx;let n;if(s.bitmap)n=s.bitmap;else{const r=s.width,a=s.height,l=this.cachedCanvases.getCanvas("inlineImage",r,a).context;cu(l,s),n=this.applyTransferMapsToCanvas(l)}for(const r of e)i.save(),i.transform(...r.transform),i.scale(1,-1),zl(i,n,r.x,r.y,r.w,r.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(s){}markPointProps(s,e){}beginMarkedContent(s){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(s,e){s==="OC"?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(s){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(s);const i=this.ctx;this.pendingClip&&(e||(this.pendingClip===pu?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const s=Ct(this.ctx);if(s[1]===0&&s[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(s[0]),Math.abs(s[3]));else{const e=Math.abs(s[0]*s[3]-s[2]*s[1]),i=Math.hypot(s[0],s[2]),n=Math.hypot(s[1],s[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:s}=this.current,{a:e,b:i,c:n,d:r}=this.ctx.getTransform();let a,l;if(i===0&&n===0){const h=Math.abs(e),c=Math.abs(r);if(h===c)if(s===0)a=l=1/h;else{const d=h*s;a=l=d<1?1/d:1}else if(s===0)a=1/h,l=1/c;else{const d=h*s,p=c*s;a=d<1?1/d:1,l=p<1?1/p:1}}else{const h=Math.abs(e*r-i*n),c=Math.hypot(e,i),d=Math.hypot(n,r);if(s===0)a=d/h,l=c/h;else{const p=s*h;a=d>p?d/p:1,l=c>p?c/p:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(s){const{ctx:e}=this,{lineWidth:i}=this.current,[n,r]=this.getScaleForStroking();if(e.lineWidth=i||1,n===1&&r===1){e.stroke();return}const a=e.getLineDash();if(s&&e.save(),e.scale(n,r),a.length>0){const l=Math.max(n,r);e.setLineDash(a.map((h=>h/l))),e.lineDashOffset/=l}e.stroke(),s&&e.restore()}isContentVisible(){for(let s=this.markedContentStack.length-1;s>=0;s--)if(!this.markedContentStack[s].visible)return!1;return!0}};ms=new WeakSet,Nc=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},Oc=function(){if(this.pageColors){const s=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(s!=="none"){const e=this.ctx.filter;this.ctx.filter=s,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},Bc=function(s,e,i){const n=new Path2D;return n.addPath(s,new DOMMatrix(i).invertSelf().multiplySelf(e)),n};let Mr=Hd;for(const u in es)Mr.prototype[u]!==void 0&&(Mr.prototype[es[u]]=Mr.prototype[u]);class an{static#t=null;static#e="";static get workerPort(){return this.#t}static set workerPort(s){if(!(typeof Worker<"u"&&s instanceof Worker)&&s!==null)throw new Error("Invalid `workerPort` type.");this.#t=s}static get workerSrc(){return this.#e}static set workerSrc(s){if(typeof s!="string")throw new Error("Invalid `workerSrc` type.");this.#e=s}}var Pn,Ho;class gm{constructor({parsedData:s,rawData:e}){y(this,Pn);y(this,Ho);v(this,Pn,s),v(this,Ho,e)}getRaw(){return o(this,Ho)}get(s){var e;return(e=o(this,Pn).get(s))!=null?e:null}getAll(){return Cd(o(this,Pn))}has(s){return o(this,Pn).has(s)}}Pn=new WeakMap,Ho=new WeakMap;const Ar=Symbol("INTERNAL");var jo,$o,zo,Xr;class mm{constructor(s,{name:e,intent:i,usage:n,rbGroups:r}){y(this,jo,!1);y(this,$o,!1);
3y(this,zo,!1);y(this,Xr,!0);v(this,jo,!!(s&Ed)),v(this,$o,!!(s&xh)),this.name=e,this.intent=i,this.usage=n,this.rbGroups=r}get visible(){if(o(this,zo))return o(this,Xr);if(!o(this,Xr))return!1;const{print:s,view:e}=this.usage;return o(this,jo)?(e==null?void 0:e.viewState)!=="OFF":!o(this,$o)||(s==null?void 0:s.printState)!=="OFF"}_setVisible(s,e,i=!1){s!==Ar&&At("Internal method `_setVisible` called."),v(this,zo,i),v(this,Xr,e)}}jo=new WeakMap,$o=new WeakMap,zo=new WeakMap,Xr=new WeakMap;var Li,mt,Yr,Kr,Uo,Hc;class vm{constructor(s,e=Ed){y(this,Uo);y(this,Li,null);y(this,mt,new Map);y(this,Yr,null);y(this,Kr,null);if(this.renderingIntent=e,this.name=null,this.creator=null,s!==null){this.name=s.name,this.creator=s.creator,v(this,Kr,s.order);for(const i of s.groups)o(this,mt).set(i.id,new mm(e,i));if(s.baseState==="OFF")for(const i of o(this,mt).values())i._setVisible(Ar,!1);for(const i of s.on)o(this,mt).get(i)._setVisible(Ar,!0);for(const i of s.off)o(this,mt).get(i)._setVisible(Ar,!1);v(this,Yr,this.getHash())}}isVisible(s){if(o(this,mt).size===0)return!0;if(!s)return Yh("Optional content group not defined."),!0;if(s.type==="OCG")return o(this,mt).has(s.id)?o(this,mt).get(s.id).visible:(J(`Optional content group not found: ${s.id}`),!0);if(s.type==="OCMD"){if(s.expression)return A(this,Uo,Hc).call(this,s.expression);if(!s.policy||s.policy==="AnyOn"){for(const e of s.ids){if(!o(this,mt).has(e))return J(`Optional content group not found: ${e}`),!0;if(o(this,mt).get(e).visible)return!0}return!1}if(s.policy==="AllOn"){for(const e of s.ids){if(!o(this,mt).has(e))return J(`Optional content group not found: ${e}`),!0;if(!o(this,mt).get(e).visible)return!1}return!0}if(s.policy==="AnyOff"){for(const e of s.ids){if(!o(this,mt).has(e))return J(`Optional content group not found: ${e}`),!0;if(!o(this,mt).get(e).visible)return!0}return!1}if(s.policy==="AllOff"){for(const e of s.ids){if(!o(this,mt).has(e))return J(`Optional content group not found: ${e}`),!0;if(o(this,mt).get(e).visible)return!1}return!0}return J(`Unknown optional content policy ${s.policy}.`),!0}return J(`Unknown group type ${s.type}.`),!0}setVisibility(s,e=!0,i=!0){var r;const n=o(this,mt).get(s);if(n){if(i&&e&&n.rbGroups.length)for(const a of n.rbGroups)for(const l of a)l!==s&&((r=o(this,mt).get(l))==null||r._setVisible(Ar,!1,!0));n._setVisible(Ar,!!e,!0),v(this,Li,null)}else J(`Optional content group not found: ${s}`)}setOCGState({state:s,preserveRB:e}){let i;for(const n of s){switch(n){case"ON":case"OFF":case"Toggle":i=n;continue}const r=o(this,mt).get(n);if(r)switch(i){case"ON":this.setVisibility(n,!0,e);break;case"OFF":this.setVisibility(n,!1,e);break;case"Toggle":this.setVisibility(n,!r.visible,e)}}v(this,Li,null)}get hasInitialVisibility(){return o(this,Yr)===null||this.getHash()===o(this,Yr)}getOrder(){return o(this,mt).size?o(this,Kr)?o(this,Kr).slice():[...o(this,mt).keys()]:null}getGroups(){return o(this,mt).size>0?Cd(o(this,mt)):null}getGroup(s){return o(this,mt).get(s)||null}getHash(){if(o(this,Li)!==null)return o(this,Li);const s=new ep;for(const[e,i]of o(this,mt))s.update(`${e}:${i.visible}`);return v(this,Li,s.hexdigest())}}Li=new WeakMap,mt=new WeakMap,Yr=new WeakMap,Kr=new WeakMap,Uo=new WeakSet,Hc=function(s){const e=s.length;if(e<2)return!0;const i=s[0];for(let n=1;n<e;n++){const r=s[n];let a;if(Array.isArray(r))a=A(this,Uo,Hc).call(this,r);else{if(!o(this,mt).has(r))return J(`Optional content group not found: ${r}`),!0;a=o(this,mt).get(r).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 i==="And"};class bm{constructor(s,{disableRange:e=!1,disableStream:i=!1}){Nt(s,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:r,progressiveDone:a,contentDispositionFilename:l}=s;if(this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=l,(r==null?void 0:r.length)>0){const h=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(h)}this._pdfDataRangeTransport=s,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],s.addRangeListener(((h,c)=>{this._onReceiveData({begin:h,chunk:c})})),s.addProgressListener(((h,c)=>{this._onProgress({loaded:h,total:c})})),s.addProgressiveReadListener((h=>{this._onReceiveData({chunk:h})})),s.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),s.transportReady()}_onReceiveData({begin:s,chunk:e}){const i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;s===void 0?this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i):Nt(this._rangeReaders.some((function(n){return n._begin!==s?!1:(n._enqueue(i),!0)})),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){var s,e;return(e=(s=this._fullRequestReader)==null?void 0:s._loaded)!=null?e:0}_onProgress(s){var e,i,n,r;s.total===void 0?(i=(e=this._rangeReaders[0])==null?void 0:e.onProgress)==null||i.call(e,{loaded:s.loaded}):(r=(n=this._fullRequestReader)==null?void 0:n.onProgress)==null||r.call(n,{loaded:s.loaded,total:s.total})}_onProgressiveDone(){var s;(s=this._fullRequestReader)==null||s.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(s){const e=this._rangeReaders.indexOf(s);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){Nt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const s=this._queuedChunks;return this._queuedChunks=null,new ym(this,s,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(s,e){if(e<=this._progressiveDataLength)return null;const i=new Am(this,s,e);return this._pdfDataRangeTransport.requestDataRange(s,e),this._rangeReaders.push(i),i}cancelAllRequests(s){var e;(e=this._fullRequestReader)==null||e.cancel(s);for(const i of this._rangeReaders.slice(0))i.cancel(s);this._pdfDataRangeTransport.abort()}}class ym{constructor(s,e,i=!1,n=null){this._stream=s,this._done=i||!1,this._filename=Rd(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const r of this._queuedChunks)this._loaded+=r.byteLength;
3this._requests=[],this._headersReady=Promise.resolve(),s._fullRequestReader=this,this.onProgress=null}_enqueue(s){this._done||(this._requests.length>0?this._requests.shift().resolve({value:s,done:!1}):this._queuedChunks.push(s),this._loaded+=s.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const s=Promise.withResolvers();return this._requests.push(s),s.promise}cancel(s){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 Am{constructor(s,e,i){this._stream=s,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(s){if(!this._done){if(this._requests.length===0)this._queuedChunk=s;else{this._requests.shift().resolve({value:s,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const s=Promise.withResolvers();return this._requests.push(s),s.promise}cancel(s){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function up(u,s){const e=new Headers;if(!u||!s||typeof s!="object")return e;for(const i in s){const n=s[i];n!==void 0&&e.append(i,n)}return e}function Zh(u){try{return new URL(u).origin}catch{}return null}function pp({responseHeaders:u,isHttp:s,rangeChunkSize:e,disableRange:i}){const n={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(u.get("Content-Length"),10);return!Number.isInteger(r)||(n.suggestedLength=r,r<=2*e)||i||!s||u.get("Accept-Ranges")!=="bytes"||(u.get("Content-Encoding")||"identity")!=="identity"||(n.allowRangeRequests=!0),n}function fp(u){const s=u.get("Content-Disposition");if(s){let e=(function(n){let r=!0,a=l("filename\\*","i").exec(n);if(a){a=a[1];let f=d(a);return f=unescape(f),f=p(f),f=g(f),c(f)}if(a=(function(m){const b=[];let w;const x=l("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(w=x.exec(m))!==null;){let[,S,E,C]=w;if(S=parseInt(S,10),S in b){if(S===0)break}else b[S]=[E,C]}const _=[];for(let S=0;S<b.length&&S in b;++S){let[E,C]=b[S];C=d(C),E&&(C=unescape(C),S===0&&(C=p(C))),_.push(C)}return _.join("")})(n),a)return c(g(a));if(a=l("filename","i").exec(n),a){a=a[1];let f=d(a);return f=g(f),c(f)}function l(f,m){return new RegExp("(?:^|;)\\s*"+f+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',m)}function h(f,m){if(f){if(!/^[\x00-\xFF]+$/.test(m))return m;try{const b=new TextDecoder(f,{fatal:!0}),w=Kh(m);m=b.decode(w),r=!1}catch{}}return m}function c(f){return r&&/[\x80-\xff]/.test(f)&&(f=h("utf-8",f),r&&(f=h("iso-8859-1",f))),f}function d(f){if(f.startsWith('"')){const m=f.slice(1).split('\\"');for(let b=0;b<m.length;++b){const w=m[b].indexOf('"');w!==-1&&(m[b]=m[b].slice(0,w),m.length=b+1),m[b]=m[b].replaceAll(/\\(.)/g,"$1")}f=m.join('"')}return f}function p(f){const m=f.indexOf("'");return m===-1?f:h(f.slice(0,m),f.slice(m+1).replace(/^[^']*'/,""))}function g(f){return!f.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(f)?f:f.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(m,b,w,x){if(w==="q"||w==="Q")return h(b,x=(x=x.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,(function(_,S){return String.fromCharCode(parseInt(S,16))})));try{x=atob(x)}catch{}return h(b,x)}))}return""})(s);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Rd(e))return e}return null}function tc(u,s){return u===404||u===0&&s.startsWith("file:")?new lo('Missing PDF "'+s+'".'):new _h(`Unexpected server response
3(${u}) while retrieving PDF "${s}".`,u)}function gp(u){return u===200||u===206}function mp(u,s,e){return{method:"GET",headers:u,signal:e.signal,mode:"cors",credentials:s?"include":"same-origin",redirect:"follow"}}function vp(u){return u instanceof Uint8Array?u.buffer:u instanceof ArrayBuffer?u:(J(`getArrayBuffer - unexpected data format: ${u}`),new Uint8Array(u).buffer)}class fu{_responseOrigin=null;constructor(s){this.source=s,this.isHttp=/^https?:/i.test(s.url),this.headers=up(this.isHttp,s.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var s,e;return(e=(s=this._fullRequestReader)==null?void 0:s._loaded)!=null?e:0}getFullReader(){return Nt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new wm(this),this._fullRequestReader}getRangeReader(s,e){if(e<=this._progressiveDataLength)return null;const i=new xm(this,s,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(s){var e;(e=this._fullRequestReader)==null||e.cancel(s);for(const i of this._rangeRequestReaders.slice(0))i.cancel(s)}}class wm{constructor(s){this._stream=s,this._reader=null,this._loaded=0,this._filename=null;const e=s.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;const i=new Headers(s.headers),n=e.url;fetch(n,mp(i,this._withCredentials,this._abortController)).then((r=>{if(s._responseOrigin=Zh(r.url),!gp(r.status))throw tc(r.status,n);this._reader=r.body.getReader(),this._headersCapability.resolve();const a=r.headers,{allowRangeRequests:l,suggestedLength:h}=pp({responseHeaders:a,isHttp:s.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=h||this._contentLength,this._filename=fp(a),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Zi("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(){var i;await this._headersCapability.promise;const{value:s,done:e}=await this._reader.read();return e?{value:s,done:e}:(this._loaded+=s.byteLength,(i=this.onProgress)==null||i.call(this,{loaded:this._loaded,total:this._contentLength}),{value:vp(s),done:!1})}cancel(s){var e;(e=this._reader)==null||e.cancel(s),this._abortController.abort()}}class xm{constructor(s,e,i){this._stream=s,this._reader=null,this._loaded=0;const n=s.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const r=new Headers(s.headers);r.append("Range",`bytes=${e}-${i-1}`);const a=n.url;fetch(a,mp(r,this._withCredentials,this._abortController)).then((l=>{const h=Zh(l.url);if(h!==s._responseOrigin)throw new Error(`Expected range response-origin "${h}" to match "${s._responseOrigin}".`);if(!gp(l.status))throw tc(l.status,a);this._readCapability.resolve(),this._reader=l.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var i;await this._readCapability.promise;const{value:s,done:e}=await this._reader.read();return e?{value:s,done:e}:(this._loaded+=s.byteLength,(i=this.onProgress)==null||i.call(this,{loaded:this._loaded}),{value:vp(s),done:!1})}cancel(s){var e;(e=this._reader)==null||e.cancel(s),this._abortController.abort()}}class _m{_responseOrigin=null;constructor({url:s,httpHeaders:e,withCredentials:i}){this.url=s,this.isHttp=/^https?:/i.test(s),this.headers=up(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}request(s){const e=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[r,a]of this.headers)e.setRequestHeader(r,a);return this.isHttp&&"begin"in s&&"end"in s?(e.setRequestHeader("Range",`bytes=${s.begin}-${s.end-1}`),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",Nt(s.onError,"Expected `onError` callback to be provided."),e.onerror=()=>{s.onError(e.status)},e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=s.onHeadersReceived,n.onDone=s.onDone,n.onError=s.onError,n.onProgress=s.onProgress,e.send(null),i}onProgress(s,e){var n;const i=this.pendingRequests[s];i&&((n=i.onProgress)==null||n.call(i,e))}onStateChange(s,e){const i=this.pendingRequests[s];if(!i)return;const n=i.xhr;if(n.readyState>
3=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),n.readyState!==4||!(s in this.pendingRequests))return;if(delete this.pendingRequests[s],n.status===0&&this.isHttp){i.onError(n.status);return}const r=n.status||200;if(!(r===200&&i.expectedStatus===206)&&r!==i.expectedStatus){i.onError(n.status);return}const a=(function(h){const c=h.response;return typeof c!="string"?c:Kh(c).buffer})(n);if(r===206){const l=n.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);h?i.onDone({begin:parseInt(h[1],10),chunk:a}):(J('Missing or invalid "Content-Range" header.'),i.onError(0))}else a?i.onDone({begin:0,chunk:a}):i.onError(n.status)}getRequestXhr(s){return this.pendingRequests[s].xhr}isPendingRequest(s){return s in this.pendingRequests}abortRequest(s){const e=this.pendingRequests[s].xhr;delete this.pendingRequests[s],e.abort()}}class Sm{constructor(s){this._source=s,this._manager=new _m(s),this._rangeChunkSize=s.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(s){const e=this._rangeRequestReaders.indexOf(s);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return Nt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Em(this._manager,this._source),this._fullRequestReader}getRangeReader(s,e){const i=new Cm(this._manager,s,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(s){var e;(e=this._fullRequestReader)==null||e.cancel(s);for(const i of this._rangeRequestReaders.slice(0))i.cancel(s)}}class Em{constructor(s,e){this._manager=s,this._url=e.url,this._fullRequestId=s.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=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 s=this._fullRequestId,e=this._manager.getRequestXhr(s);this._manager._responseOrigin=Zh(e.responseURL);const i=e.getAllResponseHeaders(),n=new Headers(i?i.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map((l=>{const[h,...c]=l.split(": ");return[h,c.join(": ")]})):[]),{allowRangeRequests:r,suggestedLength:a}=pp({responseHeaders:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=fp(n),this._isRangeSupported&&this._manager.abortRequest(s),this._headersCapability.resolve()}_onDone(s){if(s&&(this._requests.length>0?this._requests.shift().resolve({value:s.chunk,done:!1}):this._cachedChunks.push(s.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(s){this._storedError=tc(s,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(s){var e;(e=this.onProgress)==null||e.call(this,{loaded:s.loaded,total:s.lengthComputable?s.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._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const s=Promise.withResolvers();return this._requests.push(s),s.promise}cancel(s){this._done=!0,this._headersCapability.reject(s);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
3(this._fullRequestId),this._fullRequestReader=null}}class Cm{constructor(s,e,i){this._manager=s,this._url=s.url,this._requestId=s.request({begin:e,end:i,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){var e;const s=Zh((e=this._manager.getRequestXhr(this._requestId))==null?void 0:e.responseURL);s!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${s}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){var s;(s=this.onClosed)==null||s.call(this,this)}_onDone(s){const e=s.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):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(s){var e;(e=this._storedError)!=null||(this._storedError=tc(s,this._url));for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(s){var e;this.isStreamingSupported||((e=this.onProgress)==null||e.call(this,{loaded:s.loaded}))}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const s=Promise.withResolvers();return this._requests.push(s),s.promise}cancel(s){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(this._requestId),this._close()}}const km=/^[a-z][a-z0-9\-+.]+:/i;class Tm{constructor(s){this.source=s,this.url=(function(i){if(km.test(i))return new URL(i);const n=process.getBuiltinModule("url");return new URL(n.pathToFileURL(i))})(s.url),Nt(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var s,e;return(e=(s=this._fullRequestReader)==null?void 0:s._loaded)!=null?e:0}getFullReader(){return Nt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new Rm(this),this._fullRequestReader}getRangeReader(s,e){if(e<=this._progressiveDataLength)return null;const i=new Mm(this,s,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(s){var e;(e=this._fullRequestReader)==null||e.cancel(s);for(const i of this._rangeRequestReaders.slice(0))i.cancel(s)}}class Rm{constructor(s){this._url=s.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=s.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();const i=process.getBuiltinModule("fs");i.promises.lstat(this._url).then((n=>{this._contentLength=n.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()}),(n=>{n.code==="ENOENT"&&(n=new lo(`Missing PDF "${this._url}".`)),this._storedError=n,this._headersCapability.reject(n)}))}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(){var e;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const s=this._readableStream.read();return s===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=s.length,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(s).buffer,done:!1})}cancel(s){this._readableStream?this._readableStream.destroy(s):this._error(s)}_error(s){this._storedError=s,this._readCapability.resolve()}_setReadableStream(s){this._readableStream=s,s.on("readable",(()=>{this._readCapability.resolve()})),s.on("end",(()=>{s.destroy(),this._done=!0,this._readCapability.resolve()})),s.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Zi("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Mm{constructor(s,e,i){this._url=s.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const n=s.source;this._isStreamingSupported=!n.disableStream;const r=process.getBuiltinModule("fs");this._setReadableStream(r.createReadStream(this._url,{start:e,end:i-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const s=this._readableStream.read();return s===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=s.length,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded}),{value:new Uint8Array(s).buffer,done:!1})}cancel(s){this._readableStream?this._readableStream.destroy(s):this._error(s)}_error(s){this._storedError=s,this._readCapability.resolve()}_setReadableStream(s){this._readableStream=s,s.on("readable",(()=>{this._readCapability.resolve()})),s.on("end",(()=>{s.destroy(),this._done=!0,this._readCapability.resolve()})),s.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}const ye=30;var bu,Fi,_e,Vo,Go,In,Qs,qo,Wo,Dn,Qr,Jr,Ni,Zr,Xo,ta,Ln,Yo,Ko,Fn,Nn,Qo,Oi,ea,bi,bp,yp,jc,$e,sh,$c,Ap,wp;const Bt=class Bt{constructor({textContentSource:s,container:e,viewport:i}){y(this,bi);y(this,Fi,Promise.withResolvers());y(this,_e,null);y(this,Vo,!1);y(this,Go,!!((bu=globalThis.FontInspector)!=null&&bu.enabled));y(this,In,null);y(this,Qs,null);y(this,qo,0);y(this,Wo,0);y(this,Dn,null);y(this,Qr,null);y(this,Jr,0);y(this,Ni,0);y(this,Zr,Object.create(null));y(this,Xo,[]);y(this,ta,null);y(this,Ln,[]);y(this,Yo,new WeakMap);y(this,Ko,null);var h;if(s instanceof ReadableStream)v(this,ta,s);else{if(typeof s!="object")throw new Error('No "textContentSource" parameter specified.');v(this,ta,new ReadableStream({start(c){c.enqueue(s),c.close()}}))}v(this,_e,v(this,Qr,e)),v(this,Ni,i.scale*(globalThis.devicePixelRatio||1)),v(this,Jr,i.rotation),v(this,Qs,{div:null,properties:null,ctx:null});const{pageWidth:n,pageHeight:r,pageX:a,pageY:l}=i.rawDims;v(this,Ko,[1,0,0,-1,-a,l+r]),v(this,Wo,n),v(this,qo,r),A(h=Bt,$e,Ap).call(h),gr(e,i),o(this,Fi).promise.finally((()=>{o(Bt,ea).delete(this),v(this,Qs,null),v(this,Zr,null)})).catch((()=>{}))}static get fontFamilyMap(){const{isWindows:s,isFirefox:e}=ge.platform;return ot(this,"fontFamilyMap",new Map([["sans-serif",(s&&e?"Calibri, ":"")+"sans-serif"],["monospace",(s&&e?"Lucida Console, ":"")+"monospace"]]))}render(){const s=()=>{o(this,Dn).read().then((({value:e,done:i})=>{var n;i?o(this,Fi).resolve():((n=o(this,In))!=null||v(this,In,e.lang),Object.assign(o(this,Zr),e.styles),A(this,bi,bp).call(this,e.items),s())}),o(this,Fi).reject)};return v(this,Dn,o(this,ta).getReader()),o(Bt,ea).add(this),s(),o(this,Fi).promise}update({viewport:s,onBefore:e=null}){var r;const i=s.scale*(globalThis.devicePixelRatio||1),n=s.rotation;
3if(n!==o(this,Jr)&&(e==null||e(),v(this,Jr,n),gr(o(this,Qr),{rotation:n})),i!==o(this,Ni)){e==null||e(),v(this,Ni,i);const a={div:null,properties:null,ctx:A(r=Bt,$e,sh).call(r,o(this,In))};for(const l of o(this,Ln))a.properties=o(this,Yo).get(l),a.div=l,A(this,bi,jc).call(this,a)}}cancel(){var e;const s=new Zi("TextLayer task cancelled.");(e=o(this,Dn))==null||e.cancel(s).catch((()=>{})),v(this,Dn,null),o(this,Fi).reject(s)}get textDivs(){return o(this,Ln)}get textContentItemsStr(){return o(this,Xo)}static cleanup(){if(!(o(this,ea).size>0)){o(this,Fn).clear();for(const{canvas:s}of o(this,Nn).values())s.remove();o(this,Nn).clear()}}};Fi=new WeakMap,_e=new WeakMap,Vo=new WeakMap,Go=new WeakMap,In=new WeakMap,Qs=new WeakMap,qo=new WeakMap,Wo=new WeakMap,Dn=new WeakMap,Qr=new WeakMap,Jr=new WeakMap,Ni=new WeakMap,Zr=new WeakMap,Xo=new WeakMap,ta=new WeakMap,Ln=new WeakMap,Yo=new WeakMap,Ko=new WeakMap,Fn=new WeakMap,Nn=new WeakMap,Qo=new WeakMap,Oi=new WeakMap,ea=new WeakMap,bi=new WeakSet,bp=function(s){var n,r,a;if(o(this,Vo))return;(a=(r=o(this,Qs)).ctx)!=null||(r.ctx=A(n=Bt,$e,sh).call(n,o(this,In)));const e=o(this,Ln),i=o(this,Xo);for(const l of s){if(e.length>1e5){J("Ignoring additional textDivs for performance reasons."),v(this,Vo,!0);return}if(l.str!==void 0)i.push(l.str),A(this,bi,yp).call(this,l);else if(l.type==="beginMarkedContentProps"||l.type==="beginMarkedContent"){const h=o(this,_e);v(this,_e,document.createElement("span")),o(this,_e).classList.add("markedContent"),l.id!==null&&o(this,_e).setAttribute("id",`${l.id}`),h.append(o(this,_e))}else l.type==="endMarkedContent"&&v(this,_e,o(this,_e).parentNode)}},yp=function(s){var b;const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:s.str!=="",hasEOL:s.hasEOL,fontSize:0};o(this,Ln).push(e);const n=W.transform(o(this,Ko),s.transform);let r=Math.atan2(n[1],n[0]);const a=o(this,Zr)[s.fontName];a.vertical&&(r+=Math.PI/2);let l=o(this,Go)&&a.fontSubstitution||a.fontFamily;l=Bt.fontFamilyMap.get(l)||l;const h=Math.hypot(n[2],n[3]),c=h*A(b=Bt,$e,wp).call(b,l,o(this,In));let d,p;r===0?(d=n[4],p=n[5]-c):(d=n[4]+c*Math.sin(r),p=n[5]-c*Math.cos(r));const g="calc(var(--scale-factor)*",f=e.style;o(this,_e)===o(this,Qr)?(f.left=`${(100*d/o(this,Wo)).toFixed(2)}%`,f.top=`${(100*p/o(this,qo)).toFixed(2)}%`):(f.left=`${g}${d.toFixed(2)}px)`,f.top=`${g}${p.toFixed(2)}px)`),f.fontSize=`${g}${(o(Bt,Oi)*h).toFixed(2)}px)`,f.fontFamily=l,i.fontSize=h,e.setAttribute("role","presentation"),e.textContent=s.str,e.dir=s.dir,o(this,Go)&&(e.dataset.fontName=a.fontSubstitutionLoadedName||s.fontName),r!==0&&(i.angle=r*(180/Math.PI));let m=!1;if(s.str.length>1)m=!0;else if(s.str!==" "&&s.transform[0]!==s.transform[3]){const w=Math.abs(s.transform[0]),x=Math.abs(s.transform[3]);w!==x&&Math.max(w,x)/Math.min(w,x)>1.5&&(m=!0)}if(m&&(i.canvasWidth=a.vertical?s.height:s.width),o(this,Yo).set(e,i),o(this,Qs).div=e,o(this,Qs).properties=i,A(this,bi,jc).call(this,o(this,Qs)),i.hasText&&o(this,_e).append(e),i.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),o(this,_e).append(w)}},jc=function(s){var l;const{div:e,properties:i,ctx:n}=s,{style:r}=e;let a="";if(o(Bt,Oi)>1&&(a=`scale(${1/o(Bt,Oi)})`),i.canvasWidth!==0&&i.hasText){const{fontFamily:h}=r,{canvasWidth:c,fontSize:d}=i;A(l=Bt,$e,$c).call(l,n,d*o(this,Ni),h);const{width:p}=n.measureText(e.textContent);p>0&&(a=`scaleX(${c*o(this,Ni)/p}) ${a}`)}i.angle!==0&&(a=`rotate(${i.angle}deg) ${a}`),a.length>0&&(r.transform=a)},$e=new WeakSet,sh=function(s=null){let e=o(this,Nn).get(s||(s=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=s,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),o(this,Nn).set(s,e),o(this,Qo).set(e,{size:0,family:""})}return e},$c=function(s,e,i){const n=o(this,Qo).get(s);(e!==n.size||i!==n.family)&&(s.font=`${e}px ${i}`,n.size=e,n.family=i)},Ap=function(){if(o(this,Oi)!==null)return;const s=document.createElement("div");s.style.opacity=0,s.style.lineHeight=1,s.style.fontSize="1px",s.style.position="absolute",s.textContent="X",document.body.append(s),v(this,Oi,s.getBoundingClientRect().height),s.remove()},wp=function(s,e){const i=o(this,Fn).get(s);if(i)return i;const n=A(this,$e,sh).call(this,e);n.canvas.width=n.canvas.height=ye,A(this,$e,$c).call(this,n,ye,s);const r=n.measureText("");let a=r.fontBoundingBoxAscent,l=Math.abs(r.fontBoundingBoxDescent);if(a){const d=a/(a+l);return o(this,Fn).set(s,d),n.canvas.width=n.canvas.height=0,d}n.strokeStyle="red",n.clearRect(0,0,ye,ye),n.strokeText("g",0,0);let h=n.getImageData(0,0,ye,ye).data;l=0;for(let d=h.length-1-3;d>=0;d-=4)if(h[d]>0){l=Math.ceil(d/4/ye);break}n.clearRect(0,0,ye,ye),n.strokeText("A",0,ye),h=n.getImageData(0,0,ye,ye).data,a=0;for(let d=0,p=h.length;d<p;d+=4)if(h[d]>0){a=ye-Math.floor(d/4/ye);break}n.canvas.width=n.canvas.height=0;const c=a?a/(a+l):.8;return o(this,Fn).set(s,c),c},y(Bt,$e),y(Bt,Fn,new Map),y(Bt,Nn,new Map),y(Bt,Qo,new WeakMap),y(Bt,Oi,null),y(Bt,ea,new Set);let ho=Bt;class co{static textContent(s){const e=[],i={items:e,styles:Object.create(null)};return(function n(r){var h;if(!r)return;let a=null;const l=r.name;if(l==="#text")a=r.value;else{if(!co.shouldBuildText(l))return;(h=r==null?void 0:r.attributes)!=null&&h.textContent?a=r.attributes.textContent:r.value&&(
3a=r.value)}if(a!==null&&e.push({str:a}),r.children)for(const c of r.children)n(c)})(s),i}static shouldBuildText(s){return!(s==="textarea"||s==="input"||s==="option"||s==="select")}}const Pm=65536,Im=le?class extends ou{_createCanvas(s,e){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(s,e)}}:class extends ou{constructor({ownerDocument:s=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=s}_createCanvas(s,e){const i=this._document.createElement("canvas");return i.width=s,i.height=e,i}},Dm=le?class extends op{async _fetch(s){return dp(s)}}:lp;var On,sa,Js,Zs,re,Bn,Hn,B,se,Ya,wr,ih,xr,xp,zc,_r,Ka,Qa,Uc,Ja,yu;const Lm=le?class extends lu{}:(yu=class extends lu{constructor({docId:e,ownerDocument:i=globalThis.document}){super();y(this,B);y(this,On);y(this,sa);y(this,Js);y(this,Zs);y(this,re);y(this,Bn);y(this,Hn,0);v(this,Zs,e),v(this,re,i)}addFilter(e){if(!e)return"none";let i=o(this,B,se).get(e);if(i)return i;const[n,r,a]=A(this,B,ih).call(this,e),l=e.length===1?n:`${n}${r}${a}`;if(i=o(this,B,se).get(l),i)return o(this,B,se).set(e,i),i;const h=`g_${o(this,Zs)}_transfer_map_${be(this,Hn)._++}`,c=A(this,B,xr).call(this,h);o(this,B,se).set(e,c),o(this,B,se).set(l,c);const d=A(this,B,_r).call(this,h);return A(this,B,Qa).call(this,n,r,a,d),c}addHCMFilter(e,i){var m;const n=`${e}-${i}`,r="base";let a=o(this,B,Ya).get(r);if((a==null?void 0:a.key)===n||(a?((m=a.filter)==null||m.remove(),a.key=n,a.url="none",a.filter=null):(a={key:n,url:"none",filter:null},o(this,B,Ya).set(r,a)),!e||!i))return a.url;const l=A(this,B,Ja).call(this,e);e=W.makeHexColor(...l);const h=A(this,B,Ja).call(this,i);if(i=W.makeHexColor(...h),o(this,B,wr).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return a.url;const c=new Array(256);for(let b=0;b<=255;b++){const w=b/255;c[b]=w<=.03928?w/12.92:((w+.055)/1.055)**2.4}const d=c.join(","),p=`g_${o(this,Zs)}_hcm_filter`,g=a.filter=A(this,B,_r).call(this,p);A(this,B,Qa).call(this,d,d,d,g),A(this,B,zc).call(this,g);const f=(b,w)=>{const x=l[b]/255,_=h[b]/255,S=new Array(w+1);for(let E=0;E<=w;E++)S[E]=x+E/w*(_-x);return S.join(",")};return A(this,B,Qa).call(this,f(0,5),f(1,5),f(2,5),g),a.url=A(this,B,xr).call(this,p),a.url}addAlphaFilter(e){let i=o(this,B,se).get(e);if(i)return i;const[n]=A(this,B,ih).call(this,[e]),r=`alpha_${n}`;if(i=o(this,B,se).get(r),i)return o(this,B,se).set(e,i),i;const a=`g_${o(this,Zs)}_alpha_map_${be(this,Hn)._++}`,l=A(this,B,xr).call(this,a);o(this,B,se).set(e,l),o(this,B,se).set(r,l);const h=A(this,B,_r).call(this,a);return A(this,B,Uc).call(this,n,h),l}addLuminosityFilter(e){let i,n,r=o(this,B,se).get(e||"luminosity");if(r)return r;if(e?([i]=A(this,B,ih).call(this,[e]),n=`luminosity_${i}`):n="luminosity",r=o(this,B,se).get(n),r)return o(this,B,se).set(e,r),r;const a=`g_${o(this,Zs)}_luminosity_map_${be(this,Hn)._++}`,l=A(this,B,xr).call(this,a);o(this,B,se).set(e,l),o(this,B,se).set(n,l);const h=A(this,B,_r).call(this,a);return A(this,B,xp).call(this,h),e&&A(this,B,Uc).call(this,i,h),l}addHighlightHCMFilter(e,i,n,r,a){var _;const l=`${i}-${n}-${r}-${a}`;let h=o(this,B,Ya).get(e);if((h==null?void 0:h.key)===l||(h?((_=h.filter)==null||_.remove(),h.key=l,h.url="none",h.filter=null):(h={key:l,url:"none",filter:null},o(this,B,Ya).set(e,h)),!i||!n))return h.url;const[c,d]=[i,n].map(A(this,B,Ja).bind(this));let p=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),g=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[f,m]=[r,a].map(A(this,B,Ja).bind(this));g<p&&([p,g,f,m]=[g,p,m,f]),o(this,B,wr).style.color="";const b=(S,E,C)=>{const T=new Array(256),k=(g-p)/C,I=S/255,P=(E-S)/(255*C);let N=0;for(let O=0;O<=C;O++){const Y=Math.round(p+O*k),K=I+O*P;for(let V=N;V<=Y;V++)T[V]=K;N=Y+1}for(let O=N;O<256;O++)T[O]=T[N-1];return T.join(",")},w=`g_${o(this,Zs)}_hcm_${e}_filter`,x=h.filter=A(this,B,_r).call(this,w);return A(this,B,zc).call(this,x),A(this,B,Qa).call(this,b(f[0],m[0],5),b(f[1],m[1],5),b(f[2],m[2],5),x),h.url=A(this,B,xr).call(this,w),h.url}destroy(e=!1){var i,n,r,a;(!e||!((i=o(this,Bn))!=null&&i.size))&&((n=o(this,Js))==null||n.parentNode.parentNode.remove(),v(this,Js,null),(r=o(this,sa))==null||r.clear(),v(this,sa,null),(a=o(this,Bn))==null||a.clear(),v(this,Bn,null),v(this,Hn,0))}},On=new WeakMap,sa=new WeakMap,Js=new WeakMap,Zs=new WeakMap,re=new WeakMap,Bn=new WeakMap,Hn=new WeakMap,B=new WeakSet,se=function(){return o(this,sa)||v(this,sa,new Map)},Ya=function(){return o(this,Bn)||v(this,Bn,new Map)},wr=function(){if(!o(this,Js)){const e=o(this,re).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const n=o(this,re).createElementNS(Bs,"svg");n.setAttribute("width",0),n.setAttribute("height",0),v(this,Js,o(this,re).createElementNS(Bs,"def
3s")),e.append(n),n.append(o(this,Js)),o(this,re).body.append(e)}return o(this,Js)},ih=function(e){if(e.length===1){const c=e[0],d=new Array(256);for(let g=0;g<256;g++)d[g]=c[g]/255;const p=d.join(",");return[p,p,p]}const[i,n,r]=e,a=new Array(256),l=new Array(256),h=new Array(256);for(let c=0;c<256;c++)a[c]=i[c]/255,l[c]=n[c]/255,h[c]=r[c]/255;return[a.join(","),l.join(","),h.join(",")]},xr=function(e){if(o(this,On)===void 0){v(this,On,"");const i=o(this,re).URL;i!==o(this,re).baseURI&&(Jh(i)?J('#createUrl: ignore "data:"-URL for performance reasons.'):v(this,On,i.split("#",1)[0]))}return`url(${o(this,On)}#${e})`},xp=function(e){const i=o(this,re).createElementNS(Bs,"feColorMatrix");i.setAttribute("type","matrix"),i.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(i)},zc=function(e){const i=o(this,re).createElementNS(Bs,"feColorMatrix");i.setAttribute("type","matrix"),i.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"),e.append(i)},_r=function(e){const i=o(this,re).createElementNS(Bs,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),o(this,B,wr).append(i),i},Ka=function(e,i,n){const r=o(this,re).createElementNS(Bs,i);r.setAttribute("type","discrete"),r.setAttribute("tableValues",n),e.append(r)},Qa=function(e,i,n,r){const a=o(this,re).createElementNS(Bs,"feComponentTransfer");r.append(a),A(this,B,Ka).call(this,a,"feFuncR",e),A(this,B,Ka).call(this,a,"feFuncG",i),A(this,B,Ka).call(this,a,"feFuncB",n)},Uc=function(e,i){const n=o(this,re).createElementNS(Bs,"feComponentTransfer");i.append(n),A(this,B,Ka).call(this,n,"feFuncA",e)},Ja=function(e){return o(this,B,wr).style.color=e,gc(getComputedStyle(o(this,B,wr)).getPropertyValue("color"))},yu),Fm=le?class extends hp{async _fetch(s){return dp(s)}}:cp;function Nm(u={}){var D,L;typeof u=="string"||u instanceof URL?u={url:u}:(u instanceof ArrayBuffer||ArrayBuffer.isView(u))&&(u={data:u});const s=new Ld,{docId:e}=s,i=u.url?(function(G){if(G instanceof URL)return G.href;try{return new URL(G,window.location).href}catch{if(le&&typeof G=="string")return G}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")})(u.url):null,n=u.data?(function(G){if(le&&typeof Buffer<"u"&&G instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(G instanceof Uint8Array&&G.byteLength===G.buffer.byteLength)return G;if(typeof G=="string")return Kh(G);if(G instanceof ArrayBuffer||ArrayBuffer.isView(G)||typeof G=="object"&&!isNaN(G==null?void 0:G.length))return new Uint8Array(G);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")})(u.data):null,r=u.httpHeaders||null,a=u.withCredentials===!0,l=(D=u.password)!=null?D:null,h=u.range instanceof _p?u.range:null,c=Number.isInteger(u.rangeChunkSize)&&u.rangeChunkSize>0?u.rangeChunkSize:Pm;let d=u.worker instanceof Pr?u.worker:null;const p=u.verbosity,g=typeof u.docBaseUrl!="string"||Jh(u.docBaseUrl)?null:u.docBaseUrl,f=typeof u.cMapUrl=="string"?u.cMapUrl:null,m=u.cMapPacked!==!1,b=u.CMapReaderFactory||Dm,w=typeof u.standardFontDataUrl=="string"?u.standardFontDataUrl:null,x=u.StandardFontDataFactory||Fm,_=u.stopAtErrors!==!0,S=Number.isInteger(u.maxImageSize)&&u.maxImageSize>-1?u.maxImageSize:-1,E=u.isEvalSupported!==!1,C=typeof u.isOffscreenCanvasSupported=="boolean"?u.isOffscreenCanvasSupported:!le,T=typeof u.isImageDecoderSupported=="boolean"?u.isImageDecoderSupported:!le&&(ge.platform.isFirefox||!globalThis.chrome),k=Number.isInteger(u.canvasMaxAreaInBytes)?u.canvasMaxAreaInBytes:-1,I=typeof u.disableFontFace=="boolean"?u.disableFontFace:le,P=u.fontExtraProperties===!0,N=u.enableXfa===!0,O=u.ownerDocument||globalThis.document,Y=u.disableRange===!0,K=u.disableStream===!0,V=u.disableAutoFetch===!0,it=u.pdfBug===!0,rt=u.CanvasFactory||Im,j=u.FilterFactory||Lm,H=u.enableHWA===!0,xt=h?h.length:(L=u.length)!=null?L:NaN,vt=typeof u.useSystemFonts=="boolean"?u.useSystemFonts:!le&&!I,Yt=typeof u.useWorkerFetch=="boolean"?u.useWorkerFetch:b===lp&&x===cp&&f&&w&&Va(f,document.baseURI)&&Va(w,document.baseURI);Vg(p);const ut={canvasFactory:new rt({ownerDocument:O,enableHWA:H}),filterFactory:new j({docId:e,ownerDocument:O}),cMapReaderFactory:Yt?null:new b({baseUrl:f,isCompressed:m}),standardFontDataFactory:Yt?null:new x({baseUrl:w})};if(!d){const $={verbosity:p,port:an.workerPort};d=$.port?Pr.fromPort($):new Pr($),s._worker=d}const R={docId:e,apiVersion:"4.10.38",data:n,password:l,disableAutoFetch:V,rangeChunkSize:c,length:xt,docBaseUrl:g,enableXfa:N,evaluatorOptions:{maxImageSize:S,disableFontFace:I,ignoreErrors:_,isEvalSupported:E,isOffscreenCanvasSupported:C,isImageDecoderSupported:T,canvasMaxAreaInBytes:k,fontExtraProperties:P,useSystemFonts:vt,cMapUrl:Yt?f:null,standardFontDataUrl:Yt?w:null}},M={disableFontFace:I,fontExtraProperties:P,ownerDocument:O,pdfBug:it,styleElement:null,loadingParams:{disableAutoFetch:V,enableXfa:N}};return d.promise.then((function(){if(s.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");
3const $=d.messageHandler.sendWithPromise("GetDocRequest",R,n?[n.buffer]:null);let G;if(h)G=new bm(h,{disableRange:Y,disableStream:K});else if(!n){if(!i)throw new Error("getDocument - no `url` parameter provided.");let _t;if(le)if(Va(i)){if(typeof fetch>"u"||typeof Response>"u"||!("body"in Response.prototype))throw new Error("getDocument - the Fetch API was disabled in Node.js, see `--no-experimental-fetch`.");_t=fu}else _t=Tm;else _t=Va(i)?fu:Sm;G=new _t({url:i,length:xt,httpHeaders:r,withCredentials:a,rangeChunkSize:c,disableRange:Y,disableStream:K})}return $.then((_t=>{if(s.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const ft=new Xa(e,_t,d.port),zt=new jm(ft,s,G,M,ut);s._transport=zt,ft.send("Ready",null)}))})).catch(s._capability.reject),s}function gu(u){return typeof u=="object"&&Number.isInteger(u==null?void 0:u.num)&&u.num>=0&&Number.isInteger(u==null?void 0:u.gen)&&u.gen>=0}class Ld{static#t=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+Ld.#t++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var s,e,i,n;this.destroyed=!0;try{(s=this._worker)!=null&&s.port&&(this._worker._pendingDestroy=!0),await((e=this._transport)==null?void 0:e.destroy())}catch(r){throw(i=this._worker)!=null&&i.port&&delete this._worker._pendingDestroy,r}this._transport=null,(n=this._worker)==null||n.destroy(),this._worker=null}}class _p{constructor(s,e,i=!1,n=null){this.length=s,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(s){this._rangeListeners.push(s)}addProgressListener(s){this._progressListeners.push(s)}addProgressiveReadListener(s){this._progressiveReadListeners.push(s)}addProgressiveDoneListener(s){this._progressiveDoneListeners.push(s)}onDataRange(s,e){for(const i of this._rangeListeners)i(s,e)}onDataProgress(s,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(s,e)}))}onDataProgressiveRead(s){this._readyCapability.promise.then((()=>{for(const e of this._progressiveReadListeners)e(s)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const s of this._progressiveDoneListeners)s()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(s,e){At("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Om{constructor(s,e){this._pdfInfo=s,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return ot(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(s){return this._transport.getPage(s)}getPageIndex(s){return this._transport.getPageIndex(s)}getDestinations(){return this._transport.getDestinations()}getDestination(s){return this._transport.getDestination(s)}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:s="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(s);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(s=!1){return this._transport.startCleanup(s||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(s){return this._transport.cachedPageNumber(s)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Bi,ti,Ke,Sr,nh;class Bm{constructor(s,e,i,n=!1){y(this,Ke);y(this,Bi,null);y(this,ti,!1);this._pageIndex=s,this._pageInfo=e,this._transport=i,this._stats=n?new Qd:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new Sp,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:s,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}={}){return new Ll({viewBox:this.view,userUnit:this.userUnit,scale:s,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}getAnnotations({intent:s="display"}={}){const{renderingIntent:e}
3=this._transport.getRenderingIntent(s);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return ot(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var s;return((s=this._transport._htmlForXfa)==null?void 0:s.children[this._pageIndex])||null}render({canvasContext:s,viewport:e,intent:i="display",annotationMode:n=wi.ENABLE,transform:r=null,background:a=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:c=null,printAnnotationStorage:d=null,isEditing:p=!1}){var E,C;(E=this._stats)==null||E.time("Overall");const g=this._transport.getRenderingIntent(i,n,d,p),{renderingIntent:f,cacheKey:m}=g;v(this,ti,!1),A(this,Ke,nh).call(this),l||(l=this._transport.getOptionalContentConfig(f));let b=this._intentStates.get(m);b||(b=Object.create(null),this._intentStates.set(m,b)),b.streamReaderCancelTimeout&&(clearTimeout(b.streamReaderCancelTimeout),b.streamReaderCancelTimeout=null);const w=!!(f&xh);b.displayReadyCapability||(b.displayReadyCapability=Promise.withResolvers(),b.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(C=this._stats)==null||C.time("Page Request"),this._pumpOperatorList(g));const x=T=>{var k;b.renderTasks.delete(_),(this._maybeCleanupAfterRender||w)&&v(this,ti,!0),A(this,Ke,Sr).call(this,!w),T?(_.capability.reject(T),this._abortOperatorList({intentState:b,reason:T instanceof Error?T:new Error(T)})):_.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(k=globalThis.Stats)!=null&&k.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},_=new Gc({callback:x,params:{canvasContext:s,viewport:e,transform:r,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:b.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:c});(b.renderTasks||(b.renderTasks=new Set)).add(_);const S=_.task;return Promise.all([b.displayReadyCapability.promise,l]).then((([T,k])=>{var I;if(this.destroyed)x();else{if((I=this._stats)==null||I.time("Rendering"),!(k.renderingIntent&f))throw new Error("Mu
3st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");_.initializeGraphics({transparency:T,optionalContentConfig:k}),_.operatorListChanged()}})).catch(x),S}getOperatorList({intent:s="display",annotationMode:e=wi.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}={}){var h;const r=this._transport.getRenderingIntent(s,e,i,n,!0);let a,l=this._intentStates.get(r.cacheKey);return l||(l=Object.create(null),this._intentStates.set(r.cacheKey,l)),l.opListReadCapability||(a=Object.create(null),a.operatorListChanged=function(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(a))},l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(a),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(r)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:s=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:s===!0,disableNormalization:e===!0},{highWaterMark:100,size:i=>i.items.length})}getTextContent(s={}){if(this._transport._htmlForXfa)return this.getXfa().then((i=>co.textContent(i)));const e=this.streamTextContent(s);return new Promise((function(i,n){const r=e.getReader(),a={items:[],styles:Object.create(null),lang:null};(function l(){r.read().then((function({value:h,done:c}){var d;c?i(a):((d=a.lang)!=null||(a.lang=h.lang),Object.assign(a.styles,h.styles),a.items.push(...h.items),l())}),n)})()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const s=[];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)s.push(i.completed),i.cancel();return this.objs.clear(),v(this,ti,!1),A(this,Ke,nh).call(this),Promise.all(s)}cleanup(s=!1){v(this,ti,!0);const e=A(this,Ke,Sr).call(this,!1);return s&&e&&this._stats&&(this._stats=new Qd),e}_startRenderPage(s,e){var n,r;const i=this._intentStates.get(e);i&&((n=this._stats)==null||n.timeEnd("Page Request"),(r=i.displayReadyCapability)==null||r.resolve(s))}_renderPageChunk(s,e){for(let i=0,n=s.length;i<n;i++)e.operatorList.fnArray.push(s.fnArray[i]),e.operatorList.argsArray.push(s.argsArray[i]);e.operatorList.lastChunk=s.lastChunk,e.operatorList.separateAnnots=s.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();s.lastChunk&&A(this,Ke,Sr).call(this,!0)}_pumpOperatorList({renderingIntent:s,cacheKey:e,annotationStorageSerializable:i,modifiedIds:n}){const{map:r,transfer:a}=i,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:s,cacheKey:e,annotationStorage:r,modifiedIds:n},a).getReader(),h=this._intentStates.get(e);h.streamReader=l;const c=()=>{l.read().then((({value:d,done:p})=>{p?h.streamReader=null:this._transport.destroyed||(this._renderPageChunk(d,h),c())}),(d=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const p of h.renderTasks)p.operatorListChanged();A(this,Ke,Sr).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(d);else{if(!h.opListReadCapability)throw d;h.opListReadCapability.reject(d)}}}))};c()}_abortOperatorList({intentState:s,reason:e,force:i=!1}){if(s.streamReader){if(s.streamReaderCancelTimeout&&(clearTimeout(s.streamReaderCancelTimeout),s.streamReaderCancelTimeout=null),!i){if(s.renderTasks.size>0)return;if(e instanceof Td){let n=100;e.extraDelay>0&&e.extraDelay<1e3&&(n+=e.extraDelay),s.streamReaderCancelTimeout=setTimeout((()=>{s.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:s,reason:e,force:!0})}),n);return}}if(s.streamReader.cancel(new Zi(e.message)).catch((()=>{})),s.streamReader=null,!this._transport.destroyed){for(const[n,r]of this._intentStates)if(r===s){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}Bi=new WeakMap,ti=new WeakMap,Ke=new WeakSet,Sr=function(s=!1){if(A(this,Ke,nh).call(this),!o(this,ti)||this.destroyed)return!1;if(s)return v(this,Bi,setTimeout((()=>{v(this,Bi,null),A(this,Ke,Sr).call(this,!1)}),5e3)),!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(),v(this,ti,!1),!0},nh=function(){o(this,Bi)&&(clearTimeout(o(this,Bi)),v(this,Bi,null))};var ei,Bh;class Hm{constructor(){y(this,ei,new Map);y(this,Bh,Promise.resolve())}postMessage(s,e){const i={data:structuredClone(s,e?{transfer:e}:null)};o(this,Bh).then((()=>{for(const[n]of o(this,ei))n.call(this,i)}))}addEventListener(s,e,i=null){let n=null;if((i==null?void 0:i.signal)instanceof AbortSignal){const{signal:r}=i;if(r.aborted){J("LoopbackPort - cannot use an `aborted` signal.");return}const a=()=>this.removeEventListener(s,e);n=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}o(this,ei).set(e,n)}removeEventListener(s,e){const i=o(this,ei).get(e);i==null||i(),o(this,ei).delete(e)}terminate(){for(const[,s]of o(this,ei))s==null||s();o(this,ei).clear()}}ei=new WeakMap,Bh=new WeakMap;var Hh,jn,$n,ia,rh,na,ah;const Et=class Et{constructor({name:s=null,port:e=null,verbosity:i=Gg()}={}){y(this,ia);var n;if(this.name=s,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if((n=o(Et,$n))!=null&&n.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(o(Et,$n)||v(Et,$n,new WeakMap)).set(e,this),this._initializeFromPort(e)}else this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(s){this._port=s,this._messageHandler=new Xa("main","worker",s),this._messageHandler.on("ready",(function(){})),A(this,ia,rh).call(this)}_initialize(){if(o(Et,jn)||o(Et,na,ah)){this._setupFakeWorker();return}let{workerSrc:s}=Et;try{Et._isSameOrigin(window.location.href,s)||(s=Et._createCDNWrapper(new URL(s,window.location).href));const e=new Worker(s,{type:"module"}),i=new Xa("main","worker",e),n=()=>{r.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},r=new AbortController;e.addEventListener("error",(()=>{this._webWorker||n()}),{signal:r.signal}),i.on("test",(l=>{r.abort(),!this.destroyed&&l?(this._messageHandler=i,this._port=e,this._webWorker=e,A(this,ia,rh).call(this)):n()})),i.on("ready",(l=>{if(r.abort(),this.destroyed)n();else try{a()}catch{this._setupFakeWorker()}}));const a=()=>{const l=new Uint8Array;i.send("test",l,[l.buffer])};a();return}catch{Yh("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){o(Et,jn)||(J("Setting up fake worker."),v(Et,jn,!0)),Et._setupFakeWorkerGlobal.then((s=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const e=new Hm;this._port=e;const i="fake"+be(Et,Hh)._++,n=new Xa(i+"_worker",i,e);s.setup(n,e),this._messageHandler=new Xa(i,i+"_worker",e),A(this,ia,rh).call(this)})).catch((s=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${s.message}".`))}))}destroy(){var s,e,i;this.destroyed=!0,(s=this._webWorker)==null||s.terminate(),this._webWorker=null,(e=o(Et,$n))==null||e.delete(this._port),this._port=null,(i=this._messageHandler)==null||i.destroy(),this._messageHandler=null}static fromPort(s){var i;if(!(s!=null&&s.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const e=(i=o(this,$n))==null?void 0:i.get(s.port);
3if(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 Et(s)}static get workerSrc(){if(an.workerSrc)return an.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return ot(this,"_setupFakeWorkerGlobal",(async()=>o(this,na,ah)?o(this,na,ah):(await import(this.workerSrc)).WorkerMessageHandler)())}};Hh=new WeakMap,jn=new WeakMap,$n=new WeakMap,ia=new WeakSet,rh=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},na=new WeakSet,ah=function(){var s;try{return((s=globalThis.pdfjsWorker)==null?void 0:s.WorkerMessageHandler)||null}catch{return null}},y(Et,na),y(Et,Hh,0),y(Et,jn,!1),y(Et,$n),le&&(v(Et,jn,!0),an.workerSrc||(an.workerSrc="./pdf.worker.mjs")),Et._isSameOrigin=(s,e)=>{let i;try{if(i=new URL(s),!i.origin||i.origin==="null")return!1}catch{return!1}const n=new URL(e,i);return i.origin===n.origin},Et._createCDNWrapper=s=>{const e=`await import("${s}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let Pr=Et;var si,Ts,ra,aa,ii,zn,Za;class jm{constructor(s,e,i,n,r){y(this,zn);y(this,si,new Map);y(this,Ts,new Map);y(this,ra,new Map);y(this,aa,new Map);y(this,ii,null);this.messageHandler=s,this.loadingTask=e,this.commonObjs=new Sp,this.fontLoader=new sm({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return ot(this,"annotationStorage",new Pd)}getRenderingIntent(s,e=wi.ENABLE,i=null,n=!1,r=!1){let a=Ed,l=Lc;switch(s){case"any":a=ug;break;case"display":break;case"print":a=xh;break;default:J(`getRenderingIntent - invalid intent: ${s}`)}const h=a&xh&&i instanceof ip?i:this.annotationStorage;switch(e){case wi.DISABLE:a+=gg;break;case wi.ENABLE:break;case wi.ENABLE_FORMS:a+=pg;break;case wi.ENABLE_STORAGE:a+=fg,l=h.serializable;break;default:J(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(a+=mg),r&&(a+=vg);const{ids:c,hash:d}=h.modifiedIds;return{renderingIntent:a,cacheKey:[a,l.hash,d].join("_"),annotationStorageSerializable:l,modifiedIds:c}}destroy(){var i;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(i=o(this,ii))==null||i.reject(new Error("Worker was destroyed during onPassword callback"));const s=[];for(const n of o(this,Ts).values())s.push(n._destroy());o(this,Ts).clear(),o(this,ra).clear(),o(this,aa).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return s.push(e),Promise.all(s).then((()=>{var n,r;this.commonObjs.clear(),this.fontLoader.clear(),o(this,si).clear(),this.filterFactory.destroy(),ho.cleanup(),(n=this._networkStream)==null||n.cancelAllRequests(new Zi("Worker was terminated.")),(r=this.messageHandler)==null||r.destroy(),this.messageHandler=null,this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:s,loadingTask:e}=this;s.on("GetReader",((i,n)=>{Nt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=r=>{this._lastProgress={loaded:r.loaded,total:r.total}},n.onPull=()=>{this._fullReader.read().then((function({value:r,done:a}){a?n.close():(Nt(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(r),1,[r]))})).catch((r=>{n.error(r)}))},n.onCancel=r=>{this._fullReader.cancel(r),n.ready.catch((a=>{if(!this.destroyed)throw a}))}})),s.on("ReaderHeadersReady",(async i=>{var l;await this._fullReader.headersReady;const{isStreamingSupported:n,isRangeSupported:r,contentLength:a}=this._fullReader;return(!n||!r)&&(this._lastProgress&&((l=e.onProgress)==null||l.call(e,this._lastProgress)),this._fullReader.onProgress=h=>{var c;(c=e.onProgress)==null||c.call(e,{loaded:h.loaded,total:h.total})}),{isStreamingSupported:n,isRangeSupported:r,contentLength:a}})),s.on("GetRangeReader",((i,n)=>{Nt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(i.begin,i.end);r?(n.onPull=()=>{r.read().then((function({value:a,done:l}){l?n.close():(Nt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(a),1,[a]))}
3)).catch((a=>{n.error(a)}))},n.onCancel=a=>{r.cancel(a),n.ready.catch((l=>{if(!this.destroyed)throw l}))}):n.close()})),s.on("GetDoc",(({pdfInfo:i})=>{this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new Om(i,this))})),s.on("DocException",(i=>{e._capability.reject(Ae(i))})),s.on("PasswordRequest",(i=>{v(this,ii,Promise.withResolvers());try{if(!e.onPassword)throw Ae(i);const n=r=>{r instanceof Error?o(this,ii).reject(r):o(this,ii).resolve({password:r})};e.onPassword(n,i.code)}catch(n){o(this,ii).reject(n)}return o(this,ii).promise})),s.on("DataLoaded",(i=>{var n;(n=e.onProgress)==null||n.call(e,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)})),s.on("StartRenderPage",(i=>{this.destroyed||o(this,Ts).get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)})),s.on("commonobj",(([i,n,r])=>{var a;if(this.destroyed||this.commonObjs.has(i))return null;switch(n){case"Font":const{disableFontFace:l,fontExtraProperties:h,pdfBug:c}=this._params;if("error"in r){const f=r.error;J(`Error during font loading: ${f}`),this.commonObjs.resolve(i,f);break}const d=c&&((a=globalThis.FontInspector)!=null&&a.enabled)?(f,m)=>globalThis.FontInspector.fontAdded(f,m):null,p=new im(r,{disableFontFace:l,fontExtraProperties:h,inspectFont:d});this.fontLoader.bind(p).catch((()=>s.sendWithPromise("FontFallback",{id:i}))).finally((()=>{!h&&p.data&&(p.data=null),this.commonObjs.resolve(i,p)}));break;case"CopyLocalImage":const{imageRef:g}=r;Nt(g,"The imageRef must be defined.");for(const f of o(this,Ts).values())for(const[,m]of f.objs)if((m==null?void 0:m.ref)===g)return m.dataLen?(this.commonObjs.resolve(i,structuredClone(m)),m.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,r);break;default:throw new Error(`Got unknown common object type ${n}`)}return null})),s.on("obj",(([i,n,r,a])=>{var h;if(this.destroyed)return;const l=o(this,Ts).get(n);if(!l.objs.has(i))if(l._intentStates.size!==0)switch(r){case"Image":l.objs.resolve(i,a),(a==null?void 0:a.dataLen)>1e7&&(l._maybeCleanupAfterRender=!0);break;case"Pattern":l.objs.resolve(i,a);break;default:throw new Error(`Got unknown object type ${r}`)}else(h=a==null?void 0:a.bitmap)==null||h.close()})),s.on("DocProgress",(i=>{var n;this.destroyed||((n=e.onProgress)==null||n.call(e,{loaded:i.loaded,total:i.total}))})),s.on("FetchBuiltInCMap",(async i=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(i)})),s.on("FetchStandardFontData",(async i=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(i)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var i,n;this.annotationStorage.size<=0&&J("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:s,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:s,filename:(n=(i=this._fullReader)==null?void 0:i.filename)!=null?n:null},e).finally((()=>{this.annotationStorage.resetModified()}))}getPage(s){if(!Number.isInteger(s)||s<=0||s>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=s-1,i=o(this,ra).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((r=>{if(this.destroyed)throw new Error("Transport destroyed");r.refStr&&o(this,aa).set(r.refStr,s);const a=new Bm(e,r,this,this._params.pdfBug);return o(this,Ts).set(e,a),a}));return o(this,ra).set(e,n),n}getPageIndex(s){return gu(s)?this.messageHandler.sendWithPromise("GetPageIndex",{num:s.num,gen:s.gen}):Promise.reject(new Error("Invalid pageIndex request."))}
3getAnnotations(s,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:s,intent:e})}getFieldObjects(){return A(this,zn,Za).call(this,"GetFieldObjects")}hasJSActions(){return A(this,zn,Za).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(s){return typeof s!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:s})}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 A(this,zn,Za).call(this,"GetDocJSActions")}getPageJSActions(s){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:s})}getStructTree(s){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:s})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(s){return A(this,zn,Za).call(this,"GetOptionalContentConfig").then((e=>new vm(e,s)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const s="GetMetadata",e=o(this,si).get(s);if(e)return e;const i=this.messageHandler.sendWithPromise(s,null).then((n=>{var r,a,l,h;return{info:n[0],metadata:n[1]?new gm(n[1]):null,contentDispositionFilename:(a=(r=this._fullReader)==null?void 0:r.filename)!=null?a:null,contentLength:(h=(l=this._fullReader)==null?void 0:l.contentLength)!=null?h:null}}));return o(this,si).set(s,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(s=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of o(this,Ts).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),s||this.fontLoader.clear(),o(this,si).clear(),this.filterFactory.destroy(!0),ho.cleanup()}}cachedPageNumber(s){var i;if(!gu(s))return null;const e=s.gen===0?`${s.num}R`:`${s.num}R${s.gen}`;return(i=o(this,aa).get(e))!=null?i:null}}si=new WeakMap,Ts=new WeakMap,ra=new WeakMap,aa=new WeakMap,ii=new WeakMap,zn=new WeakSet,Za=function(s,e=null){const i=o(this,si).get(s);if(i)return i;const n=this.messageHandler.sendWithPromise(s,e);return o(this,si).set(s,n),n};const ja=Symbol("INITIAL_DATA");var Re,Jo,Vc;class Sp{constructor(){y(this,Jo);y(this,Re,Object.create(null))}get(s,e=null){if(e){const n=A(this,Jo,Vc).call(this,s);return n.promise.then((()=>e(n.data))),null}const i=o(this,Re)[s];if(!i||i.data===ja)throw new Error(`Requesting object that isn't resolved yet ${s}.`);return i.data}has(s){const e=o(this,Re)[s];return!!e&&e.data!==ja}delete(s){const e=o(this,Re)[s];return!e||e.data===ja?!1:(delete o(this,Re)[s],!0)}resolve(s,e=null){const i=A(this,Jo,Vc).call(this,s);i.data=e,i.resolve()}clear(){var s;for(const e in o(this,Re)){const{data:i}=o(this,Re)[e];(s=i==null?void 0:i.bitmap)==null||s.close()}v(this,Re,Object.create(null))}*[Symbol.iterator](){for(const s in o(this,Re)){const{data:e}=o(this,Re)[s];e!==ja&&(yield[s,e])}}}Re=new WeakMap,Jo=new WeakSet,Vc=function(s){var e;return(e=o(this,Re))[s]||(e[s]={...Promise.withResolvers(),data:ja})};var Hi;class $m{constructor(s){y(this,Hi,null);v(this,Hi,s),this.onContinue=null}get promise(){return o(this,Hi).capability.promise}cancel(s=0){o(this,Hi).cancel(null,s)}get separateAnnots(){const{separateAnnots:s}=o(this,Hi).operatorList;if(!s)return!1;const{annotationCanvasMap:e}=o(this,Hi);return s.form||s.canvas&&(e==null?void 0:e.size)>0}}Hi=new WeakMap;var ji,Un;const on=class on{constructor({callback:s,params:e,objs:i,commonObjs:n,annotationCanvasMap:r,operatorList:a,pageIndex:l,canvasFactory:h,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:p=!1,pageColors:g=null}){y(this,ji,null);this.callback=s,this.params=e,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=l,this.canvasFactory=h,this.filterFactory=c,this._pdfBug=p,this.pageColors=g,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new $m(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:s=!1,optionalContentConfig:e}){var l,h;if(this.cancelled)return;
3if(this._canvas){if(o(on,Un).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.");o(on,Un).add(this._canvas)}this._pdfBug&&((l=globalThis.StepperManager)!=null&&l.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:i,viewport:n,transform:r,background:a}=this.params;this.gfx=new Mr(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:r,viewport:n,transparency:s,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,(h=this.graphicsReadyCallback)==null||h.call(this)}cancel(s=null,e=0){var i;this.running=!1,this.cancelled=!0,(i=this.gfx)==null||i.endDrawing(),o(this,ji)&&(window.cancelAnimationFrame(o(this,ji)),v(this,ji,null)),o(on,Un).delete(this._canvas),this.callback(s||new Td(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){var s;this.graphicsReady?((s=this.stepper)==null||s.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?v(this,ji,window.requestAnimationFrame((()=>{v(this,ji,null),this._nextBound().catch(this._cancelBound)}))):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),o(on,Un).delete(this._canvas),this.callback())))}};ji=new WeakMap,Un=new WeakMap,y(on,Un,new WeakSet);let Gc=on;const zm="4.10.38",Um="f9bea397f";ht(670);function mu(u){return Math.floor(255*Math.max(0,Math.min(1,u))).toString(16).padStart(2,"0")}function $a(u){return Math.max(0,Math.min(255,255*u))}class vu{static CMYK_G([s,e,i,n]){return["G",1-Math.min(1,.3*s+.59*i+.11*e+n)]}static G_CMYK([s]){return["CMYK",0,0,0,1-s]}static G_RGB([s]){return["RGB",s,s,s]}static G_rgb([s]){return[s=$a(s),s,s]}static G_HTML([s]){const e=mu(s);return`#${e}${e}${e}`}static RGB_G([s,e,i]){return["G",.3*s+.59*e+.11*i]}static RGB_rgb(s){return s.map($a)}static RGB_HTML(s){return`#${s.map(mu).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([s,e,i,n]){return["RGB",1-Math.min(1,s+n),1-Math.min(1,i+n),1-Math.min(1,e+n)]}static CMYK_rgb([s,e,i,n]){return[$a(1-Math.min(1,s+n)),$a(1-Math.min(1,i+n)),$a(1-Math.min(1,e+n))]}static CMYK_HTML(s){const e=this.CMYK_RGB(s).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([s,e,i]){const n=1-s,r=1-e,a=1-i;return["CMYK",n,r,a,Math.min(n,r,a)]}}class Vm{create(s,e,i=!1){if(s<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${s}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${s} ${e}`),n}createElement(s){if(typeof s!="string")throw new Error("Invalid SVG element type");return this._createSVG(s)}_createSVG(s){At("Abstract method `_createSVG` called.")}}class Fd extends Vm{_createSVG(s){return document.createElementNS(Bs,s)}}class Ep{static setupStorage(s,e,i,n,r){const a=n.getValue(e,{value:null});switch(i.name){case"textarea":if(a.value!==null&&(s.textContent=a.value),r==="print")break;s.addEventListener("input",(l=>{n.setValue(e,{value:l.target.value})}));break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(a.value===i.attributes.xfaOn?s.setAttribute("checked",!0):a.value===i.attributes.xfaOff&&s.removeAttribute("checked"),r==="print")break;s.addEventListener("change",(l=>{n.setValue(e,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})}))}else{if(a.value!==null&&s.setAttribute("value",a.value),r==="print")break;s.addEventListener("input",(l=>{n.setValue(e,{value:l.target.value})}))}break;case"select":if(a.value!==null){s.setAttribute("value",a.value);for(const l of i.children)l.attributes.value===a.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}s.addEventListener("input",(l=>{const h=l.target.options,c=h.selectedIndex===-1?"":h[h.selectedIndex].value;n.setValue(e,{value:c})}))}}static setAttributes({html:s,element:e,storage:i=null,intent:n,linkService:r}){const{attributes:a}=e,l=s instanceof HTMLAnchorElement;a.type==="radio"&&(a.name=`${a.name}-${n}`);for(const[h,c]of Object.entries(a))if(c!=null)switch(h){case"class":c.length&&s.setAttribute(h,c.join(" "));break;case"dataId":break;case"id":s.setAttribute("data-element-id",c);break;case"style":Object.assign(s.style,c);break;case"textContent":s.textContent=c;break;default:(!l||h!=="href"&&h!=="newWindow")&&s.setAttribute(h,c)}l&&r.addLinkAttributes(s,a.href,a.newWindow),i&&a.dataId&&this.setupStorage(s,a.dataId,e,i)}static render(s){var p,g;const e=s.annotationStorage,i=s.linkService,n=s.xfaHtml,r=s.intent||"display",a=document.createElement(n.name);n.attributes&&this.setAttributes({html:a,element:n,intent:r,linkService:i});const l=r!=="richText",h=s.div;if(h.append(a),s.viewport){const f=`matrix(${s.viewport.transform.join(",")})`;h.style.transform=f}l&&h.setAttribute("class","xfaLayer xfaFont");const c=[];if(n.children.length===0){if(n.value){const f=document.createTextNode(n.value);a.append(f),l&&co.shouldBuildText(n.name)&&c.push(f)}return{textDivs:c}}const d=[[n,-1,a]];for(;d.length>0;){const[f,m,b]=d.at(-1);if(m+1===f.children.length){d.pop();continue}const w=f.children[++d.at(-1)[1]];if(w===null)continue;const{name:x}=w;if(x==="#text"){const S=document.createTextNode(w.value);c.push(S),b.append(S);continue}const _=(p=w==null?void 0:w.attributes)!=null&&p.xmlns?document.createElementNS(w.attributes.xmlns,x):document.createElement(x);if(b.append(_),w.attributes&&this.setAttributes({html:_,element:w,storage:e,intent:r,linkService:i}),((g=w.children)==null?void 0:g.length)>0)d.push([w,-1,_]);else if(w.value){const S=document.createTextNode(w.value);l&&co.shouldBuildText(x)&&c.push(S),_.append(S)}}for(const f of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))f.setAttribute("readOnly",!0);return{textDivs:c}}static update(s){const e=`matrix(${s.viewport.transform.join(",")})`;s.div.style.transform=e,s.div.hidden=!1}}const Nl=1e3,vr=new WeakSet;function Ji(u){return{width:u[2]-u[0],height:u[3]-u[1]}}class Gm{static create(s){switch(s.data.annotationType){case xg:return new Cp(s);case wg:return new qm(s);case Og:switch(s.data.fieldType){case"Tx":return new Wm(s);case"Btn":return s.data.radioButton?new Rp(s):s.data.checkBox?new Ym(s):new Km(s);case"Ch":return new Qm(s);case"Sig":return new Xm(s)}return new yr(s);case _u:return new Wc(s);case _g:return new Lp(s);case Sg:return new Zm(s);case Eg:return new t0(s);case Cg:return new e0(s);case Tg:return new Fp(s);case Lg:return new i0(s);case Fg:return new Nd(s);case kg:return new s0(s);case Rg:return new Np(s);case Mg:return new n0(s);case Pg:return new r0(s);case Ig:return new a0(s);case Dg:return new Op(s);case Ng:return new o0(s);default:return new Ft(s)}}}var Vn,oa,la,Zo,qc;const jd=class jd{constructor(s,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){y(this,Zo);y(this,Vn,null);y(this,oa,!1);y(this,la,null);this.isRenderable=e,this.data=s.data,this.layer=s.layer,this.linkService=s.linkService,this.downloadManager=s.downloadManager,this.imageResourcesPath=s.imageResourcesPath,this.renderForms=s.renderForms,this.svgFactory=s.svgFactory,this.annotationStorage=s.annotationStorage,this.enableScripting=s.enableScripting,this.hasJSActions=s.hasJSActions,this._fieldObjects=s.fieldObjects,this.parent=s.parent,e&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:s,contentsObj:e,richText:i}){return!!(s!=null&&s.str||e!=null&&e.str||i!=null&&i.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return jd._hasPopupData(this.data)}updateEdited(s){var i;if(!this.container)return;o(this,Vn)||v(this,Vn,{rect:this.data.rect.slice(0)});const{rect:e}=s;e&&A(this,Zo,qc).call(this,e),(i=o(this,la))==null||i.popup.updateEdited(s)}resetEdited(){var s;o(this,Vn)&&(A(this,Zo,qc).call(this,o(this,Vn).rect),(s=o(this,la))==null||s.popup.resetEdited(),v(this,Vn,null))}_createContainer(s){const{data:e,parent:{page:i,viewport:n}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",e.id),this instanceof yr||(r.tabIndex=Nl);const{style:a}=r;if(a.zIndex=this.parent.zIndex++,e.alternativeText&&(r.title=e.alternativeText),e.noRotate&&r.classList.add("norotate"),!e.rect||this instanceof Wc){const{rotation:b}=e;return e.hasOwnCanvas||b===0||this.setRotation(b,r),r}const{width:l,height:h}=Ji(e.rect);if(!s&&e.borderStyle.width>0){a.borderWidth=`${e.borderStyle.width}px`;const b=e.borderStyle.horizontalCornerRadius,w=e.borderStyle.verticalCornerRadius;if(b>0||w>0){const _=`calc(${b}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;a.borderRadius=_}else if(this instanceof Rp){const _=`calc(${l}px * var(--scale-factor)) / calc(${h}px * var(--scale-factor))`;a.borderRadius=_}switch(e.borderStyle.style){case Bg:a.borderStyle="solid";break;case Hg:a.borderStyle="dashed";break;case jg:J("Unimplemented border style: beveled");break;case $g:J("Unimplemented border style: inset");break;case zg:a.borderBottomStyle="solid"}const x=e.borderColor||null;x?(v(this,oa,!0),a.borderColor=W.makeHexColor(0|x[0],0|x[1],0|x[2])):a.borderWidth=0}const c=W.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:d,pageHeight:p,pageX:g,pageY:f}=n.rawDims;a.left=100*(c[0]-g)/d+"%",a.top=100*(c[1]-f)/p+"%";const{rotation:m}=e;
3return e.hasOwnCanvas||m===0?(a.width=100*l/d+"%",a.height=100*h/p+"%"):this.setRotation(m,r),r}setRotation(s,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:r,height:a}=Ji(this.data.rect);let l,h;s%180==0?(l=100*r/i,h=100*a/n):(l=100*a/i,h=100*r/n),e.style.width=`${l}%`,e.style.height=`${h}%`,e.setAttribute("data-main-rotation",(360-s)%360)}get _commonActions(){const s=(e,i,n)=>{const r=n.detail[e],a=r[0],l=r.slice(1);n.target.style[i]=vu[`${a}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:vu[`${a}_rgb`](l)})};return ot(this,"_commonActions",{display:e=>{const{display:i}=e.detail,n=i%2==1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:i===1||i===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:i}=e.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{s("bgColor","backgroundColor",e)},fillColor:e=>{s("fillColor","backgroundColor",e)},fgColor:e=>{s("fgColor","color",e)},textColor:e=>{s("textColor","color",e)},borderColor:e=>{s("borderColor","borderColor",e)},strokeColor:e=>{s("strokeColor","borderColor",e)},rotation:e=>{const i=e.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(s,e){const i=this._commonActions;for(const n of Object.keys(e.detail)){const r=s[n]||i[n];r==null||r(e)}}_setDefaultPropertiesFromJS(s){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,r]of Object.entries(e)){const a=i[n];a&&(a({detail:{[n]:r},target:s}),delete e[n])}}
3_createQuadrilaterals(){if(!this.container)return;const{quadPoints:s}=this.data;if(!s)return;const[e,i,n,r]=this.data.rect.map((b=>Math.fround(b)));if(s.length===8){const[b,w,x,_]=s.subarray(2,6);if(n===b&&r===w&&e===x&&i===_)return}const{style:a}=this.container;let l;if(o(this,oa)){const{borderColor:b,borderWidth:w}=a;a.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${b}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const h=n-e,c=r-i,{svgFactory:d}=this,p=d.createElement("svg");p.classList.add("quadrilateralsContainer"),p.setAttribute("width",0),p.setAttribute("height",0);const g=d.createElement("defs");p.append(g);const f=d.createElement("clipPath"),m=`clippath_${this.data.id}`;f.setAttribute("id",m),f.setAttribute("clipPathUnits","objectBoundingBox"),g.append(f);for(let b=2,w=s.length;b<w;b+=8){const x=s[b],_=s[b+1],S=s[b+2],E=s[b+3],C=d.createElement("rect"),T=(S-e)/h,k=(r-_)/c,I=(x-S)/h,P=(_-E)/c;C.setAttribute("x",T),C.setAttribute("y",k),C.setAttribute("width",I),C.setAttribute("height",P),f.append(C),l==null||l.push(`<rect vector-effect="non-scaling-stroke" x="${T}" y="${k}" width="${I}" height="${P}"/>`)}o(this,oa)&&(l.push("</g></svg>')"),a.backgroundImage=l.join("")),this.container.append(p),this.container.style.clipPath=`url(#${m})`}_createPopup(){const{data:s}=this,e=v(this,la,new Wc({data:{color:s.color,titleObj:s.titleObj,modificationDate:s.modificationDate,contentsObj:s.contentsObj,richText:s.richText,parentRect:s.rect,borderStyle:0,id:`popup_${s.id}`,rotation:s.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){At("Abstract method `AnnotationElement.render` called")}_getElementsByName(s,e=null){const i=[];if(this._fieldObjects){const n=this._fieldObjects[s];if(n)for(const{page:r,id:a,exportValues:l}of n){if(r===-1||a===e)continue;const h=typeof l=="string"?l:null,c=document.querySelector(`[data-element-id="${a}"]`);!c||vr.has(c)?i.push({id:a,exportValue:h,domElement:c}):J(`_getElementsByName - element not allowed: ${a}`)}return i}for(const n of document.getElementsByName(s)){const{exportValue:r}=n,a=n.getAttribute("data-element-id");a!==e&&vr.has(n)&&i.push({id:a,exportValue:r,domElement:n})}return i}show(){var s;this.container&&(this.container.hidden=!1),(s=this.popup)==null||s.maybeShow()}hide(){var s;this.container&&(this.container.hidden=!0),(s=this.popup)==null||s.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const s=this.getElementsToTriggerPopup();if(Array.isArray(s))for(const e of s)e.classList.add("highlightArea");else s.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:s,data:{id:e}}=this;this.container.addEventListener("dblclick",(()=>{var i;(i=this.linkService.eventBus)==null||i.dispatch("switchannotationeditormode",{source:this,mode:s,editId:e})}))}};Vn=new WeakMap,oa=new WeakMap,la=new WeakMap,Zo=new WeakSet,qc=function(s){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:r,pageHeight:a,pageX:l,pageY:h}}}}=this;i==null||i.splice(0,4,...s);const{width:c,height:d}=Ji(s);e.left=100*(s[0]-l)/r+"%",e.top=100*(a-s[3]+h)/a+"%",n===0?(e.width=100*c/r+"%",e.height=100*d/a+"%"):this.setRotation(n)};let Ft=jd;var He,sn,kp,Tp;class Cp extends Ft{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!(i!=null&&i.ignoreBorder),createQuadrilaterals:!0});y(this,He);this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:i}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let r=!1;return e.url?(i.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.attachment?(A(this,He,kp).call(this,n,e.attachment,e.attachmentDest),r=!0):e.setOCGState?(A(this,He,Tp).call(this,n,e.setOCGState),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,""),r=!0)),this.container.classList.add("linkA
3nnotation"),r&&this.container.append(n),this.container}_bindLink(e,i){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&A(this,He,sn).call(this)}_bindNamedAction(e,i){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),A(this,He,sn).call(this)}_bindJSAction(e,i){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(i.actions)){const a=n.get(r);a&&(e[a]=()=>{var l;return(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:r}}),!1})}e.onclick||(e.onclick=()=>!1),A(this,He,sn).call(this)}_bindResetFormAction(e,i){const n=e.onclick;n||(e.href=this.linkService.getAnchorUrl("")),A(this,He,sn).call(this),this._fieldObjects?e.onclick=()=>{var p;n==null||n();const{fields:r,refs:a,include:l}=i,h=[];if(r.length!==0||a.length!==0){const g=new Set(a);for(const f of r){const m=this._fieldObjects[f]||[];for(const{id:b}of m)g.add(b)}for(const f of Object.values(this._fieldObjects))for(const m of f)g.has(m.id)===l&&h.push(m)}else for(const g of Object.values(this._fieldObjects))h.push(...g);const c=this.annotationStorage,d=[];for(const g of h){const{id:f}=g;switch(d.push(f),g.type){case"text":{const b=g.defaultValue||"";c.setValue(f,{value:b});break}case"checkbox":case"radiobutton":{const b=g.defaultValue===g.exportValues;c.setValue(f,{value:b});break}case"combobox":case"listbox":{const b=g.defaultValue||"";c.setValue(f,{value:b});break}default:continue}const m=document.querySelector(`[data-element-id="${f}"]`);m&&(vr.has(m)?m.dispatchEvent(new Event("resetform")):J(`_bindResetFormAction - element not allowed: ${f}`))}return this.enableScripting&&((p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}:(J('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1))}}He=new WeakSet,sn=function(){this.container.setAttribute("data-internal-link","")},kp=function(e,i,n=null){e.href=this.linkService.getAnchorUrl(""),i.description&&(e.title=i.description),e.onclick=()=>{var r;return(r=this.downloadManager)==null||r.openOrDownloadData(i.content,i.filename,n),!1},A(this,He,sn).call(this)},Tp=function(e,i){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),A(this,He,sn).call(this)};class qm extends Ft{constructor(s){super(s,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const s=document.createElement("img");return s.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",s.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),s.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(s),this.container}}class yr extends Ft{render(){return this.container}showElementAndHideCanvas(s){var e;this.data.hasOwnCanvas&&(((e=s.previousSibling)==null?void 0:e.nodeName)==="CANVAS"&&(s.previousSibling.hidden=!0),s.hidden=!1)}_getKeyModifier(s){return ge.platform.isMac?s.metaKey:s.ctrlKey}_setEventListener(s,e,i,n,r){i.includes("mouse")?s.addEventListener(i,(a=>{var l;(l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(a),shift:a.shiftKey,modifier:this._getKeyModifier(a)}})})):s.addEventListener(i,(a=>{var l;if(i==="blur"){if(!e.focused||!a.relatedTarget)return;e.focused=!1}else if(i==="focus"){if(e.focused)return;e.focused=!0}r&&((l=this.linkService.eventBus)==null||l.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(a)}}))}))}_setEventListeners(s,e,i,n){var r,a,l;for(const[h,c]of i)(c==="Action"||(r=this.data.actions)!=null&&r[c])&&(c!=="Focus"&&c!=="Blur"||e||(e={focused:!1}),this._setEventListener(s,e,h,c,n),c!=="Focus"||(a=this.data.actions)!=null&&a.Blur?c!=="Blur"||(l=this.data.actions)!=null&&l.Focus||this._setEventListener(s,e,"focus","Focus",null):this._setEventListener(s,e,"blur","Blur",null))}
3_setBackgroundColor(s){const e=this.data.backgroundColor||null;s.style.backgroundColor=e===null?"transparent":W.makeHexColor(e[0],e[1],e[2])}_setTextStyle(s){const e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,r=s.style;let a;const l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-2),c=h/(Math.round(h/(ic*n))||1);a=Math.min(n,l(c/ic))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(n,l(h/ic))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=W.makeHexColor(i[0],i[1],i[2]),this.data.textAlignment!==null&&(r.textAlign=e[this.data.textAlignment])}_setRequired(s,e){e?s.setAttribute("required",!0):s.removeAttribute("required"),s.setAttribute("aria-required",e)}}class Wm extends yr{constructor(s){super(s,{isRenderable:s.renderForms||s.data.hasOwnCanvas||!s.data.hasAppearance&&!!s.data.fieldValue})}setPropertyOnSiblings(s,e,i,n){const r=this.annotationStorage;for(const a of this._getElementsByName(s.name,s.id))a.domElement&&(a.domElement[e]=i),r.setValue(a.id,{[n]:i})}render(){var n,r;const s=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=s.getValue(e,{value:this.data.fieldValue});let l=a.value||"";const h=s.getValue(e,{charLimit:this.data.maxLen}).charLimit;h&&l.length>h&&(l=l.slice(0,h));let c=a.formattedValue||((n=this.data.textContent)==null?void 0:n.join(` 4`))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:l,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=c!=null?c:l,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",c!=null?c:l),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),vr.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=Nl,this._setRequired(i,this.data.required),h&&(i.maxLength=h),i.addEventListener("input",(g=>{s.setValue(e,{value:g.target.value}),this.setPropertyOnSiblings(i,"value",g.target.value,"value"),d.formattedValue=null})),i.addEventListener("resetform",(g=>{var m;const f=(m=this.data.defaultFieldValue)!=null?m:"";i.value=d.userValue=f,d.formattedValue=null}));let p=g=>{const{formattedValue:f}=d;f!=null&&(g.target.value=f),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(f=>{var b;if(d.focused)return;const{target:m}=f;d.userValue&&(m.value=d.userValue),d.lastCommittedValue=m.value,d.commitKey=1,(b=this.data.actions)!=null&&b.Focus||(d.focused=!0)})),i.addEventListener("updatefromsandbox",(f=>{this.showElementAndHideCanvas(f.target);const m={value(b){var w;d.userValue=(w=b.detail.value)!=null?w:"",s.setValue(e,{value:d.userValue.toString()}),b.target.value=d.userValue},formattedValue(b){const{formattedValue:w}=b.detail;d.formattedValue=w,w!=null&&b.target!==document.activeElement&&(b.target.value=w),s.setValue(e,{formattedValue:w})},selRange(b){b.target.setSelectionRange(...b.detail.selRange)},charLimit:b=>{var S;const{charLimit:w}=b.detail,{target:x}=b;if(w===0){x.removeAttribute("maxLength");return}x.setAttribute("maxLength",w);let _=d.userValue;_&&!(_.length<=w)&&(_=_.slice(0,w),x.value=d.userValue=_,s.setValue(e,{value:_}),(S=this.linkService.eventBus)==null||S.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:1,selStart:x.selectionStart,selEnd:x.selectionEnd}}))}};this._dispatchEventFromSandbox(m,f)})),i.addEventListener("keydown",(f=>{var w;d.commitKey=1;let m=-1;if(f.key==="Escape"?m=0:f.key!=="Enter"||this.data.multiLine?f.key==="Tab"&&(d.commitKey=3):m=2,m===-1)return;const{value:b}=f.target;d.lastCommittedValue!==b&&(d.lastCommittedValue=b,d.userValue=b,(w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,
4commitKey:m,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}))}));const g=p;p=null,i.addEventListener("blur",(f=>{var b,w;if(!d.focused||!f.relatedTarget)return;(b=this.data.actions)!=null&&b.Blur||(d.focused=!1);const{value:m}=f.target;d.userValue=m,d.lastCommittedValue!==m&&((w=this.linkService.eventBus)==null||w.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}})),g(f)})),(r=this.data.actions)!=null&&r.Keystroke&&i.addEventListener("beforeinput",(f=>{var C;d.lastCommittedValue=null;const{data:m,target:b}=f,{value:w,selectionStart:x,selectionEnd:_}=b;let S=x,E=_;switch(f.inputType){case"deleteWordBackward":{const T=w.substring(0,x).match(/\w*[^\w]*$/);T&&(S-=T[0].length);break}case"deleteWordForward":{const T=w.substring(x).match(/^[^\w]*\w*/);T&&(E+=T[0].length);break}case"deleteContentBackward":x===_&&(S-=1);break;case"deleteContentForward":x===_&&(E+=1)}f.preventDefault(),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,change:m||"",willCommit:!1,selStart:S,selEnd:E}})})),this._setEventListeners(i,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(f=>f.target.value))}if(p&&i.addEventListener("blur",p),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/h;i.classList.add("comb"),i.style.letterSpacing=`calc(${g}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 Xm extends yr{constructor(s){super(s,{isRenderable:!!s.data.hasOwnCanvas})}}class Ym extends yr{constructor(s){super(s,{isRenderable:s.renderForms})}render(){const s=this.annotationStorage,e=this.data,i=e.id;let n=s.getValue(i,{value:e.exportValue===e.fieldValue}).value;typeof n=="string"&&(n=n!=="Off",s.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const r=document.createElement("input");return vr.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=Nl,r.addEventListener("change",(a=>{const{name:l,checked:h}=a.target;for(const c of this._getElementsByName(l,i)){const d=h&&c.exportValue===e.exportValue;c.domElement&&(c.domElement.checked=d),s.setValue(c.id,{value:d})}s.setValue(i,{value:h})})),r.addEventListener("resetform",(a=>{const l=e.defaultFieldValue||"Off";a.target.checked=l===e.exportValue})),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",(a=>{const l={value(h){h.target.checked=h.detail.value!=="Off",s.setValue(i,{value:h.target.checked})}};this._dispatchEventFromSandbox(l,a)})),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(a=>a.target.checked))),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Rp extends yr{constructor(s){super(s,{isRenderable:s.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const s=this.annotationStorage,e=this.data,i=e.id;let n=s.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if(typeof n=="string"&&(n=n!==e.buttonValue,s.setValue(i,{value:n})),n)for(const a of this._getElementsByName(e.fieldName,i))s.setValue(a.id,{value:!1});const r=document.createElement("input");if(vr.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.tabIndex=Nl,r.addEventListener("change",(a=>{const{name:l,checked:h}=a.target;for(const c of this._getElementsByName(l,i))s.setValue(c.id,{value:!1});s.setValue(i,{value:h})})),r.addEventListener("resetform",(a=>{const l=e.defaultFieldValue;a.target.checked=l!=null&&l===e.buttonValue})),this.enableScripting&&this.hasJSActions){const a=e.buttonValue;r.addEventListener("updatefromsandbox",(l=>{const h={value:c=>{const d=a===c.detail.value;for(const p of this._getElementsByName(c.target.name)){const g=d&&p.id===i;p.domElement&&(p.domElement.checked=g),s.setValue(p.id,{value:g})}}};this._dispatchEventFromSandbox(h,l)})),this._setEventListeners(r,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(l=>l.target.checked))}
4return this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class Km extends Cp{constructor(s){super(s,{ignoreBorder:s.data.hasAppearance})}render(){const s=super.render();s.classList.add("buttonWidgetAnnotation","pushButton");const e=s.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",(i=>{this._dispatchEventFromSandbox({},i)}))),s}}class Qm extends yr{constructor(s){super(s,{isRenderable:s.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const s=this.annotationStorage,e=this.data.id,i=s.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");vr.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=Nl;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(d=>{const p=this.data.defaultFieldValue;for(const g of n.options)g.selected=g.value===p}));for(const d of this.data.options){const p=document.createElement("option");p.textContent=d.displayValue,p.value=d.exportValue,i.value.includes(d.exportValue)&&(p.setAttribute("selected",!0),r=!1),n.append(p)}let a=null;if(r){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),n.prepend(d),a=()=>{d.remove(),n.removeEventListener("input",a),a=null},n.addEventListener("input",a)}const l=d=>{const p=d?"value":"textContent",{options:g,multiple:f}=n;return f?Array.prototype.filter.call(g,(m=>m.selected)).map((m=>m[p])):g.selectedIndex===-1?null:g[g.selectedIndex][p]};let h=l(!1);const c=d=>{const p=d.target.options;return Array.prototype.map.call(p,(g=>({displayValue:g.textContent,exportValue:g.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(d=>{const p={value(g){a==null||a();const f=g.detail.value,m=new Set(Array.isArray(f)?f:[f]);for(const b of n.options)b.selected=m.has(b.value);s.setValue(e,{value:l(!0)}),h=l(!1)},multipleSelection(g){n.multiple=!0},remove(g){const f=n.options,m=g.detail.remove;f[m].selected=!1,n.remove(m),f.length>0&&Array.prototype.findIndex.call(f,(b=>b.selected))===-1&&(f[0].selected=!0),s.setValue(e,{value:l(!0),items:c(g)}),h=l(!1)},clear(g){for(;n.length!==0;)n.remove(0);s.setValue(e,{value:null,items:[]}),h=l(!1)},insert(g){const{index:f,displayValue:m,exportValue:b}=g.detail.insert,w=n.children[f],x=document.createElement("option");x.textContent=m,x.value=b,w?w.before(x):n.append(x),s.setValue(e,{value:l(!0),items:c(g)}),h=l(!1)},items(g){const{items:f}=g.detail;for(;n.length!==0;)n.remove(0);for(const m of f){const{displayValue:b,exportValue:w}=m,x=document.createElement("option");x.textContent=b,x.value=w,n.append(x)}n.options.length>0&&(n.options[0].selected=!0),s.setValue(e,{value:l(!0),items:c(g)}),h=l(!1)},indices(g){const f=new Set(g.detail.indices);for(const m of g.target.options)m.selected=f.has(m.index);s.setValue(e,{value:l(!0)}),h=l(!1)},editable(g){g.target.disabled=!g.detail.editable}};this._dispatchEventFromSandbox(p,d)})),n.addEventListener("input",(d=>{var f;const p=l(!0),g=l(!1);s.setValue(e,{value:p}),d.preventDefault(),(f=this.linkService.eventBus)==null||f.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:h,change:g,changeEx:p,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(d=>d.target.value))):n.addEventListener("input",(function(d){s.setValue(e,{value:l(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Wc extends Ft{constructor(s){const{data:e,elements:i}=s;super(s,{isRenderable:Ft._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const s=this.popup=new Jm({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=s,i.container.ariaHasPopup="dialog",e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map((i=>`${kd}${i}`)).join(",")),this.container}}
4var ha,jh,$h,ca,Gn,It,ni,da,tl,el,ua,ri,as,ai,sl,oi,il,qn,Wn,yt,oh,Xc,Mp,Pp,Ip,Dp,lh,hh,Yc;class Jm{constructor({container:s,color:e,elements:i,titleObj:n,modificationDate:r,contentsObj:a,richText:l,parent:h,rect:c,parentRect:d,open:p}){y(this,yt);y(this,ha,A(this,yt,Ip).bind(this));y(this,jh,A(this,yt,Yc).bind(this));y(this,$h,A(this,yt,hh).bind(this));y(this,ca,A(this,yt,lh).bind(this));y(this,Gn,null);y(this,It,null);y(this,ni,null);y(this,da,null);y(this,tl,null);y(this,el,null);y(this,ua,null);y(this,ri,!1);y(this,as,null);y(this,ai,null);y(this,sl,null);y(this,oi,null);y(this,il,null);y(this,qn,null);y(this,Wn,!1);var g;v(this,It,s),v(this,il,n),v(this,ni,a),v(this,oi,l),v(this,el,h),v(this,Gn,e),v(this,sl,c),v(this,ua,d),v(this,tl,i),v(this,da,Eu.toDateObject(r)),this.trigger=i.flatMap((f=>f.getElementsToTriggerPopup()));for(const f of this.trigger)f.addEventListener("click",o(this,ca)),f.addEventListener("mouseenter",o(this,$h)),f.addEventListener("mouseleave",o(this,jh)),f.classList.add("popupTriggerArea");for(const f of i)(g=f.container)==null||g.addEventListener("keydown",o(this,ha));o(this,It).hidden=!0,p&&A(this,yt,lh).call(this)}render(){if(o(this,as))return;const s=v(this,as,document.createElement("div"));if(s.className="popup",o(this,Gn)){const r=s.style.outlineColor=W.makeHexColor(...o(this,Gn));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?s.style.backgroundColor=`color-mix(in srgb, ${r} 30%, white)`:s.style.backgroundColor=W.makeHexColor(...o(this,Gn).map((l=>Math.floor(.7*(255-l)+l))))}const e=document.createElement("span");e.className="header";const i=document.createElement("h1");if(e.append(i),{dir:i.dir,str:i.textContent}=o(this,il),s.append(e),o(this,da)){const r=document.createElement("span");r.classList.add("popupDate"),r.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),r.setAttribute("data-l10n-args",JSON.stringify({dateObj:o(this,da).valueOf()})),e.append(r)}const n=o(this,yt,oh);if(n)Ep.render({xfaHtml:n,intent:"richText",div:s}),s.lastChild.classList.add("richText","popupContent");else{const r=this._formatContents(o(this,ni));s.append(r)}o(this,It).append(s)}_formatContents({str:s,dir:e}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;const n=s.split(/(?:\r\n?|\n)/);for(let r=0,a=n.length;r<a;++r){const l=n[r];i.append(document.createTextNode(l)),r<a-1&&i.append(document.createElement("br"))}return i}updateEdited({rect:s,popupContent:e}){var i;o(this,qn)||v(this,qn,{contentsObj:o(this,ni),richText:o(this,oi)}),s&&v(this,ai,null),e&&(v(this,oi,A(this,yt,Pp).call(this,e)),v(this,ni,null)),(i=o(this,as))==null||i.remove(),v(this,as,null)}resetEdited(){var s;o(this,qn)&&({contentsObj:be(this,ni)._,richText:be(this,oi)._}=o(this,qn),v(this,qn,null),(s=o(this,as))==null||s.remove(),v(this,as,null),v(this,ai,null))}forceHide(){v(this,Wn,this.isVisible),o(this,Wn)&&(o(this,It).hidden=!0)}maybeShow(){o(this,Wn)&&(o(this,as)||A(this,yt,hh).call(this),v(this,Wn,!1),o(this,It).hidden=!1)}get isVisible(){return o(this,It).hidden===!1}}ha=new WeakMap,jh=new WeakMap,$h=new WeakMap,ca=new WeakMap,Gn=new WeakMap,It=new WeakMap,ni=new WeakMap,da=new WeakMap,tl=new WeakMap,el=new WeakMap,ua=new WeakMap,ri=new WeakMap,as=new WeakMap,ai=new WeakMap,sl=new WeakMap,oi=new WeakMap,il=new WeakMap,qn=new WeakMap,Wn=new WeakMap,yt=new WeakSet,oh=function(){const s=o(this,oi),e=o(this,ni);return!(s!=null&&s.str)||e!=null&&e.str&&e.str!==s.str?null:o(this,oi).html||null},Xc=function(){var s,e,i;return((i=(e=(s=o(this,yt,oh))==null?void 0:s.attributes)==null?void 0:e.style)==null?void 0:i.fontSize)||0},Mp=function(){var s,e,i;return((i=(e=(s=o(this,yt,oh))==null?void 0:s.attributes)==null?void 0:e.style)==null?void 0:i.color)||null},Pp=function(s){const e=[],i={str:s,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:o(this,yt,Mp),fontSize:o(this,yt,Xc)?`calc(${o(this,yt,Xc)}px * var(--scale-factor))`:""}};for(const r of s.split(` 5`))e.push({name:"span",value:r,attributes:n});return i},Ip=function(s){s.altKey||s.shiftKey||s.ctrlKey||s.metaKey||(s.key==="Enter"||s.key==="Escape"&&o(this,ri))&&A(this,yt,lh).call(this)},Dp=function(){if(o(this,ai)!==null)return;const{page:{view:s},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:r}}}=o(this,el);let a=!!o(this,ua),l=a?o(this,ua):o(this,sl);for(const f of o(this,tl))if(!l||W.intersect(f.data.rect,l)!==null){l=f.data.rect,a=!0;break}const h=W.normalizeRect([l[0],s[3]-l[1]+s[1],l[2],s[3]-l[3]+s[1]]),c=a?l[2]-l[0]+5:0,d=h[
50]+c,p=h[1];v(this,ai,[100*(d-n)/e,100*(p-r)/i]);const{style:g}=o(this,It);g.left=`${o(this,ai)[0]}%`,g.top=`${o(this,ai)[1]}%`},lh=function(){v(this,ri,!o(this,ri)),o(this,ri)?(A(this,yt,hh).call(this),o(this,It).addEventListener("click",o(this,ca)),o(this,It).addEventListener("keydown",o(this,ha))):(A(this,yt,Yc).call(this),o(this,It).removeEventListener("click",o(this,ca)),o(this,It).removeEventListener("keydown",o(this,ha)))},hh=function(){o(this,as)||this.render(),this.isVisible?o(this,ri)&&o(this,It).classList.add("focused"):(A(this,yt,Dp).call(this),o(this,It).hidden=!1,o(this,It).style.zIndex=parseInt(o(this,It).style.zIndex)+1e3)},Yc=function(){o(this,It).classList.remove("focused"),!o(this,ri)&&this.isVisible&&(o(this,It).hidden=!0,o(this,It).style.zIndex=parseInt(o(this,It).style.zIndex)-1e3)};class Lp extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0}),this.textContent=s.data.textContent,this.textPosition=s.data.textPosition,this.annotationEditorType=st.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const s=document.createElement("div");s.classList.add("annotationTextContent"),s.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,s.append(i)}this.container.append(s)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var nl;class Zm extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,nl,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:i,height:n}=Ji(e.rect),r=this.svgFactory.create(i,n,!0),a=v(this,nl,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,nl)}addHighlightArea(){this.container.classList.add("highlightArea")}}nl=new WeakMap;var rl;class t0 extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,rl,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:i,height:n}=Ji(e.rect),r=this.svgFactory.create(i,n,!0),a=e.borderStyle.width,l=v(this,rl,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",a/2),l.setAttribute("y",a/2),l.setAttribute("width",i-a),l.setAttribute("height",n-a),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,rl)}addHighlightArea(){this.container.classList.add("highlightArea")}}rl=new WeakMap;var al;class e0 extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,al,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:i,height:n}=Ji(e.rect),r=this.svgFactory.create(i,n,!0),a=e.borderStyle.width,l=v(this,al,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",i/2),l.setAttribute("cy",n/2),l.setAttribute("rx",i/2-a/2),l.setAttribute("ry",n/2-a/2),l.setAttribute("stroke-width",a||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),r.append(l),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,al)}addHighlightArea(){this.container.classList.add("highlightArea")}}al=new WeakMap;var ol;class Fp extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,ol,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,vertices:i,borderStyle:n,popupRef:r}}=this;if(!i)return this.container;const{width:a,height:l}=Ji(e),h=this.svgFactory.create(a,l,!0);let c=[];for(let p=0,g=i.length;p<g;p+=2){const f=i[p]-e[0],m=e[3]-i[p+1];c.push(`${f},${m}`)}c=c.join(" ");const d=v(this,ol,this.svgFactory.createElement(this.svgElementName));return d.setAttribute("points",c),d.setAttribute("stroke-width",n.width||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),h.append(d),this.container.append(h),!r&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return o(this,ol)}addHighlightArea(){this.container.classList.add("highlightArea")}}ol=new WeakMap;class s0 extends Fp{constructor(s){super(s),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class i0 extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
5var ll,Xn,hl,Kc;class Nd extends Ft{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});y(this,hl);y(this,ll,null);y(this,Xn,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?st.HIGHLIGHT:st.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:e,rotation:i,inkLists:n,borderStyle:r,popupRef:a}}=this,{transform:l,width:h,height:c}=A(this,hl,Kc).call(this,i,e),d=this.svgFactory.create(h,c,!0),p=v(this,ll,this.svgFactory.createElement("svg:g"));d.append(p),p.setAttribute("stroke-width",r.width||1),p.setAttribute("stroke-linecap","round"),p.setAttribute("stroke-linejoin","round"),p.setAttribute("stroke-miterlimit",10),p.setAttribute("stroke","transparent"),p.setAttribute("fill","transparent"),p.setAttribute("transform",l);for(let g=0,f=n.length;g<f;g++){const m=this.svgFactory.createElement(this.svgElementName);o(this,Xn).push(m),m.setAttribute("points",n[g].join(",")),p.append(m)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(d),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);const{thickness:i,points:n,rect:r}=e,a=o(this,ll);if(i>=0&&a.setAttribute("stroke-width",i||1),n)for(let l=0,h=o(this,Xn).length;l<h;l++)o(this,Xn)[l].setAttribute("points",n[l].join(","));if(r){const{transform:l,width:h,height:c}=A(this,hl,Kc).call(this,this.data.rotation,r);a.parentElement.setAttribute("viewBox",`0 0 ${h} ${c}`),a.setAttribute("transform",l)}}getElementsToTriggerPopup(){return o(this,Xn)}addHighlightArea(){this.container.classList.add("highlightArea")}}ll=new WeakMap,Xn=new WeakMap,hl=new WeakSet,Kc=function(e,i){switch(e){case 90:return{transform:`rotate(90) translate(${-i[0]},${i[1]}) scale(1,-1)`,width:i[3]-i[1],height:i[2]-i[0]};case 180:return{transform:`rotate(180) translate(${-i[2]},${i[1]}) scale(1,-1)`,width:i[2]-i[0],height:i[3]-i[1]};case 270:return{transform:`rotate(270) translate(${-i[2]},${i[3]}) scale(1,-1)`,width:i[3]-i[1],height:i[2]-i[0]};default:return{transform:`translate(${-i[0]},${i[3]}) scale(1,-1)`,width:i[2]-i[0],height:i[3]-i[1]}}};class Np extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=st.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class n0 extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class r0 extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class a0 extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class Op extends Ft{constructor(s){super(s,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=st.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var cl,dl,Qc;class o0 extends Ft{constructor(e){var n;super(e,{isRenderable:!0});y(this,dl);y(this,cl,null);const{file:i}=this.data;this.filename=i.filename,this.content=i.content,(n=this.linkService.eventBus)==null||n.dispatch("fileattachmentannotation",{source:this,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:i}=this;let n;i.hasAppearance||i.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(100*i.fillAlpha)}%);`)),n.addEventListener("dblclick",A(this,dl,Qc).bind(this)),v(this,cl,n);const{isMac:r}=ge.platform;return e.addEventListener("keydown",(a=>{a.key==="Enter"&&(r?a.metaKey:a.ctrlKey)&&A(this,dl,Qc).call(this)})),!i.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return o(this,cl)}
5addHighlightArea(){this.container.classList.add("highlightArea")}}cl=new WeakMap,dl=new WeakSet,Qc=function(){var e;(e=this.downloadManager)==null||e.openOrDownloadData(this.content,this.filename)};var ul,Yn,Kn,pl,br,Bp,Jc;class l0{constructor({div:s,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:r,viewport:a,structTreeLayer:l}){y(this,br);y(this,ul,null);y(this,Yn,null);y(this,Kn,new Map);y(this,pl,null);this.div=s,v(this,ul,e),v(this,Yn,i),v(this,pl,l||null),this.page=r,this.viewport=a,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return o(this,Kn).size>0}async render(s){var a;const{annotations:e}=s,i=this.div;gr(i,this.viewport);const n=new Map,r={data:null,layer:i,linkService:s.linkService,downloadManager:s.downloadManager,imageResourcesPath:s.imageResourcesPath||"",renderForms:s.renderForms!==!1,svgFactory:new Fd,annotationStorage:s.annotationStorage||new Pd,enableScripting:s.enableScripting===!0,hasJSActions:s.hasJSActions,fieldObjects:s.fieldObjects,parent:this,elements:null};for(const l of e){if(l.noHTML)continue;const h=l.annotationType===_u;if(h){const p=n.get(l.id);if(!p)continue;r.elements=p}else{const{width:p,height:g}=Ji(l.rect);if(p<=0||g<=0)continue}r.data=l;const c=Gm.create(r);if(!c.isRenderable)continue;if(!h&&l.popupRef){const p=n.get(l.popupRef);p?p.push(c):n.set(l.popupRef,[c])}const d=c.render();l.hidden&&(d.style.visibility="hidden"),await A(this,br,Bp).call(this,d,l.id),c._isEditable&&(o(this,Kn).set(c.data.id,c),(a=this._annotationEditorUIManager)==null||a.renderAnnotationElement(c))}A(this,br,Jc).call(this)}update({viewport:s}){const e=this.div;this.viewport=s,gr(e,{rotation:s.rotation}),A(this,br,Jc).call(this),e.hidden=!1}getEditableAnnotations(){return Array.from(o(this,Kn).values())}getEditableAnnotation(s){return o(this,Kn).get(s)}}ul=new WeakMap,Yn=new WeakMap,Kn=new WeakMap,pl=new WeakMap,br=new WeakSet,Bp=async function(s,e){var a,l;const i=s.firstChild||s,n=i.id=`${kd}${e}`,r=await((a=o(this,pl))==null?void 0:a.getAriaAttributes(n));if(r)for(const[h,c]of r)i.setAttribute(h,c);this.div.append(s),(l=o(this,ul))==null||l.moveElementInDOM(this.div,s,i,!1)},Jc=function(){if(!o(this,Yn))return;const s=this.div;for(const[e,i]of o(this,Yn)){const n=s.querySelector(`[data-annotation-id="${e}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:r}=n;r?r.nodeName==="CANVAS"?r.replaceWith(i):r.classList.contains("annotationContent")?r.after(i):r.before(i):n.append(i)}o(this,Yn).clear()};const Vl=/\r\n?|\n/g;var os,Me,fl,Qn,Pe,Ot,Hp,jp,$p,ch,mi,dh,uh,zp,td,Up;const wt=class wt extends Pt{constructor(e){super({...e,name:"freeTextEditor"});y(this,Ot);y(this,os);y(this,Me,"");y(this,fl,`${this.id}-editor`);y(this,Qn,null);y(this,Pe);v(this,os,e.color||wt._defaultColor||Pt._defaultLineColor),v(this,Pe,e.fontSize||wt._defaultFontSize)}static get _keyboardManager(){const e=wt.prototype,i=a=>a.isEmpty(),n=mr.TRANSLATE_SMALL,r=mr.TRANSLATE_BIG;return ot(this,"_keyboardManager",new Fl([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:i}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:i}]]))}static initialize(e,i){Pt.initialize(e,i);const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case lt.FREETEXT_SIZE:wt._defaultFontSize=i;break;case lt.FREETEXT_COLOR:wt._defaultColor=i}}
5updateParams(e,i){switch(e){case lt.FREETEXT_SIZE:A(this,Ot,Hp).call(this,i);break;case lt.FREETEXT_COLOR:A(this,Ot,jp).call(this,i)}}static get defaultPropertiesToUpdate(){return[[lt.FREETEXT_SIZE,wt._defaultFontSize],[lt.FREETEXT_COLOR,wt._defaultColor||Pt._defaultLineColor]]}get propertiesToUpdate(){return[[lt.FREETEXT_SIZE,o(this,Pe)],[lt.FREETEXT_COLOR,o(this,os)]]}_translateEmpty(e,i){this._uiManager.translateSelectedEditors(e,i,!0)}getInitialTranslation(){const e=this.parentScale;return[-wt._internalPadding*e,-(wt._internalPadding+o(this,Pe))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(st.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),v(this,Qn,new AbortController);const e=this._uiManager.combinedSignal(o(this,Qn));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e})}disableEditMode(){var e;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",o(this,fl)),this._isDraggable=!0,(e=o(this,Qn))==null||e.abort(),v(this,Qn,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){var i;this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),(i=this._initialOptions)!=null&&i.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=o(this,Me),i=v(this,Me,A(this,Ot,$p).call(this).trimEnd());if(e===i)return;const n=r=>{v(this,Me,r),r?(A(this,Ot,uh).call(this),this._uiManager.rebuild(this),A(this,Ot,ch).call(this)):this.remove()};this.addCommands({cmd:()=>{n(i)},undo:()=>{n(e)},mustExec:!1}),A(this,Ot,ch).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){wt._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,i;this.width&&(e=this.x,i=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",o(this,fl)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${o(this,Pe)}px * var(--scale-factor))`,n.color=o(this,os),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),Sh(this,this.div,["dblclick","keydown"]),this.width){const[r,a]=this.parentDimensions;
5if(this.annotationElementId){const{position:l}=this._initialData;let[h,c]=this.getInitialTranslation();[h,c]=this.pageTranslationToScreen(h,c);const[d,p]=this.pageDimensions,[g,f]=this.pageTranslation;let m,b;switch(this.rotation){case 0:m=e+(l[0]-g)/d,b=i+this.height-(l[1]-f)/p;break;case 90:m=e+(l[0]-g)/d,b=i-(l[1]-f)/p,[h,c]=[c,-h];break;case 180:m=e-this.width+(l[0]-g)/d,b=i-(l[1]-f)/p,[h,c]=[-h,-c];break;case 270:m=e+(l[0]-g-this.height*p)/d,b=i+(l[1]-f-this.width*d)/p,[h,c]=[-c,h]}this.setAt(m*r,b*a,h,c)}else this.setAt(e*r,i*a,this.width*r,this.height*a);A(this,Ot,uh).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var m,b,w;const i=e.clipboardData||window.clipboardData,{types:n}=i;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();const r=A(m=wt,mi,td).call(m,i.getData("text")||"").replaceAll(Vl,` 6`);if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const l=a.getRangeAt(0);if(!r.includes(` 7`)){l.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:h,startOffset:c}=l,d=[],p=[];if(h.nodeType===Node.TEXT_NODE){const x=h.parentElement;if(p.push(h.nodeValue.slice(c).replaceAll(Vl,"")),x!==this.editorDiv){let _=d;for(const S of this.editorDiv.childNodes)S!==x?_.push(A(b=wt,mi,dh).call(b,S)):_=p}d.push(h.nodeValue.slice(0,c).replaceAll(Vl,""))}else if(h===this.editorDiv){let x=d,_=0;for(const S of this.editorDiv.childNodes)_++===c&&(x=p),x.push(A(w=wt,mi,dh).call(w,S))}v(this,Me,`${d.join(` 8`)}${r}${p.join(` 9`)}`),A(this,Ot,uh).call(this);const g=new Range;let f=d.reduce(((x,_)=>x+_.length),0);for(const{firstChild:x}of this.editorDiv.childNodes)if(x.nodeType===Node.TEXT_NODE){const _=x.nodeValue.length;if(f<=_){g.setStart(x,f),g.setEnd(x,f);break}f-=_}a.removeAllRanges(),a.addRange(g)}get contentDiv(){return this.editorDiv}static async deserialize(e,i,n){var l;let r=null;if(e instanceof Lp){const{data:{defaultAppearanceData:{fontSize:h,fontColor:c},rect:d,rotation:p,id:g,popupRef:f},textContent:m,textPosition:b,parent:{page:{pageNumber:w}}}=e;if(!m||m.length===0)return null;r=e={annotationType:st.FREETEXT,color:Array.from(c),fontSize:h,value:m.join(` 10`),position:b,pageIndex:w-1,rect:d.slice(0),rotation:p,id:g,deleted:!1,popupRef:f}}const a=await super.deserialize(e,i,n);return v(a,Pe,e.fontSize),v(a,os,W.makeHexColor(...e.color)),v(a,Me,A(l=wt,mi,td).call(l,e.value)),a.annotationElementId=e.id||null,a._initialData=r,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i=wt._internalPadding*this.parentScale,n=this.getRect(i,i),r=Pt._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:o(this,os)),a={annotationType:st.FREETEXT,color:r,fontSize:o(this,Pe),value:A(this,Ot,zp).call(this),pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!A(this,Ot,Up).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const i=super.renderAnnotationElement(e);if(this.deleted)return i;const{style:n}=i;n.fontSize=`calc(${o(this,Pe)}px * var(--scale-factor))`,n.color=o(this,os),i.replaceChildren();for(const a of o(this,Me).split(` 11`)){const l=document.createElement("div");l.append(a?document.createTextNode(a):document.createElement("br")),i.append(l)}const r=wt._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(r,r),popupContent:o(this,Me)}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};os=new WeakMap,Me=new WeakMap,fl=new WeakMap,Qn=new WeakMap,Pe=new WeakMap,Ot=new WeakSet,Hp=function(e){const i=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--scale-factor))`,this.translate(0,-(r-o(this,Pe))*this.parentScale),v(this,Pe,r),A(this,Ot,ch).call(this)},n=o(this,Pe);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.FREETEXT_S
11IZE,overwriteIfSameType:!0,keepUndo:!0})},jp=function(e){const i=r=>{v(this,os,this.editorDiv.style.color=r)},n=o(this,os);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},$p=function(){var n;const e=[];this.editorDiv.normalize();let i=null;for(const r of this.editorDiv.childNodes)((i==null?void 0:i.nodeType)!==Node.TEXT_NODE||r.nodeName!=="BR")&&(e.push(A(n=wt,mi,dh).call(n,r)),i=r);return e.join(` 12`)},ch=function(){const[e,i]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:r,div:a}=this,l=a.style.display,h=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",r.div.append(this.div),n=a.getBoundingClientRect(),a.remove(),a.style.display=l,a.classList.toggle("hidden",h)}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/i):(this.width=n.height/e,this.height=n.width/i),this.fixAndSetPosition()},mi=new WeakSet,dh=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Vl,"")},uh=function(){if(this.editorDiv.replaceChildren(),o(this,Me))for(const e of o(this,Me).split(` 13`)){const i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},zp=function(){return o(this,Me).replaceAll("Â "," ")},td=function(e){return e.replaceAll(" ","Â ")},Up=function(e){const{value:i,fontSize:n,color:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==i||e.fontSize!==n||e.color.some(((l,h)=>l!==r[h]))||e.pageIndex!==a},y(wt,mi),et(wt,"_freeTextDefaultContent",""),et(wt,"_internalPadding",0),et(wt,"_defaultColor",null),et(wt,"_defaultFontSize",10),et(wt,"_type","freetext"),et(wt,"_editorType",st.FREETEXT);let Zc=wt;class U{static PRECISION=1e-4;toSVGPath(){At("Abstract method `toSVGPath` must be implemented.")}get box(){At("Abstract getter `box` must be implemented.")}serialize(s,e){At("Abstract method `serialize` must be implemented.")}static _rescale(s,e,i,n,r,a){a||(a=new Float32Array(s.length));for(let l=0,h=s.length;l<h;l+=2)a[l]=e+s[l]*n,a[l+1]=i+s[l+1]*r;return a}static _rescaleAndSwap(s,e,i,n,r,a){a||(a=new Float32Array(s.length));for(let l=0,h=s.length;l<h;l+=2)a[l]=e+s[l+1]*n,a[l+1]=i+s[l]*r;return a}static _translate(s,e,i,n){n||(n=new Float32Array(s.length));for(let r=0,a=s.length;r<a;r+=2)n[r]=e+s[r],n[r+1]=i+s[r+1];return n}static svgRound(s){return Math.round(1e4*s)}static _normalizePoint(s,e,i,n,r){switch(r){case 90:return[1-e/i,s/n];case 180:return[1-s/i,1-e/n];case 270:return[e/i,1-s/n];default:return[s/i,e/n]}}static _normalizePagePoint(s,e,i){switch(i){case 90:return[1-e,s];case 180:return[1-s,1-e];case 270:return[e,1-s];default:return[s,e]}}static createBezierPoints(s,e,i,n,r,a){return[(s+5*i)/6,(e+5*n)/6,(5*i+r)/6,(5*n+a)/6,(i+r)/2,(n+a)/2]}}var Ie,ls,pa,fa,Rs,at,Jn,Zn,gl,ml,ga,ma,$i,vl,zh,Uh,$t,to,Vp,Gp,qp,Wp,Xp,Yp;const zs=class zs{constructor({x:s,y:e},i,n,r,a,l=0){y(this,$t);y(this,Ie);y(this,ls,[]);y(this,pa);y(this,fa);y(this,Rs,[]);y(this,at,new Float32Array(18));y(this,Jn);y(this,Zn);y(this,gl);y(this,ml);y(this,ga);y(this,ma);y(this,$i,[]);v(this,Ie,i),v(this,ma,r*n),v(this,fa,a),o(this,at).set([NaN,NaN,NaN,NaN,s,e],6),v(this,pa,l),v(this,ml,o(zs,vl)*n),v(this,gl,o(zs,Uh)*n),v(this,ga,n),o(this,$i).push(s,e)}isEmpty(){return isNaN(o(this,at)[8])}add({x:s,y:e}){var k;v(this,Jn,s),v(this,Zn,e);const[i,n,r,a]=o(this,Ie);let[l,h,c,d]=o(this,at).subarray(8,12);const p=s-c,g=e-d,f=Math.hypot(p,g);if(f<o(this,gl))return!1;const m=f-o(this,ml),b=m/f,w=b*p,x=b*g;let _=l,S=h;l=c,h=d,c+=w,d+=x,(k=o(this,$i))==null||k.push(s,e);const E=w/m,C=-x/m*o(this,ma),T=E*o(this,ma);return o(this,at).set(o(this,at).subarray(2,8),0),o(this,at).set([c+C,d+T],4),o(this,at).set(o(this,at).subarray(14,18),12),o(this,at).set([c-C,d-T],16),isNaN(o(this,at)[6])?(o(this,Rs).length===0&&(o(this,at).set([l+C,h+T],2),o(this,Rs).push(NaN,NaN,NaN,NaN,(l+C-i)/r,(h+T-n)/a),o(this,at).set([l-C,h-T],14),o(this,ls).push(NaN,NaN,NaN,NaN,(l-C-i)/r,(h-T-n)/a)),o(this,at).set([_,S,l,h,c,d],6
13),!this.isEmpty()):(o(this,at).set([_,S,l,h,c,d],6),Math.abs(Math.atan2(S-h,_-l)-Math.atan2(x,w))<Math.PI/2?([l,h,c,d]=o(this,at).subarray(2,6),o(this,Rs).push(NaN,NaN,NaN,NaN,((l+c)/2-i)/r,((h+d)/2-n)/a),[l,h,_,S]=o(this,at).subarray(14,18),o(this,ls).push(NaN,NaN,NaN,NaN,((_+l)/2-i)/r,((S+h)/2-n)/a),!0):([_,S,l,h,c,d]=o(this,at).subarray(0,6),o(this,Rs).push(((_+5*l)/6-i)/r,((S+5*h)/6-n)/a,((5*l+c)/6-i)/r,((5*h+d)/6-n)/a,((l+c)/2-i)/r,((h+d)/2-n)/a),[c,d,l,h,_,S]=o(this,at).subarray(12,18),o(this,ls).push(((_+5*l)/6-i)/r,((S+5*h)/6-n)/a,((5*l+c)/6-i)/r,((5*h+d)/6-n)/a,((l+c)/2-i)/r,((h+d)/2-n)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const s=o(this,Rs),e=o(this,ls);if(isNaN(o(this,at)[6])&&!this.isEmpty())return A(this,$t,Vp).call(this);const i=[];i.push(`M${s[4]} ${s[5]}`);for(let n=6;n<s.length;n+=6)isNaN(s[n])?i.push(`L${s[n+4]} ${s[n+5]}`):i.push(`C${s[n]} ${s[n+1]} ${s[n+2]} ${s[n+3]} ${s[n+4]} ${s[n+5]}`);A(this,$t,qp).call(this,i);for(let n=e.length-6;n>=6;n-=6)isNaN(e[n])?i.push(`L${e[n+4]} ${e[n+5]}`):i.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);return A(this,$t,Gp).call(this,i),i.join(" ")}newFreeDrawOutline(s,e,i,n,r,a){return new Kp(s,e,i,n,r,a)}getOutlines(){var p,g;const s=o(this,Rs),e=o(this,ls),i=o(this,at),[n,r,a,l]=o(this,Ie),h=new Float32Array(((g=(p=o(this,$i))==null?void 0:p.length)!=null?g:0)+2);for(let f=0,m=h.length-2;f<m;f+=2)h[f]=(o(this,$i)[f]-n)/a,h[f+1]=(o(this,$i)[f+1]-r)/l;if(h[h.length-2]=(o(this,Jn)-n)/a,h[h.length-1]=(o(this,Zn)-r)/l,isNaN(i[6])&&!this.isEmpty())return A(this,$t,Wp).call(this,h);const c=new Float32Array(o(this,Rs).length+24+o(this,ls).length);let d=s.length;for(let f=0;f<d;f+=2)isNaN(s[f])?c[f]=c[f+1]=NaN:(c[f]=s[f],c[f+1]=s[f+1]);d=A(this,$t,Yp).call(this,c,d);for(let f=e.length-6;f>=6;f-=6)for(let m=0;m<6;m+=2)isNaN(e[f+m])?(c[d]=c[d+1]=NaN,d+=2):(c[d]=e[f+m],c[d+1]=e[f+m+1],d+=2);return A(this,$t,Xp).call(this,c,d),this.newFreeDrawOutline(c,h,o(this,Ie),o(this,ga),o(this,pa),o(this,fa))}};Ie=new WeakMap,ls=new WeakMap,pa=new WeakMap,fa=new WeakMap,Rs=new WeakMap,at=new WeakMap,Jn=new WeakMap,Zn=new WeakMap,gl=new WeakMap,ml=new WeakMap,ga=new WeakMap,ma=new WeakMap,$i=new WeakMap,vl=new WeakMap,zh=new WeakMap,Uh=new WeakMap,$t=new WeakSet,to=function(){const s=o(this,at).subarray(4,6),e=o(this,at).subarray(16,18),[i,n,r,a]=o(this,Ie);return[(o(this,Jn)+(s[0]-e[0])/2-i)/r,(o(this,Zn)+(s[1]-e[1])/2-n)/a,(o(this,Jn)+(e[0]-s[0])/2-i)/r,(o(this,Zn)+(e[1]-s[1])/2-n)/a]},Vp=function(){const[s,e,i,n]=o(this,Ie),[r,a,l,h]=A(this,$t,to).call(this);return`M${(o(this,at)[2]-s)/i} ${(o(this,at)[3]-e)/n} L${(o(this,at)[4]-s)/i} ${(o(this,at)[5]-e)/n} L${r} ${a} L${l} ${h} L${(o(this,at)[16]-s)/i} ${(o(this,at)[17]-e)/n} L${(o(this,at)[14]-s)/i} ${(o(this,at)[15]-e)/n} Z`},Gp=function(s){const e=o(this,ls);s.push(`L${e[4]} ${e[5]} Z`)},qp=function(s){const[e,i,n,r]=o(this,Ie),a=o(this,at).subarray(4,6),l=o(this,at).subarray(16,18),[h,c,d,p]=A(this,$t,to).call(this);s.push(`L${(a[0]-e)/n} ${(a[1]-i)/r} L${h} ${c} L${d} ${p} L${(l[0]-e)/n} ${(l[1]-i)/r}`)},Wp=function(s){const e=o(this,at),[i,n,r,a]=o(this,Ie),[l,h,c,d]=A(this,$t,to).call(this),p=new Float32Array(36);return p.set([NaN,NaN,NaN,NaN,(e[2]-i)/r,(e[3]-n)/a,NaN,NaN,NaN,NaN,(e[4]-i)/r,(e[5]-n)/a,NaN,NaN,NaN,NaN,l,h,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,(e[16]-i)/r,(e[17]-n)/a,NaN,NaN,NaN,NaN,(e[14]-i)/r,(e[15]-n)/a],0),this.newFreeDrawOutline(p,s,o(this,Ie),o(this,ga),o(this,pa),o(this,fa))},Xp=function(s,e){const i=o(this,ls);return s.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6},Yp=function(s,e){const i=o(this,at).subarray(4,6),n=o(this,at).subarray(16,18),[r,a,l,h]=o(this,Ie),[c,d,p,g]=A(this,$t,to).call(this);return s.set([NaN,NaN,NaN,NaN,(i[0]-r)/l,(i[1]-a)/h,NaN,NaN,NaN,NaN,c,d,NaN,NaN,NaN,NaN,p,g,NaN,NaN,NaN,NaN,(n[0]-r)/l,(n[1]-a)/h],e),e+24},y(zs,vl,8),y(zs,zh,2),y(zs,Uh,o(zs,vl)+o(zs,zh));let Th=zs;var va,tr,li,bl,De,yl,Lt,Vh,Qp;class Kp extends U{constructor(e,i,n,r,a,l){super();y(this,Vh);y(this,va);y(this,tr,new Float32Array(4));y(this,li);y(this,bl);y(this,De);y(this,yl);y(this,Lt);v(this,Lt,e),v(this,De,i),v(this,va,n),v(this,yl,r),v(this,li,a),v(this,bl,l),this.lastPoint=[NaN,NaN],A(this,Vh,Qp).c
13all(this,l);const[h,c,d,p]=o(this,tr);for(let g=0,f=e.length;g<f;g+=2)e[g]=(e[g]-h)/d,e[g+1]=(e[g+1]-c)/p;for(let g=0,f=i.length;g<f;g+=2)i[g]=(i[g]-h)/d,i[g+1]=(i[g+1]-c)/p}toSVGPath(){const e=[`M${o(this,Lt)[4]} ${o(this,Lt)[5]}`];for(let i=6,n=o(this,Lt).length;i<n;i+=6)isNaN(o(this,Lt)[i])?e.push(`L${o(this,Lt)[i+4]} ${o(this,Lt)[i+5]}`):e.push(`C${o(this,Lt)[i]} ${o(this,Lt)[i+1]} ${o(this,Lt)[i+2]} ${o(this,Lt)[i+3]} ${o(this,Lt)[i+4]} ${o(this,Lt)[i+5]}`);return e.push("Z"),e.join(" ")}serialize([e,i,n,r],a){const l=n-e,h=r-i;let c,d;switch(a){case 0:c=U._rescale(o(this,Lt),e,r,l,-h),d=U._rescale(o(this,De),e,r,l,-h);break;case 90:c=U._rescaleAndSwap(o(this,Lt),e,i,l,h),d=U._rescaleAndSwap(o(this,De),e,i,l,h);break;case 180:c=U._rescale(o(this,Lt),n,i,-l,h),d=U._rescale(o(this,De),n,i,-l,h);break;case 270:c=U._rescaleAndSwap(o(this,Lt),n,r,-l,-h),d=U._rescaleAndSwap(o(this,De),n,r,-l,-h)}return{outline:Array.from(c),points:[Array.from(d)]}}get box(){return o(this,tr)}newOutliner(e,i,n,r,a,l=0){return new Th(e,i,n,r,a,l)}getNewOutline(e,i){const[n,r,a,l]=o(this,tr),[h,c,d,p]=o(this,va),g=a*d,f=l*p,m=n*d+h,b=r*p+c,w=this.newOutliner({x:o(this,De)[0]*g+m,y:o(this,De)[1]*f+b},o(this,va),o(this,yl),e,o(this,bl),i!=null?i:o(this,li));for(let x=2;x<o(this,De).length;x+=2)w.add({x:o(this,De)[x]*g+m,y:o(this,De)[x+1]*f+b});return w.getOutlines()}}va=new WeakMap,tr=new WeakMap,li=new WeakMap,bl=new WeakMap,De=new WeakMap,yl=new WeakMap,Lt=new WeakMap,Vh=new WeakSet,Qp=function(e){const i=o(this,Lt);let n=i[4],r=i[5],a=n,l=r,h=n,c=r,d=n,p=r;const g=e?Math.max:Math.min;for(let m=6,b=i.length;m<b;m+=6){if(isNaN(i[m]))a=Math.min(a,i[m+4]),l=Math.min(l,i[m+5]),h=Math.max(h,i[m+4]),c=Math.max(c,i[m+5]),p<i[m+5]?(d=i[m+4],p=i[m+5]):p===i[m+5]&&(d=g(d,i[m+4]));else{const w=W.bezierBoundingBox(n,r,...i.slice(m,m+6));a=Math.min(a,w[0]),l=Math.min(l,w[1]),h=Math.max(h,w[2]),c=Math.max(c,w[3]),p<w[3]?(d=w[2],p=w[3]):p===w[3]&&(d=g(d,w[2]))}n=i[m+4],r=i[m+5]}const f=o(this,tr);f[0]=a-o(this,li),f[1]=l-o(this,li),f[2]=h-a+2*o(this,li),f[3]=c-l+2*o(this,li),this.lastPoint=[d,p]};var Al,wl,zi,hs,ve,Jp,ph,Zp,tf,sd;class ed{constructor(s,e=0,i=0,n=!0){y(this,ve);y(this,Al);y(this,wl);y(this,zi,[]);y(this,hs,[]);let r=1/0,a=-1/0,l=1/0,h=-1/0;const c=10**-4;for(const{x:w,y:x,width:_,height:S}of s){const E=Math.floor((w-e)/c)*c,C=Math.ceil((w+_+e)/c)*c,T=Math.floor((x-e)/c)*c,k=Math.ceil((x+S+e)/c)*c,I=[E,T,k,!0],P=[C,T,k,!1];o(this,zi).push(I,P),r=Math.min(r,E),a=Math.max(a,C),l=Math.min(l,T),h=Math.max(h,k)}const d=a-r+2*i,p=h-l+2*i,g=r-i,f=l-i,m=o(this,zi).at(n?-1:-2),b=[m[0],m[2]];for(const w of o(this,zi)){const[x,_,S]=w;w[0]=(x-g)/d,w[1]=(_-f)/p,w[2]=(S-f)/p}v(this,Al,new Float32Array([g,f,d,p])),v(this,wl,b)}getOutlines(){o(this,zi).sort(((e,i)=>e[0]-i[0]||e[1]-i[1]||e[2]-i[2]));const s=[];for(const e of o(this,zi))e[3]?(s.push(...A(this,ve,sd).call(this,e)),A(this,ve,Zp).call(this,e)):(A(this,ve,tf).call(this,e),s.push(...A(this,ve,sd).call(this,e)));return A(this,ve,Jp).call(this,s)}}Al=new WeakMap,wl=new WeakMap,zi=new WeakMap,hs=new WeakMap,ve=new WeakSet,Jp=function(s){const e=[],i=new Set;for(const a of s){const[l,h,c]=a;e.push([l,h,a],[l,c,a])}e.sort(((a,l)=>a[1]-l[1]||a[0]-l[0]));for(let a=0,l=e.length;a<l;a+=2){const h=e[a][2],c=e[a+1][2];h.push(c),c.push(h),i.add(h),i.add(c)}const n=[];let r;for(;i.size>0;){const a=i.values().next().value;let[l,h,c,d,p]=a;i.delete(a);let g=l,f=h;for(r=[l,c],n.push(r);;){let m;if(i.has(d))m=d;else{if(!i.has(p))break;m=p}i.delete(m),[l,h,c,d,p]=m,g!==l&&(r.push(g,f,l,f===h?h:c),g=l),f=f===h?c:h}r.push(g,f)}return new h0(n,o(this,Al),o(this,wl))},ph=function(s){const e=o(this,hs);let i=0,n=e.length-1;for(;i<=n;){const r=i+n>>1,a=e[r][0];if(a===s)return r;a<s?i=r+1:n=r-1}return n+1},Zp=function([,s,e]){const i=A(this,ve,ph).call(this,s);o(this,hs).splice(i,0,[s,e])},tf=function([,s,e]){const i=A(this,ve,ph).call(this,s);for(let n=i;n<o(this,hs).length;n++){const[r,a]=o(this,hs)[n];if(r!==s)break;if(r===s&&a===e){o(this,hs).splice(n,1);return}}for(let n=i-1;n>=0;n--){const[r,a]=o(this,hs)[n];if(r!==s)break;if(r===s&&a===e){o(this,hs).splice(n,1);return}}},sd=function(s){const[e,i,n]=s,r=[[e,i,n]],a=A(this,ve,ph).call(this,n);for(let l=0;l<a;l++){const[h,c]=o(this,hs)[l];for(let d=0,p=r.length;d<p;d++){const[,g,f]=r[d];if(!(c<=g||f<=h))if(g>=h)if(f>c)r[d][1]=c;else{if(p===1)return[];r.splice(d,1),d--,p--}else r[d][2]=h,f>c&&r.push([e,c,f])}}return r};var xl,ba;class h0 extends U{constructor(e,i,n){super();y(this,xl);y(this,ba);v(this,ba,e),v(this,xl,i),this.lastPoint=n}toSVGPath(){const e=[];for(const i of o(this,ba)){let[n,r]=i;e.push(`M${n} ${r}`);for(let a=2;a<i.length;a+=2){const l=i[a],h=i[a+1];l===n?(e.push(`V${h}`),r=h):h===r&&(e.push(`H${l}`),n=l)}e.push("Z")}return e.join(" ")}serialize([e,i,n,r],a){const l=[],h=n-e,c=r-i;for(const d of o(this,ba)){const p=new Array(d.length);for(let g=0;g<d.length;g+=2)p[g]=e+d[g]*h,p[g+1]=r-d[g+1]*c;l.push(p)}return l}get box(){return o(this,xl)}get classNamesForOutlining(){return["highlightOutline"]}}xl=new WeakMap,ba=new WeakMap;class id extends Th{newFreeDrawOutline(s,e,i,n,r,a){return new c0(s,e,i,n,r,a)}}class c0 extends Kp{newOutliner(s,e,i,n,r,a=0){return new id(s,e,i,n,r,a)}}var cs,er,ya,jt,_l,Aa,Sl,El,Ui,ds,wa,Cl,bt,nd,rd,ad,nn,ef,Ai;const we=class we{constructor({editor:s=null,uiManager:e=null}){y(this,bt);y(this,cs,null);y(this,er,null);y(this,ya);y(this,jt,null);y(this,_l,!1);y(this,Aa,!1);y(this,Sl,null);y(this,El);y(this,Ui,null);y(this,ds,null);y(this,wa);var i;s?(v(this,Aa,!1),v(this,wa,lt.HIGHLIGHT_COLOR),v(this,Sl,s)):(v(this,Aa,!0),v(this,wa,lt.HIGHLIGHT_DEFAULT_COLOR)),v(this,ds,(s==null?void 0:s._uiManager)||e),v(this,El,o(this,ds)._eventBus),v(this,ya,(s==null?void 0:s.color)||((i=o(this,ds))==null?void 0:i.highlightColors.values().next().value)||"#FFFF98"),o(we,Cl)||v(we,Cl,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return ot(this,"_keyboardManager",new Fl([[["Escape","mac+Escape"],we.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],we.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],we.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],we.prototype._moveToPrevious],[["Home","mac+Home"],we.prototype._moveToBeginning],[["End","mac+End"],we.prototype._moveToEnd]]))}renderButton(){const s=v(this,cs,document.createElement("button"));
13s.className="colorPicker",s.tabIndex="0",s.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),s.setAttribute("aria-haspopup",!0);const e=o(this,ds)._signal;s.addEventListener("click",A(this,bt,nn).bind(this),{signal:e}),s.addEventListener("keydown",A(this,bt,ad).bind(this),{signal:e});const i=v(this,er,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=o(this,ya),s.append(i),s}renderMainDropdown(){const s=v(this,jt,A(this,bt,nd).call(this));return s.setAttribute("aria-orientation","horizontal"),s.setAttribute("aria-labelledby","highlightColorPickerLabel"),s}_colorSelectFromKeyboard(s){if(s.target===o(this,cs)){A(this,bt,nn).call(this,s);return}const e=s.target.getAttribute("data-color");e&&A(this,bt,rd).call(this,e,s)}_moveToNext(s){var e,i;o(this,bt,Ai)?s.target!==o(this,cs)?(e=s.target.nextSibling)==null||e.focus():(i=o(this,jt).firstChild)==null||i.focus():A(this,bt,nn).call(this,s)}_moveToPrevious(s){var e,i;s.target!==((e=o(this,jt))==null?void 0:e.firstChild)&&s.target!==o(this,cs)?(o(this,bt,Ai)||A(this,bt,nn).call(this,s),(i=s.target.previousSibling)==null||i.focus()):o(this,bt,Ai)&&this._hideDropdownFromKeyboard()}_moveToBeginning(s){var e;o(this,bt,Ai)?(e=o(this,jt).firstChild)==null||e.focus():A(this,bt,nn).call(this,s)}_moveToEnd(s){var e;o(this,bt,Ai)?(e=o(this,jt).lastChild)==null||e.focus():A(this,bt,nn).call(this,s)}hideDropdown(){var s,e;(s=o(this,jt))==null||s.classList.add("hidden"),(e=o(this,Ui))==null||e.abort(),v(this,Ui,null)}_hideDropdownFromKeyboard(){var s;o(this,Aa)||(o(this,bt,Ai)?(this.hideDropdown(),o(this,cs).focus({preventScroll:!0,focusVisible:o(this,_l)})):(s=o(this,Sl))==null||s.unselect())}updateColor(s){if(o(this,er)&&(o(this,er).style.backgroundColor=s),!o(this,jt))return;const e=o(this,ds).highlightColors.values();for(const i of o(this,jt).children)i.setAttribute("aria-selected",e.next().value===s)}destroy(){var s,e;(s=o(this,cs))==null||s.remove(),v(this,cs,null),v(this,er,null),(e=o(this,jt))==null||e.remove(),v(this,jt,null)}};cs=new WeakMap,er=new WeakMap,ya=new WeakMap,jt=new WeakMap,_l=new WeakMap,Aa=new WeakMap,Sl=new WeakMap,El=new WeakMap,Ui=new WeakMap,ds=new WeakMap,wa=new WeakMap,Cl=new WeakMap,bt=new WeakSet,nd=function(){const s=document.createElement("div"),e=o(this,ds)._signal;s.addEventListener("contextmenu",gs,{signal:e}),s.className="dropdown",s.role="listbox",s.setAttribute("aria-multiselectable",!1),s.setAttribute("aria-orientation","vertical"),s.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[i,n]of o(this,ds).highlightColors){const r=document.createElement("button");r.tabIndex="0",r.role="option",r.setAttribute("data-color",n),r.title=i,r.setAttribute("data-l10n-id",o(we,Cl)[i]);const a=document.createElement("span");r.append(a),a.className="swatch",a.style.backgroundColor=n,r.setAttribute("aria-selected",n===o(this,ya)),r.addEventListener("click",A(this,bt,rd).bind(this,n),{signal:e}),s.append(r)}return s.addEventListener("keydown",A(this,bt,ad).bind(this),{signal:e}),s},rd=function(s,e){e.stopPropagation(),o(this,El).dispatch("switchannotationeditorparams",{source:this,type:o(this,wa),value:s})},ad=function(s){we._keyboardManager.exec(this,s)},nn=function(s){if(o(this,bt,Ai)){this.hideDropdown();return}if(v(this,_l,s.detail===0),o(this,Ui)||(v(this,Ui,new AbortController),window.addEventListener("pointerdown",A(this,bt,ef).bind(this),{signal:o(this,ds).combinedSignal(o(this,Ui))})),o(this,jt)){o(this,jt).classList.remove("hidden");return}const e=v(this,jt,A(this,bt,nd).call(this));o(this,cs).append(e)},ef=function(s){var e;(e=o(this,jt))!=null&&e.contains(s.target)||this.hideDropdown()},Ai=function(){return o(this,jt)&&!o(this,jt).classList.contains("hidden")},y(we,Cl,null);let Rh=we;var xa,kl,hi,sr,_a,Se,Tl,Rl,ir,qe,Le,Jt,Sa,ci,ae,Ea,We,Ml,tt,od,fh,sf,nf,rf,ld,rn,Qe,Er,af,gh,eo,of,lf,hf,cf,df;const pt=class pt extends Pt{constructor(e){super({...e,name:"highlightEditor"});y(this,tt);y(this,xa,null);y(this,kl,0);y(this,hi);y(this,sr,null);y(this,_a,null);y(this,Se,null);y(this,Tl,null);y(this,Rl,0);y(this,ir,null);y(this,qe,null);y(this,Le,null);y(this,Jt,!1);y(this,Sa,null);y(this,ci);y(this,ae,null);y(this,Ea,"");y(this,We);y(this,Ml,"");this.color=e.color||pt._defaultColor,v(this,We,e.thickness||pt._defaultThickness),v(this,ci,e.opacity||pt._defaultOpacity),v(this,hi,e.boxes||null),v(this,Ml,e.methodOfCreation||""),v(this,Ea,e.text||""),this._isDraggable=!1,e.highlightId>-1?(v(this,Jt,!0),A(this,tt,fh).call(this,e),A(this,tt,rn).call(this)):o(this,hi)&&(v(this,xa,e.anchorNode),v(this,kl,e.anchorOffset),v(this,Tl,e.focusNode),v(this,Rl,e.focusOffset),A(this,tt,od).call(this),A(this,tt,rn).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const e=pt.prototype;return ot(this,"_keyboardManager",new Fl([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:o(this,Jt)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:o(this,We),methodOfCreation:o(this,Ml)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("
13color").size}}static initialize(e,i){var n;Pt.initialize(e,i),pt._defaultColor||(pt._defaultColor=((n=i.highlightColors)==null?void 0:n.values().next().value)||"#fff066")}static updateDefaultParams(e,i){switch(e){case lt.HIGHLIGHT_DEFAULT_COLOR:pt._defaultColor=i;break;case lt.HIGHLIGHT_THICKNESS:pt._defaultThickness=i}}translateInPage(e,i){}get toolbarPosition(){return o(this,Sa)}updateParams(e,i){switch(e){case lt.HIGHLIGHT_COLOR:A(this,tt,sf).call(this,i);break;case lt.HIGHLIGHT_THICKNESS:A(this,tt,nf).call(this,i)}}static get defaultPropertiesToUpdate(){return[[lt.HIGHLIGHT_DEFAULT_COLOR,pt._defaultColor],[lt.HIGHLIGHT_THICKNESS,pt._defaultThickness]]}get propertiesToUpdate(){return[[lt.HIGHLIGHT_COLOR,this.color||pt._defaultColor],[lt.HIGHLIGHT_THICKNESS,o(this,We)||pt._defaultThickness],[lt.HIGHLIGHT_FREE,o(this,Jt)]]}async addEditToolbar(){const e=await super.addEditToolbar();return e?(this._uiManager.highlightColors&&(v(this,_a,new Rh({editor:this})),e.addColorPicker(o(this,_a))),e):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(A(this,tt,eo).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,A(this,tt,eo).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){A(this,tt,ld).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,tt,rn).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var n;let i=!1;this.parent&&!e?A(this,tt,ld).call(this):e&&(A(this,tt,rn).call(this,e),i=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(e),this.show(this._isVisible),i&&this.select()}rotate(e){var r,a,l;const{drawLayer:i}=this.parent;let n;o(this,Jt)?(e=(e-this.rotation+360)%360,n=A(r=pt,Qe,Er).call(r,o(this,qe).box,e)):n=A(a=pt,Qe,Er).call(a,[this.x,this.y,this.width,this.height],e),i.updateProperties(o(this,Le),{bbox:n,root:{"data-main-rotation":e}}),i.updateProperties(o(this,ae),{bbox:A(l=pt,Qe,Er).call(l,o(this,Se).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;const e=super.render();o(this,Ea)&&(e.setAttribute("aria-label",o(this,Ea)),e.setAttribute("role","mark")),o(this,Jt)?e.classList.add("free"):this.div.addEventListener("keydown",A(this,tt,af).bind(this),{signal:this._uiManager._signal});const i=v(this,ir,document.createElement("div"));e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=o(this,sr);const[n,r]=this.parentDimensions;return this.setDims(this.width*n,this.height*r),Sh(this,o(this,ir),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){var e;this.isSelected||((e=this.parent)==null||e.drawLayer.updateProperties(o(this,ae),{rootClass:{hovered:!0}}))}pointerleave(){var e;this.isSelected||((e=this.parent)==null||e.drawLayer.updateProperties(o(this,ae),{rootClass:{hovered:!1}}))}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:A(this,tt,gh).call(this,!0);break;case 1:case 3:A(this,tt,gh).call(this,!1)}}select(){var e;super.select(),o(this,ae)&&((e=this.parent)==null||e.drawLayer.updateProperties(o(this,ae),{rootClass:{hovered:!1,selected:!0}}))}unselect(){var e;super.unselect(),o(this,ae)&&((e=this.parent)==null||e.drawLayer.updateProperties(o(this,ae),{rootClass:{selected:!1}}),o(this,Jt)||A(this,tt,gh).call(this,!1))}get _mustFixPosition(){return!o(this,Jt)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(o(this,Le),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(o(this,ae),{rootClass:{hidden:!e}}))}static startHighlighting(e,i,{target:n,x:r,y:a}){const{x:l,y:h,width:c,height:d}=n.getBoundingClientRect(),p=new AbortController,g=e.combinedSignal(p),f=m=>{p.abort(),A(this,Qe,cf).call(this,e,m)};window.addEventListener("blur",f,{signal:g}),window.addEventListener("pointerup",f,{signal:g}),window.addEventListener("pointerdown",je,{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",gs,{signal:g}),n.addEventListener("pointermove",A(this,Qe,hf).bind(this,e),{signal:g}),this._freeHighlight=new id({x:r,y:a},[l,h,c,d],e.scale,this._defaultThickness/2,i,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,i,n){var b,w,x,_;let r=null;if(e instanceof Np){const{data:{quadPoints:S,rect:E,rotation:C,id:T,color:k,opacity:I,popupRef:P},parent:{page:{pageNumber:N}}}=e;r=e={annotationType:st.HIGHLIGHT,color:Array.from(k),opacity:I,quadPoints:S,boxes:null,pageIndex:N-1,rect:E.slice(0),rotation:C,id:T,deleted:!1,popupRef:P}}else if(e instanceof Nd){const{data:{inkLists:S,rect:E,rotation:C,id:T,color:k,borderStyle:{rawWidth:I},popupRef:P},parent:{page:{pageNumber:N}}}=e;r=e={annotationType:st.HIGHLIGHT,color:Array.from(k),thickness:I,inkLists:S,boxes:null,pageIndex:N-1,rect:E.slice(0),rotation:C,id:T,deleted:!1,popupRef:P}}const{color:a,quadPoints:l,inkLists:h,opacity:c}=e,d=await super.deserialize(e,i,n);d.color=W.makeHexColor(...a),v(d,ci,c||1),h&&v(d,We,e.thickness),d.annotationElementId=e.id||null,d._initialData=r;const[p,g]=d.pageDimensions,[f,m]=d.pageTranslation;if(l){const S=v(d,hi,[]);for(let E=0;E<l.length;E+=8)S.push({x:(l[E]-f)/p,y:1-(l[E+1]-m)/g,width:(l[E+2]-l[E])/p,height:(l[E+1]-l[E+5])/g});A(b=d,tt,od).call(b),A(w=d,tt,rn).call(w),d.rotate(d.rotation)}
13else if(h){v(d,Jt,!0);const S=h[0],E={x:S[0]-f,y:g-(S[1]-m)},C=new id(E,[0,0,p,g],1,o(d,We)/2,!0,.001);for(let I=0,P=S.length;I<P;I+=2)E.x=S[I]-f,E.y=g-(S[I+1]-m),C.add(E);const{id:T,clipPathId:k}=i.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:C.toSVGPath()}},!0,!0);A(x=d,tt,fh).call(x,{highlightOutlines:C.getOutlines(),highlightId:T,clipPathId:k}),A(_=d,tt,rn).call(_)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();const i=this.getRect(0,0),n=Pt._colorManager.convert(this.color),r={annotationType:st.HIGHLIGHT,color:n,opacity:o(this,ci),thickness:o(this,We),quadPoints:A(this,tt,of).call(this),outlines:A(this,tt,lf).call(this,i),pageIndex:this.pageIndex,rect:i,rotation:A(this,tt,eo).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!A(this,tt,df).call(this,r)?null:(r.id=this.annotationElementId,r)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};xa=new WeakMap,kl=new WeakMap,hi=new WeakMap,sr=new WeakMap,_a=new WeakMap,Se=new WeakMap,Tl=new WeakMap,Rl=new WeakMap,ir=new WeakMap,qe=new WeakMap,Le=new WeakMap,Jt=new WeakMap,Sa=new WeakMap,ci=new WeakMap,ae=new WeakMap,Ea=new WeakMap,We=new WeakMap,Ml=new WeakMap,tt=new WeakSet,od=function(){const e=new ed(o(this,hi),.001);v(this,qe,e.getOutlines()),[this.x,this.y,this.width,this.height]=o(this,qe).box;const i=new ed(o(this,hi),.0025,.001,this._uiManager.direction==="ltr");v(this,Se,i.getOutlines());const{lastPoint:n}=o(this,Se);v(this,Sa,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height])},fh=function({highlightOutlines:e,highlightId:i,clipPathId:n}){var d,p;if(v(this,qe,e),v(this,Se,e.getNewOutline(o(this,We)/2+1.5,.0025)),i>=0)v(this,Le,i),v(this,sr,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),v(this,ae,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:o(this,Se).box,path:{d:o(this,Se).toSVGPath()}},!0));else if(this.parent){const g=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(o(this,Le),{bbox:A(d=pt,Qe,Er).call(d,o(this,qe).box,(g-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(o(this,ae),{bbox:A(p=pt,Qe,Er).call(p,o(this,Se).box,g),path:{d:o(this,Se).toSVGPath()}})}const[r,a,l,h]=e.box;switch(this.rotation){case 0:this.x=r,this.y=a,this.width=l,this.height=h;break;case 90:{const[g,f]=this.parentDimensions;this.x=a,this.y=1-r,this.width=l*f/g,this.height=h*g/f;break}case 180:this.x=1-r,this.y=1-a,this.width=l,this.height=h;break;case 270:{const[g,f]=this.parentDimensions;this.x=1-a,this.y=r,this.width=l*f/g,this.height=h*g/f;break}}const{lastPoint:c}=o(this,Se);v(this,Sa,[(c[0]-r)/l,(c[1]-a)/h])},sf=function(e){const i=(a,l)=>{var h,c;this.color=a,v(this,ci,l),(h=this.parent)==null||h.drawLayer.updateProperties(o(this,Le),{root:{fill:a,"fill-opacity":l}}),(c=o(this,_a))==null||c.updateColor(a)},n=this.color,r=o(this,ci);this.addCommands({cmd:i.bind(this,e,pt._defaultOpacity),undo:i.bind(this,n,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(e)},!0)},nf=function(e){const i=o(this,We),n=r=>{v(this,We,r),A(this,tt,rf).call(this,r)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:lt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},rf=function(e){if(!o(this,Jt))return;A(this,tt,fh).call(this,{highlightOutlines:o(this,qe).getNewOutline(e/2)}),this.fixAndSetPosition();const[i,n]=this.parentDimensions;this.setDims(this.width*i,this.height*n)},ld=function(){o(this,Le)!==null&&this.parent&&(this.parent.drawLayer.remove(o(this,Le)),v(this,Le,null),this.parent.drawLayer.remove(o(this,ae)),v(this,ae,null))},rn=function(e=this.parent){o(this,Le)===null&&({id:be(this,Le)._,clipPathId:be(this,sr)._}=e.drawLayer.draw({bbox:o(this,qe).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":o(this,ci)},rootClass:{highlight:!0,free:o(this,Jt)},path:{d:o(this,qe).toSVGPath()}},!1,!0),v(this,ae,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:o(this,Jt)},bbox:o(this,Se).box,path:{d:o(this,Se).toSVGPath()}},o(this,Jt))),o(this,ir)&&(o(this,ir).style.clipPath=o(this,sr)))},Qe=new WeakSet,Er=function([e,i,n,r],a){switch(a){case 90:return[1-i-r,e,r,n];case 180:return[1-e-n,1-i-r,n,r];case 270:return[i,1-e-n,r,n]}return[e,i,n,r]},af=function(e){pt._keyboardManager.exec(this,e)},gh=function(e){if(!o(this,xa))return;const i=window.getSelection();e?i.setPosition(o(this,xa),o(this,kl)):i.setPosition(o(this,Tl),o(this,Rl))},eo=function(){return o(this,Jt)?this.rotation:0},of=function(){if(o(this,Jt))return null;const[e,i]=this.pageDimensions,[n,r]=this.pageTranslation,a=o(this,hi),l=new Float32Array(8*a.length);let h=0;for(const{x:c,y:d,width:p,height:g}of a){const f=c*e+n,m=(1-d)*i+r;l[h]=l[h+4]=f,l[h+1]=l[h+3]=m,l[h+2]=l[h+6]=f+p*e,l[h+5]=l[h+7]=m-g*i,h+=8}return l},lf=function(e){return o(this,qe).serialize(e,A(this,tt,eo).call(this))},hf=function(e,i){this._freeHighlight.add(i)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},cf=function(e,i){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(i,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},df=function(e){const{color:i}=this._initialData;return e.color.some(((n,r)=>n!==i[r]))},y(pt,Qe),et(pt,"_defaultColor",null),et(pt,"_defaultOpacity",1),et(pt,"_defaultThickness",12),et(pt,"_type","highlight"),et(pt,"_editorType",st.HIGHLIGHT),et(pt,"_freeHighlightId",-1),et(pt,"_freeHighlight",null),et(pt,"_freeHighlightClipId","");let Mh=pt;var nr;class d0{constructor(){y(this,nr,Object.create(null))}updateProperty(s,e){this[s]=e,this.updateSVGProperty(s,e)}updateProperties(s){if(s)for(const[e,i]of Object.entries(s))this.updateProperty(e,i)}updateSVGProperty(s,e){o(this,nr)[s]=e}toSVGProperties(){const s=o(this,nr);return v(this,nr,Object.create(null)),{root:s}}reset(){v(this,nr,Object.create(null))}updateAll(s=this){this.updateProperties(s)}clone(){At("Not implemented")}}nr=new WeakMap;var Fe,Ca,qt,rr,ar,Vi,Gi,qi,or,ct,cd,dd,ud,so,uf,mh,io,Cr;const z=class z extends Pt{constructor(e){super(e);y(this,ct);y(this,Fe,null);y(this,Ca);et(this,"_drawId",null);
13v(this,Ca,e.mustBeCommitted||!1),e.drawOutlines&&(A(this,ct,cd).call(this,e),A(this,ct,so).call(this))}static _mergeSVGProperties(e,i){const n=new Set(Object.keys(e));for(const[r,a]of Object.entries(i))n.has(r)?Object.assign(e[r],a):e[r]=a;return e}static getDefaultDrawingOptions(e){At("Not implemented")}static get typesMap(){At("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,i){const n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,i),this._currentParent&&(o(z,qt).updateProperty(n,i),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,i){const n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,i)}static get defaultPropertiesToUpdate(){const e=[],i=this._defaultDrawingOptions;for(const[n,r]of this.typesMap)e.push([n,i[r]]);return e}get propertiesToUpdate(){const e=[],{_drawingOptions:i}=this;for(const[n,r]of this.constructor.typesMap)e.push([n,i[r]]);return e}_updateProperty(e,i,n){const r=this._drawingOptions,a=r[i],l=h=>{var d;r.updateProperty(i,h);const c=o(this,Fe).updateProperty(i,h);c&&A(this,ct,io).call(this,c),(d=this.parent)==null||d.drawLayer.updateProperties(this._drawId,r.toSVGProperties())};this.addCommands({cmd:l.bind(this,n),undo:l.bind(this,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,z._mergeSVGProperties(o(this,Fe).getPathResizingSVGProperties(A(this,ct,mh).call(this)),{bbox:A(this,ct,Cr).call(this)}))}_onResized(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,z._mergeSVGProperties(o(this,Fe).getPathResizedSVGProperties(A(this,ct,mh).call(this)),{bbox:A(this,ct,Cr).call(this)}))}_onTranslating(e,i){var n;(n=this.parent)==null||n.drawLayer.updateProperties(this._drawId,{bbox:A(this,ct,Cr).call(this,e,i)})}_onTranslated(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,z._mergeSVGProperties(o(this,Fe).getPathTranslatedSVGProperties(A(this,ct,mh).call(this),this.parentDimensions),{bbox:A(this,ct,Cr).call(this)}))}_onStartDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){var e;(e=this.parent)==null||e.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,o(this,Ca)&&(v(this,Ca,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){A(this,ct,ud).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(A(this,ct,so).call(this),A(this,ct,io).call(this,o(this,Fe).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){var n;let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),A(this,ct,ud).call(this)):e&&(this._uiManager.addShouldRescale(this),A(this,ct,so).call(this,e),i=!this.parent&&((n=this.div)==null?void 0:n.classList.contains("selectedEditor"))),super.setParent(e),i&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,z._mergeSVGProperties({bbox:A(this,ct,Cr).call(this)},o(this,Fe).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&A(this,ct,io).call(this,o(this,Fe).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;const e=super.render();e.classList.add("draw");const i=document.createElement("div");e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal";const[n,r]=this.parentDimensions;return this.setDims(this.width*n,this.height*r),this._uiManager.addShouldRescale(this),this.disableEditing(),e}static createDrawerInstance(e,i,n,r,a){At("Not implemented")}static startDrawing(e,i,n,r){var w,x;const{target:a,offsetX:l,offsetY:h,pointerId:c,pointerType:d}=r;if(o(z,Gi)&&o(z,Gi)!==d)return;const{viewport:{rotation:p}}=e,{width:g,height:f}=a.getBoundingClientRect(),m=v(z,rr,new AbortController),b=e.combinedSignal(m);
13o(z,Vi)||v(z,Vi,c),(w=o(z,Gi))!=null||v(z,Gi,d),window.addEventListener("pointerup",(_=>{var S;o(z,Vi)===_.pointerId?this._endDraw(_):(S=o(z,qi))==null||S.delete(_.pointerId)}),{signal:b}),window.addEventListener("pointercancel",(_=>{var S;o(z,Vi)===_.pointerId?this._currentParent.endDrawingSession():(S=o(z,qi))==null||S.delete(_.pointerId)}),{signal:b}),window.addEventListener("pointerdown",(_=>{o(z,Gi)===_.pointerType&&((o(z,qi)||v(z,qi,new Set)).add(_.pointerId),o(z,qt).isCancellable()&&(o(z,qt).removeLastElement(),o(z,qt).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))}),{capture:!0,passive:!1,signal:b}),window.addEventListener("contextmenu",gs,{signal:b}),a.addEventListener("pointermove",this._drawMove.bind(this),{signal:b}),a.addEventListener("touchmove",(_=>{_.timeStamp===o(z,or)&&je(_)}),{signal:b}),e.toggleDrawing(),(x=i._editorUndoBar)==null||x.hide(),o(z,qt)?e.drawLayer.updateProperties(this._currentDrawId,o(z,qt).startNew(l,h,g,f,p)):(i.updateUIForDefaultProperties(this),v(z,qt,this.createDrawerInstance(l,h,g,f,p)),v(z,ar,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(o(z,ar).toSVGProperties(),o(z,qt).defaultSVGProperties),!0,!1))}static _drawMove(e){var a;if(v(z,or,-1),!o(z,qt))return;const{offsetX:i,offsetY:n,pointerId:r}=e;o(z,Vi)===r&&(((a=o(z,qi))==null?void 0:a.size)>=1?this._endDraw(e):(this._currentParent.drawLayer.updateProperties(this._currentDrawId,o(z,qt).add(i,n)),v(z,or,e.timeStamp),je(e)))}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,v(z,qt,null),v(z,ar,null),v(z,Gi,null),v(z,or,NaN)),o(z,rr)&&(o(z,rr).abort(),v(z,rr,null),v(z,Vi,NaN),v(z,qi,null))}static _endDraw(e){const i=this._currentParent;if(i)if(i.toggleDrawing(!0),this._cleanup(!1),e&&i.drawLayer.updateProperties(this._currentDrawId,o(z,qt).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){const n=o(z,qt),r=this._currentDrawId,a=n.getLastElement();i.addCommands({cmd:()=>{i.drawLayer.updateProperties(r,n.setLastElement(a))},undo:()=>{i.drawLayer.updateProperties(r,n.removeLastElement())},mustExec:!1,type:lt.DRAW_STEP})}else this.endDrawing(!1)}static endDrawing(e){const i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(lt.DRAW_STEP),!o(z,qt).isEmpty()){const{pageDimensions:[n,r],scale:a}=i,l=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:o(z,qt).getOutlines(n*a,r*a,a,this._INNER_MARGIN),drawingOptions:o(z,ar),mustBeCommitted:!e});return this._cleanup(!0),l}return i.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,i,n,r,a,l){At("Not implemented")}static async deserialize(e,i,n){var p,g;const{rawDims:{pageWidth:r,pageHeight:a,pageX:l,pageY:h}}=i.viewport,c=this.deserializeDraw(l,h,r,a,this._INNER_MARGIN,e),d=await super.deserialize(e,i,n);return d.createDrawingOptions(e),A(p=d,ct,cd).call(p,{drawOutlines:c}),A(g=d,ct,so).call(g),d.onScaleChanging(),d.rotate(),d}serializeDraw(e){const[i,n]=this.pageTranslation,[r,a]=this.pageDimensions;return o(this,Fe).serialize([i,n,r,a],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}};Fe=new WeakMap,Ca=new WeakMap,qt=new WeakMap,rr=new WeakMap,ar=new WeakMap,Vi=new WeakMap,Gi=new WeakMap,qi=new WeakMap,or=new WeakMap,ct=new WeakSet,cd=function({drawOutlines:e,drawId:i,drawingOptions:n}){v(this,Fe,e),this._drawingOptions||(this._drawingOptions=n),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=A(this,ct,dd).call(this,e,this.parent),A(this,ct,io).call(this,e.box)},dd=function(e,i){const{id:n}=i.drawLayer.draw(z._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n},ud=function(){this._drawId!==null&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},so=function(e=this.parent){(this._drawId===null||this.parent!==e)&&(this._drawId===null?(this._drawingOptions.updateAll(),this._drawId=A(this,ct,dd).call(this,o(this,Fe),e)):this.parent.drawLayer.updateParent(this._drawId,e.drawLayer))},uf=function([e,i,n,r]){const{parentDimensions:[a,l],rotation:h}=this;switch(h){case 90:return[i,1-e,n*(l/a),r*(a/l)];case 180:return[1-e,1-i,n,r];case 270:return[1-i,e,n*(l/a),r*(a/l)];default:return[e,i,n,r]}},mh=function(){const{x:e,y:i,width:n,height:r,parentDimensions:[a,l],rotation:h}=this;switch(h){case 90:return[1-i,e,n*(a/l),r*(l/a)];case 180:return[1-e,1-i,n,r];case 270:return[i,1-e,n*(a/l),r*(l/a)];default:return[e,i,n,r]}},io=function(e){if([this.x,this.y,this.width,this.height]=A(this,ct,uf).call(this,e),this.div){this.fixAndSetPosition();const[i,n]=this.parentDimensions;this.setDims(this.width*i,this.height*n)}this._onResized()},Cr=function(){const{x:e,y:i,width:n,height:r,rotation:a,parentRotation:l,parentDimensions:[h,c]}=this;switch((4*a+l)/90){case 1:return[1-i-r,e,r,n];case 2:return[1-e-n,1-i-r,n,r];case 3:return[i,1-e-n,r,n];case 4:return[e,i-n*(h/c),r*(c/h),n*(h/c)];case 5:return[1-i,e,n*(h/c),r*(c/h)];case 6:return[1-e-r*(c/h),1-i,r*(c/h),n*(h/c)];case 7:return[i-n*(h/c),1-e-r*(c/h),n*(h/c),r*(c/h)];case 8:return[e-n,i-r,n,r];case 9:return[1-i,e-n,r,n];case 10:return[1-e,1-i,n,r];case 11:return[i-r,1-e,r,n];case 12:return[e-r*(c/h),i,r*(c/h),n*(h/c)];case 13:return[1-i-n*(h/c),e-r*(c/h),n*(h/c),r*(c/h)];case 14:return[1-e,1-i-n*(h/c),r*(c/h),n*(h/c)];case 15:return[i,1-e,n*(h/c),r*(c/h)];default:return[e,i,n,r]}},et(z,"_currentDrawId",-1),et(z,"_currentParent",null),y(z,qt,null),y(z,rr,null),y(z,ar,null),y(z,Vi,NaN),y(z,Gi,null),y(z,qi,null),y(z,or,NaN),et(z,"_INNER_MARGIN",3);let hd=z;var Ms,Wt,Xt,lr,ka,de,Zt,Xe,hr,cr,dr,Ta,vh;class u0{constructor(s,e,i,n,r,a){y(this,Ta);y(this,Ms,new Float64Array(6));y(this,Wt);y(this,Xt);y(this,lr);y(this,ka);y(this,de);y(this,Zt,"");y(this,Xe,0);y(this,hr,new Ph);y(this,cr);y(this,dr);v(this,cr,i),v(this,dr,n),v(this,lr,r),v(this,ka,a),[s,e]=A(this,Ta,vh).call(this,s,e);const l=v(this,Wt,[NaN,NaN,NaN,NaN,s,e]);v(this,de,[s,e]),v(this,Xt,[{line:l,points:o(this,de)}]),o(this,Ms).set(l,0)}updateProperty(s,e){s==="stroke-width"&&v(this,ka,e)}isEmpty(){return!o(this,Xt)||o(this,Xt).length===0}isCancellable(){return o(this,de).length<=10}add(s,e){[s,e]=A(this,Ta,vh).call(this,s,e);const[i,n,r,a]=o(this,Ms).subarray(2,6),l=s-r,h=e-a;return Math.hypot(o(this,cr)*l,o(this,dr)*h)<=2?null:(o(this,de).push(s,e),isNaN(i)?(o(this,Ms).set([r,a,s,e],2),o(this,Wt).push(NaN,NaN,NaN,NaN,s,e),{path:{d:this.toSVGPath()}}):(isNaN(o(this,Ms)[0])&&o(this,Wt).splice(6,6),o(this,Ms).set([i,n,r,a,s,e],0),o(this,Wt).push(...U.createBezierPoints(i,n,r,a,s,e)),{path:{d:this.toSVGPath()}}))}end(s,e){return this.add(s,e)||(o(this,de).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(s,e,i,n,r){v(this,cr,i),v(this,dr,n),v(this,lr,r),[s,e]=A(this,Ta,vh).call(this,s,e);const a=v(this,Wt,[NaN,NaN,NaN,NaN,s,e]);v(this,de,[s,e]);const l=o(this,Xt).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),o(this,Xt).push({line:a,points:o(this,de)}),o(this,Ms).set(a,0),v(this,Xe,0),this.toSVGPath(),null}getLastElement(){return o(this,Xt).at(-1)}setLastElement(s){return o(this,Xt)?(o(this,Xt).push(s),v(this,Wt,s.line),v(this,de,s.points),v(this,Xe,0),{path:{d:this.toSVGPath()}}):o(this,hr).setLastElement(s)}removeLastElement(){if(!o(this,Xt))return o(this,hr).removeLastElement();o(this,Xt).pop(),v(this,Zt,"");for(let s=0,e=o(this,Xt).length;s<e;s++){const{line:i,points:n}=o(this,Xt)[s];v(this,Wt,i),v(this,de,n),v(this,Xe,0),this.toSVGPath()}return{path:{d:o(this,Zt)}}}toSVGPath(){const s=U.svgRound(o(this,Wt)[4]),e=U.svgRound(o(this,Wt)[5]);if(o(this,de).length===2)return v(this,Zt,`${o(this,Zt)} M ${s} ${e} Z`),o(this,Zt);if(o(this,de).length<=6){const n=o(this,Zt).lastIndexOf("M");v(this,Zt,`${o(this,Zt).slice(0,n)} M ${s} ${e}`),v(this,Xe,6)}if(o(this,de).length===4){const n=U.svgRound(o(this,Wt)[10]),r=U.svgRound(o(this,Wt)[11]);return v(this,Zt,`${o(this,Zt)} L ${n} ${r}`),v(this,Xe,12),o(this,Zt)}const i=[];o(this,Xe)===0&&(i.push(`M ${s} ${e}`),v(this,Xe,6));for(let n=o(this,Xe),r=o(this,Wt).length;n<r;n+=6){const[a,l,h,c,d,p]=o(this,Wt).slice(n,n+6).map(U.svgRound);i.push(`C${a} ${l} ${h} ${c} ${d} ${p}`)}return v(this,Zt,o(this,Zt)+i.join(" ")),v(this,Xe,o(this,Wt).length),o(this,Zt)}getOutlines(s,e,i,n){const r=o(this,Xt).at(-1);return r.line=new Float32Array(r.line),r.points=new Float32Array(r.points),o(this,hr).build(o(this,Xt),s,e,i,o(this,lr),o(this,ka),n),v(this,Ms,null),v(this,Wt,null),v(this,Xt,null),v(this,Zt,null),o(this,hr)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}Ms=new WeakMap,Wt=new WeakMap,Xt=new WeakMap,lr=new WeakMap,ka=new WeakMap,de=new WeakMap,Zt=new WeakMap,Xe=new WeakMap,hr=ne
13w WeakMap,cr=new WeakMap,dr=new WeakMap,Ta=new WeakSet,vh=function(s,e){return U._normalizePoint(s,e,o(this,cr),o(this,dr),o(this,lr))};var ue,Pl,Il,Ne,Ps,Is,Ra,Ma,Pa,ee,js,pf,ff,gf;const $d=class $d extends U{constructor(){super(...arguments);y(this,ee);y(this,ue);y(this,Pl,0);y(this,Il);y(this,Ne);y(this,Ps);y(this,Is);y(this,Ra);y(this,Ma);y(this,Pa)}build(e,i,n,r,a,l,h){v(this,Ps,i),v(this,Is,n),v(this,Ra,r),v(this,Ma,a),v(this,Pa,l),v(this,Il,h!=null?h:0),v(this,Ne,e),A(this,ee,ff).call(this)}setLastElement(e){return o(this,Ne).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return o(this,Ne).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){const e=[];for(const{line:i}of o(this,Ne))if(e.push(`M${U.svgRound(i[4])} ${U.svgRound(i[5])}`),i.length!==6)if(i.length!==12)for(let n=6,r=i.length;n<r;n+=6){const[a,l,h,c,d,p]=i.subarray(n,n+6).map(U.svgRound);e.push(`C${a} ${l} ${h} ${c} ${d} ${p}`)}else e.push(`L${U.svgRound(i[10])} ${U.svgRound(i[11])}`);else e.push("Z");return e.join("")}serialize([e,i,n,r],a){const l=[],h=[],[c,d,p,g]=A(this,ee,pf).call(this);let f,m,b,w,x,_,S,E,C;switch(o(this,Ma)){case 0:C=U._rescale,f=e,m=i+r,b=n,w=-r,x=e+c*n,_=i+(1-d-g)*r,S=e+(c+p)*n,E=i+(1-d)*r;break;case 90:C=U._rescaleAndSwap,f=e,m=i,b=n,w=r,x=e+d*n,_=i+c*r,S=e+(d+g)*n,E=i+(c+p)*r;break;case 180:C=U._rescale,f=e+n,m=i,b=-n,w=r,x=e+(1-c-p)*n,_=i+d*r,S=e+(1-c)*n,E=i+(d+g)*r;break;case 270:C=U._rescaleAndSwap,f=e+n,m=i+r,b=-n,w=-r,x=e+(1-d-g)*n,_=i+(1-c-p)*r,S=e+(1-d)*n,E=i+(1-c)*r}for(const{line:T,points:k}of o(this,Ne))l.push(C(T,f,m,b,w,a?new Array(T.length):null)),h.push(C(k,f,m,b,w,a?new Array(k.length):null));return{lines:l,points:h,rect:[x,_,S,E]}}static deserialize(e,i,n,r,a,{paths:{lines:l,points:h},rotation:c,thickness:d}){const p=[];let g,f,m,b,w;switch(c){case 0:w=U._rescale,g=-e/n,f=i/r+1,m=1/n,b=-1/r;break;case 90:w=U._rescaleAndSwap,g=-i/r,f=-e/n,m=1/r,b=1/n;break;case 180:w=U._rescale,g=e/n+1,f=-i/r,m=-1/n,b=1/r;break;case 270:w=U._rescaleAndSwap,g=i/r+1,f=e/n+1,m=-1/r,b=-1/n}if(!l){l=[];for(const _ of h){const S=_.length;if(S===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,_[0],_[1]]));continue}if(S===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,_[0],_[1],NaN,NaN,NaN,NaN,_[2],_[3]]));continue}const E=new Float32Array(3*(S-2));l.push(E);let[C,T,k,I]=_.subarray(0,4);E.set([NaN,NaN,NaN,NaN,C,T],0);for(let P=4;P<S;P+=2){const N=_[P],O=_[P+1];E.set(U.createBezierPoints(C,T,k,I,N,O),3*(P-2)),[C,T,k,I]=[k,I,N,O]}}}for(let _=0,S=l.length;_<S;_++)p.push({line:w(l[_].map((E=>E!=null?E:NaN)),g,f,m,b),points:w(h[_].map((E=>E!=null?E:NaN)),g,f,m,b)});const x=new $d;return x.build(p,n,r,1,c,d,a),x}get box(){return o(this,ue)}updateProperty(e,i){return e==="stroke-width"?A(this,ee,gf).call(this,i):null}updateParentDimensions([e,i],n){const[r,a]=A(this,ee,js).call(this);v(this,Ps,e),v(this,Is,i),v(this,Ra,n);const[l,h]=A(this,ee,js).call(this),c=l-r,d=h-a,p=o(this,ue);return p[0]-=c,p[1]-=d,p[2]+=2*c,p[3]+=2*d,p}updateRotation(e){return v(this,Pl,e),{path:{transform:this.rotationTransform}}}get viewBox(){return o(this,ue).map(U.svgRound).join(" ")}get defaultProperties(){const[e,i]=o(this,ue);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`}}}get rotationTransform(){const[,,e,i]=o(this,ue);let n=0,r=0,a=0,l=0,h=0,c=0;switch(o(this,Pl)){case 90:r=i/e,a=-e/i,h=e;break;case 180:n=-1,l=-1,h=e,c=i;break;case 270:r=-i/e,a=e/i,c=i;break;default:return""}return`matrix(${n} ${r} ${a} ${l} ${U.svgRound(h)} ${U.svgRound(c)})`}getPathResizingSVGProperties([e,i,n,r]){const[a,l]=A(this,ee,js).call(this),[h,c,d,p]=o(this,ue);if(Math.abs(d-a)<=U.PRECISION||Math.abs(p-l)<=U.PRECISION){const w=e+n/2-(h+d/2),x=i+r/2-(c+p/2);return{path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`,transform:`${this.rotationTransform} translate(${w} ${x})`}}}const g=(n-2*a)/(d-2*a),f=(r-2*l)/(p-2*l),m=d/n,b=p/r;return{path:{"transform-origin":`${U.svgRound(h)} ${U.svgRound(c)}`,transform:`${this.rotationTransform} scale(${m} ${b}) translate(${U.svgRound(a)} ${U.svgRound(l)}) scale(${g} ${f}) translate(${U.svgRound(-a)} ${U.svgRound(-l)})`}}}getPathResizedSVGProperties([e,i,n,r]){const[a,l]=A(this,ee,js).call(this),h=o(this,ue),[c,d,p,g]=h;if(h[0]=e,h[1]=i,h[2]=n,h[3]=r,Math.abs(p-a)<=U.PRECISION||Math.abs(g-l)<=U.PRECISION){const x=e+n/2-(c+p/2),_=i+r/2-(d+g/2);for(const{line:S,points:E}of o(this,Ne))U._translate(S,x,_,S),U._translate(E,x,_,E);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}const f=(n-2*a)/(p-2*a),m=(r-2*l)/(g-2*l),b=-f*(c+a)+e+a,w=-m*(d+l)+i+l;if(f!==1||m!==1||b!==0||w!==0)for(const{line:x,points:_}of o(this,Ne))U._rescale(x,b,w,f,m,x),U._rescale(_,b,w,f,m,_);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],n){const[r,a]=n,l=o(this,ue),h=e-l[0],c=i-l[1];if(o(this,Ps)===r&&o(this,Is)===a)for(const{line:d,points:p}of o(this,Ne))U._translate(d,h,c,d),U._translate(p,h,c,p);else{const d=o(this,Ps)/r,p=o(this,Is)/a;v(this,Ps,r),v(this,Is,a);for(const{line:g,points:f}of o(this,Ne))U._rescale(g,h,c,d,p,g),U._rescale(f,h,c,d,p,f);l[2]*=d,l[3]*=p}return l[0]=e,l[1]=i,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${U.svgRound(e)} ${U.svgRound(i)}`}}}get defaultSVGProperties(){const e=o(this,ue);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${U.svgRound(e[0])} ${U.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};ue=new WeakMap,Pl=new WeakMap,Il=new WeakMap,Ne=new WeakMap,Ps=new WeakMap,Is=new WeakMap,Ra=new WeakMap,Ma=new WeakMap,Pa=new WeakMap,ee=new WeakSet,js=function(e=o(this,Pa)){const i=o(this,Il)+e/2*o(this,Ra);return o(this,Ma)%180==0?[i/o(this,Ps),i/o(this,Is)]:[i/o(this,Is),i/o(this,Ps)]},pf=function(){const[e,i,n,r]=o(this,ue),[a,l]=A(this,ee,js).call(this,0);return[e+a,i+l,n-2*a,r-2*l]},ff=function(){const e=v(this,ue,new Float32Array([1/0,1/0,-1/0,-1/0]));for(const{line:r}of o(this,Ne)){if(r.length<=12){for(let h=4,c=r.length;h<c;h+=6){const[d,p]=r.subarray(h,h+2);e[0]=Math.min(e[0],d),e[1]=Math.min(e[1],p),e[2]=Math.max(e[2],d),e[3]=Math.max(e[3],p)}continue}let a=r[4],l=r[5];for(let h=6,c=r.length;h<c;h+=6){const[d,p,g,f,m,b]=r.subarray(h,h+6);W.bezierBoundingBox(a,l,d,p,g,f,m,b,e),a=m,l=b}}const[i,n]=A(this,ee,js).call(this);e[0]=Math.min(1,Math.max(0,e[0]-i)),e[1]=Math.min(1,Math.max(0,e[1]-n)),e[2]=Math.min(1,Math.max(0,e[2]+i)),e[3]=Math.min(1,Math.max(0,e[3]+n)),e[2]-=e[0],e[3]-=e[1]},gf=function(e){const[i,n]=A(this,ee,js).call(this);v(this,Pa,e);const[r,a]=A(this,ee,js).call(this),[l,h]=[r-i,a-n],c=o(this,ue);return c[0]-=l,c[1]-=h,c[2]+=2*l,c[3]+=2*h,c};let Ph=$d;var Ia;const zd=class zd extends d0{constructor(e){super();y(this,Ia);v(this,Ia,e),super.updateProperties({fill:"none",stroke:Pt._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(e,i){e==="stroke-width"&&(i!=null||(i=this["stroke-width"]),i*=o(this,Ia).realScale),super.updateSVGProperty(e,i)}clone(){const e=new zd(o(this,Ia));return e.updateAll(this),e}};Ia=new WeakMap;let pd=zd;var Gh,mf;const Tr=class Tr extends hd{constructor(e){super({...e,name:"inkEditor"});y(this,Gh);this._willKeepAspectRatio=!0}static initialize(e,i){Pt.initialize(e,i),this._defaultDrawingOptions=new pd(i.viewParameters)}static getDefaultDrawingOptions(e){const i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!0}static get typesMap(){return ot(this,"typesMap",new Map([[lt.INK_THICKNESS,"stroke-width"],[lt.INK_COLOR,"stroke"],[lt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,i,n,r,a){return new u0(e,i,n,r,a,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,i,n,r,a,l){return Ph.deserialize(e,i,n,r,a,l)}static async deserialize(e,i,n){let r=null;if(e instanceof Nd){const{data:{inkLists:l,rect:h,rotation:c,id:d,color:p,opacity:g,borderStyle:{rawWidth:f},popupRef:m},parent:{page:{pageNumber:b}}}=e;r=e={annotationType:st.INK,color:Array.from(p),thickness:f,opacity:g,paths:{points:l},boxes:null,pageIndex:b-1,rect:h.slice(0),rotation:c,id:d,deleted:!1,popupRef:m}}const a=await super.deserialize(e,i,n);return a.annotationElementId=e.id||null,a._initialData=r,a}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();const{_drawId:e,_drawingOptions:i,parent:n}=this;i.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,i.toSVGProperties())}static onScaleChangingWhenDrawing(){const e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:i,opacity:n}
13){this._drawingOptions=Tr.getDefaultDrawingOptions({stroke:W.makeHexColor(...e),"stroke-width":i,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const{lines:i,points:n,rect:r}=this.serializeDraw(e),{_drawingOptions:{stroke:a,"stroke-opacity":l,"stroke-width":h}}=this,c={annotationType:st.INK,color:Pt._colorManager.convert(a),opacity:l,thickness:h,paths:{lines:i,points:n},pageIndex:this.pageIndex,rect:r,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?c:this.annotationElementId&&!A(this,Gh,mf).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(e){const{points:i,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:i}),null}};Gh=new WeakSet,mf=function(e){const{color:i,thickness:n,opacity:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||this._hasBeenResized||e.color.some(((l,h)=>l!==i[h]))||e.thickness!==n||e.opacity!==r||e.pageIndex!==a},et(Tr,"_type","ink"),et(Tr,"_editorType",st.INK),et(Tr,"_defaultDrawingOptions",null);let fd=Tr;var Rt,te,Wi,di,Xi,Da,Ds,Ls,Oe,La,dt,no,ro,bh,md,yh,vd,Ah,vf;const oo=class oo extends Pt{constructor(e){super({...e,name:"stampEditor"});y(this,dt);y(this,Rt,null);y(this,te,null);y(this,Wi,null);y(this,di,null);y(this,Xi,null);y(this,Da,"");y(this,Ds,null);y(this,Ls,null);y(this,Oe,!1);y(this,La,!1);v(this,di,e.bitmapUrl),v(this,Xi,e.bitmapFile)}static initialize(e,i){Pt.initialize(e,i)}static get supportedTypes(){return ot(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return ot(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,i){i.pasteEditor(st.STAMP,{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var e;return{type:"stamp",hasAltText:!!((e=this.altTextData)!=null&&e.altText)}}static computeTelemetryFinalData(e){var n,r;const i=e.get("hasAltText");return{hasAltText:(n=i.get(!0))!=null?n:0,hasNoAltText:(r=i.get(!1))!=null?r:0}}async mlGuessAltText(e=null,i=!0){if(this.hasAltTextData())return null;const{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");const{data:r,width:a,height:l}=e||this.copyCanvas(null,null,!0).imageData,h=await n.guess({name:"altText",request:{data:r,width:a,height:l,channels:r.length/(a*l)}});if(!h)throw new Error("No response from the AI service.");if(h.error)throw new Error("Error from the AI service.");if(h.cancel)return null;if(!h.output)throw new Error("No valid response from the AI service.");const c=h.output;return await this.setGuessedAltText(c),i&&!this.hasAltTextData()&&(this.altTextData={alt:c,decorative:!1}),c}remove(){var e;o(this,te)&&(v(this,Rt,null),this._uiManager.imageManager.deleteId(o(this,te)),(e=o(this,Ds))==null||e.remove(),v(this,Ds,null),o(this,Ls)&&(clearTimeout(o(this,Ls)),v(this,Ls,null))),super.remove()}rebuild(){this.parent?(super.rebuild(),this.div!==null&&(o(this,te)&&o(this,Ds)===null&&A(this,dt,bh).call(this),this.isAttachedToDOM||this.parent.add(this))):o(this,te)&&A(this,dt,bh).call(this)}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(o(this,Wi)||o(this,Rt)||o(this,di)||o(this,Xi)||o(this,te))}get isResizable(){return!0}render(){if(this.div)return this.div;let e,i;if(this.width&&(e=this.x,i=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),o(this,Rt)?A(this,dt,md).call(this):A(this,dt,bh).call(this),this.width&&!this.annotationElementId){const[n,r]=this.parentDimensions;
13this.setAt(e*n,i*r,this.width*n,this.height*r)}return this._uiManager.addShouldRescale(this),this.div}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(o(this,Ls)!==null&&clearTimeout(o(this,Ls)),v(this,Ls,setTimeout((()=>{v(this,Ls,null),A(this,dt,vd).call(this)}),200)))}copyCanvas(e,i,n=!1){var f;e||(e=224);const{width:r,height:a}=o(this,Rt),l=new mc;let h=o(this,Rt),c=r,d=a,p=null;if(i){if(r>i||a>i){const I=Math.min(i/r,i/a);c=Math.floor(r*I),d=Math.floor(a*I)}p=document.createElement("canvas");const m=p.width=Math.ceil(c*l.sx),b=p.height=Math.ceil(d*l.sy);o(this,Oe)||(h=A(this,dt,yh).call(this,m,b));const w=p.getContext("2d");w.filter=this._uiManager.hcmFilter;let x="white",_="#cfcfd8";this._uiManager.hcmFilter!=="none"?_="black":(f=window.matchMedia)!=null&&f.call(window,"(prefers-color-scheme: dark)").matches&&(x="#8f8f9d",_="#42414d");const S=15,E=S*l.sx,C=S*l.sy,T=new OffscreenCanvas(2*E,2*C),k=T.getContext("2d");k.fillStyle=x,k.fillRect(0,0,2*E,2*C),k.fillStyle=_,k.fillRect(0,0,E,C),k.fillRect(E,C,E,C),w.fillStyle=w.createPattern(T,"repeat"),w.fillRect(0,0,m,b),w.drawImage(h,0,0,h.width,h.height,0,0,m,b)}let g=null;if(n){let m,b;if(l.symmetric&&h.width<e&&h.height<e)m=h.width,b=h.height;else if(h=o(this,Rt),r>e||a>e){const x=Math.min(e/r,e/a);m=Math.floor(r*x),b=Math.floor(a*x),o(this,Oe)||(h=A(this,dt,yh).call(this,m,b))}const w=new OffscreenCanvas(m,b).getContext("2d",{willReadFrequently:!0});w.drawImage(h,0,0,h.width,h.height,0,0,m,b),g={width:m,height:b,data:w.getImageData(0,0,m,b).data}}return{canvas:p,width:c,height:d,imageData:g}}getImageForAltText(){return o(this,Ds)}static async deserialize(e,i,n){var b;let r=null;if(e instanceof Op){const{data:{rect:w,rotation:x,id:_,structParent:S,popupRef:E},container:C,parent:{page:{pageNumber:T}}}=e,k=C.querySelector("canvas"),I=n.imageManager.getFromCanvas(C.id,k);k.remove();const P=((b=await i._structTree.getAriaAttributes(`${kd}${_}`))==null?void 0:b.get("aria-label"))||"";r=e={annotationType:st.STAMP,bitmapId:I.id,bitmap:I.bitmap,pageIndex:T-1,rect:w.slice(0),rotation:x,id:_,deleted:!1,accessibilityData:{decorative:!1,altText:P},isSvg:!1,structParent:S,popupRef:E}}const a=await super.deserialize(e,i,n),{rect:l,bitmap:h,bitmapUrl:c,bitmapId:d,isSvg:p,accessibilityData:g}=e;d&&n.imageManager.isValidId(d)?(v(a,te,d),h&&v(a,Rt,h)):v(a,di,c),v(a,Oe,p);const[f,m]=a.pageDimensions;return a.width=(l[2]-l[0])/f,a.height=(l[3]-l[1])/m,a.annotationElementId=e.id||null,g&&(a.altTextData=g),a._initialData=r,v(a,La,!!r),a}serialize(e=!1,i=null){var h;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const n={annotationType:st.STAMP,bitmapId:o(this,te),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:o(this,Oe),structTreeParentId:this._structTreeParentId};if(e)return n.bitmapUrl=A(this,dt,Ah).call(this,!0),n.accessibilityData=this.serializeAltText(!0),n;const{decorative:r,altText:a}=this.serializeAltText(!1);if(!r&&a&&(n.accessibilityData={type:"Figure",alt:a}),this.annotationElementId){const c=A(this,dt,vf).call(this,n);if(c.isSame)return null;c.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=(h=this._initialData.structParent)!=null?h:-1}if(n.id=this.annotationElementId,i===null)return n;i.stamps||(i.stamps=new Map);const l=o(this,Oe)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(i.stamps.has(o(this,te))){if(o(this,Oe)){const c=i.stamps.get(o(this,te));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=A(this,dt,Ah).call(this,!1))}}else i.stamps.set(o(this,te),{area:l,serialized:n}),n.bitmap=A(this,dt,Ah).call(this,!1);return n}renderAnnotationElement(e){return e.updateEdited({rect:this.getRect(0,0)}),null}};Rt=new WeakMap,te=new WeakMap,Wi=new WeakMap,di=new WeakMap,Xi=new WeakMap,Da=new WeakMap,Ds=new WeakMap,Ls=new WeakMap,Oe=new WeakMap,La=new WeakMap,dt=new WeakSet,no=function(e,i=!1){e?(v(this,Rt,e.bitmap),i||(v(this,te,e.id),v(this,Oe,e.isSvg)),e.file&&v(this,Da,e.file.name),A(this,dt,md).call(this)):this.remove()},ro=function(){if(v(this,Wi,null),this._uiManager.enableWaiting(!1),o(this,Ds))if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,Rt))this._editToolbar.hide(),this._uiManager.editAltText(this,!0);else{if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&o(this,Rt)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},bh=function(){if(o(this,te)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(o(this,te)).then((n=>A(this,dt,no).call(this,n,!0))).finally((()=>A(this,dt,ro).call(this)));return}if(o(this,di)){const n=o(this,di);v(this,di,null),this._uiManager.enableWaiting(!0),v(this,Wi,this._uiManager.imageManager.getFromUrl(n).then((r=>A(this,dt,no).call(this,r))).finally((()=>A(this,dt,ro).call(this))));return}if(o(this,Xi)){const n=o(this,Xi);v(this,Xi,null),this._uiManager.enableWaiting(!0),v(this,Wi,this._uiManager.imageManager.getFromFile(n).then((r=>A(this,dt,no).call(this,r))).finally((()=>A(this,dt,ro).call(this))));return}const e=document.createElement("input");e.type="file",e.accept=oo.supportedTypesStr;const i=this._uiManager._signal;v(this,Wi,new Promise((n=>{e.addEventListener("change",(async()=>
13{if(e.files&&e.files.length!==0){this._uiManager.enableWaiting(!0);const r=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),A(this,dt,no).call(this,r)}else this.remove();n()}),{signal:i}),e.addEventListener("cancel",(()=>{this.remove(),n()}),{signal:i})})).finally((()=>A(this,dt,ro).call(this)))),e.click()},md=function(){var p;const{div:e}=this;let{width:i,height:n}=o(this,Rt);const[r,a]=this.pageDimensions,l=.75;if(this.width)i=this.width*r,n=this.height*a;else if(i>l*r||n>l*a){const g=Math.min(l*r/i,l*a/n);i*=g,n*=g}const[h,c]=this.parentDimensions;this.setDims(i*h/r,n*c/a),this._uiManager.enableWaiting(!1);const d=v(this,Ds,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this.width=i/r,this.height=n/a,(p=this._initialOptions)!=null&&p.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(e.hidden=!1),A(this,dt,vd).call(this),o(this,La)||(this.parent.addUndoableEditor(this),v(this,La,!0)),this._reportTelemetry({action:"inserted_image"}),o(this,Da)&&d.setAttribute("aria-label",o(this,Da))},yh=function(e,i){const{width:n,height:r}=o(this,Rt);let a=n,l=r,h=o(this,Rt);for(;a>2*e||l>2*i;){const c=a,d=l;a>2*e&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),l>2*i&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));const p=new OffscreenCanvas(a,l);p.getContext("2d").drawImage(h,0,0,c,d,0,0,a,l),h=p.transferToImageBitmap()}return h},vd=function(){const[e,i]=this.parentDimensions,{width:n,height:r}=this,a=new mc,l=Math.ceil(n*e*a.sx),h=Math.ceil(r*i*a.sy),c=o(this,Ds);if(!c||c.width===l&&c.height===h)return;c.width=l,c.height=h;const d=o(this,Oe)?o(this,Rt):A(this,dt,yh).call(this,l,h),p=c.getContext("2d");p.filter=this._uiManager.hcmFilter,p.drawImage(d,0,0,d.width,d.height,0,0,l,h)},Ah=function(e){if(e){if(o(this,Oe)){const n=this._uiManager.imageManager.getSvgUrl(o(this,te));if(n)return n}const i=document.createElement("canvas");return{width:i.width,height:i.height}=o(this,Rt),i.getContext("2d").drawImage(o(this,Rt),0,0),i.toDataURL()}if(o(this,Oe)){const[i,n]=this.pageDimensions,r=Math.round(this.width*i*Oa.PDF_TO_CSS_UNITS),a=Math.round(this.height*n*Oa.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(r,a);return l.getContext("2d").drawImage(o(this,Rt),0,0,o(this,Rt).width,o(this,Rt).height,0,0,r,a),l.transferToImageBitmap()}return structuredClone(o(this,Rt))},vf=function(e){var l;const{pageIndex:i,accessibilityData:{altText:n}}=this._initialData,r=e.pageIndex===i,a=(((l=e.accessibilityData)==null?void 0:l.alt)||"")===n;return{isSame:!this._hasBeenMoved&&!this._hasBeenResized&&r&&a,isSameAltText:a}}
13,et(oo,"_type","stamp"),et(oo,"_editorType",st.STAMP);let gd=oo;var ur,Fa,Fs,Yi,ui,Ye,Ki,Na,pr,us,pi,oe,fi,q,Qi,kt,bf,bs,yd,Ad,wh;const ts=class ts{constructor({uiManager:s,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:r,annotationLayer:a,drawLayer:l,textLayer:h,viewport:c,l10n:d}){y(this,kt);y(this,ur);y(this,Fa,!1);y(this,Fs,null);y(this,Yi,null);y(this,ui,null);y(this,Ye,new Map);y(this,Ki,!1);y(this,Na,!1);y(this,pr,!1);y(this,us,null);y(this,pi,null);y(this,oe,null);y(this,fi,null);y(this,q);const p=[...o(ts,Qi).values()];if(!ts._initialized){ts._initialized=!0;for(const g of p)g.initialize(d,s)}s.registerEditorTypes(p),v(this,q,s),this.pageIndex=e,this.div=i,v(this,ur,r),v(this,Fs,a),this.viewport=c,v(this,oe,h),this.drawLayer=l,this._structTree=n,o(this,q).addLayer(this)}get isEmpty(){return o(this,Ye).size===0}get isInvisible(){return this.isEmpty&&o(this,q).getMode()===st.NONE}updateToolbar(s){o(this,q).updateToolbar(s)}updateMode(s=o(this,q).getMode()){switch(A(this,kt,wh).call(this),s){case st.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case st.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case st.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 o(ts,Qi).values())e.toggle(`${i._type}Editing`,s===i._editorType);this.div.hidden=!1}hasTextLayer(s){var e;return s===((e=o(this,oe))==null?void 0:e.div)}setEditingState(s){o(this,q).setEditingState(s)}addCommands(s){o(this,q).addCommands(s)}cleanUndoStack(s){o(this,q).cleanUndoStack(s)}toggleDrawing(s=!1){this.div.classList.toggle("drawing",!s)}togglePointerEvents(s=!1){this.div.classList.toggle("disabled",!s)}toggleAnnotationLayerPointerEvents(s=!1){var e;(e=o(this,Fs))==null||e.div.classList.toggle("disabled",!s)}async enable(){v(this,pr,!0),this.div.tabIndex=0,this.togglePointerEvents(!0);const s=new Set;for(const i of o(this,Ye).values())i.enableEditing(),i.show(!0),i.annotationElementId&&(o(this,q).removeChangedExistingAnnotation(i),s.add(i.annotationElementId));if(!o(this,Fs)){v(this,pr,!1);return}const e=o(this,Fs).getEditableAnnotations();for(const i of e){if(i.hide(),o(this,q).isDeletedAnnotationElement(i.data.id)||s.has(i.data.id))continue;const n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}v(this,pr,!1)}disable(){var n;v(this,Na,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const s=new Map,e=new Map;for(const r of o(this,Ye).values())r.disableEditing(),r.annotationElementId&&(r.serialize()===null?(e.set(r.annotationElementId,r),(n=this.getEditableAnnotation(r.annotationElementId))==null||n.show(),r.remove()):s.set(r.annotationElementId,r));if(o(this,Fs)){const r=o(this,Fs).getEditableAnnotations();for(const a of r){const{id:l}=a.data;if(o(this,q).isDeletedAnnotationElement(l))continue;let h=e.get(l);h?(h.resetAnnotationElement(a),h.show(!1),a.show()):(h=s.get(l),h&&(o(this,q).addChangedExistingAnnotation(h),h.renderAnnotationElement(a)&&h.show(!1)),a.show())}}A(this,kt,wh).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:i}=this.div;for(const r of o(ts,Qi).values())i.remove(`${r._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),v(this,Na,!1)}getEditableAnnotation(s){var e;return((e=o(this,Fs))==null?void 0:e.getEditableAnnotation(s))||null}setActiveEditor(s){o(this,q).getActive()!==s&&o(this,q).setActiveEditor(s)}enableTextSelection(){var s;if(this.div.tabIndex=-1,(s=o(this,oe))!=null&&s.div&&!o(this,fi)){v(this,fi,new AbortController);const e=o(this,q).combinedSignal(o(this,fi));o(this,oe).div.addEventListener("pointerdown",A(this,kt,bf).bind(this),{signal:e}),o(this,oe).div.classList.add("highlighting")}}disableTextSelection(){var s;this.div.tabIndex=0,(s=o(this,oe))!=null&&s.div&&o(this,fi)&&(o(this,fi).abort(),v(this,fi,null),o(this,oe).div.classList.remove("highlighting"))}enableClick(){if(o(this,Yi))return;v(this,Yi,new AbortController);const s=o(this,q).combinedSignal(o(this,Yi));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:s});const e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:s}),this.div.addEventListener("pointercancel",e,{signal:s})}disableClick(){var s;(s=o(this,Yi))==null||s.abort(),v(this,Yi,null)}attach(s){o(this,Ye).set(s.id,s);const{annotationElementId:e}=s;e&&o(this,q).isDeletedAnnotationElement(e)&&o(this,q).removeDeletedAnnotationElement(s)}detach(s){var e;o(this,Ye).delete(s.id),(e=o(this,ur))==null||e.removePointerInTextLayer(s.contentDiv),!o(this,Na)&&s.annotationElementId&&o(this,q).addDeletedAnnotationElement(s)}remove(s){this.detach(s),o(this,q).removeEditor(s),s.div.remove(),s.isAttachedToDOM=!1}changeParent(s){var e;s.parent!==this&&(s.parent&&s.annotationElementId&&(o(this,q).addDeletedAnnotationElement(s.annotationElementId),Pt.deleteAnnotationElement(s),s.annotationElementId=null),this.attach(s),(e=s.parent)==null||e.detach(s),s.setParent(this),s.div&&s.isAttachedToDOM&&(s.div.remove(),this.div.append(s.div)))}
13add(s){if(s.parent!==this||!s.isAttachedToDOM){if(this.changeParent(s),o(this,q).addEditor(s),this.attach(s),!s.isAttachedToDOM){const e=s.render();this.div.append(e),s.isAttachedToDOM=!0}s.fixAndSetPosition(),s.onceAdded(!o(this,pr)),o(this,q).addToAnnotationStorage(s),s._reportTelemetry(s.telemetryInitialData)}}moveEditorInDOM(s){var i;if(!s.isAttachedToDOM)return;const{activeElement:e}=document;s.div.contains(e)&&!o(this,ui)&&(s._focusEventsAllowed=!1,v(this,ui,setTimeout((()=>{v(this,ui,null),s.div.contains(document.activeElement)?s._focusEventsAllowed=!0:(s.div.addEventListener("focusin",(()=>{s._focusEventsAllowed=!0}),{once:!0,signal:o(this,q)._signal}),e.focus())}),0))),s._structTreeParentId=(i=o(this,ur))==null?void 0:i.moveElementInDOM(this.div,s.div,s.contentDiv,!0)}addOrRebuild(s){s.needsToBeRebuilt()?(s.parent||(s.parent=this),s.rebuild(),s.show()):this.add(s)}addUndoableEditor(s){this.addCommands({cmd:()=>s._uiManager.rebuild(s),undo:()=>{s.remove()},mustExec:!1})}getNextId(){return o(this,q).getId()}combinedSignal(s){return o(this,q).combinedSignal(s)}canCreateNewEmptyEditor(){var s;return(s=o(this,kt,bs))==null?void 0:s.canCreateNewEmptyEditor()}pasteEditor(s,e){o(this,q).updateToolbar(s),o(this,q).updateMode(s);const{offsetX:i,offsetY:n}=A(this,kt,Ad).call(this),r=this.getNextId(),a=A(this,kt,yd).call(this,{parent:this,id:r,x:i,y:n,uiManager:o(this,q),isCentered:!0,...e});a&&this.add(a)}async deserialize(s){var e,i;return await((i=o(ts,Qi).get((e=s.annotationType)!=null?e:s.annotationEditorType))==null?void 0:i.deserialize(s,this,o(this,q)))||null}createAndAddNewEditor(s,e,i={}){const n=this.getNextId(),r=A(this,kt,yd).call(this,{parent:this,id:n,x:s.offsetX,y:s.offsetY,uiManager:o(this,q),isCentered:e,...i});return r&&this.add(r),r}addNewEditor(){this.createAndAddNewEditor(A(this,kt,Ad).call(this),!0)}setSelected(s){o(this,q).setSelected(s)}toggleSelected(s){o(this,q).toggleSelected(s)}unselect(s){o(this,q).unselect(s)}pointerup(s){var i;const{isMac:e}=ge.platform;!(s.button!==0||s.ctrlKey&&e)&&s.target===this.div&&o(this,Ki)&&(v(this,Ki,!1),(i=o(this,kt,bs))!=null&&i.isDrawer&&o(this,kt,bs).supportMultipleDrawings||(o(this,Fa)?o(this,q).getMode()!==st.STAMP?this.createAndAddNewEditor(s,!1):o(this,q).unselectAll():v(this,Fa,!0)))}pointerdown(s){var n;if(o(this,q).getMode()===st.HIGHLIGHT&&this.enableTextSelection(),o(this,Ki)){v(this,Ki,!1);return}const{isMac:e}=ge.platform;if(s.button!==0||s.ctrlKey&&e||s.target!==this.div)return;if(v(this,Ki,!0),(n=o(this,kt,bs))!=null&&n.isDrawer){this.startDrawingSession(s);return}const i=o(this,q).getActive();v(this,Fa,!i||i.isEmpty())}startDrawingSession(s){if(this.div.focus(),o(this,us)){o(this,kt,bs).startDrawing(this,o(this,q),!1,s);return}o(this,q).setCurrentDrawingSession(this),v(this,us,new AbortController);const e=o(this,q).combinedSignal(o(this,us));this.div.addEventListener("blur",(({relatedTarget:i})=>{i&&!this.div.contains(i)&&(v(this,pi,null),this.commitOrRemove())}),{signal:e}),o(this,kt,bs).startDrawing(this,o(this,q),!1,s)}pause(s){if(s){const{activeElement:e}=document;this.div.contains(e)&&v(this,pi,e)}else o(this,pi)&&setTimeout((()=>{var e;(e=o(this,pi))==null||e.focus(),v(this,pi,null)}),0)}endDrawingSession(s=!1){return o(this,us)?(o(this,q).setCurrentDrawingSession(null),o(this,us).abort(),v(this,us,null),v(this,pi,null),o(this,kt,bs).endDrawing(s)):null}findNewParent(s,e,i){const n=o(this,q).findParent(e,i);return n===null||n===this?!1:(n.changeParent(s),!0)}commitOrRemove(){return o(this,us)?(this.endDrawingSession(),!0):!1}onScaleChanging(){o(this,us)&&o(this,kt,bs).onScaleChangingWhenDrawing(this)}destroy(){var s,e;this.commitOrRemove(),((s=o(this,q).getActive())==null?void 0:s.parent)===this&&(o(this,q).commitOrRemove(),o(this,q).setActiveEditor(null)),o(this,ui)&&(clearTimeout(o(this,ui)),v(this,ui,null));for(const i of o(this,Ye).values())(e=o(this,ur))==null||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,o(this,Ye).clear(),o(this,q).removeLayer(this)}render({viewport:s}){this.viewport=s,gr(this.div,s);for(const e of o(this,q).getEditors(this.pageIndex))this.add(e),e.rebuild();this.updateMode()}update({viewport:s}){o(this,q).commitOrRemove(),A(this,kt,wh).call(this);const e=this.viewport.rotation,i=s.rotation;if(this.viewport=s,gr(this.div,{rotation:i}),e!==i)for(const n of o(this,Ye).values())n.rotate(i)}get pageDimensions(){const{pageWidth:s,pageHeight:e}=this.viewport.rawDims;return[s,e]}get scale(){return o(this,q).viewParameters.realScale}};ur=new WeakMap,Fa=new WeakMap,Fs=new WeakMap,Yi=new WeakMap,ui=new WeakMap,Ye=new WeakMap,Ki=new WeakMap,Na=new WeakMap,pr=ne
13w WeakMap,us=new WeakMap,pi=new WeakMap,oe=new WeakMap,fi=new WeakMap,q=new WeakMap,Qi=new WeakMap,kt=new WeakSet,bf=function(s){o(this,q).unselectAll();const{target:e}=s;if(e===o(this,oe).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&o(this,oe).div.contains(e)){const{isMac:i}=ge.platform;if(s.button!==0||s.ctrlKey&&i)return;o(this,q).showAllEditors("highlight",!0,!0),o(this,oe).div.classList.add("free"),this.toggleDrawing(),Mh.startHighlighting(this,o(this,q).direction==="ltr",{target:o(this,oe).div,x:s.x,y:s.y}),o(this,oe).div.addEventListener("pointerup",(()=>{o(this,oe).div.classList.remove("free"),this.toggleDrawing(!0)}),{once:!0,signal:o(this,q)._signal}),s.preventDefault()}},bs=function(){return o(ts,Qi).get(o(this,q).getMode())},yd=function(s){const e=o(this,kt,bs);return e?new e.prototype.constructor(s):null},Ad=function(){const{x:s,y:e,width:i,height:n}=this.div.getBoundingClientRect(),r=Math.max(0,s),a=Math.max(0,e),l=(r+Math.min(window.innerWidth,s+i))/2-s,h=(a+Math.min(window.innerHeight,e+n))/2-e,[c,d]=this.viewport.rotation%180==0?[l,h]:[h,l];return{offsetX:c,offsetY:d}},wh=function(){for(const s of o(this,Ye).values())s.isEmpty()&&s.remove()},et(ts,"_initialized",!1),y(ts,Qi,new Map([Zc,fd,gd,Mh].map((s=>[s._editorType,s]))));let bd=ts;var ps,Dl,pe,fr,qh,yf,Ns,xd,Af,_d;const ie=class ie{constructor({pageIndex:s}){y(this,Ns);y(this,ps,null);y(this,Dl,0);y(this,pe,new Map);y(this,fr,new Map);this.pageIndex=s}setParent(s){if(o(this,ps)){if(o(this,ps)!==s){if(o(this,pe).size>0)for(const e of o(this,pe).values())e.remove(),s.append(e);v(this,ps,s)}}else v(this,ps,s)}static get _svgFactory(){return ot(this,"_svgFactory",new Fd)}draw(s,e=!1,i=!1){const n=be(this,Dl)._++,r=A(this,Ns,xd).call(this),a=ie._svgFactory.createElement("defs");r.append(a);const l=ie._svgFactory.createElement("path");a.append(l);const h=`path_p${this.pageIndex}_${n}`;l.setAttribute("id",h),l.setAttribute("vector-effect","non-scaling-stroke"),e&&o(this,fr).set(n,l);const c=i?A(this,Ns,Af).call(this,a,h):null,d=ie._svgFactory.createElement("use");return r.append(d),d.setAttribute("href",`#${h}`),this.updateProperties(r,s),o(this,pe).set(n,r),{id:n,clipPathId:`url(#${c})`}}drawOutline(s,e){const i=be(this,Dl)._++,n=A(this,Ns,xd).call(this),r=ie._svgFactory.createElement("defs");n.append(r);const a=ie._svgFactory.createElement("path");r.append(a);const l=`path_p${this.pageIndex}_${i}`;a.setAttribute("id",l),a.setAttribute("vector-effect","non-scaling-stroke");let h;if(e){const p=ie._svgFactory.createElement("mask");r.append(p),h=`mask_p${this.pageIndex}_${i}`,p.setAttribute("id",h),p.setAttribute("maskUnits","objectBoundingBox");const g=ie._svgFactory.createElement("rect");p.append(g),g.setAttribute("width","1"),g.setAttribute("height","1"),g.setAttribute("fill","white");const f=ie._svgFactory.createElement("use");p.append(f),f.setAttribute("href",`#${l}`),f.setAttribute("stroke","none"),f.setAttribute("fill","black"),f.setAttribute("fill-rule","nonzero"),f.classList.add("mask")}const c=ie._svgFactory.createElement("use");n.append(c),c.setAttribute("href",`#${l}`),h&&c.setAttribute("mask",`url(#${h})`);const d=c.cloneNode();return n.append(d),c.classList.add("mainOutline"),d.classList.add("secondaryOutline"),this.updateProperties(n,s),o(this,pe).set(i,n),i}finalizeDraw(s,e){o(this,fr).delete(s),this.updateProperties(s,e)}updateProperties(s,e){var h;if(!e)return;const{root:i,bbox:n,rootClass:r,path:a}=e,l=typeof s=="number"?o(this,pe).get(s):s;if(l){if(i&&A(this,Ns,_d).call(this,l,i),n&&A(h=ie,qh,yf).call(h,l,n),r){const{classList:c}=l;for(const[d,p]of Object.entries(r))c.toggle(d,p)}if(a){const c=l.firstChild.firstChild;A(this,Ns,_d).call(this,c,a)}}}updateParent(s,e){if(e===this)return;const i=o(this,pe).get(s);i&&(o(e,ps).append(i),o(this,pe).delete(s),o(e,pe).set(s,i))}remove(s){o(this,fr).delete(s),o(this,ps)!==null&&(o(this,pe).get(s).remove(),o(this,pe).delete(s))}destroy(){v(this,ps,null);for(const s of o(this,pe).values())s.remove();o(this,pe).clear(),o(this,fr).clear()}};ps=new WeakMap,Dl=new WeakMap,pe=new WeakMap,fr=new WeakMap,qh=new WeakSet,yf=function(s,[e,i,n,r]){const{style:a}=s;a.top=100*i+"%",a.left=100*e+"%",a.width=100*n+"%",a.height=100*r+"%"},Ns=new WeakSet,xd=function(){const s=ie._svgFactory.create(1,1,!0);return o(this,ps).append(s),s.setAttribute("aria-hidden",!0),s},Af=function(s,e){const i=ie._svgFactory.createElement("clipPath");s.append(i);const n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const r=ie._svgFactory.createElement("use");return i.append(r),r.setAttribute("href",`#${e}`),r.classList.add("clip"),n},_d=function(s,e){for(const[i,n]of Object.entries(e))n===null?s.removeAttribute(i):s.setAttribute(i,n)},y(ie,qh);let wd=ie;globalThis.pdfjsTestingUtils={HighlightOutliner:ed};Q.AbortException;Q.AnnotationEditorLayer;Q.AnnotationEditorParamsType;Q.AnnotationEditorType;Q.AnnotationEditorUIManager;Q.AnnotationLayer;Q.AnnotationMode;Q.ColorPicker;Q.DOMSVGFactory;Q.DrawLayer;Q.FeatureTest;var p0=Q.GlobalWorkerOptions;Q.ImageKind;Q.InvalidPDFException;Q.MissingPDFException;Q.OPS;Q.OutputScale;Q.PDFDataRangeTransport;Q.PDFDateString;Q.PDFWorker;Q.PasswordResponses;Q.PermissionFlag;Q.PixelsPerInch;
13Q.RenderingCancelledException;Q.TextLayer;Q.TouchManager;Q.UnexpectedResponseException;Q.Util;Q.VerbosityLevel;Q.XfaLayer;Q.build;Q.createValidAbsoluteUrl;Q.fetchData;var f0=Q.getDocument;Q.getFilenameFromUrl;Q.getPdfFilenameFromUrl;Q.getXfaPageViewport;Q.isDataScheme;Q.isPdfFile;Q.noContextMenu;Q.normalizeUnicode;Q.setLayerDimensions;Q.shadow;Q.stopEvent;Q.version;const g0=""+new URL("pdf.worker.min.rsCePomN.mjs",import.meta.url).href,m0={class:"toolbar"},v0=["max","placeholder"],b0={class:"toolbar-text"},y0={key:0,class:"progress-bar-container"},A0=Cf({__name:"index",props:{src:{},height:{}},setup(u){p0.workerSrc=g0;const s=u,e=Mt(1),i=Mt(1),n=Mt(0),r=Mt(1),a=Mt(0),l=Mt(!1),h=Mt(),c=Mt();let d=null;async function p(E){if(!(!d||!c.value))try{const C=await d.getPage(E),T=C.getViewport({scale:e.value}),k=c.value.getContext("2d");if(!k)return;const I=window.devicePixelRatio||1,P=T.width,N=T.height,O=P*I,Y=N*I;k.clearRect(0,0,c.value.width,c.value.height),c.value.width=O,c.value.height=Y,c.value.style.width=`${P}px`,c.value.style.height=`${N}px`,k.scale(I,I);const K={canvasContext:k,viewport:T};if(await C.render(K).promise,await Ua(),h.value){const V=P,it=h.value.clientWidth;V>it&&(h.value.scrollLeft=0),h.value.scrollTop=0}}catch(C){console.error("PDF 渲æå¤±è´¥:",C)}}function g(E){if(!h.value)return 1;const C=h.value.clientWidth-32;if(C<=0||E<=0)return 1;const T=C*.95/E;return Math.min(Math.max(T,.5),2)}async function f(E){if(E)try{l.value=!0,a.value=0;const C=f0(E);C.onProgress=P=>{P.total>0&&(a.value=P.loaded/P.total*100)},d=await C.promise,n.value=d.numPages,i.value=1,r.value=1,a.value=100,await Ua();const k=(await d.getPage(1)).getViewport({scale:1}),I=g(k.width);e.value=I,await Ua(),await p(1),setTimeout(()=>{l.value=!1,a.value=0},300)}catch(C){console.error("PDF å 载失败:",C),l.value=!1,a.value=0}}const m=async()=>{if(!d)return;const E=Math.min(e.value+.1,3);E!==e.value&&(e.value=E,await p(i.value))},b=async()=>{if(!d)return;const E=Math.max(e.value-.1,.5);E!==e.value&&(e.value=E,await p(i.value))},w=()=>{i.value=1},x=()=>{i.value=n.value},_=()=>{i.value<n.value&&i.value++},S=()=>{i.value>1&&i.value--};return za(i,async E=>{await p(E),r.value=E}),za(e,async()=>{await p(i.value)}),za(r,E=>{E&&E>=1&&E<=n.value&&(i.value=E)}),za(()=>s.src,E=>{E&&f(E)},{immediate:!0}),Au(async()=>{s.src&&await f(s.src),Ua(()=>{var E,C;(E=h.value)==null||E.addEventListener("keydown",T=>{T.key==="ArrowLeft"&&S(),T.key==="ArrowRight"&&_()}),(C=h.value)==null||C.focus()})}),(E,C)=>(fe(),Be("div",{class:"pdf-viewer",style:dc(s.height?{height:s.height}:{})},[Z("div",m0,[Z("button",{class:"toolbar-btn",onClick:m,title:"æ¾å¤§"},[...C[1]||(C[1]=[Z("i",{class:"ri-zoom-in-line"},null,-1)])]),Z("button",{class:"toolbar-btn",onClick:b,title:"缩å°"},[...C[2]||(C[2]=[Z("i",{class:"ri-zoom-out-line"},null,-1)])]),Z("button",{class:"toolbar-btn",onClick:w,title:"第ä¸é¡µ"},[...C[3]||(C[3]=[Z("i",{class:"ri-skip-back-mini-line"},null,-1)])]),Z("button",{class:"toolbar-btn",onClick:S,title:"ä¸ä¸é¡µ"},[...C[4]||(C[4]=[Z("i",{class:"ri-arrow-left-line"},null,-1)])]),Z("button",{class:"toolbar-btn",onClick:_,title:"ä¸ä¸é¡µ"},[...C[5]||(C[5]=[Z("i",{class:"ri-arrow-right-line"},null,-1)])]),Z("button",{class:"toolbar-btn",onClick:x,title:"æåä¸é¡µ"},[...C[6]||(C[6]=[Z("i",{class:"ri-skip-forward-mini-line"},null,-1)])]),kf(Z("input",{"onUpdate:modelValue":C[0]||(C[0]=T=>r.value=T),type:"number",min:"1",max:n.value,class:"goto-input",placeholder:i.value.toString()},null,8,v0),[[Tf,r.value,void 0,{number:!0,lazy:!0}]]),Z("span",b0,"/ "+Us(n.value),1)]),l.value?(fe(),Be("div",y0,[Z("div",{class:"progress-bar",style:dc({width:`${a.value}%`})},null,4)])):ln("",!0),Z("div",{ref_key:"container",ref:h,class:"canvas-wrapper",tabindex:"0"},[Z("canvas",{ref_key:"canvas",ref:c},null,512)],512)],4))}}),w0=Sd(A0,[["__scopeId","data-v-c3f61448"]]),x0={key:0,class:"image-reader-container"},_0={class:"image-item-wrapper"},S0=["src","onClick"],E0={key:0,class:"image-counter"},C0=["src"],k0={__name:"indexh5",props:{imageList:{type:Array,default:()=>[]}},setup(u){const s=u,e=Mt(0),i=Mt(!1),n=a=>{e.value=a.activeIndex},r=()=>{s.imageList&&s.imageList.length>0&&(i.value=!0)};return(a,l)=>{const h=Pf,c=Kf;return u.imageList&&u.imageList.length>0?(fe(),Be("div",x0,[Rr(hn(Jf),{modules:[hn(tg),hn(rg)],"slides-per-view":1,"space-between":0,pagination:{clickable:!0,type:"bullets"},navigation:!0,"initial-slide":0,onSlideChange:n,class:"swiper-container"},{default:Bl(()=>[(fe(!0),Be(Rf,null,Mf(u.imageList,(d,p)=>(fe(),wu(hn(Qf),{key:p},{default:Bl(()=>[Z("div",_0,[Z("img",{src:d,mode:"aspectFit",class:"swiper-image",onClick:g=>r(p)},null,8,S0)])]),_:2},1024))),128))]),_:1},8,["modules"]),u.imageList.length>1?(fe(),Be("div",E0,Us(e.value+1)+" / "+Us(u.imageList.length),1)):ln("",!0),Rr(c,null,{default:Bl(()=>[Rr(h,{show:i.value,"onUpdate:show":l[1]||(l[1]=d=>i.value=d)},{default:Bl(()=>[Z("div",{class:"image-popup",onClick:l[0]||(l[0]=d=>i.value=!1)},[Z("img",{src:u.imageList[e.value],alt:""},null,8,C0)])]),_:1},8,["show"])]),_:1})])):ln("",!0)}}},T0=Sd(k0,[["__scopeId","data-v-d7f3b1e6"]]),R0={class:"page-container"},M0={class:"main-content"},P0={class:"page-title"},I0={class:"arrow-container"},D0={class:"operate-section"},L0={key:0,src:ag,alt:""},F0={key:1,src:og,alt:""},N0={key:0,src:hg,alt:""},O0={key:1,src:cg,alt:""},B0={key:0,class:"content-section"},H0=["innerHTML"],j0={class:"author-section"},$0=["src"],z0={class:"author-name"},U0={key:2,class:"suggest-section"},V0={class:"suggest-title"},G0={class:"suggest-card"},q0={key:0,class:"copy-toast"},W0="empty-line",X0={__name:"detailH5",setup(u,{expose:s}){const e=Mt({informationCenter:sg}),i=If(),n=Df(),r=ng(),a=Mt(!1),l=Mt(null),h=Mt(null),c=Mt(null),{isTradChin:d,langType:p}=ig(),g=Lf({}),f=/<p>(?:\s| | |<br\s*\/?>)*<\/p>/gi,m=(R="")=>R.replace(f,`<p class="${W0}"><br></p>`),b=Hl("ssrRelatedData",Mt([])),w=Mt(b.value||[]),x=Mt(null),_=Mt(!1),S=Mt(""),E=Mt([]),C=Mt(),T=Hl("ssrDetailData",Mt(null)),k=Hl("ssrRoute",n);Hl("ssrLangType",p),T.value&&(Object.assign(g,T.value),g.content=m(g.content||""),l.value=k.query.id,h.value=k.query.type,c.value=k.query.columnId||"workersRights",Ua(()=>{Yt()}));const I=()=>
13{if(typeof window<"u"&&window.gtag){const R=g.title||"èµè®¯è¯¦æ
页";window.gtag("event","page_view",{page_title:R,page_path:"/pages/informationCenter/detailH5",page_location:window.location.href,content_id:l.value,content_type:h.value,column_id:c.value})}},P=(R,M={})=>{if(typeof window<"u"&&window.gtag){const D={content_id:l.value,content_type:h.value,content_title:g.title||"",column_id:c.value,...M};window.gtag("event",R,D)}},N=async()=>{let R;switch(h.value){case"1":R=Xf;break;case"2":R=Wf;break;case"3":R=qf;break;case"4":R=Gf;break}const M=await R({contentId:l.value,langType:p.value});if(!M){jl({message:"å
容ä¸åå¨",icon:"none",duration:2e3}),r.back();return}Object.assign(g,M||{}),O(),g.content=m(M.content).replace(/<video\b([^>]*?)>/gi,(D,L)=>(L=L.replace(/\bwidth\s*=\s*["']?[^"'\s]*["']?/gi,"").replace(/\bheight\s*=\s*["']?[^"'\s]*["']?/gi,""),`<video style="width:100%;height:auto;display:block;margin:0 auto"${L}>`)),Yt()},O=async()=>{console.log("å è½½æ¨èå表",c.value,typeof c.value);const R=c.value&&c.value!=="undefined"&&c.value!=="null"?c.value:"workersRights",M=await Hf({columnId:R,pageNo:1,pageSize:3});w.value=M?M.list.filter(D=>D.id!==l.value):[]},Y=O,K=async R=>{P("share_content",{share_title:R.title,share_type:"information"});const M=String(n.query.id||n.query.contentId||(R==null?void 0:R.id)||l.value||"");if(M)try{await zf({contentId:M})}catch(G){console.warn("contentShare failed",G)}console.log("this.$route",window.location.origin);let D="/counselingDetail";const L=n.query,$={columnId:L.id||L.contentId||"",id:L.id||L.contentId||"",type:L.type||""};($.columnId===void 0||$.columnId===null||$.columnId==="undefined"||$.columnId==="null")&&($.columnId=""),console.log($,"queryParams"),D+="?id="+$.id+"&type="+$.type,C.value.openShareModal({url:r.getPath(D)})},V=async(R,M)=>{if(P(M?"collect_content":"uncollect_content",{collect_status:M,content_title:R.title}),!a.value){jl({message:"è«å
ç»é",icon:"none",duration:2e3});return}const D=M?jf:$f;try{await D(R.basicId),R.isCollect=M}catch(L){jl({message:L.message,icon:"none",duration:2e3})}},it=R=>{S.value=R,_.value=!0,setTimeout(()=>{_.value=!1},2e3)},rt=R=>{navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(R).then(()=>{it(t("copySuccess"))}).catch(M=>{console.error(`${t("copyFail")} ${M}`),j(R)}):j(R)},j=R=>{const M=document.createElement("textarea");M.value=R,M.style.position="fixed",M.style.left="-999999px",M.style.top="-999999px",document.body.appendChild(M),M.focus(),M.select();try{document.execCommand("copy"),it(t("copySuccess"))}catch(D){console.error("å¤å¶å¤±è´¥:",D),it(t("copyFail"))}finally{document.body.removeChild(M)}},H=()=>{x.value&&clearTimeout(x.value),uni.setClipboardData({data:g.title,success:()=>{S.value=t("copySuccess"),_.value=!0,setTimeout(()=>{_.value=!1},2e3)},fail:()=>{S.value=t("copyFail"),_.value=!0,setTimeout(()=>{_.value=!1},2e3)}})},xt=()=>{x.value&&clearTimeout(x.value);let R="";if(window.getSelection&&(R=window.getSelection().toString()),R.trim())rt(R);else{const M=document.createElement("div");M.innerHTML=g.content;const D=M.textContent||M.innerText||"";rt(D)}},vt=async R=>{if(P(R.isLike?"unlike_content":"like_content",{like_status:!R.isLike,content_title:R.title}),!a.value){jl({message:"è«å
ç»é",icon:"none",duration:2e3});return}await(R.isLike?Uf:Vf)(R.basicId),R.isLike=!R.isLike,R.isLike?R.likeCount?R.likeCount++:R.likeCount=1:R.likeCount--},Yt=async()=>{if(!(!g||!g.basicId))try{let R;h.value=="1"?R=await Ff(g.basicId):h.value=="2"?R=await Nf(g.basicId):h.value=="3"?R=await Of(g.basicId):h.value=="4"&&(R=await Bf(g.basicId)),R?R&&Array.isArray(R)||Array.isArray(R)?E.value=R:E.value=[]:E.value=[]}catch(R){console.error("è·åå¾çURL失败:",R),E.value=[]}},ut=()=>{const R=n.query;l.value=R.id,h.value=R.type,c.value=R.columnId||"workersRights"};return za(()=>[n.query.id,n.query.type],([R,M])=>{R&&M&&(typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"}),ut(),N(),I())}),Au(()=>{i.userInfo&&(a.value=!0),g.title?(!w.value||w.value.length===0)&&Y():(ut(),N()),I()}),s({dataInfo:ut,loadData:N,trackPageView:I}),(R,M)=>{const D=Sf;return fe(),Be("div",R0,[Z("div",M0,[Z("div",P0,[Z("div",I0,[Z("img",{src:Ef,onClick:M[0]||(M[0]=L=>hn(r).back()),class:"w-24px h-24px",alt:""})]),Z("div",{class:"page-title-name selectable-text",onLongpress:H},Us(g.title),33)]),Z("div",D0,[Z("div",{onClick:M[1]||(M[1]=L=>V(g,!g.isCollect)),class:Gd(["operate-item",g.isCollect?"operate-collected":""])},[g.isCollect?(fe(),Be("img",L0)):(fe(),Be("img",F0)),M[4]||(M[4]=Z("text",null,"æ¶è",-1))],2),Z("div",{onClick:M[2]||(M[2]=L=>K(g)),class:"operate-item"},[...M[5]||(M[5]=[Z("img",{src:lg,alt:""},null,-1),Z("text",null,"å享",-1)])]),Z("div",{onClick:M[3]||(M[3]=L=>vt(g)),class:Gd(["operate-item",g.isLike?"operate-liked":""])},[g.isLike?(fe(),Be("img",N0)):(fe(),Be("img",O0)),Z("text",{style:dc({color:g.isLike?"#1591E4":"#A8A8A8"})},Us(g.likeCount),5),Z("text",null,Us(hn(d)?"è®å¥½":"ç¹èµ"),1)],2)]),h.value==="4"?(fe(),Be("div",B0,[Rr(w0,{src:g.pdfUrl},null,8,["src"])])):ln("",!0),Z("div",{innerHTML:g.content,class:"content-section",onLongpress:xt},null,40,H0),Z("div",j0,[Z("img",{src:e.value.informationCenter.infoAuthorImg,class:"author-img",mode:"aspectFill"},null,8,$0),Z("div",z0,Us(e.value.informationCenter.infoAuthor),1)]),E.value&&E.value.length>0?(fe(),wu(T0,{key:1,"image-list":E.value},null,8,["image-list"])):ln("",!0),w.value.length>0?(fe(),Be("div",U0,[Z("div",V0,Us(hn(d)?"ä½ å¯è½ææèè¶£":"ä½ å¯è½æå
´è¶£"),1),Z("div",G0,[Rr(Yf,{items:w.value},null,8,["items"])])])):ln("",!0)]),_.value?(fe(),Be("div",q0,Us(S.value),1)):ln("",!0),Rr(D,{ref_key:"shareModalRef",ref:C},null,512)])}}},vv=Sd(X0,[["__scopeId","data-v-8a256bf3"]]);export{vv as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.