@gadgetinc/ggt 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-HUMZSYPA.js → add-Q2YM34TO.js} +2 -2
- package/dist/{chunk-DAFEHCX5.js → chunk-BWIVLBZY.js} +2 -2
- package/dist/{chunk-U43YGCFP.js → chunk-GKAC6HNS.js} +2 -2
- package/dist/{chunk-C4CHGCKD.js → chunk-HVJWUXJL.js} +28 -28
- package/dist/{chunk-C4CHGCKD.js.map → chunk-HVJWUXJL.js.map} +4 -4
- package/dist/{chunk-DNS7DZ7M.js → chunk-JOWMHVPF.js} +2 -2
- package/dist/chunk-JOWMHVPF.js.map +7 -0
- package/dist/{chunk-F3F5GSUN.js → chunk-KP35JQJ7.js} +2 -2
- package/dist/{chunk-WGSJ2P6E.js → chunk-L4OG4HIV.js} +2 -2
- package/dist/{chunk-XGAPULF7.js → chunk-M5HB5SEG.js} +2 -2
- package/dist/{chunk-YLVZEUX7.js → chunk-OTYPO33S.js} +2 -2
- package/dist/chunk-P7E7PAMQ.js +2 -0
- package/dist/{chunk-GPJRJAHB.js.map → chunk-P7E7PAMQ.js.map} +4 -4
- package/dist/{chunk-E3RC22HP.js → chunk-PRAA2FG3.js} +2 -2
- package/dist/chunk-YINVPQ2V.js +6 -0
- package/dist/chunk-YINVPQ2V.js.map +7 -0
- package/dist/chunk-ZN6HRN6U.js +50 -0
- package/dist/chunk-ZN6HRN6U.js.map +7 -0
- package/dist/{deploy-HTVGCFPH.js → deploy-T5ZUHHLZ.js} +2 -2
- package/dist/{dev-MTMQ4VKF.js → dev-5CVDVGE3.js} +2 -2
- package/dist/{esm-OUX6XF3H.js → esm-BEXWGPJL.js} +3 -3
- package/dist/{esm-OUX6XF3H.js.map → esm-BEXWGPJL.js.map} +1 -1
- package/dist/list-BV7QOWA2.js +11 -0
- package/dist/list-BV7QOWA2.js.map +7 -0
- package/dist/login-M6YPWB3H.js +2 -0
- package/dist/{logout-2U2LIOQ5.js → logout-QLW45MMK.js} +2 -2
- package/dist/main.js +6 -6
- package/dist/main.js.map +3 -3
- package/dist/{open-L5IB23E5.js → open-TKGHV5HA.js} +2 -2
- package/dist/{pull-K5U5GMEP.js → pull-RRR7ISUG.js} +2 -2
- package/dist/push-KUORLNK6.js +2 -0
- package/dist/{status-HSABHX5Y.js → status-BKCHGWJO.js} +2 -2
- package/dist/{version-E5ZPB4IG.js → version-LUMBTKD4.js} +2 -2
- package/dist/{whoami-UFOCKGBK.js → whoami-ONJCZDTX.js} +2 -2
- package/package.json +17 -15
- package/dist/chunk-2V7EFUWO.js +0 -6
- package/dist/chunk-2V7EFUWO.js.map +0 -7
- package/dist/chunk-DNS7DZ7M.js.map +0 -7
- package/dist/chunk-GPJRJAHB.js +0 -2
- package/dist/chunk-Q5CNYV3H.js +0 -50
- package/dist/chunk-Q5CNYV3H.js.map +0 -7
- package/dist/list-Q3ZPCSNL.js +0 -11
- package/dist/list-Q3ZPCSNL.js.map +0 -7
- package/dist/login-5G4ANYDD.js +0 -2
- package/dist/push-ADPB3Y24.js +0 -2
- /package/dist/{add-HUMZSYPA.js.map → add-Q2YM34TO.js.map} +0 -0
- /package/dist/{chunk-DAFEHCX5.js.map → chunk-BWIVLBZY.js.map} +0 -0
- /package/dist/{chunk-U43YGCFP.js.map → chunk-GKAC6HNS.js.map} +0 -0
- /package/dist/{chunk-F3F5GSUN.js.map → chunk-KP35JQJ7.js.map} +0 -0
- /package/dist/{chunk-WGSJ2P6E.js.map → chunk-L4OG4HIV.js.map} +0 -0
- /package/dist/{chunk-XGAPULF7.js.map → chunk-M5HB5SEG.js.map} +0 -0
- /package/dist/{chunk-YLVZEUX7.js.map → chunk-OTYPO33S.js.map} +0 -0
- /package/dist/{chunk-E3RC22HP.js.map → chunk-PRAA2FG3.js.map} +0 -0
- /package/dist/{deploy-HTVGCFPH.js.map → deploy-T5ZUHHLZ.js.map} +0 -0
- /package/dist/{dev-MTMQ4VKF.js.map → dev-5CVDVGE3.js.map} +0 -0
- /package/dist/{login-5G4ANYDD.js.map → login-M6YPWB3H.js.map} +0 -0
- /package/dist/{logout-2U2LIOQ5.js.map → logout-QLW45MMK.js.map} +0 -0
- /package/dist/{open-L5IB23E5.js.map → open-TKGHV5HA.js.map} +0 -0
- /package/dist/{pull-K5U5GMEP.js.map → pull-RRR7ISUG.js.map} +0 -0
- /package/dist/{push-ADPB3Y24.js.map → push-KUORLNK6.js.map} +0 -0
- /package/dist/{status-HSABHX5Y.js.map → status-BKCHGWJO.js.map} +0 -0
- /package/dist/{version-E5ZPB4IG.js.map → version-LUMBTKD4.js.map} +0 -0
- /package/dist/{whoami-UFOCKGBK.js.map → whoami-ONJCZDTX.js.map} +0 -0
package/dist/chunk-GPJRJAHB.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as u,d as f,h as d}from"./chunk-56W5U2JG.js";var M=f((x,m)=>{d();var a=1e3,c=a*60,i=c*60,n=i*24,l=n*7,p=n*365.25;m.exports=function(e,r){r=r||{};var s=typeof e;if(s==="string"&&e.length>0)return v(e);if(s==="number"&&isFinite(e))return r.long?g(e):w(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function v(e){if(e=String(e),!(e.length>100)){var r=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(r){var s=parseFloat(r[1]),t=(r[2]||"ms").toLowerCase();switch(t){case"years":case"year":case"yrs":case"yr":case"y":return s*p;case"weeks":case"week":case"w":return s*l;case"days":case"day":case"d":return s*n;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*c;case"seconds":case"second":case"secs":case"sec":case"s":return s*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}u(v,"parse");function w(e){var r=Math.abs(e);return r>=n?Math.round(e/n)+"d":r>=i?Math.round(e/i)+"h":r>=c?Math.round(e/c)+"m":r>=a?Math.round(e/a)+"s":e+"ms"}u(w,"fmtShort");function g(e){var r=Math.abs(e);return r>=n?h(e,r,n,"day"):r>=i?h(e,r,i,"hour"):r>=c?h(e,r,c,"minute"):r>=a?h(e,r,a,"second"):e+" ms"}u(g,"fmtLong");function h(e,r,s,t){var o=r>=s*1.5;return Math.round(e/s)+" "+t+(o?"s":"")}u(h,"plural")});var b=f((S,y)=>{"use strict";d();y.exports=(e,r=process.argv)=>{let s=e.startsWith("-")?"":e.length===1?"-":"--",t=r.indexOf(s+e),o=r.indexOf("--");return t!==-1&&(o===-1||t<o)}});export{M as a,b};
|
|
2
|
-
//# sourceMappingURL=chunk-GPJRJAHB.js.map
|
package/dist/chunk-Q5CNYV3H.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import{d as un,e as fn,f as hn}from"./chunk-E3RC22HP.js";import{$ as cn,A as Ve,B as on,E as ue,K as le,L as an,M as W,N as ln,P as G,T as Xt,U as er,Z as we,_ as Ot,a as Kr,b as Zr,c as Xr,d as ge,e as $,f as tn,g as Tt,h as We,i as Yt,j as Jt,k as Kt,m as Zt,o as rn,w as nn,x as sn}from"./chunk-C4CHGCKD.js";import{a as Qt,b as en}from"./chunk-GPJRJAHB.js";import{a as o,b as j,d as F,f as ae,h}from"./chunk-56W5U2JG.js";var yn=F((Ja,gn)=>{"use strict";h();var Bs=j("os"),mn=j("tty"),he=en(),{env:X}=process,Be;he("no-color")||he("no-colors")||he("color=false")||he("color=never")?Be=0:(he("color")||he("colors")||he("color=true")||he("color=always"))&&(Be=1);"FORCE_COLOR"in X&&(X.FORCE_COLOR==="true"?Be=1:X.FORCE_COLOR==="false"?Be=0:Be=X.FORCE_COLOR.length===0?1:Math.min(parseInt(X.FORCE_COLOR,10),3));function tr(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(tr,"translateLevel");function rr(t,e){if(Be===0)return 0;if(he("color=16m")||he("color=full")||he("color=truecolor"))return 3;if(he("color=256"))return 2;if(t&&!e&&Be===void 0)return 0;let r=Be||0;if(X.TERM==="dumb")return r;if(process.platform==="win32"){let n=Bs.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in X)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in X)||X.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in X)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X.TEAMCITY_VERSION)?1:0;if(X.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in X){let n=parseInt((X.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(X.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X.TERM)||"COLORTERM"in X?1:r}o(rr,"supportsColor");function Ds(t){let e=rr(t,t&&t.isTTY);return tr(e)}o(Ds,"getSupportLevel");gn.exports={supportsColor:Ds,stdout:tr(rr(!0,mn.isatty(1))),stderr:tr(rr(!0,mn.isatty(2)))}});var xn=F((Xa,_n)=>{"use strict";h();var $s=yn(),He=en();function bn(t){if(/^\d{3,4}$/.test(t)){let r=/(\d{1,2})(\d{2})/.exec(t);return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let e=(t||"").split(".").map(r=>parseInt(r,10));return{major:e[0],minor:e[1],patch:e[2]}}o(bn,"parseVersion");function nr(t){let{env:e}=process;if("FORCE_HYPERLINK"in e)return!(e.FORCE_HYPERLINK.length>0&&parseInt(e.FORCE_HYPERLINK,10)===0);if(He("no-hyperlink")||He("no-hyperlinks")||He("hyperlink=false")||He("hyperlink=never"))return!1;if(He("hyperlink=true")||He("hyperlink=always")||"NETLIFY"in e)return!0;if(!$s.supportsColor(t)||t&&!t.isTTY||process.platform==="win32"||"CI"in e||"TEAMCITY_VERSION"in e)return!1;if("TERM_PROGRAM"in e){let r=bn(e.TERM_PROGRAM_VERSION);switch(e.TERM_PROGRAM){case"iTerm.app":return r.major===3?r.minor>=1:r.major>3;case"WezTerm":return r.major>=20200620;case"vscode":return r.major>1||r.major===1&&r.minor>=72}}if("VTE_VERSION"in e){if(e.VTE_VERSION==="0.50.0")return!1;let r=bn(e.VTE_VERSION);return r.major>0||r.minor>=50}return!1}o(nr,"supportsHyperlink");_n.exports={supportsHyperlink:nr,stdout:nr(process.stdout),stderr:nr(process.stderr)}});var Rn=F((lr,cr)=>{h();(function(t,e){typeof lr=="object"&&typeof cr<"u"?cr.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(lr,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",s="minute",a="hour",u="day",l="week",f="month",p="quarter",d="year",b="date",c="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|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,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(O){var E=["th","st","nd","rd"],w=O%100;return"["+O+(E[(w-20)%10]||E[w]||E[0])+"]"},"ordinal")},B=o(function(O,E,w){var y=String(O);return!y||y.length>=E?O:""+Array(E+1-y.length).join(w)+O},"m"),M={s:B,z:o(function(O){var E=-O.utcOffset(),w=Math.abs(E),y=Math.floor(w/60),g=w%60;return(E<=0?"+":"-")+B(y,2,"0")+":"+B(g,2,"0")},"z"),m:o(function O(E,w){if(E.date()<w.date())return-O(w,E);var y=12*(w.year()-E.year())+(w.month()-E.month()),g=E.clone().add(y,f),_=w-g<0,x=E.clone().add(y+(_?-1:1),f);return+(-(y+(w-g)/(_?g-x:x-g))||0)},"t"),a:o(function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},"a"),p:o(function(O){return{M:f,y:d,w:l,d:u,D:b,h:a,m:s,s:i,ms:n,Q:p}[O]||String(O||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(O){return O===void 0},"u")},J="en",k={};k[J]=T;var H="$isDayjsObject",K=o(function(O){return O instanceof re||!(!O||!O[H])},"S"),z=o(function O(E,w,y){var g;if(!E)return J;if(typeof E=="string"){var _=E.toLowerCase();k[_]&&(g=_),w&&(k[_]=w,g=_);var x=E.split("-");if(!g&&x.length>1)return O(x[0])}else{var S=E.name;k[S]=E,g=S}return!y&&g&&(J=g),g||!y&&J},"t"),N=o(function(O,E){if(K(O))return O.clone();var w=typeof E=="object"?E:{};return w.date=O,w.args=arguments,new re(w)},"O"),C=M;C.l=z,C.i=K,C.w=function(O,E){return N(O,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var re=function(){function O(w){this.$L=z(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[H]=!0}o(O,"M");var E=O.prototype;return E.parse=function(w){this.$d=function(y){var g=y.date,_=y.utc;if(g===null)return new Date(NaN);if(C.u(g))return new Date;if(g instanceof Date)return new Date(g);if(typeof g=="string"&&!/Z$/i.test(g)){var x=g.match(m);if(x){var S=x[2]-1||0,D=(x[7]||"0").substring(0,3);return _?new Date(Date.UTC(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,D)):new Date(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,D)}}return new Date(g)}(w),this.init()},E.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()},E.$utils=function(){return C},E.isValid=function(){return this.$d.toString()!==c},E.isSame=function(w,y){var g=N(w);return this.startOf(y)<=g&&g<=this.endOf(y)},E.isAfter=function(w,y){return N(w)<this.startOf(y)},E.isBefore=function(w,y){return this.endOf(y)<N(w)},E.$g=function(w,y,g){return C.u(w)?this[y]:this.set(g,w)},E.unix=function(){return Math.floor(this.valueOf()/1e3)},E.valueOf=function(){return this.$d.getTime()},E.startOf=function(w,y){var g=this,_=!!C.u(y)||y,x=C.p(w),S=o(function(q,ne){var xe=C.w(g.$u?Date.UTC(g.$y,ne,q):new Date(g.$y,ne,q),g);return _?xe:xe.endOf(u)},"l"),D=o(function(q,ne){return C.w(g.toDate()[q].apply(g.toDate("s"),(_?[0,0,0,0]:[23,59,59,999]).slice(ne)),g)},"$"),L=this.$W,U=this.$M,Z=this.$D,me="set"+(this.$u?"UTC":"");switch(x){case d:return _?S(1,0):S(31,11);case f:return _?S(1,U):S(0,U+1);case l:var oe=this.$locale().weekStart||0,Q=(L<oe?L+7:L)-oe;return S(_?Z-Q:Z+(6-Q),U);case u:case b:return D(me+"Hours",0);case a:return D(me+"Minutes",1);case s:return D(me+"Seconds",2);case i:return D(me+"Milliseconds",3);default:return this.clone()}},E.endOf=function(w){return this.startOf(w,!1)},E.$set=function(w,y){var g,_=C.p(w),x="set"+(this.$u?"UTC":""),S=(g={},g[u]=x+"Date",g[b]=x+"Date",g[f]=x+"Month",g[d]=x+"FullYear",g[a]=x+"Hours",g[s]=x+"Minutes",g[i]=x+"Seconds",g[n]=x+"Milliseconds",g)[_],D=_===u?this.$D+(y-this.$W):y;if(_===f||_===d){var L=this.clone().set(b,1);L.$d[S](D),L.init(),this.$d=L.set(b,Math.min(this.$D,L.daysInMonth())).$d}else S&&this.$d[S](D);return this.init(),this},E.set=function(w,y){return this.clone().$set(w,y)},E.get=function(w){return this[C.p(w)]()},E.add=function(w,y){var g,_=this;w=Number(w);var x=C.p(y),S=o(function(U){var Z=N(_);return C.w(Z.date(Z.date()+Math.round(U*w)),_)},"y");if(x===f)return this.set(f,this.$M+w);if(x===d)return this.set(d,this.$y+w);if(x===u)return S(1);if(x===l)return S(7);var D=(g={},g[s]=e,g[a]=r,g[i]=t,g)[x]||1,L=this.$d.getTime()+w*D;return C.w(L,this)},E.subtract=function(w,y){return this.add(-1*w,y)},E.format=function(w){var y=this,g=this.$locale();if(!this.isValid())return g.invalidDate||c;var _=w||"YYYY-MM-DDTHH:mm:ssZ",x=C.z(this),S=this.$H,D=this.$m,L=this.$M,U=g.weekdays,Z=g.months,me=g.meridiem,oe=o(function(ne,xe,it,St){return ne&&(ne[xe]||ne(y,_))||it[xe].slice(0,St)},"h"),Q=o(function(ne){return C.s(S%12||12,ne,"0")},"d"),q=me||function(ne,xe,it){var St=ne<12?"AM":"PM";return it?St.toLowerCase():St};return _.replace(v,function(ne,xe){return xe||function(it){switch(it){case"YY":return String(y.$y).slice(-2);case"YYYY":return C.s(y.$y,4,"0");case"M":return L+1;case"MM":return C.s(L+1,2,"0");case"MMM":return oe(g.monthsShort,L,Z,3);case"MMMM":return oe(Z,L);case"D":return y.$D;case"DD":return C.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return oe(g.weekdaysMin,y.$W,U,2);case"ddd":return oe(g.weekdaysShort,y.$W,U,3);case"dddd":return U[y.$W];case"H":return String(S);case"HH":return C.s(S,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return q(S,D,!0);case"A":return q(S,D,!1);case"m":return String(D);case"mm":return C.s(D,2,"0");case"s":return String(y.$s);case"ss":return C.s(y.$s,2,"0");case"SSS":return C.s(y.$ms,3,"0");case"Z":return x}return null}(ne)||x.replace(":","")})},E.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},E.diff=function(w,y,g){var _,x=this,S=C.p(y),D=N(w),L=(D.utcOffset()-this.utcOffset())*e,U=this-D,Z=o(function(){return C.m(x,D)},"D");switch(S){case d:_=Z()/12;break;case f:_=Z();break;case p:_=Z()/3;break;case l:_=(U-L)/6048e5;break;case u:_=(U-L)/864e5;break;case a:_=U/r;break;case s:_=U/e;break;case i:_=U/t;break;default:_=U}return g?_:C.a(_)},E.daysInMonth=function(){return this.endOf(f).$D},E.$locale=function(){return k[this.$L]},E.locale=function(w,y){if(!w)return this.$L;var g=this.clone(),_=z(w,y,!0);return _&&(g.$L=_),g},E.clone=function(){return C.w(this.$d,this)},E.toDate=function(){return new Date(this.valueOf())},E.toJSON=function(){return this.isValid()?this.toISOString():null},E.toISOString=function(){return this.$d.toISOString()},E.toString=function(){return this.$d.toUTCString()},O}(),nt=re.prototype;return N.prototype=nt,[["$ms",n],["$s",i],["$m",s],["$H",a],["$W",u],["$M",f],["$y",d],["$D",b]].forEach(function(O){nt[O[1]]=function(E){return this.$g(E,O[0],O[1])}}),N.extend=function(O,E){return O.$i||(O(E,re,N),O.$i=!0),N},N.locale=z,N.isDayjs=K,N.unix=function(O){return N(1e3*O)},N.en=k[J],N.Ls=k,N.p={},N})});var Dn=F(Qe=>{"use strict";h();Qe.__esModule=!0;Qe.distance=Qe.closest=void 0;var Se=new Uint32Array(65536),qs=o(function(t,e){for(var r=t.length,n=e.length,i=1<<r-1,s=-1,a=0,u=r,l=r;l--;)Se[t.charCodeAt(l)]|=1<<l;for(l=0;l<n;l++){var f=Se[e.charCodeAt(l)],p=f|a;f|=(f&s)+s^s,a|=~(f|s),s&=f,a&i&&u++,s&i&&u--,a=a<<1|1,s=s<<1|~(p|a),a&=p}for(l=r;l--;)Se[t.charCodeAt(l)]=0;return u},"myers_32"),Fs=o(function(t,e){for(var r=e.length,n=t.length,i=[],s=[],a=Math.ceil(r/32),u=Math.ceil(n/32),l=0;l<a;l++)s[l]=-1,i[l]=0;for(var f=0;f<u-1;f++){for(var p=0,d=-1,b=f*32,c=Math.min(32,n)+b,m=b;m<c;m++)Se[t.charCodeAt(m)]|=1<<m;for(var l=0;l<r;l++){var v=Se[e.charCodeAt(l)],T=s[l/32|0]>>>l&1,B=i[l/32|0]>>>l&1,M=v|p,J=((v|B)&d)+d^d|v|B,k=p|~(J|d),H=d&J;k>>>31^T&&(s[l/32|0]^=1<<l),H>>>31^B&&(i[l/32|0]^=1<<l),k=k<<1|T,H=H<<1|B,d=H|~(M|k),p=k&M}for(var m=b;m<c;m++)Se[t.charCodeAt(m)]=0}for(var K=0,z=-1,N=f*32,C=Math.min(32,n-N)+N,m=N;m<C;m++)Se[t.charCodeAt(m)]|=1<<m;for(var re=n,l=0;l<r;l++){var v=Se[e.charCodeAt(l)],T=s[l/32|0]>>>l&1,B=i[l/32|0]>>>l&1,M=v|K,J=((v|B)&z)+z^z|v|B,k=K|~(J|z),H=z&J;re+=k>>>n-1&1,re-=H>>>n-1&1,k>>>31^T&&(s[l/32|0]^=1<<l),H>>>31^B&&(i[l/32|0]^=1<<l),k=k<<1|T,H=H<<1|B,z=H|~(M|k),K=k&M}for(var m=N;m<C;m++)Se[t.charCodeAt(m)]=0;return re},"myers_x"),Bn=o(function(t,e){if(t.length<e.length){var r=e;e=t,t=r}return e.length===0?t.length:t.length<=32?qs(t,e):Fs(t,e)},"distance");Qe.distance=Bn;var Gs=o(function(t,e){for(var r=1/0,n=0,i=0;i<e.length;i++){var s=Bn(t,e[i]);s<r&&(r=s,n=i)}return e[n]},"closest");Qe.closest=Gs});var $n=F((ur,at)=>{h();(function(){"use strict";var t;try{t=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var e=Dn(),r=[],n=[],i={get:o(function(s,a,u){var l=u&&t&&u.useCollator;if(l){var f=s.length,p=a.length;if(f===0)return p;if(p===0)return f;var d,b,c,m,v;for(c=0;c<p;++c)r[c]=c,n[c]=a.charCodeAt(c);r[p]=p;var T;for(c=0;c<f;++c){for(b=c+1,m=0;m<p;++m)d=b,T=t.compare(s.charAt(c),String.fromCharCode(n[m]))===0,b=r[m]+(T?0:1),v=d+1,b>v&&(b=v),v=r[m+1]+1,b>v&&(b=v),r[m]=d;r[m]=b}return b}return e.distance(s,a)},"get")};typeof define<"u"&&define!==null&&define.amd?define(function(){return i}):typeof at<"u"&&at!==null&&typeof ur<"u"&&at.exports===ur?at.exports=i:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=i:typeof window<"u"&&window!==null&&(window.Levenshtein=i)})()});var Nn=F((hr,dr)=>{h();(function(t,e){typeof j=="function"&&typeof hr=="object"&&typeof dr=="object"?dr.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):t.pluralize=e()})(hr,function(){var t=[],e=[],r={},n={},i={};function s(c){return typeof c=="string"?new RegExp("^"+c+"$","i"):c}o(s,"sanitizeRule");function a(c,m){return c===m?m:c===c.toLowerCase()?m.toLowerCase():c===c.toUpperCase()?m.toUpperCase():c[0]===c[0].toUpperCase()?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m.toLowerCase()}o(a,"restoreCase");function u(c,m){return c.replace(/\$(\d{1,2})/g,function(v,T){return m[T]||""})}o(u,"interpolate");function l(c,m){return c.replace(m[0],function(v,T){var B=u(m[1],arguments);return a(v===""?c[T-1]:v,B)})}o(l,"replace");function f(c,m,v){if(!c.length||r.hasOwnProperty(c))return m;for(var T=v.length;T--;){var B=v[T];if(B[0].test(m))return l(m,B)}return m}o(f,"sanitizeWord");function p(c,m,v){return function(T){var B=T.toLowerCase();return m.hasOwnProperty(B)?a(T,B):c.hasOwnProperty(B)?a(T,c[B]):f(B,T,v)}}o(p,"replaceWord");function d(c,m,v,T){return function(B){var M=B.toLowerCase();return m.hasOwnProperty(M)?!0:c.hasOwnProperty(M)?!1:f(M,M,v)===M}}o(d,"checkWord");function b(c,m,v){var T=m===1?b.singular(c):b.plural(c);return(v?m+" ":"")+T}return o(b,"pluralize"),b.plural=p(i,n,t),b.isPlural=d(i,n,t),b.singular=p(n,i,e),b.isSingular=d(n,i,e),b.addPluralRule=function(c,m){t.push([s(c),m])},b.addSingularRule=function(c,m){e.push([s(c),m])},b.addUncountableRule=function(c){if(typeof c=="string"){r[c.toLowerCase()]=!0;return}b.addPluralRule(c,"$0"),b.addSingularRule(c,"$0")},b.addIrregularRule=function(c,m){m=m.toLowerCase(),c=c.toLowerCase(),i[c]=m,n[m]=c},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(c){return b.addIrregularRule(c[0],c[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(c){return b.addPluralRule(c[0],c[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(c){return b.addSingularRule(c[0],c[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(b.addUncountableRule),b})});var Wn=F((kc,jn)=>{"use strict";h();var Fn=12,Qs=0,mr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function Ys(t){var e=t.indexOf("%");if(e===-1)return t;for(var r=t.length,n="",i=0,s=0,a=e,u=Fn;e>-1&&e<r;){var l=Gn(t[e+1],4),f=Gn(t[e+2],0),p=l|f,d=mr[p];if(u=mr[256+u+d],s=s<<6|p&mr[364+d],u===Fn)n+=t.slice(i,a),n+=s<=65535?String.fromCharCode(s):String.fromCharCode(55232+(s>>10),56320+(s&1023)),s=0,i=e+3,e=a=t.indexOf("%",i);else{if(u===Qs)return null;if(e+=3,e<r&&t.charCodeAt(e)===37)continue;return null}}return n+t.slice(i)}o(Ys,"decodeURIComponent");var Js={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function Gn(t,e){var r=Js[t];return r===void 0?255:r<<e}o(Gn,"hexCodeToInt");jn.exports=Ys});var Yn=F((Bc,Qn)=>{"use strict";h();var Vn=Wn(),zn=/\+/g,Hn=o(function(){},"Empty");Hn.prototype=Object.create(null);function Ks(t){let e=new Hn;if(typeof t!="string")return e;let r=t.length,n="",i="",s=-1,a=-1,u=!1,l=!1,f=!1,p=!1,d=!1,b=0;for(let c=0;c<r+1;c++)if(b=c!==r?t.charCodeAt(c):38,b===38){if(d=a>s,d||(a=c),n=t.slice(s+1,a),d||n.length>0){f&&(n=n.replace(zn," ")),u&&(n=Vn(n)||n),d&&(i=t.slice(a+1,c),p&&(i=i.replace(zn," ")),l&&(i=Vn(i)||i));let m=e[n];m===void 0?e[n]=i:m.pop?m.push(i):e[n]=[m,i]}i="",s=c,a=c,u=!1,l=!1,f=!1,p=!1}else b===61?a<=s?a=c:l=!0:b===43?a>s?p=!0:f=!0:b===37&&(a>s?l=!0:u=!0);return e}o(Ks,"parse");Qn.exports=Ks});var Kn=F((Ac,Jn)=>{h();var ve=Array.from({length:256},(t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase()),Zs=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]);function Xs(t){let e=t.length;if(e===0)return"";let r="",n=0,i=0;e:for(;i<e;i++){let s=t.charCodeAt(i);for(;s<128;){if(Zs[s]!==1&&(n<i&&(r+=t.slice(n,i)),n=i+1,r+=ve[s]),++i===e)break e;s=t.charCodeAt(i)}if(n<i&&(r+=t.slice(n,i)),s<2048){n=i+1,r+=ve[192|s>>6]+ve[128|s&63];continue}if(s<55296||s>=57344){n=i+1,r+=ve[224|s>>12]+ve[128|s>>6&63]+ve[128|s&63];continue}if(++i,i>=e)throw new Error("URI malformed");let a=t.charCodeAt(i)&1023;n=i+1,s=65536+((s&1023)<<10|a),r+=ve[240|s>>18]+ve[128|s>>12&63]+ve[128|s>>6&63]+ve[128|s&63]}return n===0?t:n<e?r+t.slice(n):r}o(Xs,"encodeString");Jn.exports={encodeString:Xs}});var ei=F((Pc,Xn)=>{"use strict";h();var{encodeString:gr}=Kn();function Zn(t){let e=typeof t;return e==="string"?gr(t):e==="bigint"?t.toString():e==="boolean"?t?"true":"false":e==="number"&&Number.isFinite(t)?t<1e21?""+t:gr(""+t):""}o(Zn,"getAsPrimitive");function eo(t){let e="";if(t===null||typeof t!="object")return e;let r="&",n=Object.keys(t),i=n.length,s=0;for(let a=0;a<i;a++){let u=n[a],l=t[u],f=gr(u)+"=";if(a&&(e+=r),Array.isArray(l)){s=l.length;for(let p=0;p<s;p++)p&&(e+=r),e+=f,e+=Zn(l[p])}else e+=f,e+=Zn(l)}return e}o(eo,"stringify");Xn.exports=eo});var ii=F((qc,ct)=>{"use strict";h();var ti=Yn(),ri=ei(),ni={parse:ti,stringify:ri};ct.exports=ni;ct.exports.default=ni;ct.exports.parse=ti;ct.exports.stringify=ri});var xi=F((gf,Sr)=>{"use strict";h();var _o=Object.prototype.hasOwnProperty,se="~";function ut(){}o(ut,"Events");Object.create&&(ut.prototype=Object.create(null),new ut().__proto__||(se=!1));function xo(t,e,r){this.fn=t,this.context=e,this.once=r||!1}o(xo,"EE");function _i(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new xo(r,n||t,i),a=se?se+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],s]:t._events[a].push(s):(t._events[a]=s,t._eventsCount++),t}o(_i,"addListener");function $t(t,e){--t._eventsCount===0?t._events=new ut:delete t._events[e]}o($t,"clearEvent");function te(){this._events=new ut,this._eventsCount=0}o(te,"EventEmitter");te.prototype.eventNames=o(function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)_o.call(r,n)&&e.push(se?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},"eventNames");te.prototype.listeners=o(function(e){var r=se?se+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,a=new Array(s);i<s;i++)a[i]=n[i].fn;return a},"listeners");te.prototype.listenerCount=o(function(e){var r=se?se+e:e,n=this._events[r];return n?n.fn?1:n.length:0},"listenerCount");te.prototype.emit=o(function(e,r,n,i,s,a){var u=se?se+e:e;if(!this._events[u])return!1;var l=this._events[u],f=arguments.length,p,d;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,n),!0;case 4:return l.fn.call(l.context,r,n,i),!0;case 5:return l.fn.call(l.context,r,n,i,s),!0;case 6:return l.fn.call(l.context,r,n,i,s,a),!0}for(d=1,p=new Array(f-1);d<f;d++)p[d-1]=arguments[d];l.fn.apply(l.context,p)}else{var b=l.length,c;for(d=0;d<b;d++)switch(l[d].once&&this.removeListener(e,l[d].fn,void 0,!0),f){case 1:l[d].fn.call(l[d].context);break;case 2:l[d].fn.call(l[d].context,r);break;case 3:l[d].fn.call(l[d].context,r,n);break;case 4:l[d].fn.call(l[d].context,r,n,i);break;default:if(!p)for(c=1,p=new Array(f-1);c<f;c++)p[c-1]=arguments[c];l[d].fn.apply(l[d].context,p)}}return!0},"emit");te.prototype.on=o(function(e,r,n){return _i(this,e,r,n,!1)},"on");te.prototype.once=o(function(e,r,n){return _i(this,e,r,n,!0)},"once");te.prototype.removeListener=o(function(e,r,n,i){var s=se?se+e:e;if(!this._events[s])return this;if(!r)return $t(this,s),this;var a=this._events[s];if(a.fn)a.fn===r&&(!i||a.once)&&(!n||a.context===n)&&$t(this,s);else{for(var u=0,l=[],f=a.length;u<f;u++)(a[u].fn!==r||i&&!a[u].once||n&&a[u].context!==n)&&l.push(a[u]);l.length?this._events[s]=l.length===1?l[0]:l:$t(this,s)}return this},"removeListener");te.prototype.removeAllListeners=o(function(e){var r;return e?(r=se?se+e:e,this._events[r]&&$t(this,r)):(this._events=new ut,this._eventsCount=0),this},"removeAllListeners");te.prototype.off=te.prototype.removeListener;te.prototype.addListener=te.prototype.on;te.prefixed=se;te.EventEmitter=te;typeof Sr<"u"&&(Sr.exports=te)});var Oi=F((Pf,Ti)=>{"use strict";h();var{Duplex:wo}=j("stream");function Ei(t){t.emit("close")}o(Ei,"emitClose");function vo(){!this.destroyed&&this._writableState.finished&&this.destroy()}o(vo,"duplexOnEnd");function Si(t){this.removeListener("error",Si),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}o(Si,"duplexOnError");function Eo(t,e){let r=!0,n=new wo({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",o(function(s,a){let u=!a&&n._readableState.objectMode?s.toString():s;n.push(u)||t.pause()},"message")),t.once("error",o(function(s){n.destroyed||(r=!1,n.destroy(s))},"error")),t.once("close",o(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(i,s){if(t.readyState===t.CLOSED){s(i),process.nextTick(Ei,n);return}let a=!1;t.once("error",o(function(l){a=!0,s(l)},"error")),t.once("close",o(function(){a||s(i),process.nextTick(Ei,n)},"close")),r&&t.terminate()},n._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",o(function(){n._final(i)},"open"));return}t._socket!==null&&(t._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",o(function(){i()},"finish")),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(i,s,a){if(t.readyState===t.CONNECTING){t.once("open",o(function(){n._write(i,s,a)},"open"));return}t.send(i,a)},n.on("end",vo),n.on("error",Si),n}o(Eo,"createWebSocketStream");Ti.exports=Eo});var Le=F((qf,Ci)=>{"use strict";h();var Li=["nodebuffer","arraybuffer","fragments"],ki=typeof Blob<"u";ki&&Li.push("blob");Ci.exports={BINARY_TYPES:Li,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ki,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:o(()=>{},"NOOP")}});var pt=F((jf,At)=>{"use strict";h();var{EMPTY_BUFFER:So}=Le(),Cr=Buffer[Symbol.species];function To(t,e){if(t.length===0)return So;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let i=0;i<t.length;i++){let s=t[i];r.set(s,n),n+=s.length}return n<e?new Cr(r.buffer,r.byteOffset,n):r}o(To,"concat");function Ri(t,e,r,n,i){for(let s=0;s<i;s++)r[n+s]=t[s]^e[s&3]}o(Ri,"_mask");function Bi(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}o(Bi,"_unmask");function Oo(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}o(Oo,"toArrayBuffer");function Rr(t){if(Rr.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Cr(t):ArrayBuffer.isView(t)?e=new Cr(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Rr.readOnly=!1),e}o(Rr,"toBuffer");At.exports={concat:To,mask:Ri,toArrayBuffer:Oo,toBuffer:Rr,unmask:Bi};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=j("bufferutil");At.exports.mask=function(e,r,n,i,s){s<48?Ri(e,r,n,i,s):t.mask(e,r,n,i,s)},At.exports.unmask=function(e,r){e.length<32?Bi(e,r):t.unmask(e,r)}}catch{}});var Ai=F((zf,$i)=>{"use strict";h();var Di=Symbol("kDone"),Br=Symbol("kRun"),Dr=class{static{o(this,"Limiter")}constructor(e){this[Di]=()=>{this.pending--,this[Br]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Br]()}[Br](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Di])}}};$i.exports=Dr});var yt=F((Yf,Mi)=>{"use strict";h();var mt=j("zlib"),Ni=pt(),Lo=Ai(),{kStatusCode:Ii}=Le(),ko=Buffer[Symbol.species],Co=Buffer.from([0,0,255,255]),Pt=Symbol("permessage-deflate"),ke=Symbol("total-length"),gt=Symbol("callback"),Ne=Symbol("buffers"),It=Symbol("error"),Nt,$r=class{static{o(this,"PerMessageDeflate")}constructor(e,r,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!Nt){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Nt=new Lo(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[gt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),e}decompress(e,r,n){Nt.add(i=>{this._decompress(e,r,(s,a)=>{i(),n(s,a)})})}compress(e,r,n){Nt.add(i=>{this._compress(e,r,(s,a)=>{i(),n(s,a)})})}_decompress(e,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let s=`${i}_max_window_bits`,a=typeof this.params[s]!="number"?mt.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=mt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Pt]=this,this._inflate[ke]=0,this._inflate[Ne]=[],this._inflate.on("error",Bo),this._inflate.on("data",Pi)}this._inflate[gt]=n,this._inflate.write(e),r&&this._inflate.write(Co),this._inflate.flush(()=>{let s=this._inflate[It];if(s){this._inflate.close(),this._inflate=null,n(s);return}let a=Ni.concat(this._inflate[Ne],this._inflate[ke]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ke]=0,this._inflate[Ne]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(e,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let s=`${i}_max_window_bits`,a=typeof this.params[s]!="number"?mt.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=mt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[ke]=0,this._deflate[Ne]=[],this._deflate.on("data",Ro)}this._deflate[gt]=n,this._deflate.write(e),this._deflate.flush(mt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=Ni.concat(this._deflate[Ne],this._deflate[ke]);r&&(s=new ko(s.buffer,s.byteOffset,s.length-4)),this._deflate[gt]=null,this._deflate[ke]=0,this._deflate[Ne]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};Mi.exports=$r;function Ro(t){this[Ne].push(t),this[ke]+=t.length}o(Ro,"deflateOnData");function Pi(t){if(this[ke]+=t.length,this[Pt]._maxPayload<1||this[ke]<=this[Pt]._maxPayload){this[Ne].push(t);return}this[It]=new RangeError("Max payload size exceeded"),this[It].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[It][Ii]=1009,this.removeListener("data",Pi),this.reset()}o(Pi,"inflateOnData");function Bo(t){this[Pt]._inflate=null,t[Ii]=1007,this[gt](t)}o(Bo,"inflateOnError")});var Ze=F((Zf,Mt)=>{"use strict";h();var{isUtf8:Ui}=j("buffer"),{hasBlob:Do}=Le(),$o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Ao(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}o(Ao,"isValidStatusCode");function Ar(t){let e=t.length,r=0;for(;r<e;)if(!(t[r]&128))r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}o(Ar,"_isValidUTF8");function No(t){return Do&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}o(No,"isBlob");Mt.exports={isBlob:No,isValidStatusCode:Ao,isValidUTF8:Ar,tokenChars:$o};if(Ui)Mt.exports.isValidUTF8=function(t){return t.length<24?Ar(t):Ui(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=j("utf-8-validate");Mt.exports.isValidUTF8=function(e){return e.length<32?Ar(e):t(e)}}catch{}});var Ur=F((th,zi)=>{"use strict";h();var{Writable:Io}=j("stream"),qi=yt(),{BINARY_TYPES:Po,EMPTY_BUFFER:Fi,kStatusCode:Mo,kWebSocket:Uo}=Le(),{concat:Nr,toArrayBuffer:qo,unmask:Fo}=pt(),{isValidStatusCode:Go,isValidUTF8:Gi}=Ze(),Ut=Buffer[Symbol.species],de=0,ji=1,Wi=2,Vi=3,Ir=4,Pr=5,qt=6,Mr=class extends Io{static{o(this,"Receiver")}constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Po[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Uo]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=de}_write(e,r,n){if(this._opcode===8&&this._state==de)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Ut(n.buffer,n.byteOffset+e,n.length-e),new Ut(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],i=r.length-e;e>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),i),this._buffers[0]=new Ut(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case de:this.getInfo(e);break;case ji:this.getPayloadLength16(e);break;case Wi:this.getPayloadLength64(e);break;case Vi:this.getMask();break;case Ir:this.getData(e);break;case Pr:case qt:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if(r[0]&48){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[qi.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=ji:this._payloadLength===127?this._state=Wi:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=Vi:this._state=Ir}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Ir}getData(e){let r=Fi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Fo(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Pr,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[qi.extensionName].decompress(e,this._fin,(i,s)=>{if(i)return r(i);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(s)}this.dataMessage(r),this._state===de&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=de;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=Nr(n,r):this._binaryType==="arraybuffer"?i=qo(Nr(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=de):(this._state=qt,setImmediate(()=>{this.emit("message",i,!0),this._state=de,this.startLoop(e)}))}else{let i=Nr(n,r);if(!this._skipUTF8Validation&&!Gi(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Pr||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=de):(this._state=qt,setImmediate(()=>{this.emit("message",i,!1),this._state=de,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Fi),this.end();else{let n=e.readUInt16BE(0);if(!Go(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let i=new Ut(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Gi(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",n,i),this.end()}this._state=de;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=de):(this._state=qt,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=de,this.startLoop(r)}))}createError(e,r,n,i,s){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=s,a[Mo]=i,a}};zi.exports=Mr});var Gr=F((sh,Yi)=>{"use strict";h();var{Duplex:ih}=j("stream"),{randomFillSync:jo}=j("crypto"),Hi=yt(),{EMPTY_BUFFER:Wo,kWebSocket:Vo,NOOP:zo}=Le(),{isBlob:Xe,isValidStatusCode:Ho}=Ze(),{mask:Qi,toBuffer:Ue}=pt(),pe=Symbol("kByteLength"),Qo=Buffer.alloc(4),Ft=8*1024,qe,et=Ft,_e=0,Yo=1,Jo=2,qr=class t{static{o(this,"Sender")}constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=_e,this.onerror=zo,this[Vo]=void 0}static frame(e,r){let n,i=!1,s=2,a=!1;r.mask&&(n=r.maskBuffer||Qo,r.generateMask?r.generateMask(n):(et===Ft&&(qe===void 0&&(qe=Buffer.alloc(Ft)),jo(qe,0,Ft),et=0),n[0]=qe[et++],n[1]=qe[et++],n[2]=qe[et++],n[3]=qe[et++]),a=(n[0]|n[1]|n[2]|n[3])===0,s=6);let u;typeof e=="string"?(!r.mask||a)&&r[pe]!==void 0?u=r[pe]:(e=Buffer.from(e),u=e.length):(u=e.length,i=r.mask&&r.readOnly&&!a);let l=u;u>=65536?(s+=8,l=127):u>125&&(s+=2,l=126);let f=Buffer.allocUnsafe(i?u+s:s);return f[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(f[0]|=64),f[1]=l,l===126?f.writeUInt16BE(u,2):l===127&&(f[2]=f[3]=0,f.writeUIntBE(u,4,6)),r.mask?(f[1]|=128,f[s-4]=n[0],f[s-3]=n[1],f[s-2]=n[2],f[s-1]=n[3],a?[f,e]:i?(Qi(e,n,f,s,u),[f]):(Qi(e,n,e,0,u),[f,e])):[f,e]}close(e,r,n,i){let s;if(e===void 0)s=Wo;else{if(typeof e!="number"||!Ho(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let u=Buffer.byteLength(r);if(u>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+u),s.writeUInt16BE(e,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let a={[pe]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?this.enqueue([this.dispatch,s,!1,a,i]):this.sendFrame(t.frame(s,a),i)}ping(e,r,n){let i,s;if(typeof e=="string"?(i=Buffer.byteLength(e),s=!1):Xe(e)?(i=e.size,s=!1):(e=Ue(e),i=e.length,s=Ue.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[pe]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Xe(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==_e?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}pong(e,r,n){let i,s;if(typeof e=="string"?(i=Buffer.byteLength(e),s=!1):Xe(e)?(i=e.size,s=!1):(e=Ue(e),i=e.length,s=Ue.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[pe]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Xe(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==_e?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}send(e,r,n){let i=this._extensions[Hi.extensionName],s=r.binary?2:1,a=r.compress,u,l;typeof e=="string"?(u=Buffer.byteLength(e),l=!1):Xe(e)?(u=e.size,l=!1):(e=Ue(e),u=e.length,l=Ue.readOnly),this._firstFragment?(this._firstFragment=!1,a&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=u>=i._threshold),this._compress=a):(a=!1,s=0),r.fin&&(this._firstFragment=!0);let f={[pe]:u,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:l,rsv1:a};Xe(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,f,n]):this.getBlobData(e,this._compress,f,n):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,f,n]):this.dispatch(e,this._compress,f,n)}getBlobData(e,r,n,i){this._bufferedBytes+=n[pe],this._state=Jo,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let u=new Error("The socket was closed while the blob was being read");process.nextTick(Fr,this,u,i);return}this._bufferedBytes-=n[pe];let a=Ue(s);r?this.dispatch(a,r,n,i):(this._state=_e,this.sendFrame(t.frame(a,n),i),this.dequeue())}).catch(s=>{process.nextTick(Ko,this,s,i)})}dispatch(e,r,n,i){if(!r){this.sendFrame(t.frame(e,n),i);return}let s=this._extensions[Hi.extensionName];this._bufferedBytes+=n[pe],this._state=Yo,s.compress(e,n.fin,(a,u)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Fr(this,l,i);return}this._bufferedBytes-=n[pe],this._state=_e,n.readOnly=!1,this.sendFrame(t.frame(u,n),i),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][pe],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][pe],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Yi.exports=qr;function Fr(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let i=t._queue[n],s=i[i.length-1];typeof s=="function"&&s(e)}}o(Fr,"callCallbacks");function Ko(t,e,r){Fr(t,e,r),t.onerror(e)}o(Ko,"onError")});var is=F((lh,ns)=>{"use strict";h();var{kForOnEventAttribute:bt,kListener:jr}=Le(),Ji=Symbol("kCode"),Ki=Symbol("kData"),Zi=Symbol("kError"),Xi=Symbol("kMessage"),es=Symbol("kReason"),tt=Symbol("kTarget"),ts=Symbol("kType"),rs=Symbol("kWasClean"),Ce=class{static{o(this,"Event")}constructor(e){this[tt]=null,this[ts]=e}get target(){return this[tt]}get type(){return this[ts]}};Object.defineProperty(Ce.prototype,"target",{enumerable:!0});Object.defineProperty(Ce.prototype,"type",{enumerable:!0});var Fe=class extends Ce{static{o(this,"CloseEvent")}constructor(e,r={}){super(e),this[Ji]=r.code===void 0?0:r.code,this[es]=r.reason===void 0?"":r.reason,this[rs]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Ji]}get reason(){return this[es]}get wasClean(){return this[rs]}};Object.defineProperty(Fe.prototype,"code",{enumerable:!0});Object.defineProperty(Fe.prototype,"reason",{enumerable:!0});Object.defineProperty(Fe.prototype,"wasClean",{enumerable:!0});var rt=class extends Ce{static{o(this,"ErrorEvent")}constructor(e,r={}){super(e),this[Zi]=r.error===void 0?null:r.error,this[Xi]=r.message===void 0?"":r.message}get error(){return this[Zi]}get message(){return this[Xi]}};Object.defineProperty(rt.prototype,"error",{enumerable:!0});Object.defineProperty(rt.prototype,"message",{enumerable:!0});var _t=class extends Ce{static{o(this,"MessageEvent")}constructor(e,r={}){super(e),this[Ki]=r.data===void 0?null:r.data}get data(){return this[Ki]}};Object.defineProperty(_t.prototype,"data",{enumerable:!0});var Zo={addEventListener(t,e,r={}){for(let i of this.listeners(t))if(!r[bt]&&i[jr]===e&&!i[bt])return;let n;if(t==="message")n=o(function(s,a){let u=new _t("message",{data:a?s:s.toString()});u[tt]=this,Gt(e,this,u)},"onMessage");else if(t==="close")n=o(function(s,a){let u=new Fe("close",{code:s,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});u[tt]=this,Gt(e,this,u)},"onClose");else if(t==="error")n=o(function(s){let a=new rt("error",{error:s,message:s.message});a[tt]=this,Gt(e,this,a)},"onError");else if(t==="open")n=o(function(){let s=new Ce("open");s[tt]=this,Gt(e,this,s)},"onOpen");else return;n[bt]=!!r[bt],n[jr]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[jr]===e&&!r[bt]){this.removeListener(t,r);break}}};ns.exports={CloseEvent:Fe,ErrorEvent:rt,Event:Ce,EventTarget:Zo,MessageEvent:_t};function Gt(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}o(Gt,"callListener")});var Wr=F((fh,ss)=>{"use strict";h();var{tokenChars:xt}=Ze();function Ee(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}o(Ee,"push");function Xo(t){let e=Object.create(null),r=Object.create(null),n=!1,i=!1,s=!1,a,u,l=-1,f=-1,p=-1,d=0;for(;d<t.length;d++)if(f=t.charCodeAt(d),a===void 0)if(p===-1&&xt[f]===1)l===-1&&(l=d);else if(d!==0&&(f===32||f===9))p===-1&&l!==-1&&(p=d);else if(f===59||f===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let c=t.slice(l,p);f===44?(Ee(e,c,r),r=Object.create(null)):a=c,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===void 0)if(p===-1&&xt[f]===1)l===-1&&(l=d);else if(f===32||f===9)p===-1&&l!==-1&&(p=d);else if(f===59||f===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d),Ee(r,t.slice(l,p),!0),f===44&&(Ee(e,a,r),r=Object.create(null),a=void 0),l=p=-1}else if(f===61&&l!==-1&&p===-1)u=t.slice(l,d),l=p=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(i){if(xt[f]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1?l=d:n||(n=!0),i=!1}else if(s)if(xt[f]===1)l===-1&&(l=d);else if(f===34&&l!==-1)s=!1,p=d;else if(f===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(f===34&&t.charCodeAt(d-1)===61)s=!0;else if(p===-1&&xt[f]===1)l===-1&&(l=d);else if(l!==-1&&(f===32||f===9))p===-1&&(p=d);else if(f===59||f===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let c=t.slice(l,p);n&&(c=c.replace(/\\/g,""),n=!1),Ee(r,u,c),f===44&&(Ee(e,a,r),r=Object.create(null),a=void 0),u=void 0,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(l===-1||s||f===32||f===9)throw new SyntaxError("Unexpected end of input");p===-1&&(p=d);let b=t.slice(l,p);return a===void 0?Ee(e,b,r):(u===void 0?Ee(r,b,!0):n?Ee(r,u,b.replace(/\\/g,"")):Ee(r,u,b),Ee(e,a,r)),e}o(Xo,"parse");function ea(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(i=>{let s=n[i];return Array.isArray(s)||(s=[s]),s.map(a=>a===!0?i:`${i}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}o(ea,"format");ss.exports={format:ea,parse:Xo}});var Yr=F((gh,ys)=>{"use strict";h();var ta=j("events"),ra=j("https"),na=j("http"),ls=j("net"),ia=j("tls"),{randomBytes:sa,createHash:oa}=j("crypto"),{Duplex:ph,Readable:mh}=j("stream"),{URL:Vr}=j("url"),Ie=yt(),aa=Ur(),la=Gr(),{isBlob:ca}=Ze(),{BINARY_TYPES:os,EMPTY_BUFFER:jt,GUID:ua,kForOnEventAttribute:zr,kListener:fa,kStatusCode:ha,kWebSocket:ee,NOOP:cs}=Le(),{EventTarget:{addEventListener:da,removeEventListener:pa}}=is(),{format:ma,parse:ga}=Wr(),{toBuffer:ya}=pt(),ba=30*1e3,us=Symbol("kAborted"),Hr=[8,13],Re=["CONNECTING","OPEN","CLOSING","CLOSED"],_a=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,V=class t extends ta{static{o(this,"WebSocket")}constructor(e,r,n){super(),this._binaryType=os[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=jt,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),fs(this,e,r,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){os.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let i=new aa({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new la(e,this._extensions,n.generateMask);this._receiver=i,this._sender=s,this._socket=e,i[ee]=this,s[ee]=this,e[ee]=this,i.on("conclude",va),i.on("drain",Ea),i.on("error",Sa),i.on("message",Ta),i.on("ping",Oa),i.on("pong",La),s.onerror=ka,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",ps),e.on("data",Vt),e.on("end",ms),e.on("error",gs),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ds(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Qr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||jt,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Qr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||jt,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Qr(this,e,n);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Ie.extensionName]||(i.compress=!1),this._sender.send(e||jt,i,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(V,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(V.prototype,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(V,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(V.prototype,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(V,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(V.prototype,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(V,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});Object.defineProperty(V.prototype,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(V.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(V.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[zr])return e[fa];return null},set(e){for(let r of this.listeners(t))if(r[zr]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[zr]:!0})}})});V.prototype.addEventListener=da;V.prototype.removeEventListener=pa;ys.exports=V;function fs(t,e,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Hr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,!Hr.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Hr.join(", ")})`);let s;if(e instanceof Vr)s=e;else try{s=new Vr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let a=s.protocol==="wss:",u=s.protocol==="ws+unix:",l;if(s.protocol!=="ws:"&&!a&&!u?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:u&&!s.pathname?l="The URL's pathname is empty":s.hash&&(l="The URL contains a fragment identifier"),l){let v=new SyntaxError(l);if(t._redirects===0)throw v;Wt(t,v);return}let f=a?443:80,p=sa(16).toString("base64"),d=a?ra.request:na.request,b=new Set,c;if(i.createConnection=i.createConnection||(a?wa:xa),i.defaultPort=i.defaultPort||f,i.port=s.port||f,i.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket"},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(c=new Ie(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=ma({[Ie.extensionName]:c.offer()})),r.length){for(let v of r){if(typeof v!="string"||!_a.test(v)||b.has(v))throw new SyntaxError("An invalid or duplicated subprotocol was specified");b.add(v)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(s.username||s.password)&&(i.auth=`${s.username}:${s.password}`),u){let v=i.path.split(":");i.socketPath=v[0],i.path=v[1]}let m;if(i.followRedirects){if(t._redirects===0){t._originalIpc=u,t._originalSecure=a,t._originalHostOrSocketPath=u?i.socketPath:s.host;let v=n&&n.headers;if(n={...n,headers:{}},v)for(let[T,B]of Object.entries(v))n.headers[T.toLowerCase()]=B}else if(t.listenerCount("redirect")===0){let v=u?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!v||t._originalSecure&&!a)&&(delete i.headers.authorization,delete i.headers.cookie,v||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),m=t._req=d(i),t._redirects&&t.emit("redirect",t.url,m)}else m=t._req=d(i);i.timeout&&m.on("timeout",()=>{fe(t,m,"Opening handshake has timed out")}),m.on("error",v=>{m===null||m[us]||(m=t._req=null,Wt(t,v))}),m.on("response",v=>{let T=v.headers.location,B=v.statusCode;if(T&&i.followRedirects&&B>=300&&B<400){if(++t._redirects>i.maxRedirects){fe(t,m,"Maximum redirects exceeded");return}m.abort();let M;try{M=new Vr(T,e)}catch{let k=new SyntaxError(`Invalid URL: ${T}`);Wt(t,k);return}fs(t,M,r,n)}else t.emit("unexpected-response",m,v)||fe(t,m,`Unexpected server response: ${v.statusCode}`)}),m.on("upgrade",(v,T,B)=>{if(t.emit("upgrade",v),t.readyState!==V.CONNECTING)return;m=t._req=null;let M=v.headers.upgrade;if(M===void 0||M.toLowerCase()!=="websocket"){fe(t,T,"Invalid Upgrade header");return}let J=oa("sha1").update(p+ua).digest("base64");if(v.headers["sec-websocket-accept"]!==J){fe(t,T,"Invalid Sec-WebSocket-Accept header");return}let k=v.headers["sec-websocket-protocol"],H;if(k!==void 0?b.size?b.has(k)||(H="Server sent an invalid subprotocol"):H="Server sent a subprotocol but none was requested":b.size&&(H="Server sent no subprotocol"),H){fe(t,T,H);return}k&&(t._protocol=k);let K=v.headers["sec-websocket-extensions"];if(K!==void 0){if(!c){fe(t,T,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let z;try{z=ga(K)}catch{fe(t,T,"Invalid Sec-WebSocket-Extensions header");return}let N=Object.keys(z);if(N.length!==1||N[0]!==Ie.extensionName){fe(t,T,"Server indicated an extension that was not requested");return}try{c.accept(z[Ie.extensionName])}catch{fe(t,T,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[Ie.extensionName]=c}t.setSocket(T,B,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,t):m.end()}o(fs,"initAsClient");function Wt(t,e){t._readyState=V.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}o(Wt,"emitErrorAndClose");function xa(t){return t.path=t.socketPath,ls.connect(t)}o(xa,"netConnect");function wa(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=ls.isIP(t.host)?"":t.host),ia.connect(t)}o(wa,"tlsConnect");function fe(t,e,r){t._readyState=V.CLOSING;let n=new Error(r);Error.captureStackTrace(n,fe),e.setHeader?(e[us]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Wt,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}o(fe,"abortHandshake");function Qr(t,e,r){if(e){let n=ca(e)?e.size:ya(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Re[t.readyState]})`);process.nextTick(r,n)}}o(Qr,"sendAfterClose");function va(t,e){let r=this[ee];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[ee]!==void 0&&(r._socket.removeListener("data",Vt),process.nextTick(hs,r._socket),t===1005?r.close():r.close(t,e))}o(va,"receiverOnConclude");function Ea(){let t=this[ee];t.isPaused||t._socket.resume()}o(Ea,"receiverOnDrain");function Sa(t){let e=this[ee];e._socket[ee]!==void 0&&(e._socket.removeListener("data",Vt),process.nextTick(hs,e._socket),e.close(t[ha])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}o(Sa,"receiverOnError");function as(){this[ee].emitClose()}o(as,"receiverOnFinish");function Ta(t,e){this[ee].emit("message",t,e)}o(Ta,"receiverOnMessage");function Oa(t){let e=this[ee];e._autoPong&&e.pong(t,!this._isServer,cs),e.emit("ping",t)}o(Oa,"receiverOnPing");function La(t){this[ee].emit("pong",t)}o(La,"receiverOnPong");function hs(t){t.resume()}o(hs,"resume");function ka(t){let e=this[ee];e.readyState!==V.CLOSED&&(e.readyState===V.OPEN&&(e._readyState=V.CLOSING,ds(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}o(ka,"senderOnError");function ds(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),ba)}o(ds,"setCloseTimer");function ps(){let t=this[ee];this.removeListener("close",ps),this.removeListener("data",Vt),this.removeListener("end",ms),t._readyState=V.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[ee]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",as),t._receiver.on("finish",as))}o(ps,"socketOnClose");function Vt(t){this[ee]._receiver.write(t)||this.pause()}o(Vt,"socketOnData");function ms(){let t=this[ee];t._readyState=V.CLOSING,t._receiver.end(),this.end()}o(ms,"socketOnEnd");function gs(){let t=this[ee];this.removeListener("error",gs),this.on("error",cs),t&&(t._readyState=V.CLOSING,this.destroy())}o(gs,"socketOnError")});var _s=F((_h,bs)=>{"use strict";h();var{tokenChars:Ca}=Ze();function Ra(t){let e=new Set,r=-1,n=-1,i=0;for(i;i<t.length;i++){let a=t.charCodeAt(i);if(n===-1&&Ca[a]===1)r===-1&&(r=i);else if(i!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=i);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let u=t.slice(r,n);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);e.add(u),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,i);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}o(Ra,"parse");bs.exports={parse:Ra}});var Os=F((Eh,Ts)=>{"use strict";h();var Ba=j("events"),zt=j("http"),{Duplex:vh}=j("stream"),{createHash:Da}=j("crypto"),xs=Wr(),Ge=yt(),$a=_s(),Aa=Yr(),{GUID:Na,kWebSocket:Ia}=Le(),Pa=/^[+/0-9A-Za-z]{22}==$/,ws=0,vs=1,Ss=2,Jr=class extends Ba{static{o(this,"WebSocketServer")}constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Aa,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=zt.createServer((n,i)=>{let s=zt.STATUS_CODES[426];i.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),i.end(s)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Ma(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:o((i,s,a)=>{this.handleUpgrade(i,s,a,n)},"upgrade")})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=ws}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Ss){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(wt,this);return}if(e&&this.once("close",e),this._state!==vs)if(this._state=vs,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(wt,this):process.nextTick(wt,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{wt(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,i){r.on("error",Es);let s=e.headers["sec-websocket-key"],a=e.headers.upgrade,u=+e.headers["sec-websocket-version"];if(e.method!=="GET"){je(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){je(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!Pa.test(s)){je(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(u!==8&&u!==13){je(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){vt(r,400);return}let l=e.headers["sec-websocket-protocol"],f=new Set;if(l!==void 0)try{f=$a.parse(l)}catch{je(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&p!==void 0){let b=new Ge(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let c=xs.parse(p);c[Ge.extensionName]&&(b.accept(c[Ge.extensionName]),d[Ge.extensionName]=b)}catch{je(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let b={origin:e.headers[`${u===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(b,(c,m,v,T)=>{if(!c)return vt(r,m||401,v,T);this.completeUpgrade(d,s,f,e,r,n,i)});return}if(!this.options.verifyClient(b))return vt(r,401)}this.completeUpgrade(d,s,f,e,r,n,i)}completeUpgrade(e,r,n,i,s,a,u){if(!s.readable||!s.writable)return s.destroy();if(s[Ia])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>ws)return vt(s,503);let f=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Da("sha1").update(r+Na).digest("base64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;d&&(f.push(`Sec-WebSocket-Protocol: ${d}`),p._protocol=d)}if(e[Ge.extensionName]){let d=e[Ge.extensionName].params,b=xs.format({[Ge.extensionName]:[d]});f.push(`Sec-WebSocket-Extensions: ${b}`),p._extensions=e}this.emit("headers",f,i),s.write(f.concat(`\r
|
|
2
|
-
`).join(`\r
|
|
3
|
-
`)),s.removeListener("error",Es),p.setSocket(s,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on("close",()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(wt,this)})),u(p,i)}};Ts.exports=Jr;function Ma(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return o(function(){for(let n of Object.keys(e))t.removeListener(n,e[n])},"removeListeners")}o(Ma,"addListeners");function wt(t){t._state=Ss,t.emit("close")}o(wt,"emitClose");function Es(){this.destroy()}o(Es,"socketOnError");function vt(t,e,r,n){r=r||zt.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${zt.STATUS_CODES[e]}\r
|
|
4
|
-
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
|
5
|
-
`)+`\r
|
|
6
|
-
\r
|
|
7
|
-
`+r)}o(vt,"abortHandshake");function je(t,e,r,n,i){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,je),t.emit("wsClientError",s,r,e)}else vt(r,n,i)}o(je,"abortHandshakeOrEmitwsClientError")});h();h();var I="\x1B[",st="\x1B]",ze="\x07",Lt=";",dn=process.env.TERM_PROGRAM==="Apple_Terminal",A={};A.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?I+(t+1)+"G":I+(e+1)+";"+(t+1)+"H"};A.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=I+-t+"D":t>0&&(r+=I+t+"C"),e<0?r+=I+-e+"A":e>0&&(r+=I+e+"B"),r};A.cursorUp=(t=1)=>I+t+"A";A.cursorDown=(t=1)=>I+t+"B";A.cursorForward=(t=1)=>I+t+"C";A.cursorBackward=(t=1)=>I+t+"D";A.cursorLeft=I+"G";A.cursorSavePosition=dn?"\x1B7":I+"s";A.cursorRestorePosition=dn?"\x1B8":I+"u";A.cursorGetPosition=I+"6n";A.cursorNextLine=I+"E";A.cursorPrevLine=I+"F";A.cursorHide=I+"?25l";A.cursorShow=I+"?25h";A.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=A.eraseLine+(r<t-1?A.cursorUp():"");return t&&(e+=A.cursorLeft),e};A.eraseEndLine=I+"K";A.eraseStartLine=I+"1K";A.eraseLine=I+"2K";A.eraseDown=I+"J";A.eraseUp=I+"1J";A.eraseScreen=I+"2J";A.scrollUp=I+"S";A.scrollDown=I+"T";A.clearScreen="\x1Bc";A.clearTerminal=process.platform==="win32"?`${A.eraseScreen}${I}0f`:`${A.eraseScreen}${I}3J${I}H`;A.beep=ze;A.link=(t,e)=>[st,"8",Lt,Lt,e,ze,t,st,"8",Lt,Lt,ze].join("");A.image=(t,e={})=>{let r=`${st}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+t.toString("base64")+ze};A.iTerm={setCwd:o((t=process.cwd())=>`${st}50;CurrentDir=${t}${ze}`,"setCwd"),annotation:o((t,e={})=>{let r=`${st}1337;`,n=typeof e.x<"u",i=typeof e.y<"u";if((n||i)&&!(n&&i&&typeof e.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replace(/\|/g,""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(n?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+ze},"annotation")};var pn=A;var kt=ae(xn(),1);function ye(t,e,{target:r="stdout",...n}={}){return kt.default[r]?pn.link(t,e):n.fallback===!1?t:typeof n.fallback=="function"?n.fallback(t,e):`${t} (\u200B${e}\u200B)`}o(ye,"terminalLink");ye.isSupported=kt.default.stdout;ye.stderr=(t,e,r={})=>ye(t,e,{target:"stderr",...r});ye.stderr.isSupported=kt.default.stderr;h();import{randomUUID as As}from"node:crypto";h();var wn=ae(Qt(),1);import ir from"node:os";var be,vn=o(async(t,e)=>{e["--telemetry"]&&(be=await import("./esm-OUX6XF3H.js"),be.init({dsn:"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266",enabled:ge.productionLike&&(e["--telemetry"]??!1),release:Ve.version,environment:Ve.version.includes("experimental")?"experimental":"production"}))},"initSentry"),En=o(async t=>{be&&(be.captureException(t,{event_id:t.id,captureContext:{tags:{arch:G.arch,bug:t.isBug,environment:ge.value,platform:G.platform,shell:G.shell,version:Ve.version},contexts:{ctx:{argv:process.argv},cause:t.cause?ue(t.cause):void 0,app:{app_name:Ve.name,app_version:Ve.version},device:{name:ir.hostname(),family:ir.type(),arch:ir.arch()},runtime:{name:process.release.name,version:process.version}}}}),await be.flush((0,wn.default)("2s")))},"sendErrorToSentry"),Sn=o(t=>{be&&be.addBreadcrumb(t)},"addSentryBreadcrumb"),fl=o(t=>{be&&be.setUser(t)},"setSentryUser"),hl=o(t=>{be&&be.setTags(t)},"setSentryTags");var Ns=o(async(t,e)=>{if(rn(e))return t.log.debug("aborting without reporting error",{error:e}),process.exit(1);t.log.error("reporting error and exiting",{error:e});try{let r=Me.from(e);if(r.print(),r.isBug===Pe.NO)return;await En(r)}finally{process.exit(1)}},"reportErrorAndExit"),Ol=o(async(t,e)=>{t.log.debug("installing error handlers"),await vn(t,e);let r=o(n=>void Ns(t,n),"handleError");process.once("uncaughtException",r),process.once("unhandledRejection",r)},"installErrorHandlers"),Pe=Object.freeze({YES:"yes",NO:"no",MAYBE:"maybe"}),Me=class t extends Error{static{o(this,"GGTError")}id=ge.testLike?"00000000-0000-0000-0000-000000000000":As();cause;stack;constructor(e){super(e),Error.captureStackTrace(this,this.constructor),this.stack=Xr(this.stack,{pretty:!0,basePath:on})}static from(e){return e instanceof t?e:new sr(e)}sprint(){let e=this.render();if(this.isBug!==Pe.NO){e=Ot(e);let r=this.isBug===Pe.YES?"This is a bug":"If you think this is a bug",n=`https://github.com/gadget-inc/ggt/issues/new?template=bug_report.yml&error-id=${this.id}`;ye.isSupported?e+=Ot({ensureEmptyLineAbove:!0,content:we`
|
|
8
|
-
${r}, ${ye("click here",n)} to create an issue on GitHub.
|
|
9
|
-
`}):e+=Ot({ensureEmptyLineAbove:!0,content:we`
|
|
10
|
-
${r}, use the link below to create an issue on GitHub.
|
|
11
|
-
|
|
12
|
-
${n}
|
|
13
|
-
`})}return e}print(e){cn({ensureEmptyLineAbove:!0,...e,content:this.sprint()})}},sr=class extends Me{constructor(r){super("An unexpected error occurred");this.cause=r}static{o(this,"UnexpectedError")}isBug=Pe.YES;render(){let r=ue(this.cause),n=r.stack||r.message||this.stack;return this.message+`.
|
|
14
|
-
|
|
15
|
-
`+n}},Tn=class extends Me{constructor(r,n){super(r);this.cause=n}static{o(this,"EdgeCaseError")}isBug=Pe.MAYBE;render(){return this.message}};h();h();h();import On from"node:process";function ot(){let{env:t}=On,{TERM:e,TERM_PROGRAM:r}=t;return On.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}o(ot,"isUnicodeSupported");var Ln={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},kn={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},Is={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},or={...Ln,...kn},Ps={...Ln,...Is},Ms=ot(),Us=Ms?or:Ps,Cn=Us,Nl=Object.entries(kn);var ar={...ge.testLike?or:Cn};if(ot()&&G.windowsOrWsl)for(let t of["tick","cross"])ar[t]+=" ";h();var fr=ae($n(),1);import js from"node:assert";var Xl=o(t=>t.filter(e=>!!e),"compact"),An=o(t=>[...new Set(t)],"uniq"),ec=o((t,e)=>(js(e.length>0,"options must not be empty"),[...e].sort((r,n)=>fr.default.get(r,t)-fr.default.get(n,t))),"sortBySimilar");h();var In=ae(Nn(),1);import Ws from"node:assert";var De=class extends Me{constructor(r,n){super("An error occurred while communicating with Gadget");this.request=r;Kt(n)?this.cause={type:n.type,message:n.message,error:ue(n.error)}:Jt(n)?this.cause={type:n.type,code:n.code,reason:n.reason,wasClean:n.wasClean}:(Ws(Tt(n)||Yt(n)||Zt(n),"cause must be a string, Error, GraphQLError[], CloseEvent, or ErrorEvent"),this.cause=n)}static{o(this,"ClientError")}isBug=Pe.MAYBE;cause;render(){let r="";switch(!0){case Zt(this.cause):{let n=An(this.cause.map(i=>i.message));r=we`
|
|
16
|
-
Gadget responded with the following ${(0,In.default)("error",n.length,!1)}:
|
|
17
|
-
|
|
18
|
-
• ${n.join(`
|
|
19
|
-
\u2022 `)}
|
|
20
|
-
`;break}case Jt(this.cause):r="The connection to Gadget closed unexpectedly.";break;case(Kt(this.cause)||Yt(this.cause)):r=this.cause.message;break;default:r=this.cause;break}return this.message+`
|
|
21
|
-
|
|
22
|
-
`+r}};h();h();import Vs from"node:assert";var Pn=o(t=>t.url instanceof URL&&t.url.host===G.domains.services,"isGadgetServicesRequest"),zs=o(t=>{let e=un(t);return e&&`session=${encodeURIComponent(e)};`},"loadCookie"),pr=o(t=>{let e=lt(t);return Vs(e,"missing auth headers"),e},"loadAuthHeaders"),lt=o(t=>{let e=zs(t);if(e)return t.log.trace("using cookie as auth header",{},{cookie:e}),{cookie:e};let r=hn(t);if(r)return t.log.trace("using token as auth header",{},{token:r}),{"x-platform-access-token":r}},"maybeLoadAuthHeaders"),Hs=o(t=>t instanceof nn&&t.response.statusCode===401,"isUnauthorizedError"),_c=o((t,e)=>{if(Hs(e)){t.log.warn("swallowing unauthorized error",{error:e});return}throw e},"swallowUnauthorized");h();var di=ae(Qt(),1);import ho from"node:assert";import{Agent as po}from"node:http";import{Agent as mo}from"node:https";h();h();h();import co from"node:assert";h();h();var Mn=o((t,e,r,n)=>JSON.stringify({level:t,name:e,msg:Xt(r).trim(),fields:Un(n)})+`
|
|
23
|
-
`,"formatJson"),Un=o(t=>{let e={};for(let[r,n]of Object.entries(t))e[r]=qn(n);return e},"serializeFields"),qn=o(t=>(t instanceof Set&&(t=Array.from(t)),Array.isArray(t)?t.map(qn):(t instanceof Map&&(t=Object.fromEntries(t.entries())),We(t)?Un(t):Tt(t)?Xt(t).trim():t)),"serializeValue");h();var yr=ae(Rn(),1);import to from"node:assert";h();var si=ae(ii(),1);var oi=o(t=>{let e=si.default.stringify(t);return e?`?${e}`:""},"serializeObjectToHTTPQuery");h();var R=new Kr({level:ge.testLike&&G.logLevel<W.PRINT?3:Zr.level}),P={error:R.red,success:R.green,warn:R.yellow,link:R.cyan,highlighted:R.magentaBright,examplesQuestions:R.cyanBright,subdued:R.blackBright,body:R.whiteBright,black:R.black,blackBright:R.blackBright,red:R.red,redBright:R.redBright,green:R.green,greenBright:R.greenBright,yellow:R.yellow,yellowBright:R.yellowBright,blue:R.blue,blueBright:R.blueBright,magenta:R.magenta,magentaBright:R.magentaBright,cyan:R.cyan,cyanBright:R.cyanBright,white:R.white,whiteBright:R.whiteBright,bgBlack:R.bgBlack,bgBlackBright:R.bgBlackBright,bgRed:R.bgRed,bgRedBright:R.bgRedBright,bgGreen:R.bgGreen,bgGreenBright:R.bgGreenBright,bgYellow:R.bgYellow,bgYellowBright:R.bgYellowBright,bgBlue:R.bgBlue,bgBlueBright:R.bgBlueBright,bgMagenta:R.bgMagenta,bgMagentaBright:R.bgMagentaBright,bgCyan:R.bgCyan,bgCyanBright:R.bgCyanBright,bgWhite:R.bgWhite,bgWhiteBright:R.bgWhiteBright,reset:R.reset};var ci=o((t,e,r,n,i,s)=>`${so(i)} ${oo(t)} ${ao(e)}:${lo(r)}${ui(n,{indent:2,timestamp:i,environment:s})}${Te}`,"formatPretty"),Ye="",Ae=" ",Te=`
|
|
24
|
-
`,ro=":",ai="'",li=o((t,e)=>{let r=t==="error"?P.error:P.subdued,n=[];n.push(Te);for(let i=0;i<e;i++)n.push(Ae);return n.push(r(t)),n.push(r(ro)),n.join("")},"formatKey"),$e=o((t,e,r)=>{if(!t)return Ye;let n=t.split(Te);if(n.length===0)return Ye;let i=[],s=n.shift();to(!tn(s),"first line is nil"),i.push(e(s));for(let a of n)if(a){i.push(Te);for(let u=0;u<r;u++)i.push(Ae);i.push(e(a))}return i.join(Ye)},"formatValue"),no=o((t,e)=>{let r="";return e&&(r=oi(e)),`https://${t.application.slug}--${t.name}.${G.domains.app}/edit/logs${r}`},"getEnvironmentLogsUrl"),io=o(t=>t?`{environment_id="${t.id.toString()}"} | json | level=~"info|warn|error"`:'{environment_id=~".+"} | json | level=~"info|warn|error"',"defaultLogqlQuery"),ui=o((t,e)=>{let{indent:r,environment:n,timestamp:i}=e;if(Object.keys(t).length===0)return Ye;let s=[];"trace_id"in t&&(s.push(li("trace_id",r)),s.push(Ae),n&&i&&ye.isSupported?s.push(ye(P.link(t.trace_id),no(n,{timeRange:`${i.toISOString()} to now`,logql:`${io(n)} | trace_id="${t.trace_id}"`}))):s.push(P.link(t.trace_id)));for(let[a,u]of Object.entries(t))if(a!=="trace_id"){if(s.push(li(a,r)),u instanceof Set&&(u=Array.from(u)),Array.isArray(u)){if(u.length===0){s.push($e(" []",P.subdued,r));continue}u=Object.fromEntries(u.entries())}if(u instanceof Map&&(u=Object.fromEntries(u)),We(u)){let l=Object.entries(u);if(l.length===0){s.push($e(" {}",P.subdued,r));continue}l.length>10&&G.logLevel>W.TRACE&&!n&&(u=Object.fromEntries([...l.slice(0,10),[ar.ellipsis,`${l.length-10} more`]])),s.push(ui(u,{indent:r+2,environment:n}));continue}if(s.push(Ae),n)s.push($e(String(u),P.reset,r));else switch(typeof u){case"string":s.push($e(ai+u.replaceAll(Te,Te+Ae.repeat(r+a.length))+ai,P.reset,r));break;case"number":s.push($e(String(u),P.yellowBright,r));break;case"bigint":s.push($e(String(u)+"n",P.yellowBright,r));break;case"boolean":s.push($e(String(u),P.green,r));break;default:s.push($e(String(u),P.reset,r));break}}return s.join(Ye)},"formatFields"),so=o(t=>(t?(0,yr.default)(t):(0,yr.default)()).format("hh:mm:ss"),"formatTimestamp"),oo=o(t=>{switch(t){case W.PRINT:return P.bgBlack(P.body.bold(" PRINT "));case W.TRACE:return P.bgBlue(P.body.bold(" TRACE "));case W.DEBUG:return P.bgMagenta(P.body.bold(" DEBUG "));case W.INFO:return P.bgBlue(P.body.bold(" INFO "));case W.WARN:return P.bgYellow(P.body.bold(" WARN "));case W.ERROR:return P.bgRed(P.body.bold(" ERROR "))}},"formatLevel"),ao=o(t=>P.body(t),"formatName"),lo=o(t=>{if(!t)return Ye;let e=t.split(Te);return e.length===1?Ae+P.body(t):Te+e.map(r=>Ae+Ae+r).join(Te)},"formatMessage");var br={pretty:ci,json:Mn};var Eu={"--log-level":{type:o(t=>ln(t,W.INFO),"type"),alias:["-ll"],default:W.INFO},"--my-logs":{type:Boolean}},uo={trace:W.TRACE,debug:W.DEBUG,info:W.INFO,warn:W.WARN,error:W.ERROR},Su=o(t=>(e,r,n,i,s)=>{let a={...i};"error"in a&&(a.error=ue(a.error)),"reason"in a&&(a.reason=ue(a.reason));let u=br[G.logFormat],l=uo[e.toLowerCase()];co(l,`Unknown level: ${e}`),er.writeStdout(u(l,r,n,a,s,t))},"createEnvironmentStructuredLogger"),fi=o(({name:t,fields:e={},devFields:r={}})=>{let n=o(i=>(s,a,u)=>{let l=i>=G.logLevel,f=i>=W.INFO;if(!l&&!f)return;let p={...le(e),...a};if(ge.developmentOrTestLike&&Object.assign(p,le(r),u),"error"in p&&(p.error=ue(p.error)),"reason"in p&&(p.reason=ue(p.reason)),l){let d=br[G.logFormat];er.writeStderr(d(i,t,s,p))}f&&Sn({level:"log",message:s,data:p})},"createStructuredLog");return{trace:n(W.TRACE),debug:n(W.DEBUG),info:n(W.INFO),warn:n(W.WARN),error:n(W.ERROR)}},"createStructuredLogger");var _r=o(({name:t,fields:e,devFields:r})=>({...fi({name:t,fields:e,devFields:r}),child:o(({name:n,fields:i,devFields:s})=>_r({name:n||t,fields:o(()=>({...le(e),...le(i)}),"fields"),devFields:{...le(r),...le(s)}}),"child")}),"createLogger");h();var hi=ae(Qt(),1);import{setTimeout as fo}from"node:timers/promises";var Au=o((t,e)=>fo((0,hi.default)(t),void 0,e),"delay"),xr=class{static{o(this,"PromiseWrapper")}resolution;rejection;pendingPromise;constructor(e){this.pendingPromise=e,e.then(r=>(this.resolution=r,r)).catch(r=>{this.rejection=r}).finally(()=>{delete this.pendingPromise})}async unwrap(){if(this.pendingPromise)return await this.pendingPromise;if(this.rejection)throw this.rejection;return this.resolution}},Ct=class{static{o(this,"PromiseSignal")}[Symbol.toStringTag];resolve;reject;_promise;constructor(){this._promise=new xr(new Promise((e,r)=>{this.resolve=e,this.reject=r})),this[Symbol.toStringTag]=String(this._promise.pendingPromise)}then(e,r){return this._promise.unwrap().then(e,r)}catch(e){return this._promise.unwrap().catch(e)}finally(e){return this._promise.unwrap().finally(e)}};var Rt=class t extends AbortController{static{o(this,"Context")}done=new Ct;#e;#i=[];constructor({log:e}){super(),this.#e=e,this.abort=this.abort.bind(this),this.child=this.child.bind(this),this.onAbort=this.onAbort.bind(this),this.signal.addEventListener("abort",async()=>{let r;for(let n of this.#i.reverse())try{await n(this.signal.reason)}catch(i){r??=i,this.log.error("error during abort",{error:r})}r?this.done.reject(r):this.done.resolve()})}get log(){return this.#e}static init(e){return new t({log:_r(e)})}child(e){let r=new t({log:this.log.child(e)});return this.onAbort(()=>r.abort()),r}onAbort(e){this.#i.push(e)}};var wr=o(t=>(ho(t.context?.ctx instanceof Rt,we(`
|
|
25
|
-
ctx must be provided to http requests:
|
|
26
|
-
|
|
27
|
-
const response = await http({
|
|
28
|
-
context: { ctx },
|
|
29
|
-
...options,
|
|
30
|
-
});
|
|
31
|
-
`)),t.context.ctx),"getContext"),Bt=sn.extend({agent:{http:new po({keepAlive:!0}),https:new mo({keepAlive:!0})},retry:{limit:10,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN","EADDRNOTAVAIL","EHOSTUNREACH"],maxRetryAfter:void 0,calculateDelay:o(({computedValue:t})=>t,"calculateDelay"),backoffLimit:(0,di.default)("5s"),noise:100},hooks:{beforeRequest:[t=>{let e=wr(t);t.signal=e.signal,t.headers["user-agent"]=G.versionFull,e.log.debug("http request",{http:{request:{method:t.method,url:t.url?.toString()}}})}],beforeRetry:[(t,e)=>{wr(t.request?.options??t.options.context).log.warn("http request failed, retrying...",{http:{retryCount:e,error:ue(t),request:t.request&&{method:t.request.options.method,url:t.request.options.url?.toString()},response:t.response&&{statusCode:t.response.statusCode,traceId:t.response.headers["x-trace-id"],durationMs:t.response.timings.phases.total}}})}],afterResponse:[t=>{let e=wr(t.request.options);return e.log.debug("http response",{http:{request:{method:t.request.options.method,url:t.request.options.url?.toString()},response:{statusCode:t.statusCode,traceId:t.headers["x-trace-id"],durationMs:t.timings.phases.total}}}),t.statusCode===401&&Pn(t.request.options)&&fn(e,void 0),t}]}});h();import ja from"node:assert";h();h();h();h();function ie(t){return t===null?"null":Array.isArray(t)?"array":typeof t}o(ie,"extendedTypeof");function Oe(t){return ie(t)==="object"}o(Oe,"isObject");function pi(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}o(pi,"areGraphQLErrors");function vr(t,e){return t.length<124?t:e}o(vr,"limitCloseReason");var mi="graphql-transport-ws";var ce;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ce||(ce={}));var Y;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Y||(Y={}));function gi(t){if(!Oe(t))throw new Error(`Message is expected to be an object, but got ${ie(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ie(t.type)}`);switch(t.type){case Y.ConnectionInit:case Y.ConnectionAck:case Y.Ping:case Y.Pong:{if(t.payload!=null&&!Oe(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Y.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ie(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Oe(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ie(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${ie(t.payload.query)}`);if(t.payload.variables!=null&&!Oe(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ie(t.payload.variables)}`);if(t.payload.operationName!=null&&ie(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ie(t.payload.operationName)}`);if(t.payload.extensions!=null&&!Oe(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ie(t.payload.extensions)}`);break}case Y.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ie(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Oe(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ie(t.payload)}`);break}case Y.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ie(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!pi(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Y.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ie(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}o(gi,"validateMessage");function yi(t,e){return gi(typeof t=="string"?JSON.parse(t,e):t)}o(yi,"parseMessage");function Je(t,e){return gi(t),JSON.stringify(t,e)}o(Je,"stringifyMessage");var Ke=function(t){return this instanceof Ke?(this.v=t,this):new Ke(t)},go=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(c){return function(m){return Promise.resolve(m).then(c,d)}}function u(c,m){n[c]&&(i[c]=function(v){return new Promise(function(T,B){s.push([c,v,T,B])>1||l(c,v)})},m&&(i[c]=m(i[c])))}function l(c,m){try{f(n[c](m))}catch(v){b(s[0][3],v)}}function f(c){c.value instanceof Ke?Promise.resolve(c.value.v).then(p,d):b(s[0][2],c)}function p(c){l("next",c)}function d(c){l("throw",c)}function b(c,m){c(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};function bi(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:a=0,disablePong:u,connectionAckWaitTimeout:l=0,retryAttempts:f=5,retryWait:p=o(async function(g){let _=1e3;for(let x=0;x<g;x++)_*=2;await new Promise(x=>setTimeout(x,_+Math.floor(Math.random()*2700+300)))},"randomisedExponentialBackoff"),shouldRetry:d=Er,isFatalConnectionProblem:b,on:c,webSocketImpl:m,generateID:v=o(function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let _=Math.random()*16|0;return(g=="x"?_:_&3|8).toString(16)})},"generateUUID"),jsonMessageReplacer:T,jsonMessageReviver:B}=t,M;if(m){if(!bo(m))throw new Error("Invalid WebSocket implementation provided");M=m}else typeof WebSocket<"u"?M=WebSocket:typeof global<"u"?M=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(M=window.WebSocket||window.MozWebSocket);if(!M)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let J=M,k=(()=>{let y=(()=>{let _={};return{on(x,S){return _[x]=S,()=>{delete _[x]}},emit(x){var S;"id"in x&&((S=_[x.id])===null||S===void 0||S.call(_,x))}}})(),g={connecting:c?.connecting?[c.connecting]:[],opened:c?.opened?[c.opened]:[],connected:c?.connected?[c.connected]:[],ping:c?.ping?[c.ping]:[],pong:c?.pong?[c.pong]:[],message:c?.message?[y.emit,c.message]:[y.emit],closed:c?.closed?[c.closed]:[],error:c?.error?[c.error]:[]};return{onMessage:y.on,on(_,x){let S=g[_];return S.push(x),()=>{S.splice(S.indexOf(x),1)}},emit(_,...x){for(let S of[...g[_]])S(...x)}}})();function H(y){let g=[k.on("error",_=>{g.forEach(x=>x()),y(_)}),k.on("closed",_=>{g.forEach(x=>x()),y(_)})]}o(H,"errorOrClosed");let K,z=0,N,C=!1,re=0,nt=!1;async function O(){clearTimeout(N);let[y,g]=await(K??(K=new Promise((S,D)=>(async()=>{if(C){if(await p(re),!z)return K=void 0,D({code:1e3,reason:"All Subscriptions Gone"});re++}k.emit("connecting",C);let L=new J(typeof e=="function"?await e():e,mi),U,Z;function me(){isFinite(a)&&a>0&&(clearTimeout(Z),Z=setTimeout(()=>{L.readyState===J.OPEN&&(L.send(Je({type:Y.Ping})),k.emit("ping",!1,void 0))},a))}o(me,"enqueuePing"),H(Q=>{K=void 0,clearTimeout(U),clearTimeout(Z),D(Q),Q instanceof Dt&&(L.close(4499,"Terminated"),L.onerror=null,L.onclose=null)}),L.onerror=Q=>k.emit("error",Q),L.onclose=Q=>k.emit("closed",Q),L.onopen=async()=>{try{k.emit("opened",L);let Q=typeof r=="function"?await r():r;if(L.readyState!==J.OPEN)return;L.send(Je(Q?{type:Y.ConnectionInit,payload:Q}:{type:Y.ConnectionInit},T)),isFinite(l)&&l>0&&(U=setTimeout(()=>{L.close(ce.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),me()}catch(Q){k.emit("error",Q),L.close(ce.InternalClientError,vr(Q instanceof Error?Q.message:new Error(Q).message,"Internal client error"))}};let oe=!1;L.onmessage=({data:Q})=>{try{let q=yi(Q,B);if(k.emit("message",q),q.type==="ping"||q.type==="pong"){k.emit(q.type,!0,q.payload),q.type==="pong"?me():u||(L.send(Je(q.payload?{type:Y.Pong,payload:q.payload}:{type:Y.Pong})),k.emit("pong",!1,q.payload));return}if(oe)return;if(q.type!==Y.ConnectionAck)throw new Error(`First message cannot be of type ${q.type}`);clearTimeout(U),oe=!0,k.emit("connected",L,q.payload,C),C=!1,re=0,S([L,new Promise((ne,xe)=>H(xe))])}catch(q){L.onmessage=null,k.emit("error",q),L.close(ce.BadResponse,vr(q instanceof Error?q.message:new Error(q).message,"Bad response"))}}})())));y.readyState===J.CLOSING&&await g;let _=o(()=>{},"release"),x=new Promise(S=>_=S);return[y,_,Promise.race([x.then(()=>{if(!z){let S=o(()=>y.close(1e3,"Normal Closure"),"complete");isFinite(s)&&s>0?N=setTimeout(()=>{y.readyState===J.OPEN&&S()},s):S()}}),g])]}o(O,"connect");function E(y){if(Er(y)&&(yo(y.code)||[ce.InternalServerError,ce.InternalClientError,ce.BadRequest,ce.BadResponse,ce.Unauthorized,ce.SubprotocolNotAcceptable,ce.SubscriberAlreadyExists,ce.TooManyInitialisationRequests].includes(y.code)))throw y;if(nt)return!1;if(Er(y)&&y.code===1e3)return z>0;if(!f||re>=f||!d(y)||b?.(y))throw y;return C=!0}o(E,"shouldRetryConnectOrThrow"),n||(async()=>{for(z++;;)try{let[,,y]=await O();await y}catch(y){try{if(!E(y))return}catch(g){return i?.(g)}}})();function w(y,g){let _=v(y),x=!1,S=!1,D=o(()=>{z--,x=!0},"releaser");return(async()=>{for(z++;;)try{let[L,U,Z]=await O();if(x)return U();let me=k.onMessage(_,oe=>{switch(oe.type){case Y.Next:{g.next(oe.payload);return}case Y.Error:{S=!0,x=!0,g.error(oe.payload),D();return}case Y.Complete:{x=!0,D();return}}});L.send(Je({id:_,type:Y.Subscribe,payload:y},T)),D=o(()=>{!x&&L.readyState===J.OPEN&&L.send(Je({id:_,type:Y.Complete},T)),z--,x=!0,U()},"releaser"),await Z.finally(me);return}catch(L){if(!E(L))return}})().then(()=>{S||g.complete()}).catch(L=>{g.error(L)}),()=>{x||D()}}return o(w,"subscribe"),{on:k.on,subscribe:w,iterate(y){let g=[],_={done:!1,error:null,resolve:o(()=>{},"resolve")},x=w(y,{next(D){g.push(D),_.resolve()},error(D){_.done=!0,_.error=D,_.resolve()},complete(){_.done=!0,_.resolve()}}),S=o(function(){return go(this,arguments,o(function*(){for(;;){for(g.length||(yield Ke(new Promise(U=>_.resolve=U)));g.length;)yield yield Ke(g.shift());if(_.error)throw _.error;if(_.done)return yield Ke(void 0)}},"iterator_1"))},"iterator")();return S.throw=async D=>(_.done||(_.done=!0,_.error=D,_.resolve()),{done:!0,value:void 0}),S.return=async()=>(x(),{done:!0,value:void 0}),S},async dispose(){if(nt=!0,K){let[y]=await K;y.close(1e3,"Normal Closure")}},terminate(){K&&k.emit("closed",new Dt)}}}o(bi,"createClient");var Dt=class extends Error{static{o(this,"TerminatedCloseEvent")}constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function Er(t){return Oe(t)&&"code"in t&&"reason"in t}o(Er,"isLikeCloseEvent");function yo(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}o(yo,"isFatalInternalCloseCode");function bo(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}o(bo,"isWebSocket");h();h();var Tr=ae(xi(),1);h();var ft=class extends Error{static{o(this,"TimeoutError")}constructor(e){super(e),this.name="TimeoutError"}},Or=class extends Error{static{o(this,"AbortError")}constructor(e){super(),this.name="AbortError",this.message=e}},wi=o(t=>globalThis.DOMException===void 0?new Or(t):new DOMException(t),"getDOMException"),vi=o(t=>{let e=t.reason===void 0?wi("This operation was aborted."):t.reason;return e instanceof Error?e:wi(e)},"getAbortedReason");function Lr(t,e){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=e,a,u,f=new Promise((p,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:c}=e;c.aborted&&d(vi(c)),u=o(()=>{d(vi(c))},"abortHandler"),c.addEventListener("abort",u,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(p,d);return}let b=new ft;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(c){d(c)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?p():i instanceof Error?d(i):(b.message=i??`Promise timed out after ${r} milliseconds`,d(b))},r),(async()=>{try{p(await t)}catch(c){d(c)}})()}).finally(()=>{f.clear(),u&&e.signal&&e.signal.removeEventListener("abort",u)});return f.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},f}o(Lr,"pTimeout");h();h();function kr(t,e,r){let n=0,i=t.length;for(;i>0;){let s=Math.trunc(i/2),a=n+s;r(t[a],e)<=0?(n=++a,i-=s+1):i=s}return n}o(kr,"lowerBound");var ht=class{static{o(this,"PriorityQueue")}#e=[];enqueue(e,r){r={priority:0,...r};let n={priority:r.priority,id:r.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=kr(this.#e,n,(s,a)=>a.priority-s.priority);this.#e.splice(i,0,n)}setPriority(e,r){let n=this.#e.findIndex(s=>s.id===e);if(n===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[i]=this.#e.splice(n,1);this.enqueue(i.run,{priority:r,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this.#e.length}};var dt=class extends Tr.default{static{o(this,"PQueue")}#e;#i;#o=0;#d;#a;#p=0;#r;#l;#t;#m;#n=0;#c;#s;#g;#_=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:ht,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#i=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#d=e.intervalCap,this.#a=e.interval,this.#t=new e.queueClass,this.#m=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#s=e.autoStart===!1}get#x(){return this.#i||this.#o<this.#d}get#w(){return this.#n<this.#c}#v(){this.#n--,this.#u(),this.emit("next")}#E(){this.#b(),this.#y(),this.#l=void 0}get#S(){let e=Date.now();if(this.#r===void 0){let r=this.#p-e;if(r<0)this.#o=this.#e?this.#n:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#E()},r)),!0}return!1}#u(){if(this.#t.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#s){let e=!this.#S;if(this.#x&&this.#w){let r=this.#t.dequeue();return r?(this.emit("active"),r(),e&&this.#y(),!0):!1}}return!1}#y(){this.#i||this.#r!==void 0||(this.#r=setInterval(()=>{this.#b()},this.#a),this.#p=Date.now()+this.#a)}#b(){this.#o===0&&this.#n===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#o=this.#e?this.#n:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#c}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#c=e,this.#f()}async#T(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(e.reason)},{once:!0})})}setPriority(e,r){this.#t.setPriority(e,r)}async add(e,r={}){return r.id??=(this.#_++).toString(),r={timeout:this.timeout,throwOnTimeout:this.#g,...r},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#n++,this.#o++;try{r.signal?.throwIfAborted();let s=e({signal:r.signal});r.timeout&&(s=Lr(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#T(r.signal)]));let a=await s;n(a),this.emit("completed",a)}catch(s){if(s instanceof ft&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#v()}},r),this.emit("add"),this.#u()})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#t.size<e||await this.#h("next",()=>this.#t.size<e)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(e,r){return new Promise(n=>{let i=o(()=>{r&&!r()||(this.off(e,i),n())},"listener");this.on(e,i)})}get size(){return this.#t.size}sizeBy(e){return this.#t.filter(e).length}get pending(){return this.#n}get isPaused(){return this.#s}};h();var Ua=ae(Oi(),1),qa=ae(Ur(),1),Fa=ae(Gr(),1),Ls=ae(Yr(),1),Ga=ae(Os(),1);var ks=Ls.default;var Ht=class{constructor(e,r,n){this.environment=r;this.endpoint=n;this.ctx=e.child({name:"client"}),this._graphqlWsClient=bi({url:`wss://${r.application.slug}.${G.domains.app}/edit/api/graphql-ws`,shouldRetry:o(()=>!0,"shouldRetry"),connectionParams:{environment:r.name},webSocketImpl:class extends ks{static{o(this,"webSocketImpl")}constructor(i,s,a){super(i,s,{signal:e.signal,...a,headers:{...a?.headers,"user-agent":G.versionFull,...pr(e)}})}},on:{connecting:o(()=>{switch(this.status){case 1:this.status=2,this.ctx.log.info("reconnecting");break;case 2:this.ctx.log.info("retrying");break;default:this.ctx.log.debug("connecting");break}},"connecting"),connected:o(()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},"connected"),closed:o(()=>{this.status=1,this.ctx.log.debug("disconnected")},"closed"),error:o(i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})},"error")}})}static{o(this,"Client")}status=0;ctx;_graphqlWsClient;subscribe(e,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:a=an}){let u={query:r,variables:le(n)},l=this._graphqlWsClient.on("connected",()=>{this.status===2&&(u.variables=le(n),e.log.info("re-subscribing to graphql subscription"))}),f=new dt({concurrency:1}),p=o(b=>s(new De(r,b)),"onError"),d=this._graphqlWsClient.subscribe(u,{next:o(b=>void f.add(()=>i(b)).catch(p),"next"),error:o(b=>void f.add(()=>p(b)),"error"),complete:o(()=>void f.add(()=>a()).catch(p),"complete")});return()=>{e.log.trace("unsubscribing from graphql subscription"),l(),f.clear(),d()}}async execute(e,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?this.environment.type!=="production"&&(n+=`--${this.environment.name}`):this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await Bt({context:{ctx:e},method:"POST",url:`https://${n}.${G.domains.app}${this.endpoint}`,headers:{...pr(e),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:le(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!We(i)||!("data"in i)&&!("errors"in i))throw e.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new De(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var Et=class{static{o(this,"Api")}ctx;#e;constructor(e,r){this.ctx=e.child({name:"api"}),this.#e=new Ht(this.ctx,r,"/api/graphql")}async query({query:e,variables:r,...n}){let i=/query (\w+)/.exec(e)?.[1];ja(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:le(r)}}});s.log.info("executing graphql query");let a=await this.#e.execute(s,{operation:e,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(a.errors)throw new De(e,a.errors);if(!a.data)throw new De(e,"Query response did not contain data");return a.data}async dispose(){await this.#e.dispose()}};h();var Cs=we(`
|
|
32
|
-
query GadgetMetaModels {
|
|
33
|
-
gadgetMeta {
|
|
34
|
-
models {
|
|
35
|
-
apiIdentifier
|
|
36
|
-
namespace
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`),Rs=we(`
|
|
41
|
-
query GadgetMetaGlobalActions {
|
|
42
|
-
gadgetMeta {
|
|
43
|
-
globalActions {
|
|
44
|
-
apiIdentifier
|
|
45
|
-
namespace
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`);var Wa=Object.freeze({Development:"development",Production:"production",Test:"test"}),Va=$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(t=>BigInt(t)),name:$.string().transform(t=>t.toLowerCase()),type:$.nativeEnum(Wa)}),za=$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(t=>BigInt(t)),slug:$.string(),primaryDomain:$.string(),hasSplitEnvironments:$.boolean(),multiEnvironmentEnabled:$.boolean(),environments:$.array(Va),team:$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(t=>BigInt(t)),name:$.string()})}),nd=$.object({apiIdentifier:$.string(),namespace:$.nullable($.array($.string())).optional()}),id=$.object({apiIdentifier:$.string(),namespace:$.nullable($.array($.string())).optional()}),sd=o(async t=>{let e=lt(t);if(!e)return[];let r=await Bt({context:{ctx:t},url:`https://${G.domains.services}/auth/api/apps`,headers:{...e},responseType:"json",resolveBodyOnly:!0});return $.array(za).parse(r)},"getApplications"),od=o(t=>t.reduce((e,r)=>(e.set(r.team.name,[...e.get(r.team.name)??[],r]),e),new Map),"parseAppListToTeamMap"),ad=o(async(t,e)=>{if(!lt(t))return[];let n=new Et(t,e),{gadgetMeta:i}=await n.query({query:Cs});return i.models},"getModels"),ld=o(async(t,e)=>{if(!lt(t))return[];let n=new Et(t,e),{gadgetMeta:i}=await n.query({query:Rs});return i.globalActions},"getGlobalActions");export{ye as a,fl as b,hl as c,Ns as d,Ol as e,Pe as f,Me as g,sr as h,Tn as i,ar as j,Rn as k,Nn as l,Xl as m,An as n,ec as o,De as p,dt as q,lt as r,_c as s,Ht as t,Wa as u,sd as v,od as w,ad as x,ld as y,P as z,Eu as A,Su as B,Au as C,Rt as D,Bt as E};
|
|
50
|
-
//# sourceMappingURL=chunk-Q5CNYV3H.js.map
|