@zeniai/web-cockpit-ui 2.2.3-dev → 2.2.4-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/CreditAgentRoutes-u0O_RURn.js +4 -0
- package/dist/assets/{Preview-DLXp0Nre.js → Preview-CpfeeYEq.js} +1 -1
- package/dist/assets/{ScreenRoutes-mNNAq2e0.js → ScreenRoutes-CR0rsb0Y.js} +47 -47
- package/dist/assets/SignInScreen-z6WbJ1aE.js +1 -0
- package/dist/assets/{analytics-Cpw_JFiz.js → analytics-BLiQ3r9c.js} +1 -1
- package/dist/assets/{analyticsHelper-CzxQ1sBg.js → analyticsHelper-DNNAu42l.js} +1 -1
- package/dist/assets/{core-C5tWvKn9.js → core-CaiNtOVG.js} +1 -1
- package/dist/assets/{dash.all.min-XXj4RMq7.js → dash.all.min-CO0NorRH.js} +1 -1
- package/dist/assets/{empty-DYKX7aTA.js → empty-BmRfieO3.js} +1 -1
- package/dist/assets/{empty-BkjD_QtG.js → empty-uYhbfvaB.js} +1 -1
- package/dist/assets/epic-Bn6OJhuX.js +2 -0
- package/dist/assets/{index-uhY5BQQW.js → index-Boi22kzY.js} +1 -1
- package/dist/assets/{index-CGmQ25w1.js → index-CCd3lqis.js} +1 -1
- package/dist/assets/{index-QXFSNsr1.js → index-CqGS07ri.js} +1 -1
- package/dist/assets/{index-UvRXhO-m.js → index-DW4y2Msf.js} +2 -2
- package/dist/assets/{index-BGSZe5h-.js → index-DuA1EKiR.js} +1 -1
- package/dist/assets/{index-CdjoevdL.js → index-MlV_iDqQ.js} +1 -1
- package/dist/assets/{index-DjadZV6S.js → index-hcHHCGb3.js} +5 -5
- package/dist/assets/{lexical-CKFp6sGG.js → lexical-C4WBaZjK.js} +1 -1
- package/dist/assets/{liveblocks-BE1HGGgU.js → liveblocks-Diai9yiG.js} +1 -1
- package/dist/assets/{lottie-Dr0gn8Y_.js → lottie-D_bVgLfy.js} +1 -1
- package/dist/assets/{mui-CTDQ5aN3.js → mui-BIPv0jvV.js} +1 -1
- package/dist/assets/{react-DF-f7Mx8.js → react-BboDstqi.js} +1 -1
- package/dist/assets/{react-DUgONTIp.js → react-BkE5BCng.js} +1 -1
- package/dist/assets/{react-DDpCwbnl.js → react-BuyXPPrb.js} +1 -1
- package/dist/assets/{react-D7WYPjNP.js → react-CpRoLi6r.js} +1 -1
- package/dist/assets/{react-CWrXYNRM.js → react-Cv_0gVZe.js} +1 -1
- package/dist/assets/{react-CE2Gy3yN.js → react-DYhmbanG.js} +1 -1
- package/dist/assets/{react-CNux81vz.js → react-DxU5bhXa.js} +1 -1
- package/dist/assets/{react-BMe-yNMk.js → react-l9RBfATv.js} +2 -2
- package/dist/assets/{recharts-BkIVB65f.js → recharts-B79-sf8F.js} +1 -1
- package/dist/assets/{sentry-YgIwZ_T_.js → sentry-RkVKi_jZ.js} +1 -1
- package/dist/assets/{url-DGfuvT_J.js → url-BLdTFROI.js} +1 -1
- package/dist/assets/{url-BvpwB5AE.js → url-Dh0JKULk.js} +1 -1
- package/dist/assets/{utils-BxX50sbg.js → utils-BWbSm1fM.js} +1 -1
- package/dist/assets/{zeni-epic-state-D_vJEt9U.js → zeni-epic-state-Ckg9Vp34.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/CreditAgentRoutes-8ONlldpW.js +0 -4
- package/dist/assets/SignInScreen-Dbb-FrOZ.js +0 -1
- package/dist/assets/epic-BqAXKjm0.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/empty-
|
|
2
|
-
import{a as g,R as $,e as SZe,b as I4,p as M0,r as Bc,g as Yq,d as xre,f as EZe,s as yre,w as LZe,i as IZe,S as jZe,j as MZe,k as BZe,l as PZe,m as DZe}from"./sentry-YgIwZ_T_.js";import{j as Co,_ as b$e,a as wd,u as w$e,T as TZe,C as zZe,b as RZe,c as uj,d as hj,e as FZe,f as OZe,g as v$e,h as NZe,i as HZe,L as _Ze,k as bre,l as VZe,m as QZe,P as UZe,n as WZe,o as GZe,p as C$e,q as YZe,r as KZe,I as wre,s as qZe,t as ZZe,v as JZe,w as XZe,x as eJe,y as tJe,z as A$e,A as oJe,B as rJe,D as iJe}from"./liveblocks-BE1HGGgU.js";import{f as $$e,R as Jf,r as Fn,P as Dn,u as mj,g as gh,h as nJe,i as Kq,j as aJe,k as sJe,l as uT,N as lJe,m as cJe,n as dJe,B as pJe}from"./core-C5tWvKn9.js";import{H as AE,ba as Xf,bb as uJe,bc as vre,bd as q4,be as fr,bf as k$e,bg as gj,bh as Qr,bi as hJe,bj as Mh,bk as mJe,bl as gJe,bm as L8,bn as hg,bo as v9,bp as S$e,bq as fJe,br as q1,bs as E$e,bt as xJe,bu as qq,bv as L$e,bw as sn,bx as I8,by as Qu,bz as Cre,bA as yJe,bB as bJe,bC as I$e,bD as TW,bE as wJe,bF as vJe,bG as CJe,bH as AJe,bI as Zq,bJ as j$e,bK as $Je,bL as Zb,bM as kJe,bN as M$e,bO as zW,bP as Are,bQ as $re,bR as kre,bS as zl,bT as Jq,bU as B$e,bV as Xq,bW as C9,bX as fj,bY as eZ,bZ as tZ,b_ as oZ,b$ as rZ,c0 as SJe,c1 as xj,c2 as sp,c3 as lp,c4 as $E,c5 as P$e,c6 as D$e,c7 as iZ,c8 as nZ,c9 as EJe,ca as ep,cb as Dv,cc as Tv,cd as LJe,ce as IJe,cf as jJe,cg as MJe,ch as BJe,ci as PJe,cj as DJe,ck as yA,cl as T$e,cm as z$e,cn as TJe,co as zJe,cp as R$e,cq as F$e,cr as RJe,cs as FJe,ct as OJe,cu as O$e,cv as N$e,cw as NJe,cx as HJe,cy as _Je,cz as H$e,cA as VJe,cB as Sre,cC as QJe,cD as UJe,cE as Iw,cF as WJe,cG as _$e,cH as GJe,cI as V$e,cJ as YJe,cK as Ere,cL as KJe,cM as Q$e,cN as U$e,cO as W$e,cP as G$e,cQ as Y$e,cR as qJe,cS as K$e,cT as ZJe,cU as JJe,cV as XJe,cW as q$e,cX as RW,cY as eXe,cZ as Z$e,c_ as J$e,c$ as tXe,d0 as oXe,d1 as rXe,d2 as iXe,d3 as nXe,d4 as aXe,d5 as sXe,d6 as lXe,v as cXe,d7 as yj,d8 as FW,d9 as OW,da as dXe,db as pXe,dc as uXe,dd as hXe,de as mXe,df as gXe,dg as fXe,dh as xXe,di as yXe,dj as bXe,dk as Lre,dl as wXe,dm as vXe,dn as CXe,dp as AXe,dq as $Xe}from"./zeni-epic-state-D_vJEt9U.js";import{T as X$e,j as Uo,n as i,c as he,k as Vt,G as zv,C as eke,u as kXe,a as SXe}from"./mui-CTDQ5aN3.js";import{r as EXe,m as Uu}from"./analytics-Cpw_JFiz.js";import{L as NW}from"./lottie-Dr0gn8Y_.js";import{r as Da}from"./lexical-CKFp6sGG.js";import{E as Xi,c as bj,P as LXe,R as HW,F as kE,X as hd,Y as md,G as b2,H as SE,I as wj,J as w2,K as tke,L as IXe,M as jXe,N as Z4,O as aZ,Q as sZ,S as Rv,U as MXe}from"./recharts-BkIVB65f.js";import{r as BXe}from"./utils-BxX50sbg.js";(function(){try{var e=typeof window<"u"?window:typeof I4<"u"?I4:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a5079150-9d89-4031-8371-1ea4093271a8",e._sentryDebugIdIdentifier="sentry-dbid-a5079150-9d89-4031-8371-1ea4093271a8")}catch{}})();(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();var bA={},Ire;function PXe(){if(Ire)return bA;Ire=1;var e=$$e();return bA.createRoot=e.createRoot,bA.hydrateRoot=e.hydrateRoot,bA}var DXe=PXe(),xc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof I4<"u"?I4:typeof self<"u"?self:{};function Hr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jre={exports:{}},wx={},Mre;function TXe(){if(Mre)return wx;Mre=1;var e=$,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,p,u){var h,m={},f=null,x=null;u!==void 0&&(f=""+u),p.key!==void 0&&(f=""+p.key),p.ref!==void 0&&(x=p.ref);for(h in p)n.call(p,h)&&!l.hasOwnProperty(h)&&(m[h]=p[h]);if(d&&d.defaultProps)for(h in p=d.defaultProps,p)m[h]===void 0&&(m[h]=p[h]);return{$$typeof:t,type:d,key:f,ref:x,props:m,_owner:a.current}}return wx.Fragment=r,wx.jsx=c,wx.jsxs=c,wx}var Bre;function oke(){return Bre||(Bre=1,jre.exports=TXe()),jre.exports}var s=oke();const zXe=g.createContext(null),hT={didCatch:!1,error:null};let RXe=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hT}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var t,r,n=arguments.length,a=new Array(n),l=0;l<n;l++)a[l]=arguments[l];(t=(r=this.props).onReset)===null||t===void 0||t.call(r,{args:a,reason:"imperative-api"}),this.setState(hT)}}componentDidCatch(e,t){var r,n;(r=(n=this.props).onError)===null||r===void 0||r.call(n,e,t)}componentDidUpdate(e,t){const{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&t.error!==null&&FXe(e.resetKeys,n)){var a,l;(a=(l=this.props).onReset)===null||a===void 0||a.call(l,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(hT)}}render(){const{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:a,error:l}=this.state;let c=e;if(a){const d={error:l,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")c=t(d);else if(r)c=g.createElement(r,d);else if(n!==void 0)c=n;else throw l}return g.createElement(zXe.Provider,{value:{didCatch:a,error:l,resetErrorBoundary:this.resetErrorBoundary}},c)}};function FXe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}var _W={exports:{}},OXe=_W.exports,Pre;function NXe(){return Pre||(Pre=1,(function(e){(function(t,r){e.exports?e.exports=r():t.numeral=r()})(OXe,function(){var t,r,n="2.0.6",a={},l={},c={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},d={currentLocale:c.currentLocale,zeroFormat:c.zeroFormat,nullFormat:c.nullFormat,defaultFormat:c.defaultFormat,scalePercentBy100:c.scalePercentBy100};function p(u,h){this._input=u,this._value=h}return t=function(u){var h,m,f,x;if(t.isNumeral(u))h=u.value();else if(u===0||typeof u>"u")h=0;else if(u===null||r.isNaN(u))h=null;else if(typeof u=="string")if(d.zeroFormat&&u===d.zeroFormat)h=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)h=null;else{for(m in a)if(x=typeof a[m].regexps.unformat=="function"?a[m].regexps.unformat():a[m].regexps.unformat,x&&u.match(x)){f=a[m].unformat;break}f=f||t._.stringToNumber,h=f(u)}else h=Number(u)||null;return new p(u,h)},t.version=n,t.isNumeral=function(u){return u instanceof p},t._=r={numberToFormat:function(u,h,m){var f=l[t.options.currentLocale],x=!1,y=!1,b=0,w="",v=1e12,A=1e9,S=1e6,E=1e3,I="",L=!1,B,D,M,T,R,N,K;if(u=u||0,D=Math.abs(u),t._.includes(h,"(")?(x=!0,h=h.replace(/[\(|\)]/g,"")):(t._.includes(h,"+")||t._.includes(h,"-"))&&(R=t._.includes(h,"+")?h.indexOf("+"):u<0?h.indexOf("-"):-1,h=h.replace(/[\+|\-]/g,"")),t._.includes(h,"a")&&(B=h.match(/a(k|m|b|t)?/),B=B?B[1]:!1,t._.includes(h," a")&&(w=" "),h=h.replace(new RegExp(w+"a[kmbt]?"),""),D>=v&&!B||B==="t"?(w+=f.abbreviations.trillion,u=u/v):D<v&&D>=A&&!B||B==="b"?(w+=f.abbreviations.billion,u=u/A):D<A&&D>=S&&!B||B==="m"?(w+=f.abbreviations.million,u=u/S):(D<S&&D>=E&&!B||B==="k")&&(w+=f.abbreviations.thousand,u=u/E)),t._.includes(h,"[.]")&&(y=!0,h=h.replace("[.]",".")),M=u.toString().split(".")[0],T=h.split(".")[1],N=h.indexOf(","),b=(h.split(".")[0].split(",")[0].match(/0/g)||[]).length,T?(t._.includes(T,"[")?(T=T.replace("]",""),T=T.split("["),I=t._.toFixed(u,T[0].length+T[1].length,m,T[1].length)):I=t._.toFixed(u,T.length,m),M=I.split(".")[0],t._.includes(I,".")?I=f.delimiters.decimal+I.split(".")[1]:I="",y&&Number(I.slice(1))===0&&(I="")):M=t._.toFixed(u,0,m),w&&!B&&Number(M)>=1e3&&w!==f.abbreviations.trillion)switch(M=String(Number(M)/1e3),w){case f.abbreviations.thousand:w=f.abbreviations.million;break;case f.abbreviations.million:w=f.abbreviations.billion;break;case f.abbreviations.billion:w=f.abbreviations.trillion;break}if(t._.includes(M,"-")&&(M=M.slice(1),L=!0),M.length<b)for(var q=b-M.length;q>0;q--)M="0"+M;return N>-1&&(M=M.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),h.indexOf(".")===0&&(M=""),K=M+I+(w||""),x?K=(x&&L?"(":"")+K+(x&&L?")":""):R>=0?K=R===0?(L?"-":"+")+K:K+(L?"-":"+"):L&&(K="-"+K),K},stringToNumber:function(u){var h=l[d.currentLocale],m=u,f={thousand:3,million:6,billion:9,trillion:12},x,y,b;if(d.zeroFormat&&u===d.zeroFormat)y=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)y=null;else{y=1,h.delimiters.decimal!=="."&&(u=u.replace(/\./g,"").replace(h.delimiters.decimal,"."));for(x in f)if(b=new RegExp("[^a-zA-Z]"+h.abbreviations[x]+"(?:\\)|(\\"+h.currency.symbol+")?(?:\\))?)?$"),m.match(b)){y*=Math.pow(10,f[x]);break}y*=(u.split("-").length+Math.min(u.split("(").length-1,u.split(")").length-1))%2?1:-1,u=u.replace(/[^0-9\.]+/g,""),y*=Number(u)}return y},isNaN:function(u){return typeof u=="number"&&isNaN(u)},includes:function(u,h){return u.indexOf(h)!==-1},insert:function(u,h,m){return u.slice(0,m)+h+u.slice(m)},reduce:function(u,h){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof h!="function")throw new TypeError(h+" is not a function");var m=Object(u),f=m.length>>>0,x=0,y;if(arguments.length===3)y=arguments[2];else{for(;x<f&&!(x in m);)x++;if(x>=f)throw new TypeError("Reduce of empty array with no initial value");y=m[x++]}for(;x<f;x++)x in m&&(y=h(y,m[x],x,m));return y},multiplier:function(u){var h=u.toString().split(".");return h.length<2?1:Math.pow(10,h[1].length)},correctionFactor:function(){var u=Array.prototype.slice.call(arguments);return u.reduce(function(h,m){var f=r.multiplier(m);return h>f?h:f},1)},toFixed:function(u,h,m,f){var x=u.toString().split("."),y=h-(f||0),b,w,v,A;return x.length===2?b=Math.min(Math.max(x[1].length,y),h):b=y,v=Math.pow(10,b),A=(m(u+"e+"+b)/v).toFixed(b),f>h-b&&(w=new RegExp("\\.?0{1,"+(f-(h-b))+"}$"),A=A.replace(w,"")),A}},t.options=d,t.formats=a,t.locales=l,t.locale=function(u){return u&&(d.currentLocale=u.toLowerCase()),d.currentLocale},t.localeData=function(u){if(!u)return l[d.currentLocale];if(u=u.toLowerCase(),!l[u])throw new Error("Unknown locale : "+u);return l[u]},t.reset=function(){for(var u in c)d[u]=c[u]},t.zeroFormat=function(u){d.zeroFormat=typeof u=="string"?u:null},t.nullFormat=function(u){d.nullFormat=typeof u=="string"?u:null},t.defaultFormat=function(u){d.defaultFormat=typeof u=="string"?u:"0.0"},t.register=function(u,h,m){if(h=h.toLowerCase(),this[u+"s"][h])throw new TypeError(h+" "+u+" already registered.");return this[u+"s"][h]=m,m},t.validate=function(u,h){var m,f,x,y,b,w,v,A;if(typeof u!="string"&&(u+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",u)),u=u.trim(),u.match(/^\d+$/))return!0;if(u==="")return!1;try{v=t.localeData(h)}catch{v=t.localeData(t.locale())}return x=v.currency.symbol,b=v.abbreviations,m=v.delimiters.decimal,v.delimiters.thousands==="."?f="\\.":f=v.delimiters.thousands,A=u.match(/^[^\d]+/),A!==null&&(u=u.substr(1),A[0]!==x)||(A=u.match(/[^\d]+$/),A!==null&&(u=u.slice(0,-1),A[0]!==b.thousand&&A[0]!==b.million&&A[0]!==b.billion&&A[0]!==b.trillion))?!1:(w=new RegExp(f+"{2}"),u.match(/[^\d.,]/g)?!1:(y=u.split(m),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/)))},t.fn=p.prototype={clone:function(){return t(this)},format:function(u,h){var m=this._value,f=u||d.defaultFormat,x,y,b;if(h=h||Math.round,m===0&&d.zeroFormat!==null)y=d.zeroFormat;else if(m===null&&d.nullFormat!==null)y=d.nullFormat;else{for(x in a)if(f.match(a[x].regexps.format)){b=a[x].format;break}b=b||t._.numberToFormat,y=b(m,f,h)}return y},value:function(){return this._value},input:function(){return this._input},set:function(u){return this._value=Number(u),this},add:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f+Math.round(h*x)}return this._value=r.reduce([this._value,u],m,0)/h,this},subtract:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f-Math.round(h*x)}return this._value=r.reduce([u],m,Math.round(this._value*h))/h,this},multiply:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)*Math.round(f*b)/Math.round(b*b)}return this._value=r.reduce([this._value,u],h,1),this},divide:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)/Math.round(f*b)}return this._value=r.reduce([this._value,u],h),this},difference:function(u){return Math.abs(t(this._value).subtract(u).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(u){var h=u%10;return~~(u%100/10)===1?"th":h===1?"st":h===2?"nd":h===3?"rd":"th"},currency:{symbol:"$"}}),(function(){t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(u,h,m){var f=t._.includes(h," BPS")?" ":"",x;return u=u*1e4,h=h.replace(/\s?BPS/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"BPS"),x=x.join("")):x=x+f+"BPS",x},unformat:function(u){return+(t._.stringToNumber(u)*1e-4).toFixed(15)}})})(),(function(){var u={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},h={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},m=u.suffixes.concat(h.suffixes.filter(function(x){return u.suffixes.indexOf(x)<0})),f=m.join("|");f="("+f.replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(x,y,b){var w,v=t._.includes(y,"ib")?h:u,A=t._.includes(y," b")||t._.includes(y," ib")?" ":"",S,E,I;for(y=y.replace(/\s?i?b/,""),S=0;S<=v.suffixes.length;S++)if(E=Math.pow(v.base,S),I=Math.pow(v.base,S+1),x===null||x===0||x>=E&&x<I){A+=v.suffixes[S],E>0&&(x=x/E);break}return w=t._.numberToFormat(x,y,b),w+A},unformat:function(x){var y=t._.stringToNumber(x),b,w;if(y){for(b=u.suffixes.length-1;b>=0;b--){if(t._.includes(x,u.suffixes[b])){w=Math.pow(u.base,b);break}if(t._.includes(x,h.suffixes[b])){w=Math.pow(h.base,b);break}}y*=w||1}return y}})})(),(function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x={before:h.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:h.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,b,w;for(h=h.replace(/\s?\$\s?/,""),y=t._.numberToFormat(u,h,m),u>=0?(x.before=x.before.replace(/[\-\(]/,""),x.after=x.after.replace(/[\-\)]/,"")):u<0&&!t._.includes(x.before,"-")&&!t._.includes(x.before,"(")&&(x.before="-"+x.before),w=0;w<x.before.length;w++)switch(b=x.before[w],b){case"$":y=t._.insert(y,f.currency.symbol,w);break;case" ":y=t._.insert(y," ",w+f.currency.symbol.length-1);break}for(w=x.after.length-1;w>=0;w--)switch(b=x.after[w],b){case"$":y=w===x.after.length-1?y+f.currency.symbol:t._.insert(y,f.currency.symbol,-(x.after.length-(1+w)));break;case" ":y=w===x.after.length-1?y+" ":t._.insert(y," ",-(x.after.length-(1+w)+f.currency.symbol.length-1));break}return y}})})(),(function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(u,h,m){var f,x=typeof u=="number"&&!t._.isNaN(u)?u.toExponential():"0e+0",y=x.split("e");return h=h.replace(/e[\+|\-]{1}0/,""),f=t._.numberToFormat(Number(y[0]),h,m),f+"e"+y[1]},unformat:function(u){var h=t._.includes(u,"e+")?u.split("e+"):u.split("e-"),m=Number(h[0]),f=Number(h[1]);f=t._.includes(u,"e-")?f*=-1:f;function x(y,b,w,v){var A=t._.correctionFactor(y,b),S=y*A*(b*A)/(A*A);return S}return t._.reduce([m,Math.pow(10,f)],x,1)}})})(),(function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x,y=t._.includes(h," o")?" ":"";return h=h.replace(/\s?o/,""),y+=f.ordinal(u),x=t._.numberToFormat(u,h,m),x+y}})})(),(function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(u,h,m){var f=t._.includes(h," %")?" ":"",x;return t.options.scalePercentBy100&&(u=u*100),h=h.replace(/\s?\%/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"%"),x=x.join("")):x=x+f+"%",x},unformat:function(u){var h=t._.stringToNumber(u);return t.options.scalePercentBy100?h*.01:h}})})(),(function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(u,h,m){var f=Math.floor(u/60/60),x=Math.floor((u-f*60*60)/60),y=Math.round(u-f*60*60-x*60);return f+":"+(x<10?"0"+x:x)+":"+(y<10?"0"+y:y)},unformat:function(u){var h=u.split(":"),m=0;return h.length===3?(m=m+Number(h[0])*60*60,m=m+Number(h[1])*60,m=m+Number(h[2])):h.length===2&&(m=m+Number(h[0])*60,m=m+Number(h[1])),Number(m)}})})(),t})})(_W)),_W.exports}var HXe=NXe();const np=Hr(HXe);function l2(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}const r2="$$material";function _Xe(e){for(var t=0,r,n=0,a=e.length;a>=4;++n,a-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var VXe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function QXe(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var UXe=/[A-Z]|^ms/g,WXe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,rke=function(e){return e.charCodeAt(1)===45},Dre=function(e){return e!=null&&typeof e!="boolean"},mT=QXe(function(e){return rke(e)?e:e.replace(UXe,"-$&").toLowerCase()}),Tre=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(WXe,function(r,n,a){return Qm={name:n,styles:a,next:Qm},n})}return VXe[e]!==1&&!rke(e)&&typeof t=="number"&&t!==0?t+"px":t};function EE(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var a=r;if(a.anim===1)return Qm={name:a.name,styles:a.styles,next:Qm},a.name;var l=r;if(l.styles!==void 0){var c=l.next;if(c!==void 0)for(;c!==void 0;)Qm={name:c.name,styles:c.styles,next:Qm},c=c.next;var d=l.styles+";";return d}return GXe(e,t,r)}}var p=r;return p}function GXe(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a<r.length;a++)n+=EE(e,t,r[a])+";";else for(var l in r){var c=r[l];if(typeof c!="object"){var d=c;Dre(d)&&(n+=mT(l)+":"+Tre(l,d)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&t==null)for(var p=0;p<c.length;p++)Dre(c[p])&&(n+=mT(l)+":"+Tre(l,c[p])+";");else{var u=EE(e,t,c);switch(l){case"animation":case"animationName":{n+=mT(l)+":"+u+";";break}default:n+=l+"{"+u+"}"}}}return n}var zre=/label:\s*([^\s;{]+)\s*(;|$)/g,Qm;function YXe(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,a="";Qm=void 0;var l=e[0];if(l==null||l.raw===void 0)n=!1,a+=EE(r,t,l);else{var c=l;a+=c[0]}for(var d=1;d<e.length;d++)if(a+=EE(r,t,e[d]),n){var p=l;a+=p[d]}zre.lastIndex=0;for(var u="",h;(h=zre.exec(a))!==null;)u+="-"+h[1];var m=_Xe(a)+u;return{name:m,styles:a,next:Qm}}var gT={exports:{}},fT,Rre;function KXe(){if(Rre)return fT;Rre=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return fT=e,fT}var xT,Fre;function qXe(){if(Fre)return xT;Fre=1;var e=KXe();function t(){}function r(){}return r.resetWarningCache=t,xT=function(){function n(c,d,p,u,h,m){if(m!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function a(){return n}var l={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return l.PropTypes=l,l},xT}var Ore;function lZ(){return Ore||(Ore=1,gT.exports=qXe()()),gT.exports}var ZXe=lZ();const Nt=Hr(ZXe);function JXe(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function XXe(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var eet=(function(){function e(r){var n=this;this._insertTag=function(a){var l;n.tags.length===0?n.insertionPoint?l=n.insertionPoint.nextSibling:n.prepend?l=n.container.firstChild:l=n.before:l=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,l),n.tags.push(a)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(XXe(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=JXe(n);try{a.insertRule(r,a.cssRules.length)}catch{}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e})(),Zs="-ms-",LE="-moz-",Ci="-webkit-",ike="comm",cZ="rule",dZ="decl",tet="@import",nke="@keyframes",oet="@layer",ret=Math.abs,vj=String.fromCharCode,iet=Object.assign;function net(e,t){return Ts(e,0)^45?(((t<<2^Ts(e,0))<<2^Ts(e,1))<<2^Ts(e,2))<<2^Ts(e,3):0}function ake(e){return e.trim()}function aet(e,t){return(e=t.exec(e))?e[0]:e}function Ai(e,t,r){return e.replace(t,r)}function VW(e,t){return e.indexOf(t)}function Ts(e,t){return e.charCodeAt(t)|0}function jw(e,t,r){return e.slice(t,r)}function Wu(e){return e.length}function pZ(e){return e.length}function wA(e,t){return t.push(e),e}function set(e,t){return e.map(t).join("")}var Cj=1,j8=1,ske=0,Ec=0,Ia=0,A9="";function Aj(e,t,r,n,a,l,c){return{value:e,root:t,parent:r,type:n,props:a,children:l,line:Cj,column:j8,length:c,return:""}}function vx(e,t){return iet(Aj("",null,null,"",null,null,0),e,{length:-e.length},t)}function cet(){return Ia}function det(){return Ia=Ec>0?Ts(A9,--Ec):0,j8--,Ia===10&&(j8=1,Cj--),Ia}function dd(){return Ia=Ec<ske?Ts(A9,Ec++):0,j8++,Ia===10&&(j8=1,Cj++),Ia}function Ch(){return Ts(A9,Ec)}function NS(){return Ec}function Fv(e,t){return jw(A9,e,t)}function Mw(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function lke(e){return Cj=j8=1,ske=Wu(A9=e),Ec=0,[]}function cke(e){return A9="",e}function HS(e){return ake(Fv(Ec-1,QW(e===91?e+2:e===40?e+1:e)))}function pet(e){for(;(Ia=Ch())&&Ia<33;)dd();return Mw(e)>2||Mw(Ia)>3?"":" "}function uet(e,t){for(;--t&&dd()&&!(Ia<48||Ia>102||Ia>57&&Ia<65||Ia>70&&Ia<97););return Fv(e,NS()+(t<6&&Ch()==32&&dd()==32))}function QW(e){for(;dd();)switch(Ia){case e:return Ec;case 34:case 39:e!==34&&e!==39&&QW(Ia);break;case 40:e===41&&QW(e);break;case 92:dd();break}return Ec}function het(e,t){for(;dd()&&e+Ia!==57&&!(e+Ia===84&&Ch()===47););return"/*"+Fv(t,Ec-1)+"*"+vj(e===47?e:dd())}function met(e){for(;!Mw(Ch());)dd();return Fv(e,Ec)}function get(e){return cke(_S("",null,null,null,[""],e=lke(e),0,[0],e))}function _S(e,t,r,n,a,l,c,d,p){for(var u=0,h=0,m=c,f=0,x=0,y=0,b=1,w=1,v=1,A=0,S="",E=a,I=l,L=n,B=S;w;)switch(y=A,A=dd()){case 40:if(y!=108&&Ts(B,m-1)==58){VW(B+=Ai(HS(A),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:B+=HS(A);break;case 9:case 10:case 13:case 32:B+=pet(y);break;case 92:B+=uet(NS()-1,7);continue;case 47:switch(Ch()){case 42:case 47:wA(fet(het(dd(),NS()),t,r),p);break;default:B+="/"}break;case 123*b:d[u++]=Wu(B)*v;case 125*b:case 59:case 0:switch(A){case 0:case 125:w=0;case 59+h:v==-1&&(B=Ai(B,/\f/g,"")),x>0&&Wu(B)-m&&wA(x>32?Hre(B+";",n,r,m-1):Hre(Ai(B," ","")+";",n,r,m-2),p);break;case 59:B+=";";default:if(wA(L=Nre(B,t,r,u,h,a,d,S,E=[],I=[],m),l),A===123)if(h===0)_S(B,t,L,L,E,l,m,d,I);else switch(f===99&&Ts(B,3)===110?100:f){case 100:case 108:case 109:case 115:_S(e,L,L,n&&wA(Nre(e,L,L,0,0,a,d,S,a,E=[],m),I),a,I,m,d,n?E:I);break;default:_S(B,L,L,L,[""],I,0,d,I)}}u=h=x=0,b=v=1,S=B="",m=c;break;case 58:m=1+Wu(B),x=y;default:if(b<1){if(A==123)--b;else if(A==125&&b++==0&&det()==125)continue}switch(B+=vj(A),A*b){case 38:v=h>0?1:(B+="\f",-1);break;case 44:d[u++]=(Wu(B)-1)*v,v=1;break;case 64:Ch()===45&&(B+=HS(dd())),f=Ch(),h=m=Wu(S=B+=met(NS())),A++;break;case 45:y===45&&Wu(B)==2&&(b=0)}}return l}function Nre(e,t,r,n,a,l,c,d,p,u,h){for(var m=a-1,f=a===0?l:[""],x=pZ(f),y=0,b=0,w=0;y<n;++y)for(var v=0,A=jw(e,m+1,m=ret(b=c[y])),S=e;v<x;++v)(S=ake(b>0?f[v]+" "+A:Ai(A,/&\f/g,f[v])))&&(p[w++]=S);return Aj(e,t,r,a===0?cZ:d,p,u,h)}function fet(e,t,r){return Aj(e,t,r,ike,vj(cet()),jw(e,2,-2),0)}function Hre(e,t,r,n){return Aj(e,t,r,dZ,jw(e,0,n),jw(e,n+1,-1),n)}function r8(e,t){for(var r="",n=pZ(e),a=0;a<n;a++)r+=t(e[a],a,e,t)||"";return r}function xet(e,t,r,n){switch(e.type){case oet:if(e.children.length)break;case tet:case dZ:return e.return=e.return||e.value;case ike:return"";case nke:return e.return=e.value+"{"+r8(e.children,n)+"}";case cZ:e.value=e.props.join(",")}return Wu(r=r8(e.children,n))?e.return=e.value+"{"+r+"}":""}function yet(e){var t=pZ(e);return function(r,n,a,l){for(var c="",d=0;d<t;d++)c+=e[d](r,n,a,l)||"";return c}}function bet(e){return function(t){t.root||(t=t.return)&&e(t)}}var wet=function(e,t,r){for(var n=0,a=0;n=a,a=Ch(),n===38&&a===12&&(t[r]=1),!Mw(a);)dd();return Fv(e,Ec)},vet=function(e,t){var r=-1,n=44;do switch(Mw(n)){case 0:n===38&&Ch()===12&&(t[r]=1),e[r]+=wet(Ec-1,t,r);break;case 2:e[r]+=HS(n);break;case 4:if(n===44){e[++r]=Ch()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=vj(n)}while(n=dd());return e},Cet=function(e,t){return cke(vet(lke(e),t))},_re=new WeakMap,Aet=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!_re.get(r))&&!n){_re.set(e,!0);for(var a=[],l=Cet(t,a),c=r.props,d=0,p=0;d<l.length;d++)for(var u=0;u<c.length;u++,p++)e.props[p]=a[d]?l[d].replace(/&\f/g,c[u]):c[u]+" "+l[d]}}},$et=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function dke(e,t){switch(net(e,t)){case 5103:return Ci+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ci+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ci+e+LE+e+Zs+e+e;case 6828:case 4268:return Ci+e+Zs+e+e;case 6165:return Ci+e+Zs+"flex-"+e+e;case 5187:return Ci+e+Ai(e,/(\w+).+(:[^]+)/,Ci+"box-$1$2"+Zs+"flex-$1$2")+e;case 5443:return Ci+e+Zs+"flex-item-"+Ai(e,/flex-|-self/,"")+e;case 4675:return Ci+e+Zs+"flex-line-pack"+Ai(e,/align-content|flex-|-self/,"")+e;case 5548:return Ci+e+Zs+Ai(e,"shrink","negative")+e;case 5292:return Ci+e+Zs+Ai(e,"basis","preferred-size")+e;case 6060:return Ci+"box-"+Ai(e,"-grow","")+Ci+e+Zs+Ai(e,"grow","positive")+e;case 4554:return Ci+Ai(e,/([^-])(transform)/g,"$1"+Ci+"$2")+e;case 6187:return Ai(Ai(Ai(e,/(zoom-|grab)/,Ci+"$1"),/(image-set)/,Ci+"$1"),e,"")+e;case 5495:case 3959:return Ai(e,/(image-set\([^]*)/,Ci+"$1$`$1");case 4968:return Ai(Ai(e,/(.+:)(flex-)?(.*)/,Ci+"box-pack:$3"+Zs+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ci+e+e;case 4095:case 3583:case 4068:case 2532:return Ai(e,/(.+)-inline(.+)/,Ci+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Wu(e)-1-t>6)switch(Ts(e,t+1)){case 109:if(Ts(e,t+4)!==45)break;case 102:return Ai(e,/(.+:)(.+)-([^]+)/,"$1"+Ci+"$2-$3$1"+LE+(Ts(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~VW(e,"stretch")?dke(Ai(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ts(e,t+1)!==115)break;case 6444:switch(Ts(e,Wu(e)-3-(~VW(e,"!important")&&10))){case 107:return Ai(e,":",":"+Ci)+e;case 101:return Ai(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ci+(Ts(e,14)===45?"inline-":"")+"box$3$1"+Ci+"$2$3$1"+Zs+"$2box$3")+e}break;case 5936:switch(Ts(e,t+11)){case 114:return Ci+e+Zs+Ai(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ci+e+Zs+Ai(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ci+e+Zs+Ai(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ci+e+Zs+e+e}return e}var ket=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case dZ:e.return=dke(e.value,e.length);break;case nke:return r8([vx(e,{value:Ai(e.value,"@","@"+Ci)})],n);case cZ:if(e.length)return set(e.props,function(a){switch(aet(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return r8([vx(e,{props:[Ai(a,/:(read-\w+)/,":"+LE+"$1")]})],n);case"::placeholder":return r8([vx(e,{props:[Ai(a,/:(plac\w+)/,":"+Ci+"input-$1")]}),vx(e,{props:[Ai(a,/:(plac\w+)/,":"+LE+"$1")]}),vx(e,{props:[Ai(a,/:(plac\w+)/,Zs+"input-$1")]})],n)}return""})}},Eet=[ket],pke=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(y){var b=y.getAttribute("data-emotion");b.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var n=e.stylisPlugins||Eet,a={},l,c=[];l=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(y){for(var b=y.getAttribute("data-emotion").split(" "),w=1;w<b.length;w++)a[b[w]]=!0;c.push(y)});var d,p=[Aet,$et];{var u,h=[xet,bet(function(y){u.insert(y)})],m=yet(p.concat(n,h)),f=function(y){return r8(get(y),m)};d=function(y,b,w,v){u=w,f(y?y+"{"+b.styles+"}":b.styles),v&&(x.inserted[b.name]=!0)}}var x={key:t,sheet:new eet({key:t,container:l,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:d};return x.sheet.hydrate(c),x};function Let(e){return e==null||Object.keys(e).length===0}function uke(e){const{styles:t,defaultTheme:r={}}=e,n=typeof t=="function"?a=>t(Let(a)?r:a):t;return s.jsx(zv,{styles:n})}function Iet(e,t){return i(e,t)}function jet(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Vre=[];function og(e){return Vre[0]=e,YXe(Vre)}var Qre={exports:{}},Qi={},Ure;function Met(){if(Ure)return Qi;Ure=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function y(b){if(typeof b=="object"&&b!==null){var w=b.$$typeof;switch(w){case e:switch(b=b.type,b){case r:case a:case n:case p:case u:case f:return b;default:switch(b=b&&b.$$typeof,b){case c:case d:case m:case h:return b;case l:return b;default:return w}}case t:return w}}}return Qi.ContextConsumer=l,Qi.ContextProvider=c,Qi.Element=e,Qi.ForwardRef=d,Qi.Fragment=r,Qi.Lazy=m,Qi.Memo=h,Qi.Portal=t,Qi.Profiler=a,Qi.StrictMode=n,Qi.Suspense=p,Qi.SuspenseList=u,Qi.isContextConsumer=function(b){return y(b)===l},Qi.isContextProvider=function(b){return y(b)===c},Qi.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},Qi.isForwardRef=function(b){return y(b)===d},Qi.isFragment=function(b){return y(b)===r},Qi.isLazy=function(b){return y(b)===m},Qi.isMemo=function(b){return y(b)===h},Qi.isPortal=function(b){return y(b)===t},Qi.isProfiler=function(b){return y(b)===a},Qi.isStrictMode=function(b){return y(b)===n},Qi.isSuspense=function(b){return y(b)===p},Qi.isSuspenseList=function(b){return y(b)===u},Qi.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===a||b===n||b===p||b===u||typeof b=="object"&&b!==null&&(b.$$typeof===m||b.$$typeof===h||b.$$typeof===c||b.$$typeof===l||b.$$typeof===d||b.$$typeof===x||b.getModuleId!==void 0)},Qi.typeOf=y,Qi}var Wre;function Bet(){return Wre||(Wre=1,Qre.exports=Met()),Qre.exports}var hke=Bet();function H0(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function mke(e){if(g.isValidElement(e)||hke.isValidElementType(e)||!H0(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=mke(e[r])}),t}function dl(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return H0(e)&&H0(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||hke.isValidElementType(t[a])?n[a]=t[a]:H0(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&H0(e[a])?n[a]=dl(e[a],t[a],r):r.clone?n[a]=H0(t[a])?mke(t[a]):t[a]:n[a]=t[a]}),n}const Pet=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function Det(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...a}=e,l=Pet(t),c=Object.keys(l);function d(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r})`}function p(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-n/100}${r})`}function u(f,x){const y=c.indexOf(x);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r}) and (max-width:${(y!==-1&&typeof t[c[y]]=="number"?t[c[y]]:x)-n/100}${r})`}function h(f){return c.indexOf(f)+1<c.length?u(f,c[c.indexOf(f)+1]):d(f)}function m(f){const x=c.indexOf(f);return x===0?d(c[1]):x===c.length-1?p(c[x]):u(f,c[c.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:c,values:l,up:d,down:p,between:u,only:h,not:m,unit:r,...a}}function Gre(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,a)=>{const l=/min-width:\s*([0-9.]+)/;return+(n.match(l)?.[1]||0)-+(a.match(l)?.[1]||0)});return r.length?r.reduce((n,a)=>{const l=t[a];return delete n[a],n[a]=l,n},{...t}):t}function Tet(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function zet(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r)return null;const[,n,a]=r,l=Number.isNaN(+n)?n||0:+n;return e.containerQueries(a).up(l)}function Ret(e){const t=(l,c)=>l.replace("@media",c?`@container ${c}`:"@container");function r(l,c){l.up=(...d)=>t(e.breakpoints.up(...d),c),l.down=(...d)=>t(e.breakpoints.down(...d),c),l.between=(...d)=>t(e.breakpoints.between(...d),c),l.only=(...d)=>t(e.breakpoints.only(...d),c),l.not=(...d)=>{const p=t(e.breakpoints.not(...d),c);return p.includes("not all and")?p.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):p}}const n={},a=l=>(r(n,l),n);return r(a),{...e,containerQueries:a}}const Fet={borderRadius:4};function Jb(e,t){return t?dl(e,t,{clone:!1}):e}const $j={xs:0,sm:600,md:900,lg:1200,xl:1536},Yre={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${$j[e]}px)`},Oet={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:$j[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function c2(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const a=n.breakpoints||Yre;return t.reduce((l,c,d)=>(l[a.up(a.keys[d])]=r(t[d]),l),{})}if(typeof t=="object"){const a=n.breakpoints||Yre;return Object.keys(t).reduce((l,c)=>{if(Tet(a.keys,c)){const d=zet(n.containerQueries?n:Oet,c);d&&(l[d]=r(t[c],c))}else if(Object.keys(a.values||$j).includes(c)){const d=a.up(c);l[d]=r(t[c],c)}else{const d=c;l[d]=t[d]}return l},{})}return r(t)}function Net(e={}){return e.keys?.reduce((t,r)=>{const n=e.up(r);return t[n]={},t},{})||{}}function Kre(e,t){return e.reduce((r,n)=>{const a=r[n];return(!a||Object.keys(a).length===0)&&delete r[n],r},t)}function hr(e){if(typeof e!="string")throw new Error(l2(7));return e.charAt(0).toUpperCase()+e.slice(1)}function kj(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((a,l)=>a&&a[l]?a[l]:null,e);if(n!=null)return n}return t.split(".").reduce((n,a)=>n&&n[a]!=null?n[a]:null,e)}function IE(e,t,r,n=r){let a;return typeof e=="function"?a=e(r):Array.isArray(e)?a=e[r]||n:a=kj(e,r)||n,t&&(a=t(a,n,e)),a}function ha(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:a}=e,l=c=>{if(c[t]==null)return null;const d=c[t],p=c.theme,u=kj(p,n)||{};return c2(c,d,h=>{let m=IE(u,a,h);return h===m&&typeof h=="string"&&(m=IE(u,a,`${t}${h==="default"?"":hr(h)}`,h)),r===!1?m:{[r]:m}})};return l.propTypes={},l.filterProps=[t],l}function Het(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const _et={m:"margin",p:"padding"},Vet={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},qre={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Qet=Het(e=>{if(e.length>2)if(qre[e])e=qre[e];else return[e];const[t,r]=e.split(""),n=_et[t],a=Vet[r]||"";return Array.isArray(a)?a.map(l=>n+l):[n+a]}),uZ=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],hZ=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...uZ,...hZ];function Ov(e,t,r,n){const a=kj(e,t,!0)??r;return typeof a=="number"||typeof a=="string"?l=>typeof l=="string"?l:typeof a=="string"?a.startsWith("var(")&&l===0?0:a.startsWith("var(")&&l===1?a:`calc(${l} * ${a})`:a*l:Array.isArray(a)?l=>{if(typeof l=="string")return l;const c=Math.abs(l),d=a[c];return l>=0?d:typeof d=="number"?-d:typeof d=="string"&&d.startsWith("var(")?`calc(-1 * ${d})`:`-${d}`}:typeof a=="function"?a:(()=>{})}function mZ(e){return Ov(e,"spacing",8)}function Nv(e,t){return typeof t=="string"||t==null?t:e(t)}function Uet(e,t){return r=>e.reduce((n,a)=>(n[a]=Nv(t,r),n),{})}function Wet(e,t,r,n){if(!t.includes(r))return null;const a=Qet(r),l=Uet(a,n),c=e[r];return c2(e,c,l)}function gke(e,t){const r=mZ(e.theme);return Object.keys(e).map(n=>Wet(e,t,n,r)).reduce(Jb,{})}function Nn(e){return gke(e,uZ)}Nn.propTypes={};Nn.filterProps=uZ;function Hn(e){return gke(e,hZ)}Hn.propTypes={};Hn.filterProps=hZ;function fke(e=8,t=mZ({spacing:e})){if(e.mui)return e;const r=(...n)=>(n.length===0?[1]:n).map(a=>{const l=t(a);return typeof l=="number"?`${l}px`:l}).join(" ");return r.mui=!0,r}function Sj(...e){const t=e.reduce((n,a)=>(a.filterProps.forEach(l=>{n[l]=a}),n),{}),r=n=>Object.keys(n).reduce((a,l)=>t[l]?Jb(a,t[l](n)):a,{});return r.propTypes={},r.filterProps=e.reduce((n,a)=>n.concat(a.filterProps),[]),r}function Wd(e){return typeof e!="number"?e:`${e}px solid`}function m1(e,t){return ha({prop:e,themeKey:"borders",transform:t})}const Get=m1("border",Wd),Yet=m1("borderTop",Wd),Ket=m1("borderRight",Wd),qet=m1("borderBottom",Wd),Zet=m1("borderLeft",Wd),Jet=m1("borderColor"),Xet=m1("borderTopColor"),ett=m1("borderRightColor"),ttt=m1("borderBottomColor"),ott=m1("borderLeftColor"),rtt=m1("outline",Wd),itt=m1("outlineColor"),Ej=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ov(e.theme,"shape.borderRadius",4),r=n=>({borderRadius:Nv(t,n)});return c2(e,e.borderRadius,r)}return null};Ej.propTypes={};Ej.filterProps=["borderRadius"];Sj(Get,Yet,Ket,qet,Zet,Jet,Xet,ett,ttt,ott,Ej,rtt,itt);const Lj=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({gap:Nv(t,n)});return c2(e,e.gap,r)}return null};Lj.propTypes={};Lj.filterProps=["gap"];const Ij=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({columnGap:Nv(t,n)});return c2(e,e.columnGap,r)}return null};Ij.propTypes={};Ij.filterProps=["columnGap"];const jj=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({rowGap:Nv(t,n)});return c2(e,e.rowGap,r)}return null};jj.propTypes={};jj.filterProps=["rowGap"];const ntt=ha({prop:"gridColumn"}),att=ha({prop:"gridRow"}),stt=ha({prop:"gridAutoFlow"}),ltt=ha({prop:"gridAutoColumns"}),ctt=ha({prop:"gridAutoRows"}),dtt=ha({prop:"gridTemplateColumns"}),ptt=ha({prop:"gridTemplateRows"}),utt=ha({prop:"gridTemplateAreas"}),htt=ha({prop:"gridArea"});Sj(Lj,Ij,jj,ntt,att,stt,ltt,ctt,dtt,ptt,utt,htt);function i8(e,t){return t==="grey"?t:e}const mtt=ha({prop:"color",themeKey:"palette",transform:i8}),gtt=ha({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:i8}),ftt=ha({prop:"backgroundColor",themeKey:"palette",transform:i8});Sj(mtt,gtt,ftt);function rd(e){return e<=1&&e!==0?`${e*100}%`:e}const xtt=ha({prop:"width",transform:rd}),gZ=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||$j[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:rd(r)}};return c2(e,e.maxWidth,t)}return null};gZ.filterProps=["maxWidth"];const ytt=ha({prop:"minWidth",transform:rd}),btt=ha({prop:"height",transform:rd}),wtt=ha({prop:"maxHeight",transform:rd}),vtt=ha({prop:"minHeight",transform:rd});ha({prop:"size",cssProperty:"width",transform:rd});ha({prop:"size",cssProperty:"height",transform:rd});const Ctt=ha({prop:"boxSizing"});Sj(xtt,gZ,ytt,btt,wtt,vtt,Ctt);const Mj={border:{themeKey:"borders",transform:Wd},borderTop:{themeKey:"borders",transform:Wd},borderRight:{themeKey:"borders",transform:Wd},borderBottom:{themeKey:"borders",transform:Wd},borderLeft:{themeKey:"borders",transform:Wd},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Wd},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Ej},color:{themeKey:"palette",transform:i8},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:i8},backgroundColor:{themeKey:"palette",transform:i8},p:{style:Hn},pt:{style:Hn},pr:{style:Hn},pb:{style:Hn},pl:{style:Hn},px:{style:Hn},py:{style:Hn},padding:{style:Hn},paddingTop:{style:Hn},paddingRight:{style:Hn},paddingBottom:{style:Hn},paddingLeft:{style:Hn},paddingX:{style:Hn},paddingY:{style:Hn},paddingInline:{style:Hn},paddingInlineStart:{style:Hn},paddingInlineEnd:{style:Hn},paddingBlock:{style:Hn},paddingBlockStart:{style:Hn},paddingBlockEnd:{style:Hn},m:{style:Nn},mt:{style:Nn},mr:{style:Nn},mb:{style:Nn},ml:{style:Nn},mx:{style:Nn},my:{style:Nn},margin:{style:Nn},marginTop:{style:Nn},marginRight:{style:Nn},marginBottom:{style:Nn},marginLeft:{style:Nn},marginX:{style:Nn},marginY:{style:Nn},marginInline:{style:Nn},marginInlineStart:{style:Nn},marginInlineEnd:{style:Nn},marginBlock:{style:Nn},marginBlockStart:{style:Nn},marginBlockEnd:{style:Nn},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Lj},rowGap:{style:jj},columnGap:{style:Ij},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:rd},maxWidth:{style:gZ},minWidth:{transform:rd},height:{transform:rd},maxHeight:{transform:rd},minHeight:{transform:rd},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Att(...e){const t=e.reduce((n,a)=>n.concat(Object.keys(a)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function $tt(e,t){return typeof e=="function"?e(t):e}function ktt(){function e(r,n,a,l){const c={[r]:n,theme:a},d=l[r];if(!d)return{[r]:n};const{cssProperty:p=r,themeKey:u,transform:h,style:m}=d;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const f=kj(a,u)||{};return m?m(c):c2(c,n,x=>{let y=IE(f,h,x);return x===y&&typeof x=="string"&&(y=IE(f,h,`${r}${x==="default"?"":hr(x)}`,x)),p===!1?y:{[p]:y}})}function t(r){const{sx:n,theme:a={},nested:l}=r||{};if(!n)return null;const c=a.unstable_sxConfig??Mj;function d(p){let u=p;if(typeof p=="function")u=p(a);else if(typeof p!="object")return p;if(!u)return null;const h=Net(a.breakpoints),m=Object.keys(h);let f=h;return Object.keys(u).forEach(x=>{const y=$tt(u[x],a);if(y!=null)if(typeof y=="object")if(c[x])f=Jb(f,e(x,y,a,c));else{const b=c2({theme:a},y,w=>({[x]:w}));Att(b,y)?f[x]=t({sx:y,theme:a,nested:!0}):f=Jb(f,b)}else f=Jb(f,e(x,y,a,c))}),!l&&a.modularCssLayers?{"@layer sx":Gre(a,Kre(m,f))}:Gre(a,Kre(m,f))}return Array.isArray(n)?n.map(d):d(n)}return t}const j4=ktt();j4.filterProps=["sx"];function Stt(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||typeof r.getColorSchemeSelector!="function")return{};let n=r.getColorSchemeSelector(e);return n==="&"?t:((n.includes("data-")||n.includes("."))&&(n=`*:where(${n.replace(/\s*&$/,"")}) &`),{[n]:t})}return r.palette.mode===e?t:{}}function fZ(e={},...t){const{breakpoints:r={},palette:n={},spacing:a,shape:l={},...c}=e,d=Det(r),p=fke(a);let u=dl({breakpoints:d,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:p,shape:{...Fet,...l}},c);return u=Ret(u),u.applyStyles=Stt,u=t.reduce((h,m)=>dl(h,m),u),u.unstable_sxConfig={...Mj,...c?.unstable_sxConfig},u.unstable_sx=function(h){return j4({sx:h,theme:this})},u}function Ett(e){return Object.keys(e).length===0}function xZ(e=null){const t=g.useContext(X$e);return!t||Ett(t)?e:t}const Ltt=fZ();function xke(e=Ltt){return xZ(e)}function Zre(e){const t=og(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function yke({styles:e,themeId:t,defaultTheme:r={}}){const n=xke(r),a=t&&n[t]||n;let l=typeof e=="function"?e(a):e;return a.modularCssLayers&&(Array.isArray(l)?l=l.map(c=>Zre(typeof c=="function"?c(a):c)):l=Zre(l)),s.jsx(uke,{styles:l})}const Jre=e=>e,Itt=()=>{let e=Jre;return{configure(t){e=t},generate(t){return e(t)},reset(){e=Jre}}},jtt=Itt();function bke(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=bke(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ko(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=bke(e))&&(n&&(n+=" "),n+=t);return n}const Mtt={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function bi(e,t,r="Mui"){const n=Mtt[t];return n?`${r}-${n}`:`${jtt.generate(e)}-${t}`}function ai(e,t,r="Mui"){const n={};return t.forEach(a=>{n[a]=bi(e,a,r)}),n}function wke(e){const{variants:t,...r}=e,n={variants:t,style:og(r),isProcessed:!0};return n.style===r||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=og(a.style))}),n}const Btt=fZ();function yT(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function e4(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Ptt(e){return e?(t,r)=>r[e]:null}function Dtt(e,t,r){e.theme=Rtt(e.theme)?r:e.theme[t]||e.theme}function VS(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(a=>VS(e,a,r));if(Array.isArray(n?.variants)){let a;if(n.isProcessed)a=r?e4(n.style,r):n.style;else{const{variants:l,...c}=n;a=r?e4(og(c),r):c}return vke(e,n.variants,[a],r)}return n?.isProcessed?r?e4(og(n.style),r):n.style:r?e4(og(n),r):n}function vke(e,t,r=[],n=void 0){let a;e:for(let l=0;l<t.length;l+=1){const c=t[l];if(typeof c.props=="function"){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!c.props(a))continue}else for(const d in c.props)if(e[d]!==c.props[d]&&e.ownerState?.[d]!==c.props[d])continue e;typeof c.style=="function"?(a??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?e4(og(c.style(a)),n):c.style(a))):r.push(n?e4(og(c.style),n):c.style)}return r}function Ttt(e={}){const{themeId:t,defaultTheme:r=Btt,rootShouldForwardProp:n=yT,slotShouldForwardProp:a=yT}=e;function l(c){Dtt(c,t,r)}return(c,d={})=>{jet(c,I=>I.filter(L=>L!==j4));const{name:p,slot:u,skipVariantsResolver:h,skipSx:m,overridesResolver:f=Ptt(Ott(u)),...x}=d,y=p&&p.startsWith("Mui")||u?"components":"custom",b=h!==void 0?h:u&&u!=="Root"&&u!=="root"||!1,w=m||!1;let v=yT;u==="Root"||u==="root"?v=n:u?v=a:Ftt(c)&&(v=void 0);const A=Iet(c,{shouldForwardProp:v,label:ztt(),...x}),S=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(L){return VS(L,I,L.theme.modularCssLayers?y:void 0)};if(H0(I)){const L=wke(I);return function(B){return L.variants?VS(B,L,B.theme.modularCssLayers?y:void 0):B.theme.modularCssLayers?e4(L.style,y):L.style}}return I},E=(...I)=>{const L=[],B=I.map(S),D=[];if(L.push(l),p&&f&&D.push(function(R){const N=R.theme.components?.[p]?.styleOverrides;if(!N)return null;const K={};for(const q in N)K[q]=VS(R,N[q],R.theme.modularCssLayers?"theme":void 0);return f(R,K)}),p&&!b&&D.push(function(R){const N=R.theme?.components?.[p]?.variants;return N?vke(R,N,[],R.theme.modularCssLayers?"theme":void 0):null}),w||D.push(j4),Array.isArray(B[0])){const R=B.shift(),N=new Array(L.length).fill(""),K=new Array(D.length).fill("");let q;q=[...N,...R,...K],q.raw=[...N,...R.raw,...K],L.unshift(q)}const M=[...L,...B,...D],T=A(...M);return c.muiName&&(T.muiName=c.muiName),T};return A.withConfig&&(E.withConfig=A.withConfig),E}}function ztt(e,t){return void 0}function Rtt(e){for(const t in e)return!1;return!0}function Ftt(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Ott(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function UW(e,t,r=!1){const n={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const l=a;if(l==="components"||l==="slots")n[l]={...e[l],...n[l]};else if(l==="componentsProps"||l==="slotProps"){const c=e[l],d=t[l];if(!d)n[l]=c||{};else if(!c)n[l]=d;else{n[l]={...d};for(const p in c)if(Object.prototype.hasOwnProperty.call(c,p)){const u=p;n[l][u]=UW(c[u],d[u],r)}}}else l==="className"&&r&&t.className?n.className=Ko(e?.className,t?.className):l==="style"&&r&&t.style?n.style={...e?.style,...t?.style}:n[l]===void 0&&(n[l]=e[l])}return n}const gd=typeof window<"u"?g.useLayoutEffect:g.useEffect;function Ntt(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function yZ(e,t=0,r=1){return Ntt(e,t,r)}function Htt(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,a)=>a<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function mg(e){if(e.type)return e;if(e.charAt(0)==="#")return mg(Htt(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(l2(9,e));let n=e.substring(t+1,e.length-1),a;if(r==="color"){if(n=n.split(" "),a=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(l2(10,a))}else n=n.split(",");return n=n.map(l=>parseFloat(l)),{type:r,values:n,colorSpace:a}}const _tt=e=>{const t=mg(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},gb=(e,t)=>{try{return _tt(e)}catch{return e}};function Bj(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((a,l)=>l<3?parseInt(a,10):a):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function Cke(e){e=mg(e);const{values:t}=e,r=t[0],n=t[1]/100,a=t[2]/100,l=n*Math.min(a,1-a),c=(u,h=(u+r/30)%12)=>a-l*Math.max(Math.min(h-3,9-h,1),-1);let d="rgb";const p=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(d+="a",p.push(t[3])),Bj({type:d,values:p})}function WW(e){e=mg(e);let t=e.type==="hsl"||e.type==="hsla"?mg(Cke(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function Vtt(e,t){const r=WW(e),n=WW(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function jE(e,t){return e=mg(e),t=yZ(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,Bj(e)}function R3(e,t,r){try{return jE(e,t)}catch{return e}}function Pj(e,t){if(e=mg(e),t=yZ(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return Bj(e)}function Mi(e,t,r){try{return Pj(e,t)}catch{return e}}function Dj(e,t){if(e=mg(e),t=yZ(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return Bj(e)}function Bi(e,t,r){try{return Dj(e,t)}catch{return e}}function Qtt(e,t=.15){return WW(e)>.5?Pj(e,t):Dj(e,t)}function vA(e,t,r){try{return Qtt(e,t)}catch{return e}}const Ake=g.createContext(null);function bZ(){return g.useContext(Ake)}const Utt=typeof Symbol=="function"&&Symbol.for,Wtt=Utt?Symbol.for("mui.nested"):"__THEME_NESTED__";function Gtt(e,t){return typeof t=="function"?t(e):{...e,...t}}function Ytt(e){const{children:t,theme:r}=e,n=bZ(),a=g.useMemo(()=>{const l=n===null?{...r}:Gtt(n,r);return l!=null&&(l[Wtt]=n!==null),l},[r,n]);return s.jsx(Ake.Provider,{value:a,children:t})}const $ke=g.createContext();function Ktt({value:e,...t}){return s.jsx($ke.Provider,{value:e??!0,...t})}const $9=()=>g.useContext($ke)??!1,kke=g.createContext(void 0);function qtt({value:e,children:t}){return s.jsx(kke.Provider,{value:e,children:t})}function Ztt(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const a=t.components[r];return a.defaultProps?UW(a.defaultProps,n,t.components.mergeClassNameAndStyle):!a.styleOverrides&&!a.variants?UW(a,n,t.components.mergeClassNameAndStyle):n}function Jtt({props:e,name:t}){const r=g.useContext(kke);return Ztt({props:e,name:t,theme:{components:r}})}let Xre=0;function Xtt(e){const[t,r]=g.useState(e),n=e||t;return g.useEffect(()=>{t==null&&(Xre+=1,r(`mui-${Xre}`))},[t]),n}const eot={...SZe},eie=eot.useId;function Tj(e){if(eie!==void 0){const t=eie();return e??t}return Xtt(e)}function tot(e){const t=xZ(),r=Tj()||"",{modularCssLayers:n}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!n||t!==null?a="":typeof n=="string"?a=n.replace(/mui(?!\.)/g,a):a=`@layer ${a};`,gd(()=>{const l=document.querySelector("head");if(!l)return;const c=l.firstChild;if(a){if(c&&c.hasAttribute?.("data-mui-layer-order")&&c.getAttribute("data-mui-layer-order")===r)return;const d=document.createElement("style");d.setAttribute("data-mui-layer-order",r),d.textContent=a,l.prepend(d)}else l.querySelector(`style[data-mui-layer-order="${r}"]`)?.remove()},[a,r]),a?s.jsx(yke,{styles:a}):null}const tie={};function oie(e,t,r,n=!1){return g.useMemo(()=>{const a=e&&t[e]||t;if(typeof r=="function"){const l=r(a),c=e?{...t,[e]:l}:l;return n?()=>c:c}return e?{...t,[e]:r}:{...t,...r}},[e,t,r,n])}function Ske(e){const{children:t,theme:r,themeId:n}=e,a=xZ(tie),l=bZ()||tie,c=oie(n,a,r),d=oie(n,l,r,!0),p=(n?c[n]:c).direction==="rtl",u=tot(c);return s.jsx(Ytt,{theme:d,children:s.jsx(X$e.Provider,{value:c,children:s.jsx(Ktt,{value:p,children:s.jsxs(qtt,{value:n?c[n].components:c.components,children:[u,t]})})})})}const rie={theme:void 0};function oot(e){let t,r;return function(n){let a=t;return(a===void 0||n.theme!==r)&&(rie.theme=n.theme,a=wke(e(rie)),t=a,r=n.theme),a}}const wZ="mode",vZ="color-scheme",rot="data-color-scheme";function iot(e){const{defaultMode:t="system",defaultLightColorScheme:r="light",defaultDarkColorScheme:n="dark",modeStorageKey:a=wZ,colorSchemeStorageKey:l=vZ,attribute:c=rot,colorSchemeNode:d="document.documentElement",nonce:p}=e||{};let u="",h=c;if(c==="class"&&(h=".%s"),c==="data"&&(h="[data-%s]"),h.startsWith(".")){const f=h.substring(1);u+=`${d}.classList.remove('${f}'.replace('%s', light), '${f}'.replace('%s', dark));
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/empty-uYhbfvaB.js","assets/sentry-RkVKi_jZ.js","assets/empty-BmRfieO3.js","assets/index-CqGS07ri.js","assets/index-DuA1EKiR.js","assets/zeni-epic-state-Ckg9Vp34.js","assets/core-CaiNtOVG.js","assets/utils-BWbSm1fM.js","assets/recharts-B79-sf8F.js","assets/url-Dh0JKULk.js","assets/index-CCd3lqis.js","assets/index-Boi22kzY.js","assets/url-BLdTFROI.js","assets/index-DW4y2Msf.js","assets/ScreenRoutes-CR0rsb0Y.js","assets/liveblocks-Diai9yiG.js","assets/analyticsHelper-DNNAu42l.js","assets/mui-BIPv0jvV.js","assets/SignInScreen-z6WbJ1aE.js","assets/analytics-BLiQ3r9c.js","assets/lottie-D_bVgLfy.js","assets/lexical-C4WBaZjK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as g,R as $,e as SZe,b as I4,p as M0,r as Bc,g as Yq,d as xre,f as EZe,s as yre,w as LZe,i as IZe,S as jZe,j as MZe,k as BZe,l as PZe,m as DZe}from"./sentry-RkVKi_jZ.js";import{j as Co,_ as b$e,a as wd,u as w$e,T as TZe,C as zZe,b as RZe,c as uj,d as hj,e as FZe,f as OZe,g as v$e,h as NZe,i as HZe,L as _Ze,k as bre,l as VZe,m as QZe,P as UZe,n as WZe,o as GZe,p as C$e,q as YZe,r as KZe,I as wre,s as qZe,t as ZZe,v as JZe,w as XZe,x as eJe,y as tJe,z as A$e,A as oJe,B as rJe,D as iJe}from"./liveblocks-Diai9yiG.js";import{f as $$e,R as Jf,r as Fn,P as Dn,u as mj,g as gh,h as nJe,i as Kq,j as aJe,k as sJe,l as uT,N as lJe,m as cJe,n as dJe,B as pJe}from"./core-CaiNtOVG.js";import{H as AE,ba as Xf,bb as uJe,bc as vre,bd as q4,be as fr,bf as k$e,bg as gj,bh as Qr,bi as hJe,bj as Mh,bk as mJe,bl as gJe,bm as L8,bn as hg,bo as v9,bp as S$e,bq as fJe,br as q1,bs as E$e,bt as xJe,bu as qq,bv as L$e,bw as sn,bx as I8,by as Qu,bz as Cre,bA as yJe,bB as bJe,bC as I$e,bD as TW,bE as wJe,bF as vJe,bG as CJe,bH as AJe,bI as Zq,bJ as j$e,bK as $Je,bL as Zb,bM as kJe,bN as M$e,bO as zW,bP as Are,bQ as $re,bR as kre,bS as zl,bT as Jq,bU as B$e,bV as Xq,bW as C9,bX as fj,bY as eZ,bZ as tZ,b_ as oZ,b$ as rZ,c0 as SJe,c1 as xj,c2 as sp,c3 as lp,c4 as $E,c5 as P$e,c6 as D$e,c7 as iZ,c8 as nZ,c9 as EJe,ca as ep,cb as Dv,cc as Tv,cd as LJe,ce as IJe,cf as jJe,cg as MJe,ch as BJe,ci as PJe,cj as DJe,ck as yA,cl as T$e,cm as z$e,cn as TJe,co as zJe,cp as R$e,cq as F$e,cr as RJe,cs as FJe,ct as OJe,cu as O$e,cv as N$e,cw as NJe,cx as HJe,cy as _Je,cz as H$e,cA as VJe,cB as Sre,cC as QJe,cD as UJe,cE as Iw,cF as WJe,cG as _$e,cH as GJe,cI as V$e,cJ as YJe,cK as Ere,cL as KJe,cM as Q$e,cN as U$e,cO as W$e,cP as G$e,cQ as Y$e,cR as qJe,cS as K$e,cT as ZJe,cU as JJe,cV as XJe,cW as q$e,cX as RW,cY as eXe,cZ as Z$e,c_ as J$e,c$ as tXe,d0 as oXe,d1 as rXe,d2 as iXe,d3 as nXe,d4 as aXe,d5 as sXe,d6 as lXe,v as cXe,d7 as yj,d8 as FW,d9 as OW,da as dXe,db as pXe,dc as uXe,dd as hXe,de as mXe,df as gXe,dg as fXe,dh as xXe,di as yXe,dj as bXe,dk as Lre,dl as wXe,dm as vXe,dn as CXe,dp as AXe,dq as $Xe}from"./zeni-epic-state-Ckg9Vp34.js";import{T as X$e,j as Uo,n as i,c as he,k as Vt,G as zv,C as eke,u as kXe,a as SXe}from"./mui-BIPv0jvV.js";import{r as EXe,m as Uu}from"./analytics-BLiQ3r9c.js";import{L as NW}from"./lottie-D_bVgLfy.js";import{r as Da}from"./lexical-C4WBaZjK.js";import{E as Xi,c as bj,P as LXe,R as HW,F as kE,X as hd,Y as md,G as b2,H as SE,I as wj,J as w2,K as tke,L as IXe,M as jXe,N as Z4,O as aZ,Q as sZ,S as Rv,U as MXe}from"./recharts-B79-sf8F.js";import{r as BXe}from"./utils-BWbSm1fM.js";(function(){try{var e=typeof window<"u"?window:typeof I4<"u"?I4:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="a5079150-9d89-4031-8371-1ea4093271a8",e._sentryDebugIdIdentifier="sentry-dbid-a5079150-9d89-4031-8371-1ea4093271a8")}catch{}})();(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();var bA={},Ire;function PXe(){if(Ire)return bA;Ire=1;var e=$$e();return bA.createRoot=e.createRoot,bA.hydrateRoot=e.hydrateRoot,bA}var DXe=PXe(),xc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof I4<"u"?I4:typeof self<"u"?self:{};function Hr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jre={exports:{}},wx={},Mre;function TXe(){if(Mre)return wx;Mre=1;var e=$,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,p,u){var h,m={},f=null,x=null;u!==void 0&&(f=""+u),p.key!==void 0&&(f=""+p.key),p.ref!==void 0&&(x=p.ref);for(h in p)n.call(p,h)&&!l.hasOwnProperty(h)&&(m[h]=p[h]);if(d&&d.defaultProps)for(h in p=d.defaultProps,p)m[h]===void 0&&(m[h]=p[h]);return{$$typeof:t,type:d,key:f,ref:x,props:m,_owner:a.current}}return wx.Fragment=r,wx.jsx=c,wx.jsxs=c,wx}var Bre;function oke(){return Bre||(Bre=1,jre.exports=TXe()),jre.exports}var s=oke();const zXe=g.createContext(null),hT={didCatch:!1,error:null};let RXe=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=hT}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var t,r,n=arguments.length,a=new Array(n),l=0;l<n;l++)a[l]=arguments[l];(t=(r=this.props).onReset)===null||t===void 0||t.call(r,{args:a,reason:"imperative-api"}),this.setState(hT)}}componentDidCatch(e,t){var r,n;(r=(n=this.props).onError)===null||r===void 0||r.call(n,e,t)}componentDidUpdate(e,t){const{didCatch:r}=this.state,{resetKeys:n}=this.props;if(r&&t.error!==null&&FXe(e.resetKeys,n)){var a,l;(a=(l=this.props).onReset)===null||a===void 0||a.call(l,{next:n,prev:e.resetKeys,reason:"keys"}),this.setState(hT)}}render(){const{children:e,fallbackRender:t,FallbackComponent:r,fallback:n}=this.props,{didCatch:a,error:l}=this.state;let c=e;if(a){const d={error:l,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")c=t(d);else if(r)c=g.createElement(r,d);else if(n!==void 0)c=n;else throw l}return g.createElement(zXe.Provider,{value:{didCatch:a,error:l,resetErrorBoundary:this.resetErrorBoundary}},c)}};function FXe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}var _W={exports:{}},OXe=_W.exports,Pre;function NXe(){return Pre||(Pre=1,(function(e){(function(t,r){e.exports?e.exports=r():t.numeral=r()})(OXe,function(){var t,r,n="2.0.6",a={},l={},c={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},d={currentLocale:c.currentLocale,zeroFormat:c.zeroFormat,nullFormat:c.nullFormat,defaultFormat:c.defaultFormat,scalePercentBy100:c.scalePercentBy100};function p(u,h){this._input=u,this._value=h}return t=function(u){var h,m,f,x;if(t.isNumeral(u))h=u.value();else if(u===0||typeof u>"u")h=0;else if(u===null||r.isNaN(u))h=null;else if(typeof u=="string")if(d.zeroFormat&&u===d.zeroFormat)h=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)h=null;else{for(m in a)if(x=typeof a[m].regexps.unformat=="function"?a[m].regexps.unformat():a[m].regexps.unformat,x&&u.match(x)){f=a[m].unformat;break}f=f||t._.stringToNumber,h=f(u)}else h=Number(u)||null;return new p(u,h)},t.version=n,t.isNumeral=function(u){return u instanceof p},t._=r={numberToFormat:function(u,h,m){var f=l[t.options.currentLocale],x=!1,y=!1,b=0,w="",v=1e12,A=1e9,S=1e6,E=1e3,I="",L=!1,B,D,M,T,R,N,K;if(u=u||0,D=Math.abs(u),t._.includes(h,"(")?(x=!0,h=h.replace(/[\(|\)]/g,"")):(t._.includes(h,"+")||t._.includes(h,"-"))&&(R=t._.includes(h,"+")?h.indexOf("+"):u<0?h.indexOf("-"):-1,h=h.replace(/[\+|\-]/g,"")),t._.includes(h,"a")&&(B=h.match(/a(k|m|b|t)?/),B=B?B[1]:!1,t._.includes(h," a")&&(w=" "),h=h.replace(new RegExp(w+"a[kmbt]?"),""),D>=v&&!B||B==="t"?(w+=f.abbreviations.trillion,u=u/v):D<v&&D>=A&&!B||B==="b"?(w+=f.abbreviations.billion,u=u/A):D<A&&D>=S&&!B||B==="m"?(w+=f.abbreviations.million,u=u/S):(D<S&&D>=E&&!B||B==="k")&&(w+=f.abbreviations.thousand,u=u/E)),t._.includes(h,"[.]")&&(y=!0,h=h.replace("[.]",".")),M=u.toString().split(".")[0],T=h.split(".")[1],N=h.indexOf(","),b=(h.split(".")[0].split(",")[0].match(/0/g)||[]).length,T?(t._.includes(T,"[")?(T=T.replace("]",""),T=T.split("["),I=t._.toFixed(u,T[0].length+T[1].length,m,T[1].length)):I=t._.toFixed(u,T.length,m),M=I.split(".")[0],t._.includes(I,".")?I=f.delimiters.decimal+I.split(".")[1]:I="",y&&Number(I.slice(1))===0&&(I="")):M=t._.toFixed(u,0,m),w&&!B&&Number(M)>=1e3&&w!==f.abbreviations.trillion)switch(M=String(Number(M)/1e3),w){case f.abbreviations.thousand:w=f.abbreviations.million;break;case f.abbreviations.million:w=f.abbreviations.billion;break;case f.abbreviations.billion:w=f.abbreviations.trillion;break}if(t._.includes(M,"-")&&(M=M.slice(1),L=!0),M.length<b)for(var q=b-M.length;q>0;q--)M="0"+M;return N>-1&&(M=M.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),h.indexOf(".")===0&&(M=""),K=M+I+(w||""),x?K=(x&&L?"(":"")+K+(x&&L?")":""):R>=0?K=R===0?(L?"-":"+")+K:K+(L?"-":"+"):L&&(K="-"+K),K},stringToNumber:function(u){var h=l[d.currentLocale],m=u,f={thousand:3,million:6,billion:9,trillion:12},x,y,b;if(d.zeroFormat&&u===d.zeroFormat)y=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)y=null;else{y=1,h.delimiters.decimal!=="."&&(u=u.replace(/\./g,"").replace(h.delimiters.decimal,"."));for(x in f)if(b=new RegExp("[^a-zA-Z]"+h.abbreviations[x]+"(?:\\)|(\\"+h.currency.symbol+")?(?:\\))?)?$"),m.match(b)){y*=Math.pow(10,f[x]);break}y*=(u.split("-").length+Math.min(u.split("(").length-1,u.split(")").length-1))%2?1:-1,u=u.replace(/[^0-9\.]+/g,""),y*=Number(u)}return y},isNaN:function(u){return typeof u=="number"&&isNaN(u)},includes:function(u,h){return u.indexOf(h)!==-1},insert:function(u,h,m){return u.slice(0,m)+h+u.slice(m)},reduce:function(u,h){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof h!="function")throw new TypeError(h+" is not a function");var m=Object(u),f=m.length>>>0,x=0,y;if(arguments.length===3)y=arguments[2];else{for(;x<f&&!(x in m);)x++;if(x>=f)throw new TypeError("Reduce of empty array with no initial value");y=m[x++]}for(;x<f;x++)x in m&&(y=h(y,m[x],x,m));return y},multiplier:function(u){var h=u.toString().split(".");return h.length<2?1:Math.pow(10,h[1].length)},correctionFactor:function(){var u=Array.prototype.slice.call(arguments);return u.reduce(function(h,m){var f=r.multiplier(m);return h>f?h:f},1)},toFixed:function(u,h,m,f){var x=u.toString().split("."),y=h-(f||0),b,w,v,A;return x.length===2?b=Math.min(Math.max(x[1].length,y),h):b=y,v=Math.pow(10,b),A=(m(u+"e+"+b)/v).toFixed(b),f>h-b&&(w=new RegExp("\\.?0{1,"+(f-(h-b))+"}$"),A=A.replace(w,"")),A}},t.options=d,t.formats=a,t.locales=l,t.locale=function(u){return u&&(d.currentLocale=u.toLowerCase()),d.currentLocale},t.localeData=function(u){if(!u)return l[d.currentLocale];if(u=u.toLowerCase(),!l[u])throw new Error("Unknown locale : "+u);return l[u]},t.reset=function(){for(var u in c)d[u]=c[u]},t.zeroFormat=function(u){d.zeroFormat=typeof u=="string"?u:null},t.nullFormat=function(u){d.nullFormat=typeof u=="string"?u:null},t.defaultFormat=function(u){d.defaultFormat=typeof u=="string"?u:"0.0"},t.register=function(u,h,m){if(h=h.toLowerCase(),this[u+"s"][h])throw new TypeError(h+" "+u+" already registered.");return this[u+"s"][h]=m,m},t.validate=function(u,h){var m,f,x,y,b,w,v,A;if(typeof u!="string"&&(u+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",u)),u=u.trim(),u.match(/^\d+$/))return!0;if(u==="")return!1;try{v=t.localeData(h)}catch{v=t.localeData(t.locale())}return x=v.currency.symbol,b=v.abbreviations,m=v.delimiters.decimal,v.delimiters.thousands==="."?f="\\.":f=v.delimiters.thousands,A=u.match(/^[^\d]+/),A!==null&&(u=u.substr(1),A[0]!==x)||(A=u.match(/[^\d]+$/),A!==null&&(u=u.slice(0,-1),A[0]!==b.thousand&&A[0]!==b.million&&A[0]!==b.billion&&A[0]!==b.trillion))?!1:(w=new RegExp(f+"{2}"),u.match(/[^\d.,]/g)?!1:(y=u.split(m),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/)))},t.fn=p.prototype={clone:function(){return t(this)},format:function(u,h){var m=this._value,f=u||d.defaultFormat,x,y,b;if(h=h||Math.round,m===0&&d.zeroFormat!==null)y=d.zeroFormat;else if(m===null&&d.nullFormat!==null)y=d.nullFormat;else{for(x in a)if(f.match(a[x].regexps.format)){b=a[x].format;break}b=b||t._.numberToFormat,y=b(m,f,h)}return y},value:function(){return this._value},input:function(){return this._input},set:function(u){return this._value=Number(u),this},add:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f+Math.round(h*x)}return this._value=r.reduce([this._value,u],m,0)/h,this},subtract:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f-Math.round(h*x)}return this._value=r.reduce([u],m,Math.round(this._value*h))/h,this},multiply:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)*Math.round(f*b)/Math.round(b*b)}return this._value=r.reduce([this._value,u],h,1),this},divide:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)/Math.round(f*b)}return this._value=r.reduce([this._value,u],h),this},difference:function(u){return Math.abs(t(this._value).subtract(u).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(u){var h=u%10;return~~(u%100/10)===1?"th":h===1?"st":h===2?"nd":h===3?"rd":"th"},currency:{symbol:"$"}}),(function(){t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(u,h,m){var f=t._.includes(h," BPS")?" ":"",x;return u=u*1e4,h=h.replace(/\s?BPS/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"BPS"),x=x.join("")):x=x+f+"BPS",x},unformat:function(u){return+(t._.stringToNumber(u)*1e-4).toFixed(15)}})})(),(function(){var u={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},h={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},m=u.suffixes.concat(h.suffixes.filter(function(x){return u.suffixes.indexOf(x)<0})),f=m.join("|");f="("+f.replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(x,y,b){var w,v=t._.includes(y,"ib")?h:u,A=t._.includes(y," b")||t._.includes(y," ib")?" ":"",S,E,I;for(y=y.replace(/\s?i?b/,""),S=0;S<=v.suffixes.length;S++)if(E=Math.pow(v.base,S),I=Math.pow(v.base,S+1),x===null||x===0||x>=E&&x<I){A+=v.suffixes[S],E>0&&(x=x/E);break}return w=t._.numberToFormat(x,y,b),w+A},unformat:function(x){var y=t._.stringToNumber(x),b,w;if(y){for(b=u.suffixes.length-1;b>=0;b--){if(t._.includes(x,u.suffixes[b])){w=Math.pow(u.base,b);break}if(t._.includes(x,h.suffixes[b])){w=Math.pow(h.base,b);break}}y*=w||1}return y}})})(),(function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x={before:h.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:h.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,b,w;for(h=h.replace(/\s?\$\s?/,""),y=t._.numberToFormat(u,h,m),u>=0?(x.before=x.before.replace(/[\-\(]/,""),x.after=x.after.replace(/[\-\)]/,"")):u<0&&!t._.includes(x.before,"-")&&!t._.includes(x.before,"(")&&(x.before="-"+x.before),w=0;w<x.before.length;w++)switch(b=x.before[w],b){case"$":y=t._.insert(y,f.currency.symbol,w);break;case" ":y=t._.insert(y," ",w+f.currency.symbol.length-1);break}for(w=x.after.length-1;w>=0;w--)switch(b=x.after[w],b){case"$":y=w===x.after.length-1?y+f.currency.symbol:t._.insert(y,f.currency.symbol,-(x.after.length-(1+w)));break;case" ":y=w===x.after.length-1?y+" ":t._.insert(y," ",-(x.after.length-(1+w)+f.currency.symbol.length-1));break}return y}})})(),(function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(u,h,m){var f,x=typeof u=="number"&&!t._.isNaN(u)?u.toExponential():"0e+0",y=x.split("e");return h=h.replace(/e[\+|\-]{1}0/,""),f=t._.numberToFormat(Number(y[0]),h,m),f+"e"+y[1]},unformat:function(u){var h=t._.includes(u,"e+")?u.split("e+"):u.split("e-"),m=Number(h[0]),f=Number(h[1]);f=t._.includes(u,"e-")?f*=-1:f;function x(y,b,w,v){var A=t._.correctionFactor(y,b),S=y*A*(b*A)/(A*A);return S}return t._.reduce([m,Math.pow(10,f)],x,1)}})})(),(function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x,y=t._.includes(h," o")?" ":"";return h=h.replace(/\s?o/,""),y+=f.ordinal(u),x=t._.numberToFormat(u,h,m),x+y}})})(),(function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(u,h,m){var f=t._.includes(h," %")?" ":"",x;return t.options.scalePercentBy100&&(u=u*100),h=h.replace(/\s?\%/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"%"),x=x.join("")):x=x+f+"%",x},unformat:function(u){var h=t._.stringToNumber(u);return t.options.scalePercentBy100?h*.01:h}})})(),(function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(u,h,m){var f=Math.floor(u/60/60),x=Math.floor((u-f*60*60)/60),y=Math.round(u-f*60*60-x*60);return f+":"+(x<10?"0"+x:x)+":"+(y<10?"0"+y:y)},unformat:function(u){var h=u.split(":"),m=0;return h.length===3?(m=m+Number(h[0])*60*60,m=m+Number(h[1])*60,m=m+Number(h[2])):h.length===2&&(m=m+Number(h[0])*60,m=m+Number(h[1])),Number(m)}})})(),t})})(_W)),_W.exports}var HXe=NXe();const np=Hr(HXe);function l2(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}const r2="$$material";function _Xe(e){for(var t=0,r,n=0,a=e.length;a>=4;++n,a-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var VXe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function QXe(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var UXe=/[A-Z]|^ms/g,WXe=/_EMO_([^_]+?)_([^]*?)_EMO_/g,rke=function(e){return e.charCodeAt(1)===45},Dre=function(e){return e!=null&&typeof e!="boolean"},mT=QXe(function(e){return rke(e)?e:e.replace(UXe,"-$&").toLowerCase()}),Tre=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(WXe,function(r,n,a){return Qm={name:n,styles:a,next:Qm},n})}return VXe[e]!==1&&!rke(e)&&typeof t=="number"&&t!==0?t+"px":t};function EE(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var a=r;if(a.anim===1)return Qm={name:a.name,styles:a.styles,next:Qm},a.name;var l=r;if(l.styles!==void 0){var c=l.next;if(c!==void 0)for(;c!==void 0;)Qm={name:c.name,styles:c.styles,next:Qm},c=c.next;var d=l.styles+";";return d}return GXe(e,t,r)}}var p=r;return p}function GXe(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a<r.length;a++)n+=EE(e,t,r[a])+";";else for(var l in r){var c=r[l];if(typeof c!="object"){var d=c;Dre(d)&&(n+=mT(l)+":"+Tre(l,d)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&t==null)for(var p=0;p<c.length;p++)Dre(c[p])&&(n+=mT(l)+":"+Tre(l,c[p])+";");else{var u=EE(e,t,c);switch(l){case"animation":case"animationName":{n+=mT(l)+":"+u+";";break}default:n+=l+"{"+u+"}"}}}return n}var zre=/label:\s*([^\s;{]+)\s*(;|$)/g,Qm;function YXe(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,a="";Qm=void 0;var l=e[0];if(l==null||l.raw===void 0)n=!1,a+=EE(r,t,l);else{var c=l;a+=c[0]}for(var d=1;d<e.length;d++)if(a+=EE(r,t,e[d]),n){var p=l;a+=p[d]}zre.lastIndex=0;for(var u="",h;(h=zre.exec(a))!==null;)u+="-"+h[1];var m=_Xe(a)+u;return{name:m,styles:a,next:Qm}}var gT={exports:{}},fT,Rre;function KXe(){if(Rre)return fT;Rre=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return fT=e,fT}var xT,Fre;function qXe(){if(Fre)return xT;Fre=1;var e=KXe();function t(){}function r(){}return r.resetWarningCache=t,xT=function(){function n(c,d,p,u,h,m){if(m!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function a(){return n}var l={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return l.PropTypes=l,l},xT}var Ore;function lZ(){return Ore||(Ore=1,gT.exports=qXe()()),gT.exports}var ZXe=lZ();const Nt=Hr(ZXe);function JXe(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function XXe(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var eet=(function(){function e(r){var n=this;this._insertTag=function(a){var l;n.tags.length===0?n.insertionPoint?l=n.insertionPoint.nextSibling:n.prepend?l=n.container.firstChild:l=n.before:l=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,l),n.tags.push(a)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(XXe(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=JXe(n);try{a.insertRule(r,a.cssRules.length)}catch{}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e})(),Zs="-ms-",LE="-moz-",Ci="-webkit-",ike="comm",cZ="rule",dZ="decl",tet="@import",nke="@keyframes",oet="@layer",ret=Math.abs,vj=String.fromCharCode,iet=Object.assign;function net(e,t){return Ts(e,0)^45?(((t<<2^Ts(e,0))<<2^Ts(e,1))<<2^Ts(e,2))<<2^Ts(e,3):0}function ake(e){return e.trim()}function aet(e,t){return(e=t.exec(e))?e[0]:e}function Ai(e,t,r){return e.replace(t,r)}function VW(e,t){return e.indexOf(t)}function Ts(e,t){return e.charCodeAt(t)|0}function jw(e,t,r){return e.slice(t,r)}function Wu(e){return e.length}function pZ(e){return e.length}function wA(e,t){return t.push(e),e}function set(e,t){return e.map(t).join("")}var Cj=1,j8=1,ske=0,Ec=0,Ia=0,A9="";function Aj(e,t,r,n,a,l,c){return{value:e,root:t,parent:r,type:n,props:a,children:l,line:Cj,column:j8,length:c,return:""}}function vx(e,t){return iet(Aj("",null,null,"",null,null,0),e,{length:-e.length},t)}function cet(){return Ia}function det(){return Ia=Ec>0?Ts(A9,--Ec):0,j8--,Ia===10&&(j8=1,Cj--),Ia}function dd(){return Ia=Ec<ske?Ts(A9,Ec++):0,j8++,Ia===10&&(j8=1,Cj++),Ia}function Ch(){return Ts(A9,Ec)}function NS(){return Ec}function Fv(e,t){return jw(A9,e,t)}function Mw(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function lke(e){return Cj=j8=1,ske=Wu(A9=e),Ec=0,[]}function cke(e){return A9="",e}function HS(e){return ake(Fv(Ec-1,QW(e===91?e+2:e===40?e+1:e)))}function pet(e){for(;(Ia=Ch())&&Ia<33;)dd();return Mw(e)>2||Mw(Ia)>3?"":" "}function uet(e,t){for(;--t&&dd()&&!(Ia<48||Ia>102||Ia>57&&Ia<65||Ia>70&&Ia<97););return Fv(e,NS()+(t<6&&Ch()==32&&dd()==32))}function QW(e){for(;dd();)switch(Ia){case e:return Ec;case 34:case 39:e!==34&&e!==39&&QW(Ia);break;case 40:e===41&&QW(e);break;case 92:dd();break}return Ec}function het(e,t){for(;dd()&&e+Ia!==57&&!(e+Ia===84&&Ch()===47););return"/*"+Fv(t,Ec-1)+"*"+vj(e===47?e:dd())}function met(e){for(;!Mw(Ch());)dd();return Fv(e,Ec)}function get(e){return cke(_S("",null,null,null,[""],e=lke(e),0,[0],e))}function _S(e,t,r,n,a,l,c,d,p){for(var u=0,h=0,m=c,f=0,x=0,y=0,b=1,w=1,v=1,A=0,S="",E=a,I=l,L=n,B=S;w;)switch(y=A,A=dd()){case 40:if(y!=108&&Ts(B,m-1)==58){VW(B+=Ai(HS(A),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:B+=HS(A);break;case 9:case 10:case 13:case 32:B+=pet(y);break;case 92:B+=uet(NS()-1,7);continue;case 47:switch(Ch()){case 42:case 47:wA(fet(het(dd(),NS()),t,r),p);break;default:B+="/"}break;case 123*b:d[u++]=Wu(B)*v;case 125*b:case 59:case 0:switch(A){case 0:case 125:w=0;case 59+h:v==-1&&(B=Ai(B,/\f/g,"")),x>0&&Wu(B)-m&&wA(x>32?Hre(B+";",n,r,m-1):Hre(Ai(B," ","")+";",n,r,m-2),p);break;case 59:B+=";";default:if(wA(L=Nre(B,t,r,u,h,a,d,S,E=[],I=[],m),l),A===123)if(h===0)_S(B,t,L,L,E,l,m,d,I);else switch(f===99&&Ts(B,3)===110?100:f){case 100:case 108:case 109:case 115:_S(e,L,L,n&&wA(Nre(e,L,L,0,0,a,d,S,a,E=[],m),I),a,I,m,d,n?E:I);break;default:_S(B,L,L,L,[""],I,0,d,I)}}u=h=x=0,b=v=1,S=B="",m=c;break;case 58:m=1+Wu(B),x=y;default:if(b<1){if(A==123)--b;else if(A==125&&b++==0&&det()==125)continue}switch(B+=vj(A),A*b){case 38:v=h>0?1:(B+="\f",-1);break;case 44:d[u++]=(Wu(B)-1)*v,v=1;break;case 64:Ch()===45&&(B+=HS(dd())),f=Ch(),h=m=Wu(S=B+=met(NS())),A++;break;case 45:y===45&&Wu(B)==2&&(b=0)}}return l}function Nre(e,t,r,n,a,l,c,d,p,u,h){for(var m=a-1,f=a===0?l:[""],x=pZ(f),y=0,b=0,w=0;y<n;++y)for(var v=0,A=jw(e,m+1,m=ret(b=c[y])),S=e;v<x;++v)(S=ake(b>0?f[v]+" "+A:Ai(A,/&\f/g,f[v])))&&(p[w++]=S);return Aj(e,t,r,a===0?cZ:d,p,u,h)}function fet(e,t,r){return Aj(e,t,r,ike,vj(cet()),jw(e,2,-2),0)}function Hre(e,t,r,n){return Aj(e,t,r,dZ,jw(e,0,n),jw(e,n+1,-1),n)}function r8(e,t){for(var r="",n=pZ(e),a=0;a<n;a++)r+=t(e[a],a,e,t)||"";return r}function xet(e,t,r,n){switch(e.type){case oet:if(e.children.length)break;case tet:case dZ:return e.return=e.return||e.value;case ike:return"";case nke:return e.return=e.value+"{"+r8(e.children,n)+"}";case cZ:e.value=e.props.join(",")}return Wu(r=r8(e.children,n))?e.return=e.value+"{"+r+"}":""}function yet(e){var t=pZ(e);return function(r,n,a,l){for(var c="",d=0;d<t;d++)c+=e[d](r,n,a,l)||"";return c}}function bet(e){return function(t){t.root||(t=t.return)&&e(t)}}var wet=function(e,t,r){for(var n=0,a=0;n=a,a=Ch(),n===38&&a===12&&(t[r]=1),!Mw(a);)dd();return Fv(e,Ec)},vet=function(e,t){var r=-1,n=44;do switch(Mw(n)){case 0:n===38&&Ch()===12&&(t[r]=1),e[r]+=wet(Ec-1,t,r);break;case 2:e[r]+=HS(n);break;case 4:if(n===44){e[++r]=Ch()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=vj(n)}while(n=dd());return e},Cet=function(e,t){return cke(vet(lke(e),t))},_re=new WeakMap,Aet=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!_re.get(r))&&!n){_re.set(e,!0);for(var a=[],l=Cet(t,a),c=r.props,d=0,p=0;d<l.length;d++)for(var u=0;u<c.length;u++,p++)e.props[p]=a[d]?l[d].replace(/&\f/g,c[u]):c[u]+" "+l[d]}}},$et=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function dke(e,t){switch(net(e,t)){case 5103:return Ci+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ci+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ci+e+LE+e+Zs+e+e;case 6828:case 4268:return Ci+e+Zs+e+e;case 6165:return Ci+e+Zs+"flex-"+e+e;case 5187:return Ci+e+Ai(e,/(\w+).+(:[^]+)/,Ci+"box-$1$2"+Zs+"flex-$1$2")+e;case 5443:return Ci+e+Zs+"flex-item-"+Ai(e,/flex-|-self/,"")+e;case 4675:return Ci+e+Zs+"flex-line-pack"+Ai(e,/align-content|flex-|-self/,"")+e;case 5548:return Ci+e+Zs+Ai(e,"shrink","negative")+e;case 5292:return Ci+e+Zs+Ai(e,"basis","preferred-size")+e;case 6060:return Ci+"box-"+Ai(e,"-grow","")+Ci+e+Zs+Ai(e,"grow","positive")+e;case 4554:return Ci+Ai(e,/([^-])(transform)/g,"$1"+Ci+"$2")+e;case 6187:return Ai(Ai(Ai(e,/(zoom-|grab)/,Ci+"$1"),/(image-set)/,Ci+"$1"),e,"")+e;case 5495:case 3959:return Ai(e,/(image-set\([^]*)/,Ci+"$1$`$1");case 4968:return Ai(Ai(e,/(.+:)(flex-)?(.*)/,Ci+"box-pack:$3"+Zs+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ci+e+e;case 4095:case 3583:case 4068:case 2532:return Ai(e,/(.+)-inline(.+)/,Ci+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Wu(e)-1-t>6)switch(Ts(e,t+1)){case 109:if(Ts(e,t+4)!==45)break;case 102:return Ai(e,/(.+:)(.+)-([^]+)/,"$1"+Ci+"$2-$3$1"+LE+(Ts(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~VW(e,"stretch")?dke(Ai(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ts(e,t+1)!==115)break;case 6444:switch(Ts(e,Wu(e)-3-(~VW(e,"!important")&&10))){case 107:return Ai(e,":",":"+Ci)+e;case 101:return Ai(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ci+(Ts(e,14)===45?"inline-":"")+"box$3$1"+Ci+"$2$3$1"+Zs+"$2box$3")+e}break;case 5936:switch(Ts(e,t+11)){case 114:return Ci+e+Zs+Ai(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ci+e+Zs+Ai(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ci+e+Zs+Ai(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ci+e+Zs+e+e}return e}var ket=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case dZ:e.return=dke(e.value,e.length);break;case nke:return r8([vx(e,{value:Ai(e.value,"@","@"+Ci)})],n);case cZ:if(e.length)return set(e.props,function(a){switch(aet(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return r8([vx(e,{props:[Ai(a,/:(read-\w+)/,":"+LE+"$1")]})],n);case"::placeholder":return r8([vx(e,{props:[Ai(a,/:(plac\w+)/,":"+Ci+"input-$1")]}),vx(e,{props:[Ai(a,/:(plac\w+)/,":"+LE+"$1")]}),vx(e,{props:[Ai(a,/:(plac\w+)/,Zs+"input-$1")]})],n)}return""})}},Eet=[ket],pke=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(y){var b=y.getAttribute("data-emotion");b.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var n=e.stylisPlugins||Eet,a={},l,c=[];l=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(y){for(var b=y.getAttribute("data-emotion").split(" "),w=1;w<b.length;w++)a[b[w]]=!0;c.push(y)});var d,p=[Aet,$et];{var u,h=[xet,bet(function(y){u.insert(y)})],m=yet(p.concat(n,h)),f=function(y){return r8(get(y),m)};d=function(y,b,w,v){u=w,f(y?y+"{"+b.styles+"}":b.styles),v&&(x.inserted[b.name]=!0)}}var x={key:t,sheet:new eet({key:t,container:l,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:d};return x.sheet.hydrate(c),x};function Let(e){return e==null||Object.keys(e).length===0}function uke(e){const{styles:t,defaultTheme:r={}}=e,n=typeof t=="function"?a=>t(Let(a)?r:a):t;return s.jsx(zv,{styles:n})}function Iet(e,t){return i(e,t)}function jet(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Vre=[];function og(e){return Vre[0]=e,YXe(Vre)}var Qre={exports:{}},Qi={},Ure;function Met(){if(Ure)return Qi;Ure=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function y(b){if(typeof b=="object"&&b!==null){var w=b.$$typeof;switch(w){case e:switch(b=b.type,b){case r:case a:case n:case p:case u:case f:return b;default:switch(b=b&&b.$$typeof,b){case c:case d:case m:case h:return b;case l:return b;default:return w}}case t:return w}}}return Qi.ContextConsumer=l,Qi.ContextProvider=c,Qi.Element=e,Qi.ForwardRef=d,Qi.Fragment=r,Qi.Lazy=m,Qi.Memo=h,Qi.Portal=t,Qi.Profiler=a,Qi.StrictMode=n,Qi.Suspense=p,Qi.SuspenseList=u,Qi.isContextConsumer=function(b){return y(b)===l},Qi.isContextProvider=function(b){return y(b)===c},Qi.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},Qi.isForwardRef=function(b){return y(b)===d},Qi.isFragment=function(b){return y(b)===r},Qi.isLazy=function(b){return y(b)===m},Qi.isMemo=function(b){return y(b)===h},Qi.isPortal=function(b){return y(b)===t},Qi.isProfiler=function(b){return y(b)===a},Qi.isStrictMode=function(b){return y(b)===n},Qi.isSuspense=function(b){return y(b)===p},Qi.isSuspenseList=function(b){return y(b)===u},Qi.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===a||b===n||b===p||b===u||typeof b=="object"&&b!==null&&(b.$$typeof===m||b.$$typeof===h||b.$$typeof===c||b.$$typeof===l||b.$$typeof===d||b.$$typeof===x||b.getModuleId!==void 0)},Qi.typeOf=y,Qi}var Wre;function Bet(){return Wre||(Wre=1,Qre.exports=Met()),Qre.exports}var hke=Bet();function H0(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function mke(e){if(g.isValidElement(e)||hke.isValidElementType(e)||!H0(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=mke(e[r])}),t}function dl(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return H0(e)&&H0(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||hke.isValidElementType(t[a])?n[a]=t[a]:H0(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&H0(e[a])?n[a]=dl(e[a],t[a],r):r.clone?n[a]=H0(t[a])?mke(t[a]):t[a]:n[a]=t[a]}),n}const Pet=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function Det(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...a}=e,l=Pet(t),c=Object.keys(l);function d(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r})`}function p(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-n/100}${r})`}function u(f,x){const y=c.indexOf(x);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r}) and (max-width:${(y!==-1&&typeof t[c[y]]=="number"?t[c[y]]:x)-n/100}${r})`}function h(f){return c.indexOf(f)+1<c.length?u(f,c[c.indexOf(f)+1]):d(f)}function m(f){const x=c.indexOf(f);return x===0?d(c[1]):x===c.length-1?p(c[x]):u(f,c[c.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:c,values:l,up:d,down:p,between:u,only:h,not:m,unit:r,...a}}function Gre(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,a)=>{const l=/min-width:\s*([0-9.]+)/;return+(n.match(l)?.[1]||0)-+(a.match(l)?.[1]||0)});return r.length?r.reduce((n,a)=>{const l=t[a];return delete n[a],n[a]=l,n},{...t}):t}function Tet(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function zet(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r)return null;const[,n,a]=r,l=Number.isNaN(+n)?n||0:+n;return e.containerQueries(a).up(l)}function Ret(e){const t=(l,c)=>l.replace("@media",c?`@container ${c}`:"@container");function r(l,c){l.up=(...d)=>t(e.breakpoints.up(...d),c),l.down=(...d)=>t(e.breakpoints.down(...d),c),l.between=(...d)=>t(e.breakpoints.between(...d),c),l.only=(...d)=>t(e.breakpoints.only(...d),c),l.not=(...d)=>{const p=t(e.breakpoints.not(...d),c);return p.includes("not all and")?p.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):p}}const n={},a=l=>(r(n,l),n);return r(a),{...e,containerQueries:a}}const Fet={borderRadius:4};function Jb(e,t){return t?dl(e,t,{clone:!1}):e}const $j={xs:0,sm:600,md:900,lg:1200,xl:1536},Yre={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${$j[e]}px)`},Oet={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:$j[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function c2(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const a=n.breakpoints||Yre;return t.reduce((l,c,d)=>(l[a.up(a.keys[d])]=r(t[d]),l),{})}if(typeof t=="object"){const a=n.breakpoints||Yre;return Object.keys(t).reduce((l,c)=>{if(Tet(a.keys,c)){const d=zet(n.containerQueries?n:Oet,c);d&&(l[d]=r(t[c],c))}else if(Object.keys(a.values||$j).includes(c)){const d=a.up(c);l[d]=r(t[c],c)}else{const d=c;l[d]=t[d]}return l},{})}return r(t)}function Net(e={}){return e.keys?.reduce((t,r)=>{const n=e.up(r);return t[n]={},t},{})||{}}function Kre(e,t){return e.reduce((r,n)=>{const a=r[n];return(!a||Object.keys(a).length===0)&&delete r[n],r},t)}function hr(e){if(typeof e!="string")throw new Error(l2(7));return e.charAt(0).toUpperCase()+e.slice(1)}function kj(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((a,l)=>a&&a[l]?a[l]:null,e);if(n!=null)return n}return t.split(".").reduce((n,a)=>n&&n[a]!=null?n[a]:null,e)}function IE(e,t,r,n=r){let a;return typeof e=="function"?a=e(r):Array.isArray(e)?a=e[r]||n:a=kj(e,r)||n,t&&(a=t(a,n,e)),a}function ha(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:a}=e,l=c=>{if(c[t]==null)return null;const d=c[t],p=c.theme,u=kj(p,n)||{};return c2(c,d,h=>{let m=IE(u,a,h);return h===m&&typeof h=="string"&&(m=IE(u,a,`${t}${h==="default"?"":hr(h)}`,h)),r===!1?m:{[r]:m}})};return l.propTypes={},l.filterProps=[t],l}function Het(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const _et={m:"margin",p:"padding"},Vet={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},qre={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Qet=Het(e=>{if(e.length>2)if(qre[e])e=qre[e];else return[e];const[t,r]=e.split(""),n=_et[t],a=Vet[r]||"";return Array.isArray(a)?a.map(l=>n+l):[n+a]}),uZ=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],hZ=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...uZ,...hZ];function Ov(e,t,r,n){const a=kj(e,t,!0)??r;return typeof a=="number"||typeof a=="string"?l=>typeof l=="string"?l:typeof a=="string"?a.startsWith("var(")&&l===0?0:a.startsWith("var(")&&l===1?a:`calc(${l} * ${a})`:a*l:Array.isArray(a)?l=>{if(typeof l=="string")return l;const c=Math.abs(l),d=a[c];return l>=0?d:typeof d=="number"?-d:typeof d=="string"&&d.startsWith("var(")?`calc(-1 * ${d})`:`-${d}`}:typeof a=="function"?a:(()=>{})}function mZ(e){return Ov(e,"spacing",8)}function Nv(e,t){return typeof t=="string"||t==null?t:e(t)}function Uet(e,t){return r=>e.reduce((n,a)=>(n[a]=Nv(t,r),n),{})}function Wet(e,t,r,n){if(!t.includes(r))return null;const a=Qet(r),l=Uet(a,n),c=e[r];return c2(e,c,l)}function gke(e,t){const r=mZ(e.theme);return Object.keys(e).map(n=>Wet(e,t,n,r)).reduce(Jb,{})}function Nn(e){return gke(e,uZ)}Nn.propTypes={};Nn.filterProps=uZ;function Hn(e){return gke(e,hZ)}Hn.propTypes={};Hn.filterProps=hZ;function fke(e=8,t=mZ({spacing:e})){if(e.mui)return e;const r=(...n)=>(n.length===0?[1]:n).map(a=>{const l=t(a);return typeof l=="number"?`${l}px`:l}).join(" ");return r.mui=!0,r}function Sj(...e){const t=e.reduce((n,a)=>(a.filterProps.forEach(l=>{n[l]=a}),n),{}),r=n=>Object.keys(n).reduce((a,l)=>t[l]?Jb(a,t[l](n)):a,{});return r.propTypes={},r.filterProps=e.reduce((n,a)=>n.concat(a.filterProps),[]),r}function Wd(e){return typeof e!="number"?e:`${e}px solid`}function m1(e,t){return ha({prop:e,themeKey:"borders",transform:t})}const Get=m1("border",Wd),Yet=m1("borderTop",Wd),Ket=m1("borderRight",Wd),qet=m1("borderBottom",Wd),Zet=m1("borderLeft",Wd),Jet=m1("borderColor"),Xet=m1("borderTopColor"),ett=m1("borderRightColor"),ttt=m1("borderBottomColor"),ott=m1("borderLeftColor"),rtt=m1("outline",Wd),itt=m1("outlineColor"),Ej=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ov(e.theme,"shape.borderRadius",4),r=n=>({borderRadius:Nv(t,n)});return c2(e,e.borderRadius,r)}return null};Ej.propTypes={};Ej.filterProps=["borderRadius"];Sj(Get,Yet,Ket,qet,Zet,Jet,Xet,ett,ttt,ott,Ej,rtt,itt);const Lj=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({gap:Nv(t,n)});return c2(e,e.gap,r)}return null};Lj.propTypes={};Lj.filterProps=["gap"];const Ij=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({columnGap:Nv(t,n)});return c2(e,e.columnGap,r)}return null};Ij.propTypes={};Ij.filterProps=["columnGap"];const jj=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({rowGap:Nv(t,n)});return c2(e,e.rowGap,r)}return null};jj.propTypes={};jj.filterProps=["rowGap"];const ntt=ha({prop:"gridColumn"}),att=ha({prop:"gridRow"}),stt=ha({prop:"gridAutoFlow"}),ltt=ha({prop:"gridAutoColumns"}),ctt=ha({prop:"gridAutoRows"}),dtt=ha({prop:"gridTemplateColumns"}),ptt=ha({prop:"gridTemplateRows"}),utt=ha({prop:"gridTemplateAreas"}),htt=ha({prop:"gridArea"});Sj(Lj,Ij,jj,ntt,att,stt,ltt,ctt,dtt,ptt,utt,htt);function i8(e,t){return t==="grey"?t:e}const mtt=ha({prop:"color",themeKey:"palette",transform:i8}),gtt=ha({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:i8}),ftt=ha({prop:"backgroundColor",themeKey:"palette",transform:i8});Sj(mtt,gtt,ftt);function rd(e){return e<=1&&e!==0?`${e*100}%`:e}const xtt=ha({prop:"width",transform:rd}),gZ=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||$j[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:rd(r)}};return c2(e,e.maxWidth,t)}return null};gZ.filterProps=["maxWidth"];const ytt=ha({prop:"minWidth",transform:rd}),btt=ha({prop:"height",transform:rd}),wtt=ha({prop:"maxHeight",transform:rd}),vtt=ha({prop:"minHeight",transform:rd});ha({prop:"size",cssProperty:"width",transform:rd});ha({prop:"size",cssProperty:"height",transform:rd});const Ctt=ha({prop:"boxSizing"});Sj(xtt,gZ,ytt,btt,wtt,vtt,Ctt);const Mj={border:{themeKey:"borders",transform:Wd},borderTop:{themeKey:"borders",transform:Wd},borderRight:{themeKey:"borders",transform:Wd},borderBottom:{themeKey:"borders",transform:Wd},borderLeft:{themeKey:"borders",transform:Wd},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Wd},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Ej},color:{themeKey:"palette",transform:i8},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:i8},backgroundColor:{themeKey:"palette",transform:i8},p:{style:Hn},pt:{style:Hn},pr:{style:Hn},pb:{style:Hn},pl:{style:Hn},px:{style:Hn},py:{style:Hn},padding:{style:Hn},paddingTop:{style:Hn},paddingRight:{style:Hn},paddingBottom:{style:Hn},paddingLeft:{style:Hn},paddingX:{style:Hn},paddingY:{style:Hn},paddingInline:{style:Hn},paddingInlineStart:{style:Hn},paddingInlineEnd:{style:Hn},paddingBlock:{style:Hn},paddingBlockStart:{style:Hn},paddingBlockEnd:{style:Hn},m:{style:Nn},mt:{style:Nn},mr:{style:Nn},mb:{style:Nn},ml:{style:Nn},mx:{style:Nn},my:{style:Nn},margin:{style:Nn},marginTop:{style:Nn},marginRight:{style:Nn},marginBottom:{style:Nn},marginLeft:{style:Nn},marginX:{style:Nn},marginY:{style:Nn},marginInline:{style:Nn},marginInlineStart:{style:Nn},marginInlineEnd:{style:Nn},marginBlock:{style:Nn},marginBlockStart:{style:Nn},marginBlockEnd:{style:Nn},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Lj},rowGap:{style:jj},columnGap:{style:Ij},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:rd},maxWidth:{style:gZ},minWidth:{transform:rd},height:{transform:rd},maxHeight:{transform:rd},minHeight:{transform:rd},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Att(...e){const t=e.reduce((n,a)=>n.concat(Object.keys(a)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function $tt(e,t){return typeof e=="function"?e(t):e}function ktt(){function e(r,n,a,l){const c={[r]:n,theme:a},d=l[r];if(!d)return{[r]:n};const{cssProperty:p=r,themeKey:u,transform:h,style:m}=d;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const f=kj(a,u)||{};return m?m(c):c2(c,n,x=>{let y=IE(f,h,x);return x===y&&typeof x=="string"&&(y=IE(f,h,`${r}${x==="default"?"":hr(x)}`,x)),p===!1?y:{[p]:y}})}function t(r){const{sx:n,theme:a={},nested:l}=r||{};if(!n)return null;const c=a.unstable_sxConfig??Mj;function d(p){let u=p;if(typeof p=="function")u=p(a);else if(typeof p!="object")return p;if(!u)return null;const h=Net(a.breakpoints),m=Object.keys(h);let f=h;return Object.keys(u).forEach(x=>{const y=$tt(u[x],a);if(y!=null)if(typeof y=="object")if(c[x])f=Jb(f,e(x,y,a,c));else{const b=c2({theme:a},y,w=>({[x]:w}));Att(b,y)?f[x]=t({sx:y,theme:a,nested:!0}):f=Jb(f,b)}else f=Jb(f,e(x,y,a,c))}),!l&&a.modularCssLayers?{"@layer sx":Gre(a,Kre(m,f))}:Gre(a,Kre(m,f))}return Array.isArray(n)?n.map(d):d(n)}return t}const j4=ktt();j4.filterProps=["sx"];function Stt(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||typeof r.getColorSchemeSelector!="function")return{};let n=r.getColorSchemeSelector(e);return n==="&"?t:((n.includes("data-")||n.includes("."))&&(n=`*:where(${n.replace(/\s*&$/,"")}) &`),{[n]:t})}return r.palette.mode===e?t:{}}function fZ(e={},...t){const{breakpoints:r={},palette:n={},spacing:a,shape:l={},...c}=e,d=Det(r),p=fke(a);let u=dl({breakpoints:d,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:p,shape:{...Fet,...l}},c);return u=Ret(u),u.applyStyles=Stt,u=t.reduce((h,m)=>dl(h,m),u),u.unstable_sxConfig={...Mj,...c?.unstable_sxConfig},u.unstable_sx=function(h){return j4({sx:h,theme:this})},u}function Ett(e){return Object.keys(e).length===0}function xZ(e=null){const t=g.useContext(X$e);return!t||Ett(t)?e:t}const Ltt=fZ();function xke(e=Ltt){return xZ(e)}function Zre(e){const t=og(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function yke({styles:e,themeId:t,defaultTheme:r={}}){const n=xke(r),a=t&&n[t]||n;let l=typeof e=="function"?e(a):e;return a.modularCssLayers&&(Array.isArray(l)?l=l.map(c=>Zre(typeof c=="function"?c(a):c)):l=Zre(l)),s.jsx(uke,{styles:l})}const Jre=e=>e,Itt=()=>{let e=Jre;return{configure(t){e=t},generate(t){return e(t)},reset(){e=Jre}}},jtt=Itt();function bke(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=bke(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ko(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=bke(e))&&(n&&(n+=" "),n+=t);return n}const Mtt={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function bi(e,t,r="Mui"){const n=Mtt[t];return n?`${r}-${n}`:`${jtt.generate(e)}-${t}`}function ai(e,t,r="Mui"){const n={};return t.forEach(a=>{n[a]=bi(e,a,r)}),n}function wke(e){const{variants:t,...r}=e,n={variants:t,style:og(r),isProcessed:!0};return n.style===r||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=og(a.style))}),n}const Btt=fZ();function yT(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function e4(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function Ptt(e){return e?(t,r)=>r[e]:null}function Dtt(e,t,r){e.theme=Rtt(e.theme)?r:e.theme[t]||e.theme}function VS(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(a=>VS(e,a,r));if(Array.isArray(n?.variants)){let a;if(n.isProcessed)a=r?e4(n.style,r):n.style;else{const{variants:l,...c}=n;a=r?e4(og(c),r):c}return vke(e,n.variants,[a],r)}return n?.isProcessed?r?e4(og(n.style),r):n.style:r?e4(og(n),r):n}function vke(e,t,r=[],n=void 0){let a;e:for(let l=0;l<t.length;l+=1){const c=t[l];if(typeof c.props=="function"){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!c.props(a))continue}else for(const d in c.props)if(e[d]!==c.props[d]&&e.ownerState?.[d]!==c.props[d])continue e;typeof c.style=="function"?(a??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?e4(og(c.style(a)),n):c.style(a))):r.push(n?e4(og(c.style),n):c.style)}return r}function Ttt(e={}){const{themeId:t,defaultTheme:r=Btt,rootShouldForwardProp:n=yT,slotShouldForwardProp:a=yT}=e;function l(c){Dtt(c,t,r)}return(c,d={})=>{jet(c,I=>I.filter(L=>L!==j4));const{name:p,slot:u,skipVariantsResolver:h,skipSx:m,overridesResolver:f=Ptt(Ott(u)),...x}=d,y=p&&p.startsWith("Mui")||u?"components":"custom",b=h!==void 0?h:u&&u!=="Root"&&u!=="root"||!1,w=m||!1;let v=yT;u==="Root"||u==="root"?v=n:u?v=a:Ftt(c)&&(v=void 0);const A=Iet(c,{shouldForwardProp:v,label:ztt(),...x}),S=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(L){return VS(L,I,L.theme.modularCssLayers?y:void 0)};if(H0(I)){const L=wke(I);return function(B){return L.variants?VS(B,L,B.theme.modularCssLayers?y:void 0):B.theme.modularCssLayers?e4(L.style,y):L.style}}return I},E=(...I)=>{const L=[],B=I.map(S),D=[];if(L.push(l),p&&f&&D.push(function(R){const N=R.theme.components?.[p]?.styleOverrides;if(!N)return null;const K={};for(const q in N)K[q]=VS(R,N[q],R.theme.modularCssLayers?"theme":void 0);return f(R,K)}),p&&!b&&D.push(function(R){const N=R.theme?.components?.[p]?.variants;return N?vke(R,N,[],R.theme.modularCssLayers?"theme":void 0):null}),w||D.push(j4),Array.isArray(B[0])){const R=B.shift(),N=new Array(L.length).fill(""),K=new Array(D.length).fill("");let q;q=[...N,...R,...K],q.raw=[...N,...R.raw,...K],L.unshift(q)}const M=[...L,...B,...D],T=A(...M);return c.muiName&&(T.muiName=c.muiName),T};return A.withConfig&&(E.withConfig=A.withConfig),E}}function ztt(e,t){return void 0}function Rtt(e){for(const t in e)return!1;return!0}function Ftt(e){return typeof e=="string"&&e.charCodeAt(0)>96}function Ott(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function UW(e,t,r=!1){const n={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const l=a;if(l==="components"||l==="slots")n[l]={...e[l],...n[l]};else if(l==="componentsProps"||l==="slotProps"){const c=e[l],d=t[l];if(!d)n[l]=c||{};else if(!c)n[l]=d;else{n[l]={...d};for(const p in c)if(Object.prototype.hasOwnProperty.call(c,p)){const u=p;n[l][u]=UW(c[u],d[u],r)}}}else l==="className"&&r&&t.className?n.className=Ko(e?.className,t?.className):l==="style"&&r&&t.style?n.style={...e?.style,...t?.style}:n[l]===void 0&&(n[l]=e[l])}return n}const gd=typeof window<"u"?g.useLayoutEffect:g.useEffect;function Ntt(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function yZ(e,t=0,r=1){return Ntt(e,t,r)}function Htt(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,a)=>a<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function mg(e){if(e.type)return e;if(e.charAt(0)==="#")return mg(Htt(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(l2(9,e));let n=e.substring(t+1,e.length-1),a;if(r==="color"){if(n=n.split(" "),a=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(l2(10,a))}else n=n.split(",");return n=n.map(l=>parseFloat(l)),{type:r,values:n,colorSpace:a}}const _tt=e=>{const t=mg(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},gb=(e,t)=>{try{return _tt(e)}catch{return e}};function Bj(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((a,l)=>l<3?parseInt(a,10):a):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function Cke(e){e=mg(e);const{values:t}=e,r=t[0],n=t[1]/100,a=t[2]/100,l=n*Math.min(a,1-a),c=(u,h=(u+r/30)%12)=>a-l*Math.max(Math.min(h-3,9-h,1),-1);let d="rgb";const p=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(d+="a",p.push(t[3])),Bj({type:d,values:p})}function WW(e){e=mg(e);let t=e.type==="hsl"||e.type==="hsla"?mg(Cke(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function Vtt(e,t){const r=WW(e),n=WW(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function jE(e,t){return e=mg(e),t=yZ(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,Bj(e)}function R3(e,t,r){try{return jE(e,t)}catch{return e}}function Pj(e,t){if(e=mg(e),t=yZ(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return Bj(e)}function Mi(e,t,r){try{return Pj(e,t)}catch{return e}}function Dj(e,t){if(e=mg(e),t=yZ(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return Bj(e)}function Bi(e,t,r){try{return Dj(e,t)}catch{return e}}function Qtt(e,t=.15){return WW(e)>.5?Pj(e,t):Dj(e,t)}function vA(e,t,r){try{return Qtt(e,t)}catch{return e}}const Ake=g.createContext(null);function bZ(){return g.useContext(Ake)}const Utt=typeof Symbol=="function"&&Symbol.for,Wtt=Utt?Symbol.for("mui.nested"):"__THEME_NESTED__";function Gtt(e,t){return typeof t=="function"?t(e):{...e,...t}}function Ytt(e){const{children:t,theme:r}=e,n=bZ(),a=g.useMemo(()=>{const l=n===null?{...r}:Gtt(n,r);return l!=null&&(l[Wtt]=n!==null),l},[r,n]);return s.jsx(Ake.Provider,{value:a,children:t})}const $ke=g.createContext();function Ktt({value:e,...t}){return s.jsx($ke.Provider,{value:e??!0,...t})}const $9=()=>g.useContext($ke)??!1,kke=g.createContext(void 0);function qtt({value:e,children:t}){return s.jsx(kke.Provider,{value:e,children:t})}function Ztt(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const a=t.components[r];return a.defaultProps?UW(a.defaultProps,n,t.components.mergeClassNameAndStyle):!a.styleOverrides&&!a.variants?UW(a,n,t.components.mergeClassNameAndStyle):n}function Jtt({props:e,name:t}){const r=g.useContext(kke);return Ztt({props:e,name:t,theme:{components:r}})}let Xre=0;function Xtt(e){const[t,r]=g.useState(e),n=e||t;return g.useEffect(()=>{t==null&&(Xre+=1,r(`mui-${Xre}`))},[t]),n}const eot={...SZe},eie=eot.useId;function Tj(e){if(eie!==void 0){const t=eie();return e??t}return Xtt(e)}function tot(e){const t=xZ(),r=Tj()||"",{modularCssLayers:n}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!n||t!==null?a="":typeof n=="string"?a=n.replace(/mui(?!\.)/g,a):a=`@layer ${a};`,gd(()=>{const l=document.querySelector("head");if(!l)return;const c=l.firstChild;if(a){if(c&&c.hasAttribute?.("data-mui-layer-order")&&c.getAttribute("data-mui-layer-order")===r)return;const d=document.createElement("style");d.setAttribute("data-mui-layer-order",r),d.textContent=a,l.prepend(d)}else l.querySelector(`style[data-mui-layer-order="${r}"]`)?.remove()},[a,r]),a?s.jsx(yke,{styles:a}):null}const tie={};function oie(e,t,r,n=!1){return g.useMemo(()=>{const a=e&&t[e]||t;if(typeof r=="function"){const l=r(a),c=e?{...t,[e]:l}:l;return n?()=>c:c}return e?{...t,[e]:r}:{...t,...r}},[e,t,r,n])}function Ske(e){const{children:t,theme:r,themeId:n}=e,a=xZ(tie),l=bZ()||tie,c=oie(n,a,r),d=oie(n,l,r,!0),p=(n?c[n]:c).direction==="rtl",u=tot(c);return s.jsx(Ytt,{theme:d,children:s.jsx(X$e.Provider,{value:c,children:s.jsx(Ktt,{value:p,children:s.jsxs(qtt,{value:n?c[n].components:c.components,children:[u,t]})})})})}const rie={theme:void 0};function oot(e){let t,r;return function(n){let a=t;return(a===void 0||n.theme!==r)&&(rie.theme=n.theme,a=wke(e(rie)),t=a,r=n.theme),a}}const wZ="mode",vZ="color-scheme",rot="data-color-scheme";function iot(e){const{defaultMode:t="system",defaultLightColorScheme:r="light",defaultDarkColorScheme:n="dark",modeStorageKey:a=wZ,colorSchemeStorageKey:l=vZ,attribute:c=rot,colorSchemeNode:d="document.documentElement",nonce:p}=e||{};let u="",h=c;if(c==="class"&&(h=".%s"),c==="data"&&(h="[data-%s]"),h.startsWith(".")){const f=h.substring(1);u+=`${d}.classList.remove('${f}'.replace('%s', light), '${f}'.replace('%s', dark));
|
|
3
3
|
${d}.classList.add('${f}'.replace('%s', colorScheme));`}const m=h.match(/\[([^[\]]+)\]/);if(m){const[f,x]=m[1].split("=");x||(u+=`${d}.removeAttribute('${f}'.replace('%s', light));
|
|
4
4
|
${d}.removeAttribute('${f}'.replace('%s', dark));`),u+=`
|
|
5
5
|
${d}.setAttribute('${f}'.replace('%s', colorScheme), ${x?`${x}.replace('%s', colorScheme)`:'""'});`}else h!==".%s"&&(u+=`${d}.setAttribute('${h}', colorScheme);`);return s.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?p:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
@@ -243,7 +243,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
243
243
|
`+ue:"")+"\n```"},regExp:/^```(\w{1,10})?\s/,replace:q(re=>t.$createCodeNode(re?re[1]:void 0)),type:"element"},H={dependencies:[r.ListNode,r.ListItemNode],export:(re,ue)=>r.$isListNode(re)?_(re,ue,0):null,regExp:/^(\s*)[-*+]\s/,replace:F("bullet"),type:"element"},X={dependencies:[r.ListNode,r.ListItemNode],export:(re,ue)=>r.$isListNode(re)?_(re,ue,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:F("check"),type:"element"},Y={dependencies:[r.ListNode,r.ListItemNode],export:(re,ue)=>r.$isListNode(re)?_(re,ue,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:F("number"),type:"element"},G={format:["code"],tag:"`",type:"text-format"},ee={format:["highlight"],tag:"==",type:"text-format"},J={format:["bold","italic"],tag:"***",type:"text-format"},ne={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},xe={format:["bold"],tag:"**",type:"text-format"},ge={format:["bold"],intraword:!1,tag:"__",type:"text-format"},ce={format:["strikethrough"],tag:"~~",type:"text-format"},de={format:["italic"],tag:"*",type:"text-format"},me={format:["italic"],intraword:!1,tag:"_",type:"text-format"},be={dependencies:[l.LinkNode],export:(re,ue,Ee)=>{if(!l.$isLinkNode(re))return null;ue=(ue=re.getTitle())?`[${re.getTextContent()}](${re.getURL()} "${ue}")`:`[${re.getTextContent()}](${re.getURL()})`;const Be=re.getFirstChild();return re.getChildrenSize()===1&&e.$isTextNode(Be)?Ee(Be,ue):ue},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(re,ue)=>{const[,Ee,Be,we]=ue;ue=l.$createLinkNode(Be,{title:we});const De=e.$createTextNode(Ee);De.setFormat(re.getFormat()),ue.append(De),re.replace(ue)},trigger:")",type:"text-match"},ae=[V,O,z,H,Y],ie=[G,J,ne,xe,ge,ee,de,me,ce],fe=[be],ve=[...ae,...ie,...fe];return hn.$convertFromMarkdownString=function(re,ue=ve,Ee){return B(ue)(re,Ee)},hn.$convertToMarkdownString=function(re=ve,ue){return u(re)(ue)},hn.BOLD_ITALIC_STAR=J,hn.BOLD_ITALIC_UNDERSCORE=ne,hn.BOLD_STAR=xe,hn.BOLD_UNDERSCORE=ge,hn.CHECK_LIST=X,hn.CODE=z,hn.ELEMENT_TRANSFORMERS=ae,hn.HEADING=V,hn.HIGHLIGHT=ee,hn.INLINE_CODE=G,hn.ITALIC_STAR=de,hn.ITALIC_UNDERSCORE=me,hn.LINK=be,hn.ORDERED_LIST=Y,hn.QUOTE=O,hn.STRIKETHROUGH=ce,hn.TEXT_FORMAT_TRANSFORMERS=ie,hn.TEXT_MATCH_TRANSFORMERS=fe,hn.TRANSFORMERS=ve,hn.UNORDERED_LIST=H,hn.registerMarkdownShortcuts=function(re,ue=ve){let Ee=d(ue),Be=c(Ee.textFormat,({tag:De})=>De[De.length-1]),we=c(Ee.textMatch,({trigger:De})=>De);for(let De of ue)if(ue=De.type,(ue==="element"||ue==="text-match")&&!re.hasNodes(De.dependencies))throw Error("Minified Lexical error #79; visit https://lexical.dev/docs/error?code=79 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return re.registerUpdateListener(({tags:De,dirtyLeaves:Re,editorState:tt,prevEditorState:ze})=>{if(!De.has("historic")){var Ie=tt.read(e.$getSelection);if(De=ze.read(e.$getSelection),e.$isRangeSelection(De)&&e.$isRangeSelection(Ie)&&Ie.isCollapsed()){ze=Ie.anchor.key;var _e=Ie.anchor.offset,Se=tt._nodeMap.get(ze);e.$isTextNode(Se)&&Re.has(ze)&&(_e===1||_e===De.anchor.offset+1)&&re.update(()=>{if(!Se.hasFormat("code")){var Ve=Se.getParent();if(Ve!==null&&!t.$isCodeNode(Ve)){var Xe=Ie.anchor.offset;e:{var Ne=Ee.element,et=Ve.getParent();if(e.$isRootOrShadowRoot(et)&&Ve.getFirstChild()===Se&&(et=Se.getTextContent(),et[Xe-1]===" ")){for(let{regExp:pt,replace:ut}of Ne)if((Ne=et.match(pt))&&Ne[0].length===Xe){et=Se.getNextSiblings();let[zt,Gt]=Se.splitText(Xe);zt.remove(),et=Gt?[Gt,...et]:et,ut(Ve,et,Ne,!1),Ve=!0;break e}}Ve=!1}if(!Ve){e:{if(Ne=Se.getTextContent(),Ve=we[Ne[Xe-1]],Ve!=null){Xe<Ne.length&&(Ne=Ne.slice(0,Xe));for(He of Ve)if(Ve=Ne.match(He.regExp),Ve!==null){Ne=Ve.index||0,et=Ne+Ve[0].length;var mt=void 0;Ne===0?[mt]=Se.splitText(et):[,mt]=Se.splitText(Ne,et),mt.selectNext(0,0),He.replace(mt,Ve);var He=!0;break e}}He=!1}if(!He)e:{et=Se.getTextContent(),--Xe;var bt=et[Xe];if(He=Be[bt])for(let pt of He){var{tag:Mt}=pt;He=Mt.length;let ut=Xe-He+1;if(!(1<He&&!K(et,ut,Mt,0,He)||et[ut-1]===" ")&&(mt=et[Xe+1],pt.intraword!==!1||!mt||p.test(mt))){Ve=mt=Se,Ne=N(et,ut,Mt);for(var Ft=Ve;0>Ne&&(Ft=Ft.getPreviousSibling())&&!e.$isLineBreakNode(Ft);)e.$isTextNode(Ft)&&(Ne=Ft.getTextContent(),Ve=Ft,Ne=N(Ne,Ne.length,Mt));if(!(0>Ne||Ve===mt&&Ne+He===ut||(Mt=Ve.getTextContent(),0<Ne&&Mt[Ne-1]===bt||(Ft=Mt[Ne-1],pt.intraword===!1&&Ft&&!p.test(Ft))))){et=mt.getTextContent(),et=et.slice(0,ut)+et.slice(Xe+1),mt.setTextContent(et),et=Ve===mt?et:Mt,Ve.setTextContent(et.slice(0,Ne)+et.slice(Ne+He)),et=e.$getSelection(),bt=e.$createRangeSelection(),e.$setSelection(bt),Xe=Xe-He*(Ve===mt?2:1)+1,bt.anchor.set(Ve.__key,Ne,"text"),bt.focus.set(mt.__key,Xe,"text");for(let zt of pt.format)bt.hasFormat(zt)||bt.formatText(zt);bt.anchor.set(bt.focus.key,bt.focus.offset,bt.focus.type);for(let zt of pt.format)bt.hasFormat(zt)&&bt.toggleFormat(zt);e.$isRangeSelection(et)&&(bt.format=et.format);break e}}}}}}}})}}})},hn}var QH,X2e;function jze(){return X2e||(X2e=1,QH=TFt()),QH}var zFt=jze(),UH={},eme;function RFt(){if(eme)return UH;eme=1;var e=vd(),t=Bc();return UH.AutoFocusPlugin=function({defaultSelection:r}){let[n]=e.useLexicalComposerContext();return t.useEffect(()=>{n.focus(()=>{let a=document.activeElement,l=n.getRootElement();l===null||a!==null&&l.contains(a)||l.focus({preventScroll:!0})},{defaultSelection:r})},[r,n]),null},UH}var WH,tme;function FFt(){return tme||(tme=1,WH=RFt()),WH}var OFt=FFt(),u$={},v7={},GH={},ome;function NFt(){if(ome)return GH;ome=1;var e=vd(),t=Da(),r=Bc();function n(a,l){return a.getEditorState().read(()=>{let c=t.$getNodeByKey(l);return c===null?!1:c.isSelected()})}return GH.useLexicalNodeSelection=function(a){let[l]=e.useLexicalComposerContext(),[c,d]=r.useState(()=>n(l,a));r.useEffect(()=>{let h=!0,m=l.registerUpdateListener(()=>{h&&d(n(l,a))});return()=>{h=!1,m()}},[l,a]);let p=r.useCallback(h=>{l.update(()=>{let m=t.$getSelection();t.$isNodeSelection(m)||(m=t.$createNodeSelection(),t.$setSelection(m)),h?m.add(a):m.delete(a)})},[l,a]),u=r.useCallback(()=>{l.update(()=>{const h=t.$getSelection();t.$isNodeSelection(h)&&h.clear()})},[l]);return[c,p,u]},GH}var YH,rme;function HFt(){return rme||(rme=1,YH=NFt()),YH}var ime;function _Ft(){if(ime)return v7;ime=1;var e=vd(),t=HFt(),r=Dc(),n=Da(),a=Bc();let l=n.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");function c({nodeKey:m}){let[f]=e.useLexicalComposerContext(),[x,y,b]=t.useLexicalNodeSelection(m),w=a.useCallback(v=>(x&&n.$isNodeSelection(n.$getSelection())&&(v.preventDefault(),v=n.$getNodeByKey(m),h(v)&&v.remove(),y(!1)),!1),[x,m,y]);return a.useEffect(()=>r.mergeRegister(f.registerCommand(n.CLICK_COMMAND,v=>{let A=f.getElementByKey(m);return v.target===A?(v.shiftKey||b(),y(!x),!0):!1},n.COMMAND_PRIORITY_LOW),f.registerCommand(n.KEY_DELETE_COMMAND,w,n.COMMAND_PRIORITY_LOW),f.registerCommand(n.KEY_BACKSPACE_COMMAND,w,n.COMMAND_PRIORITY_LOW)),[b,f,x,m,w,y]),a.useEffect(()=>{let v=f.getElementByKey(m);v!==null&&(v.className=x?"selected":"")},[f,x,m]),null}class d extends n.DecoratorNode{static getType(){return"horizontalrule"}static clone(f){return new d(f.__key)}static importJSON(){return u()}static importDOM(){return{hr:()=>({conversion:p,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return`
|
|
244
244
|
`}isInline(){return!1}updateDOM(){return!1}decorate(){return a.createElement(c,{nodeKey:this.__key})}}function p(){return{node:u()}}function u(){return n.$applyNodeReplacement(new d)}function h(m){return m instanceof d}return v7.$createHorizontalRuleNode=u,v7.$isHorizontalRuleNode=h,v7.HorizontalRuleNode=d,v7.INSERT_HORIZONTAL_RULE_COMMAND=l,v7}var KH,nme;function VFt(){return nme||(nme=1,KH=_Ft()),KH}var ame;function QFt(){if(ame)return u$;ame=1;var e=jze(),t=vd(),r=VFt(),n=Bc();let a=[{dependencies:[r.HorizontalRuleNode],export:l=>r.$isHorizontalRuleNode(l)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(l,c,d,p)=>{c=r.$createHorizontalRuleNode(),p||l.getNextSibling()!=null?l.replace(c):l.insertBefore(c),c.selectNext()},type:"element"},...e.TRANSFORMERS];return u$.DEFAULT_TRANSFORMERS=a,u$.MarkdownShortcutPlugin=function({transformers:l=a}){let[c]=t.useLexicalComposerContext();return n.useEffect(()=>e.registerMarkdownShortcuts(c,l),[c,l]),null},u$}var qH,sme;function UFt(){return sme||(sme=1,qH=QFt()),qH}var WFt=UFt(),di={},lme;function GFt(){if(lme)return di;lme=1;var e=Da(),t=Dc();let r={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class n extends e.DEPRECATED_GridCellNode{static getType(){return"tablecell"}static clone(z){let H=new n(z.__headerState,z.__colSpan,z.__width,z.__key);return H.__rowSpan=z.__rowSpan,H}static importDOM(){return{td:()=>({conversion:a,priority:0}),th:()=>({conversion:a,priority:0})}}static importJSON(z){let H=l(z.headerState,z.colSpan,z.width||void 0);return H.__rowSpan=z.rowSpan,H}constructor(z=r.NO_STATUS,H=1,X,Y){super(H,Y),this.__headerState=z,this.__width=X}createDOM(z){let H=document.createElement(this.getTag());return this.__width&&(H.style.width=`${this.__width}px`),1<this.__colSpan&&(H.colSpan=this.__colSpan),1<this.__rowSpan&&(H.rowSpan=this.__rowSpan),t.addClassNamesToElement(H,z.theme.tableCell,this.hasHeader()&&z.theme.tableCellHeader),H}exportDOM(z){if({element:z}=super.exportDOM(z),z){let H=this.getParentOrThrow().getChildrenSize();z.style.border="1px solid black",1<this.__colSpan&&(z.colSpan=this.__colSpan),1<this.__rowSpan&&(z.rowSpan=this.__rowSpan),z.style.width=`${this.getWidth()||Math.max(90,700/H)}px`,z.style.verticalAlign="top",z.style.textAlign="start",this.hasHeader()&&(z.style.backgroundColor="#f2f3f5")}return{element:z}}exportJSON(){return{...super.exportJSON(),headerState:this.__headerState,type:"tablecell",width:this.getWidth()}}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(z){return this.getWritable().__headerState=z,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(z){return this.getWritable().__width=z,this.__width}getWidth(){return this.getLatest().__width}toggleHeaderStyle(z){let H=this.getWritable();return H.__headerState=(H.__headerState&z)===z?H.__headerState-z:H.__headerState+z,H}hasHeaderState(z){return(this.getHeaderStyles()&z)===z}hasHeader(){return this.getLatest().__headerState!==r.NO_STATUS}updateDOM(z){return z.__headerState!==this.__headerState||z.__width!==this.__width||z.__colSpan!==this.__colSpan||z.__rowSpan!==this.__rowSpan}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function a(O){var z=O.nodeName.toLowerCase();return z=l(z==="th"?r.ROW:r.NO_STATUS),z.__colSpan=O.colSpan,z.__rowSpan=O.rowSpan,{forChild:(H,X)=>c(X)&&!e.$isElementNode(H)?(X=e.$createParagraphNode(),e.$isLineBreakNode(H)&&H.getTextContent()===`
|
|
245
245
|
`?null:(X.append(H),X)):H,node:z}}function l(O,z=1,H){return e.$applyNodeReplacement(new n(O,z,H))}function c(O){return O instanceof n}class d extends e.DEPRECATED_GridRowNode{static getType(){return"tablerow"}static clone(z){return new d(z.__height,z.__key)}static importDOM(){return{tr:()=>({conversion:p,priority:0})}}static importJSON(z){return u(z.height)}constructor(z,H){super(H),this.__height=z}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1}}createDOM(z){let H=document.createElement("tr");return this.__height&&(H.style.height=`${this.__height}px`),t.addClassNamesToElement(H,z.theme.tableRow),H}isShadowRoot(){return!0}setHeight(z){return this.getWritable().__height=z,this.__height}getHeight(){return this.getLatest().__height}updateDOM(z){return z.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function p(){return{node:u()}}function u(O){return e.$applyNodeReplacement(new d(O))}function h(O){return O instanceof d}function m(O){throw Error(`Minified Lexical error #${O}; visit https://lexical.dev/docs/error?code=${O} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let f=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";class x{constructor(z,H){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.listenersToRemove=new Set,this.tableNodeKey=H,this.editor=z,this.grid={cells:[],columns:0,rows:0},this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.trackTableGrid()}getGrid(){return this.grid}removeListeners(){Array.from(this.listenersToRemove).forEach(z=>z())}trackTableGrid(){let z=new MutationObserver(H=>{this.editor.update(()=>{var X=!1;for(let Y=0;Y<H.length;Y++){const G=H[Y].target.nodeName;if(G==="TABLE"||G==="TR"){X=!0;break}}if(X){if(X=this.editor.getElementByKey(this.tableNodeKey),!X)throw Error("Expected to find TableElement in DOM");this.grid=b(X)}})});this.editor.update(()=>{let H=this.editor.getElementByKey(this.tableNodeKey);if(!H)throw Error("Expected to find TableElement in DOM");this.grid=b(H),z.observe(H,{childList:!0,subtree:!0})})}clearHighlight(){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),this.editor.update(()=>{var z=e.$getNodeByKey(this.tableNodeKey);if(!R(z))throw Error("Expected TableNode.");if(z=this.editor.getElementByKey(this.tableNodeKey),!z)throw Error("Expected to find TableElement in DOM");z=b(z),w(z,null),e.$setSelection(null),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0)})}enableHighlightStyle(){this.editor.update(()=>{let z=this.editor.getElementByKey(this.tableNodeKey);if(!z)throw Error("Expected to find TableElement in DOM");z.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){this.editor.update(()=>{let z=this.editor.getElementByKey(this.tableNodeKey);if(!z)throw Error("Expected to find TableElement in DOM");z.classList.add("disable-selection"),this.hasHijackedSelectionStyles=!0})}updateTableGridSelection(z){z!=null&&z.gridKey===this.tableNodeKey?(this.gridSelection=z,this.isHighlightingCells=!0,this.disableHighlightStyle(),w(this.grid,this.gridSelection)):z==null&&this.clearHighlight()}setFocusCellForSelection(z,H=!1){this.editor.update(()=>{var X=e.$getNodeByKey(this.tableNodeKey);if(!R(X))throw Error("Expected TableNode.");if(!this.editor.getElementByKey(this.tableNodeKey))throw Error("Expected to find TableElement in DOM");X=z.x;let Y=z.y;if(this.focusCell=z,this.anchorCell!==null){let G=f?(this.editor._window||window).getSelection():null;G&&G.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==X||this.anchorY!==Y||H))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(X===this.focusX&&Y===this.focusY)return;this.focusX=X,this.focusY=Y,this.isHighlightingCells&&(X=e.$getNearestNodeFromDOMNode(z.elem),this.gridSelection!=null&&this.anchorCellNodeKey!=null&&c(X)&&(X=X.getKey(),this.gridSelection=this.gridSelection.clone()||e.DEPRECATED_$createGridSelection(),this.focusCellNodeKey=X,this.gridSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),e.$setSelection(this.gridSelection),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0),w(this.grid,this.gridSelection)))})}setAnchorCellForSelection(z){this.isHighlightingCells=!1,this.anchorCell=z,this.anchorX=z.x,this.anchorY=z.y,this.editor.update(()=>{var H=e.$getNearestNodeFromDOMNode(z.elem);c(H)&&(H=H.getKey(),this.gridSelection=e.DEPRECATED_$createGridSelection(),this.anchorCellNodeKey=H)})}formatCells(z){this.editor.update(()=>{let H=e.$getSelection();e.DEPRECATED_$isGridSelection(H)||m(11);let X=e.$createRangeSelection(),Y=X.anchor,G=X.focus;H.getNodes().forEach(ee=>{c(ee)&&ee.getTextContentSize()!==0&&(Y.set(ee.getKey(),0,"element"),G.set(ee.getKey(),ee.getChildrenSize(),"element"),X.formatText(z))}),e.$setSelection(H),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0)})}clearText(){this.editor.update(()=>{let z=e.$getNodeByKey(this.tableNodeKey);if(!R(z))throw Error("Expected TableNode.");var H=e.$getSelection();e.DEPRECATED_$isGridSelection(H)||m(11),H=H.getNodes().filter(c),H.length===this.grid.columns*this.grid.rows?(z.selectPrevious(),z.remove(),e.$getRoot().selectStart()):(H.forEach(X=>{if(e.$isElementNode(X)){let Y=e.$createParagraphNode(),G=e.$createTextNode();Y.append(G),X.append(Y),X.getChildren().forEach(ee=>{ee!==Y&&ee.remove()})}}),w(this.grid,null),e.$setSelection(null),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0))})}}function y(O){for(;O!=null;){let z=O.nodeName;if(z==="TD"||z==="TH"){if(O=O._cell,O===void 0)break;return O}O=O.parentNode}return null}function b(O){let z=[],H={cells:z,columns:0,rows:0};var X=O.firstChild;let Y=O=0;for(z.length=0;X!=null;){var G=X.nodeName;if(G==="TD"||G==="TH")G={elem:X,highlighted:!1,x:O,y:Y},X._cell=G,z[Y]===void 0&&(z[Y]=[]),z[Y][O]=G;else if(G=X.firstChild,G!=null){X=G;continue}if(G=X.nextSibling,G!=null)O++,X=G;else if(G=X.parentNode,G!=null){if(X=G.nextSibling,X==null)break;Y++,O=0}}return H.columns=O+1,H.rows=Y+1,H}function w(O,z){let H=[],X=new Set(z?z.getNodes():[]);return v(O,(Y,G)=>{let ee=Y.elem;X.has(G)?(Y.highlighted=!0,ee.style.setProperty("background-color","rgb(172, 206, 247)"),ee.style.setProperty("caret-color","transparent"),H.push(Y)):(Y.highlighted=!1,ee.style.removeProperty("background-color"),ee.style.removeProperty("caret-color"),ee.getAttribute("style")||ee.removeAttribute("style"))}),H}function v(O,z){({cells:O}=O);for(let H=0;H<O.length;H++){let X=O[H];for(let Y=0;Y<X.length;Y++){let G=X[Y],ee=e.$getNearestNodeFromDOMNode(G.elem);ee!==null&&z(G,ee,{x:Y,y:H})}}}function A(O){O.disableHighlightStyle(),v(O.grid,z=>{let H=z.elem;z.highlighted=!0,H.style.setProperty("background-color","rgb(172, 206, 247)"),H.style.setProperty("caret-color","transparent")})}function S(O){O.enableHighlightStyle(),v(O.grid,z=>{let H=z.elem;z.highlighted=!1,H.style.removeProperty("background-color"),H.style.removeProperty("caret-color"),H.getAttribute("style")||H.removeAttribute("style")})}let E=(O,z,H,X,Y)=>{const G=Y==="forward";switch(Y){case"backward":case"forward":return H!==(G?O.grid.columns-1:0)?B(z.getCellNodeFromCordsOrThrow(H+(G?1:-1),X,O.grid)):X!==(G?O.grid.rows-1:0)?B(z.getCellNodeFromCordsOrThrow(G?0:O.grid.columns-1,X+(G?1:-1),O.grid)):G?z.selectNext():z.selectPrevious(),!0;case"up":return X!==0?B(z.getCellNodeFromCordsOrThrow(H,X-1,O.grid)):z.selectPrevious(),!0;case"down":return X!==O.grid.rows-1?B(z.getCellNodeFromCordsOrThrow(H,X+1,O.grid)):z.selectNext(),!0;default:return!1}},I=(O,z,H,X,Y)=>{const G=Y==="forward";switch(Y){case"backward":case"forward":return H!==(G?O.grid.columns-1:0)&&O.setFocusCellForSelection(z.getCellFromCordsOrThrow(H+(G?1:-1),X,O.grid)),!0;case"up":return X!==0?(O.setFocusCellForSelection(z.getCellFromCordsOrThrow(H,X-1,O.grid)),!0):!1;case"down":return X!==O.grid.rows-1?(O.setFocusCellForSelection(z.getCellFromCordsOrThrow(H,X+1,O.grid)),!0):!1;default:return!1}};function L(O,z){if(e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)){let H=z.isParentOf(O.anchor.getNode());return O=z.isParentOf(O.focus.getNode()),H&&O}return!1}function B(O){let z=O.getChildren().find(H=>e.$isParagraphNode(H));e.$isParagraphNode(z)?z.selectEnd():O.selectEnd()}class D extends e.DEPRECATED_GridNode{static getType(){return"table"}static clone(z){return new D(z.__key)}static importDOM(){return{table:()=>({conversion:M,priority:1})}}static importJSON(){return T()}constructor(z){super(z)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(z){let H=document.createElement("table");return t.addClassNamesToElement(H,z.theme.table),H}updateDOM(){return!1}exportDOM(z){return{...super.exportDOM(z),after:H=>{if(H){let X=H.cloneNode(),Y=document.createElement("colgroup"),G=document.createElement("tbody");if(G.append(...H.children),H=this.getFirstChildOrThrow(),!h(H))throw Error("Expected to find row node.");H=H.getChildrenSize();for(let ee=0;ee<H;ee++){let J=document.createElement("col");Y.append(J)}return X.replaceChildren(Y,G),X}}}}canExtractContents(){return!1}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(z,H){let{rows:X,cells:Y}=H;for(H=0;H<X;H++){var G=Y[H];if(G==null)throw Error(`Row not found at y:${H}`);if(G=G.findIndex(({elem:ee})=>e.$getNearestNodeFromDOMNode(ee)===z),G!==-1)return{x:G,y:H}}throw Error("Cell not found in table.")}getCellFromCords(z,H,X){return{cells:X}=X,H=X[H],H==null?null:(z=H[z],z??null)}getCellFromCordsOrThrow(z,H,X){if(z=this.getCellFromCords(z,H,X),!z)throw Error("Cell not found at cords.");return z}getCellNodeFromCords(z,H,X){return z=this.getCellFromCords(z,H,X),z==null?null:(z=e.$getNearestNodeFromDOMNode(z.elem),c(z)?z:null)}getCellNodeFromCordsOrThrow(z,H,X){if(z=this.getCellNodeFromCords(z,H,X),!z)throw Error("Node at cords not TableCellNode.");return z}canSelectBefore(){return!0}canIndent(){return!1}}function M(){return{node:T()}}function T(){return e.$applyNodeReplacement(new D)}function R(O){return O instanceof D}function N(O){if(O=t.$findMatchingParent(O,z=>h(z)),h(O))return O;throw Error("Expected table cell to be inside of table row.")}function K(O){if(O=t.$findMatchingParent(O,z=>R(z)),R(O))return O;throw Error("Expected table cell to be inside of table.")}function q(O,z){let H=K(O),{x:X,y:Y}=H.getCordsFromCellNode(O,z);return{above:H.getCellNodeFromCords(X,Y-1,z),below:H.getCellNodeFromCords(X,Y+1,z),left:H.getCellNodeFromCords(X-1,Y,z),right:H.getCellNodeFromCords(X+1,Y,z)}}function F(O){O=O.getFirstDescendant(),O===null&&m(124),O.getParentOrThrow().selectStart()}function _(O,z){let H=O.getFirstChild();H!==null?H.insertBefore(z):O.append(z)}let V=e.createCommand("INSERT_TABLE_COMMAND");return di.$createTableCellNode=l,di.$createTableNode=T,di.$createTableNodeWithDimensions=function(O,z,H=!0){let X=T();for(let G=0;G<O;G++){let ee=u();for(let J=0;J<z;J++){var Y=r.NO_STATUS;typeof H=="object"?(G===0&&H.rows&&(Y|=r.ROW),J===0&&H.columns&&(Y|=r.COLUMN)):H&&(G===0&&(Y|=r.ROW),J===0&&(Y|=r.COLUMN)),Y=l(Y);let ne=e.$createParagraphNode();ne.append(e.$createTextNode()),Y.append(ne),ee.append(Y)}X.append(ee)}return X},di.$createTableRowNode=u,di.$deleteTableColumn=function(O,z){let H=O.getChildren();for(let Y=0;Y<H.length;Y++){var X=H[Y];if(h(X)){if(X=X.getChildren(),z>=X.length||0>z)throw Error("Table column target index out of range");X[z].remove()}}return O},di.$deleteTableColumn__EXPERIMENTAL=function(){var O=e.$getSelection();e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)||m(118);var z=O.anchor.getNode();O=O.focus.getNode();let[H,,X]=e.DEPRECATED_$getNodeTriplet(z);[z]=e.DEPRECATED_$getNodeTriplet(O);let[Y,G,ee]=e.DEPRECATED_$computeGridMap(X,H,z);var{startColumn:J}=G;let{startRow:ne,startColumn:xe}=ee;O=Math.min(J,xe),J=Math.max(J+H.__colSpan-1,xe+z.__colSpan-1);let ge=J-O+1;if(Y[0].length===J-O+1)X.selectPrevious(),X.remove();else{var ce=Y.length;for(let de=0;de<ce;de++)for(let me=O;me<=J;me++){let{cell:be,startColumn:ae}=Y[de][me];ae<O?me===O&&be.setColSpan(be.__colSpan-Math.min(ge,be.__colSpan-(O-ae))):ae+be.__colSpan-1>J?me===J&&be.setColSpan(be.__colSpan-(J-ae+1)):be.remove()}O=Y[ne],z=O[xe+z.__colSpan],z!==void 0?({cell:z}=z,F(z)):({cell:z}=O[xe-1],F(z))}},di.$deleteTableRow__EXPERIMENTAL=function(){var O=e.$getSelection();e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)||m(118);var z=O.anchor.getNode();O=O.focus.getNode();let[H,,X]=e.DEPRECATED_$getNodeTriplet(z);[O]=e.DEPRECATED_$getNodeTriplet(O);let[Y,G,ee]=e.DEPRECATED_$computeGridMap(X,H,O);({startRow:z}=G);var{startRow:J}=ee;if(O=J+O.__rowSpan-1,Y.length===O-z+1)X.remove();else{J=Y[0].length;var ne=Y[O+1],xe=X.getChildAtIndex(O+1);for(let ce=O;ce>=z;ce--){for(var ge=J-1;0<=ge;ge--){let{cell:de,startRow:me,startColumn:be}=Y[ce][ge];if(be===ge&&(ce===z&&me<z&&de.setRowSpan(de.__rowSpan-(me-z)),me>=z&&me+de.__rowSpan-1>O))if(de.setRowSpan(de.__rowSpan-(O-me+1)),xe===null&&m(122),ge===0)_(xe,de);else{let{cell:ae}=ne[ge-1];ae.insertAfter(de)}}ge=X.getChildAtIndex(ce),e.DEPRECATED_$isGridRowNode(ge)||m(123),ge.remove()}ne!==void 0?({cell:z}=ne[0],F(z)):({cell:z}=Y[z-1][0],F(z))}},di.$getElementGridForTableNode=function(O,z){if(O=O.getElementByKey(z.getKey()),O==null)throw Error("Table Element Not Found");return b(O)},di.$getTableCellNodeFromLexicalNode=function(O){return O=t.$findMatchingParent(O,z=>c(z)),c(O)?O:null},di.$getTableColumnIndexFromTableCellNode=function(O){return N(O).getChildren().findIndex(z=>z.is(O))},di.$getTableNodeFromLexicalNodeOrThrow=K,di.$getTableRowIndexFromTableCellNode=function(O){let z=N(O);return K(z).getChildren().findIndex(H=>H.is(z))},di.$getTableRowNodeFromTableCellNodeOrThrow=N,di.$insertTableColumn=function(O,z,H=!0,X,Y){let G=O.getChildren();for(let ne=0;ne<G.length;ne++){let xe=G[ne];if(h(xe))for(let ge=0;ge<X;ge++){var ee=xe.getChildren();if(z>=ee.length||0>z)throw Error("Table column target index out of range");ee=ee[z],c(ee)||m(12);let{left:ce,right:de}=q(ee,Y);var J=r.NO_STATUS;(ce&&ce.hasHeaderState(r.ROW)||de&&de.hasHeaderState(r.ROW))&&(J|=r.ROW),J=l(J),J.append(e.$createParagraphNode()),H?ee.insertAfter(J):ee.insertBefore(J)}}return O},di.$insertTableColumn__EXPERIMENTAL=function(O=!0){function z(){let ge=l(r.NO_STATUS).append(e.$createParagraphNode());return ne===null&&(ne=ge),ge}var H=e.$getSelection();e.$isRangeSelection(H)||e.DEPRECATED_$isGridSelection(H)||m(118),H=H.focus.getNode();let[X,,Y]=e.DEPRECATED_$getNodeTriplet(H),[G,ee]=e.DEPRECATED_$computeGridMap(Y,X,X);H=G.length;var{startColumn:J}=ee;O=O?J+X.__colSpan-1:J-1,J=Y.getFirstChild(),e.DEPRECATED_$isGridRowNode(J)||m(120);let ne=null;var xe=J;e:for(J=0;J<H;J++){J!==0&&(xe=xe.getNextSibling(),e.DEPRECATED_$isGridRowNode(xe)||m(121));let ge=G[J];if(0>O){_(xe,z());continue}let{cell:ce,startColumn:de,startRow:me}=ge[O];if(de+ce.__colSpan-1<=O){let be=ce,ae=me,ie=O;for(;ae!==J&&1<be.__rowSpan;)if(ie-=ce.__colSpan,0<=ie){let{cell:fe,startRow:ve}=ge[ie];be=fe,ae=ve}else{xe.append(z());continue e}be.insertAfter(z())}else ce.setColSpan(ce.__colSpan+1)}ne!==null&&F(ne)},di.$insertTableRow=function(O,z,H=!0,X,Y){var G=O.getChildren();if(z>=G.length||0>z)throw Error("Table row target index out of range");if(z=G[z],h(z))for(G=0;G<X;G++){let J=z.getChildren(),ne=J.length,xe=u();for(let ge=0;ge<ne;ge++){var ee=J[ge];c(ee)||m(12);let{above:ce,below:de}=q(ee,Y);ee=r.NO_STATUS;let me=ce&&ce.getWidth()||de&&de.getWidth()||void 0;(ce&&ce.hasHeaderState(r.COLUMN)||de&&de.hasHeaderState(r.COLUMN))&&(ee|=r.COLUMN),ee=l(ee,1,me),ee.append(e.$createParagraphNode()),xe.append(ee)}H?z.insertAfter(xe):z.insertBefore(xe)}else throw Error("Row before insertion index does not exist.");return O},di.$insertTableRow__EXPERIMENTAL=function(O=!0){var z=e.$getSelection();e.$isRangeSelection(z)||e.DEPRECATED_$isGridSelection(z)||m(118),z=z.focus.getNode();let[H,,X]=e.DEPRECATED_$getNodeTriplet(z),[Y,G]=e.DEPRECATED_$computeGridMap(X,H,H);z=Y[0].length;var{startRow:ee}=G;if(O){O=ee+H.__rowSpan-1;var J=Y[O];ee=u();for(var ne=0;ne<z;ne++){let{cell:xe,startRow:ge}=J[ne];ge+xe.__rowSpan-1<=O?ee.append(l(r.NO_STATUS)):xe.setRowSpan(xe.__rowSpan+1)}z=X.getChildAtIndex(O),e.DEPRECATED_$isGridRowNode(z)||m(119),z.insertAfter(ee)}else{for(J=Y[ee],O=u(),ne=0;ne<z;ne++){let{cell:xe,startRow:ge}=J[ne];ge===ee?O.append(l(r.NO_STATUS)):xe.setRowSpan(xe.__rowSpan+1)}z=X.getChildAtIndex(ee),e.DEPRECATED_$isGridRowNode(z)||m(119),z.insertBefore(O)}},di.$isTableCellNode=c,di.$isTableNode=R,di.$isTableRowNode=h,di.$removeTableRowAtIndex=function(O,z){let H=O.getChildren();if(z>=H.length||0>z)throw Error("Expected table cell to be inside of table row.");return H[z].remove(),O},di.$unmergeCell=function(){var O=e.$getSelection();e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)||m(118),O=O.anchor.getNode();let[z,H,X]=e.DEPRECATED_$getNodeTriplet(O);O=z.__colSpan;let Y=z.__rowSpan;if(1<O){for(var G=1;G<O;G++)z.insertAfter(l(r.NO_STATUS));z.setColSpan(1)}if(1<Y){let[ne,xe]=e.DEPRECATED_$computeGridMap(X,z,z),{startColumn:ge,startRow:ce}=xe;for(G=1;G<Y;G++){let de=ce+G,me=ne[de];var ee=H.getNextSibling();e.DEPRECATED_$isGridRowNode(ee)||m(125);var J=null;for(let be=0;be<ge;be++){let ae=me[be],ie=ae.cell;ae.startRow===de&&(J=ie),1<ie.__colSpan&&(be+=ie.__colSpan-1)}if(J===null)for(J=0;J<O;J++)_(ee,l(r.NO_STATUS));else for(ee=0;ee<O;ee++)J.insertAfter(l(r.NO_STATUS))}z.setRowSpan(1)}},di.INSERT_TABLE_COMMAND=V,di.TableCellHeaderStates=r,di.TableCellNode=n,di.TableNode=D,di.TableRowNode=d,di.TableSelection=x,di.applyTableHandlers=function(O,z,H){let X=H.getRootElement();if(X===null)throw Error("No root element.");let Y=new x(H,O.getKey());z.__lexicalTableSelection=Y;let G=!1,ee=!1;z.addEventListener("dblclick",ce=>{let de=y(ce.target);de!==null&&(ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),Y.setAnchorCellForSelection(de),Y.setFocusCellForSelection(de,!0),G=!1)}),z.addEventListener("mousedown",ce=>{setTimeout(()=>{if(ce.button===0){var de=y(ce.target);de!==null&&(ce.preventDefault(),ce.stopPropagation(),ce.stopImmediatePropagation(),Y.setAnchorCellForSelection(de))}},0)}),z.addEventListener("mousemove",ce=>{if(ee&&(ce.preventDefault(),ce.stopPropagation(),ce.stopImmediatePropagation()),G){let de=y(ce.target);if(de!==null){let me=de.x,be=de.y;G&&(Y.anchorX!==me||Y.anchorY!==be||Y.isHighlightingCells)&&(ce.preventDefault(),Y.setFocusCellForSelection(de))}}}),z.addEventListener("mouseleave",()=>{});let J=ce=>{ce.button===0&&H.update(()=>{var de=e.$getSelection();const me=ce.target;if(me instanceof Node){if(e.DEPRECATED_$isGridSelection(de)&&de.gridKey===Y.tableNodeKey&&X.contains(me))return Y.clearHighlight();de=e.$getNearestNodeFromDOMNode(me),de!==null&&t.$findMatchingParent(de,e.DEPRECATED_$isGridNode)&&(G=!0)}})};window.addEventListener("mousedown",J),Y.listenersToRemove.add(()=>window.removeEventListener("mousedown",J));let ne=ce=>{var de;(de=G)&&(de=ce.target,de=de!==null&&de.nodeName==="SPAN",de=!de),de&&(ce.preventDefault(),ce.stopPropagation()),G=!1};window.addEventListener("mouseup",ne),Y.listenersToRemove.add(()=>window.removeEventListener("mouseup",ne)),z.addEventListener("mouseup",ne),Y.listenersToRemove.add(()=>z.removeEventListener("mouseup",ne)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_DOWN_COMMAND,ce=>{var de=e.$getSelection();if(!L(de,O))return!1;if(e.$isRangeSelection(de)){if(de.isCollapsed()){var me=t.$findMatchingParent(de.anchor.getNode(),ae=>c(ae));if(!c(me))return!1;var be=O.getCordsFromCellNode(me,Y.grid);if(de=t.$findMatchingParent(de.anchor.getNode(),ae=>e.$isElementNode(ae)),de==null)throw Error("Expected BlockNode Parent");if((me=me.getLastChild())&&de.isParentOf(me)||de===me||ce.shiftKey)return ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),ce.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(be.x,be.y,Y.grid)),I(Y,O,be.x,be.y,"down")):E(Y,O,be.x,be.y,"down")}}else if(e.DEPRECATED_$isGridSelection(de)&&ce.shiftKey)return be=de.focus.getNode(),c(be)?(be=O.getCordsFromCellNode(be,Y.grid),ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),I(Y,O,be.x,be.y,"down")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_UP_COMMAND,ce=>{var de=e.$getSelection();if(!L(de,O))return!1;if(e.$isRangeSelection(de)){if(de.isCollapsed()){var me=t.$findMatchingParent(de.anchor.getNode(),ae=>c(ae));if(!c(me))return!1;var be=O.getCordsFromCellNode(me,Y.grid);if(de=t.$findMatchingParent(de.anchor.getNode(),ae=>e.$isElementNode(ae)),de==null)throw Error("Expected BlockNode Parent");if((me=me.getLastChild())&&de.isParentOf(me)||de===me||ce.shiftKey)return ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),ce.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(be.x,be.y,Y.grid)),I(Y,O,be.x,be.y,"up")):E(Y,O,be.x,be.y,"up")}}else if(e.DEPRECATED_$isGridSelection(de)&&ce.shiftKey)return be=de.focus.getNode(),c(be)?(be=O.getCordsFromCellNode(be,Y.grid),ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),I(Y,O,be.x,be.y,"up")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_LEFT_COMMAND,ce=>{var de=e.$getSelection();if(!L(de,O))return!1;if(e.$isRangeSelection(de)){if(de.isCollapsed()){var me=t.$findMatchingParent(de.anchor.getNode(),be=>c(be));if(!c(me))return!1;if(me=O.getCordsFromCellNode(me,Y.grid),t.$findMatchingParent(de.anchor.getNode(),be=>e.$isElementNode(be))==null)throw Error("Expected BlockNode Parent");if(de.anchor.offset===0||ce.shiftKey)return ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),ce.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(me.x,me.y,Y.grid)),I(Y,O,me.x,me.y,"backward")):E(Y,O,me.x,me.y,"backward")}}else if(e.DEPRECATED_$isGridSelection(de)&&ce.shiftKey)return de=de.focus.getNode(),c(de)?(de=O.getCordsFromCellNode(de,Y.grid),ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),I(Y,O,de.x,de.y,"backward")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_RIGHT_COMMAND,ce=>{var de=e.$getSelection();if(!L(de,O))return!1;if(e.$isRangeSelection(de)){if(de.isCollapsed()){var me=t.$findMatchingParent(de.anchor.getNode(),be=>c(be));if(!c(me))return!1;if(me=O.getCordsFromCellNode(me,Y.grid),t.$findMatchingParent(de.anchor.getNode(),be=>e.$isElementNode(be))==null)throw Error("Expected BlockNode Parent");if(de.anchor.offset===de.anchor.getNode().getTextContentSize()||ce.shiftKey)return ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),ce.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(me.x,me.y,Y.grid)),I(Y,O,me.x,me.y,"forward")):E(Y,O,me.x,me.y,"forward")}}else if(e.DEPRECATED_$isGridSelection(de)&&ce.shiftKey)return de=de.focus.getNode(),c(de)?(de=O.getCordsFromCellNode(de,Y.grid),ce.preventDefault(),ce.stopImmediatePropagation(),ce.stopPropagation(),I(Y,O,de.x,de.y,"forward")):!1;return!1},e.COMMAND_PRIORITY_HIGH));let xe=ce=>()=>{var de=e.$getSelection();if(!L(de,O))return!1;if(e.DEPRECATED_$isGridSelection(de))return Y.clearText(),!0;if(e.$isRangeSelection(de)){const ae=t.$findMatchingParent(de.anchor.getNode(),ie=>c(ie));if(!c(ae))return!1;var me=de.anchor.getNode(),be=de.focus.getNode();if(me=O.isParentOf(me),be=O.isParentOf(be),me&&!be||be&&!me)return Y.clearText(),!0;if(me=(be=t.$findMatchingParent(de.anchor.getNode(),ie=>e.$isElementNode(ie)))&&t.$findMatchingParent(be,ie=>e.$isElementNode(ie)&&c(ie.getParent())),!e.$isElementNode(me)||!e.$isElementNode(be))return!1;if(ce===e.DELETE_LINE_COMMAND&&me.getPreviousSibling()===null)return!0;if((ce===e.DELETE_CHARACTER_COMMAND||ce===e.DELETE_WORD_COMMAND)&&de.isCollapsed()&&de.anchor.offset===0&&be!==me){de=be.getChildren();const ie=e.$createParagraphNode();return de.forEach(fe=>ie.append(fe)),be.replace(ie),be.getWritable().__parent=ae.getKey(),!0}}return!1};[e.DELETE_WORD_COMMAND,e.DELETE_LINE_COMMAND,e.DELETE_CHARACTER_COMMAND].forEach(ce=>{Y.listenersToRemove.add(H.registerCommand(ce,xe(ce),e.COMMAND_PRIORITY_CRITICAL))});let ge=ce=>{const de=e.$getSelection();return L(de,O)?e.DEPRECATED_$isGridSelection(de)?(ce.preventDefault(),ce.stopPropagation(),Y.clearText(),!0):(e.$isRangeSelection(de)&&(ce=t.$findMatchingParent(de.anchor.getNode(),me=>c(me)),c(ce)),!1):!1};return Y.listenersToRemove.add(H.registerCommand(e.KEY_BACKSPACE_COMMAND,ge,e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.KEY_DELETE_COMMAND,ge,e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.FORMAT_TEXT_COMMAND,ce=>{let de=e.$getSelection();return L(de,O)?e.DEPRECATED_$isGridSelection(de)?(Y.formatCells(ce),!0):(e.$isRangeSelection(de)&&(ce=t.$findMatchingParent(de.anchor.getNode(),me=>c(me)),c(ce)),!1):!1},e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.CONTROLLED_TEXT_INSERTION_COMMAND,()=>{var ce=e.$getSelection();return L(ce,O)&&(e.DEPRECATED_$isGridSelection(ce)?Y.clearHighlight():e.$isRangeSelection(ce)&&(ce=t.$findMatchingParent(ce.anchor.getNode(),de=>c(de)),c(ce))),!1},e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.KEY_TAB_COMMAND,ce=>{var de=e.$getSelection();if(!L(de,O))return!1;if(e.$isRangeSelection(de)){let me=t.$findMatchingParent(de.anchor.getNode(),be=>c(be));if(!c(me))return!1;if(de.isCollapsed())return de=O.getCordsFromCellNode(me,Y.grid),ce.preventDefault(),E(Y,O,de.x,de.y,ce.shiftKey?"backward":"forward"),!0}return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.FOCUS_COMMAND,()=>O.isSelected(),e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>{let ce=e.$getSelection();var de=e.$getPreviousSelection();if(ce&&e.$isRangeSelection(ce)&&!ce.isCollapsed()){var me=ce.anchor.getNode(),be=ce.focus.getNode();me=O.isParentOf(me);var ae=O.isParentOf(be);if(be=me&&!ae||ae&&!me,me=me&&ae&&!O.isSelected(),be)return de=ce.isBackward(),me=e.$createRangeSelection(),be=O.getKey(),me.anchor.set(ce.anchor.key,ce.anchor.offset,ce.anchor.type),me.focus.set(be,de?0:O.getChildrenSize(),"element"),ee=!0,e.$setSelection(me),A(Y),!0;if(me&&({grid:me}=Y,ce.getNodes().filter(c).length===me.rows*me.columns)){me=e.DEPRECATED_$createGridSelection(),be=O.getKey(),ae=O.getFirstChildOrThrow().getFirstChild();let ie=O.getLastChildOrThrow().getLastChild();if(ae!=null&&ie!=null)return me.set(be,ae.getKey(),ie.getKey()),e.$setSelection(me),Y.updateTableGridSelection(me),!0}}return ce&&!ce.is(de)&&(e.DEPRECATED_$isGridSelection(ce)||e.DEPRECATED_$isGridSelection(de))&&Y.gridSelection&&!Y.gridSelection.is(de)?(e.DEPRECATED_$isGridSelection(ce)&&ce.gridKey===Y.tableNodeKey?Y.updateTableGridSelection(ce):!e.DEPRECATED_$isGridSelection(ce)&&e.DEPRECATED_$isGridSelection(de)&&de.gridKey===Y.tableNodeKey&&Y.updateTableGridSelection(null),!1):(Y.hasHijackedSelectionStyles&&!O.isSelected()?(S(Y),ee=!1):!Y.hasHijackedSelectionStyles&&O.isSelected()&&A(Y),!1)},e.COMMAND_PRIORITY_CRITICAL)),Y},di.getCellFromTarget=y,di.getTableSelectionFromTableElement=function(O){return O.__lexicalTableSelection},di}var ZH,cme;function YFt(){return cme||(cme=1,ZH=GFt()),ZH}var JH=YFt(),h$={},dme;function KFt(){if(dme)return h$;dme=1;var e=SM(),t=vd(),r=Dc(),n=Da(),a=Bc();function l(f,x){for(let y=0;y<x.length;y++){let b=x[y](f);if(b)return b}return null}let c=/[.,;\s]/;function d(f){f=f.getPreviousSibling(),n.$isElementNode(f)&&(f=f.getLastDescendant());var x;return!(x=f===null||n.$isLineBreakNode(f))&&(x=n.$isTextNode(f))&&(f=f.getTextContent(),x=c.test(f[f.length-1])),x}function p(f){return f=f.getNextSibling(),n.$isElementNode(f)&&(f=f.getFirstDescendant()),f===null||n.$isLineBreakNode(f)||n.$isTextNode(f)&&c.test(f.getTextContent()[0])}function u(f,x,y){var b=f.getChildren();let w=b.length;for(let v=0;v<w;v++){let A=b[v];if(!n.$isTextNode(A)||!A.isSimpleText()){h(f),y(null,f.getURL());return}}b=f.getTextContent(),x=l(b,x),x===null||x.text!==b?(h(f),y(null,f.getURL())):d(f)&&p(f)?(b=f.getURL(),b!==x.url&&(f.setURL(x.url),y(x.url,b)),x.attributes&&(b=f.getRel(),b!==x.attributes.rel&&(f.setRel(x.attributes.rel||null),y(x.attributes.rel||null,b)),b=f.getTarget(),b!==x.attributes.target&&(f.setTarget(x.attributes.target||null),y(x.attributes.target||null,b)))):(h(f),y(null,f.getURL()))}function h(f){let x=f.getChildren();var y=x.length;for(--y;0<=y;y--)f.insertAfter(x[y]);return f.remove(),x.map(b=>b.getLatest())}function m(f,x,y){a.useEffect(()=>{if(!f.hasNodes([e.AutoLinkNode]))throw Error("Minified Lexical error #77; visit https://lexical.dev/docs/error?code=77 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let b=(w,v)=>{y&&y(w,v)};return r.mergeRegister(f.registerNodeTransform(n.TextNode,w=>{var v=w.getParentOrThrow(),A=w.getPreviousSibling();if(e.$isAutoLinkNode(v))u(v,x,b);else if(!e.$isLinkNode(v)){if(w.isSimpleText()&&(c.test(w.getTextContent()[0])||!e.$isAutoLinkNode(A))){A=v=w.getTextContent();let M=0,T=w;for(var S;(S=l(A,x))&&S!==null;){let R=S.index,N=S.length,K=R+N;var E=M+R,I=M+K,L=v,B=w;if((0<E?c.test(L[E-1]):d(B))&&(I<L.length?c.test(L[I]):p(B))){var D=void 0;M+R===0?[D,T]=T.splitText(M+N):[,D,T]=T.splitText(M+R,M+R+N),E=e.$createAutoLinkNode(S.url,S.attributes),I=n.$createTextNode(S.text),I.setFormat(D.getFormat()),I.setDetail(D.getDetail()),E.append(I),D.replace(E),y&&y(S.url,null),M=0}else M+=K;A=A.substring(K)}}v=w.getPreviousSibling(),S=w.getNextSibling(),D=w.getTextContent(),e.$isAutoLinkNode(v)&&!c.test(D[0])&&(v.append(w),u(v,x,b),w=v.getURL(),y&&y(null,w)),e.$isAutoLinkNode(S)&&!c.test(D[D.length-1])&&(h(S),u(S,x,b),w=S.getURL(),y&&y(null,w))}}))},[f,x,y])}return h$.AutoLinkPlugin=function({matchers:f,onChange:x}){let[y]=t.useLexicalComposerContext();return m(y,f,x),null},h$.createLinkMatcherWithRegExp=function(f,x=y=>y){return y=>{let b=f.exec(y);return b===null?null:{index:b.index,length:b[0].length,text:b[0],url:x(y)}}},h$}var XH,pme;function qFt(){return pme||(pme=1,XH=KFt()),XH}var ZFt=qFt(),cw={};cw.d=(e,t)=>{for(var r in t)cw.o(t,r)&&!cw.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})};cw.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var cr=globalThis.pdfjsLib={};cw.d(cr,{AbortException:()=>l5,AnnotationEditorLayer:()=>L0,AnnotationEditorParamsType:()=>gr,AnnotationEditorType:()=>ii,AnnotationEditorUIManager:()=>yg,AnnotationLayer:()=>KNt,AnnotationMode:()=>Fm,CMapCompressionType:()=>wY,ColorPicker:()=>_u,DOMSVGFactory:()=>yX,DrawLayer:()=>el,FeatureTest:()=>yc,GlobalWorkerOptions:()=>ov,ImageKind:()=>nE,InvalidPDFException:()=>Bze,MissingPDFException:()=>s5,OPS:()=>J1,Outliner:()=>LY,PDFDataRangeTransport:()=>Kze,PDFDateString:()=>Fze,PDFWorker:()=>Qd,PasswordResponses:()=>tOt,PermissionFlag:()=>eOt,PixelsPerInch:()=>W8,RenderingCancelledException:()=>bX,TextLayer:()=>PL,UnexpectedResponseException:()=>jM,Util:()=>jo,VerbosityLevel:()=>EM,XfaLayer:()=>Zze,build:()=>INt,createValidAbsoluteUrl:()=>nOt,fetchData:()=>zM,getDocument:()=>wNt,getFilenameFromUrl:()=>gOt,getPdfFilenameFromUrl:()=>fOt,getXfaPageViewport:()=>xOt,isDataScheme:()=>wX,isPdfFile:()=>vX,noContextMenu:()=>$c,normalizeUnicode:()=>pOt,renderTextLayer:()=>pNt,setLayerDimensions:()=>R4,shadow:()=>pi,updateTextLayer:()=>uNt,version:()=>LNt});const ll=typeof M0=="object"&&M0+""=="[object process]"&&!M0.versions.nw&&!(M0.versions.electron&&M0.type&&M0.type!=="browser"),Mze=[1,0,0,1,0,0],bY=[.001,0,0,.001,0,0],JFt=1e7,e_=1.35,Od={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},Fm={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},XFt="pdfjs_internal_editor_",ii={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},gr={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},eOt={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Xs={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},nE={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Na={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},hy={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},EM={ERRORS:0,WARNINGS:1,INFOS:5},wY={NONE:0,BINARY:1},J1={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},tOt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let LM=EM.WARNINGS;function oOt(e){Number.isInteger(e)&&(LM=e)}function rOt(){return LM}function IM(e){LM>=EM.INFOS&&console.log(`Info: ${e}`)}function Fr(e){LM>=EM.WARNINGS&&console.log(`Warning: ${e}`)}function Gi(e){throw new Error(e)}function Ua(e,t){e||Gi(t)}function iOt(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function nOt(e,t=null,r=null){if(!e)return null;try{if(r&&typeof e=="string"&&(r.addDefaultProtocol&&e.startsWith("www.")&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),r.tryConvertEncoding))try{e=dOt(e)}catch{}const n=t?new URL(e,t):new URL(e);if(iOt(n))return n}catch{}return null}function pi(e,t,r,n=!1){return Object.defineProperty(e,t,{value:r,enumerable:!n,configurable:!0,writable:!1}),r}const Dg=(function(){function t(r,n){this.constructor===t&&Gi("Cannot initialize BaseException."),this.message=r,this.name=n}return t.prototype=new Error,t.constructor=t,t})();class vY extends Dg{constructor(t,r){super(t,"PasswordException"),this.code=r}}class CY extends Dg{constructor(t,r){super(t,"UnknownErrorException"),this.details=r}}class Bze extends Dg{constructor(t){super(t,"InvalidPDFException")}}class s5 extends Dg{constructor(t){super(t,"MissingPDFException")}}class jM extends Dg{constructor(t,r){super(t,"UnexpectedResponseException"),this.status=r}}class aOt extends Dg{constructor(t){super(t,"FormatError")}}class l5 extends Dg{constructor(t){super(t,"AbortException")}}function Pze(e){(typeof e!="object"||e?.length===void 0)&&Gi("Invalid argument for bytesToString");const t=e.length,r=8192;if(t<r)return String.fromCharCode.apply(null,e);const n=[];for(let a=0;a<t;a+=r){const l=Math.min(a+r,t),c=e.subarray(a,l);n.push(String.fromCharCode.apply(null,c))}return n.join("")}function MM(e){typeof e!="string"&&Gi("Invalid argument for stringToBytes");const t=e.length,r=new Uint8Array(t);for(let n=0;n<t;++n)r[n]=e.charCodeAt(n)&255;return r}function sOt(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function fX(e){const t=Object.create(null);for(const[r,n]of e)t[r]=n;return t}function lOt(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function cOt(){try{return new Function(""),!0}catch{return!1}}class yc{static get isLittleEndian(){return pi(this,"isLittleEndian",lOt())}static get isEvalSupported(){return pi(this,"isEvalSupported",cOt())}static get isOffscreenCanvasSupported(){return pi(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?pi(this,"platform",{isMac:navigator.platform.includes("Mac")}):pi(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return pi(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const t_=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class jo{static makeHexColor(t,r,n){return`#${t_[t]}${t_[r]}${t_[n]}`}static scaleMinMax(t,r){let n;t[0]?(t[0]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=t[0],r[2]*=t[0],t[3]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=t[3],r[3]*=t[3]):(n=r[0],r[0]=r[1],r[1]=n,n=r[2],r[2]=r[3],r[3]=n,t[1]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=t[1],r[3]*=t[1],t[2]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=t[2],r[2]*=t[2]),r[0]+=t[4],r[1]+=t[5],r[2]+=t[4],r[3]+=t[5]}static transform(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}static applyTransform(t,r){const n=t[0]*r[0]+t[1]*r[2]+r[4],a=t[0]*r[1]+t[1]*r[3]+r[5];return[n,a]}static applyInverseTransform(t,r){const n=r[0]*r[3]-r[1]*r[2],a=(t[0]*r[3]-t[1]*r[2]+r[2]*r[5]-r[4]*r[3])/n,l=(-t[0]*r[1]+t[1]*r[0]+r[4]*r[1]-r[5]*r[0])/n;return[a,l]}static getAxialAlignedBoundingBox(t,r){const n=this.applyTransform(t,r),a=this.applyTransform(t.slice(2,4),r),l=this.applyTransform([t[0],t[3]],r),c=this.applyTransform([t[2],t[1]],r);return[Math.min(n[0],a[0],l[0],c[0]),Math.min(n[1],a[1],l[1],c[1]),Math.max(n[0],a[0],l[0],c[0]),Math.max(n[1],a[1],l[1],c[1])]}static inverseTransform(t){const r=t[0]*t[3]-t[1]*t[2];return[t[3]/r,-t[1]/r,-t[2]/r,t[0]/r,(t[2]*t[5]-t[4]*t[3])/r,(t[4]*t[1]-t[5]*t[0])/r]}static singularValueDecompose2dScale(t){const r=[t[0],t[2],t[1],t[3]],n=t[0]*r[0]+t[1]*r[2],a=t[0]*r[1]+t[1]*r[3],l=t[2]*r[0]+t[3]*r[2],c=t[2]*r[1]+t[3]*r[3],d=(n+c)/2,p=Math.sqrt((n+c)**2-4*(n*c-l*a))/2,u=d+p||1,h=d-p||1;return[Math.sqrt(u),Math.sqrt(h)]}static normalizeRect(t){const r=t.slice(0);return t[0]>t[2]&&(r[0]=t[2],r[2]=t[0]),t[1]>t[3]&&(r[1]=t[3],r[3]=t[1]),r}static intersect(t,r){const n=Math.max(Math.min(t[0],t[2]),Math.min(r[0],r[2])),a=Math.min(Math.max(t[0],t[2]),Math.max(r[0],r[2]));if(n>a)return null;const l=Math.max(Math.min(t[1],t[3]),Math.min(r[1],r[3])),c=Math.min(Math.max(t[1],t[3]),Math.max(r[1],r[3]));return l>c?null:[n,l,a,c]}static#e(t,r,n,a,l,c,d,p,u,h){if(u<=0||u>=1)return;const m=1-u,f=u*u,x=f*u,y=m*(m*(m*t+3*u*r)+3*f*n)+x*a,b=m*(m*(m*l+3*u*c)+3*f*d)+x*p;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],b),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],b)}static#t(t,r,n,a,l,c,d,p,u,h,m,f){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&this.#e(t,r,n,a,l,c,d,p,-m/h,f);return}const x=h**2-4*m*u;if(x<0)return;const y=Math.sqrt(x),b=2*u;this.#e(t,r,n,a,l,c,d,p,(-h+y)/b,f),this.#e(t,r,n,a,l,c,d,p,(-h-y)/b,f)}static bezierBoundingBox(t,r,n,a,l,c,d,p,u){return u?(u[0]=Math.min(u[0],t,d),u[1]=Math.min(u[1],r,p),u[2]=Math.max(u[2],t,d),u[3]=Math.max(u[3],r,p)):u=[Math.min(t,d),Math.min(r,p),Math.max(t,d),Math.max(r,p)],this.#t(t,n,l,d,r,a,c,p,3*(-t+3*(n-l)+d),6*(t-2*n+l),3*(n-t),u),this.#t(t,n,l,d,r,a,c,p,3*(-r+3*(a-c)+p),6*(r-2*a+c),3*(a-r),u),u}}function dOt(e){return decodeURIComponent(escape(e))}let o_=null,ume=null;function pOt(e){return o_||(o_=/([\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,ume=new Map([["ſt","ſt"]])),e.replaceAll(o_,(t,r,n)=>r?r.normalize("NFKC"):ume.get(n))}function uOt(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const e=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(Math.random()*255);return Pze(e)}const Dze="pdfjs_internal_id_",f0={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class BM{constructor(){this.constructor===BM&&Gi("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,r){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,r,n,a,l){return"none"}destroy(t=!1){}}class PM{#e=!1;constructor({enableHWA:t=!1}={}){this.constructor===PM&&Gi("Cannot initialize BaseCanvasFactory."),this.#e=t}create(t,r){if(t<=0||r<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(t,r);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#e})}}reset(t,r,n){if(!t.canvas)throw new Error("Canvas is not specified");if(r<=0||n<=0)throw new Error("Invalid canvas size");t.canvas.width=r,t.canvas.height=n}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,r){Gi("Abstract method `_createCanvas` called.")}}class DM{constructor({baseUrl:t=null,isCompressed:r=!0}){this.constructor===DM&&Gi("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=r}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const r=this.baseUrl+t+(this.isCompressed?".bcmap":""),n=this.isCompressed?wY.BINARY:wY.NONE;return this._fetchData(r,n).catch(a=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${r}`)})}_fetchData(t,r){Gi("Abstract method `_fetchData` called.")}}class TM{constructor({baseUrl:t=null}){this.constructor===TM&&Gi("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const r=`${this.baseUrl}${t}`;return this._fetchData(r).catch(n=>{throw new Error(`Unable to load font data at: ${r}`)})}_fetchData(t){Gi("Abstract method `_fetchData` called.")}}class xX{constructor(){this.constructor===xX&&Gi("Cannot initialize BaseSVGFactory.")}create(t,r,n=!1){if(t<=0||r<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");return a.setAttribute("version","1.1"),n||(a.setAttribute("width",`${t}px`),a.setAttribute("height",`${r}px`)),a.setAttribute("preserveAspectRatio","none"),a.setAttribute("viewBox",`0 0 ${t} ${r}`),a}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Gi("Abstract method `_createSVG` called.")}}const A0="http://www.w3.org/2000/svg";class W8{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class hOt extends BM{#e;#t;#o;#i;#s;#r=0;constructor({docId:t,ownerDocument:r=globalThis.document}={}){super(),this.#o=t,this.#i=r}get#n(){return this.#e||=new Map}get#l(){return this.#s||=new Map}get#d(){if(!this.#t){const t=this.#i.createElement("div"),{style:r}=t;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const n=this.#i.createElementNS(A0,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#t=this.#i.createElementNS(A0,"defs"),t.append(n),n.append(this.#t),this.#i.body.append(t)}return this.#t}#p(t){if(t.length===1){const p=t[0],u=new Array(256);for(let m=0;m<256;m++)u[m]=p[m]/255;const h=u.join(",");return[h,h,h]}const[r,n,a]=t,l=new Array(256),c=new Array(256),d=new Array(256);for(let p=0;p<256;p++)l[p]=r[p]/255,c[p]=n[p]/255,d[p]=a[p]/255;return[l.join(","),c.join(","),d.join(",")]}addFilter(t){if(!t)return"none";let r=this.#n.get(t);if(r)return r;const[n,a,l]=this.#p(t),c=t.length===1?n:`${n}${a}${l}`;if(r=this.#n.get(c),r)return this.#n.set(t,r),r;const d=`g_${this.#o}_transfer_map_${this.#r++}`,p=`url(#${d})`;this.#n.set(t,p),this.#n.set(c,p);const u=this.#a(d);return this.#f(n,a,l,u),p}addHCMFilter(t,r){const n=`${t}-${r}`,a="base";let l=this.#l.get(a);if(l?.key===n||(l?(l.filter?.remove(),l.key=n,l.url="none",l.filter=null):(l={key:n,url:"none",filter:null},this.#l.set(a,l)),!t||!r))return l.url;const c=this.#y(t);t=jo.makeHexColor(...c);const d=this.#y(r);if(r=jo.makeHexColor(...d),this.#d.style.color="",t==="#000000"&&r==="#ffffff"||t===r)return l.url;const p=new Array(256);for(let x=0;x<=255;x++){const y=x/255;p[x]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}const u=p.join(","),h=`g_${this.#o}_hcm_filter`,m=l.filter=this.#a(h);this.#f(u,u,u,m),this.#c(m);const f=(x,y)=>{const b=c[x]/255,w=d[x]/255,v=new Array(y+1);for(let A=0;A<=y;A++)v[A]=b+A/y*(w-b);return v.join(",")};return this.#f(f(0,5),f(1,5),f(2,5),m),l.url=`url(#${h})`,l.url}addAlphaFilter(t){let r=this.#n.get(t);if(r)return r;const[n]=this.#p([t]),a=`alpha_${n}`;if(r=this.#n.get(a),r)return this.#n.set(t,r),r;const l=`g_${this.#o}_alpha_map_${this.#r++}`,c=`url(#${l})`;this.#n.set(t,c),this.#n.set(a,c);const d=this.#a(l);return this.#u(n,d),c}addLuminosityFilter(t){let r=this.#n.get(t||"luminosity");if(r)return r;let n,a;if(t?([n]=this.#p([t]),a=`luminosity_${n}`):a="luminosity",r=this.#n.get(a),r)return this.#n.set(t,r),r;const l=`g_${this.#o}_luminosity_map_${this.#r++}`,c=`url(#${l})`;this.#n.set(t,c),this.#n.set(a,c);const d=this.#a(l);return this.#h(d),t&&this.#u(n,d),c}addHighlightHCMFilter(t,r,n,a,l){const c=`${r}-${n}-${a}-${l}`;let d=this.#l.get(t);if(d?.key===c||(d?(d.filter?.remove(),d.key=c,d.url="none",d.filter=null):(d={key:c,url:"none",filter:null},this.#l.set(t,d)),!r||!n))return d.url;const[p,u]=[r,n].map(this.#y.bind(this));let h=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),m=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),[f,x]=[a,l].map(this.#y.bind(this));m<h&&([h,m,f,x]=[m,h,x,f]),this.#d.style.color="";const y=(v,A,S)=>{const E=new Array(256),I=(m-h)/S,L=v/255,B=(A-v)/(255*S);let D=0;for(let M=0;M<=S;M++){const T=Math.round(h+M*I),R=L+M*B;for(let N=D;N<=T;N++)E[N]=R;D=T+1}for(let M=D;M<256;M++)E[M]=E[D-1];return E.join(",")},b=`g_${this.#o}_hcm_${t}_filter`,w=d.filter=this.#a(b);return this.#c(w),this.#f(y(f[0],x[0],5),y(f[1],x[1],5),y(f[2],x[2],5),w),d.url=`url(#${b})`,d.url}destroy(t=!1){t&&this.#l.size!==0||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#r=0)}#h(t){const r=this.#i.createElementNS(A0,"feColorMatrix");r.setAttribute("type","matrix"),r.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"),t.append(r)}#c(t){const r=this.#i.createElementNS(A0,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(r)}#a(t){const r=this.#i.createElementNS(A0,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",t),this.#d.append(r),r}#m(t,r,n){const a=this.#i.createElementNS(A0,r);a.setAttribute("type","discrete"),a.setAttribute("tableValues",n),t.append(a)}#f(t,r,n,a){const l=this.#i.createElementNS(A0,"feComponentTransfer");a.append(l),this.#m(l,"feFuncR",t),this.#m(l,"feFuncG",r),this.#m(l,"feFuncB",n)}#u(t,r){const n=this.#i.createElementNS(A0,"feComponentTransfer");r.append(n),this.#m(n,"feFuncA",t)}#y(t){return this.#d.style.color=t,CX(getComputedStyle(this.#d).getPropertyValue("color"))}}class mOt extends PM{constructor({ownerDocument:t=globalThis.document,enableHWA:r=!1}={}){super({enableHWA:r}),this._document=t}_createCanvas(t,r){const n=this._document.createElement("canvas");return n.width=t,n.height=r,n}}async function zM(e,t="text"){if(wb(e,document.baseURI)){const r=await fetch(e);if(!r.ok)throw new Error(r.statusText);switch(t){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"json":return r.json()}return r.text()}return new Promise((r,n)=>{const a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType=t,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(t){case"arraybuffer":case"blob":case"json":r(a.response);return}r(a.responseText);return}n(new Error(a.statusText))}},a.send(null)})}class Tze extends DM{_fetchData(t,r){return zM(t,this.isCompressed?"arraybuffer":"text").then(n=>({cMapData:n instanceof ArrayBuffer?new Uint8Array(n):MM(n),compressionType:r}))}}class zze extends TM{_fetchData(t){return zM(t,"arraybuffer").then(r=>new Uint8Array(r))}}class yX extends xX{_createSVG(t){return document.createElementNS(A0,t)}}class hC{constructor({viewBox:t,scale:r,rotation:n,offsetX:a=0,offsetY:l=0,dontFlip:c=!1}){this.viewBox=t,this.scale=r,this.rotation=n,this.offsetX=a,this.offsetY=l;const d=(t[2]+t[0])/2,p=(t[3]+t[1])/2;let u,h,m,f;switch(n%=360,n<0&&(n+=360),n){case 180:u=-1,h=0,m=0,f=1;break;case 90:u=0,h=1,m=1,f=0;break;case 270:u=0,h=-1,m=-1,f=0;break;case 0:u=1,h=0,m=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}c&&(m=-m,f=-f);let x,y,b,w;u===0?(x=Math.abs(p-t[1])*r+a,y=Math.abs(d-t[0])*r+l,b=(t[3]-t[1])*r,w=(t[2]-t[0])*r):(x=Math.abs(d-t[0])*r+a,y=Math.abs(p-t[1])*r+l,b=(t[2]-t[0])*r,w=(t[3]-t[1])*r),this.transform=[u*r,h*r,m*r,f*r,x-u*r*d-m*r*p,y-h*r*d-f*r*p],this.width=b,this.height=w}get rawDims(){const{viewBox:t}=this;return pi(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:r=this.rotation,offsetX:n=this.offsetX,offsetY:a=this.offsetY,dontFlip:l=!1}={}){return new hC({viewBox:this.viewBox.slice(),scale:t,rotation:r,offsetX:n,offsetY:a,dontFlip:l})}convertToViewportPoint(t,r){return jo.applyTransform([t,r],this.transform)}convertToViewportRectangle(t){const r=jo.applyTransform([t[0],t[1]],this.transform),n=jo.applyTransform([t[2],t[3]],this.transform);return[r[0],r[1],n[0],n[1]]}convertToPdfPoint(t,r){return jo.applyInverseTransform([t,r],this.transform)}}class bX extends Dg{constructor(t,r=0){super(t,"RenderingCancelledException"),this.extraDelay=r}}function wX(e){const t=e.length;let r=0;for(;r<t&&e[r].trim()==="";)r++;return e.substring(r,r+5).toLowerCase()==="data:"}function vX(e){return typeof e=="string"&&/\.pdf$/i.test(e)}function gOt(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function fOt(e,t="document.pdf"){if(typeof e!="string")return t;if(wX(e))return Fr('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,a=r.exec(e);let l=n.exec(a[1])||n.exec(a[2])||n.exec(a[3]);if(l&&(l=l[0],l.includes("%")))try{l=n.exec(decodeURIComponent(l))[0]}catch{}return l||t}class hme{started=Object.create(null);times=[];time(t){t in this.started&&Fr(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||Fr(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let r=0;for(const{name:n}of this.times)r=Math.max(n.length,r);for(const{name:n,start:a,end:l}of this.times)t.push(`${n.padEnd(r)} ${l-a}ms
|
|
246
|
-
`);return t.join("")}}function wb(e,t){try{const{protocol:r}=t?new URL(e,t):new URL(e);return r==="http:"||r==="https:"}catch{return!1}}function $c(e){e.preventDefault()}function Rze(e){console.log("Deprecated API usage: "+e)}let mme;class Fze{static toDateObject(t){if(!t||typeof t!="string")return null;mme||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const r=mme.exec(t);if(!r)return null;const n=parseInt(r[1],10);let a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let l=parseInt(r[3],10);l=l>=1&&l<=31?l:1;let c=parseInt(r[4],10);c=c>=0&&c<=23?c:0;let d=parseInt(r[5],10);d=d>=0&&d<=59?d:0;let p=parseInt(r[6],10);p=p>=0&&p<=59?p:0;const u=r[7]||"Z";let h=parseInt(r[8],10);h=h>=0&&h<=23?h:0;let m=parseInt(r[9],10)||0;return m=m>=0&&m<=59?m:0,u==="-"?(c+=h,d+=m):u==="+"&&(c-=h,d-=m),new Date(Date.UTC(n,a,l,c,d,p))}}function xOt(e,{scale:t=1,rotation:r=0}){const{width:n,height:a}=e.attributes.style,l=[0,0,parseInt(n),parseInt(a)];return new hC({viewBox:l,scale:t,rotation:r})}function CX(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map(t=>parseInt(t)):e.startsWith("rgba(")?e.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Fr(`Not a valid color format: "${e}"`),[0,0,0])}function yOt(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const r of e.keys()){t.style.color=r;const n=window.getComputedStyle(t).color;e.set(r,CX(n))}t.remove()}function Pn(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform();return[t,r,n,a,l,c]}function x0(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform().invertSelf();return[t,r,n,a,l,c]}function R4(e,t,r=!1,n=!0){if(t instanceof hC){const{pageWidth:a,pageHeight:l}=t.rawDims,{style:c}=e,d=yc.isCSSRoundSupported,p=`var(--scale-factor) * ${a}px`,u=`var(--scale-factor) * ${l}px`,h=d?`round(${p}, 1px)`:`calc(${p})`,m=d?`round(${u}, 1px)`:`calc(${u})`;!r||t.rotation%180===0?(c.width=h,c.height=m):(c.width=m,c.height=h)}n&&e.setAttribute("data-main-rotation",t.rotation)}class AX{#e=null;#t=null;#o;#i=null;constructor(t){this.#o=t}render(){const t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");const r=this.#o._uiManager._signal;t.addEventListener("contextmenu",$c,{signal:r}),t.addEventListener("pointerdown",AX.#s,{signal:r});const n=this.#i=document.createElement("div");n.className="buttons",t.append(n);const a=this.#o.toolbarPosition;if(a){const{style:l}=t,c=this.#o._uiManager.direction==="ltr"?1-a[0]:a[0];l.insetInlineEnd=`${100*c}%`,l.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}static#s(t){t.stopPropagation()}#r(t){this.#o._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#n(t){this.#o._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#l(t){const r=this.#o._uiManager._signal;t.addEventListener("focusin",this.#r.bind(this),{capture:!0,signal:r}),t.addEventListener("focusout",this.#n.bind(this),{capture:!0,signal:r}),t.addEventListener("contextmenu",$c,{signal:r})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden")}#d(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#o.editorType}-button`),this.#l(t),t.addEventListener("click",r=>{this.#o._uiManager.delete()},{signal:this.#o._uiManager._signal}),this.#i.append(t)}get#p(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#l(t),this.#i.prepend(t,this.#p)}addColorPicker(t){this.#t=t;const r=t.renderButton();this.#l(r),this.#i.prepend(r,this.#p)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class bOt{#e=null;#t=null;#o;constructor(t){this.#o=t}#i(){const t=this.#t=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",$c,{signal:this.#o._signal});const r=this.#e=document.createElement("div");return r.className="buttons",t.append(r),this.#r(),t}#s(t,r){let n=0,a=0;for(const l of t){const c=l.y+l.height;if(c<n)continue;const d=l.x+(r?l.width:0);if(c>n){a=d,n=c;continue}r?d>a&&(a=d):d<a&&(a=d)}return[r?1-a:a,n]}show(t,r,n){const[a,l]=this.#s(r,n),{style:c}=this.#t||=this.#i();t.append(this.#t),c.insetInlineEnd=`${100*a}%`,c.top=`calc(${100*l}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#r(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const r=document.createElement("span");t.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#o._signal;t.addEventListener("contextmenu",$c,{signal:n}),t.addEventListener("click",()=>{this.#o.highlightSelection("floating_button")},{signal:n}),this.#e.append(t)}}function ML(e,t,r){for(const n of r)t.addEventListener(n,e[n].bind(e))}function wOt(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}class vOt{#e=0;get id(){return`${XFt}${this.#e++}`}}class $X{#e=uOt();#t=0;#o=null;static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=t;const l=a.decode().then(()=>(n.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return pi(this,"_isSVGFittingCanvas",l)}async#i(t,r){this.#o||=new Map;let n=this.#o.get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof r=="string"?(n.url=r,a=await zM(r,"blob")):a=n.file=r,a.type==="image/svg+xml"){const l=$X._isSVGFittingCanvas,c=new FileReader,d=new Image,p=new Promise((u,h)=>{d.onload=()=>{n.bitmap=d,n.isSvg=!0,u()},c.onload=async()=>{const m=n.svgUrl=c.result;d.src=await l?`${m}#svgView(preserveAspectRatio(none))`:m},d.onerror=c.onerror=h});c.readAsDataURL(a),await p}else n.bitmap=await createImageBitmap(a);n.refCounter=1}catch(a){console.error(a),n=null}return this.#o.set(t,n),n&&this.#o.set(n.id,n),n}async getFromFile(t){const{lastModified:r,name:n,size:a,type:l}=t;return this.#i(`${r}_${n}_${a}_${l}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromId(t){this.#o||=new Map;const r=this.#o.get(t);return r?r.bitmap?(r.refCounter+=1,r):r.file?this.getFromFile(r.file):this.getFromUrl(r.url):null}getSvgUrl(t){const r=this.#o.get(t);return r?.isSvg?r.svgUrl:null}deleteId(t){this.#o||=new Map;const r=this.#o.get(t);r&&(r.refCounter-=1,r.refCounter===0&&(r.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#e}_`)}}class COt{#e=[];#t=!1;#o;#i=-1;constructor(t=128){this.#o=t}add({cmd:t,undo:r,post:n,mustExec:a,type:l=NaN,overwriteIfSameType:c=!1,keepUndo:d=!1}){if(a&&t(),this.#t)return;const p={cmd:t,undo:r,post:n,type:l};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(p);return}if(c&&this.#e[this.#i].type===l){d&&(p.undo=this.#e[this.#i].undo),this.#e[this.#i]=p;return}const u=this.#i+1;u===this.#o?this.#e.splice(0,1):(this.#i=u,u<this.#e.length&&this.#e.splice(u)),this.#e.push(p)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}destroy(){this.#e=null}}class mC{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=yc.platform;for(const[n,a,l={}]of t)for(const c of n){const d=c.startsWith("mac+");r&&d?(this.callbacks.set(c.slice(4),{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1))):!r&&!d&&(this.callbacks.set(c,{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1)))}}#e(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const r=this.buffer.join("+");return this.buffer.length=0,r}exec(t,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(this.#e(r));if(!n)return;const{callback:a,options:{bubbles:l=!1,args:c=[],checker:d=null}}=n;d&&!d(t,r)||(a.bind(t,...c,r)(),l||(r.stopPropagation(),r.preventDefault()))}}class kX{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return yOt(t),pi(this,"_colors",t)}convert(t){const r=CX(t);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,a]of this._colors)if(a.every((l,c)=>l===r[c]))return kX._colorsMapping.get(n);return r}getHexCode(t){const r=this._colors.get(t);return r?jo.makeHexColor(...r):t}}class yg{#e=new AbortController;#t=null;#o=new Map;#i=new Map;#s=null;#r=null;#n=null;#l=new COt;#d=0;#p=new Set;#h=null;#c=null;#a=new Set;#m=!1;#f=null;#u=null;#y=null;#g=!1;#b=null;#v=new vOt;#A=!1;#k=!1;#S=null;#j=null;#$=null;#w=ii.NONE;#x=new Set;#C=null;#E=null;#L=null;#B=this.blur.bind(this);#M=this.focus.bind(this);#T=this.copy.bind(this);#P=this.cut.bind(this);#z=this.paste.bind(this);#D=this.keydown.bind(this);#Q=this.keyup.bind(this);#U=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#N=this.onScaleChanging.bind(this);#R=this.onRotationChanging.bind(this);#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#F=null;#H=null;#q=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=yg.prototype,r=c=>c.#H.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&c.hasSomethingToControl(),n=(c,{target:d})=>{if(d instanceof HTMLInputElement){const{type:p}=d;return p!=="text"&&p!=="number"}return!0},a=this.TRANSLATE_SMALL,l=this.TRANSLATE_BIG;return pi(this,"_keyboardManager",new mC([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(d)&&!c.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-l,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[l,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-l],checker:r}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,l],checker:r}]]))}constructor(t,r,n,a,l,c,d,p,u){this._signal=this.#e.signal,this.#H=t,this.#q=r,this.#s=n,this._eventBus=a,this._eventBus._on("editingaction",this.#U),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#N),this._eventBus._on("rotationchanging",this.#R),this.#ie(),this.#le(),this.#Z(),this.#r=l.annotationStorage,this.#f=l.filterFactory,this.#E=c,this.#y=d||null,this.#m=p,this.#$=u||null,this.viewParameters={realScale:W8.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#e?.abort(),this.#e=null,this._signal=null,this._eventBus._off("editingaction",this.#U),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#N),this._eventBus._off("rotationchanging",this.#R);for(const t of this.#i.values())t.destroy();this.#i.clear(),this.#o.clear(),this.#a.clear(),this.#t=null,this.#x.clear(),this.#l.destroy(),this.#s?.destroy(),this.#b?.hide(),this.#b=null,this.#u&&(clearTimeout(this.#u),this.#u=null),this.#F&&(clearTimeout(this.#F),this.#F=null)}async mlGuess(t){return this.#$?.guess(t)||null}get hasMLManager(){return!!this.#$}get hcmFilter(){return pi(this,"hcmFilter",this.#E?this.#f.addHCMFilter(this.#E.foreground,this.#E.background):"none")}get direction(){return pi(this,"direction",getComputedStyle(this.#H).direction)}get highlightColors(){return pi(this,"highlightColors",this.#y?new Map(this.#y.split(",").map(t=>t.split("=").map(r=>r.trim()))):null)}get highlightColorNames(){return pi(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#j=t}editAltText(t){this.#s?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#d=t-1}focusMainContainer(){this.#H.focus()}findParent(t,r){for(const n of this.#i.values()){const{x:a,y:l,width:c,height:d}=n.div.getBoundingClientRect();if(t>=a&&t<=a+c&&r>=l&&r<=l+d)return n}return null}disableUserSelect(t=!1){this.#q.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#a.add(t)}removeShouldRescale(t){this.#a.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*W8.PDF_TO_CSS_UNITS;for(const r of this.#a)r.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#G({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c}=r,d=r.toString(),u=this.#G(r).closest(".textLayer"),h=this.getSelectionBoxes(u);if(h){r.empty(),this.#w===ii.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:ii.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const m of this.#i.values())if(m.hasTextLayer(u)){m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c,text:d});break}}}#oe(){const t=document.getSelection();if(!t||t.isCollapsed)return;const n=this.#G(t).closest(".textLayer"),a=this.getSelectionBoxes(n);a&&(this.#b||=new bOt(this),this.#b.show(n,a,this.direction==="ltr"))}addToAnnotationStorage(t){!t.isEmpty()&&this.#r&&!this.#r.has(t.id)&&this.#r.setValue(t.id,t)}#re(){const t=document.getSelection();if(!t||t.isCollapsed){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}const{anchorNode:r}=t;if(r===this.#C)return;if(!this.#G(t).closest(".textLayer")){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}if(this.#b?.hide(),this.#C=r,this.#I({hasSelectedText:!0}),!(this.#w!==ii.HIGHLIGHT&&this.#w!==ii.NONE)&&(this.#w===ii.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#g=this.isShiftKeyDown,!this.isShiftKeyDown)){const l=this._signal,c=d=>{d.type==="pointerup"&&d.button!==0||(window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),d.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}}#Y(t=""){this.#w===ii.HIGHLIGHT?this.highlightSelection(t):this.#m&&this.#oe()}#ie(){document.addEventListener("selectionchange",this.#re.bind(this),{signal:this._signal})}#ne(){const t=this._signal;window.addEventListener("focus",this.#M,{signal:t}),window.addEventListener("blur",this.#B,{signal:t})}#ae(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#B)}blur(){if(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const r of this.#x)if(r.div.contains(t)){this.#S=[r,t],r._focusEventsAllowed=!1;break}}focus(){if(!this.#S)return;const[t,r]=this.#S;this.#S=null,r.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}#Z(){const t=this._signal;window.addEventListener("keydown",this.#D,{signal:t}),window.addEventListener("keyup",this.#Q,{signal:t})}#se(){window.removeEventListener("keydown",this.#D),window.removeEventListener("keyup",this.#Q)}#J(){const t=this._signal;document.addEventListener("copy",this.#T,{signal:t}),document.addEventListener("cut",this.#P,{signal:t}),document.addEventListener("paste",this.#z,{signal:t})}#X(){document.removeEventListener("copy",this.#T),document.removeEventListener("cut",this.#P),document.removeEventListener("paste",this.#z)}#le(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#Z(),this.#J()}removeEditListeners(){this.#se(),this.#X()}dragOver(t){for(const{type:r}of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const r of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const r=[];for(const n of this.#x){const a=n.serialize(!0);a&&r.push(a)}r.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:r}=t;for(const l of r.items)for(const c of this.#c)if(c.isHandlingMimeForPasting(l.type)){c.paste(l,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(l){Fr(`paste: "${l.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const a=this.currentLayer;try{const l=[];for(const p of n){const u=a.deserialize(p);if(!u)return;l.push(u)}const c=()=>{for(const p of l)this.#ee(p);this.#te(l)},d=()=>{for(const p of l)p.remove()};this.addCommands({cmd:c,undo:d,mustExec:!0})}catch(l){Fr(`paste: "${l.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#w!==ii.NONE&&!this.isEditorHandlingKeyboard&&yg._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}#I(t){Object.entries(t).some(([n,a])=>this.#K[n]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#w===ii.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#O([[gr.HIGHLIGHT_FREE,!0]]))}#O(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ne(),this.#J(),this.#I({isEditing:this.#w!==ii.NONE,isEmpty:this.#W(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#X(),this.#I({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#c){this.#c=t;for(const r of this.#c)this.#O(r.defaultPropertiesToUpdate)}}getId(){return this.#v.id}get currentLayer(){return this.#i.get(this.#d)}getLayer(t){return this.#i.get(t)}get currentPageIndex(){return this.#d}addLayer(t){this.#i.set(t.pageIndex,t),this.#A?t.enable():t.disable()}removeLayer(t){this.#i.delete(t.pageIndex)}updateMode(t,r=null,n=!1){if(this.#w!==t){if(this.#w=t,t===ii.NONE){this.setEditingState(!1),this.#de();return}this.setEditingState(!0),this.#ce(),this.unselectAll();for(const a of this.#i.values())a.updateMode(t);if(!r&&n){this.addNewEditorFromKeyboard();return}if(r){for(const a of this.#o.values())if(a.annotationElementId===r){this.setSelected(a),a.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#w&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,r){if(this.#c){switch(t){case gr.CREATE:this.currentLayer.addNewEditor();return;case gr.HIGHLIGHT_DEFAULT_COLOR:this.#j?.updateColor(r);break;case gr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#L||=new Map).set(t,r),this.showAllEditors("highlight",r);break}for(const n of this.#x)n.updateParams(t,r);for(const n of this.#c)n.updateDefaultParams(t,r)}}showAllEditors(t,r,n=!1){for(const l of this.#o.values())l.editorType===t&&l.show(r);(this.#L?.get(gr.HIGHLIGHT_SHOW_ALL)??!0)!==r&&this.#O([[gr.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(t=!1){if(this.#k!==t){this.#k=t;for(const r of this.#i.values())t?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",t)}}#ce(){if(!this.#A){this.#A=!0;for(const t of this.#i.values())t.enable();for(const t of this.#o.values())t.enable()}}#de(){if(this.unselectAll(),this.#A){this.#A=!1;for(const t of this.#i.values())t.disable();for(const t of this.#o.values())t.disable()}}getEditors(t){const r=[];for(const n of this.#o.values())n.pageIndex===t&&r.push(n);return r}getEditor(t){return this.#o.get(t)}addEditor(t){this.#o.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#u&&clearTimeout(this.#u),this.#u=setTimeout(()=>{this.focusMainContainer(),this.#u=null},0)),this.#o.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#p.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#p.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#p.has(t)}removeDeletedAnnotationElement(t){this.#p.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#ee(t){const r=this.#i.get(t.pageIndex);r?r.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#t!==t&&(this.#t=t,t&&this.#O(t.propertiesToUpdate))}get#pe(){let t=null;for(t of this.#x);return t}updateUI(t){this.#pe===t&&this.#O(t.propertiesToUpdate)}toggleSelected(t){if(this.#x.has(t)){this.#x.delete(t),t.unselect(),this.#I({hasSelectedEditor:this.hasSelection});return}this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}setSelected(t){for(const r of this.#x)r!==t&&r.unselect();this.#x.clear(),this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}isSelected(t){return this.#x.has(t)}get firstSelectedEditor(){return this.#x.values().next().value}unselect(t){t.unselect(),this.#x.delete(t),this.#I({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#x.size!==0}get isEnterHandled(){return this.#x.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#I({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#W()})}redo(){this.#l.redo(),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#W()})}addCommands(t){this.#l.add(t),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#W()})}#W(){if(this.#o.size===0)return!0;if(this.#o.size===1)for(const t of this.#o.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#x],r=()=>{for(const a of t)a.remove()},n=()=>{for(const a of t)this.#ee(a)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#te(t){for(const r of this.#x)r.unselect();this.#x.clear();for(const r of t)r.isEmpty()||(this.#x.add(r),r.select());this.#I({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#x)t.commit();this.#te(this.#o.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#w!==ii.NONE))&&this.hasSelection){for(const t of this.#x)t.unselect();this.#x.clear(),this.#I({hasSelectedEditor:!1})}}translateSelectedEditors(t,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=t,this.#V[1]+=r;const[a,l]=this.#V,c=[...this.#x],d=1e3;this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(a,l)},undo:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(-a,-l)},mustExec:!1})},d);for(const p of c)p.translateInPage(t,r)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(const t of this.#x)this.#h.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);const t=this.#h;this.#h=null;let r=!1;for(const[{x:a,y:l,pageIndex:c},d]of t)d.newX=a,d.newY=l,d.newPageIndex=c,r||=a!==d.savedX||l!==d.savedY||c!==d.savedPageIndex;if(!r)return!1;const n=(a,l,c,d)=>{if(this.#o.has(a.id)){const p=this.#i.get(d);p?a._setParentAndPosition(p,l,c):(a.pageIndex=d,a.x=l,a.y=c)}};return this.addCommands({cmd:()=>{for(const[a,{newX:l,newY:c,newPageIndex:d}]of t)n(a,l,c,d)},undo:()=>{for(const[a,{savedX:l,savedY:c,savedPageIndex:d}]of t)n(a,l,c,d)},mustExec:!0}),!0}dragSelectedEditors(t,r){if(this.#h)for(const n of this.#h.keys())n.drag(t,r)}rebuild(t){if(t.parent===null){const r=this.getLayer(t.pageIndex);r?(r.changeParent(t),r.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#x.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#t===t}getActive(){return this.#t}getMode(){return this.#w}get imageManager(){return pi(this,"imageManager",new $X)}getSelectionBoxes(t){if(!t)return null;const r=document.getSelection();for(let u=0,h=r.rangeCount;u<h;u++)if(!t.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:a,width:l,height:c}=t.getBoundingClientRect();let d;switch(t.getAttribute("data-main-rotation")){case"90":d=(u,h,m,f)=>({x:(h-a)/c,y:1-(u+m-n)/l,width:f/c,height:m/l});break;case"180":d=(u,h,m,f)=>({x:1-(u+m-n)/l,y:1-(h+f-a)/c,width:m/l,height:f/c});break;case"270":d=(u,h,m,f)=>({x:1-(h+f-a)/c,y:(u-n)/l,width:f/c,height:m/l});break;default:d=(u,h,m,f)=>({x:(u-n)/l,y:(h-a)/c,width:m/l,height:f/c});break}const p=[];for(let u=0,h=r.rangeCount;u<h;u++){const m=r.getRangeAt(u);if(!m.collapsed)for(const{x:f,y:x,width:y,height:b}of m.getClientRects())y===0||b===0||p.push(d(f,x,y,b))}return p.length===0?null:p}addChangedExistingAnnotation({annotationElementId:t,id:r}){(this.#n||=new Map).set(t,r)}removeChangedExistingAnnotation({annotationElementId:t}){this.#n?.delete(t)}renderAnnotationElement(t){const r=this.#n?.get(t.data.id);if(!r)return;const n=this.#r.getRawValue(r);n&&(this.#w===ii.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}}class s4{#e="";#t=!1;#o=null;#i=null;#s=null;#r=!1;#n=null;static _l10nPromise=null;constructor(t){this.#n=t}static initialize(t){s4._l10nPromise||=t}async render(){const t=this.#o=document.createElement("button");t.className="altText";const r=await s4._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=r,t.setAttribute("aria-label",r),t.tabIndex="0";const n=this.#n._uiManager._signal;t.addEventListener("contextmenu",$c,{signal:n}),t.addEventListener("pointerdown",l=>l.stopPropagation(),{signal:n});const a=l=>{l.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",a,{capture:!0,signal:n}),t.addEventListener("keydown",l=>{l.target===t&&l.key==="Enter"&&(this.#r=!0,a(l))},{signal:n}),await this.#l(),t}finish(){this.#o&&(this.#o.focus({focusVisible:this.#r}),this.#r=!1)}isEmpty(){return!this.#e&&!this.#t}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:t,decorative:r}){this.#e===t&&this.#t===r||(this.#e=t,this.#t=r,this.#l())}toggle(t=!1){this.#o&&(!t&&this.#s&&(clearTimeout(this.#s),this.#s=null),this.#o.disabled=!t)}destroy(){this.#o?.remove(),this.#o=null,this.#i=null}async#l(){const t=this.#o;if(!t)return;if(!this.#e&&!this.#t){t.classList.remove("done"),this.#i?.remove();return}t.classList.add("done"),s4._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(a=>{t.setAttribute("aria-label",a)});let r=this.#i;if(!r){this.#i=r=document.createElement("span"),r.className="tooltip",r.setAttribute("role","tooltip");const a=r.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",a);const l=100,c=this.#n._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(this.#s),this.#s=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#i.classList.add("show"),this.#n._reportTelemetry({action:"alt_text_tooltip"})},l)},{signal:c}),t.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:c})}r.innerText=this.#t?await s4._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#e,r.parentNode||t.append(r),this.#n.getImageForAltText()?.setAttribute("aria-describedby",r.id)}}class pr{#e=null;#t=null;#o=null;#i=!1;#s=!1;#r=null;#n=null;#l=this.focusin.bind(this);#d=this.focusout.bind(this);#p=null;#h="";#c=!1;#a=null;#m=!1;#f=!1;#u=!1;#y=null;#g=0;#b=0;#v=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#A=!1;#k=pr._zIndex++;static _borderLineWidth=-1;static _colorManager=new kX;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=pr.prototype._resizeWithKeyboard,r=yg.TRANSLATE_SMALL,n=yg.TRANSLATE_BIG;return pi(this,"_resizerKeyboardManager",new mC([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],pr.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===pr&&Gi("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:r,rawDims:{pageWidth:n,pageHeight:a,pageX:l,pageY:c}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,a],this.pageTranslation=[l,c];const[d,p]=this.parentDimensions;this.x=t.x/d,this.y=t.y/p,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return pi(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const r=new AOt({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});r.annotationElementId=t.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(t,r,n){if(pr._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(l=>[l,t.get(l.replaceAll(/([A-Z])/g,c=>`-${c.toLowerCase()}`))])),n?.strings)for(const l of n.strings)pr._l10nPromise.set(l,t.get(l));if(pr._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);pr._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,r){Gi("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#A}set _isDraggable(t){this.#A=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(t*2),this.y+=this.width*t/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(t*2),this.y-=this.width*t/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#k}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#D(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#c?this.#c=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,r,n,a){const[l,c]=this.parentDimensions;[n,a]=this.screenToPageTranslation(n,a),this.x=(t+n)/l,this.y=(r+a)/c,this.fixAndSetPosition()}#S([t,r],n,a){[n,a]=this.screenToPageTranslation(n,a),this.x+=n/t,this.y+=a/r,this.fixAndSetPosition()}translate(t,r){this.#S(this.parentDimensions,t,r)}translateInPage(t,r){this.#a||=[this.x,this.y],this.#S(this.pageDimensions,t,r),this.div.scrollIntoView({block:"nearest"})}drag(t,r){this.#a||=[this.x,this.y];const[n,a]=this.parentDimensions;if(this.x+=t/n,this.y+=r/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:l,y:c}=this;const[d,p]=this.getBaseTranslation();l+=d,c+=p,this.div.style.left=`${(100*l).toFixed(2)}%`,this.div.style.top=`${(100*c).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#a&&(this.#a[0]!==this.x||this.#a[1]!==this.y)}getBaseTranslation(){const[t,r]=this.parentDimensions,{_borderLineWidth:n}=pr,a=n/t,l=n/r;switch(this.rotation){case 90:return[-a,l];case 180:return[a,l];case 270:return[a,-l];default:return[-a,-l]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[r,n]=this.pageDimensions;let{x:a,y:l,width:c,height:d}=this;if(c*=r,d*=n,a*=r,l*=n,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(r-c,a)),l=Math.max(0,Math.min(n-d,l));break;case 90:a=Math.max(0,Math.min(r-d,a)),l=Math.min(n,Math.max(c,l));break;case 180:a=Math.min(r,Math.max(c,a)),l=Math.min(n,Math.max(d,l));break;case 270:a=Math.min(r,Math.max(d,a)),l=Math.max(0,Math.min(n-c,l));break}this.x=a/=r,this.y=l/=n;const[p,u]=this.getBaseTranslation();a+=p,l+=u;const{style:h}=this.div;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this.moveInDOM()}static#j(t,r,n){switch(n){case 90:return[r,-t];case 180:return[-t,-r];case 270:return[-r,t];default:return[t,r]}}screenToPageTranslation(t,r){return pr.#j(t,r,this.parentRotation)}pageTranslationToScreen(t,r){return pr.#j(t,r,360-this.parentRotation)}#$(t){switch(t){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[r,n]}=this,a=r*t,l=n*t;return yc.isCSSRoundSupported?[Math.round(a),Math.round(l)]:[a,l]}setDims(t,r){const[n,a]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*r/a).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:r,width:n}=t,a=n.endsWith("%"),l=!this.#s&&r.endsWith("%");if(a&&l)return;const[c,d]=this.parentDimensions;a||(t.width=`${(100*parseFloat(n)/c).toFixed(2)}%`),!this.#s&&!l&&(t.height=`${(100*parseFloat(r)/d).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#w(){if(this.#r)return;this.#r=document.createElement("div"),this.#r.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of t){const a=document.createElement("div");this.#r.append(a),a.classList.add("resizer",n),a.setAttribute("data-resizer-name",n),a.addEventListener("pointerdown",this.#x.bind(this,n),{signal:r}),a.addEventListener("contextmenu",$c,{signal:r}),a.tabIndex=-1}this.div.prepend(this.#r)}#x(t,r){r.preventDefault();const{isMac:n}=yc.platform;if(r.button!==0||r.ctrlKey&&n)return;this.#o?.toggle(!1);const a=this.#E.bind(this,t),l=this._isDraggable;this._isDraggable=!1;const c=this._uiManager._signal,d={passive:!0,capture:!0,signal:c};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",a,d),window.addEventListener("contextmenu",$c,{signal:c});const p=this.x,u=this.y,h=this.width,m=this.height,f=this.parent.div.style.cursor,x=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(r.target).cursor;const y=()=>{this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=l,window.removeEventListener("pointerup",y),window.removeEventListener("blur",y),window.removeEventListener("pointermove",a,d),window.removeEventListener("contextmenu",$c),this.parent.div.style.cursor=f,this.div.style.cursor=x,this.#C(p,u,h,m)};window.addEventListener("pointerup",y,{signal:c}),window.addEventListener("blur",y,{signal:c})}#C(t,r,n,a){const l=this.x,c=this.y,d=this.width,p=this.height;l===t&&c===r&&d===n&&p===a||this.addCommands({cmd:()=>{this.width=d,this.height=p,this.x=l,this.y=c;const[u,h]=this.parentDimensions;this.setDims(u*d,h*p),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=a,this.x=t,this.y=r;const[u,h]=this.parentDimensions;this.setDims(u*n,h*a),this.fixAndSetPosition()},mustExec:!0})}#E(t,r){const[n,a]=this.parentDimensions,l=this.x,c=this.y,d=this.width,p=this.height,u=pr.MIN_SIZE/n,h=pr.MIN_SIZE/a,m=V=>Math.round(V*1e4)/1e4,f=this.#$(this.rotation),x=(V,O)=>[f[0]*V+f[2]*O,f[1]*V+f[3]*O],y=this.#$(360-this.rotation),b=(V,O)=>[y[0]*V+y[2]*O,y[1]*V+y[3]*O];let w,v,A=!1,S=!1;switch(t){case"topLeft":A=!0,w=(V,O)=>[0,0],v=(V,O)=>[V,O];break;case"topMiddle":w=(V,O)=>[V/2,0],v=(V,O)=>[V/2,O];break;case"topRight":A=!0,w=(V,O)=>[V,0],v=(V,O)=>[0,O];break;case"middleRight":S=!0,w=(V,O)=>[V,O/2],v=(V,O)=>[0,O/2];break;case"bottomRight":A=!0,w=(V,O)=>[V,O],v=(V,O)=>[0,0];break;case"bottomMiddle":w=(V,O)=>[V/2,O],v=(V,O)=>[V/2,0];break;case"bottomLeft":A=!0,w=(V,O)=>[0,O],v=(V,O)=>[V,0];break;case"middleLeft":S=!0,w=(V,O)=>[0,O/2],v=(V,O)=>[V,O/2];break}const E=w(d,p),I=v(d,p);let L=x(...I);const B=m(l+L[0]),D=m(c+L[1]);let M=1,T=1,[R,N]=this.screenToPageTranslation(r.movementX,r.movementY);if([R,N]=b(R/n,N/a),A){const V=Math.hypot(d,p);M=T=Math.max(Math.min(Math.hypot(I[0]-E[0]-R,I[1]-E[1]-N)/V,1/d,1/p),u/d,h/p)}else S?M=Math.max(u,Math.min(1,Math.abs(I[0]-E[0]-R)))/d:T=Math.max(h,Math.min(1,Math.abs(I[1]-E[1]-N)))/p;const K=m(d*M),q=m(p*T);L=x(...v(K,q));const F=B-L[0],_=D-L[1];this.width=K,this.height=q,this.x=F,this.y=_,this.setDims(n*K,a*q),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this.#p||this.#f?this.#p:(this.#p=new AX(this),this.div.append(this.#p.render()),this.#o&&this.#p.addAltTextButton(await this.#o.render()),this.#p)}removeEditToolbar(){this.#p&&(this.#p.remove(),this.#p=null,this.#o?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(s4.initialize(pr._l10nPromise),this.#o=new s4(this),this.#e&&(this.#o.data=this.#e,this.#e=null),await this.addEditToolbar())}get altTextData(){return this.#o?.data}set altTextData(t){this.#o&&(this.#o.data=t)}hasAltText(){return!this.#o?.isEmpty()}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#i?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",this.#l,{signal:t}),this.div.addEventListener("focusout",this.#d,{signal:t});const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*n/r).toFixed(2)}%`,this.div.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[a,l]=this.getInitialTranslation();return this.translate(a,l),ML(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:r}=yc.platform;if(t.button!==0||t.ctrlKey&&r){t.preventDefault();return}if(this.#c=!0,this._isDraggable){this.#B(t);return}this.#L(t)}#L(t){const{isMac:r}=yc.platform;t.ctrlKey&&!r||t.shiftKey||t.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)}#B(t){const r=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,a;const l=this._uiManager._signal;r&&(this.div.classList.add("moving"),n={passive:!0,capture:!0,signal:l},this.#g=t.clientX,this.#b=t.clientY,a=d=>{const{clientX:p,clientY:u}=d,[h,m]=this.screenToPageTranslation(p-this.#g,u-this.#b);this.#g=p,this.#b=u,this._uiManager.dragSelectedEditors(h,m)},window.addEventListener("pointermove",a,n));const c=()=>{window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),r&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",a,n)),this.#c=!1,this._uiManager.endDragSession()||this.#L(t)};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,r,n){t.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition()}getRect(t,r,n=this.rotation){const a=this.parentScale,[l,c]=this.pageDimensions,[d,p]=this.pageTranslation,u=t/a,h=r/a,m=this.x*l,f=this.y*c,x=this.width*l,y=this.height*c;switch(n){case 0:return[m+u+d,c-f-h-y+p,m+u+x+d,c-f-h+p];case 90:return[m+h+d,c-f+u+p,m+h+y+d,c-f+u+x+p];case 180:return[m-u-x+d,c-f+h+p,m-u+d,c-f+h+y+p];case 270:return[m-h-y+d,c-f-u-x+p,m-h+d,c-f-u+p];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,r){const[n,a,l,c]=t,d=l-n,p=c-a;switch(this.rotation){case 0:return[n,r-c,d,p];case 90:return[n,r-a,p,d];case 180:return[l,r-a,d,p];case 270:return[l,r-c,p,d];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#f=!0}disableEditMode(){this.#f=!1}isInEditMode(){return this.#f}shouldGetKeyboardEvents(){return this.#u}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){const t=this._uiManager._signal;this.div?.addEventListener("focusin",this.#l,{signal:t}),this.div?.addEventListener("focusout",this.#d,{signal:t})}rotate(t){}serialize(t=!1,r=null){Gi("An editor must be serializable")}static deserialize(t,r,n){const a=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n});a.rotation=t.rotation,a.#e=t.accessibilityData;const[l,c]=a.pageDimensions,[d,p,u,h]=a.getRectInCurrentCoords(t.rect,c);return a.x=d/l,a.y=p/c,a.width=u/l,a.height=h/c,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#d),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#D(),this.removeEditToolbar(),this.#v){for(const t of this.#v.values())clearTimeout(t);this.#v=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#w(),this.#r.classList.remove("hidden"),ML(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#n={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const r=this.#r.children;if(!this.#t){this.#t=Array.from(r);const c=this.#M.bind(this),d=this.#T.bind(this),p=this._uiManager._signal;for(const u of this.#t){const h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",c,{signal:p}),u.addEventListener("blur",d,{signal:p}),u.addEventListener("focus",this.#P.bind(this,h),{signal:p}),pr._l10nPromise.get(`pdfjs-editor-resizer-label-${h}`).then(m=>u.setAttribute("aria-label",m))}}const n=this.#t[0];let a=0;for(const c of r){if(c===n)break;a++}const l=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(l!==a){if(l<a)for(let d=0;d<a-l;d++)this.#r.append(this.#r.firstChild);else if(l>a)for(let d=0;d<l-a;d++)this.#r.firstChild.before(this.#r.lastChild);let c=0;for(const d of r){const u=this.#t[c++].getAttribute("data-resizer-name");pr._l10nPromise.get(`pdfjs-editor-resizer-label-${u}`).then(h=>d.setAttribute("aria-label",h))}}this.#z(0),this.#u=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#M(t){pr._resizerKeyboardManager.exec(this,t)}#T(t){this.#u&&t.relatedTarget?.parentNode!==this.#r&&this.#D()}#P(t){this.#h=this.#u?t:""}#z(t){if(this.#t)for(const r of this.#t)r.tabIndex=t}_resizeWithKeyboard(t,r){this.#u&&this.#E(this.#h,{movementX:t,movementY:r})}#D(){if(this.#u=!1,this.#z(-1),this.#n){const{savedX:t,savedY:r,savedWidth:n,savedHeight:a}=this.#n;this.#C(t,r,n,a),this.#n=null}}_stopResizingWithKeyboard(){this.#D(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#p){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#p?.show()});return}this.#p?.show()}unselect(){this.#r?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#p?.hide()}updateParams(t,r){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#m}set isEditing(t){this.#m=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,r){this.#s=!0;const n=t/r,{style:a}=this.div;a.aspectRatio=n,a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,r=!1){if(r){this.#v||=new Map;const{action:n}=t;let a=this.#v.get(n);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),this.#v.delete(n),this.#v.size===0&&(this.#v=null)},pr._telemetryTimeout),this.#v.set(n,a);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#i=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#i=!0}renderAnnotationElement(t){let r=t.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),t.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(t){const{firstChild:r}=t.container;r.nodeName==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}}class AOt extends pr{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const gme=3285377520,Pd=4294901760,Bu=65535;class Oze{constructor(t){this.h1=t?t&4294967295:gme,this.h2=t?t&4294967295:gme}update(t){let r,n;if(typeof t=="string"){r=new Uint8Array(t.length*2),n=0;for(let b=0,w=t.length;b<w;b++){const v=t.charCodeAt(b);v<=255?r[n++]=v:(r[n++]=v>>>8,r[n++]=v&255)}}else if(ArrayBuffer.isView(t))r=t.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=n>>2,l=n-a*4,c=new Uint32Array(r.buffer,0,a);let d=0,p=0,u=this.h1,h=this.h2;const m=3432918353,f=461845907,x=m&Bu,y=f&Bu;for(let b=0;b<a;b++)b&1?(d=c[b],d=d*m&Pd|d*x&Bu,d=d<<15|d>>>17,d=d*f&Pd|d*y&Bu,u^=d,u=u<<13|u>>>19,u=u*5+3864292196):(p=c[b],p=p*m&Pd|p*x&Bu,p=p<<15|p>>>17,p=p*f&Pd|p*y&Bu,h^=p,h=h<<13|h>>>19,h=h*5+3864292196);switch(d=0,l){case 3:d^=r[a*4+2]<<16;case 2:d^=r[a*4+1]<<8;case 1:d^=r[a*4],d=d*m&Pd|d*x&Bu,d=d<<15|d>>>17,d=d*f&Pd|d*y&Bu,a&1?u^=d:h^=d}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,r=this.h2;return t^=r>>>1,t=t*3981806797&Pd|t*36045&Bu,r=r*4283543511&Pd|((r<<16|t>>>16)*2950163797&Pd)>>>16,t^=r>>>1,t=t*444984403&Pd|t*60499&Bu,r=r*3301882366&Pd|((r<<16|t>>>16)*3120437893&Pd)>>>16,t^=r>>>1,(t>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const AY=Object.freeze({map:null,hash:"",transfer:void 0});class SX{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,r){const n=this.#t.get(t);return n===void 0?r:Object.assign(r,n)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const r of this.#t.values())if(r instanceof pr)return;this.onAnnotationEditor(null)}}setValue(t,r){const n=this.#t.get(t);let a=!1;if(n!==void 0)for(const[l,c]of Object.entries(r))n[l]!==c&&(a=!0,n[l]=c);else a=!0,this.#t.set(t,r);a&&this.#o(),r instanceof pr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?fX(this.#t):null}setAll(t){for(const[r,n]of Object.entries(t))this.setValue(r,n)}get size(){return this.#t.size}#o(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Nze(this)}get serializable(){if(this.#t.size===0)return AY;const t=new Map,r=new Oze,n=[],a=Object.create(null);let l=!1;for(const[c,d]of this.#t){const p=d instanceof pr?d.serialize(!1,a):d;p&&(t.set(c,p),r.update(`${c}:${JSON.stringify(p)}`),l||=!!p.bitmap)}if(l)for(const c of t.values())c.bitmap&&n.push(c.bitmap);return t.size>0?{map:t,hash:r.hexdigest(),transfer:n}:AY}get editorStats(){let t=null;const r=new Map;for(const n of this.#t.values()){if(!(n instanceof pr))continue;const a=n.telemetryFinalData;if(!a)continue;const{type:l}=a;r.has(l)||r.set(l,Object.getPrototypeOf(n).constructor),t||=Object.create(null);const c=t[l]||=new Map;for(const[d,p]of Object.entries(a)){if(d==="type")continue;let u=c.get(d);u||(u=new Map,c.set(d,u));const h=u.get(p)??0;u.set(p,h+1)}}for(const[n,a]of r)t[n]=a.computeTelemetryFinalData(t[n]);return t}}class Nze extends SX{#e;constructor(t){super();const{map:r,hash:n,transfer:a}=t.serializable,l=structuredClone(r,a?{transfer:a}:null);this.#e={map:l,hash:n,transfer:a}}get print(){Gi("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}class $Ot{#e=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:r=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const r=this.styleElement.sheet;r.insertRule(t,r.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:r}){if(!(!t||this.#e.has(t.loadedName))){if(Ua(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:a,style:l}=t,c=new FontFace(n,a,l);this.addNativeFontFace(c);try{await c.load(),this.#e.add(n),r?.(t)}catch{Fr(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(c)}return}Gi("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(a){throw Fr(`Failed to load font '${n.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const r=t.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const a=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return pi(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(ll||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),pi(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function r(){for(Ua(!a.done,"completeRequest() cannot be called twice."),a.done=!0;n.length>0&&n[0].done;){const l=n.shift();setTimeout(l.callback,0)}}const{loadingRequests:n}=this,a={done:!1,complete:r,callback:t};return n.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return pi(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,r){function n(E,I){return E.charCodeAt(I)<<24|E.charCodeAt(I+1)<<16|E.charCodeAt(I+2)<<8|E.charCodeAt(I+3)&255}function a(E,I,L,B){const D=E.substring(0,I),M=E.substring(I+L);return D+B+M}let l,c;const d=this._document.createElement("canvas");d.width=1,d.height=1;const p=d.getContext("2d");let u=0;function h(E,I){if(++u>30){Fr("Load test font never loaded."),I();return}if(p.font="30px "+E,p.fillText(".",0,20),p.getImageData(0,0,1,1).data[3]>0){I();return}setTimeout(h.bind(null,E,I))}const m=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=a(f,976,m.length,m);const y=16,b=1482184792;let w=n(f,y);for(l=0,c=m.length-3;l<c;l+=4)w=w-b+n(m,l)|0;l<m.length&&(w=w-b+n(m+"XXX",l)|0),f=a(f,y,4,sOt(w));const v=`url(data:font/opentype;base64,${btoa(f)});`,A=`@font-face {font-family:"${m}";src:${v}}`;this.insertRule(A);const S=this._document.createElement("div");S.style.visibility="hidden",S.style.width=S.style.height="10px",S.style.position="absolute",S.style.top=S.style.left="0px";for(const E of[t.loadedName,m]){const I=this._document.createElement("span");I.textContent="Hi",I.style.fontFamily=E,S.append(I)}this._document.body.append(S),h(m,()=>{S.remove(),r.complete()})}}class kOt{constructor(t,{disableFontFace:r=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.disableFontFace=r===!0,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=Pze(this.data),r=`url(data:${this.mimetype};base64,${btoa(t)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${r}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${r}}`}return this._inspectFont?.(this,r),n}getPathGenerator(t,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];let n;try{n=t.get(this.loadedName+"_path_"+r)}catch(l){Fr(`getPathGenerator - ignoring character: "${l}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[r]=function(l,c){};const a=[];for(let l=0,c=n.length;l<c;)switch(n[l++]){case f0.BEZIER_CURVE_TO:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.bezierCurveTo(d,p,u,h,m,f)),l+=6}break;case f0.MOVE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.moveTo(d,p)),l+=2}break;case f0.LINE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.lineTo(d,p)),l+=2}break;case f0.QUADRATIC_CURVE_TO:{const[d,p,u,h]=n.slice(l,l+4);a.push(m=>m.quadraticCurveTo(d,p,u,h)),l+=4}break;case f0.RESTORE:a.push(d=>d.restore());break;case f0.SAVE:a.push(d=>d.save());break;case f0.SCALE:Ua(a.length===2,"Scale command is only valid at the third position.");break;case f0.TRANSFORM:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.transform(d,p,u,h,m,f)),l+=6}break;case f0.TRANSLATE:{const[d,p]=n.slice(l,l+2);a.push(u=>u.translate(d,p)),l+=2}break}return this.compiledGlyphs[r]=function(c,d){a[0](c),a[1](c),c.scale(d,-d);for(let p=2,u=a.length;p<u;p++)a[p](c)}}}if(ll){var $Y=Promise.withResolvers(),kY=null;(async()=>{const t=await Xf(()=>import("./empty-BkjD_QtG.js").then(d=>d.e),__vite__mapDeps([0,1,2])),r=await Xf(()=>import("./index-QXFSNsr1.js").then(d=>d.i),__vite__mapDeps([3,1,4,5,6,7,8,9])),n=await Xf(()=>import("./index-CGmQ25w1.js").then(d=>d.i),__vite__mapDeps([10,1,11,4,5,6,7,8,9])),a=await Xf(()=>import("./url-DGfuvT_J.js").then(d=>d.u),__vite__mapDeps([12,1,9,7,5,6,8]));let l,c;return new Map(Object.entries({fs:t,http:r,https:n,url:a,canvas:l,path2d:c}))})().then(t=>{kY=t,$Y.resolve()},t=>{Fr(`loadPackages: ${t}`),kY=new Map,$Y.resolve()})}class Dh{static get promise(){return $Y.promise}static get(t){return kY?.get(t)}}const Hze=function(e){return Dh.get("fs").promises.readFile(e).then(r=>new Uint8Array(r))};class SOt extends BM{}class EOt extends PM{_createCanvas(t,r){return Dh.get("canvas").createCanvas(t,r)}}class LOt extends DM{_fetchData(t,r){return Hze(t).then(n=>({cMapData:n,compressionType:r}))}}class IOt extends TM{_fetchData(t){return Hze(t)}}const Tl={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function SY(e,t){if(!t)return;const r=t[2]-t[0],n=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],r,n),e.clip(a)}class gC{constructor(){this.constructor===gC&&Gi("Cannot initialize BaseShadingPattern.")}getPattern(){Gi("Abstract method `getPattern` called.")}}class jOt extends gC{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let r;this._type==="axial"?r=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(t,r,n,a){let l;if(a===Tl.STROKE||a===Tl.FILL){const c=r.current.getClippedPathBoundingBox(a,Pn(t))||[0,0,0,0],d=Math.ceil(c[2]-c[0])||1,p=Math.ceil(c[3]-c[1])||1,u=r.cachedCanvases.getCanvas("pattern",d,p,!0),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-c[0],-c[1]),n=jo.transform(n,[1,0,0,1,c[0],c[1]]),h.transform(...r.baseTransform),this.matrix&&h.transform(...this.matrix),SY(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),l=t.createPattern(u.canvas,"no-repeat");const m=new DOMMatrix(n);l.setTransform(m)}else SY(t,this._bbox),l=this._createGradient(t);return l}}function r_(e,t,r,n,a,l,c,d){const p=t.coords,u=t.colors,h=e.data,m=e.width*4;let f;p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f),p[n+1]>p[a+1]&&(f=n,n=a,a=f,f=c,c=d,d=f),p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f);const x=(p[r]+t.offsetX)*t.scaleX,y=(p[r+1]+t.offsetY)*t.scaleY,b=(p[n]+t.offsetX)*t.scaleX,w=(p[n+1]+t.offsetY)*t.scaleY,v=(p[a]+t.offsetX)*t.scaleX,A=(p[a+1]+t.offsetY)*t.scaleY;if(y>=A)return;const S=u[l],E=u[l+1],I=u[l+2],L=u[c],B=u[c+1],D=u[c+2],M=u[d],T=u[d+1],R=u[d+2],N=Math.round(y),K=Math.round(A);let q,F,_,V,O,z,H,X;for(let Y=N;Y<=K;Y++){if(Y<w){const xe=Y<y?0:(y-Y)/(y-w);q=x-(x-b)*xe,F=S-(S-L)*xe,_=E-(E-B)*xe,V=I-(I-D)*xe}else{let xe;Y>A?xe=1:w===A?xe=0:xe=(w-Y)/(w-A),q=b-(b-v)*xe,F=L-(L-M)*xe,_=B-(B-T)*xe,V=D-(D-R)*xe}let G;Y<y?G=0:Y>A?G=1:G=(y-Y)/(y-A),O=x-(x-v)*G,z=S-(S-M)*G,H=E-(E-T)*G,X=I-(I-R)*G;const ee=Math.round(Math.min(q,O)),J=Math.round(Math.max(q,O));let ne=m*Y+ee*4;for(let xe=ee;xe<=J;xe++)G=(q-xe)/(q-O),G<0?G=0:G>1&&(G=1),h[ne++]=F-(F-z)*G|0,h[ne++]=_-(_-H)*G|0,h[ne++]=V-(V-X)*G|0,h[ne++]=255}}function MOt(e,t,r){const n=t.coords,a=t.colors;let l,c;switch(t.type){case"lattice":const d=t.verticesPerRow,p=Math.floor(n.length/d)-1,u=d-1;for(l=0;l<p;l++){let h=l*d;for(let m=0;m<u;m++,h++)r_(e,r,n[h],n[h+1],n[h+d],a[h],a[h+1],a[h+d]),r_(e,r,n[h+d+1],n[h+1],n[h+d],a[h+d+1],a[h+1],a[h+d])}break;case"triangles":for(l=0,c=n.length;l<c;l+=3)r_(e,r,n[l],n[l+1],n[l+2],a[l],a[l+1],a[l+2]);break;default:throw new Error("illegal figure")}}class BOt extends gC{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,r,n){const d=Math.floor(this._bounds[0]),p=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-d,h=Math.ceil(this._bounds[3])-p,m=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),x=u/m,y=h/f,b={coords:this._coords,colors:this._colors,offsetX:-d,offsetY:-p,scaleX:1/x,scaleY:1/y},w=m+4,v=f+4,A=n.getCanvas("mesh",w,v,!1),S=A.context,E=S.createImageData(m,f);if(r){const L=E.data;for(let B=0,D=L.length;B<D;B+=4)L[B]=r[0],L[B+1]=r[1],L[B+2]=r[2],L[B+3]=255}for(const L of this._figures)MOt(E,L,b);return S.putImageData(E,2,2),{canvas:A.canvas,offsetX:d-2*x,offsetY:p-2*y,scaleX:x,scaleY:y}}getPattern(t,r,n,a){SY(t,this._bbox);let l;if(a===Tl.SHADING)l=jo.singularValueDecompose2dScale(Pn(t));else if(l=jo.singularValueDecompose2dScale(r.baseTransform),this.matrix){const d=jo.singularValueDecompose2dScale(this.matrix);l=[l[0]*d[0],l[1]*d[1]]}const c=this._createMeshCanvas(l,a===Tl.SHADING?null:this._background,r.cachedCanvases);return a!==Tl.SHADING&&(t.setTransform(...r.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(c.offsetX,c.offsetY),t.scale(c.scaleX,c.scaleY),t.createPattern(c.canvas,"no-repeat")}}class POt extends gC{getPattern(){return"hotpink"}}function DOt(e){switch(e[0]){case"RadialAxial":return new jOt(e);case"Mesh":return new BOt(e);case"Dummy":return new POt}throw new Error(`Unknown IR type: ${e[0]}`)}const fme={COLORED:1,UNCOLORED:2};class EX{static MAX_PATTERN_SIZE=3e3;constructor(t,r,n,a,l){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=r,this.ctx=n,this.canvasGraphicsFactory=a,this.baseTransform=l}createPatternCanvas(t){const r=this.operatorList,n=this.bbox,a=this.xstep,l=this.ystep,c=this.paintType,d=this.tilingType,p=this.color,u=this.canvasGraphicsFactory;IM("TilingType: "+d);const h=n[0],m=n[1],f=n[2],x=n[3],y=jo.singularValueDecompose2dScale(this.matrix),b=jo.singularValueDecompose2dScale(this.baseTransform),w=[y[0]*b[0],y[1]*b[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,w[0]),A=this.getSizeAndScale(l,this.ctx.canvas.height,w[1]),S=t.cachedCanvases.getCanvas("pattern",v.size,A.size,!0),E=S.context,I=u.createCanvasGraphics(E);I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,c,p);let L=h,B=m,D=f,M=x;return h<0&&(L=0,D+=Math.abs(h)),m<0&&(B=0,M+=Math.abs(m)),E.translate(-(v.scale*L),-(A.scale*B)),I.transform(v.scale,0,0,A.scale,0,0),E.save(),this.clipBbox(I,L,B,D,M),I.baseTransform=Pn(I.ctx),I.executeOperatorList(r),I.endDrawing(),{canvas:S.canvas,scaleX:v.scale,scaleY:A.scale,offsetX:L,offsetY:B}}getSizeAndScale(t,r,n){t=Math.abs(t);const a=Math.max(EX.MAX_PATTERN_SIZE,r);let l=Math.ceil(t*n);return l>=a?l=a:n=l/t,{scale:n,size:l}}clipBbox(t,r,n,a,l){const c=a-r,d=l-n;t.ctx.rect(r,n,c,d),t.current.updateRectMinMax(Pn(t.ctx),[r,n,a,l]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,r,n){const a=t.ctx,l=t.current;switch(r){case fme.COLORED:const c=this.ctx;a.fillStyle=c.fillStyle,a.strokeStyle=c.strokeStyle,l.fillColor=c.fillStyle,l.strokeColor=c.strokeStyle;break;case fme.UNCOLORED:const d=jo.makeHexColor(n[0],n[1],n[2]);a.fillStyle=d,a.strokeStyle=d,l.fillColor=d,l.strokeColor=d;break;default:throw new aOt(`Unsupported paint type: ${r}`)}}getPattern(t,r,n,a){let l=n;a!==Tl.SHADING&&(l=jo.transform(l,r.baseTransform),this.matrix&&(l=jo.transform(l,this.matrix)));const c=this.createPatternCanvas(r);let d=new DOMMatrix(l);d=d.translate(c.offsetX,c.offsetY),d=d.scale(1/c.scaleX,1/c.scaleY);const p=t.createPattern(c.canvas,"repeat");return p.setTransform(d),p}}function TOt({src:e,srcPos:t=0,dest:r,width:n,height:a,nonBlackColor:l=4294967295,inverseDecode:c=!1}){const d=yc.isLittleEndian?4278190080:255,[p,u]=c?[l,d]:[d,l],h=n>>3,m=n&7,f=e.length;r=new Uint32Array(r.buffer);let x=0;for(let y=0;y<a;y++){for(const w=t+h;t<w;t++){const v=t<f?e[t]:255;r[x++]=v&128?u:p,r[x++]=v&64?u:p,r[x++]=v&32?u:p,r[x++]=v&16?u:p,r[x++]=v&8?u:p,r[x++]=v&4?u:p,r[x++]=v&2?u:p,r[x++]=v&1?u:p}if(m===0)continue;const b=t<f?e[t++]:255;for(let w=0;w<m;w++)r[x++]=b&1<<7-w?u:p}return{srcPos:t,destPos:x}}const xme=16,yme=100,zOt=15,bme=10,wme=1e3,sc=16;function ROt(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(n,a){t.translate(n,a),this.__originalTranslate(n,a)},e.scale=function(n,a){t.scale(n,a),this.__originalScale(n,a)},e.transform=function(n,a,l,c,d,p){t.transform(n,a,l,c,d,p),this.__originalTransform(n,a,l,c,d,p)},e.setTransform=function(n,a,l,c,d,p){t.setTransform(n,a,l,c,d,p),this.__originalSetTransform(n,a,l,c,d,p)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(n){t.rotate(n),this.__originalRotate(n)},e.clip=function(n){t.clip(n),this.__originalClip(n)},e.moveTo=function(r,n){t.moveTo(r,n),this.__originalMoveTo(r,n)},e.lineTo=function(r,n){t.lineTo(r,n),this.__originalLineTo(r,n)},e.bezierCurveTo=function(r,n,a,l,c,d){t.bezierCurveTo(r,n,a,l,c,d),this.__originalBezierCurveTo(r,n,a,l,c,d)},e.rect=function(r,n,a,l){t.rect(r,n,a,l),this.__originalRect(r,n,a,l)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class FOt{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,r,n){let a;return this.cache[t]!==void 0?(a=this.cache[t],this.canvasFactory.reset(a,r,n)):(a=this.canvasFactory.create(r,n),this.cache[t]=a),a}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const r=this.cache[t];this.canvasFactory.destroy(r),delete this.cache[t]}}}function m$(e,t,r,n,a,l,c,d,p,u){const[h,m,f,x,y,b]=Pn(e);if(m===0&&f===0){const A=c*h+y,S=Math.round(A),E=d*x+b,I=Math.round(E),L=(c+p)*h+y,B=Math.abs(Math.round(L)-S)||1,D=(d+u)*x+b,M=Math.abs(Math.round(D)-I)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(x),S,I),e.drawImage(t,r,n,a,l,0,0,B,M),e.setTransform(h,m,f,x,y,b),[B,M]}if(h===0&&x===0){const A=d*f+y,S=Math.round(A),E=c*m+b,I=Math.round(E),L=(d+u)*f+y,B=Math.abs(Math.round(L)-S)||1,D=(c+p)*m+b,M=Math.abs(Math.round(D)-I)||1;return e.setTransform(0,Math.sign(m),Math.sign(f),0,S,I),e.drawImage(t,r,n,a,l,0,0,M,B),e.setTransform(h,m,f,x,y,b),[M,B]}e.drawImage(t,r,n,a,l,c,d,p,u);const w=Math.hypot(h,m),v=Math.hypot(f,x);return[w*p,v*u]}function OOt(e){const{width:t,height:r}=e;if(t>wme||r>wme)return null;const n=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=t+1;let c=new Uint8Array(l*(r+1)),d,p,u;const h=t+7&-8;let m=new Uint8Array(h*r),f=0;for(const v of e.data){let A=128;for(;A>0;)m[f++]=v&A?0:255,A>>=1}let x=0;for(f=0,m[f]!==0&&(c[0]=1,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[p]=m[f]?2:1,++x),f++;for(m[f]!==0&&(c[p]=2,++x),d=1;d<r;d++){f=d*h,u=d*l,m[f-h]!==m[f]&&(c[u]=m[f]?1:8,++x);let v=(m[f]?4:0)+(m[f-h]?8:0);for(p=1;p<t;p++)v=(v>>2)+(m[f+1]?4:0)+(m[f-h+1]?8:0),a[v]&&(c[u+p]=a[v],++x),f++;if(m[f-h]!==m[f]&&(c[u+p]=m[f]?2:4,++x),x>n)return null}for(f=h*(r-1),u=d*l,m[f]!==0&&(c[u]=8,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[u+p]=m[f]?4:8,++x),f++;if(m[f]!==0&&(c[u+p]=4,++x),x>n)return null;const y=new Int32Array([0,l,-1,0,-l,0,0,0,1]),b=new Path2D;for(d=0;x&&d<=r;d++){let v=d*l;const A=v+t;for(;v<A&&!c[v];)v++;if(v===A)continue;b.moveTo(v%l,d);const S=v;let E=c[v];do{const I=y[E];do v+=I;while(!c[v]);const L=c[v];L!==5&&L!==10?(E=L,c[v]=0):(E=L&51*E>>4,c[v]&=E>>2|E<<2),b.lineTo(v%l,v/l|0),c[v]||--x}while(S!==v);--d}return m=null,c=null,function(v){v.save(),v.scale(1/t,-1/r),v.translate(0,-r),v.fill(b),v.beginPath(),v.restore()}}class vme{constructor(t,r){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Mze,this.textMatrixScale=1,this.fontMatrix=bY,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=Xs.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,r])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,r){this.x=t,this.y=r}updatePathMinMax(t,r,n){[r,n]=jo.applyTransform([r,n],t),this.minX=Math.min(this.minX,r),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,r),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(t,r){const n=jo.applyTransform(r,t),a=jo.applyTransform(r.slice(2),t),l=jo.applyTransform([r[0],r[3]],t),c=jo.applyTransform([r[2],r[1]],t);this.minX=Math.min(this.minX,n[0],a[0],l[0],c[0]),this.minY=Math.min(this.minY,n[1],a[1],l[1],c[1]),this.maxX=Math.max(this.maxX,n[0],a[0],l[0],c[0]),this.maxY=Math.max(this.maxY,n[1],a[1],l[1],c[1])}updateScalingPathMinMax(t,r){jo.scaleMinMax(t,r),this.minX=Math.min(this.minX,r[0]),this.minY=Math.min(this.minY,r[1]),this.maxX=Math.max(this.maxX,r[2]),this.maxY=Math.max(this.maxY,r[3])}updateCurvePathMinMax(t,r,n,a,l,c,d,p,u,h){const m=jo.bezierBoundingBox(r,n,a,l,c,d,p,u,h);h||this.updateRectMinMax(t,m)}getPathBoundingBox(t=Tl.FILL,r=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===Tl.STROKE){r||Gi("Stroke bounding box must include transform.");const a=jo.singularValueDecompose2dScale(r),l=a[0]*this.lineWidth/2,c=a[1]*this.lineWidth/2;n[0]-=l,n[1]-=c,n[2]+=l,n[3]+=c}return n}updateClipFromPath(){const t=jo.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Tl.FILL,r=null){return jo.intersect(this.clipBox,this.getPathBoundingBox(t,r))}}function Cme(e,t){if(typeof ImageData<"u"&&t instanceof ImageData){e.putImageData(t,0,0);return}const r=t.height,n=t.width,a=r%sc,l=(r-a)/sc,c=a===0?l:l+1,d=e.createImageData(n,sc);let p=0,u;const h=t.data,m=d.data;let f,x,y,b;if(t.kind===nE.GRAYSCALE_1BPP){const w=h.byteLength,v=new Uint32Array(m.buffer,0,m.byteLength>>2),A=v.length,S=n+7>>3,E=4294967295,I=yc.isLittleEndian?4278190080:255;for(f=0;f<c;f++){for(y=f<l?sc:a,u=0,x=0;x<y;x++){const L=w-p;let B=0;const D=L>S?n:L*8-7,M=D&-8;let T=0,R=0;for(;B<M;B+=8)R=h[p++],v[u++]=R&128?E:I,v[u++]=R&64?E:I,v[u++]=R&32?E:I,v[u++]=R&16?E:I,v[u++]=R&8?E:I,v[u++]=R&4?E:I,v[u++]=R&2?E:I,v[u++]=R&1?E:I;for(;B<D;B++)T===0&&(R=h[p++],T=128),v[u++]=R&T?E:I,T>>=1}for(;u<A;)v[u++]=0;e.putImageData(d,0,f*sc)}}else if(t.kind===nE.RGBA_32BPP){for(x=0,b=n*sc*4,f=0;f<l;f++)m.set(h.subarray(p,p+b)),p+=b,e.putImageData(d,0,x),x+=sc;f<c&&(b=n*a*4,m.set(h.subarray(p,p+b)),e.putImageData(d,0,x))}else if(t.kind===nE.RGB_24BPP)for(y=sc,b=n*y,f=0;f<c;f++){for(f>=l&&(y=a,b=n*y),u=0,x=b;x--;)m[u++]=h[p++],m[u++]=h[p++],m[u++]=h[p++],m[u++]=255;e.putImageData(d,0,f*sc)}else throw new Error(`bad image kind: ${t.kind}`)}function Ame(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const r=t.height,n=t.width,a=r%sc,l=(r-a)/sc,c=a===0?l:l+1,d=e.createImageData(n,sc);let p=0;const u=t.data,h=d.data;for(let m=0;m<c;m++){const f=m<l?sc:a;({srcPos:p}=TOt({src:u,srcPos:p,dest:h,width:n,height:f,nonBlackColor:0})),e.putImageData(d,0,m*sc)}}function my(e,t){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function g$(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0),!ll){const{filter:t}=e;t!=="none"&&t!==""&&(e.filter="none")}}function $me(e,t){if(t)return!0;const r=jo.singularValueDecompose2dScale(e);r[0]=Math.fround(r[0]),r[1]=Math.fround(r[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*W8.PDF_TO_CSS_UNITS);return r[0]<=n&&r[1]<=n}const NOt=["butt","round","square"],HOt=["miter","round","bevel"],_Ot={},kme={};class d8{constructor(t,r,n,a,l,{optionalContentConfig:c,markedContentStack:d=null},p,u){this.ctx=t,this.current=new vme(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=a,this.filterFactory=l,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=d||[],this.optionalContentConfig=c,this.cachedCanvases=new FOt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=p,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,r=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):r}beginDrawing({transform:t,viewport:r,transparency:n=!1,background:a=null}){const l=this.ctx.canvas.width,c=this.ctx.canvas.height,d=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,l,c),this.ctx.fillStyle=d,n){const p=this.cachedCanvases.getCanvas("transparent",l,c);this.compositeCtx=this.ctx,this.transparentCanvas=p.canvas,this.ctx=p.context,this.ctx.save(),this.ctx.transform(...Pn(this.compositeCtx))}this.ctx.save(),g$(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=Pn(this.ctx)}executeOperatorList(t,r,n,a){const l=t.argsArray,c=t.fnArray;let d=r||0;const p=l.length;if(p===d)return d;const u=p-d>bme&&typeof n=="function",h=u?Date.now()+zOt:0;let m=0;const f=this.commonObjs,x=this.objs;let y;for(;;){if(a!==void 0&&d===a.nextBreakPoint)return a.breakIt(d,n),d;if(y=c[d],y!==J1.dependency)this[y].apply(this,l[d]);else for(const b of l[d]){const w=b.startsWith("g_")?f:x;if(!w.has(b))return w.get(b,n),d}if(d++,d===p)return d;if(u&&++m>bme){if(Date.now()>h)return n(),d;m=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const r of t.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const r=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}}_scaleImage(t,r){const n=t.width,a=t.height;let l=Math.max(Math.hypot(r[0],r[1]),1),c=Math.max(Math.hypot(r[2],r[3]),1),d=n,p=a,u="prescale1",h,m;for(;l>2&&d>1||c>2&&p>1;){let f=d,x=p;l>2&&d>1&&(f=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),l/=d/f),c>2&&p>1&&(x=p>=16384?Math.floor(p/2)-1||1:Math.ceil(p)/2,c/=p/x),h=this.cachedCanvases.getCanvas(u,f,x),m=h.context,m.clearRect(0,0,f,x),m.drawImage(t,0,0,d,p,0,0,f,x),t=h.canvas,d=f,p=x,u=u==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:p}}_createMaskCanvas(t){const r=this.ctx,{width:n,height:a}=t,l=this.current.fillColor,c=this.current.patternFill,d=Pn(r);let p,u,h,m;if((t.bitmap||t.data)&&t.count>1){const D=t.bitmap||t.data.buffer;u=JSON.stringify(c?d:[d.slice(0,4),l]),p=this._cachedBitmapsMap.get(D),p||(p=new Map,this._cachedBitmapsMap.set(D,p));const M=p.get(u);if(M&&!c){const T=Math.round(Math.min(d[0],d[2])+d[4]),R=Math.round(Math.min(d[1],d[3])+d[5]);return{canvas:M,offsetX:T,offsetY:R}}h=M}h||(m=this.cachedCanvases.getCanvas("maskCanvas",n,a),Ame(m.context,t));let f=jo.transform(d,[1/n,0,0,-1/a,0,0]);f=jo.transform(f,[1,0,0,1,0,-a]);const[x,y,b,w]=jo.getAxialAlignedBoundingBox([0,0,n,a],f),v=Math.round(b-x)||1,A=Math.round(w-y)||1,S=this.cachedCanvases.getCanvas("fillCanvas",v,A),E=S.context,I=x,L=y;E.translate(-I,-L),E.transform(...f),h||(h=this._scaleImage(m.canvas,x0(E)),h=h.img,p&&c&&p.set(u,h)),E.imageSmoothingEnabled=$me(Pn(E),t.interpolate),m$(E,h,0,0,h.width,h.height,0,0,n,a),E.globalCompositeOperation="source-in";const B=jo.transform(x0(E),[1,0,0,1,-I,-L]);return E.fillStyle=c?l.getPattern(r,this,B,Tl.FILL):l,E.fillRect(0,0,n,a),p&&!c&&(this.cachedCanvases.delete("fillCanvas"),p.set(u,S.canvas)),{canvas:S.canvas,offsetX:Math.round(I),offsetY:Math.round(L)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=NOt[t]}setLineJoin(t){this.ctx.lineJoin=HOt[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,r){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(t),n.lineDashOffset=r)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[r,n]of t)switch(r){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(n,t,r);this.suspendedCtx=this.ctx,this.ctx=a.context;const l=this.ctx;l.setTransform(...Pn(this.suspendedCtx)),my(this.suspendedCtx,l),ROt(l,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(),my(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,r,n,a){const l=a[0],c=a[1],d=a[2]-l,p=a[3]-c;d===0||p===0||(this.genericComposeSMask(r.context,n,d,p,r.subtype,r.backdrop,r.transferMap,l,c,r.offsetX,r.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,r,n,a,l,c,d,p,u,h,m){let f=t.canvas,x=p-h,y=u-m;if(c){if(x<0||y<0||x+n>f.width||y+a>f.height){const w=this.cachedCanvases.getCanvas("maskExtension",n,a),v=w.context;v.drawImage(f,-x,-y),c.some(A=>A!==0)&&(v.globalCompositeOperation="destination-atop",v.fillStyle=jo.makeHexColor(...c),v.fillRect(0,0,n,a),v.globalCompositeOperation="source-over"),f=w.canvas,x=y=0}else if(c.some(w=>w!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(x,y,n,a),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=jo.makeHexColor(...c),t.fillRect(x,y,n,a),t.restore()}}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),l==="Alpha"&&d?r.filter=this.filterFactory.addAlphaFilter(d):l==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(d));const b=new Path2D;b.rect(p,u,n,a),r.clip(b),r.globalCompositeOperation="destination-in",r.drawImage(f,x,y,n,a,p,u,n,a),r.restore()}save(){this.inSMaskMode?(my(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),my(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,r,n,a,l,c){this.ctx.transform(t,r,n,a,l,c),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,r,n){const a=this.ctx,l=this.current;let c=l.x,d=l.y,p,u;const h=Pn(a),m=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,f=m?n.slice(0):null;for(let x=0,y=0,b=t.length;x<b;x++)switch(t[x]|0){case J1.rectangle:c=r[y++],d=r[y++];const w=r[y++],v=r[y++],A=c+w,S=d+v;a.moveTo(c,d),w===0||v===0?a.lineTo(A,S):(a.lineTo(A,d),a.lineTo(A,S),a.lineTo(c,S)),m||l.updateRectMinMax(h,[c,d,A,S]),a.closePath();break;case J1.moveTo:c=r[y++],d=r[y++],a.moveTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.lineTo:c=r[y++],d=r[y++],a.lineTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.curveTo:p=c,u=d,c=r[y+4],d=r[y+5],a.bezierCurveTo(r[y],r[y+1],r[y+2],r[y+3],c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],r[y+2],r[y+3],c,d,f),y+=6;break;case J1.curveTo2:p=c,u=d,a.bezierCurveTo(c,d,r[y],r[y+1],r[y+2],r[y+3]),l.updateCurvePathMinMax(h,p,u,c,d,r[y],r[y+1],r[y+2],r[y+3],f),c=r[y+2],d=r[y+3],y+=4;break;case J1.curveTo3:p=c,u=d,c=r[y+2],d=r[y+3],a.bezierCurveTo(r[y],r[y+1],c,d,c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],c,d,c,d,f),y+=4;break;case J1.closePath:a.closePath();break}m&&l.updateScalingPathMinMax(h,f),l.setCurrentPoint(c,d)}closePath(){this.ctx.closePath()}stroke(t=!0){const r=this.ctx,n=this.current.strokeColor;r.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&n?.getPattern?(r.save(),r.strokeStyle=n.getPattern(r,this,x0(r),Tl.STROKE),this.rescaleAndStroke(!1),r.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),r.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;let l=!1;a&&(r.save(),r.fillStyle=n.getPattern(r,this,x0(r),Tl.FILL),l=!0);const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(r.fill("evenodd"),this.pendingEOFill=!1):r.fill()),l&&r.restore(),t&&this.consumePath(c)}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=_Ot}eoClip(){this.pendingClip=kme}beginText(){this.current.textMatrix=Mze,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,r=this.ctx;if(t===void 0){r.beginPath();return}r.save(),r.beginPath();for(const n of t)r.setTransform(...n.transform),r.translate(n.x,n.y),n.addToPath(r,n.fontSize);r.restore(),r.clip(),r.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,r){const n=this.commonObjs.get(t),a=this.current;if(!n)throw new Error(`Can't find font for ${t}`);if(a.fontMatrix=n.fontMatrix||bY,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&Fr("Invalid font matrix for font "+t),r<0?(r=-r,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const l=n.loadedName||"sans-serif",c=n.systemFontInfo?.css||`"${l}", ${n.fallbackName}`;let d="normal";n.black?d="900":n.bold&&(d="bold");const p=n.italic?"italic":"normal";let u=r;r<xme?u=xme:r>yme&&(u=yme),this.current.fontSizeScale=r/u,this.ctx.font=`${p} ${d} ${u}px ${c}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,r){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=r}setLeadingMoveText(t,r){this.setLeading(-r),this.moveText(t,r)}setTextMatrix(t,r,n,a,l,c){this.current.textMatrix=[t,r,n,a,l,c],this.current.textMatrixScale=Math.hypot(t,r),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,r,n,a){const l=this.ctx,c=this.current,d=c.font,p=c.textRenderingMode,u=c.fontSize/c.fontSizeScale,h=p&Xs.FILL_STROKE_MASK,m=!!(p&Xs.ADD_TO_PATH_FLAG),f=c.patternFill&&!d.missingFile;let x;(d.disableFontFace||m||f)&&(x=d.getPathGenerator(this.commonObjs,t)),d.disableFontFace||f?(l.save(),l.translate(r,n),l.beginPath(),x(l,u),a&&l.setTransform(...a),(h===Xs.FILL||h===Xs.FILL_STROKE)&&l.fill(),(h===Xs.STROKE||h===Xs.FILL_STROKE)&&l.stroke(),l.restore()):((h===Xs.FILL||h===Xs.FILL_STROKE)&&l.fillText(t,r,n),(h===Xs.STROKE||h===Xs.FILL_STROKE)&&l.strokeText(t,r,n)),m&&(this.pendingTextPaths||=[]).push({transform:Pn(l),x:r,y:n,fontSize:u,addToPath:x})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const r=t.getImageData(0,0,10,10).data;let n=!1;for(let a=3;a<r.length;a+=4)if(r[a]>0&&r[a]<255){n=!0;break}return pi(this,"isFontSubpixelAAEnabled",n)}showText(t){const r=this.current,n=r.font;if(n.isType3Font)return this.showType3Text(t);const a=r.fontSize;if(a===0)return;const l=this.ctx,c=r.fontSizeScale,d=r.charSpacing,p=r.wordSpacing,u=r.fontDirection,h=r.textHScale*u,m=t.length,f=n.vertical,x=f?1:-1,y=n.defaultVMetrics,b=a*r.fontMatrix[0],w=r.textRenderingMode===Xs.FILL&&!n.disableFontFace&&!r.patternFill;l.save(),l.transform(...r.textMatrix),l.translate(r.x,r.y+r.textRise),u>0?l.scale(h,-1):l.scale(h,1);let v;if(r.patternFill){l.save();const L=r.fillColor.getPattern(l,this,x0(l),Tl.FILL);v=Pn(l),l.restore(),l.fillStyle=L}let A=r.lineWidth;const S=r.textMatrixScale;if(S===0||A===0){const L=r.textRenderingMode&Xs.FILL_STROKE_MASK;(L===Xs.STROKE||L===Xs.FILL_STROKE)&&(A=this.getSinglePixelWidth())}else A/=S;if(c!==1&&(l.scale(c,c),A/=c),l.lineWidth=A,n.isInvalidPDFjsFont){const L=[];let B=0;for(const D of t)L.push(D.unicode),B+=D.width;l.fillText(L.join(""),0,0),r.x+=B*b*h,l.restore(),this.compose();return}let E=0,I;for(I=0;I<m;++I){const L=t[I];if(typeof L=="number"){E+=x*L*a/1e3;continue}let B=!1;const D=(L.isSpace?p:0)+d,M=L.fontChar,T=L.accent;let R,N,K=L.width;if(f){const F=L.vmetric||y,_=-(L.vmetric?F[1]:K*.5)*b,V=F[2]*b;K=F?-F[0]:K,R=_/c,N=(E+V)/c}else R=E/c,N=0;if(n.remeasure&&K>0){const F=l.measureText(M).width*1e3/a*c;if(K<F&&this.isFontSubpixelAAEnabled){const _=K/F;B=!0,l.save(),l.scale(_,1),R/=_}else K!==F&&(R+=(K-F)/2e3*a/c)}if(this.contentVisible&&(L.isInFont||n.missingFile)){if(w&&!T)l.fillText(M,R,N);else if(this.paintChar(M,R,N,v),T){const F=R+a*T.offset.x/c,_=N-a*T.offset.y/c;this.paintChar(T.fontChar,F,_,v)}}const q=f?K*b-D*u:K*b+D*u;E+=q,B&&l.restore()}f?r.y-=E:r.x+=E*h,l.restore(),this.compose()}showType3Text(t){const r=this.ctx,n=this.current,a=n.font,l=n.fontSize,c=n.fontDirection,d=a.vertical?1:-1,p=n.charSpacing,u=n.wordSpacing,h=n.textHScale*c,m=n.fontMatrix||bY,f=t.length,x=n.textRenderingMode===Xs.INVISIBLE;let y,b,w,v;if(!(x||l===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),r.transform(...n.textMatrix),r.translate(n.x,n.y),r.scale(h,c),y=0;y<f;++y){if(b=t[y],typeof b=="number"){v=d*b*l/1e3,this.ctx.translate(v,0),n.x+=v*h;continue}const A=(b.isSpace?u:0)+p,S=a.charProcOperatorList[b.operatorListId];if(!S){Fr(`Type3 character "${b.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=b,this.save(),r.scale(l,l),r.transform(...m),this.executeOperatorList(S),this.restore()),w=jo.applyTransform([b.width,0],m)[0]*l+A,r.translate(w,0),n.x+=w*h}r.restore(),this.processingType3=null}}setCharWidth(t,r){}setCharWidthAndBounds(t,r,n,a,l,c){this.ctx.rect(n,a,l-n,c-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let r;if(t[0]==="TilingPattern"){const n=t[1],a=this.baseTransform||Pn(this.ctx),l={createCanvasGraphics:c=>new d8(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};r=new EX(t,n,this.ctx,l,a)}else r=this._getPattern(t[1],t[2]);return r}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,r=null){let n;return this.cachedPatterns.has(t)?n=this.cachedPatterns.get(t):(n=DOt(this.getObject(t)),this.cachedPatterns.set(t,n)),r&&(n.matrix=r),n}shadingFill(t){if(!this.contentVisible)return;const r=this.ctx;this.save();const n=this._getPattern(t);r.fillStyle=n.getPattern(r,this,x0(r),Tl.SHADING);const a=x0(r);if(a){const{width:l,height:c}=r.canvas,[d,p,u,h]=jo.getAxialAlignedBoundingBox([0,0,l,c],a);this.ctx.fillRect(d,p,u-d,h-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Gi("Should not call beginInlineImage")}beginImageData(){Gi("Should not call beginImageData")}paintFormXObjectBegin(t,r){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Pn(this.ctx),r)){const n=r[2]-r[0],a=r[3]-r[1];this.ctx.rect(r[0],r[1],n,a),this.current.updateRectMinMax(Pn(this.ctx),r),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;t.isolated||IM("TODO: Support non-isolated groups."),t.knockout&&Fr("Knockout groups not supported.");const n=Pn(r);if(t.matrix&&r.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=jo.getAxialAlignedBoundingBox(t.bbox,Pn(r));const l=[0,0,r.canvas.width,r.canvas.height];a=jo.intersect(a,l)||[0,0,0,0];const c=Math.floor(a[0]),d=Math.floor(a[1]),p=Math.max(Math.ceil(a[2])-c,1),u=Math.max(Math.ceil(a[3])-d,1);this.current.startNewPathAndClipBox([0,0,p,u]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(h,p,u),f=m.context;f.translate(-c,-d),f.transform(...n),t.smask?this.smaskStack.push({canvas:m.canvas,context:f,offsetX:c,offsetY:d,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(r.setTransform(1,0,0,1,0,0),r.translate(c,d),r.save()),my(r,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=Pn(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const l=jo.getAxialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],a);this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(t,r,n,a,l){if(this.#e(),g$(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const c=r[2]-r[0],d=r[3]-r[1];if(l&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=c,r[3]=d;const[p,u]=jo.singularValueDecompose2dScale(Pn(this.ctx)),{viewportScale:h}=this,m=Math.ceil(c*this.outputScaleX*h),f=Math.ceil(d*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(m,f);const{canvas:x,context:y}=this.annotationCanvas;this.annotationCanvasMap.set(t,x),this.annotationCanvas.savedCtx=this.ctx,this.ctx=y,this.ctx.save(),this.ctx.setTransform(p,0,0,-u,0,d*u),g$(this.ctx)}else g$(this.ctx),this.ctx.rect(r[0],r[1],c,d),this.ctx.clip(),this.endPath()}this.current=new vme(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const r=t.count;t=this.getObject(t.data,t),t.count=r;const n=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=OOt(t)),a.compiled)){a.compiled(n);return}const l=this._createMaskCanvas(t),c=l.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(c,l.offsetX,l.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,r,n=0,a=0,l,c){if(!this.contentVisible)return;t=this.getObject(t.data,t);const d=this.ctx;d.save();const p=Pn(d);d.transform(r,n,a,l,0,0);const u=this._createMaskCanvas(t);d.setTransform(1,0,0,1,u.offsetX-p[4],u.offsetY-p[5]);for(let h=0,m=c.length;h<m;h+=2){const f=jo.transform(p,[r,n,a,l,c[h],c[h+1]]),[x,y]=jo.applyTransform([0,0],f);d.drawImage(u.canvas,x,y)}d.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;for(const l of t){const{data:c,width:d,height:p,transform:u}=l,h=this.cachedCanvases.getCanvas("maskCanvas",d,p),m=h.context;m.save();const f=this.getObject(c,l);Ame(m,f),m.globalCompositeOperation="source-in",m.fillStyle=a?n.getPattern(m,this,x0(r),Tl.FILL):n,m.fillRect(0,0,d,p),m.restore(),r.save(),r.transform(...u),r.scale(1,-1),m$(r,h.canvas,0,0,d,p,0,-1,1,1),r.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){Fr("Dependent image isn't ready yet");return}this.paintInlineImageXObject(r)}paintImageXObjectRepeat(t,r,n,a){if(!this.contentVisible)return;const l=this.getObject(t);if(!l){Fr("Dependent image isn't ready yet");return}const c=l.width,d=l.height,p=[];for(let u=0,h=a.length;u<h;u+=2)p.push({transform:[r,0,0,n,a[u],a[u+1]],x:0,y:0,w:c,h:d});this.paintInlineImageXObjectGroup(l,p)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:r,width:n,height:a}=t,l=this.cachedCanvases.getCanvas("inlineImage",n,a),c=l.context;return c.filter=this.current.transferMaps,c.drawImage(r,0,0),c.filter="none",l.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const r=t.width,n=t.height,a=this.ctx;if(this.save(),!ll){const{filter:d}=a;d!=="none"&&d!==""&&(a.filter="none")}a.scale(1/r,-1/n);let l;if(t.bitmap)l=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)l=t;else{const p=this.cachedCanvases.getCanvas("inlineImage",r,n).context;Cme(p,t),l=this.applyTransferMapsToCanvas(p)}const c=this._scaleImage(l,x0(a));a.imageSmoothingEnabled=$me(Pn(a),t.interpolate),m$(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-n,r,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,r){if(!this.contentVisible)return;const n=this.ctx;let a;if(t.bitmap)a=t.bitmap;else{const l=t.width,c=t.height,p=this.cachedCanvases.getCanvas("inlineImage",l,c).context;Cme(p,t),a=this.applyTransferMapsToCanvas(p)}for(const l of r)n.save(),n.transform(...l.transform),n.scale(1,-1),m$(n,a,l.x,l.y,l.w,l.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,r){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,r){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(r||(this.pendingClip===kme?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Pn(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const r=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,a)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:r,b:n,c:a,d:l}=this.ctx.getTransform();let c,d;if(n===0&&a===0){const p=Math.abs(r),u=Math.abs(l);if(p===u)if(t===0)c=d=1/p;else{const h=p*t;c=d=h<1?1/h:1}else if(t===0)c=1/p,d=1/u;else{const h=p*t,m=u*t;c=h<1?1/h:1,d=m<1?1/m:1}}else{const p=Math.abs(r*l-n*a),u=Math.hypot(r,n),h=Math.hypot(a,l);if(t===0)c=h/p,d=u/p;else{const m=t*p;c=h>m?h/m:1,d=u>m?u/m:1}}this._cachedScaleForStroking[0]=c,this._cachedScaleForStroking[1]=d}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:r}=this,{lineWidth:n}=this.current,[a,l]=this.getScaleForStroking();if(r.lineWidth=n||1,a===1&&l===1){r.stroke();return}const c=r.getLineDash();if(t&&r.save(),r.scale(a,l),c.length>0){const d=Math.max(a,l);r.setLineDash(c.map(p=>p/d)),r.lineDashOffset/=d}r.stroke(),t&&r.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const e in J1)d8.prototype[e]!==void 0&&(d8.prototype[J1[e]]=d8.prototype[e]);class ov{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");this.#e=t}static get workerSrc(){return this.#t}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");this.#t=t}}const f$={DATA:1,ERROR:2},Ca={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Yc(e){switch(e instanceof Error||typeof e=="object"&&e!==null||Gi('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new l5(e.message);case"MissingPDFException":return new s5(e.message);case"PasswordException":return new vY(e.message,e.code);case"UnexpectedResponseException":return new jM(e.message,e.status);case"UnknownErrorException":return new CY(e.message,e.details);default:return new CY(e.message,e.toString())}}class vb{constructor(t,r,n){this.sourceName=t,this.targetName=r,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=a=>{const l=a.data;if(l.targetName!==this.sourceName)return;if(l.stream){this.#t(l);return}if(l.callback){const d=l.callbackId,p=this.callbackCapabilities[d];if(!p)throw new Error(`Cannot resolve callback ${d}`);if(delete this.callbackCapabilities[d],l.callback===f$.DATA)p.resolve(l.data);else if(l.callback===f$.ERROR)p.reject(Yc(l.reason));else throw new Error("Unexpected callback case");return}const c=this.actionHandler[l.action];if(!c)throw new Error(`Unknown action from worker: ${l.action}`);if(l.callbackId){const d=this.sourceName,p=l.sourceName;new Promise(function(u){u(c(l.data))}).then(function(u){n.postMessage({sourceName:d,targetName:p,callback:f$.DATA,callbackId:l.callbackId,data:u})},function(u){n.postMessage({sourceName:d,targetName:p,callback:f$.ERROR,callbackId:l.callbackId,reason:Yc(u)})});return}if(l.streamId){this.#e(l);return}c(l.data)},n.addEventListener("message",this._onComObjOnMessage)}on(t,r){const n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=r}send(t,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:r},n)}sendWithPromise(t,r,n){const a=this.callbackId++,l=Promise.withResolvers();this.callbackCapabilities[a]=l;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:r},n)}catch(c){l.reject(c)}return l.promise}sendWithStream(t,r,n,a){const l=this.streamId++,c=this.sourceName,d=this.targetName,p=this.comObj;return new ReadableStream({start:u=>{const h=Promise.withResolvers();return this.streamControllers[l]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},p.postMessage({sourceName:c,targetName:d,action:t,streamId:l,data:r,desiredSize:u.desiredSize},a),h.promise},pull:u=>{const h=Promise.withResolvers();return this.streamControllers[l].pullCall=h,p.postMessage({sourceName:c,targetName:d,stream:Ca.PULL,streamId:l,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Ua(u instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[l].cancelCall=h,this.streamControllers[l].isClosed=!0,p.postMessage({sourceName:c,targetName:d,stream:Ca.CANCEL,streamId:l,reason:Yc(u)}),h.promise}},n)}#e(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this,d=this.actionHandler[t.action],p={enqueue(u,h=1,m){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),l.postMessage({sourceName:n,targetName:a,stream:Ca.ENQUEUE,streamId:r,chunk:u},m)},close(){this.isCancelled||(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.CLOSE,streamId:r}),delete c.streamSinks[r])},error(u){Ua(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.ERROR,streamId:r,reason:Yc(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};p.sinkCapability.resolve(),p.ready=p.sinkCapability.promise,this.streamSinks[r]=p,new Promise(function(u){u(d(t.data,p))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,success:!0})},function(u){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,reason:Yc(u)})})}#t(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this.streamControllers[r],d=this.streamSinks[r];switch(t.stream){case Ca.START_COMPLETE:t.success?c.startCall.resolve():c.startCall.reject(Yc(t.reason));break;case Ca.PULL_COMPLETE:t.success?c.pullCall.resolve():c.pullCall.reject(Yc(t.reason));break;case Ca.PULL:if(!d){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0});break}d.desiredSize<=0&&t.desiredSize>0&&d.sinkCapability.resolve(),d.desiredSize=t.desiredSize,new Promise(function(p){p(d.onPull?.())}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,reason:Yc(p)})});break;case Ca.ENQUEUE:if(Ua(c,"enqueue should have stream controller"),c.isClosed)break;c.controller.enqueue(t.chunk);break;case Ca.CLOSE:if(Ua(c,"close should have stream controller"),c.isClosed)break;c.isClosed=!0,c.controller.close(),this.#o(c,r);break;case Ca.ERROR:Ua(c,"error should have stream controller"),c.controller.error(Yc(t.reason)),this.#o(c,r);break;case Ca.CANCEL_COMPLETE:t.success?c.cancelCall.resolve():c.cancelCall.reject(Yc(t.reason)),this.#o(c,r);break;case Ca.CANCEL:if(!d)break;new Promise(function(p){p(d.onCancel?.(Yc(t.reason)))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,reason:Yc(p)})}),d.sinkCapability.reject(Yc(t.reason)),d.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}async#o(t,r){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[r]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class VOt{#e;#t;constructor({parsedData:t,rawData:r}){this.#e=t,this.#t=r}getRaw(){return this.#t}get(t){return this.#e.get(t)??null}getAll(){return fX(this.#e)}has(t){return this.#e.has(t)}}const Sm=Symbol("INTERNAL");class QOt{#e=!1;#t=!1;#o=!1;#i=!0;constructor(t,{name:r,intent:n,usage:a}){this.#e=!!(t&Od.DISPLAY),this.#t=!!(t&Od.PRINT),this.name=r,this.intent=n,this.usage=a}get visible(){if(this.#o)return this.#i;if(!this.#i)return!1;const{print:t,view:r}=this.usage;return this.#e?r?.viewState!=="OFF":this.#t?t?.printState!=="OFF":!0}_setVisible(t,r,n=!1){t!==Sm&&Gi("Internal method `_setVisible` called."),this.#o=n,this.#i=r}}class UOt{#e=null;#t=new Map;#o=null;#i=null;constructor(t,r=Od.DISPLAY){if(this.renderingIntent=r,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#i=t.order;for(const n of t.groups)this.#t.set(n.id,new QOt(r,n));if(t.baseState==="OFF")for(const n of this.#t.values())n._setVisible(Sm,!1);for(const n of t.on)this.#t.get(n)._setVisible(Sm,!0);for(const n of t.off)this.#t.get(n)._setVisible(Sm,!1);this.#o=this.getHash()}}#s(t){const r=t.length;if(r<2)return!0;const n=t[0];for(let a=1;a<r;a++){const l=t[a];let c;if(Array.isArray(l))c=this.#s(l);else if(this.#t.has(l))c=this.#t.get(l).visible;else return Fr(`Optional content group not found: ${l}`),!0;switch(n){case"And":if(!c)return!1;break;case"Or":if(c)return!0;break;case"Not":return!c;default:return!0}}return n==="And"}isVisible(t){if(this.#t.size===0)return!0;if(!t)return IM("Optional content group not defined."),!0;if(t.type==="OCG")return this.#t.has(t.id)?this.#t.get(t.id).visible:(Fr(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#s(t.expression);if(!t.policy||t.policy==="AnyOn"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!1}return!0}return Fr(`Unknown optional content policy ${t.policy}.`),!0}return Fr(`Unknown group type ${t.type}.`),!0}setVisibility(t,r=!0){const n=this.#t.get(t);if(!n){Fr(`Optional content group not found: ${t}`);return}n._setVisible(Sm,!!r,!0),this.#e=null}setOCGState({state:t,preserveRB:r}){let n;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":n=a;continue}const l=this.#t.get(a);if(l)switch(n){case"ON":l._setVisible(Sm,!0);break;case"OFF":l._setVisible(Sm,!1);break;case"Toggle":l._setVisible(Sm,!l.visible);break}}this.#e=null}get hasInitialVisibility(){return this.#o===null||this.getHash()===this.#o}getOrder(){return this.#t.size?this.#i?this.#i.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?fX(this.#t):null}getGroup(t){return this.#t.get(t)||null}getHash(){if(this.#e!==null)return this.#e;const t=new Oze;for(const[r,n]of this.#t)t.update(`${r}:${n.visible}`);return this.#e=t.hexdigest()}}class WOt{constructor(t,{disableRange:r=!1,disableStream:n=!1}){Ua(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:l,progressiveDone:c,contentDispositionFilename:d}=t;if(this._queuedChunks=[],this._progressiveDone=c,this._contentDispositionFilename=d,l?.length>0){const p=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;this._queuedChunks.push(p)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((p,u)=>{this._onReceiveData({begin:p,chunk:u})}),t.addProgressListener((p,u)=>{this._onProgress({loaded:p,total:u})}),t.addProgressiveReadListener(p=>{this._onReceiveData({chunk:p})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const a=this._rangeReaders.some(function(l){return l._begin!==t?!1:(l._enqueue(n),!0)});Ua(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){t.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const r=this._rangeReaders.indexOf(t);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){Ua(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new GOt(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new YOt(this,t,r);return this._pdfDataRangeTransport.requestDataRange(t,r),this._rangeReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeReaders.slice(0))r.cancel(t);this._pdfDataRangeTransport.abort()}}class GOt{constructor(t,r,n=!1,a=null){this._stream=t,this._done=n||!1,this._filename=vX(a)?a:null,this._queuedChunks=r||[],this._loaded=0;for(const l of this._queuedChunks)this._loaded+=l.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class YOt{constructor(t,r,n){this._stream=t,this._begin=r,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const n of this._requests)n.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 r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function KOt(e){let t=!0,r=n("filename\\*","i").exec(e);if(r){r=r[1];let h=d(r);return h=unescape(h),h=p(h),h=u(h),l(h)}if(r=c(e),r){const h=u(r);return l(h)}if(r=n("filename","i").exec(e),r){r=r[1];let h=d(r);return h=u(h),l(h)}function n(h,m){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',m)}function a(h,m){if(h){if(!/^[\x00-\xFF]+$/.test(m))return m;try{const f=new TextDecoder(h,{fatal:!0}),x=MM(m);m=f.decode(x),t=!1}catch{}}return m}function l(h){return t&&/[\x80-\xff]/.test(h)&&(h=a("utf-8",h),t&&(h=a("iso-8859-1",h))),h}function c(h){const m=[];let f;const x=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=x.exec(h))!==null;){let[,b,w,v]=f;if(b=parseInt(b,10),b in m){if(b===0)break;continue}m[b]=[w,v]}const y=[];for(let b=0;b<m.length&&b in m;++b){let[w,v]=m[b];v=d(v),w&&(v=unescape(v),b===0&&(v=p(v))),y.push(v)}return y.join("")}function d(h){if(h.startsWith('"')){const m=h.slice(1).split('\\"');for(let f=0;f<m.length;++f){const x=m[f].indexOf('"');x!==-1&&(m[f]=m[f].slice(0,x),m.length=f+1),m[f]=m[f].replaceAll(/\\(.)/g,"$1")}h=m.join('"')}return h}function p(h){const m=h.indexOf("'");if(m===-1)return h;const f=h.slice(0,m),y=h.slice(m+1).replace(/^[^']*'/,"");return a(f,y)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(m,f,x,y){if(x==="q"||x==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,w){return String.fromCharCode(parseInt(w,16))}),a(f,y);try{y=atob(y)}catch{}return a(f,y)})}return""}function LX({getResponseHeader:e,isHttp:t,rangeChunkSize:r,disableRange:n}){const a={allowRangeRequests:!1,suggestedLength:void 0},l=parseInt(e("Content-Length"),10);return!Number.isInteger(l)||(a.suggestedLength=l,l<=2*r)||n||!t||e("Accept-Ranges")!=="bytes"||(e("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function IX(e){const t=e("Content-Disposition");if(t){let r=KOt(t);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if(vX(r))return r}return null}function RM(e,t){return e===404||e===0&&t.startsWith("file:")?new s5('Missing PDF "'+t+'".'):new jM(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function _ze(e){return e===200||e===206}function Vze(e,t,r){return{method:"GET",headers:e,signal:r.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Qze(e){const t=new Headers;for(const r in e){const n=e[r];n!==void 0&&t.append(r,n)}return t}function Uze(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Fr(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Sme{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Ua(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new qOt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new ZOt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class qOt{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const r=t.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._headers=Qze(this._stream.httpHeaders);const n=r.url;fetch(n,Vze(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!_ze(a.status))throw RM(a.status,n);this._reader=a.body.getReader(),this._headersCapability.resolve();const l=p=>a.headers.get(p),{allowRangeRequests:c,suggestedLength:d}=LX({getResponseHeader:l,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=c,this._contentLength=d||this._contentLength,this._filename=IX(l),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new l5("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Uze(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class ZOt{constructor(t,r,n){this._stream=t,this._reader=null,this._loaded=0;const a=t.source;this._withCredentials=a.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController,this._headers=Qze(this._stream.httpHeaders),this._headers.append("Range",`bytes=${r}-${n-1}`);const l=a.url;fetch(l,Vze(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!_ze(c.status))throw RM(c.status,l);this._readCapability.resolve(),this._reader=c.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Uze(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}const i_=200,n_=206;function JOt(e){const t=e.response;return typeof t!="string"?t:MM(t).buffer}class XOt{constructor(t,r={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&r.httpHeaders||Object.create(null),this.withCredentials=r.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,r,n){const a={begin:t,end:r};for(const l in n)a[l]=n[l];return this.request(a)}requestFull(t){return this.request(t)}request(t){const r=new XMLHttpRequest,n=this.currXhrId++,a=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const l in this.httpHeaders){const c=this.httpHeaders[l];c!==void 0&&r.setRequestHeader(l,c)}return this.isHttp&&"begin"in t&&"end"in t?(r.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.expectedStatus=n_):a.expectedStatus=i_,r.responseType="arraybuffer",t.onError&&(r.onerror=function(l){t.onError(r.status)}),r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),a.onHeadersReceived=t.onHeadersReceived,a.onDone=t.onDone,a.onError=t.onError,a.onProgress=t.onProgress,r.send(null),n}onProgress(t,r){const n=this.pendingRequests[t];n&&n.onProgress?.(r)}onStateChange(t,r){const n=this.pendingRequests[t];if(!n)return;const a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),a.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],a.status===0&&this.isHttp){n.onError?.(a.status);return}const l=a.status||i_;if(!(l===i_&&n.expectedStatus===n_)&&l!==n.expectedStatus){n.onError?.(a.status);return}const d=JOt(a);if(l===n_){const p=a.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(p);n.onDone({begin:parseInt(u[1],10),chunk:d})}else d?n.onDone({begin:0,chunk:d}):n.onError?.(a.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const r=this.pendingRequests[t].xhr;delete this.pendingRequests[t],r.abort()}}class eNt{constructor(t){this._source=t,this._manager=new XOt(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const r=this._rangeRequestReaders.indexOf(t);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return Ua(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new tNt(this._manager,this._source),this._fullRequestReader}getRangeReader(t,r){const n=new oNt(this._manager,t,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class tNt{constructor(t,r){this._manager=t;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url,this._fullRequestId=t.requestFull(n),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,r=this._manager.getRequestXhr(t),n=c=>r.getResponseHeader(c),{allowRangeRequests:a,suggestedLength:l}=LX({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=l||this._contentLength,this._filename=IX(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=RM(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class oNt{constructor(t,r,n){this._manager=t;const a={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(r,n,a),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const r=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=RM(t,this._url);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Wze=/^file:\/\/\/[a-zA-Z]:\//;function rNt(e){const t=Dh.get("url"),r=t.parse(e);return r.protocol==="file:"||r.host?r:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(r.host||(r.protocol="file:"),r)}class iNt{constructor(t){this.source=t,this.url=rNt(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Ua(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new sNt(this):new nNt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=this.isFsUrl?new lNt(this,t,r):new aNt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class Gze{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=t.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new l5("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Yze{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const r=t.source;this._isStreamingSupported=!r.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function BL(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class nNt extends Gze{constructor(t){super(t);const r=n=>{if(n.statusCode===404){const d=new s5(`Missing PDF "${this._url}".`);this._storedError=d,this._headersCapability.reject(d);return}this._headersCapability.resolve(),this._setReadableStream(n);const a=d=>this._readableStream.headers[d.toLowerCase()],{allowRangeRequests:l,suggestedLength:c}=LX({getResponseHeader:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=IX(a)};if(this._request=null,this._url.protocol==="http:"){const n=Dh.get("http");this._request=n.request(BL(this._url,t.httpHeaders),r)}else{const n=Dh.get("https");this._request=n.request(BL(this._url,t.httpHeaders),r)}this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class aNt extends Yze{constructor(t,r,n){super(t),this._httpHeaders={};for(const l in t.httpHeaders){const c=t.httpHeaders[l];c!==void 0&&(this._httpHeaders[l]=c)}this._httpHeaders.Range=`bytes=${r}-${n-1}`;const a=l=>{if(l.statusCode===404){const c=new s5(`Missing PDF "${this._url}".`);this._storedError=c;return}this._setReadableStream(l)};if(this._request=null,this._url.protocol==="http:"){const l=Dh.get("http");this._request=l.request(BL(this._url,this._httpHeaders),a)}else{const l=Dh.get("https");this._request=l.request(BL(this._url,this._httpHeaders),a)}this._request.on("error",l=>{this._storedError=l}),this._request.end()}}class sNt extends Gze{constructor(t){super(t);let r=decodeURIComponent(this._url.path);Wze.test(this._url.href)&&(r=r.replace(/^\//,""));const n=Dh.get("fs");n.promises.lstat(r).then(a=>{this._contentLength=a.size,this._setReadableStream(n.createReadStream(r)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=new s5(`Missing PDF "${r}".`)),this._storedError=a,this._headersCapability.reject(a)})}}class lNt extends Yze{constructor(t,r,n){super(t);let a=decodeURIComponent(this._url.path);Wze.test(this._url.href)&&(a=a.replace(/^\//,""));const l=Dh.get("fs");this._setReadableStream(l.createReadStream(a,{start:r,end:n-1}))}}const cNt=1e5,ec=30,dNt=.8;let PL=class Ru{#e=Promise.withResolvers();#t=null;#o=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#n=0;#l=0;#d=null;#p=null;#h=0;#c=0;#a=Object.create(null);#m=[];#f=null;#u=[];#y=new WeakMap;#g=null;static#b=new Map;static#v=new Map;static#A=null;static#k=new Set;constructor({textContentSource:t,container:r,viewport:n}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(p){p.enqueue(t),p.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#p=r,this.#c=n.scale*(globalThis.devicePixelRatio||1),this.#h=n.rotation,this.#r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:l,pageX:c,pageY:d}=n.rawDims;this.#g=[1,0,0,-1,-c,d+l],this.#l=a,this.#n=l,Ru.#x(),R4(r,n),this.#e.promise.catch(()=>{}).then(()=>{Ru.#k.delete(this),this.#r=null,this.#a=null})}render(){const t=()=>{this.#d.read().then(({value:r,done:n})=>{if(n){this.#e.resolve();return}this.#s??=r.lang,Object.assign(this.#a,r.styles),this.#S(r.items),t()},this.#e.reject)};return this.#d=this.#f.getReader(),Ru.#k.add(this),t(),this.#e.promise}update({viewport:t,onBefore:r=null}){const n=t.scale*(globalThis.devicePixelRatio||1),a=t.rotation;if(a!==this.#h&&(r?.(),this.#h=a,R4(this.#p,{rotation:a})),n!==this.#c){r?.(),this.#c=n;const l={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:Ru.#w(this.#s)};for(const c of this.#u)l.properties=this.#y.get(c),l.div=c,this.#$(l)}}cancel(){const t=new l5("TextLayer task cancelled.");this.#d?.cancel(t).catch(()=>{}),this.#d=null,this.#e.reject(t)}get textDivs(){return this.#u}get textContentItemsStr(){return this.#m}#S(t){if(this.#o)return;this.#r.ctx??=Ru.#w(this.#s);const r=this.#u,n=this.#m;for(const a of t){if(r.length>cNt){Fr("Ignoring additional textDivs for performance reasons."),this.#o=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const l=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id!==null&&this.#t.setAttribute("id",`${a.id}`),l.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(a.str),this.#j(a)}}#j(t){const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#u.push(r);const a=jo.transform(this.#g,t.transform);let l=Math.atan2(a[1],a[0]);const c=this.#a[t.fontName];c.vertical&&(l+=Math.PI/2);const d=this.#i&&c.fontSubstitution||c.fontFamily,p=Math.hypot(a[2],a[3]),u=p*Ru.#C(d,this.#s);let h,m;l===0?(h=a[4],m=a[5]-u):(h=a[4]+u*Math.sin(l),m=a[5]-u*Math.cos(l));const f="calc(var(--scale-factor)*",x=r.style;this.#t===this.#p?(x.left=`${(100*h/this.#l).toFixed(2)}%`,x.top=`${(100*m/this.#n).toFixed(2)}%`):(x.left=`${f}${h.toFixed(2)}px)`,x.top=`${f}${m.toFixed(2)}px)`),x.fontSize=`${f}${(Ru.#A*p).toFixed(2)}px)`,x.fontFamily=d,n.fontSize=p,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#i&&(r.dataset.fontName=c.fontSubstitutionLoadedName||t.fontName),l!==0&&(n.angle=l*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const b=Math.abs(t.transform[0]),w=Math.abs(t.transform[3]);b!==w&&Math.max(b,w)/Math.min(b,w)>1.5&&(y=!0)}if(y&&(n.canvasWidth=c.vertical?t.height:t.width),this.#y.set(r,n),this.#r.div=r,this.#r.properties=n,this.#$(this.#r),n.hasText&&this.#t.append(r),n.hasEOL){const b=document.createElement("br");b.setAttribute("role","presentation"),this.#t.append(b)}}#$(t){const{div:r,properties:n,ctx:a,prevFontSize:l,prevFontFamily:c}=t,{style:d}=r;let p="";if(Ru.#A>1&&(p=`scale(${1/Ru.#A})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:u}=d,{canvasWidth:h,fontSize:m}=n;(l!==m||c!==u)&&(a.font=`${m*this.#c}px ${u}`,t.prevFontSize=m,t.prevFontFamily=u);const{width:f}=a.measureText(r.textContent);f>0&&(p=`scaleX(${h*this.#c/f}) ${p}`)}n.angle!==0&&(p=`rotate(${n.angle}deg) ${p}`),p.length>0&&(d.transform=p)}static cleanup(){if(!(this.#k.size>0)){this.#b.clear();for(const{canvas:t}of this.#v.values())t.remove();this.#v.clear()}}static#w(t=null){let r=this.#v.get(t||="");if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(t,r)}return r}static#x(){if(this.#A!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),this.#A=t.getBoundingClientRect().height,t.remove()}static#C(t,r){const n=this.#b.get(t);if(n)return n;const a=this.#w(r),l=a.font;a.canvas.width=a.canvas.height=ec,a.font=`${ec}px ${t}`;const c=a.measureText("");let d=c.fontBoundingBoxAscent,p=Math.abs(c.fontBoundingBoxDescent);if(d){const m=d/(d+p);return this.#b.set(t,m),a.canvas.width=a.canvas.height=0,a.font=l,m}a.strokeStyle="red",a.clearRect(0,0,ec,ec),a.strokeText("g",0,0);let u=a.getImageData(0,0,ec,ec).data;p=0;for(let m=u.length-1-3;m>=0;m-=4)if(u[m]>0){p=Math.ceil(m/4/ec);break}a.clearRect(0,0,ec,ec),a.strokeText("A",0,ec),u=a.getImageData(0,0,ec,ec).data,d=0;for(let m=0,f=u.length;m<f;m+=4)if(u[m]>0){d=ec-Math.floor(m/4/ec);break}a.canvas.width=a.canvas.height=0,a.font=l;const h=d?d/(d+p):dNt;return this.#b.set(t,h),h}};function pNt(){Rze("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:e,container:t,viewport:r,...n}=arguments[0],a=Object.keys(n);a.length>0&&Fr("Ignoring `renderTextLayer` parameters: "+a.join(", "));const l=new PL({textContentSource:e,container:t,viewport:r}),{textDivs:c,textContentItemsStr:d}=l;return{promise:l.render(),textDivs:c,textContentItemsStr:d}}function uNt(){Rze("`updateTextLayer`, please use `TextLayer` instead.")}class rv{static textContent(t){const r=[],n={items:r,styles:Object.create(null)};function a(l){if(!l)return;let c=null;const d=l.name;if(d==="#text")c=l.value;else if(rv.shouldBuildText(d))l?.attributes?.textContent?c=l.attributes.textContent:l.value&&(c=l.value);else return;if(c!==null&&r.push({str:c}),!!l.children)for(const p of l.children)a(p)}return a(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const hNt=65536,mNt=100,gNt=5e3,fNt=ll?EOt:mOt,xNt=ll?LOt:Tze,yNt=ll?SOt:hOt,bNt=ll?IOt:zze;function wNt(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new jX,{docId:r}=t,n=e.url?vNt(e.url):null,a=e.data?CNt(e.data):null,l=e.httpHeaders||null,c=e.withCredentials===!0,d=e.password??null,p=e.range instanceof Kze?e.range:null,u=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:hNt;let h=e.worker instanceof Qd?e.worker:null;const m=e.verbosity,f=typeof e.docBaseUrl=="string"&&!wX(e.docBaseUrl)?e.docBaseUrl:null,x=typeof e.cMapUrl=="string"?e.cMapUrl:null,y=e.cMapPacked!==!1,b=e.CMapReaderFactory||xNt,w=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,v=e.StandardFontDataFactory||bNt,A=e.stopAtErrors!==!0,S=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,E=e.isEvalSupported!==!1,I=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!ll,L=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,B=typeof e.disableFontFace=="boolean"?e.disableFontFace:ll,D=e.fontExtraProperties===!0,M=e.enableXfa===!0,T=e.ownerDocument||globalThis.document,R=e.disableRange===!0,N=e.disableStream===!0,K=e.disableAutoFetch===!0,q=e.pdfBug===!0,F=e.enableHWA===!0,_=p?p.length:e.length??NaN,V=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!ll&&!B,O=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:b===Tze&&v===zze&&x&&w&&wb(x,document.baseURI)&&wb(w,document.baseURI),z=e.canvasFactory||new fNt({ownerDocument:T,enableHWA:F}),H=e.filterFactory||new yNt({docId:r,ownerDocument:T}),X=null;oOt(m);const Y={canvasFactory:z,filterFactory:H};if(O||(Y.cMapReaderFactory=new b({baseUrl:x,isCompressed:y}),Y.standardFontDataFactory=new v({baseUrl:w})),!h){const J={verbosity:m,port:ov.workerPort};h=J.port?Qd.fromPort(J):new Qd(J),t._worker=h}const G={docId:r,apiVersion:"4.4.168",data:a,password:d,disableAutoFetch:K,rangeChunkSize:u,length:_,docBaseUrl:f,enableXfa:M,evaluatorOptions:{maxImageSize:S,disableFontFace:B,ignoreErrors:A,isEvalSupported:E,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:L,fontExtraProperties:D,useSystemFonts:V,cMapUrl:O?x:null,standardFontDataUrl:O?w:null}},ee={disableFontFace:B,fontExtraProperties:D,ownerDocument:T,pdfBug:q,styleElement:X,loadingParams:{disableAutoFetch:K,enableXfa:M}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const J=h.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let ne;if(p)ne=new WOt(p,{disableRange:R,disableStream:N});else if(!a){if(!n)throw new Error("getDocument - no `url` parameter provided.");ne=(ge=>ll?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&wb(ge.url)?new Sme(ge):new iNt(ge):wb(ge.url)?new Sme(ge):new eNt(ge))({url:n,length:_,httpHeaders:l,withCredentials:c,rangeChunkSize:u,disableRange:R,disableStream:N})}return J.then(xe=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const ge=new vb(r,xe,h.port),ce=new SNt(ge,t,ne,ee,Y);t._transport=ce,ge.send("Ready",null)})}).catch(t._capability.reject),t}function vNt(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(ll&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function CNt(e){if(ll&&typeof AE<"u"&&e instanceof AE)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e=="string")return MM(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e=="object"&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Eme(e){return typeof e=="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class jX{static#e=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${jX.#e++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}let Kze=class{constructor(t,r,n=!1,a=null){this.length=t,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=a,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,r){for(const n of this._rangeListeners)n(t,r)}onDataProgress(t,r){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(t,r)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const r of this._progressiveReadListeners)r(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,r){Gi("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class ANt{constructor(t,r){this._pdfInfo=t,this._transport=r}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return pi(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(r)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class $Nt{#e=null;#t=!1;constructor(t,r,n,a=!1){this._pageIndex=t,this._pageInfo=r,this._transport=n,this._stats=a?new hme:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new qze,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:r=this.rotate,offsetX:n=0,offsetY:a=0,dontFlip:l=!1}={}){return new hC({viewBox:this.view,scale:t,rotation:r,offsetX:n,offsetY:a,dontFlip:l})}getAnnotations({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return pi(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:r,intent:n="display",annotationMode:a=Fm.ENABLE,transform:l=null,background:c=null,optionalContentConfigPromise:d=null,annotationCanvasMap:p=null,pageColors:u=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(n,a,h),{renderingIntent:f,cacheKey:x}=m;this.#t=!1,this.#i(),d||=this._transport.getOptionalContentConfig(f);let y=this._intentStates.get(x);y||(y=Object.create(null),this._intentStates.set(x,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const b=!!(f&Od.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const w=S=>{y.renderTasks.delete(v),(this._maybeCleanupAfterRender||b)&&(this.#t=!0),this.#o(!b),S?(v.capability.reject(S),this._abortOperatorList({intentState:y,reason:S instanceof Error?S:new Error(S)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new W6({callback:w,params:{canvasContext:t,viewport:r,transform:l,background:c},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});(y.renderTasks||=new Set).add(v);const A=v.task;return Promise.all([y.displayReadyCapability.promise,d]).then(([S,E])=>{if(this.destroyed){w();return}if(this._stats?.time("Rendering"),!(E.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:S,optionalContentConfig:E}),v.operatorListChanged()}).catch(w),A}getOperatorList({intent:t="display",annotationMode:r=Fm.ENABLE,printAnnotationStorage:n=null}={}){function a(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(d))}const l=this._transport.getRenderingIntent(t,r,n,!0);let c=this._intentStates.get(l.cacheKey);c||(c=Object.create(null),this._intentStates.set(l.cacheKey,c));let d;return c.opListReadCapability||(d=Object.create(null),d.operatorListChanged=a,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(d),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(l)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:r===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>rv.textContent(n));const r=this.streamTextContent(t);return new Promise(function(n,a){function l(){c.read().then(function({value:p,done:u}){if(u){n(d);return}d.lang??=p.lang,Object.assign(d.styles,p.styles),d.items.push(...p.items),l()},a)}const c=r.getReader(),d={items:[],styles:Object.create(null),lang:null};l()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#t=!0;const r=this.#o(!1);return t&&r&&(this._stats&&=new hme),r}#o(t=!1){if(this.#i(),!this.#t||this.destroyed)return!1;if(t)return this.#e=setTimeout(()=>{this.#e=null,this.#o(!1)},gNt),!1;for(const{renderTasks:r,operatorList:n}of this._intentStates.values())if(r.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#i(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(t,r){const n=this._intentStates.get(r);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,r){for(let n=0,a=t.length;n<a;n++)r.operatorList.fnArray.push(t.fnArray[n]),r.operatorList.argsArray.push(t.argsArray[n]);r.operatorList.lastChunk=t.lastChunk,r.operatorList.separateAnnots=t.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();t.lastChunk&&this.#o(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:r,annotationStorageSerializable:n}){const{map:a,transfer:l}=n,d=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:r,annotationStorage:a},l).getReader(),p=this._intentStates.get(r);p.streamReader=d;const u=()=>{d.read().then(({value:h,done:m})=>{if(m){p.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,p),u())},h=>{if(p.streamReader=null,!this._transport.destroyed){if(p.operatorList){p.operatorList.lastChunk=!0;for(const m of p.renderTasks)m.operatorListChanged();this.#o(!0)}if(p.displayReadyCapability)p.displayReadyCapability.reject(h);else if(p.opListReadCapability)p.opListReadCapability.reject(h);else throw h}})};u()}_abortOperatorList({intentState:t,reason:r,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(r instanceof bX){let a=mNt;r.extraDelay>0&&r.extraDelay<1e3&&(a+=r.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:r,force:!0})},a);return}}if(t.streamReader.cancel(new l5(r.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,l]of this._intentStates)if(l===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}class kNt{#e=new Set;#t=Promise.resolve();postMessage(t,r){const n={data:structuredClone(t,r?{transfer:r}:null)};this.#t.then(()=>{for(const a of this.#e)a.call(this,n)})}addEventListener(t,r){this.#e.add(r)}removeEventListener(t,r){this.#e.delete(r)}terminate(){this.#e.clear()}}const D0={isWorkerDisabled:!1,fakeWorkerId:0};ll&&(D0.isWorkerDisabled=!0,ov.workerSrc||="./pdf.worker.mjs"),D0.isSameOrigin=function(e,t){let r;try{if(r=new URL(e),!r.origin||r.origin==="null")return!1}catch{return!1}const n=new URL(t,r);return r.origin===n.origin},D0.createCDNWrapper=function(e){const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class Qd{static#e;constructor({name:t=null,port:r=null,verbosity:n=rOt()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,r){if(Qd.#e?.has(r))throw new Error("Cannot use more than one PDFWorker per port.");(Qd.#e||=new WeakMap).set(r,this),this._initializeFromPort(r);return}this._initialize()}get promise(){return ll?Promise.all([Dh.promise,this._readyCapability.promise]):this._readyCapability.promise}#t(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new vb("main","worker",t),this._messageHandler.on("ready",function(){}),this.#t()}_initialize(){if(D0.isWorkerDisabled||Qd.#o){this._setupFakeWorker();return}let{workerSrc:t}=Qd;try{D0.isSameOrigin(window.location.href,t)||(t=D0.createCDNWrapper(new URL(t,window.location).href));const r=new Worker(t,{type:"module"}),n=new vb("main","worker",r),a=()=>{l.abort(),n.destroy(),r.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},l=new AbortController;r.addEventListener("error",()=>{this._webWorker||a()},{signal:l.signal}),n.on("test",d=>{if(l.abort(),this.destroyed||!d){a();return}this._messageHandler=n,this._port=r,this._webWorker=r,this.#t()}),n.on("ready",d=>{if(l.abort(),this.destroyed){a();return}try{c()}catch{this._setupFakeWorker()}});const c=()=>{const d=new Uint8Array;n.send("test",d,[d.buffer])};c();return}catch{IM("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){D0.isWorkerDisabled||(Fr("Setting up fake worker."),D0.isWorkerDisabled=!0),Qd._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const r=new kNt;this._port=r;const n=`fake${D0.fakeWorkerId++}`,a=new vb(n+"_worker",n,r);t.setup(a,r),this._messageHandler=new vb(n,n+"_worker",r),this.#t()}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),Qd.#e?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const r=this.#e?.get(t.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Qd(t)}static get workerSrc(){if(ov.workerSrc)return ov.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#o(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return pi(this,"_setupFakeWorkerGlobal",(async()=>this.#o?this.#o:(await import(this.workerSrc)).WorkerMessageHandler)())}}class SNt{#e=new Map;#t=new Map;#o=new Map;#i=new Map;#s=null;constructor(t,r,n,a,l){this.messageHandler=t,this.loadingTask=r,this.commonObjs=new qze,this.fontLoader=new $Ot({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=l.canvasFactory,this.filterFactory=l.filterFactory,this.cMapReaderFactory=l.cMapReaderFactory,this.standardFontDataFactory=l.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,r=null){const n=this.#e.get(t);if(n)return n;const a=this.messageHandler.sendWithPromise(t,r);return this.#e.set(t,a),a}get annotationStorage(){return pi(this,"annotationStorage",new SX)}getRenderingIntent(t,r=Fm.ENABLE,n=null,a=!1){let l=Od.DISPLAY,c=AY;switch(t){case"any":l=Od.ANY;break;case"display":break;case"print":l=Od.PRINT;break;default:Fr(`getRenderingIntent - invalid intent: ${t}`)}switch(r){case Fm.DISABLE:l+=Od.ANNOTATIONS_DISABLE;break;case Fm.ENABLE:break;case Fm.ENABLE_FORMS:l+=Od.ANNOTATIONS_FORMS;break;case Fm.ENABLE_STORAGE:l+=Od.ANNOTATIONS_STORAGE,c=(l&Od.PRINT&&n instanceof Nze?n:this.annotationStorage).serializable;break;default:Fr(`getRenderingIntent - invalid annotationMode: ${r}`)}return a&&(l+=Od.OPLIST),{renderingIntent:l,cacheKey:`${l}_${c.hash}`,annotationStorageSerializable:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#s?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const n of this.#t.values())t.push(n._destroy());this.#t.clear(),this.#o.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),PL.cleanup(),this._networkStream?.cancelAllRequests(new l5("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:r}=this;t.on("GetReader",(n,a)=>{Ua(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=l=>{this._lastProgress={loaded:l.loaded,total:l.total}},a.onPull=()=>{this._fullReader.read().then(function({value:l,done:c}){if(c){a.close();return}Ua(l instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(l),1,[l])}).catch(l=>{a.error(l)})},a.onCancel=l=>{this._fullReader.cancel(l),a.ready.catch(c=>{if(!this.destroyed)throw c})}}),t.on("ReaderHeadersReady",n=>{const a=Promise.withResolvers(),l=this._fullReader;return l.headersReady.then(()=>{(!l.isStreamingSupported||!l.isRangeSupported)&&(this._lastProgress&&r.onProgress?.(this._lastProgress),l.onProgress=c=>{r.onProgress?.({loaded:c.loaded,total:c.total})}),a.resolve({isStreamingSupported:l.isStreamingSupported,isRangeSupported:l.isRangeSupported,contentLength:l.contentLength})},a.reject),a.promise}),t.on("GetRangeReader",(n,a)=>{Ua(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const l=this._networkStream.getRangeReader(n.begin,n.end);if(!l){a.close();return}a.onPull=()=>{l.read().then(function({value:c,done:d}){if(d){a.close();return}Ua(c instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(c),1,[c])}).catch(c=>{a.error(c)})},a.onCancel=c=>{l.cancel(c),a.ready.catch(d=>{if(!this.destroyed)throw d})}}),t.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new ANt(n,this))}),t.on("DocException",function(n){let a;switch(n.name){case"PasswordException":a=new vY(n.message,n.code);break;case"InvalidPDFException":a=new Bze(n.message);break;case"MissingPDFException":a=new s5(n.message);break;case"UnexpectedResponseException":a=new jM(n.message,n.status);break;case"UnknownErrorException":a=new CY(n.message,n.details);break;default:Gi("DocException - expected a valid Error.")}r._capability.reject(a)}),t.on("PasswordRequest",n=>{if(this.#s=Promise.withResolvers(),r.onPassword){const a=l=>{l instanceof Error?this.#s.reject(l):this.#s.resolve({password:l})};try{r.onPassword(a,n.code)}catch(l){this.#s.reject(l)}}else this.#s.reject(new vY(n.message,n.code));return this.#s.promise}),t.on("DataLoaded",n=>{r.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,a,l])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(a){case"Font":const{disableFontFace:c,fontExtraProperties:d,pdfBug:p}=this._params;if("error"in l){const f=l.error;Fr(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const u=p&&globalThis.FontInspector?.enabled?(f,x)=>globalThis.FontInspector.fontAdded(f,x):null,h=new kOt(l,{disableFontFace:c,inspectFont:u});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!d&&h.data&&(h.data=null),this.commonObjs.resolve(n,h)});break;case"CopyLocalImage":const{imageRef:m}=l;Ua(m,"The imageRef must be defined.");for(const f of this.#t.values())for(const[,x]of f.objs)if(x?.ref===m)return x.dataLen?(this.commonObjs.resolve(n,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,l);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([n,a,l,c])=>{if(this.destroyed)return;const d=this.#t.get(a);if(!d.objs.has(n)){if(d._intentStates.size===0){c?.bitmap?.close();return}switch(l){case"Image":d.objs.resolve(n,c),c?.dataLen>JFt&&(d._maybeCleanupAfterRender=!0);break;case"Pattern":d.objs.resolve(n,c);break;default:throw new Error(`Got unknown object type ${l}`)}}}),t.on("DocProgress",n=>{this.destroyed||r.onProgress?.({loaded:n.loaded,total:n.total})}),t.on("FetchBuiltInCMap",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(n):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(n):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Fr("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=t-1,n=this.#o.get(r);if(n)return n;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(l=>{if(this.destroyed)throw new Error("Transport destroyed");l.refStr&&this.#i.set(l.refStr,t);const c=new $Nt(r,l,this,this._params.pdfBug);return this.#t.set(r,c),c});return this.#o.set(r,a),a}getPageIndex(t){return Eme(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}getFieldObjects(){return this.#r("GetFieldObjects")}hasJSActions(){return this.#r("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#r("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#r("GetOptionalContentConfig").then(r=>new UOt(r,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",r=this.#e.get(t);if(r)return r;const n=this.messageHandler.sendWithPromise(t,null).then(a=>({info:a[0],metadata:a[1]?new VOt(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(t,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const r of this.#t.values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),PL.cleanup()}}cachedPageNumber(t){if(!Eme(t))return null;const r=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#i.get(r)??null}}const x$=Symbol("INITIAL_DATA");class qze{#e=Object.create(null);#t(t){return this.#e[t]||={...Promise.withResolvers(),data:x$}}get(t,r=null){if(r){const a=this.#t(t);return a.promise.then(()=>r(a.data)),null}const n=this.#e[t];if(!n||n.data===x$)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const r=this.#e[t];return!!r&&r.data!==x$}resolve(t,r=null){const n=this.#t(t);n.data=r,n.resolve()}clear(){for(const t in this.#e){const{data:r}=this.#e[t];r?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const t in this.#e){const{data:r}=this.#e[t];r!==x$&&(yield[t,r])}}}class ENt{#e=null;constructor(t){this.#e=t,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(t=0){this.#e.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#e.operatorList;if(!t)return!1;const{annotationCanvasMap:r}=this.#e;return t.form||t.canvas&&r?.size>0}}class W6{#e=null;static#t=new WeakSet;constructor({callback:t,params:r,objs:n,commonObjs:a,annotationCanvasMap:l,operatorList:c,pageIndex:d,canvasFactory:p,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:m=!1,pageColors:f=null}){this.callback=t,this.params=r,this.objs=n,this.commonObjs=a,this.annotationCanvasMap=l,this.operatorListIdx=null,this.operatorList=c,this._pageIndex=d,this.canvasFactory=p,this.filterFactory=u,this._pdfBug=m,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ENt(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=r.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:r}){if(this.cancelled)return;if(this._canvas){if(W6.#t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");W6.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:a,transform:l,background:c}=this.params;this.gfx=new d8(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:a,transparency:t,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,r=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),W6.#t.delete(this._canvas),this.callback(t||new bX(`Rendering cancelled, page ${this._pageIndex+1}`,r))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=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(),W6.#t.delete(this._canvas),this.callback())))}}const LNt="4.4.168",INt="19fbc8998";function Lme(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function gy(e){return Math.max(0,Math.min(255,255*e))}class Ime{static CMYK_G([t,r,n,a]){return["G",1-Math.min(1,.3*t+.59*n+.11*r+a)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=gy(t),[t,t,t]}static G_HTML([t]){const r=Lme(t);return`#${r}${r}${r}`}static RGB_G([t,r,n]){return["G",.3*t+.59*r+.11*n]}static RGB_rgb(t){return t.map(gy)}static RGB_HTML(t){return`#${t.map(Lme).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,r,n,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,n+a),1-Math.min(1,r+a)]}static CMYK_rgb([t,r,n,a]){return[gy(1-Math.min(1,t+a)),gy(1-Math.min(1,n+a)),gy(1-Math.min(1,r+a))]}static CMYK_HTML(t){const r=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([t,r,n]){const a=1-t,l=1-r,c=1-n,d=Math.min(a,l,c);return["CMYK",a,l,c,d]}}class Zze{static setupStorage(t,r,n,a,l){const c=a.getValue(r,{value:null});switch(n.name){case"textarea":if(c.value!==null&&(t.textContent=c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(c.value===n.attributes.xfaOn?t.setAttribute("checked",!0):c.value===n.attributes.xfaOff&&t.removeAttribute("checked"),l==="print")break;t.addEventListener("change",d=>{a.setValue(r,{value:d.target.checked?d.target.getAttribute("xfaOn"):d.target.getAttribute("xfaOff")})})}else{if(c.value!==null&&t.setAttribute("value",c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})})}break;case"select":if(c.value!==null){t.setAttribute("value",c.value);for(const d of n.children)d.attributes.value===c.value?d.attributes.selected=!0:d.attributes.hasOwnProperty("selected")&&delete d.attributes.selected}t.addEventListener("input",d=>{const p=d.target.options,u=p.selectedIndex===-1?"":p[p.selectedIndex].value;a.setValue(r,{value:u})});break}}static setAttributes({html:t,element:r,storage:n=null,intent:a,linkService:l}){const{attributes:c}=r,d=t instanceof HTMLAnchorElement;c.type==="radio"&&(c.name=`${c.name}-${a}`);for(const[p,u]of Object.entries(c))if(u!=null)switch(p){case"class":u.length&&t.setAttribute(p,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!d||p!=="href"&&p!=="newWindow")&&t.setAttribute(p,u)}d&&l.addLinkAttributes(t,c.href,c.newWindow),n&&c.dataId&&this.setupStorage(t,c.dataId,r,n)}static render(t){const r=t.annotationStorage,n=t.linkService,a=t.xfaHtml,l=t.intent||"display",c=document.createElement(a.name);a.attributes&&this.setAttributes({html:c,element:a,intent:l,linkService:n});const d=l!=="richText",p=t.div;if(p.append(c),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;p.style.transform=m}d&&p.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const m=document.createTextNode(a.value);c.append(m),d&&rv.shouldBuildText(a.name)&&u.push(m)}return{textDivs:u}}const h=[[a,-1,c]];for(;h.length>0;){const[m,f,x]=h.at(-1);if(f+1===m.children.length){h.pop();continue}const y=m.children[++h.at(-1)[1]];if(y===null)continue;const{name:b}=y;if(b==="#text"){const v=document.createTextNode(y.value);u.push(v),x.append(v);continue}const w=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,b):document.createElement(b);if(x.append(w),y.attributes&&this.setAttributes({html:w,element:y,storage:r,intent:l,linkService:n}),y.children?.length>0)h.push([y,-1,w]);else if(y.value){const v=document.createTextNode(y.value);d&&rv.shouldBuildText(b)&&u.push(v),w.append(v)}}for(const m of p.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){const r=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=r,t.div.hidden=!1}}const fC=1e3,jNt=9,F4=new WeakSet;function a2(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class MNt{static create(t){switch(t.data.annotationType){case Na.LINK:return new Jze(t);case Na.TEXT:return new BNt(t);case Na.WIDGET:switch(t.data.fieldType){case"Tx":return new PNt(t);case"Btn":return t.data.radioButton?new Xze(t):t.data.checkBox?new TNt(t):new zNt(t);case"Ch":return new RNt(t);case"Sig":return new DNt(t)}return new c5(t);case Na.POPUP:return new EY(t);case Na.FREETEXT:return new eRe(t);case Na.LINE:return new ONt(t);case Na.SQUARE:return new NNt(t);case Na.CIRCLE:return new HNt(t);case Na.POLYLINE:return new tRe(t);case Na.CARET:return new VNt(t);case Na.INK:return new oRe(t);case Na.POLYGON:return new _Nt(t);case Na.HIGHLIGHT:return new QNt(t);case Na.UNDERLINE:return new UNt(t);case Na.SQUIGGLY:return new WNt(t);case Na.STRIKEOUT:return new GNt(t);case Na.STAMP:return new rRe(t);case Na.FILEATTACHMENT:return new YNt(t);default:return new ua(t)}}}class ua{#e=null;#t=!1;#o=null;constructor(t,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=r,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,r&&(this.container=this._createContainer(n)),a&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:r,richText:n}){return!!(t?.str||r?.str||n?.str)}get hasPopupData(){return ua._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:r}=t;r&&this.#i(r),this.#o?.popup.updateEdited(t)}resetEdited(){this.#e&&(this.#i(this.#e.rect),this.#o?.popup.resetEdited(),this.#e=null)}#i(t){const{container:{style:r},data:{rect:n,rotation:a},parent:{viewport:{rawDims:{pageWidth:l,pageHeight:c,pageX:d,pageY:p}}}}=this;n?.splice(0,4,...t);const{width:u,height:h}=a2(t);r.left=`${100*(t[0]-d)/l}%`,r.top=`${100*(c-t[3]+p)/c}%`,a===0?(r.width=`${100*u/l}%`,r.height=`${100*h/c}%`):this.setRotation(a)}_createContainer(t){const{data:r,parent:{page:n,viewport:a}}=this,l=document.createElement("section");l.setAttribute("data-annotation-id",r.id),this instanceof c5||(l.tabIndex=fC);const{style:c}=l;if(c.zIndex=this.parent.zIndex++,r.popupRef&&l.setAttribute("aria-haspopup","dialog"),r.alternativeText&&(l.title=r.alternativeText),r.noRotate&&l.classList.add("norotate"),!r.rect||this instanceof EY){const{rotation:b}=r;return!r.hasOwnCanvas&&b!==0&&this.setRotation(b,l),l}const{width:d,height:p}=a2(r.rect);if(!t&&r.borderStyle.width>0){c.borderWidth=`${r.borderStyle.width}px`;const b=r.borderStyle.horizontalCornerRadius,w=r.borderStyle.verticalCornerRadius;if(b>0||w>0){const A=`calc(${b}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;c.borderRadius=A}else if(this instanceof Xze){const A=`calc(${d}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;c.borderRadius=A}switch(r.borderStyle.style){case hy.SOLID:c.borderStyle="solid";break;case hy.DASHED:c.borderStyle="dashed";break;case hy.BEVELED:Fr("Unimplemented border style: beveled");break;case hy.INSET:Fr("Unimplemented border style: inset");break;case hy.UNDERLINE:c.borderBottomStyle="solid";break}const v=r.borderColor||null;v?(this.#t=!0,c.borderColor=jo.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):c.borderWidth=0}const u=jo.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:m,pageX:f,pageY:x}=a.rawDims;c.left=`${100*(u[0]-f)/h}%`,c.top=`${100*(u[1]-x)/m}%`;const{rotation:y}=r;return r.hasOwnCanvas||y===0?(c.width=`${100*d/h}%`,c.height=`${100*p/m}%`):this.setRotation(y,l),l}setRotation(t,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:a}=this.parent.viewport.rawDims,{width:l,height:c}=a2(this.data.rect);let d,p;t%180===0?(d=100*l/n,p=100*c/a):(d=100*c/n,p=100*l/a),r.style.width=`${d}%`,r.style.height=`${p}%`,r.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(r,n,a)=>{const l=a.detail[r],c=l[0],d=l.slice(1);a.target.style[n]=Ime[`${c}_HTML`](d),this.annotationStorage.setValue(this.data.id,{[n]:Ime[`${c}_rgb`](d)})};return pi(this,"_commonActions",{display:r=>{const{display:n}=r.detail,a=n%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{t("bgColor","backgroundColor",r)},fillColor:r=>{t("fillColor","backgroundColor",r)},fgColor:r=>{t("fgColor","color",r)},textColor:r=>{t("textColor","color",r)},borderColor:r=>{t("borderColor","borderColor",r)},strokeColor:r=>{t("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,r){const n=this._commonActions;for(const a of Object.keys(r.detail))(t[a]||n[a])?.(r)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[a,l]of Object.entries(r)){const c=n[a];if(c){const d={detail:{[a]:l},target:t};c(d),delete r[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[r,n,a,l]=this.data.rect.map(b=>Math.fround(b));if(t.length===8){const[b,w,v,A]=t.subarray(2,6);if(a===b&&l===w&&r===v&&n===A)return}const{style:c}=this.container;let d;if(this.#t){const{borderColor:b,borderWidth:w}=c;c.borderWidth=0,d=["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 p=a-r,u=l-n,{svgFactory:h}=this,m=h.createElement("svg");m.classList.add("quadrilateralsContainer"),m.setAttribute("width",0),m.setAttribute("height",0);const f=h.createElement("defs");m.append(f);const x=h.createElement("clipPath"),y=`clippath_${this.data.id}`;x.setAttribute("id",y),x.setAttribute("clipPathUnits","objectBoundingBox"),f.append(x);for(let b=2,w=t.length;b<w;b+=8){const v=t[b],A=t[b+1],S=t[b+2],E=t[b+3],I=h.createElement("rect"),L=(S-r)/p,B=(l-A)/u,D=(v-S)/p,M=(A-E)/u;I.setAttribute("x",L),I.setAttribute("y",B),I.setAttribute("width",D),I.setAttribute("height",M),x.append(I),d?.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${B}" width="${D}" height="${M}"/>`)}this.#t&&(d.push("</g></svg>')"),c.backgroundImage=d.join("")),this.container.append(m),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:r}=this;t.setAttribute("aria-haspopup","dialog");const n=this.#o=new EY({data:{color:r.color,titleObj:r.titleObj,modificationDate:r.modificationDate,contentsObj:r.contentsObj,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation},parent:this.parent,elements:[this]});this.parent.div.append(n.render())}render(){Gi("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,r=null){const n=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:l,id:c,exportValues:d}of a){if(l===-1||c===r)continue;const p=typeof d=="string"?d:null,u=document.querySelector(`[data-element-id="${c}"]`);if(u&&!F4.has(u)){Fr(`_getElementsByName - element not allowed: ${c}`);continue}n.push({id:c,exportValue:p,domElement:u})}return n}for(const a of document.getElementsByName(t)){const{exportValue:l}=a,c=a.getAttribute("data-element-id");c!==r&&F4.has(a)&&n.push({id:c,exportValue:l,domElement:a})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const r of t)r.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:r})})}}class Jze extends ua{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!r?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let a=!1;return t.url?(r.addLinkAttributes(n,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(n,t.action),a=!0):t.attachment?(this.#t(n,t.attachment,t.attachmentDest),a=!0):t.setOCGState?(this.#o(n,t.setOCGState),a=!0):t.dest?(this._bindLink(n,t.dest),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),a=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(n,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(n),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&this.#e()}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),this.#e()}#t(t,r,n=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(r.content,r.filename,n),!1),this.#e()}#o(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),this.#e()}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(r.actions)){const l=n.get(a);l&&(t[l]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:a}}),!1))}t.onclick||(t.onclick=()=>!1),this.#e()}_bindResetFormAction(t,r){const n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Fr('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{n?.();const{fields:a,refs:l,include:c}=r,d=[];if(a.length!==0||l.length!==0){const h=new Set(l);for(const m of a){const f=this._fieldObjects[m]||[];for(const{id:x}of f)h.add(x)}for(const m of Object.values(this._fieldObjects))for(const f of m)h.has(f.id)===c&&d.push(f)}else for(const h of Object.values(this._fieldObjects))d.push(...h);const p=this.annotationStorage,u=[];for(const h of d){const{id:m}=h;switch(u.push(m),h.type){case"text":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}case"checkbox":case"radiobutton":{const x=h.defaultValue===h.exportValues;p.setValue(m,{value:x});break}case"combobox":case"listbox":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}default:continue}const f=document.querySelector(`[data-element-id="${m}"]`);if(f){if(!F4.has(f)){Fr(`_bindResetFormAction - element not allowed: ${m}`);continue}}else continue;f.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:u,name:"ResetForm"}}),!1}}}class BNt extends ua{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class c5 extends ua{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return yc.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,r,n,a,l){n.includes("mouse")?t.addEventListener(n,c=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c),shift:c.shiftKey,modifier:this._getKeyModifier(c)}})}):t.addEventListener(n,c=>{if(n==="blur"){if(!r.focused||!c.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}l&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c)}})})}_setEventListeners(t,r,n,a){for(const[l,c]of n)(c==="Action"||this.data.actions?.[c])&&((c==="Focus"||c==="Blur")&&(r||={focused:!1}),this._setEventListener(t,r,l,c,a),c==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,r,"blur","Blur",null):c==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,r,"focus","Focus",null))}_setBackgroundColor(t){const r=this.data.backgroundColor||null;t.style.backgroundColor=r===null?"transparent":jo.makeHexColor(r[0],r[1],r[2])}_setTextStyle(t){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||jNt,l=t.style;let c;const d=2,p=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d),h=Math.round(u/(e_*a))||1,m=u/h;c=Math.min(a,p(m/e_))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d);c=Math.min(a,p(u/e_))}l.fontSize=`calc(${c}px * var(--scale-factor))`,l.color=jo.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(l.textAlign=r[this.data.textAlignment])}_setRequired(t,r){r?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",r)}}class PNt extends c5{constructor(t){const r=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:r})}setPropertyOnSiblings(t,r,n,a){const l=this.annotationStorage;for(const c of this._getElementsByName(t.name,t.id))c.domElement&&(c.domElement[r]=n),l.setValue(c.id,{[a]:n})}render(){const t=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const a=t.getValue(r,{value:this.data.fieldValue});let l=a.value||"";const c=t.getValue(r,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let d=a.formattedValue||this.data.textContent?.join(`
|
|
246
|
+
`);return t.join("")}}function wb(e,t){try{const{protocol:r}=t?new URL(e,t):new URL(e);return r==="http:"||r==="https:"}catch{return!1}}function $c(e){e.preventDefault()}function Rze(e){console.log("Deprecated API usage: "+e)}let mme;class Fze{static toDateObject(t){if(!t||typeof t!="string")return null;mme||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const r=mme.exec(t);if(!r)return null;const n=parseInt(r[1],10);let a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let l=parseInt(r[3],10);l=l>=1&&l<=31?l:1;let c=parseInt(r[4],10);c=c>=0&&c<=23?c:0;let d=parseInt(r[5],10);d=d>=0&&d<=59?d:0;let p=parseInt(r[6],10);p=p>=0&&p<=59?p:0;const u=r[7]||"Z";let h=parseInt(r[8],10);h=h>=0&&h<=23?h:0;let m=parseInt(r[9],10)||0;return m=m>=0&&m<=59?m:0,u==="-"?(c+=h,d+=m):u==="+"&&(c-=h,d-=m),new Date(Date.UTC(n,a,l,c,d,p))}}function xOt(e,{scale:t=1,rotation:r=0}){const{width:n,height:a}=e.attributes.style,l=[0,0,parseInt(n),parseInt(a)];return new hC({viewBox:l,scale:t,rotation:r})}function CX(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map(t=>parseInt(t)):e.startsWith("rgba(")?e.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(Fr(`Not a valid color format: "${e}"`),[0,0,0])}function yOt(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const r of e.keys()){t.style.color=r;const n=window.getComputedStyle(t).color;e.set(r,CX(n))}t.remove()}function Pn(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform();return[t,r,n,a,l,c]}function x0(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform().invertSelf();return[t,r,n,a,l,c]}function R4(e,t,r=!1,n=!0){if(t instanceof hC){const{pageWidth:a,pageHeight:l}=t.rawDims,{style:c}=e,d=yc.isCSSRoundSupported,p=`var(--scale-factor) * ${a}px`,u=`var(--scale-factor) * ${l}px`,h=d?`round(${p}, 1px)`:`calc(${p})`,m=d?`round(${u}, 1px)`:`calc(${u})`;!r||t.rotation%180===0?(c.width=h,c.height=m):(c.width=m,c.height=h)}n&&e.setAttribute("data-main-rotation",t.rotation)}class AX{#e=null;#t=null;#o;#i=null;constructor(t){this.#o=t}render(){const t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");const r=this.#o._uiManager._signal;t.addEventListener("contextmenu",$c,{signal:r}),t.addEventListener("pointerdown",AX.#s,{signal:r});const n=this.#i=document.createElement("div");n.className="buttons",t.append(n);const a=this.#o.toolbarPosition;if(a){const{style:l}=t,c=this.#o._uiManager.direction==="ltr"?1-a[0]:a[0];l.insetInlineEnd=`${100*c}%`,l.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}static#s(t){t.stopPropagation()}#r(t){this.#o._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#n(t){this.#o._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#l(t){const r=this.#o._uiManager._signal;t.addEventListener("focusin",this.#r.bind(this),{capture:!0,signal:r}),t.addEventListener("focusout",this.#n.bind(this),{capture:!0,signal:r}),t.addEventListener("contextmenu",$c,{signal:r})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden")}#d(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#o.editorType}-button`),this.#l(t),t.addEventListener("click",r=>{this.#o._uiManager.delete()},{signal:this.#o._uiManager._signal}),this.#i.append(t)}get#p(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#l(t),this.#i.prepend(t,this.#p)}addColorPicker(t){this.#t=t;const r=t.renderButton();this.#l(r),this.#i.prepend(r,this.#p)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class bOt{#e=null;#t=null;#o;constructor(t){this.#o=t}#i(){const t=this.#t=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",$c,{signal:this.#o._signal});const r=this.#e=document.createElement("div");return r.className="buttons",t.append(r),this.#r(),t}#s(t,r){let n=0,a=0;for(const l of t){const c=l.y+l.height;if(c<n)continue;const d=l.x+(r?l.width:0);if(c>n){a=d,n=c;continue}r?d>a&&(a=d):d<a&&(a=d)}return[r?1-a:a,n]}show(t,r,n){const[a,l]=this.#s(r,n),{style:c}=this.#t||=this.#i();t.append(this.#t),c.insetInlineEnd=`${100*a}%`,c.top=`calc(${100*l}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#r(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const r=document.createElement("span");t.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#o._signal;t.addEventListener("contextmenu",$c,{signal:n}),t.addEventListener("click",()=>{this.#o.highlightSelection("floating_button")},{signal:n}),this.#e.append(t)}}function ML(e,t,r){for(const n of r)t.addEventListener(n,e[n].bind(e))}function wOt(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}class vOt{#e=0;get id(){return`${XFt}${this.#e++}`}}class $X{#e=uOt();#t=0;#o=null;static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=t;const l=a.decode().then(()=>(n.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return pi(this,"_isSVGFittingCanvas",l)}async#i(t,r){this.#o||=new Map;let n=this.#o.get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof r=="string"?(n.url=r,a=await zM(r,"blob")):a=n.file=r,a.type==="image/svg+xml"){const l=$X._isSVGFittingCanvas,c=new FileReader,d=new Image,p=new Promise((u,h)=>{d.onload=()=>{n.bitmap=d,n.isSvg=!0,u()},c.onload=async()=>{const m=n.svgUrl=c.result;d.src=await l?`${m}#svgView(preserveAspectRatio(none))`:m},d.onerror=c.onerror=h});c.readAsDataURL(a),await p}else n.bitmap=await createImageBitmap(a);n.refCounter=1}catch(a){console.error(a),n=null}return this.#o.set(t,n),n&&this.#o.set(n.id,n),n}async getFromFile(t){const{lastModified:r,name:n,size:a,type:l}=t;return this.#i(`${r}_${n}_${a}_${l}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromId(t){this.#o||=new Map;const r=this.#o.get(t);return r?r.bitmap?(r.refCounter+=1,r):r.file?this.getFromFile(r.file):this.getFromUrl(r.url):null}getSvgUrl(t){const r=this.#o.get(t);return r?.isSvg?r.svgUrl:null}deleteId(t){this.#o||=new Map;const r=this.#o.get(t);r&&(r.refCounter-=1,r.refCounter===0&&(r.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#e}_`)}}class COt{#e=[];#t=!1;#o;#i=-1;constructor(t=128){this.#o=t}add({cmd:t,undo:r,post:n,mustExec:a,type:l=NaN,overwriteIfSameType:c=!1,keepUndo:d=!1}){if(a&&t(),this.#t)return;const p={cmd:t,undo:r,post:n,type:l};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(p);return}if(c&&this.#e[this.#i].type===l){d&&(p.undo=this.#e[this.#i].undo),this.#e[this.#i]=p;return}const u=this.#i+1;u===this.#o?this.#e.splice(0,1):(this.#i=u,u<this.#e.length&&this.#e.splice(u)),this.#e.push(p)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}destroy(){this.#e=null}}class mC{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=yc.platform;for(const[n,a,l={}]of t)for(const c of n){const d=c.startsWith("mac+");r&&d?(this.callbacks.set(c.slice(4),{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1))):!r&&!d&&(this.callbacks.set(c,{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1)))}}#e(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const r=this.buffer.join("+");return this.buffer.length=0,r}exec(t,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(this.#e(r));if(!n)return;const{callback:a,options:{bubbles:l=!1,args:c=[],checker:d=null}}=n;d&&!d(t,r)||(a.bind(t,...c,r)(),l||(r.stopPropagation(),r.preventDefault()))}}class kX{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return yOt(t),pi(this,"_colors",t)}convert(t){const r=CX(t);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,a]of this._colors)if(a.every((l,c)=>l===r[c]))return kX._colorsMapping.get(n);return r}getHexCode(t){const r=this._colors.get(t);return r?jo.makeHexColor(...r):t}}class yg{#e=new AbortController;#t=null;#o=new Map;#i=new Map;#s=null;#r=null;#n=null;#l=new COt;#d=0;#p=new Set;#h=null;#c=null;#a=new Set;#m=!1;#f=null;#u=null;#y=null;#g=!1;#b=null;#v=new vOt;#A=!1;#k=!1;#S=null;#j=null;#$=null;#w=ii.NONE;#x=new Set;#C=null;#E=null;#L=null;#B=this.blur.bind(this);#M=this.focus.bind(this);#T=this.copy.bind(this);#P=this.cut.bind(this);#z=this.paste.bind(this);#D=this.keydown.bind(this);#Q=this.keyup.bind(this);#U=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#N=this.onScaleChanging.bind(this);#R=this.onRotationChanging.bind(this);#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#F=null;#H=null;#q=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=yg.prototype,r=c=>c.#H.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&c.hasSomethingToControl(),n=(c,{target:d})=>{if(d instanceof HTMLInputElement){const{type:p}=d;return p!=="text"&&p!=="number"}return!0},a=this.TRANSLATE_SMALL,l=this.TRANSLATE_BIG;return pi(this,"_keyboardManager",new mC([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(d)&&!c.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-l,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[l,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-l],checker:r}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,l],checker:r}]]))}constructor(t,r,n,a,l,c,d,p,u){this._signal=this.#e.signal,this.#H=t,this.#q=r,this.#s=n,this._eventBus=a,this._eventBus._on("editingaction",this.#U),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#N),this._eventBus._on("rotationchanging",this.#R),this.#ie(),this.#le(),this.#Z(),this.#r=l.annotationStorage,this.#f=l.filterFactory,this.#E=c,this.#y=d||null,this.#m=p,this.#$=u||null,this.viewParameters={realScale:W8.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#e?.abort(),this.#e=null,this._signal=null,this._eventBus._off("editingaction",this.#U),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#N),this._eventBus._off("rotationchanging",this.#R);for(const t of this.#i.values())t.destroy();this.#i.clear(),this.#o.clear(),this.#a.clear(),this.#t=null,this.#x.clear(),this.#l.destroy(),this.#s?.destroy(),this.#b?.hide(),this.#b=null,this.#u&&(clearTimeout(this.#u),this.#u=null),this.#F&&(clearTimeout(this.#F),this.#F=null)}async mlGuess(t){return this.#$?.guess(t)||null}get hasMLManager(){return!!this.#$}get hcmFilter(){return pi(this,"hcmFilter",this.#E?this.#f.addHCMFilter(this.#E.foreground,this.#E.background):"none")}get direction(){return pi(this,"direction",getComputedStyle(this.#H).direction)}get highlightColors(){return pi(this,"highlightColors",this.#y?new Map(this.#y.split(",").map(t=>t.split("=").map(r=>r.trim()))):null)}get highlightColorNames(){return pi(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#j=t}editAltText(t){this.#s?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#d=t-1}focusMainContainer(){this.#H.focus()}findParent(t,r){for(const n of this.#i.values()){const{x:a,y:l,width:c,height:d}=n.div.getBoundingClientRect();if(t>=a&&t<=a+c&&r>=l&&r<=l+d)return n}return null}disableUserSelect(t=!1){this.#q.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#a.add(t)}removeShouldRescale(t){this.#a.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*W8.PDF_TO_CSS_UNITS;for(const r of this.#a)r.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#G({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c}=r,d=r.toString(),u=this.#G(r).closest(".textLayer"),h=this.getSelectionBoxes(u);if(h){r.empty(),this.#w===ii.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:ii.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const m of this.#i.values())if(m.hasTextLayer(u)){m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c,text:d});break}}}#oe(){const t=document.getSelection();if(!t||t.isCollapsed)return;const n=this.#G(t).closest(".textLayer"),a=this.getSelectionBoxes(n);a&&(this.#b||=new bOt(this),this.#b.show(n,a,this.direction==="ltr"))}addToAnnotationStorage(t){!t.isEmpty()&&this.#r&&!this.#r.has(t.id)&&this.#r.setValue(t.id,t)}#re(){const t=document.getSelection();if(!t||t.isCollapsed){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}const{anchorNode:r}=t;if(r===this.#C)return;if(!this.#G(t).closest(".textLayer")){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}if(this.#b?.hide(),this.#C=r,this.#I({hasSelectedText:!0}),!(this.#w!==ii.HIGHLIGHT&&this.#w!==ii.NONE)&&(this.#w===ii.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#g=this.isShiftKeyDown,!this.isShiftKeyDown)){const l=this._signal,c=d=>{d.type==="pointerup"&&d.button!==0||(window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),d.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}}#Y(t=""){this.#w===ii.HIGHLIGHT?this.highlightSelection(t):this.#m&&this.#oe()}#ie(){document.addEventListener("selectionchange",this.#re.bind(this),{signal:this._signal})}#ne(){const t=this._signal;window.addEventListener("focus",this.#M,{signal:t}),window.addEventListener("blur",this.#B,{signal:t})}#ae(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#B)}blur(){if(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const r of this.#x)if(r.div.contains(t)){this.#S=[r,t],r._focusEventsAllowed=!1;break}}focus(){if(!this.#S)return;const[t,r]=this.#S;this.#S=null,r.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}#Z(){const t=this._signal;window.addEventListener("keydown",this.#D,{signal:t}),window.addEventListener("keyup",this.#Q,{signal:t})}#se(){window.removeEventListener("keydown",this.#D),window.removeEventListener("keyup",this.#Q)}#J(){const t=this._signal;document.addEventListener("copy",this.#T,{signal:t}),document.addEventListener("cut",this.#P,{signal:t}),document.addEventListener("paste",this.#z,{signal:t})}#X(){document.removeEventListener("copy",this.#T),document.removeEventListener("cut",this.#P),document.removeEventListener("paste",this.#z)}#le(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#Z(),this.#J()}removeEditListeners(){this.#se(),this.#X()}dragOver(t){for(const{type:r}of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const r of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const r=[];for(const n of this.#x){const a=n.serialize(!0);a&&r.push(a)}r.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:r}=t;for(const l of r.items)for(const c of this.#c)if(c.isHandlingMimeForPasting(l.type)){c.paste(l,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(l){Fr(`paste: "${l.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const a=this.currentLayer;try{const l=[];for(const p of n){const u=a.deserialize(p);if(!u)return;l.push(u)}const c=()=>{for(const p of l)this.#ee(p);this.#te(l)},d=()=>{for(const p of l)p.remove()};this.addCommands({cmd:c,undo:d,mustExec:!0})}catch(l){Fr(`paste: "${l.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#w!==ii.NONE&&!this.isEditorHandlingKeyboard&&yg._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}#I(t){Object.entries(t).some(([n,a])=>this.#K[n]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#w===ii.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#O([[gr.HIGHLIGHT_FREE,!0]]))}#O(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ne(),this.#J(),this.#I({isEditing:this.#w!==ii.NONE,isEmpty:this.#W(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#X(),this.#I({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#c){this.#c=t;for(const r of this.#c)this.#O(r.defaultPropertiesToUpdate)}}getId(){return this.#v.id}get currentLayer(){return this.#i.get(this.#d)}getLayer(t){return this.#i.get(t)}get currentPageIndex(){return this.#d}addLayer(t){this.#i.set(t.pageIndex,t),this.#A?t.enable():t.disable()}removeLayer(t){this.#i.delete(t.pageIndex)}updateMode(t,r=null,n=!1){if(this.#w!==t){if(this.#w=t,t===ii.NONE){this.setEditingState(!1),this.#de();return}this.setEditingState(!0),this.#ce(),this.unselectAll();for(const a of this.#i.values())a.updateMode(t);if(!r&&n){this.addNewEditorFromKeyboard();return}if(r){for(const a of this.#o.values())if(a.annotationElementId===r){this.setSelected(a),a.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#w&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,r){if(this.#c){switch(t){case gr.CREATE:this.currentLayer.addNewEditor();return;case gr.HIGHLIGHT_DEFAULT_COLOR:this.#j?.updateColor(r);break;case gr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#L||=new Map).set(t,r),this.showAllEditors("highlight",r);break}for(const n of this.#x)n.updateParams(t,r);for(const n of this.#c)n.updateDefaultParams(t,r)}}showAllEditors(t,r,n=!1){for(const l of this.#o.values())l.editorType===t&&l.show(r);(this.#L?.get(gr.HIGHLIGHT_SHOW_ALL)??!0)!==r&&this.#O([[gr.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(t=!1){if(this.#k!==t){this.#k=t;for(const r of this.#i.values())t?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",t)}}#ce(){if(!this.#A){this.#A=!0;for(const t of this.#i.values())t.enable();for(const t of this.#o.values())t.enable()}}#de(){if(this.unselectAll(),this.#A){this.#A=!1;for(const t of this.#i.values())t.disable();for(const t of this.#o.values())t.disable()}}getEditors(t){const r=[];for(const n of this.#o.values())n.pageIndex===t&&r.push(n);return r}getEditor(t){return this.#o.get(t)}addEditor(t){this.#o.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#u&&clearTimeout(this.#u),this.#u=setTimeout(()=>{this.focusMainContainer(),this.#u=null},0)),this.#o.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#p.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#p.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#p.has(t)}removeDeletedAnnotationElement(t){this.#p.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#ee(t){const r=this.#i.get(t.pageIndex);r?r.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#t!==t&&(this.#t=t,t&&this.#O(t.propertiesToUpdate))}get#pe(){let t=null;for(t of this.#x);return t}updateUI(t){this.#pe===t&&this.#O(t.propertiesToUpdate)}toggleSelected(t){if(this.#x.has(t)){this.#x.delete(t),t.unselect(),this.#I({hasSelectedEditor:this.hasSelection});return}this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}setSelected(t){for(const r of this.#x)r!==t&&r.unselect();this.#x.clear(),this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}isSelected(t){return this.#x.has(t)}get firstSelectedEditor(){return this.#x.values().next().value}unselect(t){t.unselect(),this.#x.delete(t),this.#I({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#x.size!==0}get isEnterHandled(){return this.#x.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#I({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#W()})}redo(){this.#l.redo(),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#W()})}addCommands(t){this.#l.add(t),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#W()})}#W(){if(this.#o.size===0)return!0;if(this.#o.size===1)for(const t of this.#o.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#x],r=()=>{for(const a of t)a.remove()},n=()=>{for(const a of t)this.#ee(a)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#te(t){for(const r of this.#x)r.unselect();this.#x.clear();for(const r of t)r.isEmpty()||(this.#x.add(r),r.select());this.#I({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#x)t.commit();this.#te(this.#o.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#w!==ii.NONE))&&this.hasSelection){for(const t of this.#x)t.unselect();this.#x.clear(),this.#I({hasSelectedEditor:!1})}}translateSelectedEditors(t,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=t,this.#V[1]+=r;const[a,l]=this.#V,c=[...this.#x],d=1e3;this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(a,l)},undo:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(-a,-l)},mustExec:!1})},d);for(const p of c)p.translateInPage(t,r)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(const t of this.#x)this.#h.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);const t=this.#h;this.#h=null;let r=!1;for(const[{x:a,y:l,pageIndex:c},d]of t)d.newX=a,d.newY=l,d.newPageIndex=c,r||=a!==d.savedX||l!==d.savedY||c!==d.savedPageIndex;if(!r)return!1;const n=(a,l,c,d)=>{if(this.#o.has(a.id)){const p=this.#i.get(d);p?a._setParentAndPosition(p,l,c):(a.pageIndex=d,a.x=l,a.y=c)}};return this.addCommands({cmd:()=>{for(const[a,{newX:l,newY:c,newPageIndex:d}]of t)n(a,l,c,d)},undo:()=>{for(const[a,{savedX:l,savedY:c,savedPageIndex:d}]of t)n(a,l,c,d)},mustExec:!0}),!0}dragSelectedEditors(t,r){if(this.#h)for(const n of this.#h.keys())n.drag(t,r)}rebuild(t){if(t.parent===null){const r=this.getLayer(t.pageIndex);r?(r.changeParent(t),r.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#x.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#t===t}getActive(){return this.#t}getMode(){return this.#w}get imageManager(){return pi(this,"imageManager",new $X)}getSelectionBoxes(t){if(!t)return null;const r=document.getSelection();for(let u=0,h=r.rangeCount;u<h;u++)if(!t.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:a,width:l,height:c}=t.getBoundingClientRect();let d;switch(t.getAttribute("data-main-rotation")){case"90":d=(u,h,m,f)=>({x:(h-a)/c,y:1-(u+m-n)/l,width:f/c,height:m/l});break;case"180":d=(u,h,m,f)=>({x:1-(u+m-n)/l,y:1-(h+f-a)/c,width:m/l,height:f/c});break;case"270":d=(u,h,m,f)=>({x:1-(h+f-a)/c,y:(u-n)/l,width:f/c,height:m/l});break;default:d=(u,h,m,f)=>({x:(u-n)/l,y:(h-a)/c,width:m/l,height:f/c});break}const p=[];for(let u=0,h=r.rangeCount;u<h;u++){const m=r.getRangeAt(u);if(!m.collapsed)for(const{x:f,y:x,width:y,height:b}of m.getClientRects())y===0||b===0||p.push(d(f,x,y,b))}return p.length===0?null:p}addChangedExistingAnnotation({annotationElementId:t,id:r}){(this.#n||=new Map).set(t,r)}removeChangedExistingAnnotation({annotationElementId:t}){this.#n?.delete(t)}renderAnnotationElement(t){const r=this.#n?.get(t.data.id);if(!r)return;const n=this.#r.getRawValue(r);n&&(this.#w===ii.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}}class s4{#e="";#t=!1;#o=null;#i=null;#s=null;#r=!1;#n=null;static _l10nPromise=null;constructor(t){this.#n=t}static initialize(t){s4._l10nPromise||=t}async render(){const t=this.#o=document.createElement("button");t.className="altText";const r=await s4._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=r,t.setAttribute("aria-label",r),t.tabIndex="0";const n=this.#n._uiManager._signal;t.addEventListener("contextmenu",$c,{signal:n}),t.addEventListener("pointerdown",l=>l.stopPropagation(),{signal:n});const a=l=>{l.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",a,{capture:!0,signal:n}),t.addEventListener("keydown",l=>{l.target===t&&l.key==="Enter"&&(this.#r=!0,a(l))},{signal:n}),await this.#l(),t}finish(){this.#o&&(this.#o.focus({focusVisible:this.#r}),this.#r=!1)}isEmpty(){return!this.#e&&!this.#t}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:t,decorative:r}){this.#e===t&&this.#t===r||(this.#e=t,this.#t=r,this.#l())}toggle(t=!1){this.#o&&(!t&&this.#s&&(clearTimeout(this.#s),this.#s=null),this.#o.disabled=!t)}destroy(){this.#o?.remove(),this.#o=null,this.#i=null}async#l(){const t=this.#o;if(!t)return;if(!this.#e&&!this.#t){t.classList.remove("done"),this.#i?.remove();return}t.classList.add("done"),s4._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(a=>{t.setAttribute("aria-label",a)});let r=this.#i;if(!r){this.#i=r=document.createElement("span"),r.className="tooltip",r.setAttribute("role","tooltip");const a=r.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",a);const l=100,c=this.#n._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(this.#s),this.#s=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#i.classList.add("show"),this.#n._reportTelemetry({action:"alt_text_tooltip"})},l)},{signal:c}),t.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:c})}r.innerText=this.#t?await s4._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#e,r.parentNode||t.append(r),this.#n.getImageForAltText()?.setAttribute("aria-describedby",r.id)}}class pr{#e=null;#t=null;#o=null;#i=!1;#s=!1;#r=null;#n=null;#l=this.focusin.bind(this);#d=this.focusout.bind(this);#p=null;#h="";#c=!1;#a=null;#m=!1;#f=!1;#u=!1;#y=null;#g=0;#b=0;#v=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#A=!1;#k=pr._zIndex++;static _borderLineWidth=-1;static _colorManager=new kX;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=pr.prototype._resizeWithKeyboard,r=yg.TRANSLATE_SMALL,n=yg.TRANSLATE_BIG;return pi(this,"_resizerKeyboardManager",new mC([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],pr.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===pr&&Gi("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:r,rawDims:{pageWidth:n,pageHeight:a,pageX:l,pageY:c}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,a],this.pageTranslation=[l,c];const[d,p]=this.parentDimensions;this.x=t.x/d,this.y=t.y/p,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return pi(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const r=new AOt({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});r.annotationElementId=t.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(t,r,n){if(pr._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(l=>[l,t.get(l.replaceAll(/([A-Z])/g,c=>`-${c.toLowerCase()}`))])),n?.strings)for(const l of n.strings)pr._l10nPromise.set(l,t.get(l));if(pr._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);pr._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,r){Gi("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#A}set _isDraggable(t){this.#A=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(t*2),this.y+=this.width*t/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(t*2),this.y-=this.width*t/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#k}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#D(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#c?this.#c=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,r,n,a){const[l,c]=this.parentDimensions;[n,a]=this.screenToPageTranslation(n,a),this.x=(t+n)/l,this.y=(r+a)/c,this.fixAndSetPosition()}#S([t,r],n,a){[n,a]=this.screenToPageTranslation(n,a),this.x+=n/t,this.y+=a/r,this.fixAndSetPosition()}translate(t,r){this.#S(this.parentDimensions,t,r)}translateInPage(t,r){this.#a||=[this.x,this.y],this.#S(this.pageDimensions,t,r),this.div.scrollIntoView({block:"nearest"})}drag(t,r){this.#a||=[this.x,this.y];const[n,a]=this.parentDimensions;if(this.x+=t/n,this.y+=r/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:l,y:c}=this;const[d,p]=this.getBaseTranslation();l+=d,c+=p,this.div.style.left=`${(100*l).toFixed(2)}%`,this.div.style.top=`${(100*c).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#a&&(this.#a[0]!==this.x||this.#a[1]!==this.y)}getBaseTranslation(){const[t,r]=this.parentDimensions,{_borderLineWidth:n}=pr,a=n/t,l=n/r;switch(this.rotation){case 90:return[-a,l];case 180:return[a,l];case 270:return[a,-l];default:return[-a,-l]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[r,n]=this.pageDimensions;let{x:a,y:l,width:c,height:d}=this;if(c*=r,d*=n,a*=r,l*=n,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(r-c,a)),l=Math.max(0,Math.min(n-d,l));break;case 90:a=Math.max(0,Math.min(r-d,a)),l=Math.min(n,Math.max(c,l));break;case 180:a=Math.min(r,Math.max(c,a)),l=Math.min(n,Math.max(d,l));break;case 270:a=Math.min(r,Math.max(d,a)),l=Math.max(0,Math.min(n-c,l));break}this.x=a/=r,this.y=l/=n;const[p,u]=this.getBaseTranslation();a+=p,l+=u;const{style:h}=this.div;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this.moveInDOM()}static#j(t,r,n){switch(n){case 90:return[r,-t];case 180:return[-t,-r];case 270:return[-r,t];default:return[t,r]}}screenToPageTranslation(t,r){return pr.#j(t,r,this.parentRotation)}pageTranslationToScreen(t,r){return pr.#j(t,r,360-this.parentRotation)}#$(t){switch(t){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[r,n]}=this,a=r*t,l=n*t;return yc.isCSSRoundSupported?[Math.round(a),Math.round(l)]:[a,l]}setDims(t,r){const[n,a]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*r/a).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:r,width:n}=t,a=n.endsWith("%"),l=!this.#s&&r.endsWith("%");if(a&&l)return;const[c,d]=this.parentDimensions;a||(t.width=`${(100*parseFloat(n)/c).toFixed(2)}%`),!this.#s&&!l&&(t.height=`${(100*parseFloat(r)/d).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#w(){if(this.#r)return;this.#r=document.createElement("div"),this.#r.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of t){const a=document.createElement("div");this.#r.append(a),a.classList.add("resizer",n),a.setAttribute("data-resizer-name",n),a.addEventListener("pointerdown",this.#x.bind(this,n),{signal:r}),a.addEventListener("contextmenu",$c,{signal:r}),a.tabIndex=-1}this.div.prepend(this.#r)}#x(t,r){r.preventDefault();const{isMac:n}=yc.platform;if(r.button!==0||r.ctrlKey&&n)return;this.#o?.toggle(!1);const a=this.#E.bind(this,t),l=this._isDraggable;this._isDraggable=!1;const c=this._uiManager._signal,d={passive:!0,capture:!0,signal:c};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",a,d),window.addEventListener("contextmenu",$c,{signal:c});const p=this.x,u=this.y,h=this.width,m=this.height,f=this.parent.div.style.cursor,x=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(r.target).cursor;const y=()=>{this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=l,window.removeEventListener("pointerup",y),window.removeEventListener("blur",y),window.removeEventListener("pointermove",a,d),window.removeEventListener("contextmenu",$c),this.parent.div.style.cursor=f,this.div.style.cursor=x,this.#C(p,u,h,m)};window.addEventListener("pointerup",y,{signal:c}),window.addEventListener("blur",y,{signal:c})}#C(t,r,n,a){const l=this.x,c=this.y,d=this.width,p=this.height;l===t&&c===r&&d===n&&p===a||this.addCommands({cmd:()=>{this.width=d,this.height=p,this.x=l,this.y=c;const[u,h]=this.parentDimensions;this.setDims(u*d,h*p),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=a,this.x=t,this.y=r;const[u,h]=this.parentDimensions;this.setDims(u*n,h*a),this.fixAndSetPosition()},mustExec:!0})}#E(t,r){const[n,a]=this.parentDimensions,l=this.x,c=this.y,d=this.width,p=this.height,u=pr.MIN_SIZE/n,h=pr.MIN_SIZE/a,m=V=>Math.round(V*1e4)/1e4,f=this.#$(this.rotation),x=(V,O)=>[f[0]*V+f[2]*O,f[1]*V+f[3]*O],y=this.#$(360-this.rotation),b=(V,O)=>[y[0]*V+y[2]*O,y[1]*V+y[3]*O];let w,v,A=!1,S=!1;switch(t){case"topLeft":A=!0,w=(V,O)=>[0,0],v=(V,O)=>[V,O];break;case"topMiddle":w=(V,O)=>[V/2,0],v=(V,O)=>[V/2,O];break;case"topRight":A=!0,w=(V,O)=>[V,0],v=(V,O)=>[0,O];break;case"middleRight":S=!0,w=(V,O)=>[V,O/2],v=(V,O)=>[0,O/2];break;case"bottomRight":A=!0,w=(V,O)=>[V,O],v=(V,O)=>[0,0];break;case"bottomMiddle":w=(V,O)=>[V/2,O],v=(V,O)=>[V/2,0];break;case"bottomLeft":A=!0,w=(V,O)=>[0,O],v=(V,O)=>[V,0];break;case"middleLeft":S=!0,w=(V,O)=>[0,O/2],v=(V,O)=>[V,O/2];break}const E=w(d,p),I=v(d,p);let L=x(...I);const B=m(l+L[0]),D=m(c+L[1]);let M=1,T=1,[R,N]=this.screenToPageTranslation(r.movementX,r.movementY);if([R,N]=b(R/n,N/a),A){const V=Math.hypot(d,p);M=T=Math.max(Math.min(Math.hypot(I[0]-E[0]-R,I[1]-E[1]-N)/V,1/d,1/p),u/d,h/p)}else S?M=Math.max(u,Math.min(1,Math.abs(I[0]-E[0]-R)))/d:T=Math.max(h,Math.min(1,Math.abs(I[1]-E[1]-N)))/p;const K=m(d*M),q=m(p*T);L=x(...v(K,q));const F=B-L[0],_=D-L[1];this.width=K,this.height=q,this.x=F,this.y=_,this.setDims(n*K,a*q),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this.#p||this.#f?this.#p:(this.#p=new AX(this),this.div.append(this.#p.render()),this.#o&&this.#p.addAltTextButton(await this.#o.render()),this.#p)}removeEditToolbar(){this.#p&&(this.#p.remove(),this.#p=null,this.#o?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(s4.initialize(pr._l10nPromise),this.#o=new s4(this),this.#e&&(this.#o.data=this.#e,this.#e=null),await this.addEditToolbar())}get altTextData(){return this.#o?.data}set altTextData(t){this.#o&&(this.#o.data=t)}hasAltText(){return!this.#o?.isEmpty()}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#i?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",this.#l,{signal:t}),this.div.addEventListener("focusout",this.#d,{signal:t});const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*n/r).toFixed(2)}%`,this.div.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[a,l]=this.getInitialTranslation();return this.translate(a,l),ML(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:r}=yc.platform;if(t.button!==0||t.ctrlKey&&r){t.preventDefault();return}if(this.#c=!0,this._isDraggable){this.#B(t);return}this.#L(t)}#L(t){const{isMac:r}=yc.platform;t.ctrlKey&&!r||t.shiftKey||t.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)}#B(t){const r=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,a;const l=this._uiManager._signal;r&&(this.div.classList.add("moving"),n={passive:!0,capture:!0,signal:l},this.#g=t.clientX,this.#b=t.clientY,a=d=>{const{clientX:p,clientY:u}=d,[h,m]=this.screenToPageTranslation(p-this.#g,u-this.#b);this.#g=p,this.#b=u,this._uiManager.dragSelectedEditors(h,m)},window.addEventListener("pointermove",a,n));const c=()=>{window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),r&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",a,n)),this.#c=!1,this._uiManager.endDragSession()||this.#L(t)};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,r,n){t.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition()}getRect(t,r,n=this.rotation){const a=this.parentScale,[l,c]=this.pageDimensions,[d,p]=this.pageTranslation,u=t/a,h=r/a,m=this.x*l,f=this.y*c,x=this.width*l,y=this.height*c;switch(n){case 0:return[m+u+d,c-f-h-y+p,m+u+x+d,c-f-h+p];case 90:return[m+h+d,c-f+u+p,m+h+y+d,c-f+u+x+p];case 180:return[m-u-x+d,c-f+h+p,m-u+d,c-f+h+y+p];case 270:return[m-h-y+d,c-f-u-x+p,m-h+d,c-f-u+p];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,r){const[n,a,l,c]=t,d=l-n,p=c-a;switch(this.rotation){case 0:return[n,r-c,d,p];case 90:return[n,r-a,p,d];case 180:return[l,r-a,d,p];case 270:return[l,r-c,p,d];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#f=!0}disableEditMode(){this.#f=!1}isInEditMode(){return this.#f}shouldGetKeyboardEvents(){return this.#u}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){const t=this._uiManager._signal;this.div?.addEventListener("focusin",this.#l,{signal:t}),this.div?.addEventListener("focusout",this.#d,{signal:t})}rotate(t){}serialize(t=!1,r=null){Gi("An editor must be serializable")}static deserialize(t,r,n){const a=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n});a.rotation=t.rotation,a.#e=t.accessibilityData;const[l,c]=a.pageDimensions,[d,p,u,h]=a.getRectInCurrentCoords(t.rect,c);return a.x=d/l,a.y=p/c,a.width=u/l,a.height=h/c,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#d),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#D(),this.removeEditToolbar(),this.#v){for(const t of this.#v.values())clearTimeout(t);this.#v=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#w(),this.#r.classList.remove("hidden"),ML(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#n={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const r=this.#r.children;if(!this.#t){this.#t=Array.from(r);const c=this.#M.bind(this),d=this.#T.bind(this),p=this._uiManager._signal;for(const u of this.#t){const h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",c,{signal:p}),u.addEventListener("blur",d,{signal:p}),u.addEventListener("focus",this.#P.bind(this,h),{signal:p}),pr._l10nPromise.get(`pdfjs-editor-resizer-label-${h}`).then(m=>u.setAttribute("aria-label",m))}}const n=this.#t[0];let a=0;for(const c of r){if(c===n)break;a++}const l=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(l!==a){if(l<a)for(let d=0;d<a-l;d++)this.#r.append(this.#r.firstChild);else if(l>a)for(let d=0;d<l-a;d++)this.#r.firstChild.before(this.#r.lastChild);let c=0;for(const d of r){const u=this.#t[c++].getAttribute("data-resizer-name");pr._l10nPromise.get(`pdfjs-editor-resizer-label-${u}`).then(h=>d.setAttribute("aria-label",h))}}this.#z(0),this.#u=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#M(t){pr._resizerKeyboardManager.exec(this,t)}#T(t){this.#u&&t.relatedTarget?.parentNode!==this.#r&&this.#D()}#P(t){this.#h=this.#u?t:""}#z(t){if(this.#t)for(const r of this.#t)r.tabIndex=t}_resizeWithKeyboard(t,r){this.#u&&this.#E(this.#h,{movementX:t,movementY:r})}#D(){if(this.#u=!1,this.#z(-1),this.#n){const{savedX:t,savedY:r,savedWidth:n,savedHeight:a}=this.#n;this.#C(t,r,n,a),this.#n=null}}_stopResizingWithKeyboard(){this.#D(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#p){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#p?.show()});return}this.#p?.show()}unselect(){this.#r?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#p?.hide()}updateParams(t,r){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#m}set isEditing(t){this.#m=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,r){this.#s=!0;const n=t/r,{style:a}=this.div;a.aspectRatio=n,a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,r=!1){if(r){this.#v||=new Map;const{action:n}=t;let a=this.#v.get(n);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),this.#v.delete(n),this.#v.size===0&&(this.#v=null)},pr._telemetryTimeout),this.#v.set(n,a);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#i=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#i=!0}renderAnnotationElement(t){let r=t.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),t.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(t){const{firstChild:r}=t.container;r.nodeName==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}}class AOt extends pr{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const gme=3285377520,Pd=4294901760,Bu=65535;class Oze{constructor(t){this.h1=t?t&4294967295:gme,this.h2=t?t&4294967295:gme}update(t){let r,n;if(typeof t=="string"){r=new Uint8Array(t.length*2),n=0;for(let b=0,w=t.length;b<w;b++){const v=t.charCodeAt(b);v<=255?r[n++]=v:(r[n++]=v>>>8,r[n++]=v&255)}}else if(ArrayBuffer.isView(t))r=t.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=n>>2,l=n-a*4,c=new Uint32Array(r.buffer,0,a);let d=0,p=0,u=this.h1,h=this.h2;const m=3432918353,f=461845907,x=m&Bu,y=f&Bu;for(let b=0;b<a;b++)b&1?(d=c[b],d=d*m&Pd|d*x&Bu,d=d<<15|d>>>17,d=d*f&Pd|d*y&Bu,u^=d,u=u<<13|u>>>19,u=u*5+3864292196):(p=c[b],p=p*m&Pd|p*x&Bu,p=p<<15|p>>>17,p=p*f&Pd|p*y&Bu,h^=p,h=h<<13|h>>>19,h=h*5+3864292196);switch(d=0,l){case 3:d^=r[a*4+2]<<16;case 2:d^=r[a*4+1]<<8;case 1:d^=r[a*4],d=d*m&Pd|d*x&Bu,d=d<<15|d>>>17,d=d*f&Pd|d*y&Bu,a&1?u^=d:h^=d}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,r=this.h2;return t^=r>>>1,t=t*3981806797&Pd|t*36045&Bu,r=r*4283543511&Pd|((r<<16|t>>>16)*2950163797&Pd)>>>16,t^=r>>>1,t=t*444984403&Pd|t*60499&Bu,r=r*3301882366&Pd|((r<<16|t>>>16)*3120437893&Pd)>>>16,t^=r>>>1,(t>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const AY=Object.freeze({map:null,hash:"",transfer:void 0});class SX{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,r){const n=this.#t.get(t);return n===void 0?r:Object.assign(r,n)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const r of this.#t.values())if(r instanceof pr)return;this.onAnnotationEditor(null)}}setValue(t,r){const n=this.#t.get(t);let a=!1;if(n!==void 0)for(const[l,c]of Object.entries(r))n[l]!==c&&(a=!0,n[l]=c);else a=!0,this.#t.set(t,r);a&&this.#o(),r instanceof pr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?fX(this.#t):null}setAll(t){for(const[r,n]of Object.entries(t))this.setValue(r,n)}get size(){return this.#t.size}#o(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Nze(this)}get serializable(){if(this.#t.size===0)return AY;const t=new Map,r=new Oze,n=[],a=Object.create(null);let l=!1;for(const[c,d]of this.#t){const p=d instanceof pr?d.serialize(!1,a):d;p&&(t.set(c,p),r.update(`${c}:${JSON.stringify(p)}`),l||=!!p.bitmap)}if(l)for(const c of t.values())c.bitmap&&n.push(c.bitmap);return t.size>0?{map:t,hash:r.hexdigest(),transfer:n}:AY}get editorStats(){let t=null;const r=new Map;for(const n of this.#t.values()){if(!(n instanceof pr))continue;const a=n.telemetryFinalData;if(!a)continue;const{type:l}=a;r.has(l)||r.set(l,Object.getPrototypeOf(n).constructor),t||=Object.create(null);const c=t[l]||=new Map;for(const[d,p]of Object.entries(a)){if(d==="type")continue;let u=c.get(d);u||(u=new Map,c.set(d,u));const h=u.get(p)??0;u.set(p,h+1)}}for(const[n,a]of r)t[n]=a.computeTelemetryFinalData(t[n]);return t}}class Nze extends SX{#e;constructor(t){super();const{map:r,hash:n,transfer:a}=t.serializable,l=structuredClone(r,a?{transfer:a}:null);this.#e={map:l,hash:n,transfer:a}}get print(){Gi("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}class $Ot{#e=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:r=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const r=this.styleElement.sheet;r.insertRule(t,r.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:r}){if(!(!t||this.#e.has(t.loadedName))){if(Ua(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:a,style:l}=t,c=new FontFace(n,a,l);this.addNativeFontFace(c);try{await c.load(),this.#e.add(n),r?.(t)}catch{Fr(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(c)}return}Gi("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(a){throw Fr(`Failed to load font '${n.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const r=t.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const a=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return pi(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(ll||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),pi(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function r(){for(Ua(!a.done,"completeRequest() cannot be called twice."),a.done=!0;n.length>0&&n[0].done;){const l=n.shift();setTimeout(l.callback,0)}}const{loadingRequests:n}=this,a={done:!1,complete:r,callback:t};return n.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return pi(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,r){function n(E,I){return E.charCodeAt(I)<<24|E.charCodeAt(I+1)<<16|E.charCodeAt(I+2)<<8|E.charCodeAt(I+3)&255}function a(E,I,L,B){const D=E.substring(0,I),M=E.substring(I+L);return D+B+M}let l,c;const d=this._document.createElement("canvas");d.width=1,d.height=1;const p=d.getContext("2d");let u=0;function h(E,I){if(++u>30){Fr("Load test font never loaded."),I();return}if(p.font="30px "+E,p.fillText(".",0,20),p.getImageData(0,0,1,1).data[3]>0){I();return}setTimeout(h.bind(null,E,I))}const m=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=a(f,976,m.length,m);const y=16,b=1482184792;let w=n(f,y);for(l=0,c=m.length-3;l<c;l+=4)w=w-b+n(m,l)|0;l<m.length&&(w=w-b+n(m+"XXX",l)|0),f=a(f,y,4,sOt(w));const v=`url(data:font/opentype;base64,${btoa(f)});`,A=`@font-face {font-family:"${m}";src:${v}}`;this.insertRule(A);const S=this._document.createElement("div");S.style.visibility="hidden",S.style.width=S.style.height="10px",S.style.position="absolute",S.style.top=S.style.left="0px";for(const E of[t.loadedName,m]){const I=this._document.createElement("span");I.textContent="Hi",I.style.fontFamily=E,S.append(I)}this._document.body.append(S),h(m,()=>{S.remove(),r.complete()})}}class kOt{constructor(t,{disableFontFace:r=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.disableFontFace=r===!0,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=Pze(this.data),r=`url(data:${this.mimetype};base64,${btoa(t)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${r}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${r}}`}return this._inspectFont?.(this,r),n}getPathGenerator(t,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];let n;try{n=t.get(this.loadedName+"_path_"+r)}catch(l){Fr(`getPathGenerator - ignoring character: "${l}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[r]=function(l,c){};const a=[];for(let l=0,c=n.length;l<c;)switch(n[l++]){case f0.BEZIER_CURVE_TO:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.bezierCurveTo(d,p,u,h,m,f)),l+=6}break;case f0.MOVE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.moveTo(d,p)),l+=2}break;case f0.LINE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.lineTo(d,p)),l+=2}break;case f0.QUADRATIC_CURVE_TO:{const[d,p,u,h]=n.slice(l,l+4);a.push(m=>m.quadraticCurveTo(d,p,u,h)),l+=4}break;case f0.RESTORE:a.push(d=>d.restore());break;case f0.SAVE:a.push(d=>d.save());break;case f0.SCALE:Ua(a.length===2,"Scale command is only valid at the third position.");break;case f0.TRANSFORM:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.transform(d,p,u,h,m,f)),l+=6}break;case f0.TRANSLATE:{const[d,p]=n.slice(l,l+2);a.push(u=>u.translate(d,p)),l+=2}break}return this.compiledGlyphs[r]=function(c,d){a[0](c),a[1](c),c.scale(d,-d);for(let p=2,u=a.length;p<u;p++)a[p](c)}}}if(ll){var $Y=Promise.withResolvers(),kY=null;(async()=>{const t=await Xf(()=>import("./empty-uYhbfvaB.js").then(d=>d.e),__vite__mapDeps([0,1,2])),r=await Xf(()=>import("./index-CqGS07ri.js").then(d=>d.i),__vite__mapDeps([3,1,4,5,6,7,8,9])),n=await Xf(()=>import("./index-CCd3lqis.js").then(d=>d.i),__vite__mapDeps([10,1,11,4,5,6,7,8,9])),a=await Xf(()=>import("./url-BLdTFROI.js").then(d=>d.u),__vite__mapDeps([12,1,9,7,5,6,8]));let l,c;return new Map(Object.entries({fs:t,http:r,https:n,url:a,canvas:l,path2d:c}))})().then(t=>{kY=t,$Y.resolve()},t=>{Fr(`loadPackages: ${t}`),kY=new Map,$Y.resolve()})}class Dh{static get promise(){return $Y.promise}static get(t){return kY?.get(t)}}const Hze=function(e){return Dh.get("fs").promises.readFile(e).then(r=>new Uint8Array(r))};class SOt extends BM{}class EOt extends PM{_createCanvas(t,r){return Dh.get("canvas").createCanvas(t,r)}}class LOt extends DM{_fetchData(t,r){return Hze(t).then(n=>({cMapData:n,compressionType:r}))}}class IOt extends TM{_fetchData(t){return Hze(t)}}const Tl={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function SY(e,t){if(!t)return;const r=t[2]-t[0],n=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],r,n),e.clip(a)}class gC{constructor(){this.constructor===gC&&Gi("Cannot initialize BaseShadingPattern.")}getPattern(){Gi("Abstract method `getPattern` called.")}}class jOt extends gC{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let r;this._type==="axial"?r=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(t,r,n,a){let l;if(a===Tl.STROKE||a===Tl.FILL){const c=r.current.getClippedPathBoundingBox(a,Pn(t))||[0,0,0,0],d=Math.ceil(c[2]-c[0])||1,p=Math.ceil(c[3]-c[1])||1,u=r.cachedCanvases.getCanvas("pattern",d,p,!0),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-c[0],-c[1]),n=jo.transform(n,[1,0,0,1,c[0],c[1]]),h.transform(...r.baseTransform),this.matrix&&h.transform(...this.matrix),SY(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),l=t.createPattern(u.canvas,"no-repeat");const m=new DOMMatrix(n);l.setTransform(m)}else SY(t,this._bbox),l=this._createGradient(t);return l}}function r_(e,t,r,n,a,l,c,d){const p=t.coords,u=t.colors,h=e.data,m=e.width*4;let f;p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f),p[n+1]>p[a+1]&&(f=n,n=a,a=f,f=c,c=d,d=f),p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f);const x=(p[r]+t.offsetX)*t.scaleX,y=(p[r+1]+t.offsetY)*t.scaleY,b=(p[n]+t.offsetX)*t.scaleX,w=(p[n+1]+t.offsetY)*t.scaleY,v=(p[a]+t.offsetX)*t.scaleX,A=(p[a+1]+t.offsetY)*t.scaleY;if(y>=A)return;const S=u[l],E=u[l+1],I=u[l+2],L=u[c],B=u[c+1],D=u[c+2],M=u[d],T=u[d+1],R=u[d+2],N=Math.round(y),K=Math.round(A);let q,F,_,V,O,z,H,X;for(let Y=N;Y<=K;Y++){if(Y<w){const xe=Y<y?0:(y-Y)/(y-w);q=x-(x-b)*xe,F=S-(S-L)*xe,_=E-(E-B)*xe,V=I-(I-D)*xe}else{let xe;Y>A?xe=1:w===A?xe=0:xe=(w-Y)/(w-A),q=b-(b-v)*xe,F=L-(L-M)*xe,_=B-(B-T)*xe,V=D-(D-R)*xe}let G;Y<y?G=0:Y>A?G=1:G=(y-Y)/(y-A),O=x-(x-v)*G,z=S-(S-M)*G,H=E-(E-T)*G,X=I-(I-R)*G;const ee=Math.round(Math.min(q,O)),J=Math.round(Math.max(q,O));let ne=m*Y+ee*4;for(let xe=ee;xe<=J;xe++)G=(q-xe)/(q-O),G<0?G=0:G>1&&(G=1),h[ne++]=F-(F-z)*G|0,h[ne++]=_-(_-H)*G|0,h[ne++]=V-(V-X)*G|0,h[ne++]=255}}function MOt(e,t,r){const n=t.coords,a=t.colors;let l,c;switch(t.type){case"lattice":const d=t.verticesPerRow,p=Math.floor(n.length/d)-1,u=d-1;for(l=0;l<p;l++){let h=l*d;for(let m=0;m<u;m++,h++)r_(e,r,n[h],n[h+1],n[h+d],a[h],a[h+1],a[h+d]),r_(e,r,n[h+d+1],n[h+1],n[h+d],a[h+d+1],a[h+1],a[h+d])}break;case"triangles":for(l=0,c=n.length;l<c;l+=3)r_(e,r,n[l],n[l+1],n[l+2],a[l],a[l+1],a[l+2]);break;default:throw new Error("illegal figure")}}class BOt extends gC{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,r,n){const d=Math.floor(this._bounds[0]),p=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-d,h=Math.ceil(this._bounds[3])-p,m=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),x=u/m,y=h/f,b={coords:this._coords,colors:this._colors,offsetX:-d,offsetY:-p,scaleX:1/x,scaleY:1/y},w=m+4,v=f+4,A=n.getCanvas("mesh",w,v,!1),S=A.context,E=S.createImageData(m,f);if(r){const L=E.data;for(let B=0,D=L.length;B<D;B+=4)L[B]=r[0],L[B+1]=r[1],L[B+2]=r[2],L[B+3]=255}for(const L of this._figures)MOt(E,L,b);return S.putImageData(E,2,2),{canvas:A.canvas,offsetX:d-2*x,offsetY:p-2*y,scaleX:x,scaleY:y}}getPattern(t,r,n,a){SY(t,this._bbox);let l;if(a===Tl.SHADING)l=jo.singularValueDecompose2dScale(Pn(t));else if(l=jo.singularValueDecompose2dScale(r.baseTransform),this.matrix){const d=jo.singularValueDecompose2dScale(this.matrix);l=[l[0]*d[0],l[1]*d[1]]}const c=this._createMeshCanvas(l,a===Tl.SHADING?null:this._background,r.cachedCanvases);return a!==Tl.SHADING&&(t.setTransform(...r.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(c.offsetX,c.offsetY),t.scale(c.scaleX,c.scaleY),t.createPattern(c.canvas,"no-repeat")}}class POt extends gC{getPattern(){return"hotpink"}}function DOt(e){switch(e[0]){case"RadialAxial":return new jOt(e);case"Mesh":return new BOt(e);case"Dummy":return new POt}throw new Error(`Unknown IR type: ${e[0]}`)}const fme={COLORED:1,UNCOLORED:2};class EX{static MAX_PATTERN_SIZE=3e3;constructor(t,r,n,a,l){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=r,this.ctx=n,this.canvasGraphicsFactory=a,this.baseTransform=l}createPatternCanvas(t){const r=this.operatorList,n=this.bbox,a=this.xstep,l=this.ystep,c=this.paintType,d=this.tilingType,p=this.color,u=this.canvasGraphicsFactory;IM("TilingType: "+d);const h=n[0],m=n[1],f=n[2],x=n[3],y=jo.singularValueDecompose2dScale(this.matrix),b=jo.singularValueDecompose2dScale(this.baseTransform),w=[y[0]*b[0],y[1]*b[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,w[0]),A=this.getSizeAndScale(l,this.ctx.canvas.height,w[1]),S=t.cachedCanvases.getCanvas("pattern",v.size,A.size,!0),E=S.context,I=u.createCanvasGraphics(E);I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,c,p);let L=h,B=m,D=f,M=x;return h<0&&(L=0,D+=Math.abs(h)),m<0&&(B=0,M+=Math.abs(m)),E.translate(-(v.scale*L),-(A.scale*B)),I.transform(v.scale,0,0,A.scale,0,0),E.save(),this.clipBbox(I,L,B,D,M),I.baseTransform=Pn(I.ctx),I.executeOperatorList(r),I.endDrawing(),{canvas:S.canvas,scaleX:v.scale,scaleY:A.scale,offsetX:L,offsetY:B}}getSizeAndScale(t,r,n){t=Math.abs(t);const a=Math.max(EX.MAX_PATTERN_SIZE,r);let l=Math.ceil(t*n);return l>=a?l=a:n=l/t,{scale:n,size:l}}clipBbox(t,r,n,a,l){const c=a-r,d=l-n;t.ctx.rect(r,n,c,d),t.current.updateRectMinMax(Pn(t.ctx),[r,n,a,l]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,r,n){const a=t.ctx,l=t.current;switch(r){case fme.COLORED:const c=this.ctx;a.fillStyle=c.fillStyle,a.strokeStyle=c.strokeStyle,l.fillColor=c.fillStyle,l.strokeColor=c.strokeStyle;break;case fme.UNCOLORED:const d=jo.makeHexColor(n[0],n[1],n[2]);a.fillStyle=d,a.strokeStyle=d,l.fillColor=d,l.strokeColor=d;break;default:throw new aOt(`Unsupported paint type: ${r}`)}}getPattern(t,r,n,a){let l=n;a!==Tl.SHADING&&(l=jo.transform(l,r.baseTransform),this.matrix&&(l=jo.transform(l,this.matrix)));const c=this.createPatternCanvas(r);let d=new DOMMatrix(l);d=d.translate(c.offsetX,c.offsetY),d=d.scale(1/c.scaleX,1/c.scaleY);const p=t.createPattern(c.canvas,"repeat");return p.setTransform(d),p}}function TOt({src:e,srcPos:t=0,dest:r,width:n,height:a,nonBlackColor:l=4294967295,inverseDecode:c=!1}){const d=yc.isLittleEndian?4278190080:255,[p,u]=c?[l,d]:[d,l],h=n>>3,m=n&7,f=e.length;r=new Uint32Array(r.buffer);let x=0;for(let y=0;y<a;y++){for(const w=t+h;t<w;t++){const v=t<f?e[t]:255;r[x++]=v&128?u:p,r[x++]=v&64?u:p,r[x++]=v&32?u:p,r[x++]=v&16?u:p,r[x++]=v&8?u:p,r[x++]=v&4?u:p,r[x++]=v&2?u:p,r[x++]=v&1?u:p}if(m===0)continue;const b=t<f?e[t++]:255;for(let w=0;w<m;w++)r[x++]=b&1<<7-w?u:p}return{srcPos:t,destPos:x}}const xme=16,yme=100,zOt=15,bme=10,wme=1e3,sc=16;function ROt(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(n,a){t.translate(n,a),this.__originalTranslate(n,a)},e.scale=function(n,a){t.scale(n,a),this.__originalScale(n,a)},e.transform=function(n,a,l,c,d,p){t.transform(n,a,l,c,d,p),this.__originalTransform(n,a,l,c,d,p)},e.setTransform=function(n,a,l,c,d,p){t.setTransform(n,a,l,c,d,p),this.__originalSetTransform(n,a,l,c,d,p)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(n){t.rotate(n),this.__originalRotate(n)},e.clip=function(n){t.clip(n),this.__originalClip(n)},e.moveTo=function(r,n){t.moveTo(r,n),this.__originalMoveTo(r,n)},e.lineTo=function(r,n){t.lineTo(r,n),this.__originalLineTo(r,n)},e.bezierCurveTo=function(r,n,a,l,c,d){t.bezierCurveTo(r,n,a,l,c,d),this.__originalBezierCurveTo(r,n,a,l,c,d)},e.rect=function(r,n,a,l){t.rect(r,n,a,l),this.__originalRect(r,n,a,l)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class FOt{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,r,n){let a;return this.cache[t]!==void 0?(a=this.cache[t],this.canvasFactory.reset(a,r,n)):(a=this.canvasFactory.create(r,n),this.cache[t]=a),a}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const r=this.cache[t];this.canvasFactory.destroy(r),delete this.cache[t]}}}function m$(e,t,r,n,a,l,c,d,p,u){const[h,m,f,x,y,b]=Pn(e);if(m===0&&f===0){const A=c*h+y,S=Math.round(A),E=d*x+b,I=Math.round(E),L=(c+p)*h+y,B=Math.abs(Math.round(L)-S)||1,D=(d+u)*x+b,M=Math.abs(Math.round(D)-I)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(x),S,I),e.drawImage(t,r,n,a,l,0,0,B,M),e.setTransform(h,m,f,x,y,b),[B,M]}if(h===0&&x===0){const A=d*f+y,S=Math.round(A),E=c*m+b,I=Math.round(E),L=(d+u)*f+y,B=Math.abs(Math.round(L)-S)||1,D=(c+p)*m+b,M=Math.abs(Math.round(D)-I)||1;return e.setTransform(0,Math.sign(m),Math.sign(f),0,S,I),e.drawImage(t,r,n,a,l,0,0,M,B),e.setTransform(h,m,f,x,y,b),[M,B]}e.drawImage(t,r,n,a,l,c,d,p,u);const w=Math.hypot(h,m),v=Math.hypot(f,x);return[w*p,v*u]}function OOt(e){const{width:t,height:r}=e;if(t>wme||r>wme)return null;const n=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=t+1;let c=new Uint8Array(l*(r+1)),d,p,u;const h=t+7&-8;let m=new Uint8Array(h*r),f=0;for(const v of e.data){let A=128;for(;A>0;)m[f++]=v&A?0:255,A>>=1}let x=0;for(f=0,m[f]!==0&&(c[0]=1,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[p]=m[f]?2:1,++x),f++;for(m[f]!==0&&(c[p]=2,++x),d=1;d<r;d++){f=d*h,u=d*l,m[f-h]!==m[f]&&(c[u]=m[f]?1:8,++x);let v=(m[f]?4:0)+(m[f-h]?8:0);for(p=1;p<t;p++)v=(v>>2)+(m[f+1]?4:0)+(m[f-h+1]?8:0),a[v]&&(c[u+p]=a[v],++x),f++;if(m[f-h]!==m[f]&&(c[u+p]=m[f]?2:4,++x),x>n)return null}for(f=h*(r-1),u=d*l,m[f]!==0&&(c[u]=8,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[u+p]=m[f]?4:8,++x),f++;if(m[f]!==0&&(c[u+p]=4,++x),x>n)return null;const y=new Int32Array([0,l,-1,0,-l,0,0,0,1]),b=new Path2D;for(d=0;x&&d<=r;d++){let v=d*l;const A=v+t;for(;v<A&&!c[v];)v++;if(v===A)continue;b.moveTo(v%l,d);const S=v;let E=c[v];do{const I=y[E];do v+=I;while(!c[v]);const L=c[v];L!==5&&L!==10?(E=L,c[v]=0):(E=L&51*E>>4,c[v]&=E>>2|E<<2),b.lineTo(v%l,v/l|0),c[v]||--x}while(S!==v);--d}return m=null,c=null,function(v){v.save(),v.scale(1/t,-1/r),v.translate(0,-r),v.fill(b),v.beginPath(),v.restore()}}class vme{constructor(t,r){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Mze,this.textMatrixScale=1,this.fontMatrix=bY,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=Xs.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,r])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,r){this.x=t,this.y=r}updatePathMinMax(t,r,n){[r,n]=jo.applyTransform([r,n],t),this.minX=Math.min(this.minX,r),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,r),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(t,r){const n=jo.applyTransform(r,t),a=jo.applyTransform(r.slice(2),t),l=jo.applyTransform([r[0],r[3]],t),c=jo.applyTransform([r[2],r[1]],t);this.minX=Math.min(this.minX,n[0],a[0],l[0],c[0]),this.minY=Math.min(this.minY,n[1],a[1],l[1],c[1]),this.maxX=Math.max(this.maxX,n[0],a[0],l[0],c[0]),this.maxY=Math.max(this.maxY,n[1],a[1],l[1],c[1])}updateScalingPathMinMax(t,r){jo.scaleMinMax(t,r),this.minX=Math.min(this.minX,r[0]),this.minY=Math.min(this.minY,r[1]),this.maxX=Math.max(this.maxX,r[2]),this.maxY=Math.max(this.maxY,r[3])}updateCurvePathMinMax(t,r,n,a,l,c,d,p,u,h){const m=jo.bezierBoundingBox(r,n,a,l,c,d,p,u,h);h||this.updateRectMinMax(t,m)}getPathBoundingBox(t=Tl.FILL,r=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===Tl.STROKE){r||Gi("Stroke bounding box must include transform.");const a=jo.singularValueDecompose2dScale(r),l=a[0]*this.lineWidth/2,c=a[1]*this.lineWidth/2;n[0]-=l,n[1]-=c,n[2]+=l,n[3]+=c}return n}updateClipFromPath(){const t=jo.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Tl.FILL,r=null){return jo.intersect(this.clipBox,this.getPathBoundingBox(t,r))}}function Cme(e,t){if(typeof ImageData<"u"&&t instanceof ImageData){e.putImageData(t,0,0);return}const r=t.height,n=t.width,a=r%sc,l=(r-a)/sc,c=a===0?l:l+1,d=e.createImageData(n,sc);let p=0,u;const h=t.data,m=d.data;let f,x,y,b;if(t.kind===nE.GRAYSCALE_1BPP){const w=h.byteLength,v=new Uint32Array(m.buffer,0,m.byteLength>>2),A=v.length,S=n+7>>3,E=4294967295,I=yc.isLittleEndian?4278190080:255;for(f=0;f<c;f++){for(y=f<l?sc:a,u=0,x=0;x<y;x++){const L=w-p;let B=0;const D=L>S?n:L*8-7,M=D&-8;let T=0,R=0;for(;B<M;B+=8)R=h[p++],v[u++]=R&128?E:I,v[u++]=R&64?E:I,v[u++]=R&32?E:I,v[u++]=R&16?E:I,v[u++]=R&8?E:I,v[u++]=R&4?E:I,v[u++]=R&2?E:I,v[u++]=R&1?E:I;for(;B<D;B++)T===0&&(R=h[p++],T=128),v[u++]=R&T?E:I,T>>=1}for(;u<A;)v[u++]=0;e.putImageData(d,0,f*sc)}}else if(t.kind===nE.RGBA_32BPP){for(x=0,b=n*sc*4,f=0;f<l;f++)m.set(h.subarray(p,p+b)),p+=b,e.putImageData(d,0,x),x+=sc;f<c&&(b=n*a*4,m.set(h.subarray(p,p+b)),e.putImageData(d,0,x))}else if(t.kind===nE.RGB_24BPP)for(y=sc,b=n*y,f=0;f<c;f++){for(f>=l&&(y=a,b=n*y),u=0,x=b;x--;)m[u++]=h[p++],m[u++]=h[p++],m[u++]=h[p++],m[u++]=255;e.putImageData(d,0,f*sc)}else throw new Error(`bad image kind: ${t.kind}`)}function Ame(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const r=t.height,n=t.width,a=r%sc,l=(r-a)/sc,c=a===0?l:l+1,d=e.createImageData(n,sc);let p=0;const u=t.data,h=d.data;for(let m=0;m<c;m++){const f=m<l?sc:a;({srcPos:p}=TOt({src:u,srcPos:p,dest:h,width:n,height:f,nonBlackColor:0})),e.putImageData(d,0,m*sc)}}function my(e,t){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function g$(e){if(e.strokeStyle=e.fillStyle="#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0),!ll){const{filter:t}=e;t!=="none"&&t!==""&&(e.filter="none")}}function $me(e,t){if(t)return!0;const r=jo.singularValueDecompose2dScale(e);r[0]=Math.fround(r[0]),r[1]=Math.fround(r[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*W8.PDF_TO_CSS_UNITS);return r[0]<=n&&r[1]<=n}const NOt=["butt","round","square"],HOt=["miter","round","bevel"],_Ot={},kme={};class d8{constructor(t,r,n,a,l,{optionalContentConfig:c,markedContentStack:d=null},p,u){this.ctx=t,this.current=new vme(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=a,this.filterFactory=l,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=d||[],this.optionalContentConfig=c,this.cachedCanvases=new FOt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=p,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,r=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):r}beginDrawing({transform:t,viewport:r,transparency:n=!1,background:a=null}){const l=this.ctx.canvas.width,c=this.ctx.canvas.height,d=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,l,c),this.ctx.fillStyle=d,n){const p=this.cachedCanvases.getCanvas("transparent",l,c);this.compositeCtx=this.ctx,this.transparentCanvas=p.canvas,this.ctx=p.context,this.ctx.save(),this.ctx.transform(...Pn(this.compositeCtx))}this.ctx.save(),g$(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=Pn(this.ctx)}executeOperatorList(t,r,n,a){const l=t.argsArray,c=t.fnArray;let d=r||0;const p=l.length;if(p===d)return d;const u=p-d>bme&&typeof n=="function",h=u?Date.now()+zOt:0;let m=0;const f=this.commonObjs,x=this.objs;let y;for(;;){if(a!==void 0&&d===a.nextBreakPoint)return a.breakIt(d,n),d;if(y=c[d],y!==J1.dependency)this[y].apply(this,l[d]);else for(const b of l[d]){const w=b.startsWith("g_")?f:x;if(!w.has(b))return w.get(b,n),d}if(d++,d===p)return d;if(u&&++m>bme){if(Date.now()>h)return n(),d;m=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const r of t.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const r=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}}_scaleImage(t,r){const n=t.width,a=t.height;let l=Math.max(Math.hypot(r[0],r[1]),1),c=Math.max(Math.hypot(r[2],r[3]),1),d=n,p=a,u="prescale1",h,m;for(;l>2&&d>1||c>2&&p>1;){let f=d,x=p;l>2&&d>1&&(f=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),l/=d/f),c>2&&p>1&&(x=p>=16384?Math.floor(p/2)-1||1:Math.ceil(p)/2,c/=p/x),h=this.cachedCanvases.getCanvas(u,f,x),m=h.context,m.clearRect(0,0,f,x),m.drawImage(t,0,0,d,p,0,0,f,x),t=h.canvas,d=f,p=x,u=u==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:p}}_createMaskCanvas(t){const r=this.ctx,{width:n,height:a}=t,l=this.current.fillColor,c=this.current.patternFill,d=Pn(r);let p,u,h,m;if((t.bitmap||t.data)&&t.count>1){const D=t.bitmap||t.data.buffer;u=JSON.stringify(c?d:[d.slice(0,4),l]),p=this._cachedBitmapsMap.get(D),p||(p=new Map,this._cachedBitmapsMap.set(D,p));const M=p.get(u);if(M&&!c){const T=Math.round(Math.min(d[0],d[2])+d[4]),R=Math.round(Math.min(d[1],d[3])+d[5]);return{canvas:M,offsetX:T,offsetY:R}}h=M}h||(m=this.cachedCanvases.getCanvas("maskCanvas",n,a),Ame(m.context,t));let f=jo.transform(d,[1/n,0,0,-1/a,0,0]);f=jo.transform(f,[1,0,0,1,0,-a]);const[x,y,b,w]=jo.getAxialAlignedBoundingBox([0,0,n,a],f),v=Math.round(b-x)||1,A=Math.round(w-y)||1,S=this.cachedCanvases.getCanvas("fillCanvas",v,A),E=S.context,I=x,L=y;E.translate(-I,-L),E.transform(...f),h||(h=this._scaleImage(m.canvas,x0(E)),h=h.img,p&&c&&p.set(u,h)),E.imageSmoothingEnabled=$me(Pn(E),t.interpolate),m$(E,h,0,0,h.width,h.height,0,0,n,a),E.globalCompositeOperation="source-in";const B=jo.transform(x0(E),[1,0,0,1,-I,-L]);return E.fillStyle=c?l.getPattern(r,this,B,Tl.FILL):l,E.fillRect(0,0,n,a),p&&!c&&(this.cachedCanvases.delete("fillCanvas"),p.set(u,S.canvas)),{canvas:S.canvas,offsetX:Math.round(I),offsetY:Math.round(L)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=NOt[t]}setLineJoin(t){this.ctx.lineJoin=HOt[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,r){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(t),n.lineDashOffset=r)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[r,n]of t)switch(r){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(n,t,r);this.suspendedCtx=this.ctx,this.ctx=a.context;const l=this.ctx;l.setTransform(...Pn(this.suspendedCtx)),my(this.suspendedCtx,l),ROt(l,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(),my(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,r,n,a){const l=a[0],c=a[1],d=a[2]-l,p=a[3]-c;d===0||p===0||(this.genericComposeSMask(r.context,n,d,p,r.subtype,r.backdrop,r.transferMap,l,c,r.offsetX,r.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,r,n,a,l,c,d,p,u,h,m){let f=t.canvas,x=p-h,y=u-m;if(c){if(x<0||y<0||x+n>f.width||y+a>f.height){const w=this.cachedCanvases.getCanvas("maskExtension",n,a),v=w.context;v.drawImage(f,-x,-y),c.some(A=>A!==0)&&(v.globalCompositeOperation="destination-atop",v.fillStyle=jo.makeHexColor(...c),v.fillRect(0,0,n,a),v.globalCompositeOperation="source-over"),f=w.canvas,x=y=0}else if(c.some(w=>w!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(x,y,n,a),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=jo.makeHexColor(...c),t.fillRect(x,y,n,a),t.restore()}}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),l==="Alpha"&&d?r.filter=this.filterFactory.addAlphaFilter(d):l==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(d));const b=new Path2D;b.rect(p,u,n,a),r.clip(b),r.globalCompositeOperation="destination-in",r.drawImage(f,x,y,n,a,p,u,n,a),r.restore()}save(){this.inSMaskMode?(my(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),my(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,r,n,a,l,c){this.ctx.transform(t,r,n,a,l,c),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,r,n){const a=this.ctx,l=this.current;let c=l.x,d=l.y,p,u;const h=Pn(a),m=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,f=m?n.slice(0):null;for(let x=0,y=0,b=t.length;x<b;x++)switch(t[x]|0){case J1.rectangle:c=r[y++],d=r[y++];const w=r[y++],v=r[y++],A=c+w,S=d+v;a.moveTo(c,d),w===0||v===0?a.lineTo(A,S):(a.lineTo(A,d),a.lineTo(A,S),a.lineTo(c,S)),m||l.updateRectMinMax(h,[c,d,A,S]),a.closePath();break;case J1.moveTo:c=r[y++],d=r[y++],a.moveTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.lineTo:c=r[y++],d=r[y++],a.lineTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.curveTo:p=c,u=d,c=r[y+4],d=r[y+5],a.bezierCurveTo(r[y],r[y+1],r[y+2],r[y+3],c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],r[y+2],r[y+3],c,d,f),y+=6;break;case J1.curveTo2:p=c,u=d,a.bezierCurveTo(c,d,r[y],r[y+1],r[y+2],r[y+3]),l.updateCurvePathMinMax(h,p,u,c,d,r[y],r[y+1],r[y+2],r[y+3],f),c=r[y+2],d=r[y+3],y+=4;break;case J1.curveTo3:p=c,u=d,c=r[y+2],d=r[y+3],a.bezierCurveTo(r[y],r[y+1],c,d,c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],c,d,c,d,f),y+=4;break;case J1.closePath:a.closePath();break}m&&l.updateScalingPathMinMax(h,f),l.setCurrentPoint(c,d)}closePath(){this.ctx.closePath()}stroke(t=!0){const r=this.ctx,n=this.current.strokeColor;r.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&n?.getPattern?(r.save(),r.strokeStyle=n.getPattern(r,this,x0(r),Tl.STROKE),this.rescaleAndStroke(!1),r.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),r.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;let l=!1;a&&(r.save(),r.fillStyle=n.getPattern(r,this,x0(r),Tl.FILL),l=!0);const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(r.fill("evenodd"),this.pendingEOFill=!1):r.fill()),l&&r.restore(),t&&this.consumePath(c)}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=_Ot}eoClip(){this.pendingClip=kme}beginText(){this.current.textMatrix=Mze,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,r=this.ctx;if(t===void 0){r.beginPath();return}r.save(),r.beginPath();for(const n of t)r.setTransform(...n.transform),r.translate(n.x,n.y),n.addToPath(r,n.fontSize);r.restore(),r.clip(),r.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,r){const n=this.commonObjs.get(t),a=this.current;if(!n)throw new Error(`Can't find font for ${t}`);if(a.fontMatrix=n.fontMatrix||bY,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&Fr("Invalid font matrix for font "+t),r<0?(r=-r,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const l=n.loadedName||"sans-serif",c=n.systemFontInfo?.css||`"${l}", ${n.fallbackName}`;let d="normal";n.black?d="900":n.bold&&(d="bold");const p=n.italic?"italic":"normal";let u=r;r<xme?u=xme:r>yme&&(u=yme),this.current.fontSizeScale=r/u,this.ctx.font=`${p} ${d} ${u}px ${c}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,r){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=r}setLeadingMoveText(t,r){this.setLeading(-r),this.moveText(t,r)}setTextMatrix(t,r,n,a,l,c){this.current.textMatrix=[t,r,n,a,l,c],this.current.textMatrixScale=Math.hypot(t,r),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,r,n,a){const l=this.ctx,c=this.current,d=c.font,p=c.textRenderingMode,u=c.fontSize/c.fontSizeScale,h=p&Xs.FILL_STROKE_MASK,m=!!(p&Xs.ADD_TO_PATH_FLAG),f=c.patternFill&&!d.missingFile;let x;(d.disableFontFace||m||f)&&(x=d.getPathGenerator(this.commonObjs,t)),d.disableFontFace||f?(l.save(),l.translate(r,n),l.beginPath(),x(l,u),a&&l.setTransform(...a),(h===Xs.FILL||h===Xs.FILL_STROKE)&&l.fill(),(h===Xs.STROKE||h===Xs.FILL_STROKE)&&l.stroke(),l.restore()):((h===Xs.FILL||h===Xs.FILL_STROKE)&&l.fillText(t,r,n),(h===Xs.STROKE||h===Xs.FILL_STROKE)&&l.strokeText(t,r,n)),m&&(this.pendingTextPaths||=[]).push({transform:Pn(l),x:r,y:n,fontSize:u,addToPath:x})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const r=t.getImageData(0,0,10,10).data;let n=!1;for(let a=3;a<r.length;a+=4)if(r[a]>0&&r[a]<255){n=!0;break}return pi(this,"isFontSubpixelAAEnabled",n)}showText(t){const r=this.current,n=r.font;if(n.isType3Font)return this.showType3Text(t);const a=r.fontSize;if(a===0)return;const l=this.ctx,c=r.fontSizeScale,d=r.charSpacing,p=r.wordSpacing,u=r.fontDirection,h=r.textHScale*u,m=t.length,f=n.vertical,x=f?1:-1,y=n.defaultVMetrics,b=a*r.fontMatrix[0],w=r.textRenderingMode===Xs.FILL&&!n.disableFontFace&&!r.patternFill;l.save(),l.transform(...r.textMatrix),l.translate(r.x,r.y+r.textRise),u>0?l.scale(h,-1):l.scale(h,1);let v;if(r.patternFill){l.save();const L=r.fillColor.getPattern(l,this,x0(l),Tl.FILL);v=Pn(l),l.restore(),l.fillStyle=L}let A=r.lineWidth;const S=r.textMatrixScale;if(S===0||A===0){const L=r.textRenderingMode&Xs.FILL_STROKE_MASK;(L===Xs.STROKE||L===Xs.FILL_STROKE)&&(A=this.getSinglePixelWidth())}else A/=S;if(c!==1&&(l.scale(c,c),A/=c),l.lineWidth=A,n.isInvalidPDFjsFont){const L=[];let B=0;for(const D of t)L.push(D.unicode),B+=D.width;l.fillText(L.join(""),0,0),r.x+=B*b*h,l.restore(),this.compose();return}let E=0,I;for(I=0;I<m;++I){const L=t[I];if(typeof L=="number"){E+=x*L*a/1e3;continue}let B=!1;const D=(L.isSpace?p:0)+d,M=L.fontChar,T=L.accent;let R,N,K=L.width;if(f){const F=L.vmetric||y,_=-(L.vmetric?F[1]:K*.5)*b,V=F[2]*b;K=F?-F[0]:K,R=_/c,N=(E+V)/c}else R=E/c,N=0;if(n.remeasure&&K>0){const F=l.measureText(M).width*1e3/a*c;if(K<F&&this.isFontSubpixelAAEnabled){const _=K/F;B=!0,l.save(),l.scale(_,1),R/=_}else K!==F&&(R+=(K-F)/2e3*a/c)}if(this.contentVisible&&(L.isInFont||n.missingFile)){if(w&&!T)l.fillText(M,R,N);else if(this.paintChar(M,R,N,v),T){const F=R+a*T.offset.x/c,_=N-a*T.offset.y/c;this.paintChar(T.fontChar,F,_,v)}}const q=f?K*b-D*u:K*b+D*u;E+=q,B&&l.restore()}f?r.y-=E:r.x+=E*h,l.restore(),this.compose()}showType3Text(t){const r=this.ctx,n=this.current,a=n.font,l=n.fontSize,c=n.fontDirection,d=a.vertical?1:-1,p=n.charSpacing,u=n.wordSpacing,h=n.textHScale*c,m=n.fontMatrix||bY,f=t.length,x=n.textRenderingMode===Xs.INVISIBLE;let y,b,w,v;if(!(x||l===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),r.transform(...n.textMatrix),r.translate(n.x,n.y),r.scale(h,c),y=0;y<f;++y){if(b=t[y],typeof b=="number"){v=d*b*l/1e3,this.ctx.translate(v,0),n.x+=v*h;continue}const A=(b.isSpace?u:0)+p,S=a.charProcOperatorList[b.operatorListId];if(!S){Fr(`Type3 character "${b.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=b,this.save(),r.scale(l,l),r.transform(...m),this.executeOperatorList(S),this.restore()),w=jo.applyTransform([b.width,0],m)[0]*l+A,r.translate(w,0),n.x+=w*h}r.restore(),this.processingType3=null}}setCharWidth(t,r){}setCharWidthAndBounds(t,r,n,a,l,c){this.ctx.rect(n,a,l-n,c-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let r;if(t[0]==="TilingPattern"){const n=t[1],a=this.baseTransform||Pn(this.ctx),l={createCanvasGraphics:c=>new d8(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};r=new EX(t,n,this.ctx,l,a)}else r=this._getPattern(t[1],t[2]);return r}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,r=null){let n;return this.cachedPatterns.has(t)?n=this.cachedPatterns.get(t):(n=DOt(this.getObject(t)),this.cachedPatterns.set(t,n)),r&&(n.matrix=r),n}shadingFill(t){if(!this.contentVisible)return;const r=this.ctx;this.save();const n=this._getPattern(t);r.fillStyle=n.getPattern(r,this,x0(r),Tl.SHADING);const a=x0(r);if(a){const{width:l,height:c}=r.canvas,[d,p,u,h]=jo.getAxialAlignedBoundingBox([0,0,l,c],a);this.ctx.fillRect(d,p,u-d,h-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Gi("Should not call beginInlineImage")}beginImageData(){Gi("Should not call beginImageData")}paintFormXObjectBegin(t,r){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Pn(this.ctx),r)){const n=r[2]-r[0],a=r[3]-r[1];this.ctx.rect(r[0],r[1],n,a),this.current.updateRectMinMax(Pn(this.ctx),r),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;t.isolated||IM("TODO: Support non-isolated groups."),t.knockout&&Fr("Knockout groups not supported.");const n=Pn(r);if(t.matrix&&r.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=jo.getAxialAlignedBoundingBox(t.bbox,Pn(r));const l=[0,0,r.canvas.width,r.canvas.height];a=jo.intersect(a,l)||[0,0,0,0];const c=Math.floor(a[0]),d=Math.floor(a[1]),p=Math.max(Math.ceil(a[2])-c,1),u=Math.max(Math.ceil(a[3])-d,1);this.current.startNewPathAndClipBox([0,0,p,u]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(h,p,u),f=m.context;f.translate(-c,-d),f.transform(...n),t.smask?this.smaskStack.push({canvas:m.canvas,context:f,offsetX:c,offsetY:d,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(r.setTransform(1,0,0,1,0,0),r.translate(c,d),r.save()),my(r,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=Pn(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const l=jo.getAxialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],a);this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(t,r,n,a,l){if(this.#e(),g$(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const c=r[2]-r[0],d=r[3]-r[1];if(l&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=c,r[3]=d;const[p,u]=jo.singularValueDecompose2dScale(Pn(this.ctx)),{viewportScale:h}=this,m=Math.ceil(c*this.outputScaleX*h),f=Math.ceil(d*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(m,f);const{canvas:x,context:y}=this.annotationCanvas;this.annotationCanvasMap.set(t,x),this.annotationCanvas.savedCtx=this.ctx,this.ctx=y,this.ctx.save(),this.ctx.setTransform(p,0,0,-u,0,d*u),g$(this.ctx)}else g$(this.ctx),this.ctx.rect(r[0],r[1],c,d),this.ctx.clip(),this.endPath()}this.current=new vme(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const r=t.count;t=this.getObject(t.data,t),t.count=r;const n=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=OOt(t)),a.compiled)){a.compiled(n);return}const l=this._createMaskCanvas(t),c=l.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(c,l.offsetX,l.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,r,n=0,a=0,l,c){if(!this.contentVisible)return;t=this.getObject(t.data,t);const d=this.ctx;d.save();const p=Pn(d);d.transform(r,n,a,l,0,0);const u=this._createMaskCanvas(t);d.setTransform(1,0,0,1,u.offsetX-p[4],u.offsetY-p[5]);for(let h=0,m=c.length;h<m;h+=2){const f=jo.transform(p,[r,n,a,l,c[h],c[h+1]]),[x,y]=jo.applyTransform([0,0],f);d.drawImage(u.canvas,x,y)}d.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;for(const l of t){const{data:c,width:d,height:p,transform:u}=l,h=this.cachedCanvases.getCanvas("maskCanvas",d,p),m=h.context;m.save();const f=this.getObject(c,l);Ame(m,f),m.globalCompositeOperation="source-in",m.fillStyle=a?n.getPattern(m,this,x0(r),Tl.FILL):n,m.fillRect(0,0,d,p),m.restore(),r.save(),r.transform(...u),r.scale(1,-1),m$(r,h.canvas,0,0,d,p,0,-1,1,1),r.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){Fr("Dependent image isn't ready yet");return}this.paintInlineImageXObject(r)}paintImageXObjectRepeat(t,r,n,a){if(!this.contentVisible)return;const l=this.getObject(t);if(!l){Fr("Dependent image isn't ready yet");return}const c=l.width,d=l.height,p=[];for(let u=0,h=a.length;u<h;u+=2)p.push({transform:[r,0,0,n,a[u],a[u+1]],x:0,y:0,w:c,h:d});this.paintInlineImageXObjectGroup(l,p)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:r,width:n,height:a}=t,l=this.cachedCanvases.getCanvas("inlineImage",n,a),c=l.context;return c.filter=this.current.transferMaps,c.drawImage(r,0,0),c.filter="none",l.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const r=t.width,n=t.height,a=this.ctx;if(this.save(),!ll){const{filter:d}=a;d!=="none"&&d!==""&&(a.filter="none")}a.scale(1/r,-1/n);let l;if(t.bitmap)l=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)l=t;else{const p=this.cachedCanvases.getCanvas("inlineImage",r,n).context;Cme(p,t),l=this.applyTransferMapsToCanvas(p)}const c=this._scaleImage(l,x0(a));a.imageSmoothingEnabled=$me(Pn(a),t.interpolate),m$(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-n,r,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,r){if(!this.contentVisible)return;const n=this.ctx;let a;if(t.bitmap)a=t.bitmap;else{const l=t.width,c=t.height,p=this.cachedCanvases.getCanvas("inlineImage",l,c).context;Cme(p,t),a=this.applyTransferMapsToCanvas(p)}for(const l of r)n.save(),n.transform(...l.transform),n.scale(1,-1),m$(n,a,l.x,l.y,l.w,l.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,r){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,r){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(r||(this.pendingClip===kme?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Pn(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const r=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,a)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:r,b:n,c:a,d:l}=this.ctx.getTransform();let c,d;if(n===0&&a===0){const p=Math.abs(r),u=Math.abs(l);if(p===u)if(t===0)c=d=1/p;else{const h=p*t;c=d=h<1?1/h:1}else if(t===0)c=1/p,d=1/u;else{const h=p*t,m=u*t;c=h<1?1/h:1,d=m<1?1/m:1}}else{const p=Math.abs(r*l-n*a),u=Math.hypot(r,n),h=Math.hypot(a,l);if(t===0)c=h/p,d=u/p;else{const m=t*p;c=h>m?h/m:1,d=u>m?u/m:1}}this._cachedScaleForStroking[0]=c,this._cachedScaleForStroking[1]=d}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:r}=this,{lineWidth:n}=this.current,[a,l]=this.getScaleForStroking();if(r.lineWidth=n||1,a===1&&l===1){r.stroke();return}const c=r.getLineDash();if(t&&r.save(),r.scale(a,l),c.length>0){const d=Math.max(a,l);r.setLineDash(c.map(p=>p/d)),r.lineDashOffset/=d}r.stroke(),t&&r.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const e in J1)d8.prototype[e]!==void 0&&(d8.prototype[J1[e]]=d8.prototype[e]);class ov{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");this.#e=t}static get workerSrc(){return this.#t}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");this.#t=t}}const f$={DATA:1,ERROR:2},Ca={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Yc(e){switch(e instanceof Error||typeof e=="object"&&e!==null||Gi('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new l5(e.message);case"MissingPDFException":return new s5(e.message);case"PasswordException":return new vY(e.message,e.code);case"UnexpectedResponseException":return new jM(e.message,e.status);case"UnknownErrorException":return new CY(e.message,e.details);default:return new CY(e.message,e.toString())}}class vb{constructor(t,r,n){this.sourceName=t,this.targetName=r,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=a=>{const l=a.data;if(l.targetName!==this.sourceName)return;if(l.stream){this.#t(l);return}if(l.callback){const d=l.callbackId,p=this.callbackCapabilities[d];if(!p)throw new Error(`Cannot resolve callback ${d}`);if(delete this.callbackCapabilities[d],l.callback===f$.DATA)p.resolve(l.data);else if(l.callback===f$.ERROR)p.reject(Yc(l.reason));else throw new Error("Unexpected callback case");return}const c=this.actionHandler[l.action];if(!c)throw new Error(`Unknown action from worker: ${l.action}`);if(l.callbackId){const d=this.sourceName,p=l.sourceName;new Promise(function(u){u(c(l.data))}).then(function(u){n.postMessage({sourceName:d,targetName:p,callback:f$.DATA,callbackId:l.callbackId,data:u})},function(u){n.postMessage({sourceName:d,targetName:p,callback:f$.ERROR,callbackId:l.callbackId,reason:Yc(u)})});return}if(l.streamId){this.#e(l);return}c(l.data)},n.addEventListener("message",this._onComObjOnMessage)}on(t,r){const n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=r}send(t,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:r},n)}sendWithPromise(t,r,n){const a=this.callbackId++,l=Promise.withResolvers();this.callbackCapabilities[a]=l;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:r},n)}catch(c){l.reject(c)}return l.promise}sendWithStream(t,r,n,a){const l=this.streamId++,c=this.sourceName,d=this.targetName,p=this.comObj;return new ReadableStream({start:u=>{const h=Promise.withResolvers();return this.streamControllers[l]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},p.postMessage({sourceName:c,targetName:d,action:t,streamId:l,data:r,desiredSize:u.desiredSize},a),h.promise},pull:u=>{const h=Promise.withResolvers();return this.streamControllers[l].pullCall=h,p.postMessage({sourceName:c,targetName:d,stream:Ca.PULL,streamId:l,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Ua(u instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[l].cancelCall=h,this.streamControllers[l].isClosed=!0,p.postMessage({sourceName:c,targetName:d,stream:Ca.CANCEL,streamId:l,reason:Yc(u)}),h.promise}},n)}#e(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this,d=this.actionHandler[t.action],p={enqueue(u,h=1,m){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),l.postMessage({sourceName:n,targetName:a,stream:Ca.ENQUEUE,streamId:r,chunk:u},m)},close(){this.isCancelled||(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.CLOSE,streamId:r}),delete c.streamSinks[r])},error(u){Ua(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.ERROR,streamId:r,reason:Yc(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};p.sinkCapability.resolve(),p.ready=p.sinkCapability.promise,this.streamSinks[r]=p,new Promise(function(u){u(d(t.data,p))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,success:!0})},function(u){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,reason:Yc(u)})})}#t(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this.streamControllers[r],d=this.streamSinks[r];switch(t.stream){case Ca.START_COMPLETE:t.success?c.startCall.resolve():c.startCall.reject(Yc(t.reason));break;case Ca.PULL_COMPLETE:t.success?c.pullCall.resolve():c.pullCall.reject(Yc(t.reason));break;case Ca.PULL:if(!d){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0});break}d.desiredSize<=0&&t.desiredSize>0&&d.sinkCapability.resolve(),d.desiredSize=t.desiredSize,new Promise(function(p){p(d.onPull?.())}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,reason:Yc(p)})});break;case Ca.ENQUEUE:if(Ua(c,"enqueue should have stream controller"),c.isClosed)break;c.controller.enqueue(t.chunk);break;case Ca.CLOSE:if(Ua(c,"close should have stream controller"),c.isClosed)break;c.isClosed=!0,c.controller.close(),this.#o(c,r);break;case Ca.ERROR:Ua(c,"error should have stream controller"),c.controller.error(Yc(t.reason)),this.#o(c,r);break;case Ca.CANCEL_COMPLETE:t.success?c.cancelCall.resolve():c.cancelCall.reject(Yc(t.reason)),this.#o(c,r);break;case Ca.CANCEL:if(!d)break;new Promise(function(p){p(d.onCancel?.(Yc(t.reason)))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,reason:Yc(p)})}),d.sinkCapability.reject(Yc(t.reason)),d.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}async#o(t,r){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[r]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class VOt{#e;#t;constructor({parsedData:t,rawData:r}){this.#e=t,this.#t=r}getRaw(){return this.#t}get(t){return this.#e.get(t)??null}getAll(){return fX(this.#e)}has(t){return this.#e.has(t)}}const Sm=Symbol("INTERNAL");class QOt{#e=!1;#t=!1;#o=!1;#i=!0;constructor(t,{name:r,intent:n,usage:a}){this.#e=!!(t&Od.DISPLAY),this.#t=!!(t&Od.PRINT),this.name=r,this.intent=n,this.usage=a}get visible(){if(this.#o)return this.#i;if(!this.#i)return!1;const{print:t,view:r}=this.usage;return this.#e?r?.viewState!=="OFF":this.#t?t?.printState!=="OFF":!0}_setVisible(t,r,n=!1){t!==Sm&&Gi("Internal method `_setVisible` called."),this.#o=n,this.#i=r}}class UOt{#e=null;#t=new Map;#o=null;#i=null;constructor(t,r=Od.DISPLAY){if(this.renderingIntent=r,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#i=t.order;for(const n of t.groups)this.#t.set(n.id,new QOt(r,n));if(t.baseState==="OFF")for(const n of this.#t.values())n._setVisible(Sm,!1);for(const n of t.on)this.#t.get(n)._setVisible(Sm,!0);for(const n of t.off)this.#t.get(n)._setVisible(Sm,!1);this.#o=this.getHash()}}#s(t){const r=t.length;if(r<2)return!0;const n=t[0];for(let a=1;a<r;a++){const l=t[a];let c;if(Array.isArray(l))c=this.#s(l);else if(this.#t.has(l))c=this.#t.get(l).visible;else return Fr(`Optional content group not found: ${l}`),!0;switch(n){case"And":if(!c)return!1;break;case"Or":if(c)return!0;break;case"Not":return!c;default:return!0}}return n==="And"}isVisible(t){if(this.#t.size===0)return!0;if(!t)return IM("Optional content group not defined."),!0;if(t.type==="OCG")return this.#t.has(t.id)?this.#t.get(t.id).visible:(Fr(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#s(t.expression);if(!t.policy||t.policy==="AnyOn"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const r of t.ids){if(!this.#t.has(r))return Fr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!1}return!0}return Fr(`Unknown optional content policy ${t.policy}.`),!0}return Fr(`Unknown group type ${t.type}.`),!0}setVisibility(t,r=!0){const n=this.#t.get(t);if(!n){Fr(`Optional content group not found: ${t}`);return}n._setVisible(Sm,!!r,!0),this.#e=null}setOCGState({state:t,preserveRB:r}){let n;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":n=a;continue}const l=this.#t.get(a);if(l)switch(n){case"ON":l._setVisible(Sm,!0);break;case"OFF":l._setVisible(Sm,!1);break;case"Toggle":l._setVisible(Sm,!l.visible);break}}this.#e=null}get hasInitialVisibility(){return this.#o===null||this.getHash()===this.#o}getOrder(){return this.#t.size?this.#i?this.#i.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?fX(this.#t):null}getGroup(t){return this.#t.get(t)||null}getHash(){if(this.#e!==null)return this.#e;const t=new Oze;for(const[r,n]of this.#t)t.update(`${r}:${n.visible}`);return this.#e=t.hexdigest()}}class WOt{constructor(t,{disableRange:r=!1,disableStream:n=!1}){Ua(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:l,progressiveDone:c,contentDispositionFilename:d}=t;if(this._queuedChunks=[],this._progressiveDone=c,this._contentDispositionFilename=d,l?.length>0){const p=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;this._queuedChunks.push(p)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((p,u)=>{this._onReceiveData({begin:p,chunk:u})}),t.addProgressListener((p,u)=>{this._onProgress({loaded:p,total:u})}),t.addProgressiveReadListener(p=>{this._onReceiveData({chunk:p})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const a=this._rangeReaders.some(function(l){return l._begin!==t?!1:(l._enqueue(n),!0)});Ua(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){t.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const r=this._rangeReaders.indexOf(t);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){Ua(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new GOt(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new YOt(this,t,r);return this._pdfDataRangeTransport.requestDataRange(t,r),this._rangeReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeReaders.slice(0))r.cancel(t);this._pdfDataRangeTransport.abort()}}class GOt{constructor(t,r,n=!1,a=null){this._stream=t,this._done=n||!1,this._filename=vX(a)?a:null,this._queuedChunks=r||[],this._loaded=0;for(const l of this._queuedChunks)this._loaded+=l.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class YOt{constructor(t,r,n){this._stream=t,this._begin=r,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const n of this._requests)n.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 r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function KOt(e){let t=!0,r=n("filename\\*","i").exec(e);if(r){r=r[1];let h=d(r);return h=unescape(h),h=p(h),h=u(h),l(h)}if(r=c(e),r){const h=u(r);return l(h)}if(r=n("filename","i").exec(e),r){r=r[1];let h=d(r);return h=u(h),l(h)}function n(h,m){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',m)}function a(h,m){if(h){if(!/^[\x00-\xFF]+$/.test(m))return m;try{const f=new TextDecoder(h,{fatal:!0}),x=MM(m);m=f.decode(x),t=!1}catch{}}return m}function l(h){return t&&/[\x80-\xff]/.test(h)&&(h=a("utf-8",h),t&&(h=a("iso-8859-1",h))),h}function c(h){const m=[];let f;const x=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=x.exec(h))!==null;){let[,b,w,v]=f;if(b=parseInt(b,10),b in m){if(b===0)break;continue}m[b]=[w,v]}const y=[];for(let b=0;b<m.length&&b in m;++b){let[w,v]=m[b];v=d(v),w&&(v=unescape(v),b===0&&(v=p(v))),y.push(v)}return y.join("")}function d(h){if(h.startsWith('"')){const m=h.slice(1).split('\\"');for(let f=0;f<m.length;++f){const x=m[f].indexOf('"');x!==-1&&(m[f]=m[f].slice(0,x),m.length=f+1),m[f]=m[f].replaceAll(/\\(.)/g,"$1")}h=m.join('"')}return h}function p(h){const m=h.indexOf("'");if(m===-1)return h;const f=h.slice(0,m),y=h.slice(m+1).replace(/^[^']*'/,"");return a(f,y)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(m,f,x,y){if(x==="q"||x==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,w){return String.fromCharCode(parseInt(w,16))}),a(f,y);try{y=atob(y)}catch{}return a(f,y)})}return""}function LX({getResponseHeader:e,isHttp:t,rangeChunkSize:r,disableRange:n}){const a={allowRangeRequests:!1,suggestedLength:void 0},l=parseInt(e("Content-Length"),10);return!Number.isInteger(l)||(a.suggestedLength=l,l<=2*r)||n||!t||e("Accept-Ranges")!=="bytes"||(e("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function IX(e){const t=e("Content-Disposition");if(t){let r=KOt(t);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if(vX(r))return r}return null}function RM(e,t){return e===404||e===0&&t.startsWith("file:")?new s5('Missing PDF "'+t+'".'):new jM(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function _ze(e){return e===200||e===206}function Vze(e,t,r){return{method:"GET",headers:e,signal:r.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Qze(e){const t=new Headers;for(const r in e){const n=e[r];n!==void 0&&t.append(r,n)}return t}function Uze(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Fr(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Sme{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Ua(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new qOt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new ZOt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class qOt{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const r=t.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._headers=Qze(this._stream.httpHeaders);const n=r.url;fetch(n,Vze(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!_ze(a.status))throw RM(a.status,n);this._reader=a.body.getReader(),this._headersCapability.resolve();const l=p=>a.headers.get(p),{allowRangeRequests:c,suggestedLength:d}=LX({getResponseHeader:l,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=c,this._contentLength=d||this._contentLength,this._filename=IX(l),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new l5("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Uze(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class ZOt{constructor(t,r,n){this._stream=t,this._reader=null,this._loaded=0;const a=t.source;this._withCredentials=a.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController,this._headers=Qze(this._stream.httpHeaders),this._headers.append("Range",`bytes=${r}-${n-1}`);const l=a.url;fetch(l,Vze(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!_ze(c.status))throw RM(c.status,l);this._readCapability.resolve(),this._reader=c.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Uze(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}const i_=200,n_=206;function JOt(e){const t=e.response;return typeof t!="string"?t:MM(t).buffer}class XOt{constructor(t,r={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&r.httpHeaders||Object.create(null),this.withCredentials=r.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,r,n){const a={begin:t,end:r};for(const l in n)a[l]=n[l];return this.request(a)}requestFull(t){return this.request(t)}request(t){const r=new XMLHttpRequest,n=this.currXhrId++,a=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const l in this.httpHeaders){const c=this.httpHeaders[l];c!==void 0&&r.setRequestHeader(l,c)}return this.isHttp&&"begin"in t&&"end"in t?(r.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.expectedStatus=n_):a.expectedStatus=i_,r.responseType="arraybuffer",t.onError&&(r.onerror=function(l){t.onError(r.status)}),r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),a.onHeadersReceived=t.onHeadersReceived,a.onDone=t.onDone,a.onError=t.onError,a.onProgress=t.onProgress,r.send(null),n}onProgress(t,r){const n=this.pendingRequests[t];n&&n.onProgress?.(r)}onStateChange(t,r){const n=this.pendingRequests[t];if(!n)return;const a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),a.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],a.status===0&&this.isHttp){n.onError?.(a.status);return}const l=a.status||i_;if(!(l===i_&&n.expectedStatus===n_)&&l!==n.expectedStatus){n.onError?.(a.status);return}const d=JOt(a);if(l===n_){const p=a.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(p);n.onDone({begin:parseInt(u[1],10),chunk:d})}else d?n.onDone({begin:0,chunk:d}):n.onError?.(a.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const r=this.pendingRequests[t].xhr;delete this.pendingRequests[t],r.abort()}}class eNt{constructor(t){this._source=t,this._manager=new XOt(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const r=this._rangeRequestReaders.indexOf(t);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return Ua(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new tNt(this._manager,this._source),this._fullRequestReader}getRangeReader(t,r){const n=new oNt(this._manager,t,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class tNt{constructor(t,r){this._manager=t;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url,this._fullRequestId=t.requestFull(n),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,r=this._manager.getRequestXhr(t),n=c=>r.getResponseHeader(c),{allowRangeRequests:a,suggestedLength:l}=LX({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=l||this._contentLength,this._filename=IX(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=RM(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class oNt{constructor(t,r,n){this._manager=t;const a={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(r,n,a),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const r=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=RM(t,this._url);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Wze=/^file:\/\/\/[a-zA-Z]:\//;function rNt(e){const t=Dh.get("url"),r=t.parse(e);return r.protocol==="file:"||r.host?r:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(r.host||(r.protocol="file:"),r)}class iNt{constructor(t){this.source=t,this.url=rNt(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return Ua(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new sNt(this):new nNt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=this.isFsUrl?new lNt(this,t,r):new aNt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class Gze{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=t.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new l5("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class Yze{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const r=t.source;this._isStreamingSupported=!r.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function BL(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class nNt extends Gze{constructor(t){super(t);const r=n=>{if(n.statusCode===404){const d=new s5(`Missing PDF "${this._url}".`);this._storedError=d,this._headersCapability.reject(d);return}this._headersCapability.resolve(),this._setReadableStream(n);const a=d=>this._readableStream.headers[d.toLowerCase()],{allowRangeRequests:l,suggestedLength:c}=LX({getResponseHeader:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=IX(a)};if(this._request=null,this._url.protocol==="http:"){const n=Dh.get("http");this._request=n.request(BL(this._url,t.httpHeaders),r)}else{const n=Dh.get("https");this._request=n.request(BL(this._url,t.httpHeaders),r)}this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class aNt extends Yze{constructor(t,r,n){super(t),this._httpHeaders={};for(const l in t.httpHeaders){const c=t.httpHeaders[l];c!==void 0&&(this._httpHeaders[l]=c)}this._httpHeaders.Range=`bytes=${r}-${n-1}`;const a=l=>{if(l.statusCode===404){const c=new s5(`Missing PDF "${this._url}".`);this._storedError=c;return}this._setReadableStream(l)};if(this._request=null,this._url.protocol==="http:"){const l=Dh.get("http");this._request=l.request(BL(this._url,this._httpHeaders),a)}else{const l=Dh.get("https");this._request=l.request(BL(this._url,this._httpHeaders),a)}this._request.on("error",l=>{this._storedError=l}),this._request.end()}}class sNt extends Gze{constructor(t){super(t);let r=decodeURIComponent(this._url.path);Wze.test(this._url.href)&&(r=r.replace(/^\//,""));const n=Dh.get("fs");n.promises.lstat(r).then(a=>{this._contentLength=a.size,this._setReadableStream(n.createReadStream(r)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=new s5(`Missing PDF "${r}".`)),this._storedError=a,this._headersCapability.reject(a)})}}class lNt extends Yze{constructor(t,r,n){super(t);let a=decodeURIComponent(this._url.path);Wze.test(this._url.href)&&(a=a.replace(/^\//,""));const l=Dh.get("fs");this._setReadableStream(l.createReadStream(a,{start:r,end:n-1}))}}const cNt=1e5,ec=30,dNt=.8;let PL=class Ru{#e=Promise.withResolvers();#t=null;#o=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#n=0;#l=0;#d=null;#p=null;#h=0;#c=0;#a=Object.create(null);#m=[];#f=null;#u=[];#y=new WeakMap;#g=null;static#b=new Map;static#v=new Map;static#A=null;static#k=new Set;constructor({textContentSource:t,container:r,viewport:n}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(p){p.enqueue(t),p.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#p=r,this.#c=n.scale*(globalThis.devicePixelRatio||1),this.#h=n.rotation,this.#r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:l,pageX:c,pageY:d}=n.rawDims;this.#g=[1,0,0,-1,-c,d+l],this.#l=a,this.#n=l,Ru.#x(),R4(r,n),this.#e.promise.catch(()=>{}).then(()=>{Ru.#k.delete(this),this.#r=null,this.#a=null})}render(){const t=()=>{this.#d.read().then(({value:r,done:n})=>{if(n){this.#e.resolve();return}this.#s??=r.lang,Object.assign(this.#a,r.styles),this.#S(r.items),t()},this.#e.reject)};return this.#d=this.#f.getReader(),Ru.#k.add(this),t(),this.#e.promise}update({viewport:t,onBefore:r=null}){const n=t.scale*(globalThis.devicePixelRatio||1),a=t.rotation;if(a!==this.#h&&(r?.(),this.#h=a,R4(this.#p,{rotation:a})),n!==this.#c){r?.(),this.#c=n;const l={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:Ru.#w(this.#s)};for(const c of this.#u)l.properties=this.#y.get(c),l.div=c,this.#$(l)}}cancel(){const t=new l5("TextLayer task cancelled.");this.#d?.cancel(t).catch(()=>{}),this.#d=null,this.#e.reject(t)}get textDivs(){return this.#u}get textContentItemsStr(){return this.#m}#S(t){if(this.#o)return;this.#r.ctx??=Ru.#w(this.#s);const r=this.#u,n=this.#m;for(const a of t){if(r.length>cNt){Fr("Ignoring additional textDivs for performance reasons."),this.#o=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const l=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id!==null&&this.#t.setAttribute("id",`${a.id}`),l.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(a.str),this.#j(a)}}#j(t){const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#u.push(r);const a=jo.transform(this.#g,t.transform);let l=Math.atan2(a[1],a[0]);const c=this.#a[t.fontName];c.vertical&&(l+=Math.PI/2);const d=this.#i&&c.fontSubstitution||c.fontFamily,p=Math.hypot(a[2],a[3]),u=p*Ru.#C(d,this.#s);let h,m;l===0?(h=a[4],m=a[5]-u):(h=a[4]+u*Math.sin(l),m=a[5]-u*Math.cos(l));const f="calc(var(--scale-factor)*",x=r.style;this.#t===this.#p?(x.left=`${(100*h/this.#l).toFixed(2)}%`,x.top=`${(100*m/this.#n).toFixed(2)}%`):(x.left=`${f}${h.toFixed(2)}px)`,x.top=`${f}${m.toFixed(2)}px)`),x.fontSize=`${f}${(Ru.#A*p).toFixed(2)}px)`,x.fontFamily=d,n.fontSize=p,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#i&&(r.dataset.fontName=c.fontSubstitutionLoadedName||t.fontName),l!==0&&(n.angle=l*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const b=Math.abs(t.transform[0]),w=Math.abs(t.transform[3]);b!==w&&Math.max(b,w)/Math.min(b,w)>1.5&&(y=!0)}if(y&&(n.canvasWidth=c.vertical?t.height:t.width),this.#y.set(r,n),this.#r.div=r,this.#r.properties=n,this.#$(this.#r),n.hasText&&this.#t.append(r),n.hasEOL){const b=document.createElement("br");b.setAttribute("role","presentation"),this.#t.append(b)}}#$(t){const{div:r,properties:n,ctx:a,prevFontSize:l,prevFontFamily:c}=t,{style:d}=r;let p="";if(Ru.#A>1&&(p=`scale(${1/Ru.#A})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:u}=d,{canvasWidth:h,fontSize:m}=n;(l!==m||c!==u)&&(a.font=`${m*this.#c}px ${u}`,t.prevFontSize=m,t.prevFontFamily=u);const{width:f}=a.measureText(r.textContent);f>0&&(p=`scaleX(${h*this.#c/f}) ${p}`)}n.angle!==0&&(p=`rotate(${n.angle}deg) ${p}`),p.length>0&&(d.transform=p)}static cleanup(){if(!(this.#k.size>0)){this.#b.clear();for(const{canvas:t}of this.#v.values())t.remove();this.#v.clear()}}static#w(t=null){let r=this.#v.get(t||="");if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(t,r)}return r}static#x(){if(this.#A!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),this.#A=t.getBoundingClientRect().height,t.remove()}static#C(t,r){const n=this.#b.get(t);if(n)return n;const a=this.#w(r),l=a.font;a.canvas.width=a.canvas.height=ec,a.font=`${ec}px ${t}`;const c=a.measureText("");let d=c.fontBoundingBoxAscent,p=Math.abs(c.fontBoundingBoxDescent);if(d){const m=d/(d+p);return this.#b.set(t,m),a.canvas.width=a.canvas.height=0,a.font=l,m}a.strokeStyle="red",a.clearRect(0,0,ec,ec),a.strokeText("g",0,0);let u=a.getImageData(0,0,ec,ec).data;p=0;for(let m=u.length-1-3;m>=0;m-=4)if(u[m]>0){p=Math.ceil(m/4/ec);break}a.clearRect(0,0,ec,ec),a.strokeText("A",0,ec),u=a.getImageData(0,0,ec,ec).data,d=0;for(let m=0,f=u.length;m<f;m+=4)if(u[m]>0){d=ec-Math.floor(m/4/ec);break}a.canvas.width=a.canvas.height=0,a.font=l;const h=d?d/(d+p):dNt;return this.#b.set(t,h),h}};function pNt(){Rze("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:e,container:t,viewport:r,...n}=arguments[0],a=Object.keys(n);a.length>0&&Fr("Ignoring `renderTextLayer` parameters: "+a.join(", "));const l=new PL({textContentSource:e,container:t,viewport:r}),{textDivs:c,textContentItemsStr:d}=l;return{promise:l.render(),textDivs:c,textContentItemsStr:d}}function uNt(){Rze("`updateTextLayer`, please use `TextLayer` instead.")}class rv{static textContent(t){const r=[],n={items:r,styles:Object.create(null)};function a(l){if(!l)return;let c=null;const d=l.name;if(d==="#text")c=l.value;else if(rv.shouldBuildText(d))l?.attributes?.textContent?c=l.attributes.textContent:l.value&&(c=l.value);else return;if(c!==null&&r.push({str:c}),!!l.children)for(const p of l.children)a(p)}return a(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const hNt=65536,mNt=100,gNt=5e3,fNt=ll?EOt:mOt,xNt=ll?LOt:Tze,yNt=ll?SOt:hOt,bNt=ll?IOt:zze;function wNt(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new jX,{docId:r}=t,n=e.url?vNt(e.url):null,a=e.data?CNt(e.data):null,l=e.httpHeaders||null,c=e.withCredentials===!0,d=e.password??null,p=e.range instanceof Kze?e.range:null,u=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:hNt;let h=e.worker instanceof Qd?e.worker:null;const m=e.verbosity,f=typeof e.docBaseUrl=="string"&&!wX(e.docBaseUrl)?e.docBaseUrl:null,x=typeof e.cMapUrl=="string"?e.cMapUrl:null,y=e.cMapPacked!==!1,b=e.CMapReaderFactory||xNt,w=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,v=e.StandardFontDataFactory||bNt,A=e.stopAtErrors!==!0,S=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,E=e.isEvalSupported!==!1,I=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!ll,L=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,B=typeof e.disableFontFace=="boolean"?e.disableFontFace:ll,D=e.fontExtraProperties===!0,M=e.enableXfa===!0,T=e.ownerDocument||globalThis.document,R=e.disableRange===!0,N=e.disableStream===!0,K=e.disableAutoFetch===!0,q=e.pdfBug===!0,F=e.enableHWA===!0,_=p?p.length:e.length??NaN,V=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!ll&&!B,O=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:b===Tze&&v===zze&&x&&w&&wb(x,document.baseURI)&&wb(w,document.baseURI),z=e.canvasFactory||new fNt({ownerDocument:T,enableHWA:F}),H=e.filterFactory||new yNt({docId:r,ownerDocument:T}),X=null;oOt(m);const Y={canvasFactory:z,filterFactory:H};if(O||(Y.cMapReaderFactory=new b({baseUrl:x,isCompressed:y}),Y.standardFontDataFactory=new v({baseUrl:w})),!h){const J={verbosity:m,port:ov.workerPort};h=J.port?Qd.fromPort(J):new Qd(J),t._worker=h}const G={docId:r,apiVersion:"4.4.168",data:a,password:d,disableAutoFetch:K,rangeChunkSize:u,length:_,docBaseUrl:f,enableXfa:M,evaluatorOptions:{maxImageSize:S,disableFontFace:B,ignoreErrors:A,isEvalSupported:E,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:L,fontExtraProperties:D,useSystemFonts:V,cMapUrl:O?x:null,standardFontDataUrl:O?w:null}},ee={disableFontFace:B,fontExtraProperties:D,ownerDocument:T,pdfBug:q,styleElement:X,loadingParams:{disableAutoFetch:K,enableXfa:M}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const J=h.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let ne;if(p)ne=new WOt(p,{disableRange:R,disableStream:N});else if(!a){if(!n)throw new Error("getDocument - no `url` parameter provided.");ne=(ge=>ll?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&wb(ge.url)?new Sme(ge):new iNt(ge):wb(ge.url)?new Sme(ge):new eNt(ge))({url:n,length:_,httpHeaders:l,withCredentials:c,rangeChunkSize:u,disableRange:R,disableStream:N})}return J.then(xe=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const ge=new vb(r,xe,h.port),ce=new SNt(ge,t,ne,ee,Y);t._transport=ce,ge.send("Ready",null)})}).catch(t._capability.reject),t}function vNt(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(ll&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function CNt(e){if(ll&&typeof AE<"u"&&e instanceof AE)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e=="string")return MM(e);if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof e=="object"&&!isNaN(e?.length))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Eme(e){return typeof e=="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class jX{static#e=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${jX.#e++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}let Kze=class{constructor(t,r,n=!1,a=null){this.length=t,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=a,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,r){for(const n of this._rangeListeners)n(t,r)}onDataProgress(t,r){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(t,r)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const r of this._progressiveReadListeners)r(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,r){Gi("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class ANt{constructor(t,r){this._pdfInfo=t,this._transport=r}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return pi(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(r)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class $Nt{#e=null;#t=!1;constructor(t,r,n,a=!1){this._pageIndex=t,this._pageInfo=r,this._transport=n,this._stats=a?new hme:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new qze,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:r=this.rotate,offsetX:n=0,offsetY:a=0,dontFlip:l=!1}={}){return new hC({viewBox:this.view,scale:t,rotation:r,offsetX:n,offsetY:a,dontFlip:l})}getAnnotations({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return pi(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:r,intent:n="display",annotationMode:a=Fm.ENABLE,transform:l=null,background:c=null,optionalContentConfigPromise:d=null,annotationCanvasMap:p=null,pageColors:u=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(n,a,h),{renderingIntent:f,cacheKey:x}=m;this.#t=!1,this.#i(),d||=this._transport.getOptionalContentConfig(f);let y=this._intentStates.get(x);y||(y=Object.create(null),this._intentStates.set(x,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const b=!!(f&Od.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const w=S=>{y.renderTasks.delete(v),(this._maybeCleanupAfterRender||b)&&(this.#t=!0),this.#o(!b),S?(v.capability.reject(S),this._abortOperatorList({intentState:y,reason:S instanceof Error?S:new Error(S)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new W6({callback:w,params:{canvasContext:t,viewport:r,transform:l,background:c},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});(y.renderTasks||=new Set).add(v);const A=v.task;return Promise.all([y.displayReadyCapability.promise,d]).then(([S,E])=>{if(this.destroyed){w();return}if(this._stats?.time("Rendering"),!(E.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:S,optionalContentConfig:E}),v.operatorListChanged()}).catch(w),A}getOperatorList({intent:t="display",annotationMode:r=Fm.ENABLE,printAnnotationStorage:n=null}={}){function a(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(d))}const l=this._transport.getRenderingIntent(t,r,n,!0);let c=this._intentStates.get(l.cacheKey);c||(c=Object.create(null),this._intentStates.set(l.cacheKey,c));let d;return c.opListReadCapability||(d=Object.create(null),d.operatorListChanged=a,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(d),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(l)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:r===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>rv.textContent(n));const r=this.streamTextContent(t);return new Promise(function(n,a){function l(){c.read().then(function({value:p,done:u}){if(u){n(d);return}d.lang??=p.lang,Object.assign(d.styles,p.styles),d.items.push(...p.items),l()},a)}const c=r.getReader(),d={items:[],styles:Object.create(null),lang:null};l()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#t=!0;const r=this.#o(!1);return t&&r&&(this._stats&&=new hme),r}#o(t=!1){if(this.#i(),!this.#t||this.destroyed)return!1;if(t)return this.#e=setTimeout(()=>{this.#e=null,this.#o(!1)},gNt),!1;for(const{renderTasks:r,operatorList:n}of this._intentStates.values())if(r.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#i(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(t,r){const n=this._intentStates.get(r);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,r){for(let n=0,a=t.length;n<a;n++)r.operatorList.fnArray.push(t.fnArray[n]),r.operatorList.argsArray.push(t.argsArray[n]);r.operatorList.lastChunk=t.lastChunk,r.operatorList.separateAnnots=t.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();t.lastChunk&&this.#o(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:r,annotationStorageSerializable:n}){const{map:a,transfer:l}=n,d=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:r,annotationStorage:a},l).getReader(),p=this._intentStates.get(r);p.streamReader=d;const u=()=>{d.read().then(({value:h,done:m})=>{if(m){p.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,p),u())},h=>{if(p.streamReader=null,!this._transport.destroyed){if(p.operatorList){p.operatorList.lastChunk=!0;for(const m of p.renderTasks)m.operatorListChanged();this.#o(!0)}if(p.displayReadyCapability)p.displayReadyCapability.reject(h);else if(p.opListReadCapability)p.opListReadCapability.reject(h);else throw h}})};u()}_abortOperatorList({intentState:t,reason:r,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(r instanceof bX){let a=mNt;r.extraDelay>0&&r.extraDelay<1e3&&(a+=r.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:r,force:!0})},a);return}}if(t.streamReader.cancel(new l5(r.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,l]of this._intentStates)if(l===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}class kNt{#e=new Set;#t=Promise.resolve();postMessage(t,r){const n={data:structuredClone(t,r?{transfer:r}:null)};this.#t.then(()=>{for(const a of this.#e)a.call(this,n)})}addEventListener(t,r){this.#e.add(r)}removeEventListener(t,r){this.#e.delete(r)}terminate(){this.#e.clear()}}const D0={isWorkerDisabled:!1,fakeWorkerId:0};ll&&(D0.isWorkerDisabled=!0,ov.workerSrc||="./pdf.worker.mjs"),D0.isSameOrigin=function(e,t){let r;try{if(r=new URL(e),!r.origin||r.origin==="null")return!1}catch{return!1}const n=new URL(t,r);return r.origin===n.origin},D0.createCDNWrapper=function(e){const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class Qd{static#e;constructor({name:t=null,port:r=null,verbosity:n=rOt()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,r){if(Qd.#e?.has(r))throw new Error("Cannot use more than one PDFWorker per port.");(Qd.#e||=new WeakMap).set(r,this),this._initializeFromPort(r);return}this._initialize()}get promise(){return ll?Promise.all([Dh.promise,this._readyCapability.promise]):this._readyCapability.promise}#t(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new vb("main","worker",t),this._messageHandler.on("ready",function(){}),this.#t()}_initialize(){if(D0.isWorkerDisabled||Qd.#o){this._setupFakeWorker();return}let{workerSrc:t}=Qd;try{D0.isSameOrigin(window.location.href,t)||(t=D0.createCDNWrapper(new URL(t,window.location).href));const r=new Worker(t,{type:"module"}),n=new vb("main","worker",r),a=()=>{l.abort(),n.destroy(),r.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},l=new AbortController;r.addEventListener("error",()=>{this._webWorker||a()},{signal:l.signal}),n.on("test",d=>{if(l.abort(),this.destroyed||!d){a();return}this._messageHandler=n,this._port=r,this._webWorker=r,this.#t()}),n.on("ready",d=>{if(l.abort(),this.destroyed){a();return}try{c()}catch{this._setupFakeWorker()}});const c=()=>{const d=new Uint8Array;n.send("test",d,[d.buffer])};c();return}catch{IM("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){D0.isWorkerDisabled||(Fr("Setting up fake worker."),D0.isWorkerDisabled=!0),Qd._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const r=new kNt;this._port=r;const n=`fake${D0.fakeWorkerId++}`,a=new vb(n+"_worker",n,r);t.setup(a,r),this._messageHandler=new vb(n,n+"_worker",r),this.#t()}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),Qd.#e?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const r=this.#e?.get(t.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Qd(t)}static get workerSrc(){if(ov.workerSrc)return ov.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#o(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return pi(this,"_setupFakeWorkerGlobal",(async()=>this.#o?this.#o:(await import(this.workerSrc)).WorkerMessageHandler)())}}class SNt{#e=new Map;#t=new Map;#o=new Map;#i=new Map;#s=null;constructor(t,r,n,a,l){this.messageHandler=t,this.loadingTask=r,this.commonObjs=new qze,this.fontLoader=new $Ot({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=l.canvasFactory,this.filterFactory=l.filterFactory,this.cMapReaderFactory=l.cMapReaderFactory,this.standardFontDataFactory=l.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,r=null){const n=this.#e.get(t);if(n)return n;const a=this.messageHandler.sendWithPromise(t,r);return this.#e.set(t,a),a}get annotationStorage(){return pi(this,"annotationStorage",new SX)}getRenderingIntent(t,r=Fm.ENABLE,n=null,a=!1){let l=Od.DISPLAY,c=AY;switch(t){case"any":l=Od.ANY;break;case"display":break;case"print":l=Od.PRINT;break;default:Fr(`getRenderingIntent - invalid intent: ${t}`)}switch(r){case Fm.DISABLE:l+=Od.ANNOTATIONS_DISABLE;break;case Fm.ENABLE:break;case Fm.ENABLE_FORMS:l+=Od.ANNOTATIONS_FORMS;break;case Fm.ENABLE_STORAGE:l+=Od.ANNOTATIONS_STORAGE,c=(l&Od.PRINT&&n instanceof Nze?n:this.annotationStorage).serializable;break;default:Fr(`getRenderingIntent - invalid annotationMode: ${r}`)}return a&&(l+=Od.OPLIST),{renderingIntent:l,cacheKey:`${l}_${c.hash}`,annotationStorageSerializable:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#s?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const n of this.#t.values())t.push(n._destroy());this.#t.clear(),this.#o.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),PL.cleanup(),this._networkStream?.cancelAllRequests(new l5("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:r}=this;t.on("GetReader",(n,a)=>{Ua(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=l=>{this._lastProgress={loaded:l.loaded,total:l.total}},a.onPull=()=>{this._fullReader.read().then(function({value:l,done:c}){if(c){a.close();return}Ua(l instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(l),1,[l])}).catch(l=>{a.error(l)})},a.onCancel=l=>{this._fullReader.cancel(l),a.ready.catch(c=>{if(!this.destroyed)throw c})}}),t.on("ReaderHeadersReady",n=>{const a=Promise.withResolvers(),l=this._fullReader;return l.headersReady.then(()=>{(!l.isStreamingSupported||!l.isRangeSupported)&&(this._lastProgress&&r.onProgress?.(this._lastProgress),l.onProgress=c=>{r.onProgress?.({loaded:c.loaded,total:c.total})}),a.resolve({isStreamingSupported:l.isStreamingSupported,isRangeSupported:l.isRangeSupported,contentLength:l.contentLength})},a.reject),a.promise}),t.on("GetRangeReader",(n,a)=>{Ua(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const l=this._networkStream.getRangeReader(n.begin,n.end);if(!l){a.close();return}a.onPull=()=>{l.read().then(function({value:c,done:d}){if(d){a.close();return}Ua(c instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(c),1,[c])}).catch(c=>{a.error(c)})},a.onCancel=c=>{l.cancel(c),a.ready.catch(d=>{if(!this.destroyed)throw d})}}),t.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new ANt(n,this))}),t.on("DocException",function(n){let a;switch(n.name){case"PasswordException":a=new vY(n.message,n.code);break;case"InvalidPDFException":a=new Bze(n.message);break;case"MissingPDFException":a=new s5(n.message);break;case"UnexpectedResponseException":a=new jM(n.message,n.status);break;case"UnknownErrorException":a=new CY(n.message,n.details);break;default:Gi("DocException - expected a valid Error.")}r._capability.reject(a)}),t.on("PasswordRequest",n=>{if(this.#s=Promise.withResolvers(),r.onPassword){const a=l=>{l instanceof Error?this.#s.reject(l):this.#s.resolve({password:l})};try{r.onPassword(a,n.code)}catch(l){this.#s.reject(l)}}else this.#s.reject(new vY(n.message,n.code));return this.#s.promise}),t.on("DataLoaded",n=>{r.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,a,l])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(a){case"Font":const{disableFontFace:c,fontExtraProperties:d,pdfBug:p}=this._params;if("error"in l){const f=l.error;Fr(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const u=p&&globalThis.FontInspector?.enabled?(f,x)=>globalThis.FontInspector.fontAdded(f,x):null,h=new kOt(l,{disableFontFace:c,inspectFont:u});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!d&&h.data&&(h.data=null),this.commonObjs.resolve(n,h)});break;case"CopyLocalImage":const{imageRef:m}=l;Ua(m,"The imageRef must be defined.");for(const f of this.#t.values())for(const[,x]of f.objs)if(x?.ref===m)return x.dataLen?(this.commonObjs.resolve(n,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,l);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([n,a,l,c])=>{if(this.destroyed)return;const d=this.#t.get(a);if(!d.objs.has(n)){if(d._intentStates.size===0){c?.bitmap?.close();return}switch(l){case"Image":d.objs.resolve(n,c),c?.dataLen>JFt&&(d._maybeCleanupAfterRender=!0);break;case"Pattern":d.objs.resolve(n,c);break;default:throw new Error(`Got unknown object type ${l}`)}}}),t.on("DocProgress",n=>{this.destroyed||r.onProgress?.({loaded:n.loaded,total:n.total})}),t.on("FetchBuiltInCMap",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(n):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(n):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Fr("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=t-1,n=this.#o.get(r);if(n)return n;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(l=>{if(this.destroyed)throw new Error("Transport destroyed");l.refStr&&this.#i.set(l.refStr,t);const c=new $Nt(r,l,this,this._params.pdfBug);return this.#t.set(r,c),c});return this.#o.set(r,a),a}getPageIndex(t){return Eme(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}getFieldObjects(){return this.#r("GetFieldObjects")}hasJSActions(){return this.#r("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#r("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#r("GetOptionalContentConfig").then(r=>new UOt(r,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",r=this.#e.get(t);if(r)return r;const n=this.messageHandler.sendWithPromise(t,null).then(a=>({info:a[0],metadata:a[1]?new VOt(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(t,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const r of this.#t.values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),PL.cleanup()}}cachedPageNumber(t){if(!Eme(t))return null;const r=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#i.get(r)??null}}const x$=Symbol("INITIAL_DATA");class qze{#e=Object.create(null);#t(t){return this.#e[t]||={...Promise.withResolvers(),data:x$}}get(t,r=null){if(r){const a=this.#t(t);return a.promise.then(()=>r(a.data)),null}const n=this.#e[t];if(!n||n.data===x$)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const r=this.#e[t];return!!r&&r.data!==x$}resolve(t,r=null){const n=this.#t(t);n.data=r,n.resolve()}clear(){for(const t in this.#e){const{data:r}=this.#e[t];r?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const t in this.#e){const{data:r}=this.#e[t];r!==x$&&(yield[t,r])}}}class ENt{#e=null;constructor(t){this.#e=t,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(t=0){this.#e.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#e.operatorList;if(!t)return!1;const{annotationCanvasMap:r}=this.#e;return t.form||t.canvas&&r?.size>0}}class W6{#e=null;static#t=new WeakSet;constructor({callback:t,params:r,objs:n,commonObjs:a,annotationCanvasMap:l,operatorList:c,pageIndex:d,canvasFactory:p,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:m=!1,pageColors:f=null}){this.callback=t,this.params=r,this.objs=n,this.commonObjs=a,this.annotationCanvasMap=l,this.operatorListIdx=null,this.operatorList=c,this._pageIndex=d,this.canvasFactory=p,this.filterFactory=u,this._pdfBug=m,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ENt(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=r.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:r}){if(this.cancelled)return;if(this._canvas){if(W6.#t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");W6.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:a,transform:l,background:c}=this.params;this.gfx=new d8(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:a,transparency:t,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,r=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),W6.#t.delete(this._canvas),this.callback(t||new bX(`Rendering cancelled, page ${this._pageIndex+1}`,r))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=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(),W6.#t.delete(this._canvas),this.callback())))}}const LNt="4.4.168",INt="19fbc8998";function Lme(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function gy(e){return Math.max(0,Math.min(255,255*e))}class Ime{static CMYK_G([t,r,n,a]){return["G",1-Math.min(1,.3*t+.59*n+.11*r+a)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=gy(t),[t,t,t]}static G_HTML([t]){const r=Lme(t);return`#${r}${r}${r}`}static RGB_G([t,r,n]){return["G",.3*t+.59*r+.11*n]}static RGB_rgb(t){return t.map(gy)}static RGB_HTML(t){return`#${t.map(Lme).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,r,n,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,n+a),1-Math.min(1,r+a)]}static CMYK_rgb([t,r,n,a]){return[gy(1-Math.min(1,t+a)),gy(1-Math.min(1,n+a)),gy(1-Math.min(1,r+a))]}static CMYK_HTML(t){const r=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([t,r,n]){const a=1-t,l=1-r,c=1-n,d=Math.min(a,l,c);return["CMYK",a,l,c,d]}}class Zze{static setupStorage(t,r,n,a,l){const c=a.getValue(r,{value:null});switch(n.name){case"textarea":if(c.value!==null&&(t.textContent=c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(c.value===n.attributes.xfaOn?t.setAttribute("checked",!0):c.value===n.attributes.xfaOff&&t.removeAttribute("checked"),l==="print")break;t.addEventListener("change",d=>{a.setValue(r,{value:d.target.checked?d.target.getAttribute("xfaOn"):d.target.getAttribute("xfaOff")})})}else{if(c.value!==null&&t.setAttribute("value",c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})})}break;case"select":if(c.value!==null){t.setAttribute("value",c.value);for(const d of n.children)d.attributes.value===c.value?d.attributes.selected=!0:d.attributes.hasOwnProperty("selected")&&delete d.attributes.selected}t.addEventListener("input",d=>{const p=d.target.options,u=p.selectedIndex===-1?"":p[p.selectedIndex].value;a.setValue(r,{value:u})});break}}static setAttributes({html:t,element:r,storage:n=null,intent:a,linkService:l}){const{attributes:c}=r,d=t instanceof HTMLAnchorElement;c.type==="radio"&&(c.name=`${c.name}-${a}`);for(const[p,u]of Object.entries(c))if(u!=null)switch(p){case"class":u.length&&t.setAttribute(p,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!d||p!=="href"&&p!=="newWindow")&&t.setAttribute(p,u)}d&&l.addLinkAttributes(t,c.href,c.newWindow),n&&c.dataId&&this.setupStorage(t,c.dataId,r,n)}static render(t){const r=t.annotationStorage,n=t.linkService,a=t.xfaHtml,l=t.intent||"display",c=document.createElement(a.name);a.attributes&&this.setAttributes({html:c,element:a,intent:l,linkService:n});const d=l!=="richText",p=t.div;if(p.append(c),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;p.style.transform=m}d&&p.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const m=document.createTextNode(a.value);c.append(m),d&&rv.shouldBuildText(a.name)&&u.push(m)}return{textDivs:u}}const h=[[a,-1,c]];for(;h.length>0;){const[m,f,x]=h.at(-1);if(f+1===m.children.length){h.pop();continue}const y=m.children[++h.at(-1)[1]];if(y===null)continue;const{name:b}=y;if(b==="#text"){const v=document.createTextNode(y.value);u.push(v),x.append(v);continue}const w=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,b):document.createElement(b);if(x.append(w),y.attributes&&this.setAttributes({html:w,element:y,storage:r,intent:l,linkService:n}),y.children?.length>0)h.push([y,-1,w]);else if(y.value){const v=document.createTextNode(y.value);d&&rv.shouldBuildText(b)&&u.push(v),w.append(v)}}for(const m of p.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){const r=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=r,t.div.hidden=!1}}const fC=1e3,jNt=9,F4=new WeakSet;function a2(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class MNt{static create(t){switch(t.data.annotationType){case Na.LINK:return new Jze(t);case Na.TEXT:return new BNt(t);case Na.WIDGET:switch(t.data.fieldType){case"Tx":return new PNt(t);case"Btn":return t.data.radioButton?new Xze(t):t.data.checkBox?new TNt(t):new zNt(t);case"Ch":return new RNt(t);case"Sig":return new DNt(t)}return new c5(t);case Na.POPUP:return new EY(t);case Na.FREETEXT:return new eRe(t);case Na.LINE:return new ONt(t);case Na.SQUARE:return new NNt(t);case Na.CIRCLE:return new HNt(t);case Na.POLYLINE:return new tRe(t);case Na.CARET:return new VNt(t);case Na.INK:return new oRe(t);case Na.POLYGON:return new _Nt(t);case Na.HIGHLIGHT:return new QNt(t);case Na.UNDERLINE:return new UNt(t);case Na.SQUIGGLY:return new WNt(t);case Na.STRIKEOUT:return new GNt(t);case Na.STAMP:return new rRe(t);case Na.FILEATTACHMENT:return new YNt(t);default:return new ua(t)}}}class ua{#e=null;#t=!1;#o=null;constructor(t,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=r,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,r&&(this.container=this._createContainer(n)),a&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:r,richText:n}){return!!(t?.str||r?.str||n?.str)}get hasPopupData(){return ua._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:r}=t;r&&this.#i(r),this.#o?.popup.updateEdited(t)}resetEdited(){this.#e&&(this.#i(this.#e.rect),this.#o?.popup.resetEdited(),this.#e=null)}#i(t){const{container:{style:r},data:{rect:n,rotation:a},parent:{viewport:{rawDims:{pageWidth:l,pageHeight:c,pageX:d,pageY:p}}}}=this;n?.splice(0,4,...t);const{width:u,height:h}=a2(t);r.left=`${100*(t[0]-d)/l}%`,r.top=`${100*(c-t[3]+p)/c}%`,a===0?(r.width=`${100*u/l}%`,r.height=`${100*h/c}%`):this.setRotation(a)}_createContainer(t){const{data:r,parent:{page:n,viewport:a}}=this,l=document.createElement("section");l.setAttribute("data-annotation-id",r.id),this instanceof c5||(l.tabIndex=fC);const{style:c}=l;if(c.zIndex=this.parent.zIndex++,r.popupRef&&l.setAttribute("aria-haspopup","dialog"),r.alternativeText&&(l.title=r.alternativeText),r.noRotate&&l.classList.add("norotate"),!r.rect||this instanceof EY){const{rotation:b}=r;return!r.hasOwnCanvas&&b!==0&&this.setRotation(b,l),l}const{width:d,height:p}=a2(r.rect);if(!t&&r.borderStyle.width>0){c.borderWidth=`${r.borderStyle.width}px`;const b=r.borderStyle.horizontalCornerRadius,w=r.borderStyle.verticalCornerRadius;if(b>0||w>0){const A=`calc(${b}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;c.borderRadius=A}else if(this instanceof Xze){const A=`calc(${d}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;c.borderRadius=A}switch(r.borderStyle.style){case hy.SOLID:c.borderStyle="solid";break;case hy.DASHED:c.borderStyle="dashed";break;case hy.BEVELED:Fr("Unimplemented border style: beveled");break;case hy.INSET:Fr("Unimplemented border style: inset");break;case hy.UNDERLINE:c.borderBottomStyle="solid";break}const v=r.borderColor||null;v?(this.#t=!0,c.borderColor=jo.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):c.borderWidth=0}const u=jo.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:m,pageX:f,pageY:x}=a.rawDims;c.left=`${100*(u[0]-f)/h}%`,c.top=`${100*(u[1]-x)/m}%`;const{rotation:y}=r;return r.hasOwnCanvas||y===0?(c.width=`${100*d/h}%`,c.height=`${100*p/m}%`):this.setRotation(y,l),l}setRotation(t,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:a}=this.parent.viewport.rawDims,{width:l,height:c}=a2(this.data.rect);let d,p;t%180===0?(d=100*l/n,p=100*c/a):(d=100*c/n,p=100*l/a),r.style.width=`${d}%`,r.style.height=`${p}%`,r.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(r,n,a)=>{const l=a.detail[r],c=l[0],d=l.slice(1);a.target.style[n]=Ime[`${c}_HTML`](d),this.annotationStorage.setValue(this.data.id,{[n]:Ime[`${c}_rgb`](d)})};return pi(this,"_commonActions",{display:r=>{const{display:n}=r.detail,a=n%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{t("bgColor","backgroundColor",r)},fillColor:r=>{t("fillColor","backgroundColor",r)},fgColor:r=>{t("fgColor","color",r)},textColor:r=>{t("textColor","color",r)},borderColor:r=>{t("borderColor","borderColor",r)},strokeColor:r=>{t("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,r){const n=this._commonActions;for(const a of Object.keys(r.detail))(t[a]||n[a])?.(r)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[a,l]of Object.entries(r)){const c=n[a];if(c){const d={detail:{[a]:l},target:t};c(d),delete r[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[r,n,a,l]=this.data.rect.map(b=>Math.fround(b));if(t.length===8){const[b,w,v,A]=t.subarray(2,6);if(a===b&&l===w&&r===v&&n===A)return}const{style:c}=this.container;let d;if(this.#t){const{borderColor:b,borderWidth:w}=c;c.borderWidth=0,d=["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 p=a-r,u=l-n,{svgFactory:h}=this,m=h.createElement("svg");m.classList.add("quadrilateralsContainer"),m.setAttribute("width",0),m.setAttribute("height",0);const f=h.createElement("defs");m.append(f);const x=h.createElement("clipPath"),y=`clippath_${this.data.id}`;x.setAttribute("id",y),x.setAttribute("clipPathUnits","objectBoundingBox"),f.append(x);for(let b=2,w=t.length;b<w;b+=8){const v=t[b],A=t[b+1],S=t[b+2],E=t[b+3],I=h.createElement("rect"),L=(S-r)/p,B=(l-A)/u,D=(v-S)/p,M=(A-E)/u;I.setAttribute("x",L),I.setAttribute("y",B),I.setAttribute("width",D),I.setAttribute("height",M),x.append(I),d?.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${B}" width="${D}" height="${M}"/>`)}this.#t&&(d.push("</g></svg>')"),c.backgroundImage=d.join("")),this.container.append(m),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:r}=this;t.setAttribute("aria-haspopup","dialog");const n=this.#o=new EY({data:{color:r.color,titleObj:r.titleObj,modificationDate:r.modificationDate,contentsObj:r.contentsObj,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation},parent:this.parent,elements:[this]});this.parent.div.append(n.render())}render(){Gi("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,r=null){const n=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:l,id:c,exportValues:d}of a){if(l===-1||c===r)continue;const p=typeof d=="string"?d:null,u=document.querySelector(`[data-element-id="${c}"]`);if(u&&!F4.has(u)){Fr(`_getElementsByName - element not allowed: ${c}`);continue}n.push({id:c,exportValue:p,domElement:u})}return n}for(const a of document.getElementsByName(t)){const{exportValue:l}=a,c=a.getAttribute("data-element-id");c!==r&&F4.has(a)&&n.push({id:c,exportValue:l,domElement:a})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const r of t)r.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:r})})}}class Jze extends ua{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!r?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let a=!1;return t.url?(r.addLinkAttributes(n,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(n,t.action),a=!0):t.attachment?(this.#t(n,t.attachment,t.attachmentDest),a=!0):t.setOCGState?(this.#o(n,t.setOCGState),a=!0):t.dest?(this._bindLink(n,t.dest),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),a=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(n,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(n),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&this.#e()}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),this.#e()}#t(t,r,n=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(r.content,r.filename,n),!1),this.#e()}#o(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),this.#e()}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(r.actions)){const l=n.get(a);l&&(t[l]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:a}}),!1))}t.onclick||(t.onclick=()=>!1),this.#e()}_bindResetFormAction(t,r){const n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Fr('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{n?.();const{fields:a,refs:l,include:c}=r,d=[];if(a.length!==0||l.length!==0){const h=new Set(l);for(const m of a){const f=this._fieldObjects[m]||[];for(const{id:x}of f)h.add(x)}for(const m of Object.values(this._fieldObjects))for(const f of m)h.has(f.id)===c&&d.push(f)}else for(const h of Object.values(this._fieldObjects))d.push(...h);const p=this.annotationStorage,u=[];for(const h of d){const{id:m}=h;switch(u.push(m),h.type){case"text":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}case"checkbox":case"radiobutton":{const x=h.defaultValue===h.exportValues;p.setValue(m,{value:x});break}case"combobox":case"listbox":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}default:continue}const f=document.querySelector(`[data-element-id="${m}"]`);if(f){if(!F4.has(f)){Fr(`_bindResetFormAction - element not allowed: ${m}`);continue}}else continue;f.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:u,name:"ResetForm"}}),!1}}}class BNt extends ua{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class c5 extends ua{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return yc.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,r,n,a,l){n.includes("mouse")?t.addEventListener(n,c=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c),shift:c.shiftKey,modifier:this._getKeyModifier(c)}})}):t.addEventListener(n,c=>{if(n==="blur"){if(!r.focused||!c.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}l&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c)}})})}_setEventListeners(t,r,n,a){for(const[l,c]of n)(c==="Action"||this.data.actions?.[c])&&((c==="Focus"||c==="Blur")&&(r||={focused:!1}),this._setEventListener(t,r,l,c,a),c==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,r,"blur","Blur",null):c==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,r,"focus","Focus",null))}_setBackgroundColor(t){const r=this.data.backgroundColor||null;t.style.backgroundColor=r===null?"transparent":jo.makeHexColor(r[0],r[1],r[2])}_setTextStyle(t){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||jNt,l=t.style;let c;const d=2,p=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d),h=Math.round(u/(e_*a))||1,m=u/h;c=Math.min(a,p(m/e_))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d);c=Math.min(a,p(u/e_))}l.fontSize=`calc(${c}px * var(--scale-factor))`,l.color=jo.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(l.textAlign=r[this.data.textAlignment])}_setRequired(t,r){r?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",r)}}class PNt extends c5{constructor(t){const r=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:r})}setPropertyOnSiblings(t,r,n,a){const l=this.annotationStorage;for(const c of this._getElementsByName(t.name,t.id))c.domElement&&(c.domElement[r]=n),l.setValue(c.id,{[a]:n})}render(){const t=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const a=t.getValue(r,{value:this.data.fieldValue});let l=a.value||"";const c=t.getValue(r,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let d=a.formattedValue||this.data.textContent?.join(`
|
|
247
247
|
`)||null;d&&this.data.comb&&(d=d.replaceAll(/\s+/g,""));const p={userValue:l,formattedValue:d,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=d??l,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",d??l),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),F4.add(n),n.setAttribute("data-element-id",r),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=fC,this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",h=>{t.setValue(r,{value:h.target.value}),this.setPropertyOnSiblings(n,"value",h.target.value,"value"),p.formattedValue=null}),n.addEventListener("resetform",h=>{const m=this.data.defaultFieldValue??"";n.value=p.userValue=m,p.formattedValue=null});let u=h=>{const{formattedValue:m}=p;m!=null&&(h.target.value=m),h.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",m=>{if(p.focused)return;const{target:f}=m;p.userValue&&(f.value=p.userValue),p.lastCommittedValue=f.value,p.commitKey=1,this.data.actions?.Focus||(p.focused=!0)}),n.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const f={value(x){p.userValue=x.detail.value??"",t.setValue(r,{value:p.userValue.toString()}),x.target.value=p.userValue},formattedValue(x){const{formattedValue:y}=x.detail;p.formattedValue=y,y!=null&&x.target!==document.activeElement&&(x.target.value=y),t.setValue(r,{formattedValue:y})},selRange(x){x.target.setSelectionRange(...x.detail.selRange)},charLimit:x=>{const{charLimit:y}=x.detail,{target:b}=x;if(y===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",y);let w=p.userValue;!w||w.length<=y||(w=w.slice(0,y),b.value=p.userValue=w,t.setValue(r,{value:w}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:w,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(f,m)}),n.addEventListener("keydown",m=>{p.commitKey=1;let f=-1;if(m.key==="Escape"?f=0:m.key==="Enter"&&!this.data.multiLine?f=2:m.key==="Tab"&&(p.commitKey=3),f===-1)return;const{value:x}=m.target;p.lastCommittedValue!==x&&(p.lastCommittedValue=x,p.userValue=x,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:x,willCommit:!0,commitKey:f,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const h=u;u=null,n.addEventListener("blur",m=>{if(!p.focused||!m.relatedTarget)return;this.data.actions?.Blur||(p.focused=!1);const{value:f}=m.target;p.userValue=f,p.lastCommittedValue!==f&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:f,willCommit:!0,commitKey:p.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}),h(m)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",m=>{p.lastCommittedValue=null;const{data:f,target:x}=m,{value:y,selectionStart:b,selectionEnd:w}=x;let v=b,A=w;switch(m.inputType){case"deleteWordBackward":{const S=y.substring(0,b).match(/\w*[^\w]*$/);S&&(v-=S[0].length);break}case"deleteWordForward":{const S=y.substring(b).match(/^[^\w]*\w*/);S&&(A+=S[0].length);break}case"deleteContentBackward":b===w&&(v-=1);break;case"deleteContentForward":b===w&&(A+=1);break}m.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:y,change:f||"",willCommit:!1,selStart:v,selEnd:A}})}),this._setEventListeners(n,p,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(u&&n.addEventListener("blur",u),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${m}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class DNt extends c5{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class TNt extends c5{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,r=this.data,n=r.id;let a=t.getValue(n,{value:r.exportValue===r.fieldValue}).value;typeof a=="string"&&(a=a!=="Off",t.setValue(n,{value:a})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const l=document.createElement("input");return F4.add(l),l.setAttribute("data-element-id",n),l.disabled=r.readOnly,this._setRequired(l,this.data.required),l.type="checkbox",l.name=r.fieldName,a&&l.setAttribute("checked",!0),l.setAttribute("exportValue",r.exportValue),l.tabIndex=fC,l.addEventListener("change",c=>{const{name:d,checked:p}=c.target;for(const u of this._getElementsByName(d,n)){const h=p&&u.exportValue===r.exportValue;u.domElement&&(u.domElement.checked=h),t.setValue(u.id,{value:h})}t.setValue(n,{value:p})}),l.addEventListener("resetform",c=>{const d=r.defaultFieldValue||"Off";c.target.checked=d===r.exportValue}),this.enableScripting&&this.hasJSActions&&(l.addEventListener("updatefromsandbox",c=>{const d={value(p){p.target.checked=p.detail.value!=="Off",t.setValue(n,{value:p.target.checked})}};this._dispatchEventFromSandbox(d,c)}),this._setEventListeners(l,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],c=>c.target.checked)),this._setBackgroundColor(l),this._setDefaultPropertiesFromJS(l),this.container.append(l),this.container}}class Xze extends c5{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,r=this.data,n=r.id;let a=t.getValue(n,{value:r.fieldValue===r.buttonValue}).value;if(typeof a=="string"&&(a=a!==r.buttonValue,t.setValue(n,{value:a})),a)for(const c of this._getElementsByName(r.fieldName,n))t.setValue(c.id,{value:!1});const l=document.createElement("input");if(F4.add(l),l.setAttribute("data-element-id",n),l.disabled=r.readOnly,this._setRequired(l,this.data.required),l.type="radio",l.name=r.fieldName,a&&l.setAttribute("checked",!0),l.tabIndex=fC,l.addEventListener("change",c=>{const{name:d,checked:p}=c.target;for(const u of this._getElementsByName(d,n))t.setValue(u.id,{value:!1});t.setValue(n,{value:p})}),l.addEventListener("resetform",c=>{const d=r.defaultFieldValue;c.target.checked=d!=null&&d===r.buttonValue}),this.enableScripting&&this.hasJSActions){const c=r.buttonValue;l.addEventListener("updatefromsandbox",d=>{const p={value:u=>{const h=c===u.detail.value;for(const m of this._getElementsByName(u.target.name)){const f=h&&m.id===n;m.domElement&&(m.domElement.checked=f),t.setValue(m.id,{value:f})}}};this._dispatchEventFromSandbox(p,d)}),this._setEventListeners(l,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],d=>d.target.checked)}return this._setBackgroundColor(l),this._setDefaultPropertiesFromJS(l),this.container.append(l),this.container}}class zNt extends Jze{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const r=t.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),t}}class RNt extends c5{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,r=this.data.id,n=t.getValue(r,{value:this.data.fieldValue}),a=document.createElement("select");F4.add(a),a.setAttribute("data-element-id",r),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=fC;let l=this.data.combo&&this.data.options.length>0;this.data.combo||(a.size=this.data.options.length,this.data.multiSelect&&(a.multiple=!0)),a.addEventListener("resetform",h=>{const m=this.data.defaultFieldValue;for(const f of a.options)f.selected=f.value===m});for(const h of this.data.options){const m=document.createElement("option");m.textContent=h.displayValue,m.value=h.exportValue,n.value.includes(h.exportValue)&&(m.setAttribute("selected",!0),l=!1),a.append(m)}let c=null;if(l){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),a.prepend(h),c=()=>{h.remove(),a.removeEventListener("input",c),c=null},a.addEventListener("input",c)}const d=h=>{const m=h?"value":"textContent",{options:f,multiple:x}=a;return x?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[m]):f.selectedIndex===-1?null:f[f.selectedIndex][m]};let p=d(!1);const u=h=>{const m=h.target.options;return Array.prototype.map.call(m,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(a.addEventListener("updatefromsandbox",h=>{const m={value(f){c?.();const x=f.detail.value,y=new Set(Array.isArray(x)?x:[x]);for(const b of a.options)b.selected=y.has(b.value);t.setValue(r,{value:d(!0)}),p=d(!1)},multipleSelection(f){a.multiple=!0},remove(f){const x=a.options,y=f.detail.remove;x[y].selected=!1,a.remove(y),x.length>0&&Array.prototype.findIndex.call(x,w=>w.selected)===-1&&(x[0].selected=!0),t.setValue(r,{value:d(!0),items:u(f)}),p=d(!1)},clear(f){for(;a.length!==0;)a.remove(0);t.setValue(r,{value:null,items:[]}),p=d(!1)},insert(f){const{index:x,displayValue:y,exportValue:b}=f.detail.insert,w=a.children[x],v=document.createElement("option");v.textContent=y,v.value=b,w?w.before(v):a.append(v),t.setValue(r,{value:d(!0),items:u(f)}),p=d(!1)},items(f){const{items:x}=f.detail;for(;a.length!==0;)a.remove(0);for(const y of x){const{displayValue:b,exportValue:w}=y,v=document.createElement("option");v.textContent=b,v.value=w,a.append(v)}a.options.length>0&&(a.options[0].selected=!0),t.setValue(r,{value:d(!0),items:u(f)}),p=d(!1)},indices(f){const x=new Set(f.detail.indices);for(const y of f.target.options)y.selected=x.has(y.index);t.setValue(r,{value:d(!0)}),p=d(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(m,h)}),a.addEventListener("input",h=>{const m=d(!0),f=d(!1);t.setValue(r,{value:m}),h.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:p,change:f,changeEx:m,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(a,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):a.addEventListener("input",function(h){t.setValue(r,{value:d(!0)})}),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class EY extends ua{constructor(t){const{data:r,elements:n}=t;super(t,{isRenderable:ua._hasPopupData(r)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new FNt({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}),r=[];for(const n of this.elements)n.popup=t,r.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(n=>`${Dze}${n}`).join(",")),this.container}}class FNt{#e=this.#j.bind(this);#t=this.#C.bind(this);#o=this.#x.bind(this);#i=this.#w.bind(this);#s=null;#r=null;#n=null;#l=null;#d=null;#p=null;#h=null;#c=!1;#a=null;#m=null;#f=null;#u=null;#y=null;#g=null;#b=!1;constructor({container:t,color:r,elements:n,titleObj:a,modificationDate:l,contentsObj:c,richText:d,parent:p,rect:u,parentRect:h,open:m}){this.#r=t,this.#y=a,this.#n=c,this.#u=d,this.#p=p,this.#s=r,this.#f=u,this.#h=h,this.#d=n,this.#l=Fze.toDateObject(l),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup());for(const f of this.trigger)f.addEventListener("click",this.#i),f.addEventListener("mouseenter",this.#o),f.addEventListener("mouseleave",this.#t),f.classList.add("popupTriggerArea");for(const f of n)f.container?.addEventListener("keydown",this.#e);this.#r.hidden=!0,m&&this.#w()}render(){if(this.#a)return;const t=this.#a=document.createElement("div");if(t.className="popup",this.#s){const l=t.style.outlineColor=jo.makeHexColor(...this.#s);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${l} 30%, white)`:t.style.backgroundColor=jo.makeHexColor(...this.#s.map(d=>Math.floor(.7*(255-d)+d)))}const r=document.createElement("span");r.className="header";const n=document.createElement("h1");if(r.append(n),{dir:n.dir,str:n.textContent}=this.#y,t.append(r),this.#l){const l=document.createElement("span");l.classList.add("popupDate"),l.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),l.setAttribute("data-l10n-args",JSON.stringify({date:this.#l.toLocaleDateString(),time:this.#l.toLocaleTimeString()})),r.append(l)}const a=this.#v;if(a)Zze.render({xfaHtml:a,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const l=this._formatContents(this.#n);t.append(l)}this.#r.append(t)}get#v(){const t=this.#u,r=this.#n;return t?.str&&(!r?.str||r.str===t.str)&&this.#u.html||null}get#A(){return this.#v?.attributes?.style?.fontSize||0}get#k(){return this.#v?.attributes?.style?.color||null}#S(t){const r=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:r}]}},a={style:{color:this.#k,fontSize:this.#A?`calc(${this.#A}px * var(--scale-factor))`:""}};for(const l of t.split(`
|
|
248
248
|
`))r.push({name:"span",value:l,attributes:a});return n}_formatContents({str:t,dir:r}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=r;const a=t.split(/(?:\r\n?|\n)/);for(let l=0,c=a.length;l<c;++l){const d=a[l];n.append(document.createTextNode(d)),l<c-1&&n.append(document.createElement("br"))}return n}#j(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#c)&&this.#w()}updateEdited({rect:t,popupContent:r}){this.#g||={contentsObj:this.#n,richText:this.#u},t&&(this.#m=null),r&&(this.#u=this.#S(r),this.#n=null),this.#a?.remove(),this.#a=null}resetEdited(){this.#g&&({contentsObj:this.#n,richText:this.#u}=this.#g,this.#g=null,this.#a?.remove(),this.#a=null,this.#m=null)}#$(){if(this.#m!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:a,pageY:l}}}=this.#p;let c=!!this.#h,d=c?this.#h:this.#f;for(const y of this.#d)if(!d||jo.intersect(y.data.rect,d)!==null){d=y.data.rect,c=!0;break}const p=jo.normalizeRect([d[0],t[3]-d[1]+t[1],d[2],t[3]-d[3]+t[1]]),h=c?d[2]-d[0]+5:0,m=p[0]+h,f=p[1];this.#m=[100*(m-a)/r,100*(f-l)/n];const{style:x}=this.#r;x.left=`${this.#m[0]}%`,x.top=`${this.#m[1]}%`}#w(){this.#c=!this.#c,this.#c?(this.#x(),this.#r.addEventListener("click",this.#i),this.#r.addEventListener("keydown",this.#e)):(this.#C(),this.#r.removeEventListener("click",this.#i),this.#r.removeEventListener("keydown",this.#e))}#x(){this.#a||this.render(),this.isVisible?this.#c&&this.#r.classList.add("focused"):(this.#$(),this.#r.hidden=!1,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)+1e3)}#C(){this.#r.classList.remove("focused"),!(this.#c||!this.isVisible)&&(this.#r.hidden=!0,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)-1e3)}forceHide(){this.#b=this.isVisible,this.#b&&(this.#r.hidden=!0)}maybeShow(){this.#b&&(this.#a||this.#x(),this.#b=!1,this.#r.hidden=!1)}get isVisible(){return this.#r.hidden===!1}}class eRe extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=ii.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const r of this.textContent){const n=document.createElement("span");n.textContent=r,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class ONt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:r,height:n}=a2(t.rect),a=this.svgFactory.create(r,n,!0),l=this.#e=this.svgFactory.createElement("svg:line");return l.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),l.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),l.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),l.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),l.setAttribute("stroke-width",t.borderStyle.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class NNt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:r,height:n}=a2(t.rect),a=this.svgFactory.create(r,n,!0),l=t.borderStyle.width,c=this.#e=this.svgFactory.createElement("svg:rect");return c.setAttribute("x",l/2),c.setAttribute("y",l/2),c.setAttribute("width",r-l),c.setAttribute("height",n-l),c.setAttribute("stroke-width",l||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),a.append(c),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class HNt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:r,height:n}=a2(t.rect),a=this.svgFactory.create(r,n,!0),l=t.borderStyle.width,c=this.#e=this.svgFactory.createElement("svg:ellipse");return c.setAttribute("cx",r/2),c.setAttribute("cy",n/2),c.setAttribute("rx",r/2-l/2),c.setAttribute("ry",n/2-l/2),c.setAttribute("stroke-width",l||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),a.append(c),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class tRe extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:r,borderStyle:n,popupRef:a}}=this;if(!r)return this.container;const{width:l,height:c}=a2(t),d=this.svgFactory.create(l,c,!0);let p=[];for(let h=0,m=r.length;h<m;h+=2){const f=r[h]-t[0],x=t[3]-r[h+1];p.push(`${f},${x}`)}p=p.join(" ");const u=this.#e=this.svgFactory.createElement(this.svgElementName);return u.setAttribute("points",p),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),d.append(u),this.container.append(d),!a&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class _Nt extends tRe{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class VNt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class oRe extends ua{#e=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=ii.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:r,borderStyle:n,popupRef:a}}=this,{width:l,height:c}=a2(t),d=this.svgFactory.create(l,c,!0);for(const p of r){let u=[];for(let m=0,f=p.length;m<f;m+=2){const x=p[m]-t[0],y=t[3]-p[m+1];u.push(`${x},${y}`)}u=u.join(" ");const h=this.svgFactory.createElement(this.svgElementName);this.#e.push(h),h.setAttribute("points",u),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),!a&&this.hasPopupData&&this._createPopup(),d.append(h)}return this.container.append(d),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class QNt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class UNt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class WNt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class GNt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class rRe extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class YNt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0});const{file:r}=this.data;this.filename=r.filename,this.content=r.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:r}=this;let n;r.hasAppearance||r.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#t.bind(this)),this.#e=n;const{isMac:a}=yc.platform;return t.addEventListener("keydown",l=>{l.key==="Enter"&&(a?l.metaKey:l.ctrlKey)&&this.#t()}),!r.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),t.append(n),t}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let KNt=class{#e=null;#t=null;#o=new Map;constructor({div:t,accessibilityManager:r,annotationCanvasMap:n,annotationEditorUIManager:a,page:l,viewport:c}){this.div=t,this.#e=r,this.#t=n,this.page=l,this.viewport=c,this.zIndex=0,this._annotationEditorUIManager=a}#i(t,r){const n=t.firstChild||t;n.id=`${Dze}${r}`,this.div.append(t),this.#e?.moveElementInDOM(this.div,t,n,!1)}async render(t){const{annotations:r}=t,n=this.div;R4(n,this.viewport);const a=new Map,l={data:null,layer:n,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new yX,annotationStorage:t.annotationStorage||new SX,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const c of r){if(c.noHTML)continue;const d=c.annotationType===Na.POPUP;if(d){const h=a.get(c.id);if(!h)continue;l.elements=h}else{const{width:h,height:m}=a2(c.rect);if(h<=0||m<=0)continue}l.data=c;const p=MNt.create(l);if(!p.isRenderable)continue;if(!d&&c.popupRef){const h=a.get(c.popupRef);h?h.push(p):a.set(c.popupRef,[p])}const u=p.render();c.hidden&&(u.style.visibility="hidden"),this.#i(u,c.id),p.annotationEditorType>0&&(this.#o.set(p.data.id,p),this._annotationEditorUIManager?.renderAnnotationElement(p))}this.#s()}update({viewport:t}){const r=this.div;this.viewport=t,R4(r,{rotation:t.rotation}),this.#s(),r.hidden=!1}#s(){if(!this.#t)return;const t=this.div;for(const[r,n]of this.#t){const a=t.querySelector(`[data-annotation-id="${r}"]`);if(!a)continue;n.className="annotationContent";const{firstChild:l}=a;l?l.nodeName==="CANVAS"?l.replaceWith(n):l.classList.contains("annotationContent")?l.after(n):l.before(n):a.append(n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#o.values())}getEditableAnnotation(t){return this.#o.get(t)}};const y$=/\r\n?|\n/g;class _a extends pr{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#o=this.editorDivInput.bind(this);#i=this.editorDivKeydown.bind(this);#s=this.editorDivPaste.bind(this);#r;#n="";#l=`${this.id}-editor`;#d;#p=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=_a.prototype,r=l=>l.isEmpty(),n=yg.TRANSLATE_SMALL,a=yg.TRANSLATE_BIG;return pi(this,"_keyboardManager",new mC([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-a,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[n,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[a,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-a],checker:r}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,n],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,a],checker:r}]]))}static _type="freetext";static _editorType=ii.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#r=t.color||_a._defaultColor||pr._defaultLineColor,this.#d=t.fontSize||_a._defaultFontSize}static initialize(t,r){pr.initialize(t,r,{strings:["pdfjs-free-text-default-content"]});const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,r){switch(t){case gr.FREETEXT_SIZE:_a._defaultFontSize=r;break;case gr.FREETEXT_COLOR:_a._defaultColor=r;break}}updateParams(t,r){switch(t){case gr.FREETEXT_SIZE:this.#h(r);break;case gr.FREETEXT_COLOR:this.#c(r);break}}static get defaultPropertiesToUpdate(){return[[gr.FREETEXT_SIZE,_a._defaultFontSize],[gr.FREETEXT_COLOR,_a._defaultColor||pr._defaultLineColor]]}get propertiesToUpdate(){return[[gr.FREETEXT_SIZE,this.#d],[gr.FREETEXT_COLOR,this.#r]]}#h(t){const r=a=>{this.editorDiv.style.fontSize=`calc(${a}px * var(--scale-factor))`,this.translate(0,-(a-this.#d)*this.parentScale),this.#d=a,this.#m()},n=this.#d;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gr.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#c(t){const r=a=>{this.#r=this.editorDiv.style.color=a},n=this.#r;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gr.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,r){this._uiManager.translateSelectedEditors(t,r,!0)}getInitialTranslation(){const t=this.parentScale;return[-_a._internalPadding*t,-(_a._internalPadding+this.#d)*t]}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(ii.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const t=this._uiManager._signal;this.editorDiv.addEventListener("keydown",this.#i,{signal:t}),this.editorDiv.addEventListener("focus",this.#t,{signal:t}),this.editorDiv.addEventListener("blur",this.#e,{signal:t}),this.editorDiv.addEventListener("input",this.#o,{signal:t}),this.editorDiv.addEventListener("paste",this.#s,{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#l),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#i),this.editorDiv.removeEventListener("focus",this.#t),this.editorDiv.removeEventListener("blur",this.#e),this.editorDiv.removeEventListener("input",this.#o),this.editorDiv.removeEventListener("paste",this.#s),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#a(){const t=[];this.editorDiv.normalize();for(const r of this.editorDiv.childNodes)t.push(_a.#f(r));return t.join(`
|
|
249
249
|
`)}#m(){const[t,r]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:a,div:l}=this,c=l.style.display,d=l.classList.contains("hidden");l.classList.remove("hidden"),l.style.display="hidden",a.div.append(this.div),n=l.getBoundingClientRect(),l.remove(),l.style.display=c,l.classList.toggle("hidden",d)}this.rotation%180===this.parentRotation%180?(this.width=n.width/t,this.height=n.height/r):(this.width=n.height/t,this.height=n.width/r),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#n,r=this.#n=this.#a().trimEnd();if(t===r)return;const n=a=>{if(this.#n=a,!a){this.remove();return}this.#u(),this._uiManager.rebuild(this),this.#m()};this.addCommands({cmd:()=>{n(r)},undo:()=>{n(t)},mustExec:!1}),this.#m()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){_a._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,r;this.width&&(t=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#l),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),pr._l10nPromise.get("pdfjs-free-text-default-content").then(a=>this.editorDiv?.setAttribute("default-content",a)),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#d}px * var(--scale-factor))`,n.color=this.#r,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),ML(this,this.div,["dblclick","keydown"]),this.width){const[a,l]=this.parentDimensions;if(this.annotationElementId){const{position:c}=this.#p;let[d,p]=this.getInitialTranslation();[d,p]=this.pageTranslationToScreen(d,p);const[u,h]=this.pageDimensions,[m,f]=this.pageTranslation;let x,y;switch(this.rotation){case 0:x=t+(c[0]-m)/u,y=r+this.height-(c[1]-f)/h;break;case 90:x=t+(c[0]-m)/u,y=r-(c[1]-f)/h,[d,p]=[p,-d];break;case 180:x=t-this.width+(c[0]-m)/u,y=r-(c[1]-f)/h,[d,p]=[-d,-p];break;case 270:x=t+(c[0]-m-this.height*h)/u,y=r+(c[1]-f-this.width*u)/h,[d,p]=[-p,d];break}this.setAt(x*a,y*l,d,p)}else this.setAt(t*a,r*l,this.width*a,this.height*l);this.#u(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#f(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(y$,"")}editorDivPaste(t){const r=t.clipboardData||window.clipboardData,{types:n}=r;if(n.length===1&&n[0]==="text/plain")return;t.preventDefault();const a=_a.#g(r.getData("text")||"").replaceAll(y$,`
|
|
@@ -23055,7 +23055,7 @@ to {
|
|
|
23055
23055
|
${({isMenuVisible:e})=>e===!1?he`
|
|
23056
23056
|
display: none;
|
|
23057
23057
|
`:null};
|
|
23058
|
-
`,u_e=e=>g.createElement("svg",{width:208,height:208,viewBox:"0 0 208 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{filter:"url(#filter0_f_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:44,fill:"url(#paint0_linear_251_38441)"}),g.createElement("circle",{cx:104,cy:104,r:50,stroke:"url(#paint1_linear_251_38441)",strokeWidth:12})),g.createElement("g",{filter:"url(#filter1_d_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:41.1429,fill:"#FAFAFA"}),g.createElement("circle",{cx:104,cy:104,r:43.1429,stroke:"url(#paint2_linear_251_38441)",strokeWidth:4})),g.createElement("g",{clipPath:"url(#clip0_251_38441)"},g.createElement("path",{d:"M120.16 102.411L96.2853 90.4684C96.0134 90.3343 95.7118 90.2718 95.409 90.2867C95.1062 90.3016 94.8122 90.3935 94.5548 90.5536C94.2974 90.7138 94.0851 90.9369 93.938 91.202C93.7908 91.467 93.7137 91.7652 93.7139 92.0684V115.931C93.7137 116.234 93.7908 116.533 93.938 116.798C94.0851 117.063 94.2974 117.286 94.5548 117.446C94.8122 117.606 95.1062 117.698 95.409 117.713C95.7118 117.728 96.0134 117.665 96.2853 117.531L120.16 105.588C120.456 105.442 120.706 105.216 120.88 104.935C121.055 104.654 121.147 104.33 121.147 104C121.147 103.669 121.055 103.345 120.88 103.065C120.706 102.784 120.456 102.558 120.16 102.411Z",fill:"black"})),g.createElement("defs",null,g.createElement("filter",{id:"filter0_f_251_38441",x:0,y:0,width:208,height:208,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),g.createElement("feGaussianBlur",{stdDeviation:24,result:"effect1_foregroundBlur_251_38441"})),g.createElement("filter",{id:"filter1_d_251_38441",x:54.8569,y:58.8571,width:98.2856,height:98.2857,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),g.createElement("feOffset",{dy:4}),g.createElement("feGaussianBlur",{stdDeviation:2}),g.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),g.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),g.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_251_38441"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_251_38441",result:"shape"})),g.createElement("linearGradient",{id:"paint0_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint1_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint2_linear_251_38441",x1:118.653,y1:118.653,x2:89.0159,y2:89.0164,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("clipPath",{id:"clip0_251_38441"},g.createElement("rect",{width:27.4286,height:27.4286,fill:"white",transform:"translate(93.7139 90.2849)"})))),H5e=g.lazy(()=>Xf(()=>import("./index-
|
|
23058
|
+
`,u_e=e=>g.createElement("svg",{width:208,height:208,viewBox:"0 0 208 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{filter:"url(#filter0_f_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:44,fill:"url(#paint0_linear_251_38441)"}),g.createElement("circle",{cx:104,cy:104,r:50,stroke:"url(#paint1_linear_251_38441)",strokeWidth:12})),g.createElement("g",{filter:"url(#filter1_d_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:41.1429,fill:"#FAFAFA"}),g.createElement("circle",{cx:104,cy:104,r:43.1429,stroke:"url(#paint2_linear_251_38441)",strokeWidth:4})),g.createElement("g",{clipPath:"url(#clip0_251_38441)"},g.createElement("path",{d:"M120.16 102.411L96.2853 90.4684C96.0134 90.3343 95.7118 90.2718 95.409 90.2867C95.1062 90.3016 94.8122 90.3935 94.5548 90.5536C94.2974 90.7138 94.0851 90.9369 93.938 91.202C93.7908 91.467 93.7137 91.7652 93.7139 92.0684V115.931C93.7137 116.234 93.7908 116.533 93.938 116.798C94.0851 117.063 94.2974 117.286 94.5548 117.446C94.8122 117.606 95.1062 117.698 95.409 117.713C95.7118 117.728 96.0134 117.665 96.2853 117.531L120.16 105.588C120.456 105.442 120.706 105.216 120.88 104.935C121.055 104.654 121.147 104.33 121.147 104C121.147 103.669 121.055 103.345 120.88 103.065C120.706 102.784 120.456 102.558 120.16 102.411Z",fill:"black"})),g.createElement("defs",null,g.createElement("filter",{id:"filter0_f_251_38441",x:0,y:0,width:208,height:208,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),g.createElement("feGaussianBlur",{stdDeviation:24,result:"effect1_foregroundBlur_251_38441"})),g.createElement("filter",{id:"filter1_d_251_38441",x:54.8569,y:58.8571,width:98.2856,height:98.2857,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),g.createElement("feOffset",{dy:4}),g.createElement("feGaussianBlur",{stdDeviation:2}),g.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),g.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),g.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_251_38441"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_251_38441",result:"shape"})),g.createElement("linearGradient",{id:"paint0_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint1_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint2_linear_251_38441",x1:118.653,y1:118.653,x2:89.0159,y2:89.0164,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("clipPath",{id:"clip0_251_38441"},g.createElement("rect",{width:27.4286,height:27.4286,fill:"white",transform:"translate(93.7139 90.2849)"})))),H5e=g.lazy(()=>Xf(()=>import("./index-DW4y2Msf.js"),__vite__mapDeps([13,5,1,6])));function eVo({src:e,autoPlay:t=!0,config:r,controls:n=!0,height:a="100%",isModalOpen:l,loop:c=!1,muted:d=!1,showPlayButton:p=!1,style:u,thumbnail:h,width:m="100%",onEnded:f,onModalClose:x,onPlay:y}){const b=Me(),[w,v]=g.useState(!1);g.useEffect(()=>{l===!0&&t?v(!0):l===!1&&v(!1)},[l,t]);const A={};r?.youtube&&(A.youtube=r.youtube);const S=()=>{v(!0),y?.()},E=()=>{v(!1),x?.()},I=()=>{v(!1),f?.(),l!=null&&x?.()},L=()=>{v(!0),y?.()};return l!=null?l?Fn.createPortal(s.jsx(nVo,{windowSize:b,role:"presentation",children:s.jsx(lr,{onClickAway:E,children:s.jsx(aVo,{windowSize:b,"data-testid":"video-player-modal",children:s.jsxs(sVo,{children:[p&&!w&&s.jsxs(s.Fragment,{children:[h!=null&&h!==""&&s.jsx(iVo,{src:h,alt:"Video thumbnail"}),s.jsx(oVo,{onClick:S,children:s.jsx(rVo,{windowSize:b})})]}),(!p||w)&&s.jsx(g.Suspense,{fallback:s.jsx("div",{style:{width:"100%",height:"100%"}}),children:s.jsx(H5e,{src:e,playing:w,controls:n,muted:d,loop:c,width:"100%",height:"100%",onEnded:I,onPlay:L,config:A})})]})})})}),document.body):null:s.jsx(g.Suspense,{fallback:s.jsx("div",{style:{width:m,height:a,...u}}),children:s.jsx(H5e,{src:e,playing:w,controls:n,muted:d,loop:c,width:m,height:a,style:u,light:p&&!w?h??!0:!1,onEnded:I,onPlay:L,config:A})})}const tVo=Vt`
|
|
23059
23059
|
0% {
|
|
23060
23060
|
transform: rotate(0deg);
|
|
23061
23061
|
}
|
|
@@ -95033,7 +95033,7 @@ ${e}`,bli=e=>g.createElement("svg",{width:38,height:39,viewBox:"0 0 38 39",fill:
|
|
|
95033
95033
|
`,kwi=i(zX)`
|
|
95034
95034
|
color: ${e=>e.theme.colors.alert};
|
|
95035
95035
|
margin-top: ${o.sp2};
|
|
95036
|
-
`;var Swi=BXe();const Lw=Yq(Swi);class Ewi{getSignedInUser(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),r=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER);if(r!=null&&t!=null)return JSON.parse(this.decrypt(r,t))}getShowNegativeAmountInParenthesis(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS),r=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&r!=null?JSON.parse(this.decrypt(t,r)):!1}getShowNegativeAmountInParenthesisPDF(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF),r=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&r!=null?JSON.parse(this.decrypt(t,r)):!0}getSignedInUserTenant(t){const r=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),n=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null&&n!=null)return JSON.parse(this.decrypt(r,n)).find(l=>l.tenantEmailDomain===t)}getSignedInUserTenantWithId(t){const r=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),n=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null&&n!=null)return JSON.parse(this.decrypt(r,n)).find(l=>l.tenantId===t)}getForceRefreshedComponents(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),r=window.localStorage.getItem(this.ZENI_FORCE_REFRESHED_COMPONENTS);if(r&&t!=null){const n=this.decrypt(r,t);return n?JSON.parse(n):[]}return[]}saveForceRefreshedComponents(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null?window.localStorage.setItem(this.ZENI_FORCE_REFRESHED_COMPONENTS,this.encrypt(JSON.stringify(t),r)):console.warn("Can't update the force refreshed components when the user is logged out!")}saveSignedInUserWithSession(t,r){if(t==null||r==null)throw new Error("Can't accept nil for user or session Id");window.localStorage.setItem(this.ZENI_SESSION_ID,r),window.localStorage.setItem(this.ZENI_SIGNED_IN_USER,this.encrypt(JSON.stringify(t),r))}saveSignedInUserTenants(t,r){const n=r??window.localStorage.getItem(this.ZENI_SESSION_ID);n!=null?window.localStorage.setItem(this.ZENI_SIGNED_IN_USER_TENANTS,this.encrypt(JSON.stringify(t),n)):console.warn("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesis(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesisPDF(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}isSignedIn(){return[this.ZENI_SESSION_ID,this.ZENI_SIGNED_IN_USER].map(r=>window.localStorage.getItem(r)!=null).reduce((r,n)=>r&&n)}clearAll(){this.ALL_IDs.forEach(t=>window.localStorage.removeItem(t))}setTheme(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null&&window.localStorage.setItem(this.ZENI_THEME,this.encrypt(t,r))}getTheme(){const t=window.localStorage.getItem(this.ZENI_THEME),r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null&&r!==null)return this.decrypt(t,r)}encrypt(t,r){return Lw.AES.encrypt(t,r).toString()}decrypt(t,r){return Lw.AES.decrypt(t,r).toString(Lw.enc.Utf8)}ZENI_SESSION_ID="ZENI_SESSION_ID";ZENI_SIGNED_IN_USER="ZENI_SIGNED_IN_USER";ZENI_SIGNED_IN_USER_TENANTS="ZENI_SIGNED_IN_USER_TENANTS";ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS="ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS";ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF="ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF";ZENI_THEME="ZENI_THEME";ZENI_FORCE_REFRESHED_COMPONENTS="ZENI_FORCE_REFRESHED_COMPONENTS";ALL_IDs=[this.ZENI_SESSION_ID,this.ZENI_SIGNED_IN_USER,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.ZENI_SIGNED_IN_USER_TENANTS,this.ZENI_THEME,this.ZENI_FORCE_REFRESHED_COMPONENTS]}const vs=new Ewi,Lwi=({children:e})=>{const t=SXe("(prefers-color-scheme: dark)"),[r,n]=$.useState({dark:t});g.useEffect(()=>{const p=vs.getTheme()==null?t:vs.getTheme()==="dark";r.dark!==p&&n({dark:p})},[r,t]);const a=()=>{const p=!r.dark;vs.setTheme(p?"dark":"light"),n({...r,dark:p})},l=r.dark?Wjo():Ujo(),c=typeof window<"u"?window.__NONCE__:void 0,d=c!=null&&c.length>0?c:void 0;return Co.jsx(s$o,{dark:r.dark,webAppTheme:l,toggle:a,nonce:d,children:e})},Iwi=["sandbox","production"],jwi=e=>q4(e,Iwi),Mwi=e=>{switch(e){case"DEV":case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"sandbox";case"PROD":case"NEXT":return"production";default:return"sandbox"}},Bwi=["development","staging","production"],Pwi=e=>q4(e,Bwi),Dwi=e=>{switch(e){case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"staging";case"PROD":case"NEXT":return"production";default:return"development"}},Twi=["DEV","QA","PUNE","SUNNYVALE","DELHI","MOHALI","PROD","NEXT"],zwi=e=>q4(e,Twi),t1=zwi("DEV"),Pv=()=>t1==="DEV"||t1==="QA"||t1==="PUNE"||t1==="SUNNYVALE"||t1==="DELHI"||t1==="MOHALI",Yoe="https://zeni-webapp-dev.uc.r.appspot.com",Rwi="63d3a2406505a5737a2b4debdb513f20",y3n=jwi(Mwi(t1)),Fwi=Pwi(Dwi(t1));function Owi(e,t){return Lw.AES.decrypt(e,t).toString(Lw.enc.Utf8)}const Nwi="ZENI-WEB-APP-",eZe=t1==="DEV"||t1==="QA"?.2:.8,Sa={sentryDsn:"",sentryTraceSamplingRate:eZe,googleClientId:"",googleMapsAPIKey:"",microsoftClientId:"",mixpanelToken:"",pusherClientSecret:"",pusherCluster:"",quickbooksKey:"",appUrl:"",featureClientSecret:"",featureClientSecretCockpit:"",cardVaultId:"",stripeKey:"",qboRedirectionUrl:"",mixpanelUrl:"",mixpanelHMUrl:""};let K4,Koe;function Hwi(e){Sa.sentryDsn=e.keys.SENTRY_DSN,Sa.sentryTraceSamplingRate=e.keys.SENTRY_TRACE_SAMPLE_RATES!=null?parseInt(e.keys.SENTRY_TRACE_SAMPLE_RATES):eZe,Sa.googleClientId=e.keys.GOOGLE_CLIENT_ID,Sa.googleMapsAPIKey=e.keys.GOOGLE_MAP_KEY,Sa.microsoftClientId=e.keys.MICROSOFT_CLIENT_ID,Sa.mixpanelToken=e.keys.MIXPANEL_TOKEN,Sa.pusherClientSecret=e.keys.PUSHER_CLIENT_SECRET,Sa.pusherCluster=e.keys.PUSHER_CLUSTER,Sa.quickbooksKey=e.keys.QUICKBOOK_TOKEN,Sa.appUrl=e.keys.WEB_ENDPOINT,Sa.featureClientSecret=e.keys.STATSIG_CLIENT_SECRET,Sa.featureClientSecretCockpit=e.keys.STATSIG_CLIENT_SECRET_COCKPIT,Sa.cardVaultId=e.keys.UNIT_VAULT_ID,Sa.stripeKey=e.keys.STRIPE_KEY,Sa.qboRedirectionUrl=e.keys.QBO_URL,Sa.mixpanelUrl=e.keys.MIXPANEL_URL,Sa.mixpanelHMUrl=e.keys.MIXPANEL_HM_URL,Koe=e.externalEndPoints,K4=e.apiEndPoints,_wi()}function _wi(){try{const e=new Set;if(K4!=null){for(const t of Object.values(K4))if(typeof t=="string"&&t.startsWith("http"))try{e.add(new URL(t).origin)}catch{}}for(const t of e){const r=document.createElement("link");r.rel="preconnect",r.href=t,r.crossOrigin="anonymous",document.head.appendChild(r)}}catch{}}async function Vwi(){const t=encodeURIComponent(JSON.stringify({environment:t1}));try{const r=await fetch(`${Yoe}/api/keys?query=${t}`);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){return console.error("Error fetching details:",r),null}}let p$e=!1;function qb(){p$e||(Uu.init(Rwi,{api_host:Koe.mixpanelBaseUrl,ignore_dnt:!0,store_google:!1,track_marketing:!1}),p$e=!0)}let u$e=!1,h$e=!1;function tZe(){if(u$e)return;u$e=!0,qb();const e=sl.extractUtmParamsFromUrl();Object.keys(e).length>0&&Uu.register(e),Pv()&&console.log(`[UTM] first-touch bootstrap: ${JSON.stringify(e)}`)}function Qwi(){return Uu?.persistence?.props??null}const Uwi=new Set(["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"]);function Wwi(){const e=Qwi();if(e==null)return;const t=Object.keys(e).filter(r=>r.startsWith("utm_")||Uwi.has(r));for(const r of t)Uu.unregister(r);Pv()&&t.length>0&&console.log(`[UTM] cleared from cookie: ${JSON.stringify(t)}`)}function Gwi(){h$e||(h$e=!0,Wwi())}class Zf{identify(t,r){if(qb(),this.#o=t,t!=null&&r!=null&&(Zf.#t==null||cXe({userId:t,traits:r},Zf.#t)!==!0)){const{$email:n,...a}={...r};Uu.identify(t),n&&n!=null&&Uu.people.set_once({$email:n}),Uu.people.set(a),Zf.#t={userId:t,traits:r},Pv()&&console.log(`*** Called people set with userId ${t} traits ${JSON.stringify(r)} `)}}identifyUserAndCompany(t,r,n,a,l){throw Error("Use identify in the web-app!!")}track(t,r){if(qb(),this.#o==null){console.error("user is not identified :(, so can not fire event");return}tZe();const n={distinct_id:this.#o,...r};Uu.track(t,n),Gwi(),Pv()&&console.log(`*** firing ${t} with props ${JSON.stringify(r)}`)}alias(t,r){qb(),Uu.alias(t,r)}reset(){qb(),Uu.reset(),this.#o=void 0,Zf.#t=void 0}static get analytics(){return this.#e}static#e=new sl.Analytics(new Zf);static#t;#o}const Vm=Zf.analytics;function Ywi(){tZe()}const Kwi=()=>{const e=mj(),t=gh(r=>r.companyState);if(e.pathname.includes("/management/parent/")){const r=e.pathname.split("/")[3],n=t.companiesById[r];if(n!=null)return`${n.companyInfo.name} ${W.getLocalizedStrings().cockpit.cockpitHeaderSubsidiaryText}`}if(e.pathname.includes("management/month-end-report/company/")){const r=e.pathname.split("/")[4],n=t.companiesById[r];if(n!=null)return n.companyInfo.name}},m$e=e=>{switch(e){case"healthMonitor":return"health-monitor";case"taskManager":return"task-manager";case"aiAccountant":return"ai-accountant";case"creditAgent":return"credit-agent";default:return e}},b3n=e=>{switch(e){case"healthMonitor":return"health monitor";case"taskManager":return"task manager";case"aiAccountant":return"ai accountant";case"creditAgent":return"credit agent";default:return e}};function qwi(e,t){return{updateDownloadStateHandler:r=>{e(dXe(r))},onZeniLogoClick:()=>{t.themeState.toggle()},onLogOutClick:()=>{e(FW()),e(OW(!1)),vs.clearAll();const r=t.locationHook.state?.origin??"/";t.navigate(r,{replace:!0})},onNewCustomerClick:()=>{t.navigate("/onboarding/new"),Vm?.trackOnboardingNewCustomerStarted()},onThreadClick:(r,n,a)=>{const l=r.entityType.split(".");if(l.length===2){const c=dCe(l[0]);if(c!=null){const d=m$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in thread: ${l[0]}`)}},onNotificationClick:(r,n,a)=>{const l=r.entityType.split(".");if(r.isGlobalComment&&l.length===2){const c=dCe(l[0]);if(c!=null){const d=m$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in notification: ${l[0]}`)}}}}function Zwi(e,t){const{signedInUser:r,cockpitHeader:n}=t,a=e.tenantState.currentTenantId,c=yj(e)?.companyName??"",d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:a??""};return{signedInUser:r,cockpitHeader:n,downloadState:e.companyViewState.downloadState,downloadParams:{currentTenantCompanyName:c,cockpitEndPoint:`${Yoe}/cockpitTabs`,authParams:d}}}const Jwi=nJe(Zwi,qwi)(fii);function Xwi(){const e=yNe(),t=vs.getSignedInUser(),r=Kq(),n=mj(),a=Kwi(),l=gh(p=>pXe(p)),c={tabsFileType:"excel",tabs:["management","subscription","portfolio","onboarding","healthMonitor"],filterByTabs:l.filterByTabs,timezone:uXe()},d=n.pathname.split("/")[1];return Co.jsx(Jwi,{locationHook:n,themeState:e,signedInUser:t,cockpitHeader:a,allTabsViews:l,defaultOptions:c,analytics:Vm,currentTab:d,navigate:r})}const evi=["/management/*","/subscription/*","/onboarding/*","/portfolio/*","/audit/*","/health-monitor/*","/task-manager/*","/ai-accountant/*","/credit-agent/*"];function tvi({appContent:e}){const t=evi.filter(r=>aJe(r)).length===0;return Co.jsxs(Co.Fragment,{children:[t?null:Co.jsx(Xwi,{}),Co.jsx(Co.Fragment,{children:e})]})}const ovi="cockpit",oZe="init-enter";function rvi({location:e,visitedUrl:t}){const{pathname:r}=e;return g.useLayoutEffect(()=>{const n=t.get(r||oZe);g$e(n!==void 0?n:0)}),null}const ivi=g.memo(rvi,(e,t)=>{const{location:r,visitedUrl:n}=e,{location:a}=t,l=r.pathname||oZe,c=nvi();return n.set(l,c),!((a.pathname!==r.pathname||a.search!==r.search)&&a.hash==="")}),g$e=(e=0)=>window.requestAnimationFrame(()=>{window.scrollTo(0,e)}),nvi=()=>{let e=0;return document!=null&&document.documentElement!==null&&(e=document.documentElement.scrollTop),window.pageYOffset||e},rZe=e=>g.lazy(async()=>{const t=e.toString(),r=vs.getForceRefreshedComponents(),n=new Set(r),a=n.has(t);try{const l=await e();return n.delete(t),vs.saveForceRefreshedComponents(Array.from(n)),l}catch(l){throw a||(n.add(t),vs.saveForceRefreshedComponents(Array.from(n)),location.reload()),l}}),avi=rZe(()=>Xf(()=>import("./ScreenRoutes-mNNAq2e0.js").then(e=>e.S),__vite__mapDeps([14,5,1,6,15,8,16,17,7,2,4,9,11]))),svi=rZe(()=>Xf(()=>import("./SignInScreen-Dbb-FrOZ.js"),__vite__mapDeps([18,15,1,6,8,5,16,17,19,20,21,7])));function lvi(){const e=g.useRef();e.current==null&&(e.current=new Map);const t=Kq(),r=mj();return g.useEffect(()=>{Ywi()},[]),g.useEffect(()=>{const n="signin/auth";vs.isSignedIn()===!1&&!r.pathname.includes(n)&&t(n,{replace:!0,state:{...r.state,message:"...",origin:r.pathname}})}),Co.jsxs(pvi,{children:[Co.jsx(ivi,{visitedUrl:e.current,location:r}),Co.jsx(cvi,{})]})}const cvi=()=>{const e=vs.isSignedIn(),t=vs.getSignedInUser(),r=e&&E$e(t),n=gh(p=>yj(p)),a={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:n.tenantId??""},l=gh(p=>hXe(p)),d=gh(p=>mXe(p)).map(p=>({companyId:p.companyId,tenantId:p.tenantId,companyName:p.name}));return Co.jsx(rQr,{roomId:ovi,authParams:a,users:l,companies:d,authUrlEndPoint:`${K4.tenantMicroServiceBaseUrl}/1.0/commenting/auth`,fetchZeniUsers:!1,commentingUsersUrlEndPoint:`${K4.tenantMicroServiceBaseUrl}/1.0/users/zeni-users`,autoConnect:r,withRoomProvider:!1,loggedInUser:t,withThreadsProvider:!0,filter:{application:"cockpit"},children:Co.jsx(dvi,{})})},dvi=()=>Co.jsx(g.Suspense,{fallback:Co.jsx(uvi,{children:Co.jsx(Ao,{size:"Large",start:!0})}),children:Co.jsxs(sJe,{children:[Co.jsx(uT,{path:"/",element:Co.jsx(lJe,{to:"management",replace:!0})}),Co.jsx(uT,{path:"/signin/auth",element:Co.jsx(svi,{})}),Co.jsx(uT,{path:"*",element:Co.jsx(tvi,{appContent:Co.jsx(avi,{})})})]})}),pvi=eo("div")``,uvi=eo("div")`
|
|
95036
|
+
`;var Swi=BXe();const Lw=Yq(Swi);class Ewi{getSignedInUser(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),r=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER);if(r!=null&&t!=null)return JSON.parse(this.decrypt(r,t))}getShowNegativeAmountInParenthesis(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS),r=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&r!=null?JSON.parse(this.decrypt(t,r)):!1}getShowNegativeAmountInParenthesisPDF(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF),r=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&r!=null?JSON.parse(this.decrypt(t,r)):!0}getSignedInUserTenant(t){const r=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),n=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null&&n!=null)return JSON.parse(this.decrypt(r,n)).find(l=>l.tenantEmailDomain===t)}getSignedInUserTenantWithId(t){const r=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),n=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null&&n!=null)return JSON.parse(this.decrypt(r,n)).find(l=>l.tenantId===t)}getForceRefreshedComponents(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),r=window.localStorage.getItem(this.ZENI_FORCE_REFRESHED_COMPONENTS);if(r&&t!=null){const n=this.decrypt(r,t);return n?JSON.parse(n):[]}return[]}saveForceRefreshedComponents(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null?window.localStorage.setItem(this.ZENI_FORCE_REFRESHED_COMPONENTS,this.encrypt(JSON.stringify(t),r)):console.warn("Can't update the force refreshed components when the user is logged out!")}saveSignedInUserWithSession(t,r){if(t==null||r==null)throw new Error("Can't accept nil for user or session Id");window.localStorage.setItem(this.ZENI_SESSION_ID,r),window.localStorage.setItem(this.ZENI_SIGNED_IN_USER,this.encrypt(JSON.stringify(t),r))}saveSignedInUserTenants(t,r){const n=r??window.localStorage.getItem(this.ZENI_SESSION_ID);n!=null?window.localStorage.setItem(this.ZENI_SIGNED_IN_USER_TENANTS,this.encrypt(JSON.stringify(t),n)):console.warn("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesis(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesisPDF(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}isSignedIn(){return[this.ZENI_SESSION_ID,this.ZENI_SIGNED_IN_USER].map(r=>window.localStorage.getItem(r)!=null).reduce((r,n)=>r&&n)}clearAll(){this.ALL_IDs.forEach(t=>window.localStorage.removeItem(t))}setTheme(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null&&window.localStorage.setItem(this.ZENI_THEME,this.encrypt(t,r))}getTheme(){const t=window.localStorage.getItem(this.ZENI_THEME),r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null&&r!==null)return this.decrypt(t,r)}encrypt(t,r){return Lw.AES.encrypt(t,r).toString()}decrypt(t,r){return Lw.AES.decrypt(t,r).toString(Lw.enc.Utf8)}ZENI_SESSION_ID="ZENI_SESSION_ID";ZENI_SIGNED_IN_USER="ZENI_SIGNED_IN_USER";ZENI_SIGNED_IN_USER_TENANTS="ZENI_SIGNED_IN_USER_TENANTS";ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS="ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS";ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF="ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF";ZENI_THEME="ZENI_THEME";ZENI_FORCE_REFRESHED_COMPONENTS="ZENI_FORCE_REFRESHED_COMPONENTS";ALL_IDs=[this.ZENI_SESSION_ID,this.ZENI_SIGNED_IN_USER,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.ZENI_SIGNED_IN_USER_TENANTS,this.ZENI_THEME,this.ZENI_FORCE_REFRESHED_COMPONENTS]}const vs=new Ewi,Lwi=({children:e})=>{const t=SXe("(prefers-color-scheme: dark)"),[r,n]=$.useState({dark:t});g.useEffect(()=>{const p=vs.getTheme()==null?t:vs.getTheme()==="dark";r.dark!==p&&n({dark:p})},[r,t]);const a=()=>{const p=!r.dark;vs.setTheme(p?"dark":"light"),n({...r,dark:p})},l=r.dark?Wjo():Ujo(),c=typeof window<"u"?window.__NONCE__:void 0,d=c!=null&&c.length>0?c:void 0;return Co.jsx(s$o,{dark:r.dark,webAppTheme:l,toggle:a,nonce:d,children:e})},Iwi=["sandbox","production"],jwi=e=>q4(e,Iwi),Mwi=e=>{switch(e){case"DEV":case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"sandbox";case"PROD":case"NEXT":return"production";default:return"sandbox"}},Bwi=["development","staging","production"],Pwi=e=>q4(e,Bwi),Dwi=e=>{switch(e){case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"staging";case"PROD":case"NEXT":return"production";default:return"development"}},Twi=["DEV","QA","PUNE","SUNNYVALE","DELHI","MOHALI","PROD","NEXT"],zwi=e=>q4(e,Twi),t1=zwi("DEV"),Pv=()=>t1==="DEV"||t1==="QA"||t1==="PUNE"||t1==="SUNNYVALE"||t1==="DELHI"||t1==="MOHALI",Yoe="https://zeni-webapp-dev.uc.r.appspot.com",Rwi="63d3a2406505a5737a2b4debdb513f20",y3n=jwi(Mwi(t1)),Fwi=Pwi(Dwi(t1));function Owi(e,t){return Lw.AES.decrypt(e,t).toString(Lw.enc.Utf8)}const Nwi="ZENI-WEB-APP-",eZe=t1==="DEV"||t1==="QA"?.2:.8,Sa={sentryDsn:"",sentryTraceSamplingRate:eZe,googleClientId:"",googleMapsAPIKey:"",microsoftClientId:"",mixpanelToken:"",pusherClientSecret:"",pusherCluster:"",quickbooksKey:"",appUrl:"",featureClientSecret:"",featureClientSecretCockpit:"",cardVaultId:"",stripeKey:"",qboRedirectionUrl:"",mixpanelUrl:"",mixpanelHMUrl:""};let K4,Koe;function Hwi(e){Sa.sentryDsn=e.keys.SENTRY_DSN,Sa.sentryTraceSamplingRate=e.keys.SENTRY_TRACE_SAMPLE_RATES!=null?parseInt(e.keys.SENTRY_TRACE_SAMPLE_RATES):eZe,Sa.googleClientId=e.keys.GOOGLE_CLIENT_ID,Sa.googleMapsAPIKey=e.keys.GOOGLE_MAP_KEY,Sa.microsoftClientId=e.keys.MICROSOFT_CLIENT_ID,Sa.mixpanelToken=e.keys.MIXPANEL_TOKEN,Sa.pusherClientSecret=e.keys.PUSHER_CLIENT_SECRET,Sa.pusherCluster=e.keys.PUSHER_CLUSTER,Sa.quickbooksKey=e.keys.QUICKBOOK_TOKEN,Sa.appUrl=e.keys.WEB_ENDPOINT,Sa.featureClientSecret=e.keys.STATSIG_CLIENT_SECRET,Sa.featureClientSecretCockpit=e.keys.STATSIG_CLIENT_SECRET_COCKPIT,Sa.cardVaultId=e.keys.UNIT_VAULT_ID,Sa.stripeKey=e.keys.STRIPE_KEY,Sa.qboRedirectionUrl=e.keys.QBO_URL,Sa.mixpanelUrl=e.keys.MIXPANEL_URL,Sa.mixpanelHMUrl=e.keys.MIXPANEL_HM_URL,Koe=e.externalEndPoints,K4=e.apiEndPoints,_wi()}function _wi(){try{const e=new Set;if(K4!=null){for(const t of Object.values(K4))if(typeof t=="string"&&t.startsWith("http"))try{e.add(new URL(t).origin)}catch{}}for(const t of e){const r=document.createElement("link");r.rel="preconnect",r.href=t,r.crossOrigin="anonymous",document.head.appendChild(r)}}catch{}}async function Vwi(){const t=encodeURIComponent(JSON.stringify({environment:t1}));try{const r=await fetch(`${Yoe}/api/keys?query=${t}`);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){return console.error("Error fetching details:",r),null}}let p$e=!1;function qb(){p$e||(Uu.init(Rwi,{api_host:Koe.mixpanelBaseUrl,ignore_dnt:!0,store_google:!1,track_marketing:!1}),p$e=!0)}let u$e=!1,h$e=!1;function tZe(){if(u$e)return;u$e=!0,qb();const e=sl.extractUtmParamsFromUrl();Object.keys(e).length>0&&Uu.register(e),Pv()&&console.log(`[UTM] first-touch bootstrap: ${JSON.stringify(e)}`)}function Qwi(){return Uu?.persistence?.props??null}const Uwi=new Set(["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"]);function Wwi(){const e=Qwi();if(e==null)return;const t=Object.keys(e).filter(r=>r.startsWith("utm_")||Uwi.has(r));for(const r of t)Uu.unregister(r);Pv()&&t.length>0&&console.log(`[UTM] cleared from cookie: ${JSON.stringify(t)}`)}function Gwi(){h$e||(h$e=!0,Wwi())}class Zf{identify(t,r){if(qb(),this.#o=t,t!=null&&r!=null&&(Zf.#t==null||cXe({userId:t,traits:r},Zf.#t)!==!0)){const{$email:n,...a}={...r};Uu.identify(t),n&&n!=null&&Uu.people.set_once({$email:n}),Uu.people.set(a),Zf.#t={userId:t,traits:r},Pv()&&console.log(`*** Called people set with userId ${t} traits ${JSON.stringify(r)} `)}}identifyUserAndCompany(t,r,n,a,l){throw Error("Use identify in the web-app!!")}track(t,r){if(qb(),this.#o==null){console.error("user is not identified :(, so can not fire event");return}tZe();const n={distinct_id:this.#o,...r};Uu.track(t,n),Gwi(),Pv()&&console.log(`*** firing ${t} with props ${JSON.stringify(r)}`)}alias(t,r){qb(),Uu.alias(t,r)}reset(){qb(),Uu.reset(),this.#o=void 0,Zf.#t=void 0}static get analytics(){return this.#e}static#e=new sl.Analytics(new Zf);static#t;#o}const Vm=Zf.analytics;function Ywi(){tZe()}const Kwi=()=>{const e=mj(),t=gh(r=>r.companyState);if(e.pathname.includes("/management/parent/")){const r=e.pathname.split("/")[3],n=t.companiesById[r];if(n!=null)return`${n.companyInfo.name} ${W.getLocalizedStrings().cockpit.cockpitHeaderSubsidiaryText}`}if(e.pathname.includes("management/month-end-report/company/")){const r=e.pathname.split("/")[4],n=t.companiesById[r];if(n!=null)return n.companyInfo.name}},m$e=e=>{switch(e){case"healthMonitor":return"health-monitor";case"taskManager":return"task-manager";case"aiAccountant":return"ai-accountant";case"creditAgent":return"credit-agent";default:return e}},b3n=e=>{switch(e){case"healthMonitor":return"health monitor";case"taskManager":return"task manager";case"aiAccountant":return"ai accountant";case"creditAgent":return"credit agent";default:return e}};function qwi(e,t){return{updateDownloadStateHandler:r=>{e(dXe(r))},onZeniLogoClick:()=>{t.themeState.toggle()},onLogOutClick:()=>{e(FW()),e(OW(!1)),vs.clearAll();const r=t.locationHook.state?.origin??"/";t.navigate(r,{replace:!0})},onNewCustomerClick:()=>{t.navigate("/onboarding/new"),Vm?.trackOnboardingNewCustomerStarted()},onThreadClick:(r,n,a)=>{const l=r.entityType.split(".");if(l.length===2){const c=dCe(l[0]);if(c!=null){const d=m$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in thread: ${l[0]}`)}},onNotificationClick:(r,n,a)=>{const l=r.entityType.split(".");if(r.isGlobalComment&&l.length===2){const c=dCe(l[0]);if(c!=null){const d=m$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in notification: ${l[0]}`)}}}}function Zwi(e,t){const{signedInUser:r,cockpitHeader:n}=t,a=e.tenantState.currentTenantId,c=yj(e)?.companyName??"",d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:a??""};return{signedInUser:r,cockpitHeader:n,downloadState:e.companyViewState.downloadState,downloadParams:{currentTenantCompanyName:c,cockpitEndPoint:`${Yoe}/cockpitTabs`,authParams:d}}}const Jwi=nJe(Zwi,qwi)(fii);function Xwi(){const e=yNe(),t=vs.getSignedInUser(),r=Kq(),n=mj(),a=Kwi(),l=gh(p=>pXe(p)),c={tabsFileType:"excel",tabs:["management","subscription","portfolio","onboarding","healthMonitor"],filterByTabs:l.filterByTabs,timezone:uXe()},d=n.pathname.split("/")[1];return Co.jsx(Jwi,{locationHook:n,themeState:e,signedInUser:t,cockpitHeader:a,allTabsViews:l,defaultOptions:c,analytics:Vm,currentTab:d,navigate:r})}const evi=["/management/*","/subscription/*","/onboarding/*","/portfolio/*","/audit/*","/health-monitor/*","/task-manager/*","/ai-accountant/*","/credit-agent/*"];function tvi({appContent:e}){const t=evi.filter(r=>aJe(r)).length===0;return Co.jsxs(Co.Fragment,{children:[t?null:Co.jsx(Xwi,{}),Co.jsx(Co.Fragment,{children:e})]})}const ovi="cockpit",oZe="init-enter";function rvi({location:e,visitedUrl:t}){const{pathname:r}=e;return g.useLayoutEffect(()=>{const n=t.get(r||oZe);g$e(n!==void 0?n:0)}),null}const ivi=g.memo(rvi,(e,t)=>{const{location:r,visitedUrl:n}=e,{location:a}=t,l=r.pathname||oZe,c=nvi();return n.set(l,c),!((a.pathname!==r.pathname||a.search!==r.search)&&a.hash==="")}),g$e=(e=0)=>window.requestAnimationFrame(()=>{window.scrollTo(0,e)}),nvi=()=>{let e=0;return document!=null&&document.documentElement!==null&&(e=document.documentElement.scrollTop),window.pageYOffset||e},rZe=e=>g.lazy(async()=>{const t=e.toString(),r=vs.getForceRefreshedComponents(),n=new Set(r),a=n.has(t);try{const l=await e();return n.delete(t),vs.saveForceRefreshedComponents(Array.from(n)),l}catch(l){throw a||(n.add(t),vs.saveForceRefreshedComponents(Array.from(n)),location.reload()),l}}),avi=rZe(()=>Xf(()=>import("./ScreenRoutes-CR0rsb0Y.js").then(e=>e.S),__vite__mapDeps([14,5,1,6,15,8,16,17,7,2,4,9,11]))),svi=rZe(()=>Xf(()=>import("./SignInScreen-z6WbJ1aE.js"),__vite__mapDeps([18,15,1,6,8,5,16,17,19,20,21,7])));function lvi(){const e=g.useRef();e.current==null&&(e.current=new Map);const t=Kq(),r=mj();return g.useEffect(()=>{Ywi()},[]),g.useEffect(()=>{const n="signin/auth";vs.isSignedIn()===!1&&!r.pathname.includes(n)&&t(n,{replace:!0,state:{...r.state,message:"...",origin:r.pathname}})}),Co.jsxs(pvi,{children:[Co.jsx(ivi,{visitedUrl:e.current,location:r}),Co.jsx(cvi,{})]})}const cvi=()=>{const e=vs.isSignedIn(),t=vs.getSignedInUser(),r=e&&E$e(t),n=gh(p=>yj(p)),a={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:n.tenantId??""},l=gh(p=>hXe(p)),d=gh(p=>mXe(p)).map(p=>({companyId:p.companyId,tenantId:p.tenantId,companyName:p.name}));return Co.jsx(rQr,{roomId:ovi,authParams:a,users:l,companies:d,authUrlEndPoint:`${K4.tenantMicroServiceBaseUrl}/1.0/commenting/auth`,fetchZeniUsers:!1,commentingUsersUrlEndPoint:`${K4.tenantMicroServiceBaseUrl}/1.0/users/zeni-users`,autoConnect:r,withRoomProvider:!1,loggedInUser:t,withThreadsProvider:!0,filter:{application:"cockpit"},children:Co.jsx(dvi,{})})},dvi=()=>Co.jsx(g.Suspense,{fallback:Co.jsx(uvi,{children:Co.jsx(Ao,{size:"Large",start:!0})}),children:Co.jsxs(sJe,{children:[Co.jsx(uT,{path:"/",element:Co.jsx(lJe,{to:"management",replace:!0})}),Co.jsx(uT,{path:"/signin/auth",element:Co.jsx(svi,{})}),Co.jsx(uT,{path:"*",element:Co.jsx(tvi,{appContent:Co.jsx(avi,{})})})]})}),pvi=eo("div")``,uvi=eo("div")`
|
|
95037
95037
|
display: flex;
|
|
95038
95038
|
flex: 1 1 auto;
|
|
95039
95039
|
flex-direction: row;
|