@elizaos/client 1.6.2-alpha.3 → 1.6.2-alpha.4

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.
@@ -1,4 +1,4 @@
1
- var oC=Object.defineProperty;var i=(e,t)=>oC(e,"name",{value:t,configurable:!0});var lC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);import{g as Jo,j as A,S as ms,r as J,R as P5,a as D5,T as L5,P as B5,C as vf,b as z5,X as Fr,O as bf,c as yf,D as wf,d as uC,e as fC,f as cC,h as dC,i as U5,k as hC,l as F5,m as $5,L as Qg,n as Yg,o as G5,p as pC,V as mC,G as gC,q as V5,I as vC,s as Ji,t as bC,u as Z5,v as yC,w as H5,x as wC,y as Sn,z as xC,A as J5,B as q5,E as K5,F as X5,H as W5,J as Ar,K as _C,M as SC,N as MC,Q as EC,U as kC,W as jC,Y as AC,Z as NC,_ as IC,$ as Q5,a0 as Y5,a1 as e_,a2 as t_,a3 as r_,a4 as i_,a5 as fi,a6 as CC,a7 as RC,a8 as n_,a9 as a_,aa as OC,ab as s_,ac as kr,ad as ev,ae as qo,af as o_,ag as l_,ah as TC,ai as PC,aj as tv,ak as u_,al as DC,am as LC,an as f_,ao as BC,ap as ma,aq as $c,ar as mn,as as zi,at as Ey,au as xa,av as zC,aw as Ui,ax as jr,ay as xr,az as c_,aA as d_,aB as h_,aC as p_,aD as m_,aE as Wr,aF as xf,aG as UC,aH as FC,aI as $C,aJ as _f,aK as Sf,aL as no,aM as _a,aN as Ln,aO as ky,aP as GC,aQ as Ko,aR as Mf,aS as go,aT as VC,aU as jy,aV as ZC,aW as g_,aX as HC,aY as v_,aZ as b_,a_ as y_,a$ as w_,b0 as x_,b1 as JC,b2 as rv,b3 as Vm,b4 as __,b5 as qC,b6 as Bu,b7 as iv,b8 as S_,b9 as KC,ba as gs,bb as as,bc as nv,bd as Xo,be as zu,bf as XC,bg as M_,bh as WC,bi as av,bj as vo,bk as Yr,bl as QC,bm as YC,bn as On,bo as Gc,bp as eR,bq as ao,br as Ja,bs as tR,bt as rR,bu as iR,bv as nR,bw as aR,bx as sR,by as sv,bz as oR,bA as lR,bB as uR,bC as ov,bD as lv,bE as fR,bF as E_,bG as Zm,bH as cR,bI as k_,bJ as dR,bK as hR,bL as pR,bM as mR,bN as gR,bO as vR,bP as bR,bQ as yR,bR as wR,bS as j_,bT as A_,bU as N_,bV as I_,bW as xR,bX as _R,bY as SR,bZ as Hm,b_ as MR,b$ as ER,c0 as Ef,c1 as kR,c2 as C_,c3 as jR,c4 as AR,c5 as Vc,c6 as Ay,c7 as Ny,c8 as NR,c9 as uv,ca as IR,cb as CR,cc as RR,cd as OR,ce as TR,cf as PR,cg as DR,ch as LR,ci as BR,cj as zR,ck as pi,cl as UR}from"./react-vendor-C1OK-nqm.js";import{r as Vn}from"./main-D3VIBp4H.js";import"./ui-vendor-B7JxFfFk.js";var Ote=lC(Wg=>{function R_(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=R_(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}i(R_,"r");function fv(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=R_(e))&&(a&&(a+=" "),a+=t);return a}i(fv,"clsx");const Iy=i(e=>typeof e=="boolean"?`${e}`:e===0?"0":e,"falsyToString"),Cy=fv,En=i((e,t)=>r=>{var a;if(t?.variants==null)return Cy(e,r?.class,r?.className);const{variants:n,defaultVariants:s}=t,o=Object.keys(n).map(v=>{const c=r?.[v],d=s?.[v];if(c===null)return null;const y=Iy(c)||Iy(d);return n[v][y]}),h=r&&Object.entries(r).reduce((v,c)=>{let[d,y]=c;return y===void 0||(v[d]=y),v},{}),p=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((v,c)=>{let{class:d,className:y,...b}=c;return Object.entries(b).every(x=>{let[k,N]=x;return Array.isArray(N)?N.includes({...s,...h}[k]):{...s,...h}[k]===N})?[...v,d,y]:v},[]);return Cy(e,o,p,r?.class,r?.className)},"cva"),Xa="user",Ml="client_chat",so="client_group_chat",bo=512;var yu=(e=>(e.REQUIRED="required",e.OPTIONAL="optional",e))(yu||{});const Ua={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 wu={exports:{}},FR=wu.exports,Ry;function $R(){return Ry||(Ry=1,(function(e,t){(function(r,a){e.exports=a()})(FR,(function(){var r=1e3,a=6e4,n=36e5,s="millisecond",o="second",h="minute",p="hour",v="day",c="week",d="month",y="quarter",b="year",x="date",k="Invalid Date",N=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|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,R={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:i(function(l){var m=["th","st","nd","rd"],w=l%100;return"["+l+(m[(w-20)%10]||m[w]||m[0])+"]"},"ordinal")},O=i(function(l,m,w){var M=String(l);return!M||M.length>=m?l:""+Array(m+1-M.length).join(w)+l},"m"),T={s:O,z:i(function(l){var m=-l.utcOffset(),w=Math.abs(m),M=Math.floor(w/60),j=w%60;return(m<=0?"+":"-")+O(M,2,"0")+":"+O(j,2,"0")},"z"),m:i(function l(m,w){if(m.date()<w.date())return-l(w,m);var M=12*(w.year()-m.year())+(w.month()-m.month()),j=m.clone().add(M,d),S=w-j<0,f=m.clone().add(M+(S?-1:1),d);return+(-(M+(w-j)/(S?j-f:f-j))||0)},"t2"),a:i(function(l){return l<0?Math.ceil(l)||0:Math.floor(l)},"a"),p:i(function(l){return{M:d,y:b,w:c,d:v,D:x,h:p,m:h,s:o,ms:s,Q:y}[l]||String(l||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(l){return l===void 0},"u")},P="en",z={};z[P]=R;var Z="$isDayjsObject",V=i(function(l){return l instanceof u||!(!l||!l[Z])},"S"),ee=i(function l(m,w,M){var j;if(!m)return P;if(typeof m=="string"){var S=m.toLowerCase();z[S]&&(j=S),w&&(z[S]=w,j=S);var f=m.split("-");if(!j&&f.length>1)return l(f[0])}else{var _=m.name;z[_]=m,j=_}return!M&&j&&(P=j),j||!M&&P},"t2"),$=i(function(l,m){if(V(l))return l.clone();var w=typeof m=="object"?m:{};return w.date=l,w.args=arguments,new u(w)},"O"),F=T;F.l=ee,F.i=V,F.w=function(l,m){return $(l,{locale:m.$L,utc:m.$u,x:m.$x,$offset:m.$offset})};var u=(function(){function l(w){this.$L=ee(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[Z]=!0}i(l,"M2");var m=l.prototype;return m.parse=function(w){this.$d=(function(M){var j=M.date,S=M.utc;if(j===null)return new Date(NaN);if(F.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var f=j.match(N);if(f){var _=f[2]-1||0,E=(f[7]||"0").substring(0,3);return S?new Date(Date.UTC(f[1],_,f[3]||1,f[4]||0,f[5]||0,f[6]||0,E)):new Date(f[1],_,f[3]||1,f[4]||0,f[5]||0,f[6]||0,E)}}return new Date(j)})(w),this.init()},m.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},m.$utils=function(){return F},m.isValid=function(){return this.$d.toString()!==k},m.isSame=function(w,M){var j=$(w);return this.startOf(M)<=j&&j<=this.endOf(M)},m.isAfter=function(w,M){return $(w)<this.startOf(M)},m.isBefore=function(w,M){return this.endOf(M)<$(w)},m.$g=function(w,M,j){return F.u(w)?this[M]:this.set(j,w)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(w,M){var j=this,S=!!F.u(M)||M,f=F.p(w),_=i(function(H,K){var _e=F.w(j.$u?Date.UTC(j.$y,K,H):new Date(j.$y,K,H),j);return S?_e:_e.endOf(v)},"l2"),E=i(function(H,K){return F.w(j.toDate()[H].apply(j.toDate("s"),(S?[0,0,0,0]:[23,59,59,999]).slice(K)),j)},"$2"),I=this.$W,D=this.$M,L=this.$D,U="set"+(this.$u?"UTC":"");switch(f){case b:return S?_(1,0):_(31,11);case d:return S?_(1,D):_(0,D+1);case c:var B=this.$locale().weekStart||0,G=(I<B?I+7:I)-B;return _(S?L-G:L+(6-G),D);case v:case x:return E(U+"Hours",0);case p:return E(U+"Minutes",1);case h:return E(U+"Seconds",2);case o:return E(U+"Milliseconds",3);default:return this.clone()}},m.endOf=function(w){return this.startOf(w,!1)},m.$set=function(w,M){var j,S=F.p(w),f="set"+(this.$u?"UTC":""),_=(j={},j[v]=f+"Date",j[x]=f+"Date",j[d]=f+"Month",j[b]=f+"FullYear",j[p]=f+"Hours",j[h]=f+"Minutes",j[o]=f+"Seconds",j[s]=f+"Milliseconds",j)[S],E=S===v?this.$D+(M-this.$W):M;if(S===d||S===b){var I=this.clone().set(x,1);I.$d[_](E),I.init(),this.$d=I.set(x,Math.min(this.$D,I.daysInMonth())).$d}else _&&this.$d[_](E);return this.init(),this},m.set=function(w,M){return this.clone().$set(w,M)},m.get=function(w){return this[F.p(w)]()},m.add=function(w,M){var j,S=this;w=Number(w);var f=F.p(M),_=i(function(D){var L=$(S);return F.w(L.date(L.date()+Math.round(D*w)),S)},"y2");if(f===d)return this.set(d,this.$M+w);if(f===b)return this.set(b,this.$y+w);if(f===v)return _(1);if(f===c)return _(7);var E=(j={},j[h]=a,j[p]=n,j[o]=r,j)[f]||1,I=this.$d.getTime()+w*E;return F.w(I,this)},m.subtract=function(w,M){return this.add(-1*w,M)},m.format=function(w){var M=this,j=this.$locale();if(!this.isValid())return j.invalidDate||k;var S=w||"YYYY-MM-DDTHH:mm:ssZ",f=F.z(this),_=this.$H,E=this.$m,I=this.$M,D=j.weekdays,L=j.months,U=j.meridiem,B=i(function(K,_e,se,ae){return K&&(K[_e]||K(M,S))||se[_e].slice(0,ae)},"h2"),G=i(function(K){return F.s(_%12||12,K,"0")},"d2"),H=U||function(K,_e,se){var ae=K<12?"AM":"PM";return se?ae.toLowerCase():ae};return S.replace(C,(function(K,_e){return _e||(function(se){switch(se){case"YY":return String(M.$y).slice(-2);case"YYYY":return F.s(M.$y,4,"0");case"M":return I+1;case"MM":return F.s(I+1,2,"0");case"MMM":return B(j.monthsShort,I,L,3);case"MMMM":return B(L,I);case"D":return M.$D;case"DD":return F.s(M.$D,2,"0");case"d":return String(M.$W);case"dd":return B(j.weekdaysMin,M.$W,D,2);case"ddd":return B(j.weekdaysShort,M.$W,D,3);case"dddd":return D[M.$W];case"H":return String(_);case"HH":return F.s(_,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return H(_,E,!0);case"A":return H(_,E,!1);case"m":return String(E);case"mm":return F.s(E,2,"0");case"s":return String(M.$s);case"ss":return F.s(M.$s,2,"0");case"SSS":return F.s(M.$ms,3,"0");case"Z":return f}return null})(K)||f.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(w,M,j){var S,f=this,_=F.p(M),E=$(w),I=(E.utcOffset()-this.utcOffset())*a,D=this-E,L=i(function(){return F.m(f,E)},"D2");switch(_){case b:S=L()/12;break;case d:S=L();break;case y:S=L()/3;break;case c:S=(D-I)/6048e5;break;case v:S=(D-I)/864e5;break;case p:S=D/n;break;case h:S=D/a;break;case o:S=D/r;break;default:S=D}return j?S:F.a(S)},m.daysInMonth=function(){return this.endOf(d).$D},m.$locale=function(){return z[this.$L]},m.locale=function(w,M){if(!w)return this.$L;var j=this.clone(),S=ee(w,M,!0);return S&&(j.$L=S),j},m.clone=function(){return F.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},l})(),g=u.prototype;return $.prototype=g,[["$ms",s],["$s",o],["$m",h],["$H",p],["$W",v],["$M",d],["$y",b],["$D",x]].forEach((function(l){g[l[1]]=function(m){return this.$g(m,l[0],l[1])}})),$.extend=function(l,m){return l.$i||(l(m,u,$),l.$i=!0),$},$.locale=ee,$.isDayjs=V,$.unix=function(l){return $(1e3*l)},$.en=z[P],$.Ls=z,$.p={},$}))})(wu)),wu.exports}i($R,"requireDayjs_min");var GR=$R();const O_=Jo(GR);var xu={exports:{}},VR=xu.exports,Oy;function ZR(){return Oy||(Oy=1,(function(e,t){(function(r,a){e.exports=a()})(VR,(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(a,n,s){var o=n.prototype,h=o.format;s.en.formats=r,o.format=function(p){p===void 0&&(p="YYYY-MM-DDTHH:mm:ssZ");var v=this.$locale().formats,c=(function(d,y){return d.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(b,x,k){var N=k&&k.toUpperCase();return x||y[k]||r[k]||y[N].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(C,R,O){return R||O.slice(1)}))}))})(p,v===void 0?{}:v);return h.call(this,c)}}}))})(xu)),xu.exports}i(ZR,"requireLocalizedFormat");var HR=ZR();const JR=Jo(HR),cv="-",qR=i(e=>{const t=XR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i(o=>{const h=o.split(cv);return h[0]===""&&h.length!==1&&h.shift(),T_(h,t)||KR(o)},"getClassGroupId"),getConflictingClassGroupIds:i((o,h)=>{const p=r[o]||[];return h&&a[o]?[...p,...a[o]]:p},"getConflictingClassGroupIds")}},"createClassGroupUtils"),T_=i((e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],a=t.nextPart.get(r),n=a?T_(e.slice(1),a):void 0;if(n)return n;if(t.validators.length===0)return;const s=e.join(cv);return t.validators.find(({validator:o})=>o(s))?.classGroupId},"getGroupRecursive"),Ty=/^\[(.+)\]$/,KR=i(e=>{if(Ty.test(e)){const t=Ty.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},"getGroupIdForArbitraryProperty"),XR=i(e=>{const{theme:t,classGroups:r}=e,a={nextPart:new Map,validators:[]};for(const n in r)Jm(r[n],a,n,t);return a},"createClassMap"),Jm=i((e,t,r,a)=>{e.forEach(n=>{if(typeof n=="string"){const s=n===""?t:Py(t,n);s.classGroupId=r;return}if(typeof n=="function"){if(WR(n)){Jm(n(a),t,r,a);return}t.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([s,o])=>{Jm(o,Py(t,s),r,a)})})},"processClassesRecursively"),Py=i((e,t)=>{let r=e;return t.split(cv).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},"getPart"),WR=i(e=>e.isThemeGetter,"isThemeGetter"),QR=i(e=>{if(e<1)return{get:i(()=>{},"get"),set:i(()=>{},"set")};let t=0,r=new Map,a=new Map;const n=i((s,o)=>{r.set(s,o),t++,t>e&&(t=0,a=r,r=new Map)},"update");return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=a.get(s))!==void 0)return n(s,o),o},set(s,o){r.has(s)?r.set(s,o):n(s,o)}}},"createLruCache"),qm="!",Km=":",YR=Km.length,eO=i(e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=i(n=>{const s=[];let o=0,h=0,p=0,v;for(let x=0;x<n.length;x++){let k=n[x];if(o===0&&h===0){if(k===Km){s.push(n.slice(p,x)),p=x+YR;continue}if(k==="/"){v=x;continue}}k==="["?o++:k==="]"?o--:k==="("?h++:k===")"&&h--}const c=s.length===0?n:n.substring(p),d=tO(c),y=d!==c,b=v&&v>p?v-p:void 0;return{modifiers:s,hasImportantModifier:y,baseClassName:d,maybePostfixModifierPosition:b}},"parseClassName");if(t){const n=t+Km,s=a;a=i(o=>o.startsWith(n)?s(o.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0},"parseClassName")}if(r){const n=a;a=i(s=>r({className:s,parseClassName:n}),"parseClassName")}return a},"createParseClassName"),tO=i(e=>e.endsWith(qm)?e.substring(0,e.length-1):e.startsWith(qm)?e.substring(1):e,"stripImportantModifier"),rO=i(e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return i(a=>{if(a.length<=1)return a;const n=[];let s=[];return a.forEach(o=>{o[0]==="["||t[o]?(n.push(...s.sort(),o),s=[]):s.push(o)}),n.push(...s.sort()),n},"sortModifiers")},"createSortModifiers"),iO=i(e=>({cache:QR(e.cacheSize),parseClassName:eO(e),sortModifiers:rO(e),...qR(e)}),"createConfigUtils"),nO=/\s+/,aO=i((e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=t,o=[],h=e.trim().split(nO);let p="";for(let v=h.length-1;v>=0;v-=1){const c=h[v],{isExternal:d,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:k}=r(c);if(d){p=c+(p.length>0?" "+p:p);continue}let N=!!k,C=a(N?x.substring(0,k):x);if(!C){if(!N){p=c+(p.length>0?" "+p:p);continue}if(C=a(x),!C){p=c+(p.length>0?" "+p:p);continue}N=!1}const R=s(y).join(":"),O=b?R+qm:R,T=O+C;if(o.includes(T))continue;o.push(T);const P=n(C,N);for(let z=0;z<P.length;++z){const Z=P[z];o.push(O+Z)}p=c+(p.length>0?" "+p:p)}return p},"mergeClassList");function sO(){let e=0,t,r,a="";for(;e<arguments.length;)(t=arguments[e++])&&(r=P_(t))&&(a&&(a+=" "),a+=r);return a}i(sO,"twJoin");const P_=i(e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=P_(e[a]))&&(r&&(r+=" "),r+=t);return r},"toValue");function oO(e,...t){let r,a,n,s=o;function o(p){const v=t.reduce((c,d)=>d(c),e());return r=iO(v),a=r.cache.get,n=r.cache.set,s=h,h(p)}i(o,"initTailwindMerge");function h(p){const v=a(p);if(v)return v;const c=aO(p,r);return n(p,c),c}return i(h,"tailwindMerge"),i(function(){return s(sO.apply(null,arguments))},"callTailwindMerge")}i(oO,"createTailwindMerge");const vr=i(e=>{const t=i(r=>r[e]||[],"themeGetter");return t.isThemeGetter=!0,t},"fromTheme"),D_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lO=/^\d+\/\d+$/,uO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fO=/\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$/,cO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fa=i(e=>lO.test(e),"isFraction"),Dt=i(e=>!!e&&!Number.isNaN(Number(e)),"isNumber"),Nn=i(e=>!!e&&Number.isInteger(Number(e)),"isInteger"),Zc=i(e=>e.endsWith("%")&&Dt(e.slice(0,-1)),"isPercent"),rn=i(e=>uO.test(e),"isTshirtSize"),pO=i(()=>!0,"isAny"),mO=i(e=>fO.test(e)&&!cO.test(e),"isLengthOnly"),B_=i(()=>!1,"isNever"),gO=i(e=>dO.test(e),"isShadow"),vO=i(e=>hO.test(e),"isImage"),bO=i(e=>!pt(e)&&!mt(e),"isAnyNonArbitrary"),yO=i(e=>vs(e,F_,B_),"isArbitrarySize"),pt=i(e=>D_.test(e),"isArbitraryValue"),Xn=i(e=>vs(e,$_,mO),"isArbitraryLength"),Hc=i(e=>vs(e,MO,Dt),"isArbitraryNumber"),Dy=i(e=>vs(e,z_,B_),"isArbitraryPosition"),wO=i(e=>vs(e,U_,vO),"isArbitraryImage"),El=i(e=>vs(e,G_,gO),"isArbitraryShadow"),mt=i(e=>L_.test(e),"isArbitraryVariable"),Is=i(e=>bs(e,$_),"isArbitraryVariableLength"),xO=i(e=>bs(e,EO),"isArbitraryVariableFamilyName"),Ly=i(e=>bs(e,z_),"isArbitraryVariablePosition"),_O=i(e=>bs(e,F_),"isArbitraryVariableSize"),SO=i(e=>bs(e,U_),"isArbitraryVariableImage"),kl=i(e=>bs(e,G_,!0),"isArbitraryVariableShadow"),vs=i((e,t,r)=>{const a=D_.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},"getIsArbitraryValue"),bs=i((e,t,r=!1)=>{const a=L_.exec(e);return a?a[1]?t(a[1]):r:!1},"getIsArbitraryVariable"),z_=i(e=>e==="position"||e==="percentage","isLabelPosition"),U_=i(e=>e==="image"||e==="url","isLabelImage"),F_=i(e=>e==="length"||e==="size"||e==="bg-size","isLabelSize"),$_=i(e=>e==="length","isLabelLength"),MO=i(e=>e==="number","isLabelNumber"),EO=i(e=>e==="family-name","isLabelFamilyName"),G_=i(e=>e==="shadow","isLabelShadow"),kO=i(()=>{const e=vr("color"),t=vr("font"),r=vr("text"),a=vr("font-weight"),n=vr("tracking"),s=vr("leading"),o=vr("breakpoint"),h=vr("container"),p=vr("spacing"),v=vr("radius"),c=vr("shadow"),d=vr("inset-shadow"),y=vr("text-shadow"),b=vr("drop-shadow"),x=vr("blur"),k=vr("perspective"),N=vr("aspect"),C=vr("ease"),R=vr("animate"),O=i(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"scaleBreak"),T=i(()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],"scalePosition"),P=i(()=>[...T(),mt,pt],"scalePositionWithArbitrary"),z=i(()=>["auto","hidden","clip","visible","scroll"],"scaleOverflow"),Z=i(()=>["auto","contain","none"],"scaleOverscroll"),V=i(()=>[mt,pt,p],"scaleUnambiguousSpacing"),ee=i(()=>[Fa,"full","auto",...V()],"scaleInset"),$=i(()=>[Nn,"none","subgrid",mt,pt],"scaleGridTemplateColsRows"),F=i(()=>["auto",{span:["full",Nn,mt,pt]},Nn,mt,pt],"scaleGridColRowStartAndEnd"),u=i(()=>[Nn,"auto",mt,pt],"scaleGridColRowStartOrEnd"),g=i(()=>["auto","min","max","fr",mt,pt],"scaleGridAutoColsRows"),l=i(()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],"scaleAlignPrimaryAxis"),m=i(()=>["start","end","center","stretch","center-safe","end-safe"],"scaleAlignSecondaryAxis"),w=i(()=>["auto",...V()],"scaleMargin"),M=i(()=>[Fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],"scaleSizing"),j=i(()=>[e,mt,pt],"scaleColor"),S=i(()=>[...T(),Ly,Dy,{position:[mt,pt]}],"scaleBgPosition"),f=i(()=>["no-repeat",{repeat:["","x","y","space","round"]}],"scaleBgRepeat"),_=i(()=>["auto","cover","contain",_O,yO,{size:[mt,pt]}],"scaleBgSize"),E=i(()=>[Zc,Is,Xn],"scaleGradientStopPosition"),I=i(()=>["","none","full",v,mt,pt],"scaleRadius"),D=i(()=>["",Dt,Is,Xn],"scaleBorderWidth"),L=i(()=>["solid","dashed","dotted","double"],"scaleLineStyle"),U=i(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"scaleBlendMode"),B=i(()=>[Dt,Zc,Ly,Dy],"scaleMaskImagePosition"),G=i(()=>["","none",x,mt,pt],"scaleBlur"),H=i(()=>["none",Dt,mt,pt],"scaleRotate"),K=i(()=>["none",Dt,mt,pt],"scaleScale"),_e=i(()=>[Dt,mt,pt],"scaleSkew"),se=i(()=>[Fa,"full",...V()],"scaleTranslate");return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rn],breakpoint:[rn],color:[pO],container:[rn],"drop-shadow":[rn],ease:["in","out","in-out"],font:[bO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rn],shadow:[rn],spacing:["px",Dt],text:[rn],"text-shadow":[rn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Fa,pt,mt,N]}],container:["container"],columns:[{columns:[Dt,pt,mt,h]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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"],sr:["sr-only","not-sr-only"],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:P()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{start:ee()}],end:[{end:ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[Nn,"auto",mt,pt]}],basis:[{basis:[Fa,"full","auto",h,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Dt,Fa,"auto","initial","none",pt]}],grow:[{grow:["",Dt,mt,pt]}],shrink:[{shrink:["",Dt,mt,pt]}],order:[{order:[Nn,"first","last","none",mt,pt]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":u()}],"col-end":[{"col-end":u()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:F()}],"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":g()}],"auto-rows":[{"auto-rows":g()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...l(),"normal"]}],"justify-items":[{"justify-items":[...m(),"normal"]}],"justify-self":[{"justify-self":["auto",...m()]}],"align-content":[{content:["normal",...l()]}],"align-items":[{items:[...m(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...m(),{baseline:["","last"]}]}],"place-content":[{"place-content":l()}],"place-items":[{"place-items":[...m(),"baseline"]}],"place-self":[{"place-self":["auto",...m()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],w:[{w:[h,"screen",...M()]}],"min-w":[{"min-w":[h,"screen","none",...M()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[o]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh",...M()]}],"font-size":[{text:["base",r,Is,Xn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,mt,Hc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zc,pt]}],"font-family":[{font:[xO,pt,t]}],"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:[n,mt,pt]}],"line-clamp":[{"line-clamp":[Dt,"none",mt,Hc]}],leading:[{leading:[s,...V()]}],"list-image":[{"list-image":["none",mt,pt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",mt,pt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Dt,"from-font","auto",mt,Xn]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[Dt,"auto",mt,pt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt,pt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mt,pt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:S()}],"bg-repeat":[{bg:f()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Nn,mt,pt],radial:["",mt,pt],conic:[Nn,mt,pt]},SO,wO]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:E()}],"gradient-via-pos":[{via:E()}],"gradient-to-pos":[{to:E()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Dt,mt,pt]}],"outline-w":[{outline:["",Dt,Is,Xn]}],"outline-color":[{outline:j()}],shadow:[{shadow:["","none",c,kl,El]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":["none",d,kl,El]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[Dt,Xn]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":["none",y,kl,El]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[Dt,mt,pt]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Dt]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[mt,pt]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Dt]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:S()}],"mask-repeat":[{mask:f()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",mt,pt]}],filter:[{filter:["","none",mt,pt]}],blur:[{blur:G()}],brightness:[{brightness:[Dt,mt,pt]}],contrast:[{contrast:[Dt,mt,pt]}],"drop-shadow":[{"drop-shadow":["","none",b,kl,El]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:["",Dt,mt,pt]}],"hue-rotate":[{"hue-rotate":[Dt,mt,pt]}],invert:[{invert:["",Dt,mt,pt]}],saturate:[{saturate:[Dt,mt,pt]}],sepia:[{sepia:["",Dt,mt,pt]}],"backdrop-filter":[{"backdrop-filter":["","none",mt,pt]}],"backdrop-blur":[{"backdrop-blur":G()}],"backdrop-brightness":[{"backdrop-brightness":[Dt,mt,pt]}],"backdrop-contrast":[{"backdrop-contrast":[Dt,mt,pt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Dt,mt,pt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Dt,mt,pt]}],"backdrop-invert":[{"backdrop-invert":["",Dt,mt,pt]}],"backdrop-opacity":[{"backdrop-opacity":[Dt,mt,pt]}],"backdrop-saturate":[{"backdrop-saturate":[Dt,mt,pt]}],"backdrop-sepia":[{"backdrop-sepia":["",Dt,mt,pt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",mt,pt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Dt,"initial",mt,pt]}],ease:[{ease:["linear","initial",C,mt,pt]}],delay:[{delay:[Dt,mt,pt]}],animate:[{animate:["none",R,mt,pt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,mt,pt]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[mt,pt,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:j()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",mt,pt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",mt,pt]}],fill:[{fill:["none",...j()]}],"stroke-w":[{stroke:[Dt,Is,Xn,Hc]}],stroke:[{stroke:["none",...j()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},"getDefaultConfig"),jO=oO(kO);function Le(...e){return jO(fv(e))}i(Le,"cn");O_.extend(JR);const ga=O_,Sa=i(e=>e.substring(0,2),"formatAgentName");function bn(){return URL.createObjectURL(new Blob).split("/").pop()}i(bn,"randomUUID");function Ma(){const e="elizaos-client-user-id",t=localStorage.getItem(e);if(t)return t;const r=bn();return localStorage.setItem(e,r),r}i(Ma,"getEntityId");const V_=i((e,t=bo,r=.8)=>new Promise((a,n)=>{const s=new FileReader;s.onload=o=>{if(o.target?.result){const h=new Image;h.src=o.target.result,h.onload=()=>{const p=document.createElement("canvas");let v=h.width,c=h.height;v>c?v>t&&(c*=t/v,v=t):c>t&&(v*=t/c,c=t),p.width=v,p.height=c,p.getContext("2d")?.drawImage(h,0,0,v,c);const y=p.toDataURL("image/jpeg",r);a(y)},h.onerror=n}},s.onerror=n,s.readAsDataURL(e)}),"compressImage"),By=["/images/agents/agent1.png","/images/agents/agent2.png","/images/agents/agent3.png","/images/agents/agent4.png","/images/agents/agent5.png"],yo=i(e=>{if(e?.settings?.avatar)return e.settings.avatar;if(e?.id){let t=0;for(let a=0;a<e.id.length;a++){const n=e.id.charCodeAt(a);t=(t<<5)-t+n,t|=0}const r=Math.abs(t)%By.length;return By[r]}return"/elizaos-icon.png"},"getAgentAvatar"),dv=i((e,t,r)=>{if(e?.name&&e.name.trim()!=="")return e.name;if(t&&t.length>0){const a=t.filter(n=>n.id!==r&&n.name);if(a.length===0&&t.some(n=>n.id===r&&n.name)){const n=t.find(s=>s.id===r);return n&&n.name||"Unnamed Group"}if(a.length>0)return a.map(n=>n.name).slice(0,3).join(", ")+(a.length>3?"...":"")}return"Unnamed Group"},"generateGroupName"),hv=En("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 et({className:e,variant:t,size:r,asChild:a=!1,...n}){const s=a?ms:"button";return A.jsx(s,{"data-slot":"button",className:Le(hv({variant:t,size:r,className:e})),...n})}i(et,"Button$1");const hr=J.forwardRef(({className:e,type:t,...r},a)=>A.jsx("input",{type:t,className:Le("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",e),ref:a,"data-testid":r["data-testid"]||"input",...r}));hr.displayName="Input";const ei=J.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...a},n)=>A.jsx(P5,{ref:n,decorative:r,orientation:t,className:Le("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),"data-testid":a["data-testid"]||"separator",...a}));ei.displayName=P5.displayName;const Z_=D5,AO=L5,NO=B5,H_=J.forwardRef(({className:e,...t},r)=>A.jsx(bf,{className:Le("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",e),...t,ref:r}));H_.displayName=bf.displayName;const IO=En("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"}}),pv=J.forwardRef(({side:e="right",className:t,children:r,...a},n)=>A.jsxs(NO,{children:[A.jsx(H_,{}),A.jsxs(vf,{ref:n,className:Le(IO({side:e}),t),...a,children:[A.jsxs(z5,{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:[A.jsx(Fr,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));pv.displayName=vf.displayName;const CO=J.forwardRef(({className:e,...t},r)=>A.jsx(yf,{ref:r,className:Le("text-lg font-semibold text-foreground",e),...t}));CO.displayName=yf.displayName;const RO=J.forwardRef(({className:e,...t},r)=>A.jsx(wf,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));RO.displayName=wf.displayName;function wo({className:e,...t}){return A.jsx("div",{className:Le("animate-pulse rounded-md bg-primary/10",e),"data-testid":t["data-testid"]||"skeleton",...t})}i(wo,"Skeleton");const es=uC,cr=fC,dr=cC,lr=J.forwardRef(({className:e,sideOffset:t=4,...r},a)=>A.jsx(dC,{children:A.jsx(U5,{ref:a,sideOffset:t,className:Le("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",e),...r})}));lr.displayName=U5.displayName;const Jc=768;function OO(){const[e,t]=J.useState(void 0);return J.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Jc-1}px)`),a=i(()=>{t(window.innerWidth<Jc)},"onChange");return r.addEventListener("change",a),t(window.innerWidth<Jc),()=>r.removeEventListener("change",a)},[]),!!e}i(OO,"useIsMobile");const TO="sidebar:state",PO=3600*24*7,DO="16rem",LO="18rem",BO="3rem",zO="b",J_=J.createContext(null);function kf(){const e=J.useContext(J_);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}i(kf,"useSidebar");const q_=J.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:n,children:s,...o},h)=>{const p=OO(),[v,c]=J.useState(!1),[d,y]=J.useState(e),b=t??d,x=J.useCallback(R=>{const O=typeof R=="function"?R(b):R;r?r(O):y(O),document.cookie=`${TO}=${O}; path=/; max-age=${PO}`},[r,b]),k=J.useCallback(()=>p?c(R=>!R):x(R=>!R),[p,x,c]);J.useEffect(()=>{const R=i(O=>{O.key===zO&&(O.metaKey||O.ctrlKey)&&(O.preventDefault(),k())},"handleKeyDown");return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[k]);const N=b?"expanded":"collapsed",C=J.useMemo(()=>({state:N,open:b,setOpen:x,isMobile:p,openMobile:v,setOpenMobile:c,toggleSidebar:k}),[N,b,x,p,v,c,k]);return A.jsx(J_.Provider,{value:C,children:A.jsx(es,{delayDuration:0,children:A.jsx("div",{style:{"--sidebar-width":DO,"--sidebar-width-icon":BO,...n},className:Le("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-card",a),ref:h,...o,children:s})})})});q_.displayName="SidebarProvider";const K_=J.forwardRef(({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:a,children:n,...s},o)=>{const{isMobile:h,state:p,openMobile:v,setOpenMobile:c}=kf();return r==="none"?A.jsx("div",{className:Le("flex h-full w-[--sidebar-width] flex-col bg-card text-sidebar-foreground",a),ref:o,...s,children:n}):h?A.jsx(Z_,{open:v,onOpenChange:c,...s,children:A.jsx(pv,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-card p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":LO},side:e,children:A.jsx("div",{className:"flex h-full w-full flex-col",children:n})})}):A.jsxs("div",{ref:o,className:"group peer hidden md:block text-sidebar-foreground","data-state":p,"data-collapsible":p==="collapsed"?r:"","data-variant":t,"data-side":e,children:[A.jsx("div",{className:Le("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",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),A.jsx("div",{className:Le("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",e==="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)]",t==="floating"||t==="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",a),...s,children:A.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:n})})]})});K_.displayName="Sidebar";const UO=J.forwardRef(({className:e,onClick:t,...r},a)=>{const{toggleSidebar:n}=kf();return A.jsxs(et,{ref:a,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Le("h-7 w-7",e),onClick:i(s=>{t?.(s),n()},"onClick"),"data-testid":"sidebar-toggle",...r,children:[A.jsx(hC,{}),A.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});UO.displayName="SidebarTrigger";const FO=J.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:a}=kf();return A.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:Le("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",e),...t})});FO.displayName="SidebarRail";const X_=J.forwardRef(({className:e,...t},r)=>A.jsx("main",{ref:r,className:Le("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",e),...t}));X_.displayName="SidebarInset";const $O=J.forwardRef(({className:e,...t},r)=>A.jsx(hr,{ref:r,"data-sidebar":"input",className:Le("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));$O.displayName="SidebarInput";const W_=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"header",className:Le("flex flex-col gap-2 p-2",e),...t}));W_.displayName="SidebarHeader";const Q_=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"footer",className:Le("flex flex-col gap-2 p-2",e),...t}));Q_.displayName="SidebarFooter";const GO=J.forwardRef(({className:e,...t},r)=>A.jsx(ei,{ref:r,"data-sidebar":"separator",className:Le("mx-2 w-auto bg-card-border",e),...t}));GO.displayName="SidebarSeparator";const Y_=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"content",className:Le("flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden group-data-[collapsible=icon]:overflow-hidden",e),...t}));Y_.displayName="SidebarContent";const jf=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"group",className:Le("relative flex w-full min-w-0 flex-col p-0.5",e),...t}));jf.displayName="SidebarGroup";const VO=J.forwardRef(({className:e,asChild:t=!1,...r},a)=>{const n=t?ms:"div";return A.jsx(n,{ref:a,"data-sidebar":"group-label",className:Le("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",e),...r})});VO.displayName="SidebarGroupLabel";const ZO=J.forwardRef(({className:e,asChild:t=!1,...r},a)=>{const n=t?ms:"button";return A.jsx(n,{ref:a,"data-sidebar":"group-action",className:Le("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",e),...r})});ZO.displayName="SidebarGroupAction";const Af=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"group-content",className:Le("w-full text-sm p-0 m-0",e),...t}));Af.displayName="SidebarGroupContent";const va=J.forwardRef(({className:e,...t},r)=>A.jsx("ul",{ref:r,"data-sidebar":"menu",className:Le("flex w-full min-w-0 flex-col gap-0.5",e),...t}));va.displayName="SidebarMenu";const ji=J.forwardRef(({className:e,...t},r)=>A.jsx("li",{ref:r,"data-sidebar":"menu-item",className:Le("group/menu-item relative",e),...t}));ji.displayName="SidebarMenuItem";const HO=En("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"}}),Ea=J.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="default",size:a="default",tooltip:n,className:s,...o},h)=>{const p=e?ms:"button",{isMobile:v,state:c}=kf(),d=A.jsx(p,{ref:h,"data-sidebar":"menu-button","data-size":a,"data-active":t,className:Le(HO({variant:r,size:a}),s),...o});return n?(typeof n=="string"&&(n={children:n}),A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:d}),A.jsx(lr,{side:"right",align:"center",hidden:c!=="collapsed"||v,...n})]})):d});Ea.displayName="SidebarMenuButton";const JO=J.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...a},n)=>{const s=t?ms:"button";return A.jsx(s,{ref:n,"data-sidebar":"menu-action",className:Le("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",e),...a})});JO.displayName="SidebarMenuAction";const qO=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:Le("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",e),...t}));qO.displayName="SidebarMenuBadge";const Nf=J.forwardRef(({className:e,showIcon:t=!1,...r},a)=>{const n=J.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return A.jsxs("div",{ref:a,"data-sidebar":"menu-skeleton",className:Le("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[t&&A.jsx(wo,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),A.jsx(wo,{className:"h-4 flex-1 max-w-[--skeleton-width]","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});Nf.displayName="SidebarMenuSkeleton";const KO=J.forwardRef(({className:e,...t},r)=>A.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:Le("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",e),...t}));KO.displayName="SidebarMenuSub";const XO=J.forwardRef(({...e},t)=>A.jsx("li",{ref:t,...e}));XO.displayName="SidebarMenuSubItem";const WO=J.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:a,...n},s)=>{const o=e?ms:"a";return A.jsx(o,{ref:s,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Le("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",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",a),...n})});WO.displayName="SidebarMenuSubButton";const QO=En("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 xi({className:e,variant:t,...r}){return A.jsx("div",{className:Le(QO({variant:t}),e),"data-testid":r["data-testid"]||"badge",...r})}i(xi,"Badge$1");const YO=En("text-sm font-normal text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ts=J.forwardRef(({className:e,...t},r)=>A.jsx(F5,{ref:r,className:Le(YO(),e),...t}));ts.displayName=F5.displayName;const eT=i(({tag:e,onRemove:t})=>A.jsxs(xi,{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:[e,A.jsxs(et,{type:"button",variant:"ghost",size:"icon",onClick:i(()=>t(e),"onClick"),className:"hover:bg-accent/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[A.jsx(Fr,{className:"h-3 w-3"}),A.jsxs("span",{className:"sr-only",children:["Remove ",e]})]})]}),"Tag"),tT=i(({tags:e,onRemove:t})=>A.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map(r=>A.jsx(eT,{tag:r,onRemove:t},r))}),"TagList"),rT=i(({value:e,onChange:t,onKeyDown:r,onAdd:a})=>A.jsxs("div",{className:"relative",children:[A.jsx(hr,{value:e,onChange:t,onKeyDown:r,placeholder:"Type and press Enter or click Add...",className:Le("bg-background pr-16",!e&&"text-muted-foreground")}),e.trim()&&A.jsx(et,{size:"sm",onClick:a,className:"absolute top-1/2 -translate-y-1/2 right-2 h-7 px-3",children:"Add"})]}),"TagInput");function iT({title:e,data:t,onChange:r}){const[a,n]=J.useState(""),s=i(()=>{const p=a.trim();p&&!t.includes(p)&&(r([...t,p]),n(""))},"addTag"),o=i(p=>{p.key==="Enter"&&(p.preventDefault(),s())},"handleKeyDown"),h=i(p=>{r(t.filter(v=>v!==p))},"removeTag");return A.jsxs("div",{className:"space-y-2",children:[A.jsx(ts,{children:e}),A.jsxs("div",{className:"p-2 bg-card rounded border border-input",children:[A.jsx(tT,{tags:t,onRemove:h}),A.jsx(rT,{value:a,onChange:i(p=>n(p.target.value),"onChange"),onKeyDown:o,onAdd:s})]})]})}i(iT,"ArrayInput");const mv=$5,If=J.forwardRef(({className:e,...t},r)=>A.jsx(Qg,{ref:r,className:Le("inline-flex items-center bg-transparent border-b border-sidebar-border w-full",e),...t}));If.displayName=Qg.displayName;const xo=J.forwardRef(({className:e,...t},r)=>A.jsx(Yg,{ref:r,className:Le("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",e),...t}));xo.displayName=Yg.displayName;const wi=J.forwardRef(({className:e,...t},r)=>A.jsx(G5,{ref:r,className:Le("text-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));wi.displayName=G5.displayName;const Wo=J.forwardRef(({className:e,...t},r)=>A.jsx("textarea",{className:Le("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",e),ref:r,"data-testid":t["data-testid"]||"textarea",...t}));Wo.displayName="Textarea";const nT=1,aT=3e3;let qc=0;function sT(){return qc=(qc+1)%Number.MAX_SAFE_INTEGER,qc.toString()}i(sT,"genId");const Kc=new Map,zy=i(e=>{if(Kc.has(e))return;const t=setTimeout(()=>{Kc.delete(e),ho({type:"REMOVE_TOAST",toastId:e})},aT);Kc.set(e,t)},"addToRemoveQueue"),oT=i((e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,nT)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r)zy(r);else for(const a of e.toasts)zy(a.id);return{...e,toasts:e.toasts.map(a=>a.id===r||r===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},"reducer"),_u=[];let Su={toasts:[]};function ho(e){Su=oT(Su,e);for(const t of _u)t(Su)}i(ho,"dispatch");function lT({...e}){const t=sT(),r=i(n=>ho({type:"UPDATE_TOAST",toast:{...n,id:t}}),"update"),a=i(()=>ho({type:"DISMISS_TOAST",toastId:t}),"dismiss");return ho({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i(n=>{n||a()},"onOpenChange")}}),{id:t,dismiss:a,update:r}}i(lT,"toast");function rr(){const[e,t]=J.useState(Su);return J.useEffect(()=>(_u.push(t),()=>{const r=_u.indexOf(t);r>-1&&_u.splice(r,1)}),[]),{...e,toast:lT,dismiss:i(r=>ho({type:"DISMISS_TOAST",toastId:r}),"dismiss")}}i(rr,"useToast");function uT(e){return e.replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}i(uT,"sanitizeFilename");function fT(e){const t={id:e.id,name:e.name,username:e.username,system:e.system,templates:e.templates,bio:e.bio,messageExamples:e.messageExamples,postExamples:e.postExamples,topics:e.topics,adjectives:e.adjectives,knowledge:e.knowledge,plugins:e.plugins,settings:e.settings?{...e.settings}:void 0,style:e.style};if(t.settings&&"secrets"in t.settings){const{secrets:r,...a}=t.settings;t.settings=a}return Object.fromEntries(Object.entries(t).filter(([r,a])=>a!=null))}i(fT,"agentToCharacterData");function cT(e){const t=new Date().toISOString().split("T")[0];return`${uT(e||"agent")}-${t}.json`}i(cT,"generateExportFilename");function dT(e,t){const r=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(r),n=document.createElement("a");n.href=a,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(a)}i(dT,"downloadJsonFile");function gv(e,t){try{const r=fT(e),a=cT(e.name);return dT(r,a),t&&t({title:"Character Exported",description:`${e.name}'s character data has been downloaded as ${a}`}),{success:!0,filename:a}}catch(r){return console.error("Failed to export character:",r),t&&t({title:"Export Failed",description:"Failed to export character data. Please try again.",variant:"destructive"}),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}i(gv,"exportCharacterAsJson");const xn=pC,Xc=gC,_n=mC,Gi=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(V5,{ref:a,className:Le("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",e),...r,children:[t,A.jsx(vC,{asChild:!0,children:A.jsx(Ji,{className:"h-4 w-4 opacity-50"})})]}));Gi.displayName=V5.displayName;const e7=J.forwardRef(({className:e,...t},r)=>A.jsx(K5,{ref:r,className:Le("flex cursor-default items-center justify-center py-1",e),...t,children:A.jsx(X5,{className:"h-4 w-4"})}));e7.displayName=K5.displayName;const t7=J.forwardRef(({className:e,...t},r)=>A.jsx(W5,{ref:r,className:Le("flex cursor-default items-center justify-center py-1",e),...t,children:A.jsx(Ji,{className:"h-4 w-4"})}));t7.displayName=W5.displayName;const Vi=J.forwardRef(({className:e,children:t,position:r="popper",...a},n)=>A.jsx(bC,{children:A.jsxs(Z5,{ref:n,className:Le("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",e),position:r,...a,children:[A.jsx(e7,{}),A.jsx(yC,{className:Le("p-2",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),A.jsx(t7,{})]})}));Vi.displayName=Z5.displayName;const Xm=J.forwardRef(({className:e,...t},r)=>A.jsx(q5,{ref:r,className:Le("px-4 py-2 text-xs font-medium text-muted-foreground uppercase tracking-wider",e),...t}));Xm.displayName=q5.displayName;const Qt=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(H5,{ref:a,className:Le("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",e),...r,children:[A.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:A.jsx(wC,{children:A.jsx(Sn,{className:"h-4 w-4"})})}),A.jsx(xC,{children:t})]}));Qt.displayName=H5.displayName;const Wm=J.forwardRef(({className:e,...t},r)=>A.jsx(J5,{ref:r,className:Le("-mx-1 my-1 h-px bg-muted",e),...t}));Wm.displayName=J5.displayName;const r7={elevenlabs:"@elizaos/plugin-elevenlabs",openai:"@elizaos/plugin-openai",none:""},hT=[{value:"none",label:"No Voice",provider:"none"}],pT=[],vv=[{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"]}],i7=[{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"]}],n7=i(()=>[...hT,...pT,...vv,...i7],"getAllVoiceModels"),Qm=i(e=>n7().find(t=>t.value===e),"getVoiceModelByValue");function mT(){const[e,t]=J.useState(null);return J.useEffect(()=>{const r=localStorage.getItem("ELEVENLABS_API_KEY");t(r)},[]),Ar({queryKey:["elevenlabs-voices",e],queryFn:i(async()=>{if(!e)return[];try{const r=await fetch("https://api.elevenlabs.io/v2/voices",{method:"GET",headers:{"xi-api-key":e}});if(!r.ok)return console.error("Failed to fetch ElevenLabs voices:",r.statusText),[];const a=await r.json(),n=vv.map(h=>h.value);return a.voices.filter(h=>!n.includes(h.voice_id)).map(h=>({value:h.voice_id,label:`ElevenLabs - ${h.name} (Custom)`,provider:"elevenlabs",gender:h.labels?.gender==="female"?"female":"male",language:"en",features:[h.category||"professional",h.labels?.description||"natural"]}))}catch(r){return console.error("Error fetching ElevenLabs voices:",r),[]}},"queryFn"),staleTime:3600*1e3,refetchOnWindowFocus:!1})}i(mT,"useElevenLabsVoices");function _o({...e}){return A.jsx(_C,{"data-slot":"dropdown-menu",...e})}i(_o,"DropdownMenu");function So({...e}){return A.jsx(SC,{"data-slot":"dropdown-menu-trigger",...e})}i(So,"DropdownMenuTrigger");function Mo({className:e,sideOffset:t=4,onPointerDown:r,onPointerDownOutside:a,onCloseAutoFocus:n,...s}){const o=J.useRef(!1),h=J.useCallback(c=>{o.current=!0,r?.(c)},[r]),p=J.useCallback(c=>{o.current=!0,a?.(c)},[a]),v=J.useCallback(c=>{if(n)return n(c);o.current&&(c.preventDefault(),o.current=!1)},[n]);return A.jsx(MC,{children:A.jsx(EC,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Le("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",e),onPointerDown:h,onPointerDownOutside:p,onCloseAutoFocus:v,...s})})}i(Mo,"DropdownMenuContent");function Fi({className:e,inset:t,variant:r="default",...a}){return A.jsx(kC,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Le("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",e),...a})}i(Fi,"DropdownMenuItem");function gT({className:e,inset:t,...r}){return A.jsx(AC,{"data-slot":"dropdown-menu-label","data-inset":t,className:Le("text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:pl-8",e),...r})}i(gT,"DropdownMenuLabel");function Uu({className:e,...t}){return A.jsx(jC,{"data-slot":"dropdown-menu-separator",className:Le("bg-border -mx-1 my-1 h-px",e),...t})}i(Uu,"DropdownMenuSeparator");const a7=[{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 s7(e){return a7.find(t=>t.id===e)}i(s7,"getTemplateById");const bv=NC,vT=IC,o7=J.forwardRef(({className:e,...t},r)=>A.jsx(i_,{className:Le("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",e),...t,ref:r}));o7.displayName=i_.displayName;const Cf=J.forwardRef(({className:e,...t},r)=>A.jsxs(vT,{children:[A.jsx(o7,{}),A.jsx(Q5,{ref:r,className:Le("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",e),...t})]}));Cf.displayName=Q5.displayName;const Rf=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col space-y-2 text-center sm:text-left",e),...t}),"AlertDialogHeader");Rf.displayName="AlertDialogHeader";const Of=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t}),"AlertDialogFooter");Of.displayName="AlertDialogFooter";const Tf=J.forwardRef(({className:e,...t},r)=>A.jsx(Y5,{ref:r,className:Le("text-lg font-semibold",e),...t}));Tf.displayName=Y5.displayName;const Pf=J.forwardRef(({className:e,...t},r)=>A.jsx(e_,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));Pf.displayName=e_.displayName;const Df=J.forwardRef(({className:e,...t},r)=>A.jsx(r_,{ref:r,className:Le(hv(),e),...t}));Df.displayName=r_.displayName;const Lf=J.forwardRef(({className:e,...t},r)=>A.jsx(t_,{ref:r,className:Le(hv({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Lf.displayName=t_.displayName;function bT({open:e,onOpenChange:t,missingSecrets:r,onConfirm:a,onCancel:n}){return A.jsx(bv,{open:e,onOpenChange:t,children:A.jsxs(Cf,{children:[A.jsxs(Rf,{children:[A.jsxs(Tf,{className:"flex items-center gap-2",children:[A.jsx(fi,{className:"h-5 w-5 text-yellow-500"}),"Missing Required Configuration"]}),A.jsxs(Pf,{className:"space-y-3",children:[A.jsx("p",{children:"The following required secrets are missing or empty. Your agent may not function properly without these values."}),A.jsx("div",{className:"bg-muted rounded-md p-3 space-y-2",children:r.map(s=>A.jsxs("div",{className:"text-sm",children:[A.jsx("code",{className:"font-mono font-semibold",children:s.name}),s.plugin&&A.jsxs("span",{className:"text-muted-foreground ml-2",children:["(required by ",s.plugin,")"]}),s.description&&A.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:s.description})]},s.name))}),A.jsx("p",{className:"text-sm",children:"Do you want to save anyway?"})]})]}),A.jsxs(Of,{children:[A.jsx(Lf,{onClick:n,children:"Go Back"}),A.jsx(Df,{onClick:a,className:"bg-yellow-600 hover:bg-yellow-700",children:"Save Anyway"})]})]})})}i(bT,"MissingSecretsDialog");var It={},jl={exports:{}},Al={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Uy;function At(){return Uy||(Uy=1,(function(e,t){var r=Vn(),a=r.Buffer;function n(o,h){for(var p in o)h[p]=o[p]}i(n,"copyProps"),a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s);function s(o,h,p){return a(o,h,p)}i(s,"SafeBuffer"),s.prototype=Object.create(a.prototype),n(a,s),s.from=function(o,h,p){if(typeof o=="number")throw new TypeError("Argument must not be a number");return a(o,h,p)},s.alloc=function(o,h,p){if(typeof o!="number")throw new TypeError("Argument must be a number");var v=a(o);return h!==void 0?typeof p=="string"?v.fill(h,p):v.fill(h):v.fill(0),v},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return a(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(Al,Al.exports)),Al.exports}i(At,"requireSafeBuffer$2");var Fy;function ys(){if(Fy)return jl.exports;Fy=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
1
+ var oC=Object.defineProperty;var i=(e,t)=>oC(e,"name",{value:t,configurable:!0});var lC=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);import{g as Jo,j as A,S as ms,r as J,R as P5,a as D5,T as L5,P as B5,C as vf,b as z5,X as Fr,O as bf,c as yf,D as wf,d as uC,e as fC,f as cC,h as dC,i as U5,k as hC,l as F5,m as $5,L as Qg,n as Yg,o as G5,p as pC,V as mC,G as gC,q as V5,I as vC,s as Ji,t as bC,u as Z5,v as yC,w as H5,x as wC,y as Sn,z as xC,A as J5,B as q5,E as K5,F as X5,H as W5,J as Ar,K as _C,M as SC,N as MC,Q as EC,U as kC,W as jC,Y as AC,Z as NC,_ as IC,$ as Q5,a0 as Y5,a1 as e_,a2 as t_,a3 as r_,a4 as i_,a5 as fi,a6 as CC,a7 as RC,a8 as n_,a9 as a_,aa as OC,ab as s_,ac as kr,ad as ev,ae as qo,af as o_,ag as l_,ah as TC,ai as PC,aj as tv,ak as u_,al as DC,am as LC,an as f_,ao as BC,ap as ma,aq as $c,ar as mn,as as zi,at as Ey,au as xa,av as zC,aw as Ui,ax as jr,ay as xr,az as c_,aA as d_,aB as h_,aC as p_,aD as m_,aE as Wr,aF as xf,aG as UC,aH as FC,aI as $C,aJ as _f,aK as Sf,aL as no,aM as _a,aN as Ln,aO as ky,aP as GC,aQ as Ko,aR as Mf,aS as go,aT as VC,aU as jy,aV as ZC,aW as g_,aX as HC,aY as v_,aZ as b_,a_ as y_,a$ as w_,b0 as x_,b1 as JC,b2 as rv,b3 as Vm,b4 as __,b5 as qC,b6 as Bu,b7 as iv,b8 as S_,b9 as KC,ba as gs,bb as as,bc as nv,bd as Xo,be as zu,bf as XC,bg as M_,bh as WC,bi as av,bj as vo,bk as Yr,bl as QC,bm as YC,bn as On,bo as Gc,bp as eR,bq as ao,br as Ja,bs as tR,bt as rR,bu as iR,bv as nR,bw as aR,bx as sR,by as sv,bz as oR,bA as lR,bB as uR,bC as ov,bD as lv,bE as fR,bF as E_,bG as Zm,bH as cR,bI as k_,bJ as dR,bK as hR,bL as pR,bM as mR,bN as gR,bO as vR,bP as bR,bQ as yR,bR as wR,bS as j_,bT as A_,bU as N_,bV as I_,bW as xR,bX as _R,bY as SR,bZ as Hm,b_ as MR,b$ as ER,c0 as Ef,c1 as kR,c2 as C_,c3 as jR,c4 as AR,c5 as Vc,c6 as Ay,c7 as Ny,c8 as NR,c9 as uv,ca as IR,cb as CR,cc as RR,cd as OR,ce as TR,cf as PR,cg as DR,ch as LR,ci as BR,cj as zR,ck as pi,cl as UR}from"./react-vendor-C1OK-nqm.js";import{r as Vn}from"./main-ClsyXern.js";import"./ui-vendor-B7JxFfFk.js";var Ote=lC(Wg=>{function R_(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=R_(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}i(R_,"r");function fv(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=R_(e))&&(a&&(a+=" "),a+=t);return a}i(fv,"clsx");const Iy=i(e=>typeof e=="boolean"?`${e}`:e===0?"0":e,"falsyToString"),Cy=fv,En=i((e,t)=>r=>{var a;if(t?.variants==null)return Cy(e,r?.class,r?.className);const{variants:n,defaultVariants:s}=t,o=Object.keys(n).map(v=>{const c=r?.[v],d=s?.[v];if(c===null)return null;const y=Iy(c)||Iy(d);return n[v][y]}),h=r&&Object.entries(r).reduce((v,c)=>{let[d,y]=c;return y===void 0||(v[d]=y),v},{}),p=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((v,c)=>{let{class:d,className:y,...b}=c;return Object.entries(b).every(x=>{let[k,N]=x;return Array.isArray(N)?N.includes({...s,...h}[k]):{...s,...h}[k]===N})?[...v,d,y]:v},[]);return Cy(e,o,p,r?.class,r?.className)},"cva"),Xa="user",Ml="client_chat",so="client_group_chat",bo=512;var yu=(e=>(e.REQUIRED="required",e.OPTIONAL="optional",e))(yu||{});const Ua={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 wu={exports:{}},FR=wu.exports,Ry;function $R(){return Ry||(Ry=1,(function(e,t){(function(r,a){e.exports=a()})(FR,(function(){var r=1e3,a=6e4,n=36e5,s="millisecond",o="second",h="minute",p="hour",v="day",c="week",d="month",y="quarter",b="year",x="date",k="Invalid Date",N=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|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,R={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:i(function(l){var m=["th","st","nd","rd"],w=l%100;return"["+l+(m[(w-20)%10]||m[w]||m[0])+"]"},"ordinal")},O=i(function(l,m,w){var M=String(l);return!M||M.length>=m?l:""+Array(m+1-M.length).join(w)+l},"m"),T={s:O,z:i(function(l){var m=-l.utcOffset(),w=Math.abs(m),M=Math.floor(w/60),j=w%60;return(m<=0?"+":"-")+O(M,2,"0")+":"+O(j,2,"0")},"z"),m:i(function l(m,w){if(m.date()<w.date())return-l(w,m);var M=12*(w.year()-m.year())+(w.month()-m.month()),j=m.clone().add(M,d),S=w-j<0,f=m.clone().add(M+(S?-1:1),d);return+(-(M+(w-j)/(S?j-f:f-j))||0)},"t2"),a:i(function(l){return l<0?Math.ceil(l)||0:Math.floor(l)},"a"),p:i(function(l){return{M:d,y:b,w:c,d:v,D:x,h:p,m:h,s:o,ms:s,Q:y}[l]||String(l||"").toLowerCase().replace(/s$/,"")},"p"),u:i(function(l){return l===void 0},"u")},P="en",z={};z[P]=R;var Z="$isDayjsObject",V=i(function(l){return l instanceof u||!(!l||!l[Z])},"S"),ee=i(function l(m,w,M){var j;if(!m)return P;if(typeof m=="string"){var S=m.toLowerCase();z[S]&&(j=S),w&&(z[S]=w,j=S);var f=m.split("-");if(!j&&f.length>1)return l(f[0])}else{var _=m.name;z[_]=m,j=_}return!M&&j&&(P=j),j||!M&&P},"t2"),$=i(function(l,m){if(V(l))return l.clone();var w=typeof m=="object"?m:{};return w.date=l,w.args=arguments,new u(w)},"O"),F=T;F.l=ee,F.i=V,F.w=function(l,m){return $(l,{locale:m.$L,utc:m.$u,x:m.$x,$offset:m.$offset})};var u=(function(){function l(w){this.$L=ee(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[Z]=!0}i(l,"M2");var m=l.prototype;return m.parse=function(w){this.$d=(function(M){var j=M.date,S=M.utc;if(j===null)return new Date(NaN);if(F.u(j))return new Date;if(j instanceof Date)return new Date(j);if(typeof j=="string"&&!/Z$/i.test(j)){var f=j.match(N);if(f){var _=f[2]-1||0,E=(f[7]||"0").substring(0,3);return S?new Date(Date.UTC(f[1],_,f[3]||1,f[4]||0,f[5]||0,f[6]||0,E)):new Date(f[1],_,f[3]||1,f[4]||0,f[5]||0,f[6]||0,E)}}return new Date(j)})(w),this.init()},m.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},m.$utils=function(){return F},m.isValid=function(){return this.$d.toString()!==k},m.isSame=function(w,M){var j=$(w);return this.startOf(M)<=j&&j<=this.endOf(M)},m.isAfter=function(w,M){return $(w)<this.startOf(M)},m.isBefore=function(w,M){return this.endOf(M)<$(w)},m.$g=function(w,M,j){return F.u(w)?this[M]:this.set(j,w)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(w,M){var j=this,S=!!F.u(M)||M,f=F.p(w),_=i(function(H,K){var _e=F.w(j.$u?Date.UTC(j.$y,K,H):new Date(j.$y,K,H),j);return S?_e:_e.endOf(v)},"l2"),E=i(function(H,K){return F.w(j.toDate()[H].apply(j.toDate("s"),(S?[0,0,0,0]:[23,59,59,999]).slice(K)),j)},"$2"),I=this.$W,D=this.$M,L=this.$D,U="set"+(this.$u?"UTC":"");switch(f){case b:return S?_(1,0):_(31,11);case d:return S?_(1,D):_(0,D+1);case c:var B=this.$locale().weekStart||0,G=(I<B?I+7:I)-B;return _(S?L-G:L+(6-G),D);case v:case x:return E(U+"Hours",0);case p:return E(U+"Minutes",1);case h:return E(U+"Seconds",2);case o:return E(U+"Milliseconds",3);default:return this.clone()}},m.endOf=function(w){return this.startOf(w,!1)},m.$set=function(w,M){var j,S=F.p(w),f="set"+(this.$u?"UTC":""),_=(j={},j[v]=f+"Date",j[x]=f+"Date",j[d]=f+"Month",j[b]=f+"FullYear",j[p]=f+"Hours",j[h]=f+"Minutes",j[o]=f+"Seconds",j[s]=f+"Milliseconds",j)[S],E=S===v?this.$D+(M-this.$W):M;if(S===d||S===b){var I=this.clone().set(x,1);I.$d[_](E),I.init(),this.$d=I.set(x,Math.min(this.$D,I.daysInMonth())).$d}else _&&this.$d[_](E);return this.init(),this},m.set=function(w,M){return this.clone().$set(w,M)},m.get=function(w){return this[F.p(w)]()},m.add=function(w,M){var j,S=this;w=Number(w);var f=F.p(M),_=i(function(D){var L=$(S);return F.w(L.date(L.date()+Math.round(D*w)),S)},"y2");if(f===d)return this.set(d,this.$M+w);if(f===b)return this.set(b,this.$y+w);if(f===v)return _(1);if(f===c)return _(7);var E=(j={},j[h]=a,j[p]=n,j[o]=r,j)[f]||1,I=this.$d.getTime()+w*E;return F.w(I,this)},m.subtract=function(w,M){return this.add(-1*w,M)},m.format=function(w){var M=this,j=this.$locale();if(!this.isValid())return j.invalidDate||k;var S=w||"YYYY-MM-DDTHH:mm:ssZ",f=F.z(this),_=this.$H,E=this.$m,I=this.$M,D=j.weekdays,L=j.months,U=j.meridiem,B=i(function(K,_e,se,ae){return K&&(K[_e]||K(M,S))||se[_e].slice(0,ae)},"h2"),G=i(function(K){return F.s(_%12||12,K,"0")},"d2"),H=U||function(K,_e,se){var ae=K<12?"AM":"PM";return se?ae.toLowerCase():ae};return S.replace(C,(function(K,_e){return _e||(function(se){switch(se){case"YY":return String(M.$y).slice(-2);case"YYYY":return F.s(M.$y,4,"0");case"M":return I+1;case"MM":return F.s(I+1,2,"0");case"MMM":return B(j.monthsShort,I,L,3);case"MMMM":return B(L,I);case"D":return M.$D;case"DD":return F.s(M.$D,2,"0");case"d":return String(M.$W);case"dd":return B(j.weekdaysMin,M.$W,D,2);case"ddd":return B(j.weekdaysShort,M.$W,D,3);case"dddd":return D[M.$W];case"H":return String(_);case"HH":return F.s(_,2,"0");case"h":return G(1);case"hh":return G(2);case"a":return H(_,E,!0);case"A":return H(_,E,!1);case"m":return String(E);case"mm":return F.s(E,2,"0");case"s":return String(M.$s);case"ss":return F.s(M.$s,2,"0");case"SSS":return F.s(M.$ms,3,"0");case"Z":return f}return null})(K)||f.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(w,M,j){var S,f=this,_=F.p(M),E=$(w),I=(E.utcOffset()-this.utcOffset())*a,D=this-E,L=i(function(){return F.m(f,E)},"D2");switch(_){case b:S=L()/12;break;case d:S=L();break;case y:S=L()/3;break;case c:S=(D-I)/6048e5;break;case v:S=(D-I)/864e5;break;case p:S=D/n;break;case h:S=D/a;break;case o:S=D/r;break;default:S=D}return j?S:F.a(S)},m.daysInMonth=function(){return this.endOf(d).$D},m.$locale=function(){return z[this.$L]},m.locale=function(w,M){if(!w)return this.$L;var j=this.clone(),S=ee(w,M,!0);return S&&(j.$L=S),j},m.clone=function(){return F.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},l})(),g=u.prototype;return $.prototype=g,[["$ms",s],["$s",o],["$m",h],["$H",p],["$W",v],["$M",d],["$y",b],["$D",x]].forEach((function(l){g[l[1]]=function(m){return this.$g(m,l[0],l[1])}})),$.extend=function(l,m){return l.$i||(l(m,u,$),l.$i=!0),$},$.locale=ee,$.isDayjs=V,$.unix=function(l){return $(1e3*l)},$.en=z[P],$.Ls=z,$.p={},$}))})(wu)),wu.exports}i($R,"requireDayjs_min");var GR=$R();const O_=Jo(GR);var xu={exports:{}},VR=xu.exports,Oy;function ZR(){return Oy||(Oy=1,(function(e,t){(function(r,a){e.exports=a()})(VR,(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(a,n,s){var o=n.prototype,h=o.format;s.en.formats=r,o.format=function(p){p===void 0&&(p="YYYY-MM-DDTHH:mm:ssZ");var v=this.$locale().formats,c=(function(d,y){return d.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(b,x,k){var N=k&&k.toUpperCase();return x||y[k]||r[k]||y[N].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(C,R,O){return R||O.slice(1)}))}))})(p,v===void 0?{}:v);return h.call(this,c)}}}))})(xu)),xu.exports}i(ZR,"requireLocalizedFormat");var HR=ZR();const JR=Jo(HR),cv="-",qR=i(e=>{const t=XR(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:i(o=>{const h=o.split(cv);return h[0]===""&&h.length!==1&&h.shift(),T_(h,t)||KR(o)},"getClassGroupId"),getConflictingClassGroupIds:i((o,h)=>{const p=r[o]||[];return h&&a[o]?[...p,...a[o]]:p},"getConflictingClassGroupIds")}},"createClassGroupUtils"),T_=i((e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],a=t.nextPart.get(r),n=a?T_(e.slice(1),a):void 0;if(n)return n;if(t.validators.length===0)return;const s=e.join(cv);return t.validators.find(({validator:o})=>o(s))?.classGroupId},"getGroupRecursive"),Ty=/^\[(.+)\]$/,KR=i(e=>{if(Ty.test(e)){const t=Ty.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},"getGroupIdForArbitraryProperty"),XR=i(e=>{const{theme:t,classGroups:r}=e,a={nextPart:new Map,validators:[]};for(const n in r)Jm(r[n],a,n,t);return a},"createClassMap"),Jm=i((e,t,r,a)=>{e.forEach(n=>{if(typeof n=="string"){const s=n===""?t:Py(t,n);s.classGroupId=r;return}if(typeof n=="function"){if(WR(n)){Jm(n(a),t,r,a);return}t.validators.push({validator:n,classGroupId:r});return}Object.entries(n).forEach(([s,o])=>{Jm(o,Py(t,s),r,a)})})},"processClassesRecursively"),Py=i((e,t)=>{let r=e;return t.split(cv).forEach(a=>{r.nextPart.has(a)||r.nextPart.set(a,{nextPart:new Map,validators:[]}),r=r.nextPart.get(a)}),r},"getPart"),WR=i(e=>e.isThemeGetter,"isThemeGetter"),QR=i(e=>{if(e<1)return{get:i(()=>{},"get"),set:i(()=>{},"set")};let t=0,r=new Map,a=new Map;const n=i((s,o)=>{r.set(s,o),t++,t>e&&(t=0,a=r,r=new Map)},"update");return{get(s){let o=r.get(s);if(o!==void 0)return o;if((o=a.get(s))!==void 0)return n(s,o),o},set(s,o){r.has(s)?r.set(s,o):n(s,o)}}},"createLruCache"),qm="!",Km=":",YR=Km.length,eO=i(e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=i(n=>{const s=[];let o=0,h=0,p=0,v;for(let x=0;x<n.length;x++){let k=n[x];if(o===0&&h===0){if(k===Km){s.push(n.slice(p,x)),p=x+YR;continue}if(k==="/"){v=x;continue}}k==="["?o++:k==="]"?o--:k==="("?h++:k===")"&&h--}const c=s.length===0?n:n.substring(p),d=tO(c),y=d!==c,b=v&&v>p?v-p:void 0;return{modifiers:s,hasImportantModifier:y,baseClassName:d,maybePostfixModifierPosition:b}},"parseClassName");if(t){const n=t+Km,s=a;a=i(o=>o.startsWith(n)?s(o.substring(n.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0},"parseClassName")}if(r){const n=a;a=i(s=>r({className:s,parseClassName:n}),"parseClassName")}return a},"createParseClassName"),tO=i(e=>e.endsWith(qm)?e.substring(0,e.length-1):e.startsWith(qm)?e.substring(1):e,"stripImportantModifier"),rO=i(e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(a=>[a,!0]));return i(a=>{if(a.length<=1)return a;const n=[];let s=[];return a.forEach(o=>{o[0]==="["||t[o]?(n.push(...s.sort(),o),s=[]):s.push(o)}),n.push(...s.sort()),n},"sortModifiers")},"createSortModifiers"),iO=i(e=>({cache:QR(e.cacheSize),parseClassName:eO(e),sortModifiers:rO(e),...qR(e)}),"createConfigUtils"),nO=/\s+/,aO=i((e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=t,o=[],h=e.trim().split(nO);let p="";for(let v=h.length-1;v>=0;v-=1){const c=h[v],{isExternal:d,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:k}=r(c);if(d){p=c+(p.length>0?" "+p:p);continue}let N=!!k,C=a(N?x.substring(0,k):x);if(!C){if(!N){p=c+(p.length>0?" "+p:p);continue}if(C=a(x),!C){p=c+(p.length>0?" "+p:p);continue}N=!1}const R=s(y).join(":"),O=b?R+qm:R,T=O+C;if(o.includes(T))continue;o.push(T);const P=n(C,N);for(let z=0;z<P.length;++z){const Z=P[z];o.push(O+Z)}p=c+(p.length>0?" "+p:p)}return p},"mergeClassList");function sO(){let e=0,t,r,a="";for(;e<arguments.length;)(t=arguments[e++])&&(r=P_(t))&&(a&&(a+=" "),a+=r);return a}i(sO,"twJoin");const P_=i(e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=P_(e[a]))&&(r&&(r+=" "),r+=t);return r},"toValue");function oO(e,...t){let r,a,n,s=o;function o(p){const v=t.reduce((c,d)=>d(c),e());return r=iO(v),a=r.cache.get,n=r.cache.set,s=h,h(p)}i(o,"initTailwindMerge");function h(p){const v=a(p);if(v)return v;const c=aO(p,r);return n(p,c),c}return i(h,"tailwindMerge"),i(function(){return s(sO.apply(null,arguments))},"callTailwindMerge")}i(oO,"createTailwindMerge");const vr=i(e=>{const t=i(r=>r[e]||[],"themeGetter");return t.isThemeGetter=!0,t},"fromTheme"),D_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,L_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,lO=/^\d+\/\d+$/,uO=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,fO=/\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$/,cO=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dO=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hO=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fa=i(e=>lO.test(e),"isFraction"),Dt=i(e=>!!e&&!Number.isNaN(Number(e)),"isNumber"),Nn=i(e=>!!e&&Number.isInteger(Number(e)),"isInteger"),Zc=i(e=>e.endsWith("%")&&Dt(e.slice(0,-1)),"isPercent"),rn=i(e=>uO.test(e),"isTshirtSize"),pO=i(()=>!0,"isAny"),mO=i(e=>fO.test(e)&&!cO.test(e),"isLengthOnly"),B_=i(()=>!1,"isNever"),gO=i(e=>dO.test(e),"isShadow"),vO=i(e=>hO.test(e),"isImage"),bO=i(e=>!pt(e)&&!mt(e),"isAnyNonArbitrary"),yO=i(e=>vs(e,F_,B_),"isArbitrarySize"),pt=i(e=>D_.test(e),"isArbitraryValue"),Xn=i(e=>vs(e,$_,mO),"isArbitraryLength"),Hc=i(e=>vs(e,MO,Dt),"isArbitraryNumber"),Dy=i(e=>vs(e,z_,B_),"isArbitraryPosition"),wO=i(e=>vs(e,U_,vO),"isArbitraryImage"),El=i(e=>vs(e,G_,gO),"isArbitraryShadow"),mt=i(e=>L_.test(e),"isArbitraryVariable"),Is=i(e=>bs(e,$_),"isArbitraryVariableLength"),xO=i(e=>bs(e,EO),"isArbitraryVariableFamilyName"),Ly=i(e=>bs(e,z_),"isArbitraryVariablePosition"),_O=i(e=>bs(e,F_),"isArbitraryVariableSize"),SO=i(e=>bs(e,U_),"isArbitraryVariableImage"),kl=i(e=>bs(e,G_,!0),"isArbitraryVariableShadow"),vs=i((e,t,r)=>{const a=D_.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},"getIsArbitraryValue"),bs=i((e,t,r=!1)=>{const a=L_.exec(e);return a?a[1]?t(a[1]):r:!1},"getIsArbitraryVariable"),z_=i(e=>e==="position"||e==="percentage","isLabelPosition"),U_=i(e=>e==="image"||e==="url","isLabelImage"),F_=i(e=>e==="length"||e==="size"||e==="bg-size","isLabelSize"),$_=i(e=>e==="length","isLabelLength"),MO=i(e=>e==="number","isLabelNumber"),EO=i(e=>e==="family-name","isLabelFamilyName"),G_=i(e=>e==="shadow","isLabelShadow"),kO=i(()=>{const e=vr("color"),t=vr("font"),r=vr("text"),a=vr("font-weight"),n=vr("tracking"),s=vr("leading"),o=vr("breakpoint"),h=vr("container"),p=vr("spacing"),v=vr("radius"),c=vr("shadow"),d=vr("inset-shadow"),y=vr("text-shadow"),b=vr("drop-shadow"),x=vr("blur"),k=vr("perspective"),N=vr("aspect"),C=vr("ease"),R=vr("animate"),O=i(()=>["auto","avoid","all","avoid-page","page","left","right","column"],"scaleBreak"),T=i(()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],"scalePosition"),P=i(()=>[...T(),mt,pt],"scalePositionWithArbitrary"),z=i(()=>["auto","hidden","clip","visible","scroll"],"scaleOverflow"),Z=i(()=>["auto","contain","none"],"scaleOverscroll"),V=i(()=>[mt,pt,p],"scaleUnambiguousSpacing"),ee=i(()=>[Fa,"full","auto",...V()],"scaleInset"),$=i(()=>[Nn,"none","subgrid",mt,pt],"scaleGridTemplateColsRows"),F=i(()=>["auto",{span:["full",Nn,mt,pt]},Nn,mt,pt],"scaleGridColRowStartAndEnd"),u=i(()=>[Nn,"auto",mt,pt],"scaleGridColRowStartOrEnd"),g=i(()=>["auto","min","max","fr",mt,pt],"scaleGridAutoColsRows"),l=i(()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],"scaleAlignPrimaryAxis"),m=i(()=>["start","end","center","stretch","center-safe","end-safe"],"scaleAlignSecondaryAxis"),w=i(()=>["auto",...V()],"scaleMargin"),M=i(()=>[Fa,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],"scaleSizing"),j=i(()=>[e,mt,pt],"scaleColor"),S=i(()=>[...T(),Ly,Dy,{position:[mt,pt]}],"scaleBgPosition"),f=i(()=>["no-repeat",{repeat:["","x","y","space","round"]}],"scaleBgRepeat"),_=i(()=>["auto","cover","contain",_O,yO,{size:[mt,pt]}],"scaleBgSize"),E=i(()=>[Zc,Is,Xn],"scaleGradientStopPosition"),I=i(()=>["","none","full",v,mt,pt],"scaleRadius"),D=i(()=>["",Dt,Is,Xn],"scaleBorderWidth"),L=i(()=>["solid","dashed","dotted","double"],"scaleLineStyle"),U=i(()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"scaleBlendMode"),B=i(()=>[Dt,Zc,Ly,Dy],"scaleMaskImagePosition"),G=i(()=>["","none",x,mt,pt],"scaleBlur"),H=i(()=>["none",Dt,mt,pt],"scaleRotate"),K=i(()=>["none",Dt,mt,pt],"scaleScale"),_e=i(()=>[Dt,mt,pt],"scaleSkew"),se=i(()=>[Fa,"full",...V()],"scaleTranslate");return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[rn],breakpoint:[rn],color:[pO],container:[rn],"drop-shadow":[rn],ease:["in","out","in-out"],font:[bO],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[rn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[rn],shadow:[rn],spacing:["px",Dt],text:[rn],"text-shadow":[rn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Fa,pt,mt,N]}],container:["container"],columns:[{columns:[Dt,pt,mt,h]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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"],sr:["sr-only","not-sr-only"],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:P()}],overflow:[{overflow:z()}],"overflow-x":[{"overflow-x":z()}],"overflow-y":[{"overflow-y":z()}],overscroll:[{overscroll:Z()}],"overscroll-x":[{"overscroll-x":Z()}],"overscroll-y":[{"overscroll-y":Z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{start:ee()}],end:[{end:ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[Nn,"auto",mt,pt]}],basis:[{basis:[Fa,"full","auto",h,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Dt,Fa,"auto","initial","none",pt]}],grow:[{grow:["",Dt,mt,pt]}],shrink:[{shrink:["",Dt,mt,pt]}],order:[{order:[Nn,"first","last","none",mt,pt]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":u()}],"col-end":[{"col-end":u()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:F()}],"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":g()}],"auto-rows":[{"auto-rows":g()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...l(),"normal"]}],"justify-items":[{"justify-items":[...m(),"normal"]}],"justify-self":[{"justify-self":["auto",...m()]}],"align-content":[{content:["normal",...l()]}],"align-items":[{items:[...m(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...m(),{baseline:["","last"]}]}],"place-content":[{"place-content":l()}],"place-items":[{"place-items":[...m(),"baseline"]}],"place-self":[{"place-self":["auto",...m()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:w()}],mx:[{mx:w()}],my:[{my:w()}],ms:[{ms:w()}],me:[{me:w()}],mt:[{mt:w()}],mr:[{mr:w()}],mb:[{mb:w()}],ml:[{ml:w()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:M()}],w:[{w:[h,"screen",...M()]}],"min-w":[{"min-w":[h,"screen","none",...M()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[o]},...M()]}],h:[{h:["screen","lh",...M()]}],"min-h":[{"min-h":["screen","lh","none",...M()]}],"max-h":[{"max-h":["screen","lh",...M()]}],"font-size":[{text:["base",r,Is,Xn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,mt,Hc]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Zc,pt]}],"font-family":[{font:[xO,pt,t]}],"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:[n,mt,pt]}],"line-clamp":[{"line-clamp":[Dt,"none",mt,Hc]}],leading:[{leading:[s,...V()]}],"list-image":[{"list-image":["none",mt,pt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",mt,pt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Dt,"from-font","auto",mt,Xn]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[Dt,"auto",mt,pt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt,pt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",mt,pt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:S()}],"bg-repeat":[{bg:f()}],"bg-size":[{bg:_()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Nn,mt,pt],radial:["",mt,pt],conic:[Nn,mt,pt]},SO,wO]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:E()}],"gradient-via-pos":[{via:E()}],"gradient-to-pos":[{to:E()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:I()}],"rounded-s":[{"rounded-s":I()}],"rounded-e":[{"rounded-e":I()}],"rounded-t":[{"rounded-t":I()}],"rounded-r":[{"rounded-r":I()}],"rounded-b":[{"rounded-b":I()}],"rounded-l":[{"rounded-l":I()}],"rounded-ss":[{"rounded-ss":I()}],"rounded-se":[{"rounded-se":I()}],"rounded-ee":[{"rounded-ee":I()}],"rounded-es":[{"rounded-es":I()}],"rounded-tl":[{"rounded-tl":I()}],"rounded-tr":[{"rounded-tr":I()}],"rounded-br":[{"rounded-br":I()}],"rounded-bl":[{"rounded-bl":I()}],"border-w":[{border:D()}],"border-w-x":[{"border-x":D()}],"border-w-y":[{"border-y":D()}],"border-w-s":[{"border-s":D()}],"border-w-e":[{"border-e":D()}],"border-w-t":[{"border-t":D()}],"border-w-r":[{"border-r":D()}],"border-w-b":[{"border-b":D()}],"border-w-l":[{"border-l":D()}],"divide-x":[{"divide-x":D()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":D()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Dt,mt,pt]}],"outline-w":[{outline:["",Dt,Is,Xn]}],"outline-color":[{outline:j()}],shadow:[{shadow:["","none",c,kl,El]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":["none",d,kl,El]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[Dt,Xn]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":D()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":["none",y,kl,El]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[Dt,mt,pt]}],"mix-blend":[{"mix-blend":[...U(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":U()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Dt]}],"mask-image-linear-from-pos":[{"mask-linear-from":B()}],"mask-image-linear-to-pos":[{"mask-linear-to":B()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":B()}],"mask-image-t-to-pos":[{"mask-t-to":B()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":B()}],"mask-image-r-to-pos":[{"mask-r-to":B()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":B()}],"mask-image-b-to-pos":[{"mask-b-to":B()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":B()}],"mask-image-l-to-pos":[{"mask-l-to":B()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":B()}],"mask-image-x-to-pos":[{"mask-x-to":B()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":B()}],"mask-image-y-to-pos":[{"mask-y-to":B()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[mt,pt]}],"mask-image-radial-from-pos":[{"mask-radial-from":B()}],"mask-image-radial-to-pos":[{"mask-radial-to":B()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[Dt]}],"mask-image-conic-from-pos":[{"mask-conic-from":B()}],"mask-image-conic-to-pos":[{"mask-conic-to":B()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:S()}],"mask-repeat":[{mask:f()}],"mask-size":[{mask:_()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",mt,pt]}],filter:[{filter:["","none",mt,pt]}],blur:[{blur:G()}],brightness:[{brightness:[Dt,mt,pt]}],contrast:[{contrast:[Dt,mt,pt]}],"drop-shadow":[{"drop-shadow":["","none",b,kl,El]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:["",Dt,mt,pt]}],"hue-rotate":[{"hue-rotate":[Dt,mt,pt]}],invert:[{invert:["",Dt,mt,pt]}],saturate:[{saturate:[Dt,mt,pt]}],sepia:[{sepia:["",Dt,mt,pt]}],"backdrop-filter":[{"backdrop-filter":["","none",mt,pt]}],"backdrop-blur":[{"backdrop-blur":G()}],"backdrop-brightness":[{"backdrop-brightness":[Dt,mt,pt]}],"backdrop-contrast":[{"backdrop-contrast":[Dt,mt,pt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Dt,mt,pt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Dt,mt,pt]}],"backdrop-invert":[{"backdrop-invert":["",Dt,mt,pt]}],"backdrop-opacity":[{"backdrop-opacity":[Dt,mt,pt]}],"backdrop-saturate":[{"backdrop-saturate":[Dt,mt,pt]}],"backdrop-sepia":[{"backdrop-sepia":["",Dt,mt,pt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",mt,pt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Dt,"initial",mt,pt]}],ease:[{ease:["linear","initial",C,mt,pt]}],delay:[{delay:[Dt,mt,pt]}],animate:[{animate:["none",R,mt,pt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,mt,pt]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:H()}],"rotate-x":[{"rotate-x":H()}],"rotate-y":[{"rotate-y":H()}],"rotate-z":[{"rotate-z":H()}],scale:[{scale:K()}],"scale-x":[{"scale-x":K()}],"scale-y":[{"scale-y":K()}],"scale-z":[{"scale-z":K()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[mt,pt,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:j()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",mt,pt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",mt,pt]}],fill:[{fill:["none",...j()]}],"stroke-w":[{stroke:[Dt,Is,Xn,Hc]}],stroke:[{stroke:["none",...j()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},"getDefaultConfig"),jO=oO(kO);function Le(...e){return jO(fv(e))}i(Le,"cn");O_.extend(JR);const ga=O_,Sa=i(e=>e.substring(0,2),"formatAgentName");function bn(){return URL.createObjectURL(new Blob).split("/").pop()}i(bn,"randomUUID");function Ma(){const e="elizaos-client-user-id",t=localStorage.getItem(e);if(t)return t;const r=bn();return localStorage.setItem(e,r),r}i(Ma,"getEntityId");const V_=i((e,t=bo,r=.8)=>new Promise((a,n)=>{const s=new FileReader;s.onload=o=>{if(o.target?.result){const h=new Image;h.src=o.target.result,h.onload=()=>{const p=document.createElement("canvas");let v=h.width,c=h.height;v>c?v>t&&(c*=t/v,v=t):c>t&&(v*=t/c,c=t),p.width=v,p.height=c,p.getContext("2d")?.drawImage(h,0,0,v,c);const y=p.toDataURL("image/jpeg",r);a(y)},h.onerror=n}},s.onerror=n,s.readAsDataURL(e)}),"compressImage"),By=["/images/agents/agent1.png","/images/agents/agent2.png","/images/agents/agent3.png","/images/agents/agent4.png","/images/agents/agent5.png"],yo=i(e=>{if(e?.settings?.avatar)return e.settings.avatar;if(e?.id){let t=0;for(let a=0;a<e.id.length;a++){const n=e.id.charCodeAt(a);t=(t<<5)-t+n,t|=0}const r=Math.abs(t)%By.length;return By[r]}return"/elizaos-icon.png"},"getAgentAvatar"),dv=i((e,t,r)=>{if(e?.name&&e.name.trim()!=="")return e.name;if(t&&t.length>0){const a=t.filter(n=>n.id!==r&&n.name);if(a.length===0&&t.some(n=>n.id===r&&n.name)){const n=t.find(s=>s.id===r);return n&&n.name||"Unnamed Group"}if(a.length>0)return a.map(n=>n.name).slice(0,3).join(", ")+(a.length>3?"...":"")}return"Unnamed Group"},"generateGroupName"),hv=En("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 et({className:e,variant:t,size:r,asChild:a=!1,...n}){const s=a?ms:"button";return A.jsx(s,{"data-slot":"button",className:Le(hv({variant:t,size:r,className:e})),...n})}i(et,"Button$1");const hr=J.forwardRef(({className:e,type:t,...r},a)=>A.jsx("input",{type:t,className:Le("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",e),ref:a,"data-testid":r["data-testid"]||"input",...r}));hr.displayName="Input";const ei=J.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...a},n)=>A.jsx(P5,{ref:n,decorative:r,orientation:t,className:Le("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),"data-testid":a["data-testid"]||"separator",...a}));ei.displayName=P5.displayName;const Z_=D5,AO=L5,NO=B5,H_=J.forwardRef(({className:e,...t},r)=>A.jsx(bf,{className:Le("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",e),...t,ref:r}));H_.displayName=bf.displayName;const IO=En("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"}}),pv=J.forwardRef(({side:e="right",className:t,children:r,...a},n)=>A.jsxs(NO,{children:[A.jsx(H_,{}),A.jsxs(vf,{ref:n,className:Le(IO({side:e}),t),...a,children:[A.jsxs(z5,{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:[A.jsx(Fr,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]}),r]})]}));pv.displayName=vf.displayName;const CO=J.forwardRef(({className:e,...t},r)=>A.jsx(yf,{ref:r,className:Le("text-lg font-semibold text-foreground",e),...t}));CO.displayName=yf.displayName;const RO=J.forwardRef(({className:e,...t},r)=>A.jsx(wf,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));RO.displayName=wf.displayName;function wo({className:e,...t}){return A.jsx("div",{className:Le("animate-pulse rounded-md bg-primary/10",e),"data-testid":t["data-testid"]||"skeleton",...t})}i(wo,"Skeleton");const es=uC,cr=fC,dr=cC,lr=J.forwardRef(({className:e,sideOffset:t=4,...r},a)=>A.jsx(dC,{children:A.jsx(U5,{ref:a,sideOffset:t,className:Le("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",e),...r})}));lr.displayName=U5.displayName;const Jc=768;function OO(){const[e,t]=J.useState(void 0);return J.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Jc-1}px)`),a=i(()=>{t(window.innerWidth<Jc)},"onChange");return r.addEventListener("change",a),t(window.innerWidth<Jc),()=>r.removeEventListener("change",a)},[]),!!e}i(OO,"useIsMobile");const TO="sidebar:state",PO=3600*24*7,DO="16rem",LO="18rem",BO="3rem",zO="b",J_=J.createContext(null);function kf(){const e=J.useContext(J_);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}i(kf,"useSidebar");const q_=J.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:r,className:a,style:n,children:s,...o},h)=>{const p=OO(),[v,c]=J.useState(!1),[d,y]=J.useState(e),b=t??d,x=J.useCallback(R=>{const O=typeof R=="function"?R(b):R;r?r(O):y(O),document.cookie=`${TO}=${O}; path=/; max-age=${PO}`},[r,b]),k=J.useCallback(()=>p?c(R=>!R):x(R=>!R),[p,x,c]);J.useEffect(()=>{const R=i(O=>{O.key===zO&&(O.metaKey||O.ctrlKey)&&(O.preventDefault(),k())},"handleKeyDown");return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[k]);const N=b?"expanded":"collapsed",C=J.useMemo(()=>({state:N,open:b,setOpen:x,isMobile:p,openMobile:v,setOpenMobile:c,toggleSidebar:k}),[N,b,x,p,v,c,k]);return A.jsx(J_.Provider,{value:C,children:A.jsx(es,{delayDuration:0,children:A.jsx("div",{style:{"--sidebar-width":DO,"--sidebar-width-icon":BO,...n},className:Le("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-card",a),ref:h,...o,children:s})})})});q_.displayName="SidebarProvider";const K_=J.forwardRef(({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:a,children:n,...s},o)=>{const{isMobile:h,state:p,openMobile:v,setOpenMobile:c}=kf();return r==="none"?A.jsx("div",{className:Le("flex h-full w-[--sidebar-width] flex-col bg-card text-sidebar-foreground",a),ref:o,...s,children:n}):h?A.jsx(Z_,{open:v,onOpenChange:c,...s,children:A.jsx(pv,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-card p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":LO},side:e,children:A.jsx("div",{className:"flex h-full w-full flex-col",children:n})})}):A.jsxs("div",{ref:o,className:"group peer hidden md:block text-sidebar-foreground","data-state":p,"data-collapsible":p==="collapsed"?r:"","data-variant":t,"data-side":e,children:[A.jsx("div",{className:Le("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",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),A.jsx("div",{className:Le("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",e==="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)]",t==="floating"||t==="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",a),...s,children:A.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:n})})]})});K_.displayName="Sidebar";const UO=J.forwardRef(({className:e,onClick:t,...r},a)=>{const{toggleSidebar:n}=kf();return A.jsxs(et,{ref:a,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Le("h-7 w-7",e),onClick:i(s=>{t?.(s),n()},"onClick"),"data-testid":"sidebar-toggle",...r,children:[A.jsx(hC,{}),A.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});UO.displayName="SidebarTrigger";const FO=J.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:a}=kf();return A.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:a,title:"Toggle Sidebar",className:Le("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",e),...t})});FO.displayName="SidebarRail";const X_=J.forwardRef(({className:e,...t},r)=>A.jsx("main",{ref:r,className:Le("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",e),...t}));X_.displayName="SidebarInset";const $O=J.forwardRef(({className:e,...t},r)=>A.jsx(hr,{ref:r,"data-sidebar":"input",className:Le("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));$O.displayName="SidebarInput";const W_=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"header",className:Le("flex flex-col gap-2 p-2",e),...t}));W_.displayName="SidebarHeader";const Q_=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"footer",className:Le("flex flex-col gap-2 p-2",e),...t}));Q_.displayName="SidebarFooter";const GO=J.forwardRef(({className:e,...t},r)=>A.jsx(ei,{ref:r,"data-sidebar":"separator",className:Le("mx-2 w-auto bg-card-border",e),...t}));GO.displayName="SidebarSeparator";const Y_=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"content",className:Le("flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden group-data-[collapsible=icon]:overflow-hidden",e),...t}));Y_.displayName="SidebarContent";const jf=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"group",className:Le("relative flex w-full min-w-0 flex-col p-0.5",e),...t}));jf.displayName="SidebarGroup";const VO=J.forwardRef(({className:e,asChild:t=!1,...r},a)=>{const n=t?ms:"div";return A.jsx(n,{ref:a,"data-sidebar":"group-label",className:Le("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",e),...r})});VO.displayName="SidebarGroupLabel";const ZO=J.forwardRef(({className:e,asChild:t=!1,...r},a)=>{const n=t?ms:"button";return A.jsx(n,{ref:a,"data-sidebar":"group-action",className:Le("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",e),...r})});ZO.displayName="SidebarGroupAction";const Af=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"group-content",className:Le("w-full text-sm p-0 m-0",e),...t}));Af.displayName="SidebarGroupContent";const va=J.forwardRef(({className:e,...t},r)=>A.jsx("ul",{ref:r,"data-sidebar":"menu",className:Le("flex w-full min-w-0 flex-col gap-0.5",e),...t}));va.displayName="SidebarMenu";const ji=J.forwardRef(({className:e,...t},r)=>A.jsx("li",{ref:r,"data-sidebar":"menu-item",className:Le("group/menu-item relative",e),...t}));ji.displayName="SidebarMenuItem";const HO=En("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"}}),Ea=J.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="default",size:a="default",tooltip:n,className:s,...o},h)=>{const p=e?ms:"button",{isMobile:v,state:c}=kf(),d=A.jsx(p,{ref:h,"data-sidebar":"menu-button","data-size":a,"data-active":t,className:Le(HO({variant:r,size:a}),s),...o});return n?(typeof n=="string"&&(n={children:n}),A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:d}),A.jsx(lr,{side:"right",align:"center",hidden:c!=="collapsed"||v,...n})]})):d});Ea.displayName="SidebarMenuButton";const JO=J.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...a},n)=>{const s=t?ms:"button";return A.jsx(s,{ref:n,"data-sidebar":"menu-action",className:Le("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",e),...a})});JO.displayName="SidebarMenuAction";const qO=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:Le("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",e),...t}));qO.displayName="SidebarMenuBadge";const Nf=J.forwardRef(({className:e,showIcon:t=!1,...r},a)=>{const n=J.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return A.jsxs("div",{ref:a,"data-sidebar":"menu-skeleton",className:Le("rounded-md h-8 flex gap-2 px-2 items-center",e),...r,children:[t&&A.jsx(wo,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),A.jsx(wo,{className:"h-4 flex-1 max-w-[--skeleton-width]","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});Nf.displayName="SidebarMenuSkeleton";const KO=J.forwardRef(({className:e,...t},r)=>A.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:Le("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",e),...t}));KO.displayName="SidebarMenuSub";const XO=J.forwardRef(({...e},t)=>A.jsx("li",{ref:t,...e}));XO.displayName="SidebarMenuSubItem";const WO=J.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:a,...n},s)=>{const o=e?ms:"a";return A.jsx(o,{ref:s,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Le("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",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",a),...n})});WO.displayName="SidebarMenuSubButton";const QO=En("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 xi({className:e,variant:t,...r}){return A.jsx("div",{className:Le(QO({variant:t}),e),"data-testid":r["data-testid"]||"badge",...r})}i(xi,"Badge$1");const YO=En("text-sm font-normal text-muted-foreground leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ts=J.forwardRef(({className:e,...t},r)=>A.jsx(F5,{ref:r,className:Le(YO(),e),...t}));ts.displayName=F5.displayName;const eT=i(({tag:e,onRemove:t})=>A.jsxs(xi,{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:[e,A.jsxs(et,{type:"button",variant:"ghost",size:"icon",onClick:i(()=>t(e),"onClick"),className:"hover:bg-accent/20 rounded-full p-0.5 transition-colors h-auto w-auto min-w-0 min-h-0",children:[A.jsx(Fr,{className:"h-3 w-3"}),A.jsxs("span",{className:"sr-only",children:["Remove ",e]})]})]}),"Tag"),tT=i(({tags:e,onRemove:t})=>A.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:e.map(r=>A.jsx(eT,{tag:r,onRemove:t},r))}),"TagList"),rT=i(({value:e,onChange:t,onKeyDown:r,onAdd:a})=>A.jsxs("div",{className:"relative",children:[A.jsx(hr,{value:e,onChange:t,onKeyDown:r,placeholder:"Type and press Enter or click Add...",className:Le("bg-background pr-16",!e&&"text-muted-foreground")}),e.trim()&&A.jsx(et,{size:"sm",onClick:a,className:"absolute top-1/2 -translate-y-1/2 right-2 h-7 px-3",children:"Add"})]}),"TagInput");function iT({title:e,data:t,onChange:r}){const[a,n]=J.useState(""),s=i(()=>{const p=a.trim();p&&!t.includes(p)&&(r([...t,p]),n(""))},"addTag"),o=i(p=>{p.key==="Enter"&&(p.preventDefault(),s())},"handleKeyDown"),h=i(p=>{r(t.filter(v=>v!==p))},"removeTag");return A.jsxs("div",{className:"space-y-2",children:[A.jsx(ts,{children:e}),A.jsxs("div",{className:"p-2 bg-card rounded border border-input",children:[A.jsx(tT,{tags:t,onRemove:h}),A.jsx(rT,{value:a,onChange:i(p=>n(p.target.value),"onChange"),onKeyDown:o,onAdd:s})]})]})}i(iT,"ArrayInput");const mv=$5,If=J.forwardRef(({className:e,...t},r)=>A.jsx(Qg,{ref:r,className:Le("inline-flex items-center bg-transparent border-b border-sidebar-border w-full",e),...t}));If.displayName=Qg.displayName;const xo=J.forwardRef(({className:e,...t},r)=>A.jsx(Yg,{ref:r,className:Le("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",e),...t}));xo.displayName=Yg.displayName;const wi=J.forwardRef(({className:e,...t},r)=>A.jsx(G5,{ref:r,className:Le("text-foreground ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));wi.displayName=G5.displayName;const Wo=J.forwardRef(({className:e,...t},r)=>A.jsx("textarea",{className:Le("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",e),ref:r,"data-testid":t["data-testid"]||"textarea",...t}));Wo.displayName="Textarea";const nT=1,aT=3e3;let qc=0;function sT(){return qc=(qc+1)%Number.MAX_SAFE_INTEGER,qc.toString()}i(sT,"genId");const Kc=new Map,zy=i(e=>{if(Kc.has(e))return;const t=setTimeout(()=>{Kc.delete(e),ho({type:"REMOVE_TOAST",toastId:e})},aT);Kc.set(e,t)},"addToRemoveQueue"),oT=i((e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,nT)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(r=>r.id===t.toast.id?{...r,...t.toast}:r)};case"DISMISS_TOAST":{const{toastId:r}=t;if(r)zy(r);else for(const a of e.toasts)zy(a.id);return{...e,toasts:e.toasts.map(a=>a.id===r||r===void 0?{...a,open:!1}:a)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(r=>r.id!==t.toastId)}}},"reducer"),_u=[];let Su={toasts:[]};function ho(e){Su=oT(Su,e);for(const t of _u)t(Su)}i(ho,"dispatch");function lT({...e}){const t=sT(),r=i(n=>ho({type:"UPDATE_TOAST",toast:{...n,id:t}}),"update"),a=i(()=>ho({type:"DISMISS_TOAST",toastId:t}),"dismiss");return ho({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:i(n=>{n||a()},"onOpenChange")}}),{id:t,dismiss:a,update:r}}i(lT,"toast");function rr(){const[e,t]=J.useState(Su);return J.useEffect(()=>(_u.push(t),()=>{const r=_u.indexOf(t);r>-1&&_u.splice(r,1)}),[]),{...e,toast:lT,dismiss:i(r=>ho({type:"DISMISS_TOAST",toastId:r}),"dismiss")}}i(rr,"useToast");function uT(e){return e.replace(/[^a-zA-Z0-9]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()}i(uT,"sanitizeFilename");function fT(e){const t={id:e.id,name:e.name,username:e.username,system:e.system,templates:e.templates,bio:e.bio,messageExamples:e.messageExamples,postExamples:e.postExamples,topics:e.topics,adjectives:e.adjectives,knowledge:e.knowledge,plugins:e.plugins,settings:e.settings?{...e.settings}:void 0,style:e.style};if(t.settings&&"secrets"in t.settings){const{secrets:r,...a}=t.settings;t.settings=a}return Object.fromEntries(Object.entries(t).filter(([r,a])=>a!=null))}i(fT,"agentToCharacterData");function cT(e){const t=new Date().toISOString().split("T")[0];return`${uT(e||"agent")}-${t}.json`}i(cT,"generateExportFilename");function dT(e,t){const r=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),a=URL.createObjectURL(r),n=document.createElement("a");n.href=a,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(a)}i(dT,"downloadJsonFile");function gv(e,t){try{const r=fT(e),a=cT(e.name);return dT(r,a),t&&t({title:"Character Exported",description:`${e.name}'s character data has been downloaded as ${a}`}),{success:!0,filename:a}}catch(r){return console.error("Failed to export character:",r),t&&t({title:"Export Failed",description:"Failed to export character data. Please try again.",variant:"destructive"}),{success:!1,error:r instanceof Error?r.message:"Unknown error"}}}i(gv,"exportCharacterAsJson");const xn=pC,Xc=gC,_n=mC,Gi=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(V5,{ref:a,className:Le("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",e),...r,children:[t,A.jsx(vC,{asChild:!0,children:A.jsx(Ji,{className:"h-4 w-4 opacity-50"})})]}));Gi.displayName=V5.displayName;const e7=J.forwardRef(({className:e,...t},r)=>A.jsx(K5,{ref:r,className:Le("flex cursor-default items-center justify-center py-1",e),...t,children:A.jsx(X5,{className:"h-4 w-4"})}));e7.displayName=K5.displayName;const t7=J.forwardRef(({className:e,...t},r)=>A.jsx(W5,{ref:r,className:Le("flex cursor-default items-center justify-center py-1",e),...t,children:A.jsx(Ji,{className:"h-4 w-4"})}));t7.displayName=W5.displayName;const Vi=J.forwardRef(({className:e,children:t,position:r="popper",...a},n)=>A.jsx(bC,{children:A.jsxs(Z5,{ref:n,className:Le("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",e),position:r,...a,children:[A.jsx(e7,{}),A.jsx(yC,{className:Le("p-2",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),A.jsx(t7,{})]})}));Vi.displayName=Z5.displayName;const Xm=J.forwardRef(({className:e,...t},r)=>A.jsx(q5,{ref:r,className:Le("px-4 py-2 text-xs font-medium text-muted-foreground uppercase tracking-wider",e),...t}));Xm.displayName=q5.displayName;const Qt=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(H5,{ref:a,className:Le("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",e),...r,children:[A.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:A.jsx(wC,{children:A.jsx(Sn,{className:"h-4 w-4"})})}),A.jsx(xC,{children:t})]}));Qt.displayName=H5.displayName;const Wm=J.forwardRef(({className:e,...t},r)=>A.jsx(J5,{ref:r,className:Le("-mx-1 my-1 h-px bg-muted",e),...t}));Wm.displayName=J5.displayName;const r7={elevenlabs:"@elizaos/plugin-elevenlabs",openai:"@elizaos/plugin-openai",none:""},hT=[{value:"none",label:"No Voice",provider:"none"}],pT=[],vv=[{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"]}],i7=[{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"]}],n7=i(()=>[...hT,...pT,...vv,...i7],"getAllVoiceModels"),Qm=i(e=>n7().find(t=>t.value===e),"getVoiceModelByValue");function mT(){const[e,t]=J.useState(null);return J.useEffect(()=>{const r=localStorage.getItem("ELEVENLABS_API_KEY");t(r)},[]),Ar({queryKey:["elevenlabs-voices",e],queryFn:i(async()=>{if(!e)return[];try{const r=await fetch("https://api.elevenlabs.io/v2/voices",{method:"GET",headers:{"xi-api-key":e}});if(!r.ok)return console.error("Failed to fetch ElevenLabs voices:",r.statusText),[];const a=await r.json(),n=vv.map(h=>h.value);return a.voices.filter(h=>!n.includes(h.voice_id)).map(h=>({value:h.voice_id,label:`ElevenLabs - ${h.name} (Custom)`,provider:"elevenlabs",gender:h.labels?.gender==="female"?"female":"male",language:"en",features:[h.category||"professional",h.labels?.description||"natural"]}))}catch(r){return console.error("Error fetching ElevenLabs voices:",r),[]}},"queryFn"),staleTime:3600*1e3,refetchOnWindowFocus:!1})}i(mT,"useElevenLabsVoices");function _o({...e}){return A.jsx(_C,{"data-slot":"dropdown-menu",...e})}i(_o,"DropdownMenu");function So({...e}){return A.jsx(SC,{"data-slot":"dropdown-menu-trigger",...e})}i(So,"DropdownMenuTrigger");function Mo({className:e,sideOffset:t=4,onPointerDown:r,onPointerDownOutside:a,onCloseAutoFocus:n,...s}){const o=J.useRef(!1),h=J.useCallback(c=>{o.current=!0,r?.(c)},[r]),p=J.useCallback(c=>{o.current=!0,a?.(c)},[a]),v=J.useCallback(c=>{if(n)return n(c);o.current&&(c.preventDefault(),o.current=!1)},[n]);return A.jsx(MC,{children:A.jsx(EC,{"data-slot":"dropdown-menu-content",sideOffset:t,className:Le("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",e),onPointerDown:h,onPointerDownOutside:p,onCloseAutoFocus:v,...s})})}i(Mo,"DropdownMenuContent");function Fi({className:e,inset:t,variant:r="default",...a}){return A.jsx(kC,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:Le("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",e),...a})}i(Fi,"DropdownMenuItem");function gT({className:e,inset:t,...r}){return A.jsx(AC,{"data-slot":"dropdown-menu-label","data-inset":t,className:Le("text-muted-foreground px-2 py-1.5 text-xs font-medium data-[inset]:pl-8",e),...r})}i(gT,"DropdownMenuLabel");function Uu({className:e,...t}){return A.jsx(jC,{"data-slot":"dropdown-menu-separator",className:Le("bg-border -mx-1 my-1 h-px",e),...t})}i(Uu,"DropdownMenuSeparator");const a7=[{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 s7(e){return a7.find(t=>t.id===e)}i(s7,"getTemplateById");const bv=NC,vT=IC,o7=J.forwardRef(({className:e,...t},r)=>A.jsx(i_,{className:Le("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",e),...t,ref:r}));o7.displayName=i_.displayName;const Cf=J.forwardRef(({className:e,...t},r)=>A.jsxs(vT,{children:[A.jsx(o7,{}),A.jsx(Q5,{ref:r,className:Le("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",e),...t})]}));Cf.displayName=Q5.displayName;const Rf=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col space-y-2 text-center sm:text-left",e),...t}),"AlertDialogHeader");Rf.displayName="AlertDialogHeader";const Of=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t}),"AlertDialogFooter");Of.displayName="AlertDialogFooter";const Tf=J.forwardRef(({className:e,...t},r)=>A.jsx(Y5,{ref:r,className:Le("text-lg font-semibold",e),...t}));Tf.displayName=Y5.displayName;const Pf=J.forwardRef(({className:e,...t},r)=>A.jsx(e_,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));Pf.displayName=e_.displayName;const Df=J.forwardRef(({className:e,...t},r)=>A.jsx(r_,{ref:r,className:Le(hv(),e),...t}));Df.displayName=r_.displayName;const Lf=J.forwardRef(({className:e,...t},r)=>A.jsx(t_,{ref:r,className:Le(hv({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Lf.displayName=t_.displayName;function bT({open:e,onOpenChange:t,missingSecrets:r,onConfirm:a,onCancel:n}){return A.jsx(bv,{open:e,onOpenChange:t,children:A.jsxs(Cf,{children:[A.jsxs(Rf,{children:[A.jsxs(Tf,{className:"flex items-center gap-2",children:[A.jsx(fi,{className:"h-5 w-5 text-yellow-500"}),"Missing Required Configuration"]}),A.jsxs(Pf,{className:"space-y-3",children:[A.jsx("p",{children:"The following required secrets are missing or empty. Your agent may not function properly without these values."}),A.jsx("div",{className:"bg-muted rounded-md p-3 space-y-2",children:r.map(s=>A.jsxs("div",{className:"text-sm",children:[A.jsx("code",{className:"font-mono font-semibold",children:s.name}),s.plugin&&A.jsxs("span",{className:"text-muted-foreground ml-2",children:["(required by ",s.plugin,")"]}),s.description&&A.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:s.description})]},s.name))}),A.jsx("p",{className:"text-sm",children:"Do you want to save anyway?"})]})]}),A.jsxs(Of,{children:[A.jsx(Lf,{onClick:n,children:"Go Back"}),A.jsx(Df,{onClick:a,className:"bg-yellow-600 hover:bg-yellow-700",children:"Save Anyway"})]})]})})}i(bT,"MissingSecretsDialog");var It={},jl={exports:{}},Al={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Uy;function At(){return Uy||(Uy=1,(function(e,t){var r=Vn(),a=r.Buffer;function n(o,h){for(var p in o)h[p]=o[p]}i(n,"copyProps"),a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s);function s(o,h,p){return a(o,h,p)}i(s,"SafeBuffer"),s.prototype=Object.create(a.prototype),n(a,s),s.from=function(o,h,p){if(typeof o=="number")throw new TypeError("Argument must not be a number");return a(o,h,p)},s.alloc=function(o,h,p){if(typeof o!="number")throw new TypeError("Argument must be a number");var v=a(o);return h!==void 0?typeof p=="string"?v.fill(h,p):v.fill(h):v.fill(0),v},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return a(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(Al,Al.exports)),Al.exports}i(At,"requireSafeBuffer$2");var Fy;function ys(){if(Fy)return jl.exports;Fy=1;var e=65536,t=4294967295;function r(){throw new Error(`Secure random number generation is not supported by this browser.
2
2
  Use Chrome, Firefox or Internet Explorer 11`)}i(r,"oldBrowser");var a=At().Buffer,n=globalThis.crypto||globalThis.msCrypto;n&&n.getRandomValues?jl.exports=s:jl.exports=r;function s(o,h){if(o>t)throw new RangeError("requested too many random bytes");var p=a.allocUnsafe(o);if(o>0)if(o>e)for(var v=0;v<o;v+=e)n.getRandomValues(p.slice(v,v+e));else n.getRandomValues(p);return typeof h=="function"?process.nextTick(function(){h(null,p)}):p}return i(s,"randomBytes"),jl.exports}i(ys,"requireBrowser$b");var Nl={exports:{}},$y;function Lt(){return $y||($y=1,typeof Object.create=="function"?Nl.exports=i(function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"):Nl.exports=i(function(t,r){if(r){t.super_=r;var a=i(function(){},"TempCtor");a.prototype=r.prototype,t.prototype=new a,t.prototype.constructor=t}},"inherits")),Nl.exports}i(Lt,"requireInherits_browser");const yT={},wT=Object.freeze(Object.defineProperty({__proto__:null,default:yT},Symbol.toStringTag,{value:"Module"})),Ai=CC(wT);var Wc,Gy;function xT(){if(Gy)return Wc;Gy=1;var e=At().Buffer,t=Ai.Transform,r=Lt();function a(h){t.call(this),this._block=e.allocUnsafe(h),this._blockSize=h,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}i(a,"HashBase"),r(a,t),a.prototype._transform=function(h,p,v){var c=null;try{this.update(h,p)}catch(d){c=d}v(c)},a.prototype._flush=function(h){var p=null;try{this.push(this.digest())}catch(v){p=v}h(p)};var n=typeof Uint8Array<"u",s=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(e.prototype instanceof Uint8Array||e.TYPED_ARRAY_SUPPORT);function o(h,p){if(h instanceof e)return h;if(typeof h=="string")return e.from(h,p);if(s&&ArrayBuffer.isView(h)){if(h.byteLength===0)return e.alloc(0);var v=e.from(h.buffer,h.byteOffset,h.byteLength);if(v.byteLength===h.byteLength)return v}if(n&&h instanceof Uint8Array||e.isBuffer(h)&&h.constructor&&typeof h.constructor.isBuffer=="function"&&h.constructor.isBuffer(h))return e.from(h);throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')}return i(o,"toBuffer"),a.prototype.update=function(h,p){if(this._finalized)throw new Error("Digest already called");h=o(h,p);for(var v=this._block,c=0;this._blockOffset+h.length-c>=this._blockSize;){for(var d=this._blockOffset;d<this._blockSize;)v[d++]=h[c++];this._update(),this._blockOffset=0}for(;c<h.length;)v[this._blockOffset++]=h[c++];for(var y=0,b=h.length*8;b>0;++y)this._length[y]+=b,b=this._length[y]/4294967296|0,b>0&&(this._length[y]-=4294967296*b);return this},a.prototype._update=function(){throw new Error("_update is not implemented")},a.prototype.digest=function(h){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var p=this._digest();h!==void 0&&(p=p.toString(h)),this._block.fill(0),this._blockOffset=0;for(var v=0;v<4;++v)this._length[v]=0;return p},a.prototype._digest=function(){throw new Error("_digest is not implemented")},Wc=a,Wc}i(xT,"requireHashBase$1");var Qc,Vy;function yv(){if(Vy)return Qc;Vy=1;var e=Lt(),t=xT(),r=At().Buffer,a=new Array(16);function n(){t.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}i(n,"MD5"),e(n,t),n.prototype._update=function(){for(var c=a,d=0;d<16;++d)c[d]=this._block.readInt32LE(d*4);var y=this._a,b=this._b,x=this._c,k=this._d;y=o(y,b,x,k,c[0],3614090360,7),k=o(k,y,b,x,c[1],3905402710,12),x=o(x,k,y,b,c[2],606105819,17),b=o(b,x,k,y,c[3],3250441966,22),y=o(y,b,x,k,c[4],4118548399,7),k=o(k,y,b,x,c[5],1200080426,12),x=o(x,k,y,b,c[6],2821735955,17),b=o(b,x,k,y,c[7],4249261313,22),y=o(y,b,x,k,c[8],1770035416,7),k=o(k,y,b,x,c[9],2336552879,12),x=o(x,k,y,b,c[10],4294925233,17),b=o(b,x,k,y,c[11],2304563134,22),y=o(y,b,x,k,c[12],1804603682,7),k=o(k,y,b,x,c[13],4254626195,12),x=o(x,k,y,b,c[14],2792965006,17),b=o(b,x,k,y,c[15],1236535329,22),y=h(y,b,x,k,c[1],4129170786,5),k=h(k,y,b,x,c[6],3225465664,9),x=h(x,k,y,b,c[11],643717713,14),b=h(b,x,k,y,c[0],3921069994,20),y=h(y,b,x,k,c[5],3593408605,5),k=h(k,y,b,x,c[10],38016083,9),x=h(x,k,y,b,c[15],3634488961,14),b=h(b,x,k,y,c[4],3889429448,20),y=h(y,b,x,k,c[9],568446438,5),k=h(k,y,b,x,c[14],3275163606,9),x=h(x,k,y,b,c[3],4107603335,14),b=h(b,x,k,y,c[8],1163531501,20),y=h(y,b,x,k,c[13],2850285829,5),k=h(k,y,b,x,c[2],4243563512,9),x=h(x,k,y,b,c[7],1735328473,14),b=h(b,x,k,y,c[12],2368359562,20),y=p(y,b,x,k,c[5],4294588738,4),k=p(k,y,b,x,c[8],2272392833,11),x=p(x,k,y,b,c[11],1839030562,16),b=p(b,x,k,y,c[14],4259657740,23),y=p(y,b,x,k,c[1],2763975236,4),k=p(k,y,b,x,c[4],1272893353,11),x=p(x,k,y,b,c[7],4139469664,16),b=p(b,x,k,y,c[10],3200236656,23),y=p(y,b,x,k,c[13],681279174,4),k=p(k,y,b,x,c[0],3936430074,11),x=p(x,k,y,b,c[3],3572445317,16),b=p(b,x,k,y,c[6],76029189,23),y=p(y,b,x,k,c[9],3654602809,4),k=p(k,y,b,x,c[12],3873151461,11),x=p(x,k,y,b,c[15],530742520,16),b=p(b,x,k,y,c[2],3299628645,23),y=v(y,b,x,k,c[0],4096336452,6),k=v(k,y,b,x,c[7],1126891415,10),x=v(x,k,y,b,c[14],2878612391,15),b=v(b,x,k,y,c[5],4237533241,21),y=v(y,b,x,k,c[12],1700485571,6),k=v(k,y,b,x,c[3],2399980690,10),x=v(x,k,y,b,c[10],4293915773,15),b=v(b,x,k,y,c[1],2240044497,21),y=v(y,b,x,k,c[8],1873313359,6),k=v(k,y,b,x,c[15],4264355552,10),x=v(x,k,y,b,c[6],2734768916,15),b=v(b,x,k,y,c[13],1309151649,21),y=v(y,b,x,k,c[4],4149444226,6),k=v(k,y,b,x,c[11],3174756917,10),x=v(x,k,y,b,c[2],718787259,15),b=v(b,x,k,y,c[9],3951481745,21),this._a=this._a+y|0,this._b=this._b+b|0,this._c=this._c+x|0,this._d=this._d+k|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 c=r.allocUnsafe(16);return c.writeInt32LE(this._a,0),c.writeInt32LE(this._b,4),c.writeInt32LE(this._c,8),c.writeInt32LE(this._d,12),c};function s(c,d){return c<<d|c>>>32-d}i(s,"rotl");function o(c,d,y,b,x,k,N){return s(c+(d&y|~d&b)+x+k|0,N)+d|0}i(o,"fnF");function h(c,d,y,b,x,k,N){return s(c+(d&b|y&~b)+x+k|0,N)+d|0}i(h,"fnG");function p(c,d,y,b,x,k,N){return s(c+(d^y^b)+x+k|0,N)+d|0}i(p,"fnH");function v(c,d,y,b,x,k,N){return s(c+(y^(d|~b))+x+k|0,N)+d|0}return i(v,"fnI"),Qc=n,Qc}i(yv,"requireMd5_js");var Yc,Zy;function _T(){if(Zy)return Yc;Zy=1;var e={}.toString;return Yc=Array.isArray||function(t){return e.call(t)=="[object Array]"},Yc}i(_T,"requireIsarray$1");var ed,Hy;function Qo(){return Hy||(Hy=1,ed=TypeError),ed}i(Qo,"requireType");var td,Jy;function l7(){return Jy||(Jy=1,td=Object),td}i(l7,"requireEsObjectAtoms");var rd,qy;function ST(){return qy||(qy=1,rd=Error),rd}i(ST,"requireEsErrors");var id,Ky;function MT(){return Ky||(Ky=1,id=EvalError),id}i(MT,"require_eval");var nd,Xy;function ET(){return Xy||(Xy=1,nd=RangeError),nd}i(ET,"requireRange$1");var ad,Wy;function kT(){return Wy||(Wy=1,ad=ReferenceError),ad}i(kT,"requireRef");var sd,Qy;function u7(){return Qy||(Qy=1,sd=SyntaxError),sd}i(u7,"requireSyntax");var od,Yy;function jT(){return Yy||(Yy=1,od=URIError),od}i(jT,"requireUri");var ld,e2;function AT(){return e2||(e2=1,ld=Math.abs),ld}i(AT,"requireAbs");var ud,t2;function NT(){return t2||(t2=1,ud=Math.floor),ud}i(NT,"requireFloor");var fd,r2;function IT(){return r2||(r2=1,fd=Math.max),fd}i(IT,"requireMax");var cd,i2;function CT(){return i2||(i2=1,cd=Math.min),cd}i(CT,"requireMin");var dd,n2;function RT(){return n2||(n2=1,dd=Math.pow),dd}i(RT,"requirePow");var hd,a2;function OT(){return a2||(a2=1,hd=Math.round),hd}i(OT,"requireRound");var pd,s2;function TT(){return s2||(s2=1,pd=Number.isNaN||i(function(t){return t!==t},"isNaN")),pd}i(TT,"require_isNaN");var md,o2;function PT(){if(o2)return md;o2=1;var e=TT();return md=i(function(r){return e(r)||r===0?r:r<0?-1:1},"sign"),md}i(PT,"requireSign$1");var gd,l2;function DT(){return l2||(l2=1,gd=Object.getOwnPropertyDescriptor),gd}i(DT,"requireGOPD");var vd,u2;function Yo(){if(u2)return vd;u2=1;var e=DT();if(e)try{e([],"length")}catch{e=null}return vd=e,vd}i(Yo,"requireGopd");var bd,f2;function Bf(){if(f2)return bd;f2=1;var e=Object.defineProperty||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return bd=e,bd}i(Bf,"requireEsDefineProperty");var yd,c2;function f7(){return c2||(c2=1,yd=i(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},r=Symbol("test"),a=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var n=42;t[r]=n;for(var s in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==r||!Object.prototype.propertyIsEnumerable.call(t,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,r);if(h.value!==n||h.enumerable!==!0)return!1}return!0},"hasSymbols")),yd}i(f7,"requireShams$1");var wd,d2;function LT(){if(d2)return wd;d2=1;var e=typeof Symbol<"u"&&Symbol,t=f7();return wd=i(function(){return typeof e!="function"||typeof Symbol!="function"||typeof e("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:t()},"hasNativeSymbols"),wd}i(LT,"requireHasSymbols");var xd,h2;function c7(){return h2||(h2=1,xd=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),xd}i(c7,"requireReflect_getPrototypeOf");var _d,p2;function d7(){if(p2)return _d;p2=1;var e=l7();return _d=e.getPrototypeOf||null,_d}i(d7,"requireObject_getPrototypeOf");var Sd,m2;function BT(){if(m2)return Sd;m2=1;var e="Function.prototype.bind called on incompatible ",t=Object.prototype.toString,r=Math.max,a="[object Function]",n=i(function(p,v){for(var c=[],d=0;d<p.length;d+=1)c[d]=p[d];for(var y=0;y<v.length;y+=1)c[y+p.length]=v[y];return c},"concatty"),s=i(function(p,v){for(var c=[],d=v,y=0;d<p.length;d+=1,y+=1)c[y]=p[d];return c},"slicy"),o=i(function(h,p){for(var v="",c=0;c<h.length;c+=1)v+=h[c],c+1<h.length&&(v+=p);return v},"joiny");return Sd=i(function(p){var v=this;if(typeof v!="function"||t.apply(v)!==a)throw new TypeError(e+v);for(var c=s(arguments,1),d,y=i(function(){if(this instanceof d){var C=v.apply(this,n(c,arguments));return Object(C)===C?C:this}return v.apply(p,n(c,arguments))},"binder"),b=r(0,v.length-c.length),x=[],k=0;k<b;k++)x[k]="$"+k;if(d=Function("binder","return function ("+o(x,",")+"){ return binder.apply(this,arguments); }")(y),v.prototype){var N=i(function(){},"Empty");N.prototype=v.prototype,d.prototype=new N,N.prototype=null}return d},"bind"),Sd}i(BT,"requireImplementation");var Md,g2;function el(){if(g2)return Md;g2=1;var e=BT();return Md=Function.prototype.bind||e,Md}i(el,"requireFunctionBind");var Ed,v2;function wv(){return v2||(v2=1,Ed=Function.prototype.call),Ed}i(wv,"requireFunctionCall");var kd,b2;function xv(){return b2||(b2=1,kd=Function.prototype.apply),kd}i(xv,"requireFunctionApply");var jd,y2;function zT(){return y2||(y2=1,jd=typeof Reflect<"u"&&Reflect&&Reflect.apply),jd}i(zT,"requireReflectApply");var Ad,w2;function h7(){if(w2)return Ad;w2=1;var e=el(),t=xv(),r=wv(),a=zT();return Ad=a||e.call(r,t),Ad}i(h7,"requireActualApply");var Nd,x2;function _v(){if(x2)return Nd;x2=1;var e=el(),t=Qo(),r=wv(),a=h7();return Nd=i(function(s){if(s.length<1||typeof s[0]!="function")throw new t("a function is required");return a(e,r,s)},"callBindBasic"),Nd}i(_v,"requireCallBindApplyHelpers");var Id,_2;function UT(){if(_2)return Id;_2=1;var e=_v(),t=Yo(),r;try{r=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var a=!!r&&t&&t(Object.prototype,"__proto__"),n=Object,s=n.getPrototypeOf;return Id=a&&typeof a.get=="function"?e([a.get]):typeof s=="function"?i(function(h){return s(h==null?h:n(h))},"getDunder"):!1,Id}i(UT,"requireGet");var Cd,S2;function p7(){if(S2)return Cd;S2=1;var e=c7(),t=d7(),r=UT();return Cd=e?i(function(n){return e(n)},"getProto"):t?i(function(n){if(!n||typeof n!="object"&&typeof n!="function")throw new TypeError("getProto: not an object");return t(n)},"getProto"):r?i(function(n){return r(n)},"getProto"):null,Cd}i(p7,"requireGetProto");var Rd,M2;function FT(){if(M2)return Rd;M2=1;const e=async function(){}.constructor;return Rd=i(()=>e,"asyncFunction"),Rd}i(FT,"requireAsyncFunction");var Od,E2;function $T(){if(E2)return Od;E2=1;const e=function*(){}.constructor;return Od=i(()=>e,"generatorFunction"),Od}i($T,"requireGeneratorFunction");var Td,k2;function GT(){if(k2)return Td;k2=1;const e=async function*(){}.constructor;return Td=i(()=>e,"asyncGeneratorFunction"),Td}i(GT,"requireAsyncGeneratorFunction");var Pd,j2;function VT(){if(j2)return Pd;j2=1;var e=Function.prototype.call,t=Object.prototype.hasOwnProperty,r=el();return Pd=r.call(e,t),Pd}i(VT,"requireHasown");var Dd,A2;function m7(){if(A2)return Dd;A2=1;var e,t=l7(),r=ST(),a=MT(),n=ET(),s=kT(),o=u7(),h=Qo(),p=jT(),v=AT(),c=NT(),d=IT(),y=CT(),b=RT(),x=OT(),k=PT(),N=Yo(),C=Bf(),R=i(function(){throw new h},"throwTypeError"),O=N?(function(){try{return arguments.callee,R}catch{try{return N(arguments,"callee").get}catch{return R}}})():R,T=LT()(),P=p7(),z=d7(),Z=c7(),V=xv(),ee=wv(),$={},F=typeof Uint8Array>"u"||!P?e:P(Uint8Array),u={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?e:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?e:ArrayBuffer,"%ArrayIteratorPrototype%":T&&P?P([][Symbol.iterator]()):e,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":$,"%AsyncGenerator%":$,"%AsyncGeneratorFunction%":$,"%AsyncIteratorPrototype%":$,"%Atomics%":typeof Atomics>"u"?e:Atomics,"%BigInt%":typeof BigInt>"u"?e:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?e:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?e:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?e:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":r,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>"u"?e:Float16Array,"%Float32Array%":typeof Float32Array>"u"?e:Float32Array,"%Float64Array%":typeof Float64Array>"u"?e:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?e:FinalizationRegistry,"%Function%":Function,"%GeneratorFunction%":$,"%Int8Array%":typeof Int8Array>"u"?e:Int8Array,"%Int16Array%":typeof Int16Array>"u"?e:Int16Array,"%Int32Array%":typeof Int32Array>"u"?e:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":T&&P?P(P([][Symbol.iterator]())):e,"%JSON%":typeof JSON=="object"?JSON:e,"%Map%":typeof Map>"u"?e:Map,"%MapIteratorPrototype%":typeof Map>"u"||!T||!P?e:P(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":t,"%Object.getOwnPropertyDescriptor%":N,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?e:Promise,"%Proxy%":typeof Proxy>"u"?e:Proxy,"%RangeError%":n,"%ReferenceError%":s,"%Reflect%":typeof Reflect>"u"?e:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?e:Set,"%SetIteratorPrototype%":typeof Set>"u"||!T||!P?e:P(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?e:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":T&&P?P(""[Symbol.iterator]()):e,"%Symbol%":T?Symbol:e,"%SyntaxError%":o,"%ThrowTypeError%":O,"%TypedArray%":F,"%TypeError%":h,"%Uint8Array%":typeof Uint8Array>"u"?e:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?e:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?e:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?e:Uint32Array,"%URIError%":p,"%WeakMap%":typeof WeakMap>"u"?e:WeakMap,"%WeakRef%":typeof WeakRef>"u"?e:WeakRef,"%WeakSet%":typeof WeakSet>"u"?e:WeakSet,"%Function.prototype.call%":ee,"%Function.prototype.apply%":V,"%Object.defineProperty%":C,"%Object.getPrototypeOf%":z,"%Math.abs%":v,"%Math.floor%":c,"%Math.max%":d,"%Math.min%":y,"%Math.pow%":b,"%Math.round%":x,"%Math.sign%":k,"%Reflect.getPrototypeOf%":Z};if(P)try{null.error}catch(K){var g=P(P(K));u["%Error.prototype%"]=g}var l=FT(),m=$T(),w=GT(),M=i(function K(_e){var se;if(_e==="%AsyncFunction%")se=l()||void 0;else if(_e==="%GeneratorFunction%")se=m()||void 0;else if(_e==="%AsyncGeneratorFunction%")se=w()||void 0;else if(_e==="%AsyncGenerator%"){var ae=K("%AsyncGeneratorFunction%");ae&&(se=ae.prototype)}else if(_e==="%AsyncIteratorPrototype%"){var ve=K("%AsyncGenerator%");ve&&P&&(se=P(ve.prototype))}return u[_e]=se,se},"doEval"),j={__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"]},S=el(),f=VT(),_=S.call(ee,Array.prototype.concat),E=S.call(V,Array.prototype.splice),I=S.call(ee,String.prototype.replace),D=S.call(ee,String.prototype.slice),L=S.call(ee,RegExp.prototype.exec),U=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,B=/\\(\\)?/g,G=i(function(_e){var se=D(_e,0,1),ae=D(_e,-1);if(se==="%"&&ae!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(ae==="%"&&se!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var ve=[];return I(_e,U,function(q,ne,X,W){ve[ve.length]=X?I(W,B,"$1"):ne||q}),ve},"stringToPath"),H=i(function(_e,se){var ae=_e,ve;if(f(j,ae)&&(ve=j[ae],ae="%"+ve[0]+"%"),f(u,ae)){var q=u[ae];if(q===$&&(q=M(ae)),typeof q>"u"&&!se)throw new h("intrinsic "+_e+" exists, but is not available. Please file an issue!");return{alias:ve,name:ae,value:q}}throw new o("intrinsic "+_e+" does not exist!")},"getBaseIntrinsic");return Dd=i(function(_e,se){if(typeof _e!="string"||_e.length===0)throw new h("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof se!="boolean")throw new h('"allowMissing" argument must be a boolean');if(L(/^%?[^%]*%?$/,_e)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var ae=G(_e),ve=ae.length>0?ae[0]:"",q=H("%"+ve+"%",se),ne=q.name,X=q.value,W=!1,le=q.alias;le&&(ve=le[0],E(ae,_([0,1],le)));for(var ke=1,be=!0;ke<ae.length;ke+=1){var fe=ae[ke],Q=D(fe,0,1),Y=D(fe,-1);if((Q==='"'||Q==="'"||Q==="`"||Y==='"'||Y==="'"||Y==="`")&&Q!==Y)throw new o("property names with quotes must have matching quotes");if((fe==="constructor"||!be)&&(W=!0),ve+="."+fe,ne="%"+ve+"%",f(u,ne))X=u[ne];else if(X!=null){if(!(fe in X)){if(!se)throw new h("base intrinsic for "+_e+" exists, but the property is not available.");return}if(N&&ke+1>=ae.length){var te=N(X,fe);be=!!te,be&&"get"in te&&!("originalValue"in te.get)?X=te.get:X=X[fe]}else be=f(X,fe),X=X[fe];be&&!W&&(u[ne]=X)}}return X},"GetIntrinsic"),Dd}i(m7,"requireGetIntrinsic");var Ld,N2;function g7(){if(N2)return Ld;N2=1;var e=m7(),t=_v(),r=t([e("%String.prototype.indexOf%")]);return Ld=i(function(n,s){var o=e(n,!!s);return typeof o=="function"&&r(n,".prototype.")>-1?t([o]):o},"callBoundIntrinsic"),Ld}i(g7,"requireCallBound");var Bd,I2;function ZT(){if(I2)return Bd;I2=1;var e=Function.prototype.toString,t=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,r,a;if(typeof t=="function"&&typeof Object.defineProperty=="function")try{r=Object.defineProperty({},"length",{get:i(function(){throw a},"get")}),a={},t(function(){throw 42},null,r)}catch(R){R!==a&&(t=null)}else t=null;var n=/^\s*class\b/,s=i(function(O){try{var T=e.call(O);return n.test(T)}catch{return!1}},"isES6ClassFunction"),o=i(function(O){try{return s(O)?!1:(e.call(O),!0)}catch{return!1}},"tryFunctionToStr"),h=Object.prototype.toString,p="[object Object]",v="[object Function]",c="[object GeneratorFunction]",d="[object HTMLAllCollection]",y="[object HTML document.all class]",b="[object HTMLCollection]",x=typeof Symbol=="function"&&!!Symbol.toStringTag,k=!(0 in[,]),N=i(function(){return!1},"isDocumentDotAll");if(typeof document=="object"){var C=document.all;h.call(C)===h.call(document.all)&&(N=i(function(O){if((k||!O)&&(typeof O>"u"||typeof O=="object"))try{var T=h.call(O);return(T===d||T===y||T===b||T===p)&&O("")==null}catch{}return!1},"isDocumentDotAll2"))}return Bd=t?i(function(O){if(N(O))return!0;if(!O||typeof O!="function"&&typeof O!="object")return!1;try{t(O,null,r)}catch(T){if(T!==a)return!1}return!s(O)&&o(O)},"isCallable"):i(function(O){if(N(O))return!0;if(!O||typeof O!="function"&&typeof O!="object")return!1;if(x)return o(O);if(s(O))return!1;var T=h.call(O);return T!==v&&T!==c&&!/^\[object HTML/.test(T)?!1:o(O)},"isCallable2"),Bd}i(ZT,"requireIsCallable");var zd,C2;function HT(){if(C2)return zd;C2=1;var e=ZT(),t=Object.prototype.toString,r=Object.prototype.hasOwnProperty,a=i(function(p,v,c){for(var d=0,y=p.length;d<y;d++)r.call(p,d)&&(c==null?v(p[d],d,p):v.call(c,p[d],d,p))},"forEachArray"),n=i(function(p,v,c){for(var d=0,y=p.length;d<y;d++)c==null?v(p.charAt(d),d,p):v.call(c,p.charAt(d),d,p)},"forEachString"),s=i(function(p,v,c){for(var d in p)r.call(p,d)&&(c==null?v(p[d],d,p):v.call(c,p[d],d,p))},"forEachObject");function o(h){return t.call(h)==="[object Array]"}return i(o,"isArray"),zd=i(function(p,v,c){if(!e(v))throw new TypeError("iterator must be a function");var d;arguments.length>=3&&(d=c),o(p)?a(p,v,d):typeof p=="string"?n(p,v,d):s(p,v,d)},"forEach"),zd}i(HT,"requireForEach");var Ud,R2;function JT(){return R2||(R2=1,Ud=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),Ud}i(JT,"requirePossibleTypedArrayNames");var Fd,O2;function qT(){if(O2)return Fd;O2=1;var e=JT(),t=globalThis;return Fd=i(function(){for(var a=[],n=0;n<e.length;n++)typeof t[e[n]]=="function"&&(a[a.length]=e[n]);return a},"availableTypedArrays"),Fd}i(qT,"requireAvailableTypedArrays");var $d={exports:{}},Gd,T2;function KT(){if(T2)return Gd;T2=1;var e=Bf(),t=u7(),r=Qo(),a=Yo();return Gd=i(function(s,o,h){if(!s||typeof s!="object"&&typeof s!="function")throw new r("`obj` must be an object or a function`");if(typeof o!="string"&&typeof o!="symbol")throw new r("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new r("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new r("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new r("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new r("`loose`, if provided, must be a boolean");var p=arguments.length>3?arguments[3]:null,v=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,d=arguments.length>6?arguments[6]:!1,y=!!a&&a(s,o);if(e)e(s,o,{configurable:c===null&&y?y.configurable:!c,enumerable:p===null&&y?y.enumerable:!p,value:h,writable:v===null&&y?y.writable:!v});else if(d||!p&&!v&&!c)s[o]=h;else throw new t("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty"),Gd}i(KT,"requireDefineDataProperty");var Vd,P2;function XT(){if(P2)return Vd;P2=1;var e=Bf(),t=i(function(){return!!e},"hasPropertyDescriptors");return t.hasArrayLengthDefineBug=i(function(){if(!e)return null;try{return e([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug"),Vd=t,Vd}i(XT,"requireHasPropertyDescriptors");var Zd,D2;function WT(){if(D2)return Zd;D2=1;var e=m7(),t=KT(),r=XT()(),a=Yo(),n=Qo(),s=e("%Math.floor%");return Zd=i(function(h,p){if(typeof h!="function")throw new n("`fn` is not a function");if(typeof p!="number"||p<0||p>4294967295||s(p)!==p)throw new n("`length` must be a positive 32-bit integer");var v=arguments.length>2&&!!arguments[2],c=!0,d=!0;if("length"in h&&a){var y=a(h,"length");y&&!y.configurable&&(c=!1),y&&!y.writable&&(d=!1)}return(c||d||!v)&&(r?t(h,"length",p,!0,!0):t(h,"length",p)),h},"setFunctionLength"),Zd}i(WT,"requireSetFunctionLength");var Hd,L2;function QT(){if(L2)return Hd;L2=1;var e=el(),t=xv(),r=h7();return Hd=i(function(){return r(e,t,arguments)},"applyBind"),Hd}i(QT,"requireApplyBind");var B2;function YT(){return B2||(B2=1,(function(e){var t=WT(),r=Bf(),a=_v(),n=QT();e.exports=i(function(o){var h=a(arguments),p=o.length-(arguments.length-1);return t(h,1+(p>0?p:0),!0)},"callBind"),r?r(e.exports,"apply",{value:n}):e.exports.apply=n})($d)),$d.exports}i(YT,"requireCallBind");var Jd,z2;function eP(){if(z2)return Jd;z2=1;var e=f7();return Jd=i(function(){return e()&&!!Symbol.toStringTag},"hasToStringTagShams"),Jd}i(eP,"requireShams");var qd,U2;function tP(){if(U2)return qd;U2=1;var e=HT(),t=qT(),r=YT(),a=g7(),n=Yo(),s=p7(),o=a("Object.prototype.toString"),h=eP()(),p=globalThis,v=t(),c=a("String.prototype.slice"),d=a("Array.prototype.indexOf",!0)||i(function(N,C){for(var R=0;R<N.length;R+=1)if(N[R]===C)return R;return-1},"indexOf"),y={__proto__:null};h&&n&&s?e(v,function(k){var N=new p[k];if(Symbol.toStringTag in N&&s){var C=s(N),R=n(C,Symbol.toStringTag);if(!R&&C){var O=s(C);R=n(O,Symbol.toStringTag)}y["$"+k]=r(R.get)}}):e(v,function(k){var N=new p[k],C=N.slice||N.set;C&&(y["$"+k]=r(C))});var b=i(function(N){var C=!1;return e(y,function(R,O){if(!C)try{"$"+R(N)===O&&(C=c(O,1))}catch{}}),C},"tryAllTypedArrays"),x=i(function(N){var C=!1;return e(y,function(R,O){if(!C)try{R(N),C=c(O,1)}catch{}}),C},"tryAllSlices");return qd=i(function(N){if(!N||typeof N!="object")return!1;if(!h){var C=c(o(N),8,-1);return d(v,C)>-1?C:C!=="Object"?!1:x(N)}return n?b(N):null},"whichTypedArray"),qd}i(tP,"requireWhichTypedArray");var Kd,F2;function rP(){if(F2)return Kd;F2=1;var e=tP();return Kd=i(function(r){return!!e(r)},"isTypedArray"),Kd}i(rP,"requireIsTypedArray");var Xd,$2;function iP(){if($2)return Xd;$2=1;var e=Qo(),t=g7(),r=t("TypedArray.prototype.buffer",!0),a=rP();return Xd=r||i(function(s){if(!a(s))throw new e("Not a Typed Array");return s.buffer},"typedArrayBuffer"),Xd}i(iP,"requireTypedArrayBuffer");var Wd,G2;function zf(){if(G2)return Wd;G2=1;var e=At().Buffer,t=_T(),r=iP(),a=ArrayBuffer.isView||i(function(p){try{return r(p),!0}catch{return!1}},"isView"),n=typeof Uint8Array<"u",s=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o=s&&(e.prototype instanceof Uint8Array||e.TYPED_ARRAY_SUPPORT);return Wd=i(function(p,v){if(e.isBuffer(p))return p.constructor&&!("isBuffer"in p)?e.from(p):p;if(typeof p=="string")return e.from(p,v);if(s&&a(p)){if(p.byteLength===0)return e.alloc(0);if(o){var c=e.from(p.buffer,p.byteOffset,p.byteLength);if(c.byteLength===p.byteLength)return c}var d=p instanceof Uint8Array?p:new Uint8Array(p.buffer,p.byteOffset,p.byteLength),y=e.from(d);if(y.length===p.byteLength)return y}if(n&&p instanceof Uint8Array)return e.from(p);var b=t(p);if(b)for(var x=0;x<p.length;x+=1){var k=p[x];if(typeof k!="number"||k<0||k>255||~~k!==k)throw new RangeError("Array items must be numbers in the range 0-255.")}if(b||e.isBuffer(p)&&p.constructor&&typeof p.constructor.isBuffer=="function"&&p.constructor.isBuffer(p))return e.from(p);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')},"toBuffer"),Wd}i(zf,"requireToBuffer$2");var Qd,V2;function nP(){if(V2)return Qd;V2=1;var e=At().Buffer,t=zf(),r=typeof Uint8Array<"u",a=r&&typeof ArrayBuffer<"u",n=a&&ArrayBuffer.isView;return Qd=i(function(s,o){if(typeof s=="string"||e.isBuffer(s)||r&&s instanceof Uint8Array||n&&n(s))return t(s,o);throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView')},"toBuffer_1$1"),Qd}i(nP,"requireToBuffer$1");var Il={exports:{}},Cl={exports:{}},Z2;function Uf(){if(Z2)return Cl.exports;Z2=1,typeof process>"u"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0?Cl.exports={nextTick:e}:Cl.exports=process;function e(t,r,a,n){if(typeof t!="function")throw new TypeError('"callback" argument must be a function');var s=arguments.length,o,h;switch(s){case 0:case 1:return process.nextTick(t);case 2:return process.nextTick(i(function(){t.call(null,r)},"afterTickOne"));case 3:return process.nextTick(i(function(){t.call(null,r,a)},"afterTickTwo"));case 4:return process.nextTick(i(function(){t.call(null,r,a,n)},"afterTickThree"));default:for(o=new Array(s-1),h=0;h<o.length;)o[h++]=arguments[h];return process.nextTick(i(function(){t.apply(null,o)},"afterTick"))}}return i(e,"nextTick"),Cl.exports}i(Uf,"requireProcessNextickArgs");var Yd,H2;function aP(){if(H2)return Yd;H2=1;var e={}.toString;return Yd=Array.isArray||function(t){return e.call(t)=="[object Array]"},Yd}i(aP,"requireIsarray");var eh,J2;function v7(){return J2||(J2=1,eh=Ai.EventEmitter),eh}i(v7,"requireStreamBrowser");var Rl={exports:{}},q2;function Sv(){return q2||(q2=1,(function(e,t){var r=Vn(),a=r.Buffer;function n(o,h){for(var p in o)h[p]=o[p]}i(n,"copyProps"),a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s);function s(o,h,p){return a(o,h,p)}i(s,"SafeBuffer"),n(a,s),s.from=function(o,h,p){if(typeof o=="number")throw new TypeError("Argument must not be a number");return a(o,h,p)},s.alloc=function(o,h,p){if(typeof o!="number")throw new TypeError("Argument must be a number");var v=a(o);return h!==void 0?typeof p=="string"?v.fill(h,p):v.fill(h):v.fill(0),v},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return a(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(Rl,Rl.exports)),Rl.exports}i(Sv,"requireSafeBuffer$1");var _r={},K2;function tl(){if(K2)return _r;K2=1;function e(k){return Array.isArray?Array.isArray(k):x(k)==="[object Array]"}i(e,"isArray"),_r.isArray=e;function t(k){return typeof k=="boolean"}i(t,"isBoolean"),_r.isBoolean=t;function r(k){return k===null}i(r,"isNull"),_r.isNull=r;function a(k){return k==null}i(a,"isNullOrUndefined"),_r.isNullOrUndefined=a;function n(k){return typeof k=="number"}i(n,"isNumber"),_r.isNumber=n;function s(k){return typeof k=="string"}i(s,"isString"),_r.isString=s;function o(k){return typeof k=="symbol"}i(o,"isSymbol"),_r.isSymbol=o;function h(k){return k===void 0}i(h,"isUndefined"),_r.isUndefined=h;function p(k){return x(k)==="[object RegExp]"}i(p,"isRegExp"),_r.isRegExp=p;function v(k){return typeof k=="object"&&k!==null}i(v,"isObject"),_r.isObject=v;function c(k){return x(k)==="[object Date]"}i(c,"isDate"),_r.isDate=c;function d(k){return x(k)==="[object Error]"||k instanceof Error}i(d,"isError"),_r.isError=d;function y(k){return typeof k=="function"}i(y,"isFunction"),_r.isFunction=y;function b(k){return k===null||typeof k=="boolean"||typeof k=="number"||typeof k=="string"||typeof k=="symbol"||typeof k>"u"}i(b,"isPrimitive"),_r.isPrimitive=b,_r.isBuffer=Vn().Buffer.isBuffer;function x(k){return Object.prototype.toString.call(k)}return i(x,"objectToString"),_r}i(tl,"requireUtil$1");var th={exports:{}},X2;function sP(){return X2||(X2=1,(function(e){function t(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function")}i(t,"_classCallCheck");var r=Sv().Buffer,a=Ai;function n(s,o,h){s.copy(o,h)}i(n,"copyBuffer"),e.exports=(function(){function s(){t(this,s),this.head=null,this.tail=null,this.length=0}return i(s,"BufferList"),s.prototype.push=i(function(h){var p={data:h,next:null};this.length>0?this.tail.next=p:this.head=p,this.tail=p,++this.length},"push"),s.prototype.unshift=i(function(h){var p={data:h,next:this.head};this.length===0&&(this.tail=p),this.head=p,++this.length},"unshift"),s.prototype.shift=i(function(){if(this.length!==0){var h=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,h}},"shift"),s.prototype.clear=i(function(){this.head=this.tail=null,this.length=0},"clear"),s.prototype.join=i(function(h){if(this.length===0)return"";for(var p=this.head,v=""+p.data;p=p.next;)v+=h+p.data;return v},"join"),s.prototype.concat=i(function(h){if(this.length===0)return r.alloc(0);for(var p=r.allocUnsafe(h>>>0),v=this.head,c=0;v;)n(v.data,p,c),c+=v.data.length,v=v.next;return p},"concat"),s})(),a&&a.inspect&&a.inspect.custom&&(e.exports.prototype[a.inspect.custom]=function(){var s=a.inspect({length:this.length});return this.constructor.name+" "+s})})(th)),th.exports}i(sP,"requireBufferList");var rh,W2;function b7(){if(W2)return rh;W2=1;var e=Uf();function t(n,s){var o=this,h=this._readableState&&this._readableState.destroyed,p=this._writableState&&this._writableState.destroyed;return h||p?(s?s(n):n&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(a,this,n)):e.nextTick(a,this,n)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(n||null,function(v){!s&&v?o._writableState?o._writableState.errorEmitted||(o._writableState.errorEmitted=!0,e.nextTick(a,o,v)):e.nextTick(a,o,v):s&&s(v)}),this)}i(t,"destroy");function r(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}i(r,"undestroy");function a(n,s){n.emit("error",s)}return i(a,"emitErrorNT"),rh={destroy:t,undestroy:r},rh}i(b7,"requireDestroy");var ih,Q2;function oP(){if(Q2)return ih;Q2=1,ih=e;function e(r,a){if(t("noDeprecation"))return r;var n=!1;function s(){if(!n){if(t("throwDeprecation"))throw new Error(a);t("traceDeprecation")?console.trace(a):console.warn(a),n=!0}return r.apply(this,arguments)}return i(s,"deprecated"),s}i(e,"deprecate");function t(r){try{if(!globalThis.localStorage)return!1}catch{return!1}var a=globalThis.localStorage[r];return a==null?!1:String(a).toLowerCase()==="true"}return i(t,"config"),ih}i(oP,"requireBrowser$a");var nh,Y2;function y7(){if(Y2)return nh;Y2=1;var e=Uf();nh=k;function t(M){var j=this;this.next=null,this.entry=null,this.finish=function(){w(j,M)}}i(t,"CorkedRequest");var r=e.nextTick,a;k.WritableState=b;var n=Object.create(tl());n.inherits=Lt();var s={deprecate:oP()},o=v7(),h=Sv().Buffer,p=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function v(M){return h.from(M)}i(v,"_uint8ArrayToBuffer");function c(M){return h.isBuffer(M)||M instanceof p}i(c,"_isUint8Array");var d=b7();n.inherits(k,o);function y(){}i(y,"nop");function b(M,j){a=a||ss(),M=M||{};var S=j instanceof a;this.objectMode=!!M.objectMode,S&&(this.objectMode=this.objectMode||!!M.writableObjectMode);var f=M.highWaterMark,_=M.writableHighWaterMark,E=this.objectMode?16:16*1024;f||f===0?this.highWaterMark=f:S&&(_||_===0)?this.highWaterMark=_:this.highWaterMark=E,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var I=M.decodeStrings===!1;this.decodeStrings=!I,this.defaultEncoding=M.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(D){Z(j,D)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}i(b,"WritableState"),b.prototype.getBuffer=i(function(){for(var j=this.bufferedRequest,S=[];j;)S.push(j),j=j.next;return S},"getBuffer"),(function(){try{Object.defineProperty(b.prototype,"buffer",{get:s.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}})();var x;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(k,Symbol.hasInstance,{value:i(function(M){return x.call(this,M)?!0:this!==k?!1:M&&M._writableState instanceof b},"value")})):x=i(function(M){return M instanceof this},"realHasInstance");function k(M){if(a=a||ss(),!x.call(k,this)&&!(this instanceof a))return new k(M);this._writableState=new b(M,this),this.writable=!0,M&&(typeof M.write=="function"&&(this._write=M.write),typeof M.writev=="function"&&(this._writev=M.writev),typeof M.destroy=="function"&&(this._destroy=M.destroy),typeof M.final=="function"&&(this._final=M.final)),o.call(this)}i(k,"Writable"),k.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function N(M,j){var S=new Error("write after end");M.emit("error",S),e.nextTick(j,S)}i(N,"writeAfterEnd");function C(M,j,S,f){var _=!0,E=!1;return S===null?E=new TypeError("May not write null values to stream"):typeof S!="string"&&S!==void 0&&!j.objectMode&&(E=new TypeError("Invalid non-string/buffer chunk")),E&&(M.emit("error",E),e.nextTick(f,E),_=!1),_}i(C,"validChunk"),k.prototype.write=function(M,j,S){var f=this._writableState,_=!1,E=!f.objectMode&&c(M);return E&&!h.isBuffer(M)&&(M=v(M)),typeof j=="function"&&(S=j,j=null),E?j="buffer":j||(j=f.defaultEncoding),typeof S!="function"&&(S=y),f.ended?N(this,S):(E||C(this,f,M,S))&&(f.pendingcb++,_=O(this,f,E,M,j,S)),_},k.prototype.cork=function(){var M=this._writableState;M.corked++},k.prototype.uncork=function(){var M=this._writableState;M.corked&&(M.corked--,!M.writing&&!M.corked&&!M.bufferProcessing&&M.bufferedRequest&&$(this,M))},k.prototype.setDefaultEncoding=i(function(j){if(typeof j=="string"&&(j=j.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((j+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+j);return this._writableState.defaultEncoding=j,this},"setDefaultEncoding");function R(M,j,S){return!M.objectMode&&M.decodeStrings!==!1&&typeof j=="string"&&(j=h.from(j,S)),j}i(R,"decodeChunk"),Object.defineProperty(k.prototype,"writableHighWaterMark",{enumerable:!1,get:i(function(){return this._writableState.highWaterMark},"get")});function O(M,j,S,f,_,E){if(!S){var I=R(j,f,_);f!==I&&(S=!0,_="buffer",f=I)}var D=j.objectMode?1:f.length;j.length+=D;var L=j.length<j.highWaterMark;if(L||(j.needDrain=!0),j.writing||j.corked){var U=j.lastBufferedRequest;j.lastBufferedRequest={chunk:f,encoding:_,isBuf:S,callback:E,next:null},U?U.next=j.lastBufferedRequest:j.bufferedRequest=j.lastBufferedRequest,j.bufferedRequestCount+=1}else T(M,j,!1,D,f,_,E);return L}i(O,"writeOrBuffer");function T(M,j,S,f,_,E,I){j.writelen=f,j.writecb=I,j.writing=!0,j.sync=!0,S?M._writev(_,j.onwrite):M._write(_,E,j.onwrite),j.sync=!1}i(T,"doWrite");function P(M,j,S,f,_){--j.pendingcb,S?(e.nextTick(_,f),e.nextTick(l,M,j),M._writableState.errorEmitted=!0,M.emit("error",f)):(_(f),M._writableState.errorEmitted=!0,M.emit("error",f),l(M,j))}i(P,"onwriteError");function z(M){M.writing=!1,M.writecb=null,M.length-=M.writelen,M.writelen=0}i(z,"onwriteStateUpdate");function Z(M,j){var S=M._writableState,f=S.sync,_=S.writecb;if(z(S),j)P(M,S,f,j,_);else{var E=F(S);!E&&!S.corked&&!S.bufferProcessing&&S.bufferedRequest&&$(M,S),f?r(V,M,S,E,_):V(M,S,E,_)}}i(Z,"onwrite");function V(M,j,S,f){S||ee(M,j),j.pendingcb--,f(),l(M,j)}i(V,"afterWrite");function ee(M,j){j.length===0&&j.needDrain&&(j.needDrain=!1,M.emit("drain"))}i(ee,"onwriteDrain");function $(M,j){j.bufferProcessing=!0;var S=j.bufferedRequest;if(M._writev&&S&&S.next){var f=j.bufferedRequestCount,_=new Array(f),E=j.corkedRequestsFree;E.entry=S;for(var I=0,D=!0;S;)_[I]=S,S.isBuf||(D=!1),S=S.next,I+=1;_.allBuffers=D,T(M,j,!0,j.length,_,"",E.finish),j.pendingcb++,j.lastBufferedRequest=null,E.next?(j.corkedRequestsFree=E.next,E.next=null):j.corkedRequestsFree=new t(j),j.bufferedRequestCount=0}else{for(;S;){var L=S.chunk,U=S.encoding,B=S.callback,G=j.objectMode?1:L.length;if(T(M,j,!1,G,L,U,B),S=S.next,j.bufferedRequestCount--,j.writing)break}S===null&&(j.lastBufferedRequest=null)}j.bufferedRequest=S,j.bufferProcessing=!1}i($,"clearBuffer"),k.prototype._write=function(M,j,S){S(new Error("_write() is not implemented"))},k.prototype._writev=null,k.prototype.end=function(M,j,S){var f=this._writableState;typeof M=="function"?(S=M,M=null,j=null):typeof j=="function"&&(S=j,j=null),M!=null&&this.write(M,j),f.corked&&(f.corked=1,this.uncork()),f.ending||m(this,f,S)};function F(M){return M.ending&&M.length===0&&M.bufferedRequest===null&&!M.finished&&!M.writing}i(F,"needFinish");function u(M,j){M._final(function(S){j.pendingcb--,S&&M.emit("error",S),j.prefinished=!0,M.emit("prefinish"),l(M,j)})}i(u,"callFinal");function g(M,j){!j.prefinished&&!j.finalCalled&&(typeof M._final=="function"?(j.pendingcb++,j.finalCalled=!0,e.nextTick(u,M,j)):(j.prefinished=!0,M.emit("prefinish")))}i(g,"prefinish");function l(M,j){var S=F(j);return S&&(g(M,j),j.pendingcb===0&&(j.finished=!0,M.emit("finish"))),S}i(l,"finishMaybe");function m(M,j,S){j.ending=!0,l(M,j),S&&(j.finished?e.nextTick(S):M.once("finish",S)),j.ended=!0,M.writable=!1}i(m,"endWritable");function w(M,j,S){var f=M.entry;for(M.entry=null;f;){var _=f.callback;j.pendingcb--,_(S),f=f.next}j.corkedRequestsFree.next=M}return i(w,"onCorkedFinish"),Object.defineProperty(k.prototype,"destroyed",{get:i(function(){return this._writableState===void 0?!1:this._writableState.destroyed},"get"),set:i(function(M){this._writableState&&(this._writableState.destroyed=M)},"set")}),k.prototype.destroy=d.destroy,k.prototype._undestroy=d.undestroy,k.prototype._destroy=function(M,j){this.end(),j(M)},nh}i(y7,"require_stream_writable");var ah,ew;function ss(){if(ew)return ah;ew=1;var e=Uf(),t=Object.keys||function(d){var y=[];for(var b in d)y.push(b);return y};ah=p;var r=Object.create(tl());r.inherits=Lt();var a=w7(),n=y7();r.inherits(p,a);for(var s=t(n.prototype),o=0;o<s.length;o++){var h=s[o];p.prototype[h]||(p.prototype[h]=n.prototype[h])}function p(d){if(!(this instanceof p))return new p(d);a.call(this,d),n.call(this,d),d&&d.readable===!1&&(this.readable=!1),d&&d.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,d&&d.allowHalfOpen===!1&&(this.allowHalfOpen=!1),this.once("end",v)}i(p,"Duplex"),Object.defineProperty(p.prototype,"writableHighWaterMark",{enumerable:!1,get:i(function(){return this._writableState.highWaterMark},"get")});function v(){this.allowHalfOpen||this._writableState.ended||e.nextTick(c,this)}i(v,"onend");function c(d){d.end()}return i(c,"onEndNT"),Object.defineProperty(p.prototype,"destroyed",{get:i(function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},"get"),set:i(function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)},"set")}),p.prototype._destroy=function(d,y){this.push(null),this.end(),e.nextTick(y,d)},ah}i(ss,"require_stream_duplex");var sh={},Ol={exports:{}},tw;function lP(){return tw||(tw=1,(function(e,t){var r=Vn(),a=r.Buffer;function n(o,h){for(var p in o)h[p]=o[p]}i(n,"copyProps"),a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(n(r,t),t.Buffer=s);function s(o,h,p){return a(o,h,p)}i(s,"SafeBuffer"),n(a,s),s.from=function(o,h,p){if(typeof o=="number")throw new TypeError("Argument must not be a number");return a(o,h,p)},s.alloc=function(o,h,p){if(typeof o!="number")throw new TypeError("Argument must be a number");var v=a(o);return h!==void 0?typeof p=="string"?v.fill(h,p):v.fill(h):v.fill(0),v},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return a(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(Ol,Ol.exports)),Ol.exports}i(lP,"requireSafeBuffer");var rw;function Ym(){if(rw)return sh;rw=1;var e=lP().Buffer,t=e.isEncoding||function(C){switch(C=""+C,C&&C.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 r(C){if(!C)return"utf8";for(var R;;)switch(C){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 C;default:if(R)return;C=(""+C).toLowerCase(),R=!0}}i(r,"_normalizeEncoding");function a(C){var R=r(C);if(typeof R!="string"&&(e.isEncoding===t||!t(C)))throw new Error("Unknown encoding: "+C);return R||C}i(a,"normalizeEncoding"),sh.StringDecoder=n;function n(C){this.encoding=a(C);var R;switch(this.encoding){case"utf16le":this.text=d,this.end=y,R=4;break;case"utf8":this.fillLast=p,R=4;break;case"base64":this.text=b,this.end=x,R=3;break;default:this.write=k,this.end=N;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(R)}i(n,"StringDecoder"),n.prototype.write=function(C){if(C.length===0)return"";var R,O;if(this.lastNeed){if(R=this.fillLast(C),R===void 0)return"";O=this.lastNeed,this.lastNeed=0}else O=0;return O<C.length?R?R+this.text(C,O):this.text(C,O):R||""},n.prototype.end=c,n.prototype.text=v,n.prototype.fillLast=function(C){if(this.lastNeed<=C.length)return C.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);C.copy(this.lastChar,this.lastTotal-this.lastNeed,0,C.length),this.lastNeed-=C.length};function s(C){return C<=127?0:C>>5===6?2:C>>4===14?3:C>>3===30?4:C>>6===2?-1:-2}i(s,"utf8CheckByte");function o(C,R,O){var T=R.length-1;if(T<O)return 0;var P=s(R[T]);return P>=0?(P>0&&(C.lastNeed=P-1),P):--T<O||P===-2?0:(P=s(R[T]),P>=0?(P>0&&(C.lastNeed=P-2),P):--T<O||P===-2?0:(P=s(R[T]),P>=0?(P>0&&(P===2?P=0:C.lastNeed=P-3),P):0))}i(o,"utf8CheckIncomplete");function h(C,R,O){if((R[0]&192)!==128)return C.lastNeed=0,"�";if(C.lastNeed>1&&R.length>1){if((R[1]&192)!==128)return C.lastNeed=1,"�";if(C.lastNeed>2&&R.length>2&&(R[2]&192)!==128)return C.lastNeed=2,"�"}}i(h,"utf8CheckExtraBytes");function p(C){var R=this.lastTotal-this.lastNeed,O=h(this,C);if(O!==void 0)return O;if(this.lastNeed<=C.length)return C.copy(this.lastChar,R,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);C.copy(this.lastChar,R,0,C.length),this.lastNeed-=C.length}i(p,"utf8FillLast");function v(C,R){var O=o(this,C,R);if(!this.lastNeed)return C.toString("utf8",R);this.lastTotal=O;var T=C.length-(O-this.lastNeed);return C.copy(this.lastChar,0,T),C.toString("utf8",R,T)}i(v,"utf8Text");function c(C){var R=C&&C.length?this.write(C):"";return this.lastNeed?R+"�":R}i(c,"utf8End");function d(C,R){if((C.length-R)%2===0){var O=C.toString("utf16le",R);if(O){var T=O.charCodeAt(O.length-1);if(T>=55296&&T<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1],O.slice(0,-1)}return O}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=C[C.length-1],C.toString("utf16le",R,C.length-1)}i(d,"utf16Text");function y(C){var R=C&&C.length?this.write(C):"";if(this.lastNeed){var O=this.lastTotal-this.lastNeed;return R+this.lastChar.toString("utf16le",0,O)}return R}i(y,"utf16End");function b(C,R){var O=(C.length-R)%3;return O===0?C.toString("base64",R):(this.lastNeed=3-O,this.lastTotal=3,O===1?this.lastChar[0]=C[C.length-1]:(this.lastChar[0]=C[C.length-2],this.lastChar[1]=C[C.length-1]),C.toString("base64",R,C.length-O))}i(b,"base64Text");function x(C){var R=C&&C.length?this.write(C):"";return this.lastNeed?R+this.lastChar.toString("base64",0,3-this.lastNeed):R}i(x,"base64End");function k(C){return C.toString(this.encoding)}i(k,"simpleWrite");function N(C){return C&&C.length?this.write(C):""}return i(N,"simpleEnd"),sh}i(Ym,"requireString_decoder");var oh,iw;function w7(){if(iw)return oh;iw=1;var e=Uf();oh=R;var t=aP(),r;R.ReadableState=C,Ai.EventEmitter;var a=i(function(B,G){return B.listeners(G).length},"EElistenerCount"),n=v7(),s=Sv().Buffer,o=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function h(B){return s.from(B)}i(h,"_uint8ArrayToBuffer");function p(B){return s.isBuffer(B)||B instanceof o}i(p,"_isUint8Array");var v=Object.create(tl());v.inherits=Lt();var c=Ai,d=void 0;c&&c.debuglog?d=c.debuglog("stream"):d=i(function(){},"debug");var y=sP(),b=b7(),x;v.inherits(R,n);var k=["error","close","destroy","pause","resume"];function N(B,G,H){if(typeof B.prependListener=="function")return B.prependListener(G,H);!B._events||!B._events[G]?B.on(G,H):t(B._events[G])?B._events[G].unshift(H):B._events[G]=[H,B._events[G]]}i(N,"prependListener");function C(B,G){r=r||ss(),B=B||{};var H=G instanceof r;this.objectMode=!!B.objectMode,H&&(this.objectMode=this.objectMode||!!B.readableObjectMode);var K=B.highWaterMark,_e=B.readableHighWaterMark,se=this.objectMode?16:16*1024;K||K===0?this.highWaterMark=K:H&&(_e||_e===0)?this.highWaterMark=_e:this.highWaterMark=se,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=B.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,B.encoding&&(x||(x=Ym().StringDecoder),this.decoder=new x(B.encoding),this.encoding=B.encoding)}i(C,"ReadableState");function R(B){if(r=r||ss(),!(this instanceof R))return new R(B);this._readableState=new C(B,this),this.readable=!0,B&&(typeof B.read=="function"&&(this._read=B.read),typeof B.destroy=="function"&&(this._destroy=B.destroy)),n.call(this)}i(R,"Readable"),Object.defineProperty(R.prototype,"destroyed",{get:i(function(){return this._readableState===void 0?!1:this._readableState.destroyed},"get"),set:i(function(B){this._readableState&&(this._readableState.destroyed=B)},"set")}),R.prototype.destroy=b.destroy,R.prototype._undestroy=b.undestroy,R.prototype._destroy=function(B,G){this.push(null),G(B)},R.prototype.push=function(B,G){var H=this._readableState,K;return H.objectMode?K=!0:typeof B=="string"&&(G=G||H.defaultEncoding,G!==H.encoding&&(B=s.from(B,G),G=""),K=!0),O(this,B,G,!1,K)},R.prototype.unshift=function(B){return O(this,B,null,!0,!1)};function O(B,G,H,K,_e){var se=B._readableState;if(G===null)se.reading=!1,$(B,se);else{var ae;_e||(ae=P(se,G)),ae?B.emit("error",ae):se.objectMode||G&&G.length>0?(typeof G!="string"&&!se.objectMode&&Object.getPrototypeOf(G)!==s.prototype&&(G=h(G)),K?se.endEmitted?B.emit("error",new Error("stream.unshift() after end event")):T(B,se,G,!0):se.ended?B.emit("error",new Error("stream.push() after EOF")):(se.reading=!1,se.decoder&&!H?(G=se.decoder.write(G),se.objectMode||G.length!==0?T(B,se,G,!1):g(B,se)):T(B,se,G,!1))):K||(se.reading=!1)}return z(se)}i(O,"readableAddChunk");function T(B,G,H,K){G.flowing&&G.length===0&&!G.sync?(B.emit("data",H),B.read(0)):(G.length+=G.objectMode?1:H.length,K?G.buffer.unshift(H):G.buffer.push(H),G.needReadable&&F(B)),g(B,G)}i(T,"addChunk");function P(B,G){var H;return!p(G)&&typeof G!="string"&&G!==void 0&&!B.objectMode&&(H=new TypeError("Invalid non-string/buffer chunk")),H}i(P,"chunkInvalid");function z(B){return!B.ended&&(B.needReadable||B.length<B.highWaterMark||B.length===0)}i(z,"needMoreData"),R.prototype.isPaused=function(){return this._readableState.flowing===!1},R.prototype.setEncoding=function(B){return x||(x=Ym().StringDecoder),this._readableState.decoder=new x(B),this._readableState.encoding=B,this};var Z=8388608;function V(B){return B>=Z?B=Z:(B--,B|=B>>>1,B|=B>>>2,B|=B>>>4,B|=B>>>8,B|=B>>>16,B++),B}i(V,"computeNewHighWaterMark");function ee(B,G){return B<=0||G.length===0&&G.ended?0:G.objectMode?1:B!==B?G.flowing&&G.length?G.buffer.head.data.length:G.length:(B>G.highWaterMark&&(G.highWaterMark=V(B)),B<=G.length?B:G.ended?G.length:(G.needReadable=!0,0))}i(ee,"howMuchToRead"),R.prototype.read=function(B){d("read",B),B=parseInt(B,10);var G=this._readableState,H=B;if(B!==0&&(G.emittedReadable=!1),B===0&&G.needReadable&&(G.length>=G.highWaterMark||G.ended))return d("read: emitReadable",G.length,G.ended),G.length===0&&G.ended?D(this):F(this),null;if(B=ee(B,G),B===0&&G.ended)return G.length===0&&D(this),null;var K=G.needReadable;d("need readable",K),(G.length===0||G.length-B<G.highWaterMark)&&(K=!0,d("length less than watermark",K)),G.ended||G.reading?(K=!1,d("reading or ended",K)):K&&(d("do read"),G.reading=!0,G.sync=!0,G.length===0&&(G.needReadable=!0),this._read(G.highWaterMark),G.sync=!1,G.reading||(B=ee(H,G)));var _e;return B>0?_e=f(B,G):_e=null,_e===null?(G.needReadable=!0,B=0):G.length-=B,G.length===0&&(G.ended||(G.needReadable=!0),H!==B&&G.ended&&D(this)),_e!==null&&this.emit("data",_e),_e};function $(B,G){if(!G.ended){if(G.decoder){var H=G.decoder.end();H&&H.length&&(G.buffer.push(H),G.length+=G.objectMode?1:H.length)}G.ended=!0,F(B)}}i($,"onEofChunk");function F(B){var G=B._readableState;G.needReadable=!1,G.emittedReadable||(d("emitReadable",G.flowing),G.emittedReadable=!0,G.sync?e.nextTick(u,B):u(B))}i(F,"emitReadable");function u(B){d("emit readable"),B.emit("readable"),S(B)}i(u,"emitReadable_");function g(B,G){G.readingMore||(G.readingMore=!0,e.nextTick(l,B,G))}i(g,"maybeReadMore");function l(B,G){for(var H=G.length;!G.reading&&!G.flowing&&!G.ended&&G.length<G.highWaterMark&&(d("maybeReadMore read 0"),B.read(0),H!==G.length);)H=G.length;G.readingMore=!1}i(l,"maybeReadMore_"),R.prototype._read=function(B){this.emit("error",new Error("_read() is not implemented"))},R.prototype.pipe=function(B,G){var H=this,K=this._readableState;switch(K.pipesCount){case 0:K.pipes=B;break;case 1:K.pipes=[K.pipes,B];break;default:K.pipes.push(B);break}K.pipesCount+=1,d("pipe count=%d opts=%j",K.pipesCount,G);var _e=(!G||G.end!==!1)&&B!==process.stdout&&B!==process.stderr,se=_e?ve:Q;K.endEmitted?e.nextTick(se):H.once("end",se),B.on("unpipe",ae);function ae(Y,te){d("onunpipe"),Y===H&&te&&te.hasUnpiped===!1&&(te.hasUnpiped=!0,X())}i(ae,"onunpipe");function ve(){d("onend"),B.end()}i(ve,"onend");var q=m(H);B.on("drain",q);var ne=!1;function X(){d("cleanup"),B.removeListener("close",be),B.removeListener("finish",fe),B.removeListener("drain",q),B.removeListener("error",ke),B.removeListener("unpipe",ae),H.removeListener("end",ve),H.removeListener("end",Q),H.removeListener("data",le),ne=!0,K.awaitDrain&&(!B._writableState||B._writableState.needDrain)&&q()}i(X,"cleanup");var W=!1;H.on("data",le);function le(Y){d("ondata"),W=!1;var te=B.write(Y);te===!1&&!W&&((K.pipesCount===1&&K.pipes===B||K.pipesCount>1&&U(K.pipes,B)!==-1)&&!ne&&(d("false write response, pause",K.awaitDrain),K.awaitDrain++,W=!0),H.pause())}i(le,"ondata");function ke(Y){d("onerror",Y),Q(),B.removeListener("error",ke),a(B,"error")===0&&B.emit("error",Y)}i(ke,"onerror"),N(B,"error",ke);function be(){B.removeListener("finish",fe),Q()}i(be,"onclose"),B.once("close",be);function fe(){d("onfinish"),B.removeListener("close",be),Q()}i(fe,"onfinish"),B.once("finish",fe);function Q(){d("unpipe"),H.unpipe(B)}return i(Q,"unpipe"),B.emit("pipe",H),K.flowing||(d("pipe resume"),H.resume()),B};function m(B){return function(){var G=B._readableState;d("pipeOnDrain",G.awaitDrain),G.awaitDrain&&G.awaitDrain--,G.awaitDrain===0&&a(B,"data")&&(G.flowing=!0,S(B))}}i(m,"pipeOnDrain"),R.prototype.unpipe=function(B){var G=this._readableState,H={hasUnpiped:!1};if(G.pipesCount===0)return this;if(G.pipesCount===1)return B&&B!==G.pipes?this:(B||(B=G.pipes),G.pipes=null,G.pipesCount=0,G.flowing=!1,B&&B.emit("unpipe",this,H),this);if(!B){var K=G.pipes,_e=G.pipesCount;G.pipes=null,G.pipesCount=0,G.flowing=!1;for(var se=0;se<_e;se++)K[se].emit("unpipe",this,{hasUnpiped:!1});return this}var ae=U(G.pipes,B);return ae===-1?this:(G.pipes.splice(ae,1),G.pipesCount-=1,G.pipesCount===1&&(G.pipes=G.pipes[0]),B.emit("unpipe",this,H),this)},R.prototype.on=function(B,G){var H=n.prototype.on.call(this,B,G);if(B==="data")this._readableState.flowing!==!1&&this.resume();else if(B==="readable"){var K=this._readableState;!K.endEmitted&&!K.readableListening&&(K.readableListening=K.needReadable=!0,K.emittedReadable=!1,K.reading?K.length&&F(this):e.nextTick(w,this))}return H},R.prototype.addListener=R.prototype.on;function w(B){d("readable nexttick read 0"),B.read(0)}i(w,"nReadingNextTick"),R.prototype.resume=function(){var B=this._readableState;return B.flowing||(d("resume"),B.flowing=!0,M(this,B)),this};function M(B,G){G.resumeScheduled||(G.resumeScheduled=!0,e.nextTick(j,B,G))}i(M,"resume");function j(B,G){G.reading||(d("resume read 0"),B.read(0)),G.resumeScheduled=!1,G.awaitDrain=0,B.emit("resume"),S(B),G.flowing&&!G.reading&&B.read(0)}i(j,"resume_"),R.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this};function S(B){var G=B._readableState;for(d("flow",G.flowing);G.flowing&&B.read()!==null;);}i(S,"flow"),R.prototype.wrap=function(B){var G=this,H=this._readableState,K=!1;B.on("end",function(){if(d("wrapped end"),H.decoder&&!H.ended){var ae=H.decoder.end();ae&&ae.length&&G.push(ae)}G.push(null)}),B.on("data",function(ae){if(d("wrapped data"),H.decoder&&(ae=H.decoder.write(ae)),!(H.objectMode&&ae==null)&&!(!H.objectMode&&(!ae||!ae.length))){var ve=G.push(ae);ve||(K=!0,B.pause())}});for(var _e in B)this[_e]===void 0&&typeof B[_e]=="function"&&(this[_e]=(function(ae){return function(){return B[ae].apply(B,arguments)}})(_e));for(var se=0;se<k.length;se++)B.on(k[se],this.emit.bind(this,k[se]));return this._read=function(ae){d("wrapped _read",ae),K&&(K=!1,B.resume())},this},Object.defineProperty(R.prototype,"readableHighWaterMark",{enumerable:!1,get:i(function(){return this._readableState.highWaterMark},"get")}),R._fromList=f;function f(B,G){if(G.length===0)return null;var H;return G.objectMode?H=G.buffer.shift():!B||B>=G.length?(G.decoder?H=G.buffer.join(""):G.buffer.length===1?H=G.buffer.head.data:H=G.buffer.concat(G.length),G.buffer.clear()):H=_(B,G.buffer,G.decoder),H}i(f,"fromList");function _(B,G,H){var K;return B<G.head.data.length?(K=G.head.data.slice(0,B),G.head.data=G.head.data.slice(B)):B===G.head.data.length?K=G.shift():K=H?E(B,G):I(B,G),K}i(_,"fromListPartial");function E(B,G){var H=G.head,K=1,_e=H.data;for(B-=_e.length;H=H.next;){var se=H.data,ae=B>se.length?se.length:B;if(ae===se.length?_e+=se:_e+=se.slice(0,B),B-=ae,B===0){ae===se.length?(++K,H.next?G.head=H.next:G.head=G.tail=null):(G.head=H,H.data=se.slice(ae));break}++K}return G.length-=K,_e}i(E,"copyFromBufferString");function I(B,G){var H=s.allocUnsafe(B),K=G.head,_e=1;for(K.data.copy(H),B-=K.data.length;K=K.next;){var se=K.data,ae=B>se.length?se.length:B;if(se.copy(H,H.length-B,0,ae),B-=ae,B===0){ae===se.length?(++_e,K.next?G.head=K.next:G.head=G.tail=null):(G.head=K,K.data=se.slice(ae));break}++_e}return G.length-=_e,H}i(I,"copyFromBuffer");function D(B){var G=B._readableState;if(G.length>0)throw new Error('"endReadable()" called on non-empty stream');G.endEmitted||(G.ended=!0,e.nextTick(L,G,B))}i(D,"endReadable");function L(B,G){!B.endEmitted&&B.length===0&&(B.endEmitted=!0,G.readable=!1,G.emit("end"))}i(L,"endReadableNT");function U(B,G){for(var H=0,K=B.length;H<K;H++)if(B[H]===G)return H;return-1}return i(U,"indexOf"),oh}i(w7,"require_stream_readable");var lh,nw;function x7(){if(nw)return lh;nw=1,lh=a;var e=ss(),t=Object.create(tl());t.inherits=Lt(),t.inherits(a,e);function r(o,h){var p=this._transformState;p.transforming=!1;var v=p.writecb;if(!v)return this.emit("error",new Error("write callback called multiple times"));p.writechunk=null,p.writecb=null,h!=null&&this.push(h),v(o);var c=this._readableState;c.reading=!1,(c.needReadable||c.length<c.highWaterMark)&&this._read(c.highWaterMark)}i(r,"afterTransform");function a(o){if(!(this instanceof a))return new a(o);e.call(this,o),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,o&&(typeof o.transform=="function"&&(this._transform=o.transform),typeof o.flush=="function"&&(this._flush=o.flush)),this.on("prefinish",n)}i(a,"Transform");function n(){var o=this;typeof this._flush=="function"?this._flush(function(h,p){s(o,h,p)}):s(this,null,null)}i(n,"prefinish"),a.prototype.push=function(o,h){return this._transformState.needTransform=!1,e.prototype.push.call(this,o,h)},a.prototype._transform=function(o,h,p){throw new Error("_transform() is not implemented")},a.prototype._write=function(o,h,p){var v=this._transformState;if(v.writecb=p,v.writechunk=o,v.writeencoding=h,!v.transforming){var c=this._readableState;(v.needTransform||c.needReadable||c.length<c.highWaterMark)&&this._read(c.highWaterMark)}},a.prototype._read=function(o){var h=this._transformState;h.writechunk!==null&&h.writecb&&!h.transforming?(h.transforming=!0,this._transform(h.writechunk,h.writeencoding,h.afterTransform)):h.needTransform=!0},a.prototype._destroy=function(o,h){var p=this;e.prototype._destroy.call(this,o,function(v){h(v),p.emit("close")})};function s(o,h,p){if(h)return o.emit("error",h);if(p!=null&&o.push(p),o._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(o._transformState.transforming)throw new Error("Calling transform done when still transforming");return o.push(null)}return i(s,"done"),lh}i(x7,"require_stream_transform");var uh,aw;function uP(){if(aw)return uh;aw=1,uh=r;var e=x7(),t=Object.create(tl());t.inherits=Lt(),t.inherits(r,e);function r(a){if(!(this instanceof r))return new r(a);e.call(this,a)}return i(r,"PassThrough"),r.prototype._transform=function(a,n,s){s(null,a)},uh}i(uP,"require_stream_passthrough");var sw;function _7(){return sw||(sw=1,(function(e,t){t=e.exports=w7(),t.Stream=t,t.Readable=t,t.Writable=y7(),t.Duplex=ss(),t.Transform=x7(),t.PassThrough=uP()})(Il,Il.exports)),Il.exports}i(_7,"requireReadableBrowser");var fh,ow;function fP(){if(ow)return fh;ow=1;var e=At().Buffer,t=nP(),r=_7().Transform,a=Lt();function n(s){r.call(this),this._block=e.allocUnsafe(s),this._blockSize=s,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return i(n,"HashBase"),a(n,r),n.prototype._transform=function(s,o,h){var p=null;try{this.update(s,o)}catch(v){p=v}h(p)},n.prototype._flush=function(s){var o=null;try{this.push(this.digest())}catch(h){o=h}s(o)},n.prototype.update=function(s,o){if(this._finalized)throw new Error("Digest already called");for(var h=t(s,o),p=this._block,v=0;this._blockOffset+h.length-v>=this._blockSize;){for(var c=this._blockOffset;c<this._blockSize;)p[c]=h[v],c+=1,v+=1;this._update(),this._blockOffset=0}for(;v<h.length;)p[this._blockOffset]=h[v],this._blockOffset+=1,v+=1;for(var d=0,y=h.length*8;y>0;++d)this._length[d]+=y,y=this._length[d]/4294967296|0,y>0&&(this._length[d]-=4294967296*y);return this},n.prototype._update=function(){throw new Error("_update is not implemented")},n.prototype.digest=function(s){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var o=this._digest();s!==void 0&&(o=o.toString(s)),this._block.fill(0),this._blockOffset=0;for(var h=0;h<4;++h)this._length[h]=0;return o},n.prototype._digest=function(){throw new Error("_digest is not implemented")},fh=n,fh}i(fP,"requireHashBase");var ch,lw;function Mv(){if(lw)return ch;lw=1;var e=Vn().Buffer,t=Lt(),r=fP(),a=new Array(16),n=[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],s=[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],o=[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],h=[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],p=[0,1518500249,1859775393,2400959708,2840853838],v=[1352829926,1548603684,1836072691,2053994217,0];function c(C,R){return C<<R|C>>>32-R}i(c,"rotl");function d(C,R,O,T,P,z,Z,V){return c(C+(R^O^T)+z+Z|0,V)+P|0}i(d,"fn1");function y(C,R,O,T,P,z,Z,V){return c(C+(R&O|~R&T)+z+Z|0,V)+P|0}i(y,"fn2");function b(C,R,O,T,P,z,Z,V){return c(C+((R|~O)^T)+z+Z|0,V)+P|0}i(b,"fn3");function x(C,R,O,T,P,z,Z,V){return c(C+(R&T|O&~T)+z+Z|0,V)+P|0}i(x,"fn4");function k(C,R,O,T,P,z,Z,V){return c(C+(R^(O|~T))+z+Z|0,V)+P|0}i(k,"fn5");function N(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}return i(N,"RIPEMD160"),t(N,r),N.prototype._update=function(){for(var C=a,R=0;R<16;++R)C[R]=this._block.readInt32LE(R*4);for(var O=this._a|0,T=this._b|0,P=this._c|0,z=this._d|0,Z=this._e|0,V=this._a|0,ee=this._b|0,$=this._c|0,F=this._d|0,u=this._e|0,g=0;g<80;g+=1){var l,m;g<16?(l=d(O,T,P,z,Z,C[n[g]],p[0],o[g]),m=k(V,ee,$,F,u,C[s[g]],v[0],h[g])):g<32?(l=y(O,T,P,z,Z,C[n[g]],p[1],o[g]),m=x(V,ee,$,F,u,C[s[g]],v[1],h[g])):g<48?(l=b(O,T,P,z,Z,C[n[g]],p[2],o[g]),m=b(V,ee,$,F,u,C[s[g]],v[2],h[g])):g<64?(l=x(O,T,P,z,Z,C[n[g]],p[3],o[g]),m=y(V,ee,$,F,u,C[s[g]],v[3],h[g])):(l=k(O,T,P,z,Z,C[n[g]],p[4],o[g]),m=d(V,ee,$,F,u,C[s[g]],v[4],h[g])),O=Z,Z=z,z=c(P,10),P=T,T=l,V=u,u=F,F=c($,10),$=ee,ee=m}var w=this._b+P+F|0;this._b=this._c+z+u|0,this._c=this._d+Z+V|0,this._d=this._e+O+ee|0,this._e=this._a+T+$|0,this._a=w},N.prototype._digest=function(){this._block[this._blockOffset]=128,this._blockOffset+=1,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 C=e.alloc?e.alloc(20):new e(20);return C.writeInt32LE(this._a,0),C.writeInt32LE(this._b,4),C.writeInt32LE(this._c,8),C.writeInt32LE(this._d,12),C.writeInt32LE(this._e,16),C},ch=N,ch}i(Mv,"requireRipemd160");var dh={exports:{}},hh,uw;function ws(){if(uw)return hh;uw=1;var e=At().Buffer,t=zf();function r(a,n){this._block=e.alloc(a),this._finalSize=n,this._blockSize=a,this._len=0}return i(r,"Hash"),r.prototype.update=function(a,n){a=t(a,n||"utf8");for(var s=this._block,o=this._blockSize,h=a.length,p=this._len,v=0;v<h;){for(var c=p%o,d=Math.min(h-v,o-c),y=0;y<d;y++)s[c+y]=a[v+y];p+=d,v+=d,p%o===0&&this._update(s)}return this._len+=h,this},r.prototype.digest=function(a){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 s=this._len*8;if(s<=4294967295)this._block.writeUInt32BE(s,this._blockSize-4);else{var o=(s&4294967295)>>>0,h=(s-o)/4294967296;this._block.writeUInt32BE(h,this._blockSize-8),this._block.writeUInt32BE(o,this._blockSize-4)}this._update(this._block);var p=this._hash();return a?p.toString(a):p},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hh=r,hh}i(ws,"requireHash$1");var ph,fw;function cP(){if(fw)return ph;fw=1;var e=Lt(),t=ws(),r=At().Buffer,a=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function s(){this.init(),this._w=n,t.call(this,64,56)}i(s,"Sha"),e(s,t),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function o(v){return v<<5|v>>>27}i(o,"rotl5");function h(v){return v<<30|v>>>2}i(h,"rotl30");function p(v,c,d,y){return v===0?c&d|~c&y:v===2?c&d|c&y|d&y:c^d^y}return i(p,"ft"),s.prototype._update=function(v){for(var c=this._w,d=this._a|0,y=this._b|0,b=this._c|0,x=this._d|0,k=this._e|0,N=0;N<16;++N)c[N]=v.readInt32BE(N*4);for(;N<80;++N)c[N]=c[N-3]^c[N-8]^c[N-14]^c[N-16];for(var C=0;C<80;++C){var R=~~(C/20),O=o(d)+p(R,y,b,x)+k+c[C]+a[R]|0;k=x,x=b,b=h(y),y=d,d=O}this._a=d+this._a|0,this._b=y+this._b|0,this._c=b+this._c|0,this._d=x+this._d|0,this._e=k+this._e|0},s.prototype._hash=function(){var v=r.allocUnsafe(20);return v.writeInt32BE(this._a|0,0),v.writeInt32BE(this._b|0,4),v.writeInt32BE(this._c|0,8),v.writeInt32BE(this._d|0,12),v.writeInt32BE(this._e|0,16),v},ph=s,ph}i(cP,"requireSha$1");var mh,cw;function dP(){if(cw)return mh;cw=1;var e=Lt(),t=ws(),r=At().Buffer,a=[1518500249,1859775393,-1894007588,-899497514],n=new Array(80);function s(){this.init(),this._w=n,t.call(this,64,56)}i(s,"Sha1"),e(s,t),s.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function o(c){return c<<1|c>>>31}i(o,"rotl1");function h(c){return c<<5|c>>>27}i(h,"rotl5");function p(c){return c<<30|c>>>2}i(p,"rotl30");function v(c,d,y,b){return c===0?d&y|~d&b:c===2?d&y|d&b|y&b:d^y^b}return i(v,"ft"),s.prototype._update=function(c){for(var d=this._w,y=this._a|0,b=this._b|0,x=this._c|0,k=this._d|0,N=this._e|0,C=0;C<16;++C)d[C]=c.readInt32BE(C*4);for(;C<80;++C)d[C]=o(d[C-3]^d[C-8]^d[C-14]^d[C-16]);for(var R=0;R<80;++R){var O=~~(R/20),T=h(y)+v(O,b,x,k)+N+d[R]+a[O]|0;N=k,k=x,x=p(b),b=y,y=T}this._a=y+this._a|0,this._b=b+this._b|0,this._c=x+this._c|0,this._d=k+this._d|0,this._e=N+this._e|0},s.prototype._hash=function(){var c=r.allocUnsafe(20);return c.writeInt32BE(this._a|0,0),c.writeInt32BE(this._b|0,4),c.writeInt32BE(this._c|0,8),c.writeInt32BE(this._d|0,12),c.writeInt32BE(this._e|0,16),c},mh=s,mh}i(dP,"requireSha1");var gh,dw;function S7(){if(dw)return gh;dw=1;var e=Lt(),t=ws(),r=At().Buffer,a=[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=new Array(64);function s(){this.init(),this._w=n,t.call(this,64,56)}i(s,"Sha256"),e(s,t),s.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 o(y,b,x){return x^y&(b^x)}i(o,"ch");function h(y,b,x){return y&b|x&(y|b)}i(h,"maj");function p(y){return(y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10)}i(p,"sigma0");function v(y){return(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7)}i(v,"sigma1");function c(y){return(y>>>7|y<<25)^(y>>>18|y<<14)^y>>>3}i(c,"gamma0");function d(y){return(y>>>17|y<<15)^(y>>>19|y<<13)^y>>>10}return i(d,"gamma1"),s.prototype._update=function(y){for(var b=this._w,x=this._a|0,k=this._b|0,N=this._c|0,C=this._d|0,R=this._e|0,O=this._f|0,T=this._g|0,P=this._h|0,z=0;z<16;++z)b[z]=y.readInt32BE(z*4);for(;z<64;++z)b[z]=d(b[z-2])+b[z-7]+c(b[z-15])+b[z-16]|0;for(var Z=0;Z<64;++Z){var V=P+v(R)+o(R,O,T)+a[Z]+b[Z]|0,ee=p(x)+h(x,k,N)|0;P=T,T=O,O=R,R=C+V|0,C=N,N=k,k=x,x=V+ee|0}this._a=x+this._a|0,this._b=k+this._b|0,this._c=N+this._c|0,this._d=C+this._d|0,this._e=R+this._e|0,this._f=O+this._f|0,this._g=T+this._g|0,this._h=P+this._h|0},s.prototype._hash=function(){var y=r.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},gh=s,gh}i(S7,"requireSha256");var vh,hw;function hP(){if(hw)return vh;hw=1;var e=Lt(),t=S7(),r=ws(),a=At().Buffer,n=new Array(64);function s(){this.init(),this._w=n,r.call(this,64,56)}return i(s,"Sha224"),e(s,t),s.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},s.prototype._hash=function(){var o=a.allocUnsafe(28);return o.writeInt32BE(this._a,0),o.writeInt32BE(this._b,4),o.writeInt32BE(this._c,8),o.writeInt32BE(this._d,12),o.writeInt32BE(this._e,16),o.writeInt32BE(this._f,20),o.writeInt32BE(this._g,24),o},vh=s,vh}i(hP,"requireSha224");var bh,pw;function M7(){if(pw)return bh;pw=1;var e=Lt(),t=ws(),r=At().Buffer,a=[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=new Array(160);function s(){this.init(),this._w=n,t.call(this,128,112)}i(s,"Sha512"),e(s,t),s.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 o(k,N,C){return C^k&(N^C)}i(o,"Ch");function h(k,N,C){return k&N|C&(k|N)}i(h,"maj");function p(k,N){return(k>>>28|N<<4)^(N>>>2|k<<30)^(N>>>7|k<<25)}i(p,"sigma0");function v(k,N){return(k>>>14|N<<18)^(k>>>18|N<<14)^(N>>>9|k<<23)}i(v,"sigma1");function c(k,N){return(k>>>1|N<<31)^(k>>>8|N<<24)^k>>>7}i(c,"Gamma0");function d(k,N){return(k>>>1|N<<31)^(k>>>8|N<<24)^(k>>>7|N<<25)}i(d,"Gamma0l");function y(k,N){return(k>>>19|N<<13)^(N>>>29|k<<3)^k>>>6}i(y,"Gamma1");function b(k,N){return(k>>>19|N<<13)^(N>>>29|k<<3)^(k>>>6|N<<26)}i(b,"Gamma1l");function x(k,N){return k>>>0<N>>>0?1:0}return i(x,"getCarry"),s.prototype._update=function(k){for(var N=this._w,C=this._ah|0,R=this._bh|0,O=this._ch|0,T=this._dh|0,P=this._eh|0,z=this._fh|0,Z=this._gh|0,V=this._hh|0,ee=this._al|0,$=this._bl|0,F=this._cl|0,u=this._dl|0,g=this._el|0,l=this._fl|0,m=this._gl|0,w=this._hl|0,M=0;M<32;M+=2)N[M]=k.readInt32BE(M*4),N[M+1]=k.readInt32BE(M*4+4);for(;M<160;M+=2){var j=N[M-30],S=N[M-30+1],f=c(j,S),_=d(S,j);j=N[M-4],S=N[M-4+1];var E=y(j,S),I=b(S,j),D=N[M-14],L=N[M-14+1],U=N[M-32],B=N[M-32+1],G=_+L|0,H=f+D+x(G,_)|0;G=G+I|0,H=H+E+x(G,I)|0,G=G+B|0,H=H+U+x(G,B)|0,N[M]=H,N[M+1]=G}for(var K=0;K<160;K+=2){H=N[K],G=N[K+1];var _e=h(C,R,O),se=h(ee,$,F),ae=p(C,ee),ve=p(ee,C),q=v(P,g),ne=v(g,P),X=a[K],W=a[K+1],le=o(P,z,Z),ke=o(g,l,m),be=w+ne|0,fe=V+q+x(be,w)|0;be=be+ke|0,fe=fe+le+x(be,ke)|0,be=be+W|0,fe=fe+X+x(be,W)|0,be=be+G|0,fe=fe+H+x(be,G)|0;var Q=ve+se|0,Y=ae+_e+x(Q,ve)|0;V=Z,w=m,Z=z,m=l,z=P,l=g,g=u+be|0,P=T+fe+x(g,u)|0,T=O,u=F,O=R,F=$,R=C,$=ee,ee=be+Q|0,C=fe+Y+x(ee,be)|0}this._al=this._al+ee|0,this._bl=this._bl+$|0,this._cl=this._cl+F|0,this._dl=this._dl+u|0,this._el=this._el+g|0,this._fl=this._fl+l|0,this._gl=this._gl+m|0,this._hl=this._hl+w|0,this._ah=this._ah+C+x(this._al,ee)|0,this._bh=this._bh+R+x(this._bl,$)|0,this._ch=this._ch+O+x(this._cl,F)|0,this._dh=this._dh+T+x(this._dl,u)|0,this._eh=this._eh+P+x(this._el,g)|0,this._fh=this._fh+z+x(this._fl,l)|0,this._gh=this._gh+Z+x(this._gl,m)|0,this._hh=this._hh+V+x(this._hl,w)|0},s.prototype._hash=function(){var k=r.allocUnsafe(64);function N(C,R,O){k.writeInt32BE(C,O),k.writeInt32BE(R,O+4)}return i(N,"writeInt64BE"),N(this._ah,this._al,0),N(this._bh,this._bl,8),N(this._ch,this._cl,16),N(this._dh,this._dl,24),N(this._eh,this._el,32),N(this._fh,this._fl,40),N(this._gh,this._gl,48),N(this._hh,this._hl,56),k},bh=s,bh}i(M7,"requireSha512");var yh,mw;function pP(){if(mw)return yh;mw=1;var e=Lt(),t=M7(),r=ws(),a=At().Buffer,n=new Array(160);function s(){this.init(),this._w=n,r.call(this,128,112)}return i(s,"Sha384"),e(s,t),s.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},s.prototype._hash=function(){var o=a.allocUnsafe(48);function h(p,v,c){o.writeInt32BE(p,c),o.writeInt32BE(v,c+4)}return i(h,"writeInt64BE"),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),o},yh=s,yh}i(pP,"requireSha384");var gw;function Ev(){return gw||(gw=1,(function(e){e.exports=i(function(r){var a=r.toLowerCase(),n=e.exports[a];if(!n)throw new Error(a+" is not supported (we accept pull requests)");return new n},"SHA"),e.exports.sha=cP(),e.exports.sha1=dP(),e.exports.sha224=hP(),e.exports.sha256=S7(),e.exports.sha384=pP(),e.exports.sha512=M7()})(dh)),dh.exports}i(Ev,"requireSha_js");var wh,vw;function Zn(){if(vw)return wh;vw=1;var e=At().Buffer,t=Ai.Transform,r=Ym().StringDecoder,a=Lt(),n=zf();function s(o){t.call(this),this.hashMode=typeof o=="string",this.hashMode?this[o]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return i(s,"CipherBase"),a(s,t),s.prototype.update=function(o,h,p){var v=n(o,h),c=this._update(v);return this.hashMode?this:(p&&(c=this._toString(c,p)),c)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(o,h,p){var v;try{this.hashMode?this._update(o):this.push(this._update(o))}catch(c){v=c}finally{p(v)}},s.prototype._flush=function(o){var h;try{this.push(this.__final())}catch(p){h=p}o(h)},s.prototype._finalOrDigest=function(o){var h=this.__final()||e.alloc(0);return o&&(h=this._toString(h,o,!0)),h},s.prototype._toString=function(o,h,p){if(this._decoder||(this._decoder=new r(h),this._encoding=h),this._encoding!==h)throw new Error("can’t switch encodings");var v=this._decoder.write(o);return p&&(v+=this._decoder.end()),v},wh=s,wh}i(Zn,"requireCipherBase");var xh,bw;function rl(){if(bw)return xh;bw=1;var e=Lt(),t=yv(),r=Mv(),a=Ev(),n=Zn();function s(o){n.call(this,"digest"),this._hash=o}return i(s,"Hash"),e(s,n),s.prototype._update=function(o){this._hash.update(o)},s.prototype._final=function(){return this._hash.digest()},xh=i(function(h){return h=h.toLowerCase(),h==="md5"?new t:h==="rmd160"||h==="ripemd160"?new r:new s(a(h))},"createHash"),xh}i(rl,"requireBrowser$9");var _h,yw;function mP(){if(yw)return _h;yw=1;var e=Lt(),t=At().Buffer,r=Zn(),a=t.alloc(128),n=64;function s(o,h){r.call(this,"digest"),typeof h=="string"&&(h=t.from(h)),this._alg=o,this._key=h,h.length>n?h=o(h):h.length<n&&(h=t.concat([h,a],n));for(var p=this._ipad=t.allocUnsafe(n),v=this._opad=t.allocUnsafe(n),c=0;c<n;c++)p[c]=h[c]^54,v[c]=h[c]^92;this._hash=[p]}return i(s,"Hmac"),e(s,r),s.prototype._update=function(o){this._hash.push(o)},s.prototype._final=function(){var o=this._alg(t.concat(this._hash));return this._alg(t.concat([this._opad,o]))},_h=s,_h}i(mP,"requireLegacy");var Sh,ww;function E7(){if(ww)return Sh;ww=1;var e=yv();return Sh=i(function(t){return new e().update(t).digest()},"md5"),Sh}i(E7,"requireMd5");var Mh,xw;function k7(){if(xw)return Mh;xw=1;var e=Lt(),t=mP(),r=Zn(),a=At().Buffer,n=E7(),s=Mv(),o=Ev(),h=a.alloc(128);function p(v,c){r.call(this,"digest"),typeof c=="string"&&(c=a.from(c));var d=v==="sha512"||v==="sha384"?128:64;if(this._alg=v,this._key=c,c.length>d){var y=v==="rmd160"?new s:o(v);c=y.update(c).digest()}else c.length<d&&(c=a.concat([c,h],d));for(var b=this._ipad=a.allocUnsafe(d),x=this._opad=a.allocUnsafe(d),k=0;k<d;k++)b[k]=c[k]^54,x[k]=c[k]^92;this._hash=v==="rmd160"?new s:o(v),this._hash.update(b)}return i(p,"Hmac"),e(p,r),p.prototype._update=function(v){this._hash.update(v)},p.prototype._final=function(){var v=this._hash.digest(),c=this._alg==="rmd160"?new s:o(this._alg);return c.update(this._opad).update(v).digest()},Mh=i(function(c,d){return c=c.toLowerCase(),c==="rmd160"||c==="ripemd160"?new p("rmd160",d):c==="md5"?new t(n,d):new p(c,d)},"createHmac"),Mh}i(k7,"requireBrowser$8");const gP={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},vP={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},bP={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},yP={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},wP={sign:"ecdsa",hash:"sha256",id:""},xP={sign:"ecdsa",hash:"sha224",id:""},_P={sign:"ecdsa",hash:"sha384",id:""},SP={sign:"ecdsa",hash:"sha512",id:""},MP={sign:"dsa",hash:"sha1",id:""},EP={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},kP={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},j7={sha224WithRSAEncryption:gP,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:vP,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:bP,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:yP,"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:wP,sha224:xP,sha384:_P,sha512:SP,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:MP,"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:EP,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:kP,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var Eh,_w;function jP(){return _w||(_w=1,Eh=j7),Eh}i(jP,"requireAlgos");var Tl={},kh,Sw;function A7(){if(Sw)return kh;Sw=1;var e=isFinite,t=Math.pow(2,30)-1;return kh=i(function(r,a){if(typeof r!="number")throw new TypeError("Iterations not a number");if(r<0||!e(r))throw new TypeError("Bad iterations");if(typeof a!="number")throw new TypeError("Key length not a number");if(a<0||a>t||a!==a)throw new TypeError("Bad key length")},"precondition"),kh}i(A7,"requirePrecondition");var jh,Mw;function N7(){if(Mw)return jh;Mw=1;var e;if(globalThis.process&&globalThis.process.browser)e="utf-8";else if(globalThis.process&&globalThis.process.version){var t=parseInt(process.version.split(".")[0].slice(1),10);e=t>=6?"utf-8":"binary"}else e="utf-8";return jh=e,jh}i(N7,"requireDefaultEncoding");var Ah,Ew;function I7(){if(Ew)return Ah;Ew=1;var e=At().Buffer,t=zf(),r=typeof Uint8Array<"u",a=r&&typeof ArrayBuffer<"u",n=a&&ArrayBuffer.isView;return Ah=i(function(s,o,h){if(typeof s=="string"||e.isBuffer(s)||r&&s instanceof Uint8Array||n&&n(s))return t(s,o);throw new TypeError(h+" must be a string, a Buffer, a Uint8Array, or a DataView")},"toBuffer_1"),Ah}i(I7,"requireToBuffer");var Nh,kw;function C7(){if(kw)return Nh;kw=1;var e=E7(),t=Mv(),r=Ev(),a=At().Buffer,n=A7(),s=N7(),o=I7(),h=a.alloc(128),p={__proto__:null,md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,"sha512-256":32,ripemd160:20,rmd160:20},v={__proto__:null,"sha-1":"sha1","sha-224":"sha224","sha-256":"sha256","sha-384":"sha384","sha-512":"sha512","ripemd-160":"ripemd160"};function c(x){return new t().update(x).digest()}i(c,"rmd160Func");function d(x){function k(N){return r(x).update(N).digest()}return i(k,"shaFunc"),x==="rmd160"||x==="ripemd160"?c:x==="md5"?e:k}i(d,"getDigest");function y(x,k,N){var C=d(x),R=x==="sha512"||x==="sha384"?128:64;k.length>R?k=C(k):k.length<R&&(k=a.concat([k,h],R));for(var O=a.allocUnsafe(R+p[x]),T=a.allocUnsafe(R+p[x]),P=0;P<R;P++)O[P]=k[P]^54,T[P]=k[P]^92;var z=a.allocUnsafe(R+N+4);O.copy(z,0,0,R),this.ipad1=z,this.ipad2=O,this.opad=T,this.alg=x,this.blocksize=R,this.hash=C,this.size=p[x]}i(y,"Hmac"),y.prototype.run=function(x,k){x.copy(k,this.blocksize);var N=this.hash(k);return N.copy(this.opad,this.blocksize),this.hash(this.opad)};function b(x,k,N,C,R){n(N,C),x=o(x,s,"Password"),k=o(k,s,"Salt");var O=(R||"sha1").toLowerCase(),T=v[O]||O,P=p[T];if(typeof P!="number"||!P)throw new TypeError("Digest algorithm not supported: "+R);var z=new y(T,x,k.length),Z=a.allocUnsafe(C),V=a.allocUnsafe(k.length+4);k.copy(V,0,0,k.length);for(var ee=0,$=P,F=Math.ceil(C/$),u=1;u<=F;u++){V.writeUInt32BE(u,k.length);for(var g=z.run(V,z.ipad1),l=g,m=1;m<N;m++){l=z.run(l,z.ipad2);for(var w=0;w<$;w++)g[w]^=l[w]}g.copy(Z,ee),ee+=$}return Z}return i(b,"pbkdf2"),Nh=b,Nh}i(C7,"requireSyncBrowser");var Ih,jw;function AP(){if(jw)return Ih;jw=1;var e=At().Buffer,t=A7(),r=N7(),a=C7(),n=I7(),s,o=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"},p=[],v;function c(){return v||(globalThis.process&&globalThis.process.nextTick?v=globalThis.process.nextTick:globalThis.queueMicrotask?v=globalThis.queueMicrotask:globalThis.setImmediate?v=globalThis.setImmediate:v=globalThis.setTimeout,v)}i(c,"getNextTick");function d(x,k,N,C,R){return o.importKey("raw",x,{name:"PBKDF2"},!1,["deriveBits"]).then(function(O){return o.deriveBits({name:"PBKDF2",salt:k,iterations:N,hash:{name:R}},O,C<<3)}).then(function(O){return e.from(O)})}i(d,"browserPbkdf2");function y(x){if(globalThis.process&&!globalThis.process.browser||!o||!o.importKey||!o.deriveBits)return Promise.resolve(!1);if(p[x]!==void 0)return p[x];s=s||e.alloc(8);var k=d(s,s,10,128,x).then(function(){return!0},function(){return!1});return p[x]=k,k}i(y,"checkNative");function b(x,k){x.then(function(N){c()(function(){k(null,N)})},function(N){c()(function(){k(N)})})}return i(b,"resolvePromise"),Ih=i(function(x,k,N,C,R,O){if(typeof R=="function"&&(O=R,R=void 0),t(N,C),x=n(x,r,"Password"),k=n(k,r,"Salt"),typeof O!="function")throw new Error("No callback provided to pbkdf2");R=R||"sha1";var T=h[R.toLowerCase()];if(!T||typeof globalThis.Promise!="function"){c()(function(){var P;try{P=a(x,k,N,C,R)}catch(z){O(z);return}O(null,P)});return}b(y(T).then(function(P){return P?d(x,k,N,C,T):a(x,k,N,C,R)}),O)},"async"),Ih}i(AP,"requireAsync");var Aw;function R7(){return Aw||(Aw=1,Tl.pbkdf2=AP(),Tl.pbkdf2Sync=C7()),Tl}i(R7,"requireBrowser$7");var ai={},Wn={},Vr={},Nw;function O7(){if(Nw)return Vr;Nw=1,Vr.readUInt32BE=i(function(n,s){var o=n[0+s]<<24|n[1+s]<<16|n[2+s]<<8|n[3+s];return o>>>0},"readUInt32BE"),Vr.writeUInt32BE=i(function(n,s,o){n[0+o]=s>>>24,n[1+o]=s>>>16&255,n[2+o]=s>>>8&255,n[3+o]=s&255},"writeUInt32BE"),Vr.ip=i(function(n,s,o,h){for(var p=0,v=0,c=6;c>=0;c-=2){for(var d=0;d<=24;d+=8)p<<=1,p|=s>>>d+c&1;for(var d=0;d<=24;d+=8)p<<=1,p|=n>>>d+c&1}for(var c=6;c>=0;c-=2){for(var d=1;d<=25;d+=8)v<<=1,v|=s>>>d+c&1;for(var d=1;d<=25;d+=8)v<<=1,v|=n>>>d+c&1}o[h+0]=p>>>0,o[h+1]=v>>>0},"ip"),Vr.rip=i(function(n,s,o,h){for(var p=0,v=0,c=0;c<4;c++)for(var d=24;d>=0;d-=8)p<<=1,p|=s>>>d+c&1,p<<=1,p|=n>>>d+c&1;for(var c=4;c<8;c++)for(var d=24;d>=0;d-=8)v<<=1,v|=s>>>d+c&1,v<<=1,v|=n>>>d+c&1;o[h+0]=p>>>0,o[h+1]=v>>>0},"rip"),Vr.pc1=i(function(n,s,o,h){for(var p=0,v=0,c=7;c>=5;c--){for(var d=0;d<=24;d+=8)p<<=1,p|=s>>d+c&1;for(var d=0;d<=24;d+=8)p<<=1,p|=n>>d+c&1}for(var d=0;d<=24;d+=8)p<<=1,p|=s>>d+c&1;for(var c=1;c<=3;c++){for(var d=0;d<=24;d+=8)v<<=1,v|=s>>d+c&1;for(var d=0;d<=24;d+=8)v<<=1,v|=n>>d+c&1}for(var d=0;d<=24;d+=8)v<<=1,v|=n>>d+c&1;o[h+0]=p>>>0,o[h+1]=v>>>0},"pc1"),Vr.r28shl=i(function(n,s){return n<<s&268435455|n>>>28-s},"r28shl");var e=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];Vr.pc2=i(function(n,s,o,h){for(var p=0,v=0,c=e.length>>>1,d=0;d<c;d++)p<<=1,p|=n>>>e[d]&1;for(var d=c;d<e.length;d++)v<<=1,v|=s>>>e[d]&1;o[h+0]=p>>>0,o[h+1]=v>>>0},"pc2"),Vr.expand=i(function(n,s,o){var h=0,p=0;h=(n&1)<<5|n>>>27;for(var v=23;v>=15;v-=4)h<<=6,h|=n>>>v&63;for(var v=11;v>=3;v-=4)p|=n>>>v&63,p<<=6;p|=(n&31)<<1|n>>>31,s[o+0]=h>>>0,s[o+1]=p>>>0},"expand");var t=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];Vr.substitute=i(function(n,s){for(var o=0,h=0;h<4;h++){var p=n>>>18-h*6&63,v=t[h*64+p];o<<=4,o|=v}for(var h=0;h<4;h++){var p=s>>>18-h*6&63,v=t[256+h*64+p];o<<=4,o|=v}return o>>>0},"substitute");var r=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return Vr.permute=i(function(n){for(var s=0,o=0;o<r.length;o++)s<<=1,s|=n>>>r[o]&1;return s>>>0},"permute"),Vr.padSplit=i(function(n,s,o){for(var h=n.toString(2);h.length<s;)h="0"+h;for(var p=[],v=0;v<s;v+=o)p.push(h.slice(v,v+o));return p.join(" ")},"padSplit"),Vr}i(O7,"requireUtils$3");var Ch,Iw;function ci(){if(Iw)return Ch;Iw=1,Ch=e;function e(t,r){if(!t)throw new Error(r||"Assertion failed")}return i(e,"assert"),e.equal=i(function(r,a,n){if(r!=a)throw new Error(n||"Assertion failed: "+r+" != "+a)},"assertEqual"),Ch}i(ci,"requireMinimalisticAssert");var Rh,Cw;function kv(){if(Cw)return Rh;Cw=1;var e=ci();function t(r){this.options=r,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0,this.padding=r.padding!==!1}return i(t,"Cipher"),Rh=t,t.prototype._init=i(function(){},"_init"),t.prototype.update=i(function(a){return a.length===0?[]:this.type==="decrypt"?this._updateDecrypt(a):this._updateEncrypt(a)},"update"),t.prototype._buffer=i(function(a,n){for(var s=Math.min(this.buffer.length-this.bufferOff,a.length-n),o=0;o<s;o++)this.buffer[this.bufferOff+o]=a[n+o];return this.bufferOff+=s,s},"_buffer"),t.prototype._flushBuffer=i(function(a,n){return this._update(this.buffer,0,a,n),this.bufferOff=0,this.blockSize},"_flushBuffer"),t.prototype._updateEncrypt=i(function(a){var n=0,s=0,o=(this.bufferOff+a.length)/this.blockSize|0,h=new Array(o*this.blockSize);this.bufferOff!==0&&(n+=this._buffer(a,n),this.bufferOff===this.buffer.length&&(s+=this._flushBuffer(h,s)));for(var p=a.length-(a.length-n)%this.blockSize;n<p;n+=this.blockSize)this._update(a,n,h,s),s+=this.blockSize;for(;n<a.length;n++,this.bufferOff++)this.buffer[this.bufferOff]=a[n];return h},"_updateEncrypt"),t.prototype._updateDecrypt=i(function(a){for(var n=0,s=0,o=Math.ceil((this.bufferOff+a.length)/this.blockSize)-1,h=new Array(o*this.blockSize);o>0;o--)n+=this._buffer(a,n),s+=this._flushBuffer(h,s);return n+=this._buffer(a,n),h},"_updateDecrypt"),t.prototype.final=i(function(a){var n;a&&(n=this.update(a));var s;return this.type==="encrypt"?s=this._finalEncrypt():s=this._finalDecrypt(),n?n.concat(s):s},"final"),t.prototype._pad=i(function(a,n){if(n===0)return!1;for(;n<a.length;)a[n++]=0;return!0},"_pad"),t.prototype._finalEncrypt=i(function(){if(!this._pad(this.buffer,this.bufferOff))return[];var a=new Array(this.blockSize);return this._update(this.buffer,0,a,0),a},"_finalEncrypt"),t.prototype._unpad=i(function(a){return a},"_unpad"),t.prototype._finalDecrypt=i(function(){e.equal(this.bufferOff,this.blockSize,"Not enough data to decrypt");var a=new Array(this.blockSize);return this._flushBuffer(a,0),this._unpad(a)},"_finalDecrypt"),Rh}i(kv,"requireCipher");var Oh,Rw;function T7(){if(Rw)return Oh;Rw=1;var e=ci(),t=Lt(),r=O7(),a=kv();function n(){this.tmp=new Array(2),this.keys=null}i(n,"DESState");function s(h){a.call(this,h);var p=new n;this._desState=p,this.deriveKeys(p,h.key)}i(s,"DES"),t(s,a),Oh=s,s.create=i(function(p){return new s(p)},"create");var o=[1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1];return s.prototype.deriveKeys=i(function(p,v){p.keys=new Array(32),e.equal(v.length,this.blockSize,"Invalid key length");var c=r.readUInt32BE(v,0),d=r.readUInt32BE(v,4);r.pc1(c,d,p.tmp,0),c=p.tmp[0],d=p.tmp[1];for(var y=0;y<p.keys.length;y+=2){var b=o[y>>>1];c=r.r28shl(c,b),d=r.r28shl(d,b),r.pc2(c,d,p.keys,y)}},"deriveKeys"),s.prototype._update=i(function(p,v,c,d){var y=this._desState,b=r.readUInt32BE(p,v),x=r.readUInt32BE(p,v+4);r.ip(b,x,y.tmp,0),b=y.tmp[0],x=y.tmp[1],this.type==="encrypt"?this._encrypt(y,b,x,y.tmp,0):this._decrypt(y,b,x,y.tmp,0),b=y.tmp[0],x=y.tmp[1],r.writeUInt32BE(c,b,d),r.writeUInt32BE(c,x,d+4)},"_update"),s.prototype._pad=i(function(p,v){if(this.padding===!1)return!1;for(var c=p.length-v,d=v;d<p.length;d++)p[d]=c;return!0},"_pad"),s.prototype._unpad=i(function(p){if(this.padding===!1)return p;for(var v=p[p.length-1],c=p.length-v;c<p.length;c++)e.equal(p[c],v);return p.slice(0,p.length-v)},"_unpad"),s.prototype._encrypt=i(function(p,v,c,d,y){for(var b=v,x=c,k=0;k<p.keys.length;k+=2){var N=p.keys[k],C=p.keys[k+1];r.expand(x,p.tmp,0),N^=p.tmp[0],C^=p.tmp[1];var R=r.substitute(N,C),O=r.permute(R),T=x;x=(b^O)>>>0,b=T}r.rip(x,b,d,y)},"_encrypt"),s.prototype._decrypt=i(function(p,v,c,d,y){for(var b=c,x=v,k=p.keys.length-2;k>=0;k-=2){var N=p.keys[k],C=p.keys[k+1];r.expand(b,p.tmp,0),N^=p.tmp[0],C^=p.tmp[1];var R=r.substitute(N,C),O=r.permute(R),T=b;b=(x^O)>>>0,x=T}r.rip(b,x,d,y)},"_decrypt"),Oh}i(T7,"requireDes$1");var Th={},Ow;function NP(){if(Ow)return Th;Ow=1;var e=ci(),t=Lt(),r={};function a(s){e.equal(s.length,8,"Invalid IV length"),this.iv=new Array(8);for(var o=0;o<this.iv.length;o++)this.iv[o]=s[o]}i(a,"CBCState");function n(s){function o(c){s.call(this,c),this._cbcInit()}i(o,"CBC"),t(o,s);for(var h=Object.keys(r),p=0;p<h.length;p++){var v=h[p];o.prototype[v]=r[v]}return o.create=i(function(d){return new o(d)},"create"),o}return i(n,"instantiate"),Th.instantiate=n,r._cbcInit=i(function(){var o=new a(this.options.iv);this._cbcState=o},"_cbcInit"),r._update=i(function(o,h,p,v){var c=this._cbcState,d=this.constructor.super_.prototype,y=c.iv;if(this.type==="encrypt"){for(var b=0;b<this.blockSize;b++)y[b]^=o[h+b];d._update.call(this,y,0,p,v);for(var b=0;b<this.blockSize;b++)y[b]=p[v+b]}else{d._update.call(this,o,h,p,v);for(var b=0;b<this.blockSize;b++)p[v+b]^=y[b];for(var b=0;b<this.blockSize;b++)y[b]=o[h+b]}},"_update"),Th}i(NP,"requireCbc$1");var Ph,Tw;function IP(){if(Tw)return Ph;Tw=1;var e=ci(),t=Lt(),r=kv(),a=T7();function n(o,h){e.equal(h.length,24,"Invalid key length");var p=h.slice(0,8),v=h.slice(8,16),c=h.slice(16,24);o==="encrypt"?this.ciphers=[a.create({type:"encrypt",key:p}),a.create({type:"decrypt",key:v}),a.create({type:"encrypt",key:c})]:this.ciphers=[a.create({type:"decrypt",key:c}),a.create({type:"encrypt",key:v}),a.create({type:"decrypt",key:p})]}i(n,"EDEState");function s(o){r.call(this,o);var h=new n(this.type,this.options.key);this._edeState=h}return i(s,"EDE"),t(s,r),Ph=s,s.create=i(function(h){return new s(h)},"create"),s.prototype._update=i(function(h,p,v,c){var d=this._edeState;d.ciphers[0]._update(h,p,v,c),d.ciphers[1]._update(v,c,v,c),d.ciphers[2]._update(v,c,v,c)},"_update"),s.prototype._pad=a.prototype._pad,s.prototype._unpad=a.prototype._unpad,Ph}i(IP,"requireEde");var Pw;function CP(){return Pw||(Pw=1,Wn.utils=O7(),Wn.Cipher=kv(),Wn.DES=T7(),Wn.CBC=NP(),Wn.EDE=IP()),Wn}i(CP,"requireDes");var Dh,Dw;function RP(){if(Dw)return Dh;Dw=1;var e=Zn(),t=CP(),r=Lt(),a=At().Buffer,n={"des-ede3-cbc":t.CBC.instantiate(t.EDE),"des-ede3":t.EDE,"des-ede-cbc":t.CBC.instantiate(t.EDE),"des-ede":t.EDE,"des-cbc":t.CBC.instantiate(t.DES),"des-ecb":t.DES};n.des=n["des-cbc"],n.des3=n["des-ede3-cbc"],Dh=s,r(s,e);function s(o){e.call(this);var h=o.mode.toLowerCase(),p=n[h],v;o.decrypt?v="decrypt":v="encrypt";var c=o.key;a.isBuffer(c)||(c=a.from(c)),(h==="des-ede"||h==="des-ede-cbc")&&(c=a.concat([c,c.slice(0,8)]));var d=o.iv;a.isBuffer(d)||(d=a.from(d)),this._des=p.create({key:c,iv:d,type:v})}return i(s,"DES"),s.prototype._update=function(o){return a.from(this._des.update(o))},s.prototype._final=function(){return a.from(this._des.final())},Dh}i(RP,"requireBrowserifyDes");var si={},Pl={},Dl={},Lw;function OP(){return Lw||(Lw=1,Dl.encrypt=function(e,t){return e._cipher.encryptBlock(t)},Dl.decrypt=function(e,t){return e._cipher.decryptBlock(t)}),Dl}i(OP,"requireEcb");var Ll={},Lh,Bw;function il(){return Bw||(Bw=1,Lh=i(function(t,r){for(var a=Math.min(t.length,r.length),n=new Buffer(a),s=0;s<a;++s)n[s]=t[s]^r[s];return n},"xor")),Lh}i(il,"requireBufferXor");var zw;function TP(){if(zw)return Ll;zw=1;var e=il();return Ll.encrypt=function(t,r){var a=e(r,t._prev);return t._prev=t._cipher.encryptBlock(a),t._prev},Ll.decrypt=function(t,r){var a=t._prev;t._prev=r;var n=t._cipher.decryptBlock(r);return e(n,a)},Ll}i(TP,"requireCbc");var Bh={},Uw;function PP(){if(Uw)return Bh;Uw=1;var e=At().Buffer,t=il();function r(a,n,s){var o=n.length,h=t(n,a._cache);return a._cache=a._cache.slice(o),a._prev=e.concat([a._prev,s?n:h]),h}return i(r,"encryptStart"),Bh.encrypt=function(a,n,s){for(var o=e.allocUnsafe(0),h;n.length;)if(a._cache.length===0&&(a._cache=a._cipher.encryptBlock(a._prev),a._prev=e.allocUnsafe(0)),a._cache.length<=n.length)h=a._cache.length,o=e.concat([o,r(a,n.slice(0,h),s)]),n=n.slice(h);else{o=e.concat([o,r(a,n,s)]);break}return o},Bh}i(PP,"requireCfb");var zh={},Fw;function DP(){if(Fw)return zh;Fw=1;var e=At().Buffer;function t(r,a,n){var s=r._cipher.encryptBlock(r._prev),o=s[0]^a;return r._prev=e.concat([r._prev.slice(1),e.from([n?a:o])]),o}return i(t,"encryptByte"),zh.encrypt=function(r,a,n){for(var s=a.length,o=e.allocUnsafe(s),h=-1;++h<s;)o[h]=t(r,a[h],n);return o},zh}i(DP,"requireCfb8");var Uh={},$w;function LP(){if($w)return Uh;$w=1;var e=At().Buffer;function t(a,n,s){for(var o,h=-1,p=8,v=0,c,d;++h<p;)o=a._cipher.encryptBlock(a._prev),c=n&1<<7-h?128:0,d=o[0]^c,v+=(d&128)>>h%8,a._prev=r(a._prev,s?c:d);return v}i(t,"encryptByte");function r(a,n){var s=a.length,o=-1,h=e.allocUnsafe(a.length);for(a=e.concat([a,e.from([n])]);++o<s;)h[o]=a[o]<<1|a[o+1]>>7;return h}return i(r,"shiftIn"),Uh.encrypt=function(a,n,s){for(var o=n.length,h=e.allocUnsafe(o),p=-1;++p<o;)h[p]=t(a,n[p],s);return h},Uh}i(LP,"requireCfb1");var Fh={},Gw;function BP(){if(Gw)return Fh;Gw=1;var e=il();function t(r){return r._prev=r._cipher.encryptBlock(r._prev),r._prev}return i(t,"getBlock"),Fh.encrypt=function(r,a){for(;r._cache.length<a.length;)r._cache=Buffer.concat([r._cache,t(r)]);var n=r._cache.slice(0,a.length);return r._cache=r._cache.slice(a.length),e(a,n)},Fh}i(BP,"requireOfb");var $h={},Gh,Vw;function P7(){if(Vw)return Gh;Vw=1;function e(t){for(var r=t.length,a;r--;)if(a=t.readUInt8(r),a===255)t.writeUInt8(0,r);else{a++,t.writeUInt8(a,r);break}}return i(e,"incr32"),Gh=e,Gh}i(P7,"requireIncr32");var Zw;function Hw(){if(Zw)return $h;Zw=1;var e=il(),t=At().Buffer,r=P7();function a(s){var o=s._cipher.encryptBlockRaw(s._prev);return r(s._prev),o}i(a,"getBlock");var n=16;return $h.encrypt=function(s,o){var h=Math.ceil(o.length/n),p=s._cache.length;s._cache=t.concat([s._cache,t.allocUnsafe(h*n)]);for(var v=0;v<h;v++){var c=a(s),d=p+v*n;s._cache.writeUInt32BE(c[0],d+0),s._cache.writeUInt32BE(c[1],d+4),s._cache.writeUInt32BE(c[2],d+8),s._cache.writeUInt32BE(c[3],d+12)}var y=s._cache.slice(0,o.length);return s._cache=s._cache.slice(o.length),e(o,y)},$h}i(Hw,"requireCtr");const zP={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},UP={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},FP={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},D7={"aes-128-ecb":{cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},"aes-192-ecb":{cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},"aes-256-ecb":{cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},"aes-128-cbc":{cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},"aes-192-cbc":{cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},"aes-256-cbc":{cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},aes128:zP,aes192:UP,aes256:FP,"aes-128-cfb":{cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},"aes-192-cfb":{cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},"aes-256-cfb":{cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},"aes-128-cfb8":{cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},"aes-192-cfb8":{cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},"aes-256-cfb8":{cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},"aes-128-cfb1":{cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},"aes-192-cfb1":{cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},"aes-256-cfb1":{cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},"aes-128-ofb":{cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},"aes-192-ofb":{cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},"aes-256-ofb":{cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},"aes-128-ctr":{cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},"aes-192-ctr":{cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},"aes-256-ctr":{cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},"aes-128-gcm":{cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},"aes-192-gcm":{cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},"aes-256-gcm":{cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}};var Vh,Jw;function jv(){if(Jw)return Vh;Jw=1;var e={ECB:OP(),CBC:TP(),CFB:PP(),CFB8:DP(),CFB1:LP(),OFB:BP(),CTR:Hw(),GCM:Hw()},t=D7;for(var r in t)t[r].module=e[t[r].mode];return Vh=t,Vh}i(jv,"requireModes$1");var Zh={},qw;function Ff(){if(qw)return Zh;qw=1;var e=At().Buffer;function t(h){e.isBuffer(h)||(h=e.from(h));for(var p=h.length/4|0,v=new Array(p),c=0;c<p;c++)v[c]=h.readUInt32BE(c*4);return v}i(t,"asUInt32Array");function r(h){for(var p=0;p<h.length;h++)h[p]=0}i(r,"scrubVec");function a(h,p,v,c,d){for(var y=v[0],b=v[1],x=v[2],k=v[3],N=h[0]^p[0],C=h[1]^p[1],R=h[2]^p[2],O=h[3]^p[3],T,P,z,Z,V=4,ee=1;ee<d;ee++)T=y[N>>>24]^b[C>>>16&255]^x[R>>>8&255]^k[O&255]^p[V++],P=y[C>>>24]^b[R>>>16&255]^x[O>>>8&255]^k[N&255]^p[V++],z=y[R>>>24]^b[O>>>16&255]^x[N>>>8&255]^k[C&255]^p[V++],Z=y[O>>>24]^b[N>>>16&255]^x[C>>>8&255]^k[R&255]^p[V++],N=T,C=P,R=z,O=Z;return T=(c[N>>>24]<<24|c[C>>>16&255]<<16|c[R>>>8&255]<<8|c[O&255])^p[V++],P=(c[C>>>24]<<24|c[R>>>16&255]<<16|c[O>>>8&255]<<8|c[N&255])^p[V++],z=(c[R>>>24]<<24|c[O>>>16&255]<<16|c[N>>>8&255]<<8|c[C&255])^p[V++],Z=(c[O>>>24]<<24|c[N>>>16&255]<<16|c[C>>>8&255]<<8|c[R&255])^p[V++],T=T>>>0,P=P>>>0,z=z>>>0,Z=Z>>>0,[T,P,z,Z]}i(a,"cryptBlock");var n=[0,1,2,4,8,16,32,64,128,27,54],s=(function(){for(var h=new Array(256),p=0;p<256;p++)p<128?h[p]=p<<1:h[p]=p<<1^283;for(var v=[],c=[],d=[[],[],[],[]],y=[[],[],[],[]],b=0,x=0,k=0;k<256;++k){var N=x^x<<1^x<<2^x<<3^x<<4;N=N>>>8^N&255^99,v[b]=N,c[N]=b;var C=h[b],R=h[C],O=h[R],T=h[N]*257^N*16843008;d[0][b]=T<<24|T>>>8,d[1][b]=T<<16|T>>>16,d[2][b]=T<<8|T>>>24,d[3][b]=T,T=O*16843009^R*65537^C*257^b*16843008,y[0][N]=T<<24|T>>>8,y[1][N]=T<<16|T>>>16,y[2][N]=T<<8|T>>>24,y[3][N]=T,b===0?b=x=1:(b=C^h[h[h[O^C]]],x^=h[h[x]])}return{SBOX:v,INV_SBOX:c,SUB_MIX:d,INV_SUB_MIX:y}})();function o(h){this._key=t(h),this._reset()}return i(o,"AES"),o.blockSize=16,o.keySize=256/8,o.prototype.blockSize=o.blockSize,o.prototype.keySize=o.keySize,o.prototype._reset=function(){for(var h=this._key,p=h.length,v=p+6,c=(v+1)*4,d=[],y=0;y<p;y++)d[y]=h[y];for(y=p;y<c;y++){var b=d[y-1];y%p===0?(b=b<<8|b>>>24,b=s.SBOX[b>>>24]<<24|s.SBOX[b>>>16&255]<<16|s.SBOX[b>>>8&255]<<8|s.SBOX[b&255],b^=n[y/p|0]<<24):p>6&&y%p===4&&(b=s.SBOX[b>>>24]<<24|s.SBOX[b>>>16&255]<<16|s.SBOX[b>>>8&255]<<8|s.SBOX[b&255]),d[y]=d[y-p]^b}for(var x=[],k=0;k<c;k++){var N=c-k,C=d[N-(k%4?0:4)];k<4||N<=4?x[k]=C:x[k]=s.INV_SUB_MIX[0][s.SBOX[C>>>24]]^s.INV_SUB_MIX[1][s.SBOX[C>>>16&255]]^s.INV_SUB_MIX[2][s.SBOX[C>>>8&255]]^s.INV_SUB_MIX[3][s.SBOX[C&255]]}this._nRounds=v,this._keySchedule=d,this._invKeySchedule=x},o.prototype.encryptBlockRaw=function(h){return h=t(h),a(h,this._keySchedule,s.SUB_MIX,s.SBOX,this._nRounds)},o.prototype.encryptBlock=function(h){var p=this.encryptBlockRaw(h),v=e.allocUnsafe(16);return v.writeUInt32BE(p[0],0),v.writeUInt32BE(p[1],4),v.writeUInt32BE(p[2],8),v.writeUInt32BE(p[3],12),v},o.prototype.decryptBlock=function(h){h=t(h);var p=h[1];h[1]=h[3],h[3]=p;var v=a(h,this._invKeySchedule,s.INV_SUB_MIX,s.INV_SBOX,this._nRounds),c=e.allocUnsafe(16);return c.writeUInt32BE(v[0],0),c.writeUInt32BE(v[3],4),c.writeUInt32BE(v[2],8),c.writeUInt32BE(v[1],12),c},o.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},Zh.AES=o,Zh}i(Ff,"requireAes");var Hh,Kw;function $P(){if(Kw)return Hh;Kw=1;var e=At().Buffer,t=e.alloc(16,0);function r(s){return[s.readUInt32BE(0),s.readUInt32BE(4),s.readUInt32BE(8),s.readUInt32BE(12)]}i(r,"toArray");function a(s){var o=e.allocUnsafe(16);return o.writeUInt32BE(s[0]>>>0,0),o.writeUInt32BE(s[1]>>>0,4),o.writeUInt32BE(s[2]>>>0,8),o.writeUInt32BE(s[3]>>>0,12),o}i(a,"fromArray");function n(s){this.h=s,this.state=e.alloc(16,0),this.cache=e.allocUnsafe(0)}return i(n,"GHASH"),n.prototype.ghash=function(s){for(var o=-1;++o<s.length;)this.state[o]^=s[o];this._multiply()},n.prototype._multiply=function(){for(var s=r(this.h),o=[0,0,0,0],h,p,v,c=-1;++c<128;){for(p=(this.state[~~(c/8)]&1<<7-c%8)!==0,p&&(o[0]^=s[0],o[1]^=s[1],o[2]^=s[2],o[3]^=s[3]),v=(s[3]&1)!==0,h=3;h>0;h--)s[h]=s[h]>>>1|(s[h-1]&1)<<31;s[0]=s[0]>>>1,v&&(s[0]=s[0]^225<<24)}this.state=a(o)},n.prototype.update=function(s){this.cache=e.concat([this.cache,s]);for(var o;this.cache.length>=16;)o=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(o)},n.prototype.final=function(s,o){return this.cache.length&&this.ghash(e.concat([this.cache,t],16)),this.ghash(a([0,s,0,o])),this.state},Hh=n,Hh}i($P,"requireGhash");var Jh,Xw;function L7(){if(Xw)return Jh;Xw=1;var e=Ff(),t=At().Buffer,r=Zn(),a=Lt(),n=$P(),s=il(),o=P7();function h(c,d){var y=0;c.length!==d.length&&y++;for(var b=Math.min(c.length,d.length),x=0;x<b;++x)y+=c[x]^d[x];return y}i(h,"xorTest");function p(c,d,y){if(d.length===12)return c._finID=t.concat([d,t.from([0,0,0,1])]),t.concat([d,t.from([0,0,0,2])]);var b=new n(y),x=d.length,k=x%16;b.update(d),k&&(k=16-k,b.update(t.alloc(k,0))),b.update(t.alloc(8,0));var N=x*8,C=t.alloc(8);C.writeUIntBE(N,0,8),b.update(C),c._finID=b.state;var R=t.from(c._finID);return o(R),R}i(p,"calcIv");function v(c,d,y,b){r.call(this);var x=t.alloc(4,0);this._cipher=new e.AES(d);var k=this._cipher.encryptBlock(x);this._ghash=new n(k),y=p(this,y,k),this._prev=t.from(y),this._cache=t.allocUnsafe(0),this._secCache=t.allocUnsafe(0),this._decrypt=b,this._alen=0,this._len=0,this._mode=c,this._authTag=null,this._called=!1}return i(v,"StreamCipher"),a(v,r),v.prototype._update=function(c){if(!this._called&&this._alen){var d=16-this._alen%16;d<16&&(d=t.alloc(d,0),this._ghash.update(d))}this._called=!0;var y=this._mode.encrypt(this,c);return this._decrypt?this._ghash.update(c):this._ghash.update(y),this._len+=c.length,y},v.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var c=s(this._ghash.final(this._alen*8,this._len*8),this._cipher.encryptBlock(this._finID));if(this._decrypt&&h(c,this._authTag))throw new Error("Unsupported state or unable to authenticate data");this._authTag=c,this._cipher.scrub()},v.prototype.getAuthTag=i(function(){if(this._decrypt||!t.isBuffer(this._authTag))throw new Error("Attempting to get auth tag in unsupported state");return this._authTag},"getAuthTag"),v.prototype.setAuthTag=i(function(d){if(!this._decrypt)throw new Error("Attempting to set auth tag in unsupported state");this._authTag=d},"setAuthTag"),v.prototype.setAAD=i(function(d){if(this._called)throw new Error("Attempting to set AAD in unsupported state");this._ghash.update(d),this._alen+=d.length},"setAAD"),Jh=v,Jh}i(L7,"requireAuthCipher");var qh,Ww;function B7(){if(Ww)return qh;Ww=1;var e=Ff(),t=At().Buffer,r=Zn(),a=Lt();function n(s,o,h,p){r.call(this),this._cipher=new e.AES(o),this._prev=t.from(h),this._cache=t.allocUnsafe(0),this._secCache=t.allocUnsafe(0),this._decrypt=p,this._mode=s}return i(n,"StreamCipher"),a(n,r),n.prototype._update=function(s){return this._mode.encrypt(this,s,this._decrypt)},n.prototype._final=function(){this._cipher.scrub()},qh=n,qh}i(B7,"requireStreamCipher");var Kh,Qw;function $f(){if(Qw)return Kh;Qw=1;var e=At().Buffer,t=yv();function r(a,n,s,o){if(e.isBuffer(a)||(a=e.from(a,"binary")),n&&(e.isBuffer(n)||(n=e.from(n,"binary")),n.length!==8))throw new RangeError("salt should be Buffer with 8 byte length");for(var h=s/8,p=e.alloc(h),v=e.alloc(o||0),c=e.alloc(0);h>0||o>0;){var d=new t;d.update(c),d.update(a),n&&d.update(n),c=d.digest();var y=0;if(h>0){var b=p.length-h;y=Math.min(h,c.length),c.copy(p,b,0,y),h-=y}if(y<c.length&&o>0){var x=v.length-o,k=Math.min(o,c.length-y);c.copy(v,x,y,y+k),o-=k}}return c.fill(0),{key:p,iv:v}}return i(r,"EVP_BytesToKey"),Kh=r,Kh}i($f,"requireEvp_bytestokey");var Yw;function GP(){if(Yw)return Pl;Yw=1;var e=jv(),t=L7(),r=At().Buffer,a=B7(),n=Zn(),s=Ff(),o=$f(),h=Lt();function p(b,x,k){n.call(this),this._cache=new c,this._cipher=new s.AES(x),this._prev=r.from(k),this._mode=b,this._autopadding=!0}i(p,"Cipher"),h(p,n),p.prototype._update=function(b){this._cache.add(b);for(var x,k,N=[];x=this._cache.get();)k=this._mode.encrypt(this,x),N.push(k);return r.concat(N)};var v=r.alloc(16,16);p.prototype._final=function(){var b=this._cache.flush();if(this._autopadding)return b=this._mode.encrypt(this,b),this._cipher.scrub(),b;if(!b.equals(v))throw this._cipher.scrub(),new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(b){return this._autopadding=!!b,this};function c(){this.cache=r.allocUnsafe(0)}i(c,"Splitter"),c.prototype.add=function(b){this.cache=r.concat([this.cache,b])},c.prototype.get=function(){if(this.cache.length>15){var b=this.cache.slice(0,16);return this.cache=this.cache.slice(16),b}return null},c.prototype.flush=function(){for(var b=16-this.cache.length,x=r.allocUnsafe(b),k=-1;++k<b;)x.writeUInt8(b,k);return r.concat([this.cache,x])};function d(b,x,k){var N=e[b.toLowerCase()];if(!N)throw new TypeError("invalid suite type");if(typeof x=="string"&&(x=r.from(x)),x.length!==N.key/8)throw new TypeError("invalid key length "+x.length);if(typeof k=="string"&&(k=r.from(k)),N.mode!=="GCM"&&k.length!==N.iv)throw new TypeError("invalid iv length "+k.length);return N.type==="stream"?new a(N.module,x,k):N.type==="auth"?new t(N.module,x,k):new p(N.module,x,k)}i(d,"createCipheriv");function y(b,x){var k=e[b.toLowerCase()];if(!k)throw new TypeError("invalid suite type");var N=o(x,!1,k.key,k.iv);return d(b,N.key,N.iv)}return i(y,"createCipher"),Pl.createCipheriv=d,Pl.createCipher=y,Pl}i(GP,"requireEncrypter");var Bl={},e6;function VP(){if(e6)return Bl;e6=1;var e=L7(),t=At().Buffer,r=jv(),a=B7(),n=Zn(),s=Ff(),o=$f(),h=Lt();function p(b,x,k){n.call(this),this._cache=new v,this._last=void 0,this._cipher=new s.AES(x),this._prev=t.from(k),this._mode=b,this._autopadding=!0}i(p,"Decipher"),h(p,n),p.prototype._update=function(b){this._cache.add(b);for(var x,k,N=[];x=this._cache.get(this._autopadding);)k=this._mode.decrypt(this,x),N.push(k);return t.concat(N)},p.prototype._final=function(){var b=this._cache.flush();if(this._autopadding)return c(this._mode.decrypt(this,b));if(b)throw new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(b){return this._autopadding=!!b,this};function v(){this.cache=t.allocUnsafe(0)}i(v,"Splitter"),v.prototype.add=function(b){this.cache=t.concat([this.cache,b])},v.prototype.get=function(b){var x;if(b){if(this.cache.length>16)return x=this.cache.slice(0,16),this.cache=this.cache.slice(16),x}else if(this.cache.length>=16)return x=this.cache.slice(0,16),this.cache=this.cache.slice(16),x;return null},v.prototype.flush=function(){if(this.cache.length)return this.cache};function c(b){var x=b[15];if(x<1||x>16)throw new Error("unable to decrypt data");for(var k=-1;++k<x;)if(b[k+(16-x)]!==x)throw new Error("unable to decrypt data");if(x!==16)return b.slice(0,16-x)}i(c,"unpad");function d(b,x,k){var N=r[b.toLowerCase()];if(!N)throw new TypeError("invalid suite type");if(typeof k=="string"&&(k=t.from(k)),N.mode!=="GCM"&&k.length!==N.iv)throw new TypeError("invalid iv length "+k.length);if(typeof x=="string"&&(x=t.from(x)),x.length!==N.key/8)throw new TypeError("invalid key length "+x.length);return N.type==="stream"?new a(N.module,x,k,!0):N.type==="auth"?new e(N.module,x,k,!0):new p(N.module,x,k)}i(d,"createDecipheriv");function y(b,x){var k=r[b.toLowerCase()];if(!k)throw new TypeError("invalid suite type");var N=o(x,!1,k.key,k.iv);return d(b,N.key,N.iv)}return i(y,"createDecipher"),Bl.createDecipher=y,Bl.createDecipheriv=d,Bl}i(VP,"requireDecrypter");var t6;function Av(){if(t6)return si;t6=1;var e=GP(),t=VP(),r=D7;function a(){return Object.keys(r)}return i(a,"getCiphers"),si.createCipher=si.Cipher=e.createCipher,si.createCipheriv=si.Cipheriv=e.createCipheriv,si.createDecipher=si.Decipher=t.createDecipher,si.createDecipheriv=si.Decipheriv=t.createDecipheriv,si.listCiphers=si.getCiphers=a,si}i(Av,"requireBrowser$6");var Xh={},r6;function ZP(){return r6||(r6=1,(function(e){e["des-ecb"]={key:8,iv:0},e["des-cbc"]=e.des={key:8,iv:8},e["des-ede3-cbc"]=e.des3={key:24,iv:8},e["des-ede3"]={key:24,iv:0},e["des-ede-cbc"]={key:16,iv:8},e["des-ede"]={key:16,iv:0}})(Xh)),Xh}i(ZP,"requireModes");var i6;function HP(){if(i6)return ai;i6=1;var e=RP(),t=Av(),r=jv(),a=ZP(),n=$f();function s(c,d){c=c.toLowerCase();var y,b;if(r[c])y=r[c].key,b=r[c].iv;else if(a[c])y=a[c].key*8,b=a[c].iv;else throw new TypeError("invalid suite type");var x=n(d,!1,y,b);return h(c,x.key,x.iv)}i(s,"createCipher");function o(c,d){c=c.toLowerCase();var y,b;if(r[c])y=r[c].key,b=r[c].iv;else if(a[c])y=a[c].key*8,b=a[c].iv;else throw new TypeError("invalid suite type");var x=n(d,!1,y,b);return p(c,x.key,x.iv)}i(o,"createDecipher");function h(c,d,y){if(c=c.toLowerCase(),r[c])return t.createCipheriv(c,d,y);if(a[c])return new e({key:d,iv:y,mode:c});throw new TypeError("invalid suite type")}i(h,"createCipheriv");function p(c,d,y){if(c=c.toLowerCase(),r[c])return t.createDecipheriv(c,d,y);if(a[c])return new e({key:d,iv:y,mode:c,decrypt:!0});throw new TypeError("invalid suite type")}i(p,"createDecipheriv");function v(){return Object.keys(a).concat(t.getCiphers())}return i(v,"getCiphers"),ai.createCipher=ai.Cipher=s,ai.createCipheriv=ai.Cipheriv=h,ai.createDecipher=ai.Decipher=o,ai.createDecipheriv=ai.Decipheriv=p,ai.listCiphers=ai.getCiphers=v,ai}i(HP,"requireBrowser$5");var Qn={},Mu={exports:{}},JP=Mu.exports,n6;function Nr(){return n6||(n6=1,(function(e){(function(t,r){function a(F,u){if(!F)throw new Error(u||"Assertion failed")}i(a,"assert");function n(F,u){F.super_=u;var g=i(function(){},"TempCtor");g.prototype=u.prototype,F.prototype=new g,F.prototype.constructor=F}i(n,"inherits");function s(F,u,g){if(s.isBN(F))return F;this.negative=0,this.words=null,this.length=0,this.red=null,F!==null&&((u==="le"||u==="be")&&(g=u,u=10),this._init(F||0,u||10,g||"be"))}i(s,"BN"),typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Ai.Buffer}catch{}s.isBN=i(function(u){return u instanceof s?!0:u!==null&&typeof u=="object"&&u.constructor.wordSize===s.wordSize&&Array.isArray(u.words)},"isBN"),s.max=i(function(u,g){return u.cmp(g)>0?u:g},"max"),s.min=i(function(u,g){return u.cmp(g)<0?u:g},"min"),s.prototype._init=i(function(u,g,l){if(typeof u=="number")return this._initNumber(u,g,l);if(typeof u=="object")return this._initArray(u,g,l);g==="hex"&&(g=16),a(g===(g|0)&&g>=2&&g<=36),u=u.toString().replace(/\s+/g,"");var m=0;u[0]==="-"&&(m++,this.negative=1),m<u.length&&(g===16?this._parseHex(u,m,l):(this._parseBase(u,g,m),l==="le"&&this._initArray(this.toArray(),g,l)))},"init"),s.prototype._initNumber=i(function(u,g,l){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):(a(u<9007199254740992),this.words=[u&67108863,u/67108864&67108863,1],this.length=3),l==="le"&&this._initArray(this.toArray(),g,l)},"_initNumber"),s.prototype._initArray=i(function(u,g,l){if(a(typeof u.length=="number"),u.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(u.length/3),this.words=new Array(this.length);for(var m=0;m<this.length;m++)this.words[m]=0;var w,M,j=0;if(l==="be")for(m=u.length-1,w=0;m>=0;m-=3)M=u[m]|u[m-1]<<8|u[m-2]<<16,this.words[w]|=M<<j&67108863,this.words[w+1]=M>>>26-j&67108863,j+=24,j>=26&&(j-=26,w++);else if(l==="le")for(m=0,w=0;m<u.length;m+=3)M=u[m]|u[m+1]<<8|u[m+2]<<16,this.words[w]|=M<<j&67108863,this.words[w+1]=M>>>26-j&67108863,j+=24,j>=26&&(j-=26,w++);return this.strip()},"_initArray");function h(F,u){var g=F.charCodeAt(u);return g>=65&&g<=70?g-55:g>=97&&g<=102?g-87:g-48&15}i(h,"parseHex4Bits");function p(F,u,g){var l=h(F,g);return g-1>=u&&(l|=h(F,g-1)<<4),l}i(p,"parseHexByte"),s.prototype._parseHex=i(function(u,g,l){this.length=Math.ceil((u.length-g)/6),this.words=new Array(this.length);for(var m=0;m<this.length;m++)this.words[m]=0;var w=0,M=0,j;if(l==="be")for(m=u.length-1;m>=g;m-=2)j=p(u,g,m)<<w,this.words[M]|=j&67108863,w>=18?(w-=18,M+=1,this.words[M]|=j>>>26):w+=8;else{var S=u.length-g;for(m=S%2===0?g+1:g;m<u.length;m+=2)j=p(u,g,m)<<w,this.words[M]|=j&67108863,w>=18?(w-=18,M+=1,this.words[M]|=j>>>26):w+=8}this.strip()},"_parseHex");function v(F,u,g,l){for(var m=0,w=Math.min(F.length,g),M=u;M<w;M++){var j=F.charCodeAt(M)-48;m*=l,j>=49?m+=j-49+10:j>=17?m+=j-17+10:m+=j}return m}i(v,"parseBase"),s.prototype._parseBase=i(function(u,g,l){this.words=[0],this.length=1;for(var m=0,w=1;w<=67108863;w*=g)m++;m--,w=w/g|0;for(var M=u.length-l,j=M%m,S=Math.min(M,M-j)+l,f=0,_=l;_<S;_+=m)f=v(u,_,_+m,g),this.imuln(w),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(j!==0){var E=1;for(f=v(u,_,u.length,g),_=0;_<j;_++)E*=g;this.imuln(E),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},"_parseBase"),s.prototype.copy=i(function(u){u.words=new Array(this.length);for(var g=0;g<this.length;g++)u.words[g]=this.words[g];u.length=this.length,u.negative=this.negative,u.red=this.red},"copy"),s.prototype.clone=i(function(){var u=new s(null);return this.copy(u),u},"clone"),s.prototype._expand=i(function(u){for(;this.length<u;)this.words[this.length++]=0;return this},"_expand"),s.prototype.strip=i(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),s.prototype._normSign=i(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),s.prototype.inspect=i(function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"},"inspect");var c=["","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"],d=[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],y=[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];s.prototype.toString=i(function(u,g){u=u||10,g=g|0||1;var l;if(u===16||u==="hex"){l="";for(var m=0,w=0,M=0;M<this.length;M++){var j=this.words[M],S=((j<<m|w)&16777215).toString(16);w=j>>>24-m&16777215,m+=2,m>=26&&(m-=26,M--),w!==0||M!==this.length-1?l=c[6-S.length]+S+l:l=S+l}for(w!==0&&(l=w.toString(16)+l);l.length%g!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}if(u===(u|0)&&u>=2&&u<=36){var f=d[u],_=y[u];l="";var E=this.clone();for(E.negative=0;!E.isZero();){var I=E.modn(_).toString(u);E=E.idivn(_),E.isZero()?l=I+l:l=c[f-I.length]+I+l}for(this.isZero()&&(l="0"+l);l.length%g!==0;)l="0"+l;return this.negative!==0&&(l="-"+l),l}a(!1,"Base should be between 2 and 36")},"toString"),s.prototype.toNumber=i(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&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-u:u},"toNumber"),s.prototype.toJSON=i(function(){return this.toString(16)},"toJSON"),s.prototype.toBuffer=i(function(u,g){return a(typeof o<"u"),this.toArrayLike(o,u,g)},"toBuffer"),s.prototype.toArray=i(function(u,g){return this.toArrayLike(Array,u,g)},"toArray"),s.prototype.toArrayLike=i(function(u,g,l){var m=this.byteLength(),w=l||Math.max(1,m);a(m<=w,"byte array longer than desired length"),a(w>0,"Requested array length <= 0"),this.strip();var M=g==="le",j=new u(w),S,f,_=this.clone();if(M){for(f=0;!_.isZero();f++)S=_.andln(255),_.iushrn(8),j[f]=S;for(;f<w;f++)j[f]=0}else{for(f=0;f<w-m;f++)j[f]=0;for(f=0;!_.isZero();f++)S=_.andln(255),_.iushrn(8),j[w-f-1]=S}return j},"toArrayLike"),Math.clz32?s.prototype._countBits=i(function(u){return 32-Math.clz32(u)},"_countBits"):s.prototype._countBits=i(function(u){var g=u,l=0;return g>=4096&&(l+=13,g>>>=13),g>=64&&(l+=7,g>>>=7),g>=8&&(l+=4,g>>>=4),g>=2&&(l+=2,g>>>=2),l+g},"_countBits"),s.prototype._zeroBits=i(function(u){if(u===0)return 26;var g=u,l=0;return(g&8191)===0&&(l+=13,g>>>=13),(g&127)===0&&(l+=7,g>>>=7),(g&15)===0&&(l+=4,g>>>=4),(g&3)===0&&(l+=2,g>>>=2),(g&1)===0&&l++,l},"_zeroBits"),s.prototype.bitLength=i(function(){var u=this.words[this.length-1],g=this._countBits(u);return(this.length-1)*26+g},"bitLength");function b(F){for(var u=new Array(F.bitLength()),g=0;g<u.length;g++){var l=g/26|0,m=g%26;u[g]=(F.words[l]&1<<m)>>>m}return u}i(b,"toBitArray"),s.prototype.zeroBits=i(function(){if(this.isZero())return 0;for(var u=0,g=0;g<this.length;g++){var l=this._zeroBits(this.words[g]);if(u+=l,l!==26)break}return u},"zeroBits"),s.prototype.byteLength=i(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),s.prototype.toTwos=i(function(u){return this.negative!==0?this.abs().inotn(u).iaddn(1):this.clone()},"toTwos"),s.prototype.fromTwos=i(function(u){return this.testn(u-1)?this.notn(u).iaddn(1).ineg():this.clone()},"fromTwos"),s.prototype.isNeg=i(function(){return this.negative!==0},"isNeg"),s.prototype.neg=i(function(){return this.clone().ineg()},"neg"),s.prototype.ineg=i(function(){return this.isZero()||(this.negative^=1),this},"ineg"),s.prototype.iuor=i(function(u){for(;this.length<u.length;)this.words[this.length++]=0;for(var g=0;g<u.length;g++)this.words[g]=this.words[g]|u.words[g];return this.strip()},"iuor"),s.prototype.ior=i(function(u){return a((this.negative|u.negative)===0),this.iuor(u)},"ior"),s.prototype.or=i(function(u){return this.length>u.length?this.clone().ior(u):u.clone().ior(this)},"or"),s.prototype.uor=i(function(u){return this.length>u.length?this.clone().iuor(u):u.clone().iuor(this)},"uor"),s.prototype.iuand=i(function(u){var g;this.length>u.length?g=u:g=this;for(var l=0;l<g.length;l++)this.words[l]=this.words[l]&u.words[l];return this.length=g.length,this.strip()},"iuand"),s.prototype.iand=i(function(u){return a((this.negative|u.negative)===0),this.iuand(u)},"iand"),s.prototype.and=i(function(u){return this.length>u.length?this.clone().iand(u):u.clone().iand(this)},"and"),s.prototype.uand=i(function(u){return this.length>u.length?this.clone().iuand(u):u.clone().iuand(this)},"uand"),s.prototype.iuxor=i(function(u){var g,l;this.length>u.length?(g=this,l=u):(g=u,l=this);for(var m=0;m<l.length;m++)this.words[m]=g.words[m]^l.words[m];if(this!==g)for(;m<g.length;m++)this.words[m]=g.words[m];return this.length=g.length,this.strip()},"iuxor"),s.prototype.ixor=i(function(u){return a((this.negative|u.negative)===0),this.iuxor(u)},"ixor"),s.prototype.xor=i(function(u){return this.length>u.length?this.clone().ixor(u):u.clone().ixor(this)},"xor"),s.prototype.uxor=i(function(u){return this.length>u.length?this.clone().iuxor(u):u.clone().iuxor(this)},"uxor"),s.prototype.inotn=i(function(u){a(typeof u=="number"&&u>=0);var g=Math.ceil(u/26)|0,l=u%26;this._expand(g),l>0&&g--;for(var m=0;m<g;m++)this.words[m]=~this.words[m]&67108863;return l>0&&(this.words[m]=~this.words[m]&67108863>>26-l),this.strip()},"inotn"),s.prototype.notn=i(function(u){return this.clone().inotn(u)},"notn"),s.prototype.setn=i(function(u,g){a(typeof u=="number"&&u>=0);var l=u/26|0,m=u%26;return this._expand(l+1),g?this.words[l]=this.words[l]|1<<m:this.words[l]=this.words[l]&~(1<<m),this.strip()},"setn"),s.prototype.iadd=i(function(u){var g;if(this.negative!==0&&u.negative===0)return this.negative=0,g=this.isub(u),this.negative^=1,this._normSign();if(this.negative===0&&u.negative!==0)return u.negative=0,g=this.isub(u),u.negative=1,g._normSign();var l,m;this.length>u.length?(l=this,m=u):(l=u,m=this);for(var w=0,M=0;M<m.length;M++)g=(l.words[M]|0)+(m.words[M]|0)+w,this.words[M]=g&67108863,w=g>>>26;for(;w!==0&&M<l.length;M++)g=(l.words[M]|0)+w,this.words[M]=g&67108863,w=g>>>26;if(this.length=l.length,w!==0)this.words[this.length]=w,this.length++;else if(l!==this)for(;M<l.length;M++)this.words[M]=l.words[M];return this},"iadd"),s.prototype.add=i(function(u){var g;return u.negative!==0&&this.negative===0?(u.negative=0,g=this.sub(u),u.negative^=1,g):u.negative===0&&this.negative!==0?(this.negative=0,g=u.sub(this),this.negative=1,g):this.length>u.length?this.clone().iadd(u):u.clone().iadd(this)},"add"),s.prototype.isub=i(function(u){if(u.negative!==0){u.negative=0;var g=this.iadd(u);return u.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(u),this.negative=1,this._normSign();var l=this.cmp(u);if(l===0)return this.negative=0,this.length=1,this.words[0]=0,this;var m,w;l>0?(m=this,w=u):(m=u,w=this);for(var M=0,j=0;j<w.length;j++)g=(m.words[j]|0)-(w.words[j]|0)+M,M=g>>26,this.words[j]=g&67108863;for(;M!==0&&j<m.length;j++)g=(m.words[j]|0)+M,M=g>>26,this.words[j]=g&67108863;if(M===0&&j<m.length&&m!==this)for(;j<m.length;j++)this.words[j]=m.words[j];return this.length=Math.max(this.length,j),m!==this&&(this.negative=1),this.strip()},"isub"),s.prototype.sub=i(function(u){return this.clone().isub(u)},"sub");function x(F,u,g){g.negative=u.negative^F.negative;var l=F.length+u.length|0;g.length=l,l=l-1|0;var m=F.words[0]|0,w=u.words[0]|0,M=m*w,j=M&67108863,S=M/67108864|0;g.words[0]=j;for(var f=1;f<l;f++){for(var _=S>>>26,E=S&67108863,I=Math.min(f,u.length-1),D=Math.max(0,f-F.length+1);D<=I;D++){var L=f-D|0;m=F.words[L]|0,w=u.words[D]|0,M=m*w+E,_+=M/67108864|0,E=M&67108863}g.words[f]=E|0,S=_|0}return S!==0?g.words[f]=S|0:g.length--,g.strip()}i(x,"smallMulTo");var k=i(function(u,g,l){var m=u.words,w=g.words,M=l.words,j=0,S,f,_,E=m[0]|0,I=E&8191,D=E>>>13,L=m[1]|0,U=L&8191,B=L>>>13,G=m[2]|0,H=G&8191,K=G>>>13,_e=m[3]|0,se=_e&8191,ae=_e>>>13,ve=m[4]|0,q=ve&8191,ne=ve>>>13,X=m[5]|0,W=X&8191,le=X>>>13,ke=m[6]|0,be=ke&8191,fe=ke>>>13,Q=m[7]|0,Y=Q&8191,te=Q>>>13,he=m[8]|0,oe=he&8191,ue=he>>>13,ze=m[9]|0,we=ze&8191,Be=ze>>>13,We=w[0]|0,ge=We&8191,Ue=We>>>13,ce=w[1]|0,ye=ce&8191,Te=ce>>>13,Re=w[2]|0,je=Re&8191,$e=Re>>>13,Ye=w[3]|0,Ne=Ye&8191,Ee=Ye>>>13,Pe=w[4]|0,Se=Pe&8191,Ze=Pe>>>13,Ke=w[5]|0,re=Ke&8191,pe=Ke>>>13,Ce=w[6]|0,xe=Ce&8191,Oe=Ce>>>13,He=w[7]|0,ie=He&8191,Ae=He>>>13,Ge=w[8]|0,me=Ge&8191,Je=Ge>>>13,tt=w[9]|0,De=tt&8191,Qe=tt>>>13;l.negative=u.negative^g.negative,l.length=19,S=Math.imul(I,ge),f=Math.imul(I,Ue),f=f+Math.imul(D,ge)|0,_=Math.imul(D,Ue);var Ie=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,S=Math.imul(U,ge),f=Math.imul(U,Ue),f=f+Math.imul(B,ge)|0,_=Math.imul(B,Ue),S=S+Math.imul(I,ye)|0,f=f+Math.imul(I,Te)|0,f=f+Math.imul(D,ye)|0,_=_+Math.imul(D,Te)|0;var Fe=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,S=Math.imul(H,ge),f=Math.imul(H,Ue),f=f+Math.imul(K,ge)|0,_=Math.imul(K,Ue),S=S+Math.imul(U,ye)|0,f=f+Math.imul(U,Te)|0,f=f+Math.imul(B,ye)|0,_=_+Math.imul(B,Te)|0,S=S+Math.imul(I,je)|0,f=f+Math.imul(I,$e)|0,f=f+Math.imul(D,je)|0,_=_+Math.imul(D,$e)|0;var lt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(se,ge),f=Math.imul(se,Ue),f=f+Math.imul(ae,ge)|0,_=Math.imul(ae,Ue),S=S+Math.imul(H,ye)|0,f=f+Math.imul(H,Te)|0,f=f+Math.imul(K,ye)|0,_=_+Math.imul(K,Te)|0,S=S+Math.imul(U,je)|0,f=f+Math.imul(U,$e)|0,f=f+Math.imul(B,je)|0,_=_+Math.imul(B,$e)|0,S=S+Math.imul(I,Ne)|0,f=f+Math.imul(I,Ee)|0,f=f+Math.imul(D,Ne)|0,_=_+Math.imul(D,Ee)|0;var yt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(yt>>>26)|0,yt&=67108863,S=Math.imul(q,ge),f=Math.imul(q,Ue),f=f+Math.imul(ne,ge)|0,_=Math.imul(ne,Ue),S=S+Math.imul(se,ye)|0,f=f+Math.imul(se,Te)|0,f=f+Math.imul(ae,ye)|0,_=_+Math.imul(ae,Te)|0,S=S+Math.imul(H,je)|0,f=f+Math.imul(H,$e)|0,f=f+Math.imul(K,je)|0,_=_+Math.imul(K,$e)|0,S=S+Math.imul(U,Ne)|0,f=f+Math.imul(U,Ee)|0,f=f+Math.imul(B,Ne)|0,_=_+Math.imul(B,Ee)|0,S=S+Math.imul(I,Se)|0,f=f+Math.imul(I,Ze)|0,f=f+Math.imul(D,Se)|0,_=_+Math.imul(D,Ze)|0;var ht=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(W,ge),f=Math.imul(W,Ue),f=f+Math.imul(le,ge)|0,_=Math.imul(le,Ue),S=S+Math.imul(q,ye)|0,f=f+Math.imul(q,Te)|0,f=f+Math.imul(ne,ye)|0,_=_+Math.imul(ne,Te)|0,S=S+Math.imul(se,je)|0,f=f+Math.imul(se,$e)|0,f=f+Math.imul(ae,je)|0,_=_+Math.imul(ae,$e)|0,S=S+Math.imul(H,Ne)|0,f=f+Math.imul(H,Ee)|0,f=f+Math.imul(K,Ne)|0,_=_+Math.imul(K,Ee)|0,S=S+Math.imul(U,Se)|0,f=f+Math.imul(U,Ze)|0,f=f+Math.imul(B,Se)|0,_=_+Math.imul(B,Ze)|0,S=S+Math.imul(I,re)|0,f=f+Math.imul(I,pe)|0,f=f+Math.imul(D,re)|0,_=_+Math.imul(D,pe)|0;var Mt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,S=Math.imul(be,ge),f=Math.imul(be,Ue),f=f+Math.imul(fe,ge)|0,_=Math.imul(fe,Ue),S=S+Math.imul(W,ye)|0,f=f+Math.imul(W,Te)|0,f=f+Math.imul(le,ye)|0,_=_+Math.imul(le,Te)|0,S=S+Math.imul(q,je)|0,f=f+Math.imul(q,$e)|0,f=f+Math.imul(ne,je)|0,_=_+Math.imul(ne,$e)|0,S=S+Math.imul(se,Ne)|0,f=f+Math.imul(se,Ee)|0,f=f+Math.imul(ae,Ne)|0,_=_+Math.imul(ae,Ee)|0,S=S+Math.imul(H,Se)|0,f=f+Math.imul(H,Ze)|0,f=f+Math.imul(K,Se)|0,_=_+Math.imul(K,Ze)|0,S=S+Math.imul(U,re)|0,f=f+Math.imul(U,pe)|0,f=f+Math.imul(B,re)|0,_=_+Math.imul(B,pe)|0,S=S+Math.imul(I,xe)|0,f=f+Math.imul(I,Oe)|0,f=f+Math.imul(D,xe)|0,_=_+Math.imul(D,Oe)|0;var Bt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,S=Math.imul(Y,ge),f=Math.imul(Y,Ue),f=f+Math.imul(te,ge)|0,_=Math.imul(te,Ue),S=S+Math.imul(be,ye)|0,f=f+Math.imul(be,Te)|0,f=f+Math.imul(fe,ye)|0,_=_+Math.imul(fe,Te)|0,S=S+Math.imul(W,je)|0,f=f+Math.imul(W,$e)|0,f=f+Math.imul(le,je)|0,_=_+Math.imul(le,$e)|0,S=S+Math.imul(q,Ne)|0,f=f+Math.imul(q,Ee)|0,f=f+Math.imul(ne,Ne)|0,_=_+Math.imul(ne,Ee)|0,S=S+Math.imul(se,Se)|0,f=f+Math.imul(se,Ze)|0,f=f+Math.imul(ae,Se)|0,_=_+Math.imul(ae,Ze)|0,S=S+Math.imul(H,re)|0,f=f+Math.imul(H,pe)|0,f=f+Math.imul(K,re)|0,_=_+Math.imul(K,pe)|0,S=S+Math.imul(U,xe)|0,f=f+Math.imul(U,Oe)|0,f=f+Math.imul(B,xe)|0,_=_+Math.imul(B,Oe)|0,S=S+Math.imul(I,ie)|0,f=f+Math.imul(I,Ae)|0,f=f+Math.imul(D,ie)|0,_=_+Math.imul(D,Ae)|0;var Et=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Et>>>26)|0,Et&=67108863,S=Math.imul(oe,ge),f=Math.imul(oe,Ue),f=f+Math.imul(ue,ge)|0,_=Math.imul(ue,Ue),S=S+Math.imul(Y,ye)|0,f=f+Math.imul(Y,Te)|0,f=f+Math.imul(te,ye)|0,_=_+Math.imul(te,Te)|0,S=S+Math.imul(be,je)|0,f=f+Math.imul(be,$e)|0,f=f+Math.imul(fe,je)|0,_=_+Math.imul(fe,$e)|0,S=S+Math.imul(W,Ne)|0,f=f+Math.imul(W,Ee)|0,f=f+Math.imul(le,Ne)|0,_=_+Math.imul(le,Ee)|0,S=S+Math.imul(q,Se)|0,f=f+Math.imul(q,Ze)|0,f=f+Math.imul(ne,Se)|0,_=_+Math.imul(ne,Ze)|0,S=S+Math.imul(se,re)|0,f=f+Math.imul(se,pe)|0,f=f+Math.imul(ae,re)|0,_=_+Math.imul(ae,pe)|0,S=S+Math.imul(H,xe)|0,f=f+Math.imul(H,Oe)|0,f=f+Math.imul(K,xe)|0,_=_+Math.imul(K,Oe)|0,S=S+Math.imul(U,ie)|0,f=f+Math.imul(U,Ae)|0,f=f+Math.imul(B,ie)|0,_=_+Math.imul(B,Ae)|0,S=S+Math.imul(I,me)|0,f=f+Math.imul(I,Je)|0,f=f+Math.imul(D,me)|0,_=_+Math.imul(D,Je)|0;var _t=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(_t>>>26)|0,_t&=67108863,S=Math.imul(we,ge),f=Math.imul(we,Ue),f=f+Math.imul(Be,ge)|0,_=Math.imul(Be,Ue),S=S+Math.imul(oe,ye)|0,f=f+Math.imul(oe,Te)|0,f=f+Math.imul(ue,ye)|0,_=_+Math.imul(ue,Te)|0,S=S+Math.imul(Y,je)|0,f=f+Math.imul(Y,$e)|0,f=f+Math.imul(te,je)|0,_=_+Math.imul(te,$e)|0,S=S+Math.imul(be,Ne)|0,f=f+Math.imul(be,Ee)|0,f=f+Math.imul(fe,Ne)|0,_=_+Math.imul(fe,Ee)|0,S=S+Math.imul(W,Se)|0,f=f+Math.imul(W,Ze)|0,f=f+Math.imul(le,Se)|0,_=_+Math.imul(le,Ze)|0,S=S+Math.imul(q,re)|0,f=f+Math.imul(q,pe)|0,f=f+Math.imul(ne,re)|0,_=_+Math.imul(ne,pe)|0,S=S+Math.imul(se,xe)|0,f=f+Math.imul(se,Oe)|0,f=f+Math.imul(ae,xe)|0,_=_+Math.imul(ae,Oe)|0,S=S+Math.imul(H,ie)|0,f=f+Math.imul(H,Ae)|0,f=f+Math.imul(K,ie)|0,_=_+Math.imul(K,Ae)|0,S=S+Math.imul(U,me)|0,f=f+Math.imul(U,Je)|0,f=f+Math.imul(B,me)|0,_=_+Math.imul(B,Je)|0,S=S+Math.imul(I,De)|0,f=f+Math.imul(I,Qe)|0,f=f+Math.imul(D,De)|0,_=_+Math.imul(D,Qe)|0;var Ft=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,S=Math.imul(we,ye),f=Math.imul(we,Te),f=f+Math.imul(Be,ye)|0,_=Math.imul(Be,Te),S=S+Math.imul(oe,je)|0,f=f+Math.imul(oe,$e)|0,f=f+Math.imul(ue,je)|0,_=_+Math.imul(ue,$e)|0,S=S+Math.imul(Y,Ne)|0,f=f+Math.imul(Y,Ee)|0,f=f+Math.imul(te,Ne)|0,_=_+Math.imul(te,Ee)|0,S=S+Math.imul(be,Se)|0,f=f+Math.imul(be,Ze)|0,f=f+Math.imul(fe,Se)|0,_=_+Math.imul(fe,Ze)|0,S=S+Math.imul(W,re)|0,f=f+Math.imul(W,pe)|0,f=f+Math.imul(le,re)|0,_=_+Math.imul(le,pe)|0,S=S+Math.imul(q,xe)|0,f=f+Math.imul(q,Oe)|0,f=f+Math.imul(ne,xe)|0,_=_+Math.imul(ne,Oe)|0,S=S+Math.imul(se,ie)|0,f=f+Math.imul(se,Ae)|0,f=f+Math.imul(ae,ie)|0,_=_+Math.imul(ae,Ae)|0,S=S+Math.imul(H,me)|0,f=f+Math.imul(H,Je)|0,f=f+Math.imul(K,me)|0,_=_+Math.imul(K,Je)|0,S=S+Math.imul(U,De)|0,f=f+Math.imul(U,Qe)|0,f=f+Math.imul(B,De)|0,_=_+Math.imul(B,Qe)|0;var Vt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,S=Math.imul(we,je),f=Math.imul(we,$e),f=f+Math.imul(Be,je)|0,_=Math.imul(Be,$e),S=S+Math.imul(oe,Ne)|0,f=f+Math.imul(oe,Ee)|0,f=f+Math.imul(ue,Ne)|0,_=_+Math.imul(ue,Ee)|0,S=S+Math.imul(Y,Se)|0,f=f+Math.imul(Y,Ze)|0,f=f+Math.imul(te,Se)|0,_=_+Math.imul(te,Ze)|0,S=S+Math.imul(be,re)|0,f=f+Math.imul(be,pe)|0,f=f+Math.imul(fe,re)|0,_=_+Math.imul(fe,pe)|0,S=S+Math.imul(W,xe)|0,f=f+Math.imul(W,Oe)|0,f=f+Math.imul(le,xe)|0,_=_+Math.imul(le,Oe)|0,S=S+Math.imul(q,ie)|0,f=f+Math.imul(q,Ae)|0,f=f+Math.imul(ne,ie)|0,_=_+Math.imul(ne,Ae)|0,S=S+Math.imul(se,me)|0,f=f+Math.imul(se,Je)|0,f=f+Math.imul(ae,me)|0,_=_+Math.imul(ae,Je)|0,S=S+Math.imul(H,De)|0,f=f+Math.imul(H,Qe)|0,f=f+Math.imul(K,De)|0,_=_+Math.imul(K,Qe)|0;var Tt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,S=Math.imul(we,Ne),f=Math.imul(we,Ee),f=f+Math.imul(Be,Ne)|0,_=Math.imul(Be,Ee),S=S+Math.imul(oe,Se)|0,f=f+Math.imul(oe,Ze)|0,f=f+Math.imul(ue,Se)|0,_=_+Math.imul(ue,Ze)|0,S=S+Math.imul(Y,re)|0,f=f+Math.imul(Y,pe)|0,f=f+Math.imul(te,re)|0,_=_+Math.imul(te,pe)|0,S=S+Math.imul(be,xe)|0,f=f+Math.imul(be,Oe)|0,f=f+Math.imul(fe,xe)|0,_=_+Math.imul(fe,Oe)|0,S=S+Math.imul(W,ie)|0,f=f+Math.imul(W,Ae)|0,f=f+Math.imul(le,ie)|0,_=_+Math.imul(le,Ae)|0,S=S+Math.imul(q,me)|0,f=f+Math.imul(q,Je)|0,f=f+Math.imul(ne,me)|0,_=_+Math.imul(ne,Je)|0,S=S+Math.imul(se,De)|0,f=f+Math.imul(se,Qe)|0,f=f+Math.imul(ae,De)|0,_=_+Math.imul(ae,Qe)|0;var zt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,S=Math.imul(we,Se),f=Math.imul(we,Ze),f=f+Math.imul(Be,Se)|0,_=Math.imul(Be,Ze),S=S+Math.imul(oe,re)|0,f=f+Math.imul(oe,pe)|0,f=f+Math.imul(ue,re)|0,_=_+Math.imul(ue,pe)|0,S=S+Math.imul(Y,xe)|0,f=f+Math.imul(Y,Oe)|0,f=f+Math.imul(te,xe)|0,_=_+Math.imul(te,Oe)|0,S=S+Math.imul(be,ie)|0,f=f+Math.imul(be,Ae)|0,f=f+Math.imul(fe,ie)|0,_=_+Math.imul(fe,Ae)|0,S=S+Math.imul(W,me)|0,f=f+Math.imul(W,Je)|0,f=f+Math.imul(le,me)|0,_=_+Math.imul(le,Je)|0,S=S+Math.imul(q,De)|0,f=f+Math.imul(q,Qe)|0,f=f+Math.imul(ne,De)|0,_=_+Math.imul(ne,Qe)|0;var Nt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S=Math.imul(we,re),f=Math.imul(we,pe),f=f+Math.imul(Be,re)|0,_=Math.imul(Be,pe),S=S+Math.imul(oe,xe)|0,f=f+Math.imul(oe,Oe)|0,f=f+Math.imul(ue,xe)|0,_=_+Math.imul(ue,Oe)|0,S=S+Math.imul(Y,ie)|0,f=f+Math.imul(Y,Ae)|0,f=f+Math.imul(te,ie)|0,_=_+Math.imul(te,Ae)|0,S=S+Math.imul(be,me)|0,f=f+Math.imul(be,Je)|0,f=f+Math.imul(fe,me)|0,_=_+Math.imul(fe,Je)|0,S=S+Math.imul(W,De)|0,f=f+Math.imul(W,Qe)|0,f=f+Math.imul(le,De)|0,_=_+Math.imul(le,Qe)|0;var Pt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,S=Math.imul(we,xe),f=Math.imul(we,Oe),f=f+Math.imul(Be,xe)|0,_=Math.imul(Be,Oe),S=S+Math.imul(oe,ie)|0,f=f+Math.imul(oe,Ae)|0,f=f+Math.imul(ue,ie)|0,_=_+Math.imul(ue,Ae)|0,S=S+Math.imul(Y,me)|0,f=f+Math.imul(Y,Je)|0,f=f+Math.imul(te,me)|0,_=_+Math.imul(te,Je)|0,S=S+Math.imul(be,De)|0,f=f+Math.imul(be,Qe)|0,f=f+Math.imul(fe,De)|0,_=_+Math.imul(fe,Qe)|0;var Ut=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,S=Math.imul(we,ie),f=Math.imul(we,Ae),f=f+Math.imul(Be,ie)|0,_=Math.imul(Be,Ae),S=S+Math.imul(oe,me)|0,f=f+Math.imul(oe,Je)|0,f=f+Math.imul(ue,me)|0,_=_+Math.imul(ue,Je)|0,S=S+Math.imul(Y,De)|0,f=f+Math.imul(Y,Qe)|0,f=f+Math.imul(te,De)|0,_=_+Math.imul(te,Qe)|0;var Zt=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,S=Math.imul(we,me),f=Math.imul(we,Je),f=f+Math.imul(Be,me)|0,_=Math.imul(Be,Je),S=S+Math.imul(oe,De)|0,f=f+Math.imul(oe,Qe)|0,f=f+Math.imul(ue,De)|0,_=_+Math.imul(ue,Qe)|0;var Ht=(j+S|0)+((f&8191)<<13)|0;j=(_+(f>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,S=Math.imul(we,De),f=Math.imul(we,Qe),f=f+Math.imul(Be,De)|0,_=Math.imul(Be,Qe);var Jt=(j+S|0)+((f&8191)<<13)|0;return j=(_+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,M[0]=Ie,M[1]=Fe,M[2]=lt,M[3]=yt,M[4]=ht,M[5]=Mt,M[6]=Bt,M[7]=Et,M[8]=_t,M[9]=Ft,M[10]=Vt,M[11]=Tt,M[12]=zt,M[13]=Nt,M[14]=Pt,M[15]=Ut,M[16]=Zt,M[17]=Ht,M[18]=Jt,j!==0&&(M[19]=j,l.length++),l},"comb10MulTo");Math.imul||(k=x);function N(F,u,g){g.negative=u.negative^F.negative,g.length=F.length+u.length;for(var l=0,m=0,w=0;w<g.length-1;w++){var M=m;m=0;for(var j=l&67108863,S=Math.min(w,u.length-1),f=Math.max(0,w-F.length+1);f<=S;f++){var _=w-f,E=F.words[_]|0,I=u.words[f]|0,D=E*I,L=D&67108863;M=M+(D/67108864|0)|0,L=L+j|0,j=L&67108863,M=M+(L>>>26)|0,m+=M>>>26,M&=67108863}g.words[w]=j,l=M,M=m}return l!==0?g.words[w]=l:g.length--,g.strip()}i(N,"bigMulTo");function C(F,u,g){var l=new R;return l.mulp(F,u,g)}i(C,"jumboMulTo"),s.prototype.mulTo=i(function(u,g){var l,m=this.length+u.length;return this.length===10&&u.length===10?l=k(this,u,g):m<63?l=x(this,u,g):m<1024?l=N(this,u,g):l=C(this,u,g),l},"mulTo");function R(F,u){this.x=F,this.y=u}i(R,"FFTM"),R.prototype.makeRBT=i(function(u){for(var g=new Array(u),l=s.prototype._countBits(u)-1,m=0;m<u;m++)g[m]=this.revBin(m,l,u);return g},"makeRBT"),R.prototype.revBin=i(function(u,g,l){if(u===0||u===l-1)return u;for(var m=0,w=0;w<g;w++)m|=(u&1)<<g-w-1,u>>=1;return m},"revBin"),R.prototype.permute=i(function(u,g,l,m,w,M){for(var j=0;j<M;j++)m[j]=g[u[j]],w[j]=l[u[j]]},"permute"),R.prototype.transform=i(function(u,g,l,m,w,M){this.permute(M,u,g,l,m,w);for(var j=1;j<w;j<<=1)for(var S=j<<1,f=Math.cos(2*Math.PI/S),_=Math.sin(2*Math.PI/S),E=0;E<w;E+=S)for(var I=f,D=_,L=0;L<j;L++){var U=l[E+L],B=m[E+L],G=l[E+L+j],H=m[E+L+j],K=I*G-D*H;H=I*H+D*G,G=K,l[E+L]=U+G,m[E+L]=B+H,l[E+L+j]=U-G,m[E+L+j]=B-H,L!==S&&(K=f*I-_*D,D=f*D+_*I,I=K)}},"transform"),R.prototype.guessLen13b=i(function(u,g){var l=Math.max(g,u)|1,m=l&1,w=0;for(l=l/2|0;l;l=l>>>1)w++;return 1<<w+1+m},"guessLen13b"),R.prototype.conjugate=i(function(u,g,l){if(!(l<=1))for(var m=0;m<l/2;m++){var w=u[m];u[m]=u[l-m-1],u[l-m-1]=w,w=g[m],g[m]=-g[l-m-1],g[l-m-1]=-w}},"conjugate"),R.prototype.normalize13b=i(function(u,g){for(var l=0,m=0;m<g/2;m++){var w=Math.round(u[2*m+1]/g)*8192+Math.round(u[2*m]/g)+l;u[m]=w&67108863,w<67108864?l=0:l=w/67108864|0}return u},"normalize13b"),R.prototype.convert13b=i(function(u,g,l,m){for(var w=0,M=0;M<g;M++)w=w+(u[M]|0),l[2*M]=w&8191,w=w>>>13,l[2*M+1]=w&8191,w=w>>>13;for(M=2*g;M<m;++M)l[M]=0;a(w===0),a((w&-8192)===0)},"convert13b"),R.prototype.stub=i(function(u){for(var g=new Array(u),l=0;l<u;l++)g[l]=0;return g},"stub"),R.prototype.mulp=i(function(u,g,l){var m=2*this.guessLen13b(u.length,g.length),w=this.makeRBT(m),M=this.stub(m),j=new Array(m),S=new Array(m),f=new Array(m),_=new Array(m),E=new Array(m),I=new Array(m),D=l.words;D.length=m,this.convert13b(u.words,u.length,j,m),this.convert13b(g.words,g.length,_,m),this.transform(j,M,S,f,m,w),this.transform(_,M,E,I,m,w);for(var L=0;L<m;L++){var U=S[L]*E[L]-f[L]*I[L];f[L]=S[L]*I[L]+f[L]*E[L],S[L]=U}return this.conjugate(S,f,m),this.transform(S,f,D,M,m,w),this.conjugate(D,M,m),this.normalize13b(D,m),l.negative=u.negative^g.negative,l.length=u.length+g.length,l.strip()},"mulp"),s.prototype.mul=i(function(u){var g=new s(null);return g.words=new Array(this.length+u.length),this.mulTo(u,g)},"mul"),s.prototype.mulf=i(function(u){var g=new s(null);return g.words=new Array(this.length+u.length),C(this,u,g)},"mulf"),s.prototype.imul=i(function(u){return this.clone().mulTo(u,this)},"imul"),s.prototype.imuln=i(function(u){a(typeof u=="number"),a(u<67108864);for(var g=0,l=0;l<this.length;l++){var m=(this.words[l]|0)*u,w=(m&67108863)+(g&67108863);g>>=26,g+=m/67108864|0,g+=w>>>26,this.words[l]=w&67108863}return g!==0&&(this.words[l]=g,this.length++),this.length=u===0?1:this.length,this},"imuln"),s.prototype.muln=i(function(u){return this.clone().imuln(u)},"muln"),s.prototype.sqr=i(function(){return this.mul(this)},"sqr"),s.prototype.isqr=i(function(){return this.imul(this.clone())},"isqr"),s.prototype.pow=i(function(u){var g=b(u);if(g.length===0)return new s(1);for(var l=this,m=0;m<g.length&&g[m]===0;m++,l=l.sqr());if(++m<g.length)for(var w=l.sqr();m<g.length;m++,w=w.sqr())g[m]!==0&&(l=l.mul(w));return l},"pow"),s.prototype.iushln=i(function(u){a(typeof u=="number"&&u>=0);var g=u%26,l=(u-g)/26,m=67108863>>>26-g<<26-g,w;if(g!==0){var M=0;for(w=0;w<this.length;w++){var j=this.words[w]&m,S=(this.words[w]|0)-j<<g;this.words[w]=S|M,M=j>>>26-g}M&&(this.words[w]=M,this.length++)}if(l!==0){for(w=this.length-1;w>=0;w--)this.words[w+l]=this.words[w];for(w=0;w<l;w++)this.words[w]=0;this.length+=l}return this.strip()},"iushln"),s.prototype.ishln=i(function(u){return a(this.negative===0),this.iushln(u)},"ishln"),s.prototype.iushrn=i(function(u,g,l){a(typeof u=="number"&&u>=0);var m;g?m=(g-g%26)/26:m=0;var w=u%26,M=Math.min((u-w)/26,this.length),j=67108863^67108863>>>w<<w,S=l;if(m-=M,m=Math.max(0,m),S){for(var f=0;f<M;f++)S.words[f]=this.words[f];S.length=M}if(M!==0)if(this.length>M)for(this.length-=M,f=0;f<this.length;f++)this.words[f]=this.words[f+M];else this.words[0]=0,this.length=1;var _=0;for(f=this.length-1;f>=0&&(_!==0||f>=m);f--){var E=this.words[f]|0;this.words[f]=_<<26-w|E>>>w,_=E&j}return S&&_!==0&&(S.words[S.length++]=_),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},"iushrn"),s.prototype.ishrn=i(function(u,g,l){return a(this.negative===0),this.iushrn(u,g,l)},"ishrn"),s.prototype.shln=i(function(u){return this.clone().ishln(u)},"shln"),s.prototype.ushln=i(function(u){return this.clone().iushln(u)},"ushln"),s.prototype.shrn=i(function(u){return this.clone().ishrn(u)},"shrn"),s.prototype.ushrn=i(function(u){return this.clone().iushrn(u)},"ushrn"),s.prototype.testn=i(function(u){a(typeof u=="number"&&u>=0);var g=u%26,l=(u-g)/26,m=1<<g;if(this.length<=l)return!1;var w=this.words[l];return!!(w&m)},"testn"),s.prototype.imaskn=i(function(u){a(typeof u=="number"&&u>=0);var g=u%26,l=(u-g)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=l)return this;if(g!==0&&l++,this.length=Math.min(l,this.length),g!==0){var m=67108863^67108863>>>g<<g;this.words[this.length-1]&=m}return this.strip()},"imaskn"),s.prototype.maskn=i(function(u){return this.clone().imaskn(u)},"maskn"),s.prototype.iaddn=i(function(u){return a(typeof u=="number"),a(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)},"iaddn"),s.prototype._iaddn=i(function(u){this.words[0]+=u;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},"_iaddn"),s.prototype.isubn=i(function(u){if(a(typeof u=="number"),a(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 g=0;g<this.length&&this.words[g]<0;g++)this.words[g]+=67108864,this.words[g+1]-=1;return this.strip()},"isubn"),s.prototype.addn=i(function(u){return this.clone().iaddn(u)},"addn"),s.prototype.subn=i(function(u){return this.clone().isubn(u)},"subn"),s.prototype.iabs=i(function(){return this.negative=0,this},"iabs"),s.prototype.abs=i(function(){return this.clone().iabs()},"abs"),s.prototype._ishlnsubmul=i(function(u,g,l){var m=u.length+l,w;this._expand(m);var M,j=0;for(w=0;w<u.length;w++){M=(this.words[w+l]|0)+j;var S=(u.words[w]|0)*g;M-=S&67108863,j=(M>>26)-(S/67108864|0),this.words[w+l]=M&67108863}for(;w<this.length-l;w++)M=(this.words[w+l]|0)+j,j=M>>26,this.words[w+l]=M&67108863;if(j===0)return this.strip();for(a(j===-1),j=0,w=0;w<this.length;w++)M=-(this.words[w]|0)+j,j=M>>26,this.words[w]=M&67108863;return this.negative=1,this.strip()},"_ishlnsubmul"),s.prototype._wordDiv=i(function(u,g){var l=this.length-u.length,m=this.clone(),w=u,M=w.words[w.length-1]|0,j=this._countBits(M);l=26-j,l!==0&&(w=w.ushln(l),m.iushln(l),M=w.words[w.length-1]|0);var S=m.length-w.length,f;if(g!=="mod"){f=new s(null),f.length=S+1,f.words=new Array(f.length);for(var _=0;_<f.length;_++)f.words[_]=0}var E=m.clone()._ishlnsubmul(w,1,S);E.negative===0&&(m=E,f&&(f.words[S]=1));for(var I=S-1;I>=0;I--){var D=(m.words[w.length+I]|0)*67108864+(m.words[w.length+I-1]|0);for(D=Math.min(D/M|0,67108863),m._ishlnsubmul(w,D,I);m.negative!==0;)D--,m.negative=0,m._ishlnsubmul(w,1,I),m.isZero()||(m.negative^=1);f&&(f.words[I]=D)}return f&&f.strip(),m.strip(),g!=="div"&&l!==0&&m.iushrn(l),{div:f||null,mod:m}},"_wordDiv"),s.prototype.divmod=i(function(u,g,l){if(a(!u.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var m,w,M;return this.negative!==0&&u.negative===0?(M=this.neg().divmod(u,g),g!=="mod"&&(m=M.div.neg()),g!=="div"&&(w=M.mod.neg(),l&&w.negative!==0&&w.iadd(u)),{div:m,mod:w}):this.negative===0&&u.negative!==0?(M=this.divmod(u.neg(),g),g!=="mod"&&(m=M.div.neg()),{div:m,mod:M.mod}):(this.negative&u.negative)!==0?(M=this.neg().divmod(u.neg(),g),g!=="div"&&(w=M.mod.neg(),l&&w.negative!==0&&w.isub(u)),{div:M.div,mod:w}):u.length>this.length||this.cmp(u)<0?{div:new s(0),mod:this}:u.length===1?g==="div"?{div:this.divn(u.words[0]),mod:null}:g==="mod"?{div:null,mod:new s(this.modn(u.words[0]))}:{div:this.divn(u.words[0]),mod:new s(this.modn(u.words[0]))}:this._wordDiv(u,g)},"divmod"),s.prototype.div=i(function(u){return this.divmod(u,"div",!1).div},"div"),s.prototype.mod=i(function(u){return this.divmod(u,"mod",!1).mod},"mod"),s.prototype.umod=i(function(u){return this.divmod(u,"mod",!0).mod},"umod"),s.prototype.divRound=i(function(u){var g=this.divmod(u);if(g.mod.isZero())return g.div;var l=g.div.negative!==0?g.mod.isub(u):g.mod,m=u.ushrn(1),w=u.andln(1),M=l.cmp(m);return M<0||w===1&&M===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},"divRound"),s.prototype.modn=i(function(u){a(u<=67108863);for(var g=(1<<26)%u,l=0,m=this.length-1;m>=0;m--)l=(g*l+(this.words[m]|0))%u;return l},"modn"),s.prototype.idivn=i(function(u){a(u<=67108863);for(var g=0,l=this.length-1;l>=0;l--){var m=(this.words[l]|0)+g*67108864;this.words[l]=m/u|0,g=m%u}return this.strip()},"idivn"),s.prototype.divn=i(function(u){return this.clone().idivn(u)},"divn"),s.prototype.egcd=i(function(u){a(u.negative===0),a(!u.isZero());var g=this,l=u.clone();g.negative!==0?g=g.umod(u):g=g.clone();for(var m=new s(1),w=new s(0),M=new s(0),j=new s(1),S=0;g.isEven()&&l.isEven();)g.iushrn(1),l.iushrn(1),++S;for(var f=l.clone(),_=g.clone();!g.isZero();){for(var E=0,I=1;(g.words[0]&I)===0&&E<26;++E,I<<=1);if(E>0)for(g.iushrn(E);E-- >0;)(m.isOdd()||w.isOdd())&&(m.iadd(f),w.isub(_)),m.iushrn(1),w.iushrn(1);for(var D=0,L=1;(l.words[0]&L)===0&&D<26;++D,L<<=1);if(D>0)for(l.iushrn(D);D-- >0;)(M.isOdd()||j.isOdd())&&(M.iadd(f),j.isub(_)),M.iushrn(1),j.iushrn(1);g.cmp(l)>=0?(g.isub(l),m.isub(M),w.isub(j)):(l.isub(g),M.isub(m),j.isub(w))}return{a:M,b:j,gcd:l.iushln(S)}},"egcd"),s.prototype._invmp=i(function(u){a(u.negative===0),a(!u.isZero());var g=this,l=u.clone();g.negative!==0?g=g.umod(u):g=g.clone();for(var m=new s(1),w=new s(0),M=l.clone();g.cmpn(1)>0&&l.cmpn(1)>0;){for(var j=0,S=1;(g.words[0]&S)===0&&j<26;++j,S<<=1);if(j>0)for(g.iushrn(j);j-- >0;)m.isOdd()&&m.iadd(M),m.iushrn(1);for(var f=0,_=1;(l.words[0]&_)===0&&f<26;++f,_<<=1);if(f>0)for(l.iushrn(f);f-- >0;)w.isOdd()&&w.iadd(M),w.iushrn(1);g.cmp(l)>=0?(g.isub(l),m.isub(w)):(l.isub(g),w.isub(m))}var E;return g.cmpn(1)===0?E=m:E=w,E.cmpn(0)<0&&E.iadd(u),E},"_invmp"),s.prototype.gcd=i(function(u){if(this.isZero())return u.abs();if(u.isZero())return this.abs();var g=this.clone(),l=u.clone();g.negative=0,l.negative=0;for(var m=0;g.isEven()&&l.isEven();m++)g.iushrn(1),l.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;l.isEven();)l.iushrn(1);var w=g.cmp(l);if(w<0){var M=g;g=l,l=M}else if(w===0||l.cmpn(1)===0)break;g.isub(l)}while(!0);return l.iushln(m)},"gcd"),s.prototype.invm=i(function(u){return this.egcd(u).a.umod(u)},"invm"),s.prototype.isEven=i(function(){return(this.words[0]&1)===0},"isEven"),s.prototype.isOdd=i(function(){return(this.words[0]&1)===1},"isOdd"),s.prototype.andln=i(function(u){return this.words[0]&u},"andln"),s.prototype.bincn=i(function(u){a(typeof u=="number");var g=u%26,l=(u-g)/26,m=1<<g;if(this.length<=l)return this._expand(l+1),this.words[l]|=m,this;for(var w=m,M=l;w!==0&&M<this.length;M++){var j=this.words[M]|0;j+=w,w=j>>>26,j&=67108863,this.words[M]=j}return w!==0&&(this.words[M]=w,this.length++),this},"bincn"),s.prototype.isZero=i(function(){return this.length===1&&this.words[0]===0},"isZero"),s.prototype.cmpn=i(function(u){var g=u<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this.strip();var l;if(this.length>1)l=1;else{g&&(u=-u),a(u<=67108863,"Number is too big");var m=this.words[0]|0;l=m===u?0:m<u?-1:1}return this.negative!==0?-l|0:l},"cmpn"),s.prototype.cmp=i(function(u){if(this.negative!==0&&u.negative===0)return-1;if(this.negative===0&&u.negative!==0)return 1;var g=this.ucmp(u);return this.negative!==0?-g|0:g},"cmp"),s.prototype.ucmp=i(function(u){if(this.length>u.length)return 1;if(this.length<u.length)return-1;for(var g=0,l=this.length-1;l>=0;l--){var m=this.words[l]|0,w=u.words[l]|0;if(m!==w){m<w?g=-1:m>w&&(g=1);break}}return g},"ucmp"),s.prototype.gtn=i(function(u){return this.cmpn(u)===1},"gtn"),s.prototype.gt=i(function(u){return this.cmp(u)===1},"gt"),s.prototype.gten=i(function(u){return this.cmpn(u)>=0},"gten"),s.prototype.gte=i(function(u){return this.cmp(u)>=0},"gte"),s.prototype.ltn=i(function(u){return this.cmpn(u)===-1},"ltn"),s.prototype.lt=i(function(u){return this.cmp(u)===-1},"lt"),s.prototype.lten=i(function(u){return this.cmpn(u)<=0},"lten"),s.prototype.lte=i(function(u){return this.cmp(u)<=0},"lte"),s.prototype.eqn=i(function(u){return this.cmpn(u)===0},"eqn"),s.prototype.eq=i(function(u){return this.cmp(u)===0},"eq"),s.red=i(function(u){return new ee(u)},"red"),s.prototype.toRed=i(function(u){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),u.convertTo(this)._forceRed(u)},"toRed"),s.prototype.fromRed=i(function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),s.prototype._forceRed=i(function(u){return this.red=u,this},"_forceRed"),s.prototype.forceRed=i(function(u){return a(!this.red,"Already a number in reduction context"),this._forceRed(u)},"forceRed"),s.prototype.redAdd=i(function(u){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,u)},"redAdd"),s.prototype.redIAdd=i(function(u){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,u)},"redIAdd"),s.prototype.redSub=i(function(u){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,u)},"redSub"),s.prototype.redISub=i(function(u){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,u)},"redISub"),s.prototype.redShl=i(function(u){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,u)},"redShl"),s.prototype.redMul=i(function(u){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.mul(this,u)},"redMul"),s.prototype.redIMul=i(function(u){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,u),this.red.imul(this,u)},"redIMul"),s.prototype.redSqr=i(function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),s.prototype.redISqr=i(function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),s.prototype.redSqrt=i(function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),s.prototype.redInvm=i(function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),s.prototype.redNeg=i(function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),s.prototype.redPow=i(function(u){return a(this.red&&!u.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,u)},"redPow");var O={k256:null,p224:null,p192:null,p25519:null};function T(F,u){this.name=F,this.p=new s(u,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}i(T,"MPrime"),T.prototype._tmp=i(function(){var u=new s(null);return u.words=new Array(Math.ceil(this.n/13)),u},"_tmp"),T.prototype.ireduce=i(function(u){var g=u,l;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),l=g.bitLength();while(l>this.n);var m=l<this.n?-1:g.ucmp(this.p);return m===0?(g.words[0]=0,g.length=1):m>0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},"ireduce"),T.prototype.split=i(function(u,g){u.iushrn(this.n,0,g)},"split"),T.prototype.imulK=i(function(u){return u.imul(this.k)},"imulK");function P(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(P,"K256"),n(P,T),P.prototype.split=i(function(u,g){for(var l=4194303,m=Math.min(u.length,9),w=0;w<m;w++)g.words[w]=u.words[w];if(g.length=m,u.length<=9){u.words[0]=0,u.length=1;return}var M=u.words[9];for(g.words[g.length++]=M&l,w=10;w<u.length;w++){var j=u.words[w]|0;u.words[w-10]=(j&l)<<4|M>>>22,M=j}M>>>=22,u.words[w-10]=M,M===0&&u.length>10?u.length-=10:u.length-=9},"split"),P.prototype.imulK=i(function(u){u.words[u.length]=0,u.words[u.length+1]=0,u.length+=2;for(var g=0,l=0;l<u.length;l++){var m=u.words[l]|0;g+=m*977,u.words[l]=g&67108863,g=m*64+(g/67108864|0)}return u.words[u.length-1]===0&&(u.length--,u.words[u.length-1]===0&&u.length--),u},"imulK");function z(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(z,"P224"),n(z,T);function Z(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(Z,"P192"),n(Z,T);function V(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(V,"P25519"),n(V,T),V.prototype.imulK=i(function(u){for(var g=0,l=0;l<u.length;l++){var m=(u.words[l]|0)*19+g,w=m&67108863;m>>>=26,u.words[l]=w,g=m}return g!==0&&(u.words[u.length++]=g),u},"imulK"),s._prime=i(function(u){if(O[u])return O[u];var g;if(u==="k256")g=new P;else if(u==="p224")g=new z;else if(u==="p192")g=new Z;else if(u==="p25519")g=new V;else throw new Error("Unknown prime "+u);return O[u]=g,g},"prime");function ee(F){if(typeof F=="string"){var u=s._prime(F);this.m=u.p,this.prime=u}else a(F.gtn(1),"modulus must be greater than 1"),this.m=F,this.prime=null}i(ee,"Red"),ee.prototype._verify1=i(function(u){a(u.negative===0,"red works only with positives"),a(u.red,"red works only with red numbers")},"_verify1"),ee.prototype._verify2=i(function(u,g){a((u.negative|g.negative)===0,"red works only with positives"),a(u.red&&u.red===g.red,"red works only with red numbers")},"_verify2"),ee.prototype.imod=i(function(u){return this.prime?this.prime.ireduce(u)._forceRed(this):u.umod(this.m)._forceRed(this)},"imod"),ee.prototype.neg=i(function(u){return u.isZero()?u.clone():this.m.sub(u)._forceRed(this)},"neg"),ee.prototype.add=i(function(u,g){this._verify2(u,g);var l=u.add(g);return l.cmp(this.m)>=0&&l.isub(this.m),l._forceRed(this)},"add"),ee.prototype.iadd=i(function(u,g){this._verify2(u,g);var l=u.iadd(g);return l.cmp(this.m)>=0&&l.isub(this.m),l},"iadd"),ee.prototype.sub=i(function(u,g){this._verify2(u,g);var l=u.sub(g);return l.cmpn(0)<0&&l.iadd(this.m),l._forceRed(this)},"sub"),ee.prototype.isub=i(function(u,g){this._verify2(u,g);var l=u.isub(g);return l.cmpn(0)<0&&l.iadd(this.m),l},"isub"),ee.prototype.shl=i(function(u,g){return this._verify1(u),this.imod(u.ushln(g))},"shl"),ee.prototype.imul=i(function(u,g){return this._verify2(u,g),this.imod(u.imul(g))},"imul"),ee.prototype.mul=i(function(u,g){return this._verify2(u,g),this.imod(u.mul(g))},"mul"),ee.prototype.isqr=i(function(u){return this.imul(u,u.clone())},"isqr"),ee.prototype.sqr=i(function(u){return this.mul(u,u)},"sqr"),ee.prototype.sqrt=i(function(u){if(u.isZero())return u.clone();var g=this.m.andln(3);if(a(g%2===1),g===3){var l=this.m.add(new s(1)).iushrn(2);return this.pow(u,l)}for(var m=this.m.subn(1),w=0;!m.isZero()&&m.andln(1)===0;)w++,m.iushrn(1);a(!m.isZero());var M=new s(1).toRed(this),j=M.redNeg(),S=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new s(2*f*f).toRed(this);this.pow(f,S).cmp(j)!==0;)f.redIAdd(j);for(var _=this.pow(f,m),E=this.pow(u,m.addn(1).iushrn(1)),I=this.pow(u,m),D=w;I.cmp(M)!==0;){for(var L=I,U=0;L.cmp(M)!==0;U++)L=L.redSqr();a(U<D);var B=this.pow(_,new s(1).iushln(D-U-1));E=E.redMul(B),_=B.redSqr(),I=I.redMul(_),D=U}return E},"sqrt"),ee.prototype.invm=i(function(u){var g=u._invmp(this.m);return g.negative!==0?(g.negative=0,this.imod(g).redNeg()):this.imod(g)},"invm"),ee.prototype.pow=i(function(u,g){if(g.isZero())return new s(1).toRed(this);if(g.cmpn(1)===0)return u.clone();var l=4,m=new Array(1<<l);m[0]=new s(1).toRed(this),m[1]=u;for(var w=2;w<m.length;w++)m[w]=this.mul(m[w-1],u);var M=m[0],j=0,S=0,f=g.bitLength()%26;for(f===0&&(f=26),w=g.length-1;w>=0;w--){for(var _=g.words[w],E=f-1;E>=0;E--){var I=_>>E&1;if(M!==m[0]&&(M=this.sqr(M)),I===0&&j===0){S=0;continue}j<<=1,j|=I,S++,!(S!==l&&(w!==0||E!==0))&&(M=this.mul(M,m[j]),S=0,j=0)}f=26}return M},"pow"),ee.prototype.convertTo=i(function(u){var g=u.umod(this.m);return g===u?g.clone():g},"convertTo"),ee.prototype.convertFrom=i(function(u){var g=u.clone();return g.red=null,g},"convertFrom"),s.mont=i(function(u){return new $(u)},"mont");function $(F){ee.call(this,F),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i($,"Mont"),n($,ee),$.prototype.convertTo=i(function(u){return this.imod(u.ushln(this.shift))},"convertTo"),$.prototype.convertFrom=i(function(u){var g=this.imod(u.mul(this.rinv));return g.red=null,g},"convertFrom"),$.prototype.imul=i(function(u,g){if(u.isZero()||g.isZero())return u.words[0]=0,u.length=1,u;var l=u.imul(g),m=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=l.isub(m).iushrn(this.shift),M=w;return w.cmp(this.m)>=0?M=w.isub(this.m):w.cmpn(0)<0&&(M=w.iadd(this.m)),M._forceRed(this)},"imul"),$.prototype.mul=i(function(u,g){if(u.isZero()||g.isZero())return new s(0)._forceRed(this);var l=u.mul(g),m=l.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=l.isub(m).iushrn(this.shift),M=w;return w.cmp(this.m)>=0?M=w.isub(this.m):w.cmpn(0)<0&&(M=w.iadd(this.m)),M._forceRed(this)},"mul"),$.prototype.invm=i(function(u){var g=this.imod(u._invmp(this.m).mul(this.r2));return g._forceRed(this)},"invm")})(e,JP)})(Mu)),Mu.exports}i(Nr,"requireBn$2");var zl={exports:{}},a6;function Nv(){if(a6)return zl.exports;a6=1;var e;zl.exports=i(function(n){return e||(e=new t(null)),e.generate(n)},"rand");function t(a){this.rand=a}if(i(t,"Rand"),zl.exports.Rand=t,t.prototype.generate=i(function(n){return this._rand(n)},"generate"),t.prototype._rand=i(function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var s=new Uint8Array(n),o=0;o<s.length;o++)s[o]=this.rand.getByte();return s},"_rand"),typeof self=="object")self.crypto&&self.crypto.getRandomValues?t.prototype._rand=i(function(n){var s=new Uint8Array(n);return self.crypto.getRandomValues(s),s},"_rand"):self.msCrypto&&self.msCrypto.getRandomValues?t.prototype._rand=i(function(n){var s=new Uint8Array(n);return self.msCrypto.getRandomValues(s),s},"_rand"):typeof window=="object"&&(t.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var r=Ai;if(typeof r.randomBytes!="function")throw new Error("Not supported");t.prototype._rand=i(function(n){return r.randomBytes(n)},"_rand")}catch{}return zl.exports}i(Nv,"requireBrorand");var Wh,s6;function z7(){if(s6)return Wh;s6=1;var e=Nr(),t=Nv();function r(a){this.rand=a||new t.Rand}return i(r,"MillerRabin"),Wh=r,r.create=i(function(n){return new r(n)},"create"),r.prototype._randbelow=i(function(n){var s=n.bitLength(),o=Math.ceil(s/8);do var h=new e(this.rand.generate(o));while(h.cmp(n)>=0);return h},"_randbelow"),r.prototype._randrange=i(function(n,s){var o=s.sub(n);return n.add(this._randbelow(o))},"_randrange"),r.prototype.test=i(function(n,s,o){var h=n.bitLength(),p=e.mont(n),v=new e(1).toRed(p);s||(s=Math.max(1,h/48|0));for(var c=n.subn(1),d=0;!c.testn(d);d++);for(var y=n.shrn(d),b=c.toRed(p),x=!0;s>0;s--){var k=this._randrange(new e(2),c);o&&o(k);var N=k.toRed(p).redPow(y);if(!(N.cmp(v)===0||N.cmp(b)===0)){for(var C=1;C<d;C++){if(N=N.redSqr(),N.cmp(v)===0)return!1;if(N.cmp(b)===0)break}if(C===d)return!1}}return x},"test"),r.prototype.getDivisor=i(function(n,s){var o=n.bitLength(),h=e.mont(n),p=new e(1).toRed(h);s||(s=Math.max(1,o/48|0));for(var v=n.subn(1),c=0;!v.testn(c);c++);for(var d=n.shrn(c),y=v.toRed(h);s>0;s--){var b=this._randrange(new e(2),v),x=n.gcd(b);if(x.cmpn(1)!==0)return x;var k=b.toRed(h).redPow(d);if(!(k.cmp(p)===0||k.cmp(y)===0)){for(var N=1;N<c;N++){if(k=k.redSqr(),k.cmp(p)===0)return k.fromRed().subn(1).gcd(n);if(k.cmp(y)===0)break}if(N===c)return k=k.redSqr(),k.fromRed().subn(1).gcd(n)}}return!1},"getDivisor"),Wh}i(z7,"requireMr");var Qh,o6;function U7(){if(o6)return Qh;o6=1;var e=ys();Qh=N,N.simpleSieve=x,N.fermatTest=k;var t=Nr(),r=new t(24),a=z7(),n=new a,s=new t(1),o=new t(2),h=new t(5);new t(16),new t(8);var p=new t(10),v=new t(3);new t(7);var c=new t(11),d=new t(4);new t(12);var y=null;function b(){if(y!==null)return y;var C=1048576,R=[];R[0]=2;for(var O=1,T=3;T<C;T+=2){for(var P=Math.ceil(Math.sqrt(T)),z=0;z<O&&R[z]<=P&&T%R[z]!==0;z++);O!==z&&R[z]<=P||(R[O++]=T)}return y=R,R}i(b,"_getPrimes");function x(C){for(var R=b(),O=0;O<R.length;O++)if(C.modn(R[O])===0)return C.cmpn(R[O])===0;return!0}i(x,"simpleSieve");function k(C){var R=t.mont(C);return o.toRed(R).redPow(C.subn(1)).fromRed().cmpn(1)===0}i(k,"fermatTest");function N(C,R){if(C<16)return R===2||R===5?new t([140,123]):new t([140,39]);R=new t(R);for(var O,T;;){for(O=new t(e(Math.ceil(C/8)));O.bitLength()>C;)O.ishrn(1);if(O.isEven()&&O.iadd(s),O.testn(1)||O.iadd(o),R.cmp(o)){if(!R.cmp(h))for(;O.mod(p).cmp(v);)O.iadd(d)}else for(;O.mod(r).cmp(c);)O.iadd(d);if(T=O.shrn(1),x(T)&&x(O)&&k(T)&&k(O)&&n.test(T)&&n.test(O))return O}}return i(N,"findPrime"),Qh}i(U7,"requireGeneratePrime");const qP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},KP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},XP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},WP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},QP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},YP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},eD={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},tD={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},rD={modp1:qP,modp2:KP,modp5:XP,modp14:WP,modp15:QP,modp16:YP,modp17:eD,modp18:tD};var Yh,l6;function iD(){if(l6)return Yh;l6=1;var e=Nr(),t=z7(),r=new t,a=new e(24),n=new e(11),s=new e(10),o=new e(3),h=new e(7),p=U7(),v=ys();Yh=x;function c(N,C){return C=C||"utf8",Buffer.isBuffer(N)||(N=new Buffer(N,C)),this._pub=new e(N),this}i(c,"setPublicKey");function d(N,C){return C=C||"utf8",Buffer.isBuffer(N)||(N=new Buffer(N,C)),this._priv=new e(N),this}i(d,"setPrivateKey");var y={};function b(N,C){var R=C.toString("hex"),O=[R,N.toString(16)].join("_");if(O in y)return y[O];var T=0;if(N.isEven()||!p.simpleSieve||!p.fermatTest(N)||!r.test(N))return T+=1,R==="02"||R==="05"?T+=8:T+=4,y[O]=T,T;r.test(N.shrn(1))||(T+=2);var P;switch(R){case"02":N.mod(a).cmp(n)&&(T+=8);break;case"05":P=N.mod(s),P.cmp(o)&&P.cmp(h)&&(T+=8);break;default:T+=4}return y[O]=T,T}i(b,"checkPrime");function x(N,C,R){this.setGenerator(C),this.__prime=new e(N),this._prime=e.mont(this.__prime),this._primeLen=N.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,R?(this.setPublicKey=c,this.setPrivateKey=d):this._primeCode=8}i(x,"DH"),Object.defineProperty(x.prototype,"verifyError",{enumerable:!0,get:i(function(){return typeof this._primeCode!="number"&&(this._primeCode=b(this.__prime,this.__gen)),this._primeCode},"get")}),x.prototype.generateKeys=function(){return this._priv||(this._priv=new e(v(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},x.prototype.computeSecret=function(N){N=new e(N),N=N.toRed(this._prime);var C=N.redPow(this._priv).fromRed(),R=new Buffer(C.toArray()),O=this.getPrime();if(R.length<O.length){var T=new Buffer(O.length-R.length);T.fill(0),R=Buffer.concat([T,R])}return R},x.prototype.getPublicKey=i(function(C){return k(this._pub,C)},"getPublicKey"),x.prototype.getPrivateKey=i(function(C){return k(this._priv,C)},"getPrivateKey"),x.prototype.getPrime=function(N){return k(this.__prime,N)},x.prototype.getGenerator=function(N){return k(this._gen,N)},x.prototype.setGenerator=function(N,C){return C=C||"utf8",Buffer.isBuffer(N)||(N=new Buffer(N,C)),this.__gen=N,this._gen=new e(N),this};function k(N,C){var R=new Buffer(N.toArray());return C?R.toString(C):R}return i(k,"formatReturnValue"),Yh}i(iD,"requireDh");var u6;function nD(){if(u6)return Qn;u6=1;var e=U7(),t=rD,r=iD();function a(o){var h=new Buffer(t[o].prime,"hex"),p=new Buffer(t[o].gen,"hex");return new r(h,p)}i(a,"getDiffieHellman");var n={binary:!0,hex:!0,base64:!0};function s(o,h,p,v){return Buffer.isBuffer(h)||n[h]===void 0?s(o,"binary",h,p):(h=h||"binary",v=v||"binary",p=p||new Buffer([2]),Buffer.isBuffer(p)||(p=new Buffer(p,v)),typeof o=="number"?new r(e(o,p),p,!0):(Buffer.isBuffer(o)||(o=new Buffer(o,h)),new r(o,p,!0)))}return i(s,"createDiffieHellman"),Qn.DiffieHellmanGroup=Qn.createDiffieHellmanGroup=Qn.getDiffieHellman=a,Qn.createDiffieHellman=Qn.DiffieHellman=s,Qn}i(nD,"requireBrowser$4");var Cs={exports:{}},Eu={exports:{}},aD=Eu.exports,f6;function sD(){return f6||(f6=1,(function(e){(function(t,r){function a(g,l){if(!g)throw new Error(l||"Assertion failed")}i(a,"assert");function n(g,l){g.super_=l;var m=i(function(){},"TempCtor");m.prototype=l.prototype,g.prototype=new m,g.prototype.constructor=g}i(n,"inherits");function s(g,l,m){if(s.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((l==="le"||l==="be")&&(m=l,l=10),this._init(g||0,l||10,m||"be"))}i(s,"BN"),typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Ai.Buffer}catch{}s.isBN=i(function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},"isBN"),s.max=i(function(l,m){return l.cmp(m)>0?l:m},"max"),s.min=i(function(l,m){return l.cmp(m)<0?l:m},"min"),s.prototype._init=i(function(l,m,w){if(typeof l=="number")return this._initNumber(l,m,w);if(typeof l=="object")return this._initArray(l,m,w);m==="hex"&&(m=16),a(m===(m|0)&&m>=2&&m<=36),l=l.toString().replace(/\s+/g,"");var M=0;l[0]==="-"&&(M++,this.negative=1),M<l.length&&(m===16?this._parseHex(l,M,w):(this._parseBase(l,m,M),w==="le"&&this._initArray(this.toArray(),m,w)))},"init"),s.prototype._initNumber=i(function(l,m,w){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(a(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),w==="le"&&this._initArray(this.toArray(),m,w)},"_initNumber"),s.prototype._initArray=i(function(l,m,w){if(a(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var j,S,f=0;if(w==="be")for(M=l.length-1,j=0;M>=0;M-=3)S=l[M]|l[M-1]<<8|l[M-2]<<16,this.words[j]|=S<<f&67108863,this.words[j+1]=S>>>26-f&67108863,f+=24,f>=26&&(f-=26,j++);else if(w==="le")for(M=0,j=0;M<l.length;M+=3)S=l[M]|l[M+1]<<8|l[M+2]<<16,this.words[j]|=S<<f&67108863,this.words[j+1]=S>>>26-f&67108863,f+=24,f>=26&&(f-=26,j++);return this._strip()},"_initArray");function h(g,l){var m=g.charCodeAt(l);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;a(!1,"Invalid character in "+g)}i(h,"parseHex4Bits");function p(g,l,m){var w=h(g,m);return m-1>=l&&(w|=h(g,m-1)<<4),w}i(p,"parseHexByte"),s.prototype._parseHex=i(function(l,m,w){this.length=Math.ceil((l.length-m)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var j=0,S=0,f;if(w==="be")for(M=l.length-1;M>=m;M-=2)f=p(l,m,M)<<j,this.words[S]|=f&67108863,j>=18?(j-=18,S+=1,this.words[S]|=f>>>26):j+=8;else{var _=l.length-m;for(M=_%2===0?m+1:m;M<l.length;M+=2)f=p(l,m,M)<<j,this.words[S]|=f&67108863,j>=18?(j-=18,S+=1,this.words[S]|=f>>>26):j+=8}this._strip()},"_parseHex");function v(g,l,m,w){for(var M=0,j=0,S=Math.min(g.length,m),f=l;f<S;f++){var _=g.charCodeAt(f)-48;M*=w,_>=49?j=_-49+10:_>=17?j=_-17+10:j=_,a(_>=0&&j<w,"Invalid character"),M+=j}return M}i(v,"parseBase"),s.prototype._parseBase=i(function(l,m,w){this.words=[0],this.length=1;for(var M=0,j=1;j<=67108863;j*=m)M++;M--,j=j/m|0;for(var S=l.length-w,f=S%M,_=Math.min(S,S-f)+w,E=0,I=w;I<_;I+=M)E=v(l,I,I+M,m),this.imuln(j),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E);if(f!==0){var D=1;for(E=v(l,I,l.length,m),I=0;I<f;I++)D*=m;this.imuln(D),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E)}this._strip()},"_parseBase"),s.prototype.copy=i(function(l){l.words=new Array(this.length);for(var m=0;m<this.length;m++)l.words[m]=this.words[m];l.length=this.length,l.negative=this.negative,l.red=this.red},"copy");function c(g,l){g.words=l.words,g.length=l.length,g.negative=l.negative,g.red=l.red}if(i(c,"move"),s.prototype._move=i(function(l){c(l,this)},"_move"),s.prototype.clone=i(function(){var l=new s(null);return this.copy(l),l},"clone"),s.prototype._expand=i(function(l){for(;this.length<l;)this.words[this.length++]=0;return this},"_expand"),s.prototype._strip=i(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),s.prototype._normSign=i(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{s.prototype.inspect=d}else s.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}i(d,"inspect");var y=["","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"],b=[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],x=[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];s.prototype.toString=i(function(l,m){l=l||10,m=m|0||1;var w;if(l===16||l==="hex"){w="";for(var M=0,j=0,S=0;S<this.length;S++){var f=this.words[S],_=((f<<M|j)&16777215).toString(16);j=f>>>24-M&16777215,M+=2,M>=26&&(M-=26,S--),j!==0||S!==this.length-1?w=y[6-_.length]+_+w:w=_+w}for(j!==0&&(w=j.toString(16)+w);w.length%m!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(l===(l|0)&&l>=2&&l<=36){var E=b[l],I=x[l];w="";var D=this.clone();for(D.negative=0;!D.isZero();){var L=D.modrn(I).toString(l);D=D.idivn(I),D.isZero()?w=L+w:w=y[E-L.length]+L+w}for(this.isZero()&&(w="0"+w);w.length%m!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}a(!1,"Base should be between 2 and 36")},"toString"),s.prototype.toNumber=i(function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},"toNumber"),s.prototype.toJSON=i(function(){return this.toString(16,2)},"toJSON"),o&&(s.prototype.toBuffer=i(function(l,m){return this.toArrayLike(o,l,m)},"toBuffer")),s.prototype.toArray=i(function(l,m){return this.toArrayLike(Array,l,m)},"toArray");var k=i(function(l,m){return l.allocUnsafe?l.allocUnsafe(m):new l(m)},"allocate");s.prototype.toArrayLike=i(function(l,m,w){this._strip();var M=this.byteLength(),j=w||Math.max(1,M);a(M<=j,"byte array longer than desired length"),a(j>0,"Requested array length <= 0");var S=k(l,j),f=m==="le"?"LE":"BE";return this["_toArrayLike"+f](S,M),S},"toArrayLike"),s.prototype._toArrayLikeLE=i(function(l,m){for(var w=0,M=0,j=0,S=0;j<this.length;j++){var f=this.words[j]<<S|M;l[w++]=f&255,w<l.length&&(l[w++]=f>>8&255),w<l.length&&(l[w++]=f>>16&255),S===6?(w<l.length&&(l[w++]=f>>24&255),M=0,S=0):(M=f>>>24,S+=2)}if(w<l.length)for(l[w++]=M;w<l.length;)l[w++]=0},"_toArrayLikeLE"),s.prototype._toArrayLikeBE=i(function(l,m){for(var w=l.length-1,M=0,j=0,S=0;j<this.length;j++){var f=this.words[j]<<S|M;l[w--]=f&255,w>=0&&(l[w--]=f>>8&255),w>=0&&(l[w--]=f>>16&255),S===6?(w>=0&&(l[w--]=f>>24&255),M=0,S=0):(M=f>>>24,S+=2)}if(w>=0)for(l[w--]=M;w>=0;)l[w--]=0},"_toArrayLikeBE"),Math.clz32?s.prototype._countBits=i(function(l){return 32-Math.clz32(l)},"_countBits"):s.prototype._countBits=i(function(l){var m=l,w=0;return m>=4096&&(w+=13,m>>>=13),m>=64&&(w+=7,m>>>=7),m>=8&&(w+=4,m>>>=4),m>=2&&(w+=2,m>>>=2),w+m},"_countBits"),s.prototype._zeroBits=i(function(l){if(l===0)return 26;var m=l,w=0;return(m&8191)===0&&(w+=13,m>>>=13),(m&127)===0&&(w+=7,m>>>=7),(m&15)===0&&(w+=4,m>>>=4),(m&3)===0&&(w+=2,m>>>=2),(m&1)===0&&w++,w},"_zeroBits"),s.prototype.bitLength=i(function(){var l=this.words[this.length-1],m=this._countBits(l);return(this.length-1)*26+m},"bitLength");function N(g){for(var l=new Array(g.bitLength()),m=0;m<l.length;m++){var w=m/26|0,M=m%26;l[m]=g.words[w]>>>M&1}return l}i(N,"toBitArray"),s.prototype.zeroBits=i(function(){if(this.isZero())return 0;for(var l=0,m=0;m<this.length;m++){var w=this._zeroBits(this.words[m]);if(l+=w,w!==26)break}return l},"zeroBits"),s.prototype.byteLength=i(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),s.prototype.toTwos=i(function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},"toTwos"),s.prototype.fromTwos=i(function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},"fromTwos"),s.prototype.isNeg=i(function(){return this.negative!==0},"isNeg"),s.prototype.neg=i(function(){return this.clone().ineg()},"neg"),s.prototype.ineg=i(function(){return this.isZero()||(this.negative^=1),this},"ineg"),s.prototype.iuor=i(function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var m=0;m<l.length;m++)this.words[m]=this.words[m]|l.words[m];return this._strip()},"iuor"),s.prototype.ior=i(function(l){return a((this.negative|l.negative)===0),this.iuor(l)},"ior"),s.prototype.or=i(function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},"or"),s.prototype.uor=i(function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},"uor"),s.prototype.iuand=i(function(l){var m;this.length>l.length?m=l:m=this;for(var w=0;w<m.length;w++)this.words[w]=this.words[w]&l.words[w];return this.length=m.length,this._strip()},"iuand"),s.prototype.iand=i(function(l){return a((this.negative|l.negative)===0),this.iuand(l)},"iand"),s.prototype.and=i(function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},"and"),s.prototype.uand=i(function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},"uand"),s.prototype.iuxor=i(function(l){var m,w;this.length>l.length?(m=this,w=l):(m=l,w=this);for(var M=0;M<w.length;M++)this.words[M]=m.words[M]^w.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];return this.length=m.length,this._strip()},"iuxor"),s.prototype.ixor=i(function(l){return a((this.negative|l.negative)===0),this.iuxor(l)},"ixor"),s.prototype.xor=i(function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},"xor"),s.prototype.uxor=i(function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},"uxor"),s.prototype.inotn=i(function(l){a(typeof l=="number"&&l>=0);var m=Math.ceil(l/26)|0,w=l%26;this._expand(m),w>0&&m--;for(var M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return w>0&&(this.words[M]=~this.words[M]&67108863>>26-w),this._strip()},"inotn"),s.prototype.notn=i(function(l){return this.clone().inotn(l)},"notn"),s.prototype.setn=i(function(l,m){a(typeof l=="number"&&l>=0);var w=l/26|0,M=l%26;return this._expand(w+1),m?this.words[w]=this.words[w]|1<<M:this.words[w]=this.words[w]&~(1<<M),this._strip()},"setn"),s.prototype.iadd=i(function(l){var m;if(this.negative!==0&&l.negative===0)return this.negative=0,m=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,m=this.isub(l),l.negative=1,m._normSign();var w,M;this.length>l.length?(w=this,M=l):(w=l,M=this);for(var j=0,S=0;S<M.length;S++)m=(w.words[S]|0)+(M.words[S]|0)+j,this.words[S]=m&67108863,j=m>>>26;for(;j!==0&&S<w.length;S++)m=(w.words[S]|0)+j,this.words[S]=m&67108863,j=m>>>26;if(this.length=w.length,j!==0)this.words[this.length]=j,this.length++;else if(w!==this)for(;S<w.length;S++)this.words[S]=w.words[S];return this},"iadd"),s.prototype.add=i(function(l){var m;return l.negative!==0&&this.negative===0?(l.negative=0,m=this.sub(l),l.negative^=1,m):l.negative===0&&this.negative!==0?(this.negative=0,m=l.sub(this),this.negative=1,m):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},"add"),s.prototype.isub=i(function(l){if(l.negative!==0){l.negative=0;var m=this.iadd(l);return l.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var w=this.cmp(l);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,j;w>0?(M=this,j=l):(M=l,j=this);for(var S=0,f=0;f<j.length;f++)m=(M.words[f]|0)-(j.words[f]|0)+S,S=m>>26,this.words[f]=m&67108863;for(;S!==0&&f<M.length;f++)m=(M.words[f]|0)+S,S=m>>26,this.words[f]=m&67108863;if(S===0&&f<M.length&&M!==this)for(;f<M.length;f++)this.words[f]=M.words[f];return this.length=Math.max(this.length,f),M!==this&&(this.negative=1),this._strip()},"isub"),s.prototype.sub=i(function(l){return this.clone().isub(l)},"sub");function C(g,l,m){m.negative=l.negative^g.negative;var w=g.length+l.length|0;m.length=w,w=w-1|0;var M=g.words[0]|0,j=l.words[0]|0,S=M*j,f=S&67108863,_=S/67108864|0;m.words[0]=f;for(var E=1;E<w;E++){for(var I=_>>>26,D=_&67108863,L=Math.min(E,l.length-1),U=Math.max(0,E-g.length+1);U<=L;U++){var B=E-U|0;M=g.words[B]|0,j=l.words[U]|0,S=M*j+D,I+=S/67108864|0,D=S&67108863}m.words[E]=D|0,_=I|0}return _!==0?m.words[E]=_|0:m.length--,m._strip()}i(C,"smallMulTo");var R=i(function(l,m,w){var M=l.words,j=m.words,S=w.words,f=0,_,E,I,D=M[0]|0,L=D&8191,U=D>>>13,B=M[1]|0,G=B&8191,H=B>>>13,K=M[2]|0,_e=K&8191,se=K>>>13,ae=M[3]|0,ve=ae&8191,q=ae>>>13,ne=M[4]|0,X=ne&8191,W=ne>>>13,le=M[5]|0,ke=le&8191,be=le>>>13,fe=M[6]|0,Q=fe&8191,Y=fe>>>13,te=M[7]|0,he=te&8191,oe=te>>>13,ue=M[8]|0,ze=ue&8191,we=ue>>>13,Be=M[9]|0,We=Be&8191,ge=Be>>>13,Ue=j[0]|0,ce=Ue&8191,ye=Ue>>>13,Te=j[1]|0,Re=Te&8191,je=Te>>>13,$e=j[2]|0,Ye=$e&8191,Ne=$e>>>13,Ee=j[3]|0,Pe=Ee&8191,Se=Ee>>>13,Ze=j[4]|0,Ke=Ze&8191,re=Ze>>>13,pe=j[5]|0,Ce=pe&8191,xe=pe>>>13,Oe=j[6]|0,He=Oe&8191,ie=Oe>>>13,Ae=j[7]|0,Ge=Ae&8191,me=Ae>>>13,Je=j[8]|0,tt=Je&8191,De=Je>>>13,Qe=j[9]|0,Ie=Qe&8191,Fe=Qe>>>13;w.negative=l.negative^m.negative,w.length=19,_=Math.imul(L,ce),E=Math.imul(L,ye),E=E+Math.imul(U,ce)|0,I=Math.imul(U,ye);var lt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(lt>>>26)|0,lt&=67108863,_=Math.imul(G,ce),E=Math.imul(G,ye),E=E+Math.imul(H,ce)|0,I=Math.imul(H,ye),_=_+Math.imul(L,Re)|0,E=E+Math.imul(L,je)|0,E=E+Math.imul(U,Re)|0,I=I+Math.imul(U,je)|0;var yt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(yt>>>26)|0,yt&=67108863,_=Math.imul(_e,ce),E=Math.imul(_e,ye),E=E+Math.imul(se,ce)|0,I=Math.imul(se,ye),_=_+Math.imul(G,Re)|0,E=E+Math.imul(G,je)|0,E=E+Math.imul(H,Re)|0,I=I+Math.imul(H,je)|0,_=_+Math.imul(L,Ye)|0,E=E+Math.imul(L,Ne)|0,E=E+Math.imul(U,Ye)|0,I=I+Math.imul(U,Ne)|0;var ht=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(ht>>>26)|0,ht&=67108863,_=Math.imul(ve,ce),E=Math.imul(ve,ye),E=E+Math.imul(q,ce)|0,I=Math.imul(q,ye),_=_+Math.imul(_e,Re)|0,E=E+Math.imul(_e,je)|0,E=E+Math.imul(se,Re)|0,I=I+Math.imul(se,je)|0,_=_+Math.imul(G,Ye)|0,E=E+Math.imul(G,Ne)|0,E=E+Math.imul(H,Ye)|0,I=I+Math.imul(H,Ne)|0,_=_+Math.imul(L,Pe)|0,E=E+Math.imul(L,Se)|0,E=E+Math.imul(U,Pe)|0,I=I+Math.imul(U,Se)|0;var Mt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,_=Math.imul(X,ce),E=Math.imul(X,ye),E=E+Math.imul(W,ce)|0,I=Math.imul(W,ye),_=_+Math.imul(ve,Re)|0,E=E+Math.imul(ve,je)|0,E=E+Math.imul(q,Re)|0,I=I+Math.imul(q,je)|0,_=_+Math.imul(_e,Ye)|0,E=E+Math.imul(_e,Ne)|0,E=E+Math.imul(se,Ye)|0,I=I+Math.imul(se,Ne)|0,_=_+Math.imul(G,Pe)|0,E=E+Math.imul(G,Se)|0,E=E+Math.imul(H,Pe)|0,I=I+Math.imul(H,Se)|0,_=_+Math.imul(L,Ke)|0,E=E+Math.imul(L,re)|0,E=E+Math.imul(U,Ke)|0,I=I+Math.imul(U,re)|0;var Bt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,_=Math.imul(ke,ce),E=Math.imul(ke,ye),E=E+Math.imul(be,ce)|0,I=Math.imul(be,ye),_=_+Math.imul(X,Re)|0,E=E+Math.imul(X,je)|0,E=E+Math.imul(W,Re)|0,I=I+Math.imul(W,je)|0,_=_+Math.imul(ve,Ye)|0,E=E+Math.imul(ve,Ne)|0,E=E+Math.imul(q,Ye)|0,I=I+Math.imul(q,Ne)|0,_=_+Math.imul(_e,Pe)|0,E=E+Math.imul(_e,Se)|0,E=E+Math.imul(se,Pe)|0,I=I+Math.imul(se,Se)|0,_=_+Math.imul(G,Ke)|0,E=E+Math.imul(G,re)|0,E=E+Math.imul(H,Ke)|0,I=I+Math.imul(H,re)|0,_=_+Math.imul(L,Ce)|0,E=E+Math.imul(L,xe)|0,E=E+Math.imul(U,Ce)|0,I=I+Math.imul(U,xe)|0;var Et=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Et>>>26)|0,Et&=67108863,_=Math.imul(Q,ce),E=Math.imul(Q,ye),E=E+Math.imul(Y,ce)|0,I=Math.imul(Y,ye),_=_+Math.imul(ke,Re)|0,E=E+Math.imul(ke,je)|0,E=E+Math.imul(be,Re)|0,I=I+Math.imul(be,je)|0,_=_+Math.imul(X,Ye)|0,E=E+Math.imul(X,Ne)|0,E=E+Math.imul(W,Ye)|0,I=I+Math.imul(W,Ne)|0,_=_+Math.imul(ve,Pe)|0,E=E+Math.imul(ve,Se)|0,E=E+Math.imul(q,Pe)|0,I=I+Math.imul(q,Se)|0,_=_+Math.imul(_e,Ke)|0,E=E+Math.imul(_e,re)|0,E=E+Math.imul(se,Ke)|0,I=I+Math.imul(se,re)|0,_=_+Math.imul(G,Ce)|0,E=E+Math.imul(G,xe)|0,E=E+Math.imul(H,Ce)|0,I=I+Math.imul(H,xe)|0,_=_+Math.imul(L,He)|0,E=E+Math.imul(L,ie)|0,E=E+Math.imul(U,He)|0,I=I+Math.imul(U,ie)|0;var _t=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(_t>>>26)|0,_t&=67108863,_=Math.imul(he,ce),E=Math.imul(he,ye),E=E+Math.imul(oe,ce)|0,I=Math.imul(oe,ye),_=_+Math.imul(Q,Re)|0,E=E+Math.imul(Q,je)|0,E=E+Math.imul(Y,Re)|0,I=I+Math.imul(Y,je)|0,_=_+Math.imul(ke,Ye)|0,E=E+Math.imul(ke,Ne)|0,E=E+Math.imul(be,Ye)|0,I=I+Math.imul(be,Ne)|0,_=_+Math.imul(X,Pe)|0,E=E+Math.imul(X,Se)|0,E=E+Math.imul(W,Pe)|0,I=I+Math.imul(W,Se)|0,_=_+Math.imul(ve,Ke)|0,E=E+Math.imul(ve,re)|0,E=E+Math.imul(q,Ke)|0,I=I+Math.imul(q,re)|0,_=_+Math.imul(_e,Ce)|0,E=E+Math.imul(_e,xe)|0,E=E+Math.imul(se,Ce)|0,I=I+Math.imul(se,xe)|0,_=_+Math.imul(G,He)|0,E=E+Math.imul(G,ie)|0,E=E+Math.imul(H,He)|0,I=I+Math.imul(H,ie)|0,_=_+Math.imul(L,Ge)|0,E=E+Math.imul(L,me)|0,E=E+Math.imul(U,Ge)|0,I=I+Math.imul(U,me)|0;var Ft=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,_=Math.imul(ze,ce),E=Math.imul(ze,ye),E=E+Math.imul(we,ce)|0,I=Math.imul(we,ye),_=_+Math.imul(he,Re)|0,E=E+Math.imul(he,je)|0,E=E+Math.imul(oe,Re)|0,I=I+Math.imul(oe,je)|0,_=_+Math.imul(Q,Ye)|0,E=E+Math.imul(Q,Ne)|0,E=E+Math.imul(Y,Ye)|0,I=I+Math.imul(Y,Ne)|0,_=_+Math.imul(ke,Pe)|0,E=E+Math.imul(ke,Se)|0,E=E+Math.imul(be,Pe)|0,I=I+Math.imul(be,Se)|0,_=_+Math.imul(X,Ke)|0,E=E+Math.imul(X,re)|0,E=E+Math.imul(W,Ke)|0,I=I+Math.imul(W,re)|0,_=_+Math.imul(ve,Ce)|0,E=E+Math.imul(ve,xe)|0,E=E+Math.imul(q,Ce)|0,I=I+Math.imul(q,xe)|0,_=_+Math.imul(_e,He)|0,E=E+Math.imul(_e,ie)|0,E=E+Math.imul(se,He)|0,I=I+Math.imul(se,ie)|0,_=_+Math.imul(G,Ge)|0,E=E+Math.imul(G,me)|0,E=E+Math.imul(H,Ge)|0,I=I+Math.imul(H,me)|0,_=_+Math.imul(L,tt)|0,E=E+Math.imul(L,De)|0,E=E+Math.imul(U,tt)|0,I=I+Math.imul(U,De)|0;var Vt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,_=Math.imul(We,ce),E=Math.imul(We,ye),E=E+Math.imul(ge,ce)|0,I=Math.imul(ge,ye),_=_+Math.imul(ze,Re)|0,E=E+Math.imul(ze,je)|0,E=E+Math.imul(we,Re)|0,I=I+Math.imul(we,je)|0,_=_+Math.imul(he,Ye)|0,E=E+Math.imul(he,Ne)|0,E=E+Math.imul(oe,Ye)|0,I=I+Math.imul(oe,Ne)|0,_=_+Math.imul(Q,Pe)|0,E=E+Math.imul(Q,Se)|0,E=E+Math.imul(Y,Pe)|0,I=I+Math.imul(Y,Se)|0,_=_+Math.imul(ke,Ke)|0,E=E+Math.imul(ke,re)|0,E=E+Math.imul(be,Ke)|0,I=I+Math.imul(be,re)|0,_=_+Math.imul(X,Ce)|0,E=E+Math.imul(X,xe)|0,E=E+Math.imul(W,Ce)|0,I=I+Math.imul(W,xe)|0,_=_+Math.imul(ve,He)|0,E=E+Math.imul(ve,ie)|0,E=E+Math.imul(q,He)|0,I=I+Math.imul(q,ie)|0,_=_+Math.imul(_e,Ge)|0,E=E+Math.imul(_e,me)|0,E=E+Math.imul(se,Ge)|0,I=I+Math.imul(se,me)|0,_=_+Math.imul(G,tt)|0,E=E+Math.imul(G,De)|0,E=E+Math.imul(H,tt)|0,I=I+Math.imul(H,De)|0,_=_+Math.imul(L,Ie)|0,E=E+Math.imul(L,Fe)|0,E=E+Math.imul(U,Ie)|0,I=I+Math.imul(U,Fe)|0;var Tt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,_=Math.imul(We,Re),E=Math.imul(We,je),E=E+Math.imul(ge,Re)|0,I=Math.imul(ge,je),_=_+Math.imul(ze,Ye)|0,E=E+Math.imul(ze,Ne)|0,E=E+Math.imul(we,Ye)|0,I=I+Math.imul(we,Ne)|0,_=_+Math.imul(he,Pe)|0,E=E+Math.imul(he,Se)|0,E=E+Math.imul(oe,Pe)|0,I=I+Math.imul(oe,Se)|0,_=_+Math.imul(Q,Ke)|0,E=E+Math.imul(Q,re)|0,E=E+Math.imul(Y,Ke)|0,I=I+Math.imul(Y,re)|0,_=_+Math.imul(ke,Ce)|0,E=E+Math.imul(ke,xe)|0,E=E+Math.imul(be,Ce)|0,I=I+Math.imul(be,xe)|0,_=_+Math.imul(X,He)|0,E=E+Math.imul(X,ie)|0,E=E+Math.imul(W,He)|0,I=I+Math.imul(W,ie)|0,_=_+Math.imul(ve,Ge)|0,E=E+Math.imul(ve,me)|0,E=E+Math.imul(q,Ge)|0,I=I+Math.imul(q,me)|0,_=_+Math.imul(_e,tt)|0,E=E+Math.imul(_e,De)|0,E=E+Math.imul(se,tt)|0,I=I+Math.imul(se,De)|0,_=_+Math.imul(G,Ie)|0,E=E+Math.imul(G,Fe)|0,E=E+Math.imul(H,Ie)|0,I=I+Math.imul(H,Fe)|0;var zt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(zt>>>26)|0,zt&=67108863,_=Math.imul(We,Ye),E=Math.imul(We,Ne),E=E+Math.imul(ge,Ye)|0,I=Math.imul(ge,Ne),_=_+Math.imul(ze,Pe)|0,E=E+Math.imul(ze,Se)|0,E=E+Math.imul(we,Pe)|0,I=I+Math.imul(we,Se)|0,_=_+Math.imul(he,Ke)|0,E=E+Math.imul(he,re)|0,E=E+Math.imul(oe,Ke)|0,I=I+Math.imul(oe,re)|0,_=_+Math.imul(Q,Ce)|0,E=E+Math.imul(Q,xe)|0,E=E+Math.imul(Y,Ce)|0,I=I+Math.imul(Y,xe)|0,_=_+Math.imul(ke,He)|0,E=E+Math.imul(ke,ie)|0,E=E+Math.imul(be,He)|0,I=I+Math.imul(be,ie)|0,_=_+Math.imul(X,Ge)|0,E=E+Math.imul(X,me)|0,E=E+Math.imul(W,Ge)|0,I=I+Math.imul(W,me)|0,_=_+Math.imul(ve,tt)|0,E=E+Math.imul(ve,De)|0,E=E+Math.imul(q,tt)|0,I=I+Math.imul(q,De)|0,_=_+Math.imul(_e,Ie)|0,E=E+Math.imul(_e,Fe)|0,E=E+Math.imul(se,Ie)|0,I=I+Math.imul(se,Fe)|0;var Nt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,_=Math.imul(We,Pe),E=Math.imul(We,Se),E=E+Math.imul(ge,Pe)|0,I=Math.imul(ge,Se),_=_+Math.imul(ze,Ke)|0,E=E+Math.imul(ze,re)|0,E=E+Math.imul(we,Ke)|0,I=I+Math.imul(we,re)|0,_=_+Math.imul(he,Ce)|0,E=E+Math.imul(he,xe)|0,E=E+Math.imul(oe,Ce)|0,I=I+Math.imul(oe,xe)|0,_=_+Math.imul(Q,He)|0,E=E+Math.imul(Q,ie)|0,E=E+Math.imul(Y,He)|0,I=I+Math.imul(Y,ie)|0,_=_+Math.imul(ke,Ge)|0,E=E+Math.imul(ke,me)|0,E=E+Math.imul(be,Ge)|0,I=I+Math.imul(be,me)|0,_=_+Math.imul(X,tt)|0,E=E+Math.imul(X,De)|0,E=E+Math.imul(W,tt)|0,I=I+Math.imul(W,De)|0,_=_+Math.imul(ve,Ie)|0,E=E+Math.imul(ve,Fe)|0,E=E+Math.imul(q,Ie)|0,I=I+Math.imul(q,Fe)|0;var Pt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,_=Math.imul(We,Ke),E=Math.imul(We,re),E=E+Math.imul(ge,Ke)|0,I=Math.imul(ge,re),_=_+Math.imul(ze,Ce)|0,E=E+Math.imul(ze,xe)|0,E=E+Math.imul(we,Ce)|0,I=I+Math.imul(we,xe)|0,_=_+Math.imul(he,He)|0,E=E+Math.imul(he,ie)|0,E=E+Math.imul(oe,He)|0,I=I+Math.imul(oe,ie)|0,_=_+Math.imul(Q,Ge)|0,E=E+Math.imul(Q,me)|0,E=E+Math.imul(Y,Ge)|0,I=I+Math.imul(Y,me)|0,_=_+Math.imul(ke,tt)|0,E=E+Math.imul(ke,De)|0,E=E+Math.imul(be,tt)|0,I=I+Math.imul(be,De)|0,_=_+Math.imul(X,Ie)|0,E=E+Math.imul(X,Fe)|0,E=E+Math.imul(W,Ie)|0,I=I+Math.imul(W,Fe)|0;var Ut=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,_=Math.imul(We,Ce),E=Math.imul(We,xe),E=E+Math.imul(ge,Ce)|0,I=Math.imul(ge,xe),_=_+Math.imul(ze,He)|0,E=E+Math.imul(ze,ie)|0,E=E+Math.imul(we,He)|0,I=I+Math.imul(we,ie)|0,_=_+Math.imul(he,Ge)|0,E=E+Math.imul(he,me)|0,E=E+Math.imul(oe,Ge)|0,I=I+Math.imul(oe,me)|0,_=_+Math.imul(Q,tt)|0,E=E+Math.imul(Q,De)|0,E=E+Math.imul(Y,tt)|0,I=I+Math.imul(Y,De)|0,_=_+Math.imul(ke,Ie)|0,E=E+Math.imul(ke,Fe)|0,E=E+Math.imul(be,Ie)|0,I=I+Math.imul(be,Fe)|0;var Zt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,_=Math.imul(We,He),E=Math.imul(We,ie),E=E+Math.imul(ge,He)|0,I=Math.imul(ge,ie),_=_+Math.imul(ze,Ge)|0,E=E+Math.imul(ze,me)|0,E=E+Math.imul(we,Ge)|0,I=I+Math.imul(we,me)|0,_=_+Math.imul(he,tt)|0,E=E+Math.imul(he,De)|0,E=E+Math.imul(oe,tt)|0,I=I+Math.imul(oe,De)|0,_=_+Math.imul(Q,Ie)|0,E=E+Math.imul(Q,Fe)|0,E=E+Math.imul(Y,Ie)|0,I=I+Math.imul(Y,Fe)|0;var Ht=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,_=Math.imul(We,Ge),E=Math.imul(We,me),E=E+Math.imul(ge,Ge)|0,I=Math.imul(ge,me),_=_+Math.imul(ze,tt)|0,E=E+Math.imul(ze,De)|0,E=E+Math.imul(we,tt)|0,I=I+Math.imul(we,De)|0,_=_+Math.imul(he,Ie)|0,E=E+Math.imul(he,Fe)|0,E=E+Math.imul(oe,Ie)|0,I=I+Math.imul(oe,Fe)|0;var Jt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,_=Math.imul(We,tt),E=Math.imul(We,De),E=E+Math.imul(ge,tt)|0,I=Math.imul(ge,De),_=_+Math.imul(ze,Ie)|0,E=E+Math.imul(ze,Fe)|0,E=E+Math.imul(we,Ie)|0,I=I+Math.imul(we,Fe)|0;var Lr=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,_=Math.imul(We,Ie),E=Math.imul(We,Fe),E=E+Math.imul(ge,Ie)|0,I=Math.imul(ge,Fe);var de=(f+_|0)+((E&8191)<<13)|0;return f=(I+(E>>>13)|0)+(de>>>26)|0,de&=67108863,S[0]=lt,S[1]=yt,S[2]=ht,S[3]=Mt,S[4]=Bt,S[5]=Et,S[6]=_t,S[7]=Ft,S[8]=Vt,S[9]=Tt,S[10]=zt,S[11]=Nt,S[12]=Pt,S[13]=Ut,S[14]=Zt,S[15]=Ht,S[16]=Jt,S[17]=Lr,S[18]=de,f!==0&&(S[19]=f,w.length++),w},"comb10MulTo");Math.imul||(R=C);function O(g,l,m){m.negative=l.negative^g.negative,m.length=g.length+l.length;for(var w=0,M=0,j=0;j<m.length-1;j++){var S=M;M=0;for(var f=w&67108863,_=Math.min(j,l.length-1),E=Math.max(0,j-g.length+1);E<=_;E++){var I=j-E,D=g.words[I]|0,L=l.words[E]|0,U=D*L,B=U&67108863;S=S+(U/67108864|0)|0,B=B+f|0,f=B&67108863,S=S+(B>>>26)|0,M+=S>>>26,S&=67108863}m.words[j]=f,w=S,S=M}return w!==0?m.words[j]=w:m.length--,m._strip()}i(O,"bigMulTo");function T(g,l,m){return O(g,l,m)}i(T,"jumboMulTo"),s.prototype.mulTo=i(function(l,m){var w,M=this.length+l.length;return this.length===10&&l.length===10?w=R(this,l,m):M<63?w=C(this,l,m):M<1024?w=O(this,l,m):w=T(this,l,m),w},"mulTo"),s.prototype.mul=i(function(l){var m=new s(null);return m.words=new Array(this.length+l.length),this.mulTo(l,m)},"mul"),s.prototype.mulf=i(function(l){var m=new s(null);return m.words=new Array(this.length+l.length),T(this,l,m)},"mulf"),s.prototype.imul=i(function(l){return this.clone().mulTo(l,this)},"imul"),s.prototype.imuln=i(function(l){var m=l<0;m&&(l=-l),a(typeof l=="number"),a(l<67108864);for(var w=0,M=0;M<this.length;M++){var j=(this.words[M]|0)*l,S=(j&67108863)+(w&67108863);w>>=26,w+=j/67108864|0,w+=S>>>26,this.words[M]=S&67108863}return w!==0&&(this.words[M]=w,this.length++),this.length=l===0?1:this.length,m?this.ineg():this},"imuln"),s.prototype.muln=i(function(l){return this.clone().imuln(l)},"muln"),s.prototype.sqr=i(function(){return this.mul(this)},"sqr"),s.prototype.isqr=i(function(){return this.imul(this.clone())},"isqr"),s.prototype.pow=i(function(l){var m=N(l);if(m.length===0)return new s(1);for(var w=this,M=0;M<m.length&&m[M]===0;M++,w=w.sqr());if(++M<m.length)for(var j=w.sqr();M<m.length;M++,j=j.sqr())m[M]!==0&&(w=w.mul(j));return w},"pow"),s.prototype.iushln=i(function(l){a(typeof l=="number"&&l>=0);var m=l%26,w=(l-m)/26,M=67108863>>>26-m<<26-m,j;if(m!==0){var S=0;for(j=0;j<this.length;j++){var f=this.words[j]&M,_=(this.words[j]|0)-f<<m;this.words[j]=_|S,S=f>>>26-m}S&&(this.words[j]=S,this.length++)}if(w!==0){for(j=this.length-1;j>=0;j--)this.words[j+w]=this.words[j];for(j=0;j<w;j++)this.words[j]=0;this.length+=w}return this._strip()},"iushln"),s.prototype.ishln=i(function(l){return a(this.negative===0),this.iushln(l)},"ishln"),s.prototype.iushrn=i(function(l,m,w){a(typeof l=="number"&&l>=0);var M;m?M=(m-m%26)/26:M=0;var j=l%26,S=Math.min((l-j)/26,this.length),f=67108863^67108863>>>j<<j,_=w;if(M-=S,M=Math.max(0,M),_){for(var E=0;E<S;E++)_.words[E]=this.words[E];_.length=S}if(S!==0)if(this.length>S)for(this.length-=S,E=0;E<this.length;E++)this.words[E]=this.words[E+S];else this.words[0]=0,this.length=1;var I=0;for(E=this.length-1;E>=0&&(I!==0||E>=M);E--){var D=this.words[E]|0;this.words[E]=I<<26-j|D>>>j,I=D&f}return _&&I!==0&&(_.words[_.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},"iushrn"),s.prototype.ishrn=i(function(l,m,w){return a(this.negative===0),this.iushrn(l,m,w)},"ishrn"),s.prototype.shln=i(function(l){return this.clone().ishln(l)},"shln"),s.prototype.ushln=i(function(l){return this.clone().iushln(l)},"ushln"),s.prototype.shrn=i(function(l){return this.clone().ishrn(l)},"shrn"),s.prototype.ushrn=i(function(l){return this.clone().iushrn(l)},"ushrn"),s.prototype.testn=i(function(l){a(typeof l=="number"&&l>=0);var m=l%26,w=(l-m)/26,M=1<<m;if(this.length<=w)return!1;var j=this.words[w];return!!(j&M)},"testn"),s.prototype.imaskn=i(function(l){a(typeof l=="number"&&l>=0);var m=l%26,w=(l-m)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(m!==0&&w++,this.length=Math.min(w,this.length),m!==0){var M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}return this._strip()},"imaskn"),s.prototype.maskn=i(function(l){return this.clone().imaskn(l)},"maskn"),s.prototype.iaddn=i(function(l){return a(typeof l=="number"),a(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},"iaddn"),s.prototype._iaddn=i(function(l){this.words[0]+=l;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},"_iaddn"),s.prototype.isubn=i(function(l){if(a(typeof l=="number"),a(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},"isubn"),s.prototype.addn=i(function(l){return this.clone().iaddn(l)},"addn"),s.prototype.subn=i(function(l){return this.clone().isubn(l)},"subn"),s.prototype.iabs=i(function(){return this.negative=0,this},"iabs"),s.prototype.abs=i(function(){return this.clone().iabs()},"abs"),s.prototype._ishlnsubmul=i(function(l,m,w){var M=l.length+w,j;this._expand(M);var S,f=0;for(j=0;j<l.length;j++){S=(this.words[j+w]|0)+f;var _=(l.words[j]|0)*m;S-=_&67108863,f=(S>>26)-(_/67108864|0),this.words[j+w]=S&67108863}for(;j<this.length-w;j++)S=(this.words[j+w]|0)+f,f=S>>26,this.words[j+w]=S&67108863;if(f===0)return this._strip();for(a(f===-1),f=0,j=0;j<this.length;j++)S=-(this.words[j]|0)+f,f=S>>26,this.words[j]=S&67108863;return this.negative=1,this._strip()},"_ishlnsubmul"),s.prototype._wordDiv=i(function(l,m){var w=this.length-l.length,M=this.clone(),j=l,S=j.words[j.length-1]|0,f=this._countBits(S);w=26-f,w!==0&&(j=j.ushln(w),M.iushln(w),S=j.words[j.length-1]|0);var _=M.length-j.length,E;if(m!=="mod"){E=new s(null),E.length=_+1,E.words=new Array(E.length);for(var I=0;I<E.length;I++)E.words[I]=0}var D=M.clone()._ishlnsubmul(j,1,_);D.negative===0&&(M=D,E&&(E.words[_]=1));for(var L=_-1;L>=0;L--){var U=(M.words[j.length+L]|0)*67108864+(M.words[j.length+L-1]|0);for(U=Math.min(U/S|0,67108863),M._ishlnsubmul(j,U,L);M.negative!==0;)U--,M.negative=0,M._ishlnsubmul(j,1,L),M.isZero()||(M.negative^=1);E&&(E.words[L]=U)}return E&&E._strip(),M._strip(),m!=="div"&&w!==0&&M.iushrn(w),{div:E||null,mod:M}},"_wordDiv"),s.prototype.divmod=i(function(l,m,w){if(a(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var M,j,S;return this.negative!==0&&l.negative===0?(S=this.neg().divmod(l,m),m!=="mod"&&(M=S.div.neg()),m!=="div"&&(j=S.mod.neg(),w&&j.negative!==0&&j.iadd(l)),{div:M,mod:j}):this.negative===0&&l.negative!==0?(S=this.divmod(l.neg(),m),m!=="mod"&&(M=S.div.neg()),{div:M,mod:S.mod}):(this.negative&l.negative)!==0?(S=this.neg().divmod(l.neg(),m),m!=="div"&&(j=S.mod.neg(),w&&j.negative!==0&&j.isub(l)),{div:S.div,mod:j}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?m==="div"?{div:this.divn(l.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,m)},"divmod"),s.prototype.div=i(function(l){return this.divmod(l,"div",!1).div},"div"),s.prototype.mod=i(function(l){return this.divmod(l,"mod",!1).mod},"mod"),s.prototype.umod=i(function(l){return this.divmod(l,"mod",!0).mod},"umod"),s.prototype.divRound=i(function(l){var m=this.divmod(l);if(m.mod.isZero())return m.div;var w=m.div.negative!==0?m.mod.isub(l):m.mod,M=l.ushrn(1),j=l.andln(1),S=w.cmp(M);return S<0||j===1&&S===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},"divRound"),s.prototype.modrn=i(function(l){var m=l<0;m&&(l=-l),a(l<=67108863);for(var w=(1<<26)%l,M=0,j=this.length-1;j>=0;j--)M=(w*M+(this.words[j]|0))%l;return m?-M:M},"modrn"),s.prototype.modn=i(function(l){return this.modrn(l)},"modn"),s.prototype.idivn=i(function(l){var m=l<0;m&&(l=-l),a(l<=67108863);for(var w=0,M=this.length-1;M>=0;M--){var j=(this.words[M]|0)+w*67108864;this.words[M]=j/l|0,w=j%l}return this._strip(),m?this.ineg():this},"idivn"),s.prototype.divn=i(function(l){return this.clone().idivn(l)},"divn"),s.prototype.egcd=i(function(l){a(l.negative===0),a(!l.isZero());var m=this,w=l.clone();m.negative!==0?m=m.umod(l):m=m.clone();for(var M=new s(1),j=new s(0),S=new s(0),f=new s(1),_=0;m.isEven()&&w.isEven();)m.iushrn(1),w.iushrn(1),++_;for(var E=w.clone(),I=m.clone();!m.isZero();){for(var D=0,L=1;(m.words[0]&L)===0&&D<26;++D,L<<=1);if(D>0)for(m.iushrn(D);D-- >0;)(M.isOdd()||j.isOdd())&&(M.iadd(E),j.isub(I)),M.iushrn(1),j.iushrn(1);for(var U=0,B=1;(w.words[0]&B)===0&&U<26;++U,B<<=1);if(U>0)for(w.iushrn(U);U-- >0;)(S.isOdd()||f.isOdd())&&(S.iadd(E),f.isub(I)),S.iushrn(1),f.iushrn(1);m.cmp(w)>=0?(m.isub(w),M.isub(S),j.isub(f)):(w.isub(m),S.isub(M),f.isub(j))}return{a:S,b:f,gcd:w.iushln(_)}},"egcd"),s.prototype._invmp=i(function(l){a(l.negative===0),a(!l.isZero());var m=this,w=l.clone();m.negative!==0?m=m.umod(l):m=m.clone();for(var M=new s(1),j=new s(0),S=w.clone();m.cmpn(1)>0&&w.cmpn(1)>0;){for(var f=0,_=1;(m.words[0]&_)===0&&f<26;++f,_<<=1);if(f>0)for(m.iushrn(f);f-- >0;)M.isOdd()&&M.iadd(S),M.iushrn(1);for(var E=0,I=1;(w.words[0]&I)===0&&E<26;++E,I<<=1);if(E>0)for(w.iushrn(E);E-- >0;)j.isOdd()&&j.iadd(S),j.iushrn(1);m.cmp(w)>=0?(m.isub(w),M.isub(j)):(w.isub(m),j.isub(M))}var D;return m.cmpn(1)===0?D=M:D=j,D.cmpn(0)<0&&D.iadd(l),D},"_invmp"),s.prototype.gcd=i(function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var m=this.clone(),w=l.clone();m.negative=0,w.negative=0;for(var M=0;m.isEven()&&w.isEven();M++)m.iushrn(1),w.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;w.isEven();)w.iushrn(1);var j=m.cmp(w);if(j<0){var S=m;m=w,w=S}else if(j===0||w.cmpn(1)===0)break;m.isub(w)}while(!0);return w.iushln(M)},"gcd"),s.prototype.invm=i(function(l){return this.egcd(l).a.umod(l)},"invm"),s.prototype.isEven=i(function(){return(this.words[0]&1)===0},"isEven"),s.prototype.isOdd=i(function(){return(this.words[0]&1)===1},"isOdd"),s.prototype.andln=i(function(l){return this.words[0]&l},"andln"),s.prototype.bincn=i(function(l){a(typeof l=="number");var m=l%26,w=(l-m)/26,M=1<<m;if(this.length<=w)return this._expand(w+1),this.words[w]|=M,this;for(var j=M,S=w;j!==0&&S<this.length;S++){var f=this.words[S]|0;f+=j,j=f>>>26,f&=67108863,this.words[S]=f}return j!==0&&(this.words[S]=j,this.length++),this},"bincn"),s.prototype.isZero=i(function(){return this.length===1&&this.words[0]===0},"isZero"),s.prototype.cmpn=i(function(l){var m=l<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var w;if(this.length>1)w=1;else{m&&(l=-l),a(l<=67108863,"Number is too big");var M=this.words[0]|0;w=M===l?0:M<l?-1:1}return this.negative!==0?-w|0:w},"cmpn"),s.prototype.cmp=i(function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var m=this.ucmp(l);return this.negative!==0?-m|0:m},"cmp"),s.prototype.ucmp=i(function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var m=0,w=this.length-1;w>=0;w--){var M=this.words[w]|0,j=l.words[w]|0;if(M!==j){M<j?m=-1:M>j&&(m=1);break}}return m},"ucmp"),s.prototype.gtn=i(function(l){return this.cmpn(l)===1},"gtn"),s.prototype.gt=i(function(l){return this.cmp(l)===1},"gt"),s.prototype.gten=i(function(l){return this.cmpn(l)>=0},"gten"),s.prototype.gte=i(function(l){return this.cmp(l)>=0},"gte"),s.prototype.ltn=i(function(l){return this.cmpn(l)===-1},"ltn"),s.prototype.lt=i(function(l){return this.cmp(l)===-1},"lt"),s.prototype.lten=i(function(l){return this.cmpn(l)<=0},"lten"),s.prototype.lte=i(function(l){return this.cmp(l)<=0},"lte"),s.prototype.eqn=i(function(l){return this.cmpn(l)===0},"eqn"),s.prototype.eq=i(function(l){return this.cmp(l)===0},"eq"),s.red=i(function(l){return new F(l)},"red"),s.prototype.toRed=i(function(l){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},"toRed"),s.prototype.fromRed=i(function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),s.prototype._forceRed=i(function(l){return this.red=l,this},"_forceRed"),s.prototype.forceRed=i(function(l){return a(!this.red,"Already a number in reduction context"),this._forceRed(l)},"forceRed"),s.prototype.redAdd=i(function(l){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},"redAdd"),s.prototype.redIAdd=i(function(l){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},"redIAdd"),s.prototype.redSub=i(function(l){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},"redSub"),s.prototype.redISub=i(function(l){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},"redISub"),s.prototype.redShl=i(function(l){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},"redShl"),s.prototype.redMul=i(function(l){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},"redMul"),s.prototype.redIMul=i(function(l){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},"redIMul"),s.prototype.redSqr=i(function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),s.prototype.redISqr=i(function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),s.prototype.redSqrt=i(function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),s.prototype.redInvm=i(function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),s.prototype.redNeg=i(function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),s.prototype.redPow=i(function(l){return a(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)},"redPow");var P={k256:null,p224:null,p192:null,p25519:null};function z(g,l){this.name=g,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}i(z,"MPrime"),z.prototype._tmp=i(function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},"_tmp"),z.prototype.ireduce=i(function(l){var m=l,w;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),w=m.bitLength();while(w>this.n);var M=w<this.n?-1:m.ucmp(this.p);return M===0?(m.words[0]=0,m.length=1):M>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},"ireduce"),z.prototype.split=i(function(l,m){l.iushrn(this.n,0,m)},"split"),z.prototype.imulK=i(function(l){return l.imul(this.k)},"imulK");function Z(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Z,"K256"),n(Z,z),Z.prototype.split=i(function(l,m){for(var w=4194303,M=Math.min(l.length,9),j=0;j<M;j++)m.words[j]=l.words[j];if(m.length=M,l.length<=9){l.words[0]=0,l.length=1;return}var S=l.words[9];for(m.words[m.length++]=S&w,j=10;j<l.length;j++){var f=l.words[j]|0;l.words[j-10]=(f&w)<<4|S>>>22,S=f}S>>>=22,l.words[j-10]=S,S===0&&l.length>10?l.length-=10:l.length-=9},"split"),Z.prototype.imulK=i(function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var m=0,w=0;w<l.length;w++){var M=l.words[w]|0;m+=M*977,l.words[w]=m&67108863,m=M*64+(m/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l},"imulK");function V(){z.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(V,"P224"),n(V,z);function ee(){z.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ee,"P192"),n(ee,z);function $(){z.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i($,"P25519"),n($,z),$.prototype.imulK=i(function(l){for(var m=0,w=0;w<l.length;w++){var M=(l.words[w]|0)*19+m,j=M&67108863;M>>>=26,l.words[w]=j,m=M}return m!==0&&(l.words[l.length++]=m),l},"imulK"),s._prime=i(function(l){if(P[l])return P[l];var m;if(l==="k256")m=new Z;else if(l==="p224")m=new V;else if(l==="p192")m=new ee;else if(l==="p25519")m=new $;else throw new Error("Unknown prime "+l);return P[l]=m,m},"prime");function F(g){if(typeof g=="string"){var l=s._prime(g);this.m=l.p,this.prime=l}else a(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}i(F,"Red"),F.prototype._verify1=i(function(l){a(l.negative===0,"red works only with positives"),a(l.red,"red works only with red numbers")},"_verify1"),F.prototype._verify2=i(function(l,m){a((l.negative|m.negative)===0,"red works only with positives"),a(l.red&&l.red===m.red,"red works only with red numbers")},"_verify2"),F.prototype.imod=i(function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(c(l,l.umod(this.m)._forceRed(this)),l)},"imod"),F.prototype.neg=i(function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},"neg"),F.prototype.add=i(function(l,m){this._verify2(l,m);var w=l.add(m);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},"add"),F.prototype.iadd=i(function(l,m){this._verify2(l,m);var w=l.iadd(m);return w.cmp(this.m)>=0&&w.isub(this.m),w},"iadd"),F.prototype.sub=i(function(l,m){this._verify2(l,m);var w=l.sub(m);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},"sub"),F.prototype.isub=i(function(l,m){this._verify2(l,m);var w=l.isub(m);return w.cmpn(0)<0&&w.iadd(this.m),w},"isub"),F.prototype.shl=i(function(l,m){return this._verify1(l),this.imod(l.ushln(m))},"shl"),F.prototype.imul=i(function(l,m){return this._verify2(l,m),this.imod(l.imul(m))},"imul"),F.prototype.mul=i(function(l,m){return this._verify2(l,m),this.imod(l.mul(m))},"mul"),F.prototype.isqr=i(function(l){return this.imul(l,l.clone())},"isqr"),F.prototype.sqr=i(function(l){return this.mul(l,l)},"sqr"),F.prototype.sqrt=i(function(l){if(l.isZero())return l.clone();var m=this.m.andln(3);if(a(m%2===1),m===3){var w=this.m.add(new s(1)).iushrn(2);return this.pow(l,w)}for(var M=this.m.subn(1),j=0;!M.isZero()&&M.andln(1)===0;)j++,M.iushrn(1);a(!M.isZero());var S=new s(1).toRed(this),f=S.redNeg(),_=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,_).cmp(f)!==0;)E.redIAdd(f);for(var I=this.pow(E,M),D=this.pow(l,M.addn(1).iushrn(1)),L=this.pow(l,M),U=j;L.cmp(S)!==0;){for(var B=L,G=0;B.cmp(S)!==0;G++)B=B.redSqr();a(G<U);var H=this.pow(I,new s(1).iushln(U-G-1));D=D.redMul(H),I=H.redSqr(),L=L.redMul(I),U=G}return D},"sqrt"),F.prototype.invm=i(function(l){var m=l._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},"invm"),F.prototype.pow=i(function(l,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return l.clone();var w=4,M=new Array(1<<w);M[0]=new s(1).toRed(this),M[1]=l;for(var j=2;j<M.length;j++)M[j]=this.mul(M[j-1],l);var S=M[0],f=0,_=0,E=m.bitLength()%26;for(E===0&&(E=26),j=m.length-1;j>=0;j--){for(var I=m.words[j],D=E-1;D>=0;D--){var L=I>>D&1;if(S!==M[0]&&(S=this.sqr(S)),L===0&&f===0){_=0;continue}f<<=1,f|=L,_++,!(_!==w&&(j!==0||D!==0))&&(S=this.mul(S,M[f]),_=0,f=0)}E=26}return S},"pow"),F.prototype.convertTo=i(function(l){var m=l.umod(this.m);return m===l?m.clone():m},"convertTo"),F.prototype.convertFrom=i(function(l){var m=l.clone();return m.red=null,m},"convertFrom"),s.mont=i(function(l){return new u(l)},"mont");function u(g){F.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(u,"Mont"),n(u,F),u.prototype.convertTo=i(function(l){return this.imod(l.ushln(this.shift))},"convertTo"),u.prototype.convertFrom=i(function(l){var m=this.imod(l.mul(this.rinv));return m.red=null,m},"convertFrom"),u.prototype.imul=i(function(l,m){if(l.isZero()||m.isZero())return l.words[0]=0,l.length=1,l;var w=l.imul(m),M=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=w.isub(M).iushrn(this.shift),S=j;return j.cmp(this.m)>=0?S=j.isub(this.m):j.cmpn(0)<0&&(S=j.iadd(this.m)),S._forceRed(this)},"imul"),u.prototype.mul=i(function(l,m){if(l.isZero()||m.isZero())return new s(0)._forceRed(this);var w=l.mul(m),M=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=w.isub(M).iushrn(this.shift),S=j;return j.cmp(this.m)>=0?S=j.isub(this.m):j.cmpn(0)<0&&(S=j.iadd(this.m)),S._forceRed(this)},"mul"),u.prototype.invm=i(function(l){var m=this.imod(l._invmp(this.m).mul(this.r2));return m._forceRed(this)},"invm")})(e,aD)})(Eu)),Eu.exports}i(sD,"requireBn$1");var e0,c6;function Iv(){if(c6)return e0;c6=1;var e=sD(),t=ys(),r=At().Buffer;function a(o){var h=o.modulus.byteLength(),p;do p=new e(t(h));while(p.cmp(o.modulus)>=0||!p.umod(o.prime1)||!p.umod(o.prime2));return p}i(a,"getr");function n(o){var h=a(o),p=h.toRed(e.mont(o.modulus)).redPow(new e(o.publicExponent)).fromRed();return{blinder:p,unblinder:h.invm(o.modulus)}}i(n,"blind");function s(o,h){var p=n(h),v=h.modulus.byteLength(),c=new e(o).mul(p.blinder).umod(h.modulus),d=c.toRed(e.mont(h.prime1)),y=c.toRed(e.mont(h.prime2)),b=h.coefficient,x=h.prime1,k=h.prime2,N=d.redPow(h.exponent1).fromRed(),C=y.redPow(h.exponent2).fromRed(),R=N.isub(C).imul(b).umod(x).imul(k);return C.iadd(R).imul(p.unblinder).umod(h.modulus).toArrayLike(r,"be",v)}return i(s,"crt"),s.getr=a,e0=s,e0}i(Iv,"requireBrowserifyRsa");var t0={};const oD="6.6.1",lD={version:oD};var r0={},i0={},d6;function F7(){return d6||(d6=1,(function(e){var t=e;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var h=[];if(typeof s!="string"){for(var p=0;p<s.length;p++)h[p]=s[p]|0;return h}if(o==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var p=0;p<s.length;p+=2)h.push(parseInt(s[p]+s[p+1],16))}else for(var p=0;p<s.length;p++){var v=s.charCodeAt(p),c=v>>8,d=v&255;c?h.push(c,d):h.push(d)}return h}i(r,"toArray"),t.toArray=r;function a(s){return s.length===1?"0"+s:s}i(a,"zero2"),t.zero2=a;function n(s){for(var o="",h=0;h<s.length;h++)o+=a(s[h].toString(16));return o}i(n,"toHex"),t.toHex=n,t.encode=i(function(o,h){return h==="hex"?n(o):o},"encode")})(i0)),i0}i(F7,"requireUtils$2");var h6;function di(){return h6||(h6=1,(function(e){var t=e,r=Nr(),a=ci(),n=F7();t.assert=a,t.toArray=n.toArray,t.zero2=n.zero2,t.toHex=n.toHex,t.encode=n.encode;function s(c,d,y){var b=new Array(Math.max(c.bitLength(),y)+1),x;for(x=0;x<b.length;x+=1)b[x]=0;var k=1<<d+1,N=c.clone();for(x=0;x<b.length;x++){var C,R=N.andln(k-1);N.isOdd()?(R>(k>>1)-1?C=(k>>1)-R:C=R,N.isubn(C)):C=0,b[x]=C,N.iushrn(1)}return b}i(s,"getNAF"),t.getNAF=s;function o(c,d){var y=[[],[]];c=c.clone(),d=d.clone();for(var b=0,x=0,k;c.cmpn(-b)>0||d.cmpn(-x)>0;){var N=c.andln(3)+b&3,C=d.andln(3)+x&3;N===3&&(N=-1),C===3&&(C=-1);var R;(N&1)===0?R=0:(k=c.andln(7)+b&7,(k===3||k===5)&&C===2?R=-N:R=N),y[0].push(R);var O;(C&1)===0?O=0:(k=d.andln(7)+x&7,(k===3||k===5)&&N===2?O=-C:O=C),y[1].push(O),2*b===R+1&&(b=1-b),2*x===O+1&&(x=1-x),c.iushrn(1),d.iushrn(1)}return y}i(o,"getJSF"),t.getJSF=o;function h(c,d,y){var b="_"+d;c.prototype[d]=i(function(){return this[b]!==void 0?this[b]:this[b]=y.call(this)},"cachedProperty")}i(h,"cachedProperty"),t.cachedProperty=h;function p(c){return typeof c=="string"?t.toArray(c,"hex"):c}i(p,"parseBytes"),t.parseBytes=p;function v(c){return new r(c,"hex","le")}i(v,"intFromLE"),t.intFromLE=v})(r0)),r0}i(di,"requireUtils$1");var n0={},a0,p6;function Gf(){if(p6)return a0;p6=1;var e=Nr(),t=di(),r=t.getNAF,a=t.getJSF,n=t.assert;function s(h,p){this.type=h,this.p=new e(p.p,16),this.red=p.prime?e.red(p.prime):e.mont(this.p),this.zero=new e(0).toRed(this.red),this.one=new e(1).toRed(this.red),this.two=new e(2).toRed(this.red),this.n=p.n&&new e(p.n,16),this.g=p.g&&this.pointFromJSON(p.g,p.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var v=this.n&&this.p.div(this.n);!v||v.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}i(s,"BaseCurve"),a0=s,s.prototype.point=i(function(){throw new Error("Not implemented")},"point"),s.prototype.validate=i(function(){throw new Error("Not implemented")},"validate"),s.prototype._fixedNafMul=i(function(p,v){n(p.precomputed);var c=p._getDoubles(),d=r(v,1,this._bitLength),y=(1<<c.step+1)-(c.step%2===0?2:1);y/=3;var b=[],x,k;for(x=0;x<d.length;x+=c.step){k=0;for(var N=x+c.step-1;N>=x;N--)k=(k<<1)+d[N];b.push(k)}for(var C=this.jpoint(null,null,null),R=this.jpoint(null,null,null),O=y;O>0;O--){for(x=0;x<b.length;x++)k=b[x],k===O?R=R.mixedAdd(c.points[x]):k===-O&&(R=R.mixedAdd(c.points[x].neg()));C=C.add(R)}return C.toP()},"_fixedNafMul"),s.prototype._wnafMul=i(function(p,v){var c=4,d=p._getNAFPoints(c);c=d.wnd;for(var y=d.points,b=r(v,c,this._bitLength),x=this.jpoint(null,null,null),k=b.length-1;k>=0;k--){for(var N=0;k>=0&&b[k]===0;k--)N++;if(k>=0&&N++,x=x.dblp(N),k<0)break;var C=b[k];n(C!==0),p.type==="affine"?C>0?x=x.mixedAdd(y[C-1>>1]):x=x.mixedAdd(y[-C-1>>1].neg()):C>0?x=x.add(y[C-1>>1]):x=x.add(y[-C-1>>1].neg())}return p.type==="affine"?x.toP():x},"_wnafMul"),s.prototype._wnafMulAdd=i(function(p,v,c,d,y){var b=this._wnafT1,x=this._wnafT2,k=this._wnafT3,N=0,C,R,O;for(C=0;C<d;C++){O=v[C];var T=O._getNAFPoints(p);b[C]=T.wnd,x[C]=T.points}for(C=d-1;C>=1;C-=2){var P=C-1,z=C;if(b[P]!==1||b[z]!==1){k[P]=r(c[P],b[P],this._bitLength),k[z]=r(c[z],b[z],this._bitLength),N=Math.max(k[P].length,N),N=Math.max(k[z].length,N);continue}var Z=[v[P],null,null,v[z]];v[P].y.cmp(v[z].y)===0?(Z[1]=v[P].add(v[z]),Z[2]=v[P].toJ().mixedAdd(v[z].neg())):v[P].y.cmp(v[z].y.redNeg())===0?(Z[1]=v[P].toJ().mixedAdd(v[z]),Z[2]=v[P].add(v[z].neg())):(Z[1]=v[P].toJ().mixedAdd(v[z]),Z[2]=v[P].toJ().mixedAdd(v[z].neg()));var V=[-3,-1,-5,-7,0,7,5,1,3],ee=a(c[P],c[z]);for(N=Math.max(ee[0].length,N),k[P]=new Array(N),k[z]=new Array(N),R=0;R<N;R++){var $=ee[0][R]|0,F=ee[1][R]|0;k[P][R]=V[($+1)*3+(F+1)],k[z][R]=0,x[P]=Z}}var u=this.jpoint(null,null,null),g=this._wnafT4;for(C=N;C>=0;C--){for(var l=0;C>=0;){var m=!0;for(R=0;R<d;R++)g[R]=k[R][C]|0,g[R]!==0&&(m=!1);if(!m)break;l++,C--}if(C>=0&&l++,u=u.dblp(l),C<0)break;for(R=0;R<d;R++){var w=g[R];w!==0&&(w>0?O=x[R][w-1>>1]:w<0&&(O=x[R][-w-1>>1].neg()),O.type==="affine"?u=u.mixedAdd(O):u=u.add(O))}}for(C=0;C<d;C++)x[C]=null;return y?u:u.toP()},"_wnafMulAdd");function o(h,p){this.curve=h,this.type=p,this.precomputed=null}return i(o,"BasePoint"),s.BasePoint=o,o.prototype.eq=i(function(){throw new Error("Not implemented")},"eq"),o.prototype.validate=i(function(){return this.curve.validate(this)},"validate"),s.prototype.decodePoint=i(function(p,v){p=t.toArray(p,v);var c=this.p.byteLength();if((p[0]===4||p[0]===6||p[0]===7)&&p.length-1===2*c){p[0]===6?n(p[p.length-1]%2===0):p[0]===7&&n(p[p.length-1]%2===1);var d=this.point(p.slice(1,1+c),p.slice(1+c,1+2*c));return d}else if((p[0]===2||p[0]===3)&&p.length-1===c)return this.pointFromX(p.slice(1,1+c),p[0]===3);throw new Error("Unknown point format")},"decodePoint"),o.prototype.encodeCompressed=i(function(p){return this.encode(p,!0)},"encodeCompressed"),o.prototype._encode=i(function(p){var v=this.curve.p.byteLength(),c=this.getX().toArray("be",v);return p?[this.getY().isEven()?2:3].concat(c):[4].concat(c,this.getY().toArray("be",v))},"_encode"),o.prototype.encode=i(function(p,v){return t.encode(this._encode(v),p)},"encode"),o.prototype.precompute=i(function(p){if(this.precomputed)return this;var v={doubles:null,naf:null,beta:null};return v.naf=this._getNAFPoints(8),v.doubles=this._getDoubles(4,p),v.beta=this._getBeta(),this.precomputed=v,this},"precompute"),o.prototype._hasDoubles=i(function(p){if(!this.precomputed)return!1;var v=this.precomputed.doubles;return v?v.points.length>=Math.ceil((p.bitLength()+1)/v.step):!1},"_hasDoubles"),o.prototype._getDoubles=i(function(p,v){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var c=[this],d=this,y=0;y<v;y+=p){for(var b=0;b<p;b++)d=d.dbl();c.push(d)}return{step:p,points:c}},"_getDoubles"),o.prototype._getNAFPoints=i(function(p){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var v=[this],c=(1<<p)-1,d=c===1?null:this.dbl(),y=1;y<c;y++)v[y]=v[y-1].add(d);return{wnd:p,points:v}},"_getNAFPoints"),o.prototype._getBeta=i(function(){return null},"_getBeta"),o.prototype.dblp=i(function(p){for(var v=this,c=0;c<p;c++)v=v.dbl();return v},"dblp"),a0}i(Gf,"requireBase$1");var s0,m6;function uD(){if(m6)return s0;m6=1;var e=di(),t=Nr(),r=Lt(),a=Gf(),n=e.assert;function s(p){a.call(this,"short",p),this.a=new t(p.a,16).toRed(this.red),this.b=new t(p.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(p),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}i(s,"ShortCurve"),r(s,a),s0=s,s.prototype._getEndomorphism=i(function(v){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var c,d;if(v.beta)c=new t(v.beta,16).toRed(this.red);else{var y=this._getEndoRoots(this.p);c=y[0].cmp(y[1])<0?y[0]:y[1],c=c.toRed(this.red)}if(v.lambda)d=new t(v.lambda,16);else{var b=this._getEndoRoots(this.n);this.g.mul(b[0]).x.cmp(this.g.x.redMul(c))===0?d=b[0]:(d=b[1],n(this.g.mul(d).x.cmp(this.g.x.redMul(c))===0))}var x;return v.basis?x=v.basis.map(function(k){return{a:new t(k.a,16),b:new t(k.b,16)}}):x=this._getEndoBasis(d),{beta:c,lambda:d,basis:x}}},"_getEndomorphism"),s.prototype._getEndoRoots=i(function(v){var c=v===this.p?this.red:t.mont(v),d=new t(2).toRed(c).redInvm(),y=d.redNeg(),b=new t(3).toRed(c).redNeg().redSqrt().redMul(d),x=y.redAdd(b).fromRed(),k=y.redSub(b).fromRed();return[x,k]},"_getEndoRoots"),s.prototype._getEndoBasis=i(function(v){for(var c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=v,y=this.n.clone(),b=new t(1),x=new t(0),k=new t(0),N=new t(1),C,R,O,T,P,z,Z,V=0,ee,$;d.cmpn(0)!==0;){var F=y.div(d);ee=y.sub(F.mul(d)),$=k.sub(F.mul(b));var u=N.sub(F.mul(x));if(!O&&ee.cmp(c)<0)C=Z.neg(),R=b,O=ee.neg(),T=$;else if(O&&++V===2)break;Z=ee,y=d,d=ee,k=b,b=$,N=x,x=u}P=ee.neg(),z=$;var g=O.sqr().add(T.sqr()),l=P.sqr().add(z.sqr());return l.cmp(g)>=0&&(P=C,z=R),O.negative&&(O=O.neg(),T=T.neg()),P.negative&&(P=P.neg(),z=z.neg()),[{a:O,b:T},{a:P,b:z}]},"_getEndoBasis"),s.prototype._endoSplit=i(function(v){var c=this.endo.basis,d=c[0],y=c[1],b=y.b.mul(v).divRound(this.n),x=d.b.neg().mul(v).divRound(this.n),k=b.mul(d.a),N=x.mul(y.a),C=b.mul(d.b),R=x.mul(y.b),O=v.sub(k).sub(N),T=C.add(R).neg();return{k1:O,k2:T}},"_endoSplit"),s.prototype.pointFromX=i(function(v,c){v=new t(v,16),v.red||(v=v.toRed(this.red));var d=v.redSqr().redMul(v).redIAdd(v.redMul(this.a)).redIAdd(this.b),y=d.redSqrt();if(y.redSqr().redSub(d).cmp(this.zero)!==0)throw new Error("invalid point");var b=y.fromRed().isOdd();return(c&&!b||!c&&b)&&(y=y.redNeg()),this.point(v,y)},"pointFromX"),s.prototype.validate=i(function(v){if(v.inf)return!0;var c=v.x,d=v.y,y=this.a.redMul(c),b=c.redSqr().redMul(c).redIAdd(y).redIAdd(this.b);return d.redSqr().redISub(b).cmpn(0)===0},"validate"),s.prototype._endoWnafMulAdd=i(function(v,c,d){for(var y=this._endoWnafT1,b=this._endoWnafT2,x=0;x<v.length;x++){var k=this._endoSplit(c[x]),N=v[x],C=N._getBeta();k.k1.negative&&(k.k1.ineg(),N=N.neg(!0)),k.k2.negative&&(k.k2.ineg(),C=C.neg(!0)),y[x*2]=N,y[x*2+1]=C,b[x*2]=k.k1,b[x*2+1]=k.k2}for(var R=this._wnafMulAdd(1,y,b,x*2,d),O=0;O<x*2;O++)y[O]=null,b[O]=null;return R},"_endoWnafMulAdd");function o(p,v,c,d){a.BasePoint.call(this,p,"affine"),v===null&&c===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new t(v,16),this.y=new t(c,16),d&&(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)}i(o,"Point"),r(o,a.BasePoint),s.prototype.point=i(function(v,c,d){return new o(this,v,c,d)},"point"),s.prototype.pointFromJSON=i(function(v,c){return o.fromJSON(this,v,c)},"pointFromJSON"),o.prototype._getBeta=i(function(){if(this.curve.endo){var v=this.precomputed;if(v&&v.beta)return v.beta;var c=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(v){var d=this.curve,y=i(function(b){return d.point(b.x.redMul(d.endo.beta),b.y)},"endoMul");v.beta=c,c.precomputed={beta:null,naf:v.naf&&{wnd:v.naf.wnd,points:v.naf.points.map(y)},doubles:v.doubles&&{step:v.doubles.step,points:v.doubles.points.map(y)}}}return c}},"_getBeta"),o.prototype.toJSON=i(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]},"toJSON"),o.fromJSON=i(function(v,c,d){typeof c=="string"&&(c=JSON.parse(c));var y=v.point(c[0],c[1],d);if(!c[2])return y;function b(k){return v.point(k[0],k[1],d)}i(b,"obj2point");var x=c[2];return y.precomputed={beta:null,doubles:x.doubles&&{step:x.doubles.step,points:[y].concat(x.doubles.points.map(b))},naf:x.naf&&{wnd:x.naf.wnd,points:[y].concat(x.naf.points.map(b))}},y},"fromJSON"),o.prototype.inspect=i(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect"),o.prototype.isInfinity=i(function(){return this.inf},"isInfinity"),o.prototype.add=i(function(v){if(this.inf)return v;if(v.inf)return this;if(this.eq(v))return this.dbl();if(this.neg().eq(v))return this.curve.point(null,null);if(this.x.cmp(v.x)===0)return this.curve.point(null,null);var c=this.y.redSub(v.y);c.cmpn(0)!==0&&(c=c.redMul(this.x.redSub(v.x).redInvm()));var d=c.redSqr().redISub(this.x).redISub(v.x),y=c.redMul(this.x.redSub(d)).redISub(this.y);return this.curve.point(d,y)},"add"),o.prototype.dbl=i(function(){if(this.inf)return this;var v=this.y.redAdd(this.y);if(v.cmpn(0)===0)return this.curve.point(null,null);var c=this.curve.a,d=this.x.redSqr(),y=v.redInvm(),b=d.redAdd(d).redIAdd(d).redIAdd(c).redMul(y),x=b.redSqr().redISub(this.x.redAdd(this.x)),k=b.redMul(this.x.redSub(x)).redISub(this.y);return this.curve.point(x,k)},"dbl"),o.prototype.getX=i(function(){return this.x.fromRed()},"getX"),o.prototype.getY=i(function(){return this.y.fromRed()},"getY"),o.prototype.mul=i(function(v){return v=new t(v,16),this.isInfinity()?this:this._hasDoubles(v)?this.curve._fixedNafMul(this,v):this.curve.endo?this.curve._endoWnafMulAdd([this],[v]):this.curve._wnafMul(this,v)},"mul"),o.prototype.mulAdd=i(function(v,c,d){var y=[this,c],b=[v,d];return this.curve.endo?this.curve._endoWnafMulAdd(y,b):this.curve._wnafMulAdd(1,y,b,2)},"mulAdd"),o.prototype.jmulAdd=i(function(v,c,d){var y=[this,c],b=[v,d];return this.curve.endo?this.curve._endoWnafMulAdd(y,b,!0):this.curve._wnafMulAdd(1,y,b,2,!0)},"jmulAdd"),o.prototype.eq=i(function(v){return this===v||this.inf===v.inf&&(this.inf||this.x.cmp(v.x)===0&&this.y.cmp(v.y)===0)},"eq"),o.prototype.neg=i(function(v){if(this.inf)return this;var c=this.curve.point(this.x,this.y.redNeg());if(v&&this.precomputed){var d=this.precomputed,y=i(function(b){return b.neg()},"negate");c.precomputed={naf:d.naf&&{wnd:d.naf.wnd,points:d.naf.points.map(y)},doubles:d.doubles&&{step:d.doubles.step,points:d.doubles.points.map(y)}}}return c},"neg"),o.prototype.toJ=i(function(){if(this.inf)return this.curve.jpoint(null,null,null);var v=this.curve.jpoint(this.x,this.y,this.curve.one);return v},"toJ");function h(p,v,c,d){a.BasePoint.call(this,p,"jacobian"),v===null&&c===null&&d===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new t(0)):(this.x=new t(v,16),this.y=new t(c,16),this.z=new t(d,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}return i(h,"JPoint"),r(h,a.BasePoint),s.prototype.jpoint=i(function(v,c,d){return new h(this,v,c,d)},"jpoint"),h.prototype.toP=i(function(){if(this.isInfinity())return this.curve.point(null,null);var v=this.z.redInvm(),c=v.redSqr(),d=this.x.redMul(c),y=this.y.redMul(c).redMul(v);return this.curve.point(d,y)},"toP"),h.prototype.neg=i(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg"),h.prototype.add=i(function(v){if(this.isInfinity())return v;if(v.isInfinity())return this;var c=v.z.redSqr(),d=this.z.redSqr(),y=this.x.redMul(c),b=v.x.redMul(d),x=this.y.redMul(c.redMul(v.z)),k=v.y.redMul(d.redMul(this.z)),N=y.redSub(b),C=x.redSub(k);if(N.cmpn(0)===0)return C.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var R=N.redSqr(),O=R.redMul(N),T=y.redMul(R),P=C.redSqr().redIAdd(O).redISub(T).redISub(T),z=C.redMul(T.redISub(P)).redISub(x.redMul(O)),Z=this.z.redMul(v.z).redMul(N);return this.curve.jpoint(P,z,Z)},"add"),h.prototype.mixedAdd=i(function(v){if(this.isInfinity())return v.toJ();if(v.isInfinity())return this;var c=this.z.redSqr(),d=this.x,y=v.x.redMul(c),b=this.y,x=v.y.redMul(c).redMul(this.z),k=d.redSub(y),N=b.redSub(x);if(k.cmpn(0)===0)return N.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var C=k.redSqr(),R=C.redMul(k),O=d.redMul(C),T=N.redSqr().redIAdd(R).redISub(O).redISub(O),P=N.redMul(O.redISub(T)).redISub(b.redMul(R)),z=this.z.redMul(k);return this.curve.jpoint(T,P,z)},"mixedAdd"),h.prototype.dblp=i(function(v){if(v===0)return this;if(this.isInfinity())return this;if(!v)return this.dbl();var c;if(this.curve.zeroA||this.curve.threeA){var d=this;for(c=0;c<v;c++)d=d.dbl();return d}var y=this.curve.a,b=this.curve.tinv,x=this.x,k=this.y,N=this.z,C=N.redSqr().redSqr(),R=k.redAdd(k);for(c=0;c<v;c++){var O=x.redSqr(),T=R.redSqr(),P=T.redSqr(),z=O.redAdd(O).redIAdd(O).redIAdd(y.redMul(C)),Z=x.redMul(T),V=z.redSqr().redISub(Z.redAdd(Z)),ee=Z.redISub(V),$=z.redMul(ee);$=$.redIAdd($).redISub(P);var F=R.redMul(N);c+1<v&&(C=C.redMul(P)),x=V,N=F,R=$}return this.curve.jpoint(x,R.redMul(b),N)},"dblp"),h.prototype.dbl=i(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl"),h.prototype._zeroDbl=i(function(){var v,c,d;if(this.zOne){var y=this.x.redSqr(),b=this.y.redSqr(),x=b.redSqr(),k=this.x.redAdd(b).redSqr().redISub(y).redISub(x);k=k.redIAdd(k);var N=y.redAdd(y).redIAdd(y),C=N.redSqr().redISub(k).redISub(k),R=x.redIAdd(x);R=R.redIAdd(R),R=R.redIAdd(R),v=C,c=N.redMul(k.redISub(C)).redISub(R),d=this.y.redAdd(this.y)}else{var O=this.x.redSqr(),T=this.y.redSqr(),P=T.redSqr(),z=this.x.redAdd(T).redSqr().redISub(O).redISub(P);z=z.redIAdd(z);var Z=O.redAdd(O).redIAdd(O),V=Z.redSqr(),ee=P.redIAdd(P);ee=ee.redIAdd(ee),ee=ee.redIAdd(ee),v=V.redISub(z).redISub(z),c=Z.redMul(z.redISub(v)).redISub(ee),d=this.y.redMul(this.z),d=d.redIAdd(d)}return this.curve.jpoint(v,c,d)},"_zeroDbl"),h.prototype._threeDbl=i(function(){var v,c,d;if(this.zOne){var y=this.x.redSqr(),b=this.y.redSqr(),x=b.redSqr(),k=this.x.redAdd(b).redSqr().redISub(y).redISub(x);k=k.redIAdd(k);var N=y.redAdd(y).redIAdd(y).redIAdd(this.curve.a),C=N.redSqr().redISub(k).redISub(k);v=C;var R=x.redIAdd(x);R=R.redIAdd(R),R=R.redIAdd(R),c=N.redMul(k.redISub(C)).redISub(R),d=this.y.redAdd(this.y)}else{var O=this.z.redSqr(),T=this.y.redSqr(),P=this.x.redMul(T),z=this.x.redSub(O).redMul(this.x.redAdd(O));z=z.redAdd(z).redIAdd(z);var Z=P.redIAdd(P);Z=Z.redIAdd(Z);var V=Z.redAdd(Z);v=z.redSqr().redISub(V),d=this.y.redAdd(this.z).redSqr().redISub(T).redISub(O);var ee=T.redSqr();ee=ee.redIAdd(ee),ee=ee.redIAdd(ee),ee=ee.redIAdd(ee),c=z.redMul(Z.redISub(v)).redISub(ee)}return this.curve.jpoint(v,c,d)},"_threeDbl"),h.prototype._dbl=i(function(){var v=this.curve.a,c=this.x,d=this.y,y=this.z,b=y.redSqr().redSqr(),x=c.redSqr(),k=d.redSqr(),N=x.redAdd(x).redIAdd(x).redIAdd(v.redMul(b)),C=c.redAdd(c);C=C.redIAdd(C);var R=C.redMul(k),O=N.redSqr().redISub(R.redAdd(R)),T=R.redISub(O),P=k.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var z=N.redMul(T).redISub(P),Z=d.redAdd(d).redMul(y);return this.curve.jpoint(O,z,Z)},"_dbl"),h.prototype.trpl=i(function(){if(!this.curve.zeroA)return this.dbl().add(this);var v=this.x.redSqr(),c=this.y.redSqr(),d=this.z.redSqr(),y=c.redSqr(),b=v.redAdd(v).redIAdd(v),x=b.redSqr(),k=this.x.redAdd(c).redSqr().redISub(v).redISub(y);k=k.redIAdd(k),k=k.redAdd(k).redIAdd(k),k=k.redISub(x);var N=k.redSqr(),C=y.redIAdd(y);C=C.redIAdd(C),C=C.redIAdd(C),C=C.redIAdd(C);var R=b.redIAdd(k).redSqr().redISub(x).redISub(N).redISub(C),O=c.redMul(R);O=O.redIAdd(O),O=O.redIAdd(O);var T=this.x.redMul(N).redISub(O);T=T.redIAdd(T),T=T.redIAdd(T);var P=this.y.redMul(R.redMul(C.redISub(R)).redISub(k.redMul(N)));P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P);var z=this.z.redAdd(k).redSqr().redISub(d).redISub(N);return this.curve.jpoint(T,P,z)},"trpl"),h.prototype.mul=i(function(v,c){return v=new t(v,c),this.curve._wnafMul(this,v)},"mul"),h.prototype.eq=i(function(v){if(v.type==="affine")return this.eq(v.toJ());if(this===v)return!0;var c=this.z.redSqr(),d=v.z.redSqr();if(this.x.redMul(d).redISub(v.x.redMul(c)).cmpn(0)!==0)return!1;var y=c.redMul(this.z),b=d.redMul(v.z);return this.y.redMul(b).redISub(v.y.redMul(y)).cmpn(0)===0},"eq"),h.prototype.eqXToP=i(function(v){var c=this.z.redSqr(),d=v.toRed(this.curve.red).redMul(c);if(this.x.cmp(d)===0)return!0;for(var y=v.clone(),b=this.curve.redN.redMul(c);;){if(y.iadd(this.curve.n),y.cmp(this.curve.p)>=0)return!1;if(d.redIAdd(b),this.x.cmp(d)===0)return!0}},"eqXToP"),h.prototype.inspect=i(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)+">"},"inspect"),h.prototype.isInfinity=i(function(){return this.z.cmpn(0)===0},"isInfinity"),s0}i(uD,"requireShort");var o0,g6;function fD(){if(g6)return o0;g6=1;var e=Nr(),t=Lt(),r=Gf(),a=di();function n(o){r.call(this,"mont",o),this.a=new e(o.a,16).toRed(this.red),this.b=new e(o.b,16).toRed(this.red),this.i4=new e(4).toRed(this.red).redInvm(),this.two=new e(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}i(n,"MontCurve"),t(n,r),o0=n,n.prototype.validate=i(function(h){var p=h.normalize().x,v=p.redSqr(),c=v.redMul(p).redAdd(v.redMul(this.a)).redAdd(p),d=c.redSqrt();return d.redSqr().cmp(c)===0},"validate");function s(o,h,p){r.BasePoint.call(this,o,"projective"),h===null&&p===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new e(h,16),this.z=new e(p,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return i(s,"Point"),t(s,r.BasePoint),n.prototype.decodePoint=i(function(h,p){return this.point(a.toArray(h,p),1)},"decodePoint"),n.prototype.point=i(function(h,p){return new s(this,h,p)},"point"),n.prototype.pointFromJSON=i(function(h){return s.fromJSON(this,h)},"pointFromJSON"),s.prototype.precompute=i(function(){},"precompute"),s.prototype._encode=i(function(){return this.getX().toArray("be",this.curve.p.byteLength())},"_encode"),s.fromJSON=i(function(h,p){return new s(h,p[0],p[1]||h.one)},"fromJSON"),s.prototype.inspect=i(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"},"inspect"),s.prototype.isInfinity=i(function(){return this.z.cmpn(0)===0},"isInfinity"),s.prototype.dbl=i(function(){var h=this.x.redAdd(this.z),p=h.redSqr(),v=this.x.redSub(this.z),c=v.redSqr(),d=p.redSub(c),y=p.redMul(c),b=d.redMul(c.redAdd(this.curve.a24.redMul(d)));return this.curve.point(y,b)},"dbl"),s.prototype.add=i(function(){throw new Error("Not supported on Montgomery curve")},"add"),s.prototype.diffAdd=i(function(h,p){var v=this.x.redAdd(this.z),c=this.x.redSub(this.z),d=h.x.redAdd(h.z),y=h.x.redSub(h.z),b=y.redMul(v),x=d.redMul(c),k=p.z.redMul(b.redAdd(x).redSqr()),N=p.x.redMul(b.redISub(x).redSqr());return this.curve.point(k,N)},"diffAdd"),s.prototype.mul=i(function(h){for(var p=h.clone(),v=this,c=this.curve.point(null,null),d=this,y=[];p.cmpn(0)!==0;p.iushrn(1))y.push(p.andln(1));for(var b=y.length-1;b>=0;b--)y[b]===0?(v=v.diffAdd(c,d),c=c.dbl()):(c=v.diffAdd(c,d),v=v.dbl());return c},"mul"),s.prototype.mulAdd=i(function(){throw new Error("Not supported on Montgomery curve")},"mulAdd"),s.prototype.jumlAdd=i(function(){throw new Error("Not supported on Montgomery curve")},"jumlAdd"),s.prototype.eq=i(function(h){return this.getX().cmp(h.getX())===0},"eq"),s.prototype.normalize=i(function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},"normalize"),s.prototype.getX=i(function(){return this.normalize(),this.x.fromRed()},"getX"),o0}i(fD,"requireMont");var l0,v6;function cD(){if(v6)return l0;v6=1;var e=di(),t=Nr(),r=Lt(),a=Gf(),n=e.assert;function s(h){this.twisted=(h.a|0)!==1,this.mOneA=this.twisted&&(h.a|0)===-1,this.extended=this.mOneA,a.call(this,"edwards",h),this.a=new t(h.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new t(h.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new t(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}i(s,"EdwardsCurve"),r(s,a),l0=s,s.prototype._mulA=i(function(p){return this.mOneA?p.redNeg():this.a.redMul(p)},"_mulA"),s.prototype._mulC=i(function(p){return this.oneC?p:this.c.redMul(p)},"_mulC"),s.prototype.jpoint=i(function(p,v,c,d){return this.point(p,v,c,d)},"jpoint"),s.prototype.pointFromX=i(function(p,v){p=new t(p,16),p.red||(p=p.toRed(this.red));var c=p.redSqr(),d=this.c2.redSub(this.a.redMul(c)),y=this.one.redSub(this.c2.redMul(this.d).redMul(c)),b=d.redMul(y.redInvm()),x=b.redSqrt();if(x.redSqr().redSub(b).cmp(this.zero)!==0)throw new Error("invalid point");var k=x.fromRed().isOdd();return(v&&!k||!v&&k)&&(x=x.redNeg()),this.point(p,x)},"pointFromX"),s.prototype.pointFromY=i(function(p,v){p=new t(p,16),p.red||(p=p.toRed(this.red));var c=p.redSqr(),d=c.redSub(this.c2),y=c.redMul(this.d).redMul(this.c2).redSub(this.a),b=d.redMul(y.redInvm());if(b.cmp(this.zero)===0){if(v)throw new Error("invalid point");return this.point(this.zero,p)}var x=b.redSqrt();if(x.redSqr().redSub(b).cmp(this.zero)!==0)throw new Error("invalid point");return x.fromRed().isOdd()!==v&&(x=x.redNeg()),this.point(x,p)},"pointFromY"),s.prototype.validate=i(function(p){if(p.isInfinity())return!0;p.normalize();var v=p.x.redSqr(),c=p.y.redSqr(),d=v.redMul(this.a).redAdd(c),y=this.c2.redMul(this.one.redAdd(this.d.redMul(v).redMul(c)));return d.cmp(y)===0},"validate");function o(h,p,v,c,d){a.BasePoint.call(this,h,"projective"),p===null&&v===null&&c===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 t(p,16),this.y=new t(v,16),this.z=c?new t(c,16):this.curve.one,this.t=d&&new t(d,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()))))}return i(o,"Point"),r(o,a.BasePoint),s.prototype.pointFromJSON=i(function(p){return o.fromJSON(this,p)},"pointFromJSON"),s.prototype.point=i(function(p,v,c,d){return new o(this,p,v,c,d)},"point"),o.fromJSON=i(function(p,v){return new o(p,v[0],v[1],v[2])},"fromJSON"),o.prototype.inspect=i(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)+">"},"inspect"),o.prototype.isInfinity=i(function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},"isInfinity"),o.prototype._extDbl=i(function(){var p=this.x.redSqr(),v=this.y.redSqr(),c=this.z.redSqr();c=c.redIAdd(c);var d=this.curve._mulA(p),y=this.x.redAdd(this.y).redSqr().redISub(p).redISub(v),b=d.redAdd(v),x=b.redSub(c),k=d.redSub(v),N=y.redMul(x),C=b.redMul(k),R=y.redMul(k),O=x.redMul(b);return this.curve.point(N,C,O,R)},"_extDbl"),o.prototype._projDbl=i(function(){var p=this.x.redAdd(this.y).redSqr(),v=this.x.redSqr(),c=this.y.redSqr(),d,y,b,x,k,N;if(this.curve.twisted){x=this.curve._mulA(v);var C=x.redAdd(c);this.zOne?(d=p.redSub(v).redSub(c).redMul(C.redSub(this.curve.two)),y=C.redMul(x.redSub(c)),b=C.redSqr().redSub(C).redSub(C)):(k=this.z.redSqr(),N=C.redSub(k).redISub(k),d=p.redSub(v).redISub(c).redMul(N),y=C.redMul(x.redSub(c)),b=C.redMul(N))}else x=v.redAdd(c),k=this.curve._mulC(this.z).redSqr(),N=x.redSub(k).redSub(k),d=this.curve._mulC(p.redISub(x)).redMul(N),y=this.curve._mulC(x).redMul(v.redISub(c)),b=x.redMul(N);return this.curve.point(d,y,b)},"_projDbl"),o.prototype.dbl=i(function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},"dbl"),o.prototype._extAdd=i(function(p){var v=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),c=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),d=this.t.redMul(this.curve.dd).redMul(p.t),y=this.z.redMul(p.z.redAdd(p.z)),b=c.redSub(v),x=y.redSub(d),k=y.redAdd(d),N=c.redAdd(v),C=b.redMul(x),R=k.redMul(N),O=b.redMul(N),T=x.redMul(k);return this.curve.point(C,R,T,O)},"_extAdd"),o.prototype._projAdd=i(function(p){var v=this.z.redMul(p.z),c=v.redSqr(),d=this.x.redMul(p.x),y=this.y.redMul(p.y),b=this.curve.d.redMul(d).redMul(y),x=c.redSub(b),k=c.redAdd(b),N=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(d).redISub(y),C=v.redMul(x).redMul(N),R,O;return this.curve.twisted?(R=v.redMul(k).redMul(y.redSub(this.curve._mulA(d))),O=x.redMul(k)):(R=v.redMul(k).redMul(y.redSub(d)),O=this.curve._mulC(x).redMul(k)),this.curve.point(C,R,O)},"_projAdd"),o.prototype.add=i(function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},"add"),o.prototype.mul=i(function(p){return this._hasDoubles(p)?this.curve._fixedNafMul(this,p):this.curve._wnafMul(this,p)},"mul"),o.prototype.mulAdd=i(function(p,v,c){return this.curve._wnafMulAdd(1,[this,v],[p,c],2,!1)},"mulAdd"),o.prototype.jmulAdd=i(function(p,v,c){return this.curve._wnafMulAdd(1,[this,v],[p,c],2,!0)},"jmulAdd"),o.prototype.normalize=i(function(){if(this.zOne)return this;var p=this.z.redInvm();return this.x=this.x.redMul(p),this.y=this.y.redMul(p),this.t&&(this.t=this.t.redMul(p)),this.z=this.curve.one,this.zOne=!0,this},"normalize"),o.prototype.neg=i(function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},"neg"),o.prototype.getX=i(function(){return this.normalize(),this.x.fromRed()},"getX"),o.prototype.getY=i(function(){return this.normalize(),this.y.fromRed()},"getY"),o.prototype.eq=i(function(p){return this===p||this.getX().cmp(p.getX())===0&&this.getY().cmp(p.getY())===0},"eq"),o.prototype.eqXToP=i(function(p){var v=p.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(v)===0)return!0;for(var c=p.clone(),d=this.curve.redN.redMul(this.z);;){if(c.iadd(this.curve.n),c.cmp(this.curve.p)>=0)return!1;if(v.redIAdd(d),this.x.cmp(v)===0)return!0}},"eqXToP"),o.prototype.toP=o.prototype.normalize,o.prototype.mixedAdd=o.prototype.add,l0}i(cD,"requireEdwards");var b6;function $7(){return b6||(b6=1,(function(e){var t=e;t.base=Gf(),t.short=uD(),t.mont=fD(),t.edwards=cD()})(n0)),n0}i($7,"requireCurve");var u0={},f0={},Wt={},y6;function Qi(){if(y6)return Wt;y6=1;var e=ci(),t=Lt();Wt.inherits=t;function r(u,g){return(u.charCodeAt(g)&64512)!==55296||g<0||g+1>=u.length?!1:(u.charCodeAt(g+1)&64512)===56320}i(r,"isSurrogatePair");function a(u,g){if(Array.isArray(u))return u.slice();if(!u)return[];var l=[];if(typeof u=="string")if(g){if(g==="hex")for(u=u.replace(/[^a-z0-9]+/ig,""),u.length%2!==0&&(u="0"+u),w=0;w<u.length;w+=2)l.push(parseInt(u[w]+u[w+1],16))}else for(var m=0,w=0;w<u.length;w++){var M=u.charCodeAt(w);M<128?l[m++]=M:M<2048?(l[m++]=M>>6|192,l[m++]=M&63|128):r(u,w)?(M=65536+((M&1023)<<10)+(u.charCodeAt(++w)&1023),l[m++]=M>>18|240,l[m++]=M>>12&63|128,l[m++]=M>>6&63|128,l[m++]=M&63|128):(l[m++]=M>>12|224,l[m++]=M>>6&63|128,l[m++]=M&63|128)}else for(w=0;w<u.length;w++)l[w]=u[w]|0;return l}i(a,"toArray"),Wt.toArray=a;function n(u){for(var g="",l=0;l<u.length;l++)g+=h(u[l].toString(16));return g}i(n,"toHex"),Wt.toHex=n;function s(u){var g=u>>>24|u>>>8&65280|u<<8&16711680|(u&255)<<24;return g>>>0}i(s,"htonl"),Wt.htonl=s;function o(u,g){for(var l="",m=0;m<u.length;m++){var w=u[m];g==="little"&&(w=s(w)),l+=p(w.toString(16))}return l}i(o,"toHex32"),Wt.toHex32=o;function h(u){return u.length===1?"0"+u:u}i(h,"zero2"),Wt.zero2=h;function p(u){return u.length===7?"0"+u:u.length===6?"00"+u:u.length===5?"000"+u:u.length===4?"0000"+u:u.length===3?"00000"+u:u.length===2?"000000"+u:u.length===1?"0000000"+u:u}i(p,"zero8"),Wt.zero8=p;function v(u,g,l,m){var w=l-g;e(w%4===0);for(var M=new Array(w/4),j=0,S=g;j<M.length;j++,S+=4){var f;m==="big"?f=u[S]<<24|u[S+1]<<16|u[S+2]<<8|u[S+3]:f=u[S+3]<<24|u[S+2]<<16|u[S+1]<<8|u[S],M[j]=f>>>0}return M}i(v,"join32"),Wt.join32=v;function c(u,g){for(var l=new Array(u.length*4),m=0,w=0;m<u.length;m++,w+=4){var M=u[m];g==="big"?(l[w]=M>>>24,l[w+1]=M>>>16&255,l[w+2]=M>>>8&255,l[w+3]=M&255):(l[w+3]=M>>>24,l[w+2]=M>>>16&255,l[w+1]=M>>>8&255,l[w]=M&255)}return l}i(c,"split32"),Wt.split32=c;function d(u,g){return u>>>g|u<<32-g}i(d,"rotr32"),Wt.rotr32=d;function y(u,g){return u<<g|u>>>32-g}i(y,"rotl32"),Wt.rotl32=y;function b(u,g){return u+g>>>0}i(b,"sum32"),Wt.sum32=b;function x(u,g,l){return u+g+l>>>0}i(x,"sum32_3"),Wt.sum32_3=x;function k(u,g,l,m){return u+g+l+m>>>0}i(k,"sum32_4"),Wt.sum32_4=k;function N(u,g,l,m,w){return u+g+l+m+w>>>0}i(N,"sum32_5"),Wt.sum32_5=N;function C(u,g,l,m){var w=u[g],M=u[g+1],j=m+M>>>0,S=(j<m?1:0)+l+w;u[g]=S>>>0,u[g+1]=j}i(C,"sum64"),Wt.sum64=C;function R(u,g,l,m){var w=g+m>>>0,M=(w<g?1:0)+u+l;return M>>>0}i(R,"sum64_hi"),Wt.sum64_hi=R;function O(u,g,l,m){var w=g+m;return w>>>0}i(O,"sum64_lo"),Wt.sum64_lo=O;function T(u,g,l,m,w,M,j,S){var f=0,_=g;_=_+m>>>0,f+=_<g?1:0,_=_+M>>>0,f+=_<M?1:0,_=_+S>>>0,f+=_<S?1:0;var E=u+l+w+j+f;return E>>>0}i(T,"sum64_4_hi"),Wt.sum64_4_hi=T;function P(u,g,l,m,w,M,j,S){var f=g+m+M+S;return f>>>0}i(P,"sum64_4_lo"),Wt.sum64_4_lo=P;function z(u,g,l,m,w,M,j,S,f,_){var E=0,I=g;I=I+m>>>0,E+=I<g?1:0,I=I+M>>>0,E+=I<M?1:0,I=I+S>>>0,E+=I<S?1:0,I=I+_>>>0,E+=I<_?1:0;var D=u+l+w+j+f+E;return D>>>0}i(z,"sum64_5_hi"),Wt.sum64_5_hi=z;function Z(u,g,l,m,w,M,j,S,f,_){var E=g+m+M+S+_;return E>>>0}i(Z,"sum64_5_lo"),Wt.sum64_5_lo=Z;function V(u,g,l){var m=g<<32-l|u>>>l;return m>>>0}i(V,"rotr64_hi"),Wt.rotr64_hi=V;function ee(u,g,l){var m=u<<32-l|g>>>l;return m>>>0}i(ee,"rotr64_lo"),Wt.rotr64_lo=ee;function $(u,g,l){return u>>>l}i($,"shr64_hi"),Wt.shr64_hi=$;function F(u,g,l){var m=u<<32-l|g>>>l;return m>>>0}return i(F,"shr64_lo"),Wt.shr64_lo=F,Wt}i(Qi,"requireUtils");var c0={},w6;function nl(){if(w6)return c0;w6=1;var e=Qi(),t=ci();function r(){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}return i(r,"BlockHash"),c0.BlockHash=r,r.prototype.update=i(function(n,s){if(n=e.toArray(n,s),this.pending?this.pending=this.pending.concat(n):this.pending=n,this.pendingTotal+=n.length,this.pending.length>=this._delta8){n=this.pending;var o=n.length%this._delta8;this.pending=n.slice(n.length-o,n.length),this.pending.length===0&&(this.pending=null),n=e.join32(n,0,n.length-o,this.endian);for(var h=0;h<n.length;h+=this._delta32)this._update(n,h,h+this._delta32)}return this},"update"),r.prototype.digest=i(function(n){return this.update(this._pad()),t(this.pending===null),this._digest(n)},"digest"),r.prototype._pad=i(function(){var n=this.pendingTotal,s=this._delta8,o=s-(n+this.padLength)%s,h=new Array(o+this.padLength);h[0]=128;for(var p=1;p<o;p++)h[p]=0;if(n<<=3,this.endian==="big"){for(var v=8;v<this.padLength;v++)h[p++]=0;h[p++]=0,h[p++]=0,h[p++]=0,h[p++]=0,h[p++]=n>>>24&255,h[p++]=n>>>16&255,h[p++]=n>>>8&255,h[p++]=n&255}else for(h[p++]=n&255,h[p++]=n>>>8&255,h[p++]=n>>>16&255,h[p++]=n>>>24&255,h[p++]=0,h[p++]=0,h[p++]=0,h[p++]=0,v=8;v<this.padLength;v++)h[p++]=0;return h},"pad"),c0}i(nl,"requireCommon$1");var Yn={},Li={},x6;function G7(){if(x6)return Li;x6=1;var e=Qi(),t=e.rotr32;function r(c,d,y,b){if(c===0)return a(d,y,b);if(c===1||c===3)return s(d,y,b);if(c===2)return n(d,y,b)}i(r,"ft_1"),Li.ft_1=r;function a(c,d,y){return c&d^~c&y}i(a,"ch32"),Li.ch32=a;function n(c,d,y){return c&d^c&y^d&y}i(n,"maj32"),Li.maj32=n;function s(c,d,y){return c^d^y}i(s,"p32"),Li.p32=s;function o(c){return t(c,2)^t(c,13)^t(c,22)}i(o,"s0_256"),Li.s0_256=o;function h(c){return t(c,6)^t(c,11)^t(c,25)}i(h,"s1_256"),Li.s1_256=h;function p(c){return t(c,7)^t(c,18)^c>>>3}i(p,"g0_256"),Li.g0_256=p;function v(c){return t(c,17)^t(c,19)^c>>>10}return i(v,"g1_256"),Li.g1_256=v,Li}i(G7,"requireCommon");var d0,_6;function dD(){if(_6)return d0;_6=1;var e=Qi(),t=nl(),r=G7(),a=e.rotl32,n=e.sum32,s=e.sum32_5,o=r.ft_1,h=t.BlockHash,p=[1518500249,1859775393,2400959708,3395469782];function v(){if(!(this instanceof v))return new v;h.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return i(v,"SHA1"),e.inherits(v,h),d0=v,v.blockSize=512,v.outSize=160,v.hmacStrength=80,v.padLength=64,v.prototype._update=i(function(d,y){for(var b=this.W,x=0;x<16;x++)b[x]=d[y+x];for(;x<b.length;x++)b[x]=a(b[x-3]^b[x-8]^b[x-14]^b[x-16],1);var k=this.h[0],N=this.h[1],C=this.h[2],R=this.h[3],O=this.h[4];for(x=0;x<b.length;x++){var T=~~(x/20),P=s(a(k,5),o(T,N,C,R),O,b[x],p[T]);O=R,R=C,C=a(N,30),N=k,k=P}this.h[0]=n(this.h[0],k),this.h[1]=n(this.h[1],N),this.h[2]=n(this.h[2],C),this.h[3]=n(this.h[3],R),this.h[4]=n(this.h[4],O)},"_update"),v.prototype._digest=i(function(d){return d==="hex"?e.toHex32(this.h,"big"):e.split32(this.h,"big")},"digest"),d0}i(dD,"require_1");var h0,S6;function V7(){if(S6)return h0;S6=1;var e=Qi(),t=nl(),r=G7(),a=ci(),n=e.sum32,s=e.sum32_4,o=e.sum32_5,h=r.ch32,p=r.maj32,v=r.s0_256,c=r.s1_256,d=r.g0_256,y=r.g1_256,b=t.BlockHash,x=[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 k(){if(!(this instanceof k))return new k;b.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=x,this.W=new Array(64)}return i(k,"SHA256"),e.inherits(k,b),h0=k,k.blockSize=512,k.outSize=256,k.hmacStrength=192,k.padLength=64,k.prototype._update=i(function(C,R){for(var O=this.W,T=0;T<16;T++)O[T]=C[R+T];for(;T<O.length;T++)O[T]=s(y(O[T-2]),O[T-7],d(O[T-15]),O[T-16]);var P=this.h[0],z=this.h[1],Z=this.h[2],V=this.h[3],ee=this.h[4],$=this.h[5],F=this.h[6],u=this.h[7];for(a(this.k.length===O.length),T=0;T<O.length;T++){var g=o(u,c(ee),h(ee,$,F),this.k[T],O[T]),l=n(v(P),p(P,z,Z));u=F,F=$,$=ee,ee=n(V,g),V=Z,Z=z,z=P,P=n(g,l)}this.h[0]=n(this.h[0],P),this.h[1]=n(this.h[1],z),this.h[2]=n(this.h[2],Z),this.h[3]=n(this.h[3],V),this.h[4]=n(this.h[4],ee),this.h[5]=n(this.h[5],$),this.h[6]=n(this.h[6],F),this.h[7]=n(this.h[7],u)},"_update"),k.prototype._digest=i(function(C){return C==="hex"?e.toHex32(this.h,"big"):e.split32(this.h,"big")},"digest"),h0}i(V7,"require_256");var p0,M6;function hD(){if(M6)return p0;M6=1;var e=Qi(),t=V7();function r(){if(!(this instanceof r))return new r;t.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}return i(r,"SHA224"),e.inherits(r,t),p0=r,r.blockSize=512,r.outSize=224,r.hmacStrength=192,r.padLength=64,r.prototype._digest=i(function(n){return n==="hex"?e.toHex32(this.h.slice(0,7),"big"):e.split32(this.h.slice(0,7),"big")},"digest"),p0}i(hD,"require_224");var m0,E6;function Z7(){if(E6)return m0;E6=1;var e=Qi(),t=nl(),r=ci(),a=e.rotr64_hi,n=e.rotr64_lo,s=e.shr64_hi,o=e.shr64_lo,h=e.sum64,p=e.sum64_hi,v=e.sum64_lo,c=e.sum64_4_hi,d=e.sum64_4_lo,y=e.sum64_5_hi,b=e.sum64_5_lo,x=t.BlockHash,k=[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 N(){if(!(this instanceof N))return new N;x.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=k,this.W=new Array(160)}i(N,"SHA512"),e.inherits(N,x),m0=N,N.blockSize=1024,N.outSize=512,N.hmacStrength=192,N.padLength=128,N.prototype._prepareBlock=i(function(l,m){for(var w=this.W,M=0;M<32;M++)w[M]=l[m+M];for(;M<w.length;M+=2){var j=F(w[M-4],w[M-3]),S=u(w[M-4],w[M-3]),f=w[M-14],_=w[M-13],E=ee(w[M-30],w[M-29]),I=$(w[M-30],w[M-29]),D=w[M-32],L=w[M-31];w[M]=c(j,S,f,_,E,I,D,L),w[M+1]=d(j,S,f,_,E,I,D,L)}},"_prepareBlock"),N.prototype._update=i(function(l,m){this._prepareBlock(l,m);var w=this.W,M=this.h[0],j=this.h[1],S=this.h[2],f=this.h[3],_=this.h[4],E=this.h[5],I=this.h[6],D=this.h[7],L=this.h[8],U=this.h[9],B=this.h[10],G=this.h[11],H=this.h[12],K=this.h[13],_e=this.h[14],se=this.h[15];r(this.k.length===w.length);for(var ae=0;ae<w.length;ae+=2){var ve=_e,q=se,ne=Z(L,U),X=V(L,U),W=C(L,U,B,G,H),le=R(L,U,B,G,H,K),ke=this.k[ae],be=this.k[ae+1],fe=w[ae],Q=w[ae+1],Y=y(ve,q,ne,X,W,le,ke,be,fe,Q),te=b(ve,q,ne,X,W,le,ke,be,fe,Q);ve=P(M,j),q=z(M,j),ne=O(M,j,S,f,_),X=T(M,j,S,f,_,E);var he=p(ve,q,ne,X),oe=v(ve,q,ne,X);_e=H,se=K,H=B,K=G,B=L,G=U,L=p(I,D,Y,te),U=v(D,D,Y,te),I=_,D=E,_=S,E=f,S=M,f=j,M=p(Y,te,he,oe),j=v(Y,te,he,oe)}h(this.h,0,M,j),h(this.h,2,S,f),h(this.h,4,_,E),h(this.h,6,I,D),h(this.h,8,L,U),h(this.h,10,B,G),h(this.h,12,H,K),h(this.h,14,_e,se)},"_update"),N.prototype._digest=i(function(l){return l==="hex"?e.toHex32(this.h,"big"):e.split32(this.h,"big")},"digest");function C(g,l,m,w,M){var j=g&m^~g&M;return j<0&&(j+=4294967296),j}i(C,"ch64_hi");function R(g,l,m,w,M,j){var S=l&w^~l&j;return S<0&&(S+=4294967296),S}i(R,"ch64_lo");function O(g,l,m,w,M){var j=g&m^g&M^m&M;return j<0&&(j+=4294967296),j}i(O,"maj64_hi");function T(g,l,m,w,M,j){var S=l&w^l&j^w&j;return S<0&&(S+=4294967296),S}i(T,"maj64_lo");function P(g,l){var m=a(g,l,28),w=a(l,g,2),M=a(l,g,7),j=m^w^M;return j<0&&(j+=4294967296),j}i(P,"s0_512_hi");function z(g,l){var m=n(g,l,28),w=n(l,g,2),M=n(l,g,7),j=m^w^M;return j<0&&(j+=4294967296),j}i(z,"s0_512_lo");function Z(g,l){var m=a(g,l,14),w=a(g,l,18),M=a(l,g,9),j=m^w^M;return j<0&&(j+=4294967296),j}i(Z,"s1_512_hi");function V(g,l){var m=n(g,l,14),w=n(g,l,18),M=n(l,g,9),j=m^w^M;return j<0&&(j+=4294967296),j}i(V,"s1_512_lo");function ee(g,l){var m=a(g,l,1),w=a(g,l,8),M=s(g,l,7),j=m^w^M;return j<0&&(j+=4294967296),j}i(ee,"g0_512_hi");function $(g,l){var m=n(g,l,1),w=n(g,l,8),M=o(g,l,7),j=m^w^M;return j<0&&(j+=4294967296),j}i($,"g0_512_lo");function F(g,l){var m=a(g,l,19),w=a(l,g,29),M=s(g,l,6),j=m^w^M;return j<0&&(j+=4294967296),j}i(F,"g1_512_hi");function u(g,l){var m=n(g,l,19),w=n(l,g,29),M=o(g,l,6),j=m^w^M;return j<0&&(j+=4294967296),j}return i(u,"g1_512_lo"),m0}i(Z7,"require_512");var g0,k6;function pD(){if(k6)return g0;k6=1;var e=Qi(),t=Z7();function r(){if(!(this instanceof r))return new r;t.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}return i(r,"SHA384"),e.inherits(r,t),g0=r,r.blockSize=1024,r.outSize=384,r.hmacStrength=192,r.padLength=128,r.prototype._digest=i(function(n){return n==="hex"?e.toHex32(this.h.slice(0,12),"big"):e.split32(this.h.slice(0,12),"big")},"digest"),g0}i(pD,"require_384");var j6;function mD(){return j6||(j6=1,Yn.sha1=dD(),Yn.sha224=hD(),Yn.sha256=V7(),Yn.sha384=pD(),Yn.sha512=Z7()),Yn}i(mD,"requireSha");var v0={},A6;function gD(){if(A6)return v0;A6=1;var e=Qi(),t=nl(),r=e.rotl32,a=e.sum32,n=e.sum32_3,s=e.sum32_4,o=t.BlockHash;function h(){if(!(this instanceof h))return new h;o.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}i(h,"RIPEMD160"),e.inherits(h,o),v0.ripemd160=h,h.blockSize=512,h.outSize=160,h.hmacStrength=192,h.padLength=64,h.prototype._update=i(function(N,C){for(var R=this.h[0],O=this.h[1],T=this.h[2],P=this.h[3],z=this.h[4],Z=R,V=O,ee=T,$=P,F=z,u=0;u<80;u++){var g=a(r(s(R,p(u,O,T,P),N[d[u]+C],v(u)),b[u]),z);R=z,z=P,P=r(T,10),T=O,O=g,g=a(r(s(Z,p(79-u,V,ee,$),N[y[u]+C],c(u)),x[u]),F),Z=F,F=$,$=r(ee,10),ee=V,V=g}g=n(this.h[1],T,$),this.h[1]=n(this.h[2],P,F),this.h[2]=n(this.h[3],z,Z),this.h[3]=n(this.h[4],R,V),this.h[4]=n(this.h[0],O,ee),this.h[0]=g},"update"),h.prototype._digest=i(function(N){return N==="hex"?e.toHex32(this.h,"little"):e.split32(this.h,"little")},"digest");function p(k,N,C,R){return k<=15?N^C^R:k<=31?N&C|~N&R:k<=47?(N|~C)^R:k<=63?N&R|C&~R:N^(C|~R)}i(p,"f");function v(k){return k<=15?0:k<=31?1518500249:k<=47?1859775393:k<=63?2400959708:2840853838}i(v,"K");function c(k){return k<=15?1352829926:k<=31?1548603684:k<=47?1836072691:k<=63?2053994217:0}i(c,"Kh");var d=[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],y=[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],b=[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],x=[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];return v0}i(gD,"requireRipemd");var b0,N6;function vD(){if(N6)return b0;N6=1;var e=Qi(),t=ci();function r(a,n,s){if(!(this instanceof r))return new r(a,n,s);this.Hash=a,this.blockSize=a.blockSize/8,this.outSize=a.outSize/8,this.inner=null,this.outer=null,this._init(e.toArray(n,s))}return i(r,"Hmac"),b0=r,r.prototype._init=i(function(n){n.length>this.blockSize&&(n=new this.Hash().update(n).digest()),t(n.length<=this.blockSize);for(var s=n.length;s<this.blockSize;s++)n.push(0);for(s=0;s<n.length;s++)n[s]^=54;for(this.inner=new this.Hash().update(n),s=0;s<n.length;s++)n[s]^=106;this.outer=new this.Hash().update(n)},"init"),r.prototype.update=i(function(n,s){return this.inner.update(n,s),this},"update"),r.prototype.digest=i(function(n){return this.outer.update(this.inner.digest()),this.outer.digest(n)},"digest"),b0}i(vD,"requireHmac");var I6;function Cv(){return I6||(I6=1,(function(e){var t=e;t.utils=Qi(),t.common=nl(),t.sha=mD(),t.ripemd=gD(),t.hmac=vD(),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})(f0)),f0}i(Cv,"requireHash");var y0,C6;function bD(){return C6||(C6=1,y0={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"]]}}),y0}i(bD,"requireSecp256k1");var R6;function Rv(){return R6||(R6=1,(function(e){var t=e,r=Cv(),a=$7(),n=di(),s=n.assert;function o(v){v.type==="short"?this.curve=new a.short(v):v.type==="edwards"?this.curve=new a.edwards(v):this.curve=new a.mont(v),this.g=this.curve.g,this.n=this.curve.n,this.hash=v.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}i(o,"PresetCurve"),t.PresetCurve=o;function h(v,c){Object.defineProperty(t,v,{configurable:!0,enumerable:!0,get:i(function(){var d=new o(c);return Object.defineProperty(t,v,{configurable:!0,enumerable:!0,value:d}),d},"get")})}i(h,"defineCurve"),h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("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"]}),h("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 p;try{p=bD()}catch{p=void 0}h("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",p]})})(u0)),u0}i(Rv,"requireCurves");var w0,O6;function yD(){if(O6)return w0;O6=1;var e=Cv(),t=F7(),r=ci();function a(n){if(!(this instanceof a))return new a(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 s=t.toArray(n.entropy,n.entropyEnc||"hex"),o=t.toArray(n.nonce,n.nonceEnc||"hex"),h=t.toArray(n.pers,n.persEnc||"hex");r(s.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(s,o,h)}return i(a,"HmacDRBG"),w0=a,a.prototype._init=i(function(s,o,h){var p=s.concat(o).concat(h);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var v=0;v<this.V.length;v++)this.K[v]=0,this.V[v]=1;this._update(p),this._reseed=1,this.reseedInterval=281474976710656},"init"),a.prototype._hmac=i(function(){return new e.hmac(this.hash,this.K)},"hmac"),a.prototype._update=i(function(s){var o=this._hmac().update(this.V).update([0]);s&&(o=o.update(s)),this.K=o.digest(),this.V=this._hmac().update(this.V).digest(),s&&(this.K=this._hmac().update(this.V).update([1]).update(s).digest(),this.V=this._hmac().update(this.V).digest())},"update"),a.prototype.reseed=i(function(s,o,h,p){typeof o!="string"&&(p=h,h=o,o=null),s=t.toArray(s,o),h=t.toArray(h,p),r(s.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(s.concat(h||[])),this._reseed=1},"reseed"),a.prototype.generate=i(function(s,o,h,p){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof o!="string"&&(p=h,h=o,o=null),h&&(h=t.toArray(h,p||"hex"),this._update(h));for(var v=[];v.length<s;)this.V=this._hmac().update(this.V).digest(),v=v.concat(this.V);var c=v.slice(0,s);return this._update(h),this._reseed++,t.encode(c,o)},"generate"),w0}i(yD,"requireHmacDrbg");var x0,T6;function wD(){if(T6)return x0;T6=1;var e=Nr(),t=di(),r=t.assert;function a(n,s){this.ec=n,this.priv=null,this.pub=null,s.priv&&this._importPrivate(s.priv,s.privEnc),s.pub&&this._importPublic(s.pub,s.pubEnc)}return i(a,"KeyPair"),x0=a,a.fromPublic=i(function(s,o,h){return o instanceof a?o:new a(s,{pub:o,pubEnc:h})},"fromPublic"),a.fromPrivate=i(function(s,o,h){return o instanceof a?o:new a(s,{priv:o,privEnc:h})},"fromPrivate"),a.prototype.validate=i(function(){var s=this.getPublic();return s.isInfinity()?{result:!1,reason:"Invalid public key"}:s.validate()?s.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"}},"validate"),a.prototype.getPublic=i(function(s,o){return typeof s=="string"&&(o=s,s=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),o?this.pub.encode(o,s):this.pub},"getPublic"),a.prototype.getPrivate=i(function(s){return s==="hex"?this.priv.toString(16,2):this.priv},"getPrivate"),a.prototype._importPrivate=i(function(s,o){this.priv=new e(s,o||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate"),a.prototype._importPublic=i(function(s,o){if(s.x||s.y){this.ec.curve.type==="mont"?r(s.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&r(s.x&&s.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(s.x,s.y);return}this.pub=this.ec.curve.decodePoint(s,o)},"_importPublic"),a.prototype.derive=i(function(s){return s.validate()||r(s.validate(),"public point not validated"),s.mul(this.priv).getX()},"derive"),a.prototype.sign=i(function(s,o,h){return this.ec.sign(s,this,o,h)},"sign"),a.prototype.verify=i(function(s,o,h){return this.ec.verify(s,o,this,void 0,h)},"verify"),a.prototype.inspect=i(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect"),x0}i(wD,"requireKey$1");var _0,P6;function xD(){if(P6)return _0;P6=1;var e=Nr(),t=di(),r=t.assert;function a(p,v){if(p instanceof a)return p;this._importDER(p,v)||(r(p.r&&p.s,"Signature without r or s"),this.r=new e(p.r,16),this.s=new e(p.s,16),p.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=p.recoveryParam)}i(a,"Signature"),_0=a;function n(){this.place=0}i(n,"Position");function s(p,v){var c=p[v.place++];if(!(c&128))return c;var d=c&15;if(d===0||d>4||p[v.place]===0)return!1;for(var y=0,b=0,x=v.place;b<d;b++,x++)y<<=8,y|=p[x],y>>>=0;return y<=127?!1:(v.place=x,y)}i(s,"getLength");function o(p){for(var v=0,c=p.length-1;!p[v]&&!(p[v+1]&128)&&v<c;)v++;return v===0?p:p.slice(v)}i(o,"rmPadding"),a.prototype._importDER=i(function(v,c){v=t.toArray(v,c);var d=new n;if(v[d.place++]!==48)return!1;var y=s(v,d);if(y===!1||y+d.place!==v.length||v[d.place++]!==2)return!1;var b=s(v,d);if(b===!1||(v[d.place]&128)!==0)return!1;var x=v.slice(d.place,b+d.place);if(d.place+=b,v[d.place++]!==2)return!1;var k=s(v,d);if(k===!1||v.length!==k+d.place||(v[d.place]&128)!==0)return!1;var N=v.slice(d.place,k+d.place);if(x[0]===0)if(x[1]&128)x=x.slice(1);else return!1;if(N[0]===0)if(N[1]&128)N=N.slice(1);else return!1;return this.r=new e(x),this.s=new e(N),this.recoveryParam=null,!0},"_importDER");function h(p,v){if(v<128){p.push(v);return}var c=1+(Math.log(v)/Math.LN2>>>3);for(p.push(c|128);--c;)p.push(v>>>(c<<3)&255);p.push(v)}return i(h,"constructLength"),a.prototype.toDER=i(function(v){var c=this.r.toArray(),d=this.s.toArray();for(c[0]&128&&(c=[0].concat(c)),d[0]&128&&(d=[0].concat(d)),c=o(c),d=o(d);!d[0]&&!(d[1]&128);)d=d.slice(1);var y=[2];h(y,c.length),y=y.concat(c),y.push(2),h(y,d.length);var b=y.concat(d),x=[48];return h(x,b.length),x=x.concat(b),t.encode(x,v)},"toDER"),_0}i(xD,"requireSignature$1");var S0,D6;function _D(){if(D6)return S0;D6=1;var e=Nr(),t=yD(),r=di(),a=Rv(),n=Nv(),s=r.assert,o=wD(),h=xD();function p(v){if(!(this instanceof p))return new p(v);typeof v=="string"&&(s(Object.prototype.hasOwnProperty.call(a,v),"Unknown curve "+v),v=a[v]),v instanceof a.PresetCurve&&(v={curve:v}),this.curve=v.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=v.curve.g,this.g.precompute(v.curve.n.bitLength()+1),this.hash=v.hash||v.curve.hash}return i(p,"EC"),S0=p,p.prototype.keyPair=i(function(c){return new o(this,c)},"keyPair"),p.prototype.keyFromPrivate=i(function(c,d){return o.fromPrivate(this,c,d)},"keyFromPrivate"),p.prototype.keyFromPublic=i(function(c,d){return o.fromPublic(this,c,d)},"keyFromPublic"),p.prototype.genKeyPair=i(function(c){c||(c={});for(var d=new t({hash:this.hash,pers:c.pers,persEnc:c.persEnc||"utf8",entropy:c.entropy||n(this.hash.hmacStrength),entropyEnc:c.entropy&&c.entropyEnc||"utf8",nonce:this.n.toArray()}),y=this.n.byteLength(),b=this.n.sub(new e(2));;){var x=new e(d.generate(y));if(!(x.cmp(b)>0))return x.iaddn(1),this.keyFromPrivate(x)}},"genKeyPair"),p.prototype._truncateToN=i(function(c,d,y){var b;if(e.isBN(c)||typeof c=="number")c=new e(c,16),b=c.byteLength();else if(typeof c=="object")b=c.length,c=new e(c,16);else{var x=c.toString();b=x.length+1>>>1,c=new e(x,16)}typeof y!="number"&&(y=b*8);var k=y-this.n.bitLength();return k>0&&(c=c.ushrn(k)),!d&&c.cmp(this.n)>=0?c.sub(this.n):c},"_truncateToN"),p.prototype.sign=i(function(c,d,y,b){if(typeof y=="object"&&(b=y,y=null),b||(b={}),typeof c!="string"&&typeof c!="number"&&!e.isBN(c)){s(typeof c=="object"&&c&&typeof c.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),s(c.length>>>0===c.length);for(var x=0;x<c.length;x++)s((c[x]&255)===c[x])}d=this.keyFromPrivate(d,y),c=this._truncateToN(c,!1,b.msgBitLength),s(!c.isNeg(),"Can not sign a negative message");var k=this.n.byteLength(),N=d.getPrivate().toArray("be",k),C=c.toArray("be",k);s(new e(C).eq(c),"Can not sign message");for(var R=new t({hash:this.hash,entropy:N,nonce:C,pers:b.pers,persEnc:b.persEnc||"utf8"}),O=this.n.sub(new e(1)),T=0;;T++){var P=b.k?b.k(T):new e(R.generate(this.n.byteLength()));if(P=this._truncateToN(P,!0),!(P.cmpn(1)<=0||P.cmp(O)>=0)){var z=this.g.mul(P);if(!z.isInfinity()){var Z=z.getX(),V=Z.umod(this.n);if(V.cmpn(0)!==0){var ee=P.invm(this.n).mul(V.mul(d.getPrivate()).iadd(c));if(ee=ee.umod(this.n),ee.cmpn(0)!==0){var $=(z.getY().isOdd()?1:0)|(Z.cmp(V)!==0?2:0);return b.canonical&&ee.cmp(this.nh)>0&&(ee=this.n.sub(ee),$^=1),new h({r:V,s:ee,recoveryParam:$})}}}}}},"sign"),p.prototype.verify=i(function(c,d,y,b,x){x||(x={}),c=this._truncateToN(c,!1,x.msgBitLength),y=this.keyFromPublic(y,b),d=new h(d,"hex");var k=d.r,N=d.s;if(k.cmpn(1)<0||k.cmp(this.n)>=0||N.cmpn(1)<0||N.cmp(this.n)>=0)return!1;var C=N.invm(this.n),R=C.mul(c).umod(this.n),O=C.mul(k).umod(this.n),T;return this.curve._maxwellTrick?(T=this.g.jmulAdd(R,y.getPublic(),O),T.isInfinity()?!1:T.eqXToP(k)):(T=this.g.mulAdd(R,y.getPublic(),O),T.isInfinity()?!1:T.getX().umod(this.n).cmp(k)===0)},"verify"),p.prototype.recoverPubKey=function(v,c,d,y){s((3&d)===d,"The recovery param is more than two bits"),c=new h(c,y);var b=this.n,x=new e(v),k=c.r,N=c.s,C=d&1,R=d>>1;if(k.cmp(this.curve.p.umod(this.curve.n))>=0&&R)throw new Error("Unable to find sencond key candinate");R?k=this.curve.pointFromX(k.add(this.curve.n),C):k=this.curve.pointFromX(k,C);var O=c.r.invm(b),T=b.sub(x).mul(O).umod(b),P=N.mul(O).umod(b);return this.g.mulAdd(T,k,P)},p.prototype.getKeyRecoveryParam=function(v,c,d,y){if(c=new h(c,y),c.recoveryParam!==null)return c.recoveryParam;for(var b=0;b<4;b++){var x;try{x=this.recoverPubKey(v,c,b)}catch{continue}if(x.eq(d))return b}throw new Error("Unable to find valid recovery factor")},S0}i(_D,"requireEc");var M0,L6;function SD(){if(L6)return M0;L6=1;var e=di(),t=e.assert,r=e.parseBytes,a=e.cachedProperty;function n(s,o){this.eddsa=s,this._secret=r(o.secret),s.isPoint(o.pub)?this._pub=o.pub:this._pubBytes=r(o.pub)}return i(n,"KeyPair"),n.fromPublic=i(function(o,h){return h instanceof n?h:new n(o,{pub:h})},"fromPublic"),n.fromSecret=i(function(o,h){return h instanceof n?h:new n(o,{secret:h})},"fromSecret"),n.prototype.secret=i(function(){return this._secret},"secret"),a(n,"pubBytes",i(function(){return this.eddsa.encodePoint(this.pub())},"pubBytes")),a(n,"pub",i(function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())},"pub")),a(n,"privBytes",i(function(){var o=this.eddsa,h=this.hash(),p=o.encodingLength-1,v=h.slice(0,o.encodingLength);return v[0]&=248,v[p]&=127,v[p]|=64,v},"privBytes")),a(n,"priv",i(function(){return this.eddsa.decodeInt(this.privBytes())},"priv")),a(n,"hash",i(function(){return this.eddsa.hash().update(this.secret()).digest()},"hash")),a(n,"messagePrefix",i(function(){return this.hash().slice(this.eddsa.encodingLength)},"messagePrefix")),n.prototype.sign=i(function(o){return t(this._secret,"KeyPair can only verify"),this.eddsa.sign(o,this)},"sign"),n.prototype.verify=i(function(o,h){return this.eddsa.verify(o,h,this)},"verify"),n.prototype.getSecret=i(function(o){return t(this._secret,"KeyPair is public only"),e.encode(this.secret(),o)},"getSecret"),n.prototype.getPublic=i(function(o){return e.encode(this.pubBytes(),o)},"getPublic"),M0=n,M0}i(SD,"requireKey");var E0,B6;function MD(){if(B6)return E0;B6=1;var e=Nr(),t=di(),r=t.assert,a=t.cachedProperty,n=t.parseBytes;function s(o,h){this.eddsa=o,typeof h!="object"&&(h=n(h)),Array.isArray(h)&&(r(h.length===o.encodingLength*2,"Signature has invalid size"),h={R:h.slice(0,o.encodingLength),S:h.slice(o.encodingLength)}),r(h.R&&h.S,"Signature without R or S"),o.isPoint(h.R)&&(this._R=h.R),h.S instanceof e&&(this._S=h.S),this._Rencoded=Array.isArray(h.R)?h.R:h.Rencoded,this._Sencoded=Array.isArray(h.S)?h.S:h.Sencoded}return i(s,"Signature"),a(s,"S",i(function(){return this.eddsa.decodeInt(this.Sencoded())},"S")),a(s,"R",i(function(){return this.eddsa.decodePoint(this.Rencoded())},"R")),a(s,"Rencoded",i(function(){return this.eddsa.encodePoint(this.R())},"Rencoded")),a(s,"Sencoded",i(function(){return this.eddsa.encodeInt(this.S())},"Sencoded")),s.prototype.toBytes=i(function(){return this.Rencoded().concat(this.Sencoded())},"toBytes"),s.prototype.toHex=i(function(){return t.encode(this.toBytes(),"hex").toUpperCase()},"toHex"),E0=s,E0}i(MD,"requireSignature");var k0,z6;function ED(){if(z6)return k0;z6=1;var e=Cv(),t=Rv(),r=di(),a=r.assert,n=r.parseBytes,s=SD(),o=MD();function h(p){if(a(p==="ed25519","only tested with ed25519 so far"),!(this instanceof h))return new h(p);p=t[p].curve,this.curve=p,this.g=p.g,this.g.precompute(p.n.bitLength()+1),this.pointClass=p.point().constructor,this.encodingLength=Math.ceil(p.n.bitLength()/8),this.hash=e.sha512}return i(h,"EDDSA"),k0=h,h.prototype.sign=i(function(v,c){v=n(v);var d=this.keyFromSecret(c),y=this.hashInt(d.messagePrefix(),v),b=this.g.mul(y),x=this.encodePoint(b),k=this.hashInt(x,d.pubBytes(),v).mul(d.priv()),N=y.add(k).umod(this.curve.n);return this.makeSignature({R:b,S:N,Rencoded:x})},"sign"),h.prototype.verify=i(function(v,c,d){if(v=n(v),c=this.makeSignature(c),c.S().gte(c.eddsa.curve.n)||c.S().isNeg())return!1;var y=this.keyFromPublic(d),b=this.hashInt(c.Rencoded(),y.pubBytes(),v),x=this.g.mul(c.S()),k=c.R().add(y.pub().mul(b));return k.eq(x)},"verify"),h.prototype.hashInt=i(function(){for(var v=this.hash(),c=0;c<arguments.length;c++)v.update(arguments[c]);return r.intFromLE(v.digest()).umod(this.curve.n)},"hashInt"),h.prototype.keyFromPublic=i(function(v){return s.fromPublic(this,v)},"keyFromPublic"),h.prototype.keyFromSecret=i(function(v){return s.fromSecret(this,v)},"keyFromSecret"),h.prototype.makeSignature=i(function(v){return v instanceof o?v:new o(this,v)},"makeSignature"),h.prototype.encodePoint=i(function(v){var c=v.getY().toArray("le",this.encodingLength);return c[this.encodingLength-1]|=v.getX().isOdd()?128:0,c},"encodePoint"),h.prototype.decodePoint=i(function(v){v=r.parseBytes(v);var c=v.length-1,d=v.slice(0,c).concat(v[c]&-129),y=(v[c]&128)!==0,b=r.intFromLE(d);return this.curve.pointFromY(b,y)},"decodePoint"),h.prototype.encodeInt=i(function(v){return v.toArray("le",this.encodingLength)},"encodeInt"),h.prototype.decodeInt=i(function(v){return r.intFromLE(v)},"decodeInt"),h.prototype.isPoint=i(function(v){return v instanceof this.pointClass},"isPoint"),k0}i(ED,"requireEddsa");var U6;function Ov(){return U6||(U6=1,(function(e){var t=e;t.version=lD.version,t.utils=di(),t.rand=Nv(),t.curve=$7(),t.curves=Rv(),t.ec=_D(),t.eddsa=ED()})(t0)),t0}i(Ov,"requireElliptic");var ku={exports:{}},kD=ku.exports,F6;function H7(){return F6||(F6=1,(function(e){(function(t,r){function a(g,l){if(!g)throw new Error(l||"Assertion failed")}i(a,"assert");function n(g,l){g.super_=l;var m=i(function(){},"TempCtor");m.prototype=l.prototype,g.prototype=new m,g.prototype.constructor=g}i(n,"inherits");function s(g,l,m){if(s.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((l==="le"||l==="be")&&(m=l,l=10),this._init(g||0,l||10,m||"be"))}i(s,"BN"),typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Ai.Buffer}catch{}s.isBN=i(function(l){return l instanceof s?!0:l!==null&&typeof l=="object"&&l.constructor.wordSize===s.wordSize&&Array.isArray(l.words)},"isBN"),s.max=i(function(l,m){return l.cmp(m)>0?l:m},"max"),s.min=i(function(l,m){return l.cmp(m)<0?l:m},"min"),s.prototype._init=i(function(l,m,w){if(typeof l=="number")return this._initNumber(l,m,w);if(typeof l=="object")return this._initArray(l,m,w);m==="hex"&&(m=16),a(m===(m|0)&&m>=2&&m<=36),l=l.toString().replace(/\s+/g,"");var M=0;l[0]==="-"&&(M++,this.negative=1),M<l.length&&(m===16?this._parseHex(l,M,w):(this._parseBase(l,m,M),w==="le"&&this._initArray(this.toArray(),m,w)))},"init"),s.prototype._initNumber=i(function(l,m,w){l<0&&(this.negative=1,l=-l),l<67108864?(this.words=[l&67108863],this.length=1):l<4503599627370496?(this.words=[l&67108863,l/67108864&67108863],this.length=2):(a(l<9007199254740992),this.words=[l&67108863,l/67108864&67108863,1],this.length=3),w==="le"&&this._initArray(this.toArray(),m,w)},"_initNumber"),s.prototype._initArray=i(function(l,m,w){if(a(typeof l.length=="number"),l.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(l.length/3),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var j,S,f=0;if(w==="be")for(M=l.length-1,j=0;M>=0;M-=3)S=l[M]|l[M-1]<<8|l[M-2]<<16,this.words[j]|=S<<f&67108863,this.words[j+1]=S>>>26-f&67108863,f+=24,f>=26&&(f-=26,j++);else if(w==="le")for(M=0,j=0;M<l.length;M+=3)S=l[M]|l[M+1]<<8|l[M+2]<<16,this.words[j]|=S<<f&67108863,this.words[j+1]=S>>>26-f&67108863,f+=24,f>=26&&(f-=26,j++);return this._strip()},"_initArray");function h(g,l){var m=g.charCodeAt(l);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;a(!1,"Invalid character in "+g)}i(h,"parseHex4Bits");function p(g,l,m){var w=h(g,m);return m-1>=l&&(w|=h(g,m-1)<<4),w}i(p,"parseHexByte"),s.prototype._parseHex=i(function(l,m,w){this.length=Math.ceil((l.length-m)/6),this.words=new Array(this.length);for(var M=0;M<this.length;M++)this.words[M]=0;var j=0,S=0,f;if(w==="be")for(M=l.length-1;M>=m;M-=2)f=p(l,m,M)<<j,this.words[S]|=f&67108863,j>=18?(j-=18,S+=1,this.words[S]|=f>>>26):j+=8;else{var _=l.length-m;for(M=_%2===0?m+1:m;M<l.length;M+=2)f=p(l,m,M)<<j,this.words[S]|=f&67108863,j>=18?(j-=18,S+=1,this.words[S]|=f>>>26):j+=8}this._strip()},"_parseHex");function v(g,l,m,w){for(var M=0,j=0,S=Math.min(g.length,m),f=l;f<S;f++){var _=g.charCodeAt(f)-48;M*=w,_>=49?j=_-49+10:_>=17?j=_-17+10:j=_,a(_>=0&&j<w,"Invalid character"),M+=j}return M}i(v,"parseBase"),s.prototype._parseBase=i(function(l,m,w){this.words=[0],this.length=1;for(var M=0,j=1;j<=67108863;j*=m)M++;M--,j=j/m|0;for(var S=l.length-w,f=S%M,_=Math.min(S,S-f)+w,E=0,I=w;I<_;I+=M)E=v(l,I,I+M,m),this.imuln(j),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E);if(f!==0){var D=1;for(E=v(l,I,l.length,m),I=0;I<f;I++)D*=m;this.imuln(D),this.words[0]+E<67108864?this.words[0]+=E:this._iaddn(E)}this._strip()},"_parseBase"),s.prototype.copy=i(function(l){l.words=new Array(this.length);for(var m=0;m<this.length;m++)l.words[m]=this.words[m];l.length=this.length,l.negative=this.negative,l.red=this.red},"copy");function c(g,l){g.words=l.words,g.length=l.length,g.negative=l.negative,g.red=l.red}if(i(c,"move"),s.prototype._move=i(function(l){c(l,this)},"_move"),s.prototype.clone=i(function(){var l=new s(null);return this.copy(l),l},"clone"),s.prototype._expand=i(function(l){for(;this.length<l;)this.words[this.length++]=0;return this},"_expand"),s.prototype._strip=i(function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},"strip"),s.prototype._normSign=i(function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},"_normSign"),typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{s.prototype.inspect=d}else s.prototype.inspect=d;function d(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}i(d,"inspect");var y=["","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"],b=[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],x=[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];s.prototype.toString=i(function(l,m){l=l||10,m=m|0||1;var w;if(l===16||l==="hex"){w="";for(var M=0,j=0,S=0;S<this.length;S++){var f=this.words[S],_=((f<<M|j)&16777215).toString(16);j=f>>>24-M&16777215,M+=2,M>=26&&(M-=26,S--),j!==0||S!==this.length-1?w=y[6-_.length]+_+w:w=_+w}for(j!==0&&(w=j.toString(16)+w);w.length%m!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}if(l===(l|0)&&l>=2&&l<=36){var E=b[l],I=x[l];w="";var D=this.clone();for(D.negative=0;!D.isZero();){var L=D.modrn(I).toString(l);D=D.idivn(I),D.isZero()?w=L+w:w=y[E-L.length]+L+w}for(this.isZero()&&(w="0"+w);w.length%m!==0;)w="0"+w;return this.negative!==0&&(w="-"+w),w}a(!1,"Base should be between 2 and 36")},"toString"),s.prototype.toNumber=i(function(){var l=this.words[0];return this.length===2?l+=this.words[1]*67108864:this.length===3&&this.words[2]===1?l+=4503599627370496+this.words[1]*67108864:this.length>2&&a(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-l:l},"toNumber"),s.prototype.toJSON=i(function(){return this.toString(16,2)},"toJSON"),o&&(s.prototype.toBuffer=i(function(l,m){return this.toArrayLike(o,l,m)},"toBuffer")),s.prototype.toArray=i(function(l,m){return this.toArrayLike(Array,l,m)},"toArray");var k=i(function(l,m){return l.allocUnsafe?l.allocUnsafe(m):new l(m)},"allocate");s.prototype.toArrayLike=i(function(l,m,w){this._strip();var M=this.byteLength(),j=w||Math.max(1,M);a(M<=j,"byte array longer than desired length"),a(j>0,"Requested array length <= 0");var S=k(l,j),f=m==="le"?"LE":"BE";return this["_toArrayLike"+f](S,M),S},"toArrayLike"),s.prototype._toArrayLikeLE=i(function(l,m){for(var w=0,M=0,j=0,S=0;j<this.length;j++){var f=this.words[j]<<S|M;l[w++]=f&255,w<l.length&&(l[w++]=f>>8&255),w<l.length&&(l[w++]=f>>16&255),S===6?(w<l.length&&(l[w++]=f>>24&255),M=0,S=0):(M=f>>>24,S+=2)}if(w<l.length)for(l[w++]=M;w<l.length;)l[w++]=0},"_toArrayLikeLE"),s.prototype._toArrayLikeBE=i(function(l,m){for(var w=l.length-1,M=0,j=0,S=0;j<this.length;j++){var f=this.words[j]<<S|M;l[w--]=f&255,w>=0&&(l[w--]=f>>8&255),w>=0&&(l[w--]=f>>16&255),S===6?(w>=0&&(l[w--]=f>>24&255),M=0,S=0):(M=f>>>24,S+=2)}if(w>=0)for(l[w--]=M;w>=0;)l[w--]=0},"_toArrayLikeBE"),Math.clz32?s.prototype._countBits=i(function(l){return 32-Math.clz32(l)},"_countBits"):s.prototype._countBits=i(function(l){var m=l,w=0;return m>=4096&&(w+=13,m>>>=13),m>=64&&(w+=7,m>>>=7),m>=8&&(w+=4,m>>>=4),m>=2&&(w+=2,m>>>=2),w+m},"_countBits"),s.prototype._zeroBits=i(function(l){if(l===0)return 26;var m=l,w=0;return(m&8191)===0&&(w+=13,m>>>=13),(m&127)===0&&(w+=7,m>>>=7),(m&15)===0&&(w+=4,m>>>=4),(m&3)===0&&(w+=2,m>>>=2),(m&1)===0&&w++,w},"_zeroBits"),s.prototype.bitLength=i(function(){var l=this.words[this.length-1],m=this._countBits(l);return(this.length-1)*26+m},"bitLength");function N(g){for(var l=new Array(g.bitLength()),m=0;m<l.length;m++){var w=m/26|0,M=m%26;l[m]=g.words[w]>>>M&1}return l}i(N,"toBitArray"),s.prototype.zeroBits=i(function(){if(this.isZero())return 0;for(var l=0,m=0;m<this.length;m++){var w=this._zeroBits(this.words[m]);if(l+=w,w!==26)break}return l},"zeroBits"),s.prototype.byteLength=i(function(){return Math.ceil(this.bitLength()/8)},"byteLength"),s.prototype.toTwos=i(function(l){return this.negative!==0?this.abs().inotn(l).iaddn(1):this.clone()},"toTwos"),s.prototype.fromTwos=i(function(l){return this.testn(l-1)?this.notn(l).iaddn(1).ineg():this.clone()},"fromTwos"),s.prototype.isNeg=i(function(){return this.negative!==0},"isNeg"),s.prototype.neg=i(function(){return this.clone().ineg()},"neg"),s.prototype.ineg=i(function(){return this.isZero()||(this.negative^=1),this},"ineg"),s.prototype.iuor=i(function(l){for(;this.length<l.length;)this.words[this.length++]=0;for(var m=0;m<l.length;m++)this.words[m]=this.words[m]|l.words[m];return this._strip()},"iuor"),s.prototype.ior=i(function(l){return a((this.negative|l.negative)===0),this.iuor(l)},"ior"),s.prototype.or=i(function(l){return this.length>l.length?this.clone().ior(l):l.clone().ior(this)},"or"),s.prototype.uor=i(function(l){return this.length>l.length?this.clone().iuor(l):l.clone().iuor(this)},"uor"),s.prototype.iuand=i(function(l){var m;this.length>l.length?m=l:m=this;for(var w=0;w<m.length;w++)this.words[w]=this.words[w]&l.words[w];return this.length=m.length,this._strip()},"iuand"),s.prototype.iand=i(function(l){return a((this.negative|l.negative)===0),this.iuand(l)},"iand"),s.prototype.and=i(function(l){return this.length>l.length?this.clone().iand(l):l.clone().iand(this)},"and"),s.prototype.uand=i(function(l){return this.length>l.length?this.clone().iuand(l):l.clone().iuand(this)},"uand"),s.prototype.iuxor=i(function(l){var m,w;this.length>l.length?(m=this,w=l):(m=l,w=this);for(var M=0;M<w.length;M++)this.words[M]=m.words[M]^w.words[M];if(this!==m)for(;M<m.length;M++)this.words[M]=m.words[M];return this.length=m.length,this._strip()},"iuxor"),s.prototype.ixor=i(function(l){return a((this.negative|l.negative)===0),this.iuxor(l)},"ixor"),s.prototype.xor=i(function(l){return this.length>l.length?this.clone().ixor(l):l.clone().ixor(this)},"xor"),s.prototype.uxor=i(function(l){return this.length>l.length?this.clone().iuxor(l):l.clone().iuxor(this)},"uxor"),s.prototype.inotn=i(function(l){a(typeof l=="number"&&l>=0);var m=Math.ceil(l/26)|0,w=l%26;this._expand(m),w>0&&m--;for(var M=0;M<m;M++)this.words[M]=~this.words[M]&67108863;return w>0&&(this.words[M]=~this.words[M]&67108863>>26-w),this._strip()},"inotn"),s.prototype.notn=i(function(l){return this.clone().inotn(l)},"notn"),s.prototype.setn=i(function(l,m){a(typeof l=="number"&&l>=0);var w=l/26|0,M=l%26;return this._expand(w+1),m?this.words[w]=this.words[w]|1<<M:this.words[w]=this.words[w]&~(1<<M),this._strip()},"setn"),s.prototype.iadd=i(function(l){var m;if(this.negative!==0&&l.negative===0)return this.negative=0,m=this.isub(l),this.negative^=1,this._normSign();if(this.negative===0&&l.negative!==0)return l.negative=0,m=this.isub(l),l.negative=1,m._normSign();var w,M;this.length>l.length?(w=this,M=l):(w=l,M=this);for(var j=0,S=0;S<M.length;S++)m=(w.words[S]|0)+(M.words[S]|0)+j,this.words[S]=m&67108863,j=m>>>26;for(;j!==0&&S<w.length;S++)m=(w.words[S]|0)+j,this.words[S]=m&67108863,j=m>>>26;if(this.length=w.length,j!==0)this.words[this.length]=j,this.length++;else if(w!==this)for(;S<w.length;S++)this.words[S]=w.words[S];return this},"iadd"),s.prototype.add=i(function(l){var m;return l.negative!==0&&this.negative===0?(l.negative=0,m=this.sub(l),l.negative^=1,m):l.negative===0&&this.negative!==0?(this.negative=0,m=l.sub(this),this.negative=1,m):this.length>l.length?this.clone().iadd(l):l.clone().iadd(this)},"add"),s.prototype.isub=i(function(l){if(l.negative!==0){l.negative=0;var m=this.iadd(l);return l.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(l),this.negative=1,this._normSign();var w=this.cmp(l);if(w===0)return this.negative=0,this.length=1,this.words[0]=0,this;var M,j;w>0?(M=this,j=l):(M=l,j=this);for(var S=0,f=0;f<j.length;f++)m=(M.words[f]|0)-(j.words[f]|0)+S,S=m>>26,this.words[f]=m&67108863;for(;S!==0&&f<M.length;f++)m=(M.words[f]|0)+S,S=m>>26,this.words[f]=m&67108863;if(S===0&&f<M.length&&M!==this)for(;f<M.length;f++)this.words[f]=M.words[f];return this.length=Math.max(this.length,f),M!==this&&(this.negative=1),this._strip()},"isub"),s.prototype.sub=i(function(l){return this.clone().isub(l)},"sub");function C(g,l,m){m.negative=l.negative^g.negative;var w=g.length+l.length|0;m.length=w,w=w-1|0;var M=g.words[0]|0,j=l.words[0]|0,S=M*j,f=S&67108863,_=S/67108864|0;m.words[0]=f;for(var E=1;E<w;E++){for(var I=_>>>26,D=_&67108863,L=Math.min(E,l.length-1),U=Math.max(0,E-g.length+1);U<=L;U++){var B=E-U|0;M=g.words[B]|0,j=l.words[U]|0,S=M*j+D,I+=S/67108864|0,D=S&67108863}m.words[E]=D|0,_=I|0}return _!==0?m.words[E]=_|0:m.length--,m._strip()}i(C,"smallMulTo");var R=i(function(l,m,w){var M=l.words,j=m.words,S=w.words,f=0,_,E,I,D=M[0]|0,L=D&8191,U=D>>>13,B=M[1]|0,G=B&8191,H=B>>>13,K=M[2]|0,_e=K&8191,se=K>>>13,ae=M[3]|0,ve=ae&8191,q=ae>>>13,ne=M[4]|0,X=ne&8191,W=ne>>>13,le=M[5]|0,ke=le&8191,be=le>>>13,fe=M[6]|0,Q=fe&8191,Y=fe>>>13,te=M[7]|0,he=te&8191,oe=te>>>13,ue=M[8]|0,ze=ue&8191,we=ue>>>13,Be=M[9]|0,We=Be&8191,ge=Be>>>13,Ue=j[0]|0,ce=Ue&8191,ye=Ue>>>13,Te=j[1]|0,Re=Te&8191,je=Te>>>13,$e=j[2]|0,Ye=$e&8191,Ne=$e>>>13,Ee=j[3]|0,Pe=Ee&8191,Se=Ee>>>13,Ze=j[4]|0,Ke=Ze&8191,re=Ze>>>13,pe=j[5]|0,Ce=pe&8191,xe=pe>>>13,Oe=j[6]|0,He=Oe&8191,ie=Oe>>>13,Ae=j[7]|0,Ge=Ae&8191,me=Ae>>>13,Je=j[8]|0,tt=Je&8191,De=Je>>>13,Qe=j[9]|0,Ie=Qe&8191,Fe=Qe>>>13;w.negative=l.negative^m.negative,w.length=19,_=Math.imul(L,ce),E=Math.imul(L,ye),E=E+Math.imul(U,ce)|0,I=Math.imul(U,ye);var lt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(lt>>>26)|0,lt&=67108863,_=Math.imul(G,ce),E=Math.imul(G,ye),E=E+Math.imul(H,ce)|0,I=Math.imul(H,ye),_=_+Math.imul(L,Re)|0,E=E+Math.imul(L,je)|0,E=E+Math.imul(U,Re)|0,I=I+Math.imul(U,je)|0;var yt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(yt>>>26)|0,yt&=67108863,_=Math.imul(_e,ce),E=Math.imul(_e,ye),E=E+Math.imul(se,ce)|0,I=Math.imul(se,ye),_=_+Math.imul(G,Re)|0,E=E+Math.imul(G,je)|0,E=E+Math.imul(H,Re)|0,I=I+Math.imul(H,je)|0,_=_+Math.imul(L,Ye)|0,E=E+Math.imul(L,Ne)|0,E=E+Math.imul(U,Ye)|0,I=I+Math.imul(U,Ne)|0;var ht=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(ht>>>26)|0,ht&=67108863,_=Math.imul(ve,ce),E=Math.imul(ve,ye),E=E+Math.imul(q,ce)|0,I=Math.imul(q,ye),_=_+Math.imul(_e,Re)|0,E=E+Math.imul(_e,je)|0,E=E+Math.imul(se,Re)|0,I=I+Math.imul(se,je)|0,_=_+Math.imul(G,Ye)|0,E=E+Math.imul(G,Ne)|0,E=E+Math.imul(H,Ye)|0,I=I+Math.imul(H,Ne)|0,_=_+Math.imul(L,Pe)|0,E=E+Math.imul(L,Se)|0,E=E+Math.imul(U,Pe)|0,I=I+Math.imul(U,Se)|0;var Mt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,_=Math.imul(X,ce),E=Math.imul(X,ye),E=E+Math.imul(W,ce)|0,I=Math.imul(W,ye),_=_+Math.imul(ve,Re)|0,E=E+Math.imul(ve,je)|0,E=E+Math.imul(q,Re)|0,I=I+Math.imul(q,je)|0,_=_+Math.imul(_e,Ye)|0,E=E+Math.imul(_e,Ne)|0,E=E+Math.imul(se,Ye)|0,I=I+Math.imul(se,Ne)|0,_=_+Math.imul(G,Pe)|0,E=E+Math.imul(G,Se)|0,E=E+Math.imul(H,Pe)|0,I=I+Math.imul(H,Se)|0,_=_+Math.imul(L,Ke)|0,E=E+Math.imul(L,re)|0,E=E+Math.imul(U,Ke)|0,I=I+Math.imul(U,re)|0;var Bt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,_=Math.imul(ke,ce),E=Math.imul(ke,ye),E=E+Math.imul(be,ce)|0,I=Math.imul(be,ye),_=_+Math.imul(X,Re)|0,E=E+Math.imul(X,je)|0,E=E+Math.imul(W,Re)|0,I=I+Math.imul(W,je)|0,_=_+Math.imul(ve,Ye)|0,E=E+Math.imul(ve,Ne)|0,E=E+Math.imul(q,Ye)|0,I=I+Math.imul(q,Ne)|0,_=_+Math.imul(_e,Pe)|0,E=E+Math.imul(_e,Se)|0,E=E+Math.imul(se,Pe)|0,I=I+Math.imul(se,Se)|0,_=_+Math.imul(G,Ke)|0,E=E+Math.imul(G,re)|0,E=E+Math.imul(H,Ke)|0,I=I+Math.imul(H,re)|0,_=_+Math.imul(L,Ce)|0,E=E+Math.imul(L,xe)|0,E=E+Math.imul(U,Ce)|0,I=I+Math.imul(U,xe)|0;var Et=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Et>>>26)|0,Et&=67108863,_=Math.imul(Q,ce),E=Math.imul(Q,ye),E=E+Math.imul(Y,ce)|0,I=Math.imul(Y,ye),_=_+Math.imul(ke,Re)|0,E=E+Math.imul(ke,je)|0,E=E+Math.imul(be,Re)|0,I=I+Math.imul(be,je)|0,_=_+Math.imul(X,Ye)|0,E=E+Math.imul(X,Ne)|0,E=E+Math.imul(W,Ye)|0,I=I+Math.imul(W,Ne)|0,_=_+Math.imul(ve,Pe)|0,E=E+Math.imul(ve,Se)|0,E=E+Math.imul(q,Pe)|0,I=I+Math.imul(q,Se)|0,_=_+Math.imul(_e,Ke)|0,E=E+Math.imul(_e,re)|0,E=E+Math.imul(se,Ke)|0,I=I+Math.imul(se,re)|0,_=_+Math.imul(G,Ce)|0,E=E+Math.imul(G,xe)|0,E=E+Math.imul(H,Ce)|0,I=I+Math.imul(H,xe)|0,_=_+Math.imul(L,He)|0,E=E+Math.imul(L,ie)|0,E=E+Math.imul(U,He)|0,I=I+Math.imul(U,ie)|0;var _t=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(_t>>>26)|0,_t&=67108863,_=Math.imul(he,ce),E=Math.imul(he,ye),E=E+Math.imul(oe,ce)|0,I=Math.imul(oe,ye),_=_+Math.imul(Q,Re)|0,E=E+Math.imul(Q,je)|0,E=E+Math.imul(Y,Re)|0,I=I+Math.imul(Y,je)|0,_=_+Math.imul(ke,Ye)|0,E=E+Math.imul(ke,Ne)|0,E=E+Math.imul(be,Ye)|0,I=I+Math.imul(be,Ne)|0,_=_+Math.imul(X,Pe)|0,E=E+Math.imul(X,Se)|0,E=E+Math.imul(W,Pe)|0,I=I+Math.imul(W,Se)|0,_=_+Math.imul(ve,Ke)|0,E=E+Math.imul(ve,re)|0,E=E+Math.imul(q,Ke)|0,I=I+Math.imul(q,re)|0,_=_+Math.imul(_e,Ce)|0,E=E+Math.imul(_e,xe)|0,E=E+Math.imul(se,Ce)|0,I=I+Math.imul(se,xe)|0,_=_+Math.imul(G,He)|0,E=E+Math.imul(G,ie)|0,E=E+Math.imul(H,He)|0,I=I+Math.imul(H,ie)|0,_=_+Math.imul(L,Ge)|0,E=E+Math.imul(L,me)|0,E=E+Math.imul(U,Ge)|0,I=I+Math.imul(U,me)|0;var Ft=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Ft>>>26)|0,Ft&=67108863,_=Math.imul(ze,ce),E=Math.imul(ze,ye),E=E+Math.imul(we,ce)|0,I=Math.imul(we,ye),_=_+Math.imul(he,Re)|0,E=E+Math.imul(he,je)|0,E=E+Math.imul(oe,Re)|0,I=I+Math.imul(oe,je)|0,_=_+Math.imul(Q,Ye)|0,E=E+Math.imul(Q,Ne)|0,E=E+Math.imul(Y,Ye)|0,I=I+Math.imul(Y,Ne)|0,_=_+Math.imul(ke,Pe)|0,E=E+Math.imul(ke,Se)|0,E=E+Math.imul(be,Pe)|0,I=I+Math.imul(be,Se)|0,_=_+Math.imul(X,Ke)|0,E=E+Math.imul(X,re)|0,E=E+Math.imul(W,Ke)|0,I=I+Math.imul(W,re)|0,_=_+Math.imul(ve,Ce)|0,E=E+Math.imul(ve,xe)|0,E=E+Math.imul(q,Ce)|0,I=I+Math.imul(q,xe)|0,_=_+Math.imul(_e,He)|0,E=E+Math.imul(_e,ie)|0,E=E+Math.imul(se,He)|0,I=I+Math.imul(se,ie)|0,_=_+Math.imul(G,Ge)|0,E=E+Math.imul(G,me)|0,E=E+Math.imul(H,Ge)|0,I=I+Math.imul(H,me)|0,_=_+Math.imul(L,tt)|0,E=E+Math.imul(L,De)|0,E=E+Math.imul(U,tt)|0,I=I+Math.imul(U,De)|0;var Vt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,_=Math.imul(We,ce),E=Math.imul(We,ye),E=E+Math.imul(ge,ce)|0,I=Math.imul(ge,ye),_=_+Math.imul(ze,Re)|0,E=E+Math.imul(ze,je)|0,E=E+Math.imul(we,Re)|0,I=I+Math.imul(we,je)|0,_=_+Math.imul(he,Ye)|0,E=E+Math.imul(he,Ne)|0,E=E+Math.imul(oe,Ye)|0,I=I+Math.imul(oe,Ne)|0,_=_+Math.imul(Q,Pe)|0,E=E+Math.imul(Q,Se)|0,E=E+Math.imul(Y,Pe)|0,I=I+Math.imul(Y,Se)|0,_=_+Math.imul(ke,Ke)|0,E=E+Math.imul(ke,re)|0,E=E+Math.imul(be,Ke)|0,I=I+Math.imul(be,re)|0,_=_+Math.imul(X,Ce)|0,E=E+Math.imul(X,xe)|0,E=E+Math.imul(W,Ce)|0,I=I+Math.imul(W,xe)|0,_=_+Math.imul(ve,He)|0,E=E+Math.imul(ve,ie)|0,E=E+Math.imul(q,He)|0,I=I+Math.imul(q,ie)|0,_=_+Math.imul(_e,Ge)|0,E=E+Math.imul(_e,me)|0,E=E+Math.imul(se,Ge)|0,I=I+Math.imul(se,me)|0,_=_+Math.imul(G,tt)|0,E=E+Math.imul(G,De)|0,E=E+Math.imul(H,tt)|0,I=I+Math.imul(H,De)|0,_=_+Math.imul(L,Ie)|0,E=E+Math.imul(L,Fe)|0,E=E+Math.imul(U,Ie)|0,I=I+Math.imul(U,Fe)|0;var Tt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,_=Math.imul(We,Re),E=Math.imul(We,je),E=E+Math.imul(ge,Re)|0,I=Math.imul(ge,je),_=_+Math.imul(ze,Ye)|0,E=E+Math.imul(ze,Ne)|0,E=E+Math.imul(we,Ye)|0,I=I+Math.imul(we,Ne)|0,_=_+Math.imul(he,Pe)|0,E=E+Math.imul(he,Se)|0,E=E+Math.imul(oe,Pe)|0,I=I+Math.imul(oe,Se)|0,_=_+Math.imul(Q,Ke)|0,E=E+Math.imul(Q,re)|0,E=E+Math.imul(Y,Ke)|0,I=I+Math.imul(Y,re)|0,_=_+Math.imul(ke,Ce)|0,E=E+Math.imul(ke,xe)|0,E=E+Math.imul(be,Ce)|0,I=I+Math.imul(be,xe)|0,_=_+Math.imul(X,He)|0,E=E+Math.imul(X,ie)|0,E=E+Math.imul(W,He)|0,I=I+Math.imul(W,ie)|0,_=_+Math.imul(ve,Ge)|0,E=E+Math.imul(ve,me)|0,E=E+Math.imul(q,Ge)|0,I=I+Math.imul(q,me)|0,_=_+Math.imul(_e,tt)|0,E=E+Math.imul(_e,De)|0,E=E+Math.imul(se,tt)|0,I=I+Math.imul(se,De)|0,_=_+Math.imul(G,Ie)|0,E=E+Math.imul(G,Fe)|0,E=E+Math.imul(H,Ie)|0,I=I+Math.imul(H,Fe)|0;var zt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(zt>>>26)|0,zt&=67108863,_=Math.imul(We,Ye),E=Math.imul(We,Ne),E=E+Math.imul(ge,Ye)|0,I=Math.imul(ge,Ne),_=_+Math.imul(ze,Pe)|0,E=E+Math.imul(ze,Se)|0,E=E+Math.imul(we,Pe)|0,I=I+Math.imul(we,Se)|0,_=_+Math.imul(he,Ke)|0,E=E+Math.imul(he,re)|0,E=E+Math.imul(oe,Ke)|0,I=I+Math.imul(oe,re)|0,_=_+Math.imul(Q,Ce)|0,E=E+Math.imul(Q,xe)|0,E=E+Math.imul(Y,Ce)|0,I=I+Math.imul(Y,xe)|0,_=_+Math.imul(ke,He)|0,E=E+Math.imul(ke,ie)|0,E=E+Math.imul(be,He)|0,I=I+Math.imul(be,ie)|0,_=_+Math.imul(X,Ge)|0,E=E+Math.imul(X,me)|0,E=E+Math.imul(W,Ge)|0,I=I+Math.imul(W,me)|0,_=_+Math.imul(ve,tt)|0,E=E+Math.imul(ve,De)|0,E=E+Math.imul(q,tt)|0,I=I+Math.imul(q,De)|0,_=_+Math.imul(_e,Ie)|0,E=E+Math.imul(_e,Fe)|0,E=E+Math.imul(se,Ie)|0,I=I+Math.imul(se,Fe)|0;var Nt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,_=Math.imul(We,Pe),E=Math.imul(We,Se),E=E+Math.imul(ge,Pe)|0,I=Math.imul(ge,Se),_=_+Math.imul(ze,Ke)|0,E=E+Math.imul(ze,re)|0,E=E+Math.imul(we,Ke)|0,I=I+Math.imul(we,re)|0,_=_+Math.imul(he,Ce)|0,E=E+Math.imul(he,xe)|0,E=E+Math.imul(oe,Ce)|0,I=I+Math.imul(oe,xe)|0,_=_+Math.imul(Q,He)|0,E=E+Math.imul(Q,ie)|0,E=E+Math.imul(Y,He)|0,I=I+Math.imul(Y,ie)|0,_=_+Math.imul(ke,Ge)|0,E=E+Math.imul(ke,me)|0,E=E+Math.imul(be,Ge)|0,I=I+Math.imul(be,me)|0,_=_+Math.imul(X,tt)|0,E=E+Math.imul(X,De)|0,E=E+Math.imul(W,tt)|0,I=I+Math.imul(W,De)|0,_=_+Math.imul(ve,Ie)|0,E=E+Math.imul(ve,Fe)|0,E=E+Math.imul(q,Ie)|0,I=I+Math.imul(q,Fe)|0;var Pt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,_=Math.imul(We,Ke),E=Math.imul(We,re),E=E+Math.imul(ge,Ke)|0,I=Math.imul(ge,re),_=_+Math.imul(ze,Ce)|0,E=E+Math.imul(ze,xe)|0,E=E+Math.imul(we,Ce)|0,I=I+Math.imul(we,xe)|0,_=_+Math.imul(he,He)|0,E=E+Math.imul(he,ie)|0,E=E+Math.imul(oe,He)|0,I=I+Math.imul(oe,ie)|0,_=_+Math.imul(Q,Ge)|0,E=E+Math.imul(Q,me)|0,E=E+Math.imul(Y,Ge)|0,I=I+Math.imul(Y,me)|0,_=_+Math.imul(ke,tt)|0,E=E+Math.imul(ke,De)|0,E=E+Math.imul(be,tt)|0,I=I+Math.imul(be,De)|0,_=_+Math.imul(X,Ie)|0,E=E+Math.imul(X,Fe)|0,E=E+Math.imul(W,Ie)|0,I=I+Math.imul(W,Fe)|0;var Ut=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,_=Math.imul(We,Ce),E=Math.imul(We,xe),E=E+Math.imul(ge,Ce)|0,I=Math.imul(ge,xe),_=_+Math.imul(ze,He)|0,E=E+Math.imul(ze,ie)|0,E=E+Math.imul(we,He)|0,I=I+Math.imul(we,ie)|0,_=_+Math.imul(he,Ge)|0,E=E+Math.imul(he,me)|0,E=E+Math.imul(oe,Ge)|0,I=I+Math.imul(oe,me)|0,_=_+Math.imul(Q,tt)|0,E=E+Math.imul(Q,De)|0,E=E+Math.imul(Y,tt)|0,I=I+Math.imul(Y,De)|0,_=_+Math.imul(ke,Ie)|0,E=E+Math.imul(ke,Fe)|0,E=E+Math.imul(be,Ie)|0,I=I+Math.imul(be,Fe)|0;var Zt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,_=Math.imul(We,He),E=Math.imul(We,ie),E=E+Math.imul(ge,He)|0,I=Math.imul(ge,ie),_=_+Math.imul(ze,Ge)|0,E=E+Math.imul(ze,me)|0,E=E+Math.imul(we,Ge)|0,I=I+Math.imul(we,me)|0,_=_+Math.imul(he,tt)|0,E=E+Math.imul(he,De)|0,E=E+Math.imul(oe,tt)|0,I=I+Math.imul(oe,De)|0,_=_+Math.imul(Q,Ie)|0,E=E+Math.imul(Q,Fe)|0,E=E+Math.imul(Y,Ie)|0,I=I+Math.imul(Y,Fe)|0;var Ht=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Ht>>>26)|0,Ht&=67108863,_=Math.imul(We,Ge),E=Math.imul(We,me),E=E+Math.imul(ge,Ge)|0,I=Math.imul(ge,me),_=_+Math.imul(ze,tt)|0,E=E+Math.imul(ze,De)|0,E=E+Math.imul(we,tt)|0,I=I+Math.imul(we,De)|0,_=_+Math.imul(he,Ie)|0,E=E+Math.imul(he,Fe)|0,E=E+Math.imul(oe,Ie)|0,I=I+Math.imul(oe,Fe)|0;var Jt=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,_=Math.imul(We,tt),E=Math.imul(We,De),E=E+Math.imul(ge,tt)|0,I=Math.imul(ge,De),_=_+Math.imul(ze,Ie)|0,E=E+Math.imul(ze,Fe)|0,E=E+Math.imul(we,Ie)|0,I=I+Math.imul(we,Fe)|0;var Lr=(f+_|0)+((E&8191)<<13)|0;f=(I+(E>>>13)|0)+(Lr>>>26)|0,Lr&=67108863,_=Math.imul(We,Ie),E=Math.imul(We,Fe),E=E+Math.imul(ge,Ie)|0,I=Math.imul(ge,Fe);var de=(f+_|0)+((E&8191)<<13)|0;return f=(I+(E>>>13)|0)+(de>>>26)|0,de&=67108863,S[0]=lt,S[1]=yt,S[2]=ht,S[3]=Mt,S[4]=Bt,S[5]=Et,S[6]=_t,S[7]=Ft,S[8]=Vt,S[9]=Tt,S[10]=zt,S[11]=Nt,S[12]=Pt,S[13]=Ut,S[14]=Zt,S[15]=Ht,S[16]=Jt,S[17]=Lr,S[18]=de,f!==0&&(S[19]=f,w.length++),w},"comb10MulTo");Math.imul||(R=C);function O(g,l,m){m.negative=l.negative^g.negative,m.length=g.length+l.length;for(var w=0,M=0,j=0;j<m.length-1;j++){var S=M;M=0;for(var f=w&67108863,_=Math.min(j,l.length-1),E=Math.max(0,j-g.length+1);E<=_;E++){var I=j-E,D=g.words[I]|0,L=l.words[E]|0,U=D*L,B=U&67108863;S=S+(U/67108864|0)|0,B=B+f|0,f=B&67108863,S=S+(B>>>26)|0,M+=S>>>26,S&=67108863}m.words[j]=f,w=S,S=M}return w!==0?m.words[j]=w:m.length--,m._strip()}i(O,"bigMulTo");function T(g,l,m){return O(g,l,m)}i(T,"jumboMulTo"),s.prototype.mulTo=i(function(l,m){var w,M=this.length+l.length;return this.length===10&&l.length===10?w=R(this,l,m):M<63?w=C(this,l,m):M<1024?w=O(this,l,m):w=T(this,l,m),w},"mulTo"),s.prototype.mul=i(function(l){var m=new s(null);return m.words=new Array(this.length+l.length),this.mulTo(l,m)},"mul"),s.prototype.mulf=i(function(l){var m=new s(null);return m.words=new Array(this.length+l.length),T(this,l,m)},"mulf"),s.prototype.imul=i(function(l){return this.clone().mulTo(l,this)},"imul"),s.prototype.imuln=i(function(l){var m=l<0;m&&(l=-l),a(typeof l=="number"),a(l<67108864);for(var w=0,M=0;M<this.length;M++){var j=(this.words[M]|0)*l,S=(j&67108863)+(w&67108863);w>>=26,w+=j/67108864|0,w+=S>>>26,this.words[M]=S&67108863}return w!==0&&(this.words[M]=w,this.length++),this.length=l===0?1:this.length,m?this.ineg():this},"imuln"),s.prototype.muln=i(function(l){return this.clone().imuln(l)},"muln"),s.prototype.sqr=i(function(){return this.mul(this)},"sqr"),s.prototype.isqr=i(function(){return this.imul(this.clone())},"isqr"),s.prototype.pow=i(function(l){var m=N(l);if(m.length===0)return new s(1);for(var w=this,M=0;M<m.length&&m[M]===0;M++,w=w.sqr());if(++M<m.length)for(var j=w.sqr();M<m.length;M++,j=j.sqr())m[M]!==0&&(w=w.mul(j));return w},"pow"),s.prototype.iushln=i(function(l){a(typeof l=="number"&&l>=0);var m=l%26,w=(l-m)/26,M=67108863>>>26-m<<26-m,j;if(m!==0){var S=0;for(j=0;j<this.length;j++){var f=this.words[j]&M,_=(this.words[j]|0)-f<<m;this.words[j]=_|S,S=f>>>26-m}S&&(this.words[j]=S,this.length++)}if(w!==0){for(j=this.length-1;j>=0;j--)this.words[j+w]=this.words[j];for(j=0;j<w;j++)this.words[j]=0;this.length+=w}return this._strip()},"iushln"),s.prototype.ishln=i(function(l){return a(this.negative===0),this.iushln(l)},"ishln"),s.prototype.iushrn=i(function(l,m,w){a(typeof l=="number"&&l>=0);var M;m?M=(m-m%26)/26:M=0;var j=l%26,S=Math.min((l-j)/26,this.length),f=67108863^67108863>>>j<<j,_=w;if(M-=S,M=Math.max(0,M),_){for(var E=0;E<S;E++)_.words[E]=this.words[E];_.length=S}if(S!==0)if(this.length>S)for(this.length-=S,E=0;E<this.length;E++)this.words[E]=this.words[E+S];else this.words[0]=0,this.length=1;var I=0;for(E=this.length-1;E>=0&&(I!==0||E>=M);E--){var D=this.words[E]|0;this.words[E]=I<<26-j|D>>>j,I=D&f}return _&&I!==0&&(_.words[_.length++]=I),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},"iushrn"),s.prototype.ishrn=i(function(l,m,w){return a(this.negative===0),this.iushrn(l,m,w)},"ishrn"),s.prototype.shln=i(function(l){return this.clone().ishln(l)},"shln"),s.prototype.ushln=i(function(l){return this.clone().iushln(l)},"ushln"),s.prototype.shrn=i(function(l){return this.clone().ishrn(l)},"shrn"),s.prototype.ushrn=i(function(l){return this.clone().iushrn(l)},"ushrn"),s.prototype.testn=i(function(l){a(typeof l=="number"&&l>=0);var m=l%26,w=(l-m)/26,M=1<<m;if(this.length<=w)return!1;var j=this.words[w];return!!(j&M)},"testn"),s.prototype.imaskn=i(function(l){a(typeof l=="number"&&l>=0);var m=l%26,w=(l-m)/26;if(a(this.negative===0,"imaskn works only with positive numbers"),this.length<=w)return this;if(m!==0&&w++,this.length=Math.min(w,this.length),m!==0){var M=67108863^67108863>>>m<<m;this.words[this.length-1]&=M}return this._strip()},"imaskn"),s.prototype.maskn=i(function(l){return this.clone().imaskn(l)},"maskn"),s.prototype.iaddn=i(function(l){return a(typeof l=="number"),a(l<67108864),l<0?this.isubn(-l):this.negative!==0?this.length===1&&(this.words[0]|0)<=l?(this.words[0]=l-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(l),this.negative=1,this):this._iaddn(l)},"iaddn"),s.prototype._iaddn=i(function(l){this.words[0]+=l;for(var m=0;m<this.length&&this.words[m]>=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},"_iaddn"),s.prototype.isubn=i(function(l){if(a(typeof l=="number"),a(l<67108864),l<0)return this.iaddn(-l);if(this.negative!==0)return this.negative=0,this.iaddn(l),this.negative=1,this;if(this.words[0]-=l,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m<this.length&&this.words[m]<0;m++)this.words[m]+=67108864,this.words[m+1]-=1;return this._strip()},"isubn"),s.prototype.addn=i(function(l){return this.clone().iaddn(l)},"addn"),s.prototype.subn=i(function(l){return this.clone().isubn(l)},"subn"),s.prototype.iabs=i(function(){return this.negative=0,this},"iabs"),s.prototype.abs=i(function(){return this.clone().iabs()},"abs"),s.prototype._ishlnsubmul=i(function(l,m,w){var M=l.length+w,j;this._expand(M);var S,f=0;for(j=0;j<l.length;j++){S=(this.words[j+w]|0)+f;var _=(l.words[j]|0)*m;S-=_&67108863,f=(S>>26)-(_/67108864|0),this.words[j+w]=S&67108863}for(;j<this.length-w;j++)S=(this.words[j+w]|0)+f,f=S>>26,this.words[j+w]=S&67108863;if(f===0)return this._strip();for(a(f===-1),f=0,j=0;j<this.length;j++)S=-(this.words[j]|0)+f,f=S>>26,this.words[j]=S&67108863;return this.negative=1,this._strip()},"_ishlnsubmul"),s.prototype._wordDiv=i(function(l,m){var w=this.length-l.length,M=this.clone(),j=l,S=j.words[j.length-1]|0,f=this._countBits(S);w=26-f,w!==0&&(j=j.ushln(w),M.iushln(w),S=j.words[j.length-1]|0);var _=M.length-j.length,E;if(m!=="mod"){E=new s(null),E.length=_+1,E.words=new Array(E.length);for(var I=0;I<E.length;I++)E.words[I]=0}var D=M.clone()._ishlnsubmul(j,1,_);D.negative===0&&(M=D,E&&(E.words[_]=1));for(var L=_-1;L>=0;L--){var U=(M.words[j.length+L]|0)*67108864+(M.words[j.length+L-1]|0);for(U=Math.min(U/S|0,67108863),M._ishlnsubmul(j,U,L);M.negative!==0;)U--,M.negative=0,M._ishlnsubmul(j,1,L),M.isZero()||(M.negative^=1);E&&(E.words[L]=U)}return E&&E._strip(),M._strip(),m!=="div"&&w!==0&&M.iushrn(w),{div:E||null,mod:M}},"_wordDiv"),s.prototype.divmod=i(function(l,m,w){if(a(!l.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var M,j,S;return this.negative!==0&&l.negative===0?(S=this.neg().divmod(l,m),m!=="mod"&&(M=S.div.neg()),m!=="div"&&(j=S.mod.neg(),w&&j.negative!==0&&j.iadd(l)),{div:M,mod:j}):this.negative===0&&l.negative!==0?(S=this.divmod(l.neg(),m),m!=="mod"&&(M=S.div.neg()),{div:M,mod:S.mod}):(this.negative&l.negative)!==0?(S=this.neg().divmod(l.neg(),m),m!=="div"&&(j=S.mod.neg(),w&&j.negative!==0&&j.isub(l)),{div:S.div,mod:j}):l.length>this.length||this.cmp(l)<0?{div:new s(0),mod:this}:l.length===1?m==="div"?{div:this.divn(l.words[0]),mod:null}:m==="mod"?{div:null,mod:new s(this.modrn(l.words[0]))}:{div:this.divn(l.words[0]),mod:new s(this.modrn(l.words[0]))}:this._wordDiv(l,m)},"divmod"),s.prototype.div=i(function(l){return this.divmod(l,"div",!1).div},"div"),s.prototype.mod=i(function(l){return this.divmod(l,"mod",!1).mod},"mod"),s.prototype.umod=i(function(l){return this.divmod(l,"mod",!0).mod},"umod"),s.prototype.divRound=i(function(l){var m=this.divmod(l);if(m.mod.isZero())return m.div;var w=m.div.negative!==0?m.mod.isub(l):m.mod,M=l.ushrn(1),j=l.andln(1),S=w.cmp(M);return S<0||j===1&&S===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},"divRound"),s.prototype.modrn=i(function(l){var m=l<0;m&&(l=-l),a(l<=67108863);for(var w=(1<<26)%l,M=0,j=this.length-1;j>=0;j--)M=(w*M+(this.words[j]|0))%l;return m?-M:M},"modrn"),s.prototype.modn=i(function(l){return this.modrn(l)},"modn"),s.prototype.idivn=i(function(l){var m=l<0;m&&(l=-l),a(l<=67108863);for(var w=0,M=this.length-1;M>=0;M--){var j=(this.words[M]|0)+w*67108864;this.words[M]=j/l|0,w=j%l}return this._strip(),m?this.ineg():this},"idivn"),s.prototype.divn=i(function(l){return this.clone().idivn(l)},"divn"),s.prototype.egcd=i(function(l){a(l.negative===0),a(!l.isZero());var m=this,w=l.clone();m.negative!==0?m=m.umod(l):m=m.clone();for(var M=new s(1),j=new s(0),S=new s(0),f=new s(1),_=0;m.isEven()&&w.isEven();)m.iushrn(1),w.iushrn(1),++_;for(var E=w.clone(),I=m.clone();!m.isZero();){for(var D=0,L=1;(m.words[0]&L)===0&&D<26;++D,L<<=1);if(D>0)for(m.iushrn(D);D-- >0;)(M.isOdd()||j.isOdd())&&(M.iadd(E),j.isub(I)),M.iushrn(1),j.iushrn(1);for(var U=0,B=1;(w.words[0]&B)===0&&U<26;++U,B<<=1);if(U>0)for(w.iushrn(U);U-- >0;)(S.isOdd()||f.isOdd())&&(S.iadd(E),f.isub(I)),S.iushrn(1),f.iushrn(1);m.cmp(w)>=0?(m.isub(w),M.isub(S),j.isub(f)):(w.isub(m),S.isub(M),f.isub(j))}return{a:S,b:f,gcd:w.iushln(_)}},"egcd"),s.prototype._invmp=i(function(l){a(l.negative===0),a(!l.isZero());var m=this,w=l.clone();m.negative!==0?m=m.umod(l):m=m.clone();for(var M=new s(1),j=new s(0),S=w.clone();m.cmpn(1)>0&&w.cmpn(1)>0;){for(var f=0,_=1;(m.words[0]&_)===0&&f<26;++f,_<<=1);if(f>0)for(m.iushrn(f);f-- >0;)M.isOdd()&&M.iadd(S),M.iushrn(1);for(var E=0,I=1;(w.words[0]&I)===0&&E<26;++E,I<<=1);if(E>0)for(w.iushrn(E);E-- >0;)j.isOdd()&&j.iadd(S),j.iushrn(1);m.cmp(w)>=0?(m.isub(w),M.isub(j)):(w.isub(m),j.isub(M))}var D;return m.cmpn(1)===0?D=M:D=j,D.cmpn(0)<0&&D.iadd(l),D},"_invmp"),s.prototype.gcd=i(function(l){if(this.isZero())return l.abs();if(l.isZero())return this.abs();var m=this.clone(),w=l.clone();m.negative=0,w.negative=0;for(var M=0;m.isEven()&&w.isEven();M++)m.iushrn(1),w.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;w.isEven();)w.iushrn(1);var j=m.cmp(w);if(j<0){var S=m;m=w,w=S}else if(j===0||w.cmpn(1)===0)break;m.isub(w)}while(!0);return w.iushln(M)},"gcd"),s.prototype.invm=i(function(l){return this.egcd(l).a.umod(l)},"invm"),s.prototype.isEven=i(function(){return(this.words[0]&1)===0},"isEven"),s.prototype.isOdd=i(function(){return(this.words[0]&1)===1},"isOdd"),s.prototype.andln=i(function(l){return this.words[0]&l},"andln"),s.prototype.bincn=i(function(l){a(typeof l=="number");var m=l%26,w=(l-m)/26,M=1<<m;if(this.length<=w)return this._expand(w+1),this.words[w]|=M,this;for(var j=M,S=w;j!==0&&S<this.length;S++){var f=this.words[S]|0;f+=j,j=f>>>26,f&=67108863,this.words[S]=f}return j!==0&&(this.words[S]=j,this.length++),this},"bincn"),s.prototype.isZero=i(function(){return this.length===1&&this.words[0]===0},"isZero"),s.prototype.cmpn=i(function(l){var m=l<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var w;if(this.length>1)w=1;else{m&&(l=-l),a(l<=67108863,"Number is too big");var M=this.words[0]|0;w=M===l?0:M<l?-1:1}return this.negative!==0?-w|0:w},"cmpn"),s.prototype.cmp=i(function(l){if(this.negative!==0&&l.negative===0)return-1;if(this.negative===0&&l.negative!==0)return 1;var m=this.ucmp(l);return this.negative!==0?-m|0:m},"cmp"),s.prototype.ucmp=i(function(l){if(this.length>l.length)return 1;if(this.length<l.length)return-1;for(var m=0,w=this.length-1;w>=0;w--){var M=this.words[w]|0,j=l.words[w]|0;if(M!==j){M<j?m=-1:M>j&&(m=1);break}}return m},"ucmp"),s.prototype.gtn=i(function(l){return this.cmpn(l)===1},"gtn"),s.prototype.gt=i(function(l){return this.cmp(l)===1},"gt"),s.prototype.gten=i(function(l){return this.cmpn(l)>=0},"gten"),s.prototype.gte=i(function(l){return this.cmp(l)>=0},"gte"),s.prototype.ltn=i(function(l){return this.cmpn(l)===-1},"ltn"),s.prototype.lt=i(function(l){return this.cmp(l)===-1},"lt"),s.prototype.lten=i(function(l){return this.cmpn(l)<=0},"lten"),s.prototype.lte=i(function(l){return this.cmp(l)<=0},"lte"),s.prototype.eqn=i(function(l){return this.cmpn(l)===0},"eqn"),s.prototype.eq=i(function(l){return this.cmp(l)===0},"eq"),s.red=i(function(l){return new F(l)},"red"),s.prototype.toRed=i(function(l){return a(!this.red,"Already a number in reduction context"),a(this.negative===0,"red works only with positives"),l.convertTo(this)._forceRed(l)},"toRed"),s.prototype.fromRed=i(function(){return a(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},"fromRed"),s.prototype._forceRed=i(function(l){return this.red=l,this},"_forceRed"),s.prototype.forceRed=i(function(l){return a(!this.red,"Already a number in reduction context"),this._forceRed(l)},"forceRed"),s.prototype.redAdd=i(function(l){return a(this.red,"redAdd works only with red numbers"),this.red.add(this,l)},"redAdd"),s.prototype.redIAdd=i(function(l){return a(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,l)},"redIAdd"),s.prototype.redSub=i(function(l){return a(this.red,"redSub works only with red numbers"),this.red.sub(this,l)},"redSub"),s.prototype.redISub=i(function(l){return a(this.red,"redISub works only with red numbers"),this.red.isub(this,l)},"redISub"),s.prototype.redShl=i(function(l){return a(this.red,"redShl works only with red numbers"),this.red.shl(this,l)},"redShl"),s.prototype.redMul=i(function(l){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.mul(this,l)},"redMul"),s.prototype.redIMul=i(function(l){return a(this.red,"redMul works only with red numbers"),this.red._verify2(this,l),this.red.imul(this,l)},"redIMul"),s.prototype.redSqr=i(function(){return a(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},"redSqr"),s.prototype.redISqr=i(function(){return a(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},"redISqr"),s.prototype.redSqrt=i(function(){return a(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},"redSqrt"),s.prototype.redInvm=i(function(){return a(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},"redInvm"),s.prototype.redNeg=i(function(){return a(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},"redNeg"),s.prototype.redPow=i(function(l){return a(this.red&&!l.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,l)},"redPow");var P={k256:null,p224:null,p192:null,p25519:null};function z(g,l){this.name=g,this.p=new s(l,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}i(z,"MPrime"),z.prototype._tmp=i(function(){var l=new s(null);return l.words=new Array(Math.ceil(this.n/13)),l},"_tmp"),z.prototype.ireduce=i(function(l){var m=l,w;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),w=m.bitLength();while(w>this.n);var M=w<this.n?-1:m.ucmp(this.p);return M===0?(m.words[0]=0,m.length=1):M>0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},"ireduce"),z.prototype.split=i(function(l,m){l.iushrn(this.n,0,m)},"split"),z.prototype.imulK=i(function(l){return l.imul(this.k)},"imulK");function Z(){z.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Z,"K256"),n(Z,z),Z.prototype.split=i(function(l,m){for(var w=4194303,M=Math.min(l.length,9),j=0;j<M;j++)m.words[j]=l.words[j];if(m.length=M,l.length<=9){l.words[0]=0,l.length=1;return}var S=l.words[9];for(m.words[m.length++]=S&w,j=10;j<l.length;j++){var f=l.words[j]|0;l.words[j-10]=(f&w)<<4|S>>>22,S=f}S>>>=22,l.words[j-10]=S,S===0&&l.length>10?l.length-=10:l.length-=9},"split"),Z.prototype.imulK=i(function(l){l.words[l.length]=0,l.words[l.length+1]=0,l.length+=2;for(var m=0,w=0;w<l.length;w++){var M=l.words[w]|0;m+=M*977,l.words[w]=m&67108863,m=M*64+(m/67108864|0)}return l.words[l.length-1]===0&&(l.length--,l.words[l.length-1]===0&&l.length--),l},"imulK");function V(){z.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(V,"P224"),n(V,z);function ee(){z.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(ee,"P192"),n(ee,z);function $(){z.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i($,"P25519"),n($,z),$.prototype.imulK=i(function(l){for(var m=0,w=0;w<l.length;w++){var M=(l.words[w]|0)*19+m,j=M&67108863;M>>>=26,l.words[w]=j,m=M}return m!==0&&(l.words[l.length++]=m),l},"imulK"),s._prime=i(function(l){if(P[l])return P[l];var m;if(l==="k256")m=new Z;else if(l==="p224")m=new V;else if(l==="p192")m=new ee;else if(l==="p25519")m=new $;else throw new Error("Unknown prime "+l);return P[l]=m,m},"prime");function F(g){if(typeof g=="string"){var l=s._prime(g);this.m=l.p,this.prime=l}else a(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}i(F,"Red"),F.prototype._verify1=i(function(l){a(l.negative===0,"red works only with positives"),a(l.red,"red works only with red numbers")},"_verify1"),F.prototype._verify2=i(function(l,m){a((l.negative|m.negative)===0,"red works only with positives"),a(l.red&&l.red===m.red,"red works only with red numbers")},"_verify2"),F.prototype.imod=i(function(l){return this.prime?this.prime.ireduce(l)._forceRed(this):(c(l,l.umod(this.m)._forceRed(this)),l)},"imod"),F.prototype.neg=i(function(l){return l.isZero()?l.clone():this.m.sub(l)._forceRed(this)},"neg"),F.prototype.add=i(function(l,m){this._verify2(l,m);var w=l.add(m);return w.cmp(this.m)>=0&&w.isub(this.m),w._forceRed(this)},"add"),F.prototype.iadd=i(function(l,m){this._verify2(l,m);var w=l.iadd(m);return w.cmp(this.m)>=0&&w.isub(this.m),w},"iadd"),F.prototype.sub=i(function(l,m){this._verify2(l,m);var w=l.sub(m);return w.cmpn(0)<0&&w.iadd(this.m),w._forceRed(this)},"sub"),F.prototype.isub=i(function(l,m){this._verify2(l,m);var w=l.isub(m);return w.cmpn(0)<0&&w.iadd(this.m),w},"isub"),F.prototype.shl=i(function(l,m){return this._verify1(l),this.imod(l.ushln(m))},"shl"),F.prototype.imul=i(function(l,m){return this._verify2(l,m),this.imod(l.imul(m))},"imul"),F.prototype.mul=i(function(l,m){return this._verify2(l,m),this.imod(l.mul(m))},"mul"),F.prototype.isqr=i(function(l){return this.imul(l,l.clone())},"isqr"),F.prototype.sqr=i(function(l){return this.mul(l,l)},"sqr"),F.prototype.sqrt=i(function(l){if(l.isZero())return l.clone();var m=this.m.andln(3);if(a(m%2===1),m===3){var w=this.m.add(new s(1)).iushrn(2);return this.pow(l,w)}for(var M=this.m.subn(1),j=0;!M.isZero()&&M.andln(1)===0;)j++,M.iushrn(1);a(!M.isZero());var S=new s(1).toRed(this),f=S.redNeg(),_=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,_).cmp(f)!==0;)E.redIAdd(f);for(var I=this.pow(E,M),D=this.pow(l,M.addn(1).iushrn(1)),L=this.pow(l,M),U=j;L.cmp(S)!==0;){for(var B=L,G=0;B.cmp(S)!==0;G++)B=B.redSqr();a(G<U);var H=this.pow(I,new s(1).iushln(U-G-1));D=D.redMul(H),I=H.redSqr(),L=L.redMul(I),U=G}return D},"sqrt"),F.prototype.invm=i(function(l){var m=l._invmp(this.m);return m.negative!==0?(m.negative=0,this.imod(m).redNeg()):this.imod(m)},"invm"),F.prototype.pow=i(function(l,m){if(m.isZero())return new s(1).toRed(this);if(m.cmpn(1)===0)return l.clone();var w=4,M=new Array(1<<w);M[0]=new s(1).toRed(this),M[1]=l;for(var j=2;j<M.length;j++)M[j]=this.mul(M[j-1],l);var S=M[0],f=0,_=0,E=m.bitLength()%26;for(E===0&&(E=26),j=m.length-1;j>=0;j--){for(var I=m.words[j],D=E-1;D>=0;D--){var L=I>>D&1;if(S!==M[0]&&(S=this.sqr(S)),L===0&&f===0){_=0;continue}f<<=1,f|=L,_++,!(_!==w&&(j!==0||D!==0))&&(S=this.mul(S,M[f]),_=0,f=0)}E=26}return S},"pow"),F.prototype.convertTo=i(function(l){var m=l.umod(this.m);return m===l?m.clone():m},"convertTo"),F.prototype.convertFrom=i(function(l){var m=l.clone();return m.red=null,m},"convertFrom"),s.mont=i(function(l){return new u(l)},"mont");function u(g){F.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(u,"Mont"),n(u,F),u.prototype.convertTo=i(function(l){return this.imod(l.ushln(this.shift))},"convertTo"),u.prototype.convertFrom=i(function(l){var m=this.imod(l.mul(this.rinv));return m.red=null,m},"convertFrom"),u.prototype.imul=i(function(l,m){if(l.isZero()||m.isZero())return l.words[0]=0,l.length=1,l;var w=l.imul(m),M=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=w.isub(M).iushrn(this.shift),S=j;return j.cmp(this.m)>=0?S=j.isub(this.m):j.cmpn(0)<0&&(S=j.iadd(this.m)),S._forceRed(this)},"imul"),u.prototype.mul=i(function(l,m){if(l.isZero()||m.isZero())return new s(0)._forceRed(this);var w=l.mul(m),M=w.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),j=w.isub(M).iushrn(this.shift),S=j;return j.cmp(this.m)>=0?S=j.isub(this.m):j.cmpn(0)<0&&(S=j.iadd(this.m)),S._forceRed(this)},"mul"),u.prototype.invm=i(function(l){var m=this.imod(l._invmp(this.m).mul(this.r2));return m._forceRed(this)},"invm")})(e,kD)})(ku)),ku.exports}i(H7,"requireBn");var oi={},j0={},A0={},$6;function jD(){return $6||($6=1,(function(e){var t=al(),r=Lt(),a=e;a.define=i(function(o,h){return new n(o,h)},"define");function n(s,o){this.name=s,this.body=o,this.decoders={},this.encoders={}}i(n,"Entity"),n.prototype._createNamed=i(function(o){var h;try{h=Ai.runInThisContext("(function "+this.name+`(entity) {
3
3
  this._initNamed(entity);
4
4
  })`)}catch{h=i(function(v){this._initNamed(v)},"named")}return r(h,o),h.prototype._initNamed=i(function(v){o.call(this,v)},"initnamed"),new h(this)},"createNamed"),n.prototype._getDecoder=i(function(o){return o=o||"der",this.decoders.hasOwnProperty(o)||(this.decoders[o]=this._createNamed(t.decoders[o])),this.decoders[o]},"_getDecoder"),n.prototype.decode=i(function(o,h,p){return this._getDecoder(h).decode(o,p)},"decode"),n.prototype._getEncoder=i(function(o){return o=o||"der",this.encoders.hasOwnProperty(o)||(this.encoders[o]=this._createNamed(t.encoders[o])),this.encoders[o]},"_getEncoder"),n.prototype.encode=i(function(o,h,p){return this._getEncoder(h).encode(o,p)},"encode")})(A0)),A0}i(jD,"requireApi");var N0={},I0={},G6;function AD(){if(G6)return I0;G6=1;var e=Lt();function t(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}i(t,"Reporter"),I0.Reporter=t,t.prototype.isError=i(function(n){return n instanceof r},"isError"),t.prototype.save=i(function(){var n=this._reporterState;return{obj:n.obj,pathLen:n.path.length}},"save"),t.prototype.restore=i(function(n){var s=this._reporterState;s.obj=n.obj,s.path=s.path.slice(0,n.pathLen)},"restore"),t.prototype.enterKey=i(function(n){return this._reporterState.path.push(n)},"enterKey"),t.prototype.exitKey=i(function(n){var s=this._reporterState;s.path=s.path.slice(0,n-1)},"exitKey"),t.prototype.leaveKey=i(function(n,s,o){var h=this._reporterState;this.exitKey(n),h.obj!==null&&(h.obj[s]=o)},"leaveKey"),t.prototype.path=i(function(){return this._reporterState.path.join("/")},"path"),t.prototype.enterObject=i(function(){var n=this._reporterState,s=n.obj;return n.obj={},s},"enterObject"),t.prototype.leaveObject=i(function(n){var s=this._reporterState,o=s.obj;return s.obj=n,o},"leaveObject"),t.prototype.error=i(function(n){var s,o=this._reporterState,h=n instanceof r;if(h?s=n:s=new r(o.path.map(function(p){return"["+JSON.stringify(p)+"]"}).join(""),n.message||n,n.stack),!o.options.partial)throw s;return h||o.errors.push(s),s},"error"),t.prototype.wrapResult=i(function(n){var s=this._reporterState;return s.options.partial?{result:this.isError(n)?null:n,errors:s.errors}:n},"wrapResult");function r(a,n){this.path=a,this.rethrow(n)}return i(r,"ReporterError"),e(r,Error),r.prototype.rethrow=i(function(n){if(this.message=n+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,r),!this.stack)try{throw new Error(this.message)}catch(s){this.stack=s.stack}return this},"rethrow"),I0}i(AD,"requireReporter");var Ul={},V6;function Z6(){if(V6)return Ul;V6=1;var e=Lt(),t=po().Reporter,r=Vn().Buffer;function a(s,o){if(t.call(this,o),!r.isBuffer(s)){this.error("Input not Buffer");return}this.base=s,this.offset=0,this.length=s.length}i(a,"DecoderBuffer"),e(a,t),Ul.DecoderBuffer=a,a.prototype.save=i(function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},"save"),a.prototype.restore=i(function(o){var h=new a(this.base);return h.offset=o.offset,h.length=this.offset,this.offset=o.offset,t.prototype.restore.call(this,o.reporter),h},"restore"),a.prototype.isEmpty=i(function(){return this.offset===this.length},"isEmpty"),a.prototype.readUInt8=i(function(o){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(o||"DecoderBuffer overrun")},"readUInt8"),a.prototype.skip=i(function(o,h){if(!(this.offset+o<=this.length))return this.error(h||"DecoderBuffer overrun");var p=new a(this.base);return p._reporterState=this._reporterState,p.offset=this.offset,p.length=this.offset+o,this.offset+=o,p},"skip"),a.prototype.raw=i(function(o){return this.base.slice(o?o.offset:this.offset,this.length)},"raw");function n(s,o){if(Array.isArray(s))this.length=0,this.value=s.map(function(h){return h instanceof n||(h=new n(h,o)),this.length+=h.length,h},this);else if(typeof s=="number"){if(!(0<=s&&s<=255))return o.error("non-byte EncoderBuffer value");this.value=s,this.length=1}else if(typeof s=="string")this.value=s,this.length=r.byteLength(s);else if(r.isBuffer(s))this.value=s,this.length=s.length;else return o.error("Unsupported type: "+typeof s)}return i(n,"EncoderBuffer"),Ul.EncoderBuffer=n,n.prototype.join=i(function(o,h){return o||(o=new r(this.length)),h||(h=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(p){p.join(o,h),h+=p.length}):(typeof this.value=="number"?o[h]=this.value:typeof this.value=="string"?o.write(this.value,h):r.isBuffer(this.value)&&this.value.copy(o,h),h+=this.length)),o},"join"),Ul}i(Z6,"requireBuffer");var C0,H6;function ND(){if(H6)return C0;H6=1;var e=po().Reporter,t=po().EncoderBuffer,r=po().DecoderBuffer,a=ci(),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"],s=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(n),o=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function h(v,c){var d={};this._baseState=d,d.enc=v,d.parent=c||null,d.children=null,d.tag=null,d.args=null,d.reverseArgs=null,d.choice=null,d.optional=!1,d.any=!1,d.obj=!1,d.use=null,d.useDecoder=null,d.key=null,d.default=null,d.explicit=null,d.implicit=null,d.contains=null,d.parent||(d.children=[],this._wrap())}i(h,"Node"),C0=h;var p=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return h.prototype.clone=i(function(){var c=this._baseState,d={};p.forEach(function(b){d[b]=c[b]});var y=new this.constructor(d.parent);return y._baseState=d,y},"clone"),h.prototype._wrap=i(function(){var c=this._baseState;s.forEach(function(d){this[d]=i(function(){var b=new this.constructor(this);return c.children.push(b),b[d].apply(b,arguments)},"_wrappedMethod")},this)},"wrap"),h.prototype._init=i(function(c){var d=this._baseState;a(d.parent===null),c.call(this),d.children=d.children.filter(function(y){return y._baseState.parent===this},this),a.equal(d.children.length,1,"Root node can have only one child")},"init"),h.prototype._useArgs=i(function(c){var d=this._baseState,y=c.filter(function(b){return b instanceof this.constructor},this);c=c.filter(function(b){return!(b instanceof this.constructor)},this),y.length!==0&&(a(d.children===null),d.children=y,y.forEach(function(b){b._baseState.parent=this},this)),c.length!==0&&(a(d.args===null),d.args=c,d.reverseArgs=c.map(function(b){if(typeof b!="object"||b.constructor!==Object)return b;var x={};return Object.keys(b).forEach(function(k){k==(k|0)&&(k|=0);var N=b[k];x[N]=k}),x}))},"useArgs"),o.forEach(function(v){h.prototype[v]=i(function(){var d=this._baseState;throw new Error(v+" not implemented for encoding: "+d.enc)},"_overrided")}),n.forEach(function(v){h.prototype[v]=i(function(){var d=this._baseState,y=Array.prototype.slice.call(arguments);return a(d.tag===null),d.tag=v,this._useArgs(y),this},"_tagMethod")}),h.prototype.use=i(function(c){a(c);var d=this._baseState;return a(d.use===null),d.use=c,this},"use"),h.prototype.optional=i(function(){var c=this._baseState;return c.optional=!0,this},"optional"),h.prototype.def=i(function(c){var d=this._baseState;return a(d.default===null),d.default=c,d.optional=!0,this},"def"),h.prototype.explicit=i(function(c){var d=this._baseState;return a(d.explicit===null&&d.implicit===null),d.explicit=c,this},"explicit"),h.prototype.implicit=i(function(c){var d=this._baseState;return a(d.explicit===null&&d.implicit===null),d.implicit=c,this},"implicit"),h.prototype.obj=i(function(){var c=this._baseState,d=Array.prototype.slice.call(arguments);return c.obj=!0,d.length!==0&&this._useArgs(d),this},"obj"),h.prototype.key=i(function(c){var d=this._baseState;return a(d.key===null),d.key=c,this},"key"),h.prototype.any=i(function(){var c=this._baseState;return c.any=!0,this},"any"),h.prototype.choice=i(function(c){var d=this._baseState;return a(d.choice===null),d.choice=c,this._useArgs(Object.keys(c).map(function(y){return c[y]})),this},"choice"),h.prototype.contains=i(function(c){var d=this._baseState;return a(d.use===null),d.contains=c,this},"contains"),h.prototype._decode=i(function(c,d){var y=this._baseState;if(y.parent===null)return c.wrapResult(y.children[0]._decode(c,d));var b=y.default,x=!0,k=null;if(y.key!==null&&(k=c.enterKey(y.key)),y.optional){var N=null;if(y.explicit!==null?N=y.explicit:y.implicit!==null?N=y.implicit:y.tag!==null&&(N=y.tag),N===null&&!y.any){var C=c.save();try{y.choice===null?this._decodeGeneric(y.tag,c,d):this._decodeChoice(c,d),x=!0}catch{x=!1}c.restore(C)}else if(x=this._peekTag(c,N,y.any),c.isError(x))return x}var R;if(y.obj&&x&&(R=c.enterObject()),x){if(y.explicit!==null){var O=this._decodeTag(c,y.explicit);if(c.isError(O))return O;c=O}var T=c.offset;if(y.use===null&&y.choice===null){if(y.any)var C=c.save();var P=this._decodeTag(c,y.implicit!==null?y.implicit:y.tag,y.any);if(c.isError(P))return P;y.any?b=c.raw(C):c=P}if(d&&d.track&&y.tag!==null&&d.track(c.path(),T,c.length,"tagged"),d&&d.track&&y.tag!==null&&d.track(c.path(),c.offset,c.length,"content"),y.any?b=b:y.choice===null?b=this._decodeGeneric(y.tag,c,d):b=this._decodeChoice(c,d),c.isError(b))return b;if(!y.any&&y.choice===null&&y.children!==null&&y.children.forEach(i(function(V){V._decode(c,d)},"decodeChildren")),y.contains&&(y.tag==="octstr"||y.tag==="bitstr")){var z=new r(b);b=this._getUse(y.contains,c._reporterState.obj)._decode(z,d)}}return y.obj&&x&&(b=c.leaveObject(R)),y.key!==null&&(b!==null||x===!0)?c.leaveKey(k,y.key,b):k!==null&&c.exitKey(k),b},"decode"),h.prototype._decodeGeneric=i(function(c,d,y){var b=this._baseState;return c==="seq"||c==="set"?null:c==="seqof"||c==="setof"?this._decodeList(d,c,b.args[0],y):/str$/.test(c)?this._decodeStr(d,c,y):c==="objid"&&b.args?this._decodeObjid(d,b.args[0],b.args[1],y):c==="objid"?this._decodeObjid(d,null,null,y):c==="gentime"||c==="utctime"?this._decodeTime(d,c,y):c==="null_"?this._decodeNull(d,y):c==="bool"?this._decodeBool(d,y):c==="objDesc"?this._decodeStr(d,c,y):c==="int"||c==="enum"?this._decodeInt(d,b.args&&b.args[0],y):b.use!==null?this._getUse(b.use,d._reporterState.obj)._decode(d,y):d.error("unknown tag: "+c)},"decodeGeneric"),h.prototype._getUse=i(function(c,d){var y=this._baseState;return y.useDecoder=this._use(c,d),a(y.useDecoder._baseState.parent===null),y.useDecoder=y.useDecoder._baseState.children[0],y.implicit!==y.useDecoder._baseState.implicit&&(y.useDecoder=y.useDecoder.clone(),y.useDecoder._baseState.implicit=y.implicit),y.useDecoder},"_getUse"),h.prototype._decodeChoice=i(function(c,d){var y=this._baseState,b=null,x=!1;return Object.keys(y.choice).some(function(k){var N=c.save(),C=y.choice[k];try{var R=C._decode(c,d);if(c.isError(R))return!1;b={type:k,value:R},x=!0}catch{return c.restore(N),!1}return!0},this),x?b:c.error("Choice not matched")},"decodeChoice"),h.prototype._createEncoderBuffer=i(function(c){return new t(c,this.reporter)},"createEncoderBuffer"),h.prototype._encode=i(function(c,d,y){var b=this._baseState;if(!(b.default!==null&&b.default===c)){var x=this._encodeValue(c,d,y);if(x!==void 0&&!this._skipDefault(x,d,y))return x}},"encode"),h.prototype._encodeValue=i(function(c,d,y){var b=this._baseState;if(b.parent===null)return b.children[0]._encode(c,d||new e);var C=null;if(this.reporter=d,b.optional&&c===void 0)if(b.default!==null)c=b.default;else return;var x=null,k=!1;if(b.any)C=this._createEncoderBuffer(c);else if(b.choice)C=this._encodeChoice(c,d);else if(b.contains)x=this._getUse(b.contains,y)._encode(c,d),k=!0;else if(b.children)x=b.children.map(function(T){if(T._baseState.tag==="null_")return T._encode(null,d,c);if(T._baseState.key===null)return d.error("Child should have a key");var P=d.enterKey(T._baseState.key);if(typeof c!="object")return d.error("Child expected, but input is not object");var z=T._encode(c[T._baseState.key],d,c);return d.leaveKey(P),z},this).filter(function(T){return T}),x=this._createEncoderBuffer(x);else if(b.tag==="seqof"||b.tag==="setof"){if(!(b.args&&b.args.length===1))return d.error("Too many args for : "+b.tag);if(!Array.isArray(c))return d.error("seqof/setof, but data is not Array");var N=this.clone();N._baseState.implicit=null,x=this._createEncoderBuffer(c.map(function(T){var P=this._baseState;return this._getUse(P.args[0],c)._encode(T,d)},N))}else b.use!==null?C=this._getUse(b.use,y)._encode(c,d):(x=this._encodePrimitive(b.tag,c),k=!0);var C;if(!b.any&&b.choice===null){var R=b.implicit!==null?b.implicit:b.tag,O=b.implicit===null?"universal":"context";R===null?b.use===null&&d.error("Tag could be omitted only for .use()"):b.use===null&&(C=this._encodeComposite(R,k,O,x))}return b.explicit!==null&&(C=this._encodeComposite(b.explicit,!1,"context",C)),C},"encode"),h.prototype._encodeChoice=i(function(c,d){var y=this._baseState,b=y.choice[c.type];return b||a(!1,c.type+" not found in "+JSON.stringify(Object.keys(y.choice))),b._encode(c.value,d)},"encodeChoice"),h.prototype._encodePrimitive=i(function(c,d){var y=this._baseState;if(/str$/.test(c))return this._encodeStr(d,c);if(c==="objid"&&y.args)return this._encodeObjid(d,y.reverseArgs[0],y.args[1]);if(c==="objid")return this._encodeObjid(d,null,null);if(c==="gentime"||c==="utctime")return this._encodeTime(d,c);if(c==="null_")return this._encodeNull();if(c==="int"||c==="enum")return this._encodeInt(d,y.args&&y.reverseArgs[0]);if(c==="bool")return this._encodeBool(d);if(c==="objDesc")return this._encodeStr(d,c);throw new Error("Unsupported tag: "+c)},"encodePrimitive"),h.prototype._isNumstr=i(function(c){return/^[0-9 ]*$/.test(c)},"isNumstr"),h.prototype._isPrintstr=i(function(c){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(c)},"isPrintstr"),C0}i(ND,"requireNode");var J6;function po(){return J6||(J6=1,(function(e){var t=e;t.Reporter=AD().Reporter,t.DecoderBuffer=Z6().DecoderBuffer,t.EncoderBuffer=Z6().EncoderBuffer,t.Node=ND()})(N0)),N0}i(po,"requireBase");var R0={},O0={},q6;function ID(){return q6||(q6=1,(function(e){var t=J7();e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=t._reverse(e.tagClass),e.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"},e.tagByName=t._reverse(e.tag)})(O0)),O0}i(ID,"requireDer$2");var K6;function J7(){return K6||(K6=1,(function(e){var t=e;t._reverse=i(function(a){var n={};return Object.keys(a).forEach(function(s){(s|0)==s&&(s=s|0);var o=a[s];n[o]=s}),n},"reverse"),t.der=ID()})(R0)),R0}i(J7,"requireConstants$1");var T0={},P0,X6;function q7(){if(X6)return P0;X6=1;var e=Lt(),t=al(),r=t.base,a=t.bignum,n=t.constants.der;function s(v){this.enc="der",this.name=v.name,this.entity=v,this.tree=new o,this.tree._init(v.body)}i(s,"DERDecoder"),P0=s,s.prototype.decode=i(function(c,d){return c instanceof r.DecoderBuffer||(c=new r.DecoderBuffer(c,d)),this.tree._decode(c,d)},"decode");function o(v){r.Node.call(this,"der",v)}i(o,"DERNode"),e(o,r.Node),o.prototype._peekTag=i(function(c,d,y){if(c.isEmpty())return!1;var b=c.save(),x=h(c,'Failed to peek tag: "'+d+'"');return c.isError(x)?x:(c.restore(b),x.tag===d||x.tagStr===d||x.tagStr+"of"===d||y)},"peekTag"),o.prototype._decodeTag=i(function(c,d,y){var b=h(c,'Failed to decode tag of "'+d+'"');if(c.isError(b))return b;var x=p(c,b.primitive,'Failed to get length of "'+d+'"');if(c.isError(x))return x;if(!y&&b.tag!==d&&b.tagStr!==d&&b.tagStr+"of"!==d)return c.error('Failed to match tag: "'+d+'"');if(b.primitive||x!==null)return c.skip(x,'Failed to match body of: "'+d+'"');var k=c.save(),N=this._skipUntilEnd(c,'Failed to skip indefinite length body: "'+this.tag+'"');return c.isError(N)?N:(x=c.offset-k.offset,c.restore(k),c.skip(x,'Failed to match body of: "'+d+'"'))},"decodeTag"),o.prototype._skipUntilEnd=i(function(c,d){for(;;){var y=h(c,d);if(c.isError(y))return y;var b=p(c,y.primitive,d);if(c.isError(b))return b;var x;if(y.primitive||b!==null?x=c.skip(b):x=this._skipUntilEnd(c,d),c.isError(x))return x;if(y.tagStr==="end")break}},"skipUntilEnd"),o.prototype._decodeList=i(function(c,d,y,b){for(var x=[];!c.isEmpty();){var k=this._peekTag(c,"end");if(c.isError(k))return k;var N=y.decode(c,"der",b);if(c.isError(N)&&k)break;x.push(N)}return x},"decodeList"),o.prototype._decodeStr=i(function(c,d){if(d==="bitstr"){var y=c.readUInt8();return c.isError(y)?y:{unused:y,data:c.raw()}}else if(d==="bmpstr"){var b=c.raw();if(b.length%2===1)return c.error("Decoding of string type: bmpstr length mismatch");for(var x="",k=0;k<b.length/2;k++)x+=String.fromCharCode(b.readUInt16BE(k*2));return x}else if(d==="numstr"){var N=c.raw().toString("ascii");return this._isNumstr(N)?N:c.error("Decoding of string type: numstr unsupported characters")}else{if(d==="octstr")return c.raw();if(d==="objDesc")return c.raw();if(d==="printstr"){var C=c.raw().toString("ascii");return this._isPrintstr(C)?C:c.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(d)?c.raw().toString():c.error("Decoding of string type: "+d+" unsupported")}},"decodeStr"),o.prototype._decodeObjid=i(function(c,d,y){for(var b,x=[],k=0;!c.isEmpty();){var N=c.readUInt8();k<<=7,k|=N&127,(N&128)===0&&(x.push(k),k=0)}N&128&&x.push(k);var C=x[0]/40|0,R=x[0]%40;if(y?b=x:b=[C,R].concat(x.slice(1)),d){var O=d[b.join(" ")];O===void 0&&(O=d[b.join(".")]),O!==void 0&&(b=O)}return b},"decodeObjid"),o.prototype._decodeTime=i(function(c,d){var y=c.raw().toString();if(d==="gentime")var b=y.slice(0,4)|0,x=y.slice(4,6)|0,k=y.slice(6,8)|0,N=y.slice(8,10)|0,C=y.slice(10,12)|0,R=y.slice(12,14)|0;else if(d==="utctime"){var b=y.slice(0,2)|0,x=y.slice(2,4)|0,k=y.slice(4,6)|0,N=y.slice(6,8)|0,C=y.slice(8,10)|0,R=y.slice(10,12)|0;b<70?b=2e3+b:b=1900+b}else return c.error("Decoding "+d+" time is not supported yet");return Date.UTC(b,x-1,k,N,C,R,0)},"decodeTime"),o.prototype._decodeNull=i(function(c){return null},"decodeNull"),o.prototype._decodeBool=i(function(c){var d=c.readUInt8();return c.isError(d)?d:d!==0},"decodeBool"),o.prototype._decodeInt=i(function(c,d){var y=c.raw(),b=new a(y);return d&&(b=d[b.toString(10)]||b),b},"decodeInt"),o.prototype._use=i(function(c,d){return typeof c=="function"&&(c=c(d)),c._getDecoder("der").tree},"use");function h(v,c){var d=v.readUInt8(c);if(v.isError(d))return d;var y=n.tagClass[d>>6],b=(d&32)===0;if((d&31)===31){var x=d;for(d=0;(x&128)===128;){if(x=v.readUInt8(c),v.isError(x))return x;d<<=7,d|=x&127}}else d&=31;var k=n.tag[d];return{cls:y,primitive:b,tag:d,tagStr:k}}i(h,"derDecodeTag");function p(v,c,d){var y=v.readUInt8(d);if(v.isError(y))return y;if(!c&&y===128)return null;if((y&128)===0)return y;var b=y&127;if(b>4)return v.error("length octect is too long");y=0;for(var x=0;x<b;x++){y<<=8;var k=v.readUInt8(d);if(v.isError(k))return k;y|=k}return y}return i(p,"derDecodeLen"),P0}i(q7,"requireDer$1");var D0,W6;function CD(){if(W6)return D0;W6=1;var e=Lt(),t=Vn().Buffer,r=q7();function a(n){r.call(this,n),this.enc="pem"}return i(a,"PEMDecoder"),e(a,r),D0=a,a.prototype.decode=i(function(s,o){for(var h=s.toString().split(/[\r\n]+/g),p=o.label.toUpperCase(),v=/^-----(BEGIN|END) ([^-]+)-----$/,c=-1,d=-1,y=0;y<h.length;y++){var b=h[y].match(v);if(b!==null&&b[2]===p)if(c===-1){if(b[1]!=="BEGIN")break;c=y}else{if(b[1]!=="END")break;d=y;break}}if(c===-1||d===-1)throw new Error("PEM section not found for: "+p);var x=h.slice(c+1,d).join("");x.replace(/[^a-z0-9\+\/=]+/gi,"");var k=new t(x,"base64");return r.prototype.decode.call(this,k,o)},"decode"),D0}i(CD,"requirePem$1");var Q6;function RD(){return Q6||(Q6=1,(function(e){var t=e;t.der=q7(),t.pem=CD()})(T0)),T0}i(RD,"requireDecoders");var L0={},B0,Y6;function K7(){if(Y6)return B0;Y6=1;var e=Lt(),t=Vn().Buffer,r=al(),a=r.base,n=r.constants.der;function s(v){this.enc="der",this.name=v.name,this.entity=v,this.tree=new o,this.tree._init(v.body)}i(s,"DEREncoder"),B0=s,s.prototype.encode=i(function(c,d){return this.tree._encode(c,d).join()},"encode");function o(v){a.Node.call(this,"der",v)}i(o,"DERNode"),e(o,a.Node),o.prototype._encodeComposite=i(function(c,d,y,b){var x=p(c,d,y,this.reporter);if(b.length<128){var C=new t(2);return C[0]=x,C[1]=b.length,this._createEncoderBuffer([C,b])}for(var k=1,N=b.length;N>=256;N>>=8)k++;var C=new t(2+k);C[0]=x,C[1]=128|k;for(var N=1+k,R=b.length;R>0;N--,R>>=8)C[N]=R&255;return this._createEncoderBuffer([C,b])},"encodeComposite"),o.prototype._encodeStr=i(function(c,d){if(d==="bitstr")return this._createEncoderBuffer([c.unused|0,c.data]);if(d==="bmpstr"){for(var y=new t(c.length*2),b=0;b<c.length;b++)y.writeUInt16BE(c.charCodeAt(b),b*2);return this._createEncoderBuffer(y)}else return d==="numstr"?this._isNumstr(c)?this._createEncoderBuffer(c):this.reporter.error("Encoding of string type: numstr supports only digits and space"):d==="printstr"?this._isPrintstr(c)?this._createEncoderBuffer(c):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(d)?this._createEncoderBuffer(c):d==="objDesc"?this._createEncoderBuffer(c):this.reporter.error("Encoding of string type: "+d+" unsupported")},"encodeStr"),o.prototype._encodeObjid=i(function(c,d,y){if(typeof c=="string"){if(!d)return this.reporter.error("string objid given, but no values map found");if(!d.hasOwnProperty(c))return this.reporter.error("objid not found in values map");c=d[c].split(/[\s\.]+/g);for(var b=0;b<c.length;b++)c[b]|=0}else if(Array.isArray(c)){c=c.slice();for(var b=0;b<c.length;b++)c[b]|=0}if(!Array.isArray(c))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(c));if(!y){if(c[1]>=40)return this.reporter.error("Second objid identifier OOB");c.splice(0,2,c[0]*40+c[1])}for(var x=0,b=0;b<c.length;b++){var k=c[b];for(x++;k>=128;k>>=7)x++}for(var N=new t(x),C=N.length-1,b=c.length-1;b>=0;b--){var k=c[b];for(N[C--]=k&127;(k>>=7)>0;)N[C--]=128|k&127}return this._createEncoderBuffer(N)},"encodeObjid");function h(v){return v<10?"0"+v:v}i(h,"two"),o.prototype._encodeTime=i(function(c,d){var y,b=new Date(c);return d==="gentime"?y=[h(b.getFullYear()),h(b.getUTCMonth()+1),h(b.getUTCDate()),h(b.getUTCHours()),h(b.getUTCMinutes()),h(b.getUTCSeconds()),"Z"].join(""):d==="utctime"?y=[h(b.getFullYear()%100),h(b.getUTCMonth()+1),h(b.getUTCDate()),h(b.getUTCHours()),h(b.getUTCMinutes()),h(b.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+d+" time is not supported yet"),this._encodeStr(y,"octstr")},"encodeTime"),o.prototype._encodeNull=i(function(){return this._createEncoderBuffer("")},"encodeNull"),o.prototype._encodeInt=i(function(c,d){if(typeof c=="string"){if(!d)return this.reporter.error("String int or enum given, but no values map");if(!d.hasOwnProperty(c))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(c));c=d[c]}if(typeof c!="number"&&!t.isBuffer(c)){var y=c.toArray();!c.sign&&y[0]&128&&y.unshift(0),c=new t(y)}if(t.isBuffer(c)){var b=c.length;c.length===0&&b++;var k=new t(b);return c.copy(k),c.length===0&&(k[0]=0),this._createEncoderBuffer(k)}if(c<128)return this._createEncoderBuffer(c);if(c<256)return this._createEncoderBuffer([0,c]);for(var b=1,x=c;x>=256;x>>=8)b++;for(var k=new Array(b),x=k.length-1;x>=0;x--)k[x]=c&255,c>>=8;return k[0]&128&&k.unshift(0),this._createEncoderBuffer(new t(k))},"encodeInt"),o.prototype._encodeBool=i(function(c){return this._createEncoderBuffer(c?255:0)},"encodeBool"),o.prototype._use=i(function(c,d){return typeof c=="function"&&(c=c(d)),c._getEncoder("der").tree},"use"),o.prototype._skipDefault=i(function(c,d,y){var b=this._baseState,x;if(b.default===null)return!1;var k=c.join();if(b.defaultBuffer===void 0&&(b.defaultBuffer=this._encodeValue(b.default,d,y).join()),k.length!==b.defaultBuffer.length)return!1;for(x=0;x<k.length;x++)if(k[x]!==b.defaultBuffer[x])return!1;return!0},"skipDefault");function p(v,c,d,y){var b;if(v==="seqof"?v="seq":v==="setof"&&(v="set"),n.tagByName.hasOwnProperty(v))b=n.tagByName[v];else if(typeof v=="number"&&(v|0)===v)b=v;else return y.error("Unknown tag: "+v);return b>=31?y.error("Multi-octet tag encoding unsupported"):(c||(b|=32),b|=n.tagClassByName[d||"universal"]<<6,b)}return i(p,"encodeTag"),B0}i(K7,"requireDer");var z0,ex;function OD(){if(ex)return z0;ex=1;var e=Lt(),t=K7();function r(a){t.call(this,a),this.enc="pem"}return i(r,"PEMEncoder"),e(r,t),z0=r,r.prototype.encode=i(function(n,s){for(var o=t.prototype.encode.call(this,n),h=o.toString("base64"),p=["-----BEGIN "+s.label+"-----"],v=0;v<h.length;v+=64)p.push(h.slice(v,v+64));return p.push("-----END "+s.label+"-----"),p.join(`
@@ -77,7 +77,7 @@ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_S
77
77
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of this.seen.entries()){let d=c[1];if(t===c[0]){o(c);continue}if(a.external){let y=a.external.registry.get(c[0])?.id;if(t!==c[0]&&y){o(c);continue}}if(this.metadataRegistry.get(c[0])?.id){o(c);continue}if(d.cycle){o(c);continue}if(d.count>1&&a.reused==="ref"){o(c);continue}}let h=i((c,d)=>{let y=this.seen.get(c),b=y.def??y.schema,x={...b};if(y.ref===null)return;let k=y.ref;if(y.ref=null,k){h(k,d);let N=this.seen.get(k).schema;N.$ref&&(d.target==="draft-7"||d.target==="draft-4"||d.target==="openapi-3.0")?(b.allOf=b.allOf??[],b.allOf.push(N)):(Object.assign(b,N),Object.assign(b,x))}y.isParent||this.override({zodSchema:c,jsonSchema:b,path:y.path??[]})},"O");for(let c of[...this.seen.entries()].reverse())h(c[0],{target:this.target});let p={};if(this.target==="draft-2020-12"?p.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?p.$schema="http://json-schema.org/draft-07/schema#":this.target==="draft-4"?p.$schema="http://json-schema.org/draft-04/schema#":this.target==="openapi-3.0"||console.warn(`Invalid target: ${this.target}`),a.external?.uri){let c=a.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");p.$id=a.external.uri(c)}Object.assign(p,n.def);let v=a.external?.defs??{};for(let c of this.seen.entries()){let d=c[1];d.def&&d.defId&&(v[d.defId]=d.def)}a.external||Object.keys(v).length>0&&(this.target==="draft-2020-12"?p.$defs=v:p.definitions=v);try{return JSON.parse(JSON.stringify(p))}catch{throw Error("Error converting schema to JSON.")}}}function Bj(e,t){if(e instanceof w1){let a=new Ig(t),n={};for(let h of e._idmap.entries()){let[p,v]=h;a.process(v)}let s={},o={registry:e,uri:t?.uri,defs:n};for(let h of e._idmap.entries()){let[p,v]=h;s[p]=a.emit(v,{...t,external:o})}if(Object.keys(n).length>0){let h=a.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[h]:n}}return{schemas:s}}let r=new Ig(t);return r.process(e),r.emit(e,t)}i(Bj,"Xv");function br(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let a=e._zod.def;switch(a.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return br(a.element,r);case"object":{for(let n in a.shape)if(br(a.shape[n],r))return!0;return!1}case"union":{for(let n of a.options)if(br(n,r))return!0;return!1}case"intersection":return br(a.left,r)||br(a.right,r);case"tuple":{for(let n of a.items)if(br(n,r))return!0;return!!(a.rest&&br(a.rest,r))}case"record":return br(a.keyType,r)||br(a.valueType,r);case"map":return br(a.keyType,r)||br(a.valueType,r);case"set":return br(a.valueType,r);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return br(a.innerType,r);case"lazy":return br(a.getter(),r);case"default":return br(a.innerType,r);case"prefault":return br(a.innerType,r);case"custom":return!1;case"transform":return!0;case"pipe":return br(a.in,r)||br(a.out,r);case"success":return!1;case"catch":return!1;case"function":return!1}throw Error(`Unknown schema type: ${a.type}`)}i(br,"Kq");var IV={},zj={};$r(zj,{time:i(()=>$j,"time"),duration:i(()=>Gj,"duration"),datetime:i(()=>Uj,"datetime"),date:i(()=>Fj,"date"),ZodISOTime:i(()=>rb,"ZodISOTime"),ZodISODuration:i(()=>ib,"ZodISODuration"),ZodISODateTime:i(()=>eb,"ZodISODateTime"),ZodISODate:i(()=>tb,"ZodISODate")});var eb=Ve("ZodISODateTime",(e,t)=>{ZE.init(e,t),nr.init(e,t)});function Uj(e){return Yk(eb,e)}i(Uj,"fv");var tb=Ve("ZodISODate",(e,t)=>{HE.init(e,t),nr.init(e,t)});function Fj(e){return ej(tb,e)}i(Fj,"kv");var rb=Ve("ZodISOTime",(e,t)=>{JE.init(e,t),nr.init(e,t)});function $j(e){return tj(rb,e)}i($j,"Av");var ib=Ve("ZodISODuration",(e,t)=>{qE.init(e,t),nr.init(e,t)});function Gj(e){return rj(ib,e)}i(Gj,"Gv");var Vj=i((e,t)=>{Qv.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:i(r=>e1(e,r),"value")},flatten:{value:i(r=>Yv(e,r),"value")},addIssue:{value:i(r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Qu,2)},"value")},addIssues:{value:i(r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Qu,2)},"value")},isEmpty:{get(){return e.issues.length===0}}})},"qf"),CV=Ve("ZodError",Vj),ii=Ve("ZodError",Vj,{Parent:Error}),Zj=cl(ii),Hj=dl(ii),Jj=hl(ii),qj=pl(ii),Kj=t1(ii),Xj=r1(ii),Wj=i1(ii),Qj=n1(ii),Yj=a1(ii),eA=s1(ii),tA=o1(ii),rA=l1(ii),Ot=Ve("ZodType",(e,t)=>(kt.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Kt.mergeDefs(t,{checks:[...t.checks??[],...r.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]})),e.clone=(r,a)=>hi(e,r,a),e.brand=()=>e,e.register=(r,a)=>(r.add(e,a),e),e.parse=(r,a)=>Zj(e,r,a,{callee:e.parse}),e.safeParse=(r,a)=>Jj(e,r,a),e.parseAsync=async(r,a)=>Hj(e,r,a,{callee:e.parseAsync}),e.safeParseAsync=async(r,a)=>qj(e,r,a),e.spa=e.safeParseAsync,e.encode=(r,a)=>Kj(e,r,a),e.decode=(r,a)=>Xj(e,r,a),e.encodeAsync=async(r,a)=>Wj(e,r,a),e.decodeAsync=async(r,a)=>Qj(e,r,a),e.safeEncode=(r,a)=>Yj(e,r,a),e.safeDecode=(r,a)=>eA(e,r,a),e.safeEncodeAsync=async(r,a)=>tA(e,r,a),e.safeDecodeAsync=async(r,a)=>rA(e,r,a),e.refine=(r,a)=>e.check($A(r,a)),e.superRefine=r=>e.check(GA(r)),e.overwrite=r=>e.check(Da(r)),e.optional=()=>af(e),e.nullable=()=>sf(e),e.nullish=()=>af(sf(e)),e.nonoptional=r=>IA(e,r),e.array=()=>pc(e),e.or=r=>Eb([e,r]),e.and=r=>gA(e,r),e.transform=r=>of(e,Ab(r)),e.default=r=>jA(e,r),e.prefault=r=>NA(e,r),e.catch=r=>OA(e,r),e.pipe=r=>of(e,r),e.readonly=()=>DA(e),e.describe=r=>{let a=e.clone();return ha.add(a,{description:r}),a},Object.defineProperty(e,"description",{get(){return ha.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return ha.get(e);let a=e.clone();return ha.add(a,r[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),nb=Ve("_ZodString",(e,t)=>{bl.init(e,t),Ot.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...a)=>e.check(G1(...a)),e.includes=(...a)=>e.check(H1(...a)),e.startsWith=(...a)=>e.check(J1(...a)),e.endsWith=(...a)=>e.check(q1(...a)),e.min=(...a)=>e.check(hs(...a)),e.max=(...a)=>e.check(oc(...a)),e.length=(...a)=>e.check(lc(...a)),e.nonempty=(...a)=>e.check(hs(1,...a)),e.lowercase=a=>e.check(V1(a)),e.uppercase=a=>e.check(Z1(a)),e.trim=()=>e.check(W1()),e.normalize=(...a)=>e.check(X1(...a)),e.toLowerCase=()=>e.check(Q1()),e.toUpperCase=()=>e.check(Y1())}),uc=Ve("ZodString",(e,t)=>{bl.init(e,t),nb.init(e,t),e.email=r=>e.check(_1(ab,r)),e.url=r=>e.check(ac(fc,r)),e.jwt=r=>e.check(F1(wb,r)),e.emoji=r=>e.check(j1(sb,r)),e.guid=r=>e.check(rf(nf,r)),e.uuid=r=>e.check(S1(wn,r)),e.uuidv4=r=>e.check(M1(wn,r)),e.uuidv6=r=>e.check(E1(wn,r)),e.uuidv7=r=>e.check(k1(wn,r)),e.nanoid=r=>e.check(A1(ob,r)),e.guid=r=>e.check(rf(nf,r)),e.cuid=r=>e.check(N1(lb,r)),e.cuid2=r=>e.check(I1(ub,r)),e.ulid=r=>e.check(C1(fb,r)),e.base64=r=>e.check(B1(vb,r)),e.base64url=r=>e.check(z1(bb,r)),e.xid=r=>e.check(R1(cb,r)),e.ksuid=r=>e.check(O1(db,r)),e.ipv4=r=>e.check(T1(hb,r)),e.ipv6=r=>e.check(P1(pb,r)),e.cidrv4=r=>e.check(D1(mb,r)),e.cidrv6=r=>e.check(L1(gb,r)),e.e164=r=>e.check(U1(yb,r)),e.datetime=r=>e.check(Uj(r)),e.date=r=>e.check(Fj(r)),e.time=r=>e.check($j(r)),e.duration=r=>e.check(Gj(r))});function Cg(e){return Xk(uc,e)}i(Cg,"bv");var nr=Ve("ZodStringFormat",(e,t)=>{ir.init(e,t),nb.init(e,t)}),ab=Ve("ZodEmail",(e,t)=>{DE.init(e,t),nr.init(e,t)});function RV(e){return _1(ab,e)}i(RV,"sD");var nf=Ve("ZodGUID",(e,t)=>{TE.init(e,t),nr.init(e,t)});function OV(e){return rf(nf,e)}i(OV,"$g");var wn=Ve("ZodUUID",(e,t)=>{PE.init(e,t),nr.init(e,t)});function TV(e){return S1(wn,e)}i(TV,"qg");function PV(e){return M1(wn,e)}i(PV,"Kg");function DV(e){return E1(wn,e)}i(DV,"_g");function LV(e){return k1(wn,e)}i(LV,"Pg");var fc=Ve("ZodURL",(e,t)=>{LE.init(e,t),nr.init(e,t)});function BV(e){return ac(fc,e)}i(BV,"Og");function zV(e){return ac(fc,{protocol:/^https?$/,hostname:Pa.domain,...Kt.normalizeParams(e)})}i(zV,"jg");var sb=Ve("ZodEmoji",(e,t)=>{BE.init(e,t),nr.init(e,t)});function UV(e){return j1(sb,e)}i(UV,"Yg");var ob=Ve("ZodNanoID",(e,t)=>{zE.init(e,t),nr.init(e,t)});function FV(e){return A1(ob,e)}i(FV,"vg");var lb=Ve("ZodCUID",(e,t)=>{UE.init(e,t),nr.init(e,t)});function $V(e){return N1(lb,e)}i($V,"zg");var ub=Ve("ZodCUID2",(e,t)=>{FE.init(e,t),nr.init(e,t)});function GV(e){return I1(ub,e)}i(GV,"Wg");var fb=Ve("ZodULID",(e,t)=>{$E.init(e,t),nr.init(e,t)});function VV(e){return C1(fb,e)}i(VV,"Hg");var cb=Ve("ZodXID",(e,t)=>{GE.init(e,t),nr.init(e,t)});function ZV(e){return R1(cb,e)}i(ZV,"Jg");var db=Ve("ZodKSUID",(e,t)=>{VE.init(e,t),nr.init(e,t)});function HV(e){return O1(db,e)}i(HV,"Tg");var hb=Ve("ZodIPv4",(e,t)=>{KE.init(e,t),nr.init(e,t)});function JV(e){return T1(hb,e)}i(JV,"wg");var pb=Ve("ZodIPv6",(e,t)=>{XE.init(e,t),nr.init(e,t)});function qV(e){return P1(pb,e)}i(qV,"Zg");var mb=Ve("ZodCIDRv4",(e,t)=>{WE.init(e,t),nr.init(e,t)});function KV(e){return D1(mb,e)}i(KV,"Xg");var gb=Ve("ZodCIDRv6",(e,t)=>{QE.init(e,t),nr.init(e,t)});function XV(e){return L1(gb,e)}i(XV,"fg");var vb=Ve("ZodBase64",(e,t)=>{YE.init(e,t),nr.init(e,t)});function WV(e){return B1(vb,e)}i(WV,"kg");var bb=Ve("ZodBase64URL",(e,t)=>{tk.init(e,t),nr.init(e,t)});function QV(e){return z1(bb,e)}i(QV,"Ag");var yb=Ve("ZodE164",(e,t)=>{rk.init(e,t),nr.init(e,t)});function YV(e){return U1(yb,e)}i(YV,"Gg");var wb=Ve("ZodJWT",(e,t)=>{nk.init(e,t),nr.init(e,t)});function eZ(e){return F1(wb,e)}i(eZ,"Vg");var wl=Ve("ZodCustomStringFormat",(e,t)=>{ak.init(e,t),nr.init(e,t)});function tZ(e,t,r={}){return yl(wl,e,t,r)}i(tZ,"Sg");function rZ(e){return yl(wl,"hostname",Pa.hostname,e)}i(rZ,"Mg");function iZ(e){return yl(wl,"hex",Pa.hex,e)}i(iZ,"Ng");function nZ(e,t){let r=t?.enc??"hex",a=`${e}_${r}`,n=Pa[a];if(!n)throw Error(`Unrecognized hash format: ${a}`);return yl(wl,a,n,t)}i(nZ,"Cg");var cc=Ve("ZodNumber",(e,t)=>{h1.init(e,t),Ot.init(e,t),e.gt=(a,n)=>e.check(Ra(a,n)),e.gte=(a,n)=>e.check(Xr(a,n)),e.min=(a,n)=>e.check(Xr(a,n)),e.lt=(a,n)=>e.check(Ca(a,n)),e.lte=(a,n)=>e.check(ki(a,n)),e.max=(a,n)=>e.check(ki(a,n)),e.int=a=>e.check(Rg(a)),e.safe=a=>e.check(Rg(a)),e.positive=a=>e.check(Ra(0,a)),e.nonnegative=a=>e.check(Xr(0,a)),e.negative=a=>e.check(Ca(0,a)),e.nonpositive=a=>e.check(ki(0,a)),e.multipleOf=(a,n)=>e.check(Fo(a,n)),e.step=(a,n)=>e.check(Fo(a,n)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iA(e){return ij(cc,e)}i(iA,"Kf");var Ss=Ve("ZodNumberFormat",(e,t)=>{sk.init(e,t),cc.init(e,t)});function Rg(e){return aj(Ss,e)}i(Rg,"uv");function aZ(e){return sj(Ss,e)}i(aZ,"Eg");function sZ(e){return oj(Ss,e)}i(sZ,"hg");function oZ(e){return lj(Ss,e)}i(oZ,"Rg");function lZ(e){return uj(Ss,e)}i(lZ,"Ig");var dc=Ve("ZodBoolean",(e,t)=>{p1.init(e,t),Ot.init(e,t)});function nA(e){return fj(dc,e)}i(nA,"_f");var hc=Ve("ZodBigInt",(e,t)=>{m1.init(e,t),Ot.init(e,t),e.gte=(a,n)=>e.check(Xr(a,n)),e.min=(a,n)=>e.check(Xr(a,n)),e.gt=(a,n)=>e.check(Ra(a,n)),e.gte=(a,n)=>e.check(Xr(a,n)),e.min=(a,n)=>e.check(Xr(a,n)),e.lt=(a,n)=>e.check(Ca(a,n)),e.lte=(a,n)=>e.check(ki(a,n)),e.max=(a,n)=>e.check(ki(a,n)),e.positive=a=>e.check(Ra(BigInt(0),a)),e.negative=a=>e.check(Ca(BigInt(0),a)),e.nonpositive=a=>e.check(ki(BigInt(0),a)),e.nonnegative=a=>e.check(Xr(BigInt(0),a)),e.multipleOf=(a,n)=>e.check(Fo(a,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function uZ(e){return dj(hc,e)}i(uZ,"Dg");var xb=Ve("ZodBigIntFormat",(e,t)=>{ok.init(e,t),hc.init(e,t)});function fZ(e){return pj(xb,e)}i(fZ,"gg");function cZ(e){return mj(xb,e)}i(cZ,"Lg");var aA=Ve("ZodSymbol",(e,t)=>{lk.init(e,t),Ot.init(e,t)});function dZ(e){return gj(aA,e)}i(dZ,"bg");var sA=Ve("ZodUndefined",(e,t)=>{uk.init(e,t),Ot.init(e,t)});function hZ(e){return vj(sA,e)}i(hZ,"ug");var oA=Ve("ZodNull",(e,t)=>{fk.init(e,t),Ot.init(e,t)});function lA(e){return bj(oA,e)}i(lA,"Yf");var uA=Ve("ZodAny",(e,t)=>{ck.init(e,t),Ot.init(e,t)});function pZ(){return yj(uA)}i(pZ,"yg");var fA=Ve("ZodUnknown",(e,t)=>{dk.init(e,t),Ot.init(e,t)});function ps(){return wj(fA)}i(ps,"H4");var cA=Ve("ZodNever",(e,t)=>{hk.init(e,t),Ot.init(e,t)});function _b(e){return xj(cA,e)}i(_b,"sv");var dA=Ve("ZodVoid",(e,t)=>{pk.init(e,t),Ot.init(e,t)});function mZ(e){return _j(dA,e)}i(mZ,"pg");var Sb=Ve("ZodDate",(e,t)=>{mk.init(e,t),Ot.init(e,t),e.min=(a,n)=>e.check(Xr(a,n)),e.max=(a,n)=>e.check(ki(a,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function gZ(e){return Sj(Sb,e)}i(gZ,"xg");var hA=Ve("ZodArray",(e,t)=>{gk.init(e,t),Ot.init(e,t),e.element=t.element,e.min=(r,a)=>e.check(hs(r,a)),e.nonempty=r=>e.check(hs(1,r)),e.max=(r,a)=>e.check(oc(r,a)),e.length=(r,a)=>e.check(lc(r,a)),e.unwrap=()=>e.element});function pc(e,t){return Cj(hA,e,t)}i(pc,"Q9");function vZ(e){let t=e._zod.def.shape;return jb(Object.keys(t))}i(vZ,"cg");var mc=Ve("ZodObject",(e,t)=>{wk.init(e,t),Ot.init(e,t),Kt.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>jb(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ps()}),e.loose=()=>e.clone({...e._zod.def,catchall:ps()}),e.strict=()=>e.clone({...e._zod.def,catchall:_b()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>Kt.extend(e,r),e.safeExtend=r=>Kt.safeExtend(e,r),e.merge=r=>Kt.merge(e,r),e.pick=r=>Kt.pick(e,r),e.omit=r=>Kt.omit(e,r),e.partial=(...r)=>Kt.partial(Nb,e,r[0]),e.required=(...r)=>Kt.required(Ib,e,r[0])});function bZ(e,t){let r={type:"object",shape:e??{},...Kt.normalizeParams(t)};return new mc(r)}i(bZ,"mg");function yZ(e,t){return new mc({type:"object",shape:e,catchall:_b(),...Kt.normalizeParams(t)})}i(yZ,"dg");function wZ(e,t){return new mc({type:"object",shape:e,catchall:ps(),...Kt.normalizeParams(t)})}i(wZ,"lg");var Mb=Ve("ZodUnion",(e,t)=>{g1.init(e,t),Ot.init(e,t),e.options=t.options});function Eb(e,t){return new Mb({type:"union",options:e,...Kt.normalizeParams(t)})}i(Eb,"qz");var pA=Ve("ZodDiscriminatedUnion",(e,t)=>{Mb.init(e,t),xk.init(e,t)});function xZ(e,t,r){return new pA({type:"union",options:t,discriminator:e,...Kt.normalizeParams(r)})}i(xZ,"og");var mA=Ve("ZodIntersection",(e,t)=>{_k.init(e,t),Ot.init(e,t)});function gA(e,t){return new mA({type:"intersection",left:e,right:t})}i(gA,"Zf");var vA=Ve("ZodTuple",(e,t)=>{v1.init(e,t),Ot.init(e,t),e.rest=r=>e.clone({...e._zod.def,rest:r})});function bA(e,t,r){let a=t instanceof kt,n=a?r:t;return new vA({type:"tuple",items:e,rest:a?t:null,...Kt.normalizeParams(n)})}i(bA,"ff");var kb=Ve("ZodRecord",(e,t)=>{Sk.init(e,t),Ot.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function yA(e,t,r){return new kb({type:"record",keyType:e,valueType:t,...Kt.normalizeParams(r)})}i(yA,"kf");function _Z(e,t,r){let a=hi(e);return a._zod.values=void 0,new kb({type:"record",keyType:a,valueType:t,...Kt.normalizeParams(r)})}i(_Z,"rg");var wA=Ve("ZodMap",(e,t)=>{Mk.init(e,t),Ot.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function SZ(e,t,r){return new wA({type:"map",keyType:e,valueType:t,...Kt.normalizeParams(r)})}i(SZ,"ng");var xA=Ve("ZodSet",(e,t)=>{Ek.init(e,t),Ot.init(e,t),e.min=(...r)=>e.check($o(...r)),e.nonempty=r=>e.check($o(1,r)),e.max=(...r)=>e.check(sc(...r)),e.size=(...r)=>e.check($1(...r))});function MZ(e,t){return new xA({type:"set",valueType:e,...Kt.normalizeParams(t)})}i(MZ,"ig");var Go=Ve("ZodEnum",(e,t)=>{kk.init(e,t),Ot.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(a,n)=>{let s={};for(let o of a)if(r.has(o))s[o]=t.entries[o];else throw Error(`Key ${o} not found in enum`);return new Go({...t,checks:[],...Kt.normalizeParams(n),entries:s})},e.exclude=(a,n)=>{let s={...t.entries};for(let o of a)if(r.has(o))delete s[o];else throw Error(`Key ${o} not found in enum`);return new Go({...t,checks:[],...Kt.normalizeParams(n),entries:s})}});function jb(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new Go({type:"enum",entries:r,...Kt.normalizeParams(t)})}i(jb,"_z");function EZ(e,t){return new Go({type:"enum",entries:e,...Kt.normalizeParams(t)})}i(EZ,"tg");var _A=Ve("ZodLiteral",(e,t)=>{jk.init(e,t),Ot.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function kZ(e,t){return new _A({type:"literal",values:Array.isArray(e)?e:[e],...Kt.normalizeParams(t)})}i(kZ,"Bg");var SA=Ve("ZodFile",(e,t)=>{Ak.init(e,t),Ot.init(e,t),e.min=(r,a)=>e.check($o(r,a)),e.max=(r,a)=>e.check(sc(r,a)),e.mime=(r,a)=>e.check(K1(Array.isArray(r)?r:[r],a))});function jZ(e){return Rj(SA,e)}i(jZ,"Ug");var MA=Ve("ZodTransform",(e,t)=>{Nk.init(e,t),Ot.init(e,t),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new tc(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(Kt.issue(s,r.value,t));else{let o=s;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),r.issues.push(Kt.issue(o))}};let n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Ab(e){return new MA({type:"transform",transform:e})}i(Ab,"Pz");var Nb=Ve("ZodOptional",(e,t)=>{Ik.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function af(e){return new Nb({type:"optional",innerType:e})}i(af,"t9");var EA=Ve("ZodNullable",(e,t)=>{Ck.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function sf(e){return new EA({type:"nullable",innerType:e})}i(sf,"B9");function AZ(e){return af(sf(e))}i(AZ,"Fg");var kA=Ve("ZodDefault",(e,t)=>{Rk.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jA(e,t){return new kA({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Kt.shallowClone(t)}})}i(jA,"Ef");var AA=Ve("ZodPrefault",(e,t)=>{Ok.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function NA(e,t){return new AA({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Kt.shallowClone(t)}})}i(NA,"Rf");var Ib=Ve("ZodNonOptional",(e,t)=>{Tk.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function IA(e,t){return new Ib({type:"nonoptional",innerType:e,...Kt.normalizeParams(t)})}i(IA,"If");var CA=Ve("ZodSuccess",(e,t)=>{Pk.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function NZ(e){return new CA({type:"success",innerType:e})}i(NZ,"ag");var RA=Ve("ZodCatch",(e,t)=>{Dk.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function OA(e,t){return new RA({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}i(OA,"Lf");var TA=Ve("ZodNaN",(e,t)=>{Lk.init(e,t),Ot.init(e,t)});function IZ(e){return Ej(TA,e)}i(IZ,"Qg");var Cb=Ve("ZodPipe",(e,t)=>{Bk.init(e,t),Ot.init(e,t),e.in=t.in,e.out=t.out});function of(e,t){return new Cb({type:"pipe",in:e,out:t})}i(of,"U9");var Rb=Ve("ZodCodec",(e,t)=>{Cb.init(e,t),b1.init(e,t)});function CZ(e,t,r){return new Rb({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}i(CZ,"eg");var PA=Ve("ZodReadonly",(e,t)=>{zk.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function DA(e){return new PA({type:"readonly",innerType:e})}i(DA,"yf");var LA=Ve("ZodTemplateLiteral",(e,t)=>{Uk.init(e,t),Ot.init(e,t)});function RZ(e,t){return new LA({type:"template_literal",parts:e,...Kt.normalizeParams(t)})}i(RZ,"sg");var BA=Ve("ZodLazy",(e,t)=>{Gk.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.getter()});function zA(e){return new BA({type:"lazy",getter:e})}i(zA,"cf");var UA=Ve("ZodPromise",(e,t)=>{$k.init(e,t),Ot.init(e,t),e.unwrap=()=>e._zod.def.innerType});function OZ(e){return new UA({type:"promise",innerType:e})}i(OZ,"$L");var FA=Ve("ZodFunction",(e,t)=>{Fk.init(e,t),Ot.init(e,t)});function Q4(e){return new FA({type:"function",input:Array.isArray(e?.input)?bA(e?.input):e?.input??pc(ps()),output:e?.output??ps()})}i(Q4,"qL");var gc=Ve("ZodCustom",(e,t)=>{Vk.init(e,t),Ot.init(e,t)});function TZ(e){let t=new ur({check:"custom"});return t._zod.check=e,t}i(TZ,"KL");function PZ(e,t){return Oj(gc,e??(()=>!0),t)}i(PZ,"_L");function $A(e,t={}){return Tj(gc,e,t)}i($A,"lf");function GA(e){return Pj(e)}i(GA,"of");function DZ(e,t={error:`Input not instance of ${e.name}`}){let r=new gc({type:"custom",check:"custom",fn:i(a=>a instanceof e,"fn"),abort:!0,...Kt.normalizeParams(t)});return r._zod.bag.Class=e,r}i(DZ,"PL");var LZ=i((...e)=>Lj({Codec:Rb,Boolean:dc,String:uc},...e),"OL");function BZ(e){let t=zA(()=>Eb([Cg(e),iA(),nA(),lA(),pc(t),yA(Cg(),t)]));return t}i(BZ,"jL");function zZ(e,t){return of(Ab(e),t)}i(zZ,"YL");var UZ={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function FZ(e){Tr({customError:e})}i(FZ,"zL");function $Z(){return Tr().customError}i($Z,"WL");var Og;Og||(Og={});var VA={};$r(VA,{string:i(()=>GZ,"string"),number:i(()=>VZ,"number"),date:i(()=>JZ,"date"),boolean:i(()=>ZZ,"boolean"),bigint:i(()=>HZ,"bigint")});function GZ(e){return Wk(uc,e)}i(GZ,"HL");function VZ(e){return nj(cc,e)}i(VZ,"JL");function ZZ(e){return cj(dc,e)}i(ZZ,"TL");function HZ(e){return hj(hc,e)}i(HZ,"wL");function JZ(e){return Mj(Sb,e)}i(JZ,"ZL");Tr(Zk());new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var qZ=ti(OL(),1),KZ=Object.defineProperty,XZ=i((e,t,r)=>t in e?KZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,"rL"),WZ=i((e,t,r)=>(XZ(e,t+"",r),r),"nL");function QZ(e,t){let r=Array.from({length:e.length},(a,n)=>({start:n,end:n+1}));for(;r.length>1;){let a=null;for(let n=0;n<r.length-1;n++){let s=e.slice(r[n].start,r[n+1].end),o=t.get(s.join(","));o!=null&&(a==null||o<a[0])&&(a=[o,n])}if(a!=null){let n=a[1];r[n]={start:r[n].start,end:r[n+1].end},r.splice(n+1,1)}else break}return r}i(QZ,"iL");function YZ(e,t){return e.length===1?[t.get(e.join(","))]:QZ(e,t).map(r=>t.get(e.slice(r.start,r.end).join(","))).filter(r=>r!=null)}i(YZ,"tL");function eH(e){return e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")}i(eH,"BL");var Tg=class{static{i(this,"Mz")}specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=new Map;textMap=new Map;constructor(e,t){this.patStr=e.pat_str;let r=e.bpe_ranks.split(`
78
78
  `).filter(Boolean).reduce((a,n)=>{let[s,o,...h]=n.split(" "),p=Number.parseInt(o,10);return h.forEach((v,c)=>a[v]=p+c),a},{});for(let[a,n]of Object.entries(r)){let s=qZ.default.toByteArray(a);this.rankMap.set(s.join(","),n),this.textMap.set(n,s)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((a,[n,s])=>(a[s]=this.textEncoder.encode(n),a),{})}encode(e,t=[],r="all"){let a=new RegExp(this.patStr,"ug"),n=Tg.specialTokenRegex(Object.keys(this.specialTokens)),s=[],o=new Set(t==="all"?Object.keys(this.specialTokens):t),h=new Set(r==="all"?Object.keys(this.specialTokens).filter(v=>!o.has(v)):r);if(h.size>0){let v=Tg.specialTokenRegex([...h]),c=e.match(v);if(c!=null)throw Error(`The text contains a special token that is not allowed: ${c[0]}`)}let p=0;for(;;){let v=null,c=p;for(;n.lastIndex=c,v=n.exec(e),!(v==null||o.has(v[0]));)c=v.index+1;let d=v?.index??e.length;for(let b of e.substring(p,d).matchAll(a)){let x=this.textEncoder.encode(b[0]),k=this.rankMap.get(x.join(","));if(k!=null){s.push(k);continue}s.push(...YZ(x,this.rankMap))}if(v==null)break;let y=this.specialTokens[v[0]];s.push(y),p=v.index+v[0].length}return s}decode(e){let t=[],r=0;for(let s=0;s<e.length;++s){let o=e[s],h=this.textMap.get(o)??this.inverseSpecialTokens[o];h!=null&&(t.push(h),r+=h.length)}let a=new Uint8Array(r),n=0;for(let s of t)a.set(s,n),n+=s.length;return this.textDecoder.decode(a)}},tH=Tg;WZ(tH,"specialTokenRegex",e=>new RegExp(e.map(t=>eH(t)).join("|"),"g"));ti(fB(),1);function ZA(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof globalThis<"u"&&typeof globalThis.window<"u"&&typeof globalThis.window.document<"u"?"browser":"unknown"}i(ZA,"rG");class rH{static{i(this,"nG")}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(t){let r=this.store[t];return r!==void 0?String(r):void 0}set(t,r){this.store[t]=r}has(t){return t in this.store}getAll(){return{...this.store}}}class iH{static{i(this,"iG")}runtime;browserStore;cache=new Map;constructor(){this.runtime=ZA(),this.runtime==="browser"&&(this.browserStore=new rH)}getRuntime(){return this.runtime}isNode(){return this.runtime==="node"}isBrowser(){return this.runtime==="browser"}get(t,r){if(this.cache.has(t)){let n=this.cache.get(t);return n===void 0&&r!==void 0?r:n}let a;switch(this.runtime){case"node":typeof process<"u"&&gn&&(a=gn[t]);break;case"browser":this.browserStore&&(a=this.browserStore.get(t));break;default:a=void 0}return this.cache.set(t,a),a===void 0&&r!==void 0?r:a}set(t,r){let a=String(r);switch(this.cache.delete(t),this.runtime){case"node":typeof process<"u"&&gn&&(gn[t]=a);break;case"browser":this.browserStore&&this.browserStore.set(t,r);break}}has(t){return this.get(t)!==void 0}getAll(){switch(this.runtime){case"node":if(typeof process<"u"&&gn)return{...gn};break;case"browser":if(this.browserStore)return this.browserStore.getAll();break}return{}}getBoolean(t,r=!1){let a=this.get(t);return a===void 0?r:["true","1","yes","on"].includes(a.toLowerCase())}getNumber(t,r){let a=this.get(t);if(a===void 0)return r;let n=Number(a);return isNaN(n)?r:n}clearCache(){this.cache.clear()}}var jp=null;function nH(){return jp||(jp=new iH),jp}i(nH,"N4");function vc(e,t){return nH().get(e,t)}i(vc,"xK");ZA();class aH{static{i(this,"SO")}globalStore;constructor(t){this.globalStore=t}clear(){console.clear()}filterByLabel(t){SH(t,this.globalStore.cache).forEach(r=>{su(r)})}filterByNamespace(...t){MH(t,this.globalStore.cache).forEach(r=>{su(r)})}filterByLevel(t){EH(t,this.globalStore.cache).forEach(r=>{su(r)})}renderAll(){this.globalStore.cache.forEach(t=>{su(t)})}}class Ob{static{i(this,"C4")}config;pidCounter=1;labels=new Map;_listenerCounter=0;_levelsToListeners=new Map;_cache=[];constructor(t={}){this.config=t}get cache(){return this._cache}get configuration(){return this.config}get pid(){let t=this.pidCounter;return this.pidCounter++,t}get tools(){return new aH(this)}addLogToCache(t){this._cache.length<(this.config.cacheSize??300)&&this._cache.push(t)}clearCache(){this._cache=[]}getLabel(t){return this.labels.get(t)}setLabel(t,r){this.labels.set(t,r)}addListener(t,r){let a=this._listenerCounter+=1;return Db({...bi.levels,...this.config.levels??{}},t).forEach(n=>{this._levelsToListeners.has(n)?this._levelsToListeners.get(n).set(a,r):this._levelsToListeners.set(n,new Map([[a,r]]))}),a}removeListener(t){this._levelsToListeners.forEach(r=>{r.delete(t)})}getListeners(t){return Array.from(this._levelsToListeners.get(t)?.values()??[])}}function sH(e){return globalThis.$adzeGlobal=new Ob(e),globalThis.$adzeGlobal}i(sH,"wW");function HA(e){let t=globalThis.$adzeGlobal;if(oH(t))return t;let r=new Ob(e);return globalThis.$adzeGlobal=r,r}i(HA,"MO");function oH(e){return e instanceof Ob}i(oH,"bc");function Tb(){return typeof window<"u"&&typeof window.location<"u"&&typeof window.navigator.userAgent<"u"&&!lH()}i(Tb,"TK");function lH(){return typeof Deno<"u"}i(lH,"uc");function uH(e){return Tb()}i(uH,"aG");function fH(){let e=!1;return Tb()&&(e=new URLSearchParams(globalThis.location.search).get("ADZE_ENV")==="test"),globalThis.$ADZE_ENV==="test"||e}i(fH,"QG");function cH(){let e=globalThis;return uH()?e.navigator.userAgent.includes("Firefox"):!1}i(cH,"eG");function lf(e){return Object.prototype.toString.call(e)==="[object String]"}i(lf,"E4");function Pb(e){return e!==null&&typeof e=="number"&&!isNaN(Number(e))}i(Pb,"h4");function JA(e){return VH.includes(e)}i(JA,"NO");function dH(e){return HH.includes(e)}i(dH,"sG");function hH(e){return YA.includes(e)}i(hH,"$V");function Y4(e){return e.every(t=>lf(t))}i(Y4,"ZW");function pH(e){return Array.isArray(e)&&e.length===3&&e[1]==="-"}i(pH,"qV");function mH(){return Error().stack?.replace(/^Error\n/,`
79
79
  `)}i(mH,"_V");function gH(e){return Pb(e.activeLevel)?e.activeLevel:e.levels[e.activeLevel].level}i(gH,"PV");var e3=ti(cB(),1),vH=e3.default??e3;function bH(e){return e.charAt(0).toUpperCase()+e.slice(1)}i(bH,"VW");function t3(e){return Object.values(e).map(t=>t.level)}i(t3,"SW");function r3(e,t,r){return e.filter(a=>a>=t&&a<=r)}i(r3,"MW");function yH(e,t=!1,r){let a=(t&&r?9+r.length:9)-e.length,n=e;for(let s=0;s<=a;s+=1)n+=" ";return n}i(yH,"NW");function wH(e,t){return t.reduce((r,a)=>vH[a](r),e)}i(wH,"CW");function su(e){e.data&&console[e.data.method](...e.data.message)}i(su,"G7");function xH(e){return e.filter(t=>t!=="")}i(xH,"vV");function _H(e){return typeof e=="object"&&e!==null}i(_H,"zV");function Db(e,t){if(t==="*")return Object.values(e).map(r=>r.level);if(lf(t))return[e[t].level];if(Pb(t))return[t];if(pH(t)){if(Y4(t)){let r=e[t[0]].level,a=e[t[2]].level;return r3(t3(e),r,a)}return r3(t3(e),t[0],t[2])}return Array.isArray(t)&&Y4(t)?t.map(r=>e[r].level):t}i(Db,"V7");function qA(e,t,r){return t.length===0?!1:e==="include"?!t.includes(r):t.includes(r)}i(qA,"EW");function i3(e,t){return e.length===0?!1:e.length>0&&t.length===0?!0:!t.map(r=>e.includes(r)).includes(!0)}i(i3,"hW");function n3(e,t){return e.length===0?!1:e.length>0&&t.length===0?!0:t.map(r=>e.includes(r)).includes(!0)}i(n3,"RW");function SH(e,t){return t.filter(r=>r.data?.label?.name===e)}i(SH,"BG");function MH(e,t){return t.filter(r=>r.data?.namespace?r.data.namespace.map(a=>e.includes(a)).includes(!0):!1)}i(MH,"UG");function EH(e,t){return t.filter(r=>{let a=Db(r.configuration.levels,e);return r.data?.level===void 0?!1:qA("exclude",a,r.data.level)})}i(EH,"FG");function kH(e){return e&&e.length>0?e.reduce((t,r)=>`${t}#${r} `,""):""}i(kH,"IW");function jH(e){return e?`[${e.name}] `:""}i(jH,"DW");function AH(e){return e!==void 0?`(Count: ${e}) `:""}i(AH,"gW");function NH(e,t){return e!==void 0&&!e?`${t?"❌ ":""}Assertion failed:`:""}i(NH,"LW");function IH(e,t){return e!==void 0&&e?`${t?"✅ ":""}Expression passed:`:""}i(IH,"bW");var KA=-1,bc=0,uf=1,ff=2,Lb=3,Bb=4,zb=5,Ub=6,XA=7,WA=8,a3=typeof self=="object"?self:globalThis,CH=i((e,t)=>{let r=i((n,s)=>(e.set(s,n),n),"K"),a=i(n=>{if(e.has(n))return e.get(n);let[s,o]=t[n];switch(s){case bc:case KA:return r(o,n);case uf:{let h=r([],n);for(let p of o)h.push(a(p));return h}case ff:{let h=r({},n);for(let[p,v]of o)h[a(p)]=a(v);return h}case Lb:return r(new Date(o),n);case Bb:{let{source:h,flags:p}=o;return r(new RegExp(h,p),n)}case zb:{let h=r(new Map,n);for(let[p,v]of o)h.set(a(p),a(v));return h}case Ub:{let h=r(new Set,n);for(let p of o)h.add(a(p));return h}case XA:{let{name:h,message:p}=o;return r(new a3[h](p),n)}case WA:return r(BigInt(o),n);case"BigInt":return r(Object(BigInt(o)),n)}return r(new a3[s](o),n)},"P");return a},"yc"),s3=i(e=>CH(new Map,e)(0),"uW"),Za="",{toString:RH}={},{keys:OH}=Object,Ls=i(e=>{let t=typeof e;if(t!=="object"||!e)return[bc,t];let r=RH.call(e).slice(8,-1);switch(r){case"Array":return[uf,Za];case"Object":return[ff,Za];case"Date":return[Lb,Za];case"RegExp":return[Bb,Za];case"Map":return[zb,Za];case"Set":return[Ub,Za]}return r.includes("Array")?[uf,r]:r.includes("Error")?[XA,r]:[ff,r]},"E7"),ou=i(([e,t])=>e===bc&&(t==="function"||t==="symbol"),"RO"),TH=i((e,t,r,a)=>{let n=i((o,h)=>{let p=a.push(o)-1;return r.set(h,p),p},"_"),s=i(o=>{if(r.has(o))return r.get(o);let[h,p]=Ls(o);switch(h){case bc:{let c=o;switch(p){case"bigint":h=WA,c=o.toString();break;case"function":case"symbol":if(e)throw TypeError("unable to serialize "+p);c=null;break;case"undefined":return n([KA],o)}return n([h,c],o)}case uf:{if(p)return n([p,[...o]],o);let c=[],d=n([h,c],o);for(let y of o)c.push(s(y));return d}case ff:{if(p)switch(p){case"BigInt":return n([p,o.toString()],o);case"Boolean":case"Number":case"String":return n([p,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());let c=[],d=n([h,c],o);for(let y of OH(o))(e||!ou(Ls(o[y])))&&c.push([s(y),s(o[y])]);return d}case Lb:return n([h,o.toISOString()],o);case Bb:{let{source:c,flags:d}=o;return n([h,{source:c,flags:d}],o)}case zb:{let c=[],d=n([h,c],o);for(let[y,b]of o)(e||!(ou(Ls(y))||ou(Ls(b))))&&c.push([s(y),s(b)]);return d}case Ub:{let c=[],d=n([h,c],o);for(let y of o)(e||!ou(Ls(y)))&&c.push(s(y));return d}}let{message:v}=o;return n([h,{name:p,message:v}],o)},"j");return s},"cc"),o3=i((e,{json:t,lossy:r}={})=>{let a=[];return TH(!(t||r),!!t,new Map,a)(e),a},"yW"),l3=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?s3(o3(e,t)):structuredClone(e):(e,t)=>s3(o3(e,t));function u3(e,t,r,a){let{formatters:n,middleware:s=[],...o}=t.exportValues();return class extends e{_cfg=new Dg({...l3(o),formatters:{...n},middleware:[...s]});_modifierData=l3(r);modifierQueue=[...a]}}i(u3,"xW");function QA([e,t]){return`${e}s ${t/1e6}ms`}i(QA,"cW");function PH(){return QA(Pg())}i(PH,"HV");function Pg(e){let t=performance.now()*.001,r=Math.floor(t),a=Math.floor(t%1*1e9);if(e===void 0)return[r,a];let n=r-e[0],s=a-e[1];return s<0&&(n-=1,s+=1e9),[n,s]}i(Pg,"IO");function Fb(e){let t=i(n=>`${Math.floor(Math.abs(n))}`.padStart(2,"0"),"q"),r=-e.getTimezoneOffset(),a=`${r>=0?"+":"-"}${t(r/60)}:${t(r%60)}`;return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}${a}`}i(Fb,"b4");function DH(e){let t=i((x,k=2)=>String(x).padStart(k,"0"),"q"),r=t(e.getDate()),a=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][e.getMonth()],n=e.getFullYear(),s=t(e.getHours()),o=t(e.getMinutes()),h=t(e.getSeconds()),p=-e.getTimezoneOffset(),v=p>=0?"+":"-",c=Math.abs(p),d=t(Math.floor(c/60)),y=t(c%60),b=`${v}${d}${y}`;return`${r}/${a}/${n}:${s}:${o}:${h} ${b}`}i(DH,"JV");class yc{static{i(this,"E8")}cfg;level;timestampFormatFunction=i(t=>Fb(t),"timestampFormatFunction");constructor(t,r){this.cfg=t,this.level=r}get timestampFormatter(){return this.cfg.timestampFormatter?this.cfg.timestampFormatter:this.timestampFormatFunction}print(t,r,a){if(this.level.level>gH(this.cfg))return[];if(this.failsFilters(t))return[];if(t.assertion===!0)return[];if(t.if===!1)return[];if(t.method&&!hH(t.method)&&dH(t.method)&&JA(t.method))return a;let n=Tb()?this.formatBrowser(t,r,a):this.formatServer(t,r,a);return t.stacktrace&&n.push(t.stacktrace),n}failsFilters(t){return!!(this.failsLevelSelector()||this.failsNamespacesFilter(t)||this.failsLabelsFilter(t))}failsLevelSelector(){if(this.cfg.filters?.levels===void 0)return!1;let t=Db(this.cfg.levels,this.cfg.filters.levels.values);return!!qA(this.cfg.filters.levels.type,t,this.level.level)}failsNamespacesFilter(t){if(this.cfg.filters?.namespaces===void 0)return!1;if(this.cfg.filters.namespaces.values.length>0&&t.namespace===void 0)return!0;if(this.cfg.filters.namespaces.type==="include"){let a=t.namespace??[];return i3(this.cfg.filters.namespaces.values,a)}let r=t.namespace??[];return n3(this.cfg.filters.namespaces.values,r)}failsLabelsFilter(t){if(this.cfg.filters?.labels===void 0)return!1;if(this.cfg.filters.labels.values.length>0&&t.label===void 0)return!0;let r=t.label?[t.label.name]:[];return this.cfg.filters.labels.type==="include"?i3(this.cfg.filters.labels.values,r):n3(this.cfg.filters.labels.values,r)}}class LH extends yc{static{i(this,"DO")}timestampFormatFunction=i(t=>DH(t),"timestampFormatFunction");formatBrowser(t,r,a){return this.formatMessage(t,r,a)}formatServer(t,r,a){return this.formatMessage(t,r,a)}formatMessage(t,r,a){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 n=this.cfg.meta.hostname,s=this.cfg.meta.ident??"-",o=this.cfg.meta.user??"-",h=a[0];return[`${n} ${s} ${o} [${r}] ${h}`]}}var BH=LH;function zH(e){return typeof e.name=="string"&&typeof e.hostname=="string"}i(zH,"wV");class UH extends yc{static{i(this,"gO")}timestampFormatFunction=i(t=>Fb(t),"timestampFormatFunction");formatBrowser(t,r,a){return this.formatMessage(t,r,a)}formatServer(t,r,a){return this.formatMessage(t,r,a)}formatMessage(t,r,a){let n=HA(),s=[...a],o=s.shift();if(zH(this.cfg.meta)){let{src:h,err:p,req_id:v,req:c,res:d,latency:y,hostname:b,name:x,...k}=this.cfg.meta,{namespace:N,label:C}=t,R={v:1,level:this.level.level,levelName:this.level.levelName,name:x,hostname:b,msg:o,args:s,pid:n.pid,time:r,meta:Object.keys(k).length>0?k:void 0,namespace:N,label:C?.name,src:h,err:p,req_id:v,req:c,res:d,latency:y};return[JSON.stringify(R)]}return console.warn(Error("Adze: Required fields are missing from the log meta for generating a JSON log.")),[...s]}}var FH=UH;class $H extends yc{static{i(this,"LO")}formatBrowser(t,r,a){let n=this.formatLeader(),s=this.formatMeta(t,r);return this.cfg.withEmoji?[n,"font-size: 12px;",this.level.style,s,...a]:[n,this.level.style,s,...a]}formatServer(t,r,a){let n=`${yH(this.formatLeader(!1),this.cfg.withEmoji,this.level.emoji)} `,s=this.formatMeta(t,r);return[wH(n,this.level.terminalStyle),s,...a]}formatLeader(t=!0){let r=t?"%c":"",a=" "+bH(this.level.levelName);return this.cfg.withEmoji?`${r}${this.formatEmoji(t)}${r}${a}`:`${r}${a}`}formatEmoji(t){let r=t?" ":"";return this.level.emoji?`${this.level.emoji}${r}`:""}formatMeta(t,r){let a=this.cfg.showTimestamp?`${r} `:"",n=kH(t.namespace),s=jH(t.label),o=this.formatTime(t),h=AH(t.label?.count),p=NH(t.assertion,this.cfg.withEmoji),v=IH(t.if,this.cfg.withEmoji),c=p!==""?p:v!==""?v:"";return a+n+s+o+h+c}formatTime(t){let r=this.cfg.withEmoji?"⏱ ":"Time elapsed: ";return t.timeNow?`(${r}${t.timeNow})`:t.label?.timeElapsed?`(${r}${t.label.timeElapsed})`:""}}var f3=$H;class GH extends yc{static{i(this,"h7")}timestampFormatFunction=i(t=>Fb(t),"timestampFormatFunction");formatBrowser(t,r,a){return this.formatMessage(r,t,a)}formatServer(t,r,a){return this.formatMessage(r,t,a)}formatMessage(t,r,a){let n="",{appname:s,hostname:o,port:h}=this.cfg.meta,p=Pb(h)?`/${h}`:"",v=lf(s)?`${s}${p}`:"",c=lf(o)?` on ${o}: `:"",d=this.formatNamespace(r.namespace),y=r.label?`[${r.label.name}] `:"";return n=`${v}${c}${d}${y}`,[`[${t}] ${this.level.levelName.toUpperCase()}: ${n}${a[0]} `,a.map(b=>_H(b)?JSON.stringify(b):b).slice(1).join(" ")]}formatNamespace(t){return t&&t.length>0?`${t.reduce((r,a,n)=>n===t.length-1?`${r}${a}`:`${r}${a}/`,"")} `:""}}var YA=["group","groupCollapsed"],eN=["dir","dirxml","table",...YA],VH=["error","warn","info","log","debug",...eN],ZH=["clear","groupEnd"],HH=[...eN,...ZH],bi={activeLevel:"log",cache:!1,cacheSize:300,dump:!1,format:"pretty",showTimestamp:!1,silent:!1,withEmoji:!1,levels:{alert:JH(),error:qH(),warn:KH(),info:XH(),fail:WH(),success:QH(),log:YH(),debug:eJ(),verbose:tJ()},formatters:{default:f3,pretty:f3,standard:GH,common:BH,json:FH}};function JH(e={}){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:"🚨",...e}}i(JH,"mc");function qH(e={}){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:"🔥",...e}}i(qH,"dc");function KH(e={}){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: ${cH()?"44px":"30px"};`,terminalStyle:["white","bgYellow"],method:"warn",emoji:"🔔",...e}}i(KH,"lc");function XH(e={}){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:"ℹ️",...e}}i(XH,"oc");function WH(e={}){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:"❌",...e}}i(WH,"rc");function QH(e={}){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:"🎉",...e}}i(QH,"nc");function YH(e={}){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:"🪵",...e}}i(YH,"ic");function eJ(e={}){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:"🐞",...e}}i(eJ,"tc");function tJ(e={}){return{levelName:"verbose",level:8,style:"font-size: 12px; padding-right: 22px; color: #999999;",terminalStyle:["black","italic"],method:"debug",emoji:"💬",...e}}i(tJ,"Bc");class Dg{static{i(this,"L4")}logCfg;glblCfg;constructor(t){this.logCfg=t??{},this.glblCfg=globalThis.$adzeGlobal?.configuration}updateConfiguration(t){this.logCfg=t}get activeLevel(){return this.glblCfg?.activeLevel??this.logCfg.activeLevel??bi.activeLevel}set activeLevel(t){this.logCfg.activeLevel=t}get cache(){return this.glblCfg?.cache??this.logCfg.cache??bi.cache}set cache(t){this.logCfg.cache=t}get cacheSize(){return this.glblCfg?.cacheSize??this.logCfg.cacheSize??bi.cacheSize}set cacheSize(t){this.logCfg.cacheSize=t}get dump(){return this.glblCfg?.dump??this.logCfg.dump??bi.dump}set dump(t){this.logCfg.dump=t}get meta(){return{...this.logCfg.meta,...this.glblCfg?.meta}}set meta(t){this.logCfg.meta=t}get silent(){return this.glblCfg?.silent??this.logCfg.silent??bi.silent}set silent(t){this.logCfg.silent=t}get showTimestamp(){return this.glblCfg?.showTimestamp??this.logCfg.showTimestamp??bi.showTimestamp}set showTimestamp(t){this.logCfg.showTimestamp=t}get withEmoji(){return this.glblCfg?.withEmoji??this.logCfg.withEmoji??bi.withEmoji}set withEmoji(t){this.logCfg.withEmoji=t}get format(){return this.glblCfg?.format??this.logCfg.format??bi.format}set format(t){this.logCfg.format=t}get levels(){return{...bi.levels,...this.logCfg.levels??{},...this.glblCfg?.levels??{}}}set levels(t){this.logCfg.levels=t}get middleware(){return[...this.glblCfg?.middleware??[],...this.logCfg.middleware??[]]}set middleware(t){this.logCfg.middleware=t}get filters(){return this.glblCfg?.filters??this.logCfg.filters}set filters(t){this.logCfg.filters=t}get timestampFormatter(){return this.glblCfg?.timestampFormatter??this.logCfg.timestampFormatter}set timestampFormatter(t){this.logCfg.timestampFormatter=t}get formatters(){return{...bi.formatters,...this.logCfg.formatters??{},...this.glblCfg?.formatters??{}}}set formatters(t){this.logCfg.formatters=t}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 rJ(e){return typeof e=="function"}i(rJ,"Uc");class cf{static{i(this,"u4")}globalStore;_cfg;_modifierData;_data;modifierQueue=[];constructor(t,r){this.globalStore=HA(t),this._modifierData=r??{},this._cfg=new Dg(t),this.doHook(a=>{a.constructed&&a.constructed(this)})}get data(){return this._data}get modifierData(){return this._modifierData}get configuration(){return this._cfg}alert(...t){this.terminate("alert",t)}static alert(...t){new this().alert(...t)}error(...t){this.terminate("error",t)}static error(...t){new this().error(...t)}warn(...t){this.terminate("warn",t)}static warn(...t){new this().warn(...t)}info(...t){this.terminate("info",t)}static info(...t){new this().info(...t)}fail(...t){this.terminate("fail",t)}static fail(...t){new this().fail(...t)}success(...t){this.terminate("success",t)}static success(...t){new this().success(...t)}log(...t){this.terminate("log",t)}static log(t,...r){new this().log(t,...r)}debug(...t){this.terminate("debug",t)}static debug(...t){new this().debug(...t)}verbose(...t){this.terminate("verbose",t)}static verbose(...t){new this().verbose(...t)}clear(){console.clear()}static clear(){console.clear()}clr(){console.clear()}static clr(){console.clear()}custom(t,...r){return this._cfg.levels[t]?(this.terminate(t,r),this):(console.warn(Error("Custom log level not found in configuration.")),this)}static custom(t,...r){return new this().custom(t,...r)}seal(t){return t&&this._cfg.updateConfiguration(t),u3(cf,this._cfg,this.modifierData,this.modifierQueue)}static seal(t){return new this().seal(t)}sealTag(t,r){return this._cfg=new Dg({...this._cfg.exportValues(),...r}),(a,...n)=>{let s=String.raw({raw:a},...n),o=u3(cf,this._cfg,this.modifierData,this.modifierQueue),h=t;rJ(o[h])&&o[h](s)}}static sealTag(t,r){return new this().sealTag(t,r)}thread(t,r){this.runModifierQueue(),this._modifierData.label&&(this._modifierData.label.context||(this._modifierData.label.context={}),this._modifierData.label.context={...this._modifierData.label.context,[t]:r})}static thread(t,r){new this().thread(t,r)}assert(t){return this.modifierQueue.push(["assert",r=>(r.assertion=t,r)]),this}static assert(t){return new this().assert(t)}get closeThread(){return this.modifierQueue.push(["closeThread",t=>(t.label?.context&&(t.label.context=void 0),t)]),this}static get closeThread(){return new this().closeThread}get count(){return this.modifierQueue.push(["count",t=>(t.label&&(t.label.count=t.label.count!==void 0?t.label.count+1:1),t)]),this}static get count(){return new this().count}get countClear(){return this.modifierQueue.push(["countClear",t=>(t.label&&delete t.label.count,t)]),this}static get countClear(){return new this().countClear}get countReset(){return this.modifierQueue.push(["countReset",t=>(t.label&&(t.label.count=0),t)]),this}static get countReset(){return new this().countReset}get dir(){return this.modifierQueue.push(["dir",t=>(t.method="dir",t)]),this}static get dir(){return new this().dir}get dirxml(){return this.modifierQueue.push(["dirxml",t=>(t.method="dirxml",t)]),this}static get dirxml(){return new this().dirxml}get dump(){return this.modifierQueue.push(["dump",(t,r)=>(r._cfg.dump=!0,t)]),this}static get dump(){return new this().dump}format(t){return this.modifierQueue.push(["format",(r,a)=>Object.keys(a._cfg.formatters).includes(t)?(a._cfg.format=t,r):(console.warn(Error(`Adze: Formatter "${t}" not found in configuration.`)),r)]),this}static format(t){return new this().format(t)}get group(){return this.modifierQueue.push(["group",t=>(t.method="group",t)]),this}static get group(){return new this().group}get groupCollapsed(){return this.modifierQueue.push(["groupCollapsed",t=>(t.method="groupCollapsed",t)]),this}static get groupCollapsed(){return new this().groupCollapsed}get groupEnd(){return this.modifierQueue.push(["groupEnd",t=>(t.method="groupEnd",t)]),this}static get groupEnd(){return new this().groupEnd}if(t){return this.modifierQueue.push(["if",r=>(r.if=t,r)]),this}static if(t){return new this().if(t)}test(t){return this.if(t)}static test(t){return new this().if(t)}label(t){return this.modifierQueue.unshift(["label",r=>{let a=this.globalStore.getLabel(t)??{name:t};return r.label=a,this.globalStore.setLabel(t,a),r}]),this}static label(t){return new this().label(t)}meta(t){return this.modifierQueue.push(["meta",(r,a)=>(a._cfg.meta={...a._cfg.meta,...t},r)]),this}static meta(t){return new this().meta(t)}namespace(...t){return this.modifierQueue.push(["namespace",r=>{let a=r.namespace??[];return r.namespace=a.length>0?[...a,...t]:t,r}]),this}static namespace(...t){return new this().namespace(...t)}ns(...t){return this.namespace(...t)}static ns(...t){return new this().namespace(...t)}get silent(){return this.modifierQueue.push(["silent",(t,r)=>(r._cfg.silent=!0,t)]),this}static get silent(){return new this().silent}get table(){return this.modifierQueue.push(["table",t=>(t.method="table",t)]),this}static get table(){return new this().table}get time(){return this.modifierQueue.push(["time",t=>{let r=Pg();return t.label&&(t.label.timeStart=r),t}]),this}static get time(){return new this().time}get timeEnd(){return this.modifierQueue.push(["timeEnd",t=>(t.label?.timeStart&&(t.label.timeElapsed=QA(Pg(t.label.timeStart))),t)]),this}static get timeEnd(){return new this().timeEnd}get timeNow(){return this.modifierQueue.push(["timeNow",t=>(t.timeNow=PH(),t)]),this}static get timeNow(){return new this().timeNow}get timestamp(){return this.modifierQueue.push(["timestamp",(t,r)=>(r._cfg.showTimestamp=!0,t)]),this}static get timestamp(){return new this().timestamp}get trace(){return this.modifierQueue.push(["trace",t=>(t.stacktrace=mH(),t)]),this}static get trace(){return new this().trace}get withEmoji(){return this.modifierQueue.push(["withEmoji",(t,r)=>(r._cfg.withEmoji=!0,t)]),this}static get withEmoji(){return new this().withEmoji}print(t){fH()||t.silent||t.message.length<1||(JA(t.method)?console[t.method](...t.message):console[t.method]())}terminate(t,r){this.doHook(C=>{C.beforeTerminated&&C.beforeTerminated(this,t,r)}),this.runModifierQueue();let a=this.getLevelConfig(t),n=new(this.selectFormatter(this._cfg.format))(this._cfg,a),s=n.timestampFormatter(new Date),o=xH(n.print(this.modifierData,s,r));this._cfg.dump&&this.modifierData.label?.context&&o.push(this.modifierData.label.context),this.doHook(C=>{C.beforeFormatApplied&&(o=C.beforeFormatApplied(this,this._cfg.format,o))});let{activeLevel:h,cache:p,cacheSize:v,dump:c,format:d,meta:y,showTimestamp:b,silent:x,withEmoji:k}=this._cfg,N={activeLevel:h,cache:p,cacheSize:v,dump:c,format:d,meta:y,showTimestamp:b,silent:x,withEmoji:k,...a,...this._modifierData,terminator:t,args:r,timestamp:s,message:o};this.doHook(C=>{C.afterFormatApplied&&C.afterFormatApplied(this,this._cfg.format,o)}),this._data=N,this._cfg.cache&&this.globalStore.addLogToCache(this),this.doHook(C=>{C.beforePrint&&C.beforePrint(this)}),this.print(this._data),this.doHook(C=>{C.afterTerminated&&C.afterTerminated(this,t,r)}),this.globalStore.getListeners(a.level).forEach(C=>{C(this)})}selectFormatter(t){return this._cfg.formatters[t]}getLevelConfig(t){return this._cfg.levels[t]}runModifierQueue(){this.modifierQueue.forEach(([t,r])=>{let a=r(this.modifierData,this);this.doHook(n=>{n.beforeModifierApplied&&n.beforeModifierApplied(this,t,a)}),this._modifierData=a,this.doHook(n=>{n.afterModifierApplied&&n.afterModifierApplied(this,t,a)})})}doHook(t){this._cfg.middleware?.forEach(r=>{t(r)})}}var iJ=cf,df={trace:10,verbose:10,debug:20,success:27,progress:28,log:29,info:30,warn:40,error:50,fatal:60,alert:60},nJ={10:"trace",20:"debug",27:"success",28:"progress",29:"log",30:"info",40:"warn",50:"error",60:"fatal"};function c3(e,t){let r=df[e.toLowerCase()]||30,a=df[t.toLowerCase()]||30;return r>=a}i(c3,"MV");function Lg(e){try{let t=new WeakSet;return JSON.stringify(e,(r,a)=>{if(typeof a=="object"&&a!==null){if(t.has(a))return"[Circular]";t.add(a)}return a})}catch{return String(e)}}i(Lg,"dW");function tN(e){if(!e)return!1;let t=e.toLowerCase().trim();return t==="true"||t==="1"||t==="yes"||t==="on"}i(tN,"NV");var aJ="info",hf=vc("LOG_LEVEL")||aJ,Bg=tN(vc("LOG_JSON_FORMAT")),$b=tN(vc("LOG_TIMESTAMPS")??"true");function sJ(e=100){let t=[];return{write(r){t.push(r),t.length>e&&t.shift()},clear(){t.length=0},recentLogs(){return t.map(r=>{let a=$b?new Date(r.time).toISOString():"",n=nJ[r.level??30]||"info";return`${a} ${n} ${r.msg}`.trim()}).join(`
80
- `)}}}i(sJ,"wm");var Iu=sJ(),rN=i(()=>{let e=hf.toLowerCase();return e==="trace"?"verbose":e==="debug"?"debug":e==="log"?"log":e==="info"?"info":e==="warn"?"warn":e==="error"?"error":e==="fatal"?"alert":"info"},"CV"),oJ=rN(),iN={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:""}},lJ=sH({activeLevel:oJ,format:Bg?"json":"pretty",timestampFormatter:$b?void 0:()=>"",withEmoji:!1,levels:iN});lJ.addListener("*",e=>{try{let t=e.data,r=Array.isArray(t?.message)?t.message.map(n=>typeof n=="string"?n:Lg(n)).join(" "):typeof t?.message=="string"?t.message:"",a={time:Date.now(),level:typeof t?.level=="number"?t.level:void 0,msg:r};Iu.write(a)}catch{}});function uJ(e){let t=iJ,r=[];typeof e.namespace=="string"&&r.push(e.namespace),Array.isArray(e.namespaces)&&r.push(...e.namespaces),r.length>0&&(t=t.ns(...r));let a={...e};if(delete a.namespace,delete a.namespaces,Bg&&(a.name||(a.name="elizaos"),!a.hostname)){let s="unknown";if(typeof process<"u"&&process.platform)try{s=(EB(),$t(p9)).hostname()}catch{s="localhost"}else typeof window<"u"&&window.location&&(s=window.location.hostname||"browser");a.hostname=s}let n={activeLevel:rN(),format:Bg?"json":"pretty",timestampFormatter:$b?void 0:()=>"",withEmoji:!1,levels:iN};return t.meta(a).seal(n)}i(uJ,"fm");function fJ(e){let t=hf,r={},a;if(typeof e=="object"&&e!==null){"level"in e&&(t=e.level),"maxMemoryLogs"in e&&typeof e.maxMemoryLogs=="number"&&(a=e.maxMemoryLogs);let{level:n,maxMemoryLogs:s,...o}=e;r=o}return{level:t,base:r,maxMemoryLogs:a}}i(fJ,"km");function zg(e=!1){let{level:t,base:r,maxMemoryLogs:a}=fJ(e);if(typeof a=="number"&&a>0&&Iu.clear(),typeof e=="object"&&e&&"__forceType"in e&&e.__forceType==="browser"){let p=(typeof t=="number"?"info":t||hf).toLowerCase(),v=i((...y)=>y.map(b=>typeof b=="string"?b:b instanceof Error?b.message:Lg(b)).join(" "),"q$"),c=i((y,...b)=>{if(!c3(y,p))return;let x=v(...b),k=y==="fatal"?"error":y==="trace"||y==="verbose"?"debug":y==="success"||y==="progress"?"info":y==="log"?"log":console[y]?y:"log";typeof console[k]=="function"&&console[k](x)},"e"),d=i((y,b,...x)=>typeof y=="string"?b!==void 0?[y,b,...x]:[y,...x]:y instanceof Error?b!==void 0?[y.message,b,...x]:[y.message,...x]:b!==void 0?[b,y,...x]:[y,...x],"l");return{level:p,trace:i((y,b,...x)=>c("trace",...d(y,b,...x)),"trace"),debug:i((y,b,...x)=>c("debug",...d(y,b,...x)),"debug"),info:i((y,b,...x)=>c("info",...d(y,b,...x)),"info"),warn:i((y,b,...x)=>c("warn",...d(y,b,...x)),"warn"),error:i((y,b,...x)=>c("error",...d(y,b,...x)),"error"),fatal:i((y,b,...x)=>c("fatal",...d(y,b,...x)),"fatal"),success:i((y,b,...x)=>c("success",...d(y,b,...x)),"success"),progress:i((y,b,...x)=>c("progress",...d(y,b,...x)),"progress"),log:i((y,b,...x)=>c("log",...d(y,b,...x)),"log"),clear:i(()=>{typeof console.clear=="function"&&console.clear()},"clear"),child:i(y=>zg({level:p,...r,...y,__forceType:"browser"}),"child")}}let n=uJ(r),s=(typeof t=="number"?"info":t||hf).toLowerCase(),o=i((p,...v)=>{if(!c3(p,s))return;try{let y="";v.length>0&&(y=v.map(x=>typeof x=="string"?x:x instanceof Error?x.message:Lg(x)).join(" ")),r.namespace&&(y=`#${r.namespace} ${y}`);let b={time:Date.now(),level:df[p.toLowerCase()]||df.info,msg:y};Iu.write(b)}catch{}let c=p,d=v;p==="fatal"?c="alert":p==="progress"?(c="info",d=["[PROGRESS]",...v]):p==="success"?(c="info",d=["[SUCCESS]",...v]):p==="trace"&&(c="verbose");try{n[c](...d)}catch{console.log(`[${p.toUpperCase()}]`,...v)}},"w"),h=i((p,v,...c)=>typeof p=="string"?v!==void 0?[p,v,...c]:[p,...c]:p instanceof Error?v!==void 0?[p.message,{error:p},v,...c]:[p.message,{error:p},...c]:v!==void 0?[v,p,...c]:[p,...c],"G");return{level:s,trace:i((p,v,...c)=>o("verbose",...h(p,v,...c)),"trace"),debug:i((p,v,...c)=>o("debug",...h(p,v,...c)),"debug"),info:i((p,v,...c)=>o("info",...h(p,v,...c)),"info"),warn:i((p,v,...c)=>o("warn",...h(p,v,...c)),"warn"),error:i((p,v,...c)=>o("error",...h(p,v,...c)),"error"),fatal:i((p,v,...c)=>o("fatal",...h(p,v,...c)),"fatal"),success:i((p,v,...c)=>o("success",...h(p,v,...c)),"success"),progress:i((p,v,...c)=>o("progress",...h(p,v,...c)),"progress"),log:i((p,v,...c)=>o("log",...h(p,v,...c)),"log"),clear:i(()=>{try{typeof console?.clear=="function"&&console.clear()}catch{}Iu.clear()},"clear"),child:i(p=>zg({level:s,...r,...p}),"child")}}i(zg,"I7");var mo=zg(),lu=mo,cJ=ct.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");function Vo(e){let t=cJ.safeParse(e);return t.success?t.data:null}i(Vo,"Vm");var Ap=i(e=>{if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("audio/"))return"audio";if(e.includes("pdf")||e.includes("document")||e.startsWith("text/"))return"document"},"L_$"),nN=ct.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"),dJ=ct.object({text:ct.string().optional(),thought:ct.string().optional(),actions:ct.array(ct.string()).optional(),providers:ct.array(ct.string()).optional(),source:ct.string().optional(),target:ct.string().optional(),url:ct.string().optional(),inReplyTo:nN.optional(),attachments:ct.array(ct.any()).optional(),channelType:ct.nativeEnum(bt).optional()}).passthrough(),hJ=ct.object({name:ct.string(),content:dJ}),pJ=ct.object({directory:ct.string(),shared:ct.boolean().optional()}),mJ=ct.union([ct.string(),ct.object({path:ct.string(),shared:ct.boolean().optional()}),pJ]),gJ=ct.union([ct.string(),ct.function().optional()]),vJ=ct.object({all:ct.array(ct.string()).optional(),chat:ct.array(ct.string()).optional(),post:ct.array(ct.string()).optional()}).optional(),bJ=ct.record(ct.string(),ct.union([ct.string(),ct.boolean(),ct.number(),ct.any()])).optional(),yJ=ct.record(ct.string(),ct.union([ct.string(),ct.boolean(),ct.number()])).optional();ct.object({id:nN.optional(),name:ct.string().min(1,"Character name is required"),username:ct.string().optional(),system:ct.string().optional(),templates:ct.record(ct.string(),gJ).optional(),bio:ct.union([ct.string(),ct.array(ct.string())]),messageExamples:ct.array(ct.array(hJ)).optional(),postExamples:ct.array(ct.string()).optional(),topics:ct.array(ct.string()).optional(),adjectives:ct.array(ct.string()).optional(),knowledge:ct.array(mJ).optional(),plugins:ct.array(ct.string()).optional(),settings:bJ,secrets:yJ,style:vJ}).strict();function Yi(){return typeof Buffer<"u"&&typeof Buffer.from=="function"}i(Yi,"B8");function wJ(e){let t=e.replace(/[^0-9a-fA-F]/g,"");if(Yi())return Buffer.from(t,"hex");let r=new Uint8Array(t.length/2);for(let a=0;a<r.length;a++)r[a]=parseInt(t.substr(a*2,2),16);return r}i(wJ,"Uo");function xJ(e,t="utf8"){if(Yi()){let r=t==="utf-8"?"utf8":t;return Buffer.from(e,r)}if(t==="base64"){let r=atob(e),a=new Uint8Array(r.length);for(let n=0;n<r.length;n++)a[n]=r.charCodeAt(n);return a}return new TextEncoder().encode(e)}i(xJ,"Fo");function aN(e){if(Yi()&&Buffer.isBuffer(e))return e.toString("hex");let t=e instanceof Uint8Array?e:new Uint8Array(e),r="";for(let a=0;a<t.length;a++){let n=t[a].toString(16);r+=n.length===1?"0"+n:n}return r}i(aN,"PM");function _J(e,t="utf8"){if(Yi()&&Buffer.isBuffer(e)){let a=t==="utf-8"?"utf8":t;return e.toString(a)}let r=e instanceof Uint8Array?e:new Uint8Array(e);if(t==="hex")return aN(r);if(t==="base64"){let a="";for(let n=0;n<r.length;n++)a+=String.fromCharCode(r[n]);return btoa(a)}return new TextDecoder().decode(r)}i(_J,"ao");function SJ(e){return e?Yi()&&Buffer.isBuffer(e)?!0:e instanceof Uint8Array||e instanceof ArrayBuffer||typeof e=="object"&&e.buffer instanceof ArrayBuffer&&typeof e.byteLength=="number"&&!Array.isArray(e):!1}i(SJ,"Qo");function MJ(e){return Yi()?Buffer.alloc(e):new Uint8Array(e)}i(MJ,"eo");function EJ(e){return Yi()?Buffer.from(e):new Uint8Array(e)}i(EJ,"so");function kJ(e){if(Yi()&&e.every(n=>Buffer.isBuffer(n)))return Buffer.concat(e);let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),a=0;for(let n of e){let s=n instanceof Uint8Array?n:new Uint8Array(n);r.set(s,a),a+=s.length}return r}i(kJ,"$r");function jJ(e,t,r){return Yi()&&Buffer.isBuffer(e)?e.slice(t,r):(e instanceof Uint8Array?e:new Uint8Array(e)).slice(t,r)}i(jJ,"qr");function AJ(e,t){if(e.length!==t.length)return!1;let r=e instanceof Uint8Array?e:new Uint8Array(e),a=t instanceof Uint8Array?t:new Uint8Array(t);for(let n=0;n<r.length;n++)if(r[n]!==a[n])return!1;return!0}i(AJ,"Kr");function NJ(e){return e.length}i(NJ,"_r");function IJ(e){if(Yi())try{return(qr(),$t(Ur)).randomBytes(e)}catch{}let t=new Uint8Array(e);if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)globalThis.crypto.getRandomValues(t);else for(let r=0;r<e;r++)t[r]=Math.floor(Math.random()*256);return t}i(IJ,"Pr");var CJ={fromHex:wJ,fromString:xJ,fromBytes:EJ,toHex:aN,toString:_J,isBuffer:SJ,alloc:MJ,concat:kJ,slice:jJ,equals:AJ,byteLength:NJ,randomBytes:IJ},RJ=[];for(let e=0;e<256;++e)RJ.push((e+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var Bs=null,d3=!1,OJ=3e5;function TJ(){let e=vc("SECRET_SALT","secretsalt")||"secretsalt",t=Date.now();return Bs!==null&&t-Bs.timestamp<OJ&&Bs.value===e?Bs.value:(e==="secretsalt"&&!d3&&(mo.warn("SECRET_SALT is not set or using default value"),d3=!0),Bs={value:e,timestamp:t},e)}i(TJ,"C_");function PJ(e,t){try{if(e==null||typeof e=="boolean"||typeof e=="number")return e;if(typeof e!="string")return mo.debug(`Value is not a string (type: ${typeof e}), returning as is`),e;let r=e.split(":");if(r.length!==2)return e;let a=CJ.fromHex(r[0]),n=r[1];if(a.length!==16)return a.length&&mo.debug(`Invalid IV length (${a.length}) - expected 16 bytes`),e;let s=yx.createHash("sha256").update(t).digest().slice(0,32),o=yx.createDecipheriv("aes-256-cbc",s,a),h=o.update(n,"hex","utf8");return h+=o.final("utf8"),h}catch(r){return mo.error(`Error decrypting value: ${r}`),e}}i(PJ,"QO");function DJ(e,t){let r={};for(let[a,n]of Object.entries(e))typeof n=="string"&&n?r[a]=PJ(n,t):r[a]=n;return r}i(DJ,"vM");const qe={info:i((e,...t)=>{lu.info({source:"client"},e,...t)},"info"),error:i((e,...t)=>{lu.error({source:"client"},e,...t)},"error"),warn:i((e,...t)=>{lu.warn({source:"client"},e,...t)},"warn"),debug:i((e,...t)=>{lu.debug({source:"client"},e,...t)},"debug")},LJ="elizaos-plugins",BJ="registry",zJ=`https://raw.githubusercontent.com/${LJ}/${BJ}/refs/heads/main/generated-registry.json`,UJ=["@elizaos/plugin-bootstrap","@elizaos/plugin-sql"];async function FJ(){try{const e=await fetch(zJ);if(!e.ok)throw new Error(`Failed to fetch registry: ${e.status}`);return await e.json()}catch(e){return qe.error("Failed to fetch plugin registry:",e),null}}i(FJ,"fetchPluginRegistry");function $J(e){return e.startsWith("@elizaos-plugins/")?e:e.replace("@elizaos/","@elizaos-plugins/")}i($J,"getRegistryPluginName");function Zo(e){return UJ.includes(e)}i(Zo,"isCorePlugin");function GJ(e,t){if(Zo(e))return null;if(!t)return qe.warn(`No registry data available for ${e}`),null;const r=$J(e),a=e;qe.debug(`Looking for ${e} in registry as ${r} or ${a}`);let n=t.registry[r];if(!n&&r!==a&&(n=t.registry[a],n&&qe.debug(`Found plugin under alternative name: ${a}`)),!n?.git?.repo)return qe.warn(`No GitHub repo found in registry for plugin: ${e} (tried ${r} and ${a})`),null;qe.debug(`Found repo info for ${e}: ${n.git.repo}`);const s=n.git.v1.branch?n.git.v1:n.git.v0,o=s?.branch||"main";s?.branch?qe.debug(`Branch for ${e}: ${o}`):qe.warn(`No branch information found for plugin: ${e}`);let h;const p=n.git.repo.match(/github\.com[:/]([^/]+\/[^/.]+)(\.git)?$/);if(p)h=p[1];else{const c=n.git.repo.match(/^([^/]+\/[^/.]+)$/);if(c)h=c[1];else return qe.warn(`Could not parse GitHub repo URL: ${n.git.repo}`),null}qe.debug(`Parsed owner/repo for ${e}: ${h}`);const v=`${h}/${o}`;return qe.debug(`Initial path for ${e}: ${v}`),v}i(GJ,"getGitHubRepoPath");async function VJ(e,t){if(Zo(e))return null;if(!t)return qe.warn(`No repo path available for plugin: ${e}`),null;qe.debug(`Starting package.json fetch for ${e} with initial path: ${t}`);const r=t.split("/"),a=r[0],n=r[1],s=r[2]||"main",o=e.replace("@elizaos/","");qe.debug(`Extracted parts - owner: ${a}, repo: ${n}, branch: ${s}, packageName: ${o}`);const h=[`${a}/${n}/${s}`,`${a}/${n}/main`,`${a}/${n}/master`,`${a}/${n}/1.x`,`${a}/${n}/v1`,`${a}/${n}/v2`,`${a}/${n}/${s}/packages/${o}`,`${a}/${n}/main/packages/${o}`,`${a}/${n}/master/packages/${o}`],p=[...new Set(h)];qe.debug(`Will try ${p.length} unique paths for ${e}:`,p);for(const v of p)try{const c=`https://raw.githubusercontent.com/${v}/package.json`;qe.debug(`Trying URL for ${e}: ${c}`);const d=await fetch(c);if(d.ok){const y=await d.json();return qe.debug(`✅ Found package.json for ${e} at ${c}`),y}else qe.debug(`❌ Failed to fetch ${e} from ${c}: HTTP ${d.status}`)}catch(c){qe.debug(`❌ Error fetching ${e} from ${v}: ${c instanceof Error?c.message:String(c)}`)}return qe.warn(`Could not find package.json for ${e} in any of the expected locations`),null}i(VJ,"fetchPluginPackageJson");function ZJ(e,t){if(Zo(e))return[];if(!t)return[];if(t?.agentConfig?.pluginParameters){const r=[];for(const[a,n]of Object.entries(t.agentConfig.pluginParameters))n.required===!0&&r.push({name:a,description:n.description,required:!0,example:n.example});return r}return t?.elizaos?.secrets?t.elizaos.secrets.filter(r=>r.required):t?.elizaos?.requiredSecrets?t.elizaos.requiredSecrets.map(r=>({name:r,required:!0})):[]}i(ZJ,"extractRequiredSecrets");function HJ(e){const t=J.useMemo(()=>[...e].sort().join(","),[e]);return Ar({queryKey:["plugin-details",t],queryFn:i(async()=>{qe.debug("[usePluginDetails] Starting fetch for plugins:",e);const r=[],a=e.filter(Zo),n=e.filter(s=>!Zo(s));if(qe.debug("[usePluginDetails] Core plugins:",a),qe.debug("[usePluginDetails] External plugins:",n),a.forEach(s=>{r.push({name:s,requiredSecrets:[]})}),n.length>0){const s=await FJ();if(qe.debug("[usePluginDetails] Registry data fetched:",s?"success":"failed"),s){const p=Object.keys(s.registry);qe.debug("[usePluginDetails] Available plugins in registry:",p)}const o=n.map(async p=>{const v=GJ(p,s),c=await VJ(p,v);return{name:p,packageJson:c}}),h=await Promise.all(o);for(const{name:p,packageJson:v}of h){const c=ZJ(p,v);r.push({name:p,requiredSecrets:c})}}return qe.debug("[usePluginDetails] Final details:",r),r},"queryFn"),enabled:e.length>0,staleTime:300*1e3,retry:2,refetchOnMount:!1,refetchOnWindowFocus:!1})}i(HJ,"usePluginDetails");function sN(e){const{data:t,isLoading:r,error:a}=HJ(e);return{requiredSecrets:J.useMemo(()=>t?t.reduce((s,o)=>(o.requiredSecrets.forEach(h=>{s.find(p=>p.name===h.name)||s.push({...h,plugin:o.name})}),s),[]):[],[t]),isLoading:r,error:a}}i(sN,"useRequiredSecrets");class ra extends Error{static{i(this,"ApiError")}code;details;status;constructor(t,r,a,n){super(r),this.code=t,this.details=a,this.status=n,this.name="ApiError"}}class kn{static{i(this,"BaseApiClient")}baseUrl;apiKey;timeout;defaultHeaders;constructor(t){this.baseUrl=t.baseUrl.replace(/\/$/,""),this.apiKey=t.apiKey,this.timeout=t.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...t.headers},this.apiKey&&(this.defaultHeaders["X-API-KEY"]=this.apiKey)}createNoContentResponse(){return{success:!0}}async request(t,r,a){let n;this.baseUrl?n=new URL(`${this.baseUrl}${r}`):typeof window<"u"&&window.location?n=new URL(r,window.location.origin):n=new URL(r,"http://localhost:3000"),a?.params&&Object.entries(a.params).forEach(([h,p])=>{p!=null&&n.searchParams.append(h,String(p))});const s=new AbortController,o=setTimeout(()=>s.abort(),this.timeout);try{const h={...this.defaultHeaders,...a?.config?.headers,...a?.headers};a?.body instanceof FormData&&delete h["Content-Type"];const p=await fetch(n.toString(),{method:t,headers:h,body:a?.body instanceof FormData?a.body:a?.body?JSON.stringify(a.body):void 0,signal:s.signal});if(clearTimeout(o),p.status===204||p.headers.get("content-length")==="0")return this.createNoContentResponse();let v;try{v=await p.json()}catch{if(p.ok)return this.createNoContentResponse();throw new ra("PARSE_ERROR","Failed to parse response as JSON",void 0,p.status)}if(!p.ok){const c=v?.error||{code:"HTTP_ERROR",message:`HTTP ${p.status}: ${p.statusText}`};throw new ra(c.code,c.message,c.details,p.status)}if(v&&typeof v=="object"&&"success"in v){const c=v;if(!c.success){const d="error"in c?c.error:{code:"UNKNOWN_ERROR",message:"An unknown error occurred"};throw new ra(d.code,d.message,d.details,p.status)}return c.data}else return v}catch(h){throw clearTimeout(o),h instanceof ra?h:h instanceof Error?h.name==="AbortError"?new ra("TIMEOUT","Request timed out"):new ra("NETWORK_ERROR",h.message):new ra("UNKNOWN_ERROR","An unknown error occurred")}}async get(t,r){return this.request("GET",t,r)}async post(t,r,a){return this.request("POST",t,{...a,body:r})}async put(t,r,a){return this.request("PUT",t,{...a,body:r})}async patch(t,r,a){return this.request("PATCH",t,{...a,body:r})}async delete(t,r){return this.request("DELETE",t,r)}}class JJ extends kn{static{i(this,"AgentsService")}async listAgents(){return this.get("/api/agents")}async getAgent(t){return this.get(`/api/agents/${t}`)}async createAgent(t){return this.post("/api/agents",t)}async updateAgent(t,r){return this.patch(`/api/agents/${t}`,r)}async deleteAgent(t){return this.delete(`/api/agents/${t}`)}async startAgent(t){return this.post(`/api/agents/${t}/start`)}async stopAgent(t){return this.post(`/api/agents/${t}/stop`)}async getWorlds(){return this.get("/api/agents/worlds")}async addAgentToWorld(t,r){return this.post(`/api/agents/${t}/worlds`,{worldId:r})}async updateAgentWorldSettings(t,r,a){return this.patch(`/api/agents/${t}/worlds/${r}`,{settings:a})}async getAgentPanels(t){const r=await this.get(`/api/agents/${t}/panels`);return{panels:(Array.isArray(r)?r:[]).map((n,s)=>({id:`${n.name}-${s}`,name:n.name,url:n.path,type:"plugin"}))}}async getAgentLogs(t,r){return this.get(`/api/agents/${t}/logs`,{params:r})}async deleteAgentLog(t,r){return this.delete(`/api/agents/${t}/logs/${r}`)}async getAgentsForServer(t){return this.get(`/api/messaging/servers/${t}/agents`)}async addAgentToServer(t,r){return this.post(`/api/messaging/servers/${t}/agents`,{agentId:r})}async removeAgentFromServer(t,r){return this.delete(`/api/messaging/servers/${t}/agents/${r}`)}async getServersForAgent(t){return this.get(`/api/messaging/agents/${t}/servers`)}}class qJ extends kn{static{i(this,"MessagingService")}async submitMessage(t){return this.post("/api/messaging/submit",t)}async completeMessage(t){return this.post("/api/messaging/complete",t)}async ingestExternalMessages(t){return this.post("/api/messaging/ingest-external",t)}async createChannel(t){const r={name:t.name,type:t.type,server_id:t.serverId||"00000000-0000-0000-0000-000000000000",metadata:t.metadata};return this.post("/api/messaging/central-channels",r)}async createGroupChannel(t){const r="00000000-0000-0000-0000-000000000000";let a,n,s;if(t.metadata){const h={...t.metadata};"server_id"in h&&(n=h.server_id,delete h.server_id),"type"in h&&(s=h.type,delete h.type),Object.keys(h).length>0&&(a=h)}const o={name:t.name,server_id:n||r,participantCentralUserIds:t.participantIds,...s?{type:s}:{},...a?{metadata:a}:{}};return this.post("/api/messaging/central-channels",o)}async getOrCreateDmChannel(t){const[r,a]=t.participantIds,n={currentUserId:r,targetUserId:a,dmServerId:"00000000-0000-0000-0000-000000000000"};return this.get("/api/messaging/dm-channel",{params:n})}async getChannelDetails(t){return this.get(`/api/messaging/central-channels/${t}/details`)}async getChannelParticipants(t){return this.get(`/api/messaging/central-channels/${t}/participants`)}async addAgentToChannel(t,r){return this.post(`/api/messaging/central-channels/${t}/agents`,{agentId:r})}async removeAgentFromChannel(t,r){return this.delete(`/api/messaging/central-channels/${t}/agents/${r}`)}async deleteChannel(t){return this.delete(`/api/messaging/central-channels/${t}`)}async clearChannelHistory(t){return this.delete(`/api/messaging/central-channels/${t}/messages`)}async postMessage(t,r,a){return this.post(`/api/messaging/central-channels/${t}/messages`,{content:r,metadata:a})}async getChannelMessages(t,r){return this.get(`/api/messaging/central-channels/${t}/messages`,{params:r})}async getMessage(t){return this.get(`/api/messaging/messages/${t}`)}async deleteMessage(t,r){return this.delete(`/api/messaging/central-channels/${t}/messages/${r}`)}async updateMessage(t,r){return this.patch(`/api/messaging/messages/${t}`,{content:r})}async searchMessages(t){return this.post("/api/messaging/messages/search",t)}async listServers(){return this.get("/api/messaging/central-servers")}async getServerChannels(t){return this.get(`/api/messaging/central-servers/${t}/channels`)}async createServer(t){return this.post("/api/messaging/servers",t)}async syncServerChannels(t,r){return this.post(`/api/messaging/servers/${t}/sync-channels`,r)}async deleteServer(t){return this.delete(`/api/messaging/servers/${t}`)}async updateChannel(t,r){return this.patch(`/api/messaging/central-channels/${t}`,r)}async generateChannelTitle(t,r){return this.post(`/api/messaging/central-channels/${t}/generate-title`,{agentId:r})}async addUserToChannel(t,r){const a=await this.getChannelDetails(t),n=a.metadata?.participantCentralUserIds||[];if(!n.includes(r)){const s=[...n,r];return this.updateChannel(t,{participantCentralUserIds:s})}return{success:!0,data:a}}async addUsersToChannel(t,r){const s=[...(await this.getChannelDetails(t)).metadata?.participantCentralUserIds||[]];for(const o of r)s.includes(o)||s.push(o);return this.updateChannel(t,{participantCentralUserIds:s})}async removeUserFromChannel(t,r){const s=((await this.getChannelDetails(t)).metadata?.participantCentralUserIds||[]).filter(o=>o!==r);return this.updateChannel(t,{participantCentralUserIds:s})}}class KJ extends kn{static{i(this,"MemoryService")}async getAgentMemories(t,r){return this.get(`/api/memory/${t}/memories`,{params:r})}async getRoomMemories(t,r,a){return this.get(`/api/memory/${t}/rooms/${r}/memories`,{params:a})}async updateMemory(t,r,a){return this.patch(`/api/memory/${t}/memories/${r}`,a)}async clearAgentMemories(t){return this.delete(`/api/memory/${t}/memories`)}async clearRoomMemories(t,r){return this.delete(`/api/memory/${t}/memories/all/${r}`)}async listAgentRooms(t){return this.get(`/api/memory/${t}/rooms`)}async getRoom(t,r){return this.get(`/api/memory/${t}/rooms/${r}`)}async createRoom(t,r){return this.post(`/api/memory/${t}/rooms`,r)}async createWorldFromServer(t,r){return this.post(`/api/memory/groups/${t}`,r)}async deleteWorld(t){return this.delete(`/api/memory/groups/${t}`)}async clearWorldMemories(t){return this.delete(`/api/memory/groups/${t}/memories`)}async deleteMemory(t,r){return this.delete(`/api/memory/${t}/memories/${r}`)}async getAgentInternalMemories(t,r,a){return this.get(`/api/memory/${t}/rooms/${r}/memories`,{params:{includeEmbedding:a}})}async deleteAgentInternalMemory(t,r){return this.delete(`/api/memory/${t}/memories/${r}`)}async deleteAllAgentInternalMemories(t,r){return this.delete(`/api/memory/${t}/memories/all/${r}`)}async updateAgentInternalMemory(t,r,a){return this.patch(`/api/memory/${t}/memories/${r}`,a)}async deleteGroupMemory(t,r){return this.delete(`/api/messaging/central-channels/${t}/messages/${r}`)}async clearGroupChat(t){return this.delete(`/api/messaging/central-channels/${t}/messages`)}}class XJ extends kn{static{i(this,"AudioService")}async requestBinary(t,r,a){let n;this.baseUrl?n=new URL(`${this.baseUrl}${r}`):typeof window<"u"&&window.location?n=new URL(r,window.location.origin):n=new URL(r,"http://localhost:3000"),a?.params&&Object.entries(a.params).forEach(([h,p])=>{p!=null&&n.searchParams.append(h,String(p))});const s=new AbortController,o=setTimeout(()=>s.abort(),this.timeout);try{const h={...this.defaultHeaders,...a?.headers};a?.body instanceof FormData&&delete h["Content-Type"];const p=await fetch(n.toString(),{method:t,headers:h,body:a?.body instanceof FormData?a.body:a?.body?JSON.stringify(a.body):void 0,signal:s.signal});if(clearTimeout(o),!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return await p.arrayBuffer()}catch(h){throw clearTimeout(o),h instanceof Error?h.name==="AbortError"?new Error("Request timed out"):h:new Error("An unknown error occurred")}}processAudioInput(t){if(t instanceof Blob)return t;if(typeof t=="string"){if(t.startsWith("data:"))try{const[a,n]=t.split(","),s=a.match(/data:([^;]+)/),o=s?s[1]:"audio/wav",h=atob(n),p=new Uint8Array(h.length);for(let v=0;v<h.length;v++)p[v]=h.charCodeAt(v);return new Blob([p],{type:o})}catch(a){throw new Error(`Invalid base64 data URL: ${a instanceof Error?a.message:"Unknown error"}`)}if(this.isBase64String(t))try{const a=atob(t),n=new Uint8Array(a.length);for(let s=0;s<a.length;s++)n[s]=a.charCodeAt(s);return new Blob([n],{type:"audio/wav"})}catch{return t}return t}if(this.isBuffer(t))return new Blob([new Uint8Array(t)],{type:"audio/wav"});const r=t;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 t}. Expected Blob, Buffer, ArrayBuffer, or string.`)}isBase64String(t){const r=/^[A-Za-z0-9+/]*={0,2}$/;return t.length<4||t.length%4!==0?!1:r.test(t)}isBuffer(t){return t!=null&&typeof t=="object"&&typeof t.constructor=="function"&&t.constructor.name==="Buffer"&&typeof t.readUInt8=="function"}async speechConversation(t,r){const a=new FormData,n=this.processAudioInput(r.audio);return n instanceof Blob,a.append("file",n),r.format&&a.append("format",r.format),r.language&&a.append("language",r.language),r.metadata&&a.append("metadata",JSON.stringify(r.metadata)),this.request("POST",`/api/audio/${t}/speech/conversation`,{body:a})}async generateSpeech(t,r){const a=await this.requestBinary("POST",`/api/audio/${t}/speech/generate`,{body:r}),n=new Uint8Array(a);let s="";for(let p=0;p<n.byteLength;p++)s+=String.fromCharCode(n[p]);return{audio:btoa(s),format:"mpeg"}}async synthesizeAudioMessage(t,r){return this.post(`/api/audio/${t}/audio-messages/synthesize`,r)}async transcribe(t,r){const a=new FormData,n=this.processAudioInput(r.audio);return n instanceof Blob,a.append("file",n),r.format&&a.append("format",r.format),r.language&&a.append("language",r.language),this.request("POST",`/api/audio/${t}/transcriptions`,{body:a})}async processSpeech(t,r,a){const n=new FormData,s=this.processAudioInput(r);return s instanceof Blob,n.append("file",s),a&&n.append("metadata",JSON.stringify(a)),this.request("POST",`/api/audio/${t}/speech`,{body:n})}}class WJ extends kn{static{i(this,"MediaService")}async uploadAgentMedia(t,r){const a=new FormData;return a.append("file",r.file,r.filename),r.contentType&&a.append("contentType",r.contentType),r.metadata&&a.append("metadata",JSON.stringify(r.metadata)),this.request("POST",`/api/media/agents/${t}/upload-media`,{body:a})}async uploadChannelMedia(t,r){const a=new FormData;return a.append("file",r),this.request("POST",`/api/messaging/central-channels/${t}/upload-media`,{body:a})}}class QJ extends kn{static{i(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(t){return this.post("/api/server/logs",{logs:t})}async clearLogs(){return this.delete("/api/server/logs")}}class YJ extends kn{static{i(this,"SystemService")}async getEnvironment(){return this.get("/api/system/env/local")}async updateLocalEnvironment(t){if(!t||typeof t!="object")throw new Error("updateLocalEnvironment requires a configuration object");let r;return"variables"in t?r={content:t.variables}:"content"in t?r={content:t.content}:r={content:t},this.post("/api/system/env/local",r)}async getGlobalLogs(t){const r=await fetch(this.buildUrl("/api/server/logs",{params:t}),{method:"GET",headers:this.getHeaders()});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);const a=await r.json();return{logs:a.logs||[],count:a.count||0,total:a.total||0,level:a.requestedLevel||a.level||"all",levels:a.levels||[]}}buildUrl(t,r){const a=new URL(`${this.baseUrl}${t}`);return r?.params&&Object.entries(r.params).forEach(([n,s])=>{s!=null&&a.searchParams.append(n,String(s))}),a.toString()}getHeaders(){return{...this.defaultHeaders}}async deleteGlobalLogs(){return this.delete("/api/server/logs")}async deleteLog(t){throw new Error("Individual log deletion is not supported. Use deleteGlobalLogs() to clear all logs.")}}function h3(e,t){if(!e)return;let r;if(e instanceof Date)r=e.getTime();else if(typeof e=="string"){if(r=new Date(e).getTime(),isNaN(r)){console.warn(`Invalid date string for ${t}: ${e}`);return}}else if(typeof e=="number")r=e;else{console.warn(`Invalid type for ${t}: ${typeof e}`);return}return r.toString()}i(h3,"toTimestampString");function zs(e,t){if(!e||e.trim()==="")throw new Error(`${t} is required and cannot be empty`)}i(zs,"validateRequiredParam");class eq extends kn{static{i(this,"SessionsService")}async checkHealth(){return this.get("/api/messaging/sessions/health")}async createSession(t){return this.post("/api/messaging/sessions",t)}async getSession(t){return zs(t,"sessionId"),this.get(`/api/messaging/sessions/${t}`)}async sendMessage(t,r){return zs(t,"sessionId"),zs(r?.content,"content"),this.post(`/api/messaging/sessions/${t}/messages`,r)}async getMessages(t,r){zs(t,"sessionId");const a={};r?.limit&&(a.limit=r.limit.toString());const n=h3(r?.before,"before");n&&(a.before=n);const s=h3(r?.after,"after");return s&&(a.after=s),this.get(`/api/messaging/sessions/${t}/messages`,{params:a})}async deleteSession(t){return zs(t,"sessionId"),this.delete(`/api/messaging/sessions/${t}`)}async listSessions(){return this.get("/api/messaging/sessions")}}class tq extends kn{static{i(this,"RunsService")}async listRuns(t,r){return this.get(`/api/agents/${t}/runs`,{params:r})}async getRun(t,r,a){return this.get(`/api/agents/${t}/runs/${r}`,{params:a?{roomId:a}:void 0})}}class Gb{static{i(this,"ElizaClient")}agents;messaging;memory;audio;media;server;system;sessions;runs;constructor(t){this.agents=new JJ(t),this.messaging=new qJ(t),this.memory=new KJ(t),this.audio=new XJ(t),this.media=new WJ(t),this.server=new QJ(t),this.system=new YJ(t),this.sessions=new eq(t),this.runs=new tq(t)}static create(t){return new Gb(t)}}function rq(){const e=i(()=>`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey"),t=localStorage.getItem(e()),r={baseUrl:window.location.origin,timeout:3e4,headers:{Accept:"application/json"}};return t&&(r.apiKey=t),r}i(rq,"createApiClientConfig");let Cu=null;function Yt(){return Cu||(Cu=Gb.create(rq())),Cu}i(Yt,"createElizaClient");function iq(){Cu=null}i(iq,"resetElizaClient");function nq(e){const t=i(()=>`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey");e?localStorage.setItem(t(),e):localStorage.removeItem(t()),iq()}i(nq,"updateApiClientApiKey");const aq="elizaos-plugins",sq="registry",oq=`https://raw.githubusercontent.com/${aq}/${sq}/refs/heads/main/generated-registry.json`;function oN(){return Ar({queryKey:["plugins"],queryFn:i(async()=>{try{const e=Yt(),[t,r]=await Promise.all([fetch(oq),e.agents.listAgents()]),a=await t.json(),n=Object.entries(a.registry||{}).filter(([h,p])=>{const v=h.includes("plugin"),c=p.supports.v1===!0,d=p.npm.v1!==null||p.git.v1.version!==null&&p.git.v1.branch!==null;return v&&c&&d}).map(([h])=>h.replace(/^@elizaos-plugins\//,"@elizaos/")).sort();let s=[];try{const h=r?.agents||[];if(h.length>0){const p=h.find(v=>v.status==="active");if(p&&p.id){const c=(await e.agents.getAgent(p.id))?.plugins;Array.isArray(c)&&(s=c)}}}catch(h){qe.warn("Could not fetch agent plugins:",h)}return[...new Set([...n,...s])].sort()}catch(e){return qe.error("Failed to fetch from registry, falling back to basic list:",e),["@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(t=>t.includes("plugin")).sort()}},"queryFn")})}i(oN,"usePlugins");const lq={google:"@elizaos/plugin-google-genai",llama_local:"@elizaos/plugin-ollama"},uq={},fq=["@elizaos/plugin-sql","@elizaos/plugin-bootstrap"];function cq(){const{data:e=[]}=oN(),t=i(n=>{const s=new Set;if(Array.isArray(n.clients))for(const h of n.clients){const p=h.toLowerCase(),v=uq[p];if(v&&e.includes(v))s.add(v);else{const c=`@elizaos/plugin-${p}`;e.includes(c)&&s.add(c)}}let o=!1;if(typeof n.modelProvider=="string"){const h=n.modelProvider.toLowerCase(),p=lq[h];if(p&&e.includes(p))s.add(p),o=!0;else{const v=`@elizaos/plugin-${h}`;e.includes(v)&&(s.add(v),o=!0)}o||e.includes("@elizaos/plugin-openai")&&s.add("@elizaos/plugin-openai")}else e.includes("@elizaos/plugin-openai")&&s.add("@elizaos/plugin-openai");for(const h of fq)e.includes(h)&&s.add(h);return Array.from(s).sort()},"matchPlugins");function r(n){return typeof n=="object"&&n!==null&&"user"in n}return i(r,"isV1MessageExampleFormat"),{convertCharacter:i(n=>{const s=[...Array.isArray(n.bio)?n.bio:n.bio?[n.bio]:[],...n.lore??[]],o=(n.messageExamples??[]).map(v=>v.map(c=>r(c)?{name:c.user,content:c.content}:c))??[],h=t(n);return{name:n.name,username:n.username,system:n.system,settings:n.settings,plugins:h,bio:s,topics:n.topics,style:n.style,adjectives:n.adjectives,messageExamples:o,postExamples:n.postExamples}},"convertCharacter")}}i(cq,"useConvertCharacter");const dq=i((e=768)=>{const t=J.useRef(null),[r,a]=J.useState(!0),n=J.useRef(null),s=J.useRef(0);return J.useEffect(()=>{const o=t.current;if(!o)return;const h=i(v=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{const c=v>=e;a(d=>d!==c?c:d),s.current=v},150)},"handleResize"),p=new ResizeObserver(v=>{for(const c of v){const{width:d}=c.contentRect;Math.abs(d-s.current)>5&&h(d)}});return p.observe(o),setTimeout(()=>{const{width:v}=o.getBoundingClientRect();s.current=v,a(v>=e)},0),()=>{p.disconnect(),n.current&&clearTimeout(n.current)}},[e]),{containerRef:t,showLabels:r}},"useContainerWidth");function lN({characterValue:e,setCharacterValue:t,title:r,description:a,onSubmit:n,onDelete:s,onReset:o,onStopAgent:h,isDeleting:p=!1,isStopping:v=!1,customComponents:c=[],onTemplateChange:d,secretPanelRef:y}){const{toast:b}=rr(),{data:x,isLoading:k}=mT(),[N,C]=J.useState(!1),[R,O]=J.useState("none"),[T,P]=J.useState("basic"),z=J.useRef(null),[Z,V]=J.useState(!1),[ee,$]=J.useState(!1),[F,u]=J.useState(!1),[g,l]=J.useState(null),[m,w]=J.useState({}),M=J.useMemo(()=>e?.plugins||[],[e?.plugins]),{requiredSecrets:j}=sN(M),{convertCharacter:S}=cq();J.useEffect(()=>{i(async()=>{try{const te=await Yt().system.getEnvironment();w(te||{})}catch(Y){console.error("Failed to fetch global environment variables:",Y),w({})}},"fetchGlobalEnvs")()},[]);const{containerRef:f,showLabels:_}=dq(640),E=J.useCallback(()=>{const Q=z.current;if(!Q)return;const{scrollLeft:Y,scrollWidth:te,clientWidth:he}=Q;V(Y>0),$(Y+he<te-1)},[]);J.useEffect(()=>{const Q=z.current;if(Q)return E(),Q.addEventListener("scroll",E),window.addEventListener("resize",E),()=>{Q.removeEventListener("scroll",E),window.removeEventListener("resize",E)}},[E,c.length]);const I=i(Q=>{const Y=z.current;if(!Y)return;const te=Y.clientWidth*.8;Y.scrollBy({left:Q==="left"?-te:te,behavior:"smooth"})},"scrollTabs"),D=J.useMemo(()=>{const Q=n7();return x&&!k?[...Q.filter(te=>te.provider!=="elevenlabs"),...x]:Q},[x,k]),L=J.useMemo(()=>[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The primary identifier for this agent",fieldType:"text",getValue:i(Q=>Q.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:i(Q=>Q.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:i(Q=>Q.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:i(Q=>Q.settings?.voice?.model||"","getValue"),options:D.map(Q=>({value:Q.value,label:Q.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:i(Q=>Array.isArray(Q.bio)?Q.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:i(Q=>Q.topics||[],"getData"),tooltip:"Subject domains the agent can discuss with confidence."},{title:"Adjectives",description:"Descriptive personality traits",path:"adjectives",getData:i(Q=>Q.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:i(Q=>Q.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:i(Q=>Q.style?.chat||[],"getData"),tooltip:"Writing style specific to conversational exchanges."},{title:"Post Style",description:"Style for long-form content",path:"style.post",getData:i(Q=>Q.style?.post||[],"getData"),tooltip:"Writing style for structured content such as articles or posts."}]}],[D]),U=i(Q=>{const{name:Y,value:te,type:he}=Q.target,oe=Q.target.checked;if(he==="checkbox")t.updateField(Y,oe);else if(Y.startsWith("settings.")){const ue=Y.substring(9);t.updateSetting?t.updateSetting(ue,te):t.updateField(Y,te)}else t.updateField(Y,te)},"handleChange"),B=i((Q,Y)=>{if(Y.startsWith("settings.")){const te=Y.substring(9);if(t.updateSetting){if(t.updateSetting(te,Q),te==="voice.model"&&Q){const he=Qm(Q);if(he){const oe=Array.isArray(e.plugins)?[...e.plugins]:[],ue=Qm(e.settings?.voice?.model),ze=r7[he.provider],we=[...oe];ze&&!oe.includes(ze)&&we.push(ze),t.setPlugins?t.setPlugins(we):t.updateField&&t.updateField("plugins",we),ue?.provider!==he.provider&&b({title:"Plugin Updated",description:`${ze} plugin has been set for the selected voice model.`})}}}else t.updateField(Y,Q)}else t.updateField(Y,Q)},"handleVoiceModelChange"),G=i((Q,Y)=>{if(!Q.includes(".")){t.updateField(Q,Y);return}const te=Q.split(".");if(te.length===2&&te[0]==="style"){t.setStyleArray?t.setStyleArray(te[1],Y):t.updateField(Q,Y);return}t.updateField(Q,Y)},"updateArray"),H=i(async Q=>{if(Q.settings?.avatar){const Y=new Image;if(Y.src=Q.settings.avatar,await new Promise(te=>Y.onload=te),Y.width>bo||Y.height>bo){const he=await(await fetch(Q.settings.avatar)).blob(),oe=new File([he],"avatar.jpg",{type:he.type}),ue=await V_(oe);return{...Q,settings:{...Q.settings,avatar:ue}}}}return Q},"ensureAvatarSize"),K=i(async Q=>{Q.preventDefault(),C(!0);try{const Y=await H(e);let te=[];if(y?.current)te=y.current.validateSecrets().missingSecrets;else{const he=Y.settings?.secrets,oe=he&&typeof he=="object"&&!Array.isArray(he)?he:{};te=j.filter(ue=>{const ze=oe[ue.name];if(ze&&typeof ze=="string"&&ze.trim()!=="")return!1;const we=m[ue.name];return!(we&&we.trim()!=="")}).map(ue=>ue.name)}if(te.length>0){C(!1),l(Y),u(!0);return}await n(Y)}catch(Y){b({title:"Error",description:Y instanceof Error?Y.message:"Failed to update agent",variant:"destructive"})}finally{C(!1)}},"handleFormSubmit"),_e=i(async()=>{if(u(!1),g){C(!0);try{await n(g)}catch(Q){b({title:"Error",description:Q instanceof Error?Q.message:"Failed to update agent",variant:"destructive"})}finally{C(!1),l(null)}}},"handleConfirmSaveWithMissingSecrets"),se=i(()=>{u(!1),l(null),P("custom-Secret")},"handleCancelSaveWithMissingSecrets"),ae=i(Q=>A.jsxs("div",{className:`w-full ${Q.name==="name"?"agent-form-name":""} ${Q.name==="system"?"agent-form-system-prompt":""}`,children:[A.jsxs(ts,{htmlFor:Q.name,className:"text-sm font-normal block mb-2",children:[Q.title,Q.name in Ua&&Ua[Q.name]===yu.REQUIRED&&A.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),Q.fieldType==="textarea"?A.jsx(Wo,{id:Q.name,name:Q.name,value:Q.getValue(e),onChange:U,className:"min-h-[120px] resize-y"}):Q.fieldType==="checkbox"?A.jsx(hr,{id:Q.name,name:Q.name,type:"checkbox",checked:e[Q.name]==="true",onChange:U}):Q.fieldType==="select"?A.jsxs(xn,{name:Q.name,value:Q.getValue(e),onValueChange:i(Y=>B(Y,Q.name),"onValueChange"),children:[A.jsx(Gi,{children:A.jsx(_n,{placeholder:Q.name.includes("voice.model")&&k?"Loading voice models...":"Select a voice model"})}),A.jsx(Vi,{children:Q.name==="settings.voice.model"?A.jsxs(A.Fragment,{children:[A.jsx(Xc,{children:A.jsx(Qt,{value:"none",children:"No Voice"})}),A.jsx(Wm,{}),A.jsxs(Xc,{children:[A.jsx(Xm,{children:"OpenAI Voices"}),i7.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label.replace("OpenAI - ","")},Y.value))]}),A.jsx(Wm,{}),A.jsxs(Xc,{children:[A.jsx(Xm,{children:"ElevenLabs Voices"}),vv.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label.replace("ElevenLabs - ","")},Y.value)),x&&x.length>0&&x.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label.replace("ElevenLabs - ","")},Y.value))]})]}):Q.options?.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label},Y.value))})]}):A.jsx(hr,{id:Q.name,name:Q.name,type:Q.fieldType,value:Q.getValue(e),onChange:U}),Q.description&&A.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Q.description})]},Q.name),"renderInputField"),ve=i(Q=>A.jsxs("div",{className:"w-full",children:[A.jsxs(ts,{htmlFor:Q.path,className:"text-sm font-normal block mb-2",children:[Q.title,Q.path in Ua&&Ua[Q.path]===yu.REQUIRED&&A.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),A.jsx(iT,{data:Q.getData(e),onChange:i(Y=>G(Q.path,Y),"onChange")}),Q.description&&A.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Q.description})]},Q.path),"renderArrayField"),q=i(()=>{gv(e,b)},"handleExportJSON");function ne(Q){return typeof Q=="object"&&Q!==null&&("lore"in Q||"clients"in Q||"modelProvider"in Q)}i(ne,"isV1Character");const X=i(async Q=>{const Y=Q.target.files?.[0];if(Y)try{const te=await Y.text();let he=JSON.parse(te);ne(he)&&(he=S(he));const oe=Object.keys(Ua).filter(ue=>{if(Ua[ue]!==yu.REQUIRED)return!1;const ze=ue.split(".");let we=he;for(const Be of ze)if(we=we?.[Be],we===void 0)return!0;return!1});if(oe.length>0){b({title:"Import Failed",description:`Missing required fields: ${oe.join(", ")}`,variant:"destructive"});return}t.importAgent?t.importAgent(he):console.warn("Missing importAgent method"),b({title:"Agent Imported",description:"Agent data has been successfully loaded."})}catch(te){b({title:"Import Failed",description:te instanceof Error?te.message:"Invalid JSON file",variant:"destructive"})}finally{Q.target.value=""}},"handleImportJSON"),W=J.useRef(null),le=i(()=>{W.current?.click()},"handleImportClick"),ke=J.useMemo(()=>{const Q=[];return h&&Q.push({label:"Stop Agent",description:"Stop running",onClick:h}),s&&Q.push({label:"Delete Agent",description:"Delete permanently",onClick:i(()=>s(),"onClick")}),Q},[h,s]),be=J.useCallback(Q=>{if(O(Q),Q==="none"&&o){o();return}const Y=s7(Q);Y&&t.importAgent&&(t.importAgent(Y.template),d?.())},[o,t,d]),fe=[...L.map(Q=>({value:Q.sectionValue,label:Q.sectionTitle,shortLabel:Q.sectionTitle.split(" ")[0]})),...c.map(Q=>({value:`custom-${Q.name}`,label:Q.name,shortLabel:Q.shortLabel||Q.name.split(" ")[0]}))];return A.jsxs("div",{ref:f,className:"w-full max-w-full mx-auto p-6 sm:p-8 h-full overflow-y-auto",children:[(r||a)&&A.jsxs("div",{className:"mb-8",children:[r&&A.jsx("h1",{className:"text-2xl font-semibold mb-2",children:r}),a&&A.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:a})]}),A.jsxs("div",{className:"mb-8",children:[A.jsx(ts,{htmlFor:"template-selector",className:"text-sm",children:"Start with a template"}),A.jsxs(xn,{value:R,onValueChange:be,children:[A.jsx(Gi,{className:"w-full mt-1",children:A.jsx(_n,{placeholder:"None (blank start)"})}),A.jsx(Vi,{children:a7.map(Q=>A.jsx(Qt,{value:Q.id,children:A.jsx(es,{children:A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsx("span",{className:"w-full text-left",children:Q.label})}),A.jsx(lr,{side:"right",children:A.jsx("p",{className:"max-w-xs",children:Q.description})})]})})},Q.id))})]})]}),A.jsxs("form",{onSubmit:K,children:[A.jsxs(mv,{value:T,onValueChange:P,className:"w-full",children:[A.jsxs("div",{className:"relative mb-4",children:[Z&&A.jsx(et,{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:i(()=>I("left"),"onClick"),children:A.jsx(RC,{className:"h-4 w-4"})}),A.jsx("div",{ref:z,className:"overflow-x-auto scrollbar-hide",children:A.jsx(If,{className:"inline-flex h-10 items-center justify-start text-muted-foreground w-full",children:fe.map(Q=>A.jsx(xo,{value:Q.value,className:Le("whitespace-nowrap",!_&&"px-2 text-xs"),children:_?Q.label:Q.shortLabel},Q.value))})}),ee&&A.jsx(et,{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:i(()=>I("right"),"onClick"),children:A.jsx(n_,{className:"h-4 w-4"})})]}),A.jsxs("div",{className:"max-h-[100vh] overflow-y-auto pb-4 px-1",children:[L.map(Q=>A.jsx(wi,{value:Q.sectionValue,className:"space-y-6 mt-0 focus:outline-none",children:Q.sectionType==="input"?Q.fields.map(ae):Q.fields.map(ve)},Q.sectionValue)),c.map(Q=>A.jsx(wi,{value:`custom-${Q.name}`,className:"mt-0 focus:outline-none",children:A.jsx("div",{className:"h-full",children:Q.component})},`custom-${Q.name}`))]})]}),A.jsxs("div",{className:"flex items-center justify-between w-full mt-6",children:[A.jsxs(_o,{children:[A.jsx(So,{asChild:!0,children:A.jsxs(et,{type:"button",variant:"outline",size:"icon",className:"flex-shrink-0 p-2.5",children:[A.jsx(a_,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"More options"})]})}),A.jsxs(Mo,{align:"start",side:"top",children:[A.jsxs(Fi,{onClick:le,children:[A.jsx(OC,{className:"h-4 w-4 mr-2"}),"Import"]}),A.jsxs(Fi,{onClick:q,children:[A.jsx(s_,{className:"h-4 w-4 mr-2"}),"Export"]}),ke.length>0&&A.jsx(Uu,{}),ke.length>0&&ke.map(Q=>{const Y=Q.label==="Stop Agent",te=Q.label==="Delete Agent",he=Y?v:te?p:!1;return A.jsxs(Fi,{onClick:Q.onClick,disabled:he,className:te?"text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50":"",children:[he?A.jsx(kr,{className:"h-4 w-4 animate-spin mr-2"}):Y?A.jsx(ev,{className:"h-4 w-4 mr-2"}):A.jsx(qo,{className:"h-4 w-4 mr-2"}),he?`${Y?"Stopping":"Deleting"}...`:Q.label]},Q.label)})]})]}),A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsx(es,{children:A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsxs(et,{type:"button",variant:"outline",onClick:i(()=>{o?.()},"onClick"),children:[A.jsx(o_,{className:"h-4 w-4"}),A.jsx("span",{className:"ml-2",children:"Reset"})]})}),A.jsx(lr,{children:A.jsx("p",{children:"Reset all form fields to their original values"})})]})}),A.jsx(es,{children:A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsx(et,{type:"submit",disabled:N,className:"agent-form-submit",children:N?A.jsxs(A.Fragment,{children:[A.jsx(kr,{className:"h-4 w-4 animate-spin"}),A.jsx("span",{className:"ml-2",children:"Saving..."})]}):A.jsxs(A.Fragment,{children:[A.jsx(l_,{className:"h-4 w-4"}),A.jsx("span",{className:"ml-2",children:"Save"})]})})}),A.jsx(lr,{children:A.jsx("p",{children:"Save all changes to the agent configuration"})})]})})]}),A.jsx("input",{ref:W,type:"file",accept:".json",onChange:X,className:"hidden"})]})]}),A.jsx(bT,{open:F,onOpenChange:u,missingSecrets:(()=>{let Q=[];if(y?.current)Q=y.current.validateSecrets().missingSecrets;else{const Y=e.settings?.secrets,te=Y&&typeof Y=="object"&&!Array.isArray(Y)?Y:{};Q=j.filter(he=>{const oe=te[he.name];if(oe&&typeof oe=="string"&&oe.trim()!=="")return!1;const ue=m[he.name];return!(ue&&ue.trim()!=="")}).map(he=>he.name)}return Q.map(Y=>{const te=j.find(he=>he.name===Y);return{name:Y,plugin:te?.plugin,description:te?.description}})})(),onConfirm:_e,onCancel:se})]})}i(lN,"CharacterForm");function uN({characterValue:e,setCharacterValue:t}){const r=i(()=>{const d=e?.settings?.avatar;return typeof d=="string"?d:null},"getAvatarUrl"),[a,n]=J.useState(r()),[s,o]=J.useState(!1),h=J.useRef(null);J.useEffect(()=>{n(r()),o(!1)},[e.id]);const p=i(async d=>{const y=d.target.files?.[0];if(y)try{const b=await V_(y);n(b),o(!0),c(b)}catch(b){console.error("Error compressing image:",b)}},"handleFileUpload"),v=i(()=>{a&&(n(null),o(!0),c(""))},"handleRemoveAvatar"),c=i(d=>{t.updateAvatar?t.updateAvatar(d):t.updateSetting?t.updateSetting("avatar",d):t.updateField&&t.updateField("settings.avatar",d)},"updateCharacterAvatar");return A.jsxs("div",{className:"rounded-lg w-full",children:[A.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Avatar Settings"}),A.jsxs("div",{className:"flex flex-col items-center gap-4 pb-4 max-w-sm mx-auto",children:[a?A.jsx("div",{className:"w-64 h-64 mb-2",children:A.jsx("img",{src:a,alt:"Agent Avatar",className:"object-cover w-full h-full rounded-lg border"})}):A.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:i(()=>h.current?.click(),"onClick"),children:A.jsxs("div",{className:"flex flex-col items-center gap-2",children:[A.jsx(TC,{className:"w-10 h-10"}),A.jsx("span",{className:"text-sm",children:"Click to upload"})]})}),A.jsxs("div",{className:"flex flex-col gap-3 w-64",children:[A.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:h,onChange:p}),A.jsxs("div",{className:"flex gap-2",children:[A.jsxs(et,{type:"button",className:"flex items-center gap-2 flex-1",onClick:i(()=>h.current?.click(),"onClick"),children:[A.jsx(PC,{className:"w-5 h-5"}),a?"Replace":"Upload"]}),a&&A.jsx(et,{type:"button",variant:"outline",className:"flex items-center",onClick:v,children:A.jsx(Fr,{className:"w-5 h-5"})})]}),A.jsxs("div",{className:"flex items-center justify-center gap-1 text-xs text-muted-foreground mt-1",children:[A.jsx(tv,{className:"w-3.5 h-3.5"}),A.jsxs("span",{children:["Images greater than ",bo,"x",bo," will be resized"]})]})]})]})]})}i(uN,"AvatarPanel");const Vb=D5,hq=L5,pq=B5,fN=J.forwardRef(({className:e,...t},r)=>A.jsx(bf,{ref:r,className:Le("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",e),...t}));fN.displayName=bf.displayName;const wc=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(pq,{children:[A.jsx(fN,{}),A.jsxs(vf,{ref:a,className:Le("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",e),...r,children:[t,A.jsxs(z5,{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:[A.jsx(Fr,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wc.displayName=vf.displayName;const xc=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col space-y-1.5 text-center sm:text-left",e),...t}),"DialogHeader");xc.displayName="DialogHeader";const Zb=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t}),"DialogFooter");Zb.displayName="DialogFooter";const _c=J.forwardRef(({className:e,...t},r)=>A.jsx(yf,{ref:r,className:Le("text-lg font-semibold leading-none tracking-tight",e),...t}));_c.displayName=yf.displayName;const Hb=J.forwardRef(({className:e,...t},r)=>A.jsx(wf,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));Hb.displayName=wf.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 cN({characterValue:e,setCharacterValue:t,initialPlugins:r}){const{data:a,error:n}=oN(),{toast:s}=rr(),[o,h]=J.useState(""),[p,v]=J.useState(!1),[c,d]=J.useState(null),[y,b]=J.useState(!1),x=J.useMemo(()=>Array.isArray(e?.plugins)?e.plugins:[],[e?.plugins]),k=J.useMemo(()=>{const V=["@elizaos/plugin-sql"];return a?[...V,...(Array.isArray(a)?a:Object.keys(a)).filter(ee=>!V.includes(ee))]:V},[a]),N=J.useMemo(()=>{const V=e?.settings;if(!V||typeof V!="object"||Array.isArray(V))return null;const ee=V.voice;if(!ee||typeof ee!="object"||Array.isArray(ee))return null;const $=ee.model;if(!$||typeof $!="string")return null;const F=Qm($);if(!F)return null;const u=r7[F.provider],g=x.includes(u);return{provider:F.provider,requiredPlugin:u,isPluginEnabled:g}},[e?.settings,x]),C=J.useMemo(()=>r?r.length!==x.length?!0:!r?.every(V=>x.includes(V)):!1,[x,r]),R=J.useMemo(()=>k.filter(V=>!x.includes(V)).filter(V=>V.toLowerCase().includes(o.toLowerCase())),[k,x,o]),O=i(V=>{if(!x.includes(V)){if(t.addPlugin)t.addPlugin(V);else if(t.updateField){const ee=Array.isArray(e.plugins)?[...e.plugins]:[];t.updateField("plugins",[...ee,V])}}},"handlePluginAdd"),T=i(V=>{if(Object.keys(Cn).includes(V)){d(V),b(!0);return}P(V)},"handlePluginRemove"),P=i(V=>{const ee=x.indexOf(V);if(ee!==-1){if(t.removePlugin)t.removePlugin(ee);else if(t.updateField){const $=[...x];$.splice(ee,1),t.updateField("plugins",$)}}},"removePlugin"),z=i(()=>{c&&(P(c),d(null)),b(!1)},"handleConfirmRemoval"),Z=i(()=>{d(null),b(!1)},"handleCancelRemoval");return A.jsx("div",{className:"space-y-6",children:A.jsx("div",{className:"space-y-4",children:A.jsxs("div",{children:[A.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),n?A.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",n.message]}):A.jsxs("div",{className:"space-y-4",children:[A.jsx(bv,{open:y,onOpenChange:b,children:A.jsxs(Cf,{children:[A.jsxs(Rf,{children:[A.jsx(Tf,{children:c&&Object.keys(Cn).includes(c)?Cn[c].title:"Warning: Essential Plugin"}),A.jsx(Pf,{children:c&&Object.keys(Cn).includes(c)?Cn[c].description:"This plugin provides essential functionality for your agent."})]}),A.jsxs(Of,{children:[A.jsx(Lf,{onClick:Z,children:"Cancel"}),A.jsx(Df,{onClick:z,children:"Confirm Removal"})]})]})}),N&&A.jsxs("div",{className:"rounded-md border p-4 mb-4 flex items-center gap-2",children:[A.jsx(fi,{className:"h-4 w-4 text-yellow-500"}),A.jsx("p",{className:"text-xs text-white",children:(()=>{switch(N.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`${N.provider} plugin is required for the selected voice model.`}})()})]}),x.length>0&&A.jsxs("div",{className:"rounded-md bg-muted p-4",children:[A.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),A.jsx("div",{className:"flex flex-wrap gap-2",children:[...x].sort((V,ee)=>{const $=Object.keys(Cn).includes(V),F=Object.keys(Cn).includes(ee);return $===F?0:$?-1:1}).map(V=>{const ee=N?.requiredPlugin===V,$=Object.keys(Cn).includes(V);return A.jsxs(et,{type:"button",variant:"ghost",size:"sm",className:`inline-flex items-center rounded-full ${$?"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:ee?"Required by voice model":$?"Essential plugin for agent functionality":"",children:[$&&A.jsx("span",{className:"w-2 h-2 rounded-full bg-white inline-block"}),A.jsx("span",{className:"text-white font-semibold",children:V}),A.jsx("span",{className:fv("ml-1 opacity-70 hover:opacity-100",$&&"text-white"),onClick:i(()=>{if(ee){s({title:"Can't Remove Plugin",description:"This plugin is required by the selected voice model.",variant:"destructive"});return}T(V)},"onClick"),children:"×"})]},V)})}),A.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:A.jsxs("span",{className:"inline-flex items-center",children:[A.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-600 mr-1"}),"Essential plugins provide core functionality"]})})]}),A.jsx("div",{className:"space-y-2",children:A.jsxs(Vb,{open:p,onOpenChange:v,children:[A.jsx(hq,{asChild:!0,children:A.jsx(et,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),A.jsxs(wc,{className:"max-w-[400px]",children:[A.jsx(xc,{children:A.jsx(_c,{children:"Add Plugins"})}),A.jsxs("div",{className:"space-y-4 py-4",children:[A.jsx("div",{className:"space-y-2",children:A.jsx(hr,{type:"search",placeholder:"Search plugins...",value:o,onChange:i(V=>h(V.target.value),"onChange")})}),A.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:R.length===0?A.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):R.map(V=>A.jsx(et,{variant:"ghost",className:"w-full justify-start font-normal",onClick:i(()=>{O(V),h(""),v(!1)},"onClick"),children:V},V))})]})]})]})}),C&&A.jsx("p",{className:"text-xs text-yellow-500",children:"Plugins configuration has been changed"})]})]})})})}i(cN,"PluginsPanel");const dN=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(u_,{ref:a,className:Le("relative overflow-hidden",e),...r,children:[A.jsx(DC,{className:"h-full w-full rounded-[inherit]",children:t}),A.jsx(hN,{}),A.jsx(LC,{})]}));dN.displayName=u_.displayName;const hN=J.forwardRef(({className:e,orientation:t="vertical",...r},a)=>A.jsx(f_,{ref:a,orientation:t,className:Le("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:A.jsx(BC,{className:"relative flex-1 rounded-full bg-border"})}));hN.displayName=f_.displayName;const mq=En("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"}}),Ug=J.forwardRef(({className:e,variant:t,...r},a)=>A.jsx("div",{ref:a,role:"alert",className:Le(mq({variant:t}),e),...r}));Ug.displayName="Alert";const gq=J.forwardRef(({className:e,...t},r)=>A.jsx("h5",{ref:r,className:Le("mb-1 font-medium leading-none tracking-tight",e),...t}));gq.displayName="AlertTitle";const Fg=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,className:Le("text-sm [&_p]:leading-relaxed",e),...t}));Fg.displayName="AlertDescription";const Jb=J.forwardRef(({characterValue:e,onChange:t},r)=>{const[a,n]=J.useState([]),[s,o]=J.useState(""),[h,p]=J.useState(""),[v,c]=J.useState(!1),[d,y]=J.useState(null),[b,x]=J.useState(""),[k,N]=J.useState(!1),[C,R]=J.useState([]),[O,T]=J.useState(new Set),[P,z]=J.useState({}),[Z,V]=J.useState(!0),[ee,$]=J.useState(!1),[F,u]=J.useState(""),g=J.useRef(null),l=J.useRef(""),m=J.useRef(null),w=J.useRef(""),M=J.useMemo(()=>e?.plugins||[],[e?.plugins]),{requiredSecrets:j,isLoading:S}=sN(M);J.useEffect(()=>{i(async()=>{try{V(!0);const le=await Yt().system.getEnvironment();z(le||{})}catch(W){console.error("Failed to fetch global environment variables:",W),z({})}finally{V(!1)}},"fetchGlobalEnvs")()},[]);const f=J.useCallback(()=>{const X={};return a.forEach(({name:W,value:le})=>{X[W]=le}),C.forEach(W=>{X[W]=null}),X},[a,C]),_=J.useCallback(()=>{const X=f(),le=(S?a.filter(ke=>ke.isRequired):j).filter(ke=>{const be=typeof ke=="object"&&"name"in ke?ke.name:ke,fe=X[be];return!(fe&&fe.trim()!==""||P[be]&&P[be].trim()!=="")}).map(ke=>typeof ke=="object"&&"name"in ke?ke.name:ke);return{isValid:le.length===0,missingSecrets:le}},[f,j,S,a,P]);J.useImperativeHandle(r,()=>({getSecrets:f,validateSecrets:_}),[f,_]);const E=i(X=>{T(W=>{const le=new Set(W);return le.has(X)?le.delete(X):le.add(X),le})},"toggleSecretVisibility"),I=J.useCallback(()=>{const X=[];X.push("# Environment Variables"),X.push("");const W=a.filter(ke=>ke.isRequired),le=a.filter(ke=>!ke.isRequired&&ke.value&&ke.value.trim()!=="");return W.length>0&&(X.push("# Required Secrets"),W.forEach(ke=>{ke.plugin&&X.push(`# Required by ${ke.plugin}`),ke.description&&X.push(`# ${ke.description}`),X.push(`${ke.name}=${ke.value||""}`),X.push("")})),le.length>0&&(X.push("# Optional Variables"),le.forEach(ke=>{X.push(`${ke.name}=${ke.value}`)})),X.join(`
80
+ `)}}}i(sJ,"wm");var Iu=sJ(),rN=i(()=>{let e=hf.toLowerCase();return e==="trace"?"verbose":e==="debug"?"debug":e==="log"?"log":e==="info"?"info":e==="warn"?"warn":e==="error"?"error":e==="fatal"?"alert":"info"},"CV"),oJ=rN(),iN={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:""}},lJ=sH({activeLevel:oJ,format:Bg?"json":"pretty",timestampFormatter:$b?void 0:()=>"",withEmoji:!1,levels:iN});lJ.addListener("*",e=>{try{let t=e.data,r=Array.isArray(t?.message)?t.message.map(n=>typeof n=="string"?n:Lg(n)).join(" "):typeof t?.message=="string"?t.message:"",a={time:Date.now(),level:typeof t?.level=="number"?t.level:void 0,msg:r};Iu.write(a)}catch{}});function uJ(e){let t=iJ,r=[];typeof e.namespace=="string"&&r.push(e.namespace),Array.isArray(e.namespaces)&&r.push(...e.namespaces),r.length>0&&(t=t.ns(...r));let a={...e};if(delete a.namespace,delete a.namespaces,Bg&&(a.name||(a.name="elizaos"),!a.hostname)){let s="unknown";if(typeof process<"u"&&process.platform)try{s=(EB(),$t(p9)).hostname()}catch{s="localhost"}else typeof window<"u"&&window.location&&(s=window.location.hostname||"browser");a.hostname=s}let n={activeLevel:rN(),format:Bg?"json":"pretty",timestampFormatter:$b?void 0:()=>"",withEmoji:!1,levels:iN};return t.meta(a).seal(n)}i(uJ,"fm");function fJ(e){let t=hf,r={},a;if(typeof e=="object"&&e!==null){"level"in e&&(t=e.level),"maxMemoryLogs"in e&&typeof e.maxMemoryLogs=="number"&&(a=e.maxMemoryLogs);let{level:n,maxMemoryLogs:s,...o}=e;r=o}return{level:t,base:r,maxMemoryLogs:a}}i(fJ,"km");function zg(e=!1){let{level:t,base:r,maxMemoryLogs:a}=fJ(e);if(typeof a=="number"&&a>0&&Iu.clear(),typeof e=="object"&&e&&"__forceType"in e&&e.__forceType==="browser"){let p=(typeof t=="number"?"info":t||hf).toLowerCase(),v=i((...y)=>y.map(b=>typeof b=="string"?b:b instanceof Error?b.message:Lg(b)).join(" "),"q$"),c=i((y,...b)=>{if(!c3(y,p))return;let x=v(...b),k=y==="fatal"?"error":y==="trace"||y==="verbose"?"debug":y==="success"||y==="progress"?"info":y==="log"?"log":console[y]?y:"log";typeof console[k]=="function"&&console[k](x)},"e"),d=i((y,b,...x)=>typeof y=="string"?b!==void 0?[y,b,...x]:[y,...x]:y instanceof Error?b!==void 0?[y.message,b,...x]:[y.message,...x]:b!==void 0?[b,y,...x]:[y,...x],"l");return{level:p,trace:i((y,b,...x)=>c("trace",...d(y,b,...x)),"trace"),debug:i((y,b,...x)=>c("debug",...d(y,b,...x)),"debug"),info:i((y,b,...x)=>c("info",...d(y,b,...x)),"info"),warn:i((y,b,...x)=>c("warn",...d(y,b,...x)),"warn"),error:i((y,b,...x)=>c("error",...d(y,b,...x)),"error"),fatal:i((y,b,...x)=>c("fatal",...d(y,b,...x)),"fatal"),success:i((y,b,...x)=>c("success",...d(y,b,...x)),"success"),progress:i((y,b,...x)=>c("progress",...d(y,b,...x)),"progress"),log:i((y,b,...x)=>c("log",...d(y,b,...x)),"log"),clear:i(()=>{typeof console.clear=="function"&&console.clear()},"clear"),child:i(y=>zg({level:p,...r,...y,__forceType:"browser"}),"child")}}let n=uJ(r),s=(typeof t=="number"?"info":t||hf).toLowerCase(),o=i((p,...v)=>{if(!c3(p,s))return;try{let y="";v.length>0&&(y=v.map(x=>typeof x=="string"?x:x instanceof Error?x.message:Lg(x)).join(" ")),r.namespace&&(y=`#${r.namespace} ${y}`);let b={time:Date.now(),level:df[p.toLowerCase()]||df.info,msg:y};Iu.write(b)}catch{}let c=p,d=v;p==="fatal"?c="alert":p==="progress"?(c="info",d=["[PROGRESS]",...v]):p==="success"?(c="info",d=["[SUCCESS]",...v]):p==="trace"&&(c="verbose");try{n[c](...d)}catch{console.log(`[${p.toUpperCase()}]`,...v)}},"w"),h=i((p,v,...c)=>typeof p=="string"?v!==void 0?[p,v,...c]:[p,...c]:p instanceof Error?v!==void 0?[p.message,{error:p},v,...c]:[p.message,{error:p},...c]:v!==void 0?[v,p,...c]:[p,...c],"G");return{level:s,trace:i((p,v,...c)=>o("verbose",...h(p,v,...c)),"trace"),debug:i((p,v,...c)=>o("debug",...h(p,v,...c)),"debug"),info:i((p,v,...c)=>o("info",...h(p,v,...c)),"info"),warn:i((p,v,...c)=>o("warn",...h(p,v,...c)),"warn"),error:i((p,v,...c)=>o("error",...h(p,v,...c)),"error"),fatal:i((p,v,...c)=>o("fatal",...h(p,v,...c)),"fatal"),success:i((p,v,...c)=>o("success",...h(p,v,...c)),"success"),progress:i((p,v,...c)=>o("progress",...h(p,v,...c)),"progress"),log:i((p,v,...c)=>o("log",...h(p,v,...c)),"log"),clear:i(()=>{try{typeof console?.clear=="function"&&console.clear()}catch{}Iu.clear()},"clear"),child:i(p=>zg({level:s,...r,...p}),"child")}}i(zg,"I7");var mo=zg(),lu=mo,cJ=ct.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");function Vo(e){let t=cJ.safeParse(e);return t.success?t.data:null}i(Vo,"Vm");var Ap=i(e=>{if(e.startsWith("image/"))return"image";if(e.startsWith("video/"))return"video";if(e.startsWith("audio/"))return"audio";if(e.includes("pdf")||e.includes("document")||e.startsWith("text/"))return"document"},"L_$"),nN=ct.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"),dJ=ct.object({text:ct.string().optional(),thought:ct.string().optional(),actions:ct.array(ct.string()).optional(),providers:ct.array(ct.string()).optional(),source:ct.string().optional(),target:ct.string().optional(),url:ct.string().optional(),inReplyTo:nN.optional(),attachments:ct.array(ct.object()).optional(),channelType:ct.enum(bt).optional()}).passthrough(),hJ=ct.object({name:ct.string(),content:dJ}),pJ=ct.object({directory:ct.string(),shared:ct.boolean().optional()}),mJ=ct.union([ct.string(),ct.object({path:ct.string(),shared:ct.boolean().optional()}),pJ]),gJ=ct.union([ct.string(),ct.function().optional()]),vJ=ct.object({all:ct.array(ct.string()).optional(),chat:ct.array(ct.string()).optional(),post:ct.array(ct.string()).optional()}).optional(),bJ=ct.record(ct.string(),ct.union([ct.string(),ct.boolean(),ct.number(),ct.object()])).optional(),yJ=ct.record(ct.string(),ct.union([ct.string(),ct.boolean(),ct.number()])).optional();ct.object({id:nN.optional(),name:ct.string().min(1,"Character name is required"),username:ct.string().optional(),system:ct.string().optional(),templates:ct.record(ct.string(),gJ).optional(),bio:ct.union([ct.string(),ct.array(ct.string())]),messageExamples:ct.array(ct.array(hJ)).optional(),postExamples:ct.array(ct.string()).optional(),topics:ct.array(ct.string()).optional(),adjectives:ct.array(ct.string()).optional(),knowledge:ct.array(mJ).optional(),plugins:ct.array(ct.string()).optional(),settings:bJ,secrets:yJ,style:vJ}).strict();function Yi(){return typeof Buffer<"u"&&typeof Buffer.from=="function"}i(Yi,"B8");function wJ(e){let t=e.replace(/[^0-9a-fA-F]/g,"");if(Yi())return Buffer.from(t,"hex");let r=new Uint8Array(t.length/2);for(let a=0;a<r.length;a++)r[a]=parseInt(t.substr(a*2,2),16);return r}i(wJ,"Uo");function xJ(e,t="utf8"){if(Yi()){let r=t==="utf-8"?"utf8":t;return Buffer.from(e,r)}if(t==="base64"){let r=atob(e),a=new Uint8Array(r.length);for(let n=0;n<r.length;n++)a[n]=r.charCodeAt(n);return a}return new TextEncoder().encode(e)}i(xJ,"Fo");function aN(e){if(Yi()&&Buffer.isBuffer(e))return e.toString("hex");let t=e instanceof Uint8Array?e:new Uint8Array(e),r="";for(let a=0;a<t.length;a++){let n=t[a].toString(16);r+=n.length===1?"0"+n:n}return r}i(aN,"PM");function _J(e,t="utf8"){if(Yi()&&Buffer.isBuffer(e)){let a=t==="utf-8"?"utf8":t;return e.toString(a)}let r=e instanceof Uint8Array?e:new Uint8Array(e);if(t==="hex")return aN(r);if(t==="base64"){let a="";for(let n=0;n<r.length;n++)a+=String.fromCharCode(r[n]);return btoa(a)}return new TextDecoder().decode(r)}i(_J,"ao");function SJ(e){return e?Yi()&&Buffer.isBuffer(e)?!0:e instanceof Uint8Array||e instanceof ArrayBuffer||typeof e=="object"&&e.buffer instanceof ArrayBuffer&&typeof e.byteLength=="number"&&!Array.isArray(e):!1}i(SJ,"Qo");function MJ(e){return Yi()?Buffer.alloc(e):new Uint8Array(e)}i(MJ,"eo");function EJ(e){return Yi()?Buffer.from(e):new Uint8Array(e)}i(EJ,"so");function kJ(e){if(Yi()&&e.every(n=>Buffer.isBuffer(n)))return Buffer.concat(e);let t=0;for(let n of e)t+=n.length;let r=new Uint8Array(t),a=0;for(let n of e){let s=n instanceof Uint8Array?n:new Uint8Array(n);r.set(s,a),a+=s.length}return r}i(kJ,"$r");function jJ(e,t,r){return Yi()&&Buffer.isBuffer(e)?e.slice(t,r):(e instanceof Uint8Array?e:new Uint8Array(e)).slice(t,r)}i(jJ,"qr");function AJ(e,t){if(e.length!==t.length)return!1;let r=e instanceof Uint8Array?e:new Uint8Array(e),a=t instanceof Uint8Array?t:new Uint8Array(t);for(let n=0;n<r.length;n++)if(r[n]!==a[n])return!1;return!0}i(AJ,"Kr");function NJ(e){return e.length}i(NJ,"_r");function IJ(e){if(Yi())try{return(qr(),$t(Ur)).randomBytes(e)}catch{}let t=new Uint8Array(e);if(typeof globalThis<"u"&&globalThis.crypto&&globalThis.crypto.getRandomValues)globalThis.crypto.getRandomValues(t);else for(let r=0;r<e;r++)t[r]=Math.floor(Math.random()*256);return t}i(IJ,"Pr");var CJ={fromHex:wJ,fromString:xJ,fromBytes:EJ,toHex:aN,toString:_J,isBuffer:SJ,alloc:MJ,concat:kJ,slice:jJ,equals:AJ,byteLength:NJ,randomBytes:IJ},RJ=[];for(let e=0;e<256;++e)RJ.push((e+256).toString(16).slice(1));typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var Bs=null,d3=!1,OJ=3e5;function TJ(){let e=vc("SECRET_SALT","secretsalt")||"secretsalt",t=Date.now();return Bs!==null&&t-Bs.timestamp<OJ&&Bs.value===e?Bs.value:(e==="secretsalt"&&!d3&&(mo.warn("SECRET_SALT is not set or using default value"),d3=!0),Bs={value:e,timestamp:t},e)}i(TJ,"C_");function PJ(e,t){try{if(e==null||typeof e=="boolean"||typeof e=="number")return e;if(typeof e!="string")return mo.debug(`Value is not a string (type: ${typeof e}), returning as is`),e;let r=e.split(":");if(r.length!==2)return e;let a=CJ.fromHex(r[0]),n=r[1];if(a.length!==16)return a.length&&mo.debug(`Invalid IV length (${a.length}) - expected 16 bytes`),e;let s=yx.createHash("sha256").update(t).digest().slice(0,32),o=yx.createDecipheriv("aes-256-cbc",s,a),h=o.update(n,"hex","utf8");return h+=o.final("utf8"),h}catch(r){return mo.error(`Error decrypting value: ${r}`),e}}i(PJ,"QO");function DJ(e,t){let r={};for(let[a,n]of Object.entries(e))typeof n=="string"&&n?r[a]=PJ(n,t):r[a]=n;return r}i(DJ,"vM");const qe={info:i((e,...t)=>{lu.info({source:"client"},e,...t)},"info"),error:i((e,...t)=>{lu.error({source:"client"},e,...t)},"error"),warn:i((e,...t)=>{lu.warn({source:"client"},e,...t)},"warn"),debug:i((e,...t)=>{lu.debug({source:"client"},e,...t)},"debug")},LJ="elizaos-plugins",BJ="registry",zJ=`https://raw.githubusercontent.com/${LJ}/${BJ}/refs/heads/main/generated-registry.json`,UJ=["@elizaos/plugin-bootstrap","@elizaos/plugin-sql"];async function FJ(){try{const e=await fetch(zJ);if(!e.ok)throw new Error(`Failed to fetch registry: ${e.status}`);return await e.json()}catch(e){return qe.error("Failed to fetch plugin registry:",e),null}}i(FJ,"fetchPluginRegistry");function $J(e){return e.startsWith("@elizaos-plugins/")?e:e.replace("@elizaos/","@elizaos-plugins/")}i($J,"getRegistryPluginName");function Zo(e){return UJ.includes(e)}i(Zo,"isCorePlugin");function GJ(e,t){if(Zo(e))return null;if(!t)return qe.warn(`No registry data available for ${e}`),null;const r=$J(e),a=e;qe.debug(`Looking for ${e} in registry as ${r} or ${a}`);let n=t.registry[r];if(!n&&r!==a&&(n=t.registry[a],n&&qe.debug(`Found plugin under alternative name: ${a}`)),!n?.git?.repo)return qe.warn(`No GitHub repo found in registry for plugin: ${e} (tried ${r} and ${a})`),null;qe.debug(`Found repo info for ${e}: ${n.git.repo}`);const s=n.git.v1.branch?n.git.v1:n.git.v0,o=s?.branch||"main";s?.branch?qe.debug(`Branch for ${e}: ${o}`):qe.warn(`No branch information found for plugin: ${e}`);let h;const p=n.git.repo.match(/github\.com[:/]([^/]+\/[^/.]+)(\.git)?$/);if(p)h=p[1];else{const c=n.git.repo.match(/^([^/]+\/[^/.]+)$/);if(c)h=c[1];else return qe.warn(`Could not parse GitHub repo URL: ${n.git.repo}`),null}qe.debug(`Parsed owner/repo for ${e}: ${h}`);const v=`${h}/${o}`;return qe.debug(`Initial path for ${e}: ${v}`),v}i(GJ,"getGitHubRepoPath");async function VJ(e,t){if(Zo(e))return null;if(!t)return qe.warn(`No repo path available for plugin: ${e}`),null;qe.debug(`Starting package.json fetch for ${e} with initial path: ${t}`);const r=t.split("/"),a=r[0],n=r[1],s=r[2]||"main",o=e.replace("@elizaos/","");qe.debug(`Extracted parts - owner: ${a}, repo: ${n}, branch: ${s}, packageName: ${o}`);const h=[`${a}/${n}/${s}`,`${a}/${n}/main`,`${a}/${n}/master`,`${a}/${n}/1.x`,`${a}/${n}/v1`,`${a}/${n}/v2`,`${a}/${n}/${s}/packages/${o}`,`${a}/${n}/main/packages/${o}`,`${a}/${n}/master/packages/${o}`],p=[...new Set(h)];qe.debug(`Will try ${p.length} unique paths for ${e}:`,p);for(const v of p)try{const c=`https://raw.githubusercontent.com/${v}/package.json`;qe.debug(`Trying URL for ${e}: ${c}`);const d=await fetch(c);if(d.ok){const y=await d.json();return qe.debug(`✅ Found package.json for ${e} at ${c}`),y}else qe.debug(`❌ Failed to fetch ${e} from ${c}: HTTP ${d.status}`)}catch(c){qe.debug(`❌ Error fetching ${e} from ${v}: ${c instanceof Error?c.message:String(c)}`)}return qe.warn(`Could not find package.json for ${e} in any of the expected locations`),null}i(VJ,"fetchPluginPackageJson");function ZJ(e,t){if(Zo(e))return[];if(!t)return[];if(t?.agentConfig?.pluginParameters){const r=[];for(const[a,n]of Object.entries(t.agentConfig.pluginParameters))n.required===!0&&r.push({name:a,description:n.description,required:!0,example:n.example});return r}return t?.elizaos?.secrets?t.elizaos.secrets.filter(r=>r.required):t?.elizaos?.requiredSecrets?t.elizaos.requiredSecrets.map(r=>({name:r,required:!0})):[]}i(ZJ,"extractRequiredSecrets");function HJ(e){const t=J.useMemo(()=>[...e].sort().join(","),[e]);return Ar({queryKey:["plugin-details",t],queryFn:i(async()=>{qe.debug("[usePluginDetails] Starting fetch for plugins:",e);const r=[],a=e.filter(Zo),n=e.filter(s=>!Zo(s));if(qe.debug("[usePluginDetails] Core plugins:",a),qe.debug("[usePluginDetails] External plugins:",n),a.forEach(s=>{r.push({name:s,requiredSecrets:[]})}),n.length>0){const s=await FJ();if(qe.debug("[usePluginDetails] Registry data fetched:",s?"success":"failed"),s){const p=Object.keys(s.registry);qe.debug("[usePluginDetails] Available plugins in registry:",p)}const o=n.map(async p=>{const v=GJ(p,s),c=await VJ(p,v);return{name:p,packageJson:c}}),h=await Promise.all(o);for(const{name:p,packageJson:v}of h){const c=ZJ(p,v);r.push({name:p,requiredSecrets:c})}}return qe.debug("[usePluginDetails] Final details:",r),r},"queryFn"),enabled:e.length>0,staleTime:300*1e3,retry:2,refetchOnMount:!1,refetchOnWindowFocus:!1})}i(HJ,"usePluginDetails");function sN(e){const{data:t,isLoading:r,error:a}=HJ(e);return{requiredSecrets:J.useMemo(()=>t?t.reduce((s,o)=>(o.requiredSecrets.forEach(h=>{s.find(p=>p.name===h.name)||s.push({...h,plugin:o.name})}),s),[]):[],[t]),isLoading:r,error:a}}i(sN,"useRequiredSecrets");class ra extends Error{static{i(this,"ApiError")}code;details;status;constructor(t,r,a,n){super(r),this.code=t,this.details=a,this.status=n,this.name="ApiError"}}class kn{static{i(this,"BaseApiClient")}baseUrl;apiKey;timeout;defaultHeaders;constructor(t){this.baseUrl=t.baseUrl.replace(/\/$/,""),this.apiKey=t.apiKey,this.timeout=t.timeout||3e4,this.defaultHeaders={"Content-Type":"application/json",...t.headers},this.apiKey&&(this.defaultHeaders["X-API-KEY"]=this.apiKey)}createNoContentResponse(){return{success:!0}}async request(t,r,a){let n;this.baseUrl?n=new URL(`${this.baseUrl}${r}`):typeof window<"u"&&window.location?n=new URL(r,window.location.origin):n=new URL(r,"http://localhost:3000"),a?.params&&Object.entries(a.params).forEach(([h,p])=>{p!=null&&n.searchParams.append(h,String(p))});const s=new AbortController,o=setTimeout(()=>s.abort(),this.timeout);try{const h={...this.defaultHeaders,...a?.config?.headers,...a?.headers};a?.body instanceof FormData&&delete h["Content-Type"];const p=await fetch(n.toString(),{method:t,headers:h,body:a?.body instanceof FormData?a.body:a?.body?JSON.stringify(a.body):void 0,signal:s.signal});if(clearTimeout(o),p.status===204||p.headers.get("content-length")==="0")return this.createNoContentResponse();let v;try{v=await p.json()}catch{if(p.ok)return this.createNoContentResponse();throw new ra("PARSE_ERROR","Failed to parse response as JSON",void 0,p.status)}if(!p.ok){const c=v?.error||{code:"HTTP_ERROR",message:`HTTP ${p.status}: ${p.statusText}`};throw new ra(c.code,c.message,c.details,p.status)}if(v&&typeof v=="object"&&"success"in v){const c=v;if(!c.success){const d="error"in c?c.error:{code:"UNKNOWN_ERROR",message:"An unknown error occurred"};throw new ra(d.code,d.message,d.details,p.status)}return c.data}else return v}catch(h){throw clearTimeout(o),h instanceof ra?h:h instanceof Error?h.name==="AbortError"?new ra("TIMEOUT","Request timed out"):new ra("NETWORK_ERROR",h.message):new ra("UNKNOWN_ERROR","An unknown error occurred")}}async get(t,r){return this.request("GET",t,r)}async post(t,r,a){return this.request("POST",t,{...a,body:r})}async put(t,r,a){return this.request("PUT",t,{...a,body:r})}async patch(t,r,a){return this.request("PATCH",t,{...a,body:r})}async delete(t,r){return this.request("DELETE",t,r)}}class JJ extends kn{static{i(this,"AgentsService")}async listAgents(){return this.get("/api/agents")}async getAgent(t){return this.get(`/api/agents/${t}`)}async createAgent(t){return this.post("/api/agents",t)}async updateAgent(t,r){return this.patch(`/api/agents/${t}`,r)}async deleteAgent(t){return this.delete(`/api/agents/${t}`)}async startAgent(t){return this.post(`/api/agents/${t}/start`)}async stopAgent(t){return this.post(`/api/agents/${t}/stop`)}async getWorlds(){return this.get("/api/agents/worlds")}async addAgentToWorld(t,r){return this.post(`/api/agents/${t}/worlds`,{worldId:r})}async updateAgentWorldSettings(t,r,a){return this.patch(`/api/agents/${t}/worlds/${r}`,{settings:a})}async getAgentPanels(t){const r=await this.get(`/api/agents/${t}/panels`);return{panels:(Array.isArray(r)?r:[]).map((n,s)=>({id:`${n.name}-${s}`,name:n.name,url:n.path,type:"plugin"}))}}async getAgentLogs(t,r){return this.get(`/api/agents/${t}/logs`,{params:r})}async deleteAgentLog(t,r){return this.delete(`/api/agents/${t}/logs/${r}`)}async getAgentsForServer(t){return this.get(`/api/messaging/servers/${t}/agents`)}async addAgentToServer(t,r){return this.post(`/api/messaging/servers/${t}/agents`,{agentId:r})}async removeAgentFromServer(t,r){return this.delete(`/api/messaging/servers/${t}/agents/${r}`)}async getServersForAgent(t){return this.get(`/api/messaging/agents/${t}/servers`)}}class qJ extends kn{static{i(this,"MessagingService")}async submitMessage(t){return this.post("/api/messaging/submit",t)}async completeMessage(t){return this.post("/api/messaging/complete",t)}async ingestExternalMessages(t){return this.post("/api/messaging/ingest-external",t)}async createChannel(t){const r={name:t.name,type:t.type,server_id:t.serverId||"00000000-0000-0000-0000-000000000000",metadata:t.metadata};return this.post("/api/messaging/central-channels",r)}async createGroupChannel(t){const r="00000000-0000-0000-0000-000000000000";let a,n,s;if(t.metadata){const h={...t.metadata};"server_id"in h&&(n=h.server_id,delete h.server_id),"type"in h&&(s=h.type,delete h.type),Object.keys(h).length>0&&(a=h)}const o={name:t.name,server_id:n||r,participantCentralUserIds:t.participantIds,...s?{type:s}:{},...a?{metadata:a}:{}};return this.post("/api/messaging/central-channels",o)}async getOrCreateDmChannel(t){const[r,a]=t.participantIds,n={currentUserId:r,targetUserId:a,dmServerId:"00000000-0000-0000-0000-000000000000"};return this.get("/api/messaging/dm-channel",{params:n})}async getChannelDetails(t){return this.get(`/api/messaging/central-channels/${t}/details`)}async getChannelParticipants(t){return this.get(`/api/messaging/central-channels/${t}/participants`)}async addAgentToChannel(t,r){return this.post(`/api/messaging/central-channels/${t}/agents`,{agentId:r})}async removeAgentFromChannel(t,r){return this.delete(`/api/messaging/central-channels/${t}/agents/${r}`)}async deleteChannel(t){return this.delete(`/api/messaging/central-channels/${t}`)}async clearChannelHistory(t){return this.delete(`/api/messaging/central-channels/${t}/messages`)}async postMessage(t,r,a){return this.post(`/api/messaging/central-channels/${t}/messages`,{content:r,metadata:a})}async getChannelMessages(t,r){return this.get(`/api/messaging/central-channels/${t}/messages`,{params:r})}async getMessage(t){return this.get(`/api/messaging/messages/${t}`)}async deleteMessage(t,r){return this.delete(`/api/messaging/central-channels/${t}/messages/${r}`)}async updateMessage(t,r){return this.patch(`/api/messaging/messages/${t}`,{content:r})}async searchMessages(t){return this.post("/api/messaging/messages/search",t)}async listServers(){return this.get("/api/messaging/central-servers")}async getServerChannels(t){return this.get(`/api/messaging/central-servers/${t}/channels`)}async createServer(t){return this.post("/api/messaging/servers",t)}async syncServerChannels(t,r){return this.post(`/api/messaging/servers/${t}/sync-channels`,r)}async deleteServer(t){return this.delete(`/api/messaging/servers/${t}`)}async updateChannel(t,r){return this.patch(`/api/messaging/central-channels/${t}`,r)}async generateChannelTitle(t,r){return this.post(`/api/messaging/central-channels/${t}/generate-title`,{agentId:r})}async addUserToChannel(t,r){const a=await this.getChannelDetails(t),n=a.metadata?.participantCentralUserIds||[];if(!n.includes(r)){const s=[...n,r];return this.updateChannel(t,{participantCentralUserIds:s})}return{success:!0,data:a}}async addUsersToChannel(t,r){const s=[...(await this.getChannelDetails(t)).metadata?.participantCentralUserIds||[]];for(const o of r)s.includes(o)||s.push(o);return this.updateChannel(t,{participantCentralUserIds:s})}async removeUserFromChannel(t,r){const s=((await this.getChannelDetails(t)).metadata?.participantCentralUserIds||[]).filter(o=>o!==r);return this.updateChannel(t,{participantCentralUserIds:s})}}class KJ extends kn{static{i(this,"MemoryService")}async getAgentMemories(t,r){return this.get(`/api/memory/${t}/memories`,{params:r})}async getRoomMemories(t,r,a){return this.get(`/api/memory/${t}/rooms/${r}/memories`,{params:a})}async updateMemory(t,r,a){return this.patch(`/api/memory/${t}/memories/${r}`,a)}async clearAgentMemories(t){return this.delete(`/api/memory/${t}/memories`)}async clearRoomMemories(t,r){return this.delete(`/api/memory/${t}/memories/all/${r}`)}async listAgentRooms(t){return this.get(`/api/memory/${t}/rooms`)}async getRoom(t,r){return this.get(`/api/memory/${t}/rooms/${r}`)}async createRoom(t,r){return this.post(`/api/memory/${t}/rooms`,r)}async createWorldFromServer(t,r){return this.post(`/api/memory/groups/${t}`,r)}async deleteWorld(t){return this.delete(`/api/memory/groups/${t}`)}async clearWorldMemories(t){return this.delete(`/api/memory/groups/${t}/memories`)}async deleteMemory(t,r){return this.delete(`/api/memory/${t}/memories/${r}`)}async getAgentInternalMemories(t,r,a){return this.get(`/api/memory/${t}/rooms/${r}/memories`,{params:{includeEmbedding:a}})}async deleteAgentInternalMemory(t,r){return this.delete(`/api/memory/${t}/memories/${r}`)}async deleteAllAgentInternalMemories(t,r){return this.delete(`/api/memory/${t}/memories/all/${r}`)}async updateAgentInternalMemory(t,r,a){return this.patch(`/api/memory/${t}/memories/${r}`,a)}async deleteGroupMemory(t,r){return this.delete(`/api/messaging/central-channels/${t}/messages/${r}`)}async clearGroupChat(t){return this.delete(`/api/messaging/central-channels/${t}/messages`)}}class XJ extends kn{static{i(this,"AudioService")}async requestBinary(t,r,a){let n;this.baseUrl?n=new URL(`${this.baseUrl}${r}`):typeof window<"u"&&window.location?n=new URL(r,window.location.origin):n=new URL(r,"http://localhost:3000"),a?.params&&Object.entries(a.params).forEach(([h,p])=>{p!=null&&n.searchParams.append(h,String(p))});const s=new AbortController,o=setTimeout(()=>s.abort(),this.timeout);try{const h={...this.defaultHeaders,...a?.headers};a?.body instanceof FormData&&delete h["Content-Type"];const p=await fetch(n.toString(),{method:t,headers:h,body:a?.body instanceof FormData?a.body:a?.body?JSON.stringify(a.body):void 0,signal:s.signal});if(clearTimeout(o),!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return await p.arrayBuffer()}catch(h){throw clearTimeout(o),h instanceof Error?h.name==="AbortError"?new Error("Request timed out"):h:new Error("An unknown error occurred")}}processAudioInput(t){if(t instanceof Blob)return t;if(typeof t=="string"){if(t.startsWith("data:"))try{const[a,n]=t.split(","),s=a.match(/data:([^;]+)/),o=s?s[1]:"audio/wav",h=atob(n),p=new Uint8Array(h.length);for(let v=0;v<h.length;v++)p[v]=h.charCodeAt(v);return new Blob([p],{type:o})}catch(a){throw new Error(`Invalid base64 data URL: ${a instanceof Error?a.message:"Unknown error"}`)}if(this.isBase64String(t))try{const a=atob(t),n=new Uint8Array(a.length);for(let s=0;s<a.length;s++)n[s]=a.charCodeAt(s);return new Blob([n],{type:"audio/wav"})}catch{return t}return t}if(this.isBuffer(t))return new Blob([new Uint8Array(t)],{type:"audio/wav"});const r=t;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 t}. Expected Blob, Buffer, ArrayBuffer, or string.`)}isBase64String(t){const r=/^[A-Za-z0-9+/]*={0,2}$/;return t.length<4||t.length%4!==0?!1:r.test(t)}isBuffer(t){return t!=null&&typeof t=="object"&&typeof t.constructor=="function"&&t.constructor.name==="Buffer"&&typeof t.readUInt8=="function"}async speechConversation(t,r){const a=new FormData,n=this.processAudioInput(r.audio);return n instanceof Blob,a.append("file",n),r.format&&a.append("format",r.format),r.language&&a.append("language",r.language),r.metadata&&a.append("metadata",JSON.stringify(r.metadata)),this.request("POST",`/api/audio/${t}/speech/conversation`,{body:a})}async generateSpeech(t,r){const a=await this.requestBinary("POST",`/api/audio/${t}/speech/generate`,{body:r}),n=new Uint8Array(a);let s="";for(let p=0;p<n.byteLength;p++)s+=String.fromCharCode(n[p]);return{audio:btoa(s),format:"mpeg"}}async synthesizeAudioMessage(t,r){return this.post(`/api/audio/${t}/audio-messages/synthesize`,r)}async transcribe(t,r){const a=new FormData,n=this.processAudioInput(r.audio);return n instanceof Blob,a.append("file",n),r.format&&a.append("format",r.format),r.language&&a.append("language",r.language),this.request("POST",`/api/audio/${t}/transcriptions`,{body:a})}async processSpeech(t,r,a){const n=new FormData,s=this.processAudioInput(r);return s instanceof Blob,n.append("file",s),a&&n.append("metadata",JSON.stringify(a)),this.request("POST",`/api/audio/${t}/speech`,{body:n})}}class WJ extends kn{static{i(this,"MediaService")}async uploadAgentMedia(t,r){const a=new FormData;return a.append("file",r.file,r.filename),r.contentType&&a.append("contentType",r.contentType),r.metadata&&a.append("metadata",JSON.stringify(r.metadata)),this.request("POST",`/api/media/agents/${t}/upload-media`,{body:a})}async uploadChannelMedia(t,r){const a=new FormData;return a.append("file",r),this.request("POST",`/api/messaging/central-channels/${t}/upload-media`,{body:a})}}class QJ extends kn{static{i(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(t){return this.post("/api/server/logs",{logs:t})}async clearLogs(){return this.delete("/api/server/logs")}}class YJ extends kn{static{i(this,"SystemService")}async getEnvironment(){return this.get("/api/system/env/local")}async updateLocalEnvironment(t){if(!t||typeof t!="object")throw new Error("updateLocalEnvironment requires a configuration object");let r;return"variables"in t?r={content:t.variables}:"content"in t?r={content:t.content}:r={content:t},this.post("/api/system/env/local",r)}async getGlobalLogs(t){const r=await fetch(this.buildUrl("/api/server/logs",{params:t}),{method:"GET",headers:this.getHeaders()});if(!r.ok)throw new Error(`HTTP ${r.status}: ${r.statusText}`);const a=await r.json();return{logs:a.logs||[],count:a.count||0,total:a.total||0,level:a.requestedLevel||a.level||"all",levels:a.levels||[]}}buildUrl(t,r){const a=new URL(`${this.baseUrl}${t}`);return r?.params&&Object.entries(r.params).forEach(([n,s])=>{s!=null&&a.searchParams.append(n,String(s))}),a.toString()}getHeaders(){return{...this.defaultHeaders}}async deleteGlobalLogs(){return this.delete("/api/server/logs")}async deleteLog(t){throw new Error("Individual log deletion is not supported. Use deleteGlobalLogs() to clear all logs.")}}function h3(e,t){if(!e)return;let r;if(e instanceof Date)r=e.getTime();else if(typeof e=="string"){if(r=new Date(e).getTime(),isNaN(r)){console.warn(`Invalid date string for ${t}: ${e}`);return}}else if(typeof e=="number")r=e;else{console.warn(`Invalid type for ${t}: ${typeof e}`);return}return r.toString()}i(h3,"toTimestampString");function zs(e,t){if(!e||e.trim()==="")throw new Error(`${t} is required and cannot be empty`)}i(zs,"validateRequiredParam");class eq extends kn{static{i(this,"SessionsService")}async checkHealth(){return this.get("/api/messaging/sessions/health")}async createSession(t){return this.post("/api/messaging/sessions",t)}async getSession(t){return zs(t,"sessionId"),this.get(`/api/messaging/sessions/${t}`)}async sendMessage(t,r){return zs(t,"sessionId"),zs(r?.content,"content"),this.post(`/api/messaging/sessions/${t}/messages`,r)}async getMessages(t,r){zs(t,"sessionId");const a={};r?.limit&&(a.limit=r.limit.toString());const n=h3(r?.before,"before");n&&(a.before=n);const s=h3(r?.after,"after");return s&&(a.after=s),this.get(`/api/messaging/sessions/${t}/messages`,{params:a})}async deleteSession(t){return zs(t,"sessionId"),this.delete(`/api/messaging/sessions/${t}`)}async listSessions(){return this.get("/api/messaging/sessions")}}class tq extends kn{static{i(this,"RunsService")}async listRuns(t,r){return this.get(`/api/agents/${t}/runs`,{params:r})}async getRun(t,r,a){return this.get(`/api/agents/${t}/runs/${r}`,{params:a?{roomId:a}:void 0})}}class Gb{static{i(this,"ElizaClient")}agents;messaging;memory;audio;media;server;system;sessions;runs;constructor(t){this.agents=new JJ(t),this.messaging=new qJ(t),this.memory=new KJ(t),this.audio=new XJ(t),this.media=new WJ(t),this.server=new QJ(t),this.system=new YJ(t),this.sessions=new eq(t),this.runs=new tq(t)}static create(t){return new Gb(t)}}function rq(){const e=i(()=>`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey"),t=localStorage.getItem(e()),r={baseUrl:window.location.origin,timeout:3e4,headers:{Accept:"application/json"}};return t&&(r.apiKey=t),r}i(rq,"createApiClientConfig");let Cu=null;function Yt(){return Cu||(Cu=Gb.create(rq())),Cu}i(Yt,"createElizaClient");function iq(){Cu=null}i(iq,"resetElizaClient");function nq(e){const t=i(()=>`eliza-api-key-${window.location.origin}`,"getLocalStorageApiKey");e?localStorage.setItem(t(),e):localStorage.removeItem(t()),iq()}i(nq,"updateApiClientApiKey");const aq="elizaos-plugins",sq="registry",oq=`https://raw.githubusercontent.com/${aq}/${sq}/refs/heads/main/generated-registry.json`;function oN(){return Ar({queryKey:["plugins"],queryFn:i(async()=>{try{const e=Yt(),[t,r]=await Promise.all([fetch(oq),e.agents.listAgents()]),a=await t.json(),n=Object.entries(a.registry||{}).filter(([h,p])=>{const v=h.includes("plugin"),c=p.supports.v1===!0,d=p.npm.v1!==null||p.git.v1.version!==null&&p.git.v1.branch!==null;return v&&c&&d}).map(([h])=>h.replace(/^@elizaos-plugins\//,"@elizaos/")).sort();let s=[];try{const h=r?.agents||[];if(h.length>0){const p=h.find(v=>v.status==="active");if(p&&p.id){const c=(await e.agents.getAgent(p.id))?.plugins;Array.isArray(c)&&(s=c)}}}catch(h){qe.warn("Could not fetch agent plugins:",h)}return[...new Set([...n,...s])].sort()}catch(e){return qe.error("Failed to fetch from registry, falling back to basic list:",e),["@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(t=>t.includes("plugin")).sort()}},"queryFn")})}i(oN,"usePlugins");const lq={google:"@elizaos/plugin-google-genai",llama_local:"@elizaos/plugin-ollama"},uq={},fq=["@elizaos/plugin-sql","@elizaos/plugin-bootstrap"];function cq(){const{data:e=[]}=oN(),t=i(n=>{const s=new Set;if(Array.isArray(n.clients))for(const h of n.clients){const p=h.toLowerCase(),v=uq[p];if(v&&e.includes(v))s.add(v);else{const c=`@elizaos/plugin-${p}`;e.includes(c)&&s.add(c)}}let o=!1;if(typeof n.modelProvider=="string"){const h=n.modelProvider.toLowerCase(),p=lq[h];if(p&&e.includes(p))s.add(p),o=!0;else{const v=`@elizaos/plugin-${h}`;e.includes(v)&&(s.add(v),o=!0)}o||e.includes("@elizaos/plugin-openai")&&s.add("@elizaos/plugin-openai")}else e.includes("@elizaos/plugin-openai")&&s.add("@elizaos/plugin-openai");for(const h of fq)e.includes(h)&&s.add(h);return Array.from(s).sort()},"matchPlugins");function r(n){return typeof n=="object"&&n!==null&&"user"in n}return i(r,"isV1MessageExampleFormat"),{convertCharacter:i(n=>{const s=[...Array.isArray(n.bio)?n.bio:n.bio?[n.bio]:[],...n.lore??[]],o=(n.messageExamples??[]).map(v=>v.map(c=>r(c)?{name:c.user,content:c.content}:c))??[],h=t(n);return{name:n.name,username:n.username,system:n.system,settings:n.settings,plugins:h,bio:s,topics:n.topics,style:n.style,adjectives:n.adjectives,messageExamples:o,postExamples:n.postExamples}},"convertCharacter")}}i(cq,"useConvertCharacter");const dq=i((e=768)=>{const t=J.useRef(null),[r,a]=J.useState(!0),n=J.useRef(null),s=J.useRef(0);return J.useEffect(()=>{const o=t.current;if(!o)return;const h=i(v=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{const c=v>=e;a(d=>d!==c?c:d),s.current=v},150)},"handleResize"),p=new ResizeObserver(v=>{for(const c of v){const{width:d}=c.contentRect;Math.abs(d-s.current)>5&&h(d)}});return p.observe(o),setTimeout(()=>{const{width:v}=o.getBoundingClientRect();s.current=v,a(v>=e)},0),()=>{p.disconnect(),n.current&&clearTimeout(n.current)}},[e]),{containerRef:t,showLabels:r}},"useContainerWidth");function lN({characterValue:e,setCharacterValue:t,title:r,description:a,onSubmit:n,onDelete:s,onReset:o,onStopAgent:h,isDeleting:p=!1,isStopping:v=!1,customComponents:c=[],onTemplateChange:d,secretPanelRef:y}){const{toast:b}=rr(),{data:x,isLoading:k}=mT(),[N,C]=J.useState(!1),[R,O]=J.useState("none"),[T,P]=J.useState("basic"),z=J.useRef(null),[Z,V]=J.useState(!1),[ee,$]=J.useState(!1),[F,u]=J.useState(!1),[g,l]=J.useState(null),[m,w]=J.useState({}),M=J.useMemo(()=>e?.plugins||[],[e?.plugins]),{requiredSecrets:j}=sN(M),{convertCharacter:S}=cq();J.useEffect(()=>{i(async()=>{try{const te=await Yt().system.getEnvironment();w(te||{})}catch(Y){console.error("Failed to fetch global environment variables:",Y),w({})}},"fetchGlobalEnvs")()},[]);const{containerRef:f,showLabels:_}=dq(640),E=J.useCallback(()=>{const Q=z.current;if(!Q)return;const{scrollLeft:Y,scrollWidth:te,clientWidth:he}=Q;V(Y>0),$(Y+he<te-1)},[]);J.useEffect(()=>{const Q=z.current;if(Q)return E(),Q.addEventListener("scroll",E),window.addEventListener("resize",E),()=>{Q.removeEventListener("scroll",E),window.removeEventListener("resize",E)}},[E,c.length]);const I=i(Q=>{const Y=z.current;if(!Y)return;const te=Y.clientWidth*.8;Y.scrollBy({left:Q==="left"?-te:te,behavior:"smooth"})},"scrollTabs"),D=J.useMemo(()=>{const Q=n7();return x&&!k?[...Q.filter(te=>te.provider!=="elevenlabs"),...x]:Q},[x,k]),L=J.useMemo(()=>[{sectionTitle:"Basic Info",sectionValue:"basic",sectionType:"input",fields:[{title:"Name",name:"name",description:"The primary identifier for this agent",fieldType:"text",getValue:i(Q=>Q.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:i(Q=>Q.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:i(Q=>Q.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:i(Q=>Q.settings?.voice?.model||"","getValue"),options:D.map(Q=>({value:Q.value,label:Q.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:i(Q=>Array.isArray(Q.bio)?Q.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:i(Q=>Q.topics||[],"getData"),tooltip:"Subject domains the agent can discuss with confidence."},{title:"Adjectives",description:"Descriptive personality traits",path:"adjectives",getData:i(Q=>Q.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:i(Q=>Q.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:i(Q=>Q.style?.chat||[],"getData"),tooltip:"Writing style specific to conversational exchanges."},{title:"Post Style",description:"Style for long-form content",path:"style.post",getData:i(Q=>Q.style?.post||[],"getData"),tooltip:"Writing style for structured content such as articles or posts."}]}],[D]),U=i(Q=>{const{name:Y,value:te,type:he}=Q.target,oe=Q.target.checked;if(he==="checkbox")t.updateField(Y,oe);else if(Y.startsWith("settings.")){const ue=Y.substring(9);t.updateSetting?t.updateSetting(ue,te):t.updateField(Y,te)}else t.updateField(Y,te)},"handleChange"),B=i((Q,Y)=>{if(Y.startsWith("settings.")){const te=Y.substring(9);if(t.updateSetting){if(t.updateSetting(te,Q),te==="voice.model"&&Q){const he=Qm(Q);if(he){const oe=Array.isArray(e.plugins)?[...e.plugins]:[],ue=Qm(e.settings?.voice?.model),ze=r7[he.provider],we=[...oe];ze&&!oe.includes(ze)&&we.push(ze),t.setPlugins?t.setPlugins(we):t.updateField&&t.updateField("plugins",we),ue?.provider!==he.provider&&b({title:"Plugin Updated",description:`${ze} plugin has been set for the selected voice model.`})}}}else t.updateField(Y,Q)}else t.updateField(Y,Q)},"handleVoiceModelChange"),G=i((Q,Y)=>{if(!Q.includes(".")){t.updateField(Q,Y);return}const te=Q.split(".");if(te.length===2&&te[0]==="style"){t.setStyleArray?t.setStyleArray(te[1],Y):t.updateField(Q,Y);return}t.updateField(Q,Y)},"updateArray"),H=i(async Q=>{if(Q.settings?.avatar){const Y=new Image;if(Y.src=Q.settings.avatar,await new Promise(te=>Y.onload=te),Y.width>bo||Y.height>bo){const he=await(await fetch(Q.settings.avatar)).blob(),oe=new File([he],"avatar.jpg",{type:he.type}),ue=await V_(oe);return{...Q,settings:{...Q.settings,avatar:ue}}}}return Q},"ensureAvatarSize"),K=i(async Q=>{Q.preventDefault(),C(!0);try{const Y=await H(e);let te=[];if(y?.current)te=y.current.validateSecrets().missingSecrets;else{const he=Y.settings?.secrets,oe=he&&typeof he=="object"&&!Array.isArray(he)?he:{};te=j.filter(ue=>{const ze=oe[ue.name];if(ze&&typeof ze=="string"&&ze.trim()!=="")return!1;const we=m[ue.name];return!(we&&we.trim()!=="")}).map(ue=>ue.name)}if(te.length>0){C(!1),l(Y),u(!0);return}await n(Y)}catch(Y){b({title:"Error",description:Y instanceof Error?Y.message:"Failed to update agent",variant:"destructive"})}finally{C(!1)}},"handleFormSubmit"),_e=i(async()=>{if(u(!1),g){C(!0);try{await n(g)}catch(Q){b({title:"Error",description:Q instanceof Error?Q.message:"Failed to update agent",variant:"destructive"})}finally{C(!1),l(null)}}},"handleConfirmSaveWithMissingSecrets"),se=i(()=>{u(!1),l(null),P("custom-Secret")},"handleCancelSaveWithMissingSecrets"),ae=i(Q=>A.jsxs("div",{className:`w-full ${Q.name==="name"?"agent-form-name":""} ${Q.name==="system"?"agent-form-system-prompt":""}`,children:[A.jsxs(ts,{htmlFor:Q.name,className:"text-sm font-normal block mb-2",children:[Q.title,Q.name in Ua&&Ua[Q.name]===yu.REQUIRED&&A.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),Q.fieldType==="textarea"?A.jsx(Wo,{id:Q.name,name:Q.name,value:Q.getValue(e),onChange:U,className:"min-h-[120px] resize-y"}):Q.fieldType==="checkbox"?A.jsx(hr,{id:Q.name,name:Q.name,type:"checkbox",checked:e[Q.name]==="true",onChange:U}):Q.fieldType==="select"?A.jsxs(xn,{name:Q.name,value:Q.getValue(e),onValueChange:i(Y=>B(Y,Q.name),"onValueChange"),children:[A.jsx(Gi,{children:A.jsx(_n,{placeholder:Q.name.includes("voice.model")&&k?"Loading voice models...":"Select a voice model"})}),A.jsx(Vi,{children:Q.name==="settings.voice.model"?A.jsxs(A.Fragment,{children:[A.jsx(Xc,{children:A.jsx(Qt,{value:"none",children:"No Voice"})}),A.jsx(Wm,{}),A.jsxs(Xc,{children:[A.jsx(Xm,{children:"OpenAI Voices"}),i7.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label.replace("OpenAI - ","")},Y.value))]}),A.jsx(Wm,{}),A.jsxs(Xc,{children:[A.jsx(Xm,{children:"ElevenLabs Voices"}),vv.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label.replace("ElevenLabs - ","")},Y.value)),x&&x.length>0&&x.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label.replace("ElevenLabs - ","")},Y.value))]})]}):Q.options?.map(Y=>A.jsx(Qt,{value:Y.value,children:Y.label},Y.value))})]}):A.jsx(hr,{id:Q.name,name:Q.name,type:Q.fieldType,value:Q.getValue(e),onChange:U}),Q.description&&A.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Q.description})]},Q.name),"renderInputField"),ve=i(Q=>A.jsxs("div",{className:"w-full",children:[A.jsxs(ts,{htmlFor:Q.path,className:"text-sm font-normal block mb-2",children:[Q.title,Q.path in Ua&&Ua[Q.path]===yu.REQUIRED&&A.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),A.jsx(iT,{data:Q.getData(e),onChange:i(Y=>G(Q.path,Y),"onChange")}),Q.description&&A.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:Q.description})]},Q.path),"renderArrayField"),q=i(()=>{gv(e,b)},"handleExportJSON");function ne(Q){return typeof Q=="object"&&Q!==null&&("lore"in Q||"clients"in Q||"modelProvider"in Q)}i(ne,"isV1Character");const X=i(async Q=>{const Y=Q.target.files?.[0];if(Y)try{const te=await Y.text();let he=JSON.parse(te);ne(he)&&(he=S(he));const oe=Object.keys(Ua).filter(ue=>{if(Ua[ue]!==yu.REQUIRED)return!1;const ze=ue.split(".");let we=he;for(const Be of ze)if(we=we?.[Be],we===void 0)return!0;return!1});if(oe.length>0){b({title:"Import Failed",description:`Missing required fields: ${oe.join(", ")}`,variant:"destructive"});return}t.importAgent?t.importAgent(he):console.warn("Missing importAgent method"),b({title:"Agent Imported",description:"Agent data has been successfully loaded."})}catch(te){b({title:"Import Failed",description:te instanceof Error?te.message:"Invalid JSON file",variant:"destructive"})}finally{Q.target.value=""}},"handleImportJSON"),W=J.useRef(null),le=i(()=>{W.current?.click()},"handleImportClick"),ke=J.useMemo(()=>{const Q=[];return h&&Q.push({label:"Stop Agent",description:"Stop running",onClick:h}),s&&Q.push({label:"Delete Agent",description:"Delete permanently",onClick:i(()=>s(),"onClick")}),Q},[h,s]),be=J.useCallback(Q=>{if(O(Q),Q==="none"&&o){o();return}const Y=s7(Q);Y&&t.importAgent&&(t.importAgent(Y.template),d?.())},[o,t,d]),fe=[...L.map(Q=>({value:Q.sectionValue,label:Q.sectionTitle,shortLabel:Q.sectionTitle.split(" ")[0]})),...c.map(Q=>({value:`custom-${Q.name}`,label:Q.name,shortLabel:Q.shortLabel||Q.name.split(" ")[0]}))];return A.jsxs("div",{ref:f,className:"w-full max-w-full mx-auto p-6 sm:p-8 h-full overflow-y-auto",children:[(r||a)&&A.jsxs("div",{className:"mb-8",children:[r&&A.jsx("h1",{className:"text-2xl font-semibold mb-2",children:r}),a&&A.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:a})]}),A.jsxs("div",{className:"mb-8",children:[A.jsx(ts,{htmlFor:"template-selector",className:"text-sm",children:"Start with a template"}),A.jsxs(xn,{value:R,onValueChange:be,children:[A.jsx(Gi,{className:"w-full mt-1",children:A.jsx(_n,{placeholder:"None (blank start)"})}),A.jsx(Vi,{children:a7.map(Q=>A.jsx(Qt,{value:Q.id,children:A.jsx(es,{children:A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsx("span",{className:"w-full text-left",children:Q.label})}),A.jsx(lr,{side:"right",children:A.jsx("p",{className:"max-w-xs",children:Q.description})})]})})},Q.id))})]})]}),A.jsxs("form",{onSubmit:K,children:[A.jsxs(mv,{value:T,onValueChange:P,className:"w-full",children:[A.jsxs("div",{className:"relative mb-4",children:[Z&&A.jsx(et,{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:i(()=>I("left"),"onClick"),children:A.jsx(RC,{className:"h-4 w-4"})}),A.jsx("div",{ref:z,className:"overflow-x-auto scrollbar-hide",children:A.jsx(If,{className:"inline-flex h-10 items-center justify-start text-muted-foreground w-full",children:fe.map(Q=>A.jsx(xo,{value:Q.value,className:Le("whitespace-nowrap",!_&&"px-2 text-xs"),children:_?Q.label:Q.shortLabel},Q.value))})}),ee&&A.jsx(et,{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:i(()=>I("right"),"onClick"),children:A.jsx(n_,{className:"h-4 w-4"})})]}),A.jsxs("div",{className:"max-h-[100vh] overflow-y-auto pb-4 px-1",children:[L.map(Q=>A.jsx(wi,{value:Q.sectionValue,className:"space-y-6 mt-0 focus:outline-none",children:Q.sectionType==="input"?Q.fields.map(ae):Q.fields.map(ve)},Q.sectionValue)),c.map(Q=>A.jsx(wi,{value:`custom-${Q.name}`,className:"mt-0 focus:outline-none",children:A.jsx("div",{className:"h-full",children:Q.component})},`custom-${Q.name}`))]})]}),A.jsxs("div",{className:"flex items-center justify-between w-full mt-6",children:[A.jsxs(_o,{children:[A.jsx(So,{asChild:!0,children:A.jsxs(et,{type:"button",variant:"outline",size:"icon",className:"flex-shrink-0 p-2.5",children:[A.jsx(a_,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"More options"})]})}),A.jsxs(Mo,{align:"start",side:"top",children:[A.jsxs(Fi,{onClick:le,children:[A.jsx(OC,{className:"h-4 w-4 mr-2"}),"Import"]}),A.jsxs(Fi,{onClick:q,children:[A.jsx(s_,{className:"h-4 w-4 mr-2"}),"Export"]}),ke.length>0&&A.jsx(Uu,{}),ke.length>0&&ke.map(Q=>{const Y=Q.label==="Stop Agent",te=Q.label==="Delete Agent",he=Y?v:te?p:!1;return A.jsxs(Fi,{onClick:Q.onClick,disabled:he,className:te?"text-destructive focus:text-destructive hover:bg-red-50 dark:hover:bg-red-950/50":"",children:[he?A.jsx(kr,{className:"h-4 w-4 animate-spin mr-2"}):Y?A.jsx(ev,{className:"h-4 w-4 mr-2"}):A.jsx(qo,{className:"h-4 w-4 mr-2"}),he?`${Y?"Stopping":"Deleting"}...`:Q.label]},Q.label)})]})]}),A.jsxs("div",{className:"flex items-center gap-3",children:[A.jsx(es,{children:A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsxs(et,{type:"button",variant:"outline",onClick:i(()=>{o?.()},"onClick"),children:[A.jsx(o_,{className:"h-4 w-4"}),A.jsx("span",{className:"ml-2",children:"Reset"})]})}),A.jsx(lr,{children:A.jsx("p",{children:"Reset all form fields to their original values"})})]})}),A.jsx(es,{children:A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsx(et,{type:"submit",disabled:N,className:"agent-form-submit",children:N?A.jsxs(A.Fragment,{children:[A.jsx(kr,{className:"h-4 w-4 animate-spin"}),A.jsx("span",{className:"ml-2",children:"Saving..."})]}):A.jsxs(A.Fragment,{children:[A.jsx(l_,{className:"h-4 w-4"}),A.jsx("span",{className:"ml-2",children:"Save"})]})})}),A.jsx(lr,{children:A.jsx("p",{children:"Save all changes to the agent configuration"})})]})})]}),A.jsx("input",{ref:W,type:"file",accept:".json",onChange:X,className:"hidden"})]})]}),A.jsx(bT,{open:F,onOpenChange:u,missingSecrets:(()=>{let Q=[];if(y?.current)Q=y.current.validateSecrets().missingSecrets;else{const Y=e.settings?.secrets,te=Y&&typeof Y=="object"&&!Array.isArray(Y)?Y:{};Q=j.filter(he=>{const oe=te[he.name];if(oe&&typeof oe=="string"&&oe.trim()!=="")return!1;const ue=m[he.name];return!(ue&&ue.trim()!=="")}).map(he=>he.name)}return Q.map(Y=>{const te=j.find(he=>he.name===Y);return{name:Y,plugin:te?.plugin,description:te?.description}})})(),onConfirm:_e,onCancel:se})]})}i(lN,"CharacterForm");function uN({characterValue:e,setCharacterValue:t}){const r=i(()=>{const d=e?.settings?.avatar;return typeof d=="string"?d:null},"getAvatarUrl"),[a,n]=J.useState(r()),[s,o]=J.useState(!1),h=J.useRef(null);J.useEffect(()=>{n(r()),o(!1)},[e.id]);const p=i(async d=>{const y=d.target.files?.[0];if(y)try{const b=await V_(y);n(b),o(!0),c(b)}catch(b){console.error("Error compressing image:",b)}},"handleFileUpload"),v=i(()=>{a&&(n(null),o(!0),c(""))},"handleRemoveAvatar"),c=i(d=>{t.updateAvatar?t.updateAvatar(d):t.updateSetting?t.updateSetting("avatar",d):t.updateField&&t.updateField("settings.avatar",d)},"updateCharacterAvatar");return A.jsxs("div",{className:"rounded-lg w-full",children:[A.jsx("h2",{className:"text-xl font-bold mb-4 pb-5 ml-1",children:"Avatar Settings"}),A.jsxs("div",{className:"flex flex-col items-center gap-4 pb-4 max-w-sm mx-auto",children:[a?A.jsx("div",{className:"w-64 h-64 mb-2",children:A.jsx("img",{src:a,alt:"Agent Avatar",className:"object-cover w-full h-full rounded-lg border"})}):A.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:i(()=>h.current?.click(),"onClick"),children:A.jsxs("div",{className:"flex flex-col items-center gap-2",children:[A.jsx(TC,{className:"w-10 h-10"}),A.jsx("span",{className:"text-sm",children:"Click to upload"})]})}),A.jsxs("div",{className:"flex flex-col gap-3 w-64",children:[A.jsx("input",{type:"file",accept:"image/*",className:"hidden",ref:h,onChange:p}),A.jsxs("div",{className:"flex gap-2",children:[A.jsxs(et,{type:"button",className:"flex items-center gap-2 flex-1",onClick:i(()=>h.current?.click(),"onClick"),children:[A.jsx(PC,{className:"w-5 h-5"}),a?"Replace":"Upload"]}),a&&A.jsx(et,{type:"button",variant:"outline",className:"flex items-center",onClick:v,children:A.jsx(Fr,{className:"w-5 h-5"})})]}),A.jsxs("div",{className:"flex items-center justify-center gap-1 text-xs text-muted-foreground mt-1",children:[A.jsx(tv,{className:"w-3.5 h-3.5"}),A.jsxs("span",{children:["Images greater than ",bo,"x",bo," will be resized"]})]})]})]})]})}i(uN,"AvatarPanel");const Vb=D5,hq=L5,pq=B5,fN=J.forwardRef(({className:e,...t},r)=>A.jsx(bf,{ref:r,className:Le("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",e),...t}));fN.displayName=bf.displayName;const wc=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(pq,{children:[A.jsx(fN,{}),A.jsxs(vf,{ref:a,className:Le("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",e),...r,children:[t,A.jsxs(z5,{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:[A.jsx(Fr,{className:"h-4 w-4"}),A.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wc.displayName=vf.displayName;const xc=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col space-y-1.5 text-center sm:text-left",e),...t}),"DialogHeader");xc.displayName="DialogHeader";const Zb=i(({className:e,...t})=>A.jsx("div",{className:Le("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t}),"DialogFooter");Zb.displayName="DialogFooter";const _c=J.forwardRef(({className:e,...t},r)=>A.jsx(yf,{ref:r,className:Le("text-lg font-semibold leading-none tracking-tight",e),...t}));_c.displayName=yf.displayName;const Hb=J.forwardRef(({className:e,...t},r)=>A.jsx(wf,{ref:r,className:Le("text-sm text-muted-foreground",e),...t}));Hb.displayName=wf.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 cN({characterValue:e,setCharacterValue:t,initialPlugins:r}){const{data:a,error:n}=oN(),{toast:s}=rr(),[o,h]=J.useState(""),[p,v]=J.useState(!1),[c,d]=J.useState(null),[y,b]=J.useState(!1),x=J.useMemo(()=>Array.isArray(e?.plugins)?e.plugins:[],[e?.plugins]),k=J.useMemo(()=>{const V=["@elizaos/plugin-sql"];return a?[...V,...(Array.isArray(a)?a:Object.keys(a)).filter(ee=>!V.includes(ee))]:V},[a]),N=J.useMemo(()=>{const V=e?.settings;if(!V||typeof V!="object"||Array.isArray(V))return null;const ee=V.voice;if(!ee||typeof ee!="object"||Array.isArray(ee))return null;const $=ee.model;if(!$||typeof $!="string")return null;const F=Qm($);if(!F)return null;const u=r7[F.provider],g=x.includes(u);return{provider:F.provider,requiredPlugin:u,isPluginEnabled:g}},[e?.settings,x]),C=J.useMemo(()=>r?r.length!==x.length?!0:!r?.every(V=>x.includes(V)):!1,[x,r]),R=J.useMemo(()=>k.filter(V=>!x.includes(V)).filter(V=>V.toLowerCase().includes(o.toLowerCase())),[k,x,o]),O=i(V=>{if(!x.includes(V)){if(t.addPlugin)t.addPlugin(V);else if(t.updateField){const ee=Array.isArray(e.plugins)?[...e.plugins]:[];t.updateField("plugins",[...ee,V])}}},"handlePluginAdd"),T=i(V=>{if(Object.keys(Cn).includes(V)){d(V),b(!0);return}P(V)},"handlePluginRemove"),P=i(V=>{const ee=x.indexOf(V);if(ee!==-1){if(t.removePlugin)t.removePlugin(ee);else if(t.updateField){const $=[...x];$.splice(ee,1),t.updateField("plugins",$)}}},"removePlugin"),z=i(()=>{c&&(P(c),d(null)),b(!1)},"handleConfirmRemoval"),Z=i(()=>{d(null),b(!1)},"handleCancelRemoval");return A.jsx("div",{className:"space-y-6",children:A.jsx("div",{className:"space-y-4",children:A.jsxs("div",{children:[A.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plugins"}),n?A.jsxs("p",{className:"text-destructive",children:["Failed to load plugins: ",n.message]}):A.jsxs("div",{className:"space-y-4",children:[A.jsx(bv,{open:y,onOpenChange:b,children:A.jsxs(Cf,{children:[A.jsxs(Rf,{children:[A.jsx(Tf,{children:c&&Object.keys(Cn).includes(c)?Cn[c].title:"Warning: Essential Plugin"}),A.jsx(Pf,{children:c&&Object.keys(Cn).includes(c)?Cn[c].description:"This plugin provides essential functionality for your agent."})]}),A.jsxs(Of,{children:[A.jsx(Lf,{onClick:Z,children:"Cancel"}),A.jsx(Df,{onClick:z,children:"Confirm Removal"})]})]})}),N&&A.jsxs("div",{className:"rounded-md border p-4 mb-4 flex items-center gap-2",children:[A.jsx(fi,{className:"h-4 w-4 text-yellow-500"}),A.jsx("p",{className:"text-xs text-white",children:(()=>{switch(N.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`${N.provider} plugin is required for the selected voice model.`}})()})]}),x.length>0&&A.jsxs("div",{className:"rounded-md bg-muted p-4",children:[A.jsx("h4",{className:"text-sm font-medium mb-2",children:"Currently Enabled"}),A.jsx("div",{className:"flex flex-wrap gap-2",children:[...x].sort((V,ee)=>{const $=Object.keys(Cn).includes(V),F=Object.keys(Cn).includes(ee);return $===F?0:$?-1:1}).map(V=>{const ee=N?.requiredPlugin===V,$=Object.keys(Cn).includes(V);return A.jsxs(et,{type:"button",variant:"ghost",size:"sm",className:`inline-flex items-center rounded-full ${$?"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:ee?"Required by voice model":$?"Essential plugin for agent functionality":"",children:[$&&A.jsx("span",{className:"w-2 h-2 rounded-full bg-white inline-block"}),A.jsx("span",{className:"text-white font-semibold",children:V}),A.jsx("span",{className:fv("ml-1 opacity-70 hover:opacity-100",$&&"text-white"),onClick:i(()=>{if(ee){s({title:"Can't Remove Plugin",description:"This plugin is required by the selected voice model.",variant:"destructive"});return}T(V)},"onClick"),children:"×"})]},V)})}),A.jsx("div",{className:"mt-3 text-xs text-muted-foreground",children:A.jsxs("span",{className:"inline-flex items-center",children:[A.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-600 mr-1"}),"Essential plugins provide core functionality"]})})]}),A.jsx("div",{className:"space-y-2",children:A.jsxs(Vb,{open:p,onOpenChange:v,children:[A.jsx(hq,{asChild:!0,children:A.jsx(et,{variant:"outline",className:"w-full justify-start",children:"Search and add plugins..."})}),A.jsxs(wc,{className:"max-w-[400px]",children:[A.jsx(xc,{children:A.jsx(_c,{children:"Add Plugins"})}),A.jsxs("div",{className:"space-y-4 py-4",children:[A.jsx("div",{className:"space-y-2",children:A.jsx(hr,{type:"search",placeholder:"Search plugins...",value:o,onChange:i(V=>h(V.target.value),"onChange")})}),A.jsx("div",{className:"max-h-[300px] overflow-y-auto space-y-2",children:R.length===0?A.jsx("p",{className:"text-sm text-muted-foreground",children:"No plugins found."}):R.map(V=>A.jsx(et,{variant:"ghost",className:"w-full justify-start font-normal",onClick:i(()=>{O(V),h(""),v(!1)},"onClick"),children:V},V))})]})]})]})}),C&&A.jsx("p",{className:"text-xs text-yellow-500",children:"Plugins configuration has been changed"})]})]})})})}i(cN,"PluginsPanel");const dN=J.forwardRef(({className:e,children:t,...r},a)=>A.jsxs(u_,{ref:a,className:Le("relative overflow-hidden",e),...r,children:[A.jsx(DC,{className:"h-full w-full rounded-[inherit]",children:t}),A.jsx(hN,{}),A.jsx(LC,{})]}));dN.displayName=u_.displayName;const hN=J.forwardRef(({className:e,orientation:t="vertical",...r},a)=>A.jsx(f_,{ref:a,orientation:t,className:Le("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:A.jsx(BC,{className:"relative flex-1 rounded-full bg-border"})}));hN.displayName=f_.displayName;const mq=En("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"}}),Ug=J.forwardRef(({className:e,variant:t,...r},a)=>A.jsx("div",{ref:a,role:"alert",className:Le(mq({variant:t}),e),...r}));Ug.displayName="Alert";const gq=J.forwardRef(({className:e,...t},r)=>A.jsx("h5",{ref:r,className:Le("mb-1 font-medium leading-none tracking-tight",e),...t}));gq.displayName="AlertTitle";const Fg=J.forwardRef(({className:e,...t},r)=>A.jsx("div",{ref:r,className:Le("text-sm [&_p]:leading-relaxed",e),...t}));Fg.displayName="AlertDescription";const Jb=J.forwardRef(({characterValue:e,onChange:t},r)=>{const[a,n]=J.useState([]),[s,o]=J.useState(""),[h,p]=J.useState(""),[v,c]=J.useState(!1),[d,y]=J.useState(null),[b,x]=J.useState(""),[k,N]=J.useState(!1),[C,R]=J.useState([]),[O,T]=J.useState(new Set),[P,z]=J.useState({}),[Z,V]=J.useState(!0),[ee,$]=J.useState(!1),[F,u]=J.useState(""),g=J.useRef(null),l=J.useRef(""),m=J.useRef(null),w=J.useRef(""),M=J.useMemo(()=>e?.plugins||[],[e?.plugins]),{requiredSecrets:j,isLoading:S}=sN(M);J.useEffect(()=>{i(async()=>{try{V(!0);const le=await Yt().system.getEnvironment();z(le||{})}catch(W){console.error("Failed to fetch global environment variables:",W),z({})}finally{V(!1)}},"fetchGlobalEnvs")()},[]);const f=J.useCallback(()=>{const X={};return a.forEach(({name:W,value:le})=>{X[W]=le}),C.forEach(W=>{X[W]=null}),X},[a,C]),_=J.useCallback(()=>{const X=f(),le=(S?a.filter(ke=>ke.isRequired):j).filter(ke=>{const be=typeof ke=="object"&&"name"in ke?ke.name:ke,fe=X[be];return!(fe&&fe.trim()!==""||P[be]&&P[be].trim()!=="")}).map(ke=>typeof ke=="object"&&"name"in ke?ke.name:ke);return{isValid:le.length===0,missingSecrets:le}},[f,j,S,a,P]);J.useImperativeHandle(r,()=>({getSecrets:f,validateSecrets:_}),[f,_]);const E=i(X=>{T(W=>{const le=new Set(W);return le.has(X)?le.delete(X):le.add(X),le})},"toggleSecretVisibility"),I=J.useCallback(()=>{const X=[];X.push("# Environment Variables"),X.push("");const W=a.filter(ke=>ke.isRequired),le=a.filter(ke=>!ke.isRequired&&ke.value&&ke.value.trim()!=="");return W.length>0&&(X.push("# Required Secrets"),W.forEach(ke=>{ke.plugin&&X.push(`# Required by ${ke.plugin}`),ke.description&&X.push(`# ${ke.description}`),X.push(`${ke.name}=${ke.value||""}`),X.push("")})),le.length>0&&(X.push("# Optional Variables"),le.forEach(ke=>{X.push(`${ke.name}=${ke.value}`)})),X.join(`
81
81
  `)},[a]),D=J.useCallback(X=>{const W=X.split(`
82
82
  `),le={};for(const ke of W){const be=ke.trim();if(!be||be.startsWith("#"))continue;const[fe,...Q]=be.split("="),Y=Q.join("=").trim().replace(/^['"]|['"]$/g,"");fe&&fe.trim()&&(le[fe.trim()]=Y)}return le},[]),L=i(()=>{const X=D(F),W=a.map(le=>{if(X.hasOwnProperty(le.name)){const ke=X[le.name].startsWith("process.env.")?"":X[le.name];return{...le,value:ke,isModified:le.value!==ke}}return le.isRequired?{...le,value:"",isModified:le.value!==""}:null}).filter(Boolean);Object.entries(X).forEach(([le,ke])=>{if(!W.some(fe=>fe.name===le)){const fe=ke.startsWith("process.env.")?"":ke,Q=j.find(Y=>Y.name===le);W.push({name:le,value:fe,isNew:!0,isModified:!1,isDeleted:!1,isRequired:Q?.required||!1,description:Q?.description,example:Q?.example,plugin:Q?.plugin})}}),W.sort((le,ke)=>le.isRequired&&!ke.isRequired?-1:!le.isRequired&&ke.isRequired?1:le.name.localeCompare(ke.name)),n(W),$(!1)},"handleRawEditorSave"),U=i(()=>{u(I()),$(!0)},"openRawEditor"),B=i(()=>{navigator.clipboard.writeText(F)},"copyEnvContent");J.useEffect(()=>{if(!(S||Z)&&(e.id!==g.current||!g.current||a.length===0)){const X=TJ(),W=e?.settings?.secrets||{},le=typeof W=="object"&&!Array.isArray(W)&&W!==null?DJ(W,X):{},ke=Object.entries(le).map(([Y,te])=>{const he=String(te),oe=he.startsWith("process.env.")?"":he;return{name:Y,value:oe,isNew:!1,isModified:!1,isDeleted:!1,isRequired:!1,description:void 0,example:void 0,plugin:void 0}}),be=new Map(ke.map(Y=>[Y.name,Y])),fe=[...ke];j.forEach(Y=>{if(!be.has(Y.name))fe.push({name:Y.name,value:"",isNew:!0,isModified:!1,isDeleted:!1,isRequired:!0,description:Y.description,example:Y.example,plugin:Y.plugin});else{const te=fe.findIndex(he=>he.name===Y.name);te!==-1&&(fe[te]={...fe[te],isRequired:!0,description:Y.description,example:Y.example,plugin:Y.plugin})}}),fe.sort((Y,te)=>Y.isRequired&&!te.isRequired?-1:!Y.isRequired&&te.isRequired?1:Y.name.localeCompare(te.name)),n(fe),R([]),g.current=e.id||"new-agent";const Q=j.map(Y=>Y.name).sort().join(",");w.current=Q}},[e.id,e.settings?.secrets,j,S,P,Z]),J.useEffect(()=>{if(S)return;const X=j.map(le=>le.name).sort().join(",");if(X===w.current)return;w.current=X;const W=new Set(j.map(le=>le.name));n(le=>{const ke=le.map(fe=>{const Q=W.has(fe.name),Y=j.find(te=>te.name===fe.name);return fe.isRequired&&!Q?(setTimeout(()=>{R(te=>te.includes(fe.name)?te:[...te,fe.name])},0),null):Q&&Y?{...fe,isRequired:!0,description:Y.description,example:Y.example,plugin:Y.plugin}:{...fe,isRequired:Q,description:Q?fe.description:void 0,example:Q?fe.example:void 0,plugin:Q?fe.plugin:void 0}}).filter(Boolean),be=new Set(ke.map(fe=>fe.name));return j.forEach(fe=>{be.has(fe.name)||ke.push({name:fe.name,value:"",isNew:!0,isModified:!1,isDeleted:!1,isRequired:!0,description:fe.description,example:fe.example,plugin:fe.plugin})}),ke.sort((fe,Q)=>fe.isRequired&&!Q.isRequired?-1:!fe.isRequired&&Q.isRequired?1:fe.name.localeCompare(Q.name)),ke})},[j,S,P]),J.useEffect(()=>{const X=new Set(j.map(W=>W.name));n(W=>W.filter(ke=>{const be=X.has(ke.name)||!ke.isRequired&&ke.value&&ke.value.trim()!=="";return!be&&ke.isRequired&&R(fe=>fe.includes(ke.name)?fe:[...fe,ke.name]),be}))},[j]),J.useEffect(()=>{if(!t)return;const X=setTimeout(()=>{const W=f(),le=new Set(a.map(Q=>Q.name)),ke=e?.settings?.secrets||{};Object.keys(ke).forEach(Q=>{!le.has(Q)&&!C.includes(Q)&&(W[Q]=null)});const be=Object.keys(W).sort().reduce((Q,Y)=>(Q[Y]=W[Y],Q),{}),fe=JSON.stringify(be);fe!==l.current&&(l.current=fe,t(W))},100);return()=>clearTimeout(X)},[a,C,t,e?.settings?.secrets,f]);const G=J.useCallback(X=>{const W=new FileReader;W.onload=le=>{const be=(le.target?.result).split(`
83
83
  `),fe={};for(const Q of be){const Y=Q.trim();if(!Y||Y.startsWith("#"))continue;const[te,...he]=Y.split("="),oe=he.join("=").trim().replace(/^['"]|['"]$/g,"");te&&(fe[te.trim()]=oe)}n(Q=>{const Y=new Map(Q.map(({name:he,value:oe,...ue})=>[he,{value:oe,...ue}]));for(const[he,oe]of Object.entries(fe)){const ue=oe.startsWith("process.env.")?"":oe,ze=Y.get(he);if(ze)Y.set(he,{...ze,value:ue,isModified:!0});else{const we=j.find(Be=>Be.name===he);Y.set(he,{value:ue,isNew:!0,isModified:!1,isRequired:we?.required||!1,description:we?.description,example:we?.example,plugin:we?.plugin})}}const te=Array.from(Y.entries()).map(([he,oe])=>({name:he,...oe}));return te.sort((he,oe)=>he.isRequired&&!oe.isRequired?-1:!he.isRequired&&oe.isRequired?1:he.name.localeCompare(oe.name)),te}),C.length>0&&R(Q=>Q.filter(Y=>!Object.keys(fe).includes(Y)))},W.readAsText(X)},[j,C]);J.useEffect(()=>{const X=m.current;if(!X)return;const W=i(fe=>{fe.preventDefault(),fe.stopPropagation()},"preventDefaults"),le=i(()=>{N(!0)},"highlight"),ke=i(()=>{N(!1)},"unhighlight"),be=i(fe=>{W(fe),ke();const Q=fe.dataTransfer?.files?.[0];Q&&Q.name.endsWith(".env")&&G(Q)},"handleDrop");return["dragenter","dragover"].forEach(fe=>X.addEventListener(fe,le)),["dragleave","drop"].forEach(fe=>X.addEventListener(fe,ke)),["dragenter","dragover","dragleave","drop"].forEach(fe=>X.addEventListener(fe,W)),X.addEventListener("drop",be),()=>{["dragenter","dragover","dragleave","drop"].forEach(fe=>X.removeEventListener(fe,W)),["dragenter","dragover"].forEach(fe=>X.removeEventListener(fe,le)),["dragleave","drop"].forEach(fe=>X.removeEventListener(fe,ke)),X.removeEventListener("drop",be)}},[G]);const H=i(()=>{if(s&&h){const X=a.some(le=>le.name===s),W=h.startsWith("process.env.")?"":h;if(X)n(a.map(le=>le.name===s?{...le,value:W,isModified:!0}:le)),o(""),p("");else{C.includes(s)&&R(C.filter(fe=>fe!==s));const le=j.find(fe=>fe.name===s),ke={name:s,value:W,isNew:!0,isRequired:le?.required||!1,description:le?.description,example:le?.example,plugin:le?.plugin},be=[...a,ke];be.sort((fe,Q)=>fe.isRequired&&!Q.isRequired?-1:!fe.isRequired&&Q.isRequired?1:fe.name.localeCompare(Q.name)),n(be),o(""),p("")}}},"addEnv"),K=i(X=>{d!==null&&d!==X&&y(null),y(X),x(a[X].value),T(W=>new Set(W).add(X))},"startEditing"),_e=i(X=>{const W=[...a],le=b.startsWith("process.env.")?"":b;W[X].value!==le&&(W[X].value=le,W[X].isModified=!0),n(W),y(null),x(""),T(ke=>{const be=new Set(ke);return be.delete(X),be})},"saveEdit"),se=i(()=>{const X=d;y(null),x(""),X!==null&&T(W=>{const le=new Set(W);return le.delete(X),le})},"cancelEdit"),ae=i(X=>{const W=a[X].name;R([...C,W]),n(a.filter((le,ke)=>ke!==X)),y(null)},"removeEnv"),ve=j.filter(X=>{const W=a.find(be=>be.name===X.name),le=W&&W.value&&W.value.trim()!=="",ke=P[X.name]&&P[X.name].trim()!=="";return!le&&!ke}),q=J.useCallback(X=>P[X]&&P[X].trim()!=="",[P]),ne="scrollbar-visible";return A.jsxs("div",{className:"w-full h-full flex flex-col",children:[A.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("h2",{className:"text-lg font-semibold",children:"Variables"}),A.jsxs(xi,{variant:"secondary",className:"text-xs",children:[a.filter(X=>X.value&&X.value.trim()!=="").length," Service Variables"]})]}),A.jsxs(et,{type:"button",variant:"outline",size:"sm",onClick:U,className:"flex items-center gap-2",children:[A.jsx(ma,{className:"w-4 h-4"}),"Raw Editor"]})]}),A.jsx(dN,{className:"flex-1",children:A.jsxs("div",{className:"p-4 space-y-4",children:[(S||Z)&&A.jsxs("div",{className:"space-y-2",children:[A.jsx(wo,{className:"h-4 w-48"}),A.jsx(wo,{className:"h-4 w-64"})]}),!S&&!Z&&ve.length>0&&A.jsxs(Ug,{children:[A.jsx(fi,{className:"h-4 w-4"}),A.jsxs(Fg,{children:[A.jsx("strong",{children:"Missing required secrets:"}),A.jsx("ul",{className:"mt-2 space-y-1",children:ve.map(X=>A.jsxs("li",{className:"text-sm",children:["• ",A.jsx("code",{className:"font-mono",children:X.name}),X.plugin&&A.jsxs("span",{className:"text-muted-foreground ml-1",children:["(required by ",X.plugin,")"]})]},X.name))})]})]}),!S&&!Z&&j.some(X=>q(X.name)&&!a.find(W=>W.name===X.name)?.value)&&A.jsxs(Ug,{className:"border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-900/20",children:[A.jsx($c,{className:"h-4 w-4 text-blue-600 dark:text-blue-400"}),A.jsxs(Fg,{className:"text-blue-800 dark:text-blue-200",children:[A.jsx("strong",{children:"Global environment variables detected:"}),A.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."})]})]}),A.jsxs("div",{className:"space-y-2",children:[A.jsxs("div",{className:"hidden md:grid md:grid-cols-[minmax(200px,1fr)_2fr_auto] gap-2 items-end",children:[A.jsxs("div",{className:"space-y-1",children:[A.jsx("label",{htmlFor:"new-secret-name",className:"text-xs font-medium text-muted-foreground uppercase",children:"Name"}),A.jsx(hr,{id:"new-secret-name",placeholder:"VARIABLE_NAME",value:s,onChange:i(X=>o(X.target.value),"onChange"),className:"font-mono text-sm",onKeyDown:i(X=>{X.key==="Enter"&&(X.preventDefault(),H())},"onKeyDown")})]}),A.jsxs("div",{className:"space-y-1",children:[A.jsx("label",{htmlFor:"new-secret-value",className:"text-xs font-medium text-muted-foreground uppercase",children:"Value"}),A.jsxs("div",{className:"relative",children:[A.jsx("div",{className:`rounded border ${ne}`,children:A.jsx(hr,{id:"new-secret-value",type:v?"text":"password",placeholder:"Enter value...",value:h,onChange:i(X=>p(X.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:i(X=>{X.key==="Enter"&&(X.preventDefault(),H())},"onKeyDown")})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:i(()=>c(!v),"onClick"),children:v?A.jsx(mn,{className:"w-4 h-4"}):A.jsx(zi,{className:"w-4 h-4"})})]})]}),A.jsx(et,{type:"button",onClick:H,size:"sm",children:"Add"})]}),A.jsxs("div",{className:"md:hidden space-y-3",children:[A.jsxs("div",{className:"space-y-1",children:[A.jsx("label",{htmlFor:"new-secret-name-mobile",className:"text-xs font-medium text-muted-foreground uppercase",children:"Name"}),A.jsx(hr,{id:"new-secret-name-mobile",placeholder:"VARIABLE_NAME",value:s,onChange:i(X=>o(X.target.value),"onChange"),className:"font-mono text-sm w-full",onKeyDown:i(X=>{X.key==="Enter"&&(X.preventDefault(),document.getElementById("new-secret-value-mobile")?.focus())},"onKeyDown")})]}),A.jsxs("div",{className:"space-y-1",children:[A.jsx("label",{htmlFor:"new-secret-value-mobile",className:"text-xs font-medium text-muted-foreground uppercase",children:"Value"}),A.jsxs("div",{className:"relative",children:[A.jsx("div",{className:`rounded border ${ne}`,children:A.jsx(hr,{id:"new-secret-value-mobile",type:v?"text":"password",placeholder:"Enter value...",value:h,onChange:i(X=>p(X.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:i(X=>{X.key==="Enter"&&(X.preventDefault(),H())},"onKeyDown")})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",onClick:i(()=>c(!v),"onClick"),children:v?A.jsx(mn,{className:"w-4 h-4"}):A.jsx(zi,{className:"w-4 h-4"})})]})]}),A.jsx(et,{type:"button",onClick:H,size:"sm",className:"w-full",children:"Add Variable"})]})]}),a.length>0&&A.jsxs(es,{children:[A.jsxs("div",{className:"hidden md:block border rounded-lg overflow-hidden relative",children:[A.jsx("div",{className:"bg-muted/50 px-4 py-2 border-b",children:A.jsxs("div",{className:"grid grid-cols-[minmax(200px,1fr)_2fr_auto] gap-4 text-xs font-medium text-muted-foreground uppercase",children:[A.jsx("div",{children:"Name"}),A.jsx("div",{children:"Value"}),A.jsx("div",{className:"text-center",children:"Actions"})]})}),A.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:a.map((X,W)=>A.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 ${X.isRequired&&(!X.value||X.value.trim()==="")&&!q(X.name)?"bg-red-500/5":""}`,children:[A.jsxs("div",{className:"pr-2",children:[A.jsxs("div",{className:"flex items-start gap-2 flex-wrap",children:[A.jsx("code",{className:"font-mono text-sm font-medium break-words cursor-default",children:X.name}),X.isRequired&&A.jsx(xi,{variant:"outline",className:"text-xs shrink-0",children:"Required"}),q(X.name)&&A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsxs(xi,{variant:"secondary",className:"text-xs shrink-0 flex items-center gap-1",children:[A.jsx($c,{className:"w-3 h-3"}),"Global"]})}),A.jsx(lr,{children:A.jsx("p",{children:X.value?"Overriding global value":"Value pulled from global environment. Add new value to override."})})]})]}),X.description&&A.jsx("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:X.description}),X.plugin&&A.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["Required by: ",X.plugin]})]}),A.jsx("div",{className:"min-w-0",children:d===W?A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsx("div",{className:"relative flex-1",children:A.jsx("div",{className:`rounded border ${ne}`,children:A.jsx(hr,{value:b,onChange:i(le=>x(le.target.value),"onChange"),className:"font-mono text-sm border-0 focus-visible:ring-0 w-auto min-w-full rounded",style:{minWidth:"100%"},type:O.has(W)?"text":"password",placeholder:q(X.name)&&!X.value?"Using global (enter to override)":X.example||"Enter value...",autoFocus:!0,onKeyDown:i(le=>{le.key==="Enter"?(le.preventDefault(),_e(W)):le.key==="Escape"&&se()},"onKeyDown")})})}),A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>E(W),"onClick"),className:"h-8 w-8 p-0",children:O.has(W)?A.jsx(mn,{className:"w-4 h-4"}):A.jsx(zi,{className:"w-4 h-4"})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>_e(W),"onClick"),className:"h-8 w-8 p-0 text-green-600 hover:text-green-700",children:A.jsx(Sn,{className:"w-4 h-4"})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:se,className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:A.jsx(Fr,{className:"w-4 h-4"})})]})]}):A.jsxs("div",{className:"flex items-center gap-2 group",children:[A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsx("div",{className:`flex-1 border rounded px-3 py-1 ${ne}`,children:O.has(W)?A.jsx("code",{className:"font-mono text-sm whitespace-nowrap block",children:X.value||A.jsx("span",{className:"text-muted-foreground italic",children:q(X.name)?"Using global value":X.example?`e.g. ${X.example}`:"Not set"})}):X.value?A.jsx("code",{className:"font-mono text-sm text-muted-foreground block",children:"••••••••"}):A.jsx("span",{className:"text-muted-foreground italic text-sm block",children:q(X.name)?"Using global value":"Not set"})})}),q(X.name)&&A.jsx(lr,{className:"max-w-xs",children:A.jsxs("div",{className:"space-y-1",children:[A.jsx("p",{className:"font-semibold",children:"Global Environment Variable"}),A.jsx("p",{className:"text-sm",children:X.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."})]})})]}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>E(W),"onClick"),className:"h-8 w-8 p-0 opacity-0 group-hover:opacity-100 transition-opacity",children:O.has(W)?A.jsx(mn,{className:"w-4 h-4"}):A.jsx(zi,{className:"w-4 h-4"})})]})}),A.jsxs("div",{className:"flex items-center justify-center gap-1",children:[A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>K(W),"onClick"),disabled:d!==null&&d!==W,className:"h-8 w-8 p-0",children:A.jsx(Ey,{className:"w-4 h-4"})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>ae(W),"onClick"),disabled:d!==null,className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:A.jsx(xa,{className:"w-4 h-4"})})]})]},`${X.name}-${W}`))})]}),A.jsx("div",{className:"md:hidden space-y-3",children:a.map((X,W)=>A.jsxs("div",{className:`border rounded-lg p-4 space-y-3 ${X.isRequired&&(!X.value||X.value.trim()==="")?"border-red-500/50 bg-red-500/5":""}`,children:[A.jsx("div",{className:"space-y-1",children:A.jsxs("div",{className:"flex items-start justify-between gap-2",children:[A.jsxs("div",{className:"flex-1 min-w-0",children:[A.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[A.jsx("code",{className:"font-mono text-sm font-medium break-all",children:X.name}),X.isRequired&&A.jsx(xi,{variant:"outline",className:"text-xs",children:"Required"}),q(X.name)&&A.jsxs(xi,{variant:"secondary",className:"text-xs flex items-center gap-1",children:[A.jsx($c,{className:"w-3 h-3"}),"Global"]})]}),X.description&&A.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:X.description}),X.plugin&&A.jsxs("div",{className:"text-xs text-muted-foreground",children:["Required by: ",X.plugin]})]}),A.jsxs("div",{className:"flex items-center gap-1",children:[A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>K(W),"onClick"),disabled:d!==null&&d!==W,className:"h-8 w-8 p-0",children:A.jsx(Ey,{className:"w-4 h-4"})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>ae(W),"onClick"),disabled:d!==null,className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:A.jsx(xa,{className:"w-4 h-4"})})]})]})}),A.jsxs("div",{className:"space-y-1",children:[A.jsx("div",{className:"text-xs font-medium text-muted-foreground uppercase",children:"Value"}),d===W?A.jsxs("div",{className:"space-y-2",children:[A.jsxs("div",{className:"relative",children:[A.jsx("div",{className:`rounded border ${ne}`,children:A.jsx(hr,{value:b,onChange:i(le=>x(le.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:O.has(W)?"text":"password",placeholder:q(X.name)&&!X.value?"Using global (enter to override)":X.example||"Enter value...",autoFocus:!0,onKeyDown:i(le=>{le.key==="Enter"?(le.preventDefault(),_e(W)):le.key==="Escape"&&se()},"onKeyDown")})}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>E(W),"onClick"),className:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7 p-0",children:O.has(W)?A.jsx(mn,{className:"w-4 h-4"}):A.jsx(zi,{className:"w-4 h-4"})})]}),A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsxs(et,{type:"button",variant:"outline",size:"sm",onClick:i(()=>_e(W),"onClick"),className:"flex-1",children:[A.jsx(Sn,{className:"w-4 h-4 mr-2"}),"Save"]}),A.jsxs(et,{type:"button",variant:"ghost",size:"sm",onClick:se,className:"flex-1",children:[A.jsx(Fr,{className:"w-4 h-4 mr-2"}),"Cancel"]})]})]}):A.jsxs("div",{className:"flex items-center gap-2",children:[A.jsxs(cr,{children:[A.jsx(dr,{asChild:!0,children:A.jsx("div",{className:`flex-1 border rounded px-3 py-1 ${ne}`,children:O.has(W)?A.jsx("code",{className:"font-mono text-sm whitespace-nowrap block",children:X.value||A.jsx("span",{className:"text-muted-foreground italic",children:q(X.name)?"Using global value":X.example?`e.g. ${X.example}`:"Not set"})}):X.value?A.jsx("code",{className:"font-mono text-sm text-muted-foreground block",children:"••••••••"}):A.jsx("span",{className:"text-muted-foreground italic text-sm block",children:q(X.name)?"Using global value":"Not set"})})}),q(X.name)&&A.jsx(lr,{className:"max-w-xs",children:A.jsxs("div",{className:"space-y-1",children:[A.jsx("p",{className:"font-semibold",children:"Global Environment Variable"}),A.jsx("p",{className:"text-sm",children:X.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."})]})})]}),A.jsx(et,{type:"button",variant:"ghost",size:"sm",onClick:i(()=>E(W),"onClick"),className:"h-8 w-8 p-0",children:O.has(W)?A.jsx(mn,{className:"w-4 h-4"}):A.jsx(zi,{className:"w-4 h-4"})})]})]})]},`${X.name}-${W}-mobile`))})]}),A.jsxs("div",{ref:m,className:`border-2 border-dashed rounded-lg p-6 text-center cursor-pointer transition-colors ${k?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-muted-foreground/50"}`,onClick:i(()=>document.getElementById("env-upload")?.click(),"onClick"),children:[A.jsx(zC,{className:"w-8 h-8 mx-auto mb-2 text-muted-foreground"}),A.jsxs("div",{className:"text-sm text-muted-foreground",children:["Drag & drop ",A.jsx("code",{className:"bg-muted px-1 rounded",children:".env"})," file or click to select"]}),A.jsx("input",{id:"env-upload",type:"file",accept:"*/*",className:"hidden",onChange:i(X=>{const W=X.target.files?.[0];W&&W.name.endsWith(".env")&&G(W)},"onChange")})]})]})}),A.jsx(Vb,{open:ee,onOpenChange:$,children:A.jsxs(wc,{className:"max-w-3xl h-[600px] flex flex-col",children:[A.jsxs(xc,{children:[A.jsx(_c,{children:"Raw Editor"}),A.jsx(Hb,{children:"Add, edit, or delete your project variables in .env format"})]}),A.jsx("div",{className:"flex-1 border rounded-lg overflow-hidden",children:A.jsx(Wo,{value:F,onChange:i(X=>u(X.target.value),"onChange"),placeholder:`# Environment Variables
@@ -152,4 +152,4 @@ and limitations under the License.
152
152
  transition-all duration-300 ease-in-out
153
153
  ${C==="agents"&&o>0?"opacity-100 scale-100":"opacity-0 scale-75 pointer-events-none"}
154
154
  `,children:o})]}),A.jsx(xo,{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"})]}),A.jsxs(et,{variant:"ghost",onClick:i(()=>{C==="agents"?n("/create"):P()},"onClick"),className:"create-agent-button cursor-pointer gap-1",children:[A.jsx(_f,{className:"w-4 h-4"}),C==="agents"?"Create New Agent":"Create New Group"]})]}),A.jsx(ei,{})]})}),A.jsx(wi,{value:"agents",className:"flex-1 mt-0 bg-background",children:A.jsxs("div",{className:"flex flex-col gap-6 w-full md:max-w-4xl mx-auto px-6 py-2",children:[t&&A.jsx("div",{className:"text-center py-8",children:"Loading agents..."}),r&&A.jsxs("div",{className:"text-center py-8",children:["Error loading agents: ",a instanceof Error?a.message:"Unknown error"]}),s.length===0&&!t&&A.jsx("div",{className:"text-center py-8 flex flex-col items-center gap-4",children:A.jsx("p",{className:"text-muted-foreground",children:"No agents currently running. Start a character to begin."})}),!t&&!r&&A.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-3 agents-section",children:s.sort((z,Z)=>{const V=z.status===pr.ACTIVE?1:0;return(Z.status===pr.ACTIVE?1:0)-V}).map(z=>A.jsx(Mte,{agent:z,onChat:i(Z=>T(z,Z),"onChat")},z.id))})]})}),A.jsx(wi,{value:"groups",className:"flex-1 mt-0 bg-background",children:A.jsx("div",{className:"flex flex-col gap-6 w-full md:max-w-4xl mx-auto px-6 py-2",children:!t&&!r&&A.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-2 gap-3 groups-section",children:p.map(z=>A.jsx(rC,{serverId:z.id},z.id))})})})]})})}),b?.id&&A.jsx(QN,{isOpen:v,onClose:O,agentId:b.id}),d&&A.jsx(Bc,{onClose:i(()=>{N(null),y(!1)},"onClose"),channelId:k??void 0})]})}i(kte,"Home");const rC=Ef.memo(({serverId:e})=>{const{data:t,isLoading:r}=ay(e),a=J.useMemo(()=>t?.data?.channels?.filter(n=>n.type===bt.GROUP)||[],[t]);return r?A.jsx("p",{children:"Loading channels for server..."}):!a||a.length===0?A.jsx("p",{className:"text-sm text-muted-foreground",children:"No group channels in this server."}):A.jsx(A.Fragment,{children:a.map(n=>A.jsx(Ete,{group:{...n,server_id:e}},n.id))})});rC.displayName="ServerChannels";function jte(){const t=xf().pathname,r=t.startsWith("/api/")||t.includes("/agents/")||t.includes("/memory/")||t.includes("/speech/");return A.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[70vh] px-4 text-center",children:[A.jsx("div",{className:"flex items-center justify-center mb-8",children:A.jsx("div",{className:"bg-red-900/20 h-24 w-24 rounded-full flex items-center justify-center",children:A.jsx(fi,{className:"h-14 w-14 text-red-500"})})}),A.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Page Not Found"}),A.jsxs("div",{className:"max-w-lg",children:[r?A.jsxs(A.Fragment,{children:[A.jsxs("p",{className:"text-lg mb-6 text-muted-foreground",children:["The endpoint ",A.jsx("span",{className:"font-mono text-red-400",children:t})," does not exist."]}),A.jsxs("div",{className:"bg-red-900/20 border border-red-800/30 rounded-md p-4 mb-8 text-left",children:[A.jsxs("h3",{className:"text-red-400 font-medium mb-2 flex items-center",children:[A.jsx(fi,{className:"h-4 w-4 mr-2"}),"Endpoint Not Found"]}),A.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:"}),A.jsxs("ul",{className:"text-sm text-red-300/80 list-disc pl-5 space-y-1",children:[A.jsx("li",{children:"The URL is spelled correctly"}),A.jsx("li",{children:"You're using the correct version of the API"}),A.jsx("li",{children:"The endpoint is available in this version of Eliza"})]})]})]}):A.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."}),A.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[A.jsx(et,{asChild:!0,variant:"default",children:A.jsxs(RR,{to:"/",children:[A.jsx(OR,{className:"h-4 w-4 mr-2"}),"Go to Home"]})}),A.jsx(et,{asChild:!0,variant:"outline",children:A.jsxs("a",{onClick:i(()=>window.history.back(),"onClick"),children:[A.jsx(Hm,{className:"h-4 w-4 mr-2"}),"Go Back"]})})]})]})]})}i(jte,"NotFound");function Ate(){const{channelId:e}=uv(),[t]=TR(),r=t.get("serverId"),a=Vo(e),n=Vo(r||"");return!a||!n?A.jsx("div",{className:"flex flex-1 justify-center items-center",children:A.jsx("p",{children:"Missing channel or server information."})}):A.jsx(tC,{chatType:bt.GROUP,contextId:a,serverId:n},a)}i(Ate,"GroupRoute");function Nte(){const e=jr();return A.jsx("div",{className:"pt-4 md:pt-8",children:A.jsx(Bc,{onClose:i(()=>e(-1),"onClose")})})}i(Nte,"GroupNew");function Ite(){const{agentId:e}=uv(),t=jr(),{data:r,isLoading:a}=_l(e);if(a)return A.jsx("div",{className:"flex items-center justify-center h-full",children:A.jsx(kr,{className:"h-8 w-8 animate-spin"})});if(!r?.data)return A.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[A.jsx("p",{className:"text-muted-foreground",children:"Agent not found"}),A.jsx(et,{onClick:i(()=>t("/"),"onClick"),children:"Back to Home"})]});const n={...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 A.jsx("div",{className:"flex w-full justify-center px-4 sm:px-6 overflow-y-auto",children:A.jsx("div",{className:"w-full md:max-w-4xl py-6",children:A.jsx(CI,{agent:n,agentId:e,onSaveComplete:i(()=>{},"onSaveComplete")})})})}i(Ite,"AgentSettingsRoute");const iC=new DR({defaultOptions:{queries:{staleTime:er.STANDARD,refetchInterval:!1,retry:3,retryDelay:i(e=>Math.min(1e3*2**e,3e4),"retryDelay"),refetchOnWindowFocus:!0,refetchOnReconnect:!0},mutations:{retry:3,retryDelay:i(e=>Math.min(1e3*2**e,3e4),"retryDelay")}}}),nC=i(async()=>{try{await iC.prefetchQuery({queryKey:["agents"],queryFn:i(async()=>({data:await Yt().agents.listAgents()}),"queryFn"),staleTime:er.FREQUENT})}catch(e){console.error("Error prefetching initial data:",e)}},"prefetchInitialData");nC();function Cte(){uW();const{status:e}=ry(),[t,r]=J.useState(!1),[a,n]=J.useState(Date.now()),s=xr();J.useEffect(()=>{qe.info("[AppContent] Mounted/Updated"),nC()},[]);const o=i(()=>{qe.info("[AppContent] refreshHomePage called. Current homeKey:",a);const h=Date.now();n(h),qe.info("[AppContent] New homeKey set to:",h),qe.info("[AppContent] Invalidating queries for Home page refresh."),s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["servers"]})},"refreshHomePage");return A.jsxs(es,{delayDuration:0,children:[A.jsxs(q_,{children:[A.jsx(h8,{refreshHomePage:o}),A.jsxs(X_,{className:"h-screen flex flex-col md:ml-72 overflow-hidden",children:[A.jsx("div",{className:"md:hidden absolute top-4 left-4 z-50",children:A.jsxs(Z_,{open:t,onOpenChange:r,children:[A.jsx(AO,{asChild:!0,children:A.jsxs(et,{variant:"ghost",size:"icon","data-testid":"mobile-menu-button",children:[A.jsx(BR,{className:"h-5 w-5"}),A.jsx("span",{className:"sr-only",children:"Toggle menu"})]})}),A.jsx(pv,{side:"left",className:"w-80 p-0 z-50",children:A.jsx(h8,{isMobile:!0,refreshHomePage:o})})]})}),A.jsx("div",{className:"flex w-full justify-center pt-16 md:pt-0 flex-shrink-0",children:A.jsx("div",{className:"w-full md:max-w-4xl",children:A.jsx(xX,{})})}),A.jsx("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:A.jsxs(zR,{children:[A.jsx(pi,{path:"/",element:A.jsx(kte,{},a)}),A.jsx(pi,{path:"chat/:agentId/:channelId",element:A.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:A.jsx(T5,{})})}),A.jsx(pi,{path:"chat/:agentId",element:A.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:A.jsx(T5,{})})}),A.jsx(pi,{path:"settings/:agentId",element:A.jsx(Ite,{})}),A.jsx(pi,{path:"group/new",element:A.jsx(Nte,{})}),A.jsx(pi,{path:"agents/new",element:A.jsx(_te,{})}),A.jsx(pi,{path:"/create",element:A.jsx("div",{className:"flex w-full justify-center px-4 sm:px-6 overflow-y-auto",children:A.jsx("div",{className:"w-full md:max-w-4xl",children:A.jsx(mN,{})})})}),A.jsx(pi,{path:"/logs",element:A.jsx("div",{className:"flex w-full justify-center",children:A.jsxs("div",{className:"w-full md:max-w-4xl",children:[A.jsx("div",{className:"flex items-center justify-between mb-4",children:A.jsx("h2",{className:"text-2xl p-4 font-bold",children:"System Logs"})}),A.jsx(FN,{})]})})}),A.jsx(pi,{path:"group/:channelId",element:A.jsx("div",{className:"flex-1 min-h-0 overflow-hidden",children:A.jsx(Ate,{})})}),A.jsx(pi,{path:"settings/",element:A.jsx("div",{className:"flex w-full justify-center overflow-y-auto",children:A.jsx("div",{className:"w-full md:max-w-4xl",children:A.jsx(SX,{})})})}),A.jsx(pi,{path:"*",element:A.jsx(jte,{})})]})})]})]}),A.jsx(PX,{}),e!=="unauthorized"&&A.jsx(RX,{})]})}i(Cte,"AppContent");function Rte(){return A.jsx(PR,{client:iC,children:A.jsx("div",{className:"dark antialiased font-sans",style:{colorScheme:"dark"},children:A.jsx(LR,{children:A.jsx(wq,{children:A.jsx(JK,{children:A.jsx(Cte,{})})})})})})}i(Rte,"App");const aC=document.getElementById("root");if(!aC)throw new Error("Root element not found");UR.createRoot(aC).render(A.jsx(J.StrictMode,{children:A.jsx(Rte,{})}))});export default Ote();
155
- //# sourceMappingURL=main-dfWMBrXO.js.map
155
+ //# sourceMappingURL=main-CrNGM6hW.js.map