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