@gadgetinc/ggt 1.4.2 → 1.5.1
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 +5 -2
- package/dist/add-XHMGXWYX.js +81 -0
- package/dist/add-XHMGXWYX.js.map +7 -0
- package/dist/{chunk-JOWMHVPF.js → chunk-3B2GY4UU.js} +2 -2
- package/dist/{chunk-JOWMHVPF.js.map → chunk-3B2GY4UU.js.map} +1 -1
- package/dist/{chunk-PRAA2FG3.js → chunk-5VLIBRPJ.js} +2 -2
- package/dist/chunk-7DYQUG5M.js +2 -0
- package/dist/chunk-7DYQUG5M.js.map +7 -0
- package/dist/{chunk-GKAC6HNS.js → chunk-A75V6SNW.js} +17 -10
- package/dist/chunk-A75V6SNW.js.map +7 -0
- package/dist/{chunk-P7E7PAMQ.js → chunk-GFQYFEEH.js} +2 -2
- package/dist/{chunk-L4OG4HIV.js → chunk-HAYHNB7Q.js} +2 -2
- package/dist/{chunk-L4OG4HIV.js.map → chunk-HAYHNB7Q.js.map} +1 -1
- package/dist/chunk-HN3YKQ3C.js +6 -0
- package/dist/chunk-HN3YKQ3C.js.map +7 -0
- package/dist/chunk-KW4V2PJW.js +18 -0
- package/dist/chunk-KW4V2PJW.js.map +7 -0
- package/dist/chunk-LPIHKY3M.js +50 -0
- package/dist/chunk-LPIHKY3M.js.map +7 -0
- package/dist/chunk-SX5LO3XQ.js +2 -0
- package/dist/{chunk-OTYPO33S.js → chunk-U5I2YBJK.js} +2 -2
- package/dist/{chunk-M5HB5SEG.js → chunk-WQ4SFIE4.js} +2 -2
- package/dist/{chunk-M5HB5SEG.js.map → chunk-WQ4SFIE4.js.map} +1 -1
- package/dist/chunk-XE5GH5GR.js +2 -0
- package/dist/{chunk-ZCRXH55K.js.map → chunk-XE5GH5GR.js.map} +1 -1
- package/dist/chunk-XOSBJSTW.js +65 -0
- package/dist/chunk-XOSBJSTW.js.map +7 -0
- package/dist/chunk-Z7JIVKEF.js +8 -0
- package/dist/{chunk-KP35JQJ7.js.map → chunk-Z7JIVKEF.js.map} +1 -1
- package/dist/{deploy-T5ZUHHLZ.js → deploy-QW6KPNDB.js} +2 -2
- package/dist/{deploy-T5ZUHHLZ.js.map → deploy-QW6KPNDB.js.map} +1 -1
- package/dist/{dev-5CVDVGE3.js → dev-KUTYS7OU.js} +4 -4
- package/dist/{dev-5CVDVGE3.js.map → dev-KUTYS7OU.js.map} +1 -1
- package/dist/esm-PLVGBDRY.js +38 -0
- package/dist/esm-PLVGBDRY.js.map +7 -0
- package/dist/{list-BV7QOWA2.js → list-OSMGHITM.js} +2 -2
- package/dist/{list-BV7QOWA2.js.map → list-OSMGHITM.js.map} +1 -1
- package/dist/login-UU4MWB6Y.js +2 -0
- package/dist/logout-XPKPHMRV.js +7 -0
- package/dist/{logout-QLW45MMK.js.map → logout-XPKPHMRV.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/{open-TKGHV5HA.js → open-SP5XOXPG.js} +2 -2
- package/dist/{open-TKGHV5HA.js.map → open-SP5XOXPG.js.map} +1 -1
- package/dist/{pull-RRR7ISUG.js → pull-7JMGBM4A.js} +2 -2
- package/dist/{pull-RRR7ISUG.js.map → pull-7JMGBM4A.js.map} +1 -1
- package/dist/push-7S6V2HSB.js +2 -0
- package/dist/{status-BKCHGWJO.js → status-CJVN2UZ6.js} +2 -2
- package/dist/{status-BKCHGWJO.js.map → status-CJVN2UZ6.js.map} +1 -1
- package/dist/{version-LUMBTKD4.js → version-NFFT7WG5.js} +2 -2
- package/dist/{version-LUMBTKD4.js.map → version-NFFT7WG5.js.map} +1 -1
- package/dist/{whoami-ONJCZDTX.js → whoami-MU3POPXB.js} +2 -2
- package/dist/{whoami-ONJCZDTX.js.map → whoami-MU3POPXB.js.map} +1 -1
- package/package.json +14 -14
- package/dist/add-Q2YM34TO.js +0 -78
- package/dist/add-Q2YM34TO.js.map +0 -7
- package/dist/chunk-56W5U2JG.js +0 -2
- package/dist/chunk-56W5U2JG.js.map +0 -7
- package/dist/chunk-BWIVLBZY.js +0 -18
- package/dist/chunk-BWIVLBZY.js.map +0 -7
- package/dist/chunk-GKAC6HNS.js.map +0 -7
- package/dist/chunk-HVJWUXJL.js +0 -65
- package/dist/chunk-HVJWUXJL.js.map +0 -7
- package/dist/chunk-KP35JQJ7.js +0 -8
- package/dist/chunk-O63J4YN5.js +0 -2
- package/dist/chunk-YINVPQ2V.js +0 -6
- package/dist/chunk-YINVPQ2V.js.map +0 -7
- package/dist/chunk-ZCRXH55K.js +0 -2
- package/dist/chunk-ZN6HRN6U.js +0 -50
- package/dist/chunk-ZN6HRN6U.js.map +0 -7
- package/dist/esm-BEXWGPJL.js +0 -37
- package/dist/esm-BEXWGPJL.js.map +0 -7
- package/dist/login-M6YPWB3H.js +0 -2
- package/dist/logout-QLW45MMK.js +0 -7
- package/dist/push-KUORLNK6.js +0 -2
- /package/dist/{chunk-PRAA2FG3.js.map → chunk-5VLIBRPJ.js.map} +0 -0
- /package/dist/{chunk-P7E7PAMQ.js.map → chunk-GFQYFEEH.js.map} +0 -0
- /package/dist/{chunk-O63J4YN5.js.map → chunk-SX5LO3XQ.js.map} +0 -0
- /package/dist/{chunk-OTYPO33S.js.map → chunk-U5I2YBJK.js.map} +0 -0
- /package/dist/{login-M6YPWB3H.js.map → login-UU4MWB6Y.js.map} +0 -0
- /package/dist/{push-KUORLNK6.js.map → push-7S6V2HSB.js.map} +0 -0
package/dist/chunk-ZN6HRN6U.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import{d as un,e as fn,f as hn}from"./chunk-PRAA2FG3.js";import{$ as cn,A as Ve,B as on,E as ue,K as le,L as an,M as W,N as ln,P as G,T as Xt,U as er,Z as we,_ as Lt,a as Zr,b as Xr,c as en,d as ge,e as $,f as tn,g as Ot,h as We,i as Yt,j as Jt,k as Kt,m as Zt,o as rn,w as nn,x as sn}from"./chunk-HVJWUXJL.js";import{a as Tt}from"./chunk-P7E7PAMQ.js";import{a as o,b as j,d as U,f as ie,h}from"./chunk-56W5U2JG.js";var tr=U((Za,mn)=>{"use strict";h();mn.exports=(t,e=process.argv)=>{let r=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(r+t),i=e.indexOf("--");return n!==-1&&(i===-1||n<i)}});var bn=U((el,yn)=>{"use strict";h();var $s=j("os"),gn=j("tty"),he=tr(),{env:X}=process,Be;he("no-color")||he("no-colors")||he("color=false")||he("color=never")?Be=0:(he("color")||he("colors")||he("color=true")||he("color=always"))&&(Be=1);"FORCE_COLOR"in X&&(X.FORCE_COLOR==="true"?Be=1:X.FORCE_COLOR==="false"?Be=0:Be=X.FORCE_COLOR.length===0?1:Math.min(parseInt(X.FORCE_COLOR,10),3));function rr(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(rr,"translateLevel");function nr(t,e){if(Be===0)return 0;if(he("color=16m")||he("color=full")||he("color=truecolor"))return 3;if(he("color=256"))return 2;if(t&&!e&&Be===void 0)return 0;let r=Be||0;if(X.TERM==="dumb")return r;if(process.platform==="win32"){let n=$s.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in X)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in X)||X.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in X)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X.TEAMCITY_VERSION)?1:0;if(X.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in X){let n=parseInt((X.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(X.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X.TERM)||"COLORTERM"in X?1:r}o(nr,"supportsColor");function As(t){let e=nr(t,t&&t.isTTY);return rr(e)}o(As,"getSupportLevel");yn.exports={supportsColor:As,stdout:rr(nr(!0,gn.isatty(1))),stderr:rr(nr(!0,gn.isatty(2)))}});var wn=U((nl,xn)=>{"use strict";h();var Ns=bn(),He=tr();function _n(t){if(/^\d{3,4}$/.test(t)){let r=/(\d{1,2})(\d{2})/.exec(t);return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let e=(t||"").split(".").map(r=>parseInt(r,10));return{major:e[0],minor:e[1],patch:e[2]}}o(_n,"parseVersion");function ir(t){let{env:e}=process;if("FORCE_HYPERLINK"in e)return!(e.FORCE_HYPERLINK.length>0&&parseInt(e.FORCE_HYPERLINK,10)===0);if(He("no-hyperlink")||He("no-hyperlinks")||He("hyperlink=false")||He("hyperlink=never"))return!1;if(He("hyperlink=true")||He("hyperlink=always")||"NETLIFY"in e)return!0;if(!Ns.supportsColor(t)||t&&!t.isTTY||process.platform==="win32"||"CI"in e||"TEAMCITY_VERSION"in e)return!1;if("TERM_PROGRAM"in e){let r=_n(e.TERM_PROGRAM_VERSION);switch(e.TERM_PROGRAM){case"iTerm.app":return r.major===3?r.minor>=1:r.major>3;case"WezTerm":return r.major>=20200620;case"vscode":return r.major>1||r.major===1&&r.minor>=72}}if("VTE_VERSION"in e){if(e.VTE_VERSION==="0.50.0")return!1;let r=_n(e.VTE_VERSION);return r.major>0||r.minor>=50}return!1}o(ir,"supportsHyperlink");xn.exports={supportsHyperlink:ir,stdout:ir(process.stdout),stderr:ir(process.stderr)}});var Bn=U((cr,ur)=>{h();(function(t,e){typeof cr=="object"&&typeof ur<"u"?ur.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(cr,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",s="minute",a="hour",u="day",l="week",f="month",p="quarter",d="year",b="date",c="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,T={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:o(function(O){var E=["th","st","nd","rd"],w=O%100;return"["+O+(E[(w-20)%10]||E[w]||E[0])+"]"},"ordinal")},B=o(function(O,E,w){var y=String(O);return!y||y.length>=E?O:""+Array(E+1-y.length).join(w)+O},"m"),M={s:B,z:o(function(O){var E=-O.utcOffset(),w=Math.abs(E),y=Math.floor(w/60),g=w%60;return(E<=0?"+":"-")+B(y,2,"0")+":"+B(g,2,"0")},"z"),m:o(function O(E,w){if(E.date()<w.date())return-O(w,E);var y=12*(w.year()-E.year())+(w.month()-E.month()),g=E.clone().add(y,f),_=w-g<0,x=E.clone().add(y+(_?-1:1),f);return+(-(y+(w-g)/(_?g-x:x-g))||0)},"t"),a:o(function(O){return O<0?Math.ceil(O)||0:Math.floor(O)},"a"),p:o(function(O){return{M:f,y:d,w:l,d:u,D:b,h:a,m:s,s:i,ms:n,Q:p}[O]||String(O||"").toLowerCase().replace(/s$/,"")},"p"),u:o(function(O){return O===void 0},"u")},J="en",k={};k[J]=T;var H="$isDayjsObject",K=o(function(O){return O instanceof re||!(!O||!O[H])},"S"),z=o(function O(E,w,y){var g;if(!E)return J;if(typeof E=="string"){var _=E.toLowerCase();k[_]&&(g=_),w&&(k[_]=w,g=_);var x=E.split("-");if(!g&&x.length>1)return O(x[0])}else{var S=E.name;k[S]=E,g=S}return!y&&g&&(J=g),g||!y&&J},"t"),N=o(function(O,E){if(K(O))return O.clone();var w=typeof E=="object"?E:{};return w.date=O,w.args=arguments,new re(w)},"O"),C=M;C.l=z,C.i=K,C.w=function(O,E){return N(O,{locale:E.$L,utc:E.$u,x:E.$x,$offset:E.$offset})};var re=function(){function O(w){this.$L=z(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[H]=!0}o(O,"M");var E=O.prototype;return E.parse=function(w){this.$d=function(y){var g=y.date,_=y.utc;if(g===null)return new Date(NaN);if(C.u(g))return new Date;if(g instanceof Date)return new Date(g);if(typeof g=="string"&&!/Z$/i.test(g)){var x=g.match(m);if(x){var S=x[2]-1||0,D=(x[7]||"0").substring(0,3);return _?new Date(Date.UTC(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,D)):new Date(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,D)}}return new Date(g)}(w),this.init()},E.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},E.$utils=function(){return C},E.isValid=function(){return this.$d.toString()!==c},E.isSame=function(w,y){var g=N(w);return this.startOf(y)<=g&&g<=this.endOf(y)},E.isAfter=function(w,y){return N(w)<this.startOf(y)},E.isBefore=function(w,y){return this.endOf(y)<N(w)},E.$g=function(w,y,g){return C.u(w)?this[y]:this.set(g,w)},E.unix=function(){return Math.floor(this.valueOf()/1e3)},E.valueOf=function(){return this.$d.getTime()},E.startOf=function(w,y){var g=this,_=!!C.u(y)||y,x=C.p(w),S=o(function(F,ne){var xe=C.w(g.$u?Date.UTC(g.$y,ne,F):new Date(g.$y,ne,F),g);return _?xe:xe.endOf(u)},"l"),D=o(function(F,ne){return C.w(g.toDate()[F].apply(g.toDate("s"),(_?[0,0,0,0]:[23,59,59,999]).slice(ne)),g)},"$"),L=this.$W,q=this.$M,Z=this.$D,me="set"+(this.$u?"UTC":"");switch(x){case d:return _?S(1,0):S(31,11);case f:return _?S(1,q):S(0,q+1);case l:var ae=this.$locale().weekStart||0,Q=(L<ae?L+7:L)-ae;return S(_?Z-Q:Z+(6-Q),q);case u:case b:return D(me+"Hours",0);case a:return D(me+"Minutes",1);case s:return D(me+"Seconds",2);case i:return D(me+"Milliseconds",3);default:return this.clone()}},E.endOf=function(w){return this.startOf(w,!1)},E.$set=function(w,y){var g,_=C.p(w),x="set"+(this.$u?"UTC":""),S=(g={},g[u]=x+"Date",g[b]=x+"Date",g[f]=x+"Month",g[d]=x+"FullYear",g[a]=x+"Hours",g[s]=x+"Minutes",g[i]=x+"Seconds",g[n]=x+"Milliseconds",g)[_],D=_===u?this.$D+(y-this.$W):y;if(_===f||_===d){var L=this.clone().set(b,1);L.$d[S](D),L.init(),this.$d=L.set(b,Math.min(this.$D,L.daysInMonth())).$d}else S&&this.$d[S](D);return this.init(),this},E.set=function(w,y){return this.clone().$set(w,y)},E.get=function(w){return this[C.p(w)]()},E.add=function(w,y){var g,_=this;w=Number(w);var x=C.p(y),S=o(function(q){var Z=N(_);return C.w(Z.date(Z.date()+Math.round(q*w)),_)},"y");if(x===f)return this.set(f,this.$M+w);if(x===d)return this.set(d,this.$y+w);if(x===u)return S(1);if(x===l)return S(7);var D=(g={},g[s]=e,g[a]=r,g[i]=t,g)[x]||1,L=this.$d.getTime()+w*D;return C.w(L,this)},E.subtract=function(w,y){return this.add(-1*w,y)},E.format=function(w){var y=this,g=this.$locale();if(!this.isValid())return g.invalidDate||c;var _=w||"YYYY-MM-DDTHH:mm:ssZ",x=C.z(this),S=this.$H,D=this.$m,L=this.$M,q=g.weekdays,Z=g.months,me=g.meridiem,ae=o(function(ne,xe,it,St){return ne&&(ne[xe]||ne(y,_))||it[xe].slice(0,St)},"h"),Q=o(function(ne){return C.s(S%12||12,ne,"0")},"d"),F=me||function(ne,xe,it){var St=ne<12?"AM":"PM";return it?St.toLowerCase():St};return _.replace(v,function(ne,xe){return xe||function(it){switch(it){case"YY":return String(y.$y).slice(-2);case"YYYY":return C.s(y.$y,4,"0");case"M":return L+1;case"MM":return C.s(L+1,2,"0");case"MMM":return ae(g.monthsShort,L,Z,3);case"MMMM":return ae(Z,L);case"D":return y.$D;case"DD":return C.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return ae(g.weekdaysMin,y.$W,q,2);case"ddd":return ae(g.weekdaysShort,y.$W,q,3);case"dddd":return q[y.$W];case"H":return String(S);case"HH":return C.s(S,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return F(S,D,!0);case"A":return F(S,D,!1);case"m":return String(D);case"mm":return C.s(D,2,"0");case"s":return String(y.$s);case"ss":return C.s(y.$s,2,"0");case"SSS":return C.s(y.$ms,3,"0");case"Z":return x}return null}(ne)||x.replace(":","")})},E.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},E.diff=function(w,y,g){var _,x=this,S=C.p(y),D=N(w),L=(D.utcOffset()-this.utcOffset())*e,q=this-D,Z=o(function(){return C.m(x,D)},"D");switch(S){case d:_=Z()/12;break;case f:_=Z();break;case p:_=Z()/3;break;case l:_=(q-L)/6048e5;break;case u:_=(q-L)/864e5;break;case a:_=q/r;break;case s:_=q/e;break;case i:_=q/t;break;default:_=q}return g?_:C.a(_)},E.daysInMonth=function(){return this.endOf(f).$D},E.$locale=function(){return k[this.$L]},E.locale=function(w,y){if(!w)return this.$L;var g=this.clone(),_=z(w,y,!0);return _&&(g.$L=_),g},E.clone=function(){return C.w(this.$d,this)},E.toDate=function(){return new Date(this.valueOf())},E.toJSON=function(){return this.isValid()?this.toISOString():null},E.toISOString=function(){return this.$d.toISOString()},E.toString=function(){return this.$d.toUTCString()},O}(),nt=re.prototype;return N.prototype=nt,[["$ms",n],["$s",i],["$m",s],["$H",a],["$W",u],["$M",f],["$y",d],["$D",b]].forEach(function(O){nt[O[1]]=function(E){return this.$g(E,O[0],O[1])}}),N.extend=function(O,E){return O.$i||(O(E,re,N),O.$i=!0),N},N.locale=z,N.isDayjs=K,N.unix=function(O){return N(1e3*O)},N.en=k[J],N.Ls=k,N.p={},N})});var $n=U(Qe=>{"use strict";h();Qe.__esModule=!0;Qe.distance=Qe.closest=void 0;var Se=new Uint32Array(65536),Gs=o(function(t,e){for(var r=t.length,n=e.length,i=1<<r-1,s=-1,a=0,u=r,l=r;l--;)Se[t.charCodeAt(l)]|=1<<l;for(l=0;l<n;l++){var f=Se[e.charCodeAt(l)],p=f|a;f|=(f&s)+s^s,a|=~(f|s),s&=f,a&i&&u++,s&i&&u--,a=a<<1|1,s=s<<1|~(p|a),a&=p}for(l=r;l--;)Se[t.charCodeAt(l)]=0;return u},"myers_32"),js=o(function(t,e){for(var r=e.length,n=t.length,i=[],s=[],a=Math.ceil(r/32),u=Math.ceil(n/32),l=0;l<a;l++)s[l]=-1,i[l]=0;for(var f=0;f<u-1;f++){for(var p=0,d=-1,b=f*32,c=Math.min(32,n)+b,m=b;m<c;m++)Se[t.charCodeAt(m)]|=1<<m;for(var l=0;l<r;l++){var v=Se[e.charCodeAt(l)],T=s[l/32|0]>>>l&1,B=i[l/32|0]>>>l&1,M=v|p,J=((v|B)&d)+d^d|v|B,k=p|~(J|d),H=d&J;k>>>31^T&&(s[l/32|0]^=1<<l),H>>>31^B&&(i[l/32|0]^=1<<l),k=k<<1|T,H=H<<1|B,d=H|~(M|k),p=k&M}for(var m=b;m<c;m++)Se[t.charCodeAt(m)]=0}for(var K=0,z=-1,N=f*32,C=Math.min(32,n-N)+N,m=N;m<C;m++)Se[t.charCodeAt(m)]|=1<<m;for(var re=n,l=0;l<r;l++){var v=Se[e.charCodeAt(l)],T=s[l/32|0]>>>l&1,B=i[l/32|0]>>>l&1,M=v|K,J=((v|B)&z)+z^z|v|B,k=K|~(J|z),H=z&J;re+=k>>>n-1&1,re-=H>>>n-1&1,k>>>31^T&&(s[l/32|0]^=1<<l),H>>>31^B&&(i[l/32|0]^=1<<l),k=k<<1|T,H=H<<1|B,z=H|~(M|k),K=k&M}for(var m=N;m<C;m++)Se[t.charCodeAt(m)]=0;return re},"myers_x"),Dn=o(function(t,e){if(t.length<e.length){var r=e;e=t,t=r}return e.length===0?t.length:t.length<=32?Gs(t,e):js(t,e)},"distance");Qe.distance=Dn;var Ws=o(function(t,e){for(var r=1/0,n=0,i=0;i<e.length;i++){var s=Dn(t,e[i]);s<r&&(r=s,n=i)}return e[n]},"closest");Qe.closest=Ws});var An=U((fr,at)=>{h();(function(){"use strict";var t;try{t=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var e=$n(),r=[],n=[],i={get:o(function(s,a,u){var l=u&&t&&u.useCollator;if(l){var f=s.length,p=a.length;if(f===0)return p;if(p===0)return f;var d,b,c,m,v;for(c=0;c<p;++c)r[c]=c,n[c]=a.charCodeAt(c);r[p]=p;var T;for(c=0;c<f;++c){for(b=c+1,m=0;m<p;++m)d=b,T=t.compare(s.charAt(c),String.fromCharCode(n[m]))===0,b=r[m]+(T?0:1),v=d+1,b>v&&(b=v),v=r[m+1]+1,b>v&&(b=v),r[m]=d;r[m]=b}return b}return e.distance(s,a)},"get")};typeof define<"u"&&define!==null&&define.amd?define(function(){return i}):typeof at<"u"&&at!==null&&typeof fr<"u"&&at.exports===fr?at.exports=i:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=i:typeof window<"u"&&window!==null&&(window.Levenshtein=i)})()});var In=U((dr,pr)=>{h();(function(t,e){typeof j=="function"&&typeof dr=="object"&&typeof pr=="object"?pr.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):t.pluralize=e()})(dr,function(){var t=[],e=[],r={},n={},i={};function s(c){return typeof c=="string"?new RegExp("^"+c+"$","i"):c}o(s,"sanitizeRule");function a(c,m){return c===m?m:c===c.toLowerCase()?m.toLowerCase():c===c.toUpperCase()?m.toUpperCase():c[0]===c[0].toUpperCase()?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m.toLowerCase()}o(a,"restoreCase");function u(c,m){return c.replace(/\$(\d{1,2})/g,function(v,T){return m[T]||""})}o(u,"interpolate");function l(c,m){return c.replace(m[0],function(v,T){var B=u(m[1],arguments);return a(v===""?c[T-1]:v,B)})}o(l,"replace");function f(c,m,v){if(!c.length||r.hasOwnProperty(c))return m;for(var T=v.length;T--;){var B=v[T];if(B[0].test(m))return l(m,B)}return m}o(f,"sanitizeWord");function p(c,m,v){return function(T){var B=T.toLowerCase();return m.hasOwnProperty(B)?a(T,B):c.hasOwnProperty(B)?a(T,c[B]):f(B,T,v)}}o(p,"replaceWord");function d(c,m,v,T){return function(B){var M=B.toLowerCase();return m.hasOwnProperty(M)?!0:c.hasOwnProperty(M)?!1:f(M,M,v)===M}}o(d,"checkWord");function b(c,m,v){var T=m===1?b.singular(c):b.plural(c);return(v?m+" ":"")+T}return o(b,"pluralize"),b.plural=p(i,n,t),b.isPlural=d(i,n,t),b.singular=p(n,i,e),b.isSingular=d(n,i,e),b.addPluralRule=function(c,m){t.push([s(c),m])},b.addSingularRule=function(c,m){e.push([s(c),m])},b.addUncountableRule=function(c){if(typeof c=="string"){r[c.toLowerCase()]=!0;return}b.addPluralRule(c,"$0"),b.addSingularRule(c,"$0")},b.addIrregularRule=function(c,m){m=m.toLowerCase(),c=c.toLowerCase(),i[c]=m,n[m]=c},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(c){return b.addIrregularRule(c[0],c[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(c){return b.addPluralRule(c[0],c[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(c){return b.addSingularRule(c[0],c[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(b.addUncountableRule),b})});var Vn=U((Dc,Wn)=>{"use strict";h();var Gn=12,Js=0,gr=[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 Ks(t){var e=t.indexOf("%");if(e===-1)return t;for(var r=t.length,n="",i=0,s=0,a=e,u=Gn;e>-1&&e<r;){var l=jn(t[e+1],4),f=jn(t[e+2],0),p=l|f,d=gr[p];if(u=gr[256+u+d],s=s<<6|p&gr[364+d],u===Gn)n+=t.slice(i,a),n+=s<=65535?String.fromCharCode(s):String.fromCharCode(55232+(s>>10),56320+(s&1023)),s=0,i=e+3,e=a=t.indexOf("%",i);else{if(u===Js)return null;if(e+=3,e<r&&t.charCodeAt(e)===37)continue;return null}}return n+t.slice(i)}o(Ks,"decodeURIComponent");var Zs={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 jn(t,e){var r=Zs[t];return r===void 0?255:r<<e}o(jn,"hexCodeToInt");Wn.exports=Ks});var Jn=U((Nc,Yn)=>{"use strict";h();var zn=Vn(),Hn=/\+/g,Qn=o(function(){},"Empty");Qn.prototype=Object.create(null);function Xs(t){let e=new Qn;if(typeof t!="string")return e;let r=t.length,n="",i="",s=-1,a=-1,u=!1,l=!1,f=!1,p=!1,d=!1,b=0;for(let c=0;c<r+1;c++)if(b=c!==r?t.charCodeAt(c):38,b===38){if(d=a>s,d||(a=c),n=t.slice(s+1,a),d||n.length>0){f&&(n=n.replace(Hn," ")),u&&(n=zn(n)||n),d&&(i=t.slice(a+1,c),p&&(i=i.replace(Hn," ")),l&&(i=zn(i)||i));let m=e[n];m===void 0?e[n]=i:m.pop?m.push(i):e[n]=[m,i]}i="",s=c,a=c,u=!1,l=!1,f=!1,p=!1}else b===61?a<=s?a=c:l=!0:b===43?a>s?p=!0:f=!0:b===37&&(a>s?l=!0:u=!0);return e}o(Xs,"parse");Yn.exports=Xs});var Zn=U((Mc,Kn)=>{h();var ve=Array.from({length:256},(t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase()),eo=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 to(t){let e=t.length;if(e===0)return"";let r="",n=0,i=0;e:for(;i<e;i++){let s=t.charCodeAt(i);for(;s<128;){if(eo[s]!==1&&(n<i&&(r+=t.slice(n,i)),n=i+1,r+=ve[s]),++i===e)break e;s=t.charCodeAt(i)}if(n<i&&(r+=t.slice(n,i)),s<2048){n=i+1,r+=ve[192|s>>6]+ve[128|s&63];continue}if(s<55296||s>=57344){n=i+1,r+=ve[224|s>>12]+ve[128|s>>6&63]+ve[128|s&63];continue}if(++i,i>=e)throw new Error("URI malformed");let a=t.charCodeAt(i)&1023;n=i+1,s=65536+((s&1023)<<10|a),r+=ve[240|s>>18]+ve[128|s>>12&63]+ve[128|s>>6&63]+ve[128|s&63]}return n===0?t:n<e?r+t.slice(n):r}o(to,"encodeString");Kn.exports={encodeString:to}});var ti=U((Fc,ei)=>{"use strict";h();var{encodeString:yr}=Zn();function Xn(t){let e=typeof t;return e==="string"?yr(t):e==="bigint"?t.toString():e==="boolean"?t?"true":"false":e==="number"&&Number.isFinite(t)?t<1e21?""+t:yr(""+t):""}o(Xn,"getAsPrimitive");function ro(t){let e="";if(t===null||typeof t!="object")return e;let r="&",n=Object.keys(t),i=n.length,s=0;for(let a=0;a<i;a++){let u=n[a],l=t[u],f=yr(u)+"=";if(a&&(e+=r),Array.isArray(l)){s=l.length;for(let p=0;p<s;p++)p&&(e+=r),e+=f,e+=Xn(l[p])}else e+=f,e+=Xn(l)}return e}o(ro,"stringify");ei.exports=ro});var si=U((Wc,ct)=>{"use strict";h();var ri=Jn(),ni=ti(),ii={parse:ri,stringify:ni};ct.exports=ii;ct.exports.default=ii;ct.exports.parse=ri;ct.exports.stringify=ni});var wi=U((xf,Tr)=>{"use strict";h();var wo=Object.prototype.hasOwnProperty,oe="~";function ut(){}o(ut,"Events");Object.create&&(ut.prototype=Object.create(null),new ut().__proto__||(oe=!1));function vo(t,e,r){this.fn=t,this.context=e,this.once=r||!1}o(vo,"EE");function xi(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new vo(r,n||t,i),a=oe?oe+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],s]:t._events[a].push(s):(t._events[a]=s,t._eventsCount++),t}o(xi,"addListener");function At(t,e){--t._eventsCount===0?t._events=new ut:delete t._events[e]}o(At,"clearEvent");function te(){this._events=new ut,this._eventsCount=0}o(te,"EventEmitter");te.prototype.eventNames=o(function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)wo.call(r,n)&&e.push(oe?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},"eventNames");te.prototype.listeners=o(function(e){var r=oe?oe+e:e,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,a=new Array(s);i<s;i++)a[i]=n[i].fn;return a},"listeners");te.prototype.listenerCount=o(function(e){var r=oe?oe+e:e,n=this._events[r];return n?n.fn?1:n.length:0},"listenerCount");te.prototype.emit=o(function(e,r,n,i,s,a){var u=oe?oe+e:e;if(!this._events[u])return!1;var l=this._events[u],f=arguments.length,p,d;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,r),!0;case 3:return l.fn.call(l.context,r,n),!0;case 4:return l.fn.call(l.context,r,n,i),!0;case 5:return l.fn.call(l.context,r,n,i,s),!0;case 6:return l.fn.call(l.context,r,n,i,s,a),!0}for(d=1,p=new Array(f-1);d<f;d++)p[d-1]=arguments[d];l.fn.apply(l.context,p)}else{var b=l.length,c;for(d=0;d<b;d++)switch(l[d].once&&this.removeListener(e,l[d].fn,void 0,!0),f){case 1:l[d].fn.call(l[d].context);break;case 2:l[d].fn.call(l[d].context,r);break;case 3:l[d].fn.call(l[d].context,r,n);break;case 4:l[d].fn.call(l[d].context,r,n,i);break;default:if(!p)for(c=1,p=new Array(f-1);c<f;c++)p[c-1]=arguments[c];l[d].fn.apply(l[d].context,p)}}return!0},"emit");te.prototype.on=o(function(e,r,n){return xi(this,e,r,n,!1)},"on");te.prototype.once=o(function(e,r,n){return xi(this,e,r,n,!0)},"once");te.prototype.removeListener=o(function(e,r,n,i){var s=oe?oe+e:e;if(!this._events[s])return this;if(!r)return At(this,s),this;var a=this._events[s];if(a.fn)a.fn===r&&(!i||a.once)&&(!n||a.context===n)&&At(this,s);else{for(var u=0,l=[],f=a.length;u<f;u++)(a[u].fn!==r||i&&!a[u].once||n&&a[u].context!==n)&&l.push(a[u]);l.length?this._events[s]=l.length===1?l[0]:l:At(this,s)}return this},"removeListener");te.prototype.removeAllListeners=o(function(e){var r;return e?(r=oe?oe+e:e,this._events[r]&&At(this,r)):(this._events=new ut,this._eventsCount=0),this},"removeAllListeners");te.prototype.off=te.prototype.removeListener;te.prototype.addListener=te.prototype.on;te.prefixed=oe;te.EventEmitter=te;typeof Tr<"u"&&(Tr.exports=te)});var Li=U((Ff,Oi)=>{"use strict";h();var{Duplex:Eo}=j("stream");function Si(t){t.emit("close")}o(Si,"emitClose");function So(){!this.destroyed&&this._writableState.finished&&this.destroy()}o(So,"duplexOnEnd");function Ti(t){this.removeListener("error",Ti),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}o(Ti,"duplexOnError");function To(t,e){let r=!0,n=new Eo({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return t.on("message",o(function(s,a){let u=!a&&n._readableState.objectMode?s.toString():s;n.push(u)||t.pause()},"message")),t.once("error",o(function(s){n.destroyed||(r=!1,n.destroy(s))},"error")),t.once("close",o(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(i,s){if(t.readyState===t.CLOSED){s(i),process.nextTick(Si,n);return}let a=!1;t.once("error",o(function(l){a=!0,s(l)},"error")),t.once("close",o(function(){a||s(i),process.nextTick(Si,n)},"close")),r&&t.terminate()},n._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",o(function(){n._final(i)},"open"));return}t._socket!==null&&(t._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(t._socket.once("finish",o(function(){i()},"finish")),t.close()))},n._read=function(){t.isPaused&&t.resume()},n._write=function(i,s,a){if(t.readyState===t.CONNECTING){t.once("open",o(function(){n._write(i,s,a)},"open"));return}t.send(i,a)},n.on("end",So),n.on("error",Ti),n}o(To,"createWebSocketStream");Oi.exports=To});var Le=U((Wf,Ri)=>{"use strict";h();var ki=["nodebuffer","arraybuffer","fragments"],Ci=typeof Blob<"u";Ci&&ki.push("blob");Ri.exports={BINARY_TYPES:ki,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Ci,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:o(()=>{},"NOOP")}});var pt=U((Hf,Nt)=>{"use strict";h();var{EMPTY_BUFFER:Oo}=Le(),Rr=Buffer[Symbol.species];function Lo(t,e){if(t.length===0)return Oo;if(t.length===1)return t[0];let r=Buffer.allocUnsafe(e),n=0;for(let i=0;i<t.length;i++){let s=t[i];r.set(s,n),n+=s.length}return n<e?new Rr(r.buffer,r.byteOffset,n):r}o(Lo,"concat");function Bi(t,e,r,n,i){for(let s=0;s<i;s++)r[n+s]=t[s]^e[s&3]}o(Bi,"_mask");function Di(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}o(Di,"_unmask");function ko(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}o(ko,"toArrayBuffer");function Br(t){if(Br.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Rr(t):ArrayBuffer.isView(t)?e=new Rr(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Br.readOnly=!1),e}o(Br,"toBuffer");Nt.exports={concat:Lo,mask:Bi,toArrayBuffer:ko,toBuffer:Br,unmask:Di};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=j("bufferutil");Nt.exports.mask=function(e,r,n,i,s){s<48?Bi(e,r,n,i,s):t.mask(e,r,n,i,s)},Nt.exports.unmask=function(e,r){e.length<32?Di(e,r):t.unmask(e,r)}}catch{}});var Ni=U((Jf,Ai)=>{"use strict";h();var $i=Symbol("kDone"),Dr=Symbol("kRun"),$r=class{static{o(this,"Limiter")}constructor(e){this[$i]=()=>{this.pending--,this[Dr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Dr]()}[Dr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[$i])}}};Ai.exports=$r});var yt=U((Xf,Ui)=>{"use strict";h();var mt=j("zlib"),Ii=pt(),Co=Ni(),{kStatusCode:Pi}=Le(),Ro=Buffer[Symbol.species],Bo=Buffer.from([0,0,255,255]),Mt=Symbol("permessage-deflate"),ke=Symbol("total-length"),gt=Symbol("callback"),Ne=Symbol("buffers"),Pt=Symbol("error"),It,Ar=class{static{o(this,"PerMessageDeflate")}constructor(e,r,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!It){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;It=new Co(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[gt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let r=this._options,n=e.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let r=e[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(e){return e.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),e}decompress(e,r,n){It.add(i=>{this._decompress(e,r,(s,a)=>{i(),n(s,a)})})}compress(e,r,n){It.add(i=>{this._compress(e,r,(s,a)=>{i(),n(s,a)})})}_decompress(e,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let s=`${i}_max_window_bits`,a=typeof this.params[s]!="number"?mt.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=mt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Mt]=this,this._inflate[ke]=0,this._inflate[Ne]=[],this._inflate.on("error",$o),this._inflate.on("data",Mi)}this._inflate[gt]=n,this._inflate.write(e),r&&this._inflate.write(Bo),this._inflate.flush(()=>{let s=this._inflate[Pt];if(s){this._inflate.close(),this._inflate=null,n(s);return}let a=Ii.concat(this._inflate[Ne],this._inflate[ke]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ke]=0,this._inflate[Ne]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,a)})}_compress(e,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let s=`${i}_max_window_bits`,a=typeof this.params[s]!="number"?mt.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=mt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[ke]=0,this._deflate[Ne]=[],this._deflate.on("data",Do)}this._deflate[gt]=n,this._deflate.write(e),this._deflate.flush(mt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=Ii.concat(this._deflate[Ne],this._deflate[ke]);r&&(s=new Ro(s.buffer,s.byteOffset,s.length-4)),this._deflate[gt]=null,this._deflate[ke]=0,this._deflate[Ne]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};Ui.exports=Ar;function Do(t){this[Ne].push(t),this[ke]+=t.length}o(Do,"deflateOnData");function Mi(t){if(this[ke]+=t.length,this[Mt]._maxPayload<1||this[ke]<=this[Mt]._maxPayload){this[Ne].push(t);return}this[Pt]=new RangeError("Max payload size exceeded"),this[Pt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Pt][Pi]=1009,this.removeListener("data",Mi),this.reset()}o(Mi,"inflateOnData");function $o(t){this[Mt]._inflate=null,t[Pi]=1007,this[gt](t)}o($o,"inflateOnError")});var Ze=U((rh,Ut)=>{"use strict";h();var{isUtf8:qi}=j("buffer"),{hasBlob:Ao}=Le(),No=[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 Io(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}o(Io,"isValidStatusCode");function Nr(t){let e=t.length,r=0;for(;r<e;)if((t[r]&128)===0)r++;else if((t[r]&224)===192){if(r+1===e||(t[r+1]&192)!==128||(t[r]&254)===192)return!1;r+=2}else if((t[r]&240)===224){if(r+2>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||t[r]===224&&(t[r+1]&224)===128||t[r]===237&&(t[r+1]&224)===160)return!1;r+=3}else if((t[r]&248)===240){if(r+3>=e||(t[r+1]&192)!==128||(t[r+2]&192)!==128||(t[r+3]&192)!==128||t[r]===240&&(t[r+1]&240)===128||t[r]===244&&t[r+1]>143||t[r]>244)return!1;r+=4}else return!1;return!0}o(Nr,"_isValidUTF8");function Po(t){return Ao&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}o(Po,"isBlob");Ut.exports={isBlob:Po,isValidStatusCode:Io,isValidUTF8:Nr,tokenChars:No};if(qi)Ut.exports.isValidUTF8=function(t){return t.length<24?Nr(t):qi(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=j("utf-8-validate");Ut.exports.isValidUTF8=function(e){return e.length<32?Nr(e):t(e)}}catch{}});var qr=U((sh,Hi)=>{"use strict";h();var{Writable:Mo}=j("stream"),Fi=yt(),{BINARY_TYPES:Uo,EMPTY_BUFFER:Gi,kStatusCode:qo,kWebSocket:Fo}=Le(),{concat:Ir,toArrayBuffer:Go,unmask:jo}=pt(),{isValidStatusCode:Wo,isValidUTF8:ji}=Ze(),qt=Buffer[Symbol.species],de=0,Wi=1,Vi=2,zi=3,Pr=4,Mr=5,Ft=6,Ur=class extends Mo{static{o(this,"Receiver")}constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Uo[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Fo]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=de}_write(e,r,n){if(this._opcode===8&&this._state==de)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new qt(n.buffer,n.byteOffset+e,n.length-e),new qt(n.buffer,n.byteOffset,e)}let r=Buffer.allocUnsafe(e);do{let n=this._buffers[0],i=r.length-e;e>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,e),i),this._buffers[0]=new qt(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return r}startLoop(e){this._loop=!0;do switch(this._state){case de:this.getInfo(e);break;case Wi:this.getPayloadLength16(e);break;case Vi:this.getPayloadLength64(e);break;case zi:this.getMask();break;case Pr:this.getData(e);break;case Mr:case Ft:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[Fi.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(n){let i=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else{let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=Wi:this._payloadLength===127?this._state=Vi:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(r);return}this._masked?this._state=zi:this._state=Pr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Pr}getData(e){let r=Gi;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])!==0&&jo(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Mr,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[Fi.extensionName].decompress(e,this._fin,(i,s)=>{if(i)return r(i);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let a=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(a);return}this._fragments.push(s)}this.dataMessage(r),this._state===de&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=de;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=Ir(n,r):this._binaryType==="arraybuffer"?i=Go(Ir(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=de):(this._state=Ft,setImmediate(()=>{this.emit("message",i,!0),this._state=de,this.startLoop(e)}))}else{let i=Ir(n,r);if(!this._skipUTF8Validation&&!ji(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Mr||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=de):(this._state=Ft,setImmediate(()=>{this.emit("message",i,!1),this._state=de,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Gi),this.end();else{let n=e.readUInt16BE(0);if(!Wo(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let i=new qt(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!ji(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",n,i),this.end()}this._state=de;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=de):(this._state=Ft,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=de,this.startLoop(r)}))}createError(e,r,n,i,s){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(a,this.createError),a.code=s,a[qo]=i,a}};Hi.exports=Ur});var jr=U((ch,Ji)=>{"use strict";h();var{Duplex:lh}=j("stream"),{randomFillSync:Vo}=j("crypto"),Qi=yt(),{EMPTY_BUFFER:zo,kWebSocket:Ho,NOOP:Qo}=Le(),{isBlob:Xe,isValidStatusCode:Yo}=Ze(),{mask:Yi,toBuffer:Ue}=pt(),pe=Symbol("kByteLength"),Jo=Buffer.alloc(4),Gt=8*1024,qe,et=Gt,_e=0,Ko=1,Zo=2,Fr=class t{static{o(this,"Sender")}constructor(e,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=_e,this.onerror=Qo,this[Ho]=void 0}static frame(e,r){let n,i=!1,s=2,a=!1;r.mask&&(n=r.maskBuffer||Jo,r.generateMask?r.generateMask(n):(et===Gt&&(qe===void 0&&(qe=Buffer.alloc(Gt)),Vo(qe,0,Gt),et=0),n[0]=qe[et++],n[1]=qe[et++],n[2]=qe[et++],n[3]=qe[et++]),a=(n[0]|n[1]|n[2]|n[3])===0,s=6);let u;typeof e=="string"?(!r.mask||a)&&r[pe]!==void 0?u=r[pe]:(e=Buffer.from(e),u=e.length):(u=e.length,i=r.mask&&r.readOnly&&!a);let l=u;u>=65536?(s+=8,l=127):u>125&&(s+=2,l=126);let f=Buffer.allocUnsafe(i?u+s:s);return f[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(f[0]|=64),f[1]=l,l===126?f.writeUInt16BE(u,2):l===127&&(f[2]=f[3]=0,f.writeUIntBE(u,4,6)),r.mask?(f[1]|=128,f[s-4]=n[0],f[s-3]=n[1],f[s-2]=n[2],f[s-1]=n[3],a?[f,e]:i?(Yi(e,n,f,s,u),[f]):(Yi(e,n,e,0,u),[f,e])):[f,e]}close(e,r,n,i){let s;if(e===void 0)s=zo;else{if(typeof e!="number"||!Yo(e))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let u=Buffer.byteLength(r);if(u>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+u),s.writeUInt16BE(e,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let a={[pe]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?this.enqueue([this.dispatch,s,!1,a,i]):this.sendFrame(t.frame(s,a),i)}ping(e,r,n){let i,s;if(typeof e=="string"?(i=Buffer.byteLength(e),s=!1):Xe(e)?(i=e.size,s=!1):(e=Ue(e),i=e.length,s=Ue.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[pe]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Xe(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==_e?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}pong(e,r,n){let i,s;if(typeof e=="string"?(i=Buffer.byteLength(e),s=!1):Xe(e)?(i=e.size,s=!1):(e=Ue(e),i=e.length,s=Ue.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[pe]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Xe(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==_e?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}send(e,r,n){let i=this._extensions[Qi.extensionName],s=r.binary?2:1,a=r.compress,u,l;typeof e=="string"?(u=Buffer.byteLength(e),l=!1):Xe(e)?(u=e.size,l=!1):(e=Ue(e),u=e.length,l=Ue.readOnly),this._firstFragment?(this._firstFragment=!1,a&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(a=u>=i._threshold),this._compress=a):(a=!1,s=0),r.fin&&(this._firstFragment=!0);let f={[pe]:u,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:l,rsv1:a};Xe(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,f,n]):this.getBlobData(e,this._compress,f,n):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,f,n]):this.dispatch(e,this._compress,f,n)}getBlobData(e,r,n,i){this._bufferedBytes+=n[pe],this._state=Zo,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let u=new Error("The socket was closed while the blob was being read");process.nextTick(Gr,this,u,i);return}this._bufferedBytes-=n[pe];let a=Ue(s);r?this.dispatch(a,r,n,i):(this._state=_e,this.sendFrame(t.frame(a,n),i),this.dequeue())}).catch(s=>{process.nextTick(Xo,this,s,i)})}dispatch(e,r,n,i){if(!r){this.sendFrame(t.frame(e,n),i);return}let s=this._extensions[Qi.extensionName];this._bufferedBytes+=n[pe],this._state=Ko,s.compress(e,n.fin,(a,u)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Gr(this,l,i);return}this._bufferedBytes-=n[pe],this._state=_e,n.readOnly=!1,this.sendFrame(t.frame(u,n),i),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][pe],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][pe],this._queue.push(e)}sendFrame(e,r){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],r),this._socket.uncork()):this._socket.write(e[0],r)}};Ji.exports=Fr;function Gr(t,e,r){typeof r=="function"&&r(e);for(let n=0;n<t._queue.length;n++){let i=t._queue[n],s=i[i.length-1];typeof s=="function"&&s(e)}}o(Gr,"callCallbacks");function Xo(t,e,r){Gr(t,e,r),t.onerror(e)}o(Xo,"onError")});var ss=U((hh,is)=>{"use strict";h();var{kForOnEventAttribute:bt,kListener:Wr}=Le(),Ki=Symbol("kCode"),Zi=Symbol("kData"),Xi=Symbol("kError"),es=Symbol("kMessage"),ts=Symbol("kReason"),tt=Symbol("kTarget"),rs=Symbol("kType"),ns=Symbol("kWasClean"),Ce=class{static{o(this,"Event")}constructor(e){this[tt]=null,this[rs]=e}get target(){return this[tt]}get type(){return this[rs]}};Object.defineProperty(Ce.prototype,"target",{enumerable:!0});Object.defineProperty(Ce.prototype,"type",{enumerable:!0});var Fe=class extends Ce{static{o(this,"CloseEvent")}constructor(e,r={}){super(e),this[Ki]=r.code===void 0?0:r.code,this[ts]=r.reason===void 0?"":r.reason,this[ns]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Ki]}get reason(){return this[ts]}get wasClean(){return this[ns]}};Object.defineProperty(Fe.prototype,"code",{enumerable:!0});Object.defineProperty(Fe.prototype,"reason",{enumerable:!0});Object.defineProperty(Fe.prototype,"wasClean",{enumerable:!0});var rt=class extends Ce{static{o(this,"ErrorEvent")}constructor(e,r={}){super(e),this[Xi]=r.error===void 0?null:r.error,this[es]=r.message===void 0?"":r.message}get error(){return this[Xi]}get message(){return this[es]}};Object.defineProperty(rt.prototype,"error",{enumerable:!0});Object.defineProperty(rt.prototype,"message",{enumerable:!0});var _t=class extends Ce{static{o(this,"MessageEvent")}constructor(e,r={}){super(e),this[Zi]=r.data===void 0?null:r.data}get data(){return this[Zi]}};Object.defineProperty(_t.prototype,"data",{enumerable:!0});var ea={addEventListener(t,e,r={}){for(let i of this.listeners(t))if(!r[bt]&&i[Wr]===e&&!i[bt])return;let n;if(t==="message")n=o(function(s,a){let u=new _t("message",{data:a?s:s.toString()});u[tt]=this,jt(e,this,u)},"onMessage");else if(t==="close")n=o(function(s,a){let u=new Fe("close",{code:s,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});u[tt]=this,jt(e,this,u)},"onClose");else if(t==="error")n=o(function(s){let a=new rt("error",{error:s,message:s.message});a[tt]=this,jt(e,this,a)},"onError");else if(t==="open")n=o(function(){let s=new Ce("open");s[tt]=this,jt(e,this,s)},"onOpen");else return;n[bt]=!!r[bt],n[Wr]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Wr]===e&&!r[bt]){this.removeListener(t,r);break}}};is.exports={CloseEvent:Fe,ErrorEvent:rt,Event:Ce,EventTarget:ea,MessageEvent:_t};function jt(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}o(jt,"callListener")});var Vr=U((mh,os)=>{"use strict";h();var{tokenChars:xt}=Ze();function Ee(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}o(Ee,"push");function ta(t){let e=Object.create(null),r=Object.create(null),n=!1,i=!1,s=!1,a,u,l=-1,f=-1,p=-1,d=0;for(;d<t.length;d++)if(f=t.charCodeAt(d),a===void 0)if(p===-1&&xt[f]===1)l===-1&&(l=d);else if(d!==0&&(f===32||f===9))p===-1&&l!==-1&&(p=d);else if(f===59||f===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let c=t.slice(l,p);f===44?(Ee(e,c,r),r=Object.create(null)):a=c,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===void 0)if(p===-1&&xt[f]===1)l===-1&&(l=d);else if(f===32||f===9)p===-1&&l!==-1&&(p=d);else if(f===59||f===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d),Ee(r,t.slice(l,p),!0),f===44&&(Ee(e,a,r),r=Object.create(null),a=void 0),l=p=-1}else if(f===61&&l!==-1&&p===-1)u=t.slice(l,d),l=p=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(i){if(xt[f]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);l===-1?l=d:n||(n=!0),i=!1}else if(s)if(xt[f]===1)l===-1&&(l=d);else if(f===34&&l!==-1)s=!1,p=d;else if(f===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(f===34&&t.charCodeAt(d-1)===61)s=!0;else if(p===-1&&xt[f]===1)l===-1&&(l=d);else if(l!==-1&&(f===32||f===9))p===-1&&(p=d);else if(f===59||f===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let c=t.slice(l,p);n&&(c=c.replace(/\\/g,""),n=!1),Ee(r,u,c),f===44&&(Ee(e,a,r),r=Object.create(null),a=void 0),u=void 0,l=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(l===-1||s||f===32||f===9)throw new SyntaxError("Unexpected end of input");p===-1&&(p=d);let b=t.slice(l,p);return a===void 0?Ee(e,b,r):(u===void 0?Ee(r,b,!0):n?Ee(r,u,b.replace(/\\/g,"")):Ee(r,u,b),Ee(e,a,r)),e}o(ta,"parse");function ra(t){return Object.keys(t).map(e=>{let r=t[e];return Array.isArray(r)||(r=[r]),r.map(n=>[e].concat(Object.keys(n).map(i=>{let s=n[i];return Array.isArray(s)||(s=[s]),s.map(a=>a===!0?i:`${i}=${a}`).join("; ")})).join("; ")).join(", ")}).join(", ")}o(ra,"format");os.exports={format:ra,parse:ta}});var Jr=U((xh,bs)=>{"use strict";h();var na=j("events"),ia=j("https"),sa=j("http"),cs=j("net"),oa=j("tls"),{randomBytes:aa,createHash:la}=j("crypto"),{Duplex:bh,Readable:_h}=j("stream"),{URL:zr}=j("url"),Ie=yt(),ca=qr(),ua=jr(),{isBlob:fa}=Ze(),{BINARY_TYPES:as,EMPTY_BUFFER:Wt,GUID:ha,kForOnEventAttribute:Hr,kListener:da,kStatusCode:pa,kWebSocket:ee,NOOP:us}=Le(),{EventTarget:{addEventListener:ma,removeEventListener:ga}}=ss(),{format:ya,parse:ba}=Vr(),{toBuffer:_a}=pt(),xa=30*1e3,fs=Symbol("kAborted"),Qr=[8,13],Re=["CONNECTING","OPEN","CLOSING","CLOSED"],wa=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,V=class t extends na{static{o(this,"WebSocket")}constructor(e,r,n){super(),this._binaryType=as[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Wt,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),hs(this,e,r,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){as.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,r,n){let i=new ca({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new ua(e,this._extensions,n.generateMask);this._receiver=i,this._sender=s,this._socket=e,i[ee]=this,s[ee]=this,e[ee]=this,i.on("conclude",Sa),i.on("drain",Ta),i.on("error",Oa),i.on("message",La),i.on("ping",ka),i.on("pong",Ca),s.onerror=Ra,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",ms),e.on("data",zt),e.on("end",gs),e.on("error",ys),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,r){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ps(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Yr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Wt,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Yr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Wt,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Yr(this,e,n);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Ie.extensionName]||(i.compress=!1),this._sender.send(e||Wt,i,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(V,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(V.prototype,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(V,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(V.prototype,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(V,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(V.prototype,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(V,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});Object.defineProperty(V.prototype,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(V.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(V.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[Hr])return e[da];return null},set(e){for(let r of this.listeners(t))if(r[Hr]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[Hr]:!0})}})});V.prototype.addEventListener=ma;V.prototype.removeEventListener=ga;bs.exports=V;function hs(t,e,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Qr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,!Qr.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Qr.join(", ")})`);let s;if(e instanceof zr)s=e;else try{s=new zr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),t._url=s.href;let a=s.protocol==="wss:",u=s.protocol==="ws+unix:",l;if(s.protocol!=="ws:"&&!a&&!u?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:u&&!s.pathname?l="The URL's pathname is empty":s.hash&&(l="The URL contains a fragment identifier"),l){let v=new SyntaxError(l);if(t._redirects===0)throw v;Vt(t,v);return}let f=a?443:80,p=aa(16).toString("base64"),d=a?ia.request:sa.request,b=new Set,c;if(i.createConnection=i.createConnection||(a?Ea:va),i.defaultPort=i.defaultPort||f,i.port=s.port||f,i.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":p,Connection:"Upgrade",Upgrade:"websocket"},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(c=new Ie(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=ya({[Ie.extensionName]:c.offer()})),r.length){for(let v of r){if(typeof v!="string"||!wa.test(v)||b.has(v))throw new SyntaxError("An invalid or duplicated subprotocol was specified");b.add(v)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(s.username||s.password)&&(i.auth=`${s.username}:${s.password}`),u){let v=i.path.split(":");i.socketPath=v[0],i.path=v[1]}let m;if(i.followRedirects){if(t._redirects===0){t._originalIpc=u,t._originalSecure=a,t._originalHostOrSocketPath=u?i.socketPath:s.host;let v=n&&n.headers;if(n={...n,headers:{}},v)for(let[T,B]of Object.entries(v))n.headers[T.toLowerCase()]=B}else if(t.listenerCount("redirect")===0){let v=u?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!v||t._originalSecure&&!a)&&(delete i.headers.authorization,delete i.headers.cookie,v||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),m=t._req=d(i),t._redirects&&t.emit("redirect",t.url,m)}else m=t._req=d(i);i.timeout&&m.on("timeout",()=>{fe(t,m,"Opening handshake has timed out")}),m.on("error",v=>{m===null||m[fs]||(m=t._req=null,Vt(t,v))}),m.on("response",v=>{let T=v.headers.location,B=v.statusCode;if(T&&i.followRedirects&&B>=300&&B<400){if(++t._redirects>i.maxRedirects){fe(t,m,"Maximum redirects exceeded");return}m.abort();let M;try{M=new zr(T,e)}catch{let k=new SyntaxError(`Invalid URL: ${T}`);Vt(t,k);return}hs(t,M,r,n)}else t.emit("unexpected-response",m,v)||fe(t,m,`Unexpected server response: ${v.statusCode}`)}),m.on("upgrade",(v,T,B)=>{if(t.emit("upgrade",v),t.readyState!==V.CONNECTING)return;m=t._req=null;let M=v.headers.upgrade;if(M===void 0||M.toLowerCase()!=="websocket"){fe(t,T,"Invalid Upgrade header");return}let J=la("sha1").update(p+ha).digest("base64");if(v.headers["sec-websocket-accept"]!==J){fe(t,T,"Invalid Sec-WebSocket-Accept header");return}let k=v.headers["sec-websocket-protocol"],H;if(k!==void 0?b.size?b.has(k)||(H="Server sent an invalid subprotocol"):H="Server sent a subprotocol but none was requested":b.size&&(H="Server sent no subprotocol"),H){fe(t,T,H);return}k&&(t._protocol=k);let K=v.headers["sec-websocket-extensions"];if(K!==void 0){if(!c){fe(t,T,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let z;try{z=ba(K)}catch{fe(t,T,"Invalid Sec-WebSocket-Extensions header");return}let N=Object.keys(z);if(N.length!==1||N[0]!==Ie.extensionName){fe(t,T,"Server indicated an extension that was not requested");return}try{c.accept(z[Ie.extensionName])}catch{fe(t,T,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[Ie.extensionName]=c}t.setSocket(T,B,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,t):m.end()}o(hs,"initAsClient");function Vt(t,e){t._readyState=V.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}o(Vt,"emitErrorAndClose");function va(t){return t.path=t.socketPath,cs.connect(t)}o(va,"netConnect");function Ea(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=cs.isIP(t.host)?"":t.host),oa.connect(t)}o(Ea,"tlsConnect");function fe(t,e,r){t._readyState=V.CLOSING;let n=new Error(r);Error.captureStackTrace(n,fe),e.setHeader?(e[fs]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Vt,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}o(fe,"abortHandshake");function Yr(t,e,r){if(e){let n=fa(e)?e.size:_a(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${Re[t.readyState]})`);process.nextTick(r,n)}}o(Yr,"sendAfterClose");function Sa(t,e){let r=this[ee];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[ee]!==void 0&&(r._socket.removeListener("data",zt),process.nextTick(ds,r._socket),t===1005?r.close():r.close(t,e))}o(Sa,"receiverOnConclude");function Ta(){let t=this[ee];t.isPaused||t._socket.resume()}o(Ta,"receiverOnDrain");function Oa(t){let e=this[ee];e._socket[ee]!==void 0&&(e._socket.removeListener("data",zt),process.nextTick(ds,e._socket),e.close(t[pa])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}o(Oa,"receiverOnError");function ls(){this[ee].emitClose()}o(ls,"receiverOnFinish");function La(t,e){this[ee].emit("message",t,e)}o(La,"receiverOnMessage");function ka(t){let e=this[ee];e._autoPong&&e.pong(t,!this._isServer,us),e.emit("ping",t)}o(ka,"receiverOnPing");function Ca(t){this[ee].emit("pong",t)}o(Ca,"receiverOnPong");function ds(t){t.resume()}o(ds,"resume");function Ra(t){let e=this[ee];e.readyState!==V.CLOSED&&(e.readyState===V.OPEN&&(e._readyState=V.CLOSING,ps(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}o(Ra,"senderOnError");function ps(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),xa)}o(ps,"setCloseTimer");function ms(){let t=this[ee];this.removeListener("close",ms),this.removeListener("data",zt),this.removeListener("end",gs),t._readyState=V.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[ee]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",ls),t._receiver.on("finish",ls))}o(ms,"socketOnClose");function zt(t){this[ee]._receiver.write(t)||this.pause()}o(zt,"socketOnData");function gs(){let t=this[ee];t._readyState=V.CLOSING,t._receiver.end(),this.end()}o(gs,"socketOnEnd");function ys(){let t=this[ee];this.removeListener("error",ys),this.on("error",us),t&&(t._readyState=V.CLOSING,this.destroy())}o(ys,"socketOnError")});var xs=U((Eh,_s)=>{"use strict";h();var{tokenChars:Ba}=Ze();function Da(t){let e=new Set,r=-1,n=-1,i=0;for(i;i<t.length;i++){let a=t.charCodeAt(i);if(n===-1&&Ba[a]===1)r===-1&&(r=i);else if(i!==0&&(a===32||a===9))n===-1&&r!==-1&&(n=i);else if(a===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let u=t.slice(r,n);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);e.add(u),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=t.slice(r,i);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}o(Da,"parse");_s.exports={parse:Da}});var Ls=U((Lh,Os)=>{"use strict";h();var $a=j("events"),Ht=j("http"),{Duplex:Oh}=j("stream"),{createHash:Aa}=j("crypto"),ws=Vr(),Ge=yt(),Na=xs(),Ia=Jr(),{GUID:Pa,kWebSocket:Ma}=Le(),Ua=/^[+/0-9A-Za-z]{22}==$/,vs=0,Es=1,Ts=2,Kr=class extends $a{static{o(this,"WebSocketServer")}constructor(e,r){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Ia,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ht.createServer((n,i)=>{let s=Ht.STATUS_CODES[426];i.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),i.end(s)}),this._server.listen(e.port,e.host,e.backlog,r)):e.server&&(this._server=e.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=qa(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:o((i,s,a)=>{this.handleUpgrade(i,s,a,n)},"upgrade")})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=vs}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Ts){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(wt,this);return}if(e&&this.once("close",e),this._state!==Es)if(this._state=Es,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(wt,this):process.nextTick(wt,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{wt(this)})}}shouldHandle(e){if(this.options.path){let r=e.url.indexOf("?");if((r!==-1?e.url.slice(0,r):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,r,n,i){r.on("error",Ss);let s=e.headers["sec-websocket-key"],a=e.headers.upgrade,u=+e.headers["sec-websocket-version"];if(e.method!=="GET"){je(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){je(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!Ua.test(s)){je(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(u!==8&&u!==13){je(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){vt(r,400);return}let l=e.headers["sec-websocket-protocol"],f=new Set;if(l!==void 0)try{f=Na.parse(l)}catch{je(this,e,r,400,"Invalid Sec-WebSocket-Protocol header");return}let p=e.headers["sec-websocket-extensions"],d={};if(this.options.perMessageDeflate&&p!==void 0){let b=new Ge(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let c=ws.parse(p);c[Ge.extensionName]&&(b.accept(c[Ge.extensionName]),d[Ge.extensionName]=b)}catch{je(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let b={origin:e.headers[`${u===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(b,(c,m,v,T)=>{if(!c)return vt(r,m||401,v,T);this.completeUpgrade(d,s,f,e,r,n,i)});return}if(!this.options.verifyClient(b))return vt(r,401)}this.completeUpgrade(d,s,f,e,r,n,i)}completeUpgrade(e,r,n,i,s,a,u){if(!s.readable||!s.writable)return s.destroy();if(s[Ma])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>vs)return vt(s,503);let f=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Aa("sha1").update(r+Pa).digest("base64")}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let d=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;d&&(f.push(`Sec-WebSocket-Protocol: ${d}`),p._protocol=d)}if(e[Ge.extensionName]){let d=e[Ge.extensionName].params,b=ws.format({[Ge.extensionName]:[d]});f.push(`Sec-WebSocket-Extensions: ${b}`),p._extensions=e}this.emit("headers",f,i),s.write(f.concat(`\r
|
|
2
|
-
`).join(`\r
|
|
3
|
-
`)),s.removeListener("error",Ss),p.setSocket(s,a,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on("close",()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(wt,this)})),u(p,i)}};Os.exports=Kr;function qa(t,e){for(let r of Object.keys(e))t.on(r,e[r]);return o(function(){for(let n of Object.keys(e))t.removeListener(n,e[n])},"removeListeners")}o(qa,"addListeners");function wt(t){t._state=Ts,t.emit("close")}o(wt,"emitClose");function Ss(){this.destroy()}o(Ss,"socketOnError");function vt(t,e,r,n){r=r||Ht.STATUS_CODES[e],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${Ht.STATUS_CODES[e]}\r
|
|
4
|
-
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
|
5
|
-
`)+`\r
|
|
6
|
-
\r
|
|
7
|
-
`+r)}o(vt,"abortHandshake");function je(t,e,r,n,i){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,je),t.emit("wsClientError",s,r,e)}else vt(r,n,i)}o(je,"abortHandshakeOrEmitwsClientError")});h();h();var I="\x1B[",st="\x1B]",ze="\x07",kt=";",dn=process.env.TERM_PROGRAM==="Apple_Terminal",A={};A.cursorTo=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");return typeof e!="number"?I+(t+1)+"G":I+(e+1)+";"+(t+1)+"H"};A.cursorMove=(t,e)=>{if(typeof t!="number")throw new TypeError("The `x` argument is required");let r="";return t<0?r+=I+-t+"D":t>0&&(r+=I+t+"C"),e<0?r+=I+-e+"A":e>0&&(r+=I+e+"B"),r};A.cursorUp=(t=1)=>I+t+"A";A.cursorDown=(t=1)=>I+t+"B";A.cursorForward=(t=1)=>I+t+"C";A.cursorBackward=(t=1)=>I+t+"D";A.cursorLeft=I+"G";A.cursorSavePosition=dn?"\x1B7":I+"s";A.cursorRestorePosition=dn?"\x1B8":I+"u";A.cursorGetPosition=I+"6n";A.cursorNextLine=I+"E";A.cursorPrevLine=I+"F";A.cursorHide=I+"?25l";A.cursorShow=I+"?25h";A.eraseLines=t=>{let e="";for(let r=0;r<t;r++)e+=A.eraseLine+(r<t-1?A.cursorUp():"");return t&&(e+=A.cursorLeft),e};A.eraseEndLine=I+"K";A.eraseStartLine=I+"1K";A.eraseLine=I+"2K";A.eraseDown=I+"J";A.eraseUp=I+"1J";A.eraseScreen=I+"2J";A.scrollUp=I+"S";A.scrollDown=I+"T";A.clearScreen="\x1Bc";A.clearTerminal=process.platform==="win32"?`${A.eraseScreen}${I}0f`:`${A.eraseScreen}${I}3J${I}H`;A.beep=ze;A.link=(t,e)=>[st,"8",kt,kt,e,ze,t,st,"8",kt,kt,ze].join("");A.image=(t,e={})=>{let r=`${st}1337;File=inline=1`;return e.width&&(r+=`;width=${e.width}`),e.height&&(r+=`;height=${e.height}`),e.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+t.toString("base64")+ze};A.iTerm={setCwd:o((t=process.cwd())=>`${st}50;CurrentDir=${t}${ze}`,"setCwd"),annotation:o((t,e={})=>{let r=`${st}1337;`,n=typeof e.x<"u",i=typeof e.y<"u";if((n||i)&&!(n&&i&&typeof e.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return t=t.replace(/\|/g,""),r+=e.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",e.length>0?r+=(n?[t,e.length,e.x,e.y]:[e.length,t]).join("|"):r+=t,r+ze},"annotation")};var pn=A;var Ct=ie(wn(),1);function ye(t,e,{target:r="stdout",...n}={}){return Ct.default[r]?pn.link(t,e):n.fallback===!1?t:typeof n.fallback=="function"?n.fallback(t,e):`${t} (\u200B${e}\u200B)`}o(ye,"terminalLink");ye.isSupported=Ct.default.stdout;ye.stderr=(t,e,r={})=>ye(t,e,{target:"stderr",...r});ye.stderr.isSupported=Ct.default.stderr;h();import{randomUUID as Is}from"node:crypto";h();var vn=ie(Tt(),1);import sr from"node:os";var be,En=o(async(t,e)=>{e["--telemetry"]&&(be=await import("./esm-BEXWGPJL.js"),be.init({dsn:"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266",enabled:ge.productionLike&&(e["--telemetry"]??!1),release:Ve.version,environment:Ve.version.includes("experimental")?"experimental":"production"}))},"initSentry"),Sn=o(async t=>{be&&(be.captureException(t,{event_id:t.id,captureContext:{tags:{arch:G.arch,bug:t.isBug,environment:ge.value,platform:G.platform,shell:G.shell,version:Ve.version},contexts:{ctx:{argv:process.argv},cause:t.cause?ue(t.cause):void 0,app:{app_name:Ve.name,app_version:Ve.version},device:{name:sr.hostname(),family:sr.type(),arch:sr.arch()},runtime:{name:process.release.name,version:process.version}}}}),await be.flush((0,vn.default)("2s")))},"sendErrorToSentry"),Tn=o(t=>{be&&be.addBreadcrumb(t)},"addSentryBreadcrumb"),ml=o(t=>{be&&be.setUser(t)},"setSentryUser"),gl=o(t=>{be&&be.setTags(t)},"setSentryTags");var Ps=o(async(t,e)=>{if(rn(e))return t.log.debug("aborting without reporting error",{error:e}),process.exit(1);t.log.error("reporting error and exiting",{error:e});try{let r=Me.from(e);if(r.print(),r.isBug===Pe.NO)return;await Sn(r)}finally{process.exit(1)}},"reportErrorAndExit"),Rl=o(async(t,e)=>{t.log.debug("installing error handlers"),await En(t,e);let r=o(n=>void Ps(t,n),"handleError");process.once("uncaughtException",r),process.once("unhandledRejection",r)},"installErrorHandlers"),Pe=Object.freeze({YES:"yes",NO:"no",MAYBE:"maybe"}),Me=class t extends Error{static{o(this,"GGTError")}id=ge.testLike?"00000000-0000-0000-0000-000000000000":Is();cause;stack;constructor(e){super(e),Error.captureStackTrace(this,this.constructor),this.stack=en(this.stack,{pretty:!0,basePath:on})}static from(e){return e instanceof t?e:new or(e)}sprint(){let e=this.render();if(this.isBug!==Pe.NO){e=Lt(e);let r=this.isBug===Pe.YES?"This is a bug":"If you think this is a bug",n=`https://github.com/gadget-inc/ggt/issues/new?template=bug_report.yml&error-id=${this.id}`;ye.isSupported?e+=Lt({ensureEmptyLineAbove:!0,content:we`
|
|
8
|
-
${r}, ${ye("click here",n)} to create an issue on GitHub.
|
|
9
|
-
`}):e+=Lt({ensureEmptyLineAbove:!0,content:we`
|
|
10
|
-
${r}, use the link below to create an issue on GitHub.
|
|
11
|
-
|
|
12
|
-
${n}
|
|
13
|
-
`})}return e}print(e){cn({ensureEmptyLineAbove:!0,...e,content:this.sprint()})}},or=class extends Me{constructor(r){super("An unexpected error occurred");this.cause=r}static{o(this,"UnexpectedError")}isBug=Pe.YES;render(){let r=ue(this.cause),n=r.stack||r.message||this.stack;return this.message+`.
|
|
14
|
-
|
|
15
|
-
`+n}},On=class extends Me{constructor(r,n){super(r);this.cause=n}static{o(this,"EdgeCaseError")}isBug=Pe.MAYBE;render(){return this.message}};h();h();h();import Ln from"node:process";function ot(){let{env:t}=Ln,{TERM:e,TERM_PROGRAM:r}=t;return Ln.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}o(ot,"isUnicodeSupported");var kn={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"},Cn={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"},Ms={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"},ar={...kn,...Cn},Us={...kn,...Ms},qs=ot(),Fs=qs?ar:Us,Rn=Fs,Ul=Object.entries(Cn);var lr={...ge.testLike?ar:Rn};if(ot()&&G.windowsOrWsl)for(let t of["tick","cross"])lr[t]+=" ";h();var hr=ie(An(),1);import Vs from"node:assert";var nc=o(t=>t.filter(e=>!!e),"compact"),Nn=o(t=>[...new Set(t)],"uniq"),ic=o((t,e)=>(Vs(e.length>0,"options must not be empty"),[...e].sort((r,n)=>hr.default.get(r,t)-hr.default.get(n,t))),"sortBySimilar");h();var Pn=ie(In(),1);import zs from"node:assert";var De=class extends Me{constructor(r,n){super("An error occurred while communicating with Gadget");this.request=r;Kt(n)?this.cause={type:n.type,message:n.message,error:ue(n.error)}:Jt(n)?this.cause={type:n.type,code:n.code,reason:n.reason,wasClean:n.wasClean}:(zs(Ot(n)||Yt(n)||Zt(n),"cause must be a string, Error, GraphQLError[], CloseEvent, or ErrorEvent"),this.cause=n)}static{o(this,"ClientError")}isBug=Pe.MAYBE;cause;render(){let r="";switch(!0){case Zt(this.cause):{let n=Nn(this.cause.map(i=>i.message));r=we`
|
|
16
|
-
Gadget responded with the following ${(0,Pn.default)("error",n.length,!1)}:
|
|
17
|
-
|
|
18
|
-
• ${n.join(`
|
|
19
|
-
\u2022 `)}
|
|
20
|
-
`;break}case Jt(this.cause):r="The connection to Gadget closed unexpectedly.";break;case(Kt(this.cause)||Yt(this.cause)):r=this.cause.message;break;default:r=this.cause;break}return this.message+`
|
|
21
|
-
|
|
22
|
-
`+r}};h();h();import Hs from"node:assert";var Mn=o(t=>t.url instanceof URL&&t.url.host===G.domains.services,"isGadgetServicesRequest"),Qs=o(t=>{let e=un(t);return e&&`session=${encodeURIComponent(e)};`},"loadCookie"),mr=o(t=>{let e=lt(t);return Hs(e,"missing auth headers"),e},"loadAuthHeaders"),lt=o(t=>{let e=Qs(t);if(e)return t.log.trace("using cookie as auth header",{},{cookie:e}),{cookie:e};let r=hn(t);if(r)return t.log.trace("using token as auth header",{},{token:r}),{"x-platform-access-token":r}},"maybeLoadAuthHeaders"),Ys=o(t=>t instanceof nn&&t.response.statusCode===401,"isUnauthorizedError"),Ec=o((t,e)=>{if(Ys(e)){t.log.warn("swallowing unauthorized error",{error:e});return}throw e},"swallowUnauthorized");h();var pi=ie(Tt(),1);import mo from"node:assert";import{Agent as go}from"node:http";import{Agent as yo}from"node:https";h();h();h();import fo from"node:assert";h();h();var Un=o((t,e,r,n)=>JSON.stringify({level:t,name:e,msg:Xt(r).trim(),fields:qn(n)})+`
|
|
23
|
-
`,"formatJson"),qn=o(t=>{let e={};for(let[r,n]of Object.entries(t))e[r]=Fn(n);return e},"serializeFields"),Fn=o(t=>(t instanceof Set&&(t=Array.from(t)),Array.isArray(t)?t.map(Fn):(t instanceof Map&&(t=Object.fromEntries(t.entries())),We(t)?qn(t):Ot(t)?Xt(t).trim():t)),"serializeValue");h();var br=ie(Bn(),1);import no from"node:assert";h();var oi=ie(si(),1);var ai=o(t=>{let e=oi.default.stringify(t);return e?`?${e}`:""},"serializeObjectToHTTPQuery");h();var R=new Zr({level:ge.testLike&&G.logLevel<W.PRINT?3:Xr.level}),P={error:R.red,success:R.green,warn:R.yellow,link:R.cyan,highlighted:R.magentaBright,examplesQuestions:R.cyanBright,subdued:R.blackBright,body:R.whiteBright,black:R.black,blackBright:R.blackBright,red:R.red,redBright:R.redBright,green:R.green,greenBright:R.greenBright,yellow:R.yellow,yellowBright:R.yellowBright,blue:R.blue,blueBright:R.blueBright,magenta:R.magenta,magentaBright:R.magentaBright,cyan:R.cyan,cyanBright:R.cyanBright,white:R.white,whiteBright:R.whiteBright,bgBlack:R.bgBlack,bgBlackBright:R.bgBlackBright,bgRed:R.bgRed,bgRedBright:R.bgRedBright,bgGreen:R.bgGreen,bgGreenBright:R.bgGreenBright,bgYellow:R.bgYellow,bgYellowBright:R.bgYellowBright,bgBlue:R.bgBlue,bgBlueBright:R.bgBlueBright,bgMagenta:R.bgMagenta,bgMagentaBright:R.bgMagentaBright,bgCyan:R.bgCyan,bgCyanBright:R.bgCyanBright,bgWhite:R.bgWhite,bgWhiteBright:R.bgWhiteBright,reset:R.reset};var ui=o((t,e,r,n,i,s)=>`${ao(i)} ${lo(t)} ${co(e)}:${uo(r)}${fi(n,{indent:2,timestamp:i,environment:s})}${Te}`,"formatPretty"),Ye="",Ae=" ",Te=`
|
|
24
|
-
`,io=":",li="'",ci=o((t,e)=>{let r=t==="error"?P.error:P.subdued,n=[];n.push(Te);for(let i=0;i<e;i++)n.push(Ae);return n.push(r(t)),n.push(r(io)),n.join("")},"formatKey"),$e=o((t,e,r)=>{if(!t)return Ye;let n=t.split(Te);if(n.length===0)return Ye;let i=[],s=n.shift();no(!tn(s),"first line is nil"),i.push(e(s));for(let a of n)if(a){i.push(Te);for(let u=0;u<r;u++)i.push(Ae);i.push(e(a))}return i.join(Ye)},"formatValue"),so=o((t,e)=>{let r="";return e&&(r=ai(e)),`https://${t.application.slug}--${t.name}.${G.domains.app}/edit/logs${r}`},"getEnvironmentLogsUrl"),oo=o(t=>t?`{environment_id="${t.id.toString()}"} | json | level=~"info|warn|error"`:'{environment_id=~".+"} | json | level=~"info|warn|error"',"defaultLogqlQuery"),fi=o((t,e)=>{let{indent:r,environment:n,timestamp:i}=e;if(Object.keys(t).length===0)return Ye;let s=[];"trace_id"in t&&(s.push(ci("trace_id",r)),s.push(Ae),n&&i&&ye.isSupported?s.push(ye(P.link(t.trace_id),so(n,{timeRange:`${i.toISOString()} to now`,logql:`${oo(n)} | trace_id="${t.trace_id}"`}))):s.push(P.link(t.trace_id)));for(let[a,u]of Object.entries(t))if(a!=="trace_id"){if(s.push(ci(a,r)),u instanceof Set&&(u=Array.from(u)),Array.isArray(u)){if(u.length===0){s.push($e(" []",P.subdued,r));continue}u=Object.fromEntries(u.entries())}if(u instanceof Map&&(u=Object.fromEntries(u)),We(u)){let l=Object.entries(u);if(l.length===0){s.push($e(" {}",P.subdued,r));continue}l.length>10&&G.logLevel>W.TRACE&&!n&&(u=Object.fromEntries([...l.slice(0,10),[lr.ellipsis,`${l.length-10} more`]])),s.push(fi(u,{indent:r+2,environment:n}));continue}if(s.push(Ae),n)s.push($e(String(u),P.reset,r));else switch(typeof u){case"string":s.push($e(li+u.replaceAll(Te,Te+Ae.repeat(r+a.length))+li,P.reset,r));break;case"number":s.push($e(String(u),P.yellowBright,r));break;case"bigint":s.push($e(String(u)+"n",P.yellowBright,r));break;case"boolean":s.push($e(String(u),P.green,r));break;default:s.push($e(String(u),P.reset,r));break}}return s.join(Ye)},"formatFields"),ao=o(t=>(t?(0,br.default)(t):(0,br.default)()).format("hh:mm:ss"),"formatTimestamp"),lo=o(t=>{switch(t){case W.PRINT:return P.bgBlack(P.body.bold(" PRINT "));case W.TRACE:return P.bgBlue(P.body.bold(" TRACE "));case W.DEBUG:return P.bgMagenta(P.body.bold(" DEBUG "));case W.INFO:return P.bgBlue(P.body.bold(" INFO "));case W.WARN:return P.bgYellow(P.body.bold(" WARN "));case W.ERROR:return P.bgRed(P.body.bold(" ERROR "))}},"formatLevel"),co=o(t=>P.body(t),"formatName"),uo=o(t=>{if(!t)return Ye;let e=t.split(Te);return e.length===1?Ae+P.body(t):Te+e.map(r=>Ae+Ae+r).join(Te)},"formatMessage");var _r={pretty:ui,json:Un};var Lu={"--log-level":{type:o(t=>ln(t,W.INFO),"type"),alias:["-ll"],default:W.INFO},"--my-logs":{type:Boolean}},ho={trace:W.TRACE,debug:W.DEBUG,info:W.INFO,warn:W.WARN,error:W.ERROR},ku=o(t=>(e,r,n,i,s)=>{let a={...i};"error"in a&&(a.error=ue(a.error)),"reason"in a&&(a.reason=ue(a.reason));let u=_r[G.logFormat],l=ho[e.toLowerCase()];fo(l,`Unknown level: ${e}`),er.writeStdout(u(l,r,n,a,s,t))},"createEnvironmentStructuredLogger"),hi=o(({name:t,fields:e={},devFields:r={}})=>{let n=o(i=>(s,a,u)=>{let l=i>=G.logLevel,f=i>=W.INFO;if(!l&&!f)return;let p={...le(e),...a};if(ge.developmentOrTestLike&&Object.assign(p,le(r),u),"error"in p&&(p.error=ue(p.error)),"reason"in p&&(p.reason=ue(p.reason)),l){let d=_r[G.logFormat];er.writeStderr(d(i,t,s,p))}f&&Tn({level:"log",message:s,data:p})},"createStructuredLog");return{trace:n(W.TRACE),debug:n(W.DEBUG),info:n(W.INFO),warn:n(W.WARN),error:n(W.ERROR)}},"createStructuredLogger");var xr=o(({name:t,fields:e,devFields:r})=>({...hi({name:t,fields:e,devFields:r}),child:o(({name:n,fields:i,devFields:s})=>xr({name:n||t,fields:o(()=>({...le(e),...le(i)}),"fields"),devFields:{...le(r),...le(s)}}),"child")}),"createLogger");h();var di=ie(Tt(),1);import{setTimeout as po}from"node:timers/promises";var Mu=o((t,e)=>po((0,di.default)(t),void 0,e),"delay"),wr=class{static{o(this,"PromiseWrapper")}resolution;rejection;pendingPromise;constructor(e){this.pendingPromise=e,e.then(r=>(this.resolution=r,r)).catch(r=>{this.rejection=r}).finally(()=>{delete this.pendingPromise})}async unwrap(){if(this.pendingPromise)return await this.pendingPromise;if(this.rejection)throw this.rejection;return this.resolution}},Rt=class{static{o(this,"PromiseSignal")}[Symbol.toStringTag];resolve;reject;_promise;constructor(){this._promise=new wr(new Promise((e,r)=>{this.resolve=e,this.reject=r})),this[Symbol.toStringTag]=String(this._promise.pendingPromise)}then(e,r){return this._promise.unwrap().then(e,r)}catch(e){return this._promise.unwrap().catch(e)}finally(e){return this._promise.unwrap().finally(e)}};var Bt=class t extends AbortController{static{o(this,"Context")}done=new Rt;#e;#i=[];constructor({log:e}){super(),this.#e=e,this.abort=this.abort.bind(this),this.child=this.child.bind(this),this.onAbort=this.onAbort.bind(this),this.signal.addEventListener("abort",async()=>{let r;for(let n of this.#i.reverse())try{await n(this.signal.reason)}catch(i){r??=i,this.log.error("error during abort",{error:r})}r?this.done.reject(r):this.done.resolve()})}get log(){return this.#e}static init(e){return new t({log:xr(e)})}child(e){let r=new t({log:this.log.child(e)});return this.onAbort(()=>r.abort()),r}onAbort(e){this.#i.push(e)}};var vr=o(t=>(mo(t.context?.ctx instanceof Bt,we(`
|
|
25
|
-
ctx must be provided to http requests:
|
|
26
|
-
|
|
27
|
-
const response = await http({
|
|
28
|
-
context: { ctx },
|
|
29
|
-
...options,
|
|
30
|
-
});
|
|
31
|
-
`)),t.context.ctx),"getContext"),Dt=sn.extend({agent:{http:new go({keepAlive:!0}),https:new yo({keepAlive:!0})},retry:{limit:10,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN","EADDRNOTAVAIL","EHOSTUNREACH"],maxRetryAfter:void 0,calculateDelay:o(({computedValue:t})=>t,"calculateDelay"),backoffLimit:(0,pi.default)("5s"),noise:100},hooks:{beforeRequest:[t=>{let e=vr(t);t.signal=e.signal,t.headers["user-agent"]=G.versionFull,e.log.debug("http request",{http:{request:{method:t.method,url:t.url?.toString()}}})}],beforeRetry:[(t,e)=>{vr(t.request?.options??t.options.context).log.warn("http request failed, retrying...",{http:{retryCount:e,error:ue(t),request:t.request&&{method:t.request.options.method,url:t.request.options.url?.toString()},response:t.response&&{statusCode:t.response.statusCode,traceId:t.response.headers["x-trace-id"],durationMs:t.response.timings.phases.total}}})}],afterResponse:[t=>{let e=vr(t.request.options);return e.log.debug("http response",{http:{request:{method:t.request.options.method,url:t.request.options.url?.toString()},response:{statusCode:t.statusCode,traceId:t.headers["x-trace-id"],durationMs:t.timings.phases.total}}}),t.statusCode===401&&Mn(t.request.options)&&fn(e,void 0),t}]}});h();import Va from"node:assert";h();h();h();h();function se(t){return t===null?"null":Array.isArray(t)?"array":typeof t}o(se,"extendedTypeof");function Oe(t){return se(t)==="object"}o(Oe,"isObject");function mi(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}o(mi,"areGraphQLErrors");function Er(t,e){return t.length<124?t:e}o(Er,"limitCloseReason");var gi="graphql-transport-ws";var ce;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ce||(ce={}));var Y;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Y||(Y={}));function yi(t){if(!Oe(t))throw new Error(`Message is expected to be an object, but got ${se(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${se(t.type)}`);switch(t.type){case Y.ConnectionInit:case Y.ConnectionAck:case Y.Ping:case Y.Pong:{if(t.payload!=null&&!Oe(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Y.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${se(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Oe(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${se(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${se(t.payload.query)}`);if(t.payload.variables!=null&&!Oe(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${se(t.payload.variables)}`);if(t.payload.operationName!=null&&se(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${se(t.payload.operationName)}`);if(t.payload.extensions!=null&&!Oe(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${se(t.payload.extensions)}`);break}case Y.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${se(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Oe(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${se(t.payload)}`);break}case Y.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${se(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!mi(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Y.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${se(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}o(yi,"validateMessage");function bi(t,e){return yi(typeof t=="string"?JSON.parse(t,e):t)}o(bi,"parseMessage");function Je(t,e){return yi(t),JSON.stringify(t,e)}o(Je,"stringifyMessage");var Ke=function(t){return this instanceof Ke?(this.v=t,this):new Ke(t)},bo=function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(c){return function(m){return Promise.resolve(m).then(c,d)}}function u(c,m){n[c]&&(i[c]=function(v){return new Promise(function(T,B){s.push([c,v,T,B])>1||l(c,v)})},m&&(i[c]=m(i[c])))}function l(c,m){try{f(n[c](m))}catch(v){b(s[0][3],v)}}function f(c){c.value instanceof Ke?Promise.resolve(c.value.v).then(p,d):b(s[0][2],c)}function p(c){l("next",c)}function d(c){l("throw",c)}function b(c,m){c(m),s.shift(),s.length&&l(s[0][0],s[0][1])}};function _i(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:a=0,disablePong:u,connectionAckWaitTimeout:l=0,retryAttempts:f=5,retryWait:p=o(async function(g){let _=1e3;for(let x=0;x<g;x++)_*=2;await new Promise(x=>setTimeout(x,_+Math.floor(Math.random()*2700+300)))},"randomisedExponentialBackoff"),shouldRetry:d=Sr,isFatalConnectionProblem:b,on:c,webSocketImpl:m,generateID:v=o(function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let _=Math.random()*16|0;return(g=="x"?_:_&3|8).toString(16)})},"generateUUID"),jsonMessageReplacer:T,jsonMessageReviver:B}=t,M;if(m){if(!xo(m))throw new Error("Invalid WebSocket implementation provided");M=m}else typeof WebSocket<"u"?M=WebSocket:typeof global<"u"?M=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(M=window.WebSocket||window.MozWebSocket);if(!M)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let J=M,k=(()=>{let y=(()=>{let _={};return{on(x,S){return _[x]=S,()=>{delete _[x]}},emit(x){var S;"id"in x&&((S=_[x.id])===null||S===void 0||S.call(_,x))}}})(),g={connecting:c?.connecting?[c.connecting]:[],opened:c?.opened?[c.opened]:[],connected:c?.connected?[c.connected]:[],ping:c?.ping?[c.ping]:[],pong:c?.pong?[c.pong]:[],message:c?.message?[y.emit,c.message]:[y.emit],closed:c?.closed?[c.closed]:[],error:c?.error?[c.error]:[]};return{onMessage:y.on,on(_,x){let S=g[_];return S.push(x),()=>{S.splice(S.indexOf(x),1)}},emit(_,...x){for(let S of[...g[_]])S(...x)}}})();function H(y){let g=[k.on("error",_=>{g.forEach(x=>x()),y(_)}),k.on("closed",_=>{g.forEach(x=>x()),y(_)})]}o(H,"errorOrClosed");let K,z=0,N,C=!1,re=0,nt=!1;async function O(){clearTimeout(N);let[y,g]=await(K??(K=new Promise((S,D)=>(async()=>{if(C){if(await p(re),!z)return K=void 0,D({code:1e3,reason:"All Subscriptions Gone"});re++}k.emit("connecting",C);let L=new J(typeof e=="function"?await e():e,gi),q,Z;function me(){isFinite(a)&&a>0&&(clearTimeout(Z),Z=setTimeout(()=>{L.readyState===J.OPEN&&(L.send(Je({type:Y.Ping})),k.emit("ping",!1,void 0))},a))}o(me,"enqueuePing"),H(Q=>{K=void 0,clearTimeout(q),clearTimeout(Z),D(Q),Q instanceof $t&&(L.close(4499,"Terminated"),L.onerror=null,L.onclose=null)}),L.onerror=Q=>k.emit("error",Q),L.onclose=Q=>k.emit("closed",Q),L.onopen=async()=>{try{k.emit("opened",L);let Q=typeof r=="function"?await r():r;if(L.readyState!==J.OPEN)return;L.send(Je(Q?{type:Y.ConnectionInit,payload:Q}:{type:Y.ConnectionInit},T)),isFinite(l)&&l>0&&(q=setTimeout(()=>{L.close(ce.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},l)),me()}catch(Q){k.emit("error",Q),L.close(ce.InternalClientError,Er(Q instanceof Error?Q.message:new Error(Q).message,"Internal client error"))}};let ae=!1;L.onmessage=({data:Q})=>{try{let F=bi(Q,B);if(k.emit("message",F),F.type==="ping"||F.type==="pong"){k.emit(F.type,!0,F.payload),F.type==="pong"?me():u||(L.send(Je(F.payload?{type:Y.Pong,payload:F.payload}:{type:Y.Pong})),k.emit("pong",!1,F.payload));return}if(ae)return;if(F.type!==Y.ConnectionAck)throw new Error(`First message cannot be of type ${F.type}`);clearTimeout(q),ae=!0,k.emit("connected",L,F.payload,C),C=!1,re=0,S([L,new Promise((ne,xe)=>H(xe))])}catch(F){L.onmessage=null,k.emit("error",F),L.close(ce.BadResponse,Er(F instanceof Error?F.message:new Error(F).message,"Bad response"))}}})())));y.readyState===J.CLOSING&&await g;let _=o(()=>{},"release"),x=new Promise(S=>_=S);return[y,_,Promise.race([x.then(()=>{if(!z){let S=o(()=>y.close(1e3,"Normal Closure"),"complete");isFinite(s)&&s>0?N=setTimeout(()=>{y.readyState===J.OPEN&&S()},s):S()}}),g])]}o(O,"connect");function E(y){if(Sr(y)&&(_o(y.code)||[ce.InternalServerError,ce.InternalClientError,ce.BadRequest,ce.BadResponse,ce.Unauthorized,ce.SubprotocolNotAcceptable,ce.SubscriberAlreadyExists,ce.TooManyInitialisationRequests].includes(y.code)))throw y;if(nt)return!1;if(Sr(y)&&y.code===1e3)return z>0;if(!f||re>=f||!d(y)||b?.(y))throw y;return C=!0}o(E,"shouldRetryConnectOrThrow"),n||(async()=>{for(z++;;)try{let[,,y]=await O();await y}catch(y){try{if(!E(y))return}catch(g){return i?.(g)}}})();function w(y,g){let _=v(y),x=!1,S=!1,D=o(()=>{z--,x=!0},"releaser");return(async()=>{for(z++;;)try{let[L,q,Z]=await O();if(x)return q();let me=k.onMessage(_,ae=>{switch(ae.type){case Y.Next:{g.next(ae.payload);return}case Y.Error:{S=!0,x=!0,g.error(ae.payload),D();return}case Y.Complete:{x=!0,D();return}}});L.send(Je({id:_,type:Y.Subscribe,payload:y},T)),D=o(()=>{!x&&L.readyState===J.OPEN&&L.send(Je({id:_,type:Y.Complete},T)),z--,x=!0,q()},"releaser"),await Z.finally(me);return}catch(L){if(!E(L))return}})().then(()=>{S||g.complete()}).catch(L=>{g.error(L)}),()=>{x||D()}}return o(w,"subscribe"),{on:k.on,subscribe:w,iterate(y){let g=[],_={done:!1,error:null,resolve:o(()=>{},"resolve")},x=w(y,{next(D){g.push(D),_.resolve()},error(D){_.done=!0,_.error=D,_.resolve()},complete(){_.done=!0,_.resolve()}}),S=o(function(){return bo(this,arguments,o(function*(){for(;;){for(g.length||(yield Ke(new Promise(q=>_.resolve=q)));g.length;)yield yield Ke(g.shift());if(_.error)throw _.error;if(_.done)return yield Ke(void 0)}},"iterator_1"))},"iterator")();return S.throw=async D=>(_.done||(_.done=!0,_.error=D,_.resolve()),{done:!0,value:void 0}),S.return=async()=>(x(),{done:!0,value:void 0}),S},async dispose(){if(nt=!0,K){let[y]=await K;y.close(1e3,"Normal Closure")}},terminate(){K&&k.emit("closed",new $t)}}}o(_i,"createClient");var $t=class extends Error{static{o(this,"TerminatedCloseEvent")}constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function Sr(t){return Oe(t)&&"code"in t&&"reason"in t}o(Sr,"isLikeCloseEvent");function _o(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}o(_o,"isFatalInternalCloseCode");function xo(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}o(xo,"isWebSocket");var Rs=ie(Tt(),1);h();h();var Or=ie(wi(),1);h();var ft=class extends Error{static{o(this,"TimeoutError")}constructor(e){super(e),this.name="TimeoutError"}},Lr=class extends Error{static{o(this,"AbortError")}constructor(e){super(),this.name="AbortError",this.message=e}},vi=o(t=>globalThis.DOMException===void 0?new Lr(t):new DOMException(t),"getDOMException"),Ei=o(t=>{let e=t.reason===void 0?vi("This operation was aborted."):t.reason;return e instanceof Error?e:vi(e)},"getAbortedReason");function kr(t,e){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=e,a,u,f=new Promise((p,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:c}=e;c.aborted&&d(Ei(c)),u=o(()=>{d(Ei(c))},"abortHandler"),c.addEventListener("abort",u,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(p,d);return}let b=new ft;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(c){d(c)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?p():i instanceof Error?d(i):(b.message=i??`Promise timed out after ${r} milliseconds`,d(b))},r),(async()=>{try{p(await t)}catch(c){d(c)}})()}).finally(()=>{f.clear(),u&&e.signal&&e.signal.removeEventListener("abort",u)});return f.clear=()=>{s.clearTimeout.call(void 0,a),a=void 0},f}o(kr,"pTimeout");h();h();function Cr(t,e,r){let n=0,i=t.length;for(;i>0;){let s=Math.trunc(i/2),a=n+s;r(t[a],e)<=0?(n=++a,i-=s+1):i=s}return n}o(Cr,"lowerBound");var ht=class{static{o(this,"PriorityQueue")}#e=[];enqueue(e,r){r={priority:0,...r};let n={priority:r.priority,id:r.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=Cr(this.#e,n,(s,a)=>a.priority-s.priority);this.#e.splice(i,0,n)}setPriority(e,r){let n=this.#e.findIndex(s=>s.id===e);if(n===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[i]=this.#e.splice(n,1);this.enqueue(i.run,{priority:r,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(r=>r.priority===e.priority).map(r=>r.run)}get size(){return this.#e.length}};var dt=class extends Or.default{static{o(this,"PQueue")}#e;#i;#o=0;#d;#a;#p=0;#r;#l;#t;#m;#n=0;#c;#s;#g;#_=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:ht,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#i=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#d=e.intervalCap,this.#a=e.interval,this.#t=new e.queueClass,this.#m=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#s=e.autoStart===!1}get#x(){return this.#i||this.#o<this.#d}get#w(){return this.#n<this.#c}#v(){this.#n--,this.#u(),this.emit("next")}#E(){this.#b(),this.#y(),this.#l=void 0}get#S(){let e=Date.now();if(this.#r===void 0){let r=this.#p-e;if(r<0)this.#o=this.#e?this.#n:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#E()},r)),!0}return!1}#u(){if(this.#t.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#s){let e=!this.#S;if(this.#x&&this.#w){let r=this.#t.dequeue();return r?(this.emit("active"),r(),e&&this.#y(),!0):!1}}return!1}#y(){this.#i||this.#r!==void 0||(this.#r=setInterval(()=>{this.#b()},this.#a),this.#p=Date.now()+this.#a)}#b(){this.#o===0&&this.#n===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#o=this.#e?this.#n:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#c}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#c=e,this.#f()}async#T(e){return new Promise((r,n)=>{e.addEventListener("abort",()=>{n(e.reason)},{once:!0})})}setPriority(e,r){this.#t.setPriority(e,r)}async add(e,r={}){return r.id??=(this.#_++).toString(),r={timeout:this.timeout,throwOnTimeout:this.#g,...r},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#n++,this.#o++;try{r.signal?.throwIfAborted();let s=e({signal:r.signal});r.timeout&&(s=kr(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#T(r.signal)]));let a=await s;n(a),this.emit("completed",a)}catch(s){if(s instanceof ft&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#v()}},r),this.emit("add"),this.#u()})}async addAll(e,r){return Promise.all(e.map(async n=>this.add(n,r)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#h("empty")}async onSizeLessThan(e){this.#t.size<e||await this.#h("next",()=>this.#t.size<e)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(e,r){return new Promise(n=>{let i=o(()=>{r&&!r()||(this.off(e,i),n())},"listener");this.on(e,i)})}get size(){return this.#t.size}sizeBy(e){return this.#t.filter(e).length}get pending(){return this.#n}get isPaused(){return this.#s}};h();var Fa=ie(Li(),1),Ga=ie(qr(),1),ja=ie(jr(),1),ks=ie(Jr(),1),Wa=ie(Ls(),1);var Cs=ks.default;var Qt=class{constructor(e,r,n){this.environment=r;this.endpoint=n;this.ctx=e.child({name:"client"}),this._graphqlWsClient=_i({url:`wss://${r.application.slug}.${G.domains.app}/edit/api/graphql-ws`,keepAlive:(0,Rs.default)("10s"),shouldRetry:o(()=>!0,"shouldRetry"),connectionParams:{environment:r.name},webSocketImpl:class extends Cs{static{o(this,"webSocketImpl")}constructor(i,s,a){super(i,s,{signal:e.signal,...a,headers:{...a?.headers,"user-agent":G.versionFull,...mr(e)}})}},on:{opened:o(()=>{this.ctx.log.trace("opened")},"opened"),ping:o(i=>{this.ctx.log.trace("ping",{received:i})},"ping"),pong:o(i=>{this.ctx.log.trace("pong",{received:i})},"pong"),connecting:o(()=>{switch(this.status){case 1:this.status=2,this.ctx.log.info("reconnecting");break;case 2:this.ctx.log.info("retrying");break;default:this.ctx.log.debug("connecting");break}},"connecting"),connected:o(()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},"connected"),closed:o(()=>{this.status=1,this.ctx.log.debug("disconnected")},"closed"),error:o(i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})},"error")}})}static{o(this,"Client")}status=0;ctx;_graphqlWsClient;subscribe(e,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:a=an}){let u={query:r,variables:le(n)},l=this._graphqlWsClient.on("connected",()=>{this.status===2&&(u.variables=le(n),e.log.info("re-subscribing to graphql subscription"))}),f=new dt({concurrency:1}),p=o(b=>s(new De(r,b)),"onError"),d=this._graphqlWsClient.subscribe(u,{next:o(b=>void f.add(()=>i(b)).catch(p),"next"),error:o(b=>void f.add(()=>p(b)),"error"),complete:o(()=>void f.add(()=>a()).catch(p),"complete")});return()=>{e.log.trace("unsubscribing from graphql subscription"),l(),f.clear(),d()}}async execute(e,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?this.environment.type!=="production"&&(n+=`--${this.environment.name}`):this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await Dt({context:{ctx:e},method:"POST",url:`https://${n}.${G.domains.app}${this.endpoint}`,headers:{...mr(e),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:le(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!We(i)||!("data"in i)&&!("errors"in i))throw e.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new De(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var Et=class{static{o(this,"Api")}ctx;#e;constructor(e,r){this.ctx=e.child({name:"api"}),this.#e=new Qt(this.ctx,r,"/api/graphql")}async query({query:e,variables:r,...n}){let i=/query (\w+)/.exec(e)?.[1];Va(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:le(r)}}});s.log.info("executing graphql query");let a=await this.#e.execute(s,{operation:e,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(a.errors)throw new De(e,a.errors);if(!a.data)throw new De(e,"Query response did not contain data");return a.data}async dispose(){await this.#e.dispose()}};h();var Bs=we(`
|
|
32
|
-
query GadgetMetaModels {
|
|
33
|
-
gadgetMeta {
|
|
34
|
-
models {
|
|
35
|
-
apiIdentifier
|
|
36
|
-
namespace
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`),Ds=we(`
|
|
41
|
-
query GadgetMetaGlobalActions {
|
|
42
|
-
gadgetMeta {
|
|
43
|
-
globalActions {
|
|
44
|
-
apiIdentifier
|
|
45
|
-
namespace
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`);var za=Object.freeze({Development:"development",Production:"production",Test:"test"}),Ha=$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(t=>BigInt(t)),name:$.string().transform(t=>t.toLowerCase()),type:$.nativeEnum(za)}),Qa=$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(t=>BigInt(t)),slug:$.string(),primaryDomain:$.string(),hasSplitEnvironments:$.boolean(),multiEnvironmentEnabled:$.boolean(),environments:$.array(Ha),team:$.object({id:$.union([$.string(),$.number(),$.bigint()]).transform(t=>BigInt(t)),name:$.string()})}),ad=$.object({apiIdentifier:$.string(),namespace:$.nullable($.array($.string())).optional()}),ld=$.object({apiIdentifier:$.string(),namespace:$.nullable($.array($.string())).optional()}),cd=o(async t=>{let e=lt(t);if(!e)return[];let r=await Dt({context:{ctx:t},url:`https://${G.domains.services}/auth/api/apps`,headers:{...e},responseType:"json",resolveBodyOnly:!0});return $.array(Qa).parse(r)},"getApplications"),ud=o(t=>{let e=new Map;for(let r of t){let n=r.team.name,i=e.get(n)??[];i.push(r),e.set(n,i)}return e},"groupByTeam"),fd=o(async(t,e)=>{if(!lt(t))return[];let n=new Et(t,e),{gadgetMeta:i}=await n.query({query:Bs});return i.models},"getModels"),hd=o(async(t,e)=>{if(!lt(t))return[];let n=new Et(t,e),{gadgetMeta:i}=await n.query({query:Ds});return i.globalActions},"getGlobalActions");export{ye as a,ml as b,gl as c,Ps as d,Rl as e,Pe as f,Me as g,or as h,On as i,lr as j,Bn as k,In as l,nc as m,Nn as n,ic as o,De as p,dt as q,lt as r,Ec as s,Qt as t,za as u,cd as v,ud as w,fd as x,hd as y,P as z,Lu as A,ku as B,Mu as C,Bt as D,Dt as E};
|
|
50
|
-
//# sourceMappingURL=chunk-ZN6HRN6U.js.map
|