@zeniai/web-cockpit-ui 2.0.37-prod → 2.0.38-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.
Files changed (37) hide show
  1. package/dist/assets/{Preview-CWvs7Tny.js → Preview-DThBLNBu.js} +1 -1
  2. package/dist/assets/{ScreenRoutes-5MCnCULj.js → ScreenRoutes-C-MvTpAE.js} +1 -1
  3. package/dist/assets/{SignInScreen-DU3SZdEJ.js → SignInScreen-CQcxmIgQ.js} +1 -1
  4. package/dist/assets/{analytics-DGbnpy1_.js → analytics-BBZrbTm5.js} +1 -1
  5. package/dist/assets/{analyticsHelper-BJMrKtRV.js → analyticsHelper-D3qiW3E8.js} +1 -1
  6. package/dist/assets/{core--drY8Tri.js → core-b2yP1yat.js} +1 -1
  7. package/dist/assets/{dash.all.min-BYzlFk7y.js → dash.all.min-C71NSZtE.js} +1 -1
  8. package/dist/assets/{empty-CyhzbTWJ.js → empty-BCwlhSXs.js} +1 -1
  9. package/dist/assets/{empty-LIJVfXls.js → empty-C4jycCdP.js} +1 -1
  10. package/dist/assets/{epic-DP8UtYGd.js → epic-DSIkQN4U.js} +1 -1
  11. package/dist/assets/{index-DUU8Hnuj.js → index-BRv9f-n4.js} +1 -1
  12. package/dist/assets/{index-D2v_SjpC.js → index-C6nGAUOI.js} +1 -1
  13. package/dist/assets/{index-PqeyBbTq.js → index-D6NG1W-L.js} +6 -6
  14. package/dist/assets/{index-D6vbZjCC.js → index-DFCafQMq.js} +1 -1
  15. package/dist/assets/{index-Bp-7eV5c.js → index-Db_Wr1S4.js} +2 -2
  16. package/dist/assets/{index-Cm3DEy1L.js → index-DvNFByHc.js} +1 -1
  17. package/dist/assets/{index-7cqCij-k.js → index-Sy__jr2U.js} +1 -1
  18. package/dist/assets/{lexical-DkkNA4Za.js → lexical-B_8lIgQf.js} +1 -1
  19. package/dist/assets/{liveblocks-HFnq7SuY.js → liveblocks-Dqoe8aMJ.js} +1 -1
  20. package/dist/assets/{lottie-BzjltUm6.js → lottie-BKGDuCSI.js} +1 -1
  21. package/dist/assets/{mui-CxXcv3hP.js → mui-C_gN3Vx0.js} +1 -1
  22. package/dist/assets/{react-DwfVqt-F.js → react-CpQNHTtF.js} +1 -1
  23. package/dist/assets/{react-0qvOmT-q.js → react-DFP5OzAC.js} +1 -1
  24. package/dist/assets/{react-C6xVmAUA.js → react-DFolNGoo.js} +1 -1
  25. package/dist/assets/{react-Dsh5ksHl.js → react-DZGeKri6.js} +2 -2
  26. package/dist/assets/{react-CfDPxbOG.js → react-DoXC7GVG.js} +1 -1
  27. package/dist/assets/{react-ClaJ_bS5.js → react-DuZWND_a.js} +1 -1
  28. package/dist/assets/{react-BacAD1lb.js → react-FravVR8b.js} +1 -1
  29. package/dist/assets/{react-DMSlURrB.js → react-Ye0nq4h8.js} +1 -1
  30. package/dist/assets/{recharts-DmYFPeqK.js → recharts-DqrV7HAk.js} +1 -1
  31. package/dist/assets/{sentry-BqWEWC0e.js → sentry-DsYES6l6.js} +1 -1
  32. package/dist/assets/{url-Disk6EIb.js → url-BfdLx8mq.js} +1 -1
  33. package/dist/assets/{url-CsEI5vH-.js → url-DRVfq9I7.js} +1 -1
  34. package/dist/assets/{utils-D_VJ9WeB.js → utils-CmU840tj.js} +1 -1
  35. package/dist/assets/{zeni-epic-state-Bl-1LTas.js → zeni-epic-state-ByWZnDTr.js} +3 -3
  36. package/dist/index.html +1 -1
  37. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/empty-LIJVfXls.js","assets/sentry-BqWEWC0e.js","assets/empty-CyhzbTWJ.js","assets/index-DUU8Hnuj.js","assets/index-Cm3DEy1L.js","assets/zeni-epic-state-Bl-1LTas.js","assets/core--drY8Tri.js","assets/utils-D_VJ9WeB.js","assets/recharts-DmYFPeqK.js","assets/url-CsEI5vH-.js","assets/index-D2v_SjpC.js","assets/index-D6vbZjCC.js","assets/url-Disk6EIb.js","assets/index-Bp-7eV5c.js","assets/ScreenRoutes-5MCnCULj.js","assets/liveblocks-HFnq7SuY.js","assets/analyticsHelper-BJMrKtRV.js","assets/mui-CxXcv3hP.js","assets/analytics-DGbnpy1_.js","assets/lottie-BzjltUm6.js","assets/lexical-DkkNA4Za.js","assets/SignInScreen-DU3SZdEJ.js"])))=>i.map(i=>d[i]);
2
- import{a as g,b as k,R as gBe,c as p3,p as eh,r as Ml,g as ZH,e as NY,f as fBe,s as HY,w as xBe,i as yBe,S as wBe,j as bBe,k as vBe,l as CBe,m as $Be}from"./sentry-BqWEWC0e.js";import{j as co,_ as j4e,a as ac,u as I4e,T as kBe,C as SBe,b as ABe,c as nS,d as aS,e as EBe,f as M4e,g as LBe,h as jBe,L as IBe,i as VY,k as MBe,l as TBe,P as PBe,m as BBe,n as DBe,o as T4e,p as _Be,q as zBe,I as UY,r as RBe,s as FBe,t as OBe,v as NBe,w as HBe,x as VBe,y as P4e,z as UBe,A as WBe,B as QBe}from"./liveblocks-HFnq7SuY.js";import{f as B4e,R as Fg,r as ca,P as Yi,u as sS,g as Wu,h as GBe,i as JH,j as YBe,k as KBe,l as Oj,N as qBe,m as ZBe,n as JBe,B as XBe}from"./core--drY8Tri.js";import{H as EC,ba as Og,bb as eDe,bc as WY,bd as M3,be as Rr,bf as D4e,bg as lS,bh as vr,bi as tDe,bj as oDe,bk as B5,bl as w2,bm as XH,bn as _4e,bo as rDe,bp as z4e,bq as iDe,br as R4e,bs as nDe,bt as Ei,bu as D5,bv as Cu,bw as aDe,bx as sDe,by as lDe,bz as dDe,bA as QY,bB as cDe,bC as uDe,bD as pDe,bE as hDe,bF as eV,bG as F4e,bH as b2,bI as mDe,bJ as O4e,bK as pF,bL as GY,bM as YY,bN as KY,bO as Rs,bP as tV,bQ as oV,bR as h7,bS as rV,bT as iV,bU as nV,bV as aV,bW as gDe,bX as LC,bY as fDe,bZ as N4e,b_ as sV,b$ as xDe,c0 as wh,c1 as Lx,c2 as jx,c3 as yDe,c4 as wDe,c5 as bDe,c6 as vDe,c7 as CDe,c8 as $De,c9 as kDe,ca as SDe,cb as ADe,cc as EDe,cd as LDe,ce as jDe,cf as IDe,cg as MDe,ch as TDe,ci as PDe,cj as BDe,ck as DDe,cl as _De,cm as zDe,cn as RDe,co as H4e,cp as FDe,cq as qY,cr as ODe,cs as NDe,ct as HDe,cu as H9,cv as V4e,cw as U4e,cx as VDe,cy as W4e,cz as ZY,cA as Q4e,cB as G4e,cC as Y4e,cD as K4e,cE as q4e,cF as UDe,cG as Z4e,cH as WDe,cI as QDe,cJ as GDe,cK as J4e,cL as hF,cM as YDe,cN as X4e,cO as efe,cP as KDe,cQ as qDe,cR as ZDe,cS as JDe,cT as XDe,cU as e_e,cV as t_e,cW as o_e,v as r_e,cX as dS,cY as mF,cZ as gF,c_ as i_e,c$ as n_e,d0 as a_e,d1 as s_e,d2 as l_e,d3 as d_e,d4 as c_e,d5 as u_e,d6 as p_e,d7 as h_e,d8 as JY,d9 as m_e,da as g_e,db as f_e,dc as x_e,dd as y_e}from"./zeni-epic-state-Bl-1LTas.js";import{T as tfe,j as ko,n,c as ge,k as Ot,G as Ix,C as ofe,u as rfe,a as w_e}from"./mui-CxXcv3hP.js";import{r as b_e,m as $u}from"./analytics-DGbnpy1_.js";import{L as fF}from"./lottie-BzjltUm6.js";import{r as Un}from"./lexical-DkkNA4Za.js";import{E as wi,c as cS,P as v_e,R as xF,F as jC,X as nd,Y as ad,G as Oh,H as IC,I as uS,J as Nh,K as ife,L as C_e,M as $_e,N as T3,O as lV,Q as dV,S as Mx,U as k_e}from"./recharts-DmYFPeqK.js";import{r as S_e}from"./utils-D_VJ9WeB.js";(function(){try{var e=typeof window<"u"?window:typeof p3<"u"?p3:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b7f69437-c68e-46c3-bfc3-1459519e4847",e._sentryDebugIdIdentifier="sentry-dbid-b7f69437-c68e-46c3-bfc3-1459519e4847")}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"]'))i(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const d of s.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function o(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(a){if(a.ep)return;a.ep=!0;const s=o(a);fetch(a.href,s)}})();var ow={},XY;function A_e(){if(XY)return ow;XY=1;var e=B4e();return ow.createRoot=e.createRoot,ow.hydrateRoot=e.hydrateRoot,ow}var E_e=A_e(),hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof p3<"u"?p3:typeof self<"u"?self:{};function fr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var eK={exports:{}},l6={},tK;function L_e(){if(tK)return l6;tK=1;var e=k,t=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(c,u,p){var h,m={},f=null,x=null;p!==void 0&&(f=""+p),u.key!==void 0&&(f=""+u.key),u.ref!==void 0&&(x=u.ref);for(h in u)i.call(u,h)&&!s.hasOwnProperty(h)&&(m[h]=u[h]);if(c&&c.defaultProps)for(h in u=c.defaultProps,u)m[h]===void 0&&(m[h]=u[h]);return{$$typeof:t,type:c,key:f,ref:x,props:m,_owner:a.current}}return l6.Fragment=o,l6.jsx=d,l6.jsxs=d,l6}var oK;function nfe(){return oK||(oK=1,eK.exports=L_e()),eK.exports}var l=nfe();const j_e=g.createContext(null),Nj={didCatch:!1,error:null};let I_e=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Nj}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var t,o,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];(t=(o=this.props).onReset)===null||t===void 0||t.call(o,{args:a,reason:"imperative-api"}),this.setState(Nj)}}componentDidCatch(e,t){var o,i;(o=(i=this.props).onError)===null||o===void 0||o.call(i,e,t)}componentDidUpdate(e,t){const{didCatch:o}=this.state,{resetKeys:i}=this.props;if(o&&t.error!==null&&M_e(e.resetKeys,i)){var a,s;(a=(s=this.props).onReset)===null||a===void 0||a.call(s,{next:i,prev:e.resetKeys,reason:"keys"}),this.setState(Nj)}}render(){const{children:e,fallbackRender:t,FallbackComponent:o,fallback:i}=this.props,{didCatch:a,error:s}=this.state;let d=e;if(a){const c={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")d=t(c);else if(o)d=g.createElement(o,c);else if(i!==void 0)d=i;else throw s}return g.createElement(j_e.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},d)}};function M_e(){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((o,i)=>!Object.is(o,t[i]))}var yF={exports:{}},T_e=yF.exports,rK;function P_e(){return rK||(rK=1,function(e){(function(t,o){e.exports?e.exports=o():t.numeral=o()})(T_e,function(){var t,o,i="2.0.6",a={},s={},d={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},c={currentLocale:d.currentLocale,zeroFormat:d.zeroFormat,nullFormat:d.nullFormat,defaultFormat:d.defaultFormat,scalePercentBy100:d.scalePercentBy100};function u(p,h){this._input=p,this._value=h}return t=function(p){var h,m,f,x;if(t.isNumeral(p))h=p.value();else if(p===0||typeof p>"u")h=0;else if(p===null||o.isNaN(p))h=null;else if(typeof p=="string")if(c.zeroFormat&&p===c.zeroFormat)h=0;else if(c.nullFormat&&p===c.nullFormat||!p.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&&p.match(x)){f=a[m].unformat;break}f=f||t._.stringToNumber,h=f(p)}else h=Number(p)||null;return new u(p,h)},t.version=i,t.isNumeral=function(p){return p instanceof u},t._=o={numberToFormat:function(p,h,m){var f=s[t.options.currentLocale],x=!1,y=!1,w=0,b="",C=1e12,$=1e9,A=1e6,E=1e3,I="",L=!1,T,P,B,_,R,z,Y;if(p=p||0,P=Math.abs(p),t._.includes(h,"(")?(x=!0,h=h.replace(/[\(|\)]/g,"")):(t._.includes(h,"+")||t._.includes(h,"-"))&&(R=t._.includes(h,"+")?h.indexOf("+"):p<0?h.indexOf("-"):-1,h=h.replace(/[\+|\-]/g,"")),t._.includes(h,"a")&&(T=h.match(/a(k|m|b|t)?/),T=T?T[1]:!1,t._.includes(h," a")&&(b=" "),h=h.replace(new RegExp(b+"a[kmbt]?"),""),P>=C&&!T||T==="t"?(b+=f.abbreviations.trillion,p=p/C):P<C&&P>=$&&!T||T==="b"?(b+=f.abbreviations.billion,p=p/$):P<$&&P>=A&&!T||T==="m"?(b+=f.abbreviations.million,p=p/A):(P<A&&P>=E&&!T||T==="k")&&(b+=f.abbreviations.thousand,p=p/E)),t._.includes(h,"[.]")&&(y=!0,h=h.replace("[.]",".")),B=p.toString().split(".")[0],_=h.split(".")[1],z=h.indexOf(","),w=(h.split(".")[0].split(",")[0].match(/0/g)||[]).length,_?(t._.includes(_,"[")?(_=_.replace("]",""),_=_.split("["),I=t._.toFixed(p,_[0].length+_[1].length,m,_[1].length)):I=t._.toFixed(p,_.length,m),B=I.split(".")[0],t._.includes(I,".")?I=f.delimiters.decimal+I.split(".")[1]:I="",y&&Number(I.slice(1))===0&&(I="")):B=t._.toFixed(p,0,m),b&&!T&&Number(B)>=1e3&&b!==f.abbreviations.trillion)switch(B=String(Number(B)/1e3),b){case f.abbreviations.thousand:b=f.abbreviations.million;break;case f.abbreviations.million:b=f.abbreviations.billion;break;case f.abbreviations.billion:b=f.abbreviations.trillion;break}if(t._.includes(B,"-")&&(B=B.slice(1),L=!0),B.length<w)for(var Z=w-B.length;Z>0;Z--)B="0"+B;return z>-1&&(B=B.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),h.indexOf(".")===0&&(B=""),Y=B+I+(b||""),x?Y=(x&&L?"(":"")+Y+(x&&L?")":""):R>=0?Y=R===0?(L?"-":"+")+Y:Y+(L?"-":"+"):L&&(Y="-"+Y),Y},stringToNumber:function(p){var h=s[c.currentLocale],m=p,f={thousand:3,million:6,billion:9,trillion:12},x,y,w;if(c.zeroFormat&&p===c.zeroFormat)y=0;else if(c.nullFormat&&p===c.nullFormat||!p.replace(/[^0-9]+/g,"").length)y=null;else{y=1,h.delimiters.decimal!=="."&&(p=p.replace(/\./g,"").replace(h.delimiters.decimal,"."));for(x in f)if(w=new RegExp("[^a-zA-Z]"+h.abbreviations[x]+"(?:\\)|(\\"+h.currency.symbol+")?(?:\\))?)?$"),m.match(w)){y*=Math.pow(10,f[x]);break}y*=(p.split("-").length+Math.min(p.split("(").length-1,p.split(")").length-1))%2?1:-1,p=p.replace(/[^0-9\.]+/g,""),y*=Number(p)}return y},isNaN:function(p){return typeof p=="number"&&isNaN(p)},includes:function(p,h){return p.indexOf(h)!==-1},insert:function(p,h,m){return p.slice(0,m)+h+p.slice(m)},reduce:function(p,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(p),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(p){var h=p.toString().split(".");return h.length<2?1:Math.pow(10,h[1].length)},correctionFactor:function(){var p=Array.prototype.slice.call(arguments);return p.reduce(function(h,m){var f=o.multiplier(m);return h>f?h:f},1)},toFixed:function(p,h,m,f){var x=p.toString().split("."),y=h-(f||0),w,b,C,$;return x.length===2?w=Math.min(Math.max(x[1].length,y),h):w=y,C=Math.pow(10,w),$=(m(p+"e+"+w)/C).toFixed(w),f>h-w&&(b=new RegExp("\\.?0{1,"+(f-(h-w))+"}$"),$=$.replace(b,"")),$}},t.options=c,t.formats=a,t.locales=s,t.locale=function(p){return p&&(c.currentLocale=p.toLowerCase()),c.currentLocale},t.localeData=function(p){if(!p)return s[c.currentLocale];if(p=p.toLowerCase(),!s[p])throw new Error("Unknown locale : "+p);return s[p]},t.reset=function(){for(var p in d)c[p]=d[p]},t.zeroFormat=function(p){c.zeroFormat=typeof p=="string"?p:null},t.nullFormat=function(p){c.nullFormat=typeof p=="string"?p:null},t.defaultFormat=function(p){c.defaultFormat=typeof p=="string"?p:"0.0"},t.register=function(p,h,m){if(h=h.toLowerCase(),this[p+"s"][h])throw new TypeError(h+" "+p+" already registered.");return this[p+"s"][h]=m,m},t.validate=function(p,h){var m,f,x,y,w,b,C,$;if(typeof p!="string"&&(p+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",p)),p=p.trim(),p.match(/^\d+$/))return!0;if(p==="")return!1;try{C=t.localeData(h)}catch{C=t.localeData(t.locale())}return x=C.currency.symbol,w=C.abbreviations,m=C.delimiters.decimal,C.delimiters.thousands==="."?f="\\.":f=C.delimiters.thousands,$=p.match(/^[^\d]+/),$!==null&&(p=p.substr(1),$[0]!==x)||($=p.match(/[^\d]+$/),$!==null&&(p=p.slice(0,-1),$[0]!==w.thousand&&$[0]!==w.million&&$[0]!==w.billion&&$[0]!==w.trillion))?!1:(b=new RegExp(f+"{2}"),p.match(/[^\d.,]/g)?!1:(y=p.split(m),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(b):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(b)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(b)&&!!y[1].match(/^\d+$/)))},t.fn=u.prototype={clone:function(){return t(this)},format:function(p,h){var m=this._value,f=p||c.defaultFormat,x,y,w;if(h=h||Math.round,m===0&&c.zeroFormat!==null)y=c.zeroFormat;else if(m===null&&c.nullFormat!==null)y=c.nullFormat;else{for(x in a)if(f.match(a[x].regexps.format)){w=a[x].format;break}w=w||t._.numberToFormat,y=w(m,f,h)}return y},value:function(){return this._value},input:function(){return this._input},set:function(p){return this._value=Number(p),this},add:function(p){var h=o.correctionFactor.call(null,this._value,p);function m(f,x,y,w){return f+Math.round(h*x)}return this._value=o.reduce([this._value,p],m,0)/h,this},subtract:function(p){var h=o.correctionFactor.call(null,this._value,p);function m(f,x,y,w){return f-Math.round(h*x)}return this._value=o.reduce([p],m,Math.round(this._value*h))/h,this},multiply:function(p){function h(m,f,x,y){var w=o.correctionFactor(m,f);return Math.round(m*w)*Math.round(f*w)/Math.round(w*w)}return this._value=o.reduce([this._value,p],h,1),this},divide:function(p){function h(m,f,x,y){var w=o.correctionFactor(m,f);return Math.round(m*w)/Math.round(f*w)}return this._value=o.reduce([this._value,p],h),this},difference:function(p){return Math.abs(t(this._value).subtract(p).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(p){var h=p%10;return~~(p%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(p,h,m){var f=t._.includes(h," BPS")?" ":"",x;return p=p*1e4,h=h.replace(/\s?BPS/,""),x=t._.numberToFormat(p,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"BPS"),x=x.join("")):x=x+f+"BPS",x},unformat:function(p){return+(t._.stringToNumber(p)*1e-4).toFixed(15)}})}(),function(){var p={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=p.suffixes.concat(h.suffixes.filter(function(x){return p.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,w){var b,C=t._.includes(y,"ib")?h:p,$=t._.includes(y," b")||t._.includes(y," ib")?" ":"",A,E,I;for(y=y.replace(/\s?i?b/,""),A=0;A<=C.suffixes.length;A++)if(E=Math.pow(C.base,A),I=Math.pow(C.base,A+1),x===null||x===0||x>=E&&x<I){$+=C.suffixes[A],E>0&&(x=x/E);break}return b=t._.numberToFormat(x,y,w),b+$},unformat:function(x){var y=t._.stringToNumber(x),w,b;if(y){for(w=p.suffixes.length-1;w>=0;w--){if(t._.includes(x,p.suffixes[w])){b=Math.pow(p.base,w);break}if(t._.includes(x,h.suffixes[w])){b=Math.pow(h.base,w);break}}y*=b||1}return y}})}(),function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(p,h,m){var f=t.locales[t.options.currentLocale],x={before:h.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:h.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,w,b;for(h=h.replace(/\s?\$\s?/,""),y=t._.numberToFormat(p,h,m),p>=0?(x.before=x.before.replace(/[\-\(]/,""),x.after=x.after.replace(/[\-\)]/,"")):p<0&&!t._.includes(x.before,"-")&&!t._.includes(x.before,"(")&&(x.before="-"+x.before),b=0;b<x.before.length;b++)switch(w=x.before[b],w){case"$":y=t._.insert(y,f.currency.symbol,b);break;case" ":y=t._.insert(y," ",b+f.currency.symbol.length-1);break}for(b=x.after.length-1;b>=0;b--)switch(w=x.after[b],w){case"$":y=b===x.after.length-1?y+f.currency.symbol:t._.insert(y,f.currency.symbol,-(x.after.length-(1+b)));break;case" ":y=b===x.after.length-1?y+" ":t._.insert(y," ",-(x.after.length-(1+b)+f.currency.symbol.length-1));break}return y}})}(),function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(p,h,m){var f,x=typeof p=="number"&&!t._.isNaN(p)?p.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(p){var h=t._.includes(p,"e+")?p.split("e+"):p.split("e-"),m=Number(h[0]),f=Number(h[1]);f=t._.includes(p,"e-")?f*=-1:f;function x(y,w,b,C){var $=t._.correctionFactor(y,w),A=y*$*(w*$)/($*$);return A}return t._.reduce([m,Math.pow(10,f)],x,1)}})}(),function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(p,h,m){var f=t.locales[t.options.currentLocale],x,y=t._.includes(h," o")?" ":"";return h=h.replace(/\s?o/,""),y+=f.ordinal(p),x=t._.numberToFormat(p,h,m),x+y}})}(),function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(p,h,m){var f=t._.includes(h," %")?" ":"",x;return t.options.scalePercentBy100&&(p=p*100),h=h.replace(/\s?\%/,""),x=t._.numberToFormat(p,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"%"),x=x.join("")):x=x+f+"%",x},unformat:function(p){var h=t._.stringToNumber(p);return t.options.scalePercentBy100?h*.01:h}})}(),function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(p,h,m){var f=Math.floor(p/60/60),x=Math.floor((p-f*60*60)/60),y=Math.round(p-f*60*60-x*60);return f+":"+(x<10?"0"+x:x)+":"+(y<10?"0"+y:y)},unformat:function(p){var h=p.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})}(yF)),yF.exports}var B_e=P_e();const $h=fr(B_e);function Ih(e,...t){const o=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(i=>o.searchParams.append("args[]",i)),`Minified MUI error #${e}; visit ${o} for the full message.`}const kh="$$material";function D_e(e){for(var t=0,o,i=0,a=e.length;a>=4;++i,a-=4)o=e.charCodeAt(i)&255|(e.charCodeAt(++i)&255)<<8|(e.charCodeAt(++i)&255)<<16|(e.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+((o>>>16)*59797<<16),o^=o>>>24,t=(o&65535)*1540483477+((o>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(i+2)&255)<<16;case 2:t^=(e.charCodeAt(i+1)&255)<<8;case 1:t^=e.charCodeAt(i)&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 __e={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 z_e(e){var t=Object.create(null);return function(o){return t[o]===void 0&&(t[o]=e(o)),t[o]}}var R_e=/[A-Z]|^ms/g,F_e=/_EMO_([^_]+?)_([^]*?)_EMO_/g,afe=function(e){return e.charCodeAt(1)===45},iK=function(e){return e!=null&&typeof e!="boolean"},Hj=z_e(function(e){return afe(e)?e:e.replace(R_e,"-$&").toLowerCase()}),nK=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(F_e,function(o,i,a){return G0={name:i,styles:a,next:G0},i})}return __e[e]!==1&&!afe(e)&&typeof t=="number"&&t!==0?t+"px":t};function MC(e,t,o){if(o==null)return"";var i=o;if(i.__emotion_styles!==void 0)return i;switch(typeof o){case"boolean":return"";case"object":{var a=o;if(a.anim===1)return G0={name:a.name,styles:a.styles,next:G0},a.name;var s=o;if(s.styles!==void 0){var d=s.next;if(d!==void 0)for(;d!==void 0;)G0={name:d.name,styles:d.styles,next:G0},d=d.next;var c=s.styles+";";return c}return O_e(e,t,o)}}var u=o;return u}function O_e(e,t,o){var i="";if(Array.isArray(o))for(var a=0;a<o.length;a++)i+=MC(e,t,o[a])+";";else for(var s in o){var d=o[s];if(typeof d!="object"){var c=d;iK(c)&&(i+=Hj(s)+":"+nK(s,c)+";")}else if(Array.isArray(d)&&typeof d[0]=="string"&&t==null)for(var u=0;u<d.length;u++)iK(d[u])&&(i+=Hj(s)+":"+nK(s,d[u])+";");else{var p=MC(e,t,d);switch(s){case"animation":case"animationName":{i+=Hj(s)+":"+p+";";break}default:i+=s+"{"+p+"}"}}}return i}var aK=/label:\s*([^\s;{]+)\s*(;|$)/g,G0;function N_e(e,t,o){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var i=!0,a="";G0=void 0;var s=e[0];if(s==null||s.raw===void 0)i=!1,a+=MC(o,t,s);else{var d=s;a+=d[0]}for(var c=1;c<e.length;c++)if(a+=MC(o,t,e[c]),i){var u=s;a+=u[c]}aK.lastIndex=0;for(var p="",h;(h=aK.exec(a))!==null;)p+="-"+h[1];var m=D_e(a)+p;return{name:m,styles:a,next:G0}}var Vj={exports:{}},Uj,sK;function H_e(){if(sK)return Uj;sK=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Uj=e,Uj}var Wj,lK;function V_e(){if(lK)return Wj;lK=1;var e=H_e();function t(){}function o(){}return o.resetWarningCache=t,Wj=function(){function i(d,c,u,p,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}}i.isRequired=i;function a(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:o,resetWarningCache:t};return s.PropTypes=s,s},Wj}var dK;function cV(){return dK||(dK=1,Vj.exports=V_e()()),Vj.exports}var U_e=cV();const Tt=fr(U_e);function W_e(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 Q_e(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 G_e=function(){function e(o){var i=this;this._insertTag=function(a){var s;i.tags.length===0?i.insertionPoint?s=i.insertionPoint.nextSibling:i.prepend?s=i.container.firstChild:s=i.before:s=i.tags[i.tags.length-1].nextSibling,i.container.insertBefore(a,s),i.tags.push(a)},this.isSpeedy=o.speedy===void 0?!0:o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(o){o.forEach(this._insertTag)},t.insert=function(o){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Q_e(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var a=W_e(i);try{a.insertRule(o,a.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(o));this.ctr++},t.flush=function(){this.tags.forEach(function(o){var i;return(i=o.parentNode)==null?void 0:i.removeChild(o)}),this.tags=[],this.ctr=0},e}(),as="-ms-",TC="-moz-",Qr="-webkit-",sfe="comm",uV="rule",pV="decl",Y_e="@import",lfe="@keyframes",K_e="@layer",q_e=Math.abs,pS=String.fromCharCode,Z_e=Object.assign;function J_e(e,t){return Ua(e,0)^45?(((t<<2^Ua(e,0))<<2^Ua(e,1))<<2^Ua(e,2))<<2^Ua(e,3):0}function dfe(e){return e.trim()}function X_e(e,t){return(e=t.exec(e))?e[0]:e}function Gr(e,t,o){return e.replace(t,o)}function wF(e,t){return e.indexOf(t)}function Ua(e,t){return e.charCodeAt(t)|0}function V9(e,t,o){return e.slice(t,o)}function ku(e){return e.length}function hV(e){return e.length}function rw(e,t){return t.push(e),e}function eze(e,t){return e.map(t).join("")}var hS=1,_5=1,cfe=0,Sl=0,On=0,m7="";function mS(e,t,o,i,a,s,d){return{value:e,root:t,parent:o,type:i,props:a,children:s,line:hS,column:_5,length:d,return:""}}function d6(e,t){return Z_e(mS("",null,null,"",null,null,0),e,{length:-e.length},t)}function tze(){return On}function oze(){return On=Sl>0?Ua(m7,--Sl):0,_5--,On===10&&(_5=1,hS--),On}function od(){return On=Sl<cfe?Ua(m7,Sl++):0,_5++,On===10&&(_5=1,hS++),On}function Xu(){return Ua(m7,Sl)}function Yv(){return Sl}function Tx(e,t){return V9(m7,e,t)}function U9(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 ufe(e){return hS=_5=1,cfe=ku(m7=e),Sl=0,[]}function pfe(e){return m7="",e}function Kv(e){return dfe(Tx(Sl-1,bF(e===91?e+2:e===40?e+1:e)))}function rze(e){for(;(On=Xu())&&On<33;)od();return U9(e)>2||U9(On)>3?"":" "}function ize(e,t){for(;--t&&od()&&!(On<48||On>102||On>57&&On<65||On>70&&On<97););return Tx(e,Yv()+(t<6&&Xu()==32&&od()==32))}function bF(e){for(;od();)switch(On){case e:return Sl;case 34:case 39:e!==34&&e!==39&&bF(On);break;case 40:e===41&&bF(e);break;case 92:od();break}return Sl}function nze(e,t){for(;od()&&e+On!==57&&!(e+On===84&&Xu()===47););return"/*"+Tx(t,Sl-1)+"*"+pS(e===47?e:od())}function aze(e){for(;!U9(Xu());)od();return Tx(e,Sl)}function sze(e){return pfe(qv("",null,null,null,[""],e=ufe(e),0,[0],e))}function qv(e,t,o,i,a,s,d,c,u){for(var p=0,h=0,m=d,f=0,x=0,y=0,w=1,b=1,C=1,$=0,A="",E=a,I=s,L=i,T=A;b;)switch(y=$,$=od()){case 40:if(y!=108&&Ua(T,m-1)==58){wF(T+=Gr(Kv($),"&","&\f"),"&\f")!=-1&&(C=-1);break}case 34:case 39:case 91:T+=Kv($);break;case 9:case 10:case 13:case 32:T+=rze(y);break;case 92:T+=ize(Yv()-1,7);continue;case 47:switch(Xu()){case 42:case 47:rw(lze(nze(od(),Yv()),t,o),u);break;default:T+="/"}break;case 123*w:c[p++]=ku(T)*C;case 125*w:case 59:case 0:switch($){case 0:case 125:b=0;case 59+h:C==-1&&(T=Gr(T,/\f/g,"")),x>0&&ku(T)-m&&rw(x>32?uK(T+";",i,o,m-1):uK(Gr(T," ","")+";",i,o,m-2),u);break;case 59:T+=";";default:if(rw(L=cK(T,t,o,p,h,a,c,A,E=[],I=[],m),s),$===123)if(h===0)qv(T,t,L,L,E,s,m,c,I);else switch(f===99&&Ua(T,3)===110?100:f){case 100:case 108:case 109:case 115:qv(e,L,L,i&&rw(cK(e,L,L,0,0,a,c,A,a,E=[],m),I),a,I,m,c,i?E:I);break;default:qv(T,L,L,L,[""],I,0,c,I)}}p=h=x=0,w=C=1,A=T="",m=d;break;case 58:m=1+ku(T),x=y;default:if(w<1){if($==123)--w;else if($==125&&w++==0&&oze()==125)continue}switch(T+=pS($),$*w){case 38:C=h>0?1:(T+="\f",-1);break;case 44:c[p++]=(ku(T)-1)*C,C=1;break;case 64:Xu()===45&&(T+=Kv(od())),f=Xu(),h=m=ku(A=T+=aze(Yv())),$++;break;case 45:y===45&&ku(T)==2&&(w=0)}}return s}function cK(e,t,o,i,a,s,d,c,u,p,h){for(var m=a-1,f=a===0?s:[""],x=hV(f),y=0,w=0,b=0;y<i;++y)for(var C=0,$=V9(e,m+1,m=q_e(w=d[y])),A=e;C<x;++C)(A=dfe(w>0?f[C]+" "+$:Gr($,/&\f/g,f[C])))&&(u[b++]=A);return mS(e,t,o,a===0?uV:c,u,p,h)}function lze(e,t,o){return mS(e,t,o,sfe,pS(tze()),V9(e,2,-2),0)}function uK(e,t,o,i){return mS(e,t,o,pV,V9(e,0,i),V9(e,i+1,-1),i)}function u5(e,t){for(var o="",i=hV(e),a=0;a<i;a++)o+=t(e[a],a,e,t)||"";return o}function dze(e,t,o,i){switch(e.type){case K_e:if(e.children.length)break;case Y_e:case pV:return e.return=e.return||e.value;case sfe:return"";case lfe:return e.return=e.value+"{"+u5(e.children,i)+"}";case uV:e.value=e.props.join(",")}return ku(o=u5(e.children,i))?e.return=e.value+"{"+o+"}":""}function cze(e){var t=hV(e);return function(o,i,a,s){for(var d="",c=0;c<t;c++)d+=e[c](o,i,a,s)||"";return d}}function uze(e){return function(t){t.root||(t=t.return)&&e(t)}}var pze=function(e,t,o){for(var i=0,a=0;i=a,a=Xu(),i===38&&a===12&&(t[o]=1),!U9(a);)od();return Tx(e,Sl)},hze=function(e,t){var o=-1,i=44;do switch(U9(i)){case 0:i===38&&Xu()===12&&(t[o]=1),e[o]+=pze(Sl-1,t,o);break;case 2:e[o]+=Kv(i);break;case 4:if(i===44){e[++o]=Xu()===58?"&\f":"",t[o]=e[o].length;break}default:e[o]+=pS(i)}while(i=od());return e},mze=function(e,t){return pfe(hze(ufe(e),t))},pK=new WeakMap,gze=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,o=e.parent,i=e.column===o.column&&e.line===o.line;o.type!=="rule";)if(o=o.parent,!o)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!pK.get(o))&&!i){pK.set(e,!0);for(var a=[],s=mze(t,a),d=o.props,c=0,u=0;c<s.length;c++)for(var p=0;p<d.length;p++,u++)e.props[u]=a[c]?s[c].replace(/&\f/g,d[p]):d[p]+" "+s[c]}}},fze=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function hfe(e,t){switch(J_e(e,t)){case 5103:return Qr+"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 Qr+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Qr+e+TC+e+as+e+e;case 6828:case 4268:return Qr+e+as+e+e;case 6165:return Qr+e+as+"flex-"+e+e;case 5187:return Qr+e+Gr(e,/(\w+).+(:[^]+)/,Qr+"box-$1$2"+as+"flex-$1$2")+e;case 5443:return Qr+e+as+"flex-item-"+Gr(e,/flex-|-self/,"")+e;case 4675:return Qr+e+as+"flex-line-pack"+Gr(e,/align-content|flex-|-self/,"")+e;case 5548:return Qr+e+as+Gr(e,"shrink","negative")+e;case 5292:return Qr+e+as+Gr(e,"basis","preferred-size")+e;case 6060:return Qr+"box-"+Gr(e,"-grow","")+Qr+e+as+Gr(e,"grow","positive")+e;case 4554:return Qr+Gr(e,/([^-])(transform)/g,"$1"+Qr+"$2")+e;case 6187:return Gr(Gr(Gr(e,/(zoom-|grab)/,Qr+"$1"),/(image-set)/,Qr+"$1"),e,"")+e;case 5495:case 3959:return Gr(e,/(image-set\([^]*)/,Qr+"$1$`$1");case 4968:return Gr(Gr(e,/(.+:)(flex-)?(.*)/,Qr+"box-pack:$3"+as+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Qr+e+e;case 4095:case 3583:case 4068:case 2532:return Gr(e,/(.+)-inline(.+)/,Qr+"$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(ku(e)-1-t>6)switch(Ua(e,t+1)){case 109:if(Ua(e,t+4)!==45)break;case 102:return Gr(e,/(.+:)(.+)-([^]+)/,"$1"+Qr+"$2-$3$1"+TC+(Ua(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~wF(e,"stretch")?hfe(Gr(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ua(e,t+1)!==115)break;case 6444:switch(Ua(e,ku(e)-3-(~wF(e,"!important")&&10))){case 107:return Gr(e,":",":"+Qr)+e;case 101:return Gr(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Qr+(Ua(e,14)===45?"inline-":"")+"box$3$1"+Qr+"$2$3$1"+as+"$2box$3")+e}break;case 5936:switch(Ua(e,t+11)){case 114:return Qr+e+as+Gr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Qr+e+as+Gr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Qr+e+as+Gr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Qr+e+as+e+e}return e}var xze=function(e,t,o,i){if(e.length>-1&&!e.return)switch(e.type){case pV:e.return=hfe(e.value,e.length);break;case lfe:return u5([d6(e,{value:Gr(e.value,"@","@"+Qr)})],i);case uV:if(e.length)return eze(e.props,function(a){switch(X_e(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return u5([d6(e,{props:[Gr(a,/:(read-\w+)/,":"+TC+"$1")]})],i);case"::placeholder":return u5([d6(e,{props:[Gr(a,/:(plac\w+)/,":"+Qr+"input-$1")]}),d6(e,{props:[Gr(a,/:(plac\w+)/,":"+TC+"$1")]}),d6(e,{props:[Gr(a,/:(plac\w+)/,as+"input-$1")]})],i)}return""})}},yze=[xze],mfe=function(e){var t=e.key;if(t==="css"){var o=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(o,function(y){var w=y.getAttribute("data-emotion");w.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var i=e.stylisPlugins||yze,a={},s,d=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(y){for(var w=y.getAttribute("data-emotion").split(" "),b=1;b<w.length;b++)a[w[b]]=!0;d.push(y)});var c,u=[gze,fze];{var p,h=[dze,uze(function(y){p.insert(y)})],m=cze(u.concat(i,h)),f=function(y){return u5(sze(y),m)};c=function(y,w,b,C){p=b,f(y?y+"{"+w.styles+"}":w.styles),C&&(x.inserted[w.name]=!0)}}var x={key:t,sheet:new G_e({key:t,container:s,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:c};return x.sheet.hydrate(d),x};function wze(e){return e==null||Object.keys(e).length===0}function gfe(e){const{styles:t,defaultTheme:o={}}=e,i=typeof t=="function"?a=>t(wze(a)?o:a):t;return l.jsx(Ix,{styles:i})}function bze(e,t){return n(e,t)}function vze(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const hK=[];function n2(e){return hK[0]=e,N_e(hK)}var mK={exports:{}},hi={},gK;function Cze(){if(gK)return hi;gK=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),d=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),p=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(w){if(typeof w=="object"&&w!==null){var b=w.$$typeof;switch(b){case e:switch(w=w.type,w){case o:case a:case i:case u:case p:case f:return w;default:switch(w=w&&w.$$typeof,w){case d:case c:case m:case h:return w;case s:return w;default:return b}}case t:return b}}}return hi.ContextConsumer=s,hi.ContextProvider=d,hi.Element=e,hi.ForwardRef=c,hi.Fragment=o,hi.Lazy=m,hi.Memo=h,hi.Portal=t,hi.Profiler=a,hi.StrictMode=i,hi.Suspense=u,hi.SuspenseList=p,hi.isContextConsumer=function(w){return y(w)===s},hi.isContextProvider=function(w){return y(w)===d},hi.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},hi.isForwardRef=function(w){return y(w)===c},hi.isFragment=function(w){return y(w)===o},hi.isLazy=function(w){return y(w)===m},hi.isMemo=function(w){return y(w)===h},hi.isPortal=function(w){return y(w)===t},hi.isProfiler=function(w){return y(w)===a},hi.isStrictMode=function(w){return y(w)===i},hi.isSuspense=function(w){return y(w)===u},hi.isSuspenseList=function(w){return y(w)===p},hi.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===o||w===a||w===i||w===u||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===m||w.$$typeof===h||w.$$typeof===d||w.$$typeof===s||w.$$typeof===c||w.$$typeof===x||w.getModuleId!==void 0)},hi.typeOf=y,hi}var fK;function $ze(){return fK||(fK=1,mK.exports=Cze()),mK.exports}var ffe=$ze();function lh(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 xfe(e){if(g.isValidElement(e)||ffe.isValidElementType(e)||!lh(e))return e;const t={};return Object.keys(e).forEach(o=>{t[o]=xfe(e[o])}),t}function xs(e,t,o={clone:!0}){const i=o.clone?{...e}:e;return lh(e)&&lh(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||ffe.isValidElementType(t[a])?i[a]=t[a]:lh(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&lh(e[a])?i[a]=xs(e[a],t[a],o):o.clone?i[a]=lh(t[a])?xfe(t[a]):t[a]:i[a]=t[a]}),i}const kze=e=>{const t=Object.keys(e).map(o=>({key:o,val:e[o]}))||[];return t.sort((o,i)=>o.val-i.val),t.reduce((o,i)=>({...o,[i.key]:i.val}),{})};function Sze(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:o="px",step:i=5,...a}=e,s=kze(t),d=Object.keys(s);function c(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${o})`}function u(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-i/100}${o})`}function p(f,x){const y=d.indexOf(x);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${o}) and (max-width:${(y!==-1&&typeof t[d[y]]=="number"?t[d[y]]:x)-i/100}${o})`}function h(f){return d.indexOf(f)+1<d.length?p(f,d[d.indexOf(f)+1]):c(f)}function m(f){const x=d.indexOf(f);return x===0?c(d[1]):x===d.length-1?u(d[x]):p(f,d[d.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:d,values:s,up:c,down:u,between:p,only:h,not:m,unit:o,...a}}function xK(e,t){if(!e.containerQueries)return t;const o=Object.keys(t).filter(i=>i.startsWith("@container")).sort((i,a)=>{const s=/min-width:\s*([0-9.]+)/;return+(i.match(s)?.[1]||0)-+(a.match(s)?.[1]||0)});return o.length?o.reduce((i,a)=>{const s=t[a];return delete i[a],i[a]=s,i},{...t}):t}function Aze(e,t){return t==="@"||t.startsWith("@")&&(e.some(o=>t.startsWith(`@${o}`))||!!t.match(/^@\d/))}function Eze(e,t){const o=t.match(/^@([^/]+)?\/?(.+)?$/);if(!o)return null;const[,i,a]=o,s=Number.isNaN(+i)?i||0:+i;return e.containerQueries(a).up(s)}function Lze(e){const t=(s,d)=>s.replace("@media",d?`@container ${d}`:"@container");function o(s,d){s.up=(...c)=>t(e.breakpoints.up(...c),d),s.down=(...c)=>t(e.breakpoints.down(...c),d),s.between=(...c)=>t(e.breakpoints.between(...c),d),s.only=(...c)=>t(e.breakpoints.only(...c),d),s.not=(...c)=>{const u=t(e.breakpoints.not(...c),d);return u.includes("not all and")?u.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):u}}const i={},a=s=>(o(i,s),i);return o(a),{...e,containerQueries:a}}const jze={borderRadius:4};function y9(e,t){return t?xs(e,t,{clone:!1}):e}const gS={xs:0,sm:600,md:900,lg:1200,xl:1536},yK={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${gS[e]}px)`},Ize={containerQueries:e=>({up:t=>{let o=typeof t=="number"?t:gS[t]||t;return typeof o=="number"&&(o=`${o}px`),e?`@container ${e} (min-width:${o})`:`@container (min-width:${o})`}})};function Mh(e,t,o){const i=e.theme||{};if(Array.isArray(t)){const a=i.breakpoints||yK;return t.reduce((s,d,c)=>(s[a.up(a.keys[c])]=o(t[c]),s),{})}if(typeof t=="object"){const a=i.breakpoints||yK;return Object.keys(t).reduce((s,d)=>{if(Aze(a.keys,d)){const c=Eze(i.containerQueries?i:Ize,d);c&&(s[c]=o(t[d],d))}else if(Object.keys(a.values||gS).includes(d)){const c=a.up(d);s[c]=o(t[d],d)}else{const c=d;s[c]=t[c]}return s},{})}return o(t)}function Mze(e={}){return e.keys?.reduce((t,o)=>{const i=e.up(o);return t[i]={},t},{})||{}}function wK(e,t){return e.reduce((o,i)=>{const a=o[i];return(!a||Object.keys(a).length===0)&&delete o[i],o},t)}function No(e){if(typeof e!="string")throw new Error(Ih(7));return e.charAt(0).toUpperCase()+e.slice(1)}function fS(e,t,o=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&o){const i=`vars.${t}`.split(".").reduce((a,s)=>a&&a[s]?a[s]:null,e);if(i!=null)return i}return t.split(".").reduce((i,a)=>i&&i[a]!=null?i[a]:null,e)}function PC(e,t,o,i=o){let a;return typeof e=="function"?a=e(o):Array.isArray(e)?a=e[o]||i:a=fS(e,o)||i,t&&(a=t(a,i,e)),a}function Mn(e){const{prop:t,cssProperty:o=e.prop,themeKey:i,transform:a}=e,s=d=>{if(d[t]==null)return null;const c=d[t],u=d.theme,p=fS(u,i)||{};return Mh(d,c,h=>{let m=PC(p,a,h);return h===m&&typeof h=="string"&&(m=PC(p,a,`${t}${h==="default"?"":No(h)}`,h)),o===!1?m:{[o]:m}})};return s.propTypes={},s.filterProps=[t],s}function Tze(e){const t={};return o=>(t[o]===void 0&&(t[o]=e(o)),t[o])}const Pze={m:"margin",p:"padding"},Bze={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},bK={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Dze=Tze(e=>{if(e.length>2)if(bK[e])e=bK[e];else return[e];const[t,o]=e.split(""),i=Pze[t],a=Bze[o]||"";return Array.isArray(a)?a.map(s=>i+s):[i+a]}),mV=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],gV=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...mV,...gV];function Px(e,t,o,i){const a=fS(e,t,!0)??o;return typeof a=="number"||typeof a=="string"?s=>typeof s=="string"?s:typeof a=="string"?a.startsWith("var(")&&s===0?0:a.startsWith("var(")&&s===1?a:`calc(${s} * ${a})`:a*s:Array.isArray(a)?s=>{if(typeof s=="string")return s;const d=Math.abs(s),c=a[d];return s>=0?c:typeof c=="number"?-c:typeof c=="string"&&c.startsWith("var(")?`calc(-1 * ${c})`:`-${c}`}:typeof a=="function"?a:()=>{}}function fV(e){return Px(e,"spacing",8)}function Bx(e,t){return typeof t=="string"||t==null?t:e(t)}function _ze(e,t){return o=>e.reduce((i,a)=>(i[a]=Bx(t,o),i),{})}function zze(e,t,o,i){if(!t.includes(o))return null;const a=Dze(o),s=_ze(a,i),d=e[o];return Mh(e,d,s)}function yfe(e,t){const o=fV(e.theme);return Object.keys(e).map(i=>zze(e,t,i,o)).reduce(y9,{})}function tn(e){return yfe(e,mV)}tn.propTypes={};tn.filterProps=mV;function on(e){return yfe(e,gV)}on.propTypes={};on.filterProps=gV;function wfe(e=8,t=fV({spacing:e})){if(e.mui)return e;const o=(...i)=>(i.length===0?[1]:i).map(a=>{const s=t(a);return typeof s=="number"?`${s}px`:s}).join(" ");return o.mui=!0,o}function xS(...e){const t=e.reduce((i,a)=>(a.filterProps.forEach(s=>{i[s]=a}),i),{}),o=i=>Object.keys(i).reduce((a,s)=>t[s]?y9(a,t[s](i)):a,{});return o.propTypes={},o.filterProps=e.reduce((i,a)=>i.concat(a.filterProps),[]),o}function _d(e){return typeof e!="number"?e:`${e}px solid`}function sc(e,t){return Mn({prop:e,themeKey:"borders",transform:t})}const Rze=sc("border",_d),Fze=sc("borderTop",_d),Oze=sc("borderRight",_d),Nze=sc("borderBottom",_d),Hze=sc("borderLeft",_d),Vze=sc("borderColor"),Uze=sc("borderTopColor"),Wze=sc("borderRightColor"),Qze=sc("borderBottomColor"),Gze=sc("borderLeftColor"),Yze=sc("outline",_d),Kze=sc("outlineColor"),yS=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Px(e.theme,"shape.borderRadius",4),o=i=>({borderRadius:Bx(t,i)});return Mh(e,e.borderRadius,o)}return null};yS.propTypes={};yS.filterProps=["borderRadius"];xS(Rze,Fze,Oze,Nze,Hze,Vze,Uze,Wze,Qze,Gze,yS,Yze,Kze);const wS=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Px(e.theme,"spacing",8),o=i=>({gap:Bx(t,i)});return Mh(e,e.gap,o)}return null};wS.propTypes={};wS.filterProps=["gap"];const bS=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Px(e.theme,"spacing",8),o=i=>({columnGap:Bx(t,i)});return Mh(e,e.columnGap,o)}return null};bS.propTypes={};bS.filterProps=["columnGap"];const vS=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Px(e.theme,"spacing",8),o=i=>({rowGap:Bx(t,i)});return Mh(e,e.rowGap,o)}return null};vS.propTypes={};vS.filterProps=["rowGap"];const qze=Mn({prop:"gridColumn"}),Zze=Mn({prop:"gridRow"}),Jze=Mn({prop:"gridAutoFlow"}),Xze=Mn({prop:"gridAutoColumns"}),eRe=Mn({prop:"gridAutoRows"}),tRe=Mn({prop:"gridTemplateColumns"}),oRe=Mn({prop:"gridTemplateRows"}),rRe=Mn({prop:"gridTemplateAreas"}),iRe=Mn({prop:"gridArea"});xS(wS,bS,vS,qze,Zze,Jze,Xze,eRe,tRe,oRe,rRe,iRe);function p5(e,t){return t==="grey"?t:e}const nRe=Mn({prop:"color",themeKey:"palette",transform:p5}),aRe=Mn({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:p5}),sRe=Mn({prop:"backgroundColor",themeKey:"palette",transform:p5});xS(nRe,aRe,sRe);function ql(e){return e<=1&&e!==0?`${e*100}%`:e}const lRe=Mn({prop:"width",transform:ql}),xV=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=o=>{const i=e.theme?.breakpoints?.values?.[o]||gS[o];return i?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:ql(o)}};return Mh(e,e.maxWidth,t)}return null};xV.filterProps=["maxWidth"];const dRe=Mn({prop:"minWidth",transform:ql}),cRe=Mn({prop:"height",transform:ql}),uRe=Mn({prop:"maxHeight",transform:ql}),pRe=Mn({prop:"minHeight",transform:ql});Mn({prop:"size",cssProperty:"width",transform:ql});Mn({prop:"size",cssProperty:"height",transform:ql});const hRe=Mn({prop:"boxSizing"});xS(lRe,xV,dRe,cRe,uRe,pRe,hRe);const CS={border:{themeKey:"borders",transform:_d},borderTop:{themeKey:"borders",transform:_d},borderRight:{themeKey:"borders",transform:_d},borderBottom:{themeKey:"borders",transform:_d},borderLeft:{themeKey:"borders",transform:_d},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:_d},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:yS},color:{themeKey:"palette",transform:p5},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:p5},backgroundColor:{themeKey:"palette",transform:p5},p:{style:on},pt:{style:on},pr:{style:on},pb:{style:on},pl:{style:on},px:{style:on},py:{style:on},padding:{style:on},paddingTop:{style:on},paddingRight:{style:on},paddingBottom:{style:on},paddingLeft:{style:on},paddingX:{style:on},paddingY:{style:on},paddingInline:{style:on},paddingInlineStart:{style:on},paddingInlineEnd:{style:on},paddingBlock:{style:on},paddingBlockStart:{style:on},paddingBlockEnd:{style:on},m:{style:tn},mt:{style:tn},mr:{style:tn},mb:{style:tn},ml:{style:tn},mx:{style:tn},my:{style:tn},margin:{style:tn},marginTop:{style:tn},marginRight:{style:tn},marginBottom:{style:tn},marginLeft:{style:tn},marginX:{style:tn},marginY:{style:tn},marginInline:{style:tn},marginInlineStart:{style:tn},marginInlineEnd:{style:tn},marginBlock:{style:tn},marginBlockStart:{style:tn},marginBlockEnd:{style:tn},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:wS},rowGap:{style:vS},columnGap:{style:bS},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:ql},maxWidth:{style:xV},minWidth:{transform:ql},height:{transform:ql},maxHeight:{transform:ql},minHeight:{transform:ql},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 mRe(...e){const t=e.reduce((i,a)=>i.concat(Object.keys(a)),[]),o=new Set(t);return e.every(i=>o.size===Object.keys(i).length)}function gRe(e,t){return typeof e=="function"?e(t):e}function fRe(){function e(o,i,a,s){const d={[o]:i,theme:a},c=s[o];if(!c)return{[o]:i};const{cssProperty:u=o,themeKey:p,transform:h,style:m}=c;if(i==null)return null;if(p==="typography"&&i==="inherit")return{[o]:i};const f=fS(a,p)||{};return m?m(d):Mh(d,i,x=>{let y=PC(f,h,x);return x===y&&typeof x=="string"&&(y=PC(f,h,`${o}${x==="default"?"":No(x)}`,x)),u===!1?y:{[u]:y}})}function t(o){const{sx:i,theme:a={},nested:s}=o||{};if(!i)return null;const d=a.unstable_sxConfig??CS;function c(u){let p=u;if(typeof u=="function")p=u(a);else if(typeof u!="object")return u;if(!p)return null;const h=Mze(a.breakpoints),m=Object.keys(h);let f=h;return Object.keys(p).forEach(x=>{const y=gRe(p[x],a);if(y!=null)if(typeof y=="object")if(d[x])f=y9(f,e(x,y,a,d));else{const w=Mh({theme:a},y,b=>({[x]:b}));mRe(w,y)?f[x]=t({sx:y,theme:a,nested:!0}):f=y9(f,w)}else f=y9(f,e(x,y,a,d))}),!s&&a.modularCssLayers?{"@layer sx":xK(a,wK(m,f))}:xK(a,wK(m,f))}return Array.isArray(i)?i.map(c):c(i)}return t}const h3=fRe();h3.filterProps=["sx"];function xRe(e,t){const o=this;if(o.vars){if(!o.colorSchemes?.[e]||typeof o.getColorSchemeSelector!="function")return{};let i=o.getColorSchemeSelector(e);return i==="&"?t:((i.includes("data-")||i.includes("."))&&(i=`*:where(${i.replace(/\s*&$/,"")}) &`),{[i]:t})}return o.palette.mode===e?t:{}}function yV(e={},...t){const{breakpoints:o={},palette:i={},spacing:a,shape:s={},...d}=e,c=Sze(o),u=wfe(a);let p=xs({breakpoints:c,direction:"ltr",components:{},palette:{mode:"light",...i},spacing:u,shape:{...jze,...s}},d);return p=Lze(p),p.applyStyles=xRe,p=t.reduce((h,m)=>xs(h,m),p),p.unstable_sxConfig={...CS,...d?.unstable_sxConfig},p.unstable_sx=function(h){return h3({sx:h,theme:this})},p}function yRe(e){return Object.keys(e).length===0}function wV(e=null){const t=g.useContext(tfe);return!t||yRe(t)?e:t}const wRe=yV();function bfe(e=wRe){return wV(e)}function vK(e){const t=n2(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function vfe({styles:e,themeId:t,defaultTheme:o={}}){const i=bfe(o),a=t&&i[t]||i;let s=typeof e=="function"?e(a):e;return a.modularCssLayers&&(Array.isArray(s)?s=s.map(d=>vK(typeof d=="function"?d(a):d)):s=vK(s)),l.jsx(gfe,{styles:s})}const CK=e=>e,bRe=()=>{let e=CK;return{configure(t){e=t},generate(t){return e(t)},reset(){e=CK}}},vRe=bRe();function Cfe(e){var t,o,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(o=Cfe(e[t]))&&(i&&(i+=" "),i+=o)}else for(o in e)e[o]&&(i&&(i+=" "),i+=o);return i}function Eo(){for(var e,t,o=0,i="",a=arguments.length;o<a;o++)(e=arguments[o])&&(t=Cfe(e))&&(i&&(i+=" "),i+=t);return i}const CRe={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 Ur(e,t,o="Mui"){const i=CRe[t];return i?`${o}-${i}`:`${vRe.generate(e)}-${t}`}function Mr(e,t,o="Mui"){const i={};return t.forEach(a=>{i[a]=Ur(e,a,o)}),i}function $fe(e){const{variants:t,...o}=e,i={variants:t,style:n2(o),isProcessed:!0};return i.style===o||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=n2(a.style))}),i}const $Re=yV();function Qj(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Ng(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function kRe(e){return e?(t,o)=>o[e]:null}function SRe(e,t,o){e.theme=LRe(e.theme)?o:e.theme[t]||e.theme}function Zv(e,t,o){const i=typeof t=="function"?t(e):t;if(Array.isArray(i))return i.flatMap(a=>Zv(e,a,o));if(Array.isArray(i?.variants)){let a;if(i.isProcessed)a=o?Ng(i.style,o):i.style;else{const{variants:s,...d}=i;a=o?Ng(n2(d),o):d}return kfe(e,i.variants,[a],o)}return i?.isProcessed?o?Ng(n2(i.style),o):i.style:o?Ng(n2(i),o):i}function kfe(e,t,o=[],i=void 0){let a;e:for(let s=0;s<t.length;s+=1){const d=t[s];if(typeof d.props=="function"){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!d.props(a))continue}else for(const c in d.props)if(e[c]!==d.props[c]&&e.ownerState?.[c]!==d.props[c])continue e;typeof d.style=="function"?(a??={...e,...e.ownerState,ownerState:e.ownerState},o.push(i?Ng(n2(d.style(a)),i):d.style(a))):o.push(i?Ng(n2(d.style),i):d.style)}return o}function ARe(e={}){const{themeId:t,defaultTheme:o=$Re,rootShouldForwardProp:i=Qj,slotShouldForwardProp:a=Qj}=e;function s(d){SRe(d,t,o)}return(d,c={})=>{vze(d,I=>I.filter(L=>L!==h3));const{name:u,slot:p,skipVariantsResolver:h,skipSx:m,overridesResolver:f=kRe(IRe(p)),...x}=c,y=u&&u.startsWith("Mui")||p?"components":"custom",w=h!==void 0?h:p&&p!=="Root"&&p!=="root"||!1,b=m||!1;let C=Qj;p==="Root"||p==="root"?C=i:p?C=a:jRe(d)&&(C=void 0);const $=bze(d,{shouldForwardProp:C,label:ERe(),...x}),A=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(L){return Zv(L,I,L.theme.modularCssLayers?y:void 0)};if(lh(I)){const L=$fe(I);return function(T){return L.variants?Zv(T,L,T.theme.modularCssLayers?y:void 0):T.theme.modularCssLayers?Ng(L.style,y):L.style}}return I},E=(...I)=>{const L=[],T=I.map(A),P=[];if(L.push(s),u&&f&&P.push(function(R){const z=R.theme.components?.[u]?.styleOverrides;if(!z)return null;const Y={};for(const Z in z)Y[Z]=Zv(R,z[Z],R.theme.modularCssLayers?"theme":void 0);return f(R,Y)}),u&&!w&&P.push(function(R){const z=R.theme?.components?.[u]?.variants;return z?kfe(R,z,[],R.theme.modularCssLayers?"theme":void 0):null}),b||P.push(h3),Array.isArray(T[0])){const R=T.shift(),z=new Array(L.length).fill(""),Y=new Array(P.length).fill("");let Z;Z=[...z,...R,...Y],Z.raw=[...z,...R.raw,...Y],L.unshift(Z)}const B=[...L,...T,...P],_=$(...B);return d.muiName&&(_.muiName=d.muiName),_};return $.withConfig&&(E.withConfig=$.withConfig),E}}function ERe(e,t){return void 0}function LRe(e){for(const t in e)return!1;return!0}function jRe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function IRe(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function vF(e,t,o=!1){const i={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const s=a;if(s==="components"||s==="slots")i[s]={...e[s],...i[s]};else if(s==="componentsProps"||s==="slotProps"){const d=e[s],c=t[s];if(!c)i[s]=d||{};else if(!d)i[s]=c;else{i[s]={...c};for(const u in d)if(Object.prototype.hasOwnProperty.call(d,u)){const p=u;i[s][p]=vF(d[p],c[p],o)}}}else s==="className"&&o&&t.className?i.className=Eo(e?.className,t?.className):s==="style"&&o&&t.style?i.style={...e?.style,...t?.style}:i[s]===void 0&&(i[s]=e[s])}return i}const ec=typeof window<"u"?g.useLayoutEffect:g.useEffect;function MRe(e,t=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,o))}function bV(e,t=0,o=1){return MRe(e,t,o)}function TRe(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let o=e.match(t);return o&&o[0].length===1&&(o=o.map(i=>i+i)),o?`rgb${o.length===4?"a":""}(${o.map((i,a)=>a<3?parseInt(i,16):Math.round(parseInt(i,16)/255*1e3)/1e3).join(", ")})`:""}function v2(e){if(e.type)return e;if(e.charAt(0)==="#")return v2(TRe(e));const t=e.indexOf("("),o=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(o))throw new Error(Ih(9,e));let i=e.substring(t+1,e.length-1),a;if(o==="color"){if(i=i.split(" "),a=i.shift(),i.length===4&&i[3].charAt(0)==="/"&&(i[3]=i[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(Ih(10,a))}else i=i.split(",");return i=i.map(s=>parseFloat(s)),{type:o,values:i,colorSpace:a}}const PRe=e=>{const t=v2(e);return t.values.slice(0,3).map((o,i)=>t.type.includes("hsl")&&i!==0?`${o}%`:o).join(" ")},V8=(e,t)=>{try{return PRe(e)}catch{return e}};function $S(e){const{type:t,colorSpace:o}=e;let{values:i}=e;return t.includes("rgb")?i=i.map((a,s)=>s<3?parseInt(a,10):a):t.includes("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),t.includes("color")?i=`${o} ${i.join(" ")}`:i=`${i.join(", ")}`,`${t}(${i})`}function Sfe(e){e=v2(e);const{values:t}=e,o=t[0],i=t[1]/100,a=t[2]/100,s=i*Math.min(a,1-a),d=(p,h=(p+o/30)%12)=>a-s*Math.max(Math.min(h-3,9-h,1),-1);let c="rgb";const u=[Math.round(d(0)*255),Math.round(d(8)*255),Math.round(d(4)*255)];return e.type==="hsla"&&(c+="a",u.push(t[3])),$S({type:c,values:u})}function CF(e){e=v2(e);let t=e.type==="hsl"||e.type==="hsla"?v2(Sfe(e)).values:e.values;return t=t.map(o=>(e.type!=="color"&&(o/=255),o<=.03928?o/12.92:((o+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function BRe(e,t){const o=CF(e),i=CF(t);return(Math.max(o,i)+.05)/(Math.min(o,i)+.05)}function BC(e,t){return e=v2(e),t=bV(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,$S(e)}function Vm(e,t,o){try{return BC(e,t)}catch{return e}}function kS(e,t){if(e=v2(e),t=bV(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let o=0;o<3;o+=1)e.values[o]*=1-t;return $S(e)}function oi(e,t,o){try{return kS(e,t)}catch{return e}}function SS(e,t){if(e=v2(e),t=bV(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let o=0;o<3;o+=1)e.values[o]+=(255-e.values[o])*t;else if(e.type.includes("color"))for(let o=0;o<3;o+=1)e.values[o]+=(1-e.values[o])*t;return $S(e)}function ri(e,t,o){try{return SS(e,t)}catch{return e}}function DRe(e,t=.15){return CF(e)>.5?kS(e,t):SS(e,t)}function iw(e,t,o){try{return DRe(e,t)}catch{return e}}const Afe=g.createContext(null);function vV(){return g.useContext(Afe)}const _Re=typeof Symbol=="function"&&Symbol.for,zRe=_Re?Symbol.for("mui.nested"):"__THEME_NESTED__";function RRe(e,t){return typeof t=="function"?t(e):{...e,...t}}function FRe(e){const{children:t,theme:o}=e,i=vV(),a=g.useMemo(()=>{const s=i===null?{...o}:RRe(i,o);return s!=null&&(s[zRe]=i!==null),s},[o,i]);return l.jsx(Afe.Provider,{value:a,children:t})}const Efe=g.createContext();function ORe({value:e,...t}){return l.jsx(Efe.Provider,{value:e??!0,...t})}const g7=()=>g.useContext(Efe)??!1,Lfe=g.createContext(void 0);function NRe({value:e,children:t}){return l.jsx(Lfe.Provider,{value:e,children:t})}function HRe(e){const{theme:t,name:o,props:i}=e;if(!t||!t.components||!t.components[o])return i;const a=t.components[o];return a.defaultProps?vF(a.defaultProps,i,t.components.mergeClassNameAndStyle):!a.styleOverrides&&!a.variants?vF(a,i,t.components.mergeClassNameAndStyle):i}function VRe({props:e,name:t}){const o=g.useContext(Lfe);return HRe({props:e,name:t,theme:{components:o}})}let $K=0;function URe(e){const[t,o]=g.useState(e),i=e||t;return g.useEffect(()=>{t==null&&($K+=1,o(`mui-${$K}`))},[t]),i}const WRe={...gBe},kK=WRe.useId;function AS(e){if(kK!==void 0){const t=kK();return e??t}return URe(e)}function QRe(e){const t=wV(),o=AS()||"",{modularCssLayers:i}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||t!==null?a="":typeof i=="string"?a=i.replace(/mui(?!\.)/g,a):a=`@layer ${a};`,ec(()=>{const s=document.querySelector("head");if(!s)return;const d=s.firstChild;if(a){if(d&&d.hasAttribute?.("data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===o)return;const c=document.createElement("style");c.setAttribute("data-mui-layer-order",o),c.textContent=a,s.prepend(c)}else s.querySelector(`style[data-mui-layer-order="${o}"]`)?.remove()},[a,o]),a?l.jsx(vfe,{styles:a}):null}const SK={};function AK(e,t,o,i=!1){return g.useMemo(()=>{const a=e&&t[e]||t;if(typeof o=="function"){const s=o(a),d=e?{...t,[e]:s}:s;return i?()=>d:d}return e?{...t,[e]:o}:{...t,...o}},[e,t,o,i])}function jfe(e){const{children:t,theme:o,themeId:i}=e,a=wV(SK),s=vV()||SK,d=AK(i,a,o),c=AK(i,s,o,!0),u=(i?d[i]:d).direction==="rtl",p=QRe(d);return l.jsx(FRe,{theme:c,children:l.jsx(tfe.Provider,{value:d,children:l.jsx(ORe,{value:u,children:l.jsxs(NRe,{value:i?d[i].components:d.components,children:[p,t]})})})})}const EK={theme:void 0};function GRe(e){let t,o;return function(i){let a=t;return(a===void 0||i.theme!==o)&&(EK.theme=i.theme,a=$fe(e(EK)),t=a,o=i.theme),a}}const CV="mode",$V="color-scheme",YRe="data-color-scheme";function KRe(e){const{defaultMode:t="system",defaultLightColorScheme:o="light",defaultDarkColorScheme:i="dark",modeStorageKey:a=CV,colorSchemeStorageKey:s=$V,attribute:d=YRe,colorSchemeNode:c="document.documentElement",nonce:u}=e||{};let p="",h=d;if(d==="class"&&(h=".%s"),d==="data"&&(h="[data-%s]"),h.startsWith(".")){const f=h.substring(1);p+=`${c}.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-C4jycCdP.js","assets/sentry-DsYES6l6.js","assets/empty-BCwlhSXs.js","assets/index-BRv9f-n4.js","assets/index-DvNFByHc.js","assets/zeni-epic-state-ByWZnDTr.js","assets/core-b2yP1yat.js","assets/utils-CmU840tj.js","assets/recharts-DqrV7HAk.js","assets/url-DRVfq9I7.js","assets/index-C6nGAUOI.js","assets/index-DFCafQMq.js","assets/url-BfdLx8mq.js","assets/index-Db_Wr1S4.js","assets/ScreenRoutes-C-MvTpAE.js","assets/liveblocks-Dqoe8aMJ.js","assets/analyticsHelper-D3qiW3E8.js","assets/mui-C_gN3Vx0.js","assets/analytics-BBZrbTm5.js","assets/lottie-BKGDuCSI.js","assets/lexical-B_8lIgQf.js","assets/SignInScreen-CQcxmIgQ.js"])))=>i.map(i=>d[i]);
2
+ import{a as g,b as k,R as gBe,c as p3,p as eh,r as Ml,g as ZH,e as NY,f as fBe,s as HY,w as xBe,i as yBe,S as wBe,j as bBe,k as vBe,l as CBe,m as $Be}from"./sentry-DsYES6l6.js";import{j as co,_ as j4e,a as ac,u as I4e,T as kBe,C as SBe,b as ABe,c as nS,d as aS,e as EBe,f as M4e,g as LBe,h as jBe,L as IBe,i as VY,k as MBe,l as TBe,P as PBe,m as BBe,n as DBe,o as T4e,p as _Be,q as zBe,I as UY,r as RBe,s as FBe,t as OBe,v as NBe,w as HBe,x as VBe,y as P4e,z as UBe,A as WBe,B as QBe}from"./liveblocks-Dqoe8aMJ.js";import{f as B4e,R as Fg,r as ca,P as Yi,u as sS,g as Wu,h as GBe,i as JH,j as YBe,k as KBe,l as Oj,N as qBe,m as ZBe,n as JBe,B as XBe}from"./core-b2yP1yat.js";import{H as EC,ba as Og,bb as eDe,bc as WY,bd as M3,be as Rr,bf as D4e,bg as lS,bh as vr,bi as tDe,bj as oDe,bk as B5,bl as w2,bm as XH,bn as _4e,bo as rDe,bp as z4e,bq as iDe,br as R4e,bs as nDe,bt as Ei,bu as D5,bv as Cu,bw as aDe,bx as sDe,by as lDe,bz as dDe,bA as QY,bB as cDe,bC as uDe,bD as pDe,bE as hDe,bF as eV,bG as F4e,bH as b2,bI as mDe,bJ as O4e,bK as pF,bL as GY,bM as YY,bN as KY,bO as Rs,bP as tV,bQ as oV,bR as h7,bS as rV,bT as iV,bU as nV,bV as aV,bW as gDe,bX as LC,bY as fDe,bZ as N4e,b_ as sV,b$ as xDe,c0 as wh,c1 as Lx,c2 as jx,c3 as yDe,c4 as wDe,c5 as bDe,c6 as vDe,c7 as CDe,c8 as $De,c9 as kDe,ca as SDe,cb as ADe,cc as EDe,cd as LDe,ce as jDe,cf as IDe,cg as MDe,ch as TDe,ci as PDe,cj as BDe,ck as DDe,cl as _De,cm as zDe,cn as RDe,co as H4e,cp as FDe,cq as qY,cr as ODe,cs as NDe,ct as HDe,cu as H9,cv as V4e,cw as U4e,cx as VDe,cy as W4e,cz as ZY,cA as Q4e,cB as G4e,cC as Y4e,cD as K4e,cE as q4e,cF as UDe,cG as Z4e,cH as WDe,cI as QDe,cJ as GDe,cK as J4e,cL as hF,cM as YDe,cN as X4e,cO as efe,cP as KDe,cQ as qDe,cR as ZDe,cS as JDe,cT as XDe,cU as e_e,cV as t_e,cW as o_e,v as r_e,cX as dS,cY as mF,cZ as gF,c_ as i_e,c$ as n_e,d0 as a_e,d1 as s_e,d2 as l_e,d3 as d_e,d4 as c_e,d5 as u_e,d6 as p_e,d7 as h_e,d8 as JY,d9 as m_e,da as g_e,db as f_e,dc as x_e,dd as y_e}from"./zeni-epic-state-ByWZnDTr.js";import{T as tfe,j as ko,n,c as ge,k as Ot,G as Ix,C as ofe,u as rfe,a as w_e}from"./mui-C_gN3Vx0.js";import{r as b_e,m as $u}from"./analytics-BBZrbTm5.js";import{L as fF}from"./lottie-BKGDuCSI.js";import{r as Un}from"./lexical-B_8lIgQf.js";import{E as wi,c as cS,P as v_e,R as xF,F as jC,X as nd,Y as ad,G as Oh,H as IC,I as uS,J as Nh,K as ife,L as C_e,M as $_e,N as T3,O as lV,Q as dV,S as Mx,U as k_e}from"./recharts-DqrV7HAk.js";import{r as S_e}from"./utils-CmU840tj.js";(function(){try{var e=typeof window<"u"?window:typeof p3<"u"?p3:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="adc8365c-68a1-405f-9337-19bda5edd6b9",e._sentryDebugIdIdentifier="sentry-dbid-adc8365c-68a1-405f-9337-19bda5edd6b9")}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"]'))i(a);new MutationObserver(a=>{for(const s of a)if(s.type==="childList")for(const d of s.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function o(a){const s={};return a.integrity&&(s.integrity=a.integrity),a.referrerPolicy&&(s.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?s.credentials="include":a.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(a){if(a.ep)return;a.ep=!0;const s=o(a);fetch(a.href,s)}})();var ow={},XY;function A_e(){if(XY)return ow;XY=1;var e=B4e();return ow.createRoot=e.createRoot,ow.hydrateRoot=e.hydrateRoot,ow}var E_e=A_e(),hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof p3<"u"?p3:typeof self<"u"?self:{};function fr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var eK={exports:{}},l6={},tK;function L_e(){if(tK)return l6;tK=1;var e=k,t=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function d(c,u,p){var h,m={},f=null,x=null;p!==void 0&&(f=""+p),u.key!==void 0&&(f=""+u.key),u.ref!==void 0&&(x=u.ref);for(h in u)i.call(u,h)&&!s.hasOwnProperty(h)&&(m[h]=u[h]);if(c&&c.defaultProps)for(h in u=c.defaultProps,u)m[h]===void 0&&(m[h]=u[h]);return{$$typeof:t,type:c,key:f,ref:x,props:m,_owner:a.current}}return l6.Fragment=o,l6.jsx=d,l6.jsxs=d,l6}var oK;function nfe(){return oK||(oK=1,eK.exports=L_e()),eK.exports}var l=nfe();const j_e=g.createContext(null),Nj={didCatch:!1,error:null};let I_e=class extends g.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=Nj}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){const{error:e}=this.state;if(e!==null){for(var t,o,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];(t=(o=this.props).onReset)===null||t===void 0||t.call(o,{args:a,reason:"imperative-api"}),this.setState(Nj)}}componentDidCatch(e,t){var o,i;(o=(i=this.props).onError)===null||o===void 0||o.call(i,e,t)}componentDidUpdate(e,t){const{didCatch:o}=this.state,{resetKeys:i}=this.props;if(o&&t.error!==null&&M_e(e.resetKeys,i)){var a,s;(a=(s=this.props).onReset)===null||a===void 0||a.call(s,{next:i,prev:e.resetKeys,reason:"keys"}),this.setState(Nj)}}render(){const{children:e,fallbackRender:t,FallbackComponent:o,fallback:i}=this.props,{didCatch:a,error:s}=this.state;let d=e;if(a){const c={error:s,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")d=t(c);else if(o)d=g.createElement(o,c);else if(i!==void 0)d=i;else throw s}return g.createElement(j_e.Provider,{value:{didCatch:a,error:s,resetErrorBoundary:this.resetErrorBoundary}},d)}};function M_e(){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((o,i)=>!Object.is(o,t[i]))}var yF={exports:{}},T_e=yF.exports,rK;function P_e(){return rK||(rK=1,function(e){(function(t,o){e.exports?e.exports=o():t.numeral=o()})(T_e,function(){var t,o,i="2.0.6",a={},s={},d={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},c={currentLocale:d.currentLocale,zeroFormat:d.zeroFormat,nullFormat:d.nullFormat,defaultFormat:d.defaultFormat,scalePercentBy100:d.scalePercentBy100};function u(p,h){this._input=p,this._value=h}return t=function(p){var h,m,f,x;if(t.isNumeral(p))h=p.value();else if(p===0||typeof p>"u")h=0;else if(p===null||o.isNaN(p))h=null;else if(typeof p=="string")if(c.zeroFormat&&p===c.zeroFormat)h=0;else if(c.nullFormat&&p===c.nullFormat||!p.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&&p.match(x)){f=a[m].unformat;break}f=f||t._.stringToNumber,h=f(p)}else h=Number(p)||null;return new u(p,h)},t.version=i,t.isNumeral=function(p){return p instanceof u},t._=o={numberToFormat:function(p,h,m){var f=s[t.options.currentLocale],x=!1,y=!1,w=0,b="",C=1e12,$=1e9,A=1e6,E=1e3,I="",L=!1,T,P,B,_,R,z,Y;if(p=p||0,P=Math.abs(p),t._.includes(h,"(")?(x=!0,h=h.replace(/[\(|\)]/g,"")):(t._.includes(h,"+")||t._.includes(h,"-"))&&(R=t._.includes(h,"+")?h.indexOf("+"):p<0?h.indexOf("-"):-1,h=h.replace(/[\+|\-]/g,"")),t._.includes(h,"a")&&(T=h.match(/a(k|m|b|t)?/),T=T?T[1]:!1,t._.includes(h," a")&&(b=" "),h=h.replace(new RegExp(b+"a[kmbt]?"),""),P>=C&&!T||T==="t"?(b+=f.abbreviations.trillion,p=p/C):P<C&&P>=$&&!T||T==="b"?(b+=f.abbreviations.billion,p=p/$):P<$&&P>=A&&!T||T==="m"?(b+=f.abbreviations.million,p=p/A):(P<A&&P>=E&&!T||T==="k")&&(b+=f.abbreviations.thousand,p=p/E)),t._.includes(h,"[.]")&&(y=!0,h=h.replace("[.]",".")),B=p.toString().split(".")[0],_=h.split(".")[1],z=h.indexOf(","),w=(h.split(".")[0].split(",")[0].match(/0/g)||[]).length,_?(t._.includes(_,"[")?(_=_.replace("]",""),_=_.split("["),I=t._.toFixed(p,_[0].length+_[1].length,m,_[1].length)):I=t._.toFixed(p,_.length,m),B=I.split(".")[0],t._.includes(I,".")?I=f.delimiters.decimal+I.split(".")[1]:I="",y&&Number(I.slice(1))===0&&(I="")):B=t._.toFixed(p,0,m),b&&!T&&Number(B)>=1e3&&b!==f.abbreviations.trillion)switch(B=String(Number(B)/1e3),b){case f.abbreviations.thousand:b=f.abbreviations.million;break;case f.abbreviations.million:b=f.abbreviations.billion;break;case f.abbreviations.billion:b=f.abbreviations.trillion;break}if(t._.includes(B,"-")&&(B=B.slice(1),L=!0),B.length<w)for(var Z=w-B.length;Z>0;Z--)B="0"+B;return z>-1&&(B=B.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),h.indexOf(".")===0&&(B=""),Y=B+I+(b||""),x?Y=(x&&L?"(":"")+Y+(x&&L?")":""):R>=0?Y=R===0?(L?"-":"+")+Y:Y+(L?"-":"+"):L&&(Y="-"+Y),Y},stringToNumber:function(p){var h=s[c.currentLocale],m=p,f={thousand:3,million:6,billion:9,trillion:12},x,y,w;if(c.zeroFormat&&p===c.zeroFormat)y=0;else if(c.nullFormat&&p===c.nullFormat||!p.replace(/[^0-9]+/g,"").length)y=null;else{y=1,h.delimiters.decimal!=="."&&(p=p.replace(/\./g,"").replace(h.delimiters.decimal,"."));for(x in f)if(w=new RegExp("[^a-zA-Z]"+h.abbreviations[x]+"(?:\\)|(\\"+h.currency.symbol+")?(?:\\))?)?$"),m.match(w)){y*=Math.pow(10,f[x]);break}y*=(p.split("-").length+Math.min(p.split("(").length-1,p.split(")").length-1))%2?1:-1,p=p.replace(/[^0-9\.]+/g,""),y*=Number(p)}return y},isNaN:function(p){return typeof p=="number"&&isNaN(p)},includes:function(p,h){return p.indexOf(h)!==-1},insert:function(p,h,m){return p.slice(0,m)+h+p.slice(m)},reduce:function(p,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(p),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(p){var h=p.toString().split(".");return h.length<2?1:Math.pow(10,h[1].length)},correctionFactor:function(){var p=Array.prototype.slice.call(arguments);return p.reduce(function(h,m){var f=o.multiplier(m);return h>f?h:f},1)},toFixed:function(p,h,m,f){var x=p.toString().split("."),y=h-(f||0),w,b,C,$;return x.length===2?w=Math.min(Math.max(x[1].length,y),h):w=y,C=Math.pow(10,w),$=(m(p+"e+"+w)/C).toFixed(w),f>h-w&&(b=new RegExp("\\.?0{1,"+(f-(h-w))+"}$"),$=$.replace(b,"")),$}},t.options=c,t.formats=a,t.locales=s,t.locale=function(p){return p&&(c.currentLocale=p.toLowerCase()),c.currentLocale},t.localeData=function(p){if(!p)return s[c.currentLocale];if(p=p.toLowerCase(),!s[p])throw new Error("Unknown locale : "+p);return s[p]},t.reset=function(){for(var p in d)c[p]=d[p]},t.zeroFormat=function(p){c.zeroFormat=typeof p=="string"?p:null},t.nullFormat=function(p){c.nullFormat=typeof p=="string"?p:null},t.defaultFormat=function(p){c.defaultFormat=typeof p=="string"?p:"0.0"},t.register=function(p,h,m){if(h=h.toLowerCase(),this[p+"s"][h])throw new TypeError(h+" "+p+" already registered.");return this[p+"s"][h]=m,m},t.validate=function(p,h){var m,f,x,y,w,b,C,$;if(typeof p!="string"&&(p+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",p)),p=p.trim(),p.match(/^\d+$/))return!0;if(p==="")return!1;try{C=t.localeData(h)}catch{C=t.localeData(t.locale())}return x=C.currency.symbol,w=C.abbreviations,m=C.delimiters.decimal,C.delimiters.thousands==="."?f="\\.":f=C.delimiters.thousands,$=p.match(/^[^\d]+/),$!==null&&(p=p.substr(1),$[0]!==x)||($=p.match(/[^\d]+$/),$!==null&&(p=p.slice(0,-1),$[0]!==w.thousand&&$[0]!==w.million&&$[0]!==w.billion&&$[0]!==w.trillion))?!1:(b=new RegExp(f+"{2}"),p.match(/[^\d.,]/g)?!1:(y=p.split(m),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(b):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(b)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(b)&&!!y[1].match(/^\d+$/)))},t.fn=u.prototype={clone:function(){return t(this)},format:function(p,h){var m=this._value,f=p||c.defaultFormat,x,y,w;if(h=h||Math.round,m===0&&c.zeroFormat!==null)y=c.zeroFormat;else if(m===null&&c.nullFormat!==null)y=c.nullFormat;else{for(x in a)if(f.match(a[x].regexps.format)){w=a[x].format;break}w=w||t._.numberToFormat,y=w(m,f,h)}return y},value:function(){return this._value},input:function(){return this._input},set:function(p){return this._value=Number(p),this},add:function(p){var h=o.correctionFactor.call(null,this._value,p);function m(f,x,y,w){return f+Math.round(h*x)}return this._value=o.reduce([this._value,p],m,0)/h,this},subtract:function(p){var h=o.correctionFactor.call(null,this._value,p);function m(f,x,y,w){return f-Math.round(h*x)}return this._value=o.reduce([p],m,Math.round(this._value*h))/h,this},multiply:function(p){function h(m,f,x,y){var w=o.correctionFactor(m,f);return Math.round(m*w)*Math.round(f*w)/Math.round(w*w)}return this._value=o.reduce([this._value,p],h,1),this},divide:function(p){function h(m,f,x,y){var w=o.correctionFactor(m,f);return Math.round(m*w)/Math.round(f*w)}return this._value=o.reduce([this._value,p],h),this},difference:function(p){return Math.abs(t(this._value).subtract(p).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(p){var h=p%10;return~~(p%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(p,h,m){var f=t._.includes(h," BPS")?" ":"",x;return p=p*1e4,h=h.replace(/\s?BPS/,""),x=t._.numberToFormat(p,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"BPS"),x=x.join("")):x=x+f+"BPS",x},unformat:function(p){return+(t._.stringToNumber(p)*1e-4).toFixed(15)}})}(),function(){var p={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=p.suffixes.concat(h.suffixes.filter(function(x){return p.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,w){var b,C=t._.includes(y,"ib")?h:p,$=t._.includes(y," b")||t._.includes(y," ib")?" ":"",A,E,I;for(y=y.replace(/\s?i?b/,""),A=0;A<=C.suffixes.length;A++)if(E=Math.pow(C.base,A),I=Math.pow(C.base,A+1),x===null||x===0||x>=E&&x<I){$+=C.suffixes[A],E>0&&(x=x/E);break}return b=t._.numberToFormat(x,y,w),b+$},unformat:function(x){var y=t._.stringToNumber(x),w,b;if(y){for(w=p.suffixes.length-1;w>=0;w--){if(t._.includes(x,p.suffixes[w])){b=Math.pow(p.base,w);break}if(t._.includes(x,h.suffixes[w])){b=Math.pow(h.base,w);break}}y*=b||1}return y}})}(),function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(p,h,m){var f=t.locales[t.options.currentLocale],x={before:h.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:h.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,w,b;for(h=h.replace(/\s?\$\s?/,""),y=t._.numberToFormat(p,h,m),p>=0?(x.before=x.before.replace(/[\-\(]/,""),x.after=x.after.replace(/[\-\)]/,"")):p<0&&!t._.includes(x.before,"-")&&!t._.includes(x.before,"(")&&(x.before="-"+x.before),b=0;b<x.before.length;b++)switch(w=x.before[b],w){case"$":y=t._.insert(y,f.currency.symbol,b);break;case" ":y=t._.insert(y," ",b+f.currency.symbol.length-1);break}for(b=x.after.length-1;b>=0;b--)switch(w=x.after[b],w){case"$":y=b===x.after.length-1?y+f.currency.symbol:t._.insert(y,f.currency.symbol,-(x.after.length-(1+b)));break;case" ":y=b===x.after.length-1?y+" ":t._.insert(y," ",-(x.after.length-(1+b)+f.currency.symbol.length-1));break}return y}})}(),function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(p,h,m){var f,x=typeof p=="number"&&!t._.isNaN(p)?p.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(p){var h=t._.includes(p,"e+")?p.split("e+"):p.split("e-"),m=Number(h[0]),f=Number(h[1]);f=t._.includes(p,"e-")?f*=-1:f;function x(y,w,b,C){var $=t._.correctionFactor(y,w),A=y*$*(w*$)/($*$);return A}return t._.reduce([m,Math.pow(10,f)],x,1)}})}(),function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(p,h,m){var f=t.locales[t.options.currentLocale],x,y=t._.includes(h," o")?" ":"";return h=h.replace(/\s?o/,""),y+=f.ordinal(p),x=t._.numberToFormat(p,h,m),x+y}})}(),function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(p,h,m){var f=t._.includes(h," %")?" ":"",x;return t.options.scalePercentBy100&&(p=p*100),h=h.replace(/\s?\%/,""),x=t._.numberToFormat(p,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"%"),x=x.join("")):x=x+f+"%",x},unformat:function(p){var h=t._.stringToNumber(p);return t.options.scalePercentBy100?h*.01:h}})}(),function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(p,h,m){var f=Math.floor(p/60/60),x=Math.floor((p-f*60*60)/60),y=Math.round(p-f*60*60-x*60);return f+":"+(x<10?"0"+x:x)+":"+(y<10?"0"+y:y)},unformat:function(p){var h=p.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})}(yF)),yF.exports}var B_e=P_e();const $h=fr(B_e);function Ih(e,...t){const o=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(i=>o.searchParams.append("args[]",i)),`Minified MUI error #${e}; visit ${o} for the full message.`}const kh="$$material";function D_e(e){for(var t=0,o,i=0,a=e.length;a>=4;++i,a-=4)o=e.charCodeAt(i)&255|(e.charCodeAt(++i)&255)<<8|(e.charCodeAt(++i)&255)<<16|(e.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+((o>>>16)*59797<<16),o^=o>>>24,t=(o&65535)*1540483477+((o>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(i+2)&255)<<16;case 2:t^=(e.charCodeAt(i+1)&255)<<8;case 1:t^=e.charCodeAt(i)&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 __e={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 z_e(e){var t=Object.create(null);return function(o){return t[o]===void 0&&(t[o]=e(o)),t[o]}}var R_e=/[A-Z]|^ms/g,F_e=/_EMO_([^_]+?)_([^]*?)_EMO_/g,afe=function(e){return e.charCodeAt(1)===45},iK=function(e){return e!=null&&typeof e!="boolean"},Hj=z_e(function(e){return afe(e)?e:e.replace(R_e,"-$&").toLowerCase()}),nK=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(F_e,function(o,i,a){return G0={name:i,styles:a,next:G0},i})}return __e[e]!==1&&!afe(e)&&typeof t=="number"&&t!==0?t+"px":t};function MC(e,t,o){if(o==null)return"";var i=o;if(i.__emotion_styles!==void 0)return i;switch(typeof o){case"boolean":return"";case"object":{var a=o;if(a.anim===1)return G0={name:a.name,styles:a.styles,next:G0},a.name;var s=o;if(s.styles!==void 0){var d=s.next;if(d!==void 0)for(;d!==void 0;)G0={name:d.name,styles:d.styles,next:G0},d=d.next;var c=s.styles+";";return c}return O_e(e,t,o)}}var u=o;return u}function O_e(e,t,o){var i="";if(Array.isArray(o))for(var a=0;a<o.length;a++)i+=MC(e,t,o[a])+";";else for(var s in o){var d=o[s];if(typeof d!="object"){var c=d;iK(c)&&(i+=Hj(s)+":"+nK(s,c)+";")}else if(Array.isArray(d)&&typeof d[0]=="string"&&t==null)for(var u=0;u<d.length;u++)iK(d[u])&&(i+=Hj(s)+":"+nK(s,d[u])+";");else{var p=MC(e,t,d);switch(s){case"animation":case"animationName":{i+=Hj(s)+":"+p+";";break}default:i+=s+"{"+p+"}"}}}return i}var aK=/label:\s*([^\s;{]+)\s*(;|$)/g,G0;function N_e(e,t,o){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var i=!0,a="";G0=void 0;var s=e[0];if(s==null||s.raw===void 0)i=!1,a+=MC(o,t,s);else{var d=s;a+=d[0]}for(var c=1;c<e.length;c++)if(a+=MC(o,t,e[c]),i){var u=s;a+=u[c]}aK.lastIndex=0;for(var p="",h;(h=aK.exec(a))!==null;)p+="-"+h[1];var m=D_e(a)+p;return{name:m,styles:a,next:G0}}var Vj={exports:{}},Uj,sK;function H_e(){if(sK)return Uj;sK=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Uj=e,Uj}var Wj,lK;function V_e(){if(lK)return Wj;lK=1;var e=H_e();function t(){}function o(){}return o.resetWarningCache=t,Wj=function(){function i(d,c,u,p,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}}i.isRequired=i;function a(){return i}var s={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:o,resetWarningCache:t};return s.PropTypes=s,s},Wj}var dK;function cV(){return dK||(dK=1,Vj.exports=V_e()()),Vj.exports}var U_e=cV();const Tt=fr(U_e);function W_e(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 Q_e(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 G_e=function(){function e(o){var i=this;this._insertTag=function(a){var s;i.tags.length===0?i.insertionPoint?s=i.insertionPoint.nextSibling:i.prepend?s=i.container.firstChild:s=i.before:s=i.tags[i.tags.length-1].nextSibling,i.container.insertBefore(a,s),i.tags.push(a)},this.isSpeedy=o.speedy===void 0?!0:o.speedy,this.tags=[],this.ctr=0,this.nonce=o.nonce,this.key=o.key,this.container=o.container,this.prepend=o.prepend,this.insertionPoint=o.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(o){o.forEach(this._insertTag)},t.insert=function(o){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Q_e(this));var i=this.tags[this.tags.length-1];if(this.isSpeedy){var a=W_e(i);try{a.insertRule(o,a.cssRules.length)}catch{}}else i.appendChild(document.createTextNode(o));this.ctr++},t.flush=function(){this.tags.forEach(function(o){var i;return(i=o.parentNode)==null?void 0:i.removeChild(o)}),this.tags=[],this.ctr=0},e}(),as="-ms-",TC="-moz-",Qr="-webkit-",sfe="comm",uV="rule",pV="decl",Y_e="@import",lfe="@keyframes",K_e="@layer",q_e=Math.abs,pS=String.fromCharCode,Z_e=Object.assign;function J_e(e,t){return Ua(e,0)^45?(((t<<2^Ua(e,0))<<2^Ua(e,1))<<2^Ua(e,2))<<2^Ua(e,3):0}function dfe(e){return e.trim()}function X_e(e,t){return(e=t.exec(e))?e[0]:e}function Gr(e,t,o){return e.replace(t,o)}function wF(e,t){return e.indexOf(t)}function Ua(e,t){return e.charCodeAt(t)|0}function V9(e,t,o){return e.slice(t,o)}function ku(e){return e.length}function hV(e){return e.length}function rw(e,t){return t.push(e),e}function eze(e,t){return e.map(t).join("")}var hS=1,_5=1,cfe=0,Sl=0,On=0,m7="";function mS(e,t,o,i,a,s,d){return{value:e,root:t,parent:o,type:i,props:a,children:s,line:hS,column:_5,length:d,return:""}}function d6(e,t){return Z_e(mS("",null,null,"",null,null,0),e,{length:-e.length},t)}function tze(){return On}function oze(){return On=Sl>0?Ua(m7,--Sl):0,_5--,On===10&&(_5=1,hS--),On}function od(){return On=Sl<cfe?Ua(m7,Sl++):0,_5++,On===10&&(_5=1,hS++),On}function Xu(){return Ua(m7,Sl)}function Yv(){return Sl}function Tx(e,t){return V9(m7,e,t)}function U9(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 ufe(e){return hS=_5=1,cfe=ku(m7=e),Sl=0,[]}function pfe(e){return m7="",e}function Kv(e){return dfe(Tx(Sl-1,bF(e===91?e+2:e===40?e+1:e)))}function rze(e){for(;(On=Xu())&&On<33;)od();return U9(e)>2||U9(On)>3?"":" "}function ize(e,t){for(;--t&&od()&&!(On<48||On>102||On>57&&On<65||On>70&&On<97););return Tx(e,Yv()+(t<6&&Xu()==32&&od()==32))}function bF(e){for(;od();)switch(On){case e:return Sl;case 34:case 39:e!==34&&e!==39&&bF(On);break;case 40:e===41&&bF(e);break;case 92:od();break}return Sl}function nze(e,t){for(;od()&&e+On!==57&&!(e+On===84&&Xu()===47););return"/*"+Tx(t,Sl-1)+"*"+pS(e===47?e:od())}function aze(e){for(;!U9(Xu());)od();return Tx(e,Sl)}function sze(e){return pfe(qv("",null,null,null,[""],e=ufe(e),0,[0],e))}function qv(e,t,o,i,a,s,d,c,u){for(var p=0,h=0,m=d,f=0,x=0,y=0,w=1,b=1,C=1,$=0,A="",E=a,I=s,L=i,T=A;b;)switch(y=$,$=od()){case 40:if(y!=108&&Ua(T,m-1)==58){wF(T+=Gr(Kv($),"&","&\f"),"&\f")!=-1&&(C=-1);break}case 34:case 39:case 91:T+=Kv($);break;case 9:case 10:case 13:case 32:T+=rze(y);break;case 92:T+=ize(Yv()-1,7);continue;case 47:switch(Xu()){case 42:case 47:rw(lze(nze(od(),Yv()),t,o),u);break;default:T+="/"}break;case 123*w:c[p++]=ku(T)*C;case 125*w:case 59:case 0:switch($){case 0:case 125:b=0;case 59+h:C==-1&&(T=Gr(T,/\f/g,"")),x>0&&ku(T)-m&&rw(x>32?uK(T+";",i,o,m-1):uK(Gr(T," ","")+";",i,o,m-2),u);break;case 59:T+=";";default:if(rw(L=cK(T,t,o,p,h,a,c,A,E=[],I=[],m),s),$===123)if(h===0)qv(T,t,L,L,E,s,m,c,I);else switch(f===99&&Ua(T,3)===110?100:f){case 100:case 108:case 109:case 115:qv(e,L,L,i&&rw(cK(e,L,L,0,0,a,c,A,a,E=[],m),I),a,I,m,c,i?E:I);break;default:qv(T,L,L,L,[""],I,0,c,I)}}p=h=x=0,w=C=1,A=T="",m=d;break;case 58:m=1+ku(T),x=y;default:if(w<1){if($==123)--w;else if($==125&&w++==0&&oze()==125)continue}switch(T+=pS($),$*w){case 38:C=h>0?1:(T+="\f",-1);break;case 44:c[p++]=(ku(T)-1)*C,C=1;break;case 64:Xu()===45&&(T+=Kv(od())),f=Xu(),h=m=ku(A=T+=aze(Yv())),$++;break;case 45:y===45&&ku(T)==2&&(w=0)}}return s}function cK(e,t,o,i,a,s,d,c,u,p,h){for(var m=a-1,f=a===0?s:[""],x=hV(f),y=0,w=0,b=0;y<i;++y)for(var C=0,$=V9(e,m+1,m=q_e(w=d[y])),A=e;C<x;++C)(A=dfe(w>0?f[C]+" "+$:Gr($,/&\f/g,f[C])))&&(u[b++]=A);return mS(e,t,o,a===0?uV:c,u,p,h)}function lze(e,t,o){return mS(e,t,o,sfe,pS(tze()),V9(e,2,-2),0)}function uK(e,t,o,i){return mS(e,t,o,pV,V9(e,0,i),V9(e,i+1,-1),i)}function u5(e,t){for(var o="",i=hV(e),a=0;a<i;a++)o+=t(e[a],a,e,t)||"";return o}function dze(e,t,o,i){switch(e.type){case K_e:if(e.children.length)break;case Y_e:case pV:return e.return=e.return||e.value;case sfe:return"";case lfe:return e.return=e.value+"{"+u5(e.children,i)+"}";case uV:e.value=e.props.join(",")}return ku(o=u5(e.children,i))?e.return=e.value+"{"+o+"}":""}function cze(e){var t=hV(e);return function(o,i,a,s){for(var d="",c=0;c<t;c++)d+=e[c](o,i,a,s)||"";return d}}function uze(e){return function(t){t.root||(t=t.return)&&e(t)}}var pze=function(e,t,o){for(var i=0,a=0;i=a,a=Xu(),i===38&&a===12&&(t[o]=1),!U9(a);)od();return Tx(e,Sl)},hze=function(e,t){var o=-1,i=44;do switch(U9(i)){case 0:i===38&&Xu()===12&&(t[o]=1),e[o]+=pze(Sl-1,t,o);break;case 2:e[o]+=Kv(i);break;case 4:if(i===44){e[++o]=Xu()===58?"&\f":"",t[o]=e[o].length;break}default:e[o]+=pS(i)}while(i=od());return e},mze=function(e,t){return pfe(hze(ufe(e),t))},pK=new WeakMap,gze=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,o=e.parent,i=e.column===o.column&&e.line===o.line;o.type!=="rule";)if(o=o.parent,!o)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!pK.get(o))&&!i){pK.set(e,!0);for(var a=[],s=mze(t,a),d=o.props,c=0,u=0;c<s.length;c++)for(var p=0;p<d.length;p++,u++)e.props[u]=a[c]?s[c].replace(/&\f/g,d[p]):d[p]+" "+s[c]}}},fze=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function hfe(e,t){switch(J_e(e,t)){case 5103:return Qr+"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 Qr+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Qr+e+TC+e+as+e+e;case 6828:case 4268:return Qr+e+as+e+e;case 6165:return Qr+e+as+"flex-"+e+e;case 5187:return Qr+e+Gr(e,/(\w+).+(:[^]+)/,Qr+"box-$1$2"+as+"flex-$1$2")+e;case 5443:return Qr+e+as+"flex-item-"+Gr(e,/flex-|-self/,"")+e;case 4675:return Qr+e+as+"flex-line-pack"+Gr(e,/align-content|flex-|-self/,"")+e;case 5548:return Qr+e+as+Gr(e,"shrink","negative")+e;case 5292:return Qr+e+as+Gr(e,"basis","preferred-size")+e;case 6060:return Qr+"box-"+Gr(e,"-grow","")+Qr+e+as+Gr(e,"grow","positive")+e;case 4554:return Qr+Gr(e,/([^-])(transform)/g,"$1"+Qr+"$2")+e;case 6187:return Gr(Gr(Gr(e,/(zoom-|grab)/,Qr+"$1"),/(image-set)/,Qr+"$1"),e,"")+e;case 5495:case 3959:return Gr(e,/(image-set\([^]*)/,Qr+"$1$`$1");case 4968:return Gr(Gr(e,/(.+:)(flex-)?(.*)/,Qr+"box-pack:$3"+as+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Qr+e+e;case 4095:case 3583:case 4068:case 2532:return Gr(e,/(.+)-inline(.+)/,Qr+"$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(ku(e)-1-t>6)switch(Ua(e,t+1)){case 109:if(Ua(e,t+4)!==45)break;case 102:return Gr(e,/(.+:)(.+)-([^]+)/,"$1"+Qr+"$2-$3$1"+TC+(Ua(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~wF(e,"stretch")?hfe(Gr(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ua(e,t+1)!==115)break;case 6444:switch(Ua(e,ku(e)-3-(~wF(e,"!important")&&10))){case 107:return Gr(e,":",":"+Qr)+e;case 101:return Gr(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Qr+(Ua(e,14)===45?"inline-":"")+"box$3$1"+Qr+"$2$3$1"+as+"$2box$3")+e}break;case 5936:switch(Ua(e,t+11)){case 114:return Qr+e+as+Gr(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Qr+e+as+Gr(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Qr+e+as+Gr(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Qr+e+as+e+e}return e}var xze=function(e,t,o,i){if(e.length>-1&&!e.return)switch(e.type){case pV:e.return=hfe(e.value,e.length);break;case lfe:return u5([d6(e,{value:Gr(e.value,"@","@"+Qr)})],i);case uV:if(e.length)return eze(e.props,function(a){switch(X_e(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return u5([d6(e,{props:[Gr(a,/:(read-\w+)/,":"+TC+"$1")]})],i);case"::placeholder":return u5([d6(e,{props:[Gr(a,/:(plac\w+)/,":"+Qr+"input-$1")]}),d6(e,{props:[Gr(a,/:(plac\w+)/,":"+TC+"$1")]}),d6(e,{props:[Gr(a,/:(plac\w+)/,as+"input-$1")]})],i)}return""})}},yze=[xze],mfe=function(e){var t=e.key;if(t==="css"){var o=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(o,function(y){var w=y.getAttribute("data-emotion");w.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var i=e.stylisPlugins||yze,a={},s,d=[];s=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(y){for(var w=y.getAttribute("data-emotion").split(" "),b=1;b<w.length;b++)a[w[b]]=!0;d.push(y)});var c,u=[gze,fze];{var p,h=[dze,uze(function(y){p.insert(y)})],m=cze(u.concat(i,h)),f=function(y){return u5(sze(y),m)};c=function(y,w,b,C){p=b,f(y?y+"{"+w.styles+"}":w.styles),C&&(x.inserted[w.name]=!0)}}var x={key:t,sheet:new G_e({key:t,container:s,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:c};return x.sheet.hydrate(d),x};function wze(e){return e==null||Object.keys(e).length===0}function gfe(e){const{styles:t,defaultTheme:o={}}=e,i=typeof t=="function"?a=>t(wze(a)?o:a):t;return l.jsx(Ix,{styles:i})}function bze(e,t){return n(e,t)}function vze(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const hK=[];function n2(e){return hK[0]=e,N_e(hK)}var mK={exports:{}},hi={},gK;function Cze(){if(gK)return hi;gK=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),d=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),p=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(w){if(typeof w=="object"&&w!==null){var b=w.$$typeof;switch(b){case e:switch(w=w.type,w){case o:case a:case i:case u:case p:case f:return w;default:switch(w=w&&w.$$typeof,w){case d:case c:case m:case h:return w;case s:return w;default:return b}}case t:return b}}}return hi.ContextConsumer=s,hi.ContextProvider=d,hi.Element=e,hi.ForwardRef=c,hi.Fragment=o,hi.Lazy=m,hi.Memo=h,hi.Portal=t,hi.Profiler=a,hi.StrictMode=i,hi.Suspense=u,hi.SuspenseList=p,hi.isContextConsumer=function(w){return y(w)===s},hi.isContextProvider=function(w){return y(w)===d},hi.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},hi.isForwardRef=function(w){return y(w)===c},hi.isFragment=function(w){return y(w)===o},hi.isLazy=function(w){return y(w)===m},hi.isMemo=function(w){return y(w)===h},hi.isPortal=function(w){return y(w)===t},hi.isProfiler=function(w){return y(w)===a},hi.isStrictMode=function(w){return y(w)===i},hi.isSuspense=function(w){return y(w)===u},hi.isSuspenseList=function(w){return y(w)===p},hi.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===o||w===a||w===i||w===u||w===p||typeof w=="object"&&w!==null&&(w.$$typeof===m||w.$$typeof===h||w.$$typeof===d||w.$$typeof===s||w.$$typeof===c||w.$$typeof===x||w.getModuleId!==void 0)},hi.typeOf=y,hi}var fK;function $ze(){return fK||(fK=1,mK.exports=Cze()),mK.exports}var ffe=$ze();function lh(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 xfe(e){if(g.isValidElement(e)||ffe.isValidElementType(e)||!lh(e))return e;const t={};return Object.keys(e).forEach(o=>{t[o]=xfe(e[o])}),t}function xs(e,t,o={clone:!0}){const i=o.clone?{...e}:e;return lh(e)&&lh(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||ffe.isValidElementType(t[a])?i[a]=t[a]:lh(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&lh(e[a])?i[a]=xs(e[a],t[a],o):o.clone?i[a]=lh(t[a])?xfe(t[a]):t[a]:i[a]=t[a]}),i}const kze=e=>{const t=Object.keys(e).map(o=>({key:o,val:e[o]}))||[];return t.sort((o,i)=>o.val-i.val),t.reduce((o,i)=>({...o,[i.key]:i.val}),{})};function Sze(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:o="px",step:i=5,...a}=e,s=kze(t),d=Object.keys(s);function c(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${o})`}function u(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-i/100}${o})`}function p(f,x){const y=d.indexOf(x);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${o}) and (max-width:${(y!==-1&&typeof t[d[y]]=="number"?t[d[y]]:x)-i/100}${o})`}function h(f){return d.indexOf(f)+1<d.length?p(f,d[d.indexOf(f)+1]):c(f)}function m(f){const x=d.indexOf(f);return x===0?c(d[1]):x===d.length-1?u(d[x]):p(f,d[d.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:d,values:s,up:c,down:u,between:p,only:h,not:m,unit:o,...a}}function xK(e,t){if(!e.containerQueries)return t;const o=Object.keys(t).filter(i=>i.startsWith("@container")).sort((i,a)=>{const s=/min-width:\s*([0-9.]+)/;return+(i.match(s)?.[1]||0)-+(a.match(s)?.[1]||0)});return o.length?o.reduce((i,a)=>{const s=t[a];return delete i[a],i[a]=s,i},{...t}):t}function Aze(e,t){return t==="@"||t.startsWith("@")&&(e.some(o=>t.startsWith(`@${o}`))||!!t.match(/^@\d/))}function Eze(e,t){const o=t.match(/^@([^/]+)?\/?(.+)?$/);if(!o)return null;const[,i,a]=o,s=Number.isNaN(+i)?i||0:+i;return e.containerQueries(a).up(s)}function Lze(e){const t=(s,d)=>s.replace("@media",d?`@container ${d}`:"@container");function o(s,d){s.up=(...c)=>t(e.breakpoints.up(...c),d),s.down=(...c)=>t(e.breakpoints.down(...c),d),s.between=(...c)=>t(e.breakpoints.between(...c),d),s.only=(...c)=>t(e.breakpoints.only(...c),d),s.not=(...c)=>{const u=t(e.breakpoints.not(...c),d);return u.includes("not all and")?u.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):u}}const i={},a=s=>(o(i,s),i);return o(a),{...e,containerQueries:a}}const jze={borderRadius:4};function y9(e,t){return t?xs(e,t,{clone:!1}):e}const gS={xs:0,sm:600,md:900,lg:1200,xl:1536},yK={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${gS[e]}px)`},Ize={containerQueries:e=>({up:t=>{let o=typeof t=="number"?t:gS[t]||t;return typeof o=="number"&&(o=`${o}px`),e?`@container ${e} (min-width:${o})`:`@container (min-width:${o})`}})};function Mh(e,t,o){const i=e.theme||{};if(Array.isArray(t)){const a=i.breakpoints||yK;return t.reduce((s,d,c)=>(s[a.up(a.keys[c])]=o(t[c]),s),{})}if(typeof t=="object"){const a=i.breakpoints||yK;return Object.keys(t).reduce((s,d)=>{if(Aze(a.keys,d)){const c=Eze(i.containerQueries?i:Ize,d);c&&(s[c]=o(t[d],d))}else if(Object.keys(a.values||gS).includes(d)){const c=a.up(d);s[c]=o(t[d],d)}else{const c=d;s[c]=t[c]}return s},{})}return o(t)}function Mze(e={}){return e.keys?.reduce((t,o)=>{const i=e.up(o);return t[i]={},t},{})||{}}function wK(e,t){return e.reduce((o,i)=>{const a=o[i];return(!a||Object.keys(a).length===0)&&delete o[i],o},t)}function No(e){if(typeof e!="string")throw new Error(Ih(7));return e.charAt(0).toUpperCase()+e.slice(1)}function fS(e,t,o=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&o){const i=`vars.${t}`.split(".").reduce((a,s)=>a&&a[s]?a[s]:null,e);if(i!=null)return i}return t.split(".").reduce((i,a)=>i&&i[a]!=null?i[a]:null,e)}function PC(e,t,o,i=o){let a;return typeof e=="function"?a=e(o):Array.isArray(e)?a=e[o]||i:a=fS(e,o)||i,t&&(a=t(a,i,e)),a}function Mn(e){const{prop:t,cssProperty:o=e.prop,themeKey:i,transform:a}=e,s=d=>{if(d[t]==null)return null;const c=d[t],u=d.theme,p=fS(u,i)||{};return Mh(d,c,h=>{let m=PC(p,a,h);return h===m&&typeof h=="string"&&(m=PC(p,a,`${t}${h==="default"?"":No(h)}`,h)),o===!1?m:{[o]:m}})};return s.propTypes={},s.filterProps=[t],s}function Tze(e){const t={};return o=>(t[o]===void 0&&(t[o]=e(o)),t[o])}const Pze={m:"margin",p:"padding"},Bze={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},bK={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},Dze=Tze(e=>{if(e.length>2)if(bK[e])e=bK[e];else return[e];const[t,o]=e.split(""),i=Pze[t],a=Bze[o]||"";return Array.isArray(a)?a.map(s=>i+s):[i+a]}),mV=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],gV=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...mV,...gV];function Px(e,t,o,i){const a=fS(e,t,!0)??o;return typeof a=="number"||typeof a=="string"?s=>typeof s=="string"?s:typeof a=="string"?a.startsWith("var(")&&s===0?0:a.startsWith("var(")&&s===1?a:`calc(${s} * ${a})`:a*s:Array.isArray(a)?s=>{if(typeof s=="string")return s;const d=Math.abs(s),c=a[d];return s>=0?c:typeof c=="number"?-c:typeof c=="string"&&c.startsWith("var(")?`calc(-1 * ${c})`:`-${c}`}:typeof a=="function"?a:()=>{}}function fV(e){return Px(e,"spacing",8)}function Bx(e,t){return typeof t=="string"||t==null?t:e(t)}function _ze(e,t){return o=>e.reduce((i,a)=>(i[a]=Bx(t,o),i),{})}function zze(e,t,o,i){if(!t.includes(o))return null;const a=Dze(o),s=_ze(a,i),d=e[o];return Mh(e,d,s)}function yfe(e,t){const o=fV(e.theme);return Object.keys(e).map(i=>zze(e,t,i,o)).reduce(y9,{})}function tn(e){return yfe(e,mV)}tn.propTypes={};tn.filterProps=mV;function on(e){return yfe(e,gV)}on.propTypes={};on.filterProps=gV;function wfe(e=8,t=fV({spacing:e})){if(e.mui)return e;const o=(...i)=>(i.length===0?[1]:i).map(a=>{const s=t(a);return typeof s=="number"?`${s}px`:s}).join(" ");return o.mui=!0,o}function xS(...e){const t=e.reduce((i,a)=>(a.filterProps.forEach(s=>{i[s]=a}),i),{}),o=i=>Object.keys(i).reduce((a,s)=>t[s]?y9(a,t[s](i)):a,{});return o.propTypes={},o.filterProps=e.reduce((i,a)=>i.concat(a.filterProps),[]),o}function _d(e){return typeof e!="number"?e:`${e}px solid`}function sc(e,t){return Mn({prop:e,themeKey:"borders",transform:t})}const Rze=sc("border",_d),Fze=sc("borderTop",_d),Oze=sc("borderRight",_d),Nze=sc("borderBottom",_d),Hze=sc("borderLeft",_d),Vze=sc("borderColor"),Uze=sc("borderTopColor"),Wze=sc("borderRightColor"),Qze=sc("borderBottomColor"),Gze=sc("borderLeftColor"),Yze=sc("outline",_d),Kze=sc("outlineColor"),yS=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Px(e.theme,"shape.borderRadius",4),o=i=>({borderRadius:Bx(t,i)});return Mh(e,e.borderRadius,o)}return null};yS.propTypes={};yS.filterProps=["borderRadius"];xS(Rze,Fze,Oze,Nze,Hze,Vze,Uze,Wze,Qze,Gze,yS,Yze,Kze);const wS=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Px(e.theme,"spacing",8),o=i=>({gap:Bx(t,i)});return Mh(e,e.gap,o)}return null};wS.propTypes={};wS.filterProps=["gap"];const bS=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Px(e.theme,"spacing",8),o=i=>({columnGap:Bx(t,i)});return Mh(e,e.columnGap,o)}return null};bS.propTypes={};bS.filterProps=["columnGap"];const vS=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Px(e.theme,"spacing",8),o=i=>({rowGap:Bx(t,i)});return Mh(e,e.rowGap,o)}return null};vS.propTypes={};vS.filterProps=["rowGap"];const qze=Mn({prop:"gridColumn"}),Zze=Mn({prop:"gridRow"}),Jze=Mn({prop:"gridAutoFlow"}),Xze=Mn({prop:"gridAutoColumns"}),eRe=Mn({prop:"gridAutoRows"}),tRe=Mn({prop:"gridTemplateColumns"}),oRe=Mn({prop:"gridTemplateRows"}),rRe=Mn({prop:"gridTemplateAreas"}),iRe=Mn({prop:"gridArea"});xS(wS,bS,vS,qze,Zze,Jze,Xze,eRe,tRe,oRe,rRe,iRe);function p5(e,t){return t==="grey"?t:e}const nRe=Mn({prop:"color",themeKey:"palette",transform:p5}),aRe=Mn({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:p5}),sRe=Mn({prop:"backgroundColor",themeKey:"palette",transform:p5});xS(nRe,aRe,sRe);function ql(e){return e<=1&&e!==0?`${e*100}%`:e}const lRe=Mn({prop:"width",transform:ql}),xV=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=o=>{const i=e.theme?.breakpoints?.values?.[o]||gS[o];return i?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:ql(o)}};return Mh(e,e.maxWidth,t)}return null};xV.filterProps=["maxWidth"];const dRe=Mn({prop:"minWidth",transform:ql}),cRe=Mn({prop:"height",transform:ql}),uRe=Mn({prop:"maxHeight",transform:ql}),pRe=Mn({prop:"minHeight",transform:ql});Mn({prop:"size",cssProperty:"width",transform:ql});Mn({prop:"size",cssProperty:"height",transform:ql});const hRe=Mn({prop:"boxSizing"});xS(lRe,xV,dRe,cRe,uRe,pRe,hRe);const CS={border:{themeKey:"borders",transform:_d},borderTop:{themeKey:"borders",transform:_d},borderRight:{themeKey:"borders",transform:_d},borderBottom:{themeKey:"borders",transform:_d},borderLeft:{themeKey:"borders",transform:_d},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:_d},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:yS},color:{themeKey:"palette",transform:p5},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:p5},backgroundColor:{themeKey:"palette",transform:p5},p:{style:on},pt:{style:on},pr:{style:on},pb:{style:on},pl:{style:on},px:{style:on},py:{style:on},padding:{style:on},paddingTop:{style:on},paddingRight:{style:on},paddingBottom:{style:on},paddingLeft:{style:on},paddingX:{style:on},paddingY:{style:on},paddingInline:{style:on},paddingInlineStart:{style:on},paddingInlineEnd:{style:on},paddingBlock:{style:on},paddingBlockStart:{style:on},paddingBlockEnd:{style:on},m:{style:tn},mt:{style:tn},mr:{style:tn},mb:{style:tn},ml:{style:tn},mx:{style:tn},my:{style:tn},margin:{style:tn},marginTop:{style:tn},marginRight:{style:tn},marginBottom:{style:tn},marginLeft:{style:tn},marginX:{style:tn},marginY:{style:tn},marginInline:{style:tn},marginInlineStart:{style:tn},marginInlineEnd:{style:tn},marginBlock:{style:tn},marginBlockStart:{style:tn},marginBlockEnd:{style:tn},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:wS},rowGap:{style:vS},columnGap:{style:bS},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:ql},maxWidth:{style:xV},minWidth:{transform:ql},height:{transform:ql},maxHeight:{transform:ql},minHeight:{transform:ql},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 mRe(...e){const t=e.reduce((i,a)=>i.concat(Object.keys(a)),[]),o=new Set(t);return e.every(i=>o.size===Object.keys(i).length)}function gRe(e,t){return typeof e=="function"?e(t):e}function fRe(){function e(o,i,a,s){const d={[o]:i,theme:a},c=s[o];if(!c)return{[o]:i};const{cssProperty:u=o,themeKey:p,transform:h,style:m}=c;if(i==null)return null;if(p==="typography"&&i==="inherit")return{[o]:i};const f=fS(a,p)||{};return m?m(d):Mh(d,i,x=>{let y=PC(f,h,x);return x===y&&typeof x=="string"&&(y=PC(f,h,`${o}${x==="default"?"":No(x)}`,x)),u===!1?y:{[u]:y}})}function t(o){const{sx:i,theme:a={},nested:s}=o||{};if(!i)return null;const d=a.unstable_sxConfig??CS;function c(u){let p=u;if(typeof u=="function")p=u(a);else if(typeof u!="object")return u;if(!p)return null;const h=Mze(a.breakpoints),m=Object.keys(h);let f=h;return Object.keys(p).forEach(x=>{const y=gRe(p[x],a);if(y!=null)if(typeof y=="object")if(d[x])f=y9(f,e(x,y,a,d));else{const w=Mh({theme:a},y,b=>({[x]:b}));mRe(w,y)?f[x]=t({sx:y,theme:a,nested:!0}):f=y9(f,w)}else f=y9(f,e(x,y,a,d))}),!s&&a.modularCssLayers?{"@layer sx":xK(a,wK(m,f))}:xK(a,wK(m,f))}return Array.isArray(i)?i.map(c):c(i)}return t}const h3=fRe();h3.filterProps=["sx"];function xRe(e,t){const o=this;if(o.vars){if(!o.colorSchemes?.[e]||typeof o.getColorSchemeSelector!="function")return{};let i=o.getColorSchemeSelector(e);return i==="&"?t:((i.includes("data-")||i.includes("."))&&(i=`*:where(${i.replace(/\s*&$/,"")}) &`),{[i]:t})}return o.palette.mode===e?t:{}}function yV(e={},...t){const{breakpoints:o={},palette:i={},spacing:a,shape:s={},...d}=e,c=Sze(o),u=wfe(a);let p=xs({breakpoints:c,direction:"ltr",components:{},palette:{mode:"light",...i},spacing:u,shape:{...jze,...s}},d);return p=Lze(p),p.applyStyles=xRe,p=t.reduce((h,m)=>xs(h,m),p),p.unstable_sxConfig={...CS,...d?.unstable_sxConfig},p.unstable_sx=function(h){return h3({sx:h,theme:this})},p}function yRe(e){return Object.keys(e).length===0}function wV(e=null){const t=g.useContext(tfe);return!t||yRe(t)?e:t}const wRe=yV();function bfe(e=wRe){return wV(e)}function vK(e){const t=n2(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function vfe({styles:e,themeId:t,defaultTheme:o={}}){const i=bfe(o),a=t&&i[t]||i;let s=typeof e=="function"?e(a):e;return a.modularCssLayers&&(Array.isArray(s)?s=s.map(d=>vK(typeof d=="function"?d(a):d)):s=vK(s)),l.jsx(gfe,{styles:s})}const CK=e=>e,bRe=()=>{let e=CK;return{configure(t){e=t},generate(t){return e(t)},reset(){e=CK}}},vRe=bRe();function Cfe(e){var t,o,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(o=Cfe(e[t]))&&(i&&(i+=" "),i+=o)}else for(o in e)e[o]&&(i&&(i+=" "),i+=o);return i}function Eo(){for(var e,t,o=0,i="",a=arguments.length;o<a;o++)(e=arguments[o])&&(t=Cfe(e))&&(i&&(i+=" "),i+=t);return i}const CRe={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 Ur(e,t,o="Mui"){const i=CRe[t];return i?`${o}-${i}`:`${vRe.generate(e)}-${t}`}function Mr(e,t,o="Mui"){const i={};return t.forEach(a=>{i[a]=Ur(e,a,o)}),i}function $fe(e){const{variants:t,...o}=e,i={variants:t,style:n2(o),isProcessed:!0};return i.style===o||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=n2(a.style))}),i}const $Re=yV();function Qj(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function Ng(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function kRe(e){return e?(t,o)=>o[e]:null}function SRe(e,t,o){e.theme=LRe(e.theme)?o:e.theme[t]||e.theme}function Zv(e,t,o){const i=typeof t=="function"?t(e):t;if(Array.isArray(i))return i.flatMap(a=>Zv(e,a,o));if(Array.isArray(i?.variants)){let a;if(i.isProcessed)a=o?Ng(i.style,o):i.style;else{const{variants:s,...d}=i;a=o?Ng(n2(d),o):d}return kfe(e,i.variants,[a],o)}return i?.isProcessed?o?Ng(n2(i.style),o):i.style:o?Ng(n2(i),o):i}function kfe(e,t,o=[],i=void 0){let a;e:for(let s=0;s<t.length;s+=1){const d=t[s];if(typeof d.props=="function"){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!d.props(a))continue}else for(const c in d.props)if(e[c]!==d.props[c]&&e.ownerState?.[c]!==d.props[c])continue e;typeof d.style=="function"?(a??={...e,...e.ownerState,ownerState:e.ownerState},o.push(i?Ng(n2(d.style(a)),i):d.style(a))):o.push(i?Ng(n2(d.style),i):d.style)}return o}function ARe(e={}){const{themeId:t,defaultTheme:o=$Re,rootShouldForwardProp:i=Qj,slotShouldForwardProp:a=Qj}=e;function s(d){SRe(d,t,o)}return(d,c={})=>{vze(d,I=>I.filter(L=>L!==h3));const{name:u,slot:p,skipVariantsResolver:h,skipSx:m,overridesResolver:f=kRe(IRe(p)),...x}=c,y=u&&u.startsWith("Mui")||p?"components":"custom",w=h!==void 0?h:p&&p!=="Root"&&p!=="root"||!1,b=m||!1;let C=Qj;p==="Root"||p==="root"?C=i:p?C=a:jRe(d)&&(C=void 0);const $=bze(d,{shouldForwardProp:C,label:ERe(),...x}),A=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(L){return Zv(L,I,L.theme.modularCssLayers?y:void 0)};if(lh(I)){const L=$fe(I);return function(T){return L.variants?Zv(T,L,T.theme.modularCssLayers?y:void 0):T.theme.modularCssLayers?Ng(L.style,y):L.style}}return I},E=(...I)=>{const L=[],T=I.map(A),P=[];if(L.push(s),u&&f&&P.push(function(R){const z=R.theme.components?.[u]?.styleOverrides;if(!z)return null;const Y={};for(const Z in z)Y[Z]=Zv(R,z[Z],R.theme.modularCssLayers?"theme":void 0);return f(R,Y)}),u&&!w&&P.push(function(R){const z=R.theme?.components?.[u]?.variants;return z?kfe(R,z,[],R.theme.modularCssLayers?"theme":void 0):null}),b||P.push(h3),Array.isArray(T[0])){const R=T.shift(),z=new Array(L.length).fill(""),Y=new Array(P.length).fill("");let Z;Z=[...z,...R,...Y],Z.raw=[...z,...R.raw,...Y],L.unshift(Z)}const B=[...L,...T,...P],_=$(...B);return d.muiName&&(_.muiName=d.muiName),_};return $.withConfig&&(E.withConfig=$.withConfig),E}}function ERe(e,t){return void 0}function LRe(e){for(const t in e)return!1;return!0}function jRe(e){return typeof e=="string"&&e.charCodeAt(0)>96}function IRe(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function vF(e,t,o=!1){const i={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const s=a;if(s==="components"||s==="slots")i[s]={...e[s],...i[s]};else if(s==="componentsProps"||s==="slotProps"){const d=e[s],c=t[s];if(!c)i[s]=d||{};else if(!d)i[s]=c;else{i[s]={...c};for(const u in d)if(Object.prototype.hasOwnProperty.call(d,u)){const p=u;i[s][p]=vF(d[p],c[p],o)}}}else s==="className"&&o&&t.className?i.className=Eo(e?.className,t?.className):s==="style"&&o&&t.style?i.style={...e?.style,...t?.style}:i[s]===void 0&&(i[s]=e[s])}return i}const ec=typeof window<"u"?g.useLayoutEffect:g.useEffect;function MRe(e,t=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,o))}function bV(e,t=0,o=1){return MRe(e,t,o)}function TRe(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let o=e.match(t);return o&&o[0].length===1&&(o=o.map(i=>i+i)),o?`rgb${o.length===4?"a":""}(${o.map((i,a)=>a<3?parseInt(i,16):Math.round(parseInt(i,16)/255*1e3)/1e3).join(", ")})`:""}function v2(e){if(e.type)return e;if(e.charAt(0)==="#")return v2(TRe(e));const t=e.indexOf("("),o=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(o))throw new Error(Ih(9,e));let i=e.substring(t+1,e.length-1),a;if(o==="color"){if(i=i.split(" "),a=i.shift(),i.length===4&&i[3].charAt(0)==="/"&&(i[3]=i[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(Ih(10,a))}else i=i.split(",");return i=i.map(s=>parseFloat(s)),{type:o,values:i,colorSpace:a}}const PRe=e=>{const t=v2(e);return t.values.slice(0,3).map((o,i)=>t.type.includes("hsl")&&i!==0?`${o}%`:o).join(" ")},V8=(e,t)=>{try{return PRe(e)}catch{return e}};function $S(e){const{type:t,colorSpace:o}=e;let{values:i}=e;return t.includes("rgb")?i=i.map((a,s)=>s<3?parseInt(a,10):a):t.includes("hsl")&&(i[1]=`${i[1]}%`,i[2]=`${i[2]}%`),t.includes("color")?i=`${o} ${i.join(" ")}`:i=`${i.join(", ")}`,`${t}(${i})`}function Sfe(e){e=v2(e);const{values:t}=e,o=t[0],i=t[1]/100,a=t[2]/100,s=i*Math.min(a,1-a),d=(p,h=(p+o/30)%12)=>a-s*Math.max(Math.min(h-3,9-h,1),-1);let c="rgb";const u=[Math.round(d(0)*255),Math.round(d(8)*255),Math.round(d(4)*255)];return e.type==="hsla"&&(c+="a",u.push(t[3])),$S({type:c,values:u})}function CF(e){e=v2(e);let t=e.type==="hsl"||e.type==="hsla"?v2(Sfe(e)).values:e.values;return t=t.map(o=>(e.type!=="color"&&(o/=255),o<=.03928?o/12.92:((o+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function BRe(e,t){const o=CF(e),i=CF(t);return(Math.max(o,i)+.05)/(Math.min(o,i)+.05)}function BC(e,t){return e=v2(e),t=bV(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,$S(e)}function Vm(e,t,o){try{return BC(e,t)}catch{return e}}function kS(e,t){if(e=v2(e),t=bV(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let o=0;o<3;o+=1)e.values[o]*=1-t;return $S(e)}function oi(e,t,o){try{return kS(e,t)}catch{return e}}function SS(e,t){if(e=v2(e),t=bV(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let o=0;o<3;o+=1)e.values[o]+=(255-e.values[o])*t;else if(e.type.includes("color"))for(let o=0;o<3;o+=1)e.values[o]+=(1-e.values[o])*t;return $S(e)}function ri(e,t,o){try{return SS(e,t)}catch{return e}}function DRe(e,t=.15){return CF(e)>.5?kS(e,t):SS(e,t)}function iw(e,t,o){try{return DRe(e,t)}catch{return e}}const Afe=g.createContext(null);function vV(){return g.useContext(Afe)}const _Re=typeof Symbol=="function"&&Symbol.for,zRe=_Re?Symbol.for("mui.nested"):"__THEME_NESTED__";function RRe(e,t){return typeof t=="function"?t(e):{...e,...t}}function FRe(e){const{children:t,theme:o}=e,i=vV(),a=g.useMemo(()=>{const s=i===null?{...o}:RRe(i,o);return s!=null&&(s[zRe]=i!==null),s},[o,i]);return l.jsx(Afe.Provider,{value:a,children:t})}const Efe=g.createContext();function ORe({value:e,...t}){return l.jsx(Efe.Provider,{value:e??!0,...t})}const g7=()=>g.useContext(Efe)??!1,Lfe=g.createContext(void 0);function NRe({value:e,children:t}){return l.jsx(Lfe.Provider,{value:e,children:t})}function HRe(e){const{theme:t,name:o,props:i}=e;if(!t||!t.components||!t.components[o])return i;const a=t.components[o];return a.defaultProps?vF(a.defaultProps,i,t.components.mergeClassNameAndStyle):!a.styleOverrides&&!a.variants?vF(a,i,t.components.mergeClassNameAndStyle):i}function VRe({props:e,name:t}){const o=g.useContext(Lfe);return HRe({props:e,name:t,theme:{components:o}})}let $K=0;function URe(e){const[t,o]=g.useState(e),i=e||t;return g.useEffect(()=>{t==null&&($K+=1,o(`mui-${$K}`))},[t]),i}const WRe={...gBe},kK=WRe.useId;function AS(e){if(kK!==void 0){const t=kK();return e??t}return URe(e)}function QRe(e){const t=wV(),o=AS()||"",{modularCssLayers:i}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||t!==null?a="":typeof i=="string"?a=i.replace(/mui(?!\.)/g,a):a=`@layer ${a};`,ec(()=>{const s=document.querySelector("head");if(!s)return;const d=s.firstChild;if(a){if(d&&d.hasAttribute?.("data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===o)return;const c=document.createElement("style");c.setAttribute("data-mui-layer-order",o),c.textContent=a,s.prepend(c)}else s.querySelector(`style[data-mui-layer-order="${o}"]`)?.remove()},[a,o]),a?l.jsx(vfe,{styles:a}):null}const SK={};function AK(e,t,o,i=!1){return g.useMemo(()=>{const a=e&&t[e]||t;if(typeof o=="function"){const s=o(a),d=e?{...t,[e]:s}:s;return i?()=>d:d}return e?{...t,[e]:o}:{...t,...o}},[e,t,o,i])}function jfe(e){const{children:t,theme:o,themeId:i}=e,a=wV(SK),s=vV()||SK,d=AK(i,a,o),c=AK(i,s,o,!0),u=(i?d[i]:d).direction==="rtl",p=QRe(d);return l.jsx(FRe,{theme:c,children:l.jsx(tfe.Provider,{value:d,children:l.jsx(ORe,{value:u,children:l.jsxs(NRe,{value:i?d[i].components:d.components,children:[p,t]})})})})}const EK={theme:void 0};function GRe(e){let t,o;return function(i){let a=t;return(a===void 0||i.theme!==o)&&(EK.theme=i.theme,a=$fe(e(EK)),t=a,o=i.theme),a}}const CV="mode",$V="color-scheme",YRe="data-color-scheme";function KRe(e){const{defaultMode:t="system",defaultLightColorScheme:o="light",defaultDarkColorScheme:i="dark",modeStorageKey:a=CV,colorSchemeStorageKey:s=$V,attribute:d=YRe,colorSchemeNode:c="document.documentElement",nonce:u}=e||{};let p="",h=d;if(d==="class"&&(h=".%s"),d==="data"&&(h="[data-%s]"),h.startsWith(".")){const f=h.substring(1);p+=`${c}.classList.remove('${f}'.replace('%s', light), '${f}'.replace('%s', dark));
3
3
  ${c}.classList.add('${f}'.replace('%s', colorScheme));`}const m=h.match(/\[([^[\]]+)\]/);if(m){const[f,x]=m[1].split("=");x||(p+=`${c}.removeAttribute('${f}'.replace('%s', light));
4
4
  ${c}.removeAttribute('${f}'.replace('%s', dark));`),p+=`
5
5
  ${c}.setAttribute('${f}'.replace('%s', colorScheme), ${x?`${x}.replace('%s', colorScheme)`:'""'});`}else p+=`${c}.setAttribute('${h}', colorScheme);`;return l.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?u:"",dangerouslySetInnerHTML:{__html:`(function() {
@@ -229,7 +229,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
229
229
  `+le:"")+"\n```"},regExp:/^```(\w{1,10})?\s/,replace:Z(ue=>t.$createCodeNode(ue?ue[1]:void 0)),type:"element"},V={dependencies:[o.ListNode,o.ListItemNode],export:(ue,le)=>o.$isListNode(ue)?U(ue,le,0):null,regExp:/^(\s*)[-*+]\s/,replace:O("bullet"),type:"element"},te={dependencies:[o.ListNode,o.ListItemNode],export:(ue,le)=>o.$isListNode(ue)?U(ue,le,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:O("check"),type:"element"},q={dependencies:[o.ListNode,o.ListItemNode],export:(ue,le)=>o.$isListNode(ue)?U(ue,le,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:O("number"),type:"element"},G={format:["code"],tag:"`",type:"text-format"},J={format:["highlight"],tag:"==",type:"text-format"},X={format:["bold","italic"],tag:"***",type:"text-format"},ae={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},xe={format:["bold"],tag:"**",type:"text-format"},pe={format:["bold"],intraword:!1,tag:"__",type:"text-format"},de={format:["strikethrough"],tag:"~~",type:"text-format"},ce={format:["italic"],tag:"*",type:"text-format"},ye={format:["italic"],intraword:!1,tag:"_",type:"text-format"},Le={dependencies:[s.LinkNode],export:(ue,le,fe)=>{if(!s.$isLinkNode(ue))return null;le=(le=ue.getTitle())?`[${ue.getTextContent()}](${ue.getURL()} "${le}")`:`[${ue.getTextContent()}](${ue.getURL()})`;const Me=ue.getFirstChild();return ue.getChildrenSize()===1&&e.$isTextNode(Me)?fe(Me,le):le},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(ue,le)=>{const[,fe,Me,Ee]=le;le=s.$createLinkNode(Me,{title:Ee});const Ke=e.$createTextNode(fe);Ke.setFormat(ue.getFormat()),le.append(Ke),ue.replace(le)},trigger:")",type:"text-match"},ne=[F,D,H,V,q],se=[G,X,ae,xe,pe,J,ce,ye,de],me=[Le],ke=[...ne,...se,...me];return Bi.$convertFromMarkdownString=function(ue,le=ke,fe){return T(le)(ue,fe)},Bi.$convertToMarkdownString=function(ue=ke,le){return p(ue)(le)},Bi.BOLD_ITALIC_STAR=X,Bi.BOLD_ITALIC_UNDERSCORE=ae,Bi.BOLD_STAR=xe,Bi.BOLD_UNDERSCORE=pe,Bi.CHECK_LIST=te,Bi.CODE=H,Bi.ELEMENT_TRANSFORMERS=ne,Bi.HEADING=F,Bi.HIGHLIGHT=J,Bi.INLINE_CODE=G,Bi.ITALIC_STAR=ce,Bi.ITALIC_UNDERSCORE=ye,Bi.LINK=Le,Bi.ORDERED_LIST=q,Bi.QUOTE=D,Bi.STRIKETHROUGH=de,Bi.TEXT_FORMAT_TRANSFORMERS=se,Bi.TEXT_MATCH_TRANSFORMERS=me,Bi.TRANSFORMERS=ke,Bi.UNORDERED_LIST=V,Bi.registerMarkdownShortcuts=function(ue,le=ke){let fe=c(le),Me=d(fe.textFormat,({tag:Ke})=>Ke[Ke.length-1]),Ee=d(fe.textMatch,({trigger:Ke})=>Ke);for(let Ke of le)if(le=Ke.type,(le==="element"||le==="text-match")&&!ue.hasNodes(Ke.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 ue.registerUpdateListener(({tags:Ke,dirtyLeaves:Se,editorState:Ge,prevEditorState:ze})=>{if(!Ke.has("historic")){var Ie=Ge.read(e.$getSelection);if(Ke=ze.read(e.$getSelection),e.$isRangeSelection(Ke)&&e.$isRangeSelection(Ie)&&Ie.isCollapsed()){ze=Ie.anchor.key;var qe=Ie.anchor.offset,Fe=Ge._nodeMap.get(ze);e.$isTextNode(Fe)&&Se.has(ze)&&(qe===1||qe===Ke.anchor.offset+1)&&ue.update(()=>{if(!Fe.hasFormat("code")){var Be=Fe.getParent();if(Be!==null&&!t.$isCodeNode(Be)){var Xe=Ie.anchor.offset;e:{var lt=fe.element,dt=Be.getParent();if(e.$isRootOrShadowRoot(dt)&&Be.getFirstChild()===Fe&&(dt=Fe.getTextContent(),dt[Xe-1]===" ")){for(let{regExp:ro,replace:or}of lt)if((lt=dt.match(ro))&&lt[0].length===Xe){dt=Fe.getNextSiblings();let[Vr,Dr]=Fe.splitText(Xe);Vr.remove(),dt=Dr?[Dr,...dt]:dt,or(Be,dt,lt,!1),Be=!0;break e}}Be=!1}if(!Be){e:{if(lt=Fe.getTextContent(),Be=Ee[lt[Xe-1]],Be!=null){Xe<lt.length&&(lt=lt.slice(0,Xe));for(ct of Be)if(Be=lt.match(ct.regExp),Be!==null){lt=Be.index||0,dt=lt+Be[0].length;var Ct=void 0;lt===0?[Ct]=Fe.splitText(dt):[,Ct]=Fe.splitText(lt,dt),Ct.selectNext(0,0),ct.replace(Ct,Be);var ct=!0;break e}}ct=!1}if(!ct)e:{dt=Fe.getTextContent(),--Xe;var it=dt[Xe];if(ct=Me[it])for(let ro of ct){var{tag:Nt}=ro;ct=Nt.length;let or=Xe-ct+1;if(!(1<ct&&!Y(dt,or,Nt,0,ct)||dt[or-1]===" ")&&(Ct=dt[Xe+1],ro.intraword!==!1||!Ct||u.test(Ct))){Be=Ct=Fe,lt=z(dt,or,Nt);for(var Mt=Be;0>lt&&(Mt=Mt.getPreviousSibling())&&!e.$isLineBreakNode(Mt);)e.$isTextNode(Mt)&&(lt=Mt.getTextContent(),Be=Mt,lt=z(lt,lt.length,Nt));if(!(0>lt||Be===Ct&&lt+ct===or||(Nt=Be.getTextContent(),0<lt&&Nt[lt-1]===it||(Mt=Nt[lt-1],ro.intraword===!1&&Mt&&!u.test(Mt))))){dt=Ct.getTextContent(),dt=dt.slice(0,or)+dt.slice(Xe+1),Ct.setTextContent(dt),dt=Be===Ct?dt:Nt,Be.setTextContent(dt.slice(0,lt)+dt.slice(lt+ct)),dt=e.$getSelection(),it=e.$createRangeSelection(),e.$setSelection(it),Xe=Xe-ct*(Be===Ct?2:1)+1,it.anchor.set(Be.__key,lt,"text"),it.focus.set(Ct.__key,Xe,"text");for(let Vr of ro.format)it.hasFormat(Vr)||it.formatText(Vr);it.anchor.set(it.focus.key,it.focus.offset,it.focus.type);for(let Vr of ro.format)it.hasFormat(Vr)&&it.toggleFormat(Vr);e.$isRangeSelection(dt)&&(it.format=dt.format);break e}}}}}}}})}}})},Bi}var g_,sle;function Kve(){return sle||(sle=1,g_=Fyt()),g_}var Oyt=Kve(),f_={},lle;function Nyt(){if(lle)return f_;lle=1;var e=cd(),t=Ml();return f_.AutoFocusPlugin=function({defaultSelection:o}){let[i]=e.useLexicalComposerContext();return t.useEffect(()=>{i.focus(()=>{let a=document.activeElement,s=i.getRootElement();s===null||a!==null&&s.contains(a)||s.focus({preventScroll:!0})},{defaultSelection:o})},[o,i]),null},f_}var x_,dle;function Hyt(){return dle||(dle=1,x_=Nyt()),x_}var Vyt=Hyt(),Qw={},q4={},y_={},cle;function Uyt(){if(cle)return y_;cle=1;var e=cd(),t=Un(),o=Ml();function i(a,s){return a.getEditorState().read(()=>{let d=t.$getNodeByKey(s);return d===null?!1:d.isSelected()})}return y_.useLexicalNodeSelection=function(a){let[s]=e.useLexicalComposerContext(),[d,c]=o.useState(()=>i(s,a));o.useEffect(()=>{let h=!0,m=s.registerUpdateListener(()=>{h&&c(i(s,a))});return()=>{h=!1,m()}},[s,a]);let u=o.useCallback(h=>{s.update(()=>{let m=t.$getSelection();t.$isNodeSelection(m)||(m=t.$createNodeSelection(),t.$setSelection(m)),h?m.add(a):m.delete(a)})},[s,a]),p=o.useCallback(()=>{s.update(()=>{const h=t.$getSelection();t.$isNodeSelection(h)&&h.clear()})},[s]);return[d,u,p]},y_}var w_,ule;function Wyt(){return ule||(ule=1,w_=Uyt()),w_}var ple;function Qyt(){if(ple)return q4;ple=1;var e=cd(),t=Wyt(),o=Pl(),i=Un(),a=Ml();let s=i.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");function d({nodeKey:m}){let[f]=e.useLexicalComposerContext(),[x,y,w]=t.useLexicalNodeSelection(m),b=a.useCallback(C=>(x&&i.$isNodeSelection(i.$getSelection())&&(C.preventDefault(),C=i.$getNodeByKey(m),h(C)&&C.remove(),y(!1)),!1),[x,m,y]);return a.useEffect(()=>o.mergeRegister(f.registerCommand(i.CLICK_COMMAND,C=>{let $=f.getElementByKey(m);return C.target===$?(C.shiftKey||w(),y(!x),!0):!1},i.COMMAND_PRIORITY_LOW),f.registerCommand(i.KEY_DELETE_COMMAND,b,i.COMMAND_PRIORITY_LOW),f.registerCommand(i.KEY_BACKSPACE_COMMAND,b,i.COMMAND_PRIORITY_LOW)),[w,f,x,m,b,y]),a.useEffect(()=>{let C=f.getElementByKey(m);C!==null&&(C.className=x?"selected":"")},[f,x,m]),null}class c extends i.DecoratorNode{static getType(){return"horizontalrule"}static clone(f){return new c(f.__key)}static importJSON(){return p()}static importDOM(){return{hr:()=>({conversion:u,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return`
230
230
  `}isInline(){return!1}updateDOM(){return!1}decorate(){return a.createElement(d,{nodeKey:this.__key})}}function u(){return{node:p()}}function p(){return i.$applyNodeReplacement(new c)}function h(m){return m instanceof c}return q4.$createHorizontalRuleNode=p,q4.$isHorizontalRuleNode=h,q4.HorizontalRuleNode=c,q4.INSERT_HORIZONTAL_RULE_COMMAND=s,q4}var b_,hle;function Gyt(){return hle||(hle=1,b_=Qyt()),b_}var mle;function Yyt(){if(mle)return Qw;mle=1;var e=Kve(),t=cd(),o=Gyt(),i=Ml();let a=[{dependencies:[o.HorizontalRuleNode],export:s=>o.$isHorizontalRuleNode(s)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(s,d,c,u)=>{d=o.$createHorizontalRuleNode(),u||s.getNextSibling()!=null?s.replace(d):s.insertBefore(d),d.selectNext()},type:"element"},...e.TRANSFORMERS];return Qw.DEFAULT_TRANSFORMERS=a,Qw.MarkdownShortcutPlugin=function({transformers:s=a}){let[d]=t.useLexicalComposerContext();return i.useEffect(()=>e.registerMarkdownShortcuts(d,s),[d,s]),null},Qw}var v_,gle;function Kyt(){return gle||(gle=1,v_=Yyt()),v_}var qyt=Kyt(),_r={},fle;function Zyt(){if(fle)return _r;fle=1;var e=Un(),t=Pl();let o={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class i extends e.DEPRECATED_GridCellNode{static getType(){return"tablecell"}static clone(H){let V=new i(H.__headerState,H.__colSpan,H.__width,H.__key);return V.__rowSpan=H.__rowSpan,V}static importDOM(){return{td:()=>({conversion:a,priority:0}),th:()=>({conversion:a,priority:0})}}static importJSON(H){let V=s(H.headerState,H.colSpan,H.width||void 0);return V.__rowSpan=H.rowSpan,V}constructor(H=o.NO_STATUS,V=1,te,q){super(V,q),this.__headerState=H,this.__width=te}createDOM(H){let V=document.createElement(this.getTag());return this.__width&&(V.style.width=`${this.__width}px`),1<this.__colSpan&&(V.colSpan=this.__colSpan),1<this.__rowSpan&&(V.rowSpan=this.__rowSpan),t.addClassNamesToElement(V,H.theme.tableCell,this.hasHeader()&&H.theme.tableCellHeader),V}exportDOM(H){if({element:H}=super.exportDOM(H),H){let V=this.getParentOrThrow().getChildrenSize();H.style.border="1px solid black",1<this.__colSpan&&(H.colSpan=this.__colSpan),1<this.__rowSpan&&(H.rowSpan=this.__rowSpan),H.style.width=`${this.getWidth()||Math.max(90,700/V)}px`,H.style.verticalAlign="top",H.style.textAlign="start",this.hasHeader()&&(H.style.backgroundColor="#f2f3f5")}return{element:H}}exportJSON(){return{...super.exportJSON(),headerState:this.__headerState,type:"tablecell",width:this.getWidth()}}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(H){return this.getWritable().__headerState=H,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(H){return this.getWritable().__width=H,this.__width}getWidth(){return this.getLatest().__width}toggleHeaderStyle(H){let V=this.getWritable();return V.__headerState=(V.__headerState&H)===H?V.__headerState-H:V.__headerState+H,V}hasHeaderState(H){return(this.getHeaderStyles()&H)===H}hasHeader(){return this.getLatest().__headerState!==o.NO_STATUS}updateDOM(H){return H.__headerState!==this.__headerState||H.__width!==this.__width||H.__colSpan!==this.__colSpan||H.__rowSpan!==this.__rowSpan}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function a(D){var H=D.nodeName.toLowerCase();return H=s(H==="th"?o.ROW:o.NO_STATUS),H.__colSpan=D.colSpan,H.__rowSpan=D.rowSpan,{forChild:(V,te)=>d(te)&&!e.$isElementNode(V)?(te=e.$createParagraphNode(),e.$isLineBreakNode(V)&&V.getTextContent()===`
231
231
  `?null:(te.append(V),te)):V,node:H}}function s(D,H=1,V){return e.$applyNodeReplacement(new i(D,H,V))}function d(D){return D instanceof i}class c extends e.DEPRECATED_GridRowNode{static getType(){return"tablerow"}static clone(H){return new c(H.__height,H.__key)}static importDOM(){return{tr:()=>({conversion:u,priority:0})}}static importJSON(H){return p(H.height)}constructor(H,V){super(V),this.__height=H}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1}}createDOM(H){let V=document.createElement("tr");return this.__height&&(V.style.height=`${this.__height}px`),t.addClassNamesToElement(V,H.theme.tableRow),V}isShadowRoot(){return!0}setHeight(H){return this.getWritable().__height=H,this.__height}getHeight(){return this.getLatest().__height}updateDOM(H){return H.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function u(){return{node:p()}}function p(D){return e.$applyNodeReplacement(new c(D))}function h(D){return D instanceof c}function m(D){throw Error(`Minified Lexical error #${D}; visit https://lexical.dev/docs/error?code=${D} 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(H,V){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.listenersToRemove=new Set,this.tableNodeKey=V,this.editor=H,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(H=>H())}trackTableGrid(){let H=new MutationObserver(V=>{this.editor.update(()=>{var te=!1;for(let q=0;q<V.length;q++){const G=V[q].target.nodeName;if(G==="TABLE"||G==="TR"){te=!0;break}}if(te){if(te=this.editor.getElementByKey(this.tableNodeKey),!te)throw Error("Expected to find TableElement in DOM");this.grid=w(te)}})});this.editor.update(()=>{let V=this.editor.getElementByKey(this.tableNodeKey);if(!V)throw Error("Expected to find TableElement in DOM");this.grid=w(V),H.observe(V,{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 H=e.$getNodeByKey(this.tableNodeKey);if(!R(H))throw Error("Expected TableNode.");if(H=this.editor.getElementByKey(this.tableNodeKey),!H)throw Error("Expected to find TableElement in DOM");H=w(H),b(H,null),e.$setSelection(null),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0)})}enableHighlightStyle(){this.editor.update(()=>{let H=this.editor.getElementByKey(this.tableNodeKey);if(!H)throw Error("Expected to find TableElement in DOM");H.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){this.editor.update(()=>{let H=this.editor.getElementByKey(this.tableNodeKey);if(!H)throw Error("Expected to find TableElement in DOM");H.classList.add("disable-selection"),this.hasHijackedSelectionStyles=!0})}updateTableGridSelection(H){H!=null&&H.gridKey===this.tableNodeKey?(this.gridSelection=H,this.isHighlightingCells=!0,this.disableHighlightStyle(),b(this.grid,this.gridSelection)):H==null&&this.clearHighlight()}setFocusCellForSelection(H,V=!1){this.editor.update(()=>{var te=e.$getNodeByKey(this.tableNodeKey);if(!R(te))throw Error("Expected TableNode.");if(!this.editor.getElementByKey(this.tableNodeKey))throw Error("Expected to find TableElement in DOM");te=H.x;let q=H.y;if(this.focusCell=H,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!==te||this.anchorY!==q||V))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(te===this.focusX&&q===this.focusY)return;this.focusX=te,this.focusY=q,this.isHighlightingCells&&(te=e.$getNearestNodeFromDOMNode(H.elem),this.gridSelection!=null&&this.anchorCellNodeKey!=null&&d(te)&&(te=te.getKey(),this.gridSelection=this.gridSelection.clone()||e.DEPRECATED_$createGridSelection(),this.focusCellNodeKey=te,this.gridSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),e.$setSelection(this.gridSelection),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0),b(this.grid,this.gridSelection)))})}setAnchorCellForSelection(H){this.isHighlightingCells=!1,this.anchorCell=H,this.anchorX=H.x,this.anchorY=H.y,this.editor.update(()=>{var V=e.$getNearestNodeFromDOMNode(H.elem);d(V)&&(V=V.getKey(),this.gridSelection=e.DEPRECATED_$createGridSelection(),this.anchorCellNodeKey=V)})}formatCells(H){this.editor.update(()=>{let V=e.$getSelection();e.DEPRECATED_$isGridSelection(V)||m(11);let te=e.$createRangeSelection(),q=te.anchor,G=te.focus;V.getNodes().forEach(J=>{d(J)&&J.getTextContentSize()!==0&&(q.set(J.getKey(),0,"element"),G.set(J.getKey(),J.getChildrenSize(),"element"),te.formatText(H))}),e.$setSelection(V),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0)})}clearText(){this.editor.update(()=>{let H=e.$getNodeByKey(this.tableNodeKey);if(!R(H))throw Error("Expected TableNode.");var V=e.$getSelection();e.DEPRECATED_$isGridSelection(V)||m(11),V=V.getNodes().filter(d),V.length===this.grid.columns*this.grid.rows?(H.selectPrevious(),H.remove(),e.$getRoot().selectStart()):(V.forEach(te=>{if(e.$isElementNode(te)){let q=e.$createParagraphNode(),G=e.$createTextNode();q.append(G),te.append(q),te.getChildren().forEach(J=>{J!==q&&J.remove()})}}),b(this.grid,null),e.$setSelection(null),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0))})}}function y(D){for(;D!=null;){let H=D.nodeName;if(H==="TD"||H==="TH"){if(D=D._cell,D===void 0)break;return D}D=D.parentNode}return null}function w(D){let H=[],V={cells:H,columns:0,rows:0};var te=D.firstChild;let q=D=0;for(H.length=0;te!=null;){var G=te.nodeName;if(G==="TD"||G==="TH")G={elem:te,highlighted:!1,x:D,y:q},te._cell=G,H[q]===void 0&&(H[q]=[]),H[q][D]=G;else if(G=te.firstChild,G!=null){te=G;continue}if(G=te.nextSibling,G!=null)D++,te=G;else if(G=te.parentNode,G!=null){if(te=G.nextSibling,te==null)break;q++,D=0}}return V.columns=D+1,V.rows=q+1,V}function b(D,H){let V=[],te=new Set(H?H.getNodes():[]);return C(D,(q,G)=>{let J=q.elem;te.has(G)?(q.highlighted=!0,J.style.setProperty("background-color","rgb(172, 206, 247)"),J.style.setProperty("caret-color","transparent"),V.push(q)):(q.highlighted=!1,J.style.removeProperty("background-color"),J.style.removeProperty("caret-color"),J.getAttribute("style")||J.removeAttribute("style"))}),V}function C(D,H){({cells:D}=D);for(let V=0;V<D.length;V++){let te=D[V];for(let q=0;q<te.length;q++){let G=te[q],J=e.$getNearestNodeFromDOMNode(G.elem);J!==null&&H(G,J,{x:q,y:V})}}}function $(D){D.disableHighlightStyle(),C(D.grid,H=>{let V=H.elem;H.highlighted=!0,V.style.setProperty("background-color","rgb(172, 206, 247)"),V.style.setProperty("caret-color","transparent")})}function A(D){D.enableHighlightStyle(),C(D.grid,H=>{let V=H.elem;H.highlighted=!1,V.style.removeProperty("background-color"),V.style.removeProperty("caret-color"),V.getAttribute("style")||V.removeAttribute("style")})}let E=(D,H,V,te,q)=>{const G=q==="forward";switch(q){case"backward":case"forward":return V!==(G?D.grid.columns-1:0)?T(H.getCellNodeFromCordsOrThrow(V+(G?1:-1),te,D.grid)):te!==(G?D.grid.rows-1:0)?T(H.getCellNodeFromCordsOrThrow(G?0:D.grid.columns-1,te+(G?1:-1),D.grid)):G?H.selectNext():H.selectPrevious(),!0;case"up":return te!==0?T(H.getCellNodeFromCordsOrThrow(V,te-1,D.grid)):H.selectPrevious(),!0;case"down":return te!==D.grid.rows-1?T(H.getCellNodeFromCordsOrThrow(V,te+1,D.grid)):H.selectNext(),!0;default:return!1}},I=(D,H,V,te,q)=>{const G=q==="forward";switch(q){case"backward":case"forward":return V!==(G?D.grid.columns-1:0)&&D.setFocusCellForSelection(H.getCellFromCordsOrThrow(V+(G?1:-1),te,D.grid)),!0;case"up":return te!==0?(D.setFocusCellForSelection(H.getCellFromCordsOrThrow(V,te-1,D.grid)),!0):!1;case"down":return te!==D.grid.rows-1?(D.setFocusCellForSelection(H.getCellFromCordsOrThrow(V,te+1,D.grid)),!0):!1;default:return!1}};function L(D,H){if(e.$isRangeSelection(D)||e.DEPRECATED_$isGridSelection(D)){let V=H.isParentOf(D.anchor.getNode());return D=H.isParentOf(D.focus.getNode()),V&&D}return!1}function T(D){let H=D.getChildren().find(V=>e.$isParagraphNode(V));e.$isParagraphNode(H)?H.selectEnd():D.selectEnd()}class P extends e.DEPRECATED_GridNode{static getType(){return"table"}static clone(H){return new P(H.__key)}static importDOM(){return{table:()=>({conversion:B,priority:1})}}static importJSON(){return _()}constructor(H){super(H)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(H){let V=document.createElement("table");return t.addClassNamesToElement(V,H.theme.table),V}updateDOM(){return!1}exportDOM(H){return{...super.exportDOM(H),after:V=>{if(V){let te=V.cloneNode(),q=document.createElement("colgroup"),G=document.createElement("tbody");if(G.append(...V.children),V=this.getFirstChildOrThrow(),!h(V))throw Error("Expected to find row node.");V=V.getChildrenSize();for(let J=0;J<V;J++){let X=document.createElement("col");q.append(X)}return te.replaceChildren(q,G),te}}}}canExtractContents(){return!1}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(H,V){let{rows:te,cells:q}=V;for(V=0;V<te;V++){var G=q[V];if(G==null)throw Error(`Row not found at y:${V}`);if(G=G.findIndex(({elem:J})=>e.$getNearestNodeFromDOMNode(J)===H),G!==-1)return{x:G,y:V}}throw Error("Cell not found in table.")}getCellFromCords(H,V,te){return{cells:te}=te,V=te[V],V==null?null:(H=V[H],H??null)}getCellFromCordsOrThrow(H,V,te){if(H=this.getCellFromCords(H,V,te),!H)throw Error("Cell not found at cords.");return H}getCellNodeFromCords(H,V,te){return H=this.getCellFromCords(H,V,te),H==null?null:(H=e.$getNearestNodeFromDOMNode(H.elem),d(H)?H:null)}getCellNodeFromCordsOrThrow(H,V,te){if(H=this.getCellNodeFromCords(H,V,te),!H)throw Error("Node at cords not TableCellNode.");return H}canSelectBefore(){return!0}canIndent(){return!1}}function B(){return{node:_()}}function _(){return e.$applyNodeReplacement(new P)}function R(D){return D instanceof P}function z(D){if(D=t.$findMatchingParent(D,H=>h(H)),h(D))return D;throw Error("Expected table cell to be inside of table row.")}function Y(D){if(D=t.$findMatchingParent(D,H=>R(H)),R(D))return D;throw Error("Expected table cell to be inside of table.")}function Z(D,H){let V=Y(D),{x:te,y:q}=V.getCordsFromCellNode(D,H);return{above:V.getCellNodeFromCords(te,q-1,H),below:V.getCellNodeFromCords(te,q+1,H),left:V.getCellNodeFromCords(te-1,q,H),right:V.getCellNodeFromCords(te+1,q,H)}}function O(D){D=D.getFirstDescendant(),D===null&&m(124),D.getParentOrThrow().selectStart()}function U(D,H){let V=D.getFirstChild();V!==null?V.insertBefore(H):D.append(H)}let F=e.createCommand("INSERT_TABLE_COMMAND");return _r.$createTableCellNode=s,_r.$createTableNode=_,_r.$createTableNodeWithDimensions=function(D,H,V=!0){let te=_();for(let G=0;G<D;G++){let J=p();for(let X=0;X<H;X++){var q=o.NO_STATUS;typeof V=="object"?(G===0&&V.rows&&(q|=o.ROW),X===0&&V.columns&&(q|=o.COLUMN)):V&&(G===0&&(q|=o.ROW),X===0&&(q|=o.COLUMN)),q=s(q);let ae=e.$createParagraphNode();ae.append(e.$createTextNode()),q.append(ae),J.append(q)}te.append(J)}return te},_r.$createTableRowNode=p,_r.$deleteTableColumn=function(D,H){let V=D.getChildren();for(let q=0;q<V.length;q++){var te=V[q];if(h(te)){if(te=te.getChildren(),H>=te.length||0>H)throw Error("Table column target index out of range");te[H].remove()}}return D},_r.$deleteTableColumn__EXPERIMENTAL=function(){var D=e.$getSelection();e.$isRangeSelection(D)||e.DEPRECATED_$isGridSelection(D)||m(118);var H=D.anchor.getNode();D=D.focus.getNode();let[V,,te]=e.DEPRECATED_$getNodeTriplet(H);[H]=e.DEPRECATED_$getNodeTriplet(D);let[q,G,J]=e.DEPRECATED_$computeGridMap(te,V,H);var{startColumn:X}=G;let{startRow:ae,startColumn:xe}=J;D=Math.min(X,xe),X=Math.max(X+V.__colSpan-1,xe+H.__colSpan-1);let pe=X-D+1;if(q[0].length===X-D+1)te.selectPrevious(),te.remove();else{var de=q.length;for(let ce=0;ce<de;ce++)for(let ye=D;ye<=X;ye++){let{cell:Le,startColumn:ne}=q[ce][ye];ne<D?ye===D&&Le.setColSpan(Le.__colSpan-Math.min(pe,Le.__colSpan-(D-ne))):ne+Le.__colSpan-1>X?ye===X&&Le.setColSpan(Le.__colSpan-(X-ne+1)):Le.remove()}D=q[ae],H=D[xe+H.__colSpan],H!==void 0?({cell:H}=H,O(H)):({cell:H}=D[xe-1],O(H))}},_r.$deleteTableRow__EXPERIMENTAL=function(){var D=e.$getSelection();e.$isRangeSelection(D)||e.DEPRECATED_$isGridSelection(D)||m(118);var H=D.anchor.getNode();D=D.focus.getNode();let[V,,te]=e.DEPRECATED_$getNodeTriplet(H);[D]=e.DEPRECATED_$getNodeTriplet(D);let[q,G,J]=e.DEPRECATED_$computeGridMap(te,V,D);({startRow:H}=G);var{startRow:X}=J;if(D=X+D.__rowSpan-1,q.length===D-H+1)te.remove();else{X=q[0].length;var ae=q[D+1],xe=te.getChildAtIndex(D+1);for(let de=D;de>=H;de--){for(var pe=X-1;0<=pe;pe--){let{cell:ce,startRow:ye,startColumn:Le}=q[de][pe];if(Le===pe&&(de===H&&ye<H&&ce.setRowSpan(ce.__rowSpan-(ye-H)),ye>=H&&ye+ce.__rowSpan-1>D))if(ce.setRowSpan(ce.__rowSpan-(D-ye+1)),xe===null&&m(122),pe===0)U(xe,ce);else{let{cell:ne}=ae[pe-1];ne.insertAfter(ce)}}pe=te.getChildAtIndex(de),e.DEPRECATED_$isGridRowNode(pe)||m(123),pe.remove()}ae!==void 0?({cell:H}=ae[0],O(H)):({cell:H}=q[H-1][0],O(H))}},_r.$getElementGridForTableNode=function(D,H){if(D=D.getElementByKey(H.getKey()),D==null)throw Error("Table Element Not Found");return w(D)},_r.$getTableCellNodeFromLexicalNode=function(D){return D=t.$findMatchingParent(D,H=>d(H)),d(D)?D:null},_r.$getTableColumnIndexFromTableCellNode=function(D){return z(D).getChildren().findIndex(H=>H.is(D))},_r.$getTableNodeFromLexicalNodeOrThrow=Y,_r.$getTableRowIndexFromTableCellNode=function(D){let H=z(D);return Y(H).getChildren().findIndex(V=>V.is(H))},_r.$getTableRowNodeFromTableCellNodeOrThrow=z,_r.$insertTableColumn=function(D,H,V=!0,te,q){let G=D.getChildren();for(let ae=0;ae<G.length;ae++){let xe=G[ae];if(h(xe))for(let pe=0;pe<te;pe++){var J=xe.getChildren();if(H>=J.length||0>H)throw Error("Table column target index out of range");J=J[H],d(J)||m(12);let{left:de,right:ce}=Z(J,q);var X=o.NO_STATUS;(de&&de.hasHeaderState(o.ROW)||ce&&ce.hasHeaderState(o.ROW))&&(X|=o.ROW),X=s(X),X.append(e.$createParagraphNode()),V?J.insertAfter(X):J.insertBefore(X)}}return D},_r.$insertTableColumn__EXPERIMENTAL=function(D=!0){function H(){let pe=s(o.NO_STATUS).append(e.$createParagraphNode());return ae===null&&(ae=pe),pe}var V=e.$getSelection();e.$isRangeSelection(V)||e.DEPRECATED_$isGridSelection(V)||m(118),V=V.focus.getNode();let[te,,q]=e.DEPRECATED_$getNodeTriplet(V),[G,J]=e.DEPRECATED_$computeGridMap(q,te,te);V=G.length;var{startColumn:X}=J;D=D?X+te.__colSpan-1:X-1,X=q.getFirstChild(),e.DEPRECATED_$isGridRowNode(X)||m(120);let ae=null;var xe=X;e:for(X=0;X<V;X++){X!==0&&(xe=xe.getNextSibling(),e.DEPRECATED_$isGridRowNode(xe)||m(121));let pe=G[X];if(0>D){U(xe,H());continue}let{cell:de,startColumn:ce,startRow:ye}=pe[D];if(ce+de.__colSpan-1<=D){let Le=de,ne=ye,se=D;for(;ne!==X&&1<Le.__rowSpan;)if(se-=de.__colSpan,0<=se){let{cell:me,startRow:ke}=pe[se];Le=me,ne=ke}else{xe.append(H());continue e}Le.insertAfter(H())}else de.setColSpan(de.__colSpan+1)}ae!==null&&O(ae)},_r.$insertTableRow=function(D,H,V=!0,te,q){var G=D.getChildren();if(H>=G.length||0>H)throw Error("Table row target index out of range");if(H=G[H],h(H))for(G=0;G<te;G++){let X=H.getChildren(),ae=X.length,xe=p();for(let pe=0;pe<ae;pe++){var J=X[pe];d(J)||m(12);let{above:de,below:ce}=Z(J,q);J=o.NO_STATUS;let ye=de&&de.getWidth()||ce&&ce.getWidth()||void 0;(de&&de.hasHeaderState(o.COLUMN)||ce&&ce.hasHeaderState(o.COLUMN))&&(J|=o.COLUMN),J=s(J,1,ye),J.append(e.$createParagraphNode()),xe.append(J)}V?H.insertAfter(xe):H.insertBefore(xe)}else throw Error("Row before insertion index does not exist.");return D},_r.$insertTableRow__EXPERIMENTAL=function(D=!0){var H=e.$getSelection();e.$isRangeSelection(H)||e.DEPRECATED_$isGridSelection(H)||m(118),H=H.focus.getNode();let[V,,te]=e.DEPRECATED_$getNodeTriplet(H),[q,G]=e.DEPRECATED_$computeGridMap(te,V,V);H=q[0].length;var{startRow:J}=G;if(D){D=J+V.__rowSpan-1;var X=q[D];J=p();for(var ae=0;ae<H;ae++){let{cell:xe,startRow:pe}=X[ae];pe+xe.__rowSpan-1<=D?J.append(s(o.NO_STATUS)):xe.setRowSpan(xe.__rowSpan+1)}H=te.getChildAtIndex(D),e.DEPRECATED_$isGridRowNode(H)||m(119),H.insertAfter(J)}else{for(X=q[J],D=p(),ae=0;ae<H;ae++){let{cell:xe,startRow:pe}=X[ae];pe===J?D.append(s(o.NO_STATUS)):xe.setRowSpan(xe.__rowSpan+1)}H=te.getChildAtIndex(J),e.DEPRECATED_$isGridRowNode(H)||m(119),H.insertBefore(D)}},_r.$isTableCellNode=d,_r.$isTableNode=R,_r.$isTableRowNode=h,_r.$removeTableRowAtIndex=function(D,H){let V=D.getChildren();if(H>=V.length||0>H)throw Error("Expected table cell to be inside of table row.");return V[H].remove(),D},_r.$unmergeCell=function(){var D=e.$getSelection();e.$isRangeSelection(D)||e.DEPRECATED_$isGridSelection(D)||m(118),D=D.anchor.getNode();let[H,V,te]=e.DEPRECATED_$getNodeTriplet(D);D=H.__colSpan;let q=H.__rowSpan;if(1<D){for(var G=1;G<D;G++)H.insertAfter(s(o.NO_STATUS));H.setColSpan(1)}if(1<q){let[ae,xe]=e.DEPRECATED_$computeGridMap(te,H,H),{startColumn:pe,startRow:de}=xe;for(G=1;G<q;G++){let ce=de+G,ye=ae[ce];var J=V.getNextSibling();e.DEPRECATED_$isGridRowNode(J)||m(125);var X=null;for(let Le=0;Le<pe;Le++){let ne=ye[Le],se=ne.cell;ne.startRow===ce&&(X=se),1<se.__colSpan&&(Le+=se.__colSpan-1)}if(X===null)for(X=0;X<D;X++)U(J,s(o.NO_STATUS));else for(J=0;J<D;J++)X.insertAfter(s(o.NO_STATUS))}H.setRowSpan(1)}},_r.INSERT_TABLE_COMMAND=F,_r.TableCellHeaderStates=o,_r.TableCellNode=i,_r.TableNode=P,_r.TableRowNode=c,_r.TableSelection=x,_r.applyTableHandlers=function(D,H,V){let te=V.getRootElement();if(te===null)throw Error("No root element.");let q=new x(V,D.getKey());H.__lexicalTableSelection=q;let G=!1,J=!1;H.addEventListener("dblclick",de=>{let ce=y(de.target);ce!==null&&(de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),q.setAnchorCellForSelection(ce),q.setFocusCellForSelection(ce,!0),G=!1)}),H.addEventListener("mousedown",de=>{setTimeout(()=>{if(de.button===0){var ce=y(de.target);ce!==null&&(de.preventDefault(),de.stopPropagation(),de.stopImmediatePropagation(),q.setAnchorCellForSelection(ce))}},0)}),H.addEventListener("mousemove",de=>{if(J&&(de.preventDefault(),de.stopPropagation(),de.stopImmediatePropagation()),G){let ce=y(de.target);if(ce!==null){let ye=ce.x,Le=ce.y;G&&(q.anchorX!==ye||q.anchorY!==Le||q.isHighlightingCells)&&(de.preventDefault(),q.setFocusCellForSelection(ce))}}}),H.addEventListener("mouseleave",()=>{});let X=de=>{de.button===0&&V.update(()=>{var ce=e.$getSelection();const ye=de.target;if(ye instanceof Node){if(e.DEPRECATED_$isGridSelection(ce)&&ce.gridKey===q.tableNodeKey&&te.contains(ye))return q.clearHighlight();ce=e.$getNearestNodeFromDOMNode(ye),ce!==null&&t.$findMatchingParent(ce,e.DEPRECATED_$isGridNode)&&(G=!0)}})};window.addEventListener("mousedown",X),q.listenersToRemove.add(()=>window.removeEventListener("mousedown",X));let ae=de=>{var ce;(ce=G)&&(ce=de.target,ce=ce!==null&&ce.nodeName==="SPAN",ce=!ce),ce&&(de.preventDefault(),de.stopPropagation()),G=!1};window.addEventListener("mouseup",ae),q.listenersToRemove.add(()=>window.removeEventListener("mouseup",ae)),H.addEventListener("mouseup",ae),q.listenersToRemove.add(()=>H.removeEventListener("mouseup",ae)),q.listenersToRemove.add(V.registerCommand(e.KEY_ARROW_DOWN_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,D))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ye=t.$findMatchingParent(ce.anchor.getNode(),ne=>d(ne));if(!d(ye))return!1;var Le=D.getCordsFromCellNode(ye,q.grid);if(ce=t.$findMatchingParent(ce.anchor.getNode(),ne=>e.$isElementNode(ne)),ce==null)throw Error("Expected BlockNode Parent");if((ye=ye.getLastChild())&&ce.isParentOf(ye)||ce===ye||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(q.setAnchorCellForSelection(D.getCellFromCordsOrThrow(Le.x,Le.y,q.grid)),I(q,D,Le.x,Le.y,"down")):E(q,D,Le.x,Le.y,"down")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return Le=ce.focus.getNode(),d(Le)?(Le=D.getCordsFromCellNode(Le,q.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(q,D,Le.x,Le.y,"down")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),q.listenersToRemove.add(V.registerCommand(e.KEY_ARROW_UP_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,D))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ye=t.$findMatchingParent(ce.anchor.getNode(),ne=>d(ne));if(!d(ye))return!1;var Le=D.getCordsFromCellNode(ye,q.grid);if(ce=t.$findMatchingParent(ce.anchor.getNode(),ne=>e.$isElementNode(ne)),ce==null)throw Error("Expected BlockNode Parent");if((ye=ye.getLastChild())&&ce.isParentOf(ye)||ce===ye||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(q.setAnchorCellForSelection(D.getCellFromCordsOrThrow(Le.x,Le.y,q.grid)),I(q,D,Le.x,Le.y,"up")):E(q,D,Le.x,Le.y,"up")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return Le=ce.focus.getNode(),d(Le)?(Le=D.getCordsFromCellNode(Le,q.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(q,D,Le.x,Le.y,"up")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),q.listenersToRemove.add(V.registerCommand(e.KEY_ARROW_LEFT_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,D))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ye=t.$findMatchingParent(ce.anchor.getNode(),Le=>d(Le));if(!d(ye))return!1;if(ye=D.getCordsFromCellNode(ye,q.grid),t.$findMatchingParent(ce.anchor.getNode(),Le=>e.$isElementNode(Le))==null)throw Error("Expected BlockNode Parent");if(ce.anchor.offset===0||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(q.setAnchorCellForSelection(D.getCellFromCordsOrThrow(ye.x,ye.y,q.grid)),I(q,D,ye.x,ye.y,"backward")):E(q,D,ye.x,ye.y,"backward")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return ce=ce.focus.getNode(),d(ce)?(ce=D.getCordsFromCellNode(ce,q.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(q,D,ce.x,ce.y,"backward")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),q.listenersToRemove.add(V.registerCommand(e.KEY_ARROW_RIGHT_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,D))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ye=t.$findMatchingParent(ce.anchor.getNode(),Le=>d(Le));if(!d(ye))return!1;if(ye=D.getCordsFromCellNode(ye,q.grid),t.$findMatchingParent(ce.anchor.getNode(),Le=>e.$isElementNode(Le))==null)throw Error("Expected BlockNode Parent");if(ce.anchor.offset===ce.anchor.getNode().getTextContentSize()||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(q.setAnchorCellForSelection(D.getCellFromCordsOrThrow(ye.x,ye.y,q.grid)),I(q,D,ye.x,ye.y,"forward")):E(q,D,ye.x,ye.y,"forward")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return ce=ce.focus.getNode(),d(ce)?(ce=D.getCordsFromCellNode(ce,q.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(q,D,ce.x,ce.y,"forward")):!1;return!1},e.COMMAND_PRIORITY_HIGH));let xe=de=>()=>{var ce=e.$getSelection();if(!L(ce,D))return!1;if(e.DEPRECATED_$isGridSelection(ce))return q.clearText(),!0;if(e.$isRangeSelection(ce)){const ne=t.$findMatchingParent(ce.anchor.getNode(),se=>d(se));if(!d(ne))return!1;var ye=ce.anchor.getNode(),Le=ce.focus.getNode();if(ye=D.isParentOf(ye),Le=D.isParentOf(Le),ye&&!Le||Le&&!ye)return q.clearText(),!0;if(ye=(Le=t.$findMatchingParent(ce.anchor.getNode(),se=>e.$isElementNode(se)))&&t.$findMatchingParent(Le,se=>e.$isElementNode(se)&&d(se.getParent())),!e.$isElementNode(ye)||!e.$isElementNode(Le))return!1;if(de===e.DELETE_LINE_COMMAND&&ye.getPreviousSibling()===null)return!0;if((de===e.DELETE_CHARACTER_COMMAND||de===e.DELETE_WORD_COMMAND)&&ce.isCollapsed()&&ce.anchor.offset===0&&Le!==ye){ce=Le.getChildren();const se=e.$createParagraphNode();return ce.forEach(me=>se.append(me)),Le.replace(se),Le.getWritable().__parent=ne.getKey(),!0}}return!1};[e.DELETE_WORD_COMMAND,e.DELETE_LINE_COMMAND,e.DELETE_CHARACTER_COMMAND].forEach(de=>{q.listenersToRemove.add(V.registerCommand(de,xe(de),e.COMMAND_PRIORITY_CRITICAL))});let pe=de=>{const ce=e.$getSelection();return L(ce,D)?e.DEPRECATED_$isGridSelection(ce)?(de.preventDefault(),de.stopPropagation(),q.clearText(),!0):(e.$isRangeSelection(ce)&&(de=t.$findMatchingParent(ce.anchor.getNode(),ye=>d(ye)),d(de)),!1):!1};return q.listenersToRemove.add(V.registerCommand(e.KEY_BACKSPACE_COMMAND,pe,e.COMMAND_PRIORITY_CRITICAL)),q.listenersToRemove.add(V.registerCommand(e.KEY_DELETE_COMMAND,pe,e.COMMAND_PRIORITY_CRITICAL)),q.listenersToRemove.add(V.registerCommand(e.FORMAT_TEXT_COMMAND,de=>{let ce=e.$getSelection();return L(ce,D)?e.DEPRECATED_$isGridSelection(ce)?(q.formatCells(de),!0):(e.$isRangeSelection(ce)&&(de=t.$findMatchingParent(ce.anchor.getNode(),ye=>d(ye)),d(de)),!1):!1},e.COMMAND_PRIORITY_CRITICAL)),q.listenersToRemove.add(V.registerCommand(e.CONTROLLED_TEXT_INSERTION_COMMAND,()=>{var de=e.$getSelection();return L(de,D)&&(e.DEPRECATED_$isGridSelection(de)?q.clearHighlight():e.$isRangeSelection(de)&&(de=t.$findMatchingParent(de.anchor.getNode(),ce=>d(ce)),d(de))),!1},e.COMMAND_PRIORITY_CRITICAL)),q.listenersToRemove.add(V.registerCommand(e.KEY_TAB_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,D))return!1;if(e.$isRangeSelection(ce)){let ye=t.$findMatchingParent(ce.anchor.getNode(),Le=>d(Le));if(!d(ye))return!1;if(ce.isCollapsed())return ce=D.getCordsFromCellNode(ye,q.grid),de.preventDefault(),E(q,D,ce.x,ce.y,de.shiftKey?"backward":"forward"),!0}return!1},e.COMMAND_PRIORITY_HIGH)),q.listenersToRemove.add(V.registerCommand(e.FOCUS_COMMAND,()=>D.isSelected(),e.COMMAND_PRIORITY_HIGH)),q.listenersToRemove.add(V.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>{let de=e.$getSelection();var ce=e.$getPreviousSelection();if(de&&e.$isRangeSelection(de)&&!de.isCollapsed()){var ye=de.anchor.getNode(),Le=de.focus.getNode();ye=D.isParentOf(ye);var ne=D.isParentOf(Le);if(Le=ye&&!ne||ne&&!ye,ye=ye&&ne&&!D.isSelected(),Le)return ce=de.isBackward(),ye=e.$createRangeSelection(),Le=D.getKey(),ye.anchor.set(de.anchor.key,de.anchor.offset,de.anchor.type),ye.focus.set(Le,ce?0:D.getChildrenSize(),"element"),J=!0,e.$setSelection(ye),$(q),!0;if(ye&&({grid:ye}=q,de.getNodes().filter(d).length===ye.rows*ye.columns)){ye=e.DEPRECATED_$createGridSelection(),Le=D.getKey(),ne=D.getFirstChildOrThrow().getFirstChild();let se=D.getLastChildOrThrow().getLastChild();if(ne!=null&&se!=null)return ye.set(Le,ne.getKey(),se.getKey()),e.$setSelection(ye),q.updateTableGridSelection(ye),!0}}return de&&!de.is(ce)&&(e.DEPRECATED_$isGridSelection(de)||e.DEPRECATED_$isGridSelection(ce))&&q.gridSelection&&!q.gridSelection.is(ce)?(e.DEPRECATED_$isGridSelection(de)&&de.gridKey===q.tableNodeKey?q.updateTableGridSelection(de):!e.DEPRECATED_$isGridSelection(de)&&e.DEPRECATED_$isGridSelection(ce)&&ce.gridKey===q.tableNodeKey&&q.updateTableGridSelection(null),!1):(q.hasHijackedSelectionStyles&&!D.isSelected()?(A(q),J=!1):!q.hasHijackedSelectionStyles&&D.isSelected()&&$(q),!1)},e.COMMAND_PRIORITY_CRITICAL)),q},_r.getCellFromTarget=y,_r.getTableSelectionFromTableElement=function(D){return D.__lexicalTableSelection},_r}var C_,xle;function Jyt(){return xle||(xle=1,C_=Zyt()),C_}var $_=Jyt(),Gw={},yle;function Xyt(){if(yle)return Gw;yle=1;var e=hA(),t=cd(),o=Pl(),i=Un(),a=Ml();function s(f,x){for(let y=0;y<x.length;y++){let w=x[y](f);if(w)return w}return null}let d=/[.,;\s]/;function c(f){f=f.getPreviousSibling(),i.$isElementNode(f)&&(f=f.getLastDescendant());var x;return!(x=f===null||i.$isLineBreakNode(f))&&(x=i.$isTextNode(f))&&(f=f.getTextContent(),x=d.test(f[f.length-1])),x}function u(f){return f=f.getNextSibling(),i.$isElementNode(f)&&(f=f.getFirstDescendant()),f===null||i.$isLineBreakNode(f)||i.$isTextNode(f)&&d.test(f.getTextContent()[0])}function p(f,x,y){var w=f.getChildren();let b=w.length;for(let C=0;C<b;C++){let $=w[C];if(!i.$isTextNode($)||!$.isSimpleText()){h(f),y(null,f.getURL());return}}w=f.getTextContent(),x=s(w,x),x===null||x.text!==w?(h(f),y(null,f.getURL())):c(f)&&u(f)?(w=f.getURL(),w!==x.url&&(f.setURL(x.url),y(x.url,w)),x.attributes&&(w=f.getRel(),w!==x.attributes.rel&&(f.setRel(x.attributes.rel||null),y(x.attributes.rel||null,w)),w=f.getTarget(),w!==x.attributes.target&&(f.setTarget(x.attributes.target||null),y(x.attributes.target||null,w)))):(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(w=>w.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 w=(b,C)=>{y&&y(b,C)};return o.mergeRegister(f.registerNodeTransform(i.TextNode,b=>{var C=b.getParentOrThrow(),$=b.getPreviousSibling();if(e.$isAutoLinkNode(C))p(C,x,w);else if(!e.$isLinkNode(C)){if(b.isSimpleText()&&(d.test(b.getTextContent()[0])||!e.$isAutoLinkNode($))){$=C=b.getTextContent();let B=0,_=b;for(var A;(A=s($,x))&&A!==null;){let R=A.index,z=A.length,Y=R+z;var E=B+R,I=B+Y,L=C,T=b;if((0<E?d.test(L[E-1]):c(T))&&(I<L.length?d.test(L[I]):u(T))){var P=void 0;B+R===0?[P,_]=_.splitText(B+z):[,P,_]=_.splitText(B+R,B+R+z),E=e.$createAutoLinkNode(A.url,A.attributes),I=i.$createTextNode(A.text),I.setFormat(P.getFormat()),I.setDetail(P.getDetail()),E.append(I),P.replace(E),y&&y(A.url,null),B=0}else B+=Y;$=$.substring(Y)}}C=b.getPreviousSibling(),A=b.getNextSibling(),P=b.getTextContent(),e.$isAutoLinkNode(C)&&!d.test(P[0])&&(C.append(b),p(C,x,w),b=C.getURL(),y&&y(null,b)),e.$isAutoLinkNode(A)&&!d.test(P[P.length-1])&&(h(A),p(A,x,w),b=A.getURL(),y&&y(null,b))}}))},[f,x,y])}return Gw.AutoLinkPlugin=function({matchers:f,onChange:x}){let[y]=t.useLexicalComposerContext();return m(y,f,x),null},Gw.createLinkMatcherWithRegExp=function(f,x=y=>y){return y=>{let w=f.exec(y);return w===null?null:{index:w.index,length:w[0].length,text:w[0],url:x(y)}}},Gw}var k_,wle;function ewt(){return wle||(wle=1,k_=Xyt()),k_}var twt=ewt(),L9={};L9.d=(e,t)=>{for(var o in t)L9.o(t,o)&&!L9.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})};L9.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var _o=globalThis.pdfjsLib={};L9.d(_o,{AbortException:()=>O3,AnnotationEditorLayer:()=>Xp,AnnotationEditorParamsType:()=>Uo,AnnotationEditorType:()=>jr,AnnotationEditorUIManager:()=>A2,AnnotationLayer:()=>Xbt,AnnotationMode:()=>N0,CMapCompressionType:()=>GO,ColorPicker:()=>vu,DOMSVGFactory:()=>gW,DrawLayer:()=>ds,FeatureTest:()=>gl,GlobalWorkerOptions:()=>ox,ImageKind:()=>mC,InvalidPDFException:()=>Zve,MissingPDFException:()=>F3,OPS:()=>zc,Outliner:()=>tN,PDFDataRangeTransport:()=>mCe,PDFDateString:()=>rCe,PDFWorker:()=>Pd,PasswordResponses:()=>nwt,PermissionFlag:()=>iwt,PixelsPerInch:()=>K5,RenderingCancelledException:()=>fW,TextLayer:()=>D$,UnexpectedResponseException:()=>xA,Util:()=>mo,VerbosityLevel:()=>mA,XfaLayer:()=>fCe,build:()=>Pbt,createValidAbsoluteUrl:()=>dwt,fetchData:()=>$A,getDocument:()=>kbt,getFilenameFromUrl:()=>wwt,getPdfFilenameFromUrl:()=>bwt,getXfaPageViewport:()=>vwt,isDataScheme:()=>xW,isPdfFile:()=>yW,noContextMenu:()=>Cl,normalizeUnicode:()=>gwt,renderTextLayer:()=>gbt,setLayerDimensions:()=>y3,shadow:()=>zr,updateTextLayer:()=>fbt,version:()=>Tbt});const gs=typeof eh=="object"&&eh+""=="[object process]"&&!eh.versions.nw&&!(eh.versions.electron&&eh.type&&eh.type!=="browser"),qve=[1,0,0,1,0,0],QO=[.001,0,0,.001,0,0],owt=1e7,S_=1.35,jd={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},N0={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},rwt="pdfjs_internal_editor_",jr={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Uo={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},iwt={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ls={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},mC={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Xn={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},Y6={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},mA={ERRORS:0,WARNINGS:1,INFOS:5},GO={NONE:0,BINARY:1},zc={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},nwt={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let gA=mA.WARNINGS;function awt(e){Number.isInteger(e)&&(gA=e)}function swt(){return gA}function fA(e){gA>=mA.INFOS&&console.log(`Info: ${e}`)}function hr(e){gA>=mA.WARNINGS&&console.log(`Warning: ${e}`)}function mi(e){throw new Error(e)}function ra(e,t){e||mi(t)}function lwt(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function dwt(e,t=null,o=null){if(!e)return null;try{if(o&&typeof e=="string"&&(o.addDefaultProtocol&&e.startsWith("www.")&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),o.tryConvertEncoding))try{e=mwt(e)}catch{}const i=t?new URL(e,t):new URL(e);if(lwt(i))return i}catch{}return null}function zr(e,t,o,i=!1){return Object.defineProperty(e,t,{value:o,enumerable:!i,configurable:!0,writable:!1}),o}const O2=function(){function t(o,i){this.constructor===t&&mi("Cannot initialize BaseException."),this.message=o,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class YO extends O2{constructor(t,o){super(t,"PasswordException"),this.code=o}}class KO extends O2{constructor(t,o){super(t,"UnknownErrorException"),this.details=o}}class Zve extends O2{constructor(t){super(t,"InvalidPDFException")}}class F3 extends O2{constructor(t){super(t,"MissingPDFException")}}class xA extends O2{constructor(t,o){super(t,"UnexpectedResponseException"),this.status=o}}class cwt extends O2{constructor(t){super(t,"FormatError")}}class O3 extends O2{constructor(t){super(t,"AbortException")}}function Jve(e){(typeof e!="object"||e?.length===void 0)&&mi("Invalid argument for bytesToString");const t=e.length,o=8192;if(t<o)return String.fromCharCode.apply(null,e);const i=[];for(let a=0;a<t;a+=o){const s=Math.min(a+o,t),d=e.subarray(a,s);i.push(String.fromCharCode.apply(null,d))}return i.join("")}function yA(e){typeof e!="string"&&mi("Invalid argument for stringToBytes");const t=e.length,o=new Uint8Array(t);for(let i=0;i<t;++i)o[i]=e.charCodeAt(i)&255;return o}function uwt(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function hW(e){const t=Object.create(null);for(const[o,i]of e)t[o]=i;return t}function pwt(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function hwt(){try{return new Function(""),!0}catch{return!1}}class gl{static get isLittleEndian(){return zr(this,"isLittleEndian",pwt())}static get isEvalSupported(){return zr(this,"isEvalSupported",hwt())}static get isOffscreenCanvasSupported(){return zr(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?zr(this,"platform",{isMac:navigator.platform.includes("Mac")}):zr(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return zr(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const A_=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class mo{static makeHexColor(t,o,i){return`#${A_[t]}${A_[o]}${A_[i]}`}static scaleMinMax(t,o){let i;t[0]?(t[0]<0&&(i=o[0],o[0]=o[2],o[2]=i),o[0]*=t[0],o[2]*=t[0],t[3]<0&&(i=o[1],o[1]=o[3],o[3]=i),o[1]*=t[3],o[3]*=t[3]):(i=o[0],o[0]=o[1],o[1]=i,i=o[2],o[2]=o[3],o[3]=i,t[1]<0&&(i=o[1],o[1]=o[3],o[3]=i),o[1]*=t[1],o[3]*=t[1],t[2]<0&&(i=o[0],o[0]=o[2],o[2]=i),o[0]*=t[2],o[2]*=t[2]),o[0]+=t[4],o[1]+=t[5],o[2]+=t[4],o[3]+=t[5]}static transform(t,o){return[t[0]*o[0]+t[2]*o[1],t[1]*o[0]+t[3]*o[1],t[0]*o[2]+t[2]*o[3],t[1]*o[2]+t[3]*o[3],t[0]*o[4]+t[2]*o[5]+t[4],t[1]*o[4]+t[3]*o[5]+t[5]]}static applyTransform(t,o){const i=t[0]*o[0]+t[1]*o[2]+o[4],a=t[0]*o[1]+t[1]*o[3]+o[5];return[i,a]}static applyInverseTransform(t,o){const i=o[0]*o[3]-o[1]*o[2],a=(t[0]*o[3]-t[1]*o[2]+o[2]*o[5]-o[4]*o[3])/i,s=(-t[0]*o[1]+t[1]*o[0]+o[4]*o[1]-o[5]*o[0])/i;return[a,s]}static getAxialAlignedBoundingBox(t,o){const i=this.applyTransform(t,o),a=this.applyTransform(t.slice(2,4),o),s=this.applyTransform([t[0],t[3]],o),d=this.applyTransform([t[2],t[1]],o);return[Math.min(i[0],a[0],s[0],d[0]),Math.min(i[1],a[1],s[1],d[1]),Math.max(i[0],a[0],s[0],d[0]),Math.max(i[1],a[1],s[1],d[1])]}static inverseTransform(t){const o=t[0]*t[3]-t[1]*t[2];return[t[3]/o,-t[1]/o,-t[2]/o,t[0]/o,(t[2]*t[5]-t[4]*t[3])/o,(t[4]*t[1]-t[5]*t[0])/o]}static singularValueDecompose2dScale(t){const o=[t[0],t[2],t[1],t[3]],i=t[0]*o[0]+t[1]*o[2],a=t[0]*o[1]+t[1]*o[3],s=t[2]*o[0]+t[3]*o[2],d=t[2]*o[1]+t[3]*o[3],c=(i+d)/2,u=Math.sqrt((i+d)**2-4*(i*d-s*a))/2,p=c+u||1,h=c-u||1;return[Math.sqrt(p),Math.sqrt(h)]}static normalizeRect(t){const o=t.slice(0);return t[0]>t[2]&&(o[0]=t[2],o[2]=t[0]),t[1]>t[3]&&(o[1]=t[3],o[3]=t[1]),o}static intersect(t,o){const i=Math.max(Math.min(t[0],t[2]),Math.min(o[0],o[2])),a=Math.min(Math.max(t[0],t[2]),Math.max(o[0],o[2]));if(i>a)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(o[1],o[3])),d=Math.min(Math.max(t[1],t[3]),Math.max(o[1],o[3]));return s>d?null:[i,s,a,d]}static#e(t,o,i,a,s,d,c,u,p,h){if(p<=0||p>=1)return;const m=1-p,f=p*p,x=f*p,y=m*(m*(m*t+3*p*o)+3*f*i)+x*a,w=m*(m*(m*s+3*p*d)+3*f*c)+x*u;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],w),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],w)}static#t(t,o,i,a,s,d,c,u,p,h,m,f){if(Math.abs(p)<1e-12){Math.abs(h)>=1e-12&&this.#e(t,o,i,a,s,d,c,u,-m/h,f);return}const x=h**2-4*m*p;if(x<0)return;const y=Math.sqrt(x),w=2*p;this.#e(t,o,i,a,s,d,c,u,(-h+y)/w,f),this.#e(t,o,i,a,s,d,c,u,(-h-y)/w,f)}static bezierBoundingBox(t,o,i,a,s,d,c,u,p){return p?(p[0]=Math.min(p[0],t,c),p[1]=Math.min(p[1],o,u),p[2]=Math.max(p[2],t,c),p[3]=Math.max(p[3],o,u)):p=[Math.min(t,c),Math.min(o,u),Math.max(t,c),Math.max(o,u)],this.#t(t,i,s,c,o,a,d,u,3*(-t+3*(i-s)+c),6*(t-2*i+s),3*(i-t),p),this.#t(t,i,s,c,o,a,d,u,3*(-o+3*(a-d)+u),6*(o-2*a+d),3*(a-o),p),p}}function mwt(e){return decodeURIComponent(escape(e))}let E_=null,ble=null;function gwt(e){return E_||(E_=/([\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,ble=new Map([["ſt","ſt"]])),e.replaceAll(E_,(t,o,i)=>o?o.normalize("NFKC"):ble.get(i))}function fwt(){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 Jve(e)}const Xve="pdfjs_internal_id_",Up={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 wA{constructor(){this.constructor===wA&&mi("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,o){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,o,i,a,s){return"none"}destroy(t=!1){}}class bA{#e=!1;constructor({enableHWA:t=!1}={}){this.constructor===bA&&mi("Cannot initialize BaseCanvasFactory."),this.#e=t}create(t,o){if(t<=0||o<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,o);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#e})}}reset(t,o,i){if(!t.canvas)throw new Error("Canvas is not specified");if(o<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=o,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,o){mi("Abstract method `_createCanvas` called.")}}class vA{constructor({baseUrl:t=null,isCompressed:o=!0}){this.constructor===vA&&mi("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=o}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 o=this.baseUrl+t+(this.isCompressed?".bcmap":""),i=this.isCompressed?GO.BINARY:GO.NONE;return this._fetchData(o,i).catch(a=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${o}`)})}_fetchData(t,o){mi("Abstract method `_fetchData` called.")}}class CA{constructor({baseUrl:t=null}){this.constructor===CA&&mi("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 o=`${this.baseUrl}${t}`;return this._fetchData(o).catch(i=>{throw new Error(`Unable to load font data at: ${o}`)})}_fetchData(t){mi("Abstract method `_fetchData` called.")}}class mW{constructor(){this.constructor===mW&&mi("Cannot initialize BaseSVGFactory.")}create(t,o,i=!1){if(t<=0||o<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");return a.setAttribute("version","1.1"),i||(a.setAttribute("width",`${t}px`),a.setAttribute("height",`${o}px`)),a.setAttribute("preserveAspectRatio","none"),a.setAttribute("viewBox",`0 0 ${t} ${o}`),a}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){mi("Abstract method `_createSVG` called.")}}const Kp="http://www.w3.org/2000/svg";class K5{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class xwt extends wA{#e;#t;#o;#i;#s;#r=0;constructor({docId:t,ownerDocument:o=globalThis.document}={}){super(),this.#o=t,this.#i=o}get#n(){return this.#e||=new Map}get#l(){return this.#s||=new Map}get#c(){if(!this.#t){const t=this.#i.createElement("div"),{style:o}=t;o.visibility="hidden",o.contain="strict",o.width=o.height=0,o.position="absolute",o.top=o.left=0,o.zIndex=-1;const i=this.#i.createElementNS(Kp,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#t=this.#i.createElementNS(Kp,"defs"),t.append(i),i.append(this.#t),this.#i.body.append(t)}return this.#t}#u(t){if(t.length===1){const u=t[0],p=new Array(256);for(let m=0;m<256;m++)p[m]=u[m]/255;const h=p.join(",");return[h,h,h]}const[o,i,a]=t,s=new Array(256),d=new Array(256),c=new Array(256);for(let u=0;u<256;u++)s[u]=o[u]/255,d[u]=i[u]/255,c[u]=a[u]/255;return[s.join(","),d.join(","),c.join(",")]}addFilter(t){if(!t)return"none";let o=this.#n.get(t);if(o)return o;const[i,a,s]=this.#u(t),d=t.length===1?i:`${i}${a}${s}`;if(o=this.#n.get(d),o)return this.#n.set(t,o),o;const c=`g_${this.#o}_transfer_map_${this.#r++}`,u=`url(#${c})`;this.#n.set(t,u),this.#n.set(d,u);const p=this.#a(c);return this.#f(i,a,s,p),u}addHCMFilter(t,o){const i=`${t}-${o}`,a="base";let s=this.#l.get(a);if(s?.key===i||(s?(s.filter?.remove(),s.key=i,s.url="none",s.filter=null):(s={key:i,url:"none",filter:null},this.#l.set(a,s)),!t||!o))return s.url;const d=this.#y(t);t=mo.makeHexColor(...d);const c=this.#y(o);if(o=mo.makeHexColor(...c),this.#c.style.color="",t==="#000000"&&o==="#ffffff"||t===o)return s.url;const u=new Array(256);for(let x=0;x<=255;x++){const y=x/255;u[x]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}const p=u.join(","),h=`g_${this.#o}_hcm_filter`,m=s.filter=this.#a(h);this.#f(p,p,p,m),this.#d(m);const f=(x,y)=>{const w=d[x]/255,b=c[x]/255,C=new Array(y+1);for(let $=0;$<=y;$++)C[$]=w+$/y*(b-w);return C.join(",")};return this.#f(f(0,5),f(1,5),f(2,5),m),s.url=`url(#${h})`,s.url}addAlphaFilter(t){let o=this.#n.get(t);if(o)return o;const[i]=this.#u([t]),a=`alpha_${i}`;if(o=this.#n.get(a),o)return this.#n.set(t,o),o;const s=`g_${this.#o}_alpha_map_${this.#r++}`,d=`url(#${s})`;this.#n.set(t,d),this.#n.set(a,d);const c=this.#a(s);return this.#p(i,c),d}addLuminosityFilter(t){let o=this.#n.get(t||"luminosity");if(o)return o;let i,a;if(t?([i]=this.#u([t]),a=`luminosity_${i}`):a="luminosity",o=this.#n.get(a),o)return this.#n.set(t,o),o;const s=`g_${this.#o}_luminosity_map_${this.#r++}`,d=`url(#${s})`;this.#n.set(t,d),this.#n.set(a,d);const c=this.#a(s);return this.#h(c),t&&this.#p(i,c),d}addHighlightHCMFilter(t,o,i,a,s){const d=`${o}-${i}-${a}-${s}`;let c=this.#l.get(t);if(c?.key===d||(c?(c.filter?.remove(),c.key=d,c.url="none",c.filter=null):(c={key:d,url:"none",filter:null},this.#l.set(t,c)),!o||!i))return c.url;const[u,p]=[o,i].map(this.#y.bind(this));let h=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),m=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),[f,x]=[a,s].map(this.#y.bind(this));m<h&&([h,m,f,x]=[m,h,x,f]),this.#c.style.color="";const y=(C,$,A)=>{const E=new Array(256),I=(m-h)/A,L=C/255,T=($-C)/(255*A);let P=0;for(let B=0;B<=A;B++){const _=Math.round(h+B*I),R=L+B*T;for(let z=P;z<=_;z++)E[z]=R;P=_+1}for(let B=P;B<256;B++)E[B]=E[P-1];return E.join(",")},w=`g_${this.#o}_hcm_${t}_filter`,b=c.filter=this.#a(w);return this.#d(b),this.#f(y(f[0],x[0],5),y(f[1],x[1],5),y(f[2],x[2],5),b),c.url=`url(#${w})`,c.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 o=this.#i.createElementNS(Kp,"feColorMatrix");o.setAttribute("type","matrix"),o.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(o)}#d(t){const o=this.#i.createElementNS(Kp,"feColorMatrix");o.setAttribute("type","matrix"),o.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(o)}#a(t){const o=this.#i.createElementNS(Kp,"filter");return o.setAttribute("color-interpolation-filters","sRGB"),o.setAttribute("id",t),this.#c.append(o),o}#m(t,o,i){const a=this.#i.createElementNS(Kp,o);a.setAttribute("type","discrete"),a.setAttribute("tableValues",i),t.append(a)}#f(t,o,i,a){const s=this.#i.createElementNS(Kp,"feComponentTransfer");a.append(s),this.#m(s,"feFuncR",t),this.#m(s,"feFuncG",o),this.#m(s,"feFuncB",i)}#p(t,o){const i=this.#i.createElementNS(Kp,"feComponentTransfer");o.append(i),this.#m(i,"feFuncA",t)}#y(t){return this.#c.style.color=t,wW(getComputedStyle(this.#c).getPropertyValue("color"))}}class ywt extends bA{constructor({ownerDocument:t=globalThis.document,enableHWA:o=!1}={}){super({enableHWA:o}),this._document=t}_createCanvas(t,o){const i=this._document.createElement("canvas");return i.width=t,i.height=o,i}}async function $A(e,t="text"){if(Y8(e,document.baseURI)){const o=await fetch(e);if(!o.ok)throw new Error(o.statusText);switch(t){case"arraybuffer":return o.arrayBuffer();case"blob":return o.blob();case"json":return o.json()}return o.text()}return new Promise((o,i)=>{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":o(a.response);return}o(a.responseText);return}i(new Error(a.statusText))}},a.send(null)})}class eCe extends vA{_fetchData(t,o){return $A(t,this.isCompressed?"arraybuffer":"text").then(i=>({cMapData:i instanceof ArrayBuffer?new Uint8Array(i):yA(i),compressionType:o}))}}class tCe extends CA{_fetchData(t){return $A(t,"arraybuffer").then(o=>new Uint8Array(o))}}class gW extends mW{_createSVG(t){return document.createElementNS(Kp,t)}}class Jx{constructor({viewBox:t,scale:o,rotation:i,offsetX:a=0,offsetY:s=0,dontFlip:d=!1}){this.viewBox=t,this.scale=o,this.rotation=i,this.offsetX=a,this.offsetY=s;const c=(t[2]+t[0])/2,u=(t[3]+t[1])/2;let p,h,m,f;switch(i%=360,i<0&&(i+=360),i){case 180:p=-1,h=0,m=0,f=1;break;case 90:p=0,h=1,m=1,f=0;break;case 270:p=0,h=-1,m=-1,f=0;break;case 0:p=1,h=0,m=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}d&&(m=-m,f=-f);let x,y,w,b;p===0?(x=Math.abs(u-t[1])*o+a,y=Math.abs(c-t[0])*o+s,w=(t[3]-t[1])*o,b=(t[2]-t[0])*o):(x=Math.abs(c-t[0])*o+a,y=Math.abs(u-t[1])*o+s,w=(t[2]-t[0])*o,b=(t[3]-t[1])*o),this.transform=[p*o,h*o,m*o,f*o,x-p*o*c-m*o*u,y-h*o*c-f*o*u],this.width=w,this.height=b}get rawDims(){const{viewBox:t}=this;return zr(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:o=this.rotation,offsetX:i=this.offsetX,offsetY:a=this.offsetY,dontFlip:s=!1}={}){return new Jx({viewBox:this.viewBox.slice(),scale:t,rotation:o,offsetX:i,offsetY:a,dontFlip:s})}convertToViewportPoint(t,o){return mo.applyTransform([t,o],this.transform)}convertToViewportRectangle(t){const o=mo.applyTransform([t[0],t[1]],this.transform),i=mo.applyTransform([t[2],t[3]],this.transform);return[o[0],o[1],i[0],i[1]]}convertToPdfPoint(t,o){return mo.applyInverseTransform([t,o],this.transform)}}class fW extends O2{constructor(t,o=0){super(t,"RenderingCancelledException"),this.extraDelay=o}}function xW(e){const t=e.length;let o=0;for(;o<t&&e[o].trim()==="";)o++;return e.substring(o,o+5).toLowerCase()==="data:"}function yW(e){return typeof e=="string"&&/\.pdf$/i.test(e)}function wwt(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function bwt(e,t="document.pdf"){if(typeof e!="string")return t;if(xW(e))return hr('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const o=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,a=o.exec(e);let s=i.exec(a[1])||i.exec(a[2])||i.exec(a[3]);if(s&&(s=s[0],s.includes("%")))try{s=i.exec(decodeURIComponent(s))[0]}catch{}return s||t}class vle{started=Object.create(null);times=[];time(t){t in this.started&&hr(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||hr(`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 o=0;for(const{name:i}of this.times)o=Math.max(i.length,o);for(const{name:i,start:a,end:s}of this.times)t.push(`${i.padEnd(o)} ${s-a}ms
232
- `);return t.join("")}}function Y8(e,t){try{const{protocol:o}=t?new URL(e,t):new URL(e);return o==="http:"||o==="https:"}catch{return!1}}function Cl(e){e.preventDefault()}function oCe(e){console.log("Deprecated API usage: "+e)}let Cle;class rCe{static toDateObject(t){if(!t||typeof t!="string")return null;Cle||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const o=Cle.exec(t);if(!o)return null;const i=parseInt(o[1],10);let a=parseInt(o[2],10);a=a>=1&&a<=12?a-1:0;let s=parseInt(o[3],10);s=s>=1&&s<=31?s:1;let d=parseInt(o[4],10);d=d>=0&&d<=23?d:0;let c=parseInt(o[5],10);c=c>=0&&c<=59?c:0;let u=parseInt(o[6],10);u=u>=0&&u<=59?u:0;const p=o[7]||"Z";let h=parseInt(o[8],10);h=h>=0&&h<=23?h:0;let m=parseInt(o[9],10)||0;return m=m>=0&&m<=59?m:0,p==="-"?(d+=h,c+=m):p==="+"&&(d-=h,c-=m),new Date(Date.UTC(i,a,s,d,c,u))}}function vwt(e,{scale:t=1,rotation:o=0}){const{width:i,height:a}=e.attributes.style,s=[0,0,parseInt(i),parseInt(a)];return new Jx({viewBox:s,scale:t,rotation:o})}function wW(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):(hr(`Not a valid color format: "${e}"`),[0,0,0])}function Cwt(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const o of e.keys()){t.style.color=o;const i=window.getComputedStyle(t).color;e.set(o,wW(i))}t.remove()}function Gi(e){const{a:t,b:o,c:i,d:a,e:s,f:d}=e.getTransform();return[t,o,i,a,s,d]}function Wp(e){const{a:t,b:o,c:i,d:a,e:s,f:d}=e.getTransform().invertSelf();return[t,o,i,a,s,d]}function y3(e,t,o=!1,i=!0){if(t instanceof Jx){const{pageWidth:a,pageHeight:s}=t.rawDims,{style:d}=e,c=gl.isCSSRoundSupported,u=`var(--scale-factor) * ${a}px`,p=`var(--scale-factor) * ${s}px`,h=c?`round(${u}, 1px)`:`calc(${u})`,m=c?`round(${p}, 1px)`:`calc(${p})`;!o||t.rotation%180===0?(d.width=h,d.height=m):(d.width=m,d.height=h)}i&&e.setAttribute("data-main-rotation",t.rotation)}class bW{#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 o=this.#o._uiManager._signal;t.addEventListener("contextmenu",Cl,{signal:o}),t.addEventListener("pointerdown",bW.#s,{signal:o});const i=this.#i=document.createElement("div");i.className="buttons",t.append(i);const a=this.#o.toolbarPosition;if(a){const{style:s}=t,d=this.#o._uiManager.direction==="ltr"?1-a[0]:a[0];s.insetInlineEnd=`${100*d}%`,s.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return this.#c(),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 o=this.#o._uiManager._signal;t.addEventListener("focusin",this.#r.bind(this),{capture:!0,signal:o}),t.addEventListener("focusout",this.#n.bind(this),{capture:!0,signal:o}),t.addEventListener("contextmenu",Cl,{signal:o})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden")}#c(){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",o=>{this.#o._uiManager.delete()},{signal:this.#o._uiManager._signal}),this.#i.append(t)}get#u(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#l(t),this.#i.prepend(t,this.#u)}addColorPicker(t){this.#t=t;const o=t.renderButton();this.#l(o),this.#i.prepend(o,this.#u)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class $wt{#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",Cl,{signal:this.#o._signal});const o=this.#e=document.createElement("div");return o.className="buttons",t.append(o),this.#r(),t}#s(t,o){let i=0,a=0;for(const s of t){const d=s.y+s.height;if(d<i)continue;const c=s.x+(o?s.width:0);if(d>i){a=c,i=d;continue}o?c>a&&(a=c):c<a&&(a=c)}return[o?1-a:a,i]}show(t,o,i){const[a,s]=this.#s(o,i),{style:d}=this.#t||=this.#i();t.append(this.#t),d.insetInlineEnd=`${100*a}%`,d.top=`calc(${100*s}% + 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 o=document.createElement("span");t.append(o),o.className="visuallyHidden",o.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=this.#o._signal;t.addEventListener("contextmenu",Cl,{signal:i}),t.addEventListener("click",()=>{this.#o.highlightSelection("floating_button")},{signal:i}),this.#e.append(t)}}function P$(e,t,o){for(const i of o)t.addEventListener(i,e[i].bind(e))}function kwt(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}class Swt{#e=0;get id(){return`${rwt}${this.#e++}`}}class vW{#e=fwt();#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>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=t;const s=a.decode().then(()=>(i.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return zr(this,"_isSVGFittingCanvas",s)}async#i(t,o){this.#o||=new Map;let i=this.#o.get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof o=="string"?(i.url=o,a=await $A(o,"blob")):a=i.file=o,a.type==="image/svg+xml"){const s=vW._isSVGFittingCanvas,d=new FileReader,c=new Image,u=new Promise((p,h)=>{c.onload=()=>{i.bitmap=c,i.isSvg=!0,p()},d.onload=async()=>{const m=i.svgUrl=d.result;c.src=await s?`${m}#svgView(preserveAspectRatio(none))`:m},c.onerror=d.onerror=h});d.readAsDataURL(a),await u}else i.bitmap=await createImageBitmap(a);i.refCounter=1}catch(a){console.error(a),i=null}return this.#o.set(t,i),i&&this.#o.set(i.id,i),i}async getFromFile(t){const{lastModified:o,name:i,size:a,type:s}=t;return this.#i(`${o}_${i}_${a}_${s}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromId(t){this.#o||=new Map;const o=this.#o.get(t);return o?o.bitmap?(o.refCounter+=1,o):o.file?this.getFromFile(o.file):this.getFromUrl(o.url):null}getSvgUrl(t){const o=this.#o.get(t);return o?.isSvg?o.svgUrl:null}deleteId(t){this.#o||=new Map;const o=this.#o.get(t);o&&(o.refCounter-=1,o.refCounter===0&&(o.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#e}_`)}}class Awt{#e=[];#t=!1;#o;#i=-1;constructor(t=128){this.#o=t}add({cmd:t,undo:o,post:i,mustExec:a,type:s=NaN,overwriteIfSameType:d=!1,keepUndo:c=!1}){if(a&&t(),this.#t)return;const u={cmd:t,undo:o,post:i,type:s};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(u);return}if(d&&this.#e[this.#i].type===s){c&&(u.undo=this.#e[this.#i].undo),this.#e[this.#i]=u;return}const p=this.#i+1;p===this.#o?this.#e.splice(0,1):(this.#i=p,p<this.#e.length&&this.#e.splice(p)),this.#e.push(u)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:t,post:o}=this.#e[this.#i];t(),o?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:t,post:o}=this.#e[this.#i];t(),o?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}destroy(){this.#e=null}}class Xx{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:o}=gl.platform;for(const[i,a,s={}]of t)for(const d of i){const c=d.startsWith("mac+");o&&c?(this.callbacks.set(d.slice(4),{callback:a,options:s}),this.allKeys.add(d.split("+").at(-1))):!o&&!c&&(this.callbacks.set(d,{callback:a,options:s}),this.allKeys.add(d.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 o=this.buffer.join("+");return this.buffer.length=0,o}exec(t,o){if(!this.allKeys.has(o.key))return;const i=this.callbacks.get(this.#e(o));if(!i)return;const{callback:a,options:{bubbles:s=!1,args:d=[],checker:c=null}}=i;c&&!c(t,o)||(a.bind(t,...d,o)(),s||(o.stopPropagation(),o.preventDefault()))}}class CW{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return Cwt(t),zr(this,"_colors",t)}convert(t){const o=wW(t);if(!window.matchMedia("(forced-colors: active)").matches)return o;for(const[i,a]of this._colors)if(a.every((s,d)=>s===o[d]))return CW._colorsMapping.get(i);return o}getHexCode(t){const o=this._colors.get(t);return o?mo.makeHexColor(...o):t}}class A2{#e=new AbortController;#t=null;#o=new Map;#i=new Map;#s=null;#r=null;#n=null;#l=new Awt;#c=0;#u=new Set;#h=null;#d=null;#a=new Set;#m=!1;#f=null;#p=null;#y=null;#g=!1;#w=null;#v=new Swt;#$=!1;#S=!1;#A=null;#I=null;#k=null;#b=jr.NONE;#x=new Set;#C=null;#E=null;#L=null;#T=this.blur.bind(this);#M=this.focus.bind(this);#D=this.copy.bind(this);#P=this.cut.bind(this);#_=this.paste.bind(this);#B=this.keydown.bind(this);#U=this.keyup.bind(this);#W=this.onEditingAction.bind(this);#H=this.onPageChanging.bind(this);#O=this.onScaleChanging.bind(this);#z=this.onRotationChanging.bind(this);#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#R=null;#N=null;#q=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=A2.prototype,o=d=>d.#N.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&d.hasSomethingToControl(),i=(d,{target:c})=>{if(c instanceof HTMLInputElement){const{type:u}=c;return u!=="text"&&u!=="number"}return!0},a=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return zr(this,"_keyboardManager",new Xx([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(d,{target:c})=>!(c instanceof HTMLButtonElement)&&d.#N.contains(c)&&!d.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(d,{target:c})=>!(c instanceof HTMLButtonElement)&&d.#N.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:o}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:o}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:o}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:o}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:o}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:o}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:o}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:o}]]))}constructor(t,o,i,a,s,d,c,u,p){this._signal=this.#e.signal,this.#N=t,this.#q=o,this.#s=i,this._eventBus=a,this._eventBus._on("editingaction",this.#W),this._eventBus._on("pagechanging",this.#H),this._eventBus._on("scalechanging",this.#O),this._eventBus._on("rotationchanging",this.#z),this.#ie(),this.#le(),this.#Z(),this.#r=s.annotationStorage,this.#f=s.filterFactory,this.#E=d,this.#y=c||null,this.#m=u,this.#k=p||null,this.viewParameters={realScale:K5.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#e?.abort(),this.#e=null,this._signal=null,this._eventBus._off("editingaction",this.#W),this._eventBus._off("pagechanging",this.#H),this._eventBus._off("scalechanging",this.#O),this._eventBus._off("rotationchanging",this.#z);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.#w?.hide(),this.#w=null,this.#p&&(clearTimeout(this.#p),this.#p=null),this.#R&&(clearTimeout(this.#R),this.#R=null)}async mlGuess(t){return this.#k?.guess(t)||null}get hasMLManager(){return!!this.#k}get hcmFilter(){return zr(this,"hcmFilter",this.#E?this.#f.addHCMFilter(this.#E.foreground,this.#E.background):"none")}get direction(){return zr(this,"direction",getComputedStyle(this.#N).direction)}get highlightColors(){return zr(this,"highlightColors",this.#y?new Map(this.#y.split(",").map(t=>t.split("=").map(o=>o.trim()))):null)}get highlightColorNames(){return zr(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#I=t}editAltText(t){this.#s?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#c=t-1}focusMainContainer(){this.#N.focus()}findParent(t,o){for(const i of this.#i.values()){const{x:a,y:s,width:d,height:c}=i.div.getBoundingClientRect();if(t>=a&&t<=a+d&&o>=s&&o<=s+c)return i}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*K5.PDF_TO_CSS_UNITS;for(const o of this.#a)o.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 o=document.getSelection();if(!o||o.isCollapsed)return;const{anchorNode:i,anchorOffset:a,focusNode:s,focusOffset:d}=o,c=o.toString(),p=this.#G(o).closest(".textLayer"),h=this.getSelectionBoxes(p);if(h){o.empty(),this.#b===jr.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:jr.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const m of this.#i.values())if(m.hasTextLayer(p)){m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:a,focusNode:s,focusOffset:d,text:c});break}}}#oe(){const t=document.getSelection();if(!t||t.isCollapsed)return;const i=this.#G(t).closest(".textLayer"),a=this.getSelectionBoxes(i);a&&(this.#w||=new $wt(this),this.#w.show(i,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.#w?.hide(),this.#C=null,this.#j({hasSelectedText:!1}));return}const{anchorNode:o}=t;if(o===this.#C)return;if(!this.#G(t).closest(".textLayer")){this.#C&&(this.#w?.hide(),this.#C=null,this.#j({hasSelectedText:!1}));return}if(this.#w?.hide(),this.#C=o,this.#j({hasSelectedText:!0}),!(this.#b!==jr.HIGHLIGHT&&this.#b!==jr.NONE)&&(this.#b===jr.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#g=this.isShiftKeyDown,!this.isShiftKeyDown)){const s=this._signal,d=c=>{c.type==="pointerup"&&c.button!==0||(window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),c.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",d,{signal:s}),window.addEventListener("blur",d,{signal:s})}}#Y(t=""){this.#b===jr.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.#T,{signal:t})}#ae(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#T)}blur(){if(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const o of this.#x)if(o.div.contains(t)){this.#A=[o,t],o._focusEventsAllowed=!1;break}}focus(){if(!this.#A)return;const[t,o]=this.#A;this.#A=null,o.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),o.focus()}#Z(){const t=this._signal;window.addEventListener("keydown",this.#B,{signal:t}),window.addEventListener("keyup",this.#U,{signal:t})}#se(){window.removeEventListener("keydown",this.#B),window.removeEventListener("keyup",this.#U)}#J(){const t=this._signal;document.addEventListener("copy",this.#D,{signal:t}),document.addEventListener("cut",this.#P,{signal:t}),document.addEventListener("paste",this.#_,{signal:t})}#X(){document.removeEventListener("copy",this.#D),document.removeEventListener("cut",this.#P),document.removeEventListener("paste",this.#_)}#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:o}of t.dataTransfer.items)for(const i of this.#d)if(i.isHandlingMimeForPasting(o)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const o of t.dataTransfer.items)for(const i of this.#d)if(i.isHandlingMimeForPasting(o.type)){i.paste(o,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const o=[];for(const i of this.#x){const a=i.serialize(!0);a&&o.push(a)}o.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(o))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:o}=t;for(const s of o.items)for(const d of this.#d)if(d.isHandlingMimeForPasting(s.type)){d.paste(s,this.currentLayer);return}let i=o.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){hr(`paste: "${s.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();const a=this.currentLayer;try{const s=[];for(const u of i){const p=a.deserialize(u);if(!p)return;s.push(p)}const d=()=>{for(const u of s)this.#ee(u);this.#te(s)},c=()=>{for(const u of s)u.remove()};this.addCommands({cmd:d,undo:c,mustExec:!0})}catch(s){hr(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#b!==jr.NONE&&!this.isEditorHandlingKeyboard&&A2._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}}#j(t){Object.entries(t).some(([i,a])=>this.#K[i]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#b===jr.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#F([[Uo.HIGHLIGHT_FREE,!0]]))}#F(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ne(),this.#J(),this.#j({isEditing:this.#b!==jr.NONE,isEmpty:this.#Q(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#X(),this.#j({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#d){this.#d=t;for(const o of this.#d)this.#F(o.defaultPropertiesToUpdate)}}getId(){return this.#v.id}get currentLayer(){return this.#i.get(this.#c)}getLayer(t){return this.#i.get(t)}get currentPageIndex(){return this.#c}addLayer(t){this.#i.set(t.pageIndex,t),this.#$?t.enable():t.disable()}removeLayer(t){this.#i.delete(t.pageIndex)}updateMode(t,o=null,i=!1){if(this.#b!==t){if(this.#b=t,t===jr.NONE){this.setEditingState(!1),this.#ce();return}this.setEditingState(!0),this.#de(),this.unselectAll();for(const a of this.#i.values())a.updateMode(t);if(!o&&i){this.addNewEditorFromKeyboard();return}if(o){for(const a of this.#o.values())if(a.annotationElementId===o){this.setSelected(a),a.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#b&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,o){if(this.#d){switch(t){case Uo.CREATE:this.currentLayer.addNewEditor();return;case Uo.HIGHLIGHT_DEFAULT_COLOR:this.#I?.updateColor(o);break;case Uo.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#L||=new Map).set(t,o),this.showAllEditors("highlight",o);break}for(const i of this.#x)i.updateParams(t,o);for(const i of this.#d)i.updateDefaultParams(t,o)}}showAllEditors(t,o,i=!1){for(const s of this.#o.values())s.editorType===t&&s.show(o);(this.#L?.get(Uo.HIGHLIGHT_SHOW_ALL)??!0)!==o&&this.#F([[Uo.HIGHLIGHT_SHOW_ALL,o]])}enableWaiting(t=!1){if(this.#S!==t){this.#S=t;for(const o of this.#i.values())t?o.disableClick():o.enableClick(),o.div.classList.toggle("waiting",t)}}#de(){if(!this.#$){this.#$=!0;for(const t of this.#i.values())t.enable();for(const t of this.#o.values())t.enable()}}#ce(){if(this.unselectAll(),this.#$){this.#$=!1;for(const t of this.#i.values())t.disable();for(const t of this.#o.values())t.disable()}}getEditors(t){const o=[];for(const i of this.#o.values())i.pageIndex===t&&o.push(i);return o}getEditor(t){return this.#o.get(t)}addEditor(t){this.#o.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#p&&clearTimeout(this.#p),this.#p=setTimeout(()=>{this.focusMainContainer(),this.#p=null},0)),this.#o.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#u.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#u.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#u.has(t)}removeDeletedAnnotationElement(t){this.#u.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#ee(t){const o=this.#i.get(t.pageIndex);o?o.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#t!==t&&(this.#t=t,t&&this.#F(t.propertiesToUpdate))}get#ue(){let t=null;for(t of this.#x);return t}updateUI(t){this.#ue===t&&this.#F(t.propertiesToUpdate)}toggleSelected(t){if(this.#x.has(t)){this.#x.delete(t),t.unselect(),this.#j({hasSelectedEditor:this.hasSelection});return}this.#x.add(t),t.select(),this.#F(t.propertiesToUpdate),this.#j({hasSelectedEditor:!0})}setSelected(t){for(const o of this.#x)o!==t&&o.unselect();this.#x.clear(),this.#x.add(t),t.select(),this.#F(t.propertiesToUpdate),this.#j({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.#j({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.#j({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Q()})}redo(){this.#l.redo(),this.#j({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#Q()})}addCommands(t){this.#l.add(t),this.#j({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Q()})}#Q(){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],o=()=>{for(const a of t)a.remove()},i=()=>{for(const a of t)this.#ee(a)};this.addCommands({cmd:o,undo:i,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#te(t){for(const o of this.#x)o.unselect();this.#x.clear();for(const o of t)o.isEmpty()||(this.#x.add(o),o.select());this.#j({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.#b!==jr.NONE))&&this.hasSelection){for(const t of this.#x)t.unselect();this.#x.clear(),this.#j({hasSelectedEditor:!1})}}translateSelectedEditors(t,o,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=t,this.#V[1]+=o;const[a,s]=this.#V,d=[...this.#x],c=1e3;this.#R&&clearTimeout(this.#R),this.#R=setTimeout(()=>{this.#R=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const u of d)this.#o.has(u.id)&&u.translateInPage(a,s)},undo:()=>{for(const u of d)this.#o.has(u.id)&&u.translateInPage(-a,-s)},mustExec:!1})},c);for(const u of d)u.translateInPage(t,o)}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 o=!1;for(const[{x:a,y:s,pageIndex:d},c]of t)c.newX=a,c.newY=s,c.newPageIndex=d,o||=a!==c.savedX||s!==c.savedY||d!==c.savedPageIndex;if(!o)return!1;const i=(a,s,d,c)=>{if(this.#o.has(a.id)){const u=this.#i.get(c);u?a._setParentAndPosition(u,s,d):(a.pageIndex=c,a.x=s,a.y=d)}};return this.addCommands({cmd:()=>{for(const[a,{newX:s,newY:d,newPageIndex:c}]of t)i(a,s,d,c)},undo:()=>{for(const[a,{savedX:s,savedY:d,savedPageIndex:c}]of t)i(a,s,d,c)},mustExec:!0}),!0}dragSelectedEditors(t,o){if(this.#h)for(const i of this.#h.keys())i.drag(t,o)}rebuild(t){if(t.parent===null){const o=this.getLayer(t.pageIndex);o?(o.changeParent(t),o.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.#b}get imageManager(){return zr(this,"imageManager",new vW)}getSelectionBoxes(t){if(!t)return null;const o=document.getSelection();for(let p=0,h=o.rangeCount;p<h;p++)if(!t.contains(o.getRangeAt(p).commonAncestorContainer))return null;const{x:i,y:a,width:s,height:d}=t.getBoundingClientRect();let c;switch(t.getAttribute("data-main-rotation")){case"90":c=(p,h,m,f)=>({x:(h-a)/d,y:1-(p+m-i)/s,width:f/d,height:m/s});break;case"180":c=(p,h,m,f)=>({x:1-(p+m-i)/s,y:1-(h+f-a)/d,width:m/s,height:f/d});break;case"270":c=(p,h,m,f)=>({x:1-(h+f-a)/d,y:(p-i)/s,width:f/d,height:m/s});break;default:c=(p,h,m,f)=>({x:(p-i)/s,y:(h-a)/d,width:m/s,height:f/d});break}const u=[];for(let p=0,h=o.rangeCount;p<h;p++){const m=o.getRangeAt(p);if(!m.collapsed)for(const{x:f,y:x,width:y,height:w}of m.getClientRects())y===0||w===0||u.push(c(f,x,y,w))}return u.length===0?null:u}addChangedExistingAnnotation({annotationElementId:t,id:o}){(this.#n||=new Map).set(t,o)}removeChangedExistingAnnotation({annotationElementId:t}){this.#n?.delete(t)}renderAnnotationElement(t){const o=this.#n?.get(t.data.id);if(!o)return;const i=this.#r.getRawValue(o);i&&(this.#b===jr.NONE&&!i.hasBeenModified||i.renderAnnotationElement(t))}}class Gg{#e="";#t=!1;#o=null;#i=null;#s=null;#r=!1;#n=null;static _l10nPromise=null;constructor(t){this.#n=t}static initialize(t){Gg._l10nPromise||=t}async render(){const t=this.#o=document.createElement("button");t.className="altText";const o=await Gg._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=o,t.setAttribute("aria-label",o),t.tabIndex="0";const i=this.#n._uiManager._signal;t.addEventListener("contextmenu",Cl,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});const a=s=>{s.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",a,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(this.#r=!0,a(s))},{signal:i}),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:o}){this.#e===t&&this.#t===o||(this.#e=t,this.#t=o,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"),Gg._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(a=>{t.setAttribute("aria-label",a)});let o=this.#i;if(!o){this.#i=o=document.createElement("span"),o.className="tooltip",o.setAttribute("role","tooltip");const a=o.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",a);const s=100,d=this.#n._uiManager._signal;d.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"})},s)},{signal:d}),t.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:d})}o.innerText=this.#t?await Gg._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#e,o.parentNode||t.append(o),this.#n.getImageForAltText()?.setAttribute("aria-describedby",o.id)}}class Ro{#e=null;#t=null;#o=null;#i=!1;#s=!1;#r=null;#n=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#u=null;#h="";#d=!1;#a=null;#m=!1;#f=!1;#p=!1;#y=null;#g=0;#w=0;#v=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#$=!1;#S=Ro._zIndex++;static _borderLineWidth=-1;static _colorManager=new CW;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=Ro.prototype._resizeWithKeyboard,o=A2.TRANSLATE_SMALL,i=A2.TRANSLATE_BIG;return zr(this,"_resizerKeyboardManager",new Xx([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-o,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[o,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-o]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,o]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],Ro.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===Ro&&mi("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:o,rawDims:{pageWidth:i,pageHeight:a,pageX:s,pageY:d}}=this.parent.viewport;this.rotation=o,this.pageRotation=(360+o-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,a],this.pageTranslation=[s,d];const[c,u]=this.parentDimensions;this.x=t.x/c,this.y=t.y/u,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return zr(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const o=new Ewt({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});o.annotationElementId=t.annotationElementId,o.deleted=!0,o._uiManager.addToAnnotationStorage(o)}static initialize(t,o,i){if(Ro._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(s=>[s,t.get(s.replaceAll(/([A-Z])/g,d=>`-${d.toLowerCase()}`))])),i?.strings)for(const s of i.strings)Ro._l10nPromise.set(s,t.get(s));if(Ro._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);Ro._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,o){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,o){mi("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#$}set _isDraggable(t){this.#$=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,o]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*o/(t*2),this.y+=this.width*t/(o*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*o/(t*2),this.y-=this.width*t/(o*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.#S}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#B(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#d?this.#d=!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,o,i,a){const[s,d]=this.parentDimensions;[i,a]=this.screenToPageTranslation(i,a),this.x=(t+i)/s,this.y=(o+a)/d,this.fixAndSetPosition()}#A([t,o],i,a){[i,a]=this.screenToPageTranslation(i,a),this.x+=i/t,this.y+=a/o,this.fixAndSetPosition()}translate(t,o){this.#A(this.parentDimensions,t,o)}translateInPage(t,o){this.#a||=[this.x,this.y],this.#A(this.pageDimensions,t,o),this.div.scrollIntoView({block:"nearest"})}drag(t,o){this.#a||=[this.x,this.y];const[i,a]=this.parentDimensions;if(this.x+=t/i,this.y+=o/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:p,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,p,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:d}=this;const[c,u]=this.getBaseTranslation();s+=c,d+=u,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*d).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,o]=this.parentDimensions,{_borderLineWidth:i}=Ro,a=i/t,s=i/o;switch(this.rotation){case 90:return[-a,s];case 180:return[a,s];case 270:return[a,-s];default:return[-a,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[o,i]=this.pageDimensions;let{x:a,y:s,width:d,height:c}=this;if(d*=o,c*=i,a*=o,s*=i,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(o-d,a)),s=Math.max(0,Math.min(i-c,s));break;case 90:a=Math.max(0,Math.min(o-c,a)),s=Math.min(i,Math.max(d,s));break;case 180:a=Math.min(o,Math.max(d,a)),s=Math.min(i,Math.max(c,s));break;case 270:a=Math.min(o,Math.max(c,a)),s=Math.max(0,Math.min(i-d,s));break}this.x=a/=o,this.y=s/=i;const[u,p]=this.getBaseTranslation();a+=u,s+=p;const{style:h}=this.div;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#I(t,o,i){switch(i){case 90:return[o,-t];case 180:return[-t,-o];case 270:return[-o,t];default:return[t,o]}}screenToPageTranslation(t,o){return Ro.#I(t,o,this.parentRotation)}pageTranslationToScreen(t,o){return Ro.#I(t,o,360-this.parentRotation)}#k(t){switch(t){case 90:{const[o,i]=this.pageDimensions;return[0,-o/i,i/o,0]}case 180:return[-1,0,0,-1];case 270:{const[o,i]=this.pageDimensions;return[0,o/i,-i/o,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:[o,i]}=this,a=o*t,s=i*t;return gl.isCSSRoundSupported?[Math.round(a),Math.round(s)]:[a,s]}setDims(t,o){const[i,a]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*o/a).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:o,width:i}=t,a=i.endsWith("%"),s=!this.#s&&o.endsWith("%");if(a&&s)return;const[d,c]=this.parentDimensions;a||(t.width=`${(100*parseFloat(i)/d).toFixed(2)}%`),!this.#s&&!s&&(t.height=`${(100*parseFloat(o)/c).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#b(){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"],o=this._uiManager._signal;for(const i of t){const a=document.createElement("div");this.#r.append(a),a.classList.add("resizer",i),a.setAttribute("data-resizer-name",i),a.addEventListener("pointerdown",this.#x.bind(this,i),{signal:o}),a.addEventListener("contextmenu",Cl,{signal:o}),a.tabIndex=-1}this.div.prepend(this.#r)}#x(t,o){o.preventDefault();const{isMac:i}=gl.platform;if(o.button!==0||o.ctrlKey&&i)return;this.#o?.toggle(!1);const a=this.#E.bind(this,t),s=this._isDraggable;this._isDraggable=!1;const d=this._uiManager._signal,c={passive:!0,capture:!0,signal:d};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",a,c),window.addEventListener("contextmenu",Cl,{signal:d});const u=this.x,p=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(o.target).cursor;const y=()=>{this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=s,window.removeEventListener("pointerup",y),window.removeEventListener("blur",y),window.removeEventListener("pointermove",a,c),window.removeEventListener("contextmenu",Cl),this.parent.div.style.cursor=f,this.div.style.cursor=x,this.#C(u,p,h,m)};window.addEventListener("pointerup",y,{signal:d}),window.addEventListener("blur",y,{signal:d})}#C(t,o,i,a){const s=this.x,d=this.y,c=this.width,u=this.height;s===t&&d===o&&c===i&&u===a||this.addCommands({cmd:()=>{this.width=c,this.height=u,this.x=s,this.y=d;const[p,h]=this.parentDimensions;this.setDims(p*c,h*u),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=a,this.x=t,this.y=o;const[p,h]=this.parentDimensions;this.setDims(p*i,h*a),this.fixAndSetPosition()},mustExec:!0})}#E(t,o){const[i,a]=this.parentDimensions,s=this.x,d=this.y,c=this.width,u=this.height,p=Ro.MIN_SIZE/i,h=Ro.MIN_SIZE/a,m=F=>Math.round(F*1e4)/1e4,f=this.#k(this.rotation),x=(F,D)=>[f[0]*F+f[2]*D,f[1]*F+f[3]*D],y=this.#k(360-this.rotation),w=(F,D)=>[y[0]*F+y[2]*D,y[1]*F+y[3]*D];let b,C,$=!1,A=!1;switch(t){case"topLeft":$=!0,b=(F,D)=>[0,0],C=(F,D)=>[F,D];break;case"topMiddle":b=(F,D)=>[F/2,0],C=(F,D)=>[F/2,D];break;case"topRight":$=!0,b=(F,D)=>[F,0],C=(F,D)=>[0,D];break;case"middleRight":A=!0,b=(F,D)=>[F,D/2],C=(F,D)=>[0,D/2];break;case"bottomRight":$=!0,b=(F,D)=>[F,D],C=(F,D)=>[0,0];break;case"bottomMiddle":b=(F,D)=>[F/2,D],C=(F,D)=>[F/2,0];break;case"bottomLeft":$=!0,b=(F,D)=>[0,D],C=(F,D)=>[F,0];break;case"middleLeft":A=!0,b=(F,D)=>[0,D/2],C=(F,D)=>[F,D/2];break}const E=b(c,u),I=C(c,u);let L=x(...I);const T=m(s+L[0]),P=m(d+L[1]);let B=1,_=1,[R,z]=this.screenToPageTranslation(o.movementX,o.movementY);if([R,z]=w(R/i,z/a),$){const F=Math.hypot(c,u);B=_=Math.max(Math.min(Math.hypot(I[0]-E[0]-R,I[1]-E[1]-z)/F,1/c,1/u),p/c,h/u)}else A?B=Math.max(p,Math.min(1,Math.abs(I[0]-E[0]-R)))/c:_=Math.max(h,Math.min(1,Math.abs(I[1]-E[1]-z)))/u;const Y=m(c*B),Z=m(u*_);L=x(...C(Y,Z));const O=T-L[0],U=P-L[1];this.width=Y,this.height=Z,this.x=O,this.y=U,this.setDims(i*Y,a*Z),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this.#u||this.#f?this.#u:(this.#u=new bW(this),this.div.append(this.#u.render()),this.#o&&this.#u.addAltTextButton(await this.#o.render()),this.#u)}removeEditToolbar(){this.#u&&(this.#u.remove(),this.#u=null,this.#o?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(Gg.initialize(Ro._l10nPromise),this.#o=new Gg(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.#c,{signal:t});const[o,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/o).toFixed(2)}%`,this.div.style.maxHeight=`${(100*o/i).toFixed(2)}%`);const[a,s]=this.getInitialTranslation();return this.translate(a,s),P$(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:o}=gl.platform;if(t.button!==0||t.ctrlKey&&o){t.preventDefault();return}if(this.#d=!0,this._isDraggable){this.#T(t);return}this.#L(t)}#L(t){const{isMac:o}=gl.platform;t.ctrlKey&&!o||t.shiftKey||t.metaKey&&o?this.parent.toggleSelected(this):this.parent.setSelected(this)}#T(t){const o=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let i,a;const s=this._uiManager._signal;o&&(this.div.classList.add("moving"),i={passive:!0,capture:!0,signal:s},this.#g=t.clientX,this.#w=t.clientY,a=c=>{const{clientX:u,clientY:p}=c,[h,m]=this.screenToPageTranslation(u-this.#g,p-this.#w);this.#g=u,this.#w=p,this._uiManager.dragSelectedEditors(h,m)},window.addEventListener("pointermove",a,i));const d=()=>{window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),o&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",a,i)),this.#d=!1,this._uiManager.endDragSession()||this.#L(t)};window.addEventListener("pointerup",d,{signal:s}),window.addEventListener("blur",d,{signal:s})}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,o,i){t.changeParent(this),this.x=o,this.y=i,this.fixAndSetPosition()}getRect(t,o,i=this.rotation){const a=this.parentScale,[s,d]=this.pageDimensions,[c,u]=this.pageTranslation,p=t/a,h=o/a,m=this.x*s,f=this.y*d,x=this.width*s,y=this.height*d;switch(i){case 0:return[m+p+c,d-f-h-y+u,m+p+x+c,d-f-h+u];case 90:return[m+h+c,d-f+p+u,m+h+y+c,d-f+p+x+u];case 180:return[m-p-x+c,d-f+h+u,m-p+c,d-f+h+y+u];case 270:return[m-h-y+c,d-f-p-x+u,m-h+c,d-f-p+u];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,o){const[i,a,s,d]=t,c=s-i,u=d-a;switch(this.rotation){case 0:return[i,o-d,c,u];case 90:return[i,o-a,u,c];case 180:return[s,o-a,c,u];case 270:return[s,o-d,u,c];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.#p}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.#c,{signal:t})}rotate(t){}serialize(t=!1,o=null){mi("An editor must be serializable")}static deserialize(t,o,i){const a=new this.prototype.constructor({parent:o,id:o.getNextId(),uiManager:i});a.rotation=t.rotation,a.#e=t.accessibilityData;const[s,d]=a.pageDimensions,[c,u,p,h]=a.getRectInCurrentCoords(t.rect,d);return a.x=c/s,a.y=u/d,a.width=p/s,a.height=h/d,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#B(),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.#b(),this.#r.classList.remove("hidden"),P$(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 o=this.#r.children;if(!this.#t){this.#t=Array.from(o);const d=this.#M.bind(this),c=this.#D.bind(this),u=this._uiManager._signal;for(const p of this.#t){const h=p.getAttribute("data-resizer-name");p.setAttribute("role","spinbutton"),p.addEventListener("keydown",d,{signal:u}),p.addEventListener("blur",c,{signal:u}),p.addEventListener("focus",this.#P.bind(this,h),{signal:u}),Ro._l10nPromise.get(`pdfjs-editor-resizer-label-${h}`).then(m=>p.setAttribute("aria-label",m))}}const i=this.#t[0];let a=0;for(const d of o){if(d===i)break;a++}const s=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(s!==a){if(s<a)for(let c=0;c<a-s;c++)this.#r.append(this.#r.firstChild);else if(s>a)for(let c=0;c<s-a;c++)this.#r.firstChild.before(this.#r.lastChild);let d=0;for(const c of o){const p=this.#t[d++].getAttribute("data-resizer-name");Ro._l10nPromise.get(`pdfjs-editor-resizer-label-${p}`).then(h=>c.setAttribute("aria-label",h))}}this.#_(0),this.#p=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#M(t){Ro._resizerKeyboardManager.exec(this,t)}#D(t){this.#p&&t.relatedTarget?.parentNode!==this.#r&&this.#B()}#P(t){this.#h=this.#p?t:""}#_(t){if(this.#t)for(const o of this.#t)o.tabIndex=t}_resizeWithKeyboard(t,o){this.#p&&this.#E(this.#h,{movementX:t,movementY:o})}#B(){if(this.#p=!1,this.#_(-1),this.#n){const{savedX:t,savedY:o,savedWidth:i,savedHeight:a}=this.#n;this.#C(t,o,i,a),this.#n=null}}_stopResizingWithKeyboard(){this.#B(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#u){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#u?.show()});return}this.#u?.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.#u?.hide()}updateParams(t,o){}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,o){this.#s=!0;const i=t/o,{style:a}=this.div;a.aspectRatio=i,a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,o=!1){if(o){this.#v||=new Map;const{action:i}=t;let a=this.#v.get(i);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),this.#v.delete(i),this.#v.size===0&&(this.#v=null)},Ro._telemetryTimeout),this.#v.set(i,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 o=t.container.querySelector(".annotationContent");if(!o)o=document.createElement("div"),o.classList.add("annotationContent",this.editorType),t.container.prepend(o);else if(o.nodeName==="CANVAS"){const i=o;o=document.createElement("div"),o.classList.add("annotationContent",this.editorType),i.before(o)}return o}resetAnnotationElement(t){const{firstChild:o}=t.container;o.nodeName==="DIV"&&o.classList.contains("annotationContent")&&o.remove()}}class Ewt extends Ro{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const $le=3285377520,Cd=4294901760,hu=65535;class iCe{constructor(t){this.h1=t?t&4294967295:$le,this.h2=t?t&4294967295:$le}update(t){let o,i;if(typeof t=="string"){o=new Uint8Array(t.length*2),i=0;for(let w=0,b=t.length;w<b;w++){const C=t.charCodeAt(w);C<=255?o[i++]=C:(o[i++]=C>>>8,o[i++]=C&255)}}else if(ArrayBuffer.isView(t))o=t.slice(),i=o.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=i>>2,s=i-a*4,d=new Uint32Array(o.buffer,0,a);let c=0,u=0,p=this.h1,h=this.h2;const m=3432918353,f=461845907,x=m&hu,y=f&hu;for(let w=0;w<a;w++)w&1?(c=d[w],c=c*m&Cd|c*x&hu,c=c<<15|c>>>17,c=c*f&Cd|c*y&hu,p^=c,p=p<<13|p>>>19,p=p*5+3864292196):(u=d[w],u=u*m&Cd|u*x&hu,u=u<<15|u>>>17,u=u*f&Cd|u*y&hu,h^=u,h=h<<13|h>>>19,h=h*5+3864292196);switch(c=0,s){case 3:c^=o[a*4+2]<<16;case 2:c^=o[a*4+1]<<8;case 1:c^=o[a*4],c=c*m&Cd|c*x&hu,c=c<<15|c>>>17,c=c*f&Cd|c*y&hu,a&1?p^=c:h^=c}this.h1=p,this.h2=h}hexdigest(){let t=this.h1,o=this.h2;return t^=o>>>1,t=t*3981806797&Cd|t*36045&hu,o=o*4283543511&Cd|((o<<16|t>>>16)*2950163797&Cd)>>>16,t^=o>>>1,t=t*444984403&Cd|t*60499&hu,o=o*3301882366&Cd|((o<<16|t>>>16)*3120437893&Cd)>>>16,t^=o>>>1,(t>>>0).toString(16).padStart(8,"0")+(o>>>0).toString(16).padStart(8,"0")}}const qO=Object.freeze({map:null,hash:"",transfer:void 0});class $W{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,o){const i=this.#t.get(t);return i===void 0?o:Object.assign(o,i)}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 o of this.#t.values())if(o instanceof Ro)return;this.onAnnotationEditor(null)}}setValue(t,o){const i=this.#t.get(t);let a=!1;if(i!==void 0)for(const[s,d]of Object.entries(o))i[s]!==d&&(a=!0,i[s]=d);else a=!0,this.#t.set(t,o);a&&this.#o(),o instanceof Ro&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(o.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?hW(this.#t):null}setAll(t){for(const[o,i]of Object.entries(t))this.setValue(o,i)}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 nCe(this)}get serializable(){if(this.#t.size===0)return qO;const t=new Map,o=new iCe,i=[],a=Object.create(null);let s=!1;for(const[d,c]of this.#t){const u=c instanceof Ro?c.serialize(!1,a):c;u&&(t.set(d,u),o.update(`${d}:${JSON.stringify(u)}`),s||=!!u.bitmap)}if(s)for(const d of t.values())d.bitmap&&i.push(d.bitmap);return t.size>0?{map:t,hash:o.hexdigest(),transfer:i}:qO}get editorStats(){let t=null;const o=new Map;for(const i of this.#t.values()){if(!(i instanceof Ro))continue;const a=i.telemetryFinalData;if(!a)continue;const{type:s}=a;o.has(s)||o.set(s,Object.getPrototypeOf(i).constructor),t||=Object.create(null);const d=t[s]||=new Map;for(const[c,u]of Object.entries(a)){if(c==="type")continue;let p=d.get(c);p||(p=new Map,d.set(c,p));const h=p.get(u)??0;p.set(u,h+1)}}for(const[i,a]of o)t[i]=a.computeTelemetryFinalData(t[i]);return t}}class nCe extends $W{#e;constructor(t){super();const{map:o,hash:i,transfer:a}=t.serializable,s=structuredClone(o,a?{transfer:a}:null);this.#e={map:s,hash:i,transfer:a}}get print(){mi("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}class Lwt{#e=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:o=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 o=this.styleElement.sheet;o.insertRule(t,o.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:o}){if(!(!t||this.#e.has(t.loadedName))){if(ra(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:a,style:s}=t,d=new FontFace(i,a,s);this.addNativeFontFace(d);try{await d.load(),this.#e.add(i),o?.(t)}catch{hr(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(d)}return}mi("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 i=t.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(a){throw hr(`Failed to load font '${i.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const o=t.createFontFaceRule();if(o){if(this.insertRule(o),this.isSyncFontLoadingSupported)return;await new Promise(i=>{const a=this._queueLoadingCallback(i);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return zr(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(gs||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),zr(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function o(){for(ra(!a.done,"completeRequest() cannot be called twice."),a.done=!0;i.length>0&&i[0].done;){const s=i.shift();setTimeout(s.callback,0)}}const{loadingRequests:i}=this,a={done:!1,complete:o,callback:t};return i.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return zr(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,o){function i(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,T){const P=E.substring(0,I),B=E.substring(I+L);return P+T+B}let s,d;const c=this._document.createElement("canvas");c.width=1,c.height=1;const u=c.getContext("2d");let p=0;function h(E,I){if(++p>30){hr("Load test font never loaded."),I();return}if(u.font="30px "+E,u.fillText(".",0,20),u.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,w=1482184792;let b=i(f,y);for(s=0,d=m.length-3;s<d;s+=4)b=b-w+i(m,s)|0;s<m.length&&(b=b-w+i(m+"XXX",s)|0),f=a(f,y,4,uwt(b));const C=`url(data:font/opentype;base64,${btoa(f)});`,$=`@font-face {font-family:"${m}";src:${C}}`;this.insertRule($);const A=this._document.createElement("div");A.style.visibility="hidden",A.style.width=A.style.height="10px",A.style.position="absolute",A.style.top=A.style.left="0px";for(const E of[t.loadedName,m]){const I=this._document.createElement("span");I.textContent="Hi",I.style.fontFamily=E,A.append(I)}this._document.body.append(A),h(m,()=>{A.remove(),o.complete()})}}class jwt{constructor(t,{disableFontFace:o=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.disableFontFace=o===!0,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const o={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(o.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,o)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=Jve(this.data),o=`url(data:${this.mimetype};base64,${btoa(t)});`;let i;if(!this.cssFontInfo)i=`@font-face {font-family:"${this.loadedName}";src:${o}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${o}}`}return this._inspectFont?.(this,o),i}getPathGenerator(t,o){if(this.compiledGlyphs[o]!==void 0)return this.compiledGlyphs[o];let i;try{i=t.get(this.loadedName+"_path_"+o)}catch(s){hr(`getPathGenerator - ignoring character: "${s}".`)}if(!Array.isArray(i)||i.length===0)return this.compiledGlyphs[o]=function(s,d){};const a=[];for(let s=0,d=i.length;s<d;)switch(i[s++]){case Up.BEZIER_CURVE_TO:{const[c,u,p,h,m,f]=i.slice(s,s+6);a.push(x=>x.bezierCurveTo(c,u,p,h,m,f)),s+=6}break;case Up.MOVE_TO:{const[c,u]=i.slice(s,s+2);a.push(p=>p.moveTo(c,u)),s+=2}break;case Up.LINE_TO:{const[c,u]=i.slice(s,s+2);a.push(p=>p.lineTo(c,u)),s+=2}break;case Up.QUADRATIC_CURVE_TO:{const[c,u,p,h]=i.slice(s,s+4);a.push(m=>m.quadraticCurveTo(c,u,p,h)),s+=4}break;case Up.RESTORE:a.push(c=>c.restore());break;case Up.SAVE:a.push(c=>c.save());break;case Up.SCALE:ra(a.length===2,"Scale command is only valid at the third position.");break;case Up.TRANSFORM:{const[c,u,p,h,m,f]=i.slice(s,s+6);a.push(x=>x.transform(c,u,p,h,m,f)),s+=6}break;case Up.TRANSLATE:{const[c,u]=i.slice(s,s+2);a.push(p=>p.translate(c,u)),s+=2}break}return this.compiledGlyphs[o]=function(d,c){a[0](d),a[1](d),d.scale(c,-c);for(let u=2,p=a.length;u<p;u++)a[u](d)}}}if(gs){var ZO=Promise.withResolvers(),JO=null;(async()=>{const t=await Og(()=>import("./empty-LIJVfXls.js").then(c=>c.e),__vite__mapDeps([0,1,2])),o=await Og(()=>import("./index-DUU8Hnuj.js").then(c=>c.i),__vite__mapDeps([3,1,4,5,6,7,8,9])),i=await Og(()=>import("./index-D2v_SjpC.js").then(c=>c.i),__vite__mapDeps([10,1,11,4,5,6,7,8,9])),a=await Og(()=>import("./url-Disk6EIb.js").then(c=>c.u),__vite__mapDeps([12,1,9,7,5,6,8]));let s,d;return new Map(Object.entries({fs:t,http:o,https:i,url:a,canvas:s,path2d:d}))})().then(t=>{JO=t,ZO.resolve()},t=>{hr(`loadPackages: ${t}`),JO=new Map,ZO.resolve()})}class up{static get promise(){return ZO.promise}static get(t){return JO?.get(t)}}const aCe=function(e){return up.get("fs").promises.readFile(e).then(o=>new Uint8Array(o))};class Iwt extends wA{}class Mwt extends bA{_createCanvas(t,o){return up.get("canvas").createCanvas(t,o)}}class Twt extends vA{_fetchData(t,o){return aCe(t).then(i=>({cMapData:i,compressionType:o}))}}class Pwt extends CA{_fetchData(t){return aCe(t)}}const zs={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function XO(e,t){if(!t)return;const o=t[2]-t[0],i=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],o,i),e.clip(a)}class ey{constructor(){this.constructor===ey&&mi("Cannot initialize BaseShadingPattern.")}getPattern(){mi("Abstract method `getPattern` called.")}}class Bwt extends ey{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 o;this._type==="axial"?o=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(o=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)o.addColorStop(i[0],i[1]);return o}getPattern(t,o,i,a){let s;if(a===zs.STROKE||a===zs.FILL){const d=o.current.getClippedPathBoundingBox(a,Gi(t))||[0,0,0,0],c=Math.ceil(d[2]-d[0])||1,u=Math.ceil(d[3]-d[1])||1,p=o.cachedCanvases.getCanvas("pattern",c,u,!0),h=p.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(-d[0],-d[1]),i=mo.transform(i,[1,0,0,1,d[0],d[1]]),h.transform(...o.baseTransform),this.matrix&&h.transform(...this.matrix),XO(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),s=t.createPattern(p.canvas,"no-repeat");const m=new DOMMatrix(i);s.setTransform(m)}else XO(t,this._bbox),s=this._createGradient(t);return s}}function L_(e,t,o,i,a,s,d,c){const u=t.coords,p=t.colors,h=e.data,m=e.width*4;let f;u[o+1]>u[i+1]&&(f=o,o=i,i=f,f=s,s=d,d=f),u[i+1]>u[a+1]&&(f=i,i=a,a=f,f=d,d=c,c=f),u[o+1]>u[i+1]&&(f=o,o=i,i=f,f=s,s=d,d=f);const x=(u[o]+t.offsetX)*t.scaleX,y=(u[o+1]+t.offsetY)*t.scaleY,w=(u[i]+t.offsetX)*t.scaleX,b=(u[i+1]+t.offsetY)*t.scaleY,C=(u[a]+t.offsetX)*t.scaleX,$=(u[a+1]+t.offsetY)*t.scaleY;if(y>=$)return;const A=p[s],E=p[s+1],I=p[s+2],L=p[d],T=p[d+1],P=p[d+2],B=p[c],_=p[c+1],R=p[c+2],z=Math.round(y),Y=Math.round($);let Z,O,U,F,D,H,V,te;for(let q=z;q<=Y;q++){if(q<b){const xe=q<y?0:(y-q)/(y-b);Z=x-(x-w)*xe,O=A-(A-L)*xe,U=E-(E-T)*xe,F=I-(I-P)*xe}else{let xe;q>$?xe=1:b===$?xe=0:xe=(b-q)/(b-$),Z=w-(w-C)*xe,O=L-(L-B)*xe,U=T-(T-_)*xe,F=P-(P-R)*xe}let G;q<y?G=0:q>$?G=1:G=(y-q)/(y-$),D=x-(x-C)*G,H=A-(A-B)*G,V=E-(E-_)*G,te=I-(I-R)*G;const J=Math.round(Math.min(Z,D)),X=Math.round(Math.max(Z,D));let ae=m*q+J*4;for(let xe=J;xe<=X;xe++)G=(Z-xe)/(Z-D),G<0?G=0:G>1&&(G=1),h[ae++]=O-(O-H)*G|0,h[ae++]=U-(U-V)*G|0,h[ae++]=F-(F-te)*G|0,h[ae++]=255}}function Dwt(e,t,o){const i=t.coords,a=t.colors;let s,d;switch(t.type){case"lattice":const c=t.verticesPerRow,u=Math.floor(i.length/c)-1,p=c-1;for(s=0;s<u;s++){let h=s*c;for(let m=0;m<p;m++,h++)L_(e,o,i[h],i[h+1],i[h+c],a[h],a[h+1],a[h+c]),L_(e,o,i[h+c+1],i[h+1],i[h+c],a[h+c+1],a[h+1],a[h+c])}break;case"triangles":for(s=0,d=i.length;s<d;s+=3)L_(e,o,i[s],i[s+1],i[s+2],a[s],a[s+1],a[s+2]);break;default:throw new Error("illegal figure")}}class _wt extends ey{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,o,i){const c=Math.floor(this._bounds[0]),u=Math.floor(this._bounds[1]),p=Math.ceil(this._bounds[2])-c,h=Math.ceil(this._bounds[3])-u,m=Math.min(Math.ceil(Math.abs(p*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),x=p/m,y=h/f,w={coords:this._coords,colors:this._colors,offsetX:-c,offsetY:-u,scaleX:1/x,scaleY:1/y},b=m+2*2,C=f+2*2,$=i.getCanvas("mesh",b,C,!1),A=$.context,E=A.createImageData(m,f);if(o){const L=E.data;for(let T=0,P=L.length;T<P;T+=4)L[T]=o[0],L[T+1]=o[1],L[T+2]=o[2],L[T+3]=255}for(const L of this._figures)Dwt(E,L,w);return A.putImageData(E,2,2),{canvas:$.canvas,offsetX:c-2*x,offsetY:u-2*y,scaleX:x,scaleY:y}}getPattern(t,o,i,a){XO(t,this._bbox);let s;if(a===zs.SHADING)s=mo.singularValueDecompose2dScale(Gi(t));else if(s=mo.singularValueDecompose2dScale(o.baseTransform),this.matrix){const c=mo.singularValueDecompose2dScale(this.matrix);s=[s[0]*c[0],s[1]*c[1]]}const d=this._createMeshCanvas(s,a===zs.SHADING?null:this._background,o.cachedCanvases);return a!==zs.SHADING&&(t.setTransform(...o.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(d.offsetX,d.offsetY),t.scale(d.scaleX,d.scaleY),t.createPattern(d.canvas,"no-repeat")}}class zwt extends ey{getPattern(){return"hotpink"}}function Rwt(e){switch(e[0]){case"RadialAxial":return new Bwt(e);case"Mesh":return new _wt(e);case"Dummy":return new zwt}throw new Error(`Unknown IR type: ${e[0]}`)}const kle={COLORED:1,UNCOLORED:2};class kW{static MAX_PATTERN_SIZE=3e3;constructor(t,o,i,a,s){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=o,this.ctx=i,this.canvasGraphicsFactory=a,this.baseTransform=s}createPatternCanvas(t){const o=this.operatorList,i=this.bbox,a=this.xstep,s=this.ystep,d=this.paintType,c=this.tilingType,u=this.color,p=this.canvasGraphicsFactory;fA("TilingType: "+c);const h=i[0],m=i[1],f=i[2],x=i[3],y=mo.singularValueDecompose2dScale(this.matrix),w=mo.singularValueDecompose2dScale(this.baseTransform),b=[y[0]*w[0],y[1]*w[1]],C=this.getSizeAndScale(a,this.ctx.canvas.width,b[0]),$=this.getSizeAndScale(s,this.ctx.canvas.height,b[1]),A=t.cachedCanvases.getCanvas("pattern",C.size,$.size,!0),E=A.context,I=p.createCanvasGraphics(E);I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,d,u);let L=h,T=m,P=f,B=x;return h<0&&(L=0,P+=Math.abs(h)),m<0&&(T=0,B+=Math.abs(m)),E.translate(-(C.scale*L),-($.scale*T)),I.transform(C.scale,0,0,$.scale,0,0),E.save(),this.clipBbox(I,L,T,P,B),I.baseTransform=Gi(I.ctx),I.executeOperatorList(o),I.endDrawing(),{canvas:A.canvas,scaleX:C.scale,scaleY:$.scale,offsetX:L,offsetY:T}}getSizeAndScale(t,o,i){t=Math.abs(t);const a=Math.max(kW.MAX_PATTERN_SIZE,o);let s=Math.ceil(t*i);return s>=a?s=a:i=s/t,{scale:i,size:s}}clipBbox(t,o,i,a,s){const d=a-o,c=s-i;t.ctx.rect(o,i,d,c),t.current.updateRectMinMax(Gi(t.ctx),[o,i,a,s]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,o,i){const a=t.ctx,s=t.current;switch(o){case kle.COLORED:const d=this.ctx;a.fillStyle=d.fillStyle,a.strokeStyle=d.strokeStyle,s.fillColor=d.fillStyle,s.strokeColor=d.strokeStyle;break;case kle.UNCOLORED:const c=mo.makeHexColor(i[0],i[1],i[2]);a.fillStyle=c,a.strokeStyle=c,s.fillColor=c,s.strokeColor=c;break;default:throw new cwt(`Unsupported paint type: ${o}`)}}getPattern(t,o,i,a){let s=i;a!==zs.SHADING&&(s=mo.transform(s,o.baseTransform),this.matrix&&(s=mo.transform(s,this.matrix)));const d=this.createPatternCanvas(o);let c=new DOMMatrix(s);c=c.translate(d.offsetX,d.offsetY),c=c.scale(1/d.scaleX,1/d.scaleY);const u=t.createPattern(d.canvas,"repeat");return u.setTransform(c),u}}function Fwt({src:e,srcPos:t=0,dest:o,width:i,height:a,nonBlackColor:s=4294967295,inverseDecode:d=!1}){const c=gl.isLittleEndian?4278190080:255,[u,p]=d?[s,c]:[c,s],h=i>>3,m=i&7,f=e.length;o=new Uint32Array(o.buffer);let x=0;for(let y=0;y<a;y++){for(const b=t+h;t<b;t++){const C=t<f?e[t]:255;o[x++]=C&128?p:u,o[x++]=C&64?p:u,o[x++]=C&32?p:u,o[x++]=C&16?p:u,o[x++]=C&8?p:u,o[x++]=C&4?p:u,o[x++]=C&2?p:u,o[x++]=C&1?p:u}if(m===0)continue;const w=t<f?e[t++]:255;for(let b=0;b<m;b++)o[x++]=w&1<<7-b?p:u}return{srcPos:t,destPos:x}}const Sle=16,Ale=100,Owt=15,Ele=10,Lle=1e3,sl=16;function Nwt(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(i,a){t.translate(i,a),this.__originalTranslate(i,a)},e.scale=function(i,a){t.scale(i,a),this.__originalScale(i,a)},e.transform=function(i,a,s,d,c,u){t.transform(i,a,s,d,c,u),this.__originalTransform(i,a,s,d,c,u)},e.setTransform=function(i,a,s,d,c,u){t.setTransform(i,a,s,d,c,u),this.__originalSetTransform(i,a,s,d,c,u)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(i){t.rotate(i),this.__originalRotate(i)},e.clip=function(i){t.clip(i),this.__originalClip(i)},e.moveTo=function(o,i){t.moveTo(o,i),this.__originalMoveTo(o,i)},e.lineTo=function(o,i){t.lineTo(o,i),this.__originalLineTo(o,i)},e.bezierCurveTo=function(o,i,a,s,d,c){t.bezierCurveTo(o,i,a,s,d,c),this.__originalBezierCurveTo(o,i,a,s,d,c)},e.rect=function(o,i,a,s){t.rect(o,i,a,s),this.__originalRect(o,i,a,s)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class Hwt{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,o,i){let a;return this.cache[t]!==void 0?(a=this.cache[t],this.canvasFactory.reset(a,o,i)):(a=this.canvasFactory.create(o,i),this.cache[t]=a),a}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const o=this.cache[t];this.canvasFactory.destroy(o),delete this.cache[t]}}}function Yw(e,t,o,i,a,s,d,c,u,p){const[h,m,f,x,y,w]=Gi(e);if(m===0&&f===0){const $=d*h+y,A=Math.round($),E=c*x+w,I=Math.round(E),L=(d+u)*h+y,T=Math.abs(Math.round(L)-A)||1,P=(c+p)*x+w,B=Math.abs(Math.round(P)-I)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(x),A,I),e.drawImage(t,o,i,a,s,0,0,T,B),e.setTransform(h,m,f,x,y,w),[T,B]}if(h===0&&x===0){const $=c*f+y,A=Math.round($),E=d*m+w,I=Math.round(E),L=(c+p)*f+y,T=Math.abs(Math.round(L)-A)||1,P=(d+u)*m+w,B=Math.abs(Math.round(P)-I)||1;return e.setTransform(0,Math.sign(m),Math.sign(f),0,A,I),e.drawImage(t,o,i,a,s,0,0,B,T),e.setTransform(h,m,f,x,y,w),[B,T]}e.drawImage(t,o,i,a,s,d,c,u,p);const b=Math.hypot(h,m),C=Math.hypot(f,x);return[b*u,C*p]}function Vwt(e){const{width:t,height:o}=e;if(t>Lle||o>Lle)return null;const i=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=t+1;let d=new Uint8Array(s*(o+1)),c,u,p;const h=t+7&-8;let m=new Uint8Array(h*o),f=0;for(const C of e.data){let $=128;for(;$>0;)m[f++]=C&$?0:255,$>>=1}let x=0;for(f=0,m[f]!==0&&(d[0]=1,++x),u=1;u<t;u++)m[f]!==m[f+1]&&(d[u]=m[f]?2:1,++x),f++;for(m[f]!==0&&(d[u]=2,++x),c=1;c<o;c++){f=c*h,p=c*s,m[f-h]!==m[f]&&(d[p]=m[f]?1:8,++x);let C=(m[f]?4:0)+(m[f-h]?8:0);for(u=1;u<t;u++)C=(C>>2)+(m[f+1]?4:0)+(m[f-h+1]?8:0),a[C]&&(d[p+u]=a[C],++x),f++;if(m[f-h]!==m[f]&&(d[p+u]=m[f]?2:4,++x),x>i)return null}for(f=h*(o-1),p=c*s,m[f]!==0&&(d[p]=8,++x),u=1;u<t;u++)m[f]!==m[f+1]&&(d[p+u]=m[f]?4:8,++x),f++;if(m[f]!==0&&(d[p+u]=4,++x),x>i)return null;const y=new Int32Array([0,s,-1,0,-s,0,0,0,1]),w=new Path2D;for(c=0;x&&c<=o;c++){let C=c*s;const $=C+t;for(;C<$&&!d[C];)C++;if(C===$)continue;w.moveTo(C%s,c);const A=C;let E=d[C];do{const I=y[E];do C+=I;while(!d[C]);const L=d[C];L!==5&&L!==10?(E=L,d[C]=0):(E=L&51*E>>4,d[C]&=E>>2|E<<2),w.lineTo(C%s,C/s|0),d[C]||--x}while(A!==C);--c}return m=null,d=null,function(C){C.save(),C.scale(1/t,-1/o),C.translate(0,-o),C.fill(w),C.beginPath(),C.restore()}}class jle{constructor(t,o){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=qve,this.textMatrixScale=1,this.fontMatrix=QO,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=ls.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,o])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,o){this.x=t,this.y=o}updatePathMinMax(t,o,i){[o,i]=mo.applyTransform([o,i],t),this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,o),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,o){const i=mo.applyTransform(o,t),a=mo.applyTransform(o.slice(2),t),s=mo.applyTransform([o[0],o[3]],t),d=mo.applyTransform([o[2],o[1]],t);this.minX=Math.min(this.minX,i[0],a[0],s[0],d[0]),this.minY=Math.min(this.minY,i[1],a[1],s[1],d[1]),this.maxX=Math.max(this.maxX,i[0],a[0],s[0],d[0]),this.maxY=Math.max(this.maxY,i[1],a[1],s[1],d[1])}updateScalingPathMinMax(t,o){mo.scaleMinMax(t,o),this.minX=Math.min(this.minX,o[0]),this.minY=Math.min(this.minY,o[1]),this.maxX=Math.max(this.maxX,o[2]),this.maxY=Math.max(this.maxY,o[3])}updateCurvePathMinMax(t,o,i,a,s,d,c,u,p,h){const m=mo.bezierBoundingBox(o,i,a,s,d,c,u,p,h);h||this.updateRectMinMax(t,m)}getPathBoundingBox(t=zs.FILL,o=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===zs.STROKE){o||mi("Stroke bounding box must include transform.");const a=mo.singularValueDecompose2dScale(o),s=a[0]*this.lineWidth/2,d=a[1]*this.lineWidth/2;i[0]-=s,i[1]-=d,i[2]+=s,i[3]+=d}return i}updateClipFromPath(){const t=mo.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=zs.FILL,o=null){return mo.intersect(this.clipBox,this.getPathBoundingBox(t,o))}}function Ile(e,t){if(typeof ImageData<"u"&&t instanceof ImageData){e.putImageData(t,0,0);return}const o=t.height,i=t.width,a=o%sl,s=(o-a)/sl,d=a===0?s:s+1,c=e.createImageData(i,sl);let u=0,p;const h=t.data,m=c.data;let f,x,y,w;if(t.kind===mC.GRAYSCALE_1BPP){const b=h.byteLength,C=new Uint32Array(m.buffer,0,m.byteLength>>2),$=C.length,A=i+7>>3,E=4294967295,I=gl.isLittleEndian?4278190080:255;for(f=0;f<d;f++){for(y=f<s?sl:a,p=0,x=0;x<y;x++){const L=b-u;let T=0;const P=L>A?i:L*8-7,B=P&-8;let _=0,R=0;for(;T<B;T+=8)R=h[u++],C[p++]=R&128?E:I,C[p++]=R&64?E:I,C[p++]=R&32?E:I,C[p++]=R&16?E:I,C[p++]=R&8?E:I,C[p++]=R&4?E:I,C[p++]=R&2?E:I,C[p++]=R&1?E:I;for(;T<P;T++)_===0&&(R=h[u++],_=128),C[p++]=R&_?E:I,_>>=1}for(;p<$;)C[p++]=0;e.putImageData(c,0,f*sl)}}else if(t.kind===mC.RGBA_32BPP){for(x=0,w=i*sl*4,f=0;f<s;f++)m.set(h.subarray(u,u+w)),u+=w,e.putImageData(c,0,x),x+=sl;f<d&&(w=i*a*4,m.set(h.subarray(u,u+w)),e.putImageData(c,0,x))}else if(t.kind===mC.RGB_24BPP)for(y=sl,w=i*y,f=0;f<d;f++){for(f>=s&&(y=a,w=i*y),p=0,x=w;x--;)m[p++]=h[u++],m[p++]=h[u++],m[p++]=h[u++],m[p++]=255;e.putImageData(c,0,f*sl)}else throw new Error(`bad image kind: ${t.kind}`)}function Mle(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const o=t.height,i=t.width,a=o%sl,s=(o-a)/sl,d=a===0?s:s+1,c=e.createImageData(i,sl);let u=0;const p=t.data,h=c.data;for(let m=0;m<d;m++){const f=m<s?sl:a;({srcPos:u}=Fwt({src:p,srcPos:u,dest:h,width:i,height:f,nonBlackColor:0})),e.putImageData(c,0,m*sl)}}function K6(e,t){const o=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of o)e[i]!==void 0&&(t[i]=e[i]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function Kw(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),!gs){const{filter:t}=e;t!=="none"&&t!==""&&(e.filter="none")}}function Tle(e,t){if(t)return!0;const o=mo.singularValueDecompose2dScale(e);o[0]=Math.fround(o[0]),o[1]=Math.fround(o[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*K5.PDF_TO_CSS_UNITS);return o[0]<=i&&o[1]<=i}const Uwt=["butt","round","square"],Wwt=["miter","round","bevel"],Qwt={},Ple={};class w5{constructor(t,o,i,a,s,{optionalContentConfig:d,markedContentStack:c=null},u,p){this.ctx=t,this.current=new jle(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=o,this.objs=i,this.canvasFactory=a,this.filterFactory=s,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=c||[],this.optionalContentConfig=d,this.cachedCanvases=new Hwt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=u,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=p,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,o=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):o}beginDrawing({transform:t,viewport:o,transparency:i=!1,background:a=null}){const s=this.ctx.canvas.width,d=this.ctx.canvas.height,c=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,s,d),this.ctx.fillStyle=c,i){const u=this.cachedCanvases.getCanvas("transparent",s,d);this.compositeCtx=this.ctx,this.transparentCanvas=u.canvas,this.ctx=u.context,this.ctx.save(),this.ctx.transform(...Gi(this.compositeCtx))}this.ctx.save(),Kw(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...o.transform),this.viewportScale=o.scale,this.baseTransform=Gi(this.ctx)}executeOperatorList(t,o,i,a){const s=t.argsArray,d=t.fnArray;let c=o||0;const u=s.length;if(u===c)return c;const p=u-c>Ele&&typeof i=="function",h=p?Date.now()+Owt:0;let m=0;const f=this.commonObjs,x=this.objs;let y;for(;;){if(a!==void 0&&c===a.nextBreakPoint)return a.breakIt(c,i),c;if(y=d[c],y!==zc.dependency)this[y].apply(this,s[c]);else for(const w of s[c]){const b=w.startsWith("g_")?f:x;if(!b.has(w))return b.get(w,i),c}if(c++,c===u)return c;if(p&&++m>Ele){if(Date.now()>h)return i(),c;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 o of t.values())typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement&&(o.width=o.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 o=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=o}}}_scaleImage(t,o){const i=t.width,a=t.height;let s=Math.max(Math.hypot(o[0],o[1]),1),d=Math.max(Math.hypot(o[2],o[3]),1),c=i,u=a,p="prescale1",h,m;for(;s>2&&c>1||d>2&&u>1;){let f=c,x=u;s>2&&c>1&&(f=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),s/=c/f),d>2&&u>1&&(x=u>=16384?Math.floor(u/2)-1||1:Math.ceil(u)/2,d/=u/x),h=this.cachedCanvases.getCanvas(p,f,x),m=h.context,m.clearRect(0,0,f,x),m.drawImage(t,0,0,c,u,0,0,f,x),t=h.canvas,c=f,u=x,p=p==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:c,paintHeight:u}}_createMaskCanvas(t){const o=this.ctx,{width:i,height:a}=t,s=this.current.fillColor,d=this.current.patternFill,c=Gi(o);let u,p,h,m;if((t.bitmap||t.data)&&t.count>1){const P=t.bitmap||t.data.buffer;p=JSON.stringify(d?c:[c.slice(0,4),s]),u=this._cachedBitmapsMap.get(P),u||(u=new Map,this._cachedBitmapsMap.set(P,u));const B=u.get(p);if(B&&!d){const _=Math.round(Math.min(c[0],c[2])+c[4]),R=Math.round(Math.min(c[1],c[3])+c[5]);return{canvas:B,offsetX:_,offsetY:R}}h=B}h||(m=this.cachedCanvases.getCanvas("maskCanvas",i,a),Mle(m.context,t));let f=mo.transform(c,[1/i,0,0,-1/a,0,0]);f=mo.transform(f,[1,0,0,1,0,-a]);const[x,y,w,b]=mo.getAxialAlignedBoundingBox([0,0,i,a],f),C=Math.round(w-x)||1,$=Math.round(b-y)||1,A=this.cachedCanvases.getCanvas("fillCanvas",C,$),E=A.context,I=x,L=y;E.translate(-I,-L),E.transform(...f),h||(h=this._scaleImage(m.canvas,Wp(E)),h=h.img,u&&d&&u.set(p,h)),E.imageSmoothingEnabled=Tle(Gi(E),t.interpolate),Yw(E,h,0,0,h.width,h.height,0,0,i,a),E.globalCompositeOperation="source-in";const T=mo.transform(Wp(E),[1,0,0,1,-I,-L]);return E.fillStyle=d?s.getPattern(o,this,T,zs.FILL):s,E.fillRect(0,0,i,a),u&&!d&&(this.cachedCanvases.delete("fillCanvas"),u.set(p,A.canvas)),{canvas:A.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=Uwt[t]}setLineJoin(t){this.ctx.lineJoin=Wwt[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,o){const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=o)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[o,i]of t)switch(o){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,o=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(i,t,o);this.suspendedCtx=this.ctx,this.ctx=a.context;const s=this.ctx;s.setTransform(...Gi(this.suspendedCtx)),K6(this.suspendedCtx,s),Nwt(s,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(),K6(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 o=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,o,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,o,i,a){const s=a[0],d=a[1],c=a[2]-s,u=a[3]-d;c===0||u===0||(this.genericComposeSMask(o.context,i,c,u,o.subtype,o.backdrop,o.transferMap,s,d,o.offsetX,o.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,o,i,a,s,d,c,u,p,h,m){let f=t.canvas,x=u-h,y=p-m;if(d){if(x<0||y<0||x+i>f.width||y+a>f.height){const b=this.cachedCanvases.getCanvas("maskExtension",i,a),C=b.context;C.drawImage(f,-x,-y),d.some($=>$!==0)&&(C.globalCompositeOperation="destination-atop",C.fillStyle=mo.makeHexColor(...d),C.fillRect(0,0,i,a),C.globalCompositeOperation="source-over"),f=b.canvas,x=y=0}else if(d.some(b=>b!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const b=new Path2D;b.rect(x,y,i,a),t.clip(b),t.globalCompositeOperation="destination-atop",t.fillStyle=mo.makeHexColor(...d),t.fillRect(x,y,i,a),t.restore()}}o.save(),o.globalAlpha=1,o.setTransform(1,0,0,1,0,0),s==="Alpha"&&c?o.filter=this.filterFactory.addAlphaFilter(c):s==="Luminosity"&&(o.filter=this.filterFactory.addLuminosityFilter(c));const w=new Path2D;w.rect(u,p,i,a),o.clip(w),o.globalCompositeOperation="destination-in",o.drawImage(f,x,y,i,a,u,p,i,a),o.restore()}save(){this.inSMaskMode?(K6(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(),K6(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,o,i,a,s,d){this.ctx.transform(t,o,i,a,s,d),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,o,i){const a=this.ctx,s=this.current;let d=s.x,c=s.y,u,p;const h=Gi(a),m=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,f=m?i.slice(0):null;for(let x=0,y=0,w=t.length;x<w;x++)switch(t[x]|0){case zc.rectangle:d=o[y++],c=o[y++];const b=o[y++],C=o[y++],$=d+b,A=c+C;a.moveTo(d,c),b===0||C===0?a.lineTo($,A):(a.lineTo($,c),a.lineTo($,A),a.lineTo(d,A)),m||s.updateRectMinMax(h,[d,c,$,A]),a.closePath();break;case zc.moveTo:d=o[y++],c=o[y++],a.moveTo(d,c),m||s.updatePathMinMax(h,d,c);break;case zc.lineTo:d=o[y++],c=o[y++],a.lineTo(d,c),m||s.updatePathMinMax(h,d,c);break;case zc.curveTo:u=d,p=c,d=o[y+4],c=o[y+5],a.bezierCurveTo(o[y],o[y+1],o[y+2],o[y+3],d,c),s.updateCurvePathMinMax(h,u,p,o[y],o[y+1],o[y+2],o[y+3],d,c,f),y+=6;break;case zc.curveTo2:u=d,p=c,a.bezierCurveTo(d,c,o[y],o[y+1],o[y+2],o[y+3]),s.updateCurvePathMinMax(h,u,p,d,c,o[y],o[y+1],o[y+2],o[y+3],f),d=o[y+2],c=o[y+3],y+=4;break;case zc.curveTo3:u=d,p=c,d=o[y+2],c=o[y+3],a.bezierCurveTo(o[y],o[y+1],d,c,d,c),s.updateCurvePathMinMax(h,u,p,o[y],o[y+1],d,c,d,c,f),y+=4;break;case zc.closePath:a.closePath();break}m&&s.updateScalingPathMinMax(h,f),s.setCurrentPoint(d,c)}closePath(){this.ctx.closePath()}stroke(t=!0){const o=this.ctx,i=this.current.strokeColor;o.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof i=="object"&&i?.getPattern?(o.save(),o.strokeStyle=i.getPattern(o,this,Wp(o),zs.STROKE),this.rescaleAndStroke(!1),o.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),o.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const o=this.ctx,i=this.current.fillColor,a=this.current.patternFill;let s=!1;a&&(o.save(),o.fillStyle=i.getPattern(o,this,Wp(o),zs.FILL),s=!0);const d=this.current.getClippedPathBoundingBox();this.contentVisible&&d!==null&&(this.pendingEOFill?(o.fill("evenodd"),this.pendingEOFill=!1):o.fill()),s&&o.restore(),t&&this.consumePath(d)}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=Qwt}eoClip(){this.pendingClip=Ple}beginText(){this.current.textMatrix=qve,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,o=this.ctx;if(t===void 0){o.beginPath();return}o.save(),o.beginPath();for(const i of t)o.setTransform(...i.transform),o.translate(i.x,i.y),i.addToPath(o,i.fontSize);o.restore(),o.clip(),o.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,o){const i=this.commonObjs.get(t),a=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(a.fontMatrix=i.fontMatrix||QO,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&hr("Invalid font matrix for font "+t),o<0?(o=-o,a.fontDirection=-1):a.fontDirection=1,this.current.font=i,this.current.fontSize=o,i.isType3Font)return;const s=i.loadedName||"sans-serif",d=i.systemFontInfo?.css||`"${s}", ${i.fallbackName}`;let c="normal";i.black?c="900":i.bold&&(c="bold");const u=i.italic?"italic":"normal";let p=o;o<Sle?p=Sle:o>Ale&&(p=Ale),this.current.fontSizeScale=o/p,this.ctx.font=`${u} ${c} ${p}px ${d}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,o){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=o}setLeadingMoveText(t,o){this.setLeading(-o),this.moveText(t,o)}setTextMatrix(t,o,i,a,s,d){this.current.textMatrix=[t,o,i,a,s,d],this.current.textMatrixScale=Math.hypot(t,o),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,o,i,a){const s=this.ctx,d=this.current,c=d.font,u=d.textRenderingMode,p=d.fontSize/d.fontSizeScale,h=u&ls.FILL_STROKE_MASK,m=!!(u&ls.ADD_TO_PATH_FLAG),f=d.patternFill&&!c.missingFile;let x;(c.disableFontFace||m||f)&&(x=c.getPathGenerator(this.commonObjs,t)),c.disableFontFace||f?(s.save(),s.translate(o,i),s.beginPath(),x(s,p),a&&s.setTransform(...a),(h===ls.FILL||h===ls.FILL_STROKE)&&s.fill(),(h===ls.STROKE||h===ls.FILL_STROKE)&&s.stroke(),s.restore()):((h===ls.FILL||h===ls.FILL_STROKE)&&s.fillText(t,o,i),(h===ls.STROKE||h===ls.FILL_STROKE)&&s.strokeText(t,o,i)),m&&(this.pendingTextPaths||=[]).push({transform:Gi(s),x:o,y:i,fontSize:p,addToPath:x})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const o=t.getImageData(0,0,10,10).data;let i=!1;for(let a=3;a<o.length;a+=4)if(o[a]>0&&o[a]<255){i=!0;break}return zr(this,"isFontSubpixelAAEnabled",i)}showText(t){const o=this.current,i=o.font;if(i.isType3Font)return this.showType3Text(t);const a=o.fontSize;if(a===0)return;const s=this.ctx,d=o.fontSizeScale,c=o.charSpacing,u=o.wordSpacing,p=o.fontDirection,h=o.textHScale*p,m=t.length,f=i.vertical,x=f?1:-1,y=i.defaultVMetrics,w=a*o.fontMatrix[0],b=o.textRenderingMode===ls.FILL&&!i.disableFontFace&&!o.patternFill;s.save(),s.transform(...o.textMatrix),s.translate(o.x,o.y+o.textRise),p>0?s.scale(h,-1):s.scale(h,1);let C;if(o.patternFill){s.save();const L=o.fillColor.getPattern(s,this,Wp(s),zs.FILL);C=Gi(s),s.restore(),s.fillStyle=L}let $=o.lineWidth;const A=o.textMatrixScale;if(A===0||$===0){const L=o.textRenderingMode&ls.FILL_STROKE_MASK;(L===ls.STROKE||L===ls.FILL_STROKE)&&($=this.getSinglePixelWidth())}else $/=A;if(d!==1&&(s.scale(d,d),$/=d),s.lineWidth=$,i.isInvalidPDFjsFont){const L=[];let T=0;for(const P of t)L.push(P.unicode),T+=P.width;s.fillText(L.join(""),0,0),o.x+=T*w*h,s.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 T=!1;const P=(L.isSpace?u:0)+c,B=L.fontChar,_=L.accent;let R,z,Y=L.width;if(f){const O=L.vmetric||y,U=-(L.vmetric?O[1]:Y*.5)*w,F=O[2]*w;Y=O?-O[0]:Y,R=U/d,z=(E+F)/d}else R=E/d,z=0;if(i.remeasure&&Y>0){const O=s.measureText(B).width*1e3/a*d;if(Y<O&&this.isFontSubpixelAAEnabled){const U=Y/O;T=!0,s.save(),s.scale(U,1),R/=U}else Y!==O&&(R+=(Y-O)/2e3*a/d)}if(this.contentVisible&&(L.isInFont||i.missingFile)){if(b&&!_)s.fillText(B,R,z);else if(this.paintChar(B,R,z,C),_){const O=R+a*_.offset.x/d,U=z-a*_.offset.y/d;this.paintChar(_.fontChar,O,U,C)}}const Z=f?Y*w-P*p:Y*w+P*p;E+=Z,T&&s.restore()}f?o.y-=E:o.x+=E*h,s.restore(),this.compose()}showType3Text(t){const o=this.ctx,i=this.current,a=i.font,s=i.fontSize,d=i.fontDirection,c=a.vertical?1:-1,u=i.charSpacing,p=i.wordSpacing,h=i.textHScale*d,m=i.fontMatrix||QO,f=t.length,x=i.textRenderingMode===ls.INVISIBLE;let y,w,b,C;if(!(x||s===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,o.save(),o.transform(...i.textMatrix),o.translate(i.x,i.y),o.scale(h,d),y=0;y<f;++y){if(w=t[y],typeof w=="number"){C=c*w*s/1e3,this.ctx.translate(C,0),i.x+=C*h;continue}const $=(w.isSpace?p:0)+u,A=a.charProcOperatorList[w.operatorListId];if(!A){hr(`Type3 character "${w.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=w,this.save(),o.scale(s,s),o.transform(...m),this.executeOperatorList(A),this.restore()),b=mo.applyTransform([w.width,0],m)[0]*s+$,o.translate(b,0),i.x+=b*h}o.restore(),this.processingType3=null}}setCharWidth(t,o){}setCharWidthAndBounds(t,o,i,a,s,d){this.ctx.rect(i,a,s-i,d-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let o;if(t[0]==="TilingPattern"){const i=t[1],a=this.baseTransform||Gi(this.ctx),s={createCanvasGraphics:d=>new w5(d,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};o=new kW(t,i,this.ctx,s,a)}else o=this._getPattern(t[1],t[2]);return o}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,o,i){const a=mo.makeHexColor(t,o,i);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,o,i){const a=mo.makeHexColor(t,o,i);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,o=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=Rwt(this.getObject(t)),this.cachedPatterns.set(t,i)),o&&(i.matrix=o),i}shadingFill(t){if(!this.contentVisible)return;const o=this.ctx;this.save();const i=this._getPattern(t);o.fillStyle=i.getPattern(o,this,Wp(o),zs.SHADING);const a=Wp(o);if(a){const{width:s,height:d}=o.canvas,[c,u,p,h]=mo.getAxialAlignedBoundingBox([0,0,s,d],a);this.ctx.fillRect(c,u,p-c,h-u)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){mi("Should not call beginInlineImage")}beginImageData(){mi("Should not call beginImageData")}paintFormXObjectBegin(t,o){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Gi(this.ctx),o)){const i=o[2]-o[0],a=o[3]-o[1];this.ctx.rect(o[0],o[1],i,a),this.current.updateRectMinMax(Gi(this.ctx),o),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 o=this.ctx;t.isolated||fA("TODO: Support non-isolated groups."),t.knockout&&hr("Knockout groups not supported.");const i=Gi(o);if(t.matrix&&o.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=mo.getAxialAlignedBoundingBox(t.bbox,Gi(o));const s=[0,0,o.canvas.width,o.canvas.height];a=mo.intersect(a,s)||[0,0,0,0];const d=Math.floor(a[0]),c=Math.floor(a[1]),u=Math.max(Math.ceil(a[2])-d,1),p=Math.max(Math.ceil(a[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,p]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(h,u,p),f=m.context;f.translate(-d,-c),f.transform(...i),t.smask?this.smaskStack.push({canvas:m.canvas,context:f,offsetX:d,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(o.setTransform(1,0,0,1,0,0),o.translate(d,c),o.save()),K6(o,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(o),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const o=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=Gi(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const s=mo.getAxialAlignedBoundingBox([0,0,o.canvas.width,o.canvas.height],a);this.ctx.drawImage(o.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(t,o,i,a,s){if(this.#e(),Kw(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),o){const d=o[2]-o[0],c=o[3]-o[1];if(s&&this.annotationCanvasMap){i=i.slice(),i[4]-=o[0],i[5]-=o[1],o=o.slice(),o[0]=o[1]=0,o[2]=d,o[3]=c;const[u,p]=mo.singularValueDecompose2dScale(Gi(this.ctx)),{viewportScale:h}=this,m=Math.ceil(d*this.outputScaleX*h),f=Math.ceil(c*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(u,0,0,-p,0,c*p),Kw(this.ctx)}else Kw(this.ctx),this.ctx.rect(o[0],o[1],d,c),this.ctx.clip(),this.endPath()}this.current=new jle(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),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 o=t.count;t=this.getObject(t.data,t),t.count=o;const i=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=Vwt(t)),a.compiled)){a.compiled(i);return}const s=this._createMaskCanvas(t),d=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(d,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,o,i=0,a=0,s,d){if(!this.contentVisible)return;t=this.getObject(t.data,t);const c=this.ctx;c.save();const u=Gi(c);c.transform(o,i,a,s,0,0);const p=this._createMaskCanvas(t);c.setTransform(1,0,0,1,p.offsetX-u[4],p.offsetY-u[5]);for(let h=0,m=d.length;h<m;h+=2){const f=mo.transform(u,[o,i,a,s,d[h],d[h+1]]),[x,y]=mo.applyTransform([0,0],f);c.drawImage(p.canvas,x,y)}c.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const o=this.ctx,i=this.current.fillColor,a=this.current.patternFill;for(const s of t){const{data:d,width:c,height:u,transform:p}=s,h=this.cachedCanvases.getCanvas("maskCanvas",c,u),m=h.context;m.save();const f=this.getObject(d,s);Mle(m,f),m.globalCompositeOperation="source-in",m.fillStyle=a?i.getPattern(m,this,Wp(o),zs.FILL):i,m.fillRect(0,0,c,u),m.restore(),o.save(),o.transform(...p),o.scale(1,-1),Yw(o,h.canvas,0,0,c,u,0,-1,1,1),o.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const o=this.getObject(t);if(!o){hr("Dependent image isn't ready yet");return}this.paintInlineImageXObject(o)}paintImageXObjectRepeat(t,o,i,a){if(!this.contentVisible)return;const s=this.getObject(t);if(!s){hr("Dependent image isn't ready yet");return}const d=s.width,c=s.height,u=[];for(let p=0,h=a.length;p<h;p+=2)u.push({transform:[o,0,0,i,a[p],a[p+1]],x:0,y:0,w:d,h:c});this.paintInlineImageXObjectGroup(s,u)}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:o,width:i,height:a}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,a),d=s.context;return d.filter=this.current.transferMaps,d.drawImage(o,0,0),d.filter="none",s.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const o=t.width,i=t.height,a=this.ctx;if(this.save(),!gs){const{filter:c}=a;c!=="none"&&c!==""&&(a.filter="none")}a.scale(1/o,-1/i);let s;if(t.bitmap)s=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)s=t;else{const u=this.cachedCanvases.getCanvas("inlineImage",o,i).context;Ile(u,t),s=this.applyTransferMapsToCanvas(u)}const d=this._scaleImage(s,Wp(a));a.imageSmoothingEnabled=Tle(Gi(a),t.interpolate),Yw(a,d.img,0,0,d.paintWidth,d.paintHeight,0,-i,o,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,o){if(!this.contentVisible)return;const i=this.ctx;let a;if(t.bitmap)a=t.bitmap;else{const s=t.width,d=t.height,u=this.cachedCanvases.getCanvas("inlineImage",s,d).context;Ile(u,t),a=this.applyTransferMapsToCanvas(u)}for(const s of o)i.save(),i.transform(...s.transform),i.scale(1,-1),Yw(i,a,s.x,s.y,s.w,s.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,o){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,o){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(o)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const o=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(o||(this.pendingClip===Ple?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Gi(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const o=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,a)/o}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:o,b:i,c:a,d:s}=this.ctx.getTransform();let d,c;if(i===0&&a===0){const u=Math.abs(o),p=Math.abs(s);if(u===p)if(t===0)d=c=1/u;else{const h=u*t;d=c=h<1?1/h:1}else if(t===0)d=1/u,c=1/p;else{const h=u*t,m=p*t;d=h<1?1/h:1,c=m<1?1/m:1}}else{const u=Math.abs(o*s-i*a),p=Math.hypot(o,i),h=Math.hypot(a,s);if(t===0)d=h/u,c=p/u;else{const m=t*u;d=h>m?h/m:1,c=p>m?p/m:1}}this._cachedScaleForStroking[0]=d,this._cachedScaleForStroking[1]=c}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:o}=this,{lineWidth:i}=this.current,[a,s]=this.getScaleForStroking();if(o.lineWidth=i||1,a===1&&s===1){o.stroke();return}const d=o.getLineDash();if(t&&o.save(),o.scale(a,s),d.length>0){const c=Math.max(a,s);o.setLineDash(d.map(u=>u/c)),o.lineDashOffset/=c}o.stroke(),t&&o.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 zc)w5.prototype[e]!==void 0&&(w5.prototype[zc[e]]=w5.prototype[e]);class ox{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 qw={DATA:1,ERROR:2},Bn={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Vl(e){switch(e instanceof Error||typeof e=="object"&&e!==null||mi('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new O3(e.message);case"MissingPDFException":return new F3(e.message);case"PasswordException":return new YO(e.message,e.code);case"UnexpectedResponseException":return new xA(e.message,e.status);case"UnknownErrorException":return new KO(e.message,e.details);default:return new KO(e.message,e.toString())}}class K8{constructor(t,o,i){this.sourceName=t,this.targetName=o,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=a=>{const s=a.data;if(s.targetName!==this.sourceName)return;if(s.stream){this.#t(s);return}if(s.callback){const c=s.callbackId,u=this.callbackCapabilities[c];if(!u)throw new Error(`Cannot resolve callback ${c}`);if(delete this.callbackCapabilities[c],s.callback===qw.DATA)u.resolve(s.data);else if(s.callback===qw.ERROR)u.reject(Vl(s.reason));else throw new Error("Unexpected callback case");return}const d=this.actionHandler[s.action];if(!d)throw new Error(`Unknown action from worker: ${s.action}`);if(s.callbackId){const c=this.sourceName,u=s.sourceName;new Promise(function(p){p(d(s.data))}).then(function(p){i.postMessage({sourceName:c,targetName:u,callback:qw.DATA,callbackId:s.callbackId,data:p})},function(p){i.postMessage({sourceName:c,targetName:u,callback:qw.ERROR,callbackId:s.callbackId,reason:Vl(p)})});return}if(s.streamId){this.#e(s);return}d(s.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,o){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=o}send(t,o,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:o},i)}sendWithPromise(t,o,i){const a=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[a]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:o},i)}catch(d){s.reject(d)}return s.promise}sendWithStream(t,o,i,a){const s=this.streamId++,d=this.sourceName,c=this.targetName,u=this.comObj;return new ReadableStream({start:p=>{const h=Promise.withResolvers();return this.streamControllers[s]={controller:p,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},u.postMessage({sourceName:d,targetName:c,action:t,streamId:s,data:o,desiredSize:p.desiredSize},a),h.promise},pull:p=>{const h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,u.postMessage({sourceName:d,targetName:c,stream:Bn.PULL,streamId:s,desiredSize:p.desiredSize}),h.promise},cancel:p=>{ra(p instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,u.postMessage({sourceName:d,targetName:c,stream:Bn.CANCEL,streamId:s,reason:Vl(p)}),h.promise}},i)}#e(t){const o=t.streamId,i=this.sourceName,a=t.sourceName,s=this.comObj,d=this,c=this.actionHandler[t.action],u={enqueue(p,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),s.postMessage({sourceName:i,targetName:a,stream:Bn.ENQUEUE,streamId:o,chunk:p},m)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:a,stream:Bn.CLOSE,streamId:o}),delete d.streamSinks[o])},error(p){ra(p instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:a,stream:Bn.ERROR,streamId:o,reason:Vl(p)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};u.sinkCapability.resolve(),u.ready=u.sinkCapability.promise,this.streamSinks[o]=u,new Promise(function(p){p(c(t.data,u))}).then(function(){s.postMessage({sourceName:i,targetName:a,stream:Bn.START_COMPLETE,streamId:o,success:!0})},function(p){s.postMessage({sourceName:i,targetName:a,stream:Bn.START_COMPLETE,streamId:o,reason:Vl(p)})})}#t(t){const o=t.streamId,i=this.sourceName,a=t.sourceName,s=this.comObj,d=this.streamControllers[o],c=this.streamSinks[o];switch(t.stream){case Bn.START_COMPLETE:t.success?d.startCall.resolve():d.startCall.reject(Vl(t.reason));break;case Bn.PULL_COMPLETE:t.success?d.pullCall.resolve():d.pullCall.reject(Vl(t.reason));break;case Bn.PULL:if(!c){s.postMessage({sourceName:i,targetName:a,stream:Bn.PULL_COMPLETE,streamId:o,success:!0});break}c.desiredSize<=0&&t.desiredSize>0&&c.sinkCapability.resolve(),c.desiredSize=t.desiredSize,new Promise(function(u){u(c.onPull?.())}).then(function(){s.postMessage({sourceName:i,targetName:a,stream:Bn.PULL_COMPLETE,streamId:o,success:!0})},function(u){s.postMessage({sourceName:i,targetName:a,stream:Bn.PULL_COMPLETE,streamId:o,reason:Vl(u)})});break;case Bn.ENQUEUE:if(ra(d,"enqueue should have stream controller"),d.isClosed)break;d.controller.enqueue(t.chunk);break;case Bn.CLOSE:if(ra(d,"close should have stream controller"),d.isClosed)break;d.isClosed=!0,d.controller.close(),this.#o(d,o);break;case Bn.ERROR:ra(d,"error should have stream controller"),d.controller.error(Vl(t.reason)),this.#o(d,o);break;case Bn.CANCEL_COMPLETE:t.success?d.cancelCall.resolve():d.cancelCall.reject(Vl(t.reason)),this.#o(d,o);break;case Bn.CANCEL:if(!c)break;new Promise(function(u){u(c.onCancel?.(Vl(t.reason)))}).then(function(){s.postMessage({sourceName:i,targetName:a,stream:Bn.CANCEL_COMPLETE,streamId:o,success:!0})},function(u){s.postMessage({sourceName:i,targetName:a,stream:Bn.CANCEL_COMPLETE,streamId:o,reason:Vl(u)})}),c.sinkCapability.reject(Vl(t.reason)),c.isCancelled=!0,delete this.streamSinks[o];break;default:throw new Error("Unexpected stream case")}}async#o(t,o){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[o]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class Gwt{#e;#t;constructor({parsedData:t,rawData:o}){this.#e=t,this.#t=o}getRaw(){return this.#t}get(t){return this.#e.get(t)??null}getAll(){return hW(this.#e)}has(t){return this.#e.has(t)}}const I0=Symbol("INTERNAL");class Ywt{#e=!1;#t=!1;#o=!1;#i=!0;constructor(t,{name:o,intent:i,usage:a}){this.#e=!!(t&jd.DISPLAY),this.#t=!!(t&jd.PRINT),this.name=o,this.intent=i,this.usage=a}get visible(){if(this.#o)return this.#i;if(!this.#i)return!1;const{print:t,view:o}=this.usage;return this.#e?o?.viewState!=="OFF":this.#t?t?.printState!=="OFF":!0}_setVisible(t,o,i=!1){t!==I0&&mi("Internal method `_setVisible` called."),this.#o=i,this.#i=o}}class Kwt{#e=null;#t=new Map;#o=null;#i=null;constructor(t,o=jd.DISPLAY){if(this.renderingIntent=o,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#i=t.order;for(const i of t.groups)this.#t.set(i.id,new Ywt(o,i));if(t.baseState==="OFF")for(const i of this.#t.values())i._setVisible(I0,!1);for(const i of t.on)this.#t.get(i)._setVisible(I0,!0);for(const i of t.off)this.#t.get(i)._setVisible(I0,!1);this.#o=this.getHash()}}#s(t){const o=t.length;if(o<2)return!0;const i=t[0];for(let a=1;a<o;a++){const s=t[a];let d;if(Array.isArray(s))d=this.#s(s);else if(this.#t.has(s))d=this.#t.get(s).visible;else return hr(`Optional content group not found: ${s}`),!0;switch(i){case"And":if(!d)return!1;break;case"Or":if(d)return!0;break;case"Not":return!d;default:return!0}}return i==="And"}isVisible(t){if(this.#t.size===0)return!0;if(!t)return fA("Optional content group not defined."),!0;if(t.type==="OCG")return this.#t.has(t.id)?this.#t.get(t.id).visible:(hr(`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 o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(this.#t.get(o).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(!this.#t.get(o).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(!this.#t.get(o).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(this.#t.get(o).visible)return!1}return!0}return hr(`Unknown optional content policy ${t.policy}.`),!0}return hr(`Unknown group type ${t.type}.`),!0}setVisibility(t,o=!0){const i=this.#t.get(t);if(!i){hr(`Optional content group not found: ${t}`);return}i._setVisible(I0,!!o,!0),this.#e=null}setOCGState({state:t,preserveRB:o}){let i;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":i=a;continue}const s=this.#t.get(a);if(s)switch(i){case"ON":s._setVisible(I0,!0);break;case"OFF":s._setVisible(I0,!1);break;case"Toggle":s._setVisible(I0,!s.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?hW(this.#t):null}getGroup(t){return this.#t.get(t)||null}getHash(){if(this.#e!==null)return this.#e;const t=new iCe;for(const[o,i]of this.#t)t.update(`${o}:${i.visible}`);return this.#e=t.hexdigest()}}class qwt{constructor(t,{disableRange:o=!1,disableStream:i=!1}){ra(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:s,progressiveDone:d,contentDispositionFilename:c}=t;if(this._queuedChunks=[],this._progressiveDone=d,this._contentDispositionFilename=c,s?.length>0){const u=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(u)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!o,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((u,p)=>{this._onReceiveData({begin:u,chunk:p})}),t.addProgressListener((u,p)=>{this._onProgress({loaded:u,total:p})}),t.addProgressiveReadListener(u=>{this._onReceiveData({chunk:u})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:o}){const i=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const a=this._rangeReaders.some(function(s){return s._begin!==t?!1:(s._enqueue(i),!0)});ra(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 o=this._rangeReaders.indexOf(t);o>=0&&this._rangeReaders.splice(o,1)}getFullReader(){ra(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Zwt(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,o){if(o<=this._progressiveDataLength)return null;const i=new Jwt(this,t,o);return this._pdfDataRangeTransport.requestDataRange(t,o),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeReaders.slice(0))o.cancel(t);this._pdfDataRangeTransport.abort()}}class Zwt{constructor(t,o,i=!1,a=null){this._stream=t,this._done=i||!1,this._filename=yW(a)?a:null,this._queuedChunks=o||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Jwt{constructor(t,o,i){this._stream=t,this._begin=o,this._end=i,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 i of this._requests)i.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 o=this._queuedChunk;return this._queuedChunk=null,{value:o,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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Xwt(e){let t=!0,o=i("filename\\*","i").exec(e);if(o){o=o[1];let h=c(o);return h=unescape(h),h=u(h),h=p(h),s(h)}if(o=d(e),o){const h=p(o);return s(h)}if(o=i("filename","i").exec(e),o){o=o[1];let h=c(o);return h=p(h),s(h)}function i(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=yA(m);m=f.decode(x),t=!1}catch{}}return m}function s(h){return t&&/[\x80-\xff]/.test(h)&&(h=a("utf-8",h),t&&(h=a("iso-8859-1",h))),h}function d(h){const m=[];let f;const x=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=x.exec(h))!==null;){let[,w,b,C]=f;if(w=parseInt(w,10),w in m){if(w===0)break;continue}m[w]=[b,C]}const y=[];for(let w=0;w<m.length&&w in m;++w){let[b,C]=m[w];C=c(C),b&&(C=unescape(C),w===0&&(C=u(C))),y.push(C)}return y.join("")}function c(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 u(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 p(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(w,b){return String.fromCharCode(parseInt(b,16))}),a(f,y);try{y=atob(y)}catch{}return a(f,y)})}return""}function SW({getResponseHeader:e,isHttp:t,rangeChunkSize:o,disableRange:i}){const a={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(e("Content-Length"),10);return!Number.isInteger(s)||(a.suggestedLength=s,s<=2*o)||i||!t||e("Accept-Ranges")!=="bytes"||(e("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function AW(e){const t=e("Content-Disposition");if(t){let o=Xwt(t);if(o.includes("%"))try{o=decodeURIComponent(o)}catch{}if(yW(o))return o}return null}function kA(e,t){return e===404||e===0&&t.startsWith("file:")?new F3('Missing PDF "'+t+'".'):new xA(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function sCe(e){return e===200||e===206}function lCe(e,t,o){return{method:"GET",headers:e,signal:o.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function dCe(e){const t=new Headers;for(const o in e){const i=e[o];i!==void 0&&t.append(o,i)}return t}function cCe(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(hr(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Ble{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 ra(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new ebt(this),this._fullRequestReader}getRangeReader(t,o){if(o<=this._progressiveDataLength)return null;const i=new tbt(this,t,o);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeRequestReaders.slice(0))o.cancel(t)}}class ebt{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const o=t.source;this._withCredentials=o.withCredentials||!1,this._contentLength=o.length,this._headersCapability=Promise.withResolvers(),this._disableRange=o.disableRange||!1,this._rangeChunkSize=o.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!o.disableStream,this._isRangeSupported=!o.disableRange,this._headers=dCe(this._stream.httpHeaders);const i=o.url;fetch(i,lCe(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!sCe(a.status))throw kA(a.status,i);this._reader=a.body.getReader(),this._headersCapability.resolve();const s=u=>a.headers.get(u),{allowRangeRequests:d,suggestedLength:c}=SW({getResponseHeader:s,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=d,this._contentLength=c||this._contentLength,this._filename=AW(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new O3("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:o}=await this._reader.read();return o?{value:t,done:o}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:cCe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class tbt{constructor(t,o,i){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=dCe(this._stream.httpHeaders),this._headers.append("Range",`bytes=${o}-${i-1}`);const s=a.url;fetch(s,lCe(this._headers,this._withCredentials,this._abortController)).then(d=>{if(!sCe(d.status))throw kA(d.status,s);this._readCapability.resolve(),this._reader=d.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:o}=await this._reader.read();return o?{value:t,done:o}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:cCe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}const j_=200,I_=206;function obt(e){const t=e.response;return typeof t!="string"?t:yA(t).buffer}class rbt{constructor(t,o={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&o.httpHeaders||Object.create(null),this.withCredentials=o.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,o,i){const a={begin:t,end:o};for(const s in i)a[s]=i[s];return this.request(a)}requestFull(t){return this.request(t)}request(t){const o=new XMLHttpRequest,i=this.currXhrId++,a=this.pendingRequests[i]={xhr:o};o.open("GET",this.url),o.withCredentials=this.withCredentials;for(const s in this.httpHeaders){const d=this.httpHeaders[s];d!==void 0&&o.setRequestHeader(s,d)}return this.isHttp&&"begin"in t&&"end"in t?(o.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.expectedStatus=I_):a.expectedStatus=j_,o.responseType="arraybuffer",t.onError&&(o.onerror=function(s){t.onError(o.status)}),o.onreadystatechange=this.onStateChange.bind(this,i),o.onprogress=this.onProgress.bind(this,i),a.onHeadersReceived=t.onHeadersReceived,a.onDone=t.onDone,a.onError=t.onError,a.onProgress=t.onProgress,o.send(null),i}onProgress(t,o){const i=this.pendingRequests[t];i&&i.onProgress?.(o)}onStateChange(t,o){const i=this.pendingRequests[t];if(!i)return;const a=i.xhr;if(a.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),a.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],a.status===0&&this.isHttp){i.onError?.(a.status);return}const s=a.status||j_;if(!(s===j_&&i.expectedStatus===I_)&&s!==i.expectedStatus){i.onError?.(a.status);return}const c=obt(a);if(s===I_){const u=a.getResponseHeader("Content-Range"),p=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);i.onDone({begin:parseInt(p[1],10),chunk:c})}else c?i.onDone({begin:0,chunk:c}):i.onError?.(a.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const o=this.pendingRequests[t].xhr;delete this.pendingRequests[t],o.abort()}}class ibt{constructor(t){this._source=t,this._manager=new rbt(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const o=this._rangeRequestReaders.indexOf(t);o>=0&&this._rangeRequestReaders.splice(o,1)}getFullReader(){return ra(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new nbt(this._manager,this._source),this._fullRequestReader}getRangeReader(t,o){const i=new abt(this._manager,t,o);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeRequestReaders.slice(0))o.cancel(t)}}class nbt{constructor(t,o){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=o.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=o.disableRange||!1,this._contentLength=o.length,this._rangeChunkSize=o.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,o=this._manager.getRequestXhr(t),i=d=>o.getResponseHeader(d),{allowRangeRequests:a,suggestedLength:s}=SW({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=AW(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=kA(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const o of this._requests)o.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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class abt{constructor(t,o,i){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(o,i,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 o=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:o,done:!1}):this._queuedChunk=o,this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=kA(t,this._url);for(const o of this._requests)o.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 o=this._queuedChunk;return this._queuedChunk=null,{value:o,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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const uCe=/^file:\/\/\/[a-zA-Z]:\//;function sbt(e){const t=up.get("url"),o=t.parse(e);return o.protocol==="file:"||o.host?o:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(o.host||(o.protocol="file:"),o)}class lbt{constructor(t){this.source=t,this.url=sbt(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 ra(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new ubt(this):new dbt(this),this._fullRequestReader}getRangeReader(t,o){if(o<=this._progressiveDataLength)return null;const i=this.isFsUrl?new pbt(this,t,o):new cbt(this,t,o);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeRequestReaders.slice(0))o.cancel(t)}}class pCe{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const o=t.source;this._contentLength=o.length,this._loaded=0,this._filename=null,this._disableRange=o.disableRange||!1,this._rangeChunkSize=o.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!o.disableStream,this._isRangeSupported=!o.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",o=>{this._error(o)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new O3("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class hCe{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 o=t.source;this._isStreamingSupported=!o.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",o=>{this._error(o)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function B$(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class dbt extends pCe{constructor(t){super(t);const o=i=>{if(i.statusCode===404){const c=new F3(`Missing PDF "${this._url}".`);this._storedError=c,this._headersCapability.reject(c);return}this._headersCapability.resolve(),this._setReadableStream(i);const a=c=>this._readableStream.headers[c.toLowerCase()],{allowRangeRequests:s,suggestedLength:d}=SW({getResponseHeader:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=d||this._contentLength,this._filename=AW(a)};if(this._request=null,this._url.protocol==="http:"){const i=up.get("http");this._request=i.request(B$(this._url,t.httpHeaders),o)}else{const i=up.get("https");this._request=i.request(B$(this._url,t.httpHeaders),o)}this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class cbt extends hCe{constructor(t,o,i){super(t),this._httpHeaders={};for(const s in t.httpHeaders){const d=t.httpHeaders[s];d!==void 0&&(this._httpHeaders[s]=d)}this._httpHeaders.Range=`bytes=${o}-${i-1}`;const a=s=>{if(s.statusCode===404){const d=new F3(`Missing PDF "${this._url}".`);this._storedError=d;return}this._setReadableStream(s)};if(this._request=null,this._url.protocol==="http:"){const s=up.get("http");this._request=s.request(B$(this._url,this._httpHeaders),a)}else{const s=up.get("https");this._request=s.request(B$(this._url,this._httpHeaders),a)}this._request.on("error",s=>{this._storedError=s}),this._request.end()}}class ubt extends pCe{constructor(t){super(t);let o=decodeURIComponent(this._url.path);uCe.test(this._url.href)&&(o=o.replace(/^\//,""));const i=up.get("fs");i.promises.lstat(o).then(a=>{this._contentLength=a.size,this._setReadableStream(i.createReadStream(o)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=new F3(`Missing PDF "${o}".`)),this._storedError=a,this._headersCapability.reject(a)})}}class pbt extends hCe{constructor(t,o,i){super(t);let a=decodeURIComponent(this._url.path);uCe.test(this._url.href)&&(a=a.replace(/^\//,""));const s=up.get("fs");this._setReadableStream(s.createReadStream(a,{start:o,end:i-1}))}}const hbt=1e5,tl=30,mbt=.8;let D$=class yu{#e=Promise.withResolvers();#t=null;#o=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#n=0;#l=0;#c=null;#u=null;#h=0;#d=0;#a=Object.create(null);#m=[];#f=null;#p=[];#y=new WeakMap;#g=null;static#w=new Map;static#v=new Map;static#$=null;static#S=new Set;constructor({textContentSource:t,container:o,viewport:i}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(u){u.enqueue(t),u.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#u=o,this.#d=i.scale*(globalThis.devicePixelRatio||1),this.#h=i.rotation,this.#r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:s,pageX:d,pageY:c}=i.rawDims;this.#g=[1,0,0,-1,-d,c+s],this.#l=a,this.#n=s,yu.#x(),y3(o,i),this.#e.promise.catch(()=>{}).then(()=>{yu.#S.delete(this),this.#r=null,this.#a=null})}render(){const t=()=>{this.#c.read().then(({value:o,done:i})=>{if(i){this.#e.resolve();return}this.#s??=o.lang,Object.assign(this.#a,o.styles),this.#A(o.items),t()},this.#e.reject)};return this.#c=this.#f.getReader(),yu.#S.add(this),t(),this.#e.promise}update({viewport:t,onBefore:o=null}){const i=t.scale*(globalThis.devicePixelRatio||1),a=t.rotation;if(a!==this.#h&&(o?.(),this.#h=a,y3(this.#u,{rotation:a})),i!==this.#d){o?.(),this.#d=i;const s={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:yu.#b(this.#s)};for(const d of this.#p)s.properties=this.#y.get(d),s.div=d,this.#k(s)}}cancel(){const t=new O3("TextLayer task cancelled.");this.#c?.cancel(t).catch(()=>{}),this.#c=null,this.#e.reject(t)}get textDivs(){return this.#p}get textContentItemsStr(){return this.#m}#A(t){if(this.#o)return;this.#r.ctx??=yu.#b(this.#s);const o=this.#p,i=this.#m;for(const a of t){if(o.length>hbt){hr("Ignoring additional textDivs for performance reasons."),this.#o=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const s=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id!==null&&this.#t.setAttribute("id",`${a.id}`),s.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}i.push(a.str),this.#I(a)}}#I(t){const o=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#p.push(o);const a=mo.transform(this.#g,t.transform);let s=Math.atan2(a[1],a[0]);const d=this.#a[t.fontName];d.vertical&&(s+=Math.PI/2);const c=this.#i&&d.fontSubstitution||d.fontFamily,u=Math.hypot(a[2],a[3]),p=u*yu.#C(c,this.#s);let h,m;s===0?(h=a[4],m=a[5]-p):(h=a[4]+p*Math.sin(s),m=a[5]-p*Math.cos(s));const f="calc(var(--scale-factor)*",x=o.style;this.#t===this.#u?(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}${(yu.#$*u).toFixed(2)}px)`,x.fontFamily=c,i.fontSize=u,o.setAttribute("role","presentation"),o.textContent=t.str,o.dir=t.dir,this.#i&&(o.dataset.fontName=d.fontSubstitutionLoadedName||t.fontName),s!==0&&(i.angle=s*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),b=Math.abs(t.transform[3]);w!==b&&Math.max(w,b)/Math.min(w,b)>1.5&&(y=!0)}if(y&&(i.canvasWidth=d.vertical?t.height:t.width),this.#y.set(o,i),this.#r.div=o,this.#r.properties=i,this.#k(this.#r),i.hasText&&this.#t.append(o),i.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),this.#t.append(w)}}#k(t){const{div:o,properties:i,ctx:a,prevFontSize:s,prevFontFamily:d}=t,{style:c}=o;let u="";if(yu.#$>1&&(u=`scale(${1/yu.#$})`),i.canvasWidth!==0&&i.hasText){const{fontFamily:p}=c,{canvasWidth:h,fontSize:m}=i;(s!==m||d!==p)&&(a.font=`${m*this.#d}px ${p}`,t.prevFontSize=m,t.prevFontFamily=p);const{width:f}=a.measureText(o.textContent);f>0&&(u=`scaleX(${h*this.#d/f}) ${u}`)}i.angle!==0&&(u=`rotate(${i.angle}deg) ${u}`),u.length>0&&(c.transform=u)}static cleanup(){if(!(this.#S.size>0)){this.#w.clear();for(const{canvas:t}of this.#v.values())t.remove();this.#v.clear()}}static#b(t=null){let o=this.#v.get(t||="");if(!o){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),o=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(t,o)}return o}static#x(){if(this.#$!==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.#$=t.getBoundingClientRect().height,t.remove()}static#C(t,o){const i=this.#w.get(t);if(i)return i;const a=this.#b(o),s=a.font;a.canvas.width=a.canvas.height=tl,a.font=`${tl}px ${t}`;const d=a.measureText("");let c=d.fontBoundingBoxAscent,u=Math.abs(d.fontBoundingBoxDescent);if(c){const m=c/(c+u);return this.#w.set(t,m),a.canvas.width=a.canvas.height=0,a.font=s,m}a.strokeStyle="red",a.clearRect(0,0,tl,tl),a.strokeText("g",0,0);let p=a.getImageData(0,0,tl,tl).data;u=0;for(let m=p.length-1-3;m>=0;m-=4)if(p[m]>0){u=Math.ceil(m/4/tl);break}a.clearRect(0,0,tl,tl),a.strokeText("A",0,tl),p=a.getImageData(0,0,tl,tl).data,c=0;for(let m=0,f=p.length;m<f;m+=4)if(p[m]>0){c=tl-Math.floor(m/4/tl);break}a.canvas.width=a.canvas.height=0,a.font=s;const h=c?c/(c+u):mbt;return this.#w.set(t,h),h}};function gbt(){oCe("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:e,container:t,viewport:o,...i}=arguments[0],a=Object.keys(i);a.length>0&&hr("Ignoring `renderTextLayer` parameters: "+a.join(", "));const s=new D$({textContentSource:e,container:t,viewport:o}),{textDivs:d,textContentItemsStr:c}=s;return{promise:s.render(),textDivs:d,textContentItemsStr:c}}function fbt(){oCe("`updateTextLayer`, please use `TextLayer` instead.")}class rx{static textContent(t){const o=[],i={items:o,styles:Object.create(null)};function a(s){if(!s)return;let d=null;const c=s.name;if(c==="#text")d=s.value;else if(rx.shouldBuildText(c))s?.attributes?.textContent?d=s.attributes.textContent:s.value&&(d=s.value);else return;if(d!==null&&o.push({str:d}),!!s.children)for(const u of s.children)a(u)}return a(t),i}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const xbt=65536,ybt=100,wbt=5e3,bbt=gs?Mwt:ywt,vbt=gs?Twt:eCe,Cbt=gs?Iwt:xwt,$bt=gs?Pwt:tCe;function kbt(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new EW,{docId:o}=t,i=e.url?Sbt(e.url):null,a=e.data?Abt(e.data):null,s=e.httpHeaders||null,d=e.withCredentials===!0,c=e.password??null,u=e.range instanceof mCe?e.range:null,p=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:xbt;let h=e.worker instanceof Pd?e.worker:null;const m=e.verbosity,f=typeof e.docBaseUrl=="string"&&!xW(e.docBaseUrl)?e.docBaseUrl:null,x=typeof e.cMapUrl=="string"?e.cMapUrl:null,y=e.cMapPacked!==!1,w=e.CMapReaderFactory||vbt,b=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,C=e.StandardFontDataFactory||$bt,$=e.stopAtErrors!==!0,A=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,E=e.isEvalSupported!==!1,I=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!gs,L=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,T=typeof e.disableFontFace=="boolean"?e.disableFontFace:gs,P=e.fontExtraProperties===!0,B=e.enableXfa===!0,_=e.ownerDocument||globalThis.document,R=e.disableRange===!0,z=e.disableStream===!0,Y=e.disableAutoFetch===!0,Z=e.pdfBug===!0,O=e.enableHWA===!0,U=u?u.length:e.length??NaN,F=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!gs&&!T,D=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:w===eCe&&C===tCe&&x&&b&&Y8(x,document.baseURI)&&Y8(b,document.baseURI),H=e.canvasFactory||new bbt({ownerDocument:_,enableHWA:O}),V=e.filterFactory||new Cbt({docId:o,ownerDocument:_}),te=null;awt(m);const q={canvasFactory:H,filterFactory:V};if(D||(q.cMapReaderFactory=new w({baseUrl:x,isCompressed:y}),q.standardFontDataFactory=new C({baseUrl:b})),!h){const X={verbosity:m,port:ox.workerPort};h=X.port?Pd.fromPort(X):new Pd(X),t._worker=h}const G={docId:o,apiVersion:"4.4.168",data:a,password:c,disableAutoFetch:Y,rangeChunkSize:p,length:U,docBaseUrl:f,enableXfa:B,evaluatorOptions:{maxImageSize:A,disableFontFace:T,ignoreErrors:$,isEvalSupported:E,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:L,fontExtraProperties:P,useSystemFonts:F,cMapUrl:D?x:null,standardFontDataUrl:D?b:null}},J={disableFontFace:T,fontExtraProperties:P,ownerDocument:_,pdfBug:Z,styleElement:te,loadingParams:{disableAutoFetch:Y,enableXfa:B}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const X=h.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let ae;if(u)ae=new qwt(u,{disableRange:R,disableStream:z});else if(!a){if(!i)throw new Error("getDocument - no `url` parameter provided.");ae=(pe=>gs?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&Y8(pe.url)?new Ble(pe):new lbt(pe):Y8(pe.url)?new Ble(pe):new ibt(pe))({url:i,length:U,httpHeaders:s,withCredentials:d,rangeChunkSize:p,disableRange:R,disableStream:z})}return X.then(xe=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const pe=new K8(o,xe,h.port),de=new Ibt(pe,t,ae,J,q);t._transport=de,pe.send("Ready",null)})}).catch(t._capability.reject),t}function Sbt(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(gs&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function Abt(e){if(gs&&typeof EC<"u"&&e instanceof EC)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 yA(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 Dle(e){return typeof e=="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class EW{static#e=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${EW.#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 mCe=class{constructor(t,o,i=!1,a=null){this.length=t,this.initialData=o,this.progressiveDone=i,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,o){for(const i of this._rangeListeners)i(t,o)}onDataProgress(t,o){this._readyCapability.promise.then(()=>{for(const i of this._progressListeners)i(t,o)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const o of this._progressiveReadListeners)o(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,o){mi("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class Ebt{constructor(t,o){this._pdfInfo=t,this._transport=o}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 zr(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:o}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(o)}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 Lbt{#e=null;#t=!1;constructor(t,o,i,a=!1){this._pageIndex=t,this._pageInfo=o,this._transport=i,this._stats=a?new vle:null,this._pdfBug=a,this.commonObjs=i.commonObjs,this.objs=new gCe,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:o=this.rotate,offsetX:i=0,offsetY:a=0,dontFlip:s=!1}={}){return new Jx({viewBox:this.view,scale:t,rotation:o,offsetX:i,offsetY:a,dontFlip:s})}getAnnotations({intent:t="display"}={}){const{renderingIntent:o}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,o)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return zr(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:o,intent:i="display",annotationMode:a=N0.ENABLE,transform:s=null,background:d=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:p=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(i,a,h),{renderingIntent:f,cacheKey:x}=m;this.#t=!1,this.#i(),c||=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 w=!!(f&jd.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const b=A=>{y.renderTasks.delete(C),(this._maybeCleanupAfterRender||w)&&(this.#t=!0),this.#o(!w),A?(C.capability.reject(A),this._abortOperatorList({intentState:y,reason:A instanceof Error?A:new Error(A)})):C.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},C=new i5({callback:b,params:{canvasContext:t,viewport:o,transform:s,background:d},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:p});(y.renderTasks||=new Set).add(C);const $=C.task;return Promise.all([y.displayReadyCapability.promise,c]).then(([A,E])=>{if(this.destroyed){b();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.");C.initializeGraphics({transparency:A,optionalContentConfig:E}),C.operatorListChanged()}).catch(b),$}getOperatorList({intent:t="display",annotationMode:o=N0.ENABLE,printAnnotationStorage:i=null}={}){function a(){d.operatorList.lastChunk&&(d.opListReadCapability.resolve(d.operatorList),d.renderTasks.delete(c))}const s=this._transport.getRenderingIntent(t,o,i,!0);let d=this._intentStates.get(s.cacheKey);d||(d=Object.create(null),this._intentStates.set(s.cacheKey,d));let c;return d.opListReadCapability||(c=Object.create(null),c.operatorListChanged=a,d.opListReadCapability=Promise.withResolvers(),(d.renderTasks||=new Set).add(c),d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),d.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:o=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:o===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>rx.textContent(i));const o=this.streamTextContent(t);return new Promise(function(i,a){function s(){d.read().then(function({value:u,done:p}){if(p){i(c);return}c.lang??=u.lang,Object.assign(c.styles,u.styles),c.items.push(...u.items),s()},a)}const d=o.getReader(),c={items:[],styles:Object.create(null),lang:null};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const o of this._intentStates.values())if(this._abortOperatorList({intentState:o,reason:new Error("Page was destroyed."),force:!0}),!o.opListReadCapability)for(const i of o.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#t=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#t=!0;const o=this.#o(!1);return t&&o&&(this._stats&&=new vle),o}#o(t=!1){if(this.#i(),!this.#t||this.destroyed)return!1;if(t)return this.#e=setTimeout(()=>{this.#e=null,this.#o(!1)},wbt),!1;for(const{renderTasks:o,operatorList:i}of this._intentStates.values())if(o.size>0||!i.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,o){const i=this._intentStates.get(o);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,o){for(let i=0,a=t.length;i<a;i++)o.operatorList.fnArray.push(t.fnArray[i]),o.operatorList.argsArray.push(t.argsArray[i]);o.operatorList.lastChunk=t.lastChunk,o.operatorList.separateAnnots=t.separateAnnots;for(const i of o.renderTasks)i.operatorListChanged();t.lastChunk&&this.#o(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:o,annotationStorageSerializable:i}){const{map:a,transfer:s}=i,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:o,annotationStorage:a},s).getReader(),u=this._intentStates.get(o);u.streamReader=c;const p=()=>{c.read().then(({value:h,done:m})=>{if(m){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),p())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const m of u.renderTasks)m.operatorListChanged();this.#o(!0)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};p()}_abortOperatorList({intentState:t,reason:o,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(o instanceof fW){let a=ybt;o.extraDelay>0&&o.extraDelay<1e3&&(a+=o.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:o,force:!0})},a);return}}if(t.streamReader.cancel(new O3(o.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,s]of this._intentStates)if(s===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}class jbt{#e=new Set;#t=Promise.resolve();postMessage(t,o){const i={data:structuredClone(t,o?{transfer:o}:null)};this.#t.then(()=>{for(const a of this.#e)a.call(this,i)})}addEventListener(t,o){this.#e.add(o)}removeEventListener(t,o){this.#e.delete(o)}terminate(){this.#e.clear()}}const rh={isWorkerDisabled:!1,fakeWorkerId:0};gs&&(rh.isWorkerDisabled=!0,ox.workerSrc||="./pdf.worker.mjs"),rh.isSameOrigin=function(e,t){let o;try{if(o=new URL(e),!o.origin||o.origin==="null")return!1}catch{return!1}const i=new URL(t,o);return o.origin===i.origin},rh.createCDNWrapper=function(e){const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class Pd{static#e;constructor({name:t=null,port:o=null,verbosity:i=swt()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,o){if(Pd.#e?.has(o))throw new Error("Cannot use more than one PDFWorker per port.");(Pd.#e||=new WeakMap).set(o,this),this._initializeFromPort(o);return}this._initialize()}get promise(){return gs?Promise.all([up.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 K8("main","worker",t),this._messageHandler.on("ready",function(){}),this.#t()}_initialize(){if(rh.isWorkerDisabled||Pd.#o){this._setupFakeWorker();return}let{workerSrc:t}=Pd;try{rh.isSameOrigin(window.location.href,t)||(t=rh.createCDNWrapper(new URL(t,window.location).href));const o=new Worker(t,{type:"module"}),i=new K8("main","worker",o),a=()=>{s.abort(),i.destroy(),o.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=new AbortController;o.addEventListener("error",()=>{this._webWorker||a()},{signal:s.signal}),i.on("test",c=>{if(s.abort(),this.destroyed||!c){a();return}this._messageHandler=i,this._port=o,this._webWorker=o,this.#t()}),i.on("ready",c=>{if(s.abort(),this.destroyed){a();return}try{d()}catch{this._setupFakeWorker()}});const d=()=>{const c=new Uint8Array;i.send("test",c,[c.buffer])};d();return}catch{fA("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){rh.isWorkerDisabled||(hr("Setting up fake worker."),rh.isWorkerDisabled=!0),Pd._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const o=new jbt;this._port=o;const i=`fake${rh.fakeWorkerId++}`,a=new K8(i+"_worker",i,o);t.setup(a,o),this._messageHandler=new K8(i,i+"_worker",o),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),Pd.#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 o=this.#e?.get(t.port);if(o){if(o._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return o}return new Pd(t)}static get workerSrc(){if(ox.workerSrc)return ox.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#o(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return zr(this,"_setupFakeWorkerGlobal",(async()=>this.#o?this.#o:(await import(this.workerSrc)).WorkerMessageHandler)())}}class Ibt{#e=new Map;#t=new Map;#o=new Map;#i=new Map;#s=null;constructor(t,o,i,a,s){this.messageHandler=t,this.loadingTask=o,this.commonObjs=new gCe,this.fontLoader=new Lwt({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,o=null){const i=this.#e.get(t);if(i)return i;const a=this.messageHandler.sendWithPromise(t,o);return this.#e.set(t,a),a}get annotationStorage(){return zr(this,"annotationStorage",new $W)}getRenderingIntent(t,o=N0.ENABLE,i=null,a=!1){let s=jd.DISPLAY,d=qO;switch(t){case"any":s=jd.ANY;break;case"display":break;case"print":s=jd.PRINT;break;default:hr(`getRenderingIntent - invalid intent: ${t}`)}switch(o){case N0.DISABLE:s+=jd.ANNOTATIONS_DISABLE;break;case N0.ENABLE:break;case N0.ENABLE_FORMS:s+=jd.ANNOTATIONS_FORMS;break;case N0.ENABLE_STORAGE:s+=jd.ANNOTATIONS_STORAGE,d=(s&jd.PRINT&&i instanceof nCe?i:this.annotationStorage).serializable;break;default:hr(`getRenderingIntent - invalid annotationMode: ${o}`)}return a&&(s+=jd.OPLIST),{renderingIntent:s,cacheKey:`${s}_${d.hash}`,annotationStorageSerializable:d}}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 i of this.#t.values())t.push(i._destroy());this.#t.clear(),this.#o.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const o=this.messageHandler.sendWithPromise("Terminate",null);return t.push(o),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),D$.cleanup(),this._networkStream?.cancelAllRequests(new O3("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:o}=this;t.on("GetReader",(i,a)=>{ra(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},a.onPull=()=>{this._fullReader.read().then(function({value:s,done:d}){if(d){a.close();return}ra(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{a.error(s)})},a.onCancel=s=>{this._fullReader.cancel(s),a.ready.catch(d=>{if(!this.destroyed)throw d})}}),t.on("ReaderHeadersReady",i=>{const a=Promise.withResolvers(),s=this._fullReader;return s.headersReady.then(()=>{(!s.isStreamingSupported||!s.isRangeSupported)&&(this._lastProgress&&o.onProgress?.(this._lastProgress),s.onProgress=d=>{o.onProgress?.({loaded:d.loaded,total:d.total})}),a.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},a.reject),a.promise}),t.on("GetRangeReader",(i,a)=>{ra(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(i.begin,i.end);if(!s){a.close();return}a.onPull=()=>{s.read().then(function({value:d,done:c}){if(c){a.close();return}ra(d instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(d),1,[d])}).catch(d=>{a.error(d)})},a.onCancel=d=>{s.cancel(d),a.ready.catch(c=>{if(!this.destroyed)throw c})}}),t.on("GetDoc",({pdfInfo:i})=>{this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,o._capability.resolve(new Ebt(i,this))}),t.on("DocException",function(i){let a;switch(i.name){case"PasswordException":a=new YO(i.message,i.code);break;case"InvalidPDFException":a=new Zve(i.message);break;case"MissingPDFException":a=new F3(i.message);break;case"UnexpectedResponseException":a=new xA(i.message,i.status);break;case"UnknownErrorException":a=new KO(i.message,i.details);break;default:mi("DocException - expected a valid Error.")}o._capability.reject(a)}),t.on("PasswordRequest",i=>{if(this.#s=Promise.withResolvers(),o.onPassword){const a=s=>{s instanceof Error?this.#s.reject(s):this.#s.resolve({password:s})};try{o.onPassword(a,i.code)}catch(s){this.#s.reject(s)}}else this.#s.reject(new YO(i.message,i.code));return this.#s.promise}),t.on("DataLoaded",i=>{o.onProgress?.({loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;this.#t.get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),t.on("commonobj",([i,a,s])=>{if(this.destroyed||this.commonObjs.has(i))return null;switch(a){case"Font":const{disableFontFace:d,fontExtraProperties:c,pdfBug:u}=this._params;if("error"in s){const f=s.error;hr(`Error during font loading: ${f}`),this.commonObjs.resolve(i,f);break}const p=u&&globalThis.FontInspector?.enabled?(f,x)=>globalThis.FontInspector.fontAdded(f,x):null,h=new jwt(s,{disableFontFace:d,inspectFont:p});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!c&&h.data&&(h.data=null),this.commonObjs.resolve(i,h)});break;case"CopyLocalImage":const{imageRef:m}=s;ra(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(i,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,s);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([i,a,s,d])=>{if(this.destroyed)return;const c=this.#t.get(a);if(!c.objs.has(i)){if(c._intentStates.size===0){d?.bitmap?.close();return}switch(s){case"Image":c.objs.resolve(i,d),d?.dataLen>owt&&(c._maybeCleanupAfterRender=!0);break;case"Pattern":c.objs.resolve(i,d);break;default:throw new Error(`Got unknown object type ${s}`)}}}),t.on("DocProgress",i=>{this.destroyed||o.onProgress?.({loaded:i.loaded,total:i.total})}),t.on("FetchBuiltInCMap",i=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(i):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",i=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(i):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&hr("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:o}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},o).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const o=t-1,i=this.#o.get(o);if(i)return i;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:o}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&this.#i.set(s.refStr,t);const d=new Lbt(o,s,this,this._params.pdfBug);return this.#t.set(o,d),d});return this.#o.set(o,a),a}getPageIndex(t){return Dle(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,o){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:o})}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(o=>new Kwt(o,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",o=this.#e.get(t);if(o)return o;const i=this.messageHandler.sendWithPromise(t,null).then(a=>({info:a[0],metadata:a[1]?new Gwt(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const o of this.#t.values())if(!o.cleanup())throw new Error(`startCleanup: Page ${o.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),D$.cleanup()}}cachedPageNumber(t){if(!Dle(t))return null;const o=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#i.get(o)??null}}const Zw=Symbol("INITIAL_DATA");class gCe{#e=Object.create(null);#t(t){return this.#e[t]||={...Promise.withResolvers(),data:Zw}}get(t,o=null){if(o){const a=this.#t(t);return a.promise.then(()=>o(a.data)),null}const i=this.#e[t];if(!i||i.data===Zw)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const o=this.#e[t];return!!o&&o.data!==Zw}resolve(t,o=null){const i=this.#t(t);i.data=o,i.resolve()}clear(){for(const t in this.#e){const{data:o}=this.#e[t];o?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const t in this.#e){const{data:o}=this.#e[t];o!==Zw&&(yield[t,o])}}}class Mbt{#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:o}=this.#e;return t.form||t.canvas&&o?.size>0}}class i5{#e=null;static#t=new WeakSet;constructor({callback:t,params:o,objs:i,commonObjs:a,annotationCanvasMap:s,operatorList:d,pageIndex:c,canvasFactory:u,filterFactory:p,useRequestAnimationFrame:h=!1,pdfBug:m=!1,pageColors:f=null}){this.callback=t,this.params=o,this.objs=i,this.commonObjs=a,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=d,this._pageIndex=c,this.canvasFactory=u,this.filterFactory=p,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 Mbt(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=o.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:o}){if(this.cancelled)return;if(this._canvas){if(i5.#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.");i5.#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:i,viewport:a,transform:s,background:d}=this.params;this.gfx=new w5(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:o},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:a,transparency:t,background:d}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,o=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),i5.#t.delete(this._canvas),this.callback(t||new fW(`Rendering cancelled, page ${this._pageIndex+1}`,o))}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(),i5.#t.delete(this._canvas),this.callback())))}}const Tbt="4.4.168",Pbt="19fbc8998";function _le(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function q6(e){return Math.max(0,Math.min(255,255*e))}class zle{static CMYK_G([t,o,i,a]){return["G",1-Math.min(1,.3*t+.59*i+.11*o+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=q6(t),[t,t,t]}static G_HTML([t]){const o=_le(t);return`#${o}${o}${o}`}static RGB_G([t,o,i]){return["G",.3*t+.59*o+.11*i]}static RGB_rgb(t){return t.map(q6)}static RGB_HTML(t){return`#${t.map(_le).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,o,i,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,i+a),1-Math.min(1,o+a)]}static CMYK_rgb([t,o,i,a]){return[q6(1-Math.min(1,t+a)),q6(1-Math.min(1,i+a)),q6(1-Math.min(1,o+a))]}static CMYK_HTML(t){const o=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(o)}static RGB_CMYK([t,o,i]){const a=1-t,s=1-o,d=1-i,c=Math.min(a,s,d);return["CMYK",a,s,d,c]}}class fCe{static setupStorage(t,o,i,a,s){const d=a.getValue(o,{value:null});switch(i.name){case"textarea":if(d.value!==null&&(t.textContent=d.value),s==="print")break;t.addEventListener("input",c=>{a.setValue(o,{value:c.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(d.value===i.attributes.xfaOn?t.setAttribute("checked",!0):d.value===i.attributes.xfaOff&&t.removeAttribute("checked"),s==="print")break;t.addEventListener("change",c=>{a.setValue(o,{value:c.target.checked?c.target.getAttribute("xfaOn"):c.target.getAttribute("xfaOff")})})}else{if(d.value!==null&&t.setAttribute("value",d.value),s==="print")break;t.addEventListener("input",c=>{a.setValue(o,{value:c.target.value})})}break;case"select":if(d.value!==null){t.setAttribute("value",d.value);for(const c of i.children)c.attributes.value===d.value?c.attributes.selected=!0:c.attributes.hasOwnProperty("selected")&&delete c.attributes.selected}t.addEventListener("input",c=>{const u=c.target.options,p=u.selectedIndex===-1?"":u[u.selectedIndex].value;a.setValue(o,{value:p})});break}}static setAttributes({html:t,element:o,storage:i=null,intent:a,linkService:s}){const{attributes:d}=o,c=t instanceof HTMLAnchorElement;d.type==="radio"&&(d.name=`${d.name}-${a}`);for(const[u,p]of Object.entries(d))if(p!=null)switch(u){case"class":p.length&&t.setAttribute(u,p.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",p);break;case"style":Object.assign(t.style,p);break;case"textContent":t.textContent=p;break;default:(!c||u!=="href"&&u!=="newWindow")&&t.setAttribute(u,p)}c&&s.addLinkAttributes(t,d.href,d.newWindow),i&&d.dataId&&this.setupStorage(t,d.dataId,o,i)}static render(t){const o=t.annotationStorage,i=t.linkService,a=t.xfaHtml,s=t.intent||"display",d=document.createElement(a.name);a.attributes&&this.setAttributes({html:d,element:a,intent:s,linkService:i});const c=s!=="richText",u=t.div;if(u.append(d),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;u.style.transform=m}c&&u.setAttribute("class","xfaLayer xfaFont");const p=[];if(a.children.length===0){if(a.value){const m=document.createTextNode(a.value);d.append(m),c&&rx.shouldBuildText(a.name)&&p.push(m)}return{textDivs:p}}const h=[[a,-1,d]];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:w}=y;if(w==="#text"){const C=document.createTextNode(y.value);p.push(C),x.append(C);continue}const b=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,w):document.createElement(w);if(x.append(b),y.attributes&&this.setAttributes({html:b,element:y,storage:o,intent:s,linkService:i}),y.children?.length>0)h.push([y,-1,b]);else if(y.value){const C=document.createTextNode(y.value);c&&rx.shouldBuildText(w)&&p.push(C),b.append(C)}}for(const m of u.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:p}}static update(t){const o=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=o,t.div.hidden=!1}}const ty=1e3,Bbt=9,w3=new WeakSet;function Eh(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class Dbt{static create(t){switch(t.data.annotationType){case Xn.LINK:return new xCe(t);case Xn.TEXT:return new _bt(t);case Xn.WIDGET:switch(t.data.fieldType){case"Tx":return new zbt(t);case"Btn":return t.data.radioButton?new yCe(t):t.data.checkBox?new Fbt(t):new Obt(t);case"Ch":return new Nbt(t);case"Sig":return new Rbt(t)}return new N3(t);case Xn.POPUP:return new eN(t);case Xn.FREETEXT:return new wCe(t);case Xn.LINE:return new Vbt(t);case Xn.SQUARE:return new Ubt(t);case Xn.CIRCLE:return new Wbt(t);case Xn.POLYLINE:return new bCe(t);case Xn.CARET:return new Gbt(t);case Xn.INK:return new vCe(t);case Xn.POLYGON:return new Qbt(t);case Xn.HIGHLIGHT:return new Ybt(t);case Xn.UNDERLINE:return new Kbt(t);case Xn.SQUIGGLY:return new qbt(t);case Xn.STRIKEOUT:return new Zbt(t);case Xn.STAMP:return new CCe(t);case Xn.FILEATTACHMENT:return new Jbt(t);default:return new jn(t)}}}class jn{#e=null;#t=!1;#o=null;constructor(t,{isRenderable:o=!1,ignoreBorder:i=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=o,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,o&&(this.container=this._createContainer(i)),a&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:o,richText:i}){return!!(t?.str||o?.str||i?.str)}get hasPopupData(){return jn._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:o}=t;o&&this.#i(o),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:o},data:{rect:i,rotation:a},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:d,pageX:c,pageY:u}}}}=this;i?.splice(0,4,...t);const{width:p,height:h}=Eh(t);o.left=`${100*(t[0]-c)/s}%`,o.top=`${100*(d-t[3]+u)/d}%`,a===0?(o.width=`${100*p/s}%`,o.height=`${100*h/d}%`):this.setRotation(a)}_createContainer(t){const{data:o,parent:{page:i,viewport:a}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",o.id),this instanceof N3||(s.tabIndex=ty);const{style:d}=s;if(d.zIndex=this.parent.zIndex++,o.popupRef&&s.setAttribute("aria-haspopup","dialog"),o.alternativeText&&(s.title=o.alternativeText),o.noRotate&&s.classList.add("norotate"),!o.rect||this instanceof eN){const{rotation:w}=o;return!o.hasOwnCanvas&&w!==0&&this.setRotation(w,s),s}const{width:c,height:u}=Eh(o.rect);if(!t&&o.borderStyle.width>0){d.borderWidth=`${o.borderStyle.width}px`;const w=o.borderStyle.horizontalCornerRadius,b=o.borderStyle.verticalCornerRadius;if(w>0||b>0){const $=`calc(${w}px * var(--scale-factor)) / calc(${b}px * var(--scale-factor))`;d.borderRadius=$}else if(this instanceof yCe){const $=`calc(${c}px * var(--scale-factor)) / calc(${u}px * var(--scale-factor))`;d.borderRadius=$}switch(o.borderStyle.style){case Y6.SOLID:d.borderStyle="solid";break;case Y6.DASHED:d.borderStyle="dashed";break;case Y6.BEVELED:hr("Unimplemented border style: beveled");break;case Y6.INSET:hr("Unimplemented border style: inset");break;case Y6.UNDERLINE:d.borderBottomStyle="solid";break}const C=o.borderColor||null;C?(this.#t=!0,d.borderColor=mo.makeHexColor(C[0]|0,C[1]|0,C[2]|0)):d.borderWidth=0}const p=mo.normalizeRect([o.rect[0],i.view[3]-o.rect[1]+i.view[1],o.rect[2],i.view[3]-o.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:m,pageX:f,pageY:x}=a.rawDims;d.left=`${100*(p[0]-f)/h}%`,d.top=`${100*(p[1]-x)/m}%`;const{rotation:y}=o;return o.hasOwnCanvas||y===0?(d.width=`${100*c/h}%`,d.height=`${100*u/m}%`):this.setRotation(y,s),s}setRotation(t,o=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:a}=this.parent.viewport.rawDims,{width:s,height:d}=Eh(this.data.rect);let c,u;t%180===0?(c=100*s/i,u=100*d/a):(c=100*d/i,u=100*s/a),o.style.width=`${c}%`,o.style.height=`${u}%`,o.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(o,i,a)=>{const s=a.detail[o],d=s[0],c=s.slice(1);a.target.style[i]=zle[`${d}_HTML`](c),this.annotationStorage.setValue(this.data.id,{[i]:zle[`${d}_rgb`](c)})};return zr(this,"_commonActions",{display:o=>{const{display:i}=o.detail,a=i%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:i===1||i===2})},print:o=>{this.annotationStorage.setValue(this.data.id,{noPrint:!o.detail.print})},hidden:o=>{const{hidden:i}=o.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:o=>{setTimeout(()=>o.target.focus({preventScroll:!1}),0)},userName:o=>{o.target.title=o.detail.userName},readonly:o=>{o.target.disabled=o.detail.readonly},required:o=>{this._setRequired(o.target,o.detail.required)},bgColor:o=>{t("bgColor","backgroundColor",o)},fillColor:o=>{t("fillColor","backgroundColor",o)},fgColor:o=>{t("fgColor","color",o)},textColor:o=>{t("textColor","color",o)},borderColor:o=>{t("borderColor","borderColor",o)},strokeColor:o=>{t("strokeColor","borderColor",o)},rotation:o=>{const i=o.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,o){const i=this._commonActions;for(const a of Object.keys(o.detail))(t[a]||i[a])?.(o)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const o=this.annotationStorage.getRawValue(this.data.id);if(!o)return;const i=this._commonActions;for(const[a,s]of Object.entries(o)){const d=i[a];if(d){const c={detail:{[a]:s},target:t};d(c),delete o[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[o,i,a,s]=this.data.rect.map(w=>Math.fround(w));if(t.length===8){const[w,b,C,$]=t.subarray(2,6);if(a===w&&s===b&&o===C&&i===$)return}const{style:d}=this.container;let c;if(this.#t){const{borderColor:w,borderWidth:b}=d;d.borderWidth=0,c=["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="${w}" stroke-width="${b}">`],this.container.classList.add("hasBorder")}const u=a-o,p=s-i,{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 w=2,b=t.length;w<b;w+=8){const C=t[w],$=t[w+1],A=t[w+2],E=t[w+3],I=h.createElement("rect"),L=(A-o)/u,T=(s-$)/p,P=(C-A)/u,B=($-E)/p;I.setAttribute("x",L),I.setAttribute("y",T),I.setAttribute("width",P),I.setAttribute("height",B),x.append(I),c?.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${T}" width="${P}" height="${B}"/>`)}this.#t&&(c.push("</g></svg>')"),d.backgroundImage=c.join("")),this.container.append(m),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:o}=this;t.setAttribute("aria-haspopup","dialog");const i=this.#o=new eN({data:{color:o.color,titleObj:o.titleObj,modificationDate:o.modificationDate,contentsObj:o.contentsObj,richText:o.richText,parentRect:o.rect,borderStyle:0,id:`popup_${o.id}`,rotation:o.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){mi("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,o=null){const i=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:s,id:d,exportValues:c}of a){if(s===-1||d===o)continue;const u=typeof c=="string"?c:null,p=document.querySelector(`[data-element-id="${d}"]`);if(p&&!w3.has(p)){hr(`_getElementsByName - element not allowed: ${d}`);continue}i.push({id:d,exportValue:u,domElement:p})}return i}for(const a of document.getElementsByName(t)){const{exportValue:s}=a,d=a.getAttribute("data-element-id");d!==o&&w3.has(a)&&i.push({id:d,exportValue:s,domElement:a})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const o of t)o.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:o}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:o})})}}class xCe extends jn{constructor(t,o=null){super(t,{isRenderable:!0,ignoreBorder:!!o?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:o}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let a=!1;return t.url?(o.addLinkAttributes(i,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(i,t.action),a=!0):t.attachment?(this.#t(i,t.attachment,t.attachmentDest),a=!0):t.setOCGState?(this.#o(i,t.setOCGState),a=!0):t.dest?(this._bindLink(i,t.dest),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),a=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(i,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(i),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(t,o){t.href=this.linkService.getDestinationHash(o),t.onclick=()=>(o&&this.linkService.goToDestination(o),!1),(o||o==="")&&this.#e()}_bindNamedAction(t,o){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(o),!1),this.#e()}#t(t,o,i=null){t.href=this.linkService.getAnchorUrl(""),o.description&&(t.title=o.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(o.content,o.filename,i),!1),this.#e()}#o(t,o){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(o),!1),this.#e()}_bindJSAction(t,o){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(o.actions)){const s=i.get(a);s&&(t[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o.id,name:a}}),!1))}t.onclick||(t.onclick=()=>!1),this.#e()}_bindResetFormAction(t,o){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){hr('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();const{fields:a,refs:s,include:d}=o,c=[];if(a.length!==0||s.length!==0){const h=new Set(s);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)===d&&c.push(f)}else for(const h of Object.values(this._fieldObjects))c.push(...h);const u=this.annotationStorage,p=[];for(const h of c){const{id:m}=h;switch(p.push(m),h.type){case"text":{const x=h.defaultValue||"";u.setValue(m,{value:x});break}case"checkbox":case"radiobutton":{const x=h.defaultValue===h.exportValues;u.setValue(m,{value:x});break}case"combobox":case"listbox":{const x=h.defaultValue||"";u.setValue(m,{value:x});break}default:continue}const f=document.querySelector(`[data-element-id="${m}"]`);if(f){if(!w3.has(f)){hr(`_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:p,name:"ResetForm"}}),!1}}}class _bt extends jn{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 N3 extends jn{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return gl.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,o,i,a,s){i.includes("mouse")?t.addEventListener(i,d=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(d),shift:d.shiftKey,modifier:this._getKeyModifier(d)}})}):t.addEventListener(i,d=>{if(i==="blur"){if(!o.focused||!d.relatedTarget)return;o.focused=!1}else if(i==="focus"){if(o.focused)return;o.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(d)}})})}_setEventListeners(t,o,i,a){for(const[s,d]of i)(d==="Action"||this.data.actions?.[d])&&((d==="Focus"||d==="Blur")&&(o||={focused:!1}),this._setEventListener(t,o,s,d,a),d==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,o,"blur","Blur",null):d==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,o,"focus","Focus",null))}_setBackgroundColor(t){const o=this.data.backgroundColor||null;t.style.backgroundColor=o===null?"transparent":mo.makeHexColor(o[0],o[1],o[2])}_setTextStyle(t){const o=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||Bbt,s=t.style;let d;const c=2,u=p=>Math.round(10*p)/10;if(this.data.multiLine){const p=Math.abs(this.data.rect[3]-this.data.rect[1]-c),h=Math.round(p/(S_*a))||1,m=p/h;d=Math.min(a,u(m/S_))}else{const p=Math.abs(this.data.rect[3]-this.data.rect[1]-c);d=Math.min(a,u(p/S_))}s.fontSize=`calc(${d}px * var(--scale-factor))`,s.color=mo.makeHexColor(i[0],i[1],i[2]),this.data.textAlignment!==null&&(s.textAlign=o[this.data.textAlignment])}_setRequired(t,o){o?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",o)}}class zbt extends N3{constructor(t){const o=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:o})}setPropertyOnSiblings(t,o,i,a){const s=this.annotationStorage;for(const d of this._getElementsByName(t.name,t.id))d.domElement&&(d.domElement[o]=i),s.setValue(d.id,{[a]:i})}render(){const t=this.annotationStorage,o=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=t.getValue(o,{value:this.data.fieldValue});let s=a.value||"";const d=t.getValue(o,{charLimit:this.data.maxLen}).charLimit;d&&s.length>d&&(s=s.slice(0,d));let c=a.formattedValue||this.data.textContent?.join(`
232
+ `);return t.join("")}}function Y8(e,t){try{const{protocol:o}=t?new URL(e,t):new URL(e);return o==="http:"||o==="https:"}catch{return!1}}function Cl(e){e.preventDefault()}function oCe(e){console.log("Deprecated API usage: "+e)}let Cle;class rCe{static toDateObject(t){if(!t||typeof t!="string")return null;Cle||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const o=Cle.exec(t);if(!o)return null;const i=parseInt(o[1],10);let a=parseInt(o[2],10);a=a>=1&&a<=12?a-1:0;let s=parseInt(o[3],10);s=s>=1&&s<=31?s:1;let d=parseInt(o[4],10);d=d>=0&&d<=23?d:0;let c=parseInt(o[5],10);c=c>=0&&c<=59?c:0;let u=parseInt(o[6],10);u=u>=0&&u<=59?u:0;const p=o[7]||"Z";let h=parseInt(o[8],10);h=h>=0&&h<=23?h:0;let m=parseInt(o[9],10)||0;return m=m>=0&&m<=59?m:0,p==="-"?(d+=h,c+=m):p==="+"&&(d-=h,c-=m),new Date(Date.UTC(i,a,s,d,c,u))}}function vwt(e,{scale:t=1,rotation:o=0}){const{width:i,height:a}=e.attributes.style,s=[0,0,parseInt(i),parseInt(a)];return new Jx({viewBox:s,scale:t,rotation:o})}function wW(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):(hr(`Not a valid color format: "${e}"`),[0,0,0])}function Cwt(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const o of e.keys()){t.style.color=o;const i=window.getComputedStyle(t).color;e.set(o,wW(i))}t.remove()}function Gi(e){const{a:t,b:o,c:i,d:a,e:s,f:d}=e.getTransform();return[t,o,i,a,s,d]}function Wp(e){const{a:t,b:o,c:i,d:a,e:s,f:d}=e.getTransform().invertSelf();return[t,o,i,a,s,d]}function y3(e,t,o=!1,i=!0){if(t instanceof Jx){const{pageWidth:a,pageHeight:s}=t.rawDims,{style:d}=e,c=gl.isCSSRoundSupported,u=`var(--scale-factor) * ${a}px`,p=`var(--scale-factor) * ${s}px`,h=c?`round(${u}, 1px)`:`calc(${u})`,m=c?`round(${p}, 1px)`:`calc(${p})`;!o||t.rotation%180===0?(d.width=h,d.height=m):(d.width=m,d.height=h)}i&&e.setAttribute("data-main-rotation",t.rotation)}class bW{#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 o=this.#o._uiManager._signal;t.addEventListener("contextmenu",Cl,{signal:o}),t.addEventListener("pointerdown",bW.#s,{signal:o});const i=this.#i=document.createElement("div");i.className="buttons",t.append(i);const a=this.#o.toolbarPosition;if(a){const{style:s}=t,d=this.#o._uiManager.direction==="ltr"?1-a[0]:a[0];s.insetInlineEnd=`${100*d}%`,s.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return this.#c(),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 o=this.#o._uiManager._signal;t.addEventListener("focusin",this.#r.bind(this),{capture:!0,signal:o}),t.addEventListener("focusout",this.#n.bind(this),{capture:!0,signal:o}),t.addEventListener("contextmenu",Cl,{signal:o})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden")}#c(){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",o=>{this.#o._uiManager.delete()},{signal:this.#o._uiManager._signal}),this.#i.append(t)}get#u(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#l(t),this.#i.prepend(t,this.#u)}addColorPicker(t){this.#t=t;const o=t.renderButton();this.#l(o),this.#i.prepend(o,this.#u)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class $wt{#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",Cl,{signal:this.#o._signal});const o=this.#e=document.createElement("div");return o.className="buttons",t.append(o),this.#r(),t}#s(t,o){let i=0,a=0;for(const s of t){const d=s.y+s.height;if(d<i)continue;const c=s.x+(o?s.width:0);if(d>i){a=c,i=d;continue}o?c>a&&(a=c):c<a&&(a=c)}return[o?1-a:a,i]}show(t,o,i){const[a,s]=this.#s(o,i),{style:d}=this.#t||=this.#i();t.append(this.#t),d.insetInlineEnd=`${100*a}%`,d.top=`calc(${100*s}% + 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 o=document.createElement("span");t.append(o),o.className="visuallyHidden",o.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=this.#o._signal;t.addEventListener("contextmenu",Cl,{signal:i}),t.addEventListener("click",()=>{this.#o.highlightSelection("floating_button")},{signal:i}),this.#e.append(t)}}function P$(e,t,o){for(const i of o)t.addEventListener(i,e[i].bind(e))}function kwt(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}class Swt{#e=0;get id(){return`${rwt}${this.#e++}`}}class vW{#e=fwt();#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>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=t;const s=a.decode().then(()=>(i.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return zr(this,"_isSVGFittingCanvas",s)}async#i(t,o){this.#o||=new Map;let i=this.#o.get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof o=="string"?(i.url=o,a=await $A(o,"blob")):a=i.file=o,a.type==="image/svg+xml"){const s=vW._isSVGFittingCanvas,d=new FileReader,c=new Image,u=new Promise((p,h)=>{c.onload=()=>{i.bitmap=c,i.isSvg=!0,p()},d.onload=async()=>{const m=i.svgUrl=d.result;c.src=await s?`${m}#svgView(preserveAspectRatio(none))`:m},c.onerror=d.onerror=h});d.readAsDataURL(a),await u}else i.bitmap=await createImageBitmap(a);i.refCounter=1}catch(a){console.error(a),i=null}return this.#o.set(t,i),i&&this.#o.set(i.id,i),i}async getFromFile(t){const{lastModified:o,name:i,size:a,type:s}=t;return this.#i(`${o}_${i}_${a}_${s}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromId(t){this.#o||=new Map;const o=this.#o.get(t);return o?o.bitmap?(o.refCounter+=1,o):o.file?this.getFromFile(o.file):this.getFromUrl(o.url):null}getSvgUrl(t){const o=this.#o.get(t);return o?.isSvg?o.svgUrl:null}deleteId(t){this.#o||=new Map;const o=this.#o.get(t);o&&(o.refCounter-=1,o.refCounter===0&&(o.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#e}_`)}}class Awt{#e=[];#t=!1;#o;#i=-1;constructor(t=128){this.#o=t}add({cmd:t,undo:o,post:i,mustExec:a,type:s=NaN,overwriteIfSameType:d=!1,keepUndo:c=!1}){if(a&&t(),this.#t)return;const u={cmd:t,undo:o,post:i,type:s};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(u);return}if(d&&this.#e[this.#i].type===s){c&&(u.undo=this.#e[this.#i].undo),this.#e[this.#i]=u;return}const p=this.#i+1;p===this.#o?this.#e.splice(0,1):(this.#i=p,p<this.#e.length&&this.#e.splice(p)),this.#e.push(u)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:t,post:o}=this.#e[this.#i];t(),o?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:t,post:o}=this.#e[this.#i];t(),o?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}destroy(){this.#e=null}}class Xx{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:o}=gl.platform;for(const[i,a,s={}]of t)for(const d of i){const c=d.startsWith("mac+");o&&c?(this.callbacks.set(d.slice(4),{callback:a,options:s}),this.allKeys.add(d.split("+").at(-1))):!o&&!c&&(this.callbacks.set(d,{callback:a,options:s}),this.allKeys.add(d.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 o=this.buffer.join("+");return this.buffer.length=0,o}exec(t,o){if(!this.allKeys.has(o.key))return;const i=this.callbacks.get(this.#e(o));if(!i)return;const{callback:a,options:{bubbles:s=!1,args:d=[],checker:c=null}}=i;c&&!c(t,o)||(a.bind(t,...d,o)(),s||(o.stopPropagation(),o.preventDefault()))}}class CW{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return Cwt(t),zr(this,"_colors",t)}convert(t){const o=wW(t);if(!window.matchMedia("(forced-colors: active)").matches)return o;for(const[i,a]of this._colors)if(a.every((s,d)=>s===o[d]))return CW._colorsMapping.get(i);return o}getHexCode(t){const o=this._colors.get(t);return o?mo.makeHexColor(...o):t}}class A2{#e=new AbortController;#t=null;#o=new Map;#i=new Map;#s=null;#r=null;#n=null;#l=new Awt;#c=0;#u=new Set;#h=null;#d=null;#a=new Set;#m=!1;#f=null;#p=null;#y=null;#g=!1;#w=null;#v=new Swt;#$=!1;#S=!1;#A=null;#I=null;#k=null;#b=jr.NONE;#x=new Set;#C=null;#E=null;#L=null;#T=this.blur.bind(this);#M=this.focus.bind(this);#D=this.copy.bind(this);#P=this.cut.bind(this);#_=this.paste.bind(this);#B=this.keydown.bind(this);#U=this.keyup.bind(this);#W=this.onEditingAction.bind(this);#H=this.onPageChanging.bind(this);#O=this.onScaleChanging.bind(this);#z=this.onRotationChanging.bind(this);#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#R=null;#N=null;#q=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=A2.prototype,o=d=>d.#N.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&d.hasSomethingToControl(),i=(d,{target:c})=>{if(c instanceof HTMLInputElement){const{type:u}=c;return u!=="text"&&u!=="number"}return!0},a=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return zr(this,"_keyboardManager",new Xx([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(d,{target:c})=>!(c instanceof HTMLButtonElement)&&d.#N.contains(c)&&!d.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(d,{target:c})=>!(c instanceof HTMLButtonElement)&&d.#N.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:o}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:o}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:o}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:o}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:o}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:o}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:o}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:o}]]))}constructor(t,o,i,a,s,d,c,u,p){this._signal=this.#e.signal,this.#N=t,this.#q=o,this.#s=i,this._eventBus=a,this._eventBus._on("editingaction",this.#W),this._eventBus._on("pagechanging",this.#H),this._eventBus._on("scalechanging",this.#O),this._eventBus._on("rotationchanging",this.#z),this.#ie(),this.#le(),this.#Z(),this.#r=s.annotationStorage,this.#f=s.filterFactory,this.#E=d,this.#y=c||null,this.#m=u,this.#k=p||null,this.viewParameters={realScale:K5.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#e?.abort(),this.#e=null,this._signal=null,this._eventBus._off("editingaction",this.#W),this._eventBus._off("pagechanging",this.#H),this._eventBus._off("scalechanging",this.#O),this._eventBus._off("rotationchanging",this.#z);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.#w?.hide(),this.#w=null,this.#p&&(clearTimeout(this.#p),this.#p=null),this.#R&&(clearTimeout(this.#R),this.#R=null)}async mlGuess(t){return this.#k?.guess(t)||null}get hasMLManager(){return!!this.#k}get hcmFilter(){return zr(this,"hcmFilter",this.#E?this.#f.addHCMFilter(this.#E.foreground,this.#E.background):"none")}get direction(){return zr(this,"direction",getComputedStyle(this.#N).direction)}get highlightColors(){return zr(this,"highlightColors",this.#y?new Map(this.#y.split(",").map(t=>t.split("=").map(o=>o.trim()))):null)}get highlightColorNames(){return zr(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#I=t}editAltText(t){this.#s?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#c=t-1}focusMainContainer(){this.#N.focus()}findParent(t,o){for(const i of this.#i.values()){const{x:a,y:s,width:d,height:c}=i.div.getBoundingClientRect();if(t>=a&&t<=a+d&&o>=s&&o<=s+c)return i}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*K5.PDF_TO_CSS_UNITS;for(const o of this.#a)o.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 o=document.getSelection();if(!o||o.isCollapsed)return;const{anchorNode:i,anchorOffset:a,focusNode:s,focusOffset:d}=o,c=o.toString(),p=this.#G(o).closest(".textLayer"),h=this.getSelectionBoxes(p);if(h){o.empty(),this.#b===jr.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:jr.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const m of this.#i.values())if(m.hasTextLayer(p)){m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:i,anchorOffset:a,focusNode:s,focusOffset:d,text:c});break}}}#oe(){const t=document.getSelection();if(!t||t.isCollapsed)return;const i=this.#G(t).closest(".textLayer"),a=this.getSelectionBoxes(i);a&&(this.#w||=new $wt(this),this.#w.show(i,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.#w?.hide(),this.#C=null,this.#j({hasSelectedText:!1}));return}const{anchorNode:o}=t;if(o===this.#C)return;if(!this.#G(t).closest(".textLayer")){this.#C&&(this.#w?.hide(),this.#C=null,this.#j({hasSelectedText:!1}));return}if(this.#w?.hide(),this.#C=o,this.#j({hasSelectedText:!0}),!(this.#b!==jr.HIGHLIGHT&&this.#b!==jr.NONE)&&(this.#b===jr.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#g=this.isShiftKeyDown,!this.isShiftKeyDown)){const s=this._signal,d=c=>{c.type==="pointerup"&&c.button!==0||(window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),c.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",d,{signal:s}),window.addEventListener("blur",d,{signal:s})}}#Y(t=""){this.#b===jr.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.#T,{signal:t})}#ae(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#T)}blur(){if(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const o of this.#x)if(o.div.contains(t)){this.#A=[o,t],o._focusEventsAllowed=!1;break}}focus(){if(!this.#A)return;const[t,o]=this.#A;this.#A=null,o.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),o.focus()}#Z(){const t=this._signal;window.addEventListener("keydown",this.#B,{signal:t}),window.addEventListener("keyup",this.#U,{signal:t})}#se(){window.removeEventListener("keydown",this.#B),window.removeEventListener("keyup",this.#U)}#J(){const t=this._signal;document.addEventListener("copy",this.#D,{signal:t}),document.addEventListener("cut",this.#P,{signal:t}),document.addEventListener("paste",this.#_,{signal:t})}#X(){document.removeEventListener("copy",this.#D),document.removeEventListener("cut",this.#P),document.removeEventListener("paste",this.#_)}#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:o}of t.dataTransfer.items)for(const i of this.#d)if(i.isHandlingMimeForPasting(o)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const o of t.dataTransfer.items)for(const i of this.#d)if(i.isHandlingMimeForPasting(o.type)){i.paste(o,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const o=[];for(const i of this.#x){const a=i.serialize(!0);a&&o.push(a)}o.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(o))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:o}=t;for(const s of o.items)for(const d of this.#d)if(d.isHandlingMimeForPasting(s.type)){d.paste(s,this.currentLayer);return}let i=o.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){hr(`paste: "${s.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();const a=this.currentLayer;try{const s=[];for(const u of i){const p=a.deserialize(u);if(!p)return;s.push(p)}const d=()=>{for(const u of s)this.#ee(u);this.#te(s)},c=()=>{for(const u of s)u.remove()};this.addCommands({cmd:d,undo:c,mustExec:!0})}catch(s){hr(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#b!==jr.NONE&&!this.isEditorHandlingKeyboard&&A2._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}}#j(t){Object.entries(t).some(([i,a])=>this.#K[i]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#b===jr.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#F([[Uo.HIGHLIGHT_FREE,!0]]))}#F(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ne(),this.#J(),this.#j({isEditing:this.#b!==jr.NONE,isEmpty:this.#Q(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#X(),this.#j({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#d){this.#d=t;for(const o of this.#d)this.#F(o.defaultPropertiesToUpdate)}}getId(){return this.#v.id}get currentLayer(){return this.#i.get(this.#c)}getLayer(t){return this.#i.get(t)}get currentPageIndex(){return this.#c}addLayer(t){this.#i.set(t.pageIndex,t),this.#$?t.enable():t.disable()}removeLayer(t){this.#i.delete(t.pageIndex)}updateMode(t,o=null,i=!1){if(this.#b!==t){if(this.#b=t,t===jr.NONE){this.setEditingState(!1),this.#ce();return}this.setEditingState(!0),this.#de(),this.unselectAll();for(const a of this.#i.values())a.updateMode(t);if(!o&&i){this.addNewEditorFromKeyboard();return}if(o){for(const a of this.#o.values())if(a.annotationElementId===o){this.setSelected(a),a.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#b&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,o){if(this.#d){switch(t){case Uo.CREATE:this.currentLayer.addNewEditor();return;case Uo.HIGHLIGHT_DEFAULT_COLOR:this.#I?.updateColor(o);break;case Uo.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#L||=new Map).set(t,o),this.showAllEditors("highlight",o);break}for(const i of this.#x)i.updateParams(t,o);for(const i of this.#d)i.updateDefaultParams(t,o)}}showAllEditors(t,o,i=!1){for(const s of this.#o.values())s.editorType===t&&s.show(o);(this.#L?.get(Uo.HIGHLIGHT_SHOW_ALL)??!0)!==o&&this.#F([[Uo.HIGHLIGHT_SHOW_ALL,o]])}enableWaiting(t=!1){if(this.#S!==t){this.#S=t;for(const o of this.#i.values())t?o.disableClick():o.enableClick(),o.div.classList.toggle("waiting",t)}}#de(){if(!this.#$){this.#$=!0;for(const t of this.#i.values())t.enable();for(const t of this.#o.values())t.enable()}}#ce(){if(this.unselectAll(),this.#$){this.#$=!1;for(const t of this.#i.values())t.disable();for(const t of this.#o.values())t.disable()}}getEditors(t){const o=[];for(const i of this.#o.values())i.pageIndex===t&&o.push(i);return o}getEditor(t){return this.#o.get(t)}addEditor(t){this.#o.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#p&&clearTimeout(this.#p),this.#p=setTimeout(()=>{this.focusMainContainer(),this.#p=null},0)),this.#o.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#u.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#u.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#u.has(t)}removeDeletedAnnotationElement(t){this.#u.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#ee(t){const o=this.#i.get(t.pageIndex);o?o.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#t!==t&&(this.#t=t,t&&this.#F(t.propertiesToUpdate))}get#ue(){let t=null;for(t of this.#x);return t}updateUI(t){this.#ue===t&&this.#F(t.propertiesToUpdate)}toggleSelected(t){if(this.#x.has(t)){this.#x.delete(t),t.unselect(),this.#j({hasSelectedEditor:this.hasSelection});return}this.#x.add(t),t.select(),this.#F(t.propertiesToUpdate),this.#j({hasSelectedEditor:!0})}setSelected(t){for(const o of this.#x)o!==t&&o.unselect();this.#x.clear(),this.#x.add(t),t.select(),this.#F(t.propertiesToUpdate),this.#j({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.#j({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.#j({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#Q()})}redo(){this.#l.redo(),this.#j({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#Q()})}addCommands(t){this.#l.add(t),this.#j({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#Q()})}#Q(){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],o=()=>{for(const a of t)a.remove()},i=()=>{for(const a of t)this.#ee(a)};this.addCommands({cmd:o,undo:i,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#te(t){for(const o of this.#x)o.unselect();this.#x.clear();for(const o of t)o.isEmpty()||(this.#x.add(o),o.select());this.#j({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.#b!==jr.NONE))&&this.hasSelection){for(const t of this.#x)t.unselect();this.#x.clear(),this.#j({hasSelectedEditor:!1})}}translateSelectedEditors(t,o,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=t,this.#V[1]+=o;const[a,s]=this.#V,d=[...this.#x],c=1e3;this.#R&&clearTimeout(this.#R),this.#R=setTimeout(()=>{this.#R=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const u of d)this.#o.has(u.id)&&u.translateInPage(a,s)},undo:()=>{for(const u of d)this.#o.has(u.id)&&u.translateInPage(-a,-s)},mustExec:!1})},c);for(const u of d)u.translateInPage(t,o)}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 o=!1;for(const[{x:a,y:s,pageIndex:d},c]of t)c.newX=a,c.newY=s,c.newPageIndex=d,o||=a!==c.savedX||s!==c.savedY||d!==c.savedPageIndex;if(!o)return!1;const i=(a,s,d,c)=>{if(this.#o.has(a.id)){const u=this.#i.get(c);u?a._setParentAndPosition(u,s,d):(a.pageIndex=c,a.x=s,a.y=d)}};return this.addCommands({cmd:()=>{for(const[a,{newX:s,newY:d,newPageIndex:c}]of t)i(a,s,d,c)},undo:()=>{for(const[a,{savedX:s,savedY:d,savedPageIndex:c}]of t)i(a,s,d,c)},mustExec:!0}),!0}dragSelectedEditors(t,o){if(this.#h)for(const i of this.#h.keys())i.drag(t,o)}rebuild(t){if(t.parent===null){const o=this.getLayer(t.pageIndex);o?(o.changeParent(t),o.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.#b}get imageManager(){return zr(this,"imageManager",new vW)}getSelectionBoxes(t){if(!t)return null;const o=document.getSelection();for(let p=0,h=o.rangeCount;p<h;p++)if(!t.contains(o.getRangeAt(p).commonAncestorContainer))return null;const{x:i,y:a,width:s,height:d}=t.getBoundingClientRect();let c;switch(t.getAttribute("data-main-rotation")){case"90":c=(p,h,m,f)=>({x:(h-a)/d,y:1-(p+m-i)/s,width:f/d,height:m/s});break;case"180":c=(p,h,m,f)=>({x:1-(p+m-i)/s,y:1-(h+f-a)/d,width:m/s,height:f/d});break;case"270":c=(p,h,m,f)=>({x:1-(h+f-a)/d,y:(p-i)/s,width:f/d,height:m/s});break;default:c=(p,h,m,f)=>({x:(p-i)/s,y:(h-a)/d,width:m/s,height:f/d});break}const u=[];for(let p=0,h=o.rangeCount;p<h;p++){const m=o.getRangeAt(p);if(!m.collapsed)for(const{x:f,y:x,width:y,height:w}of m.getClientRects())y===0||w===0||u.push(c(f,x,y,w))}return u.length===0?null:u}addChangedExistingAnnotation({annotationElementId:t,id:o}){(this.#n||=new Map).set(t,o)}removeChangedExistingAnnotation({annotationElementId:t}){this.#n?.delete(t)}renderAnnotationElement(t){const o=this.#n?.get(t.data.id);if(!o)return;const i=this.#r.getRawValue(o);i&&(this.#b===jr.NONE&&!i.hasBeenModified||i.renderAnnotationElement(t))}}class Gg{#e="";#t=!1;#o=null;#i=null;#s=null;#r=!1;#n=null;static _l10nPromise=null;constructor(t){this.#n=t}static initialize(t){Gg._l10nPromise||=t}async render(){const t=this.#o=document.createElement("button");t.className="altText";const o=await Gg._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=o,t.setAttribute("aria-label",o),t.tabIndex="0";const i=this.#n._uiManager._signal;t.addEventListener("contextmenu",Cl,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});const a=s=>{s.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",a,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(this.#r=!0,a(s))},{signal:i}),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:o}){this.#e===t&&this.#t===o||(this.#e=t,this.#t=o,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"),Gg._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(a=>{t.setAttribute("aria-label",a)});let o=this.#i;if(!o){this.#i=o=document.createElement("span"),o.className="tooltip",o.setAttribute("role","tooltip");const a=o.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",a);const s=100,d=this.#n._uiManager._signal;d.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"})},s)},{signal:d}),t.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:d})}o.innerText=this.#t?await Gg._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#e,o.parentNode||t.append(o),this.#n.getImageForAltText()?.setAttribute("aria-describedby",o.id)}}class Ro{#e=null;#t=null;#o=null;#i=!1;#s=!1;#r=null;#n=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#u=null;#h="";#d=!1;#a=null;#m=!1;#f=!1;#p=!1;#y=null;#g=0;#w=0;#v=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#$=!1;#S=Ro._zIndex++;static _borderLineWidth=-1;static _colorManager=new CW;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=Ro.prototype._resizeWithKeyboard,o=A2.TRANSLATE_SMALL,i=A2.TRANSLATE_BIG;return zr(this,"_resizerKeyboardManager",new Xx([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-o,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[o,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-o]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,o]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],Ro.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===Ro&&mi("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:o,rawDims:{pageWidth:i,pageHeight:a,pageX:s,pageY:d}}=this.parent.viewport;this.rotation=o,this.pageRotation=(360+o-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,a],this.pageTranslation=[s,d];const[c,u]=this.parentDimensions;this.x=t.x/c,this.y=t.y/u,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return zr(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const o=new Ewt({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});o.annotationElementId=t.annotationElementId,o.deleted=!0,o._uiManager.addToAnnotationStorage(o)}static initialize(t,o,i){if(Ro._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(s=>[s,t.get(s.replaceAll(/([A-Z])/g,d=>`-${d.toLowerCase()}`))])),i?.strings)for(const s of i.strings)Ro._l10nPromise.set(s,t.get(s));if(Ro._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);Ro._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,o){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,o){mi("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#$}set _isDraggable(t){this.#$=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,o]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*o/(t*2),this.y+=this.width*t/(o*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*o/(t*2),this.y-=this.width*t/(o*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.#S}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#B(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#d?this.#d=!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,o,i,a){const[s,d]=this.parentDimensions;[i,a]=this.screenToPageTranslation(i,a),this.x=(t+i)/s,this.y=(o+a)/d,this.fixAndSetPosition()}#A([t,o],i,a){[i,a]=this.screenToPageTranslation(i,a),this.x+=i/t,this.y+=a/o,this.fixAndSetPosition()}translate(t,o){this.#A(this.parentDimensions,t,o)}translateInPage(t,o){this.#a||=[this.x,this.y],this.#A(this.pageDimensions,t,o),this.div.scrollIntoView({block:"nearest"})}drag(t,o){this.#a||=[this.x,this.y];const[i,a]=this.parentDimensions;if(this.x+=t/i,this.y+=o/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:p,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,p,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:d}=this;const[c,u]=this.getBaseTranslation();s+=c,d+=u,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*d).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,o]=this.parentDimensions,{_borderLineWidth:i}=Ro,a=i/t,s=i/o;switch(this.rotation){case 90:return[-a,s];case 180:return[a,s];case 270:return[a,-s];default:return[-a,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[o,i]=this.pageDimensions;let{x:a,y:s,width:d,height:c}=this;if(d*=o,c*=i,a*=o,s*=i,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(o-d,a)),s=Math.max(0,Math.min(i-c,s));break;case 90:a=Math.max(0,Math.min(o-c,a)),s=Math.min(i,Math.max(d,s));break;case 180:a=Math.min(o,Math.max(d,a)),s=Math.min(i,Math.max(c,s));break;case 270:a=Math.min(o,Math.max(c,a)),s=Math.max(0,Math.min(i-d,s));break}this.x=a/=o,this.y=s/=i;const[u,p]=this.getBaseTranslation();a+=u,s+=p;const{style:h}=this.div;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#I(t,o,i){switch(i){case 90:return[o,-t];case 180:return[-t,-o];case 270:return[-o,t];default:return[t,o]}}screenToPageTranslation(t,o){return Ro.#I(t,o,this.parentRotation)}pageTranslationToScreen(t,o){return Ro.#I(t,o,360-this.parentRotation)}#k(t){switch(t){case 90:{const[o,i]=this.pageDimensions;return[0,-o/i,i/o,0]}case 180:return[-1,0,0,-1];case 270:{const[o,i]=this.pageDimensions;return[0,o/i,-i/o,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:[o,i]}=this,a=o*t,s=i*t;return gl.isCSSRoundSupported?[Math.round(a),Math.round(s)]:[a,s]}setDims(t,o){const[i,a]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*o/a).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:o,width:i}=t,a=i.endsWith("%"),s=!this.#s&&o.endsWith("%");if(a&&s)return;const[d,c]=this.parentDimensions;a||(t.width=`${(100*parseFloat(i)/d).toFixed(2)}%`),!this.#s&&!s&&(t.height=`${(100*parseFloat(o)/c).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#b(){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"],o=this._uiManager._signal;for(const i of t){const a=document.createElement("div");this.#r.append(a),a.classList.add("resizer",i),a.setAttribute("data-resizer-name",i),a.addEventListener("pointerdown",this.#x.bind(this,i),{signal:o}),a.addEventListener("contextmenu",Cl,{signal:o}),a.tabIndex=-1}this.div.prepend(this.#r)}#x(t,o){o.preventDefault();const{isMac:i}=gl.platform;if(o.button!==0||o.ctrlKey&&i)return;this.#o?.toggle(!1);const a=this.#E.bind(this,t),s=this._isDraggable;this._isDraggable=!1;const d=this._uiManager._signal,c={passive:!0,capture:!0,signal:d};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",a,c),window.addEventListener("contextmenu",Cl,{signal:d});const u=this.x,p=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(o.target).cursor;const y=()=>{this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=s,window.removeEventListener("pointerup",y),window.removeEventListener("blur",y),window.removeEventListener("pointermove",a,c),window.removeEventListener("contextmenu",Cl),this.parent.div.style.cursor=f,this.div.style.cursor=x,this.#C(u,p,h,m)};window.addEventListener("pointerup",y,{signal:d}),window.addEventListener("blur",y,{signal:d})}#C(t,o,i,a){const s=this.x,d=this.y,c=this.width,u=this.height;s===t&&d===o&&c===i&&u===a||this.addCommands({cmd:()=>{this.width=c,this.height=u,this.x=s,this.y=d;const[p,h]=this.parentDimensions;this.setDims(p*c,h*u),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=a,this.x=t,this.y=o;const[p,h]=this.parentDimensions;this.setDims(p*i,h*a),this.fixAndSetPosition()},mustExec:!0})}#E(t,o){const[i,a]=this.parentDimensions,s=this.x,d=this.y,c=this.width,u=this.height,p=Ro.MIN_SIZE/i,h=Ro.MIN_SIZE/a,m=F=>Math.round(F*1e4)/1e4,f=this.#k(this.rotation),x=(F,D)=>[f[0]*F+f[2]*D,f[1]*F+f[3]*D],y=this.#k(360-this.rotation),w=(F,D)=>[y[0]*F+y[2]*D,y[1]*F+y[3]*D];let b,C,$=!1,A=!1;switch(t){case"topLeft":$=!0,b=(F,D)=>[0,0],C=(F,D)=>[F,D];break;case"topMiddle":b=(F,D)=>[F/2,0],C=(F,D)=>[F/2,D];break;case"topRight":$=!0,b=(F,D)=>[F,0],C=(F,D)=>[0,D];break;case"middleRight":A=!0,b=(F,D)=>[F,D/2],C=(F,D)=>[0,D/2];break;case"bottomRight":$=!0,b=(F,D)=>[F,D],C=(F,D)=>[0,0];break;case"bottomMiddle":b=(F,D)=>[F/2,D],C=(F,D)=>[F/2,0];break;case"bottomLeft":$=!0,b=(F,D)=>[0,D],C=(F,D)=>[F,0];break;case"middleLeft":A=!0,b=(F,D)=>[0,D/2],C=(F,D)=>[F,D/2];break}const E=b(c,u),I=C(c,u);let L=x(...I);const T=m(s+L[0]),P=m(d+L[1]);let B=1,_=1,[R,z]=this.screenToPageTranslation(o.movementX,o.movementY);if([R,z]=w(R/i,z/a),$){const F=Math.hypot(c,u);B=_=Math.max(Math.min(Math.hypot(I[0]-E[0]-R,I[1]-E[1]-z)/F,1/c,1/u),p/c,h/u)}else A?B=Math.max(p,Math.min(1,Math.abs(I[0]-E[0]-R)))/c:_=Math.max(h,Math.min(1,Math.abs(I[1]-E[1]-z)))/u;const Y=m(c*B),Z=m(u*_);L=x(...C(Y,Z));const O=T-L[0],U=P-L[1];this.width=Y,this.height=Z,this.x=O,this.y=U,this.setDims(i*Y,a*Z),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this.#u||this.#f?this.#u:(this.#u=new bW(this),this.div.append(this.#u.render()),this.#o&&this.#u.addAltTextButton(await this.#o.render()),this.#u)}removeEditToolbar(){this.#u&&(this.#u.remove(),this.#u=null,this.#o?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(Gg.initialize(Ro._l10nPromise),this.#o=new Gg(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.#c,{signal:t});const[o,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/o).toFixed(2)}%`,this.div.style.maxHeight=`${(100*o/i).toFixed(2)}%`);const[a,s]=this.getInitialTranslation();return this.translate(a,s),P$(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:o}=gl.platform;if(t.button!==0||t.ctrlKey&&o){t.preventDefault();return}if(this.#d=!0,this._isDraggable){this.#T(t);return}this.#L(t)}#L(t){const{isMac:o}=gl.platform;t.ctrlKey&&!o||t.shiftKey||t.metaKey&&o?this.parent.toggleSelected(this):this.parent.setSelected(this)}#T(t){const o=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let i,a;const s=this._uiManager._signal;o&&(this.div.classList.add("moving"),i={passive:!0,capture:!0,signal:s},this.#g=t.clientX,this.#w=t.clientY,a=c=>{const{clientX:u,clientY:p}=c,[h,m]=this.screenToPageTranslation(u-this.#g,p-this.#w);this.#g=u,this.#w=p,this._uiManager.dragSelectedEditors(h,m)},window.addEventListener("pointermove",a,i));const d=()=>{window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),o&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",a,i)),this.#d=!1,this._uiManager.endDragSession()||this.#L(t)};window.addEventListener("pointerup",d,{signal:s}),window.addEventListener("blur",d,{signal:s})}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,o,i){t.changeParent(this),this.x=o,this.y=i,this.fixAndSetPosition()}getRect(t,o,i=this.rotation){const a=this.parentScale,[s,d]=this.pageDimensions,[c,u]=this.pageTranslation,p=t/a,h=o/a,m=this.x*s,f=this.y*d,x=this.width*s,y=this.height*d;switch(i){case 0:return[m+p+c,d-f-h-y+u,m+p+x+c,d-f-h+u];case 90:return[m+h+c,d-f+p+u,m+h+y+c,d-f+p+x+u];case 180:return[m-p-x+c,d-f+h+u,m-p+c,d-f+h+y+u];case 270:return[m-h-y+c,d-f-p-x+u,m-h+c,d-f-p+u];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,o){const[i,a,s,d]=t,c=s-i,u=d-a;switch(this.rotation){case 0:return[i,o-d,c,u];case 90:return[i,o-a,u,c];case 180:return[s,o-a,c,u];case 270:return[s,o-d,u,c];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.#p}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.#c,{signal:t})}rotate(t){}serialize(t=!1,o=null){mi("An editor must be serializable")}static deserialize(t,o,i){const a=new this.prototype.constructor({parent:o,id:o.getNextId(),uiManager:i});a.rotation=t.rotation,a.#e=t.accessibilityData;const[s,d]=a.pageDimensions,[c,u,p,h]=a.getRectInCurrentCoords(t.rect,d);return a.x=c/s,a.y=u/d,a.width=p/s,a.height=h/d,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#B(),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.#b(),this.#r.classList.remove("hidden"),P$(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 o=this.#r.children;if(!this.#t){this.#t=Array.from(o);const d=this.#M.bind(this),c=this.#D.bind(this),u=this._uiManager._signal;for(const p of this.#t){const h=p.getAttribute("data-resizer-name");p.setAttribute("role","spinbutton"),p.addEventListener("keydown",d,{signal:u}),p.addEventListener("blur",c,{signal:u}),p.addEventListener("focus",this.#P.bind(this,h),{signal:u}),Ro._l10nPromise.get(`pdfjs-editor-resizer-label-${h}`).then(m=>p.setAttribute("aria-label",m))}}const i=this.#t[0];let a=0;for(const d of o){if(d===i)break;a++}const s=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(s!==a){if(s<a)for(let c=0;c<a-s;c++)this.#r.append(this.#r.firstChild);else if(s>a)for(let c=0;c<s-a;c++)this.#r.firstChild.before(this.#r.lastChild);let d=0;for(const c of o){const p=this.#t[d++].getAttribute("data-resizer-name");Ro._l10nPromise.get(`pdfjs-editor-resizer-label-${p}`).then(h=>c.setAttribute("aria-label",h))}}this.#_(0),this.#p=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#M(t){Ro._resizerKeyboardManager.exec(this,t)}#D(t){this.#p&&t.relatedTarget?.parentNode!==this.#r&&this.#B()}#P(t){this.#h=this.#p?t:""}#_(t){if(this.#t)for(const o of this.#t)o.tabIndex=t}_resizeWithKeyboard(t,o){this.#p&&this.#E(this.#h,{movementX:t,movementY:o})}#B(){if(this.#p=!1,this.#_(-1),this.#n){const{savedX:t,savedY:o,savedWidth:i,savedHeight:a}=this.#n;this.#C(t,o,i,a),this.#n=null}}_stopResizingWithKeyboard(){this.#B(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#u){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#u?.show()});return}this.#u?.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.#u?.hide()}updateParams(t,o){}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,o){this.#s=!0;const i=t/o,{style:a}=this.div;a.aspectRatio=i,a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,o=!1){if(o){this.#v||=new Map;const{action:i}=t;let a=this.#v.get(i);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),this.#v.delete(i),this.#v.size===0&&(this.#v=null)},Ro._telemetryTimeout),this.#v.set(i,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 o=t.container.querySelector(".annotationContent");if(!o)o=document.createElement("div"),o.classList.add("annotationContent",this.editorType),t.container.prepend(o);else if(o.nodeName==="CANVAS"){const i=o;o=document.createElement("div"),o.classList.add("annotationContent",this.editorType),i.before(o)}return o}resetAnnotationElement(t){const{firstChild:o}=t.container;o.nodeName==="DIV"&&o.classList.contains("annotationContent")&&o.remove()}}class Ewt extends Ro{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const $le=3285377520,Cd=4294901760,hu=65535;class iCe{constructor(t){this.h1=t?t&4294967295:$le,this.h2=t?t&4294967295:$le}update(t){let o,i;if(typeof t=="string"){o=new Uint8Array(t.length*2),i=0;for(let w=0,b=t.length;w<b;w++){const C=t.charCodeAt(w);C<=255?o[i++]=C:(o[i++]=C>>>8,o[i++]=C&255)}}else if(ArrayBuffer.isView(t))o=t.slice(),i=o.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=i>>2,s=i-a*4,d=new Uint32Array(o.buffer,0,a);let c=0,u=0,p=this.h1,h=this.h2;const m=3432918353,f=461845907,x=m&hu,y=f&hu;for(let w=0;w<a;w++)w&1?(c=d[w],c=c*m&Cd|c*x&hu,c=c<<15|c>>>17,c=c*f&Cd|c*y&hu,p^=c,p=p<<13|p>>>19,p=p*5+3864292196):(u=d[w],u=u*m&Cd|u*x&hu,u=u<<15|u>>>17,u=u*f&Cd|u*y&hu,h^=u,h=h<<13|h>>>19,h=h*5+3864292196);switch(c=0,s){case 3:c^=o[a*4+2]<<16;case 2:c^=o[a*4+1]<<8;case 1:c^=o[a*4],c=c*m&Cd|c*x&hu,c=c<<15|c>>>17,c=c*f&Cd|c*y&hu,a&1?p^=c:h^=c}this.h1=p,this.h2=h}hexdigest(){let t=this.h1,o=this.h2;return t^=o>>>1,t=t*3981806797&Cd|t*36045&hu,o=o*4283543511&Cd|((o<<16|t>>>16)*2950163797&Cd)>>>16,t^=o>>>1,t=t*444984403&Cd|t*60499&hu,o=o*3301882366&Cd|((o<<16|t>>>16)*3120437893&Cd)>>>16,t^=o>>>1,(t>>>0).toString(16).padStart(8,"0")+(o>>>0).toString(16).padStart(8,"0")}}const qO=Object.freeze({map:null,hash:"",transfer:void 0});class $W{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,o){const i=this.#t.get(t);return i===void 0?o:Object.assign(o,i)}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 o of this.#t.values())if(o instanceof Ro)return;this.onAnnotationEditor(null)}}setValue(t,o){const i=this.#t.get(t);let a=!1;if(i!==void 0)for(const[s,d]of Object.entries(o))i[s]!==d&&(a=!0,i[s]=d);else a=!0,this.#t.set(t,o);a&&this.#o(),o instanceof Ro&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(o.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?hW(this.#t):null}setAll(t){for(const[o,i]of Object.entries(t))this.setValue(o,i)}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 nCe(this)}get serializable(){if(this.#t.size===0)return qO;const t=new Map,o=new iCe,i=[],a=Object.create(null);let s=!1;for(const[d,c]of this.#t){const u=c instanceof Ro?c.serialize(!1,a):c;u&&(t.set(d,u),o.update(`${d}:${JSON.stringify(u)}`),s||=!!u.bitmap)}if(s)for(const d of t.values())d.bitmap&&i.push(d.bitmap);return t.size>0?{map:t,hash:o.hexdigest(),transfer:i}:qO}get editorStats(){let t=null;const o=new Map;for(const i of this.#t.values()){if(!(i instanceof Ro))continue;const a=i.telemetryFinalData;if(!a)continue;const{type:s}=a;o.has(s)||o.set(s,Object.getPrototypeOf(i).constructor),t||=Object.create(null);const d=t[s]||=new Map;for(const[c,u]of Object.entries(a)){if(c==="type")continue;let p=d.get(c);p||(p=new Map,d.set(c,p));const h=p.get(u)??0;p.set(u,h+1)}}for(const[i,a]of o)t[i]=a.computeTelemetryFinalData(t[i]);return t}}class nCe extends $W{#e;constructor(t){super();const{map:o,hash:i,transfer:a}=t.serializable,s=structuredClone(o,a?{transfer:a}:null);this.#e={map:s,hash:i,transfer:a}}get print(){mi("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}class Lwt{#e=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:o=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 o=this.styleElement.sheet;o.insertRule(t,o.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:o}){if(!(!t||this.#e.has(t.loadedName))){if(ra(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:i,src:a,style:s}=t,d=new FontFace(i,a,s);this.addNativeFontFace(d);try{await d.load(),this.#e.add(i),o?.(t)}catch{hr(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(d)}return}mi("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 i=t.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(a){throw hr(`Failed to load font '${i.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const o=t.createFontFaceRule();if(o){if(this.insertRule(o),this.isSyncFontLoadingSupported)return;await new Promise(i=>{const a=this._queueLoadingCallback(i);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return zr(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(gs||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),zr(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function o(){for(ra(!a.done,"completeRequest() cannot be called twice."),a.done=!0;i.length>0&&i[0].done;){const s=i.shift();setTimeout(s.callback,0)}}const{loadingRequests:i}=this,a={done:!1,complete:o,callback:t};return i.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return zr(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,o){function i(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,T){const P=E.substring(0,I),B=E.substring(I+L);return P+T+B}let s,d;const c=this._document.createElement("canvas");c.width=1,c.height=1;const u=c.getContext("2d");let p=0;function h(E,I){if(++p>30){hr("Load test font never loaded."),I();return}if(u.font="30px "+E,u.fillText(".",0,20),u.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,w=1482184792;let b=i(f,y);for(s=0,d=m.length-3;s<d;s+=4)b=b-w+i(m,s)|0;s<m.length&&(b=b-w+i(m+"XXX",s)|0),f=a(f,y,4,uwt(b));const C=`url(data:font/opentype;base64,${btoa(f)});`,$=`@font-face {font-family:"${m}";src:${C}}`;this.insertRule($);const A=this._document.createElement("div");A.style.visibility="hidden",A.style.width=A.style.height="10px",A.style.position="absolute",A.style.top=A.style.left="0px";for(const E of[t.loadedName,m]){const I=this._document.createElement("span");I.textContent="Hi",I.style.fontFamily=E,A.append(I)}this._document.body.append(A),h(m,()=>{A.remove(),o.complete()})}}class jwt{constructor(t,{disableFontFace:o=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.disableFontFace=o===!0,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const o={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(o.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,o)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=Jve(this.data),o=`url(data:${this.mimetype};base64,${btoa(t)});`;let i;if(!this.cssFontInfo)i=`@font-face {font-family:"${this.loadedName}";src:${o}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${o}}`}return this._inspectFont?.(this,o),i}getPathGenerator(t,o){if(this.compiledGlyphs[o]!==void 0)return this.compiledGlyphs[o];let i;try{i=t.get(this.loadedName+"_path_"+o)}catch(s){hr(`getPathGenerator - ignoring character: "${s}".`)}if(!Array.isArray(i)||i.length===0)return this.compiledGlyphs[o]=function(s,d){};const a=[];for(let s=0,d=i.length;s<d;)switch(i[s++]){case Up.BEZIER_CURVE_TO:{const[c,u,p,h,m,f]=i.slice(s,s+6);a.push(x=>x.bezierCurveTo(c,u,p,h,m,f)),s+=6}break;case Up.MOVE_TO:{const[c,u]=i.slice(s,s+2);a.push(p=>p.moveTo(c,u)),s+=2}break;case Up.LINE_TO:{const[c,u]=i.slice(s,s+2);a.push(p=>p.lineTo(c,u)),s+=2}break;case Up.QUADRATIC_CURVE_TO:{const[c,u,p,h]=i.slice(s,s+4);a.push(m=>m.quadraticCurveTo(c,u,p,h)),s+=4}break;case Up.RESTORE:a.push(c=>c.restore());break;case Up.SAVE:a.push(c=>c.save());break;case Up.SCALE:ra(a.length===2,"Scale command is only valid at the third position.");break;case Up.TRANSFORM:{const[c,u,p,h,m,f]=i.slice(s,s+6);a.push(x=>x.transform(c,u,p,h,m,f)),s+=6}break;case Up.TRANSLATE:{const[c,u]=i.slice(s,s+2);a.push(p=>p.translate(c,u)),s+=2}break}return this.compiledGlyphs[o]=function(d,c){a[0](d),a[1](d),d.scale(c,-c);for(let u=2,p=a.length;u<p;u++)a[u](d)}}}if(gs){var ZO=Promise.withResolvers(),JO=null;(async()=>{const t=await Og(()=>import("./empty-C4jycCdP.js").then(c=>c.e),__vite__mapDeps([0,1,2])),o=await Og(()=>import("./index-BRv9f-n4.js").then(c=>c.i),__vite__mapDeps([3,1,4,5,6,7,8,9])),i=await Og(()=>import("./index-C6nGAUOI.js").then(c=>c.i),__vite__mapDeps([10,1,11,4,5,6,7,8,9])),a=await Og(()=>import("./url-BfdLx8mq.js").then(c=>c.u),__vite__mapDeps([12,1,9,7,5,6,8]));let s,d;return new Map(Object.entries({fs:t,http:o,https:i,url:a,canvas:s,path2d:d}))})().then(t=>{JO=t,ZO.resolve()},t=>{hr(`loadPackages: ${t}`),JO=new Map,ZO.resolve()})}class up{static get promise(){return ZO.promise}static get(t){return JO?.get(t)}}const aCe=function(e){return up.get("fs").promises.readFile(e).then(o=>new Uint8Array(o))};class Iwt extends wA{}class Mwt extends bA{_createCanvas(t,o){return up.get("canvas").createCanvas(t,o)}}class Twt extends vA{_fetchData(t,o){return aCe(t).then(i=>({cMapData:i,compressionType:o}))}}class Pwt extends CA{_fetchData(t){return aCe(t)}}const zs={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function XO(e,t){if(!t)return;const o=t[2]-t[0],i=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],o,i),e.clip(a)}class ey{constructor(){this.constructor===ey&&mi("Cannot initialize BaseShadingPattern.")}getPattern(){mi("Abstract method `getPattern` called.")}}class Bwt extends ey{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 o;this._type==="axial"?o=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(o=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)o.addColorStop(i[0],i[1]);return o}getPattern(t,o,i,a){let s;if(a===zs.STROKE||a===zs.FILL){const d=o.current.getClippedPathBoundingBox(a,Gi(t))||[0,0,0,0],c=Math.ceil(d[2]-d[0])||1,u=Math.ceil(d[3]-d[1])||1,p=o.cachedCanvases.getCanvas("pattern",c,u,!0),h=p.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(-d[0],-d[1]),i=mo.transform(i,[1,0,0,1,d[0],d[1]]),h.transform(...o.baseTransform),this.matrix&&h.transform(...this.matrix),XO(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),s=t.createPattern(p.canvas,"no-repeat");const m=new DOMMatrix(i);s.setTransform(m)}else XO(t,this._bbox),s=this._createGradient(t);return s}}function L_(e,t,o,i,a,s,d,c){const u=t.coords,p=t.colors,h=e.data,m=e.width*4;let f;u[o+1]>u[i+1]&&(f=o,o=i,i=f,f=s,s=d,d=f),u[i+1]>u[a+1]&&(f=i,i=a,a=f,f=d,d=c,c=f),u[o+1]>u[i+1]&&(f=o,o=i,i=f,f=s,s=d,d=f);const x=(u[o]+t.offsetX)*t.scaleX,y=(u[o+1]+t.offsetY)*t.scaleY,w=(u[i]+t.offsetX)*t.scaleX,b=(u[i+1]+t.offsetY)*t.scaleY,C=(u[a]+t.offsetX)*t.scaleX,$=(u[a+1]+t.offsetY)*t.scaleY;if(y>=$)return;const A=p[s],E=p[s+1],I=p[s+2],L=p[d],T=p[d+1],P=p[d+2],B=p[c],_=p[c+1],R=p[c+2],z=Math.round(y),Y=Math.round($);let Z,O,U,F,D,H,V,te;for(let q=z;q<=Y;q++){if(q<b){const xe=q<y?0:(y-q)/(y-b);Z=x-(x-w)*xe,O=A-(A-L)*xe,U=E-(E-T)*xe,F=I-(I-P)*xe}else{let xe;q>$?xe=1:b===$?xe=0:xe=(b-q)/(b-$),Z=w-(w-C)*xe,O=L-(L-B)*xe,U=T-(T-_)*xe,F=P-(P-R)*xe}let G;q<y?G=0:q>$?G=1:G=(y-q)/(y-$),D=x-(x-C)*G,H=A-(A-B)*G,V=E-(E-_)*G,te=I-(I-R)*G;const J=Math.round(Math.min(Z,D)),X=Math.round(Math.max(Z,D));let ae=m*q+J*4;for(let xe=J;xe<=X;xe++)G=(Z-xe)/(Z-D),G<0?G=0:G>1&&(G=1),h[ae++]=O-(O-H)*G|0,h[ae++]=U-(U-V)*G|0,h[ae++]=F-(F-te)*G|0,h[ae++]=255}}function Dwt(e,t,o){const i=t.coords,a=t.colors;let s,d;switch(t.type){case"lattice":const c=t.verticesPerRow,u=Math.floor(i.length/c)-1,p=c-1;for(s=0;s<u;s++){let h=s*c;for(let m=0;m<p;m++,h++)L_(e,o,i[h],i[h+1],i[h+c],a[h],a[h+1],a[h+c]),L_(e,o,i[h+c+1],i[h+1],i[h+c],a[h+c+1],a[h+1],a[h+c])}break;case"triangles":for(s=0,d=i.length;s<d;s+=3)L_(e,o,i[s],i[s+1],i[s+2],a[s],a[s+1],a[s+2]);break;default:throw new Error("illegal figure")}}class _wt extends ey{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,o,i){const c=Math.floor(this._bounds[0]),u=Math.floor(this._bounds[1]),p=Math.ceil(this._bounds[2])-c,h=Math.ceil(this._bounds[3])-u,m=Math.min(Math.ceil(Math.abs(p*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),x=p/m,y=h/f,w={coords:this._coords,colors:this._colors,offsetX:-c,offsetY:-u,scaleX:1/x,scaleY:1/y},b=m+2*2,C=f+2*2,$=i.getCanvas("mesh",b,C,!1),A=$.context,E=A.createImageData(m,f);if(o){const L=E.data;for(let T=0,P=L.length;T<P;T+=4)L[T]=o[0],L[T+1]=o[1],L[T+2]=o[2],L[T+3]=255}for(const L of this._figures)Dwt(E,L,w);return A.putImageData(E,2,2),{canvas:$.canvas,offsetX:c-2*x,offsetY:u-2*y,scaleX:x,scaleY:y}}getPattern(t,o,i,a){XO(t,this._bbox);let s;if(a===zs.SHADING)s=mo.singularValueDecompose2dScale(Gi(t));else if(s=mo.singularValueDecompose2dScale(o.baseTransform),this.matrix){const c=mo.singularValueDecompose2dScale(this.matrix);s=[s[0]*c[0],s[1]*c[1]]}const d=this._createMeshCanvas(s,a===zs.SHADING?null:this._background,o.cachedCanvases);return a!==zs.SHADING&&(t.setTransform(...o.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(d.offsetX,d.offsetY),t.scale(d.scaleX,d.scaleY),t.createPattern(d.canvas,"no-repeat")}}class zwt extends ey{getPattern(){return"hotpink"}}function Rwt(e){switch(e[0]){case"RadialAxial":return new Bwt(e);case"Mesh":return new _wt(e);case"Dummy":return new zwt}throw new Error(`Unknown IR type: ${e[0]}`)}const kle={COLORED:1,UNCOLORED:2};class kW{static MAX_PATTERN_SIZE=3e3;constructor(t,o,i,a,s){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=o,this.ctx=i,this.canvasGraphicsFactory=a,this.baseTransform=s}createPatternCanvas(t){const o=this.operatorList,i=this.bbox,a=this.xstep,s=this.ystep,d=this.paintType,c=this.tilingType,u=this.color,p=this.canvasGraphicsFactory;fA("TilingType: "+c);const h=i[0],m=i[1],f=i[2],x=i[3],y=mo.singularValueDecompose2dScale(this.matrix),w=mo.singularValueDecompose2dScale(this.baseTransform),b=[y[0]*w[0],y[1]*w[1]],C=this.getSizeAndScale(a,this.ctx.canvas.width,b[0]),$=this.getSizeAndScale(s,this.ctx.canvas.height,b[1]),A=t.cachedCanvases.getCanvas("pattern",C.size,$.size,!0),E=A.context,I=p.createCanvasGraphics(E);I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,d,u);let L=h,T=m,P=f,B=x;return h<0&&(L=0,P+=Math.abs(h)),m<0&&(T=0,B+=Math.abs(m)),E.translate(-(C.scale*L),-($.scale*T)),I.transform(C.scale,0,0,$.scale,0,0),E.save(),this.clipBbox(I,L,T,P,B),I.baseTransform=Gi(I.ctx),I.executeOperatorList(o),I.endDrawing(),{canvas:A.canvas,scaleX:C.scale,scaleY:$.scale,offsetX:L,offsetY:T}}getSizeAndScale(t,o,i){t=Math.abs(t);const a=Math.max(kW.MAX_PATTERN_SIZE,o);let s=Math.ceil(t*i);return s>=a?s=a:i=s/t,{scale:i,size:s}}clipBbox(t,o,i,a,s){const d=a-o,c=s-i;t.ctx.rect(o,i,d,c),t.current.updateRectMinMax(Gi(t.ctx),[o,i,a,s]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,o,i){const a=t.ctx,s=t.current;switch(o){case kle.COLORED:const d=this.ctx;a.fillStyle=d.fillStyle,a.strokeStyle=d.strokeStyle,s.fillColor=d.fillStyle,s.strokeColor=d.strokeStyle;break;case kle.UNCOLORED:const c=mo.makeHexColor(i[0],i[1],i[2]);a.fillStyle=c,a.strokeStyle=c,s.fillColor=c,s.strokeColor=c;break;default:throw new cwt(`Unsupported paint type: ${o}`)}}getPattern(t,o,i,a){let s=i;a!==zs.SHADING&&(s=mo.transform(s,o.baseTransform),this.matrix&&(s=mo.transform(s,this.matrix)));const d=this.createPatternCanvas(o);let c=new DOMMatrix(s);c=c.translate(d.offsetX,d.offsetY),c=c.scale(1/d.scaleX,1/d.scaleY);const u=t.createPattern(d.canvas,"repeat");return u.setTransform(c),u}}function Fwt({src:e,srcPos:t=0,dest:o,width:i,height:a,nonBlackColor:s=4294967295,inverseDecode:d=!1}){const c=gl.isLittleEndian?4278190080:255,[u,p]=d?[s,c]:[c,s],h=i>>3,m=i&7,f=e.length;o=new Uint32Array(o.buffer);let x=0;for(let y=0;y<a;y++){for(const b=t+h;t<b;t++){const C=t<f?e[t]:255;o[x++]=C&128?p:u,o[x++]=C&64?p:u,o[x++]=C&32?p:u,o[x++]=C&16?p:u,o[x++]=C&8?p:u,o[x++]=C&4?p:u,o[x++]=C&2?p:u,o[x++]=C&1?p:u}if(m===0)continue;const w=t<f?e[t++]:255;for(let b=0;b<m;b++)o[x++]=w&1<<7-b?p:u}return{srcPos:t,destPos:x}}const Sle=16,Ale=100,Owt=15,Ele=10,Lle=1e3,sl=16;function Nwt(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(i,a){t.translate(i,a),this.__originalTranslate(i,a)},e.scale=function(i,a){t.scale(i,a),this.__originalScale(i,a)},e.transform=function(i,a,s,d,c,u){t.transform(i,a,s,d,c,u),this.__originalTransform(i,a,s,d,c,u)},e.setTransform=function(i,a,s,d,c,u){t.setTransform(i,a,s,d,c,u),this.__originalSetTransform(i,a,s,d,c,u)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(i){t.rotate(i),this.__originalRotate(i)},e.clip=function(i){t.clip(i),this.__originalClip(i)},e.moveTo=function(o,i){t.moveTo(o,i),this.__originalMoveTo(o,i)},e.lineTo=function(o,i){t.lineTo(o,i),this.__originalLineTo(o,i)},e.bezierCurveTo=function(o,i,a,s,d,c){t.bezierCurveTo(o,i,a,s,d,c),this.__originalBezierCurveTo(o,i,a,s,d,c)},e.rect=function(o,i,a,s){t.rect(o,i,a,s),this.__originalRect(o,i,a,s)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class Hwt{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,o,i){let a;return this.cache[t]!==void 0?(a=this.cache[t],this.canvasFactory.reset(a,o,i)):(a=this.canvasFactory.create(o,i),this.cache[t]=a),a}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const o=this.cache[t];this.canvasFactory.destroy(o),delete this.cache[t]}}}function Yw(e,t,o,i,a,s,d,c,u,p){const[h,m,f,x,y,w]=Gi(e);if(m===0&&f===0){const $=d*h+y,A=Math.round($),E=c*x+w,I=Math.round(E),L=(d+u)*h+y,T=Math.abs(Math.round(L)-A)||1,P=(c+p)*x+w,B=Math.abs(Math.round(P)-I)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(x),A,I),e.drawImage(t,o,i,a,s,0,0,T,B),e.setTransform(h,m,f,x,y,w),[T,B]}if(h===0&&x===0){const $=c*f+y,A=Math.round($),E=d*m+w,I=Math.round(E),L=(c+p)*f+y,T=Math.abs(Math.round(L)-A)||1,P=(d+u)*m+w,B=Math.abs(Math.round(P)-I)||1;return e.setTransform(0,Math.sign(m),Math.sign(f),0,A,I),e.drawImage(t,o,i,a,s,0,0,B,T),e.setTransform(h,m,f,x,y,w),[B,T]}e.drawImage(t,o,i,a,s,d,c,u,p);const b=Math.hypot(h,m),C=Math.hypot(f,x);return[b*u,C*p]}function Vwt(e){const{width:t,height:o}=e;if(t>Lle||o>Lle)return null;const i=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=t+1;let d=new Uint8Array(s*(o+1)),c,u,p;const h=t+7&-8;let m=new Uint8Array(h*o),f=0;for(const C of e.data){let $=128;for(;$>0;)m[f++]=C&$?0:255,$>>=1}let x=0;for(f=0,m[f]!==0&&(d[0]=1,++x),u=1;u<t;u++)m[f]!==m[f+1]&&(d[u]=m[f]?2:1,++x),f++;for(m[f]!==0&&(d[u]=2,++x),c=1;c<o;c++){f=c*h,p=c*s,m[f-h]!==m[f]&&(d[p]=m[f]?1:8,++x);let C=(m[f]?4:0)+(m[f-h]?8:0);for(u=1;u<t;u++)C=(C>>2)+(m[f+1]?4:0)+(m[f-h+1]?8:0),a[C]&&(d[p+u]=a[C],++x),f++;if(m[f-h]!==m[f]&&(d[p+u]=m[f]?2:4,++x),x>i)return null}for(f=h*(o-1),p=c*s,m[f]!==0&&(d[p]=8,++x),u=1;u<t;u++)m[f]!==m[f+1]&&(d[p+u]=m[f]?4:8,++x),f++;if(m[f]!==0&&(d[p+u]=4,++x),x>i)return null;const y=new Int32Array([0,s,-1,0,-s,0,0,0,1]),w=new Path2D;for(c=0;x&&c<=o;c++){let C=c*s;const $=C+t;for(;C<$&&!d[C];)C++;if(C===$)continue;w.moveTo(C%s,c);const A=C;let E=d[C];do{const I=y[E];do C+=I;while(!d[C]);const L=d[C];L!==5&&L!==10?(E=L,d[C]=0):(E=L&51*E>>4,d[C]&=E>>2|E<<2),w.lineTo(C%s,C/s|0),d[C]||--x}while(A!==C);--c}return m=null,d=null,function(C){C.save(),C.scale(1/t,-1/o),C.translate(0,-o),C.fill(w),C.beginPath(),C.restore()}}class jle{constructor(t,o){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=qve,this.textMatrixScale=1,this.fontMatrix=QO,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=ls.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,o])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,o){this.x=t,this.y=o}updatePathMinMax(t,o,i){[o,i]=mo.applyTransform([o,i],t),this.minX=Math.min(this.minX,o),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,o),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,o){const i=mo.applyTransform(o,t),a=mo.applyTransform(o.slice(2),t),s=mo.applyTransform([o[0],o[3]],t),d=mo.applyTransform([o[2],o[1]],t);this.minX=Math.min(this.minX,i[0],a[0],s[0],d[0]),this.minY=Math.min(this.minY,i[1],a[1],s[1],d[1]),this.maxX=Math.max(this.maxX,i[0],a[0],s[0],d[0]),this.maxY=Math.max(this.maxY,i[1],a[1],s[1],d[1])}updateScalingPathMinMax(t,o){mo.scaleMinMax(t,o),this.minX=Math.min(this.minX,o[0]),this.minY=Math.min(this.minY,o[1]),this.maxX=Math.max(this.maxX,o[2]),this.maxY=Math.max(this.maxY,o[3])}updateCurvePathMinMax(t,o,i,a,s,d,c,u,p,h){const m=mo.bezierBoundingBox(o,i,a,s,d,c,u,p,h);h||this.updateRectMinMax(t,m)}getPathBoundingBox(t=zs.FILL,o=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(t===zs.STROKE){o||mi("Stroke bounding box must include transform.");const a=mo.singularValueDecompose2dScale(o),s=a[0]*this.lineWidth/2,d=a[1]*this.lineWidth/2;i[0]-=s,i[1]-=d,i[2]+=s,i[3]+=d}return i}updateClipFromPath(){const t=mo.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=zs.FILL,o=null){return mo.intersect(this.clipBox,this.getPathBoundingBox(t,o))}}function Ile(e,t){if(typeof ImageData<"u"&&t instanceof ImageData){e.putImageData(t,0,0);return}const o=t.height,i=t.width,a=o%sl,s=(o-a)/sl,d=a===0?s:s+1,c=e.createImageData(i,sl);let u=0,p;const h=t.data,m=c.data;let f,x,y,w;if(t.kind===mC.GRAYSCALE_1BPP){const b=h.byteLength,C=new Uint32Array(m.buffer,0,m.byteLength>>2),$=C.length,A=i+7>>3,E=4294967295,I=gl.isLittleEndian?4278190080:255;for(f=0;f<d;f++){for(y=f<s?sl:a,p=0,x=0;x<y;x++){const L=b-u;let T=0;const P=L>A?i:L*8-7,B=P&-8;let _=0,R=0;for(;T<B;T+=8)R=h[u++],C[p++]=R&128?E:I,C[p++]=R&64?E:I,C[p++]=R&32?E:I,C[p++]=R&16?E:I,C[p++]=R&8?E:I,C[p++]=R&4?E:I,C[p++]=R&2?E:I,C[p++]=R&1?E:I;for(;T<P;T++)_===0&&(R=h[u++],_=128),C[p++]=R&_?E:I,_>>=1}for(;p<$;)C[p++]=0;e.putImageData(c,0,f*sl)}}else if(t.kind===mC.RGBA_32BPP){for(x=0,w=i*sl*4,f=0;f<s;f++)m.set(h.subarray(u,u+w)),u+=w,e.putImageData(c,0,x),x+=sl;f<d&&(w=i*a*4,m.set(h.subarray(u,u+w)),e.putImageData(c,0,x))}else if(t.kind===mC.RGB_24BPP)for(y=sl,w=i*y,f=0;f<d;f++){for(f>=s&&(y=a,w=i*y),p=0,x=w;x--;)m[p++]=h[u++],m[p++]=h[u++],m[p++]=h[u++],m[p++]=255;e.putImageData(c,0,f*sl)}else throw new Error(`bad image kind: ${t.kind}`)}function Mle(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const o=t.height,i=t.width,a=o%sl,s=(o-a)/sl,d=a===0?s:s+1,c=e.createImageData(i,sl);let u=0;const p=t.data,h=c.data;for(let m=0;m<d;m++){const f=m<s?sl:a;({srcPos:u}=Fwt({src:p,srcPos:u,dest:h,width:i,height:f,nonBlackColor:0})),e.putImageData(c,0,m*sl)}}function K6(e,t){const o=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of o)e[i]!==void 0&&(t[i]=e[i]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function Kw(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),!gs){const{filter:t}=e;t!=="none"&&t!==""&&(e.filter="none")}}function Tle(e,t){if(t)return!0;const o=mo.singularValueDecompose2dScale(e);o[0]=Math.fround(o[0]),o[1]=Math.fround(o[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*K5.PDF_TO_CSS_UNITS);return o[0]<=i&&o[1]<=i}const Uwt=["butt","round","square"],Wwt=["miter","round","bevel"],Qwt={},Ple={};class w5{constructor(t,o,i,a,s,{optionalContentConfig:d,markedContentStack:c=null},u,p){this.ctx=t,this.current=new jle(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=o,this.objs=i,this.canvasFactory=a,this.filterFactory=s,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=c||[],this.optionalContentConfig=d,this.cachedCanvases=new Hwt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=u,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=p,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,o=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):o}beginDrawing({transform:t,viewport:o,transparency:i=!1,background:a=null}){const s=this.ctx.canvas.width,d=this.ctx.canvas.height,c=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,s,d),this.ctx.fillStyle=c,i){const u=this.cachedCanvases.getCanvas("transparent",s,d);this.compositeCtx=this.ctx,this.transparentCanvas=u.canvas,this.ctx=u.context,this.ctx.save(),this.ctx.transform(...Gi(this.compositeCtx))}this.ctx.save(),Kw(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...o.transform),this.viewportScale=o.scale,this.baseTransform=Gi(this.ctx)}executeOperatorList(t,o,i,a){const s=t.argsArray,d=t.fnArray;let c=o||0;const u=s.length;if(u===c)return c;const p=u-c>Ele&&typeof i=="function",h=p?Date.now()+Owt:0;let m=0;const f=this.commonObjs,x=this.objs;let y;for(;;){if(a!==void 0&&c===a.nextBreakPoint)return a.breakIt(c,i),c;if(y=d[c],y!==zc.dependency)this[y].apply(this,s[c]);else for(const w of s[c]){const b=w.startsWith("g_")?f:x;if(!b.has(w))return b.get(w,i),c}if(c++,c===u)return c;if(p&&++m>Ele){if(Date.now()>h)return i(),c;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 o of t.values())typeof HTMLCanvasElement<"u"&&o instanceof HTMLCanvasElement&&(o.width=o.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 o=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=o}}}_scaleImage(t,o){const i=t.width,a=t.height;let s=Math.max(Math.hypot(o[0],o[1]),1),d=Math.max(Math.hypot(o[2],o[3]),1),c=i,u=a,p="prescale1",h,m;for(;s>2&&c>1||d>2&&u>1;){let f=c,x=u;s>2&&c>1&&(f=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c/2),s/=c/f),d>2&&u>1&&(x=u>=16384?Math.floor(u/2)-1||1:Math.ceil(u)/2,d/=u/x),h=this.cachedCanvases.getCanvas(p,f,x),m=h.context,m.clearRect(0,0,f,x),m.drawImage(t,0,0,c,u,0,0,f,x),t=h.canvas,c=f,u=x,p=p==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:c,paintHeight:u}}_createMaskCanvas(t){const o=this.ctx,{width:i,height:a}=t,s=this.current.fillColor,d=this.current.patternFill,c=Gi(o);let u,p,h,m;if((t.bitmap||t.data)&&t.count>1){const P=t.bitmap||t.data.buffer;p=JSON.stringify(d?c:[c.slice(0,4),s]),u=this._cachedBitmapsMap.get(P),u||(u=new Map,this._cachedBitmapsMap.set(P,u));const B=u.get(p);if(B&&!d){const _=Math.round(Math.min(c[0],c[2])+c[4]),R=Math.round(Math.min(c[1],c[3])+c[5]);return{canvas:B,offsetX:_,offsetY:R}}h=B}h||(m=this.cachedCanvases.getCanvas("maskCanvas",i,a),Mle(m.context,t));let f=mo.transform(c,[1/i,0,0,-1/a,0,0]);f=mo.transform(f,[1,0,0,1,0,-a]);const[x,y,w,b]=mo.getAxialAlignedBoundingBox([0,0,i,a],f),C=Math.round(w-x)||1,$=Math.round(b-y)||1,A=this.cachedCanvases.getCanvas("fillCanvas",C,$),E=A.context,I=x,L=y;E.translate(-I,-L),E.transform(...f),h||(h=this._scaleImage(m.canvas,Wp(E)),h=h.img,u&&d&&u.set(p,h)),E.imageSmoothingEnabled=Tle(Gi(E),t.interpolate),Yw(E,h,0,0,h.width,h.height,0,0,i,a),E.globalCompositeOperation="source-in";const T=mo.transform(Wp(E),[1,0,0,1,-I,-L]);return E.fillStyle=d?s.getPattern(o,this,T,zs.FILL):s,E.fillRect(0,0,i,a),u&&!d&&(this.cachedCanvases.delete("fillCanvas"),u.set(p,A.canvas)),{canvas:A.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=Uwt[t]}setLineJoin(t){this.ctx.lineJoin=Wwt[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,o){const i=this.ctx;i.setLineDash!==void 0&&(i.setLineDash(t),i.lineDashOffset=o)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[o,i]of t)switch(o){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,o=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(i,t,o);this.suspendedCtx=this.ctx,this.ctx=a.context;const s=this.ctx;s.setTransform(...Gi(this.suspendedCtx)),K6(this.suspendedCtx,s),Nwt(s,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(),K6(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 o=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,o,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,o,i,a){const s=a[0],d=a[1],c=a[2]-s,u=a[3]-d;c===0||u===0||(this.genericComposeSMask(o.context,i,c,u,o.subtype,o.backdrop,o.transferMap,s,d,o.offsetX,o.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,o,i,a,s,d,c,u,p,h,m){let f=t.canvas,x=u-h,y=p-m;if(d){if(x<0||y<0||x+i>f.width||y+a>f.height){const b=this.cachedCanvases.getCanvas("maskExtension",i,a),C=b.context;C.drawImage(f,-x,-y),d.some($=>$!==0)&&(C.globalCompositeOperation="destination-atop",C.fillStyle=mo.makeHexColor(...d),C.fillRect(0,0,i,a),C.globalCompositeOperation="source-over"),f=b.canvas,x=y=0}else if(d.some(b=>b!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const b=new Path2D;b.rect(x,y,i,a),t.clip(b),t.globalCompositeOperation="destination-atop",t.fillStyle=mo.makeHexColor(...d),t.fillRect(x,y,i,a),t.restore()}}o.save(),o.globalAlpha=1,o.setTransform(1,0,0,1,0,0),s==="Alpha"&&c?o.filter=this.filterFactory.addAlphaFilter(c):s==="Luminosity"&&(o.filter=this.filterFactory.addLuminosityFilter(c));const w=new Path2D;w.rect(u,p,i,a),o.clip(w),o.globalCompositeOperation="destination-in",o.drawImage(f,x,y,i,a,u,p,i,a),o.restore()}save(){this.inSMaskMode?(K6(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(),K6(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,o,i,a,s,d){this.ctx.transform(t,o,i,a,s,d),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,o,i){const a=this.ctx,s=this.current;let d=s.x,c=s.y,u,p;const h=Gi(a),m=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,f=m?i.slice(0):null;for(let x=0,y=0,w=t.length;x<w;x++)switch(t[x]|0){case zc.rectangle:d=o[y++],c=o[y++];const b=o[y++],C=o[y++],$=d+b,A=c+C;a.moveTo(d,c),b===0||C===0?a.lineTo($,A):(a.lineTo($,c),a.lineTo($,A),a.lineTo(d,A)),m||s.updateRectMinMax(h,[d,c,$,A]),a.closePath();break;case zc.moveTo:d=o[y++],c=o[y++],a.moveTo(d,c),m||s.updatePathMinMax(h,d,c);break;case zc.lineTo:d=o[y++],c=o[y++],a.lineTo(d,c),m||s.updatePathMinMax(h,d,c);break;case zc.curveTo:u=d,p=c,d=o[y+4],c=o[y+5],a.bezierCurveTo(o[y],o[y+1],o[y+2],o[y+3],d,c),s.updateCurvePathMinMax(h,u,p,o[y],o[y+1],o[y+2],o[y+3],d,c,f),y+=6;break;case zc.curveTo2:u=d,p=c,a.bezierCurveTo(d,c,o[y],o[y+1],o[y+2],o[y+3]),s.updateCurvePathMinMax(h,u,p,d,c,o[y],o[y+1],o[y+2],o[y+3],f),d=o[y+2],c=o[y+3],y+=4;break;case zc.curveTo3:u=d,p=c,d=o[y+2],c=o[y+3],a.bezierCurveTo(o[y],o[y+1],d,c,d,c),s.updateCurvePathMinMax(h,u,p,o[y],o[y+1],d,c,d,c,f),y+=4;break;case zc.closePath:a.closePath();break}m&&s.updateScalingPathMinMax(h,f),s.setCurrentPoint(d,c)}closePath(){this.ctx.closePath()}stroke(t=!0){const o=this.ctx,i=this.current.strokeColor;o.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof i=="object"&&i?.getPattern?(o.save(),o.strokeStyle=i.getPattern(o,this,Wp(o),zs.STROKE),this.rescaleAndStroke(!1),o.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),o.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const o=this.ctx,i=this.current.fillColor,a=this.current.patternFill;let s=!1;a&&(o.save(),o.fillStyle=i.getPattern(o,this,Wp(o),zs.FILL),s=!0);const d=this.current.getClippedPathBoundingBox();this.contentVisible&&d!==null&&(this.pendingEOFill?(o.fill("evenodd"),this.pendingEOFill=!1):o.fill()),s&&o.restore(),t&&this.consumePath(d)}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=Qwt}eoClip(){this.pendingClip=Ple}beginText(){this.current.textMatrix=qve,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,o=this.ctx;if(t===void 0){o.beginPath();return}o.save(),o.beginPath();for(const i of t)o.setTransform(...i.transform),o.translate(i.x,i.y),i.addToPath(o,i.fontSize);o.restore(),o.clip(),o.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,o){const i=this.commonObjs.get(t),a=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(a.fontMatrix=i.fontMatrix||QO,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&hr("Invalid font matrix for font "+t),o<0?(o=-o,a.fontDirection=-1):a.fontDirection=1,this.current.font=i,this.current.fontSize=o,i.isType3Font)return;const s=i.loadedName||"sans-serif",d=i.systemFontInfo?.css||`"${s}", ${i.fallbackName}`;let c="normal";i.black?c="900":i.bold&&(c="bold");const u=i.italic?"italic":"normal";let p=o;o<Sle?p=Sle:o>Ale&&(p=Ale),this.current.fontSizeScale=o/p,this.ctx.font=`${u} ${c} ${p}px ${d}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,o){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=o}setLeadingMoveText(t,o){this.setLeading(-o),this.moveText(t,o)}setTextMatrix(t,o,i,a,s,d){this.current.textMatrix=[t,o,i,a,s,d],this.current.textMatrixScale=Math.hypot(t,o),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,o,i,a){const s=this.ctx,d=this.current,c=d.font,u=d.textRenderingMode,p=d.fontSize/d.fontSizeScale,h=u&ls.FILL_STROKE_MASK,m=!!(u&ls.ADD_TO_PATH_FLAG),f=d.patternFill&&!c.missingFile;let x;(c.disableFontFace||m||f)&&(x=c.getPathGenerator(this.commonObjs,t)),c.disableFontFace||f?(s.save(),s.translate(o,i),s.beginPath(),x(s,p),a&&s.setTransform(...a),(h===ls.FILL||h===ls.FILL_STROKE)&&s.fill(),(h===ls.STROKE||h===ls.FILL_STROKE)&&s.stroke(),s.restore()):((h===ls.FILL||h===ls.FILL_STROKE)&&s.fillText(t,o,i),(h===ls.STROKE||h===ls.FILL_STROKE)&&s.strokeText(t,o,i)),m&&(this.pendingTextPaths||=[]).push({transform:Gi(s),x:o,y:i,fontSize:p,addToPath:x})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const o=t.getImageData(0,0,10,10).data;let i=!1;for(let a=3;a<o.length;a+=4)if(o[a]>0&&o[a]<255){i=!0;break}return zr(this,"isFontSubpixelAAEnabled",i)}showText(t){const o=this.current,i=o.font;if(i.isType3Font)return this.showType3Text(t);const a=o.fontSize;if(a===0)return;const s=this.ctx,d=o.fontSizeScale,c=o.charSpacing,u=o.wordSpacing,p=o.fontDirection,h=o.textHScale*p,m=t.length,f=i.vertical,x=f?1:-1,y=i.defaultVMetrics,w=a*o.fontMatrix[0],b=o.textRenderingMode===ls.FILL&&!i.disableFontFace&&!o.patternFill;s.save(),s.transform(...o.textMatrix),s.translate(o.x,o.y+o.textRise),p>0?s.scale(h,-1):s.scale(h,1);let C;if(o.patternFill){s.save();const L=o.fillColor.getPattern(s,this,Wp(s),zs.FILL);C=Gi(s),s.restore(),s.fillStyle=L}let $=o.lineWidth;const A=o.textMatrixScale;if(A===0||$===0){const L=o.textRenderingMode&ls.FILL_STROKE_MASK;(L===ls.STROKE||L===ls.FILL_STROKE)&&($=this.getSinglePixelWidth())}else $/=A;if(d!==1&&(s.scale(d,d),$/=d),s.lineWidth=$,i.isInvalidPDFjsFont){const L=[];let T=0;for(const P of t)L.push(P.unicode),T+=P.width;s.fillText(L.join(""),0,0),o.x+=T*w*h,s.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 T=!1;const P=(L.isSpace?u:0)+c,B=L.fontChar,_=L.accent;let R,z,Y=L.width;if(f){const O=L.vmetric||y,U=-(L.vmetric?O[1]:Y*.5)*w,F=O[2]*w;Y=O?-O[0]:Y,R=U/d,z=(E+F)/d}else R=E/d,z=0;if(i.remeasure&&Y>0){const O=s.measureText(B).width*1e3/a*d;if(Y<O&&this.isFontSubpixelAAEnabled){const U=Y/O;T=!0,s.save(),s.scale(U,1),R/=U}else Y!==O&&(R+=(Y-O)/2e3*a/d)}if(this.contentVisible&&(L.isInFont||i.missingFile)){if(b&&!_)s.fillText(B,R,z);else if(this.paintChar(B,R,z,C),_){const O=R+a*_.offset.x/d,U=z-a*_.offset.y/d;this.paintChar(_.fontChar,O,U,C)}}const Z=f?Y*w-P*p:Y*w+P*p;E+=Z,T&&s.restore()}f?o.y-=E:o.x+=E*h,s.restore(),this.compose()}showType3Text(t){const o=this.ctx,i=this.current,a=i.font,s=i.fontSize,d=i.fontDirection,c=a.vertical?1:-1,u=i.charSpacing,p=i.wordSpacing,h=i.textHScale*d,m=i.fontMatrix||QO,f=t.length,x=i.textRenderingMode===ls.INVISIBLE;let y,w,b,C;if(!(x||s===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,o.save(),o.transform(...i.textMatrix),o.translate(i.x,i.y),o.scale(h,d),y=0;y<f;++y){if(w=t[y],typeof w=="number"){C=c*w*s/1e3,this.ctx.translate(C,0),i.x+=C*h;continue}const $=(w.isSpace?p:0)+u,A=a.charProcOperatorList[w.operatorListId];if(!A){hr(`Type3 character "${w.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=w,this.save(),o.scale(s,s),o.transform(...m),this.executeOperatorList(A),this.restore()),b=mo.applyTransform([w.width,0],m)[0]*s+$,o.translate(b,0),i.x+=b*h}o.restore(),this.processingType3=null}}setCharWidth(t,o){}setCharWidthAndBounds(t,o,i,a,s,d){this.ctx.rect(i,a,s-i,d-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let o;if(t[0]==="TilingPattern"){const i=t[1],a=this.baseTransform||Gi(this.ctx),s={createCanvasGraphics:d=>new w5(d,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};o=new kW(t,i,this.ctx,s,a)}else o=this._getPattern(t[1],t[2]);return o}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,o,i){const a=mo.makeHexColor(t,o,i);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,o,i){const a=mo.makeHexColor(t,o,i);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,o=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=Rwt(this.getObject(t)),this.cachedPatterns.set(t,i)),o&&(i.matrix=o),i}shadingFill(t){if(!this.contentVisible)return;const o=this.ctx;this.save();const i=this._getPattern(t);o.fillStyle=i.getPattern(o,this,Wp(o),zs.SHADING);const a=Wp(o);if(a){const{width:s,height:d}=o.canvas,[c,u,p,h]=mo.getAxialAlignedBoundingBox([0,0,s,d],a);this.ctx.fillRect(c,u,p-c,h-u)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){mi("Should not call beginInlineImage")}beginImageData(){mi("Should not call beginImageData")}paintFormXObjectBegin(t,o){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Gi(this.ctx),o)){const i=o[2]-o[0],a=o[3]-o[1];this.ctx.rect(o[0],o[1],i,a),this.current.updateRectMinMax(Gi(this.ctx),o),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 o=this.ctx;t.isolated||fA("TODO: Support non-isolated groups."),t.knockout&&hr("Knockout groups not supported.");const i=Gi(o);if(t.matrix&&o.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=mo.getAxialAlignedBoundingBox(t.bbox,Gi(o));const s=[0,0,o.canvas.width,o.canvas.height];a=mo.intersect(a,s)||[0,0,0,0];const d=Math.floor(a[0]),c=Math.floor(a[1]),u=Math.max(Math.ceil(a[2])-d,1),p=Math.max(Math.ceil(a[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,p]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(h,u,p),f=m.context;f.translate(-d,-c),f.transform(...i),t.smask?this.smaskStack.push({canvas:m.canvas,context:f,offsetX:d,offsetY:c,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(o.setTransform(1,0,0,1,0,0),o.translate(d,c),o.save()),K6(o,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(o),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const o=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=Gi(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const s=mo.getAxialAlignedBoundingBox([0,0,o.canvas.width,o.canvas.height],a);this.ctx.drawImage(o.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(t,o,i,a,s){if(this.#e(),Kw(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),o){const d=o[2]-o[0],c=o[3]-o[1];if(s&&this.annotationCanvasMap){i=i.slice(),i[4]-=o[0],i[5]-=o[1],o=o.slice(),o[0]=o[1]=0,o[2]=d,o[3]=c;const[u,p]=mo.singularValueDecompose2dScale(Gi(this.ctx)),{viewportScale:h}=this,m=Math.ceil(d*this.outputScaleX*h),f=Math.ceil(c*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(u,0,0,-p,0,c*p),Kw(this.ctx)}else Kw(this.ctx),this.ctx.rect(o[0],o[1],d,c),this.ctx.clip(),this.endPath()}this.current=new jle(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),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 o=t.count;t=this.getObject(t.data,t),t.count=o;const i=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=Vwt(t)),a.compiled)){a.compiled(i);return}const s=this._createMaskCanvas(t),d=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(d,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,o,i=0,a=0,s,d){if(!this.contentVisible)return;t=this.getObject(t.data,t);const c=this.ctx;c.save();const u=Gi(c);c.transform(o,i,a,s,0,0);const p=this._createMaskCanvas(t);c.setTransform(1,0,0,1,p.offsetX-u[4],p.offsetY-u[5]);for(let h=0,m=d.length;h<m;h+=2){const f=mo.transform(u,[o,i,a,s,d[h],d[h+1]]),[x,y]=mo.applyTransform([0,0],f);c.drawImage(p.canvas,x,y)}c.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const o=this.ctx,i=this.current.fillColor,a=this.current.patternFill;for(const s of t){const{data:d,width:c,height:u,transform:p}=s,h=this.cachedCanvases.getCanvas("maskCanvas",c,u),m=h.context;m.save();const f=this.getObject(d,s);Mle(m,f),m.globalCompositeOperation="source-in",m.fillStyle=a?i.getPattern(m,this,Wp(o),zs.FILL):i,m.fillRect(0,0,c,u),m.restore(),o.save(),o.transform(...p),o.scale(1,-1),Yw(o,h.canvas,0,0,c,u,0,-1,1,1),o.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const o=this.getObject(t);if(!o){hr("Dependent image isn't ready yet");return}this.paintInlineImageXObject(o)}paintImageXObjectRepeat(t,o,i,a){if(!this.contentVisible)return;const s=this.getObject(t);if(!s){hr("Dependent image isn't ready yet");return}const d=s.width,c=s.height,u=[];for(let p=0,h=a.length;p<h;p+=2)u.push({transform:[o,0,0,i,a[p],a[p+1]],x:0,y:0,w:d,h:c});this.paintInlineImageXObjectGroup(s,u)}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:o,width:i,height:a}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,a),d=s.context;return d.filter=this.current.transferMaps,d.drawImage(o,0,0),d.filter="none",s.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const o=t.width,i=t.height,a=this.ctx;if(this.save(),!gs){const{filter:c}=a;c!=="none"&&c!==""&&(a.filter="none")}a.scale(1/o,-1/i);let s;if(t.bitmap)s=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)s=t;else{const u=this.cachedCanvases.getCanvas("inlineImage",o,i).context;Ile(u,t),s=this.applyTransferMapsToCanvas(u)}const d=this._scaleImage(s,Wp(a));a.imageSmoothingEnabled=Tle(Gi(a),t.interpolate),Yw(a,d.img,0,0,d.paintWidth,d.paintHeight,0,-i,o,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,o){if(!this.contentVisible)return;const i=this.ctx;let a;if(t.bitmap)a=t.bitmap;else{const s=t.width,d=t.height,u=this.cachedCanvases.getCanvas("inlineImage",s,d).context;Ile(u,t),a=this.applyTransferMapsToCanvas(u)}for(const s of o)i.save(),i.transform(...s.transform),i.scale(1,-1),Yw(i,a,s.x,s.y,s.w,s.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,o){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,o){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(o)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const o=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(o||(this.pendingClip===Ple?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Gi(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const o=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,a)/o}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:o,b:i,c:a,d:s}=this.ctx.getTransform();let d,c;if(i===0&&a===0){const u=Math.abs(o),p=Math.abs(s);if(u===p)if(t===0)d=c=1/u;else{const h=u*t;d=c=h<1?1/h:1}else if(t===0)d=1/u,c=1/p;else{const h=u*t,m=p*t;d=h<1?1/h:1,c=m<1?1/m:1}}else{const u=Math.abs(o*s-i*a),p=Math.hypot(o,i),h=Math.hypot(a,s);if(t===0)d=h/u,c=p/u;else{const m=t*u;d=h>m?h/m:1,c=p>m?p/m:1}}this._cachedScaleForStroking[0]=d,this._cachedScaleForStroking[1]=c}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:o}=this,{lineWidth:i}=this.current,[a,s]=this.getScaleForStroking();if(o.lineWidth=i||1,a===1&&s===1){o.stroke();return}const d=o.getLineDash();if(t&&o.save(),o.scale(a,s),d.length>0){const c=Math.max(a,s);o.setLineDash(d.map(u=>u/c)),o.lineDashOffset/=c}o.stroke(),t&&o.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 zc)w5.prototype[e]!==void 0&&(w5.prototype[zc[e]]=w5.prototype[e]);class ox{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 qw={DATA:1,ERROR:2},Bn={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Vl(e){switch(e instanceof Error||typeof e=="object"&&e!==null||mi('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new O3(e.message);case"MissingPDFException":return new F3(e.message);case"PasswordException":return new YO(e.message,e.code);case"UnexpectedResponseException":return new xA(e.message,e.status);case"UnknownErrorException":return new KO(e.message,e.details);default:return new KO(e.message,e.toString())}}class K8{constructor(t,o,i){this.sourceName=t,this.targetName=o,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=a=>{const s=a.data;if(s.targetName!==this.sourceName)return;if(s.stream){this.#t(s);return}if(s.callback){const c=s.callbackId,u=this.callbackCapabilities[c];if(!u)throw new Error(`Cannot resolve callback ${c}`);if(delete this.callbackCapabilities[c],s.callback===qw.DATA)u.resolve(s.data);else if(s.callback===qw.ERROR)u.reject(Vl(s.reason));else throw new Error("Unexpected callback case");return}const d=this.actionHandler[s.action];if(!d)throw new Error(`Unknown action from worker: ${s.action}`);if(s.callbackId){const c=this.sourceName,u=s.sourceName;new Promise(function(p){p(d(s.data))}).then(function(p){i.postMessage({sourceName:c,targetName:u,callback:qw.DATA,callbackId:s.callbackId,data:p})},function(p){i.postMessage({sourceName:c,targetName:u,callback:qw.ERROR,callbackId:s.callbackId,reason:Vl(p)})});return}if(s.streamId){this.#e(s);return}d(s.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,o){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=o}send(t,o,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:o},i)}sendWithPromise(t,o,i){const a=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[a]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:o},i)}catch(d){s.reject(d)}return s.promise}sendWithStream(t,o,i,a){const s=this.streamId++,d=this.sourceName,c=this.targetName,u=this.comObj;return new ReadableStream({start:p=>{const h=Promise.withResolvers();return this.streamControllers[s]={controller:p,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},u.postMessage({sourceName:d,targetName:c,action:t,streamId:s,data:o,desiredSize:p.desiredSize},a),h.promise},pull:p=>{const h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,u.postMessage({sourceName:d,targetName:c,stream:Bn.PULL,streamId:s,desiredSize:p.desiredSize}),h.promise},cancel:p=>{ra(p instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,u.postMessage({sourceName:d,targetName:c,stream:Bn.CANCEL,streamId:s,reason:Vl(p)}),h.promise}},i)}#e(t){const o=t.streamId,i=this.sourceName,a=t.sourceName,s=this.comObj,d=this,c=this.actionHandler[t.action],u={enqueue(p,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),s.postMessage({sourceName:i,targetName:a,stream:Bn.ENQUEUE,streamId:o,chunk:p},m)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:a,stream:Bn.CLOSE,streamId:o}),delete d.streamSinks[o])},error(p){ra(p instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:a,stream:Bn.ERROR,streamId:o,reason:Vl(p)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};u.sinkCapability.resolve(),u.ready=u.sinkCapability.promise,this.streamSinks[o]=u,new Promise(function(p){p(c(t.data,u))}).then(function(){s.postMessage({sourceName:i,targetName:a,stream:Bn.START_COMPLETE,streamId:o,success:!0})},function(p){s.postMessage({sourceName:i,targetName:a,stream:Bn.START_COMPLETE,streamId:o,reason:Vl(p)})})}#t(t){const o=t.streamId,i=this.sourceName,a=t.sourceName,s=this.comObj,d=this.streamControllers[o],c=this.streamSinks[o];switch(t.stream){case Bn.START_COMPLETE:t.success?d.startCall.resolve():d.startCall.reject(Vl(t.reason));break;case Bn.PULL_COMPLETE:t.success?d.pullCall.resolve():d.pullCall.reject(Vl(t.reason));break;case Bn.PULL:if(!c){s.postMessage({sourceName:i,targetName:a,stream:Bn.PULL_COMPLETE,streamId:o,success:!0});break}c.desiredSize<=0&&t.desiredSize>0&&c.sinkCapability.resolve(),c.desiredSize=t.desiredSize,new Promise(function(u){u(c.onPull?.())}).then(function(){s.postMessage({sourceName:i,targetName:a,stream:Bn.PULL_COMPLETE,streamId:o,success:!0})},function(u){s.postMessage({sourceName:i,targetName:a,stream:Bn.PULL_COMPLETE,streamId:o,reason:Vl(u)})});break;case Bn.ENQUEUE:if(ra(d,"enqueue should have stream controller"),d.isClosed)break;d.controller.enqueue(t.chunk);break;case Bn.CLOSE:if(ra(d,"close should have stream controller"),d.isClosed)break;d.isClosed=!0,d.controller.close(),this.#o(d,o);break;case Bn.ERROR:ra(d,"error should have stream controller"),d.controller.error(Vl(t.reason)),this.#o(d,o);break;case Bn.CANCEL_COMPLETE:t.success?d.cancelCall.resolve():d.cancelCall.reject(Vl(t.reason)),this.#o(d,o);break;case Bn.CANCEL:if(!c)break;new Promise(function(u){u(c.onCancel?.(Vl(t.reason)))}).then(function(){s.postMessage({sourceName:i,targetName:a,stream:Bn.CANCEL_COMPLETE,streamId:o,success:!0})},function(u){s.postMessage({sourceName:i,targetName:a,stream:Bn.CANCEL_COMPLETE,streamId:o,reason:Vl(u)})}),c.sinkCapability.reject(Vl(t.reason)),c.isCancelled=!0,delete this.streamSinks[o];break;default:throw new Error("Unexpected stream case")}}async#o(t,o){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[o]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class Gwt{#e;#t;constructor({parsedData:t,rawData:o}){this.#e=t,this.#t=o}getRaw(){return this.#t}get(t){return this.#e.get(t)??null}getAll(){return hW(this.#e)}has(t){return this.#e.has(t)}}const I0=Symbol("INTERNAL");class Ywt{#e=!1;#t=!1;#o=!1;#i=!0;constructor(t,{name:o,intent:i,usage:a}){this.#e=!!(t&jd.DISPLAY),this.#t=!!(t&jd.PRINT),this.name=o,this.intent=i,this.usage=a}get visible(){if(this.#o)return this.#i;if(!this.#i)return!1;const{print:t,view:o}=this.usage;return this.#e?o?.viewState!=="OFF":this.#t?t?.printState!=="OFF":!0}_setVisible(t,o,i=!1){t!==I0&&mi("Internal method `_setVisible` called."),this.#o=i,this.#i=o}}class Kwt{#e=null;#t=new Map;#o=null;#i=null;constructor(t,o=jd.DISPLAY){if(this.renderingIntent=o,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#i=t.order;for(const i of t.groups)this.#t.set(i.id,new Ywt(o,i));if(t.baseState==="OFF")for(const i of this.#t.values())i._setVisible(I0,!1);for(const i of t.on)this.#t.get(i)._setVisible(I0,!0);for(const i of t.off)this.#t.get(i)._setVisible(I0,!1);this.#o=this.getHash()}}#s(t){const o=t.length;if(o<2)return!0;const i=t[0];for(let a=1;a<o;a++){const s=t[a];let d;if(Array.isArray(s))d=this.#s(s);else if(this.#t.has(s))d=this.#t.get(s).visible;else return hr(`Optional content group not found: ${s}`),!0;switch(i){case"And":if(!d)return!1;break;case"Or":if(d)return!0;break;case"Not":return!d;default:return!0}}return i==="And"}isVisible(t){if(this.#t.size===0)return!0;if(!t)return fA("Optional content group not defined."),!0;if(t.type==="OCG")return this.#t.has(t.id)?this.#t.get(t.id).visible:(hr(`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 o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(this.#t.get(o).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(!this.#t.get(o).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(!this.#t.get(o).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const o of t.ids){if(!this.#t.has(o))return hr(`Optional content group not found: ${o}`),!0;if(this.#t.get(o).visible)return!1}return!0}return hr(`Unknown optional content policy ${t.policy}.`),!0}return hr(`Unknown group type ${t.type}.`),!0}setVisibility(t,o=!0){const i=this.#t.get(t);if(!i){hr(`Optional content group not found: ${t}`);return}i._setVisible(I0,!!o,!0),this.#e=null}setOCGState({state:t,preserveRB:o}){let i;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":i=a;continue}const s=this.#t.get(a);if(s)switch(i){case"ON":s._setVisible(I0,!0);break;case"OFF":s._setVisible(I0,!1);break;case"Toggle":s._setVisible(I0,!s.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?hW(this.#t):null}getGroup(t){return this.#t.get(t)||null}getHash(){if(this.#e!==null)return this.#e;const t=new iCe;for(const[o,i]of this.#t)t.update(`${o}:${i.visible}`);return this.#e=t.hexdigest()}}class qwt{constructor(t,{disableRange:o=!1,disableStream:i=!1}){ra(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:s,progressiveDone:d,contentDispositionFilename:c}=t;if(this._queuedChunks=[],this._progressiveDone=d,this._contentDispositionFilename=c,s?.length>0){const u=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(u)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!o,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((u,p)=>{this._onReceiveData({begin:u,chunk:p})}),t.addProgressListener((u,p)=>{this._onProgress({loaded:u,total:p})}),t.addProgressiveReadListener(u=>{this._onReceiveData({chunk:u})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:o}){const i=o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength?o.buffer:new Uint8Array(o).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const a=this._rangeReaders.some(function(s){return s._begin!==t?!1:(s._enqueue(i),!0)});ra(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 o=this._rangeReaders.indexOf(t);o>=0&&this._rangeReaders.splice(o,1)}getFullReader(){ra(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Zwt(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,o){if(o<=this._progressiveDataLength)return null;const i=new Jwt(this,t,o);return this._pdfDataRangeTransport.requestDataRange(t,o),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeReaders.slice(0))o.cancel(t);this._pdfDataRangeTransport.abort()}}class Zwt{constructor(t,o,i=!1,a=null){this._stream=t,this._done=i||!1,this._filename=yW(a)?a:null,this._queuedChunks=o||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Jwt{constructor(t,o,i){this._stream=t,this._begin=o,this._end=i,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 i of this._requests)i.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 o=this._queuedChunk;return this._queuedChunk=null,{value:o,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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function Xwt(e){let t=!0,o=i("filename\\*","i").exec(e);if(o){o=o[1];let h=c(o);return h=unescape(h),h=u(h),h=p(h),s(h)}if(o=d(e),o){const h=p(o);return s(h)}if(o=i("filename","i").exec(e),o){o=o[1];let h=c(o);return h=p(h),s(h)}function i(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=yA(m);m=f.decode(x),t=!1}catch{}}return m}function s(h){return t&&/[\x80-\xff]/.test(h)&&(h=a("utf-8",h),t&&(h=a("iso-8859-1",h))),h}function d(h){const m=[];let f;const x=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=x.exec(h))!==null;){let[,w,b,C]=f;if(w=parseInt(w,10),w in m){if(w===0)break;continue}m[w]=[b,C]}const y=[];for(let w=0;w<m.length&&w in m;++w){let[b,C]=m[w];C=c(C),b&&(C=unescape(C),w===0&&(C=u(C))),y.push(C)}return y.join("")}function c(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 u(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 p(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(w,b){return String.fromCharCode(parseInt(b,16))}),a(f,y);try{y=atob(y)}catch{}return a(f,y)})}return""}function SW({getResponseHeader:e,isHttp:t,rangeChunkSize:o,disableRange:i}){const a={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(e("Content-Length"),10);return!Number.isInteger(s)||(a.suggestedLength=s,s<=2*o)||i||!t||e("Accept-Ranges")!=="bytes"||(e("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function AW(e){const t=e("Content-Disposition");if(t){let o=Xwt(t);if(o.includes("%"))try{o=decodeURIComponent(o)}catch{}if(yW(o))return o}return null}function kA(e,t){return e===404||e===0&&t.startsWith("file:")?new F3('Missing PDF "'+t+'".'):new xA(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function sCe(e){return e===200||e===206}function lCe(e,t,o){return{method:"GET",headers:e,signal:o.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function dCe(e){const t=new Headers;for(const o in e){const i=e[o];i!==void 0&&t.append(o,i)}return t}function cCe(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(hr(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Ble{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 ra(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new ebt(this),this._fullRequestReader}getRangeReader(t,o){if(o<=this._progressiveDataLength)return null;const i=new tbt(this,t,o);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeRequestReaders.slice(0))o.cancel(t)}}class ebt{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const o=t.source;this._withCredentials=o.withCredentials||!1,this._contentLength=o.length,this._headersCapability=Promise.withResolvers(),this._disableRange=o.disableRange||!1,this._rangeChunkSize=o.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!o.disableStream,this._isRangeSupported=!o.disableRange,this._headers=dCe(this._stream.httpHeaders);const i=o.url;fetch(i,lCe(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!sCe(a.status))throw kA(a.status,i);this._reader=a.body.getReader(),this._headersCapability.resolve();const s=u=>a.headers.get(u),{allowRangeRequests:d,suggestedLength:c}=SW({getResponseHeader:s,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=d,this._contentLength=c||this._contentLength,this._filename=AW(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new O3("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:o}=await this._reader.read();return o?{value:t,done:o}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:cCe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class tbt{constructor(t,o,i){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=dCe(this._stream.httpHeaders),this._headers.append("Range",`bytes=${o}-${i-1}`);const s=a.url;fetch(s,lCe(this._headers,this._withCredentials,this._abortController)).then(d=>{if(!sCe(d.status))throw kA(d.status,s);this._readCapability.resolve(),this._reader=d.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:o}=await this._reader.read();return o?{value:t,done:o}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:cCe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}const j_=200,I_=206;function obt(e){const t=e.response;return typeof t!="string"?t:yA(t).buffer}class rbt{constructor(t,o={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&o.httpHeaders||Object.create(null),this.withCredentials=o.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,o,i){const a={begin:t,end:o};for(const s in i)a[s]=i[s];return this.request(a)}requestFull(t){return this.request(t)}request(t){const o=new XMLHttpRequest,i=this.currXhrId++,a=this.pendingRequests[i]={xhr:o};o.open("GET",this.url),o.withCredentials=this.withCredentials;for(const s in this.httpHeaders){const d=this.httpHeaders[s];d!==void 0&&o.setRequestHeader(s,d)}return this.isHttp&&"begin"in t&&"end"in t?(o.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.expectedStatus=I_):a.expectedStatus=j_,o.responseType="arraybuffer",t.onError&&(o.onerror=function(s){t.onError(o.status)}),o.onreadystatechange=this.onStateChange.bind(this,i),o.onprogress=this.onProgress.bind(this,i),a.onHeadersReceived=t.onHeadersReceived,a.onDone=t.onDone,a.onError=t.onError,a.onProgress=t.onProgress,o.send(null),i}onProgress(t,o){const i=this.pendingRequests[t];i&&i.onProgress?.(o)}onStateChange(t,o){const i=this.pendingRequests[t];if(!i)return;const a=i.xhr;if(a.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),a.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],a.status===0&&this.isHttp){i.onError?.(a.status);return}const s=a.status||j_;if(!(s===j_&&i.expectedStatus===I_)&&s!==i.expectedStatus){i.onError?.(a.status);return}const c=obt(a);if(s===I_){const u=a.getResponseHeader("Content-Range"),p=/bytes (\d+)-(\d+)\/(\d+)/.exec(u);i.onDone({begin:parseInt(p[1],10),chunk:c})}else c?i.onDone({begin:0,chunk:c}):i.onError?.(a.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const o=this.pendingRequests[t].xhr;delete this.pendingRequests[t],o.abort()}}class ibt{constructor(t){this._source=t,this._manager=new rbt(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const o=this._rangeRequestReaders.indexOf(t);o>=0&&this._rangeRequestReaders.splice(o,1)}getFullReader(){return ra(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new nbt(this._manager,this._source),this._fullRequestReader}getRangeReader(t,o){const i=new abt(this._manager,t,o);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeRequestReaders.slice(0))o.cancel(t)}}class nbt{constructor(t,o){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=o.url,this._fullRequestId=t.requestFull(i),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=o.disableRange||!1,this._contentLength=o.length,this._rangeChunkSize=o.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,o=this._manager.getRequestXhr(t),i=d=>o.getResponseHeader(d),{allowRangeRequests:a,suggestedLength:s}=SW({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=AW(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=kA(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const o of this._requests)o.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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class abt{constructor(t,o,i){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(o,i,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 o=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:o,done:!1}):this._queuedChunk=o,this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=kA(t,this._url);for(const o of this._requests)o.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 o=this._queuedChunk;return this._queuedChunk=null,{value:o,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 o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const uCe=/^file:\/\/\/[a-zA-Z]:\//;function sbt(e){const t=up.get("url"),o=t.parse(e);return o.protocol==="file:"||o.host?o:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(o.host||(o.protocol="file:"),o)}class lbt{constructor(t){this.source=t,this.url=sbt(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 ra(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new ubt(this):new dbt(this),this._fullRequestReader}getRangeReader(t,o){if(o<=this._progressiveDataLength)return null;const i=this.isFsUrl?new pbt(this,t,o):new cbt(this,t,o);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const o of this._rangeRequestReaders.slice(0))o.cancel(t)}}class pCe{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const o=t.source;this._contentLength=o.length,this._loaded=0,this._filename=null,this._disableRange=o.disableRange||!1,this._rangeChunkSize=o.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!o.disableStream,this._isRangeSupported=!o.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",o=>{this._error(o)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new O3("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class hCe{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 o=t.source;this._isStreamingSupported=!o.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",o=>{this._error(o)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function B$(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class dbt extends pCe{constructor(t){super(t);const o=i=>{if(i.statusCode===404){const c=new F3(`Missing PDF "${this._url}".`);this._storedError=c,this._headersCapability.reject(c);return}this._headersCapability.resolve(),this._setReadableStream(i);const a=c=>this._readableStream.headers[c.toLowerCase()],{allowRangeRequests:s,suggestedLength:d}=SW({getResponseHeader:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=d||this._contentLength,this._filename=AW(a)};if(this._request=null,this._url.protocol==="http:"){const i=up.get("http");this._request=i.request(B$(this._url,t.httpHeaders),o)}else{const i=up.get("https");this._request=i.request(B$(this._url,t.httpHeaders),o)}this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class cbt extends hCe{constructor(t,o,i){super(t),this._httpHeaders={};for(const s in t.httpHeaders){const d=t.httpHeaders[s];d!==void 0&&(this._httpHeaders[s]=d)}this._httpHeaders.Range=`bytes=${o}-${i-1}`;const a=s=>{if(s.statusCode===404){const d=new F3(`Missing PDF "${this._url}".`);this._storedError=d;return}this._setReadableStream(s)};if(this._request=null,this._url.protocol==="http:"){const s=up.get("http");this._request=s.request(B$(this._url,this._httpHeaders),a)}else{const s=up.get("https");this._request=s.request(B$(this._url,this._httpHeaders),a)}this._request.on("error",s=>{this._storedError=s}),this._request.end()}}class ubt extends pCe{constructor(t){super(t);let o=decodeURIComponent(this._url.path);uCe.test(this._url.href)&&(o=o.replace(/^\//,""));const i=up.get("fs");i.promises.lstat(o).then(a=>{this._contentLength=a.size,this._setReadableStream(i.createReadStream(o)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=new F3(`Missing PDF "${o}".`)),this._storedError=a,this._headersCapability.reject(a)})}}class pbt extends hCe{constructor(t,o,i){super(t);let a=decodeURIComponent(this._url.path);uCe.test(this._url.href)&&(a=a.replace(/^\//,""));const s=up.get("fs");this._setReadableStream(s.createReadStream(a,{start:o,end:i-1}))}}const hbt=1e5,tl=30,mbt=.8;let D$=class yu{#e=Promise.withResolvers();#t=null;#o=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#n=0;#l=0;#c=null;#u=null;#h=0;#d=0;#a=Object.create(null);#m=[];#f=null;#p=[];#y=new WeakMap;#g=null;static#w=new Map;static#v=new Map;static#$=null;static#S=new Set;constructor({textContentSource:t,container:o,viewport:i}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(u){u.enqueue(t),u.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#u=o,this.#d=i.scale*(globalThis.devicePixelRatio||1),this.#h=i.rotation,this.#r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:s,pageX:d,pageY:c}=i.rawDims;this.#g=[1,0,0,-1,-d,c+s],this.#l=a,this.#n=s,yu.#x(),y3(o,i),this.#e.promise.catch(()=>{}).then(()=>{yu.#S.delete(this),this.#r=null,this.#a=null})}render(){const t=()=>{this.#c.read().then(({value:o,done:i})=>{if(i){this.#e.resolve();return}this.#s??=o.lang,Object.assign(this.#a,o.styles),this.#A(o.items),t()},this.#e.reject)};return this.#c=this.#f.getReader(),yu.#S.add(this),t(),this.#e.promise}update({viewport:t,onBefore:o=null}){const i=t.scale*(globalThis.devicePixelRatio||1),a=t.rotation;if(a!==this.#h&&(o?.(),this.#h=a,y3(this.#u,{rotation:a})),i!==this.#d){o?.(),this.#d=i;const s={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:yu.#b(this.#s)};for(const d of this.#p)s.properties=this.#y.get(d),s.div=d,this.#k(s)}}cancel(){const t=new O3("TextLayer task cancelled.");this.#c?.cancel(t).catch(()=>{}),this.#c=null,this.#e.reject(t)}get textDivs(){return this.#p}get textContentItemsStr(){return this.#m}#A(t){if(this.#o)return;this.#r.ctx??=yu.#b(this.#s);const o=this.#p,i=this.#m;for(const a of t){if(o.length>hbt){hr("Ignoring additional textDivs for performance reasons."),this.#o=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const s=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id!==null&&this.#t.setAttribute("id",`${a.id}`),s.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}i.push(a.str),this.#I(a)}}#I(t){const o=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#p.push(o);const a=mo.transform(this.#g,t.transform);let s=Math.atan2(a[1],a[0]);const d=this.#a[t.fontName];d.vertical&&(s+=Math.PI/2);const c=this.#i&&d.fontSubstitution||d.fontFamily,u=Math.hypot(a[2],a[3]),p=u*yu.#C(c,this.#s);let h,m;s===0?(h=a[4],m=a[5]-p):(h=a[4]+p*Math.sin(s),m=a[5]-p*Math.cos(s));const f="calc(var(--scale-factor)*",x=o.style;this.#t===this.#u?(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}${(yu.#$*u).toFixed(2)}px)`,x.fontFamily=c,i.fontSize=u,o.setAttribute("role","presentation"),o.textContent=t.str,o.dir=t.dir,this.#i&&(o.dataset.fontName=d.fontSubstitutionLoadedName||t.fontName),s!==0&&(i.angle=s*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const w=Math.abs(t.transform[0]),b=Math.abs(t.transform[3]);w!==b&&Math.max(w,b)/Math.min(w,b)>1.5&&(y=!0)}if(y&&(i.canvasWidth=d.vertical?t.height:t.width),this.#y.set(o,i),this.#r.div=o,this.#r.properties=i,this.#k(this.#r),i.hasText&&this.#t.append(o),i.hasEOL){const w=document.createElement("br");w.setAttribute("role","presentation"),this.#t.append(w)}}#k(t){const{div:o,properties:i,ctx:a,prevFontSize:s,prevFontFamily:d}=t,{style:c}=o;let u="";if(yu.#$>1&&(u=`scale(${1/yu.#$})`),i.canvasWidth!==0&&i.hasText){const{fontFamily:p}=c,{canvasWidth:h,fontSize:m}=i;(s!==m||d!==p)&&(a.font=`${m*this.#d}px ${p}`,t.prevFontSize=m,t.prevFontFamily=p);const{width:f}=a.measureText(o.textContent);f>0&&(u=`scaleX(${h*this.#d/f}) ${u}`)}i.angle!==0&&(u=`rotate(${i.angle}deg) ${u}`),u.length>0&&(c.transform=u)}static cleanup(){if(!(this.#S.size>0)){this.#w.clear();for(const{canvas:t}of this.#v.values())t.remove();this.#v.clear()}}static#b(t=null){let o=this.#v.get(t||="");if(!o){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),o=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(t,o)}return o}static#x(){if(this.#$!==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.#$=t.getBoundingClientRect().height,t.remove()}static#C(t,o){const i=this.#w.get(t);if(i)return i;const a=this.#b(o),s=a.font;a.canvas.width=a.canvas.height=tl,a.font=`${tl}px ${t}`;const d=a.measureText("");let c=d.fontBoundingBoxAscent,u=Math.abs(d.fontBoundingBoxDescent);if(c){const m=c/(c+u);return this.#w.set(t,m),a.canvas.width=a.canvas.height=0,a.font=s,m}a.strokeStyle="red",a.clearRect(0,0,tl,tl),a.strokeText("g",0,0);let p=a.getImageData(0,0,tl,tl).data;u=0;for(let m=p.length-1-3;m>=0;m-=4)if(p[m]>0){u=Math.ceil(m/4/tl);break}a.clearRect(0,0,tl,tl),a.strokeText("A",0,tl),p=a.getImageData(0,0,tl,tl).data,c=0;for(let m=0,f=p.length;m<f;m+=4)if(p[m]>0){c=tl-Math.floor(m/4/tl);break}a.canvas.width=a.canvas.height=0,a.font=s;const h=c?c/(c+u):mbt;return this.#w.set(t,h),h}};function gbt(){oCe("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:e,container:t,viewport:o,...i}=arguments[0],a=Object.keys(i);a.length>0&&hr("Ignoring `renderTextLayer` parameters: "+a.join(", "));const s=new D$({textContentSource:e,container:t,viewport:o}),{textDivs:d,textContentItemsStr:c}=s;return{promise:s.render(),textDivs:d,textContentItemsStr:c}}function fbt(){oCe("`updateTextLayer`, please use `TextLayer` instead.")}class rx{static textContent(t){const o=[],i={items:o,styles:Object.create(null)};function a(s){if(!s)return;let d=null;const c=s.name;if(c==="#text")d=s.value;else if(rx.shouldBuildText(c))s?.attributes?.textContent?d=s.attributes.textContent:s.value&&(d=s.value);else return;if(d!==null&&o.push({str:d}),!!s.children)for(const u of s.children)a(u)}return a(t),i}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const xbt=65536,ybt=100,wbt=5e3,bbt=gs?Mwt:ywt,vbt=gs?Twt:eCe,Cbt=gs?Iwt:xwt,$bt=gs?Pwt:tCe;function kbt(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new EW,{docId:o}=t,i=e.url?Sbt(e.url):null,a=e.data?Abt(e.data):null,s=e.httpHeaders||null,d=e.withCredentials===!0,c=e.password??null,u=e.range instanceof mCe?e.range:null,p=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:xbt;let h=e.worker instanceof Pd?e.worker:null;const m=e.verbosity,f=typeof e.docBaseUrl=="string"&&!xW(e.docBaseUrl)?e.docBaseUrl:null,x=typeof e.cMapUrl=="string"?e.cMapUrl:null,y=e.cMapPacked!==!1,w=e.CMapReaderFactory||vbt,b=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,C=e.StandardFontDataFactory||$bt,$=e.stopAtErrors!==!0,A=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,E=e.isEvalSupported!==!1,I=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!gs,L=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,T=typeof e.disableFontFace=="boolean"?e.disableFontFace:gs,P=e.fontExtraProperties===!0,B=e.enableXfa===!0,_=e.ownerDocument||globalThis.document,R=e.disableRange===!0,z=e.disableStream===!0,Y=e.disableAutoFetch===!0,Z=e.pdfBug===!0,O=e.enableHWA===!0,U=u?u.length:e.length??NaN,F=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!gs&&!T,D=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:w===eCe&&C===tCe&&x&&b&&Y8(x,document.baseURI)&&Y8(b,document.baseURI),H=e.canvasFactory||new bbt({ownerDocument:_,enableHWA:O}),V=e.filterFactory||new Cbt({docId:o,ownerDocument:_}),te=null;awt(m);const q={canvasFactory:H,filterFactory:V};if(D||(q.cMapReaderFactory=new w({baseUrl:x,isCompressed:y}),q.standardFontDataFactory=new C({baseUrl:b})),!h){const X={verbosity:m,port:ox.workerPort};h=X.port?Pd.fromPort(X):new Pd(X),t._worker=h}const G={docId:o,apiVersion:"4.4.168",data:a,password:c,disableAutoFetch:Y,rangeChunkSize:p,length:U,docBaseUrl:f,enableXfa:B,evaluatorOptions:{maxImageSize:A,disableFontFace:T,ignoreErrors:$,isEvalSupported:E,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:L,fontExtraProperties:P,useSystemFonts:F,cMapUrl:D?x:null,standardFontDataUrl:D?b:null}},J={disableFontFace:T,fontExtraProperties:P,ownerDocument:_,pdfBug:Z,styleElement:te,loadingParams:{disableAutoFetch:Y,enableXfa:B}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const X=h.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let ae;if(u)ae=new qwt(u,{disableRange:R,disableStream:z});else if(!a){if(!i)throw new Error("getDocument - no `url` parameter provided.");ae=(pe=>gs?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&Y8(pe.url)?new Ble(pe):new lbt(pe):Y8(pe.url)?new Ble(pe):new ibt(pe))({url:i,length:U,httpHeaders:s,withCredentials:d,rangeChunkSize:p,disableRange:R,disableStream:z})}return X.then(xe=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const pe=new K8(o,xe,h.port),de=new Ibt(pe,t,ae,J,q);t._transport=de,pe.send("Ready",null)})}).catch(t._capability.reject),t}function Sbt(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(gs&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function Abt(e){if(gs&&typeof EC<"u"&&e instanceof EC)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 yA(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 Dle(e){return typeof e=="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class EW{static#e=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${EW.#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 mCe=class{constructor(t,o,i=!1,a=null){this.length=t,this.initialData=o,this.progressiveDone=i,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,o){for(const i of this._rangeListeners)i(t,o)}onDataProgress(t,o){this._readyCapability.promise.then(()=>{for(const i of this._progressListeners)i(t,o)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const o of this._progressiveReadListeners)o(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,o){mi("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class Ebt{constructor(t,o){this._pdfInfo=t,this._transport=o}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 zr(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:o}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(o)}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 Lbt{#e=null;#t=!1;constructor(t,o,i,a=!1){this._pageIndex=t,this._pageInfo=o,this._transport=i,this._stats=a?new vle:null,this._pdfBug=a,this.commonObjs=i.commonObjs,this.objs=new gCe,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:o=this.rotate,offsetX:i=0,offsetY:a=0,dontFlip:s=!1}={}){return new Jx({viewBox:this.view,scale:t,rotation:o,offsetX:i,offsetY:a,dontFlip:s})}getAnnotations({intent:t="display"}={}){const{renderingIntent:o}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,o)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return zr(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:o,intent:i="display",annotationMode:a=N0.ENABLE,transform:s=null,background:d=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:p=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(i,a,h),{renderingIntent:f,cacheKey:x}=m;this.#t=!1,this.#i(),c||=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 w=!!(f&jd.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const b=A=>{y.renderTasks.delete(C),(this._maybeCleanupAfterRender||w)&&(this.#t=!0),this.#o(!w),A?(C.capability.reject(A),this._abortOperatorList({intentState:y,reason:A instanceof Error?A:new Error(A)})):C.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},C=new i5({callback:b,params:{canvasContext:t,viewport:o,transform:s,background:d},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!w,pdfBug:this._pdfBug,pageColors:p});(y.renderTasks||=new Set).add(C);const $=C.task;return Promise.all([y.displayReadyCapability.promise,c]).then(([A,E])=>{if(this.destroyed){b();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.");C.initializeGraphics({transparency:A,optionalContentConfig:E}),C.operatorListChanged()}).catch(b),$}getOperatorList({intent:t="display",annotationMode:o=N0.ENABLE,printAnnotationStorage:i=null}={}){function a(){d.operatorList.lastChunk&&(d.opListReadCapability.resolve(d.operatorList),d.renderTasks.delete(c))}const s=this._transport.getRenderingIntent(t,o,i,!0);let d=this._intentStates.get(s.cacheKey);d||(d=Object.create(null),this._intentStates.set(s.cacheKey,d));let c;return d.opListReadCapability||(c=Object.create(null),c.operatorListChanged=a,d.opListReadCapability=Promise.withResolvers(),(d.renderTasks||=new Set).add(c),d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),d.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:o=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:o===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>rx.textContent(i));const o=this.streamTextContent(t);return new Promise(function(i,a){function s(){d.read().then(function({value:u,done:p}){if(p){i(c);return}c.lang??=u.lang,Object.assign(c.styles,u.styles),c.items.push(...u.items),s()},a)}const d=o.getReader(),c={items:[],styles:Object.create(null),lang:null};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const o of this._intentStates.values())if(this._abortOperatorList({intentState:o,reason:new Error("Page was destroyed."),force:!0}),!o.opListReadCapability)for(const i of o.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#t=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#t=!0;const o=this.#o(!1);return t&&o&&(this._stats&&=new vle),o}#o(t=!1){if(this.#i(),!this.#t||this.destroyed)return!1;if(t)return this.#e=setTimeout(()=>{this.#e=null,this.#o(!1)},wbt),!1;for(const{renderTasks:o,operatorList:i}of this._intentStates.values())if(o.size>0||!i.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,o){const i=this._intentStates.get(o);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,o){for(let i=0,a=t.length;i<a;i++)o.operatorList.fnArray.push(t.fnArray[i]),o.operatorList.argsArray.push(t.argsArray[i]);o.operatorList.lastChunk=t.lastChunk,o.operatorList.separateAnnots=t.separateAnnots;for(const i of o.renderTasks)i.operatorListChanged();t.lastChunk&&this.#o(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:o,annotationStorageSerializable:i}){const{map:a,transfer:s}=i,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:o,annotationStorage:a},s).getReader(),u=this._intentStates.get(o);u.streamReader=c;const p=()=>{c.read().then(({value:h,done:m})=>{if(m){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,u),p())},h=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const m of u.renderTasks)m.operatorListChanged();this.#o(!0)}if(u.displayReadyCapability)u.displayReadyCapability.reject(h);else if(u.opListReadCapability)u.opListReadCapability.reject(h);else throw h}})};p()}_abortOperatorList({intentState:t,reason:o,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(o instanceof fW){let a=ybt;o.extraDelay>0&&o.extraDelay<1e3&&(a+=o.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:o,force:!0})},a);return}}if(t.streamReader.cancel(new O3(o.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,s]of this._intentStates)if(s===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}class jbt{#e=new Set;#t=Promise.resolve();postMessage(t,o){const i={data:structuredClone(t,o?{transfer:o}:null)};this.#t.then(()=>{for(const a of this.#e)a.call(this,i)})}addEventListener(t,o){this.#e.add(o)}removeEventListener(t,o){this.#e.delete(o)}terminate(){this.#e.clear()}}const rh={isWorkerDisabled:!1,fakeWorkerId:0};gs&&(rh.isWorkerDisabled=!0,ox.workerSrc||="./pdf.worker.mjs"),rh.isSameOrigin=function(e,t){let o;try{if(o=new URL(e),!o.origin||o.origin==="null")return!1}catch{return!1}const i=new URL(t,o);return o.origin===i.origin},rh.createCDNWrapper=function(e){const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class Pd{static#e;constructor({name:t=null,port:o=null,verbosity:i=swt()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,o){if(Pd.#e?.has(o))throw new Error("Cannot use more than one PDFWorker per port.");(Pd.#e||=new WeakMap).set(o,this),this._initializeFromPort(o);return}this._initialize()}get promise(){return gs?Promise.all([up.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 K8("main","worker",t),this._messageHandler.on("ready",function(){}),this.#t()}_initialize(){if(rh.isWorkerDisabled||Pd.#o){this._setupFakeWorker();return}let{workerSrc:t}=Pd;try{rh.isSameOrigin(window.location.href,t)||(t=rh.createCDNWrapper(new URL(t,window.location).href));const o=new Worker(t,{type:"module"}),i=new K8("main","worker",o),a=()=>{s.abort(),i.destroy(),o.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=new AbortController;o.addEventListener("error",()=>{this._webWorker||a()},{signal:s.signal}),i.on("test",c=>{if(s.abort(),this.destroyed||!c){a();return}this._messageHandler=i,this._port=o,this._webWorker=o,this.#t()}),i.on("ready",c=>{if(s.abort(),this.destroyed){a();return}try{d()}catch{this._setupFakeWorker()}});const d=()=>{const c=new Uint8Array;i.send("test",c,[c.buffer])};d();return}catch{fA("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){rh.isWorkerDisabled||(hr("Setting up fake worker."),rh.isWorkerDisabled=!0),Pd._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const o=new jbt;this._port=o;const i=`fake${rh.fakeWorkerId++}`,a=new K8(i+"_worker",i,o);t.setup(a,o),this._messageHandler=new K8(i,i+"_worker",o),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),Pd.#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 o=this.#e?.get(t.port);if(o){if(o._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return o}return new Pd(t)}static get workerSrc(){if(ox.workerSrc)return ox.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#o(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return zr(this,"_setupFakeWorkerGlobal",(async()=>this.#o?this.#o:(await import(this.workerSrc)).WorkerMessageHandler)())}}class Ibt{#e=new Map;#t=new Map;#o=new Map;#i=new Map;#s=null;constructor(t,o,i,a,s){this.messageHandler=t,this.loadingTask=o,this.commonObjs=new gCe,this.fontLoader=new Lwt({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,o=null){const i=this.#e.get(t);if(i)return i;const a=this.messageHandler.sendWithPromise(t,o);return this.#e.set(t,a),a}get annotationStorage(){return zr(this,"annotationStorage",new $W)}getRenderingIntent(t,o=N0.ENABLE,i=null,a=!1){let s=jd.DISPLAY,d=qO;switch(t){case"any":s=jd.ANY;break;case"display":break;case"print":s=jd.PRINT;break;default:hr(`getRenderingIntent - invalid intent: ${t}`)}switch(o){case N0.DISABLE:s+=jd.ANNOTATIONS_DISABLE;break;case N0.ENABLE:break;case N0.ENABLE_FORMS:s+=jd.ANNOTATIONS_FORMS;break;case N0.ENABLE_STORAGE:s+=jd.ANNOTATIONS_STORAGE,d=(s&jd.PRINT&&i instanceof nCe?i:this.annotationStorage).serializable;break;default:hr(`getRenderingIntent - invalid annotationMode: ${o}`)}return a&&(s+=jd.OPLIST),{renderingIntent:s,cacheKey:`${s}_${d.hash}`,annotationStorageSerializable:d}}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 i of this.#t.values())t.push(i._destroy());this.#t.clear(),this.#o.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const o=this.messageHandler.sendWithPromise("Terminate",null);return t.push(o),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),D$.cleanup(),this._networkStream?.cancelAllRequests(new O3("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:o}=this;t.on("GetReader",(i,a)=>{ra(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},a.onPull=()=>{this._fullReader.read().then(function({value:s,done:d}){if(d){a.close();return}ra(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{a.error(s)})},a.onCancel=s=>{this._fullReader.cancel(s),a.ready.catch(d=>{if(!this.destroyed)throw d})}}),t.on("ReaderHeadersReady",i=>{const a=Promise.withResolvers(),s=this._fullReader;return s.headersReady.then(()=>{(!s.isStreamingSupported||!s.isRangeSupported)&&(this._lastProgress&&o.onProgress?.(this._lastProgress),s.onProgress=d=>{o.onProgress?.({loaded:d.loaded,total:d.total})}),a.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},a.reject),a.promise}),t.on("GetRangeReader",(i,a)=>{ra(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(i.begin,i.end);if(!s){a.close();return}a.onPull=()=>{s.read().then(function({value:d,done:c}){if(c){a.close();return}ra(d instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(d),1,[d])}).catch(d=>{a.error(d)})},a.onCancel=d=>{s.cancel(d),a.ready.catch(c=>{if(!this.destroyed)throw c})}}),t.on("GetDoc",({pdfInfo:i})=>{this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,o._capability.resolve(new Ebt(i,this))}),t.on("DocException",function(i){let a;switch(i.name){case"PasswordException":a=new YO(i.message,i.code);break;case"InvalidPDFException":a=new Zve(i.message);break;case"MissingPDFException":a=new F3(i.message);break;case"UnexpectedResponseException":a=new xA(i.message,i.status);break;case"UnknownErrorException":a=new KO(i.message,i.details);break;default:mi("DocException - expected a valid Error.")}o._capability.reject(a)}),t.on("PasswordRequest",i=>{if(this.#s=Promise.withResolvers(),o.onPassword){const a=s=>{s instanceof Error?this.#s.reject(s):this.#s.resolve({password:s})};try{o.onPassword(a,i.code)}catch(s){this.#s.reject(s)}}else this.#s.reject(new YO(i.message,i.code));return this.#s.promise}),t.on("DataLoaded",i=>{o.onProgress?.({loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;this.#t.get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),t.on("commonobj",([i,a,s])=>{if(this.destroyed||this.commonObjs.has(i))return null;switch(a){case"Font":const{disableFontFace:d,fontExtraProperties:c,pdfBug:u}=this._params;if("error"in s){const f=s.error;hr(`Error during font loading: ${f}`),this.commonObjs.resolve(i,f);break}const p=u&&globalThis.FontInspector?.enabled?(f,x)=>globalThis.FontInspector.fontAdded(f,x):null,h=new jwt(s,{disableFontFace:d,inspectFont:p});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!c&&h.data&&(h.data=null),this.commonObjs.resolve(i,h)});break;case"CopyLocalImage":const{imageRef:m}=s;ra(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(i,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,s);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([i,a,s,d])=>{if(this.destroyed)return;const c=this.#t.get(a);if(!c.objs.has(i)){if(c._intentStates.size===0){d?.bitmap?.close();return}switch(s){case"Image":c.objs.resolve(i,d),d?.dataLen>owt&&(c._maybeCleanupAfterRender=!0);break;case"Pattern":c.objs.resolve(i,d);break;default:throw new Error(`Got unknown object type ${s}`)}}}),t.on("DocProgress",i=>{this.destroyed||o.onProgress?.({loaded:i.loaded,total:i.total})}),t.on("FetchBuiltInCMap",i=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(i):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",i=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(i):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&hr("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:o}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},o).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const o=t-1,i=this.#o.get(o);if(i)return i;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:o}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&this.#i.set(s.refStr,t);const d=new Lbt(o,s,this,this._params.pdfBug);return this.#t.set(o,d),d});return this.#o.set(o,a),a}getPageIndex(t){return Dle(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,o){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:o})}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(o=>new Kwt(o,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",o=this.#e.get(t);if(o)return o;const i=this.messageHandler.sendWithPromise(t,null).then(a=>({info:a[0],metadata:a[1]?new Gwt(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const o of this.#t.values())if(!o.cleanup())throw new Error(`startCleanup: Page ${o.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),D$.cleanup()}}cachedPageNumber(t){if(!Dle(t))return null;const o=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#i.get(o)??null}}const Zw=Symbol("INITIAL_DATA");class gCe{#e=Object.create(null);#t(t){return this.#e[t]||={...Promise.withResolvers(),data:Zw}}get(t,o=null){if(o){const a=this.#t(t);return a.promise.then(()=>o(a.data)),null}const i=this.#e[t];if(!i||i.data===Zw)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const o=this.#e[t];return!!o&&o.data!==Zw}resolve(t,o=null){const i=this.#t(t);i.data=o,i.resolve()}clear(){for(const t in this.#e){const{data:o}=this.#e[t];o?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const t in this.#e){const{data:o}=this.#e[t];o!==Zw&&(yield[t,o])}}}class Mbt{#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:o}=this.#e;return t.form||t.canvas&&o?.size>0}}class i5{#e=null;static#t=new WeakSet;constructor({callback:t,params:o,objs:i,commonObjs:a,annotationCanvasMap:s,operatorList:d,pageIndex:c,canvasFactory:u,filterFactory:p,useRequestAnimationFrame:h=!1,pdfBug:m=!1,pageColors:f=null}){this.callback=t,this.params=o,this.objs=i,this.commonObjs=a,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=d,this._pageIndex=c,this.canvasFactory=u,this.filterFactory=p,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 Mbt(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=o.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:o}){if(this.cancelled)return;if(this._canvas){if(i5.#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.");i5.#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:i,viewport:a,transform:s,background:d}=this.params;this.gfx=new w5(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:o},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:a,transparency:t,background:d}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,o=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),i5.#t.delete(this._canvas),this.callback(t||new fW(`Rendering cancelled, page ${this._pageIndex+1}`,o))}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(),i5.#t.delete(this._canvas),this.callback())))}}const Tbt="4.4.168",Pbt="19fbc8998";function _le(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function q6(e){return Math.max(0,Math.min(255,255*e))}class zle{static CMYK_G([t,o,i,a]){return["G",1-Math.min(1,.3*t+.59*i+.11*o+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=q6(t),[t,t,t]}static G_HTML([t]){const o=_le(t);return`#${o}${o}${o}`}static RGB_G([t,o,i]){return["G",.3*t+.59*o+.11*i]}static RGB_rgb(t){return t.map(q6)}static RGB_HTML(t){return`#${t.map(_le).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,o,i,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,i+a),1-Math.min(1,o+a)]}static CMYK_rgb([t,o,i,a]){return[q6(1-Math.min(1,t+a)),q6(1-Math.min(1,i+a)),q6(1-Math.min(1,o+a))]}static CMYK_HTML(t){const o=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(o)}static RGB_CMYK([t,o,i]){const a=1-t,s=1-o,d=1-i,c=Math.min(a,s,d);return["CMYK",a,s,d,c]}}class fCe{static setupStorage(t,o,i,a,s){const d=a.getValue(o,{value:null});switch(i.name){case"textarea":if(d.value!==null&&(t.textContent=d.value),s==="print")break;t.addEventListener("input",c=>{a.setValue(o,{value:c.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(d.value===i.attributes.xfaOn?t.setAttribute("checked",!0):d.value===i.attributes.xfaOff&&t.removeAttribute("checked"),s==="print")break;t.addEventListener("change",c=>{a.setValue(o,{value:c.target.checked?c.target.getAttribute("xfaOn"):c.target.getAttribute("xfaOff")})})}else{if(d.value!==null&&t.setAttribute("value",d.value),s==="print")break;t.addEventListener("input",c=>{a.setValue(o,{value:c.target.value})})}break;case"select":if(d.value!==null){t.setAttribute("value",d.value);for(const c of i.children)c.attributes.value===d.value?c.attributes.selected=!0:c.attributes.hasOwnProperty("selected")&&delete c.attributes.selected}t.addEventListener("input",c=>{const u=c.target.options,p=u.selectedIndex===-1?"":u[u.selectedIndex].value;a.setValue(o,{value:p})});break}}static setAttributes({html:t,element:o,storage:i=null,intent:a,linkService:s}){const{attributes:d}=o,c=t instanceof HTMLAnchorElement;d.type==="radio"&&(d.name=`${d.name}-${a}`);for(const[u,p]of Object.entries(d))if(p!=null)switch(u){case"class":p.length&&t.setAttribute(u,p.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",p);break;case"style":Object.assign(t.style,p);break;case"textContent":t.textContent=p;break;default:(!c||u!=="href"&&u!=="newWindow")&&t.setAttribute(u,p)}c&&s.addLinkAttributes(t,d.href,d.newWindow),i&&d.dataId&&this.setupStorage(t,d.dataId,o,i)}static render(t){const o=t.annotationStorage,i=t.linkService,a=t.xfaHtml,s=t.intent||"display",d=document.createElement(a.name);a.attributes&&this.setAttributes({html:d,element:a,intent:s,linkService:i});const c=s!=="richText",u=t.div;if(u.append(d),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;u.style.transform=m}c&&u.setAttribute("class","xfaLayer xfaFont");const p=[];if(a.children.length===0){if(a.value){const m=document.createTextNode(a.value);d.append(m),c&&rx.shouldBuildText(a.name)&&p.push(m)}return{textDivs:p}}const h=[[a,-1,d]];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:w}=y;if(w==="#text"){const C=document.createTextNode(y.value);p.push(C),x.append(C);continue}const b=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,w):document.createElement(w);if(x.append(b),y.attributes&&this.setAttributes({html:b,element:y,storage:o,intent:s,linkService:i}),y.children?.length>0)h.push([y,-1,b]);else if(y.value){const C=document.createTextNode(y.value);c&&rx.shouldBuildText(w)&&p.push(C),b.append(C)}}for(const m of u.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:p}}static update(t){const o=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=o,t.div.hidden=!1}}const ty=1e3,Bbt=9,w3=new WeakSet;function Eh(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class Dbt{static create(t){switch(t.data.annotationType){case Xn.LINK:return new xCe(t);case Xn.TEXT:return new _bt(t);case Xn.WIDGET:switch(t.data.fieldType){case"Tx":return new zbt(t);case"Btn":return t.data.radioButton?new yCe(t):t.data.checkBox?new Fbt(t):new Obt(t);case"Ch":return new Nbt(t);case"Sig":return new Rbt(t)}return new N3(t);case Xn.POPUP:return new eN(t);case Xn.FREETEXT:return new wCe(t);case Xn.LINE:return new Vbt(t);case Xn.SQUARE:return new Ubt(t);case Xn.CIRCLE:return new Wbt(t);case Xn.POLYLINE:return new bCe(t);case Xn.CARET:return new Gbt(t);case Xn.INK:return new vCe(t);case Xn.POLYGON:return new Qbt(t);case Xn.HIGHLIGHT:return new Ybt(t);case Xn.UNDERLINE:return new Kbt(t);case Xn.SQUIGGLY:return new qbt(t);case Xn.STRIKEOUT:return new Zbt(t);case Xn.STAMP:return new CCe(t);case Xn.FILEATTACHMENT:return new Jbt(t);default:return new jn(t)}}}class jn{#e=null;#t=!1;#o=null;constructor(t,{isRenderable:o=!1,ignoreBorder:i=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=o,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,o&&(this.container=this._createContainer(i)),a&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:o,richText:i}){return!!(t?.str||o?.str||i?.str)}get hasPopupData(){return jn._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:o}=t;o&&this.#i(o),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:o},data:{rect:i,rotation:a},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:d,pageX:c,pageY:u}}}}=this;i?.splice(0,4,...t);const{width:p,height:h}=Eh(t);o.left=`${100*(t[0]-c)/s}%`,o.top=`${100*(d-t[3]+u)/d}%`,a===0?(o.width=`${100*p/s}%`,o.height=`${100*h/d}%`):this.setRotation(a)}_createContainer(t){const{data:o,parent:{page:i,viewport:a}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",o.id),this instanceof N3||(s.tabIndex=ty);const{style:d}=s;if(d.zIndex=this.parent.zIndex++,o.popupRef&&s.setAttribute("aria-haspopup","dialog"),o.alternativeText&&(s.title=o.alternativeText),o.noRotate&&s.classList.add("norotate"),!o.rect||this instanceof eN){const{rotation:w}=o;return!o.hasOwnCanvas&&w!==0&&this.setRotation(w,s),s}const{width:c,height:u}=Eh(o.rect);if(!t&&o.borderStyle.width>0){d.borderWidth=`${o.borderStyle.width}px`;const w=o.borderStyle.horizontalCornerRadius,b=o.borderStyle.verticalCornerRadius;if(w>0||b>0){const $=`calc(${w}px * var(--scale-factor)) / calc(${b}px * var(--scale-factor))`;d.borderRadius=$}else if(this instanceof yCe){const $=`calc(${c}px * var(--scale-factor)) / calc(${u}px * var(--scale-factor))`;d.borderRadius=$}switch(o.borderStyle.style){case Y6.SOLID:d.borderStyle="solid";break;case Y6.DASHED:d.borderStyle="dashed";break;case Y6.BEVELED:hr("Unimplemented border style: beveled");break;case Y6.INSET:hr("Unimplemented border style: inset");break;case Y6.UNDERLINE:d.borderBottomStyle="solid";break}const C=o.borderColor||null;C?(this.#t=!0,d.borderColor=mo.makeHexColor(C[0]|0,C[1]|0,C[2]|0)):d.borderWidth=0}const p=mo.normalizeRect([o.rect[0],i.view[3]-o.rect[1]+i.view[1],o.rect[2],i.view[3]-o.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:m,pageX:f,pageY:x}=a.rawDims;d.left=`${100*(p[0]-f)/h}%`,d.top=`${100*(p[1]-x)/m}%`;const{rotation:y}=o;return o.hasOwnCanvas||y===0?(d.width=`${100*c/h}%`,d.height=`${100*u/m}%`):this.setRotation(y,s),s}setRotation(t,o=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:a}=this.parent.viewport.rawDims,{width:s,height:d}=Eh(this.data.rect);let c,u;t%180===0?(c=100*s/i,u=100*d/a):(c=100*d/i,u=100*s/a),o.style.width=`${c}%`,o.style.height=`${u}%`,o.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(o,i,a)=>{const s=a.detail[o],d=s[0],c=s.slice(1);a.target.style[i]=zle[`${d}_HTML`](c),this.annotationStorage.setValue(this.data.id,{[i]:zle[`${d}_rgb`](c)})};return zr(this,"_commonActions",{display:o=>{const{display:i}=o.detail,a=i%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:i===1||i===2})},print:o=>{this.annotationStorage.setValue(this.data.id,{noPrint:!o.detail.print})},hidden:o=>{const{hidden:i}=o.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:o=>{setTimeout(()=>o.target.focus({preventScroll:!1}),0)},userName:o=>{o.target.title=o.detail.userName},readonly:o=>{o.target.disabled=o.detail.readonly},required:o=>{this._setRequired(o.target,o.detail.required)},bgColor:o=>{t("bgColor","backgroundColor",o)},fillColor:o=>{t("fillColor","backgroundColor",o)},fgColor:o=>{t("fgColor","color",o)},textColor:o=>{t("textColor","color",o)},borderColor:o=>{t("borderColor","borderColor",o)},strokeColor:o=>{t("strokeColor","borderColor",o)},rotation:o=>{const i=o.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,o){const i=this._commonActions;for(const a of Object.keys(o.detail))(t[a]||i[a])?.(o)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const o=this.annotationStorage.getRawValue(this.data.id);if(!o)return;const i=this._commonActions;for(const[a,s]of Object.entries(o)){const d=i[a];if(d){const c={detail:{[a]:s},target:t};d(c),delete o[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[o,i,a,s]=this.data.rect.map(w=>Math.fround(w));if(t.length===8){const[w,b,C,$]=t.subarray(2,6);if(a===w&&s===b&&o===C&&i===$)return}const{style:d}=this.container;let c;if(this.#t){const{borderColor:w,borderWidth:b}=d;d.borderWidth=0,c=["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="${w}" stroke-width="${b}">`],this.container.classList.add("hasBorder")}const u=a-o,p=s-i,{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 w=2,b=t.length;w<b;w+=8){const C=t[w],$=t[w+1],A=t[w+2],E=t[w+3],I=h.createElement("rect"),L=(A-o)/u,T=(s-$)/p,P=(C-A)/u,B=($-E)/p;I.setAttribute("x",L),I.setAttribute("y",T),I.setAttribute("width",P),I.setAttribute("height",B),x.append(I),c?.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${T}" width="${P}" height="${B}"/>`)}this.#t&&(c.push("</g></svg>')"),d.backgroundImage=c.join("")),this.container.append(m),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:o}=this;t.setAttribute("aria-haspopup","dialog");const i=this.#o=new eN({data:{color:o.color,titleObj:o.titleObj,modificationDate:o.modificationDate,contentsObj:o.contentsObj,richText:o.richText,parentRect:o.rect,borderStyle:0,id:`popup_${o.id}`,rotation:o.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){mi("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,o=null){const i=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:s,id:d,exportValues:c}of a){if(s===-1||d===o)continue;const u=typeof c=="string"?c:null,p=document.querySelector(`[data-element-id="${d}"]`);if(p&&!w3.has(p)){hr(`_getElementsByName - element not allowed: ${d}`);continue}i.push({id:d,exportValue:u,domElement:p})}return i}for(const a of document.getElementsByName(t)){const{exportValue:s}=a,d=a.getAttribute("data-element-id");d!==o&&w3.has(a)&&i.push({id:d,exportValue:s,domElement:a})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const o of t)o.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:o}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:o})})}}class xCe extends jn{constructor(t,o=null){super(t,{isRenderable:!0,ignoreBorder:!!o?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:o}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let a=!1;return t.url?(o.addLinkAttributes(i,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(i,t.action),a=!0):t.attachment?(this.#t(i,t.attachment,t.attachmentDest),a=!0):t.setOCGState?(this.#o(i,t.setOCGState),a=!0):t.dest?(this._bindLink(i,t.dest),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),a=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(i,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(i),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(t,o){t.href=this.linkService.getDestinationHash(o),t.onclick=()=>(o&&this.linkService.goToDestination(o),!1),(o||o==="")&&this.#e()}_bindNamedAction(t,o){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(o),!1),this.#e()}#t(t,o,i=null){t.href=this.linkService.getAnchorUrl(""),o.description&&(t.title=o.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(o.content,o.filename,i),!1),this.#e()}#o(t,o){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(o),!1),this.#e()}_bindJSAction(t,o){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(o.actions)){const s=i.get(a);s&&(t[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o.id,name:a}}),!1))}t.onclick||(t.onclick=()=>!1),this.#e()}_bindResetFormAction(t,o){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){hr('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();const{fields:a,refs:s,include:d}=o,c=[];if(a.length!==0||s.length!==0){const h=new Set(s);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)===d&&c.push(f)}else for(const h of Object.values(this._fieldObjects))c.push(...h);const u=this.annotationStorage,p=[];for(const h of c){const{id:m}=h;switch(p.push(m),h.type){case"text":{const x=h.defaultValue||"";u.setValue(m,{value:x});break}case"checkbox":case"radiobutton":{const x=h.defaultValue===h.exportValues;u.setValue(m,{value:x});break}case"combobox":case"listbox":{const x=h.defaultValue||"";u.setValue(m,{value:x});break}default:continue}const f=document.querySelector(`[data-element-id="${m}"]`);if(f){if(!w3.has(f)){hr(`_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:p,name:"ResetForm"}}),!1}}}class _bt extends jn{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 N3 extends jn{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return gl.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,o,i,a,s){i.includes("mouse")?t.addEventListener(i,d=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(d),shift:d.shiftKey,modifier:this._getKeyModifier(d)}})}):t.addEventListener(i,d=>{if(i==="blur"){if(!o.focused||!d.relatedTarget)return;o.focused=!1}else if(i==="focus"){if(o.focused)return;o.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:s(d)}})})}_setEventListeners(t,o,i,a){for(const[s,d]of i)(d==="Action"||this.data.actions?.[d])&&((d==="Focus"||d==="Blur")&&(o||={focused:!1}),this._setEventListener(t,o,s,d,a),d==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,o,"blur","Blur",null):d==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,o,"focus","Focus",null))}_setBackgroundColor(t){const o=this.data.backgroundColor||null;t.style.backgroundColor=o===null?"transparent":mo.makeHexColor(o[0],o[1],o[2])}_setTextStyle(t){const o=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||Bbt,s=t.style;let d;const c=2,u=p=>Math.round(10*p)/10;if(this.data.multiLine){const p=Math.abs(this.data.rect[3]-this.data.rect[1]-c),h=Math.round(p/(S_*a))||1,m=p/h;d=Math.min(a,u(m/S_))}else{const p=Math.abs(this.data.rect[3]-this.data.rect[1]-c);d=Math.min(a,u(p/S_))}s.fontSize=`calc(${d}px * var(--scale-factor))`,s.color=mo.makeHexColor(i[0],i[1],i[2]),this.data.textAlignment!==null&&(s.textAlign=o[this.data.textAlignment])}_setRequired(t,o){o?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",o)}}class zbt extends N3{constructor(t){const o=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:o})}setPropertyOnSiblings(t,o,i,a){const s=this.annotationStorage;for(const d of this._getElementsByName(t.name,t.id))d.domElement&&(d.domElement[o]=i),s.setValue(d.id,{[a]:i})}render(){const t=this.annotationStorage,o=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const a=t.getValue(o,{value:this.data.fieldValue});let s=a.value||"";const d=t.getValue(o,{charLimit:this.data.maxLen}).charLimit;d&&s.length>d&&(s=s.slice(0,d));let c=a.formattedValue||this.data.textContent?.join(`
233
233
  `)||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const u={userValue:s,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=c??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",c??s),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),w3.add(i),i.setAttribute("data-element-id",o),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=ty,this._setRequired(i,this.data.required),d&&(i.maxLength=d),i.addEventListener("input",h=>{t.setValue(o,{value:h.target.value}),this.setPropertyOnSiblings(i,"value",h.target.value,"value"),u.formattedValue=null}),i.addEventListener("resetform",h=>{const m=this.data.defaultFieldValue??"";i.value=u.userValue=m,u.formattedValue=null});let p=h=>{const{formattedValue:m}=u;m!=null&&(h.target.value=m),h.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",m=>{if(u.focused)return;const{target:f}=m;u.userValue&&(f.value=u.userValue),u.lastCommittedValue=f.value,u.commitKey=1,this.data.actions?.Focus||(u.focused=!0)}),i.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const f={value(x){u.userValue=x.detail.value??"",t.setValue(o,{value:u.userValue.toString()}),x.target.value=u.userValue},formattedValue(x){const{formattedValue:y}=x.detail;u.formattedValue=y,y!=null&&x.target!==document.activeElement&&(x.target.value=y),t.setValue(o,{formattedValue:y})},selRange(x){x.target.setSelectionRange(...x.detail.selRange)},charLimit:x=>{const{charLimit:y}=x.detail,{target:w}=x;if(y===0){w.removeAttribute("maxLength");return}w.setAttribute("maxLength",y);let b=u.userValue;!b||b.length<=y||(b=b.slice(0,y),w.value=u.userValue=b,t.setValue(o,{value:b}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:b,willCommit:!0,commitKey:1,selStart:w.selectionStart,selEnd:w.selectionEnd}}))}};this._dispatchEventFromSandbox(f,m)}),i.addEventListener("keydown",m=>{u.commitKey=1;let f=-1;if(m.key==="Escape"?f=0:m.key==="Enter"&&!this.data.multiLine?f=2:m.key==="Tab"&&(u.commitKey=3),f===-1)return;const{value:x}=m.target;u.lastCommittedValue!==x&&(u.lastCommittedValue=x,u.userValue=x,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:x,willCommit:!0,commitKey:f,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const h=p;p=null,i.addEventListener("blur",m=>{if(!u.focused||!m.relatedTarget)return;this.data.actions?.Blur||(u.focused=!1);const{value:f}=m.target;u.userValue=f,u.lastCommittedValue!==f&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:f,willCommit:!0,commitKey:u.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}),h(m)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",m=>{u.lastCommittedValue=null;const{data:f,target:x}=m,{value:y,selectionStart:w,selectionEnd:b}=x;let C=w,$=b;switch(m.inputType){case"deleteWordBackward":{const A=y.substring(0,w).match(/\w*[^\w]*$/);A&&(C-=A[0].length);break}case"deleteWordForward":{const A=y.substring(w).match(/^[^\w]*\w*/);A&&($+=A[0].length);break}case"deleteContentBackward":w===b&&(C-=1);break;case"deleteContentForward":w===b&&($+=1);break}m.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:y,change:f||"",willCommit:!1,selStart:C,selEnd:$}})}),this._setEventListeners(i,u,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(p&&i.addEventListener("blur",p),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/d;i.classList.add("comb"),i.style.letterSpacing=`calc(${m}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Rbt extends N3{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class Fbt extends N3{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,o=this.data,i=o.id;let a=t.getValue(i,{value:o.exportValue===o.fieldValue}).value;typeof a=="string"&&(a=a!=="Off",t.setValue(i,{value:a})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return w3.add(s),s.setAttribute("data-element-id",i),s.disabled=o.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=o.fieldName,a&&s.setAttribute("checked",!0),s.setAttribute("exportValue",o.exportValue),s.tabIndex=ty,s.addEventListener("change",d=>{const{name:c,checked:u}=d.target;for(const p of this._getElementsByName(c,i)){const h=u&&p.exportValue===o.exportValue;p.domElement&&(p.domElement.checked=h),t.setValue(p.id,{value:h})}t.setValue(i,{value:u})}),s.addEventListener("resetform",d=>{const c=o.defaultFieldValue||"Off";d.target.checked=c===o.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",d=>{const c={value(u){u.target.checked=u.detail.value!=="Off",t.setValue(i,{value:u.target.checked})}};this._dispatchEventFromSandbox(c,d)}),this._setEventListeners(s,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)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class yCe extends N3{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,o=this.data,i=o.id;let a=t.getValue(i,{value:o.fieldValue===o.buttonValue}).value;if(typeof a=="string"&&(a=a!==o.buttonValue,t.setValue(i,{value:a})),a)for(const d of this._getElementsByName(o.fieldName,i))t.setValue(d.id,{value:!1});const s=document.createElement("input");if(w3.add(s),s.setAttribute("data-element-id",i),s.disabled=o.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=o.fieldName,a&&s.setAttribute("checked",!0),s.tabIndex=ty,s.addEventListener("change",d=>{const{name:c,checked:u}=d.target;for(const p of this._getElementsByName(c,i))t.setValue(p.id,{value:!1});t.setValue(i,{value:u})}),s.addEventListener("resetform",d=>{const c=o.defaultFieldValue;d.target.checked=c!=null&&c===o.buttonValue}),this.enableScripting&&this.hasJSActions){const d=o.buttonValue;s.addEventListener("updatefromsandbox",c=>{const u={value:p=>{const h=d===p.detail.value;for(const m of this._getElementsByName(p.target.name)){const f=h&&m.id===i;m.domElement&&(m.domElement.checked=f),t.setValue(m.id,{value:f})}}};this._dispatchEventFromSandbox(u,c)}),this._setEventListeners(s,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)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Obt extends xCe{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const o=t.lastChild;return this.enableScripting&&this.hasJSActions&&o&&(this._setDefaultPropertiesFromJS(o),o.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({},i)})),t}}class Nbt extends N3{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,o=this.data.id,i=t.getValue(o,{value:this.data.fieldValue}),a=document.createElement("select");w3.add(a),a.setAttribute("data-element-id",o),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=ty;let s=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,i.value.includes(h.exportValue)&&(m.setAttribute("selected",!0),s=!1),a.append(m)}let d=null;if(s){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),a.prepend(h),d=()=>{h.remove(),a.removeEventListener("input",d),d=null},a.addEventListener("input",d)}const c=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 u=c(!1);const p=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){d?.();const x=f.detail.value,y=new Set(Array.isArray(x)?x:[x]);for(const w of a.options)w.selected=y.has(w.value);t.setValue(o,{value:c(!0)}),u=c(!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,b=>b.selected)===-1&&(x[0].selected=!0),t.setValue(o,{value:c(!0),items:p(f)}),u=c(!1)},clear(f){for(;a.length!==0;)a.remove(0);t.setValue(o,{value:null,items:[]}),u=c(!1)},insert(f){const{index:x,displayValue:y,exportValue:w}=f.detail.insert,b=a.children[x],C=document.createElement("option");C.textContent=y,C.value=w,b?b.before(C):a.append(C),t.setValue(o,{value:c(!0),items:p(f)}),u=c(!1)},items(f){const{items:x}=f.detail;for(;a.length!==0;)a.remove(0);for(const y of x){const{displayValue:w,exportValue:b}=y,C=document.createElement("option");C.textContent=w,C.value=b,a.append(C)}a.options.length>0&&(a.options[0].selected=!0),t.setValue(o,{value:c(!0),items:p(f)}),u=c(!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(o,{value:c(!0)}),u=c(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(m,h)}),a.addEventListener("input",h=>{const m=c(!0),f=c(!1);t.setValue(o,{value:m}),h.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:u,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(o,{value:c(!0)})}),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class eN extends jn{constructor(t){const{data:o,elements:i}=t;super(t,{isRenderable:jn._hasPopupData(o)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new Hbt({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}),o=[];for(const i of this.elements)i.popup=t,o.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",o.map(i=>`${Xve}${i}`).join(",")),this.container}}class Hbt{#e=this.#I.bind(this);#t=this.#C.bind(this);#o=this.#x.bind(this);#i=this.#b.bind(this);#s=null;#r=null;#n=null;#l=null;#c=null;#u=null;#h=null;#d=!1;#a=null;#m=null;#f=null;#p=null;#y=null;#g=null;#w=!1;constructor({container:t,color:o,elements:i,titleObj:a,modificationDate:s,contentsObj:d,richText:c,parent:u,rect:p,parentRect:h,open:m}){this.#r=t,this.#y=a,this.#n=d,this.#p=c,this.#u=u,this.#s=o,this.#f=p,this.#h=h,this.#c=i,this.#l=rCe.toDateObject(s),this.trigger=i.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 i)f.container?.addEventListener("keydown",this.#e);this.#r.hidden=!0,m&&this.#b()}render(){if(this.#a)return;const t=this.#a=document.createElement("div");if(t.className="popup",this.#s){const s=t.style.outlineColor=mo.makeHexColor(...this.#s);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${s} 30%, white)`:t.style.backgroundColor=mo.makeHexColor(...this.#s.map(c=>Math.floor(.7*(255-c)+c)))}const o=document.createElement("span");o.className="header";const i=document.createElement("h1");if(o.append(i),{dir:i.dir,str:i.textContent}=this.#y,t.append(o),this.#l){const s=document.createElement("span");s.classList.add("popupDate"),s.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),s.setAttribute("data-l10n-args",JSON.stringify({date:this.#l.toLocaleDateString(),time:this.#l.toLocaleTimeString()})),o.append(s)}const a=this.#v;if(a)fCe.render({xfaHtml:a,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const s=this._formatContents(this.#n);t.append(s)}this.#r.append(t)}get#v(){const t=this.#p,o=this.#n;return t?.str&&(!o?.str||o.str===t.str)&&this.#p.html||null}get#$(){return this.#v?.attributes?.style?.fontSize||0}get#S(){return this.#v?.attributes?.style?.color||null}#A(t){const o=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:o}]}},a={style:{color:this.#S,fontSize:this.#$?`calc(${this.#$}px * var(--scale-factor))`:""}};for(const s of t.split(`
234
234
  `))o.push({name:"span",value:s,attributes:a});return i}_formatContents({str:t,dir:o}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=o;const a=t.split(/(?:\r\n?|\n)/);for(let s=0,d=a.length;s<d;++s){const c=a[s];i.append(document.createTextNode(c)),s<d-1&&i.append(document.createElement("br"))}return i}#I(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#d)&&this.#b()}updateEdited({rect:t,popupContent:o}){this.#g||={contentsObj:this.#n,richText:this.#p},t&&(this.#m=null),o&&(this.#p=this.#A(o),this.#n=null),this.#a?.remove(),this.#a=null}resetEdited(){this.#g&&({contentsObj:this.#n,richText:this.#p}=this.#g,this.#g=null,this.#a?.remove(),this.#a=null,this.#m=null)}#k(){if(this.#m!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:o,pageHeight:i,pageX:a,pageY:s}}}=this.#u;let d=!!this.#h,c=d?this.#h:this.#f;for(const y of this.#c)if(!c||mo.intersect(y.data.rect,c)!==null){c=y.data.rect,d=!0;break}const u=mo.normalizeRect([c[0],t[3]-c[1]+t[1],c[2],t[3]-c[3]+t[1]]),h=d?c[2]-c[0]+5:0,m=u[0]+h,f=u[1];this.#m=[100*(m-a)/o,100*(f-s)/i];const{style:x}=this.#r;x.left=`${this.#m[0]}%`,x.top=`${this.#m[1]}%`}#b(){this.#d=!this.#d,this.#d?(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.#d&&this.#r.classList.add("focused"):(this.#k(),this.#r.hidden=!1,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)+1e3)}#C(){this.#r.classList.remove("focused"),!(this.#d||!this.isVisible)&&(this.#r.hidden=!0,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)-1e3)}forceHide(){this.#w=this.isVisible,this.#w&&(this.#r.hidden=!0)}maybeShow(){this.#w&&(this.#a||this.#x(),this.#w=!1,this.#r.hidden=!1)}get isVisible(){return this.#r.hidden===!1}}class wCe extends jn{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=jr.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 o of this.textContent){const i=document.createElement("span");i.textContent=o,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class Vbt extends jn{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:o,height:i}=Eh(t.rect),a=this.svgFactory.create(o,i,!0),s=this.#e=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),a.append(s),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Ubt extends jn{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:o,height:i}=Eh(t.rect),a=this.svgFactory.create(o,i,!0),s=t.borderStyle.width,d=this.#e=this.svgFactory.createElement("svg:rect");return d.setAttribute("x",s/2),d.setAttribute("y",s/2),d.setAttribute("width",o-s),d.setAttribute("height",i-s),d.setAttribute("stroke-width",s||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),a.append(d),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Wbt extends jn{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:o,height:i}=Eh(t.rect),a=this.svgFactory.create(o,i,!0),s=t.borderStyle.width,d=this.#e=this.svgFactory.createElement("svg:ellipse");return d.setAttribute("cx",o/2),d.setAttribute("cy",i/2),d.setAttribute("rx",o/2-s/2),d.setAttribute("ry",i/2-s/2),d.setAttribute("stroke-width",s||1),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),a.append(d),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class bCe extends jn{#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:o,borderStyle:i,popupRef:a}}=this;if(!o)return this.container;const{width:s,height:d}=Eh(t),c=this.svgFactory.create(s,d,!0);let u=[];for(let h=0,m=o.length;h<m;h+=2){const f=o[h]-t[0],x=t[3]-o[h+1];u.push(`${f},${x}`)}u=u.join(" ");const p=this.#e=this.svgFactory.createElement(this.svgElementName);return p.setAttribute("points",u),p.setAttribute("stroke-width",i.width||1),p.setAttribute("stroke","transparent"),p.setAttribute("fill","transparent"),c.append(p),this.container.append(c),!a&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Qbt extends bCe{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Gbt extends jn{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 vCe extends jn{#e=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=jr.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:o,borderStyle:i,popupRef:a}}=this,{width:s,height:d}=Eh(t),c=this.svgFactory.create(s,d,!0);for(const u of o){let p=[];for(let m=0,f=u.length;m<f;m+=2){const x=u[m]-t[0],y=t[3]-u[m+1];p.push(`${x},${y}`)}p=p.join(" ");const h=this.svgFactory.createElement(this.svgElementName);this.#e.push(h),h.setAttribute("points",p),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),!a&&this.hasPopupData&&this._createPopup(),c.append(h)}return this.container.append(c),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class Ybt extends jn{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 Kbt extends jn{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 qbt extends jn{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 Zbt extends jn{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 CCe extends jn{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 Jbt extends jn{#e=null;constructor(t){super(t,{isRenderable:!0});const{file:o}=this.data;this.filename=o.filename,this.content=o.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...o})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:o}=this;let i;o.hasAppearance||o.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(o.name)?"paperclip":"pushpin"}.svg`,o.fillAlpha&&o.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(o.fillAlpha*100)}%);`)),i.addEventListener("dblclick",this.#t.bind(this)),this.#e=i;const{isMac:a}=gl.platform;return t.addEventListener("keydown",s=>{s.key==="Enter"&&(a?s.metaKey:s.ctrlKey)&&this.#t()}),!o.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let Xbt=class{#e=null;#t=null;#o=new Map;constructor({div:t,accessibilityManager:o,annotationCanvasMap:i,annotationEditorUIManager:a,page:s,viewport:d}){this.div=t,this.#e=o,this.#t=i,this.page=s,this.viewport=d,this.zIndex=0,this._annotationEditorUIManager=a}#i(t,o){const i=t.firstChild||t;i.id=`${Xve}${o}`,this.div.append(t),this.#e?.moveElementInDOM(this.div,t,i,!1)}async render(t){const{annotations:o}=t,i=this.div;y3(i,this.viewport);const a=new Map,s={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new gW,annotationStorage:t.annotationStorage||new $W,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const d of o){if(d.noHTML)continue;const c=d.annotationType===Xn.POPUP;if(c){const h=a.get(d.id);if(!h)continue;s.elements=h}else{const{width:h,height:m}=Eh(d.rect);if(h<=0||m<=0)continue}s.data=d;const u=Dbt.create(s);if(!u.isRenderable)continue;if(!c&&d.popupRef){const h=a.get(d.popupRef);h?h.push(u):a.set(d.popupRef,[u])}const p=u.render();d.hidden&&(p.style.visibility="hidden"),this.#i(p,d.id),u.annotationEditorType>0&&(this.#o.set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}this.#s()}update({viewport:t}){const o=this.div;this.viewport=t,y3(o,{rotation:t.rotation}),this.#s(),o.hidden=!1}#s(){if(!this.#t)return;const t=this.div;for(const[o,i]of this.#t){const a=t.querySelector(`[data-annotation-id="${o}"]`);if(!a)continue;i.className="annotationContent";const{firstChild:s}=a;s?s.nodeName==="CANVAS"?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):a.append(i)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#o.values())}getEditableAnnotation(t){return this.#o.get(t)}};const Jw=/\r\n?|\n/g;class ta extends Ro{#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`;#c;#u=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=ta.prototype,o=s=>s.isEmpty(),i=A2.TRANSLATE_SMALL,a=A2.TRANSLATE_BIG;return zr(this,"_keyboardManager",new Xx([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:o}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-a,0],checker:o}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:o}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[a,0],checker:o}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:o}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-a],checker:o}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:o}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,a],checker:o}]]))}static _type="freetext";static _editorType=jr.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#r=t.color||ta._defaultColor||Ro._defaultLineColor,this.#c=t.fontSize||ta._defaultFontSize}static initialize(t,o){Ro.initialize(t,o,{strings:["pdfjs-free-text-default-content"]});const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,o){switch(t){case Uo.FREETEXT_SIZE:ta._defaultFontSize=o;break;case Uo.FREETEXT_COLOR:ta._defaultColor=o;break}}updateParams(t,o){switch(t){case Uo.FREETEXT_SIZE:this.#h(o);break;case Uo.FREETEXT_COLOR:this.#d(o);break}}static get defaultPropertiesToUpdate(){return[[Uo.FREETEXT_SIZE,ta._defaultFontSize],[Uo.FREETEXT_COLOR,ta._defaultColor||Ro._defaultLineColor]]}get propertiesToUpdate(){return[[Uo.FREETEXT_SIZE,this.#c],[Uo.FREETEXT_COLOR,this.#r]]}#h(t){const o=a=>{this.editorDiv.style.fontSize=`calc(${a}px * var(--scale-factor))`,this.translate(0,-(a-this.#c)*this.parentScale),this.#c=a,this.#m()},i=this.#c;this.addCommands({cmd:o.bind(this,t),undo:o.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Uo.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#d(t){const o=a=>{this.#r=this.editorDiv.style.color=a},i=this.#r;this.addCommands({cmd:o.bind(this,t),undo:o.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Uo.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,o){this._uiManager.translateSelectedEditors(t,o,!0)}getInitialTranslation(){const t=this.parentScale;return[-ta._internalPadding*t,-(ta._internalPadding+this.#c)*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(jr.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 o of this.editorDiv.childNodes)t.push(ta.#f(o));return t.join(`
235
235
  `)}#m(){const[t,o]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:a,div:s}=this,d=s.style.display,c=s.classList.contains("hidden");s.classList.remove("hidden"),s.style.display="hidden",a.div.append(this.div),i=s.getBoundingClientRect(),s.remove(),s.style.display=d,s.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/o):(this.width=i.height/t,this.height=i.width/o),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#n,o=this.#n=this.#a().trimEnd();if(t===o)return;const i=a=>{if(this.#n=a,!a){this.remove();return}this.#p(),this._uiManager.rebuild(this),this.#m()};this.addCommands({cmd:()=>{i(o)},undo:()=>{i(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){ta._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,o;this.width&&(t=this.x,o=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(),Ro._l10nPromise.get("pdfjs-free-text-default-content").then(a=>this.editorDiv?.setAttribute("default-content",a)),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#c}px * var(--scale-factor))`,i.color=this.#r,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),P$(this,this.div,["dblclick","keydown"]),this.width){const[a,s]=this.parentDimensions;if(this.annotationElementId){const{position:d}=this.#u;let[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);const[p,h]=this.pageDimensions,[m,f]=this.pageTranslation;let x,y;switch(this.rotation){case 0:x=t+(d[0]-m)/p,y=o+this.height-(d[1]-f)/h;break;case 90:x=t+(d[0]-m)/p,y=o-(d[1]-f)/h,[c,u]=[u,-c];break;case 180:x=t-this.width+(d[0]-m)/p,y=o-(d[1]-f)/h,[c,u]=[-c,-u];break;case 270:x=t+(d[0]-m-this.height*h)/p,y=o+(d[1]-f-this.width*p)/h,[c,u]=[-u,c];break}this.setAt(x*a,y*s,c,u)}else this.setAt(t*a,o*s,this.width*a,this.height*s);this.#p(),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(Jw,"")}editorDivPaste(t){const o=t.clipboardData||window.clipboardData,{types:i}=o;if(i.length===1&&i[0]==="text/plain")return;t.preventDefault();const a=ta.#g(o.getData("text")||"").replaceAll(Jw,`
@@ -20395,7 +20395,7 @@ to {
20395
20395
  justify-content: center;
20396
20396
  align-items: center;
20397
20397
  margin-right: ${e=>W6o.approvalCountMarginRight.valuePx(e.windowSize)};
20398
- `,RAe=({card:e,data:t,actions:o,isExpenseAutomationEnabledForUser:i,analytics:a,dndProps:s})=>{const{isUncategorizedExpensesTransactionsExist:d,isUncategorizedIncomeTransactionsExist:c,isUncategorizedExpenseAccountIdentified:u,isUncategorizedIncomeAccountIdentified:p,numOfBillsPendingApproval:h,numOfReimbursementsPendingApproval:m}=t.tasks,f=u===!1||p===!1,x=je();return l.jsx(Xi,{isDragging:s?.draggedCardType!=null,isDragOver:s?.dragOverCard===e.cardType,draggable:!0,onDragStart:y=>s?.onDragStart(e.cardType,y),onDragOver:y=>s?.onDragOver(y,e.cardType),onDragLeave:y=>s?.onDragLeave(y),onDrop:y=>s?.onDrop(y,e.cardType),dimension:e.dimension,children:l.jsx(Rl,{card:e,actions:{onCardClick:()=>{},onReloadData:o.onReloadData},children:l.jsx(Ji,{dimension:e.dimension,style:{cursor:"default"},children:l.jsxs(Q6o,{windowSize:x,children:[l.jsx(G6o,{children:l.jsx(K6o,{children:Q.getLocalizedStrings().taskCard.title})}),l.jsxs(Y6o,{children:[m>0&&l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("remi-awaiting-approval"),onClick:()=>{a?.trackReimbursementTaskCard(m),o.onCategoryClick?.("reimbursement","pending_approval","awaitingMyApproval")},"data-testid":oe("dashboard-tasks-card-remi-awaiting-approval",e.cardType),children:[Q.getLocalizedStrings().taskCard.reimbursementsAwaitingApproval,l.jsxs(Lue,{children:[l.jsx(jue,{windowSize:x,textColor:cg("remi-awaiting-approval"),children:m}),l.jsx(n8,{})]})]})}),h>0&&l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("bills-awaiting-approval"),onClick:()=>{a?.trackBillPayTaskCard(h),o.onCategoryClick?.("bill-pay","pending_approval","awaiting_my_approval")},"data-testid":oe("dashboard-tasks-card-bills-awaiting-approval",e.cardType),children:[Q.getLocalizedStrings().taskCard.billsAwaitingApproval,l.jsxs(Lue,{children:[l.jsx(jue,{windowSize:x,textColor:cg("bills-awaiting-approval"),children:h}),l.jsx(n8,{})]})]})}),f===!0?l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("uncategorized-account-mapping"),onClick:()=>o.onCategoryClick?.("uncategorized-account-mapping"),"data-testid":oe("dashboard-tasks-card-uncategorized-account-mapping",e.cardType),children:[Q.getLocalizedStrings().taskCard.uncategorizedAccountMappingText,l.jsx(n8,{})]})}):null,!i&&d?l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("uncategorized-expense"),onClick:()=>o.onCategoryClick?.("uncategorized-expense"),"data-testid":oe("dashboard-tasks-card-uncategorized-expense",e.cardType),children:[Q.getLocalizedStrings().taskCard.expensesText,l.jsx(n8,{})]})}):null,!i&&c?l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("uncategorized-income"),onClick:()=>o.onCategoryClick?.("uncategorized-income"),"data-testid":oe("dashboard-tasks-card-uncategorized-income",e.cardType),children:[Q.getLocalizedStrings().taskCard.incomeText,l.jsx(n8,{})]})}):null]})]})})})},e.cardIndex)},cg=e=>{switch(e){case"uncategorized-income":return new xt(an.graphColor33);case"uncategorized-expense":return new xt(an.graphColor17);case"bills-awaiting-approval":return new xt(an.graphColor09);case"remi-awaiting-approval":return new xt(an.graphColor05);case"uncategorized-account-mapping":return new xt(an.graphColor34);default:return new xt(It.brandColorJadeDark)}};k.memo(RAe);const FAe=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)"})))),Iue=g.lazy(()=>Og(()=>import("./index-Bp-7eV5c.js"),__vite__mapDeps([13,5,1,6])));function q6o({src:e,autoPlay:t=!0,config:o,controls:i=!0,height:a="100%",isModalOpen:s,loop:d=!1,muted:c=!1,showPlayButton:u=!1,style:p,thumbnail:h,width:m="100%",onEnded:f,onModalClose:x,onPlay:y}){const w=je(),[b,C]=g.useState(!1);g.useEffect(()=>{s===!0&&t?C(!0):s===!1&&C(!1)},[s,t]);const $={};o?.youtube&&($.youtube=o.youtube);const A=()=>{C(!0),y?.()},E=()=>{C(!1),x?.()},I=()=>{C(!1),f?.(),s!=null&&x?.()},L=()=>{C(!0),y?.()};return s!=null?s?ca.createPortal(l.jsx(t8o,{windowSize:w,role:"presentation",children:l.jsx(Go,{onClickAway:E,children:l.jsx(o8o,{windowSize:w,"data-testid":"video-player-modal",children:l.jsxs(r8o,{children:[u&&!b&&l.jsxs(l.Fragment,{children:[h!=null&&h!==""&&l.jsx(e8o,{src:h,alt:"Video thumbnail"}),l.jsx(J6o,{onClick:A,children:l.jsx(X6o,{windowSize:w})})]}),(!u||b)&&l.jsx(g.Suspense,{fallback:l.jsx("div",{style:{width:"100%",height:"100%"}}),children:l.jsx(Iue,{src:e,playing:b,controls:i,muted:c,loop:d,width:"100%",height:"100%",onEnded:I,onPlay:L,config:$})})]})})})}),document.body):null:l.jsx(g.Suspense,{fallback:l.jsx("div",{style:{width:m,height:a,...p}}),children:l.jsx(Iue,{src:e,playing:b,controls:i,muted:c,loop:d,width:m,height:a,style:p,light:u&&!b?h??!0:!1,onEnded:I,onPlay:L,config:$})})}const Z6o=Ot`
20398
+ `,RAe=({card:e,data:t,actions:o,isExpenseAutomationEnabledForUser:i,analytics:a,dndProps:s})=>{const{isUncategorizedExpensesTransactionsExist:d,isUncategorizedIncomeTransactionsExist:c,isUncategorizedExpenseAccountIdentified:u,isUncategorizedIncomeAccountIdentified:p,numOfBillsPendingApproval:h,numOfReimbursementsPendingApproval:m}=t.tasks,f=u===!1||p===!1,x=je();return l.jsx(Xi,{isDragging:s?.draggedCardType!=null,isDragOver:s?.dragOverCard===e.cardType,draggable:!0,onDragStart:y=>s?.onDragStart(e.cardType,y),onDragOver:y=>s?.onDragOver(y,e.cardType),onDragLeave:y=>s?.onDragLeave(y),onDrop:y=>s?.onDrop(y,e.cardType),dimension:e.dimension,children:l.jsx(Rl,{card:e,actions:{onCardClick:()=>{},onReloadData:o.onReloadData},children:l.jsx(Ji,{dimension:e.dimension,style:{cursor:"default"},children:l.jsxs(Q6o,{windowSize:x,children:[l.jsx(G6o,{children:l.jsx(K6o,{children:Q.getLocalizedStrings().taskCard.title})}),l.jsxs(Y6o,{children:[m>0&&l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("remi-awaiting-approval"),onClick:()=>{a?.trackReimbursementTaskCard(m),o.onCategoryClick?.("reimbursement","pending_approval","awaitingMyApproval")},"data-testid":oe("dashboard-tasks-card-remi-awaiting-approval",e.cardType),children:[Q.getLocalizedStrings().taskCard.reimbursementsAwaitingApproval,l.jsxs(Lue,{children:[l.jsx(jue,{windowSize:x,textColor:cg("remi-awaiting-approval"),children:m}),l.jsx(n8,{})]})]})}),h>0&&l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("bills-awaiting-approval"),onClick:()=>{a?.trackBillPayTaskCard(h),o.onCategoryClick?.("bill-pay","pending_approval","awaiting_my_approval")},"data-testid":oe("dashboard-tasks-card-bills-awaiting-approval",e.cardType),children:[Q.getLocalizedStrings().taskCard.billsAwaitingApproval,l.jsxs(Lue,{children:[l.jsx(jue,{windowSize:x,textColor:cg("bills-awaiting-approval"),children:h}),l.jsx(n8,{})]})]})}),f===!0?l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("uncategorized-account-mapping"),onClick:()=>o.onCategoryClick?.("uncategorized-account-mapping"),"data-testid":oe("dashboard-tasks-card-uncategorized-account-mapping",e.cardType),children:[Q.getLocalizedStrings().taskCard.uncategorizedAccountMappingText,l.jsx(n8,{})]})}):null,!i&&d?l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("uncategorized-expense"),onClick:()=>o.onCategoryClick?.("uncategorized-expense"),"data-testid":oe("dashboard-tasks-card-uncategorized-expense",e.cardType),children:[Q.getLocalizedStrings().taskCard.expensesText,l.jsx(n8,{})]})}):null,!i&&c?l.jsx(r8,{children:l.jsxs(i8,{textColor:cg("uncategorized-income"),onClick:()=>o.onCategoryClick?.("uncategorized-income"),"data-testid":oe("dashboard-tasks-card-uncategorized-income",e.cardType),children:[Q.getLocalizedStrings().taskCard.incomeText,l.jsx(n8,{})]})}):null]})]})})})},e.cardIndex)},cg=e=>{switch(e){case"uncategorized-income":return new xt(an.graphColor33);case"uncategorized-expense":return new xt(an.graphColor17);case"bills-awaiting-approval":return new xt(an.graphColor09);case"remi-awaiting-approval":return new xt(an.graphColor05);case"uncategorized-account-mapping":return new xt(an.graphColor34);default:return new xt(It.brandColorJadeDark)}};k.memo(RAe);const FAe=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)"})))),Iue=g.lazy(()=>Og(()=>import("./index-Db_Wr1S4.js"),__vite__mapDeps([13,5,1,6])));function q6o({src:e,autoPlay:t=!0,config:o,controls:i=!0,height:a="100%",isModalOpen:s,loop:d=!1,muted:c=!1,showPlayButton:u=!1,style:p,thumbnail:h,width:m="100%",onEnded:f,onModalClose:x,onPlay:y}){const w=je(),[b,C]=g.useState(!1);g.useEffect(()=>{s===!0&&t?C(!0):s===!1&&C(!1)},[s,t]);const $={};o?.youtube&&($.youtube=o.youtube);const A=()=>{C(!0),y?.()},E=()=>{C(!1),x?.()},I=()=>{C(!1),f?.(),s!=null&&x?.()},L=()=>{C(!0),y?.()};return s!=null?s?ca.createPortal(l.jsx(t8o,{windowSize:w,role:"presentation",children:l.jsx(Go,{onClickAway:E,children:l.jsx(o8o,{windowSize:w,"data-testid":"video-player-modal",children:l.jsxs(r8o,{children:[u&&!b&&l.jsxs(l.Fragment,{children:[h!=null&&h!==""&&l.jsx(e8o,{src:h,alt:"Video thumbnail"}),l.jsx(J6o,{onClick:A,children:l.jsx(X6o,{windowSize:w})})]}),(!u||b)&&l.jsx(g.Suspense,{fallback:l.jsx("div",{style:{width:"100%",height:"100%"}}),children:l.jsx(Iue,{src:e,playing:b,controls:i,muted:c,loop:d,width:"100%",height:"100%",onEnded:I,onPlay:L,config:$})})]})})})}),document.body):null:l.jsx(g.Suspense,{fallback:l.jsx("div",{style:{width:m,height:a,...p}}),children:l.jsx(Iue,{src:e,playing:b,controls:i,muted:c,loop:d,width:m,height:a,style:p,light:u&&!b?h??!0:!1,onEnded:I,onPlay:L,config:$})})}const Z6o=Ot`
20399
20399
  0% {
20400
20400
  transform: rotate(0deg);
20401
20401
  }
@@ -79290,7 +79290,7 @@ ${e}`,T4r=e=>g.createElement("svg",{width:38,height:39,viewBox:"0 0 38 39",fill:
79290
79290
  align-items: end;
79291
79291
  color: ${S.brandColorGoldDark};
79292
79292
  margin-left: ${r.sp2};
79293
- `;var nLr=S_e();const N9=ZH(nLr);class aLr{getSignedInUser(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),o=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER);if(o!=null&&t!=null)return JSON.parse(this.decrypt(o,t))}getShowNegativeAmountInParenthesis(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS),o=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&o!=null?JSON.parse(this.decrypt(t,o)):!1}getShowNegativeAmountInParenthesisPDF(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF),o=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&o!=null?JSON.parse(this.decrypt(t,o)):!0}getSignedInUserTenant(t){const o=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),i=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null&&i!=null)return JSON.parse(this.decrypt(o,i)).find(s=>s.tenantEmailDomain===t)}getSignedInUserTenantWithId(t){const o=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),i=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null&&i!=null)return JSON.parse(this.decrypt(o,i)).find(s=>s.tenantId===t)}getForceRefreshedComponents(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),o=window.localStorage.getItem(this.ZENI_FORCE_REFRESHED_COMPONENTS);if(o&&t!=null){const i=this.decrypt(o,t);return i?JSON.parse(i):[]}return[]}saveForceRefreshedComponents(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);o!=null?window.localStorage.setItem(this.ZENI_FORCE_REFRESHED_COMPONENTS,this.encrypt(JSON.stringify(t),o)):console.warn("Can't update the force refreshed components when the user is logged out!")}saveSignedInUserWithSession(t,o){if(t==null||o==null)throw new Error("Can't accept nil for user or session Id");window.localStorage.setItem(this.ZENI_SESSION_ID,o),window.localStorage.setItem(this.ZENI_SIGNED_IN_USER,this.encrypt(JSON.stringify(t),o))}saveSignedInUserTenants(t,o){const i=o??window.localStorage.getItem(this.ZENI_SESSION_ID);i!=null?window.localStorage.setItem(this.ZENI_SIGNED_IN_USER_TENANTS,this.encrypt(JSON.stringify(t),i)):console.warn("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesis(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.encrypt(JSON.stringify(t),o));else throw new Error("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesisPDF(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.encrypt(JSON.stringify(t),o));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(o=>window.localStorage.getItem(o)!=null).reduce((o,i)=>o&&i)}clearAll(){this.ALL_IDs.forEach(t=>window.localStorage.removeItem(t))}setTheme(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);o!=null&&window.localStorage.setItem(this.ZENI_THEME,this.encrypt(t,o))}getTheme(){const t=window.localStorage.getItem(this.ZENI_THEME),o=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null&&o!==null)return this.decrypt(t,o)}encrypt(t,o){return N9.AES.encrypt(t,o).toString()}decrypt(t,o){return N9.AES.decrypt(t,o).toString(N9.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 Aa=new aLr,sLr=({children:e})=>{const t=w_e("(prefers-color-scheme: dark)"),[o,i]=k.useState({dark:t});g.useEffect(()=>{const u=Aa.getTheme()==null?t:Aa.getTheme()==="dark";o.dark!==u&&i({dark:u})},[o,t]);const a=()=>{const u=!o.dark;Aa.setTheme(u?"dark":"light"),i({...o,dark:u})},s=o.dark?Who():Uho(),d=typeof window<"u"?window.__NONCE__:void 0,c=d!=null&&d.length>0?d:void 0;return co.jsx(zlo,{dark:o.dark,webAppTheme:s,toggle:a,nonce:c,children:e})},lLr=["sandbox","production"],dLr=e=>M3(e,lLr),cLr=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"}},uLr=["development","staging","production"],pLr=e=>M3(e,uLr),hLr=e=>{switch(e){case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"staging";case"PROD":case"NEXT":return"production";case"DEV":default:return"development"}},mLr=["DEV","QA","PUNE","SUNNYVALE","DELHI","MOHALI","PROD","NEXT"],gLr=e=>M3(e,mLr),Ud=gLr("PROD"),Ex=()=>Ud==="DEV"||Ud==="QA"||Ud==="PUNE"||Ud==="SUNNYVALE"||Ud==="DELHI"||Ud==="MOHALI",cY="https://zeni-webapp.uc.r.appspot.com",fLr="a9cfa638c9c62aa82fb38cd66d7f717e",qHr=dLr(cLr(Ud)),xLr=pLr(hLr(Ud));function yLr(e,t){return N9.AES.decrypt(e,t).toString(N9.enc.Utf8)}const wLr="ZENI-WEB-APP-",MPe=Ud==="DEV"||Ud==="QA"?.2:.8,_n={sentryDsn:"",sentryTraceSamplingRate:MPe,googleClientId:"",googleMapsAPIKey:"",microsoftClientId:"",mixpanelToken:"",pusherClientSecret:"",pusherCluster:"",quickbooksKey:"",appUrl:"",featureClientSecret:"",featureClientSecretCockpit:"",cardVaultId:"",stripeKey:"",qboRedirectionUrl:"",mixpanelUrl:"",mixpanelHMUrl:""};let I3,uY;function bLr(e){_n.sentryDsn=e.keys.SENTRY_DSN,_n.sentryTraceSamplingRate=e.keys.SENTRY_TRACE_SAMPLE_RATES!=null?parseInt(e.keys.SENTRY_TRACE_SAMPLE_RATES):MPe,_n.googleClientId=e.keys.GOOGLE_CLIENT_ID,_n.googleMapsAPIKey=e.keys.GOOGLE_MAP_KEY,_n.microsoftClientId=e.keys.MICROSOFT_CLIENT_ID,_n.mixpanelToken=e.keys.MIXPANEL_TOKEN,_n.pusherClientSecret=e.keys.PUSHER_CLIENT_SECRET,_n.pusherCluster=e.keys.PUSHER_CLUSTER,_n.quickbooksKey=e.keys.QUICKBOOK_TOKEN,_n.appUrl=e.keys.WEB_ENDPOINT,_n.featureClientSecret=e.keys.STATSIG_CLIENT_SECRET,_n.featureClientSecretCockpit=e.keys.STATSIG_CLIENT_SECRET_COCKPIT,_n.cardVaultId=e.keys.UNIT_VAULT_ID,_n.stripeKey=e.keys.STRIPE_KEY,_n.qboRedirectionUrl=e.keys.QBO_URL,_n.mixpanelUrl=e.keys.MIXPANEL_URL,_n.mixpanelHMUrl=e.keys.MIXPANEL_HM_URL,uY=e.externalEndPoints,I3=e.apiEndPoints,vLr()}function vLr(){try{const e=new Set;if(I3!=null){for(const t of Object.values(I3))if(typeof t=="string"&&t.startsWith("http"))try{e.add(new URL(t).origin)}catch{}}for(const t of e){const o=document.createElement("link");o.rel="preconnect",o.href=t,o.crossOrigin="anonymous",document.head.appendChild(o)}}catch{}}async function CLr(){const t=encodeURIComponent(JSON.stringify({environment:Ud}));try{const o=await fetch(`${cY}/api/keys?query=${t}`);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(o){return console.error("Error fetching details:",o),null}}let $4e=!1;function x9(){$4e||($u.init(fLr,{api_host:uY.mixpanelBaseUrl,ignore_dnt:!0,store_google:!1,track_marketing:!1}),$4e=!0)}let k4e=!1,S4e=!1;function TPe(){if(k4e)return;k4e=!0,x9();const e=ml.extractUtmParamsFromUrl();Object.keys(e).length>0&&$u.register(e),Ex()&&console.log(`[UTM] first-touch bootstrap: ${JSON.stringify(e)}`)}function $Lr(){return $u?.persistence?.props??null}const kLr=new Set(["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"]);function SLr(){const e=$Lr();if(e==null)return;const t=Object.keys(e).filter(o=>o.startsWith("utm_")||kLr.has(o));for(const o of t)$u.unregister(o);Ex()&&t.length>0&&console.log(`[UTM] cleared from cookie: ${JSON.stringify(t)}`)}function ALr(){S4e||(S4e=!0,SLr())}class Rg{identify(t,o){if(x9(),this.#o=t,t!=null&&o!=null&&(Rg.#t==null||r_e({userId:t,traits:o},Rg.#t)!==!0)){const{$email:i,...a}={...o};$u.identify(t),i&&i!=null&&$u.people.set_once({$email:i}),$u.people.set(a),Rg.#t={userId:t,traits:o},Ex()&&console.log(`*** Called people set with userId ${t} traits ${JSON.stringify(o)} `)}}identifyUserAndCompany(t,o,i,a,s){throw Error("Use identify in the web-app!!")}track(t,o){if(x9(),this.#o==null){console.error("user is not identified :(, so can not fire event");return}TPe();const i={distinct_id:this.#o,...o};$u.track(t,i),ALr(),Ex()&&console.log(`*** firing ${t} with props ${JSON.stringify(o)}`)}alias(t,o){x9(),$u.alias(t,o)}reset(){x9(),$u.reset(),this.#o=void 0,Rg.#t=void 0}static get analytics(){return this.#e}static#e=new ml.Analytics(new Rg);static#t;#o}const Q0=Rg.analytics;function ELr(){TPe()}const LLr=()=>{const e=sS(),t=Wu(o=>o.companyState);if(e.pathname.includes("/management/parent/")){const o=e.pathname.split("/")[3],i=t.companiesById[o];if(i!=null)return`${i.companyInfo.name} ${Q.getLocalizedStrings().cockpit.cockpitHeaderSubsidiaryText}`}if(e.pathname.includes("management/month-end-report/company/")){const o=e.pathname.split("/")[4],i=t.companiesById[o];if(i!=null)return i.companyInfo.name}},A4e=e=>{switch(e){case"healthMonitor":return"health-monitor";case"taskManager":return"task-manager";case"aiAccountant":return"ai-accountant";default:return e}},ZHr=e=>{switch(e){case"healthMonitor":return"health monitor";case"taskManager":return"task manager";case"aiAccountant":return"ai accountant";default:return e}};function jLr(e,t){return{updateDownloadStateHandler:o=>{e(i_e(o))},onZeniLogoClick:()=>{t.themeState.toggle()},onLogOutClick:()=>{e(mF()),e(gF(!1)),Aa.clearAll();const o=t.locationHook.state?.origin??"/";t.navigate(o,{replace:!0})},onNewCustomerClick:()=>{t.navigate("/onboarding/new"),Q0?.trackOnboardingNewCustomerStarted()},onThreadClick:(o,i,a)=>{const s=o.entityType.split(".");if(s.length===2){const d=Nge(s[0]);if(d!=null){const c=A4e(d);t.navigate(`/${c}`),a(o,i)}else console.warn(`Invalid navigation target in thread: ${s[0]}`)}},onNotificationClick:(o,i,a)=>{const s=o.entityType.split(".");if(o.isGlobalComment&&s.length===2){const d=Nge(s[0]);if(d!=null){const c=A4e(d);t.navigate(`/${c}`),a(o,i)}else console.warn(`Invalid navigation target in notification: ${s[0]}`)}}}}function ILr(e,t){const{signedInUser:o,cockpitHeader:i}=t,a=e.tenantState.currentTenantId,d=dS(e)?.companyName??"",c={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:a??""};return{signedInUser:o,cockpitHeader:i,downloadState:e.companyViewState.downloadState,downloadParams:{currentTenantCompanyName:d,cockpitEndPoint:`${cY}/cockpitTabs`,authParams:c}}}const MLr=GBe(ILr,jLr)(Agr);function TLr(){const e=Zke(),t=Aa.getSignedInUser(),o=JH(),i=sS(),a=LLr(),s=Wu(u=>n_e(u)),d={tabsFileType:"excel",tabs:["management","subscription","portfolio","onboarding","healthMonitor"],filterByTabs:s.filterByTabs,timezone:a_e()},c=i.pathname.split("/")[1];return co.jsx(MLr,{locationHook:i,themeState:e,signedInUser:t,cockpitHeader:a,allTabsViews:s,defaultOptions:d,analytics:Q0,currentTab:c,navigate:o})}const PLr=["/management/*","/subscription/*","/onboarding/*","/portfolio/*","/audit/*","/health-monitor/*","/task-manager/*","/ai-accountant/*"];function BLr({appContent:e}){const t=PLr.filter(o=>YBe(o)).length===0;return co.jsxs(co.Fragment,{children:[t?null:co.jsx(TLr,{}),co.jsx(co.Fragment,{children:e})]})}const DLr="cockpit",PPe="init-enter";function _Lr({location:e,visitedUrl:t}){const{pathname:o}=e;return g.useLayoutEffect(()=>{const i=t.get(o||PPe);E4e(i!==void 0?i:0)}),null}const zLr=g.memo(_Lr,(e,t)=>{const{location:o,visitedUrl:i}=e,{location:a}=t,s=o.pathname||PPe,d=RLr();return i.set(s,d),!((a.pathname!==o.pathname||a.search!==o.search)&&a.hash==="")}),E4e=(e=0)=>window.requestAnimationFrame(()=>{window.scrollTo(0,e)}),RLr=()=>{let e=0;return document!=null&&document.documentElement!==null&&(e=document.documentElement.scrollTop),window.pageYOffset||e},BPe=e=>g.lazy(async()=>{const t=e.toString(),o=Aa.getForceRefreshedComponents(),i=new Set(o),a=i.has(t);try{const s=await e();return i.delete(t),Aa.saveForceRefreshedComponents(Array.from(i)),s}catch(s){throw a||(i.add(t),Aa.saveForceRefreshedComponents(Array.from(i)),location.reload()),s}}),FLr=BPe(()=>Og(()=>import("./ScreenRoutes-5MCnCULj.js"),__vite__mapDeps([14,5,1,6,15,8,16,17,7,2,4,9,11,18,19,20]))),OLr=BPe(()=>Og(()=>import("./SignInScreen-DU3SZdEJ.js"),__vite__mapDeps([21,15,1,6,8,5,16,17,18,19,20,7])));function NLr(){const e=g.useRef();e.current==null&&(e.current=new Map);const t=JH(),o=sS();return g.useEffect(()=>{ELr()},[]),g.useEffect(()=>{const i="signin/auth";Aa.isSignedIn()===!1&&!o.pathname.includes(i)&&t(i,{replace:!0,state:{...o.state,message:"...",origin:o.pathname}})}),co.jsxs(ULr,{children:[co.jsx(zLr,{visitedUrl:e.current,location:o}),co.jsx(HLr,{})]})}const HLr=()=>{const e=Aa.isSignedIn(),t=Aa.getSignedInUser(),o=e&&lS(t),i=Wu(u=>dS(u)),a={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:i.tenantId??""},s=Wu(u=>s_e(u)),c=Wu(u=>l_e(u)).map(u=>({companyId:u.companyId,tenantId:u.tenantId,companyName:u.name}));return co.jsx(l1r,{roomId:DLr,authParams:a,users:s,companies:c,authUrlEndPoint:`${I3.tenantMicroServiceBaseUrl}/1.0/commenting/auth`,fetchZeniUsers:!1,commentingUsersUrlEndPoint:`${I3.tenantMicroServiceBaseUrl}/1.0/users/zeni-users`,autoConnect:o,withRoomProvider:!1,loggedInUser:t,withThreadsProvider:!0,filter:{application:"cockpit"},children:co.jsx(VLr,{})})},VLr=()=>co.jsx(g.Suspense,{fallback:co.jsx(WLr,{children:co.jsx(wo,{size:"Large",start:!0})}),children:co.jsxs(KBe,{children:[co.jsx(Oj,{path:"/",element:co.jsx(qBe,{to:"management",replace:!0})}),co.jsx(Oj,{path:"/signin/auth",element:co.jsx(OLr,{})}),co.jsx(Oj,{path:"*",element:co.jsx(BLr,{appContent:co.jsx(FLr,{})})})]})}),ULr=Vt("div")``,WLr=Vt("div")`
79293
+ `;var nLr=S_e();const N9=ZH(nLr);class aLr{getSignedInUser(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),o=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER);if(o!=null&&t!=null)return JSON.parse(this.decrypt(o,t))}getShowNegativeAmountInParenthesis(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS),o=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&o!=null?JSON.parse(this.decrypt(t,o)):!1}getShowNegativeAmountInParenthesisPDF(){const t=window.localStorage.getItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF),o=window.localStorage.getItem(this.ZENI_SESSION_ID);return t!=null&&o!=null?JSON.parse(this.decrypt(t,o)):!0}getSignedInUserTenant(t){const o=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),i=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null&&i!=null)return JSON.parse(this.decrypt(o,i)).find(s=>s.tenantEmailDomain===t)}getSignedInUserTenantWithId(t){const o=window.localStorage.getItem(this.ZENI_SIGNED_IN_USER_TENANTS),i=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null&&i!=null)return JSON.parse(this.decrypt(o,i)).find(s=>s.tenantId===t)}getForceRefreshedComponents(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID),o=window.localStorage.getItem(this.ZENI_FORCE_REFRESHED_COMPONENTS);if(o&&t!=null){const i=this.decrypt(o,t);return i?JSON.parse(i):[]}return[]}saveForceRefreshedComponents(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);o!=null?window.localStorage.setItem(this.ZENI_FORCE_REFRESHED_COMPONENTS,this.encrypt(JSON.stringify(t),o)):console.warn("Can't update the force refreshed components when the user is logged out!")}saveSignedInUserWithSession(t,o){if(t==null||o==null)throw new Error("Can't accept nil for user or session Id");window.localStorage.setItem(this.ZENI_SESSION_ID,o),window.localStorage.setItem(this.ZENI_SIGNED_IN_USER,this.encrypt(JSON.stringify(t),o))}saveSignedInUserTenants(t,o){const i=o??window.localStorage.getItem(this.ZENI_SESSION_ID);i!=null?window.localStorage.setItem(this.ZENI_SIGNED_IN_USER_TENANTS,this.encrypt(JSON.stringify(t),i)):console.warn("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesis(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.encrypt(JSON.stringify(t),o));else throw new Error("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesisPDF(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);if(o!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.encrypt(JSON.stringify(t),o));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(o=>window.localStorage.getItem(o)!=null).reduce((o,i)=>o&&i)}clearAll(){this.ALL_IDs.forEach(t=>window.localStorage.removeItem(t))}setTheme(t){const o=window.localStorage.getItem(this.ZENI_SESSION_ID);o!=null&&window.localStorage.setItem(this.ZENI_THEME,this.encrypt(t,o))}getTheme(){const t=window.localStorage.getItem(this.ZENI_THEME),o=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null&&o!==null)return this.decrypt(t,o)}encrypt(t,o){return N9.AES.encrypt(t,o).toString()}decrypt(t,o){return N9.AES.decrypt(t,o).toString(N9.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 Aa=new aLr,sLr=({children:e})=>{const t=w_e("(prefers-color-scheme: dark)"),[o,i]=k.useState({dark:t});g.useEffect(()=>{const u=Aa.getTheme()==null?t:Aa.getTheme()==="dark";o.dark!==u&&i({dark:u})},[o,t]);const a=()=>{const u=!o.dark;Aa.setTheme(u?"dark":"light"),i({...o,dark:u})},s=o.dark?Who():Uho(),d=typeof window<"u"?window.__NONCE__:void 0,c=d!=null&&d.length>0?d:void 0;return co.jsx(zlo,{dark:o.dark,webAppTheme:s,toggle:a,nonce:c,children:e})},lLr=["sandbox","production"],dLr=e=>M3(e,lLr),cLr=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"}},uLr=["development","staging","production"],pLr=e=>M3(e,uLr),hLr=e=>{switch(e){case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"staging";case"PROD":case"NEXT":return"production";case"DEV":default:return"development"}},mLr=["DEV","QA","PUNE","SUNNYVALE","DELHI","MOHALI","PROD","NEXT"],gLr=e=>M3(e,mLr),Ud=gLr("DEV"),Ex=()=>Ud==="DEV"||Ud==="QA"||Ud==="PUNE"||Ud==="SUNNYVALE"||Ud==="DELHI"||Ud==="MOHALI",cY="https://zeni-webapp-dev.uc.r.appspot.com",fLr="63d3a2406505a5737a2b4debdb513f20",qHr=dLr(cLr(Ud)),xLr=pLr(hLr(Ud));function yLr(e,t){return N9.AES.decrypt(e,t).toString(N9.enc.Utf8)}const wLr="ZENI-WEB-APP-",MPe=Ud==="DEV"||Ud==="QA"?.2:.8,_n={sentryDsn:"",sentryTraceSamplingRate:MPe,googleClientId:"",googleMapsAPIKey:"",microsoftClientId:"",mixpanelToken:"",pusherClientSecret:"",pusherCluster:"",quickbooksKey:"",appUrl:"",featureClientSecret:"",featureClientSecretCockpit:"",cardVaultId:"",stripeKey:"",qboRedirectionUrl:"",mixpanelUrl:"",mixpanelHMUrl:""};let I3,uY;function bLr(e){_n.sentryDsn=e.keys.SENTRY_DSN,_n.sentryTraceSamplingRate=e.keys.SENTRY_TRACE_SAMPLE_RATES!=null?parseInt(e.keys.SENTRY_TRACE_SAMPLE_RATES):MPe,_n.googleClientId=e.keys.GOOGLE_CLIENT_ID,_n.googleMapsAPIKey=e.keys.GOOGLE_MAP_KEY,_n.microsoftClientId=e.keys.MICROSOFT_CLIENT_ID,_n.mixpanelToken=e.keys.MIXPANEL_TOKEN,_n.pusherClientSecret=e.keys.PUSHER_CLIENT_SECRET,_n.pusherCluster=e.keys.PUSHER_CLUSTER,_n.quickbooksKey=e.keys.QUICKBOOK_TOKEN,_n.appUrl=e.keys.WEB_ENDPOINT,_n.featureClientSecret=e.keys.STATSIG_CLIENT_SECRET,_n.featureClientSecretCockpit=e.keys.STATSIG_CLIENT_SECRET_COCKPIT,_n.cardVaultId=e.keys.UNIT_VAULT_ID,_n.stripeKey=e.keys.STRIPE_KEY,_n.qboRedirectionUrl=e.keys.QBO_URL,_n.mixpanelUrl=e.keys.MIXPANEL_URL,_n.mixpanelHMUrl=e.keys.MIXPANEL_HM_URL,uY=e.externalEndPoints,I3=e.apiEndPoints,vLr()}function vLr(){try{const e=new Set;if(I3!=null){for(const t of Object.values(I3))if(typeof t=="string"&&t.startsWith("http"))try{e.add(new URL(t).origin)}catch{}}for(const t of e){const o=document.createElement("link");o.rel="preconnect",o.href=t,o.crossOrigin="anonymous",document.head.appendChild(o)}}catch{}}async function CLr(){const t=encodeURIComponent(JSON.stringify({environment:Ud}));try{const o=await fetch(`${cY}/api/keys?query=${t}`);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return await o.json()}catch(o){return console.error("Error fetching details:",o),null}}let $4e=!1;function x9(){$4e||($u.init(fLr,{api_host:uY.mixpanelBaseUrl,ignore_dnt:!0,store_google:!1,track_marketing:!1}),$4e=!0)}let k4e=!1,S4e=!1;function TPe(){if(k4e)return;k4e=!0,x9();const e=ml.extractUtmParamsFromUrl();Object.keys(e).length>0&&$u.register(e),Ex()&&console.log(`[UTM] first-touch bootstrap: ${JSON.stringify(e)}`)}function $Lr(){return $u?.persistence?.props??null}const kLr=new Set(["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"]);function SLr(){const e=$Lr();if(e==null)return;const t=Object.keys(e).filter(o=>o.startsWith("utm_")||kLr.has(o));for(const o of t)$u.unregister(o);Ex()&&t.length>0&&console.log(`[UTM] cleared from cookie: ${JSON.stringify(t)}`)}function ALr(){S4e||(S4e=!0,SLr())}class Rg{identify(t,o){if(x9(),this.#o=t,t!=null&&o!=null&&(Rg.#t==null||r_e({userId:t,traits:o},Rg.#t)!==!0)){const{$email:i,...a}={...o};$u.identify(t),i&&i!=null&&$u.people.set_once({$email:i}),$u.people.set(a),Rg.#t={userId:t,traits:o},Ex()&&console.log(`*** Called people set with userId ${t} traits ${JSON.stringify(o)} `)}}identifyUserAndCompany(t,o,i,a,s){throw Error("Use identify in the web-app!!")}track(t,o){if(x9(),this.#o==null){console.error("user is not identified :(, so can not fire event");return}TPe();const i={distinct_id:this.#o,...o};$u.track(t,i),ALr(),Ex()&&console.log(`*** firing ${t} with props ${JSON.stringify(o)}`)}alias(t,o){x9(),$u.alias(t,o)}reset(){x9(),$u.reset(),this.#o=void 0,Rg.#t=void 0}static get analytics(){return this.#e}static#e=new ml.Analytics(new Rg);static#t;#o}const Q0=Rg.analytics;function ELr(){TPe()}const LLr=()=>{const e=sS(),t=Wu(o=>o.companyState);if(e.pathname.includes("/management/parent/")){const o=e.pathname.split("/")[3],i=t.companiesById[o];if(i!=null)return`${i.companyInfo.name} ${Q.getLocalizedStrings().cockpit.cockpitHeaderSubsidiaryText}`}if(e.pathname.includes("management/month-end-report/company/")){const o=e.pathname.split("/")[4],i=t.companiesById[o];if(i!=null)return i.companyInfo.name}},A4e=e=>{switch(e){case"healthMonitor":return"health-monitor";case"taskManager":return"task-manager";case"aiAccountant":return"ai-accountant";default:return e}},ZHr=e=>{switch(e){case"healthMonitor":return"health monitor";case"taskManager":return"task manager";case"aiAccountant":return"ai accountant";default:return e}};function jLr(e,t){return{updateDownloadStateHandler:o=>{e(i_e(o))},onZeniLogoClick:()=>{t.themeState.toggle()},onLogOutClick:()=>{e(mF()),e(gF(!1)),Aa.clearAll();const o=t.locationHook.state?.origin??"/";t.navigate(o,{replace:!0})},onNewCustomerClick:()=>{t.navigate("/onboarding/new"),Q0?.trackOnboardingNewCustomerStarted()},onThreadClick:(o,i,a)=>{const s=o.entityType.split(".");if(s.length===2){const d=Nge(s[0]);if(d!=null){const c=A4e(d);t.navigate(`/${c}`),a(o,i)}else console.warn(`Invalid navigation target in thread: ${s[0]}`)}},onNotificationClick:(o,i,a)=>{const s=o.entityType.split(".");if(o.isGlobalComment&&s.length===2){const d=Nge(s[0]);if(d!=null){const c=A4e(d);t.navigate(`/${c}`),a(o,i)}else console.warn(`Invalid navigation target in notification: ${s[0]}`)}}}}function ILr(e,t){const{signedInUser:o,cockpitHeader:i}=t,a=e.tenantState.currentTenantId,d=dS(e)?.companyName??"",c={userId:o?.userId??"",sessionId:o?.zeniSessionId??"",tenantId:a??""};return{signedInUser:o,cockpitHeader:i,downloadState:e.companyViewState.downloadState,downloadParams:{currentTenantCompanyName:d,cockpitEndPoint:`${cY}/cockpitTabs`,authParams:c}}}const MLr=GBe(ILr,jLr)(Agr);function TLr(){const e=Zke(),t=Aa.getSignedInUser(),o=JH(),i=sS(),a=LLr(),s=Wu(u=>n_e(u)),d={tabsFileType:"excel",tabs:["management","subscription","portfolio","onboarding","healthMonitor"],filterByTabs:s.filterByTabs,timezone:a_e()},c=i.pathname.split("/")[1];return co.jsx(MLr,{locationHook:i,themeState:e,signedInUser:t,cockpitHeader:a,allTabsViews:s,defaultOptions:d,analytics:Q0,currentTab:c,navigate:o})}const PLr=["/management/*","/subscription/*","/onboarding/*","/portfolio/*","/audit/*","/health-monitor/*","/task-manager/*","/ai-accountant/*"];function BLr({appContent:e}){const t=PLr.filter(o=>YBe(o)).length===0;return co.jsxs(co.Fragment,{children:[t?null:co.jsx(TLr,{}),co.jsx(co.Fragment,{children:e})]})}const DLr="cockpit",PPe="init-enter";function _Lr({location:e,visitedUrl:t}){const{pathname:o}=e;return g.useLayoutEffect(()=>{const i=t.get(o||PPe);E4e(i!==void 0?i:0)}),null}const zLr=g.memo(_Lr,(e,t)=>{const{location:o,visitedUrl:i}=e,{location:a}=t,s=o.pathname||PPe,d=RLr();return i.set(s,d),!((a.pathname!==o.pathname||a.search!==o.search)&&a.hash==="")}),E4e=(e=0)=>window.requestAnimationFrame(()=>{window.scrollTo(0,e)}),RLr=()=>{let e=0;return document!=null&&document.documentElement!==null&&(e=document.documentElement.scrollTop),window.pageYOffset||e},BPe=e=>g.lazy(async()=>{const t=e.toString(),o=Aa.getForceRefreshedComponents(),i=new Set(o),a=i.has(t);try{const s=await e();return i.delete(t),Aa.saveForceRefreshedComponents(Array.from(i)),s}catch(s){throw a||(i.add(t),Aa.saveForceRefreshedComponents(Array.from(i)),location.reload()),s}}),FLr=BPe(()=>Og(()=>import("./ScreenRoutes-C-MvTpAE.js"),__vite__mapDeps([14,5,1,6,15,8,16,17,7,2,4,9,11,18,19,20]))),OLr=BPe(()=>Og(()=>import("./SignInScreen-CQcxmIgQ.js"),__vite__mapDeps([21,15,1,6,8,5,16,17,18,19,20,7])));function NLr(){const e=g.useRef();e.current==null&&(e.current=new Map);const t=JH(),o=sS();return g.useEffect(()=>{ELr()},[]),g.useEffect(()=>{const i="signin/auth";Aa.isSignedIn()===!1&&!o.pathname.includes(i)&&t(i,{replace:!0,state:{...o.state,message:"...",origin:o.pathname}})}),co.jsxs(ULr,{children:[co.jsx(zLr,{visitedUrl:e.current,location:o}),co.jsx(HLr,{})]})}const HLr=()=>{const e=Aa.isSignedIn(),t=Aa.getSignedInUser(),o=e&&lS(t),i=Wu(u=>dS(u)),a={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:i.tenantId??""},s=Wu(u=>s_e(u)),c=Wu(u=>l_e(u)).map(u=>({companyId:u.companyId,tenantId:u.tenantId,companyName:u.name}));return co.jsx(l1r,{roomId:DLr,authParams:a,users:s,companies:c,authUrlEndPoint:`${I3.tenantMicroServiceBaseUrl}/1.0/commenting/auth`,fetchZeniUsers:!1,commentingUsersUrlEndPoint:`${I3.tenantMicroServiceBaseUrl}/1.0/users/zeni-users`,autoConnect:o,withRoomProvider:!1,loggedInUser:t,withThreadsProvider:!0,filter:{application:"cockpit"},children:co.jsx(VLr,{})})},VLr=()=>co.jsx(g.Suspense,{fallback:co.jsx(WLr,{children:co.jsx(wo,{size:"Large",start:!0})}),children:co.jsxs(KBe,{children:[co.jsx(Oj,{path:"/",element:co.jsx(qBe,{to:"management",replace:!0})}),co.jsx(Oj,{path:"/signin/auth",element:co.jsx(OLr,{})}),co.jsx(Oj,{path:"*",element:co.jsx(BLr,{appContent:co.jsx(FLr,{})})})]})}),ULr=Vt("div")``,WLr=Vt("div")`
79294
79294
  display: flex;
79295
79295
  flex: 1 1 auto;
79296
79296
  flex-direction: row;
@@ -79301,4 +79301,4 @@ ${e}`,T4r=e=>g.createElement("svg",{width:38,height:39,viewBox:"0 0 38 39",fill:
79301
79301
  background-color: ${e=>e.theme.colors.background};
79302
79302
  `;function QLr(){Q.updateAppLocaleID("en"),qLr();const e=ZLr(),[t,o]=g.useState(!1),i=g.useCallback(s=>{s.data?.type==="UPDATE_READY"?o(!0):s.data?.type==="HIDE_UPDATE_POPUP"&&o(!1)},[]);g.useEffect(()=>("serviceWorker"in navigator&&(navigator.serviceWorker.addEventListener("message",i),navigator.serviceWorker.addEventListener("controllerchange",()=>{o(!1)})),()=>{navigator.serviceWorker.removeEventListener("message",i)}),[i]);const a=()=>{o(!1),window.location.reload()};return co.jsx(sLr,{children:co.jsx(ZBe,{store:e,children:co.jsx(Yvt,{children:co.jsxs(AQt,{children:[t?co.jsx(uJt,{onPrimaryClick:a}):null,co.jsx(YLr,{})]})})})})}const H8=new d_e,GLr=()=>{const e=Aa.getSignedInUser(),t=Wu(L=>dS(L)),o=Wu(L=>h_e(L,t.companyId)),i=sS(),a=JH(),s=JBe(),[d,c]=g.useState(null),u=ror(e?.userId),p=t?.excludedResources?.fetchState=="Completed"?t.excludedResources.resources:[];g.useEffect(()=>()=>{s(JY())},[]);const h=Wu(L=>m_e(L)),m=t?.externalConnections?.accounting[0]?.connectionName,f=()=>{s(JY())},x=g.useMemo(()=>g_e(t.userRole),[t.userRole]),y=Wu(L=>L.companyViewState.zeniUsers),w=g.useMemo(()=>{const L=y.fetchState==="Error"&&f_e(y.error);return L&&console.warn("Auto-logout triggered due to invalid session"),L},[y.fetchState,y.error]),b=g.useMemo(()=>{const L=y.fetchState==="Error"&&x_e(y.error)===!0;return L&&console.warn("Page is not accessible, show 404"),L},[y.fetchState,y.error]),C=g.useRef(!1);g.useEffect(()=>(w&&!C.current&&(C.current=!0,$()),()=>{C.current=!1}),[w]),g.useEffect(()=>{b&&window.open("/page-not-found","_self")},[b]);const $=g.useCallback(()=>{c(null),H8.stop(),s(mF()),s(gF(!1)),Aa.clearAll();const L=i.state?.origin??"/";a(L,{replace:!0})},[s,c,i,a]),A=g.useCallback(()=>{c(null),H8.stop(),s(mF()),s(gF(!1)),Aa.clearAll(),window.location.href="/signin/auth"},[s,c]);g.useEffect(()=>{if(e?.zeniSessionId!=null)return H8.start({idleTimeoutMinutes:u.idleTimeoutMinutes,warningDurationSeconds:u.warningDurationSeconds,heartbeatIntervalMinutes:u.heartbeatIntervalMinutes,isAutoLogoutEnabled:u.isAutoLogoutEnabled},{onHeartbeat:()=>s(y_e()),onWarningStart:L=>{Q0.trackSessionTimeoutPopupShown(L),c(L)},onWarningTick:c,onAutoLogout:()=>{Q0.trackSessionTimeoutAutoLogout(),A()},onSessionExtended:()=>c(null)}),()=>H8.stop()},[e?.zeniSessionId,u.isAutoLogoutEnabled,u.idleTimeoutMinutes,u.warningDurationSeconds,u.heartbeatIntervalMinutes,s,A,c]);const E=g.useMemo(()=>Aa.getSignedInUser(),[]),I=g.useMemo(()=>({userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:t.tenantId??""}),[E,t.tenantId]);return co.jsxs(FQt,{globalInfo:{loggedInUser:e,loggedInUserRole:t?.userRole,excludedResources:p,loggedInUserRoleMap:x,currentTenant:t,connectionName:m,controllersList:o},children:[co.jsx(IQt,{toolkit:{analytics:Q0,sentry:wBe,authParams:I},children:co.jsxs(UWt,{endPoint:{url:cY},children:[co.jsx(VZo,{isOnDashboard:!1,showSnackbar:h.isSnackbarOpen,snackbar:{message:h.message,messageType:h.messageType,onRemoveSnackbar:f,showStatusIcon:h.showStatusIcon}}),co.jsx(NLr,{})]})}),d!=null&&e!=null?co.jsx(fmr,{secondsRemaining:d,onContinueSession:()=>{Q0.trackSessionTimeoutClicked("continue",d),H8.continueSession()},onSignOut:()=>{Q0.trackSessionTimeoutClicked("sign_out",d),A()}}):null]})},YLr=()=>{const e=Aa.isSignedIn(),o=Wu(i=>dS(i)).companyId;return co.jsx(fKt,{isUserSignedIn:e,featureGateCustomFields:{companyId:o},zeniFeatureConfig:{currentFeatureEnv:xLr,featureClientSecret:_n.featureClientSecretCockpit,providerEndPoint:uY.statsigBaseUrl},children:co.jsx(GLr,{})})},KLr=xBe(QLr);function qLr(){console.log("Initialize any 3rd party libs!")}let uF=null;function ZLr(){return uF===null&&(uF=JLr(),c_e().catch(e=>{console.error("Failed to load feature epics:",e),yBe(e,{tags:{critical:"true",module:"epicManager"}}),alert(`The application failed to load required modules. Some features may not work correctly.
79303
79303
 
79304
- Please refresh the page to try again.`)})),uF}function JLr(){console.warn(`initializing epic state with url ${JSON.stringify(I3)}`);const e=Aa.getSignedInUser(),t=u_e(I3,e?.userId,e?.zeniSessionId,void 0,Ex()),o=p_e();return o.userId!=null&&Q0.identify(o.userId,{tenant_id:o.tenantId}),t}const XLr=!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)),ejr="PROD",tjr="https://zeni-webapp.uc.r.appspot.com",L4e=`/service-worker.js?v=${Date.now()}&env=${ejr}&endpoint=${encodeURIComponent(tjr)}`;function ojr(e){if("serviceWorker"in navigator){if(new URL("https://app.zeni.ai",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",()=>{XLr?rjr(L4e):DPe(L4e)})}}function DPe(e,t){navigator.serviceWorker.register(e).then(o=>{o.onupdatefound=()=>{const i=o.installing;i!=null&&(i.onstatechange=()=>{i.state==="installed"&&(navigator.serviceWorker.controller?(console.log("New content available; will be used when all tabs are closed."),navigator.serviceWorker.controller?.postMessage({type:"UPDATE_READY"}),o.waiting?.postMessage({type:"SKIP_WAITING"})):console.log("Content is cached for offline use."))})},o.waiting&&o.waiting.postMessage({type:"SKIP_WAITING"}),navigator.serviceWorker.addEventListener("controllerchange",()=>{console.log("New service worker activated."),o.active?.postMessage({type:"CLIENTS_CLAIM"})})}).catch(o=>{console.error("Error during service worker registration:",o)})}function rjr(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then(o=>{const i=o.headers.get("content-type");o.status===404||i!=null&&!i.includes("javascript")?navigator.serviceWorker.ready.then(a=>{a.unregister().then(()=>window.location.reload())}):DPe(e)}).catch(()=>{console.log("No internet connection found. App is running in offline mode.")})}const ijr=Aa.getSignedInUser(),njr=ijr?.zeniSessionId;async function ajr(){try{const e=await CLr(),t=yLr(e,wLr+Ud);bLr(JSON.parse(t)),E_e.createRoot(document.getElementById("root")).render(co.jsx(k.StrictMode,{children:co.jsx(XBe,{basename:"/cockpit",children:co.jsx(KLr,{})})})),sjr()}catch(e){console.error("Error initializing app:",e)}}function sjr(){const e=()=>{bBe({dsn:_n.sentryDsn,integrations:[vBe(),CBe({maskAllText:!0,blockAllMedia:!0})],tracesSampleRate:_n.sentryTraceSamplingRate,replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSendTransaction(t){return t.breadcrumbs&&(t.breadcrumbs=t.breadcrumbs.filter(o=>o.category!=="console"?!0:(o.message??"").toLowerCase().includes("called people set")||Array.isArray(o.data?.arguments)&&o.data.arguments.some(a=>typeof a=="string"&&a.toLowerCase().includes("called people set"))?!1:(Array.isArray(o.data?.arguments)&&(o.data.arguments=o.data.arguments.map(a=>{if(typeof a=="string"&&a.includes("user_roles"))try{const s=a.match(/\{.*\}/s);if(s!==null){const d=JSON.parse(s[0]);if(d.user_roles!=null)return delete d.user_roles,a.replace(s[0],JSON.stringify(d))}}catch{}return a})),!0))),t}}),$Be("session-id",njr)};typeof requestIdleCallback=="function"?requestIdleCallback(e):setTimeout(e,0)}ajr();ojr();export{PHr as A,NHr as B,ePr as C,Q as D,_Hr as E,OHr as F,YHr as G,w4 as H,BHr as I,BPe as J,QHr as K,Dh as L,RHr as M,zHr as N,Sjr as O,cTr as P,GTr as Q,DHr as R,P$e as S,d1r as U,UHr as V,HHr as W,KHr as Y,je as Z,VHr as _,Q0 as a,j as b,FRr as c,_n as d,wo as e,QBr as f,ZHr as g,A4e as h,dKt as i,WHr as j,v as k,qHr as l,st as m,Fho as n,r as o,ml as p,UIr as q,E_r as r,GHr as s,FHr as t,ELr as u,XTr as v,dTr as w,L_r as x,lL as y,Aa as z};
79304
+ Please refresh the page to try again.`)})),uF}function JLr(){console.warn(`initializing epic state with url ${JSON.stringify(I3)}`);const e=Aa.getSignedInUser(),t=u_e(I3,e?.userId,e?.zeniSessionId,void 0,Ex()),o=p_e();return o.userId!=null&&Q0.identify(o.userId,{tenant_id:o.tenantId}),t}const XLr=!!(window.location.hostname==="localhost"||window.location.hostname==="[::1]"||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)),ejr="DEV",tjr="https://zeni-webapp-dev.uc.r.appspot.com",L4e=`/service-worker.js?v=${Date.now()}&env=${ejr}&endpoint=${encodeURIComponent(tjr)}`;function ojr(e){if("serviceWorker"in navigator){if(new URL("https://dev.app.zeni.ai",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",()=>{XLr?rjr(L4e):DPe(L4e)})}}function DPe(e,t){navigator.serviceWorker.register(e).then(o=>{o.onupdatefound=()=>{const i=o.installing;i!=null&&(i.onstatechange=()=>{i.state==="installed"&&(navigator.serviceWorker.controller?(console.log("New content available; will be used when all tabs are closed."),navigator.serviceWorker.controller?.postMessage({type:"UPDATE_READY"}),o.waiting?.postMessage({type:"SKIP_WAITING"})):console.log("Content is cached for offline use."))})},o.waiting&&o.waiting.postMessage({type:"SKIP_WAITING"}),navigator.serviceWorker.addEventListener("controllerchange",()=>{console.log("New service worker activated."),o.active?.postMessage({type:"CLIENTS_CLAIM"})})}).catch(o=>{console.error("Error during service worker registration:",o)})}function rjr(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then(o=>{const i=o.headers.get("content-type");o.status===404||i!=null&&!i.includes("javascript")?navigator.serviceWorker.ready.then(a=>{a.unregister().then(()=>window.location.reload())}):DPe(e)}).catch(()=>{console.log("No internet connection found. App is running in offline mode.")})}const ijr=Aa.getSignedInUser(),njr=ijr?.zeniSessionId;async function ajr(){try{const e=await CLr(),t=yLr(e,wLr+Ud);bLr(JSON.parse(t)),E_e.createRoot(document.getElementById("root")).render(co.jsx(k.StrictMode,{children:co.jsx(XBe,{basename:"/cockpit",children:co.jsx(KLr,{})})})),sjr()}catch(e){console.error("Error initializing app:",e)}}function sjr(){const e=()=>{bBe({dsn:_n.sentryDsn,integrations:[vBe(),CBe({maskAllText:!0,blockAllMedia:!0})],tracesSampleRate:_n.sentryTraceSamplingRate,replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSendTransaction(t){return t.breadcrumbs&&(t.breadcrumbs=t.breadcrumbs.filter(o=>o.category!=="console"?!0:(o.message??"").toLowerCase().includes("called people set")||Array.isArray(o.data?.arguments)&&o.data.arguments.some(a=>typeof a=="string"&&a.toLowerCase().includes("called people set"))?!1:(Array.isArray(o.data?.arguments)&&(o.data.arguments=o.data.arguments.map(a=>{if(typeof a=="string"&&a.includes("user_roles"))try{const s=a.match(/\{.*\}/s);if(s!==null){const d=JSON.parse(s[0]);if(d.user_roles!=null)return delete d.user_roles,a.replace(s[0],JSON.stringify(d))}}catch{}return a})),!0))),t}}),$Be("session-id",njr)};typeof requestIdleCallback=="function"?requestIdleCallback(e):setTimeout(e,0)}ajr();ojr();export{PHr as A,NHr as B,ePr as C,Q as D,_Hr as E,OHr as F,YHr as G,w4 as H,BHr as I,BPe as J,QHr as K,Dh as L,RHr as M,zHr as N,Sjr as O,cTr as P,GTr as Q,DHr as R,P$e as S,d1r as U,UHr as V,HHr as W,KHr as Y,je as Z,VHr as _,Q0 as a,j as b,FRr as c,_n as d,wo as e,QBr as f,ZHr as g,A4e as h,dKt as i,WHr as j,v as k,qHr as l,st as m,Fho as n,r as o,ml as p,UIr as q,E_r as r,GHr as s,FHr as t,ELr as u,XTr as v,dTr as w,L_r as x,lL as y,Aa as z};