@gadgetinc/ggt 1.3.2 → 1.3.3

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.
Files changed (39) hide show
  1. package/dist/{add-OTQMXZUR.js → add-R6TZAGXK.js} +2 -2
  2. package/dist/{chunk-XB3JTJT6.js → chunk-AGPFNOXG.js} +2 -2
  3. package/dist/{chunk-BKO2TX4J.js → chunk-E3I3MPQD.js} +2 -2
  4. package/dist/{chunk-PC6ANBC6.js → chunk-IPKFNVOS.js} +2 -2
  5. package/dist/{chunk-3HRT72TB.js → chunk-NGYGSK7A.js} +2 -2
  6. package/dist/{chunk-W4IVYUHW.js → chunk-NO72UU5F.js} +2 -2
  7. package/dist/chunk-RIIVR43B.js +50 -0
  8. package/dist/{chunk-O2K4B6AL.js.map → chunk-RIIVR43B.js.map} +3 -3
  9. package/dist/{chunk-W5JAWOQQ.js → chunk-TMPKLC3N.js} +2 -2
  10. package/dist/{deploy-RK5PRQ4T.js → deploy-2SXBPB5C.js} +2 -2
  11. package/dist/{dev-J6QHZMPR.js → dev-I23ZQELT.js} +2 -2
  12. package/dist/{list-A7LFGUXG.js → list-ML7QUWEU.js} +2 -2
  13. package/dist/login-CEGC4DIJ.js +2 -0
  14. package/dist/main.js +1 -1
  15. package/dist/{open-OZDKOY6V.js → open-5DTFJE26.js} +2 -2
  16. package/dist/{pull-YLUFPDDX.js → pull-TC2GVZRD.js} +2 -2
  17. package/dist/push-DUSAXZ3K.js +2 -0
  18. package/dist/{status-MP45HWIM.js → status-2CZXUGSZ.js} +2 -2
  19. package/dist/{whoami-PPXXBHUR.js → whoami-NI52A6U4.js} +2 -2
  20. package/package.json +8 -8
  21. package/dist/chunk-O2K4B6AL.js +0 -50
  22. package/dist/login-BP4XIHLA.js +0 -2
  23. package/dist/push-FFLXHGFG.js +0 -2
  24. /package/dist/{add-OTQMXZUR.js.map → add-R6TZAGXK.js.map} +0 -0
  25. /package/dist/{chunk-XB3JTJT6.js.map → chunk-AGPFNOXG.js.map} +0 -0
  26. /package/dist/{chunk-BKO2TX4J.js.map → chunk-E3I3MPQD.js.map} +0 -0
  27. /package/dist/{chunk-PC6ANBC6.js.map → chunk-IPKFNVOS.js.map} +0 -0
  28. /package/dist/{chunk-3HRT72TB.js.map → chunk-NGYGSK7A.js.map} +0 -0
  29. /package/dist/{chunk-W4IVYUHW.js.map → chunk-NO72UU5F.js.map} +0 -0
  30. /package/dist/{chunk-W5JAWOQQ.js.map → chunk-TMPKLC3N.js.map} +0 -0
  31. /package/dist/{deploy-RK5PRQ4T.js.map → deploy-2SXBPB5C.js.map} +0 -0
  32. /package/dist/{dev-J6QHZMPR.js.map → dev-I23ZQELT.js.map} +0 -0
  33. /package/dist/{list-A7LFGUXG.js.map → list-ML7QUWEU.js.map} +0 -0
  34. /package/dist/{login-BP4XIHLA.js.map → login-CEGC4DIJ.js.map} +0 -0
  35. /package/dist/{open-OZDKOY6V.js.map → open-5DTFJE26.js.map} +0 -0
  36. /package/dist/{pull-YLUFPDDX.js.map → pull-TC2GVZRD.js.map} +0 -0
  37. /package/dist/{push-FFLXHGFG.js.map → push-DUSAXZ3K.js.map} +0 -0
  38. /package/dist/{status-MP45HWIM.js.map → status-2CZXUGSZ.js.map} +0 -0
  39. /package/dist/{whoami-PPXXBHUR.js.map → whoami-NI52A6U4.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-PC6ANBC6.js";import{g as F,l as j,m as M,n as N,o as k}from"./chunk-BKO2TX4J.js";import"./chunk-HCQR6OPH.js";import"./chunk-W5JAWOQQ.js";import{c as f}from"./chunk-W4IVYUHW.js";import"./chunk-FQ2LR3BI.js";import"./chunk-XB3JTJT6.js";import{a as T,f as v,g as E,j as y,n as $,p as u,x as C,y as B}from"./chunk-O2K4B6AL.js";import"./chunk-AGRDDZFS.js";import{$ as p,Z as r,b as m,m as b}from"./chunk-GIAIN3IJ.js";import"./chunk-B6XQEEUK.js";import{g as _}from"./chunk-SGMPMYEU.js";_();var h=class extends E{isBug=v.NO;constructor(t){let n="";if(b(t.cause)){let a=$(t.cause.map(e=>e.message));n=r` • ${a.map(e=>e.split(`
1
+ import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-IPKFNVOS.js";import{g as F,l as j,m as M,n as N,o as k}from"./chunk-E3I3MPQD.js";import"./chunk-HCQR6OPH.js";import"./chunk-TMPKLC3N.js";import{c as f}from"./chunk-NO72UU5F.js";import"./chunk-FQ2LR3BI.js";import"./chunk-AGPFNOXG.js";import{a as T,f as v,g as E,j as y,n as $,p as u,x as C,y as B}from"./chunk-RIIVR43B.js";import"./chunk-AGRDDZFS.js";import{$ as p,Z as r,b as m,m as b}from"./chunk-GIAIN3IJ.js";import"./chunk-B6XQEEUK.js";import{g as _}from"./chunk-SGMPMYEU.js";_();var h=class extends E{isBug=v.NO;constructor(t){let n="";if(b(t.cause)){let a=$(t.cause.map(e=>e.message));n=r` • ${a.map(e=>e.split(`
2
2
  `).join(`
3
3
  \u200E \u2022 `)).join(`
4
4
  `)}`}else n=r`${t.cause}`;super(n)}render(){return`${m.redBright(y.cross)} Failed to add:
@@ -75,4 +75,4 @@ import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-PC6ANBC6.js";impor
75
75
 
76
76
  {gray Usage}
77
77
  {cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);try{let i=(await a.edit.mutate({mutation:O,variables:{path:e[0],fields:s.map(d=>({name:d.name,fieldType:d.fieldType}))}})).createModelFields;await n.writeToLocalFilesystem(o,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]})}catch(i){throw i instanceof u?new h(i):i}p({ensureEmptyLineAbove:!0,content:`Field ${m.cyanBright(s[0]?.name)} added successfully.`})};export{h as AddClientError,ce as args,me as run,I as usage};
78
- //# sourceMappingURL=add-OTQMXZUR.js.map
78
+ //# sourceMappingURL=add-R6TZAGXK.js.map
@@ -1,4 +1,4 @@
1
- import{E as se,b as oe,r as ne,s as ie}from"./chunk-O2K4B6AL.js";import{e as G}from"./chunk-AGRDDZFS.js";import{$ as p,D,F as te,G as E,P as w,U as x,Z as T,_ as H,b as A,e as h}from"./chunk-GIAIN3IJ.js";import{d as Ae,g as s}from"./chunk-SGMPMYEU.js";s();s();import Ee from"node:net";import Te from"node:os";var I=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Le=1e3*15;var L,$e=()=>{let e=Te.networkInterfaces(),r=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(e))for(let o of t)r.add(o.address);return r},ae=e=>new Promise((r,t)=>{let o=Ee.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),ce=async(e,r)=>{if(e.host||e.port===0)return ae(e);for(let t of r)try{await ae({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},Be=function*(e){e&&(yield*e),yield 0};async function _(e){let r,t=new Set;if(e&&(e.port&&(r=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 a of n){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}t=new Set(n)}L===void 0&&(L=setTimeout(()=>{L=void 0,b.old=b.young,b.young=new Set},Le),L.unref&&L.unref());let o=$e();for(let n of Be(r))try{if(t.has(n))continue;let a=await ce({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new I(n);a=await ce({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof I))throw a}throw new Error("No available ports found")}import re from"node:assert";import Wr from"node:http";s();import R from"node:process";import{Buffer as Ke}from"node:buffer";import me from"node:path";import{fileURLToPath as Ye}from"node:url";import Xe from"node:child_process";import q,{constants as he}from"node:fs/promises";s();function g(e,r,t){let o=n=>Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let n=t();return o(n),n},set(n){o(n)}}),e}s();import{promisify as Ge}from"node:util";import Y from"node:process";import{execFile as _e}from"node:child_process";s();import{promisify as Ce}from"node:util";import We from"node:process";import{execFile as Ie}from"node:child_process";var Ne=Ce(Ie);async function j(){if(We.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Ne("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}s();s();import Re from"node:process";import{promisify as ke}from"node:util";import{execFile as Fe,execFileSync as Yr}from"node:child_process";var Oe=ke(Fe);async function le(e,{humanReadableOutput:r=!0}={}){if(Re.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await Oe("osascript",["-e",e,t]);return o.trim()}async function z(e){return le(`tell application "Finder" to set app_path to application file id "${e}" as string
1
+ import{E as se,b as oe,r as ne,s as ie}from"./chunk-RIIVR43B.js";import{e as G}from"./chunk-AGRDDZFS.js";import{$ as p,D,F as te,G as E,P as w,U as x,Z as T,_ as H,b as A,e as h}from"./chunk-GIAIN3IJ.js";import{d as Ae,g as s}from"./chunk-SGMPMYEU.js";s();s();import Ee from"node:net";import Te from"node:os";var I=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Le=1e3*15;var L,$e=()=>{let e=Te.networkInterfaces(),r=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(e))for(let o of t)r.add(o.address);return r},ae=e=>new Promise((r,t)=>{let o=Ee.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),ce=async(e,r)=>{if(e.host||e.port===0)return ae(e);for(let t of r)try{await ae({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},Be=function*(e){e&&(yield*e),yield 0};async function _(e){let r,t=new Set;if(e&&(e.port&&(r=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 a of n){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}t=new Set(n)}L===void 0&&(L=setTimeout(()=>{L=void 0,b.old=b.young,b.young=new Set},Le),L.unref&&L.unref());let o=$e();for(let n of Be(r))try{if(t.has(n))continue;let a=await ce({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new I(n);a=await ce({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof I))throw a}throw new Error("No available ports found")}import re from"node:assert";import Wr from"node:http";s();import R from"node:process";import{Buffer as Ke}from"node:buffer";import me from"node:path";import{fileURLToPath as Ye}from"node:url";import Xe from"node:child_process";import q,{constants as he}from"node:fs/promises";s();function g(e,r,t){let o=n=>Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let n=t();return o(n),n},set(n){o(n)}}),e}s();import{promisify as Ge}from"node:util";import Y from"node:process";import{execFile as _e}from"node:child_process";s();import{promisify as Ce}from"node:util";import We from"node:process";import{execFile as Ie}from"node:child_process";var Ne=Ce(Ie);async function j(){if(We.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Ne("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}s();s();import Re from"node:process";import{promisify as ke}from"node:util";import{execFile as Fe,execFileSync as Yr}from"node:child_process";var Oe=ke(Fe);async function le(e,{humanReadableOutput:r=!0}={}){if(Re.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await Oe("osascript",["-e",e,t]);return o.trim()}async function z(e){return le(`tell application "Finder" to set app_path to application file id "${e}" as string
2
2
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}s();import{promisify as Ue}from"node:util";import{execFile as Me}from"node:child_process";var De=Ue(Me),He={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"}},N=class extends Error{};async function K(e=De){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new N(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:o}=t.groups,n=He[o];if(!n)throw new N(`Unknown browser ID: ${o}`);return n}var je=Ge(_e),ze=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,r=>r.toUpperCase());async function X(){if(Y.platform==="darwin"){let e=await j();return{name:await z(e),id:e}}if(Y.platform==="linux"){let{stdout:e}=await je("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:ze(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(Y.platform==="win32")return K();throw new Error("Only macOS, Linux, and Windows are supported")}var J=me.dirname(Ye(import.meta.url)),ue=me.join(J,"xdg-open"),{platform:y,arch:de}=R,qe=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",o=!1;try{await q.access(t,he.F_OK),o=!0}catch{}if(!o)return e;let n=await q.readFile(t,{encoding:"utf8"}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return a?(r=a.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),pe=async(e,r)=>{let t;for(let o of e)try{return await r(o)}catch(n){t=n}throw t},k=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return pe(e.app,l=>k({...e,app:l}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return pe(r,l=>k({...e,app:{name:l,arguments:t}}));if(r==="browser"||r==="browserPrivate"){let l={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},c={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},u=await X();if(u.id in l){let m=l[u.id];return r==="browserPrivate"&&t.push(c[m]),k({...e,app:{name:v[m],arguments:t}})}throw new Error(`${u.name} is not supported as a default browser`)}let o,n=[],a={};if(y==="darwin")o="open",e.wait&&n.push("--wait-apps"),e.background&&n.push("--background"),e.newInstance&&n.push("--new"),r&&n.push("-a",r);else if(y==="win32"||E&&!te()&&!r){let l=await qe();o=E?`${l}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${R.env.SYSTEMROOT||R.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),E||(a.windowsVerbatimArguments=!0);let c=["Start"];e.wait&&c.push("-Wait"),r?(c.push(`"\`"${r}\`""`),e.target&&t.push(e.target)):e.target&&c.push(`"${e.target}"`),t.length>0&&(t=t.map(u=>`"\`"${u}\`""`),c.push("-ArgumentList",t.join(","))),e.target=Ke.from(c.join(" "),"utf16le").toString("base64")}else{if(r)o=r;else{let l=!J||J==="/",c=!1;try{await q.access(ue,he.X_OK),c=!0}catch{}o=R.versions.electron??(y==="android"||l||!c)?"xdg-open":ue}t.length>0&&n.push(...t),e.wait||(a.stdio="ignore",a.detached=!0)}y==="darwin"&&t.length>0&&n.push("--args",...t),e.target&&n.push(e.target);let d=Xe.spawn(o,n,a);return e.wait?new Promise((l,c)=>{d.once("error",c),d.once("close",u=>{if(!e.allowNonzeroExitCode&&u>0){c(new Error(`Exited with code ${u}`));return}l(d)})}):(d.unref(),d)},Je=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return k({...r,target:e})};function fe(e){if(typeof e=="string"||Array.isArray(e))return e;let{[de]:r}=e;if(!r)throw new Error(`${de} is not supported`);return r}function V({[y]:e},{wsl:r}){if(r&&E)return fe(r);if(!e)throw new Error(`${y} is not supported`);return fe(e)}var v={};g(v,"chrome",()=>V({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"]}}));g(v,"firefox",()=>V({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));g(v,"edge",()=>V({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));g(v,"browser",()=>"browser");g(v,"browserPrivate",()=>"browserPrivate");var ge=Je;s();import Br from"node:assert";s();import W from"node:process";s();s();var O={};Ae(O,{beep:()=>Sr,clearScreen:()=>xr,clearTerminal:()=>br,cursorBackward:()=>or,cursorDown:()=>rr,cursorForward:()=>tr,cursorGetPosition:()=>sr,cursorHide:()=>lr,cursorLeft:()=>be,cursorMove:()=>er,cursorNextLine:()=>ar,cursorPrevLine:()=>cr,cursorRestorePosition:()=>ir,cursorSavePosition:()=>nr,cursorShow:()=>ur,cursorTo:()=>Ze,cursorUp:()=>xe,enterAlternativeScreen:()=>yr,eraseDown:()=>mr,eraseEndLine:()=>pr,eraseLine:()=>ye,eraseLines:()=>dr,eraseScreen:()=>Q,eraseStartLine:()=>fr,eraseUp:()=>hr,exitAlternativeScreen:()=>vr,iTerm:()=>Er,image:()=>Ar,link:()=>Pr,scrollDown:()=>wr,scrollUp:()=>gr});s();import Z from"node:process";s();var F=globalThis.window?.document!==void 0,Pt=globalThis.process?.versions?.node!==void 0,At=globalThis.process?.versions?.bun!==void 0,Et=globalThis.Deno?.version?.deno!==void 0,Tt=globalThis.process?.versions?.electron!==void 0,Lt=globalThis.navigator?.userAgent?.includes("jsdom")===!0,$t=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Bt=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,Ct=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,Wt=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,$=globalThis.navigator?.userAgentData?.platform,It=$==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Nt=$==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",Rt=$==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",kt=$==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Ft=$==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var i="\x1B[",C="\x1B]",S="\x07",B=";",we=!F&&Z.env.TERM_PROGRAM==="Apple_Terminal",Ve=!F&&Z.platform==="win32",Qe=F?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Z.cwd,Ze=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?i+(e+1)+"G":i+(r+1)+B+(e+1)+"H"},er=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=i+-e+"D":e>0&&(t+=i+e+"C"),r<0?t+=i+-r+"A":r>0&&(t+=i+r+"B"),t},xe=(e=1)=>i+e+"A",rr=(e=1)=>i+e+"B",tr=(e=1)=>i+e+"C",or=(e=1)=>i+e+"D",be=i+"G",nr=we?"\x1B7":i+"s",ir=we?"\x1B8":i+"u",sr=i+"6n",ar=i+"E",cr=i+"F",lr=i+"?25l",ur=i+"?25h",dr=e=>{let r="";for(let t=0;t<e;t++)r+=ye+(t<e-1?xe():"");return e&&(r+=be),r},pr=i+"K",fr=i+"1K",ye=i+"2K",mr=i+"J",hr=i+"1J",Q=i+"2J",gr=i+"S",wr=i+"T",xr="\x1Bc",br=Ve?`${Q}${i}0f`:`${Q}${i}3J${i}H`,yr=i+"?1049h",vr=i+"?1049l",Sr=S,Pr=(e,r)=>[C,"8",B,B,r,S,e,C,"8",B,B,S].join(""),Ar=(e,r={})=>{let t=`${C}1337;File=inline=1`;return r.width&&(t+=`;width=${r.width}`),r.height&&(t+=`;height=${r.height}`),r.preserveAspectRatio===!1&&(t+=";preserveAspectRatio=0"),t+":"+Buffer.from(e).toString("base64")+S},Er={setCwd:(e=Qe())=>`${C}50;CurrentDir=${e}${S}`,annotation(e,r={}){let t=`${C}1337;`,o=r.x!==void 0,n=r.y!==void 0;if((o||n)&&!(o&&n&&r.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),t+=r.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",r.length>0?t+=(o?[e,r.length,r.x,r.y]:[r.length,e]).join("|"):t+=e,t+S}};import Tr from"node:assert";import Lr from"node:events";import f from"node:process";import ve from"node:readline";var U=class e extends Lr{static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),Tr(!e.active,"only one prompt can be active at a time"),e.active=!0;let r=ve.createInterface({input:f.stdin,escapeCodeTimeout:50});ve.emitKeypressEvents(f.stdin,r),f.stdin.isTTY&&f.stdin.setRawMode(!0);let t=["SelectPrompt"].includes(this.constructor.name),o=(n,a)=>{let d=$r(a,t);d===!1?this._(n,a):d&&typeof this[d]=="function"?this[d](a):this.bell()};this.close=()=>{f.stdin.removeListener("keypress",o),f.stdin.isTTY&&f.stdin.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0,e.active=!1},f.stdin.on("keypress",o)}_(r,t){}onRender(){}fire(){this.emit("state",{value:this.value,aborted:this.aborted,exited:this.exited})}bell(){x.writeStdout(O.beep)}render(){this.onRender(),this.firstRender&&(this.firstRender=!1)}},$r=(e,r)=>{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(r){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}}},Vt=(e,r,t)=>{t=t||r;let o=Math.min(r-t,e-Math.floor(t/2));o<0&&(o=0);let n=Math.min(o+t,r);return{startIndex:o,endIndex:n}};var Se=e=>{let r;if(typeof e=="string"?r={content:e}:r=e,r=D(r,{ensureEmptyLineAbove:!0,ensureNewLine:!0,exitWhenNo:!0}),!x.isInteractive){let t=r.whenNotInteractive??(()=>{p(r),p({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),W.exit(1)});return Promise.resolve(t())}return new Promise(t=>{let o=new ee(r);o.on("submit",t),o.on("exit",()=>W.exit(0)),o.on("abort",()=>W.exit(1))})},ee=class extends U{value=void 0;defaultValue=!1;options;constructor(r){super(),this.options=D(r,{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&&W.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&&W.exit(0)}_(r,t){if(r.toLowerCase()==="y"){this.value=!0,this.submit();return}if(r.toLowerCase()==="n"){this.value=!1,this.submit();return}this.bell()}render(r=this.value){if(super.render(),this.done){x.persistPrompt(H({...this.options,content:`${this.options.content} ${r?A.bold.greenBright("Yes."):A.bold.redBright("No.")}`}));return}x.updatePrompt(H({...this.options,content:`${this.options.content} ${this.defaultValue?A.blueBright("[Y/n] "):A.blueBright("[y/N] ")}`}))}};var Cr=h.object({id:h.union([h.string(),h.number()]).transform(Number),name:h.string().nullish(),email:h.string()}),M=async e=>{let r=ne(e);if(r)try{let t=await se({context:{ctx:e},url:`https://${w.domains.services}/auth/api/current-user`,headers:r,responseType:"json",resolveBodyOnly:!0}),o=Cr.parse(t);return e.log.info("loaded user",{user:{id:o.id}},{user:o}),oe(o),o}catch(t){ie(e,t);return}},bo=async(e,r)=>{let t=await M(e);return t||(e.log.info("prompting user to log in"),p({ensureEmptyLineAbove:!0,content:`You must be logged in to use "ggt ${r}".`}),await Se({ensureEmptyLineAbove:!0,content:"Would you like to log in?"}),await Pe(e,{_:[]}),t=await M(e),Br(t,"missing user after successful login"),t)};var Wo=()=>T`
3
3
  Log in to your account.
4
4
 
@@ -15,4 +15,4 @@ tell application "System Events" to get value of property list item "CFBundleNam
15
15
 
16
16
  Once logged in, return to this terminal.
17
17
  `})}await o}finally{r?.close()}},Pe=Ir;export{U as a,Vt as b,Se as c,ge as d,Wo as e,Ir as f,Pe as g,M as h,bo as i};
18
- //# sourceMappingURL=chunk-XB3JTJT6.js.map
18
+ //# sourceMappingURL=chunk-AGPFNOXG.js.map
@@ -1,4 +1,4 @@
1
- import{c as V}from"./chunk-W4IVYUHW.js";import{a as lr}from"./chunk-FQ2LR3BI.js";import{a as yr,b as vr,i as br}from"./chunk-XB3JTJT6.js";import{a as st,c as pr,f as pt,g as mt,j as Pt,l as Wi,m as mr,o as ee,p as Q,t as hr,u as dr,v as re,w as gr,z as ft}from"./chunk-O2K4B6AL.js";import{a as fr}from"./chunk-AGRDDZFS.js";import{$ as z,D as ct,K as lt,P as te,R as ur,U as Et,X as cr,Z as T,_ as R,b as G,e as B,g as tr,h as er,l as rr,m as nr,t as sr,u as ir,v as or,y as ar,z as Qi}from"./chunk-GIAIN3IJ.js";import{a as Vi,c as Zt,e as nt,g as C}from"./chunk-SGMPMYEU.js";var xr=Zt(D=>{"use strict";C();var Ki=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});var Xi=Vi("fs"),Zi=Ki(lr()),it=Zi.default("@kwsites/file-exists");function to(t,e,r){it("checking %s",t);try{let n=Xi.statSync(t);return n.isFile()&&e?(it("[OK] path represents a file"),!0):n.isDirectory()&&r?(it("[OK] path represents a directory"),!0):(it("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return it("[FAIL] path is not accessible: %o",n),!1;throw it("[FATAL] %o",n),n}}function eo(t,e=D.READABLE){return to(t,(e&D.FILE)>0,(e&D.FOLDER)>0)}D.exists=eo;D.FILE=1;D.FOLDER=2;D.READABLE=D.FILE+D.FOLDER});var Er=Zt(Rt=>{"use strict";C();function ro(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}Object.defineProperty(Rt,"__esModule",{value:!0});ro(xr())});var ue=Zt(Z=>{"use strict";C();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ae(){let t,e,r="pending";return{promise:new Promise((s,i)=>{t=s,e=i}),done(s){r==="pending"&&(r="resolved",t(s))},fail(s){r==="pending"&&(r="rejected",e(s))},get fulfilled(){return r!=="pending"},get status(){return r}}}Z.deferred=ae;Z.createDeferred=ae;Z.default=ae});C();var _r=nt(Wi(),1);var Ec=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ne=({problems:t,showFileTypes:e,...r})=>{let n="";for(let[s,i]of Object.entries(t)){n+=R(""),n+=R`• {cyan ${s}} {redBright ${(0,_r.default)("problem",i.length,!0)}}`;for(let o of i){let[a,...c]=o.message.split(`
1
+ import{c as V}from"./chunk-NO72UU5F.js";import{a as lr}from"./chunk-FQ2LR3BI.js";import{a as yr,b as vr,i as br}from"./chunk-AGPFNOXG.js";import{a as st,c as pr,f as pt,g as mt,j as Pt,l as Wi,m as mr,o as ee,p as Q,t as hr,u as dr,v as re,w as gr,z as ft}from"./chunk-RIIVR43B.js";import{a as fr}from"./chunk-AGRDDZFS.js";import{$ as z,D as ct,K as lt,P as te,R as ur,U as Et,X as cr,Z as T,_ as R,b as G,e as B,g as tr,h as er,l as rr,m as nr,t as sr,u as ir,v as or,y as ar,z as Qi}from"./chunk-GIAIN3IJ.js";import{a as Vi,c as Zt,e as nt,g as C}from"./chunk-SGMPMYEU.js";var xr=Zt(D=>{"use strict";C();var Ki=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});var Xi=Vi("fs"),Zi=Ki(lr()),it=Zi.default("@kwsites/file-exists");function to(t,e,r){it("checking %s",t);try{let n=Xi.statSync(t);return n.isFile()&&e?(it("[OK] path represents a file"),!0):n.isDirectory()&&r?(it("[OK] path represents a directory"),!0):(it("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return it("[FAIL] path is not accessible: %o",n),!1;throw it("[FATAL] %o",n),n}}function eo(t,e=D.READABLE){return to(t,(e&D.FILE)>0,(e&D.FOLDER)>0)}D.exists=eo;D.FILE=1;D.FOLDER=2;D.READABLE=D.FILE+D.FOLDER});var Er=Zt(Rt=>{"use strict";C();function ro(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}Object.defineProperty(Rt,"__esModule",{value:!0});ro(xr())});var ue=Zt(Z=>{"use strict";C();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ae(){let t,e,r="pending";return{promise:new Promise((s,i)=>{t=s,e=i}),done(s){r==="pending"&&(r="resolved",t(s))},fail(s){r==="pending"&&(r="rejected",e(s))},get fulfilled(){return r!=="pending"},get status(){return r}}}Z.deferred=ae;Z.createDeferred=ae;Z.default=ae});C();var _r=nt(Wi(),1);var Ec=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ne=({problems:t,showFileTypes:e,...r})=>{let n="";for(let[s,i]of Object.entries(t)){n+=R(""),n+=R`• {cyan ${s}} {redBright ${(0,_r.default)("problem",i.length,!0)}}`;for(let o of i){let[a,...c]=o.message.split(`
2
2
  `);n+=T` {red ✖} `,(e??o.type==="SourceFile")&&(n+=T`${Hi(s)} `),n+=T(a);for(let p of c)n+=R(""),n+=T` ${p}`;for(let p of o.labels)n+=T` {dim ${p}}`;n+=R("")}}return R({...r,content:n})},Pc=t=>{z(ne(t))},Hi=t=>{switch(!0){case sr(t):return G.yellowBright("JavaScript");case ir(t):return G.blue("TypeScript");case or(t):return G.magenta("Gelly");default:return G.gray("File")}},Cc=t=>{let e={};for(let r of t){let n=r.node?.apiIdentifier??r.node?.name??"Other";e[n]??=[],e[n].push({type:r.node?.type??"Unknown",severity:r.severity,message:r.message,labels:mr(r.nodeLabels?.map(s=>s?.identifier)??[])})}return e},Rc=t=>{let e={};for(let r of t)e[r.path]??=[],e[r.path].push({type:r.type,severity:r.level,message:r.message,labels:[]});return e};C();var kr=class extends mt{isBug=pt.NO;constructor(){super("Yarn not found")}render(){return T`
3
3
  Yarn must be installed to sync your application. You can install it by running:
4
4
 
@@ -114,4 +114,4 @@ import{c as V}from"./chunk-W4IVYUHW.js";import{a as lr}from"./chunk-FQ2LR3BI.js"
114
114
  • ${a.join(`
115
115
  \u2022 `)}
116
116
  `)},gc=async(t,{directory:e})=>{try{return await ai(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},yc=B.object({application:B.string(),environment:B.string(),environments:B.record(B.object({filesVersion:B.string()}))}),vc=B.object({app:B.string(),filesVersion:B.string(),mtime:B.number()}),bc=B.union([yc,vc]),_c=bc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{Ec as a,ne as b,Pc as c,Cc as d,Rc as e,kr as f,Ct as g,wr as h,Tr as i,Yi as j,Fc as k,oe as l,yp as m,pi as n,vp as o};
117
- //# sourceMappingURL=chunk-BKO2TX4J.js.map
117
+ //# sourceMappingURL=chunk-E3I3MPQD.js.map
@@ -1,4 +1,4 @@
1
- import{b as gt,e as ft,h as ht,j as xe,k as te,l as It}from"./chunk-BKO2TX4J.js";import{a as St,b as mt}from"./chunk-HCQR6OPH.js";import{b as $}from"./chunk-W5JAWOQQ.js";import{c as dt}from"./chunk-W4IVYUHW.js";import{c as Me}from"./chunk-XB3JTJT6.js";import{B as Mt,i as Ee,j as w,k as _r,l as yt,q as bt}from"./chunk-O2K4B6AL.js";import{b as Et,c as xt}from"./chunk-AGRDDZFS.js";import{$ as R,E as ut,H as pt,I as N,L as be,M as Z,P as ee,S as ct,Z as m,_ as k,b,d as rt,g as at,n as ot,p as he,q as st,r as it,s as lt,z as Ar}from"./chunk-GIAIN3IJ.js";import{a as Ir}from"./chunk-B6XQEEUK.js";import{a as v,c as x,e as F,g as u}from"./chunk-SGMPMYEU.js";var Dt=x((hs,Vt)=>{u();Vt.exports=Gt;Gt.sync=Pr;var kt=v("fs");function wr(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var a=n[r].toLowerCase();if(a&&e.substr(-a.length).toLowerCase()===a)return!0}return!1}function Lt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:wr(t,n)}function Gt(e,t,n){kt.stat(e,function(r,a){n(r,r?!1:Lt(a,e,t))})}function Pr(e,t){return Lt(kt.statSync(e),e,t)}});var jt=x((Es,Qt)=>{u();Qt.exports=Ut;Ut.sync=Or;var Ht=v("fs");function Ut(e,t,n){Ht.stat(e,function(r,a){n(r,r?!1:$t(a,t))})}function Or(e,t){return $t(Ht.statSync(e),t)}function $t(e,t){return e.isFile()&&Br(e,t)}function Br(e,t){var n=e.mode,r=e.uid,a=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),i=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),c=i|l,d=n&p||n&l&&a===s||n&i&&r===o||n&c&&o===0;return d}});var Wt=x((Is,Jt)=>{u();var Ms=v("fs"),ae;process.platform==="win32"||global.TESTING_WINDOWS?ae=Dt():ae=jt();Jt.exports=_e;_e.sync=Nr;function _e(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,a){_e(e,t||{},function(o,s){o?a(o):r(s)})})}ae(e,t||{},function(r,a){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,a=!1),n(r,a)})}function Nr(e,t){try{return ae.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var en=x((_s,Zt)=>{u();var V=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=v("path"),kr=V?";":":",Yt=Wt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Kt=(e,t)=>{let n=t.colon||kr,r=e.match(/\//)||V&&e.match(/\\/)?[""]:[...V?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],a=V?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=V?a.split(n):[""];return V&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:a}},Xt=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:o}=Kt(e,t),s=[],i=p=>new Promise((c,d)=>{if(p===r.length)return t.all&&s.length?c(s):d(zt(e));let y=r[p],S=/^".*"$/.test(y)?y.slice(1,-1):y,f=qt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;c(l(h,p,0))}),l=(p,c,d)=>new Promise((y,S)=>{if(d===a.length)return y(i(c+1));let f=a[d];Yt(p+f,{pathExt:o},(h,g)=>{if(!h&&g)if(t.all)s.push(p+f);else return y(p+f);return y(l(p,c,d+1))})});return n?i(0).then(p=>n(null,p),n):i(0)},Lr=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=Kt(e,t),o=[];for(let s=0;s<n.length;s++){let i=n[s],l=/^".*"$/.test(i)?i.slice(1,-1):i,p=qt.join(l,e),c=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let d=0;d<r.length;d++){let y=c+r[d];try{if(Yt.sync(y,{pathExt:a}))if(t.all)o.push(y);else return y}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};Zt.exports=Xt;Xt.sync=Lr});var nn=x((Ts,Ce)=>{"use strict";u();var tn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Ce.exports=tn;Ce.exports.default=tn});var sn=x((Fs,on)=>{"use strict";u();var rn=v("path"),Gr=en(),Vr=nn();function an(e,t){let n=e.options.env||process.env,r=process.cwd(),a=e.options.cwd!=null,o=a&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Gr.sync(e.command,{path:n[Vr({env:n})],pathExt:t?rn.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=rn.resolve(a?e.options.cwd:"",s)),s}function Dr(e){return an(e)||an(e,!0)}on.exports=Dr});var ln=x((ws,ve)=>{"use strict";u();var Te=/([()\][%!^"`<>&|;, *?])/g;function Hr(e){return e=e.replace(Te,"^$1"),e}function Ur(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Te,"^$1"),t&&(e=e.replace(Te,"^$1")),e}ve.exports.command=Hr;ve.exports.argument=Ur});var pn=x((Os,un)=>{"use strict";u();un.exports=/^#!(.*)/});var dn=x((Ns,cn)=>{"use strict";u();var $r=pn();cn.exports=(e="")=>{let t=e.match($r);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?r:r?`${a} ${r}`:a}});var Sn=x((Ls,yn)=>{"use strict";u();var Fe=v("fs"),Qr=dn();function jr(e){let n=Buffer.alloc(150),r;try{r=Fe.openSync(e,"r"),Fe.readSync(r,n,0,150,0),Fe.closeSync(r)}catch{}return Qr(n.toString())}yn.exports=jr});var hn=x((Vs,fn)=>{"use strict";u();var Jr=v("path"),mn=sn(),gn=ln(),Wr=Sn(),qr=process.platform==="win32",Yr=/\.(?:com|exe)$/i,zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kr(e){e.file=mn(e);let t=e.file&&Wr(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Xr(e){if(!qr)return e;let t=Kr(e),n=!Yr.test(t);if(e.options.forceShell||n){let r=zr.test(t);e.command=Jr.normalize(e.command),e.command=gn.command(e.command),e.args=e.args.map(o=>gn.argument(o,r));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zr(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:Xr(r)}fn.exports=Zr});var xn=x((Hs,En)=>{"use strict";u();var Re=process.platform==="win32";function we(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ea(e,t){if(!Re)return;let n=e.emit;e.emit=function(r,a){if(r==="exit"){let o=bn(a,t,"spawn");if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bn(e,t){return Re&&e===1&&!t.file?we(t.original,"spawn"):null}function ta(e,t){return Re&&e===1&&!t.file?we(t.original,"spawnSync"):null}En.exports={hookChildProcess:ea,verifyENOENT:bn,verifyENOENTSync:ta,notFoundError:we}});var An=x(($s,D)=>{"use strict";u();var Mn=v("child_process"),Pe=hn(),Oe=xn();function In(e,t,n){let r=Pe(e,t,n),a=Mn.spawn(r.command,r.args,r.options);return Oe.hookChildProcess(a,r),a}function na(e,t,n){let r=Pe(e,t,n),a=Mn.spawnSync(r.command,r.args,r.options);return a.error=a.error||Oe.verifyENOENTSync(a.status,r),a}D.exports=In;D.exports.spawn=In;D.exports.sync=na;D.exports._parse=Pe;D.exports._enoent=Oe});var Kn=x((pl,zn)=>{"use strict";u();var{PassThrough:Xa}=v("stream");zn.exports=function(){var e=[],t=new Xa({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",a),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",a.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function a(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});var mr=x((zl,Sr)=>{u();function I(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Sr.exports=I;I.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};I.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};I.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};I.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};I.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};I.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};I.prototype.start=I.prototype.try;I.prototype.errors=function(){return this._errors};I.prototype.attempts=function(){return this._attempts};I.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],o=a.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=a,n=s)}return t}});var gr=x(B=>{u();var Io=mr();B.operation=function(e){var t=B.timeouts(e);return new Io(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};B.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(o,s){return o-s}),r};B.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};B.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var a=0;a<n.length;a++){var o=n[a],s=e[o];e[o]=function(l){var p=B.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){l.apply(e,c)})}.bind(e,s),e[o].options=t}}});var hr=x((eu,fr)=>{u();fr.exports=gr()});u();var Q=F(yt(),1);var ne=class extends Map{created=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Cr=b.greenBright("+"),Tr=b.blueBright("\xB1"),vr=b.redBright("-"),At=b.yellowBright("\u2192"),j=(e,{changes:t,tense:n,limit:r=1/0,...a})=>{ee.logLevel<=Z.TRACE&&(r=1/0);let o=Array.from(t.entries()).filter(([y])=>!y.startsWith(".gadget/"));if(o.length===0)return"";let s=b.yellowBright(n==="past"?"renamed":"rename"),i=b.greenBright(n==="past"?"created":"create"),l=b.blueBright(n==="past"?"updated":"update"),p=b.redBright(n==="past"?"deleted":"delete"),c=o.sort((y,S)=>y[0].localeCompare(S[0])).slice(0,r).map(([y,S])=>{switch(!0){case(S.type==="create"&&at(S.oldPath)):return[At,b.yellowBright(S.oldPath),s,At,b.yellowBright(y)];case S.type==="create":return[Cr,b.greenBright(y),i];case S.type==="update":return[Tr,b.blueBright(y),l];case S.type==="delete":return[vr,b.redBright(y),p];default:return ot(S)}});o.length>r&&c.push([b.gray(w.ellipsis),m`{gray ${o.length-r} more}`,""]);let d;if(o.length>=5){let y=[],S=o.filter(([,g])=>g.type==="create").length;if(S>0){let g=n==="past"?`${S} created`:(0,Q.default)("create",S,!0);y.push(m`{greenBright ${g}}`)}let f=o.filter(([,g])=>g.type==="update").length;if(f>0){let g=n==="past"?`${f} updated`:(0,Q.default)("update",f,!0);y.push(m`{blueBright ${g}}`)}let h=o.filter(([,g])=>g.type==="delete").length;if(h>0){let g=n==="past"?`${h} deleted`:(0,Q.default)("delete",h,!0);y.push(m`{redBright ${g}}`)}d=k`
1
+ import{b as gt,e as ft,h as ht,j as xe,k as te,l as It}from"./chunk-E3I3MPQD.js";import{a as St,b as mt}from"./chunk-HCQR6OPH.js";import{b as $}from"./chunk-TMPKLC3N.js";import{c as dt}from"./chunk-NO72UU5F.js";import{c as Me}from"./chunk-AGPFNOXG.js";import{B as Mt,i as Ee,j as w,k as _r,l as yt,q as bt}from"./chunk-RIIVR43B.js";import{b as Et,c as xt}from"./chunk-AGRDDZFS.js";import{$ as R,E as ut,H as pt,I as N,L as be,M as Z,P as ee,S as ct,Z as m,_ as k,b,d as rt,g as at,n as ot,p as he,q as st,r as it,s as lt,z as Ar}from"./chunk-GIAIN3IJ.js";import{a as Ir}from"./chunk-B6XQEEUK.js";import{a as v,c as x,e as F,g as u}from"./chunk-SGMPMYEU.js";var Dt=x((hs,Vt)=>{u();Vt.exports=Gt;Gt.sync=Pr;var kt=v("fs");function wr(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var a=n[r].toLowerCase();if(a&&e.substr(-a.length).toLowerCase()===a)return!0}return!1}function Lt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:wr(t,n)}function Gt(e,t,n){kt.stat(e,function(r,a){n(r,r?!1:Lt(a,e,t))})}function Pr(e,t){return Lt(kt.statSync(e),e,t)}});var jt=x((Es,Qt)=>{u();Qt.exports=Ut;Ut.sync=Or;var Ht=v("fs");function Ut(e,t,n){Ht.stat(e,function(r,a){n(r,r?!1:$t(a,t))})}function Or(e,t){return $t(Ht.statSync(e),t)}function $t(e,t){return e.isFile()&&Br(e,t)}function Br(e,t){var n=e.mode,r=e.uid,a=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),i=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),c=i|l,d=n&p||n&l&&a===s||n&i&&r===o||n&c&&o===0;return d}});var Wt=x((Is,Jt)=>{u();var Ms=v("fs"),ae;process.platform==="win32"||global.TESTING_WINDOWS?ae=Dt():ae=jt();Jt.exports=_e;_e.sync=Nr;function _e(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,a){_e(e,t||{},function(o,s){o?a(o):r(s)})})}ae(e,t||{},function(r,a){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,a=!1),n(r,a)})}function Nr(e,t){try{return ae.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var en=x((_s,Zt)=>{u();var V=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=v("path"),kr=V?";":":",Yt=Wt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Kt=(e,t)=>{let n=t.colon||kr,r=e.match(/\//)||V&&e.match(/\\/)?[""]:[...V?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],a=V?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=V?a.split(n):[""];return V&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:a}},Xt=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:o}=Kt(e,t),s=[],i=p=>new Promise((c,d)=>{if(p===r.length)return t.all&&s.length?c(s):d(zt(e));let y=r[p],S=/^".*"$/.test(y)?y.slice(1,-1):y,f=qt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;c(l(h,p,0))}),l=(p,c,d)=>new Promise((y,S)=>{if(d===a.length)return y(i(c+1));let f=a[d];Yt(p+f,{pathExt:o},(h,g)=>{if(!h&&g)if(t.all)s.push(p+f);else return y(p+f);return y(l(p,c,d+1))})});return n?i(0).then(p=>n(null,p),n):i(0)},Lr=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=Kt(e,t),o=[];for(let s=0;s<n.length;s++){let i=n[s],l=/^".*"$/.test(i)?i.slice(1,-1):i,p=qt.join(l,e),c=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let d=0;d<r.length;d++){let y=c+r[d];try{if(Yt.sync(y,{pathExt:a}))if(t.all)o.push(y);else return y}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};Zt.exports=Xt;Xt.sync=Lr});var nn=x((Ts,Ce)=>{"use strict";u();var tn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Ce.exports=tn;Ce.exports.default=tn});var sn=x((Fs,on)=>{"use strict";u();var rn=v("path"),Gr=en(),Vr=nn();function an(e,t){let n=e.options.env||process.env,r=process.cwd(),a=e.options.cwd!=null,o=a&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Gr.sync(e.command,{path:n[Vr({env:n})],pathExt:t?rn.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=rn.resolve(a?e.options.cwd:"",s)),s}function Dr(e){return an(e)||an(e,!0)}on.exports=Dr});var ln=x((ws,ve)=>{"use strict";u();var Te=/([()\][%!^"`<>&|;, *?])/g;function Hr(e){return e=e.replace(Te,"^$1"),e}function Ur(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Te,"^$1"),t&&(e=e.replace(Te,"^$1")),e}ve.exports.command=Hr;ve.exports.argument=Ur});var pn=x((Os,un)=>{"use strict";u();un.exports=/^#!(.*)/});var dn=x((Ns,cn)=>{"use strict";u();var $r=pn();cn.exports=(e="")=>{let t=e.match($r);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?r:r?`${a} ${r}`:a}});var Sn=x((Ls,yn)=>{"use strict";u();var Fe=v("fs"),Qr=dn();function jr(e){let n=Buffer.alloc(150),r;try{r=Fe.openSync(e,"r"),Fe.readSync(r,n,0,150,0),Fe.closeSync(r)}catch{}return Qr(n.toString())}yn.exports=jr});var hn=x((Vs,fn)=>{"use strict";u();var Jr=v("path"),mn=sn(),gn=ln(),Wr=Sn(),qr=process.platform==="win32",Yr=/\.(?:com|exe)$/i,zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kr(e){e.file=mn(e);let t=e.file&&Wr(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Xr(e){if(!qr)return e;let t=Kr(e),n=!Yr.test(t);if(e.options.forceShell||n){let r=zr.test(t);e.command=Jr.normalize(e.command),e.command=gn.command(e.command),e.args=e.args.map(o=>gn.argument(o,r));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zr(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:Xr(r)}fn.exports=Zr});var xn=x((Hs,En)=>{"use strict";u();var Re=process.platform==="win32";function we(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ea(e,t){if(!Re)return;let n=e.emit;e.emit=function(r,a){if(r==="exit"){let o=bn(a,t,"spawn");if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bn(e,t){return Re&&e===1&&!t.file?we(t.original,"spawn"):null}function ta(e,t){return Re&&e===1&&!t.file?we(t.original,"spawnSync"):null}En.exports={hookChildProcess:ea,verifyENOENT:bn,verifyENOENTSync:ta,notFoundError:we}});var An=x(($s,D)=>{"use strict";u();var Mn=v("child_process"),Pe=hn(),Oe=xn();function In(e,t,n){let r=Pe(e,t,n),a=Mn.spawn(r.command,r.args,r.options);return Oe.hookChildProcess(a,r),a}function na(e,t,n){let r=Pe(e,t,n),a=Mn.spawnSync(r.command,r.args,r.options);return a.error=a.error||Oe.verifyENOENTSync(a.status,r),a}D.exports=In;D.exports.spawn=In;D.exports.sync=na;D.exports._parse=Pe;D.exports._enoent=Oe});var Kn=x((pl,zn)=>{"use strict";u();var{PassThrough:Xa}=v("stream");zn.exports=function(){var e=[],t=new Xa({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",a),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",a.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function a(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});var mr=x((zl,Sr)=>{u();function I(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Sr.exports=I;I.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};I.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};I.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};I.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};I.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};I.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};I.prototype.start=I.prototype.try;I.prototype.errors=function(){return this._errors};I.prototype.attempts=function(){return this._attempts};I.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],o=a.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=a,n=s)}return t}});var gr=x(B=>{u();var Io=mr();B.operation=function(e){var t=B.timeouts(e);return new Io(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};B.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(o,s){return o-s}),r};B.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};B.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var a=0;a<n.length;a++){var o=n[a],s=e[o];e[o]=function(l){var p=B.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){l.apply(e,c)})}.bind(e,s),e[o].options=t}}});var hr=x((eu,fr)=>{u();fr.exports=gr()});u();var Q=F(yt(),1);var ne=class extends Map{created=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Cr=b.greenBright("+"),Tr=b.blueBright("\xB1"),vr=b.redBright("-"),At=b.yellowBright("\u2192"),j=(e,{changes:t,tense:n,limit:r=1/0,...a})=>{ee.logLevel<=Z.TRACE&&(r=1/0);let o=Array.from(t.entries()).filter(([y])=>!y.startsWith(".gadget/"));if(o.length===0)return"";let s=b.yellowBright(n==="past"?"renamed":"rename"),i=b.greenBright(n==="past"?"created":"create"),l=b.blueBright(n==="past"?"updated":"update"),p=b.redBright(n==="past"?"deleted":"delete"),c=o.sort((y,S)=>y[0].localeCompare(S[0])).slice(0,r).map(([y,S])=>{switch(!0){case(S.type==="create"&&at(S.oldPath)):return[At,b.yellowBright(S.oldPath),s,At,b.yellowBright(y)];case S.type==="create":return[Cr,b.greenBright(y),i];case S.type==="update":return[Tr,b.blueBright(y),l];case S.type==="delete":return[vr,b.redBright(y),p];default:return ot(S)}});o.length>r&&c.push([b.gray(w.ellipsis),m`{gray ${o.length-r} more}`,""]);let d;if(o.length>=5){let y=[],S=o.filter(([,g])=>g.type==="create").length;if(S>0){let g=n==="past"?`${S} created`:(0,Q.default)("create",S,!0);y.push(m`{greenBright ${g}}`)}let f=o.filter(([,g])=>g.type==="update").length;if(f>0){let g=n==="past"?`${f} updated`:(0,Q.default)("update",f,!0);y.push(m`{blueBright ${g}}`)}let h=o.filter(([,g])=>g.type==="delete").length;if(h>0){let g=n==="past"?`${h} deleted`:(0,Q.default)("delete",h,!0);y.push(m`{redBright ${g}}`)}d=k`
2
2
  ${(0,Q.default)("change",o.length,!0)} in total. ${y.join(", ")}.
3
3
  `}return St({rows:c,footer:d,ensureEmptyLineAbove:!0,ensureEmptyLineAboveBody:!1,ensureEmptyLineAboveFooter:!0,indent:0,...a})},re=(e,t)=>{let n=j(e,t);n&&R(n)};u();var _t=m(`
4
4
  subscription EnvironmentLogs($query: String!, $start: DateTime, $limit: Int) {
@@ -184,4 +184,4 @@ ${r.message}`:g,_=[E,t,e].filter(Boolean).join(`
184
184
 
185
185
  {red Your app will not be operational until all fatal errors are fixed.}
186
186
  `})}catch(p){throw xe(p)?l.clear():l.fail(),p}}};export{ne as a,Tr as b,vr as c,en as d,Uo as e,$o as f,Qo as g,jo as h,Jo as i,P as j,Bt as k,Nt as l,Ss as m,ms as n,xr as o};
187
- //# sourceMappingURL=chunk-PC6ANBC6.js.map
187
+ //# sourceMappingURL=chunk-IPKFNVOS.js.map
@@ -1,4 +1,4 @@
1
- import{o as p}from"./chunk-PC6ANBC6.js";import{m as c,n as g,o as h}from"./chunk-BKO2TX4J.js";import{c as i}from"./chunk-W4IVYUHW.js";import{$ as r,Z as s}from"./chunk-GIAIN3IJ.js";import{g as a}from"./chunk-SGMPMYEU.js";a();var v={...c,"--force":{type:Boolean,alias:"-f"}},P=e=>s`
1
+ import{o as p}from"./chunk-IPKFNVOS.js";import{m as c,n as g,o as h}from"./chunk-E3I3MPQD.js";import{c as i}from"./chunk-NO72UU5F.js";import{$ as r,Z as s}from"./chunk-GIAIN3IJ.js";import{g as a}from"./chunk-SGMPMYEU.js";a();var v={...c,"--force":{type:Boolean,alias:"-f"}},P=e=>s`
2
2
  Pushes your local files to your environment directory.
3
3
 
4
4
  This command first tracks changes in your environment directory since the last sync.
@@ -23,4 +23,4 @@ import{o as p}from"./chunk-PC6ANBC6.js";import{m as c,n as g,o as h}from"./chunk
23
23
  If you are trying to push changes from a specific directory,
24
24
  you must "cd" to that directory and then run "ggt push".
25
25
  `);let y=await h(process.cwd()),m=await g.loadOrInit(e,{command:"push",args:o,directory:y}),t=new p(m),n=await t.hashes(e);if(n.localChangesToPush.size===0){r({ensureEmptyLineAbove:!0,content:"Nothing to push."});return}n.environmentChangesToPull.size>0&&!n.onlyDotGadgetFilesChanged&&await t.print(e,{hashes:n}),await t.push(e,{command:"push",hashes:n,force:o["--force"]})};export{v as a,P as b,A as c};
26
- //# sourceMappingURL=chunk-3HRT72TB.js.map
26
+ //# sourceMappingURL=chunk-NGYGSK7A.js.map
@@ -1,2 +1,2 @@
1
- import{f as G,g as w,h as C,j as E}from"./chunk-O2K4B6AL.js";import{b as R,f as N}from"./chunk-GIAIN3IJ.js";import{c as T,e as $,g as d}from"./chunk-SGMPMYEU.js";var I=T((K,D)=>{d();var b=Symbol("arg flag"),a=class n extends Error{constructor(t,p){super(t),this.name="ArgError",this.code=p,Object.setPrototypeOf(this,n.prototype)}};function h(n,{argv:t=process.argv.slice(2),permissive:p=!1,stopAtPositional:A=!1}={}){if(!n)throw new a("argument specification object is required","ARG_CONFIG_NO_SPEC");let e={_:[]},s={},f={};for(let r of Object.keys(n)){if(!r)throw new a("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(r[0]!=="-")throw new a(`argument key must start with '-' but found: '${r}'`,"ARG_CONFIG_NONOPT_KEY");if(r.length===1)throw new a(`argument key must have a name; singular '-' keys are not allowed: ${r}`,"ARG_CONFIG_NONAME_KEY");if(typeof n[r]=="string"){s[r]=n[r];continue}let l=n[r],i=!1;if(Array.isArray(l)&&l.length===1&&typeof l[0]=="function"){let[c]=l;l=(g,u,m=[])=>(m.push(c(g,u,m[m.length-1])),m),i=c===Boolean||c[b]===!0}else if(typeof l=="function")i=l===Boolean||l[b]===!0;else throw new a(`type missing or not a function or valid array type: ${r}`,"ARG_CONFIG_VAD_TYPE");if(r[1]!=="-"&&r.length>2)throw new a(`short argument keys (with a single hyphen) must have only one character: ${r}`,"ARG_CONFIG_SHORTOPT_TOOLONG");f[r]=[l,i]}for(let r=0,l=t.length;r<l;r++){let i=t[r];if(A&&e._.length>0){e._=e._.concat(t.slice(r));break}if(i==="--"){e._=e._.concat(t.slice(r+1));break}if(i.length>1&&i[0]==="-"){let c=i[1]==="-"||i.length===2?[i]:i.slice(1).split("").map(g=>`-${g}`);for(let g=0;g<c.length;g++){let u=c[g],[m,O]=u[1]==="-"?u.split(/=(.*)/,2):[u,void 0],o=m;for(;o in s;)o=s[o];if(!(o in f))if(p){e._.push(u);continue}else throw new a(`unknown or unexpected option: ${m}`,"ARG_UNKNOWN_OPTION");let[y,k]=f[o];if(!k&&g+1<c.length)throw new a(`option requires argument (but was followed by another short argument): ${m}`,"ARG_MISSING_REQUIRED_SHORTARG");if(k)e[o]=y(!0,o,e[o]);else if(O===void 0){if(t.length<r+2||t[r+1].length>1&&t[r+1][0]==="-"&&!(t[r+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(y===Number||typeof BigInt<"u"&&y===BigInt))){let S=m===o?"":` (alias for ${o})`;throw new a(`option requires argument: ${m}${S}`,"ARG_MISSING_REQUIRED_LONGARG")}e[o]=y(t[r+1],o,e[o]),++r}else e[o]=y(O,o,e[o])}}else e._.push(i)}return e}h.flag=n=>(n[b]=!0,n);h.COUNT=h.flag((n,t,p)=>(p||0)+1);h.ArgError=a;D.exports=h});d();var _=$(I(),1);var Y=(n,t)=>{let p={},A={};for(let[e,s]of Object.entries(n)){if(!("type"in s)){p[e]=s;continue}if(p[e]=s.type,A[e]=s.default,s.alias)for(let f of Array.isArray(s.alias)?s.alias:[s.alias])p[f]=e}try{let e=(0,_.default)(p,t);for(let[s,f]of Object.entries(A))N(e[s])&&(e[s]=f);return e}catch(e){throw e instanceof _.default.ArgError&&(e=new x(e.message)),e instanceof w?e:new C(e)}},x=class extends w{isBug=G.NO;render(){return`${R.redBright(E.cross)} `+this.message}};d();import P from"node:assert";var j=["dev","deploy","status","push","pull","add","open","list","login","logout","whoami","version"],H=n=>j.includes(n),V=async n=>{P(H(n),`invalid command: ${n}`);let t;switch(n){case"dev":t=await import("./dev-J6QHZMPR.js");break;case"deploy":t=await import("./deploy-RK5PRQ4T.js");break;case"status":t=await import("./status-MP45HWIM.js");break;case"push":t=await import("./push-FFLXHGFG.js");break;case"pull":t=await import("./pull-YLUFPDDX.js");break;case"add":t=await import("./add-OTQMXZUR.js");break;case"open":t=await import("./open-OZDKOY6V.js");break;case"list":t=await import("./list-A7LFGUXG.js");break;case"login":t=await import("./login-BP4XIHLA.js");break;case"logout":t=await import("./logout-PPA6JCDY.js");break;case"whoami":t=await import("./whoami-PPXXBHUR.js");break;case"version":t=await import("./version-CXGPMLMK.js");break}return t};export{I as a,Y as b,x as c,j as d,H as e,V as f};
2
- //# sourceMappingURL=chunk-W4IVYUHW.js.map
1
+ import{f as G,g as w,h as C,j as E}from"./chunk-RIIVR43B.js";import{b as R,f as N}from"./chunk-GIAIN3IJ.js";import{c as T,e as $,g as d}from"./chunk-SGMPMYEU.js";var I=T((K,D)=>{d();var b=Symbol("arg flag"),a=class n extends Error{constructor(t,p){super(t),this.name="ArgError",this.code=p,Object.setPrototypeOf(this,n.prototype)}};function h(n,{argv:t=process.argv.slice(2),permissive:p=!1,stopAtPositional:A=!1}={}){if(!n)throw new a("argument specification object is required","ARG_CONFIG_NO_SPEC");let e={_:[]},s={},f={};for(let r of Object.keys(n)){if(!r)throw new a("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(r[0]!=="-")throw new a(`argument key must start with '-' but found: '${r}'`,"ARG_CONFIG_NONOPT_KEY");if(r.length===1)throw new a(`argument key must have a name; singular '-' keys are not allowed: ${r}`,"ARG_CONFIG_NONAME_KEY");if(typeof n[r]=="string"){s[r]=n[r];continue}let l=n[r],i=!1;if(Array.isArray(l)&&l.length===1&&typeof l[0]=="function"){let[c]=l;l=(g,u,m=[])=>(m.push(c(g,u,m[m.length-1])),m),i=c===Boolean||c[b]===!0}else if(typeof l=="function")i=l===Boolean||l[b]===!0;else throw new a(`type missing or not a function or valid array type: ${r}`,"ARG_CONFIG_VAD_TYPE");if(r[1]!=="-"&&r.length>2)throw new a(`short argument keys (with a single hyphen) must have only one character: ${r}`,"ARG_CONFIG_SHORTOPT_TOOLONG");f[r]=[l,i]}for(let r=0,l=t.length;r<l;r++){let i=t[r];if(A&&e._.length>0){e._=e._.concat(t.slice(r));break}if(i==="--"){e._=e._.concat(t.slice(r+1));break}if(i.length>1&&i[0]==="-"){let c=i[1]==="-"||i.length===2?[i]:i.slice(1).split("").map(g=>`-${g}`);for(let g=0;g<c.length;g++){let u=c[g],[m,O]=u[1]==="-"?u.split(/=(.*)/,2):[u,void 0],o=m;for(;o in s;)o=s[o];if(!(o in f))if(p){e._.push(u);continue}else throw new a(`unknown or unexpected option: ${m}`,"ARG_UNKNOWN_OPTION");let[y,k]=f[o];if(!k&&g+1<c.length)throw new a(`option requires argument (but was followed by another short argument): ${m}`,"ARG_MISSING_REQUIRED_SHORTARG");if(k)e[o]=y(!0,o,e[o]);else if(O===void 0){if(t.length<r+2||t[r+1].length>1&&t[r+1][0]==="-"&&!(t[r+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(y===Number||typeof BigInt<"u"&&y===BigInt))){let S=m===o?"":` (alias for ${o})`;throw new a(`option requires argument: ${m}${S}`,"ARG_MISSING_REQUIRED_LONGARG")}e[o]=y(t[r+1],o,e[o]),++r}else e[o]=y(O,o,e[o])}}else e._.push(i)}return e}h.flag=n=>(n[b]=!0,n);h.COUNT=h.flag((n,t,p)=>(p||0)+1);h.ArgError=a;D.exports=h});d();var _=$(I(),1);var Y=(n,t)=>{let p={},A={};for(let[e,s]of Object.entries(n)){if(!("type"in s)){p[e]=s;continue}if(p[e]=s.type,A[e]=s.default,s.alias)for(let f of Array.isArray(s.alias)?s.alias:[s.alias])p[f]=e}try{let e=(0,_.default)(p,t);for(let[s,f]of Object.entries(A))N(e[s])&&(e[s]=f);return e}catch(e){throw e instanceof _.default.ArgError&&(e=new x(e.message)),e instanceof w?e:new C(e)}},x=class extends w{isBug=G.NO;render(){return`${R.redBright(E.cross)} `+this.message}};d();import P from"node:assert";var j=["dev","deploy","status","push","pull","add","open","list","login","logout","whoami","version"],H=n=>j.includes(n),V=async n=>{P(H(n),`invalid command: ${n}`);let t;switch(n){case"dev":t=await import("./dev-I23ZQELT.js");break;case"deploy":t=await import("./deploy-2SXBPB5C.js");break;case"status":t=await import("./status-2CZXUGSZ.js");break;case"push":t=await import("./push-DUSAXZ3K.js");break;case"pull":t=await import("./pull-TC2GVZRD.js");break;case"add":t=await import("./add-R6TZAGXK.js");break;case"open":t=await import("./open-5DTFJE26.js");break;case"list":t=await import("./list-ML7QUWEU.js");break;case"login":t=await import("./login-CEGC4DIJ.js");break;case"logout":t=await import("./logout-PPA6JCDY.js");break;case"whoami":t=await import("./whoami-NI52A6U4.js");break;case"version":t=await import("./version-CXGPMLMK.js");break}return t};export{I as a,Y as b,x as c,j as d,H as e,V as f};
2
+ //# sourceMappingURL=chunk-NO72UU5F.js.map
@@ -0,0 +1,50 @@
1
+ import{d as cn,e as un,f as fn}from"./chunk-AGRDDZFS.js";import{$ as ln,A as We,B as sn,E as ce,K as ae,L as on,M as j,N as an,P as q,T as Zt,U as Xt,Z as xe,_ as Tt,a as Jr,b as Kr,c as Zr,d as me,e as D,f as en,g as St,h as je,i as Qt,j as Yt,k as Jt,m as Kt,o as tn,w as rn,x as nn}from"./chunk-GIAIN3IJ.js";import{a as Ht,b as Xr}from"./chunk-B6XQEEUK.js";import{a as G,c as F,e as oe,g as f}from"./chunk-SGMPMYEU.js";var gn=F((Qa,mn)=>{"use strict";f();var Rs=G("os"),pn=G("tty"),fe=Xr(),{env:Z}=process,Re;fe("no-color")||fe("no-colors")||fe("color=false")||fe("color=never")?Re=0:(fe("color")||fe("colors")||fe("color=true")||fe("color=always"))&&(Re=1);"FORCE_COLOR"in Z&&(Z.FORCE_COLOR==="true"?Re=1:Z.FORCE_COLOR==="false"?Re=0:Re=Z.FORCE_COLOR.length===0?1:Math.min(parseInt(Z.FORCE_COLOR,10),3));function er(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function tr(e,t){if(Re===0)return 0;if(fe("color=16m")||fe("color=full")||fe("color=truecolor"))return 3;if(fe("color=256"))return 2;if(e&&!t&&Re===void 0)return 0;let r=Re||0;if(Z.TERM==="dumb")return r;if(process.platform==="win32"){let n=Rs.release().split(".");return Number(n[0])>=10&&Number(n[2])>=10586?Number(n[2])>=14931?3:2:1}if("CI"in Z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(n=>n in Z)||Z.CI_NAME==="codeship"?1:r;if("TEAMCITY_VERSION"in Z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Z.TEAMCITY_VERSION)?1:0;if(Z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Z){let n=parseInt((Z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Z.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Z.TERM)||"COLORTERM"in Z?1:r}function Bs(e){let t=tr(e,e&&e.isTTY);return er(t)}mn.exports={supportsColor:Bs,stdout:er(tr(!0,pn.isatty(1))),stderr:er(tr(!0,pn.isatty(2)))}});var _n=F((Ja,bn)=>{"use strict";f();var Ds=gn(),ze=Xr();function yn(e){if(/^\d{3,4}$/.test(e)){let r=/(\d{1,2})(\d{2})/.exec(e);return{major:0,minor:parseInt(r[1],10),patch:parseInt(r[2],10)}}let t=(e||"").split(".").map(r=>parseInt(r,10));return{major:t[0],minor:t[1],patch:t[2]}}function rr(e){let{env:t}=process;if("FORCE_HYPERLINK"in t)return!(t.FORCE_HYPERLINK.length>0&&parseInt(t.FORCE_HYPERLINK,10)===0);if(ze("no-hyperlink")||ze("no-hyperlinks")||ze("hyperlink=false")||ze("hyperlink=never"))return!1;if(ze("hyperlink=true")||ze("hyperlink=always")||"NETLIFY"in t)return!0;if(!Ds.supportsColor(e)||e&&!e.isTTY||process.platform==="win32"||"CI"in t||"TEAMCITY_VERSION"in t)return!1;if("TERM_PROGRAM"in t){let r=yn(t.TERM_PROGRAM_VERSION);switch(t.TERM_PROGRAM){case"iTerm.app":return r.major===3?r.minor>=1:r.major>3;case"WezTerm":return r.major>=20200620;case"vscode":return r.major>1||r.major===1&&r.minor>=72}}if("VTE_VERSION"in t){if(t.VTE_VERSION==="0.50.0")return!1;let r=yn(t.VTE_VERSION);return r.major>0||r.minor>=50}return!1}bn.exports={supportsHyperlink:rr,stdout:rr(process.stdout),stderr:rr(process.stderr)}});var Cn=F((ar,lr)=>{f();(function(e,t){typeof ar=="object"&&typeof lr<"u"?lr.exports=t():typeof define=="function"&&define.amd?define(t):(e=typeof globalThis<"u"?globalThis:e||self).dayjs=t()})(ar,function(){"use strict";var e=1e3,t=6e4,r=36e5,n="millisecond",i="second",s="minute",o="hour",c="day",a="week",u="month",h="quarter",p="year",d="date",l="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,O={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(S){var w=["th","st","nd","rd"],x=S%100;return"["+S+(w[(x-20)%10]||w[x]||w[0])+"]"}},R=function(S,w,x){var y=String(S);return!y||y.length>=w?S:""+Array(w+1-y.length).join(x)+S},P={s:R,z:function(S){var w=-S.utcOffset(),x=Math.abs(w),y=Math.floor(x/60),g=x%60;return(w<=0?"+":"-")+R(y,2,"0")+":"+R(g,2,"0")},m:function S(w,x){if(w.date()<x.date())return-S(x,w);var y=12*(x.year()-w.year())+(x.month()-w.month()),g=w.clone().add(y,u),b=x-g<0,_=w.clone().add(y+(b?-1:1),u);return+(-(y+(x-g)/(b?g-_:_-g))||0)},a:function(S){return S<0?Math.ceil(S)||0:Math.floor(S)},p:function(S){return{M:u,y:p,w:a,d:c,D:d,h:o,m:s,s:i,ms:n,Q:h}[S]||String(S||"").toLowerCase().replace(/s$/,"")},u:function(S){return S===void 0}},Y="en",L={};L[Y]=O;var z="$isDayjsObject",J=function(S){return S instanceof te||!(!S||!S[z])},V=function S(w,x,y){var g;if(!w)return Y;if(typeof w=="string"){var b=w.toLowerCase();L[b]&&(g=b),x&&(L[b]=x,g=b);var _=w.split("-");if(!g&&_.length>1)return S(_[0])}else{var E=w.name;L[E]=w,g=E}return!y&&g&&(Y=g),g||!y&&Y},A=function(S,w){if(J(S))return S.clone();var x=typeof w=="object"?w:{};return x.date=S,x.args=arguments,new te(x)},k=P;k.l=V,k.i=J,k.w=function(S,w){return A(S,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var te=function(){function S(x){this.$L=V(x.locale,null,!0),this.parse(x),this.$x=this.$x||x.x||{},this[z]=!0}var w=S.prototype;return w.parse=function(x){this.$d=function(y){var g=y.date,b=y.utc;if(g===null)return new Date(NaN);if(k.u(g))return new Date;if(g instanceof Date)return new Date(g);if(typeof g=="string"&&!/Z$/i.test(g)){var _=g.match(m);if(_){var E=_[2]-1||0,B=(_[7]||"0").substring(0,3);return b?new Date(Date.UTC(_[1],E,_[3]||1,_[4]||0,_[5]||0,_[6]||0,B)):new Date(_[1],E,_[3]||1,_[4]||0,_[5]||0,_[6]||0,B)}}return new Date(g)}(x),this.init()},w.init=function(){var x=this.$d;this.$y=x.getFullYear(),this.$M=x.getMonth(),this.$D=x.getDate(),this.$W=x.getDay(),this.$H=x.getHours(),this.$m=x.getMinutes(),this.$s=x.getSeconds(),this.$ms=x.getMilliseconds()},w.$utils=function(){return k},w.isValid=function(){return this.$d.toString()!==l},w.isSame=function(x,y){var g=A(x);return this.startOf(y)<=g&&g<=this.endOf(y)},w.isAfter=function(x,y){return A(x)<this.startOf(y)},w.isBefore=function(x,y){return this.endOf(y)<A(x)},w.$g=function(x,y,g){return k.u(x)?this[y]:this.set(g,x)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(x,y){var g=this,b=!!k.u(y)||y,_=k.p(x),E=function(U,re){var _e=k.w(g.$u?Date.UTC(g.$y,re,U):new Date(g.$y,re,U),g);return b?_e:_e.endOf(c)},B=function(U,re){return k.w(g.toDate()[U].apply(g.toDate("s"),(b?[0,0,0,0]:[23,59,59,999]).slice(re)),g)},T=this.$W,M=this.$M,K=this.$D,pe="set"+(this.$u?"UTC":"");switch(_){case p:return b?E(1,0):E(31,11);case u:return b?E(1,M):E(0,M+1);case a:var se=this.$locale().weekStart||0,H=(T<se?T+7:T)-se;return E(b?K-H:K+(6-H),M);case c:case d:return B(pe+"Hours",0);case o:return B(pe+"Minutes",1);case s:return B(pe+"Seconds",2);case i:return B(pe+"Milliseconds",3);default:return this.clone()}},w.endOf=function(x){return this.startOf(x,!1)},w.$set=function(x,y){var g,b=k.p(x),_="set"+(this.$u?"UTC":""),E=(g={},g[c]=_+"Date",g[d]=_+"Date",g[u]=_+"Month",g[p]=_+"FullYear",g[o]=_+"Hours",g[s]=_+"Minutes",g[i]=_+"Seconds",g[n]=_+"Milliseconds",g)[b],B=b===c?this.$D+(y-this.$W):y;if(b===u||b===p){var T=this.clone().set(d,1);T.$d[E](B),T.init(),this.$d=T.set(d,Math.min(this.$D,T.daysInMonth())).$d}else E&&this.$d[E](B);return this.init(),this},w.set=function(x,y){return this.clone().$set(x,y)},w.get=function(x){return this[k.p(x)]()},w.add=function(x,y){var g,b=this;x=Number(x);var _=k.p(y),E=function(M){var K=A(b);return k.w(K.date(K.date()+Math.round(M*x)),b)};if(_===u)return this.set(u,this.$M+x);if(_===p)return this.set(p,this.$y+x);if(_===c)return E(1);if(_===a)return E(7);var B=(g={},g[s]=t,g[o]=r,g[i]=e,g)[_]||1,T=this.$d.getTime()+x*B;return k.w(T,this)},w.subtract=function(x,y){return this.add(-1*x,y)},w.format=function(x){var y=this,g=this.$locale();if(!this.isValid())return g.invalidDate||l;var b=x||"YYYY-MM-DDTHH:mm:ssZ",_=k.z(this),E=this.$H,B=this.$m,T=this.$M,M=g.weekdays,K=g.months,pe=g.meridiem,se=function(re,_e,nt,Et){return re&&(re[_e]||re(y,b))||nt[_e].slice(0,Et)},H=function(re){return k.s(E%12||12,re,"0")},U=pe||function(re,_e,nt){var Et=re<12?"AM":"PM";return nt?Et.toLowerCase():Et};return b.replace(v,function(re,_e){return _e||function(nt){switch(nt){case"YY":return String(y.$y).slice(-2);case"YYYY":return k.s(y.$y,4,"0");case"M":return T+1;case"MM":return k.s(T+1,2,"0");case"MMM":return se(g.monthsShort,T,K,3);case"MMMM":return se(K,T);case"D":return y.$D;case"DD":return k.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return se(g.weekdaysMin,y.$W,M,2);case"ddd":return se(g.weekdaysShort,y.$W,M,3);case"dddd":return M[y.$W];case"H":return String(E);case"HH":return k.s(E,2,"0");case"h":return H(1);case"hh":return H(2);case"a":return U(E,B,!0);case"A":return U(E,B,!1);case"m":return String(B);case"mm":return k.s(B,2,"0");case"s":return String(y.$s);case"ss":return k.s(y.$s,2,"0");case"SSS":return k.s(y.$ms,3,"0");case"Z":return _}return null}(re)||_.replace(":","")})},w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(x,y,g){var b,_=this,E=k.p(y),B=A(x),T=(B.utcOffset()-this.utcOffset())*t,M=this-B,K=function(){return k.m(_,B)};switch(E){case p:b=K()/12;break;case u:b=K();break;case h:b=K()/3;break;case a:b=(M-T)/6048e5;break;case c:b=(M-T)/864e5;break;case o:b=M/r;break;case s:b=M/t;break;case i:b=M/e;break;default:b=M}return g?b:k.a(b)},w.daysInMonth=function(){return this.endOf(u).$D},w.$locale=function(){return L[this.$L]},w.locale=function(x,y){if(!x)return this.$L;var g=this.clone(),b=V(x,y,!0);return b&&(g.$L=b),g},w.clone=function(){return k.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},S}(),rt=te.prototype;return A.prototype=rt,[["$ms",n],["$s",i],["$m",s],["$H",o],["$W",c],["$M",u],["$y",p],["$D",d]].forEach(function(S){rt[S[1]]=function(w){return this.$g(w,S[0],S[1])}}),A.extend=function(S,w){return S.$i||(S(w,te,A),S.$i=!0),A},A.locale=V,A.isDayjs=J,A.unix=function(S){return A(1e3*S)},A.en=L[Y],A.Ls=L,A.p={},A})});var Bn=F(He=>{"use strict";f();He.__esModule=!0;He.distance=He.closest=void 0;var Ee=new Uint32Array(65536),Us=function(e,t){for(var r=e.length,n=t.length,i=1<<r-1,s=-1,o=0,c=r,a=r;a--;)Ee[e.charCodeAt(a)]|=1<<a;for(a=0;a<n;a++){var u=Ee[t.charCodeAt(a)],h=u|o;u|=(u&s)+s^s,o|=~(u|s),s&=u,o&i&&c++,s&i&&c--,o=o<<1|1,s=s<<1|~(h|o),o&=h}for(a=r;a--;)Ee[e.charCodeAt(a)]=0;return c},Fs=function(e,t){for(var r=t.length,n=e.length,i=[],s=[],o=Math.ceil(r/32),c=Math.ceil(n/32),a=0;a<o;a++)s[a]=-1,i[a]=0;for(var u=0;u<c-1;u++){for(var h=0,p=-1,d=u*32,l=Math.min(32,n)+d,m=d;m<l;m++)Ee[e.charCodeAt(m)]|=1<<m;for(var a=0;a<r;a++){var v=Ee[t.charCodeAt(a)],O=s[a/32|0]>>>a&1,R=i[a/32|0]>>>a&1,P=v|h,Y=((v|R)&p)+p^p|v|R,L=h|~(Y|p),z=p&Y;L>>>31^O&&(s[a/32|0]^=1<<a),z>>>31^R&&(i[a/32|0]^=1<<a),L=L<<1|O,z=z<<1|R,p=z|~(P|L),h=L&P}for(var m=d;m<l;m++)Ee[e.charCodeAt(m)]=0}for(var J=0,V=-1,A=u*32,k=Math.min(32,n-A)+A,m=A;m<k;m++)Ee[e.charCodeAt(m)]|=1<<m;for(var te=n,a=0;a<r;a++){var v=Ee[t.charCodeAt(a)],O=s[a/32|0]>>>a&1,R=i[a/32|0]>>>a&1,P=v|J,Y=((v|R)&V)+V^V|v|R,L=J|~(Y|V),z=V&Y;te+=L>>>n-1&1,te-=z>>>n-1&1,L>>>31^O&&(s[a/32|0]^=1<<a),z>>>31^R&&(i[a/32|0]^=1<<a),L=L<<1|O,z=z<<1|R,V=z|~(P|L),J=L&P}for(var m=A;m<k;m++)Ee[e.charCodeAt(m)]=0;return te},Rn=function(e,t){if(e.length<t.length){var r=t;t=e,e=r}return t.length===0?e.length:e.length<=32?Us(e,t):Fs(e,t)};He.distance=Rn;var qs=function(e,t){for(var r=1/0,n=0,i=0;i<t.length;i++){var s=Rn(e,t[i]);s<r&&(r=s,n=i)}return t[n]};He.closest=qs});var Dn=F((cr,ot)=>{f();(function(){"use strict";var e;try{e=typeof Intl<"u"&&typeof Intl.Collator<"u"?Intl.Collator("generic",{sensitivity:"base"}):null}catch{console.log("Collator could not be initialized and wouldn't be used")}var t=Bn(),r=[],n=[],i={get:function(s,o,c){var a=c&&e&&c.useCollator;if(a){var u=s.length,h=o.length;if(u===0)return h;if(h===0)return u;var p,d,l,m,v;for(l=0;l<h;++l)r[l]=l,n[l]=o.charCodeAt(l);r[h]=h;var O;for(l=0;l<u;++l){for(d=l+1,m=0;m<h;++m)p=d,O=e.compare(s.charAt(l),String.fromCharCode(n[m]))===0,d=r[m]+(O?0:1),v=p+1,d>v&&(d=v),v=r[m+1]+1,d>v&&(d=v),r[m]=p;r[m]=d}return d}return t.distance(s,o)}};typeof define<"u"&&define!==null&&define.amd?define(function(){return i}):typeof ot<"u"&&ot!==null&&typeof cr<"u"&&ot.exports===cr?ot.exports=i:typeof self<"u"&&typeof self.postMessage=="function"&&typeof self.importScripts=="function"?self.Levenshtein=i:typeof window<"u"&&window!==null&&(window.Levenshtein=i)})()});var An=F((fr,hr)=>{f();(function(e,t){typeof G=="function"&&typeof fr=="object"&&typeof hr=="object"?hr.exports=t():typeof define=="function"&&define.amd?define(function(){return t()}):e.pluralize=t()})(fr,function(){var e=[],t=[],r={},n={},i={};function s(l){return typeof l=="string"?new RegExp("^"+l+"$","i"):l}function o(l,m){return l===m?m:l===l.toLowerCase()?m.toLowerCase():l===l.toUpperCase()?m.toUpperCase():l[0]===l[0].toUpperCase()?m.charAt(0).toUpperCase()+m.substr(1).toLowerCase():m.toLowerCase()}function c(l,m){return l.replace(/\$(\d{1,2})/g,function(v,O){return m[O]||""})}function a(l,m){return l.replace(m[0],function(v,O){var R=c(m[1],arguments);return o(v===""?l[O-1]:v,R)})}function u(l,m,v){if(!l.length||r.hasOwnProperty(l))return m;for(var O=v.length;O--;){var R=v[O];if(R[0].test(m))return a(m,R)}return m}function h(l,m,v){return function(O){var R=O.toLowerCase();return m.hasOwnProperty(R)?o(O,R):l.hasOwnProperty(R)?o(O,l[R]):u(R,O,v)}}function p(l,m,v,O){return function(R){var P=R.toLowerCase();return m.hasOwnProperty(P)?!0:l.hasOwnProperty(P)?!1:u(P,P,v)===P}}function d(l,m,v){var O=m===1?d.singular(l):d.plural(l);return(v?m+" ":"")+O}return d.plural=h(i,n,e),d.isPlural=p(i,n,e),d.singular=h(n,i,t),d.isSingular=p(n,i,t),d.addPluralRule=function(l,m){e.push([s(l),m])},d.addSingularRule=function(l,m){t.push([s(l),m])},d.addUncountableRule=function(l){if(typeof l=="string"){r[l.toLowerCase()]=!0;return}d.addPluralRule(l,"$0"),d.addSingularRule(l,"$0")},d.addIrregularRule=function(l,m){m=m.toLowerCase(),l=l.toLowerCase(),i[l]=m,n[m]=l},[["I","we"],["me","us"],["he","they"],["she","they"],["them","them"],["myself","ourselves"],["yourself","yourselves"],["itself","themselves"],["herself","themselves"],["himself","themselves"],["themself","themselves"],["is","are"],["was","were"],["has","have"],["this","these"],["that","those"],["echo","echoes"],["dingo","dingoes"],["volcano","volcanoes"],["tornado","tornadoes"],["torpedo","torpedoes"],["genus","genera"],["viscus","viscera"],["stigma","stigmata"],["stoma","stomata"],["dogma","dogmata"],["lemma","lemmata"],["schema","schemata"],["anathema","anathemata"],["ox","oxen"],["axe","axes"],["die","dice"],["yes","yeses"],["foot","feet"],["eave","eaves"],["goose","geese"],["tooth","teeth"],["quiz","quizzes"],["human","humans"],["proof","proofs"],["carve","carves"],["valve","valves"],["looey","looies"],["thief","thieves"],["groove","grooves"],["pickaxe","pickaxes"],["passerby","passersby"]].forEach(function(l){return d.addIrregularRule(l[0],l[1])}),[[/s?$/i,"s"],[/[^\u0000-\u007F]$/i,"$0"],[/([^aeiou]ese)$/i,"$1"],[/(ax|test)is$/i,"$1es"],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,"$1es"],[/(e[mn]u)s?$/i,"$1s"],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,"$1"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1i"],[/(alumn|alg|vertebr)(?:a|ae)$/i,"$1ae"],[/(seraph|cherub)(?:im)?$/i,"$1im"],[/(her|at|gr)o$/i,"$1oes"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,"$1a"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,"$1a"],[/sis$/i,"ses"],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,"$1$2ves"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/([^ch][ieo][ln])ey$/i,"$1ies"],[/(x|ch|ss|sh|zz)$/i,"$1es"],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,"$1ices"],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,"$1ice"],[/(pe)(?:rson|ople)$/i,"$1ople"],[/(child)(?:ren)?$/i,"$1ren"],[/eaux$/i,"$0"],[/m[ae]n$/i,"men"],["thou","you"]].forEach(function(l){return d.addPluralRule(l[0],l[1])}),[[/s$/i,""],[/(ss)$/i,"$1"],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,"$1fe"],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,"$1f"],[/ies$/i,"y"],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,"$1ie"],[/\b(mon|smil)ies$/i,"$1ey"],[/\b((?:tit)?m|l)ice$/i,"$1ouse"],[/(seraph|cherub)im$/i,"$1"],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,"$1"],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,"$1sis"],[/(movie|twelve|abuse|e[mn]u)s$/i,"$1"],[/(test)(?:is|es)$/i,"$1is"],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,"$1us"],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,"$1um"],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,"$1on"],[/(alumn|alg|vertebr)ae$/i,"$1a"],[/(cod|mur|sil|vert|ind)ices$/i,"$1ex"],[/(matr|append)ices$/i,"$1ix"],[/(pe)(rson|ople)$/i,"$1rson"],[/(child)ren$/i,"$1"],[/(eau)x?$/i,"$1"],[/men$/i,"man"]].forEach(function(l){return d.addSingularRule(l[0],l[1])}),["adulthood","advice","agenda","aid","aircraft","alcohol","ammo","analytics","anime","athletics","audio","bison","blood","bream","buffalo","butter","carp","cash","chassis","chess","clothing","cod","commerce","cooperation","corps","debris","diabetes","digestion","elk","energy","equipment","excretion","expertise","firmware","flounder","fun","gallows","garbage","graffiti","hardware","headquarters","health","herpes","highjinks","homework","housework","information","jeans","justice","kudos","labour","literature","machinery","mackerel","mail","media","mews","moose","music","mud","manga","news","only","personnel","pike","plankton","pliers","police","pollution","premises","rain","research","rice","salmon","scissors","series","sewage","shambles","shrimp","software","species","staff","swine","tennis","traffic","transportation","trout","tuna","wealth","welfare","whiting","wildebeest","wildlife","you",/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(d.addUncountableRule),d})});var jn=F((hc,Gn)=>{"use strict";f();var Fn=12,Hs=0,pr=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];function Qs(e){var t=e.indexOf("%");if(t===-1)return e;for(var r=e.length,n="",i=0,s=0,o=t,c=Fn;t>-1&&t<r;){var a=qn(e[t+1],4),u=qn(e[t+2],0),h=a|u,p=pr[h];if(c=pr[256+c+p],s=s<<6|h&pr[364+p],c===Fn)n+=e.slice(i,o),n+=s<=65535?String.fromCharCode(s):String.fromCharCode(55232+(s>>10),56320+(s&1023)),s=0,i=t+3,t=o=e.indexOf("%",i);else{if(c===Hs)return null;if(t+=3,t<r&&e.charCodeAt(t)===37)continue;return null}}return n+e.slice(i)}var Ys={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 qn(e,t){var r=Ys[e];return r===void 0?255:r<<t}Gn.exports=Qs});var Qn=F((pc,Hn)=>{"use strict";f();var Wn=jn(),Vn=/\+/g,zn=function(){};zn.prototype=Object.create(null);function Js(e){let t=new zn;if(typeof e!="string")return t;let r=e.length,n="",i="",s=-1,o=-1,c=!1,a=!1,u=!1,h=!1,p=!1,d=0;for(let l=0;l<r+1;l++)if(d=l!==r?e.charCodeAt(l):38,d===38){if(p=o>s,p||(o=l),n=e.slice(s+1,o),p||n.length>0){u&&(n=n.replace(Vn," ")),c&&(n=Wn(n)||n),p&&(i=e.slice(o+1,l),h&&(i=i.replace(Vn," ")),a&&(i=Wn(i)||i));let m=t[n];m===void 0?t[n]=i:m.pop?m.push(i):t[n]=[m,i]}i="",s=l,o=l,c=!1,a=!1,u=!1,h=!1}else d===61?o<=s?o=l:a=!0:d===43?o>s?h=!0:u=!0:d===37&&(o>s?a=!0:c=!0);return t}Hn.exports=Js});var Jn=F((gc,Yn)=>{f();var we=Array.from({length:256},(e,t)=>"%"+((t<16?"0":"")+t.toString(16)).toUpperCase()),Ks=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 Zs(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(Ks[s]!==1&&(n<i&&(r+=e.slice(n,i)),n=i+1,r+=we[s]),++i===t)break e;s=e.charCodeAt(i)}if(n<i&&(r+=e.slice(n,i)),s<2048){n=i+1,r+=we[192|s>>6]+we[128|s&63];continue}if(s<55296||s>=57344){n=i+1,r+=we[224|s>>12]+we[128|s>>6&63]+we[128|s&63];continue}if(++i,i>=t)throw new Error("URI malformed");let o=e.charCodeAt(i)&1023;n=i+1,s=65536+((s&1023)<<10|o),r+=we[240|s>>18]+we[128|s>>12&63]+we[128|s>>6&63]+we[128|s&63]}return n===0?e:n<t?r+e.slice(n):r}Yn.exports={encodeString:Zs}});var Xn=F((bc,Zn)=>{"use strict";f();var{encodeString:mr}=Jn();function Kn(e){let t=typeof e;return t==="string"?mr(e):t==="bigint"?e.toString():t==="boolean"?e?"true":"false":t==="number"&&Number.isFinite(e)?e<1e21?""+e:mr(""+e):""}function Xs(e){let t="";if(e===null||typeof e!="object")return t;let r="&",n=Object.keys(e),i=n.length,s=0;for(let o=0;o<i;o++){let c=n[o],a=e[c],u=mr(c)+"=";if(o&&(t+=r),Array.isArray(a)){s=a.length;for(let h=0;h<s;h++)h&&(t+=r),t+=u,t+=Kn(a[h])}else t+=u,t+=Kn(a)}return t}Zn.exports=Xs});var ni=F((xc,lt)=>{"use strict";f();var ei=Qn(),ti=Xn(),ri={parse:ei,stringify:ti};lt.exports=ri;lt.exports.default=ri;lt.exports.parse=ei;lt.exports.stringify=ti});var _i=F((Mu,Er)=>{"use strict";f();var bo=Object.prototype.hasOwnProperty,ie="~";function ct(){}Object.create&&(ct.prototype=Object.create(null),new ct().__proto__||(ie=!1));function _o(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function bi(e,t,r,n,i){if(typeof r!="function")throw new TypeError("The listener must be a function");var s=new _o(r,n||e,i),o=ie?ie+t:t;return e._events[o]?e._events[o].fn?e._events[o]=[e._events[o],s]:e._events[o].push(s):(e._events[o]=s,e._eventsCount++),e}function Dt(e,t){--e._eventsCount===0?e._events=new ct:delete e._events[t]}function ee(){this._events=new ct,this._eventsCount=0}ee.prototype.eventNames=function(){var t=[],r,n;if(this._eventsCount===0)return t;for(n in r=this._events)bo.call(r,n)&&t.push(ie?n.slice(1):n);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(r)):t};ee.prototype.listeners=function(t){var r=ie?ie+t:t,n=this._events[r];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i<s;i++)o[i]=n[i].fn;return o};ee.prototype.listenerCount=function(t){var r=ie?ie+t:t,n=this._events[r];return n?n.fn?1:n.length:0};ee.prototype.emit=function(t,r,n,i,s,o){var c=ie?ie+t:t;if(!this._events[c])return!1;var a=this._events[c],u=arguments.length,h,p;if(a.fn){switch(a.once&&this.removeListener(t,a.fn,void 0,!0),u){case 1:return a.fn.call(a.context),!0;case 2:return a.fn.call(a.context,r),!0;case 3:return a.fn.call(a.context,r,n),!0;case 4:return a.fn.call(a.context,r,n,i),!0;case 5:return a.fn.call(a.context,r,n,i,s),!0;case 6:return a.fn.call(a.context,r,n,i,s,o),!0}for(p=1,h=new Array(u-1);p<u;p++)h[p-1]=arguments[p];a.fn.apply(a.context,h)}else{var d=a.length,l;for(p=0;p<d;p++)switch(a[p].once&&this.removeListener(t,a[p].fn,void 0,!0),u){case 1:a[p].fn.call(a[p].context);break;case 2:a[p].fn.call(a[p].context,r);break;case 3:a[p].fn.call(a[p].context,r,n);break;case 4:a[p].fn.call(a[p].context,r,n,i);break;default:if(!h)for(l=1,h=new Array(u-1);l<u;l++)h[l-1]=arguments[l];a[p].fn.apply(a[p].context,h)}}return!0};ee.prototype.on=function(t,r,n){return bi(this,t,r,n,!1)};ee.prototype.once=function(t,r,n){return bi(this,t,r,n,!0)};ee.prototype.removeListener=function(t,r,n,i){var s=ie?ie+t:t;if(!this._events[s])return this;if(!r)return Dt(this,s),this;var o=this._events[s];if(o.fn)o.fn===r&&(!i||o.once)&&(!n||o.context===n)&&Dt(this,s);else{for(var c=0,a=[],u=o.length;c<u;c++)(o[c].fn!==r||i&&!o[c].once||n&&o[c].context!==n)&&a.push(o[c]);a.length?this._events[s]=a.length===1?a[0]:a:Dt(this,s)}return this};ee.prototype.removeAllListeners=function(t){var r;return t?(r=ie?ie+t:t,this._events[r]&&Dt(this,r)):(this._events=new ct,this._eventsCount=0),this};ee.prototype.off=ee.prototype.removeListener;ee.prototype.addListener=ee.prototype.on;ee.prefixed=ie;ee.EventEmitter=ee;typeof Er<"u"&&(Er.exports=ee)});var Ti=F((ef,Si)=>{"use strict";f();var{Duplex:xo}=G("stream");function vi(e){e.emit("close")}function wo(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ei(e){this.removeListener("error",Ei),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}function vo(e,t){let r=!0,n=new xo({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",function(s,o){let c=!o&&n._readableState.objectMode?s.toString():s;n.push(c)||e.pause()}),e.once("error",function(s){n.destroyed||(r=!1,n.destroy(s))}),e.once("close",function(){n.destroyed||n.push(null)}),n._destroy=function(i,s){if(e.readyState===e.CLOSED){s(i),process.nextTick(vi,n);return}let o=!1;e.once("error",function(a){o=!0,s(a)}),e.once("close",function(){o||s(i),process.nextTick(vi,n)}),r&&e.terminate()},n._final=function(i){if(e.readyState===e.CONNECTING){e.once("open",function(){n._final(i)});return}e._socket!==null&&(e._socket._writableState.finished?(i(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",function(){i()}),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(i,s,o){if(e.readyState===e.CONNECTING){e.once("open",function(){n._write(i,s,o)});return}e.send(i,o)},n.on("end",wo),n.on("error",Ei),n}Si.exports=vo});var Oe=F((rf,ki)=>{"use strict";f();var Oi=["nodebuffer","arraybuffer","fragments"],Li=typeof Blob<"u";Li&&Oi.push("blob");ki.exports={BINARY_TYPES:Oi,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Li,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var dt=F((sf,$t)=>{"use strict";f();var{EMPTY_BUFFER:Eo}=Oe(),kr=Buffer[Symbol.species];function So(e,t){if(e.length===0)return Eo;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let i=0;i<e.length;i++){let s=e[i];r.set(s,n),n+=s.length}return n<t?new kr(r.buffer,r.byteOffset,n):r}function Ci(e,t,r,n,i){for(let s=0;s<i;s++)r[n+s]=e[s]^t[s&3]}function Ri(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}function To(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function Cr(e){if(Cr.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new kr(e):ArrayBuffer.isView(e)?t=new kr(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),Cr.readOnly=!1),t}$t.exports={concat:So,mask:Ci,toArrayBuffer:To,toBuffer:Cr,unmask:Ri};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=G("bufferutil");$t.exports.mask=function(t,r,n,i,s){s<48?Ci(t,r,n,i,s):e.mask(t,r,n,i,s)},$t.exports.unmask=function(t,r){t.length<32?Ri(t,r):e.unmask(t,r)}}catch{}});var $i=F((af,Di)=>{"use strict";f();var Bi=Symbol("kDone"),Rr=Symbol("kRun"),Br=class{constructor(t){this[Bi]=()=>{this.pending--,this[Rr]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[Rr]()}[Rr](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[Bi])}}};Di.exports=Br});var gt=F((cf,Pi)=>{"use strict";f();var pt=G("zlib"),Ai=dt(),Oo=$i(),{kStatusCode:Ni}=Oe(),Lo=Buffer[Symbol.species],ko=Buffer.from([0,0,255,255]),It=Symbol("permessage-deflate"),Le=Symbol("total-length"),mt=Symbol("callback"),Ae=Symbol("buffers"),Nt=Symbol("error"),At,Dr=class{constructor(t,r,n){if(this._maxPayload=n|0,this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!r,this._deflate=null,this._inflate=null,this.params=null,!At){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;At=new Oo(i)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[mt];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(i=>!(r.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>i.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let i=r[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let s=+i;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=s}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=i})}),t}decompress(t,r,n){At.add(i=>{this._decompress(t,r,(s,o)=>{i(),n(s,o)})})}compress(t,r,n){At.add(i=>{this._compress(t,r,(s,o)=>{i(),n(s,o)})})}_decompress(t,r,n){let i=this._isServer?"client":"server";if(!this._inflate){let s=`${i}_max_window_bits`,o=typeof this.params[s]!="number"?pt.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=pt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[It]=this,this._inflate[Le]=0,this._inflate[Ae]=[],this._inflate.on("error",Ro),this._inflate.on("data",Ii)}this._inflate[mt]=n,this._inflate.write(t),r&&this._inflate.write(ko),this._inflate.flush(()=>{let s=this._inflate[Nt];if(s){this._inflate.close(),this._inflate=null,n(s);return}let o=Ai.concat(this._inflate[Ae],this._inflate[Le]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Le]=0,this._inflate[Ae]=[],r&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),n(null,o)})}_compress(t,r,n){let i=this._isServer?"server":"client";if(!this._deflate){let s=`${i}_max_window_bits`,o=typeof this.params[s]!="number"?pt.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=pt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[Le]=0,this._deflate[Ae]=[],this._deflate.on("data",Co)}this._deflate[mt]=n,this._deflate.write(t),this._deflate.flush(pt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=Ai.concat(this._deflate[Ae],this._deflate[Le]);r&&(s=new Lo(s.buffer,s.byteOffset,s.length-4)),this._deflate[mt]=null,this._deflate[Le]=0,this._deflate[Ae]=[],r&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),n(null,s)})}};Pi.exports=Dr;function Co(e){this[Ae].push(e),this[Le]+=e.length}function Ii(e){if(this[Le]+=e.length,this[It]._maxPayload<1||this[Le]<=this[It]._maxPayload){this[Ae].push(e);return}this[Nt]=new RangeError("Max payload size exceeded"),this[Nt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Nt][Ni]=1009,this.removeListener("data",Ii),this.reset()}function Ro(e){this[It]._inflate=null,e[Ni]=1007,this[mt](e)}});var Ke=F((ff,Pt)=>{"use strict";f();var{isUtf8:Mi}=G("buffer"),{hasBlob:Bo}=Oe(),Do=[0,0,0,0,0,0,0,0,0,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 $o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function $r(e){let t=e.length,r=0;for(;r<t;)if(!(e[r]&128))r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}function Ao(e){return Bo&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}Pt.exports={isBlob:Ao,isValidStatusCode:$o,isValidUTF8:$r,tokenChars:Do};if(Mi)Pt.exports.isValidUTF8=function(e){return e.length<24?$r(e):Mi(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=G("utf-8-validate");Pt.exports.isValidUTF8=function(t){return t.length<32?$r(t):e(t)}}catch{}});var Mr=F((df,Vi)=>{"use strict";f();var{Writable:No}=G("stream"),Ui=gt(),{BINARY_TYPES:Io,EMPTY_BUFFER:Fi,kStatusCode:Po,kWebSocket:Mo}=Oe(),{concat:Ar,toArrayBuffer:Uo,unmask:Fo}=dt(),{isValidStatusCode:qo,isValidUTF8:qi}=Ke(),Mt=Buffer[Symbol.species],he=0,Gi=1,ji=2,Wi=3,Nr=4,Ir=5,Ut=6,Pr=class extends No{constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||Io[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[Mo]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=he}_write(t,r,n){if(this._opcode===8&&this._state==he)return n();this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new Mt(n.buffer,n.byteOffset+t,n.length-t),new Mt(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],i=r.length-t;t>=n.length?r.set(this._buffers.shift(),i):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),i),this._buffers[0]=new Mt(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case he:this.getInfo(t);break;case Gi:this.getPayloadLength16(t);break;case ji:this.getPayloadLength64(t);break;case Wi:this.getMask();break;case Nr:this.getData(t);break;case Ir:case Ut:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if(r[0]&48){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(i);return}let n=(r[0]&64)===64;if(n&&!this._extensions[Ui.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=Gi:this._payloadLength===127?this._state=ji: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=Wi:this._state=Nr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Nr}getData(t){let r=Fi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Fo(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._compressed){this._state=Ir,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[Ui.extensionName].decompress(t,this._fin,(i,s)=>{if(i)return r(i);if(s.length){if(this._messageLength+=s.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(o);return}this._fragments.push(s)}this.dataMessage(r),this._state===he&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=he;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=Ar(n,r):this._binaryType==="arraybuffer"?i=Uo(Ar(n,r)):this._binaryType==="blob"?i=new Blob(n):i=n,this._allowSynchronousEvents?(this.emit("message",i,!0),this._state=he):(this._state=Ut,setImmediate(()=>{this.emit("message",i,!0),this._state=he,this.startLoop(t)}))}else{let i=Ar(n,r);if(!this._skipUTF8Validation&&!qi(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(s);return}this._state===Ir||this._allowSynchronousEvents?(this.emit("message",i,!1),this._state=he):(this._state=Ut,setImmediate(()=>{this.emit("message",i,!1),this._state=he,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,Fi),this.end();else{let n=t.readUInt16BE(0);if(!qo(n)){let s=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(s);return}let i=new Mt(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!qi(i)){let s=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(s);return}this._loop=!1,this.emit("conclude",n,i),this.end()}this._state=he;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=he):(this._state=Ut,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=he,this.startLoop(r)}))}createError(t,r,n,i,s){this._loop=!1,this._errored=!0;let o=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(o,this.createError),o.code=s,o[Po]=i,o}};Vi.exports=Pr});var qr=F((gf,Qi)=>{"use strict";f();var{Duplex:mf}=G("stream"),{randomFillSync:Go}=G("crypto"),zi=gt(),{EMPTY_BUFFER:jo,kWebSocket:Wo,NOOP:Vo}=Oe(),{isBlob:Ze,isValidStatusCode:zo}=Ke(),{mask:Hi,toBuffer:Me}=dt(),de=Symbol("kByteLength"),Ho=Buffer.alloc(4),Ft=8*1024,Ue,Xe=Ft,be=0,Qo=1,Yo=2,Ur=class e{constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=be,this.onerror=Vo,this[Wo]=void 0}static frame(t,r){let n,i=!1,s=2,o=!1;r.mask&&(n=r.maskBuffer||Ho,r.generateMask?r.generateMask(n):(Xe===Ft&&(Ue===void 0&&(Ue=Buffer.alloc(Ft)),Go(Ue,0,Ft),Xe=0),n[0]=Ue[Xe++],n[1]=Ue[Xe++],n[2]=Ue[Xe++],n[3]=Ue[Xe++]),o=(n[0]|n[1]|n[2]|n[3])===0,s=6);let c;typeof t=="string"?(!r.mask||o)&&r[de]!==void 0?c=r[de]:(t=Buffer.from(t),c=t.length):(c=t.length,i=r.mask&&r.readOnly&&!o);let a=c;c>=65536?(s+=8,a=127):c>125&&(s+=2,a=126);let u=Buffer.allocUnsafe(i?c+s:s);return u[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(u[0]|=64),u[1]=a,a===126?u.writeUInt16BE(c,2):a===127&&(u[2]=u[3]=0,u.writeUIntBE(c,4,6)),r.mask?(u[1]|=128,u[s-4]=n[0],u[s-3]=n[1],u[s-2]=n[2],u[s-1]=n[3],o?[u,t]:i?(Hi(t,n,u,s,c),[u]):(Hi(t,n,t,0,c),[u,t])):[u,t]}close(t,r,n,i){let s;if(t===void 0)s=jo;else{if(typeof t!="number"||!zo(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+c),s.writeUInt16BE(t,0),typeof r=="string"?s.write(r,2):s.set(r,2)}}let o={[de]:s.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==be?this.enqueue([this.dispatch,s,!1,o,i]):this.sendFrame(e.frame(s,o),i)}ping(t,r,n){let i,s;if(typeof t=="string"?(i=Buffer.byteLength(t),s=!1):Ze(t)?(i=t.size,s=!1):(t=Me(t),i=t.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[de]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};Ze(t)?this._state!==be?this.enqueue([this.getBlobData,t,!1,o,n]):this.getBlobData(t,!1,o,n):this._state!==be?this.enqueue([this.dispatch,t,!1,o,n]):this.sendFrame(e.frame(t,o),n)}pong(t,r,n){let i,s;if(typeof t=="string"?(i=Buffer.byteLength(t),s=!1):Ze(t)?(i=t.size,s=!1):(t=Me(t),i=t.length,s=Me.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[de]:i,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};Ze(t)?this._state!==be?this.enqueue([this.getBlobData,t,!1,o,n]):this.getBlobData(t,!1,o,n):this._state!==be?this.enqueue([this.dispatch,t,!1,o,n]):this.sendFrame(e.frame(t,o),n)}send(t,r,n){let i=this._extensions[zi.extensionName],s=r.binary?2:1,o=r.compress,c,a;typeof t=="string"?(c=Buffer.byteLength(t),a=!1):Ze(t)?(c=t.size,a=!1):(t=Me(t),c=t.length,a=Me.readOnly),this._firstFragment?(this._firstFragment=!1,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=c>=i._threshold),this._compress=o):(o=!1,s=0),r.fin&&(this._firstFragment=!0);let u={[de]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:a,rsv1:o};Ze(t)?this._state!==be?this.enqueue([this.getBlobData,t,this._compress,u,n]):this.getBlobData(t,this._compress,u,n):this._state!==be?this.enqueue([this.dispatch,t,this._compress,u,n]):this.dispatch(t,this._compress,u,n)}getBlobData(t,r,n,i){this._bufferedBytes+=n[de],this._state=Yo,t.arrayBuffer().then(s=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(Fr,this,c,i);return}this._bufferedBytes-=n[de];let o=Me(s);r?this.dispatch(o,r,n,i):(this._state=be,this.sendFrame(e.frame(o,n),i),this.dequeue())}).catch(s=>{process.nextTick(Jo,this,s,i)})}dispatch(t,r,n,i){if(!r){this.sendFrame(e.frame(t,n),i);return}let s=this._extensions[zi.extensionName];this._bufferedBytes+=n[de],this._state=Qo,s.compress(t,n.fin,(o,c)=>{if(this._socket.destroyed){let a=new Error("The socket was closed while data was being compressed");Fr(this,a,i);return}this._bufferedBytes-=n[de],this._state=be,n.readOnly=!1,this.sendFrame(e.frame(c,n),i),this.dequeue()})}dequeue(){for(;this._state===be&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][de],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][de],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};Qi.exports=Ur;function Fr(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let i=e._queue[n],s=i[i.length-1];typeof s=="function"&&s(t)}}function Jo(e,t,r){Fr(e,t,r),e.onerror(t)}});var ns=F((bf,rs)=>{"use strict";f();var{kForOnEventAttribute:yt,kListener:Gr}=Oe(),Yi=Symbol("kCode"),Ji=Symbol("kData"),Ki=Symbol("kError"),Zi=Symbol("kMessage"),Xi=Symbol("kReason"),et=Symbol("kTarget"),es=Symbol("kType"),ts=Symbol("kWasClean"),ke=class{constructor(t){this[et]=null,this[es]=t}get target(){return this[et]}get type(){return this[es]}};Object.defineProperty(ke.prototype,"target",{enumerable:!0});Object.defineProperty(ke.prototype,"type",{enumerable:!0});var Fe=class extends ke{constructor(t,r={}){super(t),this[Yi]=r.code===void 0?0:r.code,this[Xi]=r.reason===void 0?"":r.reason,this[ts]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[Yi]}get reason(){return this[Xi]}get wasClean(){return this[ts]}};Object.defineProperty(Fe.prototype,"code",{enumerable:!0});Object.defineProperty(Fe.prototype,"reason",{enumerable:!0});Object.defineProperty(Fe.prototype,"wasClean",{enumerable:!0});var tt=class extends ke{constructor(t,r={}){super(t),this[Ki]=r.error===void 0?null:r.error,this[Zi]=r.message===void 0?"":r.message}get error(){return this[Ki]}get message(){return this[Zi]}};Object.defineProperty(tt.prototype,"error",{enumerable:!0});Object.defineProperty(tt.prototype,"message",{enumerable:!0});var bt=class extends ke{constructor(t,r={}){super(t),this[Ji]=r.data===void 0?null:r.data}get data(){return this[Ji]}};Object.defineProperty(bt.prototype,"data",{enumerable:!0});var Ko={addEventListener(e,t,r={}){for(let i of this.listeners(e))if(!r[yt]&&i[Gr]===t&&!i[yt])return;let n;if(e==="message")n=function(s,o){let c=new bt("message",{data:o?s:s.toString()});c[et]=this,qt(t,this,c)};else if(e==="close")n=function(s,o){let c=new Fe("close",{code:s,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[et]=this,qt(t,this,c)};else if(e==="error")n=function(s){let o=new tt("error",{error:s,message:s.message});o[et]=this,qt(t,this,o)};else if(e==="open")n=function(){let s=new ke("open");s[et]=this,qt(t,this,s)};else return;n[yt]=!!r[yt],n[Gr]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[Gr]===t&&!r[yt]){this.removeListener(e,r);break}}};rs.exports={CloseEvent:Fe,ErrorEvent:tt,Event:ke,EventTarget:Ko,MessageEvent:bt};function qt(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}});var jr=F((xf,is)=>{"use strict";f();var{tokenChars:_t}=Ke();function ve(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}function Zo(e){let t=Object.create(null),r=Object.create(null),n=!1,i=!1,s=!1,o,c,a=-1,u=-1,h=-1,p=0;for(;p<e.length;p++)if(u=e.charCodeAt(p),o===void 0)if(h===-1&&_t[u]===1)a===-1&&(a=p);else if(p!==0&&(u===32||u===9))h===-1&&a!==-1&&(h=p);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${p}`);h===-1&&(h=p);let l=e.slice(a,h);u===44?(ve(t,l,r),r=Object.create(null)):o=l,a=h=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(h===-1&&_t[u]===1)a===-1&&(a=p);else if(u===32||u===9)h===-1&&a!==-1&&(h=p);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${p}`);h===-1&&(h=p),ve(r,e.slice(a,h),!0),u===44&&(ve(t,o,r),r=Object.create(null),o=void 0),a=h=-1}else if(u===61&&a!==-1&&h===-1)c=e.slice(a,p),a=h=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(i){if(_t[u]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);a===-1?a=p:n||(n=!0),i=!1}else if(s)if(_t[u]===1)a===-1&&(a=p);else if(u===34&&a!==-1)s=!1,h=p;else if(u===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(u===34&&e.charCodeAt(p-1)===61)s=!0;else if(h===-1&&_t[u]===1)a===-1&&(a=p);else if(a!==-1&&(u===32||u===9))h===-1&&(h=p);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${p}`);h===-1&&(h=p);let l=e.slice(a,h);n&&(l=l.replace(/\\/g,""),n=!1),ve(r,c,l),u===44&&(ve(t,o,r),r=Object.create(null),o=void 0),c=void 0,a=h=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(a===-1||s||u===32||u===9)throw new SyntaxError("Unexpected end of input");h===-1&&(h=p);let d=e.slice(a,h);return o===void 0?ve(t,d,r):(c===void 0?ve(r,d,!0):n?ve(r,c,d.replace(/\\/g,"")):ve(r,c,d),ve(t,o,r)),t}function Xo(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(i=>{let s=n[i];return Array.isArray(s)||(s=[s]),s.map(o=>o===!0?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}is.exports={format:Xo,parse:Zo}});var Qr=F((Sf,gs)=>{"use strict";f();var ea=G("events"),ta=G("https"),ra=G("http"),as=G("net"),na=G("tls"),{randomBytes:ia,createHash:sa}=G("crypto"),{Duplex:vf,Readable:Ef}=G("stream"),{URL:Wr}=G("url"),Ne=gt(),oa=Mr(),aa=qr(),{isBlob:la}=Ke(),{BINARY_TYPES:ss,EMPTY_BUFFER:Gt,GUID:ca,kForOnEventAttribute:Vr,kListener:ua,kStatusCode:fa,kWebSocket:X,NOOP:ls}=Oe(),{EventTarget:{addEventListener:ha,removeEventListener:da}}=ns(),{format:pa,parse:ma}=jr(),{toBuffer:ga}=dt(),ya=30*1e3,cs=Symbol("kAborted"),zr=[8,13],Ce=["CONNECTING","OPEN","CLOSING","CLOSED"],ba=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,W=class e extends ea{constructor(t,r,n){super(),this._binaryType=ss[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Gt,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),us(this,t,r,n)):(this._autoPong=n.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){ss.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 oa({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),s=new aa(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",wa),i.on("drain",va),i.on("error",Ea),i.on("message",Sa),i.on("ping",Ta),i.on("pong",Oa),s.onerror=La,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",ds),t.on("data",Wt),t.on("end",ps),t.on("error",ms),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())}),hs(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Hr(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||Gt,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Hr(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||Gt,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){Hr(this,t,n);return}let i={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Ne.extensionName]||(i.compress=!1),this._sender.send(t||Gt,i,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(W,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(W.prototype,"CONNECTING",{enumerable:!0,value:Ce.indexOf("CONNECTING")});Object.defineProperty(W,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(W.prototype,"OPEN",{enumerable:!0,value:Ce.indexOf("OPEN")});Object.defineProperty(W,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(W.prototype,"CLOSING",{enumerable:!0,value:Ce.indexOf("CLOSING")});Object.defineProperty(W,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});Object.defineProperty(W.prototype,"CLOSED",{enumerable:!0,value:Ce.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(W.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(W.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[Vr])return t[ua];return null},set(t){for(let r of this.listeners(e))if(r[Vr]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[Vr]:!0})}})});W.prototype.addEventListener=ha;W.prototype.removeEventListener=da;gs.exports=W;function us(e,t,r,n){let i={allowSynchronousEvents:!0,autoPong:!0,protocolVersion:zr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=i.autoPong,!zr.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${zr.join(", ")})`);let s;if(t instanceof Wr)s=t;else try{s=new Wr(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}s.protocol==="http:"?s.protocol="ws:":s.protocol==="https:"&&(s.protocol="wss:"),e._url=s.href;let o=s.protocol==="wss:",c=s.protocol==="ws+unix:",a;if(s.protocol!=="ws:"&&!o&&!c?a=`The URL's protocol must be one of "ws:", "wss:", "http:", "https", or "ws+unix:"`:c&&!s.pathname?a="The URL's pathname is empty":s.hash&&(a="The URL contains a fragment identifier"),a){let v=new SyntaxError(a);if(e._redirects===0)throw v;jt(e,v);return}let u=o?443:80,h=ia(16).toString("base64"),p=o?ta.request:ra.request,d=new Set,l;if(i.createConnection=i.createConnection||(o?xa:_a),i.defaultPort=i.defaultPort||u,i.port=s.port||u,i.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":h,Connection:"Upgrade",Upgrade:"websocket"},i.path=s.pathname+s.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(l=new Ne(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=pa({[Ne.extensionName]:l.offer()})),r.length){for(let v of r){if(typeof v!="string"||!ba.test(v)||d.has(v))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(v)}i.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(s.username||s.password)&&(i.auth=`${s.username}:${s.password}`),c){let v=i.path.split(":");i.socketPath=v[0],i.path=v[1]}let m;if(i.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=o,e._originalHostOrSocketPath=c?i.socketPath:s.host;let v=n&&n.headers;if(n={...n,headers:{}},v)for(let[O,R]of Object.entries(v))n.headers[O.toLowerCase()]=R}else if(e.listenerCount("redirect")===0){let v=c?e._originalIpc?i.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!v||e._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,v||delete i.headers.host,i.auth=void 0)}i.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),m=e._req=p(i),e._redirects&&e.emit("redirect",e.url,m)}else m=e._req=p(i);i.timeout&&m.on("timeout",()=>{ue(e,m,"Opening handshake has timed out")}),m.on("error",v=>{m===null||m[cs]||(m=e._req=null,jt(e,v))}),m.on("response",v=>{let O=v.headers.location,R=v.statusCode;if(O&&i.followRedirects&&R>=300&&R<400){if(++e._redirects>i.maxRedirects){ue(e,m,"Maximum redirects exceeded");return}m.abort();let P;try{P=new Wr(O,t)}catch{let L=new SyntaxError(`Invalid URL: ${O}`);jt(e,L);return}us(e,P,r,n)}else e.emit("unexpected-response",m,v)||ue(e,m,`Unexpected server response: ${v.statusCode}`)}),m.on("upgrade",(v,O,R)=>{if(e.emit("upgrade",v),e.readyState!==W.CONNECTING)return;m=e._req=null;let P=v.headers.upgrade;if(P===void 0||P.toLowerCase()!=="websocket"){ue(e,O,"Invalid Upgrade header");return}let Y=sa("sha1").update(h+ca).digest("base64");if(v.headers["sec-websocket-accept"]!==Y){ue(e,O,"Invalid Sec-WebSocket-Accept header");return}let L=v.headers["sec-websocket-protocol"],z;if(L!==void 0?d.size?d.has(L)||(z="Server sent an invalid subprotocol"):z="Server sent a subprotocol but none was requested":d.size&&(z="Server sent no subprotocol"),z){ue(e,O,z);return}L&&(e._protocol=L);let J=v.headers["sec-websocket-extensions"];if(J!==void 0){if(!l){ue(e,O,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let V;try{V=ma(J)}catch{ue(e,O,"Invalid Sec-WebSocket-Extensions header");return}let A=Object.keys(V);if(A.length!==1||A[0]!==Ne.extensionName){ue(e,O,"Server indicated an extension that was not requested");return}try{l.accept(V[Ne.extensionName])}catch{ue(e,O,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Ne.extensionName]=l}e.setSocket(O,R,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(m,e):m.end()}function jt(e,t){e._readyState=W.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}function _a(e){return e.path=e.socketPath,as.connect(e)}function xa(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=as.isIP(e.host)?"":e.host),na.connect(e)}function ue(e,t,r){e._readyState=W.CLOSING;let n=new Error(r);Error.captureStackTrace(n,ue),t.setHeader?(t[cs]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(jt,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}function Hr(e,t,r){if(t){let n=la(t)?t.size:ga(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Ce[e.readyState]})`);process.nextTick(r,n)}}function wa(e,t){let r=this[X];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[X]!==void 0&&(r._socket.removeListener("data",Wt),process.nextTick(fs,r._socket),e===1005?r.close():r.close(e,t))}function va(){let e=this[X];e.isPaused||e._socket.resume()}function Ea(e){let t=this[X];t._socket[X]!==void 0&&(t._socket.removeListener("data",Wt),process.nextTick(fs,t._socket),t.close(e[fa])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}function os(){this[X].emitClose()}function Sa(e,t){this[X].emit("message",e,t)}function Ta(e){let t=this[X];t._autoPong&&t.pong(e,!this._isServer,ls),t.emit("ping",e)}function Oa(e){this[X].emit("pong",e)}function fs(e){e.resume()}function La(e){let t=this[X];t.readyState!==W.CLOSED&&(t.readyState===W.OPEN&&(t._readyState=W.CLOSING,hs(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}function hs(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),ya)}function ds(){let e=this[X];this.removeListener("close",ds),this.removeListener("data",Wt),this.removeListener("end",ps),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",os),e._receiver.on("finish",os))}function Wt(e){this[X]._receiver.write(e)||this.pause()}function ps(){let e=this[X];e._readyState=W.CLOSING,e._receiver.end(),this.end()}function ms(){let e=this[X];this.removeListener("error",ms),this.on("error",ls),e&&(e._readyState=W.CLOSING,this.destroy())}});var bs=F((Of,ys)=>{"use strict";f();var{tokenChars:ka}=Ke();function Ca(e){let t=new Set,r=-1,n=-1,i=0;for(i;i<e.length;i++){let o=e.charCodeAt(i);if(n===-1&&ka[o]===1)r===-1&&(r=i);else if(i!==0&&(o===32||o===9))n===-1&&r!==-1&&(n=i);else if(o===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${i}`);n===-1&&(n=i);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let s=e.slice(r,i);if(t.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return t.add(s),t}ys.exports={parse:Ca}});var Ts=F((Cf,Ss)=>{"use strict";f();var Ra=G("events"),Vt=G("http"),{Duplex:kf}=G("stream"),{createHash:Ba}=G("crypto"),_s=jr(),qe=gt(),Da=bs(),$a=Qr(),{GUID:Aa,kWebSocket:Na}=Oe(),Ia=/^[+/0-9A-Za-z]{22}==$/,xs=0,ws=1,Es=2,Yr=class extends Ra{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:$a,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Vt.createServer((n,i)=>{let s=Vt.STATUS_CODES[426];i.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),i.end(s)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=Pa(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,s,o)=>{this.handleUpgrade(i,s,o,n)}})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=xs}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===Es){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(xt,this);return}if(t&&this.once("close",t),this._state!==ws)if(this._state=ws,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(xt,this):process.nextTick(xt,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{xt(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,i){r.on("error",vs);let s=t.headers["sec-websocket-key"],o=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Ge(this,t,r,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){Ge(this,t,r,400,"Invalid Upgrade header");return}if(s===void 0||!Ia.test(s)){Ge(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==8&&c!==13){Ge(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(t)){wt(r,400);return}let a=t.headers["sec-websocket-protocol"],u=new Set;if(a!==void 0)try{u=Da.parse(a)}catch{Ge(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let h=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&h!==void 0){let d=new qe(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let l=_s.parse(h);l[qe.extensionName]&&(d.accept(l[qe.extensionName]),p[qe.extensionName]=d)}catch{Ge(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let d={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(d,(l,m,v,O)=>{if(!l)return wt(r,m||401,v,O);this.completeUpgrade(p,s,u,t,r,n,i)});return}if(!this.options.verifyClient(d))return wt(r,401)}this.completeUpgrade(p,s,u,t,r,n,i)}completeUpgrade(t,r,n,i,s,o,c){if(!s.readable||!s.writable)return s.destroy();if(s[Na])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>xs)return wt(s,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ba("sha1").update(r+Aa).digest("base64")}`],h=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,i):n.values().next().value;p&&(u.push(`Sec-WebSocket-Protocol: ${p}`),h._protocol=p)}if(t[qe.extensionName]){let p=t[qe.extensionName].params,d=_s.format({[qe.extensionName]:[p]});u.push(`Sec-WebSocket-Extensions: ${d}`),h._extensions=t}this.emit("headers",u,i),s.write(u.concat(`\r
2
+ `).join(`\r
3
+ `)),s.removeListener("error",vs),h.setSocket(s,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(h),h.on("close",()=>{this.clients.delete(h),this._shouldEmitClose&&!this.clients.size&&process.nextTick(xt,this)})),c(h,i)}};Ss.exports=Yr;function Pa(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function xt(e){e._state=Es,e.emit("close")}function vs(){this.destroy()}function wt(e,t,r,n){r=r||Vt.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Vt.STATUS_CODES[t]}\r
4
+ `+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
5
+ `)+`\r
6
+ \r
7
+ `+r)}function Ge(e,t,r,n,i){if(e.listenerCount("wsClientError")){let s=new Error(i);Error.captureStackTrace(s,Ge),e.emit("wsClientError",s,r,t)}else wt(r,n,i)}});f();f();var N="\x1B[",it="\x1B]",Ve="\x07",Ot=";",hn=process.env.TERM_PROGRAM==="Apple_Terminal",$={};$.cursorTo=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof t!="number"?N+(e+1)+"G":N+(t+1)+";"+(e+1)+"H"};$.cursorMove=(e,t)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let r="";return e<0?r+=N+-e+"D":e>0&&(r+=N+e+"C"),t<0?r+=N+-t+"A":t>0&&(r+=N+t+"B"),r};$.cursorUp=(e=1)=>N+e+"A";$.cursorDown=(e=1)=>N+e+"B";$.cursorForward=(e=1)=>N+e+"C";$.cursorBackward=(e=1)=>N+e+"D";$.cursorLeft=N+"G";$.cursorSavePosition=hn?"\x1B7":N+"s";$.cursorRestorePosition=hn?"\x1B8":N+"u";$.cursorGetPosition=N+"6n";$.cursorNextLine=N+"E";$.cursorPrevLine=N+"F";$.cursorHide=N+"?25l";$.cursorShow=N+"?25h";$.eraseLines=e=>{let t="";for(let r=0;r<e;r++)t+=$.eraseLine+(r<e-1?$.cursorUp():"");return e&&(t+=$.cursorLeft),t};$.eraseEndLine=N+"K";$.eraseStartLine=N+"1K";$.eraseLine=N+"2K";$.eraseDown=N+"J";$.eraseUp=N+"1J";$.eraseScreen=N+"2J";$.scrollUp=N+"S";$.scrollDown=N+"T";$.clearScreen="\x1Bc";$.clearTerminal=process.platform==="win32"?`${$.eraseScreen}${N}0f`:`${$.eraseScreen}${N}3J${N}H`;$.beep=Ve;$.link=(e,t)=>[it,"8",Ot,Ot,t,Ve,e,it,"8",Ot,Ot,Ve].join("");$.image=(e,t={})=>{let r=`${it}1337;File=inline=1`;return t.width&&(r+=`;width=${t.width}`),t.height&&(r+=`;height=${t.height}`),t.preserveAspectRatio===!1&&(r+=";preserveAspectRatio=0"),r+":"+e.toString("base64")+Ve};$.iTerm={setCwd:(e=process.cwd())=>`${it}50;CurrentDir=${e}${Ve}`,annotation:(e,t={})=>{let r=`${it}1337;`,n=typeof t.x<"u",i=typeof t.y<"u";if((n||i)&&!(n&&i&&typeof t.length<"u"))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replace(/\|/g,""),r+=t.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",t.length>0?r+=(n?[e,t.length,t.x,t.y]:[t.length,e]).join("|"):r+=e,r+Ve}};var dn=$;var Lt=oe(_n(),1);function ge(e,t,{target:r="stdout",...n}={}){return Lt.default[r]?dn.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}ge.isSupported=Lt.default.stdout;ge.stderr=(e,t,r={})=>ge(e,t,{target:"stderr",...r});ge.stderr.isSupported=Lt.default.stderr;f();import{randomUUID as $s}from"node:crypto";f();var xn=oe(Ht(),1);import nr from"node:os";var ye,wn=async(e,t)=>{t["--telemetry"]&&(ye=await import("./esm-46TFUFSK.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"}))},vn=async e=>{ye&&(ye.captureException(e,{event_id:e.id,captureContext:{tags:{arch:q.arch,bug:e.isBug,environment:me.value,platform:q.platform,shell:q.shell,version:We.version},contexts:{ctx:{argv:process.argv},cause:e.cause?ce(e.cause):void 0,app:{app_name:We.name,app_version:We.version},device:{name:nr.hostname(),family:nr.type(),arch:nr.arch()},runtime:{name:process.release.name,version:process.version}}}}),await ye.flush((0,xn.default)("2s")))},En=e=>{ye&&ye.addBreadcrumb(e)},ol=e=>{ye&&ye.setUser(e)},al=e=>{ye&&ye.setTags(e)};var As=async(e,t)=>{if(tn(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 vn(r)}finally{process.exit(1)}},xl=async(e,t)=>{e.log.debug("installing error handlers"),await wn(e,t);let r=n=>void As(e,n);process.once("uncaughtException",r),process.once("unhandledRejection",r)},Ie=Object.freeze({YES:"yes",NO:"no",MAYBE:"maybe"}),Pe=class e extends Error{id=me.testLike?"00000000-0000-0000-0000-000000000000":$s();cause;stack;constructor(t){super(t),Error.captureStackTrace(this,this.constructor),this.stack=Zr(this.stack,{pretty:!0,basePath:sn})}static from(t){return t instanceof e?t:new ir(t)}sprint(){let t=this.render();if(this.isBug!==Ie.NO){t=Tt(t);let r=this.isBug===Ie.YES?"This is a bug":"If you think this is a bug",n=`https://github.com/gadget-inc/ggt/issues/new?template=bug_report.yml&error-id=${this.id}`;ge.isSupported?t+=Tt({ensureEmptyLineAbove:!0,content:xe`
8
+ ${r}, ${ge("click here",n)} to create an issue on GitHub.
9
+ `}):t+=Tt({ensureEmptyLineAbove:!0,content:xe`
10
+ ${r}, use the link below to create an issue on GitHub.
11
+
12
+ ${n}
13
+ `})}return t}print(t){ln({ensureEmptyLineAbove:!0,...t,content:this.sprint()})}},ir=class extends Pe{constructor(r){super("An unexpected error occurred");this.cause=r}isBug=Ie.YES;render(){let r=ce(this.cause),n=r.stack||r.message||this.stack;return this.message+`.
14
+
15
+ `+n}},Sn=class extends Pe{constructor(r,n){super(r);this.cause=n}isBug=Ie.MAYBE;render(){return this.message}};f();f();f();import Tn from"node:process";function st(){let{env:e}=Tn,{TERM:t,TERM_PROGRAM:r}=e;return Tn.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var On={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"},Ln={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"},Ns={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},sr={...On,...Ln},Is={...On,...Ns},Ps=st(),Ms=Ps?sr:Is,kn=Ms,Ll=Object.entries(Ln);var or={...me.testLike?sr:kn};if(st()&&q.windowsOrWsl)for(let e of["tick","cross"])or[e]+=" ";f();var ur=oe(Dn(),1);import Gs from"node:assert";var ql=e=>e.filter(t=>!!t),$n=e=>[...new Set(e)],Gl=(e,t)=>(Gs(t.length>0,"options must not be empty"),[...t].sort((r,n)=>ur.default.get(r,e)-ur.default.get(n,e)));f();var Nn=oe(An(),1);import js from"node:assert";var Be=class extends Pe{constructor(r,n){super("An error occurred while communicating with Gadget");this.request=r;Jt(n)?this.cause={type:n.type,message:n.message,error:ce(n.error)}:Yt(n)?this.cause={type:n.type,code:n.code,reason:n.reason,wasClean:n.wasClean}:(js(St(n)||Qt(n)||Kt(n),"cause must be a string, Error, GraphQLError[], CloseEvent, or ErrorEvent"),this.cause=n)}isBug=Ie.MAYBE;cause;render(){let r="";switch(!0){case Kt(this.cause):{let n=$n(this.cause.map(i=>i.message));r=xe`
16
+ Gadget responded with the following ${(0,Nn.default)("error",n.length,!1)}:
17
+
18
+ • ${n.join(`
19
+ \u2022 `)}
20
+ `;break}case Yt(this.cause):r="The connection to Gadget closed unexpectedly.";break;case(Jt(this.cause)||Qt(this.cause)):r=this.cause.message;break;default:r=this.cause;break}return this.message+`
21
+
22
+ `+r}};f();f();import Ws from"node:assert";var In=e=>e.url instanceof URL&&e.url.host===q.domains.services,Vs=e=>{let t=cn(e);return t&&`session=${encodeURIComponent(t)};`},dr=e=>{let t=at(e);return Ws(t,"missing auth headers"),t},at=e=>{let t=Vs(e);if(t)return e.log.trace("using cookie as auth header",{},{cookie:t}),{cookie:t};let r=fn(e);if(r)return e.log.trace("using token as auth header",{},{token:r}),{"x-platform-access-token":r}},zs=e=>e instanceof rn&&e.response.statusCode===401,sc=(e,t)=>{if(zs(t)){e.log.warn("swallowing unauthorized error",{error:t});return}throw t};f();var hi=oe(Ht(),1);import fo from"node:assert";import{Agent as ho}from"node:http";import{Agent as po}from"node:https";f();f();f();import lo from"node:assert";f();f();var Pn=(e,t,r,n)=>JSON.stringify({level:e,name:t,msg:Zt(r).trim(),fields:Mn(n)})+`
23
+ `,Mn=e=>{let t={};for(let[r,n]of Object.entries(e))t[r]=Un(n);return t},Un=e=>(e instanceof Set&&(e=Array.from(e)),Array.isArray(e)?e.map(Un):(e instanceof Map&&(e=Object.fromEntries(e.entries())),je(e)?Mn(e):St(e)?Zt(e).trim():e));f();var gr=oe(Cn(),1);import eo from"node:assert";f();var ii=oe(ni(),1),si=e=>{let t=ii.default.stringify(e);return t?`?${t}`:""};f();var C=new Jr({level:me.testLike&&q.logLevel<j.PRINT?3:Kr.level}),I={error:C.red,success:C.green,warn:C.yellow,link:C.cyan,highlighted:C.magentaBright,examplesQuestions:C.cyanBright,subdued:C.blackBright,body:C.whiteBright,black:C.black,blackBright:C.blackBright,red:C.red,redBright:C.redBright,green:C.green,greenBright:C.greenBright,yellow:C.yellow,yellowBright:C.yellowBright,blue:C.blue,blueBright:C.blueBright,magenta:C.magenta,magentaBright:C.magentaBright,cyan:C.cyan,cyanBright:C.cyanBright,white:C.white,whiteBright:C.whiteBright,bgBlack:C.bgBlack,bgBlackBright:C.bgBlackBright,bgRed:C.bgRed,bgRedBright:C.bgRedBright,bgGreen:C.bgGreen,bgGreenBright:C.bgGreenBright,bgYellow:C.bgYellow,bgYellowBright:C.bgYellowBright,bgBlue:C.bgBlue,bgBlueBright:C.bgBlueBright,bgMagenta:C.bgMagenta,bgMagentaBright:C.bgMagentaBright,bgCyan:C.bgCyan,bgCyanBright:C.bgCyanBright,bgWhite:C.bgWhite,bgWhiteBright:C.bgWhiteBright,reset:C.reset};var li=(e,t,r,n,i,s)=>`${io(i)} ${so(e)} ${oo(t)}:${ao(r)}${ci(n,{indent:2,timestamp:i,environment:s})}${Se}`,Qe="",$e=" ",Se=`
24
+ `,to=":",oi="'",ai=(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(to)),n.join("")},De=(e,t,r)=>{if(!e)return Qe;let n=e.split(Se);if(n.length===0)return Qe;let i=[],s=n.shift();eo(!en(s),"first line is nil"),i.push(t(s));for(let o of n)if(o){i.push(Se);for(let c=0;c<r;c++)i.push($e);i.push(t(o))}return i.join(Qe)},ro=(e,t)=>{let r="";return t&&(r=si(t)),`https://${e.application.slug}--${e.name}.${q.domains.app}/edit/logs${r}`},no=e=>e?`{environment_id="${e.id.toString()}"} | json | level=~"info|warn|error"`:'{environment_id=~".+"} | json | level=~"info|warn|error"',ci=(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(ai("trace_id",r)),s.push($e),n&&i&&ge.isSupported?s.push(ge(I.link(e.trace_id),ro(n,{timeRange:`${i.toISOString()} to now`,logql:`${no(n)} | trace_id="${e.trace_id}"`}))):s.push(I.link(e.trace_id)));for(let[o,c]of Object.entries(e))if(o!=="trace_id"){if(s.push(ai(o,r)),c instanceof Set&&(c=Array.from(c)),Array.isArray(c)){if(c.length===0){s.push(De(" []",I.subdued,r));continue}c=Object.fromEntries(c.entries())}if(c instanceof Map&&(c=Object.fromEntries(c)),je(c)){let a=Object.entries(c);if(a.length===0){s.push(De(" {}",I.subdued,r));continue}a.length>10&&q.logLevel>j.TRACE&&!n&&(c=Object.fromEntries([...a.slice(0,10),[or.ellipsis,`${a.length-10} more`]])),s.push(ci(c,{indent:r+2,environment:n}));continue}if(s.push($e),n)s.push(De(String(c),I.reset,r));else switch(typeof c){case"string":s.push(De(oi+c.replaceAll(Se,Se+$e.repeat(r+o.length))+oi,I.reset,r));break;case"number":s.push(De(String(c),I.yellowBright,r));break;case"bigint":s.push(De(String(c)+"n",I.yellowBright,r));break;case"boolean":s.push(De(String(c),I.green,r));break;default:s.push(De(String(c),I.reset,r));break}}return s.join(Qe)},io=e=>(e?(0,gr.default)(e):(0,gr.default)()).format("hh:mm:ss"),so=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 "))}},oo=e=>I.body(e),ao=e=>{if(!e)return Qe;let t=e.split(Se);return t.length===1?$e+I.body(e):Se+t.map(r=>$e+$e+r).join(Se)};var yr={pretty:li,json:Pn};var eu={"--log-level":{type:e=>an(e,j.INFO),alias:["-ll"],default:j.INFO},"--my-logs":{type:Boolean}},co={trace:j.TRACE,debug:j.DEBUG,info:j.INFO,warn:j.WARN,error:j.ERROR},tu=e=>(t,r,n,i,s)=>{let o={...i};"error"in o&&(o.error=ce(o.error)),"reason"in o&&(o.reason=ce(o.reason));let c=yr[q.logFormat],a=co[t.toLowerCase()];lo(a,`Unknown level: ${t}`),Xt.writeStdout(c(a,r,n,o,s,e))},ui=({name:e,fields:t={},devFields:r={}})=>{let n=i=>(s,o,c)=>{let a=i>=q.logLevel,u=i>=j.INFO;if(!a&&!u)return;let h={...ae(t),...o};if(me.developmentOrTestLike&&Object.assign(h,ae(r),c),"error"in h&&(h.error=ce(h.error)),"reason"in h&&(h.reason=ce(h.reason)),a){let p=yr[q.logFormat];Xt.writeStderr(p(i,e,s,h))}u&&En({level:"log",message:s,data:h})};return{trace:n(j.TRACE),debug:n(j.DEBUG),info:n(j.INFO),warn:n(j.WARN),error:n(j.ERROR)}};var br=({name:e,fields:t,devFields:r})=>({...ui({name:e,fields:t,devFields:r}),child:({name:n,fields:i,devFields:s})=>br({name:n||e,fields:()=>({...ae(t),...ae(i)}),devFields:{...ae(r),...ae(s)}})});f();var fi=oe(Ht(),1);import{setTimeout as uo}from"node:timers/promises";var cu=(e,t)=>uo((0,fi.default)(e),void 0,t),_r=class{resolution;rejection;pendingPromise;constructor(t){this.pendingPromise=t,t.then(r=>(this.resolution=r,r)).catch(r=>{this.rejection=r}).finally(()=>{delete this.pendingPromise})}async unwrap(){if(this.pendingPromise)return await this.pendingPromise;if(this.rejection)throw this.rejection;return this.resolution}},kt=class{[Symbol.toStringTag];resolve;reject;_promise;constructor(){this._promise=new _r(new Promise((t,r)=>{this.resolve=t,this.reject=r})),this[Symbol.toStringTag]=String(this._promise.pendingPromise)}then(t,r){return this._promise.unwrap().then(t,r)}catch(t){return this._promise.unwrap().catch(t)}finally(t){return this._promise.unwrap().finally(t)}};var Ct=class e extends AbortController{done=new kt;#e;#i=[];constructor({log:t}){super(),this.#e=t,this.abort=this.abort.bind(this),this.child=this.child.bind(this),this.onAbort=this.onAbort.bind(this),this.signal.addEventListener("abort",async()=>{let r;for(let n of this.#i.reverse())try{await n(this.signal.reason)}catch(i){r??=i,this.log.error("error during abort",{error:r})}r?this.done.reject(r):this.done.resolve()})}get log(){return this.#e}static init(t){return new e({log:br(t)})}child(t){let r=new e({log:this.log.child(t)});return this.onAbort(()=>r.abort()),r}onAbort(t){this.#i.push(t)}};var xr=e=>(fo(e.context?.ctx instanceof Ct,xe(`
25
+ ctx must be provided to http requests:
26
+
27
+ const response = await http({
28
+ context: { ctx },
29
+ ...options,
30
+ });
31
+ `)),e.context.ctx),Rt=nn.extend({agent:{http:new ho({keepAlive:!0}),https:new po({keepAlive:!0})},retry:{limit:10,methods:["GET","PUT","HEAD","DELETE","OPTIONS","TRACE"],statusCodes:[408,413,429,500,502,503,504,521,522,524],errorCodes:["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN","EADDRNOTAVAIL","EHOSTUNREACH"],maxRetryAfter:void 0,calculateDelay:({computedValue:e})=>e,backoffLimit:(0,hi.default)("5s"),noise:100},hooks:{beforeRequest:[e=>{let t=xr(e);e.signal=t.signal,e.headers["user-agent"]=q.versionFull,t.log.debug("http request",{http:{request:{method:e.method,url:e.url?.toString()}}})}],beforeRetry:[(e,t)=>{xr(e.request?.options??e.options.context).log.warn("http request failed, retrying...",{http:{retryCount:t,error:ce(e),request:e.request&&{method:e.request.options.method,url:e.request.options.url?.toString()},response:e.response&&{statusCode:e.response.statusCode,traceId:e.response.headers["x-trace-id"],durationMs:e.response.timings.phases.total}}})}],afterResponse:[e=>{let t=xr(e.request.options);return t.log.debug("http response",{http:{request:{method:e.request.options.method,url:e.request.options.url?.toString()},response:{statusCode:e.statusCode,traceId:e.headers["x-trace-id"],durationMs:e.timings.phases.total}}}),e.statusCode===401&&In(e.request.options)&&un(t,void 0),e}]}});f();import Ga from"node:assert";f();f();f();f();function ne(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Te(e){return ne(e)==="object"}function di(e){return Array.isArray(e)&&e.length>0&&e.every(t=>"message"in t)}function wr(e,t){return e.length<124?e:t}var pi="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 mi(e){if(!Te(e))throw new Error(`Message is expected to be an object, but got ${ne(e)}`);if(!e.type)throw new Error("Message is missing the 'type' property");if(typeof e.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ne(e.type)}`);switch(e.type){case Q.ConnectionInit:case Q.ConnectionAck:case Q.Ping:case Q.Pong:{if(e.payload!=null&&!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${e.payload}"`);break}case Q.Subscribe:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ne(e.payload)}`);if(typeof e.payload.query!="string")throw new Error(`"${e.type}" message payload expects the 'query' property to be a string, but got ${ne(e.payload.query)}`);if(e.payload.variables!=null&&!Te(e.payload.variables))throw new Error(`"${e.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ne(e.payload.variables)}`);if(e.payload.operationName!=null&&ne(e.payload.operationName)!=="string")throw new Error(`"${e.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ne(e.payload.operationName)}`);if(e.payload.extensions!=null&&!Te(e.payload.extensions))throw new Error(`"${e.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ne(e.payload.extensions)}`);break}case Q.Next:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!Te(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an object, but got ${ne(e.payload)}`);break}case Q.Error:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);if(!di(e.payload))throw new Error(`"${e.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(e.payload)}`);break}case Q.Complete:{if(typeof e.id!="string")throw new Error(`"${e.type}" message expects the 'id' property to be a string, but got ${ne(e.id)}`);if(!e.id)throw new Error(`"${e.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${e.type}"`)}return e}function gi(e,t){return mi(typeof e=="string"?JSON.parse(e,t):e)}function Ye(e,t){return mi(e),JSON.stringify(e,t)}var Je=function(e){return this instanceof Je?(this.v=e,this):new Je(e)},mo=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){n[d]&&(i[d]=function(l){return new Promise(function(m,v){s.push([d,l,m,v])>1||c(d,l)})})}function c(d,l){try{a(n[d](l))}catch(m){p(s[0][3],m)}}function a(d){d.value instanceof Je?Promise.resolve(d.value.v).then(u,h):p(s[0][2],d)}function u(d){c("next",d)}function h(d){c("throw",d)}function p(d,l){d(l),s.shift(),s.length&&c(s[0][0],s[0][1])}};function yi(e){let{url:t,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:s=0,keepAlive:o=0,disablePong:c,connectionAckWaitTimeout:a=0,retryAttempts:u=5,retryWait:h=async function(g){let b=1e3;for(let _=0;_<g;_++)b*=2;await new Promise(_=>setTimeout(_,b+Math.floor(Math.random()*2700+300)))},shouldRetry:p=vr,isFatalConnectionProblem:d,on:l,webSocketImpl:m,generateID:v=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,g=>{let b=Math.random()*16|0;return(g=="x"?b:b&3|8).toString(16)})},jsonMessageReplacer:O,jsonMessageReviver:R}=e,P;if(m){if(!yo(m))throw new Error("Invalid WebSocket implementation provided");P=m}else typeof WebSocket<"u"?P=WebSocket:typeof global<"u"?P=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(P=window.WebSocket||window.MozWebSocket);if(!P)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let Y=P,L=(()=>{let y=(()=>{let b={};return{on(_,E){return b[_]=E,()=>{delete b[_]}},emit(_){var E;"id"in _&&((E=b[_.id])===null||E===void 0||E.call(b,_))}}})(),g={connecting:l?.connecting?[l.connecting]:[],opened:l?.opened?[l.opened]:[],connected:l?.connected?[l.connected]:[],ping:l?.ping?[l.ping]:[],pong:l?.pong?[l.pong]:[],message:l?.message?[y.emit,l.message]:[y.emit],closed:l?.closed?[l.closed]:[],error:l?.error?[l.error]:[]};return{onMessage:y.on,on(b,_){let E=g[b];return E.push(_),()=>{E.splice(E.indexOf(_),1)}},emit(b,..._){for(let E of[...g[b]])E(..._)}}})();function z(y){let g=[L.on("error",b=>{g.forEach(_=>_()),y(b)}),L.on("closed",b=>{g.forEach(_=>_()),y(b)})]}let J,V=0,A,k=!1,te=0,rt=!1;async function S(){clearTimeout(A);let[y,g]=await(J??(J=new Promise((E,B)=>(async()=>{if(k){if(await h(te),!V)return J=void 0,B({code:1e3,reason:"All Subscriptions Gone"});te++}L.emit("connecting",k);let T=new Y(typeof t=="function"?await t():t,pi),M,K;function pe(){isFinite(o)&&o>0&&(clearTimeout(K),K=setTimeout(()=>{T.readyState===Y.OPEN&&(T.send(Ye({type:Q.Ping})),L.emit("ping",!1,void 0))},o))}z(H=>{J=void 0,clearTimeout(M),clearTimeout(K),B(H),H instanceof Bt&&(T.close(4499,"Terminated"),T.onerror=null,T.onclose=null)}),T.onerror=H=>L.emit("error",H),T.onclose=H=>L.emit("closed",H),T.onopen=async()=>{try{L.emit("opened",T);let H=typeof r=="function"?await r():r;if(T.readyState!==Y.OPEN)return;T.send(Ye(H?{type:Q.ConnectionInit,payload:H}:{type:Q.ConnectionInit},O)),isFinite(a)&&a>0&&(M=setTimeout(()=>{T.close(le.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},a)),pe()}catch(H){L.emit("error",H),T.close(le.InternalClientError,wr(H instanceof Error?H.message:new Error(H).message,"Internal client error"))}};let se=!1;T.onmessage=({data:H})=>{try{let U=gi(H,R);if(L.emit("message",U),U.type==="ping"||U.type==="pong"){L.emit(U.type,!0,U.payload),U.type==="pong"?pe():c||(T.send(Ye(U.payload?{type:Q.Pong,payload:U.payload}:{type:Q.Pong})),L.emit("pong",!1,U.payload));return}if(se)return;if(U.type!==Q.ConnectionAck)throw new Error(`First message cannot be of type ${U.type}`);clearTimeout(M),se=!0,L.emit("connected",T,U.payload,k),k=!1,te=0,E([T,new Promise((re,_e)=>z(_e))])}catch(U){T.onmessage=null,L.emit("error",U),T.close(le.BadResponse,wr(U instanceof Error?U.message:new Error(U).message,"Bad response"))}}})())));y.readyState===Y.CLOSING&&await g;let b=()=>{},_=new Promise(E=>b=E);return[y,b,Promise.race([_.then(()=>{if(!V){let E=()=>y.close(1e3,"Normal Closure");isFinite(s)&&s>0?A=setTimeout(()=>{y.readyState===Y.OPEN&&E()},s):E()}}),g])]}function w(y){if(vr(y)&&(go(y.code)||[le.InternalServerError,le.InternalClientError,le.BadRequest,le.BadResponse,le.Unauthorized,le.SubprotocolNotAcceptable,le.SubscriberAlreadyExists,le.TooManyInitialisationRequests].includes(y.code)))throw y;if(rt)return!1;if(vr(y)&&y.code===1e3)return V>0;if(!u||te>=u||!p(y)||d?.(y))throw y;return k=!0}n||(async()=>{for(V++;;)try{let[,,y]=await S();await y}catch(y){try{if(!w(y))return}catch(g){return i?.(g)}}})();function x(y,g){let b=v(y),_=!1,E=!1,B=()=>{V--,_=!0};return(async()=>{for(V++;;)try{let[T,M,K]=await S();if(_)return M();let pe=L.onMessage(b,se=>{switch(se.type){case Q.Next:{g.next(se.payload);return}case Q.Error:{E=!0,_=!0,g.error(se.payload),B();return}case Q.Complete:{_=!0,B();return}}});T.send(Ye({id:b,type:Q.Subscribe,payload:y},O)),B=()=>{!_&&T.readyState===Y.OPEN&&T.send(Ye({id:b,type:Q.Complete},O)),V--,_=!0,M()},await K.finally(pe);return}catch(T){if(!w(T))return}})().then(()=>{E||g.complete()}).catch(T=>{g.error(T)}),()=>{_||B()}}return{on:L.on,subscribe:x,iterate(y){let g=[],b={done:!1,error:null,resolve:()=>{}},_=x(y,{next(B){g.push(B),b.resolve()},error(B){b.done=!0,b.error=B,b.resolve()},complete(){b.done=!0,b.resolve()}}),E=function(){return mo(this,arguments,function*(){for(;;){for(g.length||(yield Je(new Promise(M=>b.resolve=M)));g.length;)yield yield Je(g.shift());if(b.error)throw b.error;if(b.done)return yield Je(void 0)}})}();return E.throw=async B=>(b.done||(b.done=!0,b.error=B,b.resolve()),{done:!0,value:void 0}),E.return=async()=>(_(),{done:!0,value:void 0}),E},async dispose(){if(rt=!0,J){let[y]=await J;y.close(1e3,"Normal Closure")}},terminate(){J&&L.emit("closed",new Bt)}}}var Bt=class extends Error{constructor(){super(...arguments),this.name="TerminatedCloseEvent",this.message="4499: Terminated",this.code=4499,this.reason="Terminated",this.wasClean=!1}};function vr(e){return Te(e)&&"code"in e&&"reason"in e}function go(e){return[1e3,1001,1006,1005,1012,1013,1014].includes(e)?!1:e>=1e3&&e<=1999}function yo(e){return typeof e=="function"&&"constructor"in e&&"CLOSED"in e&&"CLOSING"in e&&"CONNECTING"in e&&"OPEN"in e}f();f();var Sr=oe(_i(),1);f();var ut=class extends Error{constructor(t){super(t),this.name="TimeoutError"}},Tr=class extends Error{constructor(t){super(),this.name="AbortError",this.message=t}},xi=e=>globalThis.DOMException===void 0?new Tr(e):new DOMException(e),wi=e=>{let t=e.reason===void 0?xi("This operation was aborted."):e.reason;return t instanceof Error?t:xi(t)};function Or(e,t){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=t,o,a=new Promise((u,h)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(t.signal){let{signal:d}=t;d.aborted&&h(wi(d)),d.addEventListener("abort",()=>{h(wi(d))})}if(r===Number.POSITIVE_INFINITY){e.then(u,h);return}let p=new ut;o=s.setTimeout.call(void 0,()=>{if(n){try{u(n())}catch(d){h(d)}return}typeof e.cancel=="function"&&e.cancel(),i===!1?u():i instanceof Error?h(i):(p.message=i??`Promise timed out after ${r} milliseconds`,h(p))},r),(async()=>{try{u(await e)}catch(d){h(d)}})()}).finally(()=>{a.clear()});return a.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},a}f();f();function Lr(e,t,r){let n=0,i=e.length;for(;i>0;){let s=Math.trunc(i/2),o=n+s;r(e[o],t)<=0?(n=++o,i-=s+1):i=s}return n}var ft=class{#e=[];enqueue(t,r){r={priority:0,...r};let n={priority:r.priority,run:t};if(this.size&&this.#e[this.size-1].priority>=r.priority){this.#e.push(n);return}let i=Lr(this.#e,n,(s,o)=>o.priority-s.priority);this.#e.splice(i,0,n)}dequeue(){return this.#e.shift()?.run}filter(t){return this.#e.filter(r=>r.priority===t.priority).map(r=>r.run)}get size(){return this.#e.length}};var ht=class extends Sr.default{#e;#i;#o=0;#d;#a;#p=0;#r;#l;#t;#m;#n=0;#c;#s;#g;timeout;constructor(t){if(super(),t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:ft,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${t.intervalCap?.toString()??""}\` (${typeof t.intervalCap})`);if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${t.interval?.toString()??""}\` (${typeof t.interval})`);this.#e=t.carryoverConcurrencyCount,this.#i=t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0,this.#d=t.intervalCap,this.#a=t.interval,this.#t=new t.queueClass,this.#m=t.queueClass,this.concurrency=t.concurrency,this.timeout=t.timeout,this.#g=t.throwOnTimeout===!0,this.#s=t.autoStart===!1}get#_(){return this.#i||this.#o<this.#d}get#x(){return this.#n<this.#c}#w(){this.#n--,this.#u(),this.emit("next")}#v(){this.#b(),this.#y(),this.#l=void 0}get#E(){let t=Date.now();if(this.#r===void 0){let r=this.#p-t;if(r<0)this.#o=this.#e?this.#n:0;else return this.#l===void 0&&(this.#l=setTimeout(()=>{this.#v()},r)),!0}return!1}#u(){if(this.#t.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#n===0&&this.emit("idle"),!1;if(!this.#s){let t=!this.#E;if(this.#_&&this.#x){let r=this.#t.dequeue();return r?(this.emit("active"),r(),t&&this.#y(),!0):!1}}return!1}#y(){this.#i||this.#r!==void 0||(this.#r=setInterval(()=>{this.#b()},this.#a),this.#p=Date.now()+this.#a)}#b(){this.#o===0&&this.#n===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#o=this.#e?this.#n:0,this.#f()}#f(){for(;this.#u(););}get concurrency(){return this.#c}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${t}\` (${typeof t})`);this.#c=t,this.#f()}async#S(t){return new Promise((r,n)=>{t.addEventListener("abort",()=>{n(t.reason)},{once:!0})})}async add(t,r={}){return r={timeout:this.timeout,throwOnTimeout:this.#g,...r},new Promise((n,i)=>{this.#t.enqueue(async()=>{this.#n++,this.#o++;try{r.signal?.throwIfAborted();let s=t({signal:r.signal});r.timeout&&(s=Or(Promise.resolve(s),{milliseconds:r.timeout})),r.signal&&(s=Promise.race([s,this.#S(r.signal)]));let o=await s;n(o),this.emit("completed",o)}catch(s){if(s instanceof ut&&!r.throwOnTimeout){n();return}i(s),this.emit("error",s)}finally{this.#w()}},r),this.emit("add"),this.#u()})}async addAll(t,r){return Promise.all(t.map(async n=>this.add(n,r)))}start(){return this.#s?(this.#s=!1,this.#f(),this):this}pause(){this.#s=!0}clear(){this.#t=new this.#m}async onEmpty(){this.#t.size!==0&&await this.#h("empty")}async onSizeLessThan(t){this.#t.size<t||await this.#h("next",()=>this.#t.size<t)}async onIdle(){this.#n===0&&this.#t.size===0||await this.#h("idle")}async#h(t,r){return new Promise(n=>{let i=()=>{r&&!r()||(this.off(t,i),n())};this.on(t,i)})}get size(){return this.#t.size}sizeBy(t){return this.#t.filter(t).length}get pending(){return this.#n}get isPaused(){return this.#s}};f();var Ma=oe(Ti(),1),Ua=oe(Mr(),1),Fa=oe(qr(),1),Os=oe(Qr(),1),qa=oe(Ts(),1);var Ls=Os.default;var zt=class{constructor(t,r,n){this.environment=r;this.endpoint=n;this.ctx=t.child({name:"client"}),this._graphqlWsClient=yi({url:`wss://${r.application.slug}.${q.domains.app}/edit/api/graphql-ws`,shouldRetry:()=>!0,connectionParams:{environment:r.name},webSocketImpl:class extends Ls{constructor(i,s,o){super(i,s,{signal:t.signal,...o,headers:{...o?.headers,"user-agent":q.versionFull,...dr(t)}})}},on:{connecting:()=>{switch(this.status){case 1:this.status=2,this.ctx.log.info("reconnecting");break;case 2:this.ctx.log.info("retrying");break;default:this.ctx.log.debug("connecting");break}},connected:()=>{this.status===2?this.ctx.log.info("reconnected"):this.ctx.log.debug("connected"),setImmediate(()=>this.status=0)},closed:()=>{this.status=1,this.ctx.log.debug("disconnected")},error:i=>{this.status===2?this.ctx.log.error("failed to reconnect",{error:i}):this.ctx.log.error("connection error",{error:i})}}})}status=0;ctx;_graphqlWsClient;subscribe(t,{subscription:r,variables:n,onResponse:i,onError:s,onComplete:o=on}){let c={query:r,variables:ae(n)},a=this._graphqlWsClient.on("connected",()=>{this.status===2&&(c.variables=ae(n),t.log.info("re-subscribing to graphql subscription"))}),u=new ht({concurrency:1}),h=d=>s(new Be(r,d)),p=this._graphqlWsClient.subscribe(c,{next:d=>void u.add(()=>i(d)).catch(h),error:d=>void u.add(()=>h(d)),complete:()=>void u.add(()=>o()).catch(h)});return()=>{t.log.trace("unsubscribing from graphql subscription"),a(),u.clear(),p()}}async execute(t,r){let n=this.environment.application.slug;this.environment.application.multiEnvironmentEnabled?n+=`--${this.environment.name}`:this.environment.application.hasSplitEnvironments&&(n+="--development");try{let i=await Rt({context:{ctx:t},method:"POST",url:`https://${n}.${q.domains.app}${this.endpoint}`,headers:{...dr(t),"x-gadget-environment":this.environment.name},json:{query:r.operation,variables:ae(r.variables)},responseType:"json",resolveBodyOnly:!0,throwHttpErrors:!1,...r.http});if(!je(i)||!("data"in i)&&!("errors"in i))throw t.log.error("received invalid graphql response",{error:i}),i;return i}catch(i){throw new Be(r.operation,i)}}async dispose(){await this._graphqlWsClient.dispose()}};var vt=class{ctx;#e;constructor(t,r){this.ctx=t.child({name:"api"}),this.#e=new zt(this.ctx,r,"/api/graphql")}async query({query:t,variables:r,...n}){let i=/query (\w+)/.exec(t)?.[1];Ga(i,"query name not found");let s=this.ctx.child({name:"api",fields:{edit:{query:i}},devFields:{edit:{query:i,variables:ae(r)}}});s.log.info("executing graphql query");let o=await this.#e.execute(s,{operation:t,variables:r,...n,http:{retry:{methods:["POST"]},...n.http}});if(o.errors)throw new Be(t,o.errors);if(!o.data)throw new Be(t,"Query response did not contain data");return o.data}async dispose(){await this.#e.dispose()}};f();var ks=xe(`
32
+ query GadgetMetaModels {
33
+ gadgetMeta {
34
+ models {
35
+ apiIdentifier
36
+ namespace
37
+ }
38
+ }
39
+ }
40
+ `),Cs=xe(`
41
+ query GadgetMetaGlobalActions {
42
+ gadgetMeta {
43
+ globalActions {
44
+ apiIdentifier
45
+ namespace
46
+ }
47
+ }
48
+ }
49
+ `);var ja=Object.freeze({Development:"development",Production:"production",Test:"test"}),Wa=D.object({id:D.union([D.string(),D.number(),D.bigint()]).transform(e=>BigInt(e)),name:D.string().transform(e=>e.toLowerCase()),type:D.nativeEnum(ja)}),Va=D.object({id:D.union([D.string(),D.number(),D.bigint()]).transform(e=>BigInt(e)),slug:D.string(),primaryDomain:D.string(),hasSplitEnvironments:D.boolean(),multiEnvironmentEnabled:D.boolean(),environments:D.array(Wa),team:D.object({id:D.union([D.string(),D.number(),D.bigint()]).transform(e=>BigInt(e)),name:D.string()})}),oh=D.object({apiIdentifier:D.string(),namespace:D.nullable(D.array(D.string())).optional()}),ah=D.object({apiIdentifier:D.string(),namespace:D.nullable(D.array(D.string())).optional()}),lh=async e=>{let t=at(e);if(!t)return[];let r=await Rt({context:{ctx:e},url:`https://${q.domains.services}/auth/api/apps`,headers:{...t},responseType:"json",resolveBodyOnly:!0});return D.array(Va).parse(r)},ch=e=>e.reduce((t,r)=>(t.set(r.team.name,[...t.get(r.team.name)??[],r]),t),new Map),uh=async(e,t)=>{if(!at(e))return[];let n=new vt(e,t),{gadgetMeta:i}=await n.query({query:ks});return i.models},fh=async(e,t)=>{if(!at(e))return[];let n=new vt(e,t),{gadgetMeta:i}=await n.query({query:Cs});return i.globalActions};export{ge as a,ol as b,al as c,As as d,xl as e,Ie as f,Pe as g,ir as h,Sn as i,or as j,Cn as k,An as l,ql as m,$n as n,Gl as o,Be as p,ht as q,at as r,sc as s,zt as t,ja as u,lh as v,ch as w,uh as x,fh as y,I as z,eu as A,tu as B,cu as C,Ct as D,Rt as E};
50
+ //# sourceMappingURL=chunk-RIIVR43B.js.map