@zeniai/web-cockpit-ui 2.2.29-qa → 2.2.30-dev
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CreditAgentRoutes-0HS12qW2.js → CreditAgentRoutes-BO0-bMp4.js} +1 -1
- package/dist/assets/{Preview-Ce4wflU-.js → Preview-CN35NV3d.js} +1 -1
- package/dist/assets/{ScreenRoutes-DvICZao1.js → ScreenRoutes-CU1IwyhO.js} +3 -3
- package/dist/assets/{SignInScreen-DgiQ6lLS.js → SignInScreen-BtppyXZC.js} +1 -1
- package/dist/assets/{analytics-D4sAq3WG.js → analytics-ipXwMHc8.js} +1 -1
- package/dist/assets/{analyticsHelper-BJbOQpf2.js → analyticsHelper-B8cMMWR4.js} +1 -1
- package/dist/assets/{core-Bn-pi1xR.js → core-BEEXg3fp.js} +1 -1
- package/dist/assets/{dash.all.min-BxPFks0X.js → dash.all.min-D76jbBjl.js} +1 -1
- package/dist/assets/{empty-wsHK64j3.js → empty-DF_ydwSm.js} +1 -1
- package/dist/assets/{empty-BA8CSDQh.js → empty-DQjL25_q.js} +1 -1
- package/dist/assets/epic-Cbn11ltX.js +2 -0
- package/dist/assets/{index-BdIJVq8L.js → index-B_7K1bnG.js} +1 -1
- package/dist/assets/{index-75GwB0xt.js → index-COBdIJum.js} +6 -6
- package/dist/assets/{index-hE7WepBA.js → index-DFivY-J7.js} +1 -1
- package/dist/assets/{index-OWlyrjEq.js → index-DGjOD-oo.js} +1 -1
- package/dist/assets/{index-KhUKZXvx.js → index-Dk9WTrVo.js} +1 -1
- package/dist/assets/{index-BQiC4idQ.js → index-DuHNjO4E.js} +1 -1
- package/dist/assets/{index-DMkliiad.js → index-kkqkQ_HF.js} +2 -2
- package/dist/assets/{lexical-DYV3fHgv.js → lexical-C8Tv8yGY.js} +1 -1
- package/dist/assets/{liveblocks-BSXmqiSx.js → liveblocks--EFJV9Kj.js} +1 -1
- package/dist/assets/{lottie-BeZFujwC.js → lottie-B78zgwXs.js} +1 -1
- package/dist/assets/{mui-OSAPJdFH.js → mui-CI8JGWFA.js} +1 -1
- package/dist/assets/{react-rzP2syWO.js → react-BLAkL9-0.js} +1 -1
- package/dist/assets/{react-phcR_3HH.js → react-BgtUwkhI.js} +1 -1
- package/dist/assets/{react-CCLtRo1L.js → react-CALi0P99.js} +1 -1
- package/dist/assets/{react-CSDSwGzV.js → react-CKO__y-A.js} +1 -1
- package/dist/assets/{react-BTm2K3nC.js → react-DcW68c_S.js} +1 -1
- package/dist/assets/{react-DsVtolhQ.js → react-g_L8rQtB.js} +1 -1
- package/dist/assets/{react-Bpk43RTY.js → react-sis8lA2z.js} +1 -1
- package/dist/assets/{react-i2QpO2Hq.js → react-uIHapvTY.js} +2 -2
- package/dist/assets/{recharts-D_3KEJFP.js → recharts-HpqHn9eQ.js} +1 -1
- package/dist/assets/{sentry-CWPIL0DP.js → sentry-DgKp7-MN.js} +1 -1
- package/dist/assets/{url-BKMy4dn6.js → url-CI_52qHn.js} +1 -1
- package/dist/assets/{url-Cs89cy8y.js → url-CmdokR_e.js} +1 -1
- package/dist/assets/{utils-CAbEq68d.js → utils-CribULW9.js} +1 -1
- package/dist/assets/{zeni-epic-state-D8q-ZDsG.js → zeni-epic-state-BtduplTy.js} +6 -6
- package/dist/index.html +1 -1
- package/package.json +3 -3
- package/dist/assets/epic-Cb-9BbjF.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/empty-
|
|
2
|
-
import{a as g,R as $,e as YZe,b as P4,p as T0,r as Tc,g as eZ,d as Are,f as KZe,s as $re,w as qZe,i as ZZe,S as JZe,j as XZe,k as eJe,l as tJe,m as oJe}from"./sentry-CWPIL0DP.js";import{j as Co,_ as M$e,a as Cd,u as B$e,T as rJe,C as iJe,b as nJe,c as hj,d as mj,e as aJe,f as sJe,g as P$e,h as lJe,i as cJe,L as dJe,k as kre,l as pJe,m as uJe,n as hJe,P as mJe,o as gJe,p as fJe,q as D$e,r as xJe,s as yJe,I as Sre,t as bJe,v as wJe,w as vJe,x as CJe,y as AJe,z as $Je,A as T$e,B as kJe,D as SJe,E as EJe}from"./liveblocks-BSXmqiSx.js";import{f as z$e,R as o4,r as Fn,P as Dn,u as gj,g as yh,h as LJe,i as tZ,j as IJe,k as jJe,l as mT,N as MJe,m as BJe,n as PJe,B as DJe}from"./core-Bn-pi1xR.js";import{H as AE,ba as r4,bb as TJe,bc as Ere,bd as X4,be as xr,bf as R$e,bg as Wr,bh as fj,bi as zJe,bj as Dh,bk as RJe,bl as FJe,bm as S8,bn as hg,bo as b9,bp as F$e,bq as OJe,br as q1,bs as O$e,bt as NJe,bu as oZ,bv as N$e,bw as ln,bx as E8,by as Gu,bz as Lre,bA as HJe,bB as _Je,bC as H$e,bD as NW,bE as VJe,bF as QJe,bG as UJe,bH as WJe,bI as rZ,bJ as _$e,bK as GJe,bL as qb,bM as YJe,bN as V$e,bO as HW,bP as Ire,bQ as jre,bR as Mre,bS as zl,bT as iZ,bU as Q$e,bV as U$e,bW as nZ,bX as w9,bY as xj,bZ as aZ,b_ as sZ,b$ as lZ,c0 as cZ,c1 as KJe,c2 as yj,c3 as sp,c4 as lp,c5 as $E,c6 as W$e,c7 as G$e,c8 as qJe,c9 as dZ,ca as pZ,cb as ZJe,cc as JJe,cd as ep,ce as Dv,cf as Tv,cg as XJe,ch as eXe,ci as tXe,cj as oXe,ck as rXe,cl as iXe,cm as nXe,cn as bA,co as Y$e,cp as K$e,cq as aXe,cr as sXe,cs as q$e,ct as Z$e,cu as lXe,cv as cXe,cw as dXe,cx as J$e,cy as X$e,cz as pXe,cA as uXe,cB as eke,cC as tke,cD as hXe,cE as Bre,cF as mXe,cG as gXe,cH as Iw,cI as fXe,cJ as oke,cK as xXe,cL as rke,cM as yXe,cN as Pre,cO as bXe,cP as ike,cQ as nke,cR as ake,cS as ske,cT as lke,cU as wXe,cV as cke,cW as vXe,cX as CXe,cY as AXe,cZ as dke,c_ as _W,c$ as $Xe,d0 as pke,d1 as uke,d2 as kXe,d3 as SXe,d4 as EXe,d5 as LXe,d6 as IXe,d7 as jXe,d8 as MXe,d9 as BXe,v as PXe,da as bj,db as VW,dc as QW,dd as DXe,de as TXe,df as zXe,dg as RXe,dh as FXe,di as OXe,dj as NXe,dk as HXe,dl as _Xe,dm as VXe,dn as Dre,dp as QXe,dq as UXe,dr as WXe,ds as GXe,dt as YXe}from"./zeni-epic-state-D8q-ZDsG.js";import{T as hke,j as Uo,n as i,c as pe,k as _t,G as zv,C as mke,u as KXe,a as qXe}from"./mui-OSAPJdFH.js";import{r as ZXe,m as Yu}from"./analytics-D4sAq3WG.js";import{L as UW}from"./lottie-BeZFujwC.js";import{r as Ta}from"./lexical-DYV3fHgv.js";import{E as en,c as wj,P as JXe,R as WW,F as kE,X as gd,Y as fd,G as A2,H as SE,I as vj,J as $2,K as gke,L as XXe,M as eet,N as e5,O as uZ,Q as hZ,S as Rv,U as tet}from"./recharts-D_3KEJFP.js";import{r as oet}from"./utils-CAbEq68d.js";(function(){try{var e=typeof window<"u"?window:typeof P4<"u"?P4:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="280f0bcd-e0a9-434a-911b-edf78bf91112",e._sentryDebugIdIdentifier="sentry-dbid-280f0bcd-e0a9-434a-911b-edf78bf91112")}catch{}})();(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();var wA={},Tre;function ret(){if(Tre)return wA;Tre=1;var e=z$e();return wA.createRoot=e.createRoot,wA.hydrateRoot=e.hydrateRoot,wA}var iet=ret(),wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof P4<"u"?P4:typeof self<"u"?self:{};function Vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zre={exports:{}},yx={},Rre;function net(){if(Rre)return yx;Rre=1;var e=$,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,p,u){var h,m={},f=null,x=null;u!==void 0&&(f=""+u),p.key!==void 0&&(f=""+p.key),p.ref!==void 0&&(x=p.ref);for(h in p)n.call(p,h)&&!l.hasOwnProperty(h)&&(m[h]=p[h]);if(d&&d.defaultProps)for(h in p=d.defaultProps,p)m[h]===void 0&&(m[h]=p[h]);return{$$typeof:t,type:d,key:f,ref:x,props:m,_owner:a.current}}return yx.Fragment=r,yx.jsx=c,yx.jsxs=c,yx}var Fre;function fke(){return Fre||(Fre=1,zre.exports=net()),zre.exports}var s=fke();const aet=g.createContext(null),gT={didCatch:!1,error:null};let set=class extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=gT}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:l,reason:"imperative-api"}),this.setState(gT)}}componentDidCatch(t,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&cet(t.resetKeys,a)){var l,c;(l=(c=this.props).onReset)===null||l===void 0||l.call(c,{next:a,prev:t.resetKeys,reason:"keys"}),this.setState(gT)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:l,error:c}=this.state;let d=t;if(l){const p={error:c,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")d=r(p);else if(n)d=g.createElement(n,p);else if(a!==void 0)d=a;else throw c}return g.createElement(aet.Provider,{value:{didCatch:l,error:c,resetErrorBoundary:this.resetErrorBoundary}},d)}};function cet(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}var GW={exports:{}},det=GW.exports,Ore;function pet(){return Ore||(Ore=1,(function(e){(function(t,r){e.exports?e.exports=r():t.numeral=r()})(det,function(){var t,r,n="2.0.6",a={},l={},c={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},d={currentLocale:c.currentLocale,zeroFormat:c.zeroFormat,nullFormat:c.nullFormat,defaultFormat:c.defaultFormat,scalePercentBy100:c.scalePercentBy100};function p(u,h){this._input=u,this._value=h}return t=function(u){var h,m,f,x;if(t.isNumeral(u))h=u.value();else if(u===0||typeof u>"u")h=0;else if(u===null||r.isNaN(u))h=null;else if(typeof u=="string")if(d.zeroFormat&&u===d.zeroFormat)h=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)h=null;else{for(m in a)if(x=typeof a[m].regexps.unformat=="function"?a[m].regexps.unformat():a[m].regexps.unformat,x&&u.match(x)){f=a[m].unformat;break}f=f||t._.stringToNumber,h=f(u)}else h=Number(u)||null;return new p(u,h)},t.version=n,t.isNumeral=function(u){return u instanceof p},t._=r={numberToFormat:function(u,h,m){var f=l[t.options.currentLocale],x=!1,y=!1,b=0,w="",v=1e12,A=1e9,S=1e6,E=1e3,I="",L=!1,M,D,P,T,z,N,K;if(u=u||0,D=Math.abs(u),t._.includes(h,"(")?(x=!0,h=h.replace(/[\(|\)]/g,"")):(t._.includes(h,"+")||t._.includes(h,"-"))&&(z=t._.includes(h,"+")?h.indexOf("+"):u<0?h.indexOf("-"):-1,h=h.replace(/[\+|\-]/g,"")),t._.includes(h,"a")&&(M=h.match(/a(k|m|b|t)?/),M=M?M[1]:!1,t._.includes(h," a")&&(w=" "),h=h.replace(new RegExp(w+"a[kmbt]?"),""),D>=v&&!M||M==="t"?(w+=f.abbreviations.trillion,u=u/v):D<v&&D>=A&&!M||M==="b"?(w+=f.abbreviations.billion,u=u/A):D<A&&D>=S&&!M||M==="m"?(w+=f.abbreviations.million,u=u/S):(D<S&&D>=E&&!M||M==="k")&&(w+=f.abbreviations.thousand,u=u/E)),t._.includes(h,"[.]")&&(y=!0,h=h.replace("[.]",".")),P=u.toString().split(".")[0],T=h.split(".")[1],N=h.indexOf(","),b=(h.split(".")[0].split(",")[0].match(/0/g)||[]).length,T?(t._.includes(T,"[")?(T=T.replace("]",""),T=T.split("["),I=t._.toFixed(u,T[0].length+T[1].length,m,T[1].length)):I=t._.toFixed(u,T.length,m),P=I.split(".")[0],t._.includes(I,".")?I=f.delimiters.decimal+I.split(".")[1]:I="",y&&Number(I.slice(1))===0&&(I="")):P=t._.toFixed(u,0,m),w&&!M&&Number(P)>=1e3&&w!==f.abbreviations.trillion)switch(P=String(Number(P)/1e3),w){case f.abbreviations.thousand:w=f.abbreviations.million;break;case f.abbreviations.million:w=f.abbreviations.billion;break;case f.abbreviations.billion:w=f.abbreviations.trillion;break}if(t._.includes(P,"-")&&(P=P.slice(1),L=!0),P.length<b)for(var q=b-P.length;q>0;q--)P="0"+P;return N>-1&&(P=P.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),h.indexOf(".")===0&&(P=""),K=P+I+(w||""),x?K=(x&&L?"(":"")+K+(x&&L?")":""):z>=0?K=z===0?(L?"-":"+")+K:K+(L?"-":"+"):L&&(K="-"+K),K},stringToNumber:function(u){var h=l[d.currentLocale],m=u,f={thousand:3,million:6,billion:9,trillion:12},x,y,b;if(d.zeroFormat&&u===d.zeroFormat)y=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)y=null;else{y=1,h.delimiters.decimal!=="."&&(u=u.replace(/\./g,"").replace(h.delimiters.decimal,"."));for(x in f)if(b=new RegExp("[^a-zA-Z]"+h.abbreviations[x]+"(?:\\)|(\\"+h.currency.symbol+")?(?:\\))?)?$"),m.match(b)){y*=Math.pow(10,f[x]);break}y*=(u.split("-").length+Math.min(u.split("(").length-1,u.split(")").length-1))%2?1:-1,u=u.replace(/[^0-9\.]+/g,""),y*=Number(u)}return y},isNaN:function(u){return typeof u=="number"&&isNaN(u)},includes:function(u,h){return u.indexOf(h)!==-1},insert:function(u,h,m){return u.slice(0,m)+h+u.slice(m)},reduce:function(u,h){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof h!="function")throw new TypeError(h+" is not a function");var m=Object(u),f=m.length>>>0,x=0,y;if(arguments.length===3)y=arguments[2];else{for(;x<f&&!(x in m);)x++;if(x>=f)throw new TypeError("Reduce of empty array with no initial value");y=m[x++]}for(;x<f;x++)x in m&&(y=h(y,m[x],x,m));return y},multiplier:function(u){var h=u.toString().split(".");return h.length<2?1:Math.pow(10,h[1].length)},correctionFactor:function(){var u=Array.prototype.slice.call(arguments);return u.reduce(function(h,m){var f=r.multiplier(m);return h>f?h:f},1)},toFixed:function(u,h,m,f){var x=u.toString().split("."),y=h-(f||0),b,w,v,A;return x.length===2?b=Math.min(Math.max(x[1].length,y),h):b=y,v=Math.pow(10,b),A=(m(u+"e+"+b)/v).toFixed(b),f>h-b&&(w=new RegExp("\\.?0{1,"+(f-(h-b))+"}$"),A=A.replace(w,"")),A}},t.options=d,t.formats=a,t.locales=l,t.locale=function(u){return u&&(d.currentLocale=u.toLowerCase()),d.currentLocale},t.localeData=function(u){if(!u)return l[d.currentLocale];if(u=u.toLowerCase(),!l[u])throw new Error("Unknown locale : "+u);return l[u]},t.reset=function(){for(var u in c)d[u]=c[u]},t.zeroFormat=function(u){d.zeroFormat=typeof u=="string"?u:null},t.nullFormat=function(u){d.nullFormat=typeof u=="string"?u:null},t.defaultFormat=function(u){d.defaultFormat=typeof u=="string"?u:"0.0"},t.register=function(u,h,m){if(h=h.toLowerCase(),this[u+"s"][h])throw new TypeError(h+" "+u+" already registered.");return this[u+"s"][h]=m,m},t.validate=function(u,h){var m,f,x,y,b,w,v,A;if(typeof u!="string"&&(u+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",u)),u=u.trim(),u.match(/^\d+$/))return!0;if(u==="")return!1;try{v=t.localeData(h)}catch{v=t.localeData(t.locale())}return x=v.currency.symbol,b=v.abbreviations,m=v.delimiters.decimal,v.delimiters.thousands==="."?f="\\.":f=v.delimiters.thousands,A=u.match(/^[^\d]+/),A!==null&&(u=u.substr(1),A[0]!==x)||(A=u.match(/[^\d]+$/),A!==null&&(u=u.slice(0,-1),A[0]!==b.thousand&&A[0]!==b.million&&A[0]!==b.billion&&A[0]!==b.trillion))?!1:(w=new RegExp(f+"{2}"),u.match(/[^\d.,]/g)?!1:(y=u.split(m),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/)))},t.fn=p.prototype={clone:function(){return t(this)},format:function(u,h){var m=this._value,f=u||d.defaultFormat,x,y,b;if(h=h||Math.round,m===0&&d.zeroFormat!==null)y=d.zeroFormat;else if(m===null&&d.nullFormat!==null)y=d.nullFormat;else{for(x in a)if(f.match(a[x].regexps.format)){b=a[x].format;break}b=b||t._.numberToFormat,y=b(m,f,h)}return y},value:function(){return this._value},input:function(){return this._input},set:function(u){return this._value=Number(u),this},add:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f+Math.round(h*x)}return this._value=r.reduce([this._value,u],m,0)/h,this},subtract:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f-Math.round(h*x)}return this._value=r.reduce([u],m,Math.round(this._value*h))/h,this},multiply:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)*Math.round(f*b)/Math.round(b*b)}return this._value=r.reduce([this._value,u],h,1),this},divide:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)/Math.round(f*b)}return this._value=r.reduce([this._value,u],h),this},difference:function(u){return Math.abs(t(this._value).subtract(u).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(u){var h=u%10;return~~(u%100/10)===1?"th":h===1?"st":h===2?"nd":h===3?"rd":"th"},currency:{symbol:"$"}}),(function(){t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(u,h,m){var f=t._.includes(h," BPS")?" ":"",x;return u=u*1e4,h=h.replace(/\s?BPS/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"BPS"),x=x.join("")):x=x+f+"BPS",x},unformat:function(u){return+(t._.stringToNumber(u)*1e-4).toFixed(15)}})})(),(function(){var u={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},h={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},m=u.suffixes.concat(h.suffixes.filter(function(x){return u.suffixes.indexOf(x)<0})),f=m.join("|");f="("+f.replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(x,y,b){var w,v=t._.includes(y,"ib")?h:u,A=t._.includes(y," b")||t._.includes(y," ib")?" ":"",S,E,I;for(y=y.replace(/\s?i?b/,""),S=0;S<=v.suffixes.length;S++)if(E=Math.pow(v.base,S),I=Math.pow(v.base,S+1),x===null||x===0||x>=E&&x<I){A+=v.suffixes[S],E>0&&(x=x/E);break}return w=t._.numberToFormat(x,y,b),w+A},unformat:function(x){var y=t._.stringToNumber(x),b,w;if(y){for(b=u.suffixes.length-1;b>=0;b--){if(t._.includes(x,u.suffixes[b])){w=Math.pow(u.base,b);break}if(t._.includes(x,h.suffixes[b])){w=Math.pow(h.base,b);break}}y*=w||1}return y}})})(),(function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x={before:h.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:h.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,b,w;for(h=h.replace(/\s?\$\s?/,""),y=t._.numberToFormat(u,h,m),u>=0?(x.before=x.before.replace(/[\-\(]/,""),x.after=x.after.replace(/[\-\)]/,"")):u<0&&!t._.includes(x.before,"-")&&!t._.includes(x.before,"(")&&(x.before="-"+x.before),w=0;w<x.before.length;w++)switch(b=x.before[w],b){case"$":y=t._.insert(y,f.currency.symbol,w);break;case" ":y=t._.insert(y," ",w+f.currency.symbol.length-1);break}for(w=x.after.length-1;w>=0;w--)switch(b=x.after[w],b){case"$":y=w===x.after.length-1?y+f.currency.symbol:t._.insert(y,f.currency.symbol,-(x.after.length-(1+w)));break;case" ":y=w===x.after.length-1?y+" ":t._.insert(y," ",-(x.after.length-(1+w)+f.currency.symbol.length-1));break}return y}})})(),(function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(u,h,m){var f,x=typeof u=="number"&&!t._.isNaN(u)?u.toExponential():"0e+0",y=x.split("e");return h=h.replace(/e[\+|\-]{1}0/,""),f=t._.numberToFormat(Number(y[0]),h,m),f+"e"+y[1]},unformat:function(u){var h=t._.includes(u,"e+")?u.split("e+"):u.split("e-"),m=Number(h[0]),f=Number(h[1]);f=t._.includes(u,"e-")?f*=-1:f;function x(y,b,w,v){var A=t._.correctionFactor(y,b),S=y*A*(b*A)/(A*A);return S}return t._.reduce([m,Math.pow(10,f)],x,1)}})})(),(function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x,y=t._.includes(h," o")?" ":"";return h=h.replace(/\s?o/,""),y+=f.ordinal(u),x=t._.numberToFormat(u,h,m),x+y}})})(),(function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(u,h,m){var f=t._.includes(h," %")?" ":"",x;return t.options.scalePercentBy100&&(u=u*100),h=h.replace(/\s?\%/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"%"),x=x.join("")):x=x+f+"%",x},unformat:function(u){var h=t._.stringToNumber(u);return t.options.scalePercentBy100?h*.01:h}})})(),(function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(u,h,m){var f=Math.floor(u/60/60),x=Math.floor((u-f*60*60)/60),y=Math.round(u-f*60*60-x*60);return f+":"+(x<10?"0"+x:x)+":"+(y<10?"0"+y:y)},unformat:function(u){var h=u.split(":"),m=0;return h.length===3?(m=m+Number(h[0])*60*60,m=m+Number(h[1])*60,m=m+Number(h[2])):h.length===2&&(m=m+Number(h[0])*60,m=m+Number(h[1])),Number(m)}})})(),t})})(GW)),GW.exports}var uet=pet();const np=Vr(uet);function u2(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}const s2="$$material";function het(e){for(var t=0,r,n=0,a=e.length;a>=4;++n,a-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var met={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 get(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var fet=/[A-Z]|^ms/g,xet=/_EMO_([^_]+?)_([^]*?)_EMO_/g,xke=function(e){return e.charCodeAt(1)===45},Nre=function(e){return e!=null&&typeof e!="boolean"},fT=get(function(e){return xke(e)?e:e.replace(fet,"-$&").toLowerCase()}),Hre=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(xet,function(r,n,a){return Qm={name:n,styles:a,next:Qm},n})}return met[e]!==1&&!xke(e)&&typeof t=="number"&&t!==0?t+"px":t};function EE(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var a=r;if(a.anim===1)return Qm={name:a.name,styles:a.styles,next:Qm},a.name;var l=r;if(l.styles!==void 0){var c=l.next;if(c!==void 0)for(;c!==void 0;)Qm={name:c.name,styles:c.styles,next:Qm},c=c.next;var d=l.styles+";";return d}return yet(e,t,r)}}var p=r;return p}function yet(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a<r.length;a++)n+=EE(e,t,r[a])+";";else for(var l in r){var c=r[l];if(typeof c!="object"){var d=c;Nre(d)&&(n+=fT(l)+":"+Hre(l,d)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&t==null)for(var p=0;p<c.length;p++)Nre(c[p])&&(n+=fT(l)+":"+Hre(l,c[p])+";");else{var u=EE(e,t,c);switch(l){case"animation":case"animationName":{n+=fT(l)+":"+u+";";break}default:n+=l+"{"+u+"}"}}}return n}var _re=/label:\s*([^\s;{]+)\s*(;|$)/g,Qm;function bet(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,a="";Qm=void 0;var l=e[0];if(l==null||l.raw===void 0)n=!1,a+=EE(r,t,l);else{var c=l;a+=c[0]}for(var d=1;d<e.length;d++)if(a+=EE(r,t,e[d]),n){var p=l;a+=p[d]}_re.lastIndex=0;for(var u="",h;(h=_re.exec(a))!==null;)u+="-"+h[1];var m=het(a)+u;return{name:m,styles:a,next:Qm}}var xT={exports:{}},yT,Vre;function wet(){if(Vre)return yT;Vre=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return yT=e,yT}var bT,Qre;function vet(){if(Qre)return bT;Qre=1;var e=wet();function t(){}function r(){}return r.resetWarningCache=t,bT=function(){function n(c,d,p,u,h,m){if(m!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function a(){return n}var l={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return l.PropTypes=l,l},bT}var Ure;function mZ(){return Ure||(Ure=1,xT.exports=vet()()),xT.exports}var Cet=mZ();const Nt=Vr(Cet);function Aet(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 $et(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 ket=(function(){function e(r){var n=this;this._insertTag=function(a){var l;n.tags.length===0?n.insertionPoint?l=n.insertionPoint.nextSibling:n.prepend?l=n.container.firstChild:l=n.before:l=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,l),n.tags.push(a)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag($et(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=Aet(n);try{a.insertRule(r,a.cssRules.length)}catch{}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e})(),ol="-ms-",LE="-moz-",ki="-webkit-",yke="comm",gZ="rule",fZ="decl",Eet="@import",bke="@keyframes",Let="@layer",Iet=Math.abs,Cj=String.fromCharCode,jet=Object.assign;function Met(e,t){return zs(e,0)^45?(((t<<2^zs(e,0))<<2^zs(e,1))<<2^zs(e,2))<<2^zs(e,3):0}function wke(e){return e.trim()}function Bet(e,t){return(e=t.exec(e))?e[0]:e}function Si(e,t,r){return e.replace(t,r)}function YW(e,t){return e.indexOf(t)}function zs(e,t){return e.charCodeAt(t)|0}function jw(e,t,r){return e.slice(t,r)}function Ku(e){return e.length}function xZ(e){return e.length}function vA(e,t){return t.push(e),e}function Pet(e,t){return e.map(t).join("")}var Aj=1,L8=1,vke=0,jc=0,Ia=0,v9="";function $j(e,t,r,n,a,l,c){return{value:e,root:t,parent:r,type:n,props:a,children:l,line:Aj,column:L8,length:c,return:""}}function bx(e,t){return jet($j("",null,null,"",null,null,0),e,{length:-e.length},t)}function Det(){return Ia}function Tet(){return Ia=jc>0?zs(v9,--jc):0,L8--,Ia===10&&(L8=1,Aj--),Ia}function ud(){return Ia=jc<vke?zs(v9,jc++):0,L8++,Ia===10&&(L8=1,Aj++),Ia}function kh(){return zs(v9,jc)}function NS(){return jc}function Fv(e,t){return jw(v9,e,t)}function Mw(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Cke(e){return Aj=L8=1,vke=Ku(v9=e),jc=0,[]}function Ake(e){return v9="",e}function HS(e){return wke(Fv(jc-1,KW(e===91?e+2:e===40?e+1:e)))}function zet(e){for(;(Ia=kh())&&Ia<33;)ud();return Mw(e)>2||Mw(Ia)>3?"":" "}function Ret(e,t){for(;--t&&ud()&&!(Ia<48||Ia>102||Ia>57&&Ia<65||Ia>70&&Ia<97););return Fv(e,NS()+(t<6&&kh()==32&&ud()==32))}function KW(e){for(;ud();)switch(Ia){case e:return jc;case 34:case 39:e!==34&&e!==39&&KW(Ia);break;case 40:e===41&&KW(e);break;case 92:ud();break}return jc}function Fet(e,t){for(;ud()&&e+Ia!==57&&!(e+Ia===84&&kh()===47););return"/*"+Fv(t,jc-1)+"*"+Cj(e===47?e:ud())}function Oet(e){for(;!Mw(kh());)ud();return Fv(e,jc)}function Net(e){return Ake(_S("",null,null,null,[""],e=Cke(e),0,[0],e))}function _S(e,t,r,n,a,l,c,d,p){for(var u=0,h=0,m=c,f=0,x=0,y=0,b=1,w=1,v=1,A=0,S="",E=a,I=l,L=n,M=S;w;)switch(y=A,A=ud()){case 40:if(y!=108&&zs(M,m-1)==58){YW(M+=Si(HS(A),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:M+=HS(A);break;case 9:case 10:case 13:case 32:M+=zet(y);break;case 92:M+=Ret(NS()-1,7);continue;case 47:switch(kh()){case 42:case 47:vA(Het(Fet(ud(),NS()),t,r),p);break;default:M+="/"}break;case 123*b:d[u++]=Ku(M)*v;case 125*b:case 59:case 0:switch(A){case 0:case 125:w=0;case 59+h:v==-1&&(M=Si(M,/\f/g,"")),x>0&&Ku(M)-m&&vA(x>32?Gre(M+";",n,r,m-1):Gre(Si(M," ","")+";",n,r,m-2),p);break;case 59:M+=";";default:if(vA(L=Wre(M,t,r,u,h,a,d,S,E=[],I=[],m),l),A===123)if(h===0)_S(M,t,L,L,E,l,m,d,I);else switch(f===99&&zs(M,3)===110?100:f){case 100:case 108:case 109:case 115:_S(e,L,L,n&&vA(Wre(e,L,L,0,0,a,d,S,a,E=[],m),I),a,I,m,d,n?E:I);break;default:_S(M,L,L,L,[""],I,0,d,I)}}u=h=x=0,b=v=1,S=M="",m=c;break;case 58:m=1+Ku(M),x=y;default:if(b<1){if(A==123)--b;else if(A==125&&b++==0&&Tet()==125)continue}switch(M+=Cj(A),A*b){case 38:v=h>0?1:(M+="\f",-1);break;case 44:d[u++]=(Ku(M)-1)*v,v=1;break;case 64:kh()===45&&(M+=HS(ud())),f=kh(),h=m=Ku(S=M+=Oet(NS())),A++;break;case 45:y===45&&Ku(M)==2&&(b=0)}}return l}function Wre(e,t,r,n,a,l,c,d,p,u,h){for(var m=a-1,f=a===0?l:[""],x=xZ(f),y=0,b=0,w=0;y<n;++y)for(var v=0,A=jw(e,m+1,m=Iet(b=c[y])),S=e;v<x;++v)(S=wke(b>0?f[v]+" "+A:Si(A,/&\f/g,f[v])))&&(p[w++]=S);return $j(e,t,r,a===0?gZ:d,p,u,h)}function Het(e,t,r){return $j(e,t,r,yke,Cj(Det()),jw(e,2,-2),0)}function Gre(e,t,r,n){return $j(e,t,r,fZ,jw(e,0,n),jw(e,n+1,-1),n)}function r8(e,t){for(var r="",n=xZ(e),a=0;a<n;a++)r+=t(e[a],a,e,t)||"";return r}function _et(e,t,r,n){switch(e.type){case Let:if(e.children.length)break;case Eet:case fZ:return e.return=e.return||e.value;case yke:return"";case bke:return e.return=e.value+"{"+r8(e.children,n)+"}";case gZ:e.value=e.props.join(",")}return Ku(r=r8(e.children,n))?e.return=e.value+"{"+r+"}":""}function Vet(e){var t=xZ(e);return function(r,n,a,l){for(var c="",d=0;d<t;d++)c+=e[d](r,n,a,l)||"";return c}}function Qet(e){return function(t){t.root||(t=t.return)&&e(t)}}var Uet=function(e,t,r){for(var n=0,a=0;n=a,a=kh(),n===38&&a===12&&(t[r]=1),!Mw(a);)ud();return Fv(e,jc)},Wet=function(e,t){var r=-1,n=44;do switch(Mw(n)){case 0:n===38&&kh()===12&&(t[r]=1),e[r]+=Uet(jc-1,t,r);break;case 2:e[r]+=HS(n);break;case 4:if(n===44){e[++r]=kh()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Cj(n)}while(n=ud());return e},Get=function(e,t){return Ake(Wet(Cke(e),t))},Yre=new WeakMap,Yet=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!Yre.get(r))&&!n){Yre.set(e,!0);for(var a=[],l=Get(t,a),c=r.props,d=0,p=0;d<l.length;d++)for(var u=0;u<c.length;u++,p++)e.props[p]=a[d]?l[d].replace(/&\f/g,c[u]):c[u]+" "+l[d]}}},Ket=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function $ke(e,t){switch(Met(e,t)){case 5103:return ki+"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 ki+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ki+e+LE+e+ol+e+e;case 6828:case 4268:return ki+e+ol+e+e;case 6165:return ki+e+ol+"flex-"+e+e;case 5187:return ki+e+Si(e,/(\w+).+(:[^]+)/,ki+"box-$1$2"+ol+"flex-$1$2")+e;case 5443:return ki+e+ol+"flex-item-"+Si(e,/flex-|-self/,"")+e;case 4675:return ki+e+ol+"flex-line-pack"+Si(e,/align-content|flex-|-self/,"")+e;case 5548:return ki+e+ol+Si(e,"shrink","negative")+e;case 5292:return ki+e+ol+Si(e,"basis","preferred-size")+e;case 6060:return ki+"box-"+Si(e,"-grow","")+ki+e+ol+Si(e,"grow","positive")+e;case 4554:return ki+Si(e,/([^-])(transform)/g,"$1"+ki+"$2")+e;case 6187:return Si(Si(Si(e,/(zoom-|grab)/,ki+"$1"),/(image-set)/,ki+"$1"),e,"")+e;case 5495:case 3959:return Si(e,/(image-set\([^]*)/,ki+"$1$`$1");case 4968:return Si(Si(e,/(.+:)(flex-)?(.*)/,ki+"box-pack:$3"+ol+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ki+e+e;case 4095:case 3583:case 4068:case 2532:return Si(e,/(.+)-inline(.+)/,ki+"$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(zs(e,t+1)){case 109:if(zs(e,t+4)!==45)break;case 102:return Si(e,/(.+:)(.+)-([^]+)/,"$1"+ki+"$2-$3$1"+LE+(zs(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~YW(e,"stretch")?$ke(Si(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(zs(e,t+1)!==115)break;case 6444:switch(zs(e,Ku(e)-3-(~YW(e,"!important")&&10))){case 107:return Si(e,":",":"+ki)+e;case 101:return Si(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ki+(zs(e,14)===45?"inline-":"")+"box$3$1"+ki+"$2$3$1"+ol+"$2box$3")+e}break;case 5936:switch(zs(e,t+11)){case 114:return ki+e+ol+Si(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ki+e+ol+Si(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ki+e+ol+Si(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ki+e+ol+e+e}return e}var qet=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case fZ:e.return=$ke(e.value,e.length);break;case bke:return r8([bx(e,{value:Si(e.value,"@","@"+ki)})],n);case gZ:if(e.length)return Pet(e.props,function(a){switch(Bet(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return r8([bx(e,{props:[Si(a,/:(read-\w+)/,":"+LE+"$1")]})],n);case"::placeholder":return r8([bx(e,{props:[Si(a,/:(plac\w+)/,":"+ki+"input-$1")]}),bx(e,{props:[Si(a,/:(plac\w+)/,":"+LE+"$1")]}),bx(e,{props:[Si(a,/:(plac\w+)/,ol+"input-$1")]})],n)}return""})}},Zet=[qet],kke=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(y){var b=y.getAttribute("data-emotion");b.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var n=e.stylisPlugins||Zet,a={},l,c=[];l=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(y){for(var b=y.getAttribute("data-emotion").split(" "),w=1;w<b.length;w++)a[b[w]]=!0;c.push(y)});var d,p=[Yet,Ket];{var u,h=[_et,Qet(function(y){u.insert(y)})],m=Vet(p.concat(n,h)),f=function(y){return r8(Net(y),m)};d=function(y,b,w,v){u=w,f(y?y+"{"+b.styles+"}":b.styles),v&&(x.inserted[b.name]=!0)}}var x={key:t,sheet:new ket({key:t,container:l,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:d};return x.sheet.hydrate(c),x};function Jet(e){return e==null||Object.keys(e).length===0}function Ske(e){const{styles:t,defaultTheme:r={}}=e,n=typeof t=="function"?a=>t(Jet(a)?r:a):t;return s.jsx(zv,{styles:n})}function Xet(e,t){return i(e,t)}function ett(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Kre=[];function rg(e){return Kre[0]=e,bet(Kre)}var qre={exports:{}},Qi={},Zre;function ttt(){if(Zre)return Qi;Zre=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function y(b){if(typeof b=="object"&&b!==null){var w=b.$$typeof;switch(w){case e:switch(b=b.type,b){case r:case a:case n:case p:case u:case f:return b;default:switch(b=b&&b.$$typeof,b){case c:case d:case m:case h:return b;case l:return b;default:return w}}case t:return w}}}return Qi.ContextConsumer=l,Qi.ContextProvider=c,Qi.Element=e,Qi.ForwardRef=d,Qi.Fragment=r,Qi.Lazy=m,Qi.Memo=h,Qi.Portal=t,Qi.Profiler=a,Qi.StrictMode=n,Qi.Suspense=p,Qi.SuspenseList=u,Qi.isContextConsumer=function(b){return y(b)===l},Qi.isContextProvider=function(b){return y(b)===c},Qi.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},Qi.isForwardRef=function(b){return y(b)===d},Qi.isFragment=function(b){return y(b)===r},Qi.isLazy=function(b){return y(b)===m},Qi.isMemo=function(b){return y(b)===h},Qi.isPortal=function(b){return y(b)===t},Qi.isProfiler=function(b){return y(b)===a},Qi.isStrictMode=function(b){return y(b)===n},Qi.isSuspense=function(b){return y(b)===p},Qi.isSuspenseList=function(b){return y(b)===u},Qi.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===a||b===n||b===p||b===u||typeof b=="object"&&b!==null&&(b.$$typeof===m||b.$$typeof===h||b.$$typeof===c||b.$$typeof===l||b.$$typeof===d||b.$$typeof===x||b.getModuleId!==void 0)},Qi.typeOf=y,Qi}var Jre;function ott(){return Jre||(Jre=1,qre.exports=ttt()),qre.exports}var Eke=ott();function U0(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 Lke(e){if(g.isValidElement(e)||Eke.isValidElementType(e)||!U0(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Lke(e[r])}),t}function ml(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return U0(e)&&U0(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||Eke.isValidElementType(t[a])?n[a]=t[a]:U0(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&U0(e[a])?n[a]=ml(e[a],t[a],r):r.clone?n[a]=U0(t[a])?Lke(t[a]):t[a]:n[a]=t[a]}),n}const rtt=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function itt(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...a}=e,l=rtt(t),c=Object.keys(l);function d(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r})`}function p(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-n/100}${r})`}function u(f,x){const y=c.indexOf(x);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r}) and (max-width:${(y!==-1&&typeof t[c[y]]=="number"?t[c[y]]:x)-n/100}${r})`}function h(f){return c.indexOf(f)+1<c.length?u(f,c[c.indexOf(f)+1]):d(f)}function m(f){const x=c.indexOf(f);return x===0?d(c[1]):x===c.length-1?p(c[x]):u(f,c[c.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:c,values:l,up:d,down:p,between:u,only:h,not:m,unit:r,...a}}function Xre(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,a)=>{const l=/min-width:\s*([0-9.]+)/;return+(n.match(l)?.[1]||0)-+(a.match(l)?.[1]||0)});return r.length?r.reduce((n,a)=>{const l=t[a];return delete n[a],n[a]=l,n},{...t}):t}function ntt(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function att(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r)return null;const[,n,a]=r,l=Number.isNaN(+n)?n||0:+n;return e.containerQueries(a).up(l)}function stt(e){const t=(l,c)=>l.replace("@media",c?`@container ${c}`:"@container");function r(l,c){l.up=(...d)=>t(e.breakpoints.up(...d),c),l.down=(...d)=>t(e.breakpoints.down(...d),c),l.between=(...d)=>t(e.breakpoints.between(...d),c),l.only=(...d)=>t(e.breakpoints.only(...d),c),l.not=(...d)=>{const p=t(e.breakpoints.not(...d),c);return p.includes("not all and")?p.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):p}}const n={},a=l=>(r(n,l),n);return r(a),{...e,containerQueries:a}}const ltt={borderRadius:4};function Zb(e,t){return t?ml(e,t,{clone:!1}):e}const kj={xs:0,sm:600,md:900,lg:1200,xl:1536},eie={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${kj[e]}px)`},ctt={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:kj[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function h2(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const a=n.breakpoints||eie;return t.reduce((l,c,d)=>(l[a.up(a.keys[d])]=r(t[d]),l),{})}if(typeof t=="object"){const a=n.breakpoints||eie;return Object.keys(t).reduce((l,c)=>{if(ntt(a.keys,c)){const d=att(n.containerQueries?n:ctt,c);d&&(l[d]=r(t[c],c))}else if(Object.keys(a.values||kj).includes(c)){const d=a.up(c);l[d]=r(t[c],c)}else{const d=c;l[d]=t[d]}return l},{})}return r(t)}function dtt(e={}){return e.keys?.reduce((t,r)=>{const n=e.up(r);return t[n]={},t},{})||{}}function tie(e,t){return e.reduce((r,n)=>{const a=r[n];return(!a||Object.keys(a).length===0)&&delete r[n],r},t)}function mr(e){if(typeof e!="string")throw new Error(u2(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Sj(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((a,l)=>a&&a[l]?a[l]:null,e);if(n!=null)return n}return t.split(".").reduce((n,a)=>n&&n[a]!=null?n[a]:null,e)}function IE(e,t,r,n=r){let a;return typeof e=="function"?a=e(r):Array.isArray(e)?a=e[r]||n:a=Sj(e,r)||n,t&&(a=t(a,n,e)),a}function ha(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:a}=e,l=c=>{if(c[t]==null)return null;const d=c[t],p=c.theme,u=Sj(p,n)||{};return h2(c,d,h=>{let m=IE(u,a,h);return h===m&&typeof h=="string"&&(m=IE(u,a,`${t}${h==="default"?"":mr(h)}`,h)),r===!1?m:{[r]:m}})};return l.propTypes={},l.filterProps=[t],l}function ptt(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const utt={m:"margin",p:"padding"},htt={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},oie={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},mtt=ptt(e=>{if(e.length>2)if(oie[e])e=oie[e];else return[e];const[t,r]=e.split(""),n=utt[t],a=htt[r]||"";return Array.isArray(a)?a.map(l=>n+l):[n+a]}),yZ=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],bZ=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...yZ,...bZ];function Ov(e,t,r,n){const a=Sj(e,t,!0)??r;return typeof a=="number"||typeof a=="string"?l=>typeof l=="string"?l:typeof a=="string"?a.startsWith("var(")&&l===0?0:a.startsWith("var(")&&l===1?a:`calc(${l} * ${a})`:a*l:Array.isArray(a)?l=>{if(typeof l=="string")return l;const c=Math.abs(l),d=a[c];return l>=0?d:typeof d=="number"?-d:typeof d=="string"&&d.startsWith("var(")?`calc(-1 * ${d})`:`-${d}`}:typeof a=="function"?a:(()=>{})}function wZ(e){return Ov(e,"spacing",8)}function Nv(e,t){return typeof t=="string"||t==null?t:e(t)}function gtt(e,t){return r=>e.reduce((n,a)=>(n[a]=Nv(t,r),n),{})}function ftt(e,t,r,n){if(!t.includes(r))return null;const a=mtt(r),l=gtt(a,n),c=e[r];return h2(e,c,l)}function Ike(e,t){const r=wZ(e.theme);return Object.keys(e).map(n=>ftt(e,t,n,r)).reduce(Zb,{})}function Hn(e){return Ike(e,yZ)}Hn.propTypes={};Hn.filterProps=yZ;function _n(e){return Ike(e,bZ)}_n.propTypes={};_n.filterProps=bZ;function jke(e=8,t=wZ({spacing:e})){if(e.mui)return e;const r=(...n)=>(n.length===0?[1]:n).map(a=>{const l=t(a);return typeof l=="number"?`${l}px`:l}).join(" ");return r.mui=!0,r}function Ej(...e){const t=e.reduce((n,a)=>(a.filterProps.forEach(l=>{n[l]=a}),n),{}),r=n=>Object.keys(n).reduce((a,l)=>t[l]?Zb(a,t[l](n)):a,{});return r.propTypes={},r.filterProps=e.reduce((n,a)=>n.concat(a.filterProps),[]),r}function Gd(e){return typeof e!="number"?e:`${e}px solid`}function g1(e,t){return ha({prop:e,themeKey:"borders",transform:t})}const xtt=g1("border",Gd),ytt=g1("borderTop",Gd),btt=g1("borderRight",Gd),wtt=g1("borderBottom",Gd),vtt=g1("borderLeft",Gd),Ctt=g1("borderColor"),Att=g1("borderTopColor"),$tt=g1("borderRightColor"),ktt=g1("borderBottomColor"),Stt=g1("borderLeftColor"),Ett=g1("outline",Gd),Ltt=g1("outlineColor"),Lj=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ov(e.theme,"shape.borderRadius",4),r=n=>({borderRadius:Nv(t,n)});return h2(e,e.borderRadius,r)}return null};Lj.propTypes={};Lj.filterProps=["borderRadius"];Ej(xtt,ytt,btt,wtt,vtt,Ctt,Att,$tt,ktt,Stt,Lj,Ett,Ltt);const Ij=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({gap:Nv(t,n)});return h2(e,e.gap,r)}return null};Ij.propTypes={};Ij.filterProps=["gap"];const jj=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({columnGap:Nv(t,n)});return h2(e,e.columnGap,r)}return null};jj.propTypes={};jj.filterProps=["columnGap"];const Mj=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({rowGap:Nv(t,n)});return h2(e,e.rowGap,r)}return null};Mj.propTypes={};Mj.filterProps=["rowGap"];const Itt=ha({prop:"gridColumn"}),jtt=ha({prop:"gridRow"}),Mtt=ha({prop:"gridAutoFlow"}),Btt=ha({prop:"gridAutoColumns"}),Ptt=ha({prop:"gridAutoRows"}),Dtt=ha({prop:"gridTemplateColumns"}),Ttt=ha({prop:"gridTemplateRows"}),ztt=ha({prop:"gridTemplateAreas"}),Rtt=ha({prop:"gridArea"});Ej(Ij,jj,Mj,Itt,jtt,Mtt,Btt,Ptt,Dtt,Ttt,ztt,Rtt);function i8(e,t){return t==="grey"?t:e}const Ftt=ha({prop:"color",themeKey:"palette",transform:i8}),Ott=ha({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:i8}),Ntt=ha({prop:"backgroundColor",themeKey:"palette",transform:i8});Ej(Ftt,Ott,Ntt);function nd(e){return e<=1&&e!==0?`${e*100}%`:e}const Htt=ha({prop:"width",transform:nd}),vZ=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||kj[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:nd(r)}};return h2(e,e.maxWidth,t)}return null};vZ.filterProps=["maxWidth"];const _tt=ha({prop:"minWidth",transform:nd}),Vtt=ha({prop:"height",transform:nd}),Qtt=ha({prop:"maxHeight",transform:nd}),Utt=ha({prop:"minHeight",transform:nd});ha({prop:"size",cssProperty:"width",transform:nd});ha({prop:"size",cssProperty:"height",transform:nd});const Wtt=ha({prop:"boxSizing"});Ej(Htt,vZ,_tt,Vtt,Qtt,Utt,Wtt);const Bj={border:{themeKey:"borders",transform:Gd},borderTop:{themeKey:"borders",transform:Gd},borderRight:{themeKey:"borders",transform:Gd},borderBottom:{themeKey:"borders",transform:Gd},borderLeft:{themeKey:"borders",transform:Gd},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Gd},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Lj},color:{themeKey:"palette",transform:i8},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:i8},backgroundColor:{themeKey:"palette",transform:i8},p:{style:_n},pt:{style:_n},pr:{style:_n},pb:{style:_n},pl:{style:_n},px:{style:_n},py:{style:_n},padding:{style:_n},paddingTop:{style:_n},paddingRight:{style:_n},paddingBottom:{style:_n},paddingLeft:{style:_n},paddingX:{style:_n},paddingY:{style:_n},paddingInline:{style:_n},paddingInlineStart:{style:_n},paddingInlineEnd:{style:_n},paddingBlock:{style:_n},paddingBlockStart:{style:_n},paddingBlockEnd:{style:_n},m:{style:Hn},mt:{style:Hn},mr:{style:Hn},mb:{style:Hn},ml:{style:Hn},mx:{style:Hn},my:{style:Hn},margin:{style:Hn},marginTop:{style:Hn},marginRight:{style:Hn},marginBottom:{style:Hn},marginLeft:{style:Hn},marginX:{style:Hn},marginY:{style:Hn},marginInline:{style:Hn},marginInlineStart:{style:Hn},marginInlineEnd:{style:Hn},marginBlock:{style:Hn},marginBlockStart:{style:Hn},marginBlockEnd:{style:Hn},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:Ij},rowGap:{style:Mj},columnGap:{style:jj},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:nd},maxWidth:{style:vZ},minWidth:{transform:nd},height:{transform:nd},maxHeight:{transform:nd},minHeight:{transform:nd},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 Gtt(...e){const t=e.reduce((n,a)=>n.concat(Object.keys(a)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function Ytt(e,t){return typeof e=="function"?e(t):e}function Ktt(){function e(r,n,a,l){const c={[r]:n,theme:a},d=l[r];if(!d)return{[r]:n};const{cssProperty:p=r,themeKey:u,transform:h,style:m}=d;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const f=Sj(a,u)||{};return m?m(c):h2(c,n,x=>{let y=IE(f,h,x);return x===y&&typeof x=="string"&&(y=IE(f,h,`${r}${x==="default"?"":mr(x)}`,x)),p===!1?y:{[p]:y}})}function t(r){const{sx:n,theme:a={},nested:l}=r||{};if(!n)return null;const c=a.unstable_sxConfig??Bj;function d(p){let u=p;if(typeof p=="function")u=p(a);else if(typeof p!="object")return p;if(!u)return null;const h=dtt(a.breakpoints),m=Object.keys(h);let f=h;return Object.keys(u).forEach(x=>{const y=Ytt(u[x],a);if(y!=null)if(typeof y=="object")if(c[x])f=Zb(f,e(x,y,a,c));else{const b=h2({theme:a},y,w=>({[x]:w}));Gtt(b,y)?f[x]=t({sx:y,theme:a,nested:!0}):f=Zb(f,b)}else f=Zb(f,e(x,y,a,c))}),!l&&a.modularCssLayers?{"@layer sx":Xre(a,tie(m,f))}:Xre(a,tie(m,f))}return Array.isArray(n)?n.map(d):d(n)}return t}const D4=Ktt();D4.filterProps=["sx"];function qtt(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||typeof r.getColorSchemeSelector!="function")return{};let n=r.getColorSchemeSelector(e);return n==="&"?t:((n.includes("data-")||n.includes("."))&&(n=`*:where(${n.replace(/\s*&$/,"")}) &`),{[n]:t})}return r.palette.mode===e?t:{}}function CZ(e={},...t){const{breakpoints:r={},palette:n={},spacing:a,shape:l={},...c}=e,d=itt(r),p=jke(a);let u=ml({breakpoints:d,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:p,shape:{...ltt,...l}},c);return u=stt(u),u.applyStyles=qtt,u=t.reduce((h,m)=>ml(h,m),u),u.unstable_sxConfig={...Bj,...c?.unstable_sxConfig},u.unstable_sx=function(h){return D4({sx:h,theme:this})},u}function Ztt(e){return Object.keys(e).length===0}function AZ(e=null){const t=g.useContext(hke);return!t||Ztt(t)?e:t}const Jtt=CZ();function Mke(e=Jtt){return AZ(e)}function rie(e){const t=rg(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function Bke({styles:e,themeId:t,defaultTheme:r={}}){const n=Mke(r),a=t&&n[t]||n;let l=typeof e=="function"?e(a):e;return a.modularCssLayers&&(Array.isArray(l)?l=l.map(c=>rie(typeof c=="function"?c(a):c)):l=rie(l)),s.jsx(Ske,{styles:l})}const iie=e=>e,Xtt=()=>{let e=iie;return{configure(t){e=t},generate(t){return e(t)},reset(){e=iie}}},eot=Xtt();function Pke(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Pke(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ko(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Pke(e))&&(n&&(n+=" "),n+=t);return n}const tot={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 Ci(e,t,r="Mui"){const n=tot[t];return n?`${r}-${n}`:`${eot.generate(e)}-${t}`}function ci(e,t,r="Mui"){const n={};return t.forEach(a=>{n[a]=Ci(e,a,r)}),n}function Dke(e){const{variants:t,...r}=e,n={variants:t,style:rg(r),isProcessed:!0};return n.style===r||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=rg(a.style))}),n}const oot=CZ();function wT(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function i4(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function rot(e){return e?(t,r)=>r[e]:null}function iot(e,t,r){e.theme=sot(e.theme)?r:e.theme[t]||e.theme}function VS(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(a=>VS(e,a,r));if(Array.isArray(n?.variants)){let a;if(n.isProcessed)a=r?i4(n.style,r):n.style;else{const{variants:l,...c}=n;a=r?i4(rg(c),r):c}return Tke(e,n.variants,[a],r)}return n?.isProcessed?r?i4(rg(n.style),r):n.style:r?i4(rg(n),r):n}function Tke(e,t,r=[],n=void 0){let a;e:for(let l=0;l<t.length;l+=1){const c=t[l];if(typeof c.props=="function"){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!c.props(a))continue}else for(const d in c.props)if(e[d]!==c.props[d]&&e.ownerState?.[d]!==c.props[d])continue e;typeof c.style=="function"?(a??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?i4(rg(c.style(a)),n):c.style(a))):r.push(n?i4(rg(c.style),n):c.style)}return r}function not(e={}){const{themeId:t,defaultTheme:r=oot,rootShouldForwardProp:n=wT,slotShouldForwardProp:a=wT}=e;function l(c){iot(c,t,r)}return(c,d={})=>{ett(c,I=>I.filter(L=>L!==D4));const{name:p,slot:u,skipVariantsResolver:h,skipSx:m,overridesResolver:f=rot(cot(u)),...x}=d,y=p&&p.startsWith("Mui")||u?"components":"custom",b=h!==void 0?h:u&&u!=="Root"&&u!=="root"||!1,w=m||!1;let v=wT;u==="Root"||u==="root"?v=n:u?v=a:lot(c)&&(v=void 0);const A=Xet(c,{shouldForwardProp:v,label:aot(),...x}),S=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(L){return VS(L,I,L.theme.modularCssLayers?y:void 0)};if(U0(I)){const L=Dke(I);return function(M){return L.variants?VS(M,L,M.theme.modularCssLayers?y:void 0):M.theme.modularCssLayers?i4(L.style,y):L.style}}return I},E=(...I)=>{const L=[],M=I.map(S),D=[];if(L.push(l),p&&f&&D.push(function(z){const N=z.theme.components?.[p]?.styleOverrides;if(!N)return null;const K={};for(const q in N)K[q]=VS(z,N[q],z.theme.modularCssLayers?"theme":void 0);return f(z,K)}),p&&!b&&D.push(function(z){const N=z.theme?.components?.[p]?.variants;return N?Tke(z,N,[],z.theme.modularCssLayers?"theme":void 0):null}),w||D.push(D4),Array.isArray(M[0])){const z=M.shift(),N=new Array(L.length).fill(""),K=new Array(D.length).fill("");let q;q=[...N,...z,...K],q.raw=[...N,...z.raw,...K],L.unshift(q)}const P=[...L,...M,...D],T=A(...P);return c.muiName&&(T.muiName=c.muiName),T};return A.withConfig&&(E.withConfig=A.withConfig),E}}function aot(e,t){return void 0}function sot(e){for(const t in e)return!1;return!0}function lot(e){return typeof e=="string"&&e.charCodeAt(0)>96}function cot(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function qW(e,t,r=!1){const n={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const l=a;if(l==="components"||l==="slots")n[l]={...e[l],...n[l]};else if(l==="componentsProps"||l==="slotProps"){const c=e[l],d=t[l];if(!d)n[l]=c||{};else if(!c)n[l]=d;else{n[l]={...d};for(const p in c)if(Object.prototype.hasOwnProperty.call(c,p)){const u=p;n[l][u]=qW(c[u],d[u],r)}}}else l==="className"&&r&&t.className?n.className=Ko(e?.className,t?.className):l==="style"&&r&&t.style?n.style={...e?.style,...t?.style}:n[l]===void 0&&(n[l]=e[l])}return n}const xd=typeof window<"u"?g.useLayoutEffect:g.useEffect;function dot(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function $Z(e,t=0,r=1){return dot(e,t,r)}function pot(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,a)=>a<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function mg(e){if(e.type)return e;if(e.charAt(0)==="#")return mg(pot(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(u2(9,e));let n=e.substring(t+1,e.length-1),a;if(r==="color"){if(n=n.split(" "),a=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(u2(10,a))}else n=n.split(",");return n=n.map(l=>parseFloat(l)),{type:r,values:n,colorSpace:a}}const uot=e=>{const t=mg(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},mb=(e,t)=>{try{return uot(e)}catch{return e}};function Pj(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((a,l)=>l<3?parseInt(a,10):a):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function zke(e){e=mg(e);const{values:t}=e,r=t[0],n=t[1]/100,a=t[2]/100,l=n*Math.min(a,1-a),c=(u,h=(u+r/30)%12)=>a-l*Math.max(Math.min(h-3,9-h,1),-1);let d="rgb";const p=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(d+="a",p.push(t[3])),Pj({type:d,values:p})}function ZW(e){e=mg(e);let t=e.type==="hsl"||e.type==="hsla"?mg(zke(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function hot(e,t){const r=ZW(e),n=ZW(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function jE(e,t){return e=mg(e),t=$Z(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,Pj(e)}function N3(e,t,r){try{return jE(e,t)}catch{return e}}function Dj(e,t){if(e=mg(e),t=$Z(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return Pj(e)}function Pi(e,t,r){try{return Dj(e,t)}catch{return e}}function Tj(e,t){if(e=mg(e),t=$Z(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return Pj(e)}function Di(e,t,r){try{return Tj(e,t)}catch{return e}}function mot(e,t=.15){return ZW(e)>.5?Dj(e,t):Tj(e,t)}function CA(e,t,r){try{return mot(e,t)}catch{return e}}const Rke=g.createContext(null);function kZ(){return g.useContext(Rke)}const got=typeof Symbol=="function"&&Symbol.for,fot=got?Symbol.for("mui.nested"):"__THEME_NESTED__";function xot(e,t){return typeof t=="function"?t(e):{...e,...t}}function yot(e){const{children:t,theme:r}=e,n=kZ(),a=g.useMemo(()=>{const l=n===null?{...r}:xot(n,r);return l!=null&&(l[fot]=n!==null),l},[r,n]);return s.jsx(Rke.Provider,{value:a,children:t})}const Fke=g.createContext();function bot({value:e,...t}){return s.jsx(Fke.Provider,{value:e??!0,...t})}const C9=()=>g.useContext(Fke)??!1,Oke=g.createContext(void 0);function wot({value:e,children:t}){return s.jsx(Oke.Provider,{value:e,children:t})}function vot(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const a=t.components[r];return a.defaultProps?qW(a.defaultProps,n,t.components.mergeClassNameAndStyle):!a.styleOverrides&&!a.variants?qW(a,n,t.components.mergeClassNameAndStyle):n}function Cot({props:e,name:t}){const r=g.useContext(Oke);return vot({props:e,name:t,theme:{components:r}})}let nie=0;function Aot(e){const[t,r]=g.useState(e),n=e||t;return g.useEffect(()=>{t==null&&(nie+=1,r(`mui-${nie}`))},[t]),n}const $ot={...YZe},aie=$ot.useId;function zj(e){if(aie!==void 0){const t=aie();return e??t}return Aot(e)}function kot(e){const t=AZ(),r=zj()||"",{modularCssLayers:n}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!n||t!==null?a="":typeof n=="string"?a=n.replace(/mui(?!\.)/g,a):a=`@layer ${a};`,xd(()=>{const l=document.querySelector("head");if(!l)return;const c=l.firstChild;if(a){if(c&&c.hasAttribute?.("data-mui-layer-order")&&c.getAttribute("data-mui-layer-order")===r)return;const d=document.createElement("style");d.setAttribute("data-mui-layer-order",r),d.textContent=a,l.prepend(d)}else l.querySelector(`style[data-mui-layer-order="${r}"]`)?.remove()},[a,r]),a?s.jsx(Bke,{styles:a}):null}const sie={};function lie(e,t,r,n=!1){return g.useMemo(()=>{const a=e&&t[e]||t;if(typeof r=="function"){const l=r(a),c=e?{...t,[e]:l}:l;return n?()=>c:c}return e?{...t,[e]:r}:{...t,...r}},[e,t,r,n])}function Nke(e){const{children:t,theme:r,themeId:n}=e,a=AZ(sie),l=kZ()||sie,c=lie(n,a,r),d=lie(n,l,r,!0),p=(n?c[n]:c).direction==="rtl",u=kot(c);return s.jsx(yot,{theme:d,children:s.jsx(hke.Provider,{value:c,children:s.jsx(bot,{value:p,children:s.jsxs(wot,{value:n?c[n].components:c.components,children:[u,t]})})})})}const cie={theme:void 0};function Sot(e){let t,r;return function(n){let a=t;return(a===void 0||n.theme!==r)&&(cie.theme=n.theme,a=Dke(e(cie)),t=a,r=n.theme),a}}const SZ="mode",EZ="color-scheme",Eot="data-color-scheme";function Lot(e){const{defaultMode:t="system",defaultLightColorScheme:r="light",defaultDarkColorScheme:n="dark",modeStorageKey:a=SZ,colorSchemeStorageKey:l=EZ,attribute:c=Eot,colorSchemeNode:d="document.documentElement",nonce:p}=e||{};let u="",h=c;if(c==="class"&&(h=".%s"),c==="data"&&(h="[data-%s]"),h.startsWith(".")){const f=h.substring(1);u+=`${d}.classList.remove('${f}'.replace('%s', light), '${f}'.replace('%s', dark));
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/empty-DF_ydwSm.js","assets/sentry-DgKp7-MN.js","assets/empty-DQjL25_q.js","assets/index-Dk9WTrVo.js","assets/index-DFivY-J7.js","assets/zeni-epic-state-BtduplTy.js","assets/core-BEEXg3fp.js","assets/utils-CribULW9.js","assets/recharts-HpqHn9eQ.js","assets/url-CI_52qHn.js","assets/index-B_7K1bnG.js","assets/index-DuHNjO4E.js","assets/url-CmdokR_e.js","assets/index-kkqkQ_HF.js","assets/ScreenRoutes-CU1IwyhO.js","assets/liveblocks--EFJV9Kj.js","assets/analyticsHelper-B8cMMWR4.js","assets/mui-CI8JGWFA.js","assets/SignInScreen-BtppyXZC.js","assets/analytics-ipXwMHc8.js","assets/lottie-B78zgwXs.js","assets/lexical-C8Tv8yGY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as g,R as $,e as YZe,b as P4,p as T0,r as Tc,g as eZ,d as Are,f as KZe,s as $re,w as qZe,i as ZZe,S as JZe,j as XZe,k as eJe,l as tJe,m as oJe}from"./sentry-DgKp7-MN.js";import{j as Co,_ as M$e,a as Cd,u as B$e,T as rJe,C as iJe,b as nJe,c as hj,d as mj,e as aJe,f as sJe,g as P$e,h as lJe,i as cJe,L as dJe,k as kre,l as pJe,m as uJe,n as hJe,P as mJe,o as gJe,p as fJe,q as D$e,r as xJe,s as yJe,I as Sre,t as bJe,v as wJe,w as vJe,x as CJe,y as AJe,z as $Je,A as T$e,B as kJe,D as SJe,E as EJe}from"./liveblocks--EFJV9Kj.js";import{f as z$e,R as o4,r as Fn,P as Dn,u as gj,g as yh,h as LJe,i as tZ,j as IJe,k as jJe,l as mT,N as MJe,m as BJe,n as PJe,B as DJe}from"./core-BEEXg3fp.js";import{H as AE,ba as r4,bb as TJe,bc as Ere,bd as X4,be as xr,bf as R$e,bg as Wr,bh as fj,bi as zJe,bj as Dh,bk as RJe,bl as FJe,bm as S8,bn as hg,bo as b9,bp as F$e,bq as OJe,br as q1,bs as O$e,bt as NJe,bu as oZ,bv as N$e,bw as ln,bx as E8,by as Gu,bz as Lre,bA as HJe,bB as _Je,bC as H$e,bD as NW,bE as VJe,bF as QJe,bG as UJe,bH as WJe,bI as rZ,bJ as _$e,bK as GJe,bL as qb,bM as YJe,bN as V$e,bO as HW,bP as Ire,bQ as jre,bR as Mre,bS as zl,bT as iZ,bU as Q$e,bV as U$e,bW as nZ,bX as w9,bY as xj,bZ as aZ,b_ as sZ,b$ as lZ,c0 as cZ,c1 as KJe,c2 as yj,c3 as sp,c4 as lp,c5 as $E,c6 as W$e,c7 as G$e,c8 as qJe,c9 as dZ,ca as pZ,cb as ZJe,cc as JJe,cd as ep,ce as Dv,cf as Tv,cg as XJe,ch as eXe,ci as tXe,cj as oXe,ck as rXe,cl as iXe,cm as nXe,cn as bA,co as Y$e,cp as K$e,cq as aXe,cr as sXe,cs as q$e,ct as Z$e,cu as lXe,cv as cXe,cw as dXe,cx as J$e,cy as X$e,cz as pXe,cA as uXe,cB as eke,cC as tke,cD as hXe,cE as Bre,cF as mXe,cG as gXe,cH as Iw,cI as fXe,cJ as oke,cK as xXe,cL as rke,cM as yXe,cN as Pre,cO as bXe,cP as ike,cQ as nke,cR as ake,cS as ske,cT as lke,cU as wXe,cV as cke,cW as vXe,cX as CXe,cY as AXe,cZ as dke,c_ as _W,c$ as $Xe,d0 as pke,d1 as uke,d2 as kXe,d3 as SXe,d4 as EXe,d5 as LXe,d6 as IXe,d7 as jXe,d8 as MXe,d9 as BXe,v as PXe,da as bj,db as VW,dc as QW,dd as DXe,de as TXe,df as zXe,dg as RXe,dh as FXe,di as OXe,dj as NXe,dk as HXe,dl as _Xe,dm as VXe,dn as Dre,dp as QXe,dq as UXe,dr as WXe,ds as GXe,dt as YXe}from"./zeni-epic-state-BtduplTy.js";import{T as hke,j as Uo,n as i,c as pe,k as _t,G as zv,C as mke,u as KXe,a as qXe}from"./mui-CI8JGWFA.js";import{r as ZXe,m as Yu}from"./analytics-ipXwMHc8.js";import{L as UW}from"./lottie-B78zgwXs.js";import{r as Ta}from"./lexical-C8Tv8yGY.js";import{E as en,c as wj,P as JXe,R as WW,F as kE,X as gd,Y as fd,G as A2,H as SE,I as vj,J as $2,K as gke,L as XXe,M as eet,N as e5,O as uZ,Q as hZ,S as Rv,U as tet}from"./recharts-HpqHn9eQ.js";import{r as oet}from"./utils-CribULW9.js";(function(){try{var e=typeof window<"u"?window:typeof P4<"u"?P4:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="603381a9-2683-4ecc-ac37-ca34e234ed88",e._sentryDebugIdIdentifier="sentry-dbid-603381a9-2683-4ecc-ac37-ca34e234ed88")}catch{}})();(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function n(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();var wA={},Tre;function ret(){if(Tre)return wA;Tre=1;var e=z$e();return wA.createRoot=e.createRoot,wA.hydrateRoot=e.hydrateRoot,wA}var iet=ret(),wc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof P4<"u"?P4:typeof self<"u"?self:{};function Vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zre={exports:{}},yx={},Rre;function net(){if(Rre)return yx;Rre=1;var e=$,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(d,p,u){var h,m={},f=null,x=null;u!==void 0&&(f=""+u),p.key!==void 0&&(f=""+p.key),p.ref!==void 0&&(x=p.ref);for(h in p)n.call(p,h)&&!l.hasOwnProperty(h)&&(m[h]=p[h]);if(d&&d.defaultProps)for(h in p=d.defaultProps,p)m[h]===void 0&&(m[h]=p[h]);return{$$typeof:t,type:d,key:f,ref:x,props:m,_owner:a.current}}return yx.Fragment=r,yx.jsx=c,yx.jsxs=c,yx}var Fre;function fke(){return Fre||(Fre=1,zre.exports=net()),zre.exports}var s=fke();const aet=g.createContext(null),gT={didCatch:!1,error:null};let set=class extends g.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=gT}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var r,n,a=arguments.length,l=new Array(a),c=0;c<a;c++)l[c]=arguments[c];(r=(n=this.props).onReset)===null||r===void 0||r.call(n,{args:l,reason:"imperative-api"}),this.setState(gT)}}componentDidCatch(t,r){var n,a;(n=(a=this.props).onError)===null||n===void 0||n.call(a,t,r)}componentDidUpdate(t,r){const{didCatch:n}=this.state,{resetKeys:a}=this.props;if(n&&r.error!==null&&cet(t.resetKeys,a)){var l,c;(l=(c=this.props).onReset)===null||l===void 0||l.call(c,{next:a,prev:t.resetKeys,reason:"keys"}),this.setState(gT)}}render(){const{children:t,fallbackRender:r,FallbackComponent:n,fallback:a}=this.props,{didCatch:l,error:c}=this.state;let d=t;if(l){const p={error:c,resetErrorBoundary:this.resetErrorBoundary};if(typeof r=="function")d=r(p);else if(n)d=g.createElement(n,p);else if(a!==void 0)d=a;else throw c}return g.createElement(aet.Provider,{value:{didCatch:l,error:c,resetErrorBoundary:this.resetErrorBoundary}},d)}};function cet(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((r,n)=>!Object.is(r,t[n]))}var GW={exports:{}},det=GW.exports,Ore;function pet(){return Ore||(Ore=1,(function(e){(function(t,r){e.exports?e.exports=r():t.numeral=r()})(det,function(){var t,r,n="2.0.6",a={},l={},c={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},d={currentLocale:c.currentLocale,zeroFormat:c.zeroFormat,nullFormat:c.nullFormat,defaultFormat:c.defaultFormat,scalePercentBy100:c.scalePercentBy100};function p(u,h){this._input=u,this._value=h}return t=function(u){var h,m,f,x;if(t.isNumeral(u))h=u.value();else if(u===0||typeof u>"u")h=0;else if(u===null||r.isNaN(u))h=null;else if(typeof u=="string")if(d.zeroFormat&&u===d.zeroFormat)h=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)h=null;else{for(m in a)if(x=typeof a[m].regexps.unformat=="function"?a[m].regexps.unformat():a[m].regexps.unformat,x&&u.match(x)){f=a[m].unformat;break}f=f||t._.stringToNumber,h=f(u)}else h=Number(u)||null;return new p(u,h)},t.version=n,t.isNumeral=function(u){return u instanceof p},t._=r={numberToFormat:function(u,h,m){var f=l[t.options.currentLocale],x=!1,y=!1,b=0,w="",v=1e12,A=1e9,S=1e6,E=1e3,I="",L=!1,M,D,P,T,z,N,K;if(u=u||0,D=Math.abs(u),t._.includes(h,"(")?(x=!0,h=h.replace(/[\(|\)]/g,"")):(t._.includes(h,"+")||t._.includes(h,"-"))&&(z=t._.includes(h,"+")?h.indexOf("+"):u<0?h.indexOf("-"):-1,h=h.replace(/[\+|\-]/g,"")),t._.includes(h,"a")&&(M=h.match(/a(k|m|b|t)?/),M=M?M[1]:!1,t._.includes(h," a")&&(w=" "),h=h.replace(new RegExp(w+"a[kmbt]?"),""),D>=v&&!M||M==="t"?(w+=f.abbreviations.trillion,u=u/v):D<v&&D>=A&&!M||M==="b"?(w+=f.abbreviations.billion,u=u/A):D<A&&D>=S&&!M||M==="m"?(w+=f.abbreviations.million,u=u/S):(D<S&&D>=E&&!M||M==="k")&&(w+=f.abbreviations.thousand,u=u/E)),t._.includes(h,"[.]")&&(y=!0,h=h.replace("[.]",".")),P=u.toString().split(".")[0],T=h.split(".")[1],N=h.indexOf(","),b=(h.split(".")[0].split(",")[0].match(/0/g)||[]).length,T?(t._.includes(T,"[")?(T=T.replace("]",""),T=T.split("["),I=t._.toFixed(u,T[0].length+T[1].length,m,T[1].length)):I=t._.toFixed(u,T.length,m),P=I.split(".")[0],t._.includes(I,".")?I=f.delimiters.decimal+I.split(".")[1]:I="",y&&Number(I.slice(1))===0&&(I="")):P=t._.toFixed(u,0,m),w&&!M&&Number(P)>=1e3&&w!==f.abbreviations.trillion)switch(P=String(Number(P)/1e3),w){case f.abbreviations.thousand:w=f.abbreviations.million;break;case f.abbreviations.million:w=f.abbreviations.billion;break;case f.abbreviations.billion:w=f.abbreviations.trillion;break}if(t._.includes(P,"-")&&(P=P.slice(1),L=!0),P.length<b)for(var q=b-P.length;q>0;q--)P="0"+P;return N>-1&&(P=P.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),h.indexOf(".")===0&&(P=""),K=P+I+(w||""),x?K=(x&&L?"(":"")+K+(x&&L?")":""):z>=0?K=z===0?(L?"-":"+")+K:K+(L?"-":"+"):L&&(K="-"+K),K},stringToNumber:function(u){var h=l[d.currentLocale],m=u,f={thousand:3,million:6,billion:9,trillion:12},x,y,b;if(d.zeroFormat&&u===d.zeroFormat)y=0;else if(d.nullFormat&&u===d.nullFormat||!u.replace(/[^0-9]+/g,"").length)y=null;else{y=1,h.delimiters.decimal!=="."&&(u=u.replace(/\./g,"").replace(h.delimiters.decimal,"."));for(x in f)if(b=new RegExp("[^a-zA-Z]"+h.abbreviations[x]+"(?:\\)|(\\"+h.currency.symbol+")?(?:\\))?)?$"),m.match(b)){y*=Math.pow(10,f[x]);break}y*=(u.split("-").length+Math.min(u.split("(").length-1,u.split(")").length-1))%2?1:-1,u=u.replace(/[^0-9\.]+/g,""),y*=Number(u)}return y},isNaN:function(u){return typeof u=="number"&&isNaN(u)},includes:function(u,h){return u.indexOf(h)!==-1},insert:function(u,h,m){return u.slice(0,m)+h+u.slice(m)},reduce:function(u,h){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof h!="function")throw new TypeError(h+" is not a function");var m=Object(u),f=m.length>>>0,x=0,y;if(arguments.length===3)y=arguments[2];else{for(;x<f&&!(x in m);)x++;if(x>=f)throw new TypeError("Reduce of empty array with no initial value");y=m[x++]}for(;x<f;x++)x in m&&(y=h(y,m[x],x,m));return y},multiplier:function(u){var h=u.toString().split(".");return h.length<2?1:Math.pow(10,h[1].length)},correctionFactor:function(){var u=Array.prototype.slice.call(arguments);return u.reduce(function(h,m){var f=r.multiplier(m);return h>f?h:f},1)},toFixed:function(u,h,m,f){var x=u.toString().split("."),y=h-(f||0),b,w,v,A;return x.length===2?b=Math.min(Math.max(x[1].length,y),h):b=y,v=Math.pow(10,b),A=(m(u+"e+"+b)/v).toFixed(b),f>h-b&&(w=new RegExp("\\.?0{1,"+(f-(h-b))+"}$"),A=A.replace(w,"")),A}},t.options=d,t.formats=a,t.locales=l,t.locale=function(u){return u&&(d.currentLocale=u.toLowerCase()),d.currentLocale},t.localeData=function(u){if(!u)return l[d.currentLocale];if(u=u.toLowerCase(),!l[u])throw new Error("Unknown locale : "+u);return l[u]},t.reset=function(){for(var u in c)d[u]=c[u]},t.zeroFormat=function(u){d.zeroFormat=typeof u=="string"?u:null},t.nullFormat=function(u){d.nullFormat=typeof u=="string"?u:null},t.defaultFormat=function(u){d.defaultFormat=typeof u=="string"?u:"0.0"},t.register=function(u,h,m){if(h=h.toLowerCase(),this[u+"s"][h])throw new TypeError(h+" "+u+" already registered.");return this[u+"s"][h]=m,m},t.validate=function(u,h){var m,f,x,y,b,w,v,A;if(typeof u!="string"&&(u+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",u)),u=u.trim(),u.match(/^\d+$/))return!0;if(u==="")return!1;try{v=t.localeData(h)}catch{v=t.localeData(t.locale())}return x=v.currency.symbol,b=v.abbreviations,m=v.delimiters.decimal,v.delimiters.thousands==="."?f="\\.":f=v.delimiters.thousands,A=u.match(/^[^\d]+/),A!==null&&(u=u.substr(1),A[0]!==x)||(A=u.match(/[^\d]+$/),A!==null&&(u=u.slice(0,-1),A[0]!==b.thousand&&A[0]!==b.million&&A[0]!==b.billion&&A[0]!==b.trillion))?!1:(w=new RegExp(f+"{2}"),u.match(/[^\d.,]/g)?!1:(y=u.split(m),y.length>2?!1:y.length<2?!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w):y[0].length===1?!!y[0].match(/^\d+$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/):!!y[0].match(/^\d+.*\d$/)&&!y[0].match(w)&&!!y[1].match(/^\d+$/)))},t.fn=p.prototype={clone:function(){return t(this)},format:function(u,h){var m=this._value,f=u||d.defaultFormat,x,y,b;if(h=h||Math.round,m===0&&d.zeroFormat!==null)y=d.zeroFormat;else if(m===null&&d.nullFormat!==null)y=d.nullFormat;else{for(x in a)if(f.match(a[x].regexps.format)){b=a[x].format;break}b=b||t._.numberToFormat,y=b(m,f,h)}return y},value:function(){return this._value},input:function(){return this._input},set:function(u){return this._value=Number(u),this},add:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f+Math.round(h*x)}return this._value=r.reduce([this._value,u],m,0)/h,this},subtract:function(u){var h=r.correctionFactor.call(null,this._value,u);function m(f,x,y,b){return f-Math.round(h*x)}return this._value=r.reduce([u],m,Math.round(this._value*h))/h,this},multiply:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)*Math.round(f*b)/Math.round(b*b)}return this._value=r.reduce([this._value,u],h,1),this},divide:function(u){function h(m,f,x,y){var b=r.correctionFactor(m,f);return Math.round(m*b)/Math.round(f*b)}return this._value=r.reduce([this._value,u],h),this},difference:function(u){return Math.abs(t(this._value).subtract(u).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(u){var h=u%10;return~~(u%100/10)===1?"th":h===1?"st":h===2?"nd":h===3?"rd":"th"},currency:{symbol:"$"}}),(function(){t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(u,h,m){var f=t._.includes(h," BPS")?" ":"",x;return u=u*1e4,h=h.replace(/\s?BPS/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"BPS"),x=x.join("")):x=x+f+"BPS",x},unformat:function(u){return+(t._.stringToNumber(u)*1e-4).toFixed(15)}})})(),(function(){var u={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},h={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},m=u.suffixes.concat(h.suffixes.filter(function(x){return u.suffixes.indexOf(x)<0})),f=m.join("|");f="("+f.replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(x,y,b){var w,v=t._.includes(y,"ib")?h:u,A=t._.includes(y," b")||t._.includes(y," ib")?" ":"",S,E,I;for(y=y.replace(/\s?i?b/,""),S=0;S<=v.suffixes.length;S++)if(E=Math.pow(v.base,S),I=Math.pow(v.base,S+1),x===null||x===0||x>=E&&x<I){A+=v.suffixes[S],E>0&&(x=x/E);break}return w=t._.numberToFormat(x,y,b),w+A},unformat:function(x){var y=t._.stringToNumber(x),b,w;if(y){for(b=u.suffixes.length-1;b>=0;b--){if(t._.includes(x,u.suffixes[b])){w=Math.pow(u.base,b);break}if(t._.includes(x,h.suffixes[b])){w=Math.pow(h.base,b);break}}y*=w||1}return y}})})(),(function(){t.register("format","currency",{regexps:{format:/(\$)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x={before:h.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:h.match(/([\+|\-|\)|\s|\$]*)$/)[0]},y,b,w;for(h=h.replace(/\s?\$\s?/,""),y=t._.numberToFormat(u,h,m),u>=0?(x.before=x.before.replace(/[\-\(]/,""),x.after=x.after.replace(/[\-\)]/,"")):u<0&&!t._.includes(x.before,"-")&&!t._.includes(x.before,"(")&&(x.before="-"+x.before),w=0;w<x.before.length;w++)switch(b=x.before[w],b){case"$":y=t._.insert(y,f.currency.symbol,w);break;case" ":y=t._.insert(y," ",w+f.currency.symbol.length-1);break}for(w=x.after.length-1;w>=0;w--)switch(b=x.after[w],b){case"$":y=w===x.after.length-1?y+f.currency.symbol:t._.insert(y,f.currency.symbol,-(x.after.length-(1+w)));break;case" ":y=w===x.after.length-1?y+" ":t._.insert(y," ",-(x.after.length-(1+w)+f.currency.symbol.length-1));break}return y}})})(),(function(){t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(u,h,m){var f,x=typeof u=="number"&&!t._.isNaN(u)?u.toExponential():"0e+0",y=x.split("e");return h=h.replace(/e[\+|\-]{1}0/,""),f=t._.numberToFormat(Number(y[0]),h,m),f+"e"+y[1]},unformat:function(u){var h=t._.includes(u,"e+")?u.split("e+"):u.split("e-"),m=Number(h[0]),f=Number(h[1]);f=t._.includes(u,"e-")?f*=-1:f;function x(y,b,w,v){var A=t._.correctionFactor(y,b),S=y*A*(b*A)/(A*A);return S}return t._.reduce([m,Math.pow(10,f)],x,1)}})})(),(function(){t.register("format","ordinal",{regexps:{format:/(o)/},format:function(u,h,m){var f=t.locales[t.options.currentLocale],x,y=t._.includes(h," o")?" ":"";return h=h.replace(/\s?o/,""),y+=f.ordinal(u),x=t._.numberToFormat(u,h,m),x+y}})})(),(function(){t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(u,h,m){var f=t._.includes(h," %")?" ":"",x;return t.options.scalePercentBy100&&(u=u*100),h=h.replace(/\s?\%/,""),x=t._.numberToFormat(u,h,m),t._.includes(x,")")?(x=x.split(""),x.splice(-1,0,f+"%"),x=x.join("")):x=x+f+"%",x},unformat:function(u){var h=t._.stringToNumber(u);return t.options.scalePercentBy100?h*.01:h}})})(),(function(){t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(u,h,m){var f=Math.floor(u/60/60),x=Math.floor((u-f*60*60)/60),y=Math.round(u-f*60*60-x*60);return f+":"+(x<10?"0"+x:x)+":"+(y<10?"0"+y:y)},unformat:function(u){var h=u.split(":"),m=0;return h.length===3?(m=m+Number(h[0])*60*60,m=m+Number(h[1])*60,m=m+Number(h[2])):h.length===2&&(m=m+Number(h[0])*60,m=m+Number(h[1])),Number(m)}})})(),t})})(GW)),GW.exports}var uet=pet();const np=Vr(uet);function u2(e,...t){const r=new URL(`https://mui.com/production-error/?code=${e}`);return t.forEach(n=>r.searchParams.append("args[]",n)),`Minified MUI error #${e}; visit ${r} for the full message.`}const s2="$$material";function het(e){for(var t=0,r,n=0,a=e.length;a>=4;++n,a-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(a){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var met={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 get(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var fet=/[A-Z]|^ms/g,xet=/_EMO_([^_]+?)_([^]*?)_EMO_/g,xke=function(e){return e.charCodeAt(1)===45},Nre=function(e){return e!=null&&typeof e!="boolean"},fT=get(function(e){return xke(e)?e:e.replace(fet,"-$&").toLowerCase()}),Hre=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(xet,function(r,n,a){return Qm={name:n,styles:a,next:Qm},n})}return met[e]!==1&&!xke(e)&&typeof t=="number"&&t!==0?t+"px":t};function EE(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var a=r;if(a.anim===1)return Qm={name:a.name,styles:a.styles,next:Qm},a.name;var l=r;if(l.styles!==void 0){var c=l.next;if(c!==void 0)for(;c!==void 0;)Qm={name:c.name,styles:c.styles,next:Qm},c=c.next;var d=l.styles+";";return d}return yet(e,t,r)}}var p=r;return p}function yet(e,t,r){var n="";if(Array.isArray(r))for(var a=0;a<r.length;a++)n+=EE(e,t,r[a])+";";else for(var l in r){var c=r[l];if(typeof c!="object"){var d=c;Nre(d)&&(n+=fT(l)+":"+Hre(l,d)+";")}else if(Array.isArray(c)&&typeof c[0]=="string"&&t==null)for(var p=0;p<c.length;p++)Nre(c[p])&&(n+=fT(l)+":"+Hre(l,c[p])+";");else{var u=EE(e,t,c);switch(l){case"animation":case"animationName":{n+=fT(l)+":"+u+";";break}default:n+=l+"{"+u+"}"}}}return n}var _re=/label:\s*([^\s;{]+)\s*(;|$)/g,Qm;function bet(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,a="";Qm=void 0;var l=e[0];if(l==null||l.raw===void 0)n=!1,a+=EE(r,t,l);else{var c=l;a+=c[0]}for(var d=1;d<e.length;d++)if(a+=EE(r,t,e[d]),n){var p=l;a+=p[d]}_re.lastIndex=0;for(var u="",h;(h=_re.exec(a))!==null;)u+="-"+h[1];var m=het(a)+u;return{name:m,styles:a,next:Qm}}var xT={exports:{}},yT,Vre;function wet(){if(Vre)return yT;Vre=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return yT=e,yT}var bT,Qre;function vet(){if(Qre)return bT;Qre=1;var e=wet();function t(){}function r(){}return r.resetWarningCache=t,bT=function(){function n(c,d,p,u,h,m){if(m!==e){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}}n.isRequired=n;function a(){return n}var l={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:t};return l.PropTypes=l,l},bT}var Ure;function mZ(){return Ure||(Ure=1,xT.exports=vet()()),xT.exports}var Cet=mZ();const Nt=Vr(Cet);function Aet(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 $et(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 ket=(function(){function e(r){var n=this;this._insertTag=function(a){var l;n.tags.length===0?n.insertionPoint?l=n.insertionPoint.nextSibling:n.prepend?l=n.container.firstChild:l=n.before:l=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(a,l),n.tags.push(a)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag($et(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var a=Aet(n);try{a.insertRule(r,a.cssRules.length)}catch{}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e})(),ol="-ms-",LE="-moz-",ki="-webkit-",yke="comm",gZ="rule",fZ="decl",Eet="@import",bke="@keyframes",Let="@layer",Iet=Math.abs,Cj=String.fromCharCode,jet=Object.assign;function Met(e,t){return zs(e,0)^45?(((t<<2^zs(e,0))<<2^zs(e,1))<<2^zs(e,2))<<2^zs(e,3):0}function wke(e){return e.trim()}function Bet(e,t){return(e=t.exec(e))?e[0]:e}function Si(e,t,r){return e.replace(t,r)}function YW(e,t){return e.indexOf(t)}function zs(e,t){return e.charCodeAt(t)|0}function jw(e,t,r){return e.slice(t,r)}function Ku(e){return e.length}function xZ(e){return e.length}function vA(e,t){return t.push(e),e}function Pet(e,t){return e.map(t).join("")}var Aj=1,L8=1,vke=0,jc=0,Ia=0,v9="";function $j(e,t,r,n,a,l,c){return{value:e,root:t,parent:r,type:n,props:a,children:l,line:Aj,column:L8,length:c,return:""}}function bx(e,t){return jet($j("",null,null,"",null,null,0),e,{length:-e.length},t)}function Det(){return Ia}function Tet(){return Ia=jc>0?zs(v9,--jc):0,L8--,Ia===10&&(L8=1,Aj--),Ia}function ud(){return Ia=jc<vke?zs(v9,jc++):0,L8++,Ia===10&&(L8=1,Aj++),Ia}function kh(){return zs(v9,jc)}function NS(){return jc}function Fv(e,t){return jw(v9,e,t)}function Mw(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Cke(e){return Aj=L8=1,vke=Ku(v9=e),jc=0,[]}function Ake(e){return v9="",e}function HS(e){return wke(Fv(jc-1,KW(e===91?e+2:e===40?e+1:e)))}function zet(e){for(;(Ia=kh())&&Ia<33;)ud();return Mw(e)>2||Mw(Ia)>3?"":" "}function Ret(e,t){for(;--t&&ud()&&!(Ia<48||Ia>102||Ia>57&&Ia<65||Ia>70&&Ia<97););return Fv(e,NS()+(t<6&&kh()==32&&ud()==32))}function KW(e){for(;ud();)switch(Ia){case e:return jc;case 34:case 39:e!==34&&e!==39&&KW(Ia);break;case 40:e===41&&KW(e);break;case 92:ud();break}return jc}function Fet(e,t){for(;ud()&&e+Ia!==57&&!(e+Ia===84&&kh()===47););return"/*"+Fv(t,jc-1)+"*"+Cj(e===47?e:ud())}function Oet(e){for(;!Mw(kh());)ud();return Fv(e,jc)}function Net(e){return Ake(_S("",null,null,null,[""],e=Cke(e),0,[0],e))}function _S(e,t,r,n,a,l,c,d,p){for(var u=0,h=0,m=c,f=0,x=0,y=0,b=1,w=1,v=1,A=0,S="",E=a,I=l,L=n,M=S;w;)switch(y=A,A=ud()){case 40:if(y!=108&&zs(M,m-1)==58){YW(M+=Si(HS(A),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:M+=HS(A);break;case 9:case 10:case 13:case 32:M+=zet(y);break;case 92:M+=Ret(NS()-1,7);continue;case 47:switch(kh()){case 42:case 47:vA(Het(Fet(ud(),NS()),t,r),p);break;default:M+="/"}break;case 123*b:d[u++]=Ku(M)*v;case 125*b:case 59:case 0:switch(A){case 0:case 125:w=0;case 59+h:v==-1&&(M=Si(M,/\f/g,"")),x>0&&Ku(M)-m&&vA(x>32?Gre(M+";",n,r,m-1):Gre(Si(M," ","")+";",n,r,m-2),p);break;case 59:M+=";";default:if(vA(L=Wre(M,t,r,u,h,a,d,S,E=[],I=[],m),l),A===123)if(h===0)_S(M,t,L,L,E,l,m,d,I);else switch(f===99&&zs(M,3)===110?100:f){case 100:case 108:case 109:case 115:_S(e,L,L,n&&vA(Wre(e,L,L,0,0,a,d,S,a,E=[],m),I),a,I,m,d,n?E:I);break;default:_S(M,L,L,L,[""],I,0,d,I)}}u=h=x=0,b=v=1,S=M="",m=c;break;case 58:m=1+Ku(M),x=y;default:if(b<1){if(A==123)--b;else if(A==125&&b++==0&&Tet()==125)continue}switch(M+=Cj(A),A*b){case 38:v=h>0?1:(M+="\f",-1);break;case 44:d[u++]=(Ku(M)-1)*v,v=1;break;case 64:kh()===45&&(M+=HS(ud())),f=kh(),h=m=Ku(S=M+=Oet(NS())),A++;break;case 45:y===45&&Ku(M)==2&&(b=0)}}return l}function Wre(e,t,r,n,a,l,c,d,p,u,h){for(var m=a-1,f=a===0?l:[""],x=xZ(f),y=0,b=0,w=0;y<n;++y)for(var v=0,A=jw(e,m+1,m=Iet(b=c[y])),S=e;v<x;++v)(S=wke(b>0?f[v]+" "+A:Si(A,/&\f/g,f[v])))&&(p[w++]=S);return $j(e,t,r,a===0?gZ:d,p,u,h)}function Het(e,t,r){return $j(e,t,r,yke,Cj(Det()),jw(e,2,-2),0)}function Gre(e,t,r,n){return $j(e,t,r,fZ,jw(e,0,n),jw(e,n+1,-1),n)}function r8(e,t){for(var r="",n=xZ(e),a=0;a<n;a++)r+=t(e[a],a,e,t)||"";return r}function _et(e,t,r,n){switch(e.type){case Let:if(e.children.length)break;case Eet:case fZ:return e.return=e.return||e.value;case yke:return"";case bke:return e.return=e.value+"{"+r8(e.children,n)+"}";case gZ:e.value=e.props.join(",")}return Ku(r=r8(e.children,n))?e.return=e.value+"{"+r+"}":""}function Vet(e){var t=xZ(e);return function(r,n,a,l){for(var c="",d=0;d<t;d++)c+=e[d](r,n,a,l)||"";return c}}function Qet(e){return function(t){t.root||(t=t.return)&&e(t)}}var Uet=function(e,t,r){for(var n=0,a=0;n=a,a=kh(),n===38&&a===12&&(t[r]=1),!Mw(a);)ud();return Fv(e,jc)},Wet=function(e,t){var r=-1,n=44;do switch(Mw(n)){case 0:n===38&&kh()===12&&(t[r]=1),e[r]+=Uet(jc-1,t,r);break;case 2:e[r]+=HS(n);break;case 4:if(n===44){e[++r]=kh()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Cj(n)}while(n=ud());return e},Get=function(e,t){return Ake(Wet(Cke(e),t))},Yre=new WeakMap,Yet=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!Yre.get(r))&&!n){Yre.set(e,!0);for(var a=[],l=Get(t,a),c=r.props,d=0,p=0;d<l.length;d++)for(var u=0;u<c.length;u++,p++)e.props[p]=a[d]?l[d].replace(/&\f/g,c[u]):c[u]+" "+l[d]}}},Ket=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function $ke(e,t){switch(Met(e,t)){case 5103:return ki+"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 ki+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ki+e+LE+e+ol+e+e;case 6828:case 4268:return ki+e+ol+e+e;case 6165:return ki+e+ol+"flex-"+e+e;case 5187:return ki+e+Si(e,/(\w+).+(:[^]+)/,ki+"box-$1$2"+ol+"flex-$1$2")+e;case 5443:return ki+e+ol+"flex-item-"+Si(e,/flex-|-self/,"")+e;case 4675:return ki+e+ol+"flex-line-pack"+Si(e,/align-content|flex-|-self/,"")+e;case 5548:return ki+e+ol+Si(e,"shrink","negative")+e;case 5292:return ki+e+ol+Si(e,"basis","preferred-size")+e;case 6060:return ki+"box-"+Si(e,"-grow","")+ki+e+ol+Si(e,"grow","positive")+e;case 4554:return ki+Si(e,/([^-])(transform)/g,"$1"+ki+"$2")+e;case 6187:return Si(Si(Si(e,/(zoom-|grab)/,ki+"$1"),/(image-set)/,ki+"$1"),e,"")+e;case 5495:case 3959:return Si(e,/(image-set\([^]*)/,ki+"$1$`$1");case 4968:return Si(Si(e,/(.+:)(flex-)?(.*)/,ki+"box-pack:$3"+ol+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ki+e+e;case 4095:case 3583:case 4068:case 2532:return Si(e,/(.+)-inline(.+)/,ki+"$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(zs(e,t+1)){case 109:if(zs(e,t+4)!==45)break;case 102:return Si(e,/(.+:)(.+)-([^]+)/,"$1"+ki+"$2-$3$1"+LE+(zs(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~YW(e,"stretch")?$ke(Si(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(zs(e,t+1)!==115)break;case 6444:switch(zs(e,Ku(e)-3-(~YW(e,"!important")&&10))){case 107:return Si(e,":",":"+ki)+e;case 101:return Si(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ki+(zs(e,14)===45?"inline-":"")+"box$3$1"+ki+"$2$3$1"+ol+"$2box$3")+e}break;case 5936:switch(zs(e,t+11)){case 114:return ki+e+ol+Si(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ki+e+ol+Si(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ki+e+ol+Si(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ki+e+ol+e+e}return e}var qet=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case fZ:e.return=$ke(e.value,e.length);break;case bke:return r8([bx(e,{value:Si(e.value,"@","@"+ki)})],n);case gZ:if(e.length)return Pet(e.props,function(a){switch(Bet(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return r8([bx(e,{props:[Si(a,/:(read-\w+)/,":"+LE+"$1")]})],n);case"::placeholder":return r8([bx(e,{props:[Si(a,/:(plac\w+)/,":"+ki+"input-$1")]}),bx(e,{props:[Si(a,/:(plac\w+)/,":"+LE+"$1")]}),bx(e,{props:[Si(a,/:(plac\w+)/,ol+"input-$1")]})],n)}return""})}},Zet=[qet],kke=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(y){var b=y.getAttribute("data-emotion");b.indexOf(" ")!==-1&&(document.head.appendChild(y),y.setAttribute("data-s",""))})}var n=e.stylisPlugins||Zet,a={},l,c=[];l=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(y){for(var b=y.getAttribute("data-emotion").split(" "),w=1;w<b.length;w++)a[b[w]]=!0;c.push(y)});var d,p=[Yet,Ket];{var u,h=[_et,Qet(function(y){u.insert(y)})],m=Vet(p.concat(n,h)),f=function(y){return r8(Net(y),m)};d=function(y,b,w,v){u=w,f(y?y+"{"+b.styles+"}":b.styles),v&&(x.inserted[b.name]=!0)}}var x={key:t,sheet:new ket({key:t,container:l,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:a,registered:{},insert:d};return x.sheet.hydrate(c),x};function Jet(e){return e==null||Object.keys(e).length===0}function Ske(e){const{styles:t,defaultTheme:r={}}=e,n=typeof t=="function"?a=>t(Jet(a)?r:a):t;return s.jsx(zv,{styles:n})}function Xet(e,t){return i(e,t)}function ett(e,t){Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}const Kre=[];function rg(e){return Kre[0]=e,bet(Kre)}var qre={exports:{}},Qi={},Zre;function ttt(){if(Zre)return Qi;Zre=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.view_transition"),x=Symbol.for("react.client.reference");function y(b){if(typeof b=="object"&&b!==null){var w=b.$$typeof;switch(w){case e:switch(b=b.type,b){case r:case a:case n:case p:case u:case f:return b;default:switch(b=b&&b.$$typeof,b){case c:case d:case m:case h:return b;case l:return b;default:return w}}case t:return w}}}return Qi.ContextConsumer=l,Qi.ContextProvider=c,Qi.Element=e,Qi.ForwardRef=d,Qi.Fragment=r,Qi.Lazy=m,Qi.Memo=h,Qi.Portal=t,Qi.Profiler=a,Qi.StrictMode=n,Qi.Suspense=p,Qi.SuspenseList=u,Qi.isContextConsumer=function(b){return y(b)===l},Qi.isContextProvider=function(b){return y(b)===c},Qi.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===e},Qi.isForwardRef=function(b){return y(b)===d},Qi.isFragment=function(b){return y(b)===r},Qi.isLazy=function(b){return y(b)===m},Qi.isMemo=function(b){return y(b)===h},Qi.isPortal=function(b){return y(b)===t},Qi.isProfiler=function(b){return y(b)===a},Qi.isStrictMode=function(b){return y(b)===n},Qi.isSuspense=function(b){return y(b)===p},Qi.isSuspenseList=function(b){return y(b)===u},Qi.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===a||b===n||b===p||b===u||typeof b=="object"&&b!==null&&(b.$$typeof===m||b.$$typeof===h||b.$$typeof===c||b.$$typeof===l||b.$$typeof===d||b.$$typeof===x||b.getModuleId!==void 0)},Qi.typeOf=y,Qi}var Jre;function ott(){return Jre||(Jre=1,qre.exports=ttt()),qre.exports}var Eke=ott();function U0(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 Lke(e){if(g.isValidElement(e)||Eke.isValidElementType(e)||!U0(e))return e;const t={};return Object.keys(e).forEach(r=>{t[r]=Lke(e[r])}),t}function ml(e,t,r={clone:!0}){const n=r.clone?{...e}:e;return U0(e)&&U0(t)&&Object.keys(t).forEach(a=>{g.isValidElement(t[a])||Eke.isValidElementType(t[a])?n[a]=t[a]:U0(t[a])&&Object.prototype.hasOwnProperty.call(e,a)&&U0(e[a])?n[a]=ml(e[a],t[a],r):r.clone?n[a]=U0(t[a])?Lke(t[a]):t[a]:n[a]=t[a]}),n}const rtt=e=>{const t=Object.keys(e).map(r=>({key:r,val:e[r]}))||[];return t.sort((r,n)=>r.val-n.val),t.reduce((r,n)=>({...r,[n.key]:n.val}),{})};function itt(e){const{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5,...a}=e,l=rtt(t),c=Object.keys(l);function d(f){return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r})`}function p(f){return`@media (max-width:${(typeof t[f]=="number"?t[f]:f)-n/100}${r})`}function u(f,x){const y=c.indexOf(x);return`@media (min-width:${typeof t[f]=="number"?t[f]:f}${r}) and (max-width:${(y!==-1&&typeof t[c[y]]=="number"?t[c[y]]:x)-n/100}${r})`}function h(f){return c.indexOf(f)+1<c.length?u(f,c[c.indexOf(f)+1]):d(f)}function m(f){const x=c.indexOf(f);return x===0?d(c[1]):x===c.length-1?p(c[x]):u(f,c[c.indexOf(f)+1]).replace("@media","@media not all and")}return{keys:c,values:l,up:d,down:p,between:u,only:h,not:m,unit:r,...a}}function Xre(e,t){if(!e.containerQueries)return t;const r=Object.keys(t).filter(n=>n.startsWith("@container")).sort((n,a)=>{const l=/min-width:\s*([0-9.]+)/;return+(n.match(l)?.[1]||0)-+(a.match(l)?.[1]||0)});return r.length?r.reduce((n,a)=>{const l=t[a];return delete n[a],n[a]=l,n},{...t}):t}function ntt(e,t){return t==="@"||t.startsWith("@")&&(e.some(r=>t.startsWith(`@${r}`))||!!t.match(/^@\d/))}function att(e,t){const r=t.match(/^@([^/]+)?\/?(.+)?$/);if(!r)return null;const[,n,a]=r,l=Number.isNaN(+n)?n||0:+n;return e.containerQueries(a).up(l)}function stt(e){const t=(l,c)=>l.replace("@media",c?`@container ${c}`:"@container");function r(l,c){l.up=(...d)=>t(e.breakpoints.up(...d),c),l.down=(...d)=>t(e.breakpoints.down(...d),c),l.between=(...d)=>t(e.breakpoints.between(...d),c),l.only=(...d)=>t(e.breakpoints.only(...d),c),l.not=(...d)=>{const p=t(e.breakpoints.not(...d),c);return p.includes("not all and")?p.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):p}}const n={},a=l=>(r(n,l),n);return r(a),{...e,containerQueries:a}}const ltt={borderRadius:4};function Zb(e,t){return t?ml(e,t,{clone:!1}):e}const kj={xs:0,sm:600,md:900,lg:1200,xl:1536},eie={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${kj[e]}px)`},ctt={containerQueries:e=>({up:t=>{let r=typeof t=="number"?t:kj[t]||t;return typeof r=="number"&&(r=`${r}px`),e?`@container ${e} (min-width:${r})`:`@container (min-width:${r})`}})};function h2(e,t,r){const n=e.theme||{};if(Array.isArray(t)){const a=n.breakpoints||eie;return t.reduce((l,c,d)=>(l[a.up(a.keys[d])]=r(t[d]),l),{})}if(typeof t=="object"){const a=n.breakpoints||eie;return Object.keys(t).reduce((l,c)=>{if(ntt(a.keys,c)){const d=att(n.containerQueries?n:ctt,c);d&&(l[d]=r(t[c],c))}else if(Object.keys(a.values||kj).includes(c)){const d=a.up(c);l[d]=r(t[c],c)}else{const d=c;l[d]=t[d]}return l},{})}return r(t)}function dtt(e={}){return e.keys?.reduce((t,r)=>{const n=e.up(r);return t[n]={},t},{})||{}}function tie(e,t){return e.reduce((r,n)=>{const a=r[n];return(!a||Object.keys(a).length===0)&&delete r[n],r},t)}function mr(e){if(typeof e!="string")throw new Error(u2(7));return e.charAt(0).toUpperCase()+e.slice(1)}function Sj(e,t,r=!0){if(!t||typeof t!="string")return null;if(e&&e.vars&&r){const n=`vars.${t}`.split(".").reduce((a,l)=>a&&a[l]?a[l]:null,e);if(n!=null)return n}return t.split(".").reduce((n,a)=>n&&n[a]!=null?n[a]:null,e)}function IE(e,t,r,n=r){let a;return typeof e=="function"?a=e(r):Array.isArray(e)?a=e[r]||n:a=Sj(e,r)||n,t&&(a=t(a,n,e)),a}function ha(e){const{prop:t,cssProperty:r=e.prop,themeKey:n,transform:a}=e,l=c=>{if(c[t]==null)return null;const d=c[t],p=c.theme,u=Sj(p,n)||{};return h2(c,d,h=>{let m=IE(u,a,h);return h===m&&typeof h=="string"&&(m=IE(u,a,`${t}${h==="default"?"":mr(h)}`,h)),r===!1?m:{[r]:m}})};return l.propTypes={},l.filterProps=[t],l}function ptt(e){const t={};return r=>(t[r]===void 0&&(t[r]=e(r)),t[r])}const utt={m:"margin",p:"padding"},htt={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},oie={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},mtt=ptt(e=>{if(e.length>2)if(oie[e])e=oie[e];else return[e];const[t,r]=e.split(""),n=utt[t],a=htt[r]||"";return Array.isArray(a)?a.map(l=>n+l):[n+a]}),yZ=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],bZ=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...yZ,...bZ];function Ov(e,t,r,n){const a=Sj(e,t,!0)??r;return typeof a=="number"||typeof a=="string"?l=>typeof l=="string"?l:typeof a=="string"?a.startsWith("var(")&&l===0?0:a.startsWith("var(")&&l===1?a:`calc(${l} * ${a})`:a*l:Array.isArray(a)?l=>{if(typeof l=="string")return l;const c=Math.abs(l),d=a[c];return l>=0?d:typeof d=="number"?-d:typeof d=="string"&&d.startsWith("var(")?`calc(-1 * ${d})`:`-${d}`}:typeof a=="function"?a:(()=>{})}function wZ(e){return Ov(e,"spacing",8)}function Nv(e,t){return typeof t=="string"||t==null?t:e(t)}function gtt(e,t){return r=>e.reduce((n,a)=>(n[a]=Nv(t,r),n),{})}function ftt(e,t,r,n){if(!t.includes(r))return null;const a=mtt(r),l=gtt(a,n),c=e[r];return h2(e,c,l)}function Ike(e,t){const r=wZ(e.theme);return Object.keys(e).map(n=>ftt(e,t,n,r)).reduce(Zb,{})}function Hn(e){return Ike(e,yZ)}Hn.propTypes={};Hn.filterProps=yZ;function _n(e){return Ike(e,bZ)}_n.propTypes={};_n.filterProps=bZ;function jke(e=8,t=wZ({spacing:e})){if(e.mui)return e;const r=(...n)=>(n.length===0?[1]:n).map(a=>{const l=t(a);return typeof l=="number"?`${l}px`:l}).join(" ");return r.mui=!0,r}function Ej(...e){const t=e.reduce((n,a)=>(a.filterProps.forEach(l=>{n[l]=a}),n),{}),r=n=>Object.keys(n).reduce((a,l)=>t[l]?Zb(a,t[l](n)):a,{});return r.propTypes={},r.filterProps=e.reduce((n,a)=>n.concat(a.filterProps),[]),r}function Gd(e){return typeof e!="number"?e:`${e}px solid`}function g1(e,t){return ha({prop:e,themeKey:"borders",transform:t})}const xtt=g1("border",Gd),ytt=g1("borderTop",Gd),btt=g1("borderRight",Gd),wtt=g1("borderBottom",Gd),vtt=g1("borderLeft",Gd),Ctt=g1("borderColor"),Att=g1("borderTopColor"),$tt=g1("borderRightColor"),ktt=g1("borderBottomColor"),Stt=g1("borderLeftColor"),Ett=g1("outline",Gd),Ltt=g1("outlineColor"),Lj=e=>{if(e.borderRadius!==void 0&&e.borderRadius!==null){const t=Ov(e.theme,"shape.borderRadius",4),r=n=>({borderRadius:Nv(t,n)});return h2(e,e.borderRadius,r)}return null};Lj.propTypes={};Lj.filterProps=["borderRadius"];Ej(xtt,ytt,btt,wtt,vtt,Ctt,Att,$tt,ktt,Stt,Lj,Ett,Ltt);const Ij=e=>{if(e.gap!==void 0&&e.gap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({gap:Nv(t,n)});return h2(e,e.gap,r)}return null};Ij.propTypes={};Ij.filterProps=["gap"];const jj=e=>{if(e.columnGap!==void 0&&e.columnGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({columnGap:Nv(t,n)});return h2(e,e.columnGap,r)}return null};jj.propTypes={};jj.filterProps=["columnGap"];const Mj=e=>{if(e.rowGap!==void 0&&e.rowGap!==null){const t=Ov(e.theme,"spacing",8),r=n=>({rowGap:Nv(t,n)});return h2(e,e.rowGap,r)}return null};Mj.propTypes={};Mj.filterProps=["rowGap"];const Itt=ha({prop:"gridColumn"}),jtt=ha({prop:"gridRow"}),Mtt=ha({prop:"gridAutoFlow"}),Btt=ha({prop:"gridAutoColumns"}),Ptt=ha({prop:"gridAutoRows"}),Dtt=ha({prop:"gridTemplateColumns"}),Ttt=ha({prop:"gridTemplateRows"}),ztt=ha({prop:"gridTemplateAreas"}),Rtt=ha({prop:"gridArea"});Ej(Ij,jj,Mj,Itt,jtt,Mtt,Btt,Ptt,Dtt,Ttt,ztt,Rtt);function i8(e,t){return t==="grey"?t:e}const Ftt=ha({prop:"color",themeKey:"palette",transform:i8}),Ott=ha({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:i8}),Ntt=ha({prop:"backgroundColor",themeKey:"palette",transform:i8});Ej(Ftt,Ott,Ntt);function nd(e){return e<=1&&e!==0?`${e*100}%`:e}const Htt=ha({prop:"width",transform:nd}),vZ=e=>{if(e.maxWidth!==void 0&&e.maxWidth!==null){const t=r=>{const n=e.theme?.breakpoints?.values?.[r]||kj[r];return n?e.theme?.breakpoints?.unit!=="px"?{maxWidth:`${n}${e.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:nd(r)}};return h2(e,e.maxWidth,t)}return null};vZ.filterProps=["maxWidth"];const _tt=ha({prop:"minWidth",transform:nd}),Vtt=ha({prop:"height",transform:nd}),Qtt=ha({prop:"maxHeight",transform:nd}),Utt=ha({prop:"minHeight",transform:nd});ha({prop:"size",cssProperty:"width",transform:nd});ha({prop:"size",cssProperty:"height",transform:nd});const Wtt=ha({prop:"boxSizing"});Ej(Htt,vZ,_tt,Vtt,Qtt,Utt,Wtt);const Bj={border:{themeKey:"borders",transform:Gd},borderTop:{themeKey:"borders",transform:Gd},borderRight:{themeKey:"borders",transform:Gd},borderBottom:{themeKey:"borders",transform:Gd},borderLeft:{themeKey:"borders",transform:Gd},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:Gd},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Lj},color:{themeKey:"palette",transform:i8},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:i8},backgroundColor:{themeKey:"palette",transform:i8},p:{style:_n},pt:{style:_n},pr:{style:_n},pb:{style:_n},pl:{style:_n},px:{style:_n},py:{style:_n},padding:{style:_n},paddingTop:{style:_n},paddingRight:{style:_n},paddingBottom:{style:_n},paddingLeft:{style:_n},paddingX:{style:_n},paddingY:{style:_n},paddingInline:{style:_n},paddingInlineStart:{style:_n},paddingInlineEnd:{style:_n},paddingBlock:{style:_n},paddingBlockStart:{style:_n},paddingBlockEnd:{style:_n},m:{style:Hn},mt:{style:Hn},mr:{style:Hn},mb:{style:Hn},ml:{style:Hn},mx:{style:Hn},my:{style:Hn},margin:{style:Hn},marginTop:{style:Hn},marginRight:{style:Hn},marginBottom:{style:Hn},marginLeft:{style:Hn},marginX:{style:Hn},marginY:{style:Hn},marginInline:{style:Hn},marginInlineStart:{style:Hn},marginInlineEnd:{style:Hn},marginBlock:{style:Hn},marginBlockStart:{style:Hn},marginBlockEnd:{style:Hn},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:Ij},rowGap:{style:Mj},columnGap:{style:jj},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:nd},maxWidth:{style:vZ},minWidth:{transform:nd},height:{transform:nd},maxHeight:{transform:nd},minHeight:{transform:nd},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 Gtt(...e){const t=e.reduce((n,a)=>n.concat(Object.keys(a)),[]),r=new Set(t);return e.every(n=>r.size===Object.keys(n).length)}function Ytt(e,t){return typeof e=="function"?e(t):e}function Ktt(){function e(r,n,a,l){const c={[r]:n,theme:a},d=l[r];if(!d)return{[r]:n};const{cssProperty:p=r,themeKey:u,transform:h,style:m}=d;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[r]:n};const f=Sj(a,u)||{};return m?m(c):h2(c,n,x=>{let y=IE(f,h,x);return x===y&&typeof x=="string"&&(y=IE(f,h,`${r}${x==="default"?"":mr(x)}`,x)),p===!1?y:{[p]:y}})}function t(r){const{sx:n,theme:a={},nested:l}=r||{};if(!n)return null;const c=a.unstable_sxConfig??Bj;function d(p){let u=p;if(typeof p=="function")u=p(a);else if(typeof p!="object")return p;if(!u)return null;const h=dtt(a.breakpoints),m=Object.keys(h);let f=h;return Object.keys(u).forEach(x=>{const y=Ytt(u[x],a);if(y!=null)if(typeof y=="object")if(c[x])f=Zb(f,e(x,y,a,c));else{const b=h2({theme:a},y,w=>({[x]:w}));Gtt(b,y)?f[x]=t({sx:y,theme:a,nested:!0}):f=Zb(f,b)}else f=Zb(f,e(x,y,a,c))}),!l&&a.modularCssLayers?{"@layer sx":Xre(a,tie(m,f))}:Xre(a,tie(m,f))}return Array.isArray(n)?n.map(d):d(n)}return t}const D4=Ktt();D4.filterProps=["sx"];function qtt(e,t){const r=this;if(r.vars){if(!r.colorSchemes?.[e]||typeof r.getColorSchemeSelector!="function")return{};let n=r.getColorSchemeSelector(e);return n==="&"?t:((n.includes("data-")||n.includes("."))&&(n=`*:where(${n.replace(/\s*&$/,"")}) &`),{[n]:t})}return r.palette.mode===e?t:{}}function CZ(e={},...t){const{breakpoints:r={},palette:n={},spacing:a,shape:l={},...c}=e,d=itt(r),p=jke(a);let u=ml({breakpoints:d,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:p,shape:{...ltt,...l}},c);return u=stt(u),u.applyStyles=qtt,u=t.reduce((h,m)=>ml(h,m),u),u.unstable_sxConfig={...Bj,...c?.unstable_sxConfig},u.unstable_sx=function(h){return D4({sx:h,theme:this})},u}function Ztt(e){return Object.keys(e).length===0}function AZ(e=null){const t=g.useContext(hke);return!t||Ztt(t)?e:t}const Jtt=CZ();function Mke(e=Jtt){return AZ(e)}function rie(e){const t=rg(e);return e!==t&&t.styles?(t.styles.match(/^@layer\s+[^{]*$/)||(t.styles=`@layer global{${t.styles}}`),t):e}function Bke({styles:e,themeId:t,defaultTheme:r={}}){const n=Mke(r),a=t&&n[t]||n;let l=typeof e=="function"?e(a):e;return a.modularCssLayers&&(Array.isArray(l)?l=l.map(c=>rie(typeof c=="function"?c(a):c)):l=rie(l)),s.jsx(Ske,{styles:l})}const iie=e=>e,Xtt=()=>{let e=iie;return{configure(t){e=t},generate(t){return e(t)},reset(){e=iie}}},eot=Xtt();function Pke(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=Pke(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function Ko(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=Pke(e))&&(n&&(n+=" "),n+=t);return n}const tot={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 Ci(e,t,r="Mui"){const n=tot[t];return n?`${r}-${n}`:`${eot.generate(e)}-${t}`}function ci(e,t,r="Mui"){const n={};return t.forEach(a=>{n[a]=Ci(e,a,r)}),n}function Dke(e){const{variants:t,...r}=e,n={variants:t,style:rg(r),isProcessed:!0};return n.style===r||t&&t.forEach(a=>{typeof a.style!="function"&&(a.style=rg(a.style))}),n}const oot=CZ();function wT(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}function i4(e,t){return t&&e&&typeof e=="object"&&e.styles&&!e.styles.startsWith("@layer")&&(e.styles=`@layer ${t}{${String(e.styles)}}`),e}function rot(e){return e?(t,r)=>r[e]:null}function iot(e,t,r){e.theme=sot(e.theme)?r:e.theme[t]||e.theme}function VS(e,t,r){const n=typeof t=="function"?t(e):t;if(Array.isArray(n))return n.flatMap(a=>VS(e,a,r));if(Array.isArray(n?.variants)){let a;if(n.isProcessed)a=r?i4(n.style,r):n.style;else{const{variants:l,...c}=n;a=r?i4(rg(c),r):c}return Tke(e,n.variants,[a],r)}return n?.isProcessed?r?i4(rg(n.style),r):n.style:r?i4(rg(n),r):n}function Tke(e,t,r=[],n=void 0){let a;e:for(let l=0;l<t.length;l+=1){const c=t[l];if(typeof c.props=="function"){if(a??={...e,...e.ownerState,ownerState:e.ownerState},!c.props(a))continue}else for(const d in c.props)if(e[d]!==c.props[d]&&e.ownerState?.[d]!==c.props[d])continue e;typeof c.style=="function"?(a??={...e,...e.ownerState,ownerState:e.ownerState},r.push(n?i4(rg(c.style(a)),n):c.style(a))):r.push(n?i4(rg(c.style),n):c.style)}return r}function not(e={}){const{themeId:t,defaultTheme:r=oot,rootShouldForwardProp:n=wT,slotShouldForwardProp:a=wT}=e;function l(c){iot(c,t,r)}return(c,d={})=>{ett(c,I=>I.filter(L=>L!==D4));const{name:p,slot:u,skipVariantsResolver:h,skipSx:m,overridesResolver:f=rot(cot(u)),...x}=d,y=p&&p.startsWith("Mui")||u?"components":"custom",b=h!==void 0?h:u&&u!=="Root"&&u!=="root"||!1,w=m||!1;let v=wT;u==="Root"||u==="root"?v=n:u?v=a:lot(c)&&(v=void 0);const A=Xet(c,{shouldForwardProp:v,label:aot(),...x}),S=I=>{if(I.__emotion_real===I)return I;if(typeof I=="function")return function(L){return VS(L,I,L.theme.modularCssLayers?y:void 0)};if(U0(I)){const L=Dke(I);return function(M){return L.variants?VS(M,L,M.theme.modularCssLayers?y:void 0):M.theme.modularCssLayers?i4(L.style,y):L.style}}return I},E=(...I)=>{const L=[],M=I.map(S),D=[];if(L.push(l),p&&f&&D.push(function(z){const N=z.theme.components?.[p]?.styleOverrides;if(!N)return null;const K={};for(const q in N)K[q]=VS(z,N[q],z.theme.modularCssLayers?"theme":void 0);return f(z,K)}),p&&!b&&D.push(function(z){const N=z.theme?.components?.[p]?.variants;return N?Tke(z,N,[],z.theme.modularCssLayers?"theme":void 0):null}),w||D.push(D4),Array.isArray(M[0])){const z=M.shift(),N=new Array(L.length).fill(""),K=new Array(D.length).fill("");let q;q=[...N,...z,...K],q.raw=[...N,...z.raw,...K],L.unshift(q)}const P=[...L,...M,...D],T=A(...P);return c.muiName&&(T.muiName=c.muiName),T};return A.withConfig&&(E.withConfig=A.withConfig),E}}function aot(e,t){return void 0}function sot(e){for(const t in e)return!1;return!0}function lot(e){return typeof e=="string"&&e.charCodeAt(0)>96}function cot(e){return e&&e.charAt(0).toLowerCase()+e.slice(1)}function qW(e,t,r=!1){const n={...t};for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)){const l=a;if(l==="components"||l==="slots")n[l]={...e[l],...n[l]};else if(l==="componentsProps"||l==="slotProps"){const c=e[l],d=t[l];if(!d)n[l]=c||{};else if(!c)n[l]=d;else{n[l]={...d};for(const p in c)if(Object.prototype.hasOwnProperty.call(c,p)){const u=p;n[l][u]=qW(c[u],d[u],r)}}}else l==="className"&&r&&t.className?n.className=Ko(e?.className,t?.className):l==="style"&&r&&t.style?n.style={...e?.style,...t?.style}:n[l]===void 0&&(n[l]=e[l])}return n}const xd=typeof window<"u"?g.useLayoutEffect:g.useEffect;function dot(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}function $Z(e,t=0,r=1){return dot(e,t,r)}function pot(e){e=e.slice(1);const t=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(t);return r&&r[0].length===1&&(r=r.map(n=>n+n)),r?`rgb${r.length===4?"a":""}(${r.map((n,a)=>a<3?parseInt(n,16):Math.round(parseInt(n,16)/255*1e3)/1e3).join(", ")})`:""}function mg(e){if(e.type)return e;if(e.charAt(0)==="#")return mg(pot(e));const t=e.indexOf("("),r=e.substring(0,t);if(!["rgb","rgba","hsl","hsla","color"].includes(r))throw new Error(u2(9,e));let n=e.substring(t+1,e.length-1),a;if(r==="color"){if(n=n.split(" "),a=n.shift(),n.length===4&&n[3].charAt(0)==="/"&&(n[3]=n[3].slice(1)),!["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].includes(a))throw new Error(u2(10,a))}else n=n.split(",");return n=n.map(l=>parseFloat(l)),{type:r,values:n,colorSpace:a}}const uot=e=>{const t=mg(e);return t.values.slice(0,3).map((r,n)=>t.type.includes("hsl")&&n!==0?`${r}%`:r).join(" ")},mb=(e,t)=>{try{return uot(e)}catch{return e}};function Pj(e){const{type:t,colorSpace:r}=e;let{values:n}=e;return t.includes("rgb")?n=n.map((a,l)=>l<3?parseInt(a,10):a):t.includes("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),t.includes("color")?n=`${r} ${n.join(" ")}`:n=`${n.join(", ")}`,`${t}(${n})`}function zke(e){e=mg(e);const{values:t}=e,r=t[0],n=t[1]/100,a=t[2]/100,l=n*Math.min(a,1-a),c=(u,h=(u+r/30)%12)=>a-l*Math.max(Math.min(h-3,9-h,1),-1);let d="rgb";const p=[Math.round(c(0)*255),Math.round(c(8)*255),Math.round(c(4)*255)];return e.type==="hsla"&&(d+="a",p.push(t[3])),Pj({type:d,values:p})}function ZW(e){e=mg(e);let t=e.type==="hsl"||e.type==="hsla"?mg(zke(e)).values:e.values;return t=t.map(r=>(e.type!=="color"&&(r/=255),r<=.03928?r/12.92:((r+.055)/1.055)**2.4)),Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function hot(e,t){const r=ZW(e),n=ZW(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}function jE(e,t){return e=mg(e),t=$Z(t),(e.type==="rgb"||e.type==="hsl")&&(e.type+="a"),e.type==="color"?e.values[3]=`/${t}`:e.values[3]=t,Pj(e)}function N3(e,t,r){try{return jE(e,t)}catch{return e}}function Dj(e,t){if(e=mg(e),t=$Z(t),e.type.includes("hsl"))e.values[2]*=1-t;else if(e.type.includes("rgb")||e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return Pj(e)}function Pi(e,t,r){try{return Dj(e,t)}catch{return e}}function Tj(e,t){if(e=mg(e),t=$Z(t),e.type.includes("hsl"))e.values[2]+=(100-e.values[2])*t;else if(e.type.includes("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(e.type.includes("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return Pj(e)}function Di(e,t,r){try{return Tj(e,t)}catch{return e}}function mot(e,t=.15){return ZW(e)>.5?Dj(e,t):Tj(e,t)}function CA(e,t,r){try{return mot(e,t)}catch{return e}}const Rke=g.createContext(null);function kZ(){return g.useContext(Rke)}const got=typeof Symbol=="function"&&Symbol.for,fot=got?Symbol.for("mui.nested"):"__THEME_NESTED__";function xot(e,t){return typeof t=="function"?t(e):{...e,...t}}function yot(e){const{children:t,theme:r}=e,n=kZ(),a=g.useMemo(()=>{const l=n===null?{...r}:xot(n,r);return l!=null&&(l[fot]=n!==null),l},[r,n]);return s.jsx(Rke.Provider,{value:a,children:t})}const Fke=g.createContext();function bot({value:e,...t}){return s.jsx(Fke.Provider,{value:e??!0,...t})}const C9=()=>g.useContext(Fke)??!1,Oke=g.createContext(void 0);function wot({value:e,children:t}){return s.jsx(Oke.Provider,{value:e,children:t})}function vot(e){const{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;const a=t.components[r];return a.defaultProps?qW(a.defaultProps,n,t.components.mergeClassNameAndStyle):!a.styleOverrides&&!a.variants?qW(a,n,t.components.mergeClassNameAndStyle):n}function Cot({props:e,name:t}){const r=g.useContext(Oke);return vot({props:e,name:t,theme:{components:r}})}let nie=0;function Aot(e){const[t,r]=g.useState(e),n=e||t;return g.useEffect(()=>{t==null&&(nie+=1,r(`mui-${nie}`))},[t]),n}const $ot={...YZe},aie=$ot.useId;function zj(e){if(aie!==void 0){const t=aie();return e??t}return Aot(e)}function kot(e){const t=AZ(),r=zj()||"",{modularCssLayers:n}=e;let a="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!n||t!==null?a="":typeof n=="string"?a=n.replace(/mui(?!\.)/g,a):a=`@layer ${a};`,xd(()=>{const l=document.querySelector("head");if(!l)return;const c=l.firstChild;if(a){if(c&&c.hasAttribute?.("data-mui-layer-order")&&c.getAttribute("data-mui-layer-order")===r)return;const d=document.createElement("style");d.setAttribute("data-mui-layer-order",r),d.textContent=a,l.prepend(d)}else l.querySelector(`style[data-mui-layer-order="${r}"]`)?.remove()},[a,r]),a?s.jsx(Bke,{styles:a}):null}const sie={};function lie(e,t,r,n=!1){return g.useMemo(()=>{const a=e&&t[e]||t;if(typeof r=="function"){const l=r(a),c=e?{...t,[e]:l}:l;return n?()=>c:c}return e?{...t,[e]:r}:{...t,...r}},[e,t,r,n])}function Nke(e){const{children:t,theme:r,themeId:n}=e,a=AZ(sie),l=kZ()||sie,c=lie(n,a,r),d=lie(n,l,r,!0),p=(n?c[n]:c).direction==="rtl",u=kot(c);return s.jsx(yot,{theme:d,children:s.jsx(hke.Provider,{value:c,children:s.jsx(bot,{value:p,children:s.jsxs(wot,{value:n?c[n].components:c.components,children:[u,t]})})})})}const cie={theme:void 0};function Sot(e){let t,r;return function(n){let a=t;return(a===void 0||n.theme!==r)&&(cie.theme=n.theme,a=Dke(e(cie)),t=a,r=n.theme),a}}const SZ="mode",EZ="color-scheme",Eot="data-color-scheme";function Lot(e){const{defaultMode:t="system",defaultLightColorScheme:r="light",defaultDarkColorScheme:n="dark",modeStorageKey:a=SZ,colorSchemeStorageKey:l=EZ,attribute:c=Eot,colorSchemeNode:d="document.documentElement",nonce:p}=e||{};let u="",h=c;if(c==="class"&&(h=".%s"),c==="data"&&(h="[data-%s]"),h.startsWith(".")){const f=h.substring(1);u+=`${d}.classList.remove('${f}'.replace('%s', light), '${f}'.replace('%s', dark));
|
|
3
3
|
${d}.classList.add('${f}'.replace('%s', colorScheme));`}const m=h.match(/\[([^[\]]+)\]/);if(m){const[f,x]=m[1].split("=");x||(u+=`${d}.removeAttribute('${f}'.replace('%s', light));
|
|
4
4
|
${d}.removeAttribute('${f}'.replace('%s', dark));`),u+=`
|
|
5
5
|
${d}.setAttribute('${f}'.replace('%s', colorScheme), ${x?`${x}.replace('%s', colorScheme)`:'""'});`}else h!==".%s"&&(u+=`${d}.setAttribute('${h}', colorScheme);`);return s.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?p:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
@@ -243,7 +243,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
243
243
|
`+he:"")+"\n```"},regExp:/^```(\w{1,10})?\s/,replace:q(re=>t.$createCodeNode(re?re[1]:void 0)),type:"element"},H={dependencies:[r.ListNode,r.ListItemNode],export:(re,he)=>r.$isListNode(re)?_(re,he,0):null,regExp:/^(\s*)[-*+]\s/,replace:F("bullet"),type:"element"},ee={dependencies:[r.ListNode,r.ListItemNode],export:(re,he)=>r.$isListNode(re)?_(re,he,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:F("check"),type:"element"},Y={dependencies:[r.ListNode,r.ListItemNode],export:(re,he)=>r.$isListNode(re)?_(re,he,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:F("number"),type:"element"},G={format:["code"],tag:"`",type:"text-format"},X={format:["highlight"],tag:"==",type:"text-format"},J={format:["bold","italic"],tag:"***",type:"text-format"},ie={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},ye={format:["bold"],tag:"**",type:"text-format"},me={format:["bold"],intraword:!1,tag:"__",type:"text-format"},de={format:["strikethrough"],tag:"~~",type:"text-format"},ce={format:["italic"],tag:"*",type:"text-format"},ge={format:["italic"],intraword:!1,tag:"_",type:"text-format"},be={dependencies:[l.LinkNode],export:(re,he,Ee)=>{if(!l.$isLinkNode(re))return null;he=(he=re.getTitle())?`[${re.getTextContent()}](${re.getURL()} "${he}")`:`[${re.getTextContent()}](${re.getURL()})`;const Me=re.getFirstChild();return re.getChildrenSize()===1&&e.$isTextNode(Me)?Ee(Me,he):he},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(re,he)=>{const[,Ee,Me,we]=he;he=l.$createLinkNode(Me,{title:we});const De=e.$createTextNode(Ee);De.setFormat(re.getFormat()),he.append(De),re.replace(he)},trigger:")",type:"text-match"},ne=[V,O,R,H,Y],ae=[G,J,ie,ye,me,X,ce,ge,de],fe=[be],ve=[...ne,...ae,...fe];return mn.$convertFromMarkdownString=function(re,he=ve,Ee){return M(he)(re,Ee)},mn.$convertToMarkdownString=function(re=ve,he){return u(re)(he)},mn.BOLD_ITALIC_STAR=J,mn.BOLD_ITALIC_UNDERSCORE=ie,mn.BOLD_STAR=ye,mn.BOLD_UNDERSCORE=me,mn.CHECK_LIST=ee,mn.CODE=R,mn.ELEMENT_TRANSFORMERS=ne,mn.HEADING=V,mn.HIGHLIGHT=X,mn.INLINE_CODE=G,mn.ITALIC_STAR=ce,mn.ITALIC_UNDERSCORE=ge,mn.LINK=be,mn.ORDERED_LIST=Y,mn.QUOTE=O,mn.STRIKETHROUGH=de,mn.TEXT_FORMAT_TRANSFORMERS=ae,mn.TEXT_MATCH_TRANSFORMERS=fe,mn.TRANSFORMERS=ve,mn.UNORDERED_LIST=H,mn.registerMarkdownShortcuts=function(re,he=ve){let Ee=d(he),Me=c(Ee.textFormat,({tag:De})=>De[De.length-1]),we=c(Ee.textMatch,({trigger:De})=>De);for(let De of he)if(he=De.type,(he==="element"||he==="text-match")&&!re.hasNodes(De.dependencies))throw Error("Minified Lexical error #79; visit https://lexical.dev/docs/error?code=79 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return re.registerUpdateListener(({tags:De,dirtyLeaves:ze,editorState:tt,prevEditorState:Qe})=>{if(!De.has("historic")){var Be=tt.read(e.$getSelection);if(De=Qe.read(e.$getSelection),e.$isRangeSelection(De)&&e.$isRangeSelection(Be)&&Be.isCollapsed()){Qe=Be.anchor.key;var _e=Be.anchor.offset,$e=tt._nodeMap.get(Qe);e.$isTextNode($e)&&ze.has(Qe)&&(_e===1||_e===De.anchor.offset+1)&&re.update(()=>{if(!$e.hasFormat("code")){var Re=$e.getParent();if(Re!==null&&!t.$isCodeNode(Re)){var Ze=Be.anchor.offset;e:{var Ne=Ee.element,et=Re.getParent();if(e.$isRootOrShadowRoot(et)&&Re.getFirstChild()===$e&&(et=$e.getTextContent(),et[Ze-1]===" ")){for(let{regExp:pt,replace:ut}of Ne)if((Ne=et.match(pt))&&Ne[0].length===Ze){et=$e.getNextSiblings();let[zt,Yt]=$e.splitText(Ze);zt.remove(),et=Yt?[Yt,...et]:et,ut(Re,et,Ne,!1),Re=!0;break e}}Re=!1}if(!Re){e:{if(Ne=$e.getTextContent(),Re=we[Ne[Ze-1]],Re!=null){Ze<Ne.length&&(Ne=Ne.slice(0,Ze));for(He of Re)if(Re=Ne.match(He.regExp),Re!==null){Ne=Re.index||0,et=Ne+Re[0].length;var mt=void 0;Ne===0?[mt]=$e.splitText(et):[,mt]=$e.splitText(Ne,et),mt.selectNext(0,0),He.replace(mt,Re);var He=!0;break e}}He=!1}if(!He)e:{et=$e.getTextContent(),--Ze;var bt=et[Ze];if(He=Me[bt])for(let pt of He){var{tag:Mt}=pt;He=Mt.length;let ut=Ze-He+1;if(!(1<He&&!K(et,ut,Mt,0,He)||et[ut-1]===" ")&&(mt=et[Ze+1],pt.intraword!==!1||!mt||p.test(mt))){Re=mt=$e,Ne=N(et,ut,Mt);for(var Ft=Re;0>Ne&&(Ft=Ft.getPreviousSibling())&&!e.$isLineBreakNode(Ft);)e.$isTextNode(Ft)&&(Ne=Ft.getTextContent(),Re=Ft,Ne=N(Ne,Ne.length,Mt));if(!(0>Ne||Re===mt&&Ne+He===ut||(Mt=Re.getTextContent(),0<Ne&&Mt[Ne-1]===bt||(Ft=Mt[Ne-1],pt.intraword===!1&&Ft&&!p.test(Ft))))){et=mt.getTextContent(),et=et.slice(0,ut)+et.slice(Ze+1),mt.setTextContent(et),et=Re===mt?et:Mt,Re.setTextContent(et.slice(0,Ne)+et.slice(Ne+He)),et=e.$getSelection(),bt=e.$createRangeSelection(),e.$setSelection(bt),Ze=Ze-He*(Re===mt?2:1)+1,bt.anchor.set(Re.__key,Ne,"text"),bt.focus.set(mt.__key,Ze,"text");for(let zt of pt.format)bt.hasFormat(zt)||bt.formatText(zt);bt.anchor.set(bt.focus.key,bt.focus.offset,bt.focus.type);for(let zt of pt.format)bt.hasFormat(zt)&&bt.toggleFormat(zt);e.$isRangeSelection(et)&&(bt.format=et.format);break e}}}}}}}})}}})},mn}var WH,nme;function Vze(){return nme||(nme=1,WH=iOt()),WH}var nOt=Vze(),GH={},ame;function aOt(){if(ame)return GH;ame=1;var e=Ad(),t=Tc();return GH.AutoFocusPlugin=function({defaultSelection:r}){let[n]=e.useLexicalComposerContext();return t.useEffect(()=>{n.focus(()=>{let a=document.activeElement,l=n.getRootElement();l===null||a!==null&&l.contains(a)||l.focus({preventScroll:!0})},{defaultSelection:r})},[r,n]),null},GH}var YH,sme;function sOt(){return sme||(sme=1,YH=aOt()),YH}var lOt=sOt(),h$={},v7={},KH={},lme;function cOt(){if(lme)return KH;lme=1;var e=Ad(),t=Ta(),r=Tc();function n(a,l){return a.getEditorState().read(()=>{let c=t.$getNodeByKey(l);return c===null?!1:c.isSelected()})}return KH.useLexicalNodeSelection=function(a){let[l]=e.useLexicalComposerContext(),[c,d]=r.useState(()=>n(l,a));r.useEffect(()=>{let h=!0,m=l.registerUpdateListener(()=>{h&&d(n(l,a))});return()=>{h=!1,m()}},[l,a]);let p=r.useCallback(h=>{l.update(()=>{let m=t.$getSelection();t.$isNodeSelection(m)||(m=t.$createNodeSelection(),t.$setSelection(m)),h?m.add(a):m.delete(a)})},[l,a]),u=r.useCallback(()=>{l.update(()=>{const h=t.$getSelection();t.$isNodeSelection(h)&&h.clear()})},[l]);return[c,p,u]},KH}var qH,cme;function dOt(){return cme||(cme=1,qH=cOt()),qH}var dme;function pOt(){if(dme)return v7;dme=1;var e=Ad(),t=dOt(),r=Rc(),n=Ta(),a=Tc();let l=n.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");function c({nodeKey:m}){let[f]=e.useLexicalComposerContext(),[x,y,b]=t.useLexicalNodeSelection(m),w=a.useCallback(v=>(x&&n.$isNodeSelection(n.$getSelection())&&(v.preventDefault(),v=n.$getNodeByKey(m),h(v)&&v.remove(),y(!1)),!1),[x,m,y]);return a.useEffect(()=>r.mergeRegister(f.registerCommand(n.CLICK_COMMAND,v=>{let A=f.getElementByKey(m);return v.target===A?(v.shiftKey||b(),y(!x),!0):!1},n.COMMAND_PRIORITY_LOW),f.registerCommand(n.KEY_DELETE_COMMAND,w,n.COMMAND_PRIORITY_LOW),f.registerCommand(n.KEY_BACKSPACE_COMMAND,w,n.COMMAND_PRIORITY_LOW)),[b,f,x,m,w,y]),a.useEffect(()=>{let v=f.getElementByKey(m);v!==null&&(v.className=x?"selected":"")},[f,x,m]),null}class d extends n.DecoratorNode{static getType(){return"horizontalrule"}static clone(f){return new d(f.__key)}static importJSON(){return u()}static importDOM(){return{hr:()=>({conversion:p,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return`
|
|
244
244
|
`}isInline(){return!1}updateDOM(){return!1}decorate(){return a.createElement(c,{nodeKey:this.__key})}}function p(){return{node:u()}}function u(){return n.$applyNodeReplacement(new d)}function h(m){return m instanceof d}return v7.$createHorizontalRuleNode=u,v7.$isHorizontalRuleNode=h,v7.HorizontalRuleNode=d,v7.INSERT_HORIZONTAL_RULE_COMMAND=l,v7}var ZH,pme;function uOt(){return pme||(pme=1,ZH=pOt()),ZH}var ume;function hOt(){if(ume)return h$;ume=1;var e=Vze(),t=Ad(),r=uOt(),n=Tc();let a=[{dependencies:[r.HorizontalRuleNode],export:l=>r.$isHorizontalRuleNode(l)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(l,c,d,p)=>{c=r.$createHorizontalRuleNode(),p||l.getNextSibling()!=null?l.replace(c):l.insertBefore(c),c.selectNext()},type:"element"},...e.TRANSFORMERS];return h$.DEFAULT_TRANSFORMERS=a,h$.MarkdownShortcutPlugin=function({transformers:l=a}){let[c]=t.useLexicalComposerContext();return n.useEffect(()=>e.registerMarkdownShortcuts(c,l),[c,l]),null},h$}var JH,hme;function mOt(){return hme||(hme=1,JH=hOt()),JH}var gOt=mOt(),hi={},mme;function fOt(){if(mme)return hi;mme=1;var e=Ta(),t=Rc();let r={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class n extends e.DEPRECATED_GridCellNode{static getType(){return"tablecell"}static clone(R){let H=new n(R.__headerState,R.__colSpan,R.__width,R.__key);return H.__rowSpan=R.__rowSpan,H}static importDOM(){return{td:()=>({conversion:a,priority:0}),th:()=>({conversion:a,priority:0})}}static importJSON(R){let H=l(R.headerState,R.colSpan,R.width||void 0);return H.__rowSpan=R.rowSpan,H}constructor(R=r.NO_STATUS,H=1,ee,Y){super(H,Y),this.__headerState=R,this.__width=ee}createDOM(R){let H=document.createElement(this.getTag());return this.__width&&(H.style.width=`${this.__width}px`),1<this.__colSpan&&(H.colSpan=this.__colSpan),1<this.__rowSpan&&(H.rowSpan=this.__rowSpan),t.addClassNamesToElement(H,R.theme.tableCell,this.hasHeader()&&R.theme.tableCellHeader),H}exportDOM(R){if({element:R}=super.exportDOM(R),R){let H=this.getParentOrThrow().getChildrenSize();R.style.border="1px solid black",1<this.__colSpan&&(R.colSpan=this.__colSpan),1<this.__rowSpan&&(R.rowSpan=this.__rowSpan),R.style.width=`${this.getWidth()||Math.max(90,700/H)}px`,R.style.verticalAlign="top",R.style.textAlign="start",this.hasHeader()&&(R.style.backgroundColor="#f2f3f5")}return{element:R}}exportJSON(){return{...super.exportJSON(),headerState:this.__headerState,type:"tablecell",width:this.getWidth()}}getTag(){return this.hasHeader()?"th":"td"}setHeaderStyles(R){return this.getWritable().__headerState=R,this.__headerState}getHeaderStyles(){return this.getLatest().__headerState}setWidth(R){return this.getWritable().__width=R,this.__width}getWidth(){return this.getLatest().__width}toggleHeaderStyle(R){let H=this.getWritable();return H.__headerState=(H.__headerState&R)===R?H.__headerState-R:H.__headerState+R,H}hasHeaderState(R){return(this.getHeaderStyles()&R)===R}hasHeader(){return this.getLatest().__headerState!==r.NO_STATUS}updateDOM(R){return R.__headerState!==this.__headerState||R.__width!==this.__width||R.__colSpan!==this.__colSpan||R.__rowSpan!==this.__rowSpan}isShadowRoot(){return!0}collapseAtStart(){return!0}canBeEmpty(){return!1}canIndent(){return!1}}function a(O){var R=O.nodeName.toLowerCase();return R=l(R==="th"?r.ROW:r.NO_STATUS),R.__colSpan=O.colSpan,R.__rowSpan=O.rowSpan,{forChild:(H,ee)=>c(ee)&&!e.$isElementNode(H)?(ee=e.$createParagraphNode(),e.$isLineBreakNode(H)&&H.getTextContent()===`
|
|
245
245
|
`?null:(ee.append(H),ee)):H,node:R}}function l(O,R=1,H){return e.$applyNodeReplacement(new n(O,R,H))}function c(O){return O instanceof n}class d extends e.DEPRECATED_GridRowNode{static getType(){return"tablerow"}static clone(R){return new d(R.__height,R.__key)}static importDOM(){return{tr:()=>({conversion:p,priority:0})}}static importJSON(R){return u(R.height)}constructor(R,H){super(H),this.__height=R}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1}}createDOM(R){let H=document.createElement("tr");return this.__height&&(H.style.height=`${this.__height}px`),t.addClassNamesToElement(H,R.theme.tableRow),H}isShadowRoot(){return!0}setHeight(R){return this.getWritable().__height=R,this.__height}getHeight(){return this.getLatest().__height}updateDOM(R){return R.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}}function p(){return{node:u()}}function u(O){return e.$applyNodeReplacement(new d(O))}function h(O){return O instanceof d}function m(O){throw Error(`Minified Lexical error #${O}; visit https://lexical.dev/docs/error?code=${O} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let f=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";class x{constructor(R,H){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.listenersToRemove=new Set,this.tableNodeKey=H,this.editor=R,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(R=>R())}trackTableGrid(){let R=new MutationObserver(H=>{this.editor.update(()=>{var ee=!1;for(let Y=0;Y<H.length;Y++){const G=H[Y].target.nodeName;if(G==="TABLE"||G==="TR"){ee=!0;break}}if(ee){if(ee=this.editor.getElementByKey(this.tableNodeKey),!ee)throw Error("Expected to find TableElement in DOM");this.grid=b(ee)}})});this.editor.update(()=>{let H=this.editor.getElementByKey(this.tableNodeKey);if(!H)throw Error("Expected to find TableElement in DOM");this.grid=b(H),R.observe(H,{childList:!0,subtree:!0})})}clearHighlight(){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),this.editor.update(()=>{var R=e.$getNodeByKey(this.tableNodeKey);if(!z(R))throw Error("Expected TableNode.");if(R=this.editor.getElementByKey(this.tableNodeKey),!R)throw Error("Expected to find TableElement in DOM");R=b(R),w(R,null),e.$setSelection(null),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0)})}enableHighlightStyle(){this.editor.update(()=>{let R=this.editor.getElementByKey(this.tableNodeKey);if(!R)throw Error("Expected to find TableElement in DOM");R.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){this.editor.update(()=>{let R=this.editor.getElementByKey(this.tableNodeKey);if(!R)throw Error("Expected to find TableElement in DOM");R.classList.add("disable-selection"),this.hasHijackedSelectionStyles=!0})}updateTableGridSelection(R){R!=null&&R.gridKey===this.tableNodeKey?(this.gridSelection=R,this.isHighlightingCells=!0,this.disableHighlightStyle(),w(this.grid,this.gridSelection)):R==null&&this.clearHighlight()}setFocusCellForSelection(R,H=!1){this.editor.update(()=>{var ee=e.$getNodeByKey(this.tableNodeKey);if(!z(ee))throw Error("Expected TableNode.");if(!this.editor.getElementByKey(this.tableNodeKey))throw Error("Expected to find TableElement in DOM");ee=R.x;let Y=R.y;if(this.focusCell=R,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!==ee||this.anchorY!==Y||H))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(ee===this.focusX&&Y===this.focusY)return;this.focusX=ee,this.focusY=Y,this.isHighlightingCells&&(ee=e.$getNearestNodeFromDOMNode(R.elem),this.gridSelection!=null&&this.anchorCellNodeKey!=null&&c(ee)&&(ee=ee.getKey(),this.gridSelection=this.gridSelection.clone()||e.DEPRECATED_$createGridSelection(),this.focusCellNodeKey=ee,this.gridSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),e.$setSelection(this.gridSelection),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0),w(this.grid,this.gridSelection)))})}setAnchorCellForSelection(R){this.isHighlightingCells=!1,this.anchorCell=R,this.anchorX=R.x,this.anchorY=R.y,this.editor.update(()=>{var H=e.$getNearestNodeFromDOMNode(R.elem);c(H)&&(H=H.getKey(),this.gridSelection=e.DEPRECATED_$createGridSelection(),this.anchorCellNodeKey=H)})}formatCells(R){this.editor.update(()=>{let H=e.$getSelection();e.DEPRECATED_$isGridSelection(H)||m(11);let ee=e.$createRangeSelection(),Y=ee.anchor,G=ee.focus;H.getNodes().forEach(X=>{c(X)&&X.getTextContentSize()!==0&&(Y.set(X.getKey(),0,"element"),G.set(X.getKey(),X.getChildrenSize(),"element"),ee.formatText(R))}),e.$setSelection(H),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0)})}clearText(){this.editor.update(()=>{let R=e.$getNodeByKey(this.tableNodeKey);if(!z(R))throw Error("Expected TableNode.");var H=e.$getSelection();e.DEPRECATED_$isGridSelection(H)||m(11),H=H.getNodes().filter(c),H.length===this.grid.columns*this.grid.rows?(R.selectPrevious(),R.remove(),e.$getRoot().selectStart()):(H.forEach(ee=>{if(e.$isElementNode(ee)){let Y=e.$createParagraphNode(),G=e.$createTextNode();Y.append(G),ee.append(Y),ee.getChildren().forEach(X=>{X!==Y&&X.remove()})}}),w(this.grid,null),e.$setSelection(null),this.editor.dispatchCommand(e.SELECTION_CHANGE_COMMAND,void 0))})}}function y(O){for(;O!=null;){let R=O.nodeName;if(R==="TD"||R==="TH"){if(O=O._cell,O===void 0)break;return O}O=O.parentNode}return null}function b(O){let R=[],H={cells:R,columns:0,rows:0};var ee=O.firstChild;let Y=O=0;for(R.length=0;ee!=null;){var G=ee.nodeName;if(G==="TD"||G==="TH")G={elem:ee,highlighted:!1,x:O,y:Y},ee._cell=G,R[Y]===void 0&&(R[Y]=[]),R[Y][O]=G;else if(G=ee.firstChild,G!=null){ee=G;continue}if(G=ee.nextSibling,G!=null)O++,ee=G;else if(G=ee.parentNode,G!=null){if(ee=G.nextSibling,ee==null)break;Y++,O=0}}return H.columns=O+1,H.rows=Y+1,H}function w(O,R){let H=[],ee=new Set(R?R.getNodes():[]);return v(O,(Y,G)=>{let X=Y.elem;ee.has(G)?(Y.highlighted=!0,X.style.setProperty("background-color","rgb(172, 206, 247)"),X.style.setProperty("caret-color","transparent"),H.push(Y)):(Y.highlighted=!1,X.style.removeProperty("background-color"),X.style.removeProperty("caret-color"),X.getAttribute("style")||X.removeAttribute("style"))}),H}function v(O,R){({cells:O}=O);for(let H=0;H<O.length;H++){let ee=O[H];for(let Y=0;Y<ee.length;Y++){let G=ee[Y],X=e.$getNearestNodeFromDOMNode(G.elem);X!==null&&R(G,X,{x:Y,y:H})}}}function A(O){O.disableHighlightStyle(),v(O.grid,R=>{let H=R.elem;R.highlighted=!0,H.style.setProperty("background-color","rgb(172, 206, 247)"),H.style.setProperty("caret-color","transparent")})}function S(O){O.enableHighlightStyle(),v(O.grid,R=>{let H=R.elem;R.highlighted=!1,H.style.removeProperty("background-color"),H.style.removeProperty("caret-color"),H.getAttribute("style")||H.removeAttribute("style")})}let E=(O,R,H,ee,Y)=>{const G=Y==="forward";switch(Y){case"backward":case"forward":return H!==(G?O.grid.columns-1:0)?M(R.getCellNodeFromCordsOrThrow(H+(G?1:-1),ee,O.grid)):ee!==(G?O.grid.rows-1:0)?M(R.getCellNodeFromCordsOrThrow(G?0:O.grid.columns-1,ee+(G?1:-1),O.grid)):G?R.selectNext():R.selectPrevious(),!0;case"up":return ee!==0?M(R.getCellNodeFromCordsOrThrow(H,ee-1,O.grid)):R.selectPrevious(),!0;case"down":return ee!==O.grid.rows-1?M(R.getCellNodeFromCordsOrThrow(H,ee+1,O.grid)):R.selectNext(),!0;default:return!1}},I=(O,R,H,ee,Y)=>{const G=Y==="forward";switch(Y){case"backward":case"forward":return H!==(G?O.grid.columns-1:0)&&O.setFocusCellForSelection(R.getCellFromCordsOrThrow(H+(G?1:-1),ee,O.grid)),!0;case"up":return ee!==0?(O.setFocusCellForSelection(R.getCellFromCordsOrThrow(H,ee-1,O.grid)),!0):!1;case"down":return ee!==O.grid.rows-1?(O.setFocusCellForSelection(R.getCellFromCordsOrThrow(H,ee+1,O.grid)),!0):!1;default:return!1}};function L(O,R){if(e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)){let H=R.isParentOf(O.anchor.getNode());return O=R.isParentOf(O.focus.getNode()),H&&O}return!1}function M(O){let R=O.getChildren().find(H=>e.$isParagraphNode(H));e.$isParagraphNode(R)?R.selectEnd():O.selectEnd()}class D extends e.DEPRECATED_GridNode{static getType(){return"table"}static clone(R){return new D(R.__key)}static importDOM(){return{table:()=>({conversion:P,priority:1})}}static importJSON(){return T()}constructor(R){super(R)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(R){let H=document.createElement("table");return t.addClassNamesToElement(H,R.theme.table),H}updateDOM(){return!1}exportDOM(R){return{...super.exportDOM(R),after:H=>{if(H){let ee=H.cloneNode(),Y=document.createElement("colgroup"),G=document.createElement("tbody");if(G.append(...H.children),H=this.getFirstChildOrThrow(),!h(H))throw Error("Expected to find row node.");H=H.getChildrenSize();for(let X=0;X<H;X++){let J=document.createElement("col");Y.append(J)}return ee.replaceChildren(Y,G),ee}}}}canExtractContents(){return!1}canBeEmpty(){return!1}isShadowRoot(){return!0}getCordsFromCellNode(R,H){let{rows:ee,cells:Y}=H;for(H=0;H<ee;H++){var G=Y[H];if(G==null)throw Error(`Row not found at y:${H}`);if(G=G.findIndex(({elem:X})=>e.$getNearestNodeFromDOMNode(X)===R),G!==-1)return{x:G,y:H}}throw Error("Cell not found in table.")}getCellFromCords(R,H,ee){return{cells:ee}=ee,H=ee[H],H==null?null:(R=H[R],R??null)}getCellFromCordsOrThrow(R,H,ee){if(R=this.getCellFromCords(R,H,ee),!R)throw Error("Cell not found at cords.");return R}getCellNodeFromCords(R,H,ee){return R=this.getCellFromCords(R,H,ee),R==null?null:(R=e.$getNearestNodeFromDOMNode(R.elem),c(R)?R:null)}getCellNodeFromCordsOrThrow(R,H,ee){if(R=this.getCellNodeFromCords(R,H,ee),!R)throw Error("Node at cords not TableCellNode.");return R}canSelectBefore(){return!0}canIndent(){return!1}}function P(){return{node:T()}}function T(){return e.$applyNodeReplacement(new D)}function z(O){return O instanceof D}function N(O){if(O=t.$findMatchingParent(O,R=>h(R)),h(O))return O;throw Error("Expected table cell to be inside of table row.")}function K(O){if(O=t.$findMatchingParent(O,R=>z(R)),z(O))return O;throw Error("Expected table cell to be inside of table.")}function q(O,R){let H=K(O),{x:ee,y:Y}=H.getCordsFromCellNode(O,R);return{above:H.getCellNodeFromCords(ee,Y-1,R),below:H.getCellNodeFromCords(ee,Y+1,R),left:H.getCellNodeFromCords(ee-1,Y,R),right:H.getCellNodeFromCords(ee+1,Y,R)}}function F(O){O=O.getFirstDescendant(),O===null&&m(124),O.getParentOrThrow().selectStart()}function _(O,R){let H=O.getFirstChild();H!==null?H.insertBefore(R):O.append(R)}let V=e.createCommand("INSERT_TABLE_COMMAND");return hi.$createTableCellNode=l,hi.$createTableNode=T,hi.$createTableNodeWithDimensions=function(O,R,H=!0){let ee=T();for(let G=0;G<O;G++){let X=u();for(let J=0;J<R;J++){var Y=r.NO_STATUS;typeof H=="object"?(G===0&&H.rows&&(Y|=r.ROW),J===0&&H.columns&&(Y|=r.COLUMN)):H&&(G===0&&(Y|=r.ROW),J===0&&(Y|=r.COLUMN)),Y=l(Y);let ie=e.$createParagraphNode();ie.append(e.$createTextNode()),Y.append(ie),X.append(Y)}ee.append(X)}return ee},hi.$createTableRowNode=u,hi.$deleteTableColumn=function(O,R){let H=O.getChildren();for(let Y=0;Y<H.length;Y++){var ee=H[Y];if(h(ee)){if(ee=ee.getChildren(),R>=ee.length||0>R)throw Error("Table column target index out of range");ee[R].remove()}}return O},hi.$deleteTableColumn__EXPERIMENTAL=function(){var O=e.$getSelection();e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)||m(118);var R=O.anchor.getNode();O=O.focus.getNode();let[H,,ee]=e.DEPRECATED_$getNodeTriplet(R);[R]=e.DEPRECATED_$getNodeTriplet(O);let[Y,G,X]=e.DEPRECATED_$computeGridMap(ee,H,R);var{startColumn:J}=G;let{startRow:ie,startColumn:ye}=X;O=Math.min(J,ye),J=Math.max(J+H.__colSpan-1,ye+R.__colSpan-1);let me=J-O+1;if(Y[0].length===J-O+1)ee.selectPrevious(),ee.remove();else{var de=Y.length;for(let ce=0;ce<de;ce++)for(let ge=O;ge<=J;ge++){let{cell:be,startColumn:ne}=Y[ce][ge];ne<O?ge===O&&be.setColSpan(be.__colSpan-Math.min(me,be.__colSpan-(O-ne))):ne+be.__colSpan-1>J?ge===J&&be.setColSpan(be.__colSpan-(J-ne+1)):be.remove()}O=Y[ie],R=O[ye+R.__colSpan],R!==void 0?({cell:R}=R,F(R)):({cell:R}=O[ye-1],F(R))}},hi.$deleteTableRow__EXPERIMENTAL=function(){var O=e.$getSelection();e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)||m(118);var R=O.anchor.getNode();O=O.focus.getNode();let[H,,ee]=e.DEPRECATED_$getNodeTriplet(R);[O]=e.DEPRECATED_$getNodeTriplet(O);let[Y,G,X]=e.DEPRECATED_$computeGridMap(ee,H,O);({startRow:R}=G);var{startRow:J}=X;if(O=J+O.__rowSpan-1,Y.length===O-R+1)ee.remove();else{J=Y[0].length;var ie=Y[O+1],ye=ee.getChildAtIndex(O+1);for(let de=O;de>=R;de--){for(var me=J-1;0<=me;me--){let{cell:ce,startRow:ge,startColumn:be}=Y[de][me];if(be===me&&(de===R&&ge<R&&ce.setRowSpan(ce.__rowSpan-(ge-R)),ge>=R&&ge+ce.__rowSpan-1>O))if(ce.setRowSpan(ce.__rowSpan-(O-ge+1)),ye===null&&m(122),me===0)_(ye,ce);else{let{cell:ne}=ie[me-1];ne.insertAfter(ce)}}me=ee.getChildAtIndex(de),e.DEPRECATED_$isGridRowNode(me)||m(123),me.remove()}ie!==void 0?({cell:R}=ie[0],F(R)):({cell:R}=Y[R-1][0],F(R))}},hi.$getElementGridForTableNode=function(O,R){if(O=O.getElementByKey(R.getKey()),O==null)throw Error("Table Element Not Found");return b(O)},hi.$getTableCellNodeFromLexicalNode=function(O){return O=t.$findMatchingParent(O,R=>c(R)),c(O)?O:null},hi.$getTableColumnIndexFromTableCellNode=function(O){return N(O).getChildren().findIndex(R=>R.is(O))},hi.$getTableNodeFromLexicalNodeOrThrow=K,hi.$getTableRowIndexFromTableCellNode=function(O){let R=N(O);return K(R).getChildren().findIndex(H=>H.is(R))},hi.$getTableRowNodeFromTableCellNodeOrThrow=N,hi.$insertTableColumn=function(O,R,H=!0,ee,Y){let G=O.getChildren();for(let ie=0;ie<G.length;ie++){let ye=G[ie];if(h(ye))for(let me=0;me<ee;me++){var X=ye.getChildren();if(R>=X.length||0>R)throw Error("Table column target index out of range");X=X[R],c(X)||m(12);let{left:de,right:ce}=q(X,Y);var J=r.NO_STATUS;(de&&de.hasHeaderState(r.ROW)||ce&&ce.hasHeaderState(r.ROW))&&(J|=r.ROW),J=l(J),J.append(e.$createParagraphNode()),H?X.insertAfter(J):X.insertBefore(J)}}return O},hi.$insertTableColumn__EXPERIMENTAL=function(O=!0){function R(){let me=l(r.NO_STATUS).append(e.$createParagraphNode());return ie===null&&(ie=me),me}var H=e.$getSelection();e.$isRangeSelection(H)||e.DEPRECATED_$isGridSelection(H)||m(118),H=H.focus.getNode();let[ee,,Y]=e.DEPRECATED_$getNodeTriplet(H),[G,X]=e.DEPRECATED_$computeGridMap(Y,ee,ee);H=G.length;var{startColumn:J}=X;O=O?J+ee.__colSpan-1:J-1,J=Y.getFirstChild(),e.DEPRECATED_$isGridRowNode(J)||m(120);let ie=null;var ye=J;e:for(J=0;J<H;J++){J!==0&&(ye=ye.getNextSibling(),e.DEPRECATED_$isGridRowNode(ye)||m(121));let me=G[J];if(0>O){_(ye,R());continue}let{cell:de,startColumn:ce,startRow:ge}=me[O];if(ce+de.__colSpan-1<=O){let be=de,ne=ge,ae=O;for(;ne!==J&&1<be.__rowSpan;)if(ae-=de.__colSpan,0<=ae){let{cell:fe,startRow:ve}=me[ae];be=fe,ne=ve}else{ye.append(R());continue e}be.insertAfter(R())}else de.setColSpan(de.__colSpan+1)}ie!==null&&F(ie)},hi.$insertTableRow=function(O,R,H=!0,ee,Y){var G=O.getChildren();if(R>=G.length||0>R)throw Error("Table row target index out of range");if(R=G[R],h(R))for(G=0;G<ee;G++){let J=R.getChildren(),ie=J.length,ye=u();for(let me=0;me<ie;me++){var X=J[me];c(X)||m(12);let{above:de,below:ce}=q(X,Y);X=r.NO_STATUS;let ge=de&&de.getWidth()||ce&&ce.getWidth()||void 0;(de&&de.hasHeaderState(r.COLUMN)||ce&&ce.hasHeaderState(r.COLUMN))&&(X|=r.COLUMN),X=l(X,1,ge),X.append(e.$createParagraphNode()),ye.append(X)}H?R.insertAfter(ye):R.insertBefore(ye)}else throw Error("Row before insertion index does not exist.");return O},hi.$insertTableRow__EXPERIMENTAL=function(O=!0){var R=e.$getSelection();e.$isRangeSelection(R)||e.DEPRECATED_$isGridSelection(R)||m(118),R=R.focus.getNode();let[H,,ee]=e.DEPRECATED_$getNodeTriplet(R),[Y,G]=e.DEPRECATED_$computeGridMap(ee,H,H);R=Y[0].length;var{startRow:X}=G;if(O){O=X+H.__rowSpan-1;var J=Y[O];X=u();for(var ie=0;ie<R;ie++){let{cell:ye,startRow:me}=J[ie];me+ye.__rowSpan-1<=O?X.append(l(r.NO_STATUS)):ye.setRowSpan(ye.__rowSpan+1)}R=ee.getChildAtIndex(O),e.DEPRECATED_$isGridRowNode(R)||m(119),R.insertAfter(X)}else{for(J=Y[X],O=u(),ie=0;ie<R;ie++){let{cell:ye,startRow:me}=J[ie];me===X?O.append(l(r.NO_STATUS)):ye.setRowSpan(ye.__rowSpan+1)}R=ee.getChildAtIndex(X),e.DEPRECATED_$isGridRowNode(R)||m(119),R.insertBefore(O)}},hi.$isTableCellNode=c,hi.$isTableNode=z,hi.$isTableRowNode=h,hi.$removeTableRowAtIndex=function(O,R){let H=O.getChildren();if(R>=H.length||0>R)throw Error("Expected table cell to be inside of table row.");return H[R].remove(),O},hi.$unmergeCell=function(){var O=e.$getSelection();e.$isRangeSelection(O)||e.DEPRECATED_$isGridSelection(O)||m(118),O=O.anchor.getNode();let[R,H,ee]=e.DEPRECATED_$getNodeTriplet(O);O=R.__colSpan;let Y=R.__rowSpan;if(1<O){for(var G=1;G<O;G++)R.insertAfter(l(r.NO_STATUS));R.setColSpan(1)}if(1<Y){let[ie,ye]=e.DEPRECATED_$computeGridMap(ee,R,R),{startColumn:me,startRow:de}=ye;for(G=1;G<Y;G++){let ce=de+G,ge=ie[ce];var X=H.getNextSibling();e.DEPRECATED_$isGridRowNode(X)||m(125);var J=null;for(let be=0;be<me;be++){let ne=ge[be],ae=ne.cell;ne.startRow===ce&&(J=ae),1<ae.__colSpan&&(be+=ae.__colSpan-1)}if(J===null)for(J=0;J<O;J++)_(X,l(r.NO_STATUS));else for(X=0;X<O;X++)J.insertAfter(l(r.NO_STATUS))}R.setRowSpan(1)}},hi.INSERT_TABLE_COMMAND=V,hi.TableCellHeaderStates=r,hi.TableCellNode=n,hi.TableNode=D,hi.TableRowNode=d,hi.TableSelection=x,hi.applyTableHandlers=function(O,R,H){let ee=H.getRootElement();if(ee===null)throw Error("No root element.");let Y=new x(H,O.getKey());R.__lexicalTableSelection=Y;let G=!1,X=!1;R.addEventListener("dblclick",de=>{let ce=y(de.target);ce!==null&&(de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),Y.setAnchorCellForSelection(ce),Y.setFocusCellForSelection(ce,!0),G=!1)}),R.addEventListener("mousedown",de=>{setTimeout(()=>{if(de.button===0){var ce=y(de.target);ce!==null&&(de.preventDefault(),de.stopPropagation(),de.stopImmediatePropagation(),Y.setAnchorCellForSelection(ce))}},0)}),R.addEventListener("mousemove",de=>{if(X&&(de.preventDefault(),de.stopPropagation(),de.stopImmediatePropagation()),G){let ce=y(de.target);if(ce!==null){let ge=ce.x,be=ce.y;G&&(Y.anchorX!==ge||Y.anchorY!==be||Y.isHighlightingCells)&&(de.preventDefault(),Y.setFocusCellForSelection(ce))}}}),R.addEventListener("mouseleave",()=>{});let J=de=>{de.button===0&&H.update(()=>{var ce=e.$getSelection();const ge=de.target;if(ge instanceof Node){if(e.DEPRECATED_$isGridSelection(ce)&&ce.gridKey===Y.tableNodeKey&&ee.contains(ge))return Y.clearHighlight();ce=e.$getNearestNodeFromDOMNode(ge),ce!==null&&t.$findMatchingParent(ce,e.DEPRECATED_$isGridNode)&&(G=!0)}})};window.addEventListener("mousedown",J),Y.listenersToRemove.add(()=>window.removeEventListener("mousedown",J));let ie=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",ie),Y.listenersToRemove.add(()=>window.removeEventListener("mouseup",ie)),R.addEventListener("mouseup",ie),Y.listenersToRemove.add(()=>R.removeEventListener("mouseup",ie)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_DOWN_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,O))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ge=t.$findMatchingParent(ce.anchor.getNode(),ne=>c(ne));if(!c(ge))return!1;var be=O.getCordsFromCellNode(ge,Y.grid);if(ce=t.$findMatchingParent(ce.anchor.getNode(),ne=>e.$isElementNode(ne)),ce==null)throw Error("Expected BlockNode Parent");if((ge=ge.getLastChild())&&ce.isParentOf(ge)||ce===ge||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(be.x,be.y,Y.grid)),I(Y,O,be.x,be.y,"down")):E(Y,O,be.x,be.y,"down")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return be=ce.focus.getNode(),c(be)?(be=O.getCordsFromCellNode(be,Y.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(Y,O,be.x,be.y,"down")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_UP_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,O))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ge=t.$findMatchingParent(ce.anchor.getNode(),ne=>c(ne));if(!c(ge))return!1;var be=O.getCordsFromCellNode(ge,Y.grid);if(ce=t.$findMatchingParent(ce.anchor.getNode(),ne=>e.$isElementNode(ne)),ce==null)throw Error("Expected BlockNode Parent");if((ge=ge.getLastChild())&&ce.isParentOf(ge)||ce===ge||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(be.x,be.y,Y.grid)),I(Y,O,be.x,be.y,"up")):E(Y,O,be.x,be.y,"up")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return be=ce.focus.getNode(),c(be)?(be=O.getCordsFromCellNode(be,Y.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(Y,O,be.x,be.y,"up")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_LEFT_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,O))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ge=t.$findMatchingParent(ce.anchor.getNode(),be=>c(be));if(!c(ge))return!1;if(ge=O.getCordsFromCellNode(ge,Y.grid),t.$findMatchingParent(ce.anchor.getNode(),be=>e.$isElementNode(be))==null)throw Error("Expected BlockNode Parent");if(ce.anchor.offset===0||de.shiftKey)return de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),de.shiftKey?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(ge.x,ge.y,Y.grid)),I(Y,O,ge.x,ge.y,"backward")):E(Y,O,ge.x,ge.y,"backward")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return ce=ce.focus.getNode(),c(ce)?(ce=O.getCordsFromCellNode(ce,Y.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(Y,O,ce.x,ce.y,"backward")):!1;return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.KEY_ARROW_RIGHT_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,O))return!1;if(e.$isRangeSelection(ce)){if(ce.isCollapsed()){var ge=t.$findMatchingParent(ce.anchor.getNode(),be=>c(be));if(!c(ge))return!1;if(ge=O.getCordsFromCellNode(ge,Y.grid),t.$findMatchingParent(ce.anchor.getNode(),be=>e.$isElementNode(be))==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?(Y.setAnchorCellForSelection(O.getCellFromCordsOrThrow(ge.x,ge.y,Y.grid)),I(Y,O,ge.x,ge.y,"forward")):E(Y,O,ge.x,ge.y,"forward")}}else if(e.DEPRECATED_$isGridSelection(ce)&&de.shiftKey)return ce=ce.focus.getNode(),c(ce)?(ce=O.getCordsFromCellNode(ce,Y.grid),de.preventDefault(),de.stopImmediatePropagation(),de.stopPropagation(),I(Y,O,ce.x,ce.y,"forward")):!1;return!1},e.COMMAND_PRIORITY_HIGH));let ye=de=>()=>{var ce=e.$getSelection();if(!L(ce,O))return!1;if(e.DEPRECATED_$isGridSelection(ce))return Y.clearText(),!0;if(e.$isRangeSelection(ce)){const ne=t.$findMatchingParent(ce.anchor.getNode(),ae=>c(ae));if(!c(ne))return!1;var ge=ce.anchor.getNode(),be=ce.focus.getNode();if(ge=O.isParentOf(ge),be=O.isParentOf(be),ge&&!be||be&&!ge)return Y.clearText(),!0;if(ge=(be=t.$findMatchingParent(ce.anchor.getNode(),ae=>e.$isElementNode(ae)))&&t.$findMatchingParent(be,ae=>e.$isElementNode(ae)&&c(ae.getParent())),!e.$isElementNode(ge)||!e.$isElementNode(be))return!1;if(de===e.DELETE_LINE_COMMAND&&ge.getPreviousSibling()===null)return!0;if((de===e.DELETE_CHARACTER_COMMAND||de===e.DELETE_WORD_COMMAND)&&ce.isCollapsed()&&ce.anchor.offset===0&&be!==ge){ce=be.getChildren();const ae=e.$createParagraphNode();return ce.forEach(fe=>ae.append(fe)),be.replace(ae),be.getWritable().__parent=ne.getKey(),!0}}return!1};[e.DELETE_WORD_COMMAND,e.DELETE_LINE_COMMAND,e.DELETE_CHARACTER_COMMAND].forEach(de=>{Y.listenersToRemove.add(H.registerCommand(de,ye(de),e.COMMAND_PRIORITY_CRITICAL))});let me=de=>{const ce=e.$getSelection();return L(ce,O)?e.DEPRECATED_$isGridSelection(ce)?(de.preventDefault(),de.stopPropagation(),Y.clearText(),!0):(e.$isRangeSelection(ce)&&(de=t.$findMatchingParent(ce.anchor.getNode(),ge=>c(ge)),c(de)),!1):!1};return Y.listenersToRemove.add(H.registerCommand(e.KEY_BACKSPACE_COMMAND,me,e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.KEY_DELETE_COMMAND,me,e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.FORMAT_TEXT_COMMAND,de=>{let ce=e.$getSelection();return L(ce,O)?e.DEPRECATED_$isGridSelection(ce)?(Y.formatCells(de),!0):(e.$isRangeSelection(ce)&&(de=t.$findMatchingParent(ce.anchor.getNode(),ge=>c(ge)),c(de)),!1):!1},e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.CONTROLLED_TEXT_INSERTION_COMMAND,()=>{var de=e.$getSelection();return L(de,O)&&(e.DEPRECATED_$isGridSelection(de)?Y.clearHighlight():e.$isRangeSelection(de)&&(de=t.$findMatchingParent(de.anchor.getNode(),ce=>c(ce)),c(de))),!1},e.COMMAND_PRIORITY_CRITICAL)),Y.listenersToRemove.add(H.registerCommand(e.KEY_TAB_COMMAND,de=>{var ce=e.$getSelection();if(!L(ce,O))return!1;if(e.$isRangeSelection(ce)){let ge=t.$findMatchingParent(ce.anchor.getNode(),be=>c(be));if(!c(ge))return!1;if(ce.isCollapsed())return ce=O.getCordsFromCellNode(ge,Y.grid),de.preventDefault(),E(Y,O,ce.x,ce.y,de.shiftKey?"backward":"forward"),!0}return!1},e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.FOCUS_COMMAND,()=>O.isSelected(),e.COMMAND_PRIORITY_HIGH)),Y.listenersToRemove.add(H.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>{let de=e.$getSelection();var ce=e.$getPreviousSelection();if(de&&e.$isRangeSelection(de)&&!de.isCollapsed()){var ge=de.anchor.getNode(),be=de.focus.getNode();ge=O.isParentOf(ge);var ne=O.isParentOf(be);if(be=ge&&!ne||ne&&!ge,ge=ge&&ne&&!O.isSelected(),be)return ce=de.isBackward(),ge=e.$createRangeSelection(),be=O.getKey(),ge.anchor.set(de.anchor.key,de.anchor.offset,de.anchor.type),ge.focus.set(be,ce?0:O.getChildrenSize(),"element"),X=!0,e.$setSelection(ge),A(Y),!0;if(ge&&({grid:ge}=Y,de.getNodes().filter(c).length===ge.rows*ge.columns)){ge=e.DEPRECATED_$createGridSelection(),be=O.getKey(),ne=O.getFirstChildOrThrow().getFirstChild();let ae=O.getLastChildOrThrow().getLastChild();if(ne!=null&&ae!=null)return ge.set(be,ne.getKey(),ae.getKey()),e.$setSelection(ge),Y.updateTableGridSelection(ge),!0}}return de&&!de.is(ce)&&(e.DEPRECATED_$isGridSelection(de)||e.DEPRECATED_$isGridSelection(ce))&&Y.gridSelection&&!Y.gridSelection.is(ce)?(e.DEPRECATED_$isGridSelection(de)&&de.gridKey===Y.tableNodeKey?Y.updateTableGridSelection(de):!e.DEPRECATED_$isGridSelection(de)&&e.DEPRECATED_$isGridSelection(ce)&&ce.gridKey===Y.tableNodeKey&&Y.updateTableGridSelection(null),!1):(Y.hasHijackedSelectionStyles&&!O.isSelected()?(S(Y),X=!1):!Y.hasHijackedSelectionStyles&&O.isSelected()&&A(Y),!1)},e.COMMAND_PRIORITY_CRITICAL)),Y},hi.getCellFromTarget=y,hi.getTableSelectionFromTableElement=function(O){return O.__lexicalTableSelection},hi}var XH,gme;function xOt(){return gme||(gme=1,XH=fOt()),XH}var e_=xOt(),m$={},fme;function yOt(){if(fme)return m$;fme=1;var e=EM(),t=Ad(),r=Rc(),n=Ta(),a=Tc();function l(f,x){for(let y=0;y<x.length;y++){let b=x[y](f);if(b)return b}return null}let c=/[.,;\s]/;function d(f){f=f.getPreviousSibling(),n.$isElementNode(f)&&(f=f.getLastDescendant());var x;return!(x=f===null||n.$isLineBreakNode(f))&&(x=n.$isTextNode(f))&&(f=f.getTextContent(),x=c.test(f[f.length-1])),x}function p(f){return f=f.getNextSibling(),n.$isElementNode(f)&&(f=f.getFirstDescendant()),f===null||n.$isLineBreakNode(f)||n.$isTextNode(f)&&c.test(f.getTextContent()[0])}function u(f,x,y){var b=f.getChildren();let w=b.length;for(let v=0;v<w;v++){let A=b[v];if(!n.$isTextNode(A)||!A.isSimpleText()){h(f),y(null,f.getURL());return}}b=f.getTextContent(),x=l(b,x),x===null||x.text!==b?(h(f),y(null,f.getURL())):d(f)&&p(f)?(b=f.getURL(),b!==x.url&&(f.setURL(x.url),y(x.url,b)),x.attributes&&(b=f.getRel(),b!==x.attributes.rel&&(f.setRel(x.attributes.rel||null),y(x.attributes.rel||null,b)),b=f.getTarget(),b!==x.attributes.target&&(f.setTarget(x.attributes.target||null),y(x.attributes.target||null,b)))):(h(f),y(null,f.getURL()))}function h(f){let x=f.getChildren();var y=x.length;for(--y;0<=y;y--)f.insertAfter(x[y]);return f.remove(),x.map(b=>b.getLatest())}function m(f,x,y){a.useEffect(()=>{if(!f.hasNodes([e.AutoLinkNode]))throw Error("Minified Lexical error #77; visit https://lexical.dev/docs/error?code=77 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let b=(w,v)=>{y&&y(w,v)};return r.mergeRegister(f.registerNodeTransform(n.TextNode,w=>{var v=w.getParentOrThrow(),A=w.getPreviousSibling();if(e.$isAutoLinkNode(v))u(v,x,b);else if(!e.$isLinkNode(v)){if(w.isSimpleText()&&(c.test(w.getTextContent()[0])||!e.$isAutoLinkNode(A))){A=v=w.getTextContent();let P=0,T=w;for(var S;(S=l(A,x))&&S!==null;){let z=S.index,N=S.length,K=z+N;var E=P+z,I=P+K,L=v,M=w;if((0<E?c.test(L[E-1]):d(M))&&(I<L.length?c.test(L[I]):p(M))){var D=void 0;P+z===0?[D,T]=T.splitText(P+N):[,D,T]=T.splitText(P+z,P+z+N),E=e.$createAutoLinkNode(S.url,S.attributes),I=n.$createTextNode(S.text),I.setFormat(D.getFormat()),I.setDetail(D.getDetail()),E.append(I),D.replace(E),y&&y(S.url,null),P=0}else P+=K;A=A.substring(K)}}v=w.getPreviousSibling(),S=w.getNextSibling(),D=w.getTextContent(),e.$isAutoLinkNode(v)&&!c.test(D[0])&&(v.append(w),u(v,x,b),w=v.getURL(),y&&y(null,w)),e.$isAutoLinkNode(S)&&!c.test(D[D.length-1])&&(h(S),u(S,x,b),w=S.getURL(),y&&y(null,w))}}))},[f,x,y])}return m$.AutoLinkPlugin=function({matchers:f,onChange:x}){let[y]=t.useLexicalComposerContext();return m(y,f,x),null},m$.createLinkMatcherWithRegExp=function(f,x=y=>y){return y=>{let b=f.exec(y);return b===null?null:{index:b.index,length:b[0].length,text:b[0],url:x(y)}}},m$}var t_,xme;function bOt(){return xme||(xme=1,t_=yOt()),t_}var wOt=bOt(),lw={};lw.d=(e,t)=>{for(var r in t)lw.o(t,r)&&!lw.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})};lw.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var dr=globalThis.pdfjsLib={};lw.d(dr,{AbortException:()=>p5,AnnotationEditorLayer:()=>B0,AnnotationEditorParamsType:()=>gr,AnnotationEditorType:()=>ai,AnnotationEditorUIManager:()=>yg,AnnotationLayer:()=>yHt,AnnotationMode:()=>Fm,CMapCompressionType:()=>kY,ColorPicker:()=>Uu,DOMSVGFactory:()=>kX,DrawLayer:()=>nl,FeatureTest:()=>vc,GlobalWorkerOptions:()=>ov,ImageKind:()=>nE,InvalidPDFException:()=>Uze,MissingPDFException:()=>d5,OPS:()=>J1,Outliner:()=>PY,PDFDataRangeTransport:()=>lRe,PDFDateString:()=>Zze,PDFWorker:()=>Ud,PasswordResponses:()=>$Ot,PermissionFlag:()=>AOt,PixelsPerInch:()=>Q8,RenderingCancelledException:()=>SX,TextLayer:()=>PL,UnexpectedResponseException:()=>MM,Util:()=>jo,VerbosityLevel:()=>LM,XfaLayer:()=>dRe,build:()=>JNt,createValidAbsoluteUrl:()=>LOt,fetchData:()=>RM,getDocument:()=>VNt,getFilenameFromUrl:()=>FOt,getPdfFilenameFromUrl:()=>OOt,getXfaPageViewport:()=>NOt,isDataScheme:()=>EX,isPdfFile:()=>LX,noContextMenu:()=>Ec,normalizeUnicode:()=>DOt,renderTextLayer:()=>DNt,setLayerDimensions:()=>H4,shadow:()=>mi,updateTextLayer:()=>TNt,version:()=>ZNt});const ul=typeof T0=="object"&&T0+""=="[object process]"&&!T0.versions.nw&&!(T0.versions.electron&&T0.type&&T0.type!=="browser"),Qze=[1,0,0,1,0,0],$Y=[.001,0,0,.001,0,0],vOt=1e7,o_=1.35,Nd={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},Fm={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},COt="pdfjs_internal_editor_",ai={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},gr={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},AOt={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},il={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},nE={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Ha={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},py={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},LM={ERRORS:0,WARNINGS:1,INFOS:5},kY={NONE:0,BINARY:1},J1={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},$Ot={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let IM=LM.WARNINGS;function kOt(e){Number.isInteger(e)&&(IM=e)}function SOt(){return IM}function jM(e){IM>=LM.INFOS&&console.log(`Info: ${e}`)}function Nr(e){IM>=LM.WARNINGS&&console.log(`Warning: ${e}`)}function Gi(e){throw new Error(e)}function Wa(e,t){e||Gi(t)}function EOt(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function LOt(e,t=null,r=null){if(!e)return null;try{if(r&&typeof e=="string"&&(r.addDefaultProtocol&&e.startsWith("www.")&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),r.tryConvertEncoding))try{e=POt(e)}catch{}const n=t?new URL(e,t):new URL(e);if(EOt(n))return n}catch{}return null}function mi(e,t,r,n=!1){return Object.defineProperty(e,t,{value:r,enumerable:!n,configurable:!0,writable:!1}),r}const Dg=(function(){function t(r,n){this.constructor===t&&Gi("Cannot initialize BaseException."),this.message=r,this.name=n}return t.prototype=new Error,t.constructor=t,t})();class SY extends Dg{constructor(t,r){super(t,"PasswordException"),this.code=r}}class EY extends Dg{constructor(t,r){super(t,"UnknownErrorException"),this.details=r}}class Uze extends Dg{constructor(t){super(t,"InvalidPDFException")}}class d5 extends Dg{constructor(t){super(t,"MissingPDFException")}}class MM extends Dg{constructor(t,r){super(t,"UnexpectedResponseException"),this.status=r}}class IOt extends Dg{constructor(t){super(t,"FormatError")}}class p5 extends Dg{constructor(t){super(t,"AbortException")}}function Wze(e){(typeof e!="object"||e?.length===void 0)&&Gi("Invalid argument for bytesToString");const t=e.length,r=8192;if(t<r)return String.fromCharCode.apply(null,e);const n=[];for(let a=0;a<t;a+=r){const l=Math.min(a+r,t),c=e.subarray(a,l);n.push(String.fromCharCode.apply(null,c))}return n.join("")}function BM(e){typeof e!="string"&&Gi("Invalid argument for stringToBytes");const t=e.length,r=new Uint8Array(t);for(let n=0;n<t;++n)r[n]=e.charCodeAt(n)&255;return r}function jOt(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function AX(e){const t=Object.create(null);for(const[r,n]of e)t[r]=n;return t}function MOt(){const e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function BOt(){try{return new Function(""),!0}catch{return!1}}class vc{static get isLittleEndian(){return mi(this,"isLittleEndian",MOt())}static get isEvalSupported(){return mi(this,"isEvalSupported",BOt())}static get isOffscreenCanvasSupported(){return mi(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?mi(this,"platform",{isMac:navigator.platform.includes("Mac")}):mi(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return mi(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const r_=Array.from(Array(256).keys(),e=>e.toString(16).padStart(2,"0"));class jo{static makeHexColor(t,r,n){return`#${r_[t]}${r_[r]}${r_[n]}`}static scaleMinMax(t,r){let n;t[0]?(t[0]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=t[0],r[2]*=t[0],t[3]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=t[3],r[3]*=t[3]):(n=r[0],r[0]=r[1],r[1]=n,n=r[2],r[2]=r[3],r[3]=n,t[1]<0&&(n=r[1],r[1]=r[3],r[3]=n),r[1]*=t[1],r[3]*=t[1],t[2]<0&&(n=r[0],r[0]=r[2],r[2]=n),r[0]*=t[2],r[2]*=t[2]),r[0]+=t[4],r[1]+=t[5],r[2]+=t[4],r[3]+=t[5]}static transform(t,r){return[t[0]*r[0]+t[2]*r[1],t[1]*r[0]+t[3]*r[1],t[0]*r[2]+t[2]*r[3],t[1]*r[2]+t[3]*r[3],t[0]*r[4]+t[2]*r[5]+t[4],t[1]*r[4]+t[3]*r[5]+t[5]]}static applyTransform(t,r){const n=t[0]*r[0]+t[1]*r[2]+r[4],a=t[0]*r[1]+t[1]*r[3]+r[5];return[n,a]}static applyInverseTransform(t,r){const n=r[0]*r[3]-r[1]*r[2],a=(t[0]*r[3]-t[1]*r[2]+r[2]*r[5]-r[4]*r[3])/n,l=(-t[0]*r[1]+t[1]*r[0]+r[4]*r[1]-r[5]*r[0])/n;return[a,l]}static getAxialAlignedBoundingBox(t,r){const n=this.applyTransform(t,r),a=this.applyTransform(t.slice(2,4),r),l=this.applyTransform([t[0],t[3]],r),c=this.applyTransform([t[2],t[1]],r);return[Math.min(n[0],a[0],l[0],c[0]),Math.min(n[1],a[1],l[1],c[1]),Math.max(n[0],a[0],l[0],c[0]),Math.max(n[1],a[1],l[1],c[1])]}static inverseTransform(t){const r=t[0]*t[3]-t[1]*t[2];return[t[3]/r,-t[1]/r,-t[2]/r,t[0]/r,(t[2]*t[5]-t[4]*t[3])/r,(t[4]*t[1]-t[5]*t[0])/r]}static singularValueDecompose2dScale(t){const r=[t[0],t[2],t[1],t[3]],n=t[0]*r[0]+t[1]*r[2],a=t[0]*r[1]+t[1]*r[3],l=t[2]*r[0]+t[3]*r[2],c=t[2]*r[1]+t[3]*r[3],d=(n+c)/2,p=Math.sqrt((n+c)**2-4*(n*c-l*a))/2,u=d+p||1,h=d-p||1;return[Math.sqrt(u),Math.sqrt(h)]}static normalizeRect(t){const r=t.slice(0);return t[0]>t[2]&&(r[0]=t[2],r[2]=t[0]),t[1]>t[3]&&(r[1]=t[3],r[3]=t[1]),r}static intersect(t,r){const n=Math.max(Math.min(t[0],t[2]),Math.min(r[0],r[2])),a=Math.min(Math.max(t[0],t[2]),Math.max(r[0],r[2]));if(n>a)return null;const l=Math.max(Math.min(t[1],t[3]),Math.min(r[1],r[3])),c=Math.min(Math.max(t[1],t[3]),Math.max(r[1],r[3]));return l>c?null:[n,l,a,c]}static#e(t,r,n,a,l,c,d,p,u,h){if(u<=0||u>=1)return;const m=1-u,f=u*u,x=f*u,y=m*(m*(m*t+3*u*r)+3*f*n)+x*a,b=m*(m*(m*l+3*u*c)+3*f*d)+x*p;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],b),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],b)}static#t(t,r,n,a,l,c,d,p,u,h,m,f){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&this.#e(t,r,n,a,l,c,d,p,-m/h,f);return}const x=h**2-4*m*u;if(x<0)return;const y=Math.sqrt(x),b=2*u;this.#e(t,r,n,a,l,c,d,p,(-h+y)/b,f),this.#e(t,r,n,a,l,c,d,p,(-h-y)/b,f)}static bezierBoundingBox(t,r,n,a,l,c,d,p,u){return u?(u[0]=Math.min(u[0],t,d),u[1]=Math.min(u[1],r,p),u[2]=Math.max(u[2],t,d),u[3]=Math.max(u[3],r,p)):u=[Math.min(t,d),Math.min(r,p),Math.max(t,d),Math.max(r,p)],this.#t(t,n,l,d,r,a,c,p,3*(-t+3*(n-l)+d),6*(t-2*n+l),3*(n-t),u),this.#t(t,n,l,d,r,a,c,p,3*(-r+3*(a-c)+p),6*(r-2*a+c),3*(a-r),u),u}}function POt(e){return decodeURIComponent(escape(e))}let i_=null,yme=null;function DOt(e){return i_||(i_=/([\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,yme=new Map([["ſt","ſt"]])),e.replaceAll(i_,(t,r,n)=>r?r.normalize("NFKC"):yme.get(n))}function TOt(){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 Wze(e)}const Gze="pdfjs_internal_id_",w0={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 PM{constructor(){this.constructor===PM&&Gi("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,r){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,r,n,a,l){return"none"}destroy(t=!1){}}class DM{#e=!1;constructor({enableHWA:t=!1}={}){this.constructor===DM&&Gi("Cannot initialize BaseCanvasFactory."),this.#e=t}create(t,r){if(t<=0||r<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(t,r);return{canvas:n,context:n.getContext("2d",{willReadFrequently:!this.#e})}}reset(t,r,n){if(!t.canvas)throw new Error("Canvas is not specified");if(r<=0||n<=0)throw new Error("Invalid canvas size");t.canvas.width=r,t.canvas.height=n}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,r){Gi("Abstract method `_createCanvas` called.")}}class TM{constructor({baseUrl:t=null,isCompressed:r=!0}){this.constructor===TM&&Gi("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=r}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const r=this.baseUrl+t+(this.isCompressed?".bcmap":""),n=this.isCompressed?kY.BINARY:kY.NONE;return this._fetchData(r,n).catch(a=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${r}`)})}_fetchData(t,r){Gi("Abstract method `_fetchData` called.")}}class zM{constructor({baseUrl:t=null}){this.constructor===zM&&Gi("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const r=`${this.baseUrl}${t}`;return this._fetchData(r).catch(n=>{throw new Error(`Unable to load font data at: ${r}`)})}_fetchData(t){Gi("Abstract method `_fetchData` called.")}}class $X{constructor(){this.constructor===$X&&Gi("Cannot initialize BaseSVGFactory.")}create(t,r,n=!1){if(t<=0||r<=0)throw new Error("Invalid SVG dimensions");const a=this._createSVG("svg:svg");return a.setAttribute("version","1.1"),n||(a.setAttribute("width",`${t}px`),a.setAttribute("height",`${r}px`)),a.setAttribute("preserveAspectRatio","none"),a.setAttribute("viewBox",`0 0 ${t} ${r}`),a}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){Gi("Abstract method `_createSVG` called.")}}const E0="http://www.w3.org/2000/svg";class Q8{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}class zOt extends PM{#e;#t;#o;#i;#s;#r=0;constructor({docId:t,ownerDocument:r=globalThis.document}={}){super(),this.#o=t,this.#i=r}get#n(){return this.#e||=new Map}get#l(){return this.#s||=new Map}get#d(){if(!this.#t){const t=this.#i.createElement("div"),{style:r}=t;r.visibility="hidden",r.contain="strict",r.width=r.height=0,r.position="absolute",r.top=r.left=0,r.zIndex=-1;const n=this.#i.createElementNS(E0,"svg");n.setAttribute("width",0),n.setAttribute("height",0),this.#t=this.#i.createElementNS(E0,"defs"),t.append(n),n.append(this.#t),this.#i.body.append(t)}return this.#t}#p(t){if(t.length===1){const p=t[0],u=new Array(256);for(let m=0;m<256;m++)u[m]=p[m]/255;const h=u.join(",");return[h,h,h]}const[r,n,a]=t,l=new Array(256),c=new Array(256),d=new Array(256);for(let p=0;p<256;p++)l[p]=r[p]/255,c[p]=n[p]/255,d[p]=a[p]/255;return[l.join(","),c.join(","),d.join(",")]}addFilter(t){if(!t)return"none";let r=this.#n.get(t);if(r)return r;const[n,a,l]=this.#p(t),c=t.length===1?n:`${n}${a}${l}`;if(r=this.#n.get(c),r)return this.#n.set(t,r),r;const d=`g_${this.#o}_transfer_map_${this.#r++}`,p=`url(#${d})`;this.#n.set(t,p),this.#n.set(c,p);const u=this.#a(d);return this.#f(n,a,l,u),p}addHCMFilter(t,r){const n=`${t}-${r}`,a="base";let l=this.#l.get(a);if(l?.key===n||(l?(l.filter?.remove(),l.key=n,l.url="none",l.filter=null):(l={key:n,url:"none",filter:null},this.#l.set(a,l)),!t||!r))return l.url;const c=this.#y(t);t=jo.makeHexColor(...c);const d=this.#y(r);if(r=jo.makeHexColor(...d),this.#d.style.color="",t==="#000000"&&r==="#ffffff"||t===r)return l.url;const p=new Array(256);for(let x=0;x<=255;x++){const y=x/255;p[x]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}const u=p.join(","),h=`g_${this.#o}_hcm_filter`,m=l.filter=this.#a(h);this.#f(u,u,u,m),this.#c(m);const f=(x,y)=>{const b=c[x]/255,w=d[x]/255,v=new Array(y+1);for(let A=0;A<=y;A++)v[A]=b+A/y*(w-b);return v.join(",")};return this.#f(f(0,5),f(1,5),f(2,5),m),l.url=`url(#${h})`,l.url}addAlphaFilter(t){let r=this.#n.get(t);if(r)return r;const[n]=this.#p([t]),a=`alpha_${n}`;if(r=this.#n.get(a),r)return this.#n.set(t,r),r;const l=`g_${this.#o}_alpha_map_${this.#r++}`,c=`url(#${l})`;this.#n.set(t,c),this.#n.set(a,c);const d=this.#a(l);return this.#u(n,d),c}addLuminosityFilter(t){let r=this.#n.get(t||"luminosity");if(r)return r;let n,a;if(t?([n]=this.#p([t]),a=`luminosity_${n}`):a="luminosity",r=this.#n.get(a),r)return this.#n.set(t,r),r;const l=`g_${this.#o}_luminosity_map_${this.#r++}`,c=`url(#${l})`;this.#n.set(t,c),this.#n.set(a,c);const d=this.#a(l);return this.#h(d),t&&this.#u(n,d),c}addHighlightHCMFilter(t,r,n,a,l){const c=`${r}-${n}-${a}-${l}`;let d=this.#l.get(t);if(d?.key===c||(d?(d.filter?.remove(),d.key=c,d.url="none",d.filter=null):(d={key:c,url:"none",filter:null},this.#l.set(t,d)),!r||!n))return d.url;const[p,u]=[r,n].map(this.#y.bind(this));let h=Math.round(.2126*p[0]+.7152*p[1]+.0722*p[2]),m=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),[f,x]=[a,l].map(this.#y.bind(this));m<h&&([h,m,f,x]=[m,h,x,f]),this.#d.style.color="";const y=(v,A,S)=>{const E=new Array(256),I=(m-h)/S,L=v/255,M=(A-v)/(255*S);let D=0;for(let P=0;P<=S;P++){const T=Math.round(h+P*I),z=L+P*M;for(let N=D;N<=T;N++)E[N]=z;D=T+1}for(let P=D;P<256;P++)E[P]=E[D-1];return E.join(",")},b=`g_${this.#o}_hcm_${t}_filter`,w=d.filter=this.#a(b);return this.#c(w),this.#f(y(f[0],x[0],5),y(f[1],x[1],5),y(f[2],x[2],5),w),d.url=`url(#${b})`,d.url}destroy(t=!1){t&&this.#l.size!==0||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#r=0)}#h(t){const r=this.#i.createElementNS(E0,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(r)}#c(t){const r=this.#i.createElementNS(E0,"feColorMatrix");r.setAttribute("type","matrix"),r.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(r)}#a(t){const r=this.#i.createElementNS(E0,"filter");return r.setAttribute("color-interpolation-filters","sRGB"),r.setAttribute("id",t),this.#d.append(r),r}#m(t,r,n){const a=this.#i.createElementNS(E0,r);a.setAttribute("type","discrete"),a.setAttribute("tableValues",n),t.append(a)}#f(t,r,n,a){const l=this.#i.createElementNS(E0,"feComponentTransfer");a.append(l),this.#m(l,"feFuncR",t),this.#m(l,"feFuncG",r),this.#m(l,"feFuncB",n)}#u(t,r){const n=this.#i.createElementNS(E0,"feComponentTransfer");r.append(n),this.#m(n,"feFuncA",t)}#y(t){return this.#d.style.color=t,IX(getComputedStyle(this.#d).getPropertyValue("color"))}}class ROt extends DM{constructor({ownerDocument:t=globalThis.document,enableHWA:r=!1}={}){super({enableHWA:r}),this._document=t}_createCanvas(t,r){const n=this._document.createElement("canvas");return n.width=t,n.height=r,n}}async function RM(e,t="text"){if(bb(e,document.baseURI)){const r=await fetch(e);if(!r.ok)throw new Error(r.statusText);switch(t){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"json":return r.json()}return r.text()}return new Promise((r,n)=>{const a=new XMLHttpRequest;a.open("GET",e,!0),a.responseType=t,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){switch(t){case"arraybuffer":case"blob":case"json":r(a.response);return}r(a.responseText);return}n(new Error(a.statusText))}},a.send(null)})}class Yze extends TM{_fetchData(t,r){return RM(t,this.isCompressed?"arraybuffer":"text").then(n=>({cMapData:n instanceof ArrayBuffer?new Uint8Array(n):BM(n),compressionType:r}))}}class Kze extends zM{_fetchData(t){return RM(t,"arraybuffer").then(r=>new Uint8Array(r))}}class kX extends $X{_createSVG(t){return document.createElementNS(E0,t)}}class hC{constructor({viewBox:t,scale:r,rotation:n,offsetX:a=0,offsetY:l=0,dontFlip:c=!1}){this.viewBox=t,this.scale=r,this.rotation=n,this.offsetX=a,this.offsetY=l;const d=(t[2]+t[0])/2,p=(t[3]+t[1])/2;let u,h,m,f;switch(n%=360,n<0&&(n+=360),n){case 180:u=-1,h=0,m=0,f=1;break;case 90:u=0,h=1,m=1,f=0;break;case 270:u=0,h=-1,m=-1,f=0;break;case 0:u=1,h=0,m=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}c&&(m=-m,f=-f);let x,y,b,w;u===0?(x=Math.abs(p-t[1])*r+a,y=Math.abs(d-t[0])*r+l,b=(t[3]-t[1])*r,w=(t[2]-t[0])*r):(x=Math.abs(d-t[0])*r+a,y=Math.abs(p-t[1])*r+l,b=(t[2]-t[0])*r,w=(t[3]-t[1])*r),this.transform=[u*r,h*r,m*r,f*r,x-u*r*d-m*r*p,y-h*r*d-f*r*p],this.width=b,this.height=w}get rawDims(){const{viewBox:t}=this;return mi(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:r=this.rotation,offsetX:n=this.offsetX,offsetY:a=this.offsetY,dontFlip:l=!1}={}){return new hC({viewBox:this.viewBox.slice(),scale:t,rotation:r,offsetX:n,offsetY:a,dontFlip:l})}convertToViewportPoint(t,r){return jo.applyTransform([t,r],this.transform)}convertToViewportRectangle(t){const r=jo.applyTransform([t[0],t[1]],this.transform),n=jo.applyTransform([t[2],t[3]],this.transform);return[r[0],r[1],n[0],n[1]]}convertToPdfPoint(t,r){return jo.applyInverseTransform([t,r],this.transform)}}class SX extends Dg{constructor(t,r=0){super(t,"RenderingCancelledException"),this.extraDelay=r}}function EX(e){const t=e.length;let r=0;for(;r<t&&e[r].trim()==="";)r++;return e.substring(r,r+5).toLowerCase()==="data:"}function LX(e){return typeof e=="string"&&/\.pdf$/i.test(e)}function FOt(e){return[e]=e.split(/[#?]/,1),e.substring(e.lastIndexOf("/")+1)}function OOt(e,t="document.pdf"){if(typeof e!="string")return t;if(EX(e))return Nr('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,a=r.exec(e);let l=n.exec(a[1])||n.exec(a[2])||n.exec(a[3]);if(l&&(l=l[0],l.includes("%")))try{l=n.exec(decodeURIComponent(l))[0]}catch{}return l||t}class bme{started=Object.create(null);times=[];time(t){t in this.started&&Nr(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||Nr(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let r=0;for(const{name:n}of this.times)r=Math.max(n.length,r);for(const{name:n,start:a,end:l}of this.times)t.push(`${n.padEnd(r)} ${l-a}ms
|
|
246
|
-
`);return t.join("")}}function bb(e,t){try{const{protocol:r}=t?new URL(e,t):new URL(e);return r==="http:"||r==="https:"}catch{return!1}}function Ec(e){e.preventDefault()}function qze(e){console.log("Deprecated API usage: "+e)}let wme;class Zze{static toDateObject(t){if(!t||typeof t!="string")return null;wme||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const r=wme.exec(t);if(!r)return null;const n=parseInt(r[1],10);let a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let l=parseInt(r[3],10);l=l>=1&&l<=31?l:1;let c=parseInt(r[4],10);c=c>=0&&c<=23?c:0;let d=parseInt(r[5],10);d=d>=0&&d<=59?d:0;let p=parseInt(r[6],10);p=p>=0&&p<=59?p:0;const u=r[7]||"Z";let h=parseInt(r[8],10);h=h>=0&&h<=23?h:0;let m=parseInt(r[9],10)||0;return m=m>=0&&m<=59?m:0,u==="-"?(c+=h,d+=m):u==="+"&&(c-=h,d-=m),new Date(Date.UTC(n,a,l,c,d,p))}}function NOt(e,{scale:t=1,rotation:r=0}){const{width:n,height:a}=e.attributes.style,l=[0,0,parseInt(n),parseInt(a)];return new hC({viewBox:l,scale:t,rotation:r})}function IX(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):(Nr(`Not a valid color format: "${e}"`),[0,0,0])}function HOt(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const r of e.keys()){t.style.color=r;const n=window.getComputedStyle(t).color;e.set(r,IX(n))}t.remove()}function Pn(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform();return[t,r,n,a,l,c]}function v0(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform().invertSelf();return[t,r,n,a,l,c]}function H4(e,t,r=!1,n=!0){if(t instanceof hC){const{pageWidth:a,pageHeight:l}=t.rawDims,{style:c}=e,d=vc.isCSSRoundSupported,p=`var(--scale-factor) * ${a}px`,u=`var(--scale-factor) * ${l}px`,h=d?`round(${p}, 1px)`:`calc(${p})`,m=d?`round(${u}, 1px)`:`calc(${u})`;!r||t.rotation%180===0?(c.width=h,c.height=m):(c.width=m,c.height=h)}n&&e.setAttribute("data-main-rotation",t.rotation)}class jX{#e=null;#t=null;#o;#i=null;constructor(t){this.#o=t}render(){const t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");const r=this.#o._uiManager._signal;t.addEventListener("contextmenu",Ec,{signal:r}),t.addEventListener("pointerdown",jX.#s,{signal:r});const n=this.#i=document.createElement("div");n.className="buttons",t.append(n);const a=this.#o.toolbarPosition;if(a){const{style:l}=t,c=this.#o._uiManager.direction==="ltr"?1-a[0]:a[0];l.insetInlineEnd=`${100*c}%`,l.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}static#s(t){t.stopPropagation()}#r(t){this.#o._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#n(t){this.#o._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#l(t){const r=this.#o._uiManager._signal;t.addEventListener("focusin",this.#r.bind(this),{capture:!0,signal:r}),t.addEventListener("focusout",this.#n.bind(this),{capture:!0,signal:r}),t.addEventListener("contextmenu",Ec,{signal:r})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden")}#d(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#o.editorType}-button`),this.#l(t),t.addEventListener("click",r=>{this.#o._uiManager.delete()},{signal:this.#o._uiManager._signal}),this.#i.append(t)}get#p(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#l(t),this.#i.prepend(t,this.#p)}addColorPicker(t){this.#t=t;const r=t.renderButton();this.#l(r),this.#i.prepend(r,this.#p)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class _Ot{#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",Ec,{signal:this.#o._signal});const r=this.#e=document.createElement("div");return r.className="buttons",t.append(r),this.#r(),t}#s(t,r){let n=0,a=0;for(const l of t){const c=l.y+l.height;if(c<n)continue;const d=l.x+(r?l.width:0);if(c>n){a=d,n=c;continue}r?d>a&&(a=d):d<a&&(a=d)}return[r?1-a:a,n]}show(t,r,n){const[a,l]=this.#s(r,n),{style:c}=this.#t||=this.#i();t.append(this.#t),c.insetInlineEnd=`${100*a}%`,c.top=`calc(${100*l}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#r(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const r=document.createElement("span");t.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#o._signal;t.addEventListener("contextmenu",Ec,{signal:n}),t.addEventListener("click",()=>{this.#o.highlightSelection("floating_button")},{signal:n}),this.#e.append(t)}}function ML(e,t,r){for(const n of r)t.addEventListener(n,e[n].bind(e))}function VOt(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}class QOt{#e=0;get id(){return`${COt}${this.#e++}`}}class MX{#e=TOt();#t=0;#o=null;static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=t;const l=a.decode().then(()=>(n.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return mi(this,"_isSVGFittingCanvas",l)}async#i(t,r){this.#o||=new Map;let n=this.#o.get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof r=="string"?(n.url=r,a=await RM(r,"blob")):a=n.file=r,a.type==="image/svg+xml"){const l=MX._isSVGFittingCanvas,c=new FileReader,d=new Image,p=new Promise((u,h)=>{d.onload=()=>{n.bitmap=d,n.isSvg=!0,u()},c.onload=async()=>{const m=n.svgUrl=c.result;d.src=await l?`${m}#svgView(preserveAspectRatio(none))`:m},d.onerror=c.onerror=h});c.readAsDataURL(a),await p}else n.bitmap=await createImageBitmap(a);n.refCounter=1}catch(a){console.error(a),n=null}return this.#o.set(t,n),n&&this.#o.set(n.id,n),n}async getFromFile(t){const{lastModified:r,name:n,size:a,type:l}=t;return this.#i(`${r}_${n}_${a}_${l}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromId(t){this.#o||=new Map;const r=this.#o.get(t);return r?r.bitmap?(r.refCounter+=1,r):r.file?this.getFromFile(r.file):this.getFromUrl(r.url):null}getSvgUrl(t){const r=this.#o.get(t);return r?.isSvg?r.svgUrl:null}deleteId(t){this.#o||=new Map;const r=this.#o.get(t);r&&(r.refCounter-=1,r.refCounter===0&&(r.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#e}_`)}}class UOt{#e=[];#t=!1;#o;#i=-1;constructor(t=128){this.#o=t}add({cmd:t,undo:r,post:n,mustExec:a,type:l=NaN,overwriteIfSameType:c=!1,keepUndo:d=!1}){if(a&&t(),this.#t)return;const p={cmd:t,undo:r,post:n,type:l};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(p);return}if(c&&this.#e[this.#i].type===l){d&&(p.undo=this.#e[this.#i].undo),this.#e[this.#i]=p;return}const u=this.#i+1;u===this.#o?this.#e.splice(0,1):(this.#i=u,u<this.#e.length&&this.#e.splice(u)),this.#e.push(p)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}destroy(){this.#e=null}}class mC{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=vc.platform;for(const[n,a,l={}]of t)for(const c of n){const d=c.startsWith("mac+");r&&d?(this.callbacks.set(c.slice(4),{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1))):!r&&!d&&(this.callbacks.set(c,{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1)))}}#e(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const r=this.buffer.join("+");return this.buffer.length=0,r}exec(t,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(this.#e(r));if(!n)return;const{callback:a,options:{bubbles:l=!1,args:c=[],checker:d=null}}=n;d&&!d(t,r)||(a.bind(t,...c,r)(),l||(r.stopPropagation(),r.preventDefault()))}}class BX{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return HOt(t),mi(this,"_colors",t)}convert(t){const r=IX(t);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,a]of this._colors)if(a.every((l,c)=>l===r[c]))return BX._colorsMapping.get(n);return r}getHexCode(t){const r=this._colors.get(t);return r?jo.makeHexColor(...r):t}}class yg{#e=new AbortController;#t=null;#o=new Map;#i=new Map;#s=null;#r=null;#n=null;#l=new UOt;#d=0;#p=new Set;#h=null;#c=null;#a=new Set;#m=!1;#f=null;#u=null;#y=null;#g=!1;#b=null;#v=new QOt;#A=!1;#k=!1;#S=null;#j=null;#$=null;#w=ai.NONE;#x=new Set;#C=null;#E=null;#L=null;#B=this.blur.bind(this);#M=this.focus.bind(this);#T=this.copy.bind(this);#P=this.cut.bind(this);#z=this.paste.bind(this);#D=this.keydown.bind(this);#Q=this.keyup.bind(this);#U=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#N=this.onScaleChanging.bind(this);#R=this.onRotationChanging.bind(this);#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#F=null;#H=null;#q=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=yg.prototype,r=c=>c.#H.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&c.hasSomethingToControl(),n=(c,{target:d})=>{if(d instanceof HTMLInputElement){const{type:p}=d;return p!=="text"&&p!=="number"}return!0},a=this.TRANSLATE_SMALL,l=this.TRANSLATE_BIG;return mi(this,"_keyboardManager",new mC([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(d)&&!c.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-l,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[l,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-l],checker:r}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,l],checker:r}]]))}constructor(t,r,n,a,l,c,d,p,u){this._signal=this.#e.signal,this.#H=t,this.#q=r,this.#s=n,this._eventBus=a,this._eventBus._on("editingaction",this.#U),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#N),this._eventBus._on("rotationchanging",this.#R),this.#ie(),this.#le(),this.#Z(),this.#r=l.annotationStorage,this.#f=l.filterFactory,this.#E=c,this.#y=d||null,this.#m=p,this.#$=u||null,this.viewParameters={realScale:Q8.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#e?.abort(),this.#e=null,this._signal=null,this._eventBus._off("editingaction",this.#U),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#N),this._eventBus._off("rotationchanging",this.#R);for(const t of this.#i.values())t.destroy();this.#i.clear(),this.#o.clear(),this.#a.clear(),this.#t=null,this.#x.clear(),this.#l.destroy(),this.#s?.destroy(),this.#b?.hide(),this.#b=null,this.#u&&(clearTimeout(this.#u),this.#u=null),this.#F&&(clearTimeout(this.#F),this.#F=null)}async mlGuess(t){return this.#$?.guess(t)||null}get hasMLManager(){return!!this.#$}get hcmFilter(){return mi(this,"hcmFilter",this.#E?this.#f.addHCMFilter(this.#E.foreground,this.#E.background):"none")}get direction(){return mi(this,"direction",getComputedStyle(this.#H).direction)}get highlightColors(){return mi(this,"highlightColors",this.#y?new Map(this.#y.split(",").map(t=>t.split("=").map(r=>r.trim()))):null)}get highlightColorNames(){return mi(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#j=t}editAltText(t){this.#s?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#d=t-1}focusMainContainer(){this.#H.focus()}findParent(t,r){for(const n of this.#i.values()){const{x:a,y:l,width:c,height:d}=n.div.getBoundingClientRect();if(t>=a&&t<=a+c&&r>=l&&r<=l+d)return n}return null}disableUserSelect(t=!1){this.#q.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#a.add(t)}removeShouldRescale(t){this.#a.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Q8.PDF_TO_CSS_UNITS;for(const r of this.#a)r.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#G({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c}=r,d=r.toString(),u=this.#G(r).closest(".textLayer"),h=this.getSelectionBoxes(u);if(h){r.empty(),this.#w===ai.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:ai.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const m of this.#i.values())if(m.hasTextLayer(u)){m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c,text:d});break}}}#oe(){const t=document.getSelection();if(!t||t.isCollapsed)return;const n=this.#G(t).closest(".textLayer"),a=this.getSelectionBoxes(n);a&&(this.#b||=new _Ot(this),this.#b.show(n,a,this.direction==="ltr"))}addToAnnotationStorage(t){!t.isEmpty()&&this.#r&&!this.#r.has(t.id)&&this.#r.setValue(t.id,t)}#re(){const t=document.getSelection();if(!t||t.isCollapsed){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}const{anchorNode:r}=t;if(r===this.#C)return;if(!this.#G(t).closest(".textLayer")){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}if(this.#b?.hide(),this.#C=r,this.#I({hasSelectedText:!0}),!(this.#w!==ai.HIGHLIGHT&&this.#w!==ai.NONE)&&(this.#w===ai.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#g=this.isShiftKeyDown,!this.isShiftKeyDown)){const l=this._signal,c=d=>{d.type==="pointerup"&&d.button!==0||(window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),d.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}}#Y(t=""){this.#w===ai.HIGHLIGHT?this.highlightSelection(t):this.#m&&this.#oe()}#ie(){document.addEventListener("selectionchange",this.#re.bind(this),{signal:this._signal})}#ne(){const t=this._signal;window.addEventListener("focus",this.#M,{signal:t}),window.addEventListener("blur",this.#B,{signal:t})}#ae(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#B)}blur(){if(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const r of this.#x)if(r.div.contains(t)){this.#S=[r,t],r._focusEventsAllowed=!1;break}}focus(){if(!this.#S)return;const[t,r]=this.#S;this.#S=null,r.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}#Z(){const t=this._signal;window.addEventListener("keydown",this.#D,{signal:t}),window.addEventListener("keyup",this.#Q,{signal:t})}#se(){window.removeEventListener("keydown",this.#D),window.removeEventListener("keyup",this.#Q)}#J(){const t=this._signal;document.addEventListener("copy",this.#T,{signal:t}),document.addEventListener("cut",this.#P,{signal:t}),document.addEventListener("paste",this.#z,{signal:t})}#X(){document.removeEventListener("copy",this.#T),document.removeEventListener("cut",this.#P),document.removeEventListener("paste",this.#z)}#le(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#Z(),this.#J()}removeEditListeners(){this.#se(),this.#X()}dragOver(t){for(const{type:r}of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const r of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const r=[];for(const n of this.#x){const a=n.serialize(!0);a&&r.push(a)}r.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:r}=t;for(const l of r.items)for(const c of this.#c)if(c.isHandlingMimeForPasting(l.type)){c.paste(l,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(l){Nr(`paste: "${l.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const a=this.currentLayer;try{const l=[];for(const p of n){const u=a.deserialize(p);if(!u)return;l.push(u)}const c=()=>{for(const p of l)this.#ee(p);this.#te(l)},d=()=>{for(const p of l)p.remove()};this.addCommands({cmd:c,undo:d,mustExec:!0})}catch(l){Nr(`paste: "${l.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#w!==ai.NONE&&!this.isEditorHandlingKeyboard&&yg._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}#I(t){Object.entries(t).some(([n,a])=>this.#K[n]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#w===ai.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#O([[gr.HIGHLIGHT_FREE,!0]]))}#O(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ne(),this.#J(),this.#I({isEditing:this.#w!==ai.NONE,isEmpty:this.#W(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#X(),this.#I({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#c){this.#c=t;for(const r of this.#c)this.#O(r.defaultPropertiesToUpdate)}}getId(){return this.#v.id}get currentLayer(){return this.#i.get(this.#d)}getLayer(t){return this.#i.get(t)}get currentPageIndex(){return this.#d}addLayer(t){this.#i.set(t.pageIndex,t),this.#A?t.enable():t.disable()}removeLayer(t){this.#i.delete(t.pageIndex)}updateMode(t,r=null,n=!1){if(this.#w!==t){if(this.#w=t,t===ai.NONE){this.setEditingState(!1),this.#de();return}this.setEditingState(!0),this.#ce(),this.unselectAll();for(const a of this.#i.values())a.updateMode(t);if(!r&&n){this.addNewEditorFromKeyboard();return}if(r){for(const a of this.#o.values())if(a.annotationElementId===r){this.setSelected(a),a.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#w&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,r){if(this.#c){switch(t){case gr.CREATE:this.currentLayer.addNewEditor();return;case gr.HIGHLIGHT_DEFAULT_COLOR:this.#j?.updateColor(r);break;case gr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#L||=new Map).set(t,r),this.showAllEditors("highlight",r);break}for(const n of this.#x)n.updateParams(t,r);for(const n of this.#c)n.updateDefaultParams(t,r)}}showAllEditors(t,r,n=!1){for(const l of this.#o.values())l.editorType===t&&l.show(r);(this.#L?.get(gr.HIGHLIGHT_SHOW_ALL)??!0)!==r&&this.#O([[gr.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(t=!1){if(this.#k!==t){this.#k=t;for(const r of this.#i.values())t?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",t)}}#ce(){if(!this.#A){this.#A=!0;for(const t of this.#i.values())t.enable();for(const t of this.#o.values())t.enable()}}#de(){if(this.unselectAll(),this.#A){this.#A=!1;for(const t of this.#i.values())t.disable();for(const t of this.#o.values())t.disable()}}getEditors(t){const r=[];for(const n of this.#o.values())n.pageIndex===t&&r.push(n);return r}getEditor(t){return this.#o.get(t)}addEditor(t){this.#o.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#u&&clearTimeout(this.#u),this.#u=setTimeout(()=>{this.focusMainContainer(),this.#u=null},0)),this.#o.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#p.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#p.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#p.has(t)}removeDeletedAnnotationElement(t){this.#p.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#ee(t){const r=this.#i.get(t.pageIndex);r?r.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#t!==t&&(this.#t=t,t&&this.#O(t.propertiesToUpdate))}get#pe(){let t=null;for(t of this.#x);return t}updateUI(t){this.#pe===t&&this.#O(t.propertiesToUpdate)}toggleSelected(t){if(this.#x.has(t)){this.#x.delete(t),t.unselect(),this.#I({hasSelectedEditor:this.hasSelection});return}this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}setSelected(t){for(const r of this.#x)r!==t&&r.unselect();this.#x.clear(),this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}isSelected(t){return this.#x.has(t)}get firstSelectedEditor(){return this.#x.values().next().value}unselect(t){t.unselect(),this.#x.delete(t),this.#I({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#x.size!==0}get isEnterHandled(){return this.#x.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#I({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#W()})}redo(){this.#l.redo(),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#W()})}addCommands(t){this.#l.add(t),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#W()})}#W(){if(this.#o.size===0)return!0;if(this.#o.size===1)for(const t of this.#o.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#x],r=()=>{for(const a of t)a.remove()},n=()=>{for(const a of t)this.#ee(a)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#te(t){for(const r of this.#x)r.unselect();this.#x.clear();for(const r of t)r.isEmpty()||(this.#x.add(r),r.select());this.#I({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#x)t.commit();this.#te(this.#o.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#w!==ai.NONE))&&this.hasSelection){for(const t of this.#x)t.unselect();this.#x.clear(),this.#I({hasSelectedEditor:!1})}}translateSelectedEditors(t,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=t,this.#V[1]+=r;const[a,l]=this.#V,c=[...this.#x],d=1e3;this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(a,l)},undo:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(-a,-l)},mustExec:!1})},d);for(const p of c)p.translateInPage(t,r)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(const t of this.#x)this.#h.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);const t=this.#h;this.#h=null;let r=!1;for(const[{x:a,y:l,pageIndex:c},d]of t)d.newX=a,d.newY=l,d.newPageIndex=c,r||=a!==d.savedX||l!==d.savedY||c!==d.savedPageIndex;if(!r)return!1;const n=(a,l,c,d)=>{if(this.#o.has(a.id)){const p=this.#i.get(d);p?a._setParentAndPosition(p,l,c):(a.pageIndex=d,a.x=l,a.y=c)}};return this.addCommands({cmd:()=>{for(const[a,{newX:l,newY:c,newPageIndex:d}]of t)n(a,l,c,d)},undo:()=>{for(const[a,{savedX:l,savedY:c,savedPageIndex:d}]of t)n(a,l,c,d)},mustExec:!0}),!0}dragSelectedEditors(t,r){if(this.#h)for(const n of this.#h.keys())n.drag(t,r)}rebuild(t){if(t.parent===null){const r=this.getLayer(t.pageIndex);r?(r.changeParent(t),r.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#x.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#t===t}getActive(){return this.#t}getMode(){return this.#w}get imageManager(){return mi(this,"imageManager",new MX)}getSelectionBoxes(t){if(!t)return null;const r=document.getSelection();for(let u=0,h=r.rangeCount;u<h;u++)if(!t.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:a,width:l,height:c}=t.getBoundingClientRect();let d;switch(t.getAttribute("data-main-rotation")){case"90":d=(u,h,m,f)=>({x:(h-a)/c,y:1-(u+m-n)/l,width:f/c,height:m/l});break;case"180":d=(u,h,m,f)=>({x:1-(u+m-n)/l,y:1-(h+f-a)/c,width:m/l,height:f/c});break;case"270":d=(u,h,m,f)=>({x:1-(h+f-a)/c,y:(u-n)/l,width:f/c,height:m/l});break;default:d=(u,h,m,f)=>({x:(u-n)/l,y:(h-a)/c,width:m/l,height:f/c});break}const p=[];for(let u=0,h=r.rangeCount;u<h;u++){const m=r.getRangeAt(u);if(!m.collapsed)for(const{x:f,y:x,width:y,height:b}of m.getClientRects())y===0||b===0||p.push(d(f,x,y,b))}return p.length===0?null:p}addChangedExistingAnnotation({annotationElementId:t,id:r}){(this.#n||=new Map).set(t,r)}removeChangedExistingAnnotation({annotationElementId:t}){this.#n?.delete(t)}renderAnnotationElement(t){const r=this.#n?.get(t.data.id);if(!r)return;const n=this.#r.getRawValue(r);n&&(this.#w===ai.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}}class p4{#e="";#t=!1;#o=null;#i=null;#s=null;#r=!1;#n=null;static _l10nPromise=null;constructor(t){this.#n=t}static initialize(t){p4._l10nPromise||=t}async render(){const t=this.#o=document.createElement("button");t.className="altText";const r=await p4._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=r,t.setAttribute("aria-label",r),t.tabIndex="0";const n=this.#n._uiManager._signal;t.addEventListener("contextmenu",Ec,{signal:n}),t.addEventListener("pointerdown",l=>l.stopPropagation(),{signal:n});const a=l=>{l.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",a,{capture:!0,signal:n}),t.addEventListener("keydown",l=>{l.target===t&&l.key==="Enter"&&(this.#r=!0,a(l))},{signal:n}),await this.#l(),t}finish(){this.#o&&(this.#o.focus({focusVisible:this.#r}),this.#r=!1)}isEmpty(){return!this.#e&&!this.#t}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:t,decorative:r}){this.#e===t&&this.#t===r||(this.#e=t,this.#t=r,this.#l())}toggle(t=!1){this.#o&&(!t&&this.#s&&(clearTimeout(this.#s),this.#s=null),this.#o.disabled=!t)}destroy(){this.#o?.remove(),this.#o=null,this.#i=null}async#l(){const t=this.#o;if(!t)return;if(!this.#e&&!this.#t){t.classList.remove("done"),this.#i?.remove();return}t.classList.add("done"),p4._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(a=>{t.setAttribute("aria-label",a)});let r=this.#i;if(!r){this.#i=r=document.createElement("span"),r.className="tooltip",r.setAttribute("role","tooltip");const a=r.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",a);const l=100,c=this.#n._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(this.#s),this.#s=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#i.classList.add("show"),this.#n._reportTelemetry({action:"alt_text_tooltip"})},l)},{signal:c}),t.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:c})}r.innerText=this.#t?await p4._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#e,r.parentNode||t.append(r),this.#n.getImageForAltText()?.setAttribute("aria-describedby",r.id)}}class ur{#e=null;#t=null;#o=null;#i=!1;#s=!1;#r=null;#n=null;#l=this.focusin.bind(this);#d=this.focusout.bind(this);#p=null;#h="";#c=!1;#a=null;#m=!1;#f=!1;#u=!1;#y=null;#g=0;#b=0;#v=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#A=!1;#k=ur._zIndex++;static _borderLineWidth=-1;static _colorManager=new BX;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=ur.prototype._resizeWithKeyboard,r=yg.TRANSLATE_SMALL,n=yg.TRANSLATE_BIG;return mi(this,"_resizerKeyboardManager",new mC([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],ur.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===ur&&Gi("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:r,rawDims:{pageWidth:n,pageHeight:a,pageX:l,pageY:c}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,a],this.pageTranslation=[l,c];const[d,p]=this.parentDimensions;this.x=t.x/d,this.y=t.y/p,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return mi(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const r=new WOt({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});r.annotationElementId=t.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(t,r,n){if(ur._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(l=>[l,t.get(l.replaceAll(/([A-Z])/g,c=>`-${c.toLowerCase()}`))])),n?.strings)for(const l of n.strings)ur._l10nPromise.set(l,t.get(l));if(ur._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);ur._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,r){Gi("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#A}set _isDraggable(t){this.#A=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(t*2),this.y+=this.width*t/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(t*2),this.y-=this.width*t/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#k}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#D(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#c?this.#c=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,r,n,a){const[l,c]=this.parentDimensions;[n,a]=this.screenToPageTranslation(n,a),this.x=(t+n)/l,this.y=(r+a)/c,this.fixAndSetPosition()}#S([t,r],n,a){[n,a]=this.screenToPageTranslation(n,a),this.x+=n/t,this.y+=a/r,this.fixAndSetPosition()}translate(t,r){this.#S(this.parentDimensions,t,r)}translateInPage(t,r){this.#a||=[this.x,this.y],this.#S(this.pageDimensions,t,r),this.div.scrollIntoView({block:"nearest"})}drag(t,r){this.#a||=[this.x,this.y];const[n,a]=this.parentDimensions;if(this.x+=t/n,this.y+=r/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:l,y:c}=this;const[d,p]=this.getBaseTranslation();l+=d,c+=p,this.div.style.left=`${(100*l).toFixed(2)}%`,this.div.style.top=`${(100*c).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#a&&(this.#a[0]!==this.x||this.#a[1]!==this.y)}getBaseTranslation(){const[t,r]=this.parentDimensions,{_borderLineWidth:n}=ur,a=n/t,l=n/r;switch(this.rotation){case 90:return[-a,l];case 180:return[a,l];case 270:return[a,-l];default:return[-a,-l]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[r,n]=this.pageDimensions;let{x:a,y:l,width:c,height:d}=this;if(c*=r,d*=n,a*=r,l*=n,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(r-c,a)),l=Math.max(0,Math.min(n-d,l));break;case 90:a=Math.max(0,Math.min(r-d,a)),l=Math.min(n,Math.max(c,l));break;case 180:a=Math.min(r,Math.max(c,a)),l=Math.min(n,Math.max(d,l));break;case 270:a=Math.min(r,Math.max(d,a)),l=Math.max(0,Math.min(n-c,l));break}this.x=a/=r,this.y=l/=n;const[p,u]=this.getBaseTranslation();a+=p,l+=u;const{style:h}=this.div;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this.moveInDOM()}static#j(t,r,n){switch(n){case 90:return[r,-t];case 180:return[-t,-r];case 270:return[-r,t];default:return[t,r]}}screenToPageTranslation(t,r){return ur.#j(t,r,this.parentRotation)}pageTranslationToScreen(t,r){return ur.#j(t,r,360-this.parentRotation)}#$(t){switch(t){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[r,n]}=this,a=r*t,l=n*t;return vc.isCSSRoundSupported?[Math.round(a),Math.round(l)]:[a,l]}setDims(t,r){const[n,a]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*r/a).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:r,width:n}=t,a=n.endsWith("%"),l=!this.#s&&r.endsWith("%");if(a&&l)return;const[c,d]=this.parentDimensions;a||(t.width=`${(100*parseFloat(n)/c).toFixed(2)}%`),!this.#s&&!l&&(t.height=`${(100*parseFloat(r)/d).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#w(){if(this.#r)return;this.#r=document.createElement("div"),this.#r.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of t){const a=document.createElement("div");this.#r.append(a),a.classList.add("resizer",n),a.setAttribute("data-resizer-name",n),a.addEventListener("pointerdown",this.#x.bind(this,n),{signal:r}),a.addEventListener("contextmenu",Ec,{signal:r}),a.tabIndex=-1}this.div.prepend(this.#r)}#x(t,r){r.preventDefault();const{isMac:n}=vc.platform;if(r.button!==0||r.ctrlKey&&n)return;this.#o?.toggle(!1);const a=this.#E.bind(this,t),l=this._isDraggable;this._isDraggable=!1;const c=this._uiManager._signal,d={passive:!0,capture:!0,signal:c};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",a,d),window.addEventListener("contextmenu",Ec,{signal:c});const p=this.x,u=this.y,h=this.width,m=this.height,f=this.parent.div.style.cursor,x=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(r.target).cursor;const y=()=>{this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=l,window.removeEventListener("pointerup",y),window.removeEventListener("blur",y),window.removeEventListener("pointermove",a,d),window.removeEventListener("contextmenu",Ec),this.parent.div.style.cursor=f,this.div.style.cursor=x,this.#C(p,u,h,m)};window.addEventListener("pointerup",y,{signal:c}),window.addEventListener("blur",y,{signal:c})}#C(t,r,n,a){const l=this.x,c=this.y,d=this.width,p=this.height;l===t&&c===r&&d===n&&p===a||this.addCommands({cmd:()=>{this.width=d,this.height=p,this.x=l,this.y=c;const[u,h]=this.parentDimensions;this.setDims(u*d,h*p),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=a,this.x=t,this.y=r;const[u,h]=this.parentDimensions;this.setDims(u*n,h*a),this.fixAndSetPosition()},mustExec:!0})}#E(t,r){const[n,a]=this.parentDimensions,l=this.x,c=this.y,d=this.width,p=this.height,u=ur.MIN_SIZE/n,h=ur.MIN_SIZE/a,m=V=>Math.round(V*1e4)/1e4,f=this.#$(this.rotation),x=(V,O)=>[f[0]*V+f[2]*O,f[1]*V+f[3]*O],y=this.#$(360-this.rotation),b=(V,O)=>[y[0]*V+y[2]*O,y[1]*V+y[3]*O];let w,v,A=!1,S=!1;switch(t){case"topLeft":A=!0,w=(V,O)=>[0,0],v=(V,O)=>[V,O];break;case"topMiddle":w=(V,O)=>[V/2,0],v=(V,O)=>[V/2,O];break;case"topRight":A=!0,w=(V,O)=>[V,0],v=(V,O)=>[0,O];break;case"middleRight":S=!0,w=(V,O)=>[V,O/2],v=(V,O)=>[0,O/2];break;case"bottomRight":A=!0,w=(V,O)=>[V,O],v=(V,O)=>[0,0];break;case"bottomMiddle":w=(V,O)=>[V/2,O],v=(V,O)=>[V/2,0];break;case"bottomLeft":A=!0,w=(V,O)=>[0,O],v=(V,O)=>[V,0];break;case"middleLeft":S=!0,w=(V,O)=>[0,O/2],v=(V,O)=>[V,O/2];break}const E=w(d,p),I=v(d,p);let L=x(...I);const M=m(l+L[0]),D=m(c+L[1]);let P=1,T=1,[z,N]=this.screenToPageTranslation(r.movementX,r.movementY);if([z,N]=b(z/n,N/a),A){const V=Math.hypot(d,p);P=T=Math.max(Math.min(Math.hypot(I[0]-E[0]-z,I[1]-E[1]-N)/V,1/d,1/p),u/d,h/p)}else S?P=Math.max(u,Math.min(1,Math.abs(I[0]-E[0]-z)))/d:T=Math.max(h,Math.min(1,Math.abs(I[1]-E[1]-N)))/p;const K=m(d*P),q=m(p*T);L=x(...v(K,q));const F=M-L[0],_=D-L[1];this.width=K,this.height=q,this.x=F,this.y=_,this.setDims(n*K,a*q),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this.#p||this.#f?this.#p:(this.#p=new jX(this),this.div.append(this.#p.render()),this.#o&&this.#p.addAltTextButton(await this.#o.render()),this.#p)}removeEditToolbar(){this.#p&&(this.#p.remove(),this.#p=null,this.#o?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(p4.initialize(ur._l10nPromise),this.#o=new p4(this),this.#e&&(this.#o.data=this.#e,this.#e=null),await this.addEditToolbar())}get altTextData(){return this.#o?.data}set altTextData(t){this.#o&&(this.#o.data=t)}hasAltText(){return!this.#o?.isEmpty()}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#i?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",this.#l,{signal:t}),this.div.addEventListener("focusout",this.#d,{signal:t});const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*n/r).toFixed(2)}%`,this.div.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[a,l]=this.getInitialTranslation();return this.translate(a,l),ML(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:r}=vc.platform;if(t.button!==0||t.ctrlKey&&r){t.preventDefault();return}if(this.#c=!0,this._isDraggable){this.#B(t);return}this.#L(t)}#L(t){const{isMac:r}=vc.platform;t.ctrlKey&&!r||t.shiftKey||t.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)}#B(t){const r=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,a;const l=this._uiManager._signal;r&&(this.div.classList.add("moving"),n={passive:!0,capture:!0,signal:l},this.#g=t.clientX,this.#b=t.clientY,a=d=>{const{clientX:p,clientY:u}=d,[h,m]=this.screenToPageTranslation(p-this.#g,u-this.#b);this.#g=p,this.#b=u,this._uiManager.dragSelectedEditors(h,m)},window.addEventListener("pointermove",a,n));const c=()=>{window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),r&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",a,n)),this.#c=!1,this._uiManager.endDragSession()||this.#L(t)};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,r,n){t.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition()}getRect(t,r,n=this.rotation){const a=this.parentScale,[l,c]=this.pageDimensions,[d,p]=this.pageTranslation,u=t/a,h=r/a,m=this.x*l,f=this.y*c,x=this.width*l,y=this.height*c;switch(n){case 0:return[m+u+d,c-f-h-y+p,m+u+x+d,c-f-h+p];case 90:return[m+h+d,c-f+u+p,m+h+y+d,c-f+u+x+p];case 180:return[m-u-x+d,c-f+h+p,m-u+d,c-f+h+y+p];case 270:return[m-h-y+d,c-f-u-x+p,m-h+d,c-f-u+p];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,r){const[n,a,l,c]=t,d=l-n,p=c-a;switch(this.rotation){case 0:return[n,r-c,d,p];case 90:return[n,r-a,p,d];case 180:return[l,r-a,d,p];case 270:return[l,r-c,p,d];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#f=!0}disableEditMode(){this.#f=!1}isInEditMode(){return this.#f}shouldGetKeyboardEvents(){return this.#u}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){const t=this._uiManager._signal;this.div?.addEventListener("focusin",this.#l,{signal:t}),this.div?.addEventListener("focusout",this.#d,{signal:t})}rotate(t){}serialize(t=!1,r=null){Gi("An editor must be serializable")}static deserialize(t,r,n){const a=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n});a.rotation=t.rotation,a.#e=t.accessibilityData;const[l,c]=a.pageDimensions,[d,p,u,h]=a.getRectInCurrentCoords(t.rect,c);return a.x=d/l,a.y=p/c,a.width=u/l,a.height=h/c,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#d),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#D(),this.removeEditToolbar(),this.#v){for(const t of this.#v.values())clearTimeout(t);this.#v=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#w(),this.#r.classList.remove("hidden"),ML(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#n={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const r=this.#r.children;if(!this.#t){this.#t=Array.from(r);const c=this.#M.bind(this),d=this.#T.bind(this),p=this._uiManager._signal;for(const u of this.#t){const h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",c,{signal:p}),u.addEventListener("blur",d,{signal:p}),u.addEventListener("focus",this.#P.bind(this,h),{signal:p}),ur._l10nPromise.get(`pdfjs-editor-resizer-label-${h}`).then(m=>u.setAttribute("aria-label",m))}}const n=this.#t[0];let a=0;for(const c of r){if(c===n)break;a++}const l=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(l!==a){if(l<a)for(let d=0;d<a-l;d++)this.#r.append(this.#r.firstChild);else if(l>a)for(let d=0;d<l-a;d++)this.#r.firstChild.before(this.#r.lastChild);let c=0;for(const d of r){const u=this.#t[c++].getAttribute("data-resizer-name");ur._l10nPromise.get(`pdfjs-editor-resizer-label-${u}`).then(h=>d.setAttribute("aria-label",h))}}this.#z(0),this.#u=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#M(t){ur._resizerKeyboardManager.exec(this,t)}#T(t){this.#u&&t.relatedTarget?.parentNode!==this.#r&&this.#D()}#P(t){this.#h=this.#u?t:""}#z(t){if(this.#t)for(const r of this.#t)r.tabIndex=t}_resizeWithKeyboard(t,r){this.#u&&this.#E(this.#h,{movementX:t,movementY:r})}#D(){if(this.#u=!1,this.#z(-1),this.#n){const{savedX:t,savedY:r,savedWidth:n,savedHeight:a}=this.#n;this.#C(t,r,n,a),this.#n=null}}_stopResizingWithKeyboard(){this.#D(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#p){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#p?.show()});return}this.#p?.show()}unselect(){this.#r?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#p?.hide()}updateParams(t,r){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#m}set isEditing(t){this.#m=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,r){this.#s=!0;const n=t/r,{style:a}=this.div;a.aspectRatio=n,a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,r=!1){if(r){this.#v||=new Map;const{action:n}=t;let a=this.#v.get(n);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),this.#v.delete(n),this.#v.size===0&&(this.#v=null)},ur._telemetryTimeout),this.#v.set(n,a);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#i=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#i=!0}renderAnnotationElement(t){let r=t.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),t.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(t){const{firstChild:r}=t.container;r.nodeName==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}}class WOt extends ur{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const vme=3285377520,Dd=4294901760,Tu=65535;class Jze{constructor(t){this.h1=t?t&4294967295:vme,this.h2=t?t&4294967295:vme}update(t){let r,n;if(typeof t=="string"){r=new Uint8Array(t.length*2),n=0;for(let b=0,w=t.length;b<w;b++){const v=t.charCodeAt(b);v<=255?r[n++]=v:(r[n++]=v>>>8,r[n++]=v&255)}}else if(ArrayBuffer.isView(t))r=t.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=n>>2,l=n-a*4,c=new Uint32Array(r.buffer,0,a);let d=0,p=0,u=this.h1,h=this.h2;const m=3432918353,f=461845907,x=m&Tu,y=f&Tu;for(let b=0;b<a;b++)b&1?(d=c[b],d=d*m&Dd|d*x&Tu,d=d<<15|d>>>17,d=d*f&Dd|d*y&Tu,u^=d,u=u<<13|u>>>19,u=u*5+3864292196):(p=c[b],p=p*m&Dd|p*x&Tu,p=p<<15|p>>>17,p=p*f&Dd|p*y&Tu,h^=p,h=h<<13|h>>>19,h=h*5+3864292196);switch(d=0,l){case 3:d^=r[a*4+2]<<16;case 2:d^=r[a*4+1]<<8;case 1:d^=r[a*4],d=d*m&Dd|d*x&Tu,d=d<<15|d>>>17,d=d*f&Dd|d*y&Tu,a&1?u^=d:h^=d}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,r=this.h2;return t^=r>>>1,t=t*3981806797&Dd|t*36045&Tu,r=r*4283543511&Dd|((r<<16|t>>>16)*2950163797&Dd)>>>16,t^=r>>>1,t=t*444984403&Dd|t*60499&Tu,r=r*3301882366&Dd|((r<<16|t>>>16)*3120437893&Dd)>>>16,t^=r>>>1,(t>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const LY=Object.freeze({map:null,hash:"",transfer:void 0});class PX{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,r){const n=this.#t.get(t);return n===void 0?r:Object.assign(r,n)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const r of this.#t.values())if(r instanceof ur)return;this.onAnnotationEditor(null)}}setValue(t,r){const n=this.#t.get(t);let a=!1;if(n!==void 0)for(const[l,c]of Object.entries(r))n[l]!==c&&(a=!0,n[l]=c);else a=!0,this.#t.set(t,r);a&&this.#o(),r instanceof ur&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?AX(this.#t):null}setAll(t){for(const[r,n]of Object.entries(t))this.setValue(r,n)}get size(){return this.#t.size}#o(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Xze(this)}get serializable(){if(this.#t.size===0)return LY;const t=new Map,r=new Jze,n=[],a=Object.create(null);let l=!1;for(const[c,d]of this.#t){const p=d instanceof ur?d.serialize(!1,a):d;p&&(t.set(c,p),r.update(`${c}:${JSON.stringify(p)}`),l||=!!p.bitmap)}if(l)for(const c of t.values())c.bitmap&&n.push(c.bitmap);return t.size>0?{map:t,hash:r.hexdigest(),transfer:n}:LY}get editorStats(){let t=null;const r=new Map;for(const n of this.#t.values()){if(!(n instanceof ur))continue;const a=n.telemetryFinalData;if(!a)continue;const{type:l}=a;r.has(l)||r.set(l,Object.getPrototypeOf(n).constructor),t||=Object.create(null);const c=t[l]||=new Map;for(const[d,p]of Object.entries(a)){if(d==="type")continue;let u=c.get(d);u||(u=new Map,c.set(d,u));const h=u.get(p)??0;u.set(p,h+1)}}for(const[n,a]of r)t[n]=a.computeTelemetryFinalData(t[n]);return t}}class Xze extends PX{#e;constructor(t){super();const{map:r,hash:n,transfer:a}=t.serializable,l=structuredClone(r,a?{transfer:a}:null);this.#e={map:l,hash:n,transfer:a}}get print(){Gi("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}class GOt{#e=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:r=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const r=this.styleElement.sheet;r.insertRule(t,r.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:r}){if(!(!t||this.#e.has(t.loadedName))){if(Wa(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:a,style:l}=t,c=new FontFace(n,a,l);this.addNativeFontFace(c);try{await c.load(),this.#e.add(n),r?.(t)}catch{Nr(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(c)}return}Gi("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(a){throw Nr(`Failed to load font '${n.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const r=t.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const a=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return mi(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(ul||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),mi(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function r(){for(Wa(!a.done,"completeRequest() cannot be called twice."),a.done=!0;n.length>0&&n[0].done;){const l=n.shift();setTimeout(l.callback,0)}}const{loadingRequests:n}=this,a={done:!1,complete:r,callback:t};return n.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return mi(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,r){function n(E,I){return E.charCodeAt(I)<<24|E.charCodeAt(I+1)<<16|E.charCodeAt(I+2)<<8|E.charCodeAt(I+3)&255}function a(E,I,L,M){const D=E.substring(0,I),P=E.substring(I+L);return D+M+P}let l,c;const d=this._document.createElement("canvas");d.width=1,d.height=1;const p=d.getContext("2d");let u=0;function h(E,I){if(++u>30){Nr("Load test font never loaded."),I();return}if(p.font="30px "+E,p.fillText(".",0,20),p.getImageData(0,0,1,1).data[3]>0){I();return}setTimeout(h.bind(null,E,I))}const m=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=a(f,976,m.length,m);const y=16,b=1482184792;let w=n(f,y);for(l=0,c=m.length-3;l<c;l+=4)w=w-b+n(m,l)|0;l<m.length&&(w=w-b+n(m+"XXX",l)|0),f=a(f,y,4,jOt(w));const v=`url(data:font/opentype;base64,${btoa(f)});`,A=`@font-face {font-family:"${m}";src:${v}}`;this.insertRule(A);const S=this._document.createElement("div");S.style.visibility="hidden",S.style.width=S.style.height="10px",S.style.position="absolute",S.style.top=S.style.left="0px";for(const E of[t.loadedName,m]){const I=this._document.createElement("span");I.textContent="Hi",I.style.fontFamily=E,S.append(I)}this._document.body.append(S),h(m,()=>{S.remove(),r.complete()})}}class YOt{constructor(t,{disableFontFace:r=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.disableFontFace=r===!0,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=Wze(this.data),r=`url(data:${this.mimetype};base64,${btoa(t)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${r}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${r}}`}return this._inspectFont?.(this,r),n}getPathGenerator(t,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];let n;try{n=t.get(this.loadedName+"_path_"+r)}catch(l){Nr(`getPathGenerator - ignoring character: "${l}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[r]=function(l,c){};const a=[];for(let l=0,c=n.length;l<c;)switch(n[l++]){case w0.BEZIER_CURVE_TO:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.bezierCurveTo(d,p,u,h,m,f)),l+=6}break;case w0.MOVE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.moveTo(d,p)),l+=2}break;case w0.LINE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.lineTo(d,p)),l+=2}break;case w0.QUADRATIC_CURVE_TO:{const[d,p,u,h]=n.slice(l,l+4);a.push(m=>m.quadraticCurveTo(d,p,u,h)),l+=4}break;case w0.RESTORE:a.push(d=>d.restore());break;case w0.SAVE:a.push(d=>d.save());break;case w0.SCALE:Wa(a.length===2,"Scale command is only valid at the third position.");break;case w0.TRANSFORM:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.transform(d,p,u,h,m,f)),l+=6}break;case w0.TRANSLATE:{const[d,p]=n.slice(l,l+2);a.push(u=>u.translate(d,p)),l+=2}break}return this.compiledGlyphs[r]=function(c,d){a[0](c),a[1](c),c.scale(d,-d);for(let p=2,u=a.length;p<u;p++)a[p](c)}}}if(ul){var IY=Promise.withResolvers(),jY=null;(async()=>{const t=await r4(()=>import("./empty-wsHK64j3.js").then(d=>d.e),__vite__mapDeps([0,1,2])),r=await r4(()=>import("./index-KhUKZXvx.js").then(d=>d.i),__vite__mapDeps([3,1,4,5,6,7,8,9])),n=await r4(()=>import("./index-BdIJVq8L.js").then(d=>d.i),__vite__mapDeps([10,1,11,4,5,6,7,8,9])),a=await r4(()=>import("./url-Cs89cy8y.js").then(d=>d.u),__vite__mapDeps([12,1,9,7,5,6,8]));let l,c;return new Map(Object.entries({fs:t,http:r,https:n,url:a,canvas:l,path2d:c}))})().then(t=>{jY=t,IY.resolve()},t=>{Nr(`loadPackages: ${t}`),jY=new Map,IY.resolve()})}class Rh{static get promise(){return IY.promise}static get(t){return jY?.get(t)}}const eRe=function(e){return Rh.get("fs").promises.readFile(e).then(r=>new Uint8Array(r))};class KOt extends PM{}class qOt extends DM{_createCanvas(t,r){return Rh.get("canvas").createCanvas(t,r)}}class ZOt extends TM{_fetchData(t,r){return eRe(t).then(n=>({cMapData:n,compressionType:r}))}}class JOt extends zM{_fetchData(t){return eRe(t)}}const Tl={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function MY(e,t){if(!t)return;const r=t[2]-t[0],n=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],r,n),e.clip(a)}class gC{constructor(){this.constructor===gC&&Gi("Cannot initialize BaseShadingPattern.")}getPattern(){Gi("Abstract method `getPattern` called.")}}class XOt extends gC{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let r;this._type==="axial"?r=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(t,r,n,a){let l;if(a===Tl.STROKE||a===Tl.FILL){const c=r.current.getClippedPathBoundingBox(a,Pn(t))||[0,0,0,0],d=Math.ceil(c[2]-c[0])||1,p=Math.ceil(c[3]-c[1])||1,u=r.cachedCanvases.getCanvas("pattern",d,p,!0),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-c[0],-c[1]),n=jo.transform(n,[1,0,0,1,c[0],c[1]]),h.transform(...r.baseTransform),this.matrix&&h.transform(...this.matrix),MY(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),l=t.createPattern(u.canvas,"no-repeat");const m=new DOMMatrix(n);l.setTransform(m)}else MY(t,this._bbox),l=this._createGradient(t);return l}}function n_(e,t,r,n,a,l,c,d){const p=t.coords,u=t.colors,h=e.data,m=e.width*4;let f;p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f),p[n+1]>p[a+1]&&(f=n,n=a,a=f,f=c,c=d,d=f),p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f);const x=(p[r]+t.offsetX)*t.scaleX,y=(p[r+1]+t.offsetY)*t.scaleY,b=(p[n]+t.offsetX)*t.scaleX,w=(p[n+1]+t.offsetY)*t.scaleY,v=(p[a]+t.offsetX)*t.scaleX,A=(p[a+1]+t.offsetY)*t.scaleY;if(y>=A)return;const S=u[l],E=u[l+1],I=u[l+2],L=u[c],M=u[c+1],D=u[c+2],P=u[d],T=u[d+1],z=u[d+2],N=Math.round(y),K=Math.round(A);let q,F,_,V,O,R,H,ee;for(let Y=N;Y<=K;Y++){if(Y<w){const ye=Y<y?0:(y-Y)/(y-w);q=x-(x-b)*ye,F=S-(S-L)*ye,_=E-(E-M)*ye,V=I-(I-D)*ye}else{let ye;Y>A?ye=1:w===A?ye=0:ye=(w-Y)/(w-A),q=b-(b-v)*ye,F=L-(L-P)*ye,_=M-(M-T)*ye,V=D-(D-z)*ye}let G;Y<y?G=0:Y>A?G=1:G=(y-Y)/(y-A),O=x-(x-v)*G,R=S-(S-P)*G,H=E-(E-T)*G,ee=I-(I-z)*G;const X=Math.round(Math.min(q,O)),J=Math.round(Math.max(q,O));let ie=m*Y+X*4;for(let ye=X;ye<=J;ye++)G=(q-ye)/(q-O),G<0?G=0:G>1&&(G=1),h[ie++]=F-(F-R)*G|0,h[ie++]=_-(_-H)*G|0,h[ie++]=V-(V-ee)*G|0,h[ie++]=255}}function eNt(e,t,r){const n=t.coords,a=t.colors;let l,c;switch(t.type){case"lattice":const d=t.verticesPerRow,p=Math.floor(n.length/d)-1,u=d-1;for(l=0;l<p;l++){let h=l*d;for(let m=0;m<u;m++,h++)n_(e,r,n[h],n[h+1],n[h+d],a[h],a[h+1],a[h+d]),n_(e,r,n[h+d+1],n[h+1],n[h+d],a[h+d+1],a[h+1],a[h+d])}break;case"triangles":for(l=0,c=n.length;l<c;l+=3)n_(e,r,n[l],n[l+1],n[l+2],a[l],a[l+1],a[l+2]);break;default:throw new Error("illegal figure")}}class tNt extends gC{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,r,n){const d=Math.floor(this._bounds[0]),p=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-d,h=Math.ceil(this._bounds[3])-p,m=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),x=u/m,y=h/f,b={coords:this._coords,colors:this._colors,offsetX:-d,offsetY:-p,scaleX:1/x,scaleY:1/y},w=m+4,v=f+4,A=n.getCanvas("mesh",w,v,!1),S=A.context,E=S.createImageData(m,f);if(r){const L=E.data;for(let M=0,D=L.length;M<D;M+=4)L[M]=r[0],L[M+1]=r[1],L[M+2]=r[2],L[M+3]=255}for(const L of this._figures)eNt(E,L,b);return S.putImageData(E,2,2),{canvas:A.canvas,offsetX:d-2*x,offsetY:p-2*y,scaleX:x,scaleY:y}}getPattern(t,r,n,a){MY(t,this._bbox);let l;if(a===Tl.SHADING)l=jo.singularValueDecompose2dScale(Pn(t));else if(l=jo.singularValueDecompose2dScale(r.baseTransform),this.matrix){const d=jo.singularValueDecompose2dScale(this.matrix);l=[l[0]*d[0],l[1]*d[1]]}const c=this._createMeshCanvas(l,a===Tl.SHADING?null:this._background,r.cachedCanvases);return a!==Tl.SHADING&&(t.setTransform(...r.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(c.offsetX,c.offsetY),t.scale(c.scaleX,c.scaleY),t.createPattern(c.canvas,"no-repeat")}}class oNt extends gC{getPattern(){return"hotpink"}}function rNt(e){switch(e[0]){case"RadialAxial":return new XOt(e);case"Mesh":return new tNt(e);case"Dummy":return new oNt}throw new Error(`Unknown IR type: ${e[0]}`)}const Cme={COLORED:1,UNCOLORED:2};class DX{static MAX_PATTERN_SIZE=3e3;constructor(t,r,n,a,l){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=r,this.ctx=n,this.canvasGraphicsFactory=a,this.baseTransform=l}createPatternCanvas(t){const r=this.operatorList,n=this.bbox,a=this.xstep,l=this.ystep,c=this.paintType,d=this.tilingType,p=this.color,u=this.canvasGraphicsFactory;jM("TilingType: "+d);const h=n[0],m=n[1],f=n[2],x=n[3],y=jo.singularValueDecompose2dScale(this.matrix),b=jo.singularValueDecompose2dScale(this.baseTransform),w=[y[0]*b[0],y[1]*b[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,w[0]),A=this.getSizeAndScale(l,this.ctx.canvas.height,w[1]),S=t.cachedCanvases.getCanvas("pattern",v.size,A.size,!0),E=S.context,I=u.createCanvasGraphics(E);I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,c,p);let L=h,M=m,D=f,P=x;return h<0&&(L=0,D+=Math.abs(h)),m<0&&(M=0,P+=Math.abs(m)),E.translate(-(v.scale*L),-(A.scale*M)),I.transform(v.scale,0,0,A.scale,0,0),E.save(),this.clipBbox(I,L,M,D,P),I.baseTransform=Pn(I.ctx),I.executeOperatorList(r),I.endDrawing(),{canvas:S.canvas,scaleX:v.scale,scaleY:A.scale,offsetX:L,offsetY:M}}getSizeAndScale(t,r,n){t=Math.abs(t);const a=Math.max(DX.MAX_PATTERN_SIZE,r);let l=Math.ceil(t*n);return l>=a?l=a:n=l/t,{scale:n,size:l}}clipBbox(t,r,n,a,l){const c=a-r,d=l-n;t.ctx.rect(r,n,c,d),t.current.updateRectMinMax(Pn(t.ctx),[r,n,a,l]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,r,n){const a=t.ctx,l=t.current;switch(r){case Cme.COLORED:const c=this.ctx;a.fillStyle=c.fillStyle,a.strokeStyle=c.strokeStyle,l.fillColor=c.fillStyle,l.strokeColor=c.strokeStyle;break;case Cme.UNCOLORED:const d=jo.makeHexColor(n[0],n[1],n[2]);a.fillStyle=d,a.strokeStyle=d,l.fillColor=d,l.strokeColor=d;break;default:throw new IOt(`Unsupported paint type: ${r}`)}}getPattern(t,r,n,a){let l=n;a!==Tl.SHADING&&(l=jo.transform(l,r.baseTransform),this.matrix&&(l=jo.transform(l,this.matrix)));const c=this.createPatternCanvas(r);let d=new DOMMatrix(l);d=d.translate(c.offsetX,c.offsetY),d=d.scale(1/c.scaleX,1/c.scaleY);const p=t.createPattern(c.canvas,"repeat");return p.setTransform(d),p}}function iNt({src:e,srcPos:t=0,dest:r,width:n,height:a,nonBlackColor:l=4294967295,inverseDecode:c=!1}){const d=vc.isLittleEndian?4278190080:255,[p,u]=c?[l,d]:[d,l],h=n>>3,m=n&7,f=e.length;r=new Uint32Array(r.buffer);let x=0;for(let y=0;y<a;y++){for(const w=t+h;t<w;t++){const v=t<f?e[t]:255;r[x++]=v&128?u:p,r[x++]=v&64?u:p,r[x++]=v&32?u:p,r[x++]=v&16?u:p,r[x++]=v&8?u:p,r[x++]=v&4?u:p,r[x++]=v&2?u:p,r[x++]=v&1?u:p}if(m===0)continue;const b=t<f?e[t++]:255;for(let w=0;w<m;w++)r[x++]=b&1<<7-w?u:p}return{srcPos:t,destPos:x}}const Ame=16,$me=100,nNt=15,kme=10,Sme=1e3,dc=16;function aNt(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(n,a){t.translate(n,a),this.__originalTranslate(n,a)},e.scale=function(n,a){t.scale(n,a),this.__originalScale(n,a)},e.transform=function(n,a,l,c,d,p){t.transform(n,a,l,c,d,p),this.__originalTransform(n,a,l,c,d,p)},e.setTransform=function(n,a,l,c,d,p){t.setTransform(n,a,l,c,d,p),this.__originalSetTransform(n,a,l,c,d,p)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(n){t.rotate(n),this.__originalRotate(n)},e.clip=function(n){t.clip(n),this.__originalClip(n)},e.moveTo=function(r,n){t.moveTo(r,n),this.__originalMoveTo(r,n)},e.lineTo=function(r,n){t.lineTo(r,n),this.__originalLineTo(r,n)},e.bezierCurveTo=function(r,n,a,l,c,d){t.bezierCurveTo(r,n,a,l,c,d),this.__originalBezierCurveTo(r,n,a,l,c,d)},e.rect=function(r,n,a,l){t.rect(r,n,a,l),this.__originalRect(r,n,a,l)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class sNt{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,r,n){let a;return this.cache[t]!==void 0?(a=this.cache[t],this.canvasFactory.reset(a,r,n)):(a=this.canvasFactory.create(r,n),this.cache[t]=a),a}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const r=this.cache[t];this.canvasFactory.destroy(r),delete this.cache[t]}}}function g$(e,t,r,n,a,l,c,d,p,u){const[h,m,f,x,y,b]=Pn(e);if(m===0&&f===0){const A=c*h+y,S=Math.round(A),E=d*x+b,I=Math.round(E),L=(c+p)*h+y,M=Math.abs(Math.round(L)-S)||1,D=(d+u)*x+b,P=Math.abs(Math.round(D)-I)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(x),S,I),e.drawImage(t,r,n,a,l,0,0,M,P),e.setTransform(h,m,f,x,y,b),[M,P]}if(h===0&&x===0){const A=d*f+y,S=Math.round(A),E=c*m+b,I=Math.round(E),L=(d+u)*f+y,M=Math.abs(Math.round(L)-S)||1,D=(c+p)*m+b,P=Math.abs(Math.round(D)-I)||1;return e.setTransform(0,Math.sign(m),Math.sign(f),0,S,I),e.drawImage(t,r,n,a,l,0,0,P,M),e.setTransform(h,m,f,x,y,b),[P,M]}e.drawImage(t,r,n,a,l,c,d,p,u);const w=Math.hypot(h,m),v=Math.hypot(f,x);return[w*p,v*u]}function lNt(e){const{width:t,height:r}=e;if(t>Sme||r>Sme)return null;const n=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=t+1;let c=new Uint8Array(l*(r+1)),d,p,u;const h=t+7&-8;let m=new Uint8Array(h*r),f=0;for(const v of e.data){let A=128;for(;A>0;)m[f++]=v&A?0:255,A>>=1}let x=0;for(f=0,m[f]!==0&&(c[0]=1,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[p]=m[f]?2:1,++x),f++;for(m[f]!==0&&(c[p]=2,++x),d=1;d<r;d++){f=d*h,u=d*l,m[f-h]!==m[f]&&(c[u]=m[f]?1:8,++x);let v=(m[f]?4:0)+(m[f-h]?8:0);for(p=1;p<t;p++)v=(v>>2)+(m[f+1]?4:0)+(m[f-h+1]?8:0),a[v]&&(c[u+p]=a[v],++x),f++;if(m[f-h]!==m[f]&&(c[u+p]=m[f]?2:4,++x),x>n)return null}for(f=h*(r-1),u=d*l,m[f]!==0&&(c[u]=8,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[u+p]=m[f]?4:8,++x),f++;if(m[f]!==0&&(c[u+p]=4,++x),x>n)return null;const y=new Int32Array([0,l,-1,0,-l,0,0,0,1]),b=new Path2D;for(d=0;x&&d<=r;d++){let v=d*l;const A=v+t;for(;v<A&&!c[v];)v++;if(v===A)continue;b.moveTo(v%l,d);const S=v;let E=c[v];do{const I=y[E];do v+=I;while(!c[v]);const L=c[v];L!==5&&L!==10?(E=L,c[v]=0):(E=L&51*E>>4,c[v]&=E>>2|E<<2),b.lineTo(v%l,v/l|0),c[v]||--x}while(S!==v);--d}return m=null,c=null,function(v){v.save(),v.scale(1/t,-1/r),v.translate(0,-r),v.fill(b),v.beginPath(),v.restore()}}class Eme{constructor(t,r){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Qze,this.textMatrixScale=1,this.fontMatrix=$Y,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=il.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,r])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,r){this.x=t,this.y=r}updatePathMinMax(t,r,n){[r,n]=jo.applyTransform([r,n],t),this.minX=Math.min(this.minX,r),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,r),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(t,r){const n=jo.applyTransform(r,t),a=jo.applyTransform(r.slice(2),t),l=jo.applyTransform([r[0],r[3]],t),c=jo.applyTransform([r[2],r[1]],t);this.minX=Math.min(this.minX,n[0],a[0],l[0],c[0]),this.minY=Math.min(this.minY,n[1],a[1],l[1],c[1]),this.maxX=Math.max(this.maxX,n[0],a[0],l[0],c[0]),this.maxY=Math.max(this.maxY,n[1],a[1],l[1],c[1])}updateScalingPathMinMax(t,r){jo.scaleMinMax(t,r),this.minX=Math.min(this.minX,r[0]),this.minY=Math.min(this.minY,r[1]),this.maxX=Math.max(this.maxX,r[2]),this.maxY=Math.max(this.maxY,r[3])}updateCurvePathMinMax(t,r,n,a,l,c,d,p,u,h){const m=jo.bezierBoundingBox(r,n,a,l,c,d,p,u,h);h||this.updateRectMinMax(t,m)}getPathBoundingBox(t=Tl.FILL,r=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===Tl.STROKE){r||Gi("Stroke bounding box must include transform.");const a=jo.singularValueDecompose2dScale(r),l=a[0]*this.lineWidth/2,c=a[1]*this.lineWidth/2;n[0]-=l,n[1]-=c,n[2]+=l,n[3]+=c}return n}updateClipFromPath(){const t=jo.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Tl.FILL,r=null){return jo.intersect(this.clipBox,this.getPathBoundingBox(t,r))}}function Lme(e,t){if(typeof ImageData<"u"&&t instanceof ImageData){e.putImageData(t,0,0);return}const r=t.height,n=t.width,a=r%dc,l=(r-a)/dc,c=a===0?l:l+1,d=e.createImageData(n,dc);let p=0,u;const h=t.data,m=d.data;let f,x,y,b;if(t.kind===nE.GRAYSCALE_1BPP){const w=h.byteLength,v=new Uint32Array(m.buffer,0,m.byteLength>>2),A=v.length,S=n+7>>3,E=4294967295,I=vc.isLittleEndian?4278190080:255;for(f=0;f<c;f++){for(y=f<l?dc:a,u=0,x=0;x<y;x++){const L=w-p;let M=0;const D=L>S?n:L*8-7,P=D&-8;let T=0,z=0;for(;M<P;M+=8)z=h[p++],v[u++]=z&128?E:I,v[u++]=z&64?E:I,v[u++]=z&32?E:I,v[u++]=z&16?E:I,v[u++]=z&8?E:I,v[u++]=z&4?E:I,v[u++]=z&2?E:I,v[u++]=z&1?E:I;for(;M<D;M++)T===0&&(z=h[p++],T=128),v[u++]=z&T?E:I,T>>=1}for(;u<A;)v[u++]=0;e.putImageData(d,0,f*dc)}}else if(t.kind===nE.RGBA_32BPP){for(x=0,b=n*dc*4,f=0;f<l;f++)m.set(h.subarray(p,p+b)),p+=b,e.putImageData(d,0,x),x+=dc;f<c&&(b=n*a*4,m.set(h.subarray(p,p+b)),e.putImageData(d,0,x))}else if(t.kind===nE.RGB_24BPP)for(y=dc,b=n*y,f=0;f<c;f++){for(f>=l&&(y=a,b=n*y),u=0,x=b;x--;)m[u++]=h[p++],m[u++]=h[p++],m[u++]=h[p++],m[u++]=255;e.putImageData(d,0,f*dc)}else throw new Error(`bad image kind: ${t.kind}`)}function Ime(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const r=t.height,n=t.width,a=r%dc,l=(r-a)/dc,c=a===0?l:l+1,d=e.createImageData(n,dc);let p=0;const u=t.data,h=d.data;for(let m=0;m<c;m++){const f=m<l?dc:a;({srcPos:p}=iNt({src:u,srcPos:p,dest:h,width:n,height:f,nonBlackColor:0})),e.putImageData(d,0,m*dc)}}function uy(e,t){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function f$(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),!ul){const{filter:t}=e;t!=="none"&&t!==""&&(e.filter="none")}}function jme(e,t){if(t)return!0;const r=jo.singularValueDecompose2dScale(e);r[0]=Math.fround(r[0]),r[1]=Math.fround(r[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*Q8.PDF_TO_CSS_UNITS);return r[0]<=n&&r[1]<=n}const cNt=["butt","round","square"],dNt=["miter","round","bevel"],pNt={},Mme={};class d8{constructor(t,r,n,a,l,{optionalContentConfig:c,markedContentStack:d=null},p,u){this.ctx=t,this.current=new Eme(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=a,this.filterFactory=l,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=d||[],this.optionalContentConfig=c,this.cachedCanvases=new sNt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=p,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,r=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):r}beginDrawing({transform:t,viewport:r,transparency:n=!1,background:a=null}){const l=this.ctx.canvas.width,c=this.ctx.canvas.height,d=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,l,c),this.ctx.fillStyle=d,n){const p=this.cachedCanvases.getCanvas("transparent",l,c);this.compositeCtx=this.ctx,this.transparentCanvas=p.canvas,this.ctx=p.context,this.ctx.save(),this.ctx.transform(...Pn(this.compositeCtx))}this.ctx.save(),f$(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=Pn(this.ctx)}executeOperatorList(t,r,n,a){const l=t.argsArray,c=t.fnArray;let d=r||0;const p=l.length;if(p===d)return d;const u=p-d>kme&&typeof n=="function",h=u?Date.now()+nNt:0;let m=0;const f=this.commonObjs,x=this.objs;let y;for(;;){if(a!==void 0&&d===a.nextBreakPoint)return a.breakIt(d,n),d;if(y=c[d],y!==J1.dependency)this[y].apply(this,l[d]);else for(const b of l[d]){const w=b.startsWith("g_")?f:x;if(!w.has(b))return w.get(b,n),d}if(d++,d===p)return d;if(u&&++m>kme){if(Date.now()>h)return n(),d;m=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const r of t.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const r=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}}_scaleImage(t,r){const n=t.width,a=t.height;let l=Math.max(Math.hypot(r[0],r[1]),1),c=Math.max(Math.hypot(r[2],r[3]),1),d=n,p=a,u="prescale1",h,m;for(;l>2&&d>1||c>2&&p>1;){let f=d,x=p;l>2&&d>1&&(f=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),l/=d/f),c>2&&p>1&&(x=p>=16384?Math.floor(p/2)-1||1:Math.ceil(p)/2,c/=p/x),h=this.cachedCanvases.getCanvas(u,f,x),m=h.context,m.clearRect(0,0,f,x),m.drawImage(t,0,0,d,p,0,0,f,x),t=h.canvas,d=f,p=x,u=u==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:p}}_createMaskCanvas(t){const r=this.ctx,{width:n,height:a}=t,l=this.current.fillColor,c=this.current.patternFill,d=Pn(r);let p,u,h,m;if((t.bitmap||t.data)&&t.count>1){const D=t.bitmap||t.data.buffer;u=JSON.stringify(c?d:[d.slice(0,4),l]),p=this._cachedBitmapsMap.get(D),p||(p=new Map,this._cachedBitmapsMap.set(D,p));const P=p.get(u);if(P&&!c){const T=Math.round(Math.min(d[0],d[2])+d[4]),z=Math.round(Math.min(d[1],d[3])+d[5]);return{canvas:P,offsetX:T,offsetY:z}}h=P}h||(m=this.cachedCanvases.getCanvas("maskCanvas",n,a),Ime(m.context,t));let f=jo.transform(d,[1/n,0,0,-1/a,0,0]);f=jo.transform(f,[1,0,0,1,0,-a]);const[x,y,b,w]=jo.getAxialAlignedBoundingBox([0,0,n,a],f),v=Math.round(b-x)||1,A=Math.round(w-y)||1,S=this.cachedCanvases.getCanvas("fillCanvas",v,A),E=S.context,I=x,L=y;E.translate(-I,-L),E.transform(...f),h||(h=this._scaleImage(m.canvas,v0(E)),h=h.img,p&&c&&p.set(u,h)),E.imageSmoothingEnabled=jme(Pn(E),t.interpolate),g$(E,h,0,0,h.width,h.height,0,0,n,a),E.globalCompositeOperation="source-in";const M=jo.transform(v0(E),[1,0,0,1,-I,-L]);return E.fillStyle=c?l.getPattern(r,this,M,Tl.FILL):l,E.fillRect(0,0,n,a),p&&!c&&(this.cachedCanvases.delete("fillCanvas"),p.set(u,S.canvas)),{canvas:S.canvas,offsetX:Math.round(I),offsetY:Math.round(L)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=cNt[t]}setLineJoin(t){this.ctx.lineJoin=dNt[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,r){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(t),n.lineDashOffset=r)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[r,n]of t)switch(r){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(n,t,r);this.suspendedCtx=this.ctx,this.ctx=a.context;const l=this.ctx;l.setTransform(...Pn(this.suspendedCtx)),uy(this.suspendedCtx,l),aNt(l,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),uy(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,r,n,a){const l=a[0],c=a[1],d=a[2]-l,p=a[3]-c;d===0||p===0||(this.genericComposeSMask(r.context,n,d,p,r.subtype,r.backdrop,r.transferMap,l,c,r.offsetX,r.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,r,n,a,l,c,d,p,u,h,m){let f=t.canvas,x=p-h,y=u-m;if(c){if(x<0||y<0||x+n>f.width||y+a>f.height){const w=this.cachedCanvases.getCanvas("maskExtension",n,a),v=w.context;v.drawImage(f,-x,-y),c.some(A=>A!==0)&&(v.globalCompositeOperation="destination-atop",v.fillStyle=jo.makeHexColor(...c),v.fillRect(0,0,n,a),v.globalCompositeOperation="source-over"),f=w.canvas,x=y=0}else if(c.some(w=>w!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(x,y,n,a),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=jo.makeHexColor(...c),t.fillRect(x,y,n,a),t.restore()}}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),l==="Alpha"&&d?r.filter=this.filterFactory.addAlphaFilter(d):l==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(d));const b=new Path2D;b.rect(p,u,n,a),r.clip(b),r.globalCompositeOperation="destination-in",r.drawImage(f,x,y,n,a,p,u,n,a),r.restore()}save(){this.inSMaskMode?(uy(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(),uy(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,r,n,a,l,c){this.ctx.transform(t,r,n,a,l,c),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,r,n){const a=this.ctx,l=this.current;let c=l.x,d=l.y,p,u;const h=Pn(a),m=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,f=m?n.slice(0):null;for(let x=0,y=0,b=t.length;x<b;x++)switch(t[x]|0){case J1.rectangle:c=r[y++],d=r[y++];const w=r[y++],v=r[y++],A=c+w,S=d+v;a.moveTo(c,d),w===0||v===0?a.lineTo(A,S):(a.lineTo(A,d),a.lineTo(A,S),a.lineTo(c,S)),m||l.updateRectMinMax(h,[c,d,A,S]),a.closePath();break;case J1.moveTo:c=r[y++],d=r[y++],a.moveTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.lineTo:c=r[y++],d=r[y++],a.lineTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.curveTo:p=c,u=d,c=r[y+4],d=r[y+5],a.bezierCurveTo(r[y],r[y+1],r[y+2],r[y+3],c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],r[y+2],r[y+3],c,d,f),y+=6;break;case J1.curveTo2:p=c,u=d,a.bezierCurveTo(c,d,r[y],r[y+1],r[y+2],r[y+3]),l.updateCurvePathMinMax(h,p,u,c,d,r[y],r[y+1],r[y+2],r[y+3],f),c=r[y+2],d=r[y+3],y+=4;break;case J1.curveTo3:p=c,u=d,c=r[y+2],d=r[y+3],a.bezierCurveTo(r[y],r[y+1],c,d,c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],c,d,c,d,f),y+=4;break;case J1.closePath:a.closePath();break}m&&l.updateScalingPathMinMax(h,f),l.setCurrentPoint(c,d)}closePath(){this.ctx.closePath()}stroke(t=!0){const r=this.ctx,n=this.current.strokeColor;r.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&n?.getPattern?(r.save(),r.strokeStyle=n.getPattern(r,this,v0(r),Tl.STROKE),this.rescaleAndStroke(!1),r.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),r.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;let l=!1;a&&(r.save(),r.fillStyle=n.getPattern(r,this,v0(r),Tl.FILL),l=!0);const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(r.fill("evenodd"),this.pendingEOFill=!1):r.fill()),l&&r.restore(),t&&this.consumePath(c)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=pNt}eoClip(){this.pendingClip=Mme}beginText(){this.current.textMatrix=Qze,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,r=this.ctx;if(t===void 0){r.beginPath();return}r.save(),r.beginPath();for(const n of t)r.setTransform(...n.transform),r.translate(n.x,n.y),n.addToPath(r,n.fontSize);r.restore(),r.clip(),r.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,r){const n=this.commonObjs.get(t),a=this.current;if(!n)throw new Error(`Can't find font for ${t}`);if(a.fontMatrix=n.fontMatrix||$Y,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&Nr("Invalid font matrix for font "+t),r<0?(r=-r,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const l=n.loadedName||"sans-serif",c=n.systemFontInfo?.css||`"${l}", ${n.fallbackName}`;let d="normal";n.black?d="900":n.bold&&(d="bold");const p=n.italic?"italic":"normal";let u=r;r<Ame?u=Ame:r>$me&&(u=$me),this.current.fontSizeScale=r/u,this.ctx.font=`${p} ${d} ${u}px ${c}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,r){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=r}setLeadingMoveText(t,r){this.setLeading(-r),this.moveText(t,r)}setTextMatrix(t,r,n,a,l,c){this.current.textMatrix=[t,r,n,a,l,c],this.current.textMatrixScale=Math.hypot(t,r),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,r,n,a){const l=this.ctx,c=this.current,d=c.font,p=c.textRenderingMode,u=c.fontSize/c.fontSizeScale,h=p&il.FILL_STROKE_MASK,m=!!(p&il.ADD_TO_PATH_FLAG),f=c.patternFill&&!d.missingFile;let x;(d.disableFontFace||m||f)&&(x=d.getPathGenerator(this.commonObjs,t)),d.disableFontFace||f?(l.save(),l.translate(r,n),l.beginPath(),x(l,u),a&&l.setTransform(...a),(h===il.FILL||h===il.FILL_STROKE)&&l.fill(),(h===il.STROKE||h===il.FILL_STROKE)&&l.stroke(),l.restore()):((h===il.FILL||h===il.FILL_STROKE)&&l.fillText(t,r,n),(h===il.STROKE||h===il.FILL_STROKE)&&l.strokeText(t,r,n)),m&&(this.pendingTextPaths||=[]).push({transform:Pn(l),x:r,y:n,fontSize:u,addToPath:x})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const r=t.getImageData(0,0,10,10).data;let n=!1;for(let a=3;a<r.length;a+=4)if(r[a]>0&&r[a]<255){n=!0;break}return mi(this,"isFontSubpixelAAEnabled",n)}showText(t){const r=this.current,n=r.font;if(n.isType3Font)return this.showType3Text(t);const a=r.fontSize;if(a===0)return;const l=this.ctx,c=r.fontSizeScale,d=r.charSpacing,p=r.wordSpacing,u=r.fontDirection,h=r.textHScale*u,m=t.length,f=n.vertical,x=f?1:-1,y=n.defaultVMetrics,b=a*r.fontMatrix[0],w=r.textRenderingMode===il.FILL&&!n.disableFontFace&&!r.patternFill;l.save(),l.transform(...r.textMatrix),l.translate(r.x,r.y+r.textRise),u>0?l.scale(h,-1):l.scale(h,1);let v;if(r.patternFill){l.save();const L=r.fillColor.getPattern(l,this,v0(l),Tl.FILL);v=Pn(l),l.restore(),l.fillStyle=L}let A=r.lineWidth;const S=r.textMatrixScale;if(S===0||A===0){const L=r.textRenderingMode&il.FILL_STROKE_MASK;(L===il.STROKE||L===il.FILL_STROKE)&&(A=this.getSinglePixelWidth())}else A/=S;if(c!==1&&(l.scale(c,c),A/=c),l.lineWidth=A,n.isInvalidPDFjsFont){const L=[];let M=0;for(const D of t)L.push(D.unicode),M+=D.width;l.fillText(L.join(""),0,0),r.x+=M*b*h,l.restore(),this.compose();return}let E=0,I;for(I=0;I<m;++I){const L=t[I];if(typeof L=="number"){E+=x*L*a/1e3;continue}let M=!1;const D=(L.isSpace?p:0)+d,P=L.fontChar,T=L.accent;let z,N,K=L.width;if(f){const F=L.vmetric||y,_=-(L.vmetric?F[1]:K*.5)*b,V=F[2]*b;K=F?-F[0]:K,z=_/c,N=(E+V)/c}else z=E/c,N=0;if(n.remeasure&&K>0){const F=l.measureText(P).width*1e3/a*c;if(K<F&&this.isFontSubpixelAAEnabled){const _=K/F;M=!0,l.save(),l.scale(_,1),z/=_}else K!==F&&(z+=(K-F)/2e3*a/c)}if(this.contentVisible&&(L.isInFont||n.missingFile)){if(w&&!T)l.fillText(P,z,N);else if(this.paintChar(P,z,N,v),T){const F=z+a*T.offset.x/c,_=N-a*T.offset.y/c;this.paintChar(T.fontChar,F,_,v)}}const q=f?K*b-D*u:K*b+D*u;E+=q,M&&l.restore()}f?r.y-=E:r.x+=E*h,l.restore(),this.compose()}showType3Text(t){const r=this.ctx,n=this.current,a=n.font,l=n.fontSize,c=n.fontDirection,d=a.vertical?1:-1,p=n.charSpacing,u=n.wordSpacing,h=n.textHScale*c,m=n.fontMatrix||$Y,f=t.length,x=n.textRenderingMode===il.INVISIBLE;let y,b,w,v;if(!(x||l===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),r.transform(...n.textMatrix),r.translate(n.x,n.y),r.scale(h,c),y=0;y<f;++y){if(b=t[y],typeof b=="number"){v=d*b*l/1e3,this.ctx.translate(v,0),n.x+=v*h;continue}const A=(b.isSpace?u:0)+p,S=a.charProcOperatorList[b.operatorListId];if(!S){Nr(`Type3 character "${b.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=b,this.save(),r.scale(l,l),r.transform(...m),this.executeOperatorList(S),this.restore()),w=jo.applyTransform([b.width,0],m)[0]*l+A,r.translate(w,0),n.x+=w*h}r.restore(),this.processingType3=null}}setCharWidth(t,r){}setCharWidthAndBounds(t,r,n,a,l,c){this.ctx.rect(n,a,l-n,c-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let r;if(t[0]==="TilingPattern"){const n=t[1],a=this.baseTransform||Pn(this.ctx),l={createCanvasGraphics:c=>new d8(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};r=new DX(t,n,this.ctx,l,a)}else r=this._getPattern(t[1],t[2]);return r}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,r=null){let n;return this.cachedPatterns.has(t)?n=this.cachedPatterns.get(t):(n=rNt(this.getObject(t)),this.cachedPatterns.set(t,n)),r&&(n.matrix=r),n}shadingFill(t){if(!this.contentVisible)return;const r=this.ctx;this.save();const n=this._getPattern(t);r.fillStyle=n.getPattern(r,this,v0(r),Tl.SHADING);const a=v0(r);if(a){const{width:l,height:c}=r.canvas,[d,p,u,h]=jo.getAxialAlignedBoundingBox([0,0,l,c],a);this.ctx.fillRect(d,p,u-d,h-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Gi("Should not call beginInlineImage")}beginImageData(){Gi("Should not call beginImageData")}paintFormXObjectBegin(t,r){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Pn(this.ctx),r)){const n=r[2]-r[0],a=r[3]-r[1];this.ctx.rect(r[0],r[1],n,a),this.current.updateRectMinMax(Pn(this.ctx),r),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;t.isolated||jM("TODO: Support non-isolated groups."),t.knockout&&Nr("Knockout groups not supported.");const n=Pn(r);if(t.matrix&&r.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=jo.getAxialAlignedBoundingBox(t.bbox,Pn(r));const l=[0,0,r.canvas.width,r.canvas.height];a=jo.intersect(a,l)||[0,0,0,0];const c=Math.floor(a[0]),d=Math.floor(a[1]),p=Math.max(Math.ceil(a[2])-c,1),u=Math.max(Math.ceil(a[3])-d,1);this.current.startNewPathAndClipBox([0,0,p,u]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(h,p,u),f=m.context;f.translate(-c,-d),f.transform(...n),t.smask?this.smaskStack.push({canvas:m.canvas,context:f,offsetX:c,offsetY:d,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(r.setTransform(1,0,0,1,0,0),r.translate(c,d),r.save()),uy(r,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=Pn(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const l=jo.getAxialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],a);this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(t,r,n,a,l){if(this.#e(),f$(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const c=r[2]-r[0],d=r[3]-r[1];if(l&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=c,r[3]=d;const[p,u]=jo.singularValueDecompose2dScale(Pn(this.ctx)),{viewportScale:h}=this,m=Math.ceil(c*this.outputScaleX*h),f=Math.ceil(d*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(m,f);const{canvas:x,context:y}=this.annotationCanvas;this.annotationCanvasMap.set(t,x),this.annotationCanvas.savedCtx=this.ctx,this.ctx=y,this.ctx.save(),this.ctx.setTransform(p,0,0,-u,0,d*u),f$(this.ctx)}else f$(this.ctx),this.ctx.rect(r[0],r[1],c,d),this.ctx.clip(),this.endPath()}this.current=new Eme(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const r=t.count;t=this.getObject(t.data,t),t.count=r;const n=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=lNt(t)),a.compiled)){a.compiled(n);return}const l=this._createMaskCanvas(t),c=l.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(c,l.offsetX,l.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,r,n=0,a=0,l,c){if(!this.contentVisible)return;t=this.getObject(t.data,t);const d=this.ctx;d.save();const p=Pn(d);d.transform(r,n,a,l,0,0);const u=this._createMaskCanvas(t);d.setTransform(1,0,0,1,u.offsetX-p[4],u.offsetY-p[5]);for(let h=0,m=c.length;h<m;h+=2){const f=jo.transform(p,[r,n,a,l,c[h],c[h+1]]),[x,y]=jo.applyTransform([0,0],f);d.drawImage(u.canvas,x,y)}d.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;for(const l of t){const{data:c,width:d,height:p,transform:u}=l,h=this.cachedCanvases.getCanvas("maskCanvas",d,p),m=h.context;m.save();const f=this.getObject(c,l);Ime(m,f),m.globalCompositeOperation="source-in",m.fillStyle=a?n.getPattern(m,this,v0(r),Tl.FILL):n,m.fillRect(0,0,d,p),m.restore(),r.save(),r.transform(...u),r.scale(1,-1),g$(r,h.canvas,0,0,d,p,0,-1,1,1),r.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){Nr("Dependent image isn't ready yet");return}this.paintInlineImageXObject(r)}paintImageXObjectRepeat(t,r,n,a){if(!this.contentVisible)return;const l=this.getObject(t);if(!l){Nr("Dependent image isn't ready yet");return}const c=l.width,d=l.height,p=[];for(let u=0,h=a.length;u<h;u+=2)p.push({transform:[r,0,0,n,a[u],a[u+1]],x:0,y:0,w:c,h:d});this.paintInlineImageXObjectGroup(l,p)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:r,width:n,height:a}=t,l=this.cachedCanvases.getCanvas("inlineImage",n,a),c=l.context;return c.filter=this.current.transferMaps,c.drawImage(r,0,0),c.filter="none",l.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const r=t.width,n=t.height,a=this.ctx;if(this.save(),!ul){const{filter:d}=a;d!=="none"&&d!==""&&(a.filter="none")}a.scale(1/r,-1/n);let l;if(t.bitmap)l=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)l=t;else{const p=this.cachedCanvases.getCanvas("inlineImage",r,n).context;Lme(p,t),l=this.applyTransferMapsToCanvas(p)}const c=this._scaleImage(l,v0(a));a.imageSmoothingEnabled=jme(Pn(a),t.interpolate),g$(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-n,r,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,r){if(!this.contentVisible)return;const n=this.ctx;let a;if(t.bitmap)a=t.bitmap;else{const l=t.width,c=t.height,p=this.cachedCanvases.getCanvas("inlineImage",l,c).context;Lme(p,t),a=this.applyTransferMapsToCanvas(p)}for(const l of r)n.save(),n.transform(...l.transform),n.scale(1,-1),g$(n,a,l.x,l.y,l.w,l.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,r){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,r){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(r||(this.pendingClip===Mme?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Pn(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const r=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,a)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:r,b:n,c:a,d:l}=this.ctx.getTransform();let c,d;if(n===0&&a===0){const p=Math.abs(r),u=Math.abs(l);if(p===u)if(t===0)c=d=1/p;else{const h=p*t;c=d=h<1?1/h:1}else if(t===0)c=1/p,d=1/u;else{const h=p*t,m=u*t;c=h<1?1/h:1,d=m<1?1/m:1}}else{const p=Math.abs(r*l-n*a),u=Math.hypot(r,n),h=Math.hypot(a,l);if(t===0)c=h/p,d=u/p;else{const m=t*p;c=h>m?h/m:1,d=u>m?u/m:1}}this._cachedScaleForStroking[0]=c,this._cachedScaleForStroking[1]=d}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:r}=this,{lineWidth:n}=this.current,[a,l]=this.getScaleForStroking();if(r.lineWidth=n||1,a===1&&l===1){r.stroke();return}const c=r.getLineDash();if(t&&r.save(),r.scale(a,l),c.length>0){const d=Math.max(a,l);r.setLineDash(c.map(p=>p/d)),r.lineDashOffset/=d}r.stroke(),t&&r.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const e in J1)d8.prototype[e]!==void 0&&(d8.prototype[J1[e]]=d8.prototype[e]);class ov{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");this.#e=t}static get workerSrc(){return this.#t}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");this.#t=t}}const x$={DATA:1,ERROR:2},Ca={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function qc(e){switch(e instanceof Error||typeof e=="object"&&e!==null||Gi('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new p5(e.message);case"MissingPDFException":return new d5(e.message);case"PasswordException":return new SY(e.message,e.code);case"UnexpectedResponseException":return new MM(e.message,e.status);case"UnknownErrorException":return new EY(e.message,e.details);default:return new EY(e.message,e.toString())}}class wb{constructor(t,r,n){this.sourceName=t,this.targetName=r,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=a=>{const l=a.data;if(l.targetName!==this.sourceName)return;if(l.stream){this.#t(l);return}if(l.callback){const d=l.callbackId,p=this.callbackCapabilities[d];if(!p)throw new Error(`Cannot resolve callback ${d}`);if(delete this.callbackCapabilities[d],l.callback===x$.DATA)p.resolve(l.data);else if(l.callback===x$.ERROR)p.reject(qc(l.reason));else throw new Error("Unexpected callback case");return}const c=this.actionHandler[l.action];if(!c)throw new Error(`Unknown action from worker: ${l.action}`);if(l.callbackId){const d=this.sourceName,p=l.sourceName;new Promise(function(u){u(c(l.data))}).then(function(u){n.postMessage({sourceName:d,targetName:p,callback:x$.DATA,callbackId:l.callbackId,data:u})},function(u){n.postMessage({sourceName:d,targetName:p,callback:x$.ERROR,callbackId:l.callbackId,reason:qc(u)})});return}if(l.streamId){this.#e(l);return}c(l.data)},n.addEventListener("message",this._onComObjOnMessage)}on(t,r){const n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=r}send(t,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:r},n)}sendWithPromise(t,r,n){const a=this.callbackId++,l=Promise.withResolvers();this.callbackCapabilities[a]=l;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:r},n)}catch(c){l.reject(c)}return l.promise}sendWithStream(t,r,n,a){const l=this.streamId++,c=this.sourceName,d=this.targetName,p=this.comObj;return new ReadableStream({start:u=>{const h=Promise.withResolvers();return this.streamControllers[l]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},p.postMessage({sourceName:c,targetName:d,action:t,streamId:l,data:r,desiredSize:u.desiredSize},a),h.promise},pull:u=>{const h=Promise.withResolvers();return this.streamControllers[l].pullCall=h,p.postMessage({sourceName:c,targetName:d,stream:Ca.PULL,streamId:l,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Wa(u instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[l].cancelCall=h,this.streamControllers[l].isClosed=!0,p.postMessage({sourceName:c,targetName:d,stream:Ca.CANCEL,streamId:l,reason:qc(u)}),h.promise}},n)}#e(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this,d=this.actionHandler[t.action],p={enqueue(u,h=1,m){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),l.postMessage({sourceName:n,targetName:a,stream:Ca.ENQUEUE,streamId:r,chunk:u},m)},close(){this.isCancelled||(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.CLOSE,streamId:r}),delete c.streamSinks[r])},error(u){Wa(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.ERROR,streamId:r,reason:qc(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};p.sinkCapability.resolve(),p.ready=p.sinkCapability.promise,this.streamSinks[r]=p,new Promise(function(u){u(d(t.data,p))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,success:!0})},function(u){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,reason:qc(u)})})}#t(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this.streamControllers[r],d=this.streamSinks[r];switch(t.stream){case Ca.START_COMPLETE:t.success?c.startCall.resolve():c.startCall.reject(qc(t.reason));break;case Ca.PULL_COMPLETE:t.success?c.pullCall.resolve():c.pullCall.reject(qc(t.reason));break;case Ca.PULL:if(!d){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0});break}d.desiredSize<=0&&t.desiredSize>0&&d.sinkCapability.resolve(),d.desiredSize=t.desiredSize,new Promise(function(p){p(d.onPull?.())}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,reason:qc(p)})});break;case Ca.ENQUEUE:if(Wa(c,"enqueue should have stream controller"),c.isClosed)break;c.controller.enqueue(t.chunk);break;case Ca.CLOSE:if(Wa(c,"close should have stream controller"),c.isClosed)break;c.isClosed=!0,c.controller.close(),this.#o(c,r);break;case Ca.ERROR:Wa(c,"error should have stream controller"),c.controller.error(qc(t.reason)),this.#o(c,r);break;case Ca.CANCEL_COMPLETE:t.success?c.cancelCall.resolve():c.cancelCall.reject(qc(t.reason)),this.#o(c,r);break;case Ca.CANCEL:if(!d)break;new Promise(function(p){p(d.onCancel?.(qc(t.reason)))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,reason:qc(p)})}),d.sinkCapability.reject(qc(t.reason)),d.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}async#o(t,r){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[r]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class uNt{#e;#t;constructor({parsedData:t,rawData:r}){this.#e=t,this.#t=r}getRaw(){return this.#t}get(t){return this.#e.get(t)??null}getAll(){return AX(this.#e)}has(t){return this.#e.has(t)}}const Sm=Symbol("INTERNAL");class hNt{#e=!1;#t=!1;#o=!1;#i=!0;constructor(t,{name:r,intent:n,usage:a}){this.#e=!!(t&Nd.DISPLAY),this.#t=!!(t&Nd.PRINT),this.name=r,this.intent=n,this.usage=a}get visible(){if(this.#o)return this.#i;if(!this.#i)return!1;const{print:t,view:r}=this.usage;return this.#e?r?.viewState!=="OFF":this.#t?t?.printState!=="OFF":!0}_setVisible(t,r,n=!1){t!==Sm&&Gi("Internal method `_setVisible` called."),this.#o=n,this.#i=r}}class mNt{#e=null;#t=new Map;#o=null;#i=null;constructor(t,r=Nd.DISPLAY){if(this.renderingIntent=r,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#i=t.order;for(const n of t.groups)this.#t.set(n.id,new hNt(r,n));if(t.baseState==="OFF")for(const n of this.#t.values())n._setVisible(Sm,!1);for(const n of t.on)this.#t.get(n)._setVisible(Sm,!0);for(const n of t.off)this.#t.get(n)._setVisible(Sm,!1);this.#o=this.getHash()}}#s(t){const r=t.length;if(r<2)return!0;const n=t[0];for(let a=1;a<r;a++){const l=t[a];let c;if(Array.isArray(l))c=this.#s(l);else if(this.#t.has(l))c=this.#t.get(l).visible;else return Nr(`Optional content group not found: ${l}`),!0;switch(n){case"And":if(!c)return!1;break;case"Or":if(c)return!0;break;case"Not":return!c;default:return!0}}return n==="And"}isVisible(t){if(this.#t.size===0)return!0;if(!t)return jM("Optional content group not defined."),!0;if(t.type==="OCG")return this.#t.has(t.id)?this.#t.get(t.id).visible:(Nr(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#s(t.expression);if(!t.policy||t.policy==="AnyOn"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!1}return!0}return Nr(`Unknown optional content policy ${t.policy}.`),!0}return Nr(`Unknown group type ${t.type}.`),!0}setVisibility(t,r=!0){const n=this.#t.get(t);if(!n){Nr(`Optional content group not found: ${t}`);return}n._setVisible(Sm,!!r,!0),this.#e=null}setOCGState({state:t,preserveRB:r}){let n;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":n=a;continue}const l=this.#t.get(a);if(l)switch(n){case"ON":l._setVisible(Sm,!0);break;case"OFF":l._setVisible(Sm,!1);break;case"Toggle":l._setVisible(Sm,!l.visible);break}}this.#e=null}get hasInitialVisibility(){return this.#o===null||this.getHash()===this.#o}getOrder(){return this.#t.size?this.#i?this.#i.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?AX(this.#t):null}getGroup(t){return this.#t.get(t)||null}getHash(){if(this.#e!==null)return this.#e;const t=new Jze;for(const[r,n]of this.#t)t.update(`${r}:${n.visible}`);return this.#e=t.hexdigest()}}class gNt{constructor(t,{disableRange:r=!1,disableStream:n=!1}){Wa(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:l,progressiveDone:c,contentDispositionFilename:d}=t;if(this._queuedChunks=[],this._progressiveDone=c,this._contentDispositionFilename=d,l?.length>0){const p=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;this._queuedChunks.push(p)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((p,u)=>{this._onReceiveData({begin:p,chunk:u})}),t.addProgressListener((p,u)=>{this._onProgress({loaded:p,total:u})}),t.addProgressiveReadListener(p=>{this._onReceiveData({chunk:p})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const a=this._rangeReaders.some(function(l){return l._begin!==t?!1:(l._enqueue(n),!0)});Wa(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){t.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const r=this._rangeReaders.indexOf(t);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){Wa(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new fNt(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new xNt(this,t,r);return this._pdfDataRangeTransport.requestDataRange(t,r),this._rangeReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeReaders.slice(0))r.cancel(t);this._pdfDataRangeTransport.abort()}}class fNt{constructor(t,r,n=!1,a=null){this._stream=t,this._done=n||!1,this._filename=LX(a)?a:null,this._queuedChunks=r||[],this._loaded=0;for(const l of this._queuedChunks)this._loaded+=l.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class xNt{constructor(t,r,n){this._stream=t,this._begin=r,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function yNt(e){let t=!0,r=n("filename\\*","i").exec(e);if(r){r=r[1];let h=d(r);return h=unescape(h),h=p(h),h=u(h),l(h)}if(r=c(e),r){const h=u(r);return l(h)}if(r=n("filename","i").exec(e),r){r=r[1];let h=d(r);return h=u(h),l(h)}function n(h,m){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',m)}function a(h,m){if(h){if(!/^[\x00-\xFF]+$/.test(m))return m;try{const f=new TextDecoder(h,{fatal:!0}),x=BM(m);m=f.decode(x),t=!1}catch{}}return m}function l(h){return t&&/[\x80-\xff]/.test(h)&&(h=a("utf-8",h),t&&(h=a("iso-8859-1",h))),h}function c(h){const m=[];let f;const x=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=x.exec(h))!==null;){let[,b,w,v]=f;if(b=parseInt(b,10),b in m){if(b===0)break;continue}m[b]=[w,v]}const y=[];for(let b=0;b<m.length&&b in m;++b){let[w,v]=m[b];v=d(v),w&&(v=unescape(v),b===0&&(v=p(v))),y.push(v)}return y.join("")}function d(h){if(h.startsWith('"')){const m=h.slice(1).split('\\"');for(let f=0;f<m.length;++f){const x=m[f].indexOf('"');x!==-1&&(m[f]=m[f].slice(0,x),m.length=f+1),m[f]=m[f].replaceAll(/\\(.)/g,"$1")}h=m.join('"')}return h}function p(h){const m=h.indexOf("'");if(m===-1)return h;const f=h.slice(0,m),y=h.slice(m+1).replace(/^[^']*'/,"");return a(f,y)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(m,f,x,y){if(x==="q"||x==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,w){return String.fromCharCode(parseInt(w,16))}),a(f,y);try{y=atob(y)}catch{}return a(f,y)})}return""}function TX({getResponseHeader:e,isHttp:t,rangeChunkSize:r,disableRange:n}){const a={allowRangeRequests:!1,suggestedLength:void 0},l=parseInt(e("Content-Length"),10);return!Number.isInteger(l)||(a.suggestedLength=l,l<=2*r)||n||!t||e("Accept-Ranges")!=="bytes"||(e("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function zX(e){const t=e("Content-Disposition");if(t){let r=yNt(t);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if(LX(r))return r}return null}function FM(e,t){return e===404||e===0&&t.startsWith("file:")?new d5('Missing PDF "'+t+'".'):new MM(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function tRe(e){return e===200||e===206}function oRe(e,t,r){return{method:"GET",headers:e,signal:r.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function rRe(e){const t=new Headers;for(const r in e){const n=e[r];n!==void 0&&t.append(r,n)}return t}function iRe(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Nr(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Bme{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 Wa(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new bNt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new wNt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class bNt{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const r=t.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._headers=rRe(this._stream.httpHeaders);const n=r.url;fetch(n,oRe(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!tRe(a.status))throw FM(a.status,n);this._reader=a.body.getReader(),this._headersCapability.resolve();const l=p=>a.headers.get(p),{allowRangeRequests:c,suggestedLength:d}=TX({getResponseHeader:l,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=c,this._contentLength=d||this._contentLength,this._filename=zX(l),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new p5("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:iRe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class wNt{constructor(t,r,n){this._stream=t,this._reader=null,this._loaded=0;const a=t.source;this._withCredentials=a.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController,this._headers=rRe(this._stream.httpHeaders),this._headers.append("Range",`bytes=${r}-${n-1}`);const l=a.url;fetch(l,oRe(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!tRe(c.status))throw FM(c.status,l);this._readCapability.resolve(),this._reader=c.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:iRe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}const a_=200,s_=206;function vNt(e){const t=e.response;return typeof t!="string"?t:BM(t).buffer}class CNt{constructor(t,r={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&r.httpHeaders||Object.create(null),this.withCredentials=r.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,r,n){const a={begin:t,end:r};for(const l in n)a[l]=n[l];return this.request(a)}requestFull(t){return this.request(t)}request(t){const r=new XMLHttpRequest,n=this.currXhrId++,a=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const l in this.httpHeaders){const c=this.httpHeaders[l];c!==void 0&&r.setRequestHeader(l,c)}return this.isHttp&&"begin"in t&&"end"in t?(r.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.expectedStatus=s_):a.expectedStatus=a_,r.responseType="arraybuffer",t.onError&&(r.onerror=function(l){t.onError(r.status)}),r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),a.onHeadersReceived=t.onHeadersReceived,a.onDone=t.onDone,a.onError=t.onError,a.onProgress=t.onProgress,r.send(null),n}onProgress(t,r){const n=this.pendingRequests[t];n&&n.onProgress?.(r)}onStateChange(t,r){const n=this.pendingRequests[t];if(!n)return;const a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),a.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],a.status===0&&this.isHttp){n.onError?.(a.status);return}const l=a.status||a_;if(!(l===a_&&n.expectedStatus===s_)&&l!==n.expectedStatus){n.onError?.(a.status);return}const d=vNt(a);if(l===s_){const p=a.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(p);n.onDone({begin:parseInt(u[1],10),chunk:d})}else d?n.onDone({begin:0,chunk:d}):n.onError?.(a.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const r=this.pendingRequests[t].xhr;delete this.pendingRequests[t],r.abort()}}class ANt{constructor(t){this._source=t,this._manager=new CNt(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const r=this._rangeRequestReaders.indexOf(t);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return Wa(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new $Nt(this._manager,this._source),this._fullRequestReader}getRangeReader(t,r){const n=new kNt(this._manager,t,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class $Nt{constructor(t,r){this._manager=t;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url,this._fullRequestId=t.requestFull(n),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,r=this._manager.getRequestXhr(t),n=c=>r.getResponseHeader(c),{allowRangeRequests:a,suggestedLength:l}=TX({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=l||this._contentLength,this._filename=zX(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=FM(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class kNt{constructor(t,r,n){this._manager=t;const a={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(r,n,a),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const r=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=FM(t,this._url);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const nRe=/^file:\/\/\/[a-zA-Z]:\//;function SNt(e){const t=Rh.get("url"),r=t.parse(e);return r.protocol==="file:"||r.host?r:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(r.host||(r.protocol="file:"),r)}class ENt{constructor(t){this.source=t,this.url=SNt(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 Wa(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new jNt(this):new LNt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=this.isFsUrl?new MNt(this,t,r):new INt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class aRe{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=t.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new p5("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class sRe{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const r=t.source;this._isStreamingSupported=!r.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function BL(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class LNt extends aRe{constructor(t){super(t);const r=n=>{if(n.statusCode===404){const d=new d5(`Missing PDF "${this._url}".`);this._storedError=d,this._headersCapability.reject(d);return}this._headersCapability.resolve(),this._setReadableStream(n);const a=d=>this._readableStream.headers[d.toLowerCase()],{allowRangeRequests:l,suggestedLength:c}=TX({getResponseHeader:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=zX(a)};if(this._request=null,this._url.protocol==="http:"){const n=Rh.get("http");this._request=n.request(BL(this._url,t.httpHeaders),r)}else{const n=Rh.get("https");this._request=n.request(BL(this._url,t.httpHeaders),r)}this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class INt extends sRe{constructor(t,r,n){super(t),this._httpHeaders={};for(const l in t.httpHeaders){const c=t.httpHeaders[l];c!==void 0&&(this._httpHeaders[l]=c)}this._httpHeaders.Range=`bytes=${r}-${n-1}`;const a=l=>{if(l.statusCode===404){const c=new d5(`Missing PDF "${this._url}".`);this._storedError=c;return}this._setReadableStream(l)};if(this._request=null,this._url.protocol==="http:"){const l=Rh.get("http");this._request=l.request(BL(this._url,this._httpHeaders),a)}else{const l=Rh.get("https");this._request=l.request(BL(this._url,this._httpHeaders),a)}this._request.on("error",l=>{this._storedError=l}),this._request.end()}}class jNt extends aRe{constructor(t){super(t);let r=decodeURIComponent(this._url.path);nRe.test(this._url.href)&&(r=r.replace(/^\//,""));const n=Rh.get("fs");n.promises.lstat(r).then(a=>{this._contentLength=a.size,this._setReadableStream(n.createReadStream(r)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=new d5(`Missing PDF "${r}".`)),this._storedError=a,this._headersCapability.reject(a)})}}class MNt extends sRe{constructor(t,r,n){super(t);let a=decodeURIComponent(this._url.path);nRe.test(this._url.href)&&(a=a.replace(/^\//,""));const l=Rh.get("fs");this._setReadableStream(l.createReadStream(a,{start:r,end:n-1}))}}const BNt=1e5,rc=30,PNt=.8;let PL=class Nu{#e=Promise.withResolvers();#t=null;#o=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#n=0;#l=0;#d=null;#p=null;#h=0;#c=0;#a=Object.create(null);#m=[];#f=null;#u=[];#y=new WeakMap;#g=null;static#b=new Map;static#v=new Map;static#A=null;static#k=new Set;constructor({textContentSource:t,container:r,viewport:n}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(p){p.enqueue(t),p.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#p=r,this.#c=n.scale*(globalThis.devicePixelRatio||1),this.#h=n.rotation,this.#r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:l,pageX:c,pageY:d}=n.rawDims;this.#g=[1,0,0,-1,-c,d+l],this.#l=a,this.#n=l,Nu.#x(),H4(r,n),this.#e.promise.catch(()=>{}).then(()=>{Nu.#k.delete(this),this.#r=null,this.#a=null})}render(){const t=()=>{this.#d.read().then(({value:r,done:n})=>{if(n){this.#e.resolve();return}this.#s??=r.lang,Object.assign(this.#a,r.styles),this.#S(r.items),t()},this.#e.reject)};return this.#d=this.#f.getReader(),Nu.#k.add(this),t(),this.#e.promise}update({viewport:t,onBefore:r=null}){const n=t.scale*(globalThis.devicePixelRatio||1),a=t.rotation;if(a!==this.#h&&(r?.(),this.#h=a,H4(this.#p,{rotation:a})),n!==this.#c){r?.(),this.#c=n;const l={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:Nu.#w(this.#s)};for(const c of this.#u)l.properties=this.#y.get(c),l.div=c,this.#$(l)}}cancel(){const t=new p5("TextLayer task cancelled.");this.#d?.cancel(t).catch(()=>{}),this.#d=null,this.#e.reject(t)}get textDivs(){return this.#u}get textContentItemsStr(){return this.#m}#S(t){if(this.#o)return;this.#r.ctx??=Nu.#w(this.#s);const r=this.#u,n=this.#m;for(const a of t){if(r.length>BNt){Nr("Ignoring additional textDivs for performance reasons."),this.#o=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const l=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id!==null&&this.#t.setAttribute("id",`${a.id}`),l.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(a.str),this.#j(a)}}#j(t){const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#u.push(r);const a=jo.transform(this.#g,t.transform);let l=Math.atan2(a[1],a[0]);const c=this.#a[t.fontName];c.vertical&&(l+=Math.PI/2);const d=this.#i&&c.fontSubstitution||c.fontFamily,p=Math.hypot(a[2],a[3]),u=p*Nu.#C(d,this.#s);let h,m;l===0?(h=a[4],m=a[5]-u):(h=a[4]+u*Math.sin(l),m=a[5]-u*Math.cos(l));const f="calc(var(--scale-factor)*",x=r.style;this.#t===this.#p?(x.left=`${(100*h/this.#l).toFixed(2)}%`,x.top=`${(100*m/this.#n).toFixed(2)}%`):(x.left=`${f}${h.toFixed(2)}px)`,x.top=`${f}${m.toFixed(2)}px)`),x.fontSize=`${f}${(Nu.#A*p).toFixed(2)}px)`,x.fontFamily=d,n.fontSize=p,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#i&&(r.dataset.fontName=c.fontSubstitutionLoadedName||t.fontName),l!==0&&(n.angle=l*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const b=Math.abs(t.transform[0]),w=Math.abs(t.transform[3]);b!==w&&Math.max(b,w)/Math.min(b,w)>1.5&&(y=!0)}if(y&&(n.canvasWidth=c.vertical?t.height:t.width),this.#y.set(r,n),this.#r.div=r,this.#r.properties=n,this.#$(this.#r),n.hasText&&this.#t.append(r),n.hasEOL){const b=document.createElement("br");b.setAttribute("role","presentation"),this.#t.append(b)}}#$(t){const{div:r,properties:n,ctx:a,prevFontSize:l,prevFontFamily:c}=t,{style:d}=r;let p="";if(Nu.#A>1&&(p=`scale(${1/Nu.#A})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:u}=d,{canvasWidth:h,fontSize:m}=n;(l!==m||c!==u)&&(a.font=`${m*this.#c}px ${u}`,t.prevFontSize=m,t.prevFontFamily=u);const{width:f}=a.measureText(r.textContent);f>0&&(p=`scaleX(${h*this.#c/f}) ${p}`)}n.angle!==0&&(p=`rotate(${n.angle}deg) ${p}`),p.length>0&&(d.transform=p)}static cleanup(){if(!(this.#k.size>0)){this.#b.clear();for(const{canvas:t}of this.#v.values())t.remove();this.#v.clear()}}static#w(t=null){let r=this.#v.get(t||="");if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(t,r)}return r}static#x(){if(this.#A!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),this.#A=t.getBoundingClientRect().height,t.remove()}static#C(t,r){const n=this.#b.get(t);if(n)return n;const a=this.#w(r),l=a.font;a.canvas.width=a.canvas.height=rc,a.font=`${rc}px ${t}`;const c=a.measureText("");let d=c.fontBoundingBoxAscent,p=Math.abs(c.fontBoundingBoxDescent);if(d){const m=d/(d+p);return this.#b.set(t,m),a.canvas.width=a.canvas.height=0,a.font=l,m}a.strokeStyle="red",a.clearRect(0,0,rc,rc),a.strokeText("g",0,0);let u=a.getImageData(0,0,rc,rc).data;p=0;for(let m=u.length-1-3;m>=0;m-=4)if(u[m]>0){p=Math.ceil(m/4/rc);break}a.clearRect(0,0,rc,rc),a.strokeText("A",0,rc),u=a.getImageData(0,0,rc,rc).data,d=0;for(let m=0,f=u.length;m<f;m+=4)if(u[m]>0){d=rc-Math.floor(m/4/rc);break}a.canvas.width=a.canvas.height=0,a.font=l;const h=d?d/(d+p):PNt;return this.#b.set(t,h),h}};function DNt(){qze("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:e,container:t,viewport:r,...n}=arguments[0],a=Object.keys(n);a.length>0&&Nr("Ignoring `renderTextLayer` parameters: "+a.join(", "));const l=new PL({textContentSource:e,container:t,viewport:r}),{textDivs:c,textContentItemsStr:d}=l;return{promise:l.render(),textDivs:c,textContentItemsStr:d}}function TNt(){qze("`updateTextLayer`, please use `TextLayer` instead.")}class rv{static textContent(t){const r=[],n={items:r,styles:Object.create(null)};function a(l){if(!l)return;let c=null;const d=l.name;if(d==="#text")c=l.value;else if(rv.shouldBuildText(d))l?.attributes?.textContent?c=l.attributes.textContent:l.value&&(c=l.value);else return;if(c!==null&&r.push({str:c}),!!l.children)for(const p of l.children)a(p)}return a(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const zNt=65536,RNt=100,FNt=5e3,ONt=ul?qOt:ROt,NNt=ul?ZOt:Yze,HNt=ul?KOt:zOt,_Nt=ul?JOt:Kze;function VNt(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new RX,{docId:r}=t,n=e.url?QNt(e.url):null,a=e.data?UNt(e.data):null,l=e.httpHeaders||null,c=e.withCredentials===!0,d=e.password??null,p=e.range instanceof lRe?e.range:null,u=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:zNt;let h=e.worker instanceof Ud?e.worker:null;const m=e.verbosity,f=typeof e.docBaseUrl=="string"&&!EX(e.docBaseUrl)?e.docBaseUrl:null,x=typeof e.cMapUrl=="string"?e.cMapUrl:null,y=e.cMapPacked!==!1,b=e.CMapReaderFactory||NNt,w=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,v=e.StandardFontDataFactory||_Nt,A=e.stopAtErrors!==!0,S=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,E=e.isEvalSupported!==!1,I=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!ul,L=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,M=typeof e.disableFontFace=="boolean"?e.disableFontFace:ul,D=e.fontExtraProperties===!0,P=e.enableXfa===!0,T=e.ownerDocument||globalThis.document,z=e.disableRange===!0,N=e.disableStream===!0,K=e.disableAutoFetch===!0,q=e.pdfBug===!0,F=e.enableHWA===!0,_=p?p.length:e.length??NaN,V=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!ul&&!M,O=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:b===Yze&&v===Kze&&x&&w&&bb(x,document.baseURI)&&bb(w,document.baseURI),R=e.canvasFactory||new ONt({ownerDocument:T,enableHWA:F}),H=e.filterFactory||new HNt({docId:r,ownerDocument:T}),ee=null;kOt(m);const Y={canvasFactory:R,filterFactory:H};if(O||(Y.cMapReaderFactory=new b({baseUrl:x,isCompressed:y}),Y.standardFontDataFactory=new v({baseUrl:w})),!h){const J={verbosity:m,port:ov.workerPort};h=J.port?Ud.fromPort(J):new Ud(J),t._worker=h}const G={docId:r,apiVersion:"4.4.168",data:a,password:d,disableAutoFetch:K,rangeChunkSize:u,length:_,docBaseUrl:f,enableXfa:P,evaluatorOptions:{maxImageSize:S,disableFontFace:M,ignoreErrors:A,isEvalSupported:E,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:L,fontExtraProperties:D,useSystemFonts:V,cMapUrl:O?x:null,standardFontDataUrl:O?w:null}},X={disableFontFace:M,fontExtraProperties:D,ownerDocument:T,pdfBug:q,styleElement:ee,loadingParams:{disableAutoFetch:K,enableXfa:P}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const J=h.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let ie;if(p)ie=new gNt(p,{disableRange:z,disableStream:N});else if(!a){if(!n)throw new Error("getDocument - no `url` parameter provided.");ie=(me=>ul?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&bb(me.url)?new Bme(me):new ENt(me):bb(me.url)?new Bme(me):new ANt(me))({url:n,length:_,httpHeaders:l,withCredentials:c,rangeChunkSize:u,disableRange:z,disableStream:N})}return J.then(ye=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const me=new wb(r,ye,h.port),de=new KNt(me,t,ie,X,Y);t._transport=de,me.send("Ready",null)})}).catch(t._capability.reject),t}function QNt(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(ul&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function UNt(e){if(ul&&typeof AE<"u"&&e instanceof AE)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e=="string")return BM(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 Pme(e){return typeof e=="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class RX{static#e=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${RX.#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 lRe=class{constructor(t,r,n=!1,a=null){this.length=t,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=a,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,r){for(const n of this._rangeListeners)n(t,r)}onDataProgress(t,r){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(t,r)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const r of this._progressiveReadListeners)r(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,r){Gi("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class WNt{constructor(t,r){this._pdfInfo=t,this._transport=r}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return mi(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(r)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class GNt{#e=null;#t=!1;constructor(t,r,n,a=!1){this._pageIndex=t,this._pageInfo=r,this._transport=n,this._stats=a?new bme:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new cRe,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:r=this.rotate,offsetX:n=0,offsetY:a=0,dontFlip:l=!1}={}){return new hC({viewBox:this.view,scale:t,rotation:r,offsetX:n,offsetY:a,dontFlip:l})}getAnnotations({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return mi(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:r,intent:n="display",annotationMode:a=Fm.ENABLE,transform:l=null,background:c=null,optionalContentConfigPromise:d=null,annotationCanvasMap:p=null,pageColors:u=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(n,a,h),{renderingIntent:f,cacheKey:x}=m;this.#t=!1,this.#i(),d||=this._transport.getOptionalContentConfig(f);let y=this._intentStates.get(x);y||(y=Object.create(null),this._intentStates.set(x,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const b=!!(f&Nd.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const w=S=>{y.renderTasks.delete(v),(this._maybeCleanupAfterRender||b)&&(this.#t=!0),this.#o(!b),S?(v.capability.reject(S),this._abortOperatorList({intentState:y,reason:S instanceof Error?S:new Error(S)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new W6({callback:w,params:{canvasContext:t,viewport:r,transform:l,background:c},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});(y.renderTasks||=new Set).add(v);const A=v.task;return Promise.all([y.displayReadyCapability.promise,d]).then(([S,E])=>{if(this.destroyed){w();return}if(this._stats?.time("Rendering"),!(E.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:S,optionalContentConfig:E}),v.operatorListChanged()}).catch(w),A}getOperatorList({intent:t="display",annotationMode:r=Fm.ENABLE,printAnnotationStorage:n=null}={}){function a(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(d))}const l=this._transport.getRenderingIntent(t,r,n,!0);let c=this._intentStates.get(l.cacheKey);c||(c=Object.create(null),this._intentStates.set(l.cacheKey,c));let d;return c.opListReadCapability||(d=Object.create(null),d.operatorListChanged=a,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(d),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(l)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:r===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>rv.textContent(n));const r=this.streamTextContent(t);return new Promise(function(n,a){function l(){c.read().then(function({value:p,done:u}){if(u){n(d);return}d.lang??=p.lang,Object.assign(d.styles,p.styles),d.items.push(...p.items),l()},a)}const c=r.getReader(),d={items:[],styles:Object.create(null),lang:null};l()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#t=!0;const r=this.#o(!1);return t&&r&&(this._stats&&=new bme),r}#o(t=!1){if(this.#i(),!this.#t||this.destroyed)return!1;if(t)return this.#e=setTimeout(()=>{this.#e=null,this.#o(!1)},FNt),!1;for(const{renderTasks:r,operatorList:n}of this._intentStates.values())if(r.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#i(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(t,r){const n=this._intentStates.get(r);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,r){for(let n=0,a=t.length;n<a;n++)r.operatorList.fnArray.push(t.fnArray[n]),r.operatorList.argsArray.push(t.argsArray[n]);r.operatorList.lastChunk=t.lastChunk,r.operatorList.separateAnnots=t.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();t.lastChunk&&this.#o(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:r,annotationStorageSerializable:n}){const{map:a,transfer:l}=n,d=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:r,annotationStorage:a},l).getReader(),p=this._intentStates.get(r);p.streamReader=d;const u=()=>{d.read().then(({value:h,done:m})=>{if(m){p.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,p),u())},h=>{if(p.streamReader=null,!this._transport.destroyed){if(p.operatorList){p.operatorList.lastChunk=!0;for(const m of p.renderTasks)m.operatorListChanged();this.#o(!0)}if(p.displayReadyCapability)p.displayReadyCapability.reject(h);else if(p.opListReadCapability)p.opListReadCapability.reject(h);else throw h}})};u()}_abortOperatorList({intentState:t,reason:r,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(r instanceof SX){let a=RNt;r.extraDelay>0&&r.extraDelay<1e3&&(a+=r.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:r,force:!0})},a);return}}if(t.streamReader.cancel(new p5(r.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,l]of this._intentStates)if(l===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}class YNt{#e=new Set;#t=Promise.resolve();postMessage(t,r){const n={data:structuredClone(t,r?{transfer:r}:null)};this.#t.then(()=>{for(const a of this.#e)a.call(this,n)})}addEventListener(t,r){this.#e.add(r)}removeEventListener(t,r){this.#e.delete(r)}terminate(){this.#e.clear()}}const F0={isWorkerDisabled:!1,fakeWorkerId:0};ul&&(F0.isWorkerDisabled=!0,ov.workerSrc||="./pdf.worker.mjs"),F0.isSameOrigin=function(e,t){let r;try{if(r=new URL(e),!r.origin||r.origin==="null")return!1}catch{return!1}const n=new URL(t,r);return r.origin===n.origin},F0.createCDNWrapper=function(e){const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class Ud{static#e;constructor({name:t=null,port:r=null,verbosity:n=SOt()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,r){if(Ud.#e?.has(r))throw new Error("Cannot use more than one PDFWorker per port.");(Ud.#e||=new WeakMap).set(r,this),this._initializeFromPort(r);return}this._initialize()}get promise(){return ul?Promise.all([Rh.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 wb("main","worker",t),this._messageHandler.on("ready",function(){}),this.#t()}_initialize(){if(F0.isWorkerDisabled||Ud.#o){this._setupFakeWorker();return}let{workerSrc:t}=Ud;try{F0.isSameOrigin(window.location.href,t)||(t=F0.createCDNWrapper(new URL(t,window.location).href));const r=new Worker(t,{type:"module"}),n=new wb("main","worker",r),a=()=>{l.abort(),n.destroy(),r.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},l=new AbortController;r.addEventListener("error",()=>{this._webWorker||a()},{signal:l.signal}),n.on("test",d=>{if(l.abort(),this.destroyed||!d){a();return}this._messageHandler=n,this._port=r,this._webWorker=r,this.#t()}),n.on("ready",d=>{if(l.abort(),this.destroyed){a();return}try{c()}catch{this._setupFakeWorker()}});const c=()=>{const d=new Uint8Array;n.send("test",d,[d.buffer])};c();return}catch{jM("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){F0.isWorkerDisabled||(Nr("Setting up fake worker."),F0.isWorkerDisabled=!0),Ud._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const r=new YNt;this._port=r;const n=`fake${F0.fakeWorkerId++}`,a=new wb(n+"_worker",n,r);t.setup(a,r),this._messageHandler=new wb(n,n+"_worker",r),this.#t()}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),Ud.#e?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const r=this.#e?.get(t.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Ud(t)}static get workerSrc(){if(ov.workerSrc)return ov.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#o(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return mi(this,"_setupFakeWorkerGlobal",(async()=>this.#o?this.#o:(await import(this.workerSrc)).WorkerMessageHandler)())}}class KNt{#e=new Map;#t=new Map;#o=new Map;#i=new Map;#s=null;constructor(t,r,n,a,l){this.messageHandler=t,this.loadingTask=r,this.commonObjs=new cRe,this.fontLoader=new GOt({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=l.canvasFactory,this.filterFactory=l.filterFactory,this.cMapReaderFactory=l.cMapReaderFactory,this.standardFontDataFactory=l.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,r=null){const n=this.#e.get(t);if(n)return n;const a=this.messageHandler.sendWithPromise(t,r);return this.#e.set(t,a),a}get annotationStorage(){return mi(this,"annotationStorage",new PX)}getRenderingIntent(t,r=Fm.ENABLE,n=null,a=!1){let l=Nd.DISPLAY,c=LY;switch(t){case"any":l=Nd.ANY;break;case"display":break;case"print":l=Nd.PRINT;break;default:Nr(`getRenderingIntent - invalid intent: ${t}`)}switch(r){case Fm.DISABLE:l+=Nd.ANNOTATIONS_DISABLE;break;case Fm.ENABLE:break;case Fm.ENABLE_FORMS:l+=Nd.ANNOTATIONS_FORMS;break;case Fm.ENABLE_STORAGE:l+=Nd.ANNOTATIONS_STORAGE,c=(l&Nd.PRINT&&n instanceof Xze?n:this.annotationStorage).serializable;break;default:Nr(`getRenderingIntent - invalid annotationMode: ${r}`)}return a&&(l+=Nd.OPLIST),{renderingIntent:l,cacheKey:`${l}_${c.hash}`,annotationStorageSerializable:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#s?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const n of this.#t.values())t.push(n._destroy());this.#t.clear(),this.#o.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),PL.cleanup(),this._networkStream?.cancelAllRequests(new p5("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:r}=this;t.on("GetReader",(n,a)=>{Wa(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=l=>{this._lastProgress={loaded:l.loaded,total:l.total}},a.onPull=()=>{this._fullReader.read().then(function({value:l,done:c}){if(c){a.close();return}Wa(l instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(l),1,[l])}).catch(l=>{a.error(l)})},a.onCancel=l=>{this._fullReader.cancel(l),a.ready.catch(c=>{if(!this.destroyed)throw c})}}),t.on("ReaderHeadersReady",n=>{const a=Promise.withResolvers(),l=this._fullReader;return l.headersReady.then(()=>{(!l.isStreamingSupported||!l.isRangeSupported)&&(this._lastProgress&&r.onProgress?.(this._lastProgress),l.onProgress=c=>{r.onProgress?.({loaded:c.loaded,total:c.total})}),a.resolve({isStreamingSupported:l.isStreamingSupported,isRangeSupported:l.isRangeSupported,contentLength:l.contentLength})},a.reject),a.promise}),t.on("GetRangeReader",(n,a)=>{Wa(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const l=this._networkStream.getRangeReader(n.begin,n.end);if(!l){a.close();return}a.onPull=()=>{l.read().then(function({value:c,done:d}){if(d){a.close();return}Wa(c instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(c),1,[c])}).catch(c=>{a.error(c)})},a.onCancel=c=>{l.cancel(c),a.ready.catch(d=>{if(!this.destroyed)throw d})}}),t.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new WNt(n,this))}),t.on("DocException",function(n){let a;switch(n.name){case"PasswordException":a=new SY(n.message,n.code);break;case"InvalidPDFException":a=new Uze(n.message);break;case"MissingPDFException":a=new d5(n.message);break;case"UnexpectedResponseException":a=new MM(n.message,n.status);break;case"UnknownErrorException":a=new EY(n.message,n.details);break;default:Gi("DocException - expected a valid Error.")}r._capability.reject(a)}),t.on("PasswordRequest",n=>{if(this.#s=Promise.withResolvers(),r.onPassword){const a=l=>{l instanceof Error?this.#s.reject(l):this.#s.resolve({password:l})};try{r.onPassword(a,n.code)}catch(l){this.#s.reject(l)}}else this.#s.reject(new SY(n.message,n.code));return this.#s.promise}),t.on("DataLoaded",n=>{r.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,a,l])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(a){case"Font":const{disableFontFace:c,fontExtraProperties:d,pdfBug:p}=this._params;if("error"in l){const f=l.error;Nr(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const u=p&&globalThis.FontInspector?.enabled?(f,x)=>globalThis.FontInspector.fontAdded(f,x):null,h=new YOt(l,{disableFontFace:c,inspectFont:u});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!d&&h.data&&(h.data=null),this.commonObjs.resolve(n,h)});break;case"CopyLocalImage":const{imageRef:m}=l;Wa(m,"The imageRef must be defined.");for(const f of this.#t.values())for(const[,x]of f.objs)if(x?.ref===m)return x.dataLen?(this.commonObjs.resolve(n,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,l);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([n,a,l,c])=>{if(this.destroyed)return;const d=this.#t.get(a);if(!d.objs.has(n)){if(d._intentStates.size===0){c?.bitmap?.close();return}switch(l){case"Image":d.objs.resolve(n,c),c?.dataLen>vOt&&(d._maybeCleanupAfterRender=!0);break;case"Pattern":d.objs.resolve(n,c);break;default:throw new Error(`Got unknown object type ${l}`)}}}),t.on("DocProgress",n=>{this.destroyed||r.onProgress?.({loaded:n.loaded,total:n.total})}),t.on("FetchBuiltInCMap",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(n):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(n):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Nr("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=t-1,n=this.#o.get(r);if(n)return n;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(l=>{if(this.destroyed)throw new Error("Transport destroyed");l.refStr&&this.#i.set(l.refStr,t);const c=new GNt(r,l,this,this._params.pdfBug);return this.#t.set(r,c),c});return this.#o.set(r,a),a}getPageIndex(t){return Pme(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}getFieldObjects(){return this.#r("GetFieldObjects")}hasJSActions(){return this.#r("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#r("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#r("GetOptionalContentConfig").then(r=>new mNt(r,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",r=this.#e.get(t);if(r)return r;const n=this.messageHandler.sendWithPromise(t,null).then(a=>({info:a[0],metadata:a[1]?new uNt(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(t,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const r of this.#t.values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),PL.cleanup()}}cachedPageNumber(t){if(!Pme(t))return null;const r=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#i.get(r)??null}}const y$=Symbol("INITIAL_DATA");class cRe{#e=Object.create(null);#t(t){return this.#e[t]||={...Promise.withResolvers(),data:y$}}get(t,r=null){if(r){const a=this.#t(t);return a.promise.then(()=>r(a.data)),null}const n=this.#e[t];if(!n||n.data===y$)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const r=this.#e[t];return!!r&&r.data!==y$}resolve(t,r=null){const n=this.#t(t);n.data=r,n.resolve()}clear(){for(const t in this.#e){const{data:r}=this.#e[t];r?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const t in this.#e){const{data:r}=this.#e[t];r!==y$&&(yield[t,r])}}}class qNt{#e=null;constructor(t){this.#e=t,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(t=0){this.#e.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#e.operatorList;if(!t)return!1;const{annotationCanvasMap:r}=this.#e;return t.form||t.canvas&&r?.size>0}}class W6{#e=null;static#t=new WeakSet;constructor({callback:t,params:r,objs:n,commonObjs:a,annotationCanvasMap:l,operatorList:c,pageIndex:d,canvasFactory:p,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:m=!1,pageColors:f=null}){this.callback=t,this.params=r,this.objs=n,this.commonObjs=a,this.annotationCanvasMap=l,this.operatorListIdx=null,this.operatorList=c,this._pageIndex=d,this.canvasFactory=p,this.filterFactory=u,this._pdfBug=m,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new qNt(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=r.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:r}){if(this.cancelled)return;if(this._canvas){if(W6.#t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");W6.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:a,transform:l,background:c}=this.params;this.gfx=new d8(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:a,transparency:t,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,r=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),W6.#t.delete(this._canvas),this.callback(t||new SX(`Rendering cancelled, page ${this._pageIndex+1}`,r))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),W6.#t.delete(this._canvas),this.callback())))}}const ZNt="4.4.168",JNt="19fbc8998";function Dme(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function hy(e){return Math.max(0,Math.min(255,255*e))}class Tme{static CMYK_G([t,r,n,a]){return["G",1-Math.min(1,.3*t+.59*n+.11*r+a)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=hy(t),[t,t,t]}static G_HTML([t]){const r=Dme(t);return`#${r}${r}${r}`}static RGB_G([t,r,n]){return["G",.3*t+.59*r+.11*n]}static RGB_rgb(t){return t.map(hy)}static RGB_HTML(t){return`#${t.map(Dme).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,r,n,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,n+a),1-Math.min(1,r+a)]}static CMYK_rgb([t,r,n,a]){return[hy(1-Math.min(1,t+a)),hy(1-Math.min(1,n+a)),hy(1-Math.min(1,r+a))]}static CMYK_HTML(t){const r=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([t,r,n]){const a=1-t,l=1-r,c=1-n,d=Math.min(a,l,c);return["CMYK",a,l,c,d]}}class dRe{static setupStorage(t,r,n,a,l){const c=a.getValue(r,{value:null});switch(n.name){case"textarea":if(c.value!==null&&(t.textContent=c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(c.value===n.attributes.xfaOn?t.setAttribute("checked",!0):c.value===n.attributes.xfaOff&&t.removeAttribute("checked"),l==="print")break;t.addEventListener("change",d=>{a.setValue(r,{value:d.target.checked?d.target.getAttribute("xfaOn"):d.target.getAttribute("xfaOff")})})}else{if(c.value!==null&&t.setAttribute("value",c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})})}break;case"select":if(c.value!==null){t.setAttribute("value",c.value);for(const d of n.children)d.attributes.value===c.value?d.attributes.selected=!0:d.attributes.hasOwnProperty("selected")&&delete d.attributes.selected}t.addEventListener("input",d=>{const p=d.target.options,u=p.selectedIndex===-1?"":p[p.selectedIndex].value;a.setValue(r,{value:u})});break}}static setAttributes({html:t,element:r,storage:n=null,intent:a,linkService:l}){const{attributes:c}=r,d=t instanceof HTMLAnchorElement;c.type==="radio"&&(c.name=`${c.name}-${a}`);for(const[p,u]of Object.entries(c))if(u!=null)switch(p){case"class":u.length&&t.setAttribute(p,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!d||p!=="href"&&p!=="newWindow")&&t.setAttribute(p,u)}d&&l.addLinkAttributes(t,c.href,c.newWindow),n&&c.dataId&&this.setupStorage(t,c.dataId,r,n)}static render(t){const r=t.annotationStorage,n=t.linkService,a=t.xfaHtml,l=t.intent||"display",c=document.createElement(a.name);a.attributes&&this.setAttributes({html:c,element:a,intent:l,linkService:n});const d=l!=="richText",p=t.div;if(p.append(c),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;p.style.transform=m}d&&p.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const m=document.createTextNode(a.value);c.append(m),d&&rv.shouldBuildText(a.name)&&u.push(m)}return{textDivs:u}}const h=[[a,-1,c]];for(;h.length>0;){const[m,f,x]=h.at(-1);if(f+1===m.children.length){h.pop();continue}const y=m.children[++h.at(-1)[1]];if(y===null)continue;const{name:b}=y;if(b==="#text"){const v=document.createTextNode(y.value);u.push(v),x.append(v);continue}const w=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,b):document.createElement(b);if(x.append(w),y.attributes&&this.setAttributes({html:w,element:y,storage:r,intent:l,linkService:n}),y.children?.length>0)h.push([y,-1,w]);else if(y.value){const v=document.createTextNode(y.value);d&&rv.shouldBuildText(b)&&u.push(v),w.append(v)}}for(const m of p.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){const r=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=r,t.div.hidden=!1}}const fC=1e3,XNt=9,_4=new WeakSet;function d2(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class eHt{static create(t){switch(t.data.annotationType){case Ha.LINK:return new pRe(t);case Ha.TEXT:return new tHt(t);case Ha.WIDGET:switch(t.data.fieldType){case"Tx":return new oHt(t);case"Btn":return t.data.radioButton?new uRe(t):t.data.checkBox?new iHt(t):new nHt(t);case"Ch":return new aHt(t);case"Sig":return new rHt(t)}return new u5(t);case Ha.POPUP:return new BY(t);case Ha.FREETEXT:return new hRe(t);case Ha.LINE:return new lHt(t);case Ha.SQUARE:return new cHt(t);case Ha.CIRCLE:return new dHt(t);case Ha.POLYLINE:return new mRe(t);case Ha.CARET:return new uHt(t);case Ha.INK:return new gRe(t);case Ha.POLYGON:return new pHt(t);case Ha.HIGHLIGHT:return new hHt(t);case Ha.UNDERLINE:return new mHt(t);case Ha.SQUIGGLY:return new gHt(t);case Ha.STRIKEOUT:return new fHt(t);case Ha.STAMP:return new fRe(t);case Ha.FILEATTACHMENT:return new xHt(t);default:return new ua(t)}}}class ua{#e=null;#t=!1;#o=null;constructor(t,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=r,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,r&&(this.container=this._createContainer(n)),a&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:r,richText:n}){return!!(t?.str||r?.str||n?.str)}get hasPopupData(){return ua._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:r}=t;r&&this.#i(r),this.#o?.popup.updateEdited(t)}resetEdited(){this.#e&&(this.#i(this.#e.rect),this.#o?.popup.resetEdited(),this.#e=null)}#i(t){const{container:{style:r},data:{rect:n,rotation:a},parent:{viewport:{rawDims:{pageWidth:l,pageHeight:c,pageX:d,pageY:p}}}}=this;n?.splice(0,4,...t);const{width:u,height:h}=d2(t);r.left=`${100*(t[0]-d)/l}%`,r.top=`${100*(c-t[3]+p)/c}%`,a===0?(r.width=`${100*u/l}%`,r.height=`${100*h/c}%`):this.setRotation(a)}_createContainer(t){const{data:r,parent:{page:n,viewport:a}}=this,l=document.createElement("section");l.setAttribute("data-annotation-id",r.id),this instanceof u5||(l.tabIndex=fC);const{style:c}=l;if(c.zIndex=this.parent.zIndex++,r.popupRef&&l.setAttribute("aria-haspopup","dialog"),r.alternativeText&&(l.title=r.alternativeText),r.noRotate&&l.classList.add("norotate"),!r.rect||this instanceof BY){const{rotation:b}=r;return!r.hasOwnCanvas&&b!==0&&this.setRotation(b,l),l}const{width:d,height:p}=d2(r.rect);if(!t&&r.borderStyle.width>0){c.borderWidth=`${r.borderStyle.width}px`;const b=r.borderStyle.horizontalCornerRadius,w=r.borderStyle.verticalCornerRadius;if(b>0||w>0){const A=`calc(${b}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;c.borderRadius=A}else if(this instanceof uRe){const A=`calc(${d}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;c.borderRadius=A}switch(r.borderStyle.style){case py.SOLID:c.borderStyle="solid";break;case py.DASHED:c.borderStyle="dashed";break;case py.BEVELED:Nr("Unimplemented border style: beveled");break;case py.INSET:Nr("Unimplemented border style: inset");break;case py.UNDERLINE:c.borderBottomStyle="solid";break}const v=r.borderColor||null;v?(this.#t=!0,c.borderColor=jo.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):c.borderWidth=0}const u=jo.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:m,pageX:f,pageY:x}=a.rawDims;c.left=`${100*(u[0]-f)/h}%`,c.top=`${100*(u[1]-x)/m}%`;const{rotation:y}=r;return r.hasOwnCanvas||y===0?(c.width=`${100*d/h}%`,c.height=`${100*p/m}%`):this.setRotation(y,l),l}setRotation(t,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:a}=this.parent.viewport.rawDims,{width:l,height:c}=d2(this.data.rect);let d,p;t%180===0?(d=100*l/n,p=100*c/a):(d=100*c/n,p=100*l/a),r.style.width=`${d}%`,r.style.height=`${p}%`,r.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(r,n,a)=>{const l=a.detail[r],c=l[0],d=l.slice(1);a.target.style[n]=Tme[`${c}_HTML`](d),this.annotationStorage.setValue(this.data.id,{[n]:Tme[`${c}_rgb`](d)})};return mi(this,"_commonActions",{display:r=>{const{display:n}=r.detail,a=n%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{t("bgColor","backgroundColor",r)},fillColor:r=>{t("fillColor","backgroundColor",r)},fgColor:r=>{t("fgColor","color",r)},textColor:r=>{t("textColor","color",r)},borderColor:r=>{t("borderColor","borderColor",r)},strokeColor:r=>{t("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,r){const n=this._commonActions;for(const a of Object.keys(r.detail))(t[a]||n[a])?.(r)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[a,l]of Object.entries(r)){const c=n[a];if(c){const d={detail:{[a]:l},target:t};c(d),delete r[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[r,n,a,l]=this.data.rect.map(b=>Math.fround(b));if(t.length===8){const[b,w,v,A]=t.subarray(2,6);if(a===b&&l===w&&r===v&&n===A)return}const{style:c}=this.container;let d;if(this.#t){const{borderColor:b,borderWidth:w}=c;c.borderWidth=0,d=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${b}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const p=a-r,u=l-n,{svgFactory:h}=this,m=h.createElement("svg");m.classList.add("quadrilateralsContainer"),m.setAttribute("width",0),m.setAttribute("height",0);const f=h.createElement("defs");m.append(f);const x=h.createElement("clipPath"),y=`clippath_${this.data.id}`;x.setAttribute("id",y),x.setAttribute("clipPathUnits","objectBoundingBox"),f.append(x);for(let b=2,w=t.length;b<w;b+=8){const v=t[b],A=t[b+1],S=t[b+2],E=t[b+3],I=h.createElement("rect"),L=(S-r)/p,M=(l-A)/u,D=(v-S)/p,P=(A-E)/u;I.setAttribute("x",L),I.setAttribute("y",M),I.setAttribute("width",D),I.setAttribute("height",P),x.append(I),d?.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${M}" width="${D}" height="${P}"/>`)}this.#t&&(d.push("</g></svg>')"),c.backgroundImage=d.join("")),this.container.append(m),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:r}=this;t.setAttribute("aria-haspopup","dialog");const n=this.#o=new BY({data:{color:r.color,titleObj:r.titleObj,modificationDate:r.modificationDate,contentsObj:r.contentsObj,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation},parent:this.parent,elements:[this]});this.parent.div.append(n.render())}render(){Gi("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,r=null){const n=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:l,id:c,exportValues:d}of a){if(l===-1||c===r)continue;const p=typeof d=="string"?d:null,u=document.querySelector(`[data-element-id="${c}"]`);if(u&&!_4.has(u)){Nr(`_getElementsByName - element not allowed: ${c}`);continue}n.push({id:c,exportValue:p,domElement:u})}return n}for(const a of document.getElementsByName(t)){const{exportValue:l}=a,c=a.getAttribute("data-element-id");c!==r&&_4.has(a)&&n.push({id:c,exportValue:l,domElement:a})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const r of t)r.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:r})})}}class pRe extends ua{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!r?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let a=!1;return t.url?(r.addLinkAttributes(n,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(n,t.action),a=!0):t.attachment?(this.#t(n,t.attachment,t.attachmentDest),a=!0):t.setOCGState?(this.#o(n,t.setOCGState),a=!0):t.dest?(this._bindLink(n,t.dest),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),a=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(n,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(n),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&this.#e()}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),this.#e()}#t(t,r,n=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(r.content,r.filename,n),!1),this.#e()}#o(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),this.#e()}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(r.actions)){const l=n.get(a);l&&(t[l]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:a}}),!1))}t.onclick||(t.onclick=()=>!1),this.#e()}_bindResetFormAction(t,r){const n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Nr('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{n?.();const{fields:a,refs:l,include:c}=r,d=[];if(a.length!==0||l.length!==0){const h=new Set(l);for(const m of a){const f=this._fieldObjects[m]||[];for(const{id:x}of f)h.add(x)}for(const m of Object.values(this._fieldObjects))for(const f of m)h.has(f.id)===c&&d.push(f)}else for(const h of Object.values(this._fieldObjects))d.push(...h);const p=this.annotationStorage,u=[];for(const h of d){const{id:m}=h;switch(u.push(m),h.type){case"text":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}case"checkbox":case"radiobutton":{const x=h.defaultValue===h.exportValues;p.setValue(m,{value:x});break}case"combobox":case"listbox":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}default:continue}const f=document.querySelector(`[data-element-id="${m}"]`);if(f){if(!_4.has(f)){Nr(`_bindResetFormAction - element not allowed: ${m}`);continue}}else continue;f.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:u,name:"ResetForm"}}),!1}}}class tHt extends ua{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class u5 extends ua{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return vc.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,r,n,a,l){n.includes("mouse")?t.addEventListener(n,c=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c),shift:c.shiftKey,modifier:this._getKeyModifier(c)}})}):t.addEventListener(n,c=>{if(n==="blur"){if(!r.focused||!c.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}l&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c)}})})}_setEventListeners(t,r,n,a){for(const[l,c]of n)(c==="Action"||this.data.actions?.[c])&&((c==="Focus"||c==="Blur")&&(r||={focused:!1}),this._setEventListener(t,r,l,c,a),c==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,r,"blur","Blur",null):c==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,r,"focus","Focus",null))}_setBackgroundColor(t){const r=this.data.backgroundColor||null;t.style.backgroundColor=r===null?"transparent":jo.makeHexColor(r[0],r[1],r[2])}_setTextStyle(t){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||XNt,l=t.style;let c;const d=2,p=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d),h=Math.round(u/(o_*a))||1,m=u/h;c=Math.min(a,p(m/o_))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d);c=Math.min(a,p(u/o_))}l.fontSize=`calc(${c}px * var(--scale-factor))`,l.color=jo.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(l.textAlign=r[this.data.textAlignment])}_setRequired(t,r){r?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",r)}}class oHt extends u5{constructor(t){const r=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:r})}setPropertyOnSiblings(t,r,n,a){const l=this.annotationStorage;for(const c of this._getElementsByName(t.name,t.id))c.domElement&&(c.domElement[r]=n),l.setValue(c.id,{[a]:n})}render(){const t=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const a=t.getValue(r,{value:this.data.fieldValue});let l=a.value||"";const c=t.getValue(r,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let d=a.formattedValue||this.data.textContent?.join(`
|
|
246
|
+
`);return t.join("")}}function bb(e,t){try{const{protocol:r}=t?new URL(e,t):new URL(e);return r==="http:"||r==="https:"}catch{return!1}}function Ec(e){e.preventDefault()}function qze(e){console.log("Deprecated API usage: "+e)}let wme;class Zze{static toDateObject(t){if(!t||typeof t!="string")return null;wme||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const r=wme.exec(t);if(!r)return null;const n=parseInt(r[1],10);let a=parseInt(r[2],10);a=a>=1&&a<=12?a-1:0;let l=parseInt(r[3],10);l=l>=1&&l<=31?l:1;let c=parseInt(r[4],10);c=c>=0&&c<=23?c:0;let d=parseInt(r[5],10);d=d>=0&&d<=59?d:0;let p=parseInt(r[6],10);p=p>=0&&p<=59?p:0;const u=r[7]||"Z";let h=parseInt(r[8],10);h=h>=0&&h<=23?h:0;let m=parseInt(r[9],10)||0;return m=m>=0&&m<=59?m:0,u==="-"?(c+=h,d+=m):u==="+"&&(c-=h,d-=m),new Date(Date.UTC(n,a,l,c,d,p))}}function NOt(e,{scale:t=1,rotation:r=0}){const{width:n,height:a}=e.attributes.style,l=[0,0,parseInt(n),parseInt(a)];return new hC({viewBox:l,scale:t,rotation:r})}function IX(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):(Nr(`Not a valid color format: "${e}"`),[0,0,0])}function HOt(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const r of e.keys()){t.style.color=r;const n=window.getComputedStyle(t).color;e.set(r,IX(n))}t.remove()}function Pn(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform();return[t,r,n,a,l,c]}function v0(e){const{a:t,b:r,c:n,d:a,e:l,f:c}=e.getTransform().invertSelf();return[t,r,n,a,l,c]}function H4(e,t,r=!1,n=!0){if(t instanceof hC){const{pageWidth:a,pageHeight:l}=t.rawDims,{style:c}=e,d=vc.isCSSRoundSupported,p=`var(--scale-factor) * ${a}px`,u=`var(--scale-factor) * ${l}px`,h=d?`round(${p}, 1px)`:`calc(${p})`,m=d?`round(${u}, 1px)`:`calc(${u})`;!r||t.rotation%180===0?(c.width=h,c.height=m):(c.width=m,c.height=h)}n&&e.setAttribute("data-main-rotation",t.rotation)}class jX{#e=null;#t=null;#o;#i=null;constructor(t){this.#o=t}render(){const t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");const r=this.#o._uiManager._signal;t.addEventListener("contextmenu",Ec,{signal:r}),t.addEventListener("pointerdown",jX.#s,{signal:r});const n=this.#i=document.createElement("div");n.className="buttons",t.append(n);const a=this.#o.toolbarPosition;if(a){const{style:l}=t,c=this.#o._uiManager.direction==="ltr"?1-a[0]:a[0];l.insetInlineEnd=`${100*c}%`,l.top=`calc(${100*a[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}static#s(t){t.stopPropagation()}#r(t){this.#o._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#n(t){this.#o._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#l(t){const r=this.#o._uiManager._signal;t.addEventListener("focusin",this.#r.bind(this),{capture:!0,signal:r}),t.addEventListener("focusout",this.#n.bind(this),{capture:!0,signal:r}),t.addEventListener("contextmenu",Ec,{signal:r})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden")}#d(){const t=document.createElement("button");t.className="delete",t.tabIndex=0,t.setAttribute("data-l10n-id",`pdfjs-editor-remove-${this.#o.editorType}-button`),this.#l(t),t.addEventListener("click",r=>{this.#o._uiManager.delete()},{signal:this.#o._uiManager._signal}),this.#i.append(t)}get#p(){const t=document.createElement("div");return t.className="divider",t}addAltTextButton(t){this.#l(t),this.#i.prepend(t,this.#p)}addColorPicker(t){this.#t=t;const r=t.renderButton();this.#l(r),this.#i.prepend(r,this.#p)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class _Ot{#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",Ec,{signal:this.#o._signal});const r=this.#e=document.createElement("div");return r.className="buttons",t.append(r),this.#r(),t}#s(t,r){let n=0,a=0;for(const l of t){const c=l.y+l.height;if(c<n)continue;const d=l.x+(r?l.width:0);if(c>n){a=d,n=c;continue}r?d>a&&(a=d):d<a&&(a=d)}return[r?1-a:a,n]}show(t,r,n){const[a,l]=this.#s(r,n),{style:c}=this.#t||=this.#i();t.append(this.#t),c.insetInlineEnd=`${100*a}%`,c.top=`calc(${100*l}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#r(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const r=document.createElement("span");t.append(r),r.className="visuallyHidden",r.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const n=this.#o._signal;t.addEventListener("contextmenu",Ec,{signal:n}),t.addEventListener("click",()=>{this.#o.highlightSelection("floating_button")},{signal:n}),this.#e.append(t)}}function ML(e,t,r){for(const n of r)t.addEventListener(n,e[n].bind(e))}function VOt(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")}class QOt{#e=0;get id(){return`${COt}${this.#e++}`}}class MX{#e=TOt();#t=0;#o=null;static get _isSVGFittingCanvas(){const t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',n=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),a=new Image;a.src=t;const l=a.decode().then(()=>(n.drawImage(a,0,0,1,1,0,0,1,3),new Uint32Array(n.getImageData(0,0,1,1).data.buffer)[0]===0));return mi(this,"_isSVGFittingCanvas",l)}async#i(t,r){this.#o||=new Map;let n=this.#o.get(t);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let a;if(typeof r=="string"?(n.url=r,a=await RM(r,"blob")):a=n.file=r,a.type==="image/svg+xml"){const l=MX._isSVGFittingCanvas,c=new FileReader,d=new Image,p=new Promise((u,h)=>{d.onload=()=>{n.bitmap=d,n.isSvg=!0,u()},c.onload=async()=>{const m=n.svgUrl=c.result;d.src=await l?`${m}#svgView(preserveAspectRatio(none))`:m},d.onerror=c.onerror=h});c.readAsDataURL(a),await p}else n.bitmap=await createImageBitmap(a);n.refCounter=1}catch(a){console.error(a),n=null}return this.#o.set(t,n),n&&this.#o.set(n.id,n),n}async getFromFile(t){const{lastModified:r,name:n,size:a,type:l}=t;return this.#i(`${r}_${n}_${a}_${l}`,t)}async getFromUrl(t){return this.#i(t,t)}async getFromId(t){this.#o||=new Map;const r=this.#o.get(t);return r?r.bitmap?(r.refCounter+=1,r):r.file?this.getFromFile(r.file):this.getFromUrl(r.url):null}getSvgUrl(t){const r=this.#o.get(t);return r?.isSvg?r.svgUrl:null}deleteId(t){this.#o||=new Map;const r=this.#o.get(t);r&&(r.refCounter-=1,r.refCounter===0&&(r.bitmap=null))}isValidId(t){return t.startsWith(`image_${this.#e}_`)}}class UOt{#e=[];#t=!1;#o;#i=-1;constructor(t=128){this.#o=t}add({cmd:t,undo:r,post:n,mustExec:a,type:l=NaN,overwriteIfSameType:c=!1,keepUndo:d=!1}){if(a&&t(),this.#t)return;const p={cmd:t,undo:r,post:n,type:l};if(this.#i===-1){this.#e.length>0&&(this.#e.length=0),this.#i=0,this.#e.push(p);return}if(c&&this.#e[this.#i].type===l){d&&(p.undo=this.#e[this.#i].undo),this.#e[this.#i]=p;return}const u=this.#i+1;u===this.#o?this.#e.splice(0,1):(this.#i=u,u<this.#e.length&&this.#e.splice(u)),this.#e.push(p)}undo(){if(this.#i===-1)return;this.#t=!0;const{undo:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1,this.#i-=1}redo(){if(this.#i<this.#e.length-1){this.#i+=1,this.#t=!0;const{cmd:t,post:r}=this.#e[this.#i];t(),r?.(),this.#t=!1}}hasSomethingToUndo(){return this.#i!==-1}hasSomethingToRedo(){return this.#i<this.#e.length-1}destroy(){this.#e=null}}class mC{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:r}=vc.platform;for(const[n,a,l={}]of t)for(const c of n){const d=c.startsWith("mac+");r&&d?(this.callbacks.set(c.slice(4),{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1))):!r&&!d&&(this.callbacks.set(c,{callback:a,options:l}),this.allKeys.add(c.split("+").at(-1)))}}#e(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const r=this.buffer.join("+");return this.buffer.length=0,r}exec(t,r){if(!this.allKeys.has(r.key))return;const n=this.callbacks.get(this.#e(r));if(!n)return;const{callback:a,options:{bubbles:l=!1,args:c=[],checker:d=null}}=n;d&&!d(t,r)||(a.bind(t,...c,r)(),l||(r.stopPropagation(),r.preventDefault()))}}class BX{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return HOt(t),mi(this,"_colors",t)}convert(t){const r=IX(t);if(!window.matchMedia("(forced-colors: active)").matches)return r;for(const[n,a]of this._colors)if(a.every((l,c)=>l===r[c]))return BX._colorsMapping.get(n);return r}getHexCode(t){const r=this._colors.get(t);return r?jo.makeHexColor(...r):t}}class yg{#e=new AbortController;#t=null;#o=new Map;#i=new Map;#s=null;#r=null;#n=null;#l=new UOt;#d=0;#p=new Set;#h=null;#c=null;#a=new Set;#m=!1;#f=null;#u=null;#y=null;#g=!1;#b=null;#v=new QOt;#A=!1;#k=!1;#S=null;#j=null;#$=null;#w=ai.NONE;#x=new Set;#C=null;#E=null;#L=null;#B=this.blur.bind(this);#M=this.focus.bind(this);#T=this.copy.bind(this);#P=this.cut.bind(this);#z=this.paste.bind(this);#D=this.keydown.bind(this);#Q=this.keyup.bind(this);#U=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#N=this.onScaleChanging.bind(this);#R=this.onRotationChanging.bind(this);#K={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#V=[0,0];#F=null;#H=null;#q=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const t=yg.prototype,r=c=>c.#H.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&c.hasSomethingToControl(),n=(c,{target:d})=>{if(d instanceof HTMLInputElement){const{type:p}=d;return p!=="text"&&p!=="number"}return!0},a=this.TRANSLATE_SMALL,l=this.TRANSLATE_BIG;return mi(this,"_keyboardManager",new mC([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],t.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:n}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(d)&&!c.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(c,{target:d})=>!(d instanceof HTMLButtonElement)&&c.#H.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-l,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[l,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-l],checker:r}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,l],checker:r}]]))}constructor(t,r,n,a,l,c,d,p,u){this._signal=this.#e.signal,this.#H=t,this.#q=r,this.#s=n,this._eventBus=a,this._eventBus._on("editingaction",this.#U),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#N),this._eventBus._on("rotationchanging",this.#R),this.#ie(),this.#le(),this.#Z(),this.#r=l.annotationStorage,this.#f=l.filterFactory,this.#E=c,this.#y=d||null,this.#m=p,this.#$=u||null,this.viewParameters={realScale:Q8.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#e?.abort(),this.#e=null,this._signal=null,this._eventBus._off("editingaction",this.#U),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#N),this._eventBus._off("rotationchanging",this.#R);for(const t of this.#i.values())t.destroy();this.#i.clear(),this.#o.clear(),this.#a.clear(),this.#t=null,this.#x.clear(),this.#l.destroy(),this.#s?.destroy(),this.#b?.hide(),this.#b=null,this.#u&&(clearTimeout(this.#u),this.#u=null),this.#F&&(clearTimeout(this.#F),this.#F=null)}async mlGuess(t){return this.#$?.guess(t)||null}get hasMLManager(){return!!this.#$}get hcmFilter(){return mi(this,"hcmFilter",this.#E?this.#f.addHCMFilter(this.#E.foreground,this.#E.background):"none")}get direction(){return mi(this,"direction",getComputedStyle(this.#H).direction)}get highlightColors(){return mi(this,"highlightColors",this.#y?new Map(this.#y.split(",").map(t=>t.split("=").map(r=>r.trim()))):null)}get highlightColorNames(){return mi(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){this.#j=t}editAltText(t){this.#s?.editAltText(this,t)}onPageChanging({pageNumber:t}){this.#d=t-1}focusMainContainer(){this.#H.focus()}findParent(t,r){for(const n of this.#i.values()){const{x:a,y:l,width:c,height:d}=n.div.getBoundingClientRect();if(t>=a&&t<=a+c&&r>=l&&r<=l+d)return n}return null}disableUserSelect(t=!1){this.#q.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#a.add(t)}removeShouldRescale(t){this.#a.delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Q8.PDF_TO_CSS_UNITS;for(const r of this.#a)r.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#G({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}highlightSelection(t=""){const r=document.getSelection();if(!r||r.isCollapsed)return;const{anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c}=r,d=r.toString(),u=this.#G(r).closest(".textLayer"),h=this.getSelectionBoxes(u);if(h){r.empty(),this.#w===ai.NONE&&(this._eventBus.dispatch("showannotationeditorui",{source:this,mode:ai.HIGHLIGHT}),this.showAllEditors("highlight",!0,!0));for(const m of this.#i.values())if(m.hasTextLayer(u)){m.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:n,anchorOffset:a,focusNode:l,focusOffset:c,text:d});break}}}#oe(){const t=document.getSelection();if(!t||t.isCollapsed)return;const n=this.#G(t).closest(".textLayer"),a=this.getSelectionBoxes(n);a&&(this.#b||=new _Ot(this),this.#b.show(n,a,this.direction==="ltr"))}addToAnnotationStorage(t){!t.isEmpty()&&this.#r&&!this.#r.has(t.id)&&this.#r.setValue(t.id,t)}#re(){const t=document.getSelection();if(!t||t.isCollapsed){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}const{anchorNode:r}=t;if(r===this.#C)return;if(!this.#G(t).closest(".textLayer")){this.#C&&(this.#b?.hide(),this.#C=null,this.#I({hasSelectedText:!1}));return}if(this.#b?.hide(),this.#C=r,this.#I({hasSelectedText:!0}),!(this.#w!==ai.HIGHLIGHT&&this.#w!==ai.NONE)&&(this.#w===ai.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#g=this.isShiftKeyDown,!this.isShiftKeyDown)){const l=this._signal,c=d=>{d.type==="pointerup"&&d.button!==0||(window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),d.type==="pointerup"&&this.#Y("main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}}#Y(t=""){this.#w===ai.HIGHLIGHT?this.highlightSelection(t):this.#m&&this.#oe()}#ie(){document.addEventListener("selectionchange",this.#re.bind(this),{signal:this._signal})}#ne(){const t=this._signal;window.addEventListener("focus",this.#M,{signal:t}),window.addEventListener("blur",this.#B,{signal:t})}#ae(){window.removeEventListener("focus",this.#M),window.removeEventListener("blur",this.#B)}blur(){if(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")),!this.hasSelection)return;const{activeElement:t}=document;for(const r of this.#x)if(r.div.contains(t)){this.#S=[r,t],r._focusEventsAllowed=!1;break}}focus(){if(!this.#S)return;const[t,r]=this.#S;this.#S=null,r.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),r.focus()}#Z(){const t=this._signal;window.addEventListener("keydown",this.#D,{signal:t}),window.addEventListener("keyup",this.#Q,{signal:t})}#se(){window.removeEventListener("keydown",this.#D),window.removeEventListener("keyup",this.#Q)}#J(){const t=this._signal;document.addEventListener("copy",this.#T,{signal:t}),document.addEventListener("cut",this.#P,{signal:t}),document.addEventListener("paste",this.#z,{signal:t})}#X(){document.removeEventListener("copy",this.#T),document.removeEventListener("cut",this.#P),document.removeEventListener("paste",this.#z)}#le(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#Z(),this.#J()}removeEditListeners(){this.#se(),this.#X()}dragOver(t){for(const{type:r}of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(const r of t.dataTransfer.items)for(const n of this.#c)if(n.isHandlingMimeForPasting(r.type)){n.paste(r,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const r=[];for(const n of this.#x){const a=n.serialize(!0);a&&r.push(a)}r.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(t){this.copy(t),this.delete()}paste(t){t.preventDefault();const{clipboardData:r}=t;for(const l of r.items)for(const c of this.#c)if(c.isHandlingMimeForPasting(l.type)){c.paste(l,this.currentLayer);return}let n=r.getData("application/pdfjs");if(!n)return;try{n=JSON.parse(n)}catch(l){Nr(`paste: "${l.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();const a=this.currentLayer;try{const l=[];for(const p of n){const u=a.deserialize(p);if(!u)return;l.push(u)}const c=()=>{for(const p of l)this.#ee(p);this.#te(l)},d=()=>{for(const p of l)p.remove()};this.addCommands({cmd:c,undo:d,mustExec:!0})}catch(l){Nr(`paste: "${l.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),this.#w!==ai.NONE&&!this.isEditorHandlingKeyboard&&yg._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,this.#g&&(this.#g=!1,this.#Y("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}#I(t){Object.entries(t).some(([n,a])=>this.#K[n]!==a)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#K,t)}),this.#w===ai.HIGHLIGHT&&t.hasSelectedEditor===!1&&this.#O([[gr.HIGHLIGHT_FREE,!0]]))}#O(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#ne(),this.#J(),this.#I({isEditing:this.#w!==ai.NONE,isEmpty:this.#W(),hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:this.#l.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#X(),this.#I({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#c){this.#c=t;for(const r of this.#c)this.#O(r.defaultPropertiesToUpdate)}}getId(){return this.#v.id}get currentLayer(){return this.#i.get(this.#d)}getLayer(t){return this.#i.get(t)}get currentPageIndex(){return this.#d}addLayer(t){this.#i.set(t.pageIndex,t),this.#A?t.enable():t.disable()}removeLayer(t){this.#i.delete(t.pageIndex)}updateMode(t,r=null,n=!1){if(this.#w!==t){if(this.#w=t,t===ai.NONE){this.setEditingState(!1),this.#de();return}this.setEditingState(!0),this.#ce(),this.unselectAll();for(const a of this.#i.values())a.updateMode(t);if(!r&&n){this.addNewEditorFromKeyboard();return}if(r){for(const a of this.#o.values())if(a.annotationElementId===r){this.setSelected(a),a.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==this.#w&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,r){if(this.#c){switch(t){case gr.CREATE:this.currentLayer.addNewEditor();return;case gr.HIGHLIGHT_DEFAULT_COLOR:this.#j?.updateColor(r);break;case gr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#L||=new Map).set(t,r),this.showAllEditors("highlight",r);break}for(const n of this.#x)n.updateParams(t,r);for(const n of this.#c)n.updateDefaultParams(t,r)}}showAllEditors(t,r,n=!1){for(const l of this.#o.values())l.editorType===t&&l.show(r);(this.#L?.get(gr.HIGHLIGHT_SHOW_ALL)??!0)!==r&&this.#O([[gr.HIGHLIGHT_SHOW_ALL,r]])}enableWaiting(t=!1){if(this.#k!==t){this.#k=t;for(const r of this.#i.values())t?r.disableClick():r.enableClick(),r.div.classList.toggle("waiting",t)}}#ce(){if(!this.#A){this.#A=!0;for(const t of this.#i.values())t.enable();for(const t of this.#o.values())t.enable()}}#de(){if(this.unselectAll(),this.#A){this.#A=!1;for(const t of this.#i.values())t.disable();for(const t of this.#o.values())t.disable()}}getEditors(t){const r=[];for(const n of this.#o.values())n.pageIndex===t&&r.push(n);return r}getEditor(t){return this.#o.get(t)}addEditor(t){this.#o.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#u&&clearTimeout(this.#u),this.#u=setTimeout(()=>{this.focusMainContainer(),this.#u=null},0)),this.#o.delete(t.id),this.unselect(t),(!t.annotationElementId||!this.#p.has(t.annotationElementId))&&this.#r?.remove(t.id)}addDeletedAnnotationElement(t){this.#p.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return this.#p.has(t)}removeDeletedAnnotationElement(t){this.#p.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#ee(t){const r=this.#i.get(t.pageIndex);r?r.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#t!==t&&(this.#t=t,t&&this.#O(t.propertiesToUpdate))}get#pe(){let t=null;for(t of this.#x);return t}updateUI(t){this.#pe===t&&this.#O(t.propertiesToUpdate)}toggleSelected(t){if(this.#x.has(t)){this.#x.delete(t),t.unselect(),this.#I({hasSelectedEditor:this.hasSelection});return}this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}setSelected(t){for(const r of this.#x)r!==t&&r.unselect();this.#x.clear(),this.#x.add(t),t.select(),this.#O(t.propertiesToUpdate),this.#I({hasSelectedEditor:!0})}isSelected(t){return this.#x.has(t)}get firstSelectedEditor(){return this.#x.values().next().value}unselect(t){t.unselect(),this.#x.delete(t),this.#I({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#x.size!==0}get isEnterHandled(){return this.#x.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#l.undo(),this.#I({hasSomethingToUndo:this.#l.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#W()})}redo(){this.#l.redo(),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:this.#l.hasSomethingToRedo(),isEmpty:this.#W()})}addCommands(t){this.#l.add(t),this.#I({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#W()})}#W(){if(this.#o.size===0)return!0;if(this.#o.size===1)for(const t of this.#o.values())return t.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const t=[...this.#x],r=()=>{for(const a of t)a.remove()},n=()=>{for(const a of t)this.#ee(a)};this.addCommands({cmd:r,undo:n,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#te(t){for(const r of this.#x)r.unselect();this.#x.clear();for(const r of t)r.isEmpty()||(this.#x.add(r),r.select());this.#I({hasSelectedEditor:this.hasSelection})}selectAll(){for(const t of this.#x)t.commit();this.#te(this.#o.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#w!==ai.NONE))&&this.hasSelection){for(const t of this.#x)t.unselect();this.#x.clear(),this.#I({hasSelectedEditor:!1})}}translateSelectedEditors(t,r,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#V[0]+=t,this.#V[1]+=r;const[a,l]=this.#V,c=[...this.#x],d=1e3;this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#V[0]=this.#V[1]=0,this.addCommands({cmd:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(a,l)},undo:()=>{for(const p of c)this.#o.has(p.id)&&p.translateInPage(-a,-l)},mustExec:!1})},d);for(const p of c)p.translateInPage(t,r)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#h=new Map;for(const t of this.#x)this.#h.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#h)return!1;this.disableUserSelect(!1);const t=this.#h;this.#h=null;let r=!1;for(const[{x:a,y:l,pageIndex:c},d]of t)d.newX=a,d.newY=l,d.newPageIndex=c,r||=a!==d.savedX||l!==d.savedY||c!==d.savedPageIndex;if(!r)return!1;const n=(a,l,c,d)=>{if(this.#o.has(a.id)){const p=this.#i.get(d);p?a._setParentAndPosition(p,l,c):(a.pageIndex=d,a.x=l,a.y=c)}};return this.addCommands({cmd:()=>{for(const[a,{newX:l,newY:c,newPageIndex:d}]of t)n(a,l,c,d)},undo:()=>{for(const[a,{savedX:l,savedY:c,savedPageIndex:d}]of t)n(a,l,c,d)},mustExec:!0}),!0}dragSelectedEditors(t,r){if(this.#h)for(const n of this.#h.keys())n.drag(t,r)}rebuild(t){if(t.parent===null){const r=this.getLayer(t.pageIndex);r?(r.changeParent(t),r.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#x.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#t===t}getActive(){return this.#t}getMode(){return this.#w}get imageManager(){return mi(this,"imageManager",new MX)}getSelectionBoxes(t){if(!t)return null;const r=document.getSelection();for(let u=0,h=r.rangeCount;u<h;u++)if(!t.contains(r.getRangeAt(u).commonAncestorContainer))return null;const{x:n,y:a,width:l,height:c}=t.getBoundingClientRect();let d;switch(t.getAttribute("data-main-rotation")){case"90":d=(u,h,m,f)=>({x:(h-a)/c,y:1-(u+m-n)/l,width:f/c,height:m/l});break;case"180":d=(u,h,m,f)=>({x:1-(u+m-n)/l,y:1-(h+f-a)/c,width:m/l,height:f/c});break;case"270":d=(u,h,m,f)=>({x:1-(h+f-a)/c,y:(u-n)/l,width:f/c,height:m/l});break;default:d=(u,h,m,f)=>({x:(u-n)/l,y:(h-a)/c,width:m/l,height:f/c});break}const p=[];for(let u=0,h=r.rangeCount;u<h;u++){const m=r.getRangeAt(u);if(!m.collapsed)for(const{x:f,y:x,width:y,height:b}of m.getClientRects())y===0||b===0||p.push(d(f,x,y,b))}return p.length===0?null:p}addChangedExistingAnnotation({annotationElementId:t,id:r}){(this.#n||=new Map).set(t,r)}removeChangedExistingAnnotation({annotationElementId:t}){this.#n?.delete(t)}renderAnnotationElement(t){const r=this.#n?.get(t.data.id);if(!r)return;const n=this.#r.getRawValue(r);n&&(this.#w===ai.NONE&&!n.hasBeenModified||n.renderAnnotationElement(t))}}class p4{#e="";#t=!1;#o=null;#i=null;#s=null;#r=!1;#n=null;static _l10nPromise=null;constructor(t){this.#n=t}static initialize(t){p4._l10nPromise||=t}async render(){const t=this.#o=document.createElement("button");t.className="altText";const r=await p4._l10nPromise.get("pdfjs-editor-alt-text-button-label");t.textContent=r,t.setAttribute("aria-label",r),t.tabIndex="0";const n=this.#n._uiManager._signal;t.addEventListener("contextmenu",Ec,{signal:n}),t.addEventListener("pointerdown",l=>l.stopPropagation(),{signal:n});const a=l=>{l.preventDefault(),this.#n._uiManager.editAltText(this.#n)};return t.addEventListener("click",a,{capture:!0,signal:n}),t.addEventListener("keydown",l=>{l.target===t&&l.key==="Enter"&&(this.#r=!0,a(l))},{signal:n}),await this.#l(),t}finish(){this.#o&&(this.#o.focus({focusVisible:this.#r}),this.#r=!1)}isEmpty(){return!this.#e&&!this.#t}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:t,decorative:r}){this.#e===t&&this.#t===r||(this.#e=t,this.#t=r,this.#l())}toggle(t=!1){this.#o&&(!t&&this.#s&&(clearTimeout(this.#s),this.#s=null),this.#o.disabled=!t)}destroy(){this.#o?.remove(),this.#o=null,this.#i=null}async#l(){const t=this.#o;if(!t)return;if(!this.#e&&!this.#t){t.classList.remove("done"),this.#i?.remove();return}t.classList.add("done"),p4._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(a=>{t.setAttribute("aria-label",a)});let r=this.#i;if(!r){this.#i=r=document.createElement("span"),r.className="tooltip",r.setAttribute("role","tooltip");const a=r.id=`alt-text-tooltip-${this.#n.id}`;t.setAttribute("aria-describedby",a);const l=100,c=this.#n._uiManager._signal;c.addEventListener("abort",()=>{clearTimeout(this.#s),this.#s=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#i.classList.add("show"),this.#n._reportTelemetry({action:"alt_text_tooltip"})},l)},{signal:c}),t.addEventListener("mouseleave",()=>{this.#s&&(clearTimeout(this.#s),this.#s=null),this.#i?.classList.remove("show")},{signal:c})}r.innerText=this.#t?await p4._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):this.#e,r.parentNode||t.append(r),this.#n.getImageForAltText()?.setAttribute("aria-describedby",r.id)}}class ur{#e=null;#t=null;#o=null;#i=!1;#s=!1;#r=null;#n=null;#l=this.focusin.bind(this);#d=this.focusout.bind(this);#p=null;#h="";#c=!1;#a=null;#m=!1;#f=!1;#u=!1;#y=null;#g=0;#b=0;#v=null;_initialOptions=Object.create(null);_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#A=!1;#k=ur._zIndex++;static _borderLineWidth=-1;static _colorManager=new BX;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=ur.prototype._resizeWithKeyboard,r=yg.TRANSLATE_SMALL,n=yg.TRANSLATE_BIG;return mi(this,"_resizerKeyboardManager",new mC([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-r,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-n,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[r,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[n,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-r]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-n]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,r]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,n]}],[["Escape","mac+Escape"],ur.prototype._stopResizingWithKeyboard]]))}constructor(t){this.constructor===ur&&Gi("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:r,rawDims:{pageWidth:n,pageHeight:a,pageX:l,pageY:c}}=this.parent.viewport;this.rotation=r,this.pageRotation=(360+r-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,a],this.pageTranslation=[l,c];const[d,p]=this.parentDimensions;this.x=t.x/d,this.y=t.y/p,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return mi(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const r=new WOt({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});r.annotationElementId=t.annotationElementId,r.deleted=!0,r._uiManager.addToAnnotationStorage(r)}static initialize(t,r,n){if(ur._l10nPromise||=new Map(["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-resizer-label-topLeft","pdfjs-editor-resizer-label-topMiddle","pdfjs-editor-resizer-label-topRight","pdfjs-editor-resizer-label-middleRight","pdfjs-editor-resizer-label-bottomRight","pdfjs-editor-resizer-label-bottomMiddle","pdfjs-editor-resizer-label-bottomLeft","pdfjs-editor-resizer-label-middleLeft"].map(l=>[l,t.get(l.replaceAll(/([A-Z])/g,c=>`-${c.toLowerCase()}`))])),n?.strings)for(const l of n.strings)ur._l10nPromise.set(l,t.get(l));if(ur._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);ur._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,r){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,r){Gi("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#A}set _isDraggable(t){this.#A=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,r]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*r/(t*2),this.y+=this.width*t/(r*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*r/(t*2),this.y-=this.width*t/(r*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#k}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#D(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#c?this.#c=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,r,n,a){const[l,c]=this.parentDimensions;[n,a]=this.screenToPageTranslation(n,a),this.x=(t+n)/l,this.y=(r+a)/c,this.fixAndSetPosition()}#S([t,r],n,a){[n,a]=this.screenToPageTranslation(n,a),this.x+=n/t,this.y+=a/r,this.fixAndSetPosition()}translate(t,r){this.#S(this.parentDimensions,t,r)}translateInPage(t,r){this.#a||=[this.x,this.y],this.#S(this.pageDimensions,t,r),this.div.scrollIntoView({block:"nearest"})}drag(t,r){this.#a||=[this.x,this.y];const[n,a]=this.parentDimensions;if(this.x+=t/n,this.y+=r/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:l,y:c}=this;const[d,p]=this.getBaseTranslation();l+=d,c+=p,this.div.style.left=`${(100*l).toFixed(2)}%`,this.div.style.top=`${(100*c).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#a&&(this.#a[0]!==this.x||this.#a[1]!==this.y)}getBaseTranslation(){const[t,r]=this.parentDimensions,{_borderLineWidth:n}=ur,a=n/t,l=n/r;switch(this.rotation){case 90:return[-a,l];case 180:return[a,l];case 270:return[a,-l];default:return[-a,-l]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[r,n]=this.pageDimensions;let{x:a,y:l,width:c,height:d}=this;if(c*=r,d*=n,a*=r,l*=n,this._mustFixPosition)switch(t){case 0:a=Math.max(0,Math.min(r-c,a)),l=Math.max(0,Math.min(n-d,l));break;case 90:a=Math.max(0,Math.min(r-d,a)),l=Math.min(n,Math.max(c,l));break;case 180:a=Math.min(r,Math.max(c,a)),l=Math.min(n,Math.max(d,l));break;case 270:a=Math.min(r,Math.max(d,a)),l=Math.max(0,Math.min(n-c,l));break}this.x=a/=r,this.y=l/=n;const[p,u]=this.getBaseTranslation();a+=p,l+=u;const{style:h}=this.div;h.left=`${(100*a).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this.moveInDOM()}static#j(t,r,n){switch(n){case 90:return[r,-t];case 180:return[-t,-r];case 270:return[-r,t];default:return[t,r]}}screenToPageTranslation(t,r){return ur.#j(t,r,this.parentRotation)}pageTranslationToScreen(t,r){return ur.#j(t,r,360-this.parentRotation)}#$(t){switch(t){case 90:{const[r,n]=this.pageDimensions;return[0,-r/n,n/r,0]}case 180:return[-1,0,0,-1];case 270:{const[r,n]=this.pageDimensions;return[0,r/n,-n/r,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:t,pageDimensions:[r,n]}=this,a=r*t,l=n*t;return vc.isCSSRoundSupported?[Math.round(a),Math.round(l)]:[a,l]}setDims(t,r){const[n,a]=this.parentDimensions;this.div.style.width=`${(100*t/n).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*r/a).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:r,width:n}=t,a=n.endsWith("%"),l=!this.#s&&r.endsWith("%");if(a&&l)return;const[c,d]=this.parentDimensions;a||(t.width=`${(100*parseFloat(n)/c).toFixed(2)}%`),!this.#s&&!l&&(t.height=`${(100*parseFloat(r)/d).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#w(){if(this.#r)return;this.#r=document.createElement("div"),this.#r.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],r=this._uiManager._signal;for(const n of t){const a=document.createElement("div");this.#r.append(a),a.classList.add("resizer",n),a.setAttribute("data-resizer-name",n),a.addEventListener("pointerdown",this.#x.bind(this,n),{signal:r}),a.addEventListener("contextmenu",Ec,{signal:r}),a.tabIndex=-1}this.div.prepend(this.#r)}#x(t,r){r.preventDefault();const{isMac:n}=vc.platform;if(r.button!==0||r.ctrlKey&&n)return;this.#o?.toggle(!1);const a=this.#E.bind(this,t),l=this._isDraggable;this._isDraggable=!1;const c=this._uiManager._signal,d={passive:!0,capture:!0,signal:c};this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",a,d),window.addEventListener("contextmenu",Ec,{signal:c});const p=this.x,u=this.y,h=this.width,m=this.height,f=this.parent.div.style.cursor,x=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(r.target).cursor;const y=()=>{this.parent.togglePointerEvents(!0),this.#o?.toggle(!0),this._isDraggable=l,window.removeEventListener("pointerup",y),window.removeEventListener("blur",y),window.removeEventListener("pointermove",a,d),window.removeEventListener("contextmenu",Ec),this.parent.div.style.cursor=f,this.div.style.cursor=x,this.#C(p,u,h,m)};window.addEventListener("pointerup",y,{signal:c}),window.addEventListener("blur",y,{signal:c})}#C(t,r,n,a){const l=this.x,c=this.y,d=this.width,p=this.height;l===t&&c===r&&d===n&&p===a||this.addCommands({cmd:()=>{this.width=d,this.height=p,this.x=l,this.y=c;const[u,h]=this.parentDimensions;this.setDims(u*d,h*p),this.fixAndSetPosition()},undo:()=>{this.width=n,this.height=a,this.x=t,this.y=r;const[u,h]=this.parentDimensions;this.setDims(u*n,h*a),this.fixAndSetPosition()},mustExec:!0})}#E(t,r){const[n,a]=this.parentDimensions,l=this.x,c=this.y,d=this.width,p=this.height,u=ur.MIN_SIZE/n,h=ur.MIN_SIZE/a,m=V=>Math.round(V*1e4)/1e4,f=this.#$(this.rotation),x=(V,O)=>[f[0]*V+f[2]*O,f[1]*V+f[3]*O],y=this.#$(360-this.rotation),b=(V,O)=>[y[0]*V+y[2]*O,y[1]*V+y[3]*O];let w,v,A=!1,S=!1;switch(t){case"topLeft":A=!0,w=(V,O)=>[0,0],v=(V,O)=>[V,O];break;case"topMiddle":w=(V,O)=>[V/2,0],v=(V,O)=>[V/2,O];break;case"topRight":A=!0,w=(V,O)=>[V,0],v=(V,O)=>[0,O];break;case"middleRight":S=!0,w=(V,O)=>[V,O/2],v=(V,O)=>[0,O/2];break;case"bottomRight":A=!0,w=(V,O)=>[V,O],v=(V,O)=>[0,0];break;case"bottomMiddle":w=(V,O)=>[V/2,O],v=(V,O)=>[V/2,0];break;case"bottomLeft":A=!0,w=(V,O)=>[0,O],v=(V,O)=>[V,0];break;case"middleLeft":S=!0,w=(V,O)=>[0,O/2],v=(V,O)=>[V,O/2];break}const E=w(d,p),I=v(d,p);let L=x(...I);const M=m(l+L[0]),D=m(c+L[1]);let P=1,T=1,[z,N]=this.screenToPageTranslation(r.movementX,r.movementY);if([z,N]=b(z/n,N/a),A){const V=Math.hypot(d,p);P=T=Math.max(Math.min(Math.hypot(I[0]-E[0]-z,I[1]-E[1]-N)/V,1/d,1/p),u/d,h/p)}else S?P=Math.max(u,Math.min(1,Math.abs(I[0]-E[0]-z)))/d:T=Math.max(h,Math.min(1,Math.abs(I[1]-E[1]-N)))/p;const K=m(d*P),q=m(p*T);L=x(...v(K,q));const F=M-L[0],_=D-L[1];this.width=K,this.height=q,this.x=F,this.y=_,this.setDims(n*K,a*q),this.fixAndSetPosition()}altTextFinish(){this.#o?.finish()}async addEditToolbar(){return this.#p||this.#f?this.#p:(this.#p=new jX(this),this.div.append(this.#p.render()),this.#o&&this.#p.addAltTextButton(await this.#o.render()),this.#p)}removeEditToolbar(){this.#p&&(this.#p.remove(),this.#p=null,this.#o?.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){this.#o||(p4.initialize(ur._l10nPromise),this.#o=new p4(this),this.#e&&(this.#o.data=this.#e,this.#e=null),await this.addEditToolbar())}get altTextData(){return this.#o?.data}set altTextData(t){this.#o&&(this.#o.data=t)}hasAltText(){return!this.#o?.isEmpty()}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#i?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground();const t=this._uiManager._signal;this.div.addEventListener("focusin",this.#l,{signal:t}),this.div.addEventListener("focusout",this.#d,{signal:t});const[r,n]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*n/r).toFixed(2)}%`,this.div.style.maxHeight=`${(100*r/n).toFixed(2)}%`);const[a,l]=this.getInitialTranslation();return this.translate(a,l),ML(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:r}=vc.platform;if(t.button!==0||t.ctrlKey&&r){t.preventDefault();return}if(this.#c=!0,this._isDraggable){this.#B(t);return}this.#L(t)}#L(t){const{isMac:r}=vc.platform;t.ctrlKey&&!r||t.shiftKey||t.metaKey&&r?this.parent.toggleSelected(this):this.parent.setSelected(this)}#B(t){const r=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,a;const l=this._uiManager._signal;r&&(this.div.classList.add("moving"),n={passive:!0,capture:!0,signal:l},this.#g=t.clientX,this.#b=t.clientY,a=d=>{const{clientX:p,clientY:u}=d,[h,m]=this.screenToPageTranslation(p-this.#g,u-this.#b);this.#g=p,this.#b=u,this._uiManager.dragSelectedEditors(h,m)},window.addEventListener("pointermove",a,n));const c=()=>{window.removeEventListener("pointerup",c),window.removeEventListener("blur",c),r&&(this.div.classList.remove("moving"),window.removeEventListener("pointermove",a,n)),this.#c=!1,this._uiManager.endDragSession()||this.#L(t)};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}moveInDOM(){this.#y&&clearTimeout(this.#y),this.#y=setTimeout(()=>{this.#y=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,r,n){t.changeParent(this),this.x=r,this.y=n,this.fixAndSetPosition()}getRect(t,r,n=this.rotation){const a=this.parentScale,[l,c]=this.pageDimensions,[d,p]=this.pageTranslation,u=t/a,h=r/a,m=this.x*l,f=this.y*c,x=this.width*l,y=this.height*c;switch(n){case 0:return[m+u+d,c-f-h-y+p,m+u+x+d,c-f-h+p];case 90:return[m+h+d,c-f+u+p,m+h+y+d,c-f+u+x+p];case 180:return[m-u-x+d,c-f+h+p,m-u+d,c-f+h+y+p];case 270:return[m-h-y+d,c-f-u-x+p,m-h+d,c-f-u+p];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,r){const[n,a,l,c]=t,d=l-n,p=c-a;switch(this.rotation){case 0:return[n,r-c,d,p];case 90:return[n,r-a,p,d];case 180:return[l,r-a,d,p];case 270:return[l,r-c,p,d];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#f=!0}disableEditMode(){this.#f=!1}isInEditMode(){return this.#f}shouldGetKeyboardEvents(){return this.#u}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){const t=this._uiManager._signal;this.div?.addEventListener("focusin",this.#l,{signal:t}),this.div?.addEventListener("focusout",this.#d,{signal:t})}rotate(t){}serialize(t=!1,r=null){Gi("An editor must be serializable")}static deserialize(t,r,n){const a=new this.prototype.constructor({parent:r,id:r.getNextId(),uiManager:n});a.rotation=t.rotation,a.#e=t.accessibilityData;const[l,c]=a.pageDimensions,[d,p,u,h]=a.getRectInCurrentCoords(t.rect,c);return a.x=d/l,a.y=p/c,a.width=u/l,a.height=h/c,a}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#d),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#y&&(clearTimeout(this.#y),this.#y=null),this.#D(),this.removeEditToolbar(),this.#v){for(const t of this.#v.values())clearTimeout(t);this.#v=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#w(),this.#r.classList.remove("hidden"),ML(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#n={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const r=this.#r.children;if(!this.#t){this.#t=Array.from(r);const c=this.#M.bind(this),d=this.#T.bind(this),p=this._uiManager._signal;for(const u of this.#t){const h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",c,{signal:p}),u.addEventListener("blur",d,{signal:p}),u.addEventListener("focus",this.#P.bind(this,h),{signal:p}),ur._l10nPromise.get(`pdfjs-editor-resizer-label-${h}`).then(m=>u.setAttribute("aria-label",m))}}const n=this.#t[0];let a=0;for(const c of r){if(c===n)break;a++}const l=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(l!==a){if(l<a)for(let d=0;d<a-l;d++)this.#r.append(this.#r.firstChild);else if(l>a)for(let d=0;d<l-a;d++)this.#r.firstChild.before(this.#r.lastChild);let c=0;for(const d of r){const u=this.#t[c++].getAttribute("data-resizer-name");ur._l10nPromise.get(`pdfjs-editor-resizer-label-${u}`).then(h=>d.setAttribute("aria-label",h))}}this.#z(0),this.#u=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#M(t){ur._resizerKeyboardManager.exec(this,t)}#T(t){this.#u&&t.relatedTarget?.parentNode!==this.#r&&this.#D()}#P(t){this.#h=this.#u?t:""}#z(t){if(this.#t)for(const r of this.#t)r.tabIndex=t}_resizeWithKeyboard(t,r){this.#u&&this.#E(this.#h,{movementX:t,movementY:r})}#D(){if(this.#u=!1,this.#z(-1),this.#n){const{savedX:t,savedY:r,savedWidth:n,savedHeight:a}=this.#n;this.#C(t,r,n,a),this.#n=null}}_stopResizingWithKeyboard(){this.#D(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this.#p){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this.#p?.show()});return}this.#p?.show()}unselect(){this.#r?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this.#p?.hide()}updateParams(t,r){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#m}set isEditing(t){this.#m=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,r){this.#s=!0;const n=t/r,{style:a}=this.div;a.aspectRatio=n,a.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,r=!1){if(r){this.#v||=new Map;const{action:n}=t;let a=this.#v.get(n);a&&clearTimeout(a),a=setTimeout(()=>{this._reportTelemetry(t),this.#v.delete(n),this.#v.size===0&&(this.#v=null)},ur._telemetryTimeout),this.#v.set(n,a);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#i=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#i=!0}renderAnnotationElement(t){let r=t.container.querySelector(".annotationContent");if(!r)r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),t.container.prepend(r);else if(r.nodeName==="CANVAS"){const n=r;r=document.createElement("div"),r.classList.add("annotationContent",this.editorType),n.before(r)}return r}resetAnnotationElement(t){const{firstChild:r}=t.container;r.nodeName==="DIV"&&r.classList.contains("annotationContent")&&r.remove()}}class WOt extends ur{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const vme=3285377520,Dd=4294901760,Tu=65535;class Jze{constructor(t){this.h1=t?t&4294967295:vme,this.h2=t?t&4294967295:vme}update(t){let r,n;if(typeof t=="string"){r=new Uint8Array(t.length*2),n=0;for(let b=0,w=t.length;b<w;b++){const v=t.charCodeAt(b);v<=255?r[n++]=v:(r[n++]=v>>>8,r[n++]=v&255)}}else if(ArrayBuffer.isView(t))r=t.slice(),n=r.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const a=n>>2,l=n-a*4,c=new Uint32Array(r.buffer,0,a);let d=0,p=0,u=this.h1,h=this.h2;const m=3432918353,f=461845907,x=m&Tu,y=f&Tu;for(let b=0;b<a;b++)b&1?(d=c[b],d=d*m&Dd|d*x&Tu,d=d<<15|d>>>17,d=d*f&Dd|d*y&Tu,u^=d,u=u<<13|u>>>19,u=u*5+3864292196):(p=c[b],p=p*m&Dd|p*x&Tu,p=p<<15|p>>>17,p=p*f&Dd|p*y&Tu,h^=p,h=h<<13|h>>>19,h=h*5+3864292196);switch(d=0,l){case 3:d^=r[a*4+2]<<16;case 2:d^=r[a*4+1]<<8;case 1:d^=r[a*4],d=d*m&Dd|d*x&Tu,d=d<<15|d>>>17,d=d*f&Dd|d*y&Tu,a&1?u^=d:h^=d}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,r=this.h2;return t^=r>>>1,t=t*3981806797&Dd|t*36045&Tu,r=r*4283543511&Dd|((r<<16|t>>>16)*2950163797&Dd)>>>16,t^=r>>>1,t=t*444984403&Dd|t*60499&Tu,r=r*3301882366&Dd|((r<<16|t>>>16)*3120437893&Dd)>>>16,t^=r>>>1,(t>>>0).toString(16).padStart(8,"0")+(r>>>0).toString(16).padStart(8,"0")}}const LY=Object.freeze({map:null,hash:"",transfer:void 0});class PX{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,r){const n=this.#t.get(t);return n===void 0?r:Object.assign(r,n)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const r of this.#t.values())if(r instanceof ur)return;this.onAnnotationEditor(null)}}setValue(t,r){const n=this.#t.get(t);let a=!1;if(n!==void 0)for(const[l,c]of Object.entries(r))n[l]!==c&&(a=!0,n[l]=c);else a=!0,this.#t.set(t,r);a&&this.#o(),r instanceof ur&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(r.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?AX(this.#t):null}setAll(t){for(const[r,n]of Object.entries(t))this.setValue(r,n)}get size(){return this.#t.size}#o(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Xze(this)}get serializable(){if(this.#t.size===0)return LY;const t=new Map,r=new Jze,n=[],a=Object.create(null);let l=!1;for(const[c,d]of this.#t){const p=d instanceof ur?d.serialize(!1,a):d;p&&(t.set(c,p),r.update(`${c}:${JSON.stringify(p)}`),l||=!!p.bitmap)}if(l)for(const c of t.values())c.bitmap&&n.push(c.bitmap);return t.size>0?{map:t,hash:r.hexdigest(),transfer:n}:LY}get editorStats(){let t=null;const r=new Map;for(const n of this.#t.values()){if(!(n instanceof ur))continue;const a=n.telemetryFinalData;if(!a)continue;const{type:l}=a;r.has(l)||r.set(l,Object.getPrototypeOf(n).constructor),t||=Object.create(null);const c=t[l]||=new Map;for(const[d,p]of Object.entries(a)){if(d==="type")continue;let u=c.get(d);u||(u=new Map,c.set(d,u));const h=u.get(p)??0;u.set(p,h+1)}}for(const[n,a]of r)t[n]=a.computeTelemetryFinalData(t[n]);return t}}class Xze extends PX{#e;constructor(t){super();const{map:r,hash:n,transfer:a}=t.serializable,l=structuredClone(r,a?{transfer:a}:null);this.#e={map:l,hash:n,transfer:a}}get print(){Gi("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}class GOt{#e=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:r=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const r=this.styleElement.sheet;r.insertRule(t,r.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,_inspectFont:r}){if(!(!t||this.#e.has(t.loadedName))){if(Wa(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:n,src:a,style:l}=t,c=new FontFace(n,a,l);this.addNativeFontFace(c);try{await c.load(),this.#e.add(n),r?.(t)}catch{Nr(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(c)}return}Gi("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){const n=t.createNativeFontFace();if(n){this.addNativeFontFace(n);try{await n.loaded}catch(a){throw Nr(`Failed to load font '${n.family}': '${a}'.`),t.disableFontFace=!0,a}}return}const r=t.createFontFaceRule();if(r){if(this.insertRule(r),this.isSyncFontLoadingSupported)return;await new Promise(n=>{const a=this._queueLoadingCallback(n);this._prepareFontLoadEvent(t,a)})}}get isFontLoadingAPISupported(){const t=!!this._document?.fonts;return mi(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(ul||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),mi(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function r(){for(Wa(!a.done,"completeRequest() cannot be called twice."),a.done=!0;n.length>0&&n[0].done;){const l=n.shift();setTimeout(l.callback,0)}}const{loadingRequests:n}=this,a={done:!1,complete:r,callback:t};return n.push(a),a}get _loadTestFont(){const t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return mi(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,r){function n(E,I){return E.charCodeAt(I)<<24|E.charCodeAt(I+1)<<16|E.charCodeAt(I+2)<<8|E.charCodeAt(I+3)&255}function a(E,I,L,M){const D=E.substring(0,I),P=E.substring(I+L);return D+M+P}let l,c;const d=this._document.createElement("canvas");d.width=1,d.height=1;const p=d.getContext("2d");let u=0;function h(E,I){if(++u>30){Nr("Load test font never loaded."),I();return}if(p.font="30px "+E,p.fillText(".",0,20),p.getImageData(0,0,1,1).data[3]>0){I();return}setTimeout(h.bind(null,E,I))}const m=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=a(f,976,m.length,m);const y=16,b=1482184792;let w=n(f,y);for(l=0,c=m.length-3;l<c;l+=4)w=w-b+n(m,l)|0;l<m.length&&(w=w-b+n(m+"XXX",l)|0),f=a(f,y,4,jOt(w));const v=`url(data:font/opentype;base64,${btoa(f)});`,A=`@font-face {font-family:"${m}";src:${v}}`;this.insertRule(A);const S=this._document.createElement("div");S.style.visibility="hidden",S.style.width=S.style.height="10px",S.style.position="absolute",S.style.top=S.style.left="0px";for(const E of[t.loadedName,m]){const I=this._document.createElement("span");I.textContent="Hi",I.style.fontFamily=E,S.append(I)}this._document.body.append(S),h(m,()=>{S.remove(),r.complete()})}}class YOt{constructor(t,{disableFontFace:r=!1,inspectFont:n=null}){this.compiledGlyphs=Object.create(null);for(const a in t)this[a]=t[a];this.disableFontFace=r===!0,this._inspectFont=n}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=Wze(this.data),r=`url(data:${this.mimetype};base64,${btoa(t)});`;let n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${r}}`;else{let a=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(a+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${a}src:${r}}`}return this._inspectFont?.(this,r),n}getPathGenerator(t,r){if(this.compiledGlyphs[r]!==void 0)return this.compiledGlyphs[r];let n;try{n=t.get(this.loadedName+"_path_"+r)}catch(l){Nr(`getPathGenerator - ignoring character: "${l}".`)}if(!Array.isArray(n)||n.length===0)return this.compiledGlyphs[r]=function(l,c){};const a=[];for(let l=0,c=n.length;l<c;)switch(n[l++]){case w0.BEZIER_CURVE_TO:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.bezierCurveTo(d,p,u,h,m,f)),l+=6}break;case w0.MOVE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.moveTo(d,p)),l+=2}break;case w0.LINE_TO:{const[d,p]=n.slice(l,l+2);a.push(u=>u.lineTo(d,p)),l+=2}break;case w0.QUADRATIC_CURVE_TO:{const[d,p,u,h]=n.slice(l,l+4);a.push(m=>m.quadraticCurveTo(d,p,u,h)),l+=4}break;case w0.RESTORE:a.push(d=>d.restore());break;case w0.SAVE:a.push(d=>d.save());break;case w0.SCALE:Wa(a.length===2,"Scale command is only valid at the third position.");break;case w0.TRANSFORM:{const[d,p,u,h,m,f]=n.slice(l,l+6);a.push(x=>x.transform(d,p,u,h,m,f)),l+=6}break;case w0.TRANSLATE:{const[d,p]=n.slice(l,l+2);a.push(u=>u.translate(d,p)),l+=2}break}return this.compiledGlyphs[r]=function(c,d){a[0](c),a[1](c),c.scale(d,-d);for(let p=2,u=a.length;p<u;p++)a[p](c)}}}if(ul){var IY=Promise.withResolvers(),jY=null;(async()=>{const t=await r4(()=>import("./empty-DF_ydwSm.js").then(d=>d.e),__vite__mapDeps([0,1,2])),r=await r4(()=>import("./index-Dk9WTrVo.js").then(d=>d.i),__vite__mapDeps([3,1,4,5,6,7,8,9])),n=await r4(()=>import("./index-B_7K1bnG.js").then(d=>d.i),__vite__mapDeps([10,1,11,4,5,6,7,8,9])),a=await r4(()=>import("./url-CmdokR_e.js").then(d=>d.u),__vite__mapDeps([12,1,9,7,5,6,8]));let l,c;return new Map(Object.entries({fs:t,http:r,https:n,url:a,canvas:l,path2d:c}))})().then(t=>{jY=t,IY.resolve()},t=>{Nr(`loadPackages: ${t}`),jY=new Map,IY.resolve()})}class Rh{static get promise(){return IY.promise}static get(t){return jY?.get(t)}}const eRe=function(e){return Rh.get("fs").promises.readFile(e).then(r=>new Uint8Array(r))};class KOt extends PM{}class qOt extends DM{_createCanvas(t,r){return Rh.get("canvas").createCanvas(t,r)}}class ZOt extends TM{_fetchData(t,r){return eRe(t).then(n=>({cMapData:n,compressionType:r}))}}class JOt extends zM{_fetchData(t){return eRe(t)}}const Tl={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function MY(e,t){if(!t)return;const r=t[2]-t[0],n=t[3]-t[1],a=new Path2D;a.rect(t[0],t[1],r,n),e.clip(a)}class gC{constructor(){this.constructor===gC&&Gi("Cannot initialize BaseShadingPattern.")}getPattern(){Gi("Abstract method `getPattern` called.")}}class XOt extends gC{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let r;this._type==="axial"?r=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(r=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const n of this._colorStops)r.addColorStop(n[0],n[1]);return r}getPattern(t,r,n,a){let l;if(a===Tl.STROKE||a===Tl.FILL){const c=r.current.getClippedPathBoundingBox(a,Pn(t))||[0,0,0,0],d=Math.ceil(c[2]-c[0])||1,p=Math.ceil(c[3]-c[1])||1,u=r.cachedCanvases.getCanvas("pattern",d,p,!0),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-c[0],-c[1]),n=jo.transform(n,[1,0,0,1,c[0],c[1]]),h.transform(...r.baseTransform),this.matrix&&h.transform(...this.matrix),MY(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),l=t.createPattern(u.canvas,"no-repeat");const m=new DOMMatrix(n);l.setTransform(m)}else MY(t,this._bbox),l=this._createGradient(t);return l}}function n_(e,t,r,n,a,l,c,d){const p=t.coords,u=t.colors,h=e.data,m=e.width*4;let f;p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f),p[n+1]>p[a+1]&&(f=n,n=a,a=f,f=c,c=d,d=f),p[r+1]>p[n+1]&&(f=r,r=n,n=f,f=l,l=c,c=f);const x=(p[r]+t.offsetX)*t.scaleX,y=(p[r+1]+t.offsetY)*t.scaleY,b=(p[n]+t.offsetX)*t.scaleX,w=(p[n+1]+t.offsetY)*t.scaleY,v=(p[a]+t.offsetX)*t.scaleX,A=(p[a+1]+t.offsetY)*t.scaleY;if(y>=A)return;const S=u[l],E=u[l+1],I=u[l+2],L=u[c],M=u[c+1],D=u[c+2],P=u[d],T=u[d+1],z=u[d+2],N=Math.round(y),K=Math.round(A);let q,F,_,V,O,R,H,ee;for(let Y=N;Y<=K;Y++){if(Y<w){const ye=Y<y?0:(y-Y)/(y-w);q=x-(x-b)*ye,F=S-(S-L)*ye,_=E-(E-M)*ye,V=I-(I-D)*ye}else{let ye;Y>A?ye=1:w===A?ye=0:ye=(w-Y)/(w-A),q=b-(b-v)*ye,F=L-(L-P)*ye,_=M-(M-T)*ye,V=D-(D-z)*ye}let G;Y<y?G=0:Y>A?G=1:G=(y-Y)/(y-A),O=x-(x-v)*G,R=S-(S-P)*G,H=E-(E-T)*G,ee=I-(I-z)*G;const X=Math.round(Math.min(q,O)),J=Math.round(Math.max(q,O));let ie=m*Y+X*4;for(let ye=X;ye<=J;ye++)G=(q-ye)/(q-O),G<0?G=0:G>1&&(G=1),h[ie++]=F-(F-R)*G|0,h[ie++]=_-(_-H)*G|0,h[ie++]=V-(V-ee)*G|0,h[ie++]=255}}function eNt(e,t,r){const n=t.coords,a=t.colors;let l,c;switch(t.type){case"lattice":const d=t.verticesPerRow,p=Math.floor(n.length/d)-1,u=d-1;for(l=0;l<p;l++){let h=l*d;for(let m=0;m<u;m++,h++)n_(e,r,n[h],n[h+1],n[h+d],a[h],a[h+1],a[h+d]),n_(e,r,n[h+d+1],n[h+1],n[h+d],a[h+d+1],a[h+1],a[h+d])}break;case"triangles":for(l=0,c=n.length;l<c;l+=3)n_(e,r,n[l],n[l+1],n[l+2],a[l],a[l+1],a[l+2]);break;default:throw new Error("illegal figure")}}class tNt extends gC{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,r,n){const d=Math.floor(this._bounds[0]),p=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-d,h=Math.ceil(this._bounds[3])-p,m=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3),f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3),x=u/m,y=h/f,b={coords:this._coords,colors:this._colors,offsetX:-d,offsetY:-p,scaleX:1/x,scaleY:1/y},w=m+4,v=f+4,A=n.getCanvas("mesh",w,v,!1),S=A.context,E=S.createImageData(m,f);if(r){const L=E.data;for(let M=0,D=L.length;M<D;M+=4)L[M]=r[0],L[M+1]=r[1],L[M+2]=r[2],L[M+3]=255}for(const L of this._figures)eNt(E,L,b);return S.putImageData(E,2,2),{canvas:A.canvas,offsetX:d-2*x,offsetY:p-2*y,scaleX:x,scaleY:y}}getPattern(t,r,n,a){MY(t,this._bbox);let l;if(a===Tl.SHADING)l=jo.singularValueDecompose2dScale(Pn(t));else if(l=jo.singularValueDecompose2dScale(r.baseTransform),this.matrix){const d=jo.singularValueDecompose2dScale(this.matrix);l=[l[0]*d[0],l[1]*d[1]]}const c=this._createMeshCanvas(l,a===Tl.SHADING?null:this._background,r.cachedCanvases);return a!==Tl.SHADING&&(t.setTransform(...r.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(c.offsetX,c.offsetY),t.scale(c.scaleX,c.scaleY),t.createPattern(c.canvas,"no-repeat")}}class oNt extends gC{getPattern(){return"hotpink"}}function rNt(e){switch(e[0]){case"RadialAxial":return new XOt(e);case"Mesh":return new tNt(e);case"Dummy":return new oNt}throw new Error(`Unknown IR type: ${e[0]}`)}const Cme={COLORED:1,UNCOLORED:2};class DX{static MAX_PATTERN_SIZE=3e3;constructor(t,r,n,a,l){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=r,this.ctx=n,this.canvasGraphicsFactory=a,this.baseTransform=l}createPatternCanvas(t){const r=this.operatorList,n=this.bbox,a=this.xstep,l=this.ystep,c=this.paintType,d=this.tilingType,p=this.color,u=this.canvasGraphicsFactory;jM("TilingType: "+d);const h=n[0],m=n[1],f=n[2],x=n[3],y=jo.singularValueDecompose2dScale(this.matrix),b=jo.singularValueDecompose2dScale(this.baseTransform),w=[y[0]*b[0],y[1]*b[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,w[0]),A=this.getSizeAndScale(l,this.ctx.canvas.height,w[1]),S=t.cachedCanvases.getCanvas("pattern",v.size,A.size,!0),E=S.context,I=u.createCanvasGraphics(E);I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,c,p);let L=h,M=m,D=f,P=x;return h<0&&(L=0,D+=Math.abs(h)),m<0&&(M=0,P+=Math.abs(m)),E.translate(-(v.scale*L),-(A.scale*M)),I.transform(v.scale,0,0,A.scale,0,0),E.save(),this.clipBbox(I,L,M,D,P),I.baseTransform=Pn(I.ctx),I.executeOperatorList(r),I.endDrawing(),{canvas:S.canvas,scaleX:v.scale,scaleY:A.scale,offsetX:L,offsetY:M}}getSizeAndScale(t,r,n){t=Math.abs(t);const a=Math.max(DX.MAX_PATTERN_SIZE,r);let l=Math.ceil(t*n);return l>=a?l=a:n=l/t,{scale:n,size:l}}clipBbox(t,r,n,a,l){const c=a-r,d=l-n;t.ctx.rect(r,n,c,d),t.current.updateRectMinMax(Pn(t.ctx),[r,n,a,l]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,r,n){const a=t.ctx,l=t.current;switch(r){case Cme.COLORED:const c=this.ctx;a.fillStyle=c.fillStyle,a.strokeStyle=c.strokeStyle,l.fillColor=c.fillStyle,l.strokeColor=c.strokeStyle;break;case Cme.UNCOLORED:const d=jo.makeHexColor(n[0],n[1],n[2]);a.fillStyle=d,a.strokeStyle=d,l.fillColor=d,l.strokeColor=d;break;default:throw new IOt(`Unsupported paint type: ${r}`)}}getPattern(t,r,n,a){let l=n;a!==Tl.SHADING&&(l=jo.transform(l,r.baseTransform),this.matrix&&(l=jo.transform(l,this.matrix)));const c=this.createPatternCanvas(r);let d=new DOMMatrix(l);d=d.translate(c.offsetX,c.offsetY),d=d.scale(1/c.scaleX,1/c.scaleY);const p=t.createPattern(c.canvas,"repeat");return p.setTransform(d),p}}function iNt({src:e,srcPos:t=0,dest:r,width:n,height:a,nonBlackColor:l=4294967295,inverseDecode:c=!1}){const d=vc.isLittleEndian?4278190080:255,[p,u]=c?[l,d]:[d,l],h=n>>3,m=n&7,f=e.length;r=new Uint32Array(r.buffer);let x=0;for(let y=0;y<a;y++){for(const w=t+h;t<w;t++){const v=t<f?e[t]:255;r[x++]=v&128?u:p,r[x++]=v&64?u:p,r[x++]=v&32?u:p,r[x++]=v&16?u:p,r[x++]=v&8?u:p,r[x++]=v&4?u:p,r[x++]=v&2?u:p,r[x++]=v&1?u:p}if(m===0)continue;const b=t<f?e[t++]:255;for(let w=0;w<m;w++)r[x++]=b&1<<7-w?u:p}return{srcPos:t,destPos:x}}const Ame=16,$me=100,nNt=15,kme=10,Sme=1e3,dc=16;function aNt(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(n,a){t.translate(n,a),this.__originalTranslate(n,a)},e.scale=function(n,a){t.scale(n,a),this.__originalScale(n,a)},e.transform=function(n,a,l,c,d,p){t.transform(n,a,l,c,d,p),this.__originalTransform(n,a,l,c,d,p)},e.setTransform=function(n,a,l,c,d,p){t.setTransform(n,a,l,c,d,p),this.__originalSetTransform(n,a,l,c,d,p)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(n){t.rotate(n),this.__originalRotate(n)},e.clip=function(n){t.clip(n),this.__originalClip(n)},e.moveTo=function(r,n){t.moveTo(r,n),this.__originalMoveTo(r,n)},e.lineTo=function(r,n){t.lineTo(r,n),this.__originalLineTo(r,n)},e.bezierCurveTo=function(r,n,a,l,c,d){t.bezierCurveTo(r,n,a,l,c,d),this.__originalBezierCurveTo(r,n,a,l,c,d)},e.rect=function(r,n,a,l){t.rect(r,n,a,l),this.__originalRect(r,n,a,l)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class sNt{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,r,n){let a;return this.cache[t]!==void 0?(a=this.cache[t],this.canvasFactory.reset(a,r,n)):(a=this.canvasFactory.create(r,n),this.cache[t]=a),a}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const r=this.cache[t];this.canvasFactory.destroy(r),delete this.cache[t]}}}function g$(e,t,r,n,a,l,c,d,p,u){const[h,m,f,x,y,b]=Pn(e);if(m===0&&f===0){const A=c*h+y,S=Math.round(A),E=d*x+b,I=Math.round(E),L=(c+p)*h+y,M=Math.abs(Math.round(L)-S)||1,D=(d+u)*x+b,P=Math.abs(Math.round(D)-I)||1;return e.setTransform(Math.sign(h),0,0,Math.sign(x),S,I),e.drawImage(t,r,n,a,l,0,0,M,P),e.setTransform(h,m,f,x,y,b),[M,P]}if(h===0&&x===0){const A=d*f+y,S=Math.round(A),E=c*m+b,I=Math.round(E),L=(d+u)*f+y,M=Math.abs(Math.round(L)-S)||1,D=(c+p)*m+b,P=Math.abs(Math.round(D)-I)||1;return e.setTransform(0,Math.sign(m),Math.sign(f),0,S,I),e.drawImage(t,r,n,a,l,0,0,P,M),e.setTransform(h,m,f,x,y,b),[P,M]}e.drawImage(t,r,n,a,l,c,d,p,u);const w=Math.hypot(h,m),v=Math.hypot(f,x);return[w*p,v*u]}function lNt(e){const{width:t,height:r}=e;if(t>Sme||r>Sme)return null;const n=1e3,a=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=t+1;let c=new Uint8Array(l*(r+1)),d,p,u;const h=t+7&-8;let m=new Uint8Array(h*r),f=0;for(const v of e.data){let A=128;for(;A>0;)m[f++]=v&A?0:255,A>>=1}let x=0;for(f=0,m[f]!==0&&(c[0]=1,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[p]=m[f]?2:1,++x),f++;for(m[f]!==0&&(c[p]=2,++x),d=1;d<r;d++){f=d*h,u=d*l,m[f-h]!==m[f]&&(c[u]=m[f]?1:8,++x);let v=(m[f]?4:0)+(m[f-h]?8:0);for(p=1;p<t;p++)v=(v>>2)+(m[f+1]?4:0)+(m[f-h+1]?8:0),a[v]&&(c[u+p]=a[v],++x),f++;if(m[f-h]!==m[f]&&(c[u+p]=m[f]?2:4,++x),x>n)return null}for(f=h*(r-1),u=d*l,m[f]!==0&&(c[u]=8,++x),p=1;p<t;p++)m[f]!==m[f+1]&&(c[u+p]=m[f]?4:8,++x),f++;if(m[f]!==0&&(c[u+p]=4,++x),x>n)return null;const y=new Int32Array([0,l,-1,0,-l,0,0,0,1]),b=new Path2D;for(d=0;x&&d<=r;d++){let v=d*l;const A=v+t;for(;v<A&&!c[v];)v++;if(v===A)continue;b.moveTo(v%l,d);const S=v;let E=c[v];do{const I=y[E];do v+=I;while(!c[v]);const L=c[v];L!==5&&L!==10?(E=L,c[v]=0):(E=L&51*E>>4,c[v]&=E>>2|E<<2),b.lineTo(v%l,v/l|0),c[v]||--x}while(S!==v);--d}return m=null,c=null,function(v){v.save(),v.scale(1/t,-1/r),v.translate(0,-r),v.fill(b),v.beginPath(),v.restore()}}class Eme{constructor(t,r){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Qze,this.textMatrixScale=1,this.fontMatrix=$Y,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=il.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,r])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,r){this.x=t,this.y=r}updatePathMinMax(t,r,n){[r,n]=jo.applyTransform([r,n],t),this.minX=Math.min(this.minX,r),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,r),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(t,r){const n=jo.applyTransform(r,t),a=jo.applyTransform(r.slice(2),t),l=jo.applyTransform([r[0],r[3]],t),c=jo.applyTransform([r[2],r[1]],t);this.minX=Math.min(this.minX,n[0],a[0],l[0],c[0]),this.minY=Math.min(this.minY,n[1],a[1],l[1],c[1]),this.maxX=Math.max(this.maxX,n[0],a[0],l[0],c[0]),this.maxY=Math.max(this.maxY,n[1],a[1],l[1],c[1])}updateScalingPathMinMax(t,r){jo.scaleMinMax(t,r),this.minX=Math.min(this.minX,r[0]),this.minY=Math.min(this.minY,r[1]),this.maxX=Math.max(this.maxX,r[2]),this.maxY=Math.max(this.maxY,r[3])}updateCurvePathMinMax(t,r,n,a,l,c,d,p,u,h){const m=jo.bezierBoundingBox(r,n,a,l,c,d,p,u,h);h||this.updateRectMinMax(t,m)}getPathBoundingBox(t=Tl.FILL,r=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(t===Tl.STROKE){r||Gi("Stroke bounding box must include transform.");const a=jo.singularValueDecompose2dScale(r),l=a[0]*this.lineWidth/2,c=a[1]*this.lineWidth/2;n[0]-=l,n[1]-=c,n[2]+=l,n[3]+=c}return n}updateClipFromPath(){const t=jo.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=Tl.FILL,r=null){return jo.intersect(this.clipBox,this.getPathBoundingBox(t,r))}}function Lme(e,t){if(typeof ImageData<"u"&&t instanceof ImageData){e.putImageData(t,0,0);return}const r=t.height,n=t.width,a=r%dc,l=(r-a)/dc,c=a===0?l:l+1,d=e.createImageData(n,dc);let p=0,u;const h=t.data,m=d.data;let f,x,y,b;if(t.kind===nE.GRAYSCALE_1BPP){const w=h.byteLength,v=new Uint32Array(m.buffer,0,m.byteLength>>2),A=v.length,S=n+7>>3,E=4294967295,I=vc.isLittleEndian?4278190080:255;for(f=0;f<c;f++){for(y=f<l?dc:a,u=0,x=0;x<y;x++){const L=w-p;let M=0;const D=L>S?n:L*8-7,P=D&-8;let T=0,z=0;for(;M<P;M+=8)z=h[p++],v[u++]=z&128?E:I,v[u++]=z&64?E:I,v[u++]=z&32?E:I,v[u++]=z&16?E:I,v[u++]=z&8?E:I,v[u++]=z&4?E:I,v[u++]=z&2?E:I,v[u++]=z&1?E:I;for(;M<D;M++)T===0&&(z=h[p++],T=128),v[u++]=z&T?E:I,T>>=1}for(;u<A;)v[u++]=0;e.putImageData(d,0,f*dc)}}else if(t.kind===nE.RGBA_32BPP){for(x=0,b=n*dc*4,f=0;f<l;f++)m.set(h.subarray(p,p+b)),p+=b,e.putImageData(d,0,x),x+=dc;f<c&&(b=n*a*4,m.set(h.subarray(p,p+b)),e.putImageData(d,0,x))}else if(t.kind===nE.RGB_24BPP)for(y=dc,b=n*y,f=0;f<c;f++){for(f>=l&&(y=a,b=n*y),u=0,x=b;x--;)m[u++]=h[p++],m[u++]=h[p++],m[u++]=h[p++],m[u++]=255;e.putImageData(d,0,f*dc)}else throw new Error(`bad image kind: ${t.kind}`)}function Ime(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const r=t.height,n=t.width,a=r%dc,l=(r-a)/dc,c=a===0?l:l+1,d=e.createImageData(n,dc);let p=0;const u=t.data,h=d.data;for(let m=0;m<c;m++){const f=m<l?dc:a;({srcPos:p}=iNt({src:u,srcPos:p,dest:h,width:n,height:f,nonBlackColor:0})),e.putImageData(d,0,m*dc)}}function uy(e,t){const r=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const n of r)e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function f$(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),!ul){const{filter:t}=e;t!=="none"&&t!==""&&(e.filter="none")}}function jme(e,t){if(t)return!0;const r=jo.singularValueDecompose2dScale(e);r[0]=Math.fround(r[0]),r[1]=Math.fround(r[1]);const n=Math.fround((globalThis.devicePixelRatio||1)*Q8.PDF_TO_CSS_UNITS);return r[0]<=n&&r[1]<=n}const cNt=["butt","round","square"],dNt=["miter","round","bevel"],pNt={},Mme={};class d8{constructor(t,r,n,a,l,{optionalContentConfig:c,markedContentStack:d=null},p,u){this.ctx=t,this.current=new Eme(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=r,this.objs=n,this.canvasFactory=a,this.filterFactory=l,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=d||[],this.optionalContentConfig=c,this.cachedCanvases=new sNt(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=p,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,r=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):r}beginDrawing({transform:t,viewport:r,transparency:n=!1,background:a=null}){const l=this.ctx.canvas.width,c=this.ctx.canvas.height,d=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,l,c),this.ctx.fillStyle=d,n){const p=this.cachedCanvases.getCanvas("transparent",l,c);this.compositeCtx=this.ctx,this.transparentCanvas=p.canvas,this.ctx=p.context,this.ctx.save(),this.ctx.transform(...Pn(this.compositeCtx))}this.ctx.save(),f$(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...r.transform),this.viewportScale=r.scale,this.baseTransform=Pn(this.ctx)}executeOperatorList(t,r,n,a){const l=t.argsArray,c=t.fnArray;let d=r||0;const p=l.length;if(p===d)return d;const u=p-d>kme&&typeof n=="function",h=u?Date.now()+nNt:0;let m=0;const f=this.commonObjs,x=this.objs;let y;for(;;){if(a!==void 0&&d===a.nextBreakPoint)return a.breakIt(d,n),d;if(y=c[d],y!==J1.dependency)this[y].apply(this,l[d]);else for(const b of l[d]){const w=b.startsWith("g_")?f:x;if(!w.has(b))return w.get(b,n),d}if(d++,d===p)return d;if(u&&++m>kme){if(Date.now()>h)return n(),d;m=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const r of t.values())typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&(r.width=r.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const r=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=r}}}_scaleImage(t,r){const n=t.width,a=t.height;let l=Math.max(Math.hypot(r[0],r[1]),1),c=Math.max(Math.hypot(r[2],r[3]),1),d=n,p=a,u="prescale1",h,m;for(;l>2&&d>1||c>2&&p>1;){let f=d,x=p;l>2&&d>1&&(f=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),l/=d/f),c>2&&p>1&&(x=p>=16384?Math.floor(p/2)-1||1:Math.ceil(p)/2,c/=p/x),h=this.cachedCanvases.getCanvas(u,f,x),m=h.context,m.clearRect(0,0,f,x),m.drawImage(t,0,0,d,p,0,0,f,x),t=h.canvas,d=f,p=x,u=u==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:p}}_createMaskCanvas(t){const r=this.ctx,{width:n,height:a}=t,l=this.current.fillColor,c=this.current.patternFill,d=Pn(r);let p,u,h,m;if((t.bitmap||t.data)&&t.count>1){const D=t.bitmap||t.data.buffer;u=JSON.stringify(c?d:[d.slice(0,4),l]),p=this._cachedBitmapsMap.get(D),p||(p=new Map,this._cachedBitmapsMap.set(D,p));const P=p.get(u);if(P&&!c){const T=Math.round(Math.min(d[0],d[2])+d[4]),z=Math.round(Math.min(d[1],d[3])+d[5]);return{canvas:P,offsetX:T,offsetY:z}}h=P}h||(m=this.cachedCanvases.getCanvas("maskCanvas",n,a),Ime(m.context,t));let f=jo.transform(d,[1/n,0,0,-1/a,0,0]);f=jo.transform(f,[1,0,0,1,0,-a]);const[x,y,b,w]=jo.getAxialAlignedBoundingBox([0,0,n,a],f),v=Math.round(b-x)||1,A=Math.round(w-y)||1,S=this.cachedCanvases.getCanvas("fillCanvas",v,A),E=S.context,I=x,L=y;E.translate(-I,-L),E.transform(...f),h||(h=this._scaleImage(m.canvas,v0(E)),h=h.img,p&&c&&p.set(u,h)),E.imageSmoothingEnabled=jme(Pn(E),t.interpolate),g$(E,h,0,0,h.width,h.height,0,0,n,a),E.globalCompositeOperation="source-in";const M=jo.transform(v0(E),[1,0,0,1,-I,-L]);return E.fillStyle=c?l.getPattern(r,this,M,Tl.FILL):l,E.fillRect(0,0,n,a),p&&!c&&(this.cachedCanvases.delete("fillCanvas"),p.set(u,S.canvas)),{canvas:S.canvas,offsetX:Math.round(I),offsetY:Math.round(L)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=cNt[t]}setLineJoin(t){this.ctx.lineJoin=dNt[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,r){const n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(t),n.lineDashOffset=r)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[r,n]of t)switch(r){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=n;break;case"ca":this.current.fillAlpha=n,this.ctx.globalAlpha=n;break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,r=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,a=this.cachedCanvases.getCanvas(n,t,r);this.suspendedCtx=this.ctx,this.ctx=a.context;const l=this.ctx;l.setTransform(...Pn(this.suspendedCtx)),uy(this.suspendedCtx,l),aNt(l,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),uy(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const r=this.current.activeSMask,n=this.suspendedCtx;this.composeSMask(n,r,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,r,n,a){const l=a[0],c=a[1],d=a[2]-l,p=a[3]-c;d===0||p===0||(this.genericComposeSMask(r.context,n,d,p,r.subtype,r.backdrop,r.transferMap,l,c,r.offsetX,r.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(n.canvas,0,0),t.restore())}genericComposeSMask(t,r,n,a,l,c,d,p,u,h,m){let f=t.canvas,x=p-h,y=u-m;if(c){if(x<0||y<0||x+n>f.width||y+a>f.height){const w=this.cachedCanvases.getCanvas("maskExtension",n,a),v=w.context;v.drawImage(f,-x,-y),c.some(A=>A!==0)&&(v.globalCompositeOperation="destination-atop",v.fillStyle=jo.makeHexColor(...c),v.fillRect(0,0,n,a),v.globalCompositeOperation="source-over"),f=w.canvas,x=y=0}else if(c.some(w=>w!==0)){t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const w=new Path2D;w.rect(x,y,n,a),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=jo.makeHexColor(...c),t.fillRect(x,y,n,a),t.restore()}}r.save(),r.globalAlpha=1,r.setTransform(1,0,0,1,0,0),l==="Alpha"&&d?r.filter=this.filterFactory.addAlphaFilter(d):l==="Luminosity"&&(r.filter=this.filterFactory.addLuminosityFilter(d));const b=new Path2D;b.rect(p,u,n,a),r.clip(b),r.globalCompositeOperation="destination-in",r.drawImage(f,x,y,n,a,p,u,n,a),r.restore()}save(){this.inSMaskMode?(uy(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(),uy(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,r,n,a,l,c){this.ctx.transform(t,r,n,a,l,c),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,r,n){const a=this.ctx,l=this.current;let c=l.x,d=l.y,p,u;const h=Pn(a),m=h[0]===0&&h[3]===0||h[1]===0&&h[2]===0,f=m?n.slice(0):null;for(let x=0,y=0,b=t.length;x<b;x++)switch(t[x]|0){case J1.rectangle:c=r[y++],d=r[y++];const w=r[y++],v=r[y++],A=c+w,S=d+v;a.moveTo(c,d),w===0||v===0?a.lineTo(A,S):(a.lineTo(A,d),a.lineTo(A,S),a.lineTo(c,S)),m||l.updateRectMinMax(h,[c,d,A,S]),a.closePath();break;case J1.moveTo:c=r[y++],d=r[y++],a.moveTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.lineTo:c=r[y++],d=r[y++],a.lineTo(c,d),m||l.updatePathMinMax(h,c,d);break;case J1.curveTo:p=c,u=d,c=r[y+4],d=r[y+5],a.bezierCurveTo(r[y],r[y+1],r[y+2],r[y+3],c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],r[y+2],r[y+3],c,d,f),y+=6;break;case J1.curveTo2:p=c,u=d,a.bezierCurveTo(c,d,r[y],r[y+1],r[y+2],r[y+3]),l.updateCurvePathMinMax(h,p,u,c,d,r[y],r[y+1],r[y+2],r[y+3],f),c=r[y+2],d=r[y+3],y+=4;break;case J1.curveTo3:p=c,u=d,c=r[y+2],d=r[y+3],a.bezierCurveTo(r[y],r[y+1],c,d,c,d),l.updateCurvePathMinMax(h,p,u,r[y],r[y+1],c,d,c,d,f),y+=4;break;case J1.closePath:a.closePath();break}m&&l.updateScalingPathMinMax(h,f),l.setCurrentPoint(c,d)}closePath(){this.ctx.closePath()}stroke(t=!0){const r=this.ctx,n=this.current.strokeColor;r.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n=="object"&&n?.getPattern?(r.save(),r.strokeStyle=n.getPattern(r,this,v0(r),Tl.STROKE),this.rescaleAndStroke(!1),r.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),r.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;let l=!1;a&&(r.save(),r.fillStyle=n.getPattern(r,this,v0(r),Tl.FILL),l=!0);const c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(r.fill("evenodd"),this.pendingEOFill=!1):r.fill()),l&&r.restore(),t&&this.consumePath(c)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=pNt}eoClip(){this.pendingClip=Mme}beginText(){this.current.textMatrix=Qze,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,r=this.ctx;if(t===void 0){r.beginPath();return}r.save(),r.beginPath();for(const n of t)r.setTransform(...n.transform),r.translate(n.x,n.y),n.addToPath(r,n.fontSize);r.restore(),r.clip(),r.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,r){const n=this.commonObjs.get(t),a=this.current;if(!n)throw new Error(`Can't find font for ${t}`);if(a.fontMatrix=n.fontMatrix||$Y,(a.fontMatrix[0]===0||a.fontMatrix[3]===0)&&Nr("Invalid font matrix for font "+t),r<0?(r=-r,a.fontDirection=-1):a.fontDirection=1,this.current.font=n,this.current.fontSize=r,n.isType3Font)return;const l=n.loadedName||"sans-serif",c=n.systemFontInfo?.css||`"${l}", ${n.fallbackName}`;let d="normal";n.black?d="900":n.bold&&(d="bold");const p=n.italic?"italic":"normal";let u=r;r<Ame?u=Ame:r>$me&&(u=$me),this.current.fontSizeScale=r/u,this.ctx.font=`${p} ${d} ${u}px ${c}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,r){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=r}setLeadingMoveText(t,r){this.setLeading(-r),this.moveText(t,r)}setTextMatrix(t,r,n,a,l,c){this.current.textMatrix=[t,r,n,a,l,c],this.current.textMatrixScale=Math.hypot(t,r),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,r,n,a){const l=this.ctx,c=this.current,d=c.font,p=c.textRenderingMode,u=c.fontSize/c.fontSizeScale,h=p&il.FILL_STROKE_MASK,m=!!(p&il.ADD_TO_PATH_FLAG),f=c.patternFill&&!d.missingFile;let x;(d.disableFontFace||m||f)&&(x=d.getPathGenerator(this.commonObjs,t)),d.disableFontFace||f?(l.save(),l.translate(r,n),l.beginPath(),x(l,u),a&&l.setTransform(...a),(h===il.FILL||h===il.FILL_STROKE)&&l.fill(),(h===il.STROKE||h===il.FILL_STROKE)&&l.stroke(),l.restore()):((h===il.FILL||h===il.FILL_STROKE)&&l.fillText(t,r,n),(h===il.STROKE||h===il.FILL_STROKE)&&l.strokeText(t,r,n)),m&&(this.pendingTextPaths||=[]).push({transform:Pn(l),x:r,y:n,fontSize:u,addToPath:x})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const r=t.getImageData(0,0,10,10).data;let n=!1;for(let a=3;a<r.length;a+=4)if(r[a]>0&&r[a]<255){n=!0;break}return mi(this,"isFontSubpixelAAEnabled",n)}showText(t){const r=this.current,n=r.font;if(n.isType3Font)return this.showType3Text(t);const a=r.fontSize;if(a===0)return;const l=this.ctx,c=r.fontSizeScale,d=r.charSpacing,p=r.wordSpacing,u=r.fontDirection,h=r.textHScale*u,m=t.length,f=n.vertical,x=f?1:-1,y=n.defaultVMetrics,b=a*r.fontMatrix[0],w=r.textRenderingMode===il.FILL&&!n.disableFontFace&&!r.patternFill;l.save(),l.transform(...r.textMatrix),l.translate(r.x,r.y+r.textRise),u>0?l.scale(h,-1):l.scale(h,1);let v;if(r.patternFill){l.save();const L=r.fillColor.getPattern(l,this,v0(l),Tl.FILL);v=Pn(l),l.restore(),l.fillStyle=L}let A=r.lineWidth;const S=r.textMatrixScale;if(S===0||A===0){const L=r.textRenderingMode&il.FILL_STROKE_MASK;(L===il.STROKE||L===il.FILL_STROKE)&&(A=this.getSinglePixelWidth())}else A/=S;if(c!==1&&(l.scale(c,c),A/=c),l.lineWidth=A,n.isInvalidPDFjsFont){const L=[];let M=0;for(const D of t)L.push(D.unicode),M+=D.width;l.fillText(L.join(""),0,0),r.x+=M*b*h,l.restore(),this.compose();return}let E=0,I;for(I=0;I<m;++I){const L=t[I];if(typeof L=="number"){E+=x*L*a/1e3;continue}let M=!1;const D=(L.isSpace?p:0)+d,P=L.fontChar,T=L.accent;let z,N,K=L.width;if(f){const F=L.vmetric||y,_=-(L.vmetric?F[1]:K*.5)*b,V=F[2]*b;K=F?-F[0]:K,z=_/c,N=(E+V)/c}else z=E/c,N=0;if(n.remeasure&&K>0){const F=l.measureText(P).width*1e3/a*c;if(K<F&&this.isFontSubpixelAAEnabled){const _=K/F;M=!0,l.save(),l.scale(_,1),z/=_}else K!==F&&(z+=(K-F)/2e3*a/c)}if(this.contentVisible&&(L.isInFont||n.missingFile)){if(w&&!T)l.fillText(P,z,N);else if(this.paintChar(P,z,N,v),T){const F=z+a*T.offset.x/c,_=N-a*T.offset.y/c;this.paintChar(T.fontChar,F,_,v)}}const q=f?K*b-D*u:K*b+D*u;E+=q,M&&l.restore()}f?r.y-=E:r.x+=E*h,l.restore(),this.compose()}showType3Text(t){const r=this.ctx,n=this.current,a=n.font,l=n.fontSize,c=n.fontDirection,d=a.vertical?1:-1,p=n.charSpacing,u=n.wordSpacing,h=n.textHScale*c,m=n.fontMatrix||$Y,f=t.length,x=n.textRenderingMode===il.INVISIBLE;let y,b,w,v;if(!(x||l===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,r.save(),r.transform(...n.textMatrix),r.translate(n.x,n.y),r.scale(h,c),y=0;y<f;++y){if(b=t[y],typeof b=="number"){v=d*b*l/1e3,this.ctx.translate(v,0),n.x+=v*h;continue}const A=(b.isSpace?u:0)+p,S=a.charProcOperatorList[b.operatorListId];if(!S){Nr(`Type3 character "${b.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=b,this.save(),r.scale(l,l),r.transform(...m),this.executeOperatorList(S),this.restore()),w=jo.applyTransform([b.width,0],m)[0]*l+A,r.translate(w,0),n.x+=w*h}r.restore(),this.processingType3=null}}setCharWidth(t,r){}setCharWidthAndBounds(t,r,n,a,l,c){this.ctx.rect(n,a,l-n,c-a),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let r;if(t[0]==="TilingPattern"){const n=t[1],a=this.baseTransform||Pn(this.ctx),l={createCanvasGraphics:c=>new d8(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};r=new DX(t,n,this.ctx,l,a)}else r=this._getPattern(t[1],t[2]);return r}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,r,n){const a=jo.makeHexColor(t,r,n);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,r=null){let n;return this.cachedPatterns.has(t)?n=this.cachedPatterns.get(t):(n=rNt(this.getObject(t)),this.cachedPatterns.set(t,n)),r&&(n.matrix=r),n}shadingFill(t){if(!this.contentVisible)return;const r=this.ctx;this.save();const n=this._getPattern(t);r.fillStyle=n.getPattern(r,this,v0(r),Tl.SHADING);const a=v0(r);if(a){const{width:l,height:c}=r.canvas,[d,p,u,h]=jo.getAxialAlignedBoundingBox([0,0,l,c],a);this.ctx.fillRect(d,p,u-d,h-p)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){Gi("Should not call beginInlineImage")}beginImageData(){Gi("Should not call beginImageData")}paintFormXObjectBegin(t,r){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=Pn(this.ctx),r)){const n=r[2]-r[0],a=r[3]-r[1];this.ctx.rect(r[0],r[1],n,a),this.current.updateRectMinMax(Pn(this.ctx),r),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const r=this.ctx;t.isolated||jM("TODO: Support non-isolated groups."),t.knockout&&Nr("Knockout groups not supported.");const n=Pn(r);if(t.matrix&&r.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let a=jo.getAxialAlignedBoundingBox(t.bbox,Pn(r));const l=[0,0,r.canvas.width,r.canvas.height];a=jo.intersect(a,l)||[0,0,0,0];const c=Math.floor(a[0]),d=Math.floor(a[1]),p=Math.max(Math.ceil(a[2])-c,1),u=Math.max(Math.ceil(a[3])-d,1);this.current.startNewPathAndClipBox([0,0,p,u]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(h,p,u),f=m.context;f.translate(-c,-d),f.transform(...n),t.smask?this.smaskStack.push({canvas:m.canvas,context:f,offsetX:c,offsetY:d,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(r.setTransform(1,0,0,1,0,0),r.translate(c,d),r.save()),uy(r,f),this.ctx=f,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(r),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const r=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const a=Pn(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...a);const l=jo.getAxialAlignedBoundingBox([0,0,r.canvas.width,r.canvas.height],a);this.ctx.drawImage(r.canvas,0,0),this.ctx.restore(),this.compose(l)}}beginAnnotation(t,r,n,a,l){if(this.#e(),f$(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),r){const c=r[2]-r[0],d=r[3]-r[1];if(l&&this.annotationCanvasMap){n=n.slice(),n[4]-=r[0],n[5]-=r[1],r=r.slice(),r[0]=r[1]=0,r[2]=c,r[3]=d;const[p,u]=jo.singularValueDecompose2dScale(Pn(this.ctx)),{viewportScale:h}=this,m=Math.ceil(c*this.outputScaleX*h),f=Math.ceil(d*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(m,f);const{canvas:x,context:y}=this.annotationCanvas;this.annotationCanvasMap.set(t,x),this.annotationCanvas.savedCtx=this.ctx,this.ctx=y,this.ctx.save(),this.ctx.setTransform(p,0,0,-u,0,d*u),f$(this.ctx)}else f$(this.ctx),this.ctx.rect(r[0],r[1],c,d),this.ctx.clip(),this.endPath()}this.current=new Eme(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const r=t.count;t=this.getObject(t.data,t),t.count=r;const n=this.ctx,a=this.processingType3;if(a&&(a.compiled===void 0&&(a.compiled=lNt(t)),a.compiled)){a.compiled(n);return}const l=this._createMaskCanvas(t),c=l.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(c,l.offsetX,l.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(t,r,n=0,a=0,l,c){if(!this.contentVisible)return;t=this.getObject(t.data,t);const d=this.ctx;d.save();const p=Pn(d);d.transform(r,n,a,l,0,0);const u=this._createMaskCanvas(t);d.setTransform(1,0,0,1,u.offsetX-p[4],u.offsetY-p[5]);for(let h=0,m=c.length;h<m;h+=2){const f=jo.transform(p,[r,n,a,l,c[h],c[h+1]]),[x,y]=jo.applyTransform([0,0],f);d.drawImage(u.canvas,x,y)}d.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const r=this.ctx,n=this.current.fillColor,a=this.current.patternFill;for(const l of t){const{data:c,width:d,height:p,transform:u}=l,h=this.cachedCanvases.getCanvas("maskCanvas",d,p),m=h.context;m.save();const f=this.getObject(c,l);Ime(m,f),m.globalCompositeOperation="source-in",m.fillStyle=a?n.getPattern(m,this,v0(r),Tl.FILL):n,m.fillRect(0,0,d,p),m.restore(),r.save(),r.transform(...u),r.scale(1,-1),g$(r,h.canvas,0,0,d,p,0,-1,1,1),r.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const r=this.getObject(t);if(!r){Nr("Dependent image isn't ready yet");return}this.paintInlineImageXObject(r)}paintImageXObjectRepeat(t,r,n,a){if(!this.contentVisible)return;const l=this.getObject(t);if(!l){Nr("Dependent image isn't ready yet");return}const c=l.width,d=l.height,p=[];for(let u=0,h=a.length;u<h;u+=2)p.push({transform:[r,0,0,n,a[u],a[u+1]],x:0,y:0,w:c,h:d});this.paintInlineImageXObjectGroup(l,p)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;const{bitmap:r,width:n,height:a}=t,l=this.cachedCanvases.getCanvas("inlineImage",n,a),c=l.context;return c.filter=this.current.transferMaps,c.drawImage(r,0,0),c.filter="none",l.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const r=t.width,n=t.height,a=this.ctx;if(this.save(),!ul){const{filter:d}=a;d!=="none"&&d!==""&&(a.filter="none")}a.scale(1/r,-1/n);let l;if(t.bitmap)l=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)l=t;else{const p=this.cachedCanvases.getCanvas("inlineImage",r,n).context;Lme(p,t),l=this.applyTransferMapsToCanvas(p)}const c=this._scaleImage(l,v0(a));a.imageSmoothingEnabled=jme(Pn(a),t.interpolate),g$(a,c.img,0,0,c.paintWidth,c.paintHeight,0,-n,r,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,r){if(!this.contentVisible)return;const n=this.ctx;let a;if(t.bitmap)a=t.bitmap;else{const l=t.width,c=t.height,p=this.cachedCanvases.getCanvas("inlineImage",l,c).context;Lme(p,t),a=this.applyTransferMapsToCanvas(p)}for(const l of r)n.save(),n.transform(...l.transform),n.scale(1,-1),g$(n,a,l.x,l.y,l.w,l.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,r){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,r){t==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(r)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const n=this.ctx;this.pendingClip&&(r||(this.pendingClip===Mme?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=Pn(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const r=Math.abs(t[0]*t[3]-t[2]*t[1]),n=Math.hypot(t[0],t[2]),a=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(n,a)/r}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:t}=this.current,{a:r,b:n,c:a,d:l}=this.ctx.getTransform();let c,d;if(n===0&&a===0){const p=Math.abs(r),u=Math.abs(l);if(p===u)if(t===0)c=d=1/p;else{const h=p*t;c=d=h<1?1/h:1}else if(t===0)c=1/p,d=1/u;else{const h=p*t,m=u*t;c=h<1?1/h:1,d=m<1?1/m:1}}else{const p=Math.abs(r*l-n*a),u=Math.hypot(r,n),h=Math.hypot(a,l);if(t===0)c=h/p,d=u/p;else{const m=t*p;c=h>m?h/m:1,d=u>m?u/m:1}}this._cachedScaleForStroking[0]=c,this._cachedScaleForStroking[1]=d}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:r}=this,{lineWidth:n}=this.current,[a,l]=this.getScaleForStroking();if(r.lineWidth=n||1,a===1&&l===1){r.stroke();return}const c=r.getLineDash();if(t&&r.save(),r.scale(a,l),c.length>0){const d=Math.max(a,l);r.setLineDash(c.map(p=>p/d)),r.lineDashOffset/=d}r.stroke(),t&&r.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const e in J1)d8.prototype[e]!==void 0&&(d8.prototype[J1[e]]=d8.prototype[e]);class ov{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");this.#e=t}static get workerSrc(){return this.#t}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");this.#t=t}}const x$={DATA:1,ERROR:2},Ca={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function qc(e){switch(e instanceof Error||typeof e=="object"&&e!==null||Gi('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new p5(e.message);case"MissingPDFException":return new d5(e.message);case"PasswordException":return new SY(e.message,e.code);case"UnexpectedResponseException":return new MM(e.message,e.status);case"UnknownErrorException":return new EY(e.message,e.details);default:return new EY(e.message,e.toString())}}class wb{constructor(t,r,n){this.sourceName=t,this.targetName=r,this.comObj=n,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=a=>{const l=a.data;if(l.targetName!==this.sourceName)return;if(l.stream){this.#t(l);return}if(l.callback){const d=l.callbackId,p=this.callbackCapabilities[d];if(!p)throw new Error(`Cannot resolve callback ${d}`);if(delete this.callbackCapabilities[d],l.callback===x$.DATA)p.resolve(l.data);else if(l.callback===x$.ERROR)p.reject(qc(l.reason));else throw new Error("Unexpected callback case");return}const c=this.actionHandler[l.action];if(!c)throw new Error(`Unknown action from worker: ${l.action}`);if(l.callbackId){const d=this.sourceName,p=l.sourceName;new Promise(function(u){u(c(l.data))}).then(function(u){n.postMessage({sourceName:d,targetName:p,callback:x$.DATA,callbackId:l.callbackId,data:u})},function(u){n.postMessage({sourceName:d,targetName:p,callback:x$.ERROR,callbackId:l.callbackId,reason:qc(u)})});return}if(l.streamId){this.#e(l);return}c(l.data)},n.addEventListener("message",this._onComObjOnMessage)}on(t,r){const n=this.actionHandler;if(n[t])throw new Error(`There is already an actionName called "${t}"`);n[t]=r}send(t,r,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:r},n)}sendWithPromise(t,r,n){const a=this.callbackId++,l=Promise.withResolvers();this.callbackCapabilities[a]=l;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:r},n)}catch(c){l.reject(c)}return l.promise}sendWithStream(t,r,n,a){const l=this.streamId++,c=this.sourceName,d=this.targetName,p=this.comObj;return new ReadableStream({start:u=>{const h=Promise.withResolvers();return this.streamControllers[l]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},p.postMessage({sourceName:c,targetName:d,action:t,streamId:l,data:r,desiredSize:u.desiredSize},a),h.promise},pull:u=>{const h=Promise.withResolvers();return this.streamControllers[l].pullCall=h,p.postMessage({sourceName:c,targetName:d,stream:Ca.PULL,streamId:l,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Wa(u instanceof Error,"cancel must have a valid reason");const h=Promise.withResolvers();return this.streamControllers[l].cancelCall=h,this.streamControllers[l].isClosed=!0,p.postMessage({sourceName:c,targetName:d,stream:Ca.CANCEL,streamId:l,reason:qc(u)}),h.promise}},n)}#e(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this,d=this.actionHandler[t.action],p={enqueue(u,h=1,m){if(this.isCancelled)return;const f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),l.postMessage({sourceName:n,targetName:a,stream:Ca.ENQUEUE,streamId:r,chunk:u},m)},close(){this.isCancelled||(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.CLOSE,streamId:r}),delete c.streamSinks[r])},error(u){Wa(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,l.postMessage({sourceName:n,targetName:a,stream:Ca.ERROR,streamId:r,reason:qc(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};p.sinkCapability.resolve(),p.ready=p.sinkCapability.promise,this.streamSinks[r]=p,new Promise(function(u){u(d(t.data,p))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,success:!0})},function(u){l.postMessage({sourceName:n,targetName:a,stream:Ca.START_COMPLETE,streamId:r,reason:qc(u)})})}#t(t){const r=t.streamId,n=this.sourceName,a=t.sourceName,l=this.comObj,c=this.streamControllers[r],d=this.streamSinks[r];switch(t.stream){case Ca.START_COMPLETE:t.success?c.startCall.resolve():c.startCall.reject(qc(t.reason));break;case Ca.PULL_COMPLETE:t.success?c.pullCall.resolve():c.pullCall.reject(qc(t.reason));break;case Ca.PULL:if(!d){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0});break}d.desiredSize<=0&&t.desiredSize>0&&d.sinkCapability.resolve(),d.desiredSize=t.desiredSize,new Promise(function(p){p(d.onPull?.())}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.PULL_COMPLETE,streamId:r,reason:qc(p)})});break;case Ca.ENQUEUE:if(Wa(c,"enqueue should have stream controller"),c.isClosed)break;c.controller.enqueue(t.chunk);break;case Ca.CLOSE:if(Wa(c,"close should have stream controller"),c.isClosed)break;c.isClosed=!0,c.controller.close(),this.#o(c,r);break;case Ca.ERROR:Wa(c,"error should have stream controller"),c.controller.error(qc(t.reason)),this.#o(c,r);break;case Ca.CANCEL_COMPLETE:t.success?c.cancelCall.resolve():c.cancelCall.reject(qc(t.reason)),this.#o(c,r);break;case Ca.CANCEL:if(!d)break;new Promise(function(p){p(d.onCancel?.(qc(t.reason)))}).then(function(){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,success:!0})},function(p){l.postMessage({sourceName:n,targetName:a,stream:Ca.CANCEL_COMPLETE,streamId:r,reason:qc(p)})}),d.sinkCapability.reject(qc(t.reason)),d.isCancelled=!0,delete this.streamSinks[r];break;default:throw new Error("Unexpected stream case")}}async#o(t,r){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[r]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class uNt{#e;#t;constructor({parsedData:t,rawData:r}){this.#e=t,this.#t=r}getRaw(){return this.#t}get(t){return this.#e.get(t)??null}getAll(){return AX(this.#e)}has(t){return this.#e.has(t)}}const Sm=Symbol("INTERNAL");class hNt{#e=!1;#t=!1;#o=!1;#i=!0;constructor(t,{name:r,intent:n,usage:a}){this.#e=!!(t&Nd.DISPLAY),this.#t=!!(t&Nd.PRINT),this.name=r,this.intent=n,this.usage=a}get visible(){if(this.#o)return this.#i;if(!this.#i)return!1;const{print:t,view:r}=this.usage;return this.#e?r?.viewState!=="OFF":this.#t?t?.printState!=="OFF":!0}_setVisible(t,r,n=!1){t!==Sm&&Gi("Internal method `_setVisible` called."),this.#o=n,this.#i=r}}class mNt{#e=null;#t=new Map;#o=null;#i=null;constructor(t,r=Nd.DISPLAY){if(this.renderingIntent=r,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#i=t.order;for(const n of t.groups)this.#t.set(n.id,new hNt(r,n));if(t.baseState==="OFF")for(const n of this.#t.values())n._setVisible(Sm,!1);for(const n of t.on)this.#t.get(n)._setVisible(Sm,!0);for(const n of t.off)this.#t.get(n)._setVisible(Sm,!1);this.#o=this.getHash()}}#s(t){const r=t.length;if(r<2)return!0;const n=t[0];for(let a=1;a<r;a++){const l=t[a];let c;if(Array.isArray(l))c=this.#s(l);else if(this.#t.has(l))c=this.#t.get(l).visible;else return Nr(`Optional content group not found: ${l}`),!0;switch(n){case"And":if(!c)return!1;break;case"Or":if(c)return!0;break;case"Not":return!c;default:return!0}}return n==="And"}isVisible(t){if(this.#t.size===0)return!0;if(!t)return jM("Optional content group not defined."),!0;if(t.type==="OCG")return this.#t.has(t.id)?this.#t.get(t.id).visible:(Nr(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#s(t.expression);if(!t.policy||t.policy==="AnyOn"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(!this.#t.get(r).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const r of t.ids){if(!this.#t.has(r))return Nr(`Optional content group not found: ${r}`),!0;if(this.#t.get(r).visible)return!1}return!0}return Nr(`Unknown optional content policy ${t.policy}.`),!0}return Nr(`Unknown group type ${t.type}.`),!0}setVisibility(t,r=!0){const n=this.#t.get(t);if(!n){Nr(`Optional content group not found: ${t}`);return}n._setVisible(Sm,!!r,!0),this.#e=null}setOCGState({state:t,preserveRB:r}){let n;for(const a of t){switch(a){case"ON":case"OFF":case"Toggle":n=a;continue}const l=this.#t.get(a);if(l)switch(n){case"ON":l._setVisible(Sm,!0);break;case"OFF":l._setVisible(Sm,!1);break;case"Toggle":l._setVisible(Sm,!l.visible);break}}this.#e=null}get hasInitialVisibility(){return this.#o===null||this.getHash()===this.#o}getOrder(){return this.#t.size?this.#i?this.#i.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?AX(this.#t):null}getGroup(t){return this.#t.get(t)||null}getHash(){if(this.#e!==null)return this.#e;const t=new Jze;for(const[r,n]of this.#t)t.update(`${r}:${n.visible}`);return this.#e=t.hexdigest()}}class gNt{constructor(t,{disableRange:r=!1,disableStream:n=!1}){Wa(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:a,initialData:l,progressiveDone:c,contentDispositionFilename:d}=t;if(this._queuedChunks=[],this._progressiveDone=c,this._contentDispositionFilename=d,l?.length>0){const p=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;this._queuedChunks.push(p)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!n,this._isRangeSupported=!r,this._contentLength=a,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((p,u)=>{this._onReceiveData({begin:p,chunk:u})}),t.addProgressListener((p,u)=>{this._onProgress({loaded:p,total:u})}),t.addProgressiveReadListener(p=>{this._onReceiveData({chunk:p})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:r}){const n=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{const a=this._rangeReaders.some(function(l){return l._begin!==t?!1:(l._enqueue(n),!0)});Wa(a,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){t.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const r=this._rangeReaders.indexOf(t);r>=0&&this._rangeReaders.splice(r,1)}getFullReader(){Wa(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new fNt(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new xNt(this,t,r);return this._pdfDataRangeTransport.requestDataRange(t,r),this._rangeReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeReaders.slice(0))r.cancel(t);this._pdfDataRangeTransport.abort()}}class fNt{constructor(t,r,n=!1,a=null){this._stream=t,this._done=n||!1,this._filename=LX(a)?a:null,this._queuedChunks=r||[],this._loaded=0;for(const l of this._queuedChunks)this._loaded+=l.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class xNt{constructor(t,r,n){this._stream=t,this._begin=r,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function yNt(e){let t=!0,r=n("filename\\*","i").exec(e);if(r){r=r[1];let h=d(r);return h=unescape(h),h=p(h),h=u(h),l(h)}if(r=c(e),r){const h=u(r);return l(h)}if(r=n("filename","i").exec(e),r){r=r[1];let h=d(r);return h=u(h),l(h)}function n(h,m){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',m)}function a(h,m){if(h){if(!/^[\x00-\xFF]+$/.test(m))return m;try{const f=new TextDecoder(h,{fatal:!0}),x=BM(m);m=f.decode(x),t=!1}catch{}}return m}function l(h){return t&&/[\x80-\xff]/.test(h)&&(h=a("utf-8",h),t&&(h=a("iso-8859-1",h))),h}function c(h){const m=[];let f;const x=n("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=x.exec(h))!==null;){let[,b,w,v]=f;if(b=parseInt(b,10),b in m){if(b===0)break;continue}m[b]=[w,v]}const y=[];for(let b=0;b<m.length&&b in m;++b){let[w,v]=m[b];v=d(v),w&&(v=unescape(v),b===0&&(v=p(v))),y.push(v)}return y.join("")}function d(h){if(h.startsWith('"')){const m=h.slice(1).split('\\"');for(let f=0;f<m.length;++f){const x=m[f].indexOf('"');x!==-1&&(m[f]=m[f].slice(0,x),m.length=f+1),m[f]=m[f].replaceAll(/\\(.)/g,"$1")}h=m.join('"')}return h}function p(h){const m=h.indexOf("'");if(m===-1)return h;const f=h.slice(0,m),y=h.slice(m+1).replace(/^[^']*'/,"");return a(f,y)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(m,f,x,y){if(x==="q"||x==="Q")return y=y.replaceAll("_"," "),y=y.replaceAll(/=([0-9a-fA-F]{2})/g,function(b,w){return String.fromCharCode(parseInt(w,16))}),a(f,y);try{y=atob(y)}catch{}return a(f,y)})}return""}function TX({getResponseHeader:e,isHttp:t,rangeChunkSize:r,disableRange:n}){const a={allowRangeRequests:!1,suggestedLength:void 0},l=parseInt(e("Content-Length"),10);return!Number.isInteger(l)||(a.suggestedLength=l,l<=2*r)||n||!t||e("Accept-Ranges")!=="bytes"||(e("Content-Encoding")||"identity")!=="identity"||(a.allowRangeRequests=!0),a}function zX(e){const t=e("Content-Disposition");if(t){let r=yNt(t);if(r.includes("%"))try{r=decodeURIComponent(r)}catch{}if(LX(r))return r}return null}function FM(e,t){return e===404||e===0&&t.startsWith("file:")?new d5('Missing PDF "'+t+'".'):new MM(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function tRe(e){return e===200||e===206}function oRe(e,t,r){return{method:"GET",headers:e,signal:r.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function rRe(e){const t=new Headers;for(const r in e){const n=e[r];n!==void 0&&t.append(r,n)}return t}function iRe(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:(Nr(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class Bme{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 Wa(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new bNt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=new wNt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class bNt{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const r=t.source;this._withCredentials=r.withCredentials||!1,this._contentLength=r.length,this._headersCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._headers=rRe(this._stream.httpHeaders);const n=r.url;fetch(n,oRe(this._headers,this._withCredentials,this._abortController)).then(a=>{if(!tRe(a.status))throw FM(a.status,n);this._reader=a.body.getReader(),this._headersCapability.resolve();const l=p=>a.headers.get(p),{allowRangeRequests:c,suggestedLength:d}=TX({getResponseHeader:l,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=c,this._contentLength=d||this._contentLength,this._filename=zX(l),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new p5("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:iRe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class wNt{constructor(t,r,n){this._stream=t,this._reader=null,this._loaded=0;const a=t.source;this._withCredentials=a.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController,this._headers=rRe(this._stream.httpHeaders),this._headers.append("Range",`bytes=${r}-${n-1}`);const l=a.url;fetch(l,oRe(this._headers,this._withCredentials,this._abortController)).then(c=>{if(!tRe(c.status))throw FM(c.status,l);this._readCapability.resolve(),this._reader=c.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:r}=await this._reader.read();return r?{value:t,done:r}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:iRe(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}const a_=200,s_=206;function vNt(e){const t=e.response;return typeof t!="string"?t:BM(t).buffer}class CNt{constructor(t,r={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&r.httpHeaders||Object.create(null),this.withCredentials=r.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,r,n){const a={begin:t,end:r};for(const l in n)a[l]=n[l];return this.request(a)}requestFull(t){return this.request(t)}request(t){const r=new XMLHttpRequest,n=this.currXhrId++,a=this.pendingRequests[n]={xhr:r};r.open("GET",this.url),r.withCredentials=this.withCredentials;for(const l in this.httpHeaders){const c=this.httpHeaders[l];c!==void 0&&r.setRequestHeader(l,c)}return this.isHttp&&"begin"in t&&"end"in t?(r.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),a.expectedStatus=s_):a.expectedStatus=a_,r.responseType="arraybuffer",t.onError&&(r.onerror=function(l){t.onError(r.status)}),r.onreadystatechange=this.onStateChange.bind(this,n),r.onprogress=this.onProgress.bind(this,n),a.onHeadersReceived=t.onHeadersReceived,a.onDone=t.onDone,a.onError=t.onError,a.onProgress=t.onProgress,r.send(null),n}onProgress(t,r){const n=this.pendingRequests[t];n&&n.onProgress?.(r)}onStateChange(t,r){const n=this.pendingRequests[t];if(!n)return;const a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),a.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],a.status===0&&this.isHttp){n.onError?.(a.status);return}const l=a.status||a_;if(!(l===a_&&n.expectedStatus===s_)&&l!==n.expectedStatus){n.onError?.(a.status);return}const d=vNt(a);if(l===s_){const p=a.getResponseHeader("Content-Range"),u=/bytes (\d+)-(\d+)\/(\d+)/.exec(p);n.onDone({begin:parseInt(u[1],10),chunk:d})}else d?n.onDone({begin:0,chunk:d}):n.onError?.(a.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const r=this.pendingRequests[t].xhr;delete this.pendingRequests[t],r.abort()}}class ANt{constructor(t){this._source=t,this._manager=new CNt(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const r=this._rangeRequestReaders.indexOf(t);r>=0&&this._rangeRequestReaders.splice(r,1)}getFullReader(){return Wa(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new $Nt(this._manager,this._source),this._fullRequestReader}getRangeReader(t,r){const n=new kNt(this._manager,t,r);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class $Nt{constructor(t,r){this._manager=t;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=r.url,this._fullRequestId=t.requestFull(n),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=r.disableRange||!1,this._contentLength=r.length,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,r=this._manager.getRequestXhr(t),n=c=>r.getResponseHeader(c),{allowRangeRequests:a,suggestedLength:l}=TX({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});a&&(this._isRangeSupported=!0),this._contentLength=l||this._contentLength,this._filename=zX(n),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=FM(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class kNt{constructor(t,r,n){this._manager=t;const a={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(r,n,a),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const r=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:r,done:!1}):this._queuedChunk=r,this._done=!0;for(const n of this._requests)n.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=FM(t,this._url);for(const r of this._requests)r.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const r=this._queuedChunk;return this._queuedChunk=null,{value:r,done:!1}}if(this._done)return{value:void 0,done:!0};const t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const nRe=/^file:\/\/\/[a-zA-Z]:\//;function SNt(e){const t=Rh.get("url"),r=t.parse(e);return r.protocol==="file:"||r.host?r:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(r.host||(r.protocol="file:"),r)}class ENt{constructor(t){this.source=t,this.url=SNt(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 Wa(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new jNt(this):new LNt(this),this._fullRequestReader}getRangeReader(t,r){if(r<=this._progressiveDataLength)return null;const n=this.isFsUrl?new MNt(this,t,r):new INt(this,t,r);return this._rangeRequestReaders.push(n),n}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const r of this._rangeRequestReaders.slice(0))r.cancel(t)}}class aRe{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const r=t.source;this._contentLength=r.length,this._loaded=0,this._filename=null,this._disableRange=r.disableRange||!1,this._rangeChunkSize=r.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!r.disableStream,this._isRangeSupported=!r.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new p5("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class sRe{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const r=t.source;this._isStreamingSupported=!r.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){if(!this._readableStream){this._error(t);return}this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",r=>{this._error(r)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function BL(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class LNt extends aRe{constructor(t){super(t);const r=n=>{if(n.statusCode===404){const d=new d5(`Missing PDF "${this._url}".`);this._storedError=d,this._headersCapability.reject(d);return}this._headersCapability.resolve(),this._setReadableStream(n);const a=d=>this._readableStream.headers[d.toLowerCase()],{allowRangeRequests:l,suggestedLength:c}=TX({getResponseHeader:a,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=c||this._contentLength,this._filename=zX(a)};if(this._request=null,this._url.protocol==="http:"){const n=Rh.get("http");this._request=n.request(BL(this._url,t.httpHeaders),r)}else{const n=Rh.get("https");this._request=n.request(BL(this._url,t.httpHeaders),r)}this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class INt extends sRe{constructor(t,r,n){super(t),this._httpHeaders={};for(const l in t.httpHeaders){const c=t.httpHeaders[l];c!==void 0&&(this._httpHeaders[l]=c)}this._httpHeaders.Range=`bytes=${r}-${n-1}`;const a=l=>{if(l.statusCode===404){const c=new d5(`Missing PDF "${this._url}".`);this._storedError=c;return}this._setReadableStream(l)};if(this._request=null,this._url.protocol==="http:"){const l=Rh.get("http");this._request=l.request(BL(this._url,this._httpHeaders),a)}else{const l=Rh.get("https");this._request=l.request(BL(this._url,this._httpHeaders),a)}this._request.on("error",l=>{this._storedError=l}),this._request.end()}}class jNt extends aRe{constructor(t){super(t);let r=decodeURIComponent(this._url.path);nRe.test(this._url.href)&&(r=r.replace(/^\//,""));const n=Rh.get("fs");n.promises.lstat(r).then(a=>{this._contentLength=a.size,this._setReadableStream(n.createReadStream(r)),this._headersCapability.resolve()},a=>{a.code==="ENOENT"&&(a=new d5(`Missing PDF "${r}".`)),this._storedError=a,this._headersCapability.reject(a)})}}class MNt extends sRe{constructor(t,r,n){super(t);let a=decodeURIComponent(this._url.path);nRe.test(this._url.href)&&(a=a.replace(/^\//,""));const l=Rh.get("fs");this._setReadableStream(l.createReadStream(a,{start:r,end:n-1}))}}const BNt=1e5,rc=30,PNt=.8;let PL=class Nu{#e=Promise.withResolvers();#t=null;#o=!1;#i=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#n=0;#l=0;#d=null;#p=null;#h=0;#c=0;#a=Object.create(null);#m=[];#f=null;#u=[];#y=new WeakMap;#g=null;static#b=new Map;static#v=new Map;static#A=null;static#k=new Set;constructor({textContentSource:t,container:r,viewport:n}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(p){p.enqueue(t),p.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#p=r,this.#c=n.scale*(globalThis.devicePixelRatio||1),this.#h=n.rotation,this.#r={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null};const{pageWidth:a,pageHeight:l,pageX:c,pageY:d}=n.rawDims;this.#g=[1,0,0,-1,-c,d+l],this.#l=a,this.#n=l,Nu.#x(),H4(r,n),this.#e.promise.catch(()=>{}).then(()=>{Nu.#k.delete(this),this.#r=null,this.#a=null})}render(){const t=()=>{this.#d.read().then(({value:r,done:n})=>{if(n){this.#e.resolve();return}this.#s??=r.lang,Object.assign(this.#a,r.styles),this.#S(r.items),t()},this.#e.reject)};return this.#d=this.#f.getReader(),Nu.#k.add(this),t(),this.#e.promise}update({viewport:t,onBefore:r=null}){const n=t.scale*(globalThis.devicePixelRatio||1),a=t.rotation;if(a!==this.#h&&(r?.(),this.#h=a,H4(this.#p,{rotation:a})),n!==this.#c){r?.(),this.#c=n;const l={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:Nu.#w(this.#s)};for(const c of this.#u)l.properties=this.#y.get(c),l.div=c,this.#$(l)}}cancel(){const t=new p5("TextLayer task cancelled.");this.#d?.cancel(t).catch(()=>{}),this.#d=null,this.#e.reject(t)}get textDivs(){return this.#u}get textContentItemsStr(){return this.#m}#S(t){if(this.#o)return;this.#r.ctx??=Nu.#w(this.#s);const r=this.#u,n=this.#m;for(const a of t){if(r.length>BNt){Nr("Ignoring additional textDivs for performance reasons."),this.#o=!0;return}if(a.str===void 0){if(a.type==="beginMarkedContentProps"||a.type==="beginMarkedContent"){const l=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),a.id!==null&&this.#t.setAttribute("id",`${a.id}`),l.append(this.#t)}else a.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}n.push(a.str),this.#j(a)}}#j(t){const r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#u.push(r);const a=jo.transform(this.#g,t.transform);let l=Math.atan2(a[1],a[0]);const c=this.#a[t.fontName];c.vertical&&(l+=Math.PI/2);const d=this.#i&&c.fontSubstitution||c.fontFamily,p=Math.hypot(a[2],a[3]),u=p*Nu.#C(d,this.#s);let h,m;l===0?(h=a[4],m=a[5]-u):(h=a[4]+u*Math.sin(l),m=a[5]-u*Math.cos(l));const f="calc(var(--scale-factor)*",x=r.style;this.#t===this.#p?(x.left=`${(100*h/this.#l).toFixed(2)}%`,x.top=`${(100*m/this.#n).toFixed(2)}%`):(x.left=`${f}${h.toFixed(2)}px)`,x.top=`${f}${m.toFixed(2)}px)`),x.fontSize=`${f}${(Nu.#A*p).toFixed(2)}px)`,x.fontFamily=d,n.fontSize=p,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#i&&(r.dataset.fontName=c.fontSubstitutionLoadedName||t.fontName),l!==0&&(n.angle=l*(180/Math.PI));let y=!1;if(t.str.length>1)y=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const b=Math.abs(t.transform[0]),w=Math.abs(t.transform[3]);b!==w&&Math.max(b,w)/Math.min(b,w)>1.5&&(y=!0)}if(y&&(n.canvasWidth=c.vertical?t.height:t.width),this.#y.set(r,n),this.#r.div=r,this.#r.properties=n,this.#$(this.#r),n.hasText&&this.#t.append(r),n.hasEOL){const b=document.createElement("br");b.setAttribute("role","presentation"),this.#t.append(b)}}#$(t){const{div:r,properties:n,ctx:a,prevFontSize:l,prevFontFamily:c}=t,{style:d}=r;let p="";if(Nu.#A>1&&(p=`scale(${1/Nu.#A})`),n.canvasWidth!==0&&n.hasText){const{fontFamily:u}=d,{canvasWidth:h,fontSize:m}=n;(l!==m||c!==u)&&(a.font=`${m*this.#c}px ${u}`,t.prevFontSize=m,t.prevFontFamily=u);const{width:f}=a.measureText(r.textContent);f>0&&(p=`scaleX(${h*this.#c/f}) ${p}`)}n.angle!==0&&(p=`rotate(${n.angle}deg) ${p}`),p.length>0&&(d.transform=p)}static cleanup(){if(!(this.#k.size>0)){this.#b.clear();for(const{canvas:t}of this.#v.values())t.remove();this.#v.clear()}}static#w(t=null){let r=this.#v.get(t||="");if(!r){const n=document.createElement("canvas");n.className="hiddenCanvasElement",n.lang=t,document.body.append(n),r=n.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#v.set(t,r)}return r}static#x(){if(this.#A!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.textContent="X",document.body.append(t),this.#A=t.getBoundingClientRect().height,t.remove()}static#C(t,r){const n=this.#b.get(t);if(n)return n;const a=this.#w(r),l=a.font;a.canvas.width=a.canvas.height=rc,a.font=`${rc}px ${t}`;const c=a.measureText("");let d=c.fontBoundingBoxAscent,p=Math.abs(c.fontBoundingBoxDescent);if(d){const m=d/(d+p);return this.#b.set(t,m),a.canvas.width=a.canvas.height=0,a.font=l,m}a.strokeStyle="red",a.clearRect(0,0,rc,rc),a.strokeText("g",0,0);let u=a.getImageData(0,0,rc,rc).data;p=0;for(let m=u.length-1-3;m>=0;m-=4)if(u[m]>0){p=Math.ceil(m/4/rc);break}a.clearRect(0,0,rc,rc),a.strokeText("A",0,rc),u=a.getImageData(0,0,rc,rc).data,d=0;for(let m=0,f=u.length;m<f;m+=4)if(u[m]>0){d=rc-Math.floor(m/4/rc);break}a.canvas.width=a.canvas.height=0,a.font=l;const h=d?d/(d+p):PNt;return this.#b.set(t,h),h}};function DNt(){qze("`renderTextLayer`, please use `TextLayer` instead.");const{textContentSource:e,container:t,viewport:r,...n}=arguments[0],a=Object.keys(n);a.length>0&&Nr("Ignoring `renderTextLayer` parameters: "+a.join(", "));const l=new PL({textContentSource:e,container:t,viewport:r}),{textDivs:c,textContentItemsStr:d}=l;return{promise:l.render(),textDivs:c,textContentItemsStr:d}}function TNt(){qze("`updateTextLayer`, please use `TextLayer` instead.")}class rv{static textContent(t){const r=[],n={items:r,styles:Object.create(null)};function a(l){if(!l)return;let c=null;const d=l.name;if(d==="#text")c=l.value;else if(rv.shouldBuildText(d))l?.attributes?.textContent?c=l.attributes.textContent:l.value&&(c=l.value);else return;if(c!==null&&r.push({str:c}),!!l.children)for(const p of l.children)a(p)}return a(t),n}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}}const zNt=65536,RNt=100,FNt=5e3,ONt=ul?qOt:ROt,NNt=ul?ZOt:Yze,HNt=ul?KOt:zOt,_Nt=ul?JOt:Kze;function VNt(e={}){typeof e=="string"||e instanceof URL?e={url:e}:(e instanceof ArrayBuffer||ArrayBuffer.isView(e))&&(e={data:e});const t=new RX,{docId:r}=t,n=e.url?QNt(e.url):null,a=e.data?UNt(e.data):null,l=e.httpHeaders||null,c=e.withCredentials===!0,d=e.password??null,p=e.range instanceof lRe?e.range:null,u=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:zNt;let h=e.worker instanceof Ud?e.worker:null;const m=e.verbosity,f=typeof e.docBaseUrl=="string"&&!EX(e.docBaseUrl)?e.docBaseUrl:null,x=typeof e.cMapUrl=="string"?e.cMapUrl:null,y=e.cMapPacked!==!1,b=e.CMapReaderFactory||NNt,w=typeof e.standardFontDataUrl=="string"?e.standardFontDataUrl:null,v=e.StandardFontDataFactory||_Nt,A=e.stopAtErrors!==!0,S=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,E=e.isEvalSupported!==!1,I=typeof e.isOffscreenCanvasSupported=="boolean"?e.isOffscreenCanvasSupported:!ul,L=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,M=typeof e.disableFontFace=="boolean"?e.disableFontFace:ul,D=e.fontExtraProperties===!0,P=e.enableXfa===!0,T=e.ownerDocument||globalThis.document,z=e.disableRange===!0,N=e.disableStream===!0,K=e.disableAutoFetch===!0,q=e.pdfBug===!0,F=e.enableHWA===!0,_=p?p.length:e.length??NaN,V=typeof e.useSystemFonts=="boolean"?e.useSystemFonts:!ul&&!M,O=typeof e.useWorkerFetch=="boolean"?e.useWorkerFetch:b===Yze&&v===Kze&&x&&w&&bb(x,document.baseURI)&&bb(w,document.baseURI),R=e.canvasFactory||new ONt({ownerDocument:T,enableHWA:F}),H=e.filterFactory||new HNt({docId:r,ownerDocument:T}),ee=null;kOt(m);const Y={canvasFactory:R,filterFactory:H};if(O||(Y.cMapReaderFactory=new b({baseUrl:x,isCompressed:y}),Y.standardFontDataFactory=new v({baseUrl:w})),!h){const J={verbosity:m,port:ov.workerPort};h=J.port?Ud.fromPort(J):new Ud(J),t._worker=h}const G={docId:r,apiVersion:"4.4.168",data:a,password:d,disableAutoFetch:K,rangeChunkSize:u,length:_,docBaseUrl:f,enableXfa:P,evaluatorOptions:{maxImageSize:S,disableFontFace:M,ignoreErrors:A,isEvalSupported:E,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:L,fontExtraProperties:D,useSystemFonts:V,cMapUrl:O?x:null,standardFontDataUrl:O?w:null}},X={disableFontFace:M,fontExtraProperties:D,ownerDocument:T,pdfBug:q,styleElement:ee,loadingParams:{disableAutoFetch:K,enableXfa:P}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const J=h.messageHandler.sendWithPromise("GetDocRequest",G,a?[a.buffer]:null);let ie;if(p)ie=new gNt(p,{disableRange:z,disableStream:N});else if(!a){if(!n)throw new Error("getDocument - no `url` parameter provided.");ie=(me=>ul?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&bb(me.url)?new Bme(me):new ENt(me):bb(me.url)?new Bme(me):new ANt(me))({url:n,length:_,httpHeaders:l,withCredentials:c,rangeChunkSize:u,disableRange:z,disableStream:N})}return J.then(ye=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");const me=new wb(r,ye,h.port),de=new KNt(me,t,ie,X,Y);t._transport=de,me.send("Ready",null)})}).catch(t._capability.reject),t}function QNt(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(ul&&typeof e=="string")return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function UNt(e){if(ul&&typeof AE<"u"&&e instanceof AE)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e=="string")return BM(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 Pme(e){return typeof e=="object"&&Number.isInteger(e?.num)&&e.num>=0&&Number.isInteger(e?.gen)&&e.gen>=0}class RX{static#e=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${RX.#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 lRe=class{constructor(t,r,n=!1,a=null){this.length=t,this.initialData=r,this.progressiveDone=n,this.contentDispositionFilename=a,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,r){for(const n of this._rangeListeners)n(t,r)}onDataProgress(t,r){this._readyCapability.promise.then(()=>{for(const n of this._progressListeners)n(t,r)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const r of this._progressiveReadListeners)r(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,r){Gi("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};class WNt{constructor(t,r){this._pdfInfo=t,this._transport=r}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return mi(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(r)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class GNt{#e=null;#t=!1;constructor(t,r,n,a=!1){this._pageIndex=t,this._pageInfo=r,this._transport=n,this._stats=a?new bme:null,this._pdfBug=a,this.commonObjs=n.commonObjs,this.objs=new cRe,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:r=this.rotate,offsetX:n=0,offsetY:a=0,dontFlip:l=!1}={}){return new hC({viewBox:this.view,scale:t,rotation:r,offsetX:n,offsetY:a,dontFlip:l})}getAnnotations({intent:t="display"}={}){const{renderingIntent:r}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,r)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return mi(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,viewport:r,intent:n="display",annotationMode:a=Fm.ENABLE,transform:l=null,background:c=null,optionalContentConfigPromise:d=null,annotationCanvasMap:p=null,pageColors:u=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const m=this._transport.getRenderingIntent(n,a,h),{renderingIntent:f,cacheKey:x}=m;this.#t=!1,this.#i(),d||=this._transport.getOptionalContentConfig(f);let y=this._intentStates.get(x);y||(y=Object.create(null),this._intentStates.set(x,y)),y.streamReaderCancelTimeout&&(clearTimeout(y.streamReaderCancelTimeout),y.streamReaderCancelTimeout=null);const b=!!(f&Nd.PRINT);y.displayReadyCapability||(y.displayReadyCapability=Promise.withResolvers(),y.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));const w=S=>{y.renderTasks.delete(v),(this._maybeCleanupAfterRender||b)&&(this.#t=!0),this.#o(!b),S?(v.capability.reject(S),this._abortOperatorList({intentState:y,reason:S instanceof Error?S:new Error(S)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new W6({callback:w,params:{canvasContext:t,viewport:r,transform:l,background:c},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:y.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});(y.renderTasks||=new Set).add(v);const A=v.task;return Promise.all([y.displayReadyCapability.promise,d]).then(([S,E])=>{if(this.destroyed){w();return}if(this._stats?.time("Rendering"),!(E.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:S,optionalContentConfig:E}),v.operatorListChanged()}).catch(w),A}getOperatorList({intent:t="display",annotationMode:r=Fm.ENABLE,printAnnotationStorage:n=null}={}){function a(){c.operatorList.lastChunk&&(c.opListReadCapability.resolve(c.operatorList),c.renderTasks.delete(d))}const l=this._transport.getRenderingIntent(t,r,n,!0);let c=this._intentStates.get(l.cacheKey);c||(c=Object.create(null),this._intentStates.set(l.cacheKey,c));let d;return c.opListReadCapability||(d=Object.create(null),d.operatorListChanged=a,c.opListReadCapability=Promise.withResolvers(),(c.renderTasks||=new Set).add(d),c.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(l)),c.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:r===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>rv.textContent(n));const r=this.streamTextContent(t);return new Promise(function(n,a){function l(){c.read().then(function({value:p,done:u}){if(u){n(d);return}d.lang??=p.lang,Object.assign(d.styles,p.styles),d.items.push(...p.items),l()},a)}const c=r.getReader(),d={items:[],styles:Object.create(null),lang:null};l()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const n of r.renderTasks)t.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,this.#i(),Promise.all(t)}cleanup(t=!1){this.#t=!0;const r=this.#o(!1);return t&&r&&(this._stats&&=new bme),r}#o(t=!1){if(this.#i(),!this.#t||this.destroyed)return!1;if(t)return this.#e=setTimeout(()=>{this.#e=null,this.#o(!1)},FNt),!1;for(const{renderTasks:r,operatorList:n}of this._intentStates.values())if(r.size>0||!n.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#i(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(t,r){const n=this._intentStates.get(r);n&&(this._stats?.timeEnd("Page Request"),n.displayReadyCapability?.resolve(t))}_renderPageChunk(t,r){for(let n=0,a=t.length;n<a;n++)r.operatorList.fnArray.push(t.fnArray[n]),r.operatorList.argsArray.push(t.argsArray[n]);r.operatorList.lastChunk=t.lastChunk,r.operatorList.separateAnnots=t.separateAnnots;for(const n of r.renderTasks)n.operatorListChanged();t.lastChunk&&this.#o(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:r,annotationStorageSerializable:n}){const{map:a,transfer:l}=n,d=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:r,annotationStorage:a},l).getReader(),p=this._intentStates.get(r);p.streamReader=d;const u=()=>{d.read().then(({value:h,done:m})=>{if(m){p.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(h,p),u())},h=>{if(p.streamReader=null,!this._transport.destroyed){if(p.operatorList){p.operatorList.lastChunk=!0;for(const m of p.renderTasks)m.operatorListChanged();this.#o(!0)}if(p.displayReadyCapability)p.displayReadyCapability.reject(h);else if(p.opListReadCapability)p.opListReadCapability.reject(h);else throw h}})};u()}_abortOperatorList({intentState:t,reason:r,force:n=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!n){if(t.renderTasks.size>0)return;if(r instanceof SX){let a=RNt;r.extraDelay>0&&r.extraDelay<1e3&&(a+=r.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:r,force:!0})},a);return}}if(t.streamReader.cancel(new p5(r.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[a,l]of this._intentStates)if(l===t){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}class YNt{#e=new Set;#t=Promise.resolve();postMessage(t,r){const n={data:structuredClone(t,r?{transfer:r}:null)};this.#t.then(()=>{for(const a of this.#e)a.call(this,n)})}addEventListener(t,r){this.#e.add(r)}removeEventListener(t,r){this.#e.delete(r)}terminate(){this.#e.clear()}}const F0={isWorkerDisabled:!1,fakeWorkerId:0};ul&&(F0.isWorkerDisabled=!0,ov.workerSrc||="./pdf.worker.mjs"),F0.isSameOrigin=function(e,t){let r;try{if(r=new URL(e),!r.origin||r.origin==="null")return!1}catch{return!1}const n=new URL(t,r);return r.origin===n.origin},F0.createCDNWrapper=function(e){const t=`await import("${e}");`;return URL.createObjectURL(new Blob([t],{type:"text/javascript"}))};class Ud{static#e;constructor({name:t=null,port:r=null,verbosity:n=SOt()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=n,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,r){if(Ud.#e?.has(r))throw new Error("Cannot use more than one PDFWorker per port.");(Ud.#e||=new WeakMap).set(r,this),this._initializeFromPort(r);return}this._initialize()}get promise(){return ul?Promise.all([Rh.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 wb("main","worker",t),this._messageHandler.on("ready",function(){}),this.#t()}_initialize(){if(F0.isWorkerDisabled||Ud.#o){this._setupFakeWorker();return}let{workerSrc:t}=Ud;try{F0.isSameOrigin(window.location.href,t)||(t=F0.createCDNWrapper(new URL(t,window.location).href));const r=new Worker(t,{type:"module"}),n=new wb("main","worker",r),a=()=>{l.abort(),n.destroy(),r.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},l=new AbortController;r.addEventListener("error",()=>{this._webWorker||a()},{signal:l.signal}),n.on("test",d=>{if(l.abort(),this.destroyed||!d){a();return}this._messageHandler=n,this._port=r,this._webWorker=r,this.#t()}),n.on("ready",d=>{if(l.abort(),this.destroyed){a();return}try{c()}catch{this._setupFakeWorker()}});const c=()=>{const d=new Uint8Array;n.send("test",d,[d.buffer])};c();return}catch{jM("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){F0.isWorkerDisabled||(Nr("Setting up fake worker."),F0.isWorkerDisabled=!0),Ud._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const r=new YNt;this._port=r;const n=`fake${F0.fakeWorkerId++}`,a=new wb(n+"_worker",n,r);t.setup(a,r),this._messageHandler=new wb(n,n+"_worker",r),this.#t()}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),Ud.#e?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const r=this.#e?.get(t.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new Ud(t)}static get workerSrc(){if(ov.workerSrc)return ov.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#o(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return mi(this,"_setupFakeWorkerGlobal",(async()=>this.#o?this.#o:(await import(this.workerSrc)).WorkerMessageHandler)())}}class KNt{#e=new Map;#t=new Map;#o=new Map;#i=new Map;#s=null;constructor(t,r,n,a,l){this.messageHandler=t,this.loadingTask=r,this.commonObjs=new cRe,this.fontLoader=new GOt({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this.loadingParams=a.loadingParams,this._params=a,this.canvasFactory=l.canvasFactory,this.filterFactory=l.filterFactory,this.cMapReaderFactory=l.cMapReaderFactory,this.standardFontDataFactory=l.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,r=null){const n=this.#e.get(t);if(n)return n;const a=this.messageHandler.sendWithPromise(t,r);return this.#e.set(t,a),a}get annotationStorage(){return mi(this,"annotationStorage",new PX)}getRenderingIntent(t,r=Fm.ENABLE,n=null,a=!1){let l=Nd.DISPLAY,c=LY;switch(t){case"any":l=Nd.ANY;break;case"display":break;case"print":l=Nd.PRINT;break;default:Nr(`getRenderingIntent - invalid intent: ${t}`)}switch(r){case Fm.DISABLE:l+=Nd.ANNOTATIONS_DISABLE;break;case Fm.ENABLE:break;case Fm.ENABLE_FORMS:l+=Nd.ANNOTATIONS_FORMS;break;case Fm.ENABLE_STORAGE:l+=Nd.ANNOTATIONS_STORAGE,c=(l&Nd.PRINT&&n instanceof Xze?n:this.annotationStorage).serializable;break;default:Nr(`getRenderingIntent - invalid annotationMode: ${r}`)}return a&&(l+=Nd.OPLIST),{renderingIntent:l,cacheKey:`${l}_${c.hash}`,annotationStorageSerializable:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#s?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const n of this.#t.values())t.push(n._destroy());this.#t.clear(),this.#o.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),PL.cleanup(),this._networkStream?.cancelAllRequests(new p5("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:r}=this;t.on("GetReader",(n,a)=>{Wa(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=l=>{this._lastProgress={loaded:l.loaded,total:l.total}},a.onPull=()=>{this._fullReader.read().then(function({value:l,done:c}){if(c){a.close();return}Wa(l instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(l),1,[l])}).catch(l=>{a.error(l)})},a.onCancel=l=>{this._fullReader.cancel(l),a.ready.catch(c=>{if(!this.destroyed)throw c})}}),t.on("ReaderHeadersReady",n=>{const a=Promise.withResolvers(),l=this._fullReader;return l.headersReady.then(()=>{(!l.isStreamingSupported||!l.isRangeSupported)&&(this._lastProgress&&r.onProgress?.(this._lastProgress),l.onProgress=c=>{r.onProgress?.({loaded:c.loaded,total:c.total})}),a.resolve({isStreamingSupported:l.isStreamingSupported,isRangeSupported:l.isRangeSupported,contentLength:l.contentLength})},a.reject),a.promise}),t.on("GetRangeReader",(n,a)=>{Wa(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const l=this._networkStream.getRangeReader(n.begin,n.end);if(!l){a.close();return}a.onPull=()=>{l.read().then(function({value:c,done:d}){if(d){a.close();return}Wa(c instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(c),1,[c])}).catch(c=>{a.error(c)})},a.onCancel=c=>{l.cancel(c),a.ready.catch(d=>{if(!this.destroyed)throw d})}}),t.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,r._capability.resolve(new WNt(n,this))}),t.on("DocException",function(n){let a;switch(n.name){case"PasswordException":a=new SY(n.message,n.code);break;case"InvalidPDFException":a=new Uze(n.message);break;case"MissingPDFException":a=new d5(n.message);break;case"UnexpectedResponseException":a=new MM(n.message,n.status);break;case"UnknownErrorException":a=new EY(n.message,n.details);break;default:Gi("DocException - expected a valid Error.")}r._capability.reject(a)}),t.on("PasswordRequest",n=>{if(this.#s=Promise.withResolvers(),r.onPassword){const a=l=>{l instanceof Error?this.#s.reject(l):this.#s.resolve({password:l})};try{r.onPassword(a,n.code)}catch(l){this.#s.reject(l)}}else this.#s.reject(new SY(n.message,n.code));return this.#s.promise}),t.on("DataLoaded",n=>{r.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),t.on("StartRenderPage",n=>{if(this.destroyed)return;this.#t.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),t.on("commonobj",([n,a,l])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(a){case"Font":const{disableFontFace:c,fontExtraProperties:d,pdfBug:p}=this._params;if("error"in l){const f=l.error;Nr(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const u=p&&globalThis.FontInspector?.enabled?(f,x)=>globalThis.FontInspector.fontAdded(f,x):null,h=new YOt(l,{disableFontFace:c,inspectFont:u});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:n})).finally(()=>{!d&&h.data&&(h.data=null),this.commonObjs.resolve(n,h)});break;case"CopyLocalImage":const{imageRef:m}=l;Wa(m,"The imageRef must be defined.");for(const f of this.#t.values())for(const[,x]of f.objs)if(x?.ref===m)return x.dataLen?(this.commonObjs.resolve(n,structuredClone(x)),x.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,l);break;default:throw new Error(`Got unknown common object type ${a}`)}return null}),t.on("obj",([n,a,l,c])=>{if(this.destroyed)return;const d=this.#t.get(a);if(!d.objs.has(n)){if(d._intentStates.size===0){c?.bitmap?.close();return}switch(l){case"Image":d.objs.resolve(n,c),c?.dataLen>vOt&&(d._maybeCleanupAfterRender=!0);break;case"Pattern":d.objs.resolve(n,c);break;default:throw new Error(`Got unknown object type ${l}`)}}}),t.on("DocProgress",n=>{this.destroyed||r.onProgress?.({loaded:n.loaded,total:n.total})}),t.on("FetchBuiltInCMap",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(n):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",n=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(n):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Nr("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=t-1,n=this.#o.get(r);if(n)return n;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(l=>{if(this.destroyed)throw new Error("Transport destroyed");l.refStr&&this.#i.set(l.refStr,t);const c=new GNt(r,l,this,this._params.pdfBug);return this.#t.set(r,c),c});return this.#o.set(r,a),a}getPageIndex(t){return Pme(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}getFieldObjects(){return this.#r("GetFieldObjects")}hasJSActions(){return this.#r("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#r("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#r("GetOptionalContentConfig").then(r=>new mNt(r,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",r=this.#e.get(t);if(r)return r;const n=this.messageHandler.sendWithPromise(t,null).then(a=>({info:a[0],metadata:a[1]?new uNt(a[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(t,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const r of this.#t.values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),PL.cleanup()}}cachedPageNumber(t){if(!Pme(t))return null;const r=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#i.get(r)??null}}const y$=Symbol("INITIAL_DATA");class cRe{#e=Object.create(null);#t(t){return this.#e[t]||={...Promise.withResolvers(),data:y$}}get(t,r=null){if(r){const a=this.#t(t);return a.promise.then(()=>r(a.data)),null}const n=this.#e[t];if(!n||n.data===y$)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return n.data}has(t){const r=this.#e[t];return!!r&&r.data!==y$}resolve(t,r=null){const n=this.#t(t);n.data=r,n.resolve()}clear(){for(const t in this.#e){const{data:r}=this.#e[t];r?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const t in this.#e){const{data:r}=this.#e[t];r!==y$&&(yield[t,r])}}}class qNt{#e=null;constructor(t){this.#e=t,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(t=0){this.#e.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#e.operatorList;if(!t)return!1;const{annotationCanvasMap:r}=this.#e;return t.form||t.canvas&&r?.size>0}}class W6{#e=null;static#t=new WeakSet;constructor({callback:t,params:r,objs:n,commonObjs:a,annotationCanvasMap:l,operatorList:c,pageIndex:d,canvasFactory:p,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:m=!1,pageColors:f=null}){this.callback=t,this.params=r,this.objs=n,this.commonObjs=a,this.annotationCanvasMap=l,this.operatorListIdx=null,this.operatorList=c,this._pageIndex=d,this.canvasFactory=p,this.filterFactory=u,this._pdfBug=m,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new qNt(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=r.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:r}){if(this.cancelled)return;if(this._canvas){if(W6.#t.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");W6.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:n,viewport:a,transform:l,background:c}=this.params;this.gfx=new d8(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:a,transparency:t,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,r=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),W6.#t.delete(this._canvas),this.callback(t||new SX(`Rendering cancelled, page ${this._pageIndex+1}`,r))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),W6.#t.delete(this._canvas),this.callback())))}}const ZNt="4.4.168",JNt="19fbc8998";function Dme(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,"0")}function hy(e){return Math.max(0,Math.min(255,255*e))}class Tme{static CMYK_G([t,r,n,a]){return["G",1-Math.min(1,.3*t+.59*n+.11*r+a)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=hy(t),[t,t,t]}static G_HTML([t]){const r=Dme(t);return`#${r}${r}${r}`}static RGB_G([t,r,n]){return["G",.3*t+.59*r+.11*n]}static RGB_rgb(t){return t.map(hy)}static RGB_HTML(t){return`#${t.map(Dme).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,r,n,a]){return["RGB",1-Math.min(1,t+a),1-Math.min(1,n+a),1-Math.min(1,r+a)]}static CMYK_rgb([t,r,n,a]){return[hy(1-Math.min(1,t+a)),hy(1-Math.min(1,n+a)),hy(1-Math.min(1,r+a))]}static CMYK_HTML(t){const r=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(r)}static RGB_CMYK([t,r,n]){const a=1-t,l=1-r,c=1-n,d=Math.min(a,l,c);return["CMYK",a,l,c,d]}}class dRe{static setupStorage(t,r,n,a,l){const c=a.getValue(r,{value:null});switch(n.name){case"textarea":if(c.value!==null&&(t.textContent=c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})});break;case"input":if(n.attributes.type==="radio"||n.attributes.type==="checkbox"){if(c.value===n.attributes.xfaOn?t.setAttribute("checked",!0):c.value===n.attributes.xfaOff&&t.removeAttribute("checked"),l==="print")break;t.addEventListener("change",d=>{a.setValue(r,{value:d.target.checked?d.target.getAttribute("xfaOn"):d.target.getAttribute("xfaOff")})})}else{if(c.value!==null&&t.setAttribute("value",c.value),l==="print")break;t.addEventListener("input",d=>{a.setValue(r,{value:d.target.value})})}break;case"select":if(c.value!==null){t.setAttribute("value",c.value);for(const d of n.children)d.attributes.value===c.value?d.attributes.selected=!0:d.attributes.hasOwnProperty("selected")&&delete d.attributes.selected}t.addEventListener("input",d=>{const p=d.target.options,u=p.selectedIndex===-1?"":p[p.selectedIndex].value;a.setValue(r,{value:u})});break}}static setAttributes({html:t,element:r,storage:n=null,intent:a,linkService:l}){const{attributes:c}=r,d=t instanceof HTMLAnchorElement;c.type==="radio"&&(c.name=`${c.name}-${a}`);for(const[p,u]of Object.entries(c))if(u!=null)switch(p){case"class":u.length&&t.setAttribute(p,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!d||p!=="href"&&p!=="newWindow")&&t.setAttribute(p,u)}d&&l.addLinkAttributes(t,c.href,c.newWindow),n&&c.dataId&&this.setupStorage(t,c.dataId,r,n)}static render(t){const r=t.annotationStorage,n=t.linkService,a=t.xfaHtml,l=t.intent||"display",c=document.createElement(a.name);a.attributes&&this.setAttributes({html:c,element:a,intent:l,linkService:n});const d=l!=="richText",p=t.div;if(p.append(c),t.viewport){const m=`matrix(${t.viewport.transform.join(",")})`;p.style.transform=m}d&&p.setAttribute("class","xfaLayer xfaFont");const u=[];if(a.children.length===0){if(a.value){const m=document.createTextNode(a.value);c.append(m),d&&rv.shouldBuildText(a.name)&&u.push(m)}return{textDivs:u}}const h=[[a,-1,c]];for(;h.length>0;){const[m,f,x]=h.at(-1);if(f+1===m.children.length){h.pop();continue}const y=m.children[++h.at(-1)[1]];if(y===null)continue;const{name:b}=y;if(b==="#text"){const v=document.createTextNode(y.value);u.push(v),x.append(v);continue}const w=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,b):document.createElement(b);if(x.append(w),y.attributes&&this.setAttributes({html:w,element:y,storage:r,intent:l,linkService:n}),y.children?.length>0)h.push([y,-1,w]);else if(y.value){const v=document.createTextNode(y.value);d&&rv.shouldBuildText(b)&&u.push(v),w.append(v)}}for(const m of p.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))m.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){const r=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=r,t.div.hidden=!1}}const fC=1e3,XNt=9,_4=new WeakSet;function d2(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class eHt{static create(t){switch(t.data.annotationType){case Ha.LINK:return new pRe(t);case Ha.TEXT:return new tHt(t);case Ha.WIDGET:switch(t.data.fieldType){case"Tx":return new oHt(t);case"Btn":return t.data.radioButton?new uRe(t):t.data.checkBox?new iHt(t):new nHt(t);case"Ch":return new aHt(t);case"Sig":return new rHt(t)}return new u5(t);case Ha.POPUP:return new BY(t);case Ha.FREETEXT:return new hRe(t);case Ha.LINE:return new lHt(t);case Ha.SQUARE:return new cHt(t);case Ha.CIRCLE:return new dHt(t);case Ha.POLYLINE:return new mRe(t);case Ha.CARET:return new uHt(t);case Ha.INK:return new gRe(t);case Ha.POLYGON:return new pHt(t);case Ha.HIGHLIGHT:return new hHt(t);case Ha.UNDERLINE:return new mHt(t);case Ha.SQUIGGLY:return new gHt(t);case Ha.STRIKEOUT:return new fHt(t);case Ha.STAMP:return new fRe(t);case Ha.FILEATTACHMENT:return new xHt(t);default:return new ua(t)}}}class ua{#e=null;#t=!1;#o=null;constructor(t,{isRenderable:r=!1,ignoreBorder:n=!1,createQuadrilaterals:a=!1}={}){this.isRenderable=r,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,r&&(this.container=this._createContainer(n)),a&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:r,richText:n}){return!!(t?.str||r?.str||n?.str)}get hasPopupData(){return ua._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#e||={rect:this.data.rect.slice(0)};const{rect:r}=t;r&&this.#i(r),this.#o?.popup.updateEdited(t)}resetEdited(){this.#e&&(this.#i(this.#e.rect),this.#o?.popup.resetEdited(),this.#e=null)}#i(t){const{container:{style:r},data:{rect:n,rotation:a},parent:{viewport:{rawDims:{pageWidth:l,pageHeight:c,pageX:d,pageY:p}}}}=this;n?.splice(0,4,...t);const{width:u,height:h}=d2(t);r.left=`${100*(t[0]-d)/l}%`,r.top=`${100*(c-t[3]+p)/c}%`,a===0?(r.width=`${100*u/l}%`,r.height=`${100*h/c}%`):this.setRotation(a)}_createContainer(t){const{data:r,parent:{page:n,viewport:a}}=this,l=document.createElement("section");l.setAttribute("data-annotation-id",r.id),this instanceof u5||(l.tabIndex=fC);const{style:c}=l;if(c.zIndex=this.parent.zIndex++,r.popupRef&&l.setAttribute("aria-haspopup","dialog"),r.alternativeText&&(l.title=r.alternativeText),r.noRotate&&l.classList.add("norotate"),!r.rect||this instanceof BY){const{rotation:b}=r;return!r.hasOwnCanvas&&b!==0&&this.setRotation(b,l),l}const{width:d,height:p}=d2(r.rect);if(!t&&r.borderStyle.width>0){c.borderWidth=`${r.borderStyle.width}px`;const b=r.borderStyle.horizontalCornerRadius,w=r.borderStyle.verticalCornerRadius;if(b>0||w>0){const A=`calc(${b}px * var(--scale-factor)) / calc(${w}px * var(--scale-factor))`;c.borderRadius=A}else if(this instanceof uRe){const A=`calc(${d}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;c.borderRadius=A}switch(r.borderStyle.style){case py.SOLID:c.borderStyle="solid";break;case py.DASHED:c.borderStyle="dashed";break;case py.BEVELED:Nr("Unimplemented border style: beveled");break;case py.INSET:Nr("Unimplemented border style: inset");break;case py.UNDERLINE:c.borderBottomStyle="solid";break}const v=r.borderColor||null;v?(this.#t=!0,c.borderColor=jo.makeHexColor(v[0]|0,v[1]|0,v[2]|0)):c.borderWidth=0}const u=jo.normalizeRect([r.rect[0],n.view[3]-r.rect[1]+n.view[1],r.rect[2],n.view[3]-r.rect[3]+n.view[1]]),{pageWidth:h,pageHeight:m,pageX:f,pageY:x}=a.rawDims;c.left=`${100*(u[0]-f)/h}%`,c.top=`${100*(u[1]-x)/m}%`;const{rotation:y}=r;return r.hasOwnCanvas||y===0?(c.width=`${100*d/h}%`,c.height=`${100*p/m}%`):this.setRotation(y,l),l}setRotation(t,r=this.container){if(!this.data.rect)return;const{pageWidth:n,pageHeight:a}=this.parent.viewport.rawDims,{width:l,height:c}=d2(this.data.rect);let d,p;t%180===0?(d=100*l/n,p=100*c/a):(d=100*c/n,p=100*l/a),r.style.width=`${d}%`,r.style.height=`${p}%`,r.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(r,n,a)=>{const l=a.detail[r],c=l[0],d=l.slice(1);a.target.style[n]=Tme[`${c}_HTML`](d),this.annotationStorage.setValue(this.data.id,{[n]:Tme[`${c}_rgb`](d)})};return mi(this,"_commonActions",{display:r=>{const{display:n}=r.detail,a=n%2===1;this.container.style.visibility=a?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:a,noPrint:n===1||n===2})},print:r=>{this.annotationStorage.setValue(this.data.id,{noPrint:!r.detail.print})},hidden:r=>{const{hidden:n}=r.detail;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:n,noView:n})},focus:r=>{setTimeout(()=>r.target.focus({preventScroll:!1}),0)},userName:r=>{r.target.title=r.detail.userName},readonly:r=>{r.target.disabled=r.detail.readonly},required:r=>{this._setRequired(r.target,r.detail.required)},bgColor:r=>{t("bgColor","backgroundColor",r)},fillColor:r=>{t("fillColor","backgroundColor",r)},fgColor:r=>{t("fgColor","color",r)},textColor:r=>{t("textColor","color",r)},borderColor:r=>{t("borderColor","borderColor",r)},strokeColor:r=>{t("strokeColor","borderColor",r)},rotation:r=>{const n=r.detail.rotation;this.setRotation(n),this.annotationStorage.setValue(this.data.id,{rotation:n})}})}_dispatchEventFromSandbox(t,r){const n=this._commonActions;for(const a of Object.keys(r.detail))(t[a]||n[a])?.(r)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const r=this.annotationStorage.getRawValue(this.data.id);if(!r)return;const n=this._commonActions;for(const[a,l]of Object.entries(r)){const c=n[a];if(c){const d={detail:{[a]:l},target:t};c(d),delete r[a]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[r,n,a,l]=this.data.rect.map(b=>Math.fround(b));if(t.length===8){const[b,w,v,A]=t.subarray(2,6);if(a===b&&l===w&&r===v&&n===A)return}const{style:c}=this.container;let d;if(this.#t){const{borderColor:b,borderWidth:w}=c;c.borderWidth=0,d=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${b}" stroke-width="${w}">`],this.container.classList.add("hasBorder")}const p=a-r,u=l-n,{svgFactory:h}=this,m=h.createElement("svg");m.classList.add("quadrilateralsContainer"),m.setAttribute("width",0),m.setAttribute("height",0);const f=h.createElement("defs");m.append(f);const x=h.createElement("clipPath"),y=`clippath_${this.data.id}`;x.setAttribute("id",y),x.setAttribute("clipPathUnits","objectBoundingBox"),f.append(x);for(let b=2,w=t.length;b<w;b+=8){const v=t[b],A=t[b+1],S=t[b+2],E=t[b+3],I=h.createElement("rect"),L=(S-r)/p,M=(l-A)/u,D=(v-S)/p,P=(A-E)/u;I.setAttribute("x",L),I.setAttribute("y",M),I.setAttribute("width",D),I.setAttribute("height",P),x.append(I),d?.push(`<rect vector-effect="non-scaling-stroke" x="${L}" y="${M}" width="${D}" height="${P}"/>`)}this.#t&&(d.push("</g></svg>')"),c.backgroundImage=d.join("")),this.container.append(m),this.container.style.clipPath=`url(#${y})`}_createPopup(){const{container:t,data:r}=this;t.setAttribute("aria-haspopup","dialog");const n=this.#o=new BY({data:{color:r.color,titleObj:r.titleObj,modificationDate:r.modificationDate,contentsObj:r.contentsObj,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation},parent:this.parent,elements:[this]});this.parent.div.append(n.render())}render(){Gi("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,r=null){const n=[];if(this._fieldObjects){const a=this._fieldObjects[t];if(a)for(const{page:l,id:c,exportValues:d}of a){if(l===-1||c===r)continue;const p=typeof d=="string"?d:null,u=document.querySelector(`[data-element-id="${c}"]`);if(u&&!_4.has(u)){Nr(`_getElementsByName - element not allowed: ${c}`);continue}n.push({id:c,exportValue:p,domElement:u})}return n}for(const a of document.getElementsByName(t)){const{exportValue:l}=a,c=a.getAttribute("data-element-id");c!==r&&_4.has(a)&&n.push({id:c,exportValue:l,domElement:a})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const r of t)r.classList.add("highlightArea");else t.classList.add("highlightArea")}get _isEditable(){return!1}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:r}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:r})})}}class pRe extends ua{constructor(t,r=null){super(t,{isRenderable:!0,ignoreBorder:!!r?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:r}=this,n=document.createElement("a");n.setAttribute("data-element-id",t.id);let a=!1;return t.url?(r.addLinkAttributes(n,t.url,t.newWindow),a=!0):t.action?(this._bindNamedAction(n,t.action),a=!0):t.attachment?(this.#t(n,t.attachment,t.attachmentDest),a=!0):t.setOCGState?(this.#o(n,t.setOCGState),a=!0):t.dest?(this._bindLink(n,t.dest),a=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,t),a=!0),t.resetForm?(this._bindResetFormAction(n,t.resetForm),a=!0):this.isTooltipOnly&&!a&&(this._bindLink(n,""),a=!0)),this.container.classList.add("linkAnnotation"),a&&this.container.append(n),this.container}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(t,r){t.href=this.linkService.getDestinationHash(r),t.onclick=()=>(r&&this.linkService.goToDestination(r),!1),(r||r==="")&&this.#e()}_bindNamedAction(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(r),!1),this.#e()}#t(t,r,n=null){t.href=this.linkService.getAnchorUrl(""),r.description&&(t.title=r.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(r.content,r.filename,n),!1),this.#e()}#o(t,r){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(r),!1),this.#e()}_bindJSAction(t,r){t.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const a of Object.keys(r.actions)){const l=n.get(a);l&&(t[l]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r.id,name:a}}),!1))}t.onclick||(t.onclick=()=>!1),this.#e()}_bindResetFormAction(t,r){const n=t.onclick;if(n||(t.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Nr('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(t.onclick=()=>!1);return}t.onclick=()=>{n?.();const{fields:a,refs:l,include:c}=r,d=[];if(a.length!==0||l.length!==0){const h=new Set(l);for(const m of a){const f=this._fieldObjects[m]||[];for(const{id:x}of f)h.add(x)}for(const m of Object.values(this._fieldObjects))for(const f of m)h.has(f.id)===c&&d.push(f)}else for(const h of Object.values(this._fieldObjects))d.push(...h);const p=this.annotationStorage,u=[];for(const h of d){const{id:m}=h;switch(u.push(m),h.type){case"text":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}case"checkbox":case"radiobutton":{const x=h.defaultValue===h.exportValues;p.setValue(m,{value:x});break}case"combobox":case"listbox":{const x=h.defaultValue||"";p.setValue(m,{value:x});break}default:continue}const f=document.querySelector(`[data-element-id="${m}"]`);if(f){if(!_4.has(f)){Nr(`_bindResetFormAction - element not allowed: ${m}`);continue}}else continue;f.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:u,name:"ResetForm"}}),!1}}}class tHt extends ua{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class u5 extends ua{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return vc.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,r,n,a,l){n.includes("mouse")?t.addEventListener(n,c=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c),shift:c.shiftKey,modifier:this._getKeyModifier(c)}})}):t.addEventListener(n,c=>{if(n==="blur"){if(!r.focused||!c.relatedTarget)return;r.focused=!1}else if(n==="focus"){if(r.focused)return;r.focused=!0}l&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:a,value:l(c)}})})}_setEventListeners(t,r,n,a){for(const[l,c]of n)(c==="Action"||this.data.actions?.[c])&&((c==="Focus"||c==="Blur")&&(r||={focused:!1}),this._setEventListener(t,r,l,c,a),c==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,r,"blur","Blur",null):c==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,r,"focus","Focus",null))}_setBackgroundColor(t){const r=this.data.backgroundColor||null;t.style.backgroundColor=r===null?"transparent":jo.makeHexColor(r[0],r[1],r[2])}_setTextStyle(t){const r=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,a=this.data.defaultAppearanceData.fontSize||XNt,l=t.style;let c;const d=2,p=u=>Math.round(10*u)/10;if(this.data.multiLine){const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d),h=Math.round(u/(o_*a))||1,m=u/h;c=Math.min(a,p(m/o_))}else{const u=Math.abs(this.data.rect[3]-this.data.rect[1]-d);c=Math.min(a,p(u/o_))}l.fontSize=`calc(${c}px * var(--scale-factor))`,l.color=jo.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(l.textAlign=r[this.data.textAlignment])}_setRequired(t,r){r?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",r)}}class oHt extends u5{constructor(t){const r=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:r})}setPropertyOnSiblings(t,r,n,a){const l=this.annotationStorage;for(const c of this._getElementsByName(t.name,t.id))c.domElement&&(c.domElement[r]=n),l.setValue(c.id,{[a]:n})}render(){const t=this.annotationStorage,r=this.data.id;this.container.classList.add("textWidgetAnnotation");let n=null;if(this.renderForms){const a=t.getValue(r,{value:this.data.fieldValue});let l=a.value||"";const c=t.getValue(r,{charLimit:this.data.maxLen}).charLimit;c&&l.length>c&&(l=l.slice(0,c));let d=a.formattedValue||this.data.textContent?.join(`
|
|
247
247
|
`)||null;d&&this.data.comb&&(d=d.replaceAll(/\s+/g,""));const p={userValue:l,formattedValue:d,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=d??l,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",d??l),this.data.doNotScroll&&(n.style.overflowX="hidden")),this.data.hasOwnCanvas&&(n.hidden=!0),_4.add(n),n.setAttribute("data-element-id",r),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=fC,this._setRequired(n,this.data.required),c&&(n.maxLength=c),n.addEventListener("input",h=>{t.setValue(r,{value:h.target.value}),this.setPropertyOnSiblings(n,"value",h.target.value,"value"),p.formattedValue=null}),n.addEventListener("resetform",h=>{const m=this.data.defaultFieldValue??"";n.value=p.userValue=m,p.formattedValue=null});let u=h=>{const{formattedValue:m}=p;m!=null&&(h.target.value=m),h.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",m=>{if(p.focused)return;const{target:f}=m;p.userValue&&(f.value=p.userValue),p.lastCommittedValue=f.value,p.commitKey=1,this.data.actions?.Focus||(p.focused=!0)}),n.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const f={value(x){p.userValue=x.detail.value??"",t.setValue(r,{value:p.userValue.toString()}),x.target.value=p.userValue},formattedValue(x){const{formattedValue:y}=x.detail;p.formattedValue=y,y!=null&&x.target!==document.activeElement&&(x.target.value=y),t.setValue(r,{formattedValue:y})},selRange(x){x.target.setSelectionRange(...x.detail.selRange)},charLimit:x=>{const{charLimit:y}=x.detail,{target:b}=x;if(y===0){b.removeAttribute("maxLength");return}b.setAttribute("maxLength",y);let w=p.userValue;!w||w.length<=y||(w=w.slice(0,y),b.value=p.userValue=w,t.setValue(r,{value:w}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:w,willCommit:!0,commitKey:1,selStart:b.selectionStart,selEnd:b.selectionEnd}}))}};this._dispatchEventFromSandbox(f,m)}),n.addEventListener("keydown",m=>{p.commitKey=1;let f=-1;if(m.key==="Escape"?f=0:m.key==="Enter"&&!this.data.multiLine?f=2:m.key==="Tab"&&(p.commitKey=3),f===-1)return;const{value:x}=m.target;p.lastCommittedValue!==x&&(p.lastCommittedValue=x,p.userValue=x,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:x,willCommit:!0,commitKey:f,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const h=u;u=null,n.addEventListener("blur",m=>{if(!p.focused||!m.relatedTarget)return;this.data.actions?.Blur||(p.focused=!1);const{value:f}=m.target;p.userValue=f,p.lastCommittedValue!==f&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:f,willCommit:!0,commitKey:p.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}),h(m)}),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",m=>{p.lastCommittedValue=null;const{data:f,target:x}=m,{value:y,selectionStart:b,selectionEnd:w}=x;let v=b,A=w;switch(m.inputType){case"deleteWordBackward":{const S=y.substring(0,b).match(/\w*[^\w]*$/);S&&(v-=S[0].length);break}case"deleteWordForward":{const S=y.substring(b).match(/^[^\w]*\w*/);S&&(A+=S[0].length);break}case"deleteContentBackward":b===w&&(v-=1);break;case"deleteContentForward":b===w&&(A+=1);break}m.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:y,change:f||"",willCommit:!1,selStart:v,selEnd:A}})}),this._setEventListeners(n,p,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(u&&n.addEventListener("blur",u),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/c;n.classList.add("comb"),n.style.letterSpacing=`calc(${m}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell",this.data.hasOwnCanvas&&(n.hidden=!0);return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class rHt extends u5{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class iHt extends u5{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,r=this.data,n=r.id;let a=t.getValue(n,{value:r.exportValue===r.fieldValue}).value;typeof a=="string"&&(a=a!=="Off",t.setValue(n,{value:a})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const l=document.createElement("input");return _4.add(l),l.setAttribute("data-element-id",n),l.disabled=r.readOnly,this._setRequired(l,this.data.required),l.type="checkbox",l.name=r.fieldName,a&&l.setAttribute("checked",!0),l.setAttribute("exportValue",r.exportValue),l.tabIndex=fC,l.addEventListener("change",c=>{const{name:d,checked:p}=c.target;for(const u of this._getElementsByName(d,n)){const h=p&&u.exportValue===r.exportValue;u.domElement&&(u.domElement.checked=h),t.setValue(u.id,{value:h})}t.setValue(n,{value:p})}),l.addEventListener("resetform",c=>{const d=r.defaultFieldValue||"Off";c.target.checked=d===r.exportValue}),this.enableScripting&&this.hasJSActions&&(l.addEventListener("updatefromsandbox",c=>{const d={value(p){p.target.checked=p.detail.value!=="Off",t.setValue(n,{value:p.target.checked})}};this._dispatchEventFromSandbox(d,c)}),this._setEventListeners(l,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],c=>c.target.checked)),this._setBackgroundColor(l),this._setDefaultPropertiesFromJS(l),this.container.append(l),this.container}}class uRe extends u5{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,r=this.data,n=r.id;let a=t.getValue(n,{value:r.fieldValue===r.buttonValue}).value;if(typeof a=="string"&&(a=a!==r.buttonValue,t.setValue(n,{value:a})),a)for(const c of this._getElementsByName(r.fieldName,n))t.setValue(c.id,{value:!1});const l=document.createElement("input");if(_4.add(l),l.setAttribute("data-element-id",n),l.disabled=r.readOnly,this._setRequired(l,this.data.required),l.type="radio",l.name=r.fieldName,a&&l.setAttribute("checked",!0),l.tabIndex=fC,l.addEventListener("change",c=>{const{name:d,checked:p}=c.target;for(const u of this._getElementsByName(d,n))t.setValue(u.id,{value:!1});t.setValue(n,{value:p})}),l.addEventListener("resetform",c=>{const d=r.defaultFieldValue;c.target.checked=d!=null&&d===r.buttonValue}),this.enableScripting&&this.hasJSActions){const c=r.buttonValue;l.addEventListener("updatefromsandbox",d=>{const p={value:u=>{const h=c===u.detail.value;for(const m of this._getElementsByName(u.target.name)){const f=h&&m.id===n;m.domElement&&(m.domElement.checked=f),t.setValue(m.id,{value:f})}}};this._dispatchEventFromSandbox(p,d)}),this._setEventListeners(l,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],d=>d.target.checked)}return this._setBackgroundColor(l),this._setDefaultPropertiesFromJS(l),this.container.append(l),this.container}}class nHt extends pRe{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const r=t.lastChild;return this.enableScripting&&this.hasJSActions&&r&&(this._setDefaultPropertiesFromJS(r),r.addEventListener("updatefromsandbox",n=>{this._dispatchEventFromSandbox({},n)})),t}}class aHt extends u5{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,r=this.data.id,n=t.getValue(r,{value:this.data.fieldValue}),a=document.createElement("select");_4.add(a),a.setAttribute("data-element-id",r),a.disabled=this.data.readOnly,this._setRequired(a,this.data.required),a.name=this.data.fieldName,a.tabIndex=fC;let l=this.data.combo&&this.data.options.length>0;this.data.combo||(a.size=this.data.options.length,this.data.multiSelect&&(a.multiple=!0)),a.addEventListener("resetform",h=>{const m=this.data.defaultFieldValue;for(const f of a.options)f.selected=f.value===m});for(const h of this.data.options){const m=document.createElement("option");m.textContent=h.displayValue,m.value=h.exportValue,n.value.includes(h.exportValue)&&(m.setAttribute("selected",!0),l=!1),a.append(m)}let c=null;if(l){const h=document.createElement("option");h.value=" ",h.setAttribute("hidden",!0),h.setAttribute("selected",!0),a.prepend(h),c=()=>{h.remove(),a.removeEventListener("input",c),c=null},a.addEventListener("input",c)}const d=h=>{const m=h?"value":"textContent",{options:f,multiple:x}=a;return x?Array.prototype.filter.call(f,y=>y.selected).map(y=>y[m]):f.selectedIndex===-1?null:f[f.selectedIndex][m]};let p=d(!1);const u=h=>{const m=h.target.options;return Array.prototype.map.call(m,f=>({displayValue:f.textContent,exportValue:f.value}))};return this.enableScripting&&this.hasJSActions?(a.addEventListener("updatefromsandbox",h=>{const m={value(f){c?.();const x=f.detail.value,y=new Set(Array.isArray(x)?x:[x]);for(const b of a.options)b.selected=y.has(b.value);t.setValue(r,{value:d(!0)}),p=d(!1)},multipleSelection(f){a.multiple=!0},remove(f){const x=a.options,y=f.detail.remove;x[y].selected=!1,a.remove(y),x.length>0&&Array.prototype.findIndex.call(x,w=>w.selected)===-1&&(x[0].selected=!0),t.setValue(r,{value:d(!0),items:u(f)}),p=d(!1)},clear(f){for(;a.length!==0;)a.remove(0);t.setValue(r,{value:null,items:[]}),p=d(!1)},insert(f){const{index:x,displayValue:y,exportValue:b}=f.detail.insert,w=a.children[x],v=document.createElement("option");v.textContent=y,v.value=b,w?w.before(v):a.append(v),t.setValue(r,{value:d(!0),items:u(f)}),p=d(!1)},items(f){const{items:x}=f.detail;for(;a.length!==0;)a.remove(0);for(const y of x){const{displayValue:b,exportValue:w}=y,v=document.createElement("option");v.textContent=b,v.value=w,a.append(v)}a.options.length>0&&(a.options[0].selected=!0),t.setValue(r,{value:d(!0),items:u(f)}),p=d(!1)},indices(f){const x=new Set(f.detail.indices);for(const y of f.target.options)y.selected=x.has(y.index);t.setValue(r,{value:d(!0)}),p=d(!1)},editable(f){f.target.disabled=!f.detail.editable}};this._dispatchEventFromSandbox(m,h)}),a.addEventListener("input",h=>{const m=d(!0),f=d(!1);t.setValue(r,{value:m}),h.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:r,name:"Keystroke",value:p,change:f,changeEx:m,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(a,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],h=>h.target.value)):a.addEventListener("input",function(h){t.setValue(r,{value:d(!0)})}),this.data.combo&&this._setTextStyle(a),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class BY extends ua{constructor(t){const{data:r,elements:n}=t;super(t,{isRenderable:ua._hasPopupData(r)}),this.elements=n,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new sHt({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),r=[];for(const n of this.elements)n.popup=t,r.push(n.data.id),n.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(n=>`${Gze}${n}`).join(",")),this.container}}class sHt{#e=this.#j.bind(this);#t=this.#C.bind(this);#o=this.#x.bind(this);#i=this.#w.bind(this);#s=null;#r=null;#n=null;#l=null;#d=null;#p=null;#h=null;#c=!1;#a=null;#m=null;#f=null;#u=null;#y=null;#g=null;#b=!1;constructor({container:t,color:r,elements:n,titleObj:a,modificationDate:l,contentsObj:c,richText:d,parent:p,rect:u,parentRect:h,open:m}){this.#r=t,this.#y=a,this.#n=c,this.#u=d,this.#p=p,this.#s=r,this.#f=u,this.#h=h,this.#d=n,this.#l=Zze.toDateObject(l),this.trigger=n.flatMap(f=>f.getElementsToTriggerPopup());for(const f of this.trigger)f.addEventListener("click",this.#i),f.addEventListener("mouseenter",this.#o),f.addEventListener("mouseleave",this.#t),f.classList.add("popupTriggerArea");for(const f of n)f.container?.addEventListener("keydown",this.#e);this.#r.hidden=!0,m&&this.#w()}render(){if(this.#a)return;const t=this.#a=document.createElement("div");if(t.className="popup",this.#s){const l=t.style.outlineColor=jo.makeHexColor(...this.#s);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${l} 30%, white)`:t.style.backgroundColor=jo.makeHexColor(...this.#s.map(d=>Math.floor(.7*(255-d)+d)))}const r=document.createElement("span");r.className="header";const n=document.createElement("h1");if(r.append(n),{dir:n.dir,str:n.textContent}=this.#y,t.append(r),this.#l){const l=document.createElement("span");l.classList.add("popupDate"),l.setAttribute("data-l10n-id","pdfjs-annotation-date-string"),l.setAttribute("data-l10n-args",JSON.stringify({date:this.#l.toLocaleDateString(),time:this.#l.toLocaleTimeString()})),r.append(l)}const a=this.#v;if(a)dRe.render({xfaHtml:a,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const l=this._formatContents(this.#n);t.append(l)}this.#r.append(t)}get#v(){const t=this.#u,r=this.#n;return t?.str&&(!r?.str||r.str===t.str)&&this.#u.html||null}get#A(){return this.#v?.attributes?.style?.fontSize||0}get#k(){return this.#v?.attributes?.style?.color||null}#S(t){const r=[],n={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:r}]}},a={style:{color:this.#k,fontSize:this.#A?`calc(${this.#A}px * var(--scale-factor))`:""}};for(const l of t.split(`
|
|
248
248
|
`))r.push({name:"span",value:l,attributes:a});return n}_formatContents({str:t,dir:r}){const n=document.createElement("p");n.classList.add("popupContent"),n.dir=r;const a=t.split(/(?:\r\n?|\n)/);for(let l=0,c=a.length;l<c;++l){const d=a[l];n.append(document.createTextNode(d)),l<c-1&&n.append(document.createElement("br"))}return n}#j(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#c)&&this.#w()}updateEdited({rect:t,popupContent:r}){this.#g||={contentsObj:this.#n,richText:this.#u},t&&(this.#m=null),r&&(this.#u=this.#S(r),this.#n=null),this.#a?.remove(),this.#a=null}resetEdited(){this.#g&&({contentsObj:this.#n,richText:this.#u}=this.#g,this.#g=null,this.#a?.remove(),this.#a=null,this.#m=null)}#$(){if(this.#m!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:r,pageHeight:n,pageX:a,pageY:l}}}=this.#p;let c=!!this.#h,d=c?this.#h:this.#f;for(const y of this.#d)if(!d||jo.intersect(y.data.rect,d)!==null){d=y.data.rect,c=!0;break}const p=jo.normalizeRect([d[0],t[3]-d[1]+t[1],d[2],t[3]-d[3]+t[1]]),h=c?d[2]-d[0]+5:0,m=p[0]+h,f=p[1];this.#m=[100*(m-a)/r,100*(f-l)/n];const{style:x}=this.#r;x.left=`${this.#m[0]}%`,x.top=`${this.#m[1]}%`}#w(){this.#c=!this.#c,this.#c?(this.#x(),this.#r.addEventListener("click",this.#i),this.#r.addEventListener("keydown",this.#e)):(this.#C(),this.#r.removeEventListener("click",this.#i),this.#r.removeEventListener("keydown",this.#e))}#x(){this.#a||this.render(),this.isVisible?this.#c&&this.#r.classList.add("focused"):(this.#$(),this.#r.hidden=!1,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)+1e3)}#C(){this.#r.classList.remove("focused"),!(this.#c||!this.isVisible)&&(this.#r.hidden=!0,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)-1e3)}forceHide(){this.#b=this.isVisible,this.#b&&(this.#r.hidden=!0)}maybeShow(){this.#b&&(this.#a||this.#x(),this.#b=!1,this.#r.hidden=!1)}get isVisible(){return this.#r.hidden===!1}}class hRe extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=ai.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const r of this.textContent){const n=document.createElement("span");n.textContent=r,t.append(n)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}get _isEditable(){return this.data.hasOwnCanvas}}class lHt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:r,height:n}=d2(t.rect),a=this.svgFactory.create(r,n,!0),l=this.#e=this.svgFactory.createElement("svg:line");return l.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),l.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),l.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),l.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),l.setAttribute("stroke-width",t.borderStyle.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class cHt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:r,height:n}=d2(t.rect),a=this.svgFactory.create(r,n,!0),l=t.borderStyle.width,c=this.#e=this.svgFactory.createElement("svg:rect");return c.setAttribute("x",l/2),c.setAttribute("y",l/2),c.setAttribute("width",r-l),c.setAttribute("height",n-l),c.setAttribute("stroke-width",l||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),a.append(c),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class dHt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:r,height:n}=d2(t.rect),a=this.svgFactory.create(r,n,!0),l=t.borderStyle.width,c=this.#e=this.svgFactory.createElement("svg:ellipse");return c.setAttribute("cx",r/2),c.setAttribute("cy",n/2),c.setAttribute("rx",r/2-l/2),c.setAttribute("ry",n/2-l/2),c.setAttribute("stroke-width",l||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),a.append(c),this.container.append(a),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class mRe extends ua{#e=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:r,borderStyle:n,popupRef:a}}=this;if(!r)return this.container;const{width:l,height:c}=d2(t),d=this.svgFactory.create(l,c,!0);let p=[];for(let h=0,m=r.length;h<m;h+=2){const f=r[h]-t[0],x=t[3]-r[h+1];p.push(`${f},${x}`)}p=p.join(" ");const u=this.#e=this.svgFactory.createElement(this.svgElementName);return u.setAttribute("points",p),u.setAttribute("stroke-width",n.width||1),u.setAttribute("stroke","transparent"),u.setAttribute("fill","transparent"),d.append(u),this.container.append(d),!a&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class pHt extends mRe{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class uHt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class gRe extends ua{#e=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=ai.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:r,borderStyle:n,popupRef:a}}=this,{width:l,height:c}=d2(t),d=this.svgFactory.create(l,c,!0);for(const p of r){let u=[];for(let m=0,f=p.length;m<f;m+=2){const x=p[m]-t[0],y=t[3]-p[m+1];u.push(`${x},${y}`)}u=u.join(" ");const h=this.svgFactory.createElement(this.svgElementName);this.#e.push(h),h.setAttribute("points",u),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),!a&&this.hasPopupData&&this._createPopup(),d.append(h)}return this.container.append(d),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}}class hHt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class mHt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class gHt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class fHt extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class fRe extends ua{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class xHt extends ua{#e=null;constructor(t){super(t,{isRenderable:!0});const{file:r}=this.data;this.filename=r.filename,this.content=r.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...r})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:r}=this;let n;r.hasAppearance||r.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(r.name)?"paperclip":"pushpin"}.svg`,r.fillAlpha&&r.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(r.fillAlpha*100)}%);`)),n.addEventListener("dblclick",this.#t.bind(this)),this.#e=n;const{isMac:a}=vc.platform;return t.addEventListener("keydown",l=>{l.key==="Enter"&&(a?l.metaKey:l.ctrlKey)&&this.#t()}),!r.popupRef&&this.hasPopupData?this._createPopup():n.classList.add("popupTriggerArea"),t.append(n),t}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add("highlightArea")}#t(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}let yHt=class{#e=null;#t=null;#o=new Map;constructor({div:t,accessibilityManager:r,annotationCanvasMap:n,annotationEditorUIManager:a,page:l,viewport:c}){this.div=t,this.#e=r,this.#t=n,this.page=l,this.viewport=c,this.zIndex=0,this._annotationEditorUIManager=a}#i(t,r){const n=t.firstChild||t;n.id=`${Gze}${r}`,this.div.append(t),this.#e?.moveElementInDOM(this.div,t,n,!1)}async render(t){const{annotations:r}=t,n=this.div;H4(n,this.viewport);const a=new Map,l={data:null,layer:n,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new kX,annotationStorage:t.annotationStorage||new PX,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(const c of r){if(c.noHTML)continue;const d=c.annotationType===Ha.POPUP;if(d){const h=a.get(c.id);if(!h)continue;l.elements=h}else{const{width:h,height:m}=d2(c.rect);if(h<=0||m<=0)continue}l.data=c;const p=eHt.create(l);if(!p.isRenderable)continue;if(!d&&c.popupRef){const h=a.get(c.popupRef);h?h.push(p):a.set(c.popupRef,[p])}const u=p.render();c.hidden&&(u.style.visibility="hidden"),this.#i(u,c.id),p.annotationEditorType>0&&(this.#o.set(p.data.id,p),this._annotationEditorUIManager?.renderAnnotationElement(p))}this.#s()}update({viewport:t}){const r=this.div;this.viewport=t,H4(r,{rotation:t.rotation}),this.#s(),r.hidden=!1}#s(){if(!this.#t)return;const t=this.div;for(const[r,n]of this.#t){const a=t.querySelector(`[data-annotation-id="${r}"]`);if(!a)continue;n.className="annotationContent";const{firstChild:l}=a;l?l.nodeName==="CANVAS"?l.replaceWith(n):l.classList.contains("annotationContent")?l.after(n):l.before(n):a.append(n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#o.values())}getEditableAnnotation(t){return this.#o.get(t)}};const b$=/\r\n?|\n/g;class Va extends ur{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#o=this.editorDivInput.bind(this);#i=this.editorDivKeydown.bind(this);#s=this.editorDivPaste.bind(this);#r;#n="";#l=`${this.id}-editor`;#d;#p=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=Va.prototype,r=l=>l.isEmpty(),n=yg.TRANSLATE_SMALL,a=yg.TRANSLATE_BIG;return mi(this,"_keyboardManager",new mC([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:r}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-a,0],checker:r}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[n,0],checker:r}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[a,0],checker:r}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:r}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-a],checker:r}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,n],checker:r}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,a],checker:r}]]))}static _type="freetext";static _editorType=ai.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#r=t.color||Va._defaultColor||ur._defaultLineColor,this.#d=t.fontSize||Va._defaultFontSize}static initialize(t,r){ur.initialize(t,r,{strings:["pdfjs-free-text-default-content"]});const n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,r){switch(t){case gr.FREETEXT_SIZE:Va._defaultFontSize=r;break;case gr.FREETEXT_COLOR:Va._defaultColor=r;break}}updateParams(t,r){switch(t){case gr.FREETEXT_SIZE:this.#h(r);break;case gr.FREETEXT_COLOR:this.#c(r);break}}static get defaultPropertiesToUpdate(){return[[gr.FREETEXT_SIZE,Va._defaultFontSize],[gr.FREETEXT_COLOR,Va._defaultColor||ur._defaultLineColor]]}get propertiesToUpdate(){return[[gr.FREETEXT_SIZE,this.#d],[gr.FREETEXT_COLOR,this.#r]]}#h(t){const r=a=>{this.editorDiv.style.fontSize=`calc(${a}px * var(--scale-factor))`,this.translate(0,-(a-this.#d)*this.parentScale),this.#d=a,this.#m()},n=this.#d;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gr.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#c(t){const r=a=>{this.#r=this.editorDiv.style.color=a},n=this.#r;this.addCommands({cmd:r.bind(this,t),undo:r.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:gr.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,r){this._uiManager.translateSelectedEditors(t,r,!0)}getInitialTranslation(){const t=this.parentScale;return[-Va._internalPadding*t,-(Va._internalPadding+this.#d)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(ai.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant");const t=this._uiManager._signal;this.editorDiv.addEventListener("keydown",this.#i,{signal:t}),this.editorDiv.addEventListener("focus",this.#t,{signal:t}),this.editorDiv.addEventListener("blur",this.#e,{signal:t}),this.editorDiv.addEventListener("input",this.#o,{signal:t}),this.editorDiv.addEventListener("paste",this.#s,{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#l),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#i),this.editorDiv.removeEventListener("focus",this.#t),this.editorDiv.removeEventListener("blur",this.#e),this.editorDiv.removeEventListener("input",this.#o),this.editorDiv.removeEventListener("paste",this.#s),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#a(){const t=[];this.editorDiv.normalize();for(const r of this.editorDiv.childNodes)t.push(Va.#f(r));return t.join(`
|
|
249
249
|
`)}#m(){const[t,r]=this.parentDimensions;let n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{const{currentLayer:a,div:l}=this,c=l.style.display,d=l.classList.contains("hidden");l.classList.remove("hidden"),l.style.display="hidden",a.div.append(this.div),n=l.getBoundingClientRect(),l.remove(),l.style.display=c,l.classList.toggle("hidden",d)}this.rotation%180===this.parentRotation%180?(this.width=n.width/t,this.height=n.height/r):(this.width=n.height/t,this.height=n.width/r),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#n,r=this.#n=this.#a().trimEnd();if(t===r)return;const n=a=>{if(this.#n=a,!a){this.remove();return}this.#u(),this._uiManager.rebuild(this),this.#m()};this.addCommands({cmd:()=>{n(r)},undo:()=>{n(t)},mustExec:!1}),this.#m()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){Va._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,r;this.width&&(t=this.x,r=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#l),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text"),this.enableEditing(),ur._l10nPromise.get("pdfjs-free-text-default-content").then(a=>this.editorDiv?.setAttribute("default-content",a)),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#d}px * var(--scale-factor))`,n.color=this.#r,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),ML(this,this.div,["dblclick","keydown"]),this.width){const[a,l]=this.parentDimensions;if(this.annotationElementId){const{position:c}=this.#p;let[d,p]=this.getInitialTranslation();[d,p]=this.pageTranslationToScreen(d,p);const[u,h]=this.pageDimensions,[m,f]=this.pageTranslation;let x,y;switch(this.rotation){case 0:x=t+(c[0]-m)/u,y=r+this.height-(c[1]-f)/h;break;case 90:x=t+(c[0]-m)/u,y=r-(c[1]-f)/h,[d,p]=[p,-d];break;case 180:x=t-this.width+(c[0]-m)/u,y=r-(c[1]-f)/h,[d,p]=[-d,-p];break;case 270:x=t+(c[0]-m-this.height*h)/u,y=r+(c[1]-f-this.width*u)/h,[d,p]=[-p,d];break}this.setAt(x*a,y*l,d,p)}else this.setAt(t*a,r*l,this.width*a,this.height*l);this.#u(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#f(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(b$,"")}editorDivPaste(t){const r=t.clipboardData||window.clipboardData,{types:n}=r;if(n.length===1&&n[0]==="text/plain")return;t.preventDefault();const a=Va.#g(r.getData("text")||"").replaceAll(b$,`
|
|
@@ -23899,7 +23899,7 @@ to {
|
|
|
23899
23899
|
${({isMenuVisible:e})=>e===!1?pe`
|
|
23900
23900
|
display: none;
|
|
23901
23901
|
`:null};
|
|
23902
|
-
`,j_e=e=>g.createElement("svg",{width:208,height:208,viewBox:"0 0 208 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{filter:"url(#filter0_f_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:44,fill:"url(#paint0_linear_251_38441)"}),g.createElement("circle",{cx:104,cy:104,r:50,stroke:"url(#paint1_linear_251_38441)",strokeWidth:12})),g.createElement("g",{filter:"url(#filter1_d_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:41.1429,fill:"#FAFAFA"}),g.createElement("circle",{cx:104,cy:104,r:43.1429,stroke:"url(#paint2_linear_251_38441)",strokeWidth:4})),g.createElement("g",{clipPath:"url(#clip0_251_38441)"},g.createElement("path",{d:"M120.16 102.411L96.2853 90.4684C96.0134 90.3343 95.7118 90.2718 95.409 90.2867C95.1062 90.3016 94.8122 90.3935 94.5548 90.5536C94.2974 90.7138 94.0851 90.9369 93.938 91.202C93.7908 91.467 93.7137 91.7652 93.7139 92.0684V115.931C93.7137 116.234 93.7908 116.533 93.938 116.798C94.0851 117.063 94.2974 117.286 94.5548 117.446C94.8122 117.606 95.1062 117.698 95.409 117.713C95.7118 117.728 96.0134 117.665 96.2853 117.531L120.16 105.588C120.456 105.442 120.706 105.216 120.88 104.935C121.055 104.654 121.147 104.33 121.147 104C121.147 103.669 121.055 103.345 120.88 103.065C120.706 102.784 120.456 102.558 120.16 102.411Z",fill:"black"})),g.createElement("defs",null,g.createElement("filter",{id:"filter0_f_251_38441",x:0,y:0,width:208,height:208,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),g.createElement("feGaussianBlur",{stdDeviation:24,result:"effect1_foregroundBlur_251_38441"})),g.createElement("filter",{id:"filter1_d_251_38441",x:54.8569,y:58.8571,width:98.2856,height:98.2857,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),g.createElement("feOffset",{dy:4}),g.createElement("feGaussianBlur",{stdDeviation:2}),g.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),g.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),g.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_251_38441"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_251_38441",result:"shape"})),g.createElement("linearGradient",{id:"paint0_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint1_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint2_linear_251_38441",x1:118.653,y1:118.653,x2:89.0159,y2:89.0164,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("clipPath",{id:"clip0_251_38441"},g.createElement("rect",{width:27.4286,height:27.4286,fill:"white",transform:"translate(93.7139 90.2849)"})))),Z5e=g.lazy(()=>r4(()=>import("./index-
|
|
23902
|
+
`,j_e=e=>g.createElement("svg",{width:208,height:208,viewBox:"0 0 208 208",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},g.createElement("g",{filter:"url(#filter0_f_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:44,fill:"url(#paint0_linear_251_38441)"}),g.createElement("circle",{cx:104,cy:104,r:50,stroke:"url(#paint1_linear_251_38441)",strokeWidth:12})),g.createElement("g",{filter:"url(#filter1_d_251_38441)"},g.createElement("circle",{cx:104,cy:104,r:41.1429,fill:"#FAFAFA"}),g.createElement("circle",{cx:104,cy:104,r:43.1429,stroke:"url(#paint2_linear_251_38441)",strokeWidth:4})),g.createElement("g",{clipPath:"url(#clip0_251_38441)"},g.createElement("path",{d:"M120.16 102.411L96.2853 90.4684C96.0134 90.3343 95.7118 90.2718 95.409 90.2867C95.1062 90.3016 94.8122 90.3935 94.5548 90.5536C94.2974 90.7138 94.0851 90.9369 93.938 91.202C93.7908 91.467 93.7137 91.7652 93.7139 92.0684V115.931C93.7137 116.234 93.7908 116.533 93.938 116.798C94.0851 117.063 94.2974 117.286 94.5548 117.446C94.8122 117.606 95.1062 117.698 95.409 117.713C95.7118 117.728 96.0134 117.665 96.2853 117.531L120.16 105.588C120.456 105.442 120.706 105.216 120.88 104.935C121.055 104.654 121.147 104.33 121.147 104C121.147 103.669 121.055 103.345 120.88 103.065C120.706 102.784 120.456 102.558 120.16 102.411Z",fill:"black"})),g.createElement("defs",null,g.createElement("filter",{id:"filter0_f_251_38441",x:0,y:0,width:208,height:208,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),g.createElement("feGaussianBlur",{stdDeviation:24,result:"effect1_foregroundBlur_251_38441"})),g.createElement("filter",{id:"filter1_d_251_38441",x:54.8569,y:58.8571,width:98.2856,height:98.2857,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},g.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),g.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),g.createElement("feOffset",{dy:4}),g.createElement("feGaussianBlur",{stdDeviation:2}),g.createElement("feComposite",{in2:"hardAlpha",operator:"out"}),g.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"}),g.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_251_38441"}),g.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect1_dropShadow_251_38441",result:"shape"})),g.createElement("linearGradient",{id:"paint0_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint1_linear_251_38441",x1:119.671,y1:119.671,x2:87.9755,y2:87.9758,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("linearGradient",{id:"paint2_linear_251_38441",x1:118.653,y1:118.653,x2:89.0159,y2:89.0164,gradientUnits:"userSpaceOnUse"},g.createElement("stop",{stopColor:"#7135FF"}),g.createElement("stop",{offset:.27204,stopColor:"#A050E4"}),g.createElement("stop",{offset:.364594,stopColor:"#B85ED7"}),g.createElement("stop",{offset:.546546,stopColor:"#CF6CC9"}),g.createElement("stop",{offset:.732127,stopColor:"#EE609C"}),g.createElement("stop",{offset:.85586,stopColor:"#EB61A0"}),g.createElement("stop",{offset:1,stopColor:"#EE609C"})),g.createElement("clipPath",{id:"clip0_251_38441"},g.createElement("rect",{width:27.4286,height:27.4286,fill:"white",transform:"translate(93.7139 90.2849)"})))),Z5e=g.lazy(()=>r4(()=>import("./index-kkqkQ_HF.js"),__vite__mapDeps([13,5,1,6])));function FVo({src:e,autoPlay:t=!0,config:r,controls:n=!0,height:a="100%",isModalOpen:l,loop:c=!1,muted:d=!1,showPlayButton:p=!1,style:u,thumbnail:h,width:m="100%",onEnded:f,onModalClose:x,onPlay:y}){const b=je(),[w,v]=g.useState(!1);g.useEffect(()=>{l===!0&&t?v(!0):l===!1&&v(!1)},[l,t]);const A={};r?.youtube&&(A.youtube=r.youtube);const S=()=>{v(!0),y?.()},E=()=>{v(!1),x?.()},I=()=>{v(!1),f?.(),l!=null&&x?.()},L=()=>{v(!0),y?.()};return l!=null?l?Fn.createPortal(s.jsx(VVo,{windowSize:b,role:"presentation",children:s.jsx(cr,{onClickAway:E,children:s.jsx(QVo,{windowSize:b,"data-testid":"video-player-modal",children:s.jsxs(UVo,{children:[p&&!w&&s.jsxs(s.Fragment,{children:[h!=null&&h!==""&&s.jsx(_Vo,{src:h,alt:"Video thumbnail"}),s.jsx(NVo,{onClick:S,children:s.jsx(HVo,{windowSize:b})})]}),(!p||w)&&s.jsx(g.Suspense,{fallback:s.jsx("div",{style:{width:"100%",height:"100%"}}),children:s.jsx(Z5e,{src:e,playing:w,controls:n,muted:d,loop:c,width:"100%",height:"100%",onEnded:I,onPlay:L,config:A})})]})})})}),document.body):null:s.jsx(g.Suspense,{fallback:s.jsx("div",{style:{width:m,height:a,...u}}),children:s.jsx(Z5e,{src:e,playing:w,controls:n,muted:d,loop:c,width:m,height:a,style:u,light:p&&!w?h??!0:!1,onEnded:I,onPlay:L,config:A})})}const OVo=_t`
|
|
23903
23903
|
0% {
|
|
23904
23904
|
transform: rotate(0deg);
|
|
23905
23905
|
}
|
|
@@ -96884,7 +96884,7 @@ ${e}`,dci=e=>g.createElement("svg",{width:38,height:39,viewBox:"0 0 38 39",fill:
|
|
|
96884
96884
|
`,fvi=i(VX)`
|
|
96885
96885
|
color: ${e=>e.theme.colors.alert};
|
|
96886
96886
|
margin-top: ${o.sp2};
|
|
96887
|
-
`;var xvi=oet();const Lw=eZ(xvi);class yvi{getSignedInUser(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null)return this.readEncryptedJSON(this.ZENI_SIGNED_IN_USER,t)}getShowNegativeAmountInParenthesis(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);return t==null?!1:this.readEncryptedJSON(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,t)??!1}getShowNegativeAmountInParenthesisPDF(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);return t==null?!0:this.readEncryptedJSON(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,t)??!0}getSignedInUserTenant(t){return this.getSignedInUserTenants()?.find(r=>r.tenantEmailDomain===t)}getSignedInUserTenantWithId(t){return this.getSignedInUserTenants()?.find(r=>r.tenantId===t)}getForceRefreshedComponents(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);return t==null?[]:this.readEncryptedJSON(this.ZENI_FORCE_REFRESHED_COMPONENTS,t)??[]}saveForceRefreshedComponents(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null?window.localStorage.setItem(this.ZENI_FORCE_REFRESHED_COMPONENTS,this.encrypt(JSON.stringify(t),r)):console.warn("Can't update the force refreshed components when the user is logged out!")}saveSignedInUserWithSession(t,r){if(t==null||r==null)throw new Error("Can't accept nil for user or session Id");window.localStorage.getItem(this.ZENI_SESSION_ID)!==r&&this.clearSessionKeyedEntries(),window.localStorage.setItem(this.ZENI_SESSION_ID,r),window.localStorage.setItem(this.ZENI_SIGNED_IN_USER,this.encrypt(JSON.stringify(t),r))}saveSignedInUserTenants(t,r){const n=r??window.localStorage.getItem(this.ZENI_SESSION_ID);n!=null?window.localStorage.setItem(this.ZENI_SIGNED_IN_USER_TENANTS,this.encrypt(JSON.stringify(t),n)):console.warn("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesis(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesisPDF(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}isSignedIn(){return[this.ZENI_SESSION_ID,this.ZENI_SIGNED_IN_USER].map(r=>window.localStorage.getItem(r)!=null).reduce((r,n)=>r&&n)}clearAll(){this.ALL_IDs.forEach(t=>window.localStorage.removeItem(t))}setTheme(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null&&window.localStorage.setItem(this.ZENI_THEME,this.encrypt(t,r))}getTheme(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t==null)return;const r=this.readEncryptedString(this.ZENI_THEME,t);if(r!=null){if(r!=="light"&&r!=="dark"){window.localStorage.removeItem(this.ZENI_THEME);return}return r}}encrypt(t,r){return Lw.AES.encrypt(t,r).toString()}decrypt(t,r){try{const n=Lw.AES.decrypt(t,r).toString(Lw.enc.Utf8);return n===""?void 0:n}catch{return}}readEncryptedString(t,r){const n=window.localStorage.getItem(t);if(n==null)return;const a=this.decrypt(n,r);return a==null&&window.localStorage.removeItem(t),a}readEncryptedJSON(t,r){const n=this.readEncryptedString(t,r);if(n!=null)try{const a=JSON.parse(n);if(a===null){window.localStorage.removeItem(t);return}return a}catch{window.localStorage.removeItem(t);return}}getSignedInUserTenants(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null)return this.readEncryptedJSON(this.ZENI_SIGNED_IN_USER_TENANTS,t)}clearSessionKeyedEntries(){this.SESSION_KEYED_IDs.forEach(t=>window.localStorage.removeItem(t))}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";SESSION_KEYED_IDs=[this.ZENI_SIGNED_IN_USER_TENANTS,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.ZENI_THEME,this.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 Cs=new yvi,bvi=({children:e})=>{const t=qXe("(prefers-color-scheme: dark)"),[r,n]=$.useState({dark:t});g.useEffect(()=>{const p=Cs.getTheme()==null?t:Cs.getTheme()==="dark";r.dark!==p&&n({dark:p})},[r,t]);const a=()=>{const p=!r.dark;Cs.setTheme(p?"dark":"light"),n({...r,dark:p})},l=r.dark?jMo():IMo(),c=typeof window<"u"?window.__NONCE__:void 0,d=c!=null&&c.length>0?c:void 0;return Co.jsx(U$o,{dark:r.dark,webAppTheme:l,toggle:a,nonce:d,children:e})},wvi=["sandbox","production"],vvi=e=>X4(e,wvi),Cvi=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"}},Avi=["development","staging","production"],$vi=e=>X4(e,Avi),kvi=e=>{switch(e){case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"staging";case"PROD":case"NEXT":return"production";default:return"development"}},Svi=["DEV","QA","PUNE","SUNNYVALE","DELHI","MOHALI","PROD","NEXT"],Evi=e=>X4(e,Svi),o1=Evi("QA"),Pv=()=>o1==="DEV"||o1==="QA"||o1==="PUNE"||o1==="SUNNYVALE"||o1==="DELHI"||o1==="MOHALI",ere="https://zeni-webapp-qa.uc.r.appspot.com",Lvi="ed1936cb971f6aad4104ddbe708f812c",Ufn=vvi(Cvi(o1)),Ivi=$vi(kvi(o1));function jvi(e,t){return Lw.AES.decrypt(e,t).toString(Lw.enc.Utf8)}const Mvi="ZENI-WEB-APP-",CZe=o1==="DEV"||o1==="QA"?.2:.8,Sa={sentryDsn:"",sentryTraceSamplingRate:CZe,googleClientId:"",googleMapsAPIKey:"",microsoftClientId:"",mixpanelToken:"",pusherClientSecret:"",pusherCluster:"",quickbooksKey:"",appUrl:"",featureClientSecret:"",featureClientSecretCockpit:"",cardVaultId:"",stripeKey:"",qboRedirectionUrl:"",mixpanelUrl:"",mixpanelHMUrl:""};let J4,tre;function Bvi(e){Sa.sentryDsn=e.keys.SENTRY_DSN,Sa.sentryTraceSamplingRate=e.keys.SENTRY_TRACE_SAMPLE_RATES!=null?parseInt(e.keys.SENTRY_TRACE_SAMPLE_RATES):CZe,Sa.googleClientId=e.keys.GOOGLE_CLIENT_ID,Sa.googleMapsAPIKey=e.keys.GOOGLE_MAP_KEY,Sa.microsoftClientId=e.keys.MICROSOFT_CLIENT_ID,Sa.mixpanelToken=e.keys.MIXPANEL_TOKEN,Sa.pusherClientSecret=e.keys.PUSHER_CLIENT_SECRET,Sa.pusherCluster=e.keys.PUSHER_CLUSTER,Sa.quickbooksKey=e.keys.QUICKBOOK_TOKEN,Sa.appUrl=e.keys.WEB_ENDPOINT,Sa.featureClientSecret=e.keys.STATSIG_CLIENT_SECRET,Sa.featureClientSecretCockpit=e.keys.STATSIG_CLIENT_SECRET_COCKPIT,Sa.cardVaultId=e.keys.UNIT_VAULT_ID,Sa.stripeKey=e.keys.STRIPE_KEY,Sa.qboRedirectionUrl=e.keys.QBO_URL,Sa.mixpanelUrl=e.keys.MIXPANEL_URL,Sa.mixpanelHMUrl=e.keys.MIXPANEL_HM_URL,tre=e.externalEndPoints,J4=e.apiEndPoints,Pvi()}function Pvi(){try{const e=new Set;if(J4!=null){for(const t of Object.values(J4))if(typeof t=="string"&&t.startsWith("http"))try{e.add(new URL(t).origin)}catch{}}for(const t of e){const r=document.createElement("link");r.rel="preconnect",r.href=t,r.crossOrigin="anonymous",document.head.appendChild(r)}}catch{}}async function Dvi(){const t=encodeURIComponent(JSON.stringify({environment:o1}));try{const r=await fetch(`${ere}/api/keys?query=${t}`);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){return console.error("Error fetching details:",r),null}}let A$e=!1;function Kb(){A$e||(Yu.init(Lvi,{api_host:tre.mixpanelBaseUrl,ignore_dnt:!0,store_google:!1,track_marketing:!1}),A$e=!0)}let $$e=!1,k$e=!1;function AZe(){if($$e)return;$$e=!0,Kb();const e=pl.extractUtmParamsFromUrl();Object.keys(e).length>0&&Yu.register(e),Pv()&&console.log(`[UTM] first-touch bootstrap: ${JSON.stringify(e)}`)}function Tvi(){return Yu?.persistence?.props??null}const zvi=new Set(["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"]);function Rvi(){const e=Tvi();if(e==null)return;const t=Object.keys(e).filter(r=>r.startsWith("utm_")||zvi.has(r));for(const r of t)Yu.unregister(r);Pv()&&t.length>0&&console.log(`[UTM] cleared from cookie: ${JSON.stringify(t)}`)}function Fvi(){k$e||(k$e=!0,Rvi())}class t4{identify(t,r){if(Kb(),this.#o=t,t!=null&&r!=null&&(t4.#t==null||PXe({userId:t,traits:r},t4.#t)!==!0)){const{$email:n,...a}={...r};Yu.identify(t),n&&n!=null&&Yu.people.set_once({$email:n}),Yu.people.set(a),t4.#t={userId:t,traits:r},Pv()&&console.log(`*** Called people set with userId ${t} traits ${JSON.stringify(r)} `)}}identifyUserAndCompany(t,r,n,a,l){throw Error("Use identify in the web-app!!")}track(t,r){if(Kb(),this.#o==null){console.error("user is not identified :(, so can not fire event");return}AZe();const n={distinct_id:this.#o,...r};Yu.track(t,n),Fvi(),Pv()&&console.log(`*** firing ${t} with props ${JSON.stringify(r)}`)}alias(t,r){Kb(),Yu.alias(t,r)}reset(){Kb(),Yu.reset(),this.#o=void 0,t4.#t=void 0}static get analytics(){return this.#e}static#e=new pl.Analytics(new t4);static#t;#o}const Vm=t4.analytics;function Ovi(){AZe()}const Nvi=()=>{const e=gj(),t=yh(r=>r.companyState);if(e.pathname.includes("/management/parent/")){const r=e.pathname.split("/")[3],n=t.companiesById[r];if(n!=null)return`${n.companyInfo.name} ${W.getLocalizedStrings().cockpit.cockpitHeaderSubsidiaryText}`}if(e.pathname.includes("management/month-end-report/company/")){const r=e.pathname.split("/")[4],n=t.companiesById[r];if(n!=null)return n.companyInfo.name}},S$e=e=>{switch(e){case"healthMonitor":return"health-monitor";case"taskManager":return"task-manager";case"aiAccountant":return"ai-accountant";case"creditAgent":return"credit-agent";default:return e}},Wfn=e=>{switch(e){case"healthMonitor":return"health monitor";case"taskManager":return"task manager";case"aiAccountant":return"ai accountant";case"creditAgent":return"credit agent";default:return e}};function Hvi(e,t){return{updateDownloadStateHandler:r=>{e(DXe(r))},onZeniLogoClick:()=>{t.themeState.toggle()},onLogOutClick:()=>{e(VW()),e(QW(!1)),Cs.clearAll();const r=t.locationHook.state?.origin??"/";t.navigate(r,{replace:!0})},onNewCustomerClick:()=>{t.navigate("/onboarding/new"),Vm?.trackOnboardingNewCustomerStarted()},onThreadClick:(r,n,a)=>{const l=r.entityType.split(".");if(l.length===2){const c=CCe(l[0]);if(c!=null){const d=S$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in thread: ${l[0]}`)}},onNotificationClick:(r,n,a)=>{const l=r.entityType.split(".");if(r.isGlobalComment&&l.length===2){const c=CCe(l[0]);if(c!=null){const d=S$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in notification: ${l[0]}`)}}}}function _vi(e,t){const{signedInUser:r,cockpitHeader:n}=t,a=e.tenantState.currentTenantId,c=bj(e)?.companyName??"",d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:a??""};return{signedInUser:r,cockpitHeader:n,downloadState:e.companyViewState.downloadState,downloadParams:{currentTenantCompanyName:c,cockpitEndPoint:`${ere}/cockpitTabs`,authParams:d}}}const Vvi=LJe(_vi,Hvi)(sni);function Qvi(){const e=zNe(),t=Cs.getSignedInUser(),r=tZ(),n=gj(),a=Nvi(),l=yh(p=>TXe(p)),c={tabsFileType:"excel",tabs:["management","subscription","portfolio","onboarding","healthMonitor"],filterByTabs:l.filterByTabs,timezone:zXe()},d=n.pathname.split("/")[1];return Co.jsx(Vvi,{locationHook:n,themeState:e,signedInUser:t,cockpitHeader:a,allTabsViews:l,defaultOptions:c,analytics:Vm,currentTab:d,navigate:r})}const Uvi=["/management/*","/subscription/*","/onboarding/*","/portfolio/*","/audit/*","/health-monitor/*","/task-manager/*","/ai-accountant/*","/credit-agent/*"];function Wvi({appContent:e}){const t=Uvi.filter(r=>IJe(r)).length===0;return Co.jsxs(Co.Fragment,{children:[t?null:Co.jsx(Qvi,{}),Co.jsx(Co.Fragment,{children:e})]})}const Gvi="cockpit",$Ze="init-enter";function Yvi({location:e,visitedUrl:t}){const{pathname:r}=e;return g.useLayoutEffect(()=>{const n=t.get(r||$Ze);E$e(n!==void 0?n:0)}),null}const Kvi=g.memo(Yvi,(e,t)=>{const{location:r,visitedUrl:n}=e,{location:a}=t,l=r.pathname||$Ze,c=qvi();return n.set(l,c),!((a.pathname!==r.pathname||a.search!==r.search)&&a.hash==="")}),E$e=(e=0)=>window.requestAnimationFrame(()=>{window.scrollTo(0,e)}),qvi=()=>{let e=0;return document!=null&&document.documentElement!==null&&(e=document.documentElement.scrollTop),window.pageYOffset||e},kZe=e=>g.lazy(async()=>{const t=e.toString(),r=Cs.getForceRefreshedComponents(),n=new Set(r),a=n.has(t);try{const l=await e();return n.delete(t),Cs.saveForceRefreshedComponents(Array.from(n)),l}catch(l){throw a||(n.add(t),Cs.saveForceRefreshedComponents(Array.from(n)),location.reload()),l}}),Zvi=kZe(()=>r4(()=>import("./ScreenRoutes-DvICZao1.js").then(e=>e.S),__vite__mapDeps([14,5,1,6,15,8,16,17,7,2,4,9,11]))),Jvi=kZe(()=>r4(()=>import("./SignInScreen-DgiQ6lLS.js"),__vite__mapDeps([18,15,1,6,8,5,16,17,19,20,21,7])));function Xvi(){const e=g.useRef();e.current==null&&(e.current=new Map);const t=tZ(),r=gj();return g.useEffect(()=>{Ovi()},[]),g.useEffect(()=>{const n="signin/auth";Cs.isSignedIn()===!1&&!r.pathname.includes(n)&&t(n,{replace:!0,state:{...r.state,message:"...",origin:r.pathname}})}),Co.jsxs(oCi,{children:[Co.jsx(Kvi,{visitedUrl:e.current,location:r}),Co.jsx(eCi,{})]})}const eCi=()=>{const e=Cs.isSignedIn(),t=Cs.getSignedInUser(),r=e&&O$e(t),n=yh(p=>bj(p)),a={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:n.tenantId??""},l=yh(p=>RXe(p)),d=yh(p=>FXe(p)).map(p=>({companyId:p.companyId,tenantId:p.tenantId,companyName:p.name}));return Co.jsx(tUr,{roomId:Gvi,authParams:a,users:l,companies:d,authUrlEndPoint:`${J4.tenantMicroServiceBaseUrl}/1.0/commenting/auth`,fetchZeniUsers:!1,commentingUsersUrlEndPoint:`${J4.tenantMicroServiceBaseUrl}/1.0/users/zeni-users`,autoConnect:r,withRoomProvider:!1,loggedInUser:t,withThreadsProvider:!0,filter:{application:"cockpit"},children:Co.jsx(tCi,{})})},tCi=()=>Co.jsx(g.Suspense,{fallback:Co.jsx(rCi,{children:Co.jsx(Ao,{size:"Large",start:!0})}),children:Co.jsxs(jJe,{children:[Co.jsx(mT,{path:"/",element:Co.jsx(MJe,{to:"management",replace:!0})}),Co.jsx(mT,{path:"/signin/auth",element:Co.jsx(Jvi,{})}),Co.jsx(mT,{path:"*",element:Co.jsx(Wvi,{appContent:Co.jsx(Zvi,{})})})]})}),oCi=eo("div")``,rCi=eo("div")`
|
|
96887
|
+
`;var xvi=oet();const Lw=eZ(xvi);class yvi{getSignedInUser(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null)return this.readEncryptedJSON(this.ZENI_SIGNED_IN_USER,t)}getShowNegativeAmountInParenthesis(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);return t==null?!1:this.readEncryptedJSON(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,t)??!1}getShowNegativeAmountInParenthesisPDF(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);return t==null?!0:this.readEncryptedJSON(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,t)??!0}getSignedInUserTenant(t){return this.getSignedInUserTenants()?.find(r=>r.tenantEmailDomain===t)}getSignedInUserTenantWithId(t){return this.getSignedInUserTenants()?.find(r=>r.tenantId===t)}getForceRefreshedComponents(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);return t==null?[]:this.readEncryptedJSON(this.ZENI_FORCE_REFRESHED_COMPONENTS,t)??[]}saveForceRefreshedComponents(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null?window.localStorage.setItem(this.ZENI_FORCE_REFRESHED_COMPONENTS,this.encrypt(JSON.stringify(t),r)):console.warn("Can't update the force refreshed components when the user is logged out!")}saveSignedInUserWithSession(t,r){if(t==null||r==null)throw new Error("Can't accept nil for user or session Id");window.localStorage.getItem(this.ZENI_SESSION_ID)!==r&&this.clearSessionKeyedEntries(),window.localStorage.setItem(this.ZENI_SESSION_ID,r),window.localStorage.setItem(this.ZENI_SIGNED_IN_USER,this.encrypt(JSON.stringify(t),r))}saveSignedInUserTenants(t,r){const n=r??window.localStorage.getItem(this.ZENI_SESSION_ID);n!=null?window.localStorage.setItem(this.ZENI_SIGNED_IN_USER_TENANTS,this.encrypt(JSON.stringify(t),n)):console.warn("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesis(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}saveShowNegativeAmountInParenthesisPDF(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);if(r!=null)window.localStorage.setItem(this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.encrypt(JSON.stringify(t),r));else throw new Error("Can't update the setting when the user is logged out!")}isSignedIn(){return[this.ZENI_SESSION_ID,this.ZENI_SIGNED_IN_USER].map(r=>window.localStorage.getItem(r)!=null).reduce((r,n)=>r&&n)}clearAll(){this.ALL_IDs.forEach(t=>window.localStorage.removeItem(t))}setTheme(t){const r=window.localStorage.getItem(this.ZENI_SESSION_ID);r!=null&&window.localStorage.setItem(this.ZENI_THEME,this.encrypt(t,r))}getTheme(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t==null)return;const r=this.readEncryptedString(this.ZENI_THEME,t);if(r!=null){if(r!=="light"&&r!=="dark"){window.localStorage.removeItem(this.ZENI_THEME);return}return r}}encrypt(t,r){return Lw.AES.encrypt(t,r).toString()}decrypt(t,r){try{const n=Lw.AES.decrypt(t,r).toString(Lw.enc.Utf8);return n===""?void 0:n}catch{return}}readEncryptedString(t,r){const n=window.localStorage.getItem(t);if(n==null)return;const a=this.decrypt(n,r);return a==null&&window.localStorage.removeItem(t),a}readEncryptedJSON(t,r){const n=this.readEncryptedString(t,r);if(n!=null)try{const a=JSON.parse(n);if(a===null){window.localStorage.removeItem(t);return}return a}catch{window.localStorage.removeItem(t);return}}getSignedInUserTenants(){const t=window.localStorage.getItem(this.ZENI_SESSION_ID);if(t!=null)return this.readEncryptedJSON(this.ZENI_SIGNED_IN_USER_TENANTS,t)}clearSessionKeyedEntries(){this.SESSION_KEYED_IDs.forEach(t=>window.localStorage.removeItem(t))}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";SESSION_KEYED_IDs=[this.ZENI_SIGNED_IN_USER_TENANTS,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS,this.ZENI_SHOW_NEGATIVE_AMOUNT_IN_PARENTHESIS_PDF,this.ZENI_THEME,this.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 Cs=new yvi,bvi=({children:e})=>{const t=qXe("(prefers-color-scheme: dark)"),[r,n]=$.useState({dark:t});g.useEffect(()=>{const p=Cs.getTheme()==null?t:Cs.getTheme()==="dark";r.dark!==p&&n({dark:p})},[r,t]);const a=()=>{const p=!r.dark;Cs.setTheme(p?"dark":"light"),n({...r,dark:p})},l=r.dark?jMo():IMo(),c=typeof window<"u"?window.__NONCE__:void 0,d=c!=null&&c.length>0?c:void 0;return Co.jsx(U$o,{dark:r.dark,webAppTheme:l,toggle:a,nonce:d,children:e})},wvi=["sandbox","production"],vvi=e=>X4(e,wvi),Cvi=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"}},Avi=["development","staging","production"],$vi=e=>X4(e,Avi),kvi=e=>{switch(e){case"QA":case"PUNE":case"SUNNYVALE":case"DELHI":case"MOHALI":return"staging";case"PROD":case"NEXT":return"production";default:return"development"}},Svi=["DEV","QA","PUNE","SUNNYVALE","DELHI","MOHALI","PROD","NEXT"],Evi=e=>X4(e,Svi),o1=Evi("DEV"),Pv=()=>o1==="DEV"||o1==="QA"||o1==="PUNE"||o1==="SUNNYVALE"||o1==="DELHI"||o1==="MOHALI",ere="https://zeni-webapp-dev.uc.r.appspot.com",Lvi="63d3a2406505a5737a2b4debdb513f20",Ufn=vvi(Cvi(o1)),Ivi=$vi(kvi(o1));function jvi(e,t){return Lw.AES.decrypt(e,t).toString(Lw.enc.Utf8)}const Mvi="ZENI-WEB-APP-",CZe=o1==="DEV"||o1==="QA"?.2:.8,Sa={sentryDsn:"",sentryTraceSamplingRate:CZe,googleClientId:"",googleMapsAPIKey:"",microsoftClientId:"",mixpanelToken:"",pusherClientSecret:"",pusherCluster:"",quickbooksKey:"",appUrl:"",featureClientSecret:"",featureClientSecretCockpit:"",cardVaultId:"",stripeKey:"",qboRedirectionUrl:"",mixpanelUrl:"",mixpanelHMUrl:""};let J4,tre;function Bvi(e){Sa.sentryDsn=e.keys.SENTRY_DSN,Sa.sentryTraceSamplingRate=e.keys.SENTRY_TRACE_SAMPLE_RATES!=null?parseInt(e.keys.SENTRY_TRACE_SAMPLE_RATES):CZe,Sa.googleClientId=e.keys.GOOGLE_CLIENT_ID,Sa.googleMapsAPIKey=e.keys.GOOGLE_MAP_KEY,Sa.microsoftClientId=e.keys.MICROSOFT_CLIENT_ID,Sa.mixpanelToken=e.keys.MIXPANEL_TOKEN,Sa.pusherClientSecret=e.keys.PUSHER_CLIENT_SECRET,Sa.pusherCluster=e.keys.PUSHER_CLUSTER,Sa.quickbooksKey=e.keys.QUICKBOOK_TOKEN,Sa.appUrl=e.keys.WEB_ENDPOINT,Sa.featureClientSecret=e.keys.STATSIG_CLIENT_SECRET,Sa.featureClientSecretCockpit=e.keys.STATSIG_CLIENT_SECRET_COCKPIT,Sa.cardVaultId=e.keys.UNIT_VAULT_ID,Sa.stripeKey=e.keys.STRIPE_KEY,Sa.qboRedirectionUrl=e.keys.QBO_URL,Sa.mixpanelUrl=e.keys.MIXPANEL_URL,Sa.mixpanelHMUrl=e.keys.MIXPANEL_HM_URL,tre=e.externalEndPoints,J4=e.apiEndPoints,Pvi()}function Pvi(){try{const e=new Set;if(J4!=null){for(const t of Object.values(J4))if(typeof t=="string"&&t.startsWith("http"))try{e.add(new URL(t).origin)}catch{}}for(const t of e){const r=document.createElement("link");r.rel="preconnect",r.href=t,r.crossOrigin="anonymous",document.head.appendChild(r)}}catch{}}async function Dvi(){const t=encodeURIComponent(JSON.stringify({environment:o1}));try{const r=await fetch(`${ere}/api/keys?query=${t}`);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){return console.error("Error fetching details:",r),null}}let A$e=!1;function Kb(){A$e||(Yu.init(Lvi,{api_host:tre.mixpanelBaseUrl,ignore_dnt:!0,store_google:!1,track_marketing:!1}),A$e=!0)}let $$e=!1,k$e=!1;function AZe(){if($$e)return;$$e=!0,Kb();const e=pl.extractUtmParamsFromUrl();Object.keys(e).length>0&&Yu.register(e),Pv()&&console.log(`[UTM] first-touch bootstrap: ${JSON.stringify(e)}`)}function Tvi(){return Yu?.persistence?.props??null}const zvi=new Set(["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"]);function Rvi(){const e=Tvi();if(e==null)return;const t=Object.keys(e).filter(r=>r.startsWith("utm_")||zvi.has(r));for(const r of t)Yu.unregister(r);Pv()&&t.length>0&&console.log(`[UTM] cleared from cookie: ${JSON.stringify(t)}`)}function Fvi(){k$e||(k$e=!0,Rvi())}class t4{identify(t,r){if(Kb(),this.#o=t,t!=null&&r!=null&&(t4.#t==null||PXe({userId:t,traits:r},t4.#t)!==!0)){const{$email:n,...a}={...r};Yu.identify(t),n&&n!=null&&Yu.people.set_once({$email:n}),Yu.people.set(a),t4.#t={userId:t,traits:r},Pv()&&console.log(`*** Called people set with userId ${t} traits ${JSON.stringify(r)} `)}}identifyUserAndCompany(t,r,n,a,l){throw Error("Use identify in the web-app!!")}track(t,r){if(Kb(),this.#o==null){console.error("user is not identified :(, so can not fire event");return}AZe();const n={distinct_id:this.#o,...r};Yu.track(t,n),Fvi(),Pv()&&console.log(`*** firing ${t} with props ${JSON.stringify(r)}`)}alias(t,r){Kb(),Yu.alias(t,r)}reset(){Kb(),Yu.reset(),this.#o=void 0,t4.#t=void 0}static get analytics(){return this.#e}static#e=new pl.Analytics(new t4);static#t;#o}const Vm=t4.analytics;function Ovi(){AZe()}const Nvi=()=>{const e=gj(),t=yh(r=>r.companyState);if(e.pathname.includes("/management/parent/")){const r=e.pathname.split("/")[3],n=t.companiesById[r];if(n!=null)return`${n.companyInfo.name} ${W.getLocalizedStrings().cockpit.cockpitHeaderSubsidiaryText}`}if(e.pathname.includes("management/month-end-report/company/")){const r=e.pathname.split("/")[4],n=t.companiesById[r];if(n!=null)return n.companyInfo.name}},S$e=e=>{switch(e){case"healthMonitor":return"health-monitor";case"taskManager":return"task-manager";case"aiAccountant":return"ai-accountant";case"creditAgent":return"credit-agent";default:return e}},Wfn=e=>{switch(e){case"healthMonitor":return"health monitor";case"taskManager":return"task manager";case"aiAccountant":return"ai accountant";case"creditAgent":return"credit agent";default:return e}};function Hvi(e,t){return{updateDownloadStateHandler:r=>{e(DXe(r))},onZeniLogoClick:()=>{t.themeState.toggle()},onLogOutClick:()=>{e(VW()),e(QW(!1)),Cs.clearAll();const r=t.locationHook.state?.origin??"/";t.navigate(r,{replace:!0})},onNewCustomerClick:()=>{t.navigate("/onboarding/new"),Vm?.trackOnboardingNewCustomerStarted()},onThreadClick:(r,n,a)=>{const l=r.entityType.split(".");if(l.length===2){const c=CCe(l[0]);if(c!=null){const d=S$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in thread: ${l[0]}`)}},onNotificationClick:(r,n,a)=>{const l=r.entityType.split(".");if(r.isGlobalComment&&l.length===2){const c=CCe(l[0]);if(c!=null){const d=S$e(c);t.navigate(`/${d}`),a(r,n)}else console.warn(`Invalid navigation target in notification: ${l[0]}`)}}}}function _vi(e,t){const{signedInUser:r,cockpitHeader:n}=t,a=e.tenantState.currentTenantId,c=bj(e)?.companyName??"",d={userId:r?.userId??"",sessionId:r?.zeniSessionId??"",tenantId:a??""};return{signedInUser:r,cockpitHeader:n,downloadState:e.companyViewState.downloadState,downloadParams:{currentTenantCompanyName:c,cockpitEndPoint:`${ere}/cockpitTabs`,authParams:d}}}const Vvi=LJe(_vi,Hvi)(sni);function Qvi(){const e=zNe(),t=Cs.getSignedInUser(),r=tZ(),n=gj(),a=Nvi(),l=yh(p=>TXe(p)),c={tabsFileType:"excel",tabs:["management","subscription","portfolio","onboarding","healthMonitor"],filterByTabs:l.filterByTabs,timezone:zXe()},d=n.pathname.split("/")[1];return Co.jsx(Vvi,{locationHook:n,themeState:e,signedInUser:t,cockpitHeader:a,allTabsViews:l,defaultOptions:c,analytics:Vm,currentTab:d,navigate:r})}const Uvi=["/management/*","/subscription/*","/onboarding/*","/portfolio/*","/audit/*","/health-monitor/*","/task-manager/*","/ai-accountant/*","/credit-agent/*"];function Wvi({appContent:e}){const t=Uvi.filter(r=>IJe(r)).length===0;return Co.jsxs(Co.Fragment,{children:[t?null:Co.jsx(Qvi,{}),Co.jsx(Co.Fragment,{children:e})]})}const Gvi="cockpit",$Ze="init-enter";function Yvi({location:e,visitedUrl:t}){const{pathname:r}=e;return g.useLayoutEffect(()=>{const n=t.get(r||$Ze);E$e(n!==void 0?n:0)}),null}const Kvi=g.memo(Yvi,(e,t)=>{const{location:r,visitedUrl:n}=e,{location:a}=t,l=r.pathname||$Ze,c=qvi();return n.set(l,c),!((a.pathname!==r.pathname||a.search!==r.search)&&a.hash==="")}),E$e=(e=0)=>window.requestAnimationFrame(()=>{window.scrollTo(0,e)}),qvi=()=>{let e=0;return document!=null&&document.documentElement!==null&&(e=document.documentElement.scrollTop),window.pageYOffset||e},kZe=e=>g.lazy(async()=>{const t=e.toString(),r=Cs.getForceRefreshedComponents(),n=new Set(r),a=n.has(t);try{const l=await e();return n.delete(t),Cs.saveForceRefreshedComponents(Array.from(n)),l}catch(l){throw a||(n.add(t),Cs.saveForceRefreshedComponents(Array.from(n)),location.reload()),l}}),Zvi=kZe(()=>r4(()=>import("./ScreenRoutes-CU1IwyhO.js").then(e=>e.S),__vite__mapDeps([14,5,1,6,15,8,16,17,7,2,4,9,11]))),Jvi=kZe(()=>r4(()=>import("./SignInScreen-BtppyXZC.js"),__vite__mapDeps([18,15,1,6,8,5,16,17,19,20,21,7])));function Xvi(){const e=g.useRef();e.current==null&&(e.current=new Map);const t=tZ(),r=gj();return g.useEffect(()=>{Ovi()},[]),g.useEffect(()=>{const n="signin/auth";Cs.isSignedIn()===!1&&!r.pathname.includes(n)&&t(n,{replace:!0,state:{...r.state,message:"...",origin:r.pathname}})}),Co.jsxs(oCi,{children:[Co.jsx(Kvi,{visitedUrl:e.current,location:r}),Co.jsx(eCi,{})]})}const eCi=()=>{const e=Cs.isSignedIn(),t=Cs.getSignedInUser(),r=e&&O$e(t),n=yh(p=>bj(p)),a={userId:t?.userId??"",sessionId:t?.zeniSessionId??"",tenantId:n.tenantId??""},l=yh(p=>RXe(p)),d=yh(p=>FXe(p)).map(p=>({companyId:p.companyId,tenantId:p.tenantId,companyName:p.name}));return Co.jsx(tUr,{roomId:Gvi,authParams:a,users:l,companies:d,authUrlEndPoint:`${J4.tenantMicroServiceBaseUrl}/1.0/commenting/auth`,fetchZeniUsers:!1,commentingUsersUrlEndPoint:`${J4.tenantMicroServiceBaseUrl}/1.0/users/zeni-users`,autoConnect:r,withRoomProvider:!1,loggedInUser:t,withThreadsProvider:!0,filter:{application:"cockpit"},children:Co.jsx(tCi,{})})},tCi=()=>Co.jsx(g.Suspense,{fallback:Co.jsx(rCi,{children:Co.jsx(Ao,{size:"Large",start:!0})}),children:Co.jsxs(jJe,{children:[Co.jsx(mT,{path:"/",element:Co.jsx(MJe,{to:"management",replace:!0})}),Co.jsx(mT,{path:"/signin/auth",element:Co.jsx(Jvi,{})}),Co.jsx(mT,{path:"*",element:Co.jsx(Wvi,{appContent:Co.jsx(Zvi,{})})})]})}),oCi=eo("div")``,rCi=eo("div")`
|
|
96888
96888
|
display: flex;
|
|
96889
96889
|
flex: 1 1 auto;
|
|
96890
96890
|
flex-direction: row;
|
|
@@ -96895,4 +96895,4 @@ ${e}`,dci=e=>g.createElement("svg",{width:38,height:39,viewBox:"0 0 38 39",fill:
|
|
|
96895
96895
|
background-color: ${e=>e.theme.colors.background};
|
|
96896
96896
|
`;function iCi(){W.updateAppLocaleID("en"),lCi();const e=cCi(),[t,r]=g.useState(!1),n=g.useCallback(l=>{l.data?.type==="UPDATE_READY"?r(!0):l.data?.type==="HIDE_UPDATE_POPUP"&&r(!1)},[]);g.useEffect(()=>("serviceWorker"in navigator&&(navigator.serviceWorker.addEventListener("message",n),navigator.serviceWorker.addEventListener("controllerchange",()=>{r(!1)})),()=>{navigator.serviceWorker.removeEventListener("message",n)}),[n]);const a=()=>{r(!1),window.location.reload()};return Co.jsx(bvi,{children:Co.jsx(BJe,{store:e,children:Co.jsx(h_t,{children:Co.jsxs(Rpo,{children:[t?Co.jsx(c7o,{onPrimaryClick:a}):null,Co.jsx(aCi,{})]})})})})}const hb=new OXe,nCi=()=>{const e=Cs.getSignedInUser(),t=yh(L=>bj(L)),r=yh(L=>VXe(L,t.companyId)),n=gj(),a=tZ(),l=PJe(),[c,d]=g.useState(null),p=CBr(e?.userId),u=t?.excludedResources?.fetchState=="Completed"?t.excludedResources.resources:[];g.useEffect(()=>()=>{l(Dre())},[]);const h=yh(L=>QXe(L)),m=t?.externalConnections?.accounting[0]?.connectionName,f=()=>{l(Dre())},x=g.useMemo(()=>UXe(t.userRole),[t.userRole]),y=yh(L=>L.companyViewState.zeniUsers),b=g.useMemo(()=>{const L=y.fetchState==="Error"&&WXe(y.error);return L&&console.warn("Auto-logout triggered due to invalid session"),L},[y.fetchState,y.error]),w=g.useMemo(()=>{const L=y.fetchState==="Error"&&GXe(y.error)===!0;return L&&console.warn("Page is not accessible, show 404"),L},[y.fetchState,y.error]),v=g.useRef(!1);g.useEffect(()=>(b&&!v.current&&(v.current=!0,A()),()=>{v.current=!1}),[b]),g.useEffect(()=>{w&&window.open("/page-not-found","_self")},[w]);const A=g.useCallback(()=>{d(null),hb.stop(),l(VW()),l(QW(!1)),Cs.clearAll();const L=n.state?.origin??"/";a(L,{replace:!0})},[l,d,n,a]),S=g.useCallback((L="manual")=>{L==="auto-logout"?pBo({idleTimeoutMinutes:p.idleTimeoutMinutes}):mBo(),d(null),hb.stop(),l(VW()),l(QW(!1)),Cs.clearAll(),window.location.href="/signin/auth"},[l,d,p.idleTimeoutMinutes]);g.useEffect(()=>{if(e?.zeniSessionId!=null)return hb.start({idleTimeoutMinutes:p.idleTimeoutMinutes,warningDurationSeconds:p.warningDurationSeconds,heartbeatIntervalMinutes:p.heartbeatIntervalMinutes,isAutoLogoutEnabled:p.isAutoLogoutEnabled},{onHeartbeat:()=>l(YXe()),onWarningStart:L=>{Vm.trackSessionTimeoutPopupShown(L),d(L)},onWarningTick:d,onAutoLogout:()=>{Vm.trackSessionTimeoutAutoLogout(),S("auto-logout")},onSessionExtended:()=>d(null)}),()=>hb.stop()},[e?.zeniSessionId,p.isAutoLogoutEnabled,p.idleTimeoutMinutes,p.warningDurationSeconds,p.heartbeatIntervalMinutes,l,S,d]);const E=g.useMemo(()=>Cs.getSignedInUser(),[]),I=g.useMemo(()=>({userId:E?.userId??"",sessionId:E?.zeniSessionId??"",tenantId:t.tenantId??""}),[E,t.tenantId]);return Co.jsxs(qpo,{globalInfo:{loggedInUser:e,loggedInUserRole:t?.userRole,excludedResources:u,loggedInUserRoleMap:x,currentTenant:t,connectionName:m,controllersList:r},children:[Co.jsx(Hpo,{toolkit:{analytics:Vm,sentry:JZe,authParams:I},children:Co.jsxs(Z1o,{endPoint:{url:ere},children:[Co.jsx(bCr,{isOnDashboard:!1,showSnackbar:h.isSnackbarOpen,snackbar:{message:h.message,messageType:h.messageType,onRemoveSnackbar:f,showStatusIcon:h.showStatusIcon}}),Co.jsx(Xvi,{})]})}),c!=null&&e!=null?Co.jsx(Uri,{secondsRemaining:c,onContinueSession:()=>{Vm.trackSessionTimeoutClicked("continue",c),hb.continueSession()},onSignOut:()=>{Vm.trackSessionTimeoutClicked("sign_out",c),S()}}):null]})},aCi=()=>{const e=Cs.isSignedIn(),r=yh(n=>bj(n)).companyId;return Co.jsx(r2o,{isUserSignedIn:e,featureGateCustomFields:{companyId:r},zeniFeatureConfig:{currentFeatureEnv:Ivi,featureClientSecret:Sa.featureClientSecretCockpit,providerEndPoint:tre.statsigBaseUrl},children:Co.jsx(nCi,{})})},sCi=qZe(iCi);function lCi(){console.log("Initialize any 3rd party libs!")}let OW=null;function cCi(){return OW===null&&(OW=dCi(),NXe().catch(e=>{console.error("Failed to load feature epics:",e),ZZe(e,{tags:{critical:"true",module:"epicManager"}}),alert(`The application failed to load required modules. Some features may not work correctly.
|
|
96897
96897
|
|
|
96898
|
-
Please refresh the page to try again.`)})),OW}function dCi(){console.warn(`initializing epic state with url ${JSON.stringify(J4)}`);const e=Cs.getSignedInUser(),t=HXe(J4,e?.userId,e?.zeniSessionId,void 0,Pv()),r=_Xe();return r.userId!=null&&Vm.identify(r.userId,{tenant_id:r.tenantId}),t}const L$e="zeni-chunk-reload-at",pCi=6e4,uCi=["Failed to fetch dynamically imported module","error loading dynamically imported module","Importing a module script failed"];function hCi(){window.addEventListener("vite:preloadError",e=>{const t=e;I$e(t.payload)&&t.preventDefault()}),window.addEventListener("unhandledrejection",e=>{mCi(e.reason)&&I$e(e.reason)})}function I$e(e){try{const t=Number(sessionStorage.getItem(L$e))||0;if(Date.now()-t<pCi)return!1;sessionStorage.setItem(L$e,String(Date.now()))}catch{return!1}return console.warn("[chunk-load] Stale chunk detected — hard-reloading:",e),window.location.reload(),!0}function mCi(e){const t=String(e?.message??e??"");return uCi.some(r=>t.includes(r))}const gCi=!!(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}$/)),fCi="
|
|
96898
|
+
Please refresh the page to try again.`)})),OW}function dCi(){console.warn(`initializing epic state with url ${JSON.stringify(J4)}`);const e=Cs.getSignedInUser(),t=HXe(J4,e?.userId,e?.zeniSessionId,void 0,Pv()),r=_Xe();return r.userId!=null&&Vm.identify(r.userId,{tenant_id:r.tenantId}),t}const L$e="zeni-chunk-reload-at",pCi=6e4,uCi=["Failed to fetch dynamically imported module","error loading dynamically imported module","Importing a module script failed"];function hCi(){window.addEventListener("vite:preloadError",e=>{const t=e;I$e(t.payload)&&t.preventDefault()}),window.addEventListener("unhandledrejection",e=>{mCi(e.reason)&&I$e(e.reason)})}function I$e(e){try{const t=Number(sessionStorage.getItem(L$e))||0;if(Date.now()-t<pCi)return!1;sessionStorage.setItem(L$e,String(Date.now()))}catch{return!1}return console.warn("[chunk-load] Stale chunk detected — hard-reloading:",e),window.location.reload(),!0}function mCi(e){const t=String(e?.message??e??"");return uCi.some(r=>t.includes(r))}const gCi=!!(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}$/)),fCi="DEV",xCi="https://zeni-webapp-dev.uc.r.appspot.com",j$e=`/service-worker.js?v=${Date.now()}&env=${fCi}&endpoint=${encodeURIComponent(xCi)}`;function yCi(e){if("serviceWorker"in navigator){if(new URL("https://dev.app.zeni.ai",window.location.href).origin!==window.location.origin)return;window.addEventListener("load",()=>{gCi?bCi(j$e):SZe(j$e)})}}function SZe(e,t){navigator.serviceWorker.register(e).then(r=>{r.onupdatefound=()=>{const n=r.installing;n!=null&&(n.onstatechange=()=>{n.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"}),r.waiting?.postMessage({type:"SKIP_WAITING"})):console.log("Content is cached for offline use."))})},r.waiting&&r.waiting.postMessage({type:"SKIP_WAITING"}),navigator.serviceWorker.addEventListener("controllerchange",()=>{console.log("New service worker activated."),r.active?.postMessage({type:"CLIENTS_CLAIM"})})}).catch(r=>{console.error("Error during service worker registration:",r)})}function bCi(e,t){fetch(e,{headers:{"Service-Worker":"script"}}).then(r=>{const n=r.headers.get("content-type");r.status===404||n!=null&&!n.includes("javascript")?navigator.serviceWorker.ready.then(a=>{a.unregister().then(()=>window.location.reload())}):SZe(e)}).catch(()=>{console.log("No internet connection found. App is running in offline mode.")})}const wCi=Cs.getSignedInUser(),vCi=wCi?.zeniSessionId;async function CCi(){try{const e=await Dvi(),t=jvi(e,Mvi+o1);Bvi(JSON.parse(t)),iet.createRoot(document.getElementById("root")).render(Co.jsx($.StrictMode,{children:Co.jsx(DJe,{basename:"/cockpit",children:Co.jsx(sCi,{})})})),ACi()}catch(e){console.error("Error initializing app:",e)}}function ACi(){const e=()=>{XZe({dsn:Sa.sentryDsn,integrations:[eJe(),tJe({maskAllText:!0,blockAllMedia:!0})],tracesSampleRate:Sa.sentryTraceSamplingRate,replaysSessionSampleRate:0,replaysOnErrorSampleRate:1,beforeSendTransaction(t){return t.breadcrumbs&&(t.breadcrumbs=t.breadcrumbs.filter(r=>r.category!=="console"?!0:(r.message??"").toLowerCase().includes("called people set")||Array.isArray(r.data?.arguments)&&r.data.arguments.some(a=>typeof a=="string"&&a.toLowerCase().includes("called people set"))?!1:(Array.isArray(r.data?.arguments)&&(r.data.arguments=r.data.arguments.map(a=>{if(typeof a=="string"&&a.includes("user_roles"))try{const l=a.match(/\{.*\}/s);if(l!==null){const c=JSON.parse(l[0]);if(c.user_roles!=null)return delete c.user_roles,a.replace(l[0],JSON.stringify(c))}}catch{}return a})),!0))),t}}),oJe("session-id",vCi)};typeof requestIdleCallback=="function"?requestIdleCallback(e):setTimeout(e,0)}hCi();CCi();yCi();export{Tfn as $,j as A,Ffn as B,zfn as C,QCi as D,lt as E,Rfn as F,W as G,Dfn as H,fqi as I,Ao as J,xqi as K,Hfn as L,Pfn as M,lRi as N,cRi as O,Vfn as P,Bfn as Q,kMi as R,Ofn as S,_fn as T,Mfn as U,Lfn as V,kZe as W,oUr as X,SMi as Y,dEi as Z,ere as _,Vm as a,Qfn as a0,S$e as b,Sfn as c,Sa as d,Fon as e,jfn as f,Wfn as g,r0 as h,je as i,o as j,QVi as k,PFe as l,Ifn as m,jFe as n,Nfn as o,C as p,Efn as q,Pzi as r,Ufn as s,kC as t,Ovi as u,$Mo as v,_5 as w,pl as x,Us as y,Cs as z};
|