@gadgetinc/ggt 1.7.0 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-623ZJFNZ.js → add-BIKODQCS.js} +2 -2
- package/dist/{add-623ZJFNZ.js.map → add-BIKODQCS.js.map} +1 -1
- package/dist/{chunk-7VB3L2XK.js → chunk-D2R4J557.js} +4 -4
- package/dist/{chunk-7VB3L2XK.js.map → chunk-D2R4J557.js.map} +1 -1
- package/dist/{chunk-T3XUROKS.js → chunk-FGUWID6B.js} +2 -2
- package/dist/{chunk-5AMZWMRB.js → chunk-MBWB2XUY.js} +2 -2
- package/dist/{chunk-RV4YYWDE.js → chunk-VJTDX5WL.js} +2 -2
- package/dist/{chunk-RV4YYWDE.js.map → chunk-VJTDX5WL.js.map} +1 -1
- package/dist/chunk-XQWSZW7K.js +66 -0
- package/dist/chunk-XQWSZW7K.js.map +7 -0
- package/dist/{deploy-4AVZFDZ4.js → deploy-3H3W42UM.js} +2 -2
- package/dist/{deploy-4AVZFDZ4.js.map → deploy-3H3W42UM.js.map} +1 -1
- package/dist/{dev-RHG4RVQG.js → dev-O5KGPP2V.js} +2 -2
- package/dist/{dev-RHG4RVQG.js.map → dev-O5KGPP2V.js.map} +1 -1
- package/dist/list-O5JTZNKN.js +11 -0
- package/dist/{list-YXCTVLRH.js.map → list-O5JTZNKN.js.map} +1 -1
- package/dist/login-6MLYS6A4.js +2 -0
- package/dist/{logs-DMHPRDXZ.js → logs-SS34WQ2K.js} +2 -2
- package/dist/{logs-DMHPRDXZ.js.map → logs-SS34WQ2K.js.map} +1 -1
- package/dist/main.js +1 -1
- package/dist/{open-CYXBST4H.js → open-JQTW6XFM.js} +2 -2
- package/dist/{open-CYXBST4H.js.map → open-JQTW6XFM.js.map} +1 -1
- package/dist/{pull-57RYWYNZ.js → pull-5HLV3C74.js} +2 -2
- package/dist/{pull-57RYWYNZ.js.map → pull-5HLV3C74.js.map} +1 -1
- package/dist/push-62ZJ6D3R.js +2 -0
- package/dist/{status-C3VTFX7J.js → status-PL7MJVN7.js} +2 -2
- package/dist/{status-C3VTFX7J.js.map → status-PL7MJVN7.js.map} +1 -1
- package/dist/whoami-3RPUP2PK.js +7 -0
- package/dist/{whoami-AA3ISE77.js.map → whoami-3RPUP2PK.js.map} +1 -1
- package/package.json +3 -1
- package/dist/chunk-FILWLZUN.js +0 -18
- package/dist/chunk-FILWLZUN.js.map +0 -7
- package/dist/chunk-GCO2TOVZ.js +0 -50
- package/dist/chunk-GCO2TOVZ.js.map +0 -7
- package/dist/list-YXCTVLRH.js +0 -11
- package/dist/login-XIEASAMY.js +0 -2
- package/dist/push-464T6F4H.js +0 -2
- package/dist/whoami-AA3ISE77.js +0 -7
- /package/dist/{chunk-T3XUROKS.js.map → chunk-FGUWID6B.js.map} +0 -0
- /package/dist/{chunk-5AMZWMRB.js.map → chunk-MBWB2XUY.js.map} +0 -0
- /package/dist/{login-XIEASAMY.js.map → login-6MLYS6A4.js.map} +0 -0
- /package/dist/{push-464T6F4H.js.map → push-62ZJ6D3R.js.map} +0 -0
package/dist/chunk-GCO2TOVZ.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import{a as sn,b as on,c as an}from"./chunk-DYAWQS24.js";import{a as Qr,b as nn}from"./chunk-XGQQOMPO.js";import{K as je,L as Xr,O as ce,U as oe,V as en,W as F,X as tn,Z as V,a as zr,b as Vr,ba as Qt,c as Hr,ca as Yt,d as ve,e as A,f as Yr,g as vt,h as qe,ha as _e,i as jt,ia as Et,j as Wt,ja as rn,k as zt,l as Vt,n as Ht,p as Kr,x as Jr,y as Zr}from"./chunk-24OT7GHO.js";import{a as xt}from"./chunk-GFQYFEEH.js";import{a as o,b as U,d as M,f as re,h}from"./chunk-7DYQUG5M.js";var Kt=M((Ia,cn)=>{"use strict";h();cn.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 fn=M((Ba,un)=>{"use strict";h();var Es=U("os"),ln=U("tty"),ue=Kt(),{env:J}=process,Le;ue("no-color")||ue("no-colors")||ue("color=false")||ue("color=never")?Le=0:(ue("color")||ue("colors")||ue("color=true")||ue("color=always"))&&(Le=1);"FORCE_COLOR"in J&&(J.FORCE_COLOR==="true"?Le=1:J.FORCE_COLOR==="false"?Le=0:Le=J.FORCE_COLOR.length===0?1:Math.min(parseInt(J.FORCE_COLOR,10),3));function Jt(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}o(Jt,"translateLevel");function Zt(t,e){if(Le===0)return 0;if(ue("color=16m")||ue("color=full")||ue("color=truecolor"))return 3;if(ue("color=256"))return 2;if(t&&!e&&Le===void 0)return 0;let r=Le||0;if(J.TERM==="dumb")return r;if(process.platform==="win32"){let n=Es.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in J)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in J)||J.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in J)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(J.TEAMCITY_VERSION)?1:0;if(J.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in J){let n=parseInt((J.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(J.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(J.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(J.TERM)||"COLORTERM"in J?1:r}o(Zt,"supportsColor");function ws(t){let e=Zt(t,t&&t.isTTY);return Jt(e)}o(ws,"getSupportLevel");un.exports={supportsColor:ws,stdout:Jt(Zt(!0,ln.isatty(1))),stderr:Jt(Zt(!0,ln.isatty(2)))}});var pn=M((Ga,dn)=>{"use strict";h();var Ss=fn(),We=Kt();function hn(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(hn,"parseVersion");function Xt(t){let{CI:e,FORCE_HYPERLINK:r,NETLIFY:n,TEAMCITY_VERSION:i,TERM_PROGRAM:s,TERM_PROGRAM_VERSION:a,VTE_VERSION:u,TERM:c}=process.env;if(r)return!(r.length>0&&parseInt(r,10)===0);if(We("no-hyperlink")||We("no-hyperlinks")||We("hyperlink=false")||We("hyperlink=never"))return!1;if(We("hyperlink=true")||We("hyperlink=always")||n)return!0;if(!Ss.supportsColor(t)||t&&!t.isTTY)return!1;if("WT_SESSION"in process.env)return!0;if(process.platform==="win32"||e||i)return!1;if(s){let f=hn(a||"");switch(s){case"iTerm.app":return f.major===3?f.minor>=1:f.major>3;case"WezTerm":return f.major>=20200620;case"vscode":return f.major>1||f.major===1&&f.minor>=72;case"ghostty":return!0}}if(u){if(u==="0.50.0")return!1;let f=hn(u);return f.major>0||f.minor>=50}switch(c){case"alacritty":return!0}return!1}o(Xt,"supportsHyperlink");dn.exports={supportsHyperlink:Xt,stdout:Xt(process.stdout),stderr:Xt(process.stderr)}});var xn=M((rr,nr)=>{h();(function(t,e){typeof rr=="object"&&typeof nr<"u"?nr.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(rr,function(){"use strict";var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",s="minute",a="hour",u="day",c="week",f="month",p="quarter",d="year",_="date",l="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,E=/\[([^\]]+)]|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 w=["th","st","nd","rd"],v=O%100;return"["+O+(w[(v-20)%10]||w[v]||w[0])+"]"},"ordinal")},R=o(function(O,w,v){var y=String(O);return!y||y.length>=w?O:""+Array(w+1-y.length).join(v)+O},"m"),B={s:R,z:o(function(O){var w=-O.utcOffset(),v=Math.abs(w),y=Math.floor(v/60),g=v%60;return(w<=0?"+":"-")+R(y,2,"0")+":"+R(g,2,"0")},"z"),m:o(function O(w,v){if(w.date()<v.date())return-O(v,w);var y=12*(v.year()-w.year())+(v.month()-w.month()),g=w.clone().add(y,f),b=v-g<0,x=w.clone().add(y+(b?-1:1),f);return+(-(y+(v-g)/(b?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:c,d:u,D:_,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")},Q="en",C={};C[Q]=T;var W="$isDayjsObject",Y=o(function(O){return O instanceof ee||!(!O||!O[W])},"S"),j=o(function O(w,v,y){var g;if(!w)return Q;if(typeof w=="string"){var b=w.toLowerCase();C[b]&&(g=b),v&&(C[b]=v,g=b);var x=w.split("-");if(!g&&x.length>1)return O(x[0])}else{var S=w.name;C[S]=w,g=S}return!y&&g&&(Q=g),g||!y&&Q},"t"),I=o(function(O,w){if(Y(O))return O.clone();var v=typeof w=="object"?w:{};return v.date=O,v.args=arguments,new ee(v)},"O"),$=B;$.l=j,$.i=Y,$.w=function(O,w){return I(O,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var ee=function(){function O(v){this.$L=j(v.locale,null,!0),this.parse(v),this.$x=this.$x||v.x||{},this[W]=!0}o(O,"M");var w=O.prototype;return w.parse=function(v){this.$d=function(y){var g=y.date,b=y.utc;if(g===null)return new Date(NaN);if($.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,N=(x[7]||"0").substring(0,3);return b?new Date(Date.UTC(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,N)):new Date(x[1],S,x[3]||1,x[4]||0,x[5]||0,x[6]||0,N)}}return new Date(g)}(v),this.init()},w.init=function(){var v=this.$d;this.$y=v.getFullYear(),this.$M=v.getMonth(),this.$D=v.getDate(),this.$W=v.getDay(),this.$H=v.getHours(),this.$m=v.getMinutes(),this.$s=v.getSeconds(),this.$ms=v.getMilliseconds()},w.$utils=function(){return $},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function(v,y){var g=I(v);return this.startOf(y)<=g&&g<=this.endOf(y)},w.isAfter=function(v,y){return I(v)<this.startOf(y)},w.isBefore=function(v,y){return this.endOf(y)<I(v)},w.$g=function(v,y,g){return $.u(v)?this[y]:this.set(g,v)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(v,y){var g=this,b=!!$.u(y)||y,x=$.p(v),S=o(function(G,te){var ye=$.w(g.$u?Date.UTC(g.$y,te,G):new Date(g.$y,te,G),g);return b?ye:ye.endOf(u)},"l"),N=o(function(G,te){return $.w(g.toDate()[G].apply(g.toDate("s"),(b?[0,0,0,0]:[23,59,59,999]).slice(te)),g)},"$"),k=this.$W,D=this.$M,K=this.$D,de="set"+(this.$u?"UTC":"");switch(x){case d:return b?S(1,0):S(31,11);case f:return b?S(1,D):S(0,D+1);case c:var se=this.$locale().weekStart||0,z=(k<se?k+7:k)-se;return S(b?K-z:K+(6-z),D);case u:case _:return N(de+"Hours",0);case a:return N(de+"Minutes",1);case s:return N(de+"Seconds",2);case i:return N(de+"Milliseconds",3);default:return this.clone()}},w.endOf=function(v){return this.startOf(v,!1)},w.$set=function(v,y){var g,b=$.p(v),x="set"+(this.$u?"UTC":""),S=(g={},g[u]=x+"Date",g[_]=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)[b],N=b===u?this.$D+(y-this.$W):y;if(b===f||b===d){var k=this.clone().set(_,1);k.$d[S](N),k.init(),this.$d=k.set(_,Math.min(this.$D,k.daysInMonth())).$d}else S&&this.$d[S](N);return this.init(),this},w.set=function(v,y){return this.clone().$set(v,y)},w.get=function(v){return this[$.p(v)]()},w.add=function(v,y){var g,b=this;v=Number(v);var x=$.p(y),S=o(function(D){var K=I(b);return $.w(K.date(K.date()+Math.round(D*v)),b)},"y");if(x===f)return this.set(f,this.$M+v);if(x===d)return this.set(d,this.$y+v);if(x===u)return S(1);if(x===c)return S(7);var N=(g={},g[s]=e,g[a]=r,g[i]=t,g)[x]||1,k=this.$d.getTime()+v*N;return $.w(k,this)},w.subtract=function(v,y){return this.add(-1*v,y)},w.format=function(v){var y=this,g=this.$locale();if(!this.isValid())return g.invalidDate||l;var b=v||"YYYY-MM-DDTHH:mm:ssZ",x=$.z(this),S=this.$H,N=this.$m,k=this.$M,D=g.weekdays,K=g.months,de=g.meridiem,se=o(function(te,ye,tt,bt){return te&&(te[ye]||te(y,b))||tt[ye].slice(0,bt)},"h"),z=o(function(te){return $.s(S%12||12,te,"0")},"d"),G=de||function(te,ye,tt){var bt=te<12?"AM":"PM";return tt?bt.toLowerCase():bt};return b.replace(E,function(te,ye){return ye||function(tt){switch(tt){case"YY":return String(y.$y).slice(-2);case"YYYY":return $.s(y.$y,4,"0");case"M":return k+1;case"MM":return $.s(k+1,2,"0");case"MMM":return se(g.monthsShort,k,K,3);case"MMMM":return se(K,k);case"D":return y.$D;case"DD":return $.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return se(g.weekdaysMin,y.$W,D,2);case"ddd":return se(g.weekdaysShort,y.$W,D,3);case"dddd":return D[y.$W];case"H":return String(S);case"HH":return $.s(S,2,"0");case"h":return z(1);case"hh":return z(2);case"a":return G(S,N,!0);case"A":return G(S,N,!1);case"m":return String(N);case"mm":return $.s(N,2,"0");case"s":return String(y.$s);case"ss":return $.s(y.$s,2,"0");case"SSS":return $.s(y.$ms,3,"0");case"Z":return x}return null}(te)||x.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(v,y,g){var b,x=this,S=$.p(y),N=I(v),k=(N.utcOffset()-this.utcOffset())*e,D=this-N,K=o(function(){return $.m(x,N)},"D");switch(S){case d:b=K()/12;break;case f:b=K();break;case p:b=K()/3;break;case c:b=(D-k)/6048e5;break;case u:b=(D-k)/864e5;break;case a:b=D/r;break;case s:b=D/e;break;case i:b=D/t;break;default:b=D}return g?b:$.a(b)},w.daysInMonth=function(){return this.endOf(f).$D},w.$locale=function(){return C[this.$L]},w.locale=function(v,y){if(!v)return this.$L;var g=this.clone(),b=j(v,y,!0);return b&&(g.$L=b),g},w.clone=function(){return $.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},O}(),et=ee.prototype;return I.prototype=et,[["$ms",n],["$s",i],["$m",s],["$H",a],["$W",u],["$M",f],["$y",d],["$D",_]].forEach(function(O){et[O[1]]=function(w){return this.$g(w,O[0],O[1])}}),I.extend=function(O,w){return O.$i||(O(w,ee,I),O.$i=!0),I},I.locale=j,I.isDayjs=Y,I.unix=function(O){return I(1e3*O)},I.en=C[Q],I.Ls=C,I.p={},I})});var En=M(ze=>{"use strict";h();ze.__esModule=!0;ze.distance=ze.closest=void 0;var Ee=new Uint32Array(65536),ks=o(function(t,e){for(var r=t.length,n=e.length,i=1<<r-1,s=-1,a=0,u=r,c=r;c--;)Ee[t.charCodeAt(c)]|=1<<c;for(c=0;c<n;c++){var f=Ee[e.charCodeAt(c)],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(c=r;c--;)Ee[t.charCodeAt(c)]=0;return u},"myers_32"),Cs=o(function(t,e){for(var r=e.length,n=t.length,i=[],s=[],a=Math.ceil(r/32),u=Math.ceil(n/32),c=0;c<a;c++)s[c]=-1,i[c]=0;for(var f=0;f<u-1;f++){for(var p=0,d=-1,_=f*32,l=Math.min(32,n)+_,m=_;m<l;m++)Ee[t.charCodeAt(m)]|=1<<m;for(var c=0;c<r;c++){var E=Ee[e.charCodeAt(c)],T=s[c/32|0]>>>c&1,R=i[c/32|0]>>>c&1,B=E|p,Q=((E|R)&d)+d^d|E|R,C=p|~(Q|d),W=d&Q;C>>>31^T&&(s[c/32|0]^=1<<c),W>>>31^R&&(i[c/32|0]^=1<<c),C=C<<1|T,W=W<<1|R,d=W|~(B|C),p=C&B}for(var m=_;m<l;m++)Ee[t.charCodeAt(m)]=0}for(var Y=0,j=-1,I=f*32,$=Math.min(32,n-I)+I,m=I;m<$;m++)Ee[t.charCodeAt(m)]|=1<<m;for(var ee=n,c=0;c<r;c++){var E=Ee[e.charCodeAt(c)],T=s[c/32|0]>>>c&1,R=i[c/32|0]>>>c&1,B=E|Y,Q=((E|R)&j)+j^j|E|R,C=Y|~(Q|j),W=j&Q;ee+=C>>>n-1&1,ee-=W>>>n-1&1,C>>>31^T&&(s[c/32|0]^=1<<c),W>>>31^R&&(i[c/32|0]^=1<<c),C=C<<1|T,W=W<<1|R,j=W|~(B|C),Y=C&B}for(var m=I;m<$;m++)Ee[t.charCodeAt(m)]=0;return ee},"myers_x"),vn=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?ks(t,e):Cs(t,e)},"distance");ze.distance=vn;var $s=o(function(t,e){for(var r=1/0,n=0,i=0;i<e.length;i++){var s=vn(t,e[i]);s<r&&(r=s,n=i)}return e[n]},"closest");ze.closest=$s});var wn=M((ir,rt)=>{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=En(),r=[],n=[],i={get:o(function(s,a,u){var c=u&&t&&u.useCollator;if(c){var f=s.length,p=a.length;if(f===0)return p;if(p===0)return f;var d,_,l,m,E;for(l=0;l<p;++l)r[l]=l,n[l]=a.charCodeAt(l);r[p]=p;var T;for(l=0;l<f;++l){for(_=l+1,m=0;m<p;++m)d=_,T=t.compare(s.charAt(l),String.fromCharCode(n[m]))===0,_=r[m]+(T?0:1),E=d+1,_>E&&(_=E),E=r[m+1]+1,_>E&&(_=E),r[m]=d;r[m]=_}return _}return e.distance(s,a)},"get")};typeof define<"u"&&define!==null&&define.amd?define(function(){return i}):typeof rt<"u"&&rt!==null&&typeof ir<"u"&&rt.exports===ir?rt.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 Tn=M((or,ar)=>{h();(function(t,e){typeof U=="function"&&typeof or=="object"&&typeof ar=="object"?ar.exports=e():typeof define=="function"&&define.amd?define(function(){return e()}):t.pluralize=e()})(or,function(){var t=[],e=[],r={},n={},i={};function s(l){return typeof l=="string"?new RegExp("^"+l+"$","i"):l}o(s,"sanitizeRule");function a(l,m){return l===m?m:l===l.toLowerCase()?m.toLowerCase():l===l.toUpperCase()?m.toUpperCase():l[0]===l[0].toUpperCase()?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m.toLowerCase()}o(a,"restoreCase");function u(l,m){return l.replace(/\$(\d{1,2})/g,function(E,T){return m[T]||""})}o(u,"interpolate");function c(l,m){return l.replace(m[0],function(E,T){var R=u(m[1],arguments);return a(E===""?l[T-1]:E,R)})}o(c,"replace");function f(l,m,E){if(!l.length||r.hasOwnProperty(l))return m;for(var T=E.length;T--;){var R=E[T];if(R[0].test(m))return c(m,R)}return m}o(f,"sanitizeWord");function p(l,m,E){return function(T){var R=T.toLowerCase();return m.hasOwnProperty(R)?a(T,R):l.hasOwnProperty(R)?a(T,l[R]):f(R,T,E)}}o(p,"replaceWord");function d(l,m,E,T){return function(R){var B=R.toLowerCase();return m.hasOwnProperty(B)?!0:l.hasOwnProperty(B)?!1:f(B,B,E)===B}}o(d,"checkWord");function _(l,m,E){var T=m===1?_.singular(l):_.plural(l);return(E?m+" ":"")+T}return o(_,"pluralize"),_.plural=p(i,n,t),_.isPlural=d(i,n,t),_.singular=p(n,i,e),_.isSingular=d(n,i,e),_.addPluralRule=function(l,m){t.push([s(l),m])},_.addSingularRule=function(l,m){e.push([s(l),m])},_.addUncountableRule=function(l){if(typeof l=="string"){r[l.toLowerCase()]=!0;return}_.addPluralRule(l,"$0"),_.addSingularRule(l,"$0")},_.addIrregularRule=function(l,m){m=m.toLowerCase(),l=l.toLowerCase(),i[l]=m,n[m]=l},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(l){return _.addIrregularRule(l[0],l[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(l){return _.addPluralRule(l[0],l[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(l){return _.addSingularRule(l[0],l[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(_.addUncountableRule),_})});var In=M((Xc,An)=>{"use strict";h();var Rn=12,Ps=0,lr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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 Bs(t){var e=t.indexOf("%");if(e===-1)return t;for(var r=t.length,n="",i=0,s=0,a=e,u=Rn;e>-1&&e<r;){var c=Nn(t[e+1],4),f=Nn(t[e+2],0),p=c|f,d=lr[p];if(u=lr[256+u+d],s=s<<6|p&lr[364+d],u===Rn)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===Ps)return null;if(e+=3,e<r&&t.charCodeAt(e)===37)continue;return null}}return n+t.slice(i)}o(Bs,"decodeURIComponent");var Ms={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 Nn(t,e){var r=Ms[t];return r===void 0?255:r<<e}o(Nn,"hexCodeToInt");An.exports=Bs});var Gn=M((rl,Dn)=>{"use strict";h();var Pn=In(),Bn=/\+/g,Mn=o(function(){},"Empty");Mn.prototype=Object.create(null);function Ds(t){let e=new Mn;if(typeof t!="string")return e;let r=t.length,n="",i="",s=-1,a=-1,u=!1,c=!1,f=!1,p=!1,d=!1,_=0;for(let l=0;l<r+1;l++)if(_=l!==r?t.charCodeAt(l):38,_===38){if(d=a>s,d||(a=l),n=t.slice(s+1,a),d||n.length>0){f&&(n=n.replace(Bn," ")),u&&(n=Pn(n)||n),d&&(i=t.slice(a+1,l),p&&(i=i.replace(Bn," ")),c&&(i=Pn(i)||i));let m=e[n];m===void 0?e[n]=i:m.pop?m.push(i):e[n]=[m,i]}i="",s=l,a=l,u=!1,c=!1,f=!1,p=!1}else _===61?a<=s?a=l:c=!0:_===43?a>s?p=!0:f=!0:_===37&&(a>s?c=!0:u=!0);return e}o(Ds,"parse");Dn.exports=Ds});var Fn=M((sl,Un)=>{h();var be=Array.from({length:256},(t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase()),Gs=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 Us(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(Gs[s]!==1&&(n<i&&(r+=t.slice(n,i)),n=i+1,r+=be[s]),++i===e)break e;s=t.charCodeAt(i)}if(n<i&&(r+=t.slice(n,i)),s<2048){n=i+1,r+=be[192|s>>6]+be[128|s&63];continue}if(s<55296||s>=57344){n=i+1,r+=be[224|s>>12]+be[128|s>>6&63]+be[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+=be[240|s>>18]+be[128|s>>12&63]+be[128|s>>6&63]+be[128|s&63]}return n===0?t:n<e?r+t.slice(n):r}o(Us,"encodeString");Un.exports={encodeString:Us}});var Wn=M((cl,jn)=>{"use strict";h();var{encodeString:ur}=Fn();function qn(t){let e=typeof t;return e==="string"?ur(t):e==="bigint"?t.toString():e==="boolean"?t?"true":"false":e==="number"&&Number.isFinite(t)?t<1e21?""+t:ur(""+t):""}o(qn,"getAsPrimitive");function Fs(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],c=t[u],f=ur(u)+"=";if(a&&(e+=r),Array.isArray(c)){s=c.length;for(let p=0;p<s;p++)p&&(e+=r),e+=f,e+=qn(c[p])}else e+=f,e+=qn(c)}return e}o(Fs,"stringify");jn.exports=Fs});var Qn=M((fl,it)=>{"use strict";h();var zn=Gn(),Vn=Wn(),Hn={parse:zn,stringify:Vn};it.exports=Hn;it.exports.default=Hn;it.exports.parse=zn;it.exports.stringify=Vn});var ui=M((Gu,_r)=>{"use strict";h();var so=Object.prototype.hasOwnProperty,ie="~";function st(){}o(st,"Events");Object.create&&(st.prototype=Object.create(null),new st().__proto__||(ie=!1));function oo(t,e,r){this.fn=t,this.context=e,this.once=r||!1}o(oo,"EE");function li(t,e,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new oo(r,n||t,i),a=ie?ie+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(li,"addListener");function Ct(t,e){--t._eventsCount===0?t._events=new st:delete t._events[e]}o(Ct,"clearEvent");function X(){this._events=new st,this._eventsCount=0}o(X,"EventEmitter");X.prototype.eventNames=o(function(){var e=[],r,n;if(this._eventsCount===0)return e;for(n in r=this._events)so.call(r,n)&&e.push(ie?n.slice(1):n);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(r)):e},"eventNames");X.prototype.listeners=o(function(e){var r=ie?ie+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");X.prototype.listenerCount=o(function(e){var r=ie?ie+e:e,n=this._events[r];return n?n.fn?1:n.length:0},"listenerCount");X.prototype.emit=o(function(e,r,n,i,s,a){var u=ie?ie+e:e;if(!this._events[u])return!1;var c=this._events[u],f=arguments.length,p,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,r),!0;case 3:return c.fn.call(c.context,r,n),!0;case 4:return c.fn.call(c.context,r,n,i),!0;case 5:return c.fn.call(c.context,r,n,i,s),!0;case 6:return c.fn.call(c.context,r,n,i,s,a),!0}for(d=1,p=new Array(f-1);d<f;d++)p[d-1]=arguments[d];c.fn.apply(c.context,p)}else{var _=c.length,l;for(d=0;d<_;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),f){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,r);break;case 3:c[d].fn.call(c[d].context,r,n);break;case 4:c[d].fn.call(c[d].context,r,n,i);break;default:if(!p)for(l=1,p=new Array(f-1);l<f;l++)p[l-1]=arguments[l];c[d].fn.apply(c[d].context,p)}}return!0},"emit");X.prototype.on=o(function(e,r,n){return li(this,e,r,n,!1)},"on");X.prototype.once=o(function(e,r,n){return li(this,e,r,n,!0)},"once");X.prototype.removeListener=o(function(e,r,n,i){var s=ie?ie+e:e;if(!this._events[s])return this;if(!r)return Ct(this,s),this;var a=this._events[s];if(a.fn)a.fn===r&&(!i||a.once)&&(!n||a.context===n)&&Ct(this,s);else{for(var u=0,c=[],f=a.length;u<f;u++)(a[u].fn!==r||i&&!a[u].once||n&&a[u].context!==n)&&c.push(a[u]);c.length?this._events[s]=c.length===1?c[0]:c:Ct(this,s)}return this},"removeListener");X.prototype.removeAllListeners=o(function(e){var r;return e?(r=ie?ie+e:e,this._events[r]&&Ct(this,r)):(this._events=new st,this._eventsCount=0),this},"removeAllListeners");X.prototype.off=X.prototype.removeListener;X.prototype.addListener=X.prototype.on;X.prefixed=ie;X.EventEmitter=X;typeof _r<"u"&&(_r.exports=X)});var gi=M((af,mi)=>{"use strict";h();var{Duplex:ao}=U("stream");function di(t){t.emit("close")}o(di,"emitClose");function co(){!this.destroyed&&this._writableState.finished&&this.destroy()}o(co,"duplexOnEnd");function pi(t){this.removeListener("error",pi),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}o(pi,"duplexOnError");function lo(t,e){let r=!0,n=new ao({...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(di,n);return}let a=!1;t.once("error",o(function(c){a=!0,s(c)},"error")),t.once("close",o(function(){a||s(i),process.nextTick(di,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",co),n.on("error",pi),n}o(lo,"createWebSocketStream");mi.exports=lo});var Oe=M((uf,bi)=>{"use strict";h();var yi=["nodebuffer","arraybuffer","fragments"],_i=typeof Blob<"u";_i&&yi.push("blob");bi.exports={BINARY_TYPES:yi,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:_i,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:o(()=>{},"NOOP")}});var lt=M((df,$t)=>{"use strict";h();var{EMPTY_BUFFER:uo}=Oe(),wr=Buffer[Symbol.species];function fo(t,e){if(t.length===0)return uo;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 wr(r.buffer,r.byteOffset,n):r}o(fo,"concat");function xi(t,e,r,n,i){for(let s=0;s<i;s++)r[n+s]=t[s]^e[s&3]}o(xi,"_mask");function vi(t,e){for(let r=0;r<t.length;r++)t[r]^=e[r&3]}o(vi,"_unmask");function ho(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}o(ho,"toArrayBuffer");function Sr(t){if(Sr.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new wr(t):ArrayBuffer.isView(t)?e=new wr(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Sr.readOnly=!1),e}o(Sr,"toBuffer");$t.exports={concat:fo,mask:xi,toArrayBuffer:ho,toBuffer:Sr,unmask:vi};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=U("bufferutil");$t.exports.mask=function(e,r,n,i,s){s<48?xi(e,r,n,i,s):t.mask(e,r,n,i,s)},$t.exports.unmask=function(e,r){e.length<32?vi(e,r):t.unmask(e,r)}}catch{}});var Si=M((gf,wi)=>{"use strict";h();var Ei=Symbol("kDone"),Tr=Symbol("kRun"),Or=class{static{o(this,"Limiter")}constructor(e){this[Ei]=()=>{this.pending--,this[Tr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Tr]()}[Tr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ei])}}};wi.exports=Or});var ht=M((bf,Ci)=>{"use strict";h();var ut=U("zlib"),Ti=lt(),po=Si(),{kStatusCode:Oi}=Oe(),mo=Buffer[Symbol.species],go=Buffer.from([0,0,255,255]),Nt=Symbol("permessage-deflate"),ke=Symbol("total-length"),ft=Symbol("callback"),Ie=Symbol("buffers"),Rt=Symbol("error"),Lt,kr=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,!Lt){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Lt=new po(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[ft];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){Lt.add(i=>{this._decompress(e,r,(s,a)=>{i(),n(s,a)})})}compress(e,r,n){Lt.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"?ut.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=ut.createInflateRaw({...this._options.zlibInflateOptions,windowBits:a}),this._inflate[Nt]=this,this._inflate[ke]=0,this._inflate[Ie]=[],this._inflate.on("error",_o),this._inflate.on("data",ki)}this._inflate[ft]=n,this._inflate.write(e),r&&this._inflate.write(go),this._inflate.flush(()=>{let s=this._inflate[Rt];if(s){this._inflate.close(),this._inflate=null,n(s);return}let a=Ti.concat(this._inflate[Ie],this._inflate[ke]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ke]=0,this._inflate[Ie]=[],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"?ut.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=ut.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:a}),this._deflate[ke]=0,this._deflate[Ie]=[],this._deflate.on("data",yo)}this._deflate[ft]=n,this._deflate.write(e),this._deflate.flush(ut.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=Ti.concat(this._deflate[Ie],this._deflate[ke]);r&&(s=new mo(s.buffer,s.byteOffset,s.length-4)),this._deflate[ft]=null,this._deflate[ke]=0,this._deflate[Ie]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};Ci.exports=kr;function yo(t){this[Ie].push(t),this[ke]+=t.length}o(yo,"deflateOnData");function ki(t){if(this[ke]+=t.length,this[Nt]._maxPayload<1||this[ke]<=this[Nt]._maxPayload){this[Ie].push(t);return}this[Rt]=new RangeError("Max payload size exceeded"),this[Rt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Rt][Oi]=1009,this.removeListener("data",ki),this.reset()}o(ki,"inflateOnData");function _o(t){this[Nt]._inflate=null,t[Oi]=1007,this[ft](t)}o(_o,"inflateOnError")});var Ye=M((Ef,At)=>{"use strict";h();var{isUtf8:$i}=U("buffer"),{hasBlob:bo}=Oe(),xo=[0,0,0,0,0,0,0,0,0,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 vo(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}o(vo,"isValidStatusCode");function Cr(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(Cr,"_isValidUTF8");function Eo(t){return bo&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}o(Eo,"isBlob");At.exports={isBlob:Eo,isValidStatusCode:vo,isValidUTF8:Cr,tokenChars:xo};if($i)At.exports.isValidUTF8=function(t){return t.length<24?Cr(t):$i(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=U("utf-8-validate");At.exports.isValidUTF8=function(e){return e.length<32?Cr(e):t(e)}}catch{}});var Ar=M((Tf,Bi)=>{"use strict";h();var{Writable:wo}=U("stream"),Li=ht(),{BINARY_TYPES:So,EMPTY_BUFFER:Ri,kStatusCode:To,kWebSocket:Oo}=Oe(),{concat:$r,toArrayBuffer:ko,unmask:Co}=lt(),{isValidStatusCode:$o,isValidUTF8:Ni}=Ye(),It=Buffer[Symbol.species],fe=0,Ai=1,Ii=2,Pi=3,Lr=4,Rr=5,Pt=6,Nr=class extends wo{static{o(this,"Receiver")}constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||So[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Oo]=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=fe}_write(e,r,n){if(this._opcode===8&&this._state==fe)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 It(n.buffer,n.byteOffset+e,n.length-e),new It(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 It(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 fe:this.getInfo(e);break;case Ai:this.getPayloadLength16(e);break;case Ii:this.getPayloadLength64(e);break;case Pi:this.getMask();break;case Lr:this.getData(e);break;case Rr:case Pt: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[Li.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=Ai:this._payloadLength===127?this._state=Ii: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=Pi:this._state=Lr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Lr}getData(e){let r=Ri;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&&Co(r,this._mask)}if(this._opcode>7){this.controlMessage(r,e);return}if(this._compressed){this._state=Rr,this.decompress(r,e);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(e)}decompress(e,r){this._extensions[Li.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===fe&&this.startLoop(r)})}dataMessage(e){if(!this._fin){this._state=fe;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=$r(n,r):this._binaryType==="arraybuffer"?i=ko($r(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=fe):(this._state=Pt,setImmediate(()=>{this.emit("message",i,!0),this._state=fe,this.startLoop(e)}))}else{let i=$r(n,r);if(!this._skipUTF8Validation&&!Ni(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(s);return}this._state===Rr||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=fe):(this._state=Pt,setImmediate(()=>{this.emit("message",i,!1),this._state=fe,this.startLoop(e)}))}}controlMessage(e,r){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ri),this.end();else{let n=e.readUInt16BE(0);if(!$o(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let i=new It(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ni(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=fe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=fe):(this._state=Pt,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=fe,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[To]=i,a}};Bi.exports=Nr});var Br=M(($f,Gi)=>{"use strict";h();var{Duplex:Cf}=U("stream"),{randomFillSync:Lo}=U("crypto"),Mi=ht(),{EMPTY_BUFFER:Ro,kWebSocket:No,NOOP:Ao}=Oe(),{isBlob:Ke,isValidStatusCode:Io}=Ye(),{mask:Di,toBuffer:Me}=lt(),he=Symbol("kByteLength"),Po=Buffer.alloc(4),Bt=8*1024,De,Je=Bt,ge=0,Bo=1,Mo=2,Ir=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=ge,this.onerror=Ao,this[No]=void 0}static frame(e,r){let n,i=!1,s=2,a=!1;r.mask&&(n=r.maskBuffer||Po,r.generateMask?r.generateMask(n):(Je===Bt&&(De===void 0&&(De=Buffer.alloc(Bt)),Lo(De,0,Bt),Je=0),n[0]=De[Je++],n[1]=De[Je++],n[2]=De[Je++],n[3]=De[Je++]),a=(n[0]|n[1]|n[2]|n[3])===0,s=6);let u;typeof e=="string"?(!r.mask||a)&&r[he]!==void 0?u=r[he]:(e=Buffer.from(e),u=e.length):(u=e.length,i=r.mask&&r.readOnly&&!a);let c=u;u>=65536?(s+=8,c=127):u>125&&(s+=2,c=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]=c,c===126?f.writeUInt16BE(u,2):c===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?(Di(e,n,f,s,u),[f]):(Di(e,n,e,0,u),[f,e])):[f,e]}close(e,r,n,i){let s;if(e===void 0)s=Ro;else{if(typeof e!="number"||!Io(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={[he]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ge?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):Ke(e)?(i=e.size,s=!1):(e=Me(e),i=e.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[he]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Ke(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==ge?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):Ke(e)?(i=e.size,s=!1):(e=Me(e),i=e.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let a={[he]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Ke(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,a,n]):this.getBlobData(e,!1,a,n):this._state!==ge?this.enqueue([this.dispatch,e,!1,a,n]):this.sendFrame(t.frame(e,a),n)}send(e,r,n){let i=this._extensions[Mi.extensionName],s=r.binary?2:1,a=r.compress,u,c;typeof e=="string"?(u=Buffer.byteLength(e),c=!1):Ke(e)?(u=e.size,c=!1):(e=Me(e),u=e.length,c=Me.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={[he]:u,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:c,rsv1:a};Ke(e)?this._state!==ge?this.enqueue([this.getBlobData,e,this._compress,f,n]):this.getBlobData(e,this._compress,f,n):this._state!==ge?this.enqueue([this.dispatch,e,this._compress,f,n]):this.dispatch(e,this._compress,f,n)}getBlobData(e,r,n,i){this._bufferedBytes+=n[he],this._state=Mo,e.arrayBuffer().then(s=>{if(this._socket.destroyed){let u=new Error("The socket was closed while the blob was being read");process.nextTick(Pr,this,u,i);return}this._bufferedBytes-=n[he];let a=Me(s);r?this.dispatch(a,r,n,i):(this._state=ge,this.sendFrame(t.frame(a,n),i),this.dequeue())}).catch(s=>{process.nextTick(Do,this,s,i)})}dispatch(e,r,n,i){if(!r){this.sendFrame(t.frame(e,n),i);return}let s=this._extensions[Mi.extensionName];this._bufferedBytes+=n[he],this._state=Bo,s.compress(e,n.fin,(a,u)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");Pr(this,c,i);return}this._bufferedBytes-=n[he],this._state=ge,n.readOnly=!1,this.sendFrame(t.frame(u,n),i),this.dequeue()})}dequeue(){for(;this._state===ge&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],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)}};Gi.exports=Ir;function Pr(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(Pr,"callCallbacks");function Do(t,e,r){Pr(t,e,r),t.onerror(e)}o(Do,"onError")});var Qi=M((Nf,Hi)=>{"use strict";h();var{kForOnEventAttribute:dt,kListener:Mr}=Oe(),Ui=Symbol("kCode"),Fi=Symbol("kData"),qi=Symbol("kError"),ji=Symbol("kMessage"),Wi=Symbol("kReason"),Ze=Symbol("kTarget"),zi=Symbol("kType"),Vi=Symbol("kWasClean"),Ce=class{static{o(this,"Event")}constructor(e){this[Ze]=null,this[zi]=e}get target(){return this[Ze]}get type(){return this[zi]}};Object.defineProperty(Ce.prototype,"target",{enumerable:!0});Object.defineProperty(Ce.prototype,"type",{enumerable:!0});var Ge=class extends Ce{static{o(this,"CloseEvent")}constructor(e,r={}){super(e),this[Ui]=r.code===void 0?0:r.code,this[Wi]=r.reason===void 0?"":r.reason,this[Vi]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Ui]}get reason(){return this[Wi]}get wasClean(){return this[Vi]}};Object.defineProperty(Ge.prototype,"code",{enumerable:!0});Object.defineProperty(Ge.prototype,"reason",{enumerable:!0});Object.defineProperty(Ge.prototype,"wasClean",{enumerable:!0});var Xe=class extends Ce{static{o(this,"ErrorEvent")}constructor(e,r={}){super(e),this[qi]=r.error===void 0?null:r.error,this[ji]=r.message===void 0?"":r.message}get error(){return this[qi]}get message(){return this[ji]}};Object.defineProperty(Xe.prototype,"error",{enumerable:!0});Object.defineProperty(Xe.prototype,"message",{enumerable:!0});var pt=class extends Ce{static{o(this,"MessageEvent")}constructor(e,r={}){super(e),this[Fi]=r.data===void 0?null:r.data}get data(){return this[Fi]}};Object.defineProperty(pt.prototype,"data",{enumerable:!0});var Go={addEventListener(t,e,r={}){for(let i of this.listeners(t))if(!r[dt]&&i[Mr]===e&&!i[dt])return;let n;if(t==="message")n=o(function(s,a){let u=new pt("message",{data:a?s:s.toString()});u[Ze]=this,Mt(e,this,u)},"onMessage");else if(t==="close")n=o(function(s,a){let u=new Ge("close",{code:s,reason:a.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});u[Ze]=this,Mt(e,this,u)},"onClose");else if(t==="error")n=o(function(s){let a=new Xe("error",{error:s,message:s.message});a[Ze]=this,Mt(e,this,a)},"onError");else if(t==="open")n=o(function(){let s=new Ce("open");s[Ze]=this,Mt(e,this,s)},"onOpen");else return;n[dt]=!!r[dt],n[Mr]=e,r.once?this.once(t,n):this.on(t,n)},removeEventListener(t,e){for(let r of this.listeners(t))if(r[Mr]===e&&!r[dt]){this.removeListener(t,r);break}}};Hi.exports={CloseEvent:Ge,ErrorEvent:Xe,Event:Ce,EventTarget:Go,MessageEvent:pt};function Mt(t,e,r){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,r):t.call(e,r)}o(Mt,"callListener")});var Dr=M((Pf,Yi)=>{"use strict";h();var{tokenChars:mt}=Ye();function xe(t,e,r){t[e]===void 0?t[e]=[r]:t[e].push(r)}o(xe,"push");function Uo(t){let e=Object.create(null),r=Object.create(null),n=!1,i=!1,s=!1,a,u,c=-1,f=-1,p=-1,d=0;for(;d<t.length;d++)if(f=t.charCodeAt(d),a===void 0)if(p===-1&&mt[f]===1)c===-1&&(c=d);else if(d!==0&&(f===32||f===9))p===-1&&c!==-1&&(p=d);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let l=t.slice(c,p);f===44?(xe(e,l,r),r=Object.create(null)):a=l,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);else if(u===void 0)if(p===-1&&mt[f]===1)c===-1&&(c=d);else if(f===32||f===9)p===-1&&c!==-1&&(p=d);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d),xe(r,t.slice(c,p),!0),f===44&&(xe(e,a,r),r=Object.create(null),a=void 0),c=p=-1}else if(f===61&&c!==-1&&p===-1)u=t.slice(c,d),c=p=-1;else throw new SyntaxError(`Unexpected character at index ${d}`);else if(i){if(mt[f]!==1)throw new SyntaxError(`Unexpected character at index ${d}`);c===-1?c=d:n||(n=!0),i=!1}else if(s)if(mt[f]===1)c===-1&&(c=d);else if(f===34&&c!==-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&&mt[f]===1)c===-1&&(c=d);else if(c!==-1&&(f===32||f===9))p===-1&&(p=d);else if(f===59||f===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${d}`);p===-1&&(p=d);let l=t.slice(c,p);n&&(l=l.replace(/\\/g,""),n=!1),xe(r,u,l),f===44&&(xe(e,a,r),r=Object.create(null),a=void 0),u=void 0,c=p=-1}else throw new SyntaxError(`Unexpected character at index ${d}`);if(c===-1||s||f===32||f===9)throw new SyntaxError("Unexpected end of input");p===-1&&(p=d);let _=t.slice(c,p);return a===void 0?xe(e,_,r):(u===void 0?xe(r,_,!0):n?xe(r,u,_.replace(/\\/g,"")):xe(r,u,_),xe(e,a,r)),e}o(Uo,"parse");function Fo(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(Fo,"format");Yi.exports={format:Fo,parse:Uo}});var jr=M((Uf,as)=>{"use strict";h();var qo=U("events"),jo=U("https"),Wo=U("http"),Zi=U("net"),zo=U("tls"),{randomBytes:Vo,createHash:Ho}=U("crypto"),{Duplex:Df,Readable:Gf}=U("stream"),{URL:Gr}=U("url"),Pe=ht(),Qo=Ar(),Yo=Br(),{isBlob:Ko}=Ye(),{BINARY_TYPES:Ki,EMPTY_BUFFER:Dt,GUID:Jo,kForOnEventAttribute:Ur,kListener:Zo,kStatusCode:Xo,kWebSocket:Z,NOOP:Xi}=Oe(),{EventTarget:{addEventListener:ea,removeEventListener:ta}}=Qi(),{format:ra,parse:na}=Dr(),{toBuffer:ia}=lt(),sa=30*1e3,es=Symbol("kAborted"),Fr=[8,13],$e=["CONNECTING","OPEN","CLOSING","CLOSED"],oa=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,q=class t extends qo{static{o(this,"WebSocket")}constructor(e,r,n){super(),this._binaryType=Ki[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Dt,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]),ts(this,e,r,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Ki.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 Qo({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new Yo(e,this._extensions,n.generateMask);this._receiver=i,this._sender=s,this._socket=e,i[Z]=this,s[Z]=this,e[Z]=this,i.on("conclude",la),i.on("drain",ua),i.on("error",fa),i.on("message",ha),i.on("ping",da),i.on("pong",pa),s.onerror=ma,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),r.length>0&&e.unshift(r),e.on("close",is),e.on("data",Ut),e.on("end",ss),e.on("error",os),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[Pe.extensionName]&&this._extensions[Pe.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){le(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())}),ns(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){qr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(e||Dt,r,n)}pong(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(n=e,e=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){qr(this,e,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(e||Dt,r,n)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,r,n){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){qr(this,e,n);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Pe.extensionName]||(i.compress=!1),this._sender.send(e||Dt,i,n)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){le(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(q,"CONNECTING",{enumerable:!0,value:$e.indexOf("CONNECTING")});Object.defineProperty(q.prototype,"CONNECTING",{enumerable:!0,value:$e.indexOf("CONNECTING")});Object.defineProperty(q,"OPEN",{enumerable:!0,value:$e.indexOf("OPEN")});Object.defineProperty(q.prototype,"OPEN",{enumerable:!0,value:$e.indexOf("OPEN")});Object.defineProperty(q,"CLOSING",{enumerable:!0,value:$e.indexOf("CLOSING")});Object.defineProperty(q.prototype,"CLOSING",{enumerable:!0,value:$e.indexOf("CLOSING")});Object.defineProperty(q,"CLOSED",{enumerable:!0,value:$e.indexOf("CLOSED")});Object.defineProperty(q.prototype,"CLOSED",{enumerable:!0,value:$e.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(q.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(q.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[Ur])return e[Zo];return null},set(e){for(let r of this.listeners(t))if(r[Ur]){this.removeListener(t,r);break}typeof e=="function"&&this.addEventListener(t,e,{[Ur]:!0})}})});q.prototype.addEventListener=ea;q.prototype.removeEventListener=ta;as.exports=q;function ts(t,e,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:Fr[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,!Fr.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Fr.join(", ")})`);let s;if(e instanceof Gr)s=e;else try{s=new Gr(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:",c;if(s.protocol!=="ws:"&&!a&&!u?c=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:u&&!s.pathname?c="The URL's pathname is empty":s.hash&&(c="The URL contains a fragment identifier"),c){let E=new SyntaxError(c);if(t._redirects===0)throw E;Gt(t,E);return}let f=a?443:80,p=Vo(16).toString("base64"),d=a?jo.request:Wo.request,_=new Set,l;if(i.createConnection=i.createConnection||(a?ca:aa),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&&(l=new Pe(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=ra({[Pe.extensionName]:l.offer()})),r.length){for(let E of r){if(typeof E!="string"||!oa.test(E)||_.has(E))throw new SyntaxError("An invalid or duplicated subprotocol was specified");_.add(E)}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 E=i.path.split(":");i.socketPath=E[0],i.path=E[1]}let m;if(i.followRedirects){if(t._redirects===0){t._originalIpc=u,t._originalSecure=a,t._originalHostOrSocketPath=u?i.socketPath:s.host;let E=n&&n.headers;if(n={...n,headers:{}},E)for(let[T,R]of Object.entries(E))n.headers[T.toLowerCase()]=R}else if(t.listenerCount("redirect")===0){let E=u?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:s.host===t._originalHostOrSocketPath;(!E||t._originalSecure&&!a)&&(delete i.headers.authorization,delete i.headers.cookie,E||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",()=>{le(t,m,"Opening handshake has timed out")}),m.on("error",E=>{m===null||m[es]||(m=t._req=null,Gt(t,E))}),m.on("response",E=>{let T=E.headers.location,R=E.statusCode;if(T&&i.followRedirects&&R>=300&&R<400){if(++t._redirects>i.maxRedirects){le(t,m,"Maximum redirects exceeded");return}m.abort();let B;try{B=new Gr(T,e)}catch{let C=new SyntaxError(`Invalid URL: ${T}`);Gt(t,C);return}ts(t,B,r,n)}else t.emit("unexpected-response",m,E)||le(t,m,`Unexpected server response: ${E.statusCode}`)}),m.on("upgrade",(E,T,R)=>{if(t.emit("upgrade",E),t.readyState!==q.CONNECTING)return;m=t._req=null;let B=E.headers.upgrade;if(B===void 0||B.toLowerCase()!=="websocket"){le(t,T,"Invalid Upgrade header");return}let Q=Ho("sha1").update(p+Jo).digest("base64");if(E.headers["sec-websocket-accept"]!==Q){le(t,T,"Invalid Sec-WebSocket-Accept header");return}let C=E.headers["sec-websocket-protocol"],W;if(C!==void 0?_.size?_.has(C)||(W="Server sent an invalid subprotocol"):W="Server sent a subprotocol but none was requested":_.size&&(W="Server sent no subprotocol"),W){le(t,T,W);return}C&&(t._protocol=C);let Y=E.headers["sec-websocket-extensions"];if(Y!==void 0){if(!l){le(t,T,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=na(Y)}catch{le(t,T,"Invalid Sec-WebSocket-Extensions header");return}let I=Object.keys(j);if(I.length!==1||I[0]!==Pe.extensionName){le(t,T,"Server indicated an extension that was not requested");return}try{l.accept(j[Pe.extensionName])}catch{le(t,T,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[Pe.extensionName]=l}t.setSocket(T,R,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,t):m.end()}o(ts,"initAsClient");function Gt(t,e){t._readyState=q.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}o(Gt,"emitErrorAndClose");function aa(t){return t.path=t.socketPath,Zi.connect(t)}o(aa,"netConnect");function ca(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Zi.isIP(t.host)?"":t.host),zo.connect(t)}o(ca,"tlsConnect");function le(t,e,r){t._readyState=q.CLOSING;let n=new Error(r);Error.captureStackTrace(n,le),e.setHeader?(e[es]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Gt,t,n)):(e.destroy(n),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}o(le,"abortHandshake");function qr(t,e,r){if(e){let n=Ko(e)?e.size:ia(e).length;t._socket?t._sender._bufferedBytes+=n:t._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${t.readyState} (${$e[t.readyState]})`);process.nextTick(r,n)}}o(qr,"sendAfterClose");function la(t,e){let r=this[Z];r._closeFrameReceived=!0,r._closeMessage=e,r._closeCode=t,r._socket[Z]!==void 0&&(r._socket.removeListener("data",Ut),process.nextTick(rs,r._socket),t===1005?r.close():r.close(t,e))}o(la,"receiverOnConclude");function ua(){let t=this[Z];t.isPaused||t._socket.resume()}o(ua,"receiverOnDrain");function fa(t){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",Ut),process.nextTick(rs,e._socket),e.close(t[Xo])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}o(fa,"receiverOnError");function Ji(){this[Z].emitClose()}o(Ji,"receiverOnFinish");function ha(t,e){this[Z].emit("message",t,e)}o(ha,"receiverOnMessage");function da(t){let e=this[Z];e._autoPong&&e.pong(t,!this._isServer,Xi),e.emit("ping",t)}o(da,"receiverOnPing");function pa(t){this[Z].emit("pong",t)}o(pa,"receiverOnPong");function rs(t){t.resume()}o(rs,"resume");function ma(t){let e=this[Z];e.readyState!==q.CLOSED&&(e.readyState===q.OPEN&&(e._readyState=q.CLOSING,ns(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}o(ma,"senderOnError");function ns(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),sa)}o(ns,"setCloseTimer");function is(){let t=this[Z];this.removeListener("close",is),this.removeListener("data",Ut),this.removeListener("end",ss),t._readyState=q.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[Z]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",Ji),t._receiver.on("finish",Ji))}o(is,"socketOnClose");function Ut(t){this[Z]._receiver.write(t)||this.pause()}o(Ut,"socketOnData");function ss(){let t=this[Z];t._readyState=q.CLOSING,t._receiver.end(),this.end()}o(ss,"socketOnEnd");function os(){let t=this[Z];this.removeListener("error",os),this.on("error",Xi),t&&(t._readyState=q.CLOSING,this.destroy())}o(os,"socketOnError")});var ls=M((jf,cs)=>{"use strict";h();var{tokenChars:ga}=Ye();function ya(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&&ga[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(ya,"parse");cs.exports={parse:ya}});var gs=M((Hf,ms)=>{"use strict";h();var _a=U("events"),Ft=U("http"),{Duplex:Vf}=U("stream"),{createHash:ba}=U("crypto"),us=Dr(),Ue=ht(),xa=ls(),va=jr(),{GUID:Ea,kWebSocket:wa}=Oe(),Sa=/^[+/0-9A-Za-z]{22}==$/,fs=0,hs=1,ps=2,Wr=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:va,...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=Ft.createServer((n,i)=>{let s=Ft.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=Ta(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=fs}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===ps){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(gt,this);return}if(e&&this.once("close",e),this._state!==hs)if(this._state=hs,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(gt,this):process.nextTick(gt,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{gt(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",ds);let s=e.headers["sec-websocket-key"],a=e.headers.upgrade,u=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Fe(this,e,r,405,"Invalid HTTP method");return}if(a===void 0||a.toLowerCase()!=="websocket"){Fe(this,e,r,400,"Invalid Upgrade header");return}if(s===void 0||!Sa.test(s)){Fe(this,e,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(u!==8&&u!==13){Fe(this,e,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){yt(r,400);return}let c=e.headers["sec-websocket-protocol"],f=new Set;if(c!==void 0)try{f=xa.parse(c)}catch{Fe(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 _=new Ue(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let l=us.parse(p);l[Ue.extensionName]&&(_.accept(l[Ue.extensionName]),d[Ue.extensionName]=_)}catch{Fe(this,e,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let _={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(_,(l,m,E,T)=>{if(!l)return yt(r,m||401,E,T);this.completeUpgrade(d,s,f,e,r,n,i)});return}if(!this.options.verifyClient(_))return yt(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[wa])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>fs)return yt(s,503);let f=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${ba("sha1").update(r+Ea).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[Ue.extensionName]){let d=e[Ue.extensionName].params,_=us.format({[Ue.extensionName]:[d]});f.push(`Sec-WebSocket-Extensions: ${_}`),p._extensions=e}this.emit("headers",f,i),s.write(f.concat(`\r
|
|
2
|
-
`).join(`\r
|
|
3
|
-
`)),s.removeListener("error",ds),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(gt,this)})),u(p,i)}};ms.exports=Wr;function Ta(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(Ta,"addListeners");function gt(t){t._state=ps,t.emit("close")}o(gt,"emitClose");function ds(){this.destroy()}o(ds,"socketOnError");function yt(t,e,r,n){r=r||Ft.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} ${Ft.STATUS_CODES[e]}\r
|
|
4
|
-
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
|
5
|
-
`)+`\r
|
|
6
|
-
\r
|
|
7
|
-
`+r)}o(yt,"abortHandshake");function Fe(t,e,r,n,i){if(t.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Fe),t.emit("wsClientError",s,r,e)}else yt(r,n,i)}o(Fe,"abortHandshakeOrEmitwsClientError")});h();var wt=re(pn(),1);function pe(t,e,{target:r="stdout",...n}={}){return wt.default[r]?Qr.link(t,e):n.fallback===!1?t:typeof n.fallback=="function"?n.fallback(t,e):`${t} (\u200B${e}\u200B)`}o(pe,"terminalLink");pe.isSupported=wt.default.stdout;pe.stderr=(t,e,r={})=>pe(t,e,{target:"stderr",...r});pe.stderr.isSupported=wt.default.stderr;h();import{randomUUID as Ts}from"node:crypto";h();var mn=re(xt(),1);import er from"node:os";var me,gn=o(async(t,e)=>{e["--telemetry"]&&(me=await import("./esm-PLVGBDRY.js"),me.init({dsn:"https://0c26e0d8afd94e77a88ee1c3aa9e7065@o250689.ingest.sentry.io/6703266",enabled:ve.productionLike&&(e["--telemetry"]??!1),release:je.version,environment:je.version.includes("experimental")?"experimental":"production"}))},"initSentry"),yn=o(async t=>{me&&(me.captureException(t,{event_id:t.id,captureContext:{tags:{arch:V.arch,bug:t.isBug,environment:ve.value,platform:V.platform,shell:V.shell,version:je.version},contexts:{ctx:{argv:process.argv},cause:t.cause?ce(t.cause):void 0,app:{app_name:je.name,app_version:je.version},device:{name:er.hostname(),family:er.type(),arch:er.arch()},runtime:{name:process.release.name,version:process.version}}}}),await me.flush((0,mn.default)("2s")))},"sendErrorToSentry"),_n=o(t=>{me&&me.addBreadcrumb(t)},"addSentryBreadcrumb"),Ja=o(t=>{me&&me.setUser(t)},"setSentryUser"),Za=o(t=>{me&&me.setTags(t)},"setSentryTags");var Os=o(async(t,e)=>{if(Kr(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=Be.from(e);if(r.print(),r.isBug===Re.NO)return;await yn(r)}finally{process.exit(1)}},"reportErrorAndExit"),hc=o(async(t,e)=>{t.log.debug("installing error handlers"),await gn(t,e);let r=o(n=>void Os(t,n),"handleError");process.once("uncaughtException",r),process.once("unhandledRejection",r)},"installErrorHandlers"),Re=Object.freeze({YES:"yes",NO:"no",MAYBE:"maybe"}),Be=class t extends Error{static{o(this,"GGTError")}id=ve.testLike?"00000000-0000-0000-0000-000000000000":Ts();cause;stack;constructor(e){super(e),Error.captureStackTrace(this,this.constructor),this.stack=Hr(this.stack,{pretty:!0,basePath:Xr})}static from(e){return e instanceof t?e:new tr(e)}sprint(){let e=this.render();if(this.isBug!==Re.NO){e=Et(e);let r=this.isBug===Re.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}`;pe.isSupported?e+=Et({ensureEmptyLineAbove:!0,content:_e`
|
|
8
|
-
${r}, ${pe("click here",n)} to create an issue on GitHub.
|
|
9
|
-
`}):e+=Et({ensureEmptyLineAbove:!0,content:_e`
|
|
10
|
-
${r}, use the link below to create an issue on GitHub.
|
|
11
|
-
|
|
12
|
-
${n}
|
|
13
|
-
`})}return e}print(e){rn({ensureEmptyLineAbove:!0,...e,content:this.sprint()})}},tr=class extends Be{constructor(r){super("An unexpected error occurred");this.cause=r}static{o(this,"UnexpectedError")}isBug=Re.YES;render(){let r=ce(this.cause),n=r.stack||r.message||this.stack;return this.message+`.
|
|
14
|
-
|
|
15
|
-
`+n}},bn=class extends Be{constructor(r,n){super(r);this.cause=n}static{o(this,"EdgeCaseError")}isBug=Re.MAYBE;render(){return this.message}};h();var sr=re(wn(),1);import Ls from"node:assert";var Sc=o(t=>t.filter(e=>!!e),"compact"),Sn=o(t=>[...new Set(t)],"uniq"),Tc=o((t,e)=>(Ls(e.length>0,"options must not be empty"),[...e].sort((r,n)=>sr.default.get(r,t)-sr.default.get(n,t))),"sortBySimilar");h();var kn=re(Tn(),1);import Rs from"node:assert";var we=class extends Be{constructor(r,n,i){super("An error occurred while communicating with Gadget");this.request=r;i?this.isBug=i:this.isBug=Re.MAYBE,Vt(n)?this.cause={type:n.type,message:n.message,error:ce(n.error)}:zt(n)?this.cause={type:n.type,code:n.code,reason:n.reason,wasClean:n.wasClean}:(Rs(vt(n)||jt(n)||Wt(n)||Ht(n),"cause must be a string, Error, GraphQLError[], CloseEvent, or ErrorEvent"),this.cause=n)}static{o(this,"ClientError")}isBug;cause;render(){let r;switch(!0){case Ht(this.cause):{let n=Sn(this.cause.map(i=>i.message));r=_e`
|
|
16
|
-
Gadget responded with the following ${(0,kn.default)("error",n.length,!1)}:
|
|
17
|
-
|
|
18
|
-
• ${n.join(`
|
|
19
|
-
\u2022 `)}
|
|
20
|
-
`;break}case zt(this.cause):r="The connection to Gadget closed unexpectedly.";break;case(Vt(this.cause)||Wt(this.cause)):r=this.cause.message;break;case jt(this.cause):this.cause.length===1?r=String(this.cause[0]):r=this.cause.join(", ");break;default:r=this.cause;break}return this.message+`
|
|
21
|
-
|
|
22
|
-
`+r}},On=class extends we{static{o(this,"AuthenticationError")}constructor(e){super(e,"Request authentication failed due to the session expiring while running the command. Please sign-in again.",Re.NO)}};h();h();import Ns from"node:assert";var As=o(t=>{let e=sn(t);return e&&`session=${encodeURIComponent(e)};`},"loadCookie"),cr=o(t=>{let e=nt(t);return Ns(e,"missing auth headers"),e},"loadAuthHeaders"),nt=o(t=>{let e=As(t);if(e)return t.log.trace("using cookie as auth header",{},{cookie:e}),{cookie:e};let r=an(t);if(r)return t.log.trace("using token as auth header",{},{token:r}),{"x-platform-access-token":r}},"maybeLoadAuthHeaders"),Is=o(t=>t instanceof Jr&&t.response.statusCode===401,"isUnauthorizedError"),Wc=o((t,e)=>{if(Is(e)){t.log.warn("swallowing unauthorized error",{error:e});return}throw e},"swallowUnauthorized");h();var ni=re(xt(),1);import Xs from"node:assert";import{Agent as eo}from"node:http";import{Agent as to}from"node:https";h();h();h();import Ks from"node:assert";h();h();var Cn=o((t,e,r,n)=>(r?r=Qt(r).trim():r="",JSON.stringify({level:t,name:e,msg:r,fields:$n(n)})+`
|
|
23
|
-
`),"formatJson"),$n=o(t=>{let e={};for(let[r,n]of Object.entries(t))e[r]=Ln(n);return e},"serializeFields"),Ln=o(t=>(t instanceof Set&&(t=Array.from(t)),Array.isArray(t)?t.map(Ln):(t instanceof Map&&(t=Object.fromEntries(t.entries())),qe(t)?$n(t):vt(t)?Qt(t).trim():t)),"serializeValue");h();var fr=re(xn(),1);import qs from"node:assert";h();var Yn=re(Qn(),1);var Kn=o(t=>{let e=Yn.default.stringify(t);return e?`?${e}`:""},"serializeObjectToHTTPQuery");h();var L=new zr({level:ve.testLike&&V.logLevel<F.PRINT?3:Vr.level}),P={error:L.red,success:L.green,warn:L.yellow,link:L.cyan,highlighted:L.magentaBright,examplesQuestions:L.cyanBright,subdued:L.blackBright,body:L.whiteBright,black:L.black,blackBright:L.blackBright,red:L.red,redBright:L.redBright,green:L.green,greenBright:L.greenBright,yellow:L.yellow,yellowBright:L.yellowBright,blue:L.blue,blueBright:L.blueBright,magenta:L.magenta,magentaBright:L.magentaBright,cyan:L.cyan,cyanBright:L.cyanBright,white:L.white,whiteBright:L.whiteBright,bgBlack:L.bgBlack,bgBlackBright:L.bgBlackBright,bgRed:L.bgRed,bgRedBright:L.bgRedBright,bgGreen:L.bgGreen,bgGreenBright:L.bgGreenBright,bgYellow:L.bgYellow,bgYellowBright:L.bgYellowBright,bgBlue:L.bgBlue,bgBlueBright:L.bgBlueBright,bgMagenta:L.bgMagenta,bgMagentaBright:L.bgMagentaBright,bgCyan:L.bgCyan,bgCyanBright:L.bgCyanBright,bgWhite:L.bgWhite,bgWhiteBright:L.bgWhiteBright,reset:L.reset};var Xn=o((t,e,r,n,i,s)=>`${Vs(i)} ${Hs(t)} ${Qs(e)}:${Ys(r)}${ei(n,{indent:2,timestamp:i,environment:s})}${Se}`,"formatPretty"),Ve="",Ae=" ",Se=`
|
|
24
|
-
`,js=":",Jn="'",Zn=o((t,e)=>{let r=t==="error"?P.error:P.subdued,n=[];n.push(Se);for(let i=0;i<e;i++)n.push(Ae);return n.push(r(t)),n.push(r(js)),n.join("")},"formatKey"),Ne=o((t,e,r)=>{if(!t)return Ve;let n=t.split(Se);if(n.length===0)return Ve;let i=[],s=n.shift();qs(!Yr(s),"first line is nil"),i.push(e(s));for(let a of n)if(a){i.push(Se);for(let u=0;u<r;u++)i.push(Ae);i.push(e(a))}return i.join(Ve)},"formatValue"),Ws=o((t,e)=>{let r="";return e&&(r=Kn(e)),`https://${t.application.slug}--${t.name}.${V.domains.app}/edit/logs${r}`},"getEnvironmentLogsUrl"),zs=o(t=>t?`{environment_id="${t.id.toString()}"} | json | level=~"info|warn|error"`:'{environment_id=~".+"} | json | level=~"info|warn|error"',"defaultLogqlQuery"),ei=o((t,e)=>{let{indent:r,environment:n,timestamp:i}=e;if(Object.keys(t).length===0)return Ve;let s=[];"trace_id"in t&&(s.push(Zn("trace_id",r)),s.push(Ae),n&&i&&pe.isSupported?s.push(pe(P.link(t.trace_id),Ws(n,{timeRange:`${i.toISOString()} to now`,logql:`${zs(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(Zn(a,r)),u instanceof Set&&(u=Array.from(u)),Array.isArray(u)){if(u.length===0){s.push(Ne(" []",P.subdued,r));continue}u=Object.fromEntries(u.entries())}if(u instanceof Map&&(u=Object.fromEntries(u)),qe(u)){let c=Object.entries(u);if(c.length===0){s.push(Ne(" {}",P.subdued,r));continue}c.length>10&&V.logLevel>F.TRACE&&!n&&(u=Object.fromEntries([...c.slice(0,10),[nn.ellipsis,`${c.length-10} more`]])),s.push(ei(u,{indent:r+2,environment:n}));continue}if(s.push(Ae),n)s.push(Ne(String(u),P.reset,r));else switch(typeof u){case"string":s.push(Ne(Jn+u.replaceAll(Se,Se+Ae.repeat(r+a.length))+Jn,P.reset,r));break;case"number":s.push(Ne(String(u),P.yellowBright,r));break;case"bigint":s.push(Ne(String(u)+"n",P.yellowBright,r));break;case"boolean":s.push(Ne(String(u),P.green,r));break;default:s.push(Ne(String(u),P.reset,r));break}}return s.join(Ve)},"formatFields"),Vs=o(t=>(t?(0,fr.default)(t):(0,fr.default)()).format("hh:mm:ss"),"formatTimestamp"),Hs=o(t=>{switch(t){case F.PRINT:return P.bgBlack(P.body.bold(" PRINT "));case F.TRACE:return P.bgBlue(P.body.bold(" TRACE "));case F.DEBUG:return P.bgMagenta(P.body.bold(" DEBUG "));case F.INFO:return P.bgBlue(P.body.bold(" INFO "));case F.WARN:return P.bgYellow(P.body.bold(" WARN "));case F.ERROR:return P.bgRed(P.body.bold(" ERROR "))}},"formatLevel"),Qs=o(t=>P.body(t),"formatName"),Ys=o(t=>{if(!t)return Ve;let e=t.split(Se);return e.length===1?Ae+P.body(t):Se+e.map(r=>Ae+Ae+r).join(Se)},"formatMessage");var hr={pretty:Xn,json:Cn};var Ql={"--log-level":{type:o(t=>tn(t,F.INFO),"type"),alias:["-ll"],default:F.INFO},"--my-logs":{type:Boolean}},Js={trace:F.TRACE,debug:F.DEBUG,info:F.INFO,warn:F.WARN,error:F.ERROR},Yl=o(t=>(e,r,n,i,s)=>{let a={...i};"error"in a&&(a.error=ce(a.error)),"reason"in a&&(a.reason=ce(a.reason));let u=hr[V.logFormat],c=Js[e.toLowerCase()];Ks(c,`Unknown level: ${e}`),Yt.writeStdout(u(c,r,n,a,s,t))},"createEnvironmentStructuredLogger"),ti=o(({name:t,fields:e={},devFields:r={}})=>{let n=o(i=>(s,a,u)=>{let c=i>=V.logLevel,f=i>=F.INFO;if(!c&&!f)return;let p={...oe(e),...a};if(ve.developmentOrTestLike&&Object.assign(p,oe(r),u),"error"in p&&(p.error=ce(p.error)),"reason"in p&&(p.reason=ce(p.reason)),c){let d=hr[V.logFormat];Yt.writeStderr(d(i,t,s,p))}f&&_n({level:"log",message:s,data:p})},"createStructuredLog");return{trace:n(F.TRACE),debug:n(F.DEBUG),info:n(F.INFO),warn:n(F.WARN),error:n(F.ERROR)}},"createStructuredLogger");var dr=o(({name:t,fields:e,devFields:r})=>({...ti({name:t,fields:e,devFields:r}),child:o(({name:n,fields:i,devFields:s})=>dr({name:n||t,fields:o(()=>({...oe(e),...oe(i)}),"fields"),devFields:{...oe(r),...oe(s)}}),"child")}),"createLogger");h();var ri=re(xt(),1);import{setTimeout as Zs}from"node:timers/promises";var su=o((t,e)=>Zs((0,ri.default)(t),void 0,e),"delay"),pr=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}},St=class{static{o(this,"PromiseSignal")}[Symbol.toStringTag];resolve;reject;_promise;constructor(){this._promise=new pr(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 Tt=class t extends AbortController{static{o(this,"Context")}done=new St;#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:dr(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 mr=o(t=>(Xs(t.context?.ctx instanceof Tt,_e(`
|
|
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"),Ot=Zr.extend({agent:{http:new eo({keepAlive:!0}),https:new to({keepAlive:!0,minVersion:"TLSv1.1"})},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,ni.default)("5s"),noise:100},hooks:{beforeRequest:[t=>{let e=mr(t);t.signal=e.signal,t.headers["user-agent"]=V.versionFull,e.log.debug("http request",{http:{request:{method:t.method,url:t.url?.toString()}}})}],beforeRetry:[(t,e)=>{mr(t.request?.options??t.options.context).log.warn("http request failed, retrying...",{http:{retryCount:e,error:ce(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=mr(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&&on(e,void 0),t}]}});h();import La from"node:assert";h();h();h();h();function ne(t){return t===null?"null":Array.isArray(t)?"array":typeof t}o(ne,"extendedTypeof");function Te(t){return ne(t)==="object"}o(Te,"isObject");function ii(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}o(ii,"areGraphQLErrors");function gr(t,e){return t.length<124?t:e}o(gr,"limitCloseReason");var si="graphql-transport-ws";var ae;(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"})(ae||(ae={}));var H;(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"})(H||(H={}));function oi(t){if(!Te(t))throw new Error(`Message is expected to be an object, but got ${ne(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 ${ne(t.type)}`);switch(t.type){case H.ConnectionInit:case H.ConnectionAck:case H.Ping:case H.Pong:{if(t.payload!=null&&!Te(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 H.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Te(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ne(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 ${ne(t.payload.query)}`);if(t.payload.variables!=null&&!Te(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 ${ne(t.payload.variables)}`);if(t.payload.operationName!=null&&ne(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 ${ne(t.payload.operationName)}`);if(t.payload.extensions!=null&&!Te(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 ${ne(t.payload.extensions)}`);break}case H.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Te(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ne(t.payload)}`);break}case H.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ii(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 H.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ne(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(oi,"validateMessage");function ai(t,e){return oi(typeof t=="string"?JSON.parse(t,e):t)}o(ai,"parseMessage");function He(t,e){return oi(t),JSON.stringify(t,e)}o(He,"stringifyMessage");var Qe=function(t){return this instanceof Qe?(this.v=t,this):new Qe(t)},ro=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(l){return function(m){return Promise.resolve(m).then(l,d)}}function u(l,m){n[l]&&(i[l]=function(E){return new Promise(function(T,R){s.push([l,E,T,R])>1||c(l,E)})},m&&(i[l]=m(i[l])))}function c(l,m){try{f(n[l](m))}catch(E){_(s[0][3],E)}}function f(l){l.value instanceof Qe?Promise.resolve(l.value.v).then(p,d):_(s[0][2],l)}function p(l){c("next",l)}function d(l){c("throw",l)}function _(l,m){l(m),s.shift(),s.length&&c(s[0][0],s[0][1])}};function ci(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:a=0,disablePong:u,connectionAckWaitTimeout:c=0,retryAttempts:f=5,retryWait:p=o(async function(g){let b=1e3;for(let x=0;x<g;x++)b*=2;await new Promise(x=>setTimeout(x,b+Math.floor(Math.random()*2700+300)))},"randomisedExponentialBackoff"),shouldRetry:d=yr,isFatalConnectionProblem:_,on:l,webSocketImpl:m,generateID:E=o(function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let b=Math.random()*16|0;return(g=="x"?b:b&3|8).toString(16)})},"generateUUID"),jsonMessageReplacer:T,jsonMessageReviver:R}=t,B;if(m){if(!io(m))throw new Error("Invalid WebSocket implementation provided");B=m}else typeof WebSocket<"u"?B=WebSocket:typeof global<"u"?B=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(B=window.WebSocket||window.MozWebSocket);if(!B)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let Q=B,C=(()=>{let y=(()=>{let b={};return{on(x,S){return b[x]=S,()=>{delete b[x]}},emit(x){var S;"id"in x&&((S=b[x.id])===null||S===void 0||S.call(b,x))}}})(),g={connecting:l?.connecting?[l.connecting]:[],opened:l?.opened?[l.opened]:[],connected:l?.connected?[l.connected]:[],ping:l?.ping?[l.ping]:[],pong:l?.pong?[l.pong]:[],message:l?.message?[y.emit,l.message]:[y.emit],closed:l?.closed?[l.closed]:[],error:l?.error?[l.error]:[]};return{onMessage:y.on,on(b,x){let S=g[b];return S.push(x),()=>{S.splice(S.indexOf(x),1)}},emit(b,...x){for(let S of[...g[b]])S(...x)}}})();function W(y){let g=[C.on("error",b=>{g.forEach(x=>x()),y(b)}),C.on("closed",b=>{g.forEach(x=>x()),y(b)})]}o(W,"errorOrClosed");let Y,j=0,I,$=!1,ee=0,et=!1;async function O(){clearTimeout(I);let[y,g]=await(Y??(Y=new Promise((S,N)=>(async()=>{if($){if(await p(ee),!j)return Y=void 0,N({code:1e3,reason:"All Subscriptions Gone"});ee++}C.emit("connecting",$);let k=new Q(typeof e=="function"?await e():e,si),D,K;function de(){isFinite(a)&&a>0&&(clearTimeout(K),K=setTimeout(()=>{k.readyState===Q.OPEN&&(k.send(He({type:H.Ping})),C.emit("ping",!1,void 0))},a))}o(de,"enqueuePing"),W(z=>{Y=void 0,clearTimeout(D),clearTimeout(K),N(z),z instanceof kt&&(k.close(4499,"Terminated"),k.onerror=null,k.onclose=null)}),k.onerror=z=>C.emit("error",z),k.onclose=z=>C.emit("closed",z),k.onopen=async()=>{try{C.emit("opened",k);let z=typeof r=="function"?await r():r;if(k.readyState!==Q.OPEN)return;k.send(He(z?{type:H.ConnectionInit,payload:z}:{type:H.ConnectionInit},T)),isFinite(c)&&c>0&&(D=setTimeout(()=>{k.close(ae.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),de()}catch(z){C.emit("error",z),k.close(ae.InternalClientError,gr(z instanceof Error?z.message:new Error(z).message,"Internal client error"))}};let se=!1;k.onmessage=({data:z})=>{try{let G=ai(z,R);if(C.emit("message",G),G.type==="ping"||G.type==="pong"){C.emit(G.type,!0,G.payload),G.type==="pong"?de():u||(k.send(He(G.payload?{type:H.Pong,payload:G.payload}:{type:H.Pong})),C.emit("pong",!1,G.payload));return}if(se)return;if(G.type!==H.ConnectionAck)throw new Error(`First message cannot be of type ${G.type}`);clearTimeout(D),se=!0,C.emit("connected",k,G.payload,$),$=!1,ee=0,S([k,new Promise((te,ye)=>W(ye))])}catch(G){k.onmessage=null,C.emit("error",G),k.close(ae.BadResponse,gr(G instanceof Error?G.message:new Error(G).message,"Bad response"))}}})())));y.readyState===Q.CLOSING&&await g;let b=o(()=>{},"release"),x=new Promise(S=>b=S);return[y,b,Promise.race([x.then(()=>{if(!j){let S=o(()=>y.close(1e3,"Normal Closure"),"complete");isFinite(s)&&s>0?I=setTimeout(()=>{y.readyState===Q.OPEN&&S()},s):S()}}),g])]}o(O,"connect");function w(y){if(yr(y)&&(no(y.code)||[ae.InternalServerError,ae.InternalClientError,ae.BadRequest,ae.BadResponse,ae.Unauthorized,ae.SubprotocolNotAcceptable,ae.SubscriberAlreadyExists,ae.TooManyInitialisationRequests].includes(y.code)))throw y;if(et)return!1;if(yr(y)&&y.code===1e3)return j>0;if(!f||ee>=f||!d(y)||_?.(y))throw y;return $=!0}o(w,"shouldRetryConnectOrThrow"),n||(async()=>{for(j++;;)try{let[,,y]=await O();await y}catch(y){try{if(!w(y))return}catch(g){return i?.(g)}}})();function v(y,g){let b=E(y),x=!1,S=!1,N=o(()=>{j--,x=!0},"releaser");return(async()=>{for(j++;;)try{let[k,D,K]=await O();if(x)return D();let de=C.onMessage(b,se=>{switch(se.type){case H.Next:{g.next(se.payload);return}case H.Error:{S=!0,x=!0,g.error(se.payload),N();return}case H.Complete:{x=!0,N();return}}});k.send(He({id:b,type:H.Subscribe,payload:y},T)),N=o(()=>{!x&&k.readyState===Q.OPEN&&k.send(He({id:b,type:H.Complete},T)),j--,x=!0,D()},"releaser"),await K.finally(de);return}catch(k){if(!w(k))return}})().then(()=>{S||g.complete()}).catch(k=>{g.error(k)}),()=>{x||N()}}return o(v,"subscribe"),{on:C.on,subscribe:v,iterate(y){let g=[],b={done:!1,error:null,resolve:o(()=>{},"resolve")},x=v(y,{next(N){g.push(N),b.resolve()},error(N){b.done=!0,b.error=N,b.resolve()},complete(){b.done=!0,b.resolve()}}),S=o(function(){return ro(this,arguments,o(function*(){for(;;){for(g.length||(yield Qe(new Promise(D=>b.resolve=D)));g.length;)yield yield Qe(g.shift());if(b.error)throw b.error;if(b.done)return yield Qe(void 0)}},"iterator_1"))},"iterator")();return S.throw=async N=>(b.done||(b.done=!0,b.error=N,b.resolve()),{done:!0,value:void 0}),S.return=async()=>(x(),{done:!0,value:void 0}),S},async dispose(){if(et=!0,Y){let[y]=await Y;y.close(1e3,"Normal Closure")}},terminate(){Y&&C.emit("closed",new kt)}}}o(ci,"createClient");var kt=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 yr(t){return Te(t)&&"code"in t&&"reason"in t}o(yr,"isLikeCloseEvent");function no(t){return[1e3,1001,1006,1005,1012,1013,1014].includes(t)?!1:t>=1e3&&t<=1999}o(no,"isFatalInternalCloseCode");function io(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}o(io,"isWebSocket");var bs=re(xt(),1);h();h();var br=re(ui(),1);h();var ot=class extends Error{static{o(this,"TimeoutError")}constructor(e){super(e),this.name="TimeoutError"}},xr=class extends Error{static{o(this,"AbortError")}constructor(e){super(),this.name="AbortError",this.message=e}},fi=o(t=>globalThis.DOMException===void 0?new xr(t):new DOMException(t),"getDOMException"),hi=o(t=>{let e=t.reason===void 0?fi("This operation was aborted."):t.reason;return e instanceof Error?e:fi(e)},"getAbortedReason");function vr(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:l}=e;l.aborted&&d(hi(l)),u=o(()=>{d(hi(l))},"abortHandler"),l.addEventListener("abort",u,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(p,d);return}let _=new ot;a=s.setTimeout.call(void 0,()=>{if(n){try{p(n())}catch(l){d(l)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?p():i instanceof Error?d(i):(_.message=i??`Promise timed out after ${r} milliseconds`,d(_))},r),(async()=>{try{p(await t)}catch(l){d(l)}})()}).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(vr,"pTimeout");h();h();function Er(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(Er,"lowerBound");var at=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=Er(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 ct=class extends br.default{static{o(this,"PQueue")}#e;#i;#o=0;#d;#a;#p=0;#r;#c;#t;#m;#n=0;#l;#s;#g;#b=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:at,...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#v(){return this.#n<this.#l}#E(){this.#n--,this.#u(),this.emit("next")}#w(){this.#_(),this.#y(),this.#c=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.#c===void 0&&(this.#c=setTimeout(()=>{this.#w()},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.#v){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.#_()},this.#a),this.#p=Date.now()+this.#a)}#_(){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.#l}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.#l=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.#b++).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=vr(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 ot&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#E()}},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 Oa=re(gi(),1),ka=re(Ar(),1),Ca=re(Br(),1),ys=re(jr(),1),$a=re(gs(),1);var _s=ys.default;var qt=class{constructor(e,r,n){this.environment=r;this.endpoint=n;this.ctx=e.child({name:"client"}),this._graphqlWsClient=ci({url:`wss://${r.application.slug}.${V.domains.app}/edit/api/graphql-ws`,keepAlive:(0,bs.default)("10s"),shouldRetry:o(()=>!0,"shouldRetry"),connectionParams:{environment:r.name},webSocketImpl:class extends _s{static{o(this,"webSocketImpl")}constructor(i,s,a){super(i,s,{signal:e.signal,...a,headers:{...a?.headers,"user-agent":V.versionFull,...cr(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=en}){let u={query:r,variables:oe(n)},c=this._graphqlWsClient.on("connected",()=>{this.status===2&&(u.variables=oe(n),e.log.info("re-subscribing to graphql subscription"))}),f=new ct({concurrency:1}),p=o(_=>s(new we(r,_)),"onError"),d=this._graphqlWsClient.subscribe(u,{next:o(_=>void f.add(()=>i(_)).catch(p),"next"),error:o(_=>void f.add(()=>p(_)),"error"),complete:o(()=>void f.add(()=>a()).catch(p),"complete")});return()=>{e.log.trace("unsubscribing from graphql subscription"),c(),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 Ot({context:{ctx:e},method:"POST",url:`https://${n}.${V.domains.app}${this.endpoint}`,headers:{...cr(e),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:oe(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!qe(i)||!("data"in i)&&!("errors"in i))throw e.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new we(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var _t=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];La(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:oe(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 we(e,a.errors);if(!a.data)throw new we(e,"Query response did not contain data");return a.data}async dispose(){await this.#e.dispose()}};h();var xs=_e(`
|
|
32
|
-
query GadgetMetaModels {
|
|
33
|
-
gadgetMeta {
|
|
34
|
-
models {
|
|
35
|
-
apiIdentifier
|
|
36
|
-
namespace
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`),vs=_e(`
|
|
41
|
-
query GadgetMetaGlobalActions {
|
|
42
|
-
gadgetMeta {
|
|
43
|
-
globalActions {
|
|
44
|
-
apiIdentifier
|
|
45
|
-
namespace
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`);var Ra=Object.freeze({Development:"development",Production:"production",Test:"test"}),Na=A.object({id:A.union([A.string(),A.number(),A.bigint()]).transform(t=>BigInt(t)),name:A.string().transform(t=>t.toLowerCase()),type:A.nativeEnum(Ra)}),Aa=A.object({id:A.union([A.string(),A.number(),A.bigint()]).transform(t=>BigInt(t)),slug:A.string(),primaryDomain:A.string(),hasSplitEnvironments:A.boolean(),multiEnvironmentEnabled:A.boolean(),environments:A.array(Na),team:A.object({id:A.union([A.string(),A.number(),A.bigint()]).transform(t=>BigInt(t)),name:A.string()})}),kh=A.object({apiIdentifier:A.string(),namespace:A.nullable(A.array(A.string())).optional()}),Ch=A.object({apiIdentifier:A.string(),namespace:A.nullable(A.array(A.string())).optional()}),$h=o(async t=>{let e=nt(t);if(!e)return[];let r=await Ot({context:{ctx:t},url:`https://${V.domains.services}/auth/api/apps`,headers:{...e},responseType:"json",resolveBodyOnly:!0});return A.array(Aa).parse(r)},"getApplications"),Lh=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"),Rh=o(async(t,e)=>{if(!nt(t))return[];let n=new _t(t,e),{gadgetMeta:i}=await n.query({query:xs});return i.models},"getModels"),Nh=o(async(t,e)=>{if(!nt(t))return[];let n=new _t(t,e),{gadgetMeta:i}=await n.query({query:vs});return i.globalActions},"getGlobalActions");export{pe as a,Ja as b,Za as c,Os as d,hc as e,Re as f,Be as g,tr as h,bn as i,xn as j,Tn as k,Sc as l,Sn as m,Tc as n,we as o,On as p,ct as q,nt as r,Wc as s,qt as t,Ra as u,$h as v,Lh as w,Rh as x,Nh as y,P as z,Ql as A,Yl as B,su as C,Tt as D,Ot as E};
|
|
50
|
-
//# sourceMappingURL=chunk-GCO2TOVZ.js.map
|