@gadgetinc/ggt 1.2.0 → 1.3.0
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/README.md +3 -0
- package/dist/add-VYOF3CRL.js +78 -0
- package/dist/add-VYOF3CRL.js.map +7 -0
- package/dist/{chunk-KMCOZJPU.js → chunk-3B5DKR5D.js} +2 -2
- package/dist/{chunk-KMCOZJPU.js.map → chunk-3B5DKR5D.js.map} +4 -4
- package/dist/chunk-3V7YWBUK.js +2 -0
- package/dist/{chunk-BSCZOMV4.js.map → chunk-3V7YWBUK.js.map} +1 -1
- package/dist/chunk-B6XQEEUK.js +2 -0
- package/dist/chunk-B6XQEEUK.js.map +7 -0
- package/dist/chunk-CQH5IRAO.js +50 -0
- package/dist/chunk-CQH5IRAO.js.map +7 -0
- package/dist/{chunk-THZRTDWW.js → chunk-ENT5WEIR.js} +2 -2
- package/dist/chunk-FQ2LR3BI.js +6 -0
- package/dist/chunk-FQ2LR3BI.js.map +7 -0
- package/dist/chunk-J5XIQ6N4.js +187 -0
- package/dist/chunk-J5XIQ6N4.js.map +7 -0
- package/dist/chunk-JU6IEBE5.js +65 -0
- package/dist/chunk-JU6IEBE5.js.map +7 -0
- package/dist/{chunk-BYMG3KOL.js → chunk-LQDBD3BI.js} +4 -4
- package/dist/{chunk-BYMG3KOL.js.map → chunk-LQDBD3BI.js.map} +2 -2
- package/dist/chunk-P5OUQ5XQ.js +2 -0
- package/dist/chunk-SGMPMYEU.js +2 -0
- package/dist/chunk-SGMPMYEU.js.map +7 -0
- package/dist/chunk-VE2URKOG.js +117 -0
- package/dist/chunk-VE2URKOG.js.map +7 -0
- package/dist/{chunk-BZSAGSV3.js → chunk-WBESFPTY.js} +2 -2
- package/dist/chunk-YQO2R55C.js +18 -0
- package/dist/{chunk-6FBP46EB.js.map → chunk-YQO2R55C.js.map} +3 -3
- package/dist/chunk-ZHG3WLFU.js +2 -0
- package/dist/chunk-ZHG3WLFU.js.map +7 -0
- package/dist/deploy-EEJCK2MG.js +25 -0
- package/dist/deploy-EEJCK2MG.js.map +7 -0
- package/dist/dev-G77WSGIC.js +58 -0
- package/dist/{dev-OT7PEKUN.js.map → dev-G77WSGIC.js.map} +4 -4
- package/dist/esm-3OYJEC4Z.js +36 -0
- package/dist/esm-3OYJEC4Z.js.map +7 -0
- package/dist/list-3AI2FD3F.js +11 -0
- package/dist/list-3AI2FD3F.js.map +7 -0
- package/dist/login-UGTNK3B3.js +2 -0
- package/dist/logout-CN5DL7Z2.js +7 -0
- package/dist/{logout-B3YAZN6R.js.map → logout-CN5DL7Z2.js.map} +1 -1
- package/dist/main.js +10 -10
- package/dist/main.js.map +3 -3
- package/dist/open-PM56SR6Z.js +74 -0
- package/dist/open-PM56SR6Z.js.map +7 -0
- package/dist/{pull-SLPBOP6Z.js → pull-TAW6KHZO.js} +4 -4
- package/dist/{pull-SLPBOP6Z.js.map → pull-TAW6KHZO.js.map} +2 -2
- package/dist/push-2NCJSDGS.js +2 -0
- package/dist/status-WDYI4EOU.js +14 -0
- package/dist/status-WDYI4EOU.js.map +7 -0
- package/dist/{version-AUI4NRDS.js → version-3FBGIVXT.js} +2 -2
- package/dist/{version-AUI4NRDS.js.map → version-3FBGIVXT.js.map} +1 -1
- package/dist/whoami-UALRX2FT.js +7 -0
- package/dist/{whoami-TXO7VJXC.js.map → whoami-UALRX2FT.js.map} +1 -1
- package/package.json +19 -18
- package/dist/add-DCE6CV2D.js +0 -78
- package/dist/add-DCE6CV2D.js.map +0 -7
- package/dist/build-4BGA4IZE.js +0 -3
- package/dist/build-4BGA4IZE.js.map +0 -7
- package/dist/chunk-3Q3GPB6Z.js +0 -2
- package/dist/chunk-3Q3GPB6Z.js.map +0 -7
- package/dist/chunk-57XALM2W.js +0 -2
- package/dist/chunk-57XALM2W.js.map +0 -7
- package/dist/chunk-5WC5D4WL.js +0 -2
- package/dist/chunk-5WC5D4WL.js.map +0 -7
- package/dist/chunk-6FBP46EB.js +0 -18
- package/dist/chunk-AB4I3BMD.js +0 -33
- package/dist/chunk-AB4I3BMD.js.map +0 -7
- package/dist/chunk-BSCZOMV4.js +0 -2
- package/dist/chunk-CXYA3RFX.js +0 -117
- package/dist/chunk-CXYA3RFX.js.map +0 -7
- package/dist/chunk-D2K5XPNJ.js +0 -2
- package/dist/chunk-D2K5XPNJ.js.map +0 -7
- package/dist/chunk-DVKNBG4P.js +0 -180
- package/dist/chunk-DVKNBG4P.js.map +0 -7
- package/dist/chunk-EFU2JNKY.js +0 -9
- package/dist/chunk-EFU2JNKY.js.map +0 -7
- package/dist/chunk-F3EZ4KS3.js +0 -2
- package/dist/chunk-F3EZ4KS3.js.map +0 -7
- package/dist/chunk-GOBNB5VT.js +0 -2
- package/dist/chunk-GOBNB5VT.js.map +0 -7
- package/dist/chunk-HKBXEZNF.js +0 -2
- package/dist/chunk-KGOVR5SK.js +0 -67
- package/dist/chunk-KGOVR5SK.js.map +0 -7
- package/dist/chunk-M4PNFOA5.js +0 -6
- package/dist/chunk-M4PNFOA5.js.map +0 -7
- package/dist/chunk-OLKWG2EP.js +0 -12
- package/dist/chunk-OLKWG2EP.js.map +0 -7
- package/dist/context-L5YSPF3X.js +0 -2
- package/dist/deploy-PBJEUYGH.js +0 -25
- package/dist/deploy-PBJEUYGH.js.map +0 -7
- package/dist/dev-OT7PEKUN.js +0 -55
- package/dist/esm-GJ7RK6IC.js +0 -34
- package/dist/esm-GJ7RK6IC.js.map +0 -7
- package/dist/list-CC5PICEF.js +0 -11
- package/dist/list-CC5PICEF.js.map +0 -7
- package/dist/login-SE7XIHRW.js +0 -2
- package/dist/logout-B3YAZN6R.js +0 -7
- package/dist/open-OVK3YL4O.js +0 -74
- package/dist/open-OVK3YL4O.js.map +0 -7
- package/dist/push-3HGVWCKW.js +0 -2
- package/dist/push-3HGVWCKW.js.map +0 -7
- package/dist/status-7GLNL7D5.js +0 -14
- package/dist/status-7GLNL7D5.js.map +0 -7
- package/dist/user-C34J52UL.js +0 -2
- package/dist/user-C34J52UL.js.map +0 -7
- package/dist/whoami-TXO7VJXC.js +0 -7
- /package/dist/{chunk-THZRTDWW.js.map → chunk-ENT5WEIR.js.map} +0 -0
- /package/dist/{chunk-HKBXEZNF.js.map → chunk-P5OUQ5XQ.js.map} +0 -0
- /package/dist/{chunk-BZSAGSV3.js.map → chunk-WBESFPTY.js.map} +0 -0
- /package/dist/{context-L5YSPF3X.js.map → login-UGTNK3B3.js.map} +0 -0
- /package/dist/{login-SE7XIHRW.js.map → push-2NCJSDGS.js.map} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import{d as ln,e as cn,f as un}from"./chunk-3B5DKR5D.js";import{$ as an,A as We,B as nn,E as ce,K as ae,L as sn,M as j,N as on,P as q,T as Zt,U as Xt,Z as xe,_ as Tt,a as Jr,b as Kr,c as Zr,d as me,e as D,g as St,h as je,i as Qt,j as Yt,k as Jt,m as Kt,o as en,w as tn,x as rn}from"./chunk-JU6IEBE5.js";import{a as Ht,b as Xr}from"./chunk-B6XQEEUK.js";import{a as G,c as F,e as oe,g as f}from"./chunk-SGMPMYEU.js";var mn=F((Ha,pn)=>{"use strict";f();var Cs=G("os"),dn=G("tty"),fe=Xr(),{env:Z}=process,Re;fe("no-color")||fe("no-colors")||fe("color=false")||fe("color=never")?Re=0:(fe("color")||fe("colors")||fe("color=true")||fe("color=always"))&&(Re=1);"FORCE_COLOR"in Z&&(Z.FORCE_COLOR==="true"?Re=1:Z.FORCE_COLOR==="false"?Re=0:Re=Z.FORCE_COLOR.length===0?1:Math.min(parseInt(Z.FORCE_COLOR,10),3));function er(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function tr(e,t){if(Re===0)return 0;if(fe("color=16m")||fe("color=full")||fe("color=truecolor"))return 3;if(fe("color=256"))return 2;if(e&&!t&&Re===void 0)return 0;let r=Re||0;if(Z.TERM==="dumb")return r;if(process.platform==="win32"){let n=Cs.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Z)||Z.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Z.TEAMCITY_VERSION)?1:0;if(Z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Z){let n=parseInt((Z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Z.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Z.TERM)||"COLORTERM"in Z?1:r}function Rs(e){let t=tr(e,e&&e.isTTY);return er(t)}pn.exports={supportsColor:Rs,stdout:er(tr(!0,dn.isatty(1))),stderr:er(tr(!0,dn.isatty(2)))}});var bn=F((Ya,yn)=>{"use strict";f();var Bs=mn(),ze=Xr();function gn(e){if(/^\d{3,4}$/.test(e)){let r=/(\d{1,2})(\d{2})/.exec(e);return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let t=(e||"").split(".").map(r=>parseInt(r,10));return{major:t[0],minor:t[1],patch:t[2]}}function rr(e){let{env:t}=process;if("FORCE_HYPERLINK"in t)return!(t.FORCE_HYPERLINK.length>0&&parseInt(t.FORCE_HYPERLINK,10)===0);if(ze("no-hyperlink")||ze("no-hyperlinks")||ze("hyperlink=false")||ze("hyperlink=never"))return!1;if(ze("hyperlink=true")||ze("hyperlink=always")||"NETLIFY"in t)return!0;if(!Bs.supportsColor(e)||e&&!e.isTTY||process.platform==="win32"||"CI"in t||"TEAMCITY_VERSION"in t)return!1;if("TERM_PROGRAM"in t){let r=gn(t.TERM_PROGRAM_VERSION);switch(t.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 t){if(t.VTE_VERSION==="0.50.0")return!1;let r=gn(t.VTE_VERSION);return r.major>0||r.minor>=50}return!1}yn.exports={supportsHyperlink:rr,stdout:rr(process.stdout),stderr:rr(process.stderr)}});var kn=F((ar,lr)=>{f();(function(e,t){typeof ar=="object"&&typeof lr<"u"?lr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(ar,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",s="minute",o="hour",c="day",a="week",u="month",h="quarter",p="year",d="date",l="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,O={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:function(S){var w=["th","st","nd","rd"],x=S%100;return"["+S+(w[(x-20)%10]||w[x]||w[0])+"]"}},R=function(S,w,x){var y=String(S);return!y||y.length>=w?S:""+Array(w+1-y.length).join(x)+S},P={s:R,z:function(S){var w=-S.utcOffset(),x=Math.abs(w),y=Math.floor(x/60),g=x%60;return(w<=0?"+":"-")+R(y,2,"0")+":"+R(g,2,"0")},m:function S(w,x){if(w.date()<x.date())return-S(x,w);var y=12*(x.year()-w.year())+(x.month()-w.month()),g=w.clone().add(y,u),b=x-g<0,_=w.clone().add(y+(b?-1:1),u);return+(-(y+(x-g)/(b?g-_:_-g))||0)},a:function(S){return S<0?Math.ceil(S)||0:Math.floor(S)},p:function(S){return{M:u,y:p,w:a,d:c,D:d,h:o,m:s,s:i,ms:n,Q:h}[S]||String(S||"").toLowerCase().replace(/s$/,"")},u:function(S){return S===void 0}},Y="en",L={};L[Y]=O;var z="$isDayjsObject",J=function(S){return S instanceof te||!(!S||!S[z])},V=function S(w,x,y){var g;if(!w)return Y;if(typeof w=="string"){var b=w.toLowerCase();L[b]&&(g=b),x&&(L[b]=x,g=b);var _=w.split("-");if(!g&&_.length>1)return S(_[0])}else{var E=w.name;L[E]=w,g=E}return!y&&g&&(Y=g),g||!y&&Y},A=function(S,w){if(J(S))return S.clone();var x=typeof w=="object"?w:{};return x.date=S,x.args=arguments,new te(x)},k=P;k.l=V,k.i=J,k.w=function(S,w){return A(S,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var te=function(){function S(x){this.$L=V(x.locale,null,!0),this.parse(x),this.$x=this.$x||x.x||{},this[z]=!0}var w=S.prototype;return w.parse=function(x){this.$d=function(y){var g=y.date,b=y.utc;if(g===null)return new Date(NaN);if(k.u(g))return new Date;if(g instanceof Date)return new Date(g);if(typeof g=="string"&&!/Z$/i.test(g)){var _=g.match(m);if(_){var E=_[2]-1||0,B=(_[7]||"0").substring(0,3);return b?new Date(Date.UTC(_[1],E,_[3]||1,_[4]||0,_[5]||0,_[6]||0,B)):new Date(_[1],E,_[3]||1,_[4]||0,_[5]||0,_[6]||0,B)}}return new Date(g)}(x),this.init()},w.init=function(){var x=this.$d;this.$y=x.getFullYear(),this.$M=x.getMonth(),this.$D=x.getDate(),this.$W=x.getDay(),this.$H=x.getHours(),this.$m=x.getMinutes(),this.$s=x.getSeconds(),this.$ms=x.getMilliseconds()},w.$utils=function(){return k},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function(x,y){var g=A(x);return this.startOf(y)<=g&&g<=this.endOf(y)},w.isAfter=function(x,y){return A(x)<this.startOf(y)},w.isBefore=function(x,y){return this.endOf(y)<A(x)},w.$g=function(x,y,g){return k.u(x)?this[y]:this.set(g,x)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(x,y){var g=this,b=!!k.u(y)||y,_=k.p(x),E=function(U,re){var _e=k.w(g.$u?Date.UTC(g.$y,re,U):new Date(g.$y,re,U),g);return b?_e:_e.endOf(c)},B=function(U,re){return k.w(g.toDate()[U].apply(g.toDate("s"),(b?[0,0,0,0]:[23,59,59,999]).slice(re)),g)},T=this.$W,M=this.$M,K=this.$D,pe="set"+(this.$u?"UTC":"");switch(_){case p:return b?E(1,0):E(31,11);case u:return b?E(1,M):E(0,M+1);case a:var se=this.$locale().weekStart||0,H=(T<se?T+7:T)-se;return E(b?K-H:K+(6-H),M);case c:case d:return B(pe+"Hours",0);case o:return B(pe+"Minutes",1);case s:return B(pe+"Seconds",2);case i:return B(pe+"Milliseconds",3);default:return this.clone()}},w.endOf=function(x){return this.startOf(x,!1)},w.$set=function(x,y){var g,b=k.p(x),_="set"+(this.$u?"UTC":""),E=(g={},g[c]=_+"Date",g[d]=_+"Date",g[u]=_+"Month",g[p]=_+"FullYear",g[o]=_+"Hours",g[s]=_+"Minutes",g[i]=_+"Seconds",g[n]=_+"Milliseconds",g)[b],B=b===c?this.$D+(y-this.$W):y;if(b===u||b===p){var T=this.clone().set(d,1);T.$d[E](B),T.init(),this.$d=T.set(d,Math.min(this.$D,T.daysInMonth())).$d}else E&&this.$d[E](B);return this.init(),this},w.set=function(x,y){return this.clone().$set(x,y)},w.get=function(x){return this[k.p(x)]()},w.add=function(x,y){var g,b=this;x=Number(x);var _=k.p(y),E=function(M){var K=A(b);return k.w(K.date(K.date()+Math.round(M*x)),b)};if(_===u)return this.set(u,this.$M+x);if(_===p)return this.set(p,this.$y+x);if(_===c)return E(1);if(_===a)return E(7);var B=(g={},g[s]=t,g[o]=r,g[i]=e,g)[_]||1,T=this.$d.getTime()+x*B;return k.w(T,this)},w.subtract=function(x,y){return this.add(-1*x,y)},w.format=function(x){var y=this,g=this.$locale();if(!this.isValid())return g.invalidDate||l;var b=x||"YYYY-MM-DDTHH:mm:ssZ",_=k.z(this),E=this.$H,B=this.$m,T=this.$M,M=g.weekdays,K=g.months,pe=g.meridiem,se=function(re,_e,nt,Et){return re&&(re[_e]||re(y,b))||nt[_e].slice(0,Et)},H=function(re){return k.s(E%12||12,re,"0")},U=pe||function(re,_e,nt){var Et=re<12?"AM":"PM";return nt?Et.toLowerCase():Et};return b.replace(v,function(re,_e){return _e||function(nt){switch(nt){case"YY":return String(y.$y).slice(-2);case"YYYY":return k.s(y.$y,4,"0");case"M":return T+1;case"MM":return k.s(T+1,2,"0");case"MMM":return se(g.monthsShort,T,K,3);case"MMMM":return se(K,T);case"D":return y.$D;case"DD":return k.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return se(g.weekdaysMin,y.$W,M,2);case"ddd":return se(g.weekdaysShort,y.$W,M,3);case"dddd":return M[y.$W];case"H":return String(E);case"HH":return k.s(E,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return U(E,B,!0);case"A":return U(E,B,!1);case"m":return String(B);case"mm":return k.s(B,2,"0");case"s":return String(y.$s);case"ss":return k.s(y.$s,2,"0");case"SSS":return k.s(y.$ms,3,"0");case"Z":return _}return null}(re)||_.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(x,y,g){var b,_=this,E=k.p(y),B=A(x),T=(B.utcOffset()-this.utcOffset())*t,M=this-B,K=function(){return k.m(_,B)};switch(E){case p:b=K()/12;break;case u:b=K();break;case h:b=K()/3;break;case a:b=(M-T)/6048e5;break;case c:b=(M-T)/864e5;break;case o:b=M/r;break;case s:b=M/t;break;case i:b=M/e;break;default:b=M}return g?b:k.a(b)},w.daysInMonth=function(){return this.endOf(u).$D},w.$locale=function(){return L[this.$L]},w.locale=function(x,y){if(!x)return this.$L;var g=this.clone(),b=V(x,y,!0);return b&&(g.$L=b),g},w.clone=function(){return k.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},S}(),rt=te.prototype;return A.prototype=rt,[["$ms",n],["$s",i],["$m",s],["$H",o],["$W",c],["$M",u],["$y",p],["$D",d]].forEach(function(S){rt[S[1]]=function(w){return this.$g(w,S[0],S[1])}}),A.extend=function(S,w){return S.$i||(S(w,te,A),S.$i=!0),A},A.locale=V,A.isDayjs=J,A.unix=function(S){return A(1e3*S)},A.en=L[Y],A.Ls=L,A.p={},A})});var Rn=F(He=>{"use strict";f();He.__esModule=!0;He.distance=He.closest=void 0;var Ee=new Uint32Array(65536),Ms=function(e,t){for(var r=e.length,n=t.length,i=1<<r-1,s=-1,o=0,c=r,a=r;a--;)Ee[e.charCodeAt(a)]|=1<<a;for(a=0;a<n;a++){var u=Ee[t.charCodeAt(a)],h=u|o;u|=(u&s)+s^s,o|=~(u|s),s&=u,o&i&&c++,s&i&&c--,o=o<<1|1,s=s<<1|~(h|o),o&=h}for(a=r;a--;)Ee[e.charCodeAt(a)]=0;return c},Us=function(e,t){for(var r=t.length,n=e.length,i=[],s=[],o=Math.ceil(r/32),c=Math.ceil(n/32),a=0;a<o;a++)s[a]=-1,i[a]=0;for(var u=0;u<c-1;u++){for(var h=0,p=-1,d=u*32,l=Math.min(32,n)+d,m=d;m<l;m++)Ee[e.charCodeAt(m)]|=1<<m;for(var a=0;a<r;a++){var v=Ee[t.charCodeAt(a)],O=s[a/32|0]>>>a&1,R=i[a/32|0]>>>a&1,P=v|h,Y=((v|R)&p)+p^p|v|R,L=h|~(Y|p),z=p&Y;L>>>31^O&&(s[a/32|0]^=1<<a),z>>>31^R&&(i[a/32|0]^=1<<a),L=L<<1|O,z=z<<1|R,p=z|~(P|L),h=L&P}for(var m=d;m<l;m++)Ee[e.charCodeAt(m)]=0}for(var J=0,V=-1,A=u*32,k=Math.min(32,n-A)+A,m=A;m<k;m++)Ee[e.charCodeAt(m)]|=1<<m;for(var te=n,a=0;a<r;a++){var v=Ee[t.charCodeAt(a)],O=s[a/32|0]>>>a&1,R=i[a/32|0]>>>a&1,P=v|J,Y=((v|R)&V)+V^V|v|R,L=J|~(Y|V),z=V&Y;te+=L>>>n-1&1,te-=z>>>n-1&1,L>>>31^O&&(s[a/32|0]^=1<<a),z>>>31^R&&(i[a/32|0]^=1<<a),L=L<<1|O,z=z<<1|R,V=z|~(P|L),J=L&P}for(var m=A;m<k;m++)Ee[e.charCodeAt(m)]=0;return te},Cn=function(e,t){if(e.length<t.length){var r=t;t=e,e=r}return t.length===0?e.length:e.length<=32?Ms(e,t):Us(e,t)};He.distance=Cn;var Fs=function(e,t){for(var r=1/0,n=0,i=0;i<t.length;i++){var s=Cn(e,t[i]);s<r&&(r=s,n=i)}return t[n]};He.closest=Fs});var Bn=F((cr,ot)=>{f();(function(){"use strict";var e;try{e=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 t=Rn(),r=[],n=[],i={get:function(s,o,c){var a=c&&e&&c.useCollator;if(a){var u=s.length,h=o.length;if(u===0)return h;if(h===0)return u;var p,d,l,m,v;for(l=0;l<h;++l)r[l]=l,n[l]=o.charCodeAt(l);r[h]=h;var O;for(l=0;l<u;++l){for(d=l+1,m=0;m<h;++m)p=d,O=e.compare(s.charAt(l),String.fromCharCode(n[m]))===0,d=r[m]+(O?0:1),v=p+1,d>v&&(d=v),v=r[m+1]+1,d>v&&(d=v),r[m]=p;r[m]=d}return d}return t.distance(s,o)}};typeof define<"u"&&define!==null&&define.amd?define(function(){return i}):typeof ot<"u"&&ot!==null&&typeof cr<"u"&&ot.exports===cr?ot.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 $n=F((fr,hr)=>{f();(function(e,t){typeof G=="function"&&typeof fr=="object"&&typeof hr=="object"?hr.exports=t():typeof define=="function"&&define.amd?define(function(){return t()}):e.pluralize=t()})(fr,function(){var e=[],t=[],r={},n={},i={};function s(l){return typeof l=="string"?new RegExp("^"+l+"$","i"):l}function o(l,m){return l===m?m:l===l.toLowerCase()?m.toLowerCase():l===l.toUpperCase()?m.toUpperCase():l[0]===l[0].toUpperCase()?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m.toLowerCase()}function c(l,m){return l.replace(/\$(\d{1,2})/g,function(v,O){return m[O]||""})}function a(l,m){return l.replace(m[0],function(v,O){var R=c(m[1],arguments);return o(v===""?l[O-1]:v,R)})}function u(l,m,v){if(!l.length||r.hasOwnProperty(l))return m;for(var O=v.length;O--;){var R=v[O];if(R[0].test(m))return a(m,R)}return m}function h(l,m,v){return function(O){var R=O.toLowerCase();return m.hasOwnProperty(R)?o(O,R):l.hasOwnProperty(R)?o(O,l[R]):u(R,O,v)}}function p(l,m,v,O){return function(R){var P=R.toLowerCase();return m.hasOwnProperty(P)?!0:l.hasOwnProperty(P)?!1:u(P,P,v)===P}}function d(l,m,v){var O=m===1?d.singular(l):d.plural(l);return(v?m+" ":"")+O}return d.plural=h(i,n,e),d.isPlural=p(i,n,e),d.singular=h(n,i,t),d.isSingular=p(n,i,t),d.addPluralRule=function(l,m){e.push([s(l),m])},d.addSingularRule=function(l,m){t.push([s(l),m])},d.addUncountableRule=function(l){if(typeof l=="string"){r[l.toLowerCase()]=!0;return}d.addPluralRule(l,"$0"),d.addSingularRule(l,"$0")},d.addIrregularRule=function(l,m){m=m.toLowerCase(),l=l.toLowerCase(),i[l]=m,n[m]=l},[["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(l){return d.addIrregularRule(l[0],l[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(l){return d.addPluralRule(l[0],l[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(l){return d.addSingularRule(l[0],l[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(d.addUncountableRule),d})});var Gn=F((fc,qn)=>{"use strict";f();var Un=12,zs=0,pr=[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 Hs(e){var t=e.indexOf("%");if(t===-1)return e;for(var r=e.length,n="",i=0,s=0,o=t,c=Un;t>-1&&t<r;){var a=Fn(e[t+1],4),u=Fn(e[t+2],0),h=a|u,p=pr[h];if(c=pr[256+c+p],s=s<<6|h&pr[364+p],c===Un)n+=e.slice(i,o),n+=s<=65535?String.fromCharCode(s):String.fromCharCode(55232+(s>>10),56320+(s&1023)),s=0,i=t+3,t=o=e.indexOf("%",i);else{if(c===zs)return null;if(t+=3,t<r&&e.charCodeAt(t)===37)continue;return null}}return n+e.slice(i)}var Qs={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 Fn(e,t){var r=Qs[e];return r===void 0?255:r<<t}qn.exports=Hs});var Hn=F((dc,zn)=>{"use strict";f();var jn=Gn(),Wn=/\+/g,Vn=function(){};Vn.prototype=Object.create(null);function Ys(e){let t=new Vn;if(typeof e!="string")return t;let r=e.length,n="",i="",s=-1,o=-1,c=!1,a=!1,u=!1,h=!1,p=!1,d=0;for(let l=0;l<r+1;l++)if(d=l!==r?e.charCodeAt(l):38,d===38){if(p=o>s,p||(o=l),n=e.slice(s+1,o),p||n.length>0){u&&(n=n.replace(Wn," ")),c&&(n=jn(n)||n),p&&(i=e.slice(o+1,l),h&&(i=i.replace(Wn," ")),a&&(i=jn(i)||i));let m=t[n];m===void 0?t[n]=i:m.pop?m.push(i):t[n]=[m,i]}i="",s=l,o=l,c=!1,a=!1,u=!1,h=!1}else d===61?o<=s?o=l:a=!0:d===43?o>s?h=!0:u=!0:d===37&&(o>s?a=!0:c=!0);return t}zn.exports=Ys});var Yn=F((mc,Qn)=>{f();var we=Array.from({length:256},(e,t)=>"%"+((t<16?"0":"")+t.toString(16)).toUpperCase()),Js=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 Ks(e){let t=e.length;if(t===0)return"";let r="",n=0,i=0;e:for(;i<t;i++){let s=e.charCodeAt(i);for(;s<128;){if(Js[s]!==1&&(n<i&&(r+=e.slice(n,i)),n=i+1,r+=we[s]),++i===t)break e;s=e.charCodeAt(i)}if(n<i&&(r+=e.slice(n,i)),s<2048){n=i+1,r+=we[192|s>>6]+we[128|s&63];continue}if(s<55296||s>=57344){n=i+1,r+=we[224|s>>12]+we[128|s>>6&63]+we[128|s&63];continue}if(++i,i>=t)throw new Error("URI malformed");let o=e.charCodeAt(i)&1023;n=i+1,s=65536+((s&1023)<<10|o),r+=we[240|s>>18]+we[128|s>>12&63]+we[128|s>>6&63]+we[128|s&63]}return n===0?e:n<t?r+e.slice(n):r}Qn.exports={encodeString:Ks}});var Zn=F((yc,Kn)=>{"use strict";f();var{encodeString:mr}=Yn();function Jn(e){let t=typeof e;return t==="string"?mr(e):t==="bigint"?e.toString():t==="boolean"?e?"true":"false":t==="number"&&Number.isFinite(e)?e<1e21?""+e:mr(""+e):""}function Zs(e){let t="";if(e===null||typeof e!="object")return t;let r="&",n=Object.keys(e),i=n.length,s=0;for(let o=0;o<i;o++){let c=n[o],a=e[c],u=mr(c)+"=";if(o&&(t+=r),Array.isArray(a)){s=a.length;for(let h=0;h<s;h++)h&&(t+=r),t+=u,t+=Jn(a[h])}else t+=u,t+=Jn(a)}return t}Kn.exports=Zs});var ri=F((_c,lt)=>{"use strict";f();var Xn=Hn(),ei=Zn(),ti={parse:Xn,stringify:ei};lt.exports=ti;lt.exports.default=ti;lt.exports.parse=Xn;lt.exports.stringify=ei});var bi=F((Pu,Er)=>{"use strict";f();var yo=Object.prototype.hasOwnProperty,ie="~";function ct(){}Object.create&&(ct.prototype=Object.create(null),new ct().__proto__||(ie=!1));function bo(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function yi(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new bo(r,n||e,i),o=ie?ie+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],s]:e._events[o].push(s):(e._events[o]=s,e._eventsCount++),e}function Dt(e,t){--e._eventsCount===0?e._events=new ct:delete e._events[t]}function ee(){this._events=new ct,this._eventsCount=0}ee.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)yo.call(r,n)&&t.push(ie?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};ee.prototype.listeners=function(t){var r=ie?ie+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};ee.prototype.listenerCount=function(t){var r=ie?ie+t:t,n=this._events[r];return n?n.fn?1:n.length:0};ee.prototype.emit=function(t,r,n,i,s,o){var c=ie?ie+t:t;if(!this._events[c])return!1;var a=this._events[c],u=arguments.length,h,p;if(a.fn){switch(a.once&&this.removeListener(t,a.fn,void 0,!0),u){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,r),!0;case 3:return a.fn.call(a.context,r,n),!0;case 4:return a.fn.call(a.context,r,n,i),!0;case 5:return a.fn.call(a.context,r,n,i,s),!0;case 6:return a.fn.call(a.context,r,n,i,s,o),!0}for(p=1,h=new Array(u-1);p<u;p++)h[p-1]=arguments[p];a.fn.apply(a.context,h)}else{var d=a.length,l;for(p=0;p<d;p++)switch(a[p].once&&this.removeListener(t,a[p].fn,void 0,!0),u){case 1:a[p].fn.call(a[p].context);break;case 2:a[p].fn.call(a[p].context,r);break;case 3:a[p].fn.call(a[p].context,r,n);break;case 4:a[p].fn.call(a[p].context,r,n,i);break;default:if(!h)for(l=1,h=new Array(u-1);l<u;l++)h[l-1]=arguments[l];a[p].fn.apply(a[p].context,h)}}return!0};ee.prototype.on=function(t,r,n){return yi(this,t,r,n,!1)};ee.prototype.once=function(t,r,n){return yi(this,t,r,n,!0)};ee.prototype.removeListener=function(t,r,n,i){var s=ie?ie+t:t;if(!this._events[s])return this;if(!r)return Dt(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&Dt(this,s);else{for(var c=0,a=[],u=o.length;c<u;c++)(o[c].fn!==r||i&&!o[c].once||n&&o[c].context!==n)&&a.push(o[c]);a.length?this._events[s]=a.length===1?a[0]:a:Dt(this,s)}return this};ee.prototype.removeAllListeners=function(t){var r;return t?(r=ie?ie+t:t,this._events[r]&&Dt(this,r)):(this._events=new ct,this._eventsCount=0),this};ee.prototype.off=ee.prototype.removeListener;ee.prototype.addListener=ee.prototype.on;ee.prefixed=ie;ee.EventEmitter=ee;typeof Er<"u"&&(Er.exports=ee)});var Si=F((Xu,Ei)=>{"use strict";f();var{Duplex:_o}=G("stream");function wi(e){e.emit("close")}function xo(){!this.destroyed&&this._writableState.finished&&this.destroy()}function vi(e){this.removeListener("error",vi),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function wo(e,t){let r=!0,n=new _o({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(s,o){let c=!o&&n._readableState.objectMode?s.toString():s;n.push(c)||e.pause()}),e.once("error",function(s){n.destroyed||(r=!1,n.destroy(s))}),e.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(i,s){if(e.readyState===e.CLOSED){s(i),process.nextTick(wi,n);return}let o=!1;e.once("error",function(a){o=!0,s(a)}),e.once("close",function(){o||s(i),process.nextTick(wi,n)}),r&&e.terminate()},n._final=function(i){if(e.readyState===e.CONNECTING){e.once("open",function(){n._final(i)});return}e._socket!==null&&(e._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",function(){i()}),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(i,s,o){if(e.readyState===e.CONNECTING){e.once("open",function(){n._write(i,s,o)});return}e.send(i,o)},n.on("end",xo),n.on("error",vi),n}Ei.exports=wo});var Oe=F((tf,Li)=>{"use strict";f();var Ti=["nodebuffer","arraybuffer","fragments"],Oi=typeof Blob<"u";Oi&&Ti.push("blob");Li.exports={BINARY_TYPES:Ti,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Oi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var dt=F((nf,$t)=>{"use strict";f();var{EMPTY_BUFFER:vo}=Oe(),kr=Buffer[Symbol.species];function Eo(e,t){if(e.length===0)return vo;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let i=0;i<e.length;i++){let s=e[i];r.set(s,n),n+=s.length}return n<t?new kr(r.buffer,r.byteOffset,n):r}function ki(e,t,r,n,i){for(let s=0;s<i;s++)r[n+s]=e[s]^t[s&3]}function Ci(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function So(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function Cr(e){if(Cr.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new kr(e):ArrayBuffer.isView(e)?t=new kr(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Cr.readOnly=!1),t}$t.exports={concat:Eo,mask:ki,toArrayBuffer:So,toBuffer:Cr,unmask:Ci};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=G("bufferutil");$t.exports.mask=function(t,r,n,i,s){s<48?ki(t,r,n,i,s):e.mask(t,r,n,i,s)},$t.exports.unmask=function(t,r){t.length<32?Ci(t,r):e.unmask(t,r)}}catch{}});var Di=F((of,Bi)=>{"use strict";f();var Ri=Symbol("kDone"),Rr=Symbol("kRun"),Br=class{constructor(t){this[Ri]=()=>{this.pending--,this[Rr]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Rr]()}[Rr](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[Ri])}}};Bi.exports=Br});var gt=F((lf,Ii)=>{"use strict";f();var pt=G("zlib"),$i=dt(),To=Di(),{kStatusCode:Ai}=Oe(),Oo=Buffer[Symbol.species],Lo=Buffer.from([0,0,255,255]),It=Symbol("permessage-deflate"),Le=Symbol("total-length"),mt=Symbol("callback"),Ae=Symbol("buffers"),Nt=Symbol("error"),At,Dr=class{constructor(t,r,n){if(this._maxPayload=n|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!At){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;At=new To(i)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[mt];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.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(t){let r=t[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(t){return t.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})}),t}decompress(t,r,n){At.add(i=>{this._decompress(t,r,(s,o)=>{i(),n(s,o)})})}compress(t,r,n){At.add(i=>{this._compress(t,r,(s,o)=>{i(),n(s,o)})})}_decompress(t,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let s=`${i}_max_window_bits`,o=typeof this.params[s]!="number"?pt.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=pt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[It]=this,this._inflate[Le]=0,this._inflate[Ae]=[],this._inflate.on("error",Co),this._inflate.on("data",Ni)}this._inflate[mt]=n,this._inflate.write(t),r&&this._inflate.write(Lo),this._inflate.flush(()=>{let s=this._inflate[Nt];if(s){this._inflate.close(),this._inflate=null,n(s);return}let o=$i.concat(this._inflate[Ae],this._inflate[Le]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Le]=0,this._inflate[Ae]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,o)})}_compress(t,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let s=`${i}_max_window_bits`,o=typeof this.params[s]!="number"?pt.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=pt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[Le]=0,this._deflate[Ae]=[],this._deflate.on("data",ko)}this._deflate[mt]=n,this._deflate.write(t),this._deflate.flush(pt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=$i.concat(this._deflate[Ae],this._deflate[Le]);r&&(s=new Oo(s.buffer,s.byteOffset,s.length-4)),this._deflate[mt]=null,this._deflate[Le]=0,this._deflate[Ae]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};Ii.exports=Dr;function ko(e){this[Ae].push(e),this[Le]+=e.length}function Ni(e){if(this[Le]+=e.length,this[It]._maxPayload<1||this[Le]<=this[It]._maxPayload){this[Ae].push(e);return}this[Nt]=new RangeError("Max payload size exceeded"),this[Nt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Nt][Ai]=1009,this.removeListener("data",Ni),this.reset()}function Co(e){this[It]._inflate=null,e[Ai]=1007,this[mt](e)}});var Ke=F((uf,Pt)=>{"use strict";f();var{isUtf8:Pi}=G("buffer"),{hasBlob:Ro}=Oe(),Bo=[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 Do(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function $r(e){let t=e.length,r=0;for(;r<t;)if(!(e[r]&128))r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function $o(e){return Ro&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Pt.exports={isBlob:$o,isValidStatusCode:Do,isValidUTF8:$r,tokenChars:Bo};if(Pi)Pt.exports.isValidUTF8=function(e){return e.length<24?$r(e):Pi(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=G("utf-8-validate");Pt.exports.isValidUTF8=function(t){return t.length<32?$r(t):e(t)}}catch{}});var Mr=F((hf,Wi)=>{"use strict";f();var{Writable:Ao}=G("stream"),Mi=gt(),{BINARY_TYPES:No,EMPTY_BUFFER:Ui,kStatusCode:Io,kWebSocket:Po}=Oe(),{concat:Ar,toArrayBuffer:Mo,unmask:Uo}=dt(),{isValidStatusCode:Fo,isValidUTF8:Fi}=Ke(),Mt=Buffer[Symbol.species],he=0,qi=1,Gi=2,ji=3,Nr=4,Ir=5,Ut=6,Pr=class extends Ao{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||No[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[Po]=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=he}_write(t,r,n){if(this._opcode===8&&this._state==he)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Mt(n.buffer,n.byteOffset+t,n.length-t),new Mt(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],i=r.length-t;t>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),i),this._buffers[0]=new Mt(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case he:this.getInfo(t);break;case qi:this.getPayloadLength16(t);break;case Gi:this.getPayloadLength64(t);break;case ji:this.getMask();break;case Nr:this.getData(t);break;case Ir:case Ut:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){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");t(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[Mi.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(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");t(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(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");t(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");t(i);return}if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(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");t(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(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");t(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(i);return}this._payloadLength===126?this._state=qi:this._payloadLength===127?this._state=Gi:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){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");t(i);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){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");t(r);return}this._masked?this._state=ji:this._state=Nr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Nr}getData(t){let r=Ui;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]&&Uo(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._compressed){this._state=Ir,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[Mi.extensionName].decompress(t,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 o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(o);return}this._fragments.push(s)}this.dataMessage(r),this._state===he&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=he;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=Ar(n,r):this._binaryType==="arraybuffer"?i=Mo(Ar(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=he):(this._state=Ut,setImmediate(()=>{this.emit("message",i,!0),this._state=he,this.startLoop(t)}))}else{let i=Ar(n,r);if(!this._skipUTF8Validation&&!Fi(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(s);return}this._state===Ir||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=he):(this._state=Ut,setImmediate(()=>{this.emit("message",i,!1),this._state=he,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,Ui),this.end();else{let n=t.readUInt16BE(0);if(!Fo(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let i=new Mt(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!Fi(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=he;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=he):(this._state=Ut,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=he,this.startLoop(r)}))}createError(t,r,n,i,s){this._loop=!1,this._errored=!0;let o=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(o,this.createError),o.code=s,o[Io]=i,o}};Wi.exports=Pr});var qr=F((mf,Hi)=>{"use strict";f();var{Duplex:pf}=G("stream"),{randomFillSync:qo}=G("crypto"),Vi=gt(),{EMPTY_BUFFER:Go,kWebSocket:jo,NOOP:Wo}=Oe(),{isBlob:Ze,isValidStatusCode:Vo}=Ke(),{mask:zi,toBuffer:Me}=dt(),de=Symbol("kByteLength"),zo=Buffer.alloc(4),Ft=8*1024,Ue,Xe=Ft,be=0,Ho=1,Qo=2,Ur=class e{constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=be,this.onerror=Wo,this[jo]=void 0}static frame(t,r){let n,i=!1,s=2,o=!1;r.mask&&(n=r.maskBuffer||zo,r.generateMask?r.generateMask(n):(Xe===Ft&&(Ue===void 0&&(Ue=Buffer.alloc(Ft)),qo(Ue,0,Ft),Xe=0),n[0]=Ue[Xe++],n[1]=Ue[Xe++],n[2]=Ue[Xe++],n[3]=Ue[Xe++]),o=(n[0]|n[1]|n[2]|n[3])===0,s=6);let c;typeof t=="string"?(!r.mask||o)&&r[de]!==void 0?c=r[de]:(t=Buffer.from(t),c=t.length):(c=t.length,i=r.mask&&r.readOnly&&!o);let a=c;c>=65536?(s+=8,a=127):c>125&&(s+=2,a=126);let u=Buffer.allocUnsafe(i?c+s:s);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=a,a===126?u.writeUInt16BE(c,2):a===127&&(u[2]=u[3]=0,u.writeUIntBE(c,4,6)),r.mask?(u[1]|=128,u[s-4]=n[0],u[s-3]=n[1],u[s-2]=n[2],u[s-1]=n[3],o?[u,t]:i?(zi(t,n,u,s,c),[u]):(zi(t,n,t,0,c),[u,t])):[u,t]}close(t,r,n,i){let s;if(t===void 0)s=Go;else{if(typeof t!="number"||!Vo(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+c),s.writeUInt16BE(t,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let o={[de]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==be?this.enqueue([this.dispatch,s,!1,o,i]):this.sendFrame(e.frame(s,o),i)}ping(t,r,n){let i,s;if(typeof t=="string"?(i=Buffer.byteLength(t),s=!1):Ze(t)?(i=t.size,s=!1):(t=Me(t),i=t.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[de]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Ze(t)?this._state!==be?this.enqueue([this.getBlobData,t,!1,o,n]):this.getBlobData(t,!1,o,n):this._state!==be?this.enqueue([this.dispatch,t,!1,o,n]):this.sendFrame(e.frame(t,o),n)}pong(t,r,n){let i,s;if(typeof t=="string"?(i=Buffer.byteLength(t),s=!1):Ze(t)?(i=t.size,s=!1):(t=Me(t),i=t.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[de]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Ze(t)?this._state!==be?this.enqueue([this.getBlobData,t,!1,o,n]):this.getBlobData(t,!1,o,n):this._state!==be?this.enqueue([this.dispatch,t,!1,o,n]):this.sendFrame(e.frame(t,o),n)}send(t,r,n){let i=this._extensions[Vi.extensionName],s=r.binary?2:1,o=r.compress,c,a;typeof t=="string"?(c=Buffer.byteLength(t),a=!1):Ze(t)?(c=t.size,a=!1):(t=Me(t),c=t.length,a=Me.readOnly),this._firstFragment?(this._firstFragment=!1,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=c>=i._threshold),this._compress=o):(o=!1,s=0),r.fin&&(this._firstFragment=!0);let u={[de]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:a,rsv1:o};Ze(t)?this._state!==be?this.enqueue([this.getBlobData,t,this._compress,u,n]):this.getBlobData(t,this._compress,u,n):this._state!==be?this.enqueue([this.dispatch,t,this._compress,u,n]):this.dispatch(t,this._compress,u,n)}getBlobData(t,r,n,i){this._bufferedBytes+=n[de],this._state=Qo,t.arrayBuffer().then(s=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(Fr,this,c,i);return}this._bufferedBytes-=n[de];let o=Me(s);r?this.dispatch(o,r,n,i):(this._state=be,this.sendFrame(e.frame(o,n),i),this.dequeue())}).catch(s=>{process.nextTick(Yo,this,s,i)})}dispatch(t,r,n,i){if(!r){this.sendFrame(e.frame(t,n),i);return}let s=this._extensions[Vi.extensionName];this._bufferedBytes+=n[de],this._state=Ho,s.compress(t,n.fin,(o,c)=>{if(this._socket.destroyed){let a=new Error("The socket was closed while data was being compressed");Fr(this,a,i);return}this._bufferedBytes-=n[de],this._state=be,n.readOnly=!1,this.sendFrame(e.frame(c,n),i),this.dequeue()})}dequeue(){for(;this._state===be&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][de],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][de],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};Hi.exports=Ur;function Fr(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let i=e._queue[n],s=i[i.length-1];typeof s=="function"&&s(t)}}function Yo(e,t,r){Fr(e,t,r),e.onerror(t)}});var rs=F((yf,ts)=>{"use strict";f();var{kForOnEventAttribute:yt,kListener:Gr}=Oe(),Qi=Symbol("kCode"),Yi=Symbol("kData"),Ji=Symbol("kError"),Ki=Symbol("kMessage"),Zi=Symbol("kReason"),et=Symbol("kTarget"),Xi=Symbol("kType"),es=Symbol("kWasClean"),ke=class{constructor(t){this[et]=null,this[Xi]=t}get target(){return this[et]}get type(){return this[Xi]}};Object.defineProperty(ke.prototype,"target",{enumerable:!0});Object.defineProperty(ke.prototype,"type",{enumerable:!0});var Fe=class extends ke{constructor(t,r={}){super(t),this[Qi]=r.code===void 0?0:r.code,this[Zi]=r.reason===void 0?"":r.reason,this[es]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Qi]}get reason(){return this[Zi]}get wasClean(){return this[es]}};Object.defineProperty(Fe.prototype,"code",{enumerable:!0});Object.defineProperty(Fe.prototype,"reason",{enumerable:!0});Object.defineProperty(Fe.prototype,"wasClean",{enumerable:!0});var tt=class extends ke{constructor(t,r={}){super(t),this[Ji]=r.error===void 0?null:r.error,this[Ki]=r.message===void 0?"":r.message}get error(){return this[Ji]}get message(){return this[Ki]}};Object.defineProperty(tt.prototype,"error",{enumerable:!0});Object.defineProperty(tt.prototype,"message",{enumerable:!0});var bt=class extends ke{constructor(t,r={}){super(t),this[Yi]=r.data===void 0?null:r.data}get data(){return this[Yi]}};Object.defineProperty(bt.prototype,"data",{enumerable:!0});var Jo={addEventListener(e,t,r={}){for(let i of this.listeners(e))if(!r[yt]&&i[Gr]===t&&!i[yt])return;let n;if(e==="message")n=function(s,o){let c=new bt("message",{data:o?s:s.toString()});c[et]=this,qt(t,this,c)};else if(e==="close")n=function(s,o){let c=new Fe("close",{code:s,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[et]=this,qt(t,this,c)};else if(e==="error")n=function(s){let o=new tt("error",{error:s,message:s.message});o[et]=this,qt(t,this,o)};else if(e==="open")n=function(){let s=new ke("open");s[et]=this,qt(t,this,s)};else return;n[yt]=!!r[yt],n[Gr]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[Gr]===t&&!r[yt]){this.removeListener(e,r);break}}};ts.exports={CloseEvent:Fe,ErrorEvent:tt,Event:ke,EventTarget:Jo,MessageEvent:bt};function qt(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var jr=F((_f,ns)=>{"use strict";f();var{tokenChars:_t}=Ke();function ve(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function Ko(e){let t=Object.create(null),r=Object.create(null),n=!1,i=!1,s=!1,o,c,a=-1,u=-1,h=-1,p=0;for(;p<e.length;p++)if(u=e.charCodeAt(p),o===void 0)if(h===-1&&_t[u]===1)a===-1&&(a=p);else if(p!==0&&(u===32||u===9))h===-1&&a!==-1&&(h=p);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${p}`);h===-1&&(h=p);let l=e.slice(a,h);u===44?(ve(t,l,r),r=Object.create(null)):o=l,a=h=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(h===-1&&_t[u]===1)a===-1&&(a=p);else if(u===32||u===9)h===-1&&a!==-1&&(h=p);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${p}`);h===-1&&(h=p),ve(r,e.slice(a,h),!0),u===44&&(ve(t,o,r),r=Object.create(null),o=void 0),a=h=-1}else if(u===61&&a!==-1&&h===-1)c=e.slice(a,p),a=h=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(i){if(_t[u]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);a===-1?a=p:n||(n=!0),i=!1}else if(s)if(_t[u]===1)a===-1&&(a=p);else if(u===34&&a!==-1)s=!1,h=p;else if(u===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(u===34&&e.charCodeAt(p-1)===61)s=!0;else if(h===-1&&_t[u]===1)a===-1&&(a=p);else if(a!==-1&&(u===32||u===9))h===-1&&(h=p);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${p}`);h===-1&&(h=p);let l=e.slice(a,h);n&&(l=l.replace(/\\/g,""),n=!1),ve(r,c,l),u===44&&(ve(t,o,r),r=Object.create(null),o=void 0),c=void 0,a=h=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(a===-1||s||u===32||u===9)throw new SyntaxError("Unexpected end of input");h===-1&&(h=p);let d=e.slice(a,h);return o===void 0?ve(t,d,r):(c===void 0?ve(r,d,!0):n?ve(r,c,d.replace(/\\/g,"")):ve(r,c,d),ve(t,o,r)),t}function Zo(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(i=>{let s=n[i];return Array.isArray(s)||(s=[s]),s.map(o=>o===!0?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}ns.exports={format:Zo,parse:Ko}});var Qr=F((Ef,ms)=>{"use strict";f();var Xo=G("events"),ea=G("https"),ta=G("http"),os=G("net"),ra=G("tls"),{randomBytes:na,createHash:ia}=G("crypto"),{Duplex:wf,Readable:vf}=G("stream"),{URL:Wr}=G("url"),Ne=gt(),sa=Mr(),oa=qr(),{isBlob:aa}=Ke(),{BINARY_TYPES:is,EMPTY_BUFFER:Gt,GUID:la,kForOnEventAttribute:Vr,kListener:ca,kStatusCode:ua,kWebSocket:X,NOOP:as}=Oe(),{EventTarget:{addEventListener:fa,removeEventListener:ha}}=rs(),{format:da,parse:pa}=jr(),{toBuffer:ma}=dt(),ga=30*1e3,ls=Symbol("kAborted"),zr=[8,13],Ce=["CONNECTING","OPEN","CLOSING","CLOSED"],ya=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,W=class e extends Xo{constructor(t,r,n){super(),this._binaryType=is[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Gt,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==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]),cs(this,t,r,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){is.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}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(t,r,n){let i=new sa({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new oa(t,this._extensions,n.generateMask);this._receiver=i,this._sender=s,this._socket=t,i[X]=this,s[X]=this,t[X]=this,i.on("conclude",xa),i.on("drain",wa),i.on("error",va),i.on("message",Ea),i.on("ping",Sa),i.on("pong",Ta),s.onerror=Oa,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",hs),t.on("data",Wt),t.on("end",ds),t.on("error",ps),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ne.extensionName]&&this._extensions[Ne.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),fs(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Hr(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||Gt,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Hr(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||Gt,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Hr(this,t,n);return}let i={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Ne.extensionName]||(i.compress=!1),this._sender.send(t||Gt,i,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(W,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(W.prototype,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(W,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(W.prototype,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(W,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(W.prototype,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(W,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});Object.defineProperty(W.prototype,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(W.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(W.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[Vr])return t[ca];return null},set(t){for(let r of this.listeners(e))if(r[Vr]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[Vr]:!0})}})});W.prototype.addEventListener=fa;W.prototype.removeEventListener=ha;ms.exports=W;function cs(e,t,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:zr[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(e._autoPong=i.autoPong,!zr.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${zr.join(", ")})`);let s;if(t instanceof Wr)s=t;else try{s=new Wr(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),e._url=s.href;let o=s.protocol==="wss:",c=s.protocol==="ws+unix:",a;if(s.protocol!=="ws:"&&!o&&!c?a=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:c&&!s.pathname?a="The URL's pathname is empty":s.hash&&(a="The URL contains a fragment identifier"),a){let v=new SyntaxError(a);if(e._redirects===0)throw v;jt(e,v);return}let u=o?443:80,h=na(16).toString("base64"),p=o?ea.request:ta.request,d=new Set,l;if(i.createConnection=i.createConnection||(o?_a:ba),i.defaultPort=i.defaultPort||u,i.port=s.port||u,i.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":h,Connection:"Upgrade",Upgrade:"websocket"},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(l=new Ne(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=da({[Ne.extensionName]:l.offer()})),r.length){for(let v of r){if(typeof v!="string"||!ya.test(v)||d.has(v))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.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}`),c){let v=i.path.split(":");i.socketPath=v[0],i.path=v[1]}let m;if(i.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=o,e._originalHostOrSocketPath=c?i.socketPath:s.host;let v=n&&n.headers;if(n={...n,headers:{}},v)for(let[O,R]of Object.entries(v))n.headers[O.toLowerCase()]=R}else if(e.listenerCount("redirect")===0){let v=c?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!v||e._originalSecure&&!o)&&(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=e._req=p(i),e._redirects&&e.emit("redirect",e.url,m)}else m=e._req=p(i);i.timeout&&m.on("timeout",()=>{ue(e,m,"Opening handshake has timed out")}),m.on("error",v=>{m===null||m[ls]||(m=e._req=null,jt(e,v))}),m.on("response",v=>{let O=v.headers.location,R=v.statusCode;if(O&&i.followRedirects&&R>=300&&R<400){if(++e._redirects>i.maxRedirects){ue(e,m,"Maximum redirects exceeded");return}m.abort();let P;try{P=new Wr(O,t)}catch{let L=new SyntaxError(`Invalid URL: ${O}`);jt(e,L);return}cs(e,P,r,n)}else e.emit("unexpected-response",m,v)||ue(e,m,`Unexpected server response: ${v.statusCode}`)}),m.on("upgrade",(v,O,R)=>{if(e.emit("upgrade",v),e.readyState!==W.CONNECTING)return;m=e._req=null;let P=v.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){ue(e,O,"Invalid Upgrade header");return}let Y=ia("sha1").update(h+la).digest("base64");if(v.headers["sec-websocket-accept"]!==Y){ue(e,O,"Invalid Sec-WebSocket-Accept header");return}let L=v.headers["sec-websocket-protocol"],z;if(L!==void 0?d.size?d.has(L)||(z="Server sent an invalid subprotocol"):z="Server sent a subprotocol but none was requested":d.size&&(z="Server sent no subprotocol"),z){ue(e,O,z);return}L&&(e._protocol=L);let J=v.headers["sec-websocket-extensions"];if(J!==void 0){if(!l){ue(e,O,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let V;try{V=pa(J)}catch{ue(e,O,"Invalid Sec-WebSocket-Extensions header");return}let A=Object.keys(V);if(A.length!==1||A[0]!==Ne.extensionName){ue(e,O,"Server indicated an extension that was not requested");return}try{l.accept(V[Ne.extensionName])}catch{ue(e,O,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Ne.extensionName]=l}e.setSocket(O,R,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,e):m.end()}function jt(e,t){e._readyState=W.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function ba(e){return e.path=e.socketPath,os.connect(e)}function _a(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=os.isIP(e.host)?"":e.host),ra.connect(e)}function ue(e,t,r){e._readyState=W.CLOSING;let n=new Error(r);Error.captureStackTrace(n,ue),t.setHeader?(t[ls]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(jt,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function Hr(e,t,r){if(t){let n=aa(t)?t.size:ma(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Ce[e.readyState]})`);process.nextTick(r,n)}}function xa(e,t){let r=this[X];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[X]!==void 0&&(r._socket.removeListener("data",Wt),process.nextTick(us,r._socket),e===1005?r.close():r.close(e,t))}function wa(){let e=this[X];e.isPaused||e._socket.resume()}function va(e){let t=this[X];t._socket[X]!==void 0&&(t._socket.removeListener("data",Wt),process.nextTick(us,t._socket),t.close(e[ua])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function ss(){this[X].emitClose()}function Ea(e,t){this[X].emit("message",e,t)}function Sa(e){let t=this[X];t._autoPong&&t.pong(e,!this._isServer,as),t.emit("ping",e)}function Ta(e){this[X].emit("pong",e)}function us(e){e.resume()}function Oa(e){let t=this[X];t.readyState!==W.CLOSED&&(t.readyState===W.OPEN&&(t._readyState=W.CLOSING,fs(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function fs(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),ga)}function hs(){let e=this[X];this.removeListener("close",hs),this.removeListener("data",Wt),this.removeListener("end",ds),e._readyState=W.CLOSING;let t;!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&(t=e._socket.read())!==null&&e._receiver.write(t),e._receiver.end(),this[X]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",ss),e._receiver.on("finish",ss))}function Wt(e){this[X]._receiver.write(e)||this.pause()}function ds(){let e=this[X];e._readyState=W.CLOSING,e._receiver.end(),this.end()}function ps(){let e=this[X];this.removeListener("error",ps),this.on("error",as),e&&(e._readyState=W.CLOSING,this.destroy())}});var ys=F((Tf,gs)=>{"use strict";f();var{tokenChars:La}=Ke();function ka(e){let t=new Set,r=-1,n=-1,i=0;for(i;i<e.length;i++){let o=e.charCodeAt(i);if(n===-1&&La[o]===1)r===-1&&(r=i);else if(i!==0&&(o===32||o===9))n===-1&&r!==-1&&(n=i);else if(o===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),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=e.slice(r,i);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}gs.exports={parse:ka}});var Ss=F((kf,Es)=>{"use strict";f();var Ca=G("events"),Vt=G("http"),{Duplex:Lf}=G("stream"),{createHash:Ra}=G("crypto"),bs=jr(),qe=gt(),Ba=ys(),Da=Qr(),{GUID:$a,kWebSocket:Aa}=Oe(),Na=/^[+/0-9A-Za-z]{22}==$/,_s=0,xs=1,vs=2,Yr=class extends Ca{constructor(t,r){if(super(),t={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:Da,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Vt.createServer((n,i)=>{let s=Vt.STATUS_CODES[426];i.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),i.end(s)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Ia(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,s,o)=>{this.handleUpgrade(i,s,o,n)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=_s}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===vs){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(xt,this);return}if(t&&this.once("close",t),this._state!==xs)if(this._state=xs,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(xt,this):process.nextTick(xt,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{xt(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,i){r.on("error",ws);let s=t.headers["sec-websocket-key"],o=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Ge(this,t,r,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){Ge(this,t,r,400,"Invalid Upgrade header");return}if(s===void 0||!Na.test(s)){Ge(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==8&&c!==13){Ge(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(t)){wt(r,400);return}let a=t.headers["sec-websocket-protocol"],u=new Set;if(a!==void 0)try{u=Ba.parse(a)}catch{Ge(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let h=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&h!==void 0){let d=new qe(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let l=bs.parse(h);l[qe.extensionName]&&(d.accept(l[qe.extensionName]),p[qe.extensionName]=d)}catch{Ge(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let d={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(d,(l,m,v,O)=>{if(!l)return wt(r,m||401,v,O);this.completeUpgrade(p,s,u,t,r,n,i)});return}if(!this.options.verifyClient(d))return wt(r,401)}this.completeUpgrade(p,s,u,t,r,n,i)}completeUpgrade(t,r,n,i,s,o,c){if(!s.readable||!s.writable)return s.destroy();if(s[Aa])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>_s)return wt(s,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ra("sha1").update(r+$a).digest("base64")}`],h=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;p&&(u.push(`Sec-WebSocket-Protocol: ${p}`),h._protocol=p)}if(t[qe.extensionName]){let p=t[qe.extensionName].params,d=bs.format({[qe.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${d}`),h._extensions=t}this.emit("headers",u,i),s.write(u.concat(`\r
|
|
2
|
+
`).join(`\r
|
|
3
|
+
`)),s.removeListener("error",ws),h.setSocket(s,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(h),h.on("close",()=>{this.clients.delete(h),this._shouldEmitClose&&!this.clients.size&&process.nextTick(xt,this)})),c(h,i)}};Es.exports=Yr;function Ia(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function xt(e){e._state=vs,e.emit("close")}function ws(){this.destroy()}function wt(e,t,r,n){r=r||Vt.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Vt.STATUS_CODES[t]}\r
|
|
4
|
+
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
|
5
|
+
`)+`\r
|
|
6
|
+
\r
|
|
7
|
+
`+r)}function Ge(e,t,r,n,i){if(e.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Ge),e.emit("wsClientError",s,r,t)}else wt(r,n,i)}});f();f();var N="\x1B[",it="\x1B]",Ve="\x07",Ot=";",fn=process.env.TERM_PROGRAM==="Apple_Terminal",$={};$.cursorTo=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof t!="number"?N+(e+1)+"G":N+(t+1)+";"+(e+1)+"H"};$.cursorMove=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let r="";return e<0?r+=N+-e+"D":e>0&&(r+=N+e+"C"),t<0?r+=N+-t+"A":t>0&&(r+=N+t+"B"),r};$.cursorUp=(e=1)=>N+e+"A";$.cursorDown=(e=1)=>N+e+"B";$.cursorForward=(e=1)=>N+e+"C";$.cursorBackward=(e=1)=>N+e+"D";$.cursorLeft=N+"G";$.cursorSavePosition=fn?"\x1B7":N+"s";$.cursorRestorePosition=fn?"\x1B8":N+"u";$.cursorGetPosition=N+"6n";$.cursorNextLine=N+"E";$.cursorPrevLine=N+"F";$.cursorHide=N+"?25l";$.cursorShow=N+"?25h";$.eraseLines=e=>{let t="";for(let r=0;r<e;r++)t+=$.eraseLine+(r<e-1?$.cursorUp():"");return e&&(t+=$.cursorLeft),t};$.eraseEndLine=N+"K";$.eraseStartLine=N+"1K";$.eraseLine=N+"2K";$.eraseDown=N+"J";$.eraseUp=N+"1J";$.eraseScreen=N+"2J";$.scrollUp=N+"S";$.scrollDown=N+"T";$.clearScreen="\x1Bc";$.clearTerminal=process.platform==="win32"?`${$.eraseScreen}${N}0f`:`${$.eraseScreen}${N}3J${N}H`;$.beep=Ve;$.link=(e,t)=>[it,"8",Ot,Ot,t,Ve,e,it,"8",Ot,Ot,Ve].join("");$.image=(e,t={})=>{let r=`${it}1337;File=inline=1`;return t.width&&(r+=`;width=${t.width}`),t.height&&(r+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+e.toString("base64")+Ve};$.iTerm={setCwd:(e=process.cwd())=>`${it}50;CurrentDir=${e}${Ve}`,annotation:(e,t={})=>{let r=`${it}1337;`,n=typeof t.x<"u",i=typeof t.y<"u";if((n||i)&&!(n&&i&&typeof t.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,""),r+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0?r+=(n?[e,t.length,t.x,t.y]:[t.length,e]).join("|"):r+=e,r+Ve}};var hn=$;var Lt=oe(bn(),1);function ge(e,t,{target:r="stdout",...n}={}){return Lt.default[r]?hn.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}ge.isSupported=Lt.default.stdout;ge.stderr=(e,t,r={})=>ge(e,t,{target:"stderr",...r});ge.stderr.isSupported=Lt.default.stderr;f();import{randomUUID as Ds}from"node:crypto";f();var _n=oe(Ht(),1);import nr from"node:os";var ye,xn=async(e,t)=>{t["--telemetry"]&&(ye=await import("./esm-3OYJEC4Z.js"),ye.init({dsn:"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266",enabled:me.productionLike&&(t["--telemetry"]??!1),release:We.version,environment:We.version.includes("experimental")?"experimental":"production"}))},wn=async e=>{ye&&(ye.captureException(e,{event_id:e.id,captureContext:{tags:{arch:q.arch,bug:e.isBug,environment:me.value,platform:q.platform,shell:q.shell,version:We.version},contexts:{ctx:{argv:process.argv},cause:e.cause?ce(e.cause):void 0,app:{app_name:We.name,app_version:We.version},device:{name:nr.hostname(),family:nr.type(),arch:nr.arch()},runtime:{name:process.release.name,version:process.version}}}}),await ye.flush((0,_n.default)("2s")))},vn=e=>{ye&&ye.addBreadcrumb(e)},sl=e=>{ye&&ye.setUser(e)},ol=e=>{ye&&ye.setTags(e)};var $s=async(e,t)=>{if(en(t))return e.log.debug("aborting without reporting error",{error:t}),process.exit(1);e.log.error("reporting error and exiting",{error:t});try{let r=Pe.from(t);if(r.print(),r.isBug===Ie.NO)return;await wn(r)}finally{process.exit(1)}},_l=async(e,t)=>{e.log.debug("installing error handlers"),await xn(e,t);let r=n=>void $s(e,n);process.once("uncaughtException",r),process.once("unhandledRejection",r)},Ie=Object.freeze({YES:"yes",NO:"no",MAYBE:"maybe"}),Pe=class e extends Error{id=me.testLike?"00000000-0000-0000-0000-000000000000":Ds();cause;stack;constructor(t){super(t),Error.captureStackTrace(this,this.constructor),this.stack=Zr(this.stack,{pretty:!0,basePath:nn})}static from(t){return t instanceof e?t:new ir(t)}sprint(){let t=this.render();if(this.isBug!==Ie.NO){t=Tt(t);let r=this.isBug===Ie.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}`;ge.isSupported?t+=Tt({ensureEmptyLineAbove:!0,content:xe`
|
|
8
|
+
${r}, ${ge("click here",n)} to create an issue on GitHub.
|
|
9
|
+
`}):t+=Tt({ensureEmptyLineAbove:!0,content:xe`
|
|
10
|
+
${r}, use the link below to create an issue on GitHub.
|
|
11
|
+
|
|
12
|
+
${n}
|
|
13
|
+
`})}return t}print(t){an({ensureEmptyLineAbove:!0,...t,content:this.sprint()})}},ir=class extends Pe{constructor(r){super("An unexpected error occurred");this.cause=r}isBug=Ie.YES;render(){let r=ce(this.cause),n=r.stack||r.message||this.stack;return this.message+`.
|
|
14
|
+
|
|
15
|
+
`+n}},En=class extends Pe{constructor(r,n){super(r);this.cause=n}isBug=Ie.MAYBE;render(){return this.message}};f();f();f();import Sn from"node:process";function st(){let{env:e}=Sn,{TERM:t,TERM_PROGRAM:r}=e;return Sn.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Tn={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"},On={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"},As={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"},sr={...Tn,...On},Ns={...Tn,...As},Is=st(),Ps=Is?sr:Ns,Ln=Ps,Ol=Object.entries(On);var or={...me.testLike?sr:Ln};if(st()&&q.windowsOrWsl)for(let e of["tick","cross"])or[e]+=" ";f();var ur=oe(Bn(),1);import qs from"node:assert";var Fl=e=>e.filter(t=>!!t),Dn=e=>[...new Set(e)],ql=(e,t)=>(qs(t.length>0,"options must not be empty"),[...t].sort((r,n)=>ur.default.get(r,e)-ur.default.get(n,e)));f();var An=oe($n(),1);import Gs from"node:assert";var Be=class extends Pe{constructor(r,n){super("An error occurred while communicating with Gadget");this.request=r;Jt(n)?this.cause={type:n.type,message:n.message,error:ce(n.error)}:Yt(n)?this.cause={type:n.type,code:n.code,reason:n.reason,wasClean:n.wasClean}:(Gs(St(n)||Qt(n)||Kt(n),"cause must be a string, Error, GraphQLError[], CloseEvent, or ErrorEvent"),this.cause=n)}isBug=Ie.MAYBE;cause;render(){let r="";switch(!0){case Kt(this.cause):{let n=Dn(this.cause.map(i=>i.message));r=xe`
|
|
16
|
+
Gadget responded with the following ${(0,An.default)("error",n.length,!1)}:
|
|
17
|
+
|
|
18
|
+
• ${n.join(`
|
|
19
|
+
\u2022 `)}
|
|
20
|
+
`;break}case Yt(this.cause):r="The connection to Gadget closed unexpectedly.";break;case(Jt(this.cause)||Qt(this.cause)):r=this.cause.message;break;default:r=this.cause;break}return this.message+`
|
|
21
|
+
|
|
22
|
+
`+r}};f();f();import js from"node:assert";var Nn=e=>e.url instanceof URL&&e.url.host===q.domains.services,Ws=e=>{let t=ln(e);return t&&`session=${encodeURIComponent(t)};`},dr=e=>{let t=at(e);return js(t,"missing auth headers"),t},at=e=>{let t=Ws(e);if(t)return e.log.trace("using cookie as auth header",{},{cookie:t}),{cookie:t};let r=un(e);if(r)return e.log.trace("using token as auth header",{},{token:r}),{"x-platform-access-token":r}},Vs=e=>e instanceof tn&&e.response.statusCode===401,ic=(e,t)=>{if(Vs(t)){e.log.warn("swallowing unauthorized error",{error:t});return}throw t};f();var fi=oe(Ht(),1);import uo from"node:assert";import{Agent as fo}from"node:http";import{Agent as ho}from"node:https";f();f();f();import ao from"node:assert";f();f();var In=(e,t,r,n)=>JSON.stringify({level:e,name:t,msg:Zt(r).trim(),fields:Pn(n)})+`
|
|
23
|
+
`,Pn=e=>{let t={};for(let[r,n]of Object.entries(e))t[r]=Mn(n);return t},Mn=e=>(e instanceof Set&&(e=Array.from(e)),Array.isArray(e)?e.map(Mn):(e instanceof Map&&(e=Object.fromEntries(e.entries())),je(e)?Pn(e):St(e)?Zt(e).trim():e));f();var gr=oe(kn(),1);import Xs from"node:assert";f();var ni=oe(ri(),1),ii=e=>{let t=ni.default.stringify(e);return t?`?${t}`:""};f();var C=new Jr({level:me.testLike&&q.logLevel<j.PRINT?3:Kr.level}),I={error:C.red,success:C.green,warn:C.yellow,link:C.cyan,highlighted:C.magentaBright,examplesQuestions:C.cyanBright,subdued:C.blackBright,body:C.whiteBright,black:C.black,blackBright:C.blackBright,red:C.red,redBright:C.redBright,green:C.green,greenBright:C.greenBright,yellow:C.yellow,yellowBright:C.yellowBright,blue:C.blue,blueBright:C.blueBright,magenta:C.magenta,magentaBright:C.magentaBright,cyan:C.cyan,cyanBright:C.cyanBright,white:C.white,whiteBright:C.whiteBright,bgBlack:C.bgBlack,bgBlackBright:C.bgBlackBright,bgRed:C.bgRed,bgRedBright:C.bgRedBright,bgGreen:C.bgGreen,bgGreenBright:C.bgGreenBright,bgYellow:C.bgYellow,bgYellowBright:C.bgYellowBright,bgBlue:C.bgBlue,bgBlueBright:C.bgBlueBright,bgMagenta:C.bgMagenta,bgMagentaBright:C.bgMagentaBright,bgCyan:C.bgCyan,bgCyanBright:C.bgCyanBright,bgWhite:C.bgWhite,bgWhiteBright:C.bgWhiteBright,reset:C.reset};var ai=(e,t,r,n,i,s)=>`${no(i)} ${io(e)} ${so(t)}:${oo(r)}${li(n,{indent:2,timestamp:i,environment:s})}${Se}`,Qe="",$e=" ",Se=`
|
|
24
|
+
`,eo=":",si="'",oi=(e,t)=>{let r=e==="error"?I.error:I.subdued,n=[];n.push(Se);for(let i=0;i<t;i++)n.push($e);return n.push(r(e)),n.push(r(eo)),n.join("")},De=(e,t,r)=>{if(!e)return Qe;let n=e.split(Se);if(n.length===0)return Qe;let i=[],s=n.shift();Xs(s),i.push(t(s));for(let o of n)if(o){i.push(Se);for(let c=0;c<r;c++)i.push($e);i.push(t(o))}return i.join(Qe)},to=(e,t)=>{let r="";return t&&(r=ii(t)),`https://${e.application.slug}--${e.name}.${q.domains.app}/edit/logs${r}`},ro=e=>e?`{environment_id="${e.id.toString()}"} | json | level=~"info|warn|error"`:'{environment_id=~".+"} | json | level=~"info|warn|error"',li=(e,t)=>{let{indent:r,environment:n,timestamp:i}=t;if(Object.keys(e).length===0)return Qe;let s=[];"trace_id"in e&&(s.push(oi("trace_id",r)),s.push($e),n&&i&&ge.isSupported?s.push(ge(I.link(e.trace_id),to(n,{timeRange:`${i.toISOString()} to now`,logql:`${ro(n)} | trace_id="${e.trace_id}"`}))):s.push(I.link(e.trace_id)));for(let[o,c]of Object.entries(e))if(o!=="trace_id"){if(s.push(oi(o,r)),c instanceof Set&&(c=Array.from(c)),Array.isArray(c)){if(c.length===0){s.push(De(" []",I.subdued,r));continue}c=Object.fromEntries(c.entries())}if(c instanceof Map&&(c=Object.fromEntries(c)),je(c)){let a=Object.entries(c);if(a.length===0){s.push(De(" {}",I.subdued,r));continue}a.length>10&&q.logLevel>j.TRACE&&!n&&(c=Object.fromEntries([...a.slice(0,10),[or.ellipsis,`${a.length-10} more`]])),s.push(li(c,{indent:r+2,environment:n}));continue}if(s.push($e),n)s.push(De(String(c),I.reset,r));else switch(typeof c){case"string":s.push(De(si+c.replaceAll(Se,Se+$e.repeat(r+o.length))+si,I.reset,r));break;case"number":s.push(De(String(c),I.yellowBright,r));break;case"bigint":s.push(De(String(c)+"n",I.yellowBright,r));break;case"boolean":s.push(De(String(c),I.green,r));break;default:s.push(De(String(c),I.reset,r));break}}return s.join(Qe)},no=e=>(e?(0,gr.default)(e):(0,gr.default)()).format("hh:mm:ss"),io=e=>{switch(e){case j.PRINT:return I.bgBlack(I.body.bold(" PRINT "));case j.TRACE:return I.bgBlue(I.body.bold(" TRACE "));case j.DEBUG:return I.bgMagenta(I.body.bold(" DEBUG "));case j.INFO:return I.bgBlue(I.body.bold(" INFO "));case j.WARN:return I.bgYellow(I.body.bold(" WARN "));case j.ERROR:return I.bgRed(I.body.bold(" ERROR "))}},so=e=>I.body(e),oo=e=>{if(!e)return Qe;let t=e.split(Se);return t.length===1?$e+I.body(e):Se+t.map(r=>$e+$e+r).join(Se)};var yr={pretty:ai,json:In};var Xc={"--log-level":{type:e=>on(e,j.INFO),alias:["-ll"],default:j.INFO},"--my-logs":{type:Boolean}},lo={trace:j.TRACE,debug:j.DEBUG,info:j.INFO,warn:j.WARN,error:j.ERROR},eu=e=>(t,r,n,i,s)=>{let o={...i};"error"in o&&(o.error=ce(o.error)),"reason"in o&&(o.reason=ce(o.reason));let c=yr[q.logFormat],a=lo[t.toLowerCase()];ao(a,`Unknown level: ${t}`),Xt.writeStdout(c(a,r,n,o,s,e))},ci=({name:e,fields:t={},devFields:r={}})=>{let n=i=>(s,o,c)=>{let a=i>=q.logLevel,u=i>=j.INFO;if(!a&&!u)return;let h={...ae(t),...o};if(me.developmentOrTestLike&&Object.assign(h,ae(r),c),"error"in h&&(h.error=ce(h.error)),"reason"in h&&(h.reason=ce(h.reason)),a){let p=yr[q.logFormat];Xt.writeStderr(p(i,e,s,h))}u&&vn({level:"log",message:s,data:h})};return{trace:n(j.TRACE),debug:n(j.DEBUG),info:n(j.INFO),warn:n(j.WARN),error:n(j.ERROR)}};var br=({name:e,fields:t,devFields:r})=>({...ci({name:e,fields:t,devFields:r}),child:({name:n,fields:i,devFields:s})=>br({name:n||e,fields:()=>({...ae(t),...ae(i)}),devFields:{...ae(r),...ae(s)}})});f();var ui=oe(Ht(),1);import{setTimeout as co}from"node:timers/promises";var lu=(e,t)=>co((0,ui.default)(e),void 0,t),_r=class{resolution;rejection;pendingPromise;constructor(t){this.pendingPromise=t,t.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}},kt=class{[Symbol.toStringTag];resolve;reject;_promise;constructor(){this._promise=new _r(new Promise((t,r)=>{this.resolve=t,this.reject=r})),this[Symbol.toStringTag]=String(this._promise.pendingPromise)}then(t,r){return this._promise.unwrap().then(t,r)}catch(t){return this._promise.unwrap().catch(t)}finally(t){return this._promise.unwrap().finally(t)}};var Ct=class e extends AbortController{done=new kt;#e;#i=[];constructor({log:t}){super(),this.#e=t,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(t){return new e({log:br(t)})}child(t){let r=new e({log:this.log.child(t)});return this.onAbort(()=>r.abort()),r}onAbort(t){this.#i.push(t)}};var xr=e=>(uo(e.context?.ctx instanceof Ct,xe(`
|
|
25
|
+
ctx must be provided to http requests:
|
|
26
|
+
|
|
27
|
+
const response = await http({
|
|
28
|
+
context: { ctx },
|
|
29
|
+
...options,
|
|
30
|
+
});
|
|
31
|
+
`)),e.context.ctx),Rt=rn.extend({agent:{http:new fo({keepAlive:!0}),https:new ho({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:({computedValue:e})=>e,backoffLimit:(0,fi.default)("5s"),noise:100},hooks:{beforeRequest:[e=>{let t=xr(e);e.signal=t.signal,e.headers["user-agent"]=q.versionFull,t.log.debug("http request",{http:{request:{method:e.method,url:e.url?.toString()}}})}],beforeRetry:[(e,t)=>{xr(e.request?.options??e.options.context).log.warn("http request failed, retrying...",{http:{retryCount:t,error:ce(e),request:e.request&&{method:e.request.options.method,url:e.request.options.url?.toString()},response:e.response&&{statusCode:e.response.statusCode,traceId:e.response.headers["x-trace-id"],durationMs:e.response.timings.phases.total}}})}],afterResponse:[e=>{let t=xr(e.request.options);return t.log.debug("http response",{http:{request:{method:e.request.options.method,url:e.request.options.url?.toString()},response:{statusCode:e.statusCode,traceId:e.headers["x-trace-id"],durationMs:e.timings.phases.total}}}),e.statusCode===401&&Nn(e.request.options)&&cn(t,void 0),e}]}});f();import qa from"node:assert";f();f();f();f();function ne(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Te(e){return ne(e)==="object"}function hi(e){return Array.isArray(e)&&e.length>0&&e.every(t=>"message"in t)}function wr(e,t){return e.length<124?e:t}var di="graphql-transport-ws";var le;(function(e){e[e.InternalServerError=4500]="InternalServerError",e[e.InternalClientError=4005]="InternalClientError",e[e.BadRequest=4400]="BadRequest",e[e.BadResponse=4004]="BadResponse",e[e.Unauthorized=4401]="Unauthorized",e[e.Forbidden=4403]="Forbidden",e[e.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",e[e.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",e[e.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",e[e.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",e[e.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(le||(le={}));var Q;(function(e){e.ConnectionInit="connection_init",e.ConnectionAck="connection_ack",e.Ping="ping",e.Pong="pong",e.Subscribe="subscribe",e.Next="next",e.Error="error",e.Complete="complete"})(Q||(Q={}));function pi(e){if(!Te(e))throw new Error(`Message is expected to be an object, but got ${ne(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ne(e.type)}`);switch(e.type){case Q.ConnectionInit:case Q.ConnectionAck:case Q.Ping:case Q.Pong:{if(e.payload!=null&&!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case Q.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ne(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${ne(e.payload.query)}`);if(e.payload.variables!=null&&!Te(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ne(e.payload.variables)}`);if(e.payload.operationName!=null&&ne(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ne(e.payload.operationName)}`);if(e.payload.extensions!=null&&!Te(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ne(e.payload.extensions)}`);break}case Q.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ne(e.payload)}`);break}case Q.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!hi(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case Q.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function mi(e,t){return pi(typeof e=="string"?JSON.parse(e,t):e)}function Ye(e,t){return pi(e),JSON.stringify(e,t)}var Je=function(e){return this instanceof Je?(this.v=e,this):new Je(e)},po=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){n[d]&&(i[d]=function(l){return new Promise(function(m,v){s.push([d,l,m,v])>1||c(d,l)})})}function c(d,l){try{a(n[d](l))}catch(m){p(s[0][3],m)}}function a(d){d.value instanceof Je?Promise.resolve(d.value.v).then(u,h):p(s[0][2],d)}function u(d){c("next",d)}function h(d){c("throw",d)}function p(d,l){d(l),s.shift(),s.length&&c(s[0][0],s[0][1])}};function gi(e){let{url:t,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:o=0,disablePong:c,connectionAckWaitTimeout:a=0,retryAttempts:u=5,retryWait:h=async function(g){let b=1e3;for(let _=0;_<g;_++)b*=2;await new Promise(_=>setTimeout(_,b+Math.floor(Math.random()*2700+300)))},shouldRetry:p=vr,isFatalConnectionProblem:d,on:l,webSocketImpl:m,generateID:v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let b=Math.random()*16|0;return(g=="x"?b:b&3|8).toString(16)})},jsonMessageReplacer:O,jsonMessageReviver:R}=e,P;if(m){if(!go(m))throw new Error("Invalid WebSocket implementation provided");P=m}else typeof WebSocket<"u"?P=WebSocket:typeof global<"u"?P=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(P=window.WebSocket||window.MozWebSocket);if(!P)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let Y=P,L=(()=>{let y=(()=>{let b={};return{on(_,E){return b[_]=E,()=>{delete b[_]}},emit(_){var E;"id"in _&&((E=b[_.id])===null||E===void 0||E.call(b,_))}}})(),g={connecting:l?.connecting?[l.connecting]:[],opened:l?.opened?[l.opened]:[],connected:l?.connected?[l.connected]:[],ping:l?.ping?[l.ping]:[],pong:l?.pong?[l.pong]:[],message:l?.message?[y.emit,l.message]:[y.emit],closed:l?.closed?[l.closed]:[],error:l?.error?[l.error]:[]};return{onMessage:y.on,on(b,_){let E=g[b];return E.push(_),()=>{E.splice(E.indexOf(_),1)}},emit(b,..._){for(let E of[...g[b]])E(..._)}}})();function z(y){let g=[L.on("error",b=>{g.forEach(_=>_()),y(b)}),L.on("closed",b=>{g.forEach(_=>_()),y(b)})]}let J,V=0,A,k=!1,te=0,rt=!1;async function S(){clearTimeout(A);let[y,g]=await(J??(J=new Promise((E,B)=>(async()=>{if(k){if(await h(te),!V)return J=void 0,B({code:1e3,reason:"All Subscriptions Gone"});te++}L.emit("connecting",k);let T=new Y(typeof t=="function"?await t():t,di),M,K;function pe(){isFinite(o)&&o>0&&(clearTimeout(K),K=setTimeout(()=>{T.readyState===Y.OPEN&&(T.send(Ye({type:Q.Ping})),L.emit("ping",!1,void 0))},o))}z(H=>{J=void 0,clearTimeout(M),clearTimeout(K),B(H),H instanceof Bt&&(T.close(4499,"Terminated"),T.onerror=null,T.onclose=null)}),T.onerror=H=>L.emit("error",H),T.onclose=H=>L.emit("closed",H),T.onopen=async()=>{try{L.emit("opened",T);let H=typeof r=="function"?await r():r;if(T.readyState!==Y.OPEN)return;T.send(Ye(H?{type:Q.ConnectionInit,payload:H}:{type:Q.ConnectionInit},O)),isFinite(a)&&a>0&&(M=setTimeout(()=>{T.close(le.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},a)),pe()}catch(H){L.emit("error",H),T.close(le.InternalClientError,wr(H instanceof Error?H.message:new Error(H).message,"Internal client error"))}};let se=!1;T.onmessage=({data:H})=>{try{let U=mi(H,R);if(L.emit("message",U),U.type==="ping"||U.type==="pong"){L.emit(U.type,!0,U.payload),U.type==="pong"?pe():c||(T.send(Ye(U.payload?{type:Q.Pong,payload:U.payload}:{type:Q.Pong})),L.emit("pong",!1,U.payload));return}if(se)return;if(U.type!==Q.ConnectionAck)throw new Error(`First message cannot be of type ${U.type}`);clearTimeout(M),se=!0,L.emit("connected",T,U.payload,k),k=!1,te=0,E([T,new Promise((re,_e)=>z(_e))])}catch(U){T.onmessage=null,L.emit("error",U),T.close(le.BadResponse,wr(U instanceof Error?U.message:new Error(U).message,"Bad response"))}}})())));y.readyState===Y.CLOSING&&await g;let b=()=>{},_=new Promise(E=>b=E);return[y,b,Promise.race([_.then(()=>{if(!V){let E=()=>y.close(1e3,"Normal Closure");isFinite(s)&&s>0?A=setTimeout(()=>{y.readyState===Y.OPEN&&E()},s):E()}}),g])]}function w(y){if(vr(y)&&(mo(y.code)||[le.InternalServerError,le.InternalClientError,le.BadRequest,le.BadResponse,le.Unauthorized,le.SubprotocolNotAcceptable,le.SubscriberAlreadyExists,le.TooManyInitialisationRequests].includes(y.code)))throw y;if(rt)return!1;if(vr(y)&&y.code===1e3)return V>0;if(!u||te>=u||!p(y)||d?.(y))throw y;return k=!0}n||(async()=>{for(V++;;)try{let[,,y]=await S();await y}catch(y){try{if(!w(y))return}catch(g){return i?.(g)}}})();function x(y,g){let b=v(y),_=!1,E=!1,B=()=>{V--,_=!0};return(async()=>{for(V++;;)try{let[T,M,K]=await S();if(_)return M();let pe=L.onMessage(b,se=>{switch(se.type){case Q.Next:{g.next(se.payload);return}case Q.Error:{E=!0,_=!0,g.error(se.payload),B();return}case Q.Complete:{_=!0,B();return}}});T.send(Ye({id:b,type:Q.Subscribe,payload:y},O)),B=()=>{!_&&T.readyState===Y.OPEN&&T.send(Ye({id:b,type:Q.Complete},O)),V--,_=!0,M()},await K.finally(pe);return}catch(T){if(!w(T))return}})().then(()=>{E||g.complete()}).catch(T=>{g.error(T)}),()=>{_||B()}}return{on:L.on,subscribe:x,iterate(y){let g=[],b={done:!1,error:null,resolve:()=>{}},_=x(y,{next(B){g.push(B),b.resolve()},error(B){b.done=!0,b.error=B,b.resolve()},complete(){b.done=!0,b.resolve()}}),E=function(){return po(this,arguments,function*(){for(;;){for(g.length||(yield Je(new Promise(M=>b.resolve=M)));g.length;)yield yield Je(g.shift());if(b.error)throw b.error;if(b.done)return yield Je(void 0)}})}();return E.throw=async B=>(b.done||(b.done=!0,b.error=B,b.resolve()),{done:!0,value:void 0}),E.return=async()=>(_(),{done:!0,value:void 0}),E},async dispose(){if(rt=!0,J){let[y]=await J;y.close(1e3,"Normal Closure")}},terminate(){J&&L.emit("closed",new Bt)}}}var Bt=class extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function vr(e){return Te(e)&&"code"in e&&"reason"in e}function mo(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function go(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}f();f();var Sr=oe(bi(),1);f();var ut=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},Tr=class extends Error{constructor(t){super(),this.name="AbortError",this.message=t}},_i=e=>globalThis.DOMException===void 0?new Tr(e):new DOMException(e),xi=e=>{let t=e.reason===void 0?_i("This operation was aborted."):e.reason;return t instanceof Error?t:_i(t)};function Or(e,t){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=t,o,a=new Promise((u,h)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(t.signal){let{signal:d}=t;d.aborted&&h(xi(d)),d.addEventListener("abort",()=>{h(xi(d))})}if(r===Number.POSITIVE_INFINITY){e.then(u,h);return}let p=new ut;o=s.setTimeout.call(void 0,()=>{if(n){try{u(n())}catch(d){h(d)}return}typeof e.cancel=="function"&&e.cancel(),i===!1?u():i instanceof Error?h(i):(p.message=i??`Promise timed out after ${r} milliseconds`,h(p))},r),(async()=>{try{u(await e)}catch(d){h(d)}})()}).finally(()=>{a.clear()});return a.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},a}f();f();function Lr(e,t,r){let n=0,i=e.length;for(;i>0;){let s=Math.trunc(i/2),o=n+s;r(e[o],t)<=0?(n=++o,i-=s+1):i=s}return n}var ft=class{#e=[];enqueue(t,r){r={priority:0,...r};let n={priority:r.priority,run:t};if(this.size&&this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=Lr(this.#e,n,(s,o)=>o.priority-s.priority);this.#e.splice(i,0,n)}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this.#e.length}};var ht=class extends Sr.default{#e;#i;#o=0;#d;#a;#p=0;#r;#l;#t;#m;#n=0;#c;#s;#g;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:ft,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#i=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#d=t.intervalCap,this.#a=t.interval,this.#t=new t.queueClass,this.#m=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#g=t.throwOnTimeout===!0,this.#s=t.autoStart===!1}get#_(){return this.#i||this.#o<this.#d}get#x(){return this.#n<this.#c}#w(){this.#n--,this.#u(),this.emit("next")}#v(){this.#b(),this.#y(),this.#l=void 0}get#E(){let t=Date.now();if(this.#r===void 0){let r=this.#p-t;if(r<0)this.#o=this.#e?this.#n:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#v()},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 t=!this.#E;if(this.#_&&this.#x){let r=this.#t.dequeue();return r?(this.emit("active"),r(),t&&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(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#c=t,this.#f()}async#S(t){return new Promise((r,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0})})}async add(t,r={}){return 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=t({signal:r.signal});r.timeout&&(s=Or(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#S(r.signal)]));let o=await s;n(o),this.emit("completed",o)}catch(s){if(s instanceof ut&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#w()}},r),this.emit("add"),this.#u()})}async addAll(t,r){return Promise.all(t.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(t){this.#t.size<t||await this.#h("next",()=>this.#t.size<t)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(t,r){return new Promise(n=>{let i=()=>{r&&!r()||(this.off(t,i),n())};this.on(t,i)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#n}get isPaused(){return this.#s}};f();var Pa=oe(Si(),1),Ma=oe(Mr(),1),Ua=oe(qr(),1),Ts=oe(Qr(),1),Fa=oe(Ss(),1);var Os=Ts.default;var zt=class{constructor(t,r,n){this.environment=r;this.endpoint=n;this.ctx=t.child({name:"client"}),this._graphqlWsClient=gi({url:`wss://${r.application.slug}.${q.domains.app}/edit/api/graphql-ws`,shouldRetry:()=>!0,connectionParams:{environment:r.name},webSocketImpl:class extends Os{constructor(i,s,o){super(i,s,{signal:t.signal,...o,headers:{...o?.headers,"user-agent":q.versionFull,...dr(t)}})}},on:{connecting:()=>{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}},connected:()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},closed:()=>{this.status=1,this.ctx.log.debug("disconnected")},error:i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})}}})}status=0;ctx;_graphqlWsClient;subscribe(t,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:o=sn}){let c={query:r,variables:ae(n)},a=this._graphqlWsClient.on("connected",()=>{this.status===2&&(c.variables=ae(n),t.log.info("re-subscribing to graphql subscription"))}),u=new ht({concurrency:1}),h=d=>s(new Be(r,d)),p=this._graphqlWsClient.subscribe(c,{next:d=>void u.add(()=>i(d)).catch(h),error:d=>void u.add(()=>h(d)),complete:()=>void u.add(()=>o()).catch(h)});return()=>{t.log.trace("unsubscribing from graphql subscription"),a(),u.clear(),p()}}async execute(t,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?n+=`--${this.environment.name}`:this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await Rt({context:{ctx:t},method:"POST",url:`https://${n}.${q.domains.app}${this.endpoint}`,headers:{...dr(t),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:ae(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!je(i)||!("data"in i)&&!("errors"in i))throw t.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new Be(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var vt=class{ctx;#e;constructor(t,r){this.ctx=t.child({name:"api"}),this.#e=new zt(this.ctx,r,"/api/graphql")}async query({query:t,variables:r,...n}){let i=/query (\w+)/.exec(t)?.[1];qa(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:ae(r)}}});s.log.info("executing graphql query");let o=await this.#e.execute(s,{operation:t,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(o.errors)throw new Be(t,o.errors);if(!o.data)throw new Be(t,"Query response did not contain data");return o.data}async dispose(){await this.#e.dispose()}};f();var Ls=xe(`
|
|
32
|
+
query GadgetMetaModels {
|
|
33
|
+
gadgetMeta {
|
|
34
|
+
models {
|
|
35
|
+
apiIdentifier
|
|
36
|
+
namespace
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
`),ks=xe(`
|
|
41
|
+
query GadgetMetaGlobalActions {
|
|
42
|
+
gadgetMeta {
|
|
43
|
+
globalActions {
|
|
44
|
+
apiIdentifier
|
|
45
|
+
namespace
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
`);var Ga=Object.freeze({Development:"development",Production:"production",Test:"test"}),ja=D.object({id:D.union([D.string(),D.number(),D.bigint()]).transform(e=>BigInt(e)),name:D.string().transform(e=>e.toLowerCase()),type:D.nativeEnum(Ga)}),Wa=D.object({id:D.union([D.string(),D.number(),D.bigint()]).transform(e=>BigInt(e)),slug:D.string(),primaryDomain:D.string(),hasSplitEnvironments:D.boolean(),multiEnvironmentEnabled:D.boolean(),environments:D.array(ja),team:D.object({id:D.union([D.string(),D.number(),D.bigint()]).transform(e=>BigInt(e)),name:D.string()})}),sh=D.object({apiIdentifier:D.string(),namespace:D.nullable(D.array(D.string())).optional()}),oh=D.object({apiIdentifier:D.string(),namespace:D.nullable(D.array(D.string())).optional()}),ah=async e=>{let t=at(e);if(!t)return[];let r=await Rt({context:{ctx:e},url:`https://${q.domains.services}/auth/api/apps`,headers:{...t},responseType:"json",resolveBodyOnly:!0});return D.array(Wa).parse(r)},lh=e=>e.reduce((t,r)=>(t.set(r.team.name,[...t.get(r.team.name)??[],r]),t),new Map),ch=async(e,t)=>{if(!at(e))return[];let n=new vt(e,t),{gadgetMeta:i}=await n.query({query:Ls});return i.models},uh=async(e,t)=>{if(!at(e))return[];let n=new vt(e,t),{gadgetMeta:i}=await n.query({query:ks});return i.globalActions};export{ge as a,sl as b,ol as c,$s as d,_l as e,Ie as f,Pe as g,ir as h,En as i,or as j,kn as k,$n as l,Fl as m,Dn as n,ql as o,Be as p,ht as q,at as r,ic as s,zt as t,Ga as u,ah as v,lh as w,ch as x,uh as y,I as z,Xc as A,eu as B,lu as C,Ct as D,Rt as E};
|
|
50
|
+
//# sourceMappingURL=chunk-CQH5IRAO.js.map
|