@elizaos/client 1.5.9-alpha.6 → 1.5.9-alpha.7
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/{main-DalsdH59.js → main-BZDx41Zd.js} +3 -3
- package/dist/assets/{main-DalsdH59.js.map → main-BZDx41Zd.js.map} +1 -1
- package/dist/assets/main-BzlqGWE_.js +119 -0
- package/dist/assets/main-BzlqGWE_.js.map +1 -0
- package/dist/assets/{react-vendor-Bwu9diD_.js → react-vendor-CwIqSd9I.js} +78 -78
- package/dist/assets/{react-vendor-Bwu9diD_.js.map → react-vendor-CwIqSd9I.js.map} +1 -1
- package/dist/index.html +1 -1
- package/package.json +4 -4
- package/dist/assets/main-h2y7yKYF.js +0 -118
- package/dist/assets/main-h2y7yKYF.js.map +0 -1
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
var _3=Object.defineProperty;var o=(t,e)=>_3(t,"name",{value:e,configurable:!0});import{g as fu,j as k,S as Ks,r as V,R as nv,a as sv,T as av,P as ov,C as du,b as lv,X as Vr,O as hu,c as pu,D as mu,d as M3,e as S3,f as E3,h as A3,i as uv,k as k3,l as cv,m as N3,L as fv,n as dv,o as hv,p as C3,V as R3,G as I3,q as pv,I as O3,s as yn,t as T3,u as mv,v as P3,w as gv,x as j3,y as zs,z as L3,A as vv,B as bv,E as yv,F as wv,H as xv,J as Sr,K as D3,M as B3,N as z3,Q as F3,U as U3,W as H3,Y as V3,Z as Z3,_ as G3,$ as _v,a0 as Mv,a1 as Sv,a2 as Ev,a3 as Av,a4 as kv,a5 as Xr,a6 as Y3,a7 as Q3,a8 as Nv,a9 as K3,aa as Cv,ab as Ar,ac as bh,ad as Io,ae as Rv,af as Iv,ag as X3,ah as W3,ai as Ov,aj as Tv,ak as $3,al as J3,am as Pv,an as q3,ao as Kn,ap as bc,aq as Wi,ar as wi,as as Yp,at as rs,au as e4,av as hn,aw as wr,ax as br,ay as jv,az as Lv,aA as Dv,aB as Bv,aC as t4,aD as Fr,aE as gu,aF as r4,aG as i4,aH as n4,aI as yh,aJ as vu,aK as Ta,aL as is,aM as wn,aN as Qp,aO as s4,aP as wh,aQ as bu,aR as Ha,aS as a4,aT as Kp,aU as o4,aV as zv,aW as l4,aX as Fv,aY as Uv,aZ as Hv,a_ as Vv,a$ as Zv,b0 as u4,b1 as xh,b2 as xd,b3 as Gv,b4 as c4,b5 as Ll,b6 as Yv,b7 as Qv,b8 as f4,b9 as Xs,ba as Fs,bb as _h,bc as Oo,bd as Dl,be as d4,bf as Kv,bg as h4,bh as Mh,bi as Va,bj as Zr,bk as p4,bl as m4,bm as dn,bn as yc,bo as g4,bp as Pa,bq as Ss,br as v4,bs as b4,bt as y4,bu as w4,bv as x4,bw as _4,bx as M4,by as S4,bz as E4,bA as A4,bB as Xv,bC as Wv,bD as k4,bE as N4,bF as Xp,bG as C4,bH as R4,bI as I4,bJ as O4,bK as yu,bL as T4,bM as $v,bN as P4,bO as j4,bP as wc,bQ as Wp,bR as $p,bS as L4,bT as Sh,bU as D4,bV as B4,bW as z4,bX as F4,bY as U4,bZ as H4,b_ as V4,b$ as Z4,c0 as G4,c1 as Y4,c2 as Q4,c3 as $r,c4 as K4}from"./react-vendor-Bwu9diD_.js";import"./ui-vendor-B7JxFfFk.js";function Jv(t){var e,r,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(r=Jv(t[e]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}o(Jv,"r");function Eh(){for(var t,e,r=0,i="",s=arguments.length;r<s;r++)(t=arguments[r])&&(e=Jv(t))&&(i&&(i+=" "),i+=e);return i}o(Eh,"clsx");const Jp=o(t=>typeof t=="boolean"?`${t}`:t===0?"0":t,"falsyToString"),qp=Eh,sn=o((t,e)=>r=>{var i;if(e?.variants==null)return qp(t,r?.class,r?.className);const{variants:s,defaultVariants:f}=e,n=Object.keys(s).map(h=>{const m=r?.[h],l=f?.[h];if(m===null)return null;const w=Jp(m)||Jp(l);return s[h][w]}),v=r&&Object.entries(r).reduce((h,m)=>{let[l,w]=m;return w===void 0||(h[l]=w),h},{}),b=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((h,m)=>{let{class:l,className:w,...p}=m;return Object.entries(p).every(y=>{let[M,E]=y;return Array.isArray(E)?E.includes({...f,...v}[M]):{...f,...v}[M]===E})?[...h,l,w]:h},[]);return qp(t,n,b,r?.class,r?.className)},"cva"),Ns="user",Qo="client_chat",ja="client_group_chat",Za=512;var xl=(t=>(t.REQUIRED="required",t.OPTIONAL="optional",t))(xl||{});const bs={name:"required",username:"optional",system:"required","settings.voice.model":"optional",bio:"optional",topics:"optional",adjectives:"optional","style.all":"optional","style.chat":"optional","style.post":"optional"};var _l={exports:{}},X4=_l.exports,e0;function W4(){return e0||(e0=1,(function(t,e){(function(r,i){t.exports=i()})(X4,(function(){var r=1e3,i=6e4,s=36e5,f="millisecond",n="second",v="minute",b="hour",h="day",m="week",l="month",w="quarter",p="year",y="date",M="Invalid Date",E=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,I={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(u){var d=["th","st","nd","rd"],x=u%100;return"["+u+(d[(x-20)%10]||d[x]||d[0])+"]"},"ordinal")},T=o(function(u,d,x){var A=String(u);return!A||A.length>=d?u:""+Array(d+1-A.length).join(x)+u},"m"),P={s:T,z:o(function(u){var d=-u.utcOffset(),x=Math.abs(d),A=Math.floor(x/60),N=x%60;return(d<=0?"+":"-")+T(A,2,"0")+":"+T(N,2,"0")},"z"),m:o(function u(d,x){if(d.date()<x.date())return-u(x,d);var A=12*(x.year()-d.year())+(x.month()-d.month()),N=d.clone().add(A,l),S=x-N<0,c=d.clone().add(A+(S?-1:1),l);return+(-(A+(x-N)/(S?N-c:c-N))||0)},"t2"),a:o(function(u){return u<0?Math.ceil(u)||0:Math.floor(u)},"a"),p:o(function(u){return{M:l,y:p,w:m,d:h,D:y,h:b,m:v,s:n,ms:f,Q:w}[u]||String(u||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(u){return u===void 0},"u")},j="en",L={};L[j]=I;var U="$isDayjsObject",Z=o(function(u){return u instanceof a||!(!u||!u[U])},"S"),ne=o(function u(d,x,A){var N;if(!d)return j;if(typeof d=="string"){var S=d.toLowerCase();L[S]&&(N=S),x&&(L[S]=x,N=S);var c=d.split("-");if(!N&&c.length>1)return u(c[0])}else{var _=d.name;L[_]=d,N=_}return!A&&N&&(j=N),N||!A&&j},"t2"),F=o(function(u,d){if(Z(u))return u.clone();var x=typeof d=="object"?d:{};return x.date=u,x.args=arguments,new a(x)},"O"),Y=P;Y.l=ne,Y.i=Z,Y.w=function(u,d){return F(u,{locale:d.$L,utc:d.$u,x:d.$x,$offset:d.$offset})};var a=(function(){function u(x){this.$L=ne(x.locale,null,!0),this.parse(x),this.$x=this.$x||x.x||{},this[U]=!0}o(u,"M2");var d=u.prototype;return d.parse=function(x){this.$d=(function(A){var N=A.date,S=A.utc;if(N===null)return new Date(NaN);if(Y.u(N))return new Date;if(N instanceof Date)return new Date(N);if(typeof N=="string"&&!/Z$/i.test(N)){var c=N.match(E);if(c){var _=c[2]-1||0,C=(c[7]||"0").substring(0,3);return S?new Date(Date.UTC(c[1],_,c[3]||1,c[4]||0,c[5]||0,c[6]||0,C)):new Date(c[1],_,c[3]||1,c[4]||0,c[5]||0,c[6]||0,C)}}return new Date(N)})(x),this.init()},d.init=function(){var x=this.$d;this.$y=x.getFullYear(),this.$M=x.getMonth(),this.$D=x.getDate(),this.$W=x.getDay(),this.$H=x.getHours(),this.$m=x.getMinutes(),this.$s=x.getSeconds(),this.$ms=x.getMilliseconds()},d.$utils=function(){return Y},d.isValid=function(){return this.$d.toString()!==M},d.isSame=function(x,A){var N=F(x);return this.startOf(A)<=N&&N<=this.endOf(A)},d.isAfter=function(x,A){return F(x)<this.startOf(A)},d.isBefore=function(x,A){return this.endOf(A)<F(x)},d.$g=function(x,A,N){return Y.u(x)?this[A]:this.set(N,x)},d.unix=function(){return Math.floor(this.valueOf()/1e3)},d.valueOf=function(){return this.$d.getTime()},d.startOf=function(x,A){var N=this,S=!!Y.u(A)||A,c=Y.p(x),_=o(function($,q){var Ce=Y.w(N.$u?Date.UTC(N.$y,q,$):new Date(N.$y,q,$),N);return S?Ce:Ce.endOf(h)},"l2"),C=o(function($,q){return Y.w(N.toDate()[$].apply(N.toDate("s"),(S?[0,0,0,0]:[23,59,59,999]).slice(q)),N)},"$2"),O=this.$W,D=this.$M,B=this.$D,z="set"+(this.$u?"UTC":"");switch(c){case p:return S?_(1,0):_(31,11);case l:return S?_(1,D):_(0,D+1);case m:var G=this.$locale().weekStart||0,te=(O<G?O+7:O)-G;return _(S?B-te:B+(6-te),D);case h:case y:return C(z+"Hours",0);case b:return C(z+"Minutes",1);case v:return C(z+"Seconds",2);case n:return C(z+"Milliseconds",3);default:return this.clone()}},d.endOf=function(x){return this.startOf(x,!1)},d.$set=function(x,A){var N,S=Y.p(x),c="set"+(this.$u?"UTC":""),_=(N={},N[h]=c+"Date",N[y]=c+"Date",N[l]=c+"Month",N[p]=c+"FullYear",N[b]=c+"Hours",N[v]=c+"Minutes",N[n]=c+"Seconds",N[f]=c+"Milliseconds",N)[S],C=S===h?this.$D+(A-this.$W):A;if(S===l||S===p){var O=this.clone().set(y,1);O.$d[_](C),O.init(),this.$d=O.set(y,Math.min(this.$D,O.daysInMonth())).$d}else _&&this.$d[_](C);return this.init(),this},d.set=function(x,A){return this.clone().$set(x,A)},d.get=function(x){return this[Y.p(x)]()},d.add=function(x,A){var N,S=this;x=Number(x);var c=Y.p(A),_=o(function(D){var B=F(S);return Y.w(B.date(B.date()+Math.round(D*x)),S)},"y2");if(c===l)return this.set(l,this.$M+x);if(c===p)return this.set(p,this.$y+x);if(c===h)return _(1);if(c===m)return _(7);var C=(N={},N[v]=i,N[b]=s,N[n]=r,N)[c]||1,O=this.$d.getTime()+x*C;return Y.w(O,this)},d.subtract=function(x,A){return this.add(-1*x,A)},d.format=function(x){var A=this,N=this.$locale();if(!this.isValid())return N.invalidDate||M;var S=x||"YYYY-MM-DDTHH:mm:ssZ",c=Y.z(this),_=this.$H,C=this.$m,O=this.$M,D=N.weekdays,B=N.months,z=N.meridiem,G=o(function(q,Ce,fe,ae){return q&&(q[Ce]||q(A,S))||fe[Ce].slice(0,ae)},"h2"),te=o(function(q){return Y.s(_%12||12,q,"0")},"d2"),$=z||function(q,Ce,fe){var ae=q<12?"AM":"PM";return fe?ae.toLowerCase():ae};return S.replace(R,(function(q,Ce){return Ce||(function(fe){switch(fe){case"YY":return String(A.$y).slice(-2);case"YYYY":return Y.s(A.$y,4,"0");case"M":return O+1;case"MM":return Y.s(O+1,2,"0");case"MMM":return G(N.monthsShort,O,B,3);case"MMMM":return G(B,O);case"D":return A.$D;case"DD":return Y.s(A.$D,2,"0");case"d":return String(A.$W);case"dd":return G(N.weekdaysMin,A.$W,D,2);case"ddd":return G(N.weekdaysShort,A.$W,D,3);case"dddd":return D[A.$W];case"H":return String(_);case"HH":return Y.s(_,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return $(_,C,!0);case"A":return $(_,C,!1);case"m":return String(C);case"mm":return Y.s(C,2,"0");case"s":return String(A.$s);case"ss":return Y.s(A.$s,2,"0");case"SSS":return Y.s(A.$ms,3,"0");case"Z":return c}return null})(q)||c.replace(":","")}))},d.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},d.diff=function(x,A,N){var S,c=this,_=Y.p(A),C=F(x),O=(C.utcOffset()-this.utcOffset())*i,D=this-C,B=o(function(){return Y.m(c,C)},"D2");switch(_){case p:S=B()/12;break;case l:S=B();break;case w:S=B()/3;break;case m:S=(D-O)/6048e5;break;case h:S=(D-O)/864e5;break;case b:S=D/s;break;case v:S=D/i;break;case n:S=D/r;break;default:S=D}return N?S:Y.a(S)},d.daysInMonth=function(){return this.endOf(l).$D},d.$locale=function(){return L[this.$L]},d.locale=function(x,A){if(!x)return this.$L;var N=this.clone(),S=ne(x,A,!0);return S&&(N.$L=S),N},d.clone=function(){return Y.w(this.$d,this)},d.toDate=function(){return new Date(this.valueOf())},d.toJSON=function(){return this.isValid()?this.toISOString():null},d.toISOString=function(){return this.$d.toISOString()},d.toString=function(){return this.$d.toUTCString()},u})(),g=a.prototype;return F.prototype=g,[["$ms",f],["$s",n],["$m",v],["$H",b],["$W",h],["$M",l],["$y",p],["$D",y]].forEach((function(u){g[u[1]]=function(d){return this.$g(d,u[0],u[1])}})),F.extend=function(u,d){return u.$i||(u(d,a,F),u.$i=!0),F},F.locale=ne,F.isDayjs=Z,F.unix=function(u){return F(1e3*u)},F.en=L[j],F.Ls=L,F.p={},F}))})(_l)),_l.exports}o(W4,"requireDayjs_min");var $4=W4();const qv=fu($4);var Ml={exports:{}},J4=Ml.exports,t0;function q4(){return t0||(t0=1,(function(t,e){(function(r,i){t.exports=i()})(J4,(function(){var r={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(i,s,f){var n=s.prototype,v=n.format;f.en.formats=r,n.format=function(b){b===void 0&&(b="YYYY-MM-DDTHH:mm:ssZ");var h=this.$locale().formats,m=(function(l,w){return l.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(p,y,M){var E=M&&M.toUpperCase();return y||w[M]||r[M]||w[E].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(R,I,T){return I||T.slice(1)}))}))})(b,h===void 0?{}:h);return v.call(this,m)}}}))})(Ml)),Ml.exports}o(q4,"requireLocalizedFormat");var ew=q4();const tw=fu(ew),Ah="-",rw=o(t=>{const e=nw(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o(n=>{const v=n.split(Ah);return v[0]===""&&v.length!==1&&v.shift(),eb(v,e)||iw(n)},"getClassGroupId"),getConflictingClassGroupIds:o((n,v)=>{const b=r[n]||[];return v&&i[n]?[...b,...i[n]]:b},"getConflictingClassGroupIds")}},"createClassGroupUtils"),eb=o((t,e)=>{if(t.length===0)return e.classGroupId;const r=t[0],i=e.nextPart.get(r),s=i?eb(t.slice(1),i):void 0;if(s)return s;if(e.validators.length===0)return;const f=t.join(Ah);return e.validators.find(({validator:n})=>n(f))?.classGroupId},"getGroupRecursive"),r0=/^\[(.+)\]$/,iw=o(t=>{if(r0.test(t)){const e=r0.exec(t)[1],r=e?.substring(0,e.indexOf(":"));if(r)return"arbitrary.."+r}},"getGroupIdForArbitraryProperty"),nw=o(t=>{const{theme:e,prefix:r}=t,i={nextPart:new Map,validators:[]};return aw(Object.entries(t.classGroups),r).forEach(([f,n])=>{_d(n,i,f,e)}),i},"createClassMap"),_d=o((t,e,r,i)=>{t.forEach(s=>{if(typeof s=="string"){const f=s===""?e:i0(e,s);f.classGroupId=r;return}if(typeof s=="function"){if(sw(s)){_d(s(i),e,r,i);return}e.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([f,n])=>{_d(n,i0(e,f),r,i)})})},"processClassesRecursively"),i0=o((t,e)=>{let r=t;return e.split(Ah).forEach(i=>{r.nextPart.has(i)||r.nextPart.set(i,{nextPart:new Map,validators:[]}),r=r.nextPart.get(i)}),r},"getPart"),sw=o(t=>t.isThemeGetter,"isThemeGetter"),aw=o((t,e)=>e?t.map(([r,i])=>{const s=i.map(f=>typeof f=="string"?e+f:typeof f=="object"?Object.fromEntries(Object.entries(f).map(([n,v])=>[e+n,v])):f);return[r,s]}):t,"getPrefixedClassGroupEntries"),ow=o(t=>{if(t<1)return{get:o(()=>{},"get"),set:o(()=>{},"set")};let e=0,r=new Map,i=new Map;const s=o((f,n)=>{r.set(f,n),e++,e>t&&(e=0,i=r,r=new Map)},"update");return{get(f){let n=r.get(f);if(n!==void 0)return n;if((n=i.get(f))!==void 0)return s(f,n),n},set(f,n){r.has(f)?r.set(f,n):s(f,n)}}},"createLruCache"),tb="!",lw=o(t=>{const{separator:e,experimentalParseClassName:r}=t,i=e.length===1,s=e[0],f=e.length,n=o(v=>{const b=[];let h=0,m=0,l;for(let E=0;E<v.length;E++){let R=v[E];if(h===0){if(R===s&&(i||v.slice(E,E+f)===e)){b.push(v.slice(m,E)),m=E+f;continue}if(R==="/"){l=E;continue}}R==="["?h++:R==="]"&&h--}const w=b.length===0?v:v.substring(m),p=w.startsWith(tb),y=p?w.substring(1):w,M=l&&l>m?l-m:void 0;return{modifiers:b,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:M}},"parseClassName");return r?v=>r({className:v,parseClassName:n}):n},"createParseClassName"),uw=o(t=>{if(t.length<=1)return t;const e=[];let r=[];return t.forEach(i=>{i[0]==="["?(e.push(...r.sort(),i),r=[]):r.push(i)}),e.push(...r.sort()),e},"sortModifiers"),cw=o(t=>({cache:ow(t.cacheSize),parseClassName:lw(t),...rw(t)}),"createConfigUtils"),fw=/\s+/,dw=o((t,e)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s}=e,f=[],n=t.trim().split(fw);let v="";for(let b=n.length-1;b>=0;b-=1){const h=n[b],{modifiers:m,hasImportantModifier:l,baseClassName:w,maybePostfixModifierPosition:p}=r(h);let y=!!p,M=i(y?w.substring(0,p):w);if(!M){if(!y){v=h+(v.length>0?" "+v:v);continue}if(M=i(w),!M){v=h+(v.length>0?" "+v:v);continue}y=!1}const E=uw(m).join(":"),R=l?E+tb:E,I=R+M;if(f.includes(I))continue;f.push(I);const T=s(M,y);for(let P=0;P<T.length;++P){const j=T[P];f.push(R+j)}v=h+(v.length>0?" "+v:v)}return v},"mergeClassList");function hw(){let t=0,e,r,i="";for(;t<arguments.length;)(e=arguments[t++])&&(r=rb(e))&&(i&&(i+=" "),i+=r);return i}o(hw,"twJoin");const rb=o(t=>{if(typeof t=="string")return t;let e,r="";for(let i=0;i<t.length;i++)t[i]&&(e=rb(t[i]))&&(r&&(r+=" "),r+=e);return r},"toValue");function pw(t,...e){let r,i,s,f=n;function n(b){const h=e.reduce((m,l)=>l(m),t());return r=cw(h),i=r.cache.get,s=r.cache.set,f=v,v(b)}o(n,"initTailwindMerge");function v(b){const h=i(b);if(h)return h;const m=dw(b,r);return s(b,m),m}return o(v,"tailwindMerge"),o(function(){return f(hw.apply(null,arguments))},"callTailwindMerge")}o(pw,"createTailwindMerge");const $t=o(t=>{const e=o(r=>r[t]||[],"themeGetter");return e.isThemeGetter=!0,e},"fromTheme"),ib=/^\[(?:([a-z-]+):)?(.+)\]$/i,mw=/^\d+\/\d+$/,gw=new Set(["px","full","screen"]),vw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bw=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ww=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,xw=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Di=o(t=>Ts(t)||gw.has(t)||mw.test(t),"isLength"),on=o(t=>Ws(t,"length",Cw),"isArbitraryLength"),Ts=o(t=>!!t&&!Number.isNaN(Number(t)),"isNumber"),xc=o(t=>Ws(t,"number",Ts),"isArbitraryNumber"),aa=o(t=>!!t&&Number.isInteger(Number(t)),"isInteger"),_w=o(t=>t.endsWith("%")&&Ts(t.slice(0,-1)),"isPercent"),kt=o(t=>ib.test(t),"isArbitraryValue"),ln=o(t=>vw.test(t),"isTshirtSize"),Mw=new Set(["length","size","percentage"]),Sw=o(t=>Ws(t,Mw,nb),"isArbitrarySize"),Ew=o(t=>Ws(t,"position",nb),"isArbitraryPosition"),Aw=new Set(["image","url"]),kw=o(t=>Ws(t,Aw,Iw),"isArbitraryImage"),Nw=o(t=>Ws(t,"",Rw),"isArbitraryShadow"),oa=o(()=>!0,"isAny"),Ws=o((t,e,r)=>{const i=ib.exec(t);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):r(i[2]):!1},"getIsArbitraryValue"),Cw=o(t=>bw.test(t)&&!yw.test(t),"isLengthOnly"),nb=o(()=>!1,"isNever"),Rw=o(t=>ww.test(t),"isShadow"),Iw=o(t=>xw.test(t),"isImage"),Ow=o(()=>{const t=$t("colors"),e=$t("spacing"),r=$t("blur"),i=$t("brightness"),s=$t("borderColor"),f=$t("borderRadius"),n=$t("borderSpacing"),v=$t("borderWidth"),b=$t("contrast"),h=$t("grayscale"),m=$t("hueRotate"),l=$t("invert"),w=$t("gap"),p=$t("gradientColorStops"),y=$t("gradientColorStopPositions"),M=$t("inset"),E=$t("margin"),R=$t("opacity"),I=$t("padding"),T=$t("saturate"),P=$t("scale"),j=$t("sepia"),L=$t("skew"),U=$t("space"),Z=$t("translate"),ne=o(()=>["auto","contain","none"],"getOverscroll"),F=o(()=>["auto","hidden","clip","visible","scroll"],"getOverflow"),Y=o(()=>["auto",kt,e],"getSpacingWithAutoAndArbitrary"),a=o(()=>[kt,e],"getSpacingWithArbitrary"),g=o(()=>["",Di,on],"getLengthWithEmptyAndArbitrary"),u=o(()=>["auto",Ts,kt],"getNumberWithAutoAndArbitrary"),d=o(()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],"getPositions"),x=o(()=>["solid","dashed","dotted","double","none"],"getLineStyles"),A=o(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"getBlendModes"),N=o(()=>["start","end","center","between","around","evenly","stretch"],"getAlign"),S=o(()=>["","0",kt],"getZeroAndEmpty"),c=o(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"getBreaks"),_=o(()=>[Ts,kt],"getNumberAndArbitrary");return{cacheSize:500,separator:":",theme:{colors:[oa],spacing:[Di,on],blur:["none","",ln,kt],brightness:_(),borderColor:[t],borderRadius:["none","","full",ln,kt],borderSpacing:a(),borderWidth:g(),contrast:_(),grayscale:S(),hueRotate:_(),invert:S(),gap:a(),gradientColorStops:[t],gradientColorStopPositions:[_w,on],inset:Y(),margin:Y(),opacity:_(),padding:a(),saturate:_(),scale:_(),sepia:S(),skew:_(),space:a(),translate:a()},classGroups:{aspect:[{aspect:["auto","square","video",kt]}],container:["container"],columns:[{columns:[ln]}],"break-after":[{"break-after":c()}],"break-before":[{"break-before":c()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...d(),kt]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:ne()}],"overscroll-x":[{"overscroll-x":ne()}],"overscroll-y":[{"overscroll-y":ne()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[M]}],"inset-x":[{"inset-x":[M]}],"inset-y":[{"inset-y":[M]}],start:[{start:[M]}],end:[{end:[M]}],top:[{top:[M]}],right:[{right:[M]}],bottom:[{bottom:[M]}],left:[{left:[M]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",aa,kt]}],basis:[{basis:Y()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",kt]}],grow:[{grow:S()}],shrink:[{shrink:S()}],order:[{order:["first","last","none",aa,kt]}],"grid-cols":[{"grid-cols":[oa]}],"col-start-end":[{col:["auto",{span:["full",aa,kt]},kt]}],"col-start":[{"col-start":u()}],"col-end":[{"col-end":u()}],"grid-rows":[{"grid-rows":[oa]}],"row-start-end":[{row:["auto",{span:[aa,kt]},kt]}],"row-start":[{"row-start":u()}],"row-end":[{"row-end":u()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",kt]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...N()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...N(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...N(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[E]}],mx:[{mx:[E]}],my:[{my:[E]}],ms:[{ms:[E]}],me:[{me:[E]}],mt:[{mt:[E]}],mr:[{mr:[E]}],mb:[{mb:[E]}],ml:[{ml:[E]}],"space-x":[{"space-x":[U]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[U]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",kt,e]}],"min-w":[{"min-w":[kt,e,"min","max","fit"]}],"max-w":[{"max-w":[kt,e,"none","full","min","max","fit","prose",{screen:[ln]},ln]}],h:[{h:[kt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[kt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[kt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[kt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ln,on]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",xc]}],"font-family":[{font:[oa]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",kt]}],"line-clamp":[{"line-clamp":["none",Ts,xc]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Di,kt]}],"list-image":[{"list-image":["none",kt]}],"list-style-type":[{list:["none","disc","decimal",kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[R]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[R]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...x(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Di,on]}],"underline-offset":[{"underline-offset":["auto",Di,kt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:a()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[R]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...d(),Ew]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Sw]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},kw]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[f]}],"rounded-s":[{"rounded-s":[f]}],"rounded-e":[{"rounded-e":[f]}],"rounded-t":[{"rounded-t":[f]}],"rounded-r":[{"rounded-r":[f]}],"rounded-b":[{"rounded-b":[f]}],"rounded-l":[{"rounded-l":[f]}],"rounded-ss":[{"rounded-ss":[f]}],"rounded-se":[{"rounded-se":[f]}],"rounded-ee":[{"rounded-ee":[f]}],"rounded-es":[{"rounded-es":[f]}],"rounded-tl":[{"rounded-tl":[f]}],"rounded-tr":[{"rounded-tr":[f]}],"rounded-br":[{"rounded-br":[f]}],"rounded-bl":[{"rounded-bl":[f]}],"border-w":[{border:[v]}],"border-w-x":[{"border-x":[v]}],"border-w-y":[{"border-y":[v]}],"border-w-s":[{"border-s":[v]}],"border-w-e":[{"border-e":[v]}],"border-w-t":[{"border-t":[v]}],"border-w-r":[{"border-r":[v]}],"border-w-b":[{"border-b":[v]}],"border-w-l":[{"border-l":[v]}],"border-opacity":[{"border-opacity":[R]}],"border-style":[{border:[...x(),"hidden"]}],"divide-x":[{"divide-x":[v]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[v]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[R]}],"divide-style":[{divide:x()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...x()]}],"outline-offset":[{"outline-offset":[Di,kt]}],"outline-w":[{outline:[Di,on]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:g()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[R]}],"ring-offset-w":[{"ring-offset":[Di,on]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",ln,Nw]}],"shadow-color":[{shadow:[oa]}],opacity:[{opacity:[R]}],"mix-blend":[{"mix-blend":[...A(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":A()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[i]}],contrast:[{contrast:[b]}],"drop-shadow":[{"drop-shadow":["","none",ln,kt]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[m]}],invert:[{invert:[l]}],saturate:[{saturate:[T]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[b]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[m]}],"backdrop-invert":[{"backdrop-invert":[l]}],"backdrop-opacity":[{"backdrop-opacity":[R]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[n]}],"border-spacing-x":[{"border-spacing-x":[n]}],"border-spacing-y":[{"border-spacing-y":[n]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",kt]}],duration:[{duration:_()}],ease:[{ease:["linear","in","out","in-out",kt]}],delay:[{delay:_()}],animate:[{animate:["none","spin","ping","pulse","bounce",kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[aa,kt]}],"translate-x":[{"translate-x":[Z]}],"translate-y":[{"translate-y":[Z]}],"skew-x":[{"skew-x":[L]}],"skew-y":[{"skew-y":[L]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",kt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":a()}],"scroll-mx":[{"scroll-mx":a()}],"scroll-my":[{"scroll-my":a()}],"scroll-ms":[{"scroll-ms":a()}],"scroll-me":[{"scroll-me":a()}],"scroll-mt":[{"scroll-mt":a()}],"scroll-mr":[{"scroll-mr":a()}],"scroll-mb":[{"scroll-mb":a()}],"scroll-ml":[{"scroll-ml":a()}],"scroll-p":[{"scroll-p":a()}],"scroll-px":[{"scroll-px":a()}],"scroll-py":[{"scroll-py":a()}],"scroll-ps":[{"scroll-ps":a()}],"scroll-pe":[{"scroll-pe":a()}],"scroll-pt":[{"scroll-pt":a()}],"scroll-pr":[{"scroll-pr":a()}],"scroll-pb":[{"scroll-pb":a()}],"scroll-pl":[{"scroll-pl":a()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",kt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Di,on,xc]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},"getDefaultConfig"),Tw=pw(Ow);function He(...t){return Tw(Eh(t))}o(He,"cn$1");qv.extend(tw);const Xn=qv,ns=o(t=>t.substring(0,2),"formatAgentName");function en(){return URL.createObjectURL(new Blob).split("/").pop()}o(en,"randomUUID");function ss(){const t="elizaos-client-user-id",e=localStorage.getItem(t);if(e)return e;const r=en();return localStorage.setItem(t,r),r}o(ss,"getEntityId");const sb=o((t,e=Za,r=.8)=>new Promise((i,s)=>{const f=new FileReader;f.onload=n=>{if(n.target?.result){const v=new Image;v.src=n.target.result,v.onload=()=>{const b=document.createElement("canvas");let h=v.width,m=v.height;h>m?h>e&&(m*=e/h,h=e):m>e&&(h*=e/m,m=e),b.width=h,b.height=m,b.getContext("2d")?.drawImage(v,0,0,h,m);const w=b.toDataURL("image/jpeg",r);i(w)},v.onerror=s}},f.onerror=s,f.readAsDataURL(t)}),"compressImage"),n0=["/images/agents/agent1.png","/images/agents/agent2.png","/images/agents/agent3.png","/images/agents/agent4.png","/images/agents/agent5.png"],Ga=o(t=>{if(t?.settings?.avatar)return t.settings.avatar;if(t?.id){let e=0;for(let i=0;i<t.id.length;i++){const s=t.id.charCodeAt(i);e=(e<<5)-e+s,e|=0}const r=Math.abs(e)%n0.length;return n0[r]}return"/elizaos-icon.png"},"getAgentAvatar"),kh=o((t,e,r)=>{if(t?.name&&t.name.trim()!=="")return t.name;if(e&&e.length>0){const i=e.filter(s=>s.id!==r&&s.name);if(i.length===0&&e.some(s=>s.id===r&&s.name)){const s=e.find(f=>f.id===r);return s&&s.name||"Unnamed Group"}if(i.length>0)return i.map(s=>s.name).slice(0,3).join(", ")+(i.length>3?"...":"")}return"Unnamed Group"},"generateGroupName"),Nh=sn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",destructive:"bg-red-800 text-white shadow-xs hover:bg-red-600 focus-visible:ring-red-400/20 dark:focus-visible:ring-red-500",outline:"border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-auto w-auto"}},defaultVariants:{variant:"default",size:"default"}});function $e({className:t,variant:e,size:r,asChild:i=!1,...s}){const f=i?Ks:"button";return k.jsx(f,{"data-slot":"button",className:He(Nh({variant:e,size:r,className:t})),...s})}o($e,"Button");const hr=V.forwardRef(({className:t,type:e,...r},i)=>k.jsx("input",{type:e,className:He("flex h-12 w-full rounded border border-input bg-card px-4 py-3 text-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:i,"data-testid":r["data-testid"]||"input",...r}));hr.displayName="Input";const Gr=V.forwardRef(({className:t,orientation:e="horizontal",decorative:r=!0,...i},s)=>k.jsx(nv,{ref:s,decorative:r,orientation:e,className:He("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),"data-testid":i["data-testid"]||"separator",...i}));Gr.displayName=nv.displayName;const ab=sv,Pw=av,jw=ov,ob=V.forwardRef(({className:t,...e},r)=>k.jsx(hu,{className:He("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));ob.displayName=hu.displayName;const Lw=sn("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Ch=V.forwardRef(({side:t="right",className:e,children:r,...i},s)=>k.jsxs(jw,{children:[k.jsx(ob,{}),k.jsxs(du,{ref:s,className:He(Lw({side:t}),e),...i,children:[k.jsxs(lv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[k.jsx(Vr,{className:"h-4 w-4"}),k.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));Ch.displayName=du.displayName;const Dw=V.forwardRef(({className:t,...e},r)=>k.jsx(pu,{ref:r,className:He("text-lg font-semibold text-foreground",t),...e}));Dw.displayName=pu.displayName;const Bw=V.forwardRef(({className:t,...e},r)=>k.jsx(mu,{ref:r,className:He("text-sm text-muted-foreground",t),...e}));Bw.displayName=mu.displayName;function Ya({className:t,...e}){return k.jsx("div",{className:He("animate-pulse rounded-md bg-primary/10",t),"data-testid":e["data-testid"]||"skeleton",...e})}o(Ya,"Skeleton");const Ps=M3,cr=S3,fr=E3,or=V.forwardRef(({className:t,sideOffset:e=4,...r},i)=>k.jsx(A3,{children:k.jsx(uv,{ref:i,sideOffset:e,className:He("z-50 overflow-hidden select-none rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));or.displayName=uv.displayName;const _c=768;function zw(){const[t,e]=V.useState(void 0);return V.useEffect(()=>{const r=window.matchMedia(`(max-width: ${_c-1}px)`),i=o(()=>{e(window.innerWidth<_c)},"onChange");return r.addEventListener("change",i),e(window.innerWidth<_c),()=>r.removeEventListener("change",i)},[]),!!t}o(zw,"useIsMobile");const Fw="sidebar:state",Uw=3600*24*7,Hw="16rem",Vw="18rem",Zw="3rem",Gw="b",lb=V.createContext(null);function wu(){const t=V.useContext(lb);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}o(wu,"useSidebar");const ub=V.forwardRef(({defaultOpen:t=!0,open:e,onOpenChange:r,className:i,style:s,children:f,...n},v)=>{const b=zw(),[h,m]=V.useState(!1),[l,w]=V.useState(t),p=e??l,y=V.useCallback(I=>{const T=typeof I=="function"?I(p):I;r?r(T):w(T),document.cookie=`${Fw}=${T}; path=/; max-age=${Uw}`},[r,p]),M=V.useCallback(()=>b?m(I=>!I):y(I=>!I),[b,y,m]);V.useEffect(()=>{const I=o(T=>{T.key===Gw&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),M())},"handleKeyDown");return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[M]);const E=p?"expanded":"collapsed",R=V.useMemo(()=>({state:E,open:p,setOpen:y,isMobile:b,openMobile:h,setOpenMobile:m,toggleSidebar:M}),[E,p,y,b,h,m,M]);return k.jsx(lb.Provider,{value:R,children:k.jsx(Ps,{delayDuration:0,children:k.jsx("div",{style:{"--sidebar-width":Hw,"--sidebar-width-icon":Zw,...s},className:He("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-card",i),ref:v,...n,children:f})})})});ub.displayName="SidebarProvider";const cb=V.forwardRef(({side:t="left",variant:e="sidebar",collapsible:r="offcanvas",className:i,children:s,...f},n)=>{const{isMobile:v,state:b,openMobile:h,setOpenMobile:m}=wu();return r==="none"?k.jsx("div",{className:He("flex h-full w-[--sidebar-width] flex-col bg-card text-sidebar-foreground",i),ref:n,...f,children:s}):v?k.jsx(ab,{open:h,onOpenChange:m,...f,children:k.jsx(Ch,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-card p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":Vw},side:t,children:k.jsx("div",{className:"flex h-full w-full flex-col",children:s})})}):k.jsxs("div",{ref:n,className:"group peer hidden md:block text-sidebar-foreground","data-state":b,"data-collapsible":b==="collapsed"?r:"","data-variant":e,"data-side":t,children:[k.jsx("div",{className:He("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",e==="floating"||e==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),k.jsx("div",{className:He("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",e==="floating"||e==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...f,children:k.jsx("div",{"data-sidebar":"sidebar",className:"flex m-4 rounded-md w-full flex-col group-data-[variant=floating]:rounded-md group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:s})})]})});cb.displayName="Sidebar";const Yw=V.forwardRef(({className:t,onClick:e,...r},i)=>{const{toggleSidebar:s}=wu();return k.jsxs($e,{ref:i,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:He("h-7 w-7",t),onClick:o(f=>{e?.(f),s()},"onClick"),"data-testid":"sidebar-toggle",...r,children:[k.jsx(k3,{}),k.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Yw.displayName="SidebarTrigger";const Qw=V.forwardRef(({className:t,...e},r)=>{const{toggleSidebar:i}=wu();return k.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:i,title:"Toggle Sidebar",className:He("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-card-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-card","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",t),...e})});Qw.displayName="SidebarRail";const fb=V.forwardRef(({className:t,...e},r)=>k.jsx("main",{ref:r,className:He("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",t),...e}));fb.displayName="SidebarInset";const Kw=V.forwardRef(({className:t,...e},r)=>k.jsx(hr,{ref:r,"data-sidebar":"input",className:He("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",t),...e}));Kw.displayName="SidebarInput";const db=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,"data-sidebar":"header",className:He("flex flex-col gap-2 p-2",t),...e}));db.displayName="SidebarHeader";const hb=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,"data-sidebar":"footer",className:He("flex flex-col gap-2 p-2",t),...e}));hb.displayName="SidebarFooter";const Xw=V.forwardRef(({className:t,...e},r)=>k.jsx(Gr,{ref:r,"data-sidebar":"separator",className:He("mx-2 w-auto bg-card-border",t),...e}));Xw.displayName="SidebarSeparator";const pb=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,"data-sidebar":"content",className:He("flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden group-data-[collapsible=icon]:overflow-hidden",t),...e}));pb.displayName="SidebarContent";const xu=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,"data-sidebar":"group",className:He("relative flex w-full min-w-0 flex-col p-0.5",t),...e}));xu.displayName="SidebarGroup";const Ww=V.forwardRef(({className:t,asChild:e=!1,...r},i)=>{const s=e?Ks:"div";return k.jsx(s,{ref:i,"data-sidebar":"group-label",className:He("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...r})});Ww.displayName="SidebarGroupLabel";const $w=V.forwardRef(({className:t,asChild:e=!1,...r},i)=>{const s=e?Ks:"button";return k.jsx(s,{ref:i,"data-sidebar":"group-action",className:He("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-card-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",t),...r})});$w.displayName="SidebarGroupAction";const _u=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,"data-sidebar":"group-content",className:He("w-full text-sm p-0 m-0",t),...e}));_u.displayName="SidebarGroupContent";const Wn=V.forwardRef(({className:t,...e},r)=>k.jsx("ul",{ref:r,"data-sidebar":"menu",className:He("flex w-full min-w-0 flex-col gap-0.5",t),...e}));Wn.displayName="SidebarMenu";const ui=V.forwardRef(({className:t,...e},r)=>k.jsx("li",{ref:r,"data-sidebar":"menu-item",className:He("group/menu-item relative",t),...e}));ui.displayName="SidebarMenuItem";const Jw=sn("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),as=V.forwardRef(({asChild:t=!1,isActive:e=!1,variant:r="default",size:i="default",tooltip:s,className:f,...n},v)=>{const b=t?Ks:"button",{isMobile:h,state:m}=wu(),l=k.jsx(b,{ref:v,"data-sidebar":"menu-button","data-size":i,"data-active":e,className:He(Jw({variant:r,size:i}),f),...n});return s?(typeof s=="string"&&(s={children:s}),k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:l}),k.jsx(or,{side:"right",align:"center",hidden:m!=="collapsed"||h,...s})]})):l});as.displayName="SidebarMenuButton";const qw=V.forwardRef(({className:t,asChild:e=!1,showOnHover:r=!1,...i},s)=>{const f=e?Ks:"button";return k.jsx(f,{ref:s,"data-sidebar":"menu-action",className:He("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-card-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",t),...i})});qw.displayName="SidebarMenuAction";const ex=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:He("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",t),...e}));ex.displayName="SidebarMenuBadge";const Mu=V.forwardRef(({className:t,showIcon:e=!1,...r},i)=>{const s=V.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return k.jsxs("div",{ref:i,"data-sidebar":"menu-skeleton",className:He("rounded-md h-8 flex gap-2 px-2 items-center",t),...r,children:[e&&k.jsx(Ya,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),k.jsx(Ya,{className:"h-4 flex-1 max-w-[--skeleton-width]","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":s}})]})});Mu.displayName="SidebarMenuSkeleton";const tx=V.forwardRef(({className:t,...e},r)=>k.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:He("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",t),...e}));tx.displayName="SidebarMenuSub";const rx=V.forwardRef(({...t},e)=>k.jsx("li",{ref:e,...t}));rx.displayName="SidebarMenuSubItem";const ix=V.forwardRef(({asChild:t=!1,size:e="md",isActive:r,className:i,...s},f)=>{const n=t?Ks:"a";return k.jsx(n,{ref:f,"data-sidebar":"menu-sub-button","data-size":e,"data-active":r,className:He("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-card-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-card-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-card-accent data-[active=true]:text-sidebar-accent-foreground",e==="sm"&&"text-xs",e==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",i),...s})});ix.displayName="SidebarMenuSubButton";const nx=sn("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ii({className:t,variant:e,...r}){return k.jsx("div",{className:He(nx({variant:e}),t),"data-testid":r["data-testid"]||"badge",...r})}o(ii,"Badge");const sx=sn("text-sm font-normal text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),js=V.forwardRef(({className:t,...e},r)=>k.jsx(cv,{ref:r,className:He(sx(),t),...e}));js.displayName=cv.displayName;const ax=o(({tag:t,onRemove:e})=>k.jsxs(ii,{variant:"outline",className:"flex items-center gap-1.5 pr-1.5 text-sm py-1 px-2 transition-colors hover:bg-accent hover:text-accent-foreground",children:[t,k.jsxs($e,{type:"button",variant:"ghost",size:"icon",onClick:o(()=>e(t),"onClick"),className:"hover:bg-accent/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[k.jsx(Vr,{className:"h-3 w-3"}),k.jsxs("span",{className:"sr-only",children:["Remove ",t]})]})]}),"Tag"),ox=o(({tags:t,onRemove:e})=>k.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.map(r=>k.jsx(ax,{tag:r,onRemove:e},r))}),"TagList"),lx=o(({value:t,onChange:e,onKeyDown:r,onAdd:i})=>k.jsxs("div",{className:"relative",children:[k.jsx(hr,{value:t,onChange:e,onKeyDown:r,placeholder:"Type and press Enter or click Add...",className:He("bg-background pr-16",!t&&"text-muted-foreground")}),t.trim()&&k.jsx($e,{size:"sm",onClick:i,className:"absolute top-1/2 -translate-y-1/2 right-2 h-7 px-3",children:"Add"})]}),"TagInput");function ux({title:t,data:e,onChange:r}){const[i,s]=V.useState(""),f=o(()=>{const b=i.trim();b&&!e.includes(b)&&(r([...e,b]),s(""))},"addTag"),n=o(b=>{b.key==="Enter"&&(b.preventDefault(),f())},"handleKeyDown"),v=o(b=>{r(e.filter(h=>h!==b))},"removeTag");return k.jsxs("div",{className:"space-y-2",children:[k.jsx(js,{children:t}),k.jsxs("div",{className:"p-2 bg-card rounded border border-input",children:[k.jsx(ox,{tags:e,onRemove:v}),k.jsx(lx,{value:i,onChange:o(b=>s(b.target.value),"onChange"),onKeyDown:n,onAdd:f})]})]})}o(ux,"ArrayInput");const Rh=N3,Su=V.forwardRef(({className:t,...e},r)=>k.jsx(fv,{ref:r,className:He("inline-flex items-center bg-transparent border-b border-sidebar-border w-full",t),...e}));Su.displayName=fv.displayName;const Qa=V.forwardRef(({className:t,...e},r)=>k.jsx(dv,{ref:r,className:He("inline-flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium text-muted-foreground bg-transparent transition-all hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-foreground data-[state=active]:border-b-2 data-[state=active]:border-b-primary relative",t),...e}));Qa.displayName=dv.displayName;const xi=V.forwardRef(({className:t,...e},r)=>k.jsx(hv,{ref:r,className:He("text-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));xi.displayName=hv.displayName;const To=V.forwardRef(({className:t,...e},r)=>k.jsx("textarea",{className:He("flex min-h-[120px] w-full rounded border border-input bg-card px-4 py-3 text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,"data-testid":e["data-testid"]||"textarea",...e}));To.displayName="Textarea";const cx=1,fx=3e3;let Mc=0;function dx(){return Mc=(Mc+1)%Number.MAX_SAFE_INTEGER,Mc.toString()}o(dx,"genId");const Sc=new Map,s0=o(t=>{if(Sc.has(t))return;const e=setTimeout(()=>{Sc.delete(t),za({type:"REMOVE_TOAST",toastId:t})},fx);Sc.set(t,e)},"addToRemoveQueue"),hx=o((t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,cx)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(r=>r.id===e.toast.id?{...r,...e.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=e;if(r)s0(r);else for(const i of t.toasts)s0(i.id);return{...t,toasts:t.toasts.map(i=>i.id===r||r===void 0?{...i,open:!1}:i)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(r=>r.id!==e.toastId)}}},"reducer"),Sl=[];let El={toasts:[]};function za(t){El=hx(El,t);for(const e of Sl)e(El)}o(za,"dispatch");function px({...t}){const e=dx(),r=o(s=>za({type:"UPDATE_TOAST",toast:{...s,id:e}}),"update"),i=o(()=>za({type:"DISMISS_TOAST",toastId:e}),"dismiss");return za({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:o(s=>{s||i()},"onOpenChange")}}),{id:e,dismiss:i,update:r}}o(px,"toast");function Wt(){const[t,e]=V.useState(El);return V.useEffect(()=>(Sl.push(e),()=>{const r=Sl.indexOf(e);r>-1&&Sl.splice(r,1)}),[]),{...t,toast:px,dismiss:o(r=>za({type:"DISMISS_TOAST",toastId:r}),"dismiss")}}o(Wt,"useToast");function mx(t){return t.replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}o(mx,"sanitizeFilename");function gx(t){const e={id:t.id,name:t.name,username:t.username,system:t.system,templates:t.templates,bio:t.bio,messageExamples:t.messageExamples,postExamples:t.postExamples,topics:t.topics,adjectives:t.adjectives,knowledge:t.knowledge,plugins:t.plugins,settings:t.settings?{...t.settings}:void 0,style:t.style};if(e.settings&&"secrets"in e.settings){const{secrets:r,...i}=e.settings;e.settings=i}return Object.fromEntries(Object.entries(e).filter(([r,i])=>i!=null))}o(gx,"agentToCharacterData");function vx(t){const e=new Date().toISOString().split("T")[0];return`${mx(t||"agent")}-${e}.json`}o(vx,"generateExportFilename");function bx(t,e){const r=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),i=URL.createObjectURL(r),s=document.createElement("a");s.href=i,s.download=e,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(i)}o(bx,"downloadJsonFile");function Ih(t,e){try{const r=gx(t),i=vx(t.name);return bx(r,i),e&&e({title:"Character Exported",description:`${t.name}'s character data has been downloaded as ${i}`}),{success:!0,filename:i}}catch(r){return console.error("Failed to export character:",r),e&&e({title:"Export Failed",description:"Failed to export character data. Please try again.",variant:"destructive"}),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}o(Ih,"exportCharacterAsJson");const $n=C3,Ec=I3,Jn=R3,mn=V.forwardRef(({className:t,children:e,...r},i)=>k.jsxs(pv,{ref:i,className:He("flex h-12 w-full items-center justify-between whitespace-nowrap rounded border border-input bg-card px-4 py-3 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...r,children:[e,k.jsx(O3,{asChild:!0,children:k.jsx(yn,{className:"h-4 w-4 opacity-50"})})]}));mn.displayName=pv.displayName;const mb=V.forwardRef(({className:t,...e},r)=>k.jsx(yv,{ref:r,className:He("flex cursor-default items-center justify-center py-1",t),...e,children:k.jsx(wv,{className:"h-4 w-4"})}));mb.displayName=yv.displayName;const gb=V.forwardRef(({className:t,...e},r)=>k.jsx(xv,{ref:r,className:He("flex cursor-default items-center justify-center py-1",t),...e,children:k.jsx(yn,{className:"h-4 w-4"})}));gb.displayName=xv.displayName;const gn=V.forwardRef(({className:t,children:e,position:r="popper",...i},s)=>k.jsx(T3,{children:k.jsxs(mv,{ref:s,className:He("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border border-input bg-card text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:r,...i,children:[k.jsx(mb,{}),k.jsx(P3,{className:He("p-2",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),k.jsx(gb,{})]})}));gn.displayName=mv.displayName;const Md=V.forwardRef(({className:t,...e},r)=>k.jsx(bv,{ref:r,className:He("px-4 py-2 text-xs font-medium text-muted-foreground uppercase tracking-wider",t),...e}));Md.displayName=bv.displayName;const Kt=V.forwardRef(({className:t,children:e,...r},i)=>k.jsxs(gv,{ref:i,className:He("relative flex w-full cursor-default select-none items-center rounded py-3 pl-4 pr-8 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[k.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:k.jsx(j3,{children:k.jsx(zs,{className:"h-4 w-4"})})}),k.jsx(L3,{children:e})]}));Kt.displayName=gv.displayName;const Sd=V.forwardRef(({className:t,...e},r)=>k.jsx(vv,{ref:r,className:He("-mx-1 my-1 h-px bg-muted",t),...e}));Sd.displayName=vv.displayName;const vb={elevenlabs:"@elizaos/plugin-elevenlabs",openai:"@elizaos/plugin-openai",none:""},yx=[{value:"none",label:"No Voice",provider:"none"}],wx=[],Oh=[{value:"EXAVITQu4vr4xnSDxMaL",label:"ElevenLabs - Rachel (Default)",provider:"elevenlabs",gender:"female",language:"en",features:["natural","professional"]},{value:"21m00Tcm4TlvDq8ikWAM",label:"ElevenLabs - Adam",provider:"elevenlabs",gender:"male",language:"en",features:["natural","professional"]},{value:"AZnzlk1XvdvUeBnXmlld",label:"ElevenLabs - Domi",provider:"elevenlabs",gender:"female",language:"en",features:["natural","friendly"]},{value:"MF3mGyEYCl7XYWbV9V6O",label:"ElevenLabs - Elli",provider:"elevenlabs",gender:"female",language:"en",features:["natural","friendly"]},{value:"TxGEqnHWrfWFTfGW9XjX",label:"ElevenLabs - Josh",provider:"elevenlabs",gender:"male",language:"en",features:["natural","professional"]}],bb=[{value:"alloy",label:"OpenAI - Alloy",provider:"openai",gender:"female",language:"en",features:["natural","versatile"]},{value:"echo",label:"OpenAI - Echo",provider:"openai",gender:"male",language:"en",features:["natural","professional"]},{value:"fable",label:"OpenAI - Fable",provider:"openai",gender:"male",language:"en",features:["natural","narrative"]},{value:"onyx",label:"OpenAI - Onyx",provider:"openai",gender:"male",language:"en",features:["natural","deep"]},{value:"nova",label:"OpenAI - Nova",provider:"openai",gender:"female",language:"en",features:["natural","friendly"]},{value:"shimmer",label:"OpenAI - Shimmer",provider:"openai",gender:"female",language:"en",features:["natural","bright"]},{value:"ash",label:"OpenAI - Ash",provider:"openai",gender:"male",language:"en",features:["natural","calm"]},{value:"coral",label:"OpenAI - Coral",provider:"openai",gender:"female",language:"en",features:["natural","warm"]},{value:"sage",label:"OpenAI - Sage",provider:"openai",gender:"female",language:"en",features:["natural","wise"]},{value:"ballad",label:"OpenAI - Ballad",provider:"openai",gender:"male",language:"en",features:["natural","melodic"]}],yb=o(()=>[...yx,...wx,...Oh,...bb],"getAllVoiceModels"),Ed=o(t=>yb().find(e=>e.value===t),"getVoiceModelByValue");function xx(){const[t,e]=V.useState(null);return V.useEffect(()=>{const r=localStorage.getItem("ELEVENLABS_API_KEY");e(r)},[]),Sr({queryKey:["elevenlabs-voices",t],queryFn:o(async()=>{if(!t)return[];try{const r=await fetch("https://api.elevenlabs.io/v2/voices",{method:"GET",headers:{"xi-api-key":t}});if(!r.ok)return console.error("Failed to fetch ElevenLabs voices:",r.statusText),[];const i=await r.json(),s=Oh.map(v=>v.value);return i.voices.filter(v=>!s.includes(v.voice_id)).map(v=>({value:v.voice_id,label:`ElevenLabs - ${v.name} (Custom)`,provider:"elevenlabs",gender:v.labels?.gender==="female"?"female":"male",language:"en",features:[v.category||"professional",v.labels?.description||"natural"]}))}catch(r){return console.error("Error fetching ElevenLabs voices:",r),[]}},"queryFn"),staleTime:3600*1e3,refetchOnWindowFocus:!1})}o(xx,"useElevenLabsVoices");function Ka({...t}){return k.jsx(D3,{"data-slot":"dropdown-menu",...t})}o(Ka,"DropdownMenu");function Xa({...t}){return k.jsx(B3,{"data-slot":"dropdown-menu-trigger",...t})}o(Xa,"DropdownMenuTrigger");function Wa({className:t,sideOffset:e=4,onPointerDown:r,onPointerDownOutside:i,onCloseAutoFocus:s,...f}){const n=V.useRef(!1),v=V.useCallback(m=>{n.current=!0,r?.(m)},[r]),b=V.useCallback(m=>{n.current=!0,i?.(m)},[i]),h=V.useCallback(m=>{if(s)return s(m);n.current&&(m.preventDefault(),n.current=!1)},[s]);return k.jsx(z3,{children:k.jsx(F3,{"data-slot":"dropdown-menu-content",sideOffset:e,className:He("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md border p-1 shadow-lg",t),onPointerDown:v,onPointerDownOutside:b,onCloseAutoFocus:h,...f})})}o(Wa,"DropdownMenuContent");function _i({className:t,inset:e,variant:r="default",...i}){return k.jsx(U3,{"data-slot":"dropdown-menu-item","data-inset":e,"data-variant":r,className:He("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive-foreground data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/40 data-[variant=destructive]:focus:text-destructive-foreground data-[variant=destructive]:*:[svg]:!text-destructive-foreground data-[variant=destructive]:font-normal relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm font-medium outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...i})}o(_i,"DropdownMenuItem");function _x({className:t,inset:e,...r}){return k.jsx(V3,{"data-slot":"dropdown-menu-label","data-inset":e,className:He("text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:pl-8",t),...r})}o(_x,"DropdownMenuLabel");function Bl({className:t,...e}){return k.jsx(H3,{"data-slot":"dropdown-menu-separator",className:He("bg-border -mx-1 my-1 h-px",t),...e})}o(Bl,"DropdownMenuSeparator");const wb=[{id:"none",label:"None (Start Blank)",description:"Start with an empty configuration",template:{name:"",username:"",system:"",bio:[],topics:[],adjectives:[],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap"],settings:{secrets:{}}}},{id:"discord-bot",label:"Discord Bot",description:"Interactive Discord bot that handles server interactions",template:{name:"Discord Assistant",username:"discordbot",system:"You are a Discord bot designed to assist users in a Discord server. You respond to messages, handle commands, and provide helpful information to community members. You should be friendly, helpful, and maintain a consistent personality. Focus on providing value to the community through clear, concise responses.",bio:["Helpful Discord community assistant","Responds to commands and natural language queries","Assists with server-specific information and resources","Maintains a friendly and helpful tone"],topics:["Discord server","Community assistance","Command handling","Server information"],adjectives:["Helpful","Responsive","Friendly","Informative","Reliable"],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-discord"],style:{all:["Be friendly and helpful","Use clear, concise language","Follow Discord conventions"],chat:["Respond promptly to queries","Use appropriate formatting for clarity","Reference relevant commands when helpful"],post:["Structure longer responses with clear sections","Use embeds for rich content when appropriate"]},settings:{secrets:{}}}},{id:"telegram-bot",label:"Telegram Bot",description:"Interactive bot for Telegram channels and groups",template:{name:"Telegram Assistant",username:"telegrambot",system:"You are a helpful Telegram bot designed to assist users in channels and groups. You respond to commands and natural language queries, providing information, assistance, and engaging with users in a friendly manner. You can handle both one-on-one conversations and group interactions, adapting your tone and content accordingly while respecting privacy and community guidelines.",bio:["Interactive Telegram bot","Assists users in channels and groups","Responds to commands and natural language"],topics:["Channel information","User assistance","Content sharing","Group moderation","FAQ responses"],adjectives:["Helpful","Responsive","Friendly","Informative","Reliable"],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-telegram"],style:{all:["Be concise and clear","Use Telegram-friendly formatting","Respond promptly to user queries"],chat:["Handle commands efficiently","Include relevant emoji when appropriate","Maintain conversation context"],post:["Structure longer messages clearly","Use formatting for better readability","Include relevant links when helpful"]},settings:{clients:["telegram"],allowDirectMessages:!0,shouldOnlyJoinInAllowedGroups:!1,messageTrackingLimit:100,secrets:{}}}},{id:"slack-bot",label:"Slack Bot",description:"Interactive bot for Slack workspaces",template:{name:"Slack Assistant",username:"slackbot",system:"You are a specialized assistant for Slack workspaces. You help teams by answering questions, providing information, and facilitating collaboration. You can respond to direct messages and channel mentions, maintaining a helpful and professional tone that aligns with the organization's culture. Keep responses concise and relevant to the conversation context.",bio:["Specialized Slack workspace assistant","Facilitates team collaboration","Provides timely responses to queries"],topics:["Workspace information","Team collaboration","Company policies","Resource access","Task management"],adjectives:["Responsive","Helpful","Organized","Team-oriented","Professional"],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-slack"],style:{all:["Be concise and clear","Match the tone of the workspace","Use Slack-appropriate formatting"],chat:["Reference relevant messages when appropriate","Use thread replies for detailed responses","Include emojis when fitting the workspace culture"],post:["Structure information with clear sections","Use bullet points for lists","Include relevant links when helpful"]},settings:{secrets:{}}}},{id:"twitter-agent",label:"Twitter/X Agent",description:"Manages Twitter presence and engagement",template:{name:"Twitter Agent",username:"twitteragent",system:"You are a Twitter engagement specialist designed to help create and manage effective Twitter content. You assist with drafting tweets, responding to mentions, analyzing engagement metrics, and suggesting content strategies. Your tone should match the brand voice while maintaining authenticity and encouraging audience interaction. Keep tweets concise and impactful within character limits.",bio:["Twitter engagement specialist","Creates compelling social content","Manages audience interactions"],topics:["Tweet creation","Audience engagement","Content strategy","Trend analysis","Brand voice"],adjectives:["Engaging","Concise","Strategic","Conversational","Creative"],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-twitter"],style:{all:["Be concise and impactful","Stay within character limits","Use platform-appropriate formatting"],chat:["Match brand voice in replies","Be conversational and authentic","Use hashtags strategically"],post:["Draft varied content types","Suggest engaging visuals or polls","Include call-to-actions when appropriate"]},settings:{TWITTER_DRY_RUN:!1,MAX_TWEET_LENGTH:280,TWITTER_ENABLE_POST_GENERATION:!0,TWITTER_POST_INTERVAL_MIN:90,TWITTER_POST_INTERVAL_MAX:180,secrets:{}}}},{id:"github-bot",label:"GitHub Repository Assistant",description:"Helps manage GitHub repositories and development workflows",template:{name:"GitHub Assistant",username:"githubasst",system:"You are a GitHub repository assistant designed to help development teams manage their workflow and codebase. You can assist with pull request reviews, issue triage, documentation updates, and providing information about repository structure and conventions. Maintain a technical but approachable tone, and prioritize accuracy in all technical information.",bio:["GitHub repository management specialist","Assists with development workflows","Provides code and documentation support"],topics:["Pull requests","Issue tracking","Repository structure","Code reviews","Development workflows"],adjectives:["Technical","Precise","Helpful","Organized","Knowledgeable"],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-github"],style:{all:["Use technically precise language","Reference GitHub concepts appropriately","Link to relevant documentation when helpful"],chat:["Be concise in comments","Format code snippets properly","Summarize technical points clearly"],post:["Structure longer responses with clear headings","Use code blocks with syntax highlighting","Link to specific lines of code when relevant"]},settings:{secrets:{}}}},{id:"instagram-agent",label:"Instagram Content Manager",description:"Creates and manages content for Instagram",template:{name:"Instagram Manager",username:"instagrammgr",system:"You are an Instagram content specialist designed to help create and manage engaging Instagram presence. You assist with content creation, caption writing, hashtag strategy, engagement tactics, and understanding analytics. Your approach emphasizes visual storytelling, authenticity, and building connections with followers. Maintain a voice that matches the brand identity while adapting to Instagram's evolving features and trends.",bio:["Instagram content creation specialist","Develops engaging visual storytelling","Optimizes profile engagement"],topics:["Content creation","Caption writing","Hashtag strategy","Engagement tactics","Visual aesthetics"],adjectives:["Creative","Visual","Engaging","Trend-aware","Authentic"],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap","@elizaos/plugin-instagram"],style:{all:["Balance visual description with compelling text","Maintain brand voice consistency","Consider current platform trends"],chat:["Provide actionable content suggestions","Reference visual elements clearly","Include relevant hashtag recommendations"],post:["Craft captions that enhance visual content","Suggest content series and themes","Balance promotional with authentic content"]},settings:{POST_INTERVAL_MIN:90,POST_INTERVAL_MAX:180,ENABLE_ACTION_PROCESSING:!0,ACTION_INTERVAL:5,MAX_ACTIONS_PROCESSING:1,secrets:{}}}}];function xb(t){return wb.find(e=>e.id===t)}o(xb,"getTemplateById");const Th=Z3,Mx=G3,_b=V.forwardRef(({className:t,...e},r)=>k.jsx(kv,{className:He("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:r}));_b.displayName=kv.displayName;const Eu=V.forwardRef(({className:t,...e},r)=>k.jsxs(Mx,{children:[k.jsx(_b,{}),k.jsx(_v,{ref:r,className:He("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Eu.displayName=_v.displayName;const Au=o(({className:t,...e})=>k.jsx("div",{className:He("flex flex-col space-y-2 text-center sm:text-left",t),...e}),"AlertDialogHeader");Au.displayName="AlertDialogHeader";const ku=o(({className:t,...e})=>k.jsx("div",{className:He("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e}),"AlertDialogFooter");ku.displayName="AlertDialogFooter";const Nu=V.forwardRef(({className:t,...e},r)=>k.jsx(Mv,{ref:r,className:He("text-lg font-semibold",t),...e}));Nu.displayName=Mv.displayName;const Cu=V.forwardRef(({className:t,...e},r)=>k.jsx(Sv,{ref:r,className:He("text-sm text-muted-foreground",t),...e}));Cu.displayName=Sv.displayName;const Ru=V.forwardRef(({className:t,...e},r)=>k.jsx(Av,{ref:r,className:He(Nh(),t),...e}));Ru.displayName=Av.displayName;const Iu=V.forwardRef(({className:t,...e},r)=>k.jsx(Ev,{ref:r,className:He(Nh({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Iu.displayName=Ev.displayName;function Sx({open:t,onOpenChange:e,missingSecrets:r,onConfirm:i,onCancel:s}){return k.jsx(Th,{open:t,onOpenChange:e,children:k.jsxs(Eu,{children:[k.jsxs(Au,{children:[k.jsxs(Nu,{className:"flex items-center gap-2",children:[k.jsx(Xr,{className:"h-5 w-5 text-yellow-500"}),"Missing Required Configuration"]}),k.jsxs(Cu,{className:"space-y-3",children:[k.jsx("p",{children:"The following required secrets are missing or empty. Your agent may not function properly without these values."}),k.jsx("div",{className:"bg-muted rounded-md p-3 space-y-2",children:r.map(f=>k.jsxs("div",{className:"text-sm",children:[k.jsx("code",{className:"font-mono font-semibold",children:f.name}),f.plugin&&k.jsxs("span",{className:"text-muted-foreground ml-2",children:["(required by ",f.plugin,")"]}),f.description&&k.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:f.description})]},f.name))}),k.jsx("p",{className:"text-sm",children:"Do you want to save anyway?"})]})]}),k.jsxs(ku,{children:[k.jsx(Iu,{onClick:s,children:"Go Back"}),k.jsx(Ru,{onClick:i,className:"bg-yellow-600 hover:bg-yellow-700",children:"Save Anyway"})]})]})})}o(Sx,"MissingSecretsDialog");var $i={},Ex=Object.create,{getPrototypeOf:Ax,defineProperty:$a,getOwnPropertyNames:Mb,getOwnPropertyDescriptor:kx}=Object,Sb=Object.prototype.hasOwnProperty,Tr=o((t,e,r)=>{r=t!=null?Ex(Ax(t)):{};let i=e||!t||!t.__esModule?$a(r,"default",{value:t,enumerable:!0}):r;for(let s of Mb(t))Sb.call(i,s)||$a(i,s,{get:o(()=>t[s],"get"),enumerable:!0});return i},"M4"),a0=new WeakMap,bt=o(t=>{var e=a0.get(t),r;return e||(e=$a({},"__esModule",{value:!0}),(t&&typeof t=="object"||typeof t=="function")&&Mb(t).map(i=>!Sb.call(e,i)&&$a(e,i,{get:o(()=>t[i],"get"),enumerable:!(r=kx(t,i))||r.enumerable})),a0.set(t,e),e)},"v6"),ye=o((t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),"i"),Rn=o((t,e)=>{for(var r in e)$a(t,r,{get:e[r],enumerable:!0,configurable:!0,set:o(i=>e[r]=()=>i,"set")})},"F1"),Po=o((t,e)=>()=>(t&&(e=t(t=0)),e),"S5"),Ac=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:o((e,r)=>(typeof require<"u"?require:e)[r],"get")}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),Nx=ye((t,e)=>{function r(i,s){typeof s=="boolean"&&(s={forever:s}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=s||{},this._maxRetryTime=s&&s.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o(r,"U4"),e.exports=r,r.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)},r.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null},r.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var s=new Date().getTime();if(i&&s-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var f=this._timeouts.shift();if(f===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),f=this._cachedTimeouts.slice(-1);else return!1;var n=this;return this._timer=setTimeout(function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout(function(){n._operationTimeoutCb(n._attempts)},n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)},f),this._options.unref&&this._timer.unref(),!0},r.prototype.attempt=function(i,s){this._fn=i,s&&(s.timeout&&(this._operationTimeout=s.timeout),s.cb&&(this._operationTimeoutCb=s.cb));var f=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){f._operationTimeoutCb()},f._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},r.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)},r.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)},r.prototype.start=r.prototype.try,r.prototype.errors=function(){return this._errors},r.prototype.attempts=function(){return this._attempts},r.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},s=null,f=0,n=0;n<this._errors.length;n++){var v=this._errors[n],b=v.message,h=(i[b]||0)+1;i[b]=h,h>=f&&(s=v,f=h)}return s}}),Cx=ye(t=>{var e=Nx();t.operation=function(r){var i=t.timeouts(r);return new e(i,{forever:r&&(r.forever||r.retries===1/0),unref:r&&r.unref,maxRetryTime:r&&r.maxRetryTime})},t.timeouts=function(r){if(r instanceof Array)return[].concat(r);var i={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var s in r)i[s]=r[s];if(i.minTimeout>i.maxTimeout)throw Error("minTimeout is greater than maxTimeout");for(var f=[],n=0;n<i.retries;n++)f.push(this.createTimeout(n,i));return r&&r.forever&&!f.length&&f.push(this.createTimeout(n,i)),f.sort(function(v,b){return v-b}),f},t.createTimeout=function(r,i){var s=i.randomize?Math.random()+1:1,f=Math.round(s*Math.max(i.minTimeout,1)*Math.pow(i.factor,r));return f=Math.min(f,i.maxTimeout),f},t.wrap=function(r,i,s){if(i instanceof Array&&(s=i,i=null),!s){s=[];for(var f in r)typeof r[f]=="function"&&s.push(f)}for(var n=0;n<s.length;n++){var v=s[n],b=r[v];r[v]=function(h){var m=t.operation(i),l=Array.prototype.slice.call(arguments,1),w=l.pop();l.push(function(p){m.retry(p)||(p&&(arguments[0]=m.mainError()),w.apply(this,arguments))}),m.attempt(function(){h.apply(r,l)})}.bind(r,b),r[v].options=i}}}),Ph=ye((t,e)=>{var r=Cx(),i=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class s extends Error{static{o(this,"aY")}constructor(h){super(),h instanceof Error?(this.originalError=h,{message:h}=h):(this.originalError=Error(h),this.originalError.stack=this.stack),this.name="AbortError",this.message=h}}var f=o((b,h,m)=>{let l=m.retries-(h-1);return b.attemptNumber=h,b.retriesLeft=l,b},"$I"),n=o(b=>i.includes(b),"KI"),v=o((b,h)=>new Promise((m,l)=>{h={onFailedAttempt:o(()=>{},"onFailedAttempt"),retries:10,...h};let w=r.operation(h);w.attempt(async p=>{try{m(await b(p))}catch(y){if(!(y instanceof Error)){l(TypeError(`Non-error was thrown: "${y}". You should only throw errors.`));return}if(y instanceof s)w.stop(),l(y.originalError);else if(y instanceof TypeError&&!n(y.message))w.stop(),l(y);else{f(y,p,h);try{await h.onFailedAttempt(y)}catch(M){l(M);return}w.retry(y)||l(w.mainError())}}})}),"lz");e.exports=v,e.exports.default=v,e.exports.AbortError=s}),Rx=ye((t,e)=>{var r=Object.prototype.hasOwnProperty,i="~";function s(){}o(s,"c5"),Object.create&&(s.prototype=Object.create(null),!new s().__proto__&&(i=!1));function f(h,m,l){this.fn=h,this.context=m,this.once=l||!1}o(f,"uI");function n(h,m,l,w,p){if(typeof l!="function")throw TypeError("The listener must be a function");var y=new f(l,w||h,p),M=i?i+m:m;return h._events[M]?h._events[M].fn?h._events[M]=[h._events[M],y]:h._events[M].push(y):(h._events[M]=y,h._eventsCount++),h}o(n,"Bf");function v(h,m){--h._eventsCount===0?h._events=new s:delete h._events[m]}o(v,"i_");function b(){this._events=new s,this._eventsCount=0}o(b,"q4"),b.prototype.eventNames=function(){var h=[],m,l;if(this._eventsCount===0)return h;for(l in m=this._events)r.call(m,l)&&h.push(i?l.slice(1):l);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(m)):h},b.prototype.listeners=function(h){var m=i?i+h:h,l=this._events[m];if(!l)return[];if(l.fn)return[l.fn];for(var w=0,p=l.length,y=Array(p);w<p;w++)y[w]=l[w].fn;return y},b.prototype.listenerCount=function(h){var m=i?i+h:h,l=this._events[m];return l?l.fn?1:l.length:0},b.prototype.emit=function(h,m,l,w,p,y){var M=i?i+h:h;if(!this._events[M])return!1;var E=this._events[M],R=arguments.length,I,T;if(E.fn){switch(E.once&&this.removeListener(h,E.fn,void 0,!0),R){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,m),!0;case 3:return E.fn.call(E.context,m,l),!0;case 4:return E.fn.call(E.context,m,l,w),!0;case 5:return E.fn.call(E.context,m,l,w,p),!0;case 6:return E.fn.call(E.context,m,l,w,p,y),!0}for(T=1,I=Array(R-1);T<R;T++)I[T-1]=arguments[T];E.fn.apply(E.context,I)}else{var P=E.length,j;for(T=0;T<P;T++)switch(E[T].once&&this.removeListener(h,E[T].fn,void 0,!0),R){case 1:E[T].fn.call(E[T].context);break;case 2:E[T].fn.call(E[T].context,m);break;case 3:E[T].fn.call(E[T].context,m,l);break;case 4:E[T].fn.call(E[T].context,m,l,w);break;default:if(!I)for(j=1,I=Array(R-1);j<R;j++)I[j-1]=arguments[j];E[T].fn.apply(E[T].context,I)}}return!0},b.prototype.on=function(h,m,l){return n(this,h,m,l,!1)},b.prototype.once=function(h,m,l){return n(this,h,m,l,!0)},b.prototype.removeListener=function(h,m,l,w){var p=i?i+h:h;if(!this._events[p])return this;if(!m)return v(this,p),this;var y=this._events[p];if(y.fn)y.fn===m&&(!w||y.once)&&(!l||y.context===l)&&v(this,p);else{for(var M=0,E=[],R=y.length;M<R;M++)(y[M].fn!==m||w&&!y[M].once||l&&y[M].context!==l)&&E.push(y[M]);E.length?this._events[p]=E.length===1?E[0]:E:v(this,p)}return this},b.prototype.removeAllListeners=function(h){var m;return h?(m=i?i+h:h,this._events[m]&&v(this,m)):(this._events=new s,this._eventsCount=0),this},b.prototype.off=b.prototype.removeListener,b.prototype.addListener=b.prototype.on,b.prefixed=i,b.EventEmitter=b,typeof e<"u"&&(e.exports=b)}),Ix=ye((t,e)=>{e.exports=(r,i)=>(i=i||(()=>{}),r.then(s=>new Promise(f=>{f(i())}).then(()=>s),s=>new Promise(f=>{f(i())}).then(()=>{throw s})))}),Ox=ye((t,e)=>{var r=Ix();class i extends Error{static{o(this,"kO")}constructor(n){super(n),this.name="TimeoutError"}}var s=o((f,n,v)=>new Promise((b,h)=>{if(typeof n!="number"||n<0)throw TypeError("Expected `milliseconds` to be a positive number");if(n===1/0){b(f);return}let m=setTimeout(()=>{if(typeof v=="function"){try{b(v())}catch(p){h(p)}return}let l=typeof v=="string"?v:`Promise timed out after ${n} milliseconds`,w=v instanceof Error?v:new i(l);typeof f.cancel=="function"&&f.cancel(),h(w)},n);r(f.then(b,h),()=>{clearTimeout(m)})}),"rf");e.exports=s,e.exports.default=s,e.exports.TimeoutError=i}),Tx=ye(t=>{Object.defineProperty(t,"__esModule",{value:!0});function e(r,i,s){let f=0,n=r.length;for(;n>0;){let v=n/2|0,b=f+v;s(r[b],i)<=0?(f=++b,n-=v+1):n=v}return f}o(e,"dI"),t.default=e}),Px=ye(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Tx();class r{static{o(this,"af")}constructor(){this._queue=[]}enqueue(s,f){f=Object.assign({priority:0},f);let n={priority:f.priority,run:s};if(this.size&&this._queue[this.size-1].priority>=f.priority){this._queue.push(n);return}let v=e.default(this._queue,n,(b,h)=>h.priority-b.priority);this._queue.splice(v,0,n)}dequeue(){let s=this._queue.shift();return s?.run}filter(s){return this._queue.filter(f=>f.priority===s.priority).map(f=>f.run)}get size(){return this._queue.length}}t.default=r}),jh=ye(t=>{Object.defineProperty(t,"__esModule",{value:!0});var e=Rx(),r=Ox(),i=Px(),s=o(()=>{},"a_"),f=new r.TimeoutError;class n extends e{static{o(this,"$v")}constructor(b){var h,m,l,w;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=s,this._resolveIdle=s,b=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:i.default},b),!(typeof b.intervalCap=="number"&&b.intervalCap>=1))throw TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(m=(h=b.intervalCap)===null||h===void 0?void 0:h.toString())!==null&&m!==void 0?m:""}\` (${typeof b.intervalCap})`);if(b.interval===void 0||!(Number.isFinite(b.interval)&&b.interval>=0))throw TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(w=(l=b.interval)===null||l===void 0?void 0:l.toString())!==null&&w!==void 0?w:""}\` (${typeof b.interval})`);this._carryoverConcurrencyCount=b.carryoverConcurrencyCount,this._isIntervalIgnored=b.intervalCap===1/0||b.interval===0,this._intervalCap=b.intervalCap,this._interval=b.interval,this._queue=new b.queueClass,this._queueClass=b.queueClass,this.concurrency=b.concurrency,this._timeout=b.timeout,this._throwOnTimeout=b.throwOnTimeout===!0,this._isPaused=b.autoStart===!1}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=s,this._pendingCount===0&&(this._resolveIdle(),this._resolveIdle=s,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){let b=Date.now();if(this._intervalId===void 0){let h=this._intervalEnd-b;if(h<0)this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0;else return this._timeoutId===void 0&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},h)),!0}return!1}_tryToStartAnother(){if(this._queue.size===0)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){let b=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){let h=this._queue.dequeue();return h?(this.emit("active"),h(),b&&this._initializeIntervalIfNeeded(),!0):!1}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||this._intervalId!==void 0||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){this._intervalCount===0&&this._pendingCount===0&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(b){if(!(typeof b=="number"&&b>=1))throw TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${b}\` (${typeof b})`);this._concurrency=b,this._processQueue()}async add(b,h={}){return new Promise((m,l)=>{let w=o(async()=>{this._pendingCount++,this._intervalCount++;try{let p=this._timeout===void 0&&h.timeout===void 0?b():r.default(Promise.resolve(b()),h.timeout===void 0?this._timeout:h.timeout,()=>{(h.throwOnTimeout===void 0?this._throwOnTimeout:h.throwOnTimeout)&&l(f)});m(await p)}catch(p){l(p)}this._next()},"P");this._queue.enqueue(w,h),this._tryToStartAnother(),this.emit("add")})}async addAll(b,h){return Promise.all(b.map(async m=>this.add(m,h)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(this._queue.size!==0)return new Promise(b=>{let h=this._resolveEmpty;this._resolveEmpty=()=>{h(),b()}})}async onIdle(){if(!(this._pendingCount===0&&this._queue.size===0))return new Promise(b=>{let h=this._resolveIdle;this._resolveIdle=()=>{h(),b()}})}get size(){return this._queue.size}sizeBy(b){return this._queue.filter(b).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(b){this._timeout=b}}t.default=n}),Ou=ye((t,e)=>{var r=Number.MAX_SAFE_INTEGER||9007199254740991,i=["major","premajor","minor","preminor","patch","prepatch","prerelease"];e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:r,RELEASE_TYPES:i,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}),Tu=ye((t,e)=>{var r=typeof process=="object"&&$i&&$i.NODE_DEBUG&&/\bsemver\b/i.test($i.NODE_DEBUG)?(...i)=>console.error("SEMVER",...i):()=>{};e.exports=r}),jo=ye((t,e)=>{var{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:s}=Ou(),f=Tu();t=e.exports={};var n=t.re=[],v=t.safeRe=[],b=t.src=[],h=t.safeSrc=[],m=t.t={},l=0,w="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",s],[w,i]],y=o(E=>{for(let[R,I]of p)E=E.split(`${R}*`).join(`${R}{0,${I}}`).split(`${R}+`).join(`${R}{1,${I}}`);return E},"jh"),M=o((E,R,I)=>{let T=y(R),P=l++;f(E,P,R),m[E]=P,b[P]=R,h[P]=T,n[P]=new RegExp(R,I?"g":void 0),v[P]=new RegExp(T,I?"g":void 0)},"C6");M("NUMERICIDENTIFIER","0|[1-9]\\d*"),M("NUMERICIDENTIFIERLOOSE","\\d+"),M("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${w}*`),M("MAINVERSION",`(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})`),M("MAINVERSIONLOOSE",`(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})`),M("PRERELEASEIDENTIFIER",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIER]})`),M("PRERELEASEIDENTIFIERLOOSE",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIERLOOSE]})`),M("PRERELEASE",`(?:-(${b[m.PRERELEASEIDENTIFIER]}(?:\\.${b[m.PRERELEASEIDENTIFIER]})*))`),M("PRERELEASELOOSE",`(?:-?(${b[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[m.PRERELEASEIDENTIFIERLOOSE]})*))`),M("BUILDIDENTIFIER",`${w}+`),M("BUILD",`(?:\\+(${b[m.BUILDIDENTIFIER]}(?:\\.${b[m.BUILDIDENTIFIER]})*))`),M("FULLPLAIN",`v?${b[m.MAINVERSION]}${b[m.PRERELEASE]}?${b[m.BUILD]}?`),M("FULL",`^${b[m.FULLPLAIN]}$`),M("LOOSEPLAIN",`[v=\\s]*${b[m.MAINVERSIONLOOSE]}${b[m.PRERELEASELOOSE]}?${b[m.BUILD]}?`),M("LOOSE",`^${b[m.LOOSEPLAIN]}$`),M("GTLT","((?:<|>)?=?)"),M("XRANGEIDENTIFIERLOOSE",`${b[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),M("XRANGEIDENTIFIER",`${b[m.NUMERICIDENTIFIER]}|x|X|\\*`),M("XRANGEPLAIN",`[v=\\s]*(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:${b[m.PRERELEASE]})?${b[m.BUILD]}?)?)?`),M("XRANGEPLAINLOOSE",`[v=\\s]*(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:${b[m.PRERELEASELOOSE]})?${b[m.BUILD]}?)?)?`),M("XRANGE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAIN]}$`),M("XRANGELOOSE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAINLOOSE]}$`),M("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),M("COERCE",`${b[m.COERCEPLAIN]}(?:$|[^\\d])`),M("COERCEFULL",b[m.COERCEPLAIN]+`(?:${b[m.PRERELEASE]})?(?:${b[m.BUILD]})?(?:$|[^\\d])`),M("COERCERTL",b[m.COERCE],!0),M("COERCERTLFULL",b[m.COERCEFULL],!0),M("LONETILDE","(?:~>?)"),M("TILDETRIM",`(\\s*)${b[m.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",M("TILDE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAIN]}$`),M("TILDELOOSE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAINLOOSE]}$`),M("LONECARET","(?:\\^)"),M("CARETTRIM",`(\\s*)${b[m.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",M("CARET",`^${b[m.LONECARET]}${b[m.XRANGEPLAIN]}$`),M("CARETLOOSE",`^${b[m.LONECARET]}${b[m.XRANGEPLAINLOOSE]}$`),M("COMPARATORLOOSE",`^${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]})$|^$`),M("COMPARATOR",`^${b[m.GTLT]}\\s*(${b[m.FULLPLAIN]})$|^$`),M("COMPARATORTRIM",`(\\s*)${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]}|${b[m.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",M("HYPHENRANGE",`^\\s*(${b[m.XRANGEPLAIN]})\\s+-\\s+(${b[m.XRANGEPLAIN]})\\s*$`),M("HYPHENRANGELOOSE",`^\\s*(${b[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[m.XRANGEPLAINLOOSE]})\\s*$`),M("STAR","(<|>)?=?\\s*\\*"),M("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),M("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}),Lh=ye((t,e)=>{var r=Object.freeze({loose:!0}),i=Object.freeze({}),s=o(f=>f?typeof f!="object"?r:f:i,"Jh");e.exports=s}),Eb=ye((t,e)=>{var r=/^[0-9]+$/,i=o((f,n)=>{let v=r.test(f),b=r.test(n);return v&&b&&(f=+f,n=+n),f===n?0:v&&!b?-1:b&&!v?1:f<n?-1:1},"Jv"),s=o((f,n)=>i(n,f),"zh");e.exports={compareIdentifiers:i,rcompareIdentifiers:s}}),Cr=ye((t,e)=>{var r=Tu(),{MAX_LENGTH:i,MAX_SAFE_INTEGER:s}=Ou(),{safeRe:f,t:n}=jo(),v=Lh(),{compareIdentifiers:b}=Eb();class h{static{o(this,"v$")}constructor(l,w){if(w=v(w),l instanceof h){if(l.loose===!!w.loose&&l.includePrerelease===!!w.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>i)throw TypeError(`version is longer than ${i} characters`);r("SemVer",l,w),this.options=w,this.loose=!!w.loose,this.includePrerelease=!!w.includePrerelease;let p=l.trim().match(w.loose?f[n.LOOSE]:f[n.FULL]);if(!p)throw TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+p[1],this.minor=+p[2],this.patch=+p[3],this.major>s||this.major<0)throw TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw TypeError("Invalid patch version");p[4]?this.prerelease=p[4].split(".").map(y=>{if(/^[0-9]+$/.test(y)){let M=+y;if(M>=0&&M<s)return M}return y}):this.prerelease=[],this.build=p[5]?p[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(l){if(r("SemVer.compare",this.version,this.options,l),!(l instanceof h)){if(typeof l=="string"&&l===this.version)return 0;l=new h(l,this.options)}return l.version===this.version?0:this.compareMain(l)||this.comparePre(l)}compareMain(l){return l instanceof h||(l=new h(l,this.options)),b(this.major,l.major)||b(this.minor,l.minor)||b(this.patch,l.patch)}comparePre(l){if(l instanceof h||(l=new h(l,this.options)),this.prerelease.length&&!l.prerelease.length)return-1;if(!this.prerelease.length&&l.prerelease.length)return 1;if(!this.prerelease.length&&!l.prerelease.length)return 0;let w=0;do{let p=this.prerelease[w],y=l.prerelease[w];if(r("prerelease compare",w,p,y),p===void 0&&y===void 0)return 0;if(y===void 0)return 1;if(p===void 0)return-1;if(p===y)continue;return b(p,y)}while(++w)}compareBuild(l){l instanceof h||(l=new h(l,this.options));let w=0;do{let p=this.build[w],y=l.build[w];if(r("build compare",w,p,y),p===void 0&&y===void 0)return 0;if(y===void 0)return 1;if(p===void 0)return-1;if(p===y)continue;return b(p,y)}while(++w)}inc(l,w,p){if(l.startsWith("pre")){if(!w&&p===!1)throw Error("invalid increment argument: identifier is empty");if(w){let y=`-${w}`.match(this.options.loose?f[n.PRERELEASELOOSE]:f[n.PRERELEASE]);if(!y||y[1]!==w)throw Error(`invalid identifier: ${w}`)}}switch(l){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",w,p);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",w,p);break;case"prepatch":this.prerelease.length=0,this.inc("patch",w,p),this.inc("pre",w,p);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",w,p),this.inc("pre",w,p);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let y=Number(p)?1:0;if(this.prerelease.length===0)this.prerelease=[y];else{let M=this.prerelease.length;for(;--M>=0;)typeof this.prerelease[M]=="number"&&(this.prerelease[M]++,M=-2);if(M===-1){if(w===this.prerelease.join(".")&&p===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(y)}}if(w){let M=[w,y];p===!1&&(M=[w]),b(this.prerelease[0],w)===0?isNaN(this.prerelease[1])&&(this.prerelease=M):this.prerelease=M}break}default:throw Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=h}),$s=ye((t,e)=>{var r=Cr(),i=o((s,f,n=!1)=>{if(s instanceof r)return s;try{return new r(s,f)}catch(v){if(!n)return null;throw v}},"vh");e.exports=i}),jx=ye((t,e)=>{var r=$s(),i=o((s,f)=>{let n=r(s,f);return n?n.version:null},"Xh");e.exports=i}),Lx=ye((t,e)=>{var r=$s(),i=o((s,f)=>{let n=r(s.trim().replace(/^[=v]+/,""),f);return n?n.version:null},"wh");e.exports=i}),Dx=ye((t,e)=>{var r=Cr(),i=o((s,f,n,v,b)=>{typeof n=="string"&&(b=v,v=n,n=void 0);try{return new r(s instanceof r?s.version:s,n).inc(f,v,b).version}catch{return null}},"Gh");e.exports=i}),Bx=ye((t,e)=>{var r=$s(),i=o((s,f)=>{let n=r(s,null,!0),v=r(f,null,!0),b=n.compare(v);if(b===0)return null;let h=b>0,m=h?n:v,l=h?v:n,w=!!m.prerelease.length;if(l.prerelease.length&&!w){if(!l.patch&&!l.minor)return"major";if(l.compareMain(m)===0)return l.minor&&!l.patch?"minor":"patch"}let p=w?"pre":"";return n.major!==v.major?p+"major":n.minor!==v.minor?p+"minor":n.patch!==v.patch?p+"patch":"prerelease"},"kh");e.exports=i}),zx=ye((t,e)=>{var r=Cr(),i=o((s,f)=>new r(s,f).major,"Vh");e.exports=i}),Fx=ye((t,e)=>{var r=Cr(),i=o((s,f)=>new r(s,f).minor,"Sh");e.exports=i}),Ux=ye((t,e)=>{var r=Cr(),i=o((s,f)=>new r(s,f).patch,"Eh");e.exports=i}),Hx=ye((t,e)=>{var r=$s(),i=o((s,f)=>{let n=r(s,f);return n&&n.prerelease.length?n.prerelease:null},"Rh");e.exports=i}),di=ye((t,e)=>{var r=Cr(),i=o((s,f,n)=>new r(s,n).compare(new r(f,n)),"Dh");e.exports=i}),Vx=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(f,s,n),"hh");e.exports=i}),Zx=ye((t,e)=>{var r=di(),i=o((s,f)=>r(s,f,!0),"bh");e.exports=i}),Dh=ye((t,e)=>{var r=Cr(),i=o((s,f,n)=>{let v=new r(s,n),b=new r(f,n);return v.compare(b)||v.compareBuild(b)},"gh");e.exports=i}),Gx=ye((t,e)=>{var r=Dh(),i=o((s,f)=>s.sort((n,v)=>r(n,v,f)),"xh");e.exports=i}),Yx=ye((t,e)=>{var r=Dh(),i=o((s,f)=>s.sort((n,v)=>r(v,n,f)),"ch");e.exports=i}),Pu=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(s,f,n)>0,"mh");e.exports=i}),Bh=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(s,f,n)<0,"lh");e.exports=i}),Ab=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(s,f,n)===0,"oh");e.exports=i}),kb=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(s,f,n)!==0,"Uh");e.exports=i}),zh=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(s,f,n)>=0,"Fh");e.exports=i}),Fh=ye((t,e)=>{var r=di(),i=o((s,f,n)=>r(s,f,n)<=0,"ih");e.exports=i}),Nb=ye((t,e)=>{var r=Ab(),i=kb(),s=Pu(),f=zh(),n=Bh(),v=Fh(),b=o((h,m,l,w)=>{switch(m){case"===":return typeof h=="object"&&(h=h.version),typeof l=="object"&&(l=l.version),h===l;case"!==":return typeof h=="object"&&(h=h.version),typeof l=="object"&&(l=l.version),h!==l;case"":case"=":case"==":return r(h,l,w);case"!=":return i(h,l,w);case">":return s(h,l,w);case">=":return f(h,l,w);case"<":return n(h,l,w);case"<=":return v(h,l,w);default:throw TypeError(`Invalid operator: ${m}`)}},"KL");e.exports=b}),Qx=ye((t,e)=>{var r=Cr(),i=$s(),{safeRe:s,t:f}=jo(),n=o((v,b)=>{if(v instanceof r)return v;if(typeof v=="number"&&(v=String(v)),typeof v!="string")return null;b=b||{};let h=null;if(!b.rtl)h=v.match(b.includePrerelease?s[f.COERCEFULL]:s[f.COERCE]);else{let M=b.includePrerelease?s[f.COERCERTLFULL]:s[f.COERCERTL],E;for(;(E=M.exec(v))&&(!h||h.index+h[0].length!==v.length);)(!h||E.index+E[0].length!==h.index+h[0].length)&&(h=E),M.lastIndex=E.index+E[1].length+E[2].length;M.lastIndex=-1}if(h===null)return null;let m=h[2],l=h[3]||"0",w=h[4]||"0",p=b.includePrerelease&&h[5]?`-${h[5]}`:"",y=b.includePrerelease&&h[6]?`+${h[6]}`:"";return i(`${m}.${l}.${w}${p}${y}`,b)},"YL");e.exports=n}),Kx=ye((t,e)=>{class r{static{o(this,"$T")}constructor(){this.max=1e3,this.map=new Map}get(s){let f=this.map.get(s);if(f!==void 0)return this.map.delete(s),this.map.set(s,f),f}delete(s){return this.map.delete(s)}set(s,f){if(!this.delete(s)&&f!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(s,f)}return this}}e.exports=r}),hi=ye((t,e)=>{var r=/\s+/g;class i{static{o(this,"l5")}constructor(A,N){if(N=n(N),A instanceof i)return A.loose===!!N.loose&&A.includePrerelease===!!N.includePrerelease?A:new i(A.raw,N);if(A instanceof v)return this.raw=A.value,this.set=[[A]],this.formatted=void 0,this;if(this.options=N,this.loose=!!N.loose,this.includePrerelease=!!N.includePrerelease,this.raw=A.trim().replace(r," "),this.set=this.raw.split("||").map(S=>this.parseRange(S.trim())).filter(S=>S.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let S=this.set[0];if(this.set=this.set.filter(c=>!R(c[0])),this.set.length===0)this.set=[S];else if(this.set.length>1){for(let c of this.set)if(c.length===1&&I(c[0])){this.set=[c];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let A=0;A<this.set.length;A++){A>0&&(this.formatted+="||");let N=this.set[A];for(let S=0;S<N.length;S++)S>0&&(this.formatted+=" "),this.formatted+=N[S].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(A){let N=((this.options.includePrerelease&&M)|(this.options.loose&&E))+":"+A,S=f.get(N);if(S)return S;let c=this.options.loose,_=c?m[l.HYPHENRANGELOOSE]:m[l.HYPHENRANGE];A=A.replace(_,u(this.options.includePrerelease)),b("hyphen replace",A),A=A.replace(m[l.COMPARATORTRIM],w),b("comparator trim",A),A=A.replace(m[l.TILDETRIM],p),b("tilde trim",A),A=A.replace(m[l.CARETTRIM],y),b("caret trim",A);let C=A.split(" ").map(z=>P(z,this.options)).join(" ").split(/\s+/).map(z=>g(z,this.options));c&&(C=C.filter(z=>(b("loose invalid filter",z,this.options),!!z.match(m[l.COMPARATORLOOSE])))),b("range list",C);let O=new Map,D=C.map(z=>new v(z,this.options));for(let z of D){if(R(z))return[z];O.set(z.value,z)}O.size>1&&O.has("")&&O.delete("");let B=[...O.values()];return f.set(N,B),B}intersects(A,N){if(!(A instanceof i))throw TypeError("a Range is required");return this.set.some(S=>T(S,N)&&A.set.some(c=>T(c,N)&&S.every(_=>c.every(C=>_.intersects(C,N)))))}test(A){if(!A)return!1;if(typeof A=="string")try{A=new h(A,this.options)}catch{return!1}for(let N=0;N<this.set.length;N++)if(d(this.set[N],A,this.options))return!0;return!1}}e.exports=i;var s=Kx(),f=new s,n=Lh(),v=ju(),b=Tu(),h=Cr(),{safeRe:m,t:l,comparatorTrimReplace:w,tildeTrimReplace:p,caretTrimReplace:y}=jo(),{FLAG_INCLUDE_PRERELEASE:M,FLAG_LOOSE:E}=Ou(),R=o(x=>x.value==="<0.0.0-0","YT"),I=o(x=>x.value==="","XL"),T=o((x,A)=>{let N=!0,S=x.slice(),c=S.pop();for(;N&&S.length;)N=S.every(_=>c.intersects(_,A)),c=S.pop();return N},"OT"),P=o((x,A)=>(b("comp",x,A),x=Z(x,A),b("caret",x),x=L(x,A),b("tildes",x),x=F(x,A),b("xrange",x),x=a(x,A),b("stars",x),x),"AL"),j=o(x=>!x||x.toLowerCase()==="x"||x==="*","T4"),L=o((x,A)=>x.trim().split(/\s+/).map(N=>U(N,A)).join(" "),"wL"),U=o((x,A)=>{let N=A.loose?m[l.TILDELOOSE]:m[l.TILDE];return x.replace(N,(S,c,_,C,O)=>{b("tilde",x,S,c,_,C,O);let D;return j(c)?D="":j(_)?D=`>=${c}.0.0 <${+c+1}.0.0-0`:j(C)?D=`>=${c}.${_}.0 <${c}.${+_+1}.0-0`:O?(b("replaceTilde pr",O),D=`>=${c}.${_}.${C}-${O} <${c}.${+_+1}.0-0`):D=`>=${c}.${_}.${C} <${c}.${+_+1}.0-0`,b("tilde return",D),D})},"GL"),Z=o((x,A)=>x.trim().split(/\s+/).map(N=>ne(N,A)).join(" "),"kL"),ne=o((x,A)=>{b("caret",x,A);let N=A.loose?m[l.CARETLOOSE]:m[l.CARET],S=A.includePrerelease?"-0":"";return x.replace(N,(c,_,C,O,D)=>{b("caret",x,c,_,C,O,D);let B;return j(_)?B="":j(C)?B=`>=${_}.0.0${S} <${+_+1}.0.0-0`:j(O)?_==="0"?B=`>=${_}.${C}.0${S} <${_}.${+C+1}.0-0`:B=`>=${_}.${C}.0${S} <${+_+1}.0.0-0`:D?(b("replaceCaret pr",D),_==="0"?C==="0"?B=`>=${_}.${C}.${O}-${D} <${_}.${C}.${+O+1}-0`:B=`>=${_}.${C}.${O}-${D} <${_}.${+C+1}.0-0`:B=`>=${_}.${C}.${O}-${D} <${+_+1}.0.0-0`):(b("no pr"),_==="0"?C==="0"?B=`>=${_}.${C}.${O}${S} <${_}.${C}.${+O+1}-0`:B=`>=${_}.${C}.${O}${S} <${_}.${+C+1}.0-0`:B=`>=${_}.${C}.${O} <${+_+1}.0.0-0`),b("caret return",B),B})},"ZL"),F=o((x,A)=>(b("replaceXRanges",x,A),x.split(/\s+/).map(N=>Y(N,A)).join(" ")),"VL"),Y=o((x,A)=>{x=x.trim();let N=A.loose?m[l.XRANGELOOSE]:m[l.XRANGE];return x.replace(N,(S,c,_,C,O,D)=>{b("xRange",x,S,c,_,C,O,D);let B=j(_),z=B||j(C),G=z||j(O),te=G;return c==="="&&te&&(c=""),D=A.includePrerelease?"-0":"",B?c===">"||c==="<"?S="<0.0.0-0":S="*":c&&te?(z&&(C=0),O=0,c===">"?(c=">=",z?(_=+_+1,C=0,O=0):(C=+C+1,O=0)):c==="<="&&(c="<",z?_=+_+1:C=+C+1),c==="<"&&(D="-0"),S=`${c+_}.${C}.${O}${D}`):z?S=`>=${_}.0.0${D} <${+_+1}.0.0-0`:G&&(S=`>=${_}.${C}.0${D} <${_}.${+C+1}.0-0`),b("xRange return",S),S})},"ML"),a=o((x,A)=>(b("replaceStars",x,A),x.trim().replace(m[l.STAR],"")),"SL"),g=o((x,A)=>(b("replaceGTE0",x,A),x.trim().replace(m[A.includePrerelease?l.GTE0PRE:l.GTE0],"")),"CL"),u=o(x=>(A,N,S,c,_,C,O,D,B,z,G,te)=>(j(S)?N="":j(c)?N=`>=${S}.0.0${x?"-0":""}`:j(_)?N=`>=${S}.${c}.0${x?"-0":""}`:C?N=`>=${N}`:N=`>=${N}${x?"-0":""}`,j(B)?D="":j(z)?D=`<${+B+1}.0.0-0`:j(G)?D=`<${B}.${+z+1}.0-0`:te?D=`<=${B}.${z}.${G}-${te}`:x?D=`<${B}.${z}.${+G+1}-0`:D=`<=${D}`,`${N} ${D}`.trim()),"EL"),d=o((x,A,N)=>{for(let S=0;S<x.length;S++)if(!x[S].test(A))return!1;if(A.prerelease.length&&!N.includePrerelease){for(let S=0;S<x.length;S++)if(b(x[S].semver),x[S].semver!==v.ANY&&x[S].semver.prerelease.length>0){let c=x[S].semver;if(c.major===A.major&&c.minor===A.minor&&c.patch===A.patch)return!0}return!1}return!0},"NL")}),ju=ye((t,e)=>{var r=Symbol("SemVer ANY");class i{static{o(this,"v3")}static get ANY(){return r}constructor(w,p){if(p=s(p),w instanceof i){if(w.loose===!!p.loose)return w;w=w.value}w=w.trim().split(/\s+/).join(" "),b("comparator",w,p),this.options=p,this.loose=!!p.loose,this.parse(w),this.semver===r?this.value="":this.value=this.operator+this.semver.version,b("comp",this)}parse(w){let p=this.options.loose?f[n.COMPARATORLOOSE]:f[n.COMPARATOR],y=w.match(p);if(!y)throw TypeError(`Invalid comparator: ${w}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new h(y[2],this.options.loose):this.semver=r}toString(){return this.value}test(w){if(b("Comparator.test",w,this.options.loose),this.semver===r||w===r)return!0;if(typeof w=="string")try{w=new h(w,this.options)}catch{return!1}return v(w,this.operator,this.semver,this.options)}intersects(w,p){if(!(w instanceof i))throw TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new m(w.value,p).test(this.value):w.operator===""?w.value===""?!0:new m(this.value,p).test(w.semver):(p=s(p),p.includePrerelease&&(this.value==="<0.0.0-0"||w.value==="<0.0.0-0")||!p.includePrerelease&&(this.value.startsWith("<0.0.0")||w.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&w.operator.startsWith(">")||this.operator.startsWith("<")&&w.operator.startsWith("<")||this.semver.version===w.semver.version&&this.operator.includes("=")&&w.operator.includes("=")||v(this.semver,"<",w.semver,p)&&this.operator.startsWith(">")&&w.operator.startsWith("<")||v(this.semver,">",w.semver,p)&&this.operator.startsWith("<")&&w.operator.startsWith(">")))}}e.exports=i;var s=Lh(),{safeRe:f,t:n}=jo(),v=Nb(),b=Tu(),h=Cr(),m=hi()}),Lu=ye((t,e)=>{var r=hi(),i=o((s,f,n)=>{try{f=new r(f,n)}catch{return!1}return f.test(s)},"DL");e.exports=i}),Xx=ye((t,e)=>{var r=hi(),i=o((s,f)=>new r(s,f).set.map(n=>n.map(v=>v.value).join(" ").trim().split(" ")),"hL");e.exports=i}),Wx=ye((t,e)=>{var r=Cr(),i=hi(),s=o((f,n,v)=>{let b=null,h=null,m=null;try{m=new i(n,v)}catch{return null}return f.forEach(l=>{m.test(l)&&(!b||h.compare(l)===-1)&&(b=l,h=new r(b,v))}),b},"gL");e.exports=s}),$x=ye((t,e)=>{var r=Cr(),i=hi(),s=o((f,n,v)=>{let b=null,h=null,m=null;try{m=new i(n,v)}catch{return null}return f.forEach(l=>{m.test(l)&&(!b||h.compare(l)===1)&&(b=l,h=new r(b,v))}),b},"pL");e.exports=s}),Jx=ye((t,e)=>{var r=Cr(),i=hi(),s=Pu(),f=o((n,v)=>{n=new i(n,v);let b=new r("0.0.0");if(n.test(b)||(b=new r("0.0.0-0"),n.test(b)))return b;b=null;for(let h=0;h<n.set.length;++h){let m=n.set[h],l=null;m.forEach(w=>{let p=new r(w.semver.version);switch(w.operator){case">":p.prerelease.length===0?p.patch++:p.prerelease.push(0),p.raw=p.format();case"":case">=":(!l||s(p,l))&&(l=p);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${w.operator}`)}}),l&&(!b||s(b,l))&&(b=l)}return b&&n.test(b)?b:null},"uL");e.exports=f}),qx=ye((t,e)=>{var r=hi(),i=o((s,f)=>{try{return new r(s,f).range||"*"}catch{return null}},"dL");e.exports=i}),Uh=ye((t,e)=>{var r=Cr(),i=ju(),{ANY:s}=i,f=hi(),n=Lu(),v=Pu(),b=Bh(),h=Fh(),m=zh(),l=o((w,p,y,M)=>{w=new r(w,M),p=new f(p,M);let E,R,I,T,P;switch(y){case">":E=v,R=h,I=b,T=">",P=">=";break;case"<":E=b,R=m,I=v,T="<",P="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(n(w,p,M))return!1;for(let j=0;j<p.set.length;++j){let L=p.set[j],U=null,Z=null;if(L.forEach(ne=>{ne.semver===s&&(ne=new i(">=0.0.0")),U=U||ne,Z=Z||ne,E(ne.semver,U.semver,M)?U=ne:I(ne.semver,Z.semver,M)&&(Z=ne)}),U.operator===T||U.operator===P||(!Z.operator||Z.operator===T)&&R(w,Z.semver))return!1;if(Z.operator===P&&I(w,Z.semver))return!1}return!0},"FL");e.exports=l}),e5=ye((t,e)=>{var r=Uh(),i=o((s,f,n)=>r(s,f,">",n),"iL");e.exports=i}),t5=ye((t,e)=>{var r=Uh(),i=o((s,f,n)=>r(s,f,"<",n),"aL");e.exports=i}),r5=ye((t,e)=>{var r=hi(),i=o((s,f,n)=>(s=new r(s,n),f=new r(f,n),s.intersects(f,n)),"eL");e.exports=i}),i5=ye((t,e)=>{var r=Lu(),i=di();e.exports=(s,f,n)=>{let v=[],b=null,h=null,m=s.sort((y,M)=>i(y,M,n));for(let y of m)r(y,f,n)?(h=y,!b&&(b=y)):(h&&v.push([b,h]),h=null,b=null);b&&v.push([b,null]);let l=[];for(let[y,M]of v)y===M?l.push(y):!M&&y===m[0]?l.push("*"):M?y===m[0]?l.push(`<=${M}`):l.push(`${y} - ${M}`):l.push(`>=${y}`);let w=l.join(" || "),p=typeof f.raw=="string"?f.raw:String(f);return w.length<p.length?w:f}}),n5=ye((t,e)=>{var r=hi(),i=ju(),{ANY:s}=i,f=Lu(),n=di(),v=o((p,y,M={})=>{if(p===y)return!0;p=new r(p,M),y=new r(y,M);let E=!1;e:for(let R of p.set){for(let I of y.set){let T=m(R,I,M);if(E=E||T!==null,T)continue e}if(E)return!1}return!0},"$b"),b=[new i(">=0.0.0-0")],h=[new i(">=0.0.0")],m=o((p,y,M)=>{if(p===y)return!0;if(p.length===1&&p[0].semver===s){if(y.length===1&&y[0].semver===s)return!0;M.includePrerelease?p=b:p=h}if(y.length===1&&y[0].semver===s){if(M.includePrerelease)return!0;y=h}let E=new Set,R,I;for(let F of p)F.operator===">"||F.operator===">="?R=l(R,F,M):F.operator==="<"||F.operator==="<="?I=w(I,F,M):E.add(F.semver);if(E.size>1)return null;let T;if(R&&I){if(T=n(R.semver,I.semver,M),T>0)return null;if(T===0&&(R.operator!==">="||I.operator!=="<="))return null}for(let F of E){if(R&&!f(F,String(R),M)||I&&!f(F,String(I),M))return null;for(let Y of y)if(!f(F,String(Y),M))return!1;return!0}let P,j,L,U,Z=I&&!M.includePrerelease&&I.semver.prerelease.length?I.semver:!1,ne=R&&!M.includePrerelease&&R.semver.prerelease.length?R.semver:!1;Z&&Z.prerelease.length===1&&I.operator==="<"&&Z.prerelease[0]===0&&(Z=!1);for(let F of y){if(U=U||F.operator===">"||F.operator===">=",L=L||F.operator==="<"||F.operator==="<=",R){if(ne&&F.semver.prerelease&&F.semver.prerelease.length&&F.semver.major===ne.major&&F.semver.minor===ne.minor&&F.semver.patch===ne.patch&&(ne=!1),F.operator===">"||F.operator===">="){if(P=l(R,F,M),P===F&&P!==R)return!1}else if(R.operator===">="&&!f(R.semver,String(F),M))return!1}if(I){if(Z&&F.semver.prerelease&&F.semver.prerelease.length&&F.semver.major===Z.major&&F.semver.minor===Z.minor&&F.semver.patch===Z.patch&&(Z=!1),F.operator==="<"||F.operator==="<="){if(j=w(I,F,M),j===F&&j!==I)return!1}else if(I.operator==="<="&&!f(I.semver,String(F),M))return!1}if(!F.operator&&(I||R)&&T!==0)return!1}return!(R&&L&&!I&&T!==0||I&&U&&!R&&T!==0||ne||Z)},"_b"),l=o((p,y,M)=>{if(!p)return y;let E=n(p.semver,y.semver,M);return E>0?p:E<0||y.operator===">"&&p.operator===">="?y:p},"lT"),w=o((p,y,M)=>{if(!p)return y;let E=n(p.semver,y.semver,M);return E<0?p:E>0||y.operator==="<"&&p.operator==="<="?y:p},"BT");e.exports=v}),s5=ye((t,e)=>{var r=jo(),i=Ou(),s=Cr(),f=Eb(),n=$s(),v=jx(),b=Lx(),h=Dx(),m=Bx(),l=zx(),w=Fx(),p=Ux(),y=Hx(),M=di(),E=Vx(),R=Zx(),I=Dh(),T=Gx(),P=Yx(),j=Pu(),L=Bh(),U=Ab(),Z=kb(),ne=zh(),F=Fh(),Y=Nb(),a=Qx(),g=ju(),u=hi(),d=Lu(),x=Xx(),A=Wx(),N=$x(),S=Jx(),c=qx(),_=Uh(),C=e5(),O=t5(),D=r5(),B=i5(),z=n5();e.exports={parse:n,valid:v,clean:b,inc:h,diff:m,major:l,minor:w,patch:p,prerelease:y,compare:M,rcompare:E,compareLoose:R,compareBuild:I,sort:T,rsort:P,gt:j,lt:L,eq:U,neq:Z,gte:ne,lte:F,cmp:Y,coerce:a,Comparator:g,Range:u,satisfies:d,toComparators:x,maxSatisfying:A,minSatisfying:N,minVersion:S,validRange:c,outside:_,gtr:C,ltr:O,intersects:D,simplifyRange:B,subset:z,SemVer:s,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:i.SEMVER_SPEC_VERSION,RELEASE_TYPES:i.RELEASE_TYPES,compareIdentifiers:f.compareIdentifiers,rcompareIdentifiers:f.rcompareIdentifiers}}),a5=ye((t,e)=>{e.exports=function(r,i){if(typeof r!="string")throw TypeError("Expected a string");return i=typeof i>"u"?"_":i,r.replace(/([a-z\d])([A-Z])/g,"$1"+i+"$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g,"$1"+i+"$2").toLowerCase()}}),o5=ye((t,e)=>{var r=/[\p{Lu}]/u,i=/[\p{Ll}]/u,s=/^[\p{Lu}](?![\p{Lu}])/gu,f=/([\p{Alpha}\p{N}_]|$)/u,n=/[_.\- ]+/,v=new RegExp("^"+n.source),b=new RegExp(n.source+f.source,"gu"),h=new RegExp("\\d+"+f.source,"gu"),m=o((y,M,E)=>{let R=!1,I=!1,T=!1;for(let P=0;P<y.length;P++){let j=y[P];R&&r.test(j)?(y=y.slice(0,P)+"-"+y.slice(P),R=!1,T=I,I=!0,P++):I&&T&&i.test(j)?(y=y.slice(0,P-1)+"-"+y.slice(P-1),T=I,I=!1,R=!0):(R=M(j)===j&&E(j)!==j,T=I,I=E(j)===j&&M(j)!==j)}return y},"Jg"),l=o((y,M)=>(s.lastIndex=0,y.replace(s,E=>M(E))),"zg"),w=o((y,M)=>(b.lastIndex=0,h.lastIndex=0,y.replace(b,(E,R)=>M(R)).replace(h,E=>M(E))),"fg"),p=o((y,M)=>{if(!(typeof y=="string"||Array.isArray(y)))throw TypeError("Expected the input to be `string | string[]`");if(M={pascalCase:!1,preserveConsecutiveUppercase:!1,...M},Array.isArray(y)?y=y.map(I=>I.trim()).filter(I=>I.length).join("-"):y=y.trim(),y.length===0)return"";let E=M.locale===!1?I=>I.toLowerCase():I=>I.toLocaleLowerCase(M.locale),R=M.locale===!1?I=>I.toUpperCase():I=>I.toLocaleUpperCase(M.locale);return y.length===1?M.pascalCase?R(y):E(y):(y!==E(y)&&(y=m(y,E,R)),y=y.replace(v,""),M.preserveConsecutiveUppercase?y=l(y,E):y=E(y),M.pascalCase&&(y=R(y.charAt(0))+y.slice(1)),w(y,R))},"AX");e.exports=p,e.exports.default=p}),l5=ye((t,e)=>{var r=o((f=0)=>n=>`\x1B[${38+f};5;${n}m`,"EX"),i=o((f=0)=>(n,v,b)=>`\x1B[${38+f};2;${n};${v};${b}m`,"NX");function s(){let f=new Map,n={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};n.color.gray=n.color.blackBright,n.bgColor.bgGray=n.bgColor.bgBlackBright,n.color.grey=n.color.blackBright,n.bgColor.bgGrey=n.bgColor.bgBlackBright;for(let[v,b]of Object.entries(n)){for(let[h,m]of Object.entries(b))n[h]={open:`\x1B[${m[0]}m`,close:`\x1B[${m[1]}m`},b[h]=n[h],f.set(m[0],m[1]);Object.defineProperty(n,v,{value:b,enumerable:!1})}return Object.defineProperty(n,"codes",{value:f,enumerable:!1}),n.color.close="\x1B[39m",n.bgColor.close="\x1B[49m",n.color.ansi256=r(),n.color.ansi16m=i(),n.bgColor.ansi256=r(10),n.bgColor.ansi16m=i(10),Object.defineProperties(n,{rgbToAnsi256:{value:o((v,b,h)=>v===b&&b===h?v<8?16:v>248?231:Math.round((v-8)/247*24)+232:16+36*Math.round(v/255*5)+6*Math.round(b/255*5)+Math.round(h/255*5),"value"),enumerable:!1},hexToRgb:{value:o(v=>{let b=/(?<colorString>[a-f\d]{6}|[a-f\d]{3})/i.exec(v.toString(16));if(!b)return[0,0,0];let{colorString:h}=b.groups;h.length===3&&(h=h.split("").map(l=>l+l).join(""));let m=Number.parseInt(h,16);return[m>>16&255,m>>8&255,m&255]},"value"),enumerable:!1},hexToAnsi256:{value:o(v=>n.rgbToAnsi256(...n.hexToRgb(v)),"value"),enumerable:!1}}),n}o(s,"Vg"),Object.defineProperty(e,"exports",{enumerable:!0,get:s})}),u5=ye(t=>{t.byteLength=b,t.toByteArray=m,t.fromByteArray=p;var e=[],r=[],i=typeof Uint8Array<"u"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(f=0,n=s.length;f<n;++f)e[f]=s[f],r[s.charCodeAt(f)]=f;var f,n;r[45]=62,r[95]=63;function v(y){var M=y.length;if(M%4>0)throw Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=M);var R=E===M?0:4-E%4;return[E,R]}o(v,"jw");function b(y){var M=v(y),E=M[0],R=M[1];return(E+R)*3/4-R}o(b,"Ey");function h(y,M,E){return(M+E)*3/4-E}o(h,"Ny");function m(y){var M,E=v(y),R=E[0],I=E[1],T=new i(h(y,R,I)),P=0,j=I>0?R-4:R,L;for(L=0;L<j;L+=4)M=r[y.charCodeAt(L)]<<18|r[y.charCodeAt(L+1)]<<12|r[y.charCodeAt(L+2)]<<6|r[y.charCodeAt(L+3)],T[P++]=M>>16&255,T[P++]=M>>8&255,T[P++]=M&255;return I===2&&(M=r[y.charCodeAt(L)]<<2|r[y.charCodeAt(L+1)]>>4,T[P++]=M&255),I===1&&(M=r[y.charCodeAt(L)]<<10|r[y.charCodeAt(L+1)]<<4|r[y.charCodeAt(L+2)]>>2,T[P++]=M>>8&255,T[P++]=M&255),T}o(m,"Ry");function l(y){return e[y>>18&63]+e[y>>12&63]+e[y>>6&63]+e[y&63]}o(l,"Dy");function w(y,M,E){for(var R,I=[],T=M;T<E;T+=3)R=(y[T]<<16&16711680)+(y[T+1]<<8&65280)+(y[T+2]&255),I.push(l(R));return I.join("")}o(w,"Iy");function p(y){for(var M,E=y.length,R=E%3,I=[],T=16383,P=0,j=E-R;P<j;P+=T)I.push(w(y,P,P+T>j?j:P+T));return R===1?(M=y[E-1],I.push(e[M>>2]+e[M<<4&63]+"==")):R===2&&(M=(y[E-2]<<8)+y[E-1],I.push(e[M>>10]+e[M>>4&63]+e[M<<2&63]+"=")),I.join("")}o(p,"hy")}),Pr=ye(t=>{t.__esModule=!0,t.extend=f,t.indexOf=h,t.escapeExpression=m,t.isEmpty=l,t.createFrame=w,t.blockParams=p,t.appendContextPath=y;var e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},r=/[&<>"'`=]/g,i=/[&<>"'`=]/;function s(M){return e[M]}o(s,"Uy");function f(M){for(var E=1;E<arguments.length;E++)for(var R in arguments[E])Object.prototype.hasOwnProperty.call(arguments[E],R)&&(M[R]=arguments[E][R]);return M}o(f,"zw");var n=Object.prototype.toString;t.toString=n;var v=o(function(M){return typeof M=="function"},"gj");v(/x/)&&(t.isFunction=v=o(function(M){return typeof M=="function"&&n.call(M)==="[object Function]"},"gj")),t.isFunction=v;var b=Array.isArray||function(M){return M&&typeof M=="object"?n.call(M)==="[object Array]":!1};t.isArray=b;function h(M,E){for(var R=0,I=M.length;R<I;R++)if(M[R]===E)return R;return-1}o(h,"ry");function m(M){if(typeof M!="string"){if(M&&M.toHTML)return M.toHTML();if(M==null)return"";if(!M)return M+"";M=""+M}return i.test(M)?M.replace(r,s):M}o(m,"Fy");function l(M){return!M&&M!==0?!0:!!(b(M)&&M.length===0)}o(l,"Qy");function w(M){var E=f({},M);return E._parent=M,E}o(w,"iy");function p(M,E){return M.path=E,M}o(p,"ty");function y(M,E){return(M?M+".":"")+E}o(y,"ay")}),pi=ye((t,e)=>{t.__esModule=!0;var r=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function i(s,f){var n=f&&f.loc,v=void 0,b=void 0,h=void 0,m=void 0;n&&(v=n.start.line,b=n.end.line,h=n.start.column,m=n.end.column,s+=" - "+v+":"+h);for(var l=Error.prototype.constructor.call(this,s),w=0;w<r.length;w++)this[r[w]]=l[r[w]];Error.captureStackTrace&&Error.captureStackTrace(this,i);try{n&&(this.lineNumber=v,this.endLineNumber=b,Object.defineProperty?(Object.defineProperty(this,"column",{value:h,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:m,enumerable:!0})):(this.column=h,this.endColumn=m))}catch{}}o(i,"pj"),i.prototype=Error(),t.default=i,e.exports=t.default}),c5=ye((t,e)=>{t.__esModule=!0;var r=Pr();t.default=function(i){i.registerHelper("blockHelperMissing",function(s,f){var{inverse:n,fn:v}=f;if(s===!0)return v(this);if(s===!1||s==null)return n(this);if(r.isArray(s))return s.length>0?(f.ids&&(f.ids=[f.name]),i.helpers.each(s,f)):n(this);if(f.data&&f.ids){var b=r.createFrame(f.data);b.contextPath=r.appendContextPath(f.data.contextPath,f.name),f={data:b}}return v(s,f)})},e.exports=t.default}),f5=ye((t,e)=>{t.__esModule=!0;function r(n){return n&&n.__esModule?n:{default:n}}o(r,"Tx");var i=Pr(),s=pi(),f=r(s);t.default=function(n){n.registerHelper("each",function(v,b){if(!b)throw new f.default("Must pass iterator to #each");var{fn:h,inverse:m}=b,l=0,w="",p=void 0,y=void 0;b.data&&b.ids&&(y=i.appendContextPath(b.data.contextPath,b.ids[0])+"."),i.isFunction(v)&&(v=v.call(this)),b.data&&(p=i.createFrame(b.data));function M(P,j,L){p&&(p.key=P,p.index=j,p.first=j===0,p.last=!!L,y&&(p.contextPath=y+P)),w=w+h(v[P],{data:p,blockParams:i.blockParams([v[P],P],[y+P,null])})}if(o(M,"w"),v&&typeof v=="object")if(i.isArray(v))for(var E=v.length;l<E;l++)l in v&&M(l,l,l===v.length-1);else if(typeof Symbol=="function"&&v[Symbol.iterator]){for(var R=[],I=v[Symbol.iterator](),T=I.next();!T.done;T=I.next())R.push(T.value);v=R;for(var E=v.length;l<E;l++)M(l,l,l===v.length-1)}else(function(){var P=void 0;Object.keys(v).forEach(function(j){P!==void 0&&M(P,l-1),P=j,l++}),P!==void 0&&M(P,l-1,!0)})();return l===0&&(w=m(this)),w})},e.exports=t.default}),d5=ye((t,e)=>{t.__esModule=!0;function r(f){return f&&f.__esModule?f:{default:f}}o(r,"kx");var i=pi(),s=r(i);t.default=function(f){f.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new s.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},e.exports=t.default}),h5=ye((t,e)=>{t.__esModule=!0;function r(n){return n&&n.__esModule?n:{default:n}}o(r,"Cx");var i=Pr(),s=pi(),f=r(s);t.default=function(n){n.registerHelper("if",function(v,b){if(arguments.length!=2)throw new f.default("#if requires exactly one argument");return i.isFunction(v)&&(v=v.call(this)),!b.hash.includeZero&&!v||i.isEmpty(v)?b.inverse(this):b.fn(this)}),n.registerHelper("unless",function(v,b){if(arguments.length!=2)throw new f.default("#unless requires exactly one argument");return n.helpers.if.call(this,v,{fn:b.inverse,inverse:b.fn,hash:b.hash})})},e.exports=t.default}),p5=ye((t,e)=>{t.__esModule=!0,t.default=function(r){r.registerHelper("log",function(){for(var i=[void 0],s=arguments[arguments.length-1],f=0;f<arguments.length-1;f++)i.push(arguments[f]);var n=1;s.hash.level!=null?n=s.hash.level:s.data&&s.data.level!=null&&(n=s.data.level),i[0]=n,r.log.apply(r,i)})},e.exports=t.default}),m5=ye((t,e)=>{t.__esModule=!0,t.default=function(r){r.registerHelper("lookup",function(i,s,f){return i&&f.lookupProperty(i,s)})},e.exports=t.default}),g5=ye((t,e)=>{t.__esModule=!0;function r(n){return n&&n.__esModule?n:{default:n}}o(r,"bx");var i=Pr(),s=pi(),f=r(s);t.default=function(n){n.registerHelper("with",function(v,b){if(arguments.length!=2)throw new f.default("#with requires exactly one argument");i.isFunction(v)&&(v=v.call(this));var h=b.fn;if(i.isEmpty(v))return b.inverse(this);var m=b.data;return b.data&&b.ids&&(m=i.createFrame(b.data),m.contextPath=i.appendContextPath(b.data.contextPath,b.ids[0])),h(v,{data:m,blockParams:i.blockParams([v],[m&&m.contextPath])})})},e.exports=t.default}),Cb=ye(t=>{t.__esModule=!0,t.registerDefaultHelpers=E,t.moveHelperToHooks=R;function e(I){return I&&I.__esModule?I:{default:I}}o(e,"e7");var r=c5(),i=e(r),s=f5(),f=e(s),n=d5(),v=e(n),b=h5(),h=e(b),m=p5(),l=e(m),w=m5(),p=e(w),y=g5(),M=e(y);function E(I){i.default(I),f.default(I),v.default(I),h.default(I),l.default(I),p.default(I),M.default(I)}o(E,"ax");function R(I,T,P){I.helpers[T]&&(I.hooks[T]=I.helpers[T],!P&&delete I.helpers[T])}o(R,"ex")}),v5=ye((t,e)=>{t.__esModule=!0;var r=Pr();t.default=function(i){i.registerDecorator("inline",function(s,f,n,v){var b=s;return f.partials||(f.partials={},b=o(function(h,m){var l=n.partials;n.partials=r.extend({},l,f.partials);var w=s(h,m);return n.partials=l,w},"O")),f.partials[v.args[0]]=v.fn,b})},e.exports=t.default}),b5=ye(t=>{t.__esModule=!0,t.registerDefaultDecorators=s;function e(f){return f&&f.__esModule?f:{default:f}}o(e,"Op");var r=v5(),i=e(r);function s(f){i.default(f)}o(s,"Hp")}),Rb=ye((t,e)=>{t.__esModule=!0;var r=Pr(),i={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:o(function(s){if(typeof s=="string"){var f=r.indexOf(i.methodMap,s.toLowerCase());f>=0?s=f:s=parseInt(s,10)}return s},"lookupLevel"),log:o(function(s){if(s=i.lookupLevel(s),typeof console<"u"&&i.lookupLevel(i.level)<=s){var f=i.methodMap[s];console[f]||(f="log");for(var n=arguments.length,v=Array(n>1?n-1:0),b=1;b<n;b++)v[b-1]=arguments[b];console[f].apply(console,v)}},"log")};t.default=i,e.exports=t.default}),y5=ye(t=>{t.__esModule=!0,t.createNewLookupObject=r;var e=Pr();function r(){for(var i=arguments.length,s=Array(i),f=0;f<i;f++)s[f]=arguments[f];return e.extend.apply(void 0,[Object.create(null)].concat(s))}o(r,"wp")}),Ib=ye(t=>{t.__esModule=!0,t.createProtoAccessControl=n,t.resultIsAllowed=v,t.resetLoggedProperties=m;function e(l){return l&&l.__esModule?l:{default:l}}o(e,"Vp");var r=y5(),i=Rb(),s=e(i),f=Object.create(null);function n(l){var w=Object.create(null);w.constructor=!1,w.__defineGetter__=!1,w.__defineSetter__=!1,w.__lookupGetter__=!1;var p=Object.create(null);return p.__proto__=!1,{properties:{whitelist:r.createNewLookupObject(p,l.allowedProtoProperties),defaultValue:l.allowProtoPropertiesByDefault},methods:{whitelist:r.createNewLookupObject(w,l.allowedProtoMethods),defaultValue:l.allowProtoMethodsByDefault}}}o(n,"Cp");function v(l,w,p){return b(typeof l=="function"?w.methods:w.properties,p)}o(v,"Ep");function b(l,w){return l.whitelist[w]!==void 0?l.whitelist[w]===!0:l.defaultValue!==void 0?l.defaultValue:(h(w),!1)}o(b,"rw");function h(l){f[l]!==!0&&(f[l]=!0,s.default.log("error",'Handlebars: Access has been denied to resolve the property "'+l+`" because it is not an "own property" of its parent.
|
|
2
|
-
You can add a runtime option to disable the check or this warning:
|
|
3
|
-
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}o(h,"Np");function m(){Object.keys(f).forEach(function(l){delete f[l]})}o(m,"Rp")}),Hh=ye(t=>{t.__esModule=!0,t.HandlebarsEnvironment=M;function e(R){return R&&R.__esModule?R:{default:R}}o(e,"Fw");var r=Pr(),i=pi(),s=e(i),f=Cb(),n=b5(),v=Rb(),b=e(v),h=Ib(),m="4.7.8";t.VERSION=m;var l=8;t.COMPILER_REVISION=l;var w=7;t.LAST_COMPATIBLE_COMPILER_REVISION=w;var p={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};t.REVISION_CHANGES=p;var y="[object Object]";function M(R,I,T){this.helpers=R||{},this.partials=I||{},this.decorators=T||{},f.registerDefaultHelpers(this),n.registerDefaultDecorators(this)}o(M,"oj"),M.prototype={constructor:M,logger:b.default,log:b.default.log,registerHelper:o(function(R,I){if(r.toString.call(R)===y){if(I)throw new s.default("Arg not supported with multiple helpers");r.extend(this.helpers,R)}else this.helpers[R]=I},"registerHelper"),unregisterHelper:o(function(R){delete this.helpers[R]},"unregisterHelper"),registerPartial:o(function(R,I){if(r.toString.call(R)===y)r.extend(this.partials,R);else{if(typeof I>"u")throw new s.default('Attempting to register a partial called "'+R+'" as undefined');this.partials[R]=I}},"registerPartial"),unregisterPartial:o(function(R){delete this.partials[R]},"unregisterPartial"),registerDecorator:o(function(R,I){if(r.toString.call(R)===y){if(I)throw new s.default("Arg not supported with multiple decorators");r.extend(this.decorators,R)}else this.decorators[R]=I},"registerDecorator"),unregisterDecorator:o(function(R){delete this.decorators[R]},"unregisterDecorator"),resetLoggedPropertyAccesses:o(function(){h.resetLoggedProperties()},"resetLoggedPropertyAccesses")};var E=b.default.log;t.log=E,t.createFrame=r.createFrame,t.logger=b.default}),w5=ye((t,e)=>{t.__esModule=!0;function r(i){this.string=i}o(r,"nj"),r.prototype.toString=r.prototype.toHTML=function(){return""+this.string},t.default=r,e.exports=t.default}),x5=ye(t=>{t.__esModule=!0,t.wrapHelper=e;function e(r,i){if(typeof r!="function")return r;var s=o(function(){var f=arguments[arguments.length-1];return arguments[arguments.length-1]=i(f),r.apply(this,arguments)},"K");return s}o(e,"$c")}),_5=ye(t=>{t.__esModule=!0,t.checkRevision=l,t.template=w,t.wrapProgram=p,t.resolvePartial=y,t.invokePartial=M,t.noop=E;function e(j){return j&&j.__esModule?j:{default:j}}o(e,"Yc");function r(j){if(j&&j.__esModule)return j;var L={};if(j!=null)for(var U in j)Object.prototype.hasOwnProperty.call(j,U)&&(L[U]=j[U]);return L.default=j,L}o(r,"Oc");var i=Pr(),s=r(i),f=pi(),n=e(f),v=Hh(),b=Cb(),h=x5(),m=Ib();function l(j){var L=j&&j[0]||1,U=v.COMPILER_REVISION;if(!(L>=v.LAST_COMPATIBLE_COMPILER_REVISION&&L<=v.COMPILER_REVISION))if(L<v.LAST_COMPATIBLE_COMPILER_REVISION){var Z=v.REVISION_CHANGES[U],ne=v.REVISION_CHANGES[L];throw new n.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+Z+") or downgrade your runtime to an older version ("+ne+").")}else throw new n.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+j[1]+").")}o(l,"Jc");function w(j,L){if(!L)throw new n.default("No environment passed to template");if(!j||!j.main)throw new n.default("Unknown template object: "+typeof j);j.main.decorator=j.main_d,L.VM.checkRevision(j.compiler);var U=j.compiler&&j.compiler[0]===7;function Z(Y,a,g){g.hash&&(a=s.extend({},a,g.hash),g.ids&&(g.ids[0]=!0)),Y=L.VM.resolvePartial.call(this,Y,a,g);var u=s.extend({},g,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),d=L.VM.invokePartial.call(this,Y,a,u);if(d==null&&L.compile&&(g.partials[g.name]=L.compile(Y,j.compilerOptions,L),d=g.partials[g.name](a,u)),d!=null){if(g.indent){for(var x=d.split(`
|
|
4
|
-
`),A=0,N=x.length;A<N&&!(!x[A]&&A+1===N);A++)x[A]=g.indent+x[A];d=x.join(`
|
|
5
|
-
`)}return d}else throw new n.default("The partial "+g.name+" could not be compiled when running in runtime-only mode")}o(Z,"_");var ne={strict:o(function(Y,a,g){if(!Y||!(a in Y))throw new n.default('"'+a+'" not defined in '+Y,{loc:g});return ne.lookupProperty(Y,a)},"strict"),lookupProperty:o(function(Y,a){var g=Y[a];if(g==null||Object.prototype.hasOwnProperty.call(Y,a)||m.resultIsAllowed(g,ne.protoAccessControl,a))return g},"lookupProperty"),lookup:o(function(Y,a){for(var g=Y.length,u=0;u<g;u++){var d=Y[u]&&ne.lookupProperty(Y[u],a);if(d!=null)return Y[u][a]}},"lookup"),lambda:o(function(Y,a){return typeof Y=="function"?Y.call(a):Y},"lambda"),escapeExpression:s.escapeExpression,invokePartial:Z,fn:o(function(Y){var a=j[Y];return a.decorator=j[Y+"_d"],a},"fn"),programs:[],program:o(function(Y,a,g,u,d){var x=this.programs[Y],A=this.fn(Y);return a||d||u||g?x=p(this,Y,A,a,g,u,d):x||(x=this.programs[Y]=p(this,Y,A)),x},"program"),data:o(function(Y,a){for(;Y&&a--;)Y=Y._parent;return Y},"data"),mergeIfNeeded:o(function(Y,a){var g=Y||a;return Y&&a&&Y!==a&&(g=s.extend({},a,Y)),g},"mergeIfNeeded"),nullContext:Object.seal({}),noop:L.VM.noop,compilerInfo:j.compiler};function F(Y){var a=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],g=a.data;F._setup(a),!a.partial&&j.useData&&(g=R(Y,g));var u=void 0,d=j.useBlockParams?[]:void 0;j.useDepths&&(a.depths?u=Y!=a.depths[0]?[Y].concat(a.depths):a.depths:u=[Y]);function x(A){return""+j.main(ne,A,ne.helpers,ne.partials,g,d,u)}return o(x,"Z"),x=I(j.main,x,ne,a.depths||[],g,d),x(Y,a)}return o(F,"O"),F.isTop=!0,F._setup=function(Y){if(Y.partial)ne.protoAccessControl=Y.protoAccessControl,ne.helpers=Y.helpers,ne.partials=Y.partials,ne.decorators=Y.decorators,ne.hooks=Y.hooks;else{var a=s.extend({},L.helpers,Y.helpers);T(a,ne),ne.helpers=a,j.usePartial&&(ne.partials=ne.mergeIfNeeded(Y.partials,L.partials)),(j.usePartial||j.useDecorators)&&(ne.decorators=s.extend({},L.decorators,Y.decorators)),ne.hooks={},ne.protoAccessControl=m.createProtoAccessControl(Y);var g=Y.allowCallsToHelperMissing||U;b.moveHelperToHooks(ne,"helperMissing",g),b.moveHelperToHooks(ne,"blockHelperMissing",g)}},F._child=function(Y,a,g,u){if(j.useBlockParams&&!g)throw new n.default("must pass block params");if(j.useDepths&&!u)throw new n.default("must pass parent depths");return p(ne,Y,j[Y],a,0,g,u)},F}o(w,"zc");function p(j,L,U,Z,ne,F,Y){function a(g){var u=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],d=Y;return Y&&g!=Y[0]&&!(g===j.nullContext&&Y[0]===null)&&(d=[g].concat(Y)),U(j,g,j.helpers,j.partials,u.data||Z,F&&[u.blockParams].concat(F),d)}return o(a,"z"),a=I(U,a,j,Y,Z,F),a.program=L,a.depth=Y?Y.length:0,a.blockParams=ne||0,a}o(p,"$P");function y(j,L,U){return j?!j.call&&!U.name&&(U.name=j,j=U.partials[j]):U.name==="@partial-block"?j=U.data["partial-block"]:j=U.partials[U.name],j}o(y,"fc");function M(j,L,U){var Z=U.data&&U.data["partial-block"];U.partial=!0,U.ids&&(U.data.contextPath=U.ids[0]||U.data.contextPath);var ne=void 0;if(U.fn&&U.fn!==E&&(function(){U.data=v.createFrame(U.data);var F=U.fn;ne=U.data["partial-block"]=function(Y){var a=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return a.data=v.createFrame(a.data),a.data["partial-block"]=Z,F(Y,a)},F.partials&&(U.partials=s.extend({},U.partials,F.partials))})(),j===void 0&&ne&&(j=ne),j===void 0)throw new n.default("The partial "+U.name+" could not be found");if(j instanceof Function)return j(L,U)}o(M,"vc");function E(){return""}o(E,"q0");function R(j,L){return(!L||!("root"in L))&&(L=L?v.createFrame(L):{},L.root=j),L}o(R,"Tc");function I(j,L,U,Z,ne,F){if(j.decorator){var Y={};L=j.decorator(L,Y,U,Z&&Z[0],ne,F,Z),s.extend(L,Y)}return L}o(I,"$0");function T(j,L){Object.keys(j).forEach(function(U){var Z=j[U];j[U]=P(Z,L)})}o(T,"Xc");function P(j,L){var U=L.lookupProperty;return h.wrapHelper(j,function(Z){return s.extend({lookupProperty:U},Z)})}o(P,"Ac")}),Ob=ye((t,e)=>{t.__esModule=!0,t.default=function(r){(function(){typeof globalThis!="object"&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var i=globalThis.Handlebars;r.noConflict=function(){return globalThis.Handlebars===r&&(globalThis.Handlebars=i),r}},e.exports=t.default}),M5=ye((t,e)=>{t.__esModule=!0;function r(I){return I&&I.__esModule?I:{default:I}}o(r,"Fj");function i(I){if(I&&I.__esModule)return I;var T={};if(I!=null)for(var P in I)Object.prototype.hasOwnProperty.call(I,P)&&(T[P]=I[P]);return T.default=I,T}o(i,"Qj");var s=Hh(),f=i(s),n=w5(),v=r(n),b=pi(),h=r(b),m=Pr(),l=i(m),w=_5(),p=i(w),y=Ob(),M=r(y);function E(){var I=new f.HandlebarsEnvironment;return l.extend(I,f),I.SafeString=v.default,I.Exception=h.default,I.Utils=l,I.escapeExpression=l.escapeExpression,I.VM=p,I.template=function(T){return p.template(T,I)},I}o(E,"j0");var R=E();R.create=E,M.default(R),R.default=R,t.default=R,e.exports=t.default}),Tb=ye((t,e)=>{t.__esModule=!0;var r={helpers:{helperExpression:o(function(i){return i.type==="SubExpression"||(i.type==="MustacheStatement"||i.type==="BlockStatement")&&!!(i.params&&i.params.length||i.hash)},"helperExpression"),scopedId:o(function(i){return/^\.|this\b/.test(i.original)},"scopedId"),simpleId:o(function(i){return i.parts.length===1&&!r.helpers.scopedId(i)&&!i.depth},"simpleId")}};t.default=r,e.exports=t.default}),S5=ye((t,e)=>{t.__esModule=!0;var r=(function(){var i={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:o(function(n,v,b,h,m,l,w){var p=l.length-1;switch(m){case 1:return l[p-1];case 2:this.$=h.prepareProgram(l[p]);break;case 3:this.$=l[p];break;case 4:this.$=l[p];break;case 5:this.$=l[p];break;case 6:this.$=l[p];break;case 7:this.$=l[p];break;case 8:this.$=l[p];break;case 9:this.$={type:"CommentStatement",value:h.stripComment(l[p]),strip:h.stripFlags(l[p],l[p]),loc:h.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:l[p],value:l[p],loc:h.locInfo(this._$)};break;case 11:this.$=h.prepareRawBlock(l[p-2],l[p-1],l[p],this._$);break;case 12:this.$={path:l[p-3],params:l[p-2],hash:l[p-1]};break;case 13:this.$=h.prepareBlock(l[p-3],l[p-2],l[p-1],l[p],!1,this._$);break;case 14:this.$=h.prepareBlock(l[p-3],l[p-2],l[p-1],l[p],!0,this._$);break;case 15:this.$={open:l[p-5],path:l[p-4],params:l[p-3],hash:l[p-2],blockParams:l[p-1],strip:h.stripFlags(l[p-5],l[p])};break;case 16:this.$={path:l[p-4],params:l[p-3],hash:l[p-2],blockParams:l[p-1],strip:h.stripFlags(l[p-5],l[p])};break;case 17:this.$={path:l[p-4],params:l[p-3],hash:l[p-2],blockParams:l[p-1],strip:h.stripFlags(l[p-5],l[p])};break;case 18:this.$={strip:h.stripFlags(l[p-1],l[p-1]),program:l[p]};break;case 19:var y=h.prepareBlock(l[p-2],l[p-1],l[p],l[p],!1,this._$),M=h.prepareProgram([y],l[p-1].loc);M.chained=!0,this.$={strip:l[p-2].strip,program:M,chain:!0};break;case 20:this.$=l[p];break;case 21:this.$={path:l[p-1],strip:h.stripFlags(l[p-2],l[p])};break;case 22:this.$=h.prepareMustache(l[p-3],l[p-2],l[p-1],l[p-4],h.stripFlags(l[p-4],l[p]),this._$);break;case 23:this.$=h.prepareMustache(l[p-3],l[p-2],l[p-1],l[p-4],h.stripFlags(l[p-4],l[p]),this._$);break;case 24:this.$={type:"PartialStatement",name:l[p-3],params:l[p-2],hash:l[p-1],indent:"",strip:h.stripFlags(l[p-4],l[p]),loc:h.locInfo(this._$)};break;case 25:this.$=h.preparePartialBlock(l[p-2],l[p-1],l[p],this._$);break;case 26:this.$={path:l[p-3],params:l[p-2],hash:l[p-1],strip:h.stripFlags(l[p-4],l[p])};break;case 27:this.$=l[p];break;case 28:this.$=l[p];break;case 29:this.$={type:"SubExpression",path:l[p-3],params:l[p-2],hash:l[p-1],loc:h.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:l[p],loc:h.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:h.id(l[p-2]),value:l[p],loc:h.locInfo(this._$)};break;case 32:this.$=h.id(l[p-1]);break;case 33:this.$=l[p];break;case 34:this.$=l[p];break;case 35:this.$={type:"StringLiteral",value:l[p],original:l[p],loc:h.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(l[p]),original:Number(l[p]),loc:h.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:l[p]==="true",original:l[p]==="true",loc:h.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:h.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:h.locInfo(this._$)};break;case 40:this.$=l[p];break;case 41:this.$=l[p];break;case 42:this.$=h.preparePath(!0,l[p],this._$);break;case 43:this.$=h.preparePath(!1,l[p],this._$);break;case 44:l[p-2].push({part:h.id(l[p]),original:l[p],separator:l[p-1]}),this.$=l[p-2];break;case 45:this.$=[{part:h.id(l[p]),original:l[p]}];break;case 46:this.$=[];break;case 47:l[p-1].push(l[p]);break;case 48:this.$=[];break;case 49:l[p-1].push(l[p]);break;case 50:this.$=[];break;case 51:l[p-1].push(l[p]);break;case 58:this.$=[];break;case 59:l[p-1].push(l[p]);break;case 64:this.$=[];break;case 65:l[p-1].push(l[p]);break;case 70:this.$=[];break;case 71:l[p-1].push(l[p]);break;case 78:this.$=[];break;case 79:l[p-1].push(l[p]);break;case 82:this.$=[];break;case 83:l[p-1].push(l[p]);break;case 86:this.$=[];break;case 87:l[p-1].push(l[p]);break;case 90:this.$=[];break;case 91:l[p-1].push(l[p]);break;case 94:this.$=[];break;case 95:l[p-1].push(l[p]);break;case 98:this.$=[l[p]];break;case 99:l[p-1].push(l[p]);break;case 100:this.$=[l[p]];break;case 101:l[p-1].push(l[p]);break}},"performAction"),table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:o(function(n,v){throw Error(n)},"parseError"),parse:o(function(n){var v=this,b=[0],h=[null],m=[],l=this.table,w="",p=0,y=0,M=0;this.lexer.setInput(n),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc>"u"&&(this.lexer.yylloc={});var E=this.lexer.yylloc;m.push(E);var R=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function I(){var g=v.lexer.lex()||1;return typeof g!="number"&&(g=v.symbols_[g]||g),g}o(I,"y");for(var T,P,j,L,U={},Z,ne,F,Y;;){if(P=b[b.length-1],this.defaultActions[P]?j=this.defaultActions[P]:((T===null||typeof T>"u")&&(T=I()),j=l[P]&&l[P][T]),typeof j>"u"||!j.length||!j[0]){var a="";{Y=[];for(Z in l[P])this.terminals_[Z]&&Z>2&&Y.push("'"+this.terminals_[Z]+"'");this.lexer.showPosition?a="Parse error on line "+(p+1)+`:
|
|
6
|
-
`+this.lexer.showPosition()+`
|
|
7
|
-
Expecting `+Y.join(", ")+", got '"+(this.terminals_[T]||T)+"'":a="Parse error on line "+(p+1)+": Unexpected "+(T==1?"end of input":"'"+(this.terminals_[T]||T)+"'"),this.parseError(a,{text:this.lexer.match,token:this.terminals_[T]||T,line:this.lexer.yylineno,loc:E,expected:Y})}}if(j[0]instanceof Array&&j.length>1)throw Error("Parse Error: multiple actions possible at state: "+P+", token: "+T);switch(j[0]){case 1:b.push(T),h.push(this.lexer.yytext),m.push(this.lexer.yylloc),b.push(j[1]),T=null,y=this.lexer.yyleng,w=this.lexer.yytext,p=this.lexer.yylineno,E=this.lexer.yylloc,M>0;break;case 2:if(ne=this.productions_[j[1]][1],U.$=h[h.length-ne],U._$={first_line:m[m.length-(ne||1)].first_line,last_line:m[m.length-1].last_line,first_column:m[m.length-(ne||1)].first_column,last_column:m[m.length-1].last_column},R&&(U._$.range=[m[m.length-(ne||1)].range[0],m[m.length-1].range[1]]),L=this.performAction.call(U,w,y,p,this.yy,j[1],h,m),typeof L<"u")return L;ne&&(b=b.slice(0,-1*ne*2),h=h.slice(0,-1*ne),m=m.slice(0,-1*ne)),b.push(this.productions_[j[1]][0]),h.push(U.$),m.push(U._$),F=l[b[b.length-2]][b[b.length-1]],b.push(F);break;case 3:return!0}}return!0},"parse")},s=(function(){var n={EOF:1,parseError:o(function(v,b){if(this.yy.parser)this.yy.parser.parseError(v,b);else throw Error(v)},"parseError"),setInput:o(function(v){return this._input=v,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var v=this._input[0];this.yytext+=v,this.yyleng++,this.offset++,this.match+=v,this.matched+=v;var b=v.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),v},"input"),unput:o(function(v){var b=v.length,h=v.split(/(?:\r\n?|\n)/g);this._input=v+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var l=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===m.length?this.yylloc.first_column:0)+m[m.length-h.length].length-h[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[l[0],l[0]+this.yyleng-b]),this},"unput"),more:o(function(){return this._more=!0,this},"more"),less:o(function(v){this.unput(this.match.slice(v))},"less"),pastInput:o(function(){var v=this.matched.substr(0,this.matched.length-this.match.length);return(v.length>20?"...":"")+v.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var v=this.match;return v.length<20&&(v+=this._input.substr(0,20-v.length)),(v.substr(0,20)+(v.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var v=this.pastInput(),b=Array(v.length+1).join("-");return v+this.upcomingInput()+`
|
|
8
|
-
`+b+"^"},"showPosition"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var v,b,h,m,l;this._more||(this.yytext="",this.match="");for(var w=this._currentRules(),p=0;p<w.length&&(h=this._input.match(this.rules[w[p]]),!(h&&(!b||h[0].length>b[0].length)&&(b=h,m=p,!this.options.flex)));p++);return b?(l=b[0].match(/(?:\r\n?|\n).*/g),l&&(this.yylineno+=l.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:l?l[l.length-1].length-l[l.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],v=this.performAction.call(this,this.yy,this,w[m],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
9
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var v=this.next();return typeof v<"u"?v:this.lex()},"lex"),begin:o(function(v){this.conditionStack.push(v)},"begin"),popState:o(function(){return this.conditionStack.pop()},"popState"),_currentRules:o(function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},"_currentRules"),topState:o(function(){return this.conditionStack[this.conditionStack.length-2]},"topState"),pushState:o(function(v){this.begin(v)},"pushState")};return n.options={},n.performAction=function(v,b,h,m){function l(w,p){return b.yytext=b.yytext.substring(w,b.yyleng-p+w)}switch(o(l,"w"),h){case 0:if(b.yytext.slice(-2)==="\\\\"?(l(0,1),this.begin("mu")):b.yytext.slice(-1)==="\\"?(l(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(l(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(b.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return b.yytext=l(1,2).replace(/\\"/g,'"'),80;case 32:return b.yytext=l(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return b.yytext=b.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},n.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],n.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},n})();i.lexer=s;function f(){this.yy={}}return o(f,"K"),f.prototype=i,i.Parser=f,new f})();t.default=r,e.exports=t.default}),Vh=ye((t,e)=>{t.__esModule=!0;function r(h){return h&&h.__esModule?h:{default:h}}o(r,"oc");var i=pi(),s=r(i);function f(){this.parents=[]}o(f,"KP"),f.prototype={constructor:f,mutating:!1,acceptKey:o(function(h,m){var l=this.accept(h[m]);if(this.mutating){if(l&&!f.prototype[l.type])throw new s.default('Unexpected node type "'+l.type+'" found when accepting '+m+" on "+h.type);h[m]=l}},"acceptKey"),acceptRequired:o(function(h,m){if(this.acceptKey(h,m),!h[m])throw new s.default(h.type+" requires "+m)},"acceptRequired"),acceptArray:o(function(h){for(var m=0,l=h.length;m<l;m++)this.acceptKey(h,m),!h[m]&&(h.splice(m,1),m--,l--)},"acceptArray"),accept:o(function(h){if(h){if(!this[h.type])throw new s.default("Unknown type: "+h.type,h);this.current&&this.parents.unshift(this.current),this.current=h;var m=this[h.type](h);if(this.current=this.parents.shift(),!this.mutating||m)return m;if(m!==!1)return h}},"accept"),Program:o(function(h){this.acceptArray(h.body)},"Program"),MustacheStatement:n,Decorator:n,BlockStatement:v,DecoratorBlock:v,PartialStatement:b,PartialBlockStatement:o(function(h){b.call(this,h),this.acceptKey(h,"program")},"PartialBlockStatement"),ContentStatement:o(function(){},"ContentStatement"),CommentStatement:o(function(){},"CommentStatement"),SubExpression:n,PathExpression:o(function(){},"PathExpression"),StringLiteral:o(function(){},"StringLiteral"),NumberLiteral:o(function(){},"NumberLiteral"),BooleanLiteral:o(function(){},"BooleanLiteral"),UndefinedLiteral:o(function(){},"UndefinedLiteral"),NullLiteral:o(function(){},"NullLiteral"),Hash:o(function(h){this.acceptArray(h.pairs)},"Hash"),HashPair:o(function(h){this.acceptRequired(h,"value")},"HashPair")};function n(h){this.acceptRequired(h,"path"),this.acceptArray(h.params),this.acceptKey(h,"hash")}o(n,"_P");function v(h){n.call(this,h),this.acceptKey(h,"program"),this.acceptKey(h,"inverse")}o(v,"w0");function b(h){this.acceptRequired(h,"name"),this.acceptArray(h.params),this.acceptKey(h,"hash")}o(b,"G0"),t.default=f,e.exports=t.default}),E5=ye((t,e)=>{t.__esModule=!0;function r(m){return m&&m.__esModule?m:{default:m}}o(r,"Fc");var i=Vh(),s=r(i);function f(){var m=arguments.length<=0||arguments[0]===void 0?{}:arguments[0];this.options=m}o(f,"i$"),f.prototype=new s.default,f.prototype.Program=function(m){var l=!this.options.ignoreStandalone,w=!this.isRootSeen;this.isRootSeen=!0;for(var p=m.body,y=0,M=p.length;y<M;y++){var E=p[y],R=this.accept(E);if(R){var I=n(p,y,w),T=v(p,y,w),P=R.openStandalone&&I,j=R.closeStandalone&&T,L=R.inlineStandalone&&I&&T;R.close&&b(p,y,!0),R.open&&h(p,y,!0),l&&L&&(b(p,y),h(p,y)&&E.type==="PartialStatement"&&(E.indent=/([ \t]+$)/.exec(p[y-1].original)[1])),l&&P&&(b((E.program||E.inverse).body),h(p,y)),l&&j&&(b(p,y),h((E.inverse||E.program).body))}}return m},f.prototype.BlockStatement=f.prototype.DecoratorBlock=f.prototype.PartialBlockStatement=function(m){this.accept(m.program),this.accept(m.inverse);var l=m.program||m.inverse,w=m.program&&m.inverse,p=w,y=w;if(w&&w.chained)for(p=w.body[0].program;y.chained;)y=y.body[y.body.length-1].program;var M={open:m.openStrip.open,close:m.closeStrip.close,openStandalone:v(l.body),closeStandalone:n((p||l).body)};if(m.openStrip.close&&b(l.body,null,!0),w){var E=m.inverseStrip;E.open&&h(l.body,null,!0),E.close&&b(p.body,null,!0),m.closeStrip.open&&h(y.body,null,!0),!this.options.ignoreStandalone&&n(l.body)&&v(p.body)&&(h(l.body),b(p.body))}else m.closeStrip.open&&h(l.body,null,!0);return M},f.prototype.Decorator=f.prototype.MustacheStatement=function(m){return m.strip},f.prototype.PartialStatement=f.prototype.CommentStatement=function(m){var l=m.strip||{};return{inlineStandalone:!0,open:l.open,close:l.close}};function n(m,l,w){l===void 0&&(l=m.length);var p=m[l-1],y=m[l-2];if(!p)return w;if(p.type==="ContentStatement")return(y||!w?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(p.original)}o(n,"aj");function v(m,l,w){l===void 0&&(l=-1);var p=m[l+1],y=m[l+2];if(!p)return w;if(p.type==="ContentStatement")return(y||!w?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(p.original)}o(v,"ej");function b(m,l,w){var p=m[l==null?0:l+1];if(!(!p||p.type!=="ContentStatement"||!w&&p.rightStripped)){var y=p.value;p.value=p.value.replace(w?/^\s+/:/^[ \t]*\r?\n?/,""),p.rightStripped=p.value!==y}}o(b,"q9");function h(m,l,w){var p=m[l==null?m.length-1:l-1];if(!(!p||p.type!=="ContentStatement"||!w&&p.leftStripped)){var y=p.value;return p.value=p.value.replace(w?/\s+$/:/[ \t]+$/,""),p.leftStripped=p.value!==y,p.leftStripped}}o(h,"W7"),t.default=f,e.exports=t.default}),A5=ye(t=>{t.__esModule=!0,t.SourceLocation=f,t.id=n,t.stripFlags=v,t.stripComment=b,t.preparePath=h,t.prepareMustache=m,t.prepareRawBlock=l,t.prepareBlock=w,t.prepareProgram=p,t.preparePartialBlock=y;function e(M){return M&&M.__esModule?M:{default:M}}o(e,"ec");var r=pi(),i=e(r);function s(M,E){if(E=E.path?E.path.original:E,M.path.original!==E){var R={loc:M.path.loc};throw new i.default(M.path.original+" doesn't match "+E,R)}}o(s,"qW");function f(M,E){this.source=M,this.start={line:E.first_line,column:E.first_column},this.end={line:E.last_line,column:E.last_column}}o(f,"qu");function n(M){return/^\[.*\]$/.test(M)?M.substring(1,M.length-1):M}o(n,"$u");function v(M,E){return{open:M.charAt(2)==="~",close:E.charAt(E.length-3)==="~"}}o(v,"Ku");function b(M){return M.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")}o(b,"_u");function h(M,E,R){R=this.locInfo(R);for(var I=M?"@":"",T=[],P=0,j=0,L=E.length;j<L;j++){var U=E[j].part,Z=E[j].original!==U;if(I+=(E[j].separator||"")+U,!Z&&(U===".."||U==="."||U==="this")){if(T.length>0)throw new i.default("Invalid path: "+I,{loc:R});U===".."&&P++}else T.push(U)}return{type:"PathExpression",data:M,depth:P,parts:T,original:I,loc:R}}o(h,"Pu");function m(M,E,R,I,T,P){var j=I.charAt(3)||I.charAt(2),L=j!=="{"&&j!=="&",U=/\*/.test(I);return{type:U?"Decorator":"MustacheStatement",path:M,params:E,hash:R,escaped:L,strip:T,loc:this.locInfo(P)}}o(m,"Yu");function l(M,E,R,I){s(M,R),I=this.locInfo(I);var T={type:"Program",body:E,strip:{},loc:I};return{type:"BlockStatement",path:M.path,params:M.params,hash:M.hash,program:T,openStrip:{},inverseStrip:{},closeStrip:{},loc:I}}o(l,"Ou");function w(M,E,R,I,T,P){I&&I.path&&s(M,I);var j=/\*/.test(M.open);E.blockParams=M.blockParams;var L=void 0,U=void 0;if(R){if(j)throw new i.default("Unexpected inverse block on decorator",R);R.chain&&(R.program.body[0].closeStrip=I.strip),U=R.strip,L=R.program}return T&&(T=L,L=E,E=T),{type:j?"DecoratorBlock":"BlockStatement",path:M.path,params:M.params,hash:M.hash,program:E,inverse:L,openStrip:M.strip,inverseStrip:U,closeStrip:I&&I.strip,loc:this.locInfo(P)}}o(w,"ju");function p(M,E){if(!E&&M.length){var R=M[0].loc,I=M[M.length-1].loc;R&&I&&(E={source:R.source,start:{line:R.start.line,column:R.start.column},end:{line:I.end.line,column:I.end.column}})}return{type:"Program",body:M,strip:{},loc:E}}o(p,"Wu");function y(M,E,R,I){return s(M,R),{type:"PartialBlockStatement",name:M.path,params:M.params,hash:M.hash,program:E,openStrip:M.strip,closeStrip:R&&R.strip,loc:this.locInfo(I)}}o(y,"Hu")}),k5=ye(t=>{t.__esModule=!0,t.parseWithoutProcessing=l,t.parse=w;function e(p){if(p&&p.__esModule)return p;var y={};if(p!=null)for(var M in p)Object.prototype.hasOwnProperty.call(p,M)&&(y[M]=p[M]);return y.default=p,y}o(e,"Mu");function r(p){return p&&p.__esModule?p:{default:p}}o(r,"E0");var i=S5(),s=r(i),f=E5(),n=r(f),v=A5(),b=e(v),h=Pr();t.parser=s.default;var m={};h.extend(m,b);function l(p,y){if(p.type==="Program")return p;s.default.yy=m,m.locInfo=function(E){return new m.SourceLocation(y&&y.srcName,E)};var M=s.default.parse(p);return M}o(l,"N0");function w(p,y){var M=l(p,y),E=new n.default(y);return E.accept(M)}o(w,"Iu")}),N5=ye(t=>{t.__esModule=!0,t.Compiler=b,t.precompile=h,t.compile=m;function e(p){return p&&p.__esModule?p:{default:p}}o(e,"I0");var r=pi(),i=e(r),s=Pr(),f=Tb(),n=e(f),v=[].slice;function b(){}o(b,"KW"),b.prototype={compiler:b,equals:o(function(p){var y=this.opcodes.length;if(p.opcodes.length!==y)return!1;for(var M=0;M<y;M++){var E=this.opcodes[M],R=p.opcodes[M];if(E.opcode!==R.opcode||!l(E.args,R.args))return!1}y=this.children.length;for(var M=0;M<y;M++)if(!this.children[M].equals(p.children[M]))return!1;return!0},"equals"),guid:0,compile:o(function(p,y){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=y,this.stringParams=y.stringParams,this.trackIds=y.trackIds,y.blockParams=y.blockParams||[],y.knownHelpers=s.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},y.knownHelpers),this.accept(p)},"compile"),compileProgram:o(function(p){var y=new this.compiler,M=y.compile(p,this.options),E=this.guid++;return this.usePartial=this.usePartial||M.usePartial,this.children[E]=M,this.useDepths=this.useDepths||M.useDepths,E},"compileProgram"),accept:o(function(p){if(!this[p.type])throw new i.default("Unknown type: "+p.type,p);this.sourceNode.unshift(p);var y=this[p.type](p);return this.sourceNode.shift(),y},"accept"),Program:o(function(p){this.options.blockParams.unshift(p.blockParams);for(var y=p.body,M=y.length,E=0;E<M;E++)this.accept(y[E]);return this.options.blockParams.shift(),this.isSimple=M===1,this.blockParams=p.blockParams?p.blockParams.length:0,this},"Program"),BlockStatement:o(function(p){w(p);var{program:y,inverse:M}=p;y=y&&this.compileProgram(y),M=M&&this.compileProgram(M);var E=this.classifySexpr(p);E==="helper"?this.helperSexpr(p,y,M):E==="simple"?(this.simpleSexpr(p),this.opcode("pushProgram",y),this.opcode("pushProgram",M),this.opcode("emptyHash"),this.opcode("blockValue",p.path.original)):(this.ambiguousSexpr(p,y,M),this.opcode("pushProgram",y),this.opcode("pushProgram",M),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},"BlockStatement"),DecoratorBlock:o(function(p){var y=p.program&&this.compileProgram(p.program),M=this.setupFullMustacheParams(p,y,void 0),E=p.path;this.useDecorators=!0,this.opcode("registerDecorator",M.length,E.original)},"DecoratorBlock"),PartialStatement:o(function(p){this.usePartial=!0;var y=p.program;y&&(y=this.compileProgram(p.program));var M=p.params;if(M.length>1)throw new i.default("Unsupported number of partial arguments: "+M.length,p);M.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):M.push({type:"PathExpression",parts:[],depth:0}));var E=p.name.original,R=p.name.type==="SubExpression";R&&this.accept(p.name),this.setupFullMustacheParams(p,y,void 0,!0);var I=p.indent||"";this.options.preventIndent&&I&&(this.opcode("appendContent",I),I=""),this.opcode("invokePartial",R,E,I),this.opcode("append")},"PartialStatement"),PartialBlockStatement:o(function(p){this.PartialStatement(p)},"PartialBlockStatement"),MustacheStatement:o(function(p){this.SubExpression(p),p.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},"MustacheStatement"),Decorator:o(function(p){this.DecoratorBlock(p)},"Decorator"),ContentStatement:o(function(p){p.value&&this.opcode("appendContent",p.value)},"ContentStatement"),CommentStatement:o(function(){},"CommentStatement"),SubExpression:o(function(p){w(p);var y=this.classifySexpr(p);y==="simple"?this.simpleSexpr(p):y==="helper"?this.helperSexpr(p):this.ambiguousSexpr(p)},"SubExpression"),ambiguousSexpr:o(function(p,y,M){var E=p.path,R=E.parts[0],I=y!=null||M!=null;this.opcode("getContext",E.depth),this.opcode("pushProgram",y),this.opcode("pushProgram",M),E.strict=!0,this.accept(E),this.opcode("invokeAmbiguous",R,I)},"ambiguousSexpr"),simpleSexpr:o(function(p){var y=p.path;y.strict=!0,this.accept(y),this.opcode("resolvePossibleLambda")},"simpleSexpr"),helperSexpr:o(function(p,y,M){var E=this.setupFullMustacheParams(p,y,M),R=p.path,I=R.parts[0];if(this.options.knownHelpers[I])this.opcode("invokeKnownHelper",E.length,I);else{if(this.options.knownHelpersOnly)throw new i.default("You specified knownHelpersOnly, but used the unknown helper "+I,p);R.strict=!0,R.falsy=!0,this.accept(R),this.opcode("invokeHelper",E.length,R.original,n.default.helpers.simpleId(R))}},"helperSexpr"),PathExpression:o(function(p){this.addDepth(p.depth),this.opcode("getContext",p.depth);var y=p.parts[0],M=n.default.helpers.scopedId(p),E=!p.depth&&!M&&this.blockParamIndex(y);E?this.opcode("lookupBlockParam",E,p.parts):y?p.data?(this.options.data=!0,this.opcode("lookupData",p.depth,p.parts,p.strict)):this.opcode("lookupOnContext",p.parts,p.falsy,p.strict,M):this.opcode("pushContext")},"PathExpression"),StringLiteral:o(function(p){this.opcode("pushString",p.value)},"StringLiteral"),NumberLiteral:o(function(p){this.opcode("pushLiteral",p.value)},"NumberLiteral"),BooleanLiteral:o(function(p){this.opcode("pushLiteral",p.value)},"BooleanLiteral"),UndefinedLiteral:o(function(){this.opcode("pushLiteral","undefined")},"UndefinedLiteral"),NullLiteral:o(function(){this.opcode("pushLiteral","null")},"NullLiteral"),Hash:o(function(p){var y=p.pairs,M=0,E=y.length;for(this.opcode("pushHash");M<E;M++)this.pushParam(y[M].value);for(;M--;)this.opcode("assignToHash",y[M].key);this.opcode("popHash")},"Hash"),opcode:o(function(p){this.opcodes.push({opcode:p,args:v.call(arguments,1),loc:this.sourceNode[0].loc})},"opcode"),addDepth:o(function(p){p&&(this.useDepths=!0)},"addDepth"),classifySexpr:o(function(p){var y=n.default.helpers.simpleId(p.path),M=y&&!!this.blockParamIndex(p.path.parts[0]),E=!M&&n.default.helpers.helperExpression(p),R=!M&&(E||y);if(R&&!E){var I=p.path.parts[0],T=this.options;T.knownHelpers[I]?E=!0:T.knownHelpersOnly&&(R=!1)}return E?"helper":R?"ambiguous":"simple"},"classifySexpr"),pushParams:o(function(p){for(var y=0,M=p.length;y<M;y++)this.pushParam(p[y])},"pushParams"),pushParam:o(function(p){var y=p.value!=null?p.value:p.original||"";if(this.stringParams)y.replace&&(y=y.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),p.depth&&this.addDepth(p.depth),this.opcode("getContext",p.depth||0),this.opcode("pushStringParam",y,p.type),p.type==="SubExpression"&&this.accept(p);else{if(this.trackIds){var M=void 0;if(p.parts&&!n.default.helpers.scopedId(p)&&!p.depth&&(M=this.blockParamIndex(p.parts[0])),M){var E=p.parts.slice(1).join(".");this.opcode("pushId","BlockParam",M,E)}else y=p.original||y,y.replace&&(y=y.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",p.type,y)}this.accept(p)}},"pushParam"),setupFullMustacheParams:o(function(p,y,M,E){var R=p.params;return this.pushParams(R),this.opcode("pushProgram",y),this.opcode("pushProgram",M),p.hash?this.accept(p.hash):this.opcode("emptyHash",E),R},"setupFullMustacheParams"),blockParamIndex:o(function(p){for(var y=0,M=this.options.blockParams.length;y<M;y++){var E=this.options.blockParams[y],R=E&&s.indexOf(E,p);if(E&&R>=0)return[y,R]}},"blockParamIndex")};function h(p,y,M){if(p==null||typeof p!="string"&&p.type!=="Program")throw new i.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+p);y=y||{},!("data"in y)&&(y.data=!0),y.compat&&(y.useDepths=!0);var E=M.parse(p,y),R=new M.Compiler().compile(E,y);return new M.JavaScriptCompiler().compile(R,y)}o(h,"uu");function m(p,y,M){if(y===void 0&&(y={}),p==null||typeof p!="string"&&p.type!=="Program")throw new i.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+p);y=s.extend({},y),!("data"in y)&&(y.data=!0),y.compat&&(y.useDepths=!0);var E=void 0;function R(){var T=M.parse(p,y),P=new M.Compiler().compile(T,y),j=new M.JavaScriptCompiler().compile(P,y,void 0,!0);return M.template(j)}o(R,"P");function I(T,P){return E||(E=R()),E.call(this,T,P)}return o(I,"O"),I._setup=function(T){return E||(E=R()),E._setup(T)},I._child=function(T,P,j,L){return E||(E=R()),E._child(T,P,j,L)},I}o(m,"mu");function l(p,y){if(p===y)return!0;if(s.isArray(p)&&s.isArray(y)&&p.length===y.length){for(var M=0;M<p.length;M++)if(!l(p[M],y[M]))return!1;return!0}}o(l,"h0");function w(p){if(!p.path.parts){var y=p.path;p.path={type:"PathExpression",data:!1,depth:0,parts:[y.original+""],original:y.original+"",loc:y.loc}}}o(w,"D0")}),C5=ye(t=>{var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");t.encode=function(r){if(0<=r&&r<e.length)return e[r];throw TypeError("Must be between 0 and 63: "+r)},t.decode=function(r){var i=65,s=90,f=97,n=122,v=48,b=57,h=43,m=47,l=26,w=52;return i<=r&&r<=s?r-i:f<=r&&r<=n?r-f+l:v<=r&&r<=b?r-v+w:r==h?62:r==m?63:-1}}),Pb=ye(t=>{var e=C5(),r=5,i=1<<r,s=i-1,f=i;function n(b){return b<0?(-b<<1)+1:(b<<1)+0}o(n,"Qu");function v(b){var h=(b&1)===1,m=b>>1;return h?-m:m}o(v,"iu"),t.encode=function(b){var h="",m,l=n(b);do m=l&s,l>>>=r,l>0&&(m|=f),h+=e.encode(m);while(l>0);return h},t.decode=function(b,h,m){var l=b.length,w=0,p=0,y,M;do{if(h>=l)throw Error("Expected more digits in base 64 VLQ value.");if(M=e.decode(b.charCodeAt(h++)),M===-1)throw Error("Invalid base64 digit: "+b.charAt(h-1));y=!!(M&f),M&=s,w=w+(M<<p),p+=r}while(y);m.value=v(w),m.rest=h}}),Lo=ye(t=>{function e(P,j,L){if(j in P)return P[j];if(arguments.length===3)return L;throw Error('"'+j+'" is a required argument.')}o(e,"su"),t.getArg=e;var r=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,i=/^data:.+\,.+$/;function s(P){var j=P.match(r);return j?{scheme:j[1],auth:j[2],host:j[3],port:j[4],path:j[5]}:null}o(s,"N2"),t.urlParse=s;function f(P){var j="";return P.scheme&&(j+=P.scheme+":"),j+="//",P.auth&&(j+=P.auth+"@"),P.host&&(j+=P.host),P.port&&(j+=":"+P.port),P.path&&(j+=P.path),j}o(f,"zK"),t.urlGenerate=f;function n(P){var j=P,L=s(P);if(L){if(!L.path)return P;j=L.path}for(var U=t.isAbsolute(j),Z=j.split(/\/+/),ne,F=0,Y=Z.length-1;Y>=0;Y--)ne=Z[Y],ne==="."?Z.splice(Y,1):ne===".."?F++:F>0&&(ne===""?(Z.splice(Y+1,F),F=0):(Z.splice(Y,2),F--));return j=Z.join("/"),j===""&&(j=U?"/":"."),L?(L.path=j,f(L)):j}o(n,"YW"),t.normalize=n;function v(P,j){P===""&&(P="."),j===""&&(j=".");var L=s(j),U=s(P);if(U&&(P=U.path||"/"),L&&!L.scheme)return U&&(L.scheme=U.scheme),f(L);if(L||j.match(i))return j;if(U&&!U.host&&!U.path)return U.host=j,f(U);var Z=j.charAt(0)==="/"?j:n(P.replace(/\/+$/,"")+"/"+j);return U?(U.path=Z,f(U)):Z}o(v,"m0"),t.join=v,t.isAbsolute=function(P){return P.charAt(0)==="/"||r.test(P)};function b(P,j){P===""&&(P="."),P=P.replace(/\/$/,"");for(var L=0;j.indexOf(P+"/")!==0;){var U=P.lastIndexOf("/");if(U<0||(P=P.slice(0,U),P.match(/^([^\/]+:\/)?\/*$/)))return j;++L}return Array(L+1).join("../")+j.substr(P.length+1)}o(b,"$m"),t.relative=b;var h=(function(){var P=Object.create(null);return!("__proto__"in P)})();function m(P){return P}o(m,"l0");function l(P){return p(P)?"$"+P:P}o(l,"Km"),t.toSetString=h?m:l;function w(P){return p(P)?P.slice(1):P}o(w,"_m"),t.fromSetString=h?m:w;function p(P){if(!P)return!1;var j=P.length;if(j<9||P.charCodeAt(j-1)!==95||P.charCodeAt(j-2)!==95||P.charCodeAt(j-3)!==111||P.charCodeAt(j-4)!==116||P.charCodeAt(j-5)!==111||P.charCodeAt(j-6)!==114||P.charCodeAt(j-7)!==112||P.charCodeAt(j-8)!==95||P.charCodeAt(j-9)!==95)return!1;for(var L=j-10;L>=0;L--)if(P.charCodeAt(L)!==36)return!1;return!0}o(p,"B0");function y(P,j,L){var U=E(P.source,j.source);return U!==0||(U=P.originalLine-j.originalLine,U!==0)||(U=P.originalColumn-j.originalColumn,U!==0||L)||(U=P.generatedColumn-j.generatedColumn,U!==0)||(U=P.generatedLine-j.generatedLine,U!==0)?U:E(P.name,j.name)}o(y,"Pm"),t.compareByOriginalPositions=y;function M(P,j,L){var U=P.generatedLine-j.generatedLine;return U!==0||(U=P.generatedColumn-j.generatedColumn,U!==0||L)||(U=E(P.source,j.source),U!==0)||(U=P.originalLine-j.originalLine,U!==0)||(U=P.originalColumn-j.originalColumn,U!==0)?U:E(P.name,j.name)}o(M,"Ym"),t.compareByGeneratedPositionsDeflated=M;function E(P,j){return P===j?0:P===null?1:j===null?-1:P>j?1:-1}o(E,"fK");function R(P,j){var L=P.generatedLine-j.generatedLine;return L!==0||(L=P.generatedColumn-j.generatedColumn,L!==0)||(L=E(P.source,j.source),L!==0)||(L=P.originalLine-j.originalLine,L!==0)||(L=P.originalColumn-j.originalColumn,L!==0)?L:E(P.name,j.name)}o(R,"Om"),t.compareByGeneratedPositionsInflated=R;function I(P){return JSON.parse(P.replace(/^\)]}'[^\n]*\n/,""))}o(I,"jm"),t.parseSourceMapInput=I;function T(P,j,L){if(j=j||"",P&&(P[P.length-1]!=="/"&&j[0]!=="/"&&(P+="/"),j=P+j),L){var U=s(L);if(!U)throw Error("sourceMapURL could not be parsed");if(U.path){var Z=U.path.lastIndexOf("/");Z>=0&&(U.path=U.path.substring(0,Z+1))}j=v(f(U),j)}return n(j)}o(T,"Wm"),t.computeSourceURL=T}),jb=ye(t=>{var e=Lo(),r=Object.prototype.hasOwnProperty,i=typeof Map<"u";function s(){this._array=[],this._set=i?new Map:Object.create(null)}o(s,"L1"),s.fromArray=function(f,n){for(var v=new s,b=0,h=f.length;b<h;b++)v.add(f[b],n);return v},s.prototype.size=function(){return i?this._set.size:Object.getOwnPropertyNames(this._set).length},s.prototype.add=function(f,n){var v=i?f:e.toSetString(f),b=i?this.has(f):r.call(this._set,v),h=this._array.length;(!b||n)&&this._array.push(f),b||(i?this._set.set(f,h):this._set[v]=h)},s.prototype.has=function(f){if(i)return this._set.has(f);var n=e.toSetString(f);return r.call(this._set,n)},s.prototype.indexOf=function(f){if(i){var n=this._set.get(f);if(n>=0)return n}else{var v=e.toSetString(f);if(r.call(this._set,v))return this._set[v]}throw Error('"'+f+'" is not in the set.')},s.prototype.at=function(f){if(f>=0&&f<this._array.length)return this._array[f];throw Error("No element indexed by "+f)},s.prototype.toArray=function(){return this._array.slice()},t.ArraySet=s}),R5=ye(t=>{var e=Lo();function r(s,f){var n=s.generatedLine,v=f.generatedLine,b=s.generatedColumn,h=f.generatedColumn;return v>n||v==n&&h>=b||e.compareByGeneratedPositionsInflated(s,f)<=0}o(r,"Nm");function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}o(i,"OP"),i.prototype.unsortedForEach=function(s,f){this._array.forEach(s,f)},i.prototype.add=function(s){r(this._last,s)?(this._last=s,this._array.push(s)):(this._sorted=!1,this._array.push(s))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(e.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},t.MappingList=i}),Lb=ye(t=>{var e=Pb(),r=Lo(),i=jb().ArraySet,s=R5().MappingList;function f(n){n||(n={}),this._file=r.getArg(n,"file",null),this._sourceRoot=r.getArg(n,"sourceRoot",null),this._skipValidation=r.getArg(n,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}o(f,"q$"),f.prototype._version=3,f.fromSourceMap=function(n){var v=n.sourceRoot,b=new f({file:n.file,sourceRoot:v});return n.eachMapping(function(h){var m={generated:{line:h.generatedLine,column:h.generatedColumn}};h.source!=null&&(m.source=h.source,v!=null&&(m.source=r.relative(v,m.source)),m.original={line:h.originalLine,column:h.originalColumn},h.name!=null&&(m.name=h.name)),b.addMapping(m)}),n.sources.forEach(function(h){var m=h;v!==null&&(m=r.relative(v,h)),b._sources.has(m)||b._sources.add(m);var l=n.sourceContentFor(h);l!=null&&b.setSourceContent(h,l)}),b},f.prototype.addMapping=function(n){var v=r.getArg(n,"generated"),b=r.getArg(n,"original",null),h=r.getArg(n,"source",null),m=r.getArg(n,"name",null);this._skipValidation||this._validateMapping(v,b,h,m),h!=null&&(h=String(h),!this._sources.has(h)&&this._sources.add(h)),m!=null&&(m=String(m),!this._names.has(m)&&this._names.add(m)),this._mappings.add({generatedLine:v.line,generatedColumn:v.column,originalLine:b!=null&&b.line,originalColumn:b!=null&&b.column,source:h,name:m})},f.prototype.setSourceContent=function(n,v){var b=n;this._sourceRoot!=null&&(b=r.relative(this._sourceRoot,b)),v!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[r.toSetString(b)]=v):this._sourcesContents&&(delete this._sourcesContents[r.toSetString(b)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))},f.prototype.applySourceMap=function(n,v,b){var h=v;if(v==null){if(n.file==null)throw Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);h=n.file}var m=this._sourceRoot;m!=null&&(h=r.relative(m,h));var l=new i,w=new i;this._mappings.unsortedForEach(function(p){if(p.source===h&&p.originalLine!=null){var y=n.originalPositionFor({line:p.originalLine,column:p.originalColumn});y.source!=null&&(p.source=y.source,b!=null&&(p.source=r.join(b,p.source)),m!=null&&(p.source=r.relative(m,p.source)),p.originalLine=y.line,p.originalColumn=y.column,y.name!=null&&(p.name=y.name))}var M=p.source;M!=null&&!l.has(M)&&l.add(M);var E=p.name;E!=null&&!w.has(E)&&w.add(E)},this),this._sources=l,this._names=w,n.sources.forEach(function(p){var y=n.sourceContentFor(p);y!=null&&(b!=null&&(p=r.join(b,p)),m!=null&&(p=r.relative(m,p)),this.setSourceContent(p,y))},this)},f.prototype._validateMapping=function(n,v,b,h){if(v&&typeof v.line!="number"&&typeof v.column!="number")throw Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(n&&"line"in n&&"column"in n&&n.line>0&&n.column>=0&&!v&&!b&&!h)){if(n&&"line"in n&&"column"in n&&v&&"line"in v&&"column"in v&&n.line>0&&n.column>=0&&v.line>0&&v.column>=0&&b)return;throw Error("Invalid mapping: "+JSON.stringify({generated:n,source:b,original:v,name:h}))}},f.prototype._serializeMappings=function(){for(var n=0,v=1,b=0,h=0,m=0,l=0,w="",p,y,M,E,R=this._mappings.toArray(),I=0,T=R.length;I<T;I++){if(y=R[I],p="",y.generatedLine!==v)for(n=0;y.generatedLine!==v;)p+=";",v++;else if(I>0){if(!r.compareByGeneratedPositionsInflated(y,R[I-1]))continue;p+=","}p+=e.encode(y.generatedColumn-n),n=y.generatedColumn,y.source!=null&&(E=this._sources.indexOf(y.source),p+=e.encode(E-l),l=E,p+=e.encode(y.originalLine-1-h),h=y.originalLine-1,p+=e.encode(y.originalColumn-b),b=y.originalColumn,y.name!=null&&(M=this._names.indexOf(y.name),p+=e.encode(M-m),m=M)),w+=p}return w},f.prototype._generateSourcesContent=function(n,v){return n.map(function(b){if(!this._sourcesContents)return null;v!=null&&(b=r.relative(v,b));var h=r.toSetString(b);return Object.prototype.hasOwnProperty.call(this._sourcesContents,h)?this._sourcesContents[h]:null},this)},f.prototype.toJSON=function(){var n={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(n.file=this._file),this._sourceRoot!=null&&(n.sourceRoot=this._sourceRoot),this._sourcesContents&&(n.sourcesContent=this._generateSourcesContent(n.sources,n.sourceRoot)),n},f.prototype.toString=function(){return JSON.stringify(this.toJSON())},t.SourceMapGenerator=f}),I5=ye(t=>{t.GREATEST_LOWER_BOUND=1,t.LEAST_UPPER_BOUND=2;function e(r,i,s,f,n,v){var b=Math.floor((i-r)/2)+r,h=n(s,f[b],!0);return h===0?b:h>0?i-b>1?e(b,i,s,f,n,v):v==t.LEAST_UPPER_BOUND?i<f.length?i:-1:b:b-r>1?e(r,b,s,f,n,v):v==t.LEAST_UPPER_BOUND?b:r<0?-1:r}o(e,"JW"),t.search=function(r,i,s,f){if(i.length===0)return-1;var n=e(-1,i.length,r,i,s,f||t.GREATEST_LOWER_BOUND);if(n<0)return-1;for(;n-1>=0&&s(i[n],i[n-1],!0)===0;)--n;return n}}),O5=ye(t=>{function e(s,f,n){var v=s[f];s[f]=s[n],s[n]=v}o(e,"fW");function r(s,f){return Math.round(s+Math.random()*(f-s))}o(r,"ym");function i(s,f,n,v){if(n<v){var b=r(n,v),h=n-1;e(s,b,v);for(var m=s[v],l=n;l<v;l++)f(s[l],m)<=0&&(h+=1,e(s,h,l));e(s,h+1,l);var w=h+1;i(s,f,n,w-1),i(s,f,w+1,v)}}o(i,"vW"),t.quickSort=function(s,f){i(s,f,0,s.length-1)}}),T5=ye(t=>{var e=Lo(),r=I5(),i=jb().ArraySet,s=Pb(),f=O5().quickSort;function n(m,l){var w=m;return typeof m=="string"&&(w=e.parseSourceMapInput(m)),w.sections!=null?new h(w,l):new v(w,l)}o(n,"Hq"),n.fromSourceMap=function(m,l){return v.fromSourceMap(m,l)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:o(function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings},"get")}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:o(function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings},"get")}),n.prototype._charIsMappingSeparator=function(m,l){var w=m.charAt(l);return w===";"||w===","},n.prototype._parseMappings=function(m,l){throw Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(m,l,w){var p=l||null,y=w||n.GENERATED_ORDER,M;switch(y){case n.GENERATED_ORDER:M=this._generatedMappings;break;case n.ORIGINAL_ORDER:M=this._originalMappings;break;default:throw Error("Unknown order of iteration.")}var E=this.sourceRoot;M.map(function(R){var I=R.source===null?null:this._sources.at(R.source);return I=e.computeSourceURL(E,I,this._sourceMapURL),{source:I,generatedLine:R.generatedLine,generatedColumn:R.generatedColumn,originalLine:R.originalLine,originalColumn:R.originalColumn,name:R.name===null?null:this._names.at(R.name)}},this).forEach(m,p)},n.prototype.allGeneratedPositionsFor=function(m){var l=e.getArg(m,"line"),w={source:e.getArg(m,"source"),originalLine:l,originalColumn:e.getArg(m,"column",0)};if(w.source=this._findSourceIndex(w.source),w.source<0)return[];var p=[],y=this._findMapping(w,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,r.LEAST_UPPER_BOUND);if(y>=0){var M=this._originalMappings[y];if(m.column===void 0)for(var E=M.originalLine;M&&M.originalLine===E;)p.push({line:e.getArg(M,"generatedLine",null),column:e.getArg(M,"generatedColumn",null),lastColumn:e.getArg(M,"lastGeneratedColumn",null)}),M=this._originalMappings[++y];else for(var R=M.originalColumn;M&&M.originalLine===l&&M.originalColumn==R;)p.push({line:e.getArg(M,"generatedLine",null),column:e.getArg(M,"generatedColumn",null),lastColumn:e.getArg(M,"lastGeneratedColumn",null)}),M=this._originalMappings[++y]}return p},t.SourceMapConsumer=n;function v(m,l){var w=m;typeof m=="string"&&(w=e.parseSourceMapInput(m));var p=e.getArg(w,"version"),y=e.getArg(w,"sources"),M=e.getArg(w,"names",[]),E=e.getArg(w,"sourceRoot",null),R=e.getArg(w,"sourcesContent",null),I=e.getArg(w,"mappings"),T=e.getArg(w,"file",null);if(p!=this._version)throw Error("Unsupported version: "+p);E&&(E=e.normalize(E)),y=y.map(String).map(e.normalize).map(function(P){return E&&e.isAbsolute(E)&&e.isAbsolute(P)?e.relative(E,P):P}),this._names=i.fromArray(M.map(String),!0),this._sources=i.fromArray(y,!0),this._absoluteSources=this._sources.toArray().map(function(P){return e.computeSourceURL(E,P,l)}),this.sourceRoot=E,this.sourcesContent=R,this._mappings=I,this._sourceMapURL=l,this.file=T}o(v,"Fq"),v.prototype=Object.create(n.prototype),v.prototype.consumer=n,v.prototype._findSourceIndex=function(m){var l=m;if(this.sourceRoot!=null&&(l=e.relative(this.sourceRoot,l)),this._sources.has(l))return this._sources.indexOf(l);var w;for(w=0;w<this._absoluteSources.length;++w)if(this._absoluteSources[w]==m)return w;return-1},v.fromSourceMap=function(m,l){var w=Object.create(v.prototype),p=w._names=i.fromArray(m._names.toArray(),!0),y=w._sources=i.fromArray(m._sources.toArray(),!0);w.sourceRoot=m._sourceRoot,w.sourcesContent=m._generateSourcesContent(w._sources.toArray(),w.sourceRoot),w.file=m._file,w._sourceMapURL=l,w._absoluteSources=w._sources.toArray().map(function(L){return e.computeSourceURL(w.sourceRoot,L,l)});for(var M=m._mappings.toArray().slice(),E=w.__generatedMappings=[],R=w.__originalMappings=[],I=0,T=M.length;I<T;I++){var P=M[I],j=new b;j.generatedLine=P.generatedLine,j.generatedColumn=P.generatedColumn,P.source&&(j.source=y.indexOf(P.source),j.originalLine=P.originalLine,j.originalColumn=P.originalColumn,P.name&&(j.name=p.indexOf(P.name)),R.push(j)),E.push(j)}return f(w.__originalMappings,e.compareByOriginalPositions),w},v.prototype._version=3,Object.defineProperty(v.prototype,"sources",{get:o(function(){return this._absoluteSources.slice()},"get")});function b(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}o(b,"Q0"),v.prototype._parseMappings=function(m,l){for(var w=1,p=0,y=0,M=0,E=0,R=0,I=m.length,T=0,P={},j={},L=[],U=[],Z,ne,F,Y,a;T<I;)if(m.charAt(T)===";")w++,T++,p=0;else if(m.charAt(T)===",")T++;else{for(Z=new b,Z.generatedLine=w,Y=T;Y<I&&!this._charIsMappingSeparator(m,Y);Y++);if(ne=m.slice(T,Y),F=P[ne],F)T+=ne.length;else{for(F=[];T<Y;)s.decode(m,T,j),a=j.value,T=j.rest,F.push(a);if(F.length===2)throw Error("Found a source, but no line and column");if(F.length===3)throw Error("Found a source and line, but no column");P[ne]=F}Z.generatedColumn=p+F[0],p=Z.generatedColumn,F.length>1&&(Z.source=E+F[1],E+=F[1],Z.originalLine=y+F[2],y=Z.originalLine,Z.originalLine+=1,Z.originalColumn=M+F[3],M=Z.originalColumn,F.length>4&&(Z.name=R+F[4],R+=F[4])),U.push(Z),typeof Z.originalLine=="number"&&L.push(Z)}f(U,e.compareByGeneratedPositionsDeflated),this.__generatedMappings=U,f(L,e.compareByOriginalPositions),this.__originalMappings=L},v.prototype._findMapping=function(m,l,w,p,y,M){if(m[w]<=0)throw TypeError("Line must be greater than or equal to 1, got "+m[w]);if(m[p]<0)throw TypeError("Column must be greater than or equal to 0, got "+m[p]);return r.search(m,l,y,M)},v.prototype.computeColumnSpans=function(){for(var m=0;m<this._generatedMappings.length;++m){var l=this._generatedMappings[m];if(m+1<this._generatedMappings.length){var w=this._generatedMappings[m+1];if(l.generatedLine===w.generatedLine){l.lastGeneratedColumn=w.generatedColumn-1;continue}}l.lastGeneratedColumn=1/0}},v.prototype.originalPositionFor=function(m){var l={generatedLine:e.getArg(m,"line"),generatedColumn:e.getArg(m,"column")},w=this._findMapping(l,this._generatedMappings,"generatedLine","generatedColumn",e.compareByGeneratedPositionsDeflated,e.getArg(m,"bias",n.GREATEST_LOWER_BOUND));if(w>=0){var p=this._generatedMappings[w];if(p.generatedLine===l.generatedLine){var y=e.getArg(p,"source",null);y!==null&&(y=this._sources.at(y),y=e.computeSourceURL(this.sourceRoot,y,this._sourceMapURL));var M=e.getArg(p,"name",null);return M!==null&&(M=this._names.at(M)),{source:y,line:e.getArg(p,"originalLine",null),column:e.getArg(p,"originalColumn",null),name:M}}}return{source:null,line:null,column:null,name:null}},v.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(m){return m==null}):!1},v.prototype.sourceContentFor=function(m,l){if(!this.sourcesContent)return null;var w=this._findSourceIndex(m);if(w>=0)return this.sourcesContent[w];var p=m;this.sourceRoot!=null&&(p=e.relative(this.sourceRoot,p));var y;if(this.sourceRoot!=null&&(y=e.urlParse(this.sourceRoot))){var M=p.replace(/^file:\/\//,"");if(y.scheme=="file"&&this._sources.has(M))return this.sourcesContent[this._sources.indexOf(M)];if((!y.path||y.path=="/")&&this._sources.has("/"+p))return this.sourcesContent[this._sources.indexOf("/"+p)]}if(l)return null;throw Error('"'+p+'" is not in the SourceMap.')},v.prototype.generatedPositionFor=function(m){var l=e.getArg(m,"source");if(l=this._findSourceIndex(l),l<0)return{line:null,column:null,lastColumn:null};var w={source:l,originalLine:e.getArg(m,"line"),originalColumn:e.getArg(m,"column")},p=this._findMapping(w,this._originalMappings,"originalLine","originalColumn",e.compareByOriginalPositions,e.getArg(m,"bias",n.GREATEST_LOWER_BOUND));if(p>=0){var y=this._originalMappings[p];if(y.source===w.source)return{line:e.getArg(y,"generatedLine",null),column:e.getArg(y,"generatedColumn",null),lastColumn:e.getArg(y,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},t.BasicSourceMapConsumer=v;function h(m,l){var w=m;typeof m=="string"&&(w=e.parseSourceMapInput(m));var p=e.getArg(w,"version"),y=e.getArg(w,"sections");if(p!=this._version)throw Error("Unsupported version: "+p);this._sources=new i,this._names=new i;var M={line:-1,column:0};this._sections=y.map(function(E){if(E.url)throw Error("Support for url field in sections not implemented.");var R=e.getArg(E,"offset"),I=e.getArg(R,"line"),T=e.getArg(R,"column");if(I<M.line||I===M.line&&T<M.column)throw Error("Section offsets must be ordered and non-overlapping.");return M=R,{generatedOffset:{generatedLine:I+1,generatedColumn:T+1},consumer:new n(e.getArg(E,"map"),l)}})}o(h,"G$"),h.prototype=Object.create(n.prototype),h.prototype.constructor=n,h.prototype._version=3,Object.defineProperty(h.prototype,"sources",{get:o(function(){for(var m=[],l=0;l<this._sections.length;l++)for(var w=0;w<this._sections[l].consumer.sources.length;w++)m.push(this._sections[l].consumer.sources[w]);return m},"get")}),h.prototype.originalPositionFor=function(m){var l={generatedLine:e.getArg(m,"line"),generatedColumn:e.getArg(m,"column")},w=r.search(l,this._sections,function(y,M){var E=y.generatedLine-M.generatedOffset.generatedLine;return E||y.generatedColumn-M.generatedOffset.generatedColumn}),p=this._sections[w];return p?p.consumer.originalPositionFor({line:l.generatedLine-(p.generatedOffset.generatedLine-1),column:l.generatedColumn-(p.generatedOffset.generatedLine===l.generatedLine?p.generatedOffset.generatedColumn-1:0),bias:m.bias}):{source:null,line:null,column:null,name:null}},h.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(m){return m.consumer.hasContentsOfAllSources()})},h.prototype.sourceContentFor=function(m,l){for(var w=0;w<this._sections.length;w++){var p=this._sections[w],y=p.consumer.sourceContentFor(m,!0);if(y)return y}if(l)return null;throw Error('"'+m+'" is not in the SourceMap.')},h.prototype.generatedPositionFor=function(m){for(var l=0;l<this._sections.length;l++){var w=this._sections[l];if(w.consumer._findSourceIndex(e.getArg(m,"source"))!==-1){var p=w.consumer.generatedPositionFor(m);if(p){var y={line:p.line+(w.generatedOffset.generatedLine-1),column:p.column+(w.generatedOffset.generatedLine===p.line?w.generatedOffset.generatedColumn-1:0)};return y}}}return{line:null,column:null}},h.prototype._parseMappings=function(m,l){this.__generatedMappings=[],this.__originalMappings=[];for(var w=0;w<this._sections.length;w++)for(var p=this._sections[w],y=p.consumer._generatedMappings,M=0;M<y.length;M++){var E=y[M],R=p.consumer._sources.at(E.source);R=e.computeSourceURL(p.consumer.sourceRoot,R,this._sourceMapURL),this._sources.add(R),R=this._sources.indexOf(R);var I=null;E.name&&(I=p.consumer._names.at(E.name),this._names.add(I),I=this._names.indexOf(I));var T={source:R,generatedLine:E.generatedLine+(p.generatedOffset.generatedLine-1),generatedColumn:E.generatedColumn+(p.generatedOffset.generatedLine===E.generatedLine?p.generatedOffset.generatedColumn-1:0),originalLine:E.originalLine,originalColumn:E.originalColumn,name:I};this.__generatedMappings.push(T),typeof T.originalLine=="number"&&this.__originalMappings.push(T)}f(this.__generatedMappings,e.compareByGeneratedPositionsDeflated),f(this.__originalMappings,e.compareByOriginalPositions)},t.IndexedSourceMapConsumer=h}),P5=ye(t=>{var e=Lb().SourceMapGenerator,r=Lo(),i=/(\r?\n)/,s=10,f="$$$isSourceNode$$$";function n(v,b,h,m,l){this.children=[],this.sourceContents={},this.line=v??null,this.column=b??null,this.source=h??null,this.name=l??null,this[f]=!0,m!=null&&this.add(m)}o(n,"m4"),n.fromStringWithSourceMap=function(v,b,h){var m=new n,l=v.split(i),w=0,p=o(function(){var I=P(),T=P()||"";return I+T;function P(){return w<l.length?l[w++]:void 0}},"z"),y=1,M=0,E=null;return b.eachMapping(function(I){if(E!==null)if(y<I.generatedLine)R(E,p()),y++,M=0;else{var T=l[w]||"",P=T.substr(0,I.generatedColumn-M);l[w]=T.substr(I.generatedColumn-M),M=I.generatedColumn,R(E,P),E=I;return}for(;y<I.generatedLine;)m.add(p()),y++;if(M<I.generatedColumn){var T=l[w]||"";m.add(T.substr(0,I.generatedColumn)),l[w]=T.substr(I.generatedColumn),M=I.generatedColumn}E=I},this),w<l.length&&(E&&R(E,p()),m.add(l.splice(w).join(""))),b.sources.forEach(function(I){var T=b.sourceContentFor(I);T!=null&&(h!=null&&(I=r.join(h,I)),m.setSourceContent(I,T))}),m;function R(I,T){if(I===null||I.source===void 0)m.add(T);else{var P=h?r.join(h,I.source):I.source;m.add(new n(I.originalLine,I.originalColumn,P,T,I.name))}}o(R,"Z")},n.prototype.add=function(v){if(Array.isArray(v))v.forEach(function(b){this.add(b)},this);else if(v[f]||typeof v=="string")v&&this.children.push(v);else throw TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+v);return this},n.prototype.prepend=function(v){if(Array.isArray(v))for(var b=v.length-1;b>=0;b--)this.prepend(v[b]);else if(v[f]||typeof v=="string")this.children.unshift(v);else throw TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+v);return this},n.prototype.walk=function(v){for(var b,h=0,m=this.children.length;h<m;h++)b=this.children[h],b[f]?b.walk(v):b!==""&&v(b,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(v){var b,h,m=this.children.length;if(m>0){for(b=[],h=0;h<m-1;h++)b.push(this.children[h]),b.push(v);b.push(this.children[h]),this.children=b}return this},n.prototype.replaceRight=function(v,b){var h=this.children[this.children.length-1];return h[f]?h.replaceRight(v,b):typeof h=="string"?this.children[this.children.length-1]=h.replace(v,b):this.children.push("".replace(v,b)),this},n.prototype.setSourceContent=function(v,b){this.sourceContents[r.toSetString(v)]=b},n.prototype.walkSourceContents=function(v){for(var b=0,h=this.children.length;b<h;b++)this.children[b][f]&&this.children[b].walkSourceContents(v);for(var m=Object.keys(this.sourceContents),b=0,h=m.length;b<h;b++)v(r.fromSetString(m[b]),this.sourceContents[m[b]])},n.prototype.toString=function(){var v="";return this.walk(function(b){v+=b}),v},n.prototype.toStringWithSourceMap=function(v){var b={code:"",line:1,column:0},h=new e(v),m=!1,l=null,w=null,p=null,y=null;return this.walk(function(M,E){b.code+=M,E.source!==null&&E.line!==null&&E.column!==null?((l!==E.source||w!==E.line||p!==E.column||y!==E.name)&&h.addMapping({source:E.source,original:{line:E.line,column:E.column},generated:{line:b.line,column:b.column},name:E.name}),l=E.source,w=E.line,p=E.column,y=E.name,m=!0):m&&(h.addMapping({generated:{line:b.line,column:b.column}}),l=null,m=!1);for(var R=0,I=M.length;R<I;R++)M.charCodeAt(R)===s?(b.line++,b.column=0,R+1===I?(l=null,m=!1):m&&h.addMapping({source:E.source,original:{line:E.line,column:E.column},generated:{line:b.line,column:b.column},name:E.name})):b.column++}),this.walkSourceContents(function(M,E){h.setSourceContent(M,E)}),{code:b.code,map:h}},t.SourceNode=n}),j5=ye(t=>{t.SourceMapGenerator=Lb().SourceMapGenerator,t.SourceMapConsumer=T5().SourceMapConsumer,t.SourceNode=P5().SourceNode}),L5=ye((t,e)=>{t.__esModule=!0;var r=Pr(),i=void 0;try{(typeof define!="function"||!define.amd)&&(s=j5(),i=s.SourceNode)}catch{}var s;i||(i=o(function(v,b,h,m){this.src="",m&&this.add(m)},"K9"),i.prototype={add:o(function(v){r.isArray(v)&&(v=v.join("")),this.src+=v},"add"),prepend:o(function(v){r.isArray(v)&&(v=v.join("")),this.src=v+this.src},"prepend"),toStringWithSourceMap:o(function(){return{code:this.toString()}},"toStringWithSourceMap"),toString:o(function(){return this.src},"toString")});function f(v,b,h){if(r.isArray(v)){for(var m=[],l=0,w=v.length;l<w;l++)m.push(b.wrap(v[l],h));return m}else if(typeof v=="boolean"||typeof v=="number")return v+"";return v}o(f,"XW");function n(v){this.srcFile=v,this.source=[]}o(n,"e0"),n.prototype={isEmpty:o(function(){return!this.source.length},"isEmpty"),prepend:o(function(v,b){this.source.unshift(this.wrap(v,b))},"prepend"),push:o(function(v,b){this.source.push(this.wrap(v,b))},"push"),merge:o(function(){var v=this.empty();return this.each(function(b){v.add([" ",b,`
|
|
10
|
-
`])}),v},"merge"),each:o(function(v){for(var b=0,h=this.source.length;b<h;b++)v(this.source[b])},"each"),empty:o(function(){var v=this.currentLocation||{start:{}};return new i(v.start.line,v.start.column,this.srcFile)},"empty"),wrap:o(function(v){var b=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];return v instanceof i?v:(v=f(v,this,b),new i(b.start.line,b.start.column,this.srcFile,v))},"wrap"),functionCall:o(function(v,b,h){return h=this.generateList(h),this.wrap([v,b?"."+b+"(":"(",h,")"])},"functionCall"),quotedString:o(function(v){return'"'+(v+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},"quotedString"),objectLiteral:o(function(v){var b=this,h=[];Object.keys(v).forEach(function(l){var w=f(v[l],b);w!=="undefined"&&h.push([b.quotedString(l),":",w])});var m=this.generateList(h);return m.prepend("{"),m.add("}"),m},"objectLiteral"),generateList:o(function(v){for(var b=this.empty(),h=0,m=v.length;h<m;h++)h&&b.add(","),b.add(f(v[h],this));return b},"generateList"),generateArray:o(function(v){var b=this.generateList(v);return b.prepend("["),b.add("]"),b},"generateArray")},t.default=n,e.exports=t.default}),D5=ye((t,e)=>{t.__esModule=!0;function r(w){return w&&w.__esModule?w:{default:w}}o(r,"PG");var i=Hh(),s=pi(),f=r(s),n=Pr(),v=L5(),b=r(v);function h(w){this.value=w}o(h,"AK");function m(){}o(m,"wK"),m.prototype={nameLookup:o(function(w,p){return this.internalNameLookup(w,p)},"nameLookup"),depthedLookup:o(function(w){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(w),")"]},"depthedLookup"),compilerInfo:o(function(){var w=i.COMPILER_REVISION,p=i.REVISION_CHANGES[w];return[w,p]},"compilerInfo"),appendToBuffer:o(function(w,p,y){return n.isArray(w)||(w=[w]),w=this.source.wrap(w,p),this.environment.isSimple?["return ",w,";"]:y?["buffer += ",w,";"]:(w.appendToBuffer=!0,w)},"appendToBuffer"),initializeBuffer:o(function(){return this.quotedString("")},"initializeBuffer"),internalNameLookup:o(function(w,p){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",w,",",JSON.stringify(p),")"]},"internalNameLookup"),lookupPropertyFunctionIsUsed:!1,compile:o(function(w,p,y,M){this.environment=w,this.options=p,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!M,this.name=this.environment.name,this.isChild=!!y,this.context=y||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(w,p),this.useDepths=this.useDepths||w.useDepths||w.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||w.useBlockParams;var E=w.opcodes,R=void 0,I=void 0,T=void 0,P=void 0;for(T=0,P=E.length;T<P;T++)R=E[T],this.source.currentLocation=R.loc,I=I||R.loc,this[R.opcode].apply(this,R.args);if(this.source.currentLocation=I,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new f.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),`;
|
|
11
|
-
`]),this.decorators.push("return fn;"),M?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend(`function(fn, props, container, depth0, data, blockParams, depths) {
|
|
12
|
-
`),this.decorators.push(`}
|
|
13
|
-
`),this.decorators=this.decorators.merge()));var j=this.createFunctionContext(M);if(this.isChild)return j;var L={compiler:this.compilerInfo(),main:j};this.decorators&&(L.main_d=this.decorators,L.useDecorators=!0);var U=this.context,Z=U.programs,ne=U.decorators;for(T=0,P=Z.length;T<P;T++)Z[T]&&(L[T]=Z[T],ne[T]&&(L[T+"_d"]=ne[T],L.useDecorators=!0));return this.environment.usePartial&&(L.usePartial=!0),this.options.data&&(L.useData=!0),this.useDepths&&(L.useDepths=!0),this.useBlockParams&&(L.useBlockParams=!0),this.options.compat&&(L.compat=!0),M?L.compilerOptions=this.options:(L.compiler=JSON.stringify(L.compiler),this.source.currentLocation={start:{line:1,column:0}},L=this.objectLiteral(L),p.srcName?(L=L.toStringWithSourceMap({file:p.destName}),L.map=L.map&&L.map.toString()):L=L.toString()),L},"compile"),preamble:o(function(){this.lastContext=0,this.source=new b.default(this.options.srcName),this.decorators=new b.default(this.options.srcName)},"preamble"),createFunctionContext:o(function(w){var p=this,y="",M=this.stackVars.concat(this.registers.list);M.length>0&&(y+=", "+M.join(", "));var E=0;Object.keys(this.aliases).forEach(function(T){var P=p.aliases[T];P.children&&P.referenceCount>1&&(y+=", alias"+ ++E+"="+T,P.children[0]="alias"+E)}),this.lookupPropertyFunctionIsUsed&&(y+=", "+this.lookupPropertyFunctionVarDeclaration());var R=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&R.push("blockParams"),this.useDepths&&R.push("depths");var I=this.mergeSource(y);return w?(R.push(I),Function.apply(this,R)):this.source.wrap(["function(",R.join(","),`) {
|
|
14
|
-
`,I,"}"])},"createFunctionContext"),mergeSource:o(function(w){var p=this.environment.isSimple,y=!this.forceBuffer,M=void 0,E=void 0,R=void 0,I=void 0;return this.source.each(function(T){T.appendToBuffer?(R?T.prepend(" + "):R=T,I=T):(R&&(E?R.prepend("buffer += "):M=!0,I.add(";"),R=I=void 0),E=!0,!p&&(y=!1))}),y?R?(R.prepend("return "),I.add(";")):E||this.source.push('return "";'):(w+=", buffer = "+(M?"":this.initializeBuffer()),R?(R.prepend("return buffer + "),I.add(";")):this.source.push("return buffer;")),w&&this.source.prepend("var "+w.substring(2)+(M?"":`;
|
|
15
|
-
`)),this.source.merge()},"mergeSource"),lookupPropertyFunctionVarDeclaration:o(function(){return`
|
|
16
|
-
lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
17
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
18
|
-
return parent[propertyName];
|
|
19
|
-
}
|
|
20
|
-
return undefined
|
|
21
|
-
}
|
|
22
|
-
`.trim()},"lookupPropertyFunctionVarDeclaration"),blockValue:o(function(w){var p=this.aliasable("container.hooks.blockHelperMissing"),y=[this.contextName(0)];this.setupHelperArgs(w,0,y);var M=this.popStack();y.splice(1,0,M),this.push(this.source.functionCall(p,"call",y))},"blockValue"),ambiguousBlockValue:o(function(){var w=this.aliasable("container.hooks.blockHelperMissing"),p=[this.contextName(0)];this.setupHelperArgs("",0,p,!0),this.flushInline();var y=this.topStack();p.splice(1,0,y),this.pushSource(["if (!",this.lastHelper,") { ",y," = ",this.source.functionCall(w,"call",p),"}"])},"ambiguousBlockValue"),appendContent:o(function(w){this.pendingContent?w=this.pendingContent+w:this.pendingLocation=this.source.currentLocation,this.pendingContent=w},"appendContent"),append:o(function(){if(this.isInline())this.replaceStack(function(p){return[" != null ? ",p,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var w=this.popStack();this.pushSource(["if (",w," != null) { ",this.appendToBuffer(w,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},"append"),appendEscaped:o(function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},"appendEscaped"),getContext:o(function(w){this.lastContext=w},"getContext"),pushContext:o(function(){this.pushStackLiteral(this.contextName(this.lastContext))},"pushContext"),lookupOnContext:o(function(w,p,y,M){var E=0;!M&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(w[E++])):this.pushContext(),this.resolvePath("context",w,E,p,y)},"lookupOnContext"),lookupBlockParam:o(function(w,p){this.useBlockParams=!0,this.push(["blockParams[",w[0],"][",w[1],"]"]),this.resolvePath("context",p,1)},"lookupBlockParam"),lookupData:o(function(w,p,y){w?this.pushStackLiteral("container.data(data, "+w+")"):this.pushStackLiteral("data"),this.resolvePath("data",p,0,!0,y)},"lookupData"),resolvePath:o(function(w,p,y,M,E){var R=this;if(this.options.strict||this.options.assumeObjects){this.push(l(this.options.strict&&E,this,p,y,w));return}for(var I=p.length;y<I;y++)this.replaceStack(function(T){var P=R.nameLookup(T,p[y],w);return M?[" && ",P]:[" != null ? ",P," : ",T]})},"resolvePath"),resolvePossibleLambda:o(function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},"resolvePossibleLambda"),pushStringParam:o(function(w,p){this.pushContext(),this.pushString(p),p!=="SubExpression"&&(typeof w=="string"?this.pushString(w):this.pushStackLiteral(w))},"pushStringParam"),emptyHash:o(function(w){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(w?"undefined":"{}")},"emptyHash"),pushHash:o(function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},"pushHash"),popHash:o(function(){var w=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(w.ids)),this.stringParams&&(this.push(this.objectLiteral(w.contexts)),this.push(this.objectLiteral(w.types))),this.push(this.objectLiteral(w.values))},"popHash"),pushString:o(function(w){this.pushStackLiteral(this.quotedString(w))},"pushString"),pushLiteral:o(function(w){this.pushStackLiteral(w)},"pushLiteral"),pushProgram:o(function(w){w!=null?this.pushStackLiteral(this.programExpression(w)):this.pushStackLiteral(null)},"pushProgram"),registerDecorator:o(function(w,p){var y=this.nameLookup("decorators",p,"decorator"),M=this.setupHelperArgs(p,w);this.decorators.push(["fn = ",this.decorators.functionCall(y,"",["fn","props","container",M])," || fn;"])},"registerDecorator"),invokeHelper:o(function(w,p,y){var M=this.popStack(),E=this.setupHelper(w,p),R=[];y&&R.push(E.name),R.push(M),!this.options.strict&&R.push(this.aliasable("container.hooks.helperMissing"));var I=["(",this.itemsSeparatedBy(R,"||"),")"],T=this.source.functionCall(I,"call",E.callParams);this.push(T)},"invokeHelper"),itemsSeparatedBy:o(function(w,p){var y=[];y.push(w[0]);for(var M=1;M<w.length;M++)y.push(p,w[M]);return y},"itemsSeparatedBy"),invokeKnownHelper:o(function(w,p){var y=this.setupHelper(w,p);this.push(this.source.functionCall(y.name,"call",y.callParams))},"invokeKnownHelper"),invokeAmbiguous:o(function(w,p){this.useRegister("helper");var y=this.popStack();this.emptyHash();var M=this.setupHelper(0,w,p),E=this.lastHelper=this.nameLookup("helpers",w,"helper"),R=["(","(helper = ",E," || ",y,")"];this.options.strict||(R[0]="(helper = ",R.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",R,M.paramsInit?["),(",M.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",M.callParams)," : helper))"])},"invokeAmbiguous"),invokePartial:o(function(w,p,y){var M=[],E=this.setupParams(p,1,M);w&&(p=this.popStack(),delete E.name),y&&(E.indent=JSON.stringify(y)),E.helpers="helpers",E.partials="partials",E.decorators="container.decorators",w?M.unshift(p):M.unshift(this.nameLookup("partials",p,"partial")),this.options.compat&&(E.depths="depths"),E=this.objectLiteral(E),M.push(E),this.push(this.source.functionCall("container.invokePartial","",M))},"invokePartial"),assignToHash:o(function(w){var p=this.popStack(),y=void 0,M=void 0,E=void 0;this.trackIds&&(E=this.popStack()),this.stringParams&&(M=this.popStack(),y=this.popStack());var R=this.hash;y&&(R.contexts[w]=y),M&&(R.types[w]=M),E&&(R.ids[w]=E),R.values[w]=p},"assignToHash"),pushId:o(function(w,p,y){w==="BlockParam"?this.pushStackLiteral("blockParams["+p[0]+"].path["+p[1]+"]"+(y?" + "+JSON.stringify("."+y):"")):w==="PathExpression"?this.pushString(p):w==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},"pushId"),compiler:m,compileChildren:o(function(w,p){for(var y=w.children,M=void 0,E=void 0,R=0,I=y.length;R<I;R++){M=y[R],E=new this.compiler;var T=this.matchExistingProgram(M);if(T==null){this.context.programs.push("");var P=this.context.programs.length;M.index=P,M.name="program"+P,this.context.programs[P]=E.compile(M,p,this.context,!this.precompile),this.context.decorators[P]=E.decorators,this.context.environments[P]=M,this.useDepths=this.useDepths||E.useDepths,this.useBlockParams=this.useBlockParams||E.useBlockParams,M.useDepths=this.useDepths,M.useBlockParams=this.useBlockParams}else M.index=T.index,M.name="program"+T.index,this.useDepths=this.useDepths||T.useDepths,this.useBlockParams=this.useBlockParams||T.useBlockParams}},"compileChildren"),matchExistingProgram:o(function(w){for(var p=0,y=this.context.environments.length;p<y;p++){var M=this.context.environments[p];if(M&&M.equals(w))return M}},"matchExistingProgram"),programExpression:o(function(w){var p=this.environment.children[w],y=[p.index,"data",p.blockParams];return(this.useBlockParams||this.useDepths)&&y.push("blockParams"),this.useDepths&&y.push("depths"),"container.program("+y.join(", ")+")"},"programExpression"),useRegister:o(function(w){this.registers[w]||(this.registers[w]=!0,this.registers.list.push(w))},"useRegister"),push:o(function(w){return w instanceof h||(w=this.source.wrap(w)),this.inlineStack.push(w),w},"push"),pushStackLiteral:o(function(w){this.push(new h(w))},"pushStackLiteral"),pushSource:o(function(w){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),w&&this.source.push(w)},"pushSource"),replaceStack:o(function(w){var p=["("],y=void 0,M=void 0,E=void 0;if(!this.isInline())throw new f.default("replaceStack on non-inline");var R=this.popStack(!0);if(R instanceof h)y=[R.value],p=["(",y],E=!0;else{M=!0;var I=this.incrStack();p=["((",this.push(I)," = ",R,")"],y=this.topStack()}var T=w.call(this,y);E||this.popStack(),M&&this.stackSlot--,this.push(p.concat(T,")"))},"replaceStack"),incrStack:o(function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},"incrStack"),topStackName:o(function(){return"stack"+this.stackSlot},"topStackName"),flushInline:o(function(){var w=this.inlineStack;this.inlineStack=[];for(var p=0,y=w.length;p<y;p++){var M=w[p];if(M instanceof h)this.compileStack.push(M);else{var E=this.incrStack();this.pushSource([E," = ",M,";"]),this.compileStack.push(E)}}},"flushInline"),isInline:o(function(){return this.inlineStack.length},"isInline"),popStack:o(function(w){var p=this.isInline(),y=(p?this.inlineStack:this.compileStack).pop();if(!w&&y instanceof h)return y.value;if(!p){if(!this.stackSlot)throw new f.default("Invalid stack pop");this.stackSlot--}return y},"popStack"),topStack:o(function(){var w=this.isInline()?this.inlineStack:this.compileStack,p=w[w.length-1];return p instanceof h?p.value:p},"topStack"),contextName:o(function(w){return this.useDepths&&w?"depths["+w+"]":"depth"+w},"contextName"),quotedString:o(function(w){return this.source.quotedString(w)},"quotedString"),objectLiteral:o(function(w){return this.source.objectLiteral(w)},"objectLiteral"),aliasable:o(function(w){var p=this.aliases[w];return p?(p.referenceCount++,p):(p=this.aliases[w]=this.source.wrap(w),p.aliasable=!0,p.referenceCount=1,p)},"aliasable"),setupHelper:o(function(w,p,y){var M=[],E=this.setupHelperArgs(p,w,M,y),R=this.nameLookup("helpers",p,"helper"),I=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:M,paramsInit:E,name:R,callParams:[I].concat(M)}},"setupHelper"),setupParams:o(function(w,p,y){var M={},E=[],R=[],I=[],T=!y,P=void 0;T&&(y=[]),M.name=this.quotedString(w),M.hash=this.popStack(),this.trackIds&&(M.hashIds=this.popStack()),this.stringParams&&(M.hashTypes=this.popStack(),M.hashContexts=this.popStack());var j=this.popStack(),L=this.popStack();(L||j)&&(M.fn=L||"container.noop",M.inverse=j||"container.noop");for(var U=p;U--;)P=this.popStack(),y[U]=P,this.trackIds&&(I[U]=this.popStack()),this.stringParams&&(R[U]=this.popStack(),E[U]=this.popStack());return T&&(M.args=this.source.generateArray(y)),this.trackIds&&(M.ids=this.source.generateArray(I)),this.stringParams&&(M.types=this.source.generateArray(R),M.contexts=this.source.generateArray(E)),this.options.data&&(M.data="data"),this.useBlockParams&&(M.blockParams="blockParams"),M},"setupParams"),setupHelperArgs:o(function(w,p,y,M){var E=this.setupParams(w,p,y);return E.loc=JSON.stringify(this.source.currentLocation),E=this.objectLiteral(E),M?(this.useRegister("options"),y.push("options"),["options=",E]):y?(y.push(E),""):E},"setupHelperArgs")},(function(){for(var w="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),p=m.RESERVED_WORDS={},y=0,M=w.length;y<M;y++)p[w[y]]=!0})(),m.isValidJavaScriptVariableName=function(w){return!m.RESERVED_WORDS[w]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(w)};function l(w,p,y,M,E){var R=p.popStack(),I=y.length;for(w&&I--;M<I;M++)R=p.nameLookup(R,y[M],E);return w?[p.aliasable("container.strict"),"(",R,", ",p.quotedString(y[M]),", ",JSON.stringify(p.source.currentLocation)," )"]:R}o(l,"Kd"),t.default=m,e.exports=t.default}),B5=ye((t,e)=>{t.__esModule=!0;function r(I){return I&&I.__esModule?I:{default:I}}o(r,"I2");var i=M5(),s=r(i),f=Tb(),n=r(f),v=k5(),b=N5(),h=D5(),m=r(h),l=Vh(),w=r(l),p=Ob(),y=r(p),M=s.default.create;function E(){var I=M();return I.compile=function(T,P){return b.compile(T,P,I)},I.precompile=function(T,P){return b.precompile(T,P,I)},I.AST=n.default,I.Compiler=b.Compiler,I.JavaScriptCompiler=m.default,I.Parser=v.parser,I.parse=v.parse,I.parseWithoutProcessing=v.parseWithoutProcessing,I}o(E,"WG");var R=E();R.create=E,y.default(R),R.Visitor=w.default,R.default=R,t.default=R,e.exports=t.default}),z5=ye(t=>{t.__esModule=!0,t.print=s,t.PrintVisitor=f;function e(n){return n&&n.__esModule?n:{default:n}}o(e,"Gd");var r=Vh(),i=e(r);function s(n){return new f().accept(n)}o(s,"Vd");function f(){this.padding=0}o(f,"Cq"),f.prototype=new i.default,f.prototype.pad=function(n){for(var v="",b=0,h=this.padding;b<h;b++)v+=" ";return v+=n+`
|
|
23
|
-
`,v},f.prototype.Program=function(n){var v="",b=n.body,h=void 0,m=void 0;if(n.blockParams){var l="BLOCK PARAMS: [";for(h=0,m=n.blockParams.length;h<m;h++)l+=" "+n.blockParams[h];l+=" ]",v+=this.pad(l)}for(h=0,m=b.length;h<m;h++)v+=this.accept(b[h]);return this.padding--,v},f.prototype.MustacheStatement=function(n){return this.pad("{{ "+this.SubExpression(n)+" }}")},f.prototype.Decorator=function(n){return this.pad("{{ DIRECTIVE "+this.SubExpression(n)+" }}")},f.prototype.BlockStatement=f.prototype.DecoratorBlock=function(n){var v="";return v+=this.pad((n.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,v+=this.pad(this.SubExpression(n)),n.program&&(v+=this.pad("PROGRAM:"),this.padding++,v+=this.accept(n.program),this.padding--),n.inverse&&(n.program&&this.padding++,v+=this.pad("{{^}}"),this.padding++,v+=this.accept(n.inverse),this.padding--,n.program&&this.padding--),this.padding--,v},f.prototype.PartialStatement=function(n){var v="PARTIAL:"+n.name.original;return n.params[0]&&(v+=" "+this.accept(n.params[0])),n.hash&&(v+=" "+this.accept(n.hash)),this.pad("{{> "+v+" }}")},f.prototype.PartialBlockStatement=function(n){var v="PARTIAL BLOCK:"+n.name.original;return n.params[0]&&(v+=" "+this.accept(n.params[0])),n.hash&&(v+=" "+this.accept(n.hash)),v+=" "+this.pad("PROGRAM:"),this.padding++,v+=this.accept(n.program),this.padding--,this.pad("{{> "+v+" }}")},f.prototype.ContentStatement=function(n){return this.pad("CONTENT[ '"+n.value+"' ]")},f.prototype.CommentStatement=function(n){return this.pad("{{! '"+n.value+"' }}")},f.prototype.SubExpression=function(n){for(var v=n.params,b=[],h=void 0,m=0,l=v.length;m<l;m++)b.push(this.accept(v[m]));return v="["+b.join(", ")+"]",h=n.hash?" "+this.accept(n.hash):"",this.accept(n.path)+" "+v+h},f.prototype.PathExpression=function(n){var v=n.parts.join("/");return(n.data?"@":"")+"PATH:"+v},f.prototype.StringLiteral=function(n){return'"'+n.value+'"'},f.prototype.NumberLiteral=function(n){return"NUMBER{"+n.value+"}"},f.prototype.BooleanLiteral=function(n){return"BOOLEAN{"+n.value+"}"},f.prototype.UndefinedLiteral=function(){return"UNDEFINED"},f.prototype.NullLiteral=function(){return"NULL"},f.prototype.Hash=function(n){for(var v=n.pairs,b=[],h=0,m=v.length;h<m;h++)b.push(this.accept(v[h]));return"HASH{"+b.join(", ")+"}"},f.prototype.HashPair=function(n){return n.key+"="+this.accept(n.value)}}),F5=ye((t,e)=>{var r=B5().default,i=z5();r.PrintVisitor=i.PrintVisitor,r.print=i.print,e.exports=r;function s(f,n){var v=o((()=>({})),"K"),b=v.readFileSync(n,"utf8");f.exports=r.compile(b)}o(s,"vG"),Ac.extensions&&(Ac.extensions[".handlebars"]=s,Ac.extensions[".hbs"]=s)}),U5=ye((t,e)=>{var r=String,i=o(function(){return{isColorSupported:!1,reset:r,bold:r,dim:r,italic:r,underline:r,inverse:r,hidden:r,strikethrough:r,black:r,red:r,green:r,yellow:r,blue:r,magenta:r,cyan:r,white:r,gray:r,bgBlack:r,bgRed:r,bgGreen:r,bgYellow:r,bgBlue:r,bgMagenta:r,bgCyan:r,bgWhite:r,blackBright:r,redBright:r,greenBright:r,yellowBright:r,blueBright:r,magentaBright:r,cyanBright:r,whiteBright:r,bgBlackBright:r,bgRedBright:r,bgGreenBright:r,bgYellowBright:r,bgBlueBright:r,bgMagentaBright:r,bgCyanBright:r,bgWhiteBright:r}},"FG");e.exports=i(),e.exports.createColors=i}),Db={};Rn(Db,{uptime:o(()=>G5,"uptime"),type:o(()=>X5,"type"),totalmem:o(()=>Q5,"totalmem"),tmpdir:o(()=>Fb,"tmpdir"),tmpDir:o(()=>Ub,"tmpDir"),release:o(()=>W5,"release"),platform:o(()=>J5,"platform"),networkInterfaces:o(()=>zb,"networkInterfaces"),loadavg:o(()=>Z5,"loadavg"),hostname:o(()=>V5,"hostname"),homedir:o(()=>e7,"homedir"),getNetworkInterfaces:o(()=>Bb,"getNetworkInterfaces"),freemem:o(()=>Y5,"freemem"),endianness:o(()=>H5,"endianness"),cpus:o(()=>K5,"cpus"),arch:o(()=>$5,"arch"),EOL:o(()=>q5,"EOL")});var H5=o(function(){return"LE"},"qB"),V5=o(function(){return typeof location<"u"?location.hostname:""},"$B"),Z5=o(function(){return[]},"KB"),G5=o(function(){return 0},"_B"),Y5=o(function(){return Number.MAX_VALUE},"PB"),Q5=o(function(){return Number.MAX_VALUE},"YB"),K5=o(function(){return[]},"OB"),X5=o(function(){return"Browser"},"jB"),W5=o(function(){return typeof navigator<"u"?navigator.appVersion:""},"WB"),Bb=o(function(){return{}},"jk"),zb,$5=o(function(){return"javascript"},"JB"),J5=o(function(){return"browser"},"zB"),Fb=o(function(){return"/tmp"},"Wk"),Ub,q5=`
|
|
24
|
-
`,e7=o(function(){return"/"},"TB"),t7=Po(()=>{zb=Bb,Ub=Fb}),er={};Rn(er,{transcode:o(()=>uy,"transcode"),resolveObjectURL:o(()=>oy,"resolveObjectURL"),kStringMaxLength:o(()=>$b,"kStringMaxLength"),kMaxLength:o(()=>Ja,"kMaxLength"),isUtf8:o(()=>ly,"isUtf8"),isAscii:o(()=>N7,"isAscii"),default:o(()=>cy,"default"),constants:o(()=>ry,"constants"),btoa:o(()=>Jb,"btoa"),atob:o(()=>qb,"atob"),INSPECT_MAX_BYTES:o(()=>Wb,"INSPECT_MAX_BYTES"),File:o(()=>ey,"File"),Buffer:o(()=>Xe,"Buffer"),Blob:o(()=>ty,"Blob")});function r7(t){var e=t.length;if(e%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}o(r7,"cB");function i7(t,e){return(t+e)*3/4-e}o(i7,"uB");function n7(t){var e,r=r7(t),i=r[0],s=r[1],f=new Uint8Array(i7(i,s)),n=0,v=s>0?i-4:i,b;for(b=0;b<v;b+=4)e=zr[t.charCodeAt(b)]<<18|zr[t.charCodeAt(b+1)]<<12|zr[t.charCodeAt(b+2)]<<6|zr[t.charCodeAt(b+3)],f[n++]=e>>16&255,f[n++]=e>>8&255,f[n++]=e&255;return s===2&&(e=zr[t.charCodeAt(b)]<<2|zr[t.charCodeAt(b+1)]>>4,f[n++]=e&255),s===1&&(e=zr[t.charCodeAt(b)]<<10|zr[t.charCodeAt(b+1)]<<4|zr[t.charCodeAt(b+2)]>>2,f[n++]=e>>8&255,f[n++]=e&255),f}o(n7,"mB");function s7(t){return ni[t>>18&63]+ni[t>>12&63]+ni[t>>6&63]+ni[t&63]}o(s7,"dB");function a7(t,e,r){for(var i,s=[],f=e;f<r;f+=3)i=(t[f]<<16&16711680)+(t[f+1]<<8&65280)+(t[f+2]&255),s.push(s7(i));return s.join("")}o(a7,"lB");function o0(t){for(var e,r=t.length,i=r%3,s=[],f=16383,n=0,v=r-i;n<v;n+=f)s.push(a7(t,n,n+f>v?v:n+f));return i===1?(e=t[r-1],s.push(ni[e>>2]+ni[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],s.push(ni[e>>10]+ni[e>>4&63]+ni[e<<2&63]+"=")),s.join("")}o(o0,"Nk");function Ko(t,e,r,i,s){var f,n,v=s*8-i-1,b=(1<<v)-1,h=b>>1,m=-7,l=r?s-1:0,w=r?-1:1,p=t[e+l];for(l+=w,f=p&(1<<-m)-1,p>>=-m,m+=v;m>0;f=f*256+t[e+l],l+=w,m-=8);for(n=f&(1<<-m)-1,f>>=-m,m+=i;m>0;n=n*256+t[e+l],l+=w,m-=8);if(f===0)f=1-h;else{if(f===b)return n?NaN:(p?-1:1)*(1/0);n=n+Math.pow(2,i),f=f-h}return(p?-1:1)*n*Math.pow(2,f-i)}o(Ko,"hP");function Hb(t,e,r,i,s,f){var n,v,b,h=f*8-s-1,m=(1<<h)-1,l=m>>1,w=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:f-1,y=i?1:-1,M=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(v=isNaN(e)?1:0,n=m):(n=Math.floor(Math.log(e)/Math.LN2),e*(b=Math.pow(2,-n))<1&&(n--,b*=2),n+l>=1?e+=w/b:e+=w*Math.pow(2,1-l),e*b>=2&&(n++,b/=2),n+l>=m?(v=0,n=m):n+l>=1?(v=(e*b-1)*Math.pow(2,s),n=n+l):(v=e*Math.pow(2,l-1)*Math.pow(2,s),n=0));s>=8;t[r+p]=v&255,p+=y,v/=256,s-=8);for(n=n<<s|v,h+=s;h>0;t[r+p]=n&255,p+=y,n/=256,h-=8);t[r+p-y]|=M*128}o(Hb,"Lk");function tn(t){if(t>Ja)throw RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,Xe.prototype),e}o(tn,"p1");function kc(t,e,r){return class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}o(kc,"WH");function Xe(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw TypeError('The "string" argument must be of type string. Received type number');return Ad(t)}return Vb(t,e,r)}o(Xe,"D8");function Vb(t,e,r){if(typeof t=="string")return l7(t,e);if(ArrayBuffer.isView(t))return u7(t);if(t==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Mi(t,ArrayBuffer)||t&&Mi(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Mi(t,SharedArrayBuffer)||t&&Mi(t.buffer,SharedArrayBuffer)))return Nd(t,e,r);if(typeof t=="number")throw TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return Xe.from(i,e,r);let s=c7(t);if(s)return s;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return Xe.from(t[Symbol.toPrimitive]("string"),e,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}o(Vb,"yk");function Zb(t){if(typeof t!="number")throw TypeError('"size" argument must be of type number');if(t<0)throw RangeError('The value "'+t+'" is invalid for option "size"')}o(Zb,"xk");function o7(t,e,r){return Zb(t),t<=0?tn(t):e!==void 0?typeof r=="string"?tn(t).fill(e,r):tn(t).fill(e):tn(t)}o(o7,"iB");function Ad(t){return Zb(t),tn(t<0?0:Zh(t)|0)}o(Ad,"HH");function l7(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Xe.isEncoding(e))throw TypeError("Unknown encoding: "+e);let r=Gb(t,e)|0,i=tn(r),s=i.write(t,e);return s!==r&&(i=i.slice(0,s)),i}o(l7,"tB");function kd(t){let e=t.length<0?0:Zh(t.length)|0,r=tn(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}o(kd,"YH");function u7(t){if(Mi(t,Uint8Array)){let e=new Uint8Array(t);return Nd(e.buffer,e.byteOffset,e.byteLength)}return kd(t)}o(u7,"aB");function Nd(t,e,r){if(e<0||t.byteLength<e)throw RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,Xe.prototype),i}o(Nd,"OH");function c7(t){if(Xe.isBuffer(t)){let e=Zh(t.length)|0,r=tn(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Number.isNaN(t.length)?tn(0):kd(t);if(t.type==="Buffer"&&Array.isArray(t.data))return kd(t.data)}o(c7,"eB");function Zh(t){if(t>=Ja)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ja.toString(16)+" bytes");return t|0}o(Zh,"JH");function Gb(t,e){if(Xe.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Mi(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let s=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Cd(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Xb(t).length;default:if(s)return i?-1:Cd(t).length;e=(""+e).toLowerCase(),s=!0}}o(Gb,"pk");function f7(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return x7(this,e,r);case"utf8":case"utf-8":return Yb(this,e,r);case"ascii":return y7(this,e,r);case"latin1":case"binary":return w7(this,e,r);case"base64":return v7(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _7(this,e,r);default:if(i)throw TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}o(f7,"sB");function Ln(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}o(Ln,"J9");function l0(t,e,r,i,s){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Number.isNaN(r)&&(r=s?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(s)return-1;r=t.length-1}else if(r<0)if(s)r=0;else return-1;if(typeof e=="string"&&(e=Xe.from(e,i)),Xe.isBuffer(e))return e.length===0?-1:u0(t,e,r,i,s);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?s?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):u0(t,[e],r,i,s);throw TypeError("val must be string, number or Buffer")}o(l0,"ck");function u0(t,e,r,i,s){let f=1,n=t.length,v=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;f=2,n/=2,v/=2,r/=2}function b(m,l){return f===1?m[l]:m.readUInt16BE(l*f)}o(b,"v");let h;if(s){let m=-1;for(h=r;h<n;h++)if(b(t,h)===b(e,m===-1?0:h-m)){if(m===-1&&(m=h),h-m+1===v)return m*f}else m!==-1&&(h-=h-m),m=-1}else for(r+v>n&&(r=n-v),h=r;h>=0;h--){let m=!0;for(let l=0;l<v;l++)if(b(t,h+l)!==b(e,l)){m=!1;break}if(m)return h}return-1}o(u0,"Dk");function d7(t,e,r,i){r=Number(r)||0;let s=t.length-r;i?(i=Number(i),i>s&&(i=s)):i=s;let f=e.length;i>f/2&&(i=f/2);let n;for(n=0;n<i;++n){let v=parseInt(e.substr(n*2,2),16);if(Number.isNaN(v))return n;t[r+n]=v}return n}o(d7,"qo");function h7(t,e,r,i){return Du(Cd(e,t.length-r),t,r,i)}o(h7,"$o");function p7(t,e,r,i){return Du(E7(e),t,r,i)}o(p7,"Ko");function m7(t,e,r,i){return Du(Xb(e),t,r,i)}o(m7,"_o");function g7(t,e,r,i){return Du(A7(e,t.length-r),t,r,i)}o(g7,"Po");function v7(t,e,r){return e===0&&r===t.length?o0(t):o0(t.slice(e,r))}o(v7,"Yo");function Yb(t,e,r){r=Math.min(t.length,r);let i=[],s=e;for(;s<r;){let f=t[s],n=null,v=f>239?4:f>223?3:f>191?2:1;if(s+v<=r){let b,h,m,l;switch(v){case 1:f<128&&(n=f);break;case 2:b=t[s+1],(b&192)===128&&(l=(f&31)<<6|b&63,l>127&&(n=l));break;case 3:b=t[s+1],h=t[s+2],(b&192)===128&&(h&192)===128&&(l=(f&15)<<12|(b&63)<<6|h&63,l>2047&&(l<55296||l>57343)&&(n=l));break;case 4:b=t[s+1],h=t[s+2],m=t[s+3],(b&192)===128&&(h&192)===128&&(m&192)===128&&(l=(f&15)<<18|(b&63)<<12|(h&63)<<6|m&63,l>65535&&l<1114112&&(n=l))}}n===null?(n=65533,v=1):n>65535&&(n-=65536,i.push(n>>>10&1023|55296),n=56320|n&1023),i.push(n),s+=v}return b7(i)}o(Yb,"uk");function b7(t){let e=t.length;if(e<=g0)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=g0));return r}o(b7,"Oo");function y7(t,e,r){let i="";r=Math.min(t.length,r);for(let s=e;s<r;++s)i+=String.fromCharCode(t[s]&127);return i}o(y7,"jo");function w7(t,e,r){let i="";r=Math.min(t.length,r);for(let s=e;s<r;++s)i+=String.fromCharCode(t[s]);return i}o(w7,"Wo");function x7(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let s="";for(let f=e;f<r;++f)s+=ay[t[f]];return s}o(x7,"Ho");function _7(t,e,r){let i=t.slice(e,r),s="";for(let f=0;f<i.length-1;f+=2)s+=String.fromCharCode(i[f]+i[f+1]*256);return s}o(_7,"Jo");function vr(t,e,r){if(t%1!==0||t<0)throw RangeError("offset is not uint");if(t+e>r)throw RangeError("Trying to access beyond buffer length")}o(vr,"xq");function Ir(t,e,r,i,s,f){if(!Xe.isBuffer(t))throw TypeError('"buffer" argument must be a Buffer instance');if(e>s||e<f)throw RangeError('"value" argument is out of bounds');if(r+i>t.length)throw RangeError("Index out of range")}o(Ir,"h4");function c0(t,e,r,i,s){Kb(e,i,s,t,r,7);let f=Number(e&BigInt(4294967295));t[r++]=f,f=f>>8,t[r++]=f,f=f>>8,t[r++]=f,f=f>>8,t[r++]=f;let n=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=n,n=n>>8,t[r++]=n,n=n>>8,t[r++]=n,n=n>>8,t[r++]=n,r}o(c0,"mk");function f0(t,e,r,i,s){Kb(e,i,s,t,r,7);let f=Number(e&BigInt(4294967295));t[r+7]=f,f=f>>8,t[r+6]=f,f=f>>8,t[r+5]=f,f=f>>8,t[r+4]=f;let n=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=n,n=n>>8,t[r+2]=n,n=n>>8,t[r+1]=n,n=n>>8,t[r]=n,r+8}o(f0,"dk");function Qb(t,e,r,i,s,f){if(r+i>t.length||r<0)throw RangeError("Index out of range")}o(Qb,"lk");function d0(t,e,r,i,s){return e=+e,r=r>>>0,!s&&Qb(t,e,r,4),Hb(t,e,r,i,23,4),r+4}o(d0,"Bk");function h0(t,e,r,i,s){return e=+e,r=r>>>0,!s&&Qb(t,e,r,8),Hb(t,e,r,i,52,8),r+8}o(h0,"ok");function p0(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}o(p0,"hk");function M7(t,e,r){Cs(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&La(e,t.length-(r+1))}o(M7,"zo");function Kb(t,e,r,i,s,f){if(t>r||t<e){let n=typeof e=="bigint"?"n":"",v;throw e===0||e===BigInt(0)?v=`>= 0${n} and < 2${n} ** ${(f+1)*8}${n}`:v=`>= -(2${n} ** ${(f+1)*8-1}${n}) and < 2 ** ${(f+1)*8-1}${n}`,new zl("value",v,t)}M7(i,s,f)}o(Kb,"nk");function Cs(t,e){if(typeof t!="number")throw new ny(e,"number",t)}o(Cs,"UK");function La(t,e,r){throw Math.floor(t)!==t?(Cs(t,r),new zl("offset","an integer",t)):e<0?new iy:new zl("offset",`>= 0 and <= ${e}`,t)}o(La,"i2");function S7(t){if(t=t.split("=")[0],t=t.trim().replace(sy,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}o(S7,"vo");function Cd(t,e){e=e||1/0;let r,i=t.length,s=null,f=[];for(let n=0;n<i;++n){if(r=t.charCodeAt(n),r>55295&&r<57344){if(!s){if(r>56319){(e-=3)>-1&&f.push(239,191,189);continue}else if(n+1===i){(e-=3)>-1&&f.push(239,191,189);continue}s=r;continue}if(r<56320){(e-=3)>-1&&f.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(e-=3)>-1&&f.push(239,191,189);if(s=null,r<128){if((e-=1)<0)break;f.push(r)}else if(r<2048){if((e-=2)<0)break;f.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;f.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;f.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw Error("Invalid code point")}return f}o(Cd,"jH");function E7(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}o(E7,"To");function A7(t,e){let r,i,s,f=[];for(let n=0;n<t.length&&!((e-=2)<0);++n)r=t.charCodeAt(n),i=r>>8,s=r%256,f.push(s),f.push(i);return f}o(A7,"Xo");function Xb(t){return n7(S7(t))}o(Xb,"Uk");function Du(t,e,r,i){let s;for(s=0;s<i&&!(s+r>=e.length||s>=t.length);++s)e[s+r]=t[s];return s}o(Du,"LP");function Mi(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}o(Mi,"$1");function un(t){return typeof BigInt>"u"?k7:t}o(un,"X7");function k7(){throw Error("BigInt not supported")}o(k7,"wo");function Nc(t){return()=>{throw Error(t+" is not implemented for node:buffer browser polyfill")}}o(Nc,"zH");var ni,zr,Cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dn,m0,Rc,Wb=50,Ja=2147483647,$b=536870888,Jb,qb,ey,ty,ry,iy,ny,zl,g0=4096,sy,ay,oy,ly,N7=o(t=>{for(let e of t)if(e.charCodeAt(0)>127)return!1;return!0},"Zo"),uy,cy,sr=Po(()=>{for(ni=[],zr=[],Dn=0,m0=Cc.length;Dn<m0;++Dn)ni[Dn]=Cc[Dn],zr[Cc.charCodeAt(Dn)]=Dn;zr[45]=62,zr[95]=63,Rc=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null,Jb=globalThis.btoa,qb=globalThis.atob,ey=globalThis.File,ty=globalThis.Blob,ry={MAX_LENGTH:Ja,MAX_STRING_LENGTH:$b},iy=kc("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ny=kc("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError),zl=kc("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,s=r;return Number.isInteger(r)&&Math.abs(r)>4294967296?s=p0(String(r)):typeof r=="bigint"&&(s=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(s=p0(s)),s+="n"),i+=` It must be ${e}. Received ${s}`,i},RangeError),Object.defineProperty(Xe.prototype,"parent",{enumerable:!0,get:o(function(){if(Xe.isBuffer(this))return this.buffer},"get")}),Object.defineProperty(Xe.prototype,"offset",{enumerable:!0,get:o(function(){if(Xe.isBuffer(this))return this.byteOffset},"get")}),Xe.poolSize=8192,Xe.from=function(t,e,r){return Vb(t,e,r)},Object.setPrototypeOf(Xe.prototype,Uint8Array.prototype),Object.setPrototypeOf(Xe,Uint8Array),Xe.alloc=function(t,e,r){return o7(t,e,r)},Xe.allocUnsafe=function(t){return Ad(t)},Xe.allocUnsafeSlow=function(t){return Ad(t)},Xe.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==Xe.prototype},Xe.compare=function(t,e){if(Mi(t,Uint8Array)&&(t=Xe.from(t,t.offset,t.byteLength)),Mi(e,Uint8Array)&&(e=Xe.from(e,e.offset,e.byteLength)),!Xe.isBuffer(t)||!Xe.isBuffer(e))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,i=e.length;for(let s=0,f=Math.min(r,i);s<f;++s)if(t[s]!==e[s]){r=t[s],i=e[s];break}return r<i?-1:i<r?1:0},Xe.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Xe.concat=function(t,e){if(!Array.isArray(t))throw TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return Xe.alloc(0);let r;if(e===void 0)for(e=0,r=0;r<t.length;++r)e+=t[r].length;let i=Xe.allocUnsafe(e),s=0;for(r=0;r<t.length;++r){let f=t[r];if(Mi(f,Uint8Array))s+f.length>i.length?(Xe.isBuffer(f)||(f=Xe.from(f)),f.copy(i,s)):Uint8Array.prototype.set.call(i,f,s);else if(Xe.isBuffer(f))f.copy(i,s);else throw TypeError('"list" argument must be an Array of Buffers');s+=f.length}return i},Xe.byteLength=Gb,Xe.prototype._isBuffer=!0,Xe.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)Ln(this,e,e+1);return this},Xe.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)Ln(this,e,e+3),Ln(this,e+1,e+2);return this},Xe.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)Ln(this,e,e+7),Ln(this,e+1,e+6),Ln(this,e+2,e+5),Ln(this,e+3,e+4);return this},Xe.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Yb(this,0,t):f7.apply(this,arguments)},Xe.prototype.toLocaleString=Xe.prototype.toString,Xe.prototype.equals=function(t){if(!Xe.isBuffer(t))throw TypeError("Argument must be a Buffer");return this===t?!0:Xe.compare(this,t)===0},Xe.prototype.inspect=function(){let t="",e=Wb;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},Rc&&(Xe.prototype[Rc]=Xe.prototype.inspect),Xe.prototype.compare=function(t,e,r,i,s){if(Mi(t,Uint8Array)&&(t=Xe.from(t,t.offset,t.byteLength)),!Xe.isBuffer(t))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),r===void 0&&(r=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),e<0||r>t.length||i<0||s>this.length)throw RangeError("out of range index");if(i>=s&&e>=r)return 0;if(i>=s)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,i>>>=0,s>>>=0,this===t)return 0;let f=s-i,n=r-e,v=Math.min(f,n),b=this.slice(i,s),h=t.slice(e,r);for(let m=0;m<v;++m)if(b[m]!==h[m]){f=b[m],n=h[m];break}return f<n?-1:n<f?1:0},Xe.prototype.includes=function(t,e,r){return this.indexOf(t,e,r)!==-1},Xe.prototype.indexOf=function(t,e,r){return l0(this,t,e,r,!0)},Xe.prototype.lastIndexOf=function(t,e,r){return l0(this,t,e,r,!1)},Xe.prototype.write=function(t,e,r,i){if(e===void 0)i="utf8",r=this.length,e=0;else if(r===void 0&&typeof e=="string")i=e,r=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((r===void 0||r>s)&&(r=s),t.length>0&&(r<0||e<0)||e>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let f=!1;for(;;)switch(i){case"hex":return d7(this,t,e,r);case"utf8":case"utf-8":return h7(this,t,e,r);case"ascii":case"latin1":case"binary":return p7(this,t,e,r);case"base64":return m7(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g7(this,t,e,r);default:if(f)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),f=!0}},Xe.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},Xe.prototype.slice=function(t,e){let r=this.length;t=~~t,e=e===void 0?r:~~e,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),e<t&&(e=t);let i=this.subarray(t,e);return Object.setPrototypeOf(i,Xe.prototype),i},Xe.prototype.readUintLE=Xe.prototype.readUIntLE=function(t,e,r){t=t>>>0,e=e>>>0,!r&&vr(t,e,this.length);let i=this[t],s=1,f=0;for(;++f<e&&(s*=256);)i+=this[t+f]*s;return i},Xe.prototype.readUintBE=Xe.prototype.readUIntBE=function(t,e,r){t=t>>>0,e=e>>>0,!r&&vr(t,e,this.length);let i=this[t+--e],s=1;for(;e>0&&(s*=256);)i+=this[t+--e]*s;return i},Xe.prototype.readUint8=Xe.prototype.readUInt8=function(t,e){return t=t>>>0,!e&&vr(t,1,this.length),this[t]},Xe.prototype.readUint16LE=Xe.prototype.readUInt16LE=function(t,e){return t=t>>>0,!e&&vr(t,2,this.length),this[t]|this[t+1]<<8},Xe.prototype.readUint16BE=Xe.prototype.readUInt16BE=function(t,e){return t=t>>>0,!e&&vr(t,2,this.length),this[t]<<8|this[t+1]},Xe.prototype.readUint32LE=Xe.prototype.readUInt32LE=function(t,e){return t=t>>>0,!e&&vr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},Xe.prototype.readUint32BE=Xe.prototype.readUInt32BE=function(t,e){return t=t>>>0,!e&&vr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Xe.prototype.readBigUInt64LE=un(function(t){t=t>>>0,Cs(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&La(t,this.length-8);let i=e+this[++t]*256+this[++t]*65536+this[++t]*16777216,s=this[++t]+this[++t]*256+this[++t]*65536+r*16777216;return BigInt(i)+(BigInt(s)<<BigInt(32))}),Xe.prototype.readBigUInt64BE=un(function(t){t=t>>>0,Cs(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&La(t,this.length-8);let i=e*16777216+this[++t]*65536+this[++t]*256+this[++t],s=this[++t]*16777216+this[++t]*65536+this[++t]*256+r;return(BigInt(i)<<BigInt(32))+BigInt(s)}),Xe.prototype.readIntLE=function(t,e,r){t=t>>>0,e=e>>>0,!r&&vr(t,e,this.length);let i=this[t],s=1,f=0;for(;++f<e&&(s*=256);)i+=this[t+f]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*e)),i},Xe.prototype.readIntBE=function(t,e,r){t=t>>>0,e=e>>>0,!r&&vr(t,e,this.length);let i=e,s=1,f=this[t+--i];for(;i>0&&(s*=256);)f+=this[t+--i]*s;return s*=128,f>=s&&(f-=Math.pow(2,8*e)),f},Xe.prototype.readInt8=function(t,e){return t=t>>>0,!e&&vr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},Xe.prototype.readInt16LE=function(t,e){t=t>>>0,!e&&vr(t,2,this.length);let r=this[t]|this[t+1]<<8;return r&32768?r|4294901760:r},Xe.prototype.readInt16BE=function(t,e){t=t>>>0,!e&&vr(t,2,this.length);let r=this[t+1]|this[t]<<8;return r&32768?r|4294901760:r},Xe.prototype.readInt32LE=function(t,e){return t=t>>>0,!e&&vr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Xe.prototype.readInt32BE=function(t,e){return t=t>>>0,!e&&vr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Xe.prototype.readBigInt64LE=un(function(t){t=t>>>0,Cs(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&La(t,this.length-8);let i=this[t+4]+this[t+5]*256+this[t+6]*65536+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+this[++t]*256+this[++t]*65536+this[++t]*16777216)}),Xe.prototype.readBigInt64BE=un(function(t){t=t>>>0,Cs(t,"offset");let e=this[t],r=this[t+7];(e===void 0||r===void 0)&&La(t,this.length-8);let i=(e<<24)+this[++t]*65536+this[++t]*256+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*16777216+this[++t]*65536+this[++t]*256+r)}),Xe.prototype.readFloatLE=function(t,e){return t=t>>>0,!e&&vr(t,4,this.length),Ko(this,t,!0,23,4)},Xe.prototype.readFloatBE=function(t,e){return t=t>>>0,!e&&vr(t,4,this.length),Ko(this,t,!1,23,4)},Xe.prototype.readDoubleLE=function(t,e){return t=t>>>0,!e&&vr(t,8,this.length),Ko(this,t,!0,52,8)},Xe.prototype.readDoubleBE=function(t,e){return t=t>>>0,!e&&vr(t,8,this.length),Ko(this,t,!1,52,8)},Xe.prototype.writeUintLE=Xe.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let n=Math.pow(2,8*r)-1;Ir(this,t,e,r,n,0)}let s=1,f=0;for(this[e]=t&255;++f<r&&(s*=256);)this[e+f]=t/s&255;return e+r},Xe.prototype.writeUintBE=Xe.prototype.writeUIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,r=r>>>0,!i){let n=Math.pow(2,8*r)-1;Ir(this,t,e,r,n,0)}let s=r-1,f=1;for(this[e+s]=t&255;--s>=0&&(f*=256);)this[e+s]=t/f&255;return e+r},Xe.prototype.writeUint8=Xe.prototype.writeUInt8=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,1,255,0),this[e]=t&255,e+1},Xe.prototype.writeUint16LE=Xe.prototype.writeUInt16LE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2},Xe.prototype.writeUint16BE=Xe.prototype.writeUInt16BE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2},Xe.prototype.writeUint32LE=Xe.prototype.writeUInt32LE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4},Xe.prototype.writeUint32BE=Xe.prototype.writeUInt32BE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},Xe.prototype.writeBigUInt64LE=un(function(t,e=0){return c0(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),Xe.prototype.writeBigUInt64BE=un(function(t,e=0){return f0(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))}),Xe.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let v=Math.pow(2,8*r-1);Ir(this,t,e,r,v-1,-v)}let s=0,f=1,n=0;for(this[e]=t&255;++s<r&&(f*=256);)t<0&&n===0&&this[e+s-1]!==0&&(n=1),this[e+s]=(t/f>>0)-n&255;return e+r},Xe.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e=e>>>0,!i){let v=Math.pow(2,8*r-1);Ir(this,t,e,r,v-1,-v)}let s=r-1,f=1,n=0;for(this[e+s]=t&255;--s>=0&&(f*=256);)t<0&&n===0&&this[e+s+1]!==0&&(n=1),this[e+s]=(t/f>>0)-n&255;return e+r},Xe.prototype.writeInt8=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1},Xe.prototype.writeInt16LE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2},Xe.prototype.writeInt16BE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2},Xe.prototype.writeInt32LE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},Xe.prototype.writeInt32BE=function(t,e,r){return t=+t,e=e>>>0,!r&&Ir(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4},Xe.prototype.writeBigInt64LE=un(function(t,e=0){return c0(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Xe.prototype.writeBigInt64BE=un(function(t,e=0){return f0(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Xe.prototype.writeFloatLE=function(t,e,r){return d0(this,t,e,!0,r)},Xe.prototype.writeFloatBE=function(t,e,r){return d0(this,t,e,!1,r)},Xe.prototype.writeDoubleLE=function(t,e,r){return h0(this,t,e,!0,r)},Xe.prototype.writeDoubleBE=function(t,e,r){return h0(this,t,e,!1,r)},Xe.prototype.copy=function(t,e,r,i){if(!Xe.isBuffer(t))throw TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<r&&(i=r),i===r||t.length===0||this.length===0)return 0;if(e<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-r&&(i=t.length-e+r);let s=i-r;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,r,i):Uint8Array.prototype.set.call(t,this.subarray(r,i),e),s},Xe.prototype.fill=function(t,e,r,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw TypeError("encoding must be a string");if(typeof i=="string"&&!Xe.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(t.length===1){let f=t.charCodeAt(0);(i==="utf8"&&f<128||i==="latin1")&&(t=f)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw RangeError("Out of range index");if(r<=e)return this;e=e>>>0,r=r===void 0?this.length:r>>>0,!t&&(t=0);let s;if(typeof t=="number")for(s=e;s<r;++s)this[s]=t;else{let f=Xe.isBuffer(t)?t:Xe.from(t,i),n=f.length;if(n===0)throw TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<r-e;++s)this[s+e]=f[s%n]}return this},sy=/[^+/0-9A-Za-z-_]/g,ay=(function(){let t=Array(256);for(let e=0;e<16;++e){let r=e*16;for(let i=0;i<16;++i)t[r+i]="0123456789abcdef"[e]+"0123456789abcdef"[i]}return t})(),oy=Nc("resolveObjectURL"),ly=Nc("isUtf8"),uy=Nc("transcode"),cy=Xe}),Gh={};Rn(Gh,{types:o(()=>U7,"types"),promisify:o(()=>Td,"promisify"),log:o(()=>hy,"log"),isUndefined:o(()=>Ls,"isUndefined"),isSymbol:o(()=>D7,"isSymbol"),isString:o(()=>zu,"isString"),isRegExp:o(()=>Al,"isRegExp"),isPrimitive:o(()=>B7,"isPrimitive"),isObject:o(()=>Js,"isObject"),isNumber:o(()=>dy,"isNumber"),isNullOrUndefined:o(()=>L7,"isNullOrUndefined"),isNull:o(()=>Bu,"isNull"),isFunction:o(()=>Nl,"isFunction"),isError:o(()=>kl,"isError"),isDate:o(()=>Id,"isDate"),isBuffer:o(()=>z7,"isBuffer"),isBoolean:o(()=>Qh,"isBoolean"),isArray:o(()=>fy,"isArray"),inspect:o(()=>vn,"inspect"),inherits:o(()=>py,"inherits"),format:o(()=>Yh,"format"),deprecate:o(()=>C7,"deprecate"),default:o(()=>wy,"default"),debuglog:o(()=>by,"debuglog"),callbackifyOnRejected:o(()=>Xh,"callbackifyOnRejected"),callbackify:o(()=>gy,"callbackify"),_extend:o(()=>Od,"_extend"),TextEncoder:o(()=>Pd,"TextEncoder"),TextDecoder:o(()=>jd,"TextDecoder")});function Yh(t,...e){if(!zu(t)){for(var r=[t],i=0;i<e.length;i++)r.push(vn(e[i]));return r.join(" ")}for(var i=0,s=e.length,f=String(t).replace(vy,function(v){if(v==="%%")return"%";if(i>=s)return v;switch(v){case"%s":return String(e[i++]);case"%d":return Number(e[i++]);case"%j":try{return JSON.stringify(e[i++])}catch{return"[Circular]"}default:return v}}),n=e[i];i<s;n=e[++i])Bu(n)||!Js(n)?f+=" "+n:f+=" "+vn(n);return f}o(Yh,"AH");function C7(t,e){if(typeof process>"u"||process?.noDeprecation===!0)return t;var r=!1;function i(...s){if(!r){if(process.throwDeprecation)throw Error(e);process.traceDeprecation?console.trace(e):console.error(e),r=!0}return t.apply(this,...s)}return o(i,"_"),i}o(C7,"Co");function R7(t,e){var r=vn.styles[e];return r?"\x1B["+vn.colors[r][0]+"m"+t+"\x1B["+vn.colors[r][1]+"m":t}o(R7,"No");function I7(t,e){return t}o(I7,"Ro");function O7(t){var e={};return t.forEach(function(r,i){e[r]=!0}),e}o(O7,"Do");function Fl(t,e,r){if(t.customInspect&&e&&Nl(e.inspect)&&e.inspect!==vn&&!(e.constructor&&e.constructor.prototype===e)){var i=e.inspect(r,t);return zu(i)||(i=Fl(t,i,r)),i}var s=T7(t,e);if(s)return s;var f=Object.keys(e),n=O7(f);if(t.showHidden&&(f=Object.getOwnPropertyNames(e)),kl(e)&&(f.indexOf("message")>=0||f.indexOf("description")>=0))return Ic(e);if(f.length===0){if(Nl(e)){var v=e.name?": "+e.name:"";return t.stylize("[Function"+v+"]","special")}if(Al(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Id(e))return t.stylize(Date.prototype.toString.call(e),"date");if(kl(e))return Ic(e)}var b="",h=!1,m=["{","}"];if(fy(e)&&(h=!0,m=["[","]"]),Nl(e)){var l=e.name?": "+e.name:"";b=" [Function"+l+"]"}if(Al(e)&&(b=" "+RegExp.prototype.toString.call(e)),Id(e)&&(b=" "+Date.prototype.toUTCString.call(e)),kl(e)&&(b=" "+Ic(e)),f.length===0&&(!h||e.length==0))return m[0]+b+m[1];if(r<0)return Al(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var w;return h?w=P7(t,e,r,n,f):w=f.map(function(p){return Rd(t,e,r,n,p,h)}),t.seen.pop(),j7(w,b,m)}o(Fl,"xP");function T7(t,e){if(Ls(e))return t.stylize("undefined","undefined");if(zu(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(dy(e))return t.stylize(""+e,"number");if(Qh(e))return t.stylize(""+e,"boolean");if(Bu(e))return t.stylize("null","null")}o(T7,"Io");function Ic(t){return"["+Error.prototype.toString.call(t)+"]"}o(Ic,"fH");function P7(t,e,r,i,s){for(var f=[],n=0,v=e.length;n<v;++n)my(e,String(n))?f.push(Rd(t,e,r,i,String(n),!0)):f.push("");return s.forEach(function(b){b.match(/^\d+$/)||f.push(Rd(t,e,r,i,b,!0))}),f}o(P7,"ho");function Rd(t,e,r,i,s,f){var n,v,b;if(b=Object.getOwnPropertyDescriptor(e,s)||{value:e[s]},b.get?b.set?v=t.stylize("[Getter/Setter]","special"):v=t.stylize("[Getter]","special"):b.set&&(v=t.stylize("[Setter]","special")),my(i,s)||(n="["+s+"]"),v||(t.seen.indexOf(b.value)<0?(Bu(r)?v=Fl(t,b.value,null):v=Fl(t,b.value,r-1),v.indexOf(`
|
|
25
|
-
`)>-1&&(f?v=v.split(`
|
|
26
|
-
`).map(function(h){return" "+h}).join(`
|
|
27
|
-
`).slice(2):v=`
|
|
28
|
-
`+v.split(`
|
|
29
|
-
`).map(function(h){return" "+h}).join(`
|
|
30
|
-
`))):v=t.stylize("[Circular]","special")),Ls(n)){if(f&&s.match(/^\d+$/))return v;n=JSON.stringify(""+s),n.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(n=n.slice(1,-1),n=t.stylize(n,"name")):(n=n.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),n=t.stylize(n,"string"))}return n+": "+v}o(Rd,"TH");function j7(t,e,r){var i=t.reduce(function(s,f){return f.indexOf(`
|
|
31
|
-
`)>=0,s+f.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(e===""?"":e+`
|
|
32
|
-
`)+" "+t.join(`,
|
|
33
|
-
`)+" "+r[1]:r[0]+e+" "+t.join(", ")+" "+r[1]}o(j7,"Lo");function fy(t){return Array.isArray(t)}o(fy,"rk");function Qh(t){return typeof t=="boolean"}o(Qh,"wH");function Bu(t){return t===null}o(Bu,"pP");function L7(t){return t==null}o(L7,"go");function dy(t){return typeof t=="number"}o(dy,"Fk");function zu(t){return typeof t=="string"}o(zu,"cP");function D7(t){return typeof t=="symbol"}o(D7,"yo");function Ls(t){return t===void 0}o(Ls,"rK");function Al(t){return Js(t)&&Kh(t)==="[object RegExp]"}o(Al,"bP");function Js(t){return typeof t=="object"&&t!==null}o(Js,"FK");function Id(t){return Js(t)&&Kh(t)==="[object Date]"}o(Id,"XH");function kl(t){return Js(t)&&(Kh(t)==="[object Error]"||t instanceof Error)}o(kl,"gP");function Nl(t){return typeof t=="function"}o(Nl,"yP");function B7(t){return t===null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||typeof t=="symbol"||typeof t>"u"}o(B7,"xo");function z7(t){return t instanceof Buffer}o(z7,"po");function Kh(t){return Object.prototype.toString.call(t)}o(Kh,"GH");function Oc(t){return t<10?"0"+t.toString(10):t.toString(10)}o(Oc,"vH");function F7(){var t=new Date,e=[Oc(t.getHours()),Oc(t.getMinutes()),Oc(t.getSeconds())].join(":");return[t.getDate(),yy[t.getMonth()],e].join(" ")}o(F7,"uo");function hy(...t){console.log("%s - %s",F7(),Yh.apply(null,t))}o(hy,"Qk");function py(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}o(py,"ik");function Od(t,e){if(!e||!Js(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t}o(Od,"kH");function my(t,e){return Object.prototype.hasOwnProperty.call(t,e)}o(my,"tk");function Xh(t,e){if(!t){var r=Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}o(Xh,"ZH");function gy(t){if(typeof t!="function")throw TypeError('The "original" argument must be of type Function');function e(...r){var i=r.pop();if(typeof i!="function")throw TypeError("The last argument must be of type Function");var s=this,f=o(function(...n){return i.apply(s,...n)},"O");t.apply(this,r).then(function(n){process.nextTick(f.bind(null,null,n))},function(n){process.nextTick(Xh.bind(null,n,f))})}return o(e,"$"),Object.setPrototypeOf(e,Object.getPrototypeOf(t)),Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)),e}o(gy,"ek");var vy,by,vn,U7=o(()=>{},"bo"),yy,Td,Pd,jd,wy,xy=Po(()=>{vy=/%[sdj%]/g,by=((t={},e={},r)=>((r=typeof process<"u"&&!1)&&(r=r.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase()),e=new RegExp("^"+r+"$","i"),i=>(i=i.toUpperCase(),!t[i]&&(e.test(i)?t[i]=function(...s){console.error("%s: %s",i,pid,Yh.apply(null,...s))}:t[i]=function(){}),t[i])))(),vn=(t=>(t.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},t.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.custom=Symbol.for("nodejs.util.inspect.custom"),t))(function(t,e,...r){var i={seen:[],stylize:I7};return r.length>=1&&(i.depth=r[0]),r.length>=2&&(i.colors=r[1]),Qh(e)?i.showHidden=e:e&&Od(i,e),Ls(i.showHidden)&&(i.showHidden=!1),Ls(i.depth)&&(i.depth=2),Ls(i.colors)&&(i.colors=!1),i.colors&&(i.stylize=R7),Fl(i,t,i.depth)}),yy=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Td=(t=>(t.custom=Symbol.for("nodejs.util.promisify.custom"),t))(function(t){if(typeof t!="function")throw TypeError('The "original" argument must be of type Function');if(kCustomPromisifiedSymbol&&t[kCustomPromisifiedSymbol]){var e=t[kCustomPromisifiedSymbol];if(typeof e!="function")throw TypeError('The "nodejs.util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,kCustomPromisifiedSymbol,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(...r){var i,s,f=new Promise(function(n,v){i=n,s=v});r.push(function(n,v){n?s(n):i(v)});try{t.apply(this,r)}catch(n){s(n)}return f}return o(e,"K"),Object.setPrototypeOf(e,Object.getPrototypeOf(t)),kCustomPromisifiedSymbol&&Object.defineProperty(e,kCustomPromisifiedSymbol,{value:e,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}),{TextEncoder:Pd,TextDecoder:jd}=globalThis,wy={TextEncoder:Pd,TextDecoder:jd,promisify:Td,log:hy,inherits:py,_extend:Od,callbackifyOnRejected:Xh,callbackify:gy}}),Da={};Rn(Da,{setMaxListeners:o(()=>Ey,"setMaxListeners"),once:o(()=>My,"once"),listenerCount:o(()=>Ay,"listenerCount"),init:o(()=>Xi,"init"),getMaxListeners:o(()=>Ny,"getMaxListeners"),getEventListeners:o(()=>Sy,"getEventListeners"),default:o(()=>Ry,"default"),captureRejectionSymbol:o(()=>zd,"captureRejectionSymbol"),addAbortListener:o(()=>Cy,"addAbortListener"),EventEmitter:o(()=>Xi,"EventEmitter")});function _y(t,e){var{_events:r}=t;if(e[0]??=Error("Unhandled error."),!r)throw e[0];var i=r[Dd];if(i)for(var s of Fd.call(i))s.apply(t,e);var f=r.error;if(!f)throw e[0];for(var s of Fd.call(f))s.apply(t,e);return!0}o(_y,"OZ");function H7(t,e,r,i){e.then(void 0,function(s){queueMicrotask(()=>V7(t,s,r,i))})}o(H7,"oo");function V7(t,e,r,i){if(typeof t[Bd]=="function")t[Bd](e,r,...i);else try{t[pn]=!1,t.emit("error",e)}finally{t[pn]=!0}}o(V7,"no");function v0(t,e,r){r.warned=!0;let i=Error(`Possible EventEmitter memory leak detected. ${r.length} ${String(e)} listeners added to [${t.constructor.name}]. Use emitter.setMaxListeners() to increase limit`);i.name="MaxListenersExceededWarning",i.emitter=t,i.type=e,i.count=r.length,console.warn(i)}o(v0,"jZ");function b0(t,e,...r){this.removeListener(t,e),e.apply(this,r)}o(b0,"WZ");function My(t,e,r){var i=r?.signal;if(ky(i,"options.signal"),i?.aborted)throw new Ud(void 0,{cause:i?.reason});let{resolve:s,reject:f,promise:n}=$newPromiseCapability(Promise),v=o(m=>{t.removeListener(e,b),i!=null&&Xo(i,"abort",h),f(m)},"z"),b=o((...m)=>{typeof t.removeListener=="function"&&t.removeListener("error",v),i!=null&&Xo(i,"abort",h),s(m)},"v");y0(t,e,b,{once:!0}),e!=="error"&&typeof t.once=="function"&&t.once("error",v);function h(){Xo(t,e,b),Xo(t,"error",v),f(new Ud(void 0,{cause:i?.reason}))}return o(h,"w"),i!=null&&y0(i,"abort",h,{once:!0}),n}o(My,"HZ");function Sy(t,e){return t.listeners(e)}o(Sy,"JZ");function Ey(t,...e){Ld(t,"setMaxListeners",0);var r;if(e&&(r=e.length))for(let i=0;i<r;i++)e[i].setMaxListeners(t);else Qn=t}o(Ey,"zZ");function Ay(t,e){return t.listenerCount(e)}o(Ay,"fZ");function Xo(t,e,r,i){typeof t.removeListener=="function"?t.removeListener(e,r):t.removeEventListener(e,r,i)}o(Xo,"uP");function y0(t,e,r,i){typeof t.on=="function"?i.once?t.once(e,r):t.on(e,r):t.addEventListener(e,r,i)}o(y0,"_Z");function Us(t,e,r){let i=TypeError(`The "${t}" argument must be of type ${e}. Received ${r}`);return i.code="ERR_INVALID_ARG_TYPE",i}o(Us,"QK");function Z7(t,e,r){let i=RangeError(`The "${t}" argument is out of range. It must be ${e}. Received ${r}`);return i.code="ERR_OUT_OF_RANGE",i}o(Z7,"Fo");function ky(t,e){if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw Us(e,"AbortSignal",t)}o(ky,"vZ");function Ld(t,e,r,i){if(typeof t!="number")throw Us(e,"number",t);if(t<r||i!=null||Number.isNaN(t))throw Z7(e,`${`>= ${r}`}`,t)}o(Ld,"EH");function la(t){if(typeof t!="function")throw TypeError("The listener must be a function")}o(la,"t2");function G7(t,e){if(typeof t!="boolean")throw Us(e,"boolean",t)}o(G7,"Qo");function Ny(t){return t?._maxListeners??Qn}o(Ny,"TZ");function Cy(t,e){if(t===void 0)throw Us("signal","AbortSignal",t);if(ky(t,"signal"),typeof e!="function")throw Us("listener","function",e);let r;return t.aborted?queueMicrotask(()=>e()):(t.addEventListener("abort",e,{__proto__:null,once:!0}),r=o(()=>{t.removeEventListener("abort",e)},"K")),{__proto__:null,[Symbol.dispose](){r?.()}}}o(Cy,"XZ");var Wo,pn,Dd,w0,x0,Bd,zd,Fd,Qn=10,Xi=o(function(t){(this._events===void 0||this._events===this.__proto__._events)&&(this._events={__proto__:null},this._eventsCount=0),this._maxListeners??=void 0,(this[pn]=t?.captureRejections?!!t?.captureRejections:Qt[pn])&&(this.emit=Q7)},"A7"),Qt,Y7=o(function(t,...e){if(t==="error")return _y(this,e);var{_events:r}=this;if(r===void 0)return!1;var i=r[t];if(i===void 0)return!1;let s=i.length>1?i.slice():i;for(let f=0,{length:n}=s;f<n;f++){let v=s[f];switch(e.length){case 0:v.call(this);break;case 1:v.call(this,e[0]);break;case 2:v.call(this,e[0],e[1]);break;case 3:v.call(this,e[0],e[1],e[2]);break;default:v.apply(this,e);break}}return!0},"Uo"),Q7=o(function(t,...e){if(t==="error")return _y(this,e);var{_events:r}=this;if(r===void 0)return!1;var i=r[t];if(i===void 0)return!1;let s=i.length>1?i.slice():i;for(let f=0,{length:n}=s;f<n;f++){let v=s[f],b;switch(e.length){case 0:b=v.call(this);break;case 1:b=v.call(this,e[0]);break;case 2:b=v.call(this,e[0],e[1]);break;case 3:b=v.call(this,e[0],e[1],e[2]);break;default:b=v.apply(this,e);break}b!==void 0&&typeof b?.then=="function"&&b.then===Promise.prototype.then&&H7(this,b,t,e)}return!0},"ro"),Ud,Ry,$o=Po(()=>{Wo=Symbol.for,pn=Symbol("kCapture"),Dd=Wo("events.errorMonitor"),w0=Symbol("events.maxEventTargetListeners"),x0=Symbol("events.maxEventTargetListenersWarned"),Bd=Wo("nodejs.rejection"),zd=Wo("nodejs.rejection"),Fd=Array.prototype.slice,Qt=Xi.prototype={},Qt._events=void 0,Qt._eventsCount=0,Qt._maxListeners=void 0,Qt.setMaxListeners=function(t){return Ld(t,"setMaxListeners",0),this._maxListeners=t,this},Qt.constructor=Xi,Qt.getMaxListeners=function(){return this?._maxListeners??Qn},Qt.emit=Y7,Qt.addListener=function(t,e){la(e);var r=this._events;r?r.newListener&&this.emit("newListener",t,e.listener??e):(r=this._events={__proto__:null},this._eventsCount=0);var i=r[t];if(!i)r[t]=[e],this._eventsCount++;else{i.push(e);var s=this._maxListeners??Qn;s>0&&i.length>s&&!i.warned&&v0(this,t,i)}return this},Qt.on=Qt.addListener,Qt.prependListener=function(t,e){la(e);var r=this._events;r?r.newListener&&this.emit("newListener",t,e.listener??e):(r=this._events={__proto__:null},this._eventsCount=0);var i=r[t];if(!i)r[t]=[e],this._eventsCount++;else{i.unshift(e);var s=this._maxListeners??Qn;s>0&&i.length>s&&!i.warned&&v0(this,t,i)}return this},Qt.once=function(t,e){la(e);let r=b0.bind(this,t,e);return r.listener=e,this.addListener(t,r),this},Qt.prependOnceListener=function(t,e){la(e);let r=b0.bind(this,t,e);return r.listener=e,this.prependListener(t,r),this},Qt.removeListener=function(t,e){la(e);var{_events:r}=this;if(!r)return this;var i=r[t];if(!i)return this;var s=i.length;let f=-1;for(let n=s-1;n>=0;n--)if(i[n]===e||i[n].listener===e){f=n;break}return f<0?this:(f===0?i.shift():i.splice(f,1),i.length===0&&(delete r[t],this._eventsCount--),this)},Qt.off=Qt.removeListener,Qt.removeAllListeners=function(t){var{_events:e}=this;return t&&e?e[t]&&(delete e[t],this._eventsCount--):this._events={__proto__:null},this},Qt.listeners=function(t){var{_events:e}=this;if(!e)return[];var r=e[t];return r?r.map(i=>i.listener??i):[]},Qt.rawListeners=function(t){var{_events:e}=this;if(!e)return[];var r=e[t];return r?r.slice():[]},Qt.listenerCount=function(t){var{_events:e}=this;return e?e[t]?.length??0:0},Qt.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]},Qt[pn]=!1,Ud=class extends Error{static{o(this,"SH")}constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw Us("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}},Object.defineProperties(Xi,{captureRejections:{get(){return Qt[pn]},set(t){G7(t,"EventEmitter.captureRejections"),Qt[pn]=t},enumerable:!0},defaultMaxListeners:{enumerable:!0,get:o(()=>Qn,"get"),set:o(t=>{Ld(t,"defaultMaxListeners",0),Qn=t},"set")},kMaxEventTargetListeners:{value:w0,enumerable:!1,configurable:!1,writable:!1},kMaxEventTargetListenersWarned:{value:x0,enumerable:!1,configurable:!1,writable:!1}}),Object.assign(Xi,{once:My,getEventListeners:Sy,getMaxListeners:Ny,setMaxListeners:Ey,EventEmitter:Xi,usingDomains:!1,captureRejectionSymbol:zd,errorMonitor:Dd,addAbortListener:Cy,init:Xi,listenerCount:Ay}),Ry=Xi}),Fu=ye((t,e)=>{var r=o((A,N)=>()=>(N||A((N={exports:{}}).exports,N),N.exports),"n6"),i=r((A,N)=>{class S extends Error{static{o(this,"K")}constructor(_){if(!Array.isArray(_))throw TypeError(`Expected input to be an Array, got ${typeof _}`);let C="";for(let O=0;O<_.length;O++)C+=` ${_[O].stack}
|
|
34
|
-
`;super(C),this.name="AggregateError",this.errors=_}}N.exports={AggregateError:S,ArrayIsArray(c){return Array.isArray(c)},ArrayPrototypeIncludes(c,_){return c.includes(_)},ArrayPrototypeIndexOf(c,_){return c.indexOf(_)},ArrayPrototypeJoin(c,_){return c.join(_)},ArrayPrototypeMap(c,_){return c.map(_)},ArrayPrototypePop(c,_){return c.pop(_)},ArrayPrototypePush(c,_){return c.push(_)},ArrayPrototypeSlice(c,_,C){return c.slice(_,C)},Error,FunctionPrototypeCall(c,_,...C){return c.call(_,...C)},FunctionPrototypeSymbolHasInstance(c,_){return Function.prototype[Symbol.hasInstance].call(c,_)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(c,_){return Object.defineProperties(c,_)},ObjectDefineProperty(c,_,C){return Object.defineProperty(c,_,C)},ObjectGetOwnPropertyDescriptor(c,_){return Object.getOwnPropertyDescriptor(c,_)},ObjectKeys(c){return Object.keys(c)},ObjectSetPrototypeOf(c,_){return Object.setPrototypeOf(c,_)},Promise,PromisePrototypeCatch(c,_){return c.catch(_)},PromisePrototypeThen(c,_,C){return c.then(_,C)},PromiseReject(c){return Promise.reject(c)},PromiseResolve(c){return Promise.resolve(c)},ReflectApply:Reflect.apply,RegExpPrototypeTest(c,_){return c.test(_)},SafeSet:Set,String,StringPrototypeSlice(c,_,C){return c.slice(_,C)},StringPrototypeToLowerCase(c){return c.toLowerCase()},StringPrototypeToUpperCase(c){return c.toUpperCase()},StringPrototypeTrim(c){return c.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(c,_,C){return c.set(_,C)},Boolean,Uint8Array}}),s=r((A,N)=>{N.exports={format(S,...c){return S.replace(/%([sdifj])/g,function(...[_,C]){let O=c.shift();return C==="f"?O.toFixed(6):C==="j"?JSON.stringify(O):C==="s"&&typeof O=="object"?`${O.constructor!==Object?O.constructor.name:""} {}`.trim():O.toString()})},inspect(S){switch(typeof S){case"string":if(S.includes("'"))if(S.includes('"')){if(!S.includes("`")&&!S.includes("${"))return`\`${S}\``}else return`"${S}"`;return`'${S}'`;case"number":return isNaN(S)?"NaN":Object.is(S,-0)?String(S):S;case"bigint":return`${String(S)}n`;case"boolean":case"undefined":return String(S);case"object":return"{}"}}}}),f=r((A,N)=>{var{format:S,inspect:c}=s(),{AggregateError:_}=i(),C=globalThis.AggregateError||_,O=Symbol("kIsNodeError"),D=["string","function","number","object","Function","Object","boolean","bigint","symbol"],B=/^([A-Z][a-z0-9]*)+$/,z={};function G(be,H){if(!be)throw new z.ERR_INTERNAL_ASSERTION(H)}o(G,"V");function te(be){let H="",ee=be.length,Q=be[0]==="-"?1:0;for(;ee>=Q+4;ee-=3)H=`_${be.slice(ee-3,ee)}${H}`;return`${be.slice(0,ee)}${H}`}o(te,"Z");function $(be,H,ee){if(typeof H=="function")return G(H.length<=ee.length,`Code: ${be}; The provided arguments length (${ee.length}) does not match the required ones (${H.length}).`),H(...ee);let Q=(H.match(/%[dfijoOs]/g)||[]).length;return G(Q===ee.length,`Code: ${be}; The provided arguments length (${ee.length}) does not match the required ones (${Q}).`),ee.length===0?H:S(H,...ee)}o($,"S");function q(be,H,ee){ee||(ee=Error);class Q extends ee{static{o(this,"x")}constructor(...se){super($(be,H,se))}toString(){return`${this.name} [${be}]: ${this.message}`}}Object.defineProperties(Q.prototype,{name:{value:ee.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${be}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),Q.prototype.code=be,Q.prototype[O]=!0,z[be]=Q}o(q,"C");function Ce(be){let H="__node_internal_"+be.name;return Object.defineProperty(be,"name",{value:H}),be}o(Ce,"E");function fe(be,H){if(be&&H&&be!==H){if(Array.isArray(H.errors))return H.errors.push(be),H;let ee=new C([H,be],H.message);return ee.code=H.code,ee}return be||H}o(fe,"I");class ae extends Error{static{o(this,"L")}constructor(H="The operation was aborted",ee=void 0){if(ee!==void 0&&typeof ee!="object")throw new z.ERR_INVALID_ARG_TYPE("options","Object",ee);super(H,ee),this.code="ABORT_ERR",this.name="AbortError"}}q("ERR_ASSERTION","%s",Error),q("ERR_INVALID_ARG_TYPE",(be,H,ee)=>{G(typeof be=="string","'name' must be a string"),!Array.isArray(H)&&(H=[H]);let Q="The ";be.endsWith(" argument")?Q+=`${be} `:Q+=`"${be}" ${be.includes(".")?"property":"argument"} `,Q+="must be ";let X=[],se=[],Ne=[];for(let ue of H)G(typeof ue=="string","All expected entries have to be of type string"),D.includes(ue)?X.push(ue.toLowerCase()):B.test(ue)?se.push(ue):(G(ue!=="object",'The value "object" should be written as "Object"'),Ne.push(ue));if(se.length>0){let ue=X.indexOf("object");ue!==-1&&(X.splice(X,ue,1),se.push("Object"))}if(X.length>0){switch(X.length){case 1:Q+=`of type ${X[0]}`;break;case 2:Q+=`one of type ${X[0]} or ${X[1]}`;break;default:{let ue=X.pop();Q+=`one of type ${X.join(", ")}, or ${ue}`}}(se.length>0||Ne.length>0)&&(Q+=" or ")}if(se.length>0){switch(se.length){case 1:Q+=`an instance of ${se[0]}`;break;case 2:Q+=`an instance of ${se[0]} or ${se[1]}`;break;default:{let ue=se.pop();Q+=`an instance of ${se.join(", ")}, or ${ue}`}}Ne.length>0&&(Q+=" or ")}switch(Ne.length){case 0:break;case 1:Ne[0].toLowerCase()!==Ne[0]&&(Q+="an "),Q+=`${Ne[0]}`;break;case 2:Q+=`one of ${Ne[0]} or ${Ne[1]}`;break;default:{let ue=Ne.pop();Q+=`one of ${Ne.join(", ")}, or ${ue}`}}if(ee==null)Q+=`. Received ${ee}`;else if(typeof ee=="function"&&ee.name)Q+=`. Received function ${ee.name}`;else if(typeof ee=="object"){var we;if((we=ee.constructor)!==null&&we!==void 0&&we.name)Q+=`. Received an instance of ${ee.constructor.name}`;else{let ue=c(ee,{depth:-1});Q+=`. Received ${ue}`}}else{let ue=c(ee,{colors:!1});ue.length>25&&(ue=`${ue.slice(0,25)}...`),Q+=`. Received type ${typeof ee} (${ue})`}return Q},TypeError),q("ERR_INVALID_ARG_VALUE",(be,H,ee="is invalid")=>{let Q=c(H);return Q.length>128&&(Q=Q.slice(0,128)+"..."),`The ${be.includes(".")?"property":"argument"} '${be}' ${ee}. Received ${Q}`},TypeError),q("ERR_INVALID_RETURN_VALUE",(be,H,ee)=>{var Q;let X=ee!=null&&(Q=ee.constructor)!==null&&Q!==void 0&&Q.name?`instance of ${ee.constructor.name}`:`type ${typeof ee}`;return`Expected ${be} to be returned from the "${H}" function but got ${X}.`},TypeError),q("ERR_MISSING_ARGS",(...be)=>{G(be.length>0,"At least one arg needs to be specified");let H,ee=be.length;switch(be=(Array.isArray(be)?be:[be]).map(Q=>`"${Q}"`).join(" or "),ee){case 1:H+=`The ${be[0]} argument`;break;case 2:H+=`The ${be[0]} and ${be[1]} arguments`;break;default:{let Q=be.pop();H+=`The ${be.join(", ")}, and ${Q} arguments`}break}return`${H} must be specified`},TypeError),q("ERR_OUT_OF_RANGE",(be,H,ee)=>{G(H,'Missing "range" argument');let Q;if(Number.isInteger(ee)&&Math.abs(ee)>4294967296)Q=te(String(ee));else if(typeof ee=="bigint"){Q=String(ee);let X=BigInt(2)**BigInt(32);(ee>X||ee<-X)&&(Q=te(Q)),Q+="n"}else Q=c(ee);return`The value of "${be}" is out of range. It must be ${H}. Received ${Q}`},RangeError),q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),q("ERR_STREAM_WRITE_AFTER_END","write after end",Error),q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),N.exports={AbortError:ae,aggregateTwoErrors:Ce(fe),hideStackFrames:Ce,codes:z}}),n=r((A,N)=>{Object.defineProperty(A,"__esModule",{value:!0});var S=new WeakMap,c=new WeakMap;function _(K){let W=S.get(K);return console.assert(W!=null,"'this' is expected an Event object, but got",K),W}o(_,"P");function C(K){if(K.passiveListener!=null){typeof console<"u"&&typeof console.error=="function"&&console.error("Unable to preventDefault inside passive event listener invocation.",K.passiveListener);return}K.event.cancelable&&(K.canceled=!0,typeof K.event.preventDefault=="function"&&K.event.preventDefault())}o(C,"O");function O(K,W){S.set(this,{eventTarget:K,event:W,eventPhase:2,currentTarget:K,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:W.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let J=Object.keys(W);for(let pe=0;pe<J.length;++pe){let le=J[pe];le in this||Object.defineProperty(this,le,D(le))}}o(O,"Y"),O.prototype={get type(){return _(this).event.type},get target(){return _(this).eventTarget},get currentTarget(){return _(this).currentTarget},composedPath(){let K=_(this).currentTarget;return K==null?[]:[K]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return _(this).eventPhase},stopPropagation(){let K=_(this);K.stopped=!0,typeof K.event.stopPropagation=="function"&&K.event.stopPropagation()},stopImmediatePropagation(){let K=_(this);K.stopped=!0,K.immediateStopped=!0,typeof K.event.stopImmediatePropagation=="function"&&K.event.stopImmediatePropagation()},get bubbles(){return!!_(this).event.bubbles},get cancelable(){return!!_(this).event.cancelable},preventDefault(){C(_(this))},get defaultPrevented(){return _(this).canceled},get composed(){return!!_(this).event.composed},get timeStamp(){return _(this).timeStamp},get srcElement(){return _(this).eventTarget},get cancelBubble(){return _(this).stopped},set cancelBubble(K){if(!K)return;let W=_(this);W.stopped=!0,typeof W.event.cancelBubble=="boolean"&&(W.event.cancelBubble=!0)},get returnValue(){return!_(this).canceled},set returnValue(K){K||C(_(this))},initEvent(){}},Object.defineProperty(O.prototype,"constructor",{value:O,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.Event<"u"&&(Object.setPrototypeOf(O.prototype,window.Event.prototype),c.set(window.Event.prototype,O));function D(K){return{get(){return _(this).event[K]},set(W){_(this).event[K]=W},configurable:!0,enumerable:!0}}o(D,"z");function B(K){return{value(){let W=_(this).event;return W[K].apply(W,arguments)},configurable:!0,enumerable:!0}}o(B,"v");function z(K,W){let J=Object.keys(W);if(J.length===0)return K;function pe(le,oe){K.call(this,le,oe)}o(pe,"j"),pe.prototype=Object.create(K.prototype,{constructor:{value:pe,configurable:!0,writable:!0}});for(let le=0;le<J.length;++le){let oe=J[le];if(!(oe in K.prototype)){let Ve=typeof Object.getOwnPropertyDescriptor(W,oe).value=="function";Object.defineProperty(pe.prototype,oe,Ve?B(oe):D(oe))}}return pe}o(z,"w");function G(K){if(K==null||K===Object.prototype)return O;let W=c.get(K);return W==null&&(W=z(G(Object.getPrototypeOf(K)),K),c.set(K,W)),W}o(G,"V");function te(K,W){return new(G(Object.getPrototypeOf(W)))(K,W)}o(te,"Z");function $(K){return _(K).immediateStopped}o($,"S");function q(K,W){_(K).eventPhase=W}o(q,"C");function Ce(K,W){_(K).currentTarget=W}o(Ce,"E");function fe(K,W){_(K).passiveListener=W}o(fe,"I");var ae=new WeakMap,be=1,H=2,ee=3;function Q(K){return K!==null&&typeof K=="object"}o(Q,"x");function X(K){let W=ae.get(K);if(W==null)throw TypeError("'this' is expected an EventTarget object, but got another value.");return W}o(X,"c");function se(K){return{get(){let W=X(this).get(K);for(;W!=null;){if(W.listenerType===ee)return W.listener;W=W.next}return null},set(W){typeof W!="function"&&!Q(W)&&(W=null);let J=X(this),pe=null,le=J.get(K);for(;le!=null;)le.listenerType===ee?pe!==null?pe.next=le.next:le.next!==null?J.set(K,le.next):J.delete(K):pe=le,le=le.next;if(W!==null){let oe={listener:W,listenerType:ee,passive:!1,once:!1,next:null};pe===null?J.set(K,oe):pe.next=oe}},configurable:!0,enumerable:!0}}o(se,"l");function Ne(K,W){Object.defineProperty(K,`on${W}`,se(W))}o(Ne,"B");function we(K){function W(){ue.call(this)}o(W,"D"),W.prototype=Object.create(ue.prototype,{constructor:{value:W,configurable:!0,writable:!0}});for(let J=0;J<K.length;++J)Ne(W.prototype,K[J]);return W}o(we,"s");function ue(){if(this instanceof ue){ae.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return we(arguments[0]);if(arguments.length>0){let K=Array(arguments.length);for(let W=0;W<arguments.length;++W)K[W]=arguments[W];return we(K)}throw TypeError("Cannot call a class as a function")}o(ue,"K8"),ue.prototype={addEventListener(K,W,J){if(W==null)return;if(typeof W!="function"&&!Q(W))throw TypeError("'listener' should be a function or an object.");let pe=X(this),le=Q(J),oe=(le?J.capture:J)?be:H,Ve={listener:W,listenerType:oe,passive:le&&!!J.passive,once:le&&!!J.once,next:null},_e=pe.get(K);if(_e===void 0){pe.set(K,Ve);return}let Le=null;for(;_e!=null;){if(_e.listener===W&&_e.listenerType===oe)return;Le=_e,_e=_e.next}Le.next=Ve},removeEventListener(K,W,J){if(W==null)return;let pe=X(this),le=(Q(J)?J.capture:J)?be:H,oe=null,Ve=pe.get(K);for(;Ve!=null;){if(Ve.listener===W&&Ve.listenerType===le){oe!==null?oe.next=Ve.next:Ve.next!==null?pe.set(K,Ve.next):pe.delete(K);return}oe=Ve,Ve=Ve.next}},dispatchEvent(K){if(K==null||typeof K.type!="string")throw TypeError('"event.type" should be a string.');let W=X(this),J=K.type,pe=W.get(J);if(pe==null)return!0;let le=te(this,K),oe=null;for(;pe!=null;){if(pe.once?oe!==null?oe.next=pe.next:pe.next!==null?W.set(J,pe.next):W.delete(J):oe=pe,fe(le,pe.passive?pe.listener:null),typeof pe.listener=="function")try{pe.listener.call(this,le)}catch(Ve){typeof console<"u"&&typeof console.error=="function"&&console.error(Ve)}else pe.listenerType!==ee&&typeof pe.listener.handleEvent=="function"&&pe.listener.handleEvent(le);if($(le))break;pe=pe.next}return fe(le,null),q(le,0),Ce(le,null),!le.defaultPrevented}},Object.defineProperty(ue.prototype,"constructor",{value:ue,configurable:!0,writable:!0}),typeof window<"u"&&typeof window.EventTarget<"u"&&Object.setPrototypeOf(ue.prototype,window.EventTarget.prototype),A.defineEventAttribute=Ne,A.EventTarget=ue,A.default=ue,N.exports=ue,N.exports.EventTarget=N.exports.default=ue,N.exports.defineEventAttribute=Ne}),v=r((A,N)=>{Object.defineProperty(A,"__esModule",{value:!0});var S=n();class c extends S.EventTarget{static{o(this,"_")}constructor(){throw super(),TypeError("AbortSignal cannot be constructed directly")}get aborted(){let te=O.get(this);if(typeof te!="boolean")throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?"null":typeof this}`);return te}}S.defineEventAttribute(c.prototype,"abort");function _(){let G=Object.create(c.prototype);return S.EventTarget.call(G),O.set(G,!1),G}o(_,"P");function C(G){O.get(G)===!1&&(O.set(G,!0),G.dispatchEvent({type:"abort"}))}o(C,"O");var O=new WeakMap;Object.defineProperties(c.prototype,{aborted:{enumerable:!0}}),typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(c.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});class D{static{o(this,"z")}constructor(){B.set(this,_())}get signal(){return z(this)}abort(){C(z(this))}}var B=new WeakMap;function z(G){let te=B.get(G);if(te==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${G===null?"null":typeof G}`);return te}o(z,"w"),Object.defineProperties(D.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol"&&Object.defineProperty(D.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"}),A.AbortController=D,A.AbortSignal=c,A.default=D,N.exports=D,N.exports.AbortController=N.exports.default=D,N.exports.AbortSignal=c}),b=r((A,N)=>{var S=(sr(),bt(er)),{format:c,inspect:_}=s(),{codes:{ERR_INVALID_ARG_TYPE:C}}=f(),{kResistStopPropagation:O,AggregateError:D,SymbolDispose:B}=i(),z=globalThis.AbortSignal||v().AbortSignal,G=globalThis.AbortController||v().AbortController,te=Object.getPrototypeOf(async function(){}).constructor,$=globalThis.Blob||S.Blob,q=typeof $<"u"?function(ae){return ae instanceof $}:function(ae){return!1},Ce=o((ae,be)=>{if(ae!==void 0&&(ae===null||typeof ae!="object"||!("aborted"in ae)))throw new C(be,"AbortSignal",ae)},"E"),fe=o((ae,be)=>{if(typeof ae!="function")throw new C(be,"Function",ae)},"I");N.exports={AggregateError:D,kEmptyObject:Object.freeze({}),once(ae){let be=!1;return function(...H){be||(be=!0,ae.apply(this,H))}},createDeferredPromise:o(function(){let ae,be;return{promise:new Promise((H,ee)=>{ae=H,be=ee}),resolve:ae,reject:be}},"createDeferredPromise"),promisify(ae){return new Promise((be,H)=>{ae((ee,...Q)=>ee?H(ee):be(...Q))})},debuglog(){return function(){}},format:c,inspect:_,types:{isAsyncFunction(ae){return ae instanceof te},isArrayBufferView(ae){return ArrayBuffer.isView(ae)}},isBlob:q,deprecate(ae,be){return ae},addAbortListener:($o(),bt(Da)).addAbortListener||function(ae,be){if(ae===void 0)throw new C("signal","AbortSignal",ae);Ce(ae,"signal"),fe(be,"listener");let H;return ae.aborted?queueMicrotask(()=>be()):(ae.addEventListener("abort",be,{__proto__:null,once:!0,[O]:!0}),H=o(()=>{ae.removeEventListener("abort",be)},"y")),{__proto__:null,[B](){var ee;(ee=H)===null||ee===void 0||ee()}}},AbortSignalAny:z.any||function(ae){if(ae.length===1)return ae[0];let be=new G,H=o(()=>be.abort(),"y");return ae.forEach(ee=>{Ce(ee,"signals"),ee.addEventListener("abort",H,{once:!0})}),be.signal.addEventListener("abort",()=>{ae.forEach(ee=>ee.removeEventListener("abort",H))},{once:!0}),be.signal}},N.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}),h=r((A,N)=>{var{ArrayIsArray:S,ArrayPrototypeIncludes:c,ArrayPrototypeJoin:_,ArrayPrototypeMap:C,NumberIsInteger:O,NumberIsNaN:D,NumberMAX_SAFE_INTEGER:B,NumberMIN_SAFE_INTEGER:z,NumberParseInt:G,ObjectPrototypeHasOwnProperty:te,RegExpPrototypeExec:$,String:q,StringPrototypeToUpperCase:Ce,StringPrototypeTrim:fe}=i(),{hideStackFrames:ae,codes:{ERR_SOCKET_BAD_PORT:be,ERR_INVALID_ARG_TYPE:H,ERR_INVALID_ARG_VALUE:ee,ERR_OUT_OF_RANGE:Q,ERR_UNKNOWN_SIGNAL:X}}=f(),{normalizeEncoding:se}=b(),{isAsyncFunction:Ne,isArrayBufferView:we}=b().types,ue={};function K(ie){return ie===(ie|0)}o(K,"p");function W(ie){return ie===ie>>>0}o(W,"D");var J=/^[0-7]+$/,pe="must be a 32-bit unsigned integer or an octal string";function le(ie,Ae,Ye){if(typeof ie>"u"&&(ie=Ye),typeof ie=="string"){if($(J,ie)===null)throw new ee(Ae,ie,pe);ie=G(ie,8)}return _e(ie,Ae),ie}o(le,"W");var oe=ae((ie,Ae,Ye=z,me=B)=>{if(typeof ie!="number")throw new H(Ae,"number",ie);if(!O(ie))throw new Q(Ae,"an integer",ie);if(ie<Ye||ie>me)throw new Q(Ae,`>= ${Ye} && <= ${me}`,ie)}),Ve=ae((ie,Ae,Ye=-2147483648,me=2147483647)=>{if(typeof ie!="number")throw new H(Ae,"number",ie);if(!O(ie))throw new Q(Ae,"an integer",ie);if(ie<Ye||ie>me)throw new Q(Ae,`>= ${Ye} && <= ${me}`,ie)}),_e=ae((ie,Ae,Ye=!1)=>{if(typeof ie!="number")throw new H(Ae,"number",ie);if(!O(ie))throw new Q(Ae,"an integer",ie);let me=Ye?1:0,Qe=4294967295;if(ie<me||ie>Qe)throw new Q(Ae,`>= ${me} && <= ${Qe}`,ie)});function Le(ie,Ae){if(typeof ie!="string")throw new H(Ae,"string",ie)}o(Le,"k");function qe(ie,Ae,Ye=void 0,me){if(typeof ie!="number")throw new H(Ae,"number",ie);if(Ye!=null&&ie<Ye||me!=null&&ie>me||(Ye!=null||me!=null)&&D(ie))throw new Q(Ae,`${Ye!=null?`>= ${Ye}`:""}${Ye!=null&&me!=null?" && ":""}${me!=null?`<= ${me}`:""}`,ie)}o(qe,"G");var ge=ae((ie,Ae,Ye)=>{if(!c(Ye,ie)){let me="must be one of: "+_(C(Ye,Qe=>typeof Qe=="string"?`'${Qe}'`:q(Qe)),", ");throw new ee(Ae,ie,me)}});function De(ie,Ae){if(typeof ie!="boolean")throw new H(Ae,"boolean",ie)}o(De,"H");function he(ie,Ae,Ye){return ie==null||!te(ie,Ae)?Ye:ie[Ae]}o(he,"X");var ve=ae((ie,Ae,Ye=null)=>{let me=he(Ye,"allowArray",!1),Qe=he(Ye,"allowFunction",!1);if(!he(Ye,"nullable",!1)&&ie===null||!me&&S(ie)||typeof ie!="object"&&(!Qe||typeof ie!="function"))throw new H(Ae,"Object",ie)}),Oe=ae((ie,Ae)=>{if(ie!=null&&typeof ie!="object"&&typeof ie!="function")throw new H(Ae,"a dictionary",ie)}),je=ae((ie,Ae,Ye=0)=>{if(!S(ie))throw new H(Ae,"Array",ie);if(ie.length<Ye){let me=`must be longer than ${Ye}`;throw new ee(Ae,ie,me)}});function ke(ie,Ae){je(ie,Ae);for(let Ye=0;Ye<ie.length;Ye++)Le(ie[Ye],`${Ae}[${Ye}]`)}o(ke,"u");function Fe(ie,Ae){je(ie,Ae);for(let Ye=0;Ye<ie.length;Ye++)De(ie[Ye],`${Ae}[${Ye}]`)}o(Fe,"o");function et(ie,Ae){je(ie,Ae);for(let Ye=0;Ye<ie.length;Ye++){let me=ie[Ye],Qe=`${Ae}[${Ye}]`;if(me==null)throw new H(Qe,"AbortSignal",me);Ue(me,Qe)}}o(et,"Q");function Ie(ie,Ae="signal"){if(Le(ie,Ae),ue[ie]===void 0)throw ue[Ce(ie)]!==void 0?new X(ie+" (signals must use all capital letters)"):new X(ie)}o(Ie,"j8");var Se=ae((ie,Ae="buffer")=>{if(!we(ie))throw new H(Ae,["Buffer","TypedArray","DataView"],ie)});function Be(ie,Ae){let Ye=se(Ae),me=ie.length;if(Ye==="hex"&&me%2!==0)throw new ee("encoding",Ae,`is invalid for data of length ${me}`)}o(Be,"n");function Ee(ie,Ae="Port",Ye=!0){if(typeof ie!="number"&&typeof ie!="string"||typeof ie=="string"&&fe(ie).length===0||+ie!==+ie>>>0||ie>65535||ie===0&&!Ye)throw new be(Ae,ie,Ye);return ie|0}o(Ee,"G8");var Ue=ae((ie,Ae)=>{if(ie!==void 0&&(ie===null||typeof ie!="object"||!("aborted"in ie)))throw new H(Ae,"AbortSignal",ie)}),Je=ae((ie,Ae)=>{if(typeof ie!="function")throw new H(Ae,"Function",ie)}),re=ae((ie,Ae)=>{if(typeof ie!="function"||Ne(ie))throw new H(Ae,"Function",ie)}),de=ae((ie,Ae)=>{if(ie!==void 0)throw new H(Ae,"undefined",ie)});function Pe(ie,Ae,Ye){if(!c(Ye,ie))throw new H(Ae,`('${_(Ye,"|")}')`,ie)}o(Pe,"r");var Me=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Re(ie,Ae){if(typeof ie>"u"||!$(Me,ie))throw new ee(Ae,ie,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}o(Re,"Y8");function Ke(ie){if(typeof ie=="string")return Re(ie,"hints"),ie;if(S(ie)){let Ae=ie.length,Ye="";if(Ae===0)return Ye;for(let me=0;me<Ae;me++){let Qe=ie[me];Re(Qe,"hints"),Ye+=Qe,me!==Ae-1&&(Ye+=", ")}return Ye}throw new ee("hints",ie,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}o(Ke,"e"),N.exports={isInt32:K,isUint32:W,parseFileMode:le,validateArray:je,validateStringArray:ke,validateBooleanArray:Fe,validateAbortSignalArray:et,validateBoolean:De,validateBuffer:Se,validateDictionary:Oe,validateEncoding:Be,validateFunction:Je,validateInt32:Ve,validateInteger:oe,validateNumber:qe,validateObject:ve,validateOneOf:ge,validatePlainFunction:re,validatePort:Ee,validateSignalName:Ie,validateString:Le,validateUint32:_e,validateUndefined:de,validateUnion:Pe,validateAbortSignal:Ue,validateLinkHeaderValue:Ke}}),m=r((A,N)=>{N.exports=globalThis.process}),l=r((A,N)=>{var{SymbolAsyncIterator:S,SymbolIterator:c,SymbolFor:_}=i(),C=_("nodejs.stream.destroyed"),O=_("nodejs.stream.errored"),D=_("nodejs.stream.readable"),B=_("nodejs.stream.writable"),z=_("nodejs.stream.disturbed"),G=_("nodejs.webstream.isClosedPromise"),te=_("nodejs.webstream.controllerErrorFunction");function $(he,ve=!1){var Oe;return!!(he&&typeof he.pipe=="function"&&typeof he.on=="function"&&(!ve||typeof he.pause=="function"&&typeof he.resume=="function")&&(!he._writableState||((Oe=he._readableState)===null||Oe===void 0?void 0:Oe.readable)!==!1)&&(!he._writableState||he._readableState))}o($,"S");function q(he){var ve;return!!(he&&typeof he.write=="function"&&typeof he.on=="function"&&(!he._readableState||((ve=he._writableState)===null||ve===void 0?void 0:ve.writable)!==!1))}o(q,"C");function Ce(he){return!!(he&&typeof he.pipe=="function"&&he._readableState&&typeof he.on=="function"&&typeof he.write=="function")}o(Ce,"E");function fe(he){return he&&(he._readableState||he._writableState||typeof he.write=="function"&&typeof he.on=="function"||typeof he.pipe=="function"&&typeof he.on=="function")}o(fe,"I");function ae(he){return!!(he&&!fe(he)&&typeof he.pipeThrough=="function"&&typeof he.getReader=="function"&&typeof he.cancel=="function")}o(ae,"L");function be(he){return!!(he&&!fe(he)&&typeof he.getWriter=="function"&&typeof he.abort=="function")}o(be,"h");function H(he){return!!(he&&!fe(he)&&typeof he.readable=="object"&&typeof he.writable=="object")}o(H,"b");function ee(he){return ae(he)||be(he)||H(he)}o(ee,"y");function Q(he,ve){return he==null?!1:ve===!0?typeof he[S]=="function":ve===!1?typeof he[c]=="function":typeof he[S]=="function"||typeof he[c]=="function"}o(Q,"x");function X(he){if(!fe(he))return null;let{_writableState:ve,_readableState:Oe}=he,je=ve||Oe;return!!(he.destroyed||he[C]||je!=null&&je.destroyed)}o(X,"c");function se(he){if(!q(he))return null;if(he.writableEnded===!0)return!0;let ve=he._writableState;return ve!=null&&ve.errored?!1:typeof ve?.ended!="boolean"?null:ve.ended}o(se,"l");function Ne(he,ve){if(!q(he))return null;if(he.writableFinished===!0)return!0;let Oe=he._writableState;return Oe!=null&&Oe.errored?!1:typeof Oe?.finished!="boolean"?null:!!(Oe.finished||ve===!1&&Oe.ended===!0&&Oe.length===0)}o(Ne,"B");function we(he){if(!$(he))return null;if(he.readableEnded===!0)return!0;let ve=he._readableState;return!ve||ve.errored?!1:typeof ve?.ended!="boolean"?null:ve.ended}o(we,"s");function ue(he,ve){if(!$(he))return null;let Oe=he._readableState;return Oe!=null&&Oe.errored?!1:typeof Oe?.endEmitted!="boolean"?null:!!(Oe.endEmitted||ve===!1&&Oe.ended===!0&&Oe.length===0)}o(ue,"K8");function K(he){return he&&he[D]!=null?he[D]:typeof he?.readable!="boolean"?null:X(he)?!1:$(he)&&he.readable&&!ue(he)}o(K,"p");function W(he){return he&&he[B]!=null?he[B]:typeof he?.writable!="boolean"?null:X(he)?!1:q(he)&&he.writable&&!se(he)}o(W,"D");function J(he,ve){return fe(he)?X(he)?!0:!(ve?.readable!==!1&&K(he)||ve?.writable!==!1&&W(he)):null}o(J,"M");function pe(he){var ve,Oe;return fe(he)?he.writableErrored?he.writableErrored:(ve=(Oe=he._writableState)===null||Oe===void 0?void 0:Oe.errored)!==null&&ve!==void 0?ve:null:null}o(pe,"j");function le(he){var ve,Oe;return fe(he)?he.readableErrored?he.readableErrored:(ve=(Oe=he._readableState)===null||Oe===void 0?void 0:Oe.errored)!==null&&ve!==void 0?ve:null:null}o(le,"W");function oe(he){if(!fe(he))return null;if(typeof he.closed=="boolean")return he.closed;let{_writableState:ve,_readableState:Oe}=he;return typeof ve?.closed=="boolean"||typeof Oe?.closed=="boolean"?ve?.closed||Oe?.closed:typeof he._closed=="boolean"&&Ve(he)?he._closed:null}o(oe,"f");function Ve(he){return typeof he._closed=="boolean"&&typeof he._defaultKeepAlive=="boolean"&&typeof he._removedConnection=="boolean"&&typeof he._removedContLen=="boolean"}o(Ve,"J");function _e(he){return typeof he._sent100=="boolean"&&Ve(he)}o(_e,"T");function Le(he){var ve;return typeof he._consuming=="boolean"&&typeof he._dumped=="boolean"&&((ve=he.req)===null||ve===void 0?void 0:ve.upgradeOrConnect)===void 0}o(Le,"k");function qe(he){if(!fe(he))return null;let{_writableState:ve,_readableState:Oe}=he,je=ve||Oe;return!je&&_e(he)||!!(je&&je.autoDestroy&&je.emitClose&&je.closed===!1)}o(qe,"G");function ge(he){var ve;return!!(he&&((ve=he[z])!==null&&ve!==void 0?ve:he.readableDidRead||he.readableAborted))}o(ge,"A");function De(he){var ve,Oe,je,ke,Fe,et,Ie,Se,Be,Ee;return!!(he&&((ve=(Oe=(je=(ke=(Fe=(et=he[O])!==null&&et!==void 0?et:he.readableErrored)!==null&&Fe!==void 0?Fe:he.writableErrored)!==null&&ke!==void 0?ke:(Ie=he._readableState)===null||Ie===void 0?void 0:Ie.errorEmitted)!==null&&je!==void 0?je:(Se=he._writableState)===null||Se===void 0?void 0:Se.errorEmitted)!==null&&Oe!==void 0?Oe:(Be=he._readableState)===null||Be===void 0?void 0:Be.errored)!==null&&ve!==void 0?ve:!((Ee=he._writableState)===null||Ee===void 0)&&Ee.errored))}o(De,"H"),N.exports={isDestroyed:X,kIsDestroyed:C,isDisturbed:ge,kIsDisturbed:z,isErrored:De,kIsErrored:O,isReadable:K,kIsReadable:D,kIsClosedPromise:G,kControllerErrorFunction:te,kIsWritable:B,isClosed:oe,isDuplexNodeStream:Ce,isFinished:J,isIterable:Q,isReadableNodeStream:$,isReadableStream:ae,isReadableEnded:we,isReadableFinished:ue,isReadableErrored:le,isNodeStream:fe,isWebStream:ee,isWritable:W,isWritableNodeStream:q,isWritableStream:be,isWritableEnded:se,isWritableFinished:Ne,isWritableErrored:pe,isServerRequest:Le,isServerResponse:_e,willEmitClose:qe,isTransformStream:H}}),w=r((A,N)=>{var S=m(),{AbortError:c,codes:_}=f(),{ERR_INVALID_ARG_TYPE:C,ERR_STREAM_PREMATURE_CLOSE:O}=_,{kEmptyObject:D,once:B}=b(),{validateAbortSignal:z,validateFunction:G,validateObject:te,validateBoolean:$}=h(),{Promise:q,PromisePrototypeThen:Ce,SymbolDispose:fe}=i(),{isClosed:ae,isReadable:be,isReadableNodeStream:H,isReadableStream:ee,isReadableFinished:Q,isReadableErrored:X,isWritable:se,isWritableNodeStream:Ne,isWritableStream:we,isWritableFinished:ue,isWritableErrored:K,isNodeStream:W,willEmitClose:J,kIsClosedPromise:pe}=l(),le;function oe(ge){return ge.setHeader&&typeof ge.abort=="function"}o(oe,"f");var Ve=o(()=>{},"J");function _e(ge,De,he){var ve,Oe;if(arguments.length===2?(he=De,De=D):De==null?De=D:te(De,"options"),G(he,"callback"),z(De.signal,"options.signal"),he=B(he),ee(ge)||we(ge))return Le(ge,De,he);if(!W(ge))throw new C("stream",["ReadableStream","WritableStream","Stream"],ge);let je=(ve=De.readable)!==null&&ve!==void 0?ve:H(ge),ke=(Oe=De.writable)!==null&&Oe!==void 0?Oe:Ne(ge),Fe=ge._writableState,et=ge._readableState,Ie=o(()=>{ge.writable||Ee()},"j8"),Se=J(ge)&&H(ge)===je&&Ne(ge)===ke,Be=ue(ge,!1),Ee=o(()=>{Be=!0,ge.destroyed&&(Se=!1),!(Se&&(!ge.readable||je))&&(!je||Ue)&&he.call(ge)},"G8"),Ue=Q(ge,!1),Je=o(()=>{Ue=!0,ge.destroyed&&(Se=!1),!(Se&&(!ge.writable||ke))&&(!ke||Be)&&he.call(ge)},"P8"),re=o(ie=>{he.call(ge,ie)},"t"),de=ae(ge),Pe=o(()=>{de=!0;let ie=K(ge)||X(ge);if(ie&&typeof ie!="boolean")return he.call(ge,ie);if(je&&!Ue&&H(ge,!0)&&!Q(ge,!1))return he.call(ge,new O);if(ke&&!Be&&!ue(ge,!1))return he.call(ge,new O);he.call(ge)},"r"),Me=o(()=>{de=!0;let ie=K(ge)||X(ge);if(ie&&typeof ie!="boolean")return he.call(ge,ie);he.call(ge)},"S8"),Re=o(()=>{ge.req.on("finish",Ee)},"Y8");oe(ge)?(ge.on("complete",Ee),!Se&&ge.on("abort",Pe),ge.req?Re():ge.on("request",Re)):ke&&!Fe&&(ge.on("end",Ie),ge.on("close",Ie)),!Se&&typeof ge.aborted=="boolean"&&ge.on("aborted",Pe),ge.on("end",Je),ge.on("finish",Ee),De.error!==!1&&ge.on("error",re),ge.on("close",Pe),de?S.nextTick(Pe):Fe!=null&&Fe.errorEmitted||et!=null&&et.errorEmitted?Se||S.nextTick(Me):(!je&&(!Se||be(ge))&&(Be||se(ge)===!1)||!ke&&(!Se||se(ge))&&(Ue||be(ge)===!1)||et&&ge.req&&ge.aborted)&&S.nextTick(Me);let Ke=o(()=>{he=Ve,ge.removeListener("aborted",Pe),ge.removeListener("complete",Ee),ge.removeListener("abort",Pe),ge.removeListener("request",Re),ge.req&&ge.req.removeListener("finish",Ee),ge.removeListener("end",Ie),ge.removeListener("close",Ie),ge.removeListener("finish",Ee),ge.removeListener("end",Je),ge.removeListener("error",re),ge.removeListener("close",Pe)},"e");if(De.signal&&!de){let ie=o(()=>{let Ae=he;Ke(),Ae.call(ge,new c(void 0,{cause:De.signal.reason}))},"a");if(De.signal.aborted)S.nextTick(ie);else{le=le||b().addAbortListener;let Ae=le(De.signal,ie),Ye=he;he=B((...me)=>{Ae[fe](),Ye.apply(ge,me)})}}return Ke}o(_e,"T");function Le(ge,De,he){let ve=!1,Oe=Ve;if(De.signal)if(Oe=o(()=>{ve=!0,he.call(ge,new c(void 0,{cause:De.signal.reason}))},"R"),De.signal.aborted)S.nextTick(Oe);else{le=le||b().addAbortListener;let ke=le(De.signal,Oe),Fe=he;he=B((...et)=>{ke[fe](),Fe.apply(ge,et)})}let je=o((...ke)=>{ve||S.nextTick(()=>he.apply(ge,ke))},"g");return Ce(ge[pe].promise,je,je),Ve}o(Le,"k");function qe(ge,De){var he;let ve=!1;return De===null&&(De=D),(he=De)!==null&&he!==void 0&&he.cleanup&&($(De.cleanup,"cleanup"),ve=De.cleanup),new q((Oe,je)=>{let ke=_e(ge,De,Fe=>{ve&&ke(),Fe?je(Fe):Oe()})})}o(qe,"G"),N.exports=_e,N.exports.finished=qe}),p=r((A,N)=>{var S=m(),{aggregateTwoErrors:c,codes:{ERR_MULTIPLE_CALLBACK:_},AbortError:C}=f(),{Symbol:O}=i(),{kIsDestroyed:D,isDestroyed:B,isFinished:z,isServerRequest:G}=l(),te=O("kDestroy"),$=O("kConstruct");function q(J,pe,le){J&&(J.stack,pe&&!pe.errored&&(pe.errored=J),le&&!le.errored&&(le.errored=J))}o(q,"C");function Ce(J,pe){let le=this._readableState,oe=this._writableState,Ve=oe||le;return oe!=null&&oe.destroyed||le!=null&&le.destroyed?(typeof pe=="function"&&pe(),this):(q(J,oe,le),oe&&(oe.destroyed=!0),le&&(le.destroyed=!0),Ve.constructed?fe(this,J,pe):this.once(te,function(_e){fe(this,c(_e,J),pe)}),this)}o(Ce,"E");function fe(J,pe,le){let oe=!1;function Ve(_e){if(oe)return;oe=!0;let{_readableState:Le,_writableState:qe}=J;q(_e,qe,Le),qe&&(qe.closed=!0),Le&&(Le.closed=!0),typeof le=="function"&&le(_e),_e?S.nextTick(ae,J,_e):S.nextTick(be,J)}o(Ve,"J");try{J._destroy(pe||null,Ve)}catch(_e){Ve(_e)}}o(fe,"I");function ae(J,pe){H(J,pe),be(J)}o(ae,"L");function be(J){let{_readableState:pe,_writableState:le}=J;le&&(le.closeEmitted=!0),pe&&(pe.closeEmitted=!0),(le!=null&&le.emitClose||pe!=null&&pe.emitClose)&&J.emit("close")}o(be,"h");function H(J,pe){let{_readableState:le,_writableState:oe}=J;oe!=null&&oe.errorEmitted||le!=null&&le.errorEmitted||(oe&&(oe.errorEmitted=!0),le&&(le.errorEmitted=!0),J.emit("error",pe))}o(H,"b");function ee(){let J=this._readableState,pe=this._writableState;J&&(J.constructed=!0,J.closed=!1,J.closeEmitted=!1,J.destroyed=!1,J.errored=null,J.errorEmitted=!1,J.reading=!1,J.ended=J.readable===!1,J.endEmitted=J.readable===!1),pe&&(pe.constructed=!0,pe.destroyed=!1,pe.closed=!1,pe.closeEmitted=!1,pe.errored=null,pe.errorEmitted=!1,pe.finalCalled=!1,pe.prefinished=!1,pe.ended=pe.writable===!1,pe.ending=pe.writable===!1,pe.finished=pe.writable===!1)}o(ee,"y");function Q(J,pe,le){let{_readableState:oe,_writableState:Ve}=J;if(Ve!=null&&Ve.destroyed||oe!=null&&oe.destroyed)return this;oe!=null&&oe.autoDestroy||Ve!=null&&Ve.autoDestroy?J.destroy(pe):pe&&(pe.stack,Ve&&!Ve.errored&&(Ve.errored=pe),oe&&!oe.errored&&(oe.errored=pe),le?S.nextTick(H,J,pe):H(J,pe))}o(Q,"x");function X(J,pe){if(typeof J._construct!="function")return;let{_readableState:le,_writableState:oe}=J;le&&(le.constructed=!1),oe&&(oe.constructed=!1),J.once($,pe),!(J.listenerCount($)>1)&&S.nextTick(se,J)}o(X,"c");function se(J){let pe=!1;function le(oe){if(pe){Q(J,oe??new _);return}pe=!0;let{_readableState:Ve,_writableState:_e}=J,Le=_e||Ve;Ve&&(Ve.constructed=!0),_e&&(_e.constructed=!0),Le.destroyed?J.emit(te,oe):oe?Q(J,oe,!0):S.nextTick(Ne,J)}o(le,"W");try{J._construct(oe=>{S.nextTick(le,oe)})}catch(oe){S.nextTick(le,oe)}}o(se,"l");function Ne(J){J.emit($)}o(Ne,"B");function we(J){return J?.setHeader&&typeof J.abort=="function"}o(we,"s");function ue(J){J.emit("close")}o(ue,"K8");function K(J,pe){J.emit("error",pe),S.nextTick(ue,J)}o(K,"p");function W(J,pe){!J||B(J)||(!pe&&!z(J)&&(pe=new C),G(J)?(J.socket=null,J.destroy(pe)):we(J)?J.abort():we(J.req)?J.req.abort():typeof J.destroy=="function"?J.destroy(pe):typeof J.close=="function"?J.close():pe?S.nextTick(K,J,pe):S.nextTick(ue,J),J.destroyed||(J[D]=!0))}o(W,"D"),N.exports={construct:X,destroyer:W,destroy:Ce,undestroy:ee,errorOrDestroy:Q}}),y=r((A,N)=>{var{ArrayIsArray:S,ObjectSetPrototypeOf:c}=i(),{EventEmitter:_}=($o(),bt(Da));function C(D){_.call(this,D)}o(C,"O"),c(C.prototype,_.prototype),c(C,_),C.prototype.pipe=function(D,B){let z=this;function G(be){D.writable&&D.write(be)===!1&&z.pause&&z.pause()}o(G,"V"),z.on("data",G);function te(){z.readable&&z.resume&&z.resume()}o(te,"Z"),D.on("drain",te),!D._isStdio&&(!B||B.end!==!1)&&(z.on("end",q),z.on("close",Ce));let $=!1;function q(){$||($=!0,D.end())}o(q,"C");function Ce(){$||($=!0,typeof D.destroy=="function"&&D.destroy())}o(Ce,"E");function fe(be){ae(),_.listenerCount(this,"error")===0&&this.emit("error",be)}o(fe,"I"),O(z,"error",fe),O(D,"error",fe);function ae(){z.removeListener("data",G),D.removeListener("drain",te),z.removeListener("end",q),z.removeListener("close",Ce),z.removeListener("error",fe),D.removeListener("error",fe),z.removeListener("end",ae),z.removeListener("close",ae),D.removeListener("close",ae)}return o(ae,"L"),z.on("end",ae),z.on("close",ae),D.on("close",ae),D.emit("pipe",z),D};function O(D,B,z){if(typeof D.prependListener=="function")return D.prependListener(B,z);!D._events||!D._events[B]?D.on(B,z):S(D._events[B])?D._events[B].unshift(z):D._events[B]=[z,D._events[B]]}o(O,"Y"),N.exports={Stream:C,prependListener:O}}),M=r((A,N)=>{var{SymbolDispose:S}=i(),{AbortError:c,codes:_}=f(),{isNodeStream:C,isWebStream:O,kControllerErrorFunction:D}=l(),B=w(),{ERR_INVALID_ARG_TYPE:z}=_,G,te=o(($,q)=>{if(typeof $!="object"||!("aborted"in $))throw new z(q,"AbortSignal",$)},"Z");N.exports.addAbortSignal=function($,q){if(te($,"signal"),!C(q)&&!O(q))throw new z("stream",["ReadableStream","WritableStream","Stream"],q);return N.exports.addAbortSignalNoValidate($,q)},N.exports.addAbortSignalNoValidate=function($,q){if(typeof $!="object"||!("aborted"in $))return q;let Ce=C(q)?()=>{q.destroy(new c(void 0,{cause:$.reason}))}:()=>{q[D](new c(void 0,{cause:$.reason}))};if($.aborted)Ce();else{G=G||b().addAbortListener;let fe=G($,Ce);B(q,fe[S])}return q}}),E=r((A,N)=>{var{StringPrototypeSlice:S,SymbolIterator:c,TypedArrayPrototypeSet:_,Uint8Array:C}=i(),{Buffer:O}=(sr(),bt(er)),{inspect:D}=b();N.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(B){let z={data:B,next:null};this.length>0?this.tail.next=z:this.head=z,this.tail=z,++this.length}unshift(B){let z={data:B,next:this.head};this.length===0&&(this.tail=z),this.head=z,++this.length}shift(){if(this.length===0)return;let B=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,B}clear(){this.head=this.tail=null,this.length=0}join(B){if(this.length===0)return"";let z=this.head,G=""+z.data;for(;(z=z.next)!==null;)G+=B+z.data;return G}concat(B){if(this.length===0)return O.alloc(0);let z=O.allocUnsafe(B>>>0),G=this.head,te=0;for(;G;)_(z,G.data,te),te+=G.data.length,G=G.next;return z}consume(B,z){let G=this.head.data;if(B<G.length){let te=G.slice(0,B);return this.head.data=G.slice(B),te}return B===G.length?this.shift():z?this._getString(B):this._getBuffer(B)}first(){return this.head.data}*[c](){for(let B=this.head;B;B=B.next)yield B.data}_getString(B){let z="",G=this.head,te=0;do{let $=G.data;if(B>$.length)z+=$,B-=$.length;else{B===$.length?(z+=$,++te,G.next?this.head=G.next:this.head=this.tail=null):(z+=S($,0,B),this.head=G,G.data=S($,B));break}++te}while((G=G.next)!==null);return this.length-=te,z}_getBuffer(B){let z=O.allocUnsafe(B),G=B,te=this.head,$=0;do{let q=te.data;if(B>q.length)_(z,q,G-B),B-=q.length;else{B===q.length?(_(z,q,G-B),++$,te.next?this.head=te.next:this.head=this.tail=null):(_(z,new C(q.buffer,q.byteOffset,B),G-B),this.head=te,te.data=q.slice(B));break}++$}while((te=te.next)!==null);return this.length-=$,z}[Symbol.for("nodejs.util.inspect.custom")](B,z){return D(this,{...z,depth:0,customInspect:!1})}}}),R=r((A,N)=>{var{MathFloor:S,NumberIsInteger:c}=i(),{validateInteger:_}=h(),{ERR_INVALID_ARG_VALUE:C}=f().codes,O=16384,D=16;function B($,q,Ce){return $.highWaterMark!=null?$.highWaterMark:q?$[Ce]:null}o(B,"v");function z($){return $?D:O}o(z,"w");function G($,q){_(q,"value",0),$?D=q:O=q}o(G,"V");function te($,q,Ce,fe){let ae=B(q,fe,Ce);if(ae!=null){if(!c(ae)||ae<0){let be=fe?`options.${Ce}`:"options.highWaterMark";throw new C(be,ae)}return S(ae)}return z($.objectMode)}o(te,"Z"),N.exports={getHighWaterMark:te,getDefaultHighWaterMark:z,setDefaultHighWaterMark:G}}),I=r((A,N)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var S=(sr(),bt(er)),c=S.Buffer;function _(O,D){for(var B in O)D[B]=O[B]}o(_,"P"),c.from&&c.alloc&&c.allocUnsafe&&c.allocUnsafeSlow?N.exports=S:(_(S,A),A.Buffer=C);function C(O,D,B){return c(O,D,B)}o(C,"O"),C.prototype=Object.create(c.prototype),_(c,C),C.from=function(O,D,B){if(typeof O=="number")throw TypeError("Argument must not be a number");return c(O,D,B)},C.alloc=function(O,D,B){if(typeof O!="number")throw TypeError("Argument must be a number");var z=c(O);return D!==void 0?typeof B=="string"?z.fill(D,B):z.fill(D):z.fill(0),z},C.allocUnsafe=function(O){if(typeof O!="number")throw TypeError("Argument must be a number");return c(O)},C.allocUnsafeSlow=function(O){if(typeof O!="number")throw TypeError("Argument must be a number");return S.SlowBuffer(O)}}),T=r(A=>{var N=I().Buffer,S=N.isEncoding||function(H){switch(H=""+H,H&&H.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function c(H){if(!H)return"utf8";for(var ee;;)switch(H){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return H;default:if(ee)return;H=(""+H).toLowerCase(),ee=!0}}o(c,"_");function _(H){var ee=c(H);if(typeof ee!="string"&&(N.isEncoding===S||!S(H)))throw Error("Unknown encoding: "+H);return ee||H}o(_,"P"),A.StringDecoder=C;function C(H){this.encoding=_(H);var ee;switch(this.encoding){case"utf16le":this.text=$,this.end=q,ee=4;break;case"utf8":this.fillLast=z,ee=4;break;case"base64":this.text=Ce,this.end=fe,ee=3;break;default:this.write=ae,this.end=be;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=N.allocUnsafe(ee)}o(C,"O"),C.prototype.write=function(H){if(H.length===0)return"";var ee,Q;if(this.lastNeed){if(ee=this.fillLast(H),ee===void 0)return"";Q=this.lastNeed,this.lastNeed=0}else Q=0;return Q<H.length?ee?ee+this.text(H,Q):this.text(H,Q):ee||""},C.prototype.end=te,C.prototype.text=G,C.prototype.fillLast=function(H){if(this.lastNeed<=H.length)return H.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);H.copy(this.lastChar,this.lastTotal-this.lastNeed,0,H.length),this.lastNeed-=H.length};function O(H){return H<=127?0:H>>5===6?2:H>>4===14?3:H>>3===30?4:H>>6===2?-1:-2}o(O,"Y");function D(H,ee,Q){var X=ee.length-1;if(X<Q)return 0;var se=O(ee[X]);return se>=0?(se>0&&(H.lastNeed=se-1),se):--X<Q||se===-2?0:(se=O(ee[X]),se>=0?(se>0&&(H.lastNeed=se-2),se):--X<Q||se===-2?0:(se=O(ee[X]),se>=0?(se>0&&(se===2?se=0:H.lastNeed=se-3),se):0))}o(D,"z");function B(H,ee,Q){if((ee[0]&192)!==128)return H.lastNeed=0,"�";if(H.lastNeed>1&&ee.length>1){if((ee[1]&192)!==128)return H.lastNeed=1,"�";if(H.lastNeed>2&&ee.length>2&&(ee[2]&192)!==128)return H.lastNeed=2,"�"}}o(B,"v");function z(H){var ee=this.lastTotal-this.lastNeed,Q=B(this,H);if(Q!==void 0)return Q;if(this.lastNeed<=H.length)return H.copy(this.lastChar,ee,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);H.copy(this.lastChar,ee,0,H.length),this.lastNeed-=H.length}o(z,"w");function G(H,ee){var Q=D(this,H,ee);if(!this.lastNeed)return H.toString("utf8",ee);this.lastTotal=Q;var X=H.length-(Q-this.lastNeed);return H.copy(this.lastChar,0,X),H.toString("utf8",ee,X)}o(G,"V");function te(H){var ee=H&&H.length?this.write(H):"";return this.lastNeed?ee+"�":ee}o(te,"Z");function $(H,ee){if((H.length-ee)%2===0){var Q=H.toString("utf16le",ee);if(Q){var X=Q.charCodeAt(Q.length-1);if(X>=55296&&X<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=H[H.length-2],this.lastChar[1]=H[H.length-1],Q.slice(0,-1)}return Q}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=H[H.length-1],H.toString("utf16le",ee,H.length-1)}o($,"S");function q(H){var ee=H&&H.length?this.write(H):"";if(this.lastNeed){var Q=this.lastTotal-this.lastNeed;return ee+this.lastChar.toString("utf16le",0,Q)}return ee}o(q,"C");function Ce(H,ee){var Q=(H.length-ee)%3;return Q===0?H.toString("base64",ee):(this.lastNeed=3-Q,this.lastTotal=3,Q===1?this.lastChar[0]=H[H.length-1]:(this.lastChar[0]=H[H.length-2],this.lastChar[1]=H[H.length-1]),H.toString("base64",ee,H.length-Q))}o(Ce,"E");function fe(H){var ee=H&&H.length?this.write(H):"";return this.lastNeed?ee+this.lastChar.toString("base64",0,3-this.lastNeed):ee}o(fe,"I");function ae(H){return H.toString(this.encoding)}o(ae,"L");function be(H){return H&&H.length?this.write(H):""}o(be,"h")}),P=r((A,N)=>{var S=m(),{PromisePrototypeThen:c,SymbolAsyncIterator:_,SymbolIterator:C}=i(),{Buffer:O}=(sr(),bt(er)),{ERR_INVALID_ARG_TYPE:D,ERR_STREAM_NULL_VALUES:B}=f().codes;function z(G,te,$){let q;if(typeof te=="string"||te instanceof O)return new G({objectMode:!0,...$,read(){this.push(te),this.push(null)}});let Ce;if(te&&te[_])Ce=!0,q=te[_]();else if(te&&te[C])Ce=!1,q=te[C]();else throw new D("iterable",["Iterable"],te);let fe=new G({objectMode:!0,highWaterMark:1,...$}),ae=!1;fe._read=function(){ae||(ae=!0,H())},fe._destroy=function(ee,Q){c(be(ee),()=>S.nextTick(Q,ee),X=>S.nextTick(Q,X||ee))};async function be(ee){let Q=ee!=null,X=typeof q.throw=="function";if(Q&&X){let{value:se,done:Ne}=await q.throw(ee);if(await se,Ne)return}if(typeof q.return=="function"){let{value:se}=await q.return();await se}}o(be,"h");async function H(){for(;;){try{let{value:ee,done:Q}=Ce?await q.next():q.next();if(Q)fe.push(null);else{let X=ee&&typeof ee.then=="function"?await ee:ee;if(X===null)throw ae=!1,new B;if(fe.push(X))continue;ae=!1}}catch(ee){fe.destroy(ee)}break}}return o(H,"b"),fe}o(z,"w"),N.exports=z}),j=r((A,N)=>{var S=m(),{ArrayPrototypeIndexOf:c,NumberIsInteger:_,NumberIsNaN:C,NumberParseInt:O,ObjectDefineProperties:D,ObjectKeys:B,ObjectSetPrototypeOf:z,Promise:G,SafeSet:te,SymbolAsyncDispose:$,SymbolAsyncIterator:q,Symbol:Ce}=i();N.exports=me,me.ReadableState=Ye;var{EventEmitter:fe}=($o(),bt(Da)),{Stream:ae,prependListener:be}=y(),{Buffer:H}=(sr(),bt(er)),{addAbortSignal:ee}=M(),Q=w(),X=b().debuglog("stream",ce=>{X=ce}),se=E(),Ne=p(),{getHighWaterMark:we,getDefaultHighWaterMark:ue}=R(),{aggregateTwoErrors:K,codes:{ERR_INVALID_ARG_TYPE:W,ERR_METHOD_NOT_IMPLEMENTED:J,ERR_OUT_OF_RANGE:pe,ERR_STREAM_PUSH_AFTER_EOF:le,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:oe},AbortError:Ve}=f(),{validateObject:_e}=h(),Le=Ce("kPaused"),{StringDecoder:qe}=T(),ge=P();z(me.prototype,ae.prototype),z(me,ae);var De=o(()=>{},"H"),{errorOrDestroy:he}=Ne,ve=1,Oe=2,je=4,ke=8,Fe=16,et=32,Ie=64,Se=128,Be=256,Ee=512,Ue=1024,Je=2048,re=4096,de=8192,Pe=16384,Me=32768,Re=65536,Ke=131072,ie=262144;function Ae(ce){return{enumerable:!1,get(){return(this.state&ce)!==0},set(xe){xe?this.state|=ce:this.state&=~ce}}}o(Ae,"$8"),D(Ye.prototype,{objectMode:Ae(ve),ended:Ae(Oe),endEmitted:Ae(je),reading:Ae(ke),constructed:Ae(Fe),sync:Ae(et),needReadable:Ae(Ie),emittedReadable:Ae(Se),readableListening:Ae(Be),resumeScheduled:Ae(Ee),errorEmitted:Ae(Ue),emitClose:Ae(Je),autoDestroy:Ae(re),destroyed:Ae(de),closed:Ae(Pe),closeEmitted:Ae(Me),multiAwaitDrain:Ae(Re),readingMore:Ae(Ke),dataEmitted:Ae(ie)});function Ye(ce,xe,it){typeof it!="boolean"&&(it=xe instanceof Z()),this.state=Je|re|Fe|et,ce&&ce.objectMode&&(this.state|=ve),it&&ce&&ce.readableObjectMode&&(this.state|=ve),this.highWaterMark=ce?we(this,ce,"readableHighWaterMark",it):ue(!1),this.buffer=new se,this.length=0,this.pipes=[],this.flowing=null,this[Le]=null,ce&&ce.emitClose===!1&&(this.state&=~Je),ce&&ce.autoDestroy===!1&&(this.state&=~re),this.errored=null,this.defaultEncoding=ce&&ce.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,ce&&ce.encoding&&(this.decoder=new qe(ce.encoding),this.encoding=ce.encoding)}o(Ye,"q8");function me(ce){if(!(this instanceof me))return new me(ce);let xe=this instanceof Z();this._readableState=new Ye(ce,this,xe),ce&&(typeof ce.read=="function"&&(this._read=ce.read),typeof ce.destroy=="function"&&(this._destroy=ce.destroy),typeof ce.construct=="function"&&(this._construct=ce.construct),ce.signal&&!xe&&ee(ce.signal,this)),ae.call(this,ce),Ne.construct(this,()=>{this._readableState.needReadable&&ht(this,this._readableState)})}o(me,"f8"),me.prototype.destroy=Ne.destroy,me.prototype._undestroy=Ne.undestroy,me.prototype._destroy=function(ce,xe){xe(ce)},me.prototype[fe.captureRejectionSymbol]=function(ce){this.destroy(ce)},me.prototype[$]=function(){let ce;return this.destroyed||(ce=this.readableEnded?null:new Ve,this.destroy(ce)),new G((xe,it)=>Q(this,ut=>ut&&ut!==ce?it(ut):xe(null)))},me.prototype.push=function(ce,xe){return Qe(this,ce,xe,!1)},me.prototype.unshift=function(ce,xe){return Qe(this,ce,xe,!0)};function Qe(ce,xe,it,ut){X("readableAddChunk",xe);let pt=ce._readableState,xr;if((pt.state&ve)===0&&(typeof xe=="string"?(it=it||pt.defaultEncoding,pt.encoding!==it&&(ut&&pt.encoding?xe=H.from(xe,it).toString(pt.encoding):(xe=H.from(xe,it),it=""))):xe instanceof H?it="":ae._isUint8Array(xe)?(xe=ae._uint8ArrayToBuffer(xe),it=""):xe!=null&&(xr=new W("chunk",["string","Buffer","Uint8Array"],xe))),xr)he(ce,xr);else if(xe===null)pt.state&=~ke,Ze(ce,pt);else if((pt.state&ve)!==0||xe&&xe.length>0)if(ut)if((pt.state&je)!==0)he(ce,new oe);else{if(pt.destroyed||pt.errored)return!1;st(ce,pt,xe,!0)}else if(pt.ended)he(ce,new le);else{if(pt.destroyed||pt.errored)return!1;pt.state&=~ke,pt.decoder&&!it?(xe=pt.decoder.write(xe),pt.objectMode||xe.length!==0?st(ce,pt,xe,!1):ht(ce,pt)):st(ce,pt,xe,!1)}else ut||(pt.state&=~ke,ht(ce,pt));return!pt.ended&&(pt.length<pt.highWaterMark||pt.length===0)}o(Qe,"W8");function st(ce,xe,it,ut){xe.flowing&&xe.length===0&&!xe.sync&&ce.listenerCount("data")>0?((xe.state&Re)!==0?xe.awaitDrainWriters.clear():xe.awaitDrainWriters=null,xe.dataEmitted=!0,ce.emit("data",it)):(xe.length+=xe.objectMode?1:it.length,ut?xe.buffer.unshift(it):xe.buffer.push(it),(xe.state&Ie)!==0&<(ce)),ht(ce,xe)}o(st,"J8"),me.prototype.isPaused=function(){let ce=this._readableState;return ce[Le]===!0||ce.flowing===!1},me.prototype.setEncoding=function(ce){let xe=new qe(ce);this._readableState.decoder=xe,this._readableState.encoding=this._readableState.decoder.encoding;let it=this._readableState.buffer,ut="";for(let pt of it)ut+=xe.write(pt);return it.clear(),ut!==""&&it.push(ut),this._readableState.length=ut.length,this};var ze=1073741824;function We(ce){if(ce>ze)throw new pe("size","<= 1GiB",ce);return ce--,ce|=ce>>>1,ce|=ce>>>2,ce|=ce>>>4,ce|=ce>>>8,ce|=ce>>>16,ce++,ce}o(We,"E8");function Te(ce,xe){return ce<=0||xe.length===0&&xe.ended?0:(xe.state&ve)!==0?1:C(ce)?xe.flowing&&xe.length?xe.buffer.first().length:xe.length:ce<=xe.length?ce:xe.ended?xe.length:0}o(Te,"v8"),me.prototype.read=function(ce){X("read",ce),ce===void 0?ce=NaN:_(ce)||(ce=O(ce,10));let xe=this._readableState,it=ce;if(ce>xe.highWaterMark&&(xe.highWaterMark=We(ce)),ce!==0&&(xe.state&=~Se),ce===0&&xe.needReadable&&((xe.highWaterMark!==0?xe.length>=xe.highWaterMark:xe.length>0)||xe.ended))return X("read: emitReadable",xe.length,xe.ended),xe.length===0&&xe.ended?Ut(this):lt(this),null;if(ce=Te(ce,xe),ce===0&&xe.ended)return xe.length===0&&Ut(this),null;let ut=(xe.state&Ie)!==0;if(X("need readable",ut),(xe.length===0||xe.length-ce<xe.highWaterMark)&&(ut=!0,X("length less than watermark",ut)),xe.ended||xe.reading||xe.destroyed||xe.errored||!xe.constructed)ut=!1,X("reading, ended or constructing",ut);else if(ut){X("do read"),xe.state|=ke|et,xe.length===0&&(xe.state|=Ie);try{this._read(xe.highWaterMark)}catch(xr){he(this,xr)}xe.state&=~et,!xe.reading&&(ce=Te(it,xe))}let pt;return ce>0?pt=jt(ce,xe):pt=null,pt===null?(xe.needReadable=xe.length<=xe.highWaterMark,ce=0):(xe.length-=ce,xe.multiAwaitDrain?xe.awaitDrainWriters.clear():xe.awaitDrainWriters=null),xe.length===0&&(xe.ended||(xe.needReadable=!0),it!==ce&&xe.ended&&Ut(this)),pt!==null&&!xe.errorEmitted&&!xe.closeEmitted&&(xe.dataEmitted=!0,this.emit("data",pt)),pt};function Ze(ce,xe){if(X("onEofChunk"),!xe.ended){if(xe.decoder){let it=xe.decoder.end();it&&it.length&&(xe.buffer.push(it),xe.length+=xe.objectMode?1:it.length)}xe.ended=!0,xe.sync?lt(ce):(xe.needReadable=!1,xe.emittedReadable=!0,yt(ce))}}o(Ze,"Q8");function lt(ce){let xe=ce._readableState;X("emitReadable",xe.needReadable,xe.emittedReadable),xe.needReadable=!1,!xe.emittedReadable&&(X("emitReadable",xe.flowing),xe.emittedReadable=!0,S.nextTick(yt,ce))}o(lt,"R8");function yt(ce){let xe=ce._readableState;X("emitReadable_",xe.destroyed,xe.length,xe.ended),!xe.destroyed&&!xe.errored&&(xe.length||xe.ended)&&(ce.emit("readable"),xe.emittedReadable=!1),xe.needReadable=!xe.flowing&&!xe.ended&&xe.length<=xe.highWaterMark,Pt(ce)}o(yt,"X8");function ht(ce,xe){!xe.readingMore&&xe.constructed&&(xe.readingMore=!0,S.nextTick(Nt,ce,xe))}o(ht,"q6");function Nt(ce,xe){for(;!xe.reading&&!xe.ended&&(xe.length<xe.highWaterMark||xe.flowing&&xe.length===0);){let it=xe.length;if(X("maybeReadMore read 0"),ce.read(0),it===xe.length)break}xe.readingMore=!1}o(Nt,"h8"),me.prototype._read=function(ce){throw new J("_read()")},me.prototype.pipe=function(ce,xe){let it=this,ut=this._readableState;ut.pipes.length===1&&(ut.multiAwaitDrain||(ut.multiAwaitDrain=!0,ut.awaitDrainWriters=new te(ut.awaitDrainWriters?[ut.awaitDrainWriters]:[]))),ut.pipes.push(ce),X("pipe count=%d opts=%j",ut.pipes.length,xe);let pt=(!xe||xe.end!==!1)&&ce!==S.stdout&&ce!==S.stderr?Yr:sa;ut.endEmitted?S.nextTick(pt):it.once("end",pt),ce.on("unpipe",xr);function xr(jn,Li){X("onunpipe"),jn===it&&Li&&Li.hasUnpiped===!1&&(Li.hasUnpiped=!0,x3())}o(xr,"i8");function Yr(){X("onend"),ce.end()}o(Yr,"I8");let Pn,Vp=!1;function x3(){X("cleanup"),ce.removeListener("close",gc),ce.removeListener("finish",vc),Pn&&ce.removeListener("drain",Pn),ce.removeListener("error",mc),ce.removeListener("unpipe",xr),it.removeListener("end",Yr),it.removeListener("end",sa),it.removeListener("data",Gp),Vp=!0,Pn&&ut.awaitDrainWriters&&(!ce._writableState||ce._writableState.needDrain)&&Pn()}o(x3,"p8");function Zp(){Vp||(ut.pipes.length===1&&ut.pipes[0]===ce?(X("false write response, pause",0),ut.awaitDrainWriters=ce,ut.multiAwaitDrain=!1):ut.pipes.length>1&&ut.pipes.includes(ce)&&(X("false write response, pause",ut.awaitDrainWriters.size),ut.awaitDrainWriters.add(ce)),it.pause()),Pn||(Pn=Dt(it,ce),ce.on("drain",Pn))}o(Zp,"Z8"),it.on("data",Gp);function Gp(jn){X("ondata");let Li=ce.write(jn);X("dest.write",Li),Li===!1&&Zp()}o(Gp,"W6");function mc(jn){if(X("onerror",jn),sa(),ce.removeListener("error",mc),ce.listenerCount("error")===0){let Li=ce._writableState||ce._readableState;Li&&!Li.errorEmitted?he(ce,jn):ce.emit("error",jn)}}o(mc,"L8"),be(ce,"error",mc);function gc(){ce.removeListener("finish",vc),sa()}o(gc,"N8"),ce.once("close",gc);function vc(){X("onfinish"),ce.removeListener("close",gc),sa()}o(vc,"V6"),ce.once("finish",vc);function sa(){X("unpipe"),it.unpipe(ce)}return o(sa,"w6"),ce.emit("pipe",it),ce.writableNeedDrain===!0?Zp():ut.flowing||(X("pipe resume"),it.resume()),ce};function Dt(ce,xe){return function(){let it=ce._readableState;it.awaitDrainWriters===xe?(X("pipeOnDrain",1),it.awaitDrainWriters=null):it.multiAwaitDrain&&(X("pipeOnDrain",it.awaitDrainWriters.size),it.awaitDrainWriters.delete(xe)),(!it.awaitDrainWriters||it.awaitDrainWriters.size===0)&&ce.listenerCount("data")&&ce.resume()}}o(Dt,"V8"),me.prototype.unpipe=function(ce){let xe=this._readableState,it={hasUnpiped:!1};if(xe.pipes.length===0)return this;if(!ce){let pt=xe.pipes;xe.pipes=[],this.pause();for(let xr=0;xr<pt.length;xr++)pt[xr].emit("unpipe",this,{hasUnpiped:!1});return this}let ut=c(xe.pipes,ce);return ut===-1?this:(xe.pipes.splice(ut,1),xe.pipes.length===0&&this.pause(),ce.emit("unpipe",this,it),this)},me.prototype.on=function(ce,xe){let it=ae.prototype.on.call(this,ce,xe),ut=this._readableState;return ce==="data"?(ut.readableListening=this.listenerCount("readable")>0,ut.flowing!==!1&&this.resume()):ce==="readable"&&!ut.endEmitted&&!ut.readableListening&&(ut.readableListening=ut.needReadable=!0,ut.flowing=!1,ut.emittedReadable=!1,X("on readable",ut.length,ut.reading),ut.length?lt(this):ut.reading||S.nextTick(St,this)),it},me.prototype.addListener=me.prototype.on,me.prototype.removeListener=function(ce,xe){let it=ae.prototype.removeListener.call(this,ce,xe);return ce==="readable"&&S.nextTick(Ct,this),it},me.prototype.off=me.prototype.removeListener,me.prototype.removeAllListeners=function(ce){let xe=ae.prototype.removeAllListeners.apply(this,arguments);return(ce==="readable"||ce===void 0)&&S.nextTick(Ct,this),xe};function Ct(ce){let xe=ce._readableState;xe.readableListening=ce.listenerCount("readable")>0,xe.resumeScheduled&&xe[Le]===!1?xe.flowing=!0:ce.listenerCount("data")>0?ce.resume():xe.readableListening||(xe.flowing=null)}o(Ct,"Y6");function St(ce){X("readable nexttick read 0"),ce.read(0)}o(St,"y8"),me.prototype.resume=function(){let ce=this._readableState;return ce.flowing||(X("resume"),ce.flowing=!ce.readableListening,Ht(this,ce)),ce[Le]=!1,this};function Ht(ce,xe){xe.resumeScheduled||(xe.resumeScheduled=!0,S.nextTick(Vt,ce,xe))}o(Ht,"M8");function Vt(ce,xe){X("resume",xe.reading),!xe.reading&&ce.read(0),xe.resumeScheduled=!1,ce.emit("resume"),Pt(ce),xe.flowing&&!xe.reading&&ce.read(0)}o(Vt,"H6"),me.prototype.pause=function(){return X("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(X("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Le]=!0,this};function Pt(ce){let xe=ce._readableState;for(X("flow",xe.flowing);xe.flowing&&ce.read()!==null;);}o(Pt,"b8"),me.prototype.wrap=function(ce){let xe=!1;ce.on("data",ut=>{!this.push(ut)&&ce.pause&&(xe=!0,ce.pause())}),ce.on("end",()=>{this.push(null)}),ce.on("error",ut=>{he(this,ut)}),ce.on("close",()=>{this.destroy()}),ce.on("destroy",()=>{this.destroy()}),this._read=()=>{xe&&ce.resume&&(xe=!1,ce.resume())};let it=B(ce);for(let ut=1;ut<it.length;ut++){let pt=it[ut];this[pt]===void 0&&typeof ce[pt]=="function"&&(this[pt]=ce[pt].bind(ce))}return this},me.prototype[q]=function(){return Ft(this)},me.prototype.iterator=function(ce){return ce!==void 0&&_e(ce,"options"),Ft(this,ce)};function Ft(ce,xe){typeof ce.read!="function"&&(ce=me.wrap(ce,{objectMode:!0}));let it=Tt(ce,xe);return it.stream=ce,it}o(Ft,"k8");async function*Tt(ce,xe){let it=De;function ut(Yr){this===ce?(it(),it=De):it=Yr}o(ut,"O8"),ce.on("readable",ut);let pt,xr=Q(ce,{writable:!1},Yr=>{pt=Yr?K(pt,Yr):null,it(),it=De});try{for(;;){let Yr=ce.destroyed?null:ce.read();if(Yr!==null)yield Yr;else{if(pt)throw pt;if(pt===null)return;await new G(ut)}}}catch(Yr){throw pt=K(pt,Yr),pt}finally{(pt||xe?.destroyOnReturn!==!1)&&(pt===void 0||ce._readableState.autoDestroy)?Ne.destroyer(ce,null):(ce.off("readable",ut),xr())}}o(Tt,"J6"),D(me.prototype,{readable:{__proto__:null,get(){let ce=this._readableState;return!!ce&&ce.readable!==!1&&!ce.destroyed&&!ce.errorEmitted&&!ce.endEmitted},set(ce){this._readableState&&(this._readableState.readable=!!ce)}},readableDidRead:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.dataEmitted},"get")},readableAborted:{__proto__:null,enumerable:!1,get:o(function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)},"get")},readableHighWaterMark:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.highWaterMark},"get")},readableBuffer:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState&&this._readableState.buffer},"get")},readableFlowing:{__proto__:null,enumerable:!1,get:o(function(){return this._readableState.flowing},"get"),set:o(function(ce){this._readableState&&(this._readableState.flowing=ce)},"set")},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(ce){this._readableState&&(this._readableState.destroyed=ce)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),D(Ye.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Le]!==!1},set(ce){this[Le]=!!ce}}}),me._fromList=jt;function jt(ce,xe){if(xe.length===0)return null;let it;return xe.objectMode?it=xe.buffer.shift():!ce||ce>=xe.length?(xe.decoder?it=xe.buffer.join(""):xe.buffer.length===1?it=xe.buffer.first():it=xe.buffer.concat(xe.length),xe.buffer.clear()):it=xe.buffer.consume(ce,xe.decoder),it}o(jt,"g8");function Ut(ce){let xe=ce._readableState;X("endReadable",xe.endEmitted),!xe.endEmitted&&(xe.ended=!0,S.nextTick(Zt,xe,ce))}o(Ut,"A8");function Zt(ce,xe){if(X("endReadableNT",ce.endEmitted,ce.length),!ce.errored&&!ce.closeEmitted&&!ce.endEmitted&&ce.length===0){if(ce.endEmitted=!0,xe.emit("end"),xe.writable&&xe.allowHalfOpen===!1)S.nextTick(Gt,xe);else if(ce.autoDestroy){let it=xe._writableState;(!it||it.autoDestroy&&(it.finished||it.writable===!1))&&xe.destroy()}}}o(Zt,"z6");function Gt(ce){ce.writable&&!ce.writableEnded&&!ce.destroyed&&ce.end()}o(Gt,"x8"),me.from=function(ce,xe){return ge(me,ce,xe)};var Yt;function bi(){return Yt===void 0&&(Yt={}),Yt}o(bi,"O6"),me.fromWeb=function(ce,xe){return bi().newStreamReadableFromReadableStream(ce,xe)},me.toWeb=function(ce,xe){return bi().newReadableStreamFromStreamReadable(ce,xe)},me.wrap=function(ce,xe){var it,ut;return new me({objectMode:(it=(ut=ce.readableObjectMode)!==null&&ut!==void 0?ut:ce.objectMode)!==null&&it!==void 0?it:!0,...xe,destroy(pt,xr){Ne.destroyer(ce,pt),xr(pt)}}).wrap(ce)}}),L=r((A,N)=>{var S=m(),{ArrayPrototypeSlice:c,Error:_,FunctionPrototypeSymbolHasInstance:C,ObjectDefineProperty:O,ObjectDefineProperties:D,ObjectSetPrototypeOf:B,StringPrototypeToLowerCase:z,Symbol:G,SymbolHasInstance:te}=i();N.exports=_e,_e.WritableState=oe;var{EventEmitter:$}=($o(),bt(Da)),q=y().Stream,{Buffer:Ce}=(sr(),bt(er)),fe=p(),{addAbortSignal:ae}=M(),{getHighWaterMark:be,getDefaultHighWaterMark:H}=R(),{ERR_INVALID_ARG_TYPE:ee,ERR_METHOD_NOT_IMPLEMENTED:Q,ERR_MULTIPLE_CALLBACK:X,ERR_STREAM_CANNOT_PIPE:se,ERR_STREAM_DESTROYED:Ne,ERR_STREAM_ALREADY_FINISHED:we,ERR_STREAM_NULL_VALUES:ue,ERR_STREAM_WRITE_AFTER_END:K,ERR_UNKNOWN_ENCODING:W}=f().codes,{errorOrDestroy:J}=fe;B(_e.prototype,q.prototype),B(_e,q);function pe(){}o(pe,"j");var le=G("kOnFinished");function oe(re,de,Pe){typeof Pe!="boolean"&&(Pe=de instanceof Z()),this.objectMode=!!(re&&re.objectMode),Pe&&(this.objectMode=this.objectMode||!!(re&&re.writableObjectMode)),this.highWaterMark=re?be(this,re,"writableHighWaterMark",Pe):H(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let Me=!!(re&&re.decodeStrings===!1);this.decodeStrings=!Me,this.defaultEncoding=re&&re.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=he.bind(void 0,de),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Ve(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!re||re.emitClose!==!1,this.autoDestroy=!re||re.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[le]=[]}o(oe,"f");function Ve(re){re.buffered=[],re.bufferedIndex=0,re.allBuffers=!0,re.allNoop=!0}o(Ve,"J"),oe.prototype.getBuffer=function(){return c(this.buffered,this.bufferedIndex)},O(oe.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function _e(re){let de=this instanceof Z();if(!de&&!C(_e,this))return new _e(re);this._writableState=new oe(re,this,de),re&&(typeof re.write=="function"&&(this._write=re.write),typeof re.writev=="function"&&(this._writev=re.writev),typeof re.destroy=="function"&&(this._destroy=re.destroy),typeof re.final=="function"&&(this._final=re.final),typeof re.construct=="function"&&(this._construct=re.construct),re.signal&&ae(re.signal,this)),q.call(this,re),fe.construct(this,()=>{let Pe=this._writableState;Pe.writing||ke(this,Pe),Se(this,Pe)})}o(_e,"T"),O(_e,te,{__proto__:null,value:o(function(re){return C(this,re)?!0:this!==_e?!1:re&&re._writableState instanceof oe},"value")}),_e.prototype.pipe=function(){J(this,new se)};function Le(re,de,Pe,Me){let Re=re._writableState;if(typeof Pe=="function")Me=Pe,Pe=Re.defaultEncoding;else{if(!Pe)Pe=Re.defaultEncoding;else if(Pe!=="buffer"&&!Ce.isEncoding(Pe))throw new W(Pe);typeof Me!="function"&&(Me=pe)}if(de===null)throw new ue;if(!Re.objectMode)if(typeof de=="string")Re.decodeStrings!==!1&&(de=Ce.from(de,Pe),Pe="buffer");else if(de instanceof Ce)Pe="buffer";else if(q._isUint8Array(de))de=q._uint8ArrayToBuffer(de),Pe="buffer";else throw new ee("chunk",["string","Buffer","Uint8Array"],de);let Ke;return Re.ending?Ke=new K:Re.destroyed&&(Ke=new Ne("write")),Ke?(S.nextTick(Me,Ke),J(re,Ke,!0),Ke):(Re.pendingcb++,qe(re,Re,de,Pe,Me))}o(Le,"k"),_e.prototype.write=function(re,de,Pe){return Le(this,re,de,Pe)===!0},_e.prototype.cork=function(){this._writableState.corked++},_e.prototype.uncork=function(){let re=this._writableState;re.corked&&(re.corked--,!re.writing&&ke(this,re))},_e.prototype.setDefaultEncoding=function(re){if(typeof re=="string"&&(re=z(re)),!Ce.isEncoding(re))throw new W(re);return this._writableState.defaultEncoding=re,this};function qe(re,de,Pe,Me,Re){let Ke=de.objectMode?1:Pe.length;de.length+=Ke;let ie=de.length<de.highWaterMark;return ie||(de.needDrain=!0),de.writing||de.corked||de.errored||!de.constructed?(de.buffered.push({chunk:Pe,encoding:Me,callback:Re}),de.allBuffers&&Me!=="buffer"&&(de.allBuffers=!1),de.allNoop&&Re!==pe&&(de.allNoop=!1)):(de.writelen=Ke,de.writecb=Re,de.writing=!0,de.sync=!0,re._write(Pe,Me,de.onwrite),de.sync=!1),ie&&!de.errored&&!de.destroyed}o(qe,"G");function ge(re,de,Pe,Me,Re,Ke,ie){de.writelen=Me,de.writecb=ie,de.writing=!0,de.sync=!0,de.destroyed?de.onwrite(new Ne("write")):Pe?re._writev(Re,de.onwrite):re._write(Re,Ke,de.onwrite),de.sync=!1}o(ge,"A");function De(re,de,Pe,Me){--de.pendingcb,Me(Pe),je(de),J(re,Pe)}o(De,"H");function he(re,de){let Pe=re._writableState,Me=Pe.sync,Re=Pe.writecb;if(typeof Re!="function"){J(re,new X);return}Pe.writing=!1,Pe.writecb=null,Pe.length-=Pe.writelen,Pe.writelen=0,de?(de.stack,!Pe.errored&&(Pe.errored=de),re._readableState&&!re._readableState.errored&&(re._readableState.errored=de),Me?S.nextTick(De,re,Pe,de,Re):De(re,Pe,de,Re)):(Pe.buffered.length>Pe.bufferedIndex&&ke(re,Pe),Me?Pe.afterWriteTickInfo!==null&&Pe.afterWriteTickInfo.cb===Re?Pe.afterWriteTickInfo.count++:(Pe.afterWriteTickInfo={count:1,cb:Re,stream:re,state:Pe},S.nextTick(ve,Pe.afterWriteTickInfo)):Oe(re,Pe,1,Re))}o(he,"X");function ve({stream:re,state:de,count:Pe,cb:Me}){return de.afterWriteTickInfo=null,Oe(re,de,Pe,Me)}o(ve,"N");function Oe(re,de,Pe,Me){for(!de.ending&&!re.destroyed&&de.length===0&&de.needDrain&&(de.needDrain=!1,re.emit("drain"));Pe-- >0;)de.pendingcb--,Me();de.destroyed&&je(de),Se(re,de)}o(Oe,"R");function je(re){if(re.writing)return;for(let Re=re.bufferedIndex;Re<re.buffered.length;++Re){var de;let{chunk:Ke,callback:ie}=re.buffered[Re],Ae=re.objectMode?1:Ke.length;re.length-=Ae,ie((de=re.errored)!==null&&de!==void 0?de:new Ne("write"))}let Pe=re[le].splice(0);for(let Re=0;Re<Pe.length;Re++){var Me;Pe[Re]((Me=re.errored)!==null&&Me!==void 0?Me:new Ne("end"))}Ve(re)}o(je,"g");function ke(re,de){if(de.corked||de.bufferProcessing||de.destroyed||!de.constructed)return;let{buffered:Pe,bufferedIndex:Me,objectMode:Re}=de,Ke=Pe.length-Me;if(!Ke)return;let ie=Me;if(de.bufferProcessing=!0,Ke>1&&re._writev){de.pendingcb-=Ke-1;let Ae=de.allNoop?pe:me=>{for(let Qe=ie;Qe<Pe.length;++Qe)Pe[Qe].callback(me)},Ye=de.allNoop&&ie===0?Pe:c(Pe,ie);Ye.allBuffers=de.allBuffers,ge(re,de,!0,de.length,Ye,"",Ae),Ve(de)}else{do{let{chunk:Ae,encoding:Ye,callback:me}=Pe[ie];Pe[ie++]=null;let Qe=Re?1:Ae.length;ge(re,de,!1,Qe,Ae,Ye,me)}while(ie<Pe.length&&!de.writing);ie===Pe.length?Ve(de):ie>256?(Pe.splice(0,ie),de.bufferedIndex=0):de.bufferedIndex=ie}de.bufferProcessing=!1}o(ke,"u"),_e.prototype._write=function(re,de,Pe){if(this._writev)this._writev([{chunk:re,encoding:de}],Pe);else throw new Q("_write()")},_e.prototype._writev=null,_e.prototype.end=function(re,de,Pe){let Me=this._writableState;typeof re=="function"?(Pe=re,re=null,de=null):typeof de=="function"&&(Pe=de,de=null);let Re;if(re!=null){let Ke=Le(this,re,de);Ke instanceof _&&(Re=Ke)}return Me.corked&&(Me.corked=1,this.uncork()),Re||(!Me.errored&&!Me.ending?(Me.ending=!0,Se(this,Me,!0),Me.ended=!0):Me.finished?Re=new we("end"):Me.destroyed&&(Re=new Ne("end"))),typeof Pe=="function"&&(Re||Me.finished?S.nextTick(Pe,Re):Me[le].push(Pe)),this};function Fe(re){return re.ending&&!re.destroyed&&re.constructed&&re.length===0&&!re.errored&&re.buffered.length===0&&!re.finished&&!re.writing&&!re.errorEmitted&&!re.closeEmitted}o(Fe,"o");function et(re,de){let Pe=!1;function Me(Re){if(Pe){J(re,Re??X());return}if(Pe=!0,de.pendingcb--,Re){let Ke=de[le].splice(0);for(let ie=0;ie<Ke.length;ie++)Ke[ie](Re);J(re,Re,de.sync)}else Fe(de)&&(de.prefinished=!0,re.emit("prefinish"),de.pendingcb++,S.nextTick(Be,re,de))}o(Me,"S8"),de.sync=!0,de.pendingcb++;try{re._final(Me)}catch(Re){Me(Re)}de.sync=!1}o(et,"Q");function Ie(re,de){!de.prefinished&&!de.finalCalled&&(typeof re._final=="function"&&!de.destroyed?(de.finalCalled=!0,et(re,de)):(de.prefinished=!0,re.emit("prefinish")))}o(Ie,"j8");function Se(re,de,Pe){Fe(de)&&(Ie(re,de),de.pendingcb===0&&(Pe?(de.pendingcb++,S.nextTick((Me,Re)=>{Fe(Re)?Be(Me,Re):Re.pendingcb--},re,de)):Fe(de)&&(de.pendingcb++,Be(re,de))))}o(Se,"F");function Be(re,de){de.pendingcb--,de.finished=!0;let Pe=de[le].splice(0);for(let Me=0;Me<Pe.length;Me++)Pe[Me]();if(re.emit("finish"),de.autoDestroy){let Me=re._readableState;(!Me||Me.autoDestroy&&(Me.endEmitted||Me.readable===!1))&&re.destroy()}}o(Be,"n"),D(_e.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(re){this._writableState&&(this._writableState.destroyed=re)}},writable:{__proto__:null,get(){let re=this._writableState;return!!re&&re.writable!==!1&&!re.destroyed&&!re.errored&&!re.ending&&!re.ended},set(re){this._writableState&&(this._writableState.writable=!!re)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let re=this._writableState;return re?!re.destroyed&&!re.ending&&re.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:o(function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)},"get")}});var Ee=fe.destroy;_e.prototype.destroy=function(re,de){let Pe=this._writableState;return!Pe.destroyed&&(Pe.bufferedIndex<Pe.buffered.length||Pe[le].length)&&S.nextTick(je,Pe),Ee.call(this,re,de),this},_e.prototype._undestroy=fe.undestroy,_e.prototype._destroy=function(re,de){de(re)},_e.prototype[$.captureRejectionSymbol]=function(re){this.destroy(re)};var Ue;function Je(){return Ue===void 0&&(Ue={}),Ue}o(Je,"P8"),_e.fromWeb=function(re,de){return Je().newStreamWritableFromWritableStream(re,de)},_e.toWeb=function(re){return Je().newWritableStreamFromStreamWritable(re)}}),U=r((A,N)=>{var S=m(),c=(sr(),bt(er)),{isReadable:_,isWritable:C,isIterable:O,isNodeStream:D,isReadableNodeStream:B,isWritableNodeStream:z,isDuplexNodeStream:G,isReadableStream:te,isWritableStream:$}=l(),q=w(),{AbortError:Ce,codes:{ERR_INVALID_ARG_TYPE:fe,ERR_INVALID_RETURN_VALUE:ae}}=f(),{destroyer:be}=p(),H=Z(),ee=j(),Q=L(),{createDeferredPromise:X}=b(),se=P(),Ne=globalThis.Blob||c.Blob,we=typeof Ne<"u"?function(le){return le instanceof Ne}:function(le){return!1},ue=globalThis.AbortController||v().AbortController,{FunctionPrototypeCall:K}=i();class W extends H{static{o(this,"D")}constructor(oe){super(oe),oe?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),oe?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}N.exports=o(function le(oe,Ve){if(G(oe))return oe;if(B(oe))return pe({readable:oe});if(z(oe))return pe({writable:oe});if(D(oe))return pe({writable:!1,readable:!1});if(te(oe))return pe({readable:ee.fromWeb(oe)});if($(oe))return pe({writable:Q.fromWeb(oe)});if(typeof oe=="function"){let{value:Le,write:qe,final:ge,destroy:De}=J(oe);if(O(Le))return se(W,Le,{objectMode:!0,write:qe,final:ge,destroy:De});let he=Le?.then;if(typeof he=="function"){let ve,Oe=K(he,Le,je=>{if(je!=null)throw new ae("nully","body",je)},je=>{be(ve,je)});return ve=new W({objectMode:!0,readable:!1,write:qe,final(je){ge(async()=>{try{await Oe,S.nextTick(je,null)}catch(ke){S.nextTick(je,ke)}})},destroy:De})}throw new ae("Iterable, AsyncIterable or AsyncFunction",Ve,Le)}if(we(oe))return le(oe.arrayBuffer());if(O(oe))return se(W,oe,{objectMode:!0,writable:!1});if(te(oe?.readable)&&$(oe?.writable))return W.fromWeb(oe);if(typeof oe?.writable=="object"||typeof oe?.readable=="object"){let Le=oe!=null&&oe.readable?B(oe?.readable)?oe?.readable:le(oe.readable):void 0,qe=oe!=null&&oe.writable?z(oe?.writable)?oe?.writable:le(oe.writable):void 0;return pe({readable:Le,writable:qe})}let _e=oe?.then;if(typeof _e=="function"){let Le;return K(_e,oe,qe=>{qe!=null&&Le.push(qe),Le.push(null)},qe=>{be(Le,qe)}),Le=new W({objectMode:!0,writable:!1,read(){}})}throw new fe(Ve,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],oe)},"W");function J(le){let{promise:oe,resolve:Ve}=X(),_e=new ue,Le=_e.signal;return{value:le((async function*(){for(;;){let qe=oe;oe=null;let{chunk:ge,done:De,cb:he}=await qe;if(S.nextTick(he),De)return;if(Le.aborted)throw new Ce(void 0,{cause:Le.reason});({promise:oe,resolve:Ve}=X()),yield ge}})(),{signal:Le}),write(qe,ge,De){let he=Ve;Ve=null,he({chunk:qe,done:!1,cb:De})},final(qe){let ge=Ve;Ve=null,ge({done:!0,cb:qe})},destroy(qe,ge){_e.abort(),ge(qe)}}}o(J,"M");function pe(le){let oe=le.readable&&typeof le.readable.read!="function"?ee.wrap(le.readable):le.readable,Ve=le.writable,_e=!!_(oe),Le=!!C(Ve),qe,ge,De,he,ve;function Oe(je){let ke=he;he=null,ke?ke(je):je&&ve.destroy(je)}return o(Oe,"R"),ve=new W({readableObjectMode:!!(oe!=null&&oe.readableObjectMode),writableObjectMode:!!(Ve!=null&&Ve.writableObjectMode),readable:_e,writable:Le}),Le&&(q(Ve,je=>{Le=!1,je&&be(oe,je),Oe(je)}),ve._write=function(je,ke,Fe){Ve.write(je,ke)?Fe():qe=Fe},ve._final=function(je){Ve.end(),ge=je},Ve.on("drain",function(){if(qe){let je=qe;qe=null,je()}}),Ve.on("finish",function(){if(ge){let je=ge;ge=null,je()}})),_e&&(q(oe,je=>{_e=!1,je&&be(oe,je),Oe(je)}),oe.on("readable",function(){if(De){let je=De;De=null,je()}}),oe.on("end",function(){ve.push(null)}),ve._read=function(){for(;;){let je=oe.read();if(je===null){De=ve._read;return}if(!ve.push(je))return}}),ve._destroy=function(je,ke){!je&&he!==null&&(je=new Ce),De=null,qe=null,ge=null,he===null?ke(je):(he=ke,be(Ve,je),be(oe,je))},ve}o(pe,"j")}),Z=r((A,N)=>{var{ObjectDefineProperties:S,ObjectGetOwnPropertyDescriptor:c,ObjectKeys:_,ObjectSetPrototypeOf:C}=i();N.exports=B;var O=j(),D=L();C(B.prototype,O.prototype),C(B,O);{let $=_(D.prototype);for(let q=0;q<$.length;q++){let Ce=$[q];B.prototype[Ce]||(B.prototype[Ce]=D.prototype[Ce])}}function B($){if(!(this instanceof B))return new B($);O.call(this,$),D.call(this,$),$?(this.allowHalfOpen=$.allowHalfOpen!==!1,$.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),$.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}o(B,"v"),S(B.prototype,{writable:{__proto__:null,...c(D.prototype,"writable")},writableHighWaterMark:{__proto__:null,...c(D.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...c(D.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...c(D.prototype,"writableBuffer")},writableLength:{__proto__:null,...c(D.prototype,"writableLength")},writableFinished:{__proto__:null,...c(D.prototype,"writableFinished")},writableCorked:{__proto__:null,...c(D.prototype,"writableCorked")},writableEnded:{__proto__:null,...c(D.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...c(D.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set($){this._readableState&&this._writableState&&(this._readableState.destroyed=$,this._writableState.destroyed=$)}}});var z;function G(){return z===void 0&&(z={}),z}o(G,"V"),B.fromWeb=function($,q){return G().newStreamDuplexFromReadableWritablePair($,q)},B.toWeb=function($){return G().newReadableWritablePairFromDuplex($)};var te;B.from=function($){return te||(te=U()),te($,"body")}}),ne=r((A,N)=>{var{ObjectSetPrototypeOf:S,Symbol:c}=i();N.exports=B;var{ERR_METHOD_NOT_IMPLEMENTED:_}=f().codes,C=Z(),{getHighWaterMark:O}=R();S(B.prototype,C.prototype),S(B,C);var D=c("kCallback");function B(te){if(!(this instanceof B))return new B(te);let $=te?O(this,te,"readableHighWaterMark",!0):null;$===0&&(te={...te,highWaterMark:null,readableHighWaterMark:$,writableHighWaterMark:te.writableHighWaterMark||0}),C.call(this,te),this._readableState.sync=!1,this[D]=null,te&&(typeof te.transform=="function"&&(this._transform=te.transform),typeof te.flush=="function"&&(this._flush=te.flush)),this.on("prefinish",G)}o(B,"v");function z(te){typeof this._flush=="function"&&!this.destroyed?this._flush(($,q)=>{if($){te?te($):this.destroy($);return}q!=null&&this.push(q),this.push(null),te&&te()}):(this.push(null),te&&te())}o(z,"w");function G(){this._final!==z&&z.call(this)}o(G,"V"),B.prototype._final=z,B.prototype._transform=function(te,$,q){throw new _("_transform()")},B.prototype._write=function(te,$,q){let Ce=this._readableState,fe=this._writableState,ae=Ce.length;this._transform(te,$,(be,H)=>{if(be){q(be);return}H!=null&&this.push(H),fe.ended||ae===Ce.length||Ce.length<Ce.highWaterMark?q():this[D]=q})},B.prototype._read=function(){if(this[D]){let te=this[D];this[D]=null,te()}}}),F=r((A,N)=>{var{ObjectSetPrototypeOf:S}=i();N.exports=_;var c=ne();S(_.prototype,c.prototype),S(_,c);function _(C){if(!(this instanceof _))return new _(C);c.call(this,C)}o(_,"P"),_.prototype._transform=function(C,O,D){D(null,C)}}),Y=r((A,N)=>{var S=m(),{ArrayIsArray:c,Promise:_,SymbolAsyncIterator:C,SymbolDispose:O}=i(),D=w(),{once:B}=b(),z=p(),G=Z(),{aggregateTwoErrors:te,codes:{ERR_INVALID_ARG_TYPE:$,ERR_INVALID_RETURN_VALUE:q,ERR_MISSING_ARGS:Ce,ERR_STREAM_DESTROYED:fe,ERR_STREAM_PREMATURE_CLOSE:ae},AbortError:be}=f(),{validateFunction:H,validateAbortSignal:ee}=h(),{isIterable:Q,isReadable:X,isReadableNodeStream:se,isNodeStream:Ne,isTransformStream:we,isWebStream:ue,isReadableStream:K,isReadableFinished:W}=l(),J=globalThis.AbortController||v().AbortController,pe,le,oe;function Ve(je,ke,Fe){let et=!1;je.on("close",()=>{et=!0});let Ie=D(je,{readable:ke,writable:Fe},Se=>{et=!Se});return{destroy:o(Se=>{et||(et=!0,z.destroyer(je,Se||new fe("pipe")))},"destroy"),cleanup:Ie}}o(Ve,"J");function _e(je){return H(je[je.length-1],"streams[stream.length - 1]"),je.pop()}o(_e,"T");function Le(je){if(Q(je))return je;if(se(je))return qe(je);throw new $("val",["Readable","Iterable","AsyncIterable"],je)}o(Le,"k");async function*qe(je){le||(le=j()),yield*le.prototype[C].call(je)}o(qe,"G");async function ge(je,ke,Fe,{end:et}){let Ie,Se=null,Be=o(Je=>{if(Je&&(Ie=Je),Se){let re=Se;Se=null,re()}},"n"),Ee=o(()=>new _((Je,re)=>{Ie?re(Ie):Se=o(()=>{Ie?re(Ie):Je()},"F")}),"G8");ke.on("drain",Be);let Ue=D(ke,{readable:!1},Be);try{ke.writableNeedDrain&&await Ee();for await(let Je of je)ke.write(Je)||await Ee();et&&(ke.end(),await Ee()),Fe()}catch(Je){Fe(Ie!==Je?te(Ie,Je):Je)}finally{Ue(),ke.off("drain",Be)}}o(ge,"A");async function De(je,ke,Fe,{end:et}){we(ke)&&(ke=ke.writable);let Ie=ke.getWriter();try{for await(let Se of je)await Ie.ready,Ie.write(Se).catch(()=>{});await Ie.ready,et&&await Ie.close(),Fe()}catch(Se){try{await Ie.abort(Se),Fe(Se)}catch(Be){Fe(Be)}}}o(De,"H");function he(...je){return ve(je,B(_e(je)))}o(he,"X");function ve(je,ke,Fe){if(je.length===1&&c(je[0])&&(je=je[0]),je.length<2)throw new Ce("streams");let et=new J,Ie=et.signal,Se=Fe?.signal,Be=[];ee(Se,"options.signal");function Ee(){Re(new be)}o(Ee,"G8"),oe=oe||b().addAbortListener;let Ue;Se&&(Ue=oe(Se,Ee));let Je,re,de=[],Pe=0;function Me(Ye){Re(Ye,--Pe===0)}o(Me,"S8");function Re(Ye,me){var Qe;if(Ye&&(!Je||Je.code==="ERR_STREAM_PREMATURE_CLOSE")&&(Je=Ye),!(!Je&&!me)){for(;de.length;)de.shift()(Je);(Qe=Ue)===null||Qe===void 0||Qe[O](),et.abort(),me&&(Je||Be.forEach(st=>st()),S.nextTick(ke,Je,re))}}o(Re,"Y8");let Ke;for(let Ye=0;Ye<je.length;Ye++){let me=je[Ye],Qe=Ye<je.length-1,st=Ye>0,ze=Qe||Fe?.end!==!1,We=Ye===je.length-1;if(Ne(me)){let Te=o(function(Ze){Ze&&Ze.name!=="AbortError"&&Ze.code!=="ERR_STREAM_PREMATURE_CLOSE"&&Me(Ze)},"Q8");if(ze){let{destroy:Ze,cleanup:lt}=Ve(me,Qe,st);de.push(Ze),X(me)&&We&&Be.push(lt)}me.on("error",Te),X(me)&&We&&Be.push(()=>{me.removeListener("error",Te)})}if(Ye===0)if(typeof me=="function"){if(Ke=me({signal:Ie}),!Q(Ke))throw new q("Iterable, AsyncIterable or Stream","source",Ke)}else Q(me)||se(me)||we(me)?Ke=me:Ke=G.from(me);else if(typeof me=="function"){if(we(Ke)){var ie;Ke=Le((ie=Ke)===null||ie===void 0?void 0:ie.readable)}else Ke=Le(Ke);if(Ke=me(Ke,{signal:Ie}),Qe){if(!Q(Ke,!0))throw new q("AsyncIterable",`transform[${Ye-1}]`,Ke)}else{var Ae;pe||(pe=F());let Te=new pe({objectMode:!0}),Ze=(Ae=Ke)===null||Ae===void 0?void 0:Ae.then;if(typeof Ze=="function")Pe++,Ze.call(Ke,ht=>{re=ht,ht!=null&&Te.write(ht),ze&&Te.end(),S.nextTick(Me)},ht=>{Te.destroy(ht),S.nextTick(Me,ht)});else if(Q(Ke,!0))Pe++,ge(Ke,Te,Me,{end:ze});else if(K(Ke)||we(Ke)){let ht=Ke.readable||Ke;Pe++,ge(ht,Te,Me,{end:ze})}else throw new q("AsyncIterable or Promise","destination",Ke);Ke=Te;let{destroy:lt,cleanup:yt}=Ve(Ke,!1,!0);de.push(lt),We&&Be.push(yt)}}else if(Ne(me)){if(se(Ke)){Pe+=2;let Te=Oe(Ke,me,Me,{end:ze});X(me)&&We&&Be.push(Te)}else if(we(Ke)||K(Ke)){let Te=Ke.readable||Ke;Pe++,ge(Te,me,Me,{end:ze})}else if(Q(Ke))Pe++,ge(Ke,me,Me,{end:ze});else throw new $("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Ke);Ke=me}else if(ue(me)){if(se(Ke))Pe++,De(Le(Ke),me,Me,{end:ze});else if(K(Ke)||Q(Ke))Pe++,De(Ke,me,Me,{end:ze});else if(we(Ke))Pe++,De(Ke.readable,me,Me,{end:ze});else throw new $("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Ke);Ke=me}else Ke=G.from(me)}return(Ie!=null&&Ie.aborted||Se!=null&&Se.aborted)&&S.nextTick(Ee),Ke}o(ve,"N");function Oe(je,ke,Fe,{end:et}){let Ie=!1;if(ke.on("close",()=>{Ie||Fe(new ae)}),je.pipe(ke,{end:!1}),et){let Se=o(function(){Ie=!0,ke.end()},"n");W(je)?S.nextTick(Se):je.once("end",Se)}else Fe();return D(je,{readable:!0,writable:!1},Se=>{let Be=je._readableState;Se&&Se.code==="ERR_STREAM_PREMATURE_CLOSE"&&Be&&Be.ended&&!Be.errored&&!Be.errorEmitted?je.once("end",Fe).once("error",Fe):Fe(Se)}),D(ke,{readable:!1,writable:!0},Fe)}o(Oe,"R"),N.exports={pipelineImpl:ve,pipeline:he}}),a=r((A,N)=>{var{pipeline:S}=Y(),c=Z(),{destroyer:_}=p(),{isNodeStream:C,isReadable:O,isWritable:D,isWebStream:B,isTransformStream:z,isWritableStream:G,isReadableStream:te}=l(),{AbortError:$,codes:{ERR_INVALID_ARG_VALUE:q,ERR_MISSING_ARGS:Ce}}=f(),fe=w();N.exports=function(...ae){if(ae.length===0)throw new Ce("streams");if(ae.length===1)return c.from(ae[0]);let be=[...ae];if(typeof ae[0]=="function"&&(ae[0]=c.from(ae[0])),typeof ae[ae.length-1]=="function"){let J=ae.length-1;ae[J]=c.from(ae[J])}for(let J=0;J<ae.length;++J)if(!(!C(ae[J])&&!B(ae[J]))){if(J<ae.length-1&&!(O(ae[J])||te(ae[J])||z(ae[J])))throw new q(`streams[${J}]`,be[J],"must be readable");if(J>0&&!(D(ae[J])||G(ae[J])||z(ae[J])))throw new q(`streams[${J}]`,be[J],"must be writable")}let H,ee,Q,X,se;function Ne(J){let pe=X;X=null,pe?pe(J):J?se.destroy(J):!W&&!K&&se.destroy()}o(Ne,"s");let we=ae[0],ue=S(ae,Ne),K=!!(D(we)||G(we)||z(we)),W=!!(O(ue)||te(ue)||z(ue));if(se=new c({writableObjectMode:!!(we!=null&&we.writableObjectMode),readableObjectMode:!!(ue!=null&&ue.readableObjectMode),writable:K,readable:W}),K){if(C(we))se._write=function(pe,le,oe){we.write(pe,le)?oe():H=oe},se._final=function(pe){we.end(),ee=pe},we.on("drain",function(){if(H){let pe=H;H=null,pe()}});else if(B(we)){let pe=(z(we)?we.writable:we).getWriter();se._write=async function(le,oe,Ve){try{await pe.ready,pe.write(le).catch(()=>{}),Ve()}catch(_e){Ve(_e)}},se._final=async function(le){try{await pe.ready,pe.close().catch(()=>{}),ee=le}catch(oe){le(oe)}}}let J=z(ue)?ue.readable:ue;fe(J,()=>{if(ee){let pe=ee;ee=null,pe()}})}if(W){if(C(ue))ue.on("readable",function(){if(Q){let J=Q;Q=null,J()}}),ue.on("end",function(){se.push(null)}),se._read=function(){for(;;){let J=ue.read();if(J===null){Q=se._read;return}if(!se.push(J))return}};else if(B(ue)){let J=(z(ue)?ue.readable:ue).getReader();se._read=async function(){for(;;)try{let{value:pe,done:le}=await J.read();if(!se.push(pe))return;if(le){se.push(null);return}}catch{return}}}}return se._destroy=function(J,pe){!J&&X!==null&&(J=new $),Q=null,H=null,ee=null,X===null?pe(J):(X=pe,C(ue)&&_(ue,J))},se}}),g=r((A,N)=>{var S=globalThis.AbortController||v().AbortController,{codes:{ERR_INVALID_ARG_VALUE:c,ERR_INVALID_ARG_TYPE:_,ERR_MISSING_ARGS:C,ERR_OUT_OF_RANGE:O},AbortError:D}=f(),{validateAbortSignal:B,validateInteger:z,validateObject:G}=h(),te=i().Symbol("kWeak"),$=i().Symbol("kResistStopPropagation"),{finished:q}=w(),Ce=a(),{addAbortSignalNoValidate:fe}=M(),{isWritable:ae,isNodeStream:be}=l(),{deprecate:H}=b(),{ArrayPrototypePush:ee,Boolean:Q,MathFloor:X,Number:se,NumberIsNaN:Ne,Promise:we,PromiseReject:ue,PromiseResolve:K,PromisePrototypeThen:W,Symbol:J}=i(),pe=J("kEmpty"),le=J("kEof");function oe(Se,Be){if(Be!=null&&G(Be,"options"),Be?.signal!=null&&B(Be.signal,"options.signal"),be(Se)&&!ae(Se))throw new c("stream",Se,"must be writable");let Ee=Ce(this,Se);return Be!=null&&Be.signal&&fe(Be.signal,Ee),Ee}o(oe,"f");function Ve(Se,Be){if(typeof Se!="function")throw new _("fn",["Function","AsyncFunction"],Se);Be!=null&&G(Be,"options"),Be?.signal!=null&&B(Be.signal,"options.signal");let Ee=1;Be?.concurrency!=null&&(Ee=X(Be.concurrency));let Ue=Ee-1;return Be?.highWaterMark!=null&&(Ue=X(Be.highWaterMark)),z(Ee,"options.concurrency",1),z(Ue,"options.highWaterMark",0),Ue+=Ee,async function*(){let Je=b().AbortSignalAny([Be?.signal].filter(Q)),re=this,de=[],Pe={signal:Je},Me,Re,Ke=!1,ie=0;function Ae(){Ke=!0,Ye()}o(Ae,"q8");function Ye(){ie-=1,me()}o(Ye,"f8");function me(){Re&&!Ke&&ie<Ee&&de.length<Ue&&(Re(),Re=null)}o(me,"W8");async function Qe(){try{for await(let st of re){if(Ke)return;if(Je.aborted)throw new D;try{if(st=Se(st,Pe),st===pe)continue;st=K(st)}catch(ze){st=ue(ze)}ie+=1,W(st,Ye,Ae),de.push(st),Me&&(Me(),Me=null),!Ke&&(de.length>=Ue||ie>=Ee)&&await new we(ze=>{Re=ze})}de.push(le)}catch(st){let ze=ue(st);W(ze,Ye,Ae),de.push(ze)}finally{Ke=!0,Me&&(Me(),Me=null)}}o(Qe,"J8"),Qe();try{for(;;){for(;de.length>0;){let st=await de[0];if(st===le)return;if(Je.aborted)throw new D;st!==pe&&(yield st),de.shift(),me()}await new we(st=>{Me=st})}}finally{Ke=!0,Re&&(Re(),Re=null)}}.call(this)}o(Ve,"J");function _e(Se=void 0){return Se!=null&&G(Se,"options"),Se?.signal!=null&&B(Se.signal,"options.signal"),async function*(){let Be=0;for await(let Ue of this){var Ee;if(Se!=null&&(Ee=Se.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new D({cause:Se.signal.reason});yield[Be++,Ue]}}.call(this)}o(_e,"T");async function Le(Se,Be=void 0){for await(let Ee of he.call(this,Se,Be))return!0;return!1}o(Le,"k");async function qe(Se,Be=void 0){if(typeof Se!="function")throw new _("fn",["Function","AsyncFunction"],Se);return!await Le.call(this,async(...Ee)=>!await Se(...Ee),Be)}o(qe,"G");async function ge(Se,Be){for await(let Ee of he.call(this,Se,Be))return Ee}o(ge,"A");async function De(Se,Be){if(typeof Se!="function")throw new _("fn",["Function","AsyncFunction"],Se);async function Ee(Ue,Je){return await Se(Ue,Je),pe}o(Ee,"G8");for await(let Ue of Ve.call(this,Ee,Be));}o(De,"H");function he(Se,Be){if(typeof Se!="function")throw new _("fn",["Function","AsyncFunction"],Se);async function Ee(Ue,Je){return await Se(Ue,Je)?Ue:pe}return o(Ee,"G8"),Ve.call(this,Ee,Be)}o(he,"X");class ve extends C{static{o(this,"N")}constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Oe(Se,Be,Ee){var Ue;if(typeof Se!="function")throw new _("reducer",["Function","AsyncFunction"],Se);Ee!=null&&G(Ee,"options"),Ee?.signal!=null&&B(Ee.signal,"options.signal");let Je=arguments.length>1;if(Ee!=null&&(Ue=Ee.signal)!==null&&Ue!==void 0&&Ue.aborted){let Re=new D(void 0,{cause:Ee.signal.reason});throw this.once("error",()=>{}),await q(this.destroy(Re)),Re}let re=new S,de=re.signal;if(Ee!=null&&Ee.signal){let Re={once:!0,[te]:this,[$]:!0};Ee.signal.addEventListener("abort",()=>re.abort(),Re)}let Pe=!1;try{for await(let Re of this){var Me;if(Pe=!0,Ee!=null&&(Me=Ee.signal)!==null&&Me!==void 0&&Me.aborted)throw new D;Je?Be=await Se(Be,Re,{signal:de}):(Be=Re,Je=!0)}if(!Pe&&!Je)throw new ve}finally{re.abort()}return Be}o(Oe,"R");async function je(Se){Se!=null&&G(Se,"options"),Se?.signal!=null&&B(Se.signal,"options.signal");let Be=[];for await(let Ue of this){var Ee;if(Se!=null&&(Ee=Se.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new D(void 0,{cause:Se.signal.reason});ee(Be,Ue)}return Be}o(je,"g");function ke(Se,Be){let Ee=Ve.call(this,Se,Be);return async function*(){for await(let Ue of Ee)yield*Ue}.call(this)}o(ke,"u");function Fe(Se){if(Se=se(Se),Ne(Se))return 0;if(Se<0)throw new O("number",">= 0",Se);return Se}o(Fe,"o");function et(Se,Be=void 0){return Be!=null&&G(Be,"options"),Be?.signal!=null&&B(Be.signal,"options.signal"),Se=Fe(Se),async function*(){var Ee;if(Be!=null&&(Ee=Be.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new D;for await(let Je of this){var Ue;if(Be!=null&&(Ue=Be.signal)!==null&&Ue!==void 0&&Ue.aborted)throw new D;Se--<=0&&(yield Je)}}.call(this)}o(et,"Q");function Ie(Se,Be=void 0){return Be!=null&&G(Be,"options"),Be?.signal!=null&&B(Be.signal,"options.signal"),Se=Fe(Se),async function*(){var Ee;if(Be!=null&&(Ee=Be.signal)!==null&&Ee!==void 0&&Ee.aborted)throw new D;for await(let Je of this){var Ue;if(Be!=null&&(Ue=Be.signal)!==null&&Ue!==void 0&&Ue.aborted)throw new D;if(Se-- >0&&(yield Je),Se<=0)return}}.call(this)}o(Ie,"j8"),N.exports.streamReturningOperators={asIndexedPairs:H(_e,"readable.asIndexedPairs will be removed in a future version."),drop:et,filter:he,flatMap:ke,map:Ve,take:Ie,compose:oe},N.exports.promiseReturningOperators={every:qe,forEach:De,reduce:Oe,toArray:je,some:Le,find:ge}}),u=r((A,N)=>{var{ArrayPrototypePop:S,Promise:c}=i(),{isIterable:_,isNodeStream:C,isWebStream:O}=l(),{pipelineImpl:D}=Y(),{finished:B}=w();d();function z(...G){return new c((te,$)=>{let q,Ce,fe=G[G.length-1];if(fe&&typeof fe=="object"&&!C(fe)&&!_(fe)&&!O(fe)){let ae=S(G);q=ae.signal,Ce=ae.end}D(G,(ae,be)=>{ae?$(ae):te(be)},{signal:q,end:Ce})})}o(z,"w"),N.exports={finished:B,pipeline:z}}),d=r((A,N)=>{var{Buffer:S}=(sr(),bt(er)),{ObjectDefineProperty:c,ObjectKeys:_,ReflectApply:C}=i(),{promisify:{custom:O}}=b(),{streamReturningOperators:D,promiseReturningOperators:B}=g(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:z}}=f(),G=a(),{setDefaultHighWaterMark:te,getDefaultHighWaterMark:$}=R(),{pipeline:q}=Y(),{destroyer:Ce}=p(),fe=w(),ae=u(),be=l(),H=N.exports=y().Stream;H.isDestroyed=be.isDestroyed,H.isDisturbed=be.isDisturbed,H.isErrored=be.isErrored,H.isReadable=be.isReadable,H.isWritable=be.isWritable,H.Readable=j();for(let Q of _(D)){let X=o(function(...Ne){if(new.target)throw z();return H.Readable.from(C(se,this,Ne))},"c"),se=D[Q];c(X,"name",{__proto__:null,value:se.name}),c(X,"length",{__proto__:null,value:se.length}),c(H.Readable.prototype,Q,{__proto__:null,value:X,enumerable:!1,configurable:!0,writable:!0})}for(let Q of _(B)){let X=o(function(...Ne){if(new.target)throw z();return C(se,this,Ne)},"c"),se=B[Q];c(X,"name",{__proto__:null,value:se.name}),c(X,"length",{__proto__:null,value:se.length}),c(H.Readable.prototype,Q,{__proto__:null,value:X,enumerable:!1,configurable:!0,writable:!0})}H.Writable=L(),H.Duplex=Z(),H.Transform=ne(),H.PassThrough=F(),H.pipeline=q;var{addAbortSignal:ee}=M();H.addAbortSignal=ee,H.finished=fe,H.destroy=Ce,H.compose=G,H.setDefaultHighWaterMark=te,H.getDefaultHighWaterMark=$,c(H,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return ae}}),c(q,O,{__proto__:null,enumerable:!0,get(){return ae.pipeline}}),c(fe,O,{__proto__:null,enumerable:!0,get(){return ae.finished}}),H.Stream=H,H._isUint8Array=function(Q){return Q instanceof Uint8Array},H._uint8ArrayToBuffer=function(Q){return S.from(Q.buffer,Q.byteOffset,Q.byteLength)}}),x=r((A,N)=>{Fu();{let S=d(),c=u(),_=S.Readable.destroy;N.exports=S.Readable,N.exports._uint8ArrayToBuffer=S._uint8ArrayToBuffer,N.exports._isUint8Array=S._isUint8Array,N.exports.isDisturbed=S.isDisturbed,N.exports.isErrored=S.isErrored,N.exports.isReadable=S.isReadable,N.exports.Readable=S.Readable,N.exports.Writable=S.Writable,N.exports.Duplex=S.Duplex,N.exports.Transform=S.Transform,N.exports.PassThrough=S.PassThrough,N.exports.addAbortSignal=S.addAbortSignal,N.exports.finished=S.finished,N.exports.destroy=S.destroy,N.exports.destroy=_,N.exports.pipeline=S.pipeline,N.exports.compose=S.compose,Object.defineProperty(S,"promises",{configurable:!0,enumerable:!0,get(){return c}}),N.exports.Stream=S.Stream}N.exports.default=N.exports});e.exports=x()}),Jt={};Rn(Jt,{webcrypto:o(()=>x2,"webcrypto"),rng:o(()=>Dy,"rng"),randomUUID:o(()=>J7,"randomUUID"),randomFillSync:o(()=>v2,"randomFillSync"),randomFill:o(()=>g2,"randomFill"),randomBytes:o(()=>By,"randomBytes"),publicEncrypt:o(()=>d2,"publicEncrypt"),publicDecrypt:o(()=>p2,"publicDecrypt"),pseudoRandomBytes:o(()=>Ly,"pseudoRandomBytes"),prng:o(()=>jy,"prng"),privateEncrypt:o(()=>h2,"privateEncrypt"),privateDecrypt:o(()=>m2,"privateDecrypt"),pbkdf2Sync:o(()=>Gy,"pbkdf2Sync"),pbkdf2:o(()=>Zy,"pbkdf2"),listCiphers:o(()=>t2,"listCiphers"),getRandomValues:o(()=>$7,"getRandomValues"),getHashes:o(()=>Vy,"getHashes"),getDiffieHellman:o(()=>n2,"getDiffieHellman"),getCurves:o(()=>K7,"getCurves"),getCiphers:o(()=>e2,"getCiphers"),default:o(()=>_2,"default"),createVerify:o(()=>u2,"createVerify"),createSign:o(()=>o2,"createSign"),createHmac:o(()=>Hy,"createHmac"),createHash:o(()=>Fy,"createHash"),createECDH:o(()=>f2,"createECDH"),createDiffieHellmanGroup:o(()=>i2,"createDiffieHellmanGroup"),createDiffieHellman:o(()=>s2,"createDiffieHellman"),createDecipheriv:o(()=>qy,"createDecipheriv"),createDecipher:o(()=>$y,"createDecipher"),createCredentials:o(()=>b2,"createCredentials"),createCipheriv:o(()=>Xy,"createCipheriv"),createCipher:o(()=>Qy,"createCipher"),constants:o(()=>y2,"constants"),Verify:o(()=>c2,"Verify"),Sign:o(()=>l2,"Sign"),Hmac:o(()=>Uy,"Hmac"),Hash:o(()=>zy,"Hash"),DiffieHellmanGroup:o(()=>r2,"DiffieHellmanGroup"),DiffieHellman:o(()=>a2,"DiffieHellman"),Decipheriv:o(()=>Jy,"Decipheriv"),Decipher:o(()=>Wy,"Decipher"),DEFAULT_ENCODING:o(()=>W7,"DEFAULT_ENCODING"),Cipheriv:o(()=>Ky,"Cipheriv"),Cipher:o(()=>Yy,"Cipher")});function K7(){return w2}o(K7,"iU");var Iy,Oy,Hd,Ty,Py,X7=o((t,e,r)=>{r=t!=null?Iy(Oy(t)):{};let i=e||!t||!t.__esModule?Hd(r,"default",{value:t,enumerable:!0}):r;for(let s of Ty(t))Py.call(i,s)||Hd(i,s,{get:o(()=>t[s],"get"),enumerable:!0});return i},"jn"),nt=o((t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),"l8"),ua,ca,Tc,_0,Jo,qo,Er,el,Pc,M0,jc,S0,E0,A0,k0,yi,Bi,Lc,Lr,Dc,fa,N0,Or,C0,R0,I0,Bc,Jr,ys,zc,O0,Fc,T0,Uc,P0,j0,L0,D0,tl,B0,rl,z0,F0,U0,H0,V0,Z0,G0,Y0,Q0,K0,X0,W0,$0,J0,Hc,q0,ws,em,Vc,Zc,tm,rm,Gc,im,nm,xs,sm,am,om,lm,um,cm,Yc,fm,Qc,Kc,Xc,il,Wc,dm,$c,hm,pm,nl,mm,gm,vm,bm,Rt,jy,Ly,Dy,By,zy,Fy,Uy,Hy,Vy,Zy,Gy,Yy,Qy,Ky,Xy,Wy,$y,Jy,qy,e2,t2,r2,i2,n2,s2,a2,o2,l2,u2,c2,f2,d2,h2,p2,m2,g2,v2,b2,y2,W7="buffer",$7=o(t=>crypto.getRandomValues(t),"rU"),J7=o(()=>crypto.randomUUID(),"FU"),w2,x2,_2,qt=Po(()=>{Iy=Object.create,{getPrototypeOf:Oy,defineProperty:Hd,getOwnPropertyNames:Ty}=Object,Py=Object.prototype.hasOwnProperty,ua=nt((t,e)=>{e.exports=(qt(),bt(Jt)).randomBytes}),ca=nt((t,e)=>{e.exports=(qt(),bt(Jt)).createHash}),Tc=nt((t,e)=>{e.exports=(qt(),bt(Jt)).createHmac}),_0=nt((t,e)=>{e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),Jo=nt((t,e)=>{var r=Math.pow(2,30)-1;e.exports=function(i,s){if(typeof i!="number")throw TypeError("Iterations not a number");if(i<0)throw TypeError("Bad iterations");if(typeof s!="number")throw TypeError("Key length not a number");if(s<0||s>r||s!==s)throw TypeError("Bad key length")}}),qo=nt((t,e)=>{var r;globalThis.process&&globalThis.process.browser?r="utf-8":globalThis.process&&globalThis.process.version?(i=parseInt(process.version.split(".")[0].slice(1),10),r=i>=6?"utf-8":"binary"):r="utf-8";var i;e.exports=r}),Er=nt((t,e)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var r=(sr(),bt(er)),i=r.Buffer;function s(n,v){for(var b in n)v[b]=n[b]}o(s,"P"),i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=f);function f(n,v,b){return i(n,v,b)}o(f,"O"),f.prototype=Object.create(i.prototype),s(i,f),f.from=function(n,v,b){if(typeof n=="number")throw TypeError("Argument must not be a number");return i(n,v,b)},f.alloc=function(n,v,b){if(typeof n!="number")throw TypeError("Argument must be a number");var h=i(n);return v!==void 0?typeof b=="string"?h.fill(v,b):h.fill(v):h.fill(0),h},f.allocUnsafe=function(n){if(typeof n!="number")throw TypeError("Argument must be a number");return i(n)},f.allocUnsafeSlow=function(n){if(typeof n!="number")throw TypeError("Argument must be a number");return r.SlowBuffer(n)}}),el=nt((t,e)=>{var r=Er().Buffer;e.exports=function(i,s,f){if(r.isBuffer(i))return i;if(typeof i=="string")return r.from(i,s);if(ArrayBuffer.isView(i))return r.from(i.buffer);throw TypeError(f+" must be a string, a Buffer, a typed array or a DataView")}}),Pc=nt((t,e)=>{var r={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20},i=Tc(),s=Er().Buffer,f=Jo(),n=qo(),v=el();function b(h,m,l,w,p){f(l,w),h=v(h,n,"Password"),m=v(m,n,"Salt"),p=p||"sha1";var y=s.allocUnsafe(w),M=s.allocUnsafe(m.length+4);m.copy(M,0,0,m.length);for(var E=0,R=r[p],I=Math.ceil(w/R),T=1;T<=I;T++){M.writeUInt32BE(T,m.length);for(var P=i(p,h).update(M).digest(),j=P,L=1;L<l;L++){j=i(p,h).update(j).digest();for(var U=0;U<R;U++)P[U]^=j[U]}P.copy(y,E),E+=R}return y}o(b,"v"),e.exports=b}),M0=nt((t,e)=>{var r=Er().Buffer,i=Jo(),s=qo(),f=Pc(),n=el(),v,b=globalThis.crypto&&globalThis.crypto.subtle,h={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},m=[];function l(E){if(globalThis.process&&!globalThis.process.browser||!b||!b.importKey||!b.deriveBits)return Promise.resolve(!1);if(m[E]!==void 0)return m[E];v=v||r.alloc(8);var R=y(v,v,10,128,E).then(function(){return!0}).catch(function(){return!1});return m[E]=R,R}o(l,"Z");var w;function p(){return w||(globalThis.process&&globalThis.process.nextTick?w=globalThis.process.nextTick:globalThis.queueMicrotask?w=globalThis.queueMicrotask:globalThis.setImmediate?w=globalThis.setImmediate:w=globalThis.setTimeout,w)}o(p,"C");function y(E,R,I,T,P){return b.importKey("raw",E,{name:"PBKDF2"},!1,["deriveBits"]).then(function(j){return b.deriveBits({name:"PBKDF2",salt:R,iterations:I,hash:{name:P}},j,T<<3)}).then(function(j){return r.from(j)})}o(y,"E");function M(E,R){E.then(function(I){p()(function(){R(null,I)})},function(I){p()(function(){R(I)})})}o(M,"I"),e.exports=function(E,R,I,T,P,j){typeof P=="function"&&(j=P,P=void 0),P=P||"sha1";var L=h[P.toLowerCase()];if(!L||typeof globalThis.Promise!="function"){p()(function(){var U;try{U=f(E,R,I,T,P)}catch(Z){return j(Z)}j(null,U)});return}if(i(I,T),E=n(E,s,"Password"),R=n(R,s,"Salt"),typeof j!="function")throw Error("No callback provided to pbkdf2");M(l(L).then(function(U){return U?y(E,R,I,T,L):f(E,R,I,T,P)}),j)}}),jc=nt(t=>{var e=(qt(),bt(Jt)),r=Jo(),i=qo(),s=el();function f(v,b,h,m,l,w){if(r(h,m),v=s(v,i,"Password"),b=s(b,i,"Salt"),typeof l=="function"&&(w=l,l="sha1"),typeof w!="function")throw Error("No callback provided to pbkdf2");return e.pbkdf2(v,b,h,m,l,w)}o(f,"O");function n(v,b,h,m,l){return r(h,m),v=s(v,i,"Password"),b=s(b,i,"Salt"),l=l||"sha1",e.pbkdf2Sync(v,b,h,m,l)}o(n,"Y"),!e.pbkdf2Sync||e.pbkdf2Sync.toString().indexOf("keylen, digest")===-1?(t.pbkdf2Sync=Pc(),t.pbkdf2=M0()):(t.pbkdf2Sync=n,t.pbkdf2=f)}),S0=nt(t=>{var e=(qt(),bt(Jt));t.createCipher=t.Cipher=e.createCipher,t.createCipheriv=t.Cipheriv=e.createCipheriv,t.createDecipher=t.Decipher=e.createDecipher,t.createDecipheriv=t.Decipheriv=e.createDecipheriv,t.listCiphers=t.getCiphers=e.getCiphers}),E0=nt(t=>{var e=(qt(),bt(Jt));t.DiffieHellmanGroup=e.DiffieHellmanGroup,t.createDiffieHellmanGroup=e.createDiffieHellmanGroup,t.getDiffieHellman=e.getDiffieHellman,t.createDiffieHellman=e.createDiffieHellman,t.DiffieHellman=e.DiffieHellman}),A0=nt(t=>{var e=(qt(),bt(Jt));t.createSign=e.createSign,t.Sign=e.Sign,t.createVerify=e.createVerify,t.Verify=e.Verify}),k0=nt((t,e)=>{e.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),yi=nt((t,e)=>{(function(r,i){function s(a,g){if(!a)throw Error(g||"Assertion failed")}o(s,"P");function f(a,g){a.super_=g;var u=o(function(){},"W");u.prototype=g.prototype,a.prototype=new u,a.prototype.constructor=a}o(f,"O");function n(a,g,u){if(n.isBN(a))return a;this.negative=0,this.words=null,this.length=0,this.red=null,a!==null&&((g==="le"||g==="be")&&(u=g,g=10),this._init(a||0,g||10,u||"be"))}o(n,"Y"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,g){return a.cmp(g)>0?a:g},n.min=function(a,g){return a.cmp(g)<0?a:g},n.prototype._init=function(a,g,u){if(typeof a=="number")return this._initNumber(a,g,u);if(typeof a=="object")return this._initArray(a,g,u);g==="hex"&&(g=16),s(g===(g|0)&&g>=2&&g<=36),a=a.toString().replace(/\s+/g,"");var d=0;a[0]==="-"&&(d++,this.negative=1),d<a.length&&(g===16?this._parseHex(a,d,u):(this._parseBase(a,g,d),u==="le"&&this._initArray(this.toArray(),g,u)))},n.prototype._initNumber=function(a,g,u){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(s(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),g,u)},n.prototype._initArray=function(a,g,u){if(s(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x,A,N=0;if(u==="be")for(d=a.length-1,x=0;d>=0;d-=3)A=a[d]|a[d-1]<<8|a[d-2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);else if(u==="le")for(d=0,x=0;d<a.length;d+=3)A=a[d]|a[d+1]<<8|a[d+2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);return this.strip()};function b(a,g){var u=a.charCodeAt(g);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}o(b,"v");function h(a,g,u){var d=b(a,u);return u-1>=g&&(d|=b(a,u-1)<<4),d}o(h,"w"),n.prototype._parseHex=function(a,g,u){this.length=Math.ceil((a.length-g)/6),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x=0,A=0,N;if(u==="be")for(d=a.length-1;d>=g;d-=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8;else{var S=a.length-g;for(d=S%2===0?g+1:g;d<a.length;d+=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8}this.strip()};function m(a,g,u,d){for(var x=0,A=Math.min(a.length,u),N=g;N<A;N++){var S=a.charCodeAt(N)-48;x*=d,S>=49?x+=S-49+10:S>=17?x+=S-17+10:x+=S}return x}o(m,"V"),n.prototype._parseBase=function(a,g,u){this.words=[0],this.length=1;for(var d=0,x=1;x<=67108863;x*=g)d++;d--,x=x/g|0;for(var A=a.length-u,N=A%d,S=Math.min(A,A-N)+u,c=0,_=u;_<S;_+=d)c=m(a,_,_+d,g),this.imuln(x),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(N!==0){var C=1;for(c=m(a,_,a.length,g),_=0;_<N;_++)C*=g;this.imuln(C),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(a){a.words=Array(this.length);for(var g=0;g<this.length;g++)a.words[g]=this.words[g];a.length=this.length,a.negative=this.negative,a.red=this.red},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(a,g){a=a||10,g=g|0||1;var u;if(a===16||a==="hex"){u="";for(var d=0,x=0,A=0;A<this.length;A++){var N=this.words[A],S=((N<<d|x)&16777215).toString(16);x=N>>>24-d&16777215,d+=2,d>=26&&(d-=26,A--),x!==0||A!==this.length-1?u=l[6-S.length]+S+u:u=S+u}for(x!==0&&(u=x.toString(16)+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(a===(a|0)&&a>=2&&a<=36){var c=w[a],_=p[a];u="";var C=this.clone();for(C.negative=0;!C.isZero();){var O=C.modn(_).toString(a);C=C.idivn(_),C.isZero()?u=O+u:u=l[c-O.length]+O+u}for(this.isZero()&&(u="0"+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(a,g){return s(typeof v<"u"),this.toArrayLike(v,a,g)},n.prototype.toArray=function(a,g){return this.toArrayLike(Array,a,g)},n.prototype.toArrayLike=function(a,g,u){var d=this.byteLength(),x=u||Math.max(1,d);s(d<=x,"byte array longer than desired length"),s(x>0,"Requested array length <= 0"),this.strip();var A=g==="le",N=new a(x),S,c,_=this.clone();if(A){for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[c]=S;for(;c<x;c++)N[c]=0}else{for(c=0;c<x-d;c++)N[c]=0;for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[x-c-1]=S}return N},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var g=a,u=0;return g>=4096&&(u+=13,g>>>=13),g>=64&&(u+=7,g>>>=7),g>=8&&(u+=4,g>>>=4),g>=2&&(u+=2,g>>>=2),u+g},n.prototype._zeroBits=function(a){if(a===0)return 26;var g=a,u=0;return(g&8191)===0&&(u+=13,g>>>=13),(g&127)===0&&(u+=7,g>>>=7),(g&15)===0&&(u+=4,g>>>=4),(g&3)===0&&(u+=2,g>>>=2),(g&1)===0&&u++,u},n.prototype.bitLength=function(){var a=this.words[this.length-1],g=this._countBits(a);return(this.length-1)*26+g};function y(a){for(var g=Array(a.bitLength()),u=0;u<g.length;u++){var d=u/26|0,x=u%26;g[u]=(a.words[d]&1<<x)>>>x}return g}o(y,"E"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,g=0;g<this.length;g++){var u=this._zeroBits(this.words[g]);if(a+=u,u!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var g=0;g<a.length;g++)this.words[g]=this.words[g]|a.words[g];return this.strip()},n.prototype.ior=function(a){return s((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var g;this.length>a.length?g=a:g=this;for(var u=0;u<g.length;u++)this.words[u]=this.words[u]&a.words[u];return this.length=g.length,this.strip()},n.prototype.iand=function(a){return s((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var g,u;this.length>a.length?(g=this,u=a):(g=a,u=this);for(var d=0;d<u.length;d++)this.words[d]=g.words[d]^u.words[d];if(this!==g)for(;d<g.length;d++)this.words[d]=g.words[d];return this.length=g.length,this.strip()},n.prototype.ixor=function(a){return s((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){s(typeof a=="number"&&a>=0);var g=Math.ceil(a/26)|0,u=a%26;this._expand(g),u>0&&g--;for(var d=0;d<g;d++)this.words[d]=~this.words[d]&67108863;return u>0&&(this.words[d]=~this.words[d]&67108863>>26-u),this.strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,g){s(typeof a=="number"&&a>=0);var u=a/26|0,d=a%26;return this._expand(u+1),g?this.words[u]=this.words[u]|1<<d:this.words[u]=this.words[u]&~(1<<d),this.strip()},n.prototype.iadd=function(a){var g;if(this.negative!==0&&a.negative===0)return this.negative=0,g=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,g=this.isub(a),a.negative=1,g._normSign();var u,d;this.length>a.length?(u=this,d=a):(u=a,d=this);for(var x=0,A=0;A<d.length;A++)g=(u.words[A]|0)+(d.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;for(;x!==0&&A<u.length;A++)g=(u.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;if(this.length=u.length,x!==0)this.words[this.length]=x,this.length++;else if(u!==this)for(;A<u.length;A++)this.words[A]=u.words[A];return this},n.prototype.add=function(a){var g;return a.negative!==0&&this.negative===0?(a.negative=0,g=this.sub(a),a.negative^=1,g):a.negative===0&&this.negative!==0?(this.negative=0,g=a.sub(this),this.negative=1,g):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var g=this.iadd(a);return a.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var u=this.cmp(a);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,x;u>0?(d=this,x=a):(d=a,x=this);for(var A=0,N=0;N<x.length;N++)g=(d.words[N]|0)-(x.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;for(;A!==0&&N<d.length;N++)g=(d.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;if(A===0&&N<d.length&&d!==this)for(;N<d.length;N++)this.words[N]=d.words[N];return this.length=Math.max(this.length,N),d!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function M(a,g,u){u.negative=g.negative^a.negative;var d=a.length+g.length|0;u.length=d,d=d-1|0;var x=a.words[0]|0,A=g.words[0]|0,N=x*A,S=N&67108863,c=N/67108864|0;u.words[0]=S;for(var _=1;_<d;_++){for(var C=c>>>26,O=c&67108863,D=Math.min(_,g.length-1),B=Math.max(0,_-a.length+1);B<=D;B++){var z=_-B|0;x=a.words[z]|0,A=g.words[B]|0,N=x*A+O,C+=N/67108864|0,O=N&67108863}u.words[_]=O|0,c=C|0}return c!==0?u.words[_]=c|0:u.length--,u.strip()}o(M,"I");var E=o(function(a,g,u){var d=a.words,x=g.words,A=u.words,N=0,S,c,_,C=d[0]|0,O=C&8191,D=C>>>13,B=d[1]|0,z=B&8191,G=B>>>13,te=d[2]|0,$=te&8191,q=te>>>13,Ce=d[3]|0,fe=Ce&8191,ae=Ce>>>13,be=d[4]|0,H=be&8191,ee=be>>>13,Q=d[5]|0,X=Q&8191,se=Q>>>13,Ne=d[6]|0,we=Ne&8191,ue=Ne>>>13,K=d[7]|0,W=K&8191,J=K>>>13,pe=d[8]|0,le=pe&8191,oe=pe>>>13,Ve=d[9]|0,_e=Ve&8191,Le=Ve>>>13,qe=x[0]|0,ge=qe&8191,De=qe>>>13,he=x[1]|0,ve=he&8191,Oe=he>>>13,je=x[2]|0,ke=je&8191,Fe=je>>>13,et=x[3]|0,Ie=et&8191,Se=et>>>13,Be=x[4]|0,Ee=Be&8191,Ue=Be>>>13,Je=x[5]|0,re=Je&8191,de=Je>>>13,Pe=x[6]|0,Me=Pe&8191,Re=Pe>>>13,Ke=x[7]|0,ie=Ke&8191,Ae=Ke>>>13,Ye=x[8]|0,me=Ye&8191,Qe=Ye>>>13,st=x[9]|0,ze=st&8191,We=st>>>13;u.negative=a.negative^g.negative,u.length=19,S=Math.imul(O,ge),c=Math.imul(O,De),c=c+Math.imul(D,ge)|0,_=Math.imul(D,De);var Te=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,S=Math.imul(z,ge),c=Math.imul(z,De),c=c+Math.imul(G,ge)|0,_=Math.imul(G,De),S=S+Math.imul(O,ve)|0,c=c+Math.imul(O,Oe)|0,c=c+Math.imul(D,ve)|0,_=_+Math.imul(D,Oe)|0;var Ze=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,S=Math.imul($,ge),c=Math.imul($,De),c=c+Math.imul(q,ge)|0,_=Math.imul(q,De),S=S+Math.imul(z,ve)|0,c=c+Math.imul(z,Oe)|0,c=c+Math.imul(G,ve)|0,_=_+Math.imul(G,Oe)|0,S=S+Math.imul(O,ke)|0,c=c+Math.imul(O,Fe)|0,c=c+Math.imul(D,ke)|0,_=_+Math.imul(D,Fe)|0;var lt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(fe,ge),c=Math.imul(fe,De),c=c+Math.imul(ae,ge)|0,_=Math.imul(ae,De),S=S+Math.imul($,ve)|0,c=c+Math.imul($,Oe)|0,c=c+Math.imul(q,ve)|0,_=_+Math.imul(q,Oe)|0,S=S+Math.imul(z,ke)|0,c=c+Math.imul(z,Fe)|0,c=c+Math.imul(G,ke)|0,_=_+Math.imul(G,Fe)|0,S=S+Math.imul(O,Ie)|0,c=c+Math.imul(O,Se)|0,c=c+Math.imul(D,Ie)|0,_=_+Math.imul(D,Se)|0;var yt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(yt>>>26)|0,yt&=67108863,S=Math.imul(H,ge),c=Math.imul(H,De),c=c+Math.imul(ee,ge)|0,_=Math.imul(ee,De),S=S+Math.imul(fe,ve)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(ae,ve)|0,_=_+Math.imul(ae,Oe)|0,S=S+Math.imul($,ke)|0,c=c+Math.imul($,Fe)|0,c=c+Math.imul(q,ke)|0,_=_+Math.imul(q,Fe)|0,S=S+Math.imul(z,Ie)|0,c=c+Math.imul(z,Se)|0,c=c+Math.imul(G,Ie)|0,_=_+Math.imul(G,Se)|0,S=S+Math.imul(O,Ee)|0,c=c+Math.imul(O,Ue)|0,c=c+Math.imul(D,Ee)|0,_=_+Math.imul(D,Ue)|0;var ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(X,ge),c=Math.imul(X,De),c=c+Math.imul(se,ge)|0,_=Math.imul(se,De),S=S+Math.imul(H,ve)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(ee,ve)|0,_=_+Math.imul(ee,Oe)|0,S=S+Math.imul(fe,ke)|0,c=c+Math.imul(fe,Fe)|0,c=c+Math.imul(ae,ke)|0,_=_+Math.imul(ae,Fe)|0,S=S+Math.imul($,Ie)|0,c=c+Math.imul($,Se)|0,c=c+Math.imul(q,Ie)|0,_=_+Math.imul(q,Se)|0,S=S+Math.imul(z,Ee)|0,c=c+Math.imul(z,Ue)|0,c=c+Math.imul(G,Ee)|0,_=_+Math.imul(G,Ue)|0,S=S+Math.imul(O,re)|0,c=c+Math.imul(O,de)|0,c=c+Math.imul(D,re)|0,_=_+Math.imul(D,de)|0;var Nt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S=Math.imul(we,ge),c=Math.imul(we,De),c=c+Math.imul(ue,ge)|0,_=Math.imul(ue,De),S=S+Math.imul(X,ve)|0,c=c+Math.imul(X,Oe)|0,c=c+Math.imul(se,ve)|0,_=_+Math.imul(se,Oe)|0,S=S+Math.imul(H,ke)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(ee,ke)|0,_=_+Math.imul(ee,Fe)|0,S=S+Math.imul(fe,Ie)|0,c=c+Math.imul(fe,Se)|0,c=c+Math.imul(ae,Ie)|0,_=_+Math.imul(ae,Se)|0,S=S+Math.imul($,Ee)|0,c=c+Math.imul($,Ue)|0,c=c+Math.imul(q,Ee)|0,_=_+Math.imul(q,Ue)|0,S=S+Math.imul(z,re)|0,c=c+Math.imul(z,de)|0,c=c+Math.imul(G,re)|0,_=_+Math.imul(G,de)|0,S=S+Math.imul(O,Me)|0,c=c+Math.imul(O,Re)|0,c=c+Math.imul(D,Me)|0,_=_+Math.imul(D,Re)|0;var Dt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(W,ge),c=Math.imul(W,De),c=c+Math.imul(J,ge)|0,_=Math.imul(J,De),S=S+Math.imul(we,ve)|0,c=c+Math.imul(we,Oe)|0,c=c+Math.imul(ue,ve)|0,_=_+Math.imul(ue,Oe)|0,S=S+Math.imul(X,ke)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(se,ke)|0,_=_+Math.imul(se,Fe)|0,S=S+Math.imul(H,Ie)|0,c=c+Math.imul(H,Se)|0,c=c+Math.imul(ee,Ie)|0,_=_+Math.imul(ee,Se)|0,S=S+Math.imul(fe,Ee)|0,c=c+Math.imul(fe,Ue)|0,c=c+Math.imul(ae,Ee)|0,_=_+Math.imul(ae,Ue)|0,S=S+Math.imul($,re)|0,c=c+Math.imul($,de)|0,c=c+Math.imul(q,re)|0,_=_+Math.imul(q,de)|0,S=S+Math.imul(z,Me)|0,c=c+Math.imul(z,Re)|0,c=c+Math.imul(G,Me)|0,_=_+Math.imul(G,Re)|0,S=S+Math.imul(O,ie)|0,c=c+Math.imul(O,Ae)|0,c=c+Math.imul(D,ie)|0,_=_+Math.imul(D,Ae)|0;var Ct=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,S=Math.imul(le,ge),c=Math.imul(le,De),c=c+Math.imul(oe,ge)|0,_=Math.imul(oe,De),S=S+Math.imul(W,ve)|0,c=c+Math.imul(W,Oe)|0,c=c+Math.imul(J,ve)|0,_=_+Math.imul(J,Oe)|0,S=S+Math.imul(we,ke)|0,c=c+Math.imul(we,Fe)|0,c=c+Math.imul(ue,ke)|0,_=_+Math.imul(ue,Fe)|0,S=S+Math.imul(X,Ie)|0,c=c+Math.imul(X,Se)|0,c=c+Math.imul(se,Ie)|0,_=_+Math.imul(se,Se)|0,S=S+Math.imul(H,Ee)|0,c=c+Math.imul(H,Ue)|0,c=c+Math.imul(ee,Ee)|0,_=_+Math.imul(ee,Ue)|0,S=S+Math.imul(fe,re)|0,c=c+Math.imul(fe,de)|0,c=c+Math.imul(ae,re)|0,_=_+Math.imul(ae,de)|0,S=S+Math.imul($,Me)|0,c=c+Math.imul($,Re)|0,c=c+Math.imul(q,Me)|0,_=_+Math.imul(q,Re)|0,S=S+Math.imul(z,ie)|0,c=c+Math.imul(z,Ae)|0,c=c+Math.imul(G,ie)|0,_=_+Math.imul(G,Ae)|0,S=S+Math.imul(O,me)|0,c=c+Math.imul(O,Qe)|0,c=c+Math.imul(D,me)|0,_=_+Math.imul(D,Qe)|0;var St=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(St>>>26)|0,St&=67108863,S=Math.imul(_e,ge),c=Math.imul(_e,De),c=c+Math.imul(Le,ge)|0,_=Math.imul(Le,De),S=S+Math.imul(le,ve)|0,c=c+Math.imul(le,Oe)|0,c=c+Math.imul(oe,ve)|0,_=_+Math.imul(oe,Oe)|0,S=S+Math.imul(W,ke)|0,c=c+Math.imul(W,Fe)|0,c=c+Math.imul(J,ke)|0,_=_+Math.imul(J,Fe)|0,S=S+Math.imul(we,Ie)|0,c=c+Math.imul(we,Se)|0,c=c+Math.imul(ue,Ie)|0,_=_+Math.imul(ue,Se)|0,S=S+Math.imul(X,Ee)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(se,Ee)|0,_=_+Math.imul(se,Ue)|0,S=S+Math.imul(H,re)|0,c=c+Math.imul(H,de)|0,c=c+Math.imul(ee,re)|0,_=_+Math.imul(ee,de)|0,S=S+Math.imul(fe,Me)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(ae,Me)|0,_=_+Math.imul(ae,Re)|0,S=S+Math.imul($,ie)|0,c=c+Math.imul($,Ae)|0,c=c+Math.imul(q,ie)|0,_=_+Math.imul(q,Ae)|0,S=S+Math.imul(z,me)|0,c=c+Math.imul(z,Qe)|0,c=c+Math.imul(G,me)|0,_=_+Math.imul(G,Qe)|0,S=S+Math.imul(O,ze)|0,c=c+Math.imul(O,We)|0,c=c+Math.imul(D,ze)|0,_=_+Math.imul(D,We)|0;var Ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,S=Math.imul(_e,ve),c=Math.imul(_e,Oe),c=c+Math.imul(Le,ve)|0,_=Math.imul(Le,Oe),S=S+Math.imul(le,ke)|0,c=c+Math.imul(le,Fe)|0,c=c+Math.imul(oe,ke)|0,_=_+Math.imul(oe,Fe)|0,S=S+Math.imul(W,Ie)|0,c=c+Math.imul(W,Se)|0,c=c+Math.imul(J,Ie)|0,_=_+Math.imul(J,Se)|0,S=S+Math.imul(we,Ee)|0,c=c+Math.imul(we,Ue)|0,c=c+Math.imul(ue,Ee)|0,_=_+Math.imul(ue,Ue)|0,S=S+Math.imul(X,re)|0,c=c+Math.imul(X,de)|0,c=c+Math.imul(se,re)|0,_=_+Math.imul(se,de)|0,S=S+Math.imul(H,Me)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(ee,Me)|0,_=_+Math.imul(ee,Re)|0,S=S+Math.imul(fe,ie)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(ae,ie)|0,_=_+Math.imul(ae,Ae)|0,S=S+Math.imul($,me)|0,c=c+Math.imul($,Qe)|0,c=c+Math.imul(q,me)|0,_=_+Math.imul(q,Qe)|0,S=S+Math.imul(z,ze)|0,c=c+Math.imul(z,We)|0,c=c+Math.imul(G,ze)|0,_=_+Math.imul(G,We)|0;var Vt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,S=Math.imul(_e,ke),c=Math.imul(_e,Fe),c=c+Math.imul(Le,ke)|0,_=Math.imul(Le,Fe),S=S+Math.imul(le,Ie)|0,c=c+Math.imul(le,Se)|0,c=c+Math.imul(oe,Ie)|0,_=_+Math.imul(oe,Se)|0,S=S+Math.imul(W,Ee)|0,c=c+Math.imul(W,Ue)|0,c=c+Math.imul(J,Ee)|0,_=_+Math.imul(J,Ue)|0,S=S+Math.imul(we,re)|0,c=c+Math.imul(we,de)|0,c=c+Math.imul(ue,re)|0,_=_+Math.imul(ue,de)|0,S=S+Math.imul(X,Me)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(se,Me)|0,_=_+Math.imul(se,Re)|0,S=S+Math.imul(H,ie)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(ee,ie)|0,_=_+Math.imul(ee,Ae)|0,S=S+Math.imul(fe,me)|0,c=c+Math.imul(fe,Qe)|0,c=c+Math.imul(ae,me)|0,_=_+Math.imul(ae,Qe)|0,S=S+Math.imul($,ze)|0,c=c+Math.imul($,We)|0,c=c+Math.imul(q,ze)|0,_=_+Math.imul(q,We)|0;var Pt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,S=Math.imul(_e,Ie),c=Math.imul(_e,Se),c=c+Math.imul(Le,Ie)|0,_=Math.imul(Le,Se),S=S+Math.imul(le,Ee)|0,c=c+Math.imul(le,Ue)|0,c=c+Math.imul(oe,Ee)|0,_=_+Math.imul(oe,Ue)|0,S=S+Math.imul(W,re)|0,c=c+Math.imul(W,de)|0,c=c+Math.imul(J,re)|0,_=_+Math.imul(J,de)|0,S=S+Math.imul(we,Me)|0,c=c+Math.imul(we,Re)|0,c=c+Math.imul(ue,Me)|0,_=_+Math.imul(ue,Re)|0,S=S+Math.imul(X,ie)|0,c=c+Math.imul(X,Ae)|0,c=c+Math.imul(se,ie)|0,_=_+Math.imul(se,Ae)|0,S=S+Math.imul(H,me)|0,c=c+Math.imul(H,Qe)|0,c=c+Math.imul(ee,me)|0,_=_+Math.imul(ee,Qe)|0,S=S+Math.imul(fe,ze)|0,c=c+Math.imul(fe,We)|0,c=c+Math.imul(ae,ze)|0,_=_+Math.imul(ae,We)|0;var Ft=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,S=Math.imul(_e,Ee),c=Math.imul(_e,Ue),c=c+Math.imul(Le,Ee)|0,_=Math.imul(Le,Ue),S=S+Math.imul(le,re)|0,c=c+Math.imul(le,de)|0,c=c+Math.imul(oe,re)|0,_=_+Math.imul(oe,de)|0,S=S+Math.imul(W,Me)|0,c=c+Math.imul(W,Re)|0,c=c+Math.imul(J,Me)|0,_=_+Math.imul(J,Re)|0,S=S+Math.imul(we,ie)|0,c=c+Math.imul(we,Ae)|0,c=c+Math.imul(ue,ie)|0,_=_+Math.imul(ue,Ae)|0,S=S+Math.imul(X,me)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(se,me)|0,_=_+Math.imul(se,Qe)|0,S=S+Math.imul(H,ze)|0,c=c+Math.imul(H,We)|0,c=c+Math.imul(ee,ze)|0,_=_+Math.imul(ee,We)|0;var Tt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,S=Math.imul(_e,re),c=Math.imul(_e,de),c=c+Math.imul(Le,re)|0,_=Math.imul(Le,de),S=S+Math.imul(le,Me)|0,c=c+Math.imul(le,Re)|0,c=c+Math.imul(oe,Me)|0,_=_+Math.imul(oe,Re)|0,S=S+Math.imul(W,ie)|0,c=c+Math.imul(W,Ae)|0,c=c+Math.imul(J,ie)|0,_=_+Math.imul(J,Ae)|0,S=S+Math.imul(we,me)|0,c=c+Math.imul(we,Qe)|0,c=c+Math.imul(ue,me)|0,_=_+Math.imul(ue,Qe)|0,S=S+Math.imul(X,ze)|0,c=c+Math.imul(X,We)|0,c=c+Math.imul(se,ze)|0,_=_+Math.imul(se,We)|0;var jt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(jt>>>26)|0,jt&=67108863,S=Math.imul(_e,Me),c=Math.imul(_e,Re),c=c+Math.imul(Le,Me)|0,_=Math.imul(Le,Re),S=S+Math.imul(le,ie)|0,c=c+Math.imul(le,Ae)|0,c=c+Math.imul(oe,ie)|0,_=_+Math.imul(oe,Ae)|0,S=S+Math.imul(W,me)|0,c=c+Math.imul(W,Qe)|0,c=c+Math.imul(J,me)|0,_=_+Math.imul(J,Qe)|0,S=S+Math.imul(we,ze)|0,c=c+Math.imul(we,We)|0,c=c+Math.imul(ue,ze)|0,_=_+Math.imul(ue,We)|0;var Ut=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,S=Math.imul(_e,ie),c=Math.imul(_e,Ae),c=c+Math.imul(Le,ie)|0,_=Math.imul(Le,Ae),S=S+Math.imul(le,me)|0,c=c+Math.imul(le,Qe)|0,c=c+Math.imul(oe,me)|0,_=_+Math.imul(oe,Qe)|0,S=S+Math.imul(W,ze)|0,c=c+Math.imul(W,We)|0,c=c+Math.imul(J,ze)|0,_=_+Math.imul(J,We)|0;var Zt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,S=Math.imul(_e,me),c=Math.imul(_e,Qe),c=c+Math.imul(Le,me)|0,_=Math.imul(Le,Qe),S=S+Math.imul(le,ze)|0,c=c+Math.imul(le,We)|0,c=c+Math.imul(oe,ze)|0,_=_+Math.imul(oe,We)|0;var Gt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,S=Math.imul(_e,ze),c=Math.imul(_e,We),c=c+Math.imul(Le,ze)|0,_=Math.imul(Le,We);var Yt=(N+S|0)+((c&8191)<<13)|0;return N=(_+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,A[0]=Te,A[1]=Ze,A[2]=lt,A[3]=yt,A[4]=ht,A[5]=Nt,A[6]=Dt,A[7]=Ct,A[8]=St,A[9]=Ht,A[10]=Vt,A[11]=Pt,A[12]=Ft,A[13]=Tt,A[14]=jt,A[15]=Ut,A[16]=Zt,A[17]=Gt,A[18]=Yt,N!==0&&(A[19]=N,u.length++),u},"L");Math.imul||(E=M);function R(a,g,u){u.negative=g.negative^a.negative,u.length=a.length+g.length;for(var d=0,x=0,A=0;A<u.length-1;A++){var N=x;x=0;for(var S=d&67108863,c=Math.min(A,g.length-1),_=Math.max(0,A-a.length+1);_<=c;_++){var C=A-_,O=a.words[C]|0,D=g.words[_]|0,B=O*D,z=B&67108863;N=N+(B/67108864|0)|0,z=z+S|0,S=z&67108863,N=N+(z>>>26)|0,x+=N>>>26,N&=67108863}u.words[A]=S,d=N,N=x}return d!==0?u.words[A]=d:u.length--,u.strip()}o(R,"h");function I(a,g,u){var d=new T;return d.mulp(a,g,u)}o(I,"b"),n.prototype.mulTo=function(a,g){var u,d=this.length+a.length;return this.length===10&&a.length===10?u=E(this,a,g):d<63?u=M(this,a,g):d<1024?u=R(this,a,g):u=I(this,a,g),u};function T(a,g){this.x=a,this.y=g}o(T,"y"),T.prototype.makeRBT=function(a){for(var g=Array(a),u=n.prototype._countBits(a)-1,d=0;d<a;d++)g[d]=this.revBin(d,u,a);return g},T.prototype.revBin=function(a,g,u){if(a===0||a===u-1)return a;for(var d=0,x=0;x<g;x++)d|=(a&1)<<g-x-1,a>>=1;return d},T.prototype.permute=function(a,g,u,d,x,A){for(var N=0;N<A;N++)d[N]=g[a[N]],x[N]=u[a[N]]},T.prototype.transform=function(a,g,u,d,x,A){this.permute(A,a,g,u,d,x);for(var N=1;N<x;N<<=1)for(var S=N<<1,c=Math.cos(2*Math.PI/S),_=Math.sin(2*Math.PI/S),C=0;C<x;C+=S)for(var O=c,D=_,B=0;B<N;B++){var z=u[C+B],G=d[C+B],te=u[C+B+N],$=d[C+B+N],q=O*te-D*$;$=O*$+D*te,te=q,u[C+B]=z+te,d[C+B]=G+$,u[C+B+N]=z-te,d[C+B+N]=G-$,B!==S&&(q=c*O-_*D,D=c*D+_*O,O=q)}},T.prototype.guessLen13b=function(a,g){var u=Math.max(g,a)|1,d=u&1,x=0;for(u=u/2|0;u;u=u>>>1)x++;return 1<<x+1+d},T.prototype.conjugate=function(a,g,u){if(!(u<=1))for(var d=0;d<u/2;d++){var x=a[d];a[d]=a[u-d-1],a[u-d-1]=x,x=g[d],g[d]=-g[u-d-1],g[u-d-1]=-x}},T.prototype.normalize13b=function(a,g){for(var u=0,d=0;d<g/2;d++){var x=Math.round(a[2*d+1]/g)*8192+Math.round(a[2*d]/g)+u;a[d]=x&67108863,x<67108864?u=0:u=x/67108864|0}return a},T.prototype.convert13b=function(a,g,u,d){for(var x=0,A=0;A<g;A++)x=x+(a[A]|0),u[2*A]=x&8191,x=x>>>13,u[2*A+1]=x&8191,x=x>>>13;for(A=2*g;A<d;++A)u[A]=0;s(x===0),s((x&-8192)===0)},T.prototype.stub=function(a){for(var g=Array(a),u=0;u<a;u++)g[u]=0;return g},T.prototype.mulp=function(a,g,u){var d=2*this.guessLen13b(a.length,g.length),x=this.makeRBT(d),A=this.stub(d),N=Array(d),S=Array(d),c=Array(d),_=Array(d),C=Array(d),O=Array(d),D=u.words;D.length=d,this.convert13b(a.words,a.length,N,d),this.convert13b(g.words,g.length,_,d),this.transform(N,A,S,c,d,x),this.transform(_,A,C,O,d,x);for(var B=0;B<d;B++){var z=S[B]*C[B]-c[B]*O[B];c[B]=S[B]*O[B]+c[B]*C[B],S[B]=z}return this.conjugate(S,c,d),this.transform(S,c,D,A,d,x),this.conjugate(D,A,d),this.normalize13b(D,d),u.negative=a.negative^g.negative,u.length=a.length+g.length,u.strip()},n.prototype.mul=function(a){var g=new n(null);return g.words=Array(this.length+a.length),this.mulTo(a,g)},n.prototype.mulf=function(a){var g=new n(null);return g.words=Array(this.length+a.length),I(this,a,g)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){s(typeof a=="number"),s(a<67108864);for(var g=0,u=0;u<this.length;u++){var d=(this.words[u]|0)*a,x=(d&67108863)+(g&67108863);g>>=26,g+=d/67108864|0,g+=x>>>26,this.words[u]=x&67108863}return g!==0&&(this.words[u]=g,this.length++),this.length=a===0?1:this.length,this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var g=y(a);if(g.length===0)return new n(1);for(var u=this,d=0;d<g.length&&g[d]===0;d++,u=u.sqr());if(++d<g.length)for(var x=u.sqr();d<g.length;d++,x=x.sqr())g[d]!==0&&(u=u.mul(x));return u},n.prototype.iushln=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=67108863>>>26-g<<26-g,x;if(g!==0){var A=0;for(x=0;x<this.length;x++){var N=this.words[x]&d,S=(this.words[x]|0)-N<<g;this.words[x]=S|A,A=N>>>26-g}A&&(this.words[x]=A,this.length++)}if(u!==0){for(x=this.length-1;x>=0;x--)this.words[x+u]=this.words[x];for(x=0;x<u;x++)this.words[x]=0;this.length+=u}return this.strip()},n.prototype.ishln=function(a){return s(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,g,u){s(typeof a=="number"&&a>=0);var d;g?d=(g-g%26)/26:d=0;var x=a%26,A=Math.min((a-x)/26,this.length),N=67108863^67108863>>>x<<x,S=u;if(d-=A,d=Math.max(0,d),S){for(var c=0;c<A;c++)S.words[c]=this.words[c];S.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var _=0;for(c=this.length-1;c>=0&&(_!==0||c>=d);c--){var C=this.words[c]|0;this.words[c]=_<<26-x|C>>>x,_=C&N}return S&&_!==0&&(S.words[S.length++]=_),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(a,g,u){return s(this.negative===0),this.iushrn(a,g,u)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return!1;var x=this.words[u];return!!(x&d)},n.prototype.imaskn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(g!==0&&u++,this.length=Math.min(u,this.length),g!==0){var d=67108863^67108863>>>g<<g;this.words[this.length-1]&=d}return this.strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return s(typeof a=="number"),s(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},n.prototype.isubn=function(a){if(s(typeof a=="number"),s(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this.strip()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,g,u){var d=a.length+u,x;this._expand(d);var A,N=0;for(x=0;x<a.length;x++){A=(this.words[x+u]|0)+N;var S=(a.words[x]|0)*g;A-=S&67108863,N=(A>>26)-(S/67108864|0),this.words[x+u]=A&67108863}for(;x<this.length-u;x++)A=(this.words[x+u]|0)+N,N=A>>26,this.words[x+u]=A&67108863;if(N===0)return this.strip();for(s(N===-1),N=0,x=0;x<this.length;x++)A=-(this.words[x]|0)+N,N=A>>26,this.words[x]=A&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(a,g){var u=this.length-a.length,d=this.clone(),x=a,A=x.words[x.length-1]|0,N=this._countBits(A);u=26-N,u!==0&&(x=x.ushln(u),d.iushln(u),A=x.words[x.length-1]|0);var S=d.length-x.length,c;if(g!=="mod"){c=new n(null),c.length=S+1,c.words=Array(c.length);for(var _=0;_<c.length;_++)c.words[_]=0}var C=d.clone()._ishlnsubmul(x,1,S);C.negative===0&&(d=C,c&&(c.words[S]=1));for(var O=S-1;O>=0;O--){var D=(d.words[x.length+O]|0)*67108864+(d.words[x.length+O-1]|0);for(D=Math.min(D/A|0,67108863),d._ishlnsubmul(x,D,O);d.negative!==0;)D--,d.negative=0,d._ishlnsubmul(x,1,O),!d.isZero()&&(d.negative^=1);c&&(c.words[O]=D)}return c&&c.strip(),d.strip(),g!=="div"&&u!==0&&d.iushrn(u),{div:c||null,mod:d}},n.prototype.divmod=function(a,g,u){if(s(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var d,x,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,g),g!=="mod"&&(d=A.div.neg()),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.iadd(a)),{div:d,mod:x}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),g),g!=="mod"&&(d=A.div.neg()),{div:d,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),g),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.isub(a)),{div:A.div,mod:x}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?g==="div"?{div:this.divn(a.words[0]),mod:null}:g==="mod"?{div:null,mod:new n(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modn(a.words[0]))}:this._wordDiv(a,g)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var g=this.divmod(a);if(g.mod.isZero())return g.div;var u=g.div.negative!==0?g.mod.isub(a):g.mod,d=a.ushrn(1),x=a.andln(1),A=u.cmp(d);return A<0||x===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},n.prototype.modn=function(a){s(a<=67108863);for(var g=67108864%a,u=0,d=this.length-1;d>=0;d--)u=(g*u+(this.words[d]|0))%a;return u},n.prototype.idivn=function(a){s(a<=67108863);for(var g=0,u=this.length-1;u>=0;u--){var d=(this.words[u]|0)+g*67108864;this.words[u]=d/a|0,g=d%a}return this.strip()},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=new n(0),N=new n(1),S=0;g.isEven()&&u.isEven();)g.iushrn(1),u.iushrn(1),++S;for(var c=u.clone(),_=g.clone();!g.isZero();){for(var C=0,O=1;(g.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(g.iushrn(C);C-- >0;)(d.isOdd()||x.isOdd())&&(d.iadd(c),x.isub(_)),d.iushrn(1),x.iushrn(1);for(var D=0,B=1;(u.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(u.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(c),N.isub(_)),A.iushrn(1),N.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(A),x.isub(N)):(u.isub(g),A.isub(d),N.isub(x))}return{a:A,b:N,gcd:u.iushln(S)}},n.prototype._invmp=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=u.clone();g.cmpn(1)>0&&u.cmpn(1)>0;){for(var N=0,S=1;(g.words[0]&S)===0&&N<26;++N,S<<=1);if(N>0)for(g.iushrn(N);N-- >0;)d.isOdd()&&d.iadd(A),d.iushrn(1);for(var c=0,_=1;(u.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(u.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(x)):(u.isub(g),x.isub(d))}var C;return g.cmpn(1)===0?C=d:C=x,C.cmpn(0)<0&&C.iadd(a),C},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var g=this.clone(),u=a.clone();g.negative=0,u.negative=0;for(var d=0;g.isEven()&&u.isEven();d++)g.iushrn(1),u.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;u.isEven();)u.iushrn(1);var x=g.cmp(u);if(x<0){var A=g;g=u,u=A}else if(x===0||u.cmpn(1)===0)break;g.isub(u)}while(!0);return u.iushln(d)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){s(typeof a=="number");var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return this._expand(u+1),this.words[u]|=d,this;for(var x=d,A=u;x!==0&&A<this.length;A++){var N=this.words[A]|0;N+=x,x=N>>>26,N&=67108863,this.words[A]=N}return x!==0&&(this.words[A]=x,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var g=a<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this.strip();var u;if(this.length>1)u=1;else{g&&(a=-a),s(a<=67108863,"Number is too big");var d=this.words[0]|0;u=d===a?0:d<a?-1:1}return this.negative!==0?-u|0:u},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var g=this.ucmp(a);return this.negative!==0?-g|0:g},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var g=0,u=this.length-1;u>=0;u--){var d=this.words[u]|0,x=a.words[u]|0;if(d!==x){d<x?g=-1:d>x&&(g=1);break}}return g},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new F(a)},n.prototype.toRed=function(a){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return s(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return s(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var P={k256:null,p224:null,p192:null,p25519:null};function j(a,g){this.name=a,this.p=new n(g,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(j,"c"),j.prototype._tmp=function(){var a=new n(null);return a.words=Array(Math.ceil(this.n/13)),a},j.prototype.ireduce=function(a){var g=a,u;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),u=g.bitLength();while(u>this.n);var d=u<this.n?-1:g.ucmp(this.p);return d===0?(g.words[0]=0,g.length=1):d>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(a,g){a.iushrn(this.n,0,g)},j.prototype.imulK=function(a){return a.imul(this.k)};function L(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,"l"),f(L,j),L.prototype.split=function(a,g){for(var u=4194303,d=Math.min(a.length,9),x=0;x<d;x++)g.words[x]=a.words[x];if(g.length=d,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(g.words[g.length++]=A&u,x=10;x<a.length;x++){var N=a.words[x]|0;a.words[x-10]=(N&u)<<4|A>>>22,A=N}A>>>=22,a.words[x-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},L.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var g=0,u=0;u<a.length;u++){var d=a.words[u]|0;g+=d*977,a.words[u]=g&67108863,g=d*64+(g/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(U,"B"),f(U,j);function Z(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(Z,"s"),f(Z,j);function ne(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ne,"K8"),f(ne,j),ne.prototype.imulK=function(a){for(var g=0,u=0;u<a.length;u++){var d=(a.words[u]|0)*19+g,x=d&67108863;d>>>=26,a.words[u]=x,g=d}return g!==0&&(a.words[a.length++]=g),a},n._prime=function(a){if(P[a])return P[a];var g;if(a==="k256")g=new L;else if(a==="p224")g=new U;else if(a==="p192")g=new Z;else if(a==="p25519")g=new ne;else throw Error("Unknown prime "+a);return P[a]=g,g};function F(a){if(typeof a=="string"){var g=n._prime(a);this.m=g.p,this.prime=g}else s(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}o(F,"p"),F.prototype._verify1=function(a){s(a.negative===0,"red works only with positives"),s(a.red,"red works only with red numbers")},F.prototype._verify2=function(a,g){s((a.negative|g.negative)===0,"red works only with positives"),s(a.red&&a.red===g.red,"red works only with red numbers")},F.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},F.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},F.prototype.add=function(a,g){this._verify2(a,g);var u=a.add(g);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},F.prototype.iadd=function(a,g){this._verify2(a,g);var u=a.iadd(g);return u.cmp(this.m)>=0&&u.isub(this.m),u},F.prototype.sub=function(a,g){this._verify2(a,g);var u=a.sub(g);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},F.prototype.isub=function(a,g){this._verify2(a,g);var u=a.isub(g);return u.cmpn(0)<0&&u.iadd(this.m),u},F.prototype.shl=function(a,g){return this._verify1(a),this.imod(a.ushln(g))},F.prototype.imul=function(a,g){return this._verify2(a,g),this.imod(a.imul(g))},F.prototype.mul=function(a,g){return this._verify2(a,g),this.imod(a.mul(g))},F.prototype.isqr=function(a){return this.imul(a,a.clone())},F.prototype.sqr=function(a){return this.mul(a,a)},F.prototype.sqrt=function(a){if(a.isZero())return a.clone();var g=this.m.andln(3);if(s(g%2===1),g===3){var u=this.m.add(new n(1)).iushrn(2);return this.pow(a,u)}for(var d=this.m.subn(1),x=0;!d.isZero()&&d.andln(1)===0;)x++,d.iushrn(1);s(!d.isZero());var A=new n(1).toRed(this),N=A.redNeg(),S=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,S).cmp(N)!==0;)c.redIAdd(N);for(var _=this.pow(c,d),C=this.pow(a,d.addn(1).iushrn(1)),O=this.pow(a,d),D=x;O.cmp(A)!==0;){for(var B=O,z=0;B.cmp(A)!==0;z++)B=B.redSqr();s(z<D);var G=this.pow(_,new n(1).iushln(D-z-1));C=C.redMul(G),_=G.redSqr(),O=O.redMul(_),D=z}return C},F.prototype.invm=function(a){var g=a._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},F.prototype.pow=function(a,g){if(g.isZero())return new n(1).toRed(this);if(g.cmpn(1)===0)return a.clone();var u=4,d=Array(1<<u);d[0]=new n(1).toRed(this),d[1]=a;for(var x=2;x<d.length;x++)d[x]=this.mul(d[x-1],a);var A=d[0],N=0,S=0,c=g.bitLength()%26;for(c===0&&(c=26),x=g.length-1;x>=0;x--){for(var _=g.words[x],C=c-1;C>=0;C--){var O=_>>C&1;if(A!==d[0]&&(A=this.sqr(A)),O===0&&N===0){S=0;continue}N<<=1,N|=O,S++,!(S!==u&&(x!==0||C!==0))&&(A=this.mul(A,d[N]),S=0,N=0)}c=26}return A},F.prototype.convertTo=function(a){var g=a.umod(this.m);return g===a?g.clone():g},F.prototype.convertFrom=function(a){var g=a.clone();return g.red=null,g},n.mont=function(a){return new Y(a)};function Y(a){F.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"D"),f(Y,F),Y.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},Y.prototype.convertFrom=function(a){var g=this.imod(a.mul(this.rinv));return g.red=null,g},Y.prototype.imul=function(a,g){if(a.isZero()||g.isZero())return a.words[0]=0,a.length=1,a;var u=a.imul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.mul=function(a,g){if(a.isZero()||g.isZero())return new n(0)._forceRed(this);var u=a.mul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.invm=function(a){var g=this.imod(a._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(typeof e>"u"||e,t)}),Bi=nt((t,e)=>{e.exports=r;function r(i,s){if(!i)throw Error(s||"Assertion failed")}o(r,"K"),r.equal=function(i,s,f){if(i!=s)throw Error(f||"Assertion failed: "+i+" != "+s)}}),Lc=nt(t=>{var e=t;function r(f,n){if(Array.isArray(f))return f.slice();if(!f)return[];var v=[];if(typeof f!="string"){for(var b=0;b<f.length;b++)v[b]=f[b]|0;return v}if(n==="hex"){f=f.replace(/[^a-z0-9]+/ig,""),f.length%2!==0&&(f="0"+f);for(var b=0;b<f.length;b+=2)v.push(parseInt(f[b]+f[b+1],16))}else for(var b=0;b<f.length;b++){var h=f.charCodeAt(b),m=h>>8,l=h&255;m?v.push(m,l):v.push(l)}return v}o(r,"K"),e.toArray=r;function i(f){return f.length===1?"0"+f:f}o(i,"_"),e.zero2=i;function s(f){for(var n="",v=0;v<f.length;v++)n+=i(f[v].toString(16));return n}o(s,"P"),e.toHex=s,e.encode=function(f,n){return n==="hex"?s(f):f}}),Lr=nt(t=>{var e=t,r=yi(),i=Bi(),s=Lc();e.assert=i,e.toArray=s.toArray,e.zero2=s.zero2,e.toHex=s.toHex,e.encode=s.encode;function f(m,l,w){var p=Array(Math.max(m.bitLength(),w)+1),y;for(y=0;y<p.length;y+=1)p[y]=0;var M=1<<l+1,E=m.clone();for(y=0;y<p.length;y++){var R,I=E.andln(M-1);E.isOdd()?(I>(M>>1)-1?R=(M>>1)-I:R=I,E.isubn(R)):R=0,p[y]=R,E.iushrn(1)}return p}o(f,"O"),e.getNAF=f;function n(m,l){var w=[[],[]];m=m.clone(),l=l.clone();for(var p=0,y=0,M;m.cmpn(-p)>0||l.cmpn(-y)>0;){var E=m.andln(3)+p&3,R=l.andln(3)+y&3;E===3&&(E=-1),R===3&&(R=-1);var I;(E&1)===0?I=0:(M=m.andln(7)+p&7,(M===3||M===5)&&R===2?I=-E:I=E),w[0].push(I);var T;(R&1)===0?T=0:(M=l.andln(7)+y&7,(M===3||M===5)&&E===2?T=-R:T=R),w[1].push(T),2*p===I+1&&(p=1-p),2*y===T+1&&(y=1-y),m.iushrn(1),l.iushrn(1)}return w}o(n,"Y"),e.getJSF=n;function v(m,l,w){var p="_"+l;m.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=w.call(this)}}o(v,"z"),e.cachedProperty=v;function b(m){return typeof m=="string"?e.toArray(m,"hex"):m}o(b,"v"),e.parseBytes=b;function h(m){return new r(m,"hex","le")}o(h,"w"),e.intFromLE=h}),Dc=nt((t,e)=>{var r;e.exports=function(f){return r||(r=new i(null)),r.generate(f)};function i(f){this.rand=f}if(o(i,"_"),e.exports.Rand=i,i.prototype.generate=function(f){return this._rand(f)},i.prototype._rand=function(f){if(this.rand.getBytes)return this.rand.getBytes(f);for(var n=new Uint8Array(f),v=0;v<n.length;v++)n[v]=this.rand.getByte();return n},typeof self=="object")self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(f){var n=new Uint8Array(f);return self.crypto.getRandomValues(n),n}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(f){var n=new Uint8Array(f);return self.msCrypto.getRandomValues(n),n}:typeof window=="object"&&(i.prototype._rand=function(){throw Error("Not implemented yet")});else try{if(s=(qt(),bt(Jt)),typeof s.randomBytes!="function")throw Error("Not supported");i.prototype._rand=function(f){return s.randomBytes(f)}}catch{}var s}),fa=nt((t,e)=>{var r=yi(),i=Lr(),s=i.getNAF,f=i.getJSF,n=i.assert;function v(h,m){this.type=h,this.p=new r(m.p,16),this.red=m.prime?r.red(m.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=m.n&&new r(m.n,16),this.g=m.g&&this.pointFromJSON(m.g,m.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var l=this.n&&this.p.div(this.n);!l||l.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}o(v,"z"),e.exports=v,v.prototype.point=function(){throw Error("Not implemented")},v.prototype.validate=function(){throw Error("Not implemented")},v.prototype._fixedNafMul=function(h,m){n(h.precomputed);var l=h._getDoubles(),w=s(m,1,this._bitLength),p=(1<<l.step+1)-(l.step%2===0?2:1);p/=3;var y=[],M,E;for(M=0;M<w.length;M+=l.step){E=0;for(var R=M+l.step-1;R>=M;R--)E=(E<<1)+w[R];y.push(E)}for(var I=this.jpoint(null,null,null),T=this.jpoint(null,null,null),P=p;P>0;P--){for(M=0;M<y.length;M++)E=y[M],E===P?T=T.mixedAdd(l.points[M]):E===-P&&(T=T.mixedAdd(l.points[M].neg()));I=I.add(T)}return I.toP()},v.prototype._wnafMul=function(h,m){var l=4,w=h._getNAFPoints(l);l=w.wnd;for(var p=w.points,y=s(m,l,this._bitLength),M=this.jpoint(null,null,null),E=y.length-1;E>=0;E--){for(var R=0;E>=0&&y[E]===0;E--)R++;if(E>=0&&R++,M=M.dblp(R),E<0)break;var I=y[E];n(I!==0),h.type==="affine"?I>0?M=M.mixedAdd(p[I-1>>1]):M=M.mixedAdd(p[-I-1>>1].neg()):I>0?M=M.add(p[I-1>>1]):M=M.add(p[-I-1>>1].neg())}return h.type==="affine"?M.toP():M},v.prototype._wnafMulAdd=function(h,m,l,w,p){var y=this._wnafT1,M=this._wnafT2,E=this._wnafT3,R=0,I,T,P;for(I=0;I<w;I++){P=m[I];var j=P._getNAFPoints(h);y[I]=j.wnd,M[I]=j.points}for(I=w-1;I>=1;I-=2){var L=I-1,U=I;if(y[L]!==1||y[U]!==1){E[L]=s(l[L],y[L],this._bitLength),E[U]=s(l[U],y[U],this._bitLength),R=Math.max(E[L].length,R),R=Math.max(E[U].length,R);continue}var Z=[m[L],null,null,m[U]];m[L].y.cmp(m[U].y)===0?(Z[1]=m[L].add(m[U]),Z[2]=m[L].toJ().mixedAdd(m[U].neg())):m[L].y.cmp(m[U].y.redNeg())===0?(Z[1]=m[L].toJ().mixedAdd(m[U]),Z[2]=m[L].add(m[U].neg())):(Z[1]=m[L].toJ().mixedAdd(m[U]),Z[2]=m[L].toJ().mixedAdd(m[U].neg()));var ne=[-3,-1,-5,-7,0,7,5,1,3],F=f(l[L],l[U]);for(R=Math.max(F[0].length,R),E[L]=Array(R),E[U]=Array(R),T=0;T<R;T++){var Y=F[0][T]|0,a=F[1][T]|0;E[L][T]=ne[(Y+1)*3+(a+1)],E[U][T]=0,M[L]=Z}}var g=this.jpoint(null,null,null),u=this._wnafT4;for(I=R;I>=0;I--){for(var d=0;I>=0;){var x=!0;for(T=0;T<w;T++)u[T]=E[T][I]|0,u[T]!==0&&(x=!1);if(!x)break;d++,I--}if(I>=0&&d++,g=g.dblp(d),I<0)break;for(T=0;T<w;T++){var A=u[T];A!==0&&(A>0?P=M[T][A-1>>1]:A<0&&(P=M[T][-A-1>>1].neg()),P.type==="affine"?g=g.mixedAdd(P):g=g.add(P))}}for(I=0;I<w;I++)M[I]=null;return p?g:g.toP()};function b(h,m){this.curve=h,this.type=m,this.precomputed=null}o(b,"v"),v.BasePoint=b,b.prototype.eq=function(){throw Error("Not implemented")},b.prototype.validate=function(){return this.curve.validate(this)},v.prototype.decodePoint=function(h,m){h=i.toArray(h,m);var l=this.p.byteLength();if((h[0]===4||h[0]===6||h[0]===7)&&h.length-1===2*l){h[0]===6?n(h[h.length-1]%2===0):h[0]===7&&n(h[h.length-1]%2===1);var w=this.point(h.slice(1,1+l),h.slice(1+l,1+2*l));return w}else if((h[0]===2||h[0]===3)&&h.length-1===l)return this.pointFromX(h.slice(1,1+l),h[0]===3);throw Error("Unknown point format")},b.prototype.encodeCompressed=function(h){return this.encode(h,!0)},b.prototype._encode=function(h){var m=this.curve.p.byteLength(),l=this.getX().toArray("be",m);return h?[this.getY().isEven()?2:3].concat(l):[4].concat(l,this.getY().toArray("be",m))},b.prototype.encode=function(h,m){return i.encode(this._encode(m),h)},b.prototype.precompute=function(h){if(this.precomputed)return this;var m={doubles:null,naf:null,beta:null};return m.naf=this._getNAFPoints(8),m.doubles=this._getDoubles(4,h),m.beta=this._getBeta(),this.precomputed=m,this},b.prototype._hasDoubles=function(h){if(!this.precomputed)return!1;var m=this.precomputed.doubles;return m?m.points.length>=Math.ceil((h.bitLength()+1)/m.step):!1},b.prototype._getDoubles=function(h,m){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var l=[this],w=this,p=0;p<m;p+=h){for(var y=0;y<h;y++)w=w.dbl();l.push(w)}return{step:h,points:l}},b.prototype._getNAFPoints=function(h){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var m=[this],l=(1<<h)-1,w=l===1?null:this.dbl(),p=1;p<l;p++)m[p]=m[p-1].add(w);return{wnd:h,points:m}},b.prototype._getBeta=function(){return null},b.prototype.dblp=function(h){for(var m=this,l=0;l<h;l++)m=m.dbl();return m}}),N0=nt((t,e)=>{typeof Object.create=="function"?e.exports=function(r,i){i&&(r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(r,i){if(i){r.super_=i;var s=o(function(){},"O");s.prototype=i.prototype,r.prototype=new s,r.prototype.constructor=r}}}),Or=nt((t,e)=>{try{if(r=(xy(),bt(Gh)),typeof r.inherits!="function")throw"";e.exports=r.inherits}catch{e.exports=N0()}var r}),C0=nt((t,e)=>{var r=Lr(),i=yi(),s=Or(),f=fa(),n=r.assert;function v(m){f.call(this,"short",m),this.a=new i(m.a,16).toRed(this.red),this.b=new i(m.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(m),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}o(v,"z"),s(v,f),e.exports=v,v.prototype._getEndomorphism=function(m){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var l,w;if(m.beta)l=new i(m.beta,16).toRed(this.red);else{var p=this._getEndoRoots(this.p);l=p[0].cmp(p[1])<0?p[0]:p[1],l=l.toRed(this.red)}if(m.lambda)w=new i(m.lambda,16);else{var y=this._getEndoRoots(this.n);this.g.mul(y[0]).x.cmp(this.g.x.redMul(l))===0?w=y[0]:(w=y[1],n(this.g.mul(w).x.cmp(this.g.x.redMul(l))===0))}var M;return m.basis?M=m.basis.map(function(E){return{a:new i(E.a,16),b:new i(E.b,16)}}):M=this._getEndoBasis(w),{beta:l,lambda:w,basis:M}}},v.prototype._getEndoRoots=function(m){var l=m===this.p?this.red:i.mont(m),w=new i(2).toRed(l).redInvm(),p=w.redNeg(),y=new i(3).toRed(l).redNeg().redSqrt().redMul(w),M=p.redAdd(y).fromRed(),E=p.redSub(y).fromRed();return[M,E]},v.prototype._getEndoBasis=function(m){for(var l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),w=m,p=this.n.clone(),y=new i(1),M=new i(0),E=new i(0),R=new i(1),I,T,P,j,L,U,Z,ne=0,F,Y;w.cmpn(0)!==0;){var a=p.div(w);F=p.sub(a.mul(w)),Y=E.sub(a.mul(y));var g=R.sub(a.mul(M));if(!P&&F.cmp(l)<0)I=Z.neg(),T=y,P=F.neg(),j=Y;else if(P&&++ne===2)break;Z=F,p=w,w=F,E=y,y=Y,R=M,M=g}L=F.neg(),U=Y;var u=P.sqr().add(j.sqr()),d=L.sqr().add(U.sqr());return d.cmp(u)>=0&&(L=I,U=T),P.negative&&(P=P.neg(),j=j.neg()),L.negative&&(L=L.neg(),U=U.neg()),[{a:P,b:j},{a:L,b:U}]},v.prototype._endoSplit=function(m){var l=this.endo.basis,w=l[0],p=l[1],y=p.b.mul(m).divRound(this.n),M=w.b.neg().mul(m).divRound(this.n),E=y.mul(w.a),R=M.mul(p.a),I=y.mul(w.b),T=M.mul(p.b),P=m.sub(E).sub(R),j=I.add(T).neg();return{k1:P,k2:j}},v.prototype.pointFromX=function(m,l){m=new i(m,16),!m.red&&(m=m.toRed(this.red));var w=m.redSqr().redMul(m).redIAdd(m.redMul(this.a)).redIAdd(this.b),p=w.redSqrt();if(p.redSqr().redSub(w).cmp(this.zero)!==0)throw Error("invalid point");var y=p.fromRed().isOdd();return(l&&!y||!l&&y)&&(p=p.redNeg()),this.point(m,p)},v.prototype.validate=function(m){if(m.inf)return!0;var{x:l,y:w}=m,p=this.a.redMul(l),y=l.redSqr().redMul(l).redIAdd(p).redIAdd(this.b);return w.redSqr().redISub(y).cmpn(0)===0},v.prototype._endoWnafMulAdd=function(m,l,w){for(var p=this._endoWnafT1,y=this._endoWnafT2,M=0;M<m.length;M++){var E=this._endoSplit(l[M]),R=m[M],I=R._getBeta();E.k1.negative&&(E.k1.ineg(),R=R.neg(!0)),E.k2.negative&&(E.k2.ineg(),I=I.neg(!0)),p[M*2]=R,p[M*2+1]=I,y[M*2]=E.k1,y[M*2+1]=E.k2}for(var T=this._wnafMulAdd(1,p,y,M*2,w),P=0;P<M*2;P++)p[P]=null,y[P]=null;return T};function b(m,l,w,p){f.BasePoint.call(this,m,"affine"),l===null&&w===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(l,16),this.y=new i(w,16),p&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}o(b,"v"),s(b,f.BasePoint),v.prototype.point=function(m,l,w){return new b(this,m,l,w)},v.prototype.pointFromJSON=function(m,l){return b.fromJSON(this,m,l)},b.prototype._getBeta=function(){if(this.curve.endo){var m=this.precomputed;if(m&&m.beta)return m.beta;var l=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(m){var w=this.curve,p=o(function(y){return w.point(y.x.redMul(w.endo.beta),y.y)},"E");m.beta=l,l.precomputed={beta:null,naf:m.naf&&{wnd:m.naf.wnd,points:m.naf.points.map(p)},doubles:m.doubles&&{step:m.doubles.step,points:m.doubles.points.map(p)}}}return l}},b.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},b.fromJSON=function(m,l,w){typeof l=="string"&&(l=JSON.parse(l));var p=m.point(l[0],l[1],w);if(!l[2])return p;function y(E){return m.point(E[0],E[1],w)}o(y,"I");var M=l[2];return p.precomputed={beta:null,doubles:M.doubles&&{step:M.doubles.step,points:[p].concat(M.doubles.points.map(y))},naf:M.naf&&{wnd:M.naf.wnd,points:[p].concat(M.naf.points.map(y))}},p},b.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},b.prototype.isInfinity=function(){return this.inf},b.prototype.add=function(m){if(this.inf)return m;if(m.inf)return this;if(this.eq(m))return this.dbl();if(this.neg().eq(m))return this.curve.point(null,null);if(this.x.cmp(m.x)===0)return this.curve.point(null,null);var l=this.y.redSub(m.y);l.cmpn(0)!==0&&(l=l.redMul(this.x.redSub(m.x).redInvm()));var w=l.redSqr().redISub(this.x).redISub(m.x),p=l.redMul(this.x.redSub(w)).redISub(this.y);return this.curve.point(w,p)},b.prototype.dbl=function(){if(this.inf)return this;var m=this.y.redAdd(this.y);if(m.cmpn(0)===0)return this.curve.point(null,null);var l=this.curve.a,w=this.x.redSqr(),p=m.redInvm(),y=w.redAdd(w).redIAdd(w).redIAdd(l).redMul(p),M=y.redSqr().redISub(this.x.redAdd(this.x)),E=y.redMul(this.x.redSub(M)).redISub(this.y);return this.curve.point(M,E)},b.prototype.getX=function(){return this.x.fromRed()},b.prototype.getY=function(){return this.y.fromRed()},b.prototype.mul=function(m){return m=new i(m,16),this.isInfinity()?this:this._hasDoubles(m)?this.curve._fixedNafMul(this,m):this.curve.endo?this.curve._endoWnafMulAdd([this],[m]):this.curve._wnafMul(this,m)},b.prototype.mulAdd=function(m,l,w){var p=[this,l],y=[m,w];return this.curve.endo?this.curve._endoWnafMulAdd(p,y):this.curve._wnafMulAdd(1,p,y,2)},b.prototype.jmulAdd=function(m,l,w){var p=[this,l],y=[m,w];return this.curve.endo?this.curve._endoWnafMulAdd(p,y,!0):this.curve._wnafMulAdd(1,p,y,2,!0)},b.prototype.eq=function(m){return this===m||this.inf===m.inf&&(this.inf||this.x.cmp(m.x)===0&&this.y.cmp(m.y)===0)},b.prototype.neg=function(m){if(this.inf)return this;var l=this.curve.point(this.x,this.y.redNeg());if(m&&this.precomputed){var w=this.precomputed,p=o(function(y){return y.neg()},"E");l.precomputed={naf:w.naf&&{wnd:w.naf.wnd,points:w.naf.points.map(p)},doubles:w.doubles&&{step:w.doubles.step,points:w.doubles.points.map(p)}}}return l},b.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var m=this.curve.jpoint(this.x,this.y,this.curve.one);return m};function h(m,l,w,p){f.BasePoint.call(this,m,"jacobian"),l===null&&w===null&&p===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(l,16),this.y=new i(w,16),this.z=new i(p,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(h,"w"),s(h,f.BasePoint),v.prototype.jpoint=function(m,l,w){return new h(this,m,l,w)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var m=this.z.redInvm(),l=m.redSqr(),w=this.x.redMul(l),p=this.y.redMul(l).redMul(m);return this.curve.point(w,p)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(m){if(this.isInfinity())return m;if(m.isInfinity())return this;var l=m.z.redSqr(),w=this.z.redSqr(),p=this.x.redMul(l),y=m.x.redMul(w),M=this.y.redMul(l.redMul(m.z)),E=m.y.redMul(w.redMul(this.z)),R=p.redSub(y),I=M.redSub(E);if(R.cmpn(0)===0)return I.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var T=R.redSqr(),P=T.redMul(R),j=p.redMul(T),L=I.redSqr().redIAdd(P).redISub(j).redISub(j),U=I.redMul(j.redISub(L)).redISub(M.redMul(P)),Z=this.z.redMul(m.z).redMul(R);return this.curve.jpoint(L,U,Z)},h.prototype.mixedAdd=function(m){if(this.isInfinity())return m.toJ();if(m.isInfinity())return this;var l=this.z.redSqr(),w=this.x,p=m.x.redMul(l),y=this.y,M=m.y.redMul(l).redMul(this.z),E=w.redSub(p),R=y.redSub(M);if(E.cmpn(0)===0)return R.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var I=E.redSqr(),T=I.redMul(E),P=w.redMul(I),j=R.redSqr().redIAdd(T).redISub(P).redISub(P),L=R.redMul(P.redISub(j)).redISub(y.redMul(T)),U=this.z.redMul(E);return this.curve.jpoint(j,L,U)},h.prototype.dblp=function(m){if(m===0)return this;if(this.isInfinity())return this;if(!m)return this.dbl();var l;if(this.curve.zeroA||this.curve.threeA){var w=this;for(l=0;l<m;l++)w=w.dbl();return w}var p=this.curve.a,y=this.curve.tinv,M=this.x,E=this.y,R=this.z,I=R.redSqr().redSqr(),T=E.redAdd(E);for(l=0;l<m;l++){var P=M.redSqr(),j=T.redSqr(),L=j.redSqr(),U=P.redAdd(P).redIAdd(P).redIAdd(p.redMul(I)),Z=M.redMul(j),ne=U.redSqr().redISub(Z.redAdd(Z)),F=Z.redISub(ne),Y=U.redMul(F);Y=Y.redIAdd(Y).redISub(L);var a=T.redMul(R);l+1<m&&(I=I.redMul(L)),M=ne,R=a,T=Y}return this.curve.jpoint(M,T.redMul(y),R)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var m,l,w;if(this.zOne){var p=this.x.redSqr(),y=this.y.redSqr(),M=y.redSqr(),E=this.x.redAdd(y).redSqr().redISub(p).redISub(M);E=E.redIAdd(E);var R=p.redAdd(p).redIAdd(p),I=R.redSqr().redISub(E).redISub(E),T=M.redIAdd(M);T=T.redIAdd(T),T=T.redIAdd(T),m=I,l=R.redMul(E.redISub(I)).redISub(T),w=this.y.redAdd(this.y)}else{var P=this.x.redSqr(),j=this.y.redSqr(),L=j.redSqr(),U=this.x.redAdd(j).redSqr().redISub(P).redISub(L);U=U.redIAdd(U);var Z=P.redAdd(P).redIAdd(P),ne=Z.redSqr(),F=L.redIAdd(L);F=F.redIAdd(F),F=F.redIAdd(F),m=ne.redISub(U).redISub(U),l=Z.redMul(U.redISub(m)).redISub(F),w=this.y.redMul(this.z),w=w.redIAdd(w)}return this.curve.jpoint(m,l,w)},h.prototype._threeDbl=function(){var m,l,w;if(this.zOne){var p=this.x.redSqr(),y=this.y.redSqr(),M=y.redSqr(),E=this.x.redAdd(y).redSqr().redISub(p).redISub(M);E=E.redIAdd(E);var R=p.redAdd(p).redIAdd(p).redIAdd(this.curve.a),I=R.redSqr().redISub(E).redISub(E);m=I;var T=M.redIAdd(M);T=T.redIAdd(T),T=T.redIAdd(T),l=R.redMul(E.redISub(I)).redISub(T),w=this.y.redAdd(this.y)}else{var P=this.z.redSqr(),j=this.y.redSqr(),L=this.x.redMul(j),U=this.x.redSub(P).redMul(this.x.redAdd(P));U=U.redAdd(U).redIAdd(U);var Z=L.redIAdd(L);Z=Z.redIAdd(Z);var ne=Z.redAdd(Z);m=U.redSqr().redISub(ne),w=this.y.redAdd(this.z).redSqr().redISub(j).redISub(P);var F=j.redSqr();F=F.redIAdd(F),F=F.redIAdd(F),F=F.redIAdd(F),l=U.redMul(Z.redISub(m)).redISub(F)}return this.curve.jpoint(m,l,w)},h.prototype._dbl=function(){var m=this.curve.a,l=this.x,w=this.y,p=this.z,y=p.redSqr().redSqr(),M=l.redSqr(),E=w.redSqr(),R=M.redAdd(M).redIAdd(M).redIAdd(m.redMul(y)),I=l.redAdd(l);I=I.redIAdd(I);var T=I.redMul(E),P=R.redSqr().redISub(T.redAdd(T)),j=T.redISub(P),L=E.redSqr();L=L.redIAdd(L),L=L.redIAdd(L),L=L.redIAdd(L);var U=R.redMul(j).redISub(L),Z=w.redAdd(w).redMul(p);return this.curve.jpoint(P,U,Z)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var m=this.x.redSqr(),l=this.y.redSqr(),w=this.z.redSqr(),p=l.redSqr(),y=m.redAdd(m).redIAdd(m),M=y.redSqr(),E=this.x.redAdd(l).redSqr().redISub(m).redISub(p);E=E.redIAdd(E),E=E.redAdd(E).redIAdd(E),E=E.redISub(M);var R=E.redSqr(),I=p.redIAdd(p);I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var T=y.redIAdd(E).redSqr().redISub(M).redISub(R).redISub(I),P=l.redMul(T);P=P.redIAdd(P),P=P.redIAdd(P);var j=this.x.redMul(R).redISub(P);j=j.redIAdd(j),j=j.redIAdd(j);var L=this.y.redMul(T.redMul(I.redISub(T)).redISub(E.redMul(R)));L=L.redIAdd(L),L=L.redIAdd(L),L=L.redIAdd(L);var U=this.z.redAdd(E).redSqr().redISub(w).redISub(R);return this.curve.jpoint(j,L,U)},h.prototype.mul=function(m,l){return m=new i(m,l),this.curve._wnafMul(this,m)},h.prototype.eq=function(m){if(m.type==="affine")return this.eq(m.toJ());if(this===m)return!0;var l=this.z.redSqr(),w=m.z.redSqr();if(this.x.redMul(w).redISub(m.x.redMul(l)).cmpn(0)!==0)return!1;var p=l.redMul(this.z),y=w.redMul(m.z);return this.y.redMul(y).redISub(m.y.redMul(p)).cmpn(0)===0},h.prototype.eqXToP=function(m){var l=this.z.redSqr(),w=m.toRed(this.curve.red).redMul(l);if(this.x.cmp(w)===0)return!0;for(var p=m.clone(),y=this.curve.redN.redMul(l);;){if(p.iadd(this.curve.n),p.cmp(this.curve.p)>=0)return!1;if(w.redIAdd(y),this.x.cmp(w)===0)return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),R0=nt((t,e)=>{var r=yi(),i=Or(),s=fa(),f=Lr();function n(b){s.call(this,"mont",b),this.a=new r(b.a,16).toRed(this.red),this.b=new r(b.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}o(n,"Y"),i(n,s),e.exports=n,n.prototype.validate=function(b){var h=b.normalize().x,m=h.redSqr(),l=m.redMul(h).redAdd(m.redMul(this.a)).redAdd(h),w=l.redSqrt();return w.redSqr().cmp(l)===0};function v(b,h,m){s.BasePoint.call(this,b,"projective"),h===null&&m===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(h,16),this.z=new r(m,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(v,"z"),i(v,s.BasePoint),n.prototype.decodePoint=function(b,h){return this.point(f.toArray(b,h),1)},n.prototype.point=function(b,h){return new v(this,b,h)},n.prototype.pointFromJSON=function(b){return v.fromJSON(this,b)},v.prototype.precompute=function(){},v.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},v.fromJSON=function(b,h){return new v(b,h[0],h[1]||b.one)},v.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},v.prototype.isInfinity=function(){return this.z.cmpn(0)===0},v.prototype.dbl=function(){var b=this.x.redAdd(this.z),h=b.redSqr(),m=this.x.redSub(this.z),l=m.redSqr(),w=h.redSub(l),p=h.redMul(l),y=w.redMul(l.redAdd(this.curve.a24.redMul(w)));return this.curve.point(p,y)},v.prototype.add=function(){throw Error("Not supported on Montgomery curve")},v.prototype.diffAdd=function(b,h){var m=this.x.redAdd(this.z),l=this.x.redSub(this.z),w=b.x.redAdd(b.z),p=b.x.redSub(b.z),y=p.redMul(m),M=w.redMul(l),E=h.z.redMul(y.redAdd(M).redSqr()),R=h.x.redMul(y.redISub(M).redSqr());return this.curve.point(E,R)},v.prototype.mul=function(b){for(var h=b.clone(),m=this,l=this.curve.point(null,null),w=this,p=[];h.cmpn(0)!==0;h.iushrn(1))p.push(h.andln(1));for(var y=p.length-1;y>=0;y--)p[y]===0?(m=m.diffAdd(l,w),l=l.dbl()):(l=m.diffAdd(l,w),m=m.dbl());return l},v.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},v.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},v.prototype.eq=function(b){return this.getX().cmp(b.getX())===0},v.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},v.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),I0=nt((t,e)=>{var r=Lr(),i=yi(),s=Or(),f=fa(),n=r.assert;function v(h){this.twisted=(h.a|0)!==1,this.mOneA=this.twisted&&(h.a|0)===-1,this.extended=this.mOneA,f.call(this,"edwards",h),this.a=new i(h.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(h.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(h.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),n(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(h.c|0)===1}o(v,"z"),s(v,f),e.exports=v,v.prototype._mulA=function(h){return this.mOneA?h.redNeg():this.a.redMul(h)},v.prototype._mulC=function(h){return this.oneC?h:this.c.redMul(h)},v.prototype.jpoint=function(h,m,l,w){return this.point(h,m,l,w)},v.prototype.pointFromX=function(h,m){h=new i(h,16),!h.red&&(h=h.toRed(this.red));var l=h.redSqr(),w=this.c2.redSub(this.a.redMul(l)),p=this.one.redSub(this.c2.redMul(this.d).redMul(l)),y=w.redMul(p.redInvm()),M=y.redSqrt();if(M.redSqr().redSub(y).cmp(this.zero)!==0)throw Error("invalid point");var E=M.fromRed().isOdd();return(m&&!E||!m&&E)&&(M=M.redNeg()),this.point(h,M)},v.prototype.pointFromY=function(h,m){h=new i(h,16),!h.red&&(h=h.toRed(this.red));var l=h.redSqr(),w=l.redSub(this.c2),p=l.redMul(this.d).redMul(this.c2).redSub(this.a),y=w.redMul(p.redInvm());if(y.cmp(this.zero)===0){if(m)throw Error("invalid point");return this.point(this.zero,h)}var M=y.redSqrt();if(M.redSqr().redSub(y).cmp(this.zero)!==0)throw Error("invalid point");return M.fromRed().isOdd()!==m&&(M=M.redNeg()),this.point(M,h)},v.prototype.validate=function(h){if(h.isInfinity())return!0;h.normalize();var m=h.x.redSqr(),l=h.y.redSqr(),w=m.redMul(this.a).redAdd(l),p=this.c2.redMul(this.one.redAdd(this.d.redMul(m).redMul(l)));return w.cmp(p)===0};function b(h,m,l,w,p){f.BasePoint.call(this,h,"projective"),m===null&&l===null&&w===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(m,16),this.y=new i(l,16),this.z=w?new i(w,16):this.curve.one,this.t=p&&new i(p,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),!this.zOne&&(this.t=this.t.redMul(this.z.redInvm()))))}o(b,"v"),s(b,f.BasePoint),v.prototype.pointFromJSON=function(h){return b.fromJSON(this,h)},v.prototype.point=function(h,m,l,w){return new b(this,h,m,l,w)},b.fromJSON=function(h,m){return new b(h,m[0],m[1],m[2])},b.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},b.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},b.prototype._extDbl=function(){var h=this.x.redSqr(),m=this.y.redSqr(),l=this.z.redSqr();l=l.redIAdd(l);var w=this.curve._mulA(h),p=this.x.redAdd(this.y).redSqr().redISub(h).redISub(m),y=w.redAdd(m),M=y.redSub(l),E=w.redSub(m),R=p.redMul(M),I=y.redMul(E),T=p.redMul(E),P=M.redMul(y);return this.curve.point(R,I,P,T)},b.prototype._projDbl=function(){var h=this.x.redAdd(this.y).redSqr(),m=this.x.redSqr(),l=this.y.redSqr(),w,p,y,M,E,R;if(this.curve.twisted){M=this.curve._mulA(m);var I=M.redAdd(l);this.zOne?(w=h.redSub(m).redSub(l).redMul(I.redSub(this.curve.two)),p=I.redMul(M.redSub(l)),y=I.redSqr().redSub(I).redSub(I)):(E=this.z.redSqr(),R=I.redSub(E).redISub(E),w=h.redSub(m).redISub(l).redMul(R),p=I.redMul(M.redSub(l)),y=I.redMul(R))}else M=m.redAdd(l),E=this.curve._mulC(this.z).redSqr(),R=M.redSub(E).redSub(E),w=this.curve._mulC(h.redISub(M)).redMul(R),p=this.curve._mulC(M).redMul(m.redISub(l)),y=M.redMul(R);return this.curve.point(w,p,y)},b.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},b.prototype._extAdd=function(h){var m=this.y.redSub(this.x).redMul(h.y.redSub(h.x)),l=this.y.redAdd(this.x).redMul(h.y.redAdd(h.x)),w=this.t.redMul(this.curve.dd).redMul(h.t),p=this.z.redMul(h.z.redAdd(h.z)),y=l.redSub(m),M=p.redSub(w),E=p.redAdd(w),R=l.redAdd(m),I=y.redMul(M),T=E.redMul(R),P=y.redMul(R),j=M.redMul(E);return this.curve.point(I,T,j,P)},b.prototype._projAdd=function(h){var m=this.z.redMul(h.z),l=m.redSqr(),w=this.x.redMul(h.x),p=this.y.redMul(h.y),y=this.curve.d.redMul(w).redMul(p),M=l.redSub(y),E=l.redAdd(y),R=this.x.redAdd(this.y).redMul(h.x.redAdd(h.y)).redISub(w).redISub(p),I=m.redMul(M).redMul(R),T,P;return this.curve.twisted?(T=m.redMul(E).redMul(p.redSub(this.curve._mulA(w))),P=M.redMul(E)):(T=m.redMul(E).redMul(p.redSub(w)),P=this.curve._mulC(M).redMul(E)),this.curve.point(I,T,P)},b.prototype.add=function(h){return this.isInfinity()?h:h.isInfinity()?this:this.curve.extended?this._extAdd(h):this._projAdd(h)},b.prototype.mul=function(h){return this._hasDoubles(h)?this.curve._fixedNafMul(this,h):this.curve._wnafMul(this,h)},b.prototype.mulAdd=function(h,m,l){return this.curve._wnafMulAdd(1,[this,m],[h,l],2,!1)},b.prototype.jmulAdd=function(h,m,l){return this.curve._wnafMulAdd(1,[this,m],[h,l],2,!0)},b.prototype.normalize=function(){if(this.zOne)return this;var h=this.z.redInvm();return this.x=this.x.redMul(h),this.y=this.y.redMul(h),this.t&&(this.t=this.t.redMul(h)),this.z=this.curve.one,this.zOne=!0,this},b.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},b.prototype.getX=function(){return this.normalize(),this.x.fromRed()},b.prototype.getY=function(){return this.normalize(),this.y.fromRed()},b.prototype.eq=function(h){return this===h||this.getX().cmp(h.getX())===0&&this.getY().cmp(h.getY())===0},b.prototype.eqXToP=function(h){var m=h.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(m)===0)return!0;for(var l=h.clone(),w=this.curve.redN.redMul(this.z);;){if(l.iadd(this.curve.n),l.cmp(this.curve.p)>=0)return!1;if(m.redIAdd(w),this.x.cmp(m)===0)return!0}},b.prototype.toP=b.prototype.normalize,b.prototype.mixedAdd=b.prototype.add}),Bc=nt(t=>{var e=t;e.base=fa(),e.short=C0(),e.mont=R0(),e.edwards=I0()}),Jr=nt(t=>{var e=Bi(),r=Or();t.inherits=r;function i(g,u){return(g.charCodeAt(u)&64512)!==55296||u<0||u+1>=g.length?!1:(g.charCodeAt(u+1)&64512)===56320}o(i,"_");function s(g,u){if(Array.isArray(g))return g.slice();if(!g)return[];var d=[];if(typeof g=="string")if(u){if(u==="hex")for(g=g.replace(/[^a-z0-9]+/ig,""),g.length%2!==0&&(g="0"+g),A=0;A<g.length;A+=2)d.push(parseInt(g[A]+g[A+1],16))}else for(var x=0,A=0;A<g.length;A++){var N=g.charCodeAt(A);N<128?d[x++]=N:N<2048?(d[x++]=N>>6|192,d[x++]=N&63|128):i(g,A)?(N=65536+((N&1023)<<10)+(g.charCodeAt(++A)&1023),d[x++]=N>>18|240,d[x++]=N>>12&63|128,d[x++]=N>>6&63|128,d[x++]=N&63|128):(d[x++]=N>>12|224,d[x++]=N>>6&63|128,d[x++]=N&63|128)}else for(A=0;A<g.length;A++)d[A]=g[A]|0;return d}o(s,"P"),t.toArray=s;function f(g){for(var u="",d=0;d<g.length;d++)u+=b(g[d].toString(16));return u}o(f,"O"),t.toHex=f;function n(g){var u=g>>>24|g>>>8&65280|g<<8&16711680|(g&255)<<24;return u>>>0}o(n,"Y"),t.htonl=n;function v(g,u){for(var d="",x=0;x<g.length;x++){var A=g[x];u==="little"&&(A=n(A)),d+=h(A.toString(16))}return d}o(v,"z"),t.toHex32=v;function b(g){return g.length===1?"0"+g:g}o(b,"v"),t.zero2=b;function h(g){return g.length===7?"0"+g:g.length===6?"00"+g:g.length===5?"000"+g:g.length===4?"0000"+g:g.length===3?"00000"+g:g.length===2?"000000"+g:g.length===1?"0000000"+g:g}o(h,"w"),t.zero8=h;function m(g,u,d,x){var A=d-u;e(A%4===0);for(var N=Array(A/4),S=0,c=u;S<N.length;S++,c+=4){var _;x==="big"?_=g[c]<<24|g[c+1]<<16|g[c+2]<<8|g[c+3]:_=g[c+3]<<24|g[c+2]<<16|g[c+1]<<8|g[c],N[S]=_>>>0}return N}o(m,"V"),t.join32=m;function l(g,u){for(var d=Array(g.length*4),x=0,A=0;x<g.length;x++,A+=4){var N=g[x];u==="big"?(d[A]=N>>>24,d[A+1]=N>>>16&255,d[A+2]=N>>>8&255,d[A+3]=N&255):(d[A+3]=N>>>24,d[A+2]=N>>>16&255,d[A+1]=N>>>8&255,d[A]=N&255)}return d}o(l,"Z"),t.split32=l;function w(g,u){return g>>>u|g<<32-u}o(w,"S"),t.rotr32=w;function p(g,u){return g<<u|g>>>32-u}o(p,"C"),t.rotl32=p;function y(g,u){return g+u>>>0}o(y,"E"),t.sum32=y;function M(g,u,d){return g+u+d>>>0}o(M,"I"),t.sum32_3=M;function E(g,u,d,x){return g+u+d+x>>>0}o(E,"L"),t.sum32_4=E;function R(g,u,d,x,A){return g+u+d+x+A>>>0}o(R,"h"),t.sum32_5=R;function I(g,u,d,x){var A=g[u],N=g[u+1],S=x+N>>>0,c=(S<x?1:0)+d+A;g[u]=c>>>0,g[u+1]=S}o(I,"b"),t.sum64=I;function T(g,u,d,x){var A=u+x>>>0,N=(A<u?1:0)+g+d;return N>>>0}o(T,"y"),t.sum64_hi=T;function P(g,u,d,x){var A=u+x;return A>>>0}o(P,"x"),t.sum64_lo=P;function j(g,u,d,x,A,N,S,c){var _=0,C=u;C=C+x>>>0,_+=C<u?1:0,C=C+N>>>0,_+=C<N?1:0,C=C+c>>>0,_+=C<c?1:0;var O=g+d+A+S+_;return O>>>0}o(j,"c"),t.sum64_4_hi=j;function L(g,u,d,x,A,N,S,c){var _=u+x+N+c;return _>>>0}o(L,"l"),t.sum64_4_lo=L;function U(g,u,d,x,A,N,S,c,_,C){var O=0,D=u;D=D+x>>>0,O+=D<u?1:0,D=D+N>>>0,O+=D<N?1:0,D=D+c>>>0,O+=D<c?1:0,D=D+C>>>0,O+=D<C?1:0;var B=g+d+A+S+_+O;return B>>>0}o(U,"B"),t.sum64_5_hi=U;function Z(g,u,d,x,A,N,S,c,_,C){var O=u+x+N+c+C;return O>>>0}o(Z,"s"),t.sum64_5_lo=Z;function ne(g,u,d){var x=u<<32-d|g>>>d;return x>>>0}o(ne,"K8"),t.rotr64_hi=ne;function F(g,u,d){var x=g<<32-d|u>>>d;return x>>>0}o(F,"p"),t.rotr64_lo=F;function Y(g,u,d){return g>>>d}o(Y,"D"),t.shr64_hi=Y;function a(g,u,d){var x=g<<32-d|u>>>d;return x>>>0}o(a,"M"),t.shr64_lo=a}),ys=nt(t=>{var e=Jr(),r=Bi();function i(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}o(i,"_"),t.BlockHash=i,i.prototype.update=function(s,f){if(s=e.toArray(s,f),this.pending?this.pending=this.pending.concat(s):this.pending=s,this.pendingTotal+=s.length,this.pending.length>=this._delta8){s=this.pending;var n=s.length%this._delta8;this.pending=s.slice(s.length-n,s.length),this.pending.length===0&&(this.pending=null),s=e.join32(s,0,s.length-n,this.endian);for(var v=0;v<s.length;v+=this._delta32)this._update(s,v,v+this._delta32)}return this},i.prototype.digest=function(s){return this.update(this._pad()),r(this.pending===null),this._digest(s)},i.prototype._pad=function(){var s=this.pendingTotal,f=this._delta8,n=f-(s+this.padLength)%f,v=Array(n+this.padLength);v[0]=128;for(var b=1;b<n;b++)v[b]=0;if(s<<=3,this.endian==="big"){for(var h=8;h<this.padLength;h++)v[b++]=0;v[b++]=0,v[b++]=0,v[b++]=0,v[b++]=0,v[b++]=s>>>24&255,v[b++]=s>>>16&255,v[b++]=s>>>8&255,v[b++]=s&255}else for(v[b++]=s&255,v[b++]=s>>>8&255,v[b++]=s>>>16&255,v[b++]=s>>>24&255,v[b++]=0,v[b++]=0,v[b++]=0,v[b++]=0,h=8;h<this.padLength;h++)v[b++]=0;return v}}),zc=nt(t=>{var e=Jr(),r=e.rotr32;function i(l,w,p,y){if(l===0)return s(w,p,y);if(l===1||l===3)return n(w,p,y);if(l===2)return f(w,p,y)}o(i,"_"),t.ft_1=i;function s(l,w,p){return l&w^~l&p}o(s,"P"),t.ch32=s;function f(l,w,p){return l&w^l&p^w&p}o(f,"O"),t.maj32=f;function n(l,w,p){return l^w^p}o(n,"Y"),t.p32=n;function v(l){return r(l,2)^r(l,13)^r(l,22)}o(v,"z"),t.s0_256=v;function b(l){return r(l,6)^r(l,11)^r(l,25)}o(b,"v"),t.s1_256=b;function h(l){return r(l,7)^r(l,18)^l>>>3}o(h,"w"),t.g0_256=h;function m(l){return r(l,17)^r(l,19)^l>>>10}o(m,"V"),t.g1_256=m}),O0=nt((t,e)=>{var r=Jr(),i=ys(),s=zc(),f=r.rotl32,n=r.sum32,v=r.sum32_5,b=s.ft_1,h=i.BlockHash,m=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}o(l,"Z"),r.inherits(l,h),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(w,p){for(var y=this.W,M=0;M<16;M++)y[M]=w[p+M];for(;M<y.length;M++)y[M]=f(y[M-3]^y[M-8]^y[M-14]^y[M-16],1);var E=this.h[0],R=this.h[1],I=this.h[2],T=this.h[3],P=this.h[4];for(M=0;M<y.length;M++){var j=~~(M/20),L=v(f(E,5),b(j,R,I,T),P,y[M],m[j]);P=T,T=I,I=f(R,30),R=E,E=L}this.h[0]=n(this.h[0],E),this.h[1]=n(this.h[1],R),this.h[2]=n(this.h[2],I),this.h[3]=n(this.h[3],T),this.h[4]=n(this.h[4],P)},l.prototype._digest=function(w){return w==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")}}),Fc=nt((t,e)=>{var r=Jr(),i=ys(),s=zc(),f=Bi(),n=r.sum32,v=r.sum32_4,b=r.sum32_5,h=s.ch32,m=s.maj32,l=s.s0_256,w=s.s1_256,p=s.g0_256,y=s.g1_256,M=i.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function R(){if(!(this instanceof R))return new R;M.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}o(R,"h"),r.inherits(R,M),e.exports=R,R.blockSize=512,R.outSize=256,R.hmacStrength=192,R.padLength=64,R.prototype._update=function(I,T){for(var P=this.W,j=0;j<16;j++)P[j]=I[T+j];for(;j<P.length;j++)P[j]=v(y(P[j-2]),P[j-7],p(P[j-15]),P[j-16]);var L=this.h[0],U=this.h[1],Z=this.h[2],ne=this.h[3],F=this.h[4],Y=this.h[5],a=this.h[6],g=this.h[7];for(f(this.k.length===P.length),j=0;j<P.length;j++){var u=b(g,w(F),h(F,Y,a),this.k[j],P[j]),d=n(l(L),m(L,U,Z));g=a,a=Y,Y=F,F=n(ne,u),ne=Z,Z=U,U=L,L=n(u,d)}this.h[0]=n(this.h[0],L),this.h[1]=n(this.h[1],U),this.h[2]=n(this.h[2],Z),this.h[3]=n(this.h[3],ne),this.h[4]=n(this.h[4],F),this.h[5]=n(this.h[5],Y),this.h[6]=n(this.h[6],a),this.h[7]=n(this.h[7],g)},R.prototype._digest=function(I){return I==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")}}),T0=nt((t,e)=>{var r=Jr(),i=Fc();function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}o(s,"P"),r.inherits(s,i),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(f){return f==="hex"?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}}),Uc=nt((t,e)=>{var r=Jr(),i=ys(),s=Bi(),f=r.rotr64_hi,n=r.rotr64_lo,v=r.shr64_hi,b=r.shr64_lo,h=r.sum64,m=r.sum64_hi,l=r.sum64_lo,w=r.sum64_4_hi,p=r.sum64_4_lo,y=r.sum64_5_hi,M=r.sum64_5_lo,E=i.BlockHash,R=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function I(){if(!(this instanceof I))return new I;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=R,this.W=Array(160)}o(I,"b"),r.inherits(I,E),e.exports=I,I.blockSize=1024,I.outSize=512,I.hmacStrength=192,I.padLength=128,I.prototype._prepareBlock=function(d,x){for(var A=this.W,N=0;N<32;N++)A[N]=d[x+N];for(;N<A.length;N+=2){var S=g(A[N-4],A[N-3]),c=u(A[N-4],A[N-3]),_=A[N-14],C=A[N-13],O=Y(A[N-30],A[N-29]),D=a(A[N-30],A[N-29]),B=A[N-32],z=A[N-31];A[N]=w(S,c,_,C,O,D,B,z),A[N+1]=p(S,c,_,C,O,D,B,z)}},I.prototype._update=function(d,x){this._prepareBlock(d,x);var A=this.W,N=this.h[0],S=this.h[1],c=this.h[2],_=this.h[3],C=this.h[4],O=this.h[5],D=this.h[6],B=this.h[7],z=this.h[8],G=this.h[9],te=this.h[10],$=this.h[11],q=this.h[12],Ce=this.h[13],fe=this.h[14],ae=this.h[15];s(this.k.length===A.length);for(var be=0;be<A.length;be+=2){var H=fe,ee=ae,Q=ne(z,G),X=F(z,G),se=T(z,G,te,$,q),Ne=P(z,G,te,$,q,Ce),we=this.k[be],ue=this.k[be+1],K=A[be],W=A[be+1],J=y(H,ee,Q,X,se,Ne,we,ue,K,W),pe=M(H,ee,Q,X,se,Ne,we,ue,K,W);H=U(N,S),ee=Z(N,S),Q=j(N,S,c,_,C),X=L(N,S,c,_,C,O);var le=m(H,ee,Q,X),oe=l(H,ee,Q,X);fe=q,ae=Ce,q=te,Ce=$,te=z,$=G,z=m(D,B,J,pe),G=l(B,B,J,pe),D=C,B=O,C=c,O=_,c=N,_=S,N=m(J,pe,le,oe),S=l(J,pe,le,oe)}h(this.h,0,N,S),h(this.h,2,c,_),h(this.h,4,C,O),h(this.h,6,D,B),h(this.h,8,z,G),h(this.h,10,te,$),h(this.h,12,q,Ce),h(this.h,14,fe,ae)},I.prototype._digest=function(d){return d==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")};function T(d,x,A,N,S){var c=d&A^~d&S;return c<0&&(c+=4294967296),c}o(T,"y");function P(d,x,A,N,S,c){var _=x&N^~x&c;return _<0&&(_+=4294967296),_}o(P,"x");function j(d,x,A,N,S){var c=d&A^d&S^A&S;return c<0&&(c+=4294967296),c}o(j,"c");function L(d,x,A,N,S,c){var _=x&N^x&c^N&c;return _<0&&(_+=4294967296),_}o(L,"l");function U(d,x){var A=f(d,x,28),N=f(x,d,2),S=f(x,d,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(U,"B");function Z(d,x){var A=n(d,x,28),N=n(x,d,2),S=n(x,d,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(Z,"s");function ne(d,x){var A=f(d,x,14),N=f(d,x,18),S=f(x,d,9),c=A^N^S;return c<0&&(c+=4294967296),c}o(ne,"K8");function F(d,x){var A=n(d,x,14),N=n(d,x,18),S=n(x,d,9),c=A^N^S;return c<0&&(c+=4294967296),c}o(F,"p");function Y(d,x){var A=f(d,x,1),N=f(d,x,8),S=v(d,x,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(Y,"D");function a(d,x){var A=n(d,x,1),N=n(d,x,8),S=b(d,x,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(a,"M");function g(d,x){var A=f(d,x,19),N=f(x,d,29),S=v(d,x,6),c=A^N^S;return c<0&&(c+=4294967296),c}o(g,"j");function u(d,x){var A=n(d,x,19),N=n(x,d,29),S=b(d,x,6),c=A^N^S;return c<0&&(c+=4294967296),c}o(u,"W")}),P0=nt((t,e)=>{var r=Jr(),i=Uc();function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}o(s,"P"),r.inherits(s,i),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(f){return f==="hex"?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}}),j0=nt(t=>{t.sha1=O0(),t.sha224=T0(),t.sha256=Fc(),t.sha384=P0(),t.sha512=Uc()}),L0=nt(t=>{var e=Jr(),r=ys(),i=e.rotl32,s=e.sum32,f=e.sum32_3,n=e.sum32_4,v=r.BlockHash;function b(){if(!(this instanceof b))return new b;v.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}o(b,"v"),e.inherits(b,v),t.ripemd160=b,b.blockSize=512,b.outSize=160,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(E,R){for(var I=this.h[0],T=this.h[1],P=this.h[2],j=this.h[3],L=this.h[4],U=I,Z=T,ne=P,F=j,Y=L,a=0;a<80;a++){var g=s(i(n(I,h(a,T,P,j),E[w[a]+R],m(a)),y[a]),L);I=L,L=j,j=i(P,10),P=T,T=g,g=s(i(n(U,h(79-a,Z,ne,F),E[p[a]+R],l(a)),M[a]),Y),U=Y,Y=F,F=i(ne,10),ne=Z,Z=g}g=f(this.h[1],P,F),this.h[1]=f(this.h[2],j,Y),this.h[2]=f(this.h[3],L,U),this.h[3]=f(this.h[4],I,Z),this.h[4]=f(this.h[0],T,ne),this.h[0]=g},b.prototype._digest=function(E){return E==="hex"?e.toHex32(this.h,"little"):e.split32(this.h,"little")};function h(E,R,I,T){return E<=15?R^I^T:E<=31?R&I|~R&T:E<=47?(R|~I)^T:E<=63?R&T|I&~T:R^(I|~T)}o(h,"w");function m(E){return E<=15?0:E<=31?1518500249:E<=47?1859775393:E<=63?2400959708:2840853838}o(m,"V");function l(E){return E<=15?1352829926:E<=31?1548603684:E<=47?1836072691:E<=63?2053994217:0}o(l,"Z");var w=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],M=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),D0=nt((t,e)=>{var r=Jr(),i=Bi();function s(f,n,v){if(!(this instanceof s))return new s(f,n,v);this.Hash=f,this.blockSize=f.blockSize/8,this.outSize=f.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(n,v))}o(s,"P"),e.exports=s,s.prototype._init=function(f){f.length>this.blockSize&&(f=new this.Hash().update(f).digest()),i(f.length<=this.blockSize);for(var n=f.length;n<this.blockSize;n++)f.push(0);for(n=0;n<f.length;n++)f[n]^=54;for(this.inner=new this.Hash().update(f),n=0;n<f.length;n++)f[n]^=106;this.outer=new this.Hash().update(f)},s.prototype.update=function(f,n){return this.inner.update(f,n),this},s.prototype.digest=function(f){return this.outer.update(this.inner.digest()),this.outer.digest(f)}}),tl=nt(t=>{var e=t;e.utils=Jr(),e.common=ys(),e.sha=j0(),e.ripemd=L0(),e.hmac=D0(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}),B0=nt((t,e)=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),rl=nt(t=>{var e=t,r=tl(),i=Bc(),s=Lr(),f=s.assert;function n(h){h.type==="short"?this.curve=new i.short(h):h.type==="edwards"?this.curve=new i.edwards(h):this.curve=new i.mont(h),this.g=this.curve.g,this.n=this.curve.n,this.hash=h.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o(n,"Y"),e.PresetCurve=n;function v(h,m){Object.defineProperty(e,h,{configurable:!0,enumerable:!0,get:o(function(){var l=new n(m);return Object.defineProperty(e,h,{configurable:!0,enumerable:!0,value:l}),l},"get")})}o(v,"z"),v("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),v("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),v("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),v("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),v("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),v("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),v("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var b;try{b=B0()}catch{b=void 0}v("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",b]})}),z0=nt((t,e)=>{var r=tl(),i=Lc(),s=Bi();function f(n){if(!(this instanceof f))return new f(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var v=i.toArray(n.entropy,n.entropyEnc||"hex"),b=i.toArray(n.nonce,n.nonceEnc||"hex"),h=i.toArray(n.pers,n.persEnc||"hex");s(v.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(v,b,h)}o(f,"O"),e.exports=f,f.prototype._init=function(n,v,b){var h=n.concat(v).concat(b);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var m=0;m<this.V.length;m++)this.K[m]=0,this.V[m]=1;this._update(h),this._reseed=1,this.reseedInterval=281474976710656},f.prototype._hmac=function(){return new r.hmac(this.hash,this.K)},f.prototype._update=function(n){var v=this._hmac().update(this.V).update([0]);n&&(v=v.update(n)),this.K=v.digest(),this.V=this._hmac().update(this.V).digest(),n&&(this.K=this._hmac().update(this.V).update([1]).update(n).digest(),this.V=this._hmac().update(this.V).digest())},f.prototype.reseed=function(n,v,b,h){typeof v!="string"&&(h=b,b=v,v=null),n=i.toArray(n,v),b=i.toArray(b,h),s(n.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(n.concat(b||[])),this._reseed=1},f.prototype.generate=function(n,v,b,h){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");typeof v!="string"&&(h=b,b=v,v=null),b&&(b=i.toArray(b,h||"hex"),this._update(b));for(var m=[];m.length<n;)this.V=this._hmac().update(this.V).digest(),m=m.concat(this.V);var l=m.slice(0,n);return this._update(b),this._reseed++,i.encode(l,v)}}),F0=nt((t,e)=>{var r=yi(),i=Lr(),s=i.assert;function f(n,v){this.ec=n,this.priv=null,this.pub=null,v.priv&&this._importPrivate(v.priv,v.privEnc),v.pub&&this._importPublic(v.pub,v.pubEnc)}o(f,"O"),e.exports=f,f.fromPublic=function(n,v,b){return v instanceof f?v:new f(n,{pub:v,pubEnc:b})},f.fromPrivate=function(n,v,b){return v instanceof f?v:new f(n,{priv:v,privEnc:b})},f.prototype.validate=function(){var n=this.getPublic();return n.isInfinity()?{result:!1,reason:"Invalid public key"}:n.validate()?n.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},f.prototype.getPublic=function(n,v){return typeof n=="string"&&(v=n,n=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),v?this.pub.encode(v,n):this.pub},f.prototype.getPrivate=function(n){return n==="hex"?this.priv.toString(16,2):this.priv},f.prototype._importPrivate=function(n,v){this.priv=new r(n,v||16),this.priv=this.priv.umod(this.ec.curve.n)},f.prototype._importPublic=function(n,v){if(n.x||n.y){this.ec.curve.type==="mont"?s(n.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&s(n.x&&n.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(n.x,n.y);return}this.pub=this.ec.curve.decodePoint(n,v)},f.prototype.derive=function(n){return n.validate()||s(n.validate(),"public point not validated"),n.mul(this.priv).getX()},f.prototype.sign=function(n,v,b){return this.ec.sign(n,this,v,b)},f.prototype.verify=function(n,v,b){return this.ec.verify(n,v,this,void 0,b)},f.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}}),U0=nt((t,e)=>{var r=yi(),i=Lr(),s=i.assert;function f(m,l){if(m instanceof f)return m;this._importDER(m,l)||(s(m.r&&m.s,"Signature without r or s"),this.r=new r(m.r,16),this.s=new r(m.s,16),m.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=m.recoveryParam)}o(f,"O"),e.exports=f;function n(){this.place=0}o(n,"Y");function v(m,l){var w=m[l.place++];if(!(w&128))return w;var p=w&15;if(p===0||p>4||m[l.place]===0)return!1;for(var y=0,M=0,E=l.place;M<p;M++,E++)y<<=8,y|=m[E],y>>>=0;return y<=127?!1:(l.place=E,y)}o(v,"z");function b(m){for(var l=0,w=m.length-1;!m[l]&&!(m[l+1]&128)&&l<w;)l++;return l===0?m:m.slice(l)}o(b,"v"),f.prototype._importDER=function(m,l){m=i.toArray(m,l);var w=new n;if(m[w.place++]!==48)return!1;var p=v(m,w);if(p===!1||p+w.place!==m.length||m[w.place++]!==2)return!1;var y=v(m,w);if(y===!1||(m[w.place]&128)!==0)return!1;var M=m.slice(w.place,y+w.place);if(w.place+=y,m[w.place++]!==2)return!1;var E=v(m,w);if(E===!1||m.length!==E+w.place||(m[w.place]&128)!==0)return!1;var R=m.slice(w.place,E+w.place);if(M[0]===0)if(M[1]&128)M=M.slice(1);else return!1;if(R[0]===0)if(R[1]&128)R=R.slice(1);else return!1;return this.r=new r(M),this.s=new r(R),this.recoveryParam=null,!0};function h(m,l){if(l<128){m.push(l);return}var w=1+(Math.log(l)/Math.LN2>>>3);for(m.push(w|128);--w;)m.push(l>>>(w<<3)&255);m.push(l)}o(h,"w"),f.prototype.toDER=function(m){var l=this.r.toArray(),w=this.s.toArray();for(l[0]&128&&(l=[0].concat(l)),w[0]&128&&(w=[0].concat(w)),l=b(l),w=b(w);!w[0]&&!(w[1]&128);)w=w.slice(1);var p=[2];h(p,l.length),p=p.concat(l),p.push(2),h(p,w.length);var y=p.concat(w),M=[48];return h(M,y.length),M=M.concat(y),i.encode(M,m)}}),H0=nt((t,e)=>{var r=yi(),i=z0(),s=Lr(),f=rl(),n=Dc(),v=s.assert,b=F0(),h=U0();function m(l){if(!(this instanceof m))return new m(l);typeof l=="string"&&(v(Object.prototype.hasOwnProperty.call(f,l),"Unknown curve "+l),l=f[l]),l instanceof f.PresetCurve&&(l={curve:l}),this.curve=l.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=l.curve.g,this.g.precompute(l.curve.n.bitLength()+1),this.hash=l.hash||l.curve.hash}o(m,"V"),e.exports=m,m.prototype.keyPair=function(l){return new b(this,l)},m.prototype.keyFromPrivate=function(l,w){return b.fromPrivate(this,l,w)},m.prototype.keyFromPublic=function(l,w){return b.fromPublic(this,l,w)},m.prototype.genKeyPair=function(l){l||(l={});for(var w=new i({hash:this.hash,pers:l.pers,persEnc:l.persEnc||"utf8",entropy:l.entropy||n(this.hash.hmacStrength),entropyEnc:l.entropy&&l.entropyEnc||"utf8",nonce:this.n.toArray()}),p=this.n.byteLength(),y=this.n.sub(new r(2));;){var M=new r(w.generate(p));if(!(M.cmp(y)>0))return M.iaddn(1),this.keyFromPrivate(M)}},m.prototype._truncateToN=function(l,w,p){var y;if(r.isBN(l)||typeof l=="number")l=new r(l,16),y=l.byteLength();else if(typeof l=="object")y=l.length,l=new r(l,16);else{var M=l.toString();y=M.length+1>>>1,l=new r(M,16)}typeof p!="number"&&(p=y*8);var E=p-this.n.bitLength();return E>0&&(l=l.ushrn(E)),!w&&l.cmp(this.n)>=0?l.sub(this.n):l},m.prototype.sign=function(l,w,p,y){if(typeof p=="object"&&(y=p,p=null),y||(y={}),typeof l!="string"&&typeof l!="number"&&!r.isBN(l)){v(typeof l=="object"&&l&&typeof l.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),v(l.length>>>0===l.length);for(var M=0;M<l.length;M++)v((l[M]&255)===l[M])}w=this.keyFromPrivate(w,p),l=this._truncateToN(l,!1,y.msgBitLength),v(!l.isNeg(),"Can not sign a negative message");var E=this.n.byteLength(),R=w.getPrivate().toArray("be",E),I=l.toArray("be",E);v(new r(I).eq(l),"Can not sign message");for(var T=new i({hash:this.hash,entropy:R,nonce:I,pers:y.pers,persEnc:y.persEnc||"utf8"}),P=this.n.sub(new r(1)),j=0;;j++){var L=y.k?y.k(j):new r(T.generate(this.n.byteLength()));if(L=this._truncateToN(L,!0),!(L.cmpn(1)<=0||L.cmp(P)>=0)){var U=this.g.mul(L);if(!U.isInfinity()){var Z=U.getX(),ne=Z.umod(this.n);if(ne.cmpn(0)!==0){var F=L.invm(this.n).mul(ne.mul(w.getPrivate()).iadd(l));if(F=F.umod(this.n),F.cmpn(0)!==0){var Y=(U.getY().isOdd()?1:0)|(Z.cmp(ne)!==0?2:0);return y.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),Y^=1),new h({r:ne,s:F,recoveryParam:Y})}}}}}},m.prototype.verify=function(l,w,p,y,M){M||(M={}),l=this._truncateToN(l,!1,M.msgBitLength),p=this.keyFromPublic(p,y),w=new h(w,"hex");var{r:E,s:R}=w;if(E.cmpn(1)<0||E.cmp(this.n)>=0||R.cmpn(1)<0||R.cmp(this.n)>=0)return!1;var I=R.invm(this.n),T=I.mul(l).umod(this.n),P=I.mul(E).umod(this.n),j;return this.curve._maxwellTrick?(j=this.g.jmulAdd(T,p.getPublic(),P),j.isInfinity()?!1:j.eqXToP(E)):(j=this.g.mulAdd(T,p.getPublic(),P),j.isInfinity()?!1:j.getX().umod(this.n).cmp(E)===0)},m.prototype.recoverPubKey=function(l,w,p,y){v((3&p)===p,"The recovery param is more than two bits"),w=new h(w,y);var M=this.n,E=new r(l),R=w.r,I=w.s,T=p&1,P=p>>1;if(R.cmp(this.curve.p.umod(this.curve.n))>=0&&P)throw Error("Unable to find sencond key candinate");P?R=this.curve.pointFromX(R.add(this.curve.n),T):R=this.curve.pointFromX(R,T);var j=w.r.invm(M),L=M.sub(E).mul(j).umod(M),U=I.mul(j).umod(M);return this.g.mulAdd(L,R,U)},m.prototype.getKeyRecoveryParam=function(l,w,p,y){if(w=new h(w,y),w.recoveryParam!==null)return w.recoveryParam;for(var M=0;M<4;M++){var E;try{E=this.recoverPubKey(l,w,M)}catch{continue}if(E.eq(p))return M}throw Error("Unable to find valid recovery factor")}}),V0=nt((t,e)=>{var r=Lr(),i=r.assert,s=r.parseBytes,f=r.cachedProperty;function n(v,b){this.eddsa=v,this._secret=s(b.secret),v.isPoint(b.pub)?this._pub=b.pub:this._pubBytes=s(b.pub)}o(n,"Y"),n.fromPublic=function(v,b){return b instanceof n?b:new n(v,{pub:b})},n.fromSecret=function(v,b){return b instanceof n?b:new n(v,{secret:b})},n.prototype.secret=function(){return this._secret},f(n,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),f(n,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),f(n,"privBytes",function(){var v=this.eddsa,b=this.hash(),h=v.encodingLength-1,m=b.slice(0,v.encodingLength);return m[0]&=248,m[h]&=127,m[h]|=64,m}),f(n,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),f(n,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),f(n,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),n.prototype.sign=function(v){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(v,this)},n.prototype.verify=function(v,b){return this.eddsa.verify(v,b,this)},n.prototype.getSecret=function(v){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),v)},n.prototype.getPublic=function(v){return r.encode(this.pubBytes(),v)},e.exports=n}),Z0=nt((t,e)=>{var r=yi(),i=Lr(),s=i.assert,f=i.cachedProperty,n=i.parseBytes;function v(b,h){this.eddsa=b,typeof h!="object"&&(h=n(h)),Array.isArray(h)&&(s(h.length===b.encodingLength*2,"Signature has invalid size"),h={R:h.slice(0,b.encodingLength),S:h.slice(b.encodingLength)}),s(h.R&&h.S,"Signature without R or S"),b.isPoint(h.R)&&(this._R=h.R),h.S instanceof r&&(this._S=h.S),this._Rencoded=Array.isArray(h.R)?h.R:h.Rencoded,this._Sencoded=Array.isArray(h.S)?h.S:h.Sencoded}o(v,"z"),f(v,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),f(v,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),f(v,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),f(v,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),v.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},v.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=v}),G0=nt((t,e)=>{var r=tl(),i=rl(),s=Lr(),f=s.assert,n=s.parseBytes,v=V0(),b=Z0();function h(m){if(f(m==="ed25519","only tested with ed25519 so far"),!(this instanceof h))return new h(m);m=i[m].curve,this.curve=m,this.g=m.g,this.g.precompute(m.n.bitLength()+1),this.pointClass=m.point().constructor,this.encodingLength=Math.ceil(m.n.bitLength()/8),this.hash=r.sha512}o(h,"w"),e.exports=h,h.prototype.sign=function(m,l){m=n(m);var w=this.keyFromSecret(l),p=this.hashInt(w.messagePrefix(),m),y=this.g.mul(p),M=this.encodePoint(y),E=this.hashInt(M,w.pubBytes(),m).mul(w.priv()),R=p.add(E).umod(this.curve.n);return this.makeSignature({R:y,S:R,Rencoded:M})},h.prototype.verify=function(m,l,w){if(m=n(m),l=this.makeSignature(l),l.S().gte(l.eddsa.curve.n)||l.S().isNeg())return!1;var p=this.keyFromPublic(w),y=this.hashInt(l.Rencoded(),p.pubBytes(),m),M=this.g.mul(l.S()),E=l.R().add(p.pub().mul(y));return E.eq(M)},h.prototype.hashInt=function(){for(var m=this.hash(),l=0;l<arguments.length;l++)m.update(arguments[l]);return s.intFromLE(m.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(m){return v.fromPublic(this,m)},h.prototype.keyFromSecret=function(m){return v.fromSecret(this,m)},h.prototype.makeSignature=function(m){return m instanceof b?m:new b(this,m)},h.prototype.encodePoint=function(m){var l=m.getY().toArray("le",this.encodingLength);return l[this.encodingLength-1]|=m.getX().isOdd()?128:0,l},h.prototype.decodePoint=function(m){m=s.parseBytes(m);var l=m.length-1,w=m.slice(0,l).concat(m[l]&-129),p=(m[l]&128)!==0,y=s.intFromLE(w);return this.curve.pointFromY(y,p)},h.prototype.encodeInt=function(m){return m.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(m){return s.intFromLE(m)},h.prototype.isPoint=function(m){return m instanceof this.pointClass}}),Y0=nt(t=>{var e=t;e.version=k0().version,e.utils=Lr(),e.rand=Dc(),e.curve=Bc(),e.curves=rl(),e.ec=H0(),e.eddsa=G0()}),Q0=nt((t,e)=>{(function(r,i){function s(a,g){if(!a)throw Error(g||"Assertion failed")}o(s,"P");function f(a,g){a.super_=g;var u=o(function(){},"W");u.prototype=g.prototype,a.prototype=new u,a.prototype.constructor=a}o(f,"O");function n(a,g,u){if(n.isBN(a))return a;this.negative=0,this.words=null,this.length=0,this.red=null,a!==null&&((g==="le"||g==="be")&&(u=g,g=10),this._init(a||0,g||10,u||"be"))}o(n,"Y"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,g){return a.cmp(g)>0?a:g},n.min=function(a,g){return a.cmp(g)<0?a:g},n.prototype._init=function(a,g,u){if(typeof a=="number")return this._initNumber(a,g,u);if(typeof a=="object")return this._initArray(a,g,u);g==="hex"&&(g=16),s(g===(g|0)&&g>=2&&g<=36),a=a.toString().replace(/\s+/g,"");var d=0;a[0]==="-"&&(d++,this.negative=1),d<a.length&&(g===16?this._parseHex(a,d,u):(this._parseBase(a,g,d),u==="le"&&this._initArray(this.toArray(),g,u)))},n.prototype._initNumber=function(a,g,u){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(s(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),g,u)},n.prototype._initArray=function(a,g,u){if(s(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x,A,N=0;if(u==="be")for(d=a.length-1,x=0;d>=0;d-=3)A=a[d]|a[d-1]<<8|a[d-2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);else if(u==="le")for(d=0,x=0;d<a.length;d+=3)A=a[d]|a[d+1]<<8|a[d+2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);return this.strip()};function b(a,g){var u=a.charCodeAt(g);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}o(b,"v");function h(a,g,u){var d=b(a,u);return u-1>=g&&(d|=b(a,u-1)<<4),d}o(h,"w"),n.prototype._parseHex=function(a,g,u){this.length=Math.ceil((a.length-g)/6),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x=0,A=0,N;if(u==="be")for(d=a.length-1;d>=g;d-=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8;else{var S=a.length-g;for(d=S%2===0?g+1:g;d<a.length;d+=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8}this.strip()};function m(a,g,u,d){for(var x=0,A=Math.min(a.length,u),N=g;N<A;N++){var S=a.charCodeAt(N)-48;x*=d,S>=49?x+=S-49+10:S>=17?x+=S-17+10:x+=S}return x}o(m,"V"),n.prototype._parseBase=function(a,g,u){this.words=[0],this.length=1;for(var d=0,x=1;x<=67108863;x*=g)d++;d--,x=x/g|0;for(var A=a.length-u,N=A%d,S=Math.min(A,A-N)+u,c=0,_=u;_<S;_+=d)c=m(a,_,_+d,g),this.imuln(x),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(N!==0){var C=1;for(c=m(a,_,a.length,g),_=0;_<N;_++)C*=g;this.imuln(C),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(a){a.words=Array(this.length);for(var g=0;g<this.length;g++)a.words[g]=this.words[g];a.length=this.length,a.negative=this.negative,a.red=this.red},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(a,g){a=a||10,g=g|0||1;var u;if(a===16||a==="hex"){u="";for(var d=0,x=0,A=0;A<this.length;A++){var N=this.words[A],S=((N<<d|x)&16777215).toString(16);x=N>>>24-d&16777215,d+=2,d>=26&&(d-=26,A--),x!==0||A!==this.length-1?u=l[6-S.length]+S+u:u=S+u}for(x!==0&&(u=x.toString(16)+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(a===(a|0)&&a>=2&&a<=36){var c=w[a],_=p[a];u="";var C=this.clone();for(C.negative=0;!C.isZero();){var O=C.modn(_).toString(a);C=C.idivn(_),C.isZero()?u=O+u:u=l[c-O.length]+O+u}for(this.isZero()&&(u="0"+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(a,g){return s(typeof v<"u"),this.toArrayLike(v,a,g)},n.prototype.toArray=function(a,g){return this.toArrayLike(Array,a,g)},n.prototype.toArrayLike=function(a,g,u){var d=this.byteLength(),x=u||Math.max(1,d);s(d<=x,"byte array longer than desired length"),s(x>0,"Requested array length <= 0"),this.strip();var A=g==="le",N=new a(x),S,c,_=this.clone();if(A){for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[c]=S;for(;c<x;c++)N[c]=0}else{for(c=0;c<x-d;c++)N[c]=0;for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[x-c-1]=S}return N},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var g=a,u=0;return g>=4096&&(u+=13,g>>>=13),g>=64&&(u+=7,g>>>=7),g>=8&&(u+=4,g>>>=4),g>=2&&(u+=2,g>>>=2),u+g},n.prototype._zeroBits=function(a){if(a===0)return 26;var g=a,u=0;return(g&8191)===0&&(u+=13,g>>>=13),(g&127)===0&&(u+=7,g>>>=7),(g&15)===0&&(u+=4,g>>>=4),(g&3)===0&&(u+=2,g>>>=2),(g&1)===0&&u++,u},n.prototype.bitLength=function(){var a=this.words[this.length-1],g=this._countBits(a);return(this.length-1)*26+g};function y(a){for(var g=Array(a.bitLength()),u=0;u<g.length;u++){var d=u/26|0,x=u%26;g[u]=(a.words[d]&1<<x)>>>x}return g}o(y,"E"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,g=0;g<this.length;g++){var u=this._zeroBits(this.words[g]);if(a+=u,u!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var g=0;g<a.length;g++)this.words[g]=this.words[g]|a.words[g];return this.strip()},n.prototype.ior=function(a){return s((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var g;this.length>a.length?g=a:g=this;for(var u=0;u<g.length;u++)this.words[u]=this.words[u]&a.words[u];return this.length=g.length,this.strip()},n.prototype.iand=function(a){return s((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var g,u;this.length>a.length?(g=this,u=a):(g=a,u=this);for(var d=0;d<u.length;d++)this.words[d]=g.words[d]^u.words[d];if(this!==g)for(;d<g.length;d++)this.words[d]=g.words[d];return this.length=g.length,this.strip()},n.prototype.ixor=function(a){return s((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){s(typeof a=="number"&&a>=0);var g=Math.ceil(a/26)|0,u=a%26;this._expand(g),u>0&&g--;for(var d=0;d<g;d++)this.words[d]=~this.words[d]&67108863;return u>0&&(this.words[d]=~this.words[d]&67108863>>26-u),this.strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,g){s(typeof a=="number"&&a>=0);var u=a/26|0,d=a%26;return this._expand(u+1),g?this.words[u]=this.words[u]|1<<d:this.words[u]=this.words[u]&~(1<<d),this.strip()},n.prototype.iadd=function(a){var g;if(this.negative!==0&&a.negative===0)return this.negative=0,g=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,g=this.isub(a),a.negative=1,g._normSign();var u,d;this.length>a.length?(u=this,d=a):(u=a,d=this);for(var x=0,A=0;A<d.length;A++)g=(u.words[A]|0)+(d.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;for(;x!==0&&A<u.length;A++)g=(u.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;if(this.length=u.length,x!==0)this.words[this.length]=x,this.length++;else if(u!==this)for(;A<u.length;A++)this.words[A]=u.words[A];return this},n.prototype.add=function(a){var g;return a.negative!==0&&this.negative===0?(a.negative=0,g=this.sub(a),a.negative^=1,g):a.negative===0&&this.negative!==0?(this.negative=0,g=a.sub(this),this.negative=1,g):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var g=this.iadd(a);return a.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var u=this.cmp(a);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,x;u>0?(d=this,x=a):(d=a,x=this);for(var A=0,N=0;N<x.length;N++)g=(d.words[N]|0)-(x.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;for(;A!==0&&N<d.length;N++)g=(d.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;if(A===0&&N<d.length&&d!==this)for(;N<d.length;N++)this.words[N]=d.words[N];return this.length=Math.max(this.length,N),d!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function M(a,g,u){u.negative=g.negative^a.negative;var d=a.length+g.length|0;u.length=d,d=d-1|0;var x=a.words[0]|0,A=g.words[0]|0,N=x*A,S=N&67108863,c=N/67108864|0;u.words[0]=S;for(var _=1;_<d;_++){for(var C=c>>>26,O=c&67108863,D=Math.min(_,g.length-1),B=Math.max(0,_-a.length+1);B<=D;B++){var z=_-B|0;x=a.words[z]|0,A=g.words[B]|0,N=x*A+O,C+=N/67108864|0,O=N&67108863}u.words[_]=O|0,c=C|0}return c!==0?u.words[_]=c|0:u.length--,u.strip()}o(M,"I");var E=o(function(a,g,u){var d=a.words,x=g.words,A=u.words,N=0,S,c,_,C=d[0]|0,O=C&8191,D=C>>>13,B=d[1]|0,z=B&8191,G=B>>>13,te=d[2]|0,$=te&8191,q=te>>>13,Ce=d[3]|0,fe=Ce&8191,ae=Ce>>>13,be=d[4]|0,H=be&8191,ee=be>>>13,Q=d[5]|0,X=Q&8191,se=Q>>>13,Ne=d[6]|0,we=Ne&8191,ue=Ne>>>13,K=d[7]|0,W=K&8191,J=K>>>13,pe=d[8]|0,le=pe&8191,oe=pe>>>13,Ve=d[9]|0,_e=Ve&8191,Le=Ve>>>13,qe=x[0]|0,ge=qe&8191,De=qe>>>13,he=x[1]|0,ve=he&8191,Oe=he>>>13,je=x[2]|0,ke=je&8191,Fe=je>>>13,et=x[3]|0,Ie=et&8191,Se=et>>>13,Be=x[4]|0,Ee=Be&8191,Ue=Be>>>13,Je=x[5]|0,re=Je&8191,de=Je>>>13,Pe=x[6]|0,Me=Pe&8191,Re=Pe>>>13,Ke=x[7]|0,ie=Ke&8191,Ae=Ke>>>13,Ye=x[8]|0,me=Ye&8191,Qe=Ye>>>13,st=x[9]|0,ze=st&8191,We=st>>>13;u.negative=a.negative^g.negative,u.length=19,S=Math.imul(O,ge),c=Math.imul(O,De),c=c+Math.imul(D,ge)|0,_=Math.imul(D,De);var Te=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,S=Math.imul(z,ge),c=Math.imul(z,De),c=c+Math.imul(G,ge)|0,_=Math.imul(G,De),S=S+Math.imul(O,ve)|0,c=c+Math.imul(O,Oe)|0,c=c+Math.imul(D,ve)|0,_=_+Math.imul(D,Oe)|0;var Ze=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,S=Math.imul($,ge),c=Math.imul($,De),c=c+Math.imul(q,ge)|0,_=Math.imul(q,De),S=S+Math.imul(z,ve)|0,c=c+Math.imul(z,Oe)|0,c=c+Math.imul(G,ve)|0,_=_+Math.imul(G,Oe)|0,S=S+Math.imul(O,ke)|0,c=c+Math.imul(O,Fe)|0,c=c+Math.imul(D,ke)|0,_=_+Math.imul(D,Fe)|0;var lt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(fe,ge),c=Math.imul(fe,De),c=c+Math.imul(ae,ge)|0,_=Math.imul(ae,De),S=S+Math.imul($,ve)|0,c=c+Math.imul($,Oe)|0,c=c+Math.imul(q,ve)|0,_=_+Math.imul(q,Oe)|0,S=S+Math.imul(z,ke)|0,c=c+Math.imul(z,Fe)|0,c=c+Math.imul(G,ke)|0,_=_+Math.imul(G,Fe)|0,S=S+Math.imul(O,Ie)|0,c=c+Math.imul(O,Se)|0,c=c+Math.imul(D,Ie)|0,_=_+Math.imul(D,Se)|0;var yt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(yt>>>26)|0,yt&=67108863,S=Math.imul(H,ge),c=Math.imul(H,De),c=c+Math.imul(ee,ge)|0,_=Math.imul(ee,De),S=S+Math.imul(fe,ve)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(ae,ve)|0,_=_+Math.imul(ae,Oe)|0,S=S+Math.imul($,ke)|0,c=c+Math.imul($,Fe)|0,c=c+Math.imul(q,ke)|0,_=_+Math.imul(q,Fe)|0,S=S+Math.imul(z,Ie)|0,c=c+Math.imul(z,Se)|0,c=c+Math.imul(G,Ie)|0,_=_+Math.imul(G,Se)|0,S=S+Math.imul(O,Ee)|0,c=c+Math.imul(O,Ue)|0,c=c+Math.imul(D,Ee)|0,_=_+Math.imul(D,Ue)|0;var ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(X,ge),c=Math.imul(X,De),c=c+Math.imul(se,ge)|0,_=Math.imul(se,De),S=S+Math.imul(H,ve)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(ee,ve)|0,_=_+Math.imul(ee,Oe)|0,S=S+Math.imul(fe,ke)|0,c=c+Math.imul(fe,Fe)|0,c=c+Math.imul(ae,ke)|0,_=_+Math.imul(ae,Fe)|0,S=S+Math.imul($,Ie)|0,c=c+Math.imul($,Se)|0,c=c+Math.imul(q,Ie)|0,_=_+Math.imul(q,Se)|0,S=S+Math.imul(z,Ee)|0,c=c+Math.imul(z,Ue)|0,c=c+Math.imul(G,Ee)|0,_=_+Math.imul(G,Ue)|0,S=S+Math.imul(O,re)|0,c=c+Math.imul(O,de)|0,c=c+Math.imul(D,re)|0,_=_+Math.imul(D,de)|0;var Nt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S=Math.imul(we,ge),c=Math.imul(we,De),c=c+Math.imul(ue,ge)|0,_=Math.imul(ue,De),S=S+Math.imul(X,ve)|0,c=c+Math.imul(X,Oe)|0,c=c+Math.imul(se,ve)|0,_=_+Math.imul(se,Oe)|0,S=S+Math.imul(H,ke)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(ee,ke)|0,_=_+Math.imul(ee,Fe)|0,S=S+Math.imul(fe,Ie)|0,c=c+Math.imul(fe,Se)|0,c=c+Math.imul(ae,Ie)|0,_=_+Math.imul(ae,Se)|0,S=S+Math.imul($,Ee)|0,c=c+Math.imul($,Ue)|0,c=c+Math.imul(q,Ee)|0,_=_+Math.imul(q,Ue)|0,S=S+Math.imul(z,re)|0,c=c+Math.imul(z,de)|0,c=c+Math.imul(G,re)|0,_=_+Math.imul(G,de)|0,S=S+Math.imul(O,Me)|0,c=c+Math.imul(O,Re)|0,c=c+Math.imul(D,Me)|0,_=_+Math.imul(D,Re)|0;var Dt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(W,ge),c=Math.imul(W,De),c=c+Math.imul(J,ge)|0,_=Math.imul(J,De),S=S+Math.imul(we,ve)|0,c=c+Math.imul(we,Oe)|0,c=c+Math.imul(ue,ve)|0,_=_+Math.imul(ue,Oe)|0,S=S+Math.imul(X,ke)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(se,ke)|0,_=_+Math.imul(se,Fe)|0,S=S+Math.imul(H,Ie)|0,c=c+Math.imul(H,Se)|0,c=c+Math.imul(ee,Ie)|0,_=_+Math.imul(ee,Se)|0,S=S+Math.imul(fe,Ee)|0,c=c+Math.imul(fe,Ue)|0,c=c+Math.imul(ae,Ee)|0,_=_+Math.imul(ae,Ue)|0,S=S+Math.imul($,re)|0,c=c+Math.imul($,de)|0,c=c+Math.imul(q,re)|0,_=_+Math.imul(q,de)|0,S=S+Math.imul(z,Me)|0,c=c+Math.imul(z,Re)|0,c=c+Math.imul(G,Me)|0,_=_+Math.imul(G,Re)|0,S=S+Math.imul(O,ie)|0,c=c+Math.imul(O,Ae)|0,c=c+Math.imul(D,ie)|0,_=_+Math.imul(D,Ae)|0;var Ct=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,S=Math.imul(le,ge),c=Math.imul(le,De),c=c+Math.imul(oe,ge)|0,_=Math.imul(oe,De),S=S+Math.imul(W,ve)|0,c=c+Math.imul(W,Oe)|0,c=c+Math.imul(J,ve)|0,_=_+Math.imul(J,Oe)|0,S=S+Math.imul(we,ke)|0,c=c+Math.imul(we,Fe)|0,c=c+Math.imul(ue,ke)|0,_=_+Math.imul(ue,Fe)|0,S=S+Math.imul(X,Ie)|0,c=c+Math.imul(X,Se)|0,c=c+Math.imul(se,Ie)|0,_=_+Math.imul(se,Se)|0,S=S+Math.imul(H,Ee)|0,c=c+Math.imul(H,Ue)|0,c=c+Math.imul(ee,Ee)|0,_=_+Math.imul(ee,Ue)|0,S=S+Math.imul(fe,re)|0,c=c+Math.imul(fe,de)|0,c=c+Math.imul(ae,re)|0,_=_+Math.imul(ae,de)|0,S=S+Math.imul($,Me)|0,c=c+Math.imul($,Re)|0,c=c+Math.imul(q,Me)|0,_=_+Math.imul(q,Re)|0,S=S+Math.imul(z,ie)|0,c=c+Math.imul(z,Ae)|0,c=c+Math.imul(G,ie)|0,_=_+Math.imul(G,Ae)|0,S=S+Math.imul(O,me)|0,c=c+Math.imul(O,Qe)|0,c=c+Math.imul(D,me)|0,_=_+Math.imul(D,Qe)|0;var St=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(St>>>26)|0,St&=67108863,S=Math.imul(_e,ge),c=Math.imul(_e,De),c=c+Math.imul(Le,ge)|0,_=Math.imul(Le,De),S=S+Math.imul(le,ve)|0,c=c+Math.imul(le,Oe)|0,c=c+Math.imul(oe,ve)|0,_=_+Math.imul(oe,Oe)|0,S=S+Math.imul(W,ke)|0,c=c+Math.imul(W,Fe)|0,c=c+Math.imul(J,ke)|0,_=_+Math.imul(J,Fe)|0,S=S+Math.imul(we,Ie)|0,c=c+Math.imul(we,Se)|0,c=c+Math.imul(ue,Ie)|0,_=_+Math.imul(ue,Se)|0,S=S+Math.imul(X,Ee)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(se,Ee)|0,_=_+Math.imul(se,Ue)|0,S=S+Math.imul(H,re)|0,c=c+Math.imul(H,de)|0,c=c+Math.imul(ee,re)|0,_=_+Math.imul(ee,de)|0,S=S+Math.imul(fe,Me)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(ae,Me)|0,_=_+Math.imul(ae,Re)|0,S=S+Math.imul($,ie)|0,c=c+Math.imul($,Ae)|0,c=c+Math.imul(q,ie)|0,_=_+Math.imul(q,Ae)|0,S=S+Math.imul(z,me)|0,c=c+Math.imul(z,Qe)|0,c=c+Math.imul(G,me)|0,_=_+Math.imul(G,Qe)|0,S=S+Math.imul(O,ze)|0,c=c+Math.imul(O,We)|0,c=c+Math.imul(D,ze)|0,_=_+Math.imul(D,We)|0;var Ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,S=Math.imul(_e,ve),c=Math.imul(_e,Oe),c=c+Math.imul(Le,ve)|0,_=Math.imul(Le,Oe),S=S+Math.imul(le,ke)|0,c=c+Math.imul(le,Fe)|0,c=c+Math.imul(oe,ke)|0,_=_+Math.imul(oe,Fe)|0,S=S+Math.imul(W,Ie)|0,c=c+Math.imul(W,Se)|0,c=c+Math.imul(J,Ie)|0,_=_+Math.imul(J,Se)|0,S=S+Math.imul(we,Ee)|0,c=c+Math.imul(we,Ue)|0,c=c+Math.imul(ue,Ee)|0,_=_+Math.imul(ue,Ue)|0,S=S+Math.imul(X,re)|0,c=c+Math.imul(X,de)|0,c=c+Math.imul(se,re)|0,_=_+Math.imul(se,de)|0,S=S+Math.imul(H,Me)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(ee,Me)|0,_=_+Math.imul(ee,Re)|0,S=S+Math.imul(fe,ie)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(ae,ie)|0,_=_+Math.imul(ae,Ae)|0,S=S+Math.imul($,me)|0,c=c+Math.imul($,Qe)|0,c=c+Math.imul(q,me)|0,_=_+Math.imul(q,Qe)|0,S=S+Math.imul(z,ze)|0,c=c+Math.imul(z,We)|0,c=c+Math.imul(G,ze)|0,_=_+Math.imul(G,We)|0;var Vt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,S=Math.imul(_e,ke),c=Math.imul(_e,Fe),c=c+Math.imul(Le,ke)|0,_=Math.imul(Le,Fe),S=S+Math.imul(le,Ie)|0,c=c+Math.imul(le,Se)|0,c=c+Math.imul(oe,Ie)|0,_=_+Math.imul(oe,Se)|0,S=S+Math.imul(W,Ee)|0,c=c+Math.imul(W,Ue)|0,c=c+Math.imul(J,Ee)|0,_=_+Math.imul(J,Ue)|0,S=S+Math.imul(we,re)|0,c=c+Math.imul(we,de)|0,c=c+Math.imul(ue,re)|0,_=_+Math.imul(ue,de)|0,S=S+Math.imul(X,Me)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(se,Me)|0,_=_+Math.imul(se,Re)|0,S=S+Math.imul(H,ie)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(ee,ie)|0,_=_+Math.imul(ee,Ae)|0,S=S+Math.imul(fe,me)|0,c=c+Math.imul(fe,Qe)|0,c=c+Math.imul(ae,me)|0,_=_+Math.imul(ae,Qe)|0,S=S+Math.imul($,ze)|0,c=c+Math.imul($,We)|0,c=c+Math.imul(q,ze)|0,_=_+Math.imul(q,We)|0;var Pt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,S=Math.imul(_e,Ie),c=Math.imul(_e,Se),c=c+Math.imul(Le,Ie)|0,_=Math.imul(Le,Se),S=S+Math.imul(le,Ee)|0,c=c+Math.imul(le,Ue)|0,c=c+Math.imul(oe,Ee)|0,_=_+Math.imul(oe,Ue)|0,S=S+Math.imul(W,re)|0,c=c+Math.imul(W,de)|0,c=c+Math.imul(J,re)|0,_=_+Math.imul(J,de)|0,S=S+Math.imul(we,Me)|0,c=c+Math.imul(we,Re)|0,c=c+Math.imul(ue,Me)|0,_=_+Math.imul(ue,Re)|0,S=S+Math.imul(X,ie)|0,c=c+Math.imul(X,Ae)|0,c=c+Math.imul(se,ie)|0,_=_+Math.imul(se,Ae)|0,S=S+Math.imul(H,me)|0,c=c+Math.imul(H,Qe)|0,c=c+Math.imul(ee,me)|0,_=_+Math.imul(ee,Qe)|0,S=S+Math.imul(fe,ze)|0,c=c+Math.imul(fe,We)|0,c=c+Math.imul(ae,ze)|0,_=_+Math.imul(ae,We)|0;var Ft=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,S=Math.imul(_e,Ee),c=Math.imul(_e,Ue),c=c+Math.imul(Le,Ee)|0,_=Math.imul(Le,Ue),S=S+Math.imul(le,re)|0,c=c+Math.imul(le,de)|0,c=c+Math.imul(oe,re)|0,_=_+Math.imul(oe,de)|0,S=S+Math.imul(W,Me)|0,c=c+Math.imul(W,Re)|0,c=c+Math.imul(J,Me)|0,_=_+Math.imul(J,Re)|0,S=S+Math.imul(we,ie)|0,c=c+Math.imul(we,Ae)|0,c=c+Math.imul(ue,ie)|0,_=_+Math.imul(ue,Ae)|0,S=S+Math.imul(X,me)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(se,me)|0,_=_+Math.imul(se,Qe)|0,S=S+Math.imul(H,ze)|0,c=c+Math.imul(H,We)|0,c=c+Math.imul(ee,ze)|0,_=_+Math.imul(ee,We)|0;var Tt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,S=Math.imul(_e,re),c=Math.imul(_e,de),c=c+Math.imul(Le,re)|0,_=Math.imul(Le,de),S=S+Math.imul(le,Me)|0,c=c+Math.imul(le,Re)|0,c=c+Math.imul(oe,Me)|0,_=_+Math.imul(oe,Re)|0,S=S+Math.imul(W,ie)|0,c=c+Math.imul(W,Ae)|0,c=c+Math.imul(J,ie)|0,_=_+Math.imul(J,Ae)|0,S=S+Math.imul(we,me)|0,c=c+Math.imul(we,Qe)|0,c=c+Math.imul(ue,me)|0,_=_+Math.imul(ue,Qe)|0,S=S+Math.imul(X,ze)|0,c=c+Math.imul(X,We)|0,c=c+Math.imul(se,ze)|0,_=_+Math.imul(se,We)|0;var jt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(jt>>>26)|0,jt&=67108863,S=Math.imul(_e,Me),c=Math.imul(_e,Re),c=c+Math.imul(Le,Me)|0,_=Math.imul(Le,Re),S=S+Math.imul(le,ie)|0,c=c+Math.imul(le,Ae)|0,c=c+Math.imul(oe,ie)|0,_=_+Math.imul(oe,Ae)|0,S=S+Math.imul(W,me)|0,c=c+Math.imul(W,Qe)|0,c=c+Math.imul(J,me)|0,_=_+Math.imul(J,Qe)|0,S=S+Math.imul(we,ze)|0,c=c+Math.imul(we,We)|0,c=c+Math.imul(ue,ze)|0,_=_+Math.imul(ue,We)|0;var Ut=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,S=Math.imul(_e,ie),c=Math.imul(_e,Ae),c=c+Math.imul(Le,ie)|0,_=Math.imul(Le,Ae),S=S+Math.imul(le,me)|0,c=c+Math.imul(le,Qe)|0,c=c+Math.imul(oe,me)|0,_=_+Math.imul(oe,Qe)|0,S=S+Math.imul(W,ze)|0,c=c+Math.imul(W,We)|0,c=c+Math.imul(J,ze)|0,_=_+Math.imul(J,We)|0;var Zt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,S=Math.imul(_e,me),c=Math.imul(_e,Qe),c=c+Math.imul(Le,me)|0,_=Math.imul(Le,Qe),S=S+Math.imul(le,ze)|0,c=c+Math.imul(le,We)|0,c=c+Math.imul(oe,ze)|0,_=_+Math.imul(oe,We)|0;var Gt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,S=Math.imul(_e,ze),c=Math.imul(_e,We),c=c+Math.imul(Le,ze)|0,_=Math.imul(Le,We);var Yt=(N+S|0)+((c&8191)<<13)|0;return N=(_+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,A[0]=Te,A[1]=Ze,A[2]=lt,A[3]=yt,A[4]=ht,A[5]=Nt,A[6]=Dt,A[7]=Ct,A[8]=St,A[9]=Ht,A[10]=Vt,A[11]=Pt,A[12]=Ft,A[13]=Tt,A[14]=jt,A[15]=Ut,A[16]=Zt,A[17]=Gt,A[18]=Yt,N!==0&&(A[19]=N,u.length++),u},"L");Math.imul||(E=M);function R(a,g,u){u.negative=g.negative^a.negative,u.length=a.length+g.length;for(var d=0,x=0,A=0;A<u.length-1;A++){var N=x;x=0;for(var S=d&67108863,c=Math.min(A,g.length-1),_=Math.max(0,A-a.length+1);_<=c;_++){var C=A-_,O=a.words[C]|0,D=g.words[_]|0,B=O*D,z=B&67108863;N=N+(B/67108864|0)|0,z=z+S|0,S=z&67108863,N=N+(z>>>26)|0,x+=N>>>26,N&=67108863}u.words[A]=S,d=N,N=x}return d!==0?u.words[A]=d:u.length--,u.strip()}o(R,"h");function I(a,g,u){var d=new T;return d.mulp(a,g,u)}o(I,"b"),n.prototype.mulTo=function(a,g){var u,d=this.length+a.length;return this.length===10&&a.length===10?u=E(this,a,g):d<63?u=M(this,a,g):d<1024?u=R(this,a,g):u=I(this,a,g),u};function T(a,g){this.x=a,this.y=g}o(T,"y"),T.prototype.makeRBT=function(a){for(var g=Array(a),u=n.prototype._countBits(a)-1,d=0;d<a;d++)g[d]=this.revBin(d,u,a);return g},T.prototype.revBin=function(a,g,u){if(a===0||a===u-1)return a;for(var d=0,x=0;x<g;x++)d|=(a&1)<<g-x-1,a>>=1;return d},T.prototype.permute=function(a,g,u,d,x,A){for(var N=0;N<A;N++)d[N]=g[a[N]],x[N]=u[a[N]]},T.prototype.transform=function(a,g,u,d,x,A){this.permute(A,a,g,u,d,x);for(var N=1;N<x;N<<=1)for(var S=N<<1,c=Math.cos(2*Math.PI/S),_=Math.sin(2*Math.PI/S),C=0;C<x;C+=S)for(var O=c,D=_,B=0;B<N;B++){var z=u[C+B],G=d[C+B],te=u[C+B+N],$=d[C+B+N],q=O*te-D*$;$=O*$+D*te,te=q,u[C+B]=z+te,d[C+B]=G+$,u[C+B+N]=z-te,d[C+B+N]=G-$,B!==S&&(q=c*O-_*D,D=c*D+_*O,O=q)}},T.prototype.guessLen13b=function(a,g){var u=Math.max(g,a)|1,d=u&1,x=0;for(u=u/2|0;u;u=u>>>1)x++;return 1<<x+1+d},T.prototype.conjugate=function(a,g,u){if(!(u<=1))for(var d=0;d<u/2;d++){var x=a[d];a[d]=a[u-d-1],a[u-d-1]=x,x=g[d],g[d]=-g[u-d-1],g[u-d-1]=-x}},T.prototype.normalize13b=function(a,g){for(var u=0,d=0;d<g/2;d++){var x=Math.round(a[2*d+1]/g)*8192+Math.round(a[2*d]/g)+u;a[d]=x&67108863,x<67108864?u=0:u=x/67108864|0}return a},T.prototype.convert13b=function(a,g,u,d){for(var x=0,A=0;A<g;A++)x=x+(a[A]|0),u[2*A]=x&8191,x=x>>>13,u[2*A+1]=x&8191,x=x>>>13;for(A=2*g;A<d;++A)u[A]=0;s(x===0),s((x&-8192)===0)},T.prototype.stub=function(a){for(var g=Array(a),u=0;u<a;u++)g[u]=0;return g},T.prototype.mulp=function(a,g,u){var d=2*this.guessLen13b(a.length,g.length),x=this.makeRBT(d),A=this.stub(d),N=Array(d),S=Array(d),c=Array(d),_=Array(d),C=Array(d),O=Array(d),D=u.words;D.length=d,this.convert13b(a.words,a.length,N,d),this.convert13b(g.words,g.length,_,d),this.transform(N,A,S,c,d,x),this.transform(_,A,C,O,d,x);for(var B=0;B<d;B++){var z=S[B]*C[B]-c[B]*O[B];c[B]=S[B]*O[B]+c[B]*C[B],S[B]=z}return this.conjugate(S,c,d),this.transform(S,c,D,A,d,x),this.conjugate(D,A,d),this.normalize13b(D,d),u.negative=a.negative^g.negative,u.length=a.length+g.length,u.strip()},n.prototype.mul=function(a){var g=new n(null);return g.words=Array(this.length+a.length),this.mulTo(a,g)},n.prototype.mulf=function(a){var g=new n(null);return g.words=Array(this.length+a.length),I(this,a,g)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){s(typeof a=="number"),s(a<67108864);for(var g=0,u=0;u<this.length;u++){var d=(this.words[u]|0)*a,x=(d&67108863)+(g&67108863);g>>=26,g+=d/67108864|0,g+=x>>>26,this.words[u]=x&67108863}return g!==0&&(this.words[u]=g,this.length++),this.length=a===0?1:this.length,this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var g=y(a);if(g.length===0)return new n(1);for(var u=this,d=0;d<g.length&&g[d]===0;d++,u=u.sqr());if(++d<g.length)for(var x=u.sqr();d<g.length;d++,x=x.sqr())g[d]!==0&&(u=u.mul(x));return u},n.prototype.iushln=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=67108863>>>26-g<<26-g,x;if(g!==0){var A=0;for(x=0;x<this.length;x++){var N=this.words[x]&d,S=(this.words[x]|0)-N<<g;this.words[x]=S|A,A=N>>>26-g}A&&(this.words[x]=A,this.length++)}if(u!==0){for(x=this.length-1;x>=0;x--)this.words[x+u]=this.words[x];for(x=0;x<u;x++)this.words[x]=0;this.length+=u}return this.strip()},n.prototype.ishln=function(a){return s(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,g,u){s(typeof a=="number"&&a>=0);var d;g?d=(g-g%26)/26:d=0;var x=a%26,A=Math.min((a-x)/26,this.length),N=67108863^67108863>>>x<<x,S=u;if(d-=A,d=Math.max(0,d),S){for(var c=0;c<A;c++)S.words[c]=this.words[c];S.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var _=0;for(c=this.length-1;c>=0&&(_!==0||c>=d);c--){var C=this.words[c]|0;this.words[c]=_<<26-x|C>>>x,_=C&N}return S&&_!==0&&(S.words[S.length++]=_),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(a,g,u){return s(this.negative===0),this.iushrn(a,g,u)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return!1;var x=this.words[u];return!!(x&d)},n.prototype.imaskn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(g!==0&&u++,this.length=Math.min(u,this.length),g!==0){var d=67108863^67108863>>>g<<g;this.words[this.length-1]&=d}return this.strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return s(typeof a=="number"),s(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},n.prototype.isubn=function(a){if(s(typeof a=="number"),s(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this.strip()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,g,u){var d=a.length+u,x;this._expand(d);var A,N=0;for(x=0;x<a.length;x++){A=(this.words[x+u]|0)+N;var S=(a.words[x]|0)*g;A-=S&67108863,N=(A>>26)-(S/67108864|0),this.words[x+u]=A&67108863}for(;x<this.length-u;x++)A=(this.words[x+u]|0)+N,N=A>>26,this.words[x+u]=A&67108863;if(N===0)return this.strip();for(s(N===-1),N=0,x=0;x<this.length;x++)A=-(this.words[x]|0)+N,N=A>>26,this.words[x]=A&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(a,g){var u=this.length-a.length,d=this.clone(),x=a,A=x.words[x.length-1]|0,N=this._countBits(A);u=26-N,u!==0&&(x=x.ushln(u),d.iushln(u),A=x.words[x.length-1]|0);var S=d.length-x.length,c;if(g!=="mod"){c=new n(null),c.length=S+1,c.words=Array(c.length);for(var _=0;_<c.length;_++)c.words[_]=0}var C=d.clone()._ishlnsubmul(x,1,S);C.negative===0&&(d=C,c&&(c.words[S]=1));for(var O=S-1;O>=0;O--){var D=(d.words[x.length+O]|0)*67108864+(d.words[x.length+O-1]|0);for(D=Math.min(D/A|0,67108863),d._ishlnsubmul(x,D,O);d.negative!==0;)D--,d.negative=0,d._ishlnsubmul(x,1,O),!d.isZero()&&(d.negative^=1);c&&(c.words[O]=D)}return c&&c.strip(),d.strip(),g!=="div"&&u!==0&&d.iushrn(u),{div:c||null,mod:d}},n.prototype.divmod=function(a,g,u){if(s(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var d,x,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,g),g!=="mod"&&(d=A.div.neg()),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.iadd(a)),{div:d,mod:x}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),g),g!=="mod"&&(d=A.div.neg()),{div:d,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),g),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.isub(a)),{div:A.div,mod:x}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?g==="div"?{div:this.divn(a.words[0]),mod:null}:g==="mod"?{div:null,mod:new n(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modn(a.words[0]))}:this._wordDiv(a,g)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var g=this.divmod(a);if(g.mod.isZero())return g.div;var u=g.div.negative!==0?g.mod.isub(a):g.mod,d=a.ushrn(1),x=a.andln(1),A=u.cmp(d);return A<0||x===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},n.prototype.modn=function(a){s(a<=67108863);for(var g=67108864%a,u=0,d=this.length-1;d>=0;d--)u=(g*u+(this.words[d]|0))%a;return u},n.prototype.idivn=function(a){s(a<=67108863);for(var g=0,u=this.length-1;u>=0;u--){var d=(this.words[u]|0)+g*67108864;this.words[u]=d/a|0,g=d%a}return this.strip()},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=new n(0),N=new n(1),S=0;g.isEven()&&u.isEven();)g.iushrn(1),u.iushrn(1),++S;for(var c=u.clone(),_=g.clone();!g.isZero();){for(var C=0,O=1;(g.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(g.iushrn(C);C-- >0;)(d.isOdd()||x.isOdd())&&(d.iadd(c),x.isub(_)),d.iushrn(1),x.iushrn(1);for(var D=0,B=1;(u.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(u.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(c),N.isub(_)),A.iushrn(1),N.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(A),x.isub(N)):(u.isub(g),A.isub(d),N.isub(x))}return{a:A,b:N,gcd:u.iushln(S)}},n.prototype._invmp=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=u.clone();g.cmpn(1)>0&&u.cmpn(1)>0;){for(var N=0,S=1;(g.words[0]&S)===0&&N<26;++N,S<<=1);if(N>0)for(g.iushrn(N);N-- >0;)d.isOdd()&&d.iadd(A),d.iushrn(1);for(var c=0,_=1;(u.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(u.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(x)):(u.isub(g),x.isub(d))}var C;return g.cmpn(1)===0?C=d:C=x,C.cmpn(0)<0&&C.iadd(a),C},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var g=this.clone(),u=a.clone();g.negative=0,u.negative=0;for(var d=0;g.isEven()&&u.isEven();d++)g.iushrn(1),u.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;u.isEven();)u.iushrn(1);var x=g.cmp(u);if(x<0){var A=g;g=u,u=A}else if(x===0||u.cmpn(1)===0)break;g.isub(u)}while(!0);return u.iushln(d)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){s(typeof a=="number");var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return this._expand(u+1),this.words[u]|=d,this;for(var x=d,A=u;x!==0&&A<this.length;A++){var N=this.words[A]|0;N+=x,x=N>>>26,N&=67108863,this.words[A]=N}return x!==0&&(this.words[A]=x,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var g=a<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this.strip();var u;if(this.length>1)u=1;else{g&&(a=-a),s(a<=67108863,"Number is too big");var d=this.words[0]|0;u=d===a?0:d<a?-1:1}return this.negative!==0?-u|0:u},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var g=this.ucmp(a);return this.negative!==0?-g|0:g},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var g=0,u=this.length-1;u>=0;u--){var d=this.words[u]|0,x=a.words[u]|0;if(d!==x){d<x?g=-1:d>x&&(g=1);break}}return g},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new F(a)},n.prototype.toRed=function(a){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return s(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return s(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var P={k256:null,p224:null,p192:null,p25519:null};function j(a,g){this.name=a,this.p=new n(g,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(j,"c"),j.prototype._tmp=function(){var a=new n(null);return a.words=Array(Math.ceil(this.n/13)),a},j.prototype.ireduce=function(a){var g=a,u;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),u=g.bitLength();while(u>this.n);var d=u<this.n?-1:g.ucmp(this.p);return d===0?(g.words[0]=0,g.length=1):d>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(a,g){a.iushrn(this.n,0,g)},j.prototype.imulK=function(a){return a.imul(this.k)};function L(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,"l"),f(L,j),L.prototype.split=function(a,g){for(var u=4194303,d=Math.min(a.length,9),x=0;x<d;x++)g.words[x]=a.words[x];if(g.length=d,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(g.words[g.length++]=A&u,x=10;x<a.length;x++){var N=a.words[x]|0;a.words[x-10]=(N&u)<<4|A>>>22,A=N}A>>>=22,a.words[x-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},L.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var g=0,u=0;u<a.length;u++){var d=a.words[u]|0;g+=d*977,a.words[u]=g&67108863,g=d*64+(g/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(U,"B"),f(U,j);function Z(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(Z,"s"),f(Z,j);function ne(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ne,"K8"),f(ne,j),ne.prototype.imulK=function(a){for(var g=0,u=0;u<a.length;u++){var d=(a.words[u]|0)*19+g,x=d&67108863;d>>>=26,a.words[u]=x,g=d}return g!==0&&(a.words[a.length++]=g),a},n._prime=function(a){if(P[a])return P[a];var g;if(a==="k256")g=new L;else if(a==="p224")g=new U;else if(a==="p192")g=new Z;else if(a==="p25519")g=new ne;else throw Error("Unknown prime "+a);return P[a]=g,g};function F(a){if(typeof a=="string"){var g=n._prime(a);this.m=g.p,this.prime=g}else s(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}o(F,"p"),F.prototype._verify1=function(a){s(a.negative===0,"red works only with positives"),s(a.red,"red works only with red numbers")},F.prototype._verify2=function(a,g){s((a.negative|g.negative)===0,"red works only with positives"),s(a.red&&a.red===g.red,"red works only with red numbers")},F.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},F.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},F.prototype.add=function(a,g){this._verify2(a,g);var u=a.add(g);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},F.prototype.iadd=function(a,g){this._verify2(a,g);var u=a.iadd(g);return u.cmp(this.m)>=0&&u.isub(this.m),u},F.prototype.sub=function(a,g){this._verify2(a,g);var u=a.sub(g);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},F.prototype.isub=function(a,g){this._verify2(a,g);var u=a.isub(g);return u.cmpn(0)<0&&u.iadd(this.m),u},F.prototype.shl=function(a,g){return this._verify1(a),this.imod(a.ushln(g))},F.prototype.imul=function(a,g){return this._verify2(a,g),this.imod(a.imul(g))},F.prototype.mul=function(a,g){return this._verify2(a,g),this.imod(a.mul(g))},F.prototype.isqr=function(a){return this.imul(a,a.clone())},F.prototype.sqr=function(a){return this.mul(a,a)},F.prototype.sqrt=function(a){if(a.isZero())return a.clone();var g=this.m.andln(3);if(s(g%2===1),g===3){var u=this.m.add(new n(1)).iushrn(2);return this.pow(a,u)}for(var d=this.m.subn(1),x=0;!d.isZero()&&d.andln(1)===0;)x++,d.iushrn(1);s(!d.isZero());var A=new n(1).toRed(this),N=A.redNeg(),S=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,S).cmp(N)!==0;)c.redIAdd(N);for(var _=this.pow(c,d),C=this.pow(a,d.addn(1).iushrn(1)),O=this.pow(a,d),D=x;O.cmp(A)!==0;){for(var B=O,z=0;B.cmp(A)!==0;z++)B=B.redSqr();s(z<D);var G=this.pow(_,new n(1).iushln(D-z-1));C=C.redMul(G),_=G.redSqr(),O=O.redMul(_),D=z}return C},F.prototype.invm=function(a){var g=a._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},F.prototype.pow=function(a,g){if(g.isZero())return new n(1).toRed(this);if(g.cmpn(1)===0)return a.clone();var u=4,d=Array(1<<u);d[0]=new n(1).toRed(this),d[1]=a;for(var x=2;x<d.length;x++)d[x]=this.mul(d[x-1],a);var A=d[0],N=0,S=0,c=g.bitLength()%26;for(c===0&&(c=26),x=g.length-1;x>=0;x--){for(var _=g.words[x],C=c-1;C>=0;C--){var O=_>>C&1;if(A!==d[0]&&(A=this.sqr(A)),O===0&&N===0){S=0;continue}N<<=1,N|=O,S++,!(S!==u&&(x!==0||C!==0))&&(A=this.mul(A,d[N]),S=0,N=0)}c=26}return A},F.prototype.convertTo=function(a){var g=a.umod(this.m);return g===a?g.clone():g},F.prototype.convertFrom=function(a){var g=a.clone();return g.red=null,g},n.mont=function(a){return new Y(a)};function Y(a){F.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"D"),f(Y,F),Y.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},Y.prototype.convertFrom=function(a){var g=this.imod(a.mul(this.rinv));return g.red=null,g},Y.prototype.imul=function(a,g){if(a.isZero()||g.isZero())return a.words[0]=0,a.length=1,a;var u=a.imul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.mul=function(a,g){if(a.isZero()||g.isZero())return new n(0)._forceRed(this);var u=a.mul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.invm=function(a){var g=this.imod(a._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(typeof e>"u"||e,t)}),K0=nt((t,e)=>{var r=Y0(),i=Q0();e.exports=function(v){return new f(v)};var s={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};s.p224=s.secp224r1,s.p256=s.secp256r1=s.prime256v1,s.p192=s.secp192r1=s.prime192v1,s.p384=s.secp384r1,s.p521=s.secp521r1;function f(v){this.curveType=s[v],!this.curveType&&(this.curveType={name:v}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}o(f,"O"),f.prototype.generateKeys=function(v,b){return this.keys=this.curve.genKeyPair(),this.getPublicKey(v,b)},f.prototype.computeSecret=function(v,b,h){b=b||"utf8",!Buffer.isBuffer(v)&&(v=new Buffer(v,b));var m=this.curve.keyFromPublic(v).getPublic(),l=m.mul(this.keys.getPrivate()).getX();return n(l,h,this.curveType.byteLength)},f.prototype.getPublicKey=function(v,b){var h=this.keys.getPublic(b==="compressed",!0);return b==="hybrid"&&(h[h.length-1]%2?h[0]=7:h[0]=6),n(h,v)},f.prototype.getPrivateKey=function(v){return n(this.keys.getPrivate(),v)},f.prototype.setPublicKey=function(v,b){return b=b||"utf8",!Buffer.isBuffer(v)&&(v=new Buffer(v,b)),this.keys._importPublic(v),this},f.prototype.setPrivateKey=function(v,b){b=b||"utf8",!Buffer.isBuffer(v)&&(v=new Buffer(v,b));var h=new i(v);return h=h.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(h),this};function n(v,b,h){Array.isArray(v)||(v=v.toArray());var m=new Buffer(v);if(h&&m.length<h){var l=new Buffer(h-m.length);l.fill(0),m=Buffer.concat([l,m])}return b?m.toString(b):m}o(n,"Y")}),X0=nt((t,e)=>{var r=(qt(),bt(Jt)).createECDH;e.exports=r||K0()}),W0=nt((t,e)=>{(function(r,i){function s(a,g){if(!a)throw Error(g||"Assertion failed")}o(s,"P");function f(a,g){a.super_=g;var u=o(function(){},"W");u.prototype=g.prototype,a.prototype=new u,a.prototype.constructor=a}o(f,"O");function n(a,g,u){if(n.isBN(a))return a;this.negative=0,this.words=null,this.length=0,this.red=null,a!==null&&((g==="le"||g==="be")&&(u=g,g=10),this._init(a||0,g||10,u||"be"))}o(n,"Y"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,g){return a.cmp(g)>0?a:g},n.min=function(a,g){return a.cmp(g)<0?a:g},n.prototype._init=function(a,g,u){if(typeof a=="number")return this._initNumber(a,g,u);if(typeof a=="object")return this._initArray(a,g,u);g==="hex"&&(g=16),s(g===(g|0)&&g>=2&&g<=36),a=a.toString().replace(/\s+/g,"");var d=0;a[0]==="-"&&(d++,this.negative=1),d<a.length&&(g===16?this._parseHex(a,d,u):(this._parseBase(a,g,d),u==="le"&&this._initArray(this.toArray(),g,u)))},n.prototype._initNumber=function(a,g,u){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(s(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),g,u)},n.prototype._initArray=function(a,g,u){if(s(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x,A,N=0;if(u==="be")for(d=a.length-1,x=0;d>=0;d-=3)A=a[d]|a[d-1]<<8|a[d-2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);else if(u==="le")for(d=0,x=0;d<a.length;d+=3)A=a[d]|a[d+1]<<8|a[d+2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);return this.strip()};function b(a,g){var u=a.charCodeAt(g);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}o(b,"v");function h(a,g,u){var d=b(a,u);return u-1>=g&&(d|=b(a,u-1)<<4),d}o(h,"w"),n.prototype._parseHex=function(a,g,u){this.length=Math.ceil((a.length-g)/6),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x=0,A=0,N;if(u==="be")for(d=a.length-1;d>=g;d-=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8;else{var S=a.length-g;for(d=S%2===0?g+1:g;d<a.length;d+=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8}this.strip()};function m(a,g,u,d){for(var x=0,A=Math.min(a.length,u),N=g;N<A;N++){var S=a.charCodeAt(N)-48;x*=d,S>=49?x+=S-49+10:S>=17?x+=S-17+10:x+=S}return x}o(m,"V"),n.prototype._parseBase=function(a,g,u){this.words=[0],this.length=1;for(var d=0,x=1;x<=67108863;x*=g)d++;d--,x=x/g|0;for(var A=a.length-u,N=A%d,S=Math.min(A,A-N)+u,c=0,_=u;_<S;_+=d)c=m(a,_,_+d,g),this.imuln(x),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(N!==0){var C=1;for(c=m(a,_,a.length,g),_=0;_<N;_++)C*=g;this.imuln(C),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(a){a.words=Array(this.length);for(var g=0;g<this.length;g++)a.words[g]=this.words[g];a.length=this.length,a.negative=this.negative,a.red=this.red},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(a,g){a=a||10,g=g|0||1;var u;if(a===16||a==="hex"){u="";for(var d=0,x=0,A=0;A<this.length;A++){var N=this.words[A],S=((N<<d|x)&16777215).toString(16);x=N>>>24-d&16777215,d+=2,d>=26&&(d-=26,A--),x!==0||A!==this.length-1?u=l[6-S.length]+S+u:u=S+u}for(x!==0&&(u=x.toString(16)+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(a===(a|0)&&a>=2&&a<=36){var c=w[a],_=p[a];u="";var C=this.clone();for(C.negative=0;!C.isZero();){var O=C.modn(_).toString(a);C=C.idivn(_),C.isZero()?u=O+u:u=l[c-O.length]+O+u}for(this.isZero()&&(u="0"+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(a,g){return s(typeof v<"u"),this.toArrayLike(v,a,g)},n.prototype.toArray=function(a,g){return this.toArrayLike(Array,a,g)},n.prototype.toArrayLike=function(a,g,u){var d=this.byteLength(),x=u||Math.max(1,d);s(d<=x,"byte array longer than desired length"),s(x>0,"Requested array length <= 0"),this.strip();var A=g==="le",N=new a(x),S,c,_=this.clone();if(A){for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[c]=S;for(;c<x;c++)N[c]=0}else{for(c=0;c<x-d;c++)N[c]=0;for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[x-c-1]=S}return N},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var g=a,u=0;return g>=4096&&(u+=13,g>>>=13),g>=64&&(u+=7,g>>>=7),g>=8&&(u+=4,g>>>=4),g>=2&&(u+=2,g>>>=2),u+g},n.prototype._zeroBits=function(a){if(a===0)return 26;var g=a,u=0;return(g&8191)===0&&(u+=13,g>>>=13),(g&127)===0&&(u+=7,g>>>=7),(g&15)===0&&(u+=4,g>>>=4),(g&3)===0&&(u+=2,g>>>=2),(g&1)===0&&u++,u},n.prototype.bitLength=function(){var a=this.words[this.length-1],g=this._countBits(a);return(this.length-1)*26+g};function y(a){for(var g=Array(a.bitLength()),u=0;u<g.length;u++){var d=u/26|0,x=u%26;g[u]=(a.words[d]&1<<x)>>>x}return g}o(y,"E"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,g=0;g<this.length;g++){var u=this._zeroBits(this.words[g]);if(a+=u,u!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var g=0;g<a.length;g++)this.words[g]=this.words[g]|a.words[g];return this.strip()},n.prototype.ior=function(a){return s((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var g;this.length>a.length?g=a:g=this;for(var u=0;u<g.length;u++)this.words[u]=this.words[u]&a.words[u];return this.length=g.length,this.strip()},n.prototype.iand=function(a){return s((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var g,u;this.length>a.length?(g=this,u=a):(g=a,u=this);for(var d=0;d<u.length;d++)this.words[d]=g.words[d]^u.words[d];if(this!==g)for(;d<g.length;d++)this.words[d]=g.words[d];return this.length=g.length,this.strip()},n.prototype.ixor=function(a){return s((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){s(typeof a=="number"&&a>=0);var g=Math.ceil(a/26)|0,u=a%26;this._expand(g),u>0&&g--;for(var d=0;d<g;d++)this.words[d]=~this.words[d]&67108863;return u>0&&(this.words[d]=~this.words[d]&67108863>>26-u),this.strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,g){s(typeof a=="number"&&a>=0);var u=a/26|0,d=a%26;return this._expand(u+1),g?this.words[u]=this.words[u]|1<<d:this.words[u]=this.words[u]&~(1<<d),this.strip()},n.prototype.iadd=function(a){var g;if(this.negative!==0&&a.negative===0)return this.negative=0,g=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,g=this.isub(a),a.negative=1,g._normSign();var u,d;this.length>a.length?(u=this,d=a):(u=a,d=this);for(var x=0,A=0;A<d.length;A++)g=(u.words[A]|0)+(d.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;for(;x!==0&&A<u.length;A++)g=(u.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;if(this.length=u.length,x!==0)this.words[this.length]=x,this.length++;else if(u!==this)for(;A<u.length;A++)this.words[A]=u.words[A];return this},n.prototype.add=function(a){var g;return a.negative!==0&&this.negative===0?(a.negative=0,g=this.sub(a),a.negative^=1,g):a.negative===0&&this.negative!==0?(this.negative=0,g=a.sub(this),this.negative=1,g):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var g=this.iadd(a);return a.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var u=this.cmp(a);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,x;u>0?(d=this,x=a):(d=a,x=this);for(var A=0,N=0;N<x.length;N++)g=(d.words[N]|0)-(x.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;for(;A!==0&&N<d.length;N++)g=(d.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;if(A===0&&N<d.length&&d!==this)for(;N<d.length;N++)this.words[N]=d.words[N];return this.length=Math.max(this.length,N),d!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function M(a,g,u){u.negative=g.negative^a.negative;var d=a.length+g.length|0;u.length=d,d=d-1|0;var x=a.words[0]|0,A=g.words[0]|0,N=x*A,S=N&67108863,c=N/67108864|0;u.words[0]=S;for(var _=1;_<d;_++){for(var C=c>>>26,O=c&67108863,D=Math.min(_,g.length-1),B=Math.max(0,_-a.length+1);B<=D;B++){var z=_-B|0;x=a.words[z]|0,A=g.words[B]|0,N=x*A+O,C+=N/67108864|0,O=N&67108863}u.words[_]=O|0,c=C|0}return c!==0?u.words[_]=c|0:u.length--,u.strip()}o(M,"I");var E=o(function(a,g,u){var d=a.words,x=g.words,A=u.words,N=0,S,c,_,C=d[0]|0,O=C&8191,D=C>>>13,B=d[1]|0,z=B&8191,G=B>>>13,te=d[2]|0,$=te&8191,q=te>>>13,Ce=d[3]|0,fe=Ce&8191,ae=Ce>>>13,be=d[4]|0,H=be&8191,ee=be>>>13,Q=d[5]|0,X=Q&8191,se=Q>>>13,Ne=d[6]|0,we=Ne&8191,ue=Ne>>>13,K=d[7]|0,W=K&8191,J=K>>>13,pe=d[8]|0,le=pe&8191,oe=pe>>>13,Ve=d[9]|0,_e=Ve&8191,Le=Ve>>>13,qe=x[0]|0,ge=qe&8191,De=qe>>>13,he=x[1]|0,ve=he&8191,Oe=he>>>13,je=x[2]|0,ke=je&8191,Fe=je>>>13,et=x[3]|0,Ie=et&8191,Se=et>>>13,Be=x[4]|0,Ee=Be&8191,Ue=Be>>>13,Je=x[5]|0,re=Je&8191,de=Je>>>13,Pe=x[6]|0,Me=Pe&8191,Re=Pe>>>13,Ke=x[7]|0,ie=Ke&8191,Ae=Ke>>>13,Ye=x[8]|0,me=Ye&8191,Qe=Ye>>>13,st=x[9]|0,ze=st&8191,We=st>>>13;u.negative=a.negative^g.negative,u.length=19,S=Math.imul(O,ge),c=Math.imul(O,De),c=c+Math.imul(D,ge)|0,_=Math.imul(D,De);var Te=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,S=Math.imul(z,ge),c=Math.imul(z,De),c=c+Math.imul(G,ge)|0,_=Math.imul(G,De),S=S+Math.imul(O,ve)|0,c=c+Math.imul(O,Oe)|0,c=c+Math.imul(D,ve)|0,_=_+Math.imul(D,Oe)|0;var Ze=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,S=Math.imul($,ge),c=Math.imul($,De),c=c+Math.imul(q,ge)|0,_=Math.imul(q,De),S=S+Math.imul(z,ve)|0,c=c+Math.imul(z,Oe)|0,c=c+Math.imul(G,ve)|0,_=_+Math.imul(G,Oe)|0,S=S+Math.imul(O,ke)|0,c=c+Math.imul(O,Fe)|0,c=c+Math.imul(D,ke)|0,_=_+Math.imul(D,Fe)|0;var lt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(fe,ge),c=Math.imul(fe,De),c=c+Math.imul(ae,ge)|0,_=Math.imul(ae,De),S=S+Math.imul($,ve)|0,c=c+Math.imul($,Oe)|0,c=c+Math.imul(q,ve)|0,_=_+Math.imul(q,Oe)|0,S=S+Math.imul(z,ke)|0,c=c+Math.imul(z,Fe)|0,c=c+Math.imul(G,ke)|0,_=_+Math.imul(G,Fe)|0,S=S+Math.imul(O,Ie)|0,c=c+Math.imul(O,Se)|0,c=c+Math.imul(D,Ie)|0,_=_+Math.imul(D,Se)|0;var yt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(yt>>>26)|0,yt&=67108863,S=Math.imul(H,ge),c=Math.imul(H,De),c=c+Math.imul(ee,ge)|0,_=Math.imul(ee,De),S=S+Math.imul(fe,ve)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(ae,ve)|0,_=_+Math.imul(ae,Oe)|0,S=S+Math.imul($,ke)|0,c=c+Math.imul($,Fe)|0,c=c+Math.imul(q,ke)|0,_=_+Math.imul(q,Fe)|0,S=S+Math.imul(z,Ie)|0,c=c+Math.imul(z,Se)|0,c=c+Math.imul(G,Ie)|0,_=_+Math.imul(G,Se)|0,S=S+Math.imul(O,Ee)|0,c=c+Math.imul(O,Ue)|0,c=c+Math.imul(D,Ee)|0,_=_+Math.imul(D,Ue)|0;var ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(X,ge),c=Math.imul(X,De),c=c+Math.imul(se,ge)|0,_=Math.imul(se,De),S=S+Math.imul(H,ve)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(ee,ve)|0,_=_+Math.imul(ee,Oe)|0,S=S+Math.imul(fe,ke)|0,c=c+Math.imul(fe,Fe)|0,c=c+Math.imul(ae,ke)|0,_=_+Math.imul(ae,Fe)|0,S=S+Math.imul($,Ie)|0,c=c+Math.imul($,Se)|0,c=c+Math.imul(q,Ie)|0,_=_+Math.imul(q,Se)|0,S=S+Math.imul(z,Ee)|0,c=c+Math.imul(z,Ue)|0,c=c+Math.imul(G,Ee)|0,_=_+Math.imul(G,Ue)|0,S=S+Math.imul(O,re)|0,c=c+Math.imul(O,de)|0,c=c+Math.imul(D,re)|0,_=_+Math.imul(D,de)|0;var Nt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S=Math.imul(we,ge),c=Math.imul(we,De),c=c+Math.imul(ue,ge)|0,_=Math.imul(ue,De),S=S+Math.imul(X,ve)|0,c=c+Math.imul(X,Oe)|0,c=c+Math.imul(se,ve)|0,_=_+Math.imul(se,Oe)|0,S=S+Math.imul(H,ke)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(ee,ke)|0,_=_+Math.imul(ee,Fe)|0,S=S+Math.imul(fe,Ie)|0,c=c+Math.imul(fe,Se)|0,c=c+Math.imul(ae,Ie)|0,_=_+Math.imul(ae,Se)|0,S=S+Math.imul($,Ee)|0,c=c+Math.imul($,Ue)|0,c=c+Math.imul(q,Ee)|0,_=_+Math.imul(q,Ue)|0,S=S+Math.imul(z,re)|0,c=c+Math.imul(z,de)|0,c=c+Math.imul(G,re)|0,_=_+Math.imul(G,de)|0,S=S+Math.imul(O,Me)|0,c=c+Math.imul(O,Re)|0,c=c+Math.imul(D,Me)|0,_=_+Math.imul(D,Re)|0;var Dt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(W,ge),c=Math.imul(W,De),c=c+Math.imul(J,ge)|0,_=Math.imul(J,De),S=S+Math.imul(we,ve)|0,c=c+Math.imul(we,Oe)|0,c=c+Math.imul(ue,ve)|0,_=_+Math.imul(ue,Oe)|0,S=S+Math.imul(X,ke)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(se,ke)|0,_=_+Math.imul(se,Fe)|0,S=S+Math.imul(H,Ie)|0,c=c+Math.imul(H,Se)|0,c=c+Math.imul(ee,Ie)|0,_=_+Math.imul(ee,Se)|0,S=S+Math.imul(fe,Ee)|0,c=c+Math.imul(fe,Ue)|0,c=c+Math.imul(ae,Ee)|0,_=_+Math.imul(ae,Ue)|0,S=S+Math.imul($,re)|0,c=c+Math.imul($,de)|0,c=c+Math.imul(q,re)|0,_=_+Math.imul(q,de)|0,S=S+Math.imul(z,Me)|0,c=c+Math.imul(z,Re)|0,c=c+Math.imul(G,Me)|0,_=_+Math.imul(G,Re)|0,S=S+Math.imul(O,ie)|0,c=c+Math.imul(O,Ae)|0,c=c+Math.imul(D,ie)|0,_=_+Math.imul(D,Ae)|0;var Ct=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,S=Math.imul(le,ge),c=Math.imul(le,De),c=c+Math.imul(oe,ge)|0,_=Math.imul(oe,De),S=S+Math.imul(W,ve)|0,c=c+Math.imul(W,Oe)|0,c=c+Math.imul(J,ve)|0,_=_+Math.imul(J,Oe)|0,S=S+Math.imul(we,ke)|0,c=c+Math.imul(we,Fe)|0,c=c+Math.imul(ue,ke)|0,_=_+Math.imul(ue,Fe)|0,S=S+Math.imul(X,Ie)|0,c=c+Math.imul(X,Se)|0,c=c+Math.imul(se,Ie)|0,_=_+Math.imul(se,Se)|0,S=S+Math.imul(H,Ee)|0,c=c+Math.imul(H,Ue)|0,c=c+Math.imul(ee,Ee)|0,_=_+Math.imul(ee,Ue)|0,S=S+Math.imul(fe,re)|0,c=c+Math.imul(fe,de)|0,c=c+Math.imul(ae,re)|0,_=_+Math.imul(ae,de)|0,S=S+Math.imul($,Me)|0,c=c+Math.imul($,Re)|0,c=c+Math.imul(q,Me)|0,_=_+Math.imul(q,Re)|0,S=S+Math.imul(z,ie)|0,c=c+Math.imul(z,Ae)|0,c=c+Math.imul(G,ie)|0,_=_+Math.imul(G,Ae)|0,S=S+Math.imul(O,me)|0,c=c+Math.imul(O,Qe)|0,c=c+Math.imul(D,me)|0,_=_+Math.imul(D,Qe)|0;var St=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(St>>>26)|0,St&=67108863,S=Math.imul(_e,ge),c=Math.imul(_e,De),c=c+Math.imul(Le,ge)|0,_=Math.imul(Le,De),S=S+Math.imul(le,ve)|0,c=c+Math.imul(le,Oe)|0,c=c+Math.imul(oe,ve)|0,_=_+Math.imul(oe,Oe)|0,S=S+Math.imul(W,ke)|0,c=c+Math.imul(W,Fe)|0,c=c+Math.imul(J,ke)|0,_=_+Math.imul(J,Fe)|0,S=S+Math.imul(we,Ie)|0,c=c+Math.imul(we,Se)|0,c=c+Math.imul(ue,Ie)|0,_=_+Math.imul(ue,Se)|0,S=S+Math.imul(X,Ee)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(se,Ee)|0,_=_+Math.imul(se,Ue)|0,S=S+Math.imul(H,re)|0,c=c+Math.imul(H,de)|0,c=c+Math.imul(ee,re)|0,_=_+Math.imul(ee,de)|0,S=S+Math.imul(fe,Me)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(ae,Me)|0,_=_+Math.imul(ae,Re)|0,S=S+Math.imul($,ie)|0,c=c+Math.imul($,Ae)|0,c=c+Math.imul(q,ie)|0,_=_+Math.imul(q,Ae)|0,S=S+Math.imul(z,me)|0,c=c+Math.imul(z,Qe)|0,c=c+Math.imul(G,me)|0,_=_+Math.imul(G,Qe)|0,S=S+Math.imul(O,ze)|0,c=c+Math.imul(O,We)|0,c=c+Math.imul(D,ze)|0,_=_+Math.imul(D,We)|0;var Ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,S=Math.imul(_e,ve),c=Math.imul(_e,Oe),c=c+Math.imul(Le,ve)|0,_=Math.imul(Le,Oe),S=S+Math.imul(le,ke)|0,c=c+Math.imul(le,Fe)|0,c=c+Math.imul(oe,ke)|0,_=_+Math.imul(oe,Fe)|0,S=S+Math.imul(W,Ie)|0,c=c+Math.imul(W,Se)|0,c=c+Math.imul(J,Ie)|0,_=_+Math.imul(J,Se)|0,S=S+Math.imul(we,Ee)|0,c=c+Math.imul(we,Ue)|0,c=c+Math.imul(ue,Ee)|0,_=_+Math.imul(ue,Ue)|0,S=S+Math.imul(X,re)|0,c=c+Math.imul(X,de)|0,c=c+Math.imul(se,re)|0,_=_+Math.imul(se,de)|0,S=S+Math.imul(H,Me)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(ee,Me)|0,_=_+Math.imul(ee,Re)|0,S=S+Math.imul(fe,ie)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(ae,ie)|0,_=_+Math.imul(ae,Ae)|0,S=S+Math.imul($,me)|0,c=c+Math.imul($,Qe)|0,c=c+Math.imul(q,me)|0,_=_+Math.imul(q,Qe)|0,S=S+Math.imul(z,ze)|0,c=c+Math.imul(z,We)|0,c=c+Math.imul(G,ze)|0,_=_+Math.imul(G,We)|0;var Vt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,S=Math.imul(_e,ke),c=Math.imul(_e,Fe),c=c+Math.imul(Le,ke)|0,_=Math.imul(Le,Fe),S=S+Math.imul(le,Ie)|0,c=c+Math.imul(le,Se)|0,c=c+Math.imul(oe,Ie)|0,_=_+Math.imul(oe,Se)|0,S=S+Math.imul(W,Ee)|0,c=c+Math.imul(W,Ue)|0,c=c+Math.imul(J,Ee)|0,_=_+Math.imul(J,Ue)|0,S=S+Math.imul(we,re)|0,c=c+Math.imul(we,de)|0,c=c+Math.imul(ue,re)|0,_=_+Math.imul(ue,de)|0,S=S+Math.imul(X,Me)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(se,Me)|0,_=_+Math.imul(se,Re)|0,S=S+Math.imul(H,ie)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(ee,ie)|0,_=_+Math.imul(ee,Ae)|0,S=S+Math.imul(fe,me)|0,c=c+Math.imul(fe,Qe)|0,c=c+Math.imul(ae,me)|0,_=_+Math.imul(ae,Qe)|0,S=S+Math.imul($,ze)|0,c=c+Math.imul($,We)|0,c=c+Math.imul(q,ze)|0,_=_+Math.imul(q,We)|0;var Pt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,S=Math.imul(_e,Ie),c=Math.imul(_e,Se),c=c+Math.imul(Le,Ie)|0,_=Math.imul(Le,Se),S=S+Math.imul(le,Ee)|0,c=c+Math.imul(le,Ue)|0,c=c+Math.imul(oe,Ee)|0,_=_+Math.imul(oe,Ue)|0,S=S+Math.imul(W,re)|0,c=c+Math.imul(W,de)|0,c=c+Math.imul(J,re)|0,_=_+Math.imul(J,de)|0,S=S+Math.imul(we,Me)|0,c=c+Math.imul(we,Re)|0,c=c+Math.imul(ue,Me)|0,_=_+Math.imul(ue,Re)|0,S=S+Math.imul(X,ie)|0,c=c+Math.imul(X,Ae)|0,c=c+Math.imul(se,ie)|0,_=_+Math.imul(se,Ae)|0,S=S+Math.imul(H,me)|0,c=c+Math.imul(H,Qe)|0,c=c+Math.imul(ee,me)|0,_=_+Math.imul(ee,Qe)|0,S=S+Math.imul(fe,ze)|0,c=c+Math.imul(fe,We)|0,c=c+Math.imul(ae,ze)|0,_=_+Math.imul(ae,We)|0;var Ft=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,S=Math.imul(_e,Ee),c=Math.imul(_e,Ue),c=c+Math.imul(Le,Ee)|0,_=Math.imul(Le,Ue),S=S+Math.imul(le,re)|0,c=c+Math.imul(le,de)|0,c=c+Math.imul(oe,re)|0,_=_+Math.imul(oe,de)|0,S=S+Math.imul(W,Me)|0,c=c+Math.imul(W,Re)|0,c=c+Math.imul(J,Me)|0,_=_+Math.imul(J,Re)|0,S=S+Math.imul(we,ie)|0,c=c+Math.imul(we,Ae)|0,c=c+Math.imul(ue,ie)|0,_=_+Math.imul(ue,Ae)|0,S=S+Math.imul(X,me)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(se,me)|0,_=_+Math.imul(se,Qe)|0,S=S+Math.imul(H,ze)|0,c=c+Math.imul(H,We)|0,c=c+Math.imul(ee,ze)|0,_=_+Math.imul(ee,We)|0;var Tt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,S=Math.imul(_e,re),c=Math.imul(_e,de),c=c+Math.imul(Le,re)|0,_=Math.imul(Le,de),S=S+Math.imul(le,Me)|0,c=c+Math.imul(le,Re)|0,c=c+Math.imul(oe,Me)|0,_=_+Math.imul(oe,Re)|0,S=S+Math.imul(W,ie)|0,c=c+Math.imul(W,Ae)|0,c=c+Math.imul(J,ie)|0,_=_+Math.imul(J,Ae)|0,S=S+Math.imul(we,me)|0,c=c+Math.imul(we,Qe)|0,c=c+Math.imul(ue,me)|0,_=_+Math.imul(ue,Qe)|0,S=S+Math.imul(X,ze)|0,c=c+Math.imul(X,We)|0,c=c+Math.imul(se,ze)|0,_=_+Math.imul(se,We)|0;var jt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(jt>>>26)|0,jt&=67108863,S=Math.imul(_e,Me),c=Math.imul(_e,Re),c=c+Math.imul(Le,Me)|0,_=Math.imul(Le,Re),S=S+Math.imul(le,ie)|0,c=c+Math.imul(le,Ae)|0,c=c+Math.imul(oe,ie)|0,_=_+Math.imul(oe,Ae)|0,S=S+Math.imul(W,me)|0,c=c+Math.imul(W,Qe)|0,c=c+Math.imul(J,me)|0,_=_+Math.imul(J,Qe)|0,S=S+Math.imul(we,ze)|0,c=c+Math.imul(we,We)|0,c=c+Math.imul(ue,ze)|0,_=_+Math.imul(ue,We)|0;var Ut=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,S=Math.imul(_e,ie),c=Math.imul(_e,Ae),c=c+Math.imul(Le,ie)|0,_=Math.imul(Le,Ae),S=S+Math.imul(le,me)|0,c=c+Math.imul(le,Qe)|0,c=c+Math.imul(oe,me)|0,_=_+Math.imul(oe,Qe)|0,S=S+Math.imul(W,ze)|0,c=c+Math.imul(W,We)|0,c=c+Math.imul(J,ze)|0,_=_+Math.imul(J,We)|0;var Zt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,S=Math.imul(_e,me),c=Math.imul(_e,Qe),c=c+Math.imul(Le,me)|0,_=Math.imul(Le,Qe),S=S+Math.imul(le,ze)|0,c=c+Math.imul(le,We)|0,c=c+Math.imul(oe,ze)|0,_=_+Math.imul(oe,We)|0;var Gt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,S=Math.imul(_e,ze),c=Math.imul(_e,We),c=c+Math.imul(Le,ze)|0,_=Math.imul(Le,We);var Yt=(N+S|0)+((c&8191)<<13)|0;return N=(_+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,A[0]=Te,A[1]=Ze,A[2]=lt,A[3]=yt,A[4]=ht,A[5]=Nt,A[6]=Dt,A[7]=Ct,A[8]=St,A[9]=Ht,A[10]=Vt,A[11]=Pt,A[12]=Ft,A[13]=Tt,A[14]=jt,A[15]=Ut,A[16]=Zt,A[17]=Gt,A[18]=Yt,N!==0&&(A[19]=N,u.length++),u},"L");Math.imul||(E=M);function R(a,g,u){u.negative=g.negative^a.negative,u.length=a.length+g.length;for(var d=0,x=0,A=0;A<u.length-1;A++){var N=x;x=0;for(var S=d&67108863,c=Math.min(A,g.length-1),_=Math.max(0,A-a.length+1);_<=c;_++){var C=A-_,O=a.words[C]|0,D=g.words[_]|0,B=O*D,z=B&67108863;N=N+(B/67108864|0)|0,z=z+S|0,S=z&67108863,N=N+(z>>>26)|0,x+=N>>>26,N&=67108863}u.words[A]=S,d=N,N=x}return d!==0?u.words[A]=d:u.length--,u.strip()}o(R,"h");function I(a,g,u){var d=new T;return d.mulp(a,g,u)}o(I,"b"),n.prototype.mulTo=function(a,g){var u,d=this.length+a.length;return this.length===10&&a.length===10?u=E(this,a,g):d<63?u=M(this,a,g):d<1024?u=R(this,a,g):u=I(this,a,g),u};function T(a,g){this.x=a,this.y=g}o(T,"y"),T.prototype.makeRBT=function(a){for(var g=Array(a),u=n.prototype._countBits(a)-1,d=0;d<a;d++)g[d]=this.revBin(d,u,a);return g},T.prototype.revBin=function(a,g,u){if(a===0||a===u-1)return a;for(var d=0,x=0;x<g;x++)d|=(a&1)<<g-x-1,a>>=1;return d},T.prototype.permute=function(a,g,u,d,x,A){for(var N=0;N<A;N++)d[N]=g[a[N]],x[N]=u[a[N]]},T.prototype.transform=function(a,g,u,d,x,A){this.permute(A,a,g,u,d,x);for(var N=1;N<x;N<<=1)for(var S=N<<1,c=Math.cos(2*Math.PI/S),_=Math.sin(2*Math.PI/S),C=0;C<x;C+=S)for(var O=c,D=_,B=0;B<N;B++){var z=u[C+B],G=d[C+B],te=u[C+B+N],$=d[C+B+N],q=O*te-D*$;$=O*$+D*te,te=q,u[C+B]=z+te,d[C+B]=G+$,u[C+B+N]=z-te,d[C+B+N]=G-$,B!==S&&(q=c*O-_*D,D=c*D+_*O,O=q)}},T.prototype.guessLen13b=function(a,g){var u=Math.max(g,a)|1,d=u&1,x=0;for(u=u/2|0;u;u=u>>>1)x++;return 1<<x+1+d},T.prototype.conjugate=function(a,g,u){if(!(u<=1))for(var d=0;d<u/2;d++){var x=a[d];a[d]=a[u-d-1],a[u-d-1]=x,x=g[d],g[d]=-g[u-d-1],g[u-d-1]=-x}},T.prototype.normalize13b=function(a,g){for(var u=0,d=0;d<g/2;d++){var x=Math.round(a[2*d+1]/g)*8192+Math.round(a[2*d]/g)+u;a[d]=x&67108863,x<67108864?u=0:u=x/67108864|0}return a},T.prototype.convert13b=function(a,g,u,d){for(var x=0,A=0;A<g;A++)x=x+(a[A]|0),u[2*A]=x&8191,x=x>>>13,u[2*A+1]=x&8191,x=x>>>13;for(A=2*g;A<d;++A)u[A]=0;s(x===0),s((x&-8192)===0)},T.prototype.stub=function(a){for(var g=Array(a),u=0;u<a;u++)g[u]=0;return g},T.prototype.mulp=function(a,g,u){var d=2*this.guessLen13b(a.length,g.length),x=this.makeRBT(d),A=this.stub(d),N=Array(d),S=Array(d),c=Array(d),_=Array(d),C=Array(d),O=Array(d),D=u.words;D.length=d,this.convert13b(a.words,a.length,N,d),this.convert13b(g.words,g.length,_,d),this.transform(N,A,S,c,d,x),this.transform(_,A,C,O,d,x);for(var B=0;B<d;B++){var z=S[B]*C[B]-c[B]*O[B];c[B]=S[B]*O[B]+c[B]*C[B],S[B]=z}return this.conjugate(S,c,d),this.transform(S,c,D,A,d,x),this.conjugate(D,A,d),this.normalize13b(D,d),u.negative=a.negative^g.negative,u.length=a.length+g.length,u.strip()},n.prototype.mul=function(a){var g=new n(null);return g.words=Array(this.length+a.length),this.mulTo(a,g)},n.prototype.mulf=function(a){var g=new n(null);return g.words=Array(this.length+a.length),I(this,a,g)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){s(typeof a=="number"),s(a<67108864);for(var g=0,u=0;u<this.length;u++){var d=(this.words[u]|0)*a,x=(d&67108863)+(g&67108863);g>>=26,g+=d/67108864|0,g+=x>>>26,this.words[u]=x&67108863}return g!==0&&(this.words[u]=g,this.length++),this.length=a===0?1:this.length,this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var g=y(a);if(g.length===0)return new n(1);for(var u=this,d=0;d<g.length&&g[d]===0;d++,u=u.sqr());if(++d<g.length)for(var x=u.sqr();d<g.length;d++,x=x.sqr())g[d]!==0&&(u=u.mul(x));return u},n.prototype.iushln=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=67108863>>>26-g<<26-g,x;if(g!==0){var A=0;for(x=0;x<this.length;x++){var N=this.words[x]&d,S=(this.words[x]|0)-N<<g;this.words[x]=S|A,A=N>>>26-g}A&&(this.words[x]=A,this.length++)}if(u!==0){for(x=this.length-1;x>=0;x--)this.words[x+u]=this.words[x];for(x=0;x<u;x++)this.words[x]=0;this.length+=u}return this.strip()},n.prototype.ishln=function(a){return s(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,g,u){s(typeof a=="number"&&a>=0);var d;g?d=(g-g%26)/26:d=0;var x=a%26,A=Math.min((a-x)/26,this.length),N=67108863^67108863>>>x<<x,S=u;if(d-=A,d=Math.max(0,d),S){for(var c=0;c<A;c++)S.words[c]=this.words[c];S.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var _=0;for(c=this.length-1;c>=0&&(_!==0||c>=d);c--){var C=this.words[c]|0;this.words[c]=_<<26-x|C>>>x,_=C&N}return S&&_!==0&&(S.words[S.length++]=_),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(a,g,u){return s(this.negative===0),this.iushrn(a,g,u)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return!1;var x=this.words[u];return!!(x&d)},n.prototype.imaskn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(g!==0&&u++,this.length=Math.min(u,this.length),g!==0){var d=67108863^67108863>>>g<<g;this.words[this.length-1]&=d}return this.strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return s(typeof a=="number"),s(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},n.prototype.isubn=function(a){if(s(typeof a=="number"),s(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this.strip()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,g,u){var d=a.length+u,x;this._expand(d);var A,N=0;for(x=0;x<a.length;x++){A=(this.words[x+u]|0)+N;var S=(a.words[x]|0)*g;A-=S&67108863,N=(A>>26)-(S/67108864|0),this.words[x+u]=A&67108863}for(;x<this.length-u;x++)A=(this.words[x+u]|0)+N,N=A>>26,this.words[x+u]=A&67108863;if(N===0)return this.strip();for(s(N===-1),N=0,x=0;x<this.length;x++)A=-(this.words[x]|0)+N,N=A>>26,this.words[x]=A&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(a,g){var u=this.length-a.length,d=this.clone(),x=a,A=x.words[x.length-1]|0,N=this._countBits(A);u=26-N,u!==0&&(x=x.ushln(u),d.iushln(u),A=x.words[x.length-1]|0);var S=d.length-x.length,c;if(g!=="mod"){c=new n(null),c.length=S+1,c.words=Array(c.length);for(var _=0;_<c.length;_++)c.words[_]=0}var C=d.clone()._ishlnsubmul(x,1,S);C.negative===0&&(d=C,c&&(c.words[S]=1));for(var O=S-1;O>=0;O--){var D=(d.words[x.length+O]|0)*67108864+(d.words[x.length+O-1]|0);for(D=Math.min(D/A|0,67108863),d._ishlnsubmul(x,D,O);d.negative!==0;)D--,d.negative=0,d._ishlnsubmul(x,1,O),!d.isZero()&&(d.negative^=1);c&&(c.words[O]=D)}return c&&c.strip(),d.strip(),g!=="div"&&u!==0&&d.iushrn(u),{div:c||null,mod:d}},n.prototype.divmod=function(a,g,u){if(s(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var d,x,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,g),g!=="mod"&&(d=A.div.neg()),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.iadd(a)),{div:d,mod:x}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),g),g!=="mod"&&(d=A.div.neg()),{div:d,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),g),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.isub(a)),{div:A.div,mod:x}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?g==="div"?{div:this.divn(a.words[0]),mod:null}:g==="mod"?{div:null,mod:new n(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modn(a.words[0]))}:this._wordDiv(a,g)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var g=this.divmod(a);if(g.mod.isZero())return g.div;var u=g.div.negative!==0?g.mod.isub(a):g.mod,d=a.ushrn(1),x=a.andln(1),A=u.cmp(d);return A<0||x===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},n.prototype.modn=function(a){s(a<=67108863);for(var g=67108864%a,u=0,d=this.length-1;d>=0;d--)u=(g*u+(this.words[d]|0))%a;return u},n.prototype.idivn=function(a){s(a<=67108863);for(var g=0,u=this.length-1;u>=0;u--){var d=(this.words[u]|0)+g*67108864;this.words[u]=d/a|0,g=d%a}return this.strip()},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=new n(0),N=new n(1),S=0;g.isEven()&&u.isEven();)g.iushrn(1),u.iushrn(1),++S;for(var c=u.clone(),_=g.clone();!g.isZero();){for(var C=0,O=1;(g.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(g.iushrn(C);C-- >0;)(d.isOdd()||x.isOdd())&&(d.iadd(c),x.isub(_)),d.iushrn(1),x.iushrn(1);for(var D=0,B=1;(u.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(u.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(c),N.isub(_)),A.iushrn(1),N.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(A),x.isub(N)):(u.isub(g),A.isub(d),N.isub(x))}return{a:A,b:N,gcd:u.iushln(S)}},n.prototype._invmp=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=u.clone();g.cmpn(1)>0&&u.cmpn(1)>0;){for(var N=0,S=1;(g.words[0]&S)===0&&N<26;++N,S<<=1);if(N>0)for(g.iushrn(N);N-- >0;)d.isOdd()&&d.iadd(A),d.iushrn(1);for(var c=0,_=1;(u.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(u.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(x)):(u.isub(g),x.isub(d))}var C;return g.cmpn(1)===0?C=d:C=x,C.cmpn(0)<0&&C.iadd(a),C},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var g=this.clone(),u=a.clone();g.negative=0,u.negative=0;for(var d=0;g.isEven()&&u.isEven();d++)g.iushrn(1),u.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;u.isEven();)u.iushrn(1);var x=g.cmp(u);if(x<0){var A=g;g=u,u=A}else if(x===0||u.cmpn(1)===0)break;g.isub(u)}while(!0);return u.iushln(d)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){s(typeof a=="number");var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return this._expand(u+1),this.words[u]|=d,this;for(var x=d,A=u;x!==0&&A<this.length;A++){var N=this.words[A]|0;N+=x,x=N>>>26,N&=67108863,this.words[A]=N}return x!==0&&(this.words[A]=x,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var g=a<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this.strip();var u;if(this.length>1)u=1;else{g&&(a=-a),s(a<=67108863,"Number is too big");var d=this.words[0]|0;u=d===a?0:d<a?-1:1}return this.negative!==0?-u|0:u},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var g=this.ucmp(a);return this.negative!==0?-g|0:g},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var g=0,u=this.length-1;u>=0;u--){var d=this.words[u]|0,x=a.words[u]|0;if(d!==x){d<x?g=-1:d>x&&(g=1);break}}return g},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new F(a)},n.prototype.toRed=function(a){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return s(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return s(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var P={k256:null,p224:null,p192:null,p25519:null};function j(a,g){this.name=a,this.p=new n(g,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(j,"c"),j.prototype._tmp=function(){var a=new n(null);return a.words=Array(Math.ceil(this.n/13)),a},j.prototype.ireduce=function(a){var g=a,u;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),u=g.bitLength();while(u>this.n);var d=u<this.n?-1:g.ucmp(this.p);return d===0?(g.words[0]=0,g.length=1):d>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(a,g){a.iushrn(this.n,0,g)},j.prototype.imulK=function(a){return a.imul(this.k)};function L(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,"l"),f(L,j),L.prototype.split=function(a,g){for(var u=4194303,d=Math.min(a.length,9),x=0;x<d;x++)g.words[x]=a.words[x];if(g.length=d,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(g.words[g.length++]=A&u,x=10;x<a.length;x++){var N=a.words[x]|0;a.words[x-10]=(N&u)<<4|A>>>22,A=N}A>>>=22,a.words[x-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},L.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var g=0,u=0;u<a.length;u++){var d=a.words[u]|0;g+=d*977,a.words[u]=g&67108863,g=d*64+(g/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(U,"B"),f(U,j);function Z(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(Z,"s"),f(Z,j);function ne(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ne,"K8"),f(ne,j),ne.prototype.imulK=function(a){for(var g=0,u=0;u<a.length;u++){var d=(a.words[u]|0)*19+g,x=d&67108863;d>>>=26,a.words[u]=x,g=d}return g!==0&&(a.words[a.length++]=g),a},n._prime=function(a){if(P[a])return P[a];var g;if(a==="k256")g=new L;else if(a==="p224")g=new U;else if(a==="p192")g=new Z;else if(a==="p25519")g=new ne;else throw Error("Unknown prime "+a);return P[a]=g,g};function F(a){if(typeof a=="string"){var g=n._prime(a);this.m=g.p,this.prime=g}else s(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}o(F,"p"),F.prototype._verify1=function(a){s(a.negative===0,"red works only with positives"),s(a.red,"red works only with red numbers")},F.prototype._verify2=function(a,g){s((a.negative|g.negative)===0,"red works only with positives"),s(a.red&&a.red===g.red,"red works only with red numbers")},F.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},F.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},F.prototype.add=function(a,g){this._verify2(a,g);var u=a.add(g);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},F.prototype.iadd=function(a,g){this._verify2(a,g);var u=a.iadd(g);return u.cmp(this.m)>=0&&u.isub(this.m),u},F.prototype.sub=function(a,g){this._verify2(a,g);var u=a.sub(g);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},F.prototype.isub=function(a,g){this._verify2(a,g);var u=a.isub(g);return u.cmpn(0)<0&&u.iadd(this.m),u},F.prototype.shl=function(a,g){return this._verify1(a),this.imod(a.ushln(g))},F.prototype.imul=function(a,g){return this._verify2(a,g),this.imod(a.imul(g))},F.prototype.mul=function(a,g){return this._verify2(a,g),this.imod(a.mul(g))},F.prototype.isqr=function(a){return this.imul(a,a.clone())},F.prototype.sqr=function(a){return this.mul(a,a)},F.prototype.sqrt=function(a){if(a.isZero())return a.clone();var g=this.m.andln(3);if(s(g%2===1),g===3){var u=this.m.add(new n(1)).iushrn(2);return this.pow(a,u)}for(var d=this.m.subn(1),x=0;!d.isZero()&&d.andln(1)===0;)x++,d.iushrn(1);s(!d.isZero());var A=new n(1).toRed(this),N=A.redNeg(),S=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,S).cmp(N)!==0;)c.redIAdd(N);for(var _=this.pow(c,d),C=this.pow(a,d.addn(1).iushrn(1)),O=this.pow(a,d),D=x;O.cmp(A)!==0;){for(var B=O,z=0;B.cmp(A)!==0;z++)B=B.redSqr();s(z<D);var G=this.pow(_,new n(1).iushln(D-z-1));C=C.redMul(G),_=G.redSqr(),O=O.redMul(_),D=z}return C},F.prototype.invm=function(a){var g=a._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},F.prototype.pow=function(a,g){if(g.isZero())return new n(1).toRed(this);if(g.cmpn(1)===0)return a.clone();var u=4,d=Array(1<<u);d[0]=new n(1).toRed(this),d[1]=a;for(var x=2;x<d.length;x++)d[x]=this.mul(d[x-1],a);var A=d[0],N=0,S=0,c=g.bitLength()%26;for(c===0&&(c=26),x=g.length-1;x>=0;x--){for(var _=g.words[x],C=c-1;C>=0;C--){var O=_>>C&1;if(A!==d[0]&&(A=this.sqr(A)),O===0&&N===0){S=0;continue}N<<=1,N|=O,S++,!(S!==u&&(x!==0||C!==0))&&(A=this.mul(A,d[N]),S=0,N=0)}c=26}return A},F.prototype.convertTo=function(a){var g=a.umod(this.m);return g===a?g.clone():g},F.prototype.convertFrom=function(a){var g=a.clone();return g.red=null,g},n.mont=function(a){return new Y(a)};function Y(a){F.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"D"),f(Y,F),Y.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},Y.prototype.convertFrom=function(a){var g=this.imod(a.mul(this.rinv));return g.red=null,g},Y.prototype.imul=function(a,g){if(a.isZero()||g.isZero())return a.words[0]=0,a.length=1,a;var u=a.imul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.mul=function(a,g){if(a.isZero()||g.isZero())return new n(0)._forceRed(this);var u=a.mul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.invm=function(a){var g=this.imod(a._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(typeof e>"u"||e,t)}),$0=nt(t=>{var e=xs(),r=Or(),i=t;i.define=function(f,n){return new s(f,n)};function s(f,n){this.name=f,this.body=n,this.decoders={},this.encoders={}}o(s,"P"),s.prototype._createNamed=function(f){var n;try{n=(()=>{throw new Error("Cannot require module vm")})().runInThisContext("(function "+this.name+`(entity) {
|
|
35
|
-
this._initNamed(entity);
|
|
36
|
-
})`)}catch{n=o(function(b){this._initNamed(b)},"z")}return r(n,f),n.prototype._initNamed=function(v){f.call(this,v)},new n(this)},s.prototype._getDecoder=function(f){return f=f||"der",!this.decoders.hasOwnProperty(f)&&(this.decoders[f]=this._createNamed(e.decoders[f])),this.decoders[f]},s.prototype.decode=function(f,n,v){return this._getDecoder(n).decode(f,v)},s.prototype._getEncoder=function(f){return f=f||"der",!this.encoders.hasOwnProperty(f)&&(this.encoders[f]=this._createNamed(e.encoders[f])),this.encoders[f]},s.prototype.encode=function(f,n,v){return this._getEncoder(n).encode(f,v)}}),J0=nt(t=>{var e=Or();function r(s){this._reporterState={obj:null,path:[],options:s||{},errors:[]}}o(r,"K"),t.Reporter=r,r.prototype.isError=function(s){return s instanceof i},r.prototype.save=function(){var s=this._reporterState;return{obj:s.obj,pathLen:s.path.length}},r.prototype.restore=function(s){var f=this._reporterState;f.obj=s.obj,f.path=f.path.slice(0,s.pathLen)},r.prototype.enterKey=function(s){return this._reporterState.path.push(s)},r.prototype.exitKey=function(s){var f=this._reporterState;f.path=f.path.slice(0,s-1)},r.prototype.leaveKey=function(s,f,n){var v=this._reporterState;this.exitKey(s),v.obj!==null&&(v.obj[f]=n)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){var s=this._reporterState,f=s.obj;return s.obj={},f},r.prototype.leaveObject=function(s){var f=this._reporterState,n=f.obj;return f.obj=s,n},r.prototype.error=function(s){var f,n=this._reporterState,v=s instanceof i;if(v?f=s:f=new i(n.path.map(function(b){return"["+JSON.stringify(b)+"]"}).join(""),s.message||s,s.stack),!n.options.partial)throw f;return v||n.errors.push(f),f},r.prototype.wrapResult=function(s){var f=this._reporterState;return f.options.partial?{result:this.isError(s)?null:s,errors:f.errors}:s};function i(s,f){this.path=s,this.rethrow(f)}o(i,"_"),e(i,Error),i.prototype.rethrow=function(s){if(this.message=s+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw Error(this.message)}catch(f){this.stack=f.stack}return this}}),Hc=nt(t=>{var e=Or(),r=ws().Reporter,i=(sr(),bt(er)).Buffer;function s(n,v){if(r.call(this,v),!i.isBuffer(n)){this.error("Input not Buffer");return}this.base=n,this.offset=0,this.length=n.length}o(s,"P"),e(s,r),t.DecoderBuffer=s,s.prototype.save=function(){return{offset:this.offset,reporter:r.prototype.save.call(this)}},s.prototype.restore=function(n){var v=new s(this.base);return v.offset=n.offset,v.length=this.offset,this.offset=n.offset,r.prototype.restore.call(this,n.reporter),v},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(n){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(n||"DecoderBuffer overrun")},s.prototype.skip=function(n,v){if(!(this.offset+n<=this.length))return this.error(v||"DecoderBuffer overrun");var b=new s(this.base);return b._reporterState=this._reporterState,b.offset=this.offset,b.length=this.offset+n,this.offset+=n,b},s.prototype.raw=function(n){return this.base.slice(n?n.offset:this.offset,this.length)};function f(n,v){if(Array.isArray(n))this.length=0,this.value=n.map(function(b){return b instanceof f||(b=new f(b,v)),this.length+=b.length,b},this);else if(typeof n=="number"){if(!(0<=n&&n<=255))return v.error("non-byte EncoderBuffer value");this.value=n,this.length=1}else if(typeof n=="string")this.value=n,this.length=i.byteLength(n);else if(i.isBuffer(n))this.value=n,this.length=n.length;else return v.error("Unsupported type: "+typeof n)}o(f,"O"),t.EncoderBuffer=f,f.prototype.join=function(n,v){return n||(n=new i(this.length)),v||(v=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(b){b.join(n,v),v+=b.length}):(typeof this.value=="number"?n[v]=this.value:typeof this.value=="string"?n.write(this.value,v):i.isBuffer(this.value)&&this.value.copy(n,v),v+=this.length)),n}}),q0=nt((t,e)=>{var r=ws().Reporter,i=ws().EncoderBuffer,s=ws().DecoderBuffer,f=Bi(),n=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],v=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(n),b=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function h(l,w){var p={};this._baseState=p,p.enc=l,p.parent=w||null,p.children=null,p.tag=null,p.args=null,p.reverseArgs=null,p.choice=null,p.optional=!1,p.any=!1,p.obj=!1,p.use=null,p.useDecoder=null,p.key=null,p.default=null,p.explicit=null,p.implicit=null,p.contains=null,!p.parent&&(p.children=[],this._wrap())}o(h,"w"),e.exports=h;var m=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];h.prototype.clone=function(){var l=this._baseState,w={};m.forEach(function(y){w[y]=l[y]});var p=new this.constructor(w.parent);return p._baseState=w,p},h.prototype._wrap=function(){var l=this._baseState;v.forEach(function(w){this[w]=function(){var p=new this.constructor(this);return l.children.push(p),p[w].apply(p,arguments)}},this)},h.prototype._init=function(l){var w=this._baseState;f(w.parent===null),l.call(this),w.children=w.children.filter(function(p){return p._baseState.parent===this},this),f.equal(w.children.length,1,"Root node can have only one child")},h.prototype._useArgs=function(l){var w=this._baseState,p=l.filter(function(y){return y instanceof this.constructor},this);l=l.filter(function(y){return!(y instanceof this.constructor)},this),p.length!==0&&(f(w.children===null),w.children=p,p.forEach(function(y){y._baseState.parent=this},this)),l.length!==0&&(f(w.args===null),w.args=l,w.reverseArgs=l.map(function(y){if(typeof y!="object"||y.constructor!==Object)return y;var M={};return Object.keys(y).forEach(function(E){E==(E|0)&&(E|=0);var R=y[E];M[R]=E}),M}))},b.forEach(function(l){h.prototype[l]=function(){var w=this._baseState;throw Error(l+" not implemented for encoding: "+w.enc)}}),n.forEach(function(l){h.prototype[l]=function(){var w=this._baseState,p=Array.prototype.slice.call(arguments);return f(w.tag===null),w.tag=l,this._useArgs(p),this}}),h.prototype.use=function(l){f(l);var w=this._baseState;return f(w.use===null),w.use=l,this},h.prototype.optional=function(){var l=this._baseState;return l.optional=!0,this},h.prototype.def=function(l){var w=this._baseState;return f(w.default===null),w.default=l,w.optional=!0,this},h.prototype.explicit=function(l){var w=this._baseState;return f(w.explicit===null&&w.implicit===null),w.explicit=l,this},h.prototype.implicit=function(l){var w=this._baseState;return f(w.explicit===null&&w.implicit===null),w.implicit=l,this},h.prototype.obj=function(){var l=this._baseState,w=Array.prototype.slice.call(arguments);return l.obj=!0,w.length!==0&&this._useArgs(w),this},h.prototype.key=function(l){var w=this._baseState;return f(w.key===null),w.key=l,this},h.prototype.any=function(){var l=this._baseState;return l.any=!0,this},h.prototype.choice=function(l){var w=this._baseState;return f(w.choice===null),w.choice=l,this._useArgs(Object.keys(l).map(function(p){return l[p]})),this},h.prototype.contains=function(l){var w=this._baseState;return f(w.use===null),w.contains=l,this},h.prototype._decode=function(l,w){var p=this._baseState;if(p.parent===null)return l.wrapResult(p.children[0]._decode(l,w));var y=p.default,M=!0,E=null;if(p.key!==null&&(E=l.enterKey(p.key)),p.optional){var R=null;if(p.explicit!==null?R=p.explicit:p.implicit!==null?R=p.implicit:p.tag!==null&&(R=p.tag),R===null&&!p.any){var I=l.save();try{p.choice===null?this._decodeGeneric(p.tag,l,w):this._decodeChoice(l,w),M=!0}catch{M=!1}l.restore(I)}else if(M=this._peekTag(l,R,p.any),l.isError(M))return M}var T;if(p.obj&&M&&(T=l.enterObject()),M){if(p.explicit!==null){var P=this._decodeTag(l,p.explicit);if(l.isError(P))return P;l=P}var j=l.offset;if(p.use===null&&p.choice===null){if(p.any)var I=l.save();var L=this._decodeTag(l,p.implicit!==null?p.implicit:p.tag,p.any);if(l.isError(L))return L;p.any?y=l.raw(I):l=L}if(w&&w.track&&p.tag!==null&&w.track(l.path(),j,l.length,"tagged"),w&&w.track&&p.tag!==null&&w.track(l.path(),l.offset,l.length,"content"),p.any?y=y:p.choice===null?y=this._decodeGeneric(p.tag,l,w):y=this._decodeChoice(l,w),l.isError(y))return y;if(!p.any&&p.choice===null&&p.children!==null&&p.children.forEach(function(Z){Z._decode(l,w)}),p.contains&&(p.tag==="octstr"||p.tag==="bitstr")){var U=new s(y);y=this._getUse(p.contains,l._reporterState.obj)._decode(U,w)}}return p.obj&&M&&(y=l.leaveObject(T)),p.key!==null&&(y!==null||M===!0)?l.leaveKey(E,p.key,y):E!==null&&l.exitKey(E),y},h.prototype._decodeGeneric=function(l,w,p){var y=this._baseState;return l==="seq"||l==="set"?null:l==="seqof"||l==="setof"?this._decodeList(w,l,y.args[0],p):/str$/.test(l)?this._decodeStr(w,l,p):l==="objid"&&y.args?this._decodeObjid(w,y.args[0],y.args[1],p):l==="objid"?this._decodeObjid(w,null,null,p):l==="gentime"||l==="utctime"?this._decodeTime(w,l,p):l==="null_"?this._decodeNull(w,p):l==="bool"?this._decodeBool(w,p):l==="objDesc"?this._decodeStr(w,l,p):l==="int"||l==="enum"?this._decodeInt(w,y.args&&y.args[0],p):y.use!==null?this._getUse(y.use,w._reporterState.obj)._decode(w,p):w.error("unknown tag: "+l)},h.prototype._getUse=function(l,w){var p=this._baseState;return p.useDecoder=this._use(l,w),f(p.useDecoder._baseState.parent===null),p.useDecoder=p.useDecoder._baseState.children[0],p.implicit!==p.useDecoder._baseState.implicit&&(p.useDecoder=p.useDecoder.clone(),p.useDecoder._baseState.implicit=p.implicit),p.useDecoder},h.prototype._decodeChoice=function(l,w){var p=this._baseState,y=null,M=!1;return Object.keys(p.choice).some(function(E){var R=l.save(),I=p.choice[E];try{var T=I._decode(l,w);if(l.isError(T))return!1;y={type:E,value:T},M=!0}catch{return l.restore(R),!1}return!0},this),M?y:l.error("Choice not matched")},h.prototype._createEncoderBuffer=function(l){return new i(l,this.reporter)},h.prototype._encode=function(l,w,p){var y=this._baseState;if(!(y.default!==null&&y.default===l)){var M=this._encodeValue(l,w,p);if(M!==void 0&&!this._skipDefault(M,w,p))return M}},h.prototype._encodeValue=function(l,w,p){var y=this._baseState;if(y.parent===null)return y.children[0]._encode(l,w||new r);var I=null;if(this.reporter=w,y.optional&&l===void 0)if(y.default!==null)l=y.default;else return;var M=null,E=!1;if(y.any)I=this._createEncoderBuffer(l);else if(y.choice)I=this._encodeChoice(l,w);else if(y.contains)M=this._getUse(y.contains,p)._encode(l,w),E=!0;else if(y.children)M=y.children.map(function(j){if(j._baseState.tag==="null_")return j._encode(null,w,l);if(j._baseState.key===null)return w.error("Child should have a key");var L=w.enterKey(j._baseState.key);if(typeof l!="object")return w.error("Child expected, but input is not object");var U=j._encode(l[j._baseState.key],w,l);return w.leaveKey(L),U},this).filter(function(j){return j}),M=this._createEncoderBuffer(M);else if(y.tag==="seqof"||y.tag==="setof"){if(!(y.args&&y.args.length===1))return w.error("Too many args for : "+y.tag);if(!Array.isArray(l))return w.error("seqof/setof, but data is not Array");var R=this.clone();R._baseState.implicit=null,M=this._createEncoderBuffer(l.map(function(j){var L=this._baseState;return this._getUse(L.args[0],l)._encode(j,w)},R))}else y.use!==null?I=this._getUse(y.use,p)._encode(l,w):(M=this._encodePrimitive(y.tag,l),E=!0);var I;if(!y.any&&y.choice===null){var T=y.implicit!==null?y.implicit:y.tag,P=y.implicit===null?"universal":"context";T===null?y.use===null&&w.error("Tag could be omitted only for .use()"):y.use===null&&(I=this._encodeComposite(T,E,P,M))}return y.explicit!==null&&(I=this._encodeComposite(y.explicit,!1,"context",I)),I},h.prototype._encodeChoice=function(l,w){var p=this._baseState,y=p.choice[l.type];return y||f(!1,l.type+" not found in "+JSON.stringify(Object.keys(p.choice))),y._encode(l.value,w)},h.prototype._encodePrimitive=function(l,w){var p=this._baseState;if(/str$/.test(l))return this._encodeStr(w,l);if(l==="objid"&&p.args)return this._encodeObjid(w,p.reverseArgs[0],p.args[1]);if(l==="objid")return this._encodeObjid(w,null,null);if(l==="gentime"||l==="utctime")return this._encodeTime(w,l);if(l==="null_")return this._encodeNull();if(l==="int"||l==="enum")return this._encodeInt(w,p.args&&p.reverseArgs[0]);if(l==="bool")return this._encodeBool(w);if(l==="objDesc")return this._encodeStr(w,l);throw Error("Unsupported tag: "+l)},h.prototype._isNumstr=function(l){return/^[0-9 ]*$/.test(l)},h.prototype._isPrintstr=function(l){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(l)}}),ws=nt(t=>{var e=t;e.Reporter=J0().Reporter,e.DecoderBuffer=Hc().DecoderBuffer,e.EncoderBuffer=Hc().EncoderBuffer,e.Node=q0()}),em=nt(t=>{var e=Vc();t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=e._reverse(t.tag)}),Vc=nt(t=>{var e=t;e._reverse=function(r){var i={};return Object.keys(r).forEach(function(s){(s|0)==s&&(s=s|0);var f=r[s];i[f]=s}),i},e.der=em()}),Zc=nt((t,e)=>{var r=Or(),i=xs(),s=i.base,f=i.bignum,n=i.constants.der;function v(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new b,this.tree._init(l.body)}o(v,"z"),e.exports=v,v.prototype.decode=function(l,w){return l instanceof s.DecoderBuffer||(l=new s.DecoderBuffer(l,w)),this.tree._decode(l,w)};function b(l){s.Node.call(this,"der",l)}o(b,"v"),r(b,s.Node),b.prototype._peekTag=function(l,w,p){if(l.isEmpty())return!1;var y=l.save(),M=h(l,'Failed to peek tag: "'+w+'"');return l.isError(M)?M:(l.restore(y),M.tag===w||M.tagStr===w||M.tagStr+"of"===w||p)},b.prototype._decodeTag=function(l,w,p){var y=h(l,'Failed to decode tag of "'+w+'"');if(l.isError(y))return y;var M=m(l,y.primitive,'Failed to get length of "'+w+'"');if(l.isError(M))return M;if(!p&&y.tag!==w&&y.tagStr!==w&&y.tagStr+"of"!==w)return l.error('Failed to match tag: "'+w+'"');if(y.primitive||M!==null)return l.skip(M,'Failed to match body of: "'+w+'"');var E=l.save(),R=this._skipUntilEnd(l,'Failed to skip indefinite length body: "'+this.tag+'"');return l.isError(R)?R:(M=l.offset-E.offset,l.restore(E),l.skip(M,'Failed to match body of: "'+w+'"'))},b.prototype._skipUntilEnd=function(l,w){for(;;){var p=h(l,w);if(l.isError(p))return p;var y=m(l,p.primitive,w);if(l.isError(y))return y;var M;if(p.primitive||y!==null?M=l.skip(y):M=this._skipUntilEnd(l,w),l.isError(M))return M;if(p.tagStr==="end")break}},b.prototype._decodeList=function(l,w,p,y){for(var M=[];!l.isEmpty();){var E=this._peekTag(l,"end");if(l.isError(E))return E;var R=p.decode(l,"der",y);if(l.isError(R)&&E)break;M.push(R)}return M},b.prototype._decodeStr=function(l,w){if(w==="bitstr"){var p=l.readUInt8();return l.isError(p)?p:{unused:p,data:l.raw()}}else if(w==="bmpstr"){var y=l.raw();if(y.length%2===1)return l.error("Decoding of string type: bmpstr length mismatch");for(var M="",E=0;E<y.length/2;E++)M+=String.fromCharCode(y.readUInt16BE(E*2));return M}else if(w==="numstr"){var R=l.raw().toString("ascii");return this._isNumstr(R)?R:l.error("Decoding of string type: numstr unsupported characters")}else{if(w==="octstr")return l.raw();if(w==="objDesc")return l.raw();if(w==="printstr"){var I=l.raw().toString("ascii");return this._isPrintstr(I)?I:l.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(w)?l.raw().toString():l.error("Decoding of string type: "+w+" unsupported")}},b.prototype._decodeObjid=function(l,w,p){for(var y,M=[],E=0;!l.isEmpty();){var R=l.readUInt8();E<<=7,E|=R&127,(R&128)===0&&(M.push(E),E=0)}R&128&&M.push(E);var I=M[0]/40|0,T=M[0]%40;if(p?y=M:y=[I,T].concat(M.slice(1)),w){var P=w[y.join(" ")];P===void 0&&(P=w[y.join(".")]),P!==void 0&&(y=P)}return y},b.prototype._decodeTime=function(l,w){var p=l.raw().toString();if(w==="gentime")var y=p.slice(0,4)|0,M=p.slice(4,6)|0,E=p.slice(6,8)|0,R=p.slice(8,10)|0,I=p.slice(10,12)|0,T=p.slice(12,14)|0;else if(w==="utctime"){var y=p.slice(0,2)|0,M=p.slice(2,4)|0,E=p.slice(4,6)|0,R=p.slice(6,8)|0,I=p.slice(8,10)|0,T=p.slice(10,12)|0;y<70?y=2e3+y:y=1900+y}else return l.error("Decoding "+w+" time is not supported yet");return Date.UTC(y,M-1,E,R,I,T,0)},b.prototype._decodeNull=function(l){return null},b.prototype._decodeBool=function(l){var w=l.readUInt8();return l.isError(w)?w:w!==0},b.prototype._decodeInt=function(l,w){var p=l.raw(),y=new f(p);return w&&(y=w[y.toString(10)]||y),y},b.prototype._use=function(l,w){return typeof l=="function"&&(l=l(w)),l._getDecoder("der").tree};function h(l,w){var p=l.readUInt8(w);if(l.isError(p))return p;var y=n.tagClass[p>>6],M=(p&32)===0;if((p&31)===31){var E=p;for(p=0;(E&128)===128;){if(E=l.readUInt8(w),l.isError(E))return E;p<<=7,p|=E&127}}else p&=31;var R=n.tag[p];return{cls:y,primitive:M,tag:p,tagStr:R}}o(h,"w");function m(l,w,p){var y=l.readUInt8(p);if(l.isError(y))return y;if(!w&&y===128)return null;if((y&128)===0)return y;var M=y&127;if(M>4)return l.error("length octect is too long");y=0;for(var E=0;E<M;E++){y<<=8;var R=l.readUInt8(p);if(l.isError(R))return R;y|=R}return y}o(m,"V")}),tm=nt((t,e)=>{var r=Or(),i=(sr(),bt(er)).Buffer,s=Zc();function f(n){s.call(this,n),this.enc="pem"}o(f,"O"),r(f,s),e.exports=f,f.prototype.decode=function(n,v){for(var b=n.toString().split(/[\r\n]+/g),h=v.label.toUpperCase(),m=/^-----(BEGIN|END) ([^-]+)-----$/,l=-1,w=-1,p=0;p<b.length;p++){var y=b[p].match(m);if(y!==null&&y[2]===h)if(l===-1){if(y[1]!=="BEGIN")break;l=p}else{if(y[1]!=="END")break;w=p;break}}if(l===-1||w===-1)throw Error("PEM section not found for: "+h);var M=b.slice(l+1,w).join("");M.replace(/[^a-z0-9\+\/=]+/gi,"");var E=new i(M,"base64");return s.prototype.decode.call(this,E,v)}}),rm=nt(t=>{var e=t;e.der=Zc(),e.pem=tm()}),Gc=nt((t,e)=>{var r=Or(),i=(sr(),bt(er)).Buffer,s=xs(),f=s.base,n=s.constants.der;function v(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new b,this.tree._init(l.body)}o(v,"z"),e.exports=v,v.prototype.encode=function(l,w){return this.tree._encode(l,w).join()};function b(l){f.Node.call(this,"der",l)}o(b,"v"),r(b,f.Node),b.prototype._encodeComposite=function(l,w,p,y){var M=m(l,w,p,this.reporter);if(y.length<128){var I=new i(2);return I[0]=M,I[1]=y.length,this._createEncoderBuffer([I,y])}for(var E=1,R=y.length;R>=256;R>>=8)E++;var I=new i(2+E);I[0]=M,I[1]=128|E;for(var R=1+E,T=y.length;T>0;R--,T>>=8)I[R]=T&255;return this._createEncoderBuffer([I,y])},b.prototype._encodeStr=function(l,w){if(w==="bitstr")return this._createEncoderBuffer([l.unused|0,l.data]);if(w==="bmpstr"){for(var p=new i(l.length*2),y=0;y<l.length;y++)p.writeUInt16BE(l.charCodeAt(y),y*2);return this._createEncoderBuffer(p)}else return w==="numstr"?this._isNumstr(l)?this._createEncoderBuffer(l):this.reporter.error("Encoding of string type: numstr supports only digits and space"):w==="printstr"?this._isPrintstr(l)?this._createEncoderBuffer(l):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(w)?this._createEncoderBuffer(l):w==="objDesc"?this._createEncoderBuffer(l):this.reporter.error("Encoding of string type: "+w+" unsupported")},b.prototype._encodeObjid=function(l,w,p){if(typeof l=="string"){if(!w)return this.reporter.error("string objid given, but no values map found");if(!w.hasOwnProperty(l))return this.reporter.error("objid not found in values map");l=w[l].split(/[\s\.]+/g);for(var y=0;y<l.length;y++)l[y]|=0}else if(Array.isArray(l)){l=l.slice();for(var y=0;y<l.length;y++)l[y]|=0}if(!Array.isArray(l))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(l));if(!p){if(l[1]>=40)return this.reporter.error("Second objid identifier OOB");l.splice(0,2,l[0]*40+l[1])}for(var M=0,y=0;y<l.length;y++){var E=l[y];for(M++;E>=128;E>>=7)M++}for(var R=new i(M),I=R.length-1,y=l.length-1;y>=0;y--){var E=l[y];for(R[I--]=E&127;(E>>=7)>0;)R[I--]=128|E&127}return this._createEncoderBuffer(R)};function h(l){return l<10?"0"+l:l}o(h,"w"),b.prototype._encodeTime=function(l,w){var p,y=new Date(l);return w==="gentime"?p=[h(y.getFullYear()),h(y.getUTCMonth()+1),h(y.getUTCDate()),h(y.getUTCHours()),h(y.getUTCMinutes()),h(y.getUTCSeconds()),"Z"].join(""):w==="utctime"?p=[h(y.getFullYear()%100),h(y.getUTCMonth()+1),h(y.getUTCDate()),h(y.getUTCHours()),h(y.getUTCMinutes()),h(y.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+w+" time is not supported yet"),this._encodeStr(p,"octstr")},b.prototype._encodeNull=function(){return this._createEncoderBuffer("")},b.prototype._encodeInt=function(l,w){if(typeof l=="string"){if(!w)return this.reporter.error("String int or enum given, but no values map");if(!w.hasOwnProperty(l))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(l));l=w[l]}if(typeof l!="number"&&!i.isBuffer(l)){var p=l.toArray();!l.sign&&p[0]&128&&p.unshift(0),l=new i(p)}if(i.isBuffer(l)){var y=l.length;l.length===0&&y++;var E=new i(y);return l.copy(E),l.length===0&&(E[0]=0),this._createEncoderBuffer(E)}if(l<128)return this._createEncoderBuffer(l);if(l<256)return this._createEncoderBuffer([0,l]);for(var y=1,M=l;M>=256;M>>=8)y++;for(var E=Array(y),M=E.length-1;M>=0;M--)E[M]=l&255,l>>=8;return E[0]&128&&E.unshift(0),this._createEncoderBuffer(new i(E))},b.prototype._encodeBool=function(l){return this._createEncoderBuffer(l?255:0)},b.prototype._use=function(l,w){return typeof l=="function"&&(l=l(w)),l._getEncoder("der").tree},b.prototype._skipDefault=function(l,w,p){var y=this._baseState,M;if(y.default===null)return!1;var E=l.join();if(y.defaultBuffer===void 0&&(y.defaultBuffer=this._encodeValue(y.default,w,p).join()),E.length!==y.defaultBuffer.length)return!1;for(M=0;M<E.length;M++)if(E[M]!==y.defaultBuffer[M])return!1;return!0};function m(l,w,p,y){var M;if(l==="seqof"?l="seq":l==="setof"&&(l="set"),n.tagByName.hasOwnProperty(l))M=n.tagByName[l];else if(typeof l=="number"&&(l|0)===l)M=l;else return y.error("Unknown tag: "+l);return M>=31?y.error("Multi-octet tag encoding unsupported"):(w||(M|=32),M|=n.tagClassByName[p||"universal"]<<6,M)}o(m,"V")}),im=nt((t,e)=>{var r=Or(),i=Gc();function s(f){i.call(this,f),this.enc="pem"}o(s,"P"),r(s,i),e.exports=s,s.prototype.encode=function(f,n){for(var v=i.prototype.encode.call(this,f),b=v.toString("base64"),h=["-----BEGIN "+n.label+"-----"],m=0;m<b.length;m+=64)h.push(b.slice(m,m+64));return h.push("-----END "+n.label+"-----"),h.join(`
|
|
37
|
-
`)}}),nm=nt(t=>{var e=t;e.der=Gc(),e.pem=im()}),xs=nt(t=>{var e=t;e.bignum=W0(),e.define=$0().define,e.base=ws(),e.constants=Vc(),e.decoders=rm(),e.encoders=nm()}),sm=nt((t,e)=>{var r=xs(),i=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),s=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),f=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),n=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(f),this.key("subjectPublicKey").bitstr())}),v=r.define("RelativeDistinguishedName",function(){this.setof(s)}),b=r.define("RDNSequence",function(){this.seqof(v)}),h=r.define("Name",function(){this.choice({rdnSequence:this.use(b)})}),m=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),l=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),w=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(f),this.key("issuer").use(h),this.key("validity").use(m),this.key("subject").use(h),this.key("subjectPublicKeyInfo").use(n),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())}),p=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(w),this.key("signatureAlgorithm").use(f),this.key("signatureValue").bitstr())});e.exports=p}),am=nt(t=>{var e=xs();t.certificate=sm();var r=e.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});t.RSAPrivateKey=r;var i=e.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.RSAPublicKey=i;var s=e.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),f=e.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});t.PublicKey=f;var n=e.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});t.PrivateKey=n;var v=e.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});t.EncryptedPrivateKey=v;var b=e.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});t.DSAPrivateKey=b,t.DSAparam=e.define("DSAparam",function(){this.int()});var h=e.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),m=e.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});t.ECPrivateKey=m,t.signature=e.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),om=nt((t,e)=>{e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),lm=nt((t,e)=>{var r=Er().Buffer,i=Fu().Transform,s=Or();function f(h){i.call(this),this._block=r.allocUnsafe(h),this._blockSize=h,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}o(f,"O"),s(f,i),f.prototype._transform=function(h,m,l){var w=null;try{this.update(h,m)}catch(p){w=p}l(w)},f.prototype._flush=function(h){var m=null;try{this.push(this.digest())}catch(l){m=l}h(m)};var n=typeof Uint8Array<"u",v=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(r.prototype instanceof Uint8Array||r.TYPED_ARRAY_SUPPORT);function b(h,m){if(h instanceof r)return h;if(typeof h=="string")return r.from(h,m);if(v&&ArrayBuffer.isView(h)){if(h.byteLength===0)return r.alloc(0);var l=r.from(h.buffer,h.byteOffset,h.byteLength);if(l.byteLength===h.byteLength)return l}if(n&&h instanceof Uint8Array||r.isBuffer(h)&&h.constructor&&typeof h.constructor.isBuffer=="function"&&h.constructor.isBuffer(h))return r.from(h);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}o(b,"v"),f.prototype.update=function(h,m){if(this._finalized)throw Error("Digest already called");h=b(h,m);for(var l=this._block,w=0;this._blockOffset+h.length-w>=this._blockSize;){for(var p=this._blockOffset;p<this._blockSize;)l[p++]=h[w++];this._update(),this._blockOffset=0}for(;w<h.length;)l[this._blockOffset++]=h[w++];for(var y=0,M=h.length*8;M>0;++y)this._length[y]+=M,M=this._length[y]/4294967296|0,M>0&&(this._length[y]-=4294967296*M);return this},f.prototype._update=function(){throw Error("_update is not implemented")},f.prototype.digest=function(h){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var m=this._digest();h!==void 0&&(m=m.toString(h)),this._block.fill(0),this._blockOffset=0;for(var l=0;l<4;++l)this._length[l]=0;return m},f.prototype._digest=function(){throw Error("_digest is not implemented")},e.exports=f}),um=nt((t,e)=>{var r=Or(),i=lm(),s=Er().Buffer,f=Array(16);function n(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}o(n,"Y"),r(n,i),n.prototype._update=function(){for(var w=f,p=0;p<16;++p)w[p]=this._block.readInt32LE(p*4);var y=this._a,M=this._b,E=this._c,R=this._d;y=b(y,M,E,R,w[0],3614090360,7),R=b(R,y,M,E,w[1],3905402710,12),E=b(E,R,y,M,w[2],606105819,17),M=b(M,E,R,y,w[3],3250441966,22),y=b(y,M,E,R,w[4],4118548399,7),R=b(R,y,M,E,w[5],1200080426,12),E=b(E,R,y,M,w[6],2821735955,17),M=b(M,E,R,y,w[7],4249261313,22),y=b(y,M,E,R,w[8],1770035416,7),R=b(R,y,M,E,w[9],2336552879,12),E=b(E,R,y,M,w[10],4294925233,17),M=b(M,E,R,y,w[11],2304563134,22),y=b(y,M,E,R,w[12],1804603682,7),R=b(R,y,M,E,w[13],4254626195,12),E=b(E,R,y,M,w[14],2792965006,17),M=b(M,E,R,y,w[15],1236535329,22),y=h(y,M,E,R,w[1],4129170786,5),R=h(R,y,M,E,w[6],3225465664,9),E=h(E,R,y,M,w[11],643717713,14),M=h(M,E,R,y,w[0],3921069994,20),y=h(y,M,E,R,w[5],3593408605,5),R=h(R,y,M,E,w[10],38016083,9),E=h(E,R,y,M,w[15],3634488961,14),M=h(M,E,R,y,w[4],3889429448,20),y=h(y,M,E,R,w[9],568446438,5),R=h(R,y,M,E,w[14],3275163606,9),E=h(E,R,y,M,w[3],4107603335,14),M=h(M,E,R,y,w[8],1163531501,20),y=h(y,M,E,R,w[13],2850285829,5),R=h(R,y,M,E,w[2],4243563512,9),E=h(E,R,y,M,w[7],1735328473,14),M=h(M,E,R,y,w[12],2368359562,20),y=m(y,M,E,R,w[5],4294588738,4),R=m(R,y,M,E,w[8],2272392833,11),E=m(E,R,y,M,w[11],1839030562,16),M=m(M,E,R,y,w[14],4259657740,23),y=m(y,M,E,R,w[1],2763975236,4),R=m(R,y,M,E,w[4],1272893353,11),E=m(E,R,y,M,w[7],4139469664,16),M=m(M,E,R,y,w[10],3200236656,23),y=m(y,M,E,R,w[13],681279174,4),R=m(R,y,M,E,w[0],3936430074,11),E=m(E,R,y,M,w[3],3572445317,16),M=m(M,E,R,y,w[6],76029189,23),y=m(y,M,E,R,w[9],3654602809,4),R=m(R,y,M,E,w[12],3873151461,11),E=m(E,R,y,M,w[15],530742520,16),M=m(M,E,R,y,w[2],3299628645,23),y=l(y,M,E,R,w[0],4096336452,6),R=l(R,y,M,E,w[7],1126891415,10),E=l(E,R,y,M,w[14],2878612391,15),M=l(M,E,R,y,w[5],4237533241,21),y=l(y,M,E,R,w[12],1700485571,6),R=l(R,y,M,E,w[3],2399980690,10),E=l(E,R,y,M,w[10],4293915773,15),M=l(M,E,R,y,w[1],2240044497,21),y=l(y,M,E,R,w[8],1873313359,6),R=l(R,y,M,E,w[15],4264355552,10),E=l(E,R,y,M,w[6],2734768916,15),M=l(M,E,R,y,w[13],1309151649,21),y=l(y,M,E,R,w[4],4149444226,6),R=l(R,y,M,E,w[11],3174756917,10),E=l(E,R,y,M,w[2],718787259,15),M=l(M,E,R,y,w[9],3951481745,21),this._a=this._a+y|0,this._b=this._b+M|0,this._c=this._c+E|0,this._d=this._d+R|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var w=s.allocUnsafe(16);return w.writeInt32LE(this._a,0),w.writeInt32LE(this._b,4),w.writeInt32LE(this._c,8),w.writeInt32LE(this._d,12),w};function v(w,p){return w<<p|w>>>32-p}o(v,"z");function b(w,p,y,M,E,R,I){return v(w+(p&y|~p&M)+E+R|0,I)+p|0}o(b,"v");function h(w,p,y,M,E,R,I){return v(w+(p&M|y&~M)+E+R|0,I)+p|0}o(h,"w");function m(w,p,y,M,E,R,I){return v(w+(p^y^M)+E+R|0,I)+p|0}o(m,"V");function l(w,p,y,M,E,R,I){return v(w+(y^(p|~M))+E+R|0,I)+p|0}o(l,"Z"),e.exports=n}),cm=nt((t,e)=>{var r=Er().Buffer,i=um();function s(f,n,v,b){if(r.isBuffer(f)||(f=r.from(f,"binary")),n&&(r.isBuffer(n)||(n=r.from(n,"binary")),n.length!==8))throw RangeError("salt should be Buffer with 8 byte length");for(var h=v/8,m=r.alloc(h),l=r.alloc(b||0),w=r.alloc(0);h>0||b>0;){var p=new i;p.update(w),p.update(f),n&&p.update(n),w=p.digest();var y=0;if(h>0){var M=m.length-h;y=Math.min(h,w.length),w.copy(m,M,0,y),h-=y}if(y<w.length&&b>0){var E=l.length-b,R=Math.min(b,w.length-y);w.copy(l,E,y,y+R),b-=R}}return w.fill(0),{key:m,iv:l}}o(s,"P"),e.exports=s}),Yc=nt(t=>{var e=(qt(),bt(Jt));t.createCipher=t.Cipher=e.createCipher,t.createCipheriv=t.Cipheriv=e.createCipheriv,t.createDecipher=t.Decipher=e.createDecipher,t.createDecipheriv=t.Decipheriv=e.createDecipheriv,t.listCiphers=t.getCiphers=e.getCiphers}),fm=nt((t,e)=>{var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,s=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,f=cm(),n=Yc(),v=Er().Buffer;e.exports=function(b,h){var m=b.toString(),l=m.match(r),w;if(l){var y="aes"+l[1],M=v.from(l[2],"hex"),E=v.from(l[3].replace(/[\r\n]/g,""),"base64"),R=f(h,M.slice(0,8),parseInt(l[1],10)).key,I=[],T=n.createDecipheriv(y,R,M);I.push(T.update(E)),I.push(T.final()),w=v.concat(I)}else{var p=m.match(s);w=v.from(p[2].replace(/[\r\n]/g,""),"base64")}var P=m.match(i)[1];return{tag:P,data:w}}}),Qc=nt((t,e)=>{var r=am(),i=om(),s=fm(),f=Yc(),n=jc(),v=Er().Buffer;function b(m,l){var w=m.algorithm.decrypt.kde.kdeparams.salt,p=parseInt(m.algorithm.decrypt.kde.kdeparams.iters.toString(),10),y=i[m.algorithm.decrypt.cipher.algo.join(".")],M=m.algorithm.decrypt.cipher.iv,E=m.subjectPrivateKey,R=parseInt(y.split("-")[1],10)/8,I=n.pbkdf2Sync(l,w,p,R,"sha1"),T=f.createDecipheriv(y,I,M),P=[];return P.push(T.update(E)),P.push(T.final()),v.concat(P)}o(b,"v");function h(m){var l;typeof m=="object"&&!v.isBuffer(m)&&(l=m.passphrase,m=m.key),typeof m=="string"&&(m=v.from(m));var w=s(m,l),p=w.tag,y=w.data,M,E;switch(p){case"CERTIFICATE":E=r.certificate.decode(y,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(E||(E=r.PublicKey.decode(y,"der")),M=E.algorithm.algorithm.join("."),M){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(E.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return E.subjectPrivateKey=E.subjectPublicKey,{type:"ec",data:E};case"1.2.840.10040.4.1":return E.algorithm.params.pub_key=r.DSAparam.decode(E.subjectPublicKey.data,"der"),{type:"dsa",data:E.algorithm.params};default:throw Error("unknown key id "+M)}case"ENCRYPTED PRIVATE KEY":y=r.EncryptedPrivateKey.decode(y,"der"),y=b(y,l);case"PRIVATE KEY":switch(E=r.PrivateKey.decode(y,"der"),M=E.algorithm.algorithm.join("."),M){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(E.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:E.algorithm.curve,privateKey:r.ECPrivateKey.decode(E.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return E.algorithm.params.priv_key=r.DSAparam.decode(E.subjectPrivateKey,"der"),{type:"dsa",params:E.algorithm.params};default:throw Error("unknown key id "+M)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(y,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(y,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(y,"der")};case"EC PRIVATE KEY":return y=r.ECPrivateKey.decode(y,"der"),{curve:y.parameters.value,privateKey:y.privateKey};default:throw Error("unknown key type "+p)}}o(h,"w"),h.signature=r.signature,e.exports=h}),Kc=nt((t,e)=>{var r=ca(),i=Er().Buffer;e.exports=function(f,n){for(var v=i.alloc(0),b=0,h;v.length<n;)h=s(b++),v=i.concat([v,r("sha1").update(f).update(h).digest()]);return v.slice(0,n)};function s(f){var n=i.allocUnsafe(4);return n.writeUInt32BE(f,0),n}o(s,"P")}),Xc=nt((t,e)=>{e.exports=function(r,i){for(var s=r.length,f=-1;++f<s;)r[f]^=i[f];return r}}),il=nt((t,e)=>{(function(r,i){function s(a,g){if(!a)throw Error(g||"Assertion failed")}o(s,"P");function f(a,g){a.super_=g;var u=o(function(){},"W");u.prototype=g.prototype,a.prototype=new u,a.prototype.constructor=a}o(f,"O");function n(a,g,u){if(n.isBN(a))return a;this.negative=0,this.words=null,this.length=0,this.red=null,a!==null&&((g==="le"||g==="be")&&(u=g,g=10),this._init(a||0,g||10,u||"be"))}o(n,"Y"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,g){return a.cmp(g)>0?a:g},n.min=function(a,g){return a.cmp(g)<0?a:g},n.prototype._init=function(a,g,u){if(typeof a=="number")return this._initNumber(a,g,u);if(typeof a=="object")return this._initArray(a,g,u);g==="hex"&&(g=16),s(g===(g|0)&&g>=2&&g<=36),a=a.toString().replace(/\s+/g,"");var d=0;a[0]==="-"&&(d++,this.negative=1),d<a.length&&(g===16?this._parseHex(a,d,u):(this._parseBase(a,g,d),u==="le"&&this._initArray(this.toArray(),g,u)))},n.prototype._initNumber=function(a,g,u){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(s(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),g,u)},n.prototype._initArray=function(a,g,u){if(s(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x,A,N=0;if(u==="be")for(d=a.length-1,x=0;d>=0;d-=3)A=a[d]|a[d-1]<<8|a[d-2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);else if(u==="le")for(d=0,x=0;d<a.length;d+=3)A=a[d]|a[d+1]<<8|a[d+2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);return this.strip()};function b(a,g){var u=a.charCodeAt(g);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}o(b,"v");function h(a,g,u){var d=b(a,u);return u-1>=g&&(d|=b(a,u-1)<<4),d}o(h,"w"),n.prototype._parseHex=function(a,g,u){this.length=Math.ceil((a.length-g)/6),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x=0,A=0,N;if(u==="be")for(d=a.length-1;d>=g;d-=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8;else{var S=a.length-g;for(d=S%2===0?g+1:g;d<a.length;d+=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8}this.strip()};function m(a,g,u,d){for(var x=0,A=Math.min(a.length,u),N=g;N<A;N++){var S=a.charCodeAt(N)-48;x*=d,S>=49?x+=S-49+10:S>=17?x+=S-17+10:x+=S}return x}o(m,"V"),n.prototype._parseBase=function(a,g,u){this.words=[0],this.length=1;for(var d=0,x=1;x<=67108863;x*=g)d++;d--,x=x/g|0;for(var A=a.length-u,N=A%d,S=Math.min(A,A-N)+u,c=0,_=u;_<S;_+=d)c=m(a,_,_+d,g),this.imuln(x),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(N!==0){var C=1;for(c=m(a,_,a.length,g),_=0;_<N;_++)C*=g;this.imuln(C),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(a){a.words=Array(this.length);for(var g=0;g<this.length;g++)a.words[g]=this.words[g];a.length=this.length,a.negative=this.negative,a.red=this.red},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(a,g){a=a||10,g=g|0||1;var u;if(a===16||a==="hex"){u="";for(var d=0,x=0,A=0;A<this.length;A++){var N=this.words[A],S=((N<<d|x)&16777215).toString(16);x=N>>>24-d&16777215,d+=2,d>=26&&(d-=26,A--),x!==0||A!==this.length-1?u=l[6-S.length]+S+u:u=S+u}for(x!==0&&(u=x.toString(16)+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(a===(a|0)&&a>=2&&a<=36){var c=w[a],_=p[a];u="";var C=this.clone();for(C.negative=0;!C.isZero();){var O=C.modn(_).toString(a);C=C.idivn(_),C.isZero()?u=O+u:u=l[c-O.length]+O+u}for(this.isZero()&&(u="0"+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(a,g){return s(typeof v<"u"),this.toArrayLike(v,a,g)},n.prototype.toArray=function(a,g){return this.toArrayLike(Array,a,g)},n.prototype.toArrayLike=function(a,g,u){var d=this.byteLength(),x=u||Math.max(1,d);s(d<=x,"byte array longer than desired length"),s(x>0,"Requested array length <= 0"),this.strip();var A=g==="le",N=new a(x),S,c,_=this.clone();if(A){for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[c]=S;for(;c<x;c++)N[c]=0}else{for(c=0;c<x-d;c++)N[c]=0;for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[x-c-1]=S}return N},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var g=a,u=0;return g>=4096&&(u+=13,g>>>=13),g>=64&&(u+=7,g>>>=7),g>=8&&(u+=4,g>>>=4),g>=2&&(u+=2,g>>>=2),u+g},n.prototype._zeroBits=function(a){if(a===0)return 26;var g=a,u=0;return(g&8191)===0&&(u+=13,g>>>=13),(g&127)===0&&(u+=7,g>>>=7),(g&15)===0&&(u+=4,g>>>=4),(g&3)===0&&(u+=2,g>>>=2),(g&1)===0&&u++,u},n.prototype.bitLength=function(){var a=this.words[this.length-1],g=this._countBits(a);return(this.length-1)*26+g};function y(a){for(var g=Array(a.bitLength()),u=0;u<g.length;u++){var d=u/26|0,x=u%26;g[u]=(a.words[d]&1<<x)>>>x}return g}o(y,"E"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,g=0;g<this.length;g++){var u=this._zeroBits(this.words[g]);if(a+=u,u!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var g=0;g<a.length;g++)this.words[g]=this.words[g]|a.words[g];return this.strip()},n.prototype.ior=function(a){return s((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var g;this.length>a.length?g=a:g=this;for(var u=0;u<g.length;u++)this.words[u]=this.words[u]&a.words[u];return this.length=g.length,this.strip()},n.prototype.iand=function(a){return s((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var g,u;this.length>a.length?(g=this,u=a):(g=a,u=this);for(var d=0;d<u.length;d++)this.words[d]=g.words[d]^u.words[d];if(this!==g)for(;d<g.length;d++)this.words[d]=g.words[d];return this.length=g.length,this.strip()},n.prototype.ixor=function(a){return s((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){s(typeof a=="number"&&a>=0);var g=Math.ceil(a/26)|0,u=a%26;this._expand(g),u>0&&g--;for(var d=0;d<g;d++)this.words[d]=~this.words[d]&67108863;return u>0&&(this.words[d]=~this.words[d]&67108863>>26-u),this.strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,g){s(typeof a=="number"&&a>=0);var u=a/26|0,d=a%26;return this._expand(u+1),g?this.words[u]=this.words[u]|1<<d:this.words[u]=this.words[u]&~(1<<d),this.strip()},n.prototype.iadd=function(a){var g;if(this.negative!==0&&a.negative===0)return this.negative=0,g=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,g=this.isub(a),a.negative=1,g._normSign();var u,d;this.length>a.length?(u=this,d=a):(u=a,d=this);for(var x=0,A=0;A<d.length;A++)g=(u.words[A]|0)+(d.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;for(;x!==0&&A<u.length;A++)g=(u.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;if(this.length=u.length,x!==0)this.words[this.length]=x,this.length++;else if(u!==this)for(;A<u.length;A++)this.words[A]=u.words[A];return this},n.prototype.add=function(a){var g;return a.negative!==0&&this.negative===0?(a.negative=0,g=this.sub(a),a.negative^=1,g):a.negative===0&&this.negative!==0?(this.negative=0,g=a.sub(this),this.negative=1,g):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var g=this.iadd(a);return a.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var u=this.cmp(a);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,x;u>0?(d=this,x=a):(d=a,x=this);for(var A=0,N=0;N<x.length;N++)g=(d.words[N]|0)-(x.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;for(;A!==0&&N<d.length;N++)g=(d.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;if(A===0&&N<d.length&&d!==this)for(;N<d.length;N++)this.words[N]=d.words[N];return this.length=Math.max(this.length,N),d!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function M(a,g,u){u.negative=g.negative^a.negative;var d=a.length+g.length|0;u.length=d,d=d-1|0;var x=a.words[0]|0,A=g.words[0]|0,N=x*A,S=N&67108863,c=N/67108864|0;u.words[0]=S;for(var _=1;_<d;_++){for(var C=c>>>26,O=c&67108863,D=Math.min(_,g.length-1),B=Math.max(0,_-a.length+1);B<=D;B++){var z=_-B|0;x=a.words[z]|0,A=g.words[B]|0,N=x*A+O,C+=N/67108864|0,O=N&67108863}u.words[_]=O|0,c=C|0}return c!==0?u.words[_]=c|0:u.length--,u.strip()}o(M,"I");var E=o(function(a,g,u){var d=a.words,x=g.words,A=u.words,N=0,S,c,_,C=d[0]|0,O=C&8191,D=C>>>13,B=d[1]|0,z=B&8191,G=B>>>13,te=d[2]|0,$=te&8191,q=te>>>13,Ce=d[3]|0,fe=Ce&8191,ae=Ce>>>13,be=d[4]|0,H=be&8191,ee=be>>>13,Q=d[5]|0,X=Q&8191,se=Q>>>13,Ne=d[6]|0,we=Ne&8191,ue=Ne>>>13,K=d[7]|0,W=K&8191,J=K>>>13,pe=d[8]|0,le=pe&8191,oe=pe>>>13,Ve=d[9]|0,_e=Ve&8191,Le=Ve>>>13,qe=x[0]|0,ge=qe&8191,De=qe>>>13,he=x[1]|0,ve=he&8191,Oe=he>>>13,je=x[2]|0,ke=je&8191,Fe=je>>>13,et=x[3]|0,Ie=et&8191,Se=et>>>13,Be=x[4]|0,Ee=Be&8191,Ue=Be>>>13,Je=x[5]|0,re=Je&8191,de=Je>>>13,Pe=x[6]|0,Me=Pe&8191,Re=Pe>>>13,Ke=x[7]|0,ie=Ke&8191,Ae=Ke>>>13,Ye=x[8]|0,me=Ye&8191,Qe=Ye>>>13,st=x[9]|0,ze=st&8191,We=st>>>13;u.negative=a.negative^g.negative,u.length=19,S=Math.imul(O,ge),c=Math.imul(O,De),c=c+Math.imul(D,ge)|0,_=Math.imul(D,De);var Te=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,S=Math.imul(z,ge),c=Math.imul(z,De),c=c+Math.imul(G,ge)|0,_=Math.imul(G,De),S=S+Math.imul(O,ve)|0,c=c+Math.imul(O,Oe)|0,c=c+Math.imul(D,ve)|0,_=_+Math.imul(D,Oe)|0;var Ze=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,S=Math.imul($,ge),c=Math.imul($,De),c=c+Math.imul(q,ge)|0,_=Math.imul(q,De),S=S+Math.imul(z,ve)|0,c=c+Math.imul(z,Oe)|0,c=c+Math.imul(G,ve)|0,_=_+Math.imul(G,Oe)|0,S=S+Math.imul(O,ke)|0,c=c+Math.imul(O,Fe)|0,c=c+Math.imul(D,ke)|0,_=_+Math.imul(D,Fe)|0;var lt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(fe,ge),c=Math.imul(fe,De),c=c+Math.imul(ae,ge)|0,_=Math.imul(ae,De),S=S+Math.imul($,ve)|0,c=c+Math.imul($,Oe)|0,c=c+Math.imul(q,ve)|0,_=_+Math.imul(q,Oe)|0,S=S+Math.imul(z,ke)|0,c=c+Math.imul(z,Fe)|0,c=c+Math.imul(G,ke)|0,_=_+Math.imul(G,Fe)|0,S=S+Math.imul(O,Ie)|0,c=c+Math.imul(O,Se)|0,c=c+Math.imul(D,Ie)|0,_=_+Math.imul(D,Se)|0;var yt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(yt>>>26)|0,yt&=67108863,S=Math.imul(H,ge),c=Math.imul(H,De),c=c+Math.imul(ee,ge)|0,_=Math.imul(ee,De),S=S+Math.imul(fe,ve)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(ae,ve)|0,_=_+Math.imul(ae,Oe)|0,S=S+Math.imul($,ke)|0,c=c+Math.imul($,Fe)|0,c=c+Math.imul(q,ke)|0,_=_+Math.imul(q,Fe)|0,S=S+Math.imul(z,Ie)|0,c=c+Math.imul(z,Se)|0,c=c+Math.imul(G,Ie)|0,_=_+Math.imul(G,Se)|0,S=S+Math.imul(O,Ee)|0,c=c+Math.imul(O,Ue)|0,c=c+Math.imul(D,Ee)|0,_=_+Math.imul(D,Ue)|0;var ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(X,ge),c=Math.imul(X,De),c=c+Math.imul(se,ge)|0,_=Math.imul(se,De),S=S+Math.imul(H,ve)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(ee,ve)|0,_=_+Math.imul(ee,Oe)|0,S=S+Math.imul(fe,ke)|0,c=c+Math.imul(fe,Fe)|0,c=c+Math.imul(ae,ke)|0,_=_+Math.imul(ae,Fe)|0,S=S+Math.imul($,Ie)|0,c=c+Math.imul($,Se)|0,c=c+Math.imul(q,Ie)|0,_=_+Math.imul(q,Se)|0,S=S+Math.imul(z,Ee)|0,c=c+Math.imul(z,Ue)|0,c=c+Math.imul(G,Ee)|0,_=_+Math.imul(G,Ue)|0,S=S+Math.imul(O,re)|0,c=c+Math.imul(O,de)|0,c=c+Math.imul(D,re)|0,_=_+Math.imul(D,de)|0;var Nt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S=Math.imul(we,ge),c=Math.imul(we,De),c=c+Math.imul(ue,ge)|0,_=Math.imul(ue,De),S=S+Math.imul(X,ve)|0,c=c+Math.imul(X,Oe)|0,c=c+Math.imul(se,ve)|0,_=_+Math.imul(se,Oe)|0,S=S+Math.imul(H,ke)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(ee,ke)|0,_=_+Math.imul(ee,Fe)|0,S=S+Math.imul(fe,Ie)|0,c=c+Math.imul(fe,Se)|0,c=c+Math.imul(ae,Ie)|0,_=_+Math.imul(ae,Se)|0,S=S+Math.imul($,Ee)|0,c=c+Math.imul($,Ue)|0,c=c+Math.imul(q,Ee)|0,_=_+Math.imul(q,Ue)|0,S=S+Math.imul(z,re)|0,c=c+Math.imul(z,de)|0,c=c+Math.imul(G,re)|0,_=_+Math.imul(G,de)|0,S=S+Math.imul(O,Me)|0,c=c+Math.imul(O,Re)|0,c=c+Math.imul(D,Me)|0,_=_+Math.imul(D,Re)|0;var Dt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(W,ge),c=Math.imul(W,De),c=c+Math.imul(J,ge)|0,_=Math.imul(J,De),S=S+Math.imul(we,ve)|0,c=c+Math.imul(we,Oe)|0,c=c+Math.imul(ue,ve)|0,_=_+Math.imul(ue,Oe)|0,S=S+Math.imul(X,ke)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(se,ke)|0,_=_+Math.imul(se,Fe)|0,S=S+Math.imul(H,Ie)|0,c=c+Math.imul(H,Se)|0,c=c+Math.imul(ee,Ie)|0,_=_+Math.imul(ee,Se)|0,S=S+Math.imul(fe,Ee)|0,c=c+Math.imul(fe,Ue)|0,c=c+Math.imul(ae,Ee)|0,_=_+Math.imul(ae,Ue)|0,S=S+Math.imul($,re)|0,c=c+Math.imul($,de)|0,c=c+Math.imul(q,re)|0,_=_+Math.imul(q,de)|0,S=S+Math.imul(z,Me)|0,c=c+Math.imul(z,Re)|0,c=c+Math.imul(G,Me)|0,_=_+Math.imul(G,Re)|0,S=S+Math.imul(O,ie)|0,c=c+Math.imul(O,Ae)|0,c=c+Math.imul(D,ie)|0,_=_+Math.imul(D,Ae)|0;var Ct=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,S=Math.imul(le,ge),c=Math.imul(le,De),c=c+Math.imul(oe,ge)|0,_=Math.imul(oe,De),S=S+Math.imul(W,ve)|0,c=c+Math.imul(W,Oe)|0,c=c+Math.imul(J,ve)|0,_=_+Math.imul(J,Oe)|0,S=S+Math.imul(we,ke)|0,c=c+Math.imul(we,Fe)|0,c=c+Math.imul(ue,ke)|0,_=_+Math.imul(ue,Fe)|0,S=S+Math.imul(X,Ie)|0,c=c+Math.imul(X,Se)|0,c=c+Math.imul(se,Ie)|0,_=_+Math.imul(se,Se)|0,S=S+Math.imul(H,Ee)|0,c=c+Math.imul(H,Ue)|0,c=c+Math.imul(ee,Ee)|0,_=_+Math.imul(ee,Ue)|0,S=S+Math.imul(fe,re)|0,c=c+Math.imul(fe,de)|0,c=c+Math.imul(ae,re)|0,_=_+Math.imul(ae,de)|0,S=S+Math.imul($,Me)|0,c=c+Math.imul($,Re)|0,c=c+Math.imul(q,Me)|0,_=_+Math.imul(q,Re)|0,S=S+Math.imul(z,ie)|0,c=c+Math.imul(z,Ae)|0,c=c+Math.imul(G,ie)|0,_=_+Math.imul(G,Ae)|0,S=S+Math.imul(O,me)|0,c=c+Math.imul(O,Qe)|0,c=c+Math.imul(D,me)|0,_=_+Math.imul(D,Qe)|0;var St=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(St>>>26)|0,St&=67108863,S=Math.imul(_e,ge),c=Math.imul(_e,De),c=c+Math.imul(Le,ge)|0,_=Math.imul(Le,De),S=S+Math.imul(le,ve)|0,c=c+Math.imul(le,Oe)|0,c=c+Math.imul(oe,ve)|0,_=_+Math.imul(oe,Oe)|0,S=S+Math.imul(W,ke)|0,c=c+Math.imul(W,Fe)|0,c=c+Math.imul(J,ke)|0,_=_+Math.imul(J,Fe)|0,S=S+Math.imul(we,Ie)|0,c=c+Math.imul(we,Se)|0,c=c+Math.imul(ue,Ie)|0,_=_+Math.imul(ue,Se)|0,S=S+Math.imul(X,Ee)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(se,Ee)|0,_=_+Math.imul(se,Ue)|0,S=S+Math.imul(H,re)|0,c=c+Math.imul(H,de)|0,c=c+Math.imul(ee,re)|0,_=_+Math.imul(ee,de)|0,S=S+Math.imul(fe,Me)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(ae,Me)|0,_=_+Math.imul(ae,Re)|0,S=S+Math.imul($,ie)|0,c=c+Math.imul($,Ae)|0,c=c+Math.imul(q,ie)|0,_=_+Math.imul(q,Ae)|0,S=S+Math.imul(z,me)|0,c=c+Math.imul(z,Qe)|0,c=c+Math.imul(G,me)|0,_=_+Math.imul(G,Qe)|0,S=S+Math.imul(O,ze)|0,c=c+Math.imul(O,We)|0,c=c+Math.imul(D,ze)|0,_=_+Math.imul(D,We)|0;var Ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,S=Math.imul(_e,ve),c=Math.imul(_e,Oe),c=c+Math.imul(Le,ve)|0,_=Math.imul(Le,Oe),S=S+Math.imul(le,ke)|0,c=c+Math.imul(le,Fe)|0,c=c+Math.imul(oe,ke)|0,_=_+Math.imul(oe,Fe)|0,S=S+Math.imul(W,Ie)|0,c=c+Math.imul(W,Se)|0,c=c+Math.imul(J,Ie)|0,_=_+Math.imul(J,Se)|0,S=S+Math.imul(we,Ee)|0,c=c+Math.imul(we,Ue)|0,c=c+Math.imul(ue,Ee)|0,_=_+Math.imul(ue,Ue)|0,S=S+Math.imul(X,re)|0,c=c+Math.imul(X,de)|0,c=c+Math.imul(se,re)|0,_=_+Math.imul(se,de)|0,S=S+Math.imul(H,Me)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(ee,Me)|0,_=_+Math.imul(ee,Re)|0,S=S+Math.imul(fe,ie)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(ae,ie)|0,_=_+Math.imul(ae,Ae)|0,S=S+Math.imul($,me)|0,c=c+Math.imul($,Qe)|0,c=c+Math.imul(q,me)|0,_=_+Math.imul(q,Qe)|0,S=S+Math.imul(z,ze)|0,c=c+Math.imul(z,We)|0,c=c+Math.imul(G,ze)|0,_=_+Math.imul(G,We)|0;var Vt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,S=Math.imul(_e,ke),c=Math.imul(_e,Fe),c=c+Math.imul(Le,ke)|0,_=Math.imul(Le,Fe),S=S+Math.imul(le,Ie)|0,c=c+Math.imul(le,Se)|0,c=c+Math.imul(oe,Ie)|0,_=_+Math.imul(oe,Se)|0,S=S+Math.imul(W,Ee)|0,c=c+Math.imul(W,Ue)|0,c=c+Math.imul(J,Ee)|0,_=_+Math.imul(J,Ue)|0,S=S+Math.imul(we,re)|0,c=c+Math.imul(we,de)|0,c=c+Math.imul(ue,re)|0,_=_+Math.imul(ue,de)|0,S=S+Math.imul(X,Me)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(se,Me)|0,_=_+Math.imul(se,Re)|0,S=S+Math.imul(H,ie)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(ee,ie)|0,_=_+Math.imul(ee,Ae)|0,S=S+Math.imul(fe,me)|0,c=c+Math.imul(fe,Qe)|0,c=c+Math.imul(ae,me)|0,_=_+Math.imul(ae,Qe)|0,S=S+Math.imul($,ze)|0,c=c+Math.imul($,We)|0,c=c+Math.imul(q,ze)|0,_=_+Math.imul(q,We)|0;var Pt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,S=Math.imul(_e,Ie),c=Math.imul(_e,Se),c=c+Math.imul(Le,Ie)|0,_=Math.imul(Le,Se),S=S+Math.imul(le,Ee)|0,c=c+Math.imul(le,Ue)|0,c=c+Math.imul(oe,Ee)|0,_=_+Math.imul(oe,Ue)|0,S=S+Math.imul(W,re)|0,c=c+Math.imul(W,de)|0,c=c+Math.imul(J,re)|0,_=_+Math.imul(J,de)|0,S=S+Math.imul(we,Me)|0,c=c+Math.imul(we,Re)|0,c=c+Math.imul(ue,Me)|0,_=_+Math.imul(ue,Re)|0,S=S+Math.imul(X,ie)|0,c=c+Math.imul(X,Ae)|0,c=c+Math.imul(se,ie)|0,_=_+Math.imul(se,Ae)|0,S=S+Math.imul(H,me)|0,c=c+Math.imul(H,Qe)|0,c=c+Math.imul(ee,me)|0,_=_+Math.imul(ee,Qe)|0,S=S+Math.imul(fe,ze)|0,c=c+Math.imul(fe,We)|0,c=c+Math.imul(ae,ze)|0,_=_+Math.imul(ae,We)|0;var Ft=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,S=Math.imul(_e,Ee),c=Math.imul(_e,Ue),c=c+Math.imul(Le,Ee)|0,_=Math.imul(Le,Ue),S=S+Math.imul(le,re)|0,c=c+Math.imul(le,de)|0,c=c+Math.imul(oe,re)|0,_=_+Math.imul(oe,de)|0,S=S+Math.imul(W,Me)|0,c=c+Math.imul(W,Re)|0,c=c+Math.imul(J,Me)|0,_=_+Math.imul(J,Re)|0,S=S+Math.imul(we,ie)|0,c=c+Math.imul(we,Ae)|0,c=c+Math.imul(ue,ie)|0,_=_+Math.imul(ue,Ae)|0,S=S+Math.imul(X,me)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(se,me)|0,_=_+Math.imul(se,Qe)|0,S=S+Math.imul(H,ze)|0,c=c+Math.imul(H,We)|0,c=c+Math.imul(ee,ze)|0,_=_+Math.imul(ee,We)|0;var Tt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,S=Math.imul(_e,re),c=Math.imul(_e,de),c=c+Math.imul(Le,re)|0,_=Math.imul(Le,de),S=S+Math.imul(le,Me)|0,c=c+Math.imul(le,Re)|0,c=c+Math.imul(oe,Me)|0,_=_+Math.imul(oe,Re)|0,S=S+Math.imul(W,ie)|0,c=c+Math.imul(W,Ae)|0,c=c+Math.imul(J,ie)|0,_=_+Math.imul(J,Ae)|0,S=S+Math.imul(we,me)|0,c=c+Math.imul(we,Qe)|0,c=c+Math.imul(ue,me)|0,_=_+Math.imul(ue,Qe)|0,S=S+Math.imul(X,ze)|0,c=c+Math.imul(X,We)|0,c=c+Math.imul(se,ze)|0,_=_+Math.imul(se,We)|0;var jt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(jt>>>26)|0,jt&=67108863,S=Math.imul(_e,Me),c=Math.imul(_e,Re),c=c+Math.imul(Le,Me)|0,_=Math.imul(Le,Re),S=S+Math.imul(le,ie)|0,c=c+Math.imul(le,Ae)|0,c=c+Math.imul(oe,ie)|0,_=_+Math.imul(oe,Ae)|0,S=S+Math.imul(W,me)|0,c=c+Math.imul(W,Qe)|0,c=c+Math.imul(J,me)|0,_=_+Math.imul(J,Qe)|0,S=S+Math.imul(we,ze)|0,c=c+Math.imul(we,We)|0,c=c+Math.imul(ue,ze)|0,_=_+Math.imul(ue,We)|0;var Ut=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,S=Math.imul(_e,ie),c=Math.imul(_e,Ae),c=c+Math.imul(Le,ie)|0,_=Math.imul(Le,Ae),S=S+Math.imul(le,me)|0,c=c+Math.imul(le,Qe)|0,c=c+Math.imul(oe,me)|0,_=_+Math.imul(oe,Qe)|0,S=S+Math.imul(W,ze)|0,c=c+Math.imul(W,We)|0,c=c+Math.imul(J,ze)|0,_=_+Math.imul(J,We)|0;var Zt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,S=Math.imul(_e,me),c=Math.imul(_e,Qe),c=c+Math.imul(Le,me)|0,_=Math.imul(Le,Qe),S=S+Math.imul(le,ze)|0,c=c+Math.imul(le,We)|0,c=c+Math.imul(oe,ze)|0,_=_+Math.imul(oe,We)|0;var Gt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,S=Math.imul(_e,ze),c=Math.imul(_e,We),c=c+Math.imul(Le,ze)|0,_=Math.imul(Le,We);var Yt=(N+S|0)+((c&8191)<<13)|0;return N=(_+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,A[0]=Te,A[1]=Ze,A[2]=lt,A[3]=yt,A[4]=ht,A[5]=Nt,A[6]=Dt,A[7]=Ct,A[8]=St,A[9]=Ht,A[10]=Vt,A[11]=Pt,A[12]=Ft,A[13]=Tt,A[14]=jt,A[15]=Ut,A[16]=Zt,A[17]=Gt,A[18]=Yt,N!==0&&(A[19]=N,u.length++),u},"L");Math.imul||(E=M);function R(a,g,u){u.negative=g.negative^a.negative,u.length=a.length+g.length;for(var d=0,x=0,A=0;A<u.length-1;A++){var N=x;x=0;for(var S=d&67108863,c=Math.min(A,g.length-1),_=Math.max(0,A-a.length+1);_<=c;_++){var C=A-_,O=a.words[C]|0,D=g.words[_]|0,B=O*D,z=B&67108863;N=N+(B/67108864|0)|0,z=z+S|0,S=z&67108863,N=N+(z>>>26)|0,x+=N>>>26,N&=67108863}u.words[A]=S,d=N,N=x}return d!==0?u.words[A]=d:u.length--,u.strip()}o(R,"h");function I(a,g,u){var d=new T;return d.mulp(a,g,u)}o(I,"b"),n.prototype.mulTo=function(a,g){var u,d=this.length+a.length;return this.length===10&&a.length===10?u=E(this,a,g):d<63?u=M(this,a,g):d<1024?u=R(this,a,g):u=I(this,a,g),u};function T(a,g){this.x=a,this.y=g}o(T,"y"),T.prototype.makeRBT=function(a){for(var g=Array(a),u=n.prototype._countBits(a)-1,d=0;d<a;d++)g[d]=this.revBin(d,u,a);return g},T.prototype.revBin=function(a,g,u){if(a===0||a===u-1)return a;for(var d=0,x=0;x<g;x++)d|=(a&1)<<g-x-1,a>>=1;return d},T.prototype.permute=function(a,g,u,d,x,A){for(var N=0;N<A;N++)d[N]=g[a[N]],x[N]=u[a[N]]},T.prototype.transform=function(a,g,u,d,x,A){this.permute(A,a,g,u,d,x);for(var N=1;N<x;N<<=1)for(var S=N<<1,c=Math.cos(2*Math.PI/S),_=Math.sin(2*Math.PI/S),C=0;C<x;C+=S)for(var O=c,D=_,B=0;B<N;B++){var z=u[C+B],G=d[C+B],te=u[C+B+N],$=d[C+B+N],q=O*te-D*$;$=O*$+D*te,te=q,u[C+B]=z+te,d[C+B]=G+$,u[C+B+N]=z-te,d[C+B+N]=G-$,B!==S&&(q=c*O-_*D,D=c*D+_*O,O=q)}},T.prototype.guessLen13b=function(a,g){var u=Math.max(g,a)|1,d=u&1,x=0;for(u=u/2|0;u;u=u>>>1)x++;return 1<<x+1+d},T.prototype.conjugate=function(a,g,u){if(!(u<=1))for(var d=0;d<u/2;d++){var x=a[d];a[d]=a[u-d-1],a[u-d-1]=x,x=g[d],g[d]=-g[u-d-1],g[u-d-1]=-x}},T.prototype.normalize13b=function(a,g){for(var u=0,d=0;d<g/2;d++){var x=Math.round(a[2*d+1]/g)*8192+Math.round(a[2*d]/g)+u;a[d]=x&67108863,x<67108864?u=0:u=x/67108864|0}return a},T.prototype.convert13b=function(a,g,u,d){for(var x=0,A=0;A<g;A++)x=x+(a[A]|0),u[2*A]=x&8191,x=x>>>13,u[2*A+1]=x&8191,x=x>>>13;for(A=2*g;A<d;++A)u[A]=0;s(x===0),s((x&-8192)===0)},T.prototype.stub=function(a){for(var g=Array(a),u=0;u<a;u++)g[u]=0;return g},T.prototype.mulp=function(a,g,u){var d=2*this.guessLen13b(a.length,g.length),x=this.makeRBT(d),A=this.stub(d),N=Array(d),S=Array(d),c=Array(d),_=Array(d),C=Array(d),O=Array(d),D=u.words;D.length=d,this.convert13b(a.words,a.length,N,d),this.convert13b(g.words,g.length,_,d),this.transform(N,A,S,c,d,x),this.transform(_,A,C,O,d,x);for(var B=0;B<d;B++){var z=S[B]*C[B]-c[B]*O[B];c[B]=S[B]*O[B]+c[B]*C[B],S[B]=z}return this.conjugate(S,c,d),this.transform(S,c,D,A,d,x),this.conjugate(D,A,d),this.normalize13b(D,d),u.negative=a.negative^g.negative,u.length=a.length+g.length,u.strip()},n.prototype.mul=function(a){var g=new n(null);return g.words=Array(this.length+a.length),this.mulTo(a,g)},n.prototype.mulf=function(a){var g=new n(null);return g.words=Array(this.length+a.length),I(this,a,g)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){s(typeof a=="number"),s(a<67108864);for(var g=0,u=0;u<this.length;u++){var d=(this.words[u]|0)*a,x=(d&67108863)+(g&67108863);g>>=26,g+=d/67108864|0,g+=x>>>26,this.words[u]=x&67108863}return g!==0&&(this.words[u]=g,this.length++),this.length=a===0?1:this.length,this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var g=y(a);if(g.length===0)return new n(1);for(var u=this,d=0;d<g.length&&g[d]===0;d++,u=u.sqr());if(++d<g.length)for(var x=u.sqr();d<g.length;d++,x=x.sqr())g[d]!==0&&(u=u.mul(x));return u},n.prototype.iushln=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=67108863>>>26-g<<26-g,x;if(g!==0){var A=0;for(x=0;x<this.length;x++){var N=this.words[x]&d,S=(this.words[x]|0)-N<<g;this.words[x]=S|A,A=N>>>26-g}A&&(this.words[x]=A,this.length++)}if(u!==0){for(x=this.length-1;x>=0;x--)this.words[x+u]=this.words[x];for(x=0;x<u;x++)this.words[x]=0;this.length+=u}return this.strip()},n.prototype.ishln=function(a){return s(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,g,u){s(typeof a=="number"&&a>=0);var d;g?d=(g-g%26)/26:d=0;var x=a%26,A=Math.min((a-x)/26,this.length),N=67108863^67108863>>>x<<x,S=u;if(d-=A,d=Math.max(0,d),S){for(var c=0;c<A;c++)S.words[c]=this.words[c];S.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var _=0;for(c=this.length-1;c>=0&&(_!==0||c>=d);c--){var C=this.words[c]|0;this.words[c]=_<<26-x|C>>>x,_=C&N}return S&&_!==0&&(S.words[S.length++]=_),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(a,g,u){return s(this.negative===0),this.iushrn(a,g,u)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return!1;var x=this.words[u];return!!(x&d)},n.prototype.imaskn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(g!==0&&u++,this.length=Math.min(u,this.length),g!==0){var d=67108863^67108863>>>g<<g;this.words[this.length-1]&=d}return this.strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return s(typeof a=="number"),s(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},n.prototype.isubn=function(a){if(s(typeof a=="number"),s(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this.strip()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,g,u){var d=a.length+u,x;this._expand(d);var A,N=0;for(x=0;x<a.length;x++){A=(this.words[x+u]|0)+N;var S=(a.words[x]|0)*g;A-=S&67108863,N=(A>>26)-(S/67108864|0),this.words[x+u]=A&67108863}for(;x<this.length-u;x++)A=(this.words[x+u]|0)+N,N=A>>26,this.words[x+u]=A&67108863;if(N===0)return this.strip();for(s(N===-1),N=0,x=0;x<this.length;x++)A=-(this.words[x]|0)+N,N=A>>26,this.words[x]=A&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(a,g){var u=this.length-a.length,d=this.clone(),x=a,A=x.words[x.length-1]|0,N=this._countBits(A);u=26-N,u!==0&&(x=x.ushln(u),d.iushln(u),A=x.words[x.length-1]|0);var S=d.length-x.length,c;if(g!=="mod"){c=new n(null),c.length=S+1,c.words=Array(c.length);for(var _=0;_<c.length;_++)c.words[_]=0}var C=d.clone()._ishlnsubmul(x,1,S);C.negative===0&&(d=C,c&&(c.words[S]=1));for(var O=S-1;O>=0;O--){var D=(d.words[x.length+O]|0)*67108864+(d.words[x.length+O-1]|0);for(D=Math.min(D/A|0,67108863),d._ishlnsubmul(x,D,O);d.negative!==0;)D--,d.negative=0,d._ishlnsubmul(x,1,O),!d.isZero()&&(d.negative^=1);c&&(c.words[O]=D)}return c&&c.strip(),d.strip(),g!=="div"&&u!==0&&d.iushrn(u),{div:c||null,mod:d}},n.prototype.divmod=function(a,g,u){if(s(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var d,x,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,g),g!=="mod"&&(d=A.div.neg()),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.iadd(a)),{div:d,mod:x}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),g),g!=="mod"&&(d=A.div.neg()),{div:d,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),g),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.isub(a)),{div:A.div,mod:x}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?g==="div"?{div:this.divn(a.words[0]),mod:null}:g==="mod"?{div:null,mod:new n(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modn(a.words[0]))}:this._wordDiv(a,g)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var g=this.divmod(a);if(g.mod.isZero())return g.div;var u=g.div.negative!==0?g.mod.isub(a):g.mod,d=a.ushrn(1),x=a.andln(1),A=u.cmp(d);return A<0||x===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},n.prototype.modn=function(a){s(a<=67108863);for(var g=67108864%a,u=0,d=this.length-1;d>=0;d--)u=(g*u+(this.words[d]|0))%a;return u},n.prototype.idivn=function(a){s(a<=67108863);for(var g=0,u=this.length-1;u>=0;u--){var d=(this.words[u]|0)+g*67108864;this.words[u]=d/a|0,g=d%a}return this.strip()},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=new n(0),N=new n(1),S=0;g.isEven()&&u.isEven();)g.iushrn(1),u.iushrn(1),++S;for(var c=u.clone(),_=g.clone();!g.isZero();){for(var C=0,O=1;(g.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(g.iushrn(C);C-- >0;)(d.isOdd()||x.isOdd())&&(d.iadd(c),x.isub(_)),d.iushrn(1),x.iushrn(1);for(var D=0,B=1;(u.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(u.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(c),N.isub(_)),A.iushrn(1),N.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(A),x.isub(N)):(u.isub(g),A.isub(d),N.isub(x))}return{a:A,b:N,gcd:u.iushln(S)}},n.prototype._invmp=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=u.clone();g.cmpn(1)>0&&u.cmpn(1)>0;){for(var N=0,S=1;(g.words[0]&S)===0&&N<26;++N,S<<=1);if(N>0)for(g.iushrn(N);N-- >0;)d.isOdd()&&d.iadd(A),d.iushrn(1);for(var c=0,_=1;(u.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(u.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(x)):(u.isub(g),x.isub(d))}var C;return g.cmpn(1)===0?C=d:C=x,C.cmpn(0)<0&&C.iadd(a),C},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var g=this.clone(),u=a.clone();g.negative=0,u.negative=0;for(var d=0;g.isEven()&&u.isEven();d++)g.iushrn(1),u.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;u.isEven();)u.iushrn(1);var x=g.cmp(u);if(x<0){var A=g;g=u,u=A}else if(x===0||u.cmpn(1)===0)break;g.isub(u)}while(!0);return u.iushln(d)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){s(typeof a=="number");var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return this._expand(u+1),this.words[u]|=d,this;for(var x=d,A=u;x!==0&&A<this.length;A++){var N=this.words[A]|0;N+=x,x=N>>>26,N&=67108863,this.words[A]=N}return x!==0&&(this.words[A]=x,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var g=a<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this.strip();var u;if(this.length>1)u=1;else{g&&(a=-a),s(a<=67108863,"Number is too big");var d=this.words[0]|0;u=d===a?0:d<a?-1:1}return this.negative!==0?-u|0:u},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var g=this.ucmp(a);return this.negative!==0?-g|0:g},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var g=0,u=this.length-1;u>=0;u--){var d=this.words[u]|0,x=a.words[u]|0;if(d!==x){d<x?g=-1:d>x&&(g=1);break}}return g},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new F(a)},n.prototype.toRed=function(a){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return s(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return s(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var P={k256:null,p224:null,p192:null,p25519:null};function j(a,g){this.name=a,this.p=new n(g,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(j,"c"),j.prototype._tmp=function(){var a=new n(null);return a.words=Array(Math.ceil(this.n/13)),a},j.prototype.ireduce=function(a){var g=a,u;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),u=g.bitLength();while(u>this.n);var d=u<this.n?-1:g.ucmp(this.p);return d===0?(g.words[0]=0,g.length=1):d>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(a,g){a.iushrn(this.n,0,g)},j.prototype.imulK=function(a){return a.imul(this.k)};function L(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,"l"),f(L,j),L.prototype.split=function(a,g){for(var u=4194303,d=Math.min(a.length,9),x=0;x<d;x++)g.words[x]=a.words[x];if(g.length=d,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(g.words[g.length++]=A&u,x=10;x<a.length;x++){var N=a.words[x]|0;a.words[x-10]=(N&u)<<4|A>>>22,A=N}A>>>=22,a.words[x-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},L.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var g=0,u=0;u<a.length;u++){var d=a.words[u]|0;g+=d*977,a.words[u]=g&67108863,g=d*64+(g/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(U,"B"),f(U,j);function Z(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(Z,"s"),f(Z,j);function ne(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ne,"K8"),f(ne,j),ne.prototype.imulK=function(a){for(var g=0,u=0;u<a.length;u++){var d=(a.words[u]|0)*19+g,x=d&67108863;d>>>=26,a.words[u]=x,g=d}return g!==0&&(a.words[a.length++]=g),a},n._prime=function(a){if(P[a])return P[a];var g;if(a==="k256")g=new L;else if(a==="p224")g=new U;else if(a==="p192")g=new Z;else if(a==="p25519")g=new ne;else throw Error("Unknown prime "+a);return P[a]=g,g};function F(a){if(typeof a=="string"){var g=n._prime(a);this.m=g.p,this.prime=g}else s(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}o(F,"p"),F.prototype._verify1=function(a){s(a.negative===0,"red works only with positives"),s(a.red,"red works only with red numbers")},F.prototype._verify2=function(a,g){s((a.negative|g.negative)===0,"red works only with positives"),s(a.red&&a.red===g.red,"red works only with red numbers")},F.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},F.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},F.prototype.add=function(a,g){this._verify2(a,g);var u=a.add(g);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},F.prototype.iadd=function(a,g){this._verify2(a,g);var u=a.iadd(g);return u.cmp(this.m)>=0&&u.isub(this.m),u},F.prototype.sub=function(a,g){this._verify2(a,g);var u=a.sub(g);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},F.prototype.isub=function(a,g){this._verify2(a,g);var u=a.isub(g);return u.cmpn(0)<0&&u.iadd(this.m),u},F.prototype.shl=function(a,g){return this._verify1(a),this.imod(a.ushln(g))},F.prototype.imul=function(a,g){return this._verify2(a,g),this.imod(a.imul(g))},F.prototype.mul=function(a,g){return this._verify2(a,g),this.imod(a.mul(g))},F.prototype.isqr=function(a){return this.imul(a,a.clone())},F.prototype.sqr=function(a){return this.mul(a,a)},F.prototype.sqrt=function(a){if(a.isZero())return a.clone();var g=this.m.andln(3);if(s(g%2===1),g===3){var u=this.m.add(new n(1)).iushrn(2);return this.pow(a,u)}for(var d=this.m.subn(1),x=0;!d.isZero()&&d.andln(1)===0;)x++,d.iushrn(1);s(!d.isZero());var A=new n(1).toRed(this),N=A.redNeg(),S=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,S).cmp(N)!==0;)c.redIAdd(N);for(var _=this.pow(c,d),C=this.pow(a,d.addn(1).iushrn(1)),O=this.pow(a,d),D=x;O.cmp(A)!==0;){for(var B=O,z=0;B.cmp(A)!==0;z++)B=B.redSqr();s(z<D);var G=this.pow(_,new n(1).iushln(D-z-1));C=C.redMul(G),_=G.redSqr(),O=O.redMul(_),D=z}return C},F.prototype.invm=function(a){var g=a._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},F.prototype.pow=function(a,g){if(g.isZero())return new n(1).toRed(this);if(g.cmpn(1)===0)return a.clone();var u=4,d=Array(1<<u);d[0]=new n(1).toRed(this),d[1]=a;for(var x=2;x<d.length;x++)d[x]=this.mul(d[x-1],a);var A=d[0],N=0,S=0,c=g.bitLength()%26;for(c===0&&(c=26),x=g.length-1;x>=0;x--){for(var _=g.words[x],C=c-1;C>=0;C--){var O=_>>C&1;if(A!==d[0]&&(A=this.sqr(A)),O===0&&N===0){S=0;continue}N<<=1,N|=O,S++,!(S!==u&&(x!==0||C!==0))&&(A=this.mul(A,d[N]),S=0,N=0)}c=26}return A},F.prototype.convertTo=function(a){var g=a.umod(this.m);return g===a?g.clone():g},F.prototype.convertFrom=function(a){var g=a.clone();return g.red=null,g},n.mont=function(a){return new Y(a)};function Y(a){F.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"D"),f(Y,F),Y.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},Y.prototype.convertFrom=function(a){var g=this.imod(a.mul(this.rinv));return g.red=null,g},Y.prototype.imul=function(a,g){if(a.isZero()||g.isZero())return a.words[0]=0,a.length=1,a;var u=a.imul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.mul=function(a,g){if(a.isZero()||g.isZero())return new n(0)._forceRed(this);var u=a.mul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.invm=function(a){var g=this.imod(a._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(typeof e>"u"||e,t)}),Wc=nt((t,e)=>{var r=il(),i=Er().Buffer;function s(f,n){return i.from(f.toRed(r.mont(n.modulus)).redPow(new r(n.publicExponent)).fromRed().toArray())}o(s,"P"),e.exports=s}),dm=nt((t,e)=>{(function(r,i){function s(u,d){if(!u)throw Error(d||"Assertion failed")}o(s,"P");function f(u,d){u.super_=d;var x=o(function(){},"T");x.prototype=d.prototype,u.prototype=new x,u.prototype.constructor=u}o(f,"O");function n(u,d,x){if(n.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((d==="le"||d==="be")&&(x=d,d=10),this._init(u||0,d||10,x||"be"))}o(n,"Y"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(u){return u instanceof n?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===n.wordSize&&Array.isArray(u.words)},n.max=function(u,d){return u.cmp(d)>0?u:d},n.min=function(u,d){return u.cmp(d)<0?u:d},n.prototype._init=function(u,d,x){if(typeof u=="number")return this._initNumber(u,d,x);if(typeof u=="object")return this._initArray(u,d,x);d==="hex"&&(d=16),s(d===(d|0)&&d>=2&&d<=36),u=u.toString().replace(/\s+/g,"");var A=0;u[0]==="-"&&(A++,this.negative=1),A<u.length&&(d===16?this._parseHex(u,A,x):(this._parseBase(u,d,A),x==="le"&&this._initArray(this.toArray(),d,x)))},n.prototype._initNumber=function(u,d,x){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(s(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),d,x)},n.prototype._initArray=function(u,d,x){if(s(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var N,S,c=0;if(x==="be")for(A=u.length-1,N=0;A>=0;A-=3)S=u[A]|u[A-1]<<8|u[A-2]<<16,this.words[N]|=S<<c&67108863,this.words[N+1]=S>>>26-c&67108863,c+=24,c>=26&&(c-=26,N++);else if(x==="le")for(A=0,N=0;A<u.length;A+=3)S=u[A]|u[A+1]<<8|u[A+2]<<16,this.words[N]|=S<<c&67108863,this.words[N+1]=S>>>26-c&67108863,c+=24,c>=26&&(c-=26,N++);return this._strip()};function b(u,d){var x=u.charCodeAt(d);if(x>=48&&x<=57)return x-48;if(x>=65&&x<=70)return x-55;if(x>=97&&x<=102)return x-87;s(!1,"Invalid character in "+u)}o(b,"v");function h(u,d,x){var A=b(u,x);return x-1>=d&&(A|=b(u,x-1)<<4),A}o(h,"w"),n.prototype._parseHex=function(u,d,x){this.length=Math.ceil((u.length-d)/6),this.words=Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var N=0,S=0,c;if(x==="be")for(A=u.length-1;A>=d;A-=2)c=h(u,d,A)<<N,this.words[S]|=c&67108863,N>=18?(N-=18,S+=1,this.words[S]|=c>>>26):N+=8;else{var _=u.length-d;for(A=_%2===0?d+1:d;A<u.length;A+=2)c=h(u,d,A)<<N,this.words[S]|=c&67108863,N>=18?(N-=18,S+=1,this.words[S]|=c>>>26):N+=8}this._strip()};function m(u,d,x,A){for(var N=0,S=0,c=Math.min(u.length,x),_=d;_<c;_++){var C=u.charCodeAt(_)-48;N*=A,C>=49?S=C-49+10:C>=17?S=C-17+10:S=C,s(C>=0&&S<A,"Invalid character"),N+=S}return N}o(m,"V"),n.prototype._parseBase=function(u,d,x){this.words=[0],this.length=1;for(var A=0,N=1;N<=67108863;N*=d)A++;A--,N=N/d|0;for(var S=u.length-x,c=S%A,_=Math.min(S,S-c)+x,C=0,O=x;O<_;O+=A)C=m(u,O,O+A,d),this.imuln(N),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C);if(c!==0){var D=1;for(C=m(u,O,u.length,d),O=0;O<c;O++)D*=d;this.imuln(D),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C)}this._strip()},n.prototype.copy=function(u){u.words=Array(this.length);for(var d=0;d<this.length;d++)u.words[d]=this.words[d];u.length=this.length,u.negative=this.negative,u.red=this.red};function l(u,d){u.words=d.words,u.length=d.length,u.negative=d.negative,u.red=d.red}if(o(l,"Z"),n.prototype._move=function(u){l(u,this)},n.prototype.clone=function(){var u=new n(null);return this.copy(u),u},n.prototype._expand=function(u){for(;this.length<u;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{n.prototype.inspect=w}else n.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}o(w,"S");var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(u,d){u=u||10,d=d|0||1;var x;if(u===16||u==="hex"){x="";for(var A=0,N=0,S=0;S<this.length;S++){var c=this.words[S],_=((c<<A|N)&16777215).toString(16);N=c>>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),N!==0||S!==this.length-1?x=p[6-_.length]+_+x:x=_+x}for(N!==0&&(x=N.toString(16)+x);x.length%d!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(u===(u|0)&&u>=2&&u<=36){var C=y[u],O=M[u];x="";var D=this.clone();for(D.negative=0;!D.isZero();){var B=D.modrn(O).toString(u);D=D.idivn(O),D.isZero()?x=B+x:x=p[C-B.length]+B+x}for(this.isZero()&&(x="0"+x);x.length%d!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},n.prototype.toJSON=function(){return this.toString(16,2)},v&&(n.prototype.toBuffer=function(u,d){return this.toArrayLike(v,u,d)}),n.prototype.toArray=function(u,d){return this.toArrayLike(Array,u,d)};var E=o(function(u,d){return u.allocUnsafe?u.allocUnsafe(d):new u(d)},"L");n.prototype.toArrayLike=function(u,d,x){this._strip();var A=this.byteLength(),N=x||Math.max(1,A);s(A<=N,"byte array longer than desired length"),s(N>0,"Requested array length <= 0");var S=E(u,N),c=d==="le"?"LE":"BE";return this["_toArrayLike"+c](S,A),S},n.prototype._toArrayLikeLE=function(u,d){for(var x=0,A=0,N=0,S=0;N<this.length;N++){var c=this.words[N]<<S|A;u[x++]=c&255,x<u.length&&(u[x++]=c>>8&255),x<u.length&&(u[x++]=c>>16&255),S===6?(x<u.length&&(u[x++]=c>>24&255),A=0,S=0):(A=c>>>24,S+=2)}if(x<u.length)for(u[x++]=A;x<u.length;)u[x++]=0},n.prototype._toArrayLikeBE=function(u,d){for(var x=u.length-1,A=0,N=0,S=0;N<this.length;N++){var c=this.words[N]<<S|A;u[x--]=c&255,x>=0&&(u[x--]=c>>8&255),x>=0&&(u[x--]=c>>16&255),S===6?(x>=0&&(u[x--]=c>>24&255),A=0,S=0):(A=c>>>24,S+=2)}if(x>=0)for(u[x--]=A;x>=0;)u[x--]=0},Math.clz32?n.prototype._countBits=function(u){return 32-Math.clz32(u)}:n.prototype._countBits=function(u){var d=u,x=0;return d>=4096&&(x+=13,d>>>=13),d>=64&&(x+=7,d>>>=7),d>=8&&(x+=4,d>>>=4),d>=2&&(x+=2,d>>>=2),x+d},n.prototype._zeroBits=function(u){if(u===0)return 26;var d=u,x=0;return(d&8191)===0&&(x+=13,d>>>=13),(d&127)===0&&(x+=7,d>>>=7),(d&15)===0&&(x+=4,d>>>=4),(d&3)===0&&(x+=2,d>>>=2),(d&1)===0&&x++,x},n.prototype.bitLength=function(){var u=this.words[this.length-1],d=this._countBits(u);return(this.length-1)*26+d};function R(u){for(var d=Array(u.bitLength()),x=0;x<d.length;x++){var A=x/26|0,N=x%26;d[x]=u.words[A]>>>N&1}return d}o(R,"h"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,d=0;d<this.length;d++){var x=this._zeroBits(this.words[d]);if(u+=x,x!==26)break}return u},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},n.prototype.fromTwos=function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var d=0;d<u.length;d++)this.words[d]=this.words[d]|u.words[d];return this._strip()},n.prototype.ior=function(u){return s((this.negative|u.negative)===0),this.iuor(u)},n.prototype.or=function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},n.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},n.prototype.iuand=function(u){var d;this.length>u.length?d=u:d=this;for(var x=0;x<d.length;x++)this.words[x]=this.words[x]&u.words[x];return this.length=d.length,this._strip()},n.prototype.iand=function(u){return s((this.negative|u.negative)===0),this.iuand(u)},n.prototype.and=function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},n.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},n.prototype.iuxor=function(u){var d,x;this.length>u.length?(d=this,x=u):(d=u,x=this);for(var A=0;A<x.length;A++)this.words[A]=d.words[A]^x.words[A];if(this!==d)for(;A<d.length;A++)this.words[A]=d.words[A];return this.length=d.length,this._strip()},n.prototype.ixor=function(u){return s((this.negative|u.negative)===0),this.iuxor(u)},n.prototype.xor=function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},n.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},n.prototype.inotn=function(u){s(typeof u=="number"&&u>=0);var d=Math.ceil(u/26)|0,x=u%26;this._expand(d),x>0&&d--;for(var A=0;A<d;A++)this.words[A]=~this.words[A]&67108863;return x>0&&(this.words[A]=~this.words[A]&67108863>>26-x),this._strip()},n.prototype.notn=function(u){return this.clone().inotn(u)},n.prototype.setn=function(u,d){s(typeof u=="number"&&u>=0);var x=u/26|0,A=u%26;return this._expand(x+1),d?this.words[x]=this.words[x]|1<<A:this.words[x]=this.words[x]&~(1<<A),this._strip()},n.prototype.iadd=function(u){var d;if(this.negative!==0&&u.negative===0)return this.negative=0,d=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,d=this.isub(u),u.negative=1,d._normSign();var x,A;this.length>u.length?(x=this,A=u):(x=u,A=this);for(var N=0,S=0;S<A.length;S++)d=(x.words[S]|0)+(A.words[S]|0)+N,this.words[S]=d&67108863,N=d>>>26;for(;N!==0&&S<x.length;S++)d=(x.words[S]|0)+N,this.words[S]=d&67108863,N=d>>>26;if(this.length=x.length,N!==0)this.words[this.length]=N,this.length++;else if(x!==this)for(;S<x.length;S++)this.words[S]=x.words[S];return this},n.prototype.add=function(u){var d;return u.negative!==0&&this.negative===0?(u.negative=0,d=this.sub(u),u.negative^=1,d):u.negative===0&&this.negative!==0?(this.negative=0,d=u.sub(this),this.negative=1,d):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},n.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var d=this.iadd(u);return u.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var x=this.cmp(u);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,N;x>0?(A=this,N=u):(A=u,N=this);for(var S=0,c=0;c<N.length;c++)d=(A.words[c]|0)-(N.words[c]|0)+S,S=d>>26,this.words[c]=d&67108863;for(;S!==0&&c<A.length;c++)d=(A.words[c]|0)+S,S=d>>26,this.words[c]=d&67108863;if(S===0&&c<A.length&&A!==this)for(;c<A.length;c++)this.words[c]=A.words[c];return this.length=Math.max(this.length,c),A!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(u){return this.clone().isub(u)};function I(u,d,x){x.negative=d.negative^u.negative;var A=u.length+d.length|0;x.length=A,A=A-1|0;var N=u.words[0]|0,S=d.words[0]|0,c=N*S,_=c&67108863,C=c/67108864|0;x.words[0]=_;for(var O=1;O<A;O++){for(var D=C>>>26,B=C&67108863,z=Math.min(O,d.length-1),G=Math.max(0,O-u.length+1);G<=z;G++){var te=O-G|0;N=u.words[te]|0,S=d.words[G]|0,c=N*S+B,D+=c/67108864|0,B=c&67108863}x.words[O]=B|0,C=D|0}return C!==0?x.words[O]=C|0:x.length--,x._strip()}o(I,"b");var T=o(function(u,d,x){var A=u.words,N=d.words,S=x.words,c=0,_,C,O,D=A[0]|0,B=D&8191,z=D>>>13,G=A[1]|0,te=G&8191,$=G>>>13,q=A[2]|0,Ce=q&8191,fe=q>>>13,ae=A[3]|0,be=ae&8191,H=ae>>>13,ee=A[4]|0,Q=ee&8191,X=ee>>>13,se=A[5]|0,Ne=se&8191,we=se>>>13,ue=A[6]|0,K=ue&8191,W=ue>>>13,J=A[7]|0,pe=J&8191,le=J>>>13,oe=A[8]|0,Ve=oe&8191,_e=oe>>>13,Le=A[9]|0,qe=Le&8191,ge=Le>>>13,De=N[0]|0,he=De&8191,ve=De>>>13,Oe=N[1]|0,je=Oe&8191,ke=Oe>>>13,Fe=N[2]|0,et=Fe&8191,Ie=Fe>>>13,Se=N[3]|0,Be=Se&8191,Ee=Se>>>13,Ue=N[4]|0,Je=Ue&8191,re=Ue>>>13,de=N[5]|0,Pe=de&8191,Me=de>>>13,Re=N[6]|0,Ke=Re&8191,ie=Re>>>13,Ae=N[7]|0,Ye=Ae&8191,me=Ae>>>13,Qe=N[8]|0,st=Qe&8191,ze=Qe>>>13,We=N[9]|0,Te=We&8191,Ze=We>>>13;x.negative=u.negative^d.negative,x.length=19,_=Math.imul(B,he),C=Math.imul(B,ve),C=C+Math.imul(z,he)|0,O=Math.imul(z,ve);var lt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(lt>>>26)|0,lt&=67108863,_=Math.imul(te,he),C=Math.imul(te,ve),C=C+Math.imul($,he)|0,O=Math.imul($,ve),_=_+Math.imul(B,je)|0,C=C+Math.imul(B,ke)|0,C=C+Math.imul(z,je)|0,O=O+Math.imul(z,ke)|0;var yt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(yt>>>26)|0,yt&=67108863,_=Math.imul(Ce,he),C=Math.imul(Ce,ve),C=C+Math.imul(fe,he)|0,O=Math.imul(fe,ve),_=_+Math.imul(te,je)|0,C=C+Math.imul(te,ke)|0,C=C+Math.imul($,je)|0,O=O+Math.imul($,ke)|0,_=_+Math.imul(B,et)|0,C=C+Math.imul(B,Ie)|0,C=C+Math.imul(z,et)|0,O=O+Math.imul(z,Ie)|0;var ht=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(ht>>>26)|0,ht&=67108863,_=Math.imul(be,he),C=Math.imul(be,ve),C=C+Math.imul(H,he)|0,O=Math.imul(H,ve),_=_+Math.imul(Ce,je)|0,C=C+Math.imul(Ce,ke)|0,C=C+Math.imul(fe,je)|0,O=O+Math.imul(fe,ke)|0,_=_+Math.imul(te,et)|0,C=C+Math.imul(te,Ie)|0,C=C+Math.imul($,et)|0,O=O+Math.imul($,Ie)|0,_=_+Math.imul(B,Be)|0,C=C+Math.imul(B,Ee)|0,C=C+Math.imul(z,Be)|0,O=O+Math.imul(z,Ee)|0;var Nt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,_=Math.imul(Q,he),C=Math.imul(Q,ve),C=C+Math.imul(X,he)|0,O=Math.imul(X,ve),_=_+Math.imul(be,je)|0,C=C+Math.imul(be,ke)|0,C=C+Math.imul(H,je)|0,O=O+Math.imul(H,ke)|0,_=_+Math.imul(Ce,et)|0,C=C+Math.imul(Ce,Ie)|0,C=C+Math.imul(fe,et)|0,O=O+Math.imul(fe,Ie)|0,_=_+Math.imul(te,Be)|0,C=C+Math.imul(te,Ee)|0,C=C+Math.imul($,Be)|0,O=O+Math.imul($,Ee)|0,_=_+Math.imul(B,Je)|0,C=C+Math.imul(B,re)|0,C=C+Math.imul(z,Je)|0,O=O+Math.imul(z,re)|0;var Dt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,_=Math.imul(Ne,he),C=Math.imul(Ne,ve),C=C+Math.imul(we,he)|0,O=Math.imul(we,ve),_=_+Math.imul(Q,je)|0,C=C+Math.imul(Q,ke)|0,C=C+Math.imul(X,je)|0,O=O+Math.imul(X,ke)|0,_=_+Math.imul(be,et)|0,C=C+Math.imul(be,Ie)|0,C=C+Math.imul(H,et)|0,O=O+Math.imul(H,Ie)|0,_=_+Math.imul(Ce,Be)|0,C=C+Math.imul(Ce,Ee)|0,C=C+Math.imul(fe,Be)|0,O=O+Math.imul(fe,Ee)|0,_=_+Math.imul(te,Je)|0,C=C+Math.imul(te,re)|0,C=C+Math.imul($,Je)|0,O=O+Math.imul($,re)|0,_=_+Math.imul(B,Pe)|0,C=C+Math.imul(B,Me)|0,C=C+Math.imul(z,Pe)|0,O=O+Math.imul(z,Me)|0;var Ct=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,_=Math.imul(K,he),C=Math.imul(K,ve),C=C+Math.imul(W,he)|0,O=Math.imul(W,ve),_=_+Math.imul(Ne,je)|0,C=C+Math.imul(Ne,ke)|0,C=C+Math.imul(we,je)|0,O=O+Math.imul(we,ke)|0,_=_+Math.imul(Q,et)|0,C=C+Math.imul(Q,Ie)|0,C=C+Math.imul(X,et)|0,O=O+Math.imul(X,Ie)|0,_=_+Math.imul(be,Be)|0,C=C+Math.imul(be,Ee)|0,C=C+Math.imul(H,Be)|0,O=O+Math.imul(H,Ee)|0,_=_+Math.imul(Ce,Je)|0,C=C+Math.imul(Ce,re)|0,C=C+Math.imul(fe,Je)|0,O=O+Math.imul(fe,re)|0,_=_+Math.imul(te,Pe)|0,C=C+Math.imul(te,Me)|0,C=C+Math.imul($,Pe)|0,O=O+Math.imul($,Me)|0,_=_+Math.imul(B,Ke)|0,C=C+Math.imul(B,ie)|0,C=C+Math.imul(z,Ke)|0,O=O+Math.imul(z,ie)|0;var St=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(St>>>26)|0,St&=67108863,_=Math.imul(pe,he),C=Math.imul(pe,ve),C=C+Math.imul(le,he)|0,O=Math.imul(le,ve),_=_+Math.imul(K,je)|0,C=C+Math.imul(K,ke)|0,C=C+Math.imul(W,je)|0,O=O+Math.imul(W,ke)|0,_=_+Math.imul(Ne,et)|0,C=C+Math.imul(Ne,Ie)|0,C=C+Math.imul(we,et)|0,O=O+Math.imul(we,Ie)|0,_=_+Math.imul(Q,Be)|0,C=C+Math.imul(Q,Ee)|0,C=C+Math.imul(X,Be)|0,O=O+Math.imul(X,Ee)|0,_=_+Math.imul(be,Je)|0,C=C+Math.imul(be,re)|0,C=C+Math.imul(H,Je)|0,O=O+Math.imul(H,re)|0,_=_+Math.imul(Ce,Pe)|0,C=C+Math.imul(Ce,Me)|0,C=C+Math.imul(fe,Pe)|0,O=O+Math.imul(fe,Me)|0,_=_+Math.imul(te,Ke)|0,C=C+Math.imul(te,ie)|0,C=C+Math.imul($,Ke)|0,O=O+Math.imul($,ie)|0,_=_+Math.imul(B,Ye)|0,C=C+Math.imul(B,me)|0,C=C+Math.imul(z,Ye)|0,O=O+Math.imul(z,me)|0;var Ht=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,_=Math.imul(Ve,he),C=Math.imul(Ve,ve),C=C+Math.imul(_e,he)|0,O=Math.imul(_e,ve),_=_+Math.imul(pe,je)|0,C=C+Math.imul(pe,ke)|0,C=C+Math.imul(le,je)|0,O=O+Math.imul(le,ke)|0,_=_+Math.imul(K,et)|0,C=C+Math.imul(K,Ie)|0,C=C+Math.imul(W,et)|0,O=O+Math.imul(W,Ie)|0,_=_+Math.imul(Ne,Be)|0,C=C+Math.imul(Ne,Ee)|0,C=C+Math.imul(we,Be)|0,O=O+Math.imul(we,Ee)|0,_=_+Math.imul(Q,Je)|0,C=C+Math.imul(Q,re)|0,C=C+Math.imul(X,Je)|0,O=O+Math.imul(X,re)|0,_=_+Math.imul(be,Pe)|0,C=C+Math.imul(be,Me)|0,C=C+Math.imul(H,Pe)|0,O=O+Math.imul(H,Me)|0,_=_+Math.imul(Ce,Ke)|0,C=C+Math.imul(Ce,ie)|0,C=C+Math.imul(fe,Ke)|0,O=O+Math.imul(fe,ie)|0,_=_+Math.imul(te,Ye)|0,C=C+Math.imul(te,me)|0,C=C+Math.imul($,Ye)|0,O=O+Math.imul($,me)|0,_=_+Math.imul(B,st)|0,C=C+Math.imul(B,ze)|0,C=C+Math.imul(z,st)|0,O=O+Math.imul(z,ze)|0;var Vt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,_=Math.imul(qe,he),C=Math.imul(qe,ve),C=C+Math.imul(ge,he)|0,O=Math.imul(ge,ve),_=_+Math.imul(Ve,je)|0,C=C+Math.imul(Ve,ke)|0,C=C+Math.imul(_e,je)|0,O=O+Math.imul(_e,ke)|0,_=_+Math.imul(pe,et)|0,C=C+Math.imul(pe,Ie)|0,C=C+Math.imul(le,et)|0,O=O+Math.imul(le,Ie)|0,_=_+Math.imul(K,Be)|0,C=C+Math.imul(K,Ee)|0,C=C+Math.imul(W,Be)|0,O=O+Math.imul(W,Ee)|0,_=_+Math.imul(Ne,Je)|0,C=C+Math.imul(Ne,re)|0,C=C+Math.imul(we,Je)|0,O=O+Math.imul(we,re)|0,_=_+Math.imul(Q,Pe)|0,C=C+Math.imul(Q,Me)|0,C=C+Math.imul(X,Pe)|0,O=O+Math.imul(X,Me)|0,_=_+Math.imul(be,Ke)|0,C=C+Math.imul(be,ie)|0,C=C+Math.imul(H,Ke)|0,O=O+Math.imul(H,ie)|0,_=_+Math.imul(Ce,Ye)|0,C=C+Math.imul(Ce,me)|0,C=C+Math.imul(fe,Ye)|0,O=O+Math.imul(fe,me)|0,_=_+Math.imul(te,st)|0,C=C+Math.imul(te,ze)|0,C=C+Math.imul($,st)|0,O=O+Math.imul($,ze)|0,_=_+Math.imul(B,Te)|0,C=C+Math.imul(B,Ze)|0,C=C+Math.imul(z,Te)|0,O=O+Math.imul(z,Ze)|0;var Pt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,_=Math.imul(qe,je),C=Math.imul(qe,ke),C=C+Math.imul(ge,je)|0,O=Math.imul(ge,ke),_=_+Math.imul(Ve,et)|0,C=C+Math.imul(Ve,Ie)|0,C=C+Math.imul(_e,et)|0,O=O+Math.imul(_e,Ie)|0,_=_+Math.imul(pe,Be)|0,C=C+Math.imul(pe,Ee)|0,C=C+Math.imul(le,Be)|0,O=O+Math.imul(le,Ee)|0,_=_+Math.imul(K,Je)|0,C=C+Math.imul(K,re)|0,C=C+Math.imul(W,Je)|0,O=O+Math.imul(W,re)|0,_=_+Math.imul(Ne,Pe)|0,C=C+Math.imul(Ne,Me)|0,C=C+Math.imul(we,Pe)|0,O=O+Math.imul(we,Me)|0,_=_+Math.imul(Q,Ke)|0,C=C+Math.imul(Q,ie)|0,C=C+Math.imul(X,Ke)|0,O=O+Math.imul(X,ie)|0,_=_+Math.imul(be,Ye)|0,C=C+Math.imul(be,me)|0,C=C+Math.imul(H,Ye)|0,O=O+Math.imul(H,me)|0,_=_+Math.imul(Ce,st)|0,C=C+Math.imul(Ce,ze)|0,C=C+Math.imul(fe,st)|0,O=O+Math.imul(fe,ze)|0,_=_+Math.imul(te,Te)|0,C=C+Math.imul(te,Ze)|0,C=C+Math.imul($,Te)|0,O=O+Math.imul($,Ze)|0;var Ft=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,_=Math.imul(qe,et),C=Math.imul(qe,Ie),C=C+Math.imul(ge,et)|0,O=Math.imul(ge,Ie),_=_+Math.imul(Ve,Be)|0,C=C+Math.imul(Ve,Ee)|0,C=C+Math.imul(_e,Be)|0,O=O+Math.imul(_e,Ee)|0,_=_+Math.imul(pe,Je)|0,C=C+Math.imul(pe,re)|0,C=C+Math.imul(le,Je)|0,O=O+Math.imul(le,re)|0,_=_+Math.imul(K,Pe)|0,C=C+Math.imul(K,Me)|0,C=C+Math.imul(W,Pe)|0,O=O+Math.imul(W,Me)|0,_=_+Math.imul(Ne,Ke)|0,C=C+Math.imul(Ne,ie)|0,C=C+Math.imul(we,Ke)|0,O=O+Math.imul(we,ie)|0,_=_+Math.imul(Q,Ye)|0,C=C+Math.imul(Q,me)|0,C=C+Math.imul(X,Ye)|0,O=O+Math.imul(X,me)|0,_=_+Math.imul(be,st)|0,C=C+Math.imul(be,ze)|0,C=C+Math.imul(H,st)|0,O=O+Math.imul(H,ze)|0,_=_+Math.imul(Ce,Te)|0,C=C+Math.imul(Ce,Ze)|0,C=C+Math.imul(fe,Te)|0,O=O+Math.imul(fe,Ze)|0;var Tt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,_=Math.imul(qe,Be),C=Math.imul(qe,Ee),C=C+Math.imul(ge,Be)|0,O=Math.imul(ge,Ee),_=_+Math.imul(Ve,Je)|0,C=C+Math.imul(Ve,re)|0,C=C+Math.imul(_e,Je)|0,O=O+Math.imul(_e,re)|0,_=_+Math.imul(pe,Pe)|0,C=C+Math.imul(pe,Me)|0,C=C+Math.imul(le,Pe)|0,O=O+Math.imul(le,Me)|0,_=_+Math.imul(K,Ke)|0,C=C+Math.imul(K,ie)|0,C=C+Math.imul(W,Ke)|0,O=O+Math.imul(W,ie)|0,_=_+Math.imul(Ne,Ye)|0,C=C+Math.imul(Ne,me)|0,C=C+Math.imul(we,Ye)|0,O=O+Math.imul(we,me)|0,_=_+Math.imul(Q,st)|0,C=C+Math.imul(Q,ze)|0,C=C+Math.imul(X,st)|0,O=O+Math.imul(X,ze)|0,_=_+Math.imul(be,Te)|0,C=C+Math.imul(be,Ze)|0,C=C+Math.imul(H,Te)|0,O=O+Math.imul(H,Ze)|0;var jt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(jt>>>26)|0,jt&=67108863,_=Math.imul(qe,Je),C=Math.imul(qe,re),C=C+Math.imul(ge,Je)|0,O=Math.imul(ge,re),_=_+Math.imul(Ve,Pe)|0,C=C+Math.imul(Ve,Me)|0,C=C+Math.imul(_e,Pe)|0,O=O+Math.imul(_e,Me)|0,_=_+Math.imul(pe,Ke)|0,C=C+Math.imul(pe,ie)|0,C=C+Math.imul(le,Ke)|0,O=O+Math.imul(le,ie)|0,_=_+Math.imul(K,Ye)|0,C=C+Math.imul(K,me)|0,C=C+Math.imul(W,Ye)|0,O=O+Math.imul(W,me)|0,_=_+Math.imul(Ne,st)|0,C=C+Math.imul(Ne,ze)|0,C=C+Math.imul(we,st)|0,O=O+Math.imul(we,ze)|0,_=_+Math.imul(Q,Te)|0,C=C+Math.imul(Q,Ze)|0,C=C+Math.imul(X,Te)|0,O=O+Math.imul(X,Ze)|0;var Ut=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,_=Math.imul(qe,Pe),C=Math.imul(qe,Me),C=C+Math.imul(ge,Pe)|0,O=Math.imul(ge,Me),_=_+Math.imul(Ve,Ke)|0,C=C+Math.imul(Ve,ie)|0,C=C+Math.imul(_e,Ke)|0,O=O+Math.imul(_e,ie)|0,_=_+Math.imul(pe,Ye)|0,C=C+Math.imul(pe,me)|0,C=C+Math.imul(le,Ye)|0,O=O+Math.imul(le,me)|0,_=_+Math.imul(K,st)|0,C=C+Math.imul(K,ze)|0,C=C+Math.imul(W,st)|0,O=O+Math.imul(W,ze)|0,_=_+Math.imul(Ne,Te)|0,C=C+Math.imul(Ne,Ze)|0,C=C+Math.imul(we,Te)|0,O=O+Math.imul(we,Ze)|0;var Zt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,_=Math.imul(qe,Ke),C=Math.imul(qe,ie),C=C+Math.imul(ge,Ke)|0,O=Math.imul(ge,ie),_=_+Math.imul(Ve,Ye)|0,C=C+Math.imul(Ve,me)|0,C=C+Math.imul(_e,Ye)|0,O=O+Math.imul(_e,me)|0,_=_+Math.imul(pe,st)|0,C=C+Math.imul(pe,ze)|0,C=C+Math.imul(le,st)|0,O=O+Math.imul(le,ze)|0,_=_+Math.imul(K,Te)|0,C=C+Math.imul(K,Ze)|0,C=C+Math.imul(W,Te)|0,O=O+Math.imul(W,Ze)|0;var Gt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,_=Math.imul(qe,Ye),C=Math.imul(qe,me),C=C+Math.imul(ge,Ye)|0,O=Math.imul(ge,me),_=_+Math.imul(Ve,st)|0,C=C+Math.imul(Ve,ze)|0,C=C+Math.imul(_e,st)|0,O=O+Math.imul(_e,ze)|0,_=_+Math.imul(pe,Te)|0,C=C+Math.imul(pe,Ze)|0,C=C+Math.imul(le,Te)|0,O=O+Math.imul(le,Ze)|0;var Yt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,_=Math.imul(qe,st),C=Math.imul(qe,ze),C=C+Math.imul(ge,st)|0,O=Math.imul(ge,ze),_=_+Math.imul(Ve,Te)|0,C=C+Math.imul(Ve,Ze)|0,C=C+Math.imul(_e,Te)|0,O=O+Math.imul(_e,Ze)|0;var bi=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(bi>>>26)|0,bi&=67108863,_=Math.imul(qe,Te),C=Math.imul(qe,Ze),C=C+Math.imul(ge,Te)|0,O=Math.imul(ge,Ze);var ce=(c+_|0)+((C&8191)<<13)|0;return c=(O+(C>>>13)|0)+(ce>>>26)|0,ce&=67108863,S[0]=lt,S[1]=yt,S[2]=ht,S[3]=Nt,S[4]=Dt,S[5]=Ct,S[6]=St,S[7]=Ht,S[8]=Vt,S[9]=Pt,S[10]=Ft,S[11]=Tt,S[12]=jt,S[13]=Ut,S[14]=Zt,S[15]=Gt,S[16]=Yt,S[17]=bi,S[18]=ce,c!==0&&(S[19]=c,x.length++),x},"y");Math.imul||(T=I);function P(u,d,x){x.negative=d.negative^u.negative,x.length=u.length+d.length;for(var A=0,N=0,S=0;S<x.length-1;S++){var c=N;N=0;for(var _=A&67108863,C=Math.min(S,d.length-1),O=Math.max(0,S-u.length+1);O<=C;O++){var D=S-O,B=u.words[D]|0,z=d.words[O]|0,G=B*z,te=G&67108863;c=c+(G/67108864|0)|0,te=te+_|0,_=te&67108863,c=c+(te>>>26)|0,N+=c>>>26,c&=67108863}x.words[S]=_,A=c,c=N}return A!==0?x.words[S]=A:x.length--,x._strip()}o(P,"x");function j(u,d,x){return P(u,d,x)}o(j,"c"),n.prototype.mulTo=function(u,d){var x,A=this.length+u.length;return this.length===10&&u.length===10?x=T(this,u,d):A<63?x=I(this,u,d):A<1024?x=P(this,u,d):x=j(this,u,d),x},n.prototype.mul=function(u){var d=new n(null);return d.words=Array(this.length+u.length),this.mulTo(u,d)},n.prototype.mulf=function(u){var d=new n(null);return d.words=Array(this.length+u.length),j(this,u,d)},n.prototype.imul=function(u){return this.clone().mulTo(u,this)},n.prototype.imuln=function(u){var d=u<0;d&&(u=-u),s(typeof u=="number"),s(u<67108864);for(var x=0,A=0;A<this.length;A++){var N=(this.words[A]|0)*u,S=(N&67108863)+(x&67108863);x>>=26,x+=N/67108864|0,x+=S>>>26,this.words[A]=S&67108863}return x!==0&&(this.words[A]=x,this.length++),this.length=u===0?1:this.length,d?this.ineg():this},n.prototype.muln=function(u){return this.clone().imuln(u)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(u){var d=R(u);if(d.length===0)return new n(1);for(var x=this,A=0;A<d.length&&d[A]===0;A++,x=x.sqr());if(++A<d.length)for(var N=x.sqr();A<d.length;A++,N=N.sqr())d[A]!==0&&(x=x.mul(N));return x},n.prototype.iushln=function(u){s(typeof u=="number"&&u>=0);var d=u%26,x=(u-d)/26,A=67108863>>>26-d<<26-d,N;if(d!==0){var S=0;for(N=0;N<this.length;N++){var c=this.words[N]&A,_=(this.words[N]|0)-c<<d;this.words[N]=_|S,S=c>>>26-d}S&&(this.words[N]=S,this.length++)}if(x!==0){for(N=this.length-1;N>=0;N--)this.words[N+x]=this.words[N];for(N=0;N<x;N++)this.words[N]=0;this.length+=x}return this._strip()},n.prototype.ishln=function(u){return s(this.negative===0),this.iushln(u)},n.prototype.iushrn=function(u,d,x){s(typeof u=="number"&&u>=0);var A;d?A=(d-d%26)/26:A=0;var N=u%26,S=Math.min((u-N)/26,this.length),c=67108863^67108863>>>N<<N,_=x;if(A-=S,A=Math.max(0,A),_){for(var C=0;C<S;C++)_.words[C]=this.words[C];_.length=S}if(S!==0)if(this.length>S)for(this.length-=S,C=0;C<this.length;C++)this.words[C]=this.words[C+S];else this.words[0]=0,this.length=1;var O=0;for(C=this.length-1;C>=0&&(O!==0||C>=A);C--){var D=this.words[C]|0;this.words[C]=O<<26-N|D>>>N,O=D&c}return _&&O!==0&&(_.words[_.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(u,d,x){return s(this.negative===0),this.iushrn(u,d,x)},n.prototype.shln=function(u){return this.clone().ishln(u)},n.prototype.ushln=function(u){return this.clone().iushln(u)},n.prototype.shrn=function(u){return this.clone().ishrn(u)},n.prototype.ushrn=function(u){return this.clone().iushrn(u)},n.prototype.testn=function(u){s(typeof u=="number"&&u>=0);var d=u%26,x=(u-d)/26,A=1<<d;if(this.length<=x)return!1;var N=this.words[x];return!!(N&A)},n.prototype.imaskn=function(u){s(typeof u=="number"&&u>=0);var d=u%26,x=(u-d)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(d!==0&&x++,this.length=Math.min(x,this.length),d!==0){var A=67108863^67108863>>>d<<d;this.words[this.length-1]&=A}return this._strip()},n.prototype.maskn=function(u){return this.clone().imaskn(u)},n.prototype.iaddn=function(u){return s(typeof u=="number"),s(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<=u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},n.prototype._iaddn=function(u){this.words[0]+=u;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(u){if(s(typeof u=="number"),s(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},n.prototype.addn=function(u){return this.clone().iaddn(u)},n.prototype.subn=function(u){return this.clone().isubn(u)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(u,d,x){var A=u.length+x,N;this._expand(A);var S,c=0;for(N=0;N<u.length;N++){S=(this.words[N+x]|0)+c;var _=(u.words[N]|0)*d;S-=_&67108863,c=(S>>26)-(_/67108864|0),this.words[N+x]=S&67108863}for(;N<this.length-x;N++)S=(this.words[N+x]|0)+c,c=S>>26,this.words[N+x]=S&67108863;if(c===0)return this._strip();for(s(c===-1),c=0,N=0;N<this.length;N++)S=-(this.words[N]|0)+c,c=S>>26,this.words[N]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(u,d){var x=this.length-u.length,A=this.clone(),N=u,S=N.words[N.length-1]|0,c=this._countBits(S);x=26-c,x!==0&&(N=N.ushln(x),A.iushln(x),S=N.words[N.length-1]|0);var _=A.length-N.length,C;if(d!=="mod"){C=new n(null),C.length=_+1,C.words=Array(C.length);for(var O=0;O<C.length;O++)C.words[O]=0}var D=A.clone()._ishlnsubmul(N,1,_);D.negative===0&&(A=D,C&&(C.words[_]=1));for(var B=_-1;B>=0;B--){var z=(A.words[N.length+B]|0)*67108864+(A.words[N.length+B-1]|0);for(z=Math.min(z/S|0,67108863),A._ishlnsubmul(N,z,B);A.negative!==0;)z--,A.negative=0,A._ishlnsubmul(N,1,B),!A.isZero()&&(A.negative^=1);C&&(C.words[B]=z)}return C&&C._strip(),A._strip(),d!=="div"&&x!==0&&A.iushrn(x),{div:C||null,mod:A}},n.prototype.divmod=function(u,d,x){if(s(!u.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var A,N,S;return this.negative!==0&&u.negative===0?(S=this.neg().divmod(u,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(N=S.mod.neg(),x&&N.negative!==0&&N.iadd(u)),{div:A,mod:N}):this.negative===0&&u.negative!==0?(S=this.divmod(u.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):(this.negative&u.negative)!==0?(S=this.neg().divmod(u.neg(),d),d!=="div"&&(N=S.mod.neg(),x&&N.negative!==0&&N.isub(u)),{div:S.div,mod:N}):u.length>this.length||this.cmp(u)<0?{div:new n(0),mod:this}:u.length===1?d==="div"?{div:this.divn(u.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new n(this.modrn(u.words[0]))}:this._wordDiv(u,d)},n.prototype.div=function(u){return this.divmod(u,"div",!1).div},n.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},n.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},n.prototype.divRound=function(u){var d=this.divmod(u);if(d.mod.isZero())return d.div;var x=d.div.negative!==0?d.mod.isub(u):d.mod,A=u.ushrn(1),N=u.andln(1),S=x.cmp(A);return S<0||N===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(u){var d=u<0;d&&(u=-u),s(u<=67108863);for(var x=67108864%u,A=0,N=this.length-1;N>=0;N--)A=(x*A+(this.words[N]|0))%u;return d?-A:A},n.prototype.modn=function(u){return this.modrn(u)},n.prototype.idivn=function(u){var d=u<0;d&&(u=-u),s(u<=67108863);for(var x=0,A=this.length-1;A>=0;A--){var N=(this.words[A]|0)+x*67108864;this.words[A]=N/u|0,x=N%u}return this._strip(),d?this.ineg():this},n.prototype.divn=function(u){return this.clone().idivn(u)},n.prototype.egcd=function(u){s(u.negative===0),s(!u.isZero());var d=this,x=u.clone();d.negative!==0?d=d.umod(u):d=d.clone();for(var A=new n(1),N=new n(0),S=new n(0),c=new n(1),_=0;d.isEven()&&x.isEven();)d.iushrn(1),x.iushrn(1),++_;for(var C=x.clone(),O=d.clone();!d.isZero();){for(var D=0,B=1;(d.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(d.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(C),N.isub(O)),A.iushrn(1),N.iushrn(1);for(var z=0,G=1;(x.words[0]&G)===0&&z<26;++z,G<<=1);if(z>0)for(x.iushrn(z);z-- >0;)(S.isOdd()||c.isOdd())&&(S.iadd(C),c.isub(O)),S.iushrn(1),c.iushrn(1);d.cmp(x)>=0?(d.isub(x),A.isub(S),N.isub(c)):(x.isub(d),S.isub(A),c.isub(N))}return{a:S,b:c,gcd:x.iushln(_)}},n.prototype._invmp=function(u){s(u.negative===0),s(!u.isZero());var d=this,x=u.clone();d.negative!==0?d=d.umod(u):d=d.clone();for(var A=new n(1),N=new n(0),S=x.clone();d.cmpn(1)>0&&x.cmpn(1)>0;){for(var c=0,_=1;(d.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(d.iushrn(c);c-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var C=0,O=1;(x.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(x.iushrn(C);C-- >0;)N.isOdd()&&N.iadd(S),N.iushrn(1);d.cmp(x)>=0?(d.isub(x),A.isub(N)):(x.isub(d),N.isub(A))}var D;return d.cmpn(1)===0?D=A:D=N,D.cmpn(0)<0&&D.iadd(u),D},n.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var d=this.clone(),x=u.clone();d.negative=0,x.negative=0;for(var A=0;d.isEven()&&x.isEven();A++)d.iushrn(1),x.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;x.isEven();)x.iushrn(1);var N=d.cmp(x);if(N<0){var S=d;d=x,x=S}else if(N===0||x.cmpn(1)===0)break;d.isub(x)}while(!0);return x.iushln(A)},n.prototype.invm=function(u){return this.egcd(u).a.umod(u)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(u){return this.words[0]&u},n.prototype.bincn=function(u){s(typeof u=="number");var d=u%26,x=(u-d)/26,A=1<<d;if(this.length<=x)return this._expand(x+1),this.words[x]|=A,this;for(var N=A,S=x;N!==0&&S<this.length;S++){var c=this.words[S]|0;c+=N,N=c>>>26,c&=67108863,this.words[S]=c}return N!==0&&(this.words[S]=N,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(u){var d=u<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var x;if(this.length>1)x=1;else{d&&(u=-u),s(u<=67108863,"Number is too big");var A=this.words[0]|0;x=A===u?0:A<u?-1:1}return this.negative!==0?-x|0:x},n.prototype.cmp=function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var d=this.ucmp(u);return this.negative!==0?-d|0:d},n.prototype.ucmp=function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var d=0,x=this.length-1;x>=0;x--){var A=this.words[x]|0,N=u.words[x]|0;if(A!==N){A<N?d=-1:A>N&&(d=1);break}}return d},n.prototype.gtn=function(u){return this.cmpn(u)===1},n.prototype.gt=function(u){return this.cmp(u)===1},n.prototype.gten=function(u){return this.cmpn(u)>=0},n.prototype.gte=function(u){return this.cmp(u)>=0},n.prototype.ltn=function(u){return this.cmpn(u)===-1},n.prototype.lt=function(u){return this.cmp(u)===-1},n.prototype.lten=function(u){return this.cmpn(u)<=0},n.prototype.lte=function(u){return this.cmp(u)<=0},n.prototype.eqn=function(u){return this.cmpn(u)===0},n.prototype.eq=function(u){return this.cmp(u)===0},n.red=function(u){return new a(u)},n.prototype.toRed=function(u){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(u){return this.red=u,this},n.prototype.forceRed=function(u){return s(!this.red,"Already a number in reduction context"),this._forceRed(u)},n.prototype.redAdd=function(u){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},n.prototype.redIAdd=function(u){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},n.prototype.redSub=function(u){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},n.prototype.redISub=function(u){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},n.prototype.redShl=function(u){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},n.prototype.redMul=function(u){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},n.prototype.redIMul=function(u){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(u){return s(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var L={k256:null,p224:null,p192:null,p25519:null};function U(u,d){this.name=u,this.p=new n(d,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(U,"s"),U.prototype._tmp=function(){var u=new n(null);return u.words=Array(Math.ceil(this.n/13)),u},U.prototype.ireduce=function(u){var d=u,x;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),x=d.bitLength();while(x>this.n);var A=x<this.n?-1:d.ucmp(this.p);return A===0?(d.words[0]=0,d.length=1):A>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(u,d){u.iushrn(this.n,0,d)},U.prototype.imulK=function(u){return u.imul(this.k)};function Z(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(Z,"K8"),f(Z,U),Z.prototype.split=function(u,d){for(var x=4194303,A=Math.min(u.length,9),N=0;N<A;N++)d.words[N]=u.words[N];if(d.length=A,u.length<=9){u.words[0]=0,u.length=1;return}var S=u.words[9];for(d.words[d.length++]=S&x,N=10;N<u.length;N++){var c=u.words[N]|0;u.words[N-10]=(c&x)<<4|S>>>22,S=c}S>>>=22,u.words[N-10]=S,S===0&&u.length>10?u.length-=10:u.length-=9},Z.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var d=0,x=0;x<u.length;x++){var A=u.words[x]|0;d+=A*977,u.words[x]=d&67108863,d=A*64+(d/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u};function ne(){U.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(ne,"p"),f(ne,U);function F(){U.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(F,"D"),f(F,U);function Y(){U.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(Y,"M"),f(Y,U),Y.prototype.imulK=function(u){for(var d=0,x=0;x<u.length;x++){var A=(u.words[x]|0)*19+d,N=A&67108863;A>>>=26,u.words[x]=N,d=A}return d!==0&&(u.words[u.length++]=d),u},n._prime=function(u){if(L[u])return L[u];var d;if(u==="k256")d=new Z;else if(u==="p224")d=new ne;else if(u==="p192")d=new F;else if(u==="p25519")d=new Y;else throw Error("Unknown prime "+u);return L[u]=d,d};function a(u){if(typeof u=="string"){var d=n._prime(u);this.m=d.p,this.prime=d}else s(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}o(a,"j"),a.prototype._verify1=function(u){s(u.negative===0,"red works only with positives"),s(u.red,"red works only with red numbers")},a.prototype._verify2=function(u,d){s((u.negative|d.negative)===0,"red works only with positives"),s(u.red&&u.red===d.red,"red works only with red numbers")},a.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(l(u,u.umod(this.m)._forceRed(this)),u)},a.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},a.prototype.add=function(u,d){this._verify2(u,d);var x=u.add(d);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},a.prototype.iadd=function(u,d){this._verify2(u,d);var x=u.iadd(d);return x.cmp(this.m)>=0&&x.isub(this.m),x},a.prototype.sub=function(u,d){this._verify2(u,d);var x=u.sub(d);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},a.prototype.isub=function(u,d){this._verify2(u,d);var x=u.isub(d);return x.cmpn(0)<0&&x.iadd(this.m),x},a.prototype.shl=function(u,d){return this._verify1(u),this.imod(u.ushln(d))},a.prototype.imul=function(u,d){return this._verify2(u,d),this.imod(u.imul(d))},a.prototype.mul=function(u,d){return this._verify2(u,d),this.imod(u.mul(d))},a.prototype.isqr=function(u){return this.imul(u,u.clone())},a.prototype.sqr=function(u){return this.mul(u,u)},a.prototype.sqrt=function(u){if(u.isZero())return u.clone();var d=this.m.andln(3);if(s(d%2===1),d===3){var x=this.m.add(new n(1)).iushrn(2);return this.pow(u,x)}for(var A=this.m.subn(1),N=0;!A.isZero()&&A.andln(1)===0;)N++,A.iushrn(1);s(!A.isZero());var S=new n(1).toRed(this),c=S.redNeg(),_=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new n(2*C*C).toRed(this);this.pow(C,_).cmp(c)!==0;)C.redIAdd(c);for(var O=this.pow(C,A),D=this.pow(u,A.addn(1).iushrn(1)),B=this.pow(u,A),z=N;B.cmp(S)!==0;){for(var G=B,te=0;G.cmp(S)!==0;te++)G=G.redSqr();s(te<z);var $=this.pow(O,new n(1).iushln(z-te-1));D=D.redMul($),O=$.redSqr(),B=B.redMul(O),z=te}return D},a.prototype.invm=function(u){var d=u._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},a.prototype.pow=function(u,d){if(d.isZero())return new n(1).toRed(this);if(d.cmpn(1)===0)return u.clone();var x=4,A=Array(1<<x);A[0]=new n(1).toRed(this),A[1]=u;for(var N=2;N<A.length;N++)A[N]=this.mul(A[N-1],u);var S=A[0],c=0,_=0,C=d.bitLength()%26;for(C===0&&(C=26),N=d.length-1;N>=0;N--){for(var O=d.words[N],D=C-1;D>=0;D--){var B=O>>D&1;if(S!==A[0]&&(S=this.sqr(S)),B===0&&c===0){_=0;continue}c<<=1,c|=B,_++,!(_!==x&&(N!==0||D!==0))&&(S=this.mul(S,A[c]),_=0,c=0)}C=26}return S},a.prototype.convertTo=function(u){var d=u.umod(this.m);return d===u?d.clone():d},a.prototype.convertFrom=function(u){var d=u.clone();return d.red=null,d},n.mont=function(u){return new g(u)};function g(u){a.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(g,"W"),f(g,a),g.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},g.prototype.convertFrom=function(u){var d=this.imod(u.mul(this.rinv));return d.red=null,d},g.prototype.imul=function(u,d){if(u.isZero()||d.isZero())return u.words[0]=0,u.length=1,u;var x=u.imul(d),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=x.isub(A).iushrn(this.shift),S=N;return N.cmp(this.m)>=0?S=N.isub(this.m):N.cmpn(0)<0&&(S=N.iadd(this.m)),S._forceRed(this)},g.prototype.mul=function(u,d){if(u.isZero()||d.isZero())return new n(0)._forceRed(this);var x=u.mul(d),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=x.isub(A).iushrn(this.shift),S=N;return N.cmp(this.m)>=0?S=N.isub(this.m):N.cmpn(0)<0&&(S=N.iadd(this.m)),S._forceRed(this)},g.prototype.invm=function(u){var d=this.imod(u._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof e>"u"||e,t)}),$c=nt((t,e)=>{var r=dm(),i=ua(),s=Er().Buffer;function f(b){var h=b.modulus.byteLength(),m;do m=new r(i(h));while(m.cmp(b.modulus)>=0||!m.umod(b.prime1)||!m.umod(b.prime2));return m}o(f,"O");function n(b){var h=f(b),m=h.toRed(r.mont(b.modulus)).redPow(new r(b.publicExponent)).fromRed();return{blinder:m,unblinder:h.invm(b.modulus)}}o(n,"Y");function v(b,h){var m=n(h),l=h.modulus.byteLength(),w=new r(b).mul(m.blinder).umod(h.modulus),p=w.toRed(r.mont(h.prime1)),y=w.toRed(r.mont(h.prime2)),M=h.coefficient,E=h.prime1,R=h.prime2,I=p.redPow(h.exponent1).fromRed(),T=y.redPow(h.exponent2).fromRed(),P=I.isub(T).imul(M).umod(E).imul(R);return T.iadd(P).imul(m.unblinder).umod(h.modulus).toArrayLike(s,"be",l)}o(v,"z"),v.getr=f,e.exports=v}),hm=nt((t,e)=>{var r=Qc(),i=ua(),s=ca(),f=Kc(),n=Xc(),v=il(),b=Wc(),h=$c(),m=Er().Buffer;e.exports=function(y,M,E){var R;y.padding?R=y.padding:E?R=1:R=4;var I=r(y),T;if(R===4)T=l(I,M);else if(R===1)T=w(I,M,E);else if(R===3){if(T=new v(M),T.cmp(I.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");return E?h(T,I):b(T,I)};function l(y,M){var E=y.modulus.byteLength(),R=M.length,I=s("sha1").update(m.alloc(0)).digest(),T=I.length,P=2*T;if(R>E-P-2)throw Error("message too long");var j=m.alloc(E-R-P-2),L=E-T-1,U=i(T),Z=n(m.concat([I,j,m.alloc(1,1),M],L),f(U,L)),ne=n(U,f(Z,T));return new v(m.concat([m.alloc(1),ne,Z],E))}o(l,"Z");function w(y,M,E){var R=M.length,I=y.modulus.byteLength();if(R>I-11)throw Error("message too long");var T;return E?T=m.alloc(I-R-3,255):T=p(I-R-3),new v(m.concat([m.from([0,E?1:2]),T,m.alloc(1),M],I))}o(w,"S");function p(y){for(var M=m.allocUnsafe(y),E=0,R=i(y*2),I=0,T;E<y;)I===R.length&&(R=i(y*2),I=0),T=R[I++],T&&(M[E++]=T);return M}o(p,"C")}),pm=nt((t,e)=>{var r=Qc(),i=Kc(),s=Xc(),f=il(),n=$c(),v=ca(),b=Wc(),h=Er().Buffer;e.exports=function(p,y,M){var E;p.padding?E=p.padding:M?E=1:E=4;var R=r(p),I=R.modulus.byteLength();if(y.length>I||new f(y).cmp(R.modulus)>=0)throw Error("decryption error");var T;M?T=b(new f(y),R):T=n(y,R);var P=h.alloc(I-T.length);if(T=h.concat([P,T],I),E===4)return m(R,T);if(E===1)return l(R,T,M);if(E===3)return T;throw Error("unknown padding")};function m(p,y){var M=p.modulus.byteLength(),E=v("sha1").update(h.alloc(0)).digest(),R=E.length;if(y[0]!==0)throw Error("decryption error");var I=y.slice(1,R+1),T=y.slice(R+1),P=s(I,i(T,R)),j=s(T,i(P,M-R-1));if(w(E,j.slice(0,R)))throw Error("decryption error");for(var L=R;j[L]===0;)L++;if(j[L++]!==1)throw Error("decryption error");return j.slice(L)}o(m,"V");function l(p,y,M){for(var E=y.slice(0,2),R=2,I=0;y[R++]!==0;)if(R>=y.length){I++;break}var T=y.slice(2,R-1);if((E.toString("hex")!=="0002"&&!M||E.toString("hex")!=="0001"&&M)&&I++,T.length<8&&I++,I)throw Error("decryption error");return y.slice(R)}o(l,"Z");function w(p,y){p=h.from(p),y=h.from(y);var M=0,E=p.length;p.length!==y.length&&(M++,E=Math.min(p.length,y.length));for(var R=-1;++R<E;)M+=p[R]^y[R];return M}o(w,"S")}),nl=nt(t=>{t.publicEncrypt=hm(),t.privateDecrypt=pm(),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}}),mm=nt(t=>{var e=(qt(),bt(Jt));typeof e.publicEncrypt!="function"&&(e=nl()),t.publicEncrypt=e.publicEncrypt,t.privateDecrypt=e.privateDecrypt,typeof e.privateEncrypt!="function"?t.privateEncrypt=nl().privateEncrypt:t.privateEncrypt=e.privateEncrypt,typeof e.publicDecrypt!="function"?t.publicDecrypt=nl().publicDecrypt:t.publicDecrypt=e.publicDecrypt}),gm=nt(t=>{var e=Er(),r=ua(),i=e.Buffer,s=e.kMaxLength,f=globalThis.crypto||globalThis.msCrypto,n=Math.pow(2,32)-1;function v(w,p){if(typeof w!="number"||w!==w)throw TypeError("offset must be a number");if(w>n||w<0)throw TypeError("offset must be a uint32");if(w>s||w>p)throw RangeError("offset out of range")}o(v,"z");function b(w,p,y){if(typeof w!="number"||w!==w)throw TypeError("size must be a number");if(w>n||w<0)throw TypeError("size must be a uint32");if(w+p>y||w>s)throw RangeError("buffer too small")}o(b,"v"),f&&f.getRandomValues,t.randomFill=h,t.randomFillSync=l;function h(w,p,y,M){if(!i.isBuffer(w)&&!(w instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof p=="function")M=p,p=0,y=w.length;else if(typeof y=="function")M=y,y=w.length-p;else if(typeof M!="function")throw TypeError('"cb" argument must be a function');return v(p,w.length),b(y,p,w.length),m(w,p,y,M)}o(h,"w");function m(w,p,y,M){if(M){r(y,function(R,I){if(R)return M(R);I.copy(w,p),M(null,w)});return}var E=r(y);return E.copy(w,p),w}o(m,"V");function l(w,p,y){if(typeof p>"u"&&(p=0),!i.isBuffer(w)&&!(w instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');return v(p,w.length),y===void 0&&(y=w.length-p),b(y,p,w.length),m(w,p,y)}o(l,"Z")}),vm=nt((t,e)=>{var r=(qt(),bt(Jt));typeof r.randomFill=="function"&&typeof r.randomFillSync=="function"?(t.randomFill=r.randomFill,t.randomFillSync=r.randomFillSync):e.exports=gm()}),bm=nt(t=>{t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=ua(),t.createHash=t.Hash=ca(),t.createHmac=t.Hmac=Tc();var e=_0(),r=Object.keys(e),i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);t.getHashes=function(){return i};var s=jc();t.pbkdf2=s.pbkdf2,t.pbkdf2Sync=s.pbkdf2Sync;var f=S0();t.Cipher=f.Cipher,t.createCipher=f.createCipher,t.Cipheriv=f.Cipheriv,t.createCipheriv=f.createCipheriv,t.Decipher=f.Decipher,t.createDecipher=f.createDecipher,t.Decipheriv=f.Decipheriv,t.createDecipheriv=f.createDecipheriv,t.getCiphers=f.getCiphers,t.listCiphers=f.listCiphers;var n=E0();t.DiffieHellmanGroup=n.DiffieHellmanGroup,t.createDiffieHellmanGroup=n.createDiffieHellmanGroup,t.getDiffieHellman=n.getDiffieHellman,t.createDiffieHellman=n.createDiffieHellman,t.DiffieHellman=n.DiffieHellman;var v=A0();t.createSign=v.createSign,t.Sign=v.Sign,t.createVerify=v.createVerify,t.Verify=v.Verify,t.createECDH=X0();var b=mm();t.publicEncrypt=b.publicEncrypt,t.privateEncrypt=b.privateEncrypt,t.publicDecrypt=b.publicDecrypt,t.privateDecrypt=b.privateDecrypt;var h=vm();t.randomFill=h.randomFill,t.randomFillSync=h.randomFillSync,t.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
|
|
38
|
-
we accept pull requests
|
|
39
|
-
https://github.com/browserify/crypto-browserify`)},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),Rt=X7(bm(),1),jy=Rt.prng,Ly=Rt.pseudoRandomBytes,Dy=Rt.rng,By=Rt.randomBytes,zy=Rt.Hash,Fy=Rt.createHash,Uy=Rt.Hmac,Hy=Rt.createHmac,Vy=Rt.getHashes,Zy=Rt.pbkdf2,Gy=Rt.pbkdf2Sync,Yy=Rt.Cipher,Qy=Rt.createCipher,Ky=Rt.Cipheriv,Xy=Rt.createCipheriv,Wy=Rt.Decipher,$y=Rt.createDecipher,Jy=Rt.Decipheriv,qy=Rt.createDecipheriv,e2=Rt.getCiphers,t2=Rt.listCiphers,r2=Rt.DiffieHellmanGroup,i2=Rt.createDiffieHellmanGroup,n2=Rt.getDiffieHellman,s2=Rt.createDiffieHellman,a2=Rt.DiffieHellman,o2=Rt.createSign,l2=Rt.Sign,u2=Rt.createVerify,c2=Rt.Verify,f2=Rt.createECDH,d2=Rt.publicEncrypt,h2=Rt.privateEncrypt,p2=Rt.publicDecrypt,m2=Rt.privateDecrypt,g2=Rt.randomFill,v2=Rt.randomFillSync,b2=Rt.createCredentials,y2=Rt.constants,w2=["p192","p224","p256","p384","p521","curve25519","ed25519","secp256k1","secp224r1","prime256v1","prime192v1","ed25519","secp384r1","secp521r1"],x2=crypto,_2=crypto}),Uu=ye((t,e)=>{e.exports=(qt(),bt(Jt)).randomBytes}),Hu=ye((t,e)=>{e.exports=(qt(),bt(Jt)).createHash}),q7=ye((t,e)=>{e.exports=(qt(),bt(Jt)).createHmac}),e_=ye((t,e)=>{e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}}),lr=ye((t,e)=>{/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var r=(sr(),bt(er)),i=r.Buffer;function s(n,v){for(var b in n)v[b]=n[b]}o(s,"eZ"),i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=f);function f(n,v,b){return i(n,v,b)}o(f,"w9"),f.prototype=Object.create(i.prototype),s(i,f),f.from=function(n,v,b){if(typeof n=="number")throw TypeError("Argument must not be a number");return i(n,v,b)},f.alloc=function(n,v,b){if(typeof n!="number")throw TypeError("Argument must be a number");var h=i(n);return v!==void 0?typeof b=="string"?h.fill(v,b):h.fill(v):h.fill(0),h},f.allocUnsafe=function(n){if(typeof n!="number")throw TypeError("Argument must be a number");return i(n)},f.allocUnsafeSlow=function(n){if(typeof n!="number")throw TypeError("Argument must be a number");return r.SlowBuffer(n)}}),M2=ye((t,e)=>{var r=Math.pow(2,30)-1;e.exports=function(i,s){if(typeof i!="number")throw TypeError("Iterations not a number");if(i<0)throw TypeError("Bad iterations");if(typeof s!="number")throw TypeError("Key length not a number");if(s<0||s>r||s!==s)throw TypeError("Bad key length")}}),S2=ye((t,e)=>{var r;globalThis.process&&globalThis.process.browser?r="utf-8":globalThis.process&&globalThis.process.version?(i=parseInt(process.version.split(".")[0].slice(1),10),r=i>=6?"utf-8":"binary"):r="utf-8";var i;e.exports=r}),t_=ye((t,e)=>{var r=4,i=new Buffer(r);i.fill(0);var s=8,f=16;function n(v){if(v.length%r!==0){var b=v.length+(r-v.length%r);v=Buffer.concat([v,i],b)}for(var h=Array(v.length>>>2),m=0,l=0;m<v.length;m+=r,l++)h[l]=v.readInt32LE(m);return h}o(n,"Nr"),e.exports=function(v,b){var h=b(n(v),v.length*s);v=new Buffer(f);for(var m=0;m<h.length;m++)v.writeInt32LE(h[m],m<<2,!0);return v}}),r_=ye((t,e)=>{var r=t_();function i(l,w){l[w>>5]|=128<<w%32,l[(w+64>>>9<<4)+14]=w;for(var p=1732584193,y=-271733879,M=-1732584194,E=271733878,R=0;R<l.length;R+=16){var I=p,T=y,P=M,j=E;p=f(p,y,M,E,l[R+0],7,-680876936),E=f(E,p,y,M,l[R+1],12,-389564586),M=f(M,E,p,y,l[R+2],17,606105819),y=f(y,M,E,p,l[R+3],22,-1044525330),p=f(p,y,M,E,l[R+4],7,-176418897),E=f(E,p,y,M,l[R+5],12,1200080426),M=f(M,E,p,y,l[R+6],17,-1473231341),y=f(y,M,E,p,l[R+7],22,-45705983),p=f(p,y,M,E,l[R+8],7,1770035416),E=f(E,p,y,M,l[R+9],12,-1958414417),M=f(M,E,p,y,l[R+10],17,-42063),y=f(y,M,E,p,l[R+11],22,-1990404162),p=f(p,y,M,E,l[R+12],7,1804603682),E=f(E,p,y,M,l[R+13],12,-40341101),M=f(M,E,p,y,l[R+14],17,-1502002290),y=f(y,M,E,p,l[R+15],22,1236535329),p=n(p,y,M,E,l[R+1],5,-165796510),E=n(E,p,y,M,l[R+6],9,-1069501632),M=n(M,E,p,y,l[R+11],14,643717713),y=n(y,M,E,p,l[R+0],20,-373897302),p=n(p,y,M,E,l[R+5],5,-701558691),E=n(E,p,y,M,l[R+10],9,38016083),M=n(M,E,p,y,l[R+15],14,-660478335),y=n(y,M,E,p,l[R+4],20,-405537848),p=n(p,y,M,E,l[R+9],5,568446438),E=n(E,p,y,M,l[R+14],9,-1019803690),M=n(M,E,p,y,l[R+3],14,-187363961),y=n(y,M,E,p,l[R+8],20,1163531501),p=n(p,y,M,E,l[R+13],5,-1444681467),E=n(E,p,y,M,l[R+2],9,-51403784),M=n(M,E,p,y,l[R+7],14,1735328473),y=n(y,M,E,p,l[R+12],20,-1926607734),p=v(p,y,M,E,l[R+5],4,-378558),E=v(E,p,y,M,l[R+8],11,-2022574463),M=v(M,E,p,y,l[R+11],16,1839030562),y=v(y,M,E,p,l[R+14],23,-35309556),p=v(p,y,M,E,l[R+1],4,-1530992060),E=v(E,p,y,M,l[R+4],11,1272893353),M=v(M,E,p,y,l[R+7],16,-155497632),y=v(y,M,E,p,l[R+10],23,-1094730640),p=v(p,y,M,E,l[R+13],4,681279174),E=v(E,p,y,M,l[R+0],11,-358537222),M=v(M,E,p,y,l[R+3],16,-722521979),y=v(y,M,E,p,l[R+6],23,76029189),p=v(p,y,M,E,l[R+9],4,-640364487),E=v(E,p,y,M,l[R+12],11,-421815835),M=v(M,E,p,y,l[R+15],16,530742520),y=v(y,M,E,p,l[R+2],23,-995338651),p=b(p,y,M,E,l[R+0],6,-198630844),E=b(E,p,y,M,l[R+7],10,1126891415),M=b(M,E,p,y,l[R+14],15,-1416354905),y=b(y,M,E,p,l[R+5],21,-57434055),p=b(p,y,M,E,l[R+12],6,1700485571),E=b(E,p,y,M,l[R+3],10,-1894986606),M=b(M,E,p,y,l[R+10],15,-1051523),y=b(y,M,E,p,l[R+1],21,-2054922799),p=b(p,y,M,E,l[R+8],6,1873313359),E=b(E,p,y,M,l[R+15],10,-30611744),M=b(M,E,p,y,l[R+6],15,-1560198380),y=b(y,M,E,p,l[R+13],21,1309151649),p=b(p,y,M,E,l[R+4],6,-145523070),E=b(E,p,y,M,l[R+11],10,-1120210379),M=b(M,E,p,y,l[R+2],15,718787259),y=b(y,M,E,p,l[R+9],21,-343485551),p=h(p,I),y=h(y,T),M=h(M,P),E=h(E,j)}return[p,y,M,E]}o(i,"Dr");function s(l,w,p,y,M,E){return h(m(h(h(w,l),h(y,E)),M),p)}o(s,"QP");function f(l,w,p,y,M,E,R){return s(w&p|~w&y,l,w,M,E,R)}o(f,"_4");function n(l,w,p,y,M,E,R){return s(w&y|p&~y,l,w,M,E,R)}o(n,"P4");function v(l,w,p,y,M,E,R){return s(w^p^y,l,w,M,E,R)}o(v,"Y4");function b(l,w,p,y,M,E,R){return s(p^(w|~y),l,w,M,E,R)}o(b,"O4");function h(l,w){var p=(l&65535)+(w&65535),y=(l>>16)+(w>>16)+(p>>16);return y<<16|p&65535}o(h,"V7");function m(l,w){return l<<w|l>>>32-w}o(m,"Ir"),e.exports=function(l){return r(l,i)}}),i_=ye((t,e)=>{typeof Object.create=="function"?e.exports=function(r,i){i&&(r.super_=i,r.prototype=Object.create(i.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(r,i){if(i){r.super_=i;var s=o(function(){},"_");s.prototype=i.prototype,r.prototype=new s,r.prototype.constructor=r}}}),dr=ye((t,e)=>{try{if(r=(xy(),bt(Gh)),typeof r.inherits!="function")throw"";e.exports=r.inherits}catch{e.exports=i_()}var r}),n_=ye((t,e)=>{var r=Fu().Transform,i=dr();function s(f){r.call(this),this._block=new Buffer(f),this._blockSize=f,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}o(s,"M7"),i(s,r),s.prototype._transform=function(f,n,v){var b=null;try{n!=="buffer"&&(f=new Buffer(f,n)),this.update(f)}catch(h){b=h}v(b)},s.prototype._flush=function(f){var n=null;try{this.push(this._digest())}catch(v){n=v}f(n)},s.prototype.update=function(f,n){if(!Buffer.isBuffer(f)&&typeof f!="string")throw TypeError("Data must be a string or a buffer");if(this._finalized)throw Error("Digest already called");Buffer.isBuffer(f)||(f=new Buffer(f,n||"binary"));for(var v=this._block,b=0;this._blockOffset+f.length-b>=this._blockSize;){for(var h=this._blockOffset;h<this._blockSize;)v[h++]=f[b++];this._update(),this._blockOffset=0}for(;b<f.length;)v[this._blockOffset++]=f[b++];for(var m=0,l=f.length*8;l>0;++m)this._length[m]+=l,l=this._length[m]/4294967296|0,l>0&&(this._length[m]-=4294967296*l);return this},s.prototype._update=function(f){throw Error("_update is not implemented")},s.prototype.digest=function(f){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var n=this._digest();return f!==void 0&&(n=n.toString(f)),n},s.prototype._digest=function(){throw Error("_digest is not implemented")},e.exports=s}),s_=ye((t,e)=>{var r=dr(),i=n_();function s(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}o(s,"tP"),r(s,i),s.prototype._update=function(){for(var l=Array(16),w=0;w<16;++w)l[w]=this._block.readInt32LE(w*4);var p=this._a,y=this._b,M=this._c,E=this._d,R=this._e;p=n(p,y,M,E,R,l[0],0,11),M=f(M,10),R=n(R,p,y,M,E,l[1],0,14),y=f(y,10),E=n(E,R,p,y,M,l[2],0,15),p=f(p,10),M=n(M,E,R,p,y,l[3],0,12),R=f(R,10),y=n(y,M,E,R,p,l[4],0,5),E=f(E,10),p=n(p,y,M,E,R,l[5],0,8),M=f(M,10),R=n(R,p,y,M,E,l[6],0,7),y=f(y,10),E=n(E,R,p,y,M,l[7],0,9),p=f(p,10),M=n(M,E,R,p,y,l[8],0,11),R=f(R,10),y=n(y,M,E,R,p,l[9],0,13),E=f(E,10),p=n(p,y,M,E,R,l[10],0,14),M=f(M,10),R=n(R,p,y,M,E,l[11],0,15),y=f(y,10),E=n(E,R,p,y,M,l[12],0,6),p=f(p,10),M=n(M,E,R,p,y,l[13],0,7),R=f(R,10),y=n(y,M,E,R,p,l[14],0,9),E=f(E,10),p=n(p,y,M,E,R,l[15],0,8),M=f(M,10),R=v(R,p,y,M,E,l[7],1518500249,7),y=f(y,10),E=v(E,R,p,y,M,l[4],1518500249,6),p=f(p,10),M=v(M,E,R,p,y,l[13],1518500249,8),R=f(R,10),y=v(y,M,E,R,p,l[1],1518500249,13),E=f(E,10),p=v(p,y,M,E,R,l[10],1518500249,11),M=f(M,10),R=v(R,p,y,M,E,l[6],1518500249,9),y=f(y,10),E=v(E,R,p,y,M,l[15],1518500249,7),p=f(p,10),M=v(M,E,R,p,y,l[3],1518500249,15),R=f(R,10),y=v(y,M,E,R,p,l[12],1518500249,7),E=f(E,10),p=v(p,y,M,E,R,l[0],1518500249,12),M=f(M,10),R=v(R,p,y,M,E,l[9],1518500249,15),y=f(y,10),E=v(E,R,p,y,M,l[5],1518500249,9),p=f(p,10),M=v(M,E,R,p,y,l[2],1518500249,11),R=f(R,10),y=v(y,M,E,R,p,l[14],1518500249,7),E=f(E,10),p=v(p,y,M,E,R,l[11],1518500249,13),M=f(M,10),R=v(R,p,y,M,E,l[8],1518500249,12),y=f(y,10),E=b(E,R,p,y,M,l[3],1859775393,11),p=f(p,10),M=b(M,E,R,p,y,l[10],1859775393,13),R=f(R,10),y=b(y,M,E,R,p,l[14],1859775393,6),E=f(E,10),p=b(p,y,M,E,R,l[4],1859775393,7),M=f(M,10),R=b(R,p,y,M,E,l[9],1859775393,14),y=f(y,10),E=b(E,R,p,y,M,l[15],1859775393,9),p=f(p,10),M=b(M,E,R,p,y,l[8],1859775393,13),R=f(R,10),y=b(y,M,E,R,p,l[1],1859775393,15),E=f(E,10),p=b(p,y,M,E,R,l[2],1859775393,14),M=f(M,10),R=b(R,p,y,M,E,l[7],1859775393,8),y=f(y,10),E=b(E,R,p,y,M,l[0],1859775393,13),p=f(p,10),M=b(M,E,R,p,y,l[6],1859775393,6),R=f(R,10),y=b(y,M,E,R,p,l[13],1859775393,5),E=f(E,10),p=b(p,y,M,E,R,l[11],1859775393,12),M=f(M,10),R=b(R,p,y,M,E,l[5],1859775393,7),y=f(y,10),E=b(E,R,p,y,M,l[12],1859775393,5),p=f(p,10),M=h(M,E,R,p,y,l[1],2400959708,11),R=f(R,10),y=h(y,M,E,R,p,l[9],2400959708,12),E=f(E,10),p=h(p,y,M,E,R,l[11],2400959708,14),M=f(M,10),R=h(R,p,y,M,E,l[10],2400959708,15),y=f(y,10),E=h(E,R,p,y,M,l[0],2400959708,14),p=f(p,10),M=h(M,E,R,p,y,l[8],2400959708,15),R=f(R,10),y=h(y,M,E,R,p,l[12],2400959708,9),E=f(E,10),p=h(p,y,M,E,R,l[4],2400959708,8),M=f(M,10),R=h(R,p,y,M,E,l[13],2400959708,9),y=f(y,10),E=h(E,R,p,y,M,l[3],2400959708,14),p=f(p,10),M=h(M,E,R,p,y,l[7],2400959708,5),R=f(R,10),y=h(y,M,E,R,p,l[15],2400959708,6),E=f(E,10),p=h(p,y,M,E,R,l[14],2400959708,8),M=f(M,10),R=h(R,p,y,M,E,l[5],2400959708,6),y=f(y,10),E=h(E,R,p,y,M,l[6],2400959708,5),p=f(p,10),M=h(M,E,R,p,y,l[2],2400959708,12),R=f(R,10),y=m(y,M,E,R,p,l[4],2840853838,9),E=f(E,10),p=m(p,y,M,E,R,l[0],2840853838,15),M=f(M,10),R=m(R,p,y,M,E,l[5],2840853838,5),y=f(y,10),E=m(E,R,p,y,M,l[9],2840853838,11),p=f(p,10),M=m(M,E,R,p,y,l[7],2840853838,6),R=f(R,10),y=m(y,M,E,R,p,l[12],2840853838,8),E=f(E,10),p=m(p,y,M,E,R,l[2],2840853838,13),M=f(M,10),R=m(R,p,y,M,E,l[10],2840853838,12),y=f(y,10),E=m(E,R,p,y,M,l[14],2840853838,5),p=f(p,10),M=m(M,E,R,p,y,l[1],2840853838,12),R=f(R,10),y=m(y,M,E,R,p,l[3],2840853838,13),E=f(E,10),p=m(p,y,M,E,R,l[8],2840853838,14),M=f(M,10),R=m(R,p,y,M,E,l[11],2840853838,11),y=f(y,10),E=m(E,R,p,y,M,l[6],2840853838,8),p=f(p,10),M=m(M,E,R,p,y,l[15],2840853838,5),R=f(R,10),y=m(y,M,E,R,p,l[13],2840853838,6),E=f(E,10);var I=this._a,T=this._b,P=this._c,j=this._d,L=this._e;I=m(I,T,P,j,L,l[5],1352829926,8),P=f(P,10),L=m(L,I,T,P,j,l[14],1352829926,9),T=f(T,10),j=m(j,L,I,T,P,l[7],1352829926,9),I=f(I,10),P=m(P,j,L,I,T,l[0],1352829926,11),L=f(L,10),T=m(T,P,j,L,I,l[9],1352829926,13),j=f(j,10),I=m(I,T,P,j,L,l[2],1352829926,15),P=f(P,10),L=m(L,I,T,P,j,l[11],1352829926,15),T=f(T,10),j=m(j,L,I,T,P,l[4],1352829926,5),I=f(I,10),P=m(P,j,L,I,T,l[13],1352829926,7),L=f(L,10),T=m(T,P,j,L,I,l[6],1352829926,7),j=f(j,10),I=m(I,T,P,j,L,l[15],1352829926,8),P=f(P,10),L=m(L,I,T,P,j,l[8],1352829926,11),T=f(T,10),j=m(j,L,I,T,P,l[1],1352829926,14),I=f(I,10),P=m(P,j,L,I,T,l[10],1352829926,14),L=f(L,10),T=m(T,P,j,L,I,l[3],1352829926,12),j=f(j,10),I=m(I,T,P,j,L,l[12],1352829926,6),P=f(P,10),L=h(L,I,T,P,j,l[6],1548603684,9),T=f(T,10),j=h(j,L,I,T,P,l[11],1548603684,13),I=f(I,10),P=h(P,j,L,I,T,l[3],1548603684,15),L=f(L,10),T=h(T,P,j,L,I,l[7],1548603684,7),j=f(j,10),I=h(I,T,P,j,L,l[0],1548603684,12),P=f(P,10),L=h(L,I,T,P,j,l[13],1548603684,8),T=f(T,10),j=h(j,L,I,T,P,l[5],1548603684,9),I=f(I,10),P=h(P,j,L,I,T,l[10],1548603684,11),L=f(L,10),T=h(T,P,j,L,I,l[14],1548603684,7),j=f(j,10),I=h(I,T,P,j,L,l[15],1548603684,7),P=f(P,10),L=h(L,I,T,P,j,l[8],1548603684,12),T=f(T,10),j=h(j,L,I,T,P,l[12],1548603684,7),I=f(I,10),P=h(P,j,L,I,T,l[4],1548603684,6),L=f(L,10),T=h(T,P,j,L,I,l[9],1548603684,15),j=f(j,10),I=h(I,T,P,j,L,l[1],1548603684,13),P=f(P,10),L=h(L,I,T,P,j,l[2],1548603684,11),T=f(T,10),j=b(j,L,I,T,P,l[15],1836072691,9),I=f(I,10),P=b(P,j,L,I,T,l[5],1836072691,7),L=f(L,10),T=b(T,P,j,L,I,l[1],1836072691,15),j=f(j,10),I=b(I,T,P,j,L,l[3],1836072691,11),P=f(P,10),L=b(L,I,T,P,j,l[7],1836072691,8),T=f(T,10),j=b(j,L,I,T,P,l[14],1836072691,6),I=f(I,10),P=b(P,j,L,I,T,l[6],1836072691,6),L=f(L,10),T=b(T,P,j,L,I,l[9],1836072691,14),j=f(j,10),I=b(I,T,P,j,L,l[11],1836072691,12),P=f(P,10),L=b(L,I,T,P,j,l[8],1836072691,13),T=f(T,10),j=b(j,L,I,T,P,l[12],1836072691,5),I=f(I,10),P=b(P,j,L,I,T,l[2],1836072691,14),L=f(L,10),T=b(T,P,j,L,I,l[10],1836072691,13),j=f(j,10),I=b(I,T,P,j,L,l[0],1836072691,13),P=f(P,10),L=b(L,I,T,P,j,l[4],1836072691,7),T=f(T,10),j=b(j,L,I,T,P,l[13],1836072691,5),I=f(I,10),P=v(P,j,L,I,T,l[8],2053994217,15),L=f(L,10),T=v(T,P,j,L,I,l[6],2053994217,5),j=f(j,10),I=v(I,T,P,j,L,l[4],2053994217,8),P=f(P,10),L=v(L,I,T,P,j,l[1],2053994217,11),T=f(T,10),j=v(j,L,I,T,P,l[3],2053994217,14),I=f(I,10),P=v(P,j,L,I,T,l[11],2053994217,14),L=f(L,10),T=v(T,P,j,L,I,l[15],2053994217,6),j=f(j,10),I=v(I,T,P,j,L,l[0],2053994217,14),P=f(P,10),L=v(L,I,T,P,j,l[5],2053994217,6),T=f(T,10),j=v(j,L,I,T,P,l[12],2053994217,9),I=f(I,10),P=v(P,j,L,I,T,l[2],2053994217,12),L=f(L,10),T=v(T,P,j,L,I,l[13],2053994217,9),j=f(j,10),I=v(I,T,P,j,L,l[9],2053994217,12),P=f(P,10),L=v(L,I,T,P,j,l[7],2053994217,5),T=f(T,10),j=v(j,L,I,T,P,l[10],2053994217,15),I=f(I,10),P=v(P,j,L,I,T,l[14],2053994217,8),L=f(L,10),T=n(T,P,j,L,I,l[12],0,8),j=f(j,10),I=n(I,T,P,j,L,l[15],0,5),P=f(P,10),L=n(L,I,T,P,j,l[10],0,12),T=f(T,10),j=n(j,L,I,T,P,l[4],0,9),I=f(I,10),P=n(P,j,L,I,T,l[1],0,12),L=f(L,10),T=n(T,P,j,L,I,l[5],0,5),j=f(j,10),I=n(I,T,P,j,L,l[8],0,14),P=f(P,10),L=n(L,I,T,P,j,l[7],0,6),T=f(T,10),j=n(j,L,I,T,P,l[6],0,8),I=f(I,10),P=n(P,j,L,I,T,l[2],0,13),L=f(L,10),T=n(T,P,j,L,I,l[13],0,6),j=f(j,10),I=n(I,T,P,j,L,l[14],0,5),P=f(P,10),L=n(L,I,T,P,j,l[0],0,15),T=f(T,10),j=n(j,L,I,T,P,l[3],0,13),I=f(I,10),P=n(P,j,L,I,T,l[9],0,11),L=f(L,10),T=n(T,P,j,L,I,l[11],0,11),j=f(j,10);var U=this._b+M+j|0;this._b=this._c+E+L|0,this._c=this._d+R+I|0,this._d=this._e+p+T|0,this._e=this._a+y+P|0,this._a=U},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var l=new Buffer(20);return l.writeInt32LE(this._a,0),l.writeInt32LE(this._b,4),l.writeInt32LE(this._c,8),l.writeInt32LE(this._d,12),l.writeInt32LE(this._e,16),l};function f(l,w){return l<<w|l>>>32-w}o(f,"z8");function n(l,w,p,y,M,E,R,I){return f(l+(w^p^y)+E+R|0,I)+M|0}o(n,"m6");function v(l,w,p,y,M,E,R,I){return f(l+(w&p|~w&y)+E+R|0,I)+M|0}o(v,"d6");function b(l,w,p,y,M,E,R,I){return f(l+((w|~p)^y)+E+R|0,I)+M|0}o(b,"l6");function h(l,w,p,y,M,E,R,I){return f(l+(w&y|p&~y)+E+R|0,I)+M|0}o(h,"B6");function m(l,w,p,y,M,E,R,I){return f(l+(w^(p|~y))+E+R|0,I)+M|0}o(m,"o6"),e.exports=s}),a_=ye((t,e)=>{var r={}.toString;e.exports=Array.isArray||function(i){return r.call(i)=="[object Array]"}}),Do=ye((t,e)=>{e.exports=TypeError}),E2=ye((t,e)=>{e.exports=Object}),o_=ye((t,e)=>{e.exports=Error}),l_=ye((t,e)=>{e.exports=EvalError}),u_=ye((t,e)=>{e.exports=RangeError}),c_=ye((t,e)=>{e.exports=ReferenceError}),A2=ye((t,e)=>{e.exports=SyntaxError}),f_=ye((t,e)=>{e.exports=URIError}),d_=ye((t,e)=>{e.exports=Math.abs}),h_=ye((t,e)=>{e.exports=Math.floor}),p_=ye((t,e)=>{e.exports=Math.max}),m_=ye((t,e)=>{e.exports=Math.min}),g_=ye((t,e)=>{e.exports=Math.pow}),v_=ye((t,e)=>{e.exports=Math.round}),b_=ye((t,e)=>{e.exports=Number.isNaN||function(r){return r!==r}}),y_=ye((t,e)=>{var r=b_();e.exports=function(i){return r(i)||i===0?i:i<0?-1:1}}),w_=ye((t,e)=>{e.exports=Object.getOwnPropertyDescriptor}),Bo=ye((t,e)=>{var r=w_();if(r)try{r([],"length")}catch{r=null}e.exports=r}),Vu=ye((t,e)=>{var r=Object.defineProperty||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}e.exports=r}),k2=ye((t,e)=>{e.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},i=Symbol("test"),s=Object(i);if(typeof i=="string"||Object.prototype.toString.call(i)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[object Symbol]")return!1;var f=42;r[i]=f;for(var n in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var v=Object.getOwnPropertySymbols(r);if(v.length!==1||v[0]!==i||!Object.prototype.propertyIsEnumerable.call(r,i))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var b=Object.getOwnPropertyDescriptor(r,i);if(b.value!==f||b.enumerable!==!0)return!1}return!0}}),x_=ye((t,e)=>{var r=typeof Symbol<"u"&&Symbol,i=k2();e.exports=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:i()}}),N2=ye((t,e)=>{e.exports=typeof Reflect<"u"&&Reflect.getPrototypeOf||null}),C2=ye((t,e)=>{var r=E2();e.exports=r.getPrototypeOf||null}),__=ye((t,e)=>{var r="Function.prototype.bind called on incompatible ",i=Object.prototype.toString,s=Math.max,f="[object Function]",n=o(function(h,m){for(var l=[],w=0;w<h.length;w+=1)l[w]=h[w];for(var p=0;p<m.length;p+=1)l[p+h.length]=m[p];return l},"$M"),v=o(function(h,m){for(var l=[],w=m,p=0;w<h.length;w+=1,p+=1)l[p]=h[w];return l},"dr"),b=o(function(h,m){for(var l="",w=0;w<h.length;w+=1)l+=h[w],w+1<h.length&&(l+=m);return l},"lr");e.exports=function(h){var m=this;if(typeof m!="function"||i.apply(m)!==f)throw TypeError(r+m);for(var l=v(arguments,1),w,p=o(function(){if(this instanceof w){var I=m.apply(this,n(l,arguments));return Object(I)===I?I:this}return m.apply(h,n(l,arguments))},"O"),y=s(0,m.length-l.length),M=[],E=0;E<y;E++)M[E]="$"+E;if(w=Function("binder","return function ("+b(M,",")+"){ return binder.apply(this,arguments); }")(p),m.prototype){var R=o(function(){},"w");R.prototype=m.prototype,w.prototype=new R,R.prototype=null}return w}}),zo=ye((t,e)=>{var r=__();e.exports=Function.prototype.bind||r}),Wh=ye((t,e)=>{e.exports=Function.prototype.call}),$h=ye((t,e)=>{e.exports=Function.prototype.apply}),M_=ye((t,e)=>{e.exports=typeof Reflect<"u"&&Reflect&&Reflect.apply}),R2=ye((t,e)=>{var r=zo(),i=$h(),s=Wh(),f=M_();e.exports=f||r.call(s,i)}),Jh=ye((t,e)=>{var r=zo(),i=Do(),s=Wh(),f=R2();e.exports=function(n){if(n.length<1||typeof n[0]!="function")throw new i("a function is required");return f(r,s,n)}}),S_=ye((t,e)=>{var r=Jh(),i=Bo(),s;try{s=[].__proto__===Array.prototype}catch(b){if(!b||typeof b!="object"||!("code"in b)||b.code!=="ERR_PROTO_ACCESS")throw b}var f=!!s&&i&&i(Object.prototype,"__proto__"),n=Object,v=n.getPrototypeOf;e.exports=f&&typeof f.get=="function"?r([f.get]):typeof v=="function"?function(b){return v(b==null?b:n(b))}:!1}),I2=ye((t,e)=>{var r=N2(),i=C2(),s=S_();e.exports=r?function(f){return r(f)}:i?function(f){if(!f||typeof f!="object"&&typeof f!="function")throw TypeError("getProto: not an object");return i(f)}:s?function(f){return s(f)}:null}),E_=ye((t,e)=>{var r=Function.prototype.call,i=Object.prototype.hasOwnProperty,s=zo();e.exports=s.call(r,i)}),O2=ye((t,e)=>{var r,i=E2(),s=o_(),f=l_(),n=u_(),v=c_(),b=A2(),h=Do(),m=f_(),l=d_(),w=h_(),p=p_(),y=m_(),M=g_(),E=v_(),R=y_(),I=Function,T=o(function(Ce){try{return I('"use strict"; return ('+Ce+").constructor;")()}catch{}},"$J"),P=Bo(),j=Vu(),L=o(function(){throw new h},"KJ"),U=P?(function(){try{return arguments.callee,L}catch{try{return P(arguments,"callee").get}catch{return L}}})():L,Z=x_()(),ne=I2(),F=C2(),Y=N2(),a=$h(),g=Wh(),u={},d=typeof Uint8Array>"u"||!ne?r:ne(Uint8Array),x={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":Z&&ne?ne([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":u,"%AsyncGenerator%":u,"%AsyncGeneratorFunction%":u,"%AsyncIteratorPrototype%":u,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":s,"%eval%":eval,"%EvalError%":f,"%Float16Array%":typeof Float16Array>"u"?r:Float16Array,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":I,"%GeneratorFunction%":u,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Z&&ne?ne(ne([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Z||!ne?r:ne(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":i,"%Object.getOwnPropertyDescriptor%":P,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":v,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Z||!ne?r:ne(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Z&&ne?ne(""[Symbol.iterator]()):r,"%Symbol%":Z?Symbol:r,"%SyntaxError%":b,"%ThrowTypeError%":U,"%TypedArray%":d,"%TypeError%":h,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":m,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet,"%Function.prototype.call%":g,"%Function.prototype.apply%":a,"%Object.defineProperty%":j,"%Object.getPrototypeOf%":F,"%Math.abs%":l,"%Math.floor%":w,"%Math.max%":p,"%Math.min%":y,"%Math.pow%":M,"%Math.round%":E,"%Math.sign%":R,"%Reflect.getPrototypeOf%":Y};if(ne)try{null.error}catch(Ce){A=ne(ne(Ce)),x["%Error.prototype%"]=A}var A,N=o(function Ce(fe){var ae;if(fe==="%AsyncFunction%")ae=T("async function () {}");else if(fe==="%GeneratorFunction%")ae=T("function* () {}");else if(fe==="%AsyncGeneratorFunction%")ae=T("async function* () {}");else if(fe==="%AsyncGenerator%"){var be=Ce("%AsyncGeneratorFunction%");be&&(ae=be.prototype)}else if(fe==="%AsyncIteratorPrototype%"){var H=Ce("%AsyncGenerator%");H&&ne&&(ae=ne(H.prototype))}return x[fe]=ae,ae},"q"),S={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},c=zo(),_=E_(),C=c.call(g,Array.prototype.concat),O=c.call(a,Array.prototype.splice),D=c.call(g,String.prototype.replace),B=c.call(g,String.prototype.slice),z=c.call(g,RegExp.prototype.exec),G=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,te=/\\(\\)?/g,$=o(function(Ce){var fe=B(Ce,0,1),ae=B(Ce,-1);if(fe==="%"&&ae!=="%")throw new b("invalid intrinsic syntax, expected closing `%`");if(ae==="%"&&fe!=="%")throw new b("invalid intrinsic syntax, expected opening `%`");var be=[];return D(Ce,G,function(H,ee,Q,X){be[be.length]=Q?D(X,te,"$1"):ee||H}),be},"EF"),q=o(function(Ce,fe){var ae=Ce,be;if(_(S,ae)&&(be=S[ae],ae="%"+be[0]+"%"),_(x,ae)){var H=x[ae];if(H===u&&(H=N(ae)),typeof H>"u"&&!fe)throw new h("intrinsic "+Ce+" exists, but is not available. Please file an issue!");return{alias:be,name:ae,value:H}}throw new b("intrinsic "+Ce+" does not exist!")},"NF");e.exports=function(Ce,fe){if(typeof Ce!="string"||Ce.length===0)throw new h("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof fe!="boolean")throw new h('"allowMissing" argument must be a boolean');if(z(/^%?[^%]*%?$/,Ce)===null)throw new b("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ae=$(Ce),be=ae.length>0?ae[0]:"",H=q("%"+be+"%",fe),ee=H.name,Q=H.value,X=!1,se=H.alias;se&&(be=se[0],O(ae,C([0,1],se)));for(var Ne=1,we=!0;Ne<ae.length;Ne+=1){var ue=ae[Ne],K=B(ue,0,1),W=B(ue,-1);if((K==='"'||K==="'"||K==="`"||W==='"'||W==="'"||W==="`")&&K!==W)throw new b("property names with quotes must have matching quotes");if((ue==="constructor"||!we)&&(X=!0),be+="."+ue,ee="%"+be+"%",_(x,ee))Q=x[ee];else if(Q!=null){if(!(ue in Q)){if(!fe)throw new h("base intrinsic for "+Ce+" exists, but the property is not available.");return}if(P&&Ne+1>=ae.length){var J=P(Q,ue);we=!!J,we&&"get"in J&&!("originalValue"in J.get)?Q=J.get:Q=Q[ue]}else we=_(Q,ue),Q=Q[ue];we&&!X&&(x[ee]=Q)}}return Q}}),T2=ye((t,e)=>{var r=O2(),i=Jh(),s=i([r("%String.prototype.indexOf%")]);e.exports=function(f,n){var v=r(f,!!n);return typeof v=="function"&&s(f,".prototype.")>-1?i([v]):v}}),A_=ye((t,e)=>{var r=Function.prototype.toString,i=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,s,f;if(typeof i=="function"&&typeof Object.defineProperty=="function")try{s=Object.defineProperty({},"length",{get:o(function(){throw f},"get")}),f={},i(function(){throw 42},null,s)}catch(P){P!==f&&(i=null)}else i=null;var n=/^\s*class\b/,v=o(function(P){try{var j=r.call(P);return n.test(j)}catch{return!1}},"WJ"),b=o(function(P){try{return v(P)?!1:(r.call(P),!0)}catch{return!1}},"OJ"),h=Object.prototype.toString,m="[object Object]",l="[object Function]",w="[object GeneratorFunction]",p="[object HTMLAllCollection]",y="[object HTML document.all class]",M="[object HTMLCollection]",E=typeof Symbol=="function"&&!!Symbol.toStringTag,R=!(0 in[,]),I=o(function(){return!1},"HJ");typeof document=="object"&&(T=document.all,h.call(T)===h.call(document.all)&&(I=o(function(P){if((R||!P)&&(typeof P>"u"||typeof P=="object"))try{var j=h.call(P);return(j===p||j===y||j===M||j===m)&&P("")==null}catch{}return!1},"HJ")));var T;e.exports=i?function(P){if(I(P))return!0;if(!P||typeof P!="function"&&typeof P!="object")return!1;try{i(P,null,s)}catch(j){if(j!==f)return!1}return!v(P)&&b(P)}:function(P){if(I(P))return!0;if(!P||typeof P!="function"&&typeof P!="object")return!1;if(E)return b(P);if(v(P))return!1;var j=h.call(P);return j!==l&&j!==w&&!/^\[object HTML/.test(j)?!1:b(P)}}),k_=ye((t,e)=>{var r=A_(),i=Object.prototype.toString,s=Object.prototype.hasOwnProperty,f=o(function(h,m,l){for(var w=0,p=h.length;w<p;w++)s.call(h,w)&&(l==null?m(h[w],w,h):m.call(l,h[w],w,h))},"mF"),n=o(function(h,m,l){for(var w=0,p=h.length;w<p;w++)l==null?m(h.charAt(w),w,h):m.call(l,h.charAt(w),w,h)},"dF"),v=o(function(h,m,l){for(var w in h)s.call(h,w)&&(l==null?m(h[w],w,h):m.call(l,h[w],w,h))},"lF");function b(h){return i.call(h)==="[object Array]"}o(b,"BF"),e.exports=function(h,m,l){if(!r(m))throw TypeError("iterator must be a function");var w;arguments.length>=3&&(w=l),b(h)?f(h,m,w):typeof h=="string"?n(h,m,w):v(h,m,w)}}),N_=ye((t,e)=>{e.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]}),C_=ye((t,e)=>{var r=N_(),i=globalThis;e.exports=function(){for(var s=[],f=0;f<r.length;f++)typeof i[r[f]]=="function"&&(s[s.length]=r[f]);return s}}),R_=ye((t,e)=>{var r=Vu(),i=A2(),s=Do(),f=Bo();e.exports=function(n,v,b){if(!n||typeof n!="object"&&typeof n!="function")throw new s("`obj` must be an object or a function`");if(typeof v!="string"&&typeof v!="symbol")throw new s("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new s("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new s("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new s("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new s("`loose`, if provided, must be a boolean");var h=arguments.length>3?arguments[3]:null,m=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,w=arguments.length>6?arguments[6]:!1,p=!!f&&f(n,v);if(r)r(n,v,{configurable:l===null&&p?p.configurable:!l,enumerable:h===null&&p?p.enumerable:!h,value:b,writable:m===null&&p?p.writable:!m});else if(w||!h&&!m&&!l)n[v]=b;else throw new i("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}}),I_=ye((t,e)=>{var r=Vu(),i=o(function(){return!!r},"UM");i.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},e.exports=i}),O_=ye((t,e)=>{var r=O2(),i=R_(),s=I_()(),f=Bo(),n=Do(),v=r("%Math.floor%");e.exports=function(b,h){if(typeof b!="function")throw new n("`fn` is not a function");if(typeof h!="number"||h<0||h>4294967295||v(h)!==h)throw new n("`length` must be a positive 32-bit integer");var m=arguments.length>2&&!!arguments[2],l=!0,w=!0;if("length"in b&&f){var p=f(b,"length");p&&!p.configurable&&(l=!1),p&&!p.writable&&(w=!1)}return(l||w||!m)&&(s?i(b,"length",h,!0,!0):i(b,"length",h)),b}}),T_=ye((t,e)=>{var r=zo(),i=$h(),s=R2();e.exports=function(){return s(r,i,arguments)}}),P_=ye((t,e)=>{var r=O_(),i=Vu(),s=Jh(),f=T_();e.exports=function(n){var v=s(arguments),b=n.length-(arguments.length-1);return r(v,1+(b>0?b:0),!0)},i?i(e.exports,"apply",{value:f}):e.exports.apply=f}),j_=ye((t,e)=>{var r=k2();e.exports=function(){return r()&&!!Symbol.toStringTag}}),L_=ye((t,e)=>{var r=k_(),i=C_(),s=P_(),f=T2(),n=Bo(),v=I2(),b=f("Object.prototype.toString"),h=j_()(),m=globalThis,l=i(),w=f("String.prototype.slice"),p=f("Array.prototype.indexOf",!0)||function(R,I){for(var T=0;T<R.length;T+=1)if(R[T]===I)return T;return-1},y={__proto__:null};h&&n&&v?r(l,function(R){var I=new m[R];if(Symbol.toStringTag in I&&v){var T=v(I),P=n(T,Symbol.toStringTag);if(!P&&T){var j=v(T);P=n(j,Symbol.toStringTag)}y["$"+R]=s(P.get)}}):r(l,function(R){var I=new m[R],T=I.slice||I.set;T&&(y["$"+R]=s(T))});var M=o(function(R){var I=!1;return r(y,function(T,P){if(!I)try{"$"+T(R)===P&&(I=w(P,1))}catch{}}),I},"_Q"),E=o(function(R){var I=!1;return r(y,function(T,P){if(!I)try{T(R),I=w(P,1)}catch{}}),I},"PQ");e.exports=function(R){if(!R||typeof R!="object")return!1;if(!h){var I=w(b(R),8,-1);return p(l,I)>-1?I:I!=="Object"?!1:E(R)}return n?M(R):null}}),D_=ye((t,e)=>{var r=L_();e.exports=function(i){return!!r(i)}}),B_=ye((t,e)=>{var r=Do(),i=T2(),s=i("TypedArray.prototype.buffer",!0),f=D_();e.exports=s||function(n){if(!f(n))throw new r("Not a Typed Array");return n.buffer}}),P2=ye((t,e)=>{var r=lr().Buffer,i=a_(),s=B_(),f=ArrayBuffer.isView||function(h){try{return s(h),!0}catch{return!1}},n=typeof Uint8Array<"u",v=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",b=v&&(r.prototype instanceof Uint8Array||r.TYPED_ARRAY_SUPPORT);e.exports=function(h,m){if(h instanceof r)return h;if(typeof h=="string")return r.from(h,m);if(v&&f(h)){if(h.byteLength===0)return r.alloc(0);if(b){var l=r.from(h.buffer,h.byteOffset,h.byteLength);if(l.byteLength===h.byteLength)return l}var w=h instanceof Uint8Array?h:new Uint8Array(h.buffer,h.byteOffset,h.byteLength),p=r.from(w);if(p.length===h.byteLength)return p}if(n&&h instanceof Uint8Array)return r.from(h);var y=i(h);if(y)for(var M=0;M<h.length;M+=1){var E=h[M];if(typeof E!="number"||E<0||E>255||~~E!==E)throw RangeError("Array items must be numbers in the range 0-255.")}if(y||r.isBuffer(h)&&h.constructor&&typeof h.constructor.isBuffer=="function"&&h.constructor.isBuffer(h))return r.from(h);throw TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}}),qs=ye((t,e)=>{var r=lr().Buffer,i=P2();function s(f,n){this._block=r.alloc(f),this._finalSize=n,this._blockSize=f,this._len=0}o(s,"zY"),s.prototype.update=function(f,n){f=i(f,n||"utf8");for(var v=this._block,b=this._blockSize,h=f.length,m=this._len,l=0;l<h;){for(var w=m%b,p=Math.min(h-l,b-w),y=0;y<p;y++)v[w+y]=f[l+y];m+=p,l+=p,m%b===0&&this._update(v)}return this._len+=h,this},s.prototype.digest=function(f){var n=this._len%this._blockSize;this._block[n]=128,this._block.fill(0,n+1),n>=this._finalSize&&(this._update(this._block),this._block.fill(0));var v=this._len*8;if(v<=4294967295)this._block.writeUInt32BE(v,this._blockSize-4);else{var b=(v&4294967295)>>>0,h=(v-b)/4294967296;this._block.writeUInt32BE(h,this._blockSize-8),this._block.writeUInt32BE(b,this._blockSize-4)}this._update(this._block);var m=this._hash();return f?m.toString(f):m},s.prototype._update=function(){throw Error("_update must be implemented by subclass")},e.exports=s}),z_=ye((t,e)=>{var r=dr(),i=qs(),s=lr().Buffer,f=[1518500249,1859775393,-1894007588,-899497514],n=Array(80);function v(){this.init(),this._w=n,i.call(this,64,56)}o(v,"f_"),r(v,i),v.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function b(l){return l<<5|l>>>27}o(b,"VQ");function h(l){return l<<30|l>>>2}o(h,"MQ");function m(l,w,p,y){return l===0?w&p|~w&y:l===2?w&p|w&y|p&y:w^p^y}o(m,"SQ"),v.prototype._update=function(l){for(var w=this._w,p=this._a|0,y=this._b|0,M=this._c|0,E=this._d|0,R=this._e|0,I=0;I<16;++I)w[I]=l.readInt32BE(I*4);for(;I<80;++I)w[I]=w[I-3]^w[I-8]^w[I-14]^w[I-16];for(var T=0;T<80;++T){var P=~~(T/20),j=b(p)+m(P,y,M,E)+R+w[T]+f[P]|0;R=E,E=M,M=h(y),y=p,p=j}this._a=p+this._a|0,this._b=y+this._b|0,this._c=M+this._c|0,this._d=E+this._d|0,this._e=R+this._e|0},v.prototype._hash=function(){var l=s.allocUnsafe(20);return l.writeInt32BE(this._a|0,0),l.writeInt32BE(this._b|0,4),l.writeInt32BE(this._c|0,8),l.writeInt32BE(this._d|0,12),l.writeInt32BE(this._e|0,16),l},e.exports=v}),F_=ye((t,e)=>{var r=dr(),i=qs(),s=lr().Buffer,f=[1518500249,1859775393,-1894007588,-899497514],n=Array(80);function v(){this.init(),this._w=n,i.call(this,64,56)}o(v,"v_"),r(v,i),v.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function b(w){return w<<1|w>>>31}o(b,"DQ");function h(w){return w<<5|w>>>27}o(h,"IQ");function m(w){return w<<30|w>>>2}o(m,"hQ");function l(w,p,y,M){return w===0?p&y|~p&M:w===2?p&y|p&M|y&M:p^y^M}o(l,"LQ"),v.prototype._update=function(w){for(var p=this._w,y=this._a|0,M=this._b|0,E=this._c|0,R=this._d|0,I=this._e|0,T=0;T<16;++T)p[T]=w.readInt32BE(T*4);for(;T<80;++T)p[T]=b(p[T-3]^p[T-8]^p[T-14]^p[T-16]);for(var P=0;P<80;++P){var j=~~(P/20),L=h(y)+l(j,M,E,R)+I+p[P]+f[j]|0;I=R,R=E,E=m(M),M=y,y=L}this._a=y+this._a|0,this._b=M+this._b|0,this._c=E+this._c|0,this._d=R+this._d|0,this._e=I+this._e|0},v.prototype._hash=function(){var w=s.allocUnsafe(20);return w.writeInt32BE(this._a|0,0),w.writeInt32BE(this._b|0,4),w.writeInt32BE(this._c|0,8),w.writeInt32BE(this._d|0,12),w.writeInt32BE(this._e|0,16),w},e.exports=v}),j2=ye((t,e)=>{var r=dr(),i=qs(),s=lr().Buffer,f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],n=Array(64);function v(){this.init(),this._w=n,i.call(this,64,56)}o(v,"T_"),r(v,i),v.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function b(y,M,E){return E^y&(M^E)}o(b,"pQ");function h(y,M,E){return y&M|E&(y|M)}o(h,"cQ");function m(y){return(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10)}o(m,"uQ");function l(y){return(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7)}o(l,"mQ");function w(y){return(y>>>7|y<<25)^(y>>>18|y<<14)^y>>>3}o(w,"dQ");function p(y){return(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10}o(p,"lQ"),v.prototype._update=function(y){for(var M=this._w,E=this._a|0,R=this._b|0,I=this._c|0,T=this._d|0,P=this._e|0,j=this._f|0,L=this._g|0,U=this._h|0,Z=0;Z<16;++Z)M[Z]=y.readInt32BE(Z*4);for(;Z<64;++Z)M[Z]=p(M[Z-2])+M[Z-7]+w(M[Z-15])+M[Z-16]|0;for(var ne=0;ne<64;++ne){var F=U+l(P)+b(P,j,L)+f[ne]+M[ne]|0,Y=m(E)+h(E,R,I)|0;U=L,L=j,j=P,P=T+F|0,T=I,I=R,R=E,E=F+Y|0}this._a=E+this._a|0,this._b=R+this._b|0,this._c=I+this._c|0,this._d=T+this._d|0,this._e=P+this._e|0,this._f=j+this._f|0,this._g=L+this._g|0,this._h=U+this._h|0},v.prototype._hash=function(){var y=s.allocUnsafe(32);return y.writeInt32BE(this._a,0),y.writeInt32BE(this._b,4),y.writeInt32BE(this._c,8),y.writeInt32BE(this._d,12),y.writeInt32BE(this._e,16),y.writeInt32BE(this._f,20),y.writeInt32BE(this._g,24),y.writeInt32BE(this._h,28),y},e.exports=v}),U_=ye((t,e)=>{var r=dr(),i=j2(),s=qs(),f=lr().Buffer,n=Array(64);function v(){this.init(),this._w=n,s.call(this,64,56)}o(v,"fY"),r(v,i),v.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},v.prototype._hash=function(){var b=f.allocUnsafe(28);return b.writeInt32BE(this._a,0),b.writeInt32BE(this._b,4),b.writeInt32BE(this._c,8),b.writeInt32BE(this._d,12),b.writeInt32BE(this._e,16),b.writeInt32BE(this._f,20),b.writeInt32BE(this._g,24),b},e.exports=v}),L2=ye((t,e)=>{var r=dr(),i=qs(),s=lr().Buffer,f=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],n=Array(160);function v(){this.init(),this._w=n,i.call(this,128,112)}o(v,"X_"),r(v,i),v.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function b(R,I,T){return T^R&(I^T)}o(b,"IS");function h(R,I,T){return R&I|T&(R|I)}o(h,"hS");function m(R,I){return(R>>>28|I<<4)^(I>>>2|R<<30)^(I>>>7|R<<25)}o(m,"LS");function l(R,I){return(R>>>14|I<<18)^(R>>>18|I<<14)^(I>>>9|R<<23)}o(l,"bS");function w(R,I){return(R>>>1|I<<31)^(R>>>8|I<<24)^R>>>7}o(w,"tQ");function p(R,I){return(R>>>1|I<<31)^(R>>>8|I<<24)^(R>>>7|I<<25)}o(p,"aQ");function y(R,I){return(R>>>19|I<<13)^(I>>>29|R<<3)^R>>>6}o(y,"eQ");function M(R,I){return(R>>>19|I<<13)^(I>>>29|R<<3)^(R>>>6|I<<26)}o(M,"sQ");function E(R,I){return R>>>0<I>>>0?1:0}o(E,"cq"),v.prototype._update=function(R){for(var I=this._w,T=this._ah|0,P=this._bh|0,j=this._ch|0,L=this._dh|0,U=this._eh|0,Z=this._fh|0,ne=this._gh|0,F=this._hh|0,Y=this._al|0,a=this._bl|0,g=this._cl|0,u=this._dl|0,d=this._el|0,x=this._fl|0,A=this._gl|0,N=this._hl|0,S=0;S<32;S+=2)I[S]=R.readInt32BE(S*4),I[S+1]=R.readInt32BE(S*4+4);for(;S<160;S+=2){var c=I[S-30],_=I[S-30+1],C=w(c,_),O=p(_,c);c=I[S-4],_=I[S-4+1];var D=y(c,_),B=M(_,c),z=I[S-14],G=I[S-14+1],te=I[S-32],$=I[S-32+1],q=O+G|0,Ce=C+z+E(q,O)|0;q=q+B|0,Ce=Ce+D+E(q,B)|0,q=q+$|0,Ce=Ce+te+E(q,$)|0,I[S]=Ce,I[S+1]=q}for(var fe=0;fe<160;fe+=2){Ce=I[fe],q=I[fe+1];var ae=h(T,P,j),be=h(Y,a,g),H=m(T,Y),ee=m(Y,T),Q=l(U,d),X=l(d,U),se=f[fe],Ne=f[fe+1],we=b(U,Z,ne),ue=b(d,x,A),K=N+X|0,W=F+Q+E(K,N)|0;K=K+ue|0,W=W+we+E(K,ue)|0,K=K+Ne|0,W=W+se+E(K,Ne)|0,K=K+q|0,W=W+Ce+E(K,q)|0;var J=ee+be|0,pe=H+ae+E(J,ee)|0;F=ne,N=A,ne=Z,A=x,Z=U,x=d,d=u+K|0,U=L+W+E(d,u)|0,L=j,u=g,j=P,g=a,P=T,a=Y,Y=K+J|0,T=W+pe+E(Y,K)|0}this._al=this._al+Y|0,this._bl=this._bl+a|0,this._cl=this._cl+g|0,this._dl=this._dl+u|0,this._el=this._el+d|0,this._fl=this._fl+x|0,this._gl=this._gl+A|0,this._hl=this._hl+N|0,this._ah=this._ah+T+E(this._al,Y)|0,this._bh=this._bh+P+E(this._bl,a)|0,this._ch=this._ch+j+E(this._cl,g)|0,this._dh=this._dh+L+E(this._dl,u)|0,this._eh=this._eh+U+E(this._el,d)|0,this._fh=this._fh+Z+E(this._fl,x)|0,this._gh=this._gh+ne+E(this._gl,A)|0,this._hh=this._hh+F+E(this._hl,N)|0},v.prototype._hash=function(){var R=s.allocUnsafe(64);function I(T,P,j){R.writeInt32BE(T,j),R.writeInt32BE(P,j+4)}return o(I,"$"),I(this._ah,this._al,0),I(this._bh,this._bl,8),I(this._ch,this._cl,16),I(this._dh,this._dl,24),I(this._eh,this._el,32),I(this._fh,this._fl,40),I(this._gh,this._gl,48),I(this._hh,this._hl,56),R},e.exports=v}),H_=ye((t,e)=>{var r=dr(),i=L2(),s=qs(),f=lr().Buffer,n=Array(160);function v(){this.init(),this._w=n,s.call(this,128,112)}o(v,"vY"),r(v,i),v.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},v.prototype._hash=function(){var b=f.allocUnsafe(48);function h(m,l,w){b.writeInt32BE(m,w),b.writeInt32BE(l,w+4)}return o(h,"$"),h(this._ah,this._al,0),h(this._bh,this._bl,8),h(this._ch,this._cl,16),h(this._dh,this._dl,24),h(this._eh,this._el,32),h(this._fh,this._fl,40),b},e.exports=v}),V_=ye((t,e)=>{e.exports=function(r){var i=r.toLowerCase(),s=e.exports[i];if(!s)throw Error(i+" is not supported (we accept pull requests)");return new s},e.exports.sha=z_(),e.exports.sha1=F_(),e.exports.sha224=U_(),e.exports.sha256=j2(),e.exports.sha384=H_(),e.exports.sha512=L2()}),D2=ye((t,e)=>{var r=lr().Buffer,i=P2(),s=typeof Uint8Array<"u",f=s&&typeof ArrayBuffer<"u",n=f&&ArrayBuffer.isView;e.exports=function(v,b,h){if(typeof v=="string"||r.isBuffer(v)||s&&v instanceof Uint8Array||n&&n(v))return i(v,b);throw TypeError(h+" must be a string, a Buffer, a Uint8Array, or a DataView")}}),B2=ye((t,e)=>{var r=r_(),i=s_(),s=V_(),f=lr().Buffer,n=M2(),v=S2(),b=D2(),h=f.alloc(128),m={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},l={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function w(E){return new i().update(E).digest()}o(w,"Ti");function p(E){function R(I){return s(E).update(I).digest()}return o(R,"$"),E==="rmd160"||E==="ripemd160"?w:E==="md5"?r:R}o(p,"Xi");function y(E,R,I){var T=p(E),P=E==="sha512"||E==="sha384"?128:64;R.length>P?R=T(R):R.length<P&&(R=f.concat([R,h],P));for(var j=f.allocUnsafe(P+m[E]),L=f.allocUnsafe(P+m[E]),U=0;U<P;U++)j[U]=R[U]^54,L[U]=R[U]^92;var Z=f.allocUnsafe(P+I+4);j.copy(Z,0,0,P),this.ipad1=Z,this.ipad2=j,this.opad=L,this.alg=E,this.blocksize=P,this.hash=T,this.size=m[E]}o(y,"oS"),y.prototype.run=function(E,R){E.copy(R,this.blocksize);var I=this.hash(R);return I.copy(this.opad,this.blocksize),this.hash(this.opad)};function M(E,R,I,T,P){n(I,T),E=b(E,v,"Password"),R=b(R,v,"Salt");var j=(P||"sha1").toLowerCase(),L=l[j]||j,U=m[L];if(typeof U!="number"||!U)throw TypeError("Digest algorithm not supported: "+P);var Z=new y(L,E,R.length),ne=f.allocUnsafe(T),F=f.allocUnsafe(R.length+4);R.copy(F,0,0,R.length);for(var Y=0,a=U,g=Math.ceil(T/a),u=1;u<=g;u++){F.writeUInt32BE(u,R.length);for(var d=Z.run(F,Z.ipad1),x=d,A=1;A<I;A++){x=Z.run(x,Z.ipad2);for(var N=0;N<a;N++)d[N]^=x[N]}d.copy(ne,Y),Y+=a}return ne}o(M,"Ai"),e.exports=M}),Z_=ye((t,e)=>{var r=lr().Buffer,i=M2(),s=S2(),f=B2(),n=D2(),v,b=globalThis.crypto&&globalThis.crypto.subtle,h={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},m=[],l;function w(){return l||(globalThis.process&&globalThis.process.nextTick?l=globalThis.process.nextTick:globalThis.queueMicrotask?l=globalThis.queueMicrotask:globalThis.setImmediate?l=globalThis.setImmediate:l=globalThis.setTimeout,l)}o(w,"MJ");function p(E,R,I,T,P){return b.importKey("raw",E,{name:"PBKDF2"},!1,["deriveBits"]).then(function(j){return b.deriveBits({name:"PBKDF2",salt:R,iterations:I,hash:{name:P}},j,T<<3)}).then(function(j){return r.from(j)})}o(p,"iS");function y(E){if(globalThis.process&&!globalThis.process.browser||!b||!b.importKey||!b.deriveBits)return Promise.resolve(!1);if(m[E]!==void 0)return m[E];v=v||r.alloc(8);var R=p(v,v,10,128,E).then(function(){return!0},function(){return!1});return m[E]=R,R}o(y,"ki");function M(E,R){E.then(function(I){w()(function(){R(null,I)})},function(I){w()(function(){R(I)})})}o(M,"Zi"),e.exports=function(E,R,I,T,P,j){typeof P=="function"&&(j=P,P=void 0),P=P||"sha1";var L=h[P.toLowerCase()];if(!L||typeof globalThis.Promise!="function"){w()(function(){var U;try{U=f(E,R,I,T,P)}catch(Z){j(Z);return}j(null,U)});return}if(i(I,T),E=n(E,s,"Password"),R=n(R,s,"Salt"),typeof j!="function")throw Error("No callback provided to pbkdf2");M(y(L).then(function(U){return U?p(E,R,I,T,L):f(E,R,I,T,P)}),j)}}),z2=ye(t=>{t.pbkdf2=Z_(),t.pbkdf2Sync=B2()}),G_=ye(t=>{var e=(qt(),bt(Jt));t.createCipher=t.Cipher=e.createCipher,t.createCipheriv=t.Cipheriv=e.createCipheriv,t.createDecipher=t.Decipher=e.createDecipher,t.createDecipheriv=t.Decipheriv=e.createDecipheriv,t.listCiphers=t.getCiphers=e.getCiphers}),Y_=ye(t=>{var e=(qt(),bt(Jt));t.DiffieHellmanGroup=e.DiffieHellmanGroup,t.createDiffieHellmanGroup=e.createDiffieHellmanGroup,t.getDiffieHellman=e.getDiffieHellman,t.createDiffieHellman=e.createDiffieHellman,t.DiffieHellman=e.DiffieHellman}),Q_=ye(t=>{var e=(qt(),bt(Jt));t.createSign=e.createSign,t.Sign=e.Sign,t.createVerify=e.createVerify,t.Verify=e.Verify}),K_=ye((t,e)=>{e.exports={name:"elliptic",version:"6.6.1",description:"EC cryptography",main:"lib/elliptic.js",files:["lib"],scripts:{lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository:{type:"git",url:"git@github.com:indutny/elliptic"},keywords:["EC","Elliptic","curve","Cryptography"],author:"Fedor Indutny <fedor@indutny.com>",license:"MIT",bugs:{url:"https://github.com/indutny/elliptic/issues"},homepage:"https://github.com/indutny/elliptic",devDependencies:{brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies:{"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}}),jr=ye((t,e)=>{(function(r,i){function s(a,g){if(!a)throw Error(g||"Assertion failed")}o(s,"K");function f(a,g){a.super_=g;var u=o(function(){},"M");u.prototype=g.prototype,a.prototype=new u,a.prototype.constructor=a}o(f,"_");function n(a,g,u){if(n.isBN(a))return a;this.negative=0,this.words=null,this.length=0,this.red=null,a!==null&&((g==="le"||g==="be")&&(u=g,g=10),this._init(a||0,g||10,u||"be"))}o(n,"P"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(a){return a instanceof n?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===n.wordSize&&Array.isArray(a.words)},n.max=function(a,g){return a.cmp(g)>0?a:g},n.min=function(a,g){return a.cmp(g)<0?a:g},n.prototype._init=function(a,g,u){if(typeof a=="number")return this._initNumber(a,g,u);if(typeof a=="object")return this._initArray(a,g,u);g==="hex"&&(g=16),s(g===(g|0)&&g>=2&&g<=36),a=a.toString().replace(/\s+/g,"");var d=0;a[0]==="-"&&(d++,this.negative=1),d<a.length&&(g===16?this._parseHex(a,d,u):(this._parseBase(a,g,d),u==="le"&&this._initArray(this.toArray(),g,u)))},n.prototype._initNumber=function(a,g,u){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(s(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),g,u)},n.prototype._initArray=function(a,g,u){if(s(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x,A,N=0;if(u==="be")for(d=a.length-1,x=0;d>=0;d-=3)A=a[d]|a[d-1]<<8|a[d-2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);else if(u==="le")for(d=0,x=0;d<a.length;d+=3)A=a[d]|a[d+1]<<8|a[d+2]<<16,this.words[x]|=A<<N&67108863,this.words[x+1]=A>>>26-N&67108863,N+=24,N>=26&&(N-=26,x++);return this.strip()};function b(a,g){var u=a.charCodeAt(g);return u>=65&&u<=70?u-55:u>=97&&u<=102?u-87:u-48&15}o(b,"Y");function h(a,g,u){var d=b(a,u);return u-1>=g&&(d|=b(a,u-1)<<4),d}o(h,"z"),n.prototype._parseHex=function(a,g,u){this.length=Math.ceil((a.length-g)/6),this.words=Array(this.length);for(var d=0;d<this.length;d++)this.words[d]=0;var x=0,A=0,N;if(u==="be")for(d=a.length-1;d>=g;d-=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8;else{var S=a.length-g;for(d=S%2===0?g+1:g;d<a.length;d+=2)N=h(a,g,d)<<x,this.words[A]|=N&67108863,x>=18?(x-=18,A+=1,this.words[A]|=N>>>26):x+=8}this.strip()};function m(a,g,u,d){for(var x=0,A=Math.min(a.length,u),N=g;N<A;N++){var S=a.charCodeAt(N)-48;x*=d,S>=49?x+=S-49+10:S>=17?x+=S-17+10:x+=S}return x}o(m,"v"),n.prototype._parseBase=function(a,g,u){this.words=[0],this.length=1;for(var d=0,x=1;x<=67108863;x*=g)d++;d--,x=x/g|0;for(var A=a.length-u,N=A%d,S=Math.min(A,A-N)+u,c=0,_=u;_<S;_+=d)c=m(a,_,_+d,g),this.imuln(x),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(N!==0){var C=1;for(c=m(a,_,a.length,g),_=0;_<N;_++)C*=g;this.imuln(C),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},n.prototype.copy=function(a){a.words=Array(this.length);for(var g=0;g<this.length;g++)a.words[g]=this.words[g];a.length=this.length,a.negative=this.negative,a.red=this.red},n.prototype.clone=function(){var a=new n(null);return this.copy(a),a},n.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],w=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(a,g){a=a||10,g=g|0||1;var u;if(a===16||a==="hex"){u="";for(var d=0,x=0,A=0;A<this.length;A++){var N=this.words[A],S=((N<<d|x)&16777215).toString(16);x=N>>>24-d&16777215,d+=2,d>=26&&(d-=26,A--),x!==0||A!==this.length-1?u=l[6-S.length]+S+u:u=S+u}for(x!==0&&(u=x.toString(16)+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(a===(a|0)&&a>=2&&a<=36){var c=w[a],_=p[a];u="";var C=this.clone();for(C.negative=0;!C.isZero();){var O=C.modn(_).toString(a);C=C.idivn(_),C.isZero()?u=O+u:u=l[c-O.length]+O+u}for(this.isZero()&&(u="0"+u);u.length%g!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(a,g){return s(typeof v<"u"),this.toArrayLike(v,a,g)},n.prototype.toArray=function(a,g){return this.toArrayLike(Array,a,g)},n.prototype.toArrayLike=function(a,g,u){var d=this.byteLength(),x=u||Math.max(1,d);s(d<=x,"byte array longer than desired length"),s(x>0,"Requested array length <= 0"),this.strip();var A=g==="le",N=new a(x),S,c,_=this.clone();if(A){for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[c]=S;for(;c<x;c++)N[c]=0}else{for(c=0;c<x-d;c++)N[c]=0;for(c=0;!_.isZero();c++)S=_.andln(255),_.iushrn(8),N[x-c-1]=S}return N},Math.clz32?n.prototype._countBits=function(a){return 32-Math.clz32(a)}:n.prototype._countBits=function(a){var g=a,u=0;return g>=4096&&(u+=13,g>>>=13),g>=64&&(u+=7,g>>>=7),g>=8&&(u+=4,g>>>=4),g>=2&&(u+=2,g>>>=2),u+g},n.prototype._zeroBits=function(a){if(a===0)return 26;var g=a,u=0;return(g&8191)===0&&(u+=13,g>>>=13),(g&127)===0&&(u+=7,g>>>=7),(g&15)===0&&(u+=4,g>>>=4),(g&3)===0&&(u+=2,g>>>=2),(g&1)===0&&u++,u},n.prototype.bitLength=function(){var a=this.words[this.length-1],g=this._countBits(a);return(this.length-1)*26+g};function y(a){for(var g=Array(a.bitLength()),u=0;u<g.length;u++){var d=u/26|0,x=u%26;g[u]=(a.words[d]&1<<x)>>>x}return g}o(y,"S"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,g=0;g<this.length;g++){var u=this._zeroBits(this.words[g]);if(a+=u,u!==26)break}return a},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},n.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var g=0;g<a.length;g++)this.words[g]=this.words[g]|a.words[g];return this.strip()},n.prototype.ior=function(a){return s((this.negative|a.negative)===0),this.iuor(a)},n.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},n.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},n.prototype.iuand=function(a){var g;this.length>a.length?g=a:g=this;for(var u=0;u<g.length;u++)this.words[u]=this.words[u]&a.words[u];return this.length=g.length,this.strip()},n.prototype.iand=function(a){return s((this.negative|a.negative)===0),this.iuand(a)},n.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},n.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},n.prototype.iuxor=function(a){var g,u;this.length>a.length?(g=this,u=a):(g=a,u=this);for(var d=0;d<u.length;d++)this.words[d]=g.words[d]^u.words[d];if(this!==g)for(;d<g.length;d++)this.words[d]=g.words[d];return this.length=g.length,this.strip()},n.prototype.ixor=function(a){return s((this.negative|a.negative)===0),this.iuxor(a)},n.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},n.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},n.prototype.inotn=function(a){s(typeof a=="number"&&a>=0);var g=Math.ceil(a/26)|0,u=a%26;this._expand(g),u>0&&g--;for(var d=0;d<g;d++)this.words[d]=~this.words[d]&67108863;return u>0&&(this.words[d]=~this.words[d]&67108863>>26-u),this.strip()},n.prototype.notn=function(a){return this.clone().inotn(a)},n.prototype.setn=function(a,g){s(typeof a=="number"&&a>=0);var u=a/26|0,d=a%26;return this._expand(u+1),g?this.words[u]=this.words[u]|1<<d:this.words[u]=this.words[u]&~(1<<d),this.strip()},n.prototype.iadd=function(a){var g;if(this.negative!==0&&a.negative===0)return this.negative=0,g=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,g=this.isub(a),a.negative=1,g._normSign();var u,d;this.length>a.length?(u=this,d=a):(u=a,d=this);for(var x=0,A=0;A<d.length;A++)g=(u.words[A]|0)+(d.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;for(;x!==0&&A<u.length;A++)g=(u.words[A]|0)+x,this.words[A]=g&67108863,x=g>>>26;if(this.length=u.length,x!==0)this.words[this.length]=x,this.length++;else if(u!==this)for(;A<u.length;A++)this.words[A]=u.words[A];return this},n.prototype.add=function(a){var g;return a.negative!==0&&this.negative===0?(a.negative=0,g=this.sub(a),a.negative^=1,g):a.negative===0&&this.negative!==0?(this.negative=0,g=a.sub(this),this.negative=1,g):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},n.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var g=this.iadd(a);return a.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var u=this.cmp(a);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var d,x;u>0?(d=this,x=a):(d=a,x=this);for(var A=0,N=0;N<x.length;N++)g=(d.words[N]|0)-(x.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;for(;A!==0&&N<d.length;N++)g=(d.words[N]|0)+A,A=g>>26,this.words[N]=g&67108863;if(A===0&&N<d.length&&d!==this)for(;N<d.length;N++)this.words[N]=d.words[N];return this.length=Math.max(this.length,N),d!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(a){return this.clone().isub(a)};function M(a,g,u){u.negative=g.negative^a.negative;var d=a.length+g.length|0;u.length=d,d=d-1|0;var x=a.words[0]|0,A=g.words[0]|0,N=x*A,S=N&67108863,c=N/67108864|0;u.words[0]=S;for(var _=1;_<d;_++){for(var C=c>>>26,O=c&67108863,D=Math.min(_,g.length-1),B=Math.max(0,_-a.length+1);B<=D;B++){var z=_-B|0;x=a.words[z]|0,A=g.words[B]|0,N=x*A+O,C+=N/67108864|0,O=N&67108863}u.words[_]=O|0,c=C|0}return c!==0?u.words[_]=c|0:u.length--,u.strip()}o(M,"C");var E=o(function(a,g,u){var d=a.words,x=g.words,A=u.words,N=0,S,c,_,C=d[0]|0,O=C&8191,D=C>>>13,B=d[1]|0,z=B&8191,G=B>>>13,te=d[2]|0,$=te&8191,q=te>>>13,Ce=d[3]|0,fe=Ce&8191,ae=Ce>>>13,be=d[4]|0,H=be&8191,ee=be>>>13,Q=d[5]|0,X=Q&8191,se=Q>>>13,Ne=d[6]|0,we=Ne&8191,ue=Ne>>>13,K=d[7]|0,W=K&8191,J=K>>>13,pe=d[8]|0,le=pe&8191,oe=pe>>>13,Ve=d[9]|0,_e=Ve&8191,Le=Ve>>>13,qe=x[0]|0,ge=qe&8191,De=qe>>>13,he=x[1]|0,ve=he&8191,Oe=he>>>13,je=x[2]|0,ke=je&8191,Fe=je>>>13,et=x[3]|0,Ie=et&8191,Se=et>>>13,Be=x[4]|0,Ee=Be&8191,Ue=Be>>>13,Je=x[5]|0,re=Je&8191,de=Je>>>13,Pe=x[6]|0,Me=Pe&8191,Re=Pe>>>13,Ke=x[7]|0,ie=Ke&8191,Ae=Ke>>>13,Ye=x[8]|0,me=Ye&8191,Qe=Ye>>>13,st=x[9]|0,ze=st&8191,We=st>>>13;u.negative=a.negative^g.negative,u.length=19,S=Math.imul(O,ge),c=Math.imul(O,De),c=c+Math.imul(D,ge)|0,_=Math.imul(D,De);var Te=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,S=Math.imul(z,ge),c=Math.imul(z,De),c=c+Math.imul(G,ge)|0,_=Math.imul(G,De),S=S+Math.imul(O,ve)|0,c=c+Math.imul(O,Oe)|0,c=c+Math.imul(D,ve)|0,_=_+Math.imul(D,Oe)|0;var Ze=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,S=Math.imul($,ge),c=Math.imul($,De),c=c+Math.imul(q,ge)|0,_=Math.imul(q,De),S=S+Math.imul(z,ve)|0,c=c+Math.imul(z,Oe)|0,c=c+Math.imul(G,ve)|0,_=_+Math.imul(G,Oe)|0,S=S+Math.imul(O,ke)|0,c=c+Math.imul(O,Fe)|0,c=c+Math.imul(D,ke)|0,_=_+Math.imul(D,Fe)|0;var lt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(fe,ge),c=Math.imul(fe,De),c=c+Math.imul(ae,ge)|0,_=Math.imul(ae,De),S=S+Math.imul($,ve)|0,c=c+Math.imul($,Oe)|0,c=c+Math.imul(q,ve)|0,_=_+Math.imul(q,Oe)|0,S=S+Math.imul(z,ke)|0,c=c+Math.imul(z,Fe)|0,c=c+Math.imul(G,ke)|0,_=_+Math.imul(G,Fe)|0,S=S+Math.imul(O,Ie)|0,c=c+Math.imul(O,Se)|0,c=c+Math.imul(D,Ie)|0,_=_+Math.imul(D,Se)|0;var yt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(yt>>>26)|0,yt&=67108863,S=Math.imul(H,ge),c=Math.imul(H,De),c=c+Math.imul(ee,ge)|0,_=Math.imul(ee,De),S=S+Math.imul(fe,ve)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(ae,ve)|0,_=_+Math.imul(ae,Oe)|0,S=S+Math.imul($,ke)|0,c=c+Math.imul($,Fe)|0,c=c+Math.imul(q,ke)|0,_=_+Math.imul(q,Fe)|0,S=S+Math.imul(z,Ie)|0,c=c+Math.imul(z,Se)|0,c=c+Math.imul(G,Ie)|0,_=_+Math.imul(G,Se)|0,S=S+Math.imul(O,Ee)|0,c=c+Math.imul(O,Ue)|0,c=c+Math.imul(D,Ee)|0,_=_+Math.imul(D,Ue)|0;var ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(X,ge),c=Math.imul(X,De),c=c+Math.imul(se,ge)|0,_=Math.imul(se,De),S=S+Math.imul(H,ve)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(ee,ve)|0,_=_+Math.imul(ee,Oe)|0,S=S+Math.imul(fe,ke)|0,c=c+Math.imul(fe,Fe)|0,c=c+Math.imul(ae,ke)|0,_=_+Math.imul(ae,Fe)|0,S=S+Math.imul($,Ie)|0,c=c+Math.imul($,Se)|0,c=c+Math.imul(q,Ie)|0,_=_+Math.imul(q,Se)|0,S=S+Math.imul(z,Ee)|0,c=c+Math.imul(z,Ue)|0,c=c+Math.imul(G,Ee)|0,_=_+Math.imul(G,Ue)|0,S=S+Math.imul(O,re)|0,c=c+Math.imul(O,de)|0,c=c+Math.imul(D,re)|0,_=_+Math.imul(D,de)|0;var Nt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S=Math.imul(we,ge),c=Math.imul(we,De),c=c+Math.imul(ue,ge)|0,_=Math.imul(ue,De),S=S+Math.imul(X,ve)|0,c=c+Math.imul(X,Oe)|0,c=c+Math.imul(se,ve)|0,_=_+Math.imul(se,Oe)|0,S=S+Math.imul(H,ke)|0,c=c+Math.imul(H,Fe)|0,c=c+Math.imul(ee,ke)|0,_=_+Math.imul(ee,Fe)|0,S=S+Math.imul(fe,Ie)|0,c=c+Math.imul(fe,Se)|0,c=c+Math.imul(ae,Ie)|0,_=_+Math.imul(ae,Se)|0,S=S+Math.imul($,Ee)|0,c=c+Math.imul($,Ue)|0,c=c+Math.imul(q,Ee)|0,_=_+Math.imul(q,Ue)|0,S=S+Math.imul(z,re)|0,c=c+Math.imul(z,de)|0,c=c+Math.imul(G,re)|0,_=_+Math.imul(G,de)|0,S=S+Math.imul(O,Me)|0,c=c+Math.imul(O,Re)|0,c=c+Math.imul(D,Me)|0,_=_+Math.imul(D,Re)|0;var Dt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,S=Math.imul(W,ge),c=Math.imul(W,De),c=c+Math.imul(J,ge)|0,_=Math.imul(J,De),S=S+Math.imul(we,ve)|0,c=c+Math.imul(we,Oe)|0,c=c+Math.imul(ue,ve)|0,_=_+Math.imul(ue,Oe)|0,S=S+Math.imul(X,ke)|0,c=c+Math.imul(X,Fe)|0,c=c+Math.imul(se,ke)|0,_=_+Math.imul(se,Fe)|0,S=S+Math.imul(H,Ie)|0,c=c+Math.imul(H,Se)|0,c=c+Math.imul(ee,Ie)|0,_=_+Math.imul(ee,Se)|0,S=S+Math.imul(fe,Ee)|0,c=c+Math.imul(fe,Ue)|0,c=c+Math.imul(ae,Ee)|0,_=_+Math.imul(ae,Ue)|0,S=S+Math.imul($,re)|0,c=c+Math.imul($,de)|0,c=c+Math.imul(q,re)|0,_=_+Math.imul(q,de)|0,S=S+Math.imul(z,Me)|0,c=c+Math.imul(z,Re)|0,c=c+Math.imul(G,Me)|0,_=_+Math.imul(G,Re)|0,S=S+Math.imul(O,ie)|0,c=c+Math.imul(O,Ae)|0,c=c+Math.imul(D,ie)|0,_=_+Math.imul(D,Ae)|0;var Ct=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,S=Math.imul(le,ge),c=Math.imul(le,De),c=c+Math.imul(oe,ge)|0,_=Math.imul(oe,De),S=S+Math.imul(W,ve)|0,c=c+Math.imul(W,Oe)|0,c=c+Math.imul(J,ve)|0,_=_+Math.imul(J,Oe)|0,S=S+Math.imul(we,ke)|0,c=c+Math.imul(we,Fe)|0,c=c+Math.imul(ue,ke)|0,_=_+Math.imul(ue,Fe)|0,S=S+Math.imul(X,Ie)|0,c=c+Math.imul(X,Se)|0,c=c+Math.imul(se,Ie)|0,_=_+Math.imul(se,Se)|0,S=S+Math.imul(H,Ee)|0,c=c+Math.imul(H,Ue)|0,c=c+Math.imul(ee,Ee)|0,_=_+Math.imul(ee,Ue)|0,S=S+Math.imul(fe,re)|0,c=c+Math.imul(fe,de)|0,c=c+Math.imul(ae,re)|0,_=_+Math.imul(ae,de)|0,S=S+Math.imul($,Me)|0,c=c+Math.imul($,Re)|0,c=c+Math.imul(q,Me)|0,_=_+Math.imul(q,Re)|0,S=S+Math.imul(z,ie)|0,c=c+Math.imul(z,Ae)|0,c=c+Math.imul(G,ie)|0,_=_+Math.imul(G,Ae)|0,S=S+Math.imul(O,me)|0,c=c+Math.imul(O,Qe)|0,c=c+Math.imul(D,me)|0,_=_+Math.imul(D,Qe)|0;var St=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(St>>>26)|0,St&=67108863,S=Math.imul(_e,ge),c=Math.imul(_e,De),c=c+Math.imul(Le,ge)|0,_=Math.imul(Le,De),S=S+Math.imul(le,ve)|0,c=c+Math.imul(le,Oe)|0,c=c+Math.imul(oe,ve)|0,_=_+Math.imul(oe,Oe)|0,S=S+Math.imul(W,ke)|0,c=c+Math.imul(W,Fe)|0,c=c+Math.imul(J,ke)|0,_=_+Math.imul(J,Fe)|0,S=S+Math.imul(we,Ie)|0,c=c+Math.imul(we,Se)|0,c=c+Math.imul(ue,Ie)|0,_=_+Math.imul(ue,Se)|0,S=S+Math.imul(X,Ee)|0,c=c+Math.imul(X,Ue)|0,c=c+Math.imul(se,Ee)|0,_=_+Math.imul(se,Ue)|0,S=S+Math.imul(H,re)|0,c=c+Math.imul(H,de)|0,c=c+Math.imul(ee,re)|0,_=_+Math.imul(ee,de)|0,S=S+Math.imul(fe,Me)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(ae,Me)|0,_=_+Math.imul(ae,Re)|0,S=S+Math.imul($,ie)|0,c=c+Math.imul($,Ae)|0,c=c+Math.imul(q,ie)|0,_=_+Math.imul(q,Ae)|0,S=S+Math.imul(z,me)|0,c=c+Math.imul(z,Qe)|0,c=c+Math.imul(G,me)|0,_=_+Math.imul(G,Qe)|0,S=S+Math.imul(O,ze)|0,c=c+Math.imul(O,We)|0,c=c+Math.imul(D,ze)|0,_=_+Math.imul(D,We)|0;var Ht=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,S=Math.imul(_e,ve),c=Math.imul(_e,Oe),c=c+Math.imul(Le,ve)|0,_=Math.imul(Le,Oe),S=S+Math.imul(le,ke)|0,c=c+Math.imul(le,Fe)|0,c=c+Math.imul(oe,ke)|0,_=_+Math.imul(oe,Fe)|0,S=S+Math.imul(W,Ie)|0,c=c+Math.imul(W,Se)|0,c=c+Math.imul(J,Ie)|0,_=_+Math.imul(J,Se)|0,S=S+Math.imul(we,Ee)|0,c=c+Math.imul(we,Ue)|0,c=c+Math.imul(ue,Ee)|0,_=_+Math.imul(ue,Ue)|0,S=S+Math.imul(X,re)|0,c=c+Math.imul(X,de)|0,c=c+Math.imul(se,re)|0,_=_+Math.imul(se,de)|0,S=S+Math.imul(H,Me)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(ee,Me)|0,_=_+Math.imul(ee,Re)|0,S=S+Math.imul(fe,ie)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(ae,ie)|0,_=_+Math.imul(ae,Ae)|0,S=S+Math.imul($,me)|0,c=c+Math.imul($,Qe)|0,c=c+Math.imul(q,me)|0,_=_+Math.imul(q,Qe)|0,S=S+Math.imul(z,ze)|0,c=c+Math.imul(z,We)|0,c=c+Math.imul(G,ze)|0,_=_+Math.imul(G,We)|0;var Vt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,S=Math.imul(_e,ke),c=Math.imul(_e,Fe),c=c+Math.imul(Le,ke)|0,_=Math.imul(Le,Fe),S=S+Math.imul(le,Ie)|0,c=c+Math.imul(le,Se)|0,c=c+Math.imul(oe,Ie)|0,_=_+Math.imul(oe,Se)|0,S=S+Math.imul(W,Ee)|0,c=c+Math.imul(W,Ue)|0,c=c+Math.imul(J,Ee)|0,_=_+Math.imul(J,Ue)|0,S=S+Math.imul(we,re)|0,c=c+Math.imul(we,de)|0,c=c+Math.imul(ue,re)|0,_=_+Math.imul(ue,de)|0,S=S+Math.imul(X,Me)|0,c=c+Math.imul(X,Re)|0,c=c+Math.imul(se,Me)|0,_=_+Math.imul(se,Re)|0,S=S+Math.imul(H,ie)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(ee,ie)|0,_=_+Math.imul(ee,Ae)|0,S=S+Math.imul(fe,me)|0,c=c+Math.imul(fe,Qe)|0,c=c+Math.imul(ae,me)|0,_=_+Math.imul(ae,Qe)|0,S=S+Math.imul($,ze)|0,c=c+Math.imul($,We)|0,c=c+Math.imul(q,ze)|0,_=_+Math.imul(q,We)|0;var Pt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,S=Math.imul(_e,Ie),c=Math.imul(_e,Se),c=c+Math.imul(Le,Ie)|0,_=Math.imul(Le,Se),S=S+Math.imul(le,Ee)|0,c=c+Math.imul(le,Ue)|0,c=c+Math.imul(oe,Ee)|0,_=_+Math.imul(oe,Ue)|0,S=S+Math.imul(W,re)|0,c=c+Math.imul(W,de)|0,c=c+Math.imul(J,re)|0,_=_+Math.imul(J,de)|0,S=S+Math.imul(we,Me)|0,c=c+Math.imul(we,Re)|0,c=c+Math.imul(ue,Me)|0,_=_+Math.imul(ue,Re)|0,S=S+Math.imul(X,ie)|0,c=c+Math.imul(X,Ae)|0,c=c+Math.imul(se,ie)|0,_=_+Math.imul(se,Ae)|0,S=S+Math.imul(H,me)|0,c=c+Math.imul(H,Qe)|0,c=c+Math.imul(ee,me)|0,_=_+Math.imul(ee,Qe)|0,S=S+Math.imul(fe,ze)|0,c=c+Math.imul(fe,We)|0,c=c+Math.imul(ae,ze)|0,_=_+Math.imul(ae,We)|0;var Ft=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,S=Math.imul(_e,Ee),c=Math.imul(_e,Ue),c=c+Math.imul(Le,Ee)|0,_=Math.imul(Le,Ue),S=S+Math.imul(le,re)|0,c=c+Math.imul(le,de)|0,c=c+Math.imul(oe,re)|0,_=_+Math.imul(oe,de)|0,S=S+Math.imul(W,Me)|0,c=c+Math.imul(W,Re)|0,c=c+Math.imul(J,Me)|0,_=_+Math.imul(J,Re)|0,S=S+Math.imul(we,ie)|0,c=c+Math.imul(we,Ae)|0,c=c+Math.imul(ue,ie)|0,_=_+Math.imul(ue,Ae)|0,S=S+Math.imul(X,me)|0,c=c+Math.imul(X,Qe)|0,c=c+Math.imul(se,me)|0,_=_+Math.imul(se,Qe)|0,S=S+Math.imul(H,ze)|0,c=c+Math.imul(H,We)|0,c=c+Math.imul(ee,ze)|0,_=_+Math.imul(ee,We)|0;var Tt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,S=Math.imul(_e,re),c=Math.imul(_e,de),c=c+Math.imul(Le,re)|0,_=Math.imul(Le,de),S=S+Math.imul(le,Me)|0,c=c+Math.imul(le,Re)|0,c=c+Math.imul(oe,Me)|0,_=_+Math.imul(oe,Re)|0,S=S+Math.imul(W,ie)|0,c=c+Math.imul(W,Ae)|0,c=c+Math.imul(J,ie)|0,_=_+Math.imul(J,Ae)|0,S=S+Math.imul(we,me)|0,c=c+Math.imul(we,Qe)|0,c=c+Math.imul(ue,me)|0,_=_+Math.imul(ue,Qe)|0,S=S+Math.imul(X,ze)|0,c=c+Math.imul(X,We)|0,c=c+Math.imul(se,ze)|0,_=_+Math.imul(se,We)|0;var jt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(jt>>>26)|0,jt&=67108863,S=Math.imul(_e,Me),c=Math.imul(_e,Re),c=c+Math.imul(Le,Me)|0,_=Math.imul(Le,Re),S=S+Math.imul(le,ie)|0,c=c+Math.imul(le,Ae)|0,c=c+Math.imul(oe,ie)|0,_=_+Math.imul(oe,Ae)|0,S=S+Math.imul(W,me)|0,c=c+Math.imul(W,Qe)|0,c=c+Math.imul(J,me)|0,_=_+Math.imul(J,Qe)|0,S=S+Math.imul(we,ze)|0,c=c+Math.imul(we,We)|0,c=c+Math.imul(ue,ze)|0,_=_+Math.imul(ue,We)|0;var Ut=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,S=Math.imul(_e,ie),c=Math.imul(_e,Ae),c=c+Math.imul(Le,ie)|0,_=Math.imul(Le,Ae),S=S+Math.imul(le,me)|0,c=c+Math.imul(le,Qe)|0,c=c+Math.imul(oe,me)|0,_=_+Math.imul(oe,Qe)|0,S=S+Math.imul(W,ze)|0,c=c+Math.imul(W,We)|0,c=c+Math.imul(J,ze)|0,_=_+Math.imul(J,We)|0;var Zt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,S=Math.imul(_e,me),c=Math.imul(_e,Qe),c=c+Math.imul(Le,me)|0,_=Math.imul(Le,Qe),S=S+Math.imul(le,ze)|0,c=c+Math.imul(le,We)|0,c=c+Math.imul(oe,ze)|0,_=_+Math.imul(oe,We)|0;var Gt=(N+S|0)+((c&8191)<<13)|0;N=(_+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,S=Math.imul(_e,ze),c=Math.imul(_e,We),c=c+Math.imul(Le,ze)|0,_=Math.imul(Le,We);var Yt=(N+S|0)+((c&8191)<<13)|0;return N=(_+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,A[0]=Te,A[1]=Ze,A[2]=lt,A[3]=yt,A[4]=ht,A[5]=Nt,A[6]=Dt,A[7]=Ct,A[8]=St,A[9]=Ht,A[10]=Vt,A[11]=Pt,A[12]=Ft,A[13]=Tt,A[14]=jt,A[15]=Ut,A[16]=Zt,A[17]=Gt,A[18]=Yt,N!==0&&(A[19]=N,u.length++),u},"E");Math.imul||(E=M);function R(a,g,u){u.negative=g.negative^a.negative,u.length=a.length+g.length;for(var d=0,x=0,A=0;A<u.length-1;A++){var N=x;x=0;for(var S=d&67108863,c=Math.min(A,g.length-1),_=Math.max(0,A-a.length+1);_<=c;_++){var C=A-_,O=a.words[C]|0,D=g.words[_]|0,B=O*D,z=B&67108863;N=N+(B/67108864|0)|0,z=z+S|0,S=z&67108863,N=N+(z>>>26)|0,x+=N>>>26,N&=67108863}u.words[A]=S,d=N,N=x}return d!==0?u.words[A]=d:u.length--,u.strip()}o(R,"I");function I(a,g,u){var d=new T;return d.mulp(a,g,u)}o(I,"L"),n.prototype.mulTo=function(a,g){var u,d=this.length+a.length;return this.length===10&&a.length===10?u=E(this,a,g):d<63?u=M(this,a,g):d<1024?u=R(this,a,g):u=I(this,a,g),u};function T(a,g){this.x=a,this.y=g}o(T,"h"),T.prototype.makeRBT=function(a){for(var g=Array(a),u=n.prototype._countBits(a)-1,d=0;d<a;d++)g[d]=this.revBin(d,u,a);return g},T.prototype.revBin=function(a,g,u){if(a===0||a===u-1)return a;for(var d=0,x=0;x<g;x++)d|=(a&1)<<g-x-1,a>>=1;return d},T.prototype.permute=function(a,g,u,d,x,A){for(var N=0;N<A;N++)d[N]=g[a[N]],x[N]=u[a[N]]},T.prototype.transform=function(a,g,u,d,x,A){this.permute(A,a,g,u,d,x);for(var N=1;N<x;N<<=1)for(var S=N<<1,c=Math.cos(2*Math.PI/S),_=Math.sin(2*Math.PI/S),C=0;C<x;C+=S)for(var O=c,D=_,B=0;B<N;B++){var z=u[C+B],G=d[C+B],te=u[C+B+N],$=d[C+B+N],q=O*te-D*$;$=O*$+D*te,te=q,u[C+B]=z+te,d[C+B]=G+$,u[C+B+N]=z-te,d[C+B+N]=G-$,B!==S&&(q=c*O-_*D,D=c*D+_*O,O=q)}},T.prototype.guessLen13b=function(a,g){var u=Math.max(g,a)|1,d=u&1,x=0;for(u=u/2|0;u;u=u>>>1)x++;return 1<<x+1+d},T.prototype.conjugate=function(a,g,u){if(!(u<=1))for(var d=0;d<u/2;d++){var x=a[d];a[d]=a[u-d-1],a[u-d-1]=x,x=g[d],g[d]=-g[u-d-1],g[u-d-1]=-x}},T.prototype.normalize13b=function(a,g){for(var u=0,d=0;d<g/2;d++){var x=Math.round(a[2*d+1]/g)*8192+Math.round(a[2*d]/g)+u;a[d]=x&67108863,x<67108864?u=0:u=x/67108864|0}return a},T.prototype.convert13b=function(a,g,u,d){for(var x=0,A=0;A<g;A++)x=x+(a[A]|0),u[2*A]=x&8191,x=x>>>13,u[2*A+1]=x&8191,x=x>>>13;for(A=2*g;A<d;++A)u[A]=0;s(x===0),s((x&-8192)===0)},T.prototype.stub=function(a){for(var g=Array(a),u=0;u<a;u++)g[u]=0;return g},T.prototype.mulp=function(a,g,u){var d=2*this.guessLen13b(a.length,g.length),x=this.makeRBT(d),A=this.stub(d),N=Array(d),S=Array(d),c=Array(d),_=Array(d),C=Array(d),O=Array(d),D=u.words;D.length=d,this.convert13b(a.words,a.length,N,d),this.convert13b(g.words,g.length,_,d),this.transform(N,A,S,c,d,x),this.transform(_,A,C,O,d,x);for(var B=0;B<d;B++){var z=S[B]*C[B]-c[B]*O[B];c[B]=S[B]*O[B]+c[B]*C[B],S[B]=z}return this.conjugate(S,c,d),this.transform(S,c,D,A,d,x),this.conjugate(D,A,d),this.normalize13b(D,d),u.negative=a.negative^g.negative,u.length=a.length+g.length,u.strip()},n.prototype.mul=function(a){var g=new n(null);return g.words=Array(this.length+a.length),this.mulTo(a,g)},n.prototype.mulf=function(a){var g=new n(null);return g.words=Array(this.length+a.length),I(this,a,g)},n.prototype.imul=function(a){return this.clone().mulTo(a,this)},n.prototype.imuln=function(a){s(typeof a=="number"),s(a<67108864);for(var g=0,u=0;u<this.length;u++){var d=(this.words[u]|0)*a,x=(d&67108863)+(g&67108863);g>>=26,g+=d/67108864|0,g+=x>>>26,this.words[u]=x&67108863}return g!==0&&(this.words[u]=g,this.length++),this.length=a===0?1:this.length,this},n.prototype.muln=function(a){return this.clone().imuln(a)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(a){var g=y(a);if(g.length===0)return new n(1);for(var u=this,d=0;d<g.length&&g[d]===0;d++,u=u.sqr());if(++d<g.length)for(var x=u.sqr();d<g.length;d++,x=x.sqr())g[d]!==0&&(u=u.mul(x));return u},n.prototype.iushln=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=67108863>>>26-g<<26-g,x;if(g!==0){var A=0;for(x=0;x<this.length;x++){var N=this.words[x]&d,S=(this.words[x]|0)-N<<g;this.words[x]=S|A,A=N>>>26-g}A&&(this.words[x]=A,this.length++)}if(u!==0){for(x=this.length-1;x>=0;x--)this.words[x+u]=this.words[x];for(x=0;x<u;x++)this.words[x]=0;this.length+=u}return this.strip()},n.prototype.ishln=function(a){return s(this.negative===0),this.iushln(a)},n.prototype.iushrn=function(a,g,u){s(typeof a=="number"&&a>=0);var d;g?d=(g-g%26)/26:d=0;var x=a%26,A=Math.min((a-x)/26,this.length),N=67108863^67108863>>>x<<x,S=u;if(d-=A,d=Math.max(0,d),S){for(var c=0;c<A;c++)S.words[c]=this.words[c];S.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var _=0;for(c=this.length-1;c>=0&&(_!==0||c>=d);c--){var C=this.words[c]|0;this.words[c]=_<<26-x|C>>>x,_=C&N}return S&&_!==0&&(S.words[S.length++]=_),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(a,g,u){return s(this.negative===0),this.iushrn(a,g,u)},n.prototype.shln=function(a){return this.clone().ishln(a)},n.prototype.ushln=function(a){return this.clone().iushln(a)},n.prototype.shrn=function(a){return this.clone().ishrn(a)},n.prototype.ushrn=function(a){return this.clone().iushrn(a)},n.prototype.testn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return!1;var x=this.words[u];return!!(x&d)},n.prototype.imaskn=function(a){s(typeof a=="number"&&a>=0);var g=a%26,u=(a-g)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(g!==0&&u++,this.length=Math.min(u,this.length),g!==0){var d=67108863^67108863>>>g<<g;this.words[this.length-1]&=d}return this.strip()},n.prototype.maskn=function(a){return this.clone().imaskn(a)},n.prototype.iaddn=function(a){return s(typeof a=="number"),s(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},n.prototype._iaddn=function(a){this.words[0]+=a;for(var g=0;g<this.length&&this.words[g]>=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},n.prototype.isubn=function(a){if(s(typeof a=="number"),s(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this.strip()},n.prototype.addn=function(a){return this.clone().iaddn(a)},n.prototype.subn=function(a){return this.clone().isubn(a)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(a,g,u){var d=a.length+u,x;this._expand(d);var A,N=0;for(x=0;x<a.length;x++){A=(this.words[x+u]|0)+N;var S=(a.words[x]|0)*g;A-=S&67108863,N=(A>>26)-(S/67108864|0),this.words[x+u]=A&67108863}for(;x<this.length-u;x++)A=(this.words[x+u]|0)+N,N=A>>26,this.words[x+u]=A&67108863;if(N===0)return this.strip();for(s(N===-1),N=0,x=0;x<this.length;x++)A=-(this.words[x]|0)+N,N=A>>26,this.words[x]=A&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(a,g){var u=this.length-a.length,d=this.clone(),x=a,A=x.words[x.length-1]|0,N=this._countBits(A);u=26-N,u!==0&&(x=x.ushln(u),d.iushln(u),A=x.words[x.length-1]|0);var S=d.length-x.length,c;if(g!=="mod"){c=new n(null),c.length=S+1,c.words=Array(c.length);for(var _=0;_<c.length;_++)c.words[_]=0}var C=d.clone()._ishlnsubmul(x,1,S);C.negative===0&&(d=C,c&&(c.words[S]=1));for(var O=S-1;O>=0;O--){var D=(d.words[x.length+O]|0)*67108864+(d.words[x.length+O-1]|0);for(D=Math.min(D/A|0,67108863),d._ishlnsubmul(x,D,O);d.negative!==0;)D--,d.negative=0,d._ishlnsubmul(x,1,O),!d.isZero()&&(d.negative^=1);c&&(c.words[O]=D)}return c&&c.strip(),d.strip(),g!=="div"&&u!==0&&d.iushrn(u),{div:c||null,mod:d}},n.prototype.divmod=function(a,g,u){if(s(!a.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var d,x,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,g),g!=="mod"&&(d=A.div.neg()),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.iadd(a)),{div:d,mod:x}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),g),g!=="mod"&&(d=A.div.neg()),{div:d,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),g),g!=="div"&&(x=A.mod.neg(),u&&x.negative!==0&&x.isub(a)),{div:A.div,mod:x}):a.length>this.length||this.cmp(a)<0?{div:new n(0),mod:this}:a.length===1?g==="div"?{div:this.divn(a.words[0]),mod:null}:g==="mod"?{div:null,mod:new n(this.modn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new n(this.modn(a.words[0]))}:this._wordDiv(a,g)},n.prototype.div=function(a){return this.divmod(a,"div",!1).div},n.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},n.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},n.prototype.divRound=function(a){var g=this.divmod(a);if(g.mod.isZero())return g.div;var u=g.div.negative!==0?g.mod.isub(a):g.mod,d=a.ushrn(1),x=a.andln(1),A=u.cmp(d);return A<0||x===1&&A===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},n.prototype.modn=function(a){s(a<=67108863);for(var g=67108864%a,u=0,d=this.length-1;d>=0;d--)u=(g*u+(this.words[d]|0))%a;return u},n.prototype.idivn=function(a){s(a<=67108863);for(var g=0,u=this.length-1;u>=0;u--){var d=(this.words[u]|0)+g*67108864;this.words[u]=d/a|0,g=d%a}return this.strip()},n.prototype.divn=function(a){return this.clone().idivn(a)},n.prototype.egcd=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=new n(0),N=new n(1),S=0;g.isEven()&&u.isEven();)g.iushrn(1),u.iushrn(1),++S;for(var c=u.clone(),_=g.clone();!g.isZero();){for(var C=0,O=1;(g.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(g.iushrn(C);C-- >0;)(d.isOdd()||x.isOdd())&&(d.iadd(c),x.isub(_)),d.iushrn(1),x.iushrn(1);for(var D=0,B=1;(u.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(u.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(c),N.isub(_)),A.iushrn(1),N.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(A),x.isub(N)):(u.isub(g),A.isub(d),N.isub(x))}return{a:A,b:N,gcd:u.iushln(S)}},n.prototype._invmp=function(a){s(a.negative===0),s(!a.isZero());var g=this,u=a.clone();g.negative!==0?g=g.umod(a):g=g.clone();for(var d=new n(1),x=new n(0),A=u.clone();g.cmpn(1)>0&&u.cmpn(1)>0;){for(var N=0,S=1;(g.words[0]&S)===0&&N<26;++N,S<<=1);if(N>0)for(g.iushrn(N);N-- >0;)d.isOdd()&&d.iadd(A),d.iushrn(1);for(var c=0,_=1;(u.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(u.iushrn(c);c-- >0;)x.isOdd()&&x.iadd(A),x.iushrn(1);g.cmp(u)>=0?(g.isub(u),d.isub(x)):(u.isub(g),x.isub(d))}var C;return g.cmpn(1)===0?C=d:C=x,C.cmpn(0)<0&&C.iadd(a),C},n.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var g=this.clone(),u=a.clone();g.negative=0,u.negative=0;for(var d=0;g.isEven()&&u.isEven();d++)g.iushrn(1),u.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;u.isEven();)u.iushrn(1);var x=g.cmp(u);if(x<0){var A=g;g=u,u=A}else if(x===0||u.cmpn(1)===0)break;g.isub(u)}while(!0);return u.iushln(d)},n.prototype.invm=function(a){return this.egcd(a).a.umod(a)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(a){return this.words[0]&a},n.prototype.bincn=function(a){s(typeof a=="number");var g=a%26,u=(a-g)/26,d=1<<g;if(this.length<=u)return this._expand(u+1),this.words[u]|=d,this;for(var x=d,A=u;x!==0&&A<this.length;A++){var N=this.words[A]|0;N+=x,x=N>>>26,N&=67108863,this.words[A]=N}return x!==0&&(this.words[A]=x,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(a){var g=a<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this.strip();var u;if(this.length>1)u=1;else{g&&(a=-a),s(a<=67108863,"Number is too big");var d=this.words[0]|0;u=d===a?0:d<a?-1:1}return this.negative!==0?-u|0:u},n.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var g=this.ucmp(a);return this.negative!==0?-g|0:g},n.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var g=0,u=this.length-1;u>=0;u--){var d=this.words[u]|0,x=a.words[u]|0;if(d!==x){d<x?g=-1:d>x&&(g=1);break}}return g},n.prototype.gtn=function(a){return this.cmpn(a)===1},n.prototype.gt=function(a){return this.cmp(a)===1},n.prototype.gten=function(a){return this.cmpn(a)>=0},n.prototype.gte=function(a){return this.cmp(a)>=0},n.prototype.ltn=function(a){return this.cmpn(a)===-1},n.prototype.lt=function(a){return this.cmp(a)===-1},n.prototype.lten=function(a){return this.cmpn(a)<=0},n.prototype.lte=function(a){return this.cmp(a)<=0},n.prototype.eqn=function(a){return this.cmpn(a)===0},n.prototype.eq=function(a){return this.cmp(a)===0},n.red=function(a){return new F(a)},n.prototype.toRed=function(a){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(a){return this.red=a,this},n.prototype.forceRed=function(a){return s(!this.red,"Already a number in reduction context"),this._forceRed(a)},n.prototype.redAdd=function(a){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},n.prototype.redIAdd=function(a){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},n.prototype.redSub=function(a){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},n.prototype.redISub=function(a){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},n.prototype.redShl=function(a){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},n.prototype.redMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},n.prototype.redIMul=function(a){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(a){return s(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var P={k256:null,p224:null,p192:null,p25519:null};function j(a,g){this.name=a,this.p=new n(g,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(j,"y"),j.prototype._tmp=function(){var a=new n(null);return a.words=Array(Math.ceil(this.n/13)),a},j.prototype.ireduce=function(a){var g=a,u;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),u=g.bitLength();while(u>this.n);var d=u<this.n?-1:g.ucmp(this.p);return d===0?(g.words[0]=0,g.length=1):d>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(a,g){a.iushrn(this.n,0,g)},j.prototype.imulK=function(a){return a.imul(this.k)};function L(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(L,"x"),f(L,j),L.prototype.split=function(a,g){for(var u=4194303,d=Math.min(a.length,9),x=0;x<d;x++)g.words[x]=a.words[x];if(g.length=d,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(g.words[g.length++]=A&u,x=10;x<a.length;x++){var N=a.words[x]|0;a.words[x-10]=(N&u)<<4|A>>>22,A=N}A>>>=22,a.words[x-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},L.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var g=0,u=0;u<a.length;u++){var d=a.words[u]|0;g+=d*977,a.words[u]=g&67108863,g=d*64+(g/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function U(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(U,"c"),f(U,j);function Z(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(Z,"l"),f(Z,j);function ne(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(ne,"B"),f(ne,j),ne.prototype.imulK=function(a){for(var g=0,u=0;u<a.length;u++){var d=(a.words[u]|0)*19+g,x=d&67108863;d>>>=26,a.words[u]=x,g=d}return g!==0&&(a.words[a.length++]=g),a},n._prime=function(a){if(P[a])return P[a];var g;if(a==="k256")g=new L;else if(a==="p224")g=new U;else if(a==="p192")g=new Z;else if(a==="p25519")g=new ne;else throw Error("Unknown prime "+a);return P[a]=g,g};function F(a){if(typeof a=="string"){var g=n._prime(a);this.m=g.p,this.prime=g}else s(a.gtn(1),"modulus must be greater than 1"),this.m=a,this.prime=null}o(F,"s"),F.prototype._verify1=function(a){s(a.negative===0,"red works only with positives"),s(a.red,"red works only with red numbers")},F.prototype._verify2=function(a,g){s((a.negative|g.negative)===0,"red works only with positives"),s(a.red&&a.red===g.red,"red works only with red numbers")},F.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):a.umod(this.m)._forceRed(this)},F.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},F.prototype.add=function(a,g){this._verify2(a,g);var u=a.add(g);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},F.prototype.iadd=function(a,g){this._verify2(a,g);var u=a.iadd(g);return u.cmp(this.m)>=0&&u.isub(this.m),u},F.prototype.sub=function(a,g){this._verify2(a,g);var u=a.sub(g);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},F.prototype.isub=function(a,g){this._verify2(a,g);var u=a.isub(g);return u.cmpn(0)<0&&u.iadd(this.m),u},F.prototype.shl=function(a,g){return this._verify1(a),this.imod(a.ushln(g))},F.prototype.imul=function(a,g){return this._verify2(a,g),this.imod(a.imul(g))},F.prototype.mul=function(a,g){return this._verify2(a,g),this.imod(a.mul(g))},F.prototype.isqr=function(a){return this.imul(a,a.clone())},F.prototype.sqr=function(a){return this.mul(a,a)},F.prototype.sqrt=function(a){if(a.isZero())return a.clone();var g=this.m.andln(3);if(s(g%2===1),g===3){var u=this.m.add(new n(1)).iushrn(2);return this.pow(a,u)}for(var d=this.m.subn(1),x=0;!d.isZero()&&d.andln(1)===0;)x++,d.iushrn(1);s(!d.isZero());var A=new n(1).toRed(this),N=A.redNeg(),S=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new n(2*c*c).toRed(this);this.pow(c,S).cmp(N)!==0;)c.redIAdd(N);for(var _=this.pow(c,d),C=this.pow(a,d.addn(1).iushrn(1)),O=this.pow(a,d),D=x;O.cmp(A)!==0;){for(var B=O,z=0;B.cmp(A)!==0;z++)B=B.redSqr();s(z<D);var G=this.pow(_,new n(1).iushln(D-z-1));C=C.redMul(G),_=G.redSqr(),O=O.redMul(_),D=z}return C},F.prototype.invm=function(a){var g=a._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},F.prototype.pow=function(a,g){if(g.isZero())return new n(1).toRed(this);if(g.cmpn(1)===0)return a.clone();var u=4,d=Array(1<<u);d[0]=new n(1).toRed(this),d[1]=a;for(var x=2;x<d.length;x++)d[x]=this.mul(d[x-1],a);var A=d[0],N=0,S=0,c=g.bitLength()%26;for(c===0&&(c=26),x=g.length-1;x>=0;x--){for(var _=g.words[x],C=c-1;C>=0;C--){var O=_>>C&1;if(A!==d[0]&&(A=this.sqr(A)),O===0&&N===0){S=0;continue}N<<=1,N|=O,S++,!(S!==u&&(x!==0||C!==0))&&(A=this.mul(A,d[N]),S=0,N=0)}c=26}return A},F.prototype.convertTo=function(a){var g=a.umod(this.m);return g===a?g.clone():g},F.prototype.convertFrom=function(a){var g=a.clone();return g.red=null,g},n.mont=function(a){return new Y(a)};function Y(a){F.call(this,a),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(Y,"K8"),f(Y,F),Y.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},Y.prototype.convertFrom=function(a){var g=this.imod(a.mul(this.rinv));return g.red=null,g},Y.prototype.imul=function(a,g){if(a.isZero()||g.isZero())return a.words[0]=0,a.length=1,a;var u=a.imul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.mul=function(a,g){if(a.isZero()||g.isZero())return new n(0)._forceRed(this);var u=a.mul(g),d=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),x=u.isub(d).iushrn(this.shift),A=x;return x.cmp(this.m)>=0?A=x.isub(this.m):x.cmpn(0)<0&&(A=x.iadd(this.m)),A._forceRed(this)},Y.prototype.invm=function(a){var g=this.imod(a._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(typeof e>"u"||e,t)}),In=ye((t,e)=>{e.exports=r;function r(i,s){if(!i)throw Error(s||"Assertion failed")}o(r,"_C"),r.equal=function(i,s,f){if(i!=s)throw Error(f||"Assertion failed: "+i+" != "+s)}}),F2=ye(t=>{var e=t;function r(f,n){if(Array.isArray(f))return f.slice();if(!f)return[];var v=[];if(typeof f!="string"){for(var b=0;b<f.length;b++)v[b]=f[b]|0;return v}if(n==="hex"){f=f.replace(/[^a-z0-9]+/ig,""),f.length%2!==0&&(f="0"+f);for(var b=0;b<f.length;b+=2)v.push(parseInt(f[b]+f[b+1],16))}else for(var b=0;b<f.length;b++){var h=f.charCodeAt(b),m=h>>8,l=h&255;m?v.push(m,l):v.push(l)}return v}o(r,"Bi"),e.toArray=r;function i(f){return f.length===1?"0"+f:f}o(i,"YC"),e.zero2=i;function s(f){for(var n="",v=0;v<f.length;v++)n+=i(f[v].toString(16));return n}o(s,"OC"),e.toHex=s,e.encode=function(f,n){return n==="hex"?s(f):f}}),Wr=ye(t=>{var e=t,r=jr(),i=In(),s=F2();e.assert=i,e.toArray=s.toArray,e.zero2=s.zero2,e.toHex=s.toHex,e.encode=s.encode;function f(m,l,w){var p=Array(Math.max(m.bitLength(),w)+1),y;for(y=0;y<p.length;y+=1)p[y]=0;var M=1<<l+1,E=m.clone();for(y=0;y<p.length;y++){var R,I=E.andln(M-1);E.isOdd()?(I>(M>>1)-1?R=(M>>1)-I:R=I,E.isubn(R)):R=0,p[y]=R,E.iushrn(1)}return p}o(f,"Ui"),e.getNAF=f;function n(m,l){var w=[[],[]];m=m.clone(),l=l.clone();for(var p=0,y=0,M;m.cmpn(-p)>0||l.cmpn(-y)>0;){var E=m.andln(3)+p&3,R=l.andln(3)+y&3;E===3&&(E=-1),R===3&&(R=-1);var I;(E&1)===0?I=0:(M=m.andln(7)+p&7,(M===3||M===5)&&R===2?I=-E:I=E),w[0].push(I);var T;(R&1)===0?T=0:(M=l.andln(7)+y&7,(M===3||M===5)&&E===2?T=-R:T=R),w[1].push(T),2*p===I+1&&(p=1-p),2*y===T+1&&(y=1-y),m.iushrn(1),l.iushrn(1)}return w}o(n,"ri"),e.getJSF=n;function v(m,l,w){var p="_"+l;m.prototype[l]=function(){return this[p]!==void 0?this[p]:this[p]=w.call(this)}}o(v,"Fi"),e.cachedProperty=v;function b(m){return typeof m=="string"?e.toArray(m,"hex"):m}o(b,"Qi"),e.parseBytes=b;function h(m){return new r(m,"hex","le")}o(h,"ii"),e.intFromLE=h}),U2=ye((t,e)=>{var r;e.exports=function(f){return r||(r=new i(null)),r.generate(f)};function i(f){this.rand=f}if(o(i,"S7"),e.exports.Rand=i,i.prototype.generate=function(f){return this._rand(f)},i.prototype._rand=function(f){if(this.rand.getBytes)return this.rand.getBytes(f);for(var n=new Uint8Array(f),v=0;v<n.length;v++)n[v]=this.rand.getByte();return n},typeof self=="object")self.crypto&&self.crypto.getRandomValues?i.prototype._rand=function(f){var n=new Uint8Array(f);return self.crypto.getRandomValues(n),n}:self.msCrypto&&self.msCrypto.getRandomValues?i.prototype._rand=function(f){var n=new Uint8Array(f);return self.msCrypto.getRandomValues(n),n}:typeof window=="object"&&(i.prototype._rand=function(){throw Error("Not implemented yet")});else try{if(s=(qt(),bt(Jt)),typeof s.randomBytes!="function")throw Error("Not supported");i.prototype._rand=function(f){return s.randomBytes(f)}}catch{}var s}),Zu=ye((t,e)=>{var r=jr(),i=Wr(),s=i.getNAF,f=i.getJSF,n=i.assert;function v(h,m){this.type=h,this.p=new r(m.p,16),this.red=m.prime?r.red(m.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=m.n&&new r(m.n,16),this.g=m.g&&this.pointFromJSON(m.g,m.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var l=this.n&&this.p.div(this.n);!l||l.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}o(v,"C7"),e.exports=v,v.prototype.point=function(){throw Error("Not implemented")},v.prototype.validate=function(){throw Error("Not implemented")},v.prototype._fixedNafMul=function(h,m){n(h.precomputed);var l=h._getDoubles(),w=s(m,1,this._bitLength),p=(1<<l.step+1)-(l.step%2===0?2:1);p/=3;var y=[],M,E;for(M=0;M<w.length;M+=l.step){E=0;for(var R=M+l.step-1;R>=M;R--)E=(E<<1)+w[R];y.push(E)}for(var I=this.jpoint(null,null,null),T=this.jpoint(null,null,null),P=p;P>0;P--){for(M=0;M<y.length;M++)E=y[M],E===P?T=T.mixedAdd(l.points[M]):E===-P&&(T=T.mixedAdd(l.points[M].neg()));I=I.add(T)}return I.toP()},v.prototype._wnafMul=function(h,m){var l=4,w=h._getNAFPoints(l);l=w.wnd;for(var p=w.points,y=s(m,l,this._bitLength),M=this.jpoint(null,null,null),E=y.length-1;E>=0;E--){for(var R=0;E>=0&&y[E]===0;E--)R++;if(E>=0&&R++,M=M.dblp(R),E<0)break;var I=y[E];n(I!==0),h.type==="affine"?I>0?M=M.mixedAdd(p[I-1>>1]):M=M.mixedAdd(p[-I-1>>1].neg()):I>0?M=M.add(p[I-1>>1]):M=M.add(p[-I-1>>1].neg())}return h.type==="affine"?M.toP():M},v.prototype._wnafMulAdd=function(h,m,l,w,p){var y=this._wnafT1,M=this._wnafT2,E=this._wnafT3,R=0,I,T,P;for(I=0;I<w;I++){P=m[I];var j=P._getNAFPoints(h);y[I]=j.wnd,M[I]=j.points}for(I=w-1;I>=1;I-=2){var L=I-1,U=I;if(y[L]!==1||y[U]!==1){E[L]=s(l[L],y[L],this._bitLength),E[U]=s(l[U],y[U],this._bitLength),R=Math.max(E[L].length,R),R=Math.max(E[U].length,R);continue}var Z=[m[L],null,null,m[U]];m[L].y.cmp(m[U].y)===0?(Z[1]=m[L].add(m[U]),Z[2]=m[L].toJ().mixedAdd(m[U].neg())):m[L].y.cmp(m[U].y.redNeg())===0?(Z[1]=m[L].toJ().mixedAdd(m[U]),Z[2]=m[L].add(m[U].neg())):(Z[1]=m[L].toJ().mixedAdd(m[U]),Z[2]=m[L].toJ().mixedAdd(m[U].neg()));var ne=[-3,-1,-5,-7,0,7,5,1,3],F=f(l[L],l[U]);for(R=Math.max(F[0].length,R),E[L]=Array(R),E[U]=Array(R),T=0;T<R;T++){var Y=F[0][T]|0,a=F[1][T]|0;E[L][T]=ne[(Y+1)*3+(a+1)],E[U][T]=0,M[L]=Z}}var g=this.jpoint(null,null,null),u=this._wnafT4;for(I=R;I>=0;I--){for(var d=0;I>=0;){var x=!0;for(T=0;T<w;T++)u[T]=E[T][I]|0,u[T]!==0&&(x=!1);if(!x)break;d++,I--}if(I>=0&&d++,g=g.dblp(d),I<0)break;for(T=0;T<w;T++){var A=u[T];A!==0&&(A>0?P=M[T][A-1>>1]:A<0&&(P=M[T][-A-1>>1].neg()),P.type==="affine"?g=g.mixedAdd(P):g=g.add(P))}}for(I=0;I<w;I++)M[I]=null;return p?g:g.toP()};function b(h,m){this.curve=h,this.type=m,this.precomputed=null}o(b,"_$"),v.BasePoint=b,b.prototype.eq=function(){throw Error("Not implemented")},b.prototype.validate=function(){return this.curve.validate(this)},v.prototype.decodePoint=function(h,m){h=i.toArray(h,m);var l=this.p.byteLength();if((h[0]===4||h[0]===6||h[0]===7)&&h.length-1===2*l){h[0]===6?n(h[h.length-1]%2===0):h[0]===7&&n(h[h.length-1]%2===1);var w=this.point(h.slice(1,1+l),h.slice(1+l,1+2*l));return w}else if((h[0]===2||h[0]===3)&&h.length-1===l)return this.pointFromX(h.slice(1,1+l),h[0]===3);throw Error("Unknown point format")},b.prototype.encodeCompressed=function(h){return this.encode(h,!0)},b.prototype._encode=function(h){var m=this.curve.p.byteLength(),l=this.getX().toArray("be",m);return h?[this.getY().isEven()?2:3].concat(l):[4].concat(l,this.getY().toArray("be",m))},b.prototype.encode=function(h,m){return i.encode(this._encode(m),h)},b.prototype.precompute=function(h){if(this.precomputed)return this;var m={doubles:null,naf:null,beta:null};return m.naf=this._getNAFPoints(8),m.doubles=this._getDoubles(4,h),m.beta=this._getBeta(),this.precomputed=m,this},b.prototype._hasDoubles=function(h){if(!this.precomputed)return!1;var m=this.precomputed.doubles;return m?m.points.length>=Math.ceil((h.bitLength()+1)/m.step):!1},b.prototype._getDoubles=function(h,m){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var l=[this],w=this,p=0;p<m;p+=h){for(var y=0;y<h;y++)w=w.dbl();l.push(w)}return{step:h,points:l}},b.prototype._getNAFPoints=function(h){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var m=[this],l=(1<<h)-1,w=l===1?null:this.dbl(),p=1;p<l;p++)m[p]=m[p-1].add(w);return{wnd:h,points:m}},b.prototype._getBeta=function(){return null},b.prototype.dblp=function(h){for(var m=this,l=0;l<h;l++)m=m.dbl();return m}}),X_=ye((t,e)=>{var r=Wr(),i=jr(),s=dr(),f=Zu(),n=r.assert;function v(m){f.call(this,"short",m),this.a=new i(m.a,16).toRed(this.red),this.b=new i(m.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(m),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}o(v,"P$"),s(v,f),e.exports=v,v.prototype._getEndomorphism=function(m){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var l,w;if(m.beta)l=new i(m.beta,16).toRed(this.red);else{var p=this._getEndoRoots(this.p);l=p[0].cmp(p[1])<0?p[0]:p[1],l=l.toRed(this.red)}if(m.lambda)w=new i(m.lambda,16);else{var y=this._getEndoRoots(this.n);this.g.mul(y[0]).x.cmp(this.g.x.redMul(l))===0?w=y[0]:(w=y[1],n(this.g.mul(w).x.cmp(this.g.x.redMul(l))===0))}var M;return m.basis?M=m.basis.map(function(E){return{a:new i(E.a,16),b:new i(E.b,16)}}):M=this._getEndoBasis(w),{beta:l,lambda:w,basis:M}}},v.prototype._getEndoRoots=function(m){var l=m===this.p?this.red:i.mont(m),w=new i(2).toRed(l).redInvm(),p=w.redNeg(),y=new i(3).toRed(l).redNeg().redSqrt().redMul(w),M=p.redAdd(y).fromRed(),E=p.redSub(y).fromRed();return[M,E]},v.prototype._getEndoBasis=function(m){for(var l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),w=m,p=this.n.clone(),y=new i(1),M=new i(0),E=new i(0),R=new i(1),I,T,P,j,L,U,Z,ne=0,F,Y;w.cmpn(0)!==0;){var a=p.div(w);F=p.sub(a.mul(w)),Y=E.sub(a.mul(y));var g=R.sub(a.mul(M));if(!P&&F.cmp(l)<0)I=Z.neg(),T=y,P=F.neg(),j=Y;else if(P&&++ne===2)break;Z=F,p=w,w=F,E=y,y=Y,R=M,M=g}L=F.neg(),U=Y;var u=P.sqr().add(j.sqr()),d=L.sqr().add(U.sqr());return d.cmp(u)>=0&&(L=I,U=T),P.negative&&(P=P.neg(),j=j.neg()),L.negative&&(L=L.neg(),U=U.neg()),[{a:P,b:j},{a:L,b:U}]},v.prototype._endoSplit=function(m){var l=this.endo.basis,w=l[0],p=l[1],y=p.b.mul(m).divRound(this.n),M=w.b.neg().mul(m).divRound(this.n),E=y.mul(w.a),R=M.mul(p.a),I=y.mul(w.b),T=M.mul(p.b),P=m.sub(E).sub(R),j=I.add(T).neg();return{k1:P,k2:j}},v.prototype.pointFromX=function(m,l){m=new i(m,16),!m.red&&(m=m.toRed(this.red));var w=m.redSqr().redMul(m).redIAdd(m.redMul(this.a)).redIAdd(this.b),p=w.redSqrt();if(p.redSqr().redSub(w).cmp(this.zero)!==0)throw Error("invalid point");var y=p.fromRed().isOdd();return(l&&!y||!l&&y)&&(p=p.redNeg()),this.point(m,p)},v.prototype.validate=function(m){if(m.inf)return!0;var{x:l,y:w}=m,p=this.a.redMul(l),y=l.redSqr().redMul(l).redIAdd(p).redIAdd(this.b);return w.redSqr().redISub(y).cmpn(0)===0},v.prototype._endoWnafMulAdd=function(m,l,w){for(var p=this._endoWnafT1,y=this._endoWnafT2,M=0;M<m.length;M++){var E=this._endoSplit(l[M]),R=m[M],I=R._getBeta();E.k1.negative&&(E.k1.ineg(),R=R.neg(!0)),E.k2.negative&&(E.k2.ineg(),I=I.neg(!0)),p[M*2]=R,p[M*2+1]=I,y[M*2]=E.k1,y[M*2+1]=E.k2}for(var T=this._wnafMulAdd(1,p,y,M*2,w),P=0;P<M*2;P++)p[P]=null,y[P]=null;return T};function b(m,l,w,p){f.BasePoint.call(this,m,"affine"),l===null&&w===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new i(l,16),this.y=new i(w,16),p&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}o(b,"uq"),s(b,f.BasePoint),v.prototype.point=function(m,l,w){return new b(this,m,l,w)},v.prototype.pointFromJSON=function(m,l){return b.fromJSON(this,m,l)},b.prototype._getBeta=function(){if(this.curve.endo){var m=this.precomputed;if(m&&m.beta)return m.beta;var l=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(m){var w=this.curve,p=o(function(y){return w.point(y.x.redMul(w.endo.beta),y.y)},"P");m.beta=l,l.precomputed={beta:null,naf:m.naf&&{wnd:m.naf.wnd,points:m.naf.points.map(p)},doubles:m.doubles&&{step:m.doubles.step,points:m.doubles.points.map(p)}}}return l}},b.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},b.fromJSON=function(m,l,w){typeof l=="string"&&(l=JSON.parse(l));var p=m.point(l[0],l[1],w);if(!l[2])return p;function y(E){return m.point(E[0],E[1],w)}o(y,"O");var M=l[2];return p.precomputed={beta:null,doubles:M.doubles&&{step:M.doubles.step,points:[p].concat(M.doubles.points.map(y))},naf:M.naf&&{wnd:M.naf.wnd,points:[p].concat(M.naf.points.map(y))}},p},b.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},b.prototype.isInfinity=function(){return this.inf},b.prototype.add=function(m){if(this.inf)return m;if(m.inf)return this;if(this.eq(m))return this.dbl();if(this.neg().eq(m))return this.curve.point(null,null);if(this.x.cmp(m.x)===0)return this.curve.point(null,null);var l=this.y.redSub(m.y);l.cmpn(0)!==0&&(l=l.redMul(this.x.redSub(m.x).redInvm()));var w=l.redSqr().redISub(this.x).redISub(m.x),p=l.redMul(this.x.redSub(w)).redISub(this.y);return this.curve.point(w,p)},b.prototype.dbl=function(){if(this.inf)return this;var m=this.y.redAdd(this.y);if(m.cmpn(0)===0)return this.curve.point(null,null);var l=this.curve.a,w=this.x.redSqr(),p=m.redInvm(),y=w.redAdd(w).redIAdd(w).redIAdd(l).redMul(p),M=y.redSqr().redISub(this.x.redAdd(this.x)),E=y.redMul(this.x.redSub(M)).redISub(this.y);return this.curve.point(M,E)},b.prototype.getX=function(){return this.x.fromRed()},b.prototype.getY=function(){return this.y.fromRed()},b.prototype.mul=function(m){return m=new i(m,16),this.isInfinity()?this:this._hasDoubles(m)?this.curve._fixedNafMul(this,m):this.curve.endo?this.curve._endoWnafMulAdd([this],[m]):this.curve._wnafMul(this,m)},b.prototype.mulAdd=function(m,l,w){var p=[this,l],y=[m,w];return this.curve.endo?this.curve._endoWnafMulAdd(p,y):this.curve._wnafMulAdd(1,p,y,2)},b.prototype.jmulAdd=function(m,l,w){var p=[this,l],y=[m,w];return this.curve.endo?this.curve._endoWnafMulAdd(p,y,!0):this.curve._wnafMulAdd(1,p,y,2,!0)},b.prototype.eq=function(m){return this===m||this.inf===m.inf&&(this.inf||this.x.cmp(m.x)===0&&this.y.cmp(m.y)===0)},b.prototype.neg=function(m){if(this.inf)return this;var l=this.curve.point(this.x,this.y.redNeg());if(m&&this.precomputed){var w=this.precomputed,p=o(function(y){return y.neg()},"P");l.precomputed={naf:w.naf&&{wnd:w.naf.wnd,points:w.naf.points.map(p)},doubles:w.doubles&&{step:w.doubles.step,points:w.doubles.points.map(p)}}}return l},b.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var m=this.curve.jpoint(this.x,this.y,this.curve.one);return m};function h(m,l,w,p){f.BasePoint.call(this,m,"jacobian"),l===null&&w===null&&p===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new i(0)):(this.x=new i(l,16),this.y=new i(w,16),this.z=new i(p,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(h,"tq"),s(h,f.BasePoint),v.prototype.jpoint=function(m,l,w){return new h(this,m,l,w)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var m=this.z.redInvm(),l=m.redSqr(),w=this.x.redMul(l),p=this.y.redMul(l).redMul(m);return this.curve.point(w,p)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(m){if(this.isInfinity())return m;if(m.isInfinity())return this;var l=m.z.redSqr(),w=this.z.redSqr(),p=this.x.redMul(l),y=m.x.redMul(w),M=this.y.redMul(l.redMul(m.z)),E=m.y.redMul(w.redMul(this.z)),R=p.redSub(y),I=M.redSub(E);if(R.cmpn(0)===0)return I.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var T=R.redSqr(),P=T.redMul(R),j=p.redMul(T),L=I.redSqr().redIAdd(P).redISub(j).redISub(j),U=I.redMul(j.redISub(L)).redISub(M.redMul(P)),Z=this.z.redMul(m.z).redMul(R);return this.curve.jpoint(L,U,Z)},h.prototype.mixedAdd=function(m){if(this.isInfinity())return m.toJ();if(m.isInfinity())return this;var l=this.z.redSqr(),w=this.x,p=m.x.redMul(l),y=this.y,M=m.y.redMul(l).redMul(this.z),E=w.redSub(p),R=y.redSub(M);if(E.cmpn(0)===0)return R.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var I=E.redSqr(),T=I.redMul(E),P=w.redMul(I),j=R.redSqr().redIAdd(T).redISub(P).redISub(P),L=R.redMul(P.redISub(j)).redISub(y.redMul(T)),U=this.z.redMul(E);return this.curve.jpoint(j,L,U)},h.prototype.dblp=function(m){if(m===0)return this;if(this.isInfinity())return this;if(!m)return this.dbl();var l;if(this.curve.zeroA||this.curve.threeA){var w=this;for(l=0;l<m;l++)w=w.dbl();return w}var p=this.curve.a,y=this.curve.tinv,M=this.x,E=this.y,R=this.z,I=R.redSqr().redSqr(),T=E.redAdd(E);for(l=0;l<m;l++){var P=M.redSqr(),j=T.redSqr(),L=j.redSqr(),U=P.redAdd(P).redIAdd(P).redIAdd(p.redMul(I)),Z=M.redMul(j),ne=U.redSqr().redISub(Z.redAdd(Z)),F=Z.redISub(ne),Y=U.redMul(F);Y=Y.redIAdd(Y).redISub(L);var a=T.redMul(R);l+1<m&&(I=I.redMul(L)),M=ne,R=a,T=Y}return this.curve.jpoint(M,T.redMul(y),R)},h.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},h.prototype._zeroDbl=function(){var m,l,w;if(this.zOne){var p=this.x.redSqr(),y=this.y.redSqr(),M=y.redSqr(),E=this.x.redAdd(y).redSqr().redISub(p).redISub(M);E=E.redIAdd(E);var R=p.redAdd(p).redIAdd(p),I=R.redSqr().redISub(E).redISub(E),T=M.redIAdd(M);T=T.redIAdd(T),T=T.redIAdd(T),m=I,l=R.redMul(E.redISub(I)).redISub(T),w=this.y.redAdd(this.y)}else{var P=this.x.redSqr(),j=this.y.redSqr(),L=j.redSqr(),U=this.x.redAdd(j).redSqr().redISub(P).redISub(L);U=U.redIAdd(U);var Z=P.redAdd(P).redIAdd(P),ne=Z.redSqr(),F=L.redIAdd(L);F=F.redIAdd(F),F=F.redIAdd(F),m=ne.redISub(U).redISub(U),l=Z.redMul(U.redISub(m)).redISub(F),w=this.y.redMul(this.z),w=w.redIAdd(w)}return this.curve.jpoint(m,l,w)},h.prototype._threeDbl=function(){var m,l,w;if(this.zOne){var p=this.x.redSqr(),y=this.y.redSqr(),M=y.redSqr(),E=this.x.redAdd(y).redSqr().redISub(p).redISub(M);E=E.redIAdd(E);var R=p.redAdd(p).redIAdd(p).redIAdd(this.curve.a),I=R.redSqr().redISub(E).redISub(E);m=I;var T=M.redIAdd(M);T=T.redIAdd(T),T=T.redIAdd(T),l=R.redMul(E.redISub(I)).redISub(T),w=this.y.redAdd(this.y)}else{var P=this.z.redSqr(),j=this.y.redSqr(),L=this.x.redMul(j),U=this.x.redSub(P).redMul(this.x.redAdd(P));U=U.redAdd(U).redIAdd(U);var Z=L.redIAdd(L);Z=Z.redIAdd(Z);var ne=Z.redAdd(Z);m=U.redSqr().redISub(ne),w=this.y.redAdd(this.z).redSqr().redISub(j).redISub(P);var F=j.redSqr();F=F.redIAdd(F),F=F.redIAdd(F),F=F.redIAdd(F),l=U.redMul(Z.redISub(m)).redISub(F)}return this.curve.jpoint(m,l,w)},h.prototype._dbl=function(){var m=this.curve.a,l=this.x,w=this.y,p=this.z,y=p.redSqr().redSqr(),M=l.redSqr(),E=w.redSqr(),R=M.redAdd(M).redIAdd(M).redIAdd(m.redMul(y)),I=l.redAdd(l);I=I.redIAdd(I);var T=I.redMul(E),P=R.redSqr().redISub(T.redAdd(T)),j=T.redISub(P),L=E.redSqr();L=L.redIAdd(L),L=L.redIAdd(L),L=L.redIAdd(L);var U=R.redMul(j).redISub(L),Z=w.redAdd(w).redMul(p);return this.curve.jpoint(P,U,Z)},h.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var m=this.x.redSqr(),l=this.y.redSqr(),w=this.z.redSqr(),p=l.redSqr(),y=m.redAdd(m).redIAdd(m),M=y.redSqr(),E=this.x.redAdd(l).redSqr().redISub(m).redISub(p);E=E.redIAdd(E),E=E.redAdd(E).redIAdd(E),E=E.redISub(M);var R=E.redSqr(),I=p.redIAdd(p);I=I.redIAdd(I),I=I.redIAdd(I),I=I.redIAdd(I);var T=y.redIAdd(E).redSqr().redISub(M).redISub(R).redISub(I),P=l.redMul(T);P=P.redIAdd(P),P=P.redIAdd(P);var j=this.x.redMul(R).redISub(P);j=j.redIAdd(j),j=j.redIAdd(j);var L=this.y.redMul(T.redMul(I.redISub(T)).redISub(E.redMul(R)));L=L.redIAdd(L),L=L.redIAdd(L),L=L.redIAdd(L);var U=this.z.redAdd(E).redSqr().redISub(w).redISub(R);return this.curve.jpoint(j,L,U)},h.prototype.mul=function(m,l){return m=new i(m,l),this.curve._wnafMul(this,m)},h.prototype.eq=function(m){if(m.type==="affine")return this.eq(m.toJ());if(this===m)return!0;var l=this.z.redSqr(),w=m.z.redSqr();if(this.x.redMul(w).redISub(m.x.redMul(l)).cmpn(0)!==0)return!1;var p=l.redMul(this.z),y=w.redMul(m.z);return this.y.redMul(y).redISub(m.y.redMul(p)).cmpn(0)===0},h.prototype.eqXToP=function(m){var l=this.z.redSqr(),w=m.toRed(this.curve.red).redMul(l);if(this.x.cmp(w)===0)return!0;for(var p=m.clone(),y=this.curve.redN.redMul(l);;){if(p.iadd(this.curve.n),p.cmp(this.curve.p)>=0)return!1;if(w.redIAdd(y),this.x.cmp(w)===0)return!0}},h.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},h.prototype.isInfinity=function(){return this.z.cmpn(0)===0}}),W_=ye((t,e)=>{var r=jr(),i=dr(),s=Zu(),f=Wr();function n(b){s.call(this,"mont",b),this.a=new r(b.a,16).toRed(this.red),this.b=new r(b.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}o(n,"j5"),i(n,s),e.exports=n,n.prototype.validate=function(b){var h=b.normalize().x,m=h.redSqr(),l=m.redMul(h).redAdd(m.redMul(this.a)).redAdd(h),w=l.redSqrt();return w.redSqr().cmp(l)===0};function v(b,h,m){s.BasePoint.call(this,b,"projective"),h===null&&m===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(h,16),this.z=new r(m,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(v,"mq"),i(v,s.BasePoint),n.prototype.decodePoint=function(b,h){return this.point(f.toArray(b,h),1)},n.prototype.point=function(b,h){return new v(this,b,h)},n.prototype.pointFromJSON=function(b){return v.fromJSON(this,b)},v.prototype.precompute=function(){},v.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},v.fromJSON=function(b,h){return new v(b,h[0],h[1]||b.one)},v.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},v.prototype.isInfinity=function(){return this.z.cmpn(0)===0},v.prototype.dbl=function(){var b=this.x.redAdd(this.z),h=b.redSqr(),m=this.x.redSub(this.z),l=m.redSqr(),w=h.redSub(l),p=h.redMul(l),y=w.redMul(l.redAdd(this.curve.a24.redMul(w)));return this.curve.point(p,y)},v.prototype.add=function(){throw Error("Not supported on Montgomery curve")},v.prototype.diffAdd=function(b,h){var m=this.x.redAdd(this.z),l=this.x.redSub(this.z),w=b.x.redAdd(b.z),p=b.x.redSub(b.z),y=p.redMul(m),M=w.redMul(l),E=h.z.redMul(y.redAdd(M).redSqr()),R=h.x.redMul(y.redISub(M).redSqr());return this.curve.point(E,R)},v.prototype.mul=function(b){for(var h=b.clone(),m=this,l=this.curve.point(null,null),w=this,p=[];h.cmpn(0)!==0;h.iushrn(1))p.push(h.andln(1));for(var y=p.length-1;y>=0;y--)p[y]===0?(m=m.diffAdd(l,w),l=l.dbl()):(l=m.diffAdd(l,w),m=m.dbl());return l},v.prototype.mulAdd=function(){throw Error("Not supported on Montgomery curve")},v.prototype.jumlAdd=function(){throw Error("Not supported on Montgomery curve")},v.prototype.eq=function(b){return this.getX().cmp(b.getX())===0},v.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},v.prototype.getX=function(){return this.normalize(),this.x.fromRed()}}),$_=ye((t,e)=>{var r=Wr(),i=jr(),s=dr(),f=Zu(),n=r.assert;function v(h){this.twisted=(h.a|0)!==1,this.mOneA=this.twisted&&(h.a|0)===-1,this.extended=this.mOneA,f.call(this,"edwards",h),this.a=new i(h.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new i(h.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new i(h.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),n(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(h.c|0)===1}o(v,"O1"),s(v,f),e.exports=v,v.prototype._mulA=function(h){return this.mOneA?h.redNeg():this.a.redMul(h)},v.prototype._mulC=function(h){return this.oneC?h:this.c.redMul(h)},v.prototype.jpoint=function(h,m,l,w){return this.point(h,m,l,w)},v.prototype.pointFromX=function(h,m){h=new i(h,16),!h.red&&(h=h.toRed(this.red));var l=h.redSqr(),w=this.c2.redSub(this.a.redMul(l)),p=this.one.redSub(this.c2.redMul(this.d).redMul(l)),y=w.redMul(p.redInvm()),M=y.redSqrt();if(M.redSqr().redSub(y).cmp(this.zero)!==0)throw Error("invalid point");var E=M.fromRed().isOdd();return(m&&!E||!m&&E)&&(M=M.redNeg()),this.point(h,M)},v.prototype.pointFromY=function(h,m){h=new i(h,16),!h.red&&(h=h.toRed(this.red));var l=h.redSqr(),w=l.redSub(this.c2),p=l.redMul(this.d).redMul(this.c2).redSub(this.a),y=w.redMul(p.redInvm());if(y.cmp(this.zero)===0){if(m)throw Error("invalid point");return this.point(this.zero,h)}var M=y.redSqrt();if(M.redSqr().redSub(y).cmp(this.zero)!==0)throw Error("invalid point");return M.fromRed().isOdd()!==m&&(M=M.redNeg()),this.point(M,h)},v.prototype.validate=function(h){if(h.isInfinity())return!0;h.normalize();var m=h.x.redSqr(),l=h.y.redSqr(),w=m.redMul(this.a).redAdd(l),p=this.c2.redMul(this.one.redAdd(this.d.redMul(m).redMul(l)));return w.cmp(p)===0};function b(h,m,l,w,p){f.BasePoint.call(this,h,"projective"),m===null&&l===null&&w===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new i(m,16),this.y=new i(l,16),this.z=w?new i(w,16):this.curve.one,this.t=p&&new i(p,16),!this.x.red&&(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),!this.zOne&&(this.t=this.t.redMul(this.z.redInvm()))))}o(b,"Oq"),s(b,f.BasePoint),v.prototype.pointFromJSON=function(h){return b.fromJSON(this,h)},v.prototype.point=function(h,m,l,w){return new b(this,h,m,l,w)},b.fromJSON=function(h,m){return new b(h,m[0],m[1],m[2])},b.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},b.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},b.prototype._extDbl=function(){var h=this.x.redSqr(),m=this.y.redSqr(),l=this.z.redSqr();l=l.redIAdd(l);var w=this.curve._mulA(h),p=this.x.redAdd(this.y).redSqr().redISub(h).redISub(m),y=w.redAdd(m),M=y.redSub(l),E=w.redSub(m),R=p.redMul(M),I=y.redMul(E),T=p.redMul(E),P=M.redMul(y);return this.curve.point(R,I,P,T)},b.prototype._projDbl=function(){var h=this.x.redAdd(this.y).redSqr(),m=this.x.redSqr(),l=this.y.redSqr(),w,p,y,M,E,R;if(this.curve.twisted){M=this.curve._mulA(m);var I=M.redAdd(l);this.zOne?(w=h.redSub(m).redSub(l).redMul(I.redSub(this.curve.two)),p=I.redMul(M.redSub(l)),y=I.redSqr().redSub(I).redSub(I)):(E=this.z.redSqr(),R=I.redSub(E).redISub(E),w=h.redSub(m).redISub(l).redMul(R),p=I.redMul(M.redSub(l)),y=I.redMul(R))}else M=m.redAdd(l),E=this.curve._mulC(this.z).redSqr(),R=M.redSub(E).redSub(E),w=this.curve._mulC(h.redISub(M)).redMul(R),p=this.curve._mulC(M).redMul(m.redISub(l)),y=M.redMul(R);return this.curve.point(w,p,y)},b.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},b.prototype._extAdd=function(h){var m=this.y.redSub(this.x).redMul(h.y.redSub(h.x)),l=this.y.redAdd(this.x).redMul(h.y.redAdd(h.x)),w=this.t.redMul(this.curve.dd).redMul(h.t),p=this.z.redMul(h.z.redAdd(h.z)),y=l.redSub(m),M=p.redSub(w),E=p.redAdd(w),R=l.redAdd(m),I=y.redMul(M),T=E.redMul(R),P=y.redMul(R),j=M.redMul(E);return this.curve.point(I,T,j,P)},b.prototype._projAdd=function(h){var m=this.z.redMul(h.z),l=m.redSqr(),w=this.x.redMul(h.x),p=this.y.redMul(h.y),y=this.curve.d.redMul(w).redMul(p),M=l.redSub(y),E=l.redAdd(y),R=this.x.redAdd(this.y).redMul(h.x.redAdd(h.y)).redISub(w).redISub(p),I=m.redMul(M).redMul(R),T,P;return this.curve.twisted?(T=m.redMul(E).redMul(p.redSub(this.curve._mulA(w))),P=M.redMul(E)):(T=m.redMul(E).redMul(p.redSub(w)),P=this.curve._mulC(M).redMul(E)),this.curve.point(I,T,P)},b.prototype.add=function(h){return this.isInfinity()?h:h.isInfinity()?this:this.curve.extended?this._extAdd(h):this._projAdd(h)},b.prototype.mul=function(h){return this._hasDoubles(h)?this.curve._fixedNafMul(this,h):this.curve._wnafMul(this,h)},b.prototype.mulAdd=function(h,m,l){return this.curve._wnafMulAdd(1,[this,m],[h,l],2,!1)},b.prototype.jmulAdd=function(h,m,l){return this.curve._wnafMulAdd(1,[this,m],[h,l],2,!0)},b.prototype.normalize=function(){if(this.zOne)return this;var h=this.z.redInvm();return this.x=this.x.redMul(h),this.y=this.y.redMul(h),this.t&&(this.t=this.t.redMul(h)),this.z=this.curve.one,this.zOne=!0,this},b.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},b.prototype.getX=function(){return this.normalize(),this.x.fromRed()},b.prototype.getY=function(){return this.normalize(),this.y.fromRed()},b.prototype.eq=function(h){return this===h||this.getX().cmp(h.getX())===0&&this.getY().cmp(h.getY())===0},b.prototype.eqXToP=function(h){var m=h.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(m)===0)return!0;for(var l=h.clone(),w=this.curve.redN.redMul(this.z);;){if(l.iadd(this.curve.n),l.cmp(this.curve.p)>=0)return!1;if(m.redIAdd(w),this.x.cmp(m)===0)return!0}},b.prototype.toP=b.prototype.normalize,b.prototype.mixedAdd=b.prototype.add}),H2=ye(t=>{var e=t;e.base=Zu(),e.short=X_(),e.mont=W_(),e.edwards=$_()}),Ti=ye(t=>{var e=In(),r=dr();t.inherits=r;function i(g,u){return(g.charCodeAt(u)&64512)!==55296||u<0||u+1>=g.length?!1:(g.charCodeAt(u+1)&64512)===56320}o(i,"Pt");function s(g,u){if(Array.isArray(g))return g.slice();if(!g)return[];var d=[];if(typeof g=="string")if(u){if(u==="hex")for(g=g.replace(/[^a-z0-9]+/ig,""),g.length%2!==0&&(g="0"+g),A=0;A<g.length;A+=2)d.push(parseInt(g[A]+g[A+1],16))}else for(var x=0,A=0;A<g.length;A++){var N=g.charCodeAt(A);N<128?d[x++]=N:N<2048?(d[x++]=N>>6|192,d[x++]=N&63|128):i(g,A)?(N=65536+((N&1023)<<10)+(g.charCodeAt(++A)&1023),d[x++]=N>>18|240,d[x++]=N>>12&63|128,d[x++]=N>>6&63|128,d[x++]=N&63|128):(d[x++]=N>>12|224,d[x++]=N>>6&63|128,d[x++]=N&63|128)}else for(A=0;A<g.length;A++)d[A]=g[A]|0;return d}o(s,"Yt"),t.toArray=s;function f(g){for(var u="",d=0;d<g.length;d++)u+=b(g[d].toString(16));return u}o(f,"Ot"),t.toHex=f;function n(g){var u=g>>>24|g>>>8&65280|g<<8&16711680|(g&255)<<24;return u>>>0}o(n,"kC"),t.htonl=n;function v(g,u){for(var d="",x=0;x<g.length;x++){var A=g[x];u==="little"&&(A=n(A)),d+=h(A.toString(16))}return d}o(v,"jt"),t.toHex32=v;function b(g){return g.length===1?"0"+g:g}o(b,"ZC"),t.zero2=b;function h(g){return g.length===7?"0"+g:g.length===6?"00"+g:g.length===5?"000"+g:g.length===4?"0000"+g:g.length===3?"00000"+g:g.length===2?"000000"+g:g.length===1?"0000000"+g:g}o(h,"VC"),t.zero8=h;function m(g,u,d,x){var A=d-u;e(A%4===0);for(var N=Array(A/4),S=0,c=u;S<N.length;S++,c+=4){var _;x==="big"?_=g[c]<<24|g[c+1]<<16|g[c+2]<<8|g[c+3]:_=g[c+3]<<24|g[c+2]<<16|g[c+1]<<8|g[c],N[S]=_>>>0}return N}o(m,"Wt"),t.join32=m;function l(g,u){for(var d=Array(g.length*4),x=0,A=0;x<g.length;x++,A+=4){var N=g[x];u==="big"?(d[A]=N>>>24,d[A+1]=N>>>16&255,d[A+2]=N>>>8&255,d[A+3]=N&255):(d[A+3]=N>>>24,d[A+2]=N>>>16&255,d[A+1]=N>>>8&255,d[A]=N&255)}return d}o(l,"Ht"),t.split32=l;function w(g,u){return g>>>u|g<<32-u}o(w,"Jt"),t.rotr32=w;function p(g,u){return g<<u|g>>>32-u}o(p,"zt"),t.rotl32=p;function y(g,u){return g+u>>>0}o(y,"ft"),t.sum32=y;function M(g,u,d){return g+u+d>>>0}o(M,"vt"),t.sum32_3=M;function E(g,u,d,x){return g+u+d+x>>>0}o(E,"Tt"),t.sum32_4=E;function R(g,u,d,x,A){return g+u+d+x+A>>>0}o(R,"Xt"),t.sum32_5=R;function I(g,u,d,x){var A=g[u],N=g[u+1],S=x+N>>>0,c=(S<x?1:0)+d+A;g[u]=c>>>0,g[u+1]=S}o(I,"At"),t.sum64=I;function T(g,u,d,x){var A=u+x>>>0,N=(A<u?1:0)+g+d;return N>>>0}o(T,"wt"),t.sum64_hi=T;function P(g,u,d,x){var A=u+x;return A>>>0}o(P,"Gt"),t.sum64_lo=P;function j(g,u,d,x,A,N,S,c){var _=0,C=u;C=C+x>>>0,_+=C<u?1:0,C=C+N>>>0,_+=C<N?1:0,C=C+c>>>0,_+=C<c?1:0;var O=g+d+A+S+_;return O>>>0}o(j,"kt"),t.sum64_4_hi=j;function L(g,u,d,x,A,N,S,c){var _=u+x+N+c;return _>>>0}o(L,"Zt"),t.sum64_4_lo=L;function U(g,u,d,x,A,N,S,c,_,C){var O=0,D=u;D=D+x>>>0,O+=D<u?1:0,D=D+N>>>0,O+=D<N?1:0,D=D+c>>>0,O+=D<c?1:0,D=D+C>>>0,O+=D<C?1:0;var B=g+d+A+S+_+O;return B>>>0}o(U,"Vt"),t.sum64_5_hi=U;function Z(g,u,d,x,A,N,S,c,_,C){var O=u+x+N+c+C;return O>>>0}o(Z,"Mt"),t.sum64_5_lo=Z;function ne(g,u,d){var x=u<<32-d|g>>>d;return x>>>0}o(ne,"St"),t.rotr64_hi=ne;function F(g,u,d){var x=g<<32-d|u>>>d;return x>>>0}o(F,"Ct"),t.rotr64_lo=F;function Y(g,u,d){return g>>>d}o(Y,"Et"),t.shr64_hi=Y;function a(g,u,d){var x=g<<32-d|u>>>d;return x>>>0}o(a,"Nt"),t.shr64_lo=a}),Fo=ye(t=>{var e=Ti(),r=In();function i(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}o(i,"EY"),t.BlockHash=i,i.prototype.update=function(s,f){if(s=e.toArray(s,f),this.pending?this.pending=this.pending.concat(s):this.pending=s,this.pendingTotal+=s.length,this.pending.length>=this._delta8){s=this.pending;var n=s.length%this._delta8;this.pending=s.slice(s.length-n,s.length),this.pending.length===0&&(this.pending=null),s=e.join32(s,0,s.length-n,this.endian);for(var v=0;v<s.length;v+=this._delta32)this._update(s,v,v+this._delta32)}return this},i.prototype.digest=function(s){return this.update(this._pad()),r(this.pending===null),this._digest(s)},i.prototype._pad=function(){var s=this.pendingTotal,f=this._delta8,n=f-(s+this.padLength)%f,v=Array(n+this.padLength);v[0]=128;for(var b=1;b<n;b++)v[b]=0;if(s<<=3,this.endian==="big"){for(var h=8;h<this.padLength;h++)v[b++]=0;v[b++]=0,v[b++]=0,v[b++]=0,v[b++]=0,v[b++]=s>>>24&255,v[b++]=s>>>16&255,v[b++]=s>>>8&255,v[b++]=s&255}else for(v[b++]=s&255,v[b++]=s>>>8&255,v[b++]=s>>>16&255,v[b++]=s>>>24&255,v[b++]=0,v[b++]=0,v[b++]=0,v[b++]=0,h=8;h<this.padLength;h++)v[b++]=0;return v}}),V2=ye(t=>{var e=Ti(),r=e.rotr32;function i(l,w,p,y){if(l===0)return s(w,p,y);if(l===1||l===3)return n(w,p,y);if(l===2)return f(w,p,y)}o(i,"Pa"),t.ft_1=i;function s(l,w,p){return l&w^~l&p}o(s,"SC"),t.ch32=s;function f(l,w,p){return l&w^l&p^w&p}o(f,"CC"),t.maj32=f;function n(l,w,p){return l^w^p}o(n,"EC"),t.p32=n;function v(l){return r(l,2)^r(l,13)^r(l,22)}o(v,"Ya"),t.s0_256=v;function b(l){return r(l,6)^r(l,11)^r(l,25)}o(b,"Oa"),t.s1_256=b;function h(l){return r(l,7)^r(l,18)^l>>>3}o(h,"ja"),t.g0_256=h;function m(l){return r(l,17)^r(l,19)^l>>>10}o(m,"Wa"),t.g1_256=m}),J_=ye((t,e)=>{var r=Ti(),i=Fo(),s=V2(),f=r.rotl32,n=r.sum32,v=r.sum32_5,b=s.ft_1,h=i.BlockHash,m=[1518500249,1859775393,2400959708,3395469782];function l(){if(!(this instanceof l))return new l;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}o(l,"W1"),r.inherits(l,h),e.exports=l,l.blockSize=512,l.outSize=160,l.hmacStrength=80,l.padLength=64,l.prototype._update=function(w,p){for(var y=this.W,M=0;M<16;M++)y[M]=w[p+M];for(;M<y.length;M++)y[M]=f(y[M-3]^y[M-8]^y[M-14]^y[M-16],1);var E=this.h[0],R=this.h[1],I=this.h[2],T=this.h[3],P=this.h[4];for(M=0;M<y.length;M++){var j=~~(M/20),L=v(f(E,5),b(j,R,I,T),P,y[M],m[j]);P=T,T=I,I=f(R,30),R=E,E=L}this.h[0]=n(this.h[0],E),this.h[1]=n(this.h[1],R),this.h[2]=n(this.h[2],I),this.h[3]=n(this.h[3],T),this.h[4]=n(this.h[4],P)},l.prototype._digest=function(w){return w==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")}}),Z2=ye((t,e)=>{var r=Ti(),i=Fo(),s=V2(),f=In(),n=r.sum32,v=r.sum32_4,b=r.sum32_5,h=s.ch32,m=s.maj32,l=s.s0_256,w=s.s1_256,p=s.g0_256,y=s.g1_256,M=i.BlockHash,E=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function R(){if(!(this instanceof R))return new R;M.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=E,this.W=Array(64)}o(R,"H1"),r.inherits(R,M),e.exports=R,R.blockSize=512,R.outSize=256,R.hmacStrength=192,R.padLength=64,R.prototype._update=function(I,T){for(var P=this.W,j=0;j<16;j++)P[j]=I[T+j];for(;j<P.length;j++)P[j]=v(y(P[j-2]),P[j-7],p(P[j-15]),P[j-16]);var L=this.h[0],U=this.h[1],Z=this.h[2],ne=this.h[3],F=this.h[4],Y=this.h[5],a=this.h[6],g=this.h[7];for(f(this.k.length===P.length),j=0;j<P.length;j++){var u=b(g,w(F),h(F,Y,a),this.k[j],P[j]),d=n(l(L),m(L,U,Z));g=a,a=Y,Y=F,F=n(ne,u),ne=Z,Z=U,U=L,L=n(u,d)}this.h[0]=n(this.h[0],L),this.h[1]=n(this.h[1],U),this.h[2]=n(this.h[2],Z),this.h[3]=n(this.h[3],ne),this.h[4]=n(this.h[4],F),this.h[5]=n(this.h[5],Y),this.h[6]=n(this.h[6],a),this.h[7]=n(this.h[7],g)},R.prototype._digest=function(I){return I==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")}}),q_=ye((t,e)=>{var r=Ti(),i=Z2();function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}o(s,"n1"),r.inherits(s,i),e.exports=s,s.blockSize=512,s.outSize=224,s.hmacStrength=192,s.padLength=64,s.prototype._digest=function(f){return f==="hex"?r.toHex32(this.h.slice(0,7),"big"):r.split32(this.h.slice(0,7),"big")}}),G2=ye((t,e)=>{var r=Ti(),i=Fo(),s=In(),f=r.rotr64_hi,n=r.rotr64_lo,v=r.shr64_hi,b=r.shr64_lo,h=r.sum64,m=r.sum64_hi,l=r.sum64_lo,w=r.sum64_4_hi,p=r.sum64_4_lo,y=r.sum64_5_hi,M=r.sum64_5_lo,E=i.BlockHash,R=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function I(){if(!(this instanceof I))return new I;E.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=R,this.W=Array(160)}o(I,"D$"),r.inherits(I,E),e.exports=I,I.blockSize=1024,I.outSize=512,I.hmacStrength=192,I.padLength=128,I.prototype._prepareBlock=function(d,x){for(var A=this.W,N=0;N<32;N++)A[N]=d[x+N];for(;N<A.length;N+=2){var S=g(A[N-4],A[N-3]),c=u(A[N-4],A[N-3]),_=A[N-14],C=A[N-13],O=Y(A[N-30],A[N-29]),D=a(A[N-30],A[N-29]),B=A[N-32],z=A[N-31];A[N]=w(S,c,_,C,O,D,B,z),A[N+1]=p(S,c,_,C,O,D,B,z)}},I.prototype._update=function(d,x){this._prepareBlock(d,x);var A=this.W,N=this.h[0],S=this.h[1],c=this.h[2],_=this.h[3],C=this.h[4],O=this.h[5],D=this.h[6],B=this.h[7],z=this.h[8],G=this.h[9],te=this.h[10],$=this.h[11],q=this.h[12],Ce=this.h[13],fe=this.h[14],ae=this.h[15];s(this.k.length===A.length);for(var be=0;be<A.length;be+=2){var H=fe,ee=ae,Q=ne(z,G),X=F(z,G),se=T(z,G,te,$,q),Ne=P(z,G,te,$,q,Ce),we=this.k[be],ue=this.k[be+1],K=A[be],W=A[be+1],J=y(H,ee,Q,X,se,Ne,we,ue,K,W),pe=M(H,ee,Q,X,se,Ne,we,ue,K,W);H=U(N,S),ee=Z(N,S),Q=j(N,S,c,_,C),X=L(N,S,c,_,C,O);var le=m(H,ee,Q,X),oe=l(H,ee,Q,X);fe=q,ae=Ce,q=te,Ce=$,te=z,$=G,z=m(D,B,J,pe),G=l(B,B,J,pe),D=C,B=O,C=c,O=_,c=N,_=S,N=m(J,pe,le,oe),S=l(J,pe,le,oe)}h(this.h,0,N,S),h(this.h,2,c,_),h(this.h,4,C,O),h(this.h,6,D,B),h(this.h,8,z,G),h(this.h,10,te,$),h(this.h,12,q,Ce),h(this.h,14,fe,ae)},I.prototype._digest=function(d){return d==="hex"?r.toHex32(this.h,"big"):r.split32(this.h,"big")};function T(d,x,A,N,S){var c=d&A^~d&S;return c<0&&(c+=4294967296),c}o(T,"la");function P(d,x,A,N,S,c){var _=x&N^~x&c;return _<0&&(_+=4294967296),_}o(P,"Ba");function j(d,x,A,N,S){var c=d&A^d&S^A&S;return c<0&&(c+=4294967296),c}o(j,"oa");function L(d,x,A,N,S,c){var _=x&N^x&c^N&c;return _<0&&(_+=4294967296),_}o(L,"na");function U(d,x){var A=f(d,x,28),N=f(x,d,2),S=f(x,d,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(U,"Ua");function Z(d,x){var A=n(d,x,28),N=n(x,d,2),S=n(x,d,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(Z,"ra");function ne(d,x){var A=f(d,x,14),N=f(d,x,18),S=f(x,d,9),c=A^N^S;return c<0&&(c+=4294967296),c}o(ne,"Fa");function F(d,x){var A=n(d,x,14),N=n(d,x,18),S=n(x,d,9),c=A^N^S;return c<0&&(c+=4294967296),c}o(F,"Qa");function Y(d,x){var A=f(d,x,1),N=f(d,x,8),S=v(d,x,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(Y,"ia");function a(d,x){var A=n(d,x,1),N=n(d,x,8),S=b(d,x,7),c=A^N^S;return c<0&&(c+=4294967296),c}o(a,"ta");function g(d,x){var A=f(d,x,19),N=f(x,d,29),S=v(d,x,6),c=A^N^S;return c<0&&(c+=4294967296),c}o(g,"aa");function u(d,x){var A=n(d,x,19),N=n(x,d,29),S=b(d,x,6),c=A^N^S;return c<0&&(c+=4294967296),c}o(u,"ea")}),e9=ye((t,e)=>{var r=Ti(),i=G2();function s(){if(!(this instanceof s))return new s;i.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}o(s,"U1"),r.inherits(s,i),e.exports=s,s.blockSize=1024,s.outSize=384,s.hmacStrength=192,s.padLength=128,s.prototype._digest=function(f){return f==="hex"?r.toHex32(this.h.slice(0,12),"big"):r.split32(this.h.slice(0,12),"big")}}),t9=ye(t=>{t.sha1=J_(),t.sha224=q_(),t.sha256=Z2(),t.sha384=e9(),t.sha512=G2()}),r9=ye(t=>{var e=Ti(),r=Fo(),i=e.rotl32,s=e.sum32,f=e.sum32_3,n=e.sum32_4,v=r.BlockHash;function b(){if(!(this instanceof b))return new b;v.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}o(b,"f1"),e.inherits(b,v),t.ripemd160=b,b.blockSize=512,b.outSize=160,b.hmacStrength=192,b.padLength=64,b.prototype._update=function(E,R){for(var I=this.h[0],T=this.h[1],P=this.h[2],j=this.h[3],L=this.h[4],U=I,Z=T,ne=P,F=j,Y=L,a=0;a<80;a++){var g=s(i(n(I,h(a,T,P,j),E[w[a]+R],m(a)),y[a]),L);I=L,L=j,j=i(P,10),P=T,T=g,g=s(i(n(U,h(79-a,Z,ne,F),E[p[a]+R],l(a)),M[a]),Y),U=Y,Y=F,F=i(ne,10),ne=Z,Z=g}g=f(this.h[1],P,F),this.h[1]=f(this.h[2],j,Y),this.h[2]=f(this.h[3],L,U),this.h[3]=f(this.h[4],I,Z),this.h[4]=f(this.h[0],T,ne),this.h[0]=g},b.prototype._digest=function(E){return E==="hex"?e.toHex32(this.h,"little"):e.split32(this.h,"little")};function h(E,R,I,T){return E<=15?R^I^T:E<=31?R&I|~R&T:E<=47?(R|~I)^T:E<=63?R&T|I&~T:R^(I|~T)}o(h,"nC");function m(E){return E<=15?0:E<=31?1518500249:E<=47?1859775393:E<=63?2400959708:2840853838}o(m,"Oe");function l(E){return E<=15?1352829926:E<=31?1548603684:E<=47?1836072691:E<=63?2053994217:0}o(l,"je");var w=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],y=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],M=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]}),i9=ye((t,e)=>{var r=Ti(),i=In();function s(f,n,v){if(!(this instanceof s))return new s(f,n,v);this.Hash=f,this.blockSize=f.blockSize/8,this.outSize=f.outSize/8,this.inner=null,this.outer=null,this._init(r.toArray(n,v))}o(s,"f5"),e.exports=s,s.prototype._init=function(f){f.length>this.blockSize&&(f=new this.Hash().update(f).digest()),i(f.length<=this.blockSize);for(var n=f.length;n<this.blockSize;n++)f.push(0);for(n=0;n<f.length;n++)f[n]^=54;for(this.inner=new this.Hash().update(f),n=0;n<f.length;n++)f[n]^=106;this.outer=new this.Hash().update(f)},s.prototype.update=function(f,n){return this.inner.update(f,n),this},s.prototype.digest=function(f){return this.outer.update(this.inner.digest()),this.outer.digest(f)}}),qh=ye(t=>{var e=t;e.utils=Ti(),e.common=Fo(),e.sha=t9(),e.ripemd=r9(),e.hmac=i9(),e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}),n9=ye((t,e)=>{e.exports={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}}),ep=ye(t=>{var e=t,r=qh(),i=H2(),s=Wr(),f=s.assert;function n(h){h.type==="short"?this.curve=new i.short(h):h.type==="edwards"?this.curve=new i.edwards(h):this.curve=new i.mont(h),this.g=this.curve.g,this.n=this.curve.n,this.hash=h.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}o(n,"sC"),e.PresetCurve=n;function v(h,m){Object.defineProperty(e,h,{configurable:!0,enumerable:!0,get:o(function(){var l=new n(m);return Object.defineProperty(e,h,{configurable:!0,enumerable:!0,value:l}),l},"get")})}o(v,"R7"),v("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),v("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),v("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),v("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),v("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),v("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),v("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var b;try{b=n9()}catch{b=void 0}v("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",b]})}),s9=ye((t,e)=>{var r=qh(),i=F2(),s=In();function f(n){if(!(this instanceof f))return new f(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var v=i.toArray(n.entropy,n.entropyEnc||"hex"),b=i.toArray(n.nonce,n.nonceEnc||"hex"),h=i.toArray(n.pers,n.persEnc||"hex");s(v.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(v,b,h)}o(f,"D7"),e.exports=f,f.prototype._init=function(n,v,b){var h=n.concat(v).concat(b);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var m=0;m<this.V.length;m++)this.K[m]=0,this.V[m]=1;this._update(h),this._reseed=1,this.reseedInterval=281474976710656},f.prototype._hmac=function(){return new r.hmac(this.hash,this.K)},f.prototype._update=function(n){var v=this._hmac().update(this.V).update([0]);n&&(v=v.update(n)),this.K=v.digest(),this.V=this._hmac().update(this.V).digest(),n&&(this.K=this._hmac().update(this.V).update([1]).update(n).digest(),this.V=this._hmac().update(this.V).digest())},f.prototype.reseed=function(n,v,b,h){typeof v!="string"&&(h=b,b=v,v=null),n=i.toArray(n,v),b=i.toArray(b,h),s(n.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(n.concat(b||[])),this._reseed=1},f.prototype.generate=function(n,v,b,h){if(this._reseed>this.reseedInterval)throw Error("Reseed is required");typeof v!="string"&&(h=b,b=v,v=null),b&&(b=i.toArray(b,h||"hex"),this._update(b));for(var m=[];m.length<n;)this.V=this._hmac().update(this.V).digest(),m=m.concat(this.V);var l=m.slice(0,n);return this._update(b),this._reseed++,i.encode(l,v)}}),a9=ye((t,e)=>{var r=jr(),i=Wr(),s=i.assert;function f(n,v){this.ec=n,this.priv=null,this.pub=null,v.priv&&this._importPrivate(v.priv,v.privEnc),v.pub&&this._importPublic(v.pub,v.pubEnc)}o(f,"j4"),e.exports=f,f.fromPublic=function(n,v,b){return v instanceof f?v:new f(n,{pub:v,pubEnc:b})},f.fromPrivate=function(n,v,b){return v instanceof f?v:new f(n,{priv:v,privEnc:b})},f.prototype.validate=function(){var n=this.getPublic();return n.isInfinity()?{result:!1,reason:"Invalid public key"}:n.validate()?n.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},f.prototype.getPublic=function(n,v){return typeof n=="string"&&(v=n,n=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),v?this.pub.encode(v,n):this.pub},f.prototype.getPrivate=function(n){return n==="hex"?this.priv.toString(16,2):this.priv},f.prototype._importPrivate=function(n,v){this.priv=new r(n,v||16),this.priv=this.priv.umod(this.ec.curve.n)},f.prototype._importPublic=function(n,v){if(n.x||n.y){this.ec.curve.type==="mont"?s(n.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&s(n.x&&n.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(n.x,n.y);return}this.pub=this.ec.curve.decodePoint(n,v)},f.prototype.derive=function(n){return n.validate()||s(n.validate(),"public point not validated"),n.mul(this.priv).getX()},f.prototype.sign=function(n,v,b){return this.ec.sign(n,this,v,b)},f.prototype.verify=function(n,v,b){return this.ec.verify(n,v,this,void 0,b)},f.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"}}),o9=ye((t,e)=>{var r=jr(),i=Wr(),s=i.assert;function f(m,l){if(m instanceof f)return m;this._importDER(m,l)||(s(m.r&&m.s,"Signature without r or s"),this.r=new r(m.r,16),this.s=new r(m.s,16),m.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=m.recoveryParam)}o(f,"hY"),e.exports=f;function n(){this.place=0}o(n,"Ve");function v(m,l){var w=m[l.place++];if(!(w&128))return w;var p=w&15;if(p===0||p>4||m[l.place]===0)return!1;for(var y=0,M=0,E=l.place;M<p;M++,E++)y<<=8,y|=m[E],y>>>=0;return y<=127?!1:(l.place=E,y)}o(v,"oJ");function b(m){for(var l=0,w=m.length-1;!m[l]&&!(m[l+1]&128)&&l<w;)l++;return l===0?m:m.slice(l)}o(b,"OE"),f.prototype._importDER=function(m,l){m=i.toArray(m,l);var w=new n;if(m[w.place++]!==48)return!1;var p=v(m,w);if(p===!1||p+w.place!==m.length||m[w.place++]!==2)return!1;var y=v(m,w);if(y===!1||(m[w.place]&128)!==0)return!1;var M=m.slice(w.place,y+w.place);if(w.place+=y,m[w.place++]!==2)return!1;var E=v(m,w);if(E===!1||m.length!==E+w.place||(m[w.place]&128)!==0)return!1;var R=m.slice(w.place,E+w.place);if(M[0]===0)if(M[1]&128)M=M.slice(1);else return!1;if(R[0]===0)if(R[1]&128)R=R.slice(1);else return!1;return this.r=new r(M),this.s=new r(R),this.recoveryParam=null,!0};function h(m,l){if(l<128){m.push(l);return}var w=1+(Math.log(l)/Math.LN2>>>3);for(m.push(w|128);--w;)m.push(l>>>(w<<3)&255);m.push(l)}o(h,"nJ"),f.prototype.toDER=function(m){var l=this.r.toArray(),w=this.s.toArray();for(l[0]&128&&(l=[0].concat(l)),w[0]&128&&(w=[0].concat(w)),l=b(l),w=b(w);!w[0]&&!(w[1]&128);)w=w.slice(1);var p=[2];h(p,l.length),p=p.concat(l),p.push(2),h(p,w.length);var y=p.concat(w),M=[48];return h(M,y.length),M=M.concat(y),i.encode(M,m)}}),l9=ye((t,e)=>{var r=jr(),i=s9(),s=Wr(),f=ep(),n=U2(),v=s.assert,b=a9(),h=o9();function m(l){if(!(this instanceof m))return new m(l);typeof l=="string"&&(v(Object.prototype.hasOwnProperty.call(f,l),"Unknown curve "+l),l=f[l]),l instanceof f.PresetCurve&&(l={curve:l}),this.curve=l.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=l.curve.g,this.g.precompute(l.curve.n.bitLength()+1),this.hash=l.hash||l.curve.hash}o(m,"Y$"),e.exports=m,m.prototype.keyPair=function(l){return new b(this,l)},m.prototype.keyFromPrivate=function(l,w){return b.fromPrivate(this,l,w)},m.prototype.keyFromPublic=function(l,w){return b.fromPublic(this,l,w)},m.prototype.genKeyPair=function(l){l||(l={});for(var w=new i({hash:this.hash,pers:l.pers,persEnc:l.persEnc||"utf8",entropy:l.entropy||n(this.hash.hmacStrength),entropyEnc:l.entropy&&l.entropyEnc||"utf8",nonce:this.n.toArray()}),p=this.n.byteLength(),y=this.n.sub(new r(2));;){var M=new r(w.generate(p));if(!(M.cmp(y)>0))return M.iaddn(1),this.keyFromPrivate(M)}},m.prototype._truncateToN=function(l,w,p){var y;if(r.isBN(l)||typeof l=="number")l=new r(l,16),y=l.byteLength();else if(typeof l=="object")y=l.length,l=new r(l,16);else{var M=l.toString();y=M.length+1>>>1,l=new r(M,16)}typeof p!="number"&&(p=y*8);var E=p-this.n.bitLength();return E>0&&(l=l.ushrn(E)),!w&&l.cmp(this.n)>=0?l.sub(this.n):l},m.prototype.sign=function(l,w,p,y){if(typeof p=="object"&&(y=p,p=null),y||(y={}),typeof l!="string"&&typeof l!="number"&&!r.isBN(l)){v(typeof l=="object"&&l&&typeof l.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),v(l.length>>>0===l.length);for(var M=0;M<l.length;M++)v((l[M]&255)===l[M])}w=this.keyFromPrivate(w,p),l=this._truncateToN(l,!1,y.msgBitLength),v(!l.isNeg(),"Can not sign a negative message");var E=this.n.byteLength(),R=w.getPrivate().toArray("be",E),I=l.toArray("be",E);v(new r(I).eq(l),"Can not sign message");for(var T=new i({hash:this.hash,entropy:R,nonce:I,pers:y.pers,persEnc:y.persEnc||"utf8"}),P=this.n.sub(new r(1)),j=0;;j++){var L=y.k?y.k(j):new r(T.generate(this.n.byteLength()));if(L=this._truncateToN(L,!0),!(L.cmpn(1)<=0||L.cmp(P)>=0)){var U=this.g.mul(L);if(!U.isInfinity()){var Z=U.getX(),ne=Z.umod(this.n);if(ne.cmpn(0)!==0){var F=L.invm(this.n).mul(ne.mul(w.getPrivate()).iadd(l));if(F=F.umod(this.n),F.cmpn(0)!==0){var Y=(U.getY().isOdd()?1:0)|(Z.cmp(ne)!==0?2:0);return y.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),Y^=1),new h({r:ne,s:F,recoveryParam:Y})}}}}}},m.prototype.verify=function(l,w,p,y,M){M||(M={}),l=this._truncateToN(l,!1,M.msgBitLength),p=this.keyFromPublic(p,y),w=new h(w,"hex");var{r:E,s:R}=w;if(E.cmpn(1)<0||E.cmp(this.n)>=0||R.cmpn(1)<0||R.cmp(this.n)>=0)return!1;var I=R.invm(this.n),T=I.mul(l).umod(this.n),P=I.mul(E).umod(this.n),j;return this.curve._maxwellTrick?(j=this.g.jmulAdd(T,p.getPublic(),P),j.isInfinity()?!1:j.eqXToP(E)):(j=this.g.mulAdd(T,p.getPublic(),P),j.isInfinity()?!1:j.getX().umod(this.n).cmp(E)===0)},m.prototype.recoverPubKey=function(l,w,p,y){v((3&p)===p,"The recovery param is more than two bits"),w=new h(w,y);var M=this.n,E=new r(l),R=w.r,I=w.s,T=p&1,P=p>>1;if(R.cmp(this.curve.p.umod(this.curve.n))>=0&&P)throw Error("Unable to find sencond key candinate");P?R=this.curve.pointFromX(R.add(this.curve.n),T):R=this.curve.pointFromX(R,T);var j=w.r.invm(M),L=M.sub(E).mul(j).umod(M),U=I.mul(j).umod(M);return this.g.mulAdd(L,R,U)},m.prototype.getKeyRecoveryParam=function(l,w,p,y){if(w=new h(w,y),w.recoveryParam!==null)return w.recoveryParam;for(var M=0;M<4;M++){var E;try{E=this.recoverPubKey(l,w,M)}catch{continue}if(E.eq(p))return M}throw Error("Unable to find valid recovery factor")}}),u9=ye((t,e)=>{var r=Wr(),i=r.assert,s=r.parseBytes,f=r.cachedProperty;function n(v,b){this.eddsa=v,this._secret=s(b.secret),v.isPoint(b.pub)?this._pub=b.pub:this._pubBytes=s(b.pub)}o(n,"dq"),n.fromPublic=function(v,b){return b instanceof n?b:new n(v,{pub:b})},n.fromSecret=function(v,b){return b instanceof n?b:new n(v,{secret:b})},n.prototype.secret=function(){return this._secret},f(n,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),f(n,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),f(n,"privBytes",function(){var v=this.eddsa,b=this.hash(),h=v.encodingLength-1,m=b.slice(0,v.encodingLength);return m[0]&=248,m[h]&=127,m[h]|=64,m}),f(n,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),f(n,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),f(n,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),n.prototype.sign=function(v){return i(this._secret,"KeyPair can only verify"),this.eddsa.sign(v,this)},n.prototype.verify=function(v,b){return this.eddsa.verify(v,b,this)},n.prototype.getSecret=function(v){return i(this._secret,"KeyPair is public only"),r.encode(this.secret(),v)},n.prototype.getPublic=function(v){return r.encode(this.pubBytes(),v)},e.exports=n}),c9=ye((t,e)=>{var r=jr(),i=Wr(),s=i.assert,f=i.cachedProperty,n=i.parseBytes;function v(b,h){this.eddsa=b,typeof h!="object"&&(h=n(h)),Array.isArray(h)&&(s(h.length===b.encodingLength*2,"Signature has invalid size"),h={R:h.slice(0,b.encodingLength),S:h.slice(b.encodingLength)}),s(h.R&&h.S,"Signature without R or S"),b.isPoint(h.R)&&(this._R=h.R),h.S instanceof r&&(this._S=h.S),this._Rencoded=Array.isArray(h.R)?h.R:h.Rencoded,this._Sencoded=Array.isArray(h.S)?h.S:h.Sencoded}o(v,"N9"),f(v,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),f(v,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),f(v,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),f(v,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),v.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},v.prototype.toHex=function(){return i.encode(this.toBytes(),"hex").toUpperCase()},e.exports=v}),f9=ye((t,e)=>{var r=qh(),i=ep(),s=Wr(),f=s.assert,n=s.parseBytes,v=u9(),b=c9();function h(m){if(f(m==="ed25519","only tested with ed25519 so far"),!(this instanceof h))return new h(m);m=i[m].curve,this.curve=m,this.g=m.g,this.g.precompute(m.n.bitLength()+1),this.pointClass=m.point().constructor,this.encodingLength=Math.ceil(m.n.bitLength()/8),this.hash=r.sha512}o(h,"y4"),e.exports=h,h.prototype.sign=function(m,l){m=n(m);var w=this.keyFromSecret(l),p=this.hashInt(w.messagePrefix(),m),y=this.g.mul(p),M=this.encodePoint(y),E=this.hashInt(M,w.pubBytes(),m).mul(w.priv()),R=p.add(E).umod(this.curve.n);return this.makeSignature({R:y,S:R,Rencoded:M})},h.prototype.verify=function(m,l,w){if(m=n(m),l=this.makeSignature(l),l.S().gte(l.eddsa.curve.n)||l.S().isNeg())return!1;var p=this.keyFromPublic(w),y=this.hashInt(l.Rencoded(),p.pubBytes(),m),M=this.g.mul(l.S()),E=l.R().add(p.pub().mul(y));return E.eq(M)},h.prototype.hashInt=function(){for(var m=this.hash(),l=0;l<arguments.length;l++)m.update(arguments[l]);return s.intFromLE(m.digest()).umod(this.curve.n)},h.prototype.keyFromPublic=function(m){return v.fromPublic(this,m)},h.prototype.keyFromSecret=function(m){return v.fromSecret(this,m)},h.prototype.makeSignature=function(m){return m instanceof b?m:new b(this,m)},h.prototype.encodePoint=function(m){var l=m.getY().toArray("le",this.encodingLength);return l[this.encodingLength-1]|=m.getX().isOdd()?128:0,l},h.prototype.decodePoint=function(m){m=s.parseBytes(m);var l=m.length-1,w=m.slice(0,l).concat(m[l]&-129),p=(m[l]&128)!==0,y=s.intFromLE(w);return this.curve.pointFromY(y,p)},h.prototype.encodeInt=function(m){return m.toArray("le",this.encodingLength)},h.prototype.decodeInt=function(m){return s.intFromLE(m)},h.prototype.isPoint=function(m){return m instanceof this.pointClass}}),d9=ye(t=>{var e=t;e.version=K_().version,e.utils=Wr(),e.rand=U2(),e.curve=H2(),e.curves=ep(),e.ec=l9(),e.eddsa=f9()}),h9=ye((t,e)=>{var r=d9(),i=jr();e.exports=function(v){return new f(v)};var s={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};s.p224=s.secp224r1,s.p256=s.secp256r1=s.prime256v1,s.p192=s.secp192r1=s.prime192v1,s.p384=s.secp384r1,s.p521=s.secp521r1;function f(v){this.curveType=s[v],!this.curveType&&(this.curveType={name:v}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}o(f,"D9"),f.prototype.generateKeys=function(v,b){return this.keys=this.curve.genKeyPair(),this.getPublicKey(v,b)},f.prototype.computeSecret=function(v,b,h){b=b||"utf8",!Buffer.isBuffer(v)&&(v=new Buffer(v,b));var m=this.curve.keyFromPublic(v).getPublic(),l=m.mul(this.keys.getPrivate()).getX();return n(l,h,this.curveType.byteLength)},f.prototype.getPublicKey=function(v,b){var h=this.keys.getPublic(b==="compressed",!0);return b==="hybrid"&&(h[h.length-1]%2?h[0]=7:h[0]=6),n(h,v)},f.prototype.getPrivateKey=function(v){return n(this.keys.getPrivate(),v)},f.prototype.setPublicKey=function(v,b){return b=b||"utf8",!Buffer.isBuffer(v)&&(v=new Buffer(v,b)),this.keys._importPublic(v),this},f.prototype.setPrivateKey=function(v,b){b=b||"utf8",!Buffer.isBuffer(v)&&(v=new Buffer(v,b));var h=new i(v);return h=h.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(h),this};function n(v,b,h){Array.isArray(v)||(v=v.toArray());var m=new Buffer(v);if(h&&m.length<h){var l=new Buffer(h-m.length);l.fill(0),m=Buffer.concat([l,m])}return b?m.toString(b):m}o(n,"QJ")}),p9=ye((t,e)=>{var r=(qt(),bt(Jt)).createECDH;e.exports=r||h9()}),m9=ye(t=>{var e=Uo(),r=dr(),i=t;i.define=function(f,n){return new s(f,n)};function s(f,n){this.name=f,this.body=n,this.decoders={},this.encoders={}}o(s,"X5"),s.prototype._createNamed=function(f){var n;try{n=(()=>{throw new Error("Cannot require module vm")})().runInThisContext("(function "+this.name+`(entity) {
|
|
40
|
-
this._initNamed(entity);
|
|
41
|
-
})`)}catch{n=o(function(b){this._initNamed(b)},"K")}return r(n,f),n.prototype._initNamed=function(v){f.call(this,v)},new n(this)},s.prototype._getDecoder=function(f){return f=f||"der",!this.decoders.hasOwnProperty(f)&&(this.decoders[f]=this._createNamed(e.decoders[f])),this.decoders[f]},s.prototype.decode=function(f,n,v){return this._getDecoder(n).decode(f,v)},s.prototype._getEncoder=function(f){return f=f||"der",!this.encoders.hasOwnProperty(f)&&(this.encoders[f]=this._createNamed(e.encoders[f])),this.encoders[f]},s.prototype.encode=function(f,n,v){return this._getEncoder(n).encode(f,v)}}),g9=ye(t=>{var e=dr();function r(s){this._reporterState={obj:null,path:[],options:s||{},errors:[]}}o(r,"O$"),t.Reporter=r,r.prototype.isError=function(s){return s instanceof i},r.prototype.save=function(){var s=this._reporterState;return{obj:s.obj,pathLen:s.path.length}},r.prototype.restore=function(s){var f=this._reporterState;f.obj=s.obj,f.path=f.path.slice(0,s.pathLen)},r.prototype.enterKey=function(s){return this._reporterState.path.push(s)},r.prototype.exitKey=function(s){var f=this._reporterState;f.path=f.path.slice(0,s-1)},r.prototype.leaveKey=function(s,f,n){var v=this._reporterState;this.exitKey(s),v.obj!==null&&(v.obj[f]=n)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){var s=this._reporterState,f=s.obj;return s.obj={},f},r.prototype.leaveObject=function(s){var f=this._reporterState,n=f.obj;return f.obj=s,n},r.prototype.error=function(s){var f,n=this._reporterState,v=s instanceof i;if(v?f=s:f=new i(n.path.map(function(b){return"["+JSON.stringify(b)+"]"}).join(""),s.message||s,s.stack),!n.options.partial)throw f;return v||n.errors.push(f),f},r.prototype.wrapResult=function(s){var f=this._reporterState;return f.options.partial?{result:this.isError(s)?null:s,errors:f.errors}:s};function i(s,f){this.path=s,this.rethrow(f)}o(i,"w5"),e(i,Error),i.prototype.rethrow=function(s){if(this.message=s+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,i),!this.stack)try{throw Error(this.message)}catch(f){this.stack=f.stack}return this}}),ym=ye(t=>{var e=dr(),r=Fa().Reporter,i=(sr(),bt(er)).Buffer;function s(n,v){if(r.call(this,v),!i.isBuffer(n)){this.error("Input not Buffer");return}this.base=n,this.offset=0,this.length=n.length}o(s,"v1"),e(s,r),t.DecoderBuffer=s,s.prototype.save=function(){return{offset:this.offset,reporter:r.prototype.save.call(this)}},s.prototype.restore=function(n){var v=new s(this.base);return v.offset=n.offset,v.length=this.offset,this.offset=n.offset,r.prototype.restore.call(this,n.reporter),v},s.prototype.isEmpty=function(){return this.offset===this.length},s.prototype.readUInt8=function(n){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(n||"DecoderBuffer overrun")},s.prototype.skip=function(n,v){if(!(this.offset+n<=this.length))return this.error(v||"DecoderBuffer overrun");var b=new s(this.base);return b._reporterState=this._reporterState,b.offset=this.offset,b.length=this.offset+n,this.offset+=n,b},s.prototype.raw=function(n){return this.base.slice(n?n.offset:this.offset,this.length)};function f(n,v){if(Array.isArray(n))this.length=0,this.value=n.map(function(b){return b instanceof f||(b=new f(b,v)),this.length+=b.length,b},this);else if(typeof n=="number"){if(!(0<=n&&n<=255))return v.error("non-byte EncoderBuffer value");this.value=n,this.length=1}else if(typeof n=="string")this.value=n,this.length=i.byteLength(n);else if(i.isBuffer(n))this.value=n,this.length=n.length;else return v.error("Unsupported type: "+typeof n)}o(f,"yY"),t.EncoderBuffer=f,f.prototype.join=function(n,v){return n||(n=new i(this.length)),v||(v=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(b){b.join(n,v),v+=b.length}):(typeof this.value=="number"?n[v]=this.value:typeof this.value=="string"?n.write(this.value,v):i.isBuffer(this.value)&&this.value.copy(n,v),v+=this.length)),n}}),v9=ye((t,e)=>{var r=Fa().Reporter,i=Fa().EncoderBuffer,s=Fa().DecoderBuffer,f=In(),n=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],v=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(n),b=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function h(l,w){var p={};this._baseState=p,p.enc=l,p.parent=w||null,p.children=null,p.tag=null,p.args=null,p.reverseArgs=null,p.choice=null,p.optional=!1,p.any=!1,p.obj=!1,p.use=null,p.useDecoder=null,p.key=null,p.default=null,p.explicit=null,p.implicit=null,p.contains=null,!p.parent&&(p.children=[],this._wrap())}o(h,"r6"),e.exports=h;var m=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];h.prototype.clone=function(){var l=this._baseState,w={};m.forEach(function(y){w[y]=l[y]});var p=new this.constructor(w.parent);return p._baseState=w,p},h.prototype._wrap=function(){var l=this._baseState;v.forEach(function(w){this[w]=function(){var p=new this.constructor(this);return l.children.push(p),p[w].apply(p,arguments)}},this)},h.prototype._init=function(l){var w=this._baseState;f(w.parent===null),l.call(this),w.children=w.children.filter(function(p){return p._baseState.parent===this},this),f.equal(w.children.length,1,"Root node can have only one child")},h.prototype._useArgs=function(l){var w=this._baseState,p=l.filter(function(y){return y instanceof this.constructor},this);l=l.filter(function(y){return!(y instanceof this.constructor)},this),p.length!==0&&(f(w.children===null),w.children=p,p.forEach(function(y){y._baseState.parent=this},this)),l.length!==0&&(f(w.args===null),w.args=l,w.reverseArgs=l.map(function(y){if(typeof y!="object"||y.constructor!==Object)return y;var M={};return Object.keys(y).forEach(function(E){E==(E|0)&&(E|=0);var R=y[E];M[R]=E}),M}))},b.forEach(function(l){h.prototype[l]=function(){var w=this._baseState;throw Error(l+" not implemented for encoding: "+w.enc)}}),n.forEach(function(l){h.prototype[l]=function(){var w=this._baseState,p=Array.prototype.slice.call(arguments);return f(w.tag===null),w.tag=l,this._useArgs(p),this}}),h.prototype.use=function(l){f(l);var w=this._baseState;return f(w.use===null),w.use=l,this},h.prototype.optional=function(){var l=this._baseState;return l.optional=!0,this},h.prototype.def=function(l){var w=this._baseState;return f(w.default===null),w.default=l,w.optional=!0,this},h.prototype.explicit=function(l){var w=this._baseState;return f(w.explicit===null&&w.implicit===null),w.explicit=l,this},h.prototype.implicit=function(l){var w=this._baseState;return f(w.explicit===null&&w.implicit===null),w.implicit=l,this},h.prototype.obj=function(){var l=this._baseState,w=Array.prototype.slice.call(arguments);return l.obj=!0,w.length!==0&&this._useArgs(w),this},h.prototype.key=function(l){var w=this._baseState;return f(w.key===null),w.key=l,this},h.prototype.any=function(){var l=this._baseState;return l.any=!0,this},h.prototype.choice=function(l){var w=this._baseState;return f(w.choice===null),w.choice=l,this._useArgs(Object.keys(l).map(function(p){return l[p]})),this},h.prototype.contains=function(l){var w=this._baseState;return f(w.use===null),w.contains=l,this},h.prototype._decode=function(l,w){var p=this._baseState;if(p.parent===null)return l.wrapResult(p.children[0]._decode(l,w));var y=p.default,M=!0,E=null;if(p.key!==null&&(E=l.enterKey(p.key)),p.optional){var R=null;if(p.explicit!==null?R=p.explicit:p.implicit!==null?R=p.implicit:p.tag!==null&&(R=p.tag),R===null&&!p.any){var I=l.save();try{p.choice===null?this._decodeGeneric(p.tag,l,w):this._decodeChoice(l,w),M=!0}catch{M=!1}l.restore(I)}else if(M=this._peekTag(l,R,p.any),l.isError(M))return M}var T;if(p.obj&&M&&(T=l.enterObject()),M){if(p.explicit!==null){var P=this._decodeTag(l,p.explicit);if(l.isError(P))return P;l=P}var j=l.offset;if(p.use===null&&p.choice===null){if(p.any)var I=l.save();var L=this._decodeTag(l,p.implicit!==null?p.implicit:p.tag,p.any);if(l.isError(L))return L;p.any?y=l.raw(I):l=L}if(w&&w.track&&p.tag!==null&&w.track(l.path(),j,l.length,"tagged"),w&&w.track&&p.tag!==null&&w.track(l.path(),l.offset,l.length,"content"),p.any?y=y:p.choice===null?y=this._decodeGeneric(p.tag,l,w):y=this._decodeChoice(l,w),l.isError(y))return y;if(!p.any&&p.choice===null&&p.children!==null&&p.children.forEach(function(Z){Z._decode(l,w)}),p.contains&&(p.tag==="octstr"||p.tag==="bitstr")){var U=new s(y);y=this._getUse(p.contains,l._reporterState.obj)._decode(U,w)}}return p.obj&&M&&(y=l.leaveObject(T)),p.key!==null&&(y!==null||M===!0)?l.leaveKey(E,p.key,y):E!==null&&l.exitKey(E),y},h.prototype._decodeGeneric=function(l,w,p){var y=this._baseState;return l==="seq"||l==="set"?null:l==="seqof"||l==="setof"?this._decodeList(w,l,y.args[0],p):/str$/.test(l)?this._decodeStr(w,l,p):l==="objid"&&y.args?this._decodeObjid(w,y.args[0],y.args[1],p):l==="objid"?this._decodeObjid(w,null,null,p):l==="gentime"||l==="utctime"?this._decodeTime(w,l,p):l==="null_"?this._decodeNull(w,p):l==="bool"?this._decodeBool(w,p):l==="objDesc"?this._decodeStr(w,l,p):l==="int"||l==="enum"?this._decodeInt(w,y.args&&y.args[0],p):y.use!==null?this._getUse(y.use,w._reporterState.obj)._decode(w,p):w.error("unknown tag: "+l)},h.prototype._getUse=function(l,w){var p=this._baseState;return p.useDecoder=this._use(l,w),f(p.useDecoder._baseState.parent===null),p.useDecoder=p.useDecoder._baseState.children[0],p.implicit!==p.useDecoder._baseState.implicit&&(p.useDecoder=p.useDecoder.clone(),p.useDecoder._baseState.implicit=p.implicit),p.useDecoder},h.prototype._decodeChoice=function(l,w){var p=this._baseState,y=null,M=!1;return Object.keys(p.choice).some(function(E){var R=l.save(),I=p.choice[E];try{var T=I._decode(l,w);if(l.isError(T))return!1;y={type:E,value:T},M=!0}catch{return l.restore(R),!1}return!0},this),M?y:l.error("Choice not matched")},h.prototype._createEncoderBuffer=function(l){return new i(l,this.reporter)},h.prototype._encode=function(l,w,p){var y=this._baseState;if(!(y.default!==null&&y.default===l)){var M=this._encodeValue(l,w,p);if(M!==void 0&&!this._skipDefault(M,w,p))return M}},h.prototype._encodeValue=function(l,w,p){var y=this._baseState;if(y.parent===null)return y.children[0]._encode(l,w||new r);var I=null;if(this.reporter=w,y.optional&&l===void 0)if(y.default!==null)l=y.default;else return;var M=null,E=!1;if(y.any)I=this._createEncoderBuffer(l);else if(y.choice)I=this._encodeChoice(l,w);else if(y.contains)M=this._getUse(y.contains,p)._encode(l,w),E=!0;else if(y.children)M=y.children.map(function(j){if(j._baseState.tag==="null_")return j._encode(null,w,l);if(j._baseState.key===null)return w.error("Child should have a key");var L=w.enterKey(j._baseState.key);if(typeof l!="object")return w.error("Child expected, but input is not object");var U=j._encode(l[j._baseState.key],w,l);return w.leaveKey(L),U},this).filter(function(j){return j}),M=this._createEncoderBuffer(M);else if(y.tag==="seqof"||y.tag==="setof"){if(!(y.args&&y.args.length===1))return w.error("Too many args for : "+y.tag);if(!Array.isArray(l))return w.error("seqof/setof, but data is not Array");var R=this.clone();R._baseState.implicit=null,M=this._createEncoderBuffer(l.map(function(j){var L=this._baseState;return this._getUse(L.args[0],l)._encode(j,w)},R))}else y.use!==null?I=this._getUse(y.use,p)._encode(l,w):(M=this._encodePrimitive(y.tag,l),E=!0);var I;if(!y.any&&y.choice===null){var T=y.implicit!==null?y.implicit:y.tag,P=y.implicit===null?"universal":"context";T===null?y.use===null&&w.error("Tag could be omitted only for .use()"):y.use===null&&(I=this._encodeComposite(T,E,P,M))}return y.explicit!==null&&(I=this._encodeComposite(y.explicit,!1,"context",I)),I},h.prototype._encodeChoice=function(l,w){var p=this._baseState,y=p.choice[l.type];return y||f(!1,l.type+" not found in "+JSON.stringify(Object.keys(p.choice))),y._encode(l.value,w)},h.prototype._encodePrimitive=function(l,w){var p=this._baseState;if(/str$/.test(l))return this._encodeStr(w,l);if(l==="objid"&&p.args)return this._encodeObjid(w,p.reverseArgs[0],p.args[1]);if(l==="objid")return this._encodeObjid(w,null,null);if(l==="gentime"||l==="utctime")return this._encodeTime(w,l);if(l==="null_")return this._encodeNull();if(l==="int"||l==="enum")return this._encodeInt(w,p.args&&p.reverseArgs[0]);if(l==="bool")return this._encodeBool(w);if(l==="objDesc")return this._encodeStr(w,l);throw Error("Unsupported tag: "+l)},h.prototype._isNumstr=function(l){return/^[0-9 ]*$/.test(l)},h.prototype._isPrintstr=function(l){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(l)}}),Fa=ye(t=>{var e=t;e.Reporter=g9().Reporter,e.DecoderBuffer=ym().DecoderBuffer,e.EncoderBuffer=ym().EncoderBuffer,e.Node=v9()}),b9=ye(t=>{var e=Y2();t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=e._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=e._reverse(t.tag)}),Y2=ye(t=>{var e=t;e._reverse=function(r){var i={};return Object.keys(r).forEach(function(s){(s|0)==s&&(s=s|0);var f=r[s];i[f]=s}),i},e.der=b9()}),Q2=ye((t,e)=>{var r=dr(),i=Uo(),s=i.base,f=i.bignum,n=i.constants.der;function v(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new b,this.tree._init(l.body)}o(v,"UE"),e.exports=v,v.prototype.decode=function(l,w){return l instanceof s.DecoderBuffer||(l=new s.DecoderBuffer(l,w)),this.tree._decode(l,w)};function b(l){s.Node.call(this,"der",l)}o(b,"n4"),r(b,s.Node),b.prototype._peekTag=function(l,w,p){if(l.isEmpty())return!1;var y=l.save(),M=h(l,'Failed to peek tag: "'+w+'"');return l.isError(M)?M:(l.restore(y),M.tag===w||M.tagStr===w||M.tagStr+"of"===w||p)},b.prototype._decodeTag=function(l,w,p){var y=h(l,'Failed to decode tag of "'+w+'"');if(l.isError(y))return y;var M=m(l,y.primitive,'Failed to get length of "'+w+'"');if(l.isError(M))return M;if(!p&&y.tag!==w&&y.tagStr!==w&&y.tagStr+"of"!==w)return l.error('Failed to match tag: "'+w+'"');if(y.primitive||M!==null)return l.skip(M,'Failed to match body of: "'+w+'"');var E=l.save(),R=this._skipUntilEnd(l,'Failed to skip indefinite length body: "'+this.tag+'"');return l.isError(R)?R:(M=l.offset-E.offset,l.restore(E),l.skip(M,'Failed to match body of: "'+w+'"'))},b.prototype._skipUntilEnd=function(l,w){for(;;){var p=h(l,w);if(l.isError(p))return p;var y=m(l,p.primitive,w);if(l.isError(y))return y;var M;if(p.primitive||y!==null?M=l.skip(y):M=this._skipUntilEnd(l,w),l.isError(M))return M;if(p.tagStr==="end")break}},b.prototype._decodeList=function(l,w,p,y){for(var M=[];!l.isEmpty();){var E=this._peekTag(l,"end");if(l.isError(E))return E;var R=p.decode(l,"der",y);if(l.isError(R)&&E)break;M.push(R)}return M},b.prototype._decodeStr=function(l,w){if(w==="bitstr"){var p=l.readUInt8();return l.isError(p)?p:{unused:p,data:l.raw()}}else if(w==="bmpstr"){var y=l.raw();if(y.length%2===1)return l.error("Decoding of string type: bmpstr length mismatch");for(var M="",E=0;E<y.length/2;E++)M+=String.fromCharCode(y.readUInt16BE(E*2));return M}else if(w==="numstr"){var R=l.raw().toString("ascii");return this._isNumstr(R)?R:l.error("Decoding of string type: numstr unsupported characters")}else{if(w==="octstr")return l.raw();if(w==="objDesc")return l.raw();if(w==="printstr"){var I=l.raw().toString("ascii");return this._isPrintstr(I)?I:l.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(w)?l.raw().toString():l.error("Decoding of string type: "+w+" unsupported")}},b.prototype._decodeObjid=function(l,w,p){for(var y,M=[],E=0;!l.isEmpty();){var R=l.readUInt8();E<<=7,E|=R&127,(R&128)===0&&(M.push(E),E=0)}R&128&&M.push(E);var I=M[0]/40|0,T=M[0]%40;if(p?y=M:y=[I,T].concat(M.slice(1)),w){var P=w[y.join(" ")];P===void 0&&(P=w[y.join(".")]),P!==void 0&&(y=P)}return y},b.prototype._decodeTime=function(l,w){var p=l.raw().toString();if(w==="gentime")var y=p.slice(0,4)|0,M=p.slice(4,6)|0,E=p.slice(6,8)|0,R=p.slice(8,10)|0,I=p.slice(10,12)|0,T=p.slice(12,14)|0;else if(w==="utctime"){var y=p.slice(0,2)|0,M=p.slice(2,4)|0,E=p.slice(4,6)|0,R=p.slice(6,8)|0,I=p.slice(8,10)|0,T=p.slice(10,12)|0;y<70?y=2e3+y:y=1900+y}else return l.error("Decoding "+w+" time is not supported yet");return Date.UTC(y,M-1,E,R,I,T,0)},b.prototype._decodeNull=function(l){return null},b.prototype._decodeBool=function(l){var w=l.readUInt8();return l.isError(w)?w:w!==0},b.prototype._decodeInt=function(l,w){var p=l.raw(),y=new f(p);return w&&(y=w[y.toString(10)]||y),y},b.prototype._use=function(l,w){return typeof l=="function"&&(l=l(w)),l._getDecoder("der").tree};function h(l,w){var p=l.readUInt8(w);if(l.isError(p))return p;var y=n.tagClass[p>>6],M=(p&32)===0;if((p&31)===31){var E=p;for(p=0;(E&128)===128;){if(E=l.readUInt8(w),l.isError(E))return E;p<<=7,p|=E&127}}else p&=31;var R=n.tag[p];return{cls:y,primitive:M,tag:p,tagStr:R}}o(h,"eJ");function m(l,w,p){var y=l.readUInt8(p);if(l.isError(y))return y;if(!w&&y===128)return null;if((y&128)===0)return y;var M=y&127;if(M>4)return l.error("length octect is too long");y=0;for(var E=0;E<M;E++){y<<=8;var R=l.readUInt8(p);if(l.isError(R))return R;y|=R}return y}o(m,"rE")}),y9=ye((t,e)=>{var r=dr(),i=(sr(),bt(er)).Buffer,s=Q2();function f(n){s.call(this,n),this.enc="pem"}o(f,"$z"),r(f,s),e.exports=f,f.prototype.decode=function(n,v){for(var b=n.toString().split(/[\r\n]+/g),h=v.label.toUpperCase(),m=/^-----(BEGIN|END) ([^-]+)-----$/,l=-1,w=-1,p=0;p<b.length;p++){var y=b[p].match(m);if(y!==null&&y[2]===h)if(l===-1){if(y[1]!=="BEGIN")break;l=p}else{if(y[1]!=="END")break;w=p;break}}if(l===-1||w===-1)throw Error("PEM section not found for: "+h);var M=b.slice(l+1,w).join("");M.replace(/[^a-z0-9\+\/=]+/gi,"");var E=new i(M,"base64");return s.prototype.decode.call(this,E,v)}}),w9=ye(t=>{var e=t;e.der=Q2(),e.pem=y9()}),K2=ye((t,e)=>{var r=dr(),i=(sr(),bt(er)).Buffer,s=Uo(),f=s.base,n=s.constants.der;function v(l){this.enc="der",this.name=l.name,this.entity=l,this.tree=new b,this.tree._init(l.body)}o(v,"$N"),e.exports=v,v.prototype.encode=function(l,w){return this.tree._encode(l,w).join()};function b(l){f.Node.call(this,"der",l)}o(b,"h$"),r(b,f.Node),b.prototype._encodeComposite=function(l,w,p,y){var M=m(l,w,p,this.reporter);if(y.length<128){var I=new i(2);return I[0]=M,I[1]=y.length,this._createEncoderBuffer([I,y])}for(var E=1,R=y.length;R>=256;R>>=8)E++;var I=new i(2+E);I[0]=M,I[1]=128|E;for(var R=1+E,T=y.length;T>0;R--,T>>=8)I[R]=T&255;return this._createEncoderBuffer([I,y])},b.prototype._encodeStr=function(l,w){if(w==="bitstr")return this._createEncoderBuffer([l.unused|0,l.data]);if(w==="bmpstr"){for(var p=new i(l.length*2),y=0;y<l.length;y++)p.writeUInt16BE(l.charCodeAt(y),y*2);return this._createEncoderBuffer(p)}else return w==="numstr"?this._isNumstr(l)?this._createEncoderBuffer(l):this.reporter.error("Encoding of string type: numstr supports only digits and space"):w==="printstr"?this._isPrintstr(l)?this._createEncoderBuffer(l):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(w)?this._createEncoderBuffer(l):w==="objDesc"?this._createEncoderBuffer(l):this.reporter.error("Encoding of string type: "+w+" unsupported")},b.prototype._encodeObjid=function(l,w,p){if(typeof l=="string"){if(!w)return this.reporter.error("string objid given, but no values map found");if(!w.hasOwnProperty(l))return this.reporter.error("objid not found in values map");l=w[l].split(/[\s\.]+/g);for(var y=0;y<l.length;y++)l[y]|=0}else if(Array.isArray(l)){l=l.slice();for(var y=0;y<l.length;y++)l[y]|=0}if(!Array.isArray(l))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(l));if(!p){if(l[1]>=40)return this.reporter.error("Second objid identifier OOB");l.splice(0,2,l[0]*40+l[1])}for(var M=0,y=0;y<l.length;y++){var E=l[y];for(M++;E>=128;E>>=7)M++}for(var R=new i(M),I=R.length-1,y=l.length-1;y>=0;y--){var E=l[y];for(R[I--]=E&127;(E>>=7)>0;)R[I--]=128|E&127}return this._createEncoderBuffer(R)};function h(l){return l<10?"0"+l:l}o(h,"j$"),b.prototype._encodeTime=function(l,w){var p,y=new Date(l);return w==="gentime"?p=[h(y.getFullYear()),h(y.getUTCMonth()+1),h(y.getUTCDate()),h(y.getUTCHours()),h(y.getUTCMinutes()),h(y.getUTCSeconds()),"Z"].join(""):w==="utctime"?p=[h(y.getFullYear()%100),h(y.getUTCMonth()+1),h(y.getUTCDate()),h(y.getUTCHours()),h(y.getUTCMinutes()),h(y.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+w+" time is not supported yet"),this._encodeStr(p,"octstr")},b.prototype._encodeNull=function(){return this._createEncoderBuffer("")},b.prototype._encodeInt=function(l,w){if(typeof l=="string"){if(!w)return this.reporter.error("String int or enum given, but no values map");if(!w.hasOwnProperty(l))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(l));l=w[l]}if(typeof l!="number"&&!i.isBuffer(l)){var p=l.toArray();!l.sign&&p[0]&128&&p.unshift(0),l=new i(p)}if(i.isBuffer(l)){var y=l.length;l.length===0&&y++;var E=new i(y);return l.copy(E),l.length===0&&(E[0]=0),this._createEncoderBuffer(E)}if(l<128)return this._createEncoderBuffer(l);if(l<256)return this._createEncoderBuffer([0,l]);for(var y=1,M=l;M>=256;M>>=8)y++;for(var E=Array(y),M=E.length-1;M>=0;M--)E[M]=l&255,l>>=8;return E[0]&128&&E.unshift(0),this._createEncoderBuffer(new i(E))},b.prototype._encodeBool=function(l){return this._createEncoderBuffer(l?255:0)},b.prototype._use=function(l,w){return typeof l=="function"&&(l=l(w)),l._getEncoder("der").tree},b.prototype._skipDefault=function(l,w,p){var y=this._baseState,M;if(y.default===null)return!1;var E=l.join();if(y.defaultBuffer===void 0&&(y.defaultBuffer=this._encodeValue(y.default,w,p).join()),E.length!==y.defaultBuffer.length)return!1;for(M=0;M<E.length;M++)if(E[M]!==y.defaultBuffer[M])return!1;return!0};function m(l,w,p,y){var M;if(l==="seqof"?l="seq":l==="setof"&&(l="set"),n.tagByName.hasOwnProperty(l))M=n.tagByName[l];else if(typeof l=="number"&&(l|0)===l)M=l;else return y.error("Unknown tag: "+l);return M>=31?y.error("Multi-octet tag encoding unsupported"):(w||(M|=32),M|=n.tagClassByName[p||"universal"]<<6,M)}o(m,"$s")}),x9=ye((t,e)=>{var r=dr(),i=K2();function s(f){i.call(this,f),this.enc="pem"}o(s,"Yz"),r(s,i),e.exports=s,s.prototype.encode=function(f,n){for(var v=i.prototype.encode.call(this,f),b=v.toString("base64"),h=["-----BEGIN "+n.label+"-----"],m=0;m<b.length;m+=64)h.push(b.slice(m,m+64));return h.push("-----END "+n.label+"-----"),h.join(`
|
|
42
|
-
`)}}),_9=ye(t=>{var e=t;e.der=K2(),e.pem=x9()}),Uo=ye(t=>{var e=t;e.bignum=jr(),e.define=m9().define,e.base=Fa(),e.constants=Y2(),e.decoders=w9(),e.encoders=_9()}),M9=ye((t,e)=>{var r=Uo(),i=r.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),s=r.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),f=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional(),this.key("curve").objid().optional())}),n=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(f),this.key("subjectPublicKey").bitstr())}),v=r.define("RelativeDistinguishedName",function(){this.setof(s)}),b=r.define("RDNSequence",function(){this.seqof(v)}),h=r.define("Name",function(){this.choice({rdnSequence:this.use(b)})}),m=r.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),l=r.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),w=r.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int().optional(),this.key("serialNumber").int(),this.key("signature").use(f),this.key("issuer").use(h),this.key("validity").use(m),this.key("subject").use(h),this.key("subjectPublicKeyInfo").use(n),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(l).optional())}),p=r.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(w),this.key("signatureAlgorithm").use(f),this.key("signatureValue").bitstr())});e.exports=p}),S9=ye(t=>{var e=Uo();t.certificate=M9();var r=e.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});t.RSAPrivateKey=r;var i=e.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.RSAPublicKey=i;var s=e.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),f=e.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});t.PublicKey=f;var n=e.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});t.PrivateKey=n;var v=e.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});t.EncryptedPrivateKey=v;var b=e.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});t.DSAPrivateKey=b,t.DSAparam=e.define("DSAparam",function(){this.int()});var h=e.define("ECParameters",function(){this.choice({namedCurve:this.objid()})}),m=e.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(h),this.key("publicKey").optional().explicit(1).bitstr())});t.ECPrivateKey=m,t.signature=e.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})}),E9=ye((t,e)=>{e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}}),A9=ye((t,e)=>{var r=lr().Buffer,i=Fu().Transform,s=dr();function f(h){i.call(this),this._block=r.allocUnsafe(h),this._blockSize=h,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}o(f,"I7"),s(f,i),f.prototype._transform=function(h,m,l){var w=null;try{this.update(h,m)}catch(p){w=p}l(w)},f.prototype._flush=function(h){var m=null;try{this.push(this.digest())}catch(l){m=l}h(m)};var n=typeof Uint8Array<"u",v=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(r.prototype instanceof Uint8Array||r.TYPED_ARRAY_SUPPORT);function b(h,m){if(h instanceof r)return h;if(typeof h=="string")return r.from(h,m);if(v&&ArrayBuffer.isView(h)){if(h.byteLength===0)return r.alloc(0);var l=r.from(h.buffer,h.byteOffset,h.byteLength);if(l.byteLength===h.byteLength)return l}if(n&&h instanceof Uint8Array||r.isBuffer(h)&&h.constructor&&typeof h.constructor.isBuffer=="function"&&h.constructor.isBuffer(h))return r.from(h);throw TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}o(b,"ys"),f.prototype.update=function(h,m){if(this._finalized)throw Error("Digest already called");h=b(h,m);for(var l=this._block,w=0;this._blockOffset+h.length-w>=this._blockSize;){for(var p=this._blockOffset;p<this._blockSize;)l[p++]=h[w++];this._update(),this._blockOffset=0}for(;w<h.length;)l[this._blockOffset++]=h[w++];for(var y=0,M=h.length*8;M>0;++y)this._length[y]+=M,M=this._length[y]/4294967296|0,M>0&&(this._length[y]-=4294967296*M);return this},f.prototype._update=function(){throw Error("_update is not implemented")},f.prototype.digest=function(h){if(this._finalized)throw Error("Digest already called");this._finalized=!0;var m=this._digest();h!==void 0&&(m=m.toString(h)),this._block.fill(0),this._blockOffset=0;for(var l=0;l<4;++l)this._length[l]=0;return m},f.prototype._digest=function(){throw Error("_digest is not implemented")},e.exports=f}),k9=ye((t,e)=>{var r=dr(),i=A9(),s=lr().Buffer,f=Array(16);function n(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}o(n,"uY"),r(n,i),n.prototype._update=function(){for(var w=f,p=0;p<16;++p)w[p]=this._block.readInt32LE(p*4);var y=this._a,M=this._b,E=this._c,R=this._d;y=b(y,M,E,R,w[0],3614090360,7),R=b(R,y,M,E,w[1],3905402710,12),E=b(E,R,y,M,w[2],606105819,17),M=b(M,E,R,y,w[3],3250441966,22),y=b(y,M,E,R,w[4],4118548399,7),R=b(R,y,M,E,w[5],1200080426,12),E=b(E,R,y,M,w[6],2821735955,17),M=b(M,E,R,y,w[7],4249261313,22),y=b(y,M,E,R,w[8],1770035416,7),R=b(R,y,M,E,w[9],2336552879,12),E=b(E,R,y,M,w[10],4294925233,17),M=b(M,E,R,y,w[11],2304563134,22),y=b(y,M,E,R,w[12],1804603682,7),R=b(R,y,M,E,w[13],4254626195,12),E=b(E,R,y,M,w[14],2792965006,17),M=b(M,E,R,y,w[15],1236535329,22),y=h(y,M,E,R,w[1],4129170786,5),R=h(R,y,M,E,w[6],3225465664,9),E=h(E,R,y,M,w[11],643717713,14),M=h(M,E,R,y,w[0],3921069994,20),y=h(y,M,E,R,w[5],3593408605,5),R=h(R,y,M,E,w[10],38016083,9),E=h(E,R,y,M,w[15],3634488961,14),M=h(M,E,R,y,w[4],3889429448,20),y=h(y,M,E,R,w[9],568446438,5),R=h(R,y,M,E,w[14],3275163606,9),E=h(E,R,y,M,w[3],4107603335,14),M=h(M,E,R,y,w[8],1163531501,20),y=h(y,M,E,R,w[13],2850285829,5),R=h(R,y,M,E,w[2],4243563512,9),E=h(E,R,y,M,w[7],1735328473,14),M=h(M,E,R,y,w[12],2368359562,20),y=m(y,M,E,R,w[5],4294588738,4),R=m(R,y,M,E,w[8],2272392833,11),E=m(E,R,y,M,w[11],1839030562,16),M=m(M,E,R,y,w[14],4259657740,23),y=m(y,M,E,R,w[1],2763975236,4),R=m(R,y,M,E,w[4],1272893353,11),E=m(E,R,y,M,w[7],4139469664,16),M=m(M,E,R,y,w[10],3200236656,23),y=m(y,M,E,R,w[13],681279174,4),R=m(R,y,M,E,w[0],3936430074,11),E=m(E,R,y,M,w[3],3572445317,16),M=m(M,E,R,y,w[6],76029189,23),y=m(y,M,E,R,w[9],3654602809,4),R=m(R,y,M,E,w[12],3873151461,11),E=m(E,R,y,M,w[15],530742520,16),M=m(M,E,R,y,w[2],3299628645,23),y=l(y,M,E,R,w[0],4096336452,6),R=l(R,y,M,E,w[7],1126891415,10),E=l(E,R,y,M,w[14],2878612391,15),M=l(M,E,R,y,w[5],4237533241,21),y=l(y,M,E,R,w[12],1700485571,6),R=l(R,y,M,E,w[3],2399980690,10),E=l(E,R,y,M,w[10],4293915773,15),M=l(M,E,R,y,w[1],2240044497,21),y=l(y,M,E,R,w[8],1873313359,6),R=l(R,y,M,E,w[15],4264355552,10),E=l(E,R,y,M,w[6],2734768916,15),M=l(M,E,R,y,w[13],1309151649,21),y=l(y,M,E,R,w[4],4149444226,6),R=l(R,y,M,E,w[11],3174756917,10),E=l(E,R,y,M,w[2],718787259,15),M=l(M,E,R,y,w[9],3951481745,21),this._a=this._a+y|0,this._b=this._b+M|0,this._c=this._c+E|0,this._d=this._d+R|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var w=s.allocUnsafe(16);return w.writeInt32LE(this._a,0),w.writeInt32LE(this._b,4),w.writeInt32LE(this._c,8),w.writeInt32LE(this._d,12),w};function v(w,p){return w<<p|w>>>32-p}o(v,"mY");function b(w,p,y,M,E,R,I){return v(w+(p&y|~p&M)+E+R|0,I)+p|0}o(b,"W4");function h(w,p,y,M,E,R,I){return v(w+(p&M|y&~M)+E+R|0,I)+p|0}o(h,"H4");function m(w,p,y,M,E,R,I){return v(w+(p^y^M)+E+R|0,I)+p|0}o(m,"J4");function l(w,p,y,M,E,R,I){return v(w+(y^(p|~M))+E+R|0,I)+p|0}o(l,"z4"),e.exports=n}),N9=ye((t,e)=>{var r=lr().Buffer,i=k9();function s(f,n,v,b){if(r.isBuffer(f)||(f=r.from(f,"binary")),n&&(r.isBuffer(n)||(n=r.from(n,"binary")),n.length!==8))throw RangeError("salt should be Buffer with 8 byte length");for(var h=v/8,m=r.alloc(h),l=r.alloc(b||0),w=r.alloc(0);h>0||b>0;){var p=new i;p.update(w),p.update(f),n&&p.update(n),w=p.digest();var y=0;if(h>0){var M=m.length-h;y=Math.min(h,w.length),w.copy(m,M,0,y),h-=y}if(y<w.length&&b>0){var E=l.length-b,R=Math.min(b,w.length-y);w.copy(l,E,y,y+R),b-=R}}return w.fill(0),{key:m,iv:l}}o(s,"ms"),e.exports=s}),X2=ye(t=>{var e=(qt(),bt(Jt));t.createCipher=t.Cipher=e.createCipher,t.createCipheriv=t.Cipheriv=e.createCipheriv,t.createDecipher=t.Decipher=e.createDecipher,t.createDecipheriv=t.Decipheriv=e.createDecipheriv,t.listCiphers=t.getCiphers=e.getCiphers}),C9=ye((t,e)=>{var r=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,s=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,f=N9(),n=X2(),v=lr().Buffer;e.exports=function(b,h){var m=b.toString(),l=m.match(r),w;if(l){var y="aes"+l[1],M=v.from(l[2],"hex"),E=v.from(l[3].replace(/[\r\n]/g,""),"base64"),R=f(h,M.slice(0,8),parseInt(l[1],10)).key,I=[],T=n.createDecipheriv(y,R,M);I.push(T.update(E)),I.push(T.final()),w=v.concat(I)}else{var p=m.match(s);w=v.from(p[2].replace(/[\r\n]/g,""),"base64")}var P=m.match(i)[1];return{tag:P,data:w}}}),W2=ye((t,e)=>{var r=S9(),i=E9(),s=C9(),f=X2(),n=z2(),v=lr().Buffer;function b(m,l){var w=m.algorithm.decrypt.kde.kdeparams.salt,p=parseInt(m.algorithm.decrypt.kde.kdeparams.iters.toString(),10),y=i[m.algorithm.decrypt.cipher.algo.join(".")],M=m.algorithm.decrypt.cipher.iv,E=m.subjectPrivateKey,R=parseInt(y.split("-")[1],10)/8,I=n.pbkdf2Sync(l,w,p,R,"sha1"),T=f.createDecipheriv(y,I,M),P=[];return P.push(T.update(E)),P.push(T.final()),v.concat(P)}o(b,"$88");function h(m){var l;typeof m=="object"&&!v.isBuffer(m)&&(l=m.passphrase,m=m.key),typeof m=="string"&&(m=v.from(m));var w=s(m,l),p=w.tag,y=w.data,M,E;switch(p){case"CERTIFICATE":E=r.certificate.decode(y,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(E||(E=r.PublicKey.decode(y,"der")),M=E.algorithm.algorithm.join("."),M){case"1.2.840.113549.1.1.1":return r.RSAPublicKey.decode(E.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return E.subjectPrivateKey=E.subjectPublicKey,{type:"ec",data:E};case"1.2.840.10040.4.1":return E.algorithm.params.pub_key=r.DSAparam.decode(E.subjectPublicKey.data,"der"),{type:"dsa",data:E.algorithm.params};default:throw Error("unknown key id "+M)}case"ENCRYPTED PRIVATE KEY":y=r.EncryptedPrivateKey.decode(y,"der"),y=b(y,l);case"PRIVATE KEY":switch(E=r.PrivateKey.decode(y,"der"),M=E.algorithm.algorithm.join("."),M){case"1.2.840.113549.1.1.1":return r.RSAPrivateKey.decode(E.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:E.algorithm.curve,privateKey:r.ECPrivateKey.decode(E.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return E.algorithm.params.priv_key=r.DSAparam.decode(E.subjectPrivateKey,"der"),{type:"dsa",params:E.algorithm.params};default:throw Error("unknown key id "+M)}case"RSA PUBLIC KEY":return r.RSAPublicKey.decode(y,"der");case"RSA PRIVATE KEY":return r.RSAPrivateKey.decode(y,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:r.DSAPrivateKey.decode(y,"der")};case"EC PRIVATE KEY":return y=r.ECPrivateKey.decode(y,"der"),{curve:y.parameters.value,privateKey:y.privateKey};default:throw Error("unknown key type "+p)}}o(h,"NN"),h.signature=r.signature,e.exports=h}),$2=ye((t,e)=>{var r=Hu(),i=lr().Buffer;e.exports=function(f,n){for(var v=i.alloc(0),b=0,h;v.length<n;)h=s(b++),v=i.concat([v,r("sha1").update(f).update(h).digest()]);return v.slice(0,n)};function s(f){var n=i.allocUnsafe(4);return n.writeUInt32BE(f,0),n}o(s,"_88")}),J2=ye((t,e)=>{e.exports=function(r,i){for(var s=r.length,f=-1;++f<s;)r[f]^=i[f];return r}}),q2=ye((t,e)=>{var r=jr(),i=lr().Buffer;function s(f,n){return i.from(f.toRed(r.mont(n.modulus)).redPow(new r(n.publicExponent)).fromRed().toArray())}o(s,"Y88"),e.exports=s}),R9=ye((t,e)=>{(function(r,i){function s(u,d){if(!u)throw Error(d||"Assertion failed")}o(s,"K");function f(u,d){u.super_=d;var x=o(function(){},"f");x.prototype=d.prototype,u.prototype=new x,u.prototype.constructor=u}o(f,"_");function n(u,d,x){if(n.isBN(u))return u;this.negative=0,this.words=null,this.length=0,this.red=null,u!==null&&((d==="le"||d==="be")&&(x=d,d=10),this._init(u||0,d||10,x||"be"))}o(n,"P"),typeof r=="object"?r.exports=n:i.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=(sr(),bt(er)).Buffer}catch{}n.isBN=function(u){return u instanceof n?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===n.wordSize&&Array.isArray(u.words)},n.max=function(u,d){return u.cmp(d)>0?u:d},n.min=function(u,d){return u.cmp(d)<0?u:d},n.prototype._init=function(u,d,x){if(typeof u=="number")return this._initNumber(u,d,x);if(typeof u=="object")return this._initArray(u,d,x);d==="hex"&&(d=16),s(d===(d|0)&&d>=2&&d<=36),u=u.toString().replace(/\s+/g,"");var A=0;u[0]==="-"&&(A++,this.negative=1),A<u.length&&(d===16?this._parseHex(u,A,x):(this._parseBase(u,d,A),x==="le"&&this._initArray(this.toArray(),d,x)))},n.prototype._initNumber=function(u,d,x){u<0&&(this.negative=1,u=-u),u<67108864?(this.words=[u&67108863],this.length=1):u<4503599627370496?(this.words=[u&67108863,u/67108864&67108863],this.length=2):(s(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),x==="le"&&this._initArray(this.toArray(),d,x)},n.prototype._initArray=function(u,d,x){if(s(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var N,S,c=0;if(x==="be")for(A=u.length-1,N=0;A>=0;A-=3)S=u[A]|u[A-1]<<8|u[A-2]<<16,this.words[N]|=S<<c&67108863,this.words[N+1]=S>>>26-c&67108863,c+=24,c>=26&&(c-=26,N++);else if(x==="le")for(A=0,N=0;A<u.length;A+=3)S=u[A]|u[A+1]<<8|u[A+2]<<16,this.words[N]|=S<<c&67108863,this.words[N+1]=S>>>26-c&67108863,c+=24,c>=26&&(c-=26,N++);return this._strip()};function b(u,d){var x=u.charCodeAt(d);if(x>=48&&x<=57)return x-48;if(x>=65&&x<=70)return x-55;if(x>=97&&x<=102)return x-87;s(!1,"Invalid character in "+u)}o(b,"Y");function h(u,d,x){var A=b(u,x);return x-1>=d&&(A|=b(u,x-1)<<4),A}o(h,"z"),n.prototype._parseHex=function(u,d,x){this.length=Math.ceil((u.length-d)/6),this.words=Array(this.length);for(var A=0;A<this.length;A++)this.words[A]=0;var N=0,S=0,c;if(x==="be")for(A=u.length-1;A>=d;A-=2)c=h(u,d,A)<<N,this.words[S]|=c&67108863,N>=18?(N-=18,S+=1,this.words[S]|=c>>>26):N+=8;else{var _=u.length-d;for(A=_%2===0?d+1:d;A<u.length;A+=2)c=h(u,d,A)<<N,this.words[S]|=c&67108863,N>=18?(N-=18,S+=1,this.words[S]|=c>>>26):N+=8}this._strip()};function m(u,d,x,A){for(var N=0,S=0,c=Math.min(u.length,x),_=d;_<c;_++){var C=u.charCodeAt(_)-48;N*=A,C>=49?S=C-49+10:C>=17?S=C-17+10:S=C,s(C>=0&&S<A,"Invalid character"),N+=S}return N}o(m,"v"),n.prototype._parseBase=function(u,d,x){this.words=[0],this.length=1;for(var A=0,N=1;N<=67108863;N*=d)A++;A--,N=N/d|0;for(var S=u.length-x,c=S%A,_=Math.min(S,S-c)+x,C=0,O=x;O<_;O+=A)C=m(u,O,O+A,d),this.imuln(N),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C);if(c!==0){var D=1;for(C=m(u,O,u.length,d),O=0;O<c;O++)D*=d;this.imuln(D),this.words[0]+C<67108864?this.words[0]+=C:this._iaddn(C)}this._strip()},n.prototype.copy=function(u){u.words=Array(this.length);for(var d=0;d<this.length;d++)u.words[d]=this.words[d];u.length=this.length,u.negative=this.negative,u.red=this.red};function l(u,d){u.words=d.words,u.length=d.length,u.negative=d.negative,u.red=d.red}if(o(l,"w"),n.prototype._move=function(u){l(u,this)},n.prototype.clone=function(){var u=new n(null);return this.copy(u),u},n.prototype._expand=function(u){for(;this.length<u;)this.words[this.length++]=0;return this},n.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{n.prototype[Symbol.for("nodejs.util.inspect.custom")]=w}catch{n.prototype.inspect=w}else n.prototype.inspect=w;function w(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}o(w,"V");var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],y=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(u,d){u=u||10,d=d|0||1;var x;if(u===16||u==="hex"){x="";for(var A=0,N=0,S=0;S<this.length;S++){var c=this.words[S],_=((c<<A|N)&16777215).toString(16);N=c>>>24-A&16777215,A+=2,A>=26&&(A-=26,S--),N!==0||S!==this.length-1?x=p[6-_.length]+_+x:x=_+x}for(N!==0&&(x=N.toString(16)+x);x.length%d!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}if(u===(u|0)&&u>=2&&u<=36){var C=y[u],O=M[u];x="";var D=this.clone();for(D.negative=0;!D.isZero();){var B=D.modrn(O).toString(u);D=D.idivn(O),D.isZero()?x=B+x:x=p[C-B.length]+B+x}for(this.isZero()&&(x="0"+x);x.length%d!==0;)x="0"+x;return this.negative!==0&&(x="-"+x),x}s(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var u=this.words[0];return this.length===2?u+=this.words[1]*67108864:this.length===3&&this.words[2]===1?u+=4503599627370496+this.words[1]*67108864:this.length>2&&s(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},n.prototype.toJSON=function(){return this.toString(16,2)},v&&(n.prototype.toBuffer=function(u,d){return this.toArrayLike(v,u,d)}),n.prototype.toArray=function(u,d){return this.toArrayLike(Array,u,d)};var E=o(function(u,d){return u.allocUnsafe?u.allocUnsafe(d):new u(d)},"E");n.prototype.toArrayLike=function(u,d,x){this._strip();var A=this.byteLength(),N=x||Math.max(1,A);s(A<=N,"byte array longer than desired length"),s(N>0,"Requested array length <= 0");var S=E(u,N),c=d==="le"?"LE":"BE";return this["_toArrayLike"+c](S,A),S},n.prototype._toArrayLikeLE=function(u,d){for(var x=0,A=0,N=0,S=0;N<this.length;N++){var c=this.words[N]<<S|A;u[x++]=c&255,x<u.length&&(u[x++]=c>>8&255),x<u.length&&(u[x++]=c>>16&255),S===6?(x<u.length&&(u[x++]=c>>24&255),A=0,S=0):(A=c>>>24,S+=2)}if(x<u.length)for(u[x++]=A;x<u.length;)u[x++]=0},n.prototype._toArrayLikeBE=function(u,d){for(var x=u.length-1,A=0,N=0,S=0;N<this.length;N++){var c=this.words[N]<<S|A;u[x--]=c&255,x>=0&&(u[x--]=c>>8&255),x>=0&&(u[x--]=c>>16&255),S===6?(x>=0&&(u[x--]=c>>24&255),A=0,S=0):(A=c>>>24,S+=2)}if(x>=0)for(u[x--]=A;x>=0;)u[x--]=0},Math.clz32?n.prototype._countBits=function(u){return 32-Math.clz32(u)}:n.prototype._countBits=function(u){var d=u,x=0;return d>=4096&&(x+=13,d>>>=13),d>=64&&(x+=7,d>>>=7),d>=8&&(x+=4,d>>>=4),d>=2&&(x+=2,d>>>=2),x+d},n.prototype._zeroBits=function(u){if(u===0)return 26;var d=u,x=0;return(d&8191)===0&&(x+=13,d>>>=13),(d&127)===0&&(x+=7,d>>>=7),(d&15)===0&&(x+=4,d>>>=4),(d&3)===0&&(x+=2,d>>>=2),(d&1)===0&&x++,x},n.prototype.bitLength=function(){var u=this.words[this.length-1],d=this._countBits(u);return(this.length-1)*26+d};function R(u){for(var d=Array(u.bitLength()),x=0;x<d.length;x++){var A=x/26|0,N=x%26;d[x]=u.words[A]>>>N&1}return d}o(R,"I"),n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var u=0,d=0;d<this.length;d++){var x=this._zeroBits(this.words[d]);if(u+=x,x!==26)break}return u},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},n.prototype.fromTwos=function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var d=0;d<u.length;d++)this.words[d]=this.words[d]|u.words[d];return this._strip()},n.prototype.ior=function(u){return s((this.negative|u.negative)===0),this.iuor(u)},n.prototype.or=function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},n.prototype.uor=function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},n.prototype.iuand=function(u){var d;this.length>u.length?d=u:d=this;for(var x=0;x<d.length;x++)this.words[x]=this.words[x]&u.words[x];return this.length=d.length,this._strip()},n.prototype.iand=function(u){return s((this.negative|u.negative)===0),this.iuand(u)},n.prototype.and=function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},n.prototype.uand=function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},n.prototype.iuxor=function(u){var d,x;this.length>u.length?(d=this,x=u):(d=u,x=this);for(var A=0;A<x.length;A++)this.words[A]=d.words[A]^x.words[A];if(this!==d)for(;A<d.length;A++)this.words[A]=d.words[A];return this.length=d.length,this._strip()},n.prototype.ixor=function(u){return s((this.negative|u.negative)===0),this.iuxor(u)},n.prototype.xor=function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},n.prototype.uxor=function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},n.prototype.inotn=function(u){s(typeof u=="number"&&u>=0);var d=Math.ceil(u/26)|0,x=u%26;this._expand(d),x>0&&d--;for(var A=0;A<d;A++)this.words[A]=~this.words[A]&67108863;return x>0&&(this.words[A]=~this.words[A]&67108863>>26-x),this._strip()},n.prototype.notn=function(u){return this.clone().inotn(u)},n.prototype.setn=function(u,d){s(typeof u=="number"&&u>=0);var x=u/26|0,A=u%26;return this._expand(x+1),d?this.words[x]=this.words[x]|1<<A:this.words[x]=this.words[x]&~(1<<A),this._strip()},n.prototype.iadd=function(u){var d;if(this.negative!==0&&u.negative===0)return this.negative=0,d=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,d=this.isub(u),u.negative=1,d._normSign();var x,A;this.length>u.length?(x=this,A=u):(x=u,A=this);for(var N=0,S=0;S<A.length;S++)d=(x.words[S]|0)+(A.words[S]|0)+N,this.words[S]=d&67108863,N=d>>>26;for(;N!==0&&S<x.length;S++)d=(x.words[S]|0)+N,this.words[S]=d&67108863,N=d>>>26;if(this.length=x.length,N!==0)this.words[this.length]=N,this.length++;else if(x!==this)for(;S<x.length;S++)this.words[S]=x.words[S];return this},n.prototype.add=function(u){var d;return u.negative!==0&&this.negative===0?(u.negative=0,d=this.sub(u),u.negative^=1,d):u.negative===0&&this.negative!==0?(this.negative=0,d=u.sub(this),this.negative=1,d):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},n.prototype.isub=function(u){if(u.negative!==0){u.negative=0;var d=this.iadd(u);return u.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var x=this.cmp(u);if(x===0)return this.negative=0,this.length=1,this.words[0]=0,this;var A,N;x>0?(A=this,N=u):(A=u,N=this);for(var S=0,c=0;c<N.length;c++)d=(A.words[c]|0)-(N.words[c]|0)+S,S=d>>26,this.words[c]=d&67108863;for(;S!==0&&c<A.length;c++)d=(A.words[c]|0)+S,S=d>>26,this.words[c]=d&67108863;if(S===0&&c<A.length&&A!==this)for(;c<A.length;c++)this.words[c]=A.words[c];return this.length=Math.max(this.length,c),A!==this&&(this.negative=1),this._strip()},n.prototype.sub=function(u){return this.clone().isub(u)};function I(u,d,x){x.negative=d.negative^u.negative;var A=u.length+d.length|0;x.length=A,A=A-1|0;var N=u.words[0]|0,S=d.words[0]|0,c=N*S,_=c&67108863,C=c/67108864|0;x.words[0]=_;for(var O=1;O<A;O++){for(var D=C>>>26,B=C&67108863,z=Math.min(O,d.length-1),G=Math.max(0,O-u.length+1);G<=z;G++){var te=O-G|0;N=u.words[te]|0,S=d.words[G]|0,c=N*S+B,D+=c/67108864|0,B=c&67108863}x.words[O]=B|0,C=D|0}return C!==0?x.words[O]=C|0:x.length--,x._strip()}o(I,"L");var T=o(function(u,d,x){var A=u.words,N=d.words,S=x.words,c=0,_,C,O,D=A[0]|0,B=D&8191,z=D>>>13,G=A[1]|0,te=G&8191,$=G>>>13,q=A[2]|0,Ce=q&8191,fe=q>>>13,ae=A[3]|0,be=ae&8191,H=ae>>>13,ee=A[4]|0,Q=ee&8191,X=ee>>>13,se=A[5]|0,Ne=se&8191,we=se>>>13,ue=A[6]|0,K=ue&8191,W=ue>>>13,J=A[7]|0,pe=J&8191,le=J>>>13,oe=A[8]|0,Ve=oe&8191,_e=oe>>>13,Le=A[9]|0,qe=Le&8191,ge=Le>>>13,De=N[0]|0,he=De&8191,ve=De>>>13,Oe=N[1]|0,je=Oe&8191,ke=Oe>>>13,Fe=N[2]|0,et=Fe&8191,Ie=Fe>>>13,Se=N[3]|0,Be=Se&8191,Ee=Se>>>13,Ue=N[4]|0,Je=Ue&8191,re=Ue>>>13,de=N[5]|0,Pe=de&8191,Me=de>>>13,Re=N[6]|0,Ke=Re&8191,ie=Re>>>13,Ae=N[7]|0,Ye=Ae&8191,me=Ae>>>13,Qe=N[8]|0,st=Qe&8191,ze=Qe>>>13,We=N[9]|0,Te=We&8191,Ze=We>>>13;x.negative=u.negative^d.negative,x.length=19,_=Math.imul(B,he),C=Math.imul(B,ve),C=C+Math.imul(z,he)|0,O=Math.imul(z,ve);var lt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(lt>>>26)|0,lt&=67108863,_=Math.imul(te,he),C=Math.imul(te,ve),C=C+Math.imul($,he)|0,O=Math.imul($,ve),_=_+Math.imul(B,je)|0,C=C+Math.imul(B,ke)|0,C=C+Math.imul(z,je)|0,O=O+Math.imul(z,ke)|0;var yt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(yt>>>26)|0,yt&=67108863,_=Math.imul(Ce,he),C=Math.imul(Ce,ve),C=C+Math.imul(fe,he)|0,O=Math.imul(fe,ve),_=_+Math.imul(te,je)|0,C=C+Math.imul(te,ke)|0,C=C+Math.imul($,je)|0,O=O+Math.imul($,ke)|0,_=_+Math.imul(B,et)|0,C=C+Math.imul(B,Ie)|0,C=C+Math.imul(z,et)|0,O=O+Math.imul(z,Ie)|0;var ht=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(ht>>>26)|0,ht&=67108863,_=Math.imul(be,he),C=Math.imul(be,ve),C=C+Math.imul(H,he)|0,O=Math.imul(H,ve),_=_+Math.imul(Ce,je)|0,C=C+Math.imul(Ce,ke)|0,C=C+Math.imul(fe,je)|0,O=O+Math.imul(fe,ke)|0,_=_+Math.imul(te,et)|0,C=C+Math.imul(te,Ie)|0,C=C+Math.imul($,et)|0,O=O+Math.imul($,Ie)|0,_=_+Math.imul(B,Be)|0,C=C+Math.imul(B,Ee)|0,C=C+Math.imul(z,Be)|0,O=O+Math.imul(z,Ee)|0;var Nt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,_=Math.imul(Q,he),C=Math.imul(Q,ve),C=C+Math.imul(X,he)|0,O=Math.imul(X,ve),_=_+Math.imul(be,je)|0,C=C+Math.imul(be,ke)|0,C=C+Math.imul(H,je)|0,O=O+Math.imul(H,ke)|0,_=_+Math.imul(Ce,et)|0,C=C+Math.imul(Ce,Ie)|0,C=C+Math.imul(fe,et)|0,O=O+Math.imul(fe,Ie)|0,_=_+Math.imul(te,Be)|0,C=C+Math.imul(te,Ee)|0,C=C+Math.imul($,Be)|0,O=O+Math.imul($,Ee)|0,_=_+Math.imul(B,Je)|0,C=C+Math.imul(B,re)|0,C=C+Math.imul(z,Je)|0,O=O+Math.imul(z,re)|0;var Dt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,_=Math.imul(Ne,he),C=Math.imul(Ne,ve),C=C+Math.imul(we,he)|0,O=Math.imul(we,ve),_=_+Math.imul(Q,je)|0,C=C+Math.imul(Q,ke)|0,C=C+Math.imul(X,je)|0,O=O+Math.imul(X,ke)|0,_=_+Math.imul(be,et)|0,C=C+Math.imul(be,Ie)|0,C=C+Math.imul(H,et)|0,O=O+Math.imul(H,Ie)|0,_=_+Math.imul(Ce,Be)|0,C=C+Math.imul(Ce,Ee)|0,C=C+Math.imul(fe,Be)|0,O=O+Math.imul(fe,Ee)|0,_=_+Math.imul(te,Je)|0,C=C+Math.imul(te,re)|0,C=C+Math.imul($,Je)|0,O=O+Math.imul($,re)|0,_=_+Math.imul(B,Pe)|0,C=C+Math.imul(B,Me)|0,C=C+Math.imul(z,Pe)|0,O=O+Math.imul(z,Me)|0;var Ct=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,_=Math.imul(K,he),C=Math.imul(K,ve),C=C+Math.imul(W,he)|0,O=Math.imul(W,ve),_=_+Math.imul(Ne,je)|0,C=C+Math.imul(Ne,ke)|0,C=C+Math.imul(we,je)|0,O=O+Math.imul(we,ke)|0,_=_+Math.imul(Q,et)|0,C=C+Math.imul(Q,Ie)|0,C=C+Math.imul(X,et)|0,O=O+Math.imul(X,Ie)|0,_=_+Math.imul(be,Be)|0,C=C+Math.imul(be,Ee)|0,C=C+Math.imul(H,Be)|0,O=O+Math.imul(H,Ee)|0,_=_+Math.imul(Ce,Je)|0,C=C+Math.imul(Ce,re)|0,C=C+Math.imul(fe,Je)|0,O=O+Math.imul(fe,re)|0,_=_+Math.imul(te,Pe)|0,C=C+Math.imul(te,Me)|0,C=C+Math.imul($,Pe)|0,O=O+Math.imul($,Me)|0,_=_+Math.imul(B,Ke)|0,C=C+Math.imul(B,ie)|0,C=C+Math.imul(z,Ke)|0,O=O+Math.imul(z,ie)|0;var St=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(St>>>26)|0,St&=67108863,_=Math.imul(pe,he),C=Math.imul(pe,ve),C=C+Math.imul(le,he)|0,O=Math.imul(le,ve),_=_+Math.imul(K,je)|0,C=C+Math.imul(K,ke)|0,C=C+Math.imul(W,je)|0,O=O+Math.imul(W,ke)|0,_=_+Math.imul(Ne,et)|0,C=C+Math.imul(Ne,Ie)|0,C=C+Math.imul(we,et)|0,O=O+Math.imul(we,Ie)|0,_=_+Math.imul(Q,Be)|0,C=C+Math.imul(Q,Ee)|0,C=C+Math.imul(X,Be)|0,O=O+Math.imul(X,Ee)|0,_=_+Math.imul(be,Je)|0,C=C+Math.imul(be,re)|0,C=C+Math.imul(H,Je)|0,O=O+Math.imul(H,re)|0,_=_+Math.imul(Ce,Pe)|0,C=C+Math.imul(Ce,Me)|0,C=C+Math.imul(fe,Pe)|0,O=O+Math.imul(fe,Me)|0,_=_+Math.imul(te,Ke)|0,C=C+Math.imul(te,ie)|0,C=C+Math.imul($,Ke)|0,O=O+Math.imul($,ie)|0,_=_+Math.imul(B,Ye)|0,C=C+Math.imul(B,me)|0,C=C+Math.imul(z,Ye)|0,O=O+Math.imul(z,me)|0;var Ht=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,_=Math.imul(Ve,he),C=Math.imul(Ve,ve),C=C+Math.imul(_e,he)|0,O=Math.imul(_e,ve),_=_+Math.imul(pe,je)|0,C=C+Math.imul(pe,ke)|0,C=C+Math.imul(le,je)|0,O=O+Math.imul(le,ke)|0,_=_+Math.imul(K,et)|0,C=C+Math.imul(K,Ie)|0,C=C+Math.imul(W,et)|0,O=O+Math.imul(W,Ie)|0,_=_+Math.imul(Ne,Be)|0,C=C+Math.imul(Ne,Ee)|0,C=C+Math.imul(we,Be)|0,O=O+Math.imul(we,Ee)|0,_=_+Math.imul(Q,Je)|0,C=C+Math.imul(Q,re)|0,C=C+Math.imul(X,Je)|0,O=O+Math.imul(X,re)|0,_=_+Math.imul(be,Pe)|0,C=C+Math.imul(be,Me)|0,C=C+Math.imul(H,Pe)|0,O=O+Math.imul(H,Me)|0,_=_+Math.imul(Ce,Ke)|0,C=C+Math.imul(Ce,ie)|0,C=C+Math.imul(fe,Ke)|0,O=O+Math.imul(fe,ie)|0,_=_+Math.imul(te,Ye)|0,C=C+Math.imul(te,me)|0,C=C+Math.imul($,Ye)|0,O=O+Math.imul($,me)|0,_=_+Math.imul(B,st)|0,C=C+Math.imul(B,ze)|0,C=C+Math.imul(z,st)|0,O=O+Math.imul(z,ze)|0;var Vt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,_=Math.imul(qe,he),C=Math.imul(qe,ve),C=C+Math.imul(ge,he)|0,O=Math.imul(ge,ve),_=_+Math.imul(Ve,je)|0,C=C+Math.imul(Ve,ke)|0,C=C+Math.imul(_e,je)|0,O=O+Math.imul(_e,ke)|0,_=_+Math.imul(pe,et)|0,C=C+Math.imul(pe,Ie)|0,C=C+Math.imul(le,et)|0,O=O+Math.imul(le,Ie)|0,_=_+Math.imul(K,Be)|0,C=C+Math.imul(K,Ee)|0,C=C+Math.imul(W,Be)|0,O=O+Math.imul(W,Ee)|0,_=_+Math.imul(Ne,Je)|0,C=C+Math.imul(Ne,re)|0,C=C+Math.imul(we,Je)|0,O=O+Math.imul(we,re)|0,_=_+Math.imul(Q,Pe)|0,C=C+Math.imul(Q,Me)|0,C=C+Math.imul(X,Pe)|0,O=O+Math.imul(X,Me)|0,_=_+Math.imul(be,Ke)|0,C=C+Math.imul(be,ie)|0,C=C+Math.imul(H,Ke)|0,O=O+Math.imul(H,ie)|0,_=_+Math.imul(Ce,Ye)|0,C=C+Math.imul(Ce,me)|0,C=C+Math.imul(fe,Ye)|0,O=O+Math.imul(fe,me)|0,_=_+Math.imul(te,st)|0,C=C+Math.imul(te,ze)|0,C=C+Math.imul($,st)|0,O=O+Math.imul($,ze)|0,_=_+Math.imul(B,Te)|0,C=C+Math.imul(B,Ze)|0,C=C+Math.imul(z,Te)|0,O=O+Math.imul(z,Ze)|0;var Pt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,_=Math.imul(qe,je),C=Math.imul(qe,ke),C=C+Math.imul(ge,je)|0,O=Math.imul(ge,ke),_=_+Math.imul(Ve,et)|0,C=C+Math.imul(Ve,Ie)|0,C=C+Math.imul(_e,et)|0,O=O+Math.imul(_e,Ie)|0,_=_+Math.imul(pe,Be)|0,C=C+Math.imul(pe,Ee)|0,C=C+Math.imul(le,Be)|0,O=O+Math.imul(le,Ee)|0,_=_+Math.imul(K,Je)|0,C=C+Math.imul(K,re)|0,C=C+Math.imul(W,Je)|0,O=O+Math.imul(W,re)|0,_=_+Math.imul(Ne,Pe)|0,C=C+Math.imul(Ne,Me)|0,C=C+Math.imul(we,Pe)|0,O=O+Math.imul(we,Me)|0,_=_+Math.imul(Q,Ke)|0,C=C+Math.imul(Q,ie)|0,C=C+Math.imul(X,Ke)|0,O=O+Math.imul(X,ie)|0,_=_+Math.imul(be,Ye)|0,C=C+Math.imul(be,me)|0,C=C+Math.imul(H,Ye)|0,O=O+Math.imul(H,me)|0,_=_+Math.imul(Ce,st)|0,C=C+Math.imul(Ce,ze)|0,C=C+Math.imul(fe,st)|0,O=O+Math.imul(fe,ze)|0,_=_+Math.imul(te,Te)|0,C=C+Math.imul(te,Ze)|0,C=C+Math.imul($,Te)|0,O=O+Math.imul($,Ze)|0;var Ft=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,_=Math.imul(qe,et),C=Math.imul(qe,Ie),C=C+Math.imul(ge,et)|0,O=Math.imul(ge,Ie),_=_+Math.imul(Ve,Be)|0,C=C+Math.imul(Ve,Ee)|0,C=C+Math.imul(_e,Be)|0,O=O+Math.imul(_e,Ee)|0,_=_+Math.imul(pe,Je)|0,C=C+Math.imul(pe,re)|0,C=C+Math.imul(le,Je)|0,O=O+Math.imul(le,re)|0,_=_+Math.imul(K,Pe)|0,C=C+Math.imul(K,Me)|0,C=C+Math.imul(W,Pe)|0,O=O+Math.imul(W,Me)|0,_=_+Math.imul(Ne,Ke)|0,C=C+Math.imul(Ne,ie)|0,C=C+Math.imul(we,Ke)|0,O=O+Math.imul(we,ie)|0,_=_+Math.imul(Q,Ye)|0,C=C+Math.imul(Q,me)|0,C=C+Math.imul(X,Ye)|0,O=O+Math.imul(X,me)|0,_=_+Math.imul(be,st)|0,C=C+Math.imul(be,ze)|0,C=C+Math.imul(H,st)|0,O=O+Math.imul(H,ze)|0,_=_+Math.imul(Ce,Te)|0,C=C+Math.imul(Ce,Ze)|0,C=C+Math.imul(fe,Te)|0,O=O+Math.imul(fe,Ze)|0;var Tt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,_=Math.imul(qe,Be),C=Math.imul(qe,Ee),C=C+Math.imul(ge,Be)|0,O=Math.imul(ge,Ee),_=_+Math.imul(Ve,Je)|0,C=C+Math.imul(Ve,re)|0,C=C+Math.imul(_e,Je)|0,O=O+Math.imul(_e,re)|0,_=_+Math.imul(pe,Pe)|0,C=C+Math.imul(pe,Me)|0,C=C+Math.imul(le,Pe)|0,O=O+Math.imul(le,Me)|0,_=_+Math.imul(K,Ke)|0,C=C+Math.imul(K,ie)|0,C=C+Math.imul(W,Ke)|0,O=O+Math.imul(W,ie)|0,_=_+Math.imul(Ne,Ye)|0,C=C+Math.imul(Ne,me)|0,C=C+Math.imul(we,Ye)|0,O=O+Math.imul(we,me)|0,_=_+Math.imul(Q,st)|0,C=C+Math.imul(Q,ze)|0,C=C+Math.imul(X,st)|0,O=O+Math.imul(X,ze)|0,_=_+Math.imul(be,Te)|0,C=C+Math.imul(be,Ze)|0,C=C+Math.imul(H,Te)|0,O=O+Math.imul(H,Ze)|0;var jt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(jt>>>26)|0,jt&=67108863,_=Math.imul(qe,Je),C=Math.imul(qe,re),C=C+Math.imul(ge,Je)|0,O=Math.imul(ge,re),_=_+Math.imul(Ve,Pe)|0,C=C+Math.imul(Ve,Me)|0,C=C+Math.imul(_e,Pe)|0,O=O+Math.imul(_e,Me)|0,_=_+Math.imul(pe,Ke)|0,C=C+Math.imul(pe,ie)|0,C=C+Math.imul(le,Ke)|0,O=O+Math.imul(le,ie)|0,_=_+Math.imul(K,Ye)|0,C=C+Math.imul(K,me)|0,C=C+Math.imul(W,Ye)|0,O=O+Math.imul(W,me)|0,_=_+Math.imul(Ne,st)|0,C=C+Math.imul(Ne,ze)|0,C=C+Math.imul(we,st)|0,O=O+Math.imul(we,ze)|0,_=_+Math.imul(Q,Te)|0,C=C+Math.imul(Q,Ze)|0,C=C+Math.imul(X,Te)|0,O=O+Math.imul(X,Ze)|0;var Ut=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,_=Math.imul(qe,Pe),C=Math.imul(qe,Me),C=C+Math.imul(ge,Pe)|0,O=Math.imul(ge,Me),_=_+Math.imul(Ve,Ke)|0,C=C+Math.imul(Ve,ie)|0,C=C+Math.imul(_e,Ke)|0,O=O+Math.imul(_e,ie)|0,_=_+Math.imul(pe,Ye)|0,C=C+Math.imul(pe,me)|0,C=C+Math.imul(le,Ye)|0,O=O+Math.imul(le,me)|0,_=_+Math.imul(K,st)|0,C=C+Math.imul(K,ze)|0,C=C+Math.imul(W,st)|0,O=O+Math.imul(W,ze)|0,_=_+Math.imul(Ne,Te)|0,C=C+Math.imul(Ne,Ze)|0,C=C+Math.imul(we,Te)|0,O=O+Math.imul(we,Ze)|0;var Zt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,_=Math.imul(qe,Ke),C=Math.imul(qe,ie),C=C+Math.imul(ge,Ke)|0,O=Math.imul(ge,ie),_=_+Math.imul(Ve,Ye)|0,C=C+Math.imul(Ve,me)|0,C=C+Math.imul(_e,Ye)|0,O=O+Math.imul(_e,me)|0,_=_+Math.imul(pe,st)|0,C=C+Math.imul(pe,ze)|0,C=C+Math.imul(le,st)|0,O=O+Math.imul(le,ze)|0,_=_+Math.imul(K,Te)|0,C=C+Math.imul(K,Ze)|0,C=C+Math.imul(W,Te)|0,O=O+Math.imul(W,Ze)|0;var Gt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,_=Math.imul(qe,Ye),C=Math.imul(qe,me),C=C+Math.imul(ge,Ye)|0,O=Math.imul(ge,me),_=_+Math.imul(Ve,st)|0,C=C+Math.imul(Ve,ze)|0,C=C+Math.imul(_e,st)|0,O=O+Math.imul(_e,ze)|0,_=_+Math.imul(pe,Te)|0,C=C+Math.imul(pe,Ze)|0,C=C+Math.imul(le,Te)|0,O=O+Math.imul(le,Ze)|0;var Yt=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,_=Math.imul(qe,st),C=Math.imul(qe,ze),C=C+Math.imul(ge,st)|0,O=Math.imul(ge,ze),_=_+Math.imul(Ve,Te)|0,C=C+Math.imul(Ve,Ze)|0,C=C+Math.imul(_e,Te)|0,O=O+Math.imul(_e,Ze)|0;var bi=(c+_|0)+((C&8191)<<13)|0;c=(O+(C>>>13)|0)+(bi>>>26)|0,bi&=67108863,_=Math.imul(qe,Te),C=Math.imul(qe,Ze),C=C+Math.imul(ge,Te)|0,O=Math.imul(ge,Ze);var ce=(c+_|0)+((C&8191)<<13)|0;return c=(O+(C>>>13)|0)+(ce>>>26)|0,ce&=67108863,S[0]=lt,S[1]=yt,S[2]=ht,S[3]=Nt,S[4]=Dt,S[5]=Ct,S[6]=St,S[7]=Ht,S[8]=Vt,S[9]=Pt,S[10]=Ft,S[11]=Tt,S[12]=jt,S[13]=Ut,S[14]=Zt,S[15]=Gt,S[16]=Yt,S[17]=bi,S[18]=ce,c!==0&&(S[19]=c,x.length++),x},"h");Math.imul||(T=I);function P(u,d,x){x.negative=d.negative^u.negative,x.length=u.length+d.length;for(var A=0,N=0,S=0;S<x.length-1;S++){var c=N;N=0;for(var _=A&67108863,C=Math.min(S,d.length-1),O=Math.max(0,S-u.length+1);O<=C;O++){var D=S-O,B=u.words[D]|0,z=d.words[O]|0,G=B*z,te=G&67108863;c=c+(G/67108864|0)|0,te=te+_|0,_=te&67108863,c=c+(te>>>26)|0,N+=c>>>26,c&=67108863}x.words[S]=_,A=c,c=N}return A!==0?x.words[S]=A:x.length--,x._strip()}o(P,"b");function j(u,d,x){return P(u,d,x)}o(j,"y"),n.prototype.mulTo=function(u,d){var x,A=this.length+u.length;return this.length===10&&u.length===10?x=T(this,u,d):A<63?x=I(this,u,d):A<1024?x=P(this,u,d):x=j(this,u,d),x},n.prototype.mul=function(u){var d=new n(null);return d.words=Array(this.length+u.length),this.mulTo(u,d)},n.prototype.mulf=function(u){var d=new n(null);return d.words=Array(this.length+u.length),j(this,u,d)},n.prototype.imul=function(u){return this.clone().mulTo(u,this)},n.prototype.imuln=function(u){var d=u<0;d&&(u=-u),s(typeof u=="number"),s(u<67108864);for(var x=0,A=0;A<this.length;A++){var N=(this.words[A]|0)*u,S=(N&67108863)+(x&67108863);x>>=26,x+=N/67108864|0,x+=S>>>26,this.words[A]=S&67108863}return x!==0&&(this.words[A]=x,this.length++),this.length=u===0?1:this.length,d?this.ineg():this},n.prototype.muln=function(u){return this.clone().imuln(u)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(u){var d=R(u);if(d.length===0)return new n(1);for(var x=this,A=0;A<d.length&&d[A]===0;A++,x=x.sqr());if(++A<d.length)for(var N=x.sqr();A<d.length;A++,N=N.sqr())d[A]!==0&&(x=x.mul(N));return x},n.prototype.iushln=function(u){s(typeof u=="number"&&u>=0);var d=u%26,x=(u-d)/26,A=67108863>>>26-d<<26-d,N;if(d!==0){var S=0;for(N=0;N<this.length;N++){var c=this.words[N]&A,_=(this.words[N]|0)-c<<d;this.words[N]=_|S,S=c>>>26-d}S&&(this.words[N]=S,this.length++)}if(x!==0){for(N=this.length-1;N>=0;N--)this.words[N+x]=this.words[N];for(N=0;N<x;N++)this.words[N]=0;this.length+=x}return this._strip()},n.prototype.ishln=function(u){return s(this.negative===0),this.iushln(u)},n.prototype.iushrn=function(u,d,x){s(typeof u=="number"&&u>=0);var A;d?A=(d-d%26)/26:A=0;var N=u%26,S=Math.min((u-N)/26,this.length),c=67108863^67108863>>>N<<N,_=x;if(A-=S,A=Math.max(0,A),_){for(var C=0;C<S;C++)_.words[C]=this.words[C];_.length=S}if(S!==0)if(this.length>S)for(this.length-=S,C=0;C<this.length;C++)this.words[C]=this.words[C+S];else this.words[0]=0,this.length=1;var O=0;for(C=this.length-1;C>=0&&(O!==0||C>=A);C--){var D=this.words[C]|0;this.words[C]=O<<26-N|D>>>N,O=D&c}return _&&O!==0&&(_.words[_.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},n.prototype.ishrn=function(u,d,x){return s(this.negative===0),this.iushrn(u,d,x)},n.prototype.shln=function(u){return this.clone().ishln(u)},n.prototype.ushln=function(u){return this.clone().iushln(u)},n.prototype.shrn=function(u){return this.clone().ishrn(u)},n.prototype.ushrn=function(u){return this.clone().iushrn(u)},n.prototype.testn=function(u){s(typeof u=="number"&&u>=0);var d=u%26,x=(u-d)/26,A=1<<d;if(this.length<=x)return!1;var N=this.words[x];return!!(N&A)},n.prototype.imaskn=function(u){s(typeof u=="number"&&u>=0);var d=u%26,x=(u-d)/26;if(s(this.negative===0,"imaskn works only with positive numbers"),this.length<=x)return this;if(d!==0&&x++,this.length=Math.min(x,this.length),d!==0){var A=67108863^67108863>>>d<<d;this.words[this.length-1]&=A}return this._strip()},n.prototype.maskn=function(u){return this.clone().imaskn(u)},n.prototype.iaddn=function(u){return s(typeof u=="number"),s(u<67108864),u<0?this.isubn(-u):this.negative!==0?this.length===1&&(this.words[0]|0)<=u?(this.words[0]=u-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(u),this.negative=1,this):this._iaddn(u)},n.prototype._iaddn=function(u){this.words[0]+=u;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},n.prototype.isubn=function(u){if(s(typeof u=="number"),s(u<67108864),u<0)return this.iaddn(-u);if(this.negative!==0)return this.negative=0,this.iaddn(u),this.negative=1,this;if(this.words[0]-=u,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},n.prototype.addn=function(u){return this.clone().iaddn(u)},n.prototype.subn=function(u){return this.clone().isubn(u)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(u,d,x){var A=u.length+x,N;this._expand(A);var S,c=0;for(N=0;N<u.length;N++){S=(this.words[N+x]|0)+c;var _=(u.words[N]|0)*d;S-=_&67108863,c=(S>>26)-(_/67108864|0),this.words[N+x]=S&67108863}for(;N<this.length-x;N++)S=(this.words[N+x]|0)+c,c=S>>26,this.words[N+x]=S&67108863;if(c===0)return this._strip();for(s(c===-1),c=0,N=0;N<this.length;N++)S=-(this.words[N]|0)+c,c=S>>26,this.words[N]=S&67108863;return this.negative=1,this._strip()},n.prototype._wordDiv=function(u,d){var x=this.length-u.length,A=this.clone(),N=u,S=N.words[N.length-1]|0,c=this._countBits(S);x=26-c,x!==0&&(N=N.ushln(x),A.iushln(x),S=N.words[N.length-1]|0);var _=A.length-N.length,C;if(d!=="mod"){C=new n(null),C.length=_+1,C.words=Array(C.length);for(var O=0;O<C.length;O++)C.words[O]=0}var D=A.clone()._ishlnsubmul(N,1,_);D.negative===0&&(A=D,C&&(C.words[_]=1));for(var B=_-1;B>=0;B--){var z=(A.words[N.length+B]|0)*67108864+(A.words[N.length+B-1]|0);for(z=Math.min(z/S|0,67108863),A._ishlnsubmul(N,z,B);A.negative!==0;)z--,A.negative=0,A._ishlnsubmul(N,1,B),!A.isZero()&&(A.negative^=1);C&&(C.words[B]=z)}return C&&C._strip(),A._strip(),d!=="div"&&x!==0&&A.iushrn(x),{div:C||null,mod:A}},n.prototype.divmod=function(u,d,x){if(s(!u.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var A,N,S;return this.negative!==0&&u.negative===0?(S=this.neg().divmod(u,d),d!=="mod"&&(A=S.div.neg()),d!=="div"&&(N=S.mod.neg(),x&&N.negative!==0&&N.iadd(u)),{div:A,mod:N}):this.negative===0&&u.negative!==0?(S=this.divmod(u.neg(),d),d!=="mod"&&(A=S.div.neg()),{div:A,mod:S.mod}):(this.negative&u.negative)!==0?(S=this.neg().divmod(u.neg(),d),d!=="div"&&(N=S.mod.neg(),x&&N.negative!==0&&N.isub(u)),{div:S.div,mod:N}):u.length>this.length||this.cmp(u)<0?{div:new n(0),mod:this}:u.length===1?d==="div"?{div:this.divn(u.words[0]),mod:null}:d==="mod"?{div:null,mod:new n(this.modrn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new n(this.modrn(u.words[0]))}:this._wordDiv(u,d)},n.prototype.div=function(u){return this.divmod(u,"div",!1).div},n.prototype.mod=function(u){return this.divmod(u,"mod",!1).mod},n.prototype.umod=function(u){return this.divmod(u,"mod",!0).mod},n.prototype.divRound=function(u){var d=this.divmod(u);if(d.mod.isZero())return d.div;var x=d.div.negative!==0?d.mod.isub(u):d.mod,A=u.ushrn(1),N=u.andln(1),S=x.cmp(A);return S<0||N===1&&S===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},n.prototype.modrn=function(u){var d=u<0;d&&(u=-u),s(u<=67108863);for(var x=67108864%u,A=0,N=this.length-1;N>=0;N--)A=(x*A+(this.words[N]|0))%u;return d?-A:A},n.prototype.modn=function(u){return this.modrn(u)},n.prototype.idivn=function(u){var d=u<0;d&&(u=-u),s(u<=67108863);for(var x=0,A=this.length-1;A>=0;A--){var N=(this.words[A]|0)+x*67108864;this.words[A]=N/u|0,x=N%u}return this._strip(),d?this.ineg():this},n.prototype.divn=function(u){return this.clone().idivn(u)},n.prototype.egcd=function(u){s(u.negative===0),s(!u.isZero());var d=this,x=u.clone();d.negative!==0?d=d.umod(u):d=d.clone();for(var A=new n(1),N=new n(0),S=new n(0),c=new n(1),_=0;d.isEven()&&x.isEven();)d.iushrn(1),x.iushrn(1),++_;for(var C=x.clone(),O=d.clone();!d.isZero();){for(var D=0,B=1;(d.words[0]&B)===0&&D<26;++D,B<<=1);if(D>0)for(d.iushrn(D);D-- >0;)(A.isOdd()||N.isOdd())&&(A.iadd(C),N.isub(O)),A.iushrn(1),N.iushrn(1);for(var z=0,G=1;(x.words[0]&G)===0&&z<26;++z,G<<=1);if(z>0)for(x.iushrn(z);z-- >0;)(S.isOdd()||c.isOdd())&&(S.iadd(C),c.isub(O)),S.iushrn(1),c.iushrn(1);d.cmp(x)>=0?(d.isub(x),A.isub(S),N.isub(c)):(x.isub(d),S.isub(A),c.isub(N))}return{a:S,b:c,gcd:x.iushln(_)}},n.prototype._invmp=function(u){s(u.negative===0),s(!u.isZero());var d=this,x=u.clone();d.negative!==0?d=d.umod(u):d=d.clone();for(var A=new n(1),N=new n(0),S=x.clone();d.cmpn(1)>0&&x.cmpn(1)>0;){for(var c=0,_=1;(d.words[0]&_)===0&&c<26;++c,_<<=1);if(c>0)for(d.iushrn(c);c-- >0;)A.isOdd()&&A.iadd(S),A.iushrn(1);for(var C=0,O=1;(x.words[0]&O)===0&&C<26;++C,O<<=1);if(C>0)for(x.iushrn(C);C-- >0;)N.isOdd()&&N.iadd(S),N.iushrn(1);d.cmp(x)>=0?(d.isub(x),A.isub(N)):(x.isub(d),N.isub(A))}var D;return d.cmpn(1)===0?D=A:D=N,D.cmpn(0)<0&&D.iadd(u),D},n.prototype.gcd=function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var d=this.clone(),x=u.clone();d.negative=0,x.negative=0;for(var A=0;d.isEven()&&x.isEven();A++)d.iushrn(1),x.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;x.isEven();)x.iushrn(1);var N=d.cmp(x);if(N<0){var S=d;d=x,x=S}else if(N===0||x.cmpn(1)===0)break;d.isub(x)}while(!0);return x.iushln(A)},n.prototype.invm=function(u){return this.egcd(u).a.umod(u)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(u){return this.words[0]&u},n.prototype.bincn=function(u){s(typeof u=="number");var d=u%26,x=(u-d)/26,A=1<<d;if(this.length<=x)return this._expand(x+1),this.words[x]|=A,this;for(var N=A,S=x;N!==0&&S<this.length;S++){var c=this.words[S]|0;c+=N,N=c>>>26,c&=67108863,this.words[S]=c}return N!==0&&(this.words[S]=N,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(u){var d=u<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var x;if(this.length>1)x=1;else{d&&(u=-u),s(u<=67108863,"Number is too big");var A=this.words[0]|0;x=A===u?0:A<u?-1:1}return this.negative!==0?-x|0:x},n.prototype.cmp=function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var d=this.ucmp(u);return this.negative!==0?-d|0:d},n.prototype.ucmp=function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var d=0,x=this.length-1;x>=0;x--){var A=this.words[x]|0,N=u.words[x]|0;if(A!==N){A<N?d=-1:A>N&&(d=1);break}}return d},n.prototype.gtn=function(u){return this.cmpn(u)===1},n.prototype.gt=function(u){return this.cmp(u)===1},n.prototype.gten=function(u){return this.cmpn(u)>=0},n.prototype.gte=function(u){return this.cmp(u)>=0},n.prototype.ltn=function(u){return this.cmpn(u)===-1},n.prototype.lt=function(u){return this.cmp(u)===-1},n.prototype.lten=function(u){return this.cmpn(u)<=0},n.prototype.lte=function(u){return this.cmp(u)<=0},n.prototype.eqn=function(u){return this.cmpn(u)===0},n.prototype.eq=function(u){return this.cmp(u)===0},n.red=function(u){return new a(u)},n.prototype.toRed=function(u){return s(!this.red,"Already a number in reduction context"),s(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},n.prototype.fromRed=function(){return s(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(u){return this.red=u,this},n.prototype.forceRed=function(u){return s(!this.red,"Already a number in reduction context"),this._forceRed(u)},n.prototype.redAdd=function(u){return s(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},n.prototype.redIAdd=function(u){return s(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},n.prototype.redSub=function(u){return s(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},n.prototype.redISub=function(u){return s(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},n.prototype.redShl=function(u){return s(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},n.prototype.redMul=function(u){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},n.prototype.redIMul=function(u){return s(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},n.prototype.redSqr=function(){return s(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return s(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return s(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return s(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return s(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(u){return s(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)};var L={k256:null,p224:null,p192:null,p25519:null};function U(u,d){this.name=u,this.p=new n(d,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}o(U,"l"),U.prototype._tmp=function(){var u=new n(null);return u.words=Array(Math.ceil(this.n/13)),u},U.prototype.ireduce=function(u){var d=u,x;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),x=d.bitLength();while(x>this.n);var A=x<this.n?-1:d.ucmp(this.p);return A===0?(d.words[0]=0,d.length=1):A>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},U.prototype.split=function(u,d){u.iushrn(this.n,0,d)},U.prototype.imulK=function(u){return u.imul(this.k)};function Z(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}o(Z,"B"),f(Z,U),Z.prototype.split=function(u,d){for(var x=4194303,A=Math.min(u.length,9),N=0;N<A;N++)d.words[N]=u.words[N];if(d.length=A,u.length<=9){u.words[0]=0,u.length=1;return}var S=u.words[9];for(d.words[d.length++]=S&x,N=10;N<u.length;N++){var c=u.words[N]|0;u.words[N-10]=(c&x)<<4|S>>>22,S=c}S>>>=22,u.words[N-10]=S,S===0&&u.length>10?u.length-=10:u.length-=9},Z.prototype.imulK=function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var d=0,x=0;x<u.length;x++){var A=u.words[x]|0;d+=A*977,u.words[x]=d&67108863,d=A*64+(d/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u};function ne(){U.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}o(ne,"s"),f(ne,U);function F(){U.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}o(F,"K8"),f(F,U);function Y(){U.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}o(Y,"p"),f(Y,U),Y.prototype.imulK=function(u){for(var d=0,x=0;x<u.length;x++){var A=(u.words[x]|0)*19+d,N=A&67108863;A>>>=26,u.words[x]=N,d=A}return d!==0&&(u.words[u.length++]=d),u},n._prime=function(u){if(L[u])return L[u];var d;if(u==="k256")d=new Z;else if(u==="p224")d=new ne;else if(u==="p192")d=new F;else if(u==="p25519")d=new Y;else throw Error("Unknown prime "+u);return L[u]=d,d};function a(u){if(typeof u=="string"){var d=n._prime(u);this.m=d.p,this.prime=d}else s(u.gtn(1),"modulus must be greater than 1"),this.m=u,this.prime=null}o(a,"D"),a.prototype._verify1=function(u){s(u.negative===0,"red works only with positives"),s(u.red,"red works only with red numbers")},a.prototype._verify2=function(u,d){s((u.negative|d.negative)===0,"red works only with positives"),s(u.red&&u.red===d.red,"red works only with red numbers")},a.prototype.imod=function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):(l(u,u.umod(this.m)._forceRed(this)),u)},a.prototype.neg=function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},a.prototype.add=function(u,d){this._verify2(u,d);var x=u.add(d);return x.cmp(this.m)>=0&&x.isub(this.m),x._forceRed(this)},a.prototype.iadd=function(u,d){this._verify2(u,d);var x=u.iadd(d);return x.cmp(this.m)>=0&&x.isub(this.m),x},a.prototype.sub=function(u,d){this._verify2(u,d);var x=u.sub(d);return x.cmpn(0)<0&&x.iadd(this.m),x._forceRed(this)},a.prototype.isub=function(u,d){this._verify2(u,d);var x=u.isub(d);return x.cmpn(0)<0&&x.iadd(this.m),x},a.prototype.shl=function(u,d){return this._verify1(u),this.imod(u.ushln(d))},a.prototype.imul=function(u,d){return this._verify2(u,d),this.imod(u.imul(d))},a.prototype.mul=function(u,d){return this._verify2(u,d),this.imod(u.mul(d))},a.prototype.isqr=function(u){return this.imul(u,u.clone())},a.prototype.sqr=function(u){return this.mul(u,u)},a.prototype.sqrt=function(u){if(u.isZero())return u.clone();var d=this.m.andln(3);if(s(d%2===1),d===3){var x=this.m.add(new n(1)).iushrn(2);return this.pow(u,x)}for(var A=this.m.subn(1),N=0;!A.isZero()&&A.andln(1)===0;)N++,A.iushrn(1);s(!A.isZero());var S=new n(1).toRed(this),c=S.redNeg(),_=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new n(2*C*C).toRed(this);this.pow(C,_).cmp(c)!==0;)C.redIAdd(c);for(var O=this.pow(C,A),D=this.pow(u,A.addn(1).iushrn(1)),B=this.pow(u,A),z=N;B.cmp(S)!==0;){for(var G=B,te=0;G.cmp(S)!==0;te++)G=G.redSqr();s(te<z);var $=this.pow(O,new n(1).iushln(z-te-1));D=D.redMul($),O=$.redSqr(),B=B.redMul(O),z=te}return D},a.prototype.invm=function(u){var d=u._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},a.prototype.pow=function(u,d){if(d.isZero())return new n(1).toRed(this);if(d.cmpn(1)===0)return u.clone();var x=4,A=Array(1<<x);A[0]=new n(1).toRed(this),A[1]=u;for(var N=2;N<A.length;N++)A[N]=this.mul(A[N-1],u);var S=A[0],c=0,_=0,C=d.bitLength()%26;for(C===0&&(C=26),N=d.length-1;N>=0;N--){for(var O=d.words[N],D=C-1;D>=0;D--){var B=O>>D&1;if(S!==A[0]&&(S=this.sqr(S)),B===0&&c===0){_=0;continue}c<<=1,c|=B,_++,!(_!==x&&(N!==0||D!==0))&&(S=this.mul(S,A[c]),_=0,c=0)}C=26}return S},a.prototype.convertTo=function(u){var d=u.umod(this.m);return d===u?d.clone():d},a.prototype.convertFrom=function(u){var d=u.clone();return d.red=null,d},n.mont=function(u){return new g(u)};function g(u){a.call(this,u),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}o(g,"M"),f(g,a),g.prototype.convertTo=function(u){return this.imod(u.ushln(this.shift))},g.prototype.convertFrom=function(u){var d=this.imod(u.mul(this.rinv));return d.red=null,d},g.prototype.imul=function(u,d){if(u.isZero()||d.isZero())return u.words[0]=0,u.length=1,u;var x=u.imul(d),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=x.isub(A).iushrn(this.shift),S=N;return N.cmp(this.m)>=0?S=N.isub(this.m):N.cmpn(0)<0&&(S=N.iadd(this.m)),S._forceRed(this)},g.prototype.mul=function(u,d){if(u.isZero()||d.isZero())return new n(0)._forceRed(this);var x=u.mul(d),A=x.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=x.isub(A).iushrn(this.shift),S=N;return N.cmp(this.m)>=0?S=N.isub(this.m):N.cmpn(0)<0&&(S=N.iadd(this.m)),S._forceRed(this)},g.prototype.invm=function(u){var d=this.imod(u._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(typeof e>"u"||e,t)}),e6=ye((t,e)=>{var r=R9(),i=Uu(),s=lr().Buffer;function f(b){var h=b.modulus.byteLength(),m;do m=new r(i(h));while(m.cmp(b.modulus)>=0||!m.umod(b.prime1)||!m.umod(b.prime2));return m}o(f,"yN");function n(b){var h=f(b),m=h.toRed(r.mont(b.modulus)).redPow(new r(b.publicExponent)).fromRed();return{blinder:m,unblinder:h.invm(b.modulus)}}o(n,"W88");function v(b,h){var m=n(h),l=h.modulus.byteLength(),w=new r(b).mul(m.blinder).umod(h.modulus),p=w.toRed(r.mont(h.prime1)),y=w.toRed(r.mont(h.prime2)),M=h.coefficient,E=h.prime1,R=h.prime2,I=p.redPow(h.exponent1).fromRed(),T=y.redPow(h.exponent2).fromRed(),P=I.isub(T).imul(M).umod(E).imul(R);return T.iadd(P).imul(m.unblinder).umod(h.modulus).toArrayLike(s,"be",l)}o(v,"xN"),v.getr=f,e.exports=v}),I9=ye((t,e)=>{var r=W2(),i=Uu(),s=Hu(),f=$2(),n=J2(),v=jr(),b=q2(),h=e6(),m=lr().Buffer;e.exports=function(y,M,E){var R;y.padding?R=y.padding:E?R=1:R=4;var I=r(y),T;if(R===4)T=l(I,M);else if(R===1)T=w(I,M,E);else if(R===3){if(T=new v(M),T.cmp(I.modulus)>=0)throw Error("data too long for modulus")}else throw Error("unknown padding");return E?h(T,I):b(T,I)};function l(y,M){var E=y.modulus.byteLength(),R=M.length,I=s("sha1").update(m.alloc(0)).digest(),T=I.length,P=2*T;if(R>E-P-2)throw Error("message too long");var j=m.alloc(E-R-P-2),L=E-T-1,U=i(T),Z=n(m.concat([I,j,m.alloc(1,1),M],L),f(U,L)),ne=n(U,f(Z,T));return new v(m.concat([m.alloc(1),ne,Z],E))}o(l,"v88");function w(y,M,E){var R=M.length,I=y.modulus.byteLength();if(R>I-11)throw Error("message too long");var T;return E?T=m.alloc(I-R-3,255):T=p(I-R-3),new v(m.concat([m.from([0,E?1:2]),T,m.alloc(1),M],I))}o(w,"T88");function p(y){for(var M=m.allocUnsafe(y),E=0,R=i(y*2),I=0,T;E<y;)I===R.length&&(R=i(y*2),I=0),T=R[I++],T&&(M[E++]=T);return M}o(p,"X88")}),O9=ye((t,e)=>{var r=W2(),i=$2(),s=J2(),f=jr(),n=e6(),v=Hu(),b=q2(),h=lr().Buffer;e.exports=function(p,y,M){var E;p.padding?E=p.padding:M?E=1:E=4;var R=r(p),I=R.modulus.byteLength();if(y.length>I||new f(y).cmp(R.modulus)>=0)throw Error("decryption error");var T;M?T=b(new f(y),R):T=n(y,R);var P=h.alloc(I-T.length);if(T=h.concat([P,T],I),E===4)return m(R,T);if(E===1)return l(R,T,M);if(E===3)return T;throw Error("unknown padding")};function m(p,y){var M=p.modulus.byteLength(),E=v("sha1").update(h.alloc(0)).digest(),R=E.length;if(y[0]!==0)throw Error("decryption error");var I=y.slice(1,R+1),T=y.slice(R+1),P=s(I,i(T,R)),j=s(T,i(P,M-R-1));if(w(E,j.slice(0,R)))throw Error("decryption error");for(var L=R;j[L]===0;)L++;if(j[L++]!==1)throw Error("decryption error");return j.slice(L)}o(m,"Z88");function l(p,y,M){for(var E=y.slice(0,2),R=2,I=0;y[R++]!==0;)if(R>=y.length){I++;break}var T=y.slice(2,R-1);if((E.toString("hex")!=="0002"&&!M||E.toString("hex")!=="0001"&&M)&&I++,T.length<8&&I++,I)throw Error("decryption error");return y.slice(R)}o(l,"V88");function w(p,y){p=h.from(p),y=h.from(y);var M=0,E=p.length;p.length!==y.length&&(M++,E=Math.min(p.length,y.length));for(var R=-1;++R<E;)M+=p[R]^y[R];return M}o(w,"M88")}),Jc=ye(t=>{t.publicEncrypt=I9(),t.privateDecrypt=O9(),t.privateEncrypt=function(e,r){return t.publicEncrypt(e,r,!0)},t.publicDecrypt=function(e,r){return t.privateDecrypt(e,r,!0)}}),T9=ye(t=>{var e=(qt(),bt(Jt));typeof e.publicEncrypt!="function"&&(e=Jc()),t.publicEncrypt=e.publicEncrypt,t.privateDecrypt=e.privateDecrypt,typeof e.privateEncrypt!="function"?t.privateEncrypt=Jc().privateEncrypt:t.privateEncrypt=e.privateEncrypt,typeof e.publicDecrypt!="function"?t.publicDecrypt=Jc().publicDecrypt:t.publicDecrypt=e.publicDecrypt}),P9=ye(t=>{function e(){throw Error(`secure random number generation not supported by this browser
|
|
43
|
-
use chrome, FireFox or Internet Explorer 11`)}o(e,"iN");var r=lr();Uu();var i=r.Buffer,s=r.kMaxLength,f=globalThis.crypto||globalThis.msCrypto,n=Math.pow(2,32)-1;function v(w,p){if(typeof w!="number"||w!==w)throw TypeError("offset must be a number");if(w>n||w<0)throw TypeError("offset must be a uint32");if(w>s||w>p)throw RangeError("offset out of range")}o(v,"$R");function b(w,p,y){if(typeof w!="number"||w!==w)throw TypeError("size must be a number");if(w>n||w<0)throw TypeError("size must be a uint32");if(w+p>y||w>s)throw RangeError("buffer too small")}o(b,"KR"),f&&f.getRandomValues?(t.randomFill=h,t.randomFillSync=l):(t.randomFill=e,t.randomFillSync=e);function h(w,p,y,M){if(!i.isBuffer(w)&&!(w instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof p=="function")M=p,p=0,y=w.length;else if(typeof y=="function")M=y,y=w.length-p;else if(typeof M!="function")throw TypeError('"cb" argument must be a function');return v(p,w.length),b(y,p,w.length),m(w,p,y,M)}o(h,"g88");function m(w,p,y,M){var E=w.buffer,R=new Uint8Array(E,p,y);if(f.getRandomValues(R),M){process.nextTick(function(){M(null,w)});return}return w}o(m,"_R");function l(w,p,y){if(typeof p>"u"&&(p=0),!i.isBuffer(w)&&!(w instanceof globalThis.Uint8Array))throw TypeError('"buf" argument must be a Buffer or Uint8Array');return v(p,w.length),y===void 0&&(y=w.length-p),b(y,p,w.length),m(w,p,y)}o(l,"y88")}),j9=ye((t,e)=>{var r=(qt(),bt(Jt));typeof r.randomFill=="function"&&typeof r.randomFillSync=="function"?(t.randomFill=r.randomFill,t.randomFillSync=r.randomFillSync):e.exports=P9()}),L9=ye(t=>{t.randomBytes=t.rng=t.pseudoRandomBytes=t.prng=Uu(),t.createHash=t.Hash=Hu(),t.createHmac=t.Hmac=q7();var e=e_(),r=Object.keys(e),i=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(r);t.getHashes=function(){return i};var s=z2();t.pbkdf2=s.pbkdf2,t.pbkdf2Sync=s.pbkdf2Sync;var f=G_();t.Cipher=f.Cipher,t.createCipher=f.createCipher,t.Cipheriv=f.Cipheriv,t.createCipheriv=f.createCipheriv,t.Decipher=f.Decipher,t.createDecipher=f.createDecipher,t.Decipheriv=f.Decipheriv,t.createDecipheriv=f.createDecipheriv,t.getCiphers=f.getCiphers,t.listCiphers=f.listCiphers;var n=Y_();t.DiffieHellmanGroup=n.DiffieHellmanGroup,t.createDiffieHellmanGroup=n.createDiffieHellmanGroup,t.getDiffieHellman=n.getDiffieHellman,t.createDiffieHellman=n.createDiffieHellman,t.DiffieHellman=n.DiffieHellman;var v=Q_();t.createSign=v.createSign,t.Sign=v.Sign,t.createVerify=v.createVerify,t.Verify=v.Verify,t.createECDH=p9();var b=T9();t.publicEncrypt=b.publicEncrypt,t.privateEncrypt=b.privateEncrypt,t.publicDecrypt=b.publicDecrypt,t.privateDecrypt=b.privateDecrypt;var h=j9();t.randomFill=h.randomFill,t.randomFillSync=h.randomFillSync,t.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
|
|
44
|
-
we accept pull requests
|
|
45
|
-
https://github.com/browserify/crypto-browserify`)},t.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}}),Vd;(t=>{t.IMAGE="image",t.VIDEO="video",t.AUDIO="audio",t.DOCUMENT="document",t.LINK="link"})(Vd||={});var D9;(t=>{t.DOCUMENT="document",t.FRAGMENT="fragment",t.MESSAGE="message",t.DESCRIPTION="description",t.CUSTOM="custom"})(D9||={});var B9;(t=>{t.SHARED="shared",t.PRIVATE="private"})(B9||={});var z9;(t=>t.KNOWLEDGE="knowledge")(z9||={});var F9;(t=>{t.OWNER="OWNER",t.ADMIN="ADMIN",t.NONE="NONE"})(F9||={});var vt;(t=>{t.SELF="SELF",t.DM="DM",t.GROUP="GROUP",t.VOICE_DM="VOICE_DM",t.VOICE_GROUP="VOICE_GROUP",t.FEED="FEED",t.THREAD="THREAD",t.WORLD="WORLD",t.FORUM="FORUM",t.API="API"})(vt||={});var pr;(t=>{t.ACTIVE="active",t.INACTIVE="inactive"})(pr||={});var U9;(t=>{t.WORLD_JOINED="WORLD_JOINED",t.WORLD_CONNECTED="WORLD_CONNECTED",t.WORLD_LEFT="WORLD_LEFT",t.ENTITY_JOINED="ENTITY_JOINED",t.ENTITY_LEFT="ENTITY_LEFT",t.ENTITY_UPDATED="ENTITY_UPDATED",t.ROOM_JOINED="ROOM_JOINED",t.ROOM_LEFT="ROOM_LEFT",t.MESSAGE_RECEIVED="MESSAGE_RECEIVED",t.MESSAGE_SENT="MESSAGE_SENT",t.MESSAGE_DELETED="MESSAGE_DELETED",t.CHANNEL_CLEARED="CHANNEL_CLEARED",t.VOICE_MESSAGE_RECEIVED="VOICE_MESSAGE_RECEIVED",t.VOICE_MESSAGE_SENT="VOICE_MESSAGE_SENT",t.REACTION_RECEIVED="REACTION_RECEIVED",t.POST_GENERATED="POST_GENERATED",t.INTERACTION_RECEIVED="INTERACTION_RECEIVED",t.RUN_STARTED="RUN_STARTED",t.RUN_ENDED="RUN_ENDED",t.RUN_TIMEOUT="RUN_TIMEOUT",t.ACTION_STARTED="ACTION_STARTED",t.ACTION_COMPLETED="ACTION_COMPLETED",t.EVALUATOR_STARTED="EVALUATOR_STARTED",t.EVALUATOR_COMPLETED="EVALUATOR_COMPLETED",t.MODEL_USED="MODEL_USED",t.EMBEDDING_GENERATION_REQUESTED="EMBEDDING_GENERATION_REQUESTED",t.EMBEDDING_GENERATION_COMPLETED="EMBEDDING_GENERATION_COMPLETED",t.EMBEDDING_GENERATION_FAILED="EMBEDDING_GENERATION_FAILED"})(U9||={});var H9;(t=>{t.DISCORD="DISCORD",t.TELEGRAM="TELEGRAM",t.TWITTER="TWITTER"})(H9||={});var V9;(t=>{t.OFF="OFF",t.LOCAL="LOCAL",t.DOCKER="DOCKER",t.PRODUCTION="PRODUCTION"})(V9||={});var Z9;(t=>t.TDX_DSTACK="tdx_dstack")(Z9||={});var Zd;(t=>{t[t.ROOM_JOINING=1]="ROOM_JOINING",t[t.SEND_MESSAGE=2]="SEND_MESSAGE",t[t.MESSAGE=3]="MESSAGE",t[t.ACK=4]="ACK",t[t.THINKING=5]="THINKING",t[t.CONTROL=6]="CONTROL"})(Zd||={});var G9={};Rn(G9,{void:o(()=>CM,"void"),util:o(()=>Bt,"util"),unknown:o(()=>kM,"unknown"),union:o(()=>TM,"union"),undefined:o(()=>SM,"undefined"),tuple:o(()=>LM,"tuple"),transformer:o(()=>_m,"transformer"),symbol:o(()=>MM,"symbol"),string:o(()=>o6,"string"),strictObject:o(()=>OM,"strictObject"),setErrorMap:o(()=>K9,"setErrorMap"),set:o(()=>zM,"set"),record:o(()=>DM,"record"),quotelessJson:o(()=>Y9,"quotelessJson"),promise:o(()=>GM,"promise"),preprocess:o(()=>KM,"preprocess"),pipeline:o(()=>XM,"pipeline"),ostring:o(()=>WM,"ostring"),optional:o(()=>YM,"optional"),onumber:o(()=>$M,"onumber"),oboolean:o(()=>JM,"oboolean"),objectUtil:o(()=>Gd,"objectUtil"),object:o(()=>IM,"object"),number:o(()=>l6,"number"),nullable:o(()=>QM,"nullable"),null:o(()=>EM,"null"),never:o(()=>NM,"never"),nativeEnum:o(()=>ZM,"nativeEnum"),nan:o(()=>wM,"nan"),map:o(()=>BM,"map"),makeIssue:o(()=>Hl,"makeIssue"),literal:o(()=>HM,"literal"),lazy:o(()=>UM,"lazy"),late:o(()=>bM,"late"),isValid:o(()=>os,"isValid"),isDirty:o(()=>Qd,"isDirty"),isAsync:o(()=>qa,"isAsync"),isAborted:o(()=>Yd,"isAborted"),intersection:o(()=>jM,"intersection"),instanceof:o(()=>yM,"instanceof"),getParsedType:o(()=>Ji,"getParsedType"),getErrorMap:o(()=>Ul,"getErrorMap"),function:o(()=>FM,"function"),enum:o(()=>VM,"enum"),effect:o(()=>_m,"effect"),discriminatedUnion:o(()=>PM,"discriminatedUnion"),defaultErrorMap:o(()=>Hs,"defaultErrorMap"),datetimeRegex:o(()=>n6,"datetimeRegex"),date:o(()=>_M,"date"),custom:o(()=>a6,"custom"),coerce:o(()=>qM,"coerce"),boolean:o(()=>u6,"boolean"),bigint:o(()=>xM,"bigint"),array:o(()=>RM,"array"),any:o(()=>AM,"any"),addIssueToContext:o(()=>at,"addIssueToContext"),ZodVoid:o(()=>Zl,"ZodVoid"),ZodUnknown:o(()=>qn,"ZodUnknown"),ZodUnion:o(()=>io,"ZodUnion"),ZodUndefined:o(()=>to,"ZodUndefined"),ZodType:o(()=>It,"ZodType"),ZodTuple:o(()=>Ni,"ZodTuple"),ZodTransformer:o(()=>ci,"ZodTransformer"),ZodSymbol:o(()=>Vl,"ZodSymbol"),ZodString:o(()=>si,"ZodString"),ZodSet:o(()=>us,"ZodSet"),ZodSchema:o(()=>It,"ZodSchema"),ZodRecord:o(()=>so,"ZodRecord"),ZodReadonly:o(()=>fo,"ZodReadonly"),ZodPromise:o(()=>Zs,"ZodPromise"),ZodPipeline:o(()=>Ho,"ZodPipeline"),ZodParsedType:o(()=>ct,"ZodParsedType"),ZodOptional:o(()=>Si,"ZodOptional"),ZodObject:o(()=>ir,"ZodObject"),ZodNumber:o(()=>xn,"ZodNumber"),ZodNullable:o(()=>Sn,"ZodNullable"),ZodNull:o(()=>ro,"ZodNull"),ZodNever:o(()=>rn,"ZodNever"),ZodNativeEnum:o(()=>lo,"ZodNativeEnum"),ZodNaN:o(()=>Yl,"ZodNaN"),ZodMap:o(()=>Gl,"ZodMap"),ZodLiteral:o(()=>oo,"ZodLiteral"),ZodLazy:o(()=>ao,"ZodLazy"),ZodIssueCode:o(()=>tt,"ZodIssueCode"),ZodIntersection:o(()=>no,"ZodIntersection"),ZodFunction:o(()=>Ds,"ZodFunction"),ZodFirstPartyTypeKind:o(()=>_t,"ZodFirstPartyTypeKind"),ZodError:o(()=>Ur,"ZodError"),ZodEnum:o(()=>Mn,"ZodEnum"),ZodEffects:o(()=>ci,"ZodEffects"),ZodDiscriminatedUnion:o(()=>Gu,"ZodDiscriminatedUnion"),ZodDefault:o(()=>uo,"ZodDefault"),ZodDate:o(()=>ls,"ZodDate"),ZodCatch:o(()=>co,"ZodCatch"),ZodBranded:o(()=>tp,"ZodBranded"),ZodBoolean:o(()=>eo,"ZodBoolean"),ZodBigInt:o(()=>_n,"ZodBigInt"),ZodArray:o(()=>oi,"ZodArray"),ZodAny:o(()=>Vs,"ZodAny"),Schema:o(()=>It,"Schema"),ParseStatus:o(()=>_r,"ParseStatus"),OK:o(()=>kr,"OK"),NEVER:o(()=>eS,"NEVER"),INVALID:o(()=>wt,"INVALID"),EMPTY_PATH:o(()=>X9,"EMPTY_PATH"),DIRTY:o(()=>Rs,"DIRTY"),BRAND:o(()=>vM,"BRAND")});var Bt;(function(t){t.assertEqual=s=>{};function e(s){}o(e,"$"),t.assertIs=e;function r(s){throw Error()}o(r,"K"),t.assertNever=r,t.arrayToEnum=s=>{let f={};for(let n of s)f[n]=n;return f},t.getValidEnumValues=s=>{let f=t.objectKeys(s).filter(v=>typeof s[s[v]]!="number"),n={};for(let v of f)n[v]=s[v];return t.objectValues(n)},t.objectValues=s=>t.objectKeys(s).map(function(f){return s[f]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let f=[];for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&f.push(n);return f},t.find=(s,f)=>{for(let n of s)if(f(n))return n},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function i(s,f=" | "){return s.map(n=>typeof n=="string"?`'${n}'`:n).join(f)}o(i,"_"),t.joinValues=i,t.jsonStringifyReplacer=(s,f)=>typeof f=="bigint"?f.toString():f})(Bt||(Bt={}));var Gd;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Gd||(Gd={}));var ct=Bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ji=o(t=>{switch(typeof t){case"undefined":return ct.undefined;case"string":return ct.string;case"number":return Number.isNaN(t)?ct.nan:ct.number;case"boolean":return ct.boolean;case"function":return ct.function;case"bigint":return ct.bigint;case"symbol":return ct.symbol;case"object":return Array.isArray(t)?ct.array:t===null?ct.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ct.promise:typeof Map<"u"&&t instanceof Map?ct.map:typeof Set<"u"&&t instanceof Set?ct.set:typeof Date<"u"&&t instanceof Date?ct.date:ct.object;default:return ct.unknown}},"y$"),tt=Bt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Y9=o(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"uR");class Ur extends Error{static{o(this,"S4")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(f){return f.message},i={_errors:[]},s=o(f=>{for(let n of f.issues)if(n.code==="invalid_union")n.unionErrors.map(s);else if(n.code==="invalid_return_type")s(n.returnTypeError);else if(n.code==="invalid_arguments")s(n.argumentsError);else if(n.path.length===0)i._errors.push(r(n));else{let v=i,b=0;for(;b<n.path.length;){let h=n.path[b];b!==n.path.length-1?v[h]=v[h]||{_errors:[]}:(v[h]=v[h]||{_errors:[]},v[h]._errors.push(r(n))),v=v[h],b++}}},"_");return s(this),i}static assert(e){if(!(e instanceof Ur))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Bt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let s of this.issues)if(s.path.length>0){let f=s.path[0];r[f]=r[f]||[],r[f].push(e(s))}else i.push(e(s));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}Ur.create=t=>new Ur(t);var Q9=o((t,e)=>{let r;switch(t.code){case tt.invalid_type:t.received===ct.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case tt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Bt.jsonStringifyReplacer)}`;break;case tt.unrecognized_keys:r=`Unrecognized key(s) in object: ${Bt.joinValues(t.keys,", ")}`;break;case tt.invalid_union:r="Invalid input";break;case tt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Bt.joinValues(t.options)}`;break;case tt.invalid_enum_value:r=`Invalid enum value. Expected ${Bt.joinValues(t.options)}, received '${t.received}'`;break;case tt.invalid_arguments:r="Invalid function arguments";break;case tt.invalid_return_type:r="Invalid function return type";break;case tt.invalid_date:r="Invalid date";break;case tt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Bt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case tt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case tt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case tt.custom:r="Invalid input";break;case tt.invalid_intersection_types:r="Intersection results could not be merged";break;case tt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case tt.not_finite:r="Number must be finite";break;default:r=e.defaultError,Bt.assertNever(t)}return{message:r}},"mR"),Hs=Q9,t6=Hs;function K9(t){t6=t}o(K9,"dR");function Ul(){return t6}o(Ul,"h9");var Hl=o(t=>{let{data:e,path:r,errorMaps:i,issueData:s}=t,f=[...r,...s.path||[]],n={...s,path:f};if(s.message!==void 0)return{...s,path:f,message:s.message};let v="",b=i.filter(h=>!!h).slice().reverse();for(let h of b)v=h(n,{data:e,defaultError:v}).message;return{...s,path:f,message:v}},"E5"),X9=[];function at(t,e){let r=Ul(),i=Hl({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Hs?void 0:Hs].filter(s=>!!s)});t.common.issues.push(i)}o(at,"U8");class _r{static{o(this,"lq")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let s of r){if(s.status==="aborted")return wt;s.status==="dirty"&&e.dirty(),i.push(s.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let s of r){let f=await s.key,n=await s.value;i.push({key:f,value:n})}return _r.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let s of r){let{key:f,value:n}=s;if(f.status==="aborted"||n.status==="aborted")return wt;f.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),f.value!=="__proto__"&&(typeof n.value<"u"||s.alwaysSet)&&(i[f.value]=n.value)}return{status:e.value,value:i}}}var wt=Object.freeze({status:"aborted"}),Rs=o(t=>({status:"dirty",value:t}),"g7"),kr=o(t=>({status:"valid",value:t}),"sq"),Yd=o(t=>t.status==="aborted","I_"),Qd=o(t=>t.status==="dirty","h_"),os=o(t=>t.status==="valid","Q1"),qa=o(t=>typeof Promise<"u"&&t instanceof Promise,"L9"),mt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(mt||(mt={}));class ki{static{o(this,"z$")}constructor(e,r,i,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}var wm=o((t,e)=>{if(os(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Ur(t.common.issues);return this._error=r,this._error}}},"Rz");function Et(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:s}=t;if(e&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:o((f,n)=>{let{message:v}=t;return f.code==="invalid_enum_value"?{message:v??n.defaultError}:typeof n.data>"u"?{message:v??i??n.defaultError}:f.code!=="invalid_type"?{message:n.defaultError}:{message:v??r??n.defaultError}},"errorMap"),description:s}}o(Et,"E6");class It{static{o(this,"I6")}get description(){return this._def.description}_getType(e){return Ji(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Ji(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _r,ctx:{common:e.parent.common,data:e.data,parsedType:Ji(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(qa(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ji(e)},s=this._parseSync({data:e,path:i.path,parent:i});return wm(i,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ji(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return os(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>os(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ji(e)},s=this._parse({data:e,path:i.path,parent:i}),f=await(qa(s)?s:Promise.resolve(s));return wm(i,f)}refine(e,r){let i=o(s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r,"K");return this._refinement((s,f)=>{let n=e(s),v=o(()=>f.addIssue({code:tt.custom,...i(s)}),"Y");return typeof Promise<"u"&&n instanceof Promise?n.then(b=>b?!0:(v(),!1)):n?!0:(v(),!1)})}refinement(e,r){return this._refinement((i,s)=>e(i)?!0:(s.addIssue(typeof r=="function"?r(i,s):r),!1))}_refinement(e){return new ci({schema:this,typeName:_t.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(r=>this["~validate"](r),"validate")}}optional(){return Si.create(this,this._def)}nullable(){return Sn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oi.create(this)}promise(){return Zs.create(this,this._def)}or(e){return io.create([this,e],this._def)}and(e){return no.create(this,e,this._def)}transform(e){return new ci({...Et(this._def),schema:this,typeName:_t.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new uo({...Et(this._def),innerType:this,defaultValue:r,typeName:_t.ZodDefault})}brand(){return new tp({typeName:_t.ZodBranded,type:this,...Et(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new co({...Et(this._def),innerType:this,catchValue:r,typeName:_t.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Ho.create(this,e)}readonly(){return fo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var W9=/^c[^\s-]{8,}$/i,$9=/^[0-9a-z]+$/,J9=/^[0-9A-HJKMNP-TV-Z]{26}$/i,q9=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,eM=/^[a-z0-9_-]{21}$/i,tM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rM=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qc,sM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,aM=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,oM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,lM=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,uM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,r6="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fM=new RegExp(`^${r6}$`);function i6(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}o(i6,"hz");function dM(t){return new RegExp(`^${i6(t)}$`)}o(dM,"PD");function n6(t){let e=`${r6}T${i6(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}o(n6,"Lz");function hM(t,e){return!!((e==="v4"||!e)&&sM.test(t)||(e==="v6"||!e)&&oM.test(t))}o(hM,"YD");function pM(t,e){if(!tM.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(i));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}o(pM,"OD");function mM(t,e){return!!((e==="v4"||!e)&&aM.test(t)||(e==="v6"||!e)&&lM.test(t))}o(mM,"jD");class si extends It{static{o(this,"W$")}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ct.string){let s=this._getOrReturnCtx(e);return at(s,{code:tt.invalid_type,expected:ct.string,received:s.parsedType}),wt}let r=new _r,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),at(i,{code:tt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),at(i,{code:tt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let f=e.data.length>s.value,n=e.data.length<s.value;(f||n)&&(i=this._getOrReturnCtx(e,i),f?at(i,{code:tt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):n&&at(i,{code:tt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")iM.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"email",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")qc||(qc=new RegExp(nM,"u")),qc.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"emoji",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")q9.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"uuid",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")eM.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"nanoid",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")W9.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"cuid",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")$9.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"cuid2",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")J9.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"ulid",code:tt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),at(i,{validation:"url",code:tt.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,!s.regex.test(e.data)&&(i=this._getOrReturnCtx(e,i),at(i,{validation:"regex",code:tt.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),at(i,{code:tt.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),at(i,{code:tt.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),at(i,{code:tt.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?n6(s).test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{code:tt.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?fM.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{code:tt.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?dM(s).test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{code:tt.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?rM.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"duration",code:tt.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?hM(e.data,s.version)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"ip",code:tt.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?pM(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"jwt",code:tt.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?mM(e.data,s.version)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"cidr",code:tt.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?uM.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"base64",code:tt.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?cM.test(e.data)||(i=this._getOrReturnCtx(e,i),at(i,{validation:"base64url",code:tt.invalid_string,message:s.message}),r.dirty()):Bt.assertNever(s);return{status:r.value,value:e.data}}_regex(e,r,i){return this.refinement(s=>e.test(s),{validation:r,code:tt.invalid_string,...mt.errToObj(i)})}_addCheck(e){return new si({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...mt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...mt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...mt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...mt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...mt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...mt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...mt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...mt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...mt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...mt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...mt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...mt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...mt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...mt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...mt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...mt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...mt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...mt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...mt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...mt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...mt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...mt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...mt.errToObj(r)})}nonempty(e){return this.min(1,mt.errToObj(e))}trim(){return new si({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new si({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new si({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}si.create=t=>new si({checks:[],typeName:_t.ZodString,coerce:t?.coerce??!1,...Et(t)});function gM(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,s=r>i?r:i,f=Number.parseInt(t.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return f%n/10**s}o(gM,"WD");class xn extends It{static{o(this,"t1")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ct.number){let s=this._getOrReturnCtx(e);return at(s,{code:tt.invalid_type,expected:ct.number,received:s.parsedType}),wt}let r,i=new _r;for(let s of this._def.checks)s.kind==="int"?Bt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),at(r,{code:tt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),at(r,{code:tt.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),at(r,{code:tt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?gM(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),at(r,{code:tt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),at(r,{code:tt.not_finite,message:s.message}),i.dirty()):Bt.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,mt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,mt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,mt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,mt.toString(r))}setLimit(e,r,i,s){return new xn({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:mt.toString(s)}]})}_addCheck(e){return new xn({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:mt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:mt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:mt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:mt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:mt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:mt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Bt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}}xn.create=t=>new xn({checks:[],typeName:_t.ZodNumber,coerce:t?.coerce||!1,...Et(t)});class _n extends It{static{o(this,"a1")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ct.bigint)return this._getInvalidInput(e);let r,i=new _r;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),at(r,{code:tt.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),at(r,{code:tt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),at(r,{code:tt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Bt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.bigint,received:r.parsedType}),wt}gte(e,r){return this.setLimit("min",e,!0,mt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,mt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,mt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,mt.toString(r))}setLimit(e,r,i,s){return new _n({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:mt.toString(s)}]})}_addCheck(e){return new _n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:mt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:mt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:mt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:mt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:mt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}_n.create=t=>new _n({checks:[],typeName:_t.ZodBigInt,coerce:t?.coerce??!1,...Et(t)});class eo extends It{static{o(this,"y9")}_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ct.boolean){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.boolean,received:r.parsedType}),wt}return kr(e.data)}}eo.create=t=>new eo({typeName:_t.ZodBoolean,coerce:t?.coerce||!1,...Et(t)});class ls extends It{static{o(this,"y7")}_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ct.date){let s=this._getOrReturnCtx(e);return at(s,{code:tt.invalid_type,expected:ct.date,received:s.parsedType}),wt}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return at(s,{code:tt.invalid_date}),wt}let r=new _r,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),at(i,{code:tt.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),at(i,{code:tt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Bt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ls({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:mt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:mt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ls.create=t=>new ls({checks:[],coerce:t?.coerce||!1,typeName:_t.ZodDate,...Et(t)});class Vl extends It{static{o(this,"N5")}_parse(e){if(this._getType(e)!==ct.symbol){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.symbol,received:r.parsedType}),wt}return kr(e.data)}}Vl.create=t=>new Vl({typeName:_t.ZodSymbol,...Et(t)});class to extends It{static{o(this,"x9")}_parse(e){if(this._getType(e)!==ct.undefined){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.undefined,received:r.parsedType}),wt}return kr(e.data)}}to.create=t=>new to({typeName:_t.ZodUndefined,...Et(t)});class ro extends It{static{o(this,"p9")}_parse(e){if(this._getType(e)!==ct.null){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.null,received:r.parsedType}),wt}return kr(e.data)}}ro.create=t=>new ro({typeName:_t.ZodNull,...Et(t)});class Vs extends It{static{o(this,"x7")}constructor(){super(...arguments),this._any=!0}_parse(e){return kr(e.data)}}Vs.create=t=>new Vs({typeName:_t.ZodAny,...Et(t)});class qn extends It{static{o(this,"i1")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return kr(e.data)}}qn.create=t=>new qn({typeName:_t.ZodUnknown,...Et(t)});class rn extends It{static{o(this,"x$")}_parse(e){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.never,received:r.parsedType}),wt}}rn.create=t=>new rn({typeName:_t.ZodNever,...Et(t)});class Zl extends It{static{o(this,"R5")}_parse(e){if(this._getType(e)!==ct.undefined){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.void,received:r.parsedType}),wt}return kr(e.data)}}Zl.create=t=>new Zl({typeName:_t.ZodVoid,...Et(t)});class oi extends It{static{o(this,"H$")}_parse(e){let{ctx:r,status:i}=this._processInputParams(e),s=this._def;if(r.parsedType!==ct.array)return at(r,{code:tt.invalid_type,expected:ct.array,received:r.parsedType}),wt;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,v=r.data.length<s.exactLength.value;(n||v)&&(at(r,{code:n?tt.too_big:tt.too_small,minimum:v?s.exactLength.value:void 0,maximum:n?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),i.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(at(r,{code:tt.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),i.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(at(r,{code:tt.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((n,v)=>s.type._parseAsync(new ki(r,n,r.path,v)))).then(n=>_r.mergeArray(i,n));let f=[...r.data].map((n,v)=>s.type._parseSync(new ki(r,n,r.path,v)));return _r.mergeArray(i,f)}get element(){return this._def.type}min(e,r){return new oi({...this._def,minLength:{value:e,message:mt.toString(r)}})}max(e,r){return new oi({...this._def,maxLength:{value:e,message:mt.toString(r)}})}length(e,r){return new oi({...this._def,exactLength:{value:e,message:mt.toString(r)}})}nonempty(e){return this.min(1,e)}}oi.create=(t,e)=>new oi({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_t.ZodArray,...Et(e)});function Es(t){if(t instanceof ir){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Si.create(Es(i))}return new ir({...t._def,shape:o(()=>e,"shape")})}else return t instanceof oi?new oi({...t._def,type:Es(t.element)}):t instanceof Si?Si.create(Es(t.unwrap())):t instanceof Sn?Sn.create(Es(t.unwrap())):t instanceof Ni?Ni.create(t.items.map(e=>Es(e))):t}o(Es,"b9");class ir extends It{static{o(this,"Gq")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Bt.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ct.object){let b=this._getOrReturnCtx(e);return at(b,{code:tt.invalid_type,expected:ct.object,received:b.parsedType}),wt}let{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:f}=this._getCached(),n=[];if(!(this._def.catchall instanceof rn&&this._def.unknownKeys==="strip"))for(let b in i.data)f.includes(b)||n.push(b);let v=[];for(let b of f){let h=s[b],m=i.data[b];v.push({key:{status:"valid",value:b},value:h._parse(new ki(i,m,i.path,b)),alwaysSet:b in i.data})}if(this._def.catchall instanceof rn){let b=this._def.unknownKeys;if(b==="passthrough")for(let h of n)v.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(b==="strict")n.length>0&&(at(i,{code:tt.unrecognized_keys,keys:n}),r.dirty());else if(b!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let b=this._def.catchall;for(let h of n){let m=i.data[h];v.push({key:{status:"valid",value:h},value:b._parse(new ki(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let b=[];for(let h of v){let m=await h.key,l=await h.value;b.push({key:m,value:l,alwaysSet:h.alwaysSet})}return b}).then(b=>_r.mergeObjectSync(r,b)):_r.mergeObjectSync(r,v)}get shape(){return this._def.shape()}strict(e){return mt.errToObj,new ir({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:o((r,i)=>{let s=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:mt.errToObj(e).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new ir({...this._def,unknownKeys:"strip"})}passthrough(){return new ir({...this._def,unknownKeys:"passthrough"})}extend(e){return new ir({...this._def,shape:o(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new ir({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:o(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:_t.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ir({...this._def,catchall:e})}pick(e){let r={};for(let i of Bt.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new ir({...this._def,shape:o(()=>r,"shape")})}omit(e){let r={};for(let i of Bt.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new ir({...this._def,shape:o(()=>r,"shape")})}deepPartial(){return Es(this)}partial(e){let r={};for(let i of Bt.objectKeys(this.shape)){let s=this.shape[i];e&&!e[i]?r[i]=s:r[i]=s.optional()}return new ir({...this._def,shape:o(()=>r,"shape")})}required(e){let r={};for(let i of Bt.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Si;)s=s._def.innerType;r[i]=s}return new ir({...this._def,shape:o(()=>r,"shape")})}keyof(){return s6(Bt.objectKeys(this.shape))}}ir.create=(t,e)=>new ir({shape:o(()=>t,"shape"),unknownKeys:"strip",catchall:rn.create(),typeName:_t.ZodObject,...Et(e)});ir.strictCreate=(t,e)=>new ir({shape:o(()=>t,"shape"),unknownKeys:"strict",catchall:rn.create(),typeName:_t.ZodObject,...Et(e)});ir.lazycreate=(t,e)=>new ir({shape:t,unknownKeys:"strip",catchall:rn.create(),typeName:_t.ZodObject,...Et(e)});class io extends It{static{o(this,"c9")}_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function s(f){for(let v of f)if(v.result.status==="valid")return v.result;for(let v of f)if(v.result.status==="dirty")return r.common.issues.push(...v.ctx.common.issues),v.result;let n=f.map(v=>new Ur(v.ctx.common.issues));return at(r,{code:tt.invalid_union,unionErrors:n}),wt}if(o(s,"_"),r.common.async)return Promise.all(i.map(async f=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await f._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let f,n=[];for(let b of i){let h={...r,common:{...r.common,issues:[]},parent:null},m=b._parseSync({data:r.data,path:r.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!f&&(f={result:m,ctx:h}),h.common.issues.length&&n.push(h.common.issues)}if(f)return r.common.issues.push(...f.ctx.common.issues),f.result;let v=n.map(b=>new Ur(b));return at(r,{code:tt.invalid_union,unionErrors:v}),wt}}get options(){return this._def.options}}io.create=(t,e)=>new io({options:t,typeName:_t.ZodUnion,...Et(e)});var Qi=o(t=>t instanceof ao?Qi(t.schema):t instanceof ci?Qi(t.innerType()):t instanceof oo?[t.value]:t instanceof Mn?t.options:t instanceof lo?Bt.objectValues(t.enum):t instanceof uo?Qi(t._def.innerType):t instanceof to?[void 0]:t instanceof ro?[null]:t instanceof Si?[void 0,...Qi(t.unwrap())]:t instanceof Sn?[null,...Qi(t.unwrap())]:t instanceof tp||t instanceof fo?Qi(t.unwrap()):t instanceof co?Qi(t._def.innerType):[],"w1");class Gu extends It{static{o(this,"L_")}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ct.object)return at(r,{code:tt.invalid_type,expected:ct.object,received:r.parsedType}),wt;let i=this.discriminator,s=r.data[i],f=this.optionsMap.get(s);return f?r.common.async?f._parseAsync({data:r.data,path:r.path,parent:r}):f._parseSync({data:r.data,path:r.path,parent:r}):(at(r,{code:tt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),wt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let s=new Map;for(let f of r){let n=Qi(f.shape[e]);if(!n.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let v of n){if(s.has(v))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(v)}`);s.set(v,f)}}return new Gu({typeName:_t.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Et(i)})}}function Kd(t,e){let r=Ji(t),i=Ji(e);if(t===e)return{valid:!0,data:t};if(r===ct.object&&i===ct.object){let s=Bt.objectKeys(e),f=Bt.objectKeys(t).filter(v=>s.indexOf(v)!==-1),n={...t,...e};for(let v of f){let b=Kd(t[v],e[v]);if(!b.valid)return{valid:!1};n[v]=b.data}return{valid:!0,data:n}}else if(r===ct.array&&i===ct.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let f=0;f<t.length;f++){let n=t[f],v=e[f],b=Kd(n,v);if(!b.valid)return{valid:!1};s.push(b.data)}return{valid:!0,data:s}}else return r===ct.date&&i===ct.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}o(Kd,"tY");class no extends It{static{o(this,"u9")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=o((f,n)=>{if(Yd(f)||Yd(n))return wt;let v=Kd(f.value,n.value);return v.valid?((Qd(f)||Qd(n))&&r.dirty(),{status:r.value,value:v.data}):(at(i,{code:tt.invalid_intersection_types}),wt)},"_");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([f,n])=>s(f,n)):s(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}no.create=(t,e,r)=>new no({left:t,right:e,typeName:_t.ZodIntersection,...Et(r)});class Ni extends It{static{o(this,"p$")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ct.array)return at(i,{code:tt.invalid_type,expected:ct.array,received:i.parsedType}),wt;if(i.data.length<this._def.items.length)return at(i,{code:tt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),wt;!this._def.rest&&i.data.length>this._def.items.length&&(at(i,{code:tt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...i.data].map((f,n)=>{let v=this._def.items[n]||this._def.rest;return v?v._parse(new ki(i,f,i.path,n)):null}).filter(f=>!!f);return i.common.async?Promise.all(s).then(f=>_r.mergeArray(r,f)):_r.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Ni({...this._def,rest:e})}}Ni.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ni({items:t,typeName:_t.ZodTuple,rest:null,...Et(e)})};class so extends It{static{o(this,"D5")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ct.object)return at(i,{code:tt.invalid_type,expected:ct.object,received:i.parsedType}),wt;let s=[],f=this._def.keyType,n=this._def.valueType;for(let v in i.data)s.push({key:f._parse(new ki(i,v,i.path,v)),value:n._parse(new ki(i,i.data[v],i.path,v)),alwaysSet:v in i.data});return i.common.async?_r.mergeObjectAsync(r,s):_r.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof It?new so({keyType:e,valueType:r,typeName:_t.ZodRecord,...Et(i)}):new so({keyType:si.create(),valueType:e,typeName:_t.ZodRecord,...Et(r)})}}class Gl extends It{static{o(this,"I5")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ct.map)return at(i,{code:tt.invalid_type,expected:ct.map,received:i.parsedType}),wt;let s=this._def.keyType,f=this._def.valueType,n=[...i.data.entries()].map(([v,b],h)=>({key:s._parse(new ki(i,v,i.path,[h,"key"])),value:f._parse(new ki(i,b,i.path,[h,"value"]))}));if(i.common.async){let v=new Map;return Promise.resolve().then(async()=>{for(let b of n){let h=await b.key,m=await b.value;if(h.status==="aborted"||m.status==="aborted")return wt;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),v.set(h.value,m.value)}return{status:r.value,value:v}})}else{let v=new Map;for(let b of n){let{key:h,value:m}=b;if(h.status==="aborted"||m.status==="aborted")return wt;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),v.set(h.value,m.value)}return{status:r.value,value:v}}}}Gl.create=(t,e,r)=>new Gl({valueType:e,keyType:t,typeName:_t.ZodMap,...Et(r)});class us extends It{static{o(this,"p7")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ct.set)return at(i,{code:tt.invalid_type,expected:ct.set,received:i.parsedType}),wt;let s=this._def;s.minSize!==null&&i.data.size<s.minSize.value&&(at(i,{code:tt.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&i.data.size>s.maxSize.value&&(at(i,{code:tt.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let f=this._def.valueType;function n(b){let h=new Set;for(let m of b){if(m.status==="aborted")return wt;m.status==="dirty"&&r.dirty(),h.add(m.value)}return{status:r.value,value:h}}o(n,"O");let v=[...i.data.values()].map((b,h)=>f._parse(new ki(i,b,i.path,h)));return i.common.async?Promise.all(v).then(b=>n(b)):n(v)}min(e,r){return new us({...this._def,minSize:{value:e,message:mt.toString(r)}})}max(e,r){return new us({...this._def,maxSize:{value:e,message:mt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}us.create=(t,e)=>new us({valueType:t,minSize:null,maxSize:null,typeName:_t.ZodSet,...Et(e)});class Ds extends It{static{o(this,"g9")}constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ct.function)return at(r,{code:tt.invalid_type,expected:ct.function,received:r.parsedType}),wt;function i(v,b){return Hl({data:v,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ul(),Hs].filter(h=>!!h),issueData:{code:tt.invalid_arguments,argumentsError:b}})}o(i,"K");function s(v,b){return Hl({data:v,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ul(),Hs].filter(h=>!!h),issueData:{code:tt.invalid_return_type,returnTypeError:b}})}o(s,"_");let f={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Zs){let v=this;return kr(async function(...b){let h=new Ur([]),m=await v._def.args.parseAsync(b,f).catch(w=>{throw h.addIssue(i(b,w)),h}),l=await Reflect.apply(n,this,m);return await v._def.returns._def.type.parseAsync(l,f).catch(w=>{throw h.addIssue(s(l,w)),h})})}else{let v=this;return kr(function(...b){let h=v._def.args.safeParse(b,f);if(!h.success)throw new Ur([i(b,h.error)]);let m=Reflect.apply(n,this,h.data),l=v._def.returns.safeParse(m,f);if(!l.success)throw new Ur([s(m,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ds({...this._def,args:Ni.create(e).rest(qn.create())})}returns(e){return new Ds({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new Ds({args:e||Ni.create([]).rest(qn.create()),returns:r||qn.create(),typeName:_t.ZodFunction,...Et(i)})}}class ao extends It{static{o(this,"m9")}get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}ao.create=(t,e)=>new ao({getter:t,typeName:_t.ZodLazy,...Et(e)});class oo extends It{static{o(this,"d9")}_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return at(r,{received:r.data,code:tt.invalid_literal,expected:this._def.value}),wt}return{status:"valid",value:e.data}}get value(){return this._def.value}}oo.create=(t,e)=>new oo({value:t,typeName:_t.ZodLiteral,...Et(e)});function s6(t,e){return new Mn({values:t,typeName:_t.ZodEnum,...Et(e)})}o(s6,"bz");class Mn extends It{static{o(this,"e1")}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return at(r,{expected:Bt.joinValues(i),received:r.parsedType,code:tt.invalid_type}),wt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return at(r,{received:r.data,code:tt.invalid_enum_value,options:i}),wt}return kr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return Mn.create(e,{...this._def,...r})}exclude(e,r=this._def){return Mn.create(this.options.filter(i=>!e.includes(i)),{...this._def,...r})}}Mn.create=s6;class lo extends It{static{o(this,"l9")}_parse(e){let r=Bt.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ct.string&&i.parsedType!==ct.number){let s=Bt.objectValues(r);return at(i,{expected:Bt.joinValues(s),received:i.parsedType,code:tt.invalid_type}),wt}if(this._cache||(this._cache=new Set(Bt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=Bt.objectValues(r);return at(i,{received:i.data,code:tt.invalid_enum_value,options:s}),wt}return kr(e.data)}get enum(){return this._def.values}}lo.create=(t,e)=>new lo({values:t,typeName:_t.ZodNativeEnum,...Et(e)});class Zs extends It{static{o(this,"c7")}unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ct.promise&&r.common.async===!1)return at(r,{code:tt.invalid_type,expected:ct.promise,received:r.parsedType}),wt;let i=r.parsedType===ct.promise?r.data:Promise.resolve(r.data);return kr(i.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Zs.create=(t,e)=>new Zs({type:t,typeName:_t.ZodPromise,...Et(e)});class ci extends It{static{o(this,"f$")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_t.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=this._def.effect||null,f={addIssue:o(n=>{at(i,n),n.fatal?r.abort():r.dirty()},"addIssue"),get path(){return i.path}};if(f.addIssue=f.addIssue.bind(f),s.type==="preprocess"){let n=s.transform(i.data,f);if(i.common.async)return Promise.resolve(n).then(async v=>{if(r.value==="aborted")return wt;let b=await this._def.schema._parseAsync({data:v,path:i.path,parent:i});return b.status==="aborted"?wt:b.status==="dirty"||r.value==="dirty"?Rs(b.value):b});{if(r.value==="aborted")return wt;let v=this._def.schema._parseSync({data:n,path:i.path,parent:i});return v.status==="aborted"?wt:v.status==="dirty"||r.value==="dirty"?Rs(v.value):v}}if(s.type==="refinement"){let n=o(v=>{let b=s.refinement(v,f);if(i.common.async)return Promise.resolve(b);if(b instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return v},"O");if(i.common.async===!1){let v=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return v.status==="aborted"?wt:(v.status==="dirty"&&r.dirty(),n(v.value),{status:r.value,value:v.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(v=>v.status==="aborted"?wt:(v.status==="dirty"&&r.dirty(),n(v.value).then(()=>({status:r.value,value:v.value}))))}if(s.type==="transform")if(i.common.async===!1){let n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!os(n))return wt;let v=s.transform(n.value,f);if(v instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:v}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(n=>os(n)?Promise.resolve(s.transform(n.value,f)).then(v=>({status:r.value,value:v})):wt);Bt.assertNever(s)}}ci.create=(t,e,r)=>new ci({schema:t,typeName:_t.ZodEffects,effect:e,...Et(r)});ci.createWithPreprocess=(t,e,r)=>new ci({schema:e,effect:{type:"preprocess",transform:t},typeName:_t.ZodEffects,...Et(r)});class Si extends It{static{o(this,"J$")}_parse(e){return this._getType(e)===ct.undefined?kr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Si.create=(t,e)=>new Si({innerType:t,typeName:_t.ZodOptional,...Et(e)});class Sn extends It{static{o(this,"G1")}_parse(e){return this._getType(e)===ct.null?kr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Sn.create=(t,e)=>new Sn({innerType:t,typeName:_t.ZodNullable,...Et(e)});class uo extends It{static{o(this,"B9")}_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===ct.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}uo.create=(t,e)=>new uo({innerType:t,typeName:_t.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Et(e)});class co extends It{static{o(this,"o9")}_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return qa(s)?s.then(f=>({status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new Ur(i.common.issues)},input:i.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ur(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}co.create=(t,e)=>new co({innerType:t,typeName:_t.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Et(e)});class Yl extends It{static{o(this,"h5")}_parse(e){if(this._getType(e)!==ct.nan){let r=this._getOrReturnCtx(e);return at(r,{code:tt.invalid_type,expected:ct.nan,received:r.parsedType}),wt}return{status:"valid",value:e.data}}}Yl.create=t=>new Yl({typeName:_t.ZodNaN,...Et(t)});var vM=Symbol("zod_brand");class tp extends It{static{o(this,"b_")}_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ho extends It{static{o(this,"L5")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?wt:s.status==="dirty"?(r.dirty(),Rs(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{let s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?wt:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}static create(e,r){return new Ho({in:e,out:r,typeName:_t.ZodPipeline})}}class fo extends It{static{o(this,"n9")}_parse(e){let r=this._def.innerType._parse(e),i=o(s=>(os(s)&&(s.value=Object.freeze(s.value)),s),"K");return qa(r)?r.then(s=>i(s)):i(r)}unwrap(){return this._def.innerType}}fo.create=(t,e)=>new fo({innerType:t,typeName:_t.ZodReadonly,...Et(e)});function xm(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}o(xm,"Dz");function a6(t,e={},r){return t?Vs.create().superRefine((i,s)=>{let f=t(i);if(f instanceof Promise)return f.then(n=>{if(!n){let v=xm(e,i),b=v.fatal??r??!0;s.addIssue({code:"custom",...v,fatal:b})}});if(!f){let n=xm(e,i),v=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:v})}}):Vs.create()}o(a6,"gz");var bM={object:ir.lazycreate},_t;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_t||(_t={}));var yM=o((t,e={message:`Input not instance of ${t.name}`})=>a6(r=>r instanceof t,e),"zD"),o6=si.create,l6=xn.create,wM=Yl.create,xM=_n.create,u6=eo.create,_M=ls.create,MM=Vl.create,SM=to.create,EM=ro.create,AM=Vs.create,kM=qn.create,NM=rn.create,CM=Zl.create,RM=oi.create,IM=ir.create,OM=ir.strictCreate,TM=io.create,PM=Gu.create,jM=no.create,LM=Ni.create,DM=so.create,BM=Gl.create,zM=us.create,FM=Ds.create,UM=ao.create,HM=oo.create,VM=Mn.create,ZM=lo.create,GM=Zs.create,_m=ci.create,YM=Si.create,QM=Sn.create,KM=ci.createWithPreprocess,XM=Ho.create,WM=o(()=>o6().optional(),"oD"),$M=o(()=>l6().optional(),"nD"),JM=o(()=>u6().optional(),"UD"),qM={string:o(t=>si.create({...t,coerce:!0}),"string"),number:o(t=>xn.create({...t,coerce:!0}),"number"),boolean:o(t=>eo.create({...t,coerce:!0}),"boolean"),bigint:o(t=>_n.create({...t,coerce:!0}),"bigint"),date:o(t=>ls.create({...t,coerce:!0}),"date")},eS=wt;Tr(Ph(),1);var tS=[];for(sl=0;sl<256;++sl)tS.push((sl+256).toString(16).slice(1));var sl;typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var c6={};Rn(c6,{validator:o(()=>Kl,"validator"),validate:o(()=>d6,"validate"),getValueByPointer:o(()=>Ql,"getValueByPointer"),deepClone:o(()=>oS,"deepClone"),applyReducer:o(()=>uS,"applyReducer"),applyPatch:o(()=>f6,"applyPatch"),applyOperation:o(()=>es,"applyOperation"),_areEquals:o(()=>ho,"_areEquals"),JsonPatchError:o(()=>ar,"JsonPatchError")});/*!
|
|
46
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
47
|
-
* (c) 2017-2022 Joachim Wester
|
|
48
|
-
* MIT licensed
|
|
49
|
-
*/var rS=Object.prototype.hasOwnProperty;function iS(t,e){return rS.call(t,e)}o(iS,"Qz");function nS(t){if(Array.isArray(t)){let r=Array(t.length);for(let i=0;i<r.length;i++)r[i]=""+i;return r}if(Object.keys)return Object.keys(t);let e=[];for(let r in t)iS(t,r)&&e.push(r);return e}o(nS,"iz");function cs(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}o(cs,"r4");function Xd(t){let e=0,r=t.length,i;for(;e<r;){if(i=t.charCodeAt(e),i>=48&&i<=57){e++;continue}return!1}return!0}o(Xd,"u_");function sS(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}o(sS,"g5");function Wd(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(let r=0,i=t.length;r<i;r++)if(Wd(t[r]))return!0}else if(typeof t=="object"){let r=nS(t),i=r.length;for(var e=0;e<i;e++)if(Wd(t[r[e]]))return!0}}return!1}o(Wd,"c_");function Mm(t,e){let r=[t];for(let i in e){let s=typeof e[i]=="object"?JSON.stringify(e[i],null,2):e[i];typeof s<"u"&&r.push(`${i}: ${s}`)}return r.join(`
|
|
50
|
-
`)}o(Mm,"Fz");class aS extends Error{static{o(this,"r9")}constructor(e,r,i,s,f){super(Mm(e,{name:r,index:i,operation:s,tree:f})),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"index",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"operation",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"tree",{enumerable:!0,configurable:!0,writable:!0,value:f}),Object.setPrototypeOf(this,new.target.prototype),this.message=Mm(e,{name:r,index:i,operation:s,tree:f})}}var ar=aS,oS=cs,Is={add:o(function(t,e,r){return t[e]=this.value,{newDocument:r}},"add"),remove:o(function(t,e,r){var i=t[e];return delete t[e],{newDocument:r,removed:i}},"remove"),replace:o(function(t,e,r){var i=t[e];return t[e]=this.value,{newDocument:r,removed:i}},"replace"),move:o(function(t,e,r){let i=Ql(r,this.path);i&&(i=cs(i));let s=es(r,{op:"remove",path:this.from}).removed;return es(r,{op:"add",path:this.path,value:s}),{newDocument:r,removed:i}},"move"),copy:o(function(t,e,r){let i=Ql(r,this.from);return es(r,{op:"add",path:this.path,value:cs(i)}),{newDocument:r}},"copy"),test:o(function(t,e,r){return{newDocument:r,test:ho(t[e],this.value)}},"test"),_get:o(function(t,e,r){return this.value=t[e],{newDocument:r}},"_get")},lS={add:o(function(t,e,r){return Xd(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},"add"),remove:o(function(t,e,r){var i=t.splice(e,1);return{newDocument:r,removed:i[0]}},"remove"),replace:o(function(t,e,r){var i=t[e];return t[e]=this.value,{newDocument:r,removed:i}},"replace"),move:Is.move,copy:Is.copy,test:Is.test,_get:Is._get};function Ql(t,e){if(e=="")return t;var r={op:"_get",path:e};return es(t,r),r.value}o(Ql,"d_");function es(t,e,r=!1,i=!0,s=!0,f=0){if(r&&(typeof r=="function"?r(e,0,t,e.path):Kl(e,0)),e.path===""){let n={newDocument:t};if(e.op==="add")return n.newDocument=e.value,n;if(e.op==="replace")return n.newDocument=e.value,n.removed=t,n;if(e.op==="move"||e.op==="copy")return n.newDocument=Ql(t,e.from),e.op==="move"&&(n.removed=t),n;if(e.op==="test"){if(n.test=ho(t,e.value),n.test===!1)throw new ar("Test operation failed","TEST_OPERATION_FAILED",f,e,t);return n.newDocument=t,n}else{if(e.op==="remove")return n.removed=t,n.newDocument=null,n;if(e.op==="_get")return e.value=t,n;if(r)throw new ar("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",f,e,t);return n}}else{i||(t=cs(t));let n=(e.path||"").split("/"),v=t,b=1,h=n.length,m,l,w;for(typeof r=="function"?w=r:w=Kl;;){if(l=n[b],l&&l.indexOf("~")!=-1&&(l=sS(l)),s&&(l=="__proto__"||l=="prototype"&&b>0&&n[b-1]=="constructor"))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&m===void 0&&(v[l]===void 0?m=n.slice(0,b).join("/"):b==h-1&&(m=e.path),m!==void 0&&w(e,0,t,m)),b++,Array.isArray(v)){if(l==="-")l=v.length;else{if(r&&!Xd(l))throw new ar("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",f,e,t);Xd(l)&&(l=~~l)}if(b>=h){if(r&&e.op==="add"&&l>v.length)throw new ar("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",f,e,t);let p=lS[e.op].call(e,v,l,t);if(p.test===!1)throw new ar("Test operation failed","TEST_OPERATION_FAILED",f,e,t);return p}}else if(b>=h){let p=Is[e.op].call(e,v,l,t);if(p.test===!1)throw new ar("Test operation failed","TEST_OPERATION_FAILED",f,e,t);return p}if(v=v[l],r&&b<h&&(!v||typeof v!="object"))throw new ar("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",f,e,t)}}}o(es,"m7");function f6(t,e,r,i=!0,s=!0){if(r&&!Array.isArray(e))throw new ar("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");i||(t=cs(t));let f=Array(e.length);for(let n=0,v=e.length;n<v;n++)f[n]=es(t,e[n],r,!0,s,n),t=f[n].newDocument;return f.newDocument=t,f}o(f6,"d7");function uS(t,e,r){let i=es(t,e);if(i.test===!1)throw new ar("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return i.newDocument}o(uS,"vI");function Kl(t,e,r,i){if(typeof t!="object"||t===null||Array.isArray(t))throw new ar("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(Is[t.op]){if(typeof t.path!="string")throw new ar("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new ar('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new ar("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new ar("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&Wd(t.value))throw new ar("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var s=t.path.split("/").length,f=i.split("/").length;if(s!==f+1&&s!==f)throw new ar("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==i)throw new ar("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var n={op:"_get",path:t.from,value:void 0},v=d6([n],r);if(v&&v.name==="OPERATION_PATH_UNRESOLVABLE")throw new ar("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new ar("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}o(Kl,"l_");function d6(t,e,r){try{if(!Array.isArray(t))throw new ar("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)f6(cs(e),cs(t),r||!0);else{r=r||Kl;for(var i=0;i<t.length;i++)r(t[i],i,e,void 0)}}catch(s){if(s instanceof ar)return s;throw s}}o(d6,"tz");function ho(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),i=Array.isArray(e),s,f,n;if(r&&i){if(f=t.length,f!=e.length)return!1;for(s=f;s--!==0;)if(!ho(t[s],e[s]))return!1;return!0}if(r!=i)return!1;var v=Object.keys(t);if(f=v.length,f!==Object.keys(e).length)return!1;for(s=f;s--!==0;)if(!e.hasOwnProperty(v[s]))return!1;for(s=f;s--!==0;)if(n=v[s],!ho(t[n],e[n]))return!1;return!0}return t!==t&&e!==e}o(ho,"y5");/*!
|
|
51
|
-
* https://github.com/Starcounter-Jack/JSON-Patch
|
|
52
|
-
* (c) 2013-2021 Joachim Wester
|
|
53
|
-
* MIT license
|
|
54
|
-
*/({...c6});var cS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function fS(t){return typeof t=="string"&&cS.test(t)}o(fS,"TI");var dS=fS;function hS(t){if(!dS(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}o(hS,"XI");var pS=hS,yr=[];for(al=0;al<256;++al)yr.push((al+256).toString(16).slice(1));var al;function mS(t,e=0){return(yr[t[e+0]]+yr[t[e+1]]+yr[t[e+2]]+yr[t[e+3]]+"-"+yr[t[e+4]]+yr[t[e+5]]+"-"+yr[t[e+6]]+yr[t[e+7]]+"-"+yr[t[e+8]]+yr[t[e+9]]+"-"+yr[t[e+10]]+yr[t[e+11]]+yr[t[e+12]]+yr[t[e+13]]+yr[t[e+14]]+yr[t[e+15]]).toLowerCase()}o(mS,"B_");function gS(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}o(gS,"wI");var vS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",bS="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function yS(t,e,r){function i(s,f,n,v){var b;if(typeof s=="string"&&(s=gS(s)),typeof f=="string"&&(f=pS(f)),((b=f)===null||b===void 0?void 0:b.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var h=new Uint8Array(16+s.length);if(h.set(f),h.set(s,f.length),h=r(h),h[6]=h[6]&15|e,h[8]=h[8]&63|128,n){v=v||0;for(var m=0;m<16;++m)n[v+m]=h[m];return n}return mS(h)}o(i,"_");try{i.name=t}catch{}return i.DNS=vS,i.URL=bS,i}o(yS,"_O");typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);function wS(t,e,r,i){switch(t){case 0:return e&r^~e&i;case 1:return e^r^i;case 2:return e&r^e&i^r&i;case 3:return e^r^i}}o(wS,"MI");function ef(t,e){return t<<e|t>>>32-e}o(ef,"YO");function xS(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var i=unescape(encodeURIComponent(t));t=[];for(var s=0;s<i.length;++s)t.push(i.charCodeAt(s))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var f=t.length/4+2,n=Math.ceil(f/16),v=Array(n),b=0;b<n;++b){for(var h=new Uint32Array(16),m=0;m<16;++m)h[m]=t[b*64+m*4]<<24|t[b*64+m*4+1]<<16|t[b*64+m*4+2]<<8|t[b*64+m*4+3];v[b]=h}v[n-1][14]=(t.length-1)*8/Math.pow(2,32),v[n-1][14]=Math.floor(v[n-1][14]),v[n-1][15]=(t.length-1)*8&4294967295;for(var l=0;l<n;++l){for(var w=new Uint32Array(80),p=0;p<16;++p)w[p]=v[l][p];for(var y=16;y<80;++y)w[y]=ef(w[y-3]^w[y-8]^w[y-14]^w[y-16],1);for(var M=r[0],E=r[1],R=r[2],I=r[3],T=r[4],P=0;P<80;++P){var j=Math.floor(P/20),L=ef(M,5)+wS(j,E,R,I)+T+e[j]+w[P]>>>0;T=I,I=R,R=ef(E,30)>>>0,E=M,M=L}r[0]=r[0]+M>>>0,r[1]=r[1]+E>>>0,r[2]=r[2]+R>>>0,r[3]=r[3]+I>>>0,r[4]=r[4]+T>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}o(xS,"SI");var _S=xS;yS("v5",80,_S);Tr(Ph(),1);Tr(jh(),1);Tr(s5(),1);new TextEncoder;Tr(a5(),1);Tr(o5(),1);var MS=Tr(l5(),1),{color:FP}=MS.default;Tr(jh(),1);Tr(Ph(),1);Tr(jh(),1);function Yu(t,e,r){function i(v,b){var h;Object.defineProperty(v,"_zod",{value:v._zod??{},enumerable:!1}),(h=v._zod).traits??(h.traits=new Set),v._zod.traits.add(t),e(v,b);for(let m in n.prototype)m in v||Object.defineProperty(v,m,{value:n.prototype[m].bind(v)});v._zod.constr=n,v._zod.def=b}o(i,"_");let s=r?.Parent??Object;class f extends s{static{o(this,"O")}}Object.defineProperty(f,"name",{value:t});function n(v){var b;let h=r?.Parent?new f:this;i(h,v),(b=h._zod).deferred??(b.deferred=[]);for(let m of h._zod.deferred)m();return h}return o(n,"Y"),Object.defineProperty(n,"init",{value:i}),Object.defineProperty(n,Symbol.hasInstance,{value:o(v=>r?.Parent&&v instanceof r.Parent?!0:v?._zod?.traits?.has(t),"value")}),Object.defineProperty(n,"name",{value:t}),n}o(Yu,"qK");class $d extends Error{static{o(this,"r7")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var SS={};function h6(t){return SS}o(h6,"a5");function ES(t,e){return typeof e=="bigint"?e.toString():e}o(ES,"aX");function tf(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}o(tf,"h3");function ol(t){return typeof t=="string"?t:t?.message}o(ol,"I3");function p6(t,e,r){let i={...t,path:t.path??[]};if(!t.message){let s=ol(t.inst?._zod.def?.error?.(t))??ol(e?.error?.(t))??ol(r.customError?.(t))??ol(r.localeError?.(t))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,!e?.reportInput&&delete i.input,i}o(p6,"e5");var m6=o((t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,ES,2)},enumerable:!0}),Object.defineProperty(t,"toString",{value:o(()=>t.message,"value"),enumerable:!1})},"$A"),AS=Yu("$ZodError",m6),g6=Yu("$ZodError",m6,{Parent:Error}),kS=o(t=>(e,r,i)=>{let s=i?{...i,async:!1}:{async:!1},f=e._zod.run({value:r,issues:[]},s);if(f instanceof Promise)throw new $d;return f.issues.length?{success:!1,error:new(t??AS)(f.issues.map(n=>p6(n,s,h6())))}:{success:!0,data:f.value}},"pg"),NS=kS(g6),CS=o(t=>async(e,r,i)=>{let s=i?Object.assign(i,{async:!0}):{async:!0},f=e._zod.run({value:r,issues:[]},s);return f instanceof Promise&&(f=await f),f.issues.length?{success:!1,error:new t(f.issues.map(n=>p6(n,s,h6())))}:{success:!0,data:f.value}},"cg"),RS=CS(g6),IS={major:4,minor:0,patch:0},OS=Yu("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=IS;let i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(let s of i)for(let f of s._zod.onattach)f(t);if(i.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let s=o((f,n,v)=>{let b=tf(f),h;for(let m of n){if(m._zod.def.when){if(!m._zod.def.when(f))continue}else if(b)continue;let l=f.issues.length,w=m._zod.check(f);if(w instanceof Promise&&v?.async===!1)throw new $d;if(h||w instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await w,f.issues.length!==l&&(b||(b=tf(f,l)))});else{if(f.issues.length===l)continue;b||(b=tf(f,l))}}return h?h.then(()=>f):f},"P");t._zod.run=(f,n)=>{let v=t._zod.parse(f,n);if(v instanceof Promise){if(n.async===!1)throw new $d;return v.then(b=>s(b,i,n))}return s(v,i,n)}}t["~standard"]={validate:o(s=>{try{let f=NS(t,s);return f.success?{value:f.data}:{issues:f.error?.issues}}catch{return RS(t,s).then(n=>n.success?{value:n.data}:{issues:n.error?.issues})}},"validate"),vendor:"zod",version:1}});Yu("$ZodNever",(t,e)=>{OS.init(t,e),t._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});var po;(function(t){t.assertEqual=s=>s;function e(s){}o(e,"$"),t.assertIs=e;function r(s){throw Error()}o(r,"K"),t.assertNever=r,t.arrayToEnum=s=>{let f={};for(let n of s)f[n]=n;return f},t.getValidEnumValues=s=>{let f=t.objectKeys(s).filter(v=>typeof s[s[v]]!="number"),n={};for(let v of f)n[v]=s[v];return t.objectValues(n)},t.objectValues=s=>t.objectKeys(s).map(function(f){return s[f]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let f=[];for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&f.push(n);return f},t.find=(s,f)=>{for(let n of s)if(f(n))return n},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function i(s,f=" | "){return s.map(n=>typeof n=="string"?`'${n}'`:n).join(f)}o(i,"_"),t.joinValues=i,t.jsonStringifyReplacer=(s,f)=>typeof f=="bigint"?f.toString():f})(po||(po={}));var Sm;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Sm||(Sm={}));po.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);po.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Xl extends Error{static{o(this,"a4")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(f){return f.message},i={_errors:[]},s=o(f=>{for(let n of f.issues)if(n.code==="invalid_union")n.unionErrors.map(s);else if(n.code==="invalid_return_type")s(n.returnTypeError);else if(n.code==="invalid_arguments")s(n.argumentsError);else if(n.path.length===0)i._errors.push(r(n));else{let v=i,b=0;for(;b<n.path.length;){let h=n.path[b];b!==n.path.length-1?v[h]=v[h]||{_errors:[]}:(v[h]=v[h]||{_errors:[]},v[h]._errors.push(r(n))),v=v[h],b++}}},"_");return s(this),i}static assert(e){if(!(e instanceof Xl))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,po.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):i.push(e(s));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}Xl.create=t=>new Xl(t);var Em;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(Em||(Em={}));var Am;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Am||(Am={}));new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var TS=Tr(u5(),1),PS=Object.defineProperty,jS=o((t,e,r)=>e in t?PS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,"py"),LS=o((t,e,r)=>(jS(t,e+"",r),r),"cy");function DS(t,e){let r=Array.from({length:t.length},(i,s)=>({start:s,end:s+1}));for(;r.length>1;){let i=null;for(let s=0;s<r.length-1;s++){let f=t.slice(r[s].start,r[s+1].end),n=e.get(f.join(","));n!=null&&(i==null||n<i[0])&&(i=[n,s])}if(i!=null){let s=i[1];r[s]={start:r[s].start,end:r[s+1].end},r.splice(s+1,1)}else break}return r}o(DS,"uy");function BS(t,e){return t.length===1?[e.get(t.join(","))]:DS(t,e).map(r=>e.get(t.slice(r.start,r.end).join(","))).filter(r=>r!=null)}o(BS,"my");function zS(t){return t.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}o(zS,"dy");var Jd=class{static{o(this,"Lj")}specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(t,e){this.patStr=t.pat_str;let r=t.bpe_ranks.split(`
|
|
55
|
-
`).filter(Boolean).reduce((i,s)=>{let[f,n,...v]=s.split(" "),b=Number.parseInt(n,10);return v.forEach((h,m)=>i[h]=b+m),i},{});for(let[i,s]of Object.entries(r)){let f=TS.default.toByteArray(i);this.rankMap.set(f.join(","),s),this.textMap.set(s,f)}this.specialTokens={...t.special_tokens,...e},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((i,[s,f])=>(i[f]=this.textEncoder.encode(s),i),{})}encode(t,e=[],r="all"){let i=new RegExp(this.patStr,"ug"),s=Jd.specialTokenRegex(Object.keys(this.specialTokens)),f=[],n=new Set(e==="all"?Object.keys(this.specialTokens):e),v=new Set(r==="all"?Object.keys(this.specialTokens).filter(h=>!n.has(h)):r);if(v.size>0){let h=Jd.specialTokenRegex([...v]),m=t.match(h);if(m!=null)throw Error(`The text contains a special token that is not allowed: ${m[0]}`)}let b=0;for(;;){let h=null,m=b;for(;s.lastIndex=m,h=s.exec(t),!(h==null||n.has(h[0]));)m=h.index+1;let l=h?.index??t.length;for(let p of t.substring(b,l).matchAll(i)){let y=this.textEncoder.encode(p[0]),M=this.rankMap.get(y.join(","));if(M!=null){f.push(M);continue}f.push(...BS(y,this.rankMap))}if(h==null)break;let w=this.specialTokens[h[0]];f.push(w),b=h.index+h[0].length}return f}decode(t){let e=[],r=0;for(let f=0;f<t.length;++f){let n=t[f],v=this.textMap.get(n)??this.inverseSpecialTokens[n];v!=null&&(e.push(v),r+=v.length)}let i=new Uint8Array(r),s=0;for(let f of e)i.set(f,s),s+=f.length;return this.textDecoder.decode(i)}},FS=Jd;LS(FS,"specialTokenRegex",t=>new RegExp(t.map(e=>zS(e)).join("|"),"g"));Tr(F5(),1);var dt={};Rn(dt,{void:o(()=>SE,"void"),util:o(()=>zt,"util"),unknown:o(()=>_E,"unknown"),union:o(()=>NE,"union"),undefined:o(()=>yE,"undefined"),tuple:o(()=>IE,"tuple"),transformer:o(()=>Cm,"transformer"),symbol:o(()=>bE,"symbol"),string:o(()=>M6,"string"),strictObject:o(()=>kE,"strictObject"),setErrorMap:o(()=>VS,"setErrorMap"),set:o(()=>PE,"set"),record:o(()=>OE,"record"),quotelessJson:o(()=>US,"quotelessJson"),promise:o(()=>FE,"promise"),preprocess:o(()=>VE,"preprocess"),pipeline:o(()=>ZE,"pipeline"),ostring:o(()=>GE,"ostring"),optional:o(()=>UE,"optional"),onumber:o(()=>YE,"onumber"),oboolean:o(()=>QE,"oboolean"),objectUtil:o(()=>qd,"objectUtil"),object:o(()=>AE,"object"),number:o(()=>S6,"number"),nullable:o(()=>HE,"nullable"),null:o(()=>wE,"null"),never:o(()=>ME,"never"),nativeEnum:o(()=>zE,"nativeEnum"),nan:o(()=>mE,"nan"),map:o(()=>TE,"map"),makeIssue:o(()=>$l,"makeIssue"),literal:o(()=>DE,"literal"),lazy:o(()=>LE,"lazy"),late:o(()=>hE,"late"),isValid:o(()=>fs,"isValid"),isDirty:o(()=>th,"isDirty"),isAsync:o(()=>mo,"isAsync"),isAborted:o(()=>eh,"isAborted"),intersection:o(()=>RE,"intersection"),instanceof:o(()=>pE,"instanceof"),getParsedType:o(()=>qi,"getParsedType"),getErrorMap:o(()=>Wl,"getErrorMap"),function:o(()=>jE,"function"),enum:o(()=>BE,"enum"),effect:o(()=>Cm,"effect"),discriminatedUnion:o(()=>CE,"discriminatedUnion"),defaultErrorMap:o(()=>Gs,"defaultErrorMap"),datetimeRegex:o(()=>w6,"datetimeRegex"),date:o(()=>vE,"date"),custom:o(()=>_6,"custom"),coerce:o(()=>KE,"coerce"),boolean:o(()=>E6,"boolean"),bigint:o(()=>gE,"bigint"),array:o(()=>EE,"array"),any:o(()=>xE,"any"),addIssueToContext:o(()=>ot,"addIssueToContext"),ZodVoid:o(()=>ql,"ZodVoid"),ZodUnknown:o(()=>ts,"ZodUnknown"),ZodUnion:o(()=>yo,"ZodUnion"),ZodUndefined:o(()=>vo,"ZodUndefined"),ZodType:o(()=>Ot,"ZodType"),ZodTuple:o(()=>Ri,"ZodTuple"),ZodTransformer:o(()=>fi,"ZodTransformer"),ZodSymbol:o(()=>Jl,"ZodSymbol"),ZodString:o(()=>ai,"ZodString"),ZodSet:o(()=>hs,"ZodSet"),ZodSchema:o(()=>Ot,"ZodSchema"),ZodRecord:o(()=>xo,"ZodRecord"),ZodReadonly:o(()=>ko,"ZodReadonly"),ZodPromise:o(()=>Qs,"ZodPromise"),ZodPipeline:o(()=>Vo,"ZodPipeline"),ZodParsedType:o(()=>ft,"ZodParsedType"),ZodOptional:o(()=>Ei,"ZodOptional"),ZodObject:o(()=>nr,"ZodObject"),ZodNumber:o(()=>En,"ZodNumber"),ZodNullable:o(()=>Nn,"ZodNullable"),ZodNull:o(()=>bo,"ZodNull"),ZodNever:o(()=>nn,"ZodNever"),ZodNativeEnum:o(()=>So,"ZodNativeEnum"),ZodNaN:o(()=>tu,"ZodNaN"),ZodMap:o(()=>eu,"ZodMap"),ZodLiteral:o(()=>Mo,"ZodLiteral"),ZodLazy:o(()=>_o,"ZodLazy"),ZodIssueCode:o(()=>rt,"ZodIssueCode"),ZodIntersection:o(()=>wo,"ZodIntersection"),ZodFunction:o(()=>Bs,"ZodFunction"),ZodFirstPartyTypeKind:o(()=>Mt,"ZodFirstPartyTypeKind"),ZodError:o(()=>Hr,"ZodError"),ZodEnum:o(()=>kn,"ZodEnum"),ZodEffects:o(()=>fi,"ZodEffects"),ZodDiscriminatedUnion:o(()=>Qu,"ZodDiscriminatedUnion"),ZodDefault:o(()=>Eo,"ZodDefault"),ZodDate:o(()=>ds,"ZodDate"),ZodCatch:o(()=>Ao,"ZodCatch"),ZodBranded:o(()=>rp,"ZodBranded"),ZodBoolean:o(()=>go,"ZodBoolean"),ZodBigInt:o(()=>An,"ZodBigInt"),ZodArray:o(()=>li,"ZodArray"),ZodAny:o(()=>Ys,"ZodAny"),Schema:o(()=>Ot,"Schema"),ParseStatus:o(()=>Mr,"ParseStatus"),OK:o(()=>Nr,"OK"),NEVER:o(()=>XE,"NEVER"),INVALID:o(()=>xt,"INVALID"),EMPTY_PATH:o(()=>ZS,"EMPTY_PATH"),DIRTY:o(()=>Os,"DIRTY"),BRAND:o(()=>dE,"BRAND")});var zt;(function(t){t.assertEqual=s=>{};function e(s){}o(e,"$"),t.assertIs=e;function r(s){throw Error()}o(r,"K"),t.assertNever=r,t.arrayToEnum=s=>{let f={};for(let n of s)f[n]=n;return f},t.getValidEnumValues=s=>{let f=t.objectKeys(s).filter(v=>typeof s[s[v]]!="number"),n={};for(let v of f)n[v]=s[v];return t.objectValues(n)},t.objectValues=s=>t.objectKeys(s).map(function(f){return s[f]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let f=[];for(let n in s)Object.prototype.hasOwnProperty.call(s,n)&&f.push(n);return f},t.find=(s,f)=>{for(let n of s)if(f(n))return n},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function i(s,f=" | "){return s.map(n=>typeof n=="string"?`'${n}'`:n).join(f)}o(i,"_"),t.joinValues=i,t.jsonStringifyReplacer=(s,f)=>typeof f=="bigint"?f.toString():f})(zt||(zt={}));var qd;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(qd||(qd={}));var ft=zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qi=o(t=>{switch(typeof t){case"undefined":return ft.undefined;case"string":return ft.string;case"number":return Number.isNaN(t)?ft.nan:ft.number;case"boolean":return ft.boolean;case"function":return ft.function;case"bigint":return ft.bigint;case"symbol":return ft.symbol;case"object":return Array.isArray(t)?ft.array:t===null?ft.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?ft.promise:typeof Map<"u"&&t instanceof Map?ft.map:typeof Set<"u"&&t instanceof Set?ft.set:typeof Date<"u"&&t instanceof Date?ft.date:ft.object;default:return ft.unknown}},"t$"),rt=zt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),US=o(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"Nd");class Hr extends Error{static{o(this,"I4")}get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(f){return f.message},i={_errors:[]},s=o(f=>{for(let n of f.issues)if(n.code==="invalid_union")n.unionErrors.map(s);else if(n.code==="invalid_return_type")s(n.returnTypeError);else if(n.code==="invalid_arguments")s(n.argumentsError);else if(n.path.length===0)i._errors.push(r(n));else{let v=i,b=0;for(;b<n.path.length;){let h=n.path[b];b!==n.path.length-1?v[h]=v[h]||{_errors:[]}:(v[h]=v[h]||{_errors:[]},v[h]._errors.push(r(n))),v=v[h],b++}}},"_");return s(this),i}static assert(e){if(!(e instanceof Hr))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let s of this.issues)if(s.path.length>0){let f=s.path[0];r[f]=r[f]||[],r[f].push(e(s))}else i.push(e(s));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}Hr.create=t=>new Hr(t);var HS=o((t,e)=>{let r;switch(t.code){case rt.invalid_type:t.received===ft.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case rt.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,zt.jsonStringifyReplacer)}`;break;case rt.unrecognized_keys:r=`Unrecognized key(s) in object: ${zt.joinValues(t.keys,", ")}`;break;case rt.invalid_union:r="Invalid input";break;case rt.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${zt.joinValues(t.options)}`;break;case rt.invalid_enum_value:r=`Invalid enum value. Expected ${zt.joinValues(t.options)}, received '${t.received}'`;break;case rt.invalid_arguments:r="Invalid function arguments";break;case rt.invalid_return_type:r="Invalid function return type";break;case rt.invalid_date:r="Invalid date";break;case rt.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:zt.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case rt.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case rt.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case rt.custom:r="Invalid input";break;case rt.invalid_intersection_types:r="Intersection results could not be merged";break;case rt.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case rt.not_finite:r="Number must be finite";break;default:r=e.defaultError,zt.assertNever(t)}return{message:r}},"Rd"),Gs=HS,v6=Gs;function VS(t){v6=t}o(VS,"Dd");function Wl(){return v6}o(Wl,"kK");var $l=o(t=>{let{data:e,path:r,errorMaps:i,issueData:s}=t,f=[...r,...s.path||[]],n={...s,path:f};if(s.message!==void 0)return{...s,path:f,message:s.message};let v="",b=i.filter(h=>!!h).slice().reverse();for(let h of b)v=h(n,{data:e,defaultError:v}).message;return{...s,path:f,message:v}},"h2"),ZS=[];function ot(t,e){let r=Wl(),i=$l({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Gs?void 0:Gs].filter(s=>!!s)});t.common.issues.push(i)}o(ot,"r8");class Mr{static{o(this,"Qq")}constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let s of r){if(s.status==="aborted")return xt;s.status==="dirty"&&e.dirty(),i.push(s.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let s of r){let f=await s.key,n=await s.value;i.push({key:f,value:n})}return Mr.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let s of r){let{key:f,value:n}=s;if(f.status==="aborted"||n.status==="aborted")return xt;f.status==="dirty"&&e.dirty(),n.status==="dirty"&&e.dirty(),f.value!=="__proto__"&&(typeof n.value<"u"||s.alwaysSet)&&(i[f.value]=n.value)}return{status:e.value,value:i}}}var xt=Object.freeze({status:"aborted"}),Os=o(t=>({status:"dirty",value:t}),"_9"),Nr=o(t=>({status:"valid",value:t}),"K4"),eh=o(t=>t.status==="aborted","fP"),th=o(t=>t.status==="dirty","vP"),fs=o(t=>t.status==="valid","H7"),mo=o(t=>typeof Promise<"u"&&t instanceof Promise,"ZK"),gt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(gt||(gt={}));class Ci{static{o(this,"M$")}constructor(e,r,i,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}var km=o((t,e)=>{if(fs(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Hr(t.common.issues);return this._error=r,this._error}}},"VG");function At(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:s}=t;if(e&&(r||i))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:o((f,n)=>{let{message:v}=t;return f.code==="invalid_enum_value"?{message:v??n.defaultError}:typeof n.data>"u"?{message:v??i??n.defaultError}:f.code!=="invalid_type"?{message:n.defaultError}:{message:v??r??n.defaultError}},"errorMap"),description:s}}o(At,"R6");class Ot{static{o(this,"h6")}get description(){return this._def.description}_getType(e){return qi(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:qi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Mr,ctx:{common:e.parent.common,data:e.data,parsedType:qi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(mo(r))throw Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){let i={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qi(e)},s=this._parseSync({data:e,path:i.path,parent:i});return km(i,s)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qi(e)};if(!this["~standard"].async)try{let i=this._parseSync({data:e,path:[],parent:r});return fs(i)?{value:i.value}:{issues:r.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>fs(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:qi(e)},s=this._parse({data:e,path:i.path,parent:i}),f=await(mo(s)?s:Promise.resolve(s));return km(i,f)}refine(e,r){let i=o(s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r,"K");return this._refinement((s,f)=>{let n=e(s),v=o(()=>f.addIssue({code:rt.custom,...i(s)}),"Y");return typeof Promise<"u"&&n instanceof Promise?n.then(b=>b?!0:(v(),!1)):n?!0:(v(),!1)})}refinement(e,r){return this._refinement((i,s)=>e(i)?!0:(s.addIssue(typeof r=="function"?r(i,s):r),!1))}_refinement(e){return new fi({schema:this,typeName:Mt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:o(r=>this["~validate"](r),"validate")}}optional(){return Ei.create(this,this._def)}nullable(){return Nn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return li.create(this)}promise(){return Qs.create(this,this._def)}or(e){return yo.create([this,e],this._def)}and(e){return wo.create(this,e,this._def)}transform(e){return new fi({...At(this._def),schema:this,typeName:Mt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Eo({...At(this._def),innerType:this,defaultValue:r,typeName:Mt.ZodDefault})}brand(){return new rp({typeName:Mt.ZodBranded,type:this,...At(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ao({...At(this._def),innerType:this,catchValue:r,typeName:Mt.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Vo.create(this,e)}readonly(){return ko.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var GS=/^c[^\s-]{8,}$/i,YS=/^[0-9a-z]+$/,QS=/^[0-9A-HJKMNP-TV-Z]{26}$/i,KS=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,XS=/^[a-z0-9_-]{21}$/i,WS=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$S=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,JS=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,qS="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",rf,eE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,iE=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nE=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sE=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,b6="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",aE=new RegExp(`^${b6}$`);function y6(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}o(y6,"CG");function oE(t){return new RegExp(`^${y6(t)}$`)}o(oE,"rd");function w6(t){let e=`${b6}T${y6(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}o(w6,"EG");function lE(t,e){return!!((e==="v4"||!e)&&eE.test(t)||(e==="v6"||!e)&&rE.test(t))}o(lE,"Fd");function uE(t,e){if(!WS.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(i));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}o(uE,"Qd");function cE(t,e){return!!((e==="v4"||!e)&&tE.test(t)||(e==="v6"||!e)&&iE.test(t))}o(cE,"id$1");class ai extends Ot{static{o(this,"k$")}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ft.string){let s=this._getOrReturnCtx(e);return ot(s,{code:rt.invalid_type,expected:ft.string,received:s.parsedType}),xt}let r=new Mr,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let f=e.data.length>s.value,n=e.data.length<s.value;(f||n)&&(i=this._getOrReturnCtx(e,i),f?ot(i,{code:rt.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):n&&ot(i,{code:rt.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")JS.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"email",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")rf||(rf=new RegExp(qS,"u")),rf.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"emoji",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")KS.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"uuid",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")XS.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"nanoid",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")GS.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"cuid",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")YS.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"cuid2",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")QS.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"ulid",code:rt.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),ot(i,{validation:"url",code:rt.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,!s.regex.test(e.data)&&(i=this._getOrReturnCtx(e,i),ot(i,{validation:"regex",code:rt.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?w6(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?aE.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?oE(s).test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?$S.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"duration",code:rt.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?lE(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"ip",code:rt.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?uE(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"jwt",code:rt.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?cE(e.data,s.version)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"cidr",code:rt.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?nE.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"base64",code:rt.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?sE.test(e.data)||(i=this._getOrReturnCtx(e,i),ot(i,{validation:"base64url",code:rt.invalid_string,message:s.message}),r.dirty()):zt.assertNever(s);return{status:r.value,value:e.data}}_regex(e,r,i){return this.refinement(s=>e.test(s),{validation:r,code:rt.invalid_string,...gt.errToObj(i)})}_addCheck(e){return new ai({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...gt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...gt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...gt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...gt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...gt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...gt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...gt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...gt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...gt.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...gt.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...gt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...gt.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...gt.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...gt.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...gt.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...gt.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...gt.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...gt.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...gt.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...gt.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...gt.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...gt.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...gt.errToObj(r)})}nonempty(e){return this.min(1,gt.errToObj(e))}trim(){return new ai({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ai({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ai({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}ai.create=t=>new ai({checks:[],typeName:Mt.ZodString,coerce:t?.coerce??!1,...At(t)});function fE(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,s=r>i?r:i,f=Number.parseInt(t.toFixed(s).replace(".","")),n=Number.parseInt(e.toFixed(s).replace(".",""));return f%n/10**s}o(fE,"td");class En extends Ot{static{o(this,"z7")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==ft.number){let s=this._getOrReturnCtx(e);return ot(s,{code:rt.invalid_type,expected:ft.number,received:s.parsedType}),xt}let r,i=new Mr;for(let s of this._def.checks)s.kind==="int"?zt.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?fE(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.not_finite,message:s.message}),i.dirty()):zt.assertNever(s);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,gt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,gt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,gt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,gt.toString(r))}setLimit(e,r,i,s){return new En({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:gt.toString(s)}]})}_addCheck(e){return new En({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:gt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:gt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:gt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:gt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:gt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:gt.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:gt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:gt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:gt.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&zt.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}}En.create=t=>new En({checks:[],typeName:Mt.ZodNumber,coerce:t?.coerce||!1,...At(t)});class An extends Ot{static{o(this,"f7")}constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==ft.bigint)return this._getInvalidInput(e);let r,i=new Mr;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ot(r,{code:rt.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):zt.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.bigint,received:r.parsedType}),xt}gte(e,r){return this.setLimit("min",e,!0,gt.toString(r))}gt(e,r){return this.setLimit("min",e,!1,gt.toString(r))}lte(e,r){return this.setLimit("max",e,!0,gt.toString(r))}lt(e,r){return this.setLimit("max",e,!1,gt.toString(r))}setLimit(e,r,i,s){return new An({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:gt.toString(s)}]})}_addCheck(e){return new An({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:gt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:gt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:gt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:gt.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:gt.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}An.create=t=>new An({checks:[],typeName:Mt.ZodBigInt,coerce:t?.coerce??!1,...At(t)});class go extends Ot{static{o(this,"SK")}_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==ft.boolean){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.boolean,received:r.parsedType}),xt}return Nr(e.data)}}go.create=t=>new go({typeName:Mt.ZodBoolean,coerce:t?.coerce||!1,...At(t)});class ds extends Ot{static{o(this,"P9")}_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ft.date){let s=this._getOrReturnCtx(e);return ot(s,{code:rt.invalid_type,expected:ft.date,received:s.parsedType}),xt}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return ot(s,{code:rt.invalid_date}),xt}let r=new Mr,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),ot(i,{code:rt.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):zt.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ds({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:gt.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:gt.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}ds.create=t=>new ds({checks:[],coerce:t?.coerce||!1,typeName:Mt.ZodDate,...At(t)});class Jl extends Ot{static{o(this,"L2")}_parse(e){if(this._getType(e)!==ft.symbol){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.symbol,received:r.parsedType}),xt}return Nr(e.data)}}Jl.create=t=>new Jl({typeName:Mt.ZodSymbol,...At(t)});class vo extends Ot{static{o(this,"CK")}_parse(e){if(this._getType(e)!==ft.undefined){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.undefined,received:r.parsedType}),xt}return Nr(e.data)}}vo.create=t=>new vo({typeName:Mt.ZodUndefined,...At(t)});class bo extends Ot{static{o(this,"EK")}_parse(e){if(this._getType(e)!==ft.null){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.null,received:r.parsedType}),xt}return Nr(e.data)}}bo.create=t=>new bo({typeName:Mt.ZodNull,...At(t)});class Ys extends Ot{static{o(this,"Y9")}constructor(){super(...arguments),this._any=!0}_parse(e){return Nr(e.data)}}Ys.create=t=>new Ys({typeName:Mt.ZodAny,...At(t)});class ts extends Ot{static{o(this,"J7")}constructor(){super(...arguments),this._unknown=!0}_parse(e){return Nr(e.data)}}ts.create=t=>new ts({typeName:Mt.ZodUnknown,...At(t)});class nn extends Ot{static{o(this,"a$")}_parse(e){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.never,received:r.parsedType}),xt}}nn.create=t=>new nn({typeName:Mt.ZodNever,...At(t)});class ql extends Ot{static{o(this,"b2")}_parse(e){if(this._getType(e)!==ft.undefined){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.void,received:r.parsedType}),xt}return Nr(e.data)}}ql.create=t=>new ql({typeName:Mt.ZodVoid,...At(t)});class li extends Ot{static{o(this,"Z$")}_parse(e){let{ctx:r,status:i}=this._processInputParams(e),s=this._def;if(r.parsedType!==ft.array)return ot(r,{code:rt.invalid_type,expected:ft.array,received:r.parsedType}),xt;if(s.exactLength!==null){let n=r.data.length>s.exactLength.value,v=r.data.length<s.exactLength.value;(n||v)&&(ot(r,{code:n?rt.too_big:rt.too_small,minimum:v?s.exactLength.value:void 0,maximum:n?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),i.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(ot(r,{code:rt.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),i.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(ot(r,{code:rt.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((n,v)=>s.type._parseAsync(new Ci(r,n,r.path,v)))).then(n=>Mr.mergeArray(i,n));let f=[...r.data].map((n,v)=>s.type._parseSync(new Ci(r,n,r.path,v)));return Mr.mergeArray(i,f)}get element(){return this._def.type}min(e,r){return new li({...this._def,minLength:{value:e,message:gt.toString(r)}})}max(e,r){return new li({...this._def,maxLength:{value:e,message:gt.toString(r)}})}length(e,r){return new li({...this._def,exactLength:{value:e,message:gt.toString(r)}})}nonempty(e){return this.min(1,e)}}li.create=(t,e)=>new li({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Mt.ZodArray,...At(e)});function As(t){if(t instanceof nr){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=Ei.create(As(i))}return new nr({...t._def,shape:o(()=>e,"shape")})}else return t instanceof li?new li({...t._def,type:As(t.element)}):t instanceof Ei?Ei.create(As(t.unwrap())):t instanceof Nn?Nn.create(As(t.unwrap())):t instanceof Ri?Ri.create(t.items.map(e=>As(e))):t}o(As,"VK");class nr extends Ot{static{o(this,"kq")}constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=zt.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==ft.object){let b=this._getOrReturnCtx(e);return ot(b,{code:rt.invalid_type,expected:ft.object,received:b.parsedType}),xt}let{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:f}=this._getCached(),n=[];if(!(this._def.catchall instanceof nn&&this._def.unknownKeys==="strip"))for(let b in i.data)f.includes(b)||n.push(b);let v=[];for(let b of f){let h=s[b],m=i.data[b];v.push({key:{status:"valid",value:b},value:h._parse(new Ci(i,m,i.path,b)),alwaysSet:b in i.data})}if(this._def.catchall instanceof nn){let b=this._def.unknownKeys;if(b==="passthrough")for(let h of n)v.push({key:{status:"valid",value:h},value:{status:"valid",value:i.data[h]}});else if(b==="strict")n.length>0&&(ot(i,{code:rt.unrecognized_keys,keys:n}),r.dirty());else if(b!=="strip")throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let b=this._def.catchall;for(let h of n){let m=i.data[h];v.push({key:{status:"valid",value:h},value:b._parse(new Ci(i,m,i.path,h)),alwaysSet:h in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let b=[];for(let h of v){let m=await h.key,l=await h.value;b.push({key:m,value:l,alwaysSet:h.alwaysSet})}return b}).then(b=>Mr.mergeObjectSync(r,b)):Mr.mergeObjectSync(r,v)}get shape(){return this._def.shape()}strict(e){return gt.errToObj,new nr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:o((r,i)=>{let s=this._def.errorMap?.(r,i).message??i.defaultError;return r.code==="unrecognized_keys"?{message:gt.errToObj(e).message??s}:{message:s}},"errorMap")}:{}})}strip(){return new nr({...this._def,unknownKeys:"strip"})}passthrough(){return new nr({...this._def,unknownKeys:"passthrough"})}extend(e){return new nr({...this._def,shape:o(()=>({...this._def.shape(),...e}),"shape")})}merge(e){return new nr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:o(()=>({...this._def.shape(),...e._def.shape()}),"shape"),typeName:Mt.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new nr({...this._def,catchall:e})}pick(e){let r={};for(let i of zt.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new nr({...this._def,shape:o(()=>r,"shape")})}omit(e){let r={};for(let i of zt.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new nr({...this._def,shape:o(()=>r,"shape")})}deepPartial(){return As(this)}partial(e){let r={};for(let i of zt.objectKeys(this.shape)){let s=this.shape[i];e&&!e[i]?r[i]=s:r[i]=s.optional()}return new nr({...this._def,shape:o(()=>r,"shape")})}required(e){let r={};for(let i of zt.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof Ei;)s=s._def.innerType;r[i]=s}return new nr({...this._def,shape:o(()=>r,"shape")})}keyof(){return x6(zt.objectKeys(this.shape))}}nr.create=(t,e)=>new nr({shape:o(()=>t,"shape"),unknownKeys:"strip",catchall:nn.create(),typeName:Mt.ZodObject,...At(e)});nr.strictCreate=(t,e)=>new nr({shape:o(()=>t,"shape"),unknownKeys:"strict",catchall:nn.create(),typeName:Mt.ZodObject,...At(e)});nr.lazycreate=(t,e)=>new nr({shape:t,unknownKeys:"strip",catchall:nn.create(),typeName:Mt.ZodObject,...At(e)});class yo extends Ot{static{o(this,"NK")}_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function s(f){for(let v of f)if(v.result.status==="valid")return v.result;for(let v of f)if(v.result.status==="dirty")return r.common.issues.push(...v.ctx.common.issues),v.result;let n=f.map(v=>new Hr(v.ctx.common.issues));return ot(r,{code:rt.invalid_union,unionErrors:n}),xt}if(o(s,"_"),r.common.async)return Promise.all(i.map(async f=>{let n={...r,common:{...r.common,issues:[]},parent:null};return{result:await f._parseAsync({data:r.data,path:r.path,parent:n}),ctx:n}})).then(s);{let f,n=[];for(let b of i){let h={...r,common:{...r.common,issues:[]},parent:null},m=b._parseSync({data:r.data,path:r.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!f&&(f={result:m,ctx:h}),h.common.issues.length&&n.push(h.common.issues)}if(f)return r.common.issues.push(...f.ctx.common.issues),f.result;let v=n.map(b=>new Hr(b));return ot(r,{code:rt.invalid_union,unionErrors:v}),xt}}get options(){return this._def.options}}yo.create=(t,e)=>new yo({options:t,typeName:Mt.ZodUnion,...At(e)});var Ki=o(t=>t instanceof _o?Ki(t.schema):t instanceof fi?Ki(t.innerType()):t instanceof Mo?[t.value]:t instanceof kn?t.options:t instanceof So?zt.objectValues(t.enum):t instanceof Eo?Ki(t._def.innerType):t instanceof vo?[void 0]:t instanceof bo?[null]:t instanceof Ei?[void 0,...Ki(t.unwrap())]:t instanceof Nn?[null,...Ki(t.unwrap())]:t instanceof rp||t instanceof ko?Ki(t.unwrap()):t instanceof Ao?Ki(t._def.innerType):[],"g1");class Qu extends Ot{static{o(this,"TP")}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ft.object)return ot(r,{code:rt.invalid_type,expected:ft.object,received:r.parsedType}),xt;let i=this.discriminator,s=r.data[i],f=this.optionsMap.get(s);return f?r.common.async?f._parseAsync({data:r.data,path:r.path,parent:r}):f._parseSync({data:r.data,path:r.path,parent:r}):(ot(r,{code:rt.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),xt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let s=new Map;for(let f of r){let n=Ki(f.shape[e]);if(!n.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let v of n){if(s.has(v))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(v)}`);s.set(v,f)}}return new Qu({typeName:Mt.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...At(i)})}}function rh(t,e){let r=qi(t),i=qi(e);if(t===e)return{valid:!0,data:t};if(r===ft.object&&i===ft.object){let s=zt.objectKeys(e),f=zt.objectKeys(t).filter(v=>s.indexOf(v)!==-1),n={...t,...e};for(let v of f){let b=rh(t[v],e[v]);if(!b.valid)return{valid:!1};n[v]=b.data}return{valid:!0,data:n}}else if(r===ft.array&&i===ft.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let f=0;f<t.length;f++){let n=t[f],v=e[f],b=rh(n,v);if(!b.valid)return{valid:!1};s.push(b.data)}return{valid:!0,data:s}}else return r===ft.date&&i===ft.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}o(rh,"SW");class wo extends Ot{static{o(this,"RK")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=o((f,n)=>{if(eh(f)||eh(n))return xt;let v=rh(f.value,n.value);return v.valid?((th(f)||th(n))&&r.dirty(),{status:r.value,value:v.data}):(ot(i,{code:rt.invalid_intersection_types}),xt)},"_");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([f,n])=>s(f,n)):s(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}wo.create=(t,e,r)=>new wo({left:t,right:e,typeName:Mt.ZodIntersection,...At(r)});class Ri extends Ot{static{o(this,"e$")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ft.array)return ot(i,{code:rt.invalid_type,expected:ft.array,received:i.parsedType}),xt;if(i.data.length<this._def.items.length)return ot(i,{code:rt.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),xt;!this._def.rest&&i.data.length>this._def.items.length&&(ot(i,{code:rt.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=[...i.data].map((f,n)=>{let v=this._def.items[n]||this._def.rest;return v?v._parse(new Ci(i,f,i.path,n)):null}).filter(f=>!!f);return i.common.async?Promise.all(s).then(f=>Mr.mergeArray(r,f)):Mr.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new Ri({...this._def,rest:e})}}Ri.create=(t,e)=>{if(!Array.isArray(t))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ri({items:t,typeName:Mt.ZodTuple,rest:null,...At(e)})};class xo extends Ot{static{o(this,"g2")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ft.object)return ot(i,{code:rt.invalid_type,expected:ft.object,received:i.parsedType}),xt;let s=[],f=this._def.keyType,n=this._def.valueType;for(let v in i.data)s.push({key:f._parse(new Ci(i,v,i.path,v)),value:n._parse(new Ci(i,i.data[v],i.path,v)),alwaysSet:v in i.data});return i.common.async?Mr.mergeObjectAsync(r,s):Mr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof Ot?new xo({keyType:e,valueType:r,typeName:Mt.ZodRecord,...At(i)}):new xo({keyType:ai.create(),valueType:e,typeName:Mt.ZodRecord,...At(r)})}}class eu extends Ot{static{o(this,"y2")}get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ft.map)return ot(i,{code:rt.invalid_type,expected:ft.map,received:i.parsedType}),xt;let s=this._def.keyType,f=this._def.valueType,n=[...i.data.entries()].map(([v,b],h)=>({key:s._parse(new Ci(i,v,i.path,[h,"key"])),value:f._parse(new Ci(i,b,i.path,[h,"value"]))}));if(i.common.async){let v=new Map;return Promise.resolve().then(async()=>{for(let b of n){let h=await b.key,m=await b.value;if(h.status==="aborted"||m.status==="aborted")return xt;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),v.set(h.value,m.value)}return{status:r.value,value:v}})}else{let v=new Map;for(let b of n){let{key:h,value:m}=b;if(h.status==="aborted"||m.status==="aborted")return xt;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),v.set(h.value,m.value)}return{status:r.value,value:v}}}}eu.create=(t,e,r)=>new eu({valueType:e,keyType:t,typeName:Mt.ZodMap,...At(r)});class hs extends Ot{static{o(this,"O9")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==ft.set)return ot(i,{code:rt.invalid_type,expected:ft.set,received:i.parsedType}),xt;let s=this._def;s.minSize!==null&&i.data.size<s.minSize.value&&(ot(i,{code:rt.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&i.data.size>s.maxSize.value&&(ot(i,{code:rt.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let f=this._def.valueType;function n(b){let h=new Set;for(let m of b){if(m.status==="aborted")return xt;m.status==="dirty"&&r.dirty(),h.add(m.value)}return{status:r.value,value:h}}o(n,"O");let v=[...i.data.values()].map((b,h)=>f._parse(new Ci(i,b,i.path,h)));return i.common.async?Promise.all(v).then(b=>n(b)):n(v)}min(e,r){return new hs({...this._def,minSize:{value:e,message:gt.toString(r)}})}max(e,r){return new hs({...this._def,maxSize:{value:e,message:gt.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}hs.create=(t,e)=>new hs({valueType:t,minSize:null,maxSize:null,typeName:Mt.ZodSet,...At(e)});class Bs extends Ot{static{o(this,"MK")}constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ft.function)return ot(r,{code:rt.invalid_type,expected:ft.function,received:r.parsedType}),xt;function i(v,b){return $l({data:v,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wl(),Gs].filter(h=>!!h),issueData:{code:rt.invalid_arguments,argumentsError:b}})}o(i,"K");function s(v,b){return $l({data:v,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Wl(),Gs].filter(h=>!!h),issueData:{code:rt.invalid_return_type,returnTypeError:b}})}o(s,"_");let f={errorMap:r.common.contextualErrorMap},n=r.data;if(this._def.returns instanceof Qs){let v=this;return Nr(async function(...b){let h=new Hr([]),m=await v._def.args.parseAsync(b,f).catch(w=>{throw h.addIssue(i(b,w)),h}),l=await Reflect.apply(n,this,m);return await v._def.returns._def.type.parseAsync(l,f).catch(w=>{throw h.addIssue(s(l,w)),h})})}else{let v=this;return Nr(function(...b){let h=v._def.args.safeParse(b,f);if(!h.success)throw new Hr([i(b,h.error)]);let m=Reflect.apply(n,this,h.data),l=v._def.returns.safeParse(m,f);if(!l.success)throw new Hr([s(m,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Bs({...this._def,args:Ri.create(e).rest(ts.create())})}returns(e){return new Bs({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new Bs({args:e||Ri.create([]).rest(ts.create()),returns:r||ts.create(),typeName:Mt.ZodFunction,...At(i)})}}class _o extends Ot{static{o(this,"DK")}get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}_o.create=(t,e)=>new _o({getter:t,typeName:Mt.ZodLazy,...At(e)});class Mo extends Ot{static{o(this,"IK")}_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return ot(r,{received:r.data,code:rt.invalid_literal,expected:this._def.value}),xt}return{status:"valid",value:e.data}}get value(){return this._def.value}}Mo.create=(t,e)=>new Mo({value:t,typeName:Mt.ZodLiteral,...At(e)});function x6(t,e){return new kn({values:t,typeName:Mt.ZodEnum,...At(e)})}o(x6,"NG");class kn extends Ot{static{o(this,"v7")}_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return ot(r,{expected:zt.joinValues(i),received:r.parsedType,code:rt.invalid_type}),xt}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return ot(r,{received:r.data,code:rt.invalid_enum_value,options:i}),xt}return Nr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return kn.create(e,{...this._def,...r})}exclude(e,r=this._def){return kn.create(this.options.filter(i=>!e.includes(i)),{...this._def,...r})}}kn.create=x6;class So extends Ot{static{o(this,"hK")}_parse(e){let r=zt.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==ft.string&&i.parsedType!==ft.number){let s=zt.objectValues(r);return ot(i,{expected:zt.joinValues(s),received:i.parsedType,code:rt.invalid_type}),xt}if(this._cache||(this._cache=new Set(zt.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=zt.objectValues(r);return ot(i,{received:i.data,code:rt.invalid_enum_value,options:s}),xt}return Nr(e.data)}get enum(){return this._def.values}}So.create=(t,e)=>new So({values:t,typeName:Mt.ZodNativeEnum,...At(e)});class Qs extends Ot{static{o(this,"j9")}unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==ft.promise&&r.common.async===!1)return ot(r,{code:rt.invalid_type,expected:ft.promise,received:r.parsedType}),xt;let i=r.parsedType===ft.promise?r.data:Promise.resolve(r.data);return Nr(i.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Qs.create=(t,e)=>new Qs({type:t,typeName:Mt.ZodPromise,...At(e)});class fi extends Ot{static{o(this,"S$")}innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=this._def.effect||null,f={addIssue:o(n=>{ot(i,n),n.fatal?r.abort():r.dirty()},"addIssue"),get path(){return i.path}};if(f.addIssue=f.addIssue.bind(f),s.type==="preprocess"){let n=s.transform(i.data,f);if(i.common.async)return Promise.resolve(n).then(async v=>{if(r.value==="aborted")return xt;let b=await this._def.schema._parseAsync({data:v,path:i.path,parent:i});return b.status==="aborted"?xt:b.status==="dirty"||r.value==="dirty"?Os(b.value):b});{if(r.value==="aborted")return xt;let v=this._def.schema._parseSync({data:n,path:i.path,parent:i});return v.status==="aborted"?xt:v.status==="dirty"||r.value==="dirty"?Os(v.value):v}}if(s.type==="refinement"){let n=o(v=>{let b=s.refinement(v,f);if(i.common.async)return Promise.resolve(b);if(b instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return v},"O");if(i.common.async===!1){let v=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return v.status==="aborted"?xt:(v.status==="dirty"&&r.dirty(),n(v.value),{status:r.value,value:v.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(v=>v.status==="aborted"?xt:(v.status==="dirty"&&r.dirty(),n(v.value).then(()=>({status:r.value,value:v.value}))))}if(s.type==="transform")if(i.common.async===!1){let n=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!fs(n))return xt;let v=s.transform(n.value,f);if(v instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:v}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(n=>fs(n)?Promise.resolve(s.transform(n.value,f)).then(v=>({status:r.value,value:v})):xt);zt.assertNever(s)}}fi.create=(t,e,r)=>new fi({schema:t,typeName:Mt.ZodEffects,effect:e,...At(r)});fi.createWithPreprocess=(t,e,r)=>new fi({schema:e,effect:{type:"preprocess",transform:t},typeName:Mt.ZodEffects,...At(r)});class Ei extends Ot{static{o(this,"V$")}_parse(e){return this._getType(e)===ft.undefined?Nr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ei.create=(t,e)=>new Ei({innerType:t,typeName:Mt.ZodOptional,...At(e)});class Nn extends Ot{static{o(this,"y1")}_parse(e){return this._getType(e)===ft.null?Nr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Nn.create=(t,e)=>new Nn({innerType:t,typeName:Mt.ZodNullable,...At(e)});class Eo extends Ot{static{o(this,"LK")}_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===ft.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}Eo.create=(t,e)=>new Eo({innerType:t,typeName:Mt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...At(e)});class Ao extends Ot{static{o(this,"bK")}_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return mo(s)?s.then(f=>({status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new Hr(i.common.issues)},input:i.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Hr(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Ao.create=(t,e)=>new Ao({innerType:t,typeName:Mt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...At(e)});class tu extends Ot{static{o(this,"x2")}_parse(e){if(this._getType(e)!==ft.nan){let r=this._getOrReturnCtx(e);return ot(r,{code:rt.invalid_type,expected:ft.nan,received:r.parsedType}),xt}return{status:"valid",value:e.data}}}tu.create=t=>new tu({typeName:Mt.ZodNaN,...At(t)});var dE=Symbol("zod_brand");class rp extends Ot{static{o(this,"XP")}_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}}class Vo extends Ot{static{o(this,"p2")}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?xt:s.status==="dirty"?(r.dirty(),Os(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{let s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?xt:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}static create(e,r){return new Vo({in:e,out:r,typeName:Mt.ZodPipeline})}}class ko extends Ot{static{o(this,"gK")}_parse(e){let r=this._def.innerType._parse(e),i=o(s=>(fs(s)&&(s.value=Object.freeze(s.value)),s),"K");return mo(r)?r.then(s=>i(s)):i(r)}unwrap(){return this._def.innerType}}ko.create=(t,e)=>new ko({innerType:t,typeName:Mt.ZodReadonly,...At(e)});function Nm(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}o(Nm,"MG");function _6(t,e={},r){return t?Ys.create().superRefine((i,s)=>{let f=t(i);if(f instanceof Promise)return f.then(n=>{if(!n){let v=Nm(e,i),b=v.fatal??r??!0;s.addIssue({code:"custom",...v,fatal:b})}});if(!f){let n=Nm(e,i),v=n.fatal??r??!0;s.addIssue({code:"custom",...n,fatal:v})}}):Ys.create()}o(_6,"RG");var hE={object:nr.lazycreate},Mt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Mt||(Mt={}));var pE=o((t,e={message:`Input not instance of ${t.name}`})=>_6(r=>r instanceof t,e),"sd"),M6=ai.create,S6=En.create,mE=tu.create,gE=An.create,E6=go.create,vE=ds.create,bE=Jl.create,yE=vo.create,wE=bo.create,xE=Ys.create,_E=ts.create,ME=nn.create,SE=ql.create,EE=li.create,AE=nr.create,kE=nr.strictCreate,NE=yo.create,CE=Qu.create,RE=wo.create,IE=Ri.create,OE=xo.create,TE=eu.create,PE=hs.create,jE=Bs.create,LE=_o.create,DE=Mo.create,BE=kn.create,zE=So.create,FE=Qs.create,Cm=fi.create,UE=Ei.create,HE=Nn.create,VE=fi.createWithPreprocess,ZE=Vo.create,GE=o(()=>M6().optional(),"Ll"),YE=o(()=>S6().optional(),"bl"),QE=o(()=>E6().optional(),"gl"),KE={string:o(t=>ai.create({...t,coerce:!0}),"string"),number:o(t=>En.create({...t,coerce:!0}),"number"),boolean:o(t=>go.create({...t,coerce:!0}),"boolean"),bigint:o(t=>An.create({...t,coerce:!0}),"bigint"),date:o(t=>ds.create({...t,coerce:!0}),"date")},XE=xt;function A6(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof globalThis<"u"&&typeof globalThis.window<"u"&&typeof globalThis.window.document<"u"?"browser":"unknown"}o(A6,"LG");class WE{static{o(this,"bG")}store={};constructor(){typeof globalThis<"u"&&globalThis.window&&globalThis.window.ENV&&(this.store={...globalThis.window.ENV}),typeof globalThis<"u"&&globalThis.__ENV__&&(this.store={...this.store,...globalThis.__ENV__})}get(e){let r=this.store[e];return r!==void 0?String(r):void 0}set(e,r){this.store[e]=r}has(e){return e in this.store}getAll(){return{...this.store}}}class $E{static{o(this,"gG")}runtime;browserStore;cache=new Map;constructor(){this.runtime=A6(),this.runtime==="browser"&&(this.browserStore=new WE)}getRuntime(){return this.runtime}isNode(){return this.runtime==="node"}isBrowser(){return this.runtime==="browser"}get(e,r){if(this.cache.has(e)){let s=this.cache.get(e);return s===void 0&&r!==void 0?r:s}let i;switch(this.runtime){case"node":typeof process<"u"&&$i&&(i=$i[e]);break;case"browser":this.browserStore&&(i=this.browserStore.get(e));break;default:i=void 0}return this.cache.set(e,i),i===void 0&&r!==void 0?r:i}set(e,r){let i=String(r);switch(this.cache.delete(e),this.runtime){case"node":typeof process<"u"&&$i&&($i[e]=i);break;case"browser":this.browserStore&&this.browserStore.set(e,r);break}}has(e){return this.get(e)!==void 0}getAll(){switch(this.runtime){case"node":if(typeof process<"u"&&$i)return{...$i};break;case"browser":if(this.browserStore)return this.browserStore.getAll();break}return{}}getBoolean(e,r=!1){let i=this.get(e);return i===void 0?r:["true","1","yes","on"].includes(i.toLowerCase())}getNumber(e,r){let i=this.get(e);if(i===void 0)return r;let s=Number(i);return isNaN(s)?r:s}clearCache(){this.cache.clear()}}var nf=null;function JE(){return nf||(nf=new $E),nf}o(JE,"yK");function Ku(t,e){return JE().get(t,e)}o(Ku,"T7");A6();class qE{static{o(this,"AP")}globalStore;constructor(e){this.globalStore=e}clear(){console.clear()}filterByLabel(e){vA(e,this.globalStore.cache).forEach(r=>{ll(r)})}filterByNamespace(...e){bA(e,this.globalStore.cache).forEach(r=>{ll(r)})}filterByLevel(e){yA(e,this.globalStore.cache).forEach(r=>{ll(r)})}renderAll(){this.globalStore.cache.forEach(e=>{ll(e)})}}class ip{static{o(this,"xK")}config;pidCounter=1;labels=new Map;_listenerCounter=0;_levelsToListeners=new Map;_cache=[];constructor(e={}){this.config=e}get cache(){return this._cache}get configuration(){return this.config}get pid(){let e=this.pidCounter;return this.pidCounter++,e}get tools(){return new qE(this)}addLogToCache(e){this._cache.length<(this.config.cacheSize??300)&&this._cache.push(e)}clearCache(){this._cache=[]}getLabel(e){return this.labels.get(e)}setLabel(e,r){this.labels.set(e,r)}addListener(e,r){let i=this._listenerCounter+=1;return ap({...ti.levels,...this.config.levels??{}},e).forEach(s=>{this._levelsToListeners.has(s)?this._levelsToListeners.get(s).set(i,r):this._levelsToListeners.set(s,new Map([[i,r]]))}),i}removeListener(e){this._levelsToListeners.forEach(r=>{r.delete(e)})}getListeners(e){return Array.from(this._levelsToListeners.get(e)?.values()??[])}}function eA(t){return globalThis.$adzeGlobal=new ip(t),globalThis.$adzeGlobal}o(eA,"EW");function k6(t){let e=globalThis.$adzeGlobal;if(tA(e))return e;let r=new ip(t);return globalThis.$adzeGlobal=r,r}o(k6,"wP");function tA(t){return t instanceof ip}o(tA,"pl");function np(){return typeof window<"u"&&typeof window.location<"u"&&typeof window.navigator.userAgent<"u"&&!rA()}o(np,"x1");function rA(){return typeof Deno<"u"}o(rA,"cl");function iA(t){return np()}o(iA,"uG");function nA(){let t=!1;return np()&&(t=new URLSearchParams(globalThis.location.search).get("ADZE_ENV")==="test"),globalThis.$ADZE_ENV==="test"||t}o(nA,"mG");function sA(){let t=globalThis;return iA()?t.navigator.userAgent.includes("Firefox"):!1}o(sA,"dG");function ru(t){return Object.prototype.toString.call(t)==="[object String]"}o(ru,"pK");function sp(t){return t!==null&&typeof t=="number"&&!isNaN(Number(t))}o(sp,"cK");function N6(t){return BA.includes(t)}o(N6,"GP");function aA(t){return FA.includes(t)}o(aA,"lG");function oA(t){return P6.includes(t)}o(oA,"BG");function Rm(t){return t.every(e=>ru(e))}o(Rm,"NW");function lA(t){return Array.isArray(t)&&t.length===3&&t[1]==="-"}o(lA,"oG");function uA(){return Error().stack?.replace(/^Error\n/,`
|
|
56
|
-
`)}o(uA,"UG");function cA(t){return sp(t.activeLevel)?t.activeLevel:t.levels[t.activeLevel].level}o(cA,"rG");var Im=Tr(U5(),1),fA=Im.default??Im;function dA(t){return t.charAt(0).toUpperCase()+t.slice(1)}o(dA,"bW");function Om(t){return Object.values(t).map(e=>e.level)}o(Om,"gW");function Tm(t,e,r){return t.filter(i=>i>=e&&i<=r)}o(Tm,"yW");function hA(t,e=!1,r){let i=(e&&r?9+r.length:9)-t.length,s=t;for(let f=0;f<=i;f+=1)s+=" ";return s}o(hA,"xW");function pA(t,e){return e.reduce((r,i)=>fA[i](r),t)}o(pA,"pW");function ll(t){t.data&&console[t.data.method](...t.data.message)}o(ll,"c2");function mA(t){return t.filter(e=>e!=="")}o(mA,"tG");function gA(t){return typeof t=="object"&&t!==null}o(gA,"aG");function ap(t,e){if(e==="*")return Object.values(t).map(r=>r.level);if(ru(e))return[t[e].level];if(sp(e))return[e];if(lA(e)){if(Rm(e)){let r=t[e[0]].level,i=t[e[2]].level;return Tm(Om(t),r,i)}return Tm(Om(t),e[0],e[2])}return Array.isArray(e)&&Rm(e)?e.map(r=>t[r].level):e}o(ap,"u2");function C6(t,e,r){return e.length===0?!1:t==="include"?!e.includes(r):e.includes(r)}o(C6,"cW");function Pm(t,e){return t.length===0?!1:t.length>0&&e.length===0?!0:!e.map(r=>t.includes(r)).includes(!0)}o(Pm,"uW");function jm(t,e){return t.length===0?!1:t.length>0&&e.length===0?!0:e.map(r=>t.includes(r)).includes(!0)}o(jm,"mW");function vA(t,e){return e.filter(r=>r.data?.label?.name===t)}o(vA,"xG");function bA(t,e){return e.filter(r=>r.data?.namespace?r.data.namespace.map(i=>t.includes(i)).includes(!0):!1)}o(bA,"pG");function yA(t,e){return e.filter(r=>{let i=ap(r.configuration.levels,t);return r.data?.level===void 0?!1:C6("exclude",i,r.data.level)})}o(yA,"cG");function wA(t){return t&&t.length>0?t.reduce((e,r)=>`${e}#${r} `,""):""}o(wA,"dW");function xA(t){return t?`[${t.name}] `:""}o(xA,"lW");function _A(t){return t!==void 0?`(Count: ${t}) `:""}o(_A,"BW");function MA(t,e){return t!==void 0&&!t?`${e?"❌ ":""}Assertion failed:`:""}o(MA,"oW");function SA(t,e){return t!==void 0&&t?`${e?"✅ ":""}Expression passed:`:""}o(SA,"nW");var R6=-1,Xu=0,iu=1,nu=2,op=3,lp=4,up=5,cp=6,I6=7,O6=8,Lm=typeof self=="object"?self:globalThis,EA=o((t,e)=>{let r=o((s,f)=>(t.set(f,s),s),"K"),i=o(s=>{if(t.has(s))return t.get(s);let[f,n]=e[s];switch(f){case Xu:case R6:return r(n,s);case iu:{let v=r([],s);for(let b of n)v.push(i(b));return v}case nu:{let v=r({},s);for(let[b,h]of n)v[i(b)]=i(h);return v}case op:return r(new Date(n),s);case lp:{let{source:v,flags:b}=n;return r(new RegExp(v,b),s)}case up:{let v=r(new Map,s);for(let[b,h]of n)v.set(i(b),i(h));return v}case cp:{let v=r(new Set,s);for(let b of n)v.add(i(b));return v}case I6:{let{name:v,message:b}=n;return r(new Lm[v](b),s)}case O6:return r(BigInt(n),s);case"BigInt":return r(Object(BigInt(n)),s)}return r(new Lm[f](n),s)},"_");return i},"ul"),Dm=o(t=>EA(new Map,t)(0),"UW"),_s="",{toString:AA}={},{keys:kA}=Object,da=o(t=>{let e=typeof t;if(e!=="object"||!t)return[Xu,e];let r=AA.call(t).slice(8,-1);switch(r){case"Array":return[iu,_s];case"Object":return[nu,_s];case"Date":return[op,_s];case"RegExp":return[lp,_s];case"Map":return[up,_s];case"Set":return[cp,_s]}return r.includes("Array")?[iu,r]:r.includes("Error")?[I6,r]:[nu,r]},"o2"),ul=o(([t,e])=>t===Xu&&(e==="function"||e==="symbol"),"MP"),NA=o((t,e,r,i)=>{let s=o((n,v)=>{let b=i.push(n)-1;return r.set(v,b),b},"P"),f=o(n=>{if(r.has(n))return r.get(n);let[v,b]=da(n);switch(v){case Xu:{let m=n;switch(b){case"bigint":v=O6,m=n.toString();break;case"function":case"symbol":if(t)throw TypeError("unable to serialize "+b);m=null;break;case"undefined":return s([R6],n)}return s([v,m],n)}case iu:{if(b)return s([b,[...n]],n);let m=[],l=s([v,m],n);for(let w of n)m.push(f(w));return l}case nu:{if(b)switch(b){case"BigInt":return s([b,n.toString()],n);case"Boolean":case"Number":case"String":return s([b,n.valueOf()],n)}if(e&&"toJSON"in n)return f(n.toJSON());let m=[],l=s([v,m],n);for(let w of kA(n))(t||!ul(da(n[w])))&&m.push([f(w),f(n[w])]);return l}case op:return s([v,n.toISOString()],n);case lp:{let{source:m,flags:l}=n;return s([v,{source:m,flags:l}],n)}case up:{let m=[],l=s([v,m],n);for(let[w,p]of n)(t||!(ul(da(w))||ul(da(p))))&&m.push([f(w),f(p)]);return l}case cp:{let m=[],l=s([v,m],n);for(let w of n)(t||!ul(da(w)))&&m.push(f(w));return l}}let{message:h}=n;return s([v,{name:b,message:h}],n)},"O");return f},"ll"),Bm=o((t,{json:e,lossy:r}={})=>{let i=[];return NA(!(e||r),!!e,new Map,i)(t),i},"rW"),zm=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?Dm(Bm(t,e)):structuredClone(t):(t,e)=>Dm(Bm(t,e));function Fm(t,e,r,i){let{formatters:s,middleware:f=[],...n}=e.exportValues();return class extends t{_cfg=new nh({...zm(n),formatters:{...s},middleware:[...f]});_modifierData=zm(r);modifierQueue=[...i]}}o(Fm,"QW");function T6([t,e]){return`${t}s ${e/1e6}ms`}o(T6,"iW");function CA(){return T6(ih())}o(CA,"sG");function ih(t){let e=performance.now()*.001,r=Math.floor(e),i=Math.floor(e%1*1e9);if(t===void 0)return[r,i];let s=r-t[0],f=i-t[1];return f<0&&(s-=1,f+=1e9),[s,f]}o(ih,"SP");function fp(t){let e=o(s=>`${Math.floor(Math.abs(s))}`.padStart(2,"0"),"$"),r=-t.getTimezoneOffset(),i=`${r>=0?"+":"-"}${e(r/60)}:${e(r%60)}`;return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}${i}`}o(fp,"oK");function RA(t){let e=o((y,M=2)=>String(y).padStart(M,"0"),"$"),r=e(t.getDate()),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getMonth()],s=t.getFullYear(),f=e(t.getHours()),n=e(t.getMinutes()),v=e(t.getSeconds()),b=-t.getTimezoneOffset(),h=b>=0?"+":"-",m=Math.abs(b),l=e(Math.floor(m/60)),w=e(m%60),p=`${h}${l}${w}`;return`${r}/${i}/${s}:${f}:${n}:${v} ${p}`}o(RA,"qk");class Wu{static{o(this,"C$")}cfg;level;timestampFormatFunction=o(e=>fp(e),"timestampFormatFunction");constructor(e,r){this.cfg=e,this.level=r}get timestampFormatter(){return this.cfg.timestampFormatter?this.cfg.timestampFormatter:this.timestampFormatFunction}print(e,r,i){if(this.level.level>cA(this.cfg))return[];if(this.failsFilters(e))return[];if(e.assertion===!0)return[];if(e.if===!1)return[];if(e.method&&!oA(e.method)&&aA(e.method)&&N6(e.method))return i;let s=np()?this.formatBrowser(e,r,i):this.formatServer(e,r,i);return e.stacktrace&&s.push(e.stacktrace),s}failsFilters(e){return!!(this.failsLevelSelector()||this.failsNamespacesFilter(e)||this.failsLabelsFilter(e))}failsLevelSelector(){if(this.cfg.filters?.levels===void 0)return!1;let e=ap(this.cfg.levels,this.cfg.filters.levels.values);return!!C6(this.cfg.filters.levels.type,e,this.level.level)}failsNamespacesFilter(e){if(this.cfg.filters?.namespaces===void 0)return!1;if(this.cfg.filters.namespaces.values.length>0&&e.namespace===void 0)return!0;if(this.cfg.filters.namespaces.type==="include"){let i=e.namespace??[];return Pm(this.cfg.filters.namespaces.values,i)}let r=e.namespace??[];return jm(this.cfg.filters.namespaces.values,r)}failsLabelsFilter(e){if(this.cfg.filters?.labels===void 0)return!1;if(this.cfg.filters.labels.values.length>0&&e.label===void 0)return!0;let r=e.label?[e.label.name]:[];return this.cfg.filters.labels.type==="include"?Pm(this.cfg.filters.labels.values,r):jm(this.cfg.filters.labels.values,r)}}class IA extends Wu{static{o(this,"CP")}timestampFormatFunction=o(e=>RA(e),"timestampFormatFunction");formatBrowser(e,r,i){return this.formatMessage(e,r,i)}formatServer(e,r,i){return this.formatMessage(e,r,i)}formatMessage(e,r,i){this.cfg.meta.hostname===void 0&&console.warn(Error("Adze: 'hostname' is required for the common log format. Please provide this value in your log's meta data."));let s=this.cfg.meta.hostname,f=this.cfg.meta.ident??"-",n=this.cfg.meta.user??"-",v=i[0];return[`${s} ${f} ${n} [${r}] ${v}`]}}var OA=IA;function TA(t){return typeof t.name=="string"&&typeof t.hostname=="string"}o(TA,"Kk");class PA extends Wu{static{o(this,"EP")}timestampFormatFunction=o(e=>fp(e),"timestampFormatFunction");formatBrowser(e,r,i){return this.formatMessage(e,r,i)}formatServer(e,r,i){return this.formatMessage(e,r,i)}formatMessage(e,r,i){let s=k6(),f=[...i],n=f.shift();if(TA(this.cfg.meta)){let{src:v,err:b,req_id:h,req:m,res:l,latency:w,hostname:p,name:y,...M}=this.cfg.meta,{namespace:E,label:R}=e,I={v:1,level:this.level.level,levelName:this.level.levelName,name:y,hostname:p,msg:n,args:f,pid:s.pid,time:r,meta:Object.keys(M).length>0?M:void 0,namespace:E,label:R?.name,src:v,err:b,req_id:h,req:m,res:l,latency:w};return[JSON.stringify(I)]}return console.warn(Error("Adze: Required fields are missing from the log meta for generating a JSON log.")),[...f]}}var jA=PA;class LA extends Wu{static{o(this,"NP")}formatBrowser(e,r,i){let s=this.formatLeader(),f=this.formatMeta(e,r);return this.cfg.withEmoji?[s,"font-size: 12px;",this.level.style,f,...i]:[s,this.level.style,f,...i]}formatServer(e,r,i){let s=`${hA(this.formatLeader(!1),this.cfg.withEmoji,this.level.emoji)} `,f=this.formatMeta(e,r);return[pA(s,this.level.terminalStyle),f,...i]}formatLeader(e=!0){let r=e?"%c":"",i=" "+dA(this.level.levelName);return this.cfg.withEmoji?`${r}${this.formatEmoji(e)}${r}${i}`:`${r}${i}`}formatEmoji(e){let r=e?" ":"";return this.level.emoji?`${this.level.emoji}${r}`:""}formatMeta(e,r){let i=this.cfg.showTimestamp?`${r} `:"",s=wA(e.namespace),f=xA(e.label),n=this.formatTime(e),v=_A(e.label?.count),b=MA(e.assertion,this.cfg.withEmoji),h=SA(e.if,this.cfg.withEmoji),m=b!==""?b:h!==""?h:"";return i+s+f+n+v+m}formatTime(e){let r=this.cfg.withEmoji?"⏱ ":"Time elapsed: ";return e.timeNow?`(${r}${e.timeNow})`:e.label?.timeElapsed?`(${r}${e.label.timeElapsed})`:""}}var Um=LA;class DA extends Wu{static{o(this,"n2")}timestampFormatFunction=o(e=>fp(e),"timestampFormatFunction");formatBrowser(e,r,i){return this.formatMessage(r,e,i)}formatServer(e,r,i){return this.formatMessage(r,e,i)}formatMessage(e,r,i){let s="",{appname:f,hostname:n,port:v}=this.cfg.meta,b=sp(v)?`/${v}`:"",h=ru(f)?`${f}${b}`:"",m=ru(n)?` on ${n}: `:"",l=this.formatNamespace(r.namespace),w=r.label?`[${r.label.name}] `:"";return s=`${h}${m}${l}${w}`,[`[${e}] ${this.level.levelName.toUpperCase()}: ${s}${i[0]} `,i.map(p=>gA(p)?JSON.stringify(p):p).slice(1).join(" ")]}formatNamespace(e){return e&&e.length>0?`${e.reduce((r,i,s)=>s===e.length-1?`${r}${i}`:`${r}${i}/`,"")} `:""}}var P6=["group","groupCollapsed"],j6=["dir","dirxml","table",...P6],BA=["error","warn","info","log","debug",...j6],zA=["clear","groupEnd"],FA=[...j6,...zA],ti={activeLevel:"log",cache:!1,cacheSize:300,dump:!1,format:"pretty",showTimestamp:!1,silent:!1,withEmoji:!1,levels:{alert:UA(),error:HA(),warn:VA(),info:ZA(),fail:GA(),success:YA(),log:QA(),debug:KA(),verbose:XA()},formatters:{default:Um,pretty:Um,standard:DA,common:OA,json:jA}};function UA(t={}){return{levelName:"alert",level:0,style:"padding-right: 24px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fc8585, #fc2323); color: #fff; border-color: #b70101;",terminalStyle:["white","bold","bgRed"],method:"error",emoji:"🚨",...t}}o(UA,"Bl");function HA(t={}){return{levelName:"error",level:1,style:"padding-right: 24px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fff, #ffd1d1); color: #a4000f; border-color: #e3bbbb;",terminalStyle:["white","bgRed"],method:"error",emoji:"🔥",...t}}o(HA,"ol");function VA(t={}){return{levelName:"warn",level:2,style:`font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #fff, #fff0a8); color: #715100; border-color: #e3d696; padding-right: ${sA()?"44px":"30px"};`,terminalStyle:["white","bgYellow"],method:"warn",emoji:"🔔",...t}}o(VA,"nl");function ZA(t={}){return{levelName:"info",level:3,style:"padding-right: 44px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #d8ebff, #b2d7ff); color: #465464; border-color: #96b5d7;",terminalStyle:["white","bgBlue"],method:"info",emoji:"ℹ️",...t}}o(ZA,"Ul");function GA(t={}){return{levelName:"fail",level:4,style:"padding-right: 44px; font-size: 12px; border-radius: 4px; background: linear-gradient(to right, #ffe8e8, #ffd1d1); color: #a4000f; border-color: #e3bbbb;",terminalStyle:["white","bgRed"],method:"info",emoji:"❌",...t}}o(GA,"rl");function YA(t={}){return{levelName:"success",level:5,style:"font-size: 12px; border-radius: 4px; padding-right: 22px; background: linear-gradient(to right, #e6f6e4, #ceedc9); color: #4e594d; border-color: #b7d1b3;",terminalStyle:["white","bgGreen"],method:"info",emoji:"🎉",...t}}o(YA,"Fl");function QA(t={}){return{levelName:"log",level:6,style:"font-size: 12px; border-radius: 4px; padding-right: 51px; background: linear-gradient(to right, #ecedef, #d9dce0); color: #333435; border-color: #bfc1c5;",terminalStyle:["white","bgBlackBright"],method:"log",emoji:"🪵",...t}}o(QA,"Ql");function KA(t={}){return{levelName:"debug",level:7,style:"font-size: 12px; padding-right: 36px; border-right: 1px solid #d9dce0; color: #465464; border-color: #999999;",terminalStyle:["white","bgBlack"],method:"debug",emoji:"🐞",...t}}o(KA,"il");function XA(t={}){return{levelName:"verbose",level:8,style:"font-size: 12px; padding-right: 22px; color: #999999;",terminalStyle:["black","italic"],method:"debug",emoji:"💬",...t}}o(XA,"tl");class nh{static{o(this,"BK")}logCfg;glblCfg;constructor(e){this.logCfg=e??{},this.glblCfg=globalThis.$adzeGlobal?.configuration}updateConfiguration(e){this.logCfg=e}get activeLevel(){return this.glblCfg?.activeLevel??this.logCfg.activeLevel??ti.activeLevel}set activeLevel(e){this.logCfg.activeLevel=e}get cache(){return this.glblCfg?.cache??this.logCfg.cache??ti.cache}set cache(e){this.logCfg.cache=e}get cacheSize(){return this.glblCfg?.cacheSize??this.logCfg.cacheSize??ti.cacheSize}set cacheSize(e){this.logCfg.cacheSize=e}get dump(){return this.glblCfg?.dump??this.logCfg.dump??ti.dump}set dump(e){this.logCfg.dump=e}get meta(){return{...this.logCfg.meta,...this.glblCfg?.meta}}set meta(e){this.logCfg.meta=e}get silent(){return this.glblCfg?.silent??this.logCfg.silent??ti.silent}set silent(e){this.logCfg.silent=e}get showTimestamp(){return this.glblCfg?.showTimestamp??this.logCfg.showTimestamp??ti.showTimestamp}set showTimestamp(e){this.logCfg.showTimestamp=e}get withEmoji(){return this.glblCfg?.withEmoji??this.logCfg.withEmoji??ti.withEmoji}set withEmoji(e){this.logCfg.withEmoji=e}get format(){return this.glblCfg?.format??this.logCfg.format??ti.format}set format(e){this.logCfg.format=e}get levels(){return{...ti.levels,...this.logCfg.levels??{},...this.glblCfg?.levels??{}}}set levels(e){this.logCfg.levels=e}get middleware(){return[...this.glblCfg?.middleware??[],...this.logCfg.middleware??[]]}set middleware(e){this.logCfg.middleware=e}get filters(){return this.glblCfg?.filters??this.logCfg.filters}set filters(e){this.logCfg.filters=e}get timestampFormatter(){return this.glblCfg?.timestampFormatter??this.logCfg.timestampFormatter}set timestampFormatter(e){this.logCfg.timestampFormatter=e}get formatters(){return{...ti.formatters,...this.logCfg.formatters??{},...this.glblCfg?.formatters??{}}}set formatters(e){this.logCfg.formatters=e}exportValues(){return{activeLevel:this.logCfg.activeLevel,cache:this.logCfg.cache,cacheSize:this.logCfg.cacheSize,dump:this.logCfg.dump,meta:this.logCfg.meta,silent:this.logCfg.silent,showTimestamp:this.logCfg.showTimestamp,withEmoji:this.logCfg.withEmoji,format:this.logCfg.format,levels:this.logCfg.levels,middleware:this.logCfg.middleware,filters:this.logCfg.filters,timestampFormatter:this.logCfg.timestampFormatter,formatters:this.logCfg.formatters}}}function WA(t){return typeof t=="function"}o(WA,"al");class su{static{o(this,"nK")}globalStore;_cfg;_modifierData;_data;modifierQueue=[];constructor(e,r){this.globalStore=k6(e),this._modifierData=r??{},this._cfg=new nh(e),this.doHook(i=>{i.constructed&&i.constructed(this)})}get data(){return this._data}get modifierData(){return this._modifierData}get configuration(){return this._cfg}alert(...e){this.terminate("alert",e)}static alert(...e){new this().alert(...e)}error(...e){this.terminate("error",e)}static error(...e){new this().error(...e)}warn(...e){this.terminate("warn",e)}static warn(...e){new this().warn(...e)}info(...e){this.terminate("info",e)}static info(...e){new this().info(...e)}fail(...e){this.terminate("fail",e)}static fail(...e){new this().fail(...e)}success(...e){this.terminate("success",e)}static success(...e){new this().success(...e)}log(...e){this.terminate("log",e)}static log(e,...r){new this().log(e,...r)}debug(...e){this.terminate("debug",e)}static debug(...e){new this().debug(...e)}verbose(...e){this.terminate("verbose",e)}static verbose(...e){new this().verbose(...e)}clear(){console.clear()}static clear(){console.clear()}clr(){console.clear()}static clr(){console.clear()}custom(e,...r){return this._cfg.levels[e]?(this.terminate(e,r),this):(console.warn(Error("Custom log level not found in configuration.")),this)}static custom(e,...r){return new this().custom(e,...r)}seal(e){return e&&this._cfg.updateConfiguration(e),Fm(su,this._cfg,this.modifierData,this.modifierQueue)}static seal(e){return new this().seal(e)}sealTag(e,r){return this._cfg=new nh({...this._cfg.exportValues(),...r}),(i,...s)=>{let f=String.raw({raw:i},...s),n=Fm(su,this._cfg,this.modifierData,this.modifierQueue),v=e;WA(n[v])&&n[v](f)}}static sealTag(e,r){return new this().sealTag(e,r)}thread(e,r){this.runModifierQueue(),this._modifierData.label&&(this._modifierData.label.context||(this._modifierData.label.context={}),this._modifierData.label.context={...this._modifierData.label.context,[e]:r})}static thread(e,r){new this().thread(e,r)}assert(e){return this.modifierQueue.push(["assert",r=>(r.assertion=e,r)]),this}static assert(e){return new this().assert(e)}get closeThread(){return this.modifierQueue.push(["closeThread",e=>(e.label?.context&&(e.label.context=void 0),e)]),this}static get closeThread(){return new this().closeThread}get count(){return this.modifierQueue.push(["count",e=>(e.label&&(e.label.count=e.label.count!==void 0?e.label.count+1:1),e)]),this}static get count(){return new this().count}get countClear(){return this.modifierQueue.push(["countClear",e=>(e.label&&delete e.label.count,e)]),this}static get countClear(){return new this().countClear}get countReset(){return this.modifierQueue.push(["countReset",e=>(e.label&&(e.label.count=0),e)]),this}static get countReset(){return new this().countReset}get dir(){return this.modifierQueue.push(["dir",e=>(e.method="dir",e)]),this}static get dir(){return new this().dir}get dirxml(){return this.modifierQueue.push(["dirxml",e=>(e.method="dirxml",e)]),this}static get dirxml(){return new this().dirxml}get dump(){return this.modifierQueue.push(["dump",(e,r)=>(r._cfg.dump=!0,e)]),this}static get dump(){return new this().dump}format(e){return this.modifierQueue.push(["format",(r,i)=>Object.keys(i._cfg.formatters).includes(e)?(i._cfg.format=e,r):(console.warn(Error(`Adze: Formatter "${e}" not found in configuration.`)),r)]),this}static format(e){return new this().format(e)}get group(){return this.modifierQueue.push(["group",e=>(e.method="group",e)]),this}static get group(){return new this().group}get groupCollapsed(){return this.modifierQueue.push(["groupCollapsed",e=>(e.method="groupCollapsed",e)]),this}static get groupCollapsed(){return new this().groupCollapsed}get groupEnd(){return this.modifierQueue.push(["groupEnd",e=>(e.method="groupEnd",e)]),this}static get groupEnd(){return new this().groupEnd}if(e){return this.modifierQueue.push(["if",r=>(r.if=e,r)]),this}static if(e){return new this().if(e)}test(e){return this.if(e)}static test(e){return new this().if(e)}label(e){return this.modifierQueue.unshift(["label",r=>{let i=this.globalStore.getLabel(e)??{name:e};return r.label=i,this.globalStore.setLabel(e,i),r}]),this}static label(e){return new this().label(e)}meta(e){return this.modifierQueue.push(["meta",(r,i)=>(i._cfg.meta={...i._cfg.meta,...e},r)]),this}static meta(e){return new this().meta(e)}namespace(...e){return this.modifierQueue.push(["namespace",r=>{let i=r.namespace??[];return r.namespace=i.length>0?[...i,...e]:e,r}]),this}static namespace(...e){return new this().namespace(...e)}ns(...e){return this.namespace(...e)}static ns(...e){return new this().namespace(...e)}get silent(){return this.modifierQueue.push(["silent",(e,r)=>(r._cfg.silent=!0,e)]),this}static get silent(){return new this().silent}get table(){return this.modifierQueue.push(["table",e=>(e.method="table",e)]),this}static get table(){return new this().table}get time(){return this.modifierQueue.push(["time",e=>{let r=ih();return e.label&&(e.label.timeStart=r),e}]),this}static get time(){return new this().time}get timeEnd(){return this.modifierQueue.push(["timeEnd",e=>(e.label?.timeStart&&(e.label.timeElapsed=T6(ih(e.label.timeStart))),e)]),this}static get timeEnd(){return new this().timeEnd}get timeNow(){return this.modifierQueue.push(["timeNow",e=>(e.timeNow=CA(),e)]),this}static get timeNow(){return new this().timeNow}get timestamp(){return this.modifierQueue.push(["timestamp",(e,r)=>(r._cfg.showTimestamp=!0,e)]),this}static get timestamp(){return new this().timestamp}get trace(){return this.modifierQueue.push(["trace",e=>(e.stacktrace=uA(),e)]),this}static get trace(){return new this().trace}get withEmoji(){return this.modifierQueue.push(["withEmoji",(e,r)=>(r._cfg.withEmoji=!0,e)]),this}static get withEmoji(){return new this().withEmoji}print(e){nA()||e.silent||e.message.length<1||(N6(e.method)?console[e.method](...e.message):console[e.method]())}terminate(e,r){this.doHook(R=>{R.beforeTerminated&&R.beforeTerminated(this,e,r)}),this.runModifierQueue();let i=this.getLevelConfig(e),s=new(this.selectFormatter(this._cfg.format))(this._cfg,i),f=s.timestampFormatter(new Date),n=mA(s.print(this.modifierData,f,r));this._cfg.dump&&this.modifierData.label?.context&&n.push(this.modifierData.label.context),this.doHook(R=>{R.beforeFormatApplied&&(n=R.beforeFormatApplied(this,this._cfg.format,n))});let{activeLevel:v,cache:b,cacheSize:h,dump:m,format:l,meta:w,showTimestamp:p,silent:y,withEmoji:M}=this._cfg,E={activeLevel:v,cache:b,cacheSize:h,dump:m,format:l,meta:w,showTimestamp:p,silent:y,withEmoji:M,...i,...this._modifierData,terminator:e,args:r,timestamp:f,message:n};this.doHook(R=>{R.afterFormatApplied&&R.afterFormatApplied(this,this._cfg.format,n)}),this._data=E,this._cfg.cache&&this.globalStore.addLogToCache(this),this.doHook(R=>{R.beforePrint&&R.beforePrint(this)}),this.print(this._data),this.doHook(R=>{R.afterTerminated&&R.afterTerminated(this,e,r)}),this.globalStore.getListeners(i.level).forEach(R=>{R(this)})}selectFormatter(e){return this._cfg.formatters[e]}getLevelConfig(e){return this._cfg.levels[e]}runModifierQueue(){this.modifierQueue.forEach(([e,r])=>{let i=r(this.modifierData,this);this.doHook(s=>{s.beforeModifierApplied&&s.beforeModifierApplied(this,e,i)}),this._modifierData=i,this.doHook(s=>{s.afterModifierApplied&&s.afterModifierApplied(this,e,i)})})}doHook(e){this._cfg.middleware?.forEach(r=>{e(r)})}}var $A=su,au={trace:10,verbose:10,debug:20,success:27,progress:28,log:29,info:30,warn:40,error:50,fatal:60,alert:60},JA={10:"trace",20:"debug",27:"success",28:"progress",29:"log",30:"info",40:"warn",50:"error",60:"fatal"};function Hm(t,e){let r=au[t.toLowerCase()]||30,i=au[e.toLowerCase()]||30;return r>=i}o(Hm,"zk");function sh(t){try{let e=new WeakSet;return JSON.stringify(t,(r,i)=>{if(typeof i=="object"&&i!==null){if(e.has(i))return"[Circular]";e.add(i)}return i})}catch{return String(t)}}o(sh,"aW");function L6(t){if(!t)return!1;let e=t.toLowerCase().trim();return e==="true"||e==="1"||e==="yes"||e==="on"}o(L6,"fk");var qA="info",ou=Ku("LOG_LEVEL")||qA,ah=L6(Ku("LOG_JSON_FORMAT")),dp=L6(Ku("LOG_TIMESTAMPS")??"true");function ek(t=100){let e=[];return{write(r){e.push(r),e.length>t&&e.shift()},clear(){e.length=0},recentLogs(){return e.map(r=>{let i=dp?new Date(r.time).toISOString():"",s=JA[r.level??30]||"info";return`${i} ${s} ${r.msg}`.trim()}).join(`
|
|
57
|
-
`)}}}o(ek,"wB");var Cl=ek(),D6=o(()=>{let t=ou.toLowerCase();return t==="trace"?"verbose":t==="debug"?"debug":t==="log"?"log":t==="info"?"info":t==="warn"?"warn":t==="error"?"error":t==="fatal"?"alert":"info"},"vk"),tk=D6(),B6={alert:{levelName:"alert",level:0,style:"font-size: 12px; color: #ff0000;",terminalStyle:["bgRed","white","bold"],method:"error",emoji:""},error:{levelName:"error",level:1,style:"font-size: 12px; color: #ff0000;",terminalStyle:["bgRed","whiteBright","bold"],method:"error",emoji:""},warn:{levelName:"warn",level:2,style:"font-size: 12px; color: #ffaa00;",terminalStyle:["bgYellow","black","bold"],method:"warn",emoji:""},info:{levelName:"info",level:3,style:"font-size: 12px; color: #0099ff;",terminalStyle:["cyan"],method:"info",emoji:""},fail:{levelName:"fail",level:4,style:"font-size: 12px; color: #ff6600;",terminalStyle:["red","underline"],method:"error",emoji:""},success:{levelName:"success",level:5,style:"font-size: 12px; color: #00cc00;",terminalStyle:["green"],method:"log",emoji:""},log:{levelName:"log",level:6,style:"font-size: 12px; color: #888888;",terminalStyle:["white"],method:"log",emoji:""},debug:{levelName:"debug",level:7,style:"font-size: 12px; color: #9b59b6;",terminalStyle:["gray","dim"],method:"debug",emoji:""},verbose:{levelName:"verbose",level:8,style:"font-size: 12px; color: #666666;",terminalStyle:["gray","dim","italic"],method:"debug",emoji:""}},rk=eA({activeLevel:tk,format:ah?"json":"pretty",timestampFormatter:dp?void 0:()=>"",withEmoji:!1,levels:B6});rk.addListener("*",t=>{try{let e=t.data,r=Array.isArray(e?.message)?e.message.map(s=>typeof s=="string"?s:sh(s)).join(" "):typeof e?.message=="string"?e.message:"",i={time:Date.now(),level:typeof e?.level=="number"?e.level:void 0,msg:r};Cl.write(i)}catch{}});function ik(t){let e=$A,r=[];typeof t.namespace=="string"&&r.push(t.namespace),Array.isArray(t.namespaces)&&r.push(...t.namespaces),r.length>0&&(e=e.ns(...r));let i={...t};if(delete i.namespace,delete i.namespaces,ah&&(i.name||(i.name="elizaos"),!i.hostname)){let f="unknown";if(typeof process<"u"&&process.platform)try{f=(t7(),bt(Db)).hostname()}catch{f="localhost"}else typeof window<"u"&&window.location&&(f=window.location.hostname||"browser");i.hostname=f}let s={activeLevel:D6(),format:ah?"json":"pretty",timestampFormatter:dp?void 0:()=>"",withEmoji:!1,levels:B6};return e.meta(i).seal(s)}o(ik,"ZB");function nk(t){let e=ou,r={},i;if(typeof t=="object"&&t!==null){"level"in t&&(e=t.level),"maxMemoryLogs"in t&&typeof t.maxMemoryLogs=="number"&&(i=t.maxMemoryLogs);let{level:s,maxMemoryLogs:f,...n}=t;r=n}return{level:e,base:r,maxMemoryLogs:i}}o(nk,"VB");function oh(t=!1){let{level:e,base:r,maxMemoryLogs:i}=nk(t);if(typeof i=="number"&&i>0&&Cl.clear(),typeof t=="object"&&t&&"__forceType"in t&&t.__forceType==="browser"){let b=(typeof e=="number"?"info":e||ou).toLowerCase(),h=o((...w)=>w.map(p=>typeof p=="string"?p:p instanceof Error?p.message:sh(p)).join(" "),"s"),m=o((w,...p)=>{if(!Hm(w,b))return;let y=h(...p),M=w==="fatal"?"error":w==="trace"||w==="verbose"?"debug":w==="success"||w==="progress"?"info":w==="log"?"log":console[w]?w:"log";typeof console[M]=="function"&&console[M](y)},"K8"),l=o((w,p,...y)=>typeof w=="string"?p!==void 0?[w,p,...y]:[w,...y]:w instanceof Error?p!==void 0?[w.message,p,...y]:[w.message,...y]:p!==void 0?[p,w,...y]:[w,...y],"p");return{level:b,trace:o((w,p,...y)=>m("trace",...l(w,p,...y)),"trace"),debug:o((w,p,...y)=>m("debug",...l(w,p,...y)),"debug"),info:o((w,p,...y)=>m("info",...l(w,p,...y)),"info"),warn:o((w,p,...y)=>m("warn",...l(w,p,...y)),"warn"),error:o((w,p,...y)=>m("error",...l(w,p,...y)),"error"),fatal:o((w,p,...y)=>m("fatal",...l(w,p,...y)),"fatal"),success:o((w,p,...y)=>m("success",...l(w,p,...y)),"success"),progress:o((w,p,...y)=>m("progress",...l(w,p,...y)),"progress"),log:o((w,p,...y)=>m("log",...l(w,p,...y)),"log"),clear:o(()=>{typeof console.clear=="function"&&console.clear()},"clear"),child:o(w=>oh({level:b,...r,...w,__forceType:"browser"}),"child")}}let s=ik(r),f=(typeof e=="number"?"info":e||ou).toLowerCase(),n=o((b,...h)=>{if(!Hm(b,f))return;try{let w="";h.length>0&&(w=h.map(y=>typeof y=="string"?y:y instanceof Error?y.message:sh(y)).join(" ")),r.namespace&&(w=`#${r.namespace} ${w}`);let p={time:Date.now(),level:au[b.toLowerCase()]||au.info,msg:w};Cl.write(p)}catch{}let m=b,l=h;b==="fatal"?m="alert":b==="progress"?(m="info",l=["[PROGRESS]",...h]):b==="success"?(m="info",l=["[SUCCESS]",...h]):b==="trace"&&(m="verbose");try{s[m](...l)}catch{console.log(`[${b.toUpperCase()}]`,...h)}},"w"),v=o((b,h,...m)=>typeof b=="string"?h!==void 0?[b,h,...m]:[b,...m]:b instanceof Error?h!==void 0?[b.message,{error:b},h,...m]:[b.message,{error:b},...m]:h!==void 0?[h,b,...m]:[b,...m],"V");return{level:f,trace:o((b,h,...m)=>n("verbose",...v(b,h,...m)),"trace"),debug:o((b,h,...m)=>n("debug",...v(b,h,...m)),"debug"),info:o((b,h,...m)=>n("info",...v(b,h,...m)),"info"),warn:o((b,h,...m)=>n("warn",...v(b,h,...m)),"warn"),error:o((b,h,...m)=>n("error",...v(b,h,...m)),"error"),fatal:o((b,h,...m)=>n("fatal",...v(b,h,...m)),"fatal"),success:o((b,h,...m)=>n("success",...v(b,h,...m)),"success"),progress:o((b,h,...m)=>n("progress",...v(b,h,...m)),"progress"),log:o((b,h,...m)=>n("log",...v(b,h,...m)),"log"),clear:o(()=>{try{typeof console?.clear=="function"&&console.clear()}catch{}Cl.clear()},"clear"),child:o(b=>oh({level:f,...r,...b}),"child")}}o(oh,"r2");var Ua=oh(),cl=Ua,sk=dt.string().uuid();function No(t){let e=sk.safeParse(t);return e.success?e.data:null}o(No,"CB");var sf=o(t=>{if(t.startsWith("image/"))return"image";if(t.startsWith("video/"))return"video";if(t.startsWith("audio/"))return"audio";if(t.includes("pdf")||t.includes("document")||t.startsWith("text/"))return"document"},"Uj8"),z6=dt.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,"Invalid UUID format"),ak=dt.object({text:dt.string().optional(),thought:dt.string().optional(),actions:dt.array(dt.string()).optional(),providers:dt.array(dt.string()).optional(),source:dt.string().optional(),target:dt.string().optional(),url:dt.string().optional(),inReplyTo:z6.optional(),attachments:dt.array(dt.any()).optional(),channelType:dt.string().optional()}).passthrough(),ok=dt.object({name:dt.string(),content:ak}),lk=dt.object({directory:dt.string(),shared:dt.boolean().optional()}),uk=dt.union([dt.string(),dt.object({path:dt.string(),shared:dt.boolean().optional()}),lk]),ck=dt.union([dt.string(),dt.function().optional()]),fk=dt.object({all:dt.array(dt.string()).optional(),chat:dt.array(dt.string()).optional(),post:dt.array(dt.string()).optional()}).optional(),dk=dt.record(dt.union([dt.string(),dt.boolean(),dt.number(),dt.any()])).optional(),hk=dt.record(dt.union([dt.string(),dt.boolean(),dt.number()])).optional();dt.object({id:z6.optional(),name:dt.string().min(1,"Character name is required"),username:dt.string().optional(),system:dt.string().optional(),templates:dt.record(ck).optional(),bio:dt.union([dt.string(),dt.array(dt.string())]),messageExamples:dt.array(dt.array(ok)).optional(),postExamples:dt.array(dt.string()).optional(),topics:dt.array(dt.string()).optional(),adjectives:dt.array(dt.string()).optional(),knowledge:dt.array(uk).optional(),plugins:dt.array(dt.string()).optional(),settings:dk,secrets:hk,style:fk}).strict();function Pi(){return typeof Buffer<"u"&&typeof Buffer.from=="function"}o(Pi,"_1");function pk(t){let e=t.replace(/[^0-9a-fA-F]/g,"");if(Pi())return Buffer.from(e,"hex");let r=new Uint8Array(e.length/2);for(let i=0;i<r.length;i++)r[i]=parseInt(e.substr(i*2,2),16);return r}o(pk,"eU");function mk(t,e="utf8"){if(Pi()){let r=e==="utf-8"?"utf8":e;return Buffer.from(t,r)}if(e==="base64"){let r=atob(t),i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return i}return new TextEncoder().encode(t)}o(mk,"sU");function F6(t){if(Pi()&&Buffer.isBuffer(t))return t.toString("hex");let e=t instanceof Uint8Array?t:new Uint8Array(t),r="";for(let i=0;i<e.length;i++){let s=e[i].toString(16);r+=s.length===1?"0"+s:s}return r}o(F6,"nZ");function gk(t,e="utf8"){if(Pi()&&Buffer.isBuffer(t)){let i=e==="utf-8"?"utf8":e;return t.toString(i)}let r=t instanceof Uint8Array?t:new Uint8Array(t);if(e==="hex")return F6(r);if(e==="base64"){let i="";for(let s=0;s<r.length;s++)i+=String.fromCharCode(r[s]);return btoa(i)}return new TextDecoder().decode(r)}o(gk,"qr");function vk(t){return t?Pi()&&Buffer.isBuffer(t)?!0:t instanceof Uint8Array||t instanceof ArrayBuffer||typeof t=="object"&&t.buffer instanceof ArrayBuffer&&typeof t.byteLength=="number"&&!Array.isArray(t):!1}o(vk,"$r");function bk(t){return Pi()?Buffer.alloc(t):new Uint8Array(t)}o(bk,"Kr");function yk(t){return Pi()?Buffer.from(t):new Uint8Array(t)}o(yk,"_r");function wk(t){if(Pi()&&t.every(s=>Buffer.isBuffer(s)))return Buffer.concat(t);let e=0;for(let s of t)e+=s.length;let r=new Uint8Array(e),i=0;for(let s of t){let f=s instanceof Uint8Array?s:new Uint8Array(s);r.set(f,i),i+=f.length}return r}o(wk,"Pr");function xk(t,e,r){return Pi()&&Buffer.isBuffer(t)?t.slice(e,r):(t instanceof Uint8Array?t:new Uint8Array(t)).slice(e,r)}o(xk,"Yr");function _k(t,e){if(t.length!==e.length)return!1;let r=t instanceof Uint8Array?t:new Uint8Array(t),i=e instanceof Uint8Array?e:new Uint8Array(e);for(let s=0;s<r.length;s++)if(r[s]!==i[s])return!1;return!0}o(_k,"Or");function Mk(t){return t.length}o(Mk,"jr");function Sk(t){if(Pi())try{return(qt(),bt(Jt)).randomBytes(t)}catch{}let e=new Uint8Array(t);if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)globalThis.crypto.getRandomValues(e);else for(let r=0;r<t;r++)e[r]=Math.floor(Math.random()*256);return e}o(Sk,"Wr");var Ek={fromHex:pk,fromString:mk,fromBytes:yk,toHex:F6,toString:gk,isBuffer:vk,alloc:bk,concat:wk,slice:xk,equals:_k,byteLength:Mk,randomBytes:Sk},Ak=[];for(let t=0;t<256;++t)Ak.push((t+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var Vm=Tr(L9(),1),ha=null,Zm=!1,kk=3e5;function Nk(){let t=Ku("SECRET_SALT","secretsalt")||"secretsalt",e=Date.now();return ha!==null&&e-ha.timestamp<kk&&ha.value===t?ha.value:(t==="secretsalt"&&!Zm&&(Ua.warn("SECRET_SALT is not set or using default value"),Zm=!0),ha={value:t,timestamp:e},t)}o(Nk,"A9");function Ck(t,e){try{if(t==null||typeof t=="boolean"||typeof t=="number")return t;if(typeof t!="string")return Ua.debug(`Value is not a string (type: ${typeof t}), returning as is`),t;let r=t.split(":");if(r.length!==2)return t;let i=Ek.fromHex(r[0]),s=r[1];if(i.length!==16)return i.length&&Ua.debug(`Invalid IV length (${i.length}) - expected 16 bytes`),t;let f=Vm.default.createHash("sha256").update(e).digest().slice(0,32),n=Vm.default.createDecipheriv("aes-256-cbc",f,i),v=n.update(s,"hex","utf8");return v+=n.final("utf8"),v}catch(r){return Ua.error(`Error decrypting value: ${r}`),t}}o(Ck,"UP");function Rk(t,e){let r={};for(let[i,s]of Object.entries(t))typeof s=="string"&&s?r[i]=Ck(s,e):r[i]=s;return r}o(Rk,"zR");const Ge={info:o((t,...e)=>{cl.info({source:"client"},t,...e)},"info"),error:o((t,...e)=>{cl.error({source:"client"},t,...e)},"error"),warn:o((t,...e)=>{cl.warn({source:"client"},t,...e)},"warn"),debug:o((t,...e)=>{cl.debug({source:"client"},t,...e)},"debug")},Ik="elizaos-plugins",Ok="registry",Tk=`https://raw.githubusercontent.com/${Ik}/${Ok}/refs/heads/main/generated-registry.json`,Pk=["@elizaos/plugin-bootstrap","@elizaos/plugin-sql"];async function jk(){try{const t=await fetch(Tk);if(!t.ok)throw new Error(`Failed to fetch registry: ${t.status}`);return await t.json()}catch(t){return Ge.error("Failed to fetch plugin registry:",t),null}}o(jk,"fetchPluginRegistry");function Lk(t){return t.startsWith("@elizaos-plugins/")?t:t.replace("@elizaos/","@elizaos-plugins/")}o(Lk,"getRegistryPluginName");function Co(t){return Pk.includes(t)}o(Co,"isCorePlugin");function Dk(t,e){if(Co(t))return null;if(!e)return Ge.warn(`No registry data available for ${t}`),null;const r=Lk(t),i=t;Ge.debug(`Looking for ${t} in registry as ${r} or ${i}`);let s=e.registry[r];if(!s&&r!==i&&(s=e.registry[i],s&&Ge.debug(`Found plugin under alternative name: ${i}`)),!s?.git?.repo)return Ge.warn(`No GitHub repo found in registry for plugin: ${t} (tried ${r} and ${i})`),null;Ge.debug(`Found repo info for ${t}: ${s.git.repo}`);const f=s.git.v1.branch?s.git.v1:s.git.v0,n=f?.branch||"main";f?.branch?Ge.debug(`Branch for ${t}: ${n}`):Ge.warn(`No branch information found for plugin: ${t}`);let v;const b=s.git.repo.match(/github\.com[:/]([^/]+\/[^/.]+)(\.git)?$/);if(b)v=b[1];else{const m=s.git.repo.match(/^([^/]+\/[^/.]+)$/);if(m)v=m[1];else return Ge.warn(`Could not parse GitHub repo URL: ${s.git.repo}`),null}Ge.debug(`Parsed owner/repo for ${t}: ${v}`);const h=`${v}/${n}`;return Ge.debug(`Initial path for ${t}: ${h}`),h}o(Dk,"getGitHubRepoPath");async function Bk(t,e){if(Co(t))return null;if(!e)return Ge.warn(`No repo path available for plugin: ${t}`),null;Ge.debug(`Starting package.json fetch for ${t} with initial path: ${e}`);const r=e.split("/"),i=r[0],s=r[1],f=r[2]||"main",n=t.replace("@elizaos/","");Ge.debug(`Extracted parts - owner: ${i}, repo: ${s}, branch: ${f}, packageName: ${n}`);const v=[`${i}/${s}/${f}`,`${i}/${s}/main`,`${i}/${s}/master`,`${i}/${s}/1.x`,`${i}/${s}/v1`,`${i}/${s}/v2`,`${i}/${s}/${f}/packages/${n}`,`${i}/${s}/main/packages/${n}`,`${i}/${s}/master/packages/${n}`],b=[...new Set(v)];Ge.debug(`Will try ${b.length} unique paths for ${t}:`,b);for(const h of b)try{const m=`https://raw.githubusercontent.com/${h}/package.json`;Ge.debug(`Trying URL for ${t}: ${m}`);const l=await fetch(m);if(l.ok){const w=await l.json();return Ge.debug(`✅ Found package.json for ${t} at ${m}`),w}else Ge.debug(`❌ Failed to fetch ${t} from ${m}: HTTP ${l.status}`)}catch(m){Ge.debug(`❌ Error fetching ${t} from ${h}: ${m instanceof Error?m.message:String(m)}`)}return Ge.warn(`Could not find package.json for ${t} in any of the expected locations`),null}o(Bk,"fetchPluginPackageJson");function zk(t,e){if(Co(t))return[];if(!e)return[];if(e?.agentConfig?.pluginParameters){const r=[];for(const[i,s]of Object.entries(e.agentConfig.pluginParameters))s.required===!0&&r.push({name:i,description:s.description,required:!0,example:s.example});return r}return e?.elizaos?.secrets?e.elizaos.secrets.filter(r=>r.required):e?.elizaos?.requiredSecrets?e.elizaos.requiredSecrets.map(r=>({name:r,required:!0})):[]}o(zk,"extractRequiredSecrets");function Fk(t){const e=V.useMemo(()=>[...t].sort().join(","),[t]);return Sr({queryKey:["plugin-details",e],queryFn:o(async()=>{Ge.debug("[usePluginDetails] Starting fetch for plugins:",t);const r=[],i=t.filter(Co),s=t.filter(f=>!Co(f));if(Ge.debug("[usePluginDetails] Core plugins:",i),Ge.debug("[usePluginDetails] External plugins:",s),i.forEach(f=>{r.push({name:f,requiredSecrets:[]})}),s.length>0){const f=await jk();if(Ge.debug("[usePluginDetails] Registry data fetched:",f?"success":"failed"),f){const b=Object.keys(f.registry);Ge.debug("[usePluginDetails] Available plugins in registry:",b)}const n=s.map(async b=>{const h=Dk(b,f),m=await Bk(b,h);return{name:b,packageJson:m}}),v=await Promise.all(n);for(const{name:b,packageJson:h}of v){const m=zk(b,h);r.push({name:b,requiredSecrets:m})}}return Ge.debug("[usePluginDetails] Final details:",r),r},"queryFn"),enabled:t.length>0,staleTime:300*1e3,retry:2,refetchOnMount:!1,refetchOnWindowFocus:!1})}o(Fk,"usePluginDetails");function U6(t){const{data:e,isLoading:r,error:i}=Fk(t);return{requiredSecrets:V.useMemo(()=>e?e.reduce((f,n)=>(n.requiredSecrets.forEach(v=>{f.find(b=>b.name===v.name)||f.push({...v,plugin:n.name})}),f),[]):[],[e]),isLoading:r,error:i}}o(U6,"useRequiredSecrets");class Bn extends Error{static{o(this,"ApiError")}code;details;status;constructor(e,r,i,s){super(r),this.code=e,this.details=i,this.status=s,this.name="ApiError"}}class On{static{o(this,"BaseApiClient")}baseUrl;apiKey;timeout;defaultHeaders;constructor(e){this.baseUrl=e.baseUrl.replace(/\/$/,""),this.apiKey=e.apiKey,this.timeout=e.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...e.headers},this.apiKey&&(this.defaultHeaders["X-API-KEY"]=this.apiKey)}createNoContentResponse(){return{success:!0}}async request(e,r,i){let s;this.baseUrl?s=new URL(`${this.baseUrl}${r}`):typeof window<"u"&&window.location?s=new URL(r,window.location.origin):s=new URL(r,"http://localhost:3000"),i?.params&&Object.entries(i.params).forEach(([v,b])=>{b!=null&&s.searchParams.append(v,String(b))});const f=new AbortController,n=setTimeout(()=>f.abort(),this.timeout);try{const v={...this.defaultHeaders,...i?.config?.headers,...i?.headers};i?.body instanceof FormData&&delete v["Content-Type"];const b=await fetch(s.toString(),{method:e,headers:v,body:i?.body instanceof FormData?i.body:i?.body?JSON.stringify(i.body):void 0,signal:f.signal});if(clearTimeout(n),b.status===204||b.headers.get("content-length")==="0")return this.createNoContentResponse();let h;try{h=await b.json()}catch{if(b.ok)return this.createNoContentResponse();throw new Bn("PARSE_ERROR","Failed to parse response as JSON",void 0,b.status)}if(!b.ok){const m=h?.error||{code:"HTTP_ERROR",message:`HTTP ${b.status}: ${b.statusText}`};throw new Bn(m.code,m.message,m.details,b.status)}if(h&&typeof h=="object"&&"success"in h){const m=h;if(!m.success){const l="error"in m?m.error:{code:"UNKNOWN_ERROR",message:"An unknown error occurred"};throw new Bn(l.code,l.message,l.details,b.status)}return m.data}else return h}catch(v){throw clearTimeout(n),v instanceof Bn?v:v instanceof Error?v.name==="AbortError"?new Bn("TIMEOUT","Request timed out"):new Bn("NETWORK_ERROR",v.message):new Bn("UNKNOWN_ERROR","An unknown error occurred")}}async get(e,r){return this.request("GET",e,r)}async post(e,r,i){return this.request("POST",e,{...i,body:r})}async put(e,r,i){return this.request("PUT",e,{...i,body:r})}async patch(e,r,i){return this.request("PATCH",e,{...i,body:r})}async delete(e,r){return this.request("DELETE",e,r)}}class Uk extends On{static{o(this,"AgentsService")}async listAgents(){return this.get("/api/agents")}async getAgent(e){return this.get(`/api/agents/${e}`)}async createAgent(e){return this.post("/api/agents",e)}async updateAgent(e,r){return this.patch(`/api/agents/${e}`,r)}async deleteAgent(e){return this.delete(`/api/agents/${e}`)}async startAgent(e){return this.post(`/api/agents/${e}/start`)}async stopAgent(e){return this.post(`/api/agents/${e}/stop`)}async getWorlds(){return this.get("/api/agents/worlds")}async addAgentToWorld(e,r){return this.post(`/api/agents/${e}/worlds`,{worldId:r})}async updateAgentWorldSettings(e,r,i){return this.patch(`/api/agents/${e}/worlds/${r}`,{settings:i})}async getAgentPanels(e){const r=await this.get(`/api/agents/${e}/panels`);return{panels:(Array.isArray(r)?r:[]).map((s,f)=>({id:`${s.name}-${f}`,name:s.name,url:s.path,type:"plugin"}))}}async getAgentLogs(e,r){return this.get(`/api/agents/${e}/logs`,{params:r})}async deleteAgentLog(e,r){return this.delete(`/api/agents/${e}/logs/${r}`)}async getAgentsForServer(e){return this.get(`/api/messaging/servers/${e}/agents`)}async addAgentToServer(e,r){return this.post(`/api/messaging/servers/${e}/agents`,{agentId:r})}async removeAgentFromServer(e,r){return this.delete(`/api/messaging/servers/${e}/agents/${r}`)}async getServersForAgent(e){return this.get(`/api/messaging/agents/${e}/servers`)}}class Hk extends On{static{o(this,"MessagingService")}async submitMessage(e){return this.post("/api/messaging/submit",e)}async completeMessage(e){return this.post("/api/messaging/complete",e)}async ingestExternalMessages(e){return this.post("/api/messaging/ingest-external",e)}async createChannel(e){const r={name:e.name,type:e.type,server_id:e.serverId||"00000000-0000-0000-0000-000000000000",metadata:e.metadata};return this.post("/api/messaging/central-channels",r)}async createGroupChannel(e){const r="00000000-0000-0000-0000-000000000000";let i,s,f;if(e.metadata){const v={...e.metadata};"server_id"in v&&(s=v.server_id,delete v.server_id),"type"in v&&(f=v.type,delete v.type),Object.keys(v).length>0&&(i=v)}const n={name:e.name,server_id:s||r,participantCentralUserIds:e.participantIds,...f?{type:f}:{},...i?{metadata:i}:{}};return this.post("/api/messaging/central-channels",n)}async getOrCreateDmChannel(e){const[r,i]=e.participantIds,s={currentUserId:r,targetUserId:i,dmServerId:"00000000-0000-0000-0000-000000000000"};return this.get("/api/messaging/dm-channel",{params:s})}async getChannelDetails(e){return this.get(`/api/messaging/central-channels/${e}/details`)}async getChannelParticipants(e){return this.get(`/api/messaging/central-channels/${e}/participants`)}async addAgentToChannel(e,r){return this.post(`/api/messaging/central-channels/${e}/agents`,{agentId:r})}async removeAgentFromChannel(e,r){return this.delete(`/api/messaging/central-channels/${e}/agents/${r}`)}async deleteChannel(e){return this.delete(`/api/messaging/central-channels/${e}`)}async clearChannelHistory(e){return this.delete(`/api/messaging/central-channels/${e}/messages`)}async postMessage(e,r,i){return this.post(`/api/messaging/central-channels/${e}/messages`,{content:r,metadata:i})}async getChannelMessages(e,r){return this.get(`/api/messaging/central-channels/${e}/messages`,{params:r})}async getMessage(e){return this.get(`/api/messaging/messages/${e}`)}async deleteMessage(e,r){return this.delete(`/api/messaging/central-channels/${e}/messages/${r}`)}async updateMessage(e,r){return this.patch(`/api/messaging/messages/${e}`,{content:r})}async searchMessages(e){return this.post("/api/messaging/messages/search",e)}async listServers(){return this.get("/api/messaging/central-servers")}async getServerChannels(e){return this.get(`/api/messaging/central-servers/${e}/channels`)}async createServer(e){return this.post("/api/messaging/servers",e)}async syncServerChannels(e,r){return this.post(`/api/messaging/servers/${e}/sync-channels`,r)}async deleteServer(e){return this.delete(`/api/messaging/servers/${e}`)}async updateChannel(e,r){return this.patch(`/api/messaging/central-channels/${e}`,r)}async generateChannelTitle(e,r){return this.post(`/api/messaging/central-channels/${e}/generate-title`,{agentId:r})}async addUserToChannel(e,r){const i=await this.getChannelDetails(e),s=i.metadata?.participantCentralUserIds||[];if(!s.includes(r)){const f=[...s,r];return this.updateChannel(e,{participantCentralUserIds:f})}return{success:!0,data:i}}async addUsersToChannel(e,r){const f=[...(await this.getChannelDetails(e)).metadata?.participantCentralUserIds||[]];for(const n of r)f.includes(n)||f.push(n);return this.updateChannel(e,{participantCentralUserIds:f})}async removeUserFromChannel(e,r){const f=((await this.getChannelDetails(e)).metadata?.participantCentralUserIds||[]).filter(n=>n!==r);return this.updateChannel(e,{participantCentralUserIds:f})}}class Vk extends On{static{o(this,"MemoryService")}async getAgentMemories(e,r){return this.get(`/api/memory/${e}/memories`,{params:r})}async getRoomMemories(e,r,i){return this.get(`/api/memory/${e}/rooms/${r}/memories`,{params:i})}async updateMemory(e,r,i){return this.patch(`/api/memory/${e}/memories/${r}`,i)}async clearAgentMemories(e){return this.delete(`/api/memory/${e}/memories`)}async clearRoomMemories(e,r){return this.delete(`/api/memory/${e}/memories/all/${r}`)}async listAgentRooms(e){return this.get(`/api/memory/${e}/rooms`)}async getRoom(e,r){return this.get(`/api/memory/${e}/rooms/${r}`)}async createRoom(e,r){return this.post(`/api/memory/${e}/rooms`,r)}async createWorldFromServer(e,r){return this.post(`/api/memory/groups/${e}`,r)}async deleteWorld(e){return this.delete(`/api/memory/groups/${e}`)}async clearWorldMemories(e){return this.delete(`/api/memory/groups/${e}/memories`)}async deleteMemory(e,r){return this.delete(`/api/memory/${e}/memories/${r}`)}async getAgentInternalMemories(e,r,i){return this.get(`/api/memory/${e}/rooms/${r}/memories`,{params:{includeEmbedding:i}})}async deleteAgentInternalMemory(e,r){return this.delete(`/api/memory/${e}/memories/${r}`)}async deleteAllAgentInternalMemories(e,r){return this.delete(`/api/memory/${e}/memories/all/${r}`)}async updateAgentInternalMemory(e,r,i){return this.patch(`/api/memory/${e}/memories/${r}`,i)}async deleteGroupMemory(e,r){return this.delete(`/api/messaging/central-channels/${e}/messages/${r}`)}async clearGroupChat(e){return this.delete(`/api/messaging/central-channels/${e}/messages`)}}class Zk extends On{static{o(this,"AudioService")}async requestBinary(e,r,i){let s;this.baseUrl?s=new URL(`${this.baseUrl}${r}`):typeof window<"u"&&window.location?s=new URL(r,window.location.origin):s=new URL(r,"http://localhost:3000"),i?.params&&Object.entries(i.params).forEach(([v,b])=>{b!=null&&s.searchParams.append(v,String(b))});const f=new AbortController,n=setTimeout(()=>f.abort(),this.timeout);try{const v={...this.defaultHeaders,...i?.headers};i?.body instanceof FormData&&delete v["Content-Type"];const b=await fetch(s.toString(),{method:e,headers:v,body:i?.body instanceof FormData?i.body:i?.body?JSON.stringify(i.body):void 0,signal:f.signal});if(clearTimeout(n),!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return await b.arrayBuffer()}catch(v){throw clearTimeout(n),v instanceof Error?v.name==="AbortError"?new Error("Request timed out"):v:new Error("An unknown error occurred")}}processAudioInput(e){if(e instanceof Blob)return e;if(typeof e=="string"){if(e.startsWith("data:"))try{const[i,s]=e.split(","),f=i.match(/data:([^;]+)/),n=f?f[1]:"audio/wav",v=atob(s),b=new Uint8Array(v.length);for(let h=0;h<v.length;h++)b[h]=v.charCodeAt(h);return new Blob([b],{type:n})}catch(i){throw new Error(`Invalid base64 data URL: ${i instanceof Error?i.message:"Unknown error"}`)}if(this.isBase64String(e))try{const i=atob(e),s=new Uint8Array(i.length);for(let f=0;f<i.length;f++)s[f]=i.charCodeAt(f);return new Blob([s],{type:"audio/wav"})}catch{return e}return e}if(this.isBuffer(e))return new Blob([new Uint8Array(e)],{type:"audio/wav"});const r=e;if(r instanceof ArrayBuffer)return new Blob([r],{type:"audio/wav"});if(r&&typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer)return new Blob([r.buffer],{type:"audio/wav"});throw new Error(`Unsupported audio input type: ${typeof e}. Expected Blob, Buffer, ArrayBuffer, or string.`)}isBase64String(e){const r=/^[A-Za-z0-9+/]*={0,2}$/;return e.length<4||e.length%4!==0?!1:r.test(e)}isBuffer(e){return e!=null&&typeof e=="object"&&typeof e.constructor=="function"&&e.constructor.name==="Buffer"&&typeof e.readUInt8=="function"}async speechConversation(e,r){const i=new FormData,s=this.processAudioInput(r.audio);return s instanceof Blob,i.append("file",s),r.format&&i.append("format",r.format),r.language&&i.append("language",r.language),r.metadata&&i.append("metadata",JSON.stringify(r.metadata)),this.request("POST",`/api/audio/${e}/speech/conversation`,{body:i})}async generateSpeech(e,r){const i=await this.requestBinary("POST",`/api/audio/${e}/speech/generate`,{body:r}),s=new Uint8Array(i);let f="";for(let b=0;b<s.byteLength;b++)f+=String.fromCharCode(s[b]);return{audio:btoa(f),format:"mpeg"}}async synthesizeAudioMessage(e,r){return this.post(`/api/audio/${e}/audio-messages/synthesize`,r)}async transcribe(e,r){const i=new FormData,s=this.processAudioInput(r.audio);return s instanceof Blob,i.append("file",s),r.format&&i.append("format",r.format),r.language&&i.append("language",r.language),this.request("POST",`/api/audio/${e}/transcriptions`,{body:i})}async processSpeech(e,r,i){const s=new FormData,f=this.processAudioInput(r);return f instanceof Blob,s.append("file",f),i&&s.append("metadata",JSON.stringify(i)),this.request("POST",`/api/audio/${e}/speech`,{body:s})}}class Gk extends On{static{o(this,"MediaService")}async uploadAgentMedia(e,r){const i=new FormData;return i.append("file",r.file,r.filename),r.contentType&&i.append("contentType",r.contentType),r.metadata&&i.append("metadata",JSON.stringify(r.metadata)),this.request("POST",`/api/media/agents/${e}/upload-media`,{body:i})}async uploadChannelMedia(e,r){const i=new FormData;return i.append("file",r),this.request("POST",`/api/messaging/central-channels/${e}/upload-media`,{body:i})}}class Yk extends On{static{o(this,"ServerService")}async checkHealth(){return this.get("/api/server/health")}async ping(){return this.get("/api/server/ping")}async hello(){return this.get("/api/server/hello")}async getStatus(){return this.get("/api/server/status")}async stopServer(){return this.post("/api/server/stop")}async getDebugInfo(){return this.get("/api/server/debug/servers")}async submitLogs(e){return this.post("/api/server/logs",{logs:e})}async clearLogs(){return this.delete("/api/server/logs")}}class Qk extends On{static{o(this,"SystemService")}async getEnvironment(){return this.get("/api/system/env/local")}async updateLocalEnvironment(e){if(!e||typeof e!="object")throw new Error("updateLocalEnvironment requires a configuration object");let r;return"variables"in e?r={content:e.variables}:"content"in e?r={content:e.content}:r={content:e},this.post("/api/system/env/local",r)}async getGlobalLogs(e){const r=await fetch(this.buildUrl("/api/server/logs",{params:e}),{method:"GET",headers:this.getHeaders()});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);const i=await r.json();return{logs:i.logs||[],count:i.count||0,total:i.total||0,level:i.requestedLevel||i.level||"all",levels:i.levels||[]}}buildUrl(e,r){const i=new URL(`${this.baseUrl}${e}`);return r?.params&&Object.entries(r.params).forEach(([s,f])=>{f!=null&&i.searchParams.append(s,String(f))}),i.toString()}getHeaders(){return{...this.defaultHeaders}}async deleteGlobalLogs(){return this.delete("/api/server/logs")}async deleteLog(e){throw new Error("Individual log deletion is not supported. Use deleteGlobalLogs() to clear all logs.")}}function Gm(t,e){if(!t)return;let r;if(t instanceof Date)r=t.getTime();else if(typeof t=="string"){if(r=new Date(t).getTime(),isNaN(r)){console.warn(`Invalid date string for ${e}: ${t}`);return}}else if(typeof t=="number")r=t;else{console.warn(`Invalid type for ${e}: ${typeof t}`);return}return r.toString()}o(Gm,"toTimestampString");function pa(t,e){if(!t||t.trim()==="")throw new Error(`${e} is required and cannot be empty`)}o(pa,"validateRequiredParam");class Kk extends On{static{o(this,"SessionsService")}async checkHealth(){return this.get("/api/messaging/sessions/health")}async createSession(e){return this.post("/api/messaging/sessions",e)}async getSession(e){return pa(e,"sessionId"),this.get(`/api/messaging/sessions/${e}`)}async sendMessage(e,r){return pa(e,"sessionId"),pa(r?.content,"content"),this.post(`/api/messaging/sessions/${e}/messages`,r)}async getMessages(e,r){pa(e,"sessionId");const i={};r?.limit&&(i.limit=r.limit.toString());const s=Gm(r?.before,"before");s&&(i.before=s);const f=Gm(r?.after,"after");return f&&(i.after=f),this.get(`/api/messaging/sessions/${e}/messages`,{params:i})}async deleteSession(e){return pa(e,"sessionId"),this.delete(`/api/messaging/sessions/${e}`)}async listSessions(){return this.get("/api/messaging/sessions")}}class hp{static{o(this,"ElizaClient")}agents;messaging;memory;audio;media;server;system;sessions;constructor(e){this.agents=new Uk(e),this.messaging=new Hk(e),this.memory=new Vk(e),this.audio=new Zk(e),this.media=new Gk(e),this.server=new Yk(e),this.system=new Qk(e),this.sessions=new Kk(e)}static create(e){return new hp(e)}}function Xk(){const t=o(()=>`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey"),e=localStorage.getItem(t()),r={baseUrl:window.location.origin,timeout:3e4,headers:{Accept:"application/json"}};return e&&(r.apiKey=e),r}o(Xk,"createApiClientConfig");let Rl=null;function Xt(){return Rl||(Rl=hp.create(Xk())),Rl}o(Xt,"createElizaClient");function Wk(){Rl=null}o(Wk,"resetElizaClient");function $k(t){const e=o(()=>`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey");t?localStorage.setItem(e(),t):localStorage.removeItem(e()),Wk()}o($k,"updateApiClientApiKey");const Jk="elizaos-plugins",qk="registry",eN=`https://raw.githubusercontent.com/${Jk}/${qk}/refs/heads/main/generated-registry.json`;function H6(){return Sr({queryKey:["plugins"],queryFn:o(async()=>{try{const t=Xt(),[e,r]=await Promise.all([fetch(eN),t.agents.listAgents()]),i=await e.json(),s=Object.entries(i.registry||{}).filter(([v,b])=>{const h=v.includes("plugin"),m=b.supports.v1===!0,l=b.npm.v1!==null||b.git.v1.version!==null&&b.git.v1.branch!==null;return h&&m&&l}).map(([v])=>v.replace(/^@elizaos-plugins\//,"@elizaos/")).sort();let f=[];try{const v=r?.agents||[];if(v.length>0){const b=v.find(h=>h.status==="active");if(b&&b.id){const m=(await t.agents.getAgent(b.id))?.plugins;Array.isArray(m)&&(f=m)}}}catch(v){Ge.warn("Could not fetch agent plugins:",v)}return[...new Set([...s,...f])].sort()}catch(t){return Ge.error("Failed to fetch from registry, falling back to basic list:",t),["@elizaos/plugin-bootstrap","@elizaos/plugin-evm","@elizaos/plugin-discord","@elizaos/plugin-elevenlabs","@elizaos/plugin-anthropic","@elizaos/plugin-browser","@elizaos/plugin-farcaster","@elizaos/plugin-groq"].filter(e=>e.includes("plugin")).sort()}},"queryFn")})}o(H6,"usePlugins");const tN={google:"@elizaos/plugin-google-genai",llama_local:"@elizaos/plugin-ollama"},rN={},iN=["@elizaos/plugin-sql","@elizaos/plugin-bootstrap"];function nN(){const{data:t=[]}=H6(),e=o(s=>{const f=new Set;if(Array.isArray(s.clients))for(const v of s.clients){const b=v.toLowerCase(),h=rN[b];if(h&&t.includes(h))f.add(h);else{const m=`@elizaos/plugin-${b}`;t.includes(m)&&f.add(m)}}let n=!1;if(typeof s.modelProvider=="string"){const v=s.modelProvider.toLowerCase(),b=tN[v];if(b&&t.includes(b))f.add(b),n=!0;else{const h=`@elizaos/plugin-${v}`;t.includes(h)&&(f.add(h),n=!0)}n||t.includes("@elizaos/plugin-openai")&&f.add("@elizaos/plugin-openai")}else t.includes("@elizaos/plugin-openai")&&f.add("@elizaos/plugin-openai");for(const v of iN)t.includes(v)&&f.add(v);return Array.from(f).sort()},"matchPlugins");function r(s){return typeof s=="object"&&s!==null&&"user"in s}return o(r,"isV1MessageExampleFormat"),{convertCharacter:o(s=>{const f=[...Array.isArray(s.bio)?s.bio:s.bio?[s.bio]:[],...s.lore??[]],n=(s.messageExamples??[]).map(h=>h.map(m=>r(m)?{name:m.user,content:m.content}:m))??[],v=e(s);return{name:s.name,username:s.username,system:s.system,settings:s.settings,plugins:v,bio:f,topics:s.topics,style:s.style,adjectives:s.adjectives,messageExamples:n,postExamples:s.postExamples}},"convertCharacter")}}o(nN,"useConvertCharacter");const sN=o((t=768)=>{const e=V.useRef(null),[r,i]=V.useState(!0),s=V.useRef(null),f=V.useRef(0);return V.useEffect(()=>{const n=e.current;if(!n)return;const v=o(h=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{const m=h>=t;i(l=>l!==m?m:l),f.current=h},150)},"handleResize"),b=new ResizeObserver(h=>{for(const m of h){const{width:l}=m.contentRect;Math.abs(l-f.current)>5&&v(l)}});return b.observe(n),setTimeout(()=>{const{width:h}=n.getBoundingClientRect();f.current=h,i(h>=t)},0),()=>{b.disconnect(),s.current&&clearTimeout(s.current)}},[t]),{containerRef:e,showLabels:r}},"useContainerWidth");function V6({characterValue:t,setCharacterValue:e,title:r,description:i,onSubmit:s,onDelete:f,onReset:n,onStopAgent:v,isDeleting:b=!1,isStopping:h=!1,customComponents:m=[],onTemplateChange:l,secretPanelRef:w}){const{toast:p}=Wt(),{data:y,isLoading:M}=xx(),[E,R]=V.useState(!1),[I,T]=V.useState("none"),[P,j]=V.useState("basic"),L=V.useRef(null),[U,Z]=V.useState(!1),[ne,F]=V.useState(!1),[Y,a]=V.useState(!1),[g,u]=V.useState(null),[d,x]=V.useState({}),A=V.useMemo(()=>t?.plugins||[],[t?.plugins]),{requiredSecrets:N}=U6(A),{convertCharacter:S}=nN();V.useEffect(()=>{o(async()=>{try{const J=await Xt().system.getEnvironment();x(J||{})}catch(W){console.error("Failed to fetch global environment variables:",W),x({})}},"fetchGlobalEnvs")()},[]);const{containerRef:c,showLabels:_}=sN(640),C=V.useCallback(()=>{const K=L.current;if(!K)return;const{scrollLeft:W,scrollWidth:J,clientWidth:pe}=K;Z(W>0),F(W+pe<J-1)},[]);V.useEffect(()=>{const K=L.current;if(K)return C(),K.addEventListener("scroll",C),window.addEventListener("resize",C),()=>{K.removeEventListener("scroll",C),window.removeEventListener("resize",C)}},[C,m.length]);const O=o(K=>{const W=L.current;if(!W)return;const J=W.clientWidth*.8;W.scrollBy({left:K==="left"?-J:J,behavior:"smooth"})},"scrollTabs"),D=V.useMemo(()=>{const K=yb();return y&&!M?[...K.filter(J=>J.provider!=="elevenlabs"),...y]:K},[y,M]),B=V.useMemo(()=>[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The primary identifier for this agent",fieldType:"text",getValue:o(K=>K.name||"","getValue"),tooltip:"Display name that will be visible to users. Required for identification purposes."},{title:"Username",name:"username",description:"Used in URLs and API endpoints",fieldType:"text",getValue:o(K=>K.username||"","getValue"),tooltip:"Unique identifier for your agent. Used in APIs/URLs and Rooms."},{title:"System",name:"system",description:"System prompt defining agent behavior",fieldType:"textarea",getValue:o(K=>K.system||"","getValue"),tooltip:"Instructions for the AI model that establish core behavior patterns and personality traits."},{title:"Voice Model",name:"settings.voice.model",description:"Voice model for audio synthesis",fieldType:"select",getValue:o(K=>K.settings?.voice?.model||"","getValue"),options:D.map(K=>({value:K.value,label:K.label})),tooltip:"Select a voice that aligns with the agent's intended persona."}]},{sectionTitle:"Content",sectionValue:"content",sectionType:"array",fields:[{title:"Bio",description:"Bio data for this agent",path:"bio",getData:o(K=>Array.isArray(K.bio)?K.bio:[],"getData"),tooltip:"Biographical details that establish the agent's background and context."},{title:"Topics",description:"Topics this agent can talk about",path:"topics",getData:o(K=>K.topics||[],"getData"),tooltip:"Subject domains the agent can discuss with confidence."},{title:"Adjectives",description:"Descriptive personality traits",path:"adjectives",getData:o(K=>K.adjectives||[],"getData"),tooltip:"Key personality attributes that define the agent's character."}]},{sectionTitle:"Style",sectionValue:"style",sectionType:"array",fields:[{title:"All Styles",description:"Writing style for all content types",path:"style.all",getData:o(K=>K.style?.all||[],"getData"),tooltip:"Core writing style guidelines applied across all content formats."},{title:"Chat Style",description:"Style specific to chat interactions",path:"style.chat",getData:o(K=>K.style?.chat||[],"getData"),tooltip:"Writing style specific to conversational exchanges."},{title:"Post Style",description:"Style for long-form content",path:"style.post",getData:o(K=>K.style?.post||[],"getData"),tooltip:"Writing style for structured content such as articles or posts."}]}],[D]),z=o(K=>{const{name:W,value:J,type:pe}=K.target,le=K.target.checked;if(pe==="checkbox")e.updateField(W,le);else if(W.startsWith("settings.")){const oe=W.substring(9);e.updateSetting?e.updateSetting(oe,J):e.updateField(W,J)}else e.updateField(W,J)},"handleChange"),G=o((K,W)=>{if(W.startsWith("settings.")){const J=W.substring(9);if(e.updateSetting){if(e.updateSetting(J,K),J==="voice.model"&&K){const pe=Ed(K);if(pe){const le=Array.isArray(t.plugins)?[...t.plugins]:[],oe=Ed(t.settings?.voice?.model),Ve=vb[pe.provider],_e=[...le];Ve&&!le.includes(Ve)&&_e.push(Ve),e.setPlugins?e.setPlugins(_e):e.updateField&&e.updateField("plugins",_e),oe?.provider!==pe.provider&&p({title:"Plugin Updated",description:`${Ve} plugin has been set for the selected voice model.`})}}}else e.updateField(W,K)}else e.updateField(W,K)},"handleVoiceModelChange"),te=o((K,W)=>{if(!K.includes(".")){e.updateField(K,W);return}const J=K.split(".");if(J.length===2&&J[0]==="style"){e.setStyleArray?e.setStyleArray(J[1],W):e.updateField(K,W);return}e.updateField(K,W)},"updateArray"),$=o(async K=>{if(K.settings?.avatar){const W=new Image;if(W.src=K.settings.avatar,await new Promise(J=>W.onload=J),W.width>Za||W.height>Za){const pe=await(await fetch(K.settings.avatar)).blob(),le=new File([pe],"avatar.jpg",{type:pe.type}),oe=await sb(le);return{...K,settings:{...K.settings,avatar:oe}}}}return K},"ensureAvatarSize"),q=o(async K=>{K.preventDefault(),R(!0);try{const W=await $(t);let J=[];if(w?.current)J=w.current.validateSecrets().missingSecrets;else{const pe=W.settings?.secrets,le=pe&&typeof pe=="object"&&!Array.isArray(pe)?pe:{};J=N.filter(oe=>{const Ve=le[oe.name];if(Ve&&typeof Ve=="string"&&Ve.trim()!=="")return!1;const _e=d[oe.name];return!(_e&&_e.trim()!=="")}).map(oe=>oe.name)}if(J.length>0){R(!1),u(W),a(!0);return}await s(W)}catch(W){p({title:"Error",description:W instanceof Error?W.message:"Failed to update agent",variant:"destructive"})}finally{R(!1)}},"handleFormSubmit"),Ce=o(async()=>{if(a(!1),g){R(!0);try{await s(g)}catch(K){p({title:"Error",description:K instanceof Error?K.message:"Failed to update agent",variant:"destructive"})}finally{R(!1),u(null)}}},"handleConfirmSaveWithMissingSecrets"),fe=o(()=>{a(!1),u(null),j("custom-Secret")},"handleCancelSaveWithMissingSecrets"),ae=o(K=>k.jsxs("div",{className:`w-full ${K.name==="name"?"agent-form-name":""} ${K.name==="system"?"agent-form-system-prompt":""}`,children:[k.jsxs(js,{htmlFor:K.name,className:"text-sm font-normal block mb-2",children:[K.title,K.name in bs&&bs[K.name]===xl.REQUIRED&&k.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),K.fieldType==="textarea"?k.jsx(To,{id:K.name,name:K.name,value:K.getValue(t),onChange:z,className:"min-h-[120px] resize-y"}):K.fieldType==="checkbox"?k.jsx(hr,{id:K.name,name:K.name,type:"checkbox",checked:t[K.name]==="true",onChange:z}):K.fieldType==="select"?k.jsxs($n,{name:K.name,value:K.getValue(t),onValueChange:o(W=>G(W,K.name),"onValueChange"),children:[k.jsx(mn,{children:k.jsx(Jn,{placeholder:K.name.includes("voice.model")&&M?"Loading voice models...":"Select a voice model"})}),k.jsx(gn,{children:K.name==="settings.voice.model"?k.jsxs(k.Fragment,{children:[k.jsx(Ec,{children:k.jsx(Kt,{value:"none",children:"No Voice"})}),k.jsx(Sd,{}),k.jsxs(Ec,{children:[k.jsx(Md,{children:"OpenAI Voices"}),bb.map(W=>k.jsx(Kt,{value:W.value,children:W.label.replace("OpenAI - ","")},W.value))]}),k.jsx(Sd,{}),k.jsxs(Ec,{children:[k.jsx(Md,{children:"ElevenLabs Voices"}),Oh.map(W=>k.jsx(Kt,{value:W.value,children:W.label.replace("ElevenLabs - ","")},W.value)),y&&y.length>0&&y.map(W=>k.jsx(Kt,{value:W.value,children:W.label.replace("ElevenLabs - ","")},W.value))]})]}):K.options?.map(W=>k.jsx(Kt,{value:W.value,children:W.label},W.value))})]}):k.jsx(hr,{id:K.name,name:K.name,type:K.fieldType,value:K.getValue(t),onChange:z}),K.description&&k.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:K.description})]},K.name),"renderInputField"),be=o(K=>k.jsxs("div",{className:"w-full",children:[k.jsxs(js,{htmlFor:K.path,className:"text-sm font-normal block mb-2",children:[K.title,K.path in bs&&bs[K.path]===xl.REQUIRED&&k.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),k.jsx(ux,{data:K.getData(t),onChange:o(W=>te(K.path,W),"onChange")}),K.description&&k.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:K.description})]},K.path),"renderArrayField"),H=o(()=>{Ih(t,p)},"handleExportJSON");function ee(K){return typeof K=="object"&&K!==null&&("lore"in K||"clients"in K||"modelProvider"in K)}o(ee,"isV1Character");const Q=o(async K=>{const W=K.target.files?.[0];if(W)try{const J=await W.text();let pe=JSON.parse(J);ee(pe)&&(pe=S(pe));const le=Object.keys(bs).filter(oe=>{if(bs[oe]!==xl.REQUIRED)return!1;const Ve=oe.split(".");let _e=pe;for(const Le of Ve)if(_e=_e?.[Le],_e===void 0)return!0;return!1});if(le.length>0){p({title:"Import Failed",description:`Missing required fields: ${le.join(", ")}`,variant:"destructive"});return}e.importAgent?e.importAgent(pe):console.warn("Missing importAgent method"),p({title:"Agent Imported",description:"Agent data has been successfully loaded."})}catch(J){p({title:"Import Failed",description:J instanceof Error?J.message:"Invalid JSON file",variant:"destructive"})}finally{K.target.value=""}},"handleImportJSON"),X=V.useRef(null),se=o(()=>{X.current?.click()},"handleImportClick"),Ne=V.useMemo(()=>{const K=[];return v&&K.push({label:"Stop Agent",description:"Stop running",onClick:v}),f&&K.push({label:"Delete Agent",description:"Delete permanently",onClick:o(()=>f(),"onClick")}),K},[v,f]),we=V.useCallback(K=>{if(T(K),K==="none"&&n){n();return}const W=xb(K);W&&e.importAgent&&(e.importAgent(W.template),l?.())},[n,e,l]),ue=[...B.map(K=>({value:K.sectionValue,label:K.sectionTitle,shortLabel:K.sectionTitle.split(" ")[0]})),...m.map(K=>({value:`custom-${K.name}`,label:K.name,shortLabel:K.shortLabel||K.name.split(" ")[0]}))];return k.jsxs("div",{ref:c,className:"w-full max-w-full mx-auto p-6 sm:p-8 h-full overflow-y-auto",children:[(r||i)&&k.jsxs("div",{className:"mb-8",children:[r&&k.jsx("h1",{className:"text-2xl font-semibold mb-2",children:r}),i&&k.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:i})]}),k.jsxs("div",{className:"mb-8",children:[k.jsx(js,{htmlFor:"template-selector",className:"text-sm",children:"Start with a template"}),k.jsxs($n,{value:I,onValueChange:we,children:[k.jsx(mn,{className:"w-full mt-1",children:k.jsx(Jn,{placeholder:"None (blank start)"})}),k.jsx(gn,{children:wb.map(K=>k.jsx(Kt,{value:K.id,children:k.jsx(Ps,{children:k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx("span",{className:"w-full text-left",children:K.label})}),k.jsx(or,{side:"right",children:k.jsx("p",{className:"max-w-xs",children:K.description})})]})})},K.id))})]})]}),k.jsxs("form",{onSubmit:q,children:[k.jsxs(Rh,{value:P,onValueChange:j,className:"w-full",children:[k.jsxs("div",{className:"relative mb-4",children:[U&&k.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"absolute left-0 top-1/2 -translate-y-1/2 z-10 h-8 w-8 p-0 bg-background/80 backdrop-blur-sm shadow-md",onClick:o(()=>O("left"),"onClick"),children:k.jsx(Y3,{className:"h-4 w-4"})}),k.jsx("div",{ref:L,className:"overflow-x-auto scrollbar-hide",children:k.jsx(Su,{className:"inline-flex h-10 items-center justify-start text-muted-foreground w-full",children:ue.map(K=>k.jsx(Qa,{value:K.value,className:He("whitespace-nowrap",!_&&"px-2 text-xs"),children:_?K.label:K.shortLabel},K.value))})}),ne&&k.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-1/2 -translate-y-1/2 z-10 h-8 w-8 p-0 bg-background/80 backdrop-blur-sm shadow-md",onClick:o(()=>O("right"),"onClick"),children:k.jsx(Q3,{className:"h-4 w-4"})})]}),k.jsxs("div",{className:"max-h-[100vh] overflow-y-auto pb-4 px-1",children:[B.map(K=>k.jsx(xi,{value:K.sectionValue,className:"space-y-6 mt-0 focus:outline-none",children:K.sectionType==="input"?K.fields.map(ae):K.fields.map(be)},K.sectionValue)),m.map(K=>k.jsx(xi,{value:`custom-${K.name}`,className:"mt-0 focus:outline-none",children:k.jsx("div",{className:"h-full",children:K.component})},`custom-${K.name}`))]})]}),k.jsxs("div",{className:"flex items-center justify-between w-full mt-6",children:[k.jsxs(Ka,{children:[k.jsx(Xa,{asChild:!0,children:k.jsxs($e,{type:"button",variant:"outline",size:"icon",className:"flex-shrink-0 p-2.5",children:[k.jsx(Nv,{className:"h-4 w-4"}),k.jsx("span",{className:"sr-only",children:"More options"})]})}),k.jsxs(Wa,{align:"start",side:"top",children:[k.jsxs(_i,{onClick:se,children:[k.jsx(K3,{className:"h-4 w-4 mr-2"}),"Import"]}),k.jsxs(_i,{onClick:H,children:[k.jsx(Cv,{className:"h-4 w-4 mr-2"}),"Export"]}),Ne.length>0&&k.jsx(Bl,{}),Ne.length>0&&Ne.map(K=>{const W=K.label==="Stop Agent",J=K.label==="Delete Agent",pe=W?h:J?b:!1;return k.jsxs(_i,{onClick:K.onClick,disabled:pe,className:J?"text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50":"",children:[pe?k.jsx(Ar,{className:"h-4 w-4 animate-spin mr-2"}):W?k.jsx(bh,{className:"h-4 w-4 mr-2"}):k.jsx(Io,{className:"h-4 w-4 mr-2"}),pe?`${W?"Stopping":"Deleting"}...`:K.label]},K.label)})]})]}),k.jsxs("div",{className:"flex items-center gap-3",children:[k.jsx(Ps,{children:k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsxs($e,{type:"button",variant:"outline",onClick:o(()=>{n?.()},"onClick"),children:[k.jsx(Rv,{className:"h-4 w-4"}),k.jsx("span",{className:"ml-2",children:"Reset"})]})}),k.jsx(or,{children:k.jsx("p",{children:"Reset all form fields to their original values"})})]})}),k.jsx(Ps,{children:k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{type:"submit",disabled:E,className:"agent-form-submit",children:E?k.jsxs(k.Fragment,{children:[k.jsx(Ar,{className:"h-4 w-4 animate-spin"}),k.jsx("span",{className:"ml-2",children:"Saving..."})]}):k.jsxs(k.Fragment,{children:[k.jsx(Iv,{className:"h-4 w-4"}),k.jsx("span",{className:"ml-2",children:"Save"})]})})}),k.jsx(or,{children:k.jsx("p",{children:"Save all changes to the agent configuration"})})]})})]}),k.jsx("input",{ref:X,type:"file",accept:".json",onChange:Q,className:"hidden"})]})]}),k.jsx(Sx,{open:Y,onOpenChange:a,missingSecrets:(()=>{let K=[];if(w?.current)K=w.current.validateSecrets().missingSecrets;else{const W=t.settings?.secrets,J=W&&typeof W=="object"&&!Array.isArray(W)?W:{};K=N.filter(pe=>{const le=J[pe.name];if(le&&typeof le=="string"&&le.trim()!=="")return!1;const oe=d[pe.name];return!(oe&&oe.trim()!=="")}).map(pe=>pe.name)}return K.map(W=>{const J=N.find(pe=>pe.name===W);return{name:W,plugin:J?.plugin,description:J?.description}})})(),onConfirm:Ce,onCancel:fe})]})}o(V6,"CharacterForm");function Z6({characterValue:t,setCharacterValue:e}){const r=o(()=>{const l=t?.settings?.avatar;return typeof l=="string"?l:null},"getAvatarUrl"),[i,s]=V.useState(r()),[f,n]=V.useState(!1),v=V.useRef(null);V.useEffect(()=>{s(r()),n(!1)},[t.id]);const b=o(async l=>{const w=l.target.files?.[0];if(w)try{const p=await sb(w);s(p),n(!0),m(p)}catch(p){console.error("Error compressing image:",p)}},"handleFileUpload"),h=o(()=>{i&&(s(null),n(!0),m(""))},"handleRemoveAvatar"),m=o(l=>{e.updateAvatar?e.updateAvatar(l):e.updateSetting?e.updateSetting("avatar",l):e.updateField&&e.updateField("settings.avatar",l)},"updateCharacterAvatar");return k.jsxs("div",{className:"rounded-lg w-full",children:[k.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Avatar Settings"}),k.jsxs("div",{className:"flex flex-col items-center gap-4 pb-4 max-w-sm mx-auto",children:[i?k.jsx("div",{className:"w-64 h-64 mb-2",children:k.jsx("img",{src:i,alt:"Agent Avatar",className:"object-cover w-full h-full rounded-lg border"})}):k.jsx("div",{className:"w-64 h-64 flex items-center justify-center border border-dashed rounded-lg text-gray-500 mb-2 cursor-pointer hover:bg-gray-50 transition-colors",onClick:o(()=>v.current?.click(),"onClick"),children:k.jsxs("div",{className:"flex flex-col items-center gap-2",children:[k.jsx(X3,{className:"w-10 h-10"}),k.jsx("span",{className:"text-sm",children:"Click to upload"})]})}),k.jsxs("div",{className:"flex flex-col gap-3 w-64",children:[k.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:v,onChange:b}),k.jsxs("div",{className:"flex gap-2",children:[k.jsxs($e,{type:"button",className:"flex items-center gap-2 flex-1",onClick:o(()=>v.current?.click(),"onClick"),children:[k.jsx(W3,{className:"w-5 h-5"}),i?"Replace":"Upload"]}),i&&k.jsx($e,{type:"button",variant:"outline",className:"flex items-center",onClick:h,children:k.jsx(Vr,{className:"w-5 h-5"})})]}),k.jsxs("div",{className:"flex items-center justify-center gap-1 text-xs text-muted-foreground mt-1",children:[k.jsx(Ov,{className:"w-3.5 h-3.5"}),k.jsxs("span",{children:["Images greater than ",Za,"x",Za," will be resized"]})]})]})]})]})}o(Z6,"AvatarPanel");const pp=sv,aN=av,oN=ov,G6=V.forwardRef(({className:t,...e},r)=>k.jsx(hu,{ref:r,className:He("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));G6.displayName=hu.displayName;const $u=V.forwardRef(({className:t,children:e,...r},i)=>k.jsxs(oN,{children:[k.jsx(G6,{}),k.jsxs(du,{ref:i,className:He("fixed left-[50%] top-[50%] z-50 bg-card grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...r,children:[e,k.jsxs(lv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[k.jsx(Vr,{className:"h-4 w-4"}),k.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$u.displayName=du.displayName;const Ju=o(({className:t,...e})=>k.jsx("div",{className:He("flex flex-col space-y-1.5 text-center sm:text-left",t),...e}),"DialogHeader");Ju.displayName="DialogHeader";const mp=o(({className:t,...e})=>k.jsx("div",{className:He("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e}),"DialogFooter");mp.displayName="DialogFooter";const qu=V.forwardRef(({className:t,...e},r)=>k.jsx(pu,{ref:r,className:He("text-lg font-semibold leading-none tracking-tight",t),...e}));qu.displayName=pu.displayName;const gp=V.forwardRef(({className:t,...e},r)=>k.jsx(mu,{ref:r,className:He("text-sm text-muted-foreground",t),...e}));gp.displayName=mu.displayName;const cn={"@elizaos/plugin-sql":{title:"Essential Plugin: SQL",description:"Provides memory and state storage. If removed, replace with an adapter plugin or your agent may lose conversation history and memory capabilities."},"@elizaos/plugin-openai":{title:"Essential Plugin: OpenAI",description:"Provides language model access. If removed, replace with another LLM plugin or your agent may fail to function properly."},"@elizaos/plugin-bootstrap":{title:"Essential Plugin: Bootstrap",description:"Provides default message processing, event handling, and attachment workflows for your agent. If removed, ensure you have a custom plugin handling these responsibilities, or your agent may not process events or respond to messages as expected."}};function Y6({characterValue:t,setCharacterValue:e,initialPlugins:r}){const{data:i,error:s}=H6(),{toast:f}=Wt(),[n,v]=V.useState(""),[b,h]=V.useState(!1),[m,l]=V.useState(null),[w,p]=V.useState(!1),y=V.useMemo(()=>Array.isArray(t?.plugins)?t.plugins:[],[t?.plugins]),M=V.useMemo(()=>{const Z=["@elizaos/plugin-sql"];return i?[...Z,...(Array.isArray(i)?i:Object.keys(i)).filter(ne=>!Z.includes(ne))]:Z},[i]),E=V.useMemo(()=>{const Z=t?.settings;if(!Z||typeof Z!="object"||Array.isArray(Z))return null;const ne=Z.voice;if(!ne||typeof ne!="object"||Array.isArray(ne))return null;const F=ne.model;if(!F||typeof F!="string")return null;const Y=Ed(F);if(!Y)return null;const a=vb[Y.provider],g=y.includes(a);return{provider:Y.provider,requiredPlugin:a,isPluginEnabled:g}},[t?.settings,y]),R=V.useMemo(()=>r?r.length!==y.length?!0:!r?.every(Z=>y.includes(Z)):!1,[y,r]),I=V.useMemo(()=>M.filter(Z=>!y.includes(Z)).filter(Z=>Z.toLowerCase().includes(n.toLowerCase())),[M,y,n]),T=o(Z=>{if(!y.includes(Z)){if(e.addPlugin)e.addPlugin(Z);else if(e.updateField){const ne=Array.isArray(t.plugins)?[...t.plugins]:[];e.updateField("plugins",[...ne,Z])}}},"handlePluginAdd"),P=o(Z=>{if(Object.keys(cn).includes(Z)){l(Z),p(!0);return}j(Z)},"handlePluginRemove"),j=o(Z=>{const ne=y.indexOf(Z);if(ne!==-1){if(e.removePlugin)e.removePlugin(ne);else if(e.updateField){const F=[...y];F.splice(ne,1),e.updateField("plugins",F)}}},"removePlugin"),L=o(()=>{m&&(j(m),l(null)),p(!1)},"handleConfirmRemoval"),U=o(()=>{l(null),p(!1)},"handleCancelRemoval");return k.jsx("div",{className:"space-y-6",children:k.jsx("div",{className:"space-y-4",children:k.jsxs("div",{children:[k.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),s?k.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",s.message]}):k.jsxs("div",{className:"space-y-4",children:[k.jsx(Th,{open:w,onOpenChange:p,children:k.jsxs(Eu,{children:[k.jsxs(Au,{children:[k.jsx(Nu,{children:m&&Object.keys(cn).includes(m)?cn[m].title:"Warning: Essential Plugin"}),k.jsx(Cu,{children:m&&Object.keys(cn).includes(m)?cn[m].description:"This plugin provides essential functionality for your agent."})]}),k.jsxs(ku,{children:[k.jsx(Iu,{onClick:U,children:"Cancel"}),k.jsx(Ru,{onClick:L,children:"Confirm Removal"})]})]})}),E&&k.jsxs("div",{className:"rounded-md border p-4 mb-4 flex items-center gap-2",children:[k.jsx(Xr,{className:"h-4 w-4 text-yellow-500"}),k.jsx("p",{className:"text-xs text-white",children:(()=>{switch(E.provider){case"elevenlabs":return"ElevenLabs plugin is required for the selected voice model.";case"openai":return"OpenAI plugin is required for the selected voice model.";case"none":return'No voice plugin required for "No Voice" option.';default:return`${E.provider} plugin is required for the selected voice model.`}})()})]}),y.length>0&&k.jsxs("div",{className:"rounded-md bg-muted p-4",children:[k.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),k.jsx("div",{className:"flex flex-wrap gap-2",children:[...y].sort((Z,ne)=>{const F=Object.keys(cn).includes(Z),Y=Object.keys(cn).includes(ne);return F===Y?0:F?-1:1}).map(Z=>{const ne=E?.requiredPlugin===Z,F=Object.keys(cn).includes(Z);return k.jsxs($e,{type:"button",variant:"ghost",size:"sm",className:`inline-flex items-center rounded-full ${F?"bg-blue-800 text-blue-700 hover:bg-blue-600":"bg-primary/10 text-primary hover:bg-primary/20"} px-2.5 py-0.5 text-xs font-medium h-auto`,title:ne?"Required by voice model":F?"Essential plugin for agent functionality":"",children:[F&&k.jsx("span",{className:"w-2 h-2 rounded-full bg-white inline-block"}),k.jsx("span",{className:"text-white font-semibold",children:Z}),k.jsx("span",{className:Eh("ml-1 opacity-70 hover:opacity-100",F&&"text-white"),onClick:o(()=>{if(ne){f({title:"Can't Remove Plugin",description:"This plugin is required by the selected voice model.",variant:"destructive"});return}P(Z)},"onClick"),children:"×"})]},Z)})}),k.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:k.jsxs("span",{className:"inline-flex items-center",children:[k.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-600 mr-1"}),"Essential plugins provide core functionality"]})})]}),k.jsx("div",{className:"space-y-2",children:k.jsxs(pp,{open:b,onOpenChange:h,children:[k.jsx(aN,{asChild:!0,children:k.jsx($e,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),k.jsxs($u,{className:"max-w-[400px]",children:[k.jsx(Ju,{children:k.jsx(qu,{children:"Add Plugins"})}),k.jsxs("div",{className:"space-y-4 py-4",children:[k.jsx("div",{className:"space-y-2",children:k.jsx(hr,{type:"search",placeholder:"Search plugins...",value:n,onChange:o(Z=>v(Z.target.value),"onChange")})}),k.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:I.length===0?k.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):I.map(Z=>k.jsx($e,{variant:"ghost",className:"w-full justify-start font-normal",onClick:o(()=>{T(Z),v(""),h(!1)},"onClick"),children:Z},Z))})]})]})]})}),R&&k.jsx("p",{className:"text-xs text-yellow-500",children:"Plugins configuration has been changed"})]})]})})})}o(Y6,"PluginsPanel");const Q6=V.forwardRef(({className:t,children:e,...r},i)=>k.jsxs(Tv,{ref:i,className:He("relative overflow-hidden",t),...r,children:[k.jsx($3,{className:"h-full w-full rounded-[inherit]",children:e}),k.jsx(K6,{}),k.jsx(J3,{})]}));Q6.displayName=Tv.displayName;const K6=V.forwardRef(({className:t,orientation:e="vertical",...r},i)=>k.jsx(Pv,{ref:i,orientation:e,className:He("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...r,children:k.jsx(q3,{className:"relative flex-1 rounded-full bg-border"})}));K6.displayName=Pv.displayName;const lN=sn("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),lh=V.forwardRef(({className:t,variant:e,...r},i)=>k.jsx("div",{ref:i,role:"alert",className:He(lN({variant:e}),t),...r}));lh.displayName="Alert";const uN=V.forwardRef(({className:t,...e},r)=>k.jsx("h5",{ref:r,className:He("mb-1 font-medium leading-none tracking-tight",t),...e}));uN.displayName="AlertTitle";const uh=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,className:He("text-sm [&_p]:leading-relaxed",t),...e}));uh.displayName="AlertDescription";const vp=V.forwardRef(({characterValue:t,onChange:e},r)=>{const[i,s]=V.useState([]),[f,n]=V.useState(""),[v,b]=V.useState(""),[h,m]=V.useState(!1),[l,w]=V.useState(null),[p,y]=V.useState(""),[M,E]=V.useState(!1),[R,I]=V.useState([]),[T,P]=V.useState(new Set),[j,L]=V.useState({}),[U,Z]=V.useState(!0),[ne,F]=V.useState(!1),[Y,a]=V.useState(""),g=V.useRef(null),u=V.useRef(""),d=V.useRef(null),x=V.useRef(""),A=V.useMemo(()=>t?.plugins||[],[t?.plugins]),{requiredSecrets:N,isLoading:S}=U6(A);V.useEffect(()=>{o(async()=>{try{Z(!0);const se=await Xt().system.getEnvironment();L(se||{})}catch(X){console.error("Failed to fetch global environment variables:",X),L({})}finally{Z(!1)}},"fetchGlobalEnvs")()},[]);const c=V.useCallback(()=>{const Q={};return i.forEach(({name:X,value:se})=>{Q[X]=se}),R.forEach(X=>{Q[X]=null}),Q},[i,R]),_=V.useCallback(()=>{const Q=c(),se=(S?i.filter(Ne=>Ne.isRequired):N).filter(Ne=>{const we=typeof Ne=="object"&&"name"in Ne?Ne.name:Ne,ue=Q[we];return!(ue&&ue.trim()!==""||j[we]&&j[we].trim()!=="")}).map(Ne=>typeof Ne=="object"&&"name"in Ne?Ne.name:Ne);return{isValid:se.length===0,missingSecrets:se}},[c,N,S,i,j]);V.useImperativeHandle(r,()=>({getSecrets:c,validateSecrets:_}),[c,_]);const C=o(Q=>{P(X=>{const se=new Set(X);return se.has(Q)?se.delete(Q):se.add(Q),se})},"toggleSecretVisibility"),O=V.useCallback(()=>{const Q=[];Q.push("# Environment Variables"),Q.push("");const X=i.filter(Ne=>Ne.isRequired),se=i.filter(Ne=>!Ne.isRequired&&Ne.value&&Ne.value.trim()!=="");return X.length>0&&(Q.push("# Required Secrets"),X.forEach(Ne=>{Ne.plugin&&Q.push(`# Required by ${Ne.plugin}`),Ne.description&&Q.push(`# ${Ne.description}`),Q.push(`${Ne.name}=${Ne.value||""}`),Q.push("")})),se.length>0&&(Q.push("# Optional Variables"),se.forEach(Ne=>{Q.push(`${Ne.name}=${Ne.value}`)})),Q.join(`
|
|
58
|
-
`)},[i]),D=V.useCallback(Q=>{const X=Q.split(`
|
|
59
|
-
`),se={};for(const Ne of X){const we=Ne.trim();if(!we||we.startsWith("#"))continue;const[ue,...K]=we.split("="),W=K.join("=").trim().replace(/^['"]|['"]$/g,"");ue&&ue.trim()&&(se[ue.trim()]=W)}return se},[]),B=o(()=>{const Q=D(Y),X=i.map(se=>{if(Q.hasOwnProperty(se.name)){const Ne=Q[se.name].startsWith("process.env.")?"":Q[se.name];return{...se,value:Ne,isModified:se.value!==Ne}}return se.isRequired?{...se,value:"",isModified:se.value!==""}:null}).filter(Boolean);Object.entries(Q).forEach(([se,Ne])=>{if(!X.some(ue=>ue.name===se)){const ue=Ne.startsWith("process.env.")?"":Ne,K=N.find(W=>W.name===se);X.push({name:se,value:ue,isNew:!0,isModified:!1,isDeleted:!1,isRequired:K?.required||!1,description:K?.description,example:K?.example,plugin:K?.plugin})}}),X.sort((se,Ne)=>se.isRequired&&!Ne.isRequired?-1:!se.isRequired&&Ne.isRequired?1:se.name.localeCompare(Ne.name)),s(X),F(!1)},"handleRawEditorSave"),z=o(()=>{a(O()),F(!0)},"openRawEditor"),G=o(()=>{navigator.clipboard.writeText(Y)},"copyEnvContent");V.useEffect(()=>{if(!(S||U)&&(t.id!==g.current||!g.current||i.length===0)){const Q=Nk(),X=t?.settings?.secrets||{},se=typeof X=="object"&&!Array.isArray(X)&&X!==null?Rk(X,Q):{},Ne=Object.entries(se).map(([W,J])=>{const pe=String(J),le=pe.startsWith("process.env.")?"":pe;return{name:W,value:le,isNew:!1,isModified:!1,isDeleted:!1,isRequired:!1,description:void 0,example:void 0,plugin:void 0}}),we=new Map(Ne.map(W=>[W.name,W])),ue=[...Ne];N.forEach(W=>{if(!we.has(W.name))ue.push({name:W.name,value:"",isNew:!0,isModified:!1,isDeleted:!1,isRequired:!0,description:W.description,example:W.example,plugin:W.plugin});else{const J=ue.findIndex(pe=>pe.name===W.name);J!==-1&&(ue[J]={...ue[J],isRequired:!0,description:W.description,example:W.example,plugin:W.plugin})}}),ue.sort((W,J)=>W.isRequired&&!J.isRequired?-1:!W.isRequired&&J.isRequired?1:W.name.localeCompare(J.name)),s(ue),I([]),g.current=t.id||"new-agent";const K=N.map(W=>W.name).sort().join(",");x.current=K}},[t.id,t.settings?.secrets,N,S,j,U]),V.useEffect(()=>{if(S)return;const Q=N.map(se=>se.name).sort().join(",");if(Q===x.current)return;x.current=Q;const X=new Set(N.map(se=>se.name));s(se=>{const Ne=se.map(ue=>{const K=X.has(ue.name),W=N.find(J=>J.name===ue.name);return ue.isRequired&&!K?(setTimeout(()=>{I(J=>J.includes(ue.name)?J:[...J,ue.name])},0),null):K&&W?{...ue,isRequired:!0,description:W.description,example:W.example,plugin:W.plugin}:{...ue,isRequired:K,description:K?ue.description:void 0,example:K?ue.example:void 0,plugin:K?ue.plugin:void 0}}).filter(Boolean),we=new Set(Ne.map(ue=>ue.name));return N.forEach(ue=>{we.has(ue.name)||Ne.push({name:ue.name,value:"",isNew:!0,isModified:!1,isDeleted:!1,isRequired:!0,description:ue.description,example:ue.example,plugin:ue.plugin})}),Ne.sort((ue,K)=>ue.isRequired&&!K.isRequired?-1:!ue.isRequired&&K.isRequired?1:ue.name.localeCompare(K.name)),Ne})},[N,S,j]),V.useEffect(()=>{const Q=new Set(N.map(X=>X.name));s(X=>X.filter(Ne=>{const we=Q.has(Ne.name)||!Ne.isRequired&&Ne.value&&Ne.value.trim()!=="";return!we&&Ne.isRequired&&I(ue=>ue.includes(Ne.name)?ue:[...ue,Ne.name]),we}))},[N]),V.useEffect(()=>{if(!e)return;const Q=setTimeout(()=>{const X=c(),se=new Set(i.map(K=>K.name)),Ne=t?.settings?.secrets||{};Object.keys(Ne).forEach(K=>{!se.has(K)&&!R.includes(K)&&(X[K]=null)});const we=Object.keys(X).sort().reduce((K,W)=>(K[W]=X[W],K),{}),ue=JSON.stringify(we);ue!==u.current&&(u.current=ue,e(X))},100);return()=>clearTimeout(Q)},[i,R,e,t?.settings?.secrets,c]);const te=V.useCallback(Q=>{const X=new FileReader;X.onload=se=>{const we=(se.target?.result).split(`
|
|
60
|
-
`),ue={};for(const K of we){const W=K.trim();if(!W||W.startsWith("#"))continue;const[J,...pe]=W.split("="),le=pe.join("=").trim().replace(/^['"]|['"]$/g,"");J&&(ue[J.trim()]=le)}s(K=>{const W=new Map(K.map(({name:pe,value:le,...oe})=>[pe,{value:le,...oe}]));for(const[pe,le]of Object.entries(ue)){const oe=le.startsWith("process.env.")?"":le,Ve=W.get(pe);if(Ve)W.set(pe,{...Ve,value:oe,isModified:!0});else{const _e=N.find(Le=>Le.name===pe);W.set(pe,{value:oe,isNew:!0,isModified:!1,isRequired:_e?.required||!1,description:_e?.description,example:_e?.example,plugin:_e?.plugin})}}const J=Array.from(W.entries()).map(([pe,le])=>({name:pe,...le}));return J.sort((pe,le)=>pe.isRequired&&!le.isRequired?-1:!pe.isRequired&&le.isRequired?1:pe.name.localeCompare(le.name)),J}),R.length>0&&I(K=>K.filter(W=>!Object.keys(ue).includes(W)))},X.readAsText(Q)},[N,R]);V.useEffect(()=>{const Q=d.current;if(!Q)return;const X=o(ue=>{ue.preventDefault(),ue.stopPropagation()},"preventDefaults"),se=o(()=>{E(!0)},"highlight"),Ne=o(()=>{E(!1)},"unhighlight"),we=o(ue=>{X(ue),Ne();const K=ue.dataTransfer?.files?.[0];K&&K.name.endsWith(".env")&&te(K)},"handleDrop");return["dragenter","dragover"].forEach(ue=>Q.addEventListener(ue,se)),["dragleave","drop"].forEach(ue=>Q.addEventListener(ue,Ne)),["dragenter","dragover","dragleave","drop"].forEach(ue=>Q.addEventListener(ue,X)),Q.addEventListener("drop",we),()=>{["dragenter","dragover","dragleave","drop"].forEach(ue=>Q.removeEventListener(ue,X)),["dragenter","dragover"].forEach(ue=>Q.removeEventListener(ue,se)),["dragleave","drop"].forEach(ue=>Q.removeEventListener(ue,Ne)),Q.removeEventListener("drop",we)}},[te]);const $=o(()=>{if(f&&v){const Q=i.some(se=>se.name===f),X=v.startsWith("process.env.")?"":v;if(Q)s(i.map(se=>se.name===f?{...se,value:X,isModified:!0}:se)),n(""),b("");else{R.includes(f)&&I(R.filter(ue=>ue!==f));const se=N.find(ue=>ue.name===f),Ne={name:f,value:X,isNew:!0,isRequired:se?.required||!1,description:se?.description,example:se?.example,plugin:se?.plugin},we=[...i,Ne];we.sort((ue,K)=>ue.isRequired&&!K.isRequired?-1:!ue.isRequired&&K.isRequired?1:ue.name.localeCompare(K.name)),s(we),n(""),b("")}}},"addEnv"),q=o(Q=>{l!==null&&l!==Q&&w(null),w(Q),y(i[Q].value),P(X=>new Set(X).add(Q))},"startEditing"),Ce=o(Q=>{const X=[...i],se=p.startsWith("process.env.")?"":p;X[Q].value!==se&&(X[Q].value=se,X[Q].isModified=!0),s(X),w(null),y(""),P(Ne=>{const we=new Set(Ne);return we.delete(Q),we})},"saveEdit"),fe=o(()=>{const Q=l;w(null),y(""),Q!==null&&P(X=>{const se=new Set(X);return se.delete(Q),se})},"cancelEdit"),ae=o(Q=>{const X=i[Q].name;I([...R,X]),s(i.filter((se,Ne)=>Ne!==Q)),w(null)},"removeEnv"),be=N.filter(Q=>{const X=i.find(we=>we.name===Q.name),se=X&&X.value&&X.value.trim()!=="",Ne=j[Q.name]&&j[Q.name].trim()!=="";return!se&&!Ne}),H=V.useCallback(Q=>j[Q]&&j[Q].trim()!=="",[j]),ee="scrollbar-visible";return k.jsxs("div",{className:"w-full h-full flex flex-col",children:[k.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("h2",{className:"text-lg font-semibold",children:"Variables"}),k.jsxs(ii,{variant:"secondary",className:"text-xs",children:[i.filter(Q=>Q.value&&Q.value.trim()!=="").length," Service Variables"]})]}),k.jsxs($e,{type:"button",variant:"outline",size:"sm",onClick:z,className:"flex items-center gap-2",children:[k.jsx(Kn,{className:"w-4 h-4"}),"Raw Editor"]})]}),k.jsx(Q6,{className:"flex-1",children:k.jsxs("div",{className:"p-4 space-y-4",children:[(S||U)&&k.jsxs("div",{className:"space-y-2",children:[k.jsx(Ya,{className:"h-4 w-48"}),k.jsx(Ya,{className:"h-4 w-64"})]}),!S&&!U&&be.length>0&&k.jsxs(lh,{children:[k.jsx(Xr,{className:"h-4 w-4"}),k.jsxs(uh,{children:[k.jsx("strong",{children:"Missing required secrets:"}),k.jsx("ul",{className:"mt-2 space-y-1",children:be.map(Q=>k.jsxs("li",{className:"text-sm",children:["• ",k.jsx("code",{className:"font-mono",children:Q.name}),Q.plugin&&k.jsxs("span",{className:"text-muted-foreground ml-1",children:["(required by ",Q.plugin,")"]})]},Q.name))})]})]}),!S&&!U&&N.some(Q=>H(Q.name)&&!i.find(X=>X.name===Q.name)?.value)&&k.jsxs(lh,{className:"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20",children:[k.jsx(bc,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),k.jsxs(uh,{className:"text-blue-800 dark:text-blue-200",children:[k.jsx("strong",{children:"Global environment variables detected:"}),k.jsx("p",{className:"text-sm mt-1",children:"Some required secrets are automatically using values from your global environment settings. To override any of these for this specific agent, simply enter a new value in the field."})]})]}),k.jsxs("div",{className:"space-y-2",children:[k.jsxs("div",{className:"hidden md:grid md:grid-cols-[minmax(200px,1fr)_2fr_auto] gap-2 items-end",children:[k.jsxs("div",{className:"space-y-1",children:[k.jsx("label",{htmlFor:"new-secret-name",className:"text-xs font-medium text-muted-foreground uppercase",children:"Name"}),k.jsx(hr,{id:"new-secret-name",placeholder:"VARIABLE_NAME",value:f,onChange:o(Q=>n(Q.target.value),"onChange"),className:"font-mono text-sm",onKeyDown:o(Q=>{Q.key==="Enter"&&(Q.preventDefault(),$())},"onKeyDown")})]}),k.jsxs("div",{className:"space-y-1",children:[k.jsx("label",{htmlFor:"new-secret-value",className:"text-xs font-medium text-muted-foreground uppercase",children:"Value"}),k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:`rounded border ${ee}`,children:k.jsx(hr,{id:"new-secret-value",type:h?"text":"password",placeholder:"Enter value...",value:v,onChange:o(Q=>b(Q.target.value),"onChange"),className:"font-mono text-sm pr-10 border-0 focus-visible:ring-0 w-auto min-w-full rounded",style:{minWidth:"100%"},onKeyDown:o(Q=>{Q.key==="Enter"&&(Q.preventDefault(),$())},"onKeyDown")})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:o(()=>m(!h),"onClick"),children:h?k.jsx(Wi,{className:"w-4 h-4"}):k.jsx(wi,{className:"w-4 h-4"})})]})]}),k.jsx($e,{type:"button",onClick:$,size:"sm",children:"Add"})]}),k.jsxs("div",{className:"md:hidden space-y-3",children:[k.jsxs("div",{className:"space-y-1",children:[k.jsx("label",{htmlFor:"new-secret-name-mobile",className:"text-xs font-medium text-muted-foreground uppercase",children:"Name"}),k.jsx(hr,{id:"new-secret-name-mobile",placeholder:"VARIABLE_NAME",value:f,onChange:o(Q=>n(Q.target.value),"onChange"),className:"font-mono text-sm w-full",onKeyDown:o(Q=>{Q.key==="Enter"&&(Q.preventDefault(),document.getElementById("new-secret-value-mobile")?.focus())},"onKeyDown")})]}),k.jsxs("div",{className:"space-y-1",children:[k.jsx("label",{htmlFor:"new-secret-value-mobile",className:"text-xs font-medium text-muted-foreground uppercase",children:"Value"}),k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:`rounded border ${ee}`,children:k.jsx(hr,{id:"new-secret-value-mobile",type:h?"text":"password",placeholder:"Enter value...",value:v,onChange:o(Q=>b(Q.target.value),"onChange"),className:"font-mono text-sm pr-10 border-0 focus-visible:ring-0 w-auto min-w-full rounded",style:{minWidth:"100%"},onKeyDown:o(Q=>{Q.key==="Enter"&&(Q.preventDefault(),$())},"onKeyDown")})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:o(()=>m(!h),"onClick"),children:h?k.jsx(Wi,{className:"w-4 h-4"}):k.jsx(wi,{className:"w-4 h-4"})})]})]}),k.jsx($e,{type:"button",onClick:$,size:"sm",className:"w-full",children:"Add Variable"})]})]}),i.length>0&&k.jsxs(Ps,{children:[k.jsxs("div",{className:"hidden md:block border rounded-lg overflow-hidden relative",children:[k.jsx("div",{className:"bg-muted/50 px-4 py-2 border-b",children:k.jsxs("div",{className:"grid grid-cols-[minmax(200px,1fr)_2fr_auto] gap-4 text-xs font-medium text-muted-foreground uppercase",children:[k.jsx("div",{children:"Name"}),k.jsx("div",{children:"Value"}),k.jsx("div",{className:"text-center",children:"Actions"})]})}),k.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:i.map((Q,X)=>k.jsxs("div",{className:`grid grid-cols-[minmax(200px,1fr)_2fr_auto] gap-4 items-center px-4 py-3 border-b last:border-b-0 hover:bg-muted/10 transition-colors ${Q.isRequired&&(!Q.value||Q.value.trim()==="")&&!H(Q.name)?"bg-red-500/5":""}`,children:[k.jsxs("div",{className:"pr-2",children:[k.jsxs("div",{className:"flex items-start gap-2 flex-wrap",children:[k.jsx("code",{className:"font-mono text-sm font-medium break-words cursor-default",children:Q.name}),Q.isRequired&&k.jsx(ii,{variant:"outline",className:"text-xs shrink-0",children:"Required"}),H(Q.name)&&k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsxs(ii,{variant:"secondary",className:"text-xs shrink-0 flex items-center gap-1",children:[k.jsx(bc,{className:"w-3 h-3"}),"Global"]})}),k.jsx(or,{children:k.jsx("p",{children:Q.value?"Overriding global value":"Value pulled from global environment. Add new value to override."})})]})]}),Q.description&&k.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:Q.description}),Q.plugin&&k.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["Required by: ",Q.plugin]})]}),k.jsx("div",{className:"min-w-0",children:l===X?k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("div",{className:"relative flex-1",children:k.jsx("div",{className:`rounded border ${ee}`,children:k.jsx(hr,{value:p,onChange:o(se=>y(se.target.value),"onChange"),className:"font-mono text-sm border-0 focus-visible:ring-0 w-auto min-w-full rounded",style:{minWidth:"100%"},type:T.has(X)?"text":"password",placeholder:H(Q.name)&&!Q.value?"Using global (enter to override)":Q.example||"Enter value...",autoFocus:!0,onKeyDown:o(se=>{se.key==="Enter"?(se.preventDefault(),Ce(X)):se.key==="Escape"&&fe()},"onKeyDown")})})}),k.jsxs("div",{className:"flex items-center gap-1",children:[k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>C(X),"onClick"),className:"h-8 w-8 p-0",children:T.has(X)?k.jsx(Wi,{className:"w-4 h-4"}):k.jsx(wi,{className:"w-4 h-4"})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>Ce(X),"onClick"),className:"h-8 w-8 p-0 text-green-600 hover:text-green-700",children:k.jsx(zs,{className:"w-4 h-4"})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:fe,className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:k.jsx(Vr,{className:"w-4 h-4"})})]})]}):k.jsxs("div",{className:"flex items-center gap-2 group",children:[k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx("div",{className:`flex-1 border rounded px-3 py-1 ${ee}`,children:T.has(X)?k.jsx("code",{className:"font-mono text-sm whitespace-nowrap block",children:Q.value||k.jsx("span",{className:"text-muted-foreground italic",children:H(Q.name)?"Using global value":Q.example?`e.g. ${Q.example}`:"Not set"})}):Q.value?k.jsx("code",{className:"font-mono text-sm text-muted-foreground block",children:"••••••••"}):k.jsx("span",{className:"text-muted-foreground italic text-sm block",children:H(Q.name)?"Using global value":"Not set"})})}),H(Q.name)&&k.jsx(or,{className:"max-w-xs",children:k.jsxs("div",{className:"space-y-1",children:[k.jsx("p",{className:"font-semibold",children:"Global Environment Variable"}),k.jsx("p",{className:"text-sm",children:Q.value?"You've entered a custom value for this agent. This overrides the global environment setting. Clear the field to use the global value.":"This secret is currently using the value from your global environment settings. The actual value is hidden for security. Enter a value here if you want to override it for this agent only."})]})})]}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>C(X),"onClick"),className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",children:T.has(X)?k.jsx(Wi,{className:"w-4 h-4"}):k.jsx(wi,{className:"w-4 h-4"})})]})}),k.jsxs("div",{className:"flex items-center justify-center gap-1",children:[k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>q(X),"onClick"),disabled:l!==null&&l!==X,className:"h-8 w-8 p-0",children:k.jsx(Yp,{className:"w-4 h-4"})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>ae(X),"onClick"),disabled:l!==null,className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:k.jsx(rs,{className:"w-4 h-4"})})]})]},`${Q.name}-${X}`))})]}),k.jsx("div",{className:"md:hidden space-y-3",children:i.map((Q,X)=>k.jsxs("div",{className:`border rounded-lg p-4 space-y-3 ${Q.isRequired&&(!Q.value||Q.value.trim()==="")?"border-red-500/50 bg-red-500/5":""}`,children:[k.jsx("div",{className:"space-y-1",children:k.jsxs("div",{className:"flex items-start justify-between gap-2",children:[k.jsxs("div",{className:"flex-1 min-w-0",children:[k.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[k.jsx("code",{className:"font-mono text-sm font-medium break-all",children:Q.name}),Q.isRequired&&k.jsx(ii,{variant:"outline",className:"text-xs",children:"Required"}),H(Q.name)&&k.jsxs(ii,{variant:"secondary",className:"text-xs flex items-center gap-1",children:[k.jsx(bc,{className:"w-3 h-3"}),"Global"]})]}),Q.description&&k.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:Q.description}),Q.plugin&&k.jsxs("div",{className:"text-xs text-muted-foreground",children:["Required by: ",Q.plugin]})]}),k.jsxs("div",{className:"flex items-center gap-1",children:[k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>q(X),"onClick"),disabled:l!==null&&l!==X,className:"h-8 w-8 p-0",children:k.jsx(Yp,{className:"w-4 h-4"})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>ae(X),"onClick"),disabled:l!==null,className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:k.jsx(rs,{className:"w-4 h-4"})})]})]})}),k.jsxs("div",{className:"space-y-1",children:[k.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Value"}),l===X?k.jsxs("div",{className:"space-y-2",children:[k.jsxs("div",{className:"relative",children:[k.jsx("div",{className:`rounded border ${ee}`,children:k.jsx(hr,{value:p,onChange:o(se=>y(se.target.value),"onChange"),className:"font-mono text-sm pr-10 border-0 focus-visible:ring-0 w-auto min-w-full rounded",style:{minWidth:"100%"},type:T.has(X)?"text":"password",placeholder:H(Q.name)&&!Q.value?"Using global (enter to override)":Q.example||"Enter value...",autoFocus:!0,onKeyDown:o(se=>{se.key==="Enter"?(se.preventDefault(),Ce(X)):se.key==="Escape"&&fe()},"onKeyDown")})}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>C(X),"onClick"),className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",children:T.has(X)?k.jsx(Wi,{className:"w-4 h-4"}):k.jsx(wi,{className:"w-4 h-4"})})]}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsxs($e,{type:"button",variant:"outline",size:"sm",onClick:o(()=>Ce(X),"onClick"),className:"flex-1",children:[k.jsx(zs,{className:"w-4 h-4 mr-2"}),"Save"]}),k.jsxs($e,{type:"button",variant:"ghost",size:"sm",onClick:fe,className:"flex-1",children:[k.jsx(Vr,{className:"w-4 h-4 mr-2"}),"Cancel"]})]})]}):k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx("div",{className:`flex-1 border rounded px-3 py-1 ${ee}`,children:T.has(X)?k.jsx("code",{className:"font-mono text-sm whitespace-nowrap block",children:Q.value||k.jsx("span",{className:"text-muted-foreground italic",children:H(Q.name)?"Using global value":Q.example?`e.g. ${Q.example}`:"Not set"})}):Q.value?k.jsx("code",{className:"font-mono text-sm text-muted-foreground block",children:"••••••••"}):k.jsx("span",{className:"text-muted-foreground italic text-sm block",children:H(Q.name)?"Using global value":"Not set"})})}),H(Q.name)&&k.jsx(or,{className:"max-w-xs",children:k.jsxs("div",{className:"space-y-1",children:[k.jsx("p",{className:"font-semibold",children:"Global Environment Variable"}),k.jsx("p",{className:"text-sm",children:Q.value?"You've entered a custom value for this agent. This overrides the global environment setting. Clear the field to use the global value.":"This secret is currently using the value from your global environment settings. The actual value is hidden for security. Enter a value here if you want to override it for this agent only."})]})})]}),k.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:o(()=>C(X),"onClick"),className:"h-8 w-8 p-0",children:T.has(X)?k.jsx(Wi,{className:"w-4 h-4"}):k.jsx(wi,{className:"w-4 h-4"})})]})]})]},`${Q.name}-${X}-mobile`))})]}),k.jsxs("div",{ref:d,className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors ${M?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50"}`,onClick:o(()=>document.getElementById("env-upload")?.click(),"onClick"),children:[k.jsx(e4,{className:"w-8 h-8 mx-auto mb-2 text-muted-foreground"}),k.jsxs("div",{className:"text-sm text-muted-foreground",children:["Drag & drop ",k.jsx("code",{className:"bg-muted px-1 rounded",children:".env"})," file or click to select"]}),k.jsx("input",{id:"env-upload",type:"file",accept:"*/*",className:"hidden",onChange:o(Q=>{const X=Q.target.files?.[0];X&&X.name.endsWith(".env")&&te(X)},"onChange")})]})]})}),k.jsx(pp,{open:ne,onOpenChange:F,children:k.jsxs($u,{className:"max-w-3xl h-[600px] flex flex-col",children:[k.jsxs(Ju,{children:[k.jsx(qu,{children:"Raw Editor"}),k.jsx(gp,{children:"Add, edit, or delete your project variables in .env format"})]}),k.jsx("div",{className:"flex-1 border rounded-lg overflow-hidden",children:k.jsx(To,{value:Y,onChange:o(Q=>a(Q.target.value),"onChange"),placeholder:`# Environment Variables
|
|
61
|
-
|
|
62
|
-
# Required Secrets
|
|
63
|
-
API_KEY=your_api_key_here
|
|
64
|
-
|
|
65
|
-
# Optional Variables
|
|
66
|
-
DEBUG=true
|
|
67
|
-
|
|
68
|
-
# Comments are supported`,className:"w-full h-full resize-none border-0 font-mono text-sm focus-visible:ring-0"})}),k.jsxs(mp,{children:[k.jsxs($e,{variant:"outline",size:"sm",onClick:G,children:[k.jsx(hn,{className:"w-4 h-4 mr-2"}),"Copy ENV"]}),k.jsx($e,{variant:"outline",size:"sm",onClick:o(()=>F(!1),"onClick"),children:"Cancel"}),k.jsx($e,{size:"sm",onClick:B,children:"Update Variables"})]})]})})]})});vp.displayName="SecretPanel";function cN(t){const[e,r]=V.useState(t),i=V.useCallback((l,w)=>{r(p=>{if(!l.includes("."))return{...p,[l]:w};const y=l.split("."),M=y[0],E=y.slice(1).join(".");if(!isNaN(Number(y[1]))){const T=y[0],P=Number(y[1]),j=p[T],L=Array.isArray(j)?[...j]:[];if(y.length===2)L[P]=w;else{const U=y.slice(2).join(".");L[P]=s(L[P],U,w)}return{...p,[T]:L}}if(l.startsWith("settings.secrets.")){const T=l.split(".")[2],P=p.settings||{},L={...P.secrets||{},[T]:w};return{...p,settings:{...P,secrets:L}}}return{...p,[M]:s(p[M],E,w)}})},[]),s=o((l,w,p)=>{if(!w.includes("."))return{...l,[w]:p};const[y,...M]=w.split("."),E=M.join(".");return{...l,[y]:s(l[y]||{},E,p)}},"updateNestedObject"),f=V.useCallback((l,w)=>{r(p=>{const y=l.split(".");if(y.length===1){const I=y[0],T=Array.isArray(p[I])?[...p[I]]:[];return{...p,[I]:[...T,w]}}const M=l,E=v(p,M),R=Array.isArray(E)?[...E]:[];return b(p,M,[...R,w])})},[]),n=V.useCallback((l,w)=>{r(p=>{const y=l.split(".");if(y.length===1){const I=y[0],T=Array.isArray(p[I])?[...p[I]]:[];return w<0||w>=T.length?p:{...p,[I]:[...T.slice(0,w),...T.slice(w+1)]}}const M=l,E=v(p,M);if(!Array.isArray(E)||w<0||w>=E.length)return p;const R=[...E.slice(0,w),...E.slice(w+1)];return b(p,M,R)})},[]),v=o((l,w)=>{const p=w.split(".");let y=l;for(const M of p){if(y==null)return;y=y[M]}return y},"getNestedValue"),b=o((l,w,p)=>{const y=w.split(".");if(y.length===1)return{...l,[y[0]]:p};const[M,...E]=y,R=l[M]||{};return{...l,[M]:b(R,E.join("."),p)}},"setNestedValue"),h=V.useCallback(()=>{r(t)},[t]),m=V.useCallback(l=>{r(w=>{const{secrets:p,avatar:y,...M}=l,E={...w.settings,...M};if(typeof y=="string"&&(E.avatar=y),p){const I={};Object.entries(p).forEach(([T,P])=>{P!==null&&(I[T]=P)}),E.secrets=I}return{...w,settings:E}})},[]);return{value:e,updateField:i,addArrayItem:f,removeArrayItem:n,reset:h,updateSettings:m}}o(cN,"usePartialUpdate");function X6(t){const e=V.useRef(JSON.parse(JSON.stringify(t))),{value:r,updateField:i,addArrayItem:s,removeArrayItem:f,reset:n,updateSettings:v}=cN(t),b=V.useCallback(F=>{Object.entries(F).forEach(([Y,a])=>{Y==="settings"&&a?v({...r.settings,...a}):Y==="style"&&a?i("style",{all:a.all||[],chat:a.chat||[],post:a.post||[]}):Array.isArray(a)?i(Y,[...a]):i(Y,a)})},[r.settings,i,v]),h=V.useCallback((F,Y)=>{i(`settings.${F}`,Y)},[i]),m=V.useCallback(F=>{v(F)},[v]),l=V.useCallback(F=>{i("system",F)},[i]),w=V.useCallback((F,Y)=>{const a=r.settings||{},g=a.secrets||{},d={...typeof g=="object"&&g!==null&&!Array.isArray(g)?g:{},[F]:Y};v({...a,secrets:d})},[r.settings,v]),p=V.useCallback(F=>{const Y=r.settings||{},a=Y.secrets||{},u={...typeof a=="object"&&a!==null&&!Array.isArray(a)?a:{}};delete u[F];const d={...Y,secrets:u};v(d)},[r.settings,v]),y=V.useCallback((F,Y)=>{s(F,Y)},[s]),M=V.useCallback((F,Y)=>{f(F,Y)},[f]),E=V.useCallback((F,Y,a)=>{i(`${F}.${Y}`,a)},[i]),R=V.useCallback((F,Y)=>{s(`style.${F}`,Y)},[s]),I=V.useCallback((F,Y)=>{f(`style.${F}`,Y)},[f]),T=V.useCallback((F,Y,a)=>{i(`style.${F}.${Y}`,a)},[i]),P=V.useCallback((F,Y)=>{i(`style.${F}`,Y)},[i]),j=V.useCallback(F=>{s("plugins",F)},[s]),L=V.useCallback(F=>{f("plugins",F)},[f]),U=V.useCallback(F=>{i("plugins",F)},[i]),Z=V.useCallback(F=>{h("avatar",F)},[h]),ne=V.useCallback(()=>{const F={},Y=r,a=e.current;["name","username","system"].forEach(x=>{Y[x]!==a[x]&&(F[x]=Y[x])}),Y.enabled!==a.enabled&&(F.enabled=Y.enabled),JSON.stringify(Y.bio)!==JSON.stringify(a.bio)&&(F.bio=Y.bio),JSON.stringify(Y.topics)!==JSON.stringify(a.topics)&&(F.topics=Y.topics),JSON.stringify(Y.adjectives)!==JSON.stringify(a.adjectives)&&(F.adjectives=Y.adjectives),JSON.stringify(Y.plugins)!==JSON.stringify(a.plugins)&&(F.plugins=Y.plugins),JSON.stringify(Y.style)!==JSON.stringify(a.style)&&(F.style=Y.style);const u=a.settings||{},d=Y.settings||{};if(JSON.stringify(d)!==JSON.stringify(u)){if(F.settings={},d.avatar!==u.avatar&&(F.settings.avatar=d.avatar),JSON.stringify(d.voice)!==JSON.stringify(u.voice)&&(F.settings.voice=d.voice),JSON.stringify(d.secrets)!==JSON.stringify(u.secrets)){const x=u.secrets||{},A=d.secrets||{},N=typeof x=="object"&&x!==null&&!Array.isArray(x)?x:{},S=typeof A=="object"&&A!==null&&!Array.isArray(A)?A:{},c={};let _=!1;Object.entries(S).forEach(([C,O])=>{N[C]!==O&&(c[C]=O,_=!0)}),Object.keys(N).forEach(C=>{S[C]===void 0&&(c[C]=null,_=!0)}),_&&(F.settings||(F.settings={}),F.settings.secrets=c)}Object.keys(F.settings).length===0&&delete F.settings}return F},[r]);return{agent:r,updateField:i,reset:n,updateSettings:v,setSettings:m,getChangedFields:ne,updateSetting:h,updateSystemPrompt:l,updateSecret:w,removeSecret:p,addContentItem:y,removeContentItem:M,updateContentItem:E,addStyleRule:R,removeStyleRule:I,updateStyleRule:T,setStyleArray:P,addPlugin:j,removePlugin:L,setPlugins:U,updateAvatar:Z,importAgent:b}}o(X6,"useAgentUpdate");const fN=xb("none")?.template||{name:"",username:"",system:"",bio:[],topics:[],adjectives:[],plugins:["@elizaos/plugin-sql","@elizaos/plugin-openai","@elizaos/plugin-bootstrap"],settings:{secrets:{}}};function W6(){const t=wr(),{toast:e}=Wt(),r=br(),[i]=V.useState({...fN}),s=V.useRef(null),[f,n]=V.useState({}),v=X6(i),b=o(m=>({...m,bio:m.bio??[],messageExamples:m.messageExamples??[],postExamples:m.postExamples??[],topics:m.topics??[],adjectives:m.adjectives??[],plugins:m.plugins??[],style:{all:m.style?.all??[],chat:m.style?.chat??[],post:m.style?.post??[]},settings:m.settings??{secrets:{}}}),"ensureRequiredFields"),h=o(async m=>{try{const l=b(m),w=f||s.current?.getSecrets()||{};w&&Object.keys(w).length>0&&(l.settings={...l.settings,secrets:w}),await Xt().agents.createAgent({agent:l}),r.invalidateQueries({queryKey:["characters"]}),e({title:"Success",description:"Agent created successfully!"}),r.invalidateQueries({queryKey:["agents"]}),t("/")}catch(l){e({title:"Error",description:l instanceof Error?l.message:"Failed to create agent",variant:"destructive"})}},"handleSubmit");return k.jsx("div",{className:"h-full w-full",children:k.jsx(V6,{characterValue:v.agent,setCharacterValue:v,title:"Create Agent",description:"Configure your AI agent's behavior and capabilities.",onSubmit:h,onReset:o(()=>{v.reset(),n({})},"onReset"),onDelete:o(()=>{t("/")},"onDelete"),onTemplateChange:o(()=>{n({})},"onTemplateChange"),isAgent:!0,secretPanelRef:s,customComponents:[{name:"Plugins",component:k.jsx(Y6,{characterValue:v.agent,setCharacterValue:v})},{name:"Secret",component:k.jsx(vp,{characterValue:v.agent,ref:s,onChange:o(m=>{n(m)},"onChange")})},{name:"Avatar",component:k.jsx(Z6,{characterValue:v.agent,setCharacterValue:v})}]})})}o(W6,"AgentCreator");function ms({open:t,onOpenChange:e,title:r,description:i,confirmText:s="Confirm",cancelText:f="Cancel",onConfirm:n,variant:v="destructive"}){const b=o(()=>{n(),e(!1)},"handleConfirm");return k.jsx(Th,{open:t,onOpenChange:e,children:k.jsxs(Eu,{children:[k.jsxs(Au,{children:[k.jsx(Nu,{children:r}),k.jsx(Cu,{children:i})]}),k.jsxs(ku,{children:[k.jsx(Iu,{children:f}),k.jsx(Ru,{onClick:b,className:v==="destructive"?"bg-destructive text-destructive-foreground":void 0,children:s})]})]})})}o(ms,"ConfirmationDialog");const dN=o(()=>typeof window>"u"?"eliza-api-key":`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey");function $6({open:t,onOpenChange:e,onApiKeySaved:r}){const[i,s]=V.useState(""),[f,n]=V.useState(!1),{toast:v}=Wt(),b=dN();V.useEffect(()=>{if(t)try{const m=localStorage.getItem(b);m&&s(m)}catch(m){console.error("Unable to access localStorage",m)}},[t,b]);const h=o(()=>{if(!i.trim()){v({title:"API Key Required",description:"Please enter a valid API key.",variant:"destructive"});return}try{localStorage.setItem(b,i)}catch{v({title:"Storage Error",description:"Unable to save the API key (browser storage blocked).",variant:"destructive"});return}r(),v({title:"API Key Saved",description:"The API key has been stored locally."}),e(!1)},"handleSave");return k.jsx(pp,{open:t,onOpenChange:e,children:k.jsxs($u,{className:"sm:max-w-[425px]",children:[k.jsxs(Ju,{children:[k.jsx(qu,{children:"API Key Required"}),k.jsx(gp,{children:"Please enter the API key required to connect to the Eliza server. This key will be stored locally in your browser."})]}),k.jsx("div",{className:"grid gap-4 py-4",children:k.jsxs("div",{className:"grid grid-cols-4 items-center gap-4",children:[k.jsx(js,{htmlFor:"api-key",className:"text-right",children:"API Key"}),k.jsxs("div",{className:"col-span-3 relative",children:[k.jsx(hr,{id:"api-key",type:f?"text":"password",value:i,onChange:o(m=>s(m.target.value),"onChange"),className:"pr-10"}),k.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 h-7 w-7 -translate-y-1/2 text-muted-foreground",onClick:o(()=>n(!f),"onClick"),"aria-label":f?"Hide API key":"Show API key",children:f?k.jsx(Wi,{className:"h-4 w-4"}):k.jsx(wi,{className:"h-4 w-4"})})]})]})}),k.jsx(mp,{children:k.jsx($e,{type:"button",onClick:h,children:"Save Key"})})]})})}o($6,"ApiKeyDialog");const J6=V.createContext(void 0),hN=o(({children:t})=>{const e=br(),[r,i]=V.useState(!1),s=V.useCallback(()=>{i(!0)},[]),f=V.useCallback(()=>{i(!1),Ge.info("API key saved via dialog, invalidating ping query."),e.invalidateQueries({queryKey:["ping"]})},[e]);return k.jsxs(J6.Provider,{value:{openApiKeyDialog:s},children:[t,k.jsx($6,{open:r,onOpenChange:i,onApiKeySaved:f})]})},"AuthProvider"),pN=o(()=>{const t=V.useContext(J6);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},"useAuth");var zn={},qr={},af={},Ym;function mN(){return Ym||(Ym=1,Object.defineProperty(af,"__esModule",{value:!0})),af}o(mN,"requireHelper");var Fn={},of={},fl={},Qm;function Zo(){if(Qm)return fl;Qm=1,Object.defineProperty(fl,"__esModule",{value:!0}),fl.typeGuard=t;function t(e,r){return r}return o(t,"typeGuard$1"),fl}o(Zo,"requireTypeGuard");var Km;function q6(){return Km||(Km=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CtxLike=void 0;var e=Zo();(function(r){function i(s){return(0,e.typeGuard)(s,!0)&&s instanceof Object&&typeof s.done=="function"&&typeof s.abort=="function"&&typeof s.zz__addHandler=="function"&&typeof s.zz__removeHandler=="function"}o(i,"match"),r.match=i})(t.CtxLike||(t.CtxLike={}))})(of)),of}o(q6,"requireCtxLike");var Xm;function gN(){return Xm||(Xm=1,(function(t){var e=Fn&&Fn.__createBinding||(Object.create?(function(i,s,f,n){n===void 0&&(n=f);var v=Object.getOwnPropertyDescriptor(s,f);(!v||("get"in v?!s.__esModule:v.writable||v.configurable))&&(v={enumerable:!0,get:o(function(){return s[f]},"get")}),Object.defineProperty(i,n,v)}):(function(i,s,f,n){n===void 0&&(n=f),i[n]=s[f]})),r=Fn&&Fn.__exportStar||function(i,s){for(var f in i)f!=="default"&&!Object.prototype.hasOwnProperty.call(s,f)&&e(s,i,f)};Object.defineProperty(t,"__esModule",{value:!0}),r(q6(),t)})(Fn)),Fn}o(gN,"requireInterfaces");var ma={},Wm;function vN(){if(Wm)return ma;Wm=1,Object.defineProperty(ma,"__esModule",{value:!0}),ma.__hack=void 0;/*! *****************************************************************************
|
|
69
|
-
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
70
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
71
|
-
this file except in compliance with the License. You may obtain a copy of the
|
|
72
|
-
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
73
|
-
|
|
74
|
-
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
75
|
-
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
76
|
-
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
77
|
-
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
78
|
-
|
|
79
|
-
See the Apache Version 2.0 License for specific language governing permissions
|
|
80
|
-
and limitations under the License.
|
|
81
|
-
***************************************************************************** */return ma.__hack="NOT TYPE ONLY",ma}o(vN,"requireLib_dom");var lf={},$m;function e8(){return $m||($m=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EventTargetLike=void 0;var e=Zo();(function(r){var i;(function(b){function h(m){return(0,e.typeGuard)(m,!0)&&m instanceof Object&&typeof m.subscribe=="function"}o(h,"match"),b.match=h})(i=r.RxJSSubject||(r.RxJSSubject={}));var s;(function(b){function h(m){return(0,e.typeGuard)(m,!0)&&m instanceof Object&&typeof m.addListener=="function"&&typeof m.removeListener=="function"}o(h,"match"),b.match=h})(s=r.NodeStyleEventEmitter||(r.NodeStyleEventEmitter={}));var f;(function(b){function h(m){return(0,e.typeGuard)(m,!0)&&m instanceof Object&&typeof m.on=="function"&&typeof m.off=="function"}o(h,"match"),b.match=h})(f=r.JQueryStyleEventEmitter||(r.JQueryStyleEventEmitter={}));var n;(function(b){function h(m){return(0,e.typeGuard)(m,!0)&&m instanceof Object&&typeof m.addEventListener=="function"&&typeof m.removeEventListener=="function"}o(h,"match"),b.match=h})(n=r.HasEventTargetAddRemove||(r.HasEventTargetAddRemove={}));function v(b){try{return n.match(b)||s.match(b)||f.match(b)||i.match(b)}catch{return!1}}o(v,"canBe"),r.canBe=v})(t.EventTargetLike||(t.EventTargetLike={}))})(lf)),lf}o(e8,"requireEventTargetLike");var zi={},Jm;function t8(){if(Jm)return zi;Jm=1;var t=zi&&zi.__extends||(function(){var i=o(function(s,f){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,v){n.__proto__=v}||function(n,v){for(var b in v)Object.prototype.hasOwnProperty.call(v,b)&&(n[b]=v[b])},i(s,f)},"extendStatics");return function(s,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");i(s,f);function n(){this.constructor=s}o(n,"__"),s.prototype=f===null?Object.create(f):(n.prototype=f.prototype,new n)}})();Object.defineProperty(zi,"__esModule",{value:!0}),zi.DetachedEvtError=zi.TimeoutEvtError=void 0;var e=(function(i){t(s,i);function s(f){var n=this.constructor,v=i.call(this,"Evt timeout after ".concat(f,"ms"))||this;return v.timeout=f,Object.setPrototypeOf(v,n.prototype),v}return o(s,"TimeoutEvtError"),s})(Error);zi.TimeoutEvtError=e;var r=(function(i){t(s,i);function s(){var f=this.constructor,n=i.call(this,"Evt handler detached")||this;return Object.setPrototypeOf(n,f.prototype),n}return o(s,"DetachedEvtError"),s})(Error);return zi.DetachedEvtError=r,zi}o(t8,"requireEvtError");var uf={},qm;function bN(){return qm||(qm=1,Object.defineProperty(uf,"__esModule",{value:!0})),uf}o(bN,"requireOperator");var eg;function yN(){return eg||(eg=1,(function(t){var e=qr&&qr.__createBinding||(Object.create?(function(f,n,v,b){b===void 0&&(b=v);var h=Object.getOwnPropertyDescriptor(n,v);(!h||("get"in h?!n.__esModule:h.writable||h.configurable))&&(h={enumerable:!0,get:o(function(){return n[v]},"get")}),Object.defineProperty(f,b,h)}):(function(f,n,v,b){b===void 0&&(b=v),f[b]=n[v]})),r=qr&&qr.__setModuleDefault||(Object.create?(function(f,n){Object.defineProperty(f,"default",{enumerable:!0,value:n})}):function(f,n){f.default=n}),i=qr&&qr.__exportStar||function(f,n){for(var v in f)v!=="default"&&!Object.prototype.hasOwnProperty.call(n,v)&&e(n,f,v)},s=qr&&qr.__importStar||function(f){if(f&&f.__esModule)return f;var n={};if(f!=null)for(var v in f)v!=="default"&&Object.prototype.hasOwnProperty.call(f,v)&&e(n,f,v);return r(n,f),n};Object.defineProperty(t,"__esModule",{value:!0}),t.dom=void 0,i(mN(),t),i(gN(),t),t.dom=s(vN()),i(e8(),t),i(t8(),t),i(bN(),t)})(qr)),qr}o(yN,"requireTypes");var cf={},Fi={},ff={},tg;function r8(){return tg||(tg=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertOperatorToStatelessFλ=void 0;function e(s){var f=s[1];return function(n,v){var b=s[0](n,f,v);return b!==null&&v(function(){return f=b[0]}),b}}o(e,"encapsulateOpState");function r(s){return function(f,n){var v=s(f,n);return v instanceof Object&&!("input"in v)&&v.length===1?v:v?[f]:null}}o(r,"statelessOpToStatelessFλ");function i(s){return typeof s!="function"?e(s):r(s)}o(i,"convertOperatorToStatelessFλ"),t.convertOperatorToStatelessFλ=i})(ff)),ff}o(r8,"requireConvertOperatorToStatelessFLambda");var ga={},rg;function ec(){if(rg)return ga;rg=1,Object.defineProperty(ga,"__esModule",{value:!0}),ga.id=void 0;var t=o(function(e){return e},"id$1");return ga.id=t,ga}o(ec,"requireId");var ig;function tc(){if(ig)return Fi;ig=1;var t=Fi&&Fi.__read||function(n,v){var b=typeof Symbol=="function"&&n[Symbol.iterator];if(!b)return n;var h=b.call(n),m,l=[],w;try{for(;(v===void 0||v-- >0)&&!(m=h.next()).done;)l.push(m.value)}catch(p){w={error:p}}finally{try{m&&!m.done&&(b=h.return)&&b.call(h)}finally{if(w)throw w.error}}return l},e=Fi&&Fi.__spreadArray||function(n,v,b){if(b||arguments.length===2)for(var h=0,m=v.length,l;h<m;h++)(l||!(h in v))&&(l||(l=Array.prototype.slice.call(v,0,h)),l[h]=v[h]);return n.concat(l||Array.prototype.slice.call(v))};Object.defineProperty(Fi,"__esModule",{value:!0}),Fi.compose=void 0;var r=r8(),i=ec();function s(n,v){var b=(0,r.convertOperatorToStatelessFλ)(n),h=(0,r.convertOperatorToStatelessFλ)(v);return(0,i.id)(function(m,l){var w=b(m,l);if(!w)return null;var p=t(w,1),y=p[0],M=h(y,l);return M&&[M[0]]})}o(s,"f_o_g");function f(){for(var n=[],v=0;v<arguments.length;v++)n[v]=arguments[v];if(n.length===1){var b=t(n,1),h=b[0];return(0,r.convertOperatorToStatelessFλ)(h)}var m=t(n),l=m[0],w=m[1],p=m.slice(2),y=s(l,w);return p.length===0?y:f.apply(void 0,e([y],t(p),!1))}return o(f,"compose$1"),Fi.compose=f,Fi}o(tc,"requireCompose");var ng;function wN(){return ng||(ng=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.compose=void 0;var e=tc();Object.defineProperty(t,"compose",{enumerable:!0,get:o(function(){return e.compose},"get")})})(cf)),cf}o(wN,"requireUtil");var Un={},Hn={},Vn={},sg;function bp(){if(sg)return Vn;sg=1,Vn.__esModule=!0,Vn.Polyfill=Vn.LightMapImpl=void 0;var t=(function(){function e(){this.record=[]}return o(e,"LightMapImpl"),e.prototype.has=function(r){return this.record.map(function(i){var s=i[0];return s}).indexOf(r)>=0},e.prototype.get=function(r){var i=this.record.filter(function(s){var f=s[0];return f===r})[0];if(i!==void 0)return i[1]},e.prototype.set=function(r,i){var s=this.record.filter(function(f){var n=f[0];return n===r})[0];return s===void 0?this.record.push([r,i]):s[1]=i,this},e.prototype.delete=function(r){var i=this.record.map(function(s){var f=s[0];return f}).indexOf(r);return i<0?!1:(this.record.splice(i,1),!0)},e.prototype.keys=function(){return this.record.map(function(r){var i=r[0];return i})},e})();return Vn.LightMapImpl=t,Vn.Polyfill=typeof Map<"u"?Map:t,Vn}o(bp,"require_Map");var ag;function xN(){if(ag)return Hn;ag=1,Hn.__esModule=!0,Hn.Polyfill=Hn.LightSetImpl=void 0;var t=bp(),e=(function(){function r(i){if(this.map=new t.Polyfill,i!==void 0)for(var s=0,f=i;s<f.length;s++){var n=f[s];this.add(n)}}return o(r,"LightSetImpl"),r.prototype.has=function(i){return this.map.has(i)},r.prototype.add=function(i){return this.map.set(i,!0),this},r.prototype.values=function(){return this.map.keys()},r.prototype.delete=function(i){return this.map.delete(i)},r})();return Hn.LightSetImpl=e,Hn.Polyfill=typeof Set<"u"?Set:e,Hn}o(xN,"require_Set");var va={},og;function rc(){if(og)return va;og=1,va.__esModule=!0,va.Polyfill=void 0;var t=bp();return va.Polyfill=typeof WeakMap<"u"?WeakMap:t.Polyfill,va}o(rc,"require_WeakMap");var ei={},Ms={},lg;function ea(){if(lg)return Ms;lg=1;var t=Ms&&Ms.__assign||function(){return t=Object.assign||function(r){for(var i,s=1,f=arguments.length;s<f;s++){i=arguments[s];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])}return r},t.apply(this,arguments)};Object.defineProperty(Ms,"__esModule",{value:!0}),Ms.overwriteReadonlyProp=e;function e(r,i,s){try{r[i]=s}catch{}if(r[i]===s)return s;var f=void 0,n=Object.getOwnPropertyDescriptor(r,i)||{enumerable:!0,configurable:!0};if(n.get)throw new Error("Probably a wrong idea to overwrite ".concat(String(i)," getter"));try{Object.defineProperty(r,i,t(t({},n),{value:s}))}catch(v){f=v}if(r[i]!==s)throw f||new Error("Can't assign");return s}return o(e,"overwriteReadonlyProp$1"),Ms}o(ea,"requireOverwriteReadonlyProp");var ug;function yp(){if(ug)return ei;ug=1;var t=ei&&ei.__extends||(function(){var b=o(function(h,m){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,w){l.__proto__=w}||function(l,w){for(var p in w)Object.prototype.hasOwnProperty.call(w,p)&&(l[p]=w[p])},b(h,m)},"extendStatics");return function(h,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");b(h,m);function l(){this.constructor=h}o(l,"__"),h.prototype=m===null?Object.create(m):(l.prototype=m.prototype,new l)}})(),e=ei&&ei.__read||function(b,h){var m=typeof Symbol=="function"&&b[Symbol.iterator];if(!m)return b;var l=m.call(b),w,p=[],y;try{for(;(h===void 0||h-- >0)&&!(w=l.next()).done;)p.push(w.value)}catch(M){y={error:M}}finally{try{w&&!w.done&&(m=l.return)&&m.call(l)}finally{if(y)throw y.error}}return p};Object.defineProperty(ei,"__esModule",{value:!0}),ei.AssertionError=void 0,ei.assert=f,ei.is=v;var r=ea(),i=(function(b){t(h,b);function h(m){var l=this.constructor,w=b.call(this,"Wrong assertion encountered"+(m?': "'.concat(m,'"'):""))||this;if(w.originalMessage=m,Object.setPrototypeOf(w,l.prototype),!w.stack)return w;try{(0,r.overwriteReadonlyProp)(w,"stack",w.stack.split(`
|
|
82
|
-
`).filter(function(){for(var p=[],y=0;y<arguments.length;y++)p[y]=arguments[y];var M=e(p,2),E=M[1];return E!==1&&E!==2}).join(`
|
|
83
|
-
`))}catch{}return w}return o(h,"AssertionError"),h})(Error);ei.AssertionError=i;var s=void 0;function f(b,h){if(arguments.length===0&&(b=!0),s!==void 0){s=void 0;return}if(!b)throw new i(typeof h=="function"?h():h)}o(f,"assert$1");var n="Wrong usage of the `is` function refer to https://docs.tsafe.dev/is";function v(b){var h={};if(s!==void 0)throw s=void 0,new Error(n);return s=h,Promise.resolve().then(function(){if(s===h)throw new Error(n)}),null}return o(v,"is"),ei}o(yp,"requireAssert");var ba={},ya={},cg;function mi(){return cg||(cg=1,Object.defineProperty(ya,"__esModule",{value:!0}),ya.importProxy=void 0,ya.importProxy={}),ya}o(mi,"requireImportProxy");var fg;function wp(){if(fg)return ba;fg=1,Object.defineProperty(ba,"__esModule",{value:!0}),ba.LazyEvt=void 0;var t=ea(),e=mi(),r=(function(){function i(){this.initialPostCount=0}return o(i,"LazyEvt"),Object.defineProperty(i.prototype,"evt",{get:o(function(){return this.__evt===void 0&&(this.__evt=new e.importProxy.Evt,(0,t.overwriteReadonlyProp)(this.__evt,"postCount",this.initialPostCount)),this.__evt},"get"),enumerable:!1,configurable:!0}),i.prototype.__post=function(s,f){return this.__evt===void 0?++this.initialPostCount:this.__evt[f?"postAndWait":"post"](s)},i.prototype.post=function(s){return this.__post(s,!1)},i.prototype.postAndWait=function(s){return this.__post(s,!0)},i})();return ba.LazyEvt=r,ba}o(wp,"requireLazyEvt");var dg;function _N(){return dg||(dg=1,(function(t){var e=Un&&Un.__assign||function(){return e=Object.assign||function(m){for(var l,w=1,p=arguments.length;w<p;w++){l=arguments[w];for(var y in l)Object.prototype.hasOwnProperty.call(l,y)&&(m[y]=l[y])}return m},e.apply(this,arguments)},r=Un&&Un.__values||function(m){var l=typeof Symbol=="function"&&Symbol.iterator,w=l&&m[l],p=0;if(w)return w.call(m);if(m&&typeof m.length=="number")return{next:o(function(){return m&&p>=m.length&&(m=void 0),{value:m&&m[p++],done:!m}},"next")};throw new TypeError(l?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Ctx=void 0;var i=xN(),s=rc(),f=yp(),n=wp(),v=mi(),b=ea(),h=(function(){function m(){this.lazyEvtAttach=new n.LazyEvt,this.lazyEvtDetach=new n.LazyEvt,this.lazyEvtDoneOrAborted=new n.LazyEvt,this.handlers=new i.Polyfill,this.evtByHandler=new s.Polyfill}return o(m,"CtxImpl"),Object.defineProperty(m.prototype,"evtDoneOrAborted",{get:o(function(){return this.lazyEvtDoneOrAborted.evt},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"evtAttach",{get:o(function(){return this.lazyEvtAttach.evt},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"evtDetach",{get:o(function(){return this.lazyEvtDetach.evt},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(m.prototype,"completionStatus",{get:o(function(){return this.__completionStatus},"get"),enumerable:!1,configurable:!0}),m.prototype.onDoneOrAborted=function(l){this.__completionStatus=l,this.lazyEvtDoneOrAborted.post(l)},m.prototype.waitFor=function(l){var w=this;return this.evtDoneOrAborted.waitFor(l).then(function(p){if(p.type==="ABORTED")throw p.error;return p.result},function(p){throw w.abort(p),p})},m.prototype.abort=function(l){return this.__done(l)},m.prototype.done=function(l){return this.__done(void 0,l)},m.prototype.__done=function(l,w){var p,y,M=[];try{for(var E=r(this.handlers.values()),R=E.next();!R.done;R=E.next()){var I=R.value,T=this.evtByHandler.get(I),P=I.detach();P&&M.push({handler:I,evt:T})}}catch(j){p={error:j}}finally{try{R&&!R.done&&(y=E.return)&&y.call(E)}finally{if(p)throw p.error}}return this.onDoneOrAborted(e(e({},l?{type:"ABORTED",error:l}:{type:"DONE",result:w}),{handlers:M})),M},m.prototype.getHandlers=function(){var l=this;return Array.from(this.handlers.values()).map(function(w){return{handler:w,evt:l.evtByHandler.get(w)}})},m.prototype.zz__addHandler=function(l,w){if((0,f.assert)(l.ctx===this),(0,f.assert)((0,f.is)(l)),this.completionStatus!==void 0){l.detach();return}this.handlers.add(l),this.evtByHandler.set(l,w),this.lazyEvtAttach.post({handler:l,evt:w})},m.prototype.zz__removeHandler=function(l){(0,f.assert)(l.ctx===this),(0,f.assert)((0,f.is)(l)),this.lazyEvtDetach.post({handler:l,evt:this.evtByHandler.get(l)}),this.handlers.delete(l)},m})();t.Ctx=h;try{(0,b.overwriteReadonlyProp)(t.Ctx,"name","Ctx")}catch{}v.importProxy.Ctx=t.Ctx})(Un)),Un}o(_N,"requireCtx");var ur={},df={},hg;function MN(){return hg||(hg=1,df.__esModule=!0,Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:o(function(t){if(this==null)throw new TypeError('"this" is null or not defined');var e=Object(this),r=e.length>>>0;if(typeof t!="function")throw new TypeError("predicate must be a function");for(var i=arguments[1],s=0;s<r;){var f=e[s];if(t.call(i,f,s,e))return f;s++}},"value"),configurable:!0,writable:!0})),df}o(MN,"requireArray_prototype_find");var wa={},pg;function SN(){if(pg)return wa;pg=1,Object.defineProperty(wa,"__esModule",{value:!0}),wa.create=void 0;var t=mi();function e(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return r.length===0?new t.importProxy.Evt:new t.importProxy.StatefulEvt(r[0])}return o(e,"create"),wa.create=e,wa}o(SN,"requireEvt_create");var xa={},mg;function EN(){if(mg)return xa;mg=1,Object.defineProperty(xa,"__esModule",{value:!0}),xa.getCtxFactory=void 0;var t=rc(),e=mi();function r(){var i=new t.Polyfill;function s(f){var n=i.get(f);return n===void 0&&(n=new e.importProxy.Ctx,i.set(f,n)),n}return o(s,"getCtx"),s}return o(r,"getCtxFactory"),xa.getCtxFactory=r,xa}o(EN,"requireEvt_getCtx");var _a={},gg;function AN(){if(gg)return _a;gg=1,Object.defineProperty(_a,"__esModule",{value:!0}),_a.factorize=void 0;function t(e){return e}return o(t,"factorize"),_a.factorize=t,_a}o(AN,"requireEvt_factorize");var Zn={},vg;function i8(){if(vg)return Zn;vg=1,Object.defineProperty(Zn,"__esModule",{value:!0}),Zn.merge=Zn.mergeImpl=void 0;var t=mi();function e(i,s){var f=new t.importProxy.Evt,n=o(function(v){return f.post(v)},"callback");return s.forEach(function(v){i===void 0?v.attach(n):v.attach(i,n)}),f}o(e,"mergeImpl"),Zn.mergeImpl=e;function r(i,s){return"length"in i?e(void 0,i):e(i,s)}return o(r,"merge"),Zn.merge=r,Zn}o(i8,"requireEvt_merge");var Dr={},bg;function kN(){if(bg)return Dr;bg=1;var t=Dr&&Dr.__createBinding||(Object.create?(function(y,M,E,R){R===void 0&&(R=E);var I=Object.getOwnPropertyDescriptor(M,E);(!I||("get"in I?!M.__esModule:I.writable||I.configurable))&&(I={enumerable:!0,get:o(function(){return M[E]},"get")}),Object.defineProperty(y,R,I)}):(function(y,M,E,R){R===void 0&&(R=E),y[R]=M[E]})),e=Dr&&Dr.__setModuleDefault||(Object.create?(function(y,M){Object.defineProperty(y,"default",{enumerable:!0,value:M})}):function(y,M){y.default=M}),r=Dr&&Dr.__importStar||function(y){if(y&&y.__esModule)return y;var M={};if(y!=null)for(var E in y)E!=="default"&&Object.prototype.hasOwnProperty.call(y,E)&&t(M,y,E);return e(M,y),M},i=Dr&&Dr.__read||function(y,M){var E=typeof Symbol=="function"&&y[Symbol.iterator];if(!E)return y;var R=E.call(y),I,T=[],P;try{for(;(M===void 0||M-- >0)&&!(I=R.next()).done;)T.push(I.value)}catch(j){P={error:j}}finally{try{I&&!I.done&&(E=R.return)&&E.call(R)}finally{if(P)throw P.error}}return T};Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.from=void 0;var s=ec(),f=yp(),n=Zo(),v=i8(),b=mi(),h=r(e8()),m=h.EventTargetLike;function l(y,M,E,R){var I=o(function(ne){return m.canBe(ne)},"matchEventTargetLike");if(!I(M)){if("then"in M){var T=new b.importProxy.Evt,P=(function(){var ne=o(function(){return y?.evtDoneOrAborted.postCount},"getEvtDonePostCount"),F=ne();return function(){return F!==ne()}})();return M.then(function(ne){P()||T.post(ne)}),T}return(0,v.mergeImpl)(y,Array.from(M).map(function(ne){return l(y,ne,E,R)}))}var j;if(m.HasEventTargetAddRemove.match(M))j={on:o(function(ne,F,Y){return M.addEventListener(F,ne,Y)},"on"),off:o(function(ne,F,Y){return M.removeEventListener(F,ne,Y)},"off")};else if(m.NodeStyleEventEmitter.match(M))j={on:o(function(ne,F){return M.addListener(F,ne)},"on"),off:o(function(ne,F){return M.removeListener(F,ne)},"off")};else if(m.JQueryStyleEventEmitter.match(M))j={on:o(function(ne,F){return M.on(F,ne)},"on"),off:o(function(ne,F){return M.off(F,ne)},"off")};else if(m.RxJSSubject.match(M)){var L;j={on:o(function(ne){return L=M.subscribe(function(F){return ne(F)})},"on"),off:o(function(){return L.unsubscribe()},"off")}}else(0,s.id)(M),(0,f.assert)(!1);var U=new b.importProxy.Evt,Z=o(function(ne){return U.post(ne)},"listener");return y?.evtDoneOrAborted.attachOnce(function(){return j.off(Z,E,R)}),j.on(Z,E,R),U}o(l,"fromImplForTargetEventLike");function w(y,M,E){var R=b.importProxy.Evt.create(),I=o(function(P){var j=i(P,1),L=j[0];return R.post(L)},"listener"),T=new M(I);return T.observe(E),y?.evtDoneOrAborted.attachOnce(function(){return T.disconnect()}),R}o(w,"fromImplForObserver");function p(y,M,E,R){return"evtDoneOrAborted"in y?((0,f.assert)((0,n.typeGuard)(M,!0)&&(0,n.typeGuard)(E,!0)&&(0,n.typeGuard)(R,!0)),typeof M=="function"?((0,f.assert)((0,n.typeGuard)(E,!0)&&(0,n.typeGuard)(R,!0)),w(y,M,E)):((0,f.assert)((0,n.typeGuard)(E,!0)),l(y,M,E,R))):((0,f.assert)((0,n.typeGuard)(y,!0)&&(0,n.typeGuard)(M,!0)&&(0,n.typeGuard)(E,!0)),typeof y=="function"?((0,f.assert)((0,n.typeGuard)(M,!0)&&(0,n.typeGuard)(E,!0)),w(void 0,y,M)):((0,f.assert)((0,n.typeGuard)(M,!0)),l(void 0,y,M,E)))}return o(p,"from"),Dr.from=p,Dr}o(kN,"requireEvt_from");var Ma={},yg;function NN(){if(yg)return Ma;yg=1,Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.asPostable=void 0;function t(e){return e}return o(t,"asPostable"),Ma.asPostable=t,Ma}o(NN,"requireEvt_asPostable");var Ui={},wg;function CN(){if(wg)return Ui;wg=1;var t=Ui&&Ui.__awaiter||function(s,f,n,v){function b(h){return h instanceof n?h:new n(function(m){m(h)})}return o(b,"adopt"),new(n||(n=Promise))(function(h,m){function l(y){try{p(v.next(y))}catch(M){m(M)}}o(l,"fulfilled");function w(y){try{p(v.throw(y))}catch(M){m(M)}}o(w,"rejected");function p(y){y.done?h(y.value):b(y.value).then(l,w)}o(p,"step"),p((v=v.apply(s,f||[])).next())})},e=Ui&&Ui.__generator||function(s,f){var n={label:0,sent:o(function(){if(h[0]&1)throw h[1];return h[1]},"sent"),trys:[],ops:[]},v,b,h,m;return m={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function l(p){return function(y){return w([p,y])}}function w(p){if(v)throw new TypeError("Generator is already executing.");for(;n;)try{if(v=1,b&&(h=p[0]&2?b.return:p[0]?b.throw||((h=b.return)&&h.call(b),0):b.next)&&!(h=h.call(b,p[1])).done)return h;switch(b=0,h&&(p=[p[0]&2,h.value]),p[0]){case 0:case 1:h=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,b=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(h=n.trys,!(h=h.length>0&&h[h.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!h||p[1]>h[0]&&p[1]<h[3])){n.label=p[1];break}if(p[0]===6&&n.label<h[1]){n.label=h[1],h=p;break}if(h&&n.label<h[2]){n.label=h[2],n.ops.push(p);break}h[2]&&n.ops.pop(),n.trys.pop();continue}p=f.call(s,n)}catch(y){p=[6,y],b=0}finally{v=h=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}};Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.asyncPipe=void 0;var r=mi();function i(s,f){var n=this,v="state"in s?r.importProxy.Evt.create(void 0):r.importProxy.Evt.create(),b=0;return s.attach(function(h){return t(n,void 0,void 0,function(){var m,l,w;return e(this,function(p){switch(p.label){case 0:return b++,m=b,l=f(h),l!==null&&"then"in l?[4,l]:[3,2];case 1:return w=p.sent(),"state"in s&&m!==b?[2]:[3,3];case 2:w=l,p.label=3;case 3:return w?(v.post(w[0]),[2]):[2]}})})}),v}return o(i,"asyncPipe"),Ui.asyncPipe=i,Ui}o(CN,"requireEvt_asyncPipe");var Sa={},xg;function RN(){if(xg)return Sa;xg=1,Object.defineProperty(Sa,"__esModule",{value:!0}),Sa.asNonPostable=void 0;function t(e){return e}return o(t,"asNonPostable"),Sa.asNonPostable=t,Sa}o(RN,"requireEvt_asNonPostable");var Br={},_g;function IN(){if(_g)return Br;_g=1;var t=Br&&Br.__assign||function(){return t=Object.assign||function(m){for(var l,w=1,p=arguments.length;w<p;w++){l=arguments[w];for(var y in l)Object.prototype.hasOwnProperty.call(l,y)&&(m[y]=l[y])}return m},t.apply(this,arguments)},e=Br&&Br.__read||function(m,l){var w=typeof Symbol=="function"&&m[Symbol.iterator];if(!w)return m;var p=w.call(m),y,M=[],E;try{for(;(l===void 0||l-- >0)&&!(y=p.next()).done;)M.push(y.value)}catch(R){E={error:R}}finally{try{y&&!y.done&&(w=p.return)&&w.call(p)}finally{if(E)throw E.error}}return M},r=Br&&Br.__spreadArray||function(m,l,w){if(w||arguments.length===2)for(var p=0,y=l.length,M;p<y;p++)(M||!(p in l))&&(M||(M=Array.prototype.slice.call(l,0,p)),M[p]=l[p]);return m.concat(M||Array.prototype.slice.call(l))};Object.defineProperty(Br,"__esModule",{value:!0}),Br.parsePropsFromArgs=Br.matchAll=void 0;var i=ec(),s=tc(),f=Zo();function n(){return!0}o(n,"matchAll"),Br.matchAll=n;var v=o(function(m){return m!==void 0&&(0,f.typeGuard)(m,!0)&&(typeof m=="function"||typeof m[0]=="function")},"canBeOperator"),b={op:n,ctx:void 0,timeout:void 0,callback:void 0};function h(m,l){switch(l){case"pipe":{var w=o(function(a){return a.length===0?{}:{op:a.length===1?a[0]:s.compose.apply(void 0,r([],e(a),!1))}},"getOpWrap");if(v(m[0]))return(0,i.id)(t(t({},b),w(m)));var p=e(m),y=p[0],M=p.slice(1);return(0,i.id)(t(t(t({},b),y!==void 0?{ctx:y}:{}),w(M)))}case"waitFor":return h(r(r([],e(m.filter(function(a,g){return!(g===m.length-1&&a===void 0)})),!1),[b.callback],!1),"attach*");case"attach*":{var E=m.length;switch(E){case 4:{var R=e(m,4),I=R[0],T=R[1],P=R[2],j=R[3];return(0,i.id)(t(t({},b),{op:I,ctx:T,timeout:P,callback:j}))}case 3:{var L=e(m,3),I=L[0],T=L[1],P=L[2];if(typeof T=="number"){var U=T,Z=P;return v(I)?(0,i.id)(t(t({},b),{timeout:U,callback:Z,op:I})):(0,i.id)(t(t({},b),{timeout:U,callback:Z,ctx:I}))}else return(0,i.id)(t(t({},b),{op:I,ctx:T,callback:P}))}case 2:{var ne=e(m,2),I=ne[0],T=ne[1];if(typeof I=="number")return(0,i.id)(t(t({},b),{timeout:I,callback:T}));var Z=T;return v(I)?(0,i.id)(t(t({},b),{callback:Z,op:I})):(0,i.id)(t(t({},b),{callback:Z,ctx:I}))}case 1:{var F=e(m,1),Y=F[0];return(0,i.id)(t(t({},b),{callback:Y}))}case 0:return(0,i.id)(t({},b))}}break}}return o(h,"parsePropsFromArgs"),Br.parsePropsFromArgs=h,Br}o(IN,"requireEvt_parsePropsFromArgs");var Ea={},Mg;function ON(){if(Mg)return Ea;Mg=1,Object.defineProperty(Ea,"__esModule",{value:!0}),Ea.newCtx=void 0;var t=mi();function e(){return new t.importProxy.Ctx}return o(e,"newCtx"),Ea.newCtx=e,Ea}o(ON,"requireEvt_newCtx");var rr={},Sg;function TN(){if(Sg)return rr;Sg=1;var t=rr&&rr.__spreadArrays||function(){for(var T=0,P=0,j=arguments.length;P<j;P++)T+=arguments[P].length;for(var L=Array(T),U=0,P=0;P<j;P++)for(var Z=arguments[P],ne=0,F=Z.length;ne<F;ne++,U++)L[U]=Z[ne];return L};rr.__esModule=!0,rr.buildMethodCb=rr.buildCb=rr.getPrComplete=rr.isRunning=rr.cancelAllQueuedCalls=rr.getQueuedCallCount=rr.buildMethod=rr.build=rr.createGroupRef=void 0;var e=rc(),r=(function(){function T(){this.queuedCalls=[],this.isRunning=!1,this.prComplete=Promise.resolve()}return o(T,"ExecQueue2"),T.prototype.cancelAllQueuedCalls=function(){var P;return this.queuedCalls.splice(0,P=this.queuedCalls.length),P},T})(),i={},s=new e.Polyfill;function f(T,P){var j=s.get(T);j||(j=new e.Polyfill,s.set(T,j));var L=j.get(P);return L||(L=new r,j.set(P,L)),L}o(f,"getOrCreateExecQueue");function n(){return new Array(0)}o(n,"createGroupRef"),rr.createGroupRef=n;function v(){for(var T=[],P=0;P<arguments.length;P++)T[P]=arguments[P];switch(T.length){case 1:return M(!0,n(),T[0]);case 2:return M(!0,T[0],T[1])}}o(v,"build"),rr.build=v;function b(){for(var T=[],P=0;P<arguments.length;P++)T[P]=arguments[P];switch(T.length){case 1:return M(!1,n(),T[0]);case 2:return M(!1,T[0],T[1])}}o(b,"buildMethod"),rr.buildMethod=b;function h(T,P){var j=y(T,P);return j?j.queuedCalls.length:0}o(h,"getQueuedCallCount"),rr.getQueuedCallCount=h;function m(T,P){var j=y(T,P);return j?j.cancelAllQueuedCalls():0}o(m,"cancelAllQueuedCalls"),rr.cancelAllQueuedCalls=m;function l(T,P){var j=y(T,P);return j?j.isRunning:!1}o(l,"isRunning"),rr.isRunning=l;function w(T,P){var j=y(T,P);return j?j.prComplete:Promise.resolve()}o(w,"getPrComplete"),rr.getPrComplete=w;var p=new e.Polyfill;function y(T,P){P===void 0&&(P=i);var j=p.get(T);if(!j)throw Error("Not a run exclusiveFunction");var L=s.get(P);if(L)return L.get(j)}o(y,"getExecQueueByFunctionAndContext");function M(T,P,j){var L,U=o((function(){for(var Z=this,ne=[],F=0;F<arguments.length;F++)ne[F]=arguments[F];if(!T){if(!(this instanceof Object))throw new Error("Run exclusive, <this> should be an object");L=f(this,P)}return new Promise(function(Y,a){var g;L.prComplete=new Promise(function(d){return g=o(function(){return d()},"onPrCompleteResolve")});var u=o(function(d){g(),L.isRunning=!1,L.queuedCalls.length&&L.queuedCalls.shift()(),"data"in d?Y(d.data):a(d.reason)},"onComplete");o((function d(){for(var x=this,A=[],N=0;N<arguments.length;N++)A[N]=arguments[N];if(L.isRunning){L.queuedCalls.push(function(){return d.apply(x,A)});return}L.isRunning=!0;try{j.apply(this,A).then(function(S){return u({data:S})}).catch(function(S){return u({reason:S})})}catch(S){u({reason:S})}}),"callee").apply(Z,ne)})}),"runExclusiveFunction");return T&&(L=f(i,P)),p.set(U,P),U}o(M,"buildFnPromise");function E(){for(var T=[],P=0;P<arguments.length;P++)T[P]=arguments[P];switch(T.length){case 1:return I(!0,n(),T[0]);case 2:return I(!0,T[0],T[1])}}o(E,"buildCb"),rr.buildCb=E;function R(){for(var T=[],P=0;P<arguments.length;P++)T[P]=arguments[P];switch(T.length){case 1:return I(!1,n(),T[0]);case 2:return I(!1,T[0],T[1])}}o(R,"buildMethodCb"),rr.buildMethodCb=R;function I(T,P,j){var L,U=o((function(){for(var Z=this,ne=[],F=0;F<arguments.length;F++)ne[F]=arguments[F];if(!T){if(!(this instanceof Object))throw new Error("Run exclusive, <this> should be an object");L=f(this,P)}var Y=void 0;ne.length&&typeof ne[ne.length-1]=="function"&&(Y=ne.pop());var a;L.prComplete=new Promise(function(u){return a=o(function(){return u()},"onPrCompleteResolve")});var g=o(function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];a(),L.isRunning=!1,L.queuedCalls.length&&L.queuedCalls.shift()(),Y&&Y.apply(Z,u)},"onComplete");g.hasCallback=!!Y,o((function u(){for(var d=this,x=[],A=0;A<arguments.length;A++)x[A]=arguments[A];if(L.isRunning){L.queuedCalls.push(function(){return u.apply(d,x)});return}L.isRunning=!0;try{j.apply(this,t(x,[g]))}catch(N){throw N.message+=" ( This exception should not have been thrown, miss use of run-exclusive buildCb )",N}}),"callee").apply(this,ne)}),"runExclusiveFunction");return T&&(L=f(i,P)),p.set(U,P),U}return o(I,"buildFnCallback"),rr}o(TN,"requireRunExclusive");var Hi={},Eg;function PN(){if(Eg)return Hi;Eg=1;var t=Hi&&Hi.__extends||(function(){var s=o(function(f,n){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,b){v.__proto__=b}||function(v,b){for(var h in b)Object.prototype.hasOwnProperty.call(b,h)&&(v[h]=b[h])},s(f,n)},"extendStatics");return function(f,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");s(f,n);function v(){this.constructor=f}o(v,"__"),f.prototype=n===null?Object.create(n):(v.prototype=n.prototype,new v)}})();Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.VoidDeferred=Hi.Deferred=void 0;var e=ea(),r=(function(){function s(){var f=this;this.isPending=!0;var n,v;this.pr=new Promise(function(b,h){n=o(function(m){(0,e.overwriteReadonlyProp)(f,"isPending",!1),b(m)},"resolve"),v=o(function(m){(0,e.overwriteReadonlyProp)(f,"isPending",!1),h(m)},"reject")}),this.resolve=n,this.reject=v}return o(s,"Deferred"),s})();Hi.Deferred=r;var i=(function(s){t(f,s);function f(){return s!==null&&s.apply(this,arguments)||this}return o(f,"VoidDeferred"),f})(r);return Hi.VoidDeferred=i,Hi}o(PN,"requireDeferred");var Aa={},Ag;function jN(){if(Ag)return Aa;Ag=1,Object.defineProperty(Aa,"__esModule",{value:!0}),Aa.loosenType=void 0;function t(e){return e}return o(t,"loosenType"),Aa.loosenType=t,Aa}o(jN,"requireEvt_loosenType");var Gn={},kg;function LN(){if(kg)return Gn;kg=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.safeClearTimeout=Gn.safeSetTimeout=void 0;var t=o(function(r,i){return setTimeout(r,i)},"safeSetTimeout$1");Gn.safeSetTimeout=t;var e=o(function(r){return clearTimeout(r)},"safeClearTimeout");return Gn.safeClearTimeout=e,Gn}o(LN,"requireSafeSetTimeout");var dl={},Ng;function DN(){if(Ng)return dl;Ng=1,Object.defineProperty(dl,"__esModule",{value:!0}),dl.isPromiseLike=t;function t(e){return typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"}return o(t,"isPromiseLike$1"),dl}o(DN,"requireIsPromiseLike");var Cg;function n8(){return Cg||(Cg=1,(function(t){var e=ur&&ur.__assign||function(){return e=Object.assign||function(_){for(var C,O=1,D=arguments.length;O<D;O++){C=arguments[O];for(var B in C)Object.prototype.hasOwnProperty.call(C,B)&&(_[B]=C[B])}return _},e.apply(this,arguments)},r=ur&&ur.__createBinding||(Object.create?(function(_,C,O,D){D===void 0&&(D=O);var B=Object.getOwnPropertyDescriptor(C,O);(!B||("get"in B?!C.__esModule:B.writable||B.configurable))&&(B={enumerable:!0,get:o(function(){return C[O]},"get")}),Object.defineProperty(_,D,B)}):(function(_,C,O,D){D===void 0&&(D=O),_[D]=C[O]})),i=ur&&ur.__setModuleDefault||(Object.create?(function(_,C){Object.defineProperty(_,"default",{enumerable:!0,value:C})}):function(_,C){_.default=C}),s=ur&&ur.__importStar||function(_){if(_&&_.__esModule)return _;var C={};if(_!=null)for(var O in _)O!=="default"&&Object.prototype.hasOwnProperty.call(_,O)&&r(C,_,O);return i(C,_),C},f=ur&&ur.__awaiter||function(_,C,O,D){function B(z){return z instanceof O?z:new O(function(G){G(z)})}return o(B,"adopt"),new(O||(O=Promise))(function(z,G){function te(Ce){try{q(D.next(Ce))}catch(fe){G(fe)}}o(te,"fulfilled");function $(Ce){try{q(D.throw(Ce))}catch(fe){G(fe)}}o($,"rejected");function q(Ce){Ce.done?z(Ce.value):B(Ce.value).then(te,$)}o(q,"step"),q((D=D.apply(_,C||[])).next())})},n=ur&&ur.__generator||function(_,C){var O={label:0,sent:o(function(){if(z[0]&1)throw z[1];return z[1]},"sent"),trys:[],ops:[]},D,B,z,G;return G={next:te(0),throw:te(1),return:te(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function te(q){return function(Ce){return $([q,Ce])}}function $(q){if(D)throw new TypeError("Generator is already executing.");for(;O;)try{if(D=1,B&&(z=q[0]&2?B.return:q[0]?B.throw||((z=B.return)&&z.call(B),0):B.next)&&!(z=z.call(B,q[1])).done)return z;switch(B=0,z&&(q=[q[0]&2,z.value]),q[0]){case 0:case 1:z=q;break;case 4:return O.label++,{value:q[1],done:!1};case 5:O.label++,B=q[1],q=[0];continue;case 7:q=O.ops.pop(),O.trys.pop();continue;default:if(z=O.trys,!(z=z.length>0&&z[z.length-1])&&(q[0]===6||q[0]===2)){O=0;continue}if(q[0]===3&&(!z||q[1]>z[0]&&q[1]<z[3])){O.label=q[1];break}if(q[0]===6&&O.label<z[1]){O.label=z[1],z=q;break}if(z&&O.label<z[2]){O.label=z[2],O.ops.push(q);break}z[2]&&O.ops.pop(),O.trys.pop();continue}q=C.call(_,O)}catch(Ce){q=[6,Ce],B=0}finally{D=z=0}if(q[0]&5)throw q[1];return{value:q[0]?q[1]:void 0,done:!0}}},v=ur&&ur.__read||function(_,C){var O=typeof Symbol=="function"&&_[Symbol.iterator];if(!O)return _;var D=O.call(_),B,z=[],G;try{for(;(C===void 0||C-- >0)&&!(B=D.next()).done;)z.push(B.value)}catch(te){G={error:te}}finally{try{B&&!B.done&&(O=D.return)&&O.call(D)}finally{if(G)throw G.error}}return z},b=ur&&ur.__spreadArray||function(_,C,O){if(O||arguments.length===2)for(var D=0,B=C.length,z;D<B;D++)(z||!(D in C))&&(z||(z=Array.prototype.slice.call(C,0,D)),z[D]=C[D]);return _.concat(z||Array.prototype.slice.call(C))},h=ur&&ur.__values||function(_){var C=typeof Symbol=="function"&&Symbol.iterator,O=C&&_[C],D=0;if(O)return O.call(_);if(_&&typeof _.length=="number")return{next:o(function(){return _&&D>=_.length&&(_=void 0),{value:_&&_[D++],done:!_}},"next")};throw new TypeError(C?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.Evt=t.onAddHandlerByEvt=void 0,MN();var m=bp(),l=rc(),w=mi(),p=SN(),y=EN(),M=AN(),E=i8(),R=kN(),I=NN(),T=CN(),P=RN(),j=IN(),L=ON(),U=wp(),Z=s(TN()),ne=ea(),F=Zo(),Y=PN(),a=jN(),g=LN(),u=DN(),d=t8(),x=s(q6()),A=r8(),N=o(function(_){return _()},"runSideEffect"),S=x.CtxLike,c=(function(){function _(){this.lazyEvtAttach=new U.LazyEvt,this.lazyEvtDetach=new U.LazyEvt,this.__maxHandlers=void 0,this.postCount=0,this.traceId=null,this.handlers=[],this.handlerTriggers=new m.Polyfill,this.__currentChronologyMark=0,this.asyncHandlerCount=0}return o(_,"EvtImpl"),_.setDefaultMaxHandlers=function(C){this.__defaultMaxHandlers=isFinite(C)?C:0},_.prototype.toStateful=function(C,O){var D=S.match(C),B=D?void 0:C,z=O||(D?C:void 0),G=new w.importProxy.StatefulEvt(B),te=o(function($){return G.post($)},"callback");return z?this.attach(z,te):this.attach(te),G},Object.defineProperty(_.prototype,"evtAttach",{get:o(function(){return this.lazyEvtAttach.evt},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"evtDetach",{get:o(function(){return this.lazyEvtDetach.evt},"get"),enumerable:!1,configurable:!0}),_.prototype.setMaxHandlers=function(C){return this.__maxHandlers=isFinite(C)?C:0,this},_.prototype.enableTrace=function(C){var O=C.id,D=C.formatter,B=C.log;this.traceId=O,this.traceFormatter=D||(function(z){try{return JSON.stringify(z,null,2)}catch{return"".concat(z)}}),this.log=B===void 0?(function(){for(var z=[],G=0;G<arguments.length;G++)z[G]=arguments[G];return console.log.apply(console,b([],v(z),!1))}):B===!1?void 0:B},_.prototype.disableTrace=function(){return this.traceId=null,this},Object.defineProperty(_.prototype,"asyncHandlerChronologyMark",{get:o(function(){var C,O,D,B;return(O=(B=(C=(D=this)["~internal"])!==null&&C!==void 0?C:D["~internal"]={}).asyncHandlerChronologyMark)!==null&&O!==void 0?O:B.asyncHandlerChronologyMark=new l.Polyfill},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"asyncHandlerChronologyExceptionRange",{get:o(function(){var C,O,D,B;return(O=(B=(C=(D=this)["~internal"])!==null&&C!==void 0?C:D["~internal"]={}).asyncHandlerChronologyExceptionRange)!==null&&O!==void 0?O:B.asyncHandlerChronologyExceptionRange=new l.Polyfill},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(_.prototype,"invocableOpByOp",{get:o(function(){var C,O,D,B;return(O=(B=(C=(D=this)["~internal"])!==null&&C!==void 0?C:D["~internal"]={}).invocableOpByOp)!==null&&O!==void 0?O:B.invocableOpByOp=new l.Polyfill},"get"),enumerable:!1,configurable:!0}),_.prototype.getInvocableOp=function(C){var O=this.invocableOpByOp.get(C);if(O===void 0)throw new Error(["Provided operator isn't the operator of any handler","currently attached to the Evt instance"].join(" "));return O},_.prototype.getChronologyMark=function(){return this.__currentChronologyMark++},_.prototype.detachHandler=function(C,O,D){var B=this.handlers.indexOf(C);return B<0?!1:((0,F.typeGuard)(C,!!C.ctx)&&C.ctx.zz__removeHandler(C),this.handlers.splice(B,1),C.async&&this.asyncHandlerCount--,this.handlerTriggers.delete(C),O[0]!==void 0&&((0,g.safeClearTimeout)(O[0]),D(new d.DetachedEvtError)),this.lazyEvtDetach.post(C),!0)},_.prototype.triggerHandler=function(C,O,D,B){var z=C.callback,G=C.once;O[0]!==void 0&&((0,g.safeClearTimeout)(O[0]),O[0]=void 0),G&&C.detach();var te=v(B,1),$=te[0],q=z?.call(this,$);return D?.($),(0,u.isPromiseLike)(q)?q:void 0},_.prototype.addHandler=function(C,O){var D=this,B;this.invocableOpByOp.set(C.op,(0,A.convertOperatorToStatelessFλ)(C.op));var z=new Y.Deferred,G=[void 0],te=e(e(e({},C),O),{detach:o(function(){return D.detachHandler(te,G,z.reject)},"detach"),promise:z.pr});typeof te.timeout=="number"&&(G[0]=(0,g.safeSetTimeout)(function(){G[0]=void 0,te.detach(),z.reject(new d.TimeoutEvtError(te.timeout))},te.timeout));var $=o(function(Ce){return D.triggerHandler(te,G,z.isPending?z.resolve:void 0,Ce)},"handlerTrigger");if(this.handlerTriggers.set(te,$),te.async&&this.asyncHandlerChronologyMark.set(te,this.getChronologyMark()),te.prepend){var q=void 0;for(q=0;q<this.handlers.length&&this.handlers[q].extract;q++);this.handlers.splice(q,0,te)}else this.handlers.push(te);return te.async&&this.asyncHandlerCount++,this.checkForPotentialMemoryLeak(),(0,F.typeGuard)(te,!!te.ctx)&&te.ctx.zz__addHandler(te,this),(B=t.onAddHandlerByEvt.get(this))===null||B===void 0||B(te,$),this.handlerTriggers.has(te)&&this.lazyEvtAttach.post(te),te},_.prototype.checkForPotentialMemoryLeak=function(){var C=this.__maxHandlers!==void 0?this.__maxHandlers:_.__defaultMaxHandlers;if(!(C===0||this.handlers.length%(C+1)!==0)){var O=["MaxHandlersExceededWarning: Possible Evt memory leak detected.","".concat(this.handlers.length," handlers attached").concat(this.traceId?' to "'.concat(this.traceId,'"'):"",`.
|
|
84
|
-
`),`Use Evt.prototype.setMaxHandlers(n) to increase limit on a specific Evt.
|
|
85
|
-
`,"Use Evt.setDefaultMaxHandlers(n) to change the default limit currently set to ".concat(_.__defaultMaxHandlers,`.
|
|
86
|
-
`)].join(""),D=new m.Polyfill;this.getHandlers().map(function(B){var z=B.ctx,G=B.async,te=B.once,$=B.prepend,q=B.extract,Ce=B.op,fe=B.callback;return e(e({hasCtx:!!z,once:te,prepend:$,extract:q,isWaitFor:G},Ce===j.matchAll?{}:{op:Ce.toString()}),fe?{callback:fe.toString()}:{})}).map(function(B){return`{
|
|
87
|
-
`+Object.keys(B).map(function(z){return" ".concat(z,": ").concat(B[z])}).join(`,
|
|
88
|
-
`)+`
|
|
89
|
-
}`}).forEach(function(B){return D.set(B,(D.has(B)?D.get(B):0)+1)}),O+=`
|
|
90
|
-
`+Array.from(D.keys()).map(function(B){return"".concat(D.get(B)," handler").concat(D.get(B)===1?"":"s",` like:
|
|
91
|
-
`).concat(B)}).join(`
|
|
92
|
-
`)+`
|
|
93
|
-
`,this.traceId===null&&(O+=`
|
|
94
|
-
`+["To validate the identify of the Evt instance that is triggering this warning you can call",`Evt.prototype.enableTrace({ "id": "My evt id", "log": false }) on the Evt that you suspect.
|
|
95
|
-
`].join(" "));try{console.warn(O)}catch{}}},_.prototype.isHandledByOp=function(C,O){var D=!1,B;try{B=this.getInvocableOp(C)}catch{return!1}var z=B(O,function(){return D=!0});return z!==null||D},_.prototype.trace=function(C){var O=this,D;if(this.traceId!==null){var B="(".concat(this.traceId,") "),z=!!this.handlers.find(function(te){var $=te.extract,q=te.op;return $&&O.isHandledByOp(q,C)});if(z)B+="extracted ";else{var G=this.handlers.filter(function(te){var $=te.extract,q=te.op;return!$&&O.isHandledByOp(q,C)}).length;B+="".concat(G," handler").concat(G>1?"s":"",", ")}(D=this.log)===null||D===void 0||D.call(this,B+this.traceFormatter(C))}},_.prototype.postSync=function(C){var O,D,B=[],z=o(function(ee){return[ee,Promise.all(B).then(function(){})]},"getReturnValue");try{for(var G=h(b([],v(this.handlers),!1)),te=G.next();!te.done;te=G.next()){var $=te.value,q=$.async,Ce=$.op,fe=$.extract;if(!q){var ae=this.handlerTriggers.get($),be=this.getInvocableOp(Ce)(C,N);if(be!==null&&ae){var H=ae(be);if(H!==void 0&&B.push(H),fe)return z(!0)}}}}catch(ee){O={error:ee}}finally{try{te&&!te.done&&(D=G.return)&&D.call(G)}finally{if(O)throw O.error}}return z(!1)},_.prototype.postAsyncFactory=function(){var C=this;return Z.buildMethodCb(function(O,D,B){var z,G;if(C.asyncHandlerCount===0){B();return}var te=[],$;Promise.resolve().then(function(){return $=C.getChronologyMark()});var q=o(function(H){if(!H.async)return"continue";var ee=C.getInvocableOp(H.op)(O,N);if(ee===null)return"continue";var Q=C.handlerTriggers.get(H);if(!Q)return"continue";var X=(function(){var se=C.asyncHandlerChronologyMark.get(H);if(D>se)return!0;var Ne=C.asyncHandlerChronologyExceptionRange.get(H);return Ne!==void 0&&Ne.lowerMark<D&&D<Ne.upperMark&&se>Ne.upperMark})();if(!X)return"continue";te.push(new Promise(function(se){return H.promise.then(function(){return se()}).catch(function(){return se()})})),Q(ee)},"_loop_1");try{for(var Ce=h(b([],v(C.handlers),!1)),fe=Ce.next();!fe.done;fe=Ce.next()){var ae=fe.value;q(ae)}}catch(H){z={error:H}}finally{try{fe&&!fe.done&&(G=Ce.return)&&G.call(Ce)}finally{if(z)throw z.error}}if(te.length===0){B();return}var be=b([],v(C.handlers),!1);Promise.all(te).then(function(){var H,ee;try{for(var Q=h(C.handlers),X=Q.next();!X.done;X=Q.next()){var se=X.value;se.async&&(be.indexOf(se)>=0||C.asyncHandlerChronologyExceptionRange.set(se,{lowerMark:D,upperMark:$}))}}catch(Ne){H={error:Ne}}finally{try{X&&!X.done&&(ee=Q.return)&&ee.call(Q)}finally{if(H)throw H.error}}B()})})},_.prototype.isHandled=function(C){var O=this;return!!this.getHandlers().find(function(D){var B=D.op;return O.isHandledByOp(B,C)})},_.prototype.getHandlers=function(){return b([],v(this.handlers),!1)},_.prototype.detach=function(C){var O,D,B=[];try{for(var z=h(this.getHandlers()),G=z.next();!G.done;G=z.next()){var te=G.value;if(!(C!==void 0&&te.ctx!==C)){var $=te.detach();$&&B.push(te)}}}catch(q){O={error:q}}finally{try{G&&!G.done&&(D=z.return)&&D.call(z)}finally{if(O)throw O.error}}return B},_.prototype.pipe=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];var D=new _;return this.addHandler(e(e({},(0,j.parsePropsFromArgs)(C,"pipe")),{callback:o(function(B){return D.post(B)},"callback")}),_.propsFormMethodNames.attach),D},_.prototype.waitFor=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.addHandler((0,j.parsePropsFromArgs)(C,"waitFor"),_.propsFormMethodNames.waitFor).promise},_.prototype[Symbol.asyncIterator]=function(){return this.iter()[Symbol.asyncIterator]()},_.prototype.iter=function(){for(var C,O,D=[],B=0;B<arguments.length;B++)D[B]=arguments[B];var z=(0,j.parsePropsFromArgs)(D,"waitFor"),G=(O=z.ctx)!==null&&O!==void 0?O:(0,L.newCtx)(),te=this;return C={ctx:G},C[Symbol.asyncIterator]=function(){var $=G.evtDoneOrAborted.postCount,q=(function(){var be=z.timeout;if(be!==void 0){var H=o(function(){var Q=new d.TimeoutEvtError(be);G.abort(Q)},"setTimeoutCallback"),ee=setTimeout(H,be);return{timeout:be,setTimeoutCallback:H,timer:ee}}})(),Ce=te.pipe(G,z.op).pipe(function(be,H){return q!==void 0&&H(function(){clearTimeout(q.timer),q.timer=setTimeout(q.setTimeoutCallback,q.timeout)}),[be]}),fe=[];if(Ce.attach(function(be){return fe.push([be])}),q!==void 0){var ae=q.timer;G.evtDoneOrAborted.attachOnce(function(be){return be.type==="DONE"},function(){return clearTimeout(ae)})}return{next:o(function(){return f(this,void 0,void 0,function(){var be,H,ee,Q;return n(this,function(X){switch(X.label){case 0:return be=fe.shift(),be!==void 0?[3,2]:(H=new Y.Deferred,$<G.evtDoneOrAborted.postCount?[2,{done:!0}]:(ee=(0,L.newCtx)(),G.evtDoneOrAborted.attachOnce(ee,function(){return H.resolve(void 0)}),Ce.attachOnceExtract(ee,function(se){ee.done(),H.resolve([se])}),[4,H.pr]));case 1:if(be=X.sent(),be===void 0)return[2,{done:!0}];X.label=2;case 2:return Q={done:!1,value:be[0]},[2,Q]}})})},"next"),return:o(function(){return te.detach(G),{done:!0}},"return"),throw:o(function(be){return te.detach(G),Promise.reject(be)},"throw")}},C},_.prototype.$attach=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.attach.apply(this,b([],v(C),!1))},_.prototype.attach=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.__attachX(C,"attach")},_.prototype.$attachOnce=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.attachOnce.apply(this,b([],v(C),!1))},_.prototype.attachOnce=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.__attachX(C,"attachOnce")},_.prototype.$attachExtract=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.attachExtract.apply(this,b([],v(C),!1))},_.prototype.attachExtract=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.__attachX(C,"attachExtract")},_.prototype.$attachPrepend=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.attachPrepend.apply(this,b([],v(C),!1))},_.prototype.attachPrepend=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.__attachX(C,"attachPrepend")},_.prototype.$attachOncePrepend=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.attachOncePrepend.apply(this,b([],v(C),!1))},_.prototype.attachOncePrepend=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.__attachX(C,"attachOncePrepend")},_.prototype.$attachOnceExtract=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.attachOnceExtract.apply(this,b([],v(C),!1))},_.prototype.attachOnceExtract=function(){for(var C=[],O=0;O<arguments.length;O++)C[O]=arguments[O];return this.__attachX(C,"attachOnceExtract")},_.prototype.__attachX=function(C,O){var D=(0,j.parsePropsFromArgs)(C,"attach*"),B=this.addHandler(D,_.propsFormMethodNames[O]);return D.timeout===void 0?this:B.promise},_.prototype.postAsyncOnceHandled=function(C){var O=this;if(this.isHandled(C))return this.post(C);var D=new Y.Deferred;return this.evtAttach.attachOnce(function(B){var z=B.op;return O.isHandledByOp(z,C)},function(){return Promise.resolve().then(function(){return D.resolve(O.post(C))})}),D.pr},_.prototype.postOrPostAndWait=function(C,O){var D=this;this.trace(C),(0,ne.overwriteReadonlyProp)(this,"postCount",this.postCount+1);var B=this.getChronologyMark(),z=v(this.postSync(C),2),G=z[0],te=z[1],$=O?function(){return te}:function(){return D.postCount};if(G)return $();if(this.postAsync===void 0){if(this.asyncHandlerCount===0)return $();this.postAsync=this.postAsyncFactory()}return this.postAsync(C,B),$()},_.prototype.post=function(C){return this.postOrPostAndWait(C,!1)},_.prototype.postAndWait=function(C){return this.postOrPostAndWait(C,!0)},_.create=p.create,_.newCtx=L.newCtx,_.merge=E.merge,_.from=R.from,_.getCtx=(0,y.getCtxFactory)(),_.loosenType=a.loosenType,_.factorize=M.factorize,_.asPostable=I.asPostable,_.asyncPipe=T.asyncPipe,_.asNonPostable=P.asNonPostable,_.__defaultMaxHandlers=25,_.propsFormMethodNames={waitFor:{async:!0,extract:!1,once:!0,prepend:!1},attach:{async:!1,extract:!1,once:!1,prepend:!1},attachExtract:{async:!1,extract:!0,once:!1,prepend:!0},attachPrepend:{async:!1,extract:!1,once:!1,prepend:!0},attachOnce:{async:!1,extract:!1,once:!0,prepend:!1},attachOncePrepend:{async:!1,extract:!1,once:!0,prepend:!0},attachOnceExtract:{async:!1,extract:!0,once:!0,prepend:!0}},_})();t.onAddHandlerByEvt=new l.Polyfill,t.Evt=c;try{(0,ne.overwriteReadonlyProp)(t.Evt,"name","Evt")}catch{}w.importProxy.Evt=t.Evt})(ur)),ur}o(n8,"requireEvt");var Vi={},hf={},Rg;function BN(){return Rg||(Rg=1,hf.__esModule=!0,Object.is||(Object.is=function(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e})),hf}o(BN,"requireObject_is");var ka={},Ig;function zN(){if(Ig)return ka;Ig=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.LazyStatefulEvt=void 0;var t=ea(),e=mi(),r=(function(){function i(s){this.initialPostCount=0,this.initialState=s}return o(i,"LazyStatefulEvt"),Object.defineProperty(i.prototype,"evt",{get:o(function(){return this.__evt===void 0&&(this.__evt=new e.importProxy.StatefulEvt(this.initialState),this.initialState=null,(0,t.overwriteReadonlyProp)(this.__evt,"postCount",this.initialPostCount)),this.__evt},"get"),enumerable:!1,configurable:!0}),i.prototype.__post=function(s,f){return this.__evt===void 0?(this.initialState=s,++this.initialPostCount):this.__evt[f?"postAndWait":"post"](s)},i.prototype.post=function(s){return this.__post(s,!1)},i.prototype.postAndWait=function(s){return this.__post(s,!0)},i})();return ka.LazyStatefulEvt=r,ka}o(zN,"requireLazyStatefulEvt");var Og;function FN(){return Og||(Og=1,(function(t){var e=Vi&&Vi.__extends||(function(){var w=o(function(p,y){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(M,E){M.__proto__=E}||function(M,E){for(var R in E)Object.prototype.hasOwnProperty.call(E,R)&&(M[R]=E[R])},w(p,y)},"extendStatics");return function(p,y){if(typeof y!="function"&&y!==null)throw new TypeError("Class extends value "+String(y)+" is not a constructor or null");w(p,y);function M(){this.constructor=p}o(M,"__"),p.prototype=y===null?Object.create(y):(M.prototype=y.prototype,new M)}})(),r=Vi&&Vi.__read||function(w,p){var y=typeof Symbol=="function"&&w[Symbol.iterator];if(!y)return w;var M=y.call(w),E,R=[],I;try{for(;(p===void 0||p-- >0)&&!(E=M.next()).done;)R.push(E.value)}catch(T){I={error:T}}finally{try{E&&!E.done&&(y=M.return)&&y.call(M)}finally{if(I)throw I.error}}return R},i=Vi&&Vi.__spreadArray||function(w,p,y){if(y||arguments.length===2)for(var M=0,E=p.length,R;M<E;M++)(R||!(M in p))&&(R||(R=Array.prototype.slice.call(p,0,M)),R[M]=p[M]);return w.concat(R||Array.prototype.slice.call(p))};Object.defineProperty(t,"__esModule",{value:!0}),t.StatefulEvt=void 0,BN();var s=wp(),f=zN(),n=mi(),v=n8(),b=yp(),h=ec(),m=o(function(w){return w()},"runSideEffect"),l=(function(w){e(p,w);function p(y){var M=w.call(this)||this;return M.lazyEvtDiff=new s.LazyEvt,M.lazyEvtChangeDiff=new s.LazyEvt,M.__state=y,M.lazyEvtChange=new f.LazyStatefulEvt(M.__state),v.onAddHandlerByEvt.set(M,function(E,R){if(!E.extract){var I=(0,h.id)(void 0),T=M.getInvocableOp(E.op)(M.__state,M.setOpResultForPipe!==void 0?(function(P){return I=P}):m);M.setOpResultForPipe!==void 0&&(M.setOpResultForPipe(T),I!==void 0&&I()),T&&R(T)}}),M}return o(p,"StatefulEvtImpl"),Object.defineProperty(p.prototype,"state",{get:o(function(){return this.__state},"get"),set:o(function(y){this.state!==y&&this.post(y)},"set"),enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"evtDiff",{get:o(function(){return this.lazyEvtDiff.evt},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"evtChange",{get:o(function(){return this.lazyEvtChange.evt},"get"),enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"evtChangeDiff",{get:o(function(){return this.lazyEvtChangeDiff.evt},"get"),enumerable:!1,configurable:!0}),p.prototype.post=function(y){return this.__post(y,!1,!1)},p.prototype.postForceChange=function(y){return this.__post(y?y[0]:this.state,!0,!1)},p.prototype.postAndWait=function(y){return this.__post(y,!1,!0)},p.prototype.__post=function(y,M,E){var R=this.state;this.__state=y;var I={prevState:R,newState:this.state},T=E?"postAndWait":"post",P=[],j=this.lazyEvtDiff[T](I);if(E&&P.push(j),M||!Object.is(R,this.state)){var L=this.lazyEvtChange[T](this.state),U=this.lazyEvtChangeDiff[T](I);E&&P.push(L,U)}var Z=w.prototype[T].call(this,y);return E?(P.push(Z),Promise.all(P).then(function(){})):Z},p.prototype.pipe=function(){for(var y=[],M=0;M<arguments.length;M++)y[M]=arguments[M];var E=void 0;this.setOpResultForPipe=function(I){return E=I};var R=w.prototype.pipe.apply(this,i([],r(y),!1));if((0,b.assert)(E!==void 0),this.setOpResultForPipe=void 0,!E)throw new Error(["Cannot pipe StatefulEvt because the operator does not match","it's current state. You would end up with evt.state === undefined","Use evt.toStateless([ctx]).pipe(op).toStatic(initialState)","to be sure the StatefulEvt does not have an undefined state"].join(" "));return R.toStateful(E[0])},p.prototype.toStateless=function(y){var M=v.onAddHandlerByEvt.get(this);v.onAddHandlerByEvt.delete(this);var E=y?w.prototype.pipe.call(this,y):w.prototype.pipe.call(this);return v.onAddHandlerByEvt.set(this,M),E},p})(v.Evt);t.StatefulEvt=l,n.importProxy.StatefulEvt=t.StatefulEvt})(Vi)),Vi}o(FN,"requireStatefulEvt");var pf={},Tg;function UN(){return Tg||(Tg=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.to=void 0;var e=new Map,r=o(function(i){var s;return(s=e.get(i))!==null&&s!==void 0?s:(e.set(i,function(f){return f[0]!==i?null:[f[1]]}),(0,t.to)(i))},"to");t.to=r})(pf)),pf}o(UN,"requireTo");var Na={},Pg;function HN(){if(Pg)return Na;Pg=1,Object.defineProperty(Na,"__esModule",{value:!0}),Na.throttleTime=void 0;var t=tc(),e=o(function(r){return(0,t.compose)([function(i,s){var f=s.lastClick,n=Date.now();return n-f<r?null:[{data:i,lastClick:n}]},{lastClick:0,data:null}],function(i){var s=i.data;return[s]})},"throttleTime$1");return Na.throttleTime=e,Na}o(HN,"requireThrottleTime");var Ca={},jg;function VN(){if(jg)return Ca;jg=1,Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.nonNullable=void 0;var t=o(function(i){return i!=null},"isNonNullable"),e=o(function(i){return t(i)?[i]:null},"nonNullableImpl"),r=o(function(){return e},"nonNullable$1");return Ca.nonNullable=r,Ca}o(VN,"requireNonNullable");var Zi={},Lg;function ZN(){if(Lg)return Zi;Lg=1;var t=Zi&&Zi.__read||function(s,f){var n=typeof Symbol=="function"&&s[Symbol.iterator];if(!n)return s;var v=n.call(s),b,h=[],m;try{for(;(f===void 0||f-- >0)&&!(b=v.next()).done;)h.push(b.value)}catch(l){m={error:l}}finally{try{b&&!b.done&&(n=v.return)&&n.call(v)}finally{if(m)throw m.error}}return h},e=Zi&&Zi.__spreadArray||function(s,f,n){if(n||arguments.length===2)for(var v=0,b=f.length,h;v<b;v++)(h||!(v in f))&&(h||(h=Array.prototype.slice.call(f,0,v)),h[v]=f[v]);return s.concat(h||Array.prototype.slice.call(f))};Object.defineProperty(Zi,"__esModule",{value:!0}),Zi.distinct=void 0;var r=tc(),i=o(function(s,f){var n;return(0,r.compose)(function(v){var b,h;return[{data:v,selectedKey:(b=s?.(v))!==null&&b!==void 0?b:v,currentFlushCount:(h=f?.evtDoneOrAborted.postCount)!==null&&h!==void 0?h:0}]},[function(v,b){var h=v.data,m=v.selectedKey,l=v.currentFlushCount,w=b.alreadyPostedData,p=b.previousFlushCount;return[{boxedData:l!==p||!w.has(m)?[h]:null,alreadyPostedData:new Set(e(e([],t(l!==p?[]:Array.from(w)),!1),[m],!1)),previousFlushCount:l}]},{boxedData:null,alreadyPostedData:new Set,previousFlushCount:(n=f?.evtDoneOrAborted.postCount)!==null&&n!==void 0?n:0}],function(v){var b=v.boxedData;return b})},"distinct$1");return Zi.distinct=i,Zi}o(ZN,"requireDistinct");var Dg;function GN(){return Dg||(Dg=1,(function(t){var e=zn&&zn.__createBinding||(Object.create?(function(m,l,w,p){p===void 0&&(p=w);var y=Object.getOwnPropertyDescriptor(l,w);(!y||("get"in y?!l.__esModule:y.writable||y.configurable))&&(y={enumerable:!0,get:o(function(){return l[w]},"get")}),Object.defineProperty(m,p,y)}):(function(m,l,w,p){p===void 0&&(p=w),m[p]=l[w]})),r=zn&&zn.__exportStar||function(m,l){for(var w in m)w!=="default"&&!Object.prototype.hasOwnProperty.call(l,w)&&e(l,m,w)};Object.defineProperty(t,"__esModule",{value:!0}),t.distinct=t.nonNullable=t.throttleTime=t.to=t.StatefulEvt=t.Evt=t.Ctx=void 0,r(yN(),t),r(wN(),t);var i=_N();Object.defineProperty(t,"Ctx",{enumerable:!0,get:o(function(){return i.Ctx},"get")});var s=n8();Object.defineProperty(t,"Evt",{enumerable:!0,get:o(function(){return s.Evt},"get")});var f=FN();Object.defineProperty(t,"StatefulEvt",{enumerable:!0,get:o(function(){return f.StatefulEvt},"get")});var n=UN();Object.defineProperty(t,"to",{enumerable:!0,get:o(function(){return n.to},"get")});var v=HN();Object.defineProperty(t,"throttleTime",{enumerable:!0,get:o(function(){return v.throttleTime},"get")});var b=VN();Object.defineProperty(t,"nonNullable",{enumerable:!0,get:o(function(){return b.nonNullable},"get")});var h=ZN();Object.defineProperty(t,"distinct",{enumerable:!0,get:o(function(){return h.distinct},"get")})})(zn)),zn}o(GN,"requireLib");var Gi=GN();const Ii=Object.create(null);Ii.open="0";Ii.close="1";Ii.ping="2";Ii.pong="3";Ii.message="4";Ii.upgrade="5";Ii.noop="6";const Il=Object.create(null);Object.keys(Ii).forEach(t=>{Il[Ii[t]]=t});const ch={type:"error",data:"parser error"},s8=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",a8=typeof ArrayBuffer=="function",o8=o(t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,"isView$1"),xp=o(({type:t,data:e},r,i)=>s8&&e instanceof Blob?r?i(e):Bg(e,i):a8&&(e instanceof ArrayBuffer||o8(e))?r?i(e):Bg(new Blob([e]),i):i(Ii[t]+(e||"")),"encodePacket"),Bg=o((t,e)=>{const r=new FileReader;return r.onload=function(){const i=r.result.split(",")[1];e("b"+(i||""))},r.readAsDataURL(t)},"encodeBlobAsBase64");function zg(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}o(zg,"toArray");let mf;function YN(t,e){if(s8&&t.data instanceof Blob)return t.data.arrayBuffer().then(zg).then(e);if(a8&&(t.data instanceof ArrayBuffer||o8(t.data)))return e(zg(t.data));xp(t,!1,r=>{mf||(mf=new TextEncoder),e(mf.encode(r))})}o(YN,"encodePacketToBinary");const Fg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ba=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Fg.length;t++)Ba[Fg.charCodeAt(t)]=t;const QN=o(t=>{let e=t.length*.75,r=t.length,i,s=0,f,n,v,b;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const h=new ArrayBuffer(e),m=new Uint8Array(h);for(i=0;i<r;i+=4)f=Ba[t.charCodeAt(i)],n=Ba[t.charCodeAt(i+1)],v=Ba[t.charCodeAt(i+2)],b=Ba[t.charCodeAt(i+3)],m[s++]=f<<2|n>>4,m[s++]=(n&15)<<4|v>>2,m[s++]=(v&3)<<6|b&63;return h},"decode$1"),KN=typeof ArrayBuffer=="function",_p=o((t,e)=>{if(typeof t!="string")return{type:"message",data:l8(t,e)};const r=t.charAt(0);return r==="b"?{type:"message",data:XN(t.substring(1),e)}:Il[r]?t.length>1?{type:Il[r],data:t.substring(1)}:{type:Il[r]}:ch},"decodePacket"),XN=o((t,e)=>{if(KN){const r=QN(t);return l8(r,e)}else return{base64:!0,data:t}},"decodeBase64Packet"),l8=o((t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},"mapBinary"),u8="",WN=o((t,e)=>{const r=t.length,i=new Array(r);let s=0;t.forEach((f,n)=>{xp(f,!1,v=>{i[n]=v,++s===r&&e(i.join(u8))})})},"encodePayload"),$N=o((t,e)=>{const r=t.split(u8),i=[];for(let s=0;s<r.length;s++){const f=_p(r[s],e);if(i.push(f),f.type==="error")break}return i},"decodePayload");function JN(){return new TransformStream({transform(t,e){YN(t,r=>{const i=r.length;let s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);const f=new DataView(s.buffer);f.setUint8(0,126),f.setUint16(1,i)}else{s=new Uint8Array(9);const f=new DataView(s.buffer);f.setUint8(0,127),f.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(r)})}})}o(JN,"createPacketEncoderStream");let gf;function hl(t){return t.reduce((e,r)=>e+r.length,0)}o(hl,"totalLength");function pl(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let i=0;for(let s=0;s<e;s++)r[s]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),r}o(pl,"concatChunks");function qN(t,e){gf||(gf=new TextDecoder);const r=[];let i=0,s=-1,f=!1;return new TransformStream({transform(n,v){for(r.push(n);;){if(i===0){if(hl(r)<1)break;const b=pl(r,1);f=(b[0]&128)===128,s=b[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(hl(r)<2)break;const b=pl(r,2);s=new DataView(b.buffer,b.byteOffset,b.length).getUint16(0),i=3}else if(i===2){if(hl(r)<8)break;const b=pl(r,8),h=new DataView(b.buffer,b.byteOffset,b.length),m=h.getUint32(0);if(m>Math.pow(2,21)-1){v.enqueue(ch);break}s=m*Math.pow(2,32)+h.getUint32(4),i=3}else{if(hl(r)<s)break;const b=pl(r,s);v.enqueue(_p(f?b:gf.decode(b),e)),i=0}if(s===0||s>t){v.enqueue(ch);break}}}})}o(qN,"createPacketDecoderStream");const c8=4;function mr(t){if(t)return eC(t)}o(mr,"Emitter");function eC(t){for(var e in mr.prototype)t[e]=mr.prototype[e];return t}o(eC,"mixin");mr.prototype.on=mr.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};mr.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return o(r,"on"),r.fn=e,this.on(t,r),this};mr.prototype.off=mr.prototype.removeListener=mr.prototype.removeAllListeners=mr.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,s=0;s<r.length;s++)if(i=r[s],i===e||i.fn===e){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+t],this};mr.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(r){r=r.slice(0);for(var i=0,s=r.length;i<s;++i)r[i].apply(this,e)}return this};mr.prototype.emitReserved=mr.prototype.emit;mr.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};mr.prototype.hasListeners=function(t){return!!this.listeners(t).length};const ic=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0),Qr=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),tC="arraybuffer";function f8(t,...e){return e.reduce((r,i)=>(t.hasOwnProperty(i)&&(r[i]=t[i]),r),{})}o(f8,"pick");const rC=Qr.setTimeout,iC=Qr.clearTimeout;function nc(t,e){e.useNativeTimers?(t.setTimeoutFn=rC.bind(Qr),t.clearTimeoutFn=iC.bind(Qr)):(t.setTimeoutFn=Qr.setTimeout.bind(Qr),t.clearTimeoutFn=Qr.clearTimeout.bind(Qr))}o(nc,"installTimerFunctions");const nC=1.33;function sC(t){return typeof t=="string"?aC(t):Math.ceil((t.byteLength||t.size)*nC)}o(sC,"byteLength");function aC(t){let e=0,r=0;for(let i=0,s=t.length;i<s;i++)e=t.charCodeAt(i),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(i++,r+=4);return r}o(aC,"utf8Length");function d8(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}o(d8,"randomString");function oC(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}o(oC,"encode");function lC(t){let e={},r=t.split("&");for(let i=0,s=r.length;i<s;i++){let f=r[i].split("=");e[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return e}o(lC,"decode");class uC extends Error{static{o(this,"TransportError")}constructor(e,r,i){super(e),this.description=r,this.context=i,this.type="TransportError"}}class Mp extends mr{static{o(this,"Transport")}constructor(e){super(),this.writable=!1,nc(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,r,i){return super.emitReserved("error",new uC(e,r,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const r=_p(e,this.socket.binaryType);this.onPacket(r)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,r={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const r=oC(e);return r.length?"?"+r:""}}class cC extends Mp{static{o(this,"Polling")}constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const r=o(()=>{this.readyState="paused",e()},"pause");if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||r()})),this.writable||(i++,this.once("drain",function(){--i||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const r=o(i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)},"callback");$N(e,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=o(()=>{this.write([{type:"close"}])},"close");this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,WN(e,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=d8()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(e,r)}}let h8=!1;try{h8=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const fC=h8;function dC(){}o(dC,"empty");class hC extends cC{static{o(this,"BaseXHR")}constructor(e){if(super(e),typeof location<"u"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,r){const i=this.request({method:"POST",data:e});i.on("success",r),i.on("error",(s,f)=>{this.onError("xhr post error",s,f)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(r,i)=>{this.onError("xhr poll error",r,i)}),this.pollXhr=e}}class Ai extends mr{static{o(this,"Request")}constructor(e,r,i){super(),this.createRequest=e,nc(this,i),this._opts=i,this._method=i.method||"GET",this._uri=r,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;const r=f8(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(r);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&i.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var s;i.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=Ai.requestsCount++,Ai.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=dC,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ai.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}Ai.requestsCount=0;Ai.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ug);else if(typeof addEventListener=="function"){const t="onpagehide"in Qr?"pagehide":"unload";addEventListener(t,Ug,!1)}}function Ug(){for(let t in Ai.requests)Ai.requests.hasOwnProperty(t)&&Ai.requests[t].abort()}o(Ug,"unloadHandler");const pC=(function(){const t=p8({xdomain:!1});return t&&t.responseType!==null})();class mC extends hC{static{o(this,"XHR")}constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=pC&&!r}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ai(p8,this.uri(),e)}}function p8(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||fC))return new XMLHttpRequest}catch{}if(!e)try{return new Qr[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}o(p8,"newRequest");const m8=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class gC extends Mp{static{o(this,"BaseWS")}get name(){return"websocket"}doOpen(){const e=this.uri(),r=this.opts.protocols,i=m8?{}:f8(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,r,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const i=e[r],s=r===e.length-1;xp(i,this.supportsBinary,f=>{try{this.doWrite(i,f)}catch{}s&&ic(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=d8()),this.supportsBinary||(r.b64=1),this.createUri(e,r)}}const vf=Qr.WebSocket||Qr.MozWebSocket;class vC extends gC{static{o(this,"WS")}createSocket(e,r,i){return m8?new vf(e,r,i):r?new vf(e,r):new vf(e)}doWrite(e,r){this.ws.send(r)}}class bC extends Mp{static{o(this,"WT")}get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const r=qN(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(r).getReader(),s=JN();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const f=o(()=>{i.read().then(({done:v,value:b})=>{v||(this.onPacket(b),f())}).catch(v=>{})},"read");f();const n={type:"open"};this.query.sid&&(n.data=`{"sid":"${this.query.sid}"}`),this._writer.write(n).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const i=e[r],s=r===e.length-1;this._writer.write(i).then(()=>{s&&ic(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const yC={websocket:vC,webtransport:bC,polling:mC},wC=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,xC=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fh(t){if(t.length>8e3)throw"URI too long";const e=t,r=t.indexOf("["),i=t.indexOf("]");r!=-1&&i!=-1&&(t=t.substring(0,r)+t.substring(r,i).replace(/:/g,";")+t.substring(i,t.length));let s=wC.exec(t||""),f={},n=14;for(;n--;)f[xC[n]]=s[n]||"";return r!=-1&&i!=-1&&(f.source=e,f.host=f.host.substring(1,f.host.length-1).replace(/;/g,":"),f.authority=f.authority.replace("[","").replace("]","").replace(/;/g,":"),f.ipv6uri=!0),f.pathNames=_C(f,f.path),f.queryKey=MC(f,f.query),f}o(fh,"parse");function _C(t,e){const r=/\/{2,9}/g,i=e.replace(r,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}o(_C,"pathNames");function MC(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,f){s&&(r[s]=f)}),r}o(MC,"queryKey");const dh=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ol=[];dh&&addEventListener("offline",()=>{Ol.forEach(t=>t())},!1);class bn extends mr{static{o(this,"SocketWithoutUpgrade")}constructor(e,r){if(super(),this.binaryType=tC,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(r=e,e=null),e){const i=fh(e);r.hostname=i.host,r.secure=i.protocol==="https"||i.protocol==="wss",r.port=i.port,i.query&&(r.query=i.query)}else r.host&&(r.hostname=fh(r.host).host);nc(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(i=>{const s=i.prototype.name;this.transports.push(s),this._transportsByName[s]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=lC(this.opts.query)),dh&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ol.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const r=Object.assign({},this.opts.query);r.EIO=c8,r.transport=e,this.id&&(r.sid=this.id);const i=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&bn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(e);r.open(),this.setTransport(r)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",bn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=e.data,this._onError(r);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let i=0;i<this.writeBuffer.length;i++){const s=this.writeBuffer[i].data;if(s&&(r+=sC(s)),i>0&&r>this._maxPayload)return this.writeBuffer.slice(0,i);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ic(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,r,i){return this._sendPacket("message",e,r,i),this}send(e,r,i){return this._sendPacket("message",e,r,i),this}_sendPacket(e,r,i,s){if(typeof r=="function"&&(s=r,r=void 0),typeof i=="function"&&(s=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const f={type:e,data:r,options:i};this.emitReserved("packetCreate",f),this.writeBuffer.push(f),s&&this.once("flush",s),this.flush()}close(){const e=o(()=>{this._onClose("forced close"),this.transport.close()},"close"),r=o(()=>{this.off("upgrade",r),this.off("upgradeError",r),e()},"cleanupAndClose"),i=o(()=>{this.once("upgrade",r),this.once("upgradeError",r)},"waitForUpgrade");return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(bn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),dh&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Ol.indexOf(this._offlineEventListener);i!==-1&&Ol.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,r),this.writeBuffer=[],this._prevBufferLen=0}}}bn.protocol=c8;class SC extends bn{static{o(this,"SocketWithUpgrade")}constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let r=this.createTransport(e),i=!1;bn.priorWebsocketSuccess=!1;const s=o(()=>{i||(r.send([{type:"ping",data:"probe"}]),r.once("packet",l=>{if(!i)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;bn.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(m(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=r.name,this.emitReserved("upgradeError",w)}}))},"onTransportOpen");function f(){i||(i=!0,m(),r.close(),r=null)}o(f,"freezeTransport");const n=o(l=>{const w=new Error("probe error: "+l);w.transport=r.name,f(),this.emitReserved("upgradeError",w)},"onerror");function v(){n("transport closed")}o(v,"onTransportClose");function b(){n("socket closed")}o(b,"onclose");function h(l){r&&l.name!==r.name&&f()}o(h,"onupgrade");const m=o(()=>{r.removeListener("open",s),r.removeListener("error",n),r.removeListener("close",v),this.off("close",b),this.off("upgrading",h)},"cleanup");r.once("open",s),r.once("error",n),r.once("close",v),this.once("close",b),this.once("upgrading",h),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||r.open()},200):r.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const r=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&r.push(e[i]);return r}}let EC=class extends SC{static{o(this,"Socket")}constructor(e,r={}){const i=typeof e=="object"?e:r;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>yC[s]).filter(s=>!!s)),super(e,i)}};function AC(t,e="",r){let i=t;r=r||typeof location<"u"&&location,t==null&&(t=r.protocol+"//"+r.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=r.protocol+t:t=r.host+t),/^(https?|wss?):\/\//.test(t)||(typeof r<"u"?t=r.protocol+"//"+t:t="https://"+t),i=fh(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const f=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+f+":"+i.port+e,i.href=i.protocol+"://"+f+(r&&r.port===i.port?"":":"+i.port),i}o(AC,"url");const kC=typeof ArrayBuffer=="function",NC=o(t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,"isView"),g8=Object.prototype.toString,CC=typeof Blob=="function"||typeof Blob<"u"&&g8.call(Blob)==="[object BlobConstructor]",RC=typeof File=="function"||typeof File<"u"&&g8.call(File)==="[object FileConstructor]";function Sp(t){return kC&&(t instanceof ArrayBuffer||NC(t))||CC&&t instanceof Blob||RC&&t instanceof File}o(Sp,"isBinary");function Tl(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,i=t.length;r<i;r++)if(Tl(t[r]))return!0;return!1}if(Sp(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Tl(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&Tl(t[r]))return!0;return!1}o(Tl,"hasBinary");function IC(t){const e=[],r=t.data,i=t;return i.data=hh(r,e),i.attachments=e.length,{packet:i,buffers:e}}o(IC,"deconstructPacket");function hh(t,e){if(!t)return t;if(Sp(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){const r=new Array(t.length);for(let i=0;i<t.length;i++)r[i]=hh(t[i],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){const r={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=hh(t[i],e));return r}return t}o(hh,"_deconstructPacket");function OC(t,e){return t.data=ph(t.data,e),delete t.attachments,t}o(OC,"reconstructPacket");function ph(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=ph(t[r],e);else if(typeof t=="object")for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=ph(t[r],e));return t}o(ph,"_reconstructPacket");const TC=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],PC=5;var Lt;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(Lt||(Lt={}));class jC{static{o(this,"Encoder")}constructor(e){this.replacer=e}encode(e){return(e.type===Lt.EVENT||e.type===Lt.ACK)&&Tl(e)?this.encodeAsBinary({type:e.type===Lt.EVENT?Lt.BINARY_EVENT:Lt.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===Lt.BINARY_EVENT||e.type===Lt.BINARY_ACK)&&(r+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(r+=e.nsp+","),e.id!=null&&(r+=e.id),e.data!=null&&(r+=JSON.stringify(e.data,this.replacer)),r}encodeAsBinary(e){const r=IC(e),i=this.encodeAsString(r.packet),s=r.buffers;return s.unshift(i),s}}function Hg(t){return Object.prototype.toString.call(t)==="[object Object]"}o(Hg,"isObject");class Ep extends mr{static{o(this,"Decoder")}constructor(e){super(),this.reviver=e}add(e){let r;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(e);const i=r.type===Lt.BINARY_EVENT;i||r.type===Lt.BINARY_ACK?(r.type=i?Lt.EVENT:Lt.ACK,this.reconstructor=new LC(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(Sp(e)||e.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let r=0;const i={type:Number(e.charAt(0))};if(Lt[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===Lt.BINARY_EVENT||i.type===Lt.BINARY_ACK){const f=r+1;for(;e.charAt(++r)!=="-"&&r!=e.length;);const n=e.substring(f,r);if(n!=Number(n)||e.charAt(r)!=="-")throw new Error("Illegal attachments");i.attachments=Number(n)}if(e.charAt(r+1)==="/"){const f=r+1;for(;++r&&!(e.charAt(r)===","||r===e.length););i.nsp=e.substring(f,r)}else i.nsp="/";const s=e.charAt(r+1);if(s!==""&&Number(s)==s){const f=r+1;for(;++r;){const n=e.charAt(r);if(n==null||Number(n)!=n){--r;break}if(r===e.length)break}i.id=Number(e.substring(f,r+1))}if(e.charAt(++r)){const f=this.tryParse(e.substr(r));if(Ep.isPayloadValid(i.type,f))i.data=f;else throw new Error("invalid payload")}return i}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,r){switch(e){case Lt.CONNECT:return Hg(r);case Lt.DISCONNECT:return r===void 0;case Lt.CONNECT_ERROR:return typeof r=="string"||Hg(r);case Lt.EVENT:case Lt.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&TC.indexOf(r[0])===-1);case Lt.ACK:case Lt.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class LC{static{o(this,"BinaryReconstructor")}constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const r=OC(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const DC=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Ep,Encoder:jC,get PacketType(){return Lt},protocol:PC},Symbol.toStringTag,{value:"Module"}));function ri(t,e,r){return t.on(e,r),o(function(){t.off(e,r)},"subDestroy")}o(ri,"on");const BC=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class v8 extends mr{static{o(this,"Socket")}constructor(e,r,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=r,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ri(e,"open",this.onopen.bind(this)),ri(e,"packet",this.onpacket.bind(this)),ri(e,"error",this.onerror.bind(this)),ri(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...r){var i,s,f;if(BC.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(r.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const n={type:Lt.EVENT,data:r};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const m=this.ids++,l=r.pop();this._registerAckCallback(m,l),n.id=m}const v=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,b=this.connected&&!(!((f=this.io.engine)===null||f===void 0)&&f._hasPingExpired());return this.flags.volatile&&!v||(b?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,r){var i;const s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[e]=r;return}const f=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let v=0;v<this.sendBuffer.length;v++)this.sendBuffer[v].id===e&&this.sendBuffer.splice(v,1);r.call(this,new Error("operation has timed out"))},s),n=o((...v)=>{this.io.clearTimeoutFn(f),r.apply(this,v)},"fn");n.withError=!0,this.acks[e]=n}emitWithAck(e,...r){return new Promise((i,s)=>{const f=o((n,v)=>n?s(n):i(v),"fn");f.withError=!0,r.push(f),this.emit(e,...r)})}_addToQueue(e){let r;typeof e[e.length-1]=="function"&&(r=e.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...f)=>i!==this._queue[0]?void 0:(s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(s)):(this._queue.shift(),r&&r(null,...f)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!e||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Lt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){const i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Lt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Lt.EVENT:case Lt.BINARY_EVENT:this.onevent(e);break;case Lt.ACK:case Lt.BINARY_ACK:this.onack(e);break;case Lt.DISCONNECT:this.ondisconnect();break;case Lt.CONNECT_ERROR:this.destroy();const i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){const r=e.data||[];e.id!=null&&r.push(this.ack(e.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const i of r)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const r=this;let i=!1;return function(...s){i||(i=!0,r.packet({type:Lt.ACK,id:e,data:s}))}}onack(e){const r=this.acks[e.id];typeof r=="function"&&(delete this.acks[e.id],r.withError&&e.data.unshift(null),r.apply(this,e.data))}onconnect(e,r){this.id=e,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Lt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const r=this._anyListeners;for(let i=0;i<r.length;i++)if(e===r[i])return r.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const r=this._anyOutgoingListeners;for(let i=0;i<r.length;i++)if(e===r[i])return r.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const i of r)i.apply(this,e.data)}}}function ta(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}o(ta,"Backoff");ta.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-r:t+r}return Math.min(t,this.max)|0};ta.prototype.reset=function(){this.attempts=0};ta.prototype.setMin=function(t){this.ms=t};ta.prototype.setMax=function(t){this.max=t};ta.prototype.setJitter=function(t){this.jitter=t};class mh extends mr{static{o(this,"Manager")}constructor(e,r){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(r=e,e=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,nc(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((i=r.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new ta({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=e;const s=r.parser||DC;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var r;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(r=this.backoff)===null||r===void 0||r.setMin(e),this)}randomizationFactor(e){var r;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(r=this.backoff)===null||r===void 0||r.setJitter(e),this)}reconnectionDelayMax(e){var r;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(r=this.backoff)===null||r===void 0||r.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new EC(this.uri,this.opts);const r=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const s=ri(r,"open",function(){i.onopen(),e&&e()}),f=o(v=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",v),e?e(v):this.maybeReconnectOnOpen()},"onError"),n=ri(r,"error",f);if(this._timeout!==!1){const v=this._timeout,b=this.setTimeoutFn(()=>{s(),f(new Error("timeout")),r.close()},v);this.opts.autoUnref&&b.unref(),this.subs.push(()=>{this.clearTimeoutFn(b)})}return this.subs.push(s),this.subs.push(n),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ri(e,"ping",this.onping.bind(this)),ri(e,"data",this.ondata.bind(this)),ri(e,"error",this.onerror.bind(this)),ri(e,"close",this.onclose.bind(this)),ri(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(r){this.onclose("parse error",r)}}ondecoded(e){ic(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,r){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new v8(this,e,r),this.nsps[e]=i),i}_destroy(e){const r=Object.keys(this.nsps);for(const i of r)if(this.nsps[i].active)return;this._close()}_packet(e){const r=this.encoder.encode(e);for(let i=0;i<r.length;i++)this.engine.write(r[i],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,r){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},r);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ra={};function Pl(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const r=AC(t,e.path||"/socket.io"),i=r.source,s=r.id,f=r.path,n=Ra[s]&&f in Ra[s].nsps,v=e.forceNew||e["force new connection"]||e.multiplex===!1||n;let b;return v?b=new mh(i,e):(Ra[s]||(Ra[s]=new mh(i,e)),b=Ra[s]),r.query&&!e.query&&(e.query=r.queryKey),b.socket(r.path,e)}o(Pl,"lookup");Object.assign(Pl,{Manager:mh,Socket:v8,io:Pl,connect:Pl});class zC{static{o(this,"EventAdapter")}events={};constructor(){this.events.messageBroadcast=Gi.Evt.create(),this.events.messageComplete=Gi.Evt.create(),this.events.controlMessage=Gi.Evt.create(),this.events.messageDeleted=Gi.Evt.create(),this.events.channelCleared=Gi.Evt.create(),this.events.channelDeleted=Gi.Evt.create(),this.events.logStream=Gi.Evt.create()}on(e,r){return this.events[e]||(this.events[e]=Gi.Evt.create()),this.events[e].attach(r),this}off(e,r){if(this.events[e]){const i=this.events[e].getHandlers();for(const s of i)s.callback===r&&s.detach()}return this}emit(e,...r){return this.events[e]&&this.events[e].post(r.length===1?r[0]:r),this}once(e,r){return this.events[e]||(this.events[e]=Gi.Evt.create()),this.events[e].attachOnce(r),this}listenerCount(e){return this.events[e]?this.events[e].getHandlers().length:0}_getEvt(e){return this.events[e]}}class Kr extends zC{static{o(this,"SocketIOManager")}static instance=null;socket=null;isConnected=!1;connectPromise=null;resolveConnect=null;activeChannelIds=new Set;clientEntityId=null;logStreamSubscribed=!1;get evtMessageBroadcast(){return this._getEvt("messageBroadcast")}get evtMessageComplete(){return this._getEvt("messageComplete")}get evtControlMessage(){return this._getEvt("controlMessage")}get evtMessageDeleted(){return this._getEvt("messageDeleted")}get evtChannelCleared(){return this._getEvt("channelCleared")}get evtChannelDeleted(){return this._getEvt("channelDeleted")}get evtLogStream(){return this._getEvt("logStream")}constructor(){super()}static getInstance(){return Kr.instance||(Kr.instance=new Kr),Kr.instance}static isConnected(){return Kr.instance?.isConnected||!1}isChannelActive(e){return this.activeChannelIds.has(e)}initialize(e){if(this.clientEntityId=e,this.socket){Ge.debug("[SocketIO] Socket already initialized");return}const r=window.location.origin+"/";Ge.info("connecting to",r),this.socket=Pl(r,{autoConnect:!0,reconnection:!0}),this.connectPromise=new Promise(i=>{this.resolveConnect=i}),this.socket.on("connect",()=>{Ge.info("[SocketIO] Connected to server"),this.isConnected=!0,this.resolveConnect?.(),this.emit("connect")}),this.socket.on("unauthorized",i=>{this.emit("unauthorized",i)}),this.socket.on("messageBroadcast",i=>{const s=typeof i=="string"?(()=>{try{return JSON.parse(i)}catch{return Ge.warn("[SocketIO] Failed to parse string messageBroadcast payload:",i),{}}})():i;Ge.info("[SocketIO] Message broadcast received:",s);const f=s&&typeof s=="object",n=f?Object.keys(s):[];Ge.debug("[SocketIO] Message broadcast data structure:",{keys:n,senderId:s.senderId,senderNameType:typeof s.senderName,textType:typeof s.text,textLength:s.text?s.text.length:0,hasThought:f&&"thought"in s,hasActions:f&&"actions"in s,additionalKeys:n.filter(b=>!["senderId","senderName","text","roomId","createdAt","source","thought","actions"].includes(b))});const v=s.channelId||s.roomId;v&&this.activeChannelIds.has(v)?(Ge.info(`[SocketIO] Handling message for active channel ${v}`),this.emit("messageBroadcast",{...s,channelId:v,roomId:v,name:s.senderName})):Ge.warn(`[SocketIO] Received message for inactive channel ${v}, active channels:`,Array.from(this.activeChannelIds))}),this.socket.on("messageComplete",i=>{this.emit("messageComplete",i)}),this.socket.on("controlMessage",i=>{Ge.info("[SocketIO] Control message received:",i);const s=i.channelId||i.roomId;s&&this.activeChannelIds.has(s)?(Ge.info(`[SocketIO] Handling control message for active channel ${s}`),this.emit("controlMessage",{...i,channelId:s,roomId:s})):Ge.warn(`[SocketIO] Received control message for inactive channel ${s}, active channels:`,Array.from(this.activeChannelIds))}),this.socket.on("messageDeleted",i=>{Ge.debug("[SocketIO] Message deleted event received:",i);const s=i.channelId||i.roomId;s&&this.activeChannelIds.has(s)?(Ge.info(`[SocketIO] Handling message deletion for active channel ${s}`),this.emit("messageDeleted",{...i,channelId:s,roomId:s})):Ge.warn(`[SocketIO] Received message deleted event for inactive channel ${s}, active channels:`,Array.from(this.activeChannelIds))}),this.socket.on("channelCleared",i=>{Ge.info("[SocketIO] Channel cleared event received:",i);const s=i.channelId||i.roomId;s&&this.activeChannelIds.has(s)?(Ge.info(`[SocketIO] Handling channel cleared for active channel ${s}`),this.emit("channelCleared",{...i,channelId:s,roomId:s})):Ge.warn(`[SocketIO] Received channel cleared event for inactive channel ${s}, active channels:`,Array.from(this.activeChannelIds))}),this.socket.on("channelDeleted",i=>{Ge.info("[SocketIO] Channel deleted event received:",i);const s=i.channelId||i.roomId;s&&this.activeChannelIds.has(s)?(Ge.info(`[SocketIO] Handling channel deleted for active channel ${s}`),this.emit("channelDeleted",{...i,channelId:s,roomId:s})):Ge.warn(`[SocketIO] Received channel deleted event for inactive channel ${s}, active channels:`,Array.from(this.activeChannelIds))}),this.socket.on("disconnect",i=>{Ge.info(`[SocketIO] Disconnected. Reason: ${i}`),this.isConnected=!1,this.emit("disconnect",i),this.connectPromise=new Promise(s=>{this.resolveConnect=s}),i==="io server disconnect"&&this.socket?.connect()}),this.socket.on("reconnect_attempt",i=>{Ge.info("[SocketIO] Reconnect attempt",i),this.emit("reconnect_attempt",i)}),this.socket.on("reconnect",i=>{Ge.info(`[SocketIO] Reconnected after ${i} attempts`),this.emit("reconnect",i)}),this.socket.on("connect_error",i=>{Ge.error("[SocketIO] Connection error:",i),this.emit("connect_error",i)}),this.socket.on("log_stream",i=>{Ge.debug("[SocketIO] Log stream data received:",i),i.type==="log_entry"&&i.payload&&this.emit("logStream",i.payload)}),this.socket.on("log_subscription_confirmed",i=>{Ge.info("[SocketIO] Log subscription confirmed:",i),this.logStreamSubscribed=i.subscribed})}async joinChannel(e){if(!this.socket){Ge.error("[SocketIO] Cannot join channel: socket not initialized");return}this.isConnected||await this.connectPromise,Ge.info(`[SocketIO] joinChannel: Attempting to join ${e}. Current activeChannelIds before add:`,new Set(this.activeChannelIds)),this.activeChannelIds.add(e),Ge.info(`[SocketIO] joinChannel: Joined ${e}. Current activeChannelIds after add:`,new Set(this.activeChannelIds)),this.socket.emit("message",{type:Zd.ROOM_JOINING,payload:{channelId:e,roomId:e,entityId:this.clientEntityId}}),Ge.info(`[SocketIO] Emitted ROOM_JOINING for ${e}`)}async joinRoom(e){return this.joinChannel(e)}leaveChannel(e){if(!this.socket||!this.isConnected){Ge.warn(`[SocketIO] Cannot leave channel ${e}: not connected`);return}Ge.info(`[SocketIO] leaveChannel: Attempting to leave ${e}. Current activeChannelIds before delete:`,new Set(this.activeChannelIds)),this.activeChannelIds.delete(e),Ge.info(`[SocketIO] leaveChannel: Left ${e}. Current activeChannelIds after delete:`,new Set(this.activeChannelIds))}leaveRoom(e){return this.leaveChannel(e)}async sendMessage(e,r,i,s,f,n,v){if(!this.socket){Ge.error("[SocketIO] Cannot send message: socket not initialized");return}this.isConnected||await this.connectPromise;const b=n||en();Ge.info(`[SocketIO] Sending message to central channel ${r} on server ${i}`),this.socket.emit("message",{type:Zd.SEND_MESSAGE,payload:{senderId:this.clientEntityId,senderName:Ns,message:e,channelId:r,roomId:r,serverId:i,messageId:b,source:s,attachments:f,metadata:v}})}async subscribeToLogStream(){if(!this.socket){Ge.error("[SocketIO] Cannot subscribe to logs: socket not initialized");return}this.isConnected||await this.connectPromise,this.socket.emit("subscribe_logs"),Ge.info("[SocketIO] Subscribed to log stream")}async unsubscribeFromLogStream(){if(!this.socket){Ge.error("[SocketIO] Cannot unsubscribe from logs: socket not initialized");return}this.isConnected||await this.connectPromise,this.socket.emit("unsubscribe_logs"),Ge.info("[SocketIO] Unsubscribed from log stream")}async updateLogStreamFilters(e){if(!this.socket){Ge.error("[SocketIO] Cannot update log filters: socket not initialized");return}this.isConnected||await this.connectPromise,this.socket.emit("update_log_filters",e),Ge.info("[SocketIO] Updated log stream filters:",e)}isLogStreamSubscribed(){return this.logStreamSubscribed}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.activeChannelIds.clear(),this.logStreamSubscribed=!1,Ge.info("[SocketIO] Disconnected from server"))}}const fn={setUnauthorized:o(t=>{console.warn("setUnauthorized called before ConnectionContext is ready",t)},"setUnauthorized"),setOfflineStatus:o(t=>{console.warn("setOfflineStatus called before ConnectionContext is ready",t)},"setOfflineStatus")},b8=V.createContext(void 0),FC=o(({children:t})=>{const{toast:e}=Wt(),[r,i]=V.useState("loading"),[s,f]=V.useState(null),n=V.useRef(!0),v=Kr.getInstance(),b=V.useCallback(l=>{i("unauthorized"),f(l),e({title:"Authorization Required",description:l||"Please provide a valid API Key.",variant:"destructive"})},[e]),h=V.useCallback(l=>{l?r!=="error"&&r!=="unauthorized"&&(i("error"),f("Network connection appears to be offline."),e({title:"Network Offline",description:"Please check your internet connection.",variant:"destructive"})):r==="error"&&s?.includes("offline")},[r,s,e]),m=V.useCallback(l=>{try{l!==void 0&&$k(l),console.log("API client refreshed with new configuration")}catch(w){console.error("Failed to refresh API client:",w)}},[]);return V.useEffect(()=>{fn.setUnauthorized=b,fn.setOfflineStatus=h},[b,h]),V.useEffect(()=>{const l=o(()=>{i("connected"),f(null),fn.setOfflineStatus&&fn.setOfflineStatus(!1),n.current?n.current=!1:e({title:"Connection Restored",description:"Successfully reconnected to the Eliza server."})},"onConnect"),w=o(E=>{i("error"),f(`Connection lost: ${E}`),fn.setOfflineStatus&&fn.setOfflineStatus(!0),e({title:"Connection Lost",description:"Attempting to reconnect to the Eliza server…",variant:"destructive"})},"onDisconnect"),p=o(()=>{i("reconnecting"),f("Reconnecting...")},"onReconnectAttempt"),y=o(E=>{i("error"),f(E.message),fn.setOfflineStatus&&fn.setOfflineStatus(!0)},"onConnectError"),M=o(E=>{i("unauthorized"),f(`Unauthorized: ${E}`),e({title:"Unauthorized",description:"Please log in again.",variant:"destructive"})},"onUnauthorized");return v.on("connect",l),v.on("disconnect",w),v.on("reconnect",l),v.on("reconnect_attempt",p),v.on("connect_error",y),v.on("unauthorized",M),Kr.isConnected()&&l(),()=>{v.off("connect",l),v.off("disconnect",w),v.off("reconnect",l),v.off("reconnect_attempt",p),v.off("connect_error",y),v.off("unauthorized",M)}},[e,v,h]),k.jsx(b8.Provider,{value:{status:r,error:s,setUnauthorizedFromApi:b,setOfflineStatusFromProvider:h,refreshApiClient:m},children:t})},"ConnectionProvider"),Ap=o(()=>{const t=V.useContext(b8);if(!t)throw new Error("useConnection must be inside ConnectionProvider");return t},"useConnection");function UC(){const{toast:t}=Wt(),[e,r]=V.useState(null),{openApiKeyDialog:i}=pN(),{status:s,error:f}=Ap(),n=s==="loading",v=s==="connected",b=s==="error",h=s==="unauthorized",m=b||h;V.useEffect(()=>{(e==="error"||e==="unauthorized"||e==="disconnected")&&v?t({title:"Connection Restored",description:k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(jv,{className:"h-4 w-4 text-green-500"}),k.jsx("span",{children:"Successfully reconnected to the Eliza server."})]})}):e==="connected"&&(b||h)&&t({title:"Connection Lost",description:"Attempting to reconnect to the Eliza server...",variant:"destructive"}),r(s)},[s,e,v,b,h,t]),V.useEffect(()=>{h&&e!=="unauthorized"&&i()},[h,e,i]);const l=o(()=>h?"bg-yellow-500":n?"bg-muted-foreground":v?"bg-green-600":"bg-red-600","getStatusColor"),w=o(()=>h?"Unauthorized":n?"Connecting...":v?"Connected":"Disconnected","getStatusText"),p=o(()=>h?"text-yellow-500":n?"text-muted-foreground":v?"text-green-600":"text-red-600","getTextColor"),y=o(()=>f?h?"Unauthorized: Invalid or missing API Key. Check client configuration or server logs.":f.includes("NetworkError")||f.includes("Failed to fetch")?"Cannot reach server":f.includes("ECONNREFUSED")?"Connection refused":f.includes("timeout")?"Connection timeout":f.includes("404")||f.includes("not found")||f.includes("API endpoint not found")?"Endpoint not found":f:"Connection failed","getErrorMessage");return k.jsx(ui,{"data-testid":"connection-status",children:k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx(as,{className:"rounded",children:k.jsx("div",{className:"flex flex-col gap-1 select-none",children:k.jsxs("div",{className:"flex items-center gap-1",children:[m||h?k.jsx(Xr,{className:He("h-3.5 w-3.5",h?"text-yellow-500":"text-red-600")}):k.jsx("div",{className:He(["h-2.5 w-2.5 rounded-full",l()])}),k.jsx("span",{className:He("text-xs",p()),children:w()})]})})})}),m&&k.jsx(or,{side:"top",align:"center",className:"max-w-xs",children:k.jsxs("div",{className:"flex flex-col gap-2",children:[k.jsx("div",{className:He("font-semibold",h?"text-yellow-500":"text-red-500"),children:y()}),k.jsx("p",{className:"text-xs",children:"Please ensure the Eliza server is running and accessible."}),!h&&k.jsx("p",{className:"text-xs",children:"Try refreshing the connection or check server logs."}),h&&k.jsx("p",{className:"text-xs",children:"Check the X-API-KEY configured in your client or the ELIZA_SERVER_AUTH_TOKEN on the server."})]})})]})})}o(UC,"ConnectionStatus");const Cn=V.forwardRef(({className:t,...e},r)=>k.jsx(Lv,{ref:r,className:He("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-md",t),"data-testid":e["data-testid"]||"avatar",...e}));Cn.displayName=Lv.displayName;const ps=V.forwardRef(({className:t,...e},r)=>k.jsx(Dv,{ref:r,className:He("aspect-square h-full w-full object-cover",t),"data-testid":e["data-testid"]||"avatar-image",...e}));ps.displayName=Dv.displayName;const sc=V.forwardRef(({className:t,...e},r)=>k.jsx(Bv,{ref:r,className:He("flex h-full w-full items-center justify-center rounded-md bg-muted",t),"data-testid":e["data-testid"]||"avatar-fallback",...e}));sc.displayName=Bv.displayName;function gs(){const[t,e]=V.useState({open:!1,options:null,onConfirm:null}),r=V.useCallback((f,n)=>{e({open:!0,options:f,onConfirm:n})},[]),i=V.useCallback(f=>{f||e({open:!1,options:null,onConfirm:null})},[]),s=V.useCallback(()=>{t.onConfirm&&t.onConfirm(),i(!1)},[t.onConfirm,i]);return{confirm:r,isOpen:t.open,onOpenChange:i,onConfirm:s,options:t.options}}o(gs,"useConfirmation");function HC(t){switch(t){case"active":return pr.ACTIVE;case"inactive":case"stopped":return pr.INACTIVE;default:return pr.INACTIVE}}o(HC,"mapApiStatusToEnum");function y8(t){return{...t,id:t.id,status:HC(t.status),createdAt:t.createdAt instanceof Date?t.createdAt.getTime():new Date(t.createdAt).getTime(),updatedAt:t.updatedAt instanceof Date?t.updatedAt.getTime():new Date(t.updatedAt).getTime()}}o(y8,"mapApiAgentToClient");function lu(t){return t instanceof Date?t.getTime():typeof t=="string"?new Date(t).getTime():t}o(lu,"apiDateToTimestamp");function uu(t){return t instanceof Date?t.toISOString():t}o(uu,"apiDateToString");function kp(t){return{...t,id:t.id,messageServerId:t.messageServerId,type:t.type,createdAt:uu(t.createdAt),updatedAt:uu(t.updatedAt)}}o(kp,"mapApiChannelToClient");function VC(t){return{...t,id:t.id,createdAt:uu(t.createdAt),updatedAt:uu(t.updatedAt)}}o(VC,"mapApiServerToClient");function ZC(t){return t.map(VC)}o(ZC,"mapApiServersToClient");function GC(t){return t.map(kp)}o(GC,"mapApiChannelsToClient");function YC(t,e){const r=t.metadata?.attachments?.map(f=>({id:f.id||crypto.randomUUID(),url:f.url,title:f.title||f.name,source:f.source,description:f.description,text:f.text,contentType:f.contentType||f.type}))||void 0,i=t.sourceType,s=t.rawMessage;return{id:t.id,text:t.content,name:t.metadata?.authorDisplayName||t.metadata?.agentName||"Unknown",senderId:t.authorId,isAgent:!!t.metadata?.isAgent||!1,createdAt:lu(t.createdAt),channelId:t.channelId,serverId:e||t.metadata?.serverId,prompt:t.metadata?.prompt,attachments:r,thought:t.metadata?.thought,actions:t.metadata?.actions,type:i,rawMessage:s}}o(YC,"mapApiMessageToUi");function QC(t){return{id:t.id,type:t?.type||t.body?.modelType,timestamp:t.timestamp?lu(t.timestamp):void 0,message:t.message,details:t.details,roomId:t.roomId,body:t.body,createdAt:t.createdAt?lu(t.createdAt):void 0}}o(QC,"mapApiLogToClient");function KC(t){return{id:t.id,entityId:t.metadata?.entityId||t.metadata?.userId||t.agentId,agentId:t.agentId,content:t.content,embedding:t.embedding,roomId:t.roomId,createdAt:lu(t.createdAt),unique:t.metadata?.unique}}o(KC,"mapApiMemoryToClient");const gr=Xt(),tr={FREQUENT:3e4,STANDARD:12e4,RARE:6e5,NEVER:Number.POSITIVE_INFINITY},Tn=o(()=>{const t=typeof navigator<"u"&&"connection"in navigator?navigator.connection:null;return{isOffline:typeof navigator<"u"&&!navigator.onLine,effectiveType:t?.effectiveType||"unknown",saveData:t?.saveData||!1}},"useNetworkStatus");function Np(t={}){const e=Tn();return Sr({queryKey:["agents"],queryFn:o(async()=>({data:{agents:(await gr.agents.listAgents()).agents.map(s=>y8(s))}}),"queryFn"),staleTime:tr.FREQUENT,refetchInterval:e.isOffline?!1:tr.FREQUENT,refetchIntervalInBackground:!1,...!e.isOffline&&e.effectiveType==="slow-2g"&&{refetchInterval:tr.STANDARD},...t})}o(Np,"useAgents");function Go(t,e={}){const r=Tn();return Sr({queryKey:["agent",t],queryFn:o(async()=>{if(!t)throw new Error("Agent ID is required");const i=await gr.agents.getAgent(t);return{data:y8(i)}},"queryFn"),staleTime:tr.FREQUENT,enabled:!!t,refetchInterval:!r.isOffline&&t?tr.FREQUENT:!1,refetchIntervalInBackground:!1,...!r.isOffline&&r.effectiveType==="slow-2g"&&{refetchInterval:tr.STANDARD},...e})}o(Go,"useAgent");function XC(){const t=br(),{toast:e}=Wt();return Fr({mutationFn:o(async r=>{try{const i=await gr.agents.startAgent(r);return{data:{id:r,name:"Agent",status:i.status}}}catch(i){throw i instanceof Error&&i.message.includes("already running")?new Error("Agent is already running."):i}},"mutationFn"),onMutate:o(async r=>(e({title:"Starting Agent",description:"Initializing agent..."}),{}),"onMutate"),onSuccess:o((r,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),e({title:"Agent Started",description:`${r?.data?.name||"Agent"} is now running`})},"onSuccess"),onError:o(r=>{const i=r instanceof Error?r.message:"Failed to start agent";e({title:"Error Starting Agent",description:`${i}. Please try again.`,variant:"destructive"})},"onError")})}o(XC,"useStartAgent");function WC(){const t=br(),{toast:e}=Wt();return Fr({mutationFn:o(async r=>({data:{message:`Agent ${(await gr.agents.stopAgent(r)).status}`}}),"mutationFn"),onMutate:o(async r=>{const i=t.getQueryData(["agent",r]);i&&e({title:"Stopping Agent",description:`Stopping ${i.name}...`})},"onMutate"),onSuccess:o((r,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),e({title:"Agent Stopped",description:r?.data?.message||"The agent has been successfully stopped"})},"onSuccess"),onError:o((r,i)=>{t.invalidateQueries({queryKey:["agents"]}),t.invalidateQueries({queryKey:["agent",i]}),e({title:"Error",description:r instanceof Error?r.message:"Failed to stop agent",variant:"destructive"})},"onError")})}o(WC,"useStopAgent");function Vg(t,e){const r=ss(),[i,s]=V.useState([]),[f,n]=V.useState(null),[v,b]=V.useState(!0),[h,m]=V.useState(!0),[l,w]=V.useState(!1),[p,y]=V.useState(null),[M,E]=V.useState(!1),R=V.useCallback((Z,ne)=>{const F=Z.authorId!==r;let Y=Date.now();if(typeof Z.createdAt=="number")Y=Z.createdAt;else if(typeof Z.createdAt=="string"){const a=Date.parse(Z.createdAt);isNaN(a)?Ge.warn("[transformServerMessageToUiMessage] createdAt string was not directly parsable by Date.parse():",Z.createdAt,"for message id:",Z.id):Y=a}else if(Z.createdAt)try{const a=new Date(Z.createdAt).getTime();isNaN(a)||(Y=a)}catch{Ge.warn("[transformServerMessageToUiMessage] Could not process createdAt (unknown type):",Z.createdAt,"for message:",Z.id)}return{id:Z.id,text:Z.content,name:F?Z.metadata?.agentName||Z.metadata?.authorDisplayName||Z.authorDisplayName||"Agent":Ns,senderId:Z.authorId,isAgent:F,createdAt:Y,attachments:Z.metadata?.attachments,thought:F?Z.metadata?.thought:void 0,actions:F?Z.metadata?.actions:void 0,channelId:Z.channelId,serverId:ne||Z.metadata?.serverId||Z.serverId||e,source:Z.sourceType,isLoading:!1,prompt:F?Z.metadata?.prompt:void 0}},[r,e]),I=V.useCallback(async Z=>{if(!t){s([]),m(!1);return}Z?E(!0):m(!0),w(!1),y(null);try{const F=(await gr.messaging.getChannelMessages(t,{limit:30,before:Z?new Date(Z).toISOString():void 0})).messages.map(Y=>YC(Y,e||Y.metadata?.serverId));if(s(Y=>{const a=Z?[...F,...Y]:F;return Array.from(new Map(a.map(u=>[u.id,u])).values()).sort((u,d)=>u.createdAt-d.createdAt)}),F.length>0){const Y=Math.min(...F.map(a=>a.createdAt));(!Z||Y<(f||1/0))&&n(Y)}b(F.length>=30)}catch(ne){w(!0),y(ne),Ge.error(`Failed to fetch messages for channel ${t}:`,ne)}finally{m(!1),E(!1)}},[t,R,e]);V.useEffect(()=>{t?(Ge.info(`[useChannelMessages] ChannelId changed or became available: ${t}. Clearing messages and fetching initial set.`),s([]),n(null),b(!0),I()):(Ge.info("[useChannelMessages] ChannelId is undefined. Clearing messages."),s([]),n(null),b(!0),m(!1))},[t,I]);const T=o(async()=>{v&&!M&&f&&await I(f-1)},"fetchNextPage"),P=V.useCallback(Z=>{s(ne=>{const F=ne.findIndex(Y=>Y.id===Z.id);if(F>=0){const Y=[...ne];return Y[F]=Z,Y.sort((a,g)=>a.createdAt-g.createdAt)}else return[...ne,Z].sort((Y,a)=>Y.createdAt-a.createdAt)})},[]),j=V.useCallback((Z,ne)=>{s(F=>F.map(Y=>Y.id===Z?{...Y,...ne}:Y))},[]),L=V.useCallback(Z=>{s(ne=>ne.filter(F=>F.id!==Z))},[]),U=V.useCallback(()=>{s([]),n(null),b(!0)},[]);return{data:i,isLoading:h&&i.length===0,isError:l,error:p,fetchNextPage:T,hasNextPage:v,isFetchingNextPage:M,addMessage:P,updateMessage:j,removeMessage:L,clearMessages:U}}o(Vg,"useChannelMessages");function $C(t,e,r){return Sr({queryKey:["agentActions",t,e,r],queryFn:o(async()=>{const i=await gr.agents.getAgentLogs(t,{limit:50});return i?i.map(QC):[]},"queryFn"),refetchInterval:1e3,staleTime:1e3})}o($C,"useAgentActions");function JC(){const t=br(),{toast:e}=Wt();return Fr({mutationFn:o(async({agentId:r,logId:i})=>(await gr.agents.deleteAgentLog(r,i),{agentId:r,logId:i}),"mutationFn"),onMutate:o(async({agentId:r,logId:i})=>{const s=t.getQueryData(["agentActions",r]);return s&&t.setQueryData(["agentActions",r],f=>f.filter(n=>n.id!==i)),{previousLogs:s,agentId:r,logId:i}},"onMutate"),onSuccess:o((r,{agentId:i})=>{t.invalidateQueries({queryKey:["agentActions",i]}),e({title:"Log Deleted",description:"The log entry has been successfully removed"})},"onSuccess"),onError:o((r,{agentId:i},s)=>{s?.previousLogs&&t.setQueryData(["agentActions",i],s.previousLogs),e({title:"Error",description:r instanceof Error?r.message:"Failed to delete log",variant:"destructive"}),t.invalidateQueries({queryKey:["agentActions",i]})},"onError")})}o(JC,"useDeleteLog");function Zg(t,e,r,i=!1){return Sr({queryKey:r?["agents",t,"channels",r,"memories",e,i]:["agents",t,"memories",e,i],queryFn:o(async()=>{const f={tableName:e,includeEmbedding:i},n=r?await gr.memory.getRoomMemories(t,r,f):await gr.memory.getAgentMemories(t,f);return console.log("Agent memories result:",{agentId:t,tableName:e,includeEmbedding:i,channelId:r,result:n,dataLength:n.memories?.length,firstMemory:n.memories?.[0],hasEmbeddings:(n.memories||[]).some(b=>b.embedding?.length>0)}),(n.memories||[]).map(KC)},"queryFn"),enabled:!!(t&&e),staleTime:1e3,refetchInterval:10*1e3})}o(Zg,"useAgentMemories");function qC(){const t=br();return Fr({mutationFn:o(async({agentId:e,memoryId:r})=>(await gr.memory.deleteMemory(e,r),{agentId:e,memoryId:r}),"mutationFn"),onSuccess:o(e=>{t.invalidateQueries({queryKey:["agents",e.agentId,"memories"]}),t.invalidateQueries({queryKey:["agents",e.agentId,"rooms"],predicate:o(r=>r.queryKey.length>3&&r.queryKey[4]==="memories","predicate")})},"onSuccess")})}o(qC,"useDeleteMemory");function eR(){const t=br(),{toast:e}=Wt();return Fr({mutationFn:o(async({agentId:r,memoryId:i,memoryData:s})=>{const f=await gr.memory.updateMemory(r,i,s);return{agentId:r,memoryId:i,result:f}},"mutationFn"),onSuccess:o(r=>{t.invalidateQueries({queryKey:["agents",r.agentId,"memories"]}),r.result?.roomId?t.invalidateQueries({queryKey:["agents",r.agentId,"rooms",r.result.roomId,"memories"]}):t.invalidateQueries({queryKey:["agents",r.agentId,"rooms"],predicate:o(i=>i.queryKey.length>3&&i.queryKey[4]==="memories","predicate")}),r.result?.roomId&&t.invalidateQueries({queryKey:["messages",r.agentId,r.result.roomId]}),e({title:"Memory Updated",description:"The memory has been successfully updated"})},"onSuccess"),onError:o(r=>{e({title:"Error",description:r instanceof Error?r.message:"Failed to update memory",variant:"destructive"})},"onError")})}o(eR,"useUpdateMemory");function tR(t,e={}){const r=Tn();return Sr({queryKey:["agentPanels",t],queryFn:o(async()=>{if(!t)throw new Error("Agent ID required");return{success:!0,data:(await gr.agents.getAgentPanels(t)).panels}},"queryFn"),enabled:!!t,staleTime:tr.STANDARD,refetchInterval:!r.isOffline&&t?tr.RARE:!1,refetchIntervalInBackground:!1,...!r.isOffline&&r.effectiveType==="slow-2g"&&{refetchInterval:tr.NEVER},...e})}o(tR,"useAgentPanels");function ra(){const t=Tn(),{data:e,isLoading:r}=Np(),i=e?.data?.agents?.map(h=>h.id)||[],s=t4({queries:i.map(h=>({queryKey:["agent",h],queryFn:o(async()=>({data:await gr.agents.getAgent(h)}),"queryFn"),staleTime:tr.FREQUENT,enabled:!!h,refetchInterval:!t.isOffline&&h?tr.FREQUENT:!1,refetchIntervalInBackground:!1,...!t.isOffline&&t.effectiveType==="slow-2g"&&{refetchInterval:tr.STANDARD}}))}),f=r||s.some(h=>h.isLoading),n=s.some(h=>h.isError),v=s.find(h=>h.error)?.error;return{data:{agents:s.filter(h=>!!h.data?.data).map(h=>h.data.data)},isLoading:f,isError:n,error:v}}o(ra,"useAgentsWithDetails");function w8(t={}){const e=Tn();return Sr({queryKey:["servers"],queryFn:o(async()=>{const r=await gr.messaging.listServers();return{data:{servers:ZC(r.servers)}}},"queryFn"),staleTime:tr.RARE,refetchInterval:e.isOffline?!1:tr.RARE,...t})}o(w8,"useServers");function Cp(t,e={}){const r=Tn();return Sr({queryKey:["channels",t],queryFn:o(async()=>{if(!t)return Promise.resolve({data:{channels:[]}});const i=await gr.messaging.getServerChannels(t);return{data:{channels:GC(i.channels)}}},"queryFn"),enabled:!!t,staleTime:tr.STANDARD,refetchInterval:!r.isOffline&&t?tr.STANDARD:!1,...e})}o(Cp,"useChannels");function rR(t,e={}){const r=Tn();return Sr({queryKey:["channelDetails",t],queryFn:o(async()=>{if(!t)return Promise.resolve({success:!0,data:null});const i=await gr.messaging.getChannelDetails(t);return{success:!0,data:kp(i)}},"queryFn"),enabled:!!t,staleTime:tr.STANDARD,refetchInterval:!r.isOffline&&t?tr.RARE:!1,...e})}o(rR,"useChannelDetails");function Rp(t,e={}){const r=Tn();return Sr({queryKey:["channelParticipants",t],queryFn:o(async()=>{if(!t)return Promise.resolve({success:!0,data:[]});try{const i=await gr.messaging.getChannelParticipants(t);let s=[];return i&&Array.isArray(i.participants)?s=i.participants.map(f=>f.userId):i&&Array.isArray(i)&&(s=i.map(f=>f.userId||f.id||f)),{success:!0,data:s}}catch(i){return console.error("[useChannelParticipants] Error:",i),{success:!1,data:[]}}},"queryFn"),enabled:!!t,staleTime:tr.STANDARD,refetchInterval:!r.isOffline&&t?tr.FREQUENT:!1,...e})}o(Rp,"useChannelParticipants");function iR(){br();const{toast:t}=Wt();return Fr({mutationFn:o(async({channelId:e,messageId:r})=>(await gr.messaging.deleteMessage(e,r),{channelId:e,messageId:r}),"mutationFn"),onSuccess:o((e,r)=>{t({title:"Message Deleted",description:"Message removed successfully."})},"onSuccess"),onError:o(e=>{t({title:"Error Deleting Message",description:e instanceof Error?e.message:"Failed to delete message",variant:"destructive"})},"onError")})}o(iR,"useDeleteChannelMessage");function nR(){const t=br(),{toast:e}=Wt();return Fr({mutationFn:o(async r=>(await gr.messaging.clearChannelHistory(r),{channelId:r}),"mutationFn"),onSuccess:o((r,i)=>{e({title:"Channel Cleared",description:`All messages in channel ${i} cleared.`}),t.invalidateQueries({queryKey:["messages",i]}),t.setQueryData(["messages",i],()=>[])},"onSuccess"),onError:o(r=>{e({title:"Error Clearing Channel",description:r instanceof Error?r.message:"Failed to clear messages",variant:"destructive"})},"onError")})}o(nR,"useClearChannelMessages");function x8(){return Sr({queryKey:["server-version"],queryFn:o(async()=>{try{const t=await fetch("/api/system/version");if(!t.ok)throw new Error(`Failed to fetch server version: ${t.status} ${t.statusText}`);return await t.json()}catch(t){throw Ge.error("Error fetching server version:",t),t}},"queryFn"),staleTime:300*1e3,retry:3,retryDelay:o(t=>Math.min(1e3*2**t,3e4),"retryDelay")})}o(x8,"useServerVersion");function sR(){const{data:t}=x8();return t?.version||"0.0.0-loading"}o(sR,"useServerVersionString");const aR=o((t,e)=>{const r=[],i=[];return t.forEach(s=>(e(s)?r:i).push(s)),[r,i]},"partition"),Ip=o(({children:t,className:e=""})=>k.jsx("div",{className:He("px-4 pt-1 pb-0 text-sm font-medium text-muted-foreground sidebar-section-header",e),children:t}),"SectionHeader"),oR=o(({title:t,children:e,className:r=""})=>k.jsxs(k.Fragment,{children:[k.jsx(Ip,{className:r,children:t}),k.jsx(xu,{children:k.jsx(_u,{className:"mt-0",children:k.jsx(Wn,{children:e})})})]}),"SidebarSection"),lR=o(({agent:t,isOnline:e,active:r})=>k.jsx(ui,{children:k.jsx(vu,{to:`/chat/${t.id}`,children:k.jsxs(as,{isActive:r,className:"px-2 py-2 my-1 h-full rounded justify-between cursor-pointer",children:[k.jsx("span",{className:"text-base truncate max-w-36",children:t.name}),k.jsx("div",{className:"flex items-center",children:k.jsxs("div",{className:"relative",children:[k.jsxs(Cn,{className:"h-6 w-6 rounded-full",children:[k.jsx(ps,{src:Ga(t),alt:t.name||"avatar"}),k.jsx(sc,{className:"rounded-full",children:ns(t.name||"")})]}),k.jsx("span",{className:He("absolute bottom-0 right-0 w-[8px] h-[8px] rounded border border-white",e?"bg-green-500":"bg-muted-foreground")})]})})]})})}),"AgentRow"),uR=o(({channel:t,serverId:e,active:r})=>{const i=ss(),{data:s}=ra(),f=s?.agents||[],{data:n}=Rp(t.id),v=n?.data,b=v&&Array.isArray(v)?v:[],h=f.filter(w=>w.id&&b.includes(w.id)),m=h.slice(0,3),l=h.length>3?h.length-3:0;return k.jsx(ui,{children:k.jsx(vu,{to:`/group/${t.id}?serverId=${e}`,className:"flex-1",children:k.jsxs(as,{isActive:r,className:"px-2 py-2 my-1 h-full rounded justify-between cursor-pointer",children:[k.jsx("span",{className:"text-base truncate max-w-36",children:t.name||kh(t,t.participants||[],i)}),k.jsx("div",{className:"flex items-center gap-2",children:k.jsxs("div",{className:"flex -space-x-2",children:[m.map(w=>k.jsxs(Cn,{className:"h-6 w-6 rounded-full border border-background",children:[k.jsx(ps,{src:typeof w.settings?.avatar=="string"?w.settings.avatar:"",alt:w.name||""}),k.jsx(sc,{className:"rounded-full text-xs",children:ns(w.name||"")})]},w.id)),l>0&&k.jsxs("div",{className:"w-6 h-6 rounded-full bg-muted text-[10px] flex items-center justify-center border border-background",children:["+",l]})]})})]})})})},"GroupRow"),cR=o(({agents:t,activePath:e})=>k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex items-center px-4 pt-1 pb-0 text-muted-foreground",children:[k.jsx(Ip,{className:"px-0 py-0 text-xs flex gap-1 mr-2",children:k.jsx("div",{children:"Agents"})}),k.jsx(Gr,{})]}),k.jsx(xu,{children:k.jsx(_u,{className:"px-1 mt-0",children:k.jsx(Wn,{children:t.map(r=>k.jsx(lR,{agent:r,isOnline:r.status===pr.ACTIVE,active:e.includes(`/chat/${String(r?.id)}`)},r?.id))})})})]}),"AgentListSection"),fR=o(({servers:t,isLoadingServers:e,activePath:r})=>k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex items-center px-4 pt-1 pb-0 text-muted-foreground",children:[k.jsx(Ip,{className:"px-0 py-0 text-xs flex gap-1 mr-2",children:k.jsx("div",{children:"Groups"})}),k.jsx(Gr,{})]}),k.jsx(xu,{children:k.jsx(_u,{className:"px-1 mt-0",children:k.jsxs(Wn,{children:[e&&Array.from({length:3}).map((i,s)=>k.jsx(ui,{children:k.jsx(Mu,{})},`skel-group-${s}`)),t?.map(i=>k.jsx(dR,{serverId:i.id,activePath:r},i.id)),(!t||t.length===0)&&!e&&k.jsx(ui,{children:k.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:"No groups found."})})]})})})]}),"GroupListSection"),dR=o(({serverId:t,activePath:e})=>{const{data:r,isLoading:i}=Cp(t),s=V.useMemo(()=>r?.data?.channels?.filter(f=>f.type===vt.GROUP)||[],[r]);return i?k.jsx(ui,{children:k.jsx(Mu,{})}):s.length?k.jsx(k.Fragment,{children:s.map(f=>k.jsx(uR,{channel:f,serverId:t,active:e.includes(`/group/${f.id}`)},f.id))}):null},"GroupChannelsForServer");function Gg({refreshHomePage:t,isMobile:e=!1}){const r=gu(),i=wr(),s=br(),f=sR(),{data:n,error:v,isLoading:b}=ra(),{data:h,isLoading:m}=w8(),l=V.useMemo(()=>n?.agents||[],[n]),w=V.useMemo(()=>h?.data?.servers||[],[h]),[p,y]=V.useMemo(()=>aR(l,I=>I.status===pr.ACTIVE),[l]),M=v?"Error loading agents: NetworkError: Unable to connect to the server. Please check if the server is running.":void 0,E=o(I=>{I.preventDefault(),Ge.info("[AppSidebar] handleLogoClick triggered",{currentPath:r.pathname}),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["agentsWithDetails"]}),s.invalidateQueries({queryKey:["servers"]}),s.invalidateQueries({queryKey:["channels"]}),r.pathname==="/"?(Ge.info("[AppSidebar] Already on home page. Calling refreshHomePage()."),t()):(Ge.info('[AppSidebar] Not on home page. Navigating to "/".'),i("/"))},"handleLogoClick");function R(){const I=wr(),T=o(()=>{I("/create")},"handleCreateAgent"),P=o(()=>{I("/group/new")},"handleCreateGroup");return k.jsxs(Ka,{children:[k.jsx(Xa,{asChild:!0,children:k.jsxs($e,{variant:"ghost",className:"w-full bg-sidebar-accent hover:bg-sidebar-accent/80 h-10 rounded justify-start",children:[k.jsx(yh,{className:"w-4 h-4 bg"}),"Create New"]})}),k.jsxs(Wa,{align:"start",className:"w-full min-w-[var(--radix-dropdown-menu-trigger-width)]",children:[k.jsx(_i,{onClick:T,className:"w-full",children:"Create New Agent"}),k.jsx(_i,{onClick:P,className:"w-full",children:"Create New Group"})]})]})}return o(R,"renderCreateNewButton"),k.jsx(k.Fragment,{children:k.jsxs(cb,{className:He("bg-background border-r overflow-hidden",e?"p-3 pt-12 w-full h-full":"p-4 w-72 fixed left-0 top-0 z-40 h-screen",!e&&"hidden md:flex md:flex-col"),collapsible:"none","data-testid":"app-sidebar",children:[k.jsx(db,{children:k.jsx(Wn,{children:k.jsx(ui,{children:k.jsx(as,{size:"lg",asChild:!0,children:k.jsx("a",{href:"/",onClick:E,className:"px-4 py-2 h-full sidebar-logo no-underline cursor-pointer",children:k.jsxs("div",{className:"flex flex-col pt-2 gap-1 items-start justify-center",children:[k.jsx("img",{alt:"elizaos-logo",src:"/elizaos-logo-light.png",className:"w-32 max-w-full"}),k.jsxs("span",{className:"text-xs font-mono text-muted-foreground",children:["v",f]})]})})})})})}),k.jsxs(pb,{className:"flex-1 overflow-y-auto",children:[M&&k.jsx("div",{className:"px-4 py-2 text-xs text-red-500",children:M}),k.jsx(Wn,{className:"my-2",children:k.jsx(ui,{className:"list-none",children:R()})}),k.jsxs("div",{className:"pt-2",children:[b&&!M&&k.jsx(oR,{title:"Agents",children:k.jsx(Mu,{})}),!b&&!M&&k.jsxs(k.Fragment,{children:[k.jsx(cR,{agents:[...p,...y],activePath:r.pathname}),k.jsx(fR,{servers:w,isLoadingServers:m,activePath:r.pathname})]})]})]}),k.jsx(hb,{className:"px-2 py-4",children:k.jsxs(Wn,{children:[k.jsx(bf,{to:"https://eliza.how/",Icon:r4,label:"Documentation"}),k.jsx(bf,{to:"/logs",Icon:i4,label:"Logs"}),k.jsx(bf,{to:"/settings",Icon:n4,label:"Settings"}),k.jsx(UC,{})]})})]})})}o(Gg,"AppSidebar");const bf=o(({to:t,Icon:e,label:r})=>t.startsWith("http://")||t.startsWith("https://")?k.jsx(ui,{children:k.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:k.jsxs(as,{className:"rounded cursor-pointer",children:[k.jsx(e,{className:"h-4 w-4 mr-3"}),r]})})}):k.jsx(ui,{children:k.jsx(vu,{to:t,children:k.jsxs(as,{className:"rounded cursor-pointer",children:[k.jsx(e,{className:"h-4 w-4 mr-3"}),r]})})}),"FooterLink");function hR({className:t}){const{status:e,error:r}=Ap();if(!(e==="error"||e==="unauthorized"))return null;let s="Connection Failed",f="Please ensure the Eliza server is running and accessible.";const n=e==="unauthorized";if(r){const v=r;n?(s="Unauthorized",f="Invalid or missing API Key provided."):v.includes("NetworkError")||v.includes("Failed to fetch")?(s="Network Error",f="Cannot reach the server. Please check your network connection."):v.includes("ECONNREFUSED")?(s="Connection Refused",f="The server refused the connection. Please ensure it is running."):v.includes("timeout")?(s="Connection Timeout",f="The server took too long to respond."):v.includes("404")||v.includes("not found")||v.includes("API endpoint not found")||v.includes("Endpoint not found")?(s="Endpoint Not Found",f="The server API endpoint could not be found."):f=v}return k.jsx("div",{className:He("bg-opacity-10 border rounded-md p-3 mb-4 w-full md:max-w-4xl","flex items-center justify-between w-full mt-4",n?"bg-yellow-900/20 border-yellow-700 text-yellow-100":"bg-red-900/20 border-red-700 text-red-100",t),children:k.jsxs("div",{className:"flex items-center space-x-3",children:[k.jsx(Xr,{className:He("h-5 w-5 flex-shrink-0",n?"text-yellow-400":"text-red-400")}),k.jsxs("div",{children:[k.jsx("h4",{className:He("font-medium text-sm",n?"text-yellow-200":"text-red-200"),children:s}),k.jsx("p",{className:He("text-xs mt-1",n?"text-yellow-300":"text-red-300"),children:f}),k.jsx("div",{className:"mt-2 flex space-x-4",children:k.jsxs("a",{href:"https://eliza.how",target:"_blank",rel:"noopener noreferrer",className:He("text-xs flex items-center",n?"hover:text-yellow-200 text-yellow-300":"hover:text-red-200 text-red-300"),children:[k.jsx(Ta,{className:"h-3 w-3 mr-1"}),"Troubleshooting Guide"]})})]})]})})}o(hR,"ConnectionErrorBanner");const Oi=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,className:He("rounded-lg border bg-card text-card-foreground shadow-sm",t),"data-slot":"card",...e}));Oi.displayName="Card";const ac=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,className:He("flex flex-col space-y-1.5 bg-black/50 rounded-t-lg p-2",t),"data-slot":"card-header",...e}));ac.displayName="CardHeader";const Op=V.forwardRef(({className:t,...e},r)=>k.jsx("h3",{ref:r,className:He("text-2xl font-semibold leading-none tracking-tight",t),"data-slot":"card-title",...e}));Op.displayName="CardTitle";const pR=V.forwardRef(({className:t,...e},r)=>k.jsx("p",{ref:r,className:He("text-sm text-muted-foreground",t),"data-slot":"card-description",...e}));pR.displayName="CardDescription";const vs=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,className:He("p-6 pt-0",t),"data-slot":"card-content",...e}));vs.displayName="CardContent";const oc=V.forwardRef(({className:t,...e},r)=>k.jsx("div",{ref:r,className:He("flex items-center p-6 pt-0",t),"data-slot":"card-footer",...e}));oc.displayName="CardFooter";function mR(){const[t,e]=V.useState(""),[r,i]=V.useState(""),[s,f]=V.useState(!1),[n,v]=V.useState(null),[b,h]=V.useState(null),[m,l]=V.useState(""),[w,p]=V.useState({}),y=V.useRef(null),[M,E]=V.useState(!1),[R,I]=V.useState(!1),{toast:T}=Wt();V.useEffect(()=>{const Y=o(a=>{y.current&&!y.current.contains(a.target)&&v(null)},"handleClickOutside");return document.addEventListener("mousedown",Y),()=>{document.removeEventListener("mousedown",Y)}},[]),V.useEffect(()=>{P()},[]);const P=o(async()=>{const a=await Xt().system.getEnvironment();p(a)},"fetchLocalEnvs"),j=o(async()=>{await P(),h(null),v(null),e(""),i("")},"handleReset"),L=o(Y=>{h(n),l(w[Y]),v(null)},"handleEdit"),U=o(Y=>{const a={...w};delete a[Y],p(a),v(null)},"handleRemove"),Z=o(Y=>{p({...w,[Y]:m}),h(null)},"saveEdit"),ne=o(()=>{!t||!r||(p({...w,[t]:r}),e(""),i(""),h(null))},"addEnv"),F=o(()=>{console.log("API Key was saved")},"handleApiKeySaved");return k.jsxs("div",{className:"container max-w-4xl mx-auto p-6",children:[k.jsx($6,{open:R,onOpenChange:I,onApiKeySaved:F}),k.jsxs("div",{className:"flex items-center justify-between mb-6",children:[k.jsxs("div",{children:[k.jsx("h1",{className:"text-3xl font-bold",children:"Env settings"}),k.jsx("p",{className:"text-muted-foreground mt-1",children:"Env settings"})]}),k.jsxs($e,{onClick:o(()=>I(!0),"onClick"),"aria-label":"Manage API Key",children:[k.jsx(is,{className:"h-5 w-5"}),"Manage API Key"]})]}),k.jsx(Oi,{children:k.jsx(vs,{className:"p-6",children:k.jsx("div",{className:"space-y-6",children:k.jsxs("div",{className:"rounded-lg w-full flex flex-col gap-3",children:[k.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Environment Settings"}),k.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-end w-full pb-4",children:[k.jsxs("div",{className:"flex flex-col gap-1",children:[k.jsx("label",{htmlFor:"secret-name",className:"ml-2 text-xs font-medium text-gray-400",children:"NAME"}),k.jsx(hr,{id:"secret-name",placeholder:"VARIABLE_NAME",value:t,onChange:o(Y=>e(Y.target.value),"onChange")})]}),k.jsxs("div",{className:"flex flex-col gap-1 relative",children:[k.jsx("label",{htmlFor:"secret-value",className:"ml-2 text-xs font-medium text-gray-400",children:"VALUE"}),k.jsxs("div",{className:"relative",children:[k.jsx(hr,{id:"secret-value",type:s?"text":"password",placeholder:"i9ju23nfsdf56",value:r,onChange:o(Y=>i(Y.target.value),"onChange"),className:"pr-10"}),k.jsx("div",{className:"absolute inset-y-0 right-3 flex items-center cursor-pointer text-gray-500",onClick:o(()=>f(!s),"onClick"),children:s?k.jsx(Wi,{}):k.jsx(wi,{})})]})]}),k.jsx($e,{className:"shrink-0",onClick:ne,children:"Add"})]}),Object.keys(w).length>0&&k.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 mt-6 font-medium text-gray-400 border-b pb-2 ml-1",children:[k.jsx("div",{children:"Name"}),k.jsx("div",{children:"Value"}),k.jsx("div",{children:"Action"})]}),k.jsx("div",{className:"mt-2",children:Object.entries(w).map(([Y,a],g)=>k.jsxs("div",{className:"grid grid-cols-[1fr_2fr_auto] gap-4 items-center border-b py-2 ml-1 relative",children:[k.jsx("div",{className:"truncate max-w-48",children:Y}),k.jsx("div",{children:b===g?k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(hr,{value:m,onChange:o(u=>l(u.target.value),"onChange"),className:"w-full"}),k.jsx($e,{variant:"ghost",onClick:o(()=>Z(Y),"onClick"),children:k.jsx(zs,{className:"w-5 h-5 text-green-500"})}),k.jsx($e,{variant:"ghost",onClick:o(()=>h(null),"onClick"),children:k.jsx(Vr,{className:"w-5 h-5 text-red-500"})})]}):k.jsx("div",{className:"truncate text-gray-500",children:"Encrypted"})}),k.jsxs("div",{className:"relative",children:[k.jsx($e,{variant:"ghost",className:"p-2 text-gray-500",onClick:o(()=>v(n===g?null:g),"onClick"),children:k.jsx(Nv,{className:"h-5 w-5"})}),n===g&&k.jsx("div",{ref:y,className:"absolute right-0 mt-2 w-56 rounded-md shadow-lg bg-card ring-1 ring-black ring-opacity-5 z-10",children:k.jsxs("div",{className:"py-1",children:[k.jsx("button",{onClick:o(()=>L(Y),"onClick"),className:"w-full text-left px-4 py-2 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground",children:"Edit"}),k.jsx("button",{onClick:o(()=>U(Y),"onClick"),className:"w-full text-left px-4 py-2 text-sm text-red-500 hover:bg-accent",children:"Remove"})]})})]})]},g))})]})})})}),k.jsxs("div",{className:"flex gap-2 mt-4 justify-end",children:[k.jsx($e,{variant:"outline",onClick:j,children:"Reset"}),k.jsx($e,{type:"submit",disabled:M,onClick:o(async()=>{E(!0);try{await Xt().system.updateLocalEnvironment(w),T({title:"Success",description:"Environment variables updated successfully!"})}catch{T({title:"Error",description:"Failed to update environment variables.",variant:"destructive"})}finally{E(!1)}},"onClick"),children:"Save Changes"})]})]})}o(mR,"EnvSettings");const gR={10:"TRACE",20:"DEBUG",27:"SUCCESS",28:"PROGRESS",29:"LOG",30:"INFO",40:"WARN",50:"ERROR",60:"FATAL"};function Yg(t){return gR[t]||"UNKNOWN"}o(Yg,"getLevelName");function vR(t){return t>=50?"bg-red-600/80":t>=40?"bg-amber-600/80":t>=27?"bg-emerald-600/80":"bg-slate-500"}o(vR,"getLevelColor");function bR(t){return new Date(t).toLocaleDateString("en-US",{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}o(bR,"formatTimestamp");function yR(t){const e=Date.now(),r=24,i={};for(let f=r-1;f>=0;f--){const n=new Date(e-f*60*60*1e3);n.setMinutes(0,0,0);const v=n.toISOString();i[v]={info:0,errors:0}}const s=e-1440*60*1e3;return t.forEach(f=>{if(f.time>=s){const n=new Date(f.time);n.setMinutes(0,0,0);const v=n.toISOString();i[v]&&(f.level>=50?i[v].errors++:i[v].info++)}}),Object.entries(i).map(([f,n])=>({timestamp:new Date(f),...n,total:n.info+n.errors}))}o(yR,"generateLogChart");function wR({data:t}){const e=Math.max(...t.map(r=>r.total),1);return k.jsxs("div",{className:"mb-6",children:[k.jsxs("div",{className:"flex items-center justify-between mb-4",children:[k.jsxs("div",{className:"flex items-center gap-4",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("div",{className:"w-3 h-3 rounded-full bg-slate-500"}),k.jsxs("span",{className:"text-sm text-muted-foreground",children:["Info"," ",k.jsx("span",{className:"font-mono",children:t.reduce((r,i)=>r+i.info,0).toLocaleString()})]})]}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("div",{className:"w-3 h-3 rounded-full bg-red-600/80"}),k.jsxs("span",{className:"text-sm text-muted-foreground",children:["Errors"," ",k.jsx("span",{className:"font-mono",children:t.reduce((r,i)=>r+i.errors,0).toLocaleString()})]})]})]}),k.jsxs("div",{className:"text-sm text-muted-foreground",children:[t[t.length-1]?.timestamp.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})," ","- (UTC-7)"]})]}),k.jsx("div",{className:"h-32 flex items-end gap-1 bg-muted/30 rounded p-4",children:t.map((r,i)=>k.jsxs("div",{className:"flex-1 flex flex-col justify-end",children:[k.jsx("div",{style:{height:`${r.info/e*100}%`},className:"bg-slate-500 rounded-sm min-h-[2px] transition-all duration-200",title:`${r.timestamp.toLocaleTimeString()}: ${r.info} info logs`},`${r.timestamp.getTime()}-info`),k.jsx("div",{style:{height:`${r.errors/e*100}%`},className:"bg-red-600/80 rounded-sm min-h-[2px] transition-all duration-200",title:`${r.timestamp.toLocaleTimeString()}: ${r.errors} error logs`},`${r.timestamp.getTime()}-errors`)]},i))}),k.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mt-2",children:[k.jsx("span",{children:t[0]?.timestamp.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),k.jsx("span",{children:t[t.length-1]?.timestamp.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit"})})]})]})}o(wR,"LogChart");function xR(){return k.jsx("div",{className:"flex items-center justify-center py-8",children:k.jsxs("div",{className:"flex flex-col items-center gap-4",children:[k.jsx(Ha,{className:"h-8 w-8 animate-spin text-muted-foreground"}),k.jsxs("div",{className:"text-center",children:[k.jsx("h3",{className:"font-medium",children:"Loading Logs"}),k.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching system logs..."})]})]})})}o(xR,"LoadingIndicator$1");function _R({selectedLevel:t,searchQuery:e}){return k.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[k.jsx(wn,{className:"h-16 w-16 text-muted-foreground/30 mb-4"}),k.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Logs Found"}),k.jsx("p",{className:"text-muted-foreground max-w-md",children:e?`No logs match "${e}". Try adjusting your search or filter.`:t==="all"?"No logs available. Logs will appear here as the system generates them.":`No ${t.toUpperCase()} logs found.`})]})}o(_R,"EmptyState$1");function _8({agentName:t,level:e}){const[r,i]=V.useState(e||"all"),[s,f]=V.useState(t||"all"),[n,v]=V.useState(""),[b,h]=V.useState("7 days"),[m,l]=V.useState(!0),[w,p]=V.useState(!1),[y,M]=V.useState([]),[E,R]=V.useState(!1),I=br(),{confirm:T,isOpen:P,onOpenChange:j,onConfirm:L,options:U}=gs(),{data:Z,isLoading:ne,error:F,refetch:Y}=Sr({queryKey:["logs",r,s],queryFn:o(async()=>await Xt().system.getGlobalLogs({level:r==="all"?"":r,agentName:s==="all"?void 0:s}),"queryFn"),refetchInterval:m&&!E?5e3:!1,staleTime:1e3,enabled:!0}),{data:a}=Np(),g=V.useCallback(O=>{(r==="all"||Yg(O.level).toLowerCase()===r.toLowerCase())&&(s==="all"||O.agentName===s)&&M(B=>[O,...B].slice(0,1e3))},[r,s]);V.useEffect(()=>{if(m&&E){const O=Kr.getInstance();return O.subscribeToLogStream().catch(console.error),O.on("logStream",g),()=>{O.off("logStream",g),O.unsubscribeFromLogStream().catch(console.error)}}},[m,E,g]),V.useEffect(()=>{m?Kr.isConnected()?R(!0):R(!1):(R(!1),M([]))},[m]),V.useEffect(()=>{E&&m&&Kr.getInstance().updateLogStreamFilters({agentName:s,level:r}).catch(console.error)},[s,r,E,m]);const u=Z?.logs||[];let d;E&&m&&y.length>0?d=y:d=u;const x=d.sort((O,D)=>D.time-O.time),A=Z?.levels||[],N=a?.data?.agents?.map(O=>O.name)||[],S=x.filter(O=>{if(n.trim()){const D=n.toLowerCase();return[O.msg,O.agentName,O.roomId,Yg(O.level),...Object.entries(O).filter(([z])=>!Number.isNaN(Number(z))).map(([z,G])=>String(G))].filter(Boolean).join(" ").toLowerCase().includes(D)}return!0}),c=yR(S),_=o(()=>{T({title:"Clear All Logs",description:"Are you sure you want to permanently delete all system logs? This action cannot be undone.",confirmText:"Delete",variant:"destructive"},async()=>{try{p(!0),await Xt().system.deleteGlobalLogs(),I.invalidateQueries({queryKey:["logs"]}),E&&M([])}catch(O){console.error("Failed to clear logs:",O)}finally{p(!1)}})},"handleClearLogs"),C=o(()=>{E&&m?M([]):Y&&Y()},"handleRefresh");if(ne&&x.length===0)return k.jsx("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:k.jsx(xR,{})});if(F){const O=F.message?.includes("404")||F.message?.includes("endpoint not found")||F.message?.includes("Not Found");return k.jsx("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:k.jsx("div",{className:"flex items-center justify-center flex-1",children:k.jsxs("div",{className:"text-center max-w-md",children:[k.jsx(wn,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),k.jsx("h3",{className:"font-medium mb-2",children:O?"Global Logs API Not Available":"Failed to Load Logs"}),k.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:O?"The server does not have the global logs API endpoint configured. You can still view individual agent logs from the agent details pages.":`There was an error loading the system logs: ${F.message}`}),!O&&k.jsxs($e,{variant:"outline",size:"sm",onClick:o(()=>Y?.(),"onClick"),children:[k.jsx(Qp,{className:"h-4 w-4 mr-2"}),"Try Again"]})]})})})}return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:[k.jsxs("div",{className:"flex items-center gap-3 mb-6 px-4 pt-4 flex-none",children:[k.jsxs($n,{value:r,onValueChange:i,children:[k.jsxs(mn,{className:"w-32 h-9",children:[k.jsx(s4,{className:"h-4 w-4 mr-2"}),k.jsx(Jn,{placeholder:"Filter"})]}),k.jsxs(gn,{children:[k.jsx(Kt,{value:"all",children:"ALL"}),A.map(O=>k.jsx(Kt,{value:O,children:O.toUpperCase()},O))]})]}),k.jsxs("div",{className:"relative flex-1 max-w-md",children:[k.jsx(wh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),k.jsx(hr,{placeholder:"Full-text log search",value:n,onChange:o(O=>v(O.target.value),"onChange"),className:"pl-10 h-9"})]}),N&&N.length>0&&!t&&k.jsxs($n,{value:s,onValueChange:f,children:[k.jsx(mn,{className:"w-40 h-9",children:k.jsx(Jn,{placeholder:"Agent"})}),k.jsxs(gn,{children:[k.jsx(Kt,{value:"all",children:"ALL AGENTS"}),N?.map(O=>k.jsx(Kt,{value:O,children:O},O))]})]}),k.jsxs($n,{value:b,onValueChange:h,children:[k.jsxs(mn,{className:"w-32 h-9",children:[k.jsx(bu,{className:"h-4 w-4 mr-2"}),k.jsx(Jn,{})]}),k.jsxs(gn,{children:[k.jsx(Kt,{value:"1 hour",children:"1 hour"}),k.jsx(Kt,{value:"6 hours",children:"6 hours"}),k.jsx(Kt,{value:"24 hours",children:"24 hours"}),k.jsx(Kt,{value:"7 days",children:"7 days"}),k.jsx(Kt,{value:"30 days",children:"30 days"})]})]}),k.jsx($e,{variant:"outline",size:"sm",onClick:C,className:"h-9 w-9 p-0",children:k.jsx(Qp,{className:"h-4 w-4"})}),k.jsxs($e,{variant:m?"default":"outline",size:"sm",onClick:o(()=>l(!m),"onClick"),className:"h-9 px-3",title:m?E?"Live mode (WebSocket)":"Live mode (Polling)":"Live mode disabled",children:[k.jsx("div",{className:`w-2 h-2 rounded-full mr-2 ${m?"bg-emerald-500 animate-pulse":"bg-slate-400"}`}),"Live"]})]}),k.jsx("div",{className:"flex-1 overflow-hidden px-4 pb-4",children:S.length===0?k.jsx(_R,{selectedLevel:r,searchQuery:n}):k.jsxs("div",{className:"space-y-6",children:[k.jsx(wR,{data:c}),k.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[k.jsx("div",{className:"bg-muted/50 border-b px-4 py-3",children:k.jsxs("div",{className:"grid grid-cols-[200px_1fr] gap-4",children:[k.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Timestamp"}),k.jsx("div",{className:"text-sm font-medium text-muted-foreground",children:"Message"})]})}),k.jsx("div",{className:"divide-y max-h-[400px] overflow-y-auto",children:S.slice(0,100).map((O,D)=>k.jsxs("div",{className:"grid grid-cols-[200px_1fr] gap-4 px-4 py-3 hover:bg-muted/30 transition-colors",children:[k.jsxs("div",{className:"flex items-center gap-3",children:[k.jsx("div",{className:`w-1 h-6 rounded-full ${vR(O.level)}`}),k.jsx("div",{className:"text-sm font-mono text-muted-foreground",children:bR(O.time)})]}),k.jsxs("div",{className:"flex items-start gap-2 min-w-0",children:[k.jsx("div",{className:"font-mono text-sm leading-relaxed break-all",children:O.msg}),O.agentName&&k.jsx(ii,{variant:"secondary",className:"text-xs flex-shrink-0",children:O.agentName})]})]},`${O.time}-${O.msg}-${D}`))}),S.length>100&&k.jsx("div",{className:"border-t bg-muted/30 px-4 py-3 text-center",children:k.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing first 100 of ",S.length.toLocaleString()," logs"]})})]})]})}),k.jsxs("div",{className:"border-t bg-muted/30 px-4 py-3 flex items-center justify-between",children:[k.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:m&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"w-2 h-2 rounded-full bg-emerald-500 animate-pulse"}),k.jsxs("span",{children:["Live updates enabled ",E?"(streaming)":"(polling)"]})]})}),k.jsxs($e,{variant:"destructive",size:"sm",onClick:_,disabled:w,className:"h-8 px-3 text-xs",children:[k.jsx(rs,{className:"h-3 w-3 mr-1"}),w?"Clearing...":"Clear All Logs"]})]})]}),k.jsx(ms,{open:P,onOpenChange:j,title:U?.title||"",description:U?.description||"",confirmText:U?.confirmText,cancelText:U?.cancelText,variant:U?.variant,onConfirm:L})]})}o(_8,"AgentLogViewer");const Qg="eliza-onboarding-completed",MR=o(()=>{const[t,e]=V.useState(()=>{try{return localStorage.getItem(Qg)==="true"}catch(s){return Ge.error("Error accessing localStorage:",s),!1}});return V.useEffect(()=>{try{localStorage.setItem(Qg,t.toString())}catch(s){Ge.error("Error writing to localStorage:",s)}},[t]),{onboardingCompleted:t,completeOnboarding:o(()=>{e(!0)},"completeOnboarding"),resetOnboarding:o(()=>{e(!1)},"resetOnboarding")}},"useOnboarding");function SR(){const{onboardingCompleted:t,completeOnboarding:e}=MR(),[r,i]=V.useState(!1),s=gu(),[f,n]=V.useState(0),v=[{target:".sidebar-logo",content:"Welcome to ElizaOS! This is your gateway to creating and managing intelligent AI agents.",disableBeacon:!0,title:"Welcome to ElizaOS"},{target:".sidebar-create-button",content:"This is your main creation button. Click here to create new agents or rooms quickly.",title:"Create Button"},{target:".sidebar-online-section, .sidebar-offline-section",content:"Your agents are organized here. Online agents (green dot) are ready to chat, while offline agents need to be activated first.",title:"Your Agents"},{target:".sidebar-groups-section",content:"Access your agent groups from here to see collaborative conversations between multiple agents.",title:"Groups Navigation"},{target:".sidebar-docs-button, .sidebar-logs-button, .sidebar-settings-button",content:"Access documentation, system logs, and global settings from these utility buttons.",title:"System Utilities"},{target:".sidebar-connection-status",content:"This indicator shows your connection status to the ElizaOS server.",title:"Connection Status"},{target:".agents-section",content:'This is your main workspace showing all your agents. Active agents have a green dot, while inactive ones appear grayed out with an "Offline" label.',title:"Agent Dashboard"},{target:".message-button, .start-button",content:'Click "Message" to chat with active agents, or "Start" to activate offline agents first.',title:"Agent Interaction"},{target:".agent-info-button, .agent-settings-button",content:"View agent details or configure settings using these buttons on each agent card.",title:"Agent Management"},{target:".groups-section",content:"This section displays your agent groups for collaborative interactions between multiple agents.",title:"Agent Groups"},{target:".groups-create-button",content:"Create a new group by clicking this button. Groups allow multiple agents to interact together.",title:"Create New Group"},{target:".create-agent-button",content:"Let's create your first agent! Click this button to get started.",title:"Create Your First Agent",spotlightClicks:!0}],b=[{target:".agent-form-name",content:"Give your agent a name that reflects its purpose or personality.",title:"Name Your Agent",disableBeacon:!0},{target:".agent-form-system-prompt",content:"The system prompt defines your agent's behavior and capabilities. This is the most important field for shaping how your agent will respond.",title:"Define Agent Behavior"},{target:".tabs-list",content:"Switch between these tabs to configure different aspects of your agent such as content, style, plugins, and appearance.",title:"Configuration Tabs"},{target:".agent-form-submit",content:"Click Save to create your agent and return to the dashboard.",title:"Save Your Agent",spotlightClicks:!0}],h=s.pathname==="/"?v:s.pathname==="/create"?b:[];V.useEffect(()=>{if(s.pathname==="/"&&!t&&f===0){const l=setTimeout(()=>{i(!0)},1e3);return()=>clearTimeout(l)}else if(s.pathname==="/create"&&!t&&f===1){const l=setTimeout(()=>{i(!0)},1e3);return()=>clearTimeout(l)}else i(!1)},[s.pathname,t,f]);const m=o(l=>{const{status:w,index:p,type:y,action:M}=l;s.pathname==="/"&&y==="step:after"&&p===v.length-1&&(n(1),i(!1)),(w===Kp.FINISHED||w===Kp.SKIPPED||M===o4.CLOSE)&&(e(),i(!1))},"handleJoyrideCallback");return t||h.length===0?null:k.jsx(a4,{callback:m,continuous:!0,run:r,scrollToFirstStep:!0,showProgress:!0,showSkipButton:!0,steps:h,floaterProps:{disableAnimation:!1,styles:{floater:{filter:"drop-shadow(0 10px 15px rgba(0, 0, 0, 0.25))"}}},styles:{options:{primaryColor:"#3b82f6",backgroundColor:"#1f2937",textColor:"#f3f4f6",overlayColor:"rgba(0, 0, 0, 0.6)",zIndex:9999,arrowColor:"#1f2937",beaconSize:36},tooltip:{fontSize:"14px",padding:"16px",borderRadius:"10px",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.3)"},tooltipContainer:{textAlign:"left"},tooltipTitle:{fontSize:"16px",fontWeight:"600",marginBottom:"8px"},tooltipContent:{padding:"5px 0",fontSize:"14px",lineHeight:"1.5"},buttonClose:{color:"#9ca3af",opacity:.8},buttonBack:{color:"#9ca3af",fontSize:"14px",fontWeight:"500",padding:"8px 12px",borderRadius:"6px",marginRight:"8px",transition:"background-color 0.2s ease"},buttonNext:{backgroundColor:"#3b82f6",fontSize:"14px",fontWeight:"500",padding:"8px 16px",borderRadius:"6px",color:"white",border:"none",boxShadow:"0 4px 6px rgba(59, 130, 246, 0.3)",transition:"all 0.2s ease"},buttonSkip:{color:"#9ca3af",fontSize:"14px",padding:"8px 12px",borderRadius:"6px",transition:"background-color 0.2s ease"},spotlight:{borderRadius:"8px",backgroundColor:"transparent"},overlay:{backgroundColor:"rgba(0, 0, 0, 0.7)"}}})}o(SR,"OnboardingTour");const ER=l4,M8=V.forwardRef(({className:t,...e},r)=>k.jsx(Zv,{ref:r,className:He("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...e}));M8.displayName=Zv.displayName;const AR=sn("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),S8=V.forwardRef(({className:t,variant:e,...r},i)=>k.jsx(Fv,{ref:i,className:He(AR({variant:e}),t),...r}));S8.displayName=Fv.displayName;const E8=V.forwardRef(({className:t,...e},r)=>k.jsx(zv,{ref:r,className:He("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));E8.displayName=zv.displayName;const A8=V.forwardRef(({className:t,...e},r)=>k.jsx(Vv,{ref:r,className:He("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:k.jsx(Vr,{className:"h-4 w-4"})}));A8.displayName=Vv.displayName;const k8=V.forwardRef(({className:t,...e},r)=>k.jsx(Uv,{ref:r,className:He("text-sm font-semibold [&+div]:text-xs",t),...e}));k8.displayName=Uv.displayName;const N8=V.forwardRef(({className:t,...e},r)=>k.jsx(Hv,{ref:r,className:He("text-sm opacity-90",t),...e}));N8.displayName=Hv.displayName;function kR(){const{toasts:t}=Wt();return k.jsxs(ER,{children:[t.map(({id:e,title:r,description:i,action:s,...f})=>k.jsxs(S8,{...f,children:[k.jsxs("div",{className:"grid gap-1",children:[r&&k.jsx(k8,{children:r}),i&&k.jsx(N8,{children:i})]}),s,k.jsx(A8,{})]},e)),k.jsx(M8,{})]})}o(kR,"Toaster");var ml={exports:{}},yf,Kg;function lc(){if(Kg)return yf;Kg=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,s=e-6;return yf={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:s,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},yf}o(lc,"requireConstants");var wf,Xg;function uc(){if(Xg)return wf;Xg=1;var t={};return wf=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},wf}o(uc,"requireDebug");var Wg;function Yo(){return Wg||(Wg=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:s}=lc(),f=uc();e=t.exports={};const n=e.re=[],v=e.safeRe=[],b=e.src=[],h=e.safeSrc=[],m=e.t={};let l=0;const w="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",s],[w,i]],y=o(E=>{for(const[R,I]of p)E=E.split(`${R}*`).join(`${R}{0,${I}}`).split(`${R}+`).join(`${R}{1,${I}}`);return E},"makeSafeRegex"),M=o((E,R,I)=>{const T=y(R),P=l++;f(E,P,R),m[E]=P,b[P]=R,h[P]=T,n[P]=new RegExp(R,I?"g":void 0),v[P]=new RegExp(T,I?"g":void 0)},"createToken");M("NUMERICIDENTIFIER","0|[1-9]\\d*"),M("NUMERICIDENTIFIERLOOSE","\\d+"),M("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${w}*`),M("MAINVERSION",`(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})\\.(${b[m.NUMERICIDENTIFIER]})`),M("MAINVERSIONLOOSE",`(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})\\.(${b[m.NUMERICIDENTIFIERLOOSE]})`),M("PRERELEASEIDENTIFIER",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIER]})`),M("PRERELEASEIDENTIFIERLOOSE",`(?:${b[m.NONNUMERICIDENTIFIER]}|${b[m.NUMERICIDENTIFIERLOOSE]})`),M("PRERELEASE",`(?:-(${b[m.PRERELEASEIDENTIFIER]}(?:\\.${b[m.PRERELEASEIDENTIFIER]})*))`),M("PRERELEASELOOSE",`(?:-?(${b[m.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${b[m.PRERELEASEIDENTIFIERLOOSE]})*))`),M("BUILDIDENTIFIER",`${w}+`),M("BUILD",`(?:\\+(${b[m.BUILDIDENTIFIER]}(?:\\.${b[m.BUILDIDENTIFIER]})*))`),M("FULLPLAIN",`v?${b[m.MAINVERSION]}${b[m.PRERELEASE]}?${b[m.BUILD]}?`),M("FULL",`^${b[m.FULLPLAIN]}$`),M("LOOSEPLAIN",`[v=\\s]*${b[m.MAINVERSIONLOOSE]}${b[m.PRERELEASELOOSE]}?${b[m.BUILD]}?`),M("LOOSE",`^${b[m.LOOSEPLAIN]}$`),M("GTLT","((?:<|>)?=?)"),M("XRANGEIDENTIFIERLOOSE",`${b[m.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),M("XRANGEIDENTIFIER",`${b[m.NUMERICIDENTIFIER]}|x|X|\\*`),M("XRANGEPLAIN",`[v=\\s]*(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:\\.(${b[m.XRANGEIDENTIFIER]})(?:${b[m.PRERELEASE]})?${b[m.BUILD]}?)?)?`),M("XRANGEPLAINLOOSE",`[v=\\s]*(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:\\.(${b[m.XRANGEIDENTIFIERLOOSE]})(?:${b[m.PRERELEASELOOSE]})?${b[m.BUILD]}?)?)?`),M("XRANGE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAIN]}$`),M("XRANGELOOSE",`^${b[m.GTLT]}\\s*${b[m.XRANGEPLAINLOOSE]}$`),M("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),M("COERCE",`${b[m.COERCEPLAIN]}(?:$|[^\\d])`),M("COERCEFULL",b[m.COERCEPLAIN]+`(?:${b[m.PRERELEASE]})?(?:${b[m.BUILD]})?(?:$|[^\\d])`),M("COERCERTL",b[m.COERCE],!0),M("COERCERTLFULL",b[m.COERCEFULL],!0),M("LONETILDE","(?:~>?)"),M("TILDETRIM",`(\\s*)${b[m.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",M("TILDE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAIN]}$`),M("TILDELOOSE",`^${b[m.LONETILDE]}${b[m.XRANGEPLAINLOOSE]}$`),M("LONECARET","(?:\\^)"),M("CARETTRIM",`(\\s*)${b[m.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",M("CARET",`^${b[m.LONECARET]}${b[m.XRANGEPLAIN]}$`),M("CARETLOOSE",`^${b[m.LONECARET]}${b[m.XRANGEPLAINLOOSE]}$`),M("COMPARATORLOOSE",`^${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]})$|^$`),M("COMPARATOR",`^${b[m.GTLT]}\\s*(${b[m.FULLPLAIN]})$|^$`),M("COMPARATORTRIM",`(\\s*)${b[m.GTLT]}\\s*(${b[m.LOOSEPLAIN]}|${b[m.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",M("HYPHENRANGE",`^\\s*(${b[m.XRANGEPLAIN]})\\s+-\\s+(${b[m.XRANGEPLAIN]})\\s*$`),M("HYPHENRANGELOOSE",`^\\s*(${b[m.XRANGEPLAINLOOSE]})\\s+-\\s+(${b[m.XRANGEPLAINLOOSE]})\\s*$`),M("STAR","(<|>)?=?\\s*\\*"),M("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),M("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(ml,ml.exports)),ml.exports}o(Yo,"requireRe");var xf,$g;function Tp(){if($g)return xf;$g=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return xf=o(i=>i?typeof i!="object"?t:i:e,"parseOptions"),xf}o(Tp,"requireParseOptions");var _f,Jg;function C8(){if(Jg)return _f;Jg=1;const t=/^[0-9]+$/,e=o((i,s)=>{const f=t.test(i),n=t.test(s);return f&&n&&(i=+i,s=+s),i===s?0:f&&!n?-1:n&&!f?1:i<s?-1:1},"compareIdentifiers");return _f={compareIdentifiers:e,rcompareIdentifiers:o((i,s)=>e(s,i),"rcompareIdentifiers")},_f}o(C8,"requireIdentifiers");var Mf,qg;function Rr(){if(qg)return Mf;qg=1;const t=uc(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:r}=lc(),{safeRe:i,t:s}=Yo(),f=Tp(),{compareIdentifiers:n}=C8();class v{static{o(this,"SemVer")}constructor(h,m){if(m=f(m),h instanceof v){if(h.loose===!!m.loose&&h.includePrerelease===!!m.includePrerelease)return h;h=h.version}else if(typeof h!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof h}".`);if(h.length>e)throw new TypeError(`version is longer than ${e} characters`);t("SemVer",h,m),this.options=m,this.loose=!!m.loose,this.includePrerelease=!!m.includePrerelease;const l=h.trim().match(m.loose?i[s.LOOSE]:i[s.FULL]);if(!l)throw new TypeError(`Invalid Version: ${h}`);if(this.raw=h,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(w=>{if(/^[0-9]+$/.test(w)){const p=+w;if(p>=0&&p<r)return p}return w}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(h){if(t("SemVer.compare",this.version,this.options,h),!(h instanceof v)){if(typeof h=="string"&&h===this.version)return 0;h=new v(h,this.options)}return h.version===this.version?0:this.compareMain(h)||this.comparePre(h)}compareMain(h){return h instanceof v||(h=new v(h,this.options)),n(this.major,h.major)||n(this.minor,h.minor)||n(this.patch,h.patch)}comparePre(h){if(h instanceof v||(h=new v(h,this.options)),this.prerelease.length&&!h.prerelease.length)return-1;if(!this.prerelease.length&&h.prerelease.length)return 1;if(!this.prerelease.length&&!h.prerelease.length)return 0;let m=0;do{const l=this.prerelease[m],w=h.prerelease[m];if(t("prerelease compare",m,l,w),l===void 0&&w===void 0)return 0;if(w===void 0)return 1;if(l===void 0)return-1;if(l===w)continue;return n(l,w)}while(++m)}compareBuild(h){h instanceof v||(h=new v(h,this.options));let m=0;do{const l=this.build[m],w=h.build[m];if(t("build compare",m,l,w),l===void 0&&w===void 0)return 0;if(w===void 0)return 1;if(l===void 0)return-1;if(l===w)continue;return n(l,w)}while(++m)}inc(h,m,l){if(h.startsWith("pre")){if(!m&&l===!1)throw new Error("invalid increment argument: identifier is empty");if(m){const w=`-${m}`.match(this.options.loose?i[s.PRERELEASELOOSE]:i[s.PRERELEASE]);if(!w||w[1]!==m)throw new Error(`invalid identifier: ${m}`)}}switch(h){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",m,l);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",m,l);break;case"prepatch":this.prerelease.length=0,this.inc("patch",m,l),this.inc("pre",m,l);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",m,l),this.inc("pre",m,l);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const w=Number(l)?1:0;if(this.prerelease.length===0)this.prerelease=[w];else{let p=this.prerelease.length;for(;--p>=0;)typeof this.prerelease[p]=="number"&&(this.prerelease[p]++,p=-2);if(p===-1){if(m===this.prerelease.join(".")&&l===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(w)}}if(m){let p=[m,w];l===!1&&(p=[m]),n(this.prerelease[0],m)===0?isNaN(this.prerelease[1])&&(this.prerelease=p):this.prerelease=p}break}default:throw new Error(`invalid increment argument: ${h}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Mf=v,Mf}o(Rr,"requireSemver$1");var Sf,e1;function ia(){if(e1)return Sf;e1=1;const t=Rr();return Sf=o((r,i,s=!1)=>{if(r instanceof t)return r;try{return new t(r,i)}catch(f){if(!s)return null;throw f}},"parse"),Sf}o(ia,"requireParse");var Ef,t1;function NR(){if(t1)return Ef;t1=1;const t=ia();return Ef=o((r,i)=>{const s=t(r,i);return s?s.version:null},"valid"),Ef}o(NR,"requireValid$1");var Af,r1;function CR(){if(r1)return Af;r1=1;const t=ia();return Af=o((r,i)=>{const s=t(r.trim().replace(/^[=v]+/,""),i);return s?s.version:null},"clean"),Af}o(CR,"requireClean");var kf,i1;function RR(){if(i1)return kf;i1=1;const t=Rr();return kf=o((r,i,s,f,n)=>{typeof s=="string"&&(n=f,f=s,s=void 0);try{return new t(r instanceof t?r.version:r,s).inc(i,f,n).version}catch{return null}},"inc"),kf}o(RR,"requireInc");var Nf,n1;function IR(){if(n1)return Nf;n1=1;const t=ia();return Nf=o((r,i)=>{const s=t(r,null,!0),f=t(i,null,!0),n=s.compare(f);if(n===0)return null;const v=n>0,b=v?s:f,h=v?f:s,m=!!b.prerelease.length;if(!!h.prerelease.length&&!m){if(!h.patch&&!h.minor)return"major";if(h.compareMain(b)===0)return h.minor&&!h.patch?"minor":"patch"}const w=m?"pre":"";return s.major!==f.major?w+"major":s.minor!==f.minor?w+"minor":s.patch!==f.patch?w+"patch":"prerelease"},"diff"),Nf}o(IR,"requireDiff");var Cf,s1;function OR(){if(s1)return Cf;s1=1;const t=Rr();return Cf=o((r,i)=>new t(r,i).major,"major"),Cf}o(OR,"requireMajor");var Rf,a1;function TR(){if(a1)return Rf;a1=1;const t=Rr();return Rf=o((r,i)=>new t(r,i).minor,"minor"),Rf}o(TR,"requireMinor");var If,o1;function PR(){if(o1)return If;o1=1;const t=Rr();return If=o((r,i)=>new t(r,i).patch,"patch"),If}o(PR,"requirePatch");var Of,l1;function jR(){if(l1)return Of;l1=1;const t=ia();return Of=o((r,i)=>{const s=t(r,i);return s&&s.prerelease.length?s.prerelease:null},"prerelease"),Of}o(jR,"requirePrerelease");var Tf,u1;function gi(){if(u1)return Tf;u1=1;const t=Rr();return Tf=o((r,i,s)=>new t(r,s).compare(new t(i,s)),"compare"),Tf}o(gi,"requireCompare");var Pf,c1;function LR(){if(c1)return Pf;c1=1;const t=gi();return Pf=o((r,i,s)=>t(i,r,s),"rcompare"),Pf}o(LR,"requireRcompare");var jf,f1;function DR(){if(f1)return jf;f1=1;const t=gi();return jf=o((r,i)=>t(r,i,!0),"compareLoose"),jf}o(DR,"requireCompareLoose");var Lf,d1;function Pp(){if(d1)return Lf;d1=1;const t=Rr();return Lf=o((r,i,s)=>{const f=new t(r,s),n=new t(i,s);return f.compare(n)||f.compareBuild(n)},"compareBuild"),Lf}o(Pp,"requireCompareBuild");var Df,h1;function BR(){if(h1)return Df;h1=1;const t=Pp();return Df=o((r,i)=>r.sort((s,f)=>t(s,f,i)),"sort"),Df}o(BR,"requireSort");var Bf,p1;function zR(){if(p1)return Bf;p1=1;const t=Pp();return Bf=o((r,i)=>r.sort((s,f)=>t(f,s,i)),"rsort"),Bf}o(zR,"requireRsort");var zf,m1;function cc(){if(m1)return zf;m1=1;const t=gi();return zf=o((r,i,s)=>t(r,i,s)>0,"gt"),zf}o(cc,"requireGt");var Ff,g1;function jp(){if(g1)return Ff;g1=1;const t=gi();return Ff=o((r,i,s)=>t(r,i,s)<0,"lt"),Ff}o(jp,"requireLt");var Uf,v1;function R8(){if(v1)return Uf;v1=1;const t=gi();return Uf=o((r,i,s)=>t(r,i,s)===0,"eq"),Uf}o(R8,"requireEq");var Hf,b1;function I8(){if(b1)return Hf;b1=1;const t=gi();return Hf=o((r,i,s)=>t(r,i,s)!==0,"neq"),Hf}o(I8,"requireNeq");var Vf,y1;function Lp(){if(y1)return Vf;y1=1;const t=gi();return Vf=o((r,i,s)=>t(r,i,s)>=0,"gte"),Vf}o(Lp,"requireGte");var Zf,w1;function Dp(){if(w1)return Zf;w1=1;const t=gi();return Zf=o((r,i,s)=>t(r,i,s)<=0,"lte"),Zf}o(Dp,"requireLte");var Gf,x1;function O8(){if(x1)return Gf;x1=1;const t=R8(),e=I8(),r=cc(),i=Lp(),s=jp(),f=Dp();return Gf=o((v,b,h,m)=>{switch(b){case"===":return typeof v=="object"&&(v=v.version),typeof h=="object"&&(h=h.version),v===h;case"!==":return typeof v=="object"&&(v=v.version),typeof h=="object"&&(h=h.version),v!==h;case"":case"=":case"==":return t(v,h,m);case"!=":return e(v,h,m);case">":return r(v,h,m);case">=":return i(v,h,m);case"<":return s(v,h,m);case"<=":return f(v,h,m);default:throw new TypeError(`Invalid operator: ${b}`)}},"cmp"),Gf}o(O8,"requireCmp");var Yf,_1;function FR(){if(_1)return Yf;_1=1;const t=Rr(),e=ia(),{safeRe:r,t:i}=Yo();return Yf=o((f,n)=>{if(f instanceof t)return f;if(typeof f=="number"&&(f=String(f)),typeof f!="string")return null;n=n||{};let v=null;if(!n.rtl)v=f.match(n.includePrerelease?r[i.COERCEFULL]:r[i.COERCE]);else{const p=n.includePrerelease?r[i.COERCERTLFULL]:r[i.COERCERTL];let y;for(;(y=p.exec(f))&&(!v||v.index+v[0].length!==f.length);)(!v||y.index+y[0].length!==v.index+v[0].length)&&(v=y),p.lastIndex=y.index+y[1].length+y[2].length;p.lastIndex=-1}if(v===null)return null;const b=v[2],h=v[3]||"0",m=v[4]||"0",l=n.includePrerelease&&v[5]?`-${v[5]}`:"",w=n.includePrerelease&&v[6]?`+${v[6]}`:"";return e(`${b}.${h}.${m}${l}${w}`,n)},"coerce"),Yf}o(FR,"requireCoerce");var Qf,M1;function UR(){if(M1)return Qf;M1=1;class t{static{o(this,"LRUCache")}constructor(){this.max=1e3,this.map=new Map}get(r){const i=this.map.get(r);if(i!==void 0)return this.map.delete(r),this.map.set(r,i),i}delete(r){return this.map.delete(r)}set(r,i){if(!this.delete(r)&&i!==void 0){if(this.map.size>=this.max){const f=this.map.keys().next().value;this.delete(f)}this.map.set(r,i)}return this}}return Qf=t,Qf}o(UR,"requireLrucache");var Kf,S1;function vi(){if(S1)return Kf;S1=1;const t=/\s+/g;class e{static{o(this,"Range")}constructor(d,x){if(x=s(x),d instanceof e)return d.loose===!!x.loose&&d.includePrerelease===!!x.includePrerelease?d:new e(d.raw,x);if(d instanceof f)return this.raw=d.value,this.set=[[d]],this.formatted=void 0,this;if(this.options=x,this.loose=!!x.loose,this.includePrerelease=!!x.includePrerelease,this.raw=d.trim().replace(t," "),this.set=this.raw.split("||").map(A=>this.parseRange(A.trim())).filter(A=>A.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const A=this.set[0];if(this.set=this.set.filter(N=>!M(N[0])),this.set.length===0)this.set=[A];else if(this.set.length>1){for(const N of this.set)if(N.length===1&&E(N[0])){this.set=[N];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let d=0;d<this.set.length;d++){d>0&&(this.formatted+="||");const x=this.set[d];for(let A=0;A<x.length;A++)A>0&&(this.formatted+=" "),this.formatted+=x[A].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(d){const A=((this.options.includePrerelease&&p)|(this.options.loose&&y))+":"+d,N=i.get(A);if(N)return N;const S=this.options.loose,c=S?b[h.HYPHENRANGELOOSE]:b[h.HYPHENRANGE];d=d.replace(c,a(this.options.includePrerelease)),n("hyphen replace",d),d=d.replace(b[h.COMPARATORTRIM],m),n("comparator trim",d),d=d.replace(b[h.TILDETRIM],l),n("tilde trim",d),d=d.replace(b[h.CARETTRIM],w),n("caret trim",d);let _=d.split(" ").map(B=>I(B,this.options)).join(" ").split(/\s+/).map(B=>Y(B,this.options));S&&(_=_.filter(B=>(n("loose invalid filter",B,this.options),!!B.match(b[h.COMPARATORLOOSE])))),n("range list",_);const C=new Map,O=_.map(B=>new f(B,this.options));for(const B of O){if(M(B))return[B];C.set(B.value,B)}C.size>1&&C.has("")&&C.delete("");const D=[...C.values()];return i.set(A,D),D}intersects(d,x){if(!(d instanceof e))throw new TypeError("a Range is required");return this.set.some(A=>R(A,x)&&d.set.some(N=>R(N,x)&&A.every(S=>N.every(c=>S.intersects(c,x)))))}test(d){if(!d)return!1;if(typeof d=="string")try{d=new v(d,this.options)}catch{return!1}for(let x=0;x<this.set.length;x++)if(g(this.set[x],d,this.options))return!0;return!1}}Kf=e;const r=UR(),i=new r,s=Tp(),f=fc(),n=uc(),v=Rr(),{safeRe:b,t:h,comparatorTrimReplace:m,tildeTrimReplace:l,caretTrimReplace:w}=Yo(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:y}=lc(),M=o(u=>u.value==="<0.0.0-0","isNullSet"),E=o(u=>u.value==="","isAny"),R=o((u,d)=>{let x=!0;const A=u.slice();let N=A.pop();for(;x&&A.length;)x=A.every(S=>N.intersects(S,d)),N=A.pop();return x},"isSatisfiable"),I=o((u,d)=>(n("comp",u,d),u=L(u,d),n("caret",u),u=P(u,d),n("tildes",u),u=Z(u,d),n("xrange",u),u=F(u,d),n("stars",u),u),"parseComparator"),T=o(u=>!u||u.toLowerCase()==="x"||u==="*","isX"),P=o((u,d)=>u.trim().split(/\s+/).map(x=>j(x,d)).join(" "),"replaceTildes"),j=o((u,d)=>{const x=d.loose?b[h.TILDELOOSE]:b[h.TILDE];return u.replace(x,(A,N,S,c,_)=>{n("tilde",u,A,N,S,c,_);let C;return T(N)?C="":T(S)?C=`>=${N}.0.0 <${+N+1}.0.0-0`:T(c)?C=`>=${N}.${S}.0 <${N}.${+S+1}.0-0`:_?(n("replaceTilde pr",_),C=`>=${N}.${S}.${c}-${_} <${N}.${+S+1}.0-0`):C=`>=${N}.${S}.${c} <${N}.${+S+1}.0-0`,n("tilde return",C),C})},"replaceTilde"),L=o((u,d)=>u.trim().split(/\s+/).map(x=>U(x,d)).join(" "),"replaceCarets"),U=o((u,d)=>{n("caret",u,d);const x=d.loose?b[h.CARETLOOSE]:b[h.CARET],A=d.includePrerelease?"-0":"";return u.replace(x,(N,S,c,_,C)=>{n("caret",u,N,S,c,_,C);let O;return T(S)?O="":T(c)?O=`>=${S}.0.0${A} <${+S+1}.0.0-0`:T(_)?S==="0"?O=`>=${S}.${c}.0${A} <${S}.${+c+1}.0-0`:O=`>=${S}.${c}.0${A} <${+S+1}.0.0-0`:C?(n("replaceCaret pr",C),S==="0"?c==="0"?O=`>=${S}.${c}.${_}-${C} <${S}.${c}.${+_+1}-0`:O=`>=${S}.${c}.${_}-${C} <${S}.${+c+1}.0-0`:O=`>=${S}.${c}.${_}-${C} <${+S+1}.0.0-0`):(n("no pr"),S==="0"?c==="0"?O=`>=${S}.${c}.${_}${A} <${S}.${c}.${+_+1}-0`:O=`>=${S}.${c}.${_}${A} <${S}.${+c+1}.0-0`:O=`>=${S}.${c}.${_} <${+S+1}.0.0-0`),n("caret return",O),O})},"replaceCaret"),Z=o((u,d)=>(n("replaceXRanges",u,d),u.split(/\s+/).map(x=>ne(x,d)).join(" ")),"replaceXRanges"),ne=o((u,d)=>{u=u.trim();const x=d.loose?b[h.XRANGELOOSE]:b[h.XRANGE];return u.replace(x,(A,N,S,c,_,C)=>{n("xRange",u,A,N,S,c,_,C);const O=T(S),D=O||T(c),B=D||T(_),z=B;return N==="="&&z&&(N=""),C=d.includePrerelease?"-0":"",O?N===">"||N==="<"?A="<0.0.0-0":A="*":N&&z?(D&&(c=0),_=0,N===">"?(N=">=",D?(S=+S+1,c=0,_=0):(c=+c+1,_=0)):N==="<="&&(N="<",D?S=+S+1:c=+c+1),N==="<"&&(C="-0"),A=`${N+S}.${c}.${_}${C}`):D?A=`>=${S}.0.0${C} <${+S+1}.0.0-0`:B&&(A=`>=${S}.${c}.0${C} <${S}.${+c+1}.0-0`),n("xRange return",A),A})},"replaceXRange"),F=o((u,d)=>(n("replaceStars",u,d),u.trim().replace(b[h.STAR],"")),"replaceStars"),Y=o((u,d)=>(n("replaceGTE0",u,d),u.trim().replace(b[d.includePrerelease?h.GTE0PRE:h.GTE0],"")),"replaceGTE0"),a=o(u=>(d,x,A,N,S,c,_,C,O,D,B,z)=>(T(A)?x="":T(N)?x=`>=${A}.0.0${u?"-0":""}`:T(S)?x=`>=${A}.${N}.0${u?"-0":""}`:c?x=`>=${x}`:x=`>=${x}${u?"-0":""}`,T(O)?C="":T(D)?C=`<${+O+1}.0.0-0`:T(B)?C=`<${O}.${+D+1}.0-0`:z?C=`<=${O}.${D}.${B}-${z}`:u?C=`<${O}.${D}.${+B+1}-0`:C=`<=${C}`,`${x} ${C}`.trim()),"hyphenReplace"),g=o((u,d,x)=>{for(let A=0;A<u.length;A++)if(!u[A].test(d))return!1;if(d.prerelease.length&&!x.includePrerelease){for(let A=0;A<u.length;A++)if(n(u[A].semver),u[A].semver!==f.ANY&&u[A].semver.prerelease.length>0){const N=u[A].semver;if(N.major===d.major&&N.minor===d.minor&&N.patch===d.patch)return!0}return!1}return!0},"testSet");return Kf}o(vi,"requireRange");var Xf,E1;function fc(){if(E1)return Xf;E1=1;const t=Symbol("SemVer ANY");class e{static{o(this,"Comparator")}static get ANY(){return t}constructor(m,l){if(l=r(l),m instanceof e){if(m.loose===!!l.loose)return m;m=m.value}m=m.trim().split(/\s+/).join(" "),n("comparator",m,l),this.options=l,this.loose=!!l.loose,this.parse(m),this.semver===t?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}parse(m){const l=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],w=m.match(l);if(!w)throw new TypeError(`Invalid comparator: ${m}`);this.operator=w[1]!==void 0?w[1]:"",this.operator==="="&&(this.operator=""),w[2]?this.semver=new v(w[2],this.options.loose):this.semver=t}toString(){return this.value}test(m){if(n("Comparator.test",m,this.options.loose),this.semver===t||m===t)return!0;if(typeof m=="string")try{m=new v(m,this.options)}catch{return!1}return f(m,this.operator,this.semver,this.options)}intersects(m,l){if(!(m instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new b(m.value,l).test(this.value):m.operator===""?m.value===""?!0:new b(this.value,l).test(m.semver):(l=r(l),l.includePrerelease&&(this.value==="<0.0.0-0"||m.value==="<0.0.0-0")||!l.includePrerelease&&(this.value.startsWith("<0.0.0")||m.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&m.operator.startsWith(">")||this.operator.startsWith("<")&&m.operator.startsWith("<")||this.semver.version===m.semver.version&&this.operator.includes("=")&&m.operator.includes("=")||f(this.semver,"<",m.semver,l)&&this.operator.startsWith(">")&&m.operator.startsWith("<")||f(this.semver,">",m.semver,l)&&this.operator.startsWith("<")&&m.operator.startsWith(">")))}}Xf=e;const r=Tp(),{safeRe:i,t:s}=Yo(),f=O8(),n=uc(),v=Rr(),b=vi();return Xf}o(fc,"requireComparator");var Wf,A1;function dc(){if(A1)return Wf;A1=1;const t=vi();return Wf=o((r,i,s)=>{try{i=new t(i,s)}catch{return!1}return i.test(r)},"satisfies"),Wf}o(dc,"requireSatisfies");var $f,k1;function HR(){if(k1)return $f;k1=1;const t=vi();return $f=o((r,i)=>new t(r,i).set.map(s=>s.map(f=>f.value).join(" ").trim().split(" ")),"toComparators"),$f}o(HR,"requireToComparators");var Jf,N1;function VR(){if(N1)return Jf;N1=1;const t=Rr(),e=vi();return Jf=o((i,s,f)=>{let n=null,v=null,b=null;try{b=new e(s,f)}catch{return null}return i.forEach(h=>{b.test(h)&&(!n||v.compare(h)===-1)&&(n=h,v=new t(n,f))}),n},"maxSatisfying"),Jf}o(VR,"requireMaxSatisfying");var qf,C1;function ZR(){if(C1)return qf;C1=1;const t=Rr(),e=vi();return qf=o((i,s,f)=>{let n=null,v=null,b=null;try{b=new e(s,f)}catch{return null}return i.forEach(h=>{b.test(h)&&(!n||v.compare(h)===1)&&(n=h,v=new t(n,f))}),n},"minSatisfying"),qf}o(ZR,"requireMinSatisfying");var ed,R1;function GR(){if(R1)return ed;R1=1;const t=Rr(),e=vi(),r=cc();return ed=o((s,f)=>{s=new e(s,f);let n=new t("0.0.0");if(s.test(n)||(n=new t("0.0.0-0"),s.test(n)))return n;n=null;for(let v=0;v<s.set.length;++v){const b=s.set[v];let h=null;b.forEach(m=>{const l=new t(m.semver.version);switch(m.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!h||r(l,h))&&(h=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${m.operator}`)}}),h&&(!n||r(n,h))&&(n=h)}return n&&s.test(n)?n:null},"minVersion"),ed}o(GR,"requireMinVersion");var td,I1;function YR(){if(I1)return td;I1=1;const t=vi();return td=o((r,i)=>{try{return new t(r,i).range||"*"}catch{return null}},"validRange"),td}o(YR,"requireValid");var rd,O1;function Bp(){if(O1)return rd;O1=1;const t=Rr(),e=fc(),{ANY:r}=e,i=vi(),s=dc(),f=cc(),n=jp(),v=Dp(),b=Lp();return rd=o((m,l,w,p)=>{m=new t(m,p),l=new i(l,p);let y,M,E,R,I;switch(w){case">":y=f,M=v,E=n,R=">",I=">=";break;case"<":y=n,M=b,E=f,R="<",I="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(m,l,p))return!1;for(let T=0;T<l.set.length;++T){const P=l.set[T];let j=null,L=null;if(P.forEach(U=>{U.semver===r&&(U=new e(">=0.0.0")),j=j||U,L=L||U,y(U.semver,j.semver,p)?j=U:E(U.semver,L.semver,p)&&(L=U)}),j.operator===R||j.operator===I||(!L.operator||L.operator===R)&&M(m,L.semver))return!1;if(L.operator===I&&E(m,L.semver))return!1}return!0},"outside"),rd}o(Bp,"requireOutside");var id,T1;function QR(){if(T1)return id;T1=1;const t=Bp();return id=o((r,i,s)=>t(r,i,">",s),"gtr"),id}o(QR,"requireGtr");var nd,P1;function KR(){if(P1)return nd;P1=1;const t=Bp();return nd=o((r,i,s)=>t(r,i,"<",s),"ltr"),nd}o(KR,"requireLtr");var sd,j1;function XR(){if(j1)return sd;j1=1;const t=vi();return sd=o((r,i,s)=>(r=new t(r,s),i=new t(i,s),r.intersects(i,s)),"intersects"),sd}o(XR,"requireIntersects");var ad,L1;function WR(){if(L1)return ad;L1=1;const t=dc(),e=gi();return ad=o((r,i,s)=>{const f=[];let n=null,v=null;const b=r.sort((w,p)=>e(w,p,s));for(const w of b)t(w,i,s)?(v=w,n||(n=w)):(v&&f.push([n,v]),v=null,n=null);n&&f.push([n,null]);const h=[];for(const[w,p]of f)w===p?h.push(w):!p&&w===b[0]?h.push("*"):p?w===b[0]?h.push(`<=${p}`):h.push(`${w} - ${p}`):h.push(`>=${w}`);const m=h.join(" || "),l=typeof i.raw=="string"?i.raw:String(i);return m.length<l.length?m:i},"simplify"),ad}o(WR,"requireSimplify");var od,D1;function $R(){if(D1)return od;D1=1;const t=vi(),e=fc(),{ANY:r}=e,i=dc(),s=gi(),f=o((l,w,p={})=>{if(l===w)return!0;l=new t(l,p),w=new t(w,p);let y=!1;e:for(const M of l.set){for(const E of w.set){const R=b(M,E,p);if(y=y||R!==null,R)continue e}if(y)return!1}return!0},"subset"),n=[new e(">=0.0.0-0")],v=[new e(">=0.0.0")],b=o((l,w,p)=>{if(l===w)return!0;if(l.length===1&&l[0].semver===r){if(w.length===1&&w[0].semver===r)return!0;p.includePrerelease?l=n:l=v}if(w.length===1&&w[0].semver===r){if(p.includePrerelease)return!0;w=v}const y=new Set;let M,E;for(const Z of l)Z.operator===">"||Z.operator===">="?M=h(M,Z,p):Z.operator==="<"||Z.operator==="<="?E=m(E,Z,p):y.add(Z.semver);if(y.size>1)return null;let R;if(M&&E){if(R=s(M.semver,E.semver,p),R>0)return null;if(R===0&&(M.operator!==">="||E.operator!=="<="))return null}for(const Z of y){if(M&&!i(Z,String(M),p)||E&&!i(Z,String(E),p))return null;for(const ne of w)if(!i(Z,String(ne),p))return!1;return!0}let I,T,P,j,L=E&&!p.includePrerelease&&E.semver.prerelease.length?E.semver:!1,U=M&&!p.includePrerelease&&M.semver.prerelease.length?M.semver:!1;L&&L.prerelease.length===1&&E.operator==="<"&&L.prerelease[0]===0&&(L=!1);for(const Z of w){if(j=j||Z.operator===">"||Z.operator===">=",P=P||Z.operator==="<"||Z.operator==="<=",M){if(U&&Z.semver.prerelease&&Z.semver.prerelease.length&&Z.semver.major===U.major&&Z.semver.minor===U.minor&&Z.semver.patch===U.patch&&(U=!1),Z.operator===">"||Z.operator===">="){if(I=h(M,Z,p),I===Z&&I!==M)return!1}else if(M.operator===">="&&!i(M.semver,String(Z),p))return!1}if(E){if(L&&Z.semver.prerelease&&Z.semver.prerelease.length&&Z.semver.major===L.major&&Z.semver.minor===L.minor&&Z.semver.patch===L.patch&&(L=!1),Z.operator==="<"||Z.operator==="<="){if(T=m(E,Z,p),T===Z&&T!==E)return!1}else if(E.operator==="<="&&!i(E.semver,String(Z),p))return!1}if(!Z.operator&&(E||M)&&R!==0)return!1}return!(M&&P&&!E&&R!==0||E&&j&&!M&&R!==0||U||L)},"simpleSubset"),h=o((l,w,p)=>{if(!l)return w;const y=s(l.semver,w.semver,p);return y>0?l:y<0||w.operator===">"&&l.operator===">="?w:l},"higherGT"),m=o((l,w,p)=>{if(!l)return w;const y=s(l.semver,w.semver,p);return y<0?l:y>0||w.operator==="<"&&l.operator==="<="?w:l},"lowerLT");return od=f,od}o($R,"requireSubset");var ld,B1;function JR(){if(B1)return ld;B1=1;const t=Yo(),e=lc(),r=Rr(),i=C8(),s=ia(),f=NR(),n=CR(),v=RR(),b=IR(),h=OR(),m=TR(),l=PR(),w=jR(),p=gi(),y=LR(),M=DR(),E=Pp(),R=BR(),I=zR(),T=cc(),P=jp(),j=R8(),L=I8(),U=Lp(),Z=Dp(),ne=O8(),F=FR(),Y=fc(),a=vi(),g=dc(),u=HR(),d=VR(),x=ZR(),A=GR(),N=YR(),S=Bp(),c=QR(),_=KR(),C=XR(),O=WR(),D=$R();return ld={parse:s,valid:f,clean:n,inc:v,diff:b,major:h,minor:m,patch:l,prerelease:w,compare:p,rcompare:y,compareLoose:M,compareBuild:E,sort:R,rsort:I,gt:T,lt:P,eq:j,neq:L,gte:U,lte:Z,cmp:ne,coerce:F,Comparator:Y,Range:a,satisfies:g,toComparators:u,maxSatisfying:d,minSatisfying:x,minVersion:A,validRange:N,outside:S,gtr:c,ltr:_,intersects:C,simplifyRange:O,subset:D,SemVer:r,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:i.compareIdentifiers,rcompareIdentifiers:i.rcompareIdentifiers},ld}o(JR,"requireSemver");var qR=JR();const eI=fu(qR);function tI(){const{toast:t}=Wt(),{data:e}=x8();async function r(s){const f=`https://api.github.com/repos/${s}/releases/latest`;try{const n=await fetch(f,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"fetch-latest-release"}});if(!n.ok)throw new Error(`Failed to fetch latest release: ${n.status} ${n.statusText}`);return(await n.json()).tag_name}catch{}}o(r,"getLatestRelease");const i=V.useCallback(async()=>{try{const s=await r("elizaos/eliza"),f=e?.version;s&&f&&eI.gt(s.replace("v",""),f.replace("v",""))&&t({variant:"default",title:`New version ${s} is available.`,description:"Visit GitHub for more information.",action:k.jsx(vu,{to:"https://github.com/elizaos/eliza/releases",target:"_blank",children:k.jsx(E8,{altText:"Update",children:"Update"})})})}catch(s){Ge.error(`Unable to retrieve latest version from GitHub: ${s}`)}},[t,e?.version]);return V.useEffect(()=>{i()},[i]),null}o(tI,"useVersion");const rI=o(({text:t})=>{const[e,r]=V.useState(!1),i=o(()=>{navigator.clipboard.writeText(t).then(()=>{r(!0),setTimeout(()=>r(!1),2e3)})},"handleCopy");return k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{onClick:i,variant:"ghost",size:"icon",className:"flex items-center space-x-2 text-muted-foreground",children:e?k.jsx(zs,{className:"size-3"}):k.jsx(hn,{className:"size-3"})})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:"Copy"})})]})},"CopyButton"),iI=o(({onClick:t})=>k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{onClick:t,variant:"ghost",size:"icon",className:"text-muted-foreground",children:k.jsx(rs,{className:"size-3"})})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:"Delete"})})]}),"DeleteButton");function nI({onClick:t,className:e}){return k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{variant:"ghost",size:"icon",className:`text-muted-foreground ${e}`,onClick:t,children:k.jsx(u4,{className:"size-3"})})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:"Retry message"})})]})}o(nI,"RetryButton");const sI=o(t=>{const e=[/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([^&\n?#]+)/,/youtube\.com\/watch\?.*v=([^&\n?#]+)/];for(const r of e){const i=t.match(r);if(i)return i[1]}return null},"getYouTubeId"),aI=o(t=>{const e=t.match(/spotify\.com\/(track|album|playlist|episode|show)\/([a-zA-Z0-9]+)(?:\?.*)?/);return e?{type:e[1],id:e[2]}:null},"getSpotifyId"),oI=o(t=>/\.(jpg|jpeg|png|gif|webp|svg|bmp|ico)(\?.*)?$/i.test(t),"isImageUrl$1"),lI=o(t=>/\.(mp4|webm|ogg|mov|avi|wmv|flv|mkv)(\?.*)?$/i.test(t),"isVideoUrl"),uI=o(t=>/\.(mp3|wav|ogg|aac|flac|m4a|wma)(\?.*)?$/i.test(t),"isAudioUrl"),cI=o(t=>/\.pdf(\?.*)?$/i.test(t)||t.includes("pdf"),"isPdfUrl"),fI=o(t=>/\.(pdf|doc|docx|ppt|pptx|xls|xlsx|txt)(\?.*)?$/i.test(t),"isDocumentUrl");function z1({url:t,title:e,className:r,maxWidth:i=600,maxHeight:s=400}){const[f,n]=V.useState(!0),[v,b]=V.useState(!1),h=o(()=>n(!1),"handleLoad"),m=o(()=>{n(!1),b(!0)},"handleError"),l=sI(t);if(l)return k.jsxs("div",{className:He("relative rounded-lg overflow-hidden bg-muted",r),style:{maxWidth:i,maxHeight:s},children:[f&&k.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:k.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[k.jsx(xh,{className:"w-6 h-6"}),k.jsx("span",{children:"Loading video..."})]})}),k.jsx("iframe",{src:`https://www.youtube.com/embed/${l}`,title:e||"YouTube video",className:"w-full aspect-video",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,onLoad:h,onError:m})]});const w=aI(t);if(w){const p=w.type==="track"?152:w.type==="episode"?232:352;return k.jsxs("div",{className:He("relative rounded-lg overflow-hidden bg-muted",r),style:{maxWidth:i},children:[f&&k.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:k.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[k.jsx(xd,{className:"w-6 h-6"}),k.jsx("span",{children:"Loading Spotify content..."})]})}),k.jsx("iframe",{src:`https://open.spotify.com/embed/${w.type}/${w.id}?utm_source=generator`,width:"100%",height:p,frameBorder:"0",allow:"autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture",loading:"lazy",title:e||"Spotify content",onLoad:h,onError:m})]})}return oI(t)?k.jsxs("div",{className:He("relative rounded-lg overflow-hidden bg-muted",r),style:{maxWidth:i,maxHeight:s},children:[f&&k.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:k.jsx("div",{className:"animate-pulse w-full h-32 bg-muted-foreground/20 rounded"})}),v?k.jsxs("div",{className:"flex items-center justify-center p-4 text-muted-foreground",children:[k.jsx(Xr,{className:"w-6 h-6 mr-2"}),k.jsx("span",{children:"Failed to load image"})]}):k.jsx("img",{src:t||"/placeholder.svg",alt:e||"Image",width:i,height:s,className:"w-full h-auto object-contain",onLoad:h,onError:m})]}):lI(t)?k.jsx("div",{className:He("relative rounded-lg overflow-hidden bg-muted",r),style:{maxWidth:i,maxHeight:s},children:v?k.jsxs("div",{className:"flex items-center justify-center p-4 text-muted-foreground",children:[k.jsx(Xr,{className:"w-6 h-6 mr-2"}),k.jsx("span",{children:"Failed to load video"})]}):k.jsxs("video",{controls:!0,preload:"metadata",className:"w-full h-auto",onLoadedData:h,onError:m,crossOrigin:"anonymous",children:[k.jsx("source",{src:t}),"Your browser does not support the video tag."]})}):uI(t)?k.jsxs("div",{className:He("relative rounded-lg bg-card border p-4",r),style:{maxWidth:i},children:[k.jsxs("div",{className:"flex items-center space-x-3 mb-3 overflow-hidden",children:[k.jsx(xd,{className:"w-5 h-5 text-muted-foreground"}),k.jsx("span",{className:"text-sm text-primary font-medium truncate whitespace-nowrap overflow-hidden text-ellipsis max-w-44",children:e||"Audio File"})]}),v?k.jsxs("div",{className:"flex items-center text-muted-foreground",children:[k.jsx(Xr,{className:"w-4 h-4 mr-2"}),k.jsx("span",{className:"text-sm",children:"Failed to load audio"})]}):k.jsxs("audio",{controls:!0,className:"w-full",preload:"metadata",onLoadedData:h,onError:m,crossOrigin:"anonymous",children:[k.jsx("source",{src:t}),"Your browser does not support the audio tag."]})]}):cI(t)?k.jsxs("div",{className:He("relative rounded-lg overflow-hidden bg-card border",r),style:{maxWidth:i},children:[k.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 border-b gap-10",children:[k.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[k.jsx(Kn,{className:"w-5 h-5 text-muted-foreground"}),k.jsx("span",{className:"text-sm text-primary font-medium truncate whitespace-nowrap overflow-hidden text-ellipsis max-w-44",children:e||"PDF Document"})]}),k.jsxs("div",{className:"flex items-center space-x-2",children:[k.jsxs("a",{href:`https://docs.google.com/viewer?url=${encodeURIComponent(t)}&embedded=true`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-1 text-primary hover:text-primary/80 text-sm",children:[k.jsx(Ta,{className:"w-4 h-4"}),k.jsx("span",{children:"View"})]}),k.jsxs("a",{href:t,download:!0,className:"flex items-center space-x-1 text-primary hover:text-primary/80 text-sm",children:[k.jsx(Gv,{className:"w-4 h-4"}),k.jsx("span",{children:"Download"})]})]})]}),k.jsx("div",{className:"relative",style:{height:Math.min(s,500)},children:v?k.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-muted-foreground h-full",children:[k.jsx(Xr,{className:"w-8 h-8 mb-2"}),k.jsx("span",{className:"text-center mb-4",children:"PDF preview not available"}),k.jsxs("div",{className:"flex space-x-2",children:[k.jsx("a",{href:`https://docs.google.com/viewer?url=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-2 bg-primary text-primary-foreground rounded text-sm hover:bg-primary/90",children:"Open in Google Viewer"}),k.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"px-3 py-2 bg-secondary text-secondary-foreground rounded text-sm hover:bg-secondary/90",children:"Open Original"})]})]}):k.jsxs(k.Fragment,{children:[f&&k.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:k.jsxs("div",{className:"flex items-center space-x-2 text-muted-foreground",children:[k.jsx(Kn,{className:"w-6 h-6"}),k.jsx("span",{children:"Loading PDF..."})]})}),k.jsx("iframe",{src:`https://docs.google.com/viewer?url=${encodeURIComponent(t)}&embedded=true`,className:"w-full h-full border-0",title:e||"PDF Document",onLoad:h,onError:o(()=>{const p=document.createElement("iframe");p.src=`${t}#toolbar=0&navpanes=0&scrollbar=0`,p.className="w-full h-full border-0",p.title=e||"PDF Document",p.onload=h,p.onerror=m;const y=document.querySelector(`[data-pdf-container="${t}"]`);y&&(y.innerHTML="",y.appendChild(p))},"onError")}),k.jsx("div",{"data-pdf-container":t,className:"hidden"})]})}),k.jsx("div",{className:"p-2 bg-muted/50 border-t text-xs text-muted-foreground",children:k.jsx("span",{children:`PDF Document • Click "View" or "Download" if preview doesn't load`})})]}):fI(t)?k.jsx("div",{className:He("rounded-lg bg-card border p-4",r),style:{maxWidth:i},children:k.jsxs("div",{className:"flex items-center space-x-3",children:[k.jsx(Kn,{className:"w-8 h-8 text-muted-foreground"}),k.jsxs("div",{className:"flex-1 overflow-hidden mr-6",children:[k.jsx("p",{className:"text-sm text-primary font-medium truncate whitespace-nowrap overflow-hidden text-ellipsis max-w-44",children:e||"Document"}),k.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.split(".").pop()?.toUpperCase()," file"]})]}),k.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-1 text-primary hover:text-primary/80 text-sm font-medium",children:[k.jsx(Ta,{className:"w-4 h-4"}),k.jsx("span",{children:"Open"})]})]})}):k.jsx("div",{className:He("rounded-lg bg-card border p-4",r),style:{maxWidth:i},children:k.jsxs("div",{className:"flex items-center space-x-3",children:[k.jsx(Ta,{className:"w-8 h-8 text-muted-foreground"}),k.jsxs("div",{className:"flex-1",children:[k.jsx("p",{className:"text-sm text-primary font-medium",children:e||"External Link"}),k.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t})]}),k.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"flex items-center space-x-1 text-primary hover:text-primary/80 text-sm font-medium",children:[k.jsx(Ta,{className:"w-4 h-4"}),k.jsx("span",{children:"Open"})]})]})})}o(z1,"MediaContent");function na(){wr(),br();const{toast:t}=Wt(),e=XC(),r=WC(),[i,s]=V.useState([]),[f,n]=V.useState([]);return{startAgent:o(async l=>{if(!l.id){t({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const w=l.id;if(!i.includes(w))try{s(p=>[...p,w]),await e.mutateAsync(w)}catch(p){console.error("Failed to start agent:",p)}finally{s(p=>p.filter(y=>y!==w))}},"startAgent"),stopAgent:o(async l=>{if(!l.id){t({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const w=l.id;if(!f.includes(w))try{n(p=>[...p,w]),await r.mutateAsync(w),t({title:"Agent Stopped",description:`${l.name} has been stopped`})}catch(p){console.error("Failed to stop agent:",p)}finally{n(p=>p.filter(y=>y!==w))}},"stopAgent"),isAgentStarting:o(l=>l?i.includes(l):!1,"isAgentStarting"),isAgentStopping:o(l=>l?f.includes(l):!1,"isAgentStopping"),startingAgents:i,stoppingAgents:f}}o(na,"useAgentManagement");function dI({agent:t,variant:e="destructive",size:r="default",className:i="",showIcon:s=!0,redirectToHome:f=!1,onStopComplete:n}){const{stopAgent:v,isAgentStopping:b}=na(),h=wr(),m=b(t.id),{confirm:l,isOpen:w,onOpenChange:p,onConfirm:y,options:M}=gs(),E=o(()=>{l({title:"Stop Agent",description:`Are you sure you want to stop "${t.name}"?`,confirmText:"Stop",variant:"destructive"},async()=>{try{await v(t),n&&n(),f&&h("/")}catch(R){Ge.error("Error stopping agent:",R)}})},"handleStopAgent");return k.jsxs(k.Fragment,{children:[k.jsx($e,{type:"button",variant:e,size:r,className:i,onClick:E,disabled:m,children:m?k.jsxs(k.Fragment,{children:[s&&k.jsx(Ar,{className:"mr-2 h-4 w-4 animate-spin"}),"Stopping..."]}):k.jsxs(k.Fragment,{children:[s&&k.jsx(c4,{className:"mr-2 h-4 w-4"}),"Stop"]})}),k.jsx(ms,{open:w,onOpenChange:p,title:M?.title||"",description:M?.description||"",confirmText:M?.confirmText,cancelText:M?.cancelText,variant:M?.variant,onConfirm:y})]})}o(dI,"StopAgentButton");function T8({isOpen:t,onClose:e,agentId:r}){if(!t)return null;const{startAgent:i,isAgentStarting:s,isAgentStopping:f}=na(),{toast:n}=Wt(),v=wr(),{data:b}=Go(r),h=b?.data,m=h?.status===pr.ACTIVE,l=s(r),w=f(r),p=l||w,y={label:"Start",icon:k.jsx(xh,{className:"w-4 h-4"})};l&&(y.label="Starting...",y.icon=k.jsx(Ar,{className:"animate-spin w-4 h-4"}));const M=o(()=>{p||i(h)},"handleAgentStart"),E=o(()=>{if(!b?.data)return;const R={...b.data,createdAt:b.data.createdAt||Date.now(),updatedAt:b.data.updatedAt||Date.now()};Ih(R,n)},"handleExportCharacter");return k.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4 backdrop-blur-sm",onClick:e,onKeyUp:o(R=>{(R.key==="Enter"||R.key===" ")&&e()},"onKeyUp"),children:k.jsxs(Oi,{className:"flex flex-col w-full max-w-md md:max-w-xl overflow-hidden relative",onClick:o(R=>R.stopPropagation(),"onClick"),children:[k.jsxs(ac,{className:"p-0 space-y-0",children:[k.jsx("div",{className:"absolute top-4 right-4 z-10",children:k.jsx($e,{variant:"ghost",size:"icon",onClick:e,children:k.jsx(Vr,{className:"w-5 h-5"})})}),k.jsx("div",{className:"p-6 w-full flex items-end bg-gradient-to-b from-primary/20 to-background",children:k.jsx("div",{className:"flex w-full justify-between items-end",children:k.jsxs("div",{className:"flex flex-col gap-2",children:[k.jsxs("div",{className:"w-24 h-24 flex justify-center items-center relative",children:[k.jsx("div",{className:"text-4xl bg-muted rounded-full h-full w-full flex justify-center items-center overflow-hidden border-4 border-background",children:typeof h?.settings?.avatar=="string"?k.jsx("img",{src:h.settings.avatar,alt:"Agent Avatar",className:"w-full h-full object-cover"}):ns(h?.name??"")}),k.jsx("div",{className:`absolute bottom-1 right-1 w-4 h-4 rounded-full border-2 border-background ${m?"bg-emerald-500":"bg-muted-foreground"}`})]}),k.jsxs("div",{className:"flex flex-col justify-center mr-4",children:[k.jsx("div",{className:"text-xl font-bold truncate max-w-48",children:h?.name}),k.jsx("div",{className:"text-xs text-muted-foreground",children:k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsxs("span",{className:"cursor-pointer hover:underline",onClick:o(R=>{R.stopPropagation(),h?.id&&navigator.clipboard.writeText(h.id)},"onClick"),onKeyUp:o(R=>{(R.key==="Enter"||R.key===" ")&&(R.stopPropagation(),h?.id&&navigator.clipboard.writeText(h.id))},"onKeyUp"),children:["ID: ",h?.id??"N/A"]})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:"Click to copy agent ID"})})]})})]})]})})})]}),k.jsxs(vs,{className:"p-6 overflow-auto",children:[k.jsxs("div",{className:"rounded-md bg-muted p-4 mb-6 max-h-60 overflow-y-auto",children:[k.jsx("p",{className:"font-medium text-sm mb-2",children:"About Me"}),k.jsx("p",{className:"font-light text-sm text-gray-500",children:b?.data?.system})]}),k.jsxs("div",{className:"space-y-6",children:[k.jsxs("div",{children:[k.jsx("p",{className:"font-medium text-sm mb-2",children:"Status"}),k.jsxs("div",{className:"flex items-center",children:[k.jsx("div",{className:`w-3 h-3 rounded-full mr-2 ${m?"bg-green-500":"bg-gray-400"}`}),k.jsx("span",{className:"text-sm",children:m?"Active":"Inactive"})]})]}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium text-sm mb-2",children:"Model"}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(Ll,{className:"w-4 h-4 text-muted-foreground"}),k.jsx("span",{className:"text-sm",children:typeof h?.settings?.model=="string"?h.settings.model:h?.settings?.model!==void 0?String(h.settings.model):"Default"})]})]}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium text-sm mb-2",children:"Created"}),k.jsx("p",{className:"text-sm text-gray-500",children:h?.createdAt?Xn(h.createdAt).format("LLL"):Xn().format("LLL")})]}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium text-sm mb-2",children:"Plugins"}),k.jsx("div",{className:"flex flex-wrap gap-2",children:h?.plugins&&h.plugins.length>0?h.plugins.map((R,I)=>{const T=R.replace("@elizaos/plugin-","").replace("@elizaos-plugins/plugin-","");return k.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-muted text-muted-foreground border border-border",children:T},I)}):k.jsx("p",{className:"text-sm text-gray-500",children:"No plugins enabled"})})]})]})]}),k.jsxs(oc,{className:"flex justify-between items-center p-4 border-t",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[m?k.jsx(dI,{agent:h,showIcon:!0,size:"default",className:"h-9"}):k.jsxs($e,{variant:"default",onClick:M,disabled:p,className:"h-9",children:[y.icon,k.jsx("span",{className:"ml-2",children:y.label})]}),k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsxs($e,{variant:"outline",onClick:E,disabled:!h,className:"h-9",size:"sm",children:["Export",k.jsx(Gv,{size:16})]})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:"Export character as JSON"})})]}),k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsxs($e,{variant:"outline",onClick:o(()=>v(`/settings/${r}`),"onClick"),disabled:!h,className:"h-9",size:"sm",children:[k.jsx(is,{size:16,className:"mr-1"}),"Settings"]})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:"Configure agent settings"})})]})]}),m&&k.jsx($e,{variant:"default",className:"h-9",onClick:o(()=>v(`/chat/${h.id}`),"onClick"),children:"Message"})]})]})})}o(T8,"ProfileOverlay");function hI(){return k.jsxs("svg",{role:"img","aria-label":"Loading animation",width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:"text-foreground","data-testid":"loading",children:[k.jsx("circle",{cx:"4",cy:"12",r:"2",fill:"currentColor",children:k.jsx("animate",{id:"spinner_qFRN",begin:"0;spinner_OcgL.end+0.25s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),k.jsx("circle",{cx:"12",cy:"12",r:"2",fill:"currentColor",children:k.jsx("animate",{begin:"spinner_qFRN.begin+0.1s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})}),k.jsx("circle",{cx:"20",cy:"12",r:"2",fill:"currentColor",children:k.jsx("animate",{id:"spinner_OcgL",begin:"spinner_qFRN.begin+0.2s",attributeName:"cy",calcMode:"spline",dur:"0.6s",values:"12;6;12",keySplines:".33,.66,.66,1;.33,0,.66,.33"})})]})}o(hI,"MessageLoading");const pI=sn("flex gap-2 max-w-[60%] relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),P8=V.forwardRef(({className:t,variant:e,layout:r,children:i,...s},f)=>k.jsx("div",{className:He(pI({variant:e,layout:r,className:t}),"relative group"),ref:f,...s,children:V.Children.map(i,n=>V.isValidElement(n)&&typeof n.type!="string"&&n.type!==V.Fragment?V.cloneElement(n,{variant:e,layout:r}):n)}));P8.displayName="ChatBubble";const mI=sn("",{variants:{variant:{received:"text-secondary-foreground",sent:"px-5 py-2.5 bg-secondary text-secondary-foreground rounded-lg"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),j8=V.forwardRef(({className:t,variant:e,layout:r,isLoading:i=!1,children:s,...f},n)=>k.jsx("div",{className:He(mI({variant:e,layout:r,className:t}),"break-words max-w-full whitespace-pre-wrap"),ref:n,...f,children:i?k.jsx("div",{className:"flex items-center space-x-2",children:k.jsx(hI,{})}):s}));j8.displayName="ChatBubbleMessage";const gI=o(({timestamp:t,className:e,...r})=>k.jsx("div",{className:He("text-xs text-right select-none",e),...r,children:t}),"ChatBubbleTimestamp"),vI=V.forwardRef(({variant:t,className:e,children:r,...i},s)=>k.jsx("div",{ref:s,className:He("absolute top-1/2 -translate-y-1/2 flex opacity-0 group-hover:opacity-100 transition-opacity duration-200",t==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",e),...i,children:r}));vI.displayName="ChatBubbleActionWrapper";let Yi=null;function bI({agentId:t,text:e}){const{toast:r}=Wt(),[i,s]=V.useState(!1),[f,n]=V.useState(null),[v,b]=V.useState(null),h=V.useRef(null),m=V.useRef(null),l=Xt();V.useEffect(()=>()=>{v&&URL.revokeObjectURL(v)},[v]);const w=Fr({mutationKey:["tts",e],mutationFn:o(async()=>{console.log("🎵 Starting TTS API call..."),console.log("🎵 agentId:",t),console.log("🎵 text:",e);const R=await l.audio.generateSpeech(t,{text:e});console.log("🎵 TTS API response:",R);const{audio:I,format:T}=R;let P,j;if(I.startsWith("data:")){const[Z,ne]=I.split(","),F=Z.match(/data:([^;]+)/);j=F?F[1]:`audio/${T||"mpeg"}`,P=ne}else P=I,j=`audio/${T||"mpeg"}`;const L=atob(P),U=new Uint8Array(L.length);for(let Z=0;Z<L.length;Z++)U[Z]=L.charCodeAt(Z);return new Blob([U],{type:j})},"mutationFn"),onSuccess:o(R=>{n(R),m.current=R;const I=URL.createObjectURL(R);b(I),setTimeout(()=>{p()},100)},"onSuccess"),onError:o(R=>{r({variant:"destructive",title:"Unable to read message aloud",description:R.message})},"onError")}),p=o(async()=>{if(h.current)try{Yi&&Yi!==h.current&&(Yi.pause(),Yi.currentTime=0),Yi=h.current,h.current.volume=1,h.current.muted=!1,await h.current.play(),s(!0)}catch(R){r({variant:"destructive",title:"Audio playback failed",description:R.message}),s(!1)}},"play"),y=o(()=>{h.current&&(h.current.pause(),h.current.currentTime=0,Yi===h.current&&(Yi=null)),s(!1)},"stop"),M=o(async()=>{if(w?.isPending)return;if(i){y();return}if(f||m.current||h.current?.src&&h.current.src.startsWith("blob:")){await p();return}w.mutate()},"execute"),E="text-muted-foreground size-3";return k.jsxs(k.Fragment,{children:[f?k.jsx("audio",{crossOrigin:"anonymous",playsInline:!0,ref:h,src:v||"",onEnded:o(()=>{s(!1),Yi===h.current&&(Yi=null)},"onEnded"),children:"Your browser does not support the audio element."}):null,k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{size:"icon",variant:"ghost",type:"button",onClick:o(()=>M(),"onClick"),disabled:w?.isPending,children:w?.isPending?k.jsx(Yv,{className:E}):i?k.jsx(bh,{className:E}):k.jsx(xd,{className:E})})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:i?"Stop":"Read aloud"})})]})]})}o(bI,"ChatTtsButton");function F1(t,e){const r=String(t);if(typeof e!="string")throw new TypeError("Expected character");let i=0,s=r.indexOf(e);for(;s!==-1;)i++,s=r.indexOf(e,s+e.length);return i}o(F1,"ccount");function yI(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}o(yI,"escapeStringRegexp");function wI(t,e,r){const s=Qv((r||{}).ignore||[]),f=xI(e);let n=-1;for(;++n<f.length;)f4(t,"text",v);function v(h,m){let l=-1,w;for(;++l<m.length;){const p=m[l],y=w?w.children:void 0;if(s(p,y?y.indexOf(p):void 0,w))return;w=p}if(w)return b(h,m)}o(v,"visitor");function b(h,m){const l=m[m.length-1],w=f[n][0],p=f[n][1];let y=0;const E=l.children.indexOf(h);let R=!1,I=[];w.lastIndex=0;let T=w.exec(h.value);for(;T;){const P=T.index,j={index:T.index,input:T.input,stack:[...m,h]};let L=p(...T,j);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?w.lastIndex=P+1:(y!==P&&I.push({type:"text",value:h.value.slice(y,P)}),Array.isArray(L)?I.push(...L):L&&I.push(L),y=P+T[0].length,R=!0),!w.global)break;T=w.exec(h.value)}return R?(y<h.value.length&&I.push({type:"text",value:h.value.slice(y)}),l.children.splice(E,1,...I)):I=[h],E+I.length}o(b,"handler")}o(wI,"findAndReplace");function xI(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!t[0]||Array.isArray(t[0])?t:[t];let i=-1;for(;++i<r.length;){const s=r[i];e.push([_I(s[0]),MI(s[1])])}return e}o(xI,"toPairs");function _I(t){return typeof t=="string"?new RegExp(yI(t),"g"):t}o(_I,"toExpression");function MI(t){return typeof t=="function"?t:function(){return t}}o(MI,"toFunction");const ud="phrasing",cd=["autolink","link","image","label"];function SI(){return{transforms:[II],enter:{literalAutolink:AI,literalAutolinkEmail:fd,literalAutolinkHttp:fd,literalAutolinkWww:fd},exit:{literalAutolink:RI,literalAutolinkEmail:CI,literalAutolinkHttp:kI,literalAutolinkWww:NI}}}o(SI,"gfmAutolinkLiteralFromMarkdown");function EI(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:ud,notInConstruct:cd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:ud,notInConstruct:cd},{character:":",before:"[ps]",after:"\\/",inConstruct:ud,notInConstruct:cd}]}}o(EI,"gfmAutolinkLiteralToMarkdown");function AI(t){this.enter({type:"link",title:null,url:"",children:[]},t)}o(AI,"enterLiteralAutolink");function fd(t){this.config.enter.autolinkProtocol.call(this,t)}o(fd,"enterLiteralAutolinkValue");function kI(t){this.config.exit.autolinkProtocol.call(this,t)}o(kI,"exitLiteralAutolinkHttp");function NI(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];Xs(e.type==="link"),e.url="http://"+this.sliceSerialize(t)}o(NI,"exitLiteralAutolinkWww");function CI(t){this.config.exit.autolinkEmail.call(this,t)}o(CI,"exitLiteralAutolinkEmail");function RI(t){this.exit(t)}o(RI,"exitLiteralAutolink");function II(t){wI(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,OI],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,TI]],{ignore:["link","linkReference"]})}o(II,"transformGfmAutolinkLiterals");function OI(t,e,r,i,s){let f="";if(!L8(s)||(/^w/i.test(e)&&(r=e+r,e="",f="http://"),!PI(r)))return!1;const n=jI(r+i);if(!n[0])return!1;const v={type:"link",title:null,url:f+e+n[0],children:[{type:"text",value:e+n[0]}]};return n[1]?[v,{type:"text",value:n[1]}]:v}o(OI,"findUrl");function TI(t,e,r,i){return!L8(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+r,children:[{type:"text",value:e+"@"+r}]}}o(TI,"findEmail");function PI(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}o(PI,"isCorrectDomain");function jI(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let r=e[0],i=r.indexOf(")");const s=F1(t,"(");let f=F1(t,")");for(;i!==-1&&s>f;)t+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),f++;return[t,r]}o(jI,"splitUrl");function L8(t,e){const r=t.input.charCodeAt(t.index-1);return(t.index===0||Fs(r)||_h(r))&&(!e||r!==47)}o(L8,"previous");D8.peek=ZI;function LI(){this.buffer()}o(LI,"enterFootnoteCallString");function DI(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}o(DI,"enterFootnoteCall");function BI(){this.buffer()}o(BI,"enterFootnoteDefinitionLabelString");function zI(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}o(zI,"enterFootnoteDefinition");function FI(t){const e=this.resume(),r=this.stack[this.stack.length-1];Xs(r.type==="footnoteReference"),r.identifier=Oo(this.sliceSerialize(t)).toLowerCase(),r.label=e}o(FI,"exitFootnoteCallString");function UI(t){this.exit(t)}o(UI,"exitFootnoteCall");function HI(t){const e=this.resume(),r=this.stack[this.stack.length-1];Xs(r.type==="footnoteDefinition"),r.identifier=Oo(this.sliceSerialize(t)).toLowerCase(),r.label=e}o(HI,"exitFootnoteDefinitionLabelString");function VI(t){this.exit(t)}o(VI,"exitFootnoteDefinition");function ZI(){return"["}o(ZI,"footnoteReferencePeek");function D8(t,e,r,i){const s=r.createTracker(i);let f=s.move("[^");const n=r.enter("footnoteReference"),v=r.enter("reference");return f+=s.move(r.safe(r.associationId(t),{after:"]",before:f})),v(),n(),f+=s.move("]"),f}o(D8,"footnoteReference");function GI(){return{enter:{gfmFootnoteCallString:LI,gfmFootnoteCall:DI,gfmFootnoteDefinitionLabelString:BI,gfmFootnoteDefinition:zI},exit:{gfmFootnoteCallString:FI,gfmFootnoteCall:UI,gfmFootnoteDefinitionLabelString:HI,gfmFootnoteDefinition:VI}}}o(GI,"gfmFootnoteFromMarkdown");function YI(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:r,footnoteReference:D8},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,s,f,n){const v=f.createTracker(n);let b=v.move("[^");const h=f.enter("footnoteDefinition"),m=f.enter("label");return b+=v.move(f.safe(f.associationId(i),{before:b,after:"]"})),m(),b+=v.move("]:"),i.children&&i.children.length>0&&(v.shift(4),b+=v.move((e?`
|
|
96
|
-
`:" ")+f.indentLines(f.containerFlow(i,v.current()),e?B8:QI))),h(),b}o(r,"footnoteDefinition")}o(YI,"gfmFootnoteToMarkdown");function QI(t,e,r){return e===0?t:B8(t,e,r)}o(QI,"mapExceptFirst");function B8(t,e,r){return(r?"":" ")+t}o(B8,"mapAll");const KI=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];z8.peek=qI;function XI(){return{canContainEols:["delete"],enter:{strikethrough:$I},exit:{strikethrough:JI}}}o(XI,"gfmStrikethroughFromMarkdown");function WI(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:KI}],handlers:{delete:z8}}}o(WI,"gfmStrikethroughToMarkdown");function $I(t){this.enter({type:"delete",children:[]},t)}o($I,"enterStrikethrough");function JI(t){this.exit(t)}o(JI,"exitStrikethrough");function z8(t,e,r,i){const s=r.createTracker(i),f=r.enter("strikethrough");let n=s.move("~~");return n+=r.containerPhrasing(t,{...s.current(),before:n,after:"~"}),n+=s.move("~~"),f(),n}o(z8,"handleDelete");function qI(){return"~"}o(qI,"peekDelete");function eO(t){return t.length}o(eO,"defaultStringLength");function tO(t,e){const r=e||{},i=(r.align||[]).concat(),s=r.stringLength||eO,f=[],n=[],v=[],b=[];let h=0,m=-1;for(;++m<t.length;){const M=[],E=[];let R=-1;for(t[m].length>h&&(h=t[m].length);++R<t[m].length;){const I=rO(t[m][R]);if(r.alignDelimiters!==!1){const T=s(I);E[R]=T,(b[R]===void 0||T>b[R])&&(b[R]=T)}M.push(I)}n[m]=M,v[m]=E}let l=-1;if(typeof i=="object"&&"length"in i)for(;++l<h;)f[l]=U1(i[l]);else{const M=U1(i);for(;++l<h;)f[l]=M}l=-1;const w=[],p=[];for(;++l<h;){const M=f[l];let E="",R="";M===99?(E=":",R=":"):M===108?E=":":M===114&&(R=":");let I=r.alignDelimiters===!1?1:Math.max(1,b[l]-E.length-R.length);const T=E+"-".repeat(I)+R;r.alignDelimiters!==!1&&(I=E.length+I+R.length,I>b[l]&&(b[l]=I),p[l]=I),w[l]=T}n.splice(1,0,w),v.splice(1,0,p),m=-1;const y=[];for(;++m<n.length;){const M=n[m],E=v[m];l=-1;const R=[];for(;++l<h;){const I=M[l]||"";let T="",P="";if(r.alignDelimiters!==!1){const j=b[l]-(E[l]||0),L=f[l];L===114?T=" ".repeat(j):L===99?j%2?(T=" ".repeat(j/2+.5),P=" ".repeat(j/2-.5)):(T=" ".repeat(j/2),P=T):P=" ".repeat(j)}r.delimiterStart!==!1&&!l&&R.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&I==="")&&(r.delimiterStart!==!1||l)&&R.push(" "),r.alignDelimiters!==!1&&R.push(T),R.push(I),r.alignDelimiters!==!1&&R.push(P),r.padding!==!1&&R.push(" "),(r.delimiterEnd!==!1||l!==h-1)&&R.push("|")}y.push(r.delimiterEnd===!1?R.join("").replace(/ +$/,""):R.join(""))}return y.join(`
|
|
97
|
-
`)}o(tO,"markdownTable");function rO(t){return t==null?"":String(t)}o(rO,"serialize");function U1(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}o(U1,"toAlignment");function iO(t,e,r,i){const s=r.enter("blockquote"),f=r.createTracker(i);f.move("> "),f.shift(2);const n=r.indentLines(r.containerFlow(t,f.current()),nO);return s(),n}o(iO,"blockquote");function nO(t,e,r){return">"+(r?"":" ")+t}o(nO,"map$1");function sO(t,e){return H1(t,e.inConstruct,!0)&&!H1(t,e.notInConstruct,!1)}o(sO,"patternInScope");function H1(t,e,r){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return r;let i=-1;for(;++i<e.length;)if(t.includes(e[i]))return!0;return!1}o(H1,"listInScope");function V1(t,e,r,i){let s=-1;for(;++s<r.unsafe.length;)if(r.unsafe[s].character===`
|
|
98
|
-
`&&sO(r.stack,r.unsafe[s]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
99
|
-
`}o(V1,"hardBreak");function aO(t,e){const r=String(t);let i=r.indexOf(e),s=i,f=0,n=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===s?++f>n&&(n=f):f=1,s=i+e.length,i=r.indexOf(e,s);return n}o(aO,"longestStreak");function oO(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}o(oO,"formatCodeAsIndented");function lO(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}o(lO,"checkFence");function uO(t,e,r,i){const s=lO(r),f=t.value||"",n=s==="`"?"GraveAccent":"Tilde";if(oO(t,r)){const l=r.enter("codeIndented"),w=r.indentLines(f,cO);return l(),w}const v=r.createTracker(i),b=s.repeat(Math.max(aO(f,s)+1,3)),h=r.enter("codeFenced");let m=v.move(b);if(t.lang){const l=r.enter(`codeFencedLang${n}`);m+=v.move(r.safe(t.lang,{before:m,after:" ",encode:["`"],...v.current()})),l()}if(t.lang&&t.meta){const l=r.enter(`codeFencedMeta${n}`);m+=v.move(" "),m+=v.move(r.safe(t.meta,{before:m,after:`
|
|
100
|
-
`,encode:["`"],...v.current()})),l()}return m+=v.move(`
|
|
101
|
-
`),f&&(m+=v.move(f+`
|
|
102
|
-
`)),m+=v.move(b),h(),m}o(uO,"code$1");function cO(t,e,r){return(r?"":" ")+t}o(cO,"map");function zp(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}o(zp,"checkQuote");function fO(t,e,r,i){const s=zp(r),f=s==='"'?"Quote":"Apostrophe",n=r.enter("definition");let v=r.enter("label");const b=r.createTracker(i);let h=b.move("[");return h+=b.move(r.safe(r.associationId(t),{before:h,after:"]",...b.current()})),h+=b.move("]: "),v(),!t.url||/[\0- \u007F]/.test(t.url)?(v=r.enter("destinationLiteral"),h+=b.move("<"),h+=b.move(r.safe(t.url,{before:h,after:">",...b.current()})),h+=b.move(">")):(v=r.enter("destinationRaw"),h+=b.move(r.safe(t.url,{before:h,after:t.title?" ":`
|
|
103
|
-
`,...b.current()}))),v(),t.title&&(v=r.enter(`title${f}`),h+=b.move(" "+s),h+=b.move(r.safe(t.title,{before:h,after:s,...b.current()})),h+=b.move(s),v()),n(),h}o(fO,"definition");function dO(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}o(dO,"checkEmphasis");function Ro(t){return"&#x"+t.toString(16).toUpperCase()+";"}o(Ro,"encodeCharacterReference");function cu(t,e,r){const i=Dl(t),s=Dl(e);return i===void 0?s===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}o(cu,"encodeInfo");F8.peek=hO;function F8(t,e,r,i){const s=dO(r),f=r.enter("emphasis"),n=r.createTracker(i),v=n.move(s);let b=n.move(r.containerPhrasing(t,{after:s,before:v,...n.current()}));const h=b.charCodeAt(0),m=cu(i.before.charCodeAt(i.before.length-1),h,s);m.inside&&(b=Ro(h)+b.slice(1));const l=b.charCodeAt(b.length-1),w=cu(i.after.charCodeAt(0),l,s);w.inside&&(b=b.slice(0,-1)+Ro(l));const p=n.move(s);return f(),r.attentionEncodeSurroundingInfo={after:w.outside,before:m.outside},v+b+p}o(F8,"emphasis");function hO(t,e,r){return r.options.emphasis||"*"}o(hO,"emphasisPeek");function pO(t,e){let r=!1;return d4(t,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,h4}),!!((!t.depth||t.depth<3)&&Kv(t)&&(e.options.setext||r))}o(pO,"formatHeadingAsSetext");function mO(t,e,r,i){const s=Math.max(Math.min(6,t.depth||1),1),f=r.createTracker(i);if(pO(t,r)){const m=r.enter("headingSetext"),l=r.enter("phrasing"),w=r.containerPhrasing(t,{...f.current(),before:`
|
|
104
|
-
`,after:`
|
|
105
|
-
`});return l(),m(),w+`
|
|
106
|
-
`+(s===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
|
|
107
|
-
`))+1))}const n="#".repeat(s),v=r.enter("headingAtx"),b=r.enter("phrasing");f.move(n+" ");let h=r.containerPhrasing(t,{before:"# ",after:`
|
|
108
|
-
`,...f.current()});return/^[\t ]/.test(h)&&(h=Ro(h.charCodeAt(0))+h.slice(1)),h=h?n+" "+h:n,r.options.closeAtx&&(h+=" "+n),b(),v(),h}o(mO,"heading");U8.peek=gO;function U8(t){return t.value||""}o(U8,"html");function gO(){return"<"}o(gO,"htmlPeek");H8.peek=vO;function H8(t,e,r,i){const s=zp(r),f=s==='"'?"Quote":"Apostrophe",n=r.enter("image");let v=r.enter("label");const b=r.createTracker(i);let h=b.move("![");return h+=b.move(r.safe(t.alt,{before:h,after:"]",...b.current()})),h+=b.move("]("),v(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(v=r.enter("destinationLiteral"),h+=b.move("<"),h+=b.move(r.safe(t.url,{before:h,after:">",...b.current()})),h+=b.move(">")):(v=r.enter("destinationRaw"),h+=b.move(r.safe(t.url,{before:h,after:t.title?" ":")",...b.current()}))),v(),t.title&&(v=r.enter(`title${f}`),h+=b.move(" "+s),h+=b.move(r.safe(t.title,{before:h,after:s,...b.current()})),h+=b.move(s),v()),h+=b.move(")"),n(),h}o(H8,"image");function vO(){return"!"}o(vO,"imagePeek");V8.peek=bO;function V8(t,e,r,i){const s=t.referenceType,f=r.enter("imageReference");let n=r.enter("label");const v=r.createTracker(i);let b=v.move("![");const h=r.safe(t.alt,{before:b,after:"]",...v.current()});b+=v.move(h+"]["),n();const m=r.stack;r.stack=[],n=r.enter("reference");const l=r.safe(r.associationId(t),{before:b,after:"]",...v.current()});return n(),r.stack=m,f(),s==="full"||!h||h!==l?b+=v.move(l+"]"):s==="shortcut"?b=b.slice(0,-1):b+=v.move("]"),b}o(V8,"imageReference");function bO(){return"!"}o(bO,"imageReferencePeek");Z8.peek=yO;function Z8(t,e,r){let i=t.value||"",s="`",f=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++f<r.unsafe.length;){const n=r.unsafe[f],v=r.compilePattern(n);let b;if(n.atBreak)for(;b=v.exec(i);){let h=b.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(b.index+1)}}return s+i+s}o(Z8,"inlineCode");function yO(){return"`"}o(yO,"inlineCodePeek");function G8(t,e){const r=Kv(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(r===t.url||"mailto:"+r===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}o(G8,"formatLinkAsAutolink");Y8.peek=wO;function Y8(t,e,r,i){const s=zp(r),f=s==='"'?"Quote":"Apostrophe",n=r.createTracker(i);let v,b;if(G8(t,r)){const m=r.stack;r.stack=[],v=r.enter("autolink");let l=n.move("<");return l+=n.move(r.containerPhrasing(t,{before:l,after:">",...n.current()})),l+=n.move(">"),v(),r.stack=m,l}v=r.enter("link"),b=r.enter("label");let h=n.move("[");return h+=n.move(r.containerPhrasing(t,{before:h,after:"](",...n.current()})),h+=n.move("]("),b(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(b=r.enter("destinationLiteral"),h+=n.move("<"),h+=n.move(r.safe(t.url,{before:h,after:">",...n.current()})),h+=n.move(">")):(b=r.enter("destinationRaw"),h+=n.move(r.safe(t.url,{before:h,after:t.title?" ":")",...n.current()}))),b(),t.title&&(b=r.enter(`title${f}`),h+=n.move(" "+s),h+=n.move(r.safe(t.title,{before:h,after:s,...n.current()})),h+=n.move(s),b()),h+=n.move(")"),v(),h}o(Y8,"link");function wO(t,e,r){return G8(t,r)?"<":"["}o(wO,"linkPeek");Q8.peek=xO;function Q8(t,e,r,i){const s=t.referenceType,f=r.enter("linkReference");let n=r.enter("label");const v=r.createTracker(i);let b=v.move("[");const h=r.containerPhrasing(t,{before:b,after:"]",...v.current()});b+=v.move(h+"]["),n();const m=r.stack;r.stack=[],n=r.enter("reference");const l=r.safe(r.associationId(t),{before:b,after:"]",...v.current()});return n(),r.stack=m,f(),s==="full"||!h||h!==l?b+=v.move(l+"]"):s==="shortcut"?b=b.slice(0,-1):b+=v.move("]"),b}o(Q8,"linkReference");function xO(){return"["}o(xO,"linkReferencePeek");function Fp(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}o(Fp,"checkBullet");function _O(t){const e=Fp(t),r=t.options.bulletOther;if(!r)return e==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+r+"`) to be different");return r}o(_O,"checkBulletOther");function MO(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}o(MO,"checkBulletOrdered");function K8(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}o(K8,"checkRule");function SO(t,e,r,i){const s=r.enter("list"),f=r.bulletCurrent;let n=t.ordered?MO(r):Fp(r);const v=t.ordered?n==="."?")":".":_O(r);let b=e&&r.bulletLastUsed?n===r.bulletLastUsed:!1;if(!t.ordered){const m=t.children?t.children[0]:void 0;if((n==="*"||n==="-")&&m&&(!m.children||!m.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(b=!0),K8(r)===n&&m){let l=-1;for(;++l<t.children.length;){const w=t.children[l];if(w&&w.type==="listItem"&&w.children&&w.children[0]&&w.children[0].type==="thematicBreak"){b=!0;break}}}}b&&(n=v),r.bulletCurrent=n;const h=r.containerFlow(t,i);return r.bulletLastUsed=n,r.bulletCurrent=f,s(),h}o(SO,"list");function EO(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}o(EO,"checkListItemIndent");function AO(t,e,r,i){const s=EO(r);let f=r.bulletCurrent||Fp(r);e&&e.type==="list"&&e.ordered&&(f=(typeof e.start=="number"&&e.start>-1?e.start:1)+(r.options.incrementListMarker===!1?0:e.children.indexOf(t))+f);let n=f.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(n=Math.ceil(n/4)*4);const v=r.createTracker(i);v.move(f+" ".repeat(n-f.length)),v.shift(n);const b=r.enter("listItem"),h=r.indentLines(r.containerFlow(t,v.current()),m);return b(),h;function m(l,w,p){return w?(p?"":" ".repeat(n))+l:(p?f:f+" ".repeat(n-f.length))+l}o(m,"map")}o(AO,"listItem");function kO(t,e,r,i){const s=r.enter("paragraph"),f=r.enter("phrasing"),n=r.containerPhrasing(t,i);return f(),s(),n}o(kO,"paragraph");const NO=Qv(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function CO(t,e,r,i){return(t.children.some(function(n){return NO(n)})?r.containerPhrasing:r.containerFlow).call(r,t,i)}o(CO,"root");function RO(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}o(RO,"checkStrong");X8.peek=IO;function X8(t,e,r,i){const s=RO(r),f=r.enter("strong"),n=r.createTracker(i),v=n.move(s+s);let b=n.move(r.containerPhrasing(t,{after:s,before:v,...n.current()}));const h=b.charCodeAt(0),m=cu(i.before.charCodeAt(i.before.length-1),h,s);m.inside&&(b=Ro(h)+b.slice(1));const l=b.charCodeAt(b.length-1),w=cu(i.after.charCodeAt(0),l,s);w.inside&&(b=b.slice(0,-1)+Ro(l));const p=n.move(s+s);return f(),r.attentionEncodeSurroundingInfo={after:w.outside,before:m.outside},v+b+p}o(X8,"strong");function IO(t,e,r){return r.options.strong||"*"}o(IO,"strongPeek");function OO(t,e,r,i){return r.safe(t.value,i)}o(OO,"text$1");function TO(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}o(TO,"checkRuleRepetition");function PO(t,e,r){const i=(K8(r)+(r.options.ruleSpaces?" ":"")).repeat(TO(r));return r.options.ruleSpaces?i.slice(0,-1):i}o(PO,"thematicBreak");const W8={blockquote:iO,break:V1,code:uO,definition:fO,emphasis:F8,hardBreak:V1,heading:mO,html:U8,image:H8,imageReference:V8,inlineCode:Z8,link:Y8,linkReference:Q8,list:SO,listItem:AO,paragraph:kO,root:CO,strong:X8,text:OO,thematicBreak:PO};function jO(){return{enter:{table:LO,tableData:Z1,tableHeader:Z1,tableRow:BO},exit:{codeText:zO,table:DO,tableData:dd,tableHeader:dd,tableRow:dd}}}o(jO,"gfmTableFromMarkdown");function LO(t){const e=t._align;this.enter({type:"table",align:e.map(function(r){return r==="none"?null:r}),children:[]},t),this.data.inTable=!0}o(LO,"enterTable");function DO(t){this.exit(t),this.data.inTable=void 0}o(DO,"exitTable");function BO(t){this.enter({type:"tableRow",children:[]},t)}o(BO,"enterRow");function dd(t){this.exit(t)}o(dd,"exit");function Z1(t){this.enter({type:"tableCell",children:[]},t)}o(Z1,"enterCell");function zO(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,FO));const r=this.stack[this.stack.length-1];Xs(r.type==="inlineCode"),r.value=e,this.exit(t)}o(zO,"exitCodeText");function FO(t,e){return e==="|"?e:t}o(FO,"replace");function UO(t){const e=t||{},r=e.tableCellPadding,i=e.tablePipeAlign,s=e.stringLength,f=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
109
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:w,table:n,tableCell:b,tableRow:v}};function n(p,y,M,E){return h(m(p,M,E),p.align)}function v(p,y,M,E){const R=l(p,M,E),I=h([R]);return I.slice(0,I.indexOf(`
|
|
110
|
-
`))}function b(p,y,M,E){const R=M.enter("tableCell"),I=M.enter("phrasing"),T=M.containerPhrasing(p,{...E,before:f,after:f});return I(),R(),T}function h(p,y){return tO(p,{align:y,alignDelimiters:i,padding:r,stringLength:s})}function m(p,y,M){const E=p.children;let R=-1;const I=[],T=y.enter("table");for(;++R<E.length;)I[R]=l(E[R],y,M);return T(),I}function l(p,y,M){const E=p.children;let R=-1;const I=[],T=y.enter("tableRow");for(;++R<E.length;)I[R]=b(E[R],p,y,M);return T(),I}function w(p,y,M){let E=W8.inlineCode(p,y,M);return M.stack.includes("tableCell")&&(E=E.replace(/\|/g,"\\$&")),E}}o(UO,"gfmTableToMarkdown");function HO(){return{exit:{taskListCheckValueChecked:G1,taskListCheckValueUnchecked:G1,paragraph:ZO}}}o(HO,"gfmTaskListItemFromMarkdown");function VO(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:GO}}}o(VO,"gfmTaskListItemToMarkdown");function G1(t){const e=this.stack[this.stack.length-2];Xs(e.type==="listItem"),e.checked=t.type==="taskListCheckValueChecked"}o(G1,"exitCheck");function ZO(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const r=this.stack[this.stack.length-1];Xs(r.type==="paragraph");const i=r.children[0];if(i&&i.type==="text"){const s=e.children;let f=-1,n;for(;++f<s.length;){const v=s[f];if(v.type==="paragraph"){n=v;break}}n===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(t)}o(ZO,"exitParagraphWithTaskListItem");function GO(t,e,r,i){const s=t.children[0],f=typeof t.checked=="boolean"&&s&&s.type==="paragraph",n="["+(t.checked?"x":" ")+"] ",v=r.createTracker(i);f&&v.move(n);let b=W8.listItem(t,e,r,{...i,...v.current()});return f&&(b=b.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),b;function h(m){return m+n}o(h,"check")}o(GO,"listItemWithTaskListItem");function YO(){return[SI(),GI(),XI(),jO(),HO()]}o(YO,"gfmFromMarkdown");function QO(t){return{extensions:[EI(),YI(t),WI(),UO(t),VO()]}}o(QO,"gfmToMarkdown");const KO={tokenize:eT,partial:!0},$8={tokenize:tT,partial:!0},J8={tokenize:rT,partial:!0},q8={tokenize:iT,partial:!0},XO={tokenize:nT,partial:!0},e3={name:"wwwAutolink",tokenize:JO,previous:r3},t3={name:"protocolAutolink",tokenize:qO,previous:i3},an={name:"emailAutolink",tokenize:$O,previous:n3},ji={};function WO(){return{text:ji}}o(WO,"gfmAutolinkLiteral");let Yn=48;for(;Yn<123;)ji[Yn]=an,Yn++,Yn===58?Yn=65:Yn===91&&(Yn=97);ji[43]=an;ji[45]=an;ji[46]=an;ji[95]=an;ji[72]=[an,t3];ji[104]=[an,t3];ji[87]=[an,e3];ji[119]=[an,e3];function $O(t,e,r){const i=this;let s,f;return n;function n(l){return!gh(l)||!n3.call(i,i.previous)||Up(i.events)?r(l):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),v(l))}function v(l){return gh(l)?(t.consume(l),v):l===64?(t.consume(l),b):r(l)}function b(l){return l===46?t.check(XO,m,h)(l):l===45||l===95||Mh(l)?(f=!0,t.consume(l),b):m(l)}function h(l){return t.consume(l),s=!0,b}function m(l){return f&&s&&Va(i.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(l)):r(l)}}o($O,"tokenizeEmailAutolink");function JO(t,e,r){const i=this;return s;function s(n){return n!==87&&n!==119||!r3.call(i,i.previous)||Up(i.events)?r(n):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(KO,t.attempt($8,t.attempt(J8,f),r),r)(n))}function f(n){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(n)}}o(JO,"tokenizeWwwAutolink");function qO(t,e,r){const i=this;let s="",f=!1;return n;function n(l){return(l===72||l===104)&&i3.call(i,i.previous)&&!Up(i.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),s+=String.fromCodePoint(l),t.consume(l),v):r(l)}function v(l){if(Va(l)&&s.length<5)return s+=String.fromCodePoint(l),t.consume(l),v;if(l===58){const w=s.toLowerCase();if(w==="http"||w==="https")return t.consume(l),b}return r(l)}function b(l){return l===47?(t.consume(l),f?h:(f=!0,b)):r(l)}function h(l){return l===null||p4(l)||Zr(l)||Fs(l)||_h(l)?r(l):t.attempt($8,t.attempt(J8,m),r)(l)}function m(l){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(l)}}o(qO,"tokenizeProtocolAutolink");function eT(t,e,r){let i=0;return s;function s(n){return(n===87||n===119)&&i<3?(i++,t.consume(n),s):n===46&&i===3?(t.consume(n),f):r(n)}function f(n){return n===null?r(n):e(n)}}o(eT,"tokenizeWwwPrefix");function tT(t,e,r){let i,s,f;return n;function n(h){return h===46||h===95?t.check(q8,b,v)(h):h===null||Zr(h)||Fs(h)||h!==45&&_h(h)?b(h):(f=!0,t.consume(h),n)}function v(h){return h===95?i=!0:(s=i,i=void 0),t.consume(h),n}function b(h){return s||i||!f?r(h):e(h)}}o(tT,"tokenizeDomain");function rT(t,e){let r=0,i=0;return s;function s(n){return n===40?(r++,t.consume(n),s):n===41&&i<r?f(n):n===33||n===34||n===38||n===39||n===41||n===42||n===44||n===46||n===58||n===59||n===60||n===63||n===93||n===95||n===126?t.check(q8,e,f)(n):n===null||Zr(n)||Fs(n)?e(n):(t.consume(n),s)}function f(n){return n===41&&i++,t.consume(n),s}}o(rT,"tokenizePath");function iT(t,e,r){return i;function i(v){return v===33||v===34||v===39||v===41||v===42||v===44||v===46||v===58||v===59||v===63||v===95||v===126?(t.consume(v),i):v===38?(t.consume(v),f):v===93?(t.consume(v),s):v===60||v===null||Zr(v)||Fs(v)?e(v):r(v)}function s(v){return v===null||v===40||v===91||Zr(v)||Fs(v)?e(v):i(v)}function f(v){return Va(v)?n(v):r(v)}function n(v){return v===59?(t.consume(v),i):Va(v)?(t.consume(v),n):r(v)}}o(iT,"tokenizeTrail");function nT(t,e,r){return i;function i(f){return t.consume(f),s}function s(f){return Mh(f)?r(f):e(f)}}o(nT,"tokenizeEmailDomainDotTrail");function r3(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Zr(t)}o(r3,"previousWww");function i3(t){return!Va(t)}o(i3,"previousProtocol");function n3(t){return!(t===47||gh(t))}o(n3,"previousEmail");function gh(t){return t===43||t===45||t===46||t===95||Mh(t)}o(gh,"gfmAtext");function Up(t){let e=t.length,r=!1;for(;e--;){const i=t[e][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return t.length>0&&!r&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}o(Up,"previousUnbalanced");const sT={tokenize:hT,partial:!0};function aT(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:cT,continuation:{tokenize:fT},exit:dT}},text:{91:{name:"gfmFootnoteCall",tokenize:uT},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:oT,resolveTo:lT}}}}o(aT,"gfmFootnote");function oT(t,e,r){const i=this;let s=i.events.length;const f=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let n;for(;s--;){const b=i.events[s][1];if(b.type==="labelImage"){n=b;break}if(b.type==="gfmFootnoteCall"||b.type==="labelLink"||b.type==="label"||b.type==="image"||b.type==="link")break}return v;function v(b){if(!n||!n._balanced)return r(b);const h=Oo(i.sliceSerialize({start:n.end,end:i.now()}));return h.codePointAt(0)!==94||!f.includes(h.slice(1))?r(b):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(b),t.exit("gfmFootnoteCallLabelMarker"),e(b))}}o(oT,"tokenizePotentialGfmFootnoteCall");function lT(t,e){let r=t.length;for(;r--;)if(t[r][1].type==="labelImage"&&t[r][0]==="enter"){t[r][1];break}t[r+1][1].type="data",t[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},t[r+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[r+3][1].end),end:Object.assign({},t[r+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const f={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},n={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},v=[t[r+1],t[r+2],["enter",i,e],t[r+3],t[r+4],["enter",s,e],["exit",s,e],["enter",f,e],["enter",n,e],["exit",n,e],["exit",f,e],t[t.length-2],t[t.length-1],["exit",i,e]];return t.splice(r,t.length-r+1,...v),t}o(lT,"resolveToPotentialGfmFootnoteCall");function uT(t,e,r){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f=0,n;return v;function v(l){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),b}function b(l){return l!==94?r(l):(t.enter("gfmFootnoteCallMarker"),t.consume(l),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(l){if(f>999||l===93&&!n||l===null||l===91||Zr(l))return r(l);if(l===93){t.exit("chunkString");const w=t.exit("gfmFootnoteCallString");return s.includes(Oo(i.sliceSerialize(w)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):r(l)}return Zr(l)||(n=!0),f++,t.consume(l),l===92?m:h}function m(l){return l===91||l===92||l===93?(t.consume(l),f++,h):h(l)}}o(uT,"tokenizeGfmFootnoteCall");function cT(t,e,r){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let f,n=0,v;return b;function b(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",m):r(y)}function m(y){if(n>999||y===93&&!v||y===null||y===91||Zr(y))return r(y);if(y===93){t.exit("chunkString");const M=t.exit("gfmFootnoteDefinitionLabelString");return f=Oo(i.sliceSerialize(M)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),w}return Zr(y)||(v=!0),n++,t.consume(y),y===92?l:m}function l(y){return y===91||y===92||y===93?(t.consume(y),n++,m):m(y)}function w(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(f)||s.push(f),dn(t,p,"gfmFootnoteDefinitionWhitespace")):r(y)}function p(y){return e(y)}}o(cT,"tokenizeDefinitionStart");function fT(t,e,r){return t.check(m4,e,t.attempt(sT,e,r))}o(fT,"tokenizeDefinitionContinuation");function dT(t){t.exit("gfmFootnoteDefinition")}o(dT,"gfmFootnoteDefinitionEnd");function hT(t,e,r){const i=this;return dn(t,s,"gfmFootnoteDefinitionIndent",5);function s(f){const n=i.events[i.events.length-1];return n&&n[1].type==="gfmFootnoteDefinitionIndent"&&n[2].sliceSerialize(n[1],!0).length===4?e(f):r(f)}}o(hT,"tokenizeIndent");function pT(t){let r=(t||{}).singleTilde;const i={name:"strikethrough",tokenize:f,resolveAll:s};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(n,v){let b=-1;for(;++b<n.length;)if(n[b][0]==="enter"&&n[b][1].type==="strikethroughSequenceTemporary"&&n[b][1]._close){let h=b;for(;h--;)if(n[h][0]==="exit"&&n[h][1].type==="strikethroughSequenceTemporary"&&n[h][1]._open&&n[b][1].end.offset-n[b][1].start.offset===n[h][1].end.offset-n[h][1].start.offset){n[b][1].type="strikethroughSequence",n[h][1].type="strikethroughSequence";const m={type:"strikethrough",start:Object.assign({},n[h][1].start),end:Object.assign({},n[b][1].end)},l={type:"strikethroughText",start:Object.assign({},n[h][1].end),end:Object.assign({},n[b][1].start)},w=[["enter",m,v],["enter",n[h][1],v],["exit",n[h][1],v],["enter",l,v]],p=v.parser.constructs.insideSpan.null;p&&yc(w,w.length,0,g4(p,n.slice(h+1,b),v)),yc(w,w.length,0,[["exit",l,v],["enter",n[b][1],v],["exit",n[b][1],v],["exit",m,v]]),yc(n,h-1,b-h+3,w),b=h+w.length-2;break}}for(b=-1;++b<n.length;)n[b][1].type==="strikethroughSequenceTemporary"&&(n[b][1].type="data");return n}o(s,"resolveAllStrikethrough");function f(n,v,b){const h=this.previous,m=this.events;let l=0;return w;function w(y){return h===126&&m[m.length-1][1].type!=="characterEscape"?b(y):(n.enter("strikethroughSequenceTemporary"),p(y))}function p(y){const M=Dl(h);if(y===126)return l>1?b(y):(n.consume(y),l++,p);if(l<2&&!r)return b(y);const E=n.exit("strikethroughSequenceTemporary"),R=Dl(y);return E._open=!R||R===2&&!!M,E._close=!M||M===2&&!!R,v(y)}}o(f,"tokenizeStrikethrough")}o(pT,"gfmStrikethrough");class mT{static{o(this,"EditMap")}constructor(){this.map=[]}add(e,r,i){gT(this,e,r,i)}consume(e){if(this.map.sort(function(f,n){return f[0]-n[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(e.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),e.length=this.map[r][0];i.push(e.slice()),e.length=0;let s=i.pop();for(;s;){for(const f of s)e.push(f);s=i.pop()}this.map.length=0}}function gT(t,e,r,i){let s=0;if(!(r===0&&i.length===0)){for(;s<t.map.length;){if(t.map[s][0]===e){t.map[s][1]+=r,t.map[s][2].push(...i);return}s+=1}t.map.push([e,r,i])}}o(gT,"addImplementation");function vT(t,e){let r=!1;const i=[];for(;e<t.length;){const s=t[e];if(r){if(s[0]==="enter")s[1].type==="tableContent"&&i.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const f=i.length-1;i[f]=i[f]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(r=!0);e+=1}return i}o(vT,"gfmTableAlign");function bT(){return{flow:{null:{name:"table",tokenize:yT,resolveAll:wT}}}}o(bT,"gfmTable");function yT(t,e,r){const i=this;let s=0,f=0,n;return v;function v(F){let Y=i.events.length-1;for(;Y>-1;){const u=i.events[Y][1].type;if(u==="lineEnding"||u==="linePrefix")Y--;else break}const a=Y>-1?i.events[Y][1].type:null,g=a==="tableHead"||a==="tableRow"?L:b;return g===L&&i.parser.lazy[i.now().line]?r(F):g(F)}function b(F){return t.enter("tableHead"),t.enter("tableRow"),h(F)}function h(F){return F===124||(n=!0,f+=1),m(F)}function m(F){return F===null?r(F):Pa(F)?f>1?(f=0,i.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),p):r(F):Ss(F)?dn(t,m,"whitespace")(F):(f+=1,n&&(n=!1,s+=1),F===124?(t.enter("tableCellDivider"),t.consume(F),t.exit("tableCellDivider"),n=!0,m):(t.enter("data"),l(F)))}function l(F){return F===null||F===124||Zr(F)?(t.exit("data"),m(F)):(t.consume(F),F===92?w:l)}function w(F){return F===92||F===124?(t.consume(F),l):l(F)}function p(F){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(F):(t.enter("tableDelimiterRow"),n=!1,Ss(F)?dn(t,y,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):y(F))}function y(F){return F===45||F===58?E(F):F===124?(n=!0,t.enter("tableCellDivider"),t.consume(F),t.exit("tableCellDivider"),M):j(F)}function M(F){return Ss(F)?dn(t,E,"whitespace")(F):E(F)}function E(F){return F===58?(f+=1,n=!0,t.enter("tableDelimiterMarker"),t.consume(F),t.exit("tableDelimiterMarker"),R):F===45?(f+=1,R(F)):F===null||Pa(F)?P(F):j(F)}function R(F){return F===45?(t.enter("tableDelimiterFiller"),I(F)):j(F)}function I(F){return F===45?(t.consume(F),I):F===58?(n=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(F),t.exit("tableDelimiterMarker"),T):(t.exit("tableDelimiterFiller"),T(F))}function T(F){return Ss(F)?dn(t,P,"whitespace")(F):P(F)}function P(F){return F===124?y(F):F===null||Pa(F)?!n||s!==f?j(F):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(F)):j(F)}function j(F){return r(F)}function L(F){return t.enter("tableRow"),U(F)}function U(F){return F===124?(t.enter("tableCellDivider"),t.consume(F),t.exit("tableCellDivider"),U):F===null||Pa(F)?(t.exit("tableRow"),e(F)):Ss(F)?dn(t,U,"whitespace")(F):(t.enter("data"),Z(F))}function Z(F){return F===null||F===124||Zr(F)?(t.exit("data"),U(F)):(t.consume(F),F===92?ne:Z)}function ne(F){return F===92||F===124?(t.consume(F),Z):Z(F)}}o(yT,"tokenizeTable");function wT(t,e){let r=-1,i=!0,s=0,f=[0,0,0,0],n=[0,0,0,0],v=!1,b=0,h,m,l;const w=new mT;for(;++r<t.length;){const p=t[r],y=p[1];p[0]==="enter"?y.type==="tableHead"?(v=!1,b!==0&&(Y1(w,e,b,h,m),m=void 0,b=0),h={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},w.add(r,0,[["enter",h,e]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(i=!0,l=void 0,f=[0,0,0,0],n=[0,r+1,0,0],v&&(v=!1,m={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},w.add(r,0,[["enter",m,e]])),s=y.type==="tableDelimiterRow"?2:m?3:1):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(i=!1,n[2]===0&&(f[1]!==0&&(n[0]=n[1],l=gl(w,e,f,s,void 0,l),f=[0,0,0,0]),n[2]=r)):y.type==="tableCellDivider"&&(i?i=!1:(f[1]!==0&&(n[0]=n[1],l=gl(w,e,f,s,void 0,l)),f=n,n=[f[1],r,0,0])):y.type==="tableHead"?(v=!0,b=r):y.type==="tableRow"||y.type==="tableDelimiterRow"?(b=r,f[1]!==0?(n[0]=n[1],l=gl(w,e,f,s,r,l)):n[1]!==0&&(l=gl(w,e,n,s,r,l)),s=0):s&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(n[3]=r)}for(b!==0&&Y1(w,e,b,h,m),w.consume(e.events),r=-1;++r<e.events.length;){const p=e.events[r];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=vT(e.events,r))}return t}o(wT,"resolveTable");function gl(t,e,r,i,s,f){const n=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",v="tableContent";r[0]!==0&&(f.end=Object.assign({},ks(e.events,r[0])),t.add(r[0],0,[["exit",f,e]]));const b=ks(e.events,r[1]);if(f={type:n,start:Object.assign({},b),end:Object.assign({},b)},t.add(r[1],0,[["enter",f,e]]),r[2]!==0){const h=ks(e.events,r[2]),m=ks(e.events,r[3]),l={type:v,start:Object.assign({},h),end:Object.assign({},m)};if(t.add(r[2],0,[["enter",l,e]]),i!==2){const w=e.events[r[2]],p=e.events[r[3]];if(w[1].end=Object.assign({},p[1].end),w[1].type="chunkText",w[1].contentType="text",r[3]>r[2]+1){const y=r[2]+1,M=r[3]-r[2]-1;t.add(y,M,[])}}t.add(r[3]+1,0,[["exit",l,e]])}return s!==void 0&&(f.end=Object.assign({},ks(e.events,s)),t.add(s,0,[["exit",f,e]]),f=void 0),f}o(gl,"flushCell");function Y1(t,e,r,i,s){const f=[],n=ks(e.events,r);s&&(s.end=Object.assign({},n),f.push(["exit",s,e])),i.end=Object.assign({},n),f.push(["exit",i,e]),t.add(r+1,0,f)}o(Y1,"flushTableEnd");function ks(t,e){const r=t[e],i=r[0]==="enter"?"start":"end";return r[1][i]}o(ks,"getPoint");const xT={name:"tasklistCheck",tokenize:MT};function _T(){return{text:{91:xT}}}o(_T,"gfmTaskListItem");function MT(t,e,r){const i=this;return s;function s(b){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(b):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(b),t.exit("taskListCheckMarker"),f)}function f(b){return Zr(b)?(t.enter("taskListCheckValueUnchecked"),t.consume(b),t.exit("taskListCheckValueUnchecked"),n):b===88||b===120?(t.enter("taskListCheckValueChecked"),t.consume(b),t.exit("taskListCheckValueChecked"),n):r(b)}function n(b){return b===93?(t.enter("taskListCheckMarker"),t.consume(b),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),v):r(b)}function v(b){return Pa(b)?e(b):Ss(b)?t.check({tokenize:ST},e,r)(b):r(b)}}o(MT,"tokenizeTasklistCheck");function ST(t,e,r){return dn(t,i,"whitespace");function i(s){return s===null?r(s):e(s)}}o(ST,"spaceThenNonSpace");function ET(t){return v4([WO(),aT(),pT(t),bT(),_T()])}o(ET,"gfm");const AT={};function kT(t){const e=this,r=t||AT,i=e.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),f=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),n=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(ET(r)),f.push(YO()),n.push(QO(r))}o(kT,"remarkGfm");const s3=V.forwardRef(({className:t,children:e,variant:r="agent",...i},s)=>k.jsx("div",{ref:s,className:He("not-prose relative overflow-hidden rounded-lg border border-border",t),style:{backgroundColor:"#0f172a",color:"white"},...i,children:e}));s3.displayName="CodeBlock";const NT=V.forwardRef(({className:t,children:e,...r},i)=>k.jsx("div",{ref:i,className:He("flex items-center justify-between border-b border-border px-4 py-2 text-sm text-muted-foreground bg-muted/30 dark:bg-slate-800/50",t),...r,children:e}));NT.displayName="CodeBlockGroup";const a3=V.forwardRef(({code:t,language:e="text",className:r,variant:i="agent",...s},f)=>k.jsx("div",{ref:f,className:He("overflow-x-auto p-4",r),style:{backgroundColor:"transparent"},...s,children:k.jsx("pre",{className:"text-sm whitespace-pre-wrap",style:{color:"white"},children:k.jsx("code",{className:"font-mono",style:{color:"white"},children:t})})}));a3.displayName="CodeBlockCode";const CT=o((t="agent")=>({pre:o(({children:e,className:r,...i})=>{if(V.Children.toArray(e).some(f=>V.isValidElement(f)&&f.props?.className&&/language-\w+/.test(f.props.className))){const f=V.Children.toArray(e).find(m=>V.isValidElement(m)&&m.props?.className&&/language-\w+/.test(m.props.className)),v=(f.props.className||"").match(/language-(\w+)/),b=v?v[1]:"text",h=String(f.props.children||"").trim();return k.jsxs(s3,{children:[b&&b!=="text"&&k.jsx("div",{className:"flex items-center justify-between px-4 py-2 text-xs bg-black/30 text-white border-b border-border",children:k.jsx("span",{className:"font-mono uppercase tracking-wide",children:b})}),k.jsx(a3,{code:h,language:b})]})}return k.jsx("pre",{className:He("overflow-x-auto rounded-md bg-black dark:bg-black/50 border border-border p-4 text-sm font-mono text-white dark:text-white",r),...i,children:e})},"pre"),code:o(({className:e,children:r,...i})=>e&&/language-\w+/.test(e)?k.jsx("code",{className:e,...i,children:r}):k.jsx("code",{className:He("relative rounded bg-muted/60 dark:bg-slate-800/60 px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold text-foreground dark:text-slate-100 border border-border/50",e),...i,children:r}),"code"),h1:o(({className:e,...r})=>k.jsx("h1",{className:He("mt-2 scroll-m-20 text-xl font-bold tracking-tight",e),...r}),"h1"),h2:o(({className:e,...r})=>k.jsx("h2",{className:He("mt-2 scroll-m-20 text-lg font-semibold tracking-tight",e),...r}),"h2"),h3:o(({className:e,...r})=>k.jsx("h3",{className:He("mt-2 scroll-m-20 text-base font-semibold tracking-tight",e),...r}),"h3"),h4:o(({className:e,...r})=>k.jsx("h4",{className:He("mt-2 scroll-m-20 text-sm font-semibold tracking-tight",e),...r}),"h4"),p:o(({className:e,...r})=>k.jsx("p",{className:He("leading-7",e),...r}),"p"),ul:o(({className:e,...r})=>k.jsx("ul",{className:He("my-2 ml-6 list-disc [&>li]:mt-1",e),...r}),"ul"),ol:o(({className:e,...r})=>k.jsx("ol",{className:He("my-2 ml-6 list-decimal [&>li]:mt-1",e),...r}),"ol"),a:o(({className:e,...r})=>k.jsx("a",{className:He("font-medium text-primary underline underline-offset-4",e),...r}),"a"),blockquote:o(({className:e,...r})=>k.jsx("blockquote",{className:He("mt-2 border-l-2 border-muted-foreground/20 pl-6 italic",e),...r}),"blockquote"),table:o(({className:e,...r})=>k.jsx("div",{className:"my-2 w-full overflow-y-auto",children:k.jsx("table",{className:He("w-full",e),...r})}),"table"),th:o(({className:e,...r})=>k.jsx("th",{className:He("border border-muted-foreground/20 px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",e),...r}),"th"),td:o(({className:e,...r})=>k.jsx("td",{className:He("border border-muted-foreground/20 px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right",e),...r}),"td"),img:o(({className:e,alt:r,...i})=>k.jsx("img",{className:He("rounded-md",e),alt:r,...i}),"img"),hr:o(({...e})=>k.jsx("hr",{className:"my-4 border-muted-foreground/20",...e}),"hr"),strong:o(({className:e,...r})=>k.jsx("strong",{className:He("font-semibold",e),...r}),"strong"),em:o(({className:e,...r})=>k.jsx("em",{className:He("italic",e),...r}),"em")}),"createComponents"),Hp=V.memo(({children:t,className:e,components:r,variant:i="agent",...s})=>{const f=V.useMemo(()=>CT(i),[i]),n=V.useMemo(()=>({...f,...r}),[f,r]);return k.jsx("div",{className:He("markdown-content",e),...s,children:k.jsx(b4,{remarkPlugins:[kT],components:n,children:t})})});Hp.displayName="Markdown";const RT=o(({children:t,className:e,variant:r="agent",shouldAnimate:i=!1,messageId:s,maxDurationMs:f=1e4})=>{const[n,v]=V.useState(i?"":t);return V.useEffect(()=>{if(!i||!t.trim()){v(t);return}const b=Math.max(1e3,f);v("");const h=20,m=t.length,l=Math.ceil(b/h),w=Math.max(1,Math.ceil(m/l));let p=0;const y=setInterval(()=>{p+=w,p>=m?(v(t),clearInterval(y)):v(t.slice(0,p))},h);return()=>clearInterval(y)},[t,i,s,f]),k.jsx(Hp,{className:e,variant:r,children:n})},"AnimatedMarkdown");/*!---------------------------------------------------------------------------------------------
|
|
111
|
-
* Copyright (c) StackBlitz. All rights reserved.
|
|
112
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
113
|
-
*--------------------------------------------------------------------------------------------*/const IT={damping:.7,stiffness:.05,mass:1.25},OT=70,TT=1e3/60,PT=350;let hc=!1;globalThis.document?.addEventListener("mousedown",()=>{hc=!0});globalThis.document?.addEventListener("mouseup",()=>{hc=!1});globalThis.document?.addEventListener("click",()=>{hc=!1});const jT=o((t={})=>{const[e,r]=V.useState(!1),[i,s]=V.useState(t.initial!==!1),[f,n]=V.useState(!1),v=V.useRef(null);v.current=t;const b=V.useCallback(()=>{if(!hc)return!1;const I=window.getSelection();if(!I||!I.rangeCount)return!1;const T=I.getRangeAt(0);return T.commonAncestorContainer.contains(E.current)||E.current?.contains(T.commonAncestorContainer)},[]),h=V.useCallback(I=>{l.isAtBottom=I,s(I)},[]),m=V.useCallback(I=>{l.escapedFromLock=I,r(I)},[]),l=V.useMemo(()=>{let I;return{escapedFromLock:e,isAtBottom:i,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return E.current?.scrollTop??0},set scrollTop(T){E.current&&(E.current.scrollTop=T,l.ignoreScrollToTop=E.current.scrollTop)},get targetScrollTop(){return!E.current||!R.current?0:E.current.scrollHeight-1-E.current.clientHeight},get calculatedTargetScrollTop(){if(!E.current||!R.current)return 0;const{targetScrollTop:T}=this;if(!t.targetScrollTop)return T;if(I?.targetScrollTop===T)return I.calculatedScrollTop;const P=Math.max(Math.min(t.targetScrollTop(T,{scrollElement:E.current,contentElement:R.current}),T),0);return I={targetScrollTop:T,calculatedScrollTop:P},requestAnimationFrame(()=>{I=void 0}),P},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=OT}}},[]),w=V.useCallback((I={})=>{typeof I=="string"&&(I={animation:I}),I.preserveScrollPosition||h(!0);const T=Date.now()+(Number(I.wait)||0),P=pd(v.current,I.animation),{ignoreEscapes:j=!1}=I;let L,U=l.calculatedTargetScrollTop;I.duration instanceof Promise?I.duration.finally(()=>{L=Date.now()}):L=T+(I.duration??0);const Z=o(async()=>{const ne=new Promise(requestAnimationFrame).then(()=>{if(!l.isAtBottom)return l.animation=void 0,!1;const{scrollTop:F}=l,Y=performance.now(),a=(Y-(l.lastTick??Y))/TT;if(l.animation||(l.animation={behavior:P,promise:ne,ignoreEscapes:j}),l.animation.behavior===P&&(l.lastTick=Y),b()||T>Date.now())return Z();if(F<Math.min(U,l.calculatedTargetScrollTop)){if(l.animation?.behavior===P){if(P==="instant")return l.scrollTop=l.calculatedTargetScrollTop,Z();l.velocity=(P.damping*l.velocity+P.stiffness*l.scrollDifference)/P.mass,l.accumulated+=l.velocity*a,l.scrollTop+=l.accumulated,l.scrollTop!==F&&(l.accumulated=0)}return Z()}return L>Date.now()?(U=l.calculatedTargetScrollTop,Z()):(l.animation=void 0,l.scrollTop<l.calculatedTargetScrollTop?w({animation:pd(v.current,v.current.resize),ignoreEscapes:j,duration:Math.max(0,L-Date.now())||void 0}):l.isAtBottom)});return ne.then(F=>(requestAnimationFrame(()=>{l.animation||(l.lastTick=void 0,l.velocity=0)}),F))},"next");return I.wait!==!0&&(l.animation=void 0),l.animation?.behavior===P?l.animation.promise:Z()},[h,b,l]),p=V.useCallback(()=>{m(!0),h(!1)},[m,h]),y=V.useCallback(({target:I})=>{if(I!==E.current)return;const{scrollTop:T,ignoreScrollToTop:P}=l;let{lastScrollTop:j=T}=l;l.lastScrollTop=T,l.ignoreScrollToTop=void 0,P&&P>T&&(j=P),n(l.isNearBottom),setTimeout(()=>{if(l.resizeDifference||T===P)return;if(b()){m(!0),h(!1);return}const L=T>j,U=T<j;if(l.animation?.ignoreEscapes){l.scrollTop=j;return}U&&(m(!0),h(!1)),L&&m(!1),!l.escapedFromLock&&l.isNearBottom&&h(!0)},1)},[m,h,b,l]),M=V.useCallback(({target:I,deltaY:T})=>{let P=I;for(;!["scroll","auto"].includes(getComputedStyle(P).overflow);){if(!P.parentElement)return;P=P.parentElement}P===E.current&&T<0&&E.current.scrollHeight>E.current.clientHeight&&!l.animation?.ignoreEscapes&&(m(!0),h(!1))},[m,h,l]),E=Q1(I=>{E.current?.removeEventListener("scroll",y),E.current?.removeEventListener("wheel",M),I?.addEventListener("scroll",y,{passive:!0}),I?.addEventListener("wheel",M,{passive:!0})},[]),R=Q1(I=>{if(l.resizeObserver?.disconnect(),!I)return;let T;l.resizeObserver=new ResizeObserver(([P])=>{const{height:j}=P.contentRect,L=j-(T??j);if(l.resizeDifference=L,l.scrollTop>l.targetScrollTop&&(l.scrollTop=l.targetScrollTop),n(l.isNearBottom),L>=0){const U=pd(v.current,T?v.current.resize:v.current.initial);w({animation:U,wait:!0,preserveScrollPosition:!0,duration:U==="instant"?void 0:PT})}else l.isNearBottom&&(m(!1),h(!0));T=j,requestAnimationFrame(()=>{setTimeout(()=>{l.resizeDifference===L&&(l.resizeDifference=0)},1)})}),l.resizeObserver?.observe(I)},[]);return{contentRef:R,scrollRef:E,scrollToBottom:w,stopScroll:p,isAtBottom:i||f,isNearBottom:f,escapedFromLock:e,state:l}},"useStickToBottom");function Q1(t,e){const r=V.useCallback(i=>(r.current=i,t(i)),e);return r}o(Q1,"useRefCallback");const hd=new Map;function pd(...t){const e={...IT};let r=!1;for(const s of t){if(s==="instant"){r=!0;continue}typeof s=="object"&&(r=!1,e.damping=s.damping??e.damping,e.stiffness=s.stiffness??e.stiffness,e.mass=s.mass??e.mass)}const i=JSON.stringify(e);return hd.has(i)||hd.set(i,Object.freeze(e)),r?"instant":hd.get(i)}o(pd,"mergeAnimations");function LT(t={}){const{smooth:e=!1}=t,r=V.useRef(!1),i=jT({initial:e?"smooth":"instant",resize:e?"smooth":"instant"}),[s,f]=V.useState({isAtBottom:!0,autoScrollEnabled:!0});V.useEffect(()=>{i.isAtBottom?(r.current=!1,f({isAtBottom:!0,autoScrollEnabled:!0})):f(h=>({...h,isAtBottom:!1,autoScrollEnabled:r.current?!1:h.autoScrollEnabled}))},[i.isAtBottom]);const n=V.useCallback(b=>{const h=b?"instant":e?"smooth":"instant";i.scrollToBottom({animation:h,preserveScrollPosition:!1}),f({isAtBottom:!0,autoScrollEnabled:!0}),r.current=!1},[i.scrollToBottom,e]),v=V.useCallback(()=>{i.isAtBottom||(r.current=!0,i.stopScroll(),f(b=>({...b,autoScrollEnabled:!1})))},[i.isAtBottom,i.stopScroll]);return{scrollRef:i.scrollRef,contentRef:i.contentRef,isAtBottom:s.isAtBottom,autoScrollEnabled:s.autoScrollEnabled,scrollToBottom:o(()=>n(!1),"scrollToBottom"),disableAutoScroll:v,_stickToBottom:i}}o(LT,"useAutoScroll");const DT=o(({className:t,...e})=>k.jsx(w4,{className:He("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...e}),"ResizablePanelGroup"),K1=y4,BT=o(({withHandle:t,className:e,...r})=>k.jsx(x4,{className:He("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",e),...r,children:t&&k.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:k.jsx(_4,{className:"h-2.5 w-2.5"})})}),"ResizableHandle"),vh=V.forwardRef(({mainAction:t,actions:e,variant:r="default",size:i="default",disabled:s,className:f,mainButtonClassName:n,dropdownButtonClassName:v},b)=>{const h=V.useRef(null),[m,l]=V.useState();return V.useImperativeHandle(b,()=>h.current,[]),V.useLayoutEffect(()=>{h.current&&l(h.current.offsetWidth)},[e.length,t.label]),k.jsxs("div",{ref:h,className:He("flex w-full",f),children:[k.jsxs($e,{type:"button",variant:r,size:i,onClick:t.onClick,disabled:s||t.disabled,className:He("rounded-r-none flex-1",r==="destructive"?"border-r border-red-700":"border-r-0",n),children:[t.icon&&k.jsx("span",{className:"mr-2",children:t.icon}),t.label]}),k.jsxs(Ka,{children:[k.jsx(Xa,{asChild:!0,children:k.jsxs($e,{type:"button",variant:r,size:i,disabled:s,className:He("rounded-l-none px-2 flex-shrink-0",v),children:[k.jsx(yn,{className:"h-4 w-4"}),k.jsx("span",{className:"sr-only",children:"More options"})]})}),k.jsx(Wa,{align:"end",style:{width:m},children:e.map((w,p)=>k.jsxs(V.Fragment,{children:[k.jsxs(_i,{onClick:w.onClick,disabled:w.disabled,className:He(w.variant==="destructive"&&"text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50"),children:[w.icon,w.label]}),p<e.length-1&&k.jsx(Bl,{})]},p))})]})]})});vh.displayName="SplitButton";const zT=M4,FT=S4,UT=E4,HT=o(({toolPart:t,defaultOpen:e=!1,className:r})=>{const[i,s]=V.useState(e),{state:f,input:n,output:v,toolCallId:b}=t,h=o(()=>{switch(f){case"input-streaming":return k.jsx(Ar,{className:"h-4 w-4 animate-spin text-blue-500"});case"input-available":return k.jsx(is,{className:"h-4 w-4 text-orange-500"});case"output-available":return k.jsx(jv,{className:"h-4 w-4 text-green-500"});case"output-error":return k.jsx(A4,{className:"h-4 w-4 text-red-500"});default:return k.jsx(is,{className:"text-muted-foreground h-4 w-4"})}},"getStateIcon"),m=o(()=>{const w="px-2 py-1 rounded-full text-xs font-medium";switch(f){case"input-streaming":return k.jsx("span",{className:He(w,"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400"),children:"Processing"});case"input-available":return k.jsx("span",{className:He(w,"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400"),children:"Ready"});case"output-available":return k.jsx("span",{className:He(w,"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400"),children:"Completed"});case"output-error":return k.jsx("span",{className:He(w,"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:"Error"});default:return k.jsx("span",{className:He(w,"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400"),children:"Pending"})}},"getStateBadge"),l=o(w=>w===null?"null":w===void 0?"undefined":typeof w=="string"?w:typeof w=="object"?JSON.stringify(w,null,2):String(w),"formatValue");return k.jsx("div",{className:He("border-border mt-3 overflow-hidden rounded-lg border",r),children:k.jsxs(zT,{open:i,onOpenChange:s,children:[k.jsx(FT,{asChild:!0,children:k.jsxs($e,{variant:"ghost",className:"bg-background h-auto w-full justify-between rounded-b-none px-3 py-2 font-normal",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[h(),k.jsx("span",{className:"font-mono text-sm font-medium",children:t.type}),m()]}),k.jsx(yn,{className:He("h-4 w-4",i&&"rotate-180")})]})}),k.jsx(UT,{className:He("border-border border-t","data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down overflow-hidden"),children:k.jsxs("div",{className:"bg-background space-y-3 p-3",children:[n&&Object.keys(n).length>0&&k.jsxs("div",{children:[k.jsx("h4",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Input"}),k.jsx("div",{className:"bg-background rounded border p-2 font-mono text-sm",children:Object.entries(n).map(([w,p])=>k.jsxs("div",{className:"mb-1",children:[k.jsxs("span",{className:"text-muted-foreground",children:[w,":"]})," ",k.jsx("span",{children:l(p)})]},w))})]}),v&&k.jsxs("div",{children:[k.jsx("h4",{className:"text-muted-foreground mb-2 text-sm font-medium",children:"Output"}),k.jsx("div",{className:"bg-background max-h-60 overflow-auto rounded border p-2 font-mono text-sm",children:k.jsx("pre",{className:"whitespace-pre-wrap",children:l(v)})})]}),f==="output-error"&&t.errorText&&k.jsxs("div",{children:[k.jsx("h4",{className:"mb-2 text-sm font-medium text-red-500",children:"Error"}),k.jsx("div",{className:"bg-background rounded border border-red-200 p-2 text-sm dark:border-red-950 dark:bg-red-900/20",children:t.errorText})]}),f==="input-streaming"&&k.jsx("div",{className:"text-muted-foreground text-sm",children:"Processing tool call..."}),b&&k.jsx("div",{className:"text-muted-foreground border-t border-blue-200 pt-2 text-xs",children:k.jsxs("span",{className:"font-mono",children:["Call ID: ",b]})})]})})]})})},"Tool");function VT({agentId:t,channelId:e,chatType:r}){const[i,s]=V.useState([]),f=V.useRef(new Set),{toast:n}=Wt(),v=Xt();V.useEffect(()=>()=>{f.current.forEach(y=>URL.revokeObjectURL(y)),f.current.clear()},[]);const b=V.useCallback(y=>{const I=Array.from(y.target.files||[]).filter(T=>T.type.startsWith("image/")||T.type.startsWith("video/")||T.type.startsWith("audio/")||T.type==="application/pdf"||T.type==="application/msword"||T.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"||T.type==="application/vnd.ms-excel"||T.type==="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"||T.type==="application/vnd.ms-powerpoint"||T.type==="application/vnd.openxmlformats-officedocument.presentationml.presentation"||T.type.startsWith("text/")).filter(T=>!i.some(P=>P.file.name===T.name&&P.file.size===T.size&&P.file.lastModified===T.lastModified)).map(T=>({file:T,id:en(),isUploading:!1}));s(T=>{const P=[...T,...I];return Array.from(new Map(P.map(j=>[`${j.file.name}-${j.file.size}`,j])).values())}),y.target&&(y.target.value="")},[i]),h=V.useCallback(y=>{s(M=>{const E=M.find(R=>R.id===y);return E?.blobUrl&&(URL.revokeObjectURL(E.blobUrl),f.current.delete(E.blobUrl)),M.filter(R=>R.id!==y)})},[]),m=V.useCallback(y=>y.map(E=>{const R=URL.createObjectURL(E.file);return f.current.add(R),E.blobUrl=R,{id:E.id,url:R,title:E.file.name,contentType:sf(E.file.type),isUploading:!0}}).filter(E=>E.contentType!==void 0),[]),l=V.useCallback(async y=>{if(!y.length)return{uploaded:[],failed:[],blobUrls:[]};const M=y.map(async P=>{try{const j=r===vt.DM&&t?await v.media.uploadAgentMedia(t,{file:P.file,filename:P.file.name}):await v.media.uploadChannelMedia(e,P.file);return{success:!0,media:{id:P.id,url:j.url,title:P.file.name,source:"file_upload",contentType:sf(P.file.type)}}}catch(j){return Ge.error(`Failed to upload ${P.file.name}:`,j),n({title:`Upload Failed: ${P.file.name}`,description:j instanceof Error?j.message:"Upload failed",variant:"destructive"}),{success:!1,file:P,error:j instanceof Error?j.message:"Upload failed"}}}),E=await Promise.allSettled(M),R=[],I=[],T=[];return E.forEach((P,j)=>{P.status==="fulfilled"?P.value.success&&"media"in P.value?R.push(P.value.media):"file"in P.value&&I.push(P.value):I.push({file:y[j],error:P.reason?.message||"Upload failed"})}),y.forEach(P=>{P.blobUrl&&T.push(P.blobUrl)}),{uploaded:R,failed:I,blobUrls:T}},[r,t,e,n]),w=V.useCallback(y=>{y.forEach(M=>{URL.revokeObjectURL(M),f.current.delete(M)})},[]),p=V.useCallback(()=>{i.forEach(y=>{y.blobUrl&&(URL.revokeObjectURL(y.blobUrl),f.current.delete(y.blobUrl))}),s([])},[i]);return{selectedFiles:i,setSelectedFiles:s,handleFileChange:b,removeFile:h,createBlobUrls:m,uploadFiles:l,cleanupBlobUrls:w,clearFiles:p,getContentTypeFromMimeType:sf}}o(VT,"useFileUpload");function ZT({channelId:t,currentUserId:e,contextId:r,chatType:i,allAgents:s,messages:f,onAddMessage:n,onUpdateMessage:v,onDeleteMessage:b,onClearMessages:h,onInputDisabledChange:m}){const l=Kr.getInstance(),w=V.useRef(null),p=V.useRef(null),y=V.useCallback(async(M,E,R,I,T,P,j)=>{const L=j||t;if(!L){Ge.error("[useSocketChat] Cannot send message: no channel ID available");return}const U={...P,channelType:i,...i===vt.DM&&{isDm:!0,targetUserId:r}};await l.sendMessage(M,L,E,R,I,T,U)},[t,l,i,r]);return V.useEffect(()=>{if(!t||!e){p.current&&(Ge.info(`[useSocketChat] useEffect: channelId is now null/undefined, resetting joinedChannelRef from ${p.current}`),p.current=null);return}l.initialize(e),t!==p.current?(Ge.info(`[useSocketChat] useEffect: Joining channel ${t}. Previous joinedChannelRef: ${p.current}`),l.joinChannel(t),p.current=t):Ge.info(`[useSocketChat] useEffect: Channel ${t} already marked as joined by this instance. Skipping joinChannel call.`);const M=o(a=>{if(Ge.info("[useSocketChat] Received raw messageBroadcast data:",JSON.stringify(a)),(a.channelId||a.roomId)!==t)return;const u=a.senderId===e,d=i===vt.DM?a.senderId===r:s.some(A=>A.id===a.senderId);!u&&d&&m(!1);const x=a.clientMessageId;if(x&&u)v(x,{id:a.id||en(),isLoading:!1,createdAt:typeof a.createdAt=="number"?a.createdAt:Date.parse(a.createdAt),text:a.text,attachments:a.attachments,isAgent:!1});else{const A={id:a.id||en(),text:a.text,name:a.senderName,senderId:a.senderId,isAgent:d,createdAt:typeof a.createdAt=="number"?a.createdAt:Date.parse(a.createdAt),channelId:a.channelId||a.roomId,serverId:a.serverId,source:a.source,attachments:a.attachments,thought:a.thought,actions:a.actions,isLoading:!1,prompt:a.prompt,rawMessage:a.rawMessage};f.some(S=>S.id===a.id)||(Ge.info("[useSocketChat] Adding new UiMessage:",JSON.stringify(A)),n(A),d&&A.id?w.current=A.id:w.current=null)}},"handleMessageBroadcasting"),E=o(a=>{(a.channelId||a.roomId)===t&&m(!1)},"handleMessageComplete"),R=o(a=>{(a.channelId||a.roomId)===t&&(a.action==="disable_input"?m(!0):a.action==="enable_input"&&m(!1))},"handleControlMessage"),I=o(a=>{(a.channelId||a.roomId)===t&&a.messageId&&b(a.messageId)},"handleMessageDeleted"),T=o(a=>{(a.channelId||a.roomId)===t&&h()},"handleChannelCleared"),P=o(a=>{(a.channelId||a.roomId)===t&&h()},"handleChannelDeleted"),j=l.evtMessageBroadcast.attach(a=>(a.channelId||a.roomId)===t,M),L=l.evtMessageComplete.attach(a=>(a.channelId||a.roomId)===t,E),U=l.evtControlMessage.attach(a=>(a.channelId||a.roomId)===t,R),Z=l.evtMessageDeleted.attach(a=>(a.channelId||a.roomId)===t,I),ne=l.evtChannelCleared.attach(a=>(a.channelId||a.roomId)===t,T),F=l.evtChannelDeleted.attach(a=>(a.channelId||a.roomId)===t,P);return()=>{t&&(Ge.info(`[useSocketChat] useEffect cleanup: Leaving channel ${t}. Current joinedChannelRef: ${p.current}`),l.leaveChannel(t),t===p.current&&(p.current=null,Ge.info(`[useSocketChat] useEffect cleanup: Reset joinedChannelRef for ${t}`))),Y([j,L,U,Z,ne,F])};function Y(a){a.forEach(g=>g?.detach())}},[t,e,l]),{sendMessage:y,animatedMessageId:w.current}}o(ZT,"useSocketChat");const GT=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","avif"]),YT=new Set(["mp4","webm","mov","avi","mkv","flv","wmv","m4v","ogv"]),QT={youtube:{patterns:[/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/,/(?:https?:\/\/)?(?:www\.)?youtube\.com\/embed\/([a-zA-Z0-9_-]{11})/],getEmbedUrl:o(t=>`https://www.youtube.com/embed/${t}`,"getEmbedUrl")},vimeo:{patterns:[/(?:https?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)/],getEmbedUrl:o(t=>`https://player.vimeo.com/video/${t}`,"getEmbedUrl")}};function o3(t){try{return new URL(t).pathname.split(".").pop()?.toLowerCase()||""}catch{return""}}o(o3,"getFileExtension");function KT(t){const e=o3(t);return GT.has(e)}o(KT,"isImageUrl");function XT(t){const e=o3(t);return YT.has(e)}o(XT,"isVideoFileUrl");function l3(t){for(const[e,r]of Object.entries(QT))for(const i of r.patterns){const s=t.match(i);if(s&&s[1])return{platform:e,id:s[1],embedUrl:r.getEmbedUrl(s[1])}}return null}o(l3,"getVideoPlatformInfo");function u3(t){if(!t)return[];const e=/(https?:\/\/[^\s]+)/g;return(t.match(e)||[]).map(i=>{const s=i.replace(/[.,!?;)]*$/,"");if(KT(s))return{url:s,type:"image",isEmbed:!1};if(XT(s))return{url:s,type:"video",isEmbed:!1};const f=l3(s);return f?{url:f.embedUrl,type:"video",isEmbed:!0}:{url:s,type:"unknown",isEmbed:!1}}).filter(i=>i.type!=="unknown")}o(u3,"parseMediaFromText");function WT(t,e){let r=t;return e.forEach(i=>{if(i.isEmbed){const s=/(https?:\/\/[^\s]+)/g,f=t.match(s)||[];for(const n of f){const v=n.replace(/[.,!?;)]*$/,""),b=l3(v);if(b&&b.embedUrl===i.url){r=r.replace(n,"").trim();break}}}else r=r.replace(i.url,"").trim()}),r}o(WT,"removeMediaUrlsFromText");const vl=15;function c3(t){return(t.includes("TEXT")||t.includes("OBJECT"))&&!t.includes("EMBEDDING")&&!t.includes("TRANSCRIPTION")?"LLM":t.includes("EMBEDDING")?"Embedding":t.includes("TRANSCRIPTION")?"Transcription":t.includes("IMAGE")?"Image":!t.includes("TEXT")&&!t.includes("IMAGE")&&!t.includes("EMBEDDING")&&!t.includes("TRANSCRIPTION")?"Other":"Unknown"}o(c3,"getModelUsageType");function $T(t){if(!t)return"Unknown date";const e=new Date(t),r=new Date,i=(r.getTime()-e.getTime())/(1e3*60*60);return i<1?`${Math.floor((r.getTime()-e.getTime())/6e4)}m ago`:i<24?`${Math.floor(i)}h ago`:i<168?e.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}o($T,"formatDate");function JT(t=""){return t==="ACTION"?Xv:t.includes("TEXT_EMBEDDING")?Ll:t.includes("TRANSCRIPTION")?Kn:t.includes("TEXT")||t.includes("OBJECT")?Wv:t.includes("IMAGE")?k4:N4}o(JT,"getModelIcon");function qT(t){if(!t)return null;const{prompt_tokens:e,completion_tokens:r,total_tokens:i}=t;return i?{prompt:e||0,completion:r||0,total:i}:null}o(qT,"formatTokenUsage");function X1(t,e=100){return t.length<=e?t:t.substring(0,e)+"..."}o(X1,"truncateText");function bl(t){navigator.clipboard.writeText(t).catch(console.error)}o(bl,"copyToClipboard");function eP(t){const e={};for(const r of t){const i=r.createdAt||r.timestamp||0,f=new Date(i).toLocaleDateString();e[f]||(e[f]=[]),e[f].push(r)}return e}o(eP,"groupActionsByDate");function tP({action:t,onDelete:e}){const[r,i]=V.useState(!1),[s,f]=V.useState(!1),[n,v]=V.useState(!1),b=t.body?.modelType||"",h=t.body?.modelKey||"",m=t.type==="action",l=t.body?.action||"",w=JT(m?"ACTION":b),p=m?"Action":c3(b),y=qT(t.body?.response?.usage||t.body?.usage),M=t.body?.prompts,E=o(()=>{const T=t.body?.params;if(!T&&!M)return null;if(b.includes("TRANSCRIPTION")&&Array.isArray(T))return k.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[k.jsx(Kn,{className:"h-3 w-3"}),k.jsx("span",{children:"Audio input data"})]});const{prompt:P,...j}=T||{};return k.jsxs("div",{className:"space-y-4",children:[M&&Array.isArray(M)&&M.length>0&&k.jsxs("div",{className:"space-y-2",children:[k.jsx("div",{className:"flex items-center justify-between",children:k.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Prompts (",M.length,")"]})}),k.jsx("div",{className:"space-y-3",children:M.map((L,U)=>k.jsxs("div",{className:"space-y-1",children:[k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsxs("span",{className:"text-xs text-muted-foreground",children:[L.modelType||"Prompt"," #",U+1]}),k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>bl(L.prompt),"onClick"),className:"h-5 px-1 text-xs",title:"Copy prompt",children:k.jsx(hn,{className:"h-3 w-3"})})]}),k.jsx("div",{className:"bg-muted/30 rounded-md p-2",children:k.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto",children:L.prompt})})]},U))})]}),!M&&P&&k.jsxs("div",{className:"space-y-2",children:[k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Prompt"}),k.jsxs($e,{variant:"ghost",size:"sm",onClick:o(()=>bl(P),"onClick"),className:"h-6 px-2 text-xs",title:"Copy prompt",children:[k.jsx(hn,{className:"h-3 w-3 mr-1"}),"Copy"]})]}),k.jsx("div",{className:"bg-muted/30 rounded-md p-3 relative",children:k.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto",children:typeof P=="string"?P:JSON.stringify(P,null,2)})})]}),Object.keys(j).length>0&&k.jsxs("div",{className:"space-y-2",children:[k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Other Parameters"}),JSON.stringify(j,null,2).length>200?k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>f(!s),"onClick"),className:"h-6 px-2 text-xs",children:s?"Show less":"Show more"}):null]}),k.jsxs("div",{className:"bg-muted/30 rounded-md p-3 relative group",children:[k.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto",children:(()=>{const L=JSON.stringify(j,null,2),U=L.length>200;return s||!U?L:X1(L,200)})()}),k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>bl(JSON.stringify(j,null,2)),"onClick"),className:"absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy parameters",children:k.jsx(hn,{className:"h-3 w-3"})})]})]})]})},"renderParams"),R=o(()=>{const T=t.body?.response;if(!T)return null;if(T==="[array]")return k.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[k.jsx(wn,{className:"h-3 w-3"}),k.jsx("span",{children:"Array response data"})]});const P=typeof T=="object"?JSON.stringify(T,null,2):String(T),j=P.length>300;return k.jsxs("div",{className:"space-y-2",children:[k.jsxs("div",{className:"flex items-center justify-between",children:[k.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Response"}),j&&k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>v(!n),"onClick"),className:"h-6 px-2 text-xs",children:n?"Show less":"Show more"})]}),k.jsxs("div",{className:"bg-muted/30 rounded-md p-3 relative group max-h-64 overflow-y-auto",children:[k.jsx("pre",{className:"text-xs font-mono whitespace-pre-wrap overflow-x-auto",children:n||!j?P:X1(P,300)}),k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>bl(P),"onClick"),className:"absolute top-1 right-1 h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity",title:"Copy response",children:k.jsx(hn,{className:"h-3 w-3"})})]})]})},"renderResponse"),I=t.body?.params||t.body?.response||t.message||t.details;return k.jsxs("div",{className:"border rounded-lg bg-card hover:shadow-sm transition-all duration-200 group",children:[k.jsx("div",{className:"p-4 pb-3",children:k.jsxs("div",{className:"flex items-start justify-between",children:[k.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[k.jsx("div",{className:"p-2 rounded-lg bg-muted",children:k.jsx(w,{className:"h-4 w-4 text-muted-foreground"})}),k.jsxs("div",{className:"flex-1 min-w-0",children:[k.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[k.jsx("h4",{className:"font-semibold text-sm",children:m?l:p}),k.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:m?"Action":b}),t.body?.promptCount&&t.body.promptCount>1&&k.jsxs(ii,{variant:"secondary",className:"text-xs px-1.5",children:[t.body.promptCount," prompts"]})]}),k.jsxs("div",{className:"space-y-1",children:[(h||m)&&k.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[k.jsx(Xv,{className:"h-3 w-3"}),k.jsx("code",{className:"font-mono",children:m?`Action ID: ${t.body?.actionId?.slice(-8)||"N/A"}`:h})]}),k.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[k.jsx(bu,{className:"h-3 w-3"}),k.jsx("span",{children:$T(t.createdAt||t.timestamp)}),t.id&&k.jsxs(k.Fragment,{children:[k.jsx("span",{children:"•"}),k.jsx("code",{className:"text-[10px] bg-muted px-1 rounded",children:t.id.slice(-8)})]})]})]}),y&&k.jsxs("div",{className:"flex items-center gap-4 mt-2 text-xs",children:[k.jsxs("div",{className:"flex items-center gap-1",children:[k.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),k.jsx("span",{className:"font-mono",children:y.total.toLocaleString()})]}),y.prompt>0&&k.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[k.jsx("span",{children:"In:"}),k.jsx("span",{className:"font-mono",children:y.prompt.toLocaleString()})]}),y.completion>0&&k.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[k.jsx("span",{children:"Out:"}),k.jsx("span",{className:"font-mono",children:y.completion.toLocaleString()})]})]})]})]}),k.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[I&&k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>i(!r),"onClick"),className:"h-8 w-8 p-0",title:r?"Collapse details":"Expand details",children:r?k.jsx(wv,{className:"h-3 w-3"}):k.jsx(yn,{className:"h-3 w-3"})}),t.id&&e&&k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>{typeof t.id=="string"&&e(t.id)},"onClick"),className:"h-8 w-8 p-0 text-destructive hover:text-destructive",title:"Delete log entry",children:k.jsx(rs,{className:"h-3 w-3"})})]})]})}),r&&I&&k.jsxs(k.Fragment,{children:[k.jsx(Gr,{}),k.jsxs("div",{className:"p-4 pt-3 space-y-4",children:[E(),R(),(t.message||t.details)&&k.jsxs("div",{className:"space-y-2",children:[k.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Additional Info"}),k.jsxs("div",{className:"bg-muted/30 rounded-md p-3",children:[t.message&&k.jsxs("div",{className:"text-xs mb-2",children:[k.jsx("span",{className:"font-medium text-muted-foreground",children:"Message: "}),k.jsx("span",{children:t.message})]}),t.details&&k.jsxs("div",{className:"text-xs",children:[k.jsx("span",{className:"font-medium text-muted-foreground",children:"Details: "}),k.jsx("span",{children:t.details})]})]})]})]})]}),!r&&I&&k.jsxs(k.Fragment,{children:[k.jsx(Gr,{}),k.jsx("div",{className:"p-4 pt-3",children:k.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[k.jsx(Xr,{className:"h-3 w-3"}),k.jsx("span",{children:(()=>{const T=[];return t.body?.promptCount&&t.body.promptCount>0&&T.push(`${t.body.promptCount} prompt${t.body.promptCount>1?"s":""}`),t.body?.params&&T.push("parameters"),t.body?.response&&T.push("response data"),T.length>0?`Contains ${T.join(" and ")}`:"Contains additional data"})()}),k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>i(!0),"onClick"),className:"h-5 px-2 text-xs ml-auto",children:"View details"})]})})]})]})}o(tP,"ActionCard");function rP({loadingMore:t,onLoadMore:e}){return k.jsx("div",{className:"flex justify-center py-6",children:t?k.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[k.jsx(Ha,{className:"h-4 w-4 animate-spin"}),k.jsx("span",{className:"text-sm",children:"Loading more actions..."})]}):k.jsx($e,{variant:"outline",onClick:e,className:"px-8",children:"Load More"})})}o(rP,"LoadingIndicator");function iP({selectedType:t,searchQuery:e}){return k.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center p-8",children:[k.jsx(wn,{className:"h-16 w-16 text-muted-foreground/30 mb-4"}),k.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Actions Found"}),k.jsx("p",{className:"text-muted-foreground max-w-md mb-4",children:e?`No actions match "${e}". Try adjusting your search or filter.`:t==="all"?"Actions will appear here once the agent has performed operations.":`No ${t} actions found.`}),e&&k.jsx($e,{variant:"outline",onClick:o(()=>{},"onClick"),children:"Clear Search"})]})}o(iP,"EmptyState");function nP({agentId:t,roomId:e}){const[r,i]=V.useState("all"),[s,f]=V.useState(""),[n,v]=V.useState(vl),[b,h]=V.useState(!1),m=V.useRef(null),l=["embedding","text_embedding"],{data:w=[],isLoading:p,error:y}=$C(t,e,l),{mutate:M}=JC(),{confirm:E,isOpen:R,onOpenChange:I,onConfirm:T,options:P}=gs(),j=w.filter(a=>{if(r!=="all"){const g=a.body?.modelType||"",u=c3(g),d=a.type==="action";switch(r){case"llm":if(u!=="LLM"&&!d)return!1;break;case"transcription":if(u!=="Transcription")return!1;break;case"image":if(u!=="Image")return!1;break;case"other":if(u!=="Other"&&u!=="Unknown"&&!d)return!1;break}}if(s.trim()){const g=s.toLowerCase();return[a.body?.modelType,a.body?.modelKey,a.id,a.message,JSON.stringify(a.body?.params),JSON.stringify(a.body?.response)].filter(Boolean).join(" ").toLowerCase().includes(g)}return!0}),L=V.useCallback(()=>{if(!m.current||b||n>=j.length)return;const{scrollTop:a,scrollHeight:g,clientHeight:u}=m.current;a+u>=g-200&&(h(!0),setTimeout(()=>{v(x=>Math.min(x+vl,j.length)),h(!1)},500))},[b,n,j.length]);V.useEffect(()=>{v(vl)},[r,s]),V.useEffect(()=>{const a=m.current;if(a)return a.addEventListener("scroll",L),()=>a.removeEventListener("scroll",L)},[L]);const U=j.slice(0,n),Z=n<j.length,ne=eP(U),F=o(a=>{E({title:"Delete Log Entry",description:"Are you sure you want to permanently delete this log entry? This action cannot be undone.",confirmText:"Delete",variant:"destructive"},()=>{M({agentId:t,logId:a})})},"handleDelete"),Y=o(()=>{v(a=>a+vl)},"handleLoadMore");return p&&w.length===0?k.jsx("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:k.jsx("div",{className:"flex items-center justify-center flex-1",children:k.jsxs("div",{className:"flex flex-col items-center gap-4",children:[k.jsx(Ha,{className:"h-8 w-8 animate-spin text-muted-foreground"}),k.jsxs("div",{className:"text-center",children:[k.jsx("h3",{className:"font-medium",children:"Loading Actions"}),k.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching agent action history..."})]})]})})}):y?k.jsx("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:k.jsx("div",{className:"flex items-center justify-center flex-1",children:k.jsxs("div",{className:"text-center",children:[k.jsx(wn,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),k.jsx("h3",{className:"font-medium text-destructive",children:"Failed to Load Actions"}),k.jsx("p",{className:"text-sm text-muted-foreground",children:"There was an error loading the agent actions."})]})})}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:[k.jsxs("div",{className:"flex justify-between items-center mb-4 px-4 pt-4 flex-none border-b pb-3",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("h3",{className:"text-lg font-medium",children:" Actions"}),!p&&k.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded bg-muted text-muted-foreground",children:j.length})]}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsxs("div",{className:"relative",children:[k.jsx(wh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),k.jsx(hr,{placeholder:"Search actions...",value:s,onChange:o(a=>f(a.target.value),"onChange"),className:"pl-10 w-64"})]}),k.jsxs($n,{value:r,onValueChange:o(a=>i(a),"onValueChange"),children:[k.jsx(mn,{className:"w-40",children:k.jsx(Jn,{placeholder:"Filter actions"})}),k.jsxs(gn,{children:[k.jsx(Kt,{value:"all",children:"All Actions"}),k.jsx(Kt,{value:"llm",children:"LLM Calls"}),k.jsx(Kt,{value:"transcription",children:"Transcriptions"}),k.jsx(Kt,{value:"image",children:"Image Operations"}),k.jsx(Kt,{value:"other",children:"Other"})]})]})]})]}),k.jsx("div",{ref:m,className:"flex-1 overflow-y-auto px-4",children:j.length===0?k.jsx(iP,{selectedType:r,searchQuery:s}):k.jsxs("div",{className:"space-y-4",children:[Object.entries(ne).map(([a,g])=>k.jsxs("div",{className:"space-y-3",children:[k.jsxs("div",{className:"flex items-center gap-3 py-2",children:[k.jsx(Gr,{className:"flex-1"}),k.jsx("span",{className:"text-sm font-medium text-muted-foreground px-2",children:a}),k.jsx(Gr,{className:"flex-1"})]}),k.jsx("div",{className:"space-y-3",children:g.map((u,d)=>k.jsx(tP,{action:u,onDelete:F},u.id||d))})]},a)),Z&&k.jsx(rP,{loadingMore:b,onLoadMore:Y})]})})]}),k.jsx(ms,{open:R,onOpenChange:I,title:P?.title||"",description:P?.description||"",confirmText:P?.confirmText,cancelText:P?.cancelText,variant:P?.variant,onConfirm:T})]})}o(nP,"AgentActionViewer");function sP({isOpen:t,onClose:e,memory:r,agentId:i}){const{toast:s}=Wt(),{mutate:f,isPending:n}=eR(),{mutate:v,isPending:b}=qC(),[h,m]=V.useState(""),[l,w]=V.useState(!0),[p,y]=V.useState(!1),[M,E]=V.useState(!1),R=V.useRef(null),I=n||b,T=JSON.stringify(r.content,null,2),{confirm:P,isOpen:j,onOpenChange:L,onConfirm:U,options:Z}=gs();V.useEffect(()=>{t&&(m(T),w(!0),E(!1),y(!1),setTimeout(()=>{R.current?.focus()},100))},[t,T]),V.useEffect(()=>{E(h!==T)},[h,T]),V.useEffect(()=>{if(!h.trim()){w(!1);return}try{JSON.parse(h),w(!0)}catch{w(!1)}},[h]),V.useEffect(()=>{const x=o(A=>{A.key==="Escape"&&t&&(M?P({title:"Discard Unsaved Changes?",description:"You have unsaved changes. Are you sure you want to close without saving?",confirmText:"Discard",variant:"destructive"},()=>{e()}):e())},"handleEscape");return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[t,M,e]);const ne=V.useCallback(()=>{if(!h.trim()){s({title:"Error",description:"Memory content cannot be empty",variant:"destructive"});return}if(!l){s({title:"Invalid JSON",description:"Please fix JSON syntax errors before saving",variant:"destructive"});return}try{const x=JSON.parse(h);f({agentId:i,memoryId:r.id,memoryData:{content:x}},{onSuccess:o(()=>{e(),s({title:"Memory Updated",description:"The memory content has been successfully updated"})},"onSuccess"),onError:o(A=>{s({title:"Update Failed",description:A.message||"Failed to update memory",variant:"destructive"})},"onError")})}catch{s({title:"Invalid JSON",description:"Please enter valid JSON format",variant:"destructive"})}},[h,l,f,i,r.id,e,s]),F=V.useCallback(()=>{P({title:"Delete Memory",description:"Are you sure you want to delete this memory? This action cannot be undone.",confirmText:"Delete",variant:"destructive"},()=>{v({agentId:i,memoryId:r.id},{onSuccess:o(()=>{e(),s({title:"Memory Deleted",description:"The memory has been successfully removed"})},"onSuccess"),onError:o(x=>{s({title:"Delete Failed",description:x.message||"Failed to delete memory",variant:"destructive"})},"onError")})})},[v,i,r.id,e,s]),Y=V.useCallback(()=>{try{const x=JSON.parse(h);m(JSON.stringify(x,null,2)),s({title:"Formatted",description:"JSON has been formatted"})}catch{s({title:"Format Error",description:"Cannot format invalid JSON",variant:"destructive"})}},[h,s]),a=V.useCallback(()=>{P({title:"Reset Changes",description:"Reset to original content? All unsaved changes will be lost.",confirmText:"Reset",variant:"destructive"},()=>{m(T)})},[T]),g=V.useCallback(async()=>{try{await navigator.clipboard.writeText(h),s({title:"Copied",description:"Content copied to clipboard"})}catch{s({title:"Copy Failed",description:"Failed to copy to clipboard",variant:"destructive"})}},[h,s]),u=o(x=>new Date(x).toLocaleString(),"formatTimestamp"),d=o(x=>{x.target===x.currentTarget&&(M?P({title:"Discard Unsaved Changes?",description:"You have unsaved changes. Are you sure you want to close without saving?",confirmText:"Discard",variant:"destructive"},()=>{e()}):e())},"handleOverlayClick");return t?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4",onClick:d,role:"dialog","aria-modal":"true","aria-labelledby":"memory-edit-title",children:k.jsxs(Oi,{className:"w-full max-w-4xl h-[85vh] max-h-[800px] flex flex-col",onClick:o(x=>x.stopPropagation(),"onClick"),children:[k.jsxs(ac,{className:"flex flex-row items-center justify-between space-y-0 pb-2 flex-shrink-0",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx(Op,{id:"memory-edit-title",className:"text-xl font-semibold",children:"Edit Memory Content"}),M&&k.jsx("span",{className:"text-xs px-2 py-1 rounded bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",children:"Unsaved changes"})]}),k.jsx($e,{variant:"ghost",size:"sm",onClick:e,"aria-label":"Close dialog",children:k.jsx(Vr,{className:"h-4 w-4"})})]}),k.jsx(Gr,{}),k.jsxs(vs,{className:"pt-4 flex-1 overflow-hidden flex flex-col",children:[k.jsxs("div",{className:"mb-4 flex items-start bg-amber-50 dark:bg-amber-950/50 border border-amber-200 dark:border-amber-800 rounded-md p-3",children:[k.jsx(Xp,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 mr-2 mt-0.5 flex-shrink-0"}),k.jsxs("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[k.jsx("p",{className:"font-medium mb-1",children:"Editing Raw Memory Content"}),k.jsx("p",{children:"Changes may affect agent behavior. Ensure JSON format is valid before saving."})]})]}),k.jsxs("div",{className:"mb-4 grid grid-cols-1 md:grid-cols-2 gap-2 text-sm",children:[k.jsxs("div",{className:"space-y-1",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"text-muted-foreground",children:"ID:"}),k.jsx("code",{className:"text-xs bg-muted px-1 rounded",children:r.id})]}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"text-muted-foreground",children:"Created:"}),k.jsx("span",{children:u(r.createdAt||0)})]})]}),k.jsxs("div",{className:"space-y-1",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"text-muted-foreground",children:"Room:"}),k.jsx("code",{className:"text-xs bg-muted px-1 rounded",children:r.roomId})]}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"text-muted-foreground",children:"Type:"}),k.jsx("span",{className:`text-xs px-2 py-1 rounded-full ${r.entityId===i?"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200":"bg-white-100 text-white dark:bg-white-800 dark:text-white"}`,children:r.entityId===i?"Agent Message":"User Message"})]})]})]}),k.jsxs("div",{className:"flex items-center justify-between mb-2",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("label",{htmlFor:"memory-content",className:"text-sm font-medium",children:"Memory Content"}),k.jsxs("div",{className:"flex items-center gap-1",children:[l?k.jsx(zs,{className:"h-3 w-3 text-green-500"}):k.jsx(Xp,{className:"h-3 w-3 text-red-500"}),k.jsx("span",{className:`text-xs ${l?"text-green-600":"text-red-600"}`,children:l?"Valid JSON":"Invalid JSON"})]})]}),k.jsxs("div",{className:"flex items-center gap-1",children:[k.jsx($e,{variant:"outline",size:"sm",onClick:o(()=>y(!p),"onClick"),disabled:I,title:p?"Switch to edit mode":"Switch to preview mode",children:p?k.jsx(Wi,{className:"h-3 w-3"}):k.jsx(wi,{className:"h-3 w-3"})}),k.jsx($e,{variant:"outline",size:"sm",onClick:g,disabled:I,title:"Copy to clipboard",children:k.jsx(hn,{className:"h-3 w-3"})}),k.jsx($e,{variant:"outline",size:"sm",onClick:Y,disabled:I||!l,title:"Format JSON",children:"Format"}),k.jsx($e,{variant:"outline",size:"sm",onClick:a,disabled:I||!M,title:"Reset to original",children:k.jsx(Rv,{className:"h-3 w-3"})})]})]}),k.jsxs("div",{className:"flex-1 min-h-0 flex flex-col",children:[p?k.jsx("div",{className:"flex-1 border rounded-md p-3 bg-muted/50 overflow-auto",children:k.jsx("pre",{className:"text-sm whitespace-pre-wrap",children:l?JSON.stringify(JSON.parse(h),null,2):h})}):k.jsx(To,{ref:R,id:"memory-content",value:h,onChange:o(x=>m(x.target.value),"onChange"),className:`flex-1 resize-none font-mono text-sm min-h-[300px] ${l?"":"border-red-300 focus:border-red-500"}`,placeholder:"Memory content in JSON format...",disabled:I,"aria-describedby":"json-help"}),k.jsx("p",{id:"json-help",className:"text-xs text-muted-foreground mt-2 flex-shrink-0",children:"Edit the JSON directly. Use Ctrl+A to select all, Ctrl+Z to undo."})]})]}),k.jsxs(oc,{className:"flex justify-between flex-shrink-0",children:[k.jsxs($e,{variant:"destructive",onClick:F,disabled:I,children:[k.jsx(Io,{className:"mr-2 h-4 w-4"}),"Delete Memory"]}),k.jsxs("div",{className:"flex gap-2",children:[k.jsx($e,{variant:"outline",onClick:e,disabled:I,children:"Cancel"}),k.jsxs($e,{onClick:ne,disabled:I||!l||!M,children:[k.jsx(Iv,{className:"mr-2 h-4 w-4"}),n?"Saving...":"Save Changes"]})]})]})]})}),k.jsx(ms,{open:j,onOpenChange:L,title:Z?.title||"",description:Z?.description||"",confirmText:Z?.confirmText,cancelText:Z?.cancelText,variant:Z?.variant,onConfirm:U})]}):null}o(sP,"MemoryEditOverlay");const yl=15;function aP({agentId:t,agentName:e,channelId:r}){const[i,s]=V.useState("all"),[f,n]=V.useState(""),[v,b]=V.useState(null),[h,m]=V.useState(yl),[l,w]=V.useState(!1),p=V.useRef(null),{data:y}=Np(),M=i==="facts"?void 0:"messages",E=i==="facts"||i==="all"?"facts":void 0,R=i==="currentChat"&&r?r:void 0,{data:I=[],isLoading:T,error:P}=Zg(t,M,R),{data:j=[],isLoading:L,error:U}=Zg(t,E,R),Z=[...I,...j],ne=T||L,F=P||U,Y=Z.filter(C=>{if(i!=="all"&&i!=="currentChat"){if(i==="facts")return!0;if(i==="messagesSent"&&C.entityId!==C.agentId||i==="messagesReceived"&&C.entityId===C.agentId)return!1}if(f.trim()){const O=f.toLowerCase(),D=C.content;return[D?.text,D?.thought,C.id,C.metadata].filter(Boolean).join(" ").toLowerCase().includes(O)}return!0}),a=V.useCallback(()=>{if(!p.current||l||h>=Y.length)return;const{scrollTop:C,scrollHeight:O,clientHeight:D}=p.current;C+D>=O-200&&(w(!0),setTimeout(()=>{m(z=>Math.min(z+yl,Y.length)),w(!1)},500))},[l,h,Y.length]);V.useEffect(()=>{m(yl)},[i,f]),V.useEffect(()=>{const C=p.current;if(C)return C.addEventListener("scroll",a),()=>C.removeEventListener("scroll",a)},[a]);const g=o(C=>{const O=new Date(C),B=(new Date().getTime()-O.getTime())/(1e3*60*60);return B<24?O.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):B<168?O.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):O.toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},"formatDate"),u=o((C,O)=>O?.thought?Ll:C.entityId===C.agentId?Wv:R4,"getMemoryIcon"),d=o(async C=>{try{await navigator.clipboard.writeText(C)}catch(O){console.error("Failed to copy:",O)}},"copyToClipboard"),x=o(C=>{const O={};for(const D of C){const z=new Date(D.createdAt||0).toLocaleDateString();O[z]||(O[z]=[]),O[z].push(D)}return O},"groupMessagesByDate"),A=Y.slice(0,h),N=h<Y.length,S=x(A);if(ne&&Z.length===0)return k.jsx("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:k.jsx("div",{className:"flex items-center justify-center flex-1",children:k.jsxs("div",{className:"flex flex-col items-center gap-4",children:[k.jsx(Ha,{className:"h-8 w-8 animate-spin text-muted-foreground"}),k.jsxs("div",{className:"text-center",children:[k.jsx("h3",{className:"font-medium",children:"Loading Memories"}),k.jsx("p",{className:"text-sm text-muted-foreground",children:"Fetching agent conversation history..."})]})]})})});if(F)return k.jsx("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:k.jsx("div",{className:"flex items-center justify-center flex-1",children:k.jsxs("div",{className:"text-center",children:[k.jsx(wn,{className:"h-12 w-12 text-destructive mx-auto mb-4"}),k.jsx("h3",{className:"font-medium text-destructive",children:"Failed to Load Memories"}),k.jsx("p",{className:"text-sm text-muted-foreground",children:"There was an error loading the agent memories."})]})})});const c=o(()=>k.jsxs("div",{className:"flex flex-col items-center justify-center flex-1 text-center p-8",children:[k.jsx(wn,{className:"h-16 w-16 text-muted-foreground/30 mb-4"}),k.jsx("h3",{className:"text-lg font-medium mb-2",children:"No Memories Found"}),k.jsx("p",{className:"text-muted-foreground max-w-md mb-4",children:f?`No memories match "${f}". Try adjusting your search or filter.`:"This agent hasn't created any memories yet. Memories will appear here as the agent interacts."}),f&&k.jsx($e,{variant:"outline",onClick:o(()=>n(""),"onClick"),children:"Clear Search"})]}),"EmptyState"),_=o(({memory:C})=>{const O=C.content,D=u(C,O),B=C.entityId===C.agentId,G=o(()=>B?y?.data?.agents?.find($=>$.id===C.entityId)?.name||e:C.metadata?.raw?.senderName||C.metadata?.source||"User","getEntityName")();return k.jsxs("div",{className:"border rounded-lg p-4 bg-card hover:bg-accent/5 transition-colors group",children:[k.jsxs("div",{className:"flex items-start justify-between mb-3",children:[k.jsxs("div",{className:"flex items-center gap-3",children:[k.jsx("div",{className:"p-2 rounded-md bg-muted",children:k.jsx(D,{className:"h-4 w-4"})}),k.jsxs("div",{children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("span",{className:"font-medium text-sm",children:G}),k.jsx("span",{className:"text-xs px-2 py-0.5 rounded bg-muted text-muted-foreground",children:O?.thought?"Thought":B?"Agent":"User"})]}),k.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[k.jsx(bu,{className:"h-3 w-3"}),k.jsx("span",{children:g(C.createdAt||0)}),C.id&&k.jsxs(k.Fragment,{children:[k.jsx("span",{children:"•"}),k.jsx("code",{className:"text-[10px] bg-muted px-1 rounded",children:C.id.slice(-8)})]})]})]})]}),k.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[O?.text&&k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>d(O.text||""),"onClick"),className:"h-8 w-8 p-0",title:"Copy text",children:k.jsx(hn,{className:"h-3 w-3"})}),C.id&&k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>b(C),"onClick"),className:"h-8 w-8 p-0",title:"Edit memory",children:k.jsx(C4,{className:"h-3 w-3"})})]})]}),k.jsxs("div",{className:"space-y-3",children:[O?.text&&k.jsx("div",{className:"bg-muted/50 rounded-md p-3",children:k.jsx("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:O.text})}),O?.thought&&k.jsxs("div",{className:"border-l-2 border-muted pl-3",children:[k.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[k.jsx(Ll,{className:"h-3 w-3 text-muted-foreground"}),k.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Thought Process"})]}),k.jsx("p",{className:"text-xs text-muted-foreground italic leading-relaxed",children:String(O.thought)})]}),(O?.actions||O?.providers||O?.source)&&k.jsxs("div",{className:"flex flex-wrap gap-1",children:[O.actions?.map(te=>k.jsx("span",{className:"text-xs px-2 py-1 bg-muted rounded text-muted-foreground",title:"Action",children:te},te)),O.providers?.map(te=>k.jsx("span",{className:"text-xs px-2 py-1 bg-muted rounded text-muted-foreground",title:"Provider",children:te},te)),O.source&&k.jsx("span",{className:"text-xs px-2 py-1 bg-muted rounded text-muted-foreground",children:O.source})]}),C.metadata&&Object.keys(C.metadata).length>0&&k.jsxs("details",{className:"text-xs",children:[k.jsx("summary",{className:"cursor-pointer text-muted-foreground hover:text-foreground",children:"View metadata"}),k.jsx("div",{className:"mt-2 p-2 bg-muted/30 rounded text-[10px] font-mono overflow-x-auto",children:k.jsx("pre",{children:JSON.stringify(C.metadata,null,2)})})]})]})]})},"MemoryCard");return k.jsxs("div",{className:"flex flex-col h-[calc(100vh-100px)] min-h-[400px] w-full",children:[k.jsxs("div",{className:"flex justify-between items-center mb-4 px-4 pt-4 flex-none border-b pb-3",children:[k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsx("h3",{className:"text-lg font-medium",children:"Memories"}),!ne&&k.jsx("span",{className:"ml-2 text-xs px-2 py-1 rounded bg-muted text-muted-foreground",children:Y.length})]}),k.jsxs("div",{className:"flex items-center gap-2",children:[k.jsxs("div",{className:"relative",children:[k.jsx(wh,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),k.jsx(hr,{placeholder:"Search memories...",value:f,onChange:o(C=>n(C.target.value),"onChange"),className:"pl-10 w-full min-w-0 max-w-64"})]}),k.jsxs($n,{value:i,onValueChange:o(C=>s(C),"onValueChange"),children:[k.jsx(mn,{className:"w-40",children:k.jsx(Jn,{placeholder:"Filter memories"})}),k.jsxs(gn,{children:[k.jsx(Kt,{value:"all",children:"All Messages"}),r&&k.jsx(Kt,{value:"currentChat",children:"Current Chat"}),k.jsx(Kt,{value:"messagesSent",children:"Agent Messages"}),k.jsx(Kt,{value:"messagesReceived",children:"User Messages"}),k.jsx(Kt,{value:"facts",children:"Facts"})]})]})]})]}),k.jsx("div",{ref:p,className:"flex-1 overflow-y-auto px-4",children:Y.length===0?k.jsx(c,{}):k.jsxs("div",{className:"space-y-4",children:[Object.entries(S).map(([C,O])=>k.jsxs("div",{className:"space-y-3",children:[k.jsxs("div",{className:"flex items-center gap-3 py-2",children:[k.jsx(Gr,{className:"flex-1"}),k.jsx("span",{className:"text-sm font-medium text-muted-foreground px-2",children:C}),k.jsx(Gr,{className:"flex-1"})]}),k.jsx("div",{className:"space-y-3",children:O.map(D=>k.jsx(_,{memory:D},D.id||D.createdAt))})]},C)),N&&k.jsx("div",{className:"flex justify-center py-6",children:l?k.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[k.jsx(Ha,{className:"h-4 w-4 animate-spin"}),k.jsx("span",{className:"text-sm",children:"Loading more memories..."})]}):k.jsx($e,{variant:"outline",onClick:o(()=>m(C=>C+yl),"onClick"),className:"px-8",children:"Load More"})})]})}),v&&k.jsx(sP,{isOpen:!!v,onClose:o(()=>b(null),"onClose"),memory:v,agentId:t})]})}o(aP,"AgentMemoryViewer");function f3(t){const[e,r]=V.useState(!1),{toast:i}=Wt(),s=wr(),f=br();return{handleDelete:V.useCallback(async()=>{r(!0),i({title:"Deleting...",description:`Deleting agent "${t.name}"`});let v=!1,b=null;try{b=setTimeout(()=>{v||(f.invalidateQueries({queryKey:["agents"]}),s("/"),i({title:"Note",description:"Deletion is still processing in the background."}))},8e3);const h=Xt();if(!t.id)throw new Error("Agent ID is required for deletion");const m=await h.agents.deleteAgent(t.id);v=!0,b&&clearTimeout(b);const l=m?.partial;i(l?{title:"Processing",description:"Deletion is still in progress and will complete in the background."}:{title:"Success",description:"Agent deleted successfully"}),f.invalidateQueries({queryKey:["agents"]}),s("/")}catch(h){v=!0,b&&clearTimeout(b);const m=h?.message??"Failed to delete agent",l=h?.statusCode||h?.response?.status;l===409||m.includes("409")||m.includes("Conflict")||m.includes("foreign key constraint")||m.includes("active references")?i({title:"Cannot Delete",description:"This agent cannot be deleted because it has active references. Try stopping the agent first.",variant:"destructive"}):l===408||l===504||m.includes("408")||m.includes("504")||m.includes("timeout")||m.includes("timed out")?(i({title:"Operation Timeout",description:"The deletion is taking longer than expected and will continue in the background.",variant:"destructive"}),f.invalidateQueries({queryKey:["agents"]}),s("/")):i({title:"Error",description:m,variant:"destructive"})}finally{r(!1)}},[t,i,s,f]),isDeleting:e}}o(f3,"useDeleteAgent");function d3({agent:t,agentId:e,onSaveComplete:r}){const{toast:i}=Wt(),s=wr(),f=br(),{confirm:n,isOpen:v,onOpenChange:b,onConfirm:h,options:m}=gs(),l=t?.status===pr.ACTIVE,w=V.useRef(null),[p,y]=V.useState({}),{handleDelete:M,isDeleting:E}=f3(t),R=X6(t),{stopAgent:I,isAgentStopping:T}=na(),P=o(async()=>{try{await I(t),i({title:"Success",description:"Agent stopped successfully"})}catch(U){i({title:"Error",description:U instanceof Error?U.message:"Failed to stop agent",variant:"destructive"})}},"handleStopAgent"),j=o(async()=>{if(!e){i({title:"Error",description:"Agent ID is missing",variant:"destructive"});return}const U=o(async()=>{try{const Z=Xt(),ne=Object.keys(p).length>0?p:w.current?.getSecrets()||{},F=R.getChangedFields();if(ne&&Object.keys(ne).length>0){F.settings||(F.settings={});const a=Object.entries(ne).filter(([g,u])=>u!==null).reduce((g,[u,d])=>({...g,[u]:d}),{});F.settings.secrets=a}if(Object.keys(F).length===0){const a=R.agent?.settings?.secrets;if(a&&Object.keys(a).length>0){const g={id:e,settings:{secrets:a}};await Z.agents.updateAgent(e,g),f.invalidateQueries({queryKey:["agent",e]}),f.invalidateQueries({queryKey:["agents"]}),i({title:"Success",description:"Agent secrets updated successfully"}),r?r():s("/");return}i({title:"No Changes",description:"No changes were made to the agent"}),r?r():s("/");return}const Y={id:e,...F};await Z.agents.updateAgent(e,Y),f.invalidateQueries({queryKey:["agent",e]}),f.invalidateQueries({queryKey:["agents"]}),i({title:"Success",description:"Agent updated successfully"}),r?r():s("/")}catch(Z){throw i({title:"Error",description:Z instanceof Error?Z.message:"Failed to update agent",variant:"destructive"}),Z}},"performSave");if(w?.current){const Z=w.current.validateSecrets();if(!Z.isValid){n({title:"Missing Required Secrets",description:`The following required secrets are missing: ${Z.missingSecrets.join(", ")}. Do you want to save anyway?`,confirmText:"Save Anyway",cancelText:"Cancel",variant:"destructive"},U);return}}await U()},"handleSubmit"),L=o(()=>{E||n({title:"Delete Agent",description:`Are you sure you want to delete the agent "${t.name}"? This action cannot be undone.`,confirmText:"Delete",variant:"destructive"},M)},"handleDelete");return k.jsxs(k.Fragment,{children:[k.jsx(V6,{characterValue:R.agent,setCharacterValue:R,title:"Agent Settings",description:"Configure your AI agent's behaviour and capabilities.",onSubmit:j,onReset:R.reset,onDelete:L,onStopAgent:l?P:void 0,isAgent:!0,isDeleting:E,isStopping:T(e),customComponents:[{name:"Plugins",component:k.jsx(Y6,{characterValue:R.agent,setCharacterValue:R,initialPlugins:t.plugins})},{name:"Secret",component:k.jsx(vp,{characterValue:R.agent,ref:w,onChange:o(U=>{y(U),R.updateSettings({secrets:U})},"onChange")})},{name:"Avatar",component:k.jsx(Z6,{characterValue:R.agent,setCharacterValue:R})}]}),k.jsx(ms,{open:v,onOpenChange:b,title:m?.title||"",description:m?.description||"",confirmText:m?.confirmText,cancelText:m?.cancelText,variant:m?.variant,onConfirm:h})]})}o(d3,"AgentSettings");const W1="eliza-agent-tab-states";function oP(t){const[e,r]=V.useState("details"),i=V.useCallback(()=>{try{const n=localStorage.getItem(W1);return n?JSON.parse(n):{}}catch(n){return Ge.error("Error reading agent tab states from localStorage:",n),{}}},[]),s=V.useCallback(n=>{try{localStorage.setItem(W1,JSON.stringify(n))}catch(v){Ge.error("Error saving agent tab states to localStorage:",v)}},[]);V.useEffect(()=>{if(!t){r("details");return}const v=i()[t]||"details";r(v)},[t,i]);const f=V.useCallback(n=>{if(r(n),t){const b={...i(),[t]:n};s(b)}},[t,i,s]);return{currentTab:e,setTab:f}}o(oP,"useAgentTabState");function $1({agentId:t,agentName:e,channelId:r}){const{currentTab:i,setTab:s}=oP(t),{data:f,isLoading:n}=tR(t,{enabled:!!t}),{data:v,isLoading:b,error:h}=Go(t,{enabled:!!t&&i==="details"}),m=v?.data,l=V.useMemo(()=>f?.data||[],[f]),w=V.useMemo(()=>{const p=[{value:"details",label:"Details",icon:k.jsx(Ov,{className:"h-4 w-4"})},{value:"actions",label:"Model Calls",icon:k.jsx(wi,{className:"h-4 w-4"})},{value:"memories",label:"Memories",icon:k.jsx(wn,{className:"h-4 w-4"})},{value:"logs",label:"Logs",icon:k.jsx(O4,{className:"h-4 w-4"})}],y=l.map(M=>({value:M.name,label:M.name,icon:k.jsx(I4,{className:"h-4 w-4"})}));return[...p,...y]},[l]);return k.jsxs(Rh,{defaultValue:"details",value:i,onValueChange:s,className:"flex flex-col h-screen w-full max-w-full",children:[k.jsxs(Su,{className:"flex w-full max-w-full overflow-x-auto flex-shrink-0",children:[w.map(p=>k.jsxs(Qa,{value:p.value,className:"flex items-center gap-1.5 flex-shrink-0",children:[p.icon,k.jsx("span",{className:"truncate",children:p.label})]},p.value)),n&&k.jsx(k.Fragment,{children:[...Array(2)].map((p,y)=>k.jsx(Ya,{className:"h-9 w-full rounded-md flex-shrink-0"},`skel-tab-${y}`))})]}),k.jsxs(xi,{value:"details",className:"overflow-y-auto overflow-x-hidden flex-1 p-4 w-full max-w-full min-h-0",children:[i==="details"&&t&&k.jsxs(k.Fragment,{children:[b&&k.jsx("div",{className:"flex items-center justify-center h-full",children:k.jsx(Ar,{className:"h-6 w-6 animate-spin text-primary"})}),h&&k.jsxs("div",{className:"text-red-500 break-words",children:["Error loading agent details: ",h.message]}),!b&&!h&&m&&k.jsx("div",{className:"w-full max-w-full",children:k.jsx(d3,{agent:m,agentId:t,onSaveComplete:o(()=>{},"onSaveComplete")})}),!b&&!h&&!m&&!n&&k.jsx("div",{className:"text-muted-foreground",children:"Agent details not found."})]}),i==="details"&&!t&&k.jsx("div",{className:"p-4 text-muted-foreground",children:"Select an agent to see their details."})]}),k.jsxs(xi,{value:"actions",className:"overflow-y-auto overflow-x-hidden flex-1 w-full max-w-full min-h-0",children:[i==="actions"&&t&&k.jsx("div",{className:"w-full max-w-full",children:k.jsx(nP,{agentId:t})}),i==="actions"&&!t&&k.jsx("div",{className:"p-4 text-muted-foreground",children:"Select an agent to see their actions."})]}),k.jsxs(xi,{value:"logs",className:"overflow-y-auto overflow-x-hidden flex-1 w-full max-w-full min-h-0",children:[i==="logs"&&t&&k.jsx("div",{className:"w-full max-w-full",children:k.jsx(_8,{agentName:e,level:"all"})}),i==="logs"&&!t&&k.jsx("div",{className:"p-4 text-muted-foreground",children:"Select an agent to see their logs."})]}),k.jsxs(xi,{value:"memories",className:"overflow-y-auto overflow-x-hidden flex-1 w-full max-w-full min-h-0",children:[i==="memories"&&t&&k.jsx("div",{className:"w-full max-w-full",children:k.jsx(aP,{agentId:t,agentName:e,channelId:r})}),i==="memories"&&!t&&k.jsx("div",{className:"p-4 text-muted-foreground",children:"Select an agent to see their memories."})]}),l.map(p=>k.jsx(xi,{value:p.name,className:"overflow-y-auto overflow-x-hidden flex-1 w-full max-w-full min-h-0",children:i===p.name&&t&&k.jsx("iframe",{src:p.url,title:p.name,className:"w-full h-full border-0 flex-1 max-w-full"})},p.name))]})}o($1,"AgentSidebar");const lP=160,h3=V.forwardRef(({className:t,...e},r)=>{const i=V.useRef(null),s=o(n=>{typeof r=="function"?r(n):r&&(r.current=n),i.current=n},"combinedRef"),f=o(()=>{const n=i.current;n&&(n.style.height="auto",n.style.height=Math.min(n.scrollHeight,lP)+"px")},"resizeTextarea");return V.useEffect(()=>{f()},[e.value]),k.jsx(To,{autoComplete:"off",ref:s,name:"message",className:He("px-4 py-3 bg-background text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring disabled:cursor-not-allowed disabled:opacity-50 w-full rounded-md flex items-center h-16 resize-none",t),...e})});h3.displayName="ChatInput";let Ia,Oa=[],wl;const J1=o((t,e)=>String(t).padStart(e,"0"),"padWithLeadingZeros"),uP=o(({className:t,timerClassName:e,agentId:r,onChange:i})=>{const{toast:s}=Wt(),[f,n]=V.useState(!1),[v,b]=V.useState(!1),[h,m]=V.useState(0),[l,w]=V.useState({id:-1,name:"",file:null}),p=Math.floor(h%3600/60),y=h%60,[M,E]=V.useMemo(()=>J1(p,2).split(""),[p]),[R,I]=V.useMemo(()=>J1(y,2).split(""),[y]),T=V.useRef({stream:null,analyser:null,mediaRecorder:null,audioContext:null}),P=Xt(),j=Fr({mutationKey:["whisper"],mutationFn:o(F=>P.audio.transcribe(r,{audio:F}),"mutationFn"),onSuccess:o(F=>{F?.text&&i(F.text)},"onSuccess"),onError:o(F=>{s({variant:"destructive",title:"Unable to start recording",description:F.message}),console.log(F)},"onError")});function L(){navigator.mediaDevices?.getUserMedia&&navigator.mediaDevices.getUserMedia({audio:!0}).then(F=>{n(!0);const Y=window.AudioContext,a=new Y,g=a.createAnalyser();a.createMediaStreamSource(F).connect(g),T.current={stream:F,analyser:g,mediaRecorder:null,audioContext:a};const x={mimeType:MediaRecorder.isTypeSupported("audio/mpeg")?"audio/mpeg":MediaRecorder.isTypeSupported("audio/webm")?"audio/webm":"audio/wav"};T.current.mediaRecorder=new MediaRecorder(F,x),T.current.mediaRecorder.start(),Oa=[],Ia=new MediaRecorder(F),Ia.start(),Ia.ondataavailable=A=>{Oa.push(A.data)}}).catch(F=>{s({variant:"destructive",title:"Unable to start recording",description:F.message}),console.log(F)})}o(L,"startRecording");function U(){Ia.onstop=()=>{const F=new Blob(Oa,{type:"audio/wav"});j.mutate(F),w({...l,file:window.URL.createObjectURL(F)}),Oa=[]},Ia.stop(),n(!1),b(!0),m(0),clearTimeout(wl)}o(U,"stopRecording");function Z(){const{mediaRecorder:F,stream:Y,analyser:a,audioContext:g}=T.current;if(F&&(F.onstop=()=>{Oa=[]},F.stop()),a&&a.disconnect(),Y)for(const u of Y.getTracks())u.stop();g&&g.close(),n(!1),b(!0),m(0),clearTimeout(wl)}o(Z,"resetRecording");const ne=o(()=>{U()},"handleSubmit");return V.useEffect(()=>(f&&(wl=setTimeout(()=>{m(h+1)},1e3)),()=>clearTimeout(wl)),[f,h]),j?.isPending?k.jsx($e,{variant:"ghost",disabled:!0,size:"icon",children:k.jsx(Yv,{className:"size-4"})}):k.jsxs("div",{className:He("flex items-center justify-center gap-2 border-l border-l-transparent border-opacity-0 transition-all duration-300",{"border-opacity-100 border-l-border pl-2":f},t),children:[f?k.jsxs("div",{className:"flex gap-1 items-center",children:[k.jsx("div",{className:"bg-red-500 rounded-full h-2.5 w-2.5 animate-pulse"}),k.jsx(p3,{minuteLeft:M,minuteRight:E,secondLeft:R,secondRight:I,timerClassName:e})]}):null,k.jsxs("div",{className:"flex items-center gap-2",children:[f?k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{onClick:Z,size:"icon",variant:"ghost",children:k.jsx(Io,{className:"size-4"})})}),k.jsx(or,{className:"m-2",children:k.jsx("span",{children:" Reset recording"})})]}):null,k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:f?k.jsx($e,{onClick:ne,variant:"ghost",size:"icon",children:k.jsx($v,{className:"size-4"})}):k.jsxs($e,{variant:"ghost",size:"icon",onClick:o(()=>L(),"onClick"),children:[k.jsx(T4,{className:"size-4"}),k.jsx("span",{className:"sr-only",children:"Use Microphone"})]})}),k.jsx(or,{side:"right",children:k.jsxs("span",{children:[f?"Send":"Start"," "]})})]})]})]})},"AudioRecorder"),p3=yu.memo(({minuteLeft:t,minuteRight:e,secondLeft:r,secondRight:i,timerClassName:s})=>k.jsx("div",{className:He("text-sm animate-in duration-1000 fade-in-0 select-none",s),children:k.jsxs("p",{children:[t,e,":",r,i]})}));p3.displayName="Timer";const q1=o(({input:t,setInput:e,inputDisabled:r,selectedFiles:i,removeFile:s,handleFileChange:f,handleSendMessage:n,handleKeyDown:v,chatType:b,targetAgentData:h,formRef:m,inputRef:l,fileInputRef:w})=>k.jsxs("div",{className:"px-2 sm:px-4 pb-2 sm:pb-4 mt-auto flex-shrink-0","data-testid":"chat-container",children:[r&&k.jsxs("div",{className:"px-2 pb-2 text-sm text-muted-foreground flex items-center gap-2",children:[k.jsxs("div",{className:"flex gap-0.5 items-center justify-center",children:[k.jsx("span",{className:"w-[6px] h-[6px] bg-white rounded-full animate-bounce [animation-delay:0s]"}),k.jsx("span",{className:"w-[6px] h-[6px] bg-white rounded-full animate-bounce [animation-delay:0.2s]"}),k.jsx("span",{className:"w-[6px] h-[6px] bg-white rounded-full animate-bounce [animation-delay:0.4s]"})]}),k.jsx("span",{className:"text-xs sm:text-sm",children:b===vt.DM&&h?`${h.name} is thinking`:"Agent is thinking"}),k.jsxs("div",{className:"flex",children:[k.jsx("span",{className:"animate-pulse [animation-delay:0ms]",children:"."}),k.jsx("span",{className:"animate-pulse [animation-delay:200ms]",children:"."}),k.jsx("span",{className:"animate-pulse [animation-delay:400ms]",children:"."})]})]}),k.jsxs("form",{ref:m,onSubmit:n,className:"relative rounded-md border bg-card p-2 sm:p-3",children:[i.length>0&&k.jsx("div",{className:"flex flex-wrap gap-2 sm:gap-3 p-2 sm:p-3 pb-0 max-h-32 sm:max-h-40 overflow-y-auto",children:i.map(p=>{const y=p.blobUrl||URL.createObjectURL(p.file);return k.jsxs("div",{className:"relative p-1 sm:p-2",children:[k.jsxs("div",{className:"relative w-12 h-12 sm:w-16 sm:h-16 rounded-lg overflow-hidden border bg-muted",children:[p.isUploading&&k.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center z-10",children:k.jsx(Ar,{className:"h-3 w-3 sm:h-4 sm:w-4 animate-spin text-white"})}),p.file.type.startsWith("image/")?k.jsx("img",{alt:"Selected file",src:y,className:"w-full h-full object-cover"}):p.file.type.startsWith("video/")?k.jsx("video",{src:y,className:"w-full h-full object-cover",muted:!0}):k.jsx("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:k.jsx(Kn,{className:"h-4 w-4 sm:h-8 sm:w-8 text-muted-foreground"})}),p.error&&k.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-red-500 text-white text-xs p-1 text-center",children:"Error"})]}),k.jsx($e,{onClick:o(()=>s(p.id),"onClick"),className:"absolute -right-1 -top-1 size-[16px] sm:size-[20px] ring-2 ring-background z-20",variant:"outline",size:"icon",disabled:p.isUploading,children:k.jsx(Vr,{className:"h-2 w-2 sm:h-3 sm:w-3"})}),k.jsx("div",{className:"text-xs text-center mt-1 truncate w-12 sm:w-16",children:p.file.name})]},p.id)})}),k.jsx(h3,{ref:l,onKeyDown:v,value:t,onChange:o(({target:p})=>e(p.value),"onChange"),placeholder:r?b===vt.DM&&h?`${h.name} is thinking...`:"Agent is processing...":b===vt.DM?"Type your message here...":"Message group...",className:"min-h-12 resize-none rounded-none bg-card border-0 px-0 py-0 shadow-none focus-visible:ring-0 text-sm sm:text-base",disabled:r||b===vt.DM&&h?.status==="inactive","data-testid":"chat-input"}),k.jsxs("div",{className:"flex items-center pt-0 gap-1",children:[k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsxs("div",{children:[k.jsxs($e,{variant:"ghost",size:"icon",className:"h-8 w-8 sm:h-10 sm:w-10",onClick:o(()=>{w.current&&w.current.click()},"onClick"),children:[k.jsx(P4,{className:"size-3 sm:size-4"}),k.jsx("span",{className:"sr-only",children:"Attach file"})]}),k.jsx("input",{type:"file",ref:w,onChange:f,accept:"image/*,video/*,audio/*,.pdf,.doc,.docx,.txt,.rtf,...",multiple:!0,className:"hidden"})]})}),k.jsx(or,{side:"left",children:k.jsx("p",{children:"Attach files"})})]}),b===vt.DM&&h?.id&&k.jsx(uP,{agentId:h.id,onChange:o(p=>e(p),"onChange")}),k.jsx($e,{disabled:r||b===vt.DM&&h?.status==="inactive"||i.some(p=>p.isUploading),type:"submit",size:"sm",className:"ml-auto gap-1.5 h-[26px] sm:h-[30px] px-2 sm:px-3","data-testid":"send-button",children:r||i.some(p=>p.isUploading)?k.jsxs("div",{className:"flex gap-0.5 items-center justify-center",children:[k.jsx("span",{className:"w-[4px] h-[4px] bg-gray-500 rounded-full animate-bounce [animation-delay:0s]"}),k.jsx("span",{className:"w-[4px] h-[4px] bg-gray-500 rounded-full animate-bounce [animation-delay:0.2s]"}),k.jsx("span",{className:"w-[4px] h-[4px] bg-gray-500 rounded-full animate-bounce [animation-delay:0.4s]"})]}):k.jsx($v,{className:"size-3 sm:size-3.5"})})]})]})]}),"ChatInputArea"),m3=V.forwardRef(({className:t,children:e,scrollRef:r,contentRef:i,isAtBottom:s,scrollToBottom:f,disableAutoScroll:n,...v},b)=>k.jsxs("div",{className:"relative w-full h-full overflow-hidden",children:[k.jsx("div",{className:`flex flex-col w-full h-full p-2 overflow-y-auto ${t}`,ref:r,onWheel:n,onTouchMove:n,...v,children:k.jsx("div",{className:"flex flex-col gap-10",ref:i,children:e})}),!s&&k.jsx($e,{onClick:o(()=>{f()},"onClick"),size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 transform -translate-x-1/2 inline-flex rounded-full shadow-md",children:k.jsx(j4,{className:"h-4 w-4"})})]}));m3.displayName="ChatMessageList";const ev=o(({messages:t,isLoadingMessages:e,chatType:r,currentClientEntityId:i,targetAgentData:s,allAgents:f,animatedMessageId:n,scrollRef:v,contentRef:b,isAtBottom:h,scrollToBottom:m,disableAutoScroll:l,finalChannelId:w,getAgentInMessage:p,agentAvatarMap:y,onDeleteMessage:M,onRetryMessage:E,selectedGroupAgentId:R})=>{const I=yu.useMemo(()=>r===vt.GROUP&&R?t.filter(T=>{const P=T.senderId===i,j=T.senderId===R;return P||j}):t,[t,r,R,i]);return k.jsxs(m3,{scrollRef:v,contentRef:b,isAtBottom:h,scrollToBottom:m,disableAutoScroll:l,className:"h-full w-full","data-testid":"chat-messages",children:[e&&I.length===0&&k.jsx("div",{className:"flex flex-1 justify-center items-center",children:k.jsx("p",{children:"Loading messages..."})}),!e&&I.length===0&&k.jsx("div",{className:"flex flex-1 justify-center items-center",children:k.jsx("p",{children:"No messages yet. Start the conversation!"})}),I.map((T,P)=>{const j=T.senderId===i,L=P===I.length-1&&T.isAgent&&T.id===n,U=!j&&p?p(T.senderId):void 0;return k.jsx("div",{className:He("flex gap-1",j?"justify-end":"justify-start"),children:k.jsxs(P8,{variant:j?"sent":"received",className:`flex flex-col gap-1 ${j?"flex-row-reverse":""}`,children:[!j&&r===vt.GROUP&&k.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[k.jsx(Cn,{className:"size-5 border rounded-full select-none",children:k.jsx(ps,{src:Ga(U||(y&&T.senderId&&f?f.find(Z=>Z.id===T.senderId):void 0))})}),k.jsx("div",{children:U?.name})]}),k.jsx(MP,{message:T,agentForTts:r===vt.DM?s:U,shouldAnimate:L,onDelete:M,onRetry:E,isUser:j,getAgentInMessage:r===vt.GROUP?p:void 0,agentAvatarMap:r===vt.GROUP?y:void 0,chatType:r})]})},`${T.id}-${T.createdAt}`)})]},w||"no-channel")},"ChatMessageListComponent");function cP({options:t=[],className:e="",onSelect:r,initialSelected:i=[]}){const[s,f]=V.useState(i),[n,v]=V.useState(!1),b=V.useRef(null);V.useEffect(()=>{f(i)},[i]),V.useEffect(()=>{const p=o(y=>{b.current&&!b.current.contains(y.target)&&v(!1)},"handleClickOutside");return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[]);const h=o(p=>s.some(y=>p.id&&y.id?y.id===p.id:y.label===p.label),"isOptionSelected"),m=o(p=>{console.log("[MultiSelectCombobox] toggleSelection called with:",p),f(y=>{const M=h(p);let E;return M?E=y.filter(R=>p.id&&R.id?R.id!==p.id:R.label!==p.label):E=[...y,p],console.log("[MultiSelectCombobox] New selection:",E),r&&r(E),E})},"toggleSelection"),l=o(p=>{f(y=>{const M=y.filter(E=>p.id&&E.id?E.id!==p.id:E.label!==p.label);return r&&r(M),M})},"removeSelection"),w=o(()=>{f(p=>{const y=p.slice(0,3);return r&&r(y),y})},"removeExtraSelections");return k.jsxs("div",{className:`relative w-80 ${e}`,ref:b,children:[k.jsxs("div",{className:`flex items-center gap-2 border p-2 bg-background rounded cursor-pointer ${n?"border-primary":"border-input"}`,onClick:o(()=>v(!n),"onClick"),children:[k.jsx("div",{className:"flex flex-wrap gap-1 w-full",children:s.length>0?k.jsxs(k.Fragment,{children:[s.slice(0,3).map((p,y)=>k.jsxs(ii,{className:"flex items-center gap-1 px-2",children:[p.label,k.jsx(Vr,{size:12,className:"cursor-pointer",onClick:o(M=>{M.stopPropagation(),l(p)},"onClick")})]},p.id||p.label||y)),s.length>3&&k.jsxs(ii,{className:"px-2 cursor-pointer",onClick:o(p=>{p.stopPropagation(),w()},"onClick"),children:["+",s.length-3," more"]})]}):k.jsx("span",{className:"text-muted-foreground",children:"Select agents..."})}),k.jsx(yn,{size:16})]}),n&&k.jsx(Oi,{className:"absolute left-0 mt-2 w-full shadow-md border border-border rounded z-40 max-h-60 overflow-y-auto",children:t.length===0?k.jsx("div",{className:"p-2 text-muted-foreground text-sm",children:"No agents available"}):t.map((p,y)=>k.jsxs("div",{className:`flex items-center gap-2 p-2 cursor-pointer rounded hover:bg-muted ${h(p)?"bg-muted":"bg-card"}`,onClick:o(()=>m(p),"onClick"),children:[k.jsx("div",{className:"bg-gray-500 rounded-full w-4 h-4 flex justify-center items-center overflow-hidden text-xs",children:p.icon?k.jsx("img",{src:p.icon,alt:p.label,className:"w-full h-full object-cover"}):ns(p.label)}),p.label]},p.id||p.label||y))})]})}o(cP,"MultiSelectCombobox");const fP="00000000-0000-0000-0000-000000000000";function dP(t){return!!t.id&&!!No(t.id)&&typeof t.name=="string"&&t.name.trim()!==""}o(dP,"isAgentSelectable");function pc({onClose:t,channelId:e}){const[r,i]=V.useState(""),[s,f]=V.useState([]),[n,v]=V.useState(""),[b,h]=V.useState([]),m=fP,l=V.useRef(!1),w=V.useRef(e),p=V.useRef(!1),{data:y}=Cp(e?m:void 0,{enabled:!!e}),{data:M,isLoading:E,isError:R}=ra(),I=V.useMemo(()=>(M?.agents||[]).filter(dP),[M]),T=br(),P=wr(),{toast:j}=Wt(),{confirm:L,isOpen:U,onOpenChange:Z,onConfirm:ne,options:F}=gs();V.useEffect(()=>{e&&(T.invalidateQueries({queryKey:["channelParticipants",e]}),T.refetchQueries({queryKey:["channelParticipants",e]}))},[e,T]);const Y=Fr({mutationFn:o(async({name:z,participantIds:G})=>await Xt().messaging.createGroupChannel({name:z,participantIds:G,metadata:{type:vt.GROUP,server_id:m,source:ja}}),"mutationFn"),onSuccess:o(z=>{z&&(j({title:"Success",description:"Group created successfully."}),T.invalidateQueries({queryKey:["channels",m]}),T.invalidateQueries({queryKey:["channels"]}),t(),setTimeout(()=>{P(`/group/${z.id}?serverId=${m}`)},100))},"onSuccess"),onError:o(z=>{Ge.error("Failed to create group",z);const G=z instanceof Error?z.message:"Failed to create group.";j({title:"Error",description:G,variant:"destructive"})},"onError")}),a=Fr({mutationFn:o(async({name:z,participantIds:G})=>{if(!e)throw new Error("Channel ID is required for update");return await Xt().messaging.updateChannel(e,{name:z,participantCentralUserIds:G})},"mutationFn"),onSuccess:o(()=>{j({title:"Group Updated",description:"Group details updated successfully."}),T.invalidateQueries({queryKey:["channels",m]}),T.invalidateQueries({queryKey:["channels"]}),t(),setTimeout(()=>{P(`/group/${e}?serverId=${m}`)},100)},"onSuccess"),onError:o(z=>{Ge.error("Failed to update group",z),console.error("Group update error details:",z);const G=z instanceof Error?z.message:"Failed to update group.";j({title:"Error",description:G,variant:"destructive"})},"onError")}),g=Fr({mutationFn:o(async()=>{if(!e)throw new Error("Channel ID is required for delete");return await Xt().messaging.deleteChannel(e)},"mutationFn"),onSuccess:o(()=>{j({title:"Group Deleted",description:"The group has been successfully deleted."}),T.invalidateQueries({queryKey:["channels",m]}),T.invalidateQueries({queryKey:["channels"]}),P("/"),t()},"onSuccess"),onError:o(z=>{Ge.error("Failed to delete channel",z);const G=z instanceof Error?z.message:"Could not delete group.";typeof z=="object"&&z!==null&&z.statusCode===404?j({title:"Error Deleting Group",description:"Delete operation not found on server.",variant:"destructive"}):j({title:"Error Deleting Group",description:G,variant:"destructive"})},"onError")}),{data:u,isLoading:d,isError:x,error:A}=Sr({queryKey:["channelParticipants",e],queryFn:o(async()=>{if(!e)return{success:!0,data:[]};try{const G=await Xt().messaging.getChannelParticipants(e);let te=[];return G&&Array.isArray(G.participants)?te=G.participants.map($=>$.userId):G&&Array.isArray(G)&&(te=G.map($=>$.userId||$.id||$)),{success:!0,data:te}}catch(z){return console.error("[GroupPanel] Error fetching channel participants:",z),{success:!1,error:{message:z instanceof Error?z.message:"Unknown error"}}}},"queryFn"),enabled:!!e,retry:!1,refetchOnMount:!0,refetchOnWindowFocus:!1,staleTime:0,gcTime:0});V.useEffect(()=>{if(e&&y?.data?.channels){const z=y.data.channels.find(G=>G.id===e);if(!l.current||w.current!==e){const G=z?.name||"";i(G),v(G),l.current=!0,w.current=e,p.current=!1}}else e||(l.current=!1,i(""),f([]),v(""),h([]))},[e,y]),V.useEffect(()=>{if(!E&&!(e&&d)){if(!e){p.current=!1;return}if(!(p.current&&w.current===e)){if(x){j({title:"Error",description:`Could not load group participants: ${A?.message||"Unknown error"}`,variant:"destructive"}),f([]),h([]),p.current=!0;return}if(u?.success&&u.data){const z=u.data,G=I.filter(te=>z.includes(te.id));f(G),h(G.map(te=>te.id)),p.current=!0}else u&&!u.success?(j({title:"Error",description:`Could not load group participants: ${u.error?.message||"Server error"}`,variant:"destructive"}),f([]),h([]),p.current=!0):(f([]),h([]),p.current=!0)}}},[e,E,d,u,I,x,A,j]);const N=V.useMemo(()=>E||R?[]:I.map(z=>({id:z.id,label:`${z.name}${z.status===pr.INACTIVE?" (Inactive)":""}`,icon:typeof z.settings?.avatar=="string"?z.settings.avatar:""})),[I,E,R]),S=V.useMemo(()=>[],[]),c=V.useMemo(()=>E||!e||e&&!p.current?S:s.map(G=>({id:G.id,label:`${G.name}${G.status===pr.INACTIVE?" (Inactive)":""}`,icon:typeof G.settings?.avatar=="string"?G.settings.avatar:""})),[e,s,E,S]),_=V.useCallback(z=>{const G=I.filter(te=>z.some($=>$.id===te.id));f(G)},[I]),C=V.useCallback(async()=>{if(!e)return;const z=y?.data?.channels.find(G=>G.id===e);L({title:"Delete Group",description:`Are you sure you want to permanently delete the group chat "${z?.name||r||"this group"}"? This action cannot be undone.`,confirmText:"Delete",variant:"destructive"},()=>{g.mutate()})},[e,r,y,g]),O=V.useMemo(()=>{if(!e)return!0;const z=r.trim()!==n.trim(),G=s.map(q=>q.id).sort(),te=b.sort(),$=JSON.stringify(G)!==JSON.stringify(te);return z||$},[e,r,n,s,b]),D=V.useCallback(async()=>{if(!e&&s.length===0){j({title:"Validation Error",description:"Please select at least one agent for the group.",variant:"destructive"});return}const z=o(()=>{const G=s.map($=>$.id),te=r.trim()||(s.length>0?s.map($=>$.name).join(", "):"Empty Group");e?a.mutate({name:te,participantIds:G}):Y.mutate({name:te,participantIds:G})},"proceed");if(e&&s.length===0){L({title:"Remove All Agents?",description:"Are you sure you want to remove all agents from this group? This will leave the group with no participants.",confirmText:"Remove All",variant:"destructive"},()=>{z()});return}z()},[e,r,s,Y,a,j]),B=e?!O||Y.isPending||a.isPending||g.isPending:s.length===0||Y.isPending||a.isPending||g.isPending;return k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-80 flex items-center justify-center z-50",onClick:t,children:k.jsxs(Oi,{className:"w-[80%] max-w-2xl",onClick:o(z=>z.stopPropagation(),"onClick"),children:[k.jsxs(ac,{className:"flex flex-row items-center justify-between space-y-0",children:[k.jsx(Op,{className:"text-xl font-semibold",children:e?"Edit Group Chat":"Create Group Chat"}),k.jsx($e,{variant:"ghost",size:"sm",onClick:t,children:k.jsx(Vr,{className:"h-4 w-4"})})]}),k.jsx(Gr,{}),k.jsx(vs,{className:"pt-4",children:k.jsxs("div",{className:"flex flex-col gap-4 w-full",children:[k.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[k.jsx("label",{htmlFor:"chat-name",className:"text-sm font-medium",children:"Chat Name (Optional)"}),k.jsx(hr,{id:"chat-name",value:r,onChange:o(z=>i(z.target.value),"onChange"),className:"w-full bg-background text-foreground",placeholder:"Leave blank to auto-generate from participants",disabled:Y.isPending||a.isPending||g.isPending})]}),k.jsxs("div",{className:"flex flex-col gap-2 w-full",children:[k.jsxs("label",{htmlFor:"invite-agents",className:"text-sm font-medium",children:["Select Agents"," ",!e&&k.jsx("span",{className:"text-muted-foreground",children:"(Required)"})]}),E?k.jsxs("div",{className:"flex items-center justify-center p-4",children:[k.jsx(Ar,{className:"h-6 w-6 animate-spin text-muted-foreground"}),k.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading agents..."})]}):R?k.jsx("div",{className:"flex items-center justify-center p-4 text-red-500",children:"Error loading agents. Please try again later."}):k.jsx(cP,{options:N,onSelect:_,className:"w-full",initialSelected:c},`group-panel-combobox-${e||"create"}-${I.length}`),s.length>0&&k.jsxs("p",{className:"text-sm text-muted-foreground",children:[s.length," agent",s.length>1?"s":""," selected"]}),e&&O&&k.jsx("div",{className:"text-sm text-blue-500 mt-1",children:"You have unsaved changes"})]})]})}),k.jsxs(oc,{className:"flex justify-between pt-4",children:[e&&k.jsxs($e,{variant:"destructive",onClick:C,disabled:g.isPending||Y.isPending||a.isPending||E,children:[g.isPending?k.jsx(Ar,{className:"mr-2 h-4 w-4 animate-spin"}):k.jsx(Io,{className:"mr-2 h-4 w-4"}),"Delete Group"]}),k.jsxs($e,{variant:"default",className:e?"":"w-full",onClick:D,disabled:B,children:[(Y.isPending||a.isPending)&&k.jsx(Ar,{className:"mr-2 h-4 w-4 animate-spin"}),e?"Update Group":"Create Group"]})]})]})}),k.jsx(ms,{open:U,onOpenChange:Z,title:F?.title||"",description:F?.description||"",confirmText:F?.confirmText,cancelText:F?.cancelText,variant:F?.variant,onConfirm:ne})]})}o(pc,"GroupPanel");Xt();function hP(t,e="00000000-0000-0000-0000-000000000000"){const r=ss();return Sr({queryKey:["dmChannels",t,r],queryFn:o(async()=>{if(!t)return[];Ge.info("[useDmChannelsForAgent] Fetching distinct DM channels for agent:",t);const v=((await Xt().messaging.getServerChannels(e)).channels||[]).map(kp).filter(b=>{const h=b.metadata||{},m=b.type===vt.DM,l=h.isDm===!0,w=h.forAgent===t,p=h.user1===r&&h.user2===t||h.user1===t&&h.user2===r;if(m&&l&&w&&p)return!0;if(b.type===vt.DM&&!h.isDm&&!h.forAgent){const y=b.name.toLowerCase(),M=`dm-${r}-${t}`.toLowerCase(),E=`dm-${t}-${r}`.toLowerCase();if(y===M||y===E)return Ge.warn("[useDmChannelsForAgent] Matched a canonical DM channel by name convention:",b.id,b.name),!0}return!1});return Ge.info("[useDmChannelsForAgent] Found distinct DM channels:",v.length,v.map(b=>({id:b.id,name:b.name,metadata:b.metadata}))),v.sort((b,h)=>{const m=new Date(b.updatedAt||b.createdAt).getTime();return new Date(h.updatedAt||h.createdAt).getTime()-m})},"queryFn"),enabled:!!t,staleTime:tr.FREQUENT,refetchInterval:tr.STANDARD})}o(hP,"useDmChannelsForAgent");function pP(){const t=br(),{toast:e}=Wt(),r=ss();return wr(),Fr({mutationFn:o(async({agentId:i,channelName:s})=>{if(Ge.info("[useCreateDmChannel] Creating new distinct DM channel with agent:",{agentId:i,channelName:s}),!s||!s.trim())throw new Error("Channel name cannot be empty for a new DM conversation.");return await Xt().messaging.createGroupChannel({name:s.trim(),participantIds:[r,i],metadata:{type:vt.DM,server_id:"00000000-0000-0000-0000-000000000000",isDm:!0,user1:r,user2:i,forAgent:i,createdAt:new Date().toISOString()}})},"mutationFn"),onSuccess:o((i,s)=>{Ge.info("[useCreateDmChannel] Distinct DM channel created successfully:",i),e({title:"New Chat Started",description:`Conversation "${i.name}" created.`}),t.invalidateQueries({queryKey:["dmChannels",s.agentId,r]}),t.invalidateQueries({queryKey:["channels"]})},"onSuccess"),onError:o(i=>{Ge.error("[useCreateDmChannel] Error creating distinct DM channel:",i),e({title:"Error Creating Chat",description:i instanceof Error?i.message:"Could not start new chat.",variant:"destructive"})},"onError")})}o(pP,"useCreateDmChannel");const tv="eliza-agent-sidebar-visible";function mP(){const[t,e]=V.useState(!1);V.useEffect(()=>{try{const s=localStorage.getItem(tv);if(s!==null){const f=JSON.parse(s);e(f)}}catch(s){Ge.error("Error reading sidebar state from localStorage:",s),e(!1)}},[]);const r=V.useCallback(s=>{e(s);try{localStorage.setItem(tv,JSON.stringify(s))}catch(f){Ge.error("Error saving sidebar state to localStorage:",f)}},[]),i=V.useCallback(()=>{r(!t)},[t,r]);return{isVisible:t,setSidebarVisible:r,toggleSidebar:i}}o(mP,"useSidebarState");const md="eliza-main-panel-width",gd="eliza-sidebar-panel-width",vd="eliza-floating-threshold",bd=70,yd=30,wd=1400;function gP(){const[t,e]=V.useState(bd),[r,i]=V.useState(yd),[s,f]=V.useState(!1),[n,v]=V.useState(wd);V.useEffect(()=>{try{const p=localStorage.getItem(md),y=localStorage.getItem(gd),M=localStorage.getItem(vd);if(p!==null){const E=parseFloat(p);!isNaN(E)&&E>0&&E<=100&&e(E)}if(y!==null){const E=parseFloat(y);!isNaN(E)&&E>0&&E<=100&&i(E)}if(M!==null){const E=parseFloat(M);!isNaN(E)&&E>0&&v(E)}}catch(p){Ge.error("Error reading panel sizes from localStorage:",p),e(bd),i(yd),v(wd)}},[]),V.useEffect(()=>{const p=o(()=>{const y=window.innerWidth<n;f(y)},"checkFloatingMode");return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[n]);const b=V.useCallback(p=>{const y=Math.max(20,Math.min(80,p));e(y);try{localStorage.setItem(md,y.toString())}catch(M){Ge.error("Error saving main panel size to localStorage:",M)}},[]),h=V.useCallback(p=>{const y=Math.max(20,Math.min(80,p));i(y);try{localStorage.setItem(gd,y.toString())}catch(M){Ge.error("Error saving sidebar panel size to localStorage:",M)}},[]),m=V.useCallback(p=>{const y=Math.max(320,Math.min(2560,p));v(y);try{localStorage.setItem(vd,y.toString())}catch(M){Ge.error("Error saving floating threshold to localStorage:",M)}},[]),l=V.useCallback(()=>{f(p=>!p)},[]),w=V.useCallback(()=>{e(bd),i(yd),v(wd);try{localStorage.removeItem(md),localStorage.removeItem(gd),localStorage.removeItem(vd)}catch(p){Ge.error("Error clearing panel sizes from localStorage:",p)}},[]);return{mainPanelSize:t,sidebarPanelSize:r,isFloatingMode:s,floatingThreshold:n,setMainPanelSize:b,setSidebarPanelSize:h,setFloatingThreshold:m,toggleFloatingMode:l,resetPanelSizes:w}}o(gP,"usePanelWidthState");var jl={exports:{}},vP=jl.exports,rv;function bP(){return rv||(rv=1,(function(t,e){(function(r,i){t.exports=i()})(vP,(function(){return function(r,i,s){r=r||{};var f=i.prototype,n={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function v(h,m,l,w){return f.fromToBase(h,m,l,w)}o(v,"i"),s.en.relativeTime=n,f.fromToBase=function(h,m,l,w,p){for(var y,M,E,R=l.$locale().relativeTime||n,I=r.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],T=I.length,P=0;P<T;P+=1){var j=I[P];j.d&&(y=w?s(h).diff(l,j.d,!0):l.diff(h,j.d,!0));var L=(r.rounding||Math.round)(Math.abs(y));if(E=y>0,L<=j.r||!j.r){L<=1&&P>0&&(j=I[P-1]);var U=R[j.l];p&&(L=p(""+L)),M=typeof U=="string"?U.replace("%d",L):U(L,m,j.l,E);break}}if(m)return M;var Z=E?R.future:R.past;return typeof Z=="function"?Z(M):Z.replace("%s",M)},f.to=function(h,m){return v(h,m,this,!0)},f.from=function(h,m){return v(h,m,this)};var b=o(function(h){return h.$u?s.utc():s()},"d");f.toNow=function(h){return this.to(b(this),h)},f.fromNow=function(h){return this.from(b(this),h)}}}))})(jl)),jl.exports}o(bP,"requireRelativeTime");var yP=bP();const wP=fu(yP);Xn.extend(wP);const xP="00000000-0000-0000-0000-000000000000",_P=o(t=>{const e=t.rawMessage,r=o(m=>{switch(m){case"pending":case"executing":case"running":return"input-streaming";case"completed":case"success":return"output-available";case"failed":case"error":return"output-error";default:return"input-available"}},"mapActionStatusToState"),i=e.actions?.[0]||e.action||"ACTION",s=e.actionStatus||"completed",f=e.actionId,n={};e.actions&&(n.actions=e.actions),e.action&&(n.action=e.action),e.thought&&(n.thought=e.thought);const v={};e.text&&(v.result=e.text),v.status=s,e.thought&&(v.thought=e.thought),e.actionResult&&(v.actionResult=e.actionResult);const h=s==="failed"||s==="error"?e.text||"Action failed":void 0;return{type:i,state:r(s),toolCallId:f,input:Object.keys(n).length>0?n:void 0,output:Object.keys(v).length>0?v:void 0,errorText:h}},"convertActionMessageToToolPart"),MP=yu.memo(SP,(t,e)=>t.message.id===e.message.id&&t.message.text===e.message.text&&t.message.isLoading===e.message.isLoading&&t.shouldAnimate===e.shouldAnimate&&t.isUser===e.isUser);function SP({message:t,agentForTts:e,shouldAnimate:r,onDelete:i,onRetry:s,isUser:f,getAgentInMessage:n,agentAvatarMap:v,chatType:b}){const h=t.type==="agent_action"||t.source==="agent_action";return k.jsxs("div",{className:"flex flex-col w-full",children:[k.jsxs(j8,{isLoading:t.isLoading,...f?{variant:"sent"}:{},...!t.text&&!t.attachments?.length?{className:"bg-transparent"}:{},children:[h?k.jsx(HT,{toolPart:_P(t),defaultOpen:!1,className:"max-w-none"}):k.jsx("div",{children:(()=>{if(!t.text)return null;const m=u3(t.text),l=new Set(t.attachments?.map(y=>y.url).filter(Boolean)||[]),w=m.filter(y=>!l.has(y.url)),p=WT(t.text,m);return k.jsxs("div",{className:"space-y-3",children:[p.trim()&&k.jsx("div",{children:f?k.jsx(Hp,{className:"prose-sm max-w-none",variant:"user",children:p}):k.jsx(RT,{className:"prose-sm max-w-none",variant:"agent",shouldAnimate:r,messageId:t.id,children:p})}),w.length>0&&k.jsx("div",{className:"space-y-2",children:w.map((y,M)=>k.jsx("div",{children:k.jsx(z1,{url:y.url,title:"Shared media"})},`${y.url}-${M}`))})]})})()}),t.attachments?.filter(m=>m.url&&m.url.trim()!=="").map(m=>k.jsx(z1,{url:m.url,title:m.title||"Attachment"},`${m.url}-${m.title}`))]}),k.jsxs("div",{className:"flex items-center justify-between w-full py-1",children:[k.jsx("div",{children:!f&&(t.text||t.attachments?.length)&&t.createdAt&&k.jsx(gI,{className:"text-muted-foreground",timestamp:Xn(t.createdAt).format("LT")})}),k.jsxs("div",{className:"flex items-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity duration-500",children:[!f&&t.text&&!t.isLoading&&e?.id&&k.jsxs(k.Fragment,{children:[k.jsx(rI,{text:t.text}),k.jsx(bI,{agentId:e.id,text:t.text})]}),f&&t.text&&!t.isLoading&&s&&k.jsx(nI,{onClick:o(()=>s(t.text||""),"onClick")}),k.jsx(iI,{onClick:o(()=>i(t.id),"onClick")})]})]})]})}o(SP,"MessageContent");function g3({chatType:t,contextId:e,serverId:r,initialDmChannelId:i}){const{toast:s}=Wt(),f=br(),{isVisible:n,setSidebarVisible:v,toggleSidebar:b}=mP(),{mainPanelSize:h,sidebarPanelSize:m,isFloatingMode:l,setMainPanelSize:w,setSidebarPanelSize:p}=gP(),[y,M]=V.useState({showGroupEditPanel:!1,showProfileOverlay:!1,input:"",inputDisabled:!1,selectedGroupAgentId:null,currentDmChannelId:null,isCreatingDM:!1,isMobile:!1}),I=gu().state?.forceNew||!1;wr();const[T,P]=V.useState(I),j=l||y.isMobile,{confirm:L,isOpen:U,onOpenChange:Z,onConfirm:ne,options:F}=gs(),{stopAgent:Y,isAgentStopping:a}=na(),g=V.useCallback(Te=>{M(Ze=>({...Ze,...Te}))},[]),u=ss(),d=V.useRef(null),x=V.useRef(null),A=V.useRef(null),N=V.useRef(!1),S=V.useRef(!1),c=V.useRef(""),{data:_,isLoading:C}=Go(t===vt.DM?e:void 0,{enabled:t===vt.DM}),O=_?.data?{..._.data,createdAt:_.data.createdAt||Date.now(),updatedAt:_.data.updatedAt||Date.now()}:void 0,{handleDelete:D,isDeleting:B}=f3(O||{}),{data:z=[],isLoading:G}=hP(t===vt.DM?e:void 0),te=pP(),{data:$}=rR(t===vt.GROUP?e:void 0),{data:q}=Rp(t===vt.GROUP?e:void 0),Ce=q?.data,{data:fe}=ra(),ae=fe?.agents||[],be=z[0],H=t===vt.DM?y.currentDmChannelId||void 0:e||void 0,ee=V.useMemo(()=>t===vt.DM?xP:r||void 0,[t,r]),{data:Q=[],isLoading:X}=Vg(be?.id,ee),{data:se=[],isLoading:Ne,addMessage:we,updateMessage:ue,removeMessage:K,clearMessages:W}=Vg(H,ee),J=V.useMemo(()=>t!==vt.GROUP||!Ce?[]:Ce.map(Te=>ae.find(Ze=>Ze.id===Te)).filter(Boolean),[t,Ce,ae]),pe=V.useMemo(()=>ae.reduce((Te,Ze)=>(Ze.id&&typeof Ze.settings?.avatar=="string"&&(Te[Ze.id]=Ze.settings.avatar),Te),{}),[ae]),le=V.useCallback(Te=>ae.find(Ze=>Ze.id===Te),[ae]),{scrollRef:oe,contentRef:Ve,isAtBottom:_e,scrollToBottom:Le,disableAutoScroll:qe,autoScrollEnabled:ge}=LT({smooth:!0}),De=V.useRef(0),he=V.useCallback(()=>{oe.current&&setTimeout(()=>Le(),0)},[Le,oe]),ve=V.useRef(!1),Oe=V.useRef(null),je=V.useCallback(async Te=>{if(!Te||t!=="DM")return;if(be)try{const yt=await Xt().messaging.getChannelMessages(be.id,{limit:30}),ht=Be(be.name),Nt=(yt?.messages?.length??0)===0;if(ht&&Nt){y.currentDmChannelId===be.id?s({title:"Already in a fresh chat",description:`You're already in a new chat with ${O?.name||"the agent"}.`}):(g({currentDmChannelId:be.id}),s({title:"Chat opened",description:`You can now start chatting with ${O?.name||"the agent"}.`})),g({currentDmChannelId:be.id});return}else Ge.info("[Chat] Latest DM channel has messages or customized name, proceeding to create a new one.")}catch(lt){Ge.error("[Chat] Failed to fetch latest DM channel messages:",lt)}const Ze=`Chat - ${Xn().format("MMM D, HH:mm:ss")}`;Ge.info(`[Chat] Creating new distinct DM channel with agent ${Te}, name: "${Ze}"`),g({isCreatingDM:!0});try{ve.current=!0,await te.mutateAsync({agentId:Te,channelName:Ze}),g({input:""}),setTimeout(()=>he(),150)}catch(lt){Ge.error("[Chat] Error creating new distinct DM channel:",lt),g({currentDmChannelId:null,input:""})}finally{g({isCreatingDM:!1}),s({title:"Chat opened",description:`You can now start chatting with ${O?.name||"the agent"}.`})}},[t,te,g,he,be]),ke=V.useCallback(Te=>{const Ze=z.find(lt=>lt.id===Te);Ze&&(Ge.info(`[Chat] DM Channel selected: ${Ze.name} (Channel ID: ${Ze.id})`),g({currentDmChannelId:Ze.id,input:""}),setTimeout(()=>he(),150))},[z,g,he]),Fe=V.useCallback(()=>{if(t!==vt.DM||!y.currentDmChannelId||!O?.id)return;const Te=z.find(Ze=>Ze.id===y.currentDmChannelId);Te&&L({title:"Delete Chat",description:`Are you sure you want to delete the chat "${Te.name}" with ${O.name}? This action cannot be undone.`,confirmText:"Delete",variant:"destructive"},async()=>{Ge.info(`[Chat] Deleting DM channel ${Te.id}`);try{await Xt().messaging.deleteChannel(Te.id),f.setQueryData(["dmChannels",O.id,u],yt=>yt?.filter(ht=>ht.id!==Te.id)),f.invalidateQueries({queryKey:["dmChannels",O.id,u]}),f.invalidateQueries({queryKey:["channels"]}),s({title:"Chat Deleted",description:`"${Te.name}" was deleted.`});const lt=f.getQueryData(["dmChannels",O.id,u])||[];lt.length>0?(g({currentDmChannelId:lt[0].id}),Ge.info("[Chat] Switched to DM channel:",lt[0].id)):(Ge.info("[Chat] No DM channels left after deletion. Will create a fresh chat once."),g({currentDmChannelId:null}),ve.current=!1,await je(O.id))}catch(Ze){Ge.error("[Chat] Error deleting DM channel:",Ze),s({title:"Error",description:"Could not delete chat. The server might not support this action yet.",variant:"destructive"})}})},[t,y.currentDmChannelId,O,z,L,s,g,je,f,u]);V.useEffect(()=>{be&&!X&&Q&&O?.id&&T&&(je(O.id),P(!1))},[T,P,je,O?.id,be,Q,X]),V.useEffect(()=>{N.current=y.inputDisabled},[y.inputDisabled]),V.useEffect(()=>{const Te=z.find(Ze=>Ze.id===y.currentDmChannelId);Te?.name&&(c.current=Te.name)},[z,y.currentDmChannelId]),V.useEffect(()=>{!G&&z.length>0&&(Ge.info("[Chat] Selecting first available DM channel:",z[0].id),g({currentDmChannelId:z[0].id}))},[z,G,g]);const et=V.useCallback(Te=>{if(t===vt.DM&&e&&Te&&typeof window<"u"){const Ze=`/chat/${e}/${Te}`;window.location.pathname!==Ze&&window.history&&window.history.replaceState(null,"",Ze)}},[t,e]);V.useEffect(()=>{y.currentDmChannelId&&et(y.currentDmChannelId)},[y.currentDmChannelId,et]),V.useEffect(()=>{if(Ge.info("[Chat] URL navigation effect triggered",{initialDmChannelId:i,agentDmChannelsLength:z.length,isLoadingAgentDmChannels:G,currentDmChannelId:y.currentDmChannelId}),i&&z.length>0&&!G&&!S.current){if(!No(i)){Ge.warn("[Chat] Invalid channel ID format from URL:",i),S.current=!0;return}z.some(lt=>lt.id===i)?(Ge.info("[Chat] Switching to channel from URL:",i),g({currentDmChannelId:i}),S.current=!0):(Ge.warn("[Chat] Channel from URL not found, staying with current channel",{initialDmChannelId:i,availableChannels:z.map(lt=>lt.id)}),S.current=!0)}},[i,z,G,g]),V.useEffect(()=>{if(t===vt.DM&&O?.id){if(!(!y.currentDmChannelId||z.some(Ze=>Ze.id===y.currentDmChannelId))&&!G){Ge.info(`[Chat] Current DM channel ${y.currentDmChannelId} doesn't belong to agent ${O.id}, clearing it`),g({currentDmChannelId:null});return}!G&&z.length===0&&!i&&!ve.current&&!y.isCreatingDM&&!te.isPending&&(Ge.info("[Chat] No existing DM channels found; auto-creating a fresh one."),ve.current=!0,je(O.id))}else t!==vt.DM&&y.currentDmChannelId!==null&&g({currentDmChannelId:null})},[t,O?.id,z,G,te.isPending,y.isCreatingDM,y.currentDmChannelId,i,g,je]),V.useEffect(()=>(z.length>0&&Oe.current&&(clearTimeout(Oe.current),Oe.current=null),()=>{Oe.current&&(clearTimeout(Oe.current),Oe.current=null)}),[z]),V.useEffect(()=>{t===vt.GROUP&&J.length===1&&!y.selectedGroupAgentId&&(g({selectedGroupAgentId:J[0].id}),n||v(!0))},[t,J,y.selectedGroupAgentId,g,n,v]);const{mutate:Ie}=iR(),{mutate:Se}=nR();V.useEffect(()=>{const Te=De.current===0&&se.length>0,Ze=se.length!==De.current&&De.current!==0;Te?(Ge.debug("[chat] Initial messages loaded, scrolling to bottom.",{count:se.length}),he()):Ze&&(ge?(Ge.debug("[chat] New messages and autoScroll enabled, scrolling."),he()):Ge.debug("[chat] New messages, but autoScroll is disabled (user scrolled up).")),De.current=se.length},[se,ge,he,H]);function Be(Te){return!!Te?.match(/^Chat - [A-Z][a-z]{2} \d{1,2}, \d{2}:\d{2}(:\d{2})?$/)}o(Be,"isAutoGeneratedChatName");const Ee=o(async()=>{if(!(!!c.current&&Be(c.current)&&t===vt.DM))return;if(!H||!y.currentDmChannelId){Ge.warn("Cannot update chat title: missing channel ID");return}const Ze=Xt(),yt=(await Ze.messaging.generateChannelTitle(H,e))?.title,ht=await Ze.messaging.getChannelParticipants(y.currentDmChannelId);if(yt&&ht){let Nt=[];ht&&Array.isArray(ht.participants)?Nt=ht.participants.map(Ct=>Ct.userId):ht&&Array.isArray(ht)&&(Nt=ht.map(Ct=>Ct.userId||Ct.id||Ct)),await Ze.messaging.updateChannel(H,{name:yt,participantCentralUserIds:Nt});const Dt=ss();f.invalidateQueries({queryKey:["dmChannels",e,Dt]})}},"updateChatTitle"),{sendMessage:Ue,animatedMessageId:Je}=ZT({channelId:H,currentUserId:u,contextId:e,chatType:t,allAgents:ae,messages:se,onAddMessage:o(Te=>{we(Te),Ee(),Te.isAgent&&he()},"onAddMessage"),onUpdateMessage:o((Te,Ze)=>{ue(Te,Ze),!Ze.isLoading&&Ze.isLoading!==void 0&&he()},"onUpdateMessage"),onDeleteMessage:o(Te=>{K(Te)},"onDeleteMessage"),onClearMessages:o(()=>{W()},"onClearMessages"),onInputDisabledChange:o(Te=>g({inputDisabled:Te}),"onInputDisabledChange")}),{selectedFiles:re,handleFileChange:de,removeFile:Pe,createBlobUrls:Me,uploadFiles:Re,cleanupBlobUrls:Ke,clearFiles:ie}=VT({agentId:O?.id,channelId:H,chatType:t}),Ae=o(Te=>{Te.key==="Enter"&&!Te.shiftKey&&!Te.nativeEvent.isComposing&&(Te.preventDefault(),Ye(Te))},"handleKeyDown"),Ye=o(async Te=>{Te.preventDefault();let Ze=H;if(t===vt.DM&&!Ze&&O?.id){if(y.isCreatingDM||te.isPending){Ge.info("[Chat] DM channel creation already in progress; will wait for it to finish instead of creating another.");return}Ge.info("[Chat] No DM channel selected, creating one before sending message");try{ve.current=!0;const St=await te.mutateAsync({agentId:O.id,channelName:`Chat - ${Xn().format("MMM D, HH:mm")}`});g({currentDmChannelId:St.id}),Ze=St.id,await new Promise(Ht=>setTimeout(Ht,100))}catch(St){Ge.error("[Chat] Failed to create DM channel before sending message:",St),s({title:"Error",description:"Failed to create chat channel. Please try again.",variant:"destructive"}),g({inputDisabled:!1});return}}if(!y.input.trim()&&re.length===0||N.current||!Ze||!ee||!u||t===vt.DM&&!O?.id)return;const lt=en();let yt=y.input.trim();const ht=y.input;g({input:"",inputDisabled:!0});const Nt=[...re];ie(),A.current?.reset();const Dt=Me(Nt),Ct={id:lt,text:yt,name:Ns,createdAt:Date.now(),senderId:u,isAgent:!1,isLoading:!0,channelId:Ze,serverId:ee,source:t===vt.DM?Qo:ja,attachments:Dt};(yt||Nt.length>0)&&we(Ct),he();try{let St=[];if(Nt.length>0){const{uploaded:Tt,failed:jt,blobUrls:Ut}=await Re(Nt);St=Tt,jt.length>0&&ue(lt,{attachments:Ct.attachments?.filter(Zt=>!jt.some(Gt=>Gt.file.id===Zt.id))}),Ke(Ut),!yt.trim()&&St.length>0&&(yt=`Shared ${St.length} file(s).`)}const Vt=u3(ht).map((Tt,jt)=>({id:`textmedia-${lt}-${jt}`,url:Tt.url,title:Tt.type==="image"?"Image":Tt.type==="video"?"Video":"Media Link",source:"user_input_url",contentType:Tt.type==="image"?Vd.IMAGE:Tt.type==="video"?Vd.VIDEO:void 0})),Pt=[...St,...Vt],Ft=yt||(Pt.length>0?"Shared content.":"");if(!Ft.trim()&&Pt.length===0){g({inputDisabled:!1}),K(lt);return}await Ue(Ft,ee,t===vt.DM?Qo:ja,Pt.length>0?Pt:void 0,lt,void 0,Ze)}catch(St){Ge.error("Error sending message or uploading files:",St),s({title:"Error Sending Message",description:St instanceof Error?St.message:"Could not send message.",variant:"destructive"}),ue(lt,{isLoading:!1,text:`${Ct.text||"Attachment(s)"} (Failed to send)`}),g({inputDisabled:!1})}finally{d.current?.focus()}},"handleSendMessage"),me=o(Te=>{if(!H||!Te)return;const Ze=No(Te);Ze&&(K(Te),Ie({channelId:H,messageId:Ze}))},"handleDeleteMessage"),Qe=o(async Te=>{if(N.current||!Te.text?.trim()&&Te.attachments?.length===0)return;g({inputDisabled:!0});const Ze=en(),lt=Te.text?.trim()||`Shared ${Te.attachments?.length} file(s).`,yt={id:Ze,text:Te.text,name:Ns,createdAt:Date.now(),senderId:u,isAgent:!1,isLoading:!0,channelId:Te.channelId,serverId:ee,source:t===vt.DM?Qo:ja,attachments:Te.attachments};if(we(yt),he(),!ee||!H){Ge.error("Cannot retry message: missing server or channel ID"),s({title:"Error Sending Message",description:"Missing required channel information.",variant:"destructive"}),g({inputDisabled:!1}),K(Ze);return}try{await Ue(lt,ee,t===vt.DM?Qo:ja,Te.attachments,Ze,void 0,H)}catch(ht){Ge.error("Error sending message or uploading files:",ht),s({title:"Error Sending Message",description:ht instanceof Error?ht.message:"Could not send message.",variant:"destructive"}),ue(Ze,{isLoading:!1,text:`${yt.text||"Attachment(s)"} (Failed to send)`}),g({inputDisabled:!1})}},"handleRetryMessage"),st=o(()=>{if(!H)return;const Te=t===vt.DM?`Clear all messages in this chat with ${O?.name}?`:"Clear all messages in this group chat?";L({title:"Clear Chat",description:`${Te} This action cannot be undone.`,confirmText:"Clear",variant:"destructive"},()=>{Se(H)})},"handleClearChat");if(V.useEffect(()=>{const Te=o(()=>{const Ze=window.innerWidth<768;g({isMobile:Ze})},"checkMobile");return Te(),window.addEventListener("resize",Te),()=>window.removeEventListener("resize",Te)},[g]),t===vt.DM&&(C||!O&&e||G))return k.jsx("div",{className:"flex items-center justify-center h-full",children:k.jsx(Ar,{className:"h-8 w-8 animate-spin text-primary"})});if(!H||!ee||t===vt.DM&&!O)return k.jsx("div",{className:"flex flex-1 justify-center items-center",children:k.jsx("p",{children:"Loading chat context..."})});const ze=o(()=>{B||L({title:"Delete Agent",description:`Are you sure you want to delete the agent "${O?.name}"? This action cannot be undone.`,confirmText:"Delete",variant:"destructive"},D)},"onDeleteAgent"),We=o(()=>{if(t===vt.DM&&O)return k.jsxs("div",{className:"flex items-center justify-between mb-4 p-3",children:[k.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:k.jsxs(Ka,{children:[k.jsx(Xa,{asChild:!0,children:k.jsxs($e,{variant:"ghost",size:"sm",className:"py-6 px-2 flex-shrink-0",children:[k.jsxs("div",{className:"relative flex-shrink-0",children:[k.jsx(Cn,{className:"size-4 sm:size-10 border rounded-full",children:k.jsx(ps,{src:Ga(O)})}),O?.status===pr.ACTIVE?k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx("span",{className:"absolute bottom-0 right-0 size-2 sm:size-[10px] rounded-full border border-white bg-green-500"})}),k.jsx(or,{side:"right",children:k.jsx("p",{children:"Agent is active"})})]}):k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx("span",{className:"absolute bottom-0 right-0 size-2 sm:size-[10px] rounded-full border border-white bg-muted-foreground"})}),k.jsx(or,{side:"right",children:k.jsx("p",{children:"Agent is inactive"})})]})]}),k.jsx("div",{children:k.jsx("h2",{className:"font-semibold text-lg truncate max-w-[80px] sm:max-w-none",children:O?.name||"Agent"})}),k.jsx(yn,{className:"size-4"})]})}),k.jsxs(Wa,{align:"start",side:"bottom",className:"min-w-36 w-[var(--radix-dropdown-menu-trigger-width)]",children:[k.jsxs(_i,{onClick:o(()=>{Ih(O,s)},"onClick"),children:[k.jsx(Cv,{className:"h-4 w-4 mr-2"}),"Export"]}),k.jsx(Bl,{}),k.jsxs(_i,{onClick:o(()=>{O&&!a(O.id)&&Y(O)},"onClick"),children:[k.jsx(bh,{className:"h-4 w-4 mr-2"}),"Stop Agent"]}),k.jsxs(_i,{onClick:o(()=>{O&&!B&&ze()},"onClick"),className:"text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50",children:[k.jsx(Io,{className:"h-4 w-4 mr-2"}),"Delete Agent"]})]})]})}),k.jsx("div",{className:"flex gap-1 sm:gap-2 items-center flex-shrink-0",children:t===vt.DM&&k.jsxs("div",{className:"flex items-center gap-2",children:[z.length>0&&k.jsxs(Ka,{children:[k.jsx(Xa,{asChild:!0,children:k.jsxs($e,{variant:"outline",size:"sm",className:"w-8 h-9 sm:max-w-[300px] sm:w-auto rounded-[12px]",children:[k.jsx(bu,{className:"size-4 flex-shrink-0 text-muted-foreground"}),k.jsx("span",{className:"hidden md:inline truncate text-xs sm:text-sm",children:z.find(Te=>Te.id===y.currentDmChannelId)?.name||"Select Chat"}),k.jsx(yn,{className:"hidden md:inline-flex size-4 text-muted-foreground"})]})}),k.jsxs(Wa,{align:"end",className:"w-[280px] sm:w-[320px]",children:[k.jsxs(_x,{className:"font-medium",children:["Chat History with ",O.name]}),k.jsx(Bl,{}),k.jsx("div",{className:"max-h-[300px] overflow-y-auto",children:z.map(Te=>k.jsx(_i,{onClick:o(()=>ke(Te.id),"onClick"),className:He("cursor-pointer",Te.id===y.currentDmChannelId&&"bg-muted"),children:k.jsxs("div",{className:"flex items-center justify-between w-full",children:[k.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[k.jsx("span",{className:He("text-sm truncate",Te.id===y.currentDmChannelId&&"font-medium"),children:Te.name}),k.jsx("span",{className:"text-xs text-muted-foreground",children:Xn((typeof Te.metadata?.createdAt=="string"||typeof Te.metadata?.createdAt=="number"?Te.metadata.createdAt:null)||Te.updatedAt||Te.createdAt).fromNow()})]}),Te.id===y.currentDmChannelId&&k.jsx(ii,{variant:"default",className:"text-xs flex-shrink-0 ml-2",children:"Current"})]})},Te.id))})]})]}),k.jsx(vh,{mainAction:{label:y.isCreatingDM?"Creating...":k.jsxs(k.Fragment,{children:[k.jsx("span",{className:"sm:hidden",children:"New"}),k.jsx("span",{className:"hidden sm:inline",children:"New Chat"})]}),onClick:o(()=>je(O?.id),"onClick"),icon:y.isCreatingDM?k.jsx(Ar,{className:"size-4 animate-spin"}):k.jsx(yh,{className:"size-4"}),disabled:y.isCreatingDM||G},actions:[{label:"Clear Chat",onClick:st,icon:k.jsx(Wp,{className:"size-4"}),disabled:!se||se.length===0},{label:"Delete Chat",onClick:Fe,icon:k.jsx(rs,{className:"size-4"}),disabled:!y.currentDmChannelId,variant:"destructive"}],variant:"outline",size:"sm",mainButtonClassName:"rounded-l-[12px] h-9",dropdownButtonClassName:"rounded-r-[12px] h-9"}),k.jsxs(cr,{children:[k.jsx(fr,{asChild:!0,children:k.jsx($e,{className:"w-9 h-9 rounded-[12px]",variant:"outline",onClick:b,children:n?k.jsx(wc,{className:"size-4"}):k.jsx($p,{className:"size-4"})})}),k.jsx(or,{side:"bottom",children:k.jsx("p",{children:n?"Close SidePanel":"Open SidePanel"})})]})]})})]});if(t===vt.GROUP){const Te=kh($?.data||void 0,J,u);return k.jsxs("div",{className:"flex flex-col gap-3 mb-4",children:[k.jsxs("div",{className:"flex items-center justify-between p-3 bg-card rounded-lg border",children:[k.jsx("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:k.jsx("h2",{className:"font-semibold text-lg truncate",title:Te,children:Te})}),k.jsxs("div",{className:"flex gap-1 sm:gap-2 items-center flex-shrink-0",children:[k.jsx(vh,{mainAction:{label:"Edit Group",onClick:o(()=>g({showGroupEditPanel:!0}),"onClick"),icon:k.jsx(L4,{className:"size-4"})},actions:[{label:"Clear Messages",onClick:st,icon:k.jsx(Wp,{className:"size-4"}),disabled:!se||se.length===0},{label:"Delete Group",onClick:o(()=>{if(!H||!ee)return;const Ze=H;L({title:"Delete Group",description:"Are you sure you want to delete this group? This action cannot be undone.",confirmText:"Delete",variant:"destructive"},async()=>{try{await Xt().messaging.deleteChannel(Ze),s({title:"Group Deleted",description:"The group has been successfully deleted."}),window.location.href="/"}catch(lt){Ge.error("[Chat] Error deleting group:",lt),s({title:"Error",description:"Could not delete group.",variant:"destructive"})}})},"onClick"),icon:k.jsx(rs,{className:"size-4"}),disabled:!H||!ee,variant:"destructive"}],variant:"outline",size:"sm",className:"px-2 sm:px-3"}),k.jsx($e,{variant:"ghost",size:"sm",className:"px-2 sm:px-3 h-8 w-8 sm:w-auto",onClick:b,children:n?k.jsx(wc,{className:"h-4 w-4"}):k.jsx($p,{className:"h-4 w-4"})})]})]}),J.length>0&&k.jsxs("div",{className:"flex items-center gap-2 p-2 bg-card rounded-lg border overflow-x-auto",children:[k.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap flex-shrink-0",children:"Agents:"}),k.jsxs("div",{className:"flex gap-2 min-w-0",children:[k.jsx($e,{variant:y.selectedGroupAgentId?"ghost":"default",size:"sm",onClick:o(()=>g({selectedGroupAgentId:null}),"onClick"),className:"flex items-center gap-2 flex-shrink-0",children:k.jsx("span",{children:"All"})}),J.map(Ze=>k.jsxs($e,{variant:y.selectedGroupAgentId===Ze?.id?"default":"ghost",size:"sm",onClick:o(()=>{g({selectedGroupAgentId:Ze?.id||null}),Ze?.id&&!n&&v(!0)},"onClick"),className:"flex items-center gap-2 flex-shrink-0",children:[k.jsx(Cn,{className:"size-5",children:k.jsx(ps,{src:Ga(Ze)})}),k.jsx("span",{className:"truncate max-w-[100px] sm:max-w-none",children:Ze?.name})]},Ze?.id))]})]})]})}return null},"renderChatHeader");return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"h-full flex flex-col relative overflow-hidden",children:[j?k.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[k.jsx("div",{className:"flex-shrink-0 p-2 sm:p-4 pb-0",children:We()}),k.jsxs("div",{className:He("flex flex-col transition-all duration-300 w-full flex-1 min-h-0 overflow-hidden p-2 sm:p-4 pt-0"),children:[k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden px-5 py-2",children:k.jsx(ev,{messages:se,isLoadingMessages:Ne,chatType:t,currentClientEntityId:u,targetAgentData:O,allAgents:ae,animatedMessageId:Je,scrollRef:oe,contentRef:Ve,isAtBottom:_e,scrollToBottom:Le,disableAutoScroll:qe,finalChannelId:H,getAgentInMessage:le,agentAvatarMap:pe,onDeleteMessage:me,onRetryMessage:o(Te=>{if(!H){s({title:"Error",description:"Cannot retry message: missing channel information.",variant:"destructive"});return}const Ze={id:en(),text:Te,name:Ns,senderId:u,isAgent:!1,createdAt:Date.now(),channelId:H,serverId:ee};Qe(Ze)},"onRetryMessage"),selectedGroupAgentId:y.selectedGroupAgentId})}),k.jsx("div",{className:"flex-shrink-0",children:k.jsx(q1,{input:y.input,setInput:o(Te=>g({input:Te}),"setInput"),inputDisabled:y.inputDisabled,selectedFiles:re,removeFile:Pe,handleFileChange:de,handleSendMessage:Ye,handleKeyDown:Ae,chatType:t,targetAgentData:O,formRef:A,inputRef:d,fileInputRef:x})})]})]}):k.jsxs(DT,{direction:"horizontal",className:"h-full flex-1 overflow-hidden",onLayout:o(Te=>{Te.length>=2&&n&&!y.isMobile&&(w(Te[0]),p(Te[1]))},"onLayout"),children:[k.jsx(K1,{defaultSize:n&&!y.isMobile?h:100,minSize:y.isMobile?100:50,children:k.jsx("div",{className:"relative h-full overflow-hidden",children:k.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[k.jsx("div",{className:"flex-shrink-0 p-2 sm:p-4 pb-0",children:We()}),k.jsxs("div",{className:He("flex flex-col transition-all duration-300 w-full flex-1 min-h-0 overflow-hidden p-2 sm:p-4 pt-0"),children:[k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden px-5 py-2",children:k.jsx(ev,{messages:se,isLoadingMessages:Ne,chatType:t,currentClientEntityId:u,targetAgentData:O,allAgents:ae,animatedMessageId:Je,scrollRef:oe,contentRef:Ve,isAtBottom:_e,scrollToBottom:Le,disableAutoScroll:qe,finalChannelId:H,getAgentInMessage:le,agentAvatarMap:pe,onDeleteMessage:me,onRetryMessage:o(Te=>{if(!H){s({title:"Error",description:"Cannot retry message: missing channel information.",variant:"destructive"});return}const Ze={id:en(),text:Te,name:Ns,senderId:u,isAgent:!1,createdAt:Date.now(),channelId:H,serverId:ee};Qe(Ze)},"onRetryMessage"),selectedGroupAgentId:y.selectedGroupAgentId})}),k.jsx("div",{className:"flex-shrink-0",children:k.jsx(q1,{input:y.input,setInput:o(Te=>g({input:Te}),"setInput"),inputDisabled:y.inputDisabled,selectedFiles:re,removeFile:Pe,handleFileChange:de,handleSendMessage:Ye,handleKeyDown:Ae,chatType:t,targetAgentData:O,formRef:A,inputRef:d,fileInputRef:x})})]})]})})}),(()=>{let Te,Ze="Agent",lt;return t===vt.DM?(Te=e,Ze=O?.name||"Agent",lt=y.currentDmChannelId||void 0):t===vt.GROUP&&y.selectedGroupAgentId?(Te=y.selectedGroupAgentId,Ze=ae.find(ht=>ht.id===y.selectedGroupAgentId)?.name||"Group Member",lt=e):t===vt.GROUP&&!y.selectedGroupAgentId&&(Ze="Group",lt=e),n&&!y.isMobile&&k.jsxs(k.Fragment,{children:[k.jsx(BT,{withHandle:!0}),k.jsx(K1,{defaultSize:m,minSize:20,maxSize:50,children:k.jsx($1,{agentId:Te,agentName:Ze,channelId:lt})})]})})()]}),(()=>{let Te,Ze="Agent",lt;return t===vt.DM?(Te=e,Ze=O?.name||"Agent",lt=y.currentDmChannelId||void 0):t===vt.GROUP&&y.selectedGroupAgentId?(Te=y.selectedGroupAgentId,Ze=ae.find(ht=>ht.id===y.selectedGroupAgentId)?.name||"Group Member",lt=e):t===vt.GROUP&&!y.selectedGroupAgentId&&(Ze="Group",lt=e),n&&j&&k.jsx("div",{className:"absolute inset-0 z-50 bg-background/80 backdrop-blur-sm",children:k.jsx("div",{className:"absolute inset-0 bg-background shadow-lg",children:k.jsxs("div",{className:"h-full flex flex-col",children:[k.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[k.jsx("h3",{className:"font-semibold text-lg",children:Ze}),k.jsx($e,{variant:"ghost",size:"sm",onClick:o(()=>v(!1),"onClick"),className:"h-8 w-8 p-0",children:k.jsx(wc,{className:"h-4 w-4"})})]}),k.jsx("div",{className:"flex-1 overflow-hidden",children:k.jsx($1,{agentId:Te,agentName:Ze,channelId:lt})})]})})})})()]}),y.showGroupEditPanel&&t===vt.GROUP&&k.jsx(pc,{onClose:o(()=>g({showGroupEditPanel:!1}),"onClose"),channelId:e}),y.showProfileOverlay&&t===vt.DM&&O?.id&&k.jsx(T8,{isOpen:y.showProfileOverlay,onClose:o(()=>g({showProfileOverlay:!1}),"onClose"),agentId:O.id}),k.jsx(ms,{open:U,onOpenChange:Z,title:F?.title||"",description:F?.description||"",confirmText:F?.confirmText,cancelText:F?.cancelText,variant:F?.variant,onConfirm:ne})]})}o(g3,"Chat");function iv(){const{agentId:t,channelId:e}=Sh(),r=wr();V.useEffect(()=>(Ge.info("[AgentRoute] Component mounted/updated",{agentId:t,channelId:e}),()=>{Ge.info("[AgentRoute] Component unmounted",{agentId:t,channelId:e})}),[t,e]);const{data:i,isLoading:s}=Go(t),{startAgent:f,isAgentStarting:n}=na(),v=i?.data?{...i.data,status:i.data.status==="active"?pr.ACTIVE:(i.data.status==="inactive",pr.INACTIVE),username:i.data.username||i.data.name||"Unknown",bio:i.data.bio||"",messageExamples:i.data.messageExamples||[],postExamples:i.data.postExamples||[],topics:i.data.topics||[],adjectives:i.data.adjectives||[],knowledge:i.data.knowledge||[],plugins:i.data.plugins||[],settings:i.data.settings||{},secrets:i.data.secrets||{},style:i.data.style||{},templates:i.data.templates||{},enabled:typeof i.data.enabled=="boolean"?i.data.enabled:!0,createdAt:typeof i.data.createdAt=="number"?i.data.createdAt:Date.now(),updatedAt:typeof i.data.updatedAt=="number"?i.data.updatedAt:Date.now()}:void 0;if(!t)return k.jsx("div",{className:"p-4",children:"Agent ID not provided."});if(s||!v)return k.jsx("div",{className:"p-4 flex items-center justify-center h-full",children:k.jsx(Ar,{className:"h-8 w-8 animate-spin text-primary"})});const b=v.status===pr.ACTIVE,h=n(v.id),m=o(()=>{v&&f(v)},"handleStartAgent");return b?(Ge.info("[AgentRoute] Agent is active, rendering chat for DM",{agentName:v?.name,dmChannelIdFromRoute:e}),k.jsx(g3,{chatType:vt.DM,contextId:t,initialDmChannelId:e},`${t}-${e||"no-dm-channel"}`)):(Ge.info("[AgentRoute] Agent is not active, rendering inactive state UI",{agentName:v?.name}),k.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full p-8 text-center",children:[k.jsxs("h2",{className:"text-2xl font-semibold mb-4",children:[v.name," is not active."]}),k.jsx("p",{className:"text-muted-foreground mb-6",children:"Press the button below to start this agent."}),k.jsxs("div",{className:"flex gap-3",children:[k.jsx($e,{onClick:o(()=>r(`/settings/${t}`),"onClick"),variant:"outline",size:"lg",children:k.jsx(is,{className:"h-5 w-5"})}),k.jsxs($e,{onClick:m,disabled:h,size:"lg",children:[h?k.jsx(Ar,{className:"mr-2 h-5 w-5 animate-spin"}):k.jsx(xh,{className:"mr-2 h-5 w-5"}),h?"Starting Agent...":"Start Agent"]})]})]}))}o(iv,"AgentRoute");function EP(){return k.jsx("div",{className:"h-full w-full overflow-y-auto",children:k.jsx("div",{className:"min-h-full flex w-full justify-center px-4 sm:px-6 py-4",children:k.jsx("div",{className:"w-full max-w-4xl min-w-0",children:k.jsx(W6,{})})})})}o(EP,"AgentCreatorRoute");function AP({className:t,...e}){return k.jsx(D4,{"data-slot":"switch",className:He("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-4 w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer",t),...e,children:k.jsx(B4,{"data-slot":"switch-thumb",className:He("bg-background dark:data-[state=unchecked]:bg-primary-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block h-2.5 w-2.5 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%+10px)] data-[state=unchecked]:translate-x-0")})})}o(AP,"Switch");const kP=o(({agent:t,onChat:e})=>{const r=wr(),{startAgent:i,stopAgent:s,isAgentStarting:f,isAgentStopping:n}=na();if(!t||!t.id)return Ge.error("[AgentCard] Agent data or ID is missing",{agent:t}),k.jsx(Oi,{className:"p-4 min-h-[100px] flex items-center justify-center text-muted-foreground",children:"Agent data not available."});const v=t.id,b=t.name||"Unnamed Agent",h=Array.isArray(t.bio)?t.bio.filter(Boolean).join(" ").trim():typeof t.bio=="string"&&t.bio.trim()||"Engages with all types of questions and conversations",m=t.status===pr.ACTIVE,l=f(t.id),w=n(t.id),p={id:t.id,name:b,username:t.username||b,bio:t.bio||"",messageExamples:t.messageExamples||[],postExamples:t.postExamples||[],topics:t.topics||[],adjectives:t.adjectives||[],knowledge:t.knowledge||[],plugins:t.plugins||[],settings:t.settings||{},secrets:t.secrets||{},style:t.style||{},system:t.system||void 0,templates:t.templates||{},enabled:typeof t.enabled=="boolean"?t.enabled:!0,status:t.status||pr.INACTIVE,createdAt:typeof t.createdAt=="number"?t.createdAt:Date.now(),updatedAt:typeof t.updatedAt=="number"?t.updatedAt:Date.now()},y=o(()=>{i(p)},"handleStart"),M=o(()=>{s(p)},"handleStop"),E=o((T=!1)=>{e(T)},"handleNewChat"),R=o(()=>{r(`/settings/${v}`)},"handleSettings"),I=o(()=>{m?M():y()},"handleToggle");return k.jsx(Oi,{className:He("w-full transition-all bg-card border border-border/50 rounded-sm hover:bg-card/50 cursor-pointer",m?"":"opacity-75"),"data-testid":"agent-card",onClick:o(T=>{T.stopPropagation(),E()},"onClick"),children:k.jsxs(vs,{className:"p-0 relative h-full",children:[k.jsx("div",{className:"absolute top-3 right-3",children:k.jsx(AP,{checked:m,onCheckedChange:o(T=>{T!==m&&I()},"onCheckedChange"),onClick:o(T=>T.stopPropagation(),"onClick"),"aria-label":`Toggle ${b}`,disabled:l||w,className:He(m?"data-[state=checked]:!bg-green-600":"data-[state=unchecked]:!bg-gray-500/80")})}),k.jsxs("div",{className:"flex flex-col justify-between h-full",children:[k.jsxs("div",{className:"flex items-center gap-4 p-2 h-[90%]",children:[k.jsxs(Cn,{className:"h-16 w-16 flex-shrink-0 rounded-sm",children:[k.jsx(ps,{src:Ga(t),alt:b}),k.jsx(sc,{className:"text-lg font-medium rounded-sm",children:ns(b)})]}),k.jsxs("div",{className:"flex-1 min-w-0",children:[k.jsx("h3",{className:"font-semibold text-xl mb-1 truncate",title:b,children:b}),k.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 leading-relaxed",children:h})]})]}),k.jsx("div",{className:"border-t border-muted"}),k.jsxs("div",{className:"flex items-center justify-between py-1 px-2",children:[k.jsx($e,{variant:"ghost",size:"sm",onClick:o(T=>{T.stopPropagation(),R()},"onClick"),className:"h-8 w-8 p-0 hover:bg-muted/50 cursor-pointer",children:k.jsx(is,{className:"h-4 w-4 text-muted-foreground"})}),k.jsx($e,{variant:"outline",size:"sm",onClick:o(T=>{T.stopPropagation(),E(!0)},"onClick"),className:"h-8 px-2 rounded-sm bg-muted hover:bg-muted/50 cursor-pointer",children:"New Chat"})]})]})]})})},"AgentCard"),NP=o(({group:t})=>{const e=wr(),r=ss(),[i,s]=V.useState(!1);if(!t||!t.id)return k.jsx(Oi,{className:"p-4 min-h-[180px] flex items-center justify-center text-muted-foreground",children:"Group data not available."});const f=kh(t,t.participants||[],r),n=o(()=>{e(`/group/${t.id}?serverId=${t.server_id}`)},"handleChatClick"),{data:v}=ra(),b=v?.agents||[],{data:h}=Rp(t.id),m=h?.data,l=m&&Array.isArray(m)?m:[],w=l?b.filter(M=>M.id&&l.includes(M.id)):[],p=o(()=>{s(!0)},"handleSettings"),y=w.map(M=>M.name).filter(Boolean).join(", ")||"No members";return k.jsxs(k.Fragment,{children:[k.jsx(Oi,{className:"w-full transition-all bg-card border border-border/50 rounded-sm","data-testid":"agent-card",children:k.jsx(vs,{className:"p-0 relative h-full",children:k.jsxs("div",{className:"flex flex-col justify-between h-full",children:[k.jsxs("div",{className:"flex items-center gap-4 p-2 h-[90%]",children:[k.jsx(Cn,{className:"bg-[#282829] h-16 w-16 flex-shrink-0 rounded-[3px] relative overflow-hidden",children:w&&w.length>0?k.jsxs("div",{className:"grid grid-cols-2 grid-rows-2 gap-1 w-full h-full p-1",children:[w.slice(0,3).map(M=>{const E=typeof M.settings?.avatar=="string"?M.settings.avatar:null;return E?k.jsx("img",{src:E,alt:M.name,className:"object-cover w-full h-full rounded-[3px]"},M.id):k.jsx("div",{className:"flex items-center justify-center bg-[#3F3F3F] text-xs font-medium w-full h-full rounded-[3px]",children:ns(M.name)},M.id)}),w.length>3?k.jsxs("div",{className:"flex items-center justify-center bg-[#3F3F3F] text-xs font-medium w-full h-full rounded-[3px]",children:["+",w.length-3]}):Array.from({length:4-w.slice(0,3).length}).map((M,E)=>k.jsx("div",{className:"flex items-center justify-center bg-[#2D2D2D] text-xs font-medium w-full h-full rounded-[3px]"},`empty-${E}`))]}):k.jsx("div",{className:"flex items-center justify-center bg-muted text-lg font-medium w-full h-full",children:ns(f)})}),k.jsxs("div",{className:"flex-1 min-w-0",children:[k.jsx("h3",{className:"font-semibold text-xl mb-1 truncate",title:f,children:f}),k.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 leading-relaxed",children:y})]})]}),k.jsx("div",{className:"border-t border-muted"}),k.jsxs("div",{className:"flex items-center justify-between py-1 px-2",children:[k.jsx($e,{variant:"ghost",size:"sm",onClick:o(M=>{M.stopPropagation(),p()},"onClick"),className:"h-8 w-8 p-0 hover:bg-muted/50 cursor-pointer",children:k.jsx(is,{className:"h-4 w-4 text-muted-foreground"})}),k.jsx($e,{variant:"outline",size:"sm",onClick:o(M=>{M.stopPropagation(),n()},"onClick"),className:"h-8 px-2 rounded-sm bg-muted hover:bg-muted/50 cursor-pointer",children:"Chat"})]})]})})}),i&&k.jsx(pc,{onClose:o(()=>s(!1),"onClose"),channelId:t.id})]})},"GroupCard");function CP(){const{data:t,isLoading:e,isError:r,error:i}=ra(),s=wr(),f=V.useMemo(()=>t?.agents||[],[t]),n=f.filter(L=>L.status===pr.ACTIVE).length,{data:v}=w8(),b=v?.data?.servers||[],[h,m]=V.useState(!1),[l,w]=V.useState(!1),[p,y]=V.useState(null),[M,E]=V.useState(null),[R,I]=V.useState("agents"),T=o(()=>{y(null),m(!1)},"closeOverlay"),P=o(async(L,U)=>{L.id&&s(`/chat/${L.id}`,{state:{forceNew:U}})},"handleNavigateToDm"),j=o(()=>{s("/group/new")},"handleCreateGroup");return V.useEffect(()=>{Ge.info("[Home] Component mounted/re-rendered. Key might have changed.")},[]),k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"flex-1 w-full overflow-y-auto bg-background",children:k.jsx("div",{className:"flex flex-col w-full h-full",children:k.jsxs(Rh,{value:R,onValueChange:I,className:"w-full h-full flex flex-col",children:[k.jsx("div",{className:"w-full",children:k.jsxs("div",{className:"w-full md:max-w-4xl mx-auto px-6 pt-6 pb-2",children:[k.jsxs("div",{className:"flex justify-between items-center mb-3",children:[k.jsxs(Su,{className:"h-auto p-0 bg-transparent border-0 border-b-0 gap-2 w-auto",children:[k.jsxs(Qa,{value:"agents",className:"relative rounded-full data-[state=active]:border-b-0 data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:font-bold cursor-pointer text-lg py-1",children:["Agents",k.jsx("span",{className:`
|
|
114
|
-
absolute -top-2.5 right-0 inline-flex items-center justify-center h-5 w-5 rounded-full bg-blue-600 text-white text-[8px] font-semibold border border-black
|
|
115
|
-
transition-all duration-300 ease-in-out
|
|
116
|
-
${R==="agents"&&n>0?"opacity-100 scale-100":"opacity-0 scale-75 pointer-events-none"}
|
|
117
|
-
`,children:n})]}),k.jsx(Qa,{value:"groups",className:"rounded-full data-[state=active]:border-b-0 data-[state=active]:bg-white data-[state=active]:text-black data-[state=active]:font-bold cursor-pointer text-lg py-1",children:"Groups"})]}),k.jsxs($e,{variant:"ghost",onClick:o(()=>{R==="agents"?s("/create"):j()},"onClick"),className:"create-agent-button cursor-pointer gap-1",children:[k.jsx(yh,{className:"w-4 h-4"}),R==="agents"?"Create New Agent":"Create New Group"]})]}),k.jsx(Gr,{})]})}),k.jsx(xi,{value:"agents",className:"flex-1 mt-0 bg-background",children:k.jsxs("div",{className:"flex flex-col gap-6 w-full md:max-w-4xl mx-auto px-6 py-2",children:[e&&k.jsx("div",{className:"text-center py-8",children:"Loading agents..."}),r&&k.jsxs("div",{className:"text-center py-8",children:["Error loading agents: ",i instanceof Error?i.message:"Unknown error"]}),f.length===0&&!e&&k.jsx("div",{className:"text-center py-8 flex flex-col items-center gap-4",children:k.jsx("p",{className:"text-muted-foreground",children:"No agents currently running. Start a character to begin."})}),!e&&!r&&k.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-3 agents-section",children:f.sort((L,U)=>{const Z=L.status===pr.ACTIVE?1:0;return(U.status===pr.ACTIVE?1:0)-Z}).map(L=>k.jsx(kP,{agent:L,onChat:o(U=>P(L,U),"onChat")},L.id))})]})}),k.jsx(xi,{value:"groups",className:"flex-1 mt-0 bg-background",children:k.jsx("div",{className:"flex flex-col gap-6 w-full md:max-w-4xl mx-auto px-6 py-2",children:!e&&!r&&k.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-3 groups-section",children:b.map(L=>k.jsx(v3,{serverId:L.id},L.id))})})})]})})}),p?.id&&k.jsx(T8,{isOpen:h,onClose:T,agentId:p.id}),l&&k.jsx(pc,{onClose:o(()=>{E(null),w(!1)},"onClose"),channelId:M??void 0})]})}o(CP,"Home");const v3=yu.memo(({serverId:t})=>{const{data:e,isLoading:r}=Cp(t),i=V.useMemo(()=>e?.data?.channels?.filter(s=>s.type===vt.GROUP)||[],[e]);return r?k.jsx("p",{children:"Loading channels for server..."}):!i||i.length===0?k.jsx("p",{className:"text-sm text-muted-foreground",children:"No group channels in this server."}):k.jsx(k.Fragment,{children:i.map(s=>k.jsx(NP,{group:{...s,server_id:t}},s.id))})});v3.displayName="ServerChannels";function RP(){const e=gu().pathname,r=e.startsWith("/api/")||e.includes("/agents/")||e.includes("/memory/")||e.includes("/speech/");return k.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[70vh] px-4 text-center",children:[k.jsx("div",{className:"flex items-center justify-center mb-8",children:k.jsx("div",{className:"bg-red-900/20 h-24 w-24 rounded-full flex items-center justify-center",children:k.jsx(Xr,{className:"h-14 w-14 text-red-500"})})}),k.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Page Not Found"}),k.jsxs("div",{className:"max-w-lg",children:[r?k.jsxs(k.Fragment,{children:[k.jsxs("p",{className:"text-lg mb-6 text-muted-foreground",children:["The endpoint ",k.jsx("span",{className:"font-mono text-red-400",children:e})," does not exist."]}),k.jsxs("div",{className:"bg-red-900/20 border border-red-800/30 rounded-md p-4 mb-8 text-left",children:[k.jsxs("h3",{className:"text-red-400 font-medium mb-2 flex items-center",children:[k.jsx(Xr,{className:"h-4 w-4 mr-2"}),"Endpoint Not Found"]}),k.jsx("p",{className:"text-sm text-red-300/80 mb-2",children:"The requested API endpoint does not exist on this server. Please check that:"}),k.jsxs("ul",{className:"text-sm text-red-300/80 list-disc pl-5 space-y-1",children:[k.jsx("li",{children:"The URL is spelled correctly"}),k.jsx("li",{children:"You're using the correct version of the API"}),k.jsx("li",{children:"The endpoint is available in this version of Eliza"})]})]})]}):k.jsx("p",{className:"text-lg mb-6 text-muted-foreground",children:"Sorry, the page you're looking for doesn't exist or has been moved."}),k.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[k.jsx($e,{asChild:!0,variant:"default",children:k.jsxs(z4,{to:"/",children:[k.jsx(F4,{className:"h-4 w-4 mr-2"}),"Go to Home"]})}),k.jsx($e,{asChild:!0,variant:"outline",children:k.jsxs("a",{onClick:o(()=>window.history.back(),"onClick"),children:[k.jsx(U4,{className:"h-4 w-4 mr-2"}),"Go Back"]})})]})]})]})}o(RP,"NotFound");function IP(){const{channelId:t}=Sh(),[e]=H4(),r=e.get("serverId"),i=No(t),s=No(r||"");return!i||!s?k.jsx("div",{className:"flex flex-1 justify-center items-center",children:k.jsx("p",{children:"Missing channel or server information."})}):k.jsx(g3,{chatType:vt.GROUP,contextId:i,serverId:s},i)}o(IP,"GroupRoute");function OP(){const t=wr();return k.jsx("div",{className:"pt-4 md:pt-8",children:k.jsx(pc,{onClose:o(()=>t(-1),"onClose")})})}o(OP,"GroupNew");function TP(){const{agentId:t}=Sh(),e=wr(),{data:r,isLoading:i}=Go(t);if(i)return k.jsx("div",{className:"flex items-center justify-center h-full",children:k.jsx(Ar,{className:"h-8 w-8 animate-spin"})});if(!r?.data)return k.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[k.jsx("p",{className:"text-muted-foreground",children:"Agent not found"}),k.jsx($e,{onClick:o(()=>e("/"),"onClick"),children:"Back to Home"})]});const s={...r.data,createdAt:r.data.createdAt??Date.now(),bio:r.data.bio??[],topics:r.data.topics??[],adjectives:r.data.adjectives??[],style:r.data.style??{all:[],chat:[],post:[]},settings:r.data.settings??{secrets:{}}};return k.jsx("div",{className:"flex w-full justify-center px-4 sm:px-6 overflow-y-auto",children:k.jsx("div",{className:"w-full md:max-w-4xl py-6",children:k.jsx(d3,{agent:s,agentId:t,onSaveComplete:o(()=>{},"onSaveComplete")})})})}o(TP,"AgentSettingsRoute");const b3=new Z4({defaultOptions:{queries:{staleTime:tr.STANDARD,refetchInterval:!1,retry:3,retryDelay:o(t=>Math.min(1e3*2**t,3e4),"retryDelay"),refetchOnWindowFocus:!0,refetchOnReconnect:!0},mutations:{retry:3,retryDelay:o(t=>Math.min(1e3*2**t,3e4),"retryDelay")}}}),y3=o(async()=>{try{await b3.prefetchQuery({queryKey:["agents"],queryFn:o(async()=>({data:await Xt().agents.listAgents()}),"queryFn"),staleTime:tr.FREQUENT})}catch(t){console.error("Error prefetching initial data:",t)}},"prefetchInitialData");y3();function PP(){tI();const{status:t}=Ap(),[e,r]=V.useState(!1),[i,s]=V.useState(Date.now()),f=br();V.useEffect(()=>{Ge.info("[AppContent] Mounted/Updated"),y3()},[]);const n=o(()=>{Ge.info("[AppContent] refreshHomePage called. Current homeKey:",i);const v=Date.now();s(v),Ge.info("[AppContent] New homeKey set to:",v),Ge.info("[AppContent] Invalidating queries for Home page refresh."),f.invalidateQueries({queryKey:["agents"]}),f.invalidateQueries({queryKey:["servers"]})},"refreshHomePage");return k.jsxs(Ps,{delayDuration:0,children:[k.jsxs(ub,{children:[k.jsx(Gg,{refreshHomePage:n}),k.jsxs(fb,{className:"h-screen flex flex-col md:ml-72 overflow-hidden",children:[k.jsx("div",{className:"md:hidden absolute top-4 left-4 z-50",children:k.jsxs(ab,{open:e,onOpenChange:r,children:[k.jsx(Pw,{asChild:!0,children:k.jsxs($e,{variant:"ghost",size:"icon","data-testid":"mobile-menu-button",children:[k.jsx(Y4,{className:"h-5 w-5"}),k.jsx("span",{className:"sr-only",children:"Toggle menu"})]})}),k.jsx(Ch,{side:"left",className:"w-80 p-0 z-50",children:k.jsx(Gg,{isMobile:!0,refreshHomePage:n})})]})}),k.jsx("div",{className:"flex w-full justify-center pt-16 md:pt-0 flex-shrink-0",children:k.jsx("div",{className:"w-full md:max-w-4xl",children:k.jsx(hR,{})})}),k.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:k.jsxs(Q4,{children:[k.jsx($r,{path:"/",element:k.jsx(CP,{},i)}),k.jsx($r,{path:"chat/:agentId/:channelId",element:k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:k.jsx(iv,{})})}),k.jsx($r,{path:"chat/:agentId",element:k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:k.jsx(iv,{})})}),k.jsx($r,{path:"settings/:agentId",element:k.jsx(TP,{})}),k.jsx($r,{path:"group/new",element:k.jsx(OP,{})}),k.jsx($r,{path:"agents/new",element:k.jsx(EP,{})}),k.jsx($r,{path:"/create",element:k.jsx("div",{className:"flex w-full justify-center px-4 sm:px-6 overflow-y-auto",children:k.jsx("div",{className:"w-full md:max-w-4xl",children:k.jsx(W6,{})})})}),k.jsx($r,{path:"/logs",element:k.jsx("div",{className:"flex w-full justify-center",children:k.jsxs("div",{className:"w-full md:max-w-4xl",children:[k.jsx("div",{className:"flex items-center justify-between mb-4",children:k.jsx("h2",{className:"text-2xl p-4 font-bold",children:"System Logs"})}),k.jsx(_8,{})]})})}),k.jsx($r,{path:"group/:channelId",element:k.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:k.jsx(IP,{})})}),k.jsx($r,{path:"settings/",element:k.jsx("div",{className:"flex w-full justify-center overflow-y-auto",children:k.jsx("div",{className:"w-full md:max-w-4xl",children:k.jsx(mR,{})})})}),k.jsx($r,{path:"*",element:k.jsx(RP,{})})]})})]})]}),k.jsx(kR,{}),t!=="unauthorized"&&k.jsx(SR,{})]})}o(PP,"AppContent");function jP(){return k.jsx(V4,{client:b3,children:k.jsx("div",{className:"dark antialiased font-sans",style:{colorScheme:"dark"},children:k.jsx(G4,{children:k.jsx(hN,{children:k.jsx(FC,{children:k.jsx(PP,{})})})})})})}o(jP,"App");const w3=document.getElementById("root");if(!w3)throw new Error("Root element not found");K4.createRoot(w3).render(k.jsx(V.StrictMode,{children:k.jsx(jP,{})}));
|
|
118
|
-
//# sourceMappingURL=main-h2y7yKYF.js.map
|