@hype-stack/cli 0.5.9 → 0.5.11

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.
@@ -13,7 +13,7 @@ import { Prompt as O } from "@clack/core";
13
13
  import { styleText as k } from "node:util";
14
14
  import { downloadTemplate as ee } from "giget";
15
15
  //#region src/constants/constants.ts
16
- var A = "0.5.9", te = "gh:BetterTyped/hype-stack", ne = "stack.json", re = "/schema/stack.json", j = "https://api.hype-stack.dev", M = "HYPE_STACK_API_URL", N = "https://www.hype-stack.dev", ie = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, P = [
16
+ var A = "0.5.11", j = "gh:BetterTyped/hype-stack", te = "stack.json", ne = "/schema/stack.json", M = "https://api.hype-stack.dev", N = "HYPE_STACK_API_URL", P = "https://www.hype-stack.dev", re = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, F = [
17
17
  {
18
18
  value: "cursor",
19
19
  label: "Cursor",
@@ -31,109 +31,109 @@ var A = "0.5.9", te = "gh:BetterTyped/hype-stack", ne = "stack.json", re = "/sch
31
31
  value: "copilot",
32
32
  label: "GitHub Copilot"
33
33
  }
34
- ], ae = P.map((e) => e.value), oe = ".cursor/rules", se = ".cursor", ce = ".agents";
35
- function F() {
34
+ ], ie = F.map((e) => e.value), ae = ".cursor/rules", oe = ".cursor", se = ".agents";
35
+ function I() {
36
36
  let e = process.env.HYPE_STACK_API_URL;
37
- return e ? (ue(e), e.replace(/\/+$/, "")) : j;
37
+ return e ? (le(e), e.replace(/\/+$/, "")) : M;
38
38
  }
39
- function le() {
39
+ function ce() {
40
40
  let e = process.env.HYPE_STACK_WEB_URL;
41
- return e ? (ue(e), e.replace(/\/+$/, "")) : N;
41
+ return e ? (le(e), e.replace(/\/+$/, "")) : P;
42
42
  }
43
- function ue(e) {
43
+ function le(e) {
44
44
  try {
45
45
  let t = new URL(e);
46
- if (!t.protocol.startsWith("http")) throw Error(`${M} must use http or https protocol, got "${t.protocol}"`);
46
+ if (!t.protocol.startsWith("http")) throw Error(`${N} must use http or https protocol, got "${t.protocol}"`);
47
47
  } catch (t) {
48
- throw t instanceof TypeError ? Error(`${M} is not a valid URL: "${e}"`, { cause: t }) : t;
48
+ throw t instanceof TypeError ? Error(`${N} is not a valid URL: "${e}"`, { cause: t }) : t;
49
49
  }
50
50
  }
51
- function de() {
52
- return `${F()}${re}`;
51
+ function ue() {
52
+ return `${I()}${ne}`;
53
53
  }
54
54
  //#endregion
55
55
  //#region src/ui/theme.ts
56
- var fe = (e) => `\x1b[38;5;208m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;214m${e}\x1b[39m`, I = (e) => `\x1b[38;5;220m${e}\x1b[39m`, me = (e) => `\x1b[38;5;33m${e}\x1b[39m`, L = (e) => `\x1b[38;5;39m${e}\x1b[39m`, he = (e) => `\x1b[38;5;81m${e}\x1b[39m`, ge = {
57
- orange: fe,
58
- orangeBright: pe,
59
- amber: I,
60
- deepBlue: me,
61
- skyBlue: L,
62
- lightBlue: he
63
- }, R = {
64
- brand: (e) => fe(e),
65
- brandBold: (e) => b.bold(fe(e)),
66
- accent: (e) => L(e),
67
- accentBold: (e) => b.bold(L(e)),
56
+ var de = (e) => `\x1b[38;5;208m${e}\x1b[39m`, fe = (e) => `\x1b[38;5;214m${e}\x1b[39m`, L = (e) => `\x1b[38;5;220m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;33m${e}\x1b[39m`, R = (e) => `\x1b[38;5;39m${e}\x1b[39m`, me = (e) => `\x1b[38;5;81m${e}\x1b[39m`, he = {
57
+ orange: de,
58
+ orangeBright: fe,
59
+ amber: L,
60
+ deepBlue: pe,
61
+ skyBlue: R,
62
+ lightBlue: me
63
+ }, z = {
64
+ brand: (e) => de(e),
65
+ brandBold: (e) => b.bold(de(e)),
66
+ accent: (e) => R(e),
67
+ accentBold: (e) => b.bold(R(e)),
68
68
  success: (e) => b.green(e),
69
69
  error: (e) => b.red(e),
70
70
  warning: (e) => b.yellow(e),
71
71
  muted: (e) => b.dim(e),
72
72
  bold: (e) => b.bold(e),
73
73
  highlight: (e) => b.bold(b.white(e)),
74
- path: (e) => b.underline(L(e)),
75
- command: (e) => b.bold(I(e)),
74
+ path: (e) => b.underline(R(e)),
75
+ command: (e) => b.bold(L(e)),
76
76
  label: (e) => b.dim(b.bold(e))
77
77
  };
78
- function _e(e, t = e) {
79
- return `\x1b]8;;${e}\x07${L(t)}\x1b]8;;\x07`;
80
- }
81
- var z = {
82
- arrow: fe("›"),
83
- bullet: R.muted("·"),
84
- dash: R.muted("─"),
85
- corner: R.muted("╰"),
86
- pipe: R.muted("│"),
87
- dot: R.muted("•"),
88
- spark: I("✦"),
89
- sparkSmall: pe("✧"),
90
- bolt: I("⚡")
91
- }, ve = [
92
- I,
93
- I,
94
- pe,
78
+ function ge(e, t = e) {
79
+ return `\x1b]8;;${e}\x07${R(t)}\x1b]8;;\x07`;
80
+ }
81
+ var B = {
82
+ arrow: de("›"),
83
+ bullet: z.muted("·"),
84
+ dash: z.muted("─"),
85
+ corner: z.muted("╰"),
86
+ pipe: z.muted("│"),
87
+ dot: z.muted("•"),
88
+ spark: L("✦"),
89
+ sparkSmall: fe("✧"),
90
+ bolt: L("⚡")
91
+ }, _e = [
92
+ L,
93
+ L,
95
94
  fe,
95
+ de,
96
+ pe,
97
+ R,
96
98
  me,
97
- L,
98
- he,
99
- he
99
+ me
100
100
  ];
101
- function ye(e) {
101
+ function ve(e) {
102
102
  let t = [...e], n = t.length;
103
103
  return t.map((e, t) => {
104
104
  if (e === " " || e === "\n") return e;
105
105
  let r = t / Math.max(n - 1, 1);
106
- return ve[Math.min(Math.floor(r * ve.length), ve.length - 1)](e);
106
+ return _e[Math.min(Math.floor(r * _e.length), _e.length - 1)](e);
107
107
  }).join("");
108
108
  }
109
- function be(e, t, n) {
109
+ function ye(e, t, n) {
110
110
  return Math.round(e + (t - e) * n);
111
111
  }
112
- function xe(e, t) {
112
+ function be(e, t) {
113
113
  let { start: n, end: r, angle: i = 1 } = t, a = Math.max(...e.map((e) => e.length), 1), o = Math.max(e.length - 1, 1);
114
114
  return e.map((e, t) => [...e].map((e, s) => {
115
115
  if (e === " ") return e;
116
116
  let c = s / Math.max(a - 1, 1), l = t / o, u = Math.min((c + l * i) / (1 + i), 1);
117
- return `\x1b[38;2;${be(n[0], r[0], u)};${be(n[1], r[1], u)};${be(n[2], r[2], u)}m${e}\x1b[39m`;
117
+ return `\x1b[38;2;${ye(n[0], r[0], u)};${ye(n[1], r[1], u)};${ye(n[2], r[2], u)}m${e}\x1b[39m`;
118
118
  }).join(""));
119
119
  }
120
120
  //#endregion
121
121
  //#region src/core/license.ts
122
- function Se(e) {
123
- return `${le()}/packs/${e}`;
122
+ function xe(e) {
123
+ return `${ce()}/packs/${e}`;
124
124
  }
125
125
  //#endregion
126
126
  //#region ../../node_modules/.pnpm/@hyper-fetch+core@8.1.1/node_modules/@hyper-fetch/core/dist/index.mjs
127
- var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDescriptor, Ee = Object.getOwnPropertyNames, De = Object.getPrototypeOf, Oe = Object.prototype.hasOwnProperty, ke = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Ae = (e, t, n, r) => {
128
- if (t && typeof t == "object" || typeof t == "function") for (var i = Ee(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Oe.call(e, s) && s !== n && we(e, s, {
127
+ var Se = Object.create, Ce = Object.defineProperty, we = Object.getOwnPropertyDescriptor, Te = Object.getOwnPropertyNames, Ee = Object.getPrototypeOf, De = Object.prototype.hasOwnProperty, Oe = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), ke = (e, t, n, r) => {
128
+ if (t && typeof t == "object" || typeof t == "function") for (var i = Te(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !De.call(e, s) && s !== n && Ce(e, s, {
129
129
  get: ((e) => t[e]).bind(null, s),
130
- enumerable: !(r = Te(t, s)) || r.enumerable
130
+ enumerable: !(r = we(t, s)) || r.enumerable
131
131
  });
132
132
  return e;
133
- }, je = (e, t, n) => (n = e == null ? {} : Ce(De(e)), Ae(t || !e || !e.__esModule ? we(n, "default", {
133
+ }, Ae = (e, t, n) => (n = e == null ? {} : Se(Ee(e)), ke(t || !e || !e.__esModule ? Ce(n, "default", {
134
134
  value: e,
135
135
  enumerable: !0
136
- }) : n, e)), Me = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, Ne = /* @__PURE__ */ je((/* @__PURE__ */ ke(((e, t) => {
136
+ }) : n, e)), je = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, Me = /* @__PURE__ */ Ae((/* @__PURE__ */ Oe(((e, t) => {
137
137
  var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
138
138
  return Function.prototype.apply.call(e, t, n);
139
139
  }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
@@ -308,7 +308,7 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
308
308
  });
309
309
  else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
310
310
  }
311
- })))()), Pe = (e) => `listen_${String(e)}`, Fe = class extends Ne.default {
311
+ })))()), Ne = (e) => `listen_${String(e)}`, Pe = class extends Me.default {
312
312
  emitCallbacks = [];
313
313
  constructor(e) {
314
314
  super(e);
@@ -320,26 +320,26 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
320
320
  onEmit = (e) => (this.emitCallbacks?.push(e), () => {
321
321
  this.emitCallbacks = this.emitCallbacks?.filter((t) => t !== e);
322
322
  });
323
- onListener = (e, t) => (super.on(Pe(e), t), () => {
324
- super.off(Pe(e), t);
323
+ onListener = (e, t) => (super.on(Ne(e), t), () => {
324
+ super.off(Ne(e), t);
325
325
  });
326
- on = (e, t) => (super.on(e, t), super.emit(Pe(e), super.listeners(e).length), this);
327
- off = (e, t) => (super.off(e, t), super.emit(Pe(e), super.listeners(e).length), this);
326
+ on = (e, t) => (super.on(e, t), super.emit(Ne(e), super.listeners(e).length), this);
327
+ off = (e, t) => (super.off(e, t), super.emit(Ne(e), super.listeners(e).length), this);
328
328
  addListener = this.on;
329
329
  removeListener = this.off;
330
- }, Ie = class {
331
- emitter = new Fe();
332
- events = Ve(this.emitter);
330
+ }, Fe = class {
331
+ emitter = new Pe();
332
+ events = Be(this.emitter);
333
333
  isBrowser;
334
334
  isOnline;
335
335
  isFocused;
336
336
  constructor(e) {
337
337
  this.options = e, this.emitter?.setMaxListeners(1e3);
338
- let { initiallyFocused: t = He.initiallyFocused, initiallyOnline: n = He.initiallyOnline } = this.options || He;
339
- this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Re();
338
+ let { initiallyFocused: t = H.initiallyFocused, initiallyOnline: n = H.initiallyOnline } = this.options || H;
339
+ this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Le();
340
340
  }
341
341
  initialize = () => {
342
- let { focusEvent: e = He.focusEvent, onlineEvent: t = He.onlineEvent } = this.options || He;
342
+ let { focusEvent: e = H.focusEvent, onlineEvent: t = H.onlineEvent } = this.options || H;
343
343
  e(this.setFocused), t(this.setOnline);
344
344
  };
345
345
  setInitialFocus = async (e) => {
@@ -354,51 +354,51 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
354
354
  setOnline = (e) => {
355
355
  this.isOnline = e, e ? this.events.emitOnline() : this.events.emitOffline();
356
356
  };
357
- }, Le = () => {
357
+ }, Ie = () => {
358
358
  try {
359
359
  return !!(window && window.addEventListener);
360
360
  } catch {
361
361
  /* istanbul ignore next */
362
362
  return !1;
363
363
  }
364
- }, Re = () => {
364
+ }, Le = () => {
365
365
  try {
366
- return !!(Le() && window.document && window.document.addEventListener);
366
+ return !!(Ie() && window.document && window.document.addEventListener);
367
367
  } catch {
368
368
  /* istanbul ignore next */
369
369
  return !1;
370
370
  }
371
- }, ze = (e, t, n) => Le() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, Be = (e, t, n) => Re() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, Ve = (e) => ({
371
+ }, Re = (e, t, n) => Ie() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, ze = (e, t, n) => Le() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, Be = (e) => ({
372
372
  emitFocus: () => {
373
- e.emit(B.FOCUS);
373
+ e.emit(V.FOCUS);
374
374
  },
375
375
  emitBlur: () => {
376
- e.emit(B.BLUR);
376
+ e.emit(V.BLUR);
377
377
  },
378
378
  emitOnline: () => {
379
- e.emit(B.ONLINE);
379
+ e.emit(V.ONLINE);
380
380
  },
381
381
  emitOffline: () => {
382
- e.emit(B.OFFLINE);
382
+ e.emit(V.OFFLINE);
383
383
  },
384
- onFocus: (t) => (e.on(B.FOCUS, t), () => e.removeListener(B.FOCUS, t)),
385
- onBlur: (t) => (e.on(B.BLUR, t), () => e.removeListener(B.BLUR, t)),
386
- onOnline: (t) => (e.on(B.ONLINE, t), () => e.removeListener(B.ONLINE, t)),
387
- onOffline: (t) => (e.on(B.OFFLINE, t), () => e.removeListener(B.OFFLINE, t))
388
- }), B = /* @__PURE__ */ function(e) {
384
+ onFocus: (t) => (e.on(V.FOCUS, t), () => e.removeListener(V.FOCUS, t)),
385
+ onBlur: (t) => (e.on(V.BLUR, t), () => e.removeListener(V.BLUR, t)),
386
+ onOnline: (t) => (e.on(V.ONLINE, t), () => e.removeListener(V.ONLINE, t)),
387
+ onOffline: (t) => (e.on(V.OFFLINE, t), () => e.removeListener(V.OFFLINE, t))
388
+ }), V = /* @__PURE__ */ function(e) {
389
389
  return e.FOCUS = "focus", e.BLUR = "blur", e.ONLINE = "online", e.OFFLINE = "offline", e;
390
- }({}), He = {
390
+ }({}), H = {
391
391
  initiallyFocused: !0,
392
392
  initiallyOnline: !0,
393
393
  focusEvent: (e) => {
394
- Be("visibilitychange", () => e(!0)), ze("focus", () => e(!0)), ze("blur", () => e(!1));
394
+ ze("visibilitychange", () => e(!0)), Re("focus", () => e(!0)), Re("blur", () => e(!1));
395
395
  },
396
396
  onlineEvent: (e) => {
397
- ze("online", () => e(!0)), ze("offline", () => e(!1));
397
+ Re("online", () => e(!0)), Re("offline", () => e(!1));
398
398
  }
399
- }, Ue = class {
400
- emitter = new Fe();
401
- events = yt(this.emitter);
399
+ }, Ve = class {
400
+ emitter = new Pe();
401
+ events = _t(this.emitter);
402
402
  constructor() {
403
403
  this.emitter?.setMaxListeners(1e3);
404
404
  }
@@ -435,71 +435,71 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
435
435
  });
436
436
  });
437
437
  };
438
- }, We = () => "loading-event-any", Ge = (e) => `${e}-loading-event`, Ke = (e) => `${e}-loading-cache-event`, qe = (e) => `${e}-loading-event-by-id`, Je = () => "remove-event-any", Ye = (e) => `${e}-remove-event`, Xe = (e) => `${e}-remove-event-by-id`, Ze = () => "request-abort-any", Qe = (e) => `${e}-request-abort`, $e = (e) => `${e}-request-abort-by-id`, et = () => "response-any", tt = (e) => `${e}-response`, nt = (e) => `${e}-response-by-id`, rt = () => "request-start-any", it = (e) => `${e}-request-start`, at = (e) => `${e}-request-start-by-id`, ot = () => "response-start-any", st = (e) => `${e}-response-start`, ct = (e) => `${e}-response-start-by-id`, lt = () => "request-progress-any", ut = (e) => `${e}-request-progress`, dt = (e) => `${e}-request-progress-by-id`, ft = () => "response-progress-any", pt = (e) => `${e}-response-progress`, mt = (e) => `${e}-response-progress-by-id`, ht = () => "request-deduplicated-any", gt = (e) => `${e}-query-request-deduplicated`, _t = (e) => `${e}-cache-request-deduplicated`, vt = (e) => `${e}-request-deduplicated-by-id`, yt = (e) => ({
438
+ }, He = () => "loading-event-any", Ue = (e) => `${e}-loading-event`, We = (e) => `${e}-loading-cache-event`, Ge = (e) => `${e}-loading-event-by-id`, Ke = () => "remove-event-any", qe = (e) => `${e}-remove-event`, Je = (e) => `${e}-remove-event-by-id`, Ye = () => "request-abort-any", Xe = (e) => `${e}-request-abort`, Ze = (e) => `${e}-request-abort-by-id`, Qe = () => "response-any", $e = (e) => `${e}-response`, et = (e) => `${e}-response-by-id`, tt = () => "request-start-any", nt = (e) => `${e}-request-start`, rt = (e) => `${e}-request-start-by-id`, it = () => "response-start-any", at = (e) => `${e}-response-start`, ot = (e) => `${e}-response-start-by-id`, st = () => "request-progress-any", ct = (e) => `${e}-request-progress`, lt = (e) => `${e}-request-progress-by-id`, ut = () => "response-progress-any", dt = (e) => `${e}-response-progress`, ft = (e) => `${e}-response-progress-by-id`, pt = () => "request-deduplicated-any", mt = (e) => `${e}-query-request-deduplicated`, ht = (e) => `${e}-cache-request-deduplicated`, gt = (e) => `${e}-request-deduplicated-by-id`, _t = (e) => ({
439
439
  emitDeduplicated: (t, n = !1) => {
440
- e.emit(ht(), t, n), e.emit(vt(t.requestId), t, n), e.emit(_t(t.request.cacheKey), t, n), e.emit(gt(t.request.queryKey), t, n);
440
+ e.emit(pt(), t, n), e.emit(gt(t.requestId), t, n), e.emit(ht(t.request.cacheKey), t, n), e.emit(mt(t.request.queryKey), t, n);
441
441
  },
442
442
  emitLoading: (t, n = !1) => {
443
- e.emit(We(), t, n), e.emit(qe(t.requestId), t, n), e.emit(Ke(t.request.cacheKey), t, n), e.emit(Ge(t.request.queryKey), t, n);
443
+ e.emit(He(), t, n), e.emit(Ge(t.requestId), t, n), e.emit(We(t.request.cacheKey), t, n), e.emit(Ue(t.request.queryKey), t, n);
444
444
  },
445
445
  emitRequestStart: (t, n = !1) => {
446
- e.emit(rt(), t, n), e.emit(at(t.requestId), t, n), e.emit(it(t.request.queryKey), t, n);
446
+ e.emit(tt(), t, n), e.emit(rt(t.requestId), t, n), e.emit(nt(t.request.queryKey), t, n);
447
447
  },
448
448
  emitResponseStart: (t, n = !1) => {
449
- e.emit(ot(), t, n), e.emit(ct(t.requestId), t, n), e.emit(st(t.request.queryKey), t, n);
449
+ e.emit(it(), t, n), e.emit(ot(t.requestId), t, n), e.emit(at(t.request.queryKey), t, n);
450
450
  },
451
451
  emitUploadProgress: (t, n = !1) => {
452
- e.emit(lt(), t, n), e.emit(dt(t.requestId), t, n), e.emit(ut(t.request.queryKey), t, n);
452
+ e.emit(st(), t, n), e.emit(lt(t.requestId), t, n), e.emit(ct(t.request.queryKey), t, n);
453
453
  },
454
454
  emitDownloadProgress: (t, n = !1) => {
455
- e.emit(ft(), t, n), e.emit(mt(t.requestId), t, n), e.emit(pt(t.request.queryKey), t, n);
455
+ e.emit(ut(), t, n), e.emit(ft(t.requestId), t, n), e.emit(dt(t.request.queryKey), t, n);
456
456
  },
457
457
  emitResponse: (t, n = !1) => {
458
- e.emit(et(), t, n), e.emit(nt(t.requestId), t, n), e.emit(tt(t.request.cacheKey), t, n);
458
+ e.emit(Qe(), t, n), e.emit(et(t.requestId), t, n), e.emit($e(t.request.cacheKey), t, n);
459
459
  },
460
460
  emitAbort: (t, n = !1) => {
461
- e.emit(Ze(), t, n), e.emit($e(t.requestId), t, n), e.emit(Qe(t.request.abortKey), t, n);
461
+ e.emit(Ye(), t, n), e.emit(Ze(t.requestId), t, n), e.emit(Xe(t.request.abortKey), t, n);
462
462
  },
463
463
  emitRemove: (t, n = !1) => {
464
- e.emit(Je(), t, n), e.emit(Xe(t.requestId), t, n), e.emit(Ye(t.request.queryKey), t, n);
464
+ e.emit(Ke(), t, n), e.emit(Je(t.requestId), t, n), e.emit(qe(t.request.queryKey), t, n);
465
465
  },
466
- onDeduplicated: (t) => (e.on(ht(), t), () => e.removeListener(ht(), t)),
467
- onDeduplicatedByQueue: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
468
- onDeduplicatedByCache: (t, n) => (e.on(_t(t), n), () => e.removeListener(_t(t), n)),
469
- onDeduplicatedById: (t, n) => (e.on(vt(t), n), () => e.removeListener(vt(t), n)),
470
- onLoading: (t) => (e.on(We(), t), () => e.removeListener(We(), t)),
471
- onLoadingByQueue: (t, n) => (e.on(Ge(t), n), () => e.removeListener(Ge(t), n)),
472
- onLoadingByCache: (t, n) => (e.on(Ke(t), n), () => e.removeListener(Ke(t), n)),
473
- onLoadingById: (t, n) => (e.on(qe(t), n), () => e.removeListener(qe(t), n)),
474
- onRequestStart: (t) => (e.on(rt(), t), () => e.removeListener(rt(), t)),
475
- onRequestStartByQueue: (t, n) => (e.on(it(t), n), () => e.removeListener(it(t), n)),
476
- onRequestStartById: (t, n) => (e.on(at(t), n), () => e.removeListener(at(t), n)),
477
- onResponseStart: (t) => (e.on(ot(), t), () => e.removeListener(ot(), t)),
478
- onResponseStartByQueue: (t, n) => (e.on(st(t), n), () => e.removeListener(st(t), n)),
479
- onResponseStartById: (t, n) => (e.on(ct(t), n), () => e.removeListener(ct(t), n)),
480
- onUploadProgress: (t) => (e.on(lt(), t), () => e.removeListener(lt(), t)),
481
- onUploadProgressByQueue: (t, n) => (e.on(ut(t), n), () => e.removeListener(ut(t), n)),
482
- onUploadProgressById: (t, n) => (e.on(dt(t), n), () => e.removeListener(dt(t), n)),
483
- onDownloadProgress: (t) => (e.on(ft(), t), () => e.removeListener(ft(), t)),
484
- onDownloadProgressByQueue: (t, n) => (e.on(pt(t), n), () => e.removeListener(pt(t), n)),
485
- onDownloadProgressById: (t, n) => (e.on(mt(t), n), () => e.removeListener(mt(t), n)),
486
- onResponse: (t) => (e.on(et(), t), () => e.removeListener(et(), t)),
487
- onResponseByCache: (t, n) => (e.on(tt(t), n), () => e.removeListener(tt(t), n)),
488
- onResponseById: (t, n) => (e.on(nt(t), n), () => e.removeListener(nt(t), n)),
489
- onAbort: (t) => (e.on(Ze(), t), () => e.removeListener(Ze(), t)),
490
- onAbortByKey: (t, n) => (e.on(Qe(t), n), () => e.removeListener(Qe(t), n)),
491
- onAbortById: (t, n) => (e.on($e(t), n), () => e.removeListener($e(t), n)),
492
- onRemove: (t) => (e.on(Je(), t), () => e.removeListener(Je(), t)),
493
- onRemoveByQueue: (t, n) => (e.on(Ye(t), n), () => e.removeListener(Ye(t), n)),
494
- onRemoveById: (t, n) => (e.on(Xe(t), n), () => e.removeListener(Xe(t), n))
495
- }), bt = class {
466
+ onDeduplicated: (t) => (e.on(pt(), t), () => e.removeListener(pt(), t)),
467
+ onDeduplicatedByQueue: (t, n) => (e.on(mt(t), n), () => e.removeListener(mt(t), n)),
468
+ onDeduplicatedByCache: (t, n) => (e.on(ht(t), n), () => e.removeListener(ht(t), n)),
469
+ onDeduplicatedById: (t, n) => (e.on(gt(t), n), () => e.removeListener(gt(t), n)),
470
+ onLoading: (t) => (e.on(He(), t), () => e.removeListener(He(), t)),
471
+ onLoadingByQueue: (t, n) => (e.on(Ue(t), n), () => e.removeListener(Ue(t), n)),
472
+ onLoadingByCache: (t, n) => (e.on(We(t), n), () => e.removeListener(We(t), n)),
473
+ onLoadingById: (t, n) => (e.on(Ge(t), n), () => e.removeListener(Ge(t), n)),
474
+ onRequestStart: (t) => (e.on(tt(), t), () => e.removeListener(tt(), t)),
475
+ onRequestStartByQueue: (t, n) => (e.on(nt(t), n), () => e.removeListener(nt(t), n)),
476
+ onRequestStartById: (t, n) => (e.on(rt(t), n), () => e.removeListener(rt(t), n)),
477
+ onResponseStart: (t) => (e.on(it(), t), () => e.removeListener(it(), t)),
478
+ onResponseStartByQueue: (t, n) => (e.on(at(t), n), () => e.removeListener(at(t), n)),
479
+ onResponseStartById: (t, n) => (e.on(ot(t), n), () => e.removeListener(ot(t), n)),
480
+ onUploadProgress: (t) => (e.on(st(), t), () => e.removeListener(st(), t)),
481
+ onUploadProgressByQueue: (t, n) => (e.on(ct(t), n), () => e.removeListener(ct(t), n)),
482
+ onUploadProgressById: (t, n) => (e.on(lt(t), n), () => e.removeListener(lt(t), n)),
483
+ onDownloadProgress: (t) => (e.on(ut(), t), () => e.removeListener(ut(), t)),
484
+ onDownloadProgressByQueue: (t, n) => (e.on(dt(t), n), () => e.removeListener(dt(t), n)),
485
+ onDownloadProgressById: (t, n) => (e.on(ft(t), n), () => e.removeListener(ft(t), n)),
486
+ onResponse: (t) => (e.on(Qe(), t), () => e.removeListener(Qe(), t)),
487
+ onResponseByCache: (t, n) => (e.on($e(t), n), () => e.removeListener($e(t), n)),
488
+ onResponseById: (t, n) => (e.on(et(t), n), () => e.removeListener(et(t), n)),
489
+ onAbort: (t) => (e.on(Ye(), t), () => e.removeListener(Ye(), t)),
490
+ onAbortByKey: (t, n) => (e.on(Xe(t), n), () => e.removeListener(Xe(t), n)),
491
+ onAbortById: (t, n) => (e.on(Ze(t), n), () => e.removeListener(Ze(t), n)),
492
+ onRemove: (t) => (e.on(Ke(), t), () => e.removeListener(Ke(), t)),
493
+ onRemoveByQueue: (t, n) => (e.on(qe(t), n), () => e.removeListener(qe(t), n)),
494
+ onRemoveById: (t, n) => (e.on(Je(t), n), () => e.removeListener(Je(t), n))
495
+ }), vt = class {
496
496
  logger;
497
497
  level;
498
498
  modules;
499
- emitter = new Ne.default();
499
+ emitter = new Me.default();
500
500
  client;
501
501
  constructor(e) {
502
- this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || Ct, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
502
+ this.options = e, this.emitter?.setMaxListeners(1e3), this.logger = this.options?.logger || xt, this.level = this.options?.level || "warning", this.modules = this.options?.modules;
503
503
  }
504
504
  setSeverity = (e) => {
505
505
  this.level = e;
@@ -530,58 +530,58 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
530
530
  })
531
531
  });
532
532
  log = (e) => {
533
- this.client.debug && (wt.indexOf(this.level) <= wt.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
533
+ this.client.debug && (St.indexOf(this.level) <= St.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
534
534
  };
535
- }, xt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, St = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, Ct = (e) => {
536
- let t = Et[e.level], n = Dt[e.level], r = `%c[${xt()}]%c${e.title}%c${St(e)}`, i = `${t}${n}font-weight:600;border-radius: 4px 0 0 4px;`, a = `${t}${n}font-weight:600;`, o = `${t}font-weight:normal;border-radius: 0 4px 4px 0;`;
535
+ }, yt = () => `${(/* @__PURE__ */ new Date()).toLocaleTimeString()}`, bt = (e) => e.type === "request" || e.type === "response" ? `${e.extra.request.endpoint}` : `[${e.module}]`, xt = (e) => {
536
+ let t = wt[e.level], n = Tt[e.level], r = `%c[${yt()}]%c${e.title}%c${bt(e)}`, i = `${t}${n}font-weight:600;border-radius: 4px 0 0 4px;`, a = `${t}${n}font-weight:600;`, o = `${t}font-weight:normal;border-radius: 0 4px 4px 0;`;
537
537
  e.extra && Object.keys(e.extra)?.length ? (console.groupCollapsed(r, i, a, o), console.log(e.extra), console.groupEnd()) : console.log(r, t);
538
- }, wt = [
538
+ }, St = [
539
539
  "error",
540
540
  "warning",
541
541
  "info",
542
542
  "debug"
543
- ], Tt = "padding:2px 5px;", Et = {
544
- error: `${Tt};background:#db252520;`,
545
- warning: `${Tt};background:#e1941e20;`,
546
- info: `${Tt};background:#1e74e120;`,
547
- debug: `${Tt};background:#00000020;`
548
- }, Dt = {
543
+ ], Ct = "padding:2px 5px;", wt = {
544
+ error: `${Ct};background:#db252520;`,
545
+ warning: `${Ct};background:#e1941e20;`,
546
+ info: `${Ct};background:#1e74e120;`,
547
+ debug: `${Ct};background:#00000020;`
548
+ }, Tt = {
549
549
  error: "color:#ff3737;",
550
550
  warning: "color:#ffc107;",
551
551
  info: "color:#34a8ff;",
552
552
  debug: "color:#cccccc;"
553
- }, Ot = class extends Error {
553
+ }, Et = class extends Error {
554
554
  constructor() {
555
555
  super("Request timeout"), this.name = "TimeoutError";
556
556
  }
557
- }, kt = class extends Error {
557
+ }, Dt = class extends Error {
558
558
  constructor() {
559
559
  super("Request aborted"), this.name = "AbortError";
560
560
  }
561
- }, At = class extends Error {
561
+ }, Ot = class extends Error {
562
562
  constructor() {
563
563
  super("Request deleted"), this.name = "DeletedError";
564
564
  }
565
- }, jt = class extends Error {
565
+ }, kt = class extends Error {
566
566
  description;
567
567
  constructor(e) {
568
568
  super("Request processing error"), this.description = e, this.name = "RequestProcessingError";
569
569
  }
570
- }, Mt = class extends Error {
570
+ }, At = class extends Error {
571
571
  description;
572
572
  constructor(e) {
573
573
  super("Unexpected error"), this.description = e, this.name = "UnexpectedError";
574
574
  }
575
- }, V = (e) => e === "timeout" ? new Ot() : e === "abort" ? new kt() : e === "deleted" ? new At() : e === "processing" ? new jt() : new Mt(), Nt = (e) => {
575
+ }, jt = (e) => e === "timeout" ? new Et() : e === "abort" ? new Dt() : e === "deleted" ? new Ot() : e === "processing" ? new kt() : new At(), Mt = (e) => {
576
576
  try {
577
577
  return JSON.stringify(e);
578
578
  } catch {
579
579
  return "";
580
580
  }
581
- }, Pt = (e) => {
582
- let t = Le() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
581
+ }, Nt = (e) => {
582
+ let t = Ie() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
583
583
  return !t && n && (r["Content-Type"] = "application/json"), Object.assign(r, e.headers), r;
584
- }, Ft = (e) => Le() && e instanceof FormData ? e : Nt(e), It = [
584
+ }, Pt = (e) => Ie() && e instanceof FormData ? e : Mt(e), Ft = [
585
585
  "onBeforeSent",
586
586
  "onRequestStart",
587
587
  "onResponseStart",
@@ -590,7 +590,7 @@ var Ce = Object.create, we = Object.defineProperty, Te = Object.getOwnPropertyDe
590
590
  "onResponse",
591
591
  "onRemove"
592
592
  ];
593
- function Lt(e) {
593
+ function It(e) {
594
594
  let t = {
595
595
  onBeforeSent: [],
596
596
  onRequestStart: [],
@@ -600,7 +600,7 @@ function Lt(e) {
600
600
  onResponse: [],
601
601
  onRemove: []
602
602
  };
603
- e && It.forEach((n) => {
603
+ e && Ft.forEach((n) => {
604
604
  t[n] = [...e[n]];
605
605
  });
606
606
  let n = (e) => (n) => (t[e].push(n), () => {
@@ -622,15 +622,15 @@ function Lt(e) {
622
622
  },
623
623
  __snapshot() {
624
624
  let e = {};
625
- return It.forEach((n) => {
625
+ return Ft.forEach((n) => {
626
626
  e[n] = [...t[n]];
627
627
  }), e;
628
628
  }
629
629
  };
630
630
  }
631
- var Rt = /* @__PURE__ */ function(e) {
631
+ var Lt = /* @__PURE__ */ function(e) {
632
632
  return e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.PATCH = "PATCH", e.DELETE = "DELETE", e;
633
- }({}), H = (e, t) => t ? `${t}__${e}` : e, zt = (e) => {
633
+ }({}), U = (e, t) => t ? `${t}__${e}` : e, Rt = (e) => {
634
634
  try {
635
635
  if (typeof e == "string") return e;
636
636
  if (e == null) return "";
@@ -640,13 +640,13 @@ var Rt = /* @__PURE__ */ function(e) {
640
640
  } catch {
641
641
  return "";
642
642
  }
643
- }, Bt = ({ loaded: e, total: t }) => !e || !t ? 0 : Number((e * 100 / t).toFixed(0)), Vt = (e, t, { total: n, loaded: r }) => {
643
+ }, zt = ({ loaded: e, total: t }) => !e || !t ? 0 : Number((e * 100 / t).toFixed(0)), Bt = (e, t, { total: n, loaded: r }) => {
644
644
  let i = r / (t - +e || 1), a = Math.max(n, r), o = a - r, s = i ? o / i : null;
645
645
  return {
646
646
  timeLeft: a === r ? 0 : s,
647
647
  sizeLeft: o
648
648
  };
649
- }, Ht = (e, t, n) => {
649
+ }, Vt = (e, t, n) => {
650
650
  let { total: r, loaded: i } = n;
651
651
  if (Number.isNaN(r) || Number.isNaN(i)) return {
652
652
  progress: 0,
@@ -656,23 +656,23 @@ var Rt = /* @__PURE__ */ function(e) {
656
656
  loaded: 0,
657
657
  startTimestamp: +e
658
658
  };
659
- let { timeLeft: a, sizeLeft: o } = Vt(e, t, n);
659
+ let { timeLeft: a, sizeLeft: o } = Bt(e, t, n);
660
660
  return {
661
- progress: Bt(n),
661
+ progress: zt(n),
662
662
  timeLeft: a,
663
663
  sizeLeft: o,
664
664
  total: r,
665
665
  loaded: i,
666
666
  startTimestamp: +e
667
667
  };
668
- }, Ut = (e) => `${e.method}_${e.requestOptions.endpoint}_${e.cancelable}`, Wt = (e, t) => `${zt(e.method)}_${t ? e.requestOptions.endpoint : zt(e.endpoint)}_${t ? "" : zt(e.queryParams)}`, Gt = (e, t = "auto") => {
669
- let { fetchDispatcher: n, submitDispatcher: r } = e.client, i = e.method === Rt.GET, a = t === "auto" && i || t === "fetch";
668
+ }, Ht = (e) => `${e.method}_${e.requestOptions.endpoint}_${e.cancelable}`, Ut = (e, t) => `${Rt(e.method)}_${t ? e.requestOptions.endpoint : Rt(e.endpoint)}_${t ? "" : Rt(e.queryParams)}`, Wt = (e, t = "auto") => {
669
+ let { fetchDispatcher: n, submitDispatcher: r } = e.client, i = e.method === Lt.GET, a = t === "auto" && i || t === "fetch";
670
670
  return [a ? n : r, a];
671
- }, Kt = async (e, t) => {
671
+ }, Gt = async (e, t) => {
672
672
  let n = e.unstable_responseMapper?.(t);
673
673
  return n instanceof Promise ? await n : n || t;
674
- }, qt = async (e, t) => {
675
- let { client: n } = e, { requestManager: r } = n, [i] = Gt(e, t?.dispatcherType), a;
674
+ }, Kt = async (e, t) => {
675
+ let { client: n } = e, { requestManager: r } = n, [i] = Wt(e, t?.dispatcherType), a;
676
676
  if (e.optimistic) try {
677
677
  a = await e.optimistic({
678
678
  request: e,
@@ -748,7 +748,7 @@ var Rt = /* @__PURE__ */ function(e) {
748
748
  data: null,
749
749
  status: null,
750
750
  success: !1,
751
- error: V("deleted"),
751
+ error: jt("deleted"),
752
752
  extra: e.client.adapter.defaultExtra,
753
753
  requestTimestamp: +/* @__PURE__ */ new Date(),
754
754
  responseTimestamp: +/* @__PURE__ */ new Date()
@@ -759,9 +759,9 @@ var Rt = /* @__PURE__ */ function(e) {
759
759
  u(), d(), f(), p(), m(), h();
760
760
  }
761
761
  });
762
- }, Jt = /* @__PURE__ */ function(e) {
762
+ }, qt = /* @__PURE__ */ function(e) {
763
763
  return e[e.SEC = 1e3] = "SEC", e[e.MIN = 6e4] = "MIN", e[e.HOUR = 36e5] = "HOUR", e[e.DAY = 864e5] = "DAY", e[e.WEEK = 6048e5] = "WEEK", e[e.MONTH_30 = 2592e6] = "MONTH_30", e[e.MONTH_31 = 26784e5] = "MONTH_31", e[e.YEAR = 31536e6] = "YEAR", e[e.YEAR_LEAP = 316224e5] = "YEAR_LEAP", e;
764
- }({}), Yt = class e {
764
+ }({}), Jt = class e {
765
765
  endpoint;
766
766
  headers;
767
767
  auth;
@@ -785,7 +785,7 @@ var Rt = /* @__PURE__ */ function(e) {
785
785
  deduplicate;
786
786
  deduplicateTime;
787
787
  scope;
788
- $hooks = Lt();
788
+ $hooks = It();
789
789
  isMockerEnabled = !1;
790
790
  unstable_mock;
791
791
  unstable_payloadMapper;
@@ -802,7 +802,7 @@ var Rt = /* @__PURE__ */ function(e) {
802
802
  updatedQueryKey;
803
803
  constructor(e, t, n) {
804
804
  this.client = e, this.requestOptions = t, this.initialRequestConfiguration = n;
805
- let { endpoint: r, headers: i, auth: a = !0, method: o = e.adapter.defaultMethod, options: s, cancelable: c = !1, retry: l = 0, retryTime: u = 500, cacheTime: d = Jt.MIN * 5, cache: f = !0, staleTime: p = Jt.MIN * 5, queued: m = !1, offline: h = !0, abortKey: g, cacheKey: _, queryKey: v, deduplicate: y = !1, deduplicateTime: b = null } = {
805
+ let { endpoint: r, headers: i, auth: a = !0, method: o = e.adapter.defaultMethod, options: s, cancelable: c = !1, retry: l = 0, retryTime: u = 500, cacheTime: d = qt.MIN * 5, cache: f = !0, staleTime: p = qt.MIN * 5, queued: m = !1, offline: h = !0, abortKey: g, cacheKey: _, queryKey: v, deduplicate: y = !1, deduplicateTime: b = null } = {
806
806
  ...this.client.adapter.unstable_getRequestDefaults?.(t),
807
807
  ...t
808
808
  };
@@ -912,11 +912,11 @@ var Rt = /* @__PURE__ */ function(e) {
912
912
  payload: t?.payload || this.payload,
913
913
  params: t?.params || this.params
914
914
  }, r = new e(this.client, this.requestOptions, n);
915
- return r.unstable_payloadMapper = this.unstable_payloadMapper, r.unstable_responseMapper = this.unstable_responseMapper, r.unstable_requestMapper = this.unstable_requestMapper, r.retryOnError = this.retryOnError, r.unstable_mock = this.unstable_mock, r.isMockerEnabled = this.isMockerEnabled, r.optimistic = this.optimistic, r.$hooks = Lt(this.$hooks.__snapshot()), r;
915
+ return r.unstable_payloadMapper = this.unstable_payloadMapper, r.unstable_responseMapper = this.unstable_responseMapper, r.unstable_requestMapper = this.unstable_requestMapper, r.retryOnError = this.retryOnError, r.unstable_mock = this.unstable_mock, r.isMockerEnabled = this.isMockerEnabled, r.optimistic = this.optimistic, r.$hooks = It(this.$hooks.__snapshot()), r;
916
916
  }
917
917
  abort = () => {
918
918
  let { requestManager: e } = this.client;
919
- return e.abortByKey(H(this.abortKey, this.scope)), this.clone();
919
+ return e.abortByKey(U(this.abortKey, this.scope)), this.clone();
920
920
  };
921
921
  dehydrate = (e) => {
922
922
  let { response: t, override: n = !0 } = e || {};
@@ -931,7 +931,7 @@ var Rt = /* @__PURE__ */ function(e) {
931
931
  cache: !0,
932
932
  response: t
933
933
  };
934
- let r = this.client.cache.get(H(this.cacheKey, this.scope));
934
+ let r = this.client.cache.get(U(this.cacheKey, this.scope));
935
935
  if (r) return {
936
936
  override: n,
937
937
  cacheTime: this.cacheTime,
@@ -953,7 +953,7 @@ var Rt = /* @__PURE__ */ function(e) {
953
953
  };
954
954
  };
955
955
  read() {
956
- let e = this.client.cache.get(H(this.cacheKey, this.scope));
956
+ let e = this.client.cache.get(U(this.cacheKey, this.scope));
957
957
  if (e) return {
958
958
  data: e.data,
959
959
  error: e.error,
@@ -965,7 +965,7 @@ var Rt = /* @__PURE__ */ function(e) {
965
965
  };
966
966
  }
967
967
  exec = async (e) => {
968
- let { adapter: t, requestManager: n } = this.client, r = this.clone(e), i = this.client.unstable_requestIdMapper(this), a = H(this.abortKey, this.scope);
968
+ let { adapter: t, requestManager: n } = this.client, r = this.clone(e), i = this.client.unstable_requestIdMapper(this), a = U(this.abortKey, this.scope);
969
969
  n.addAbortController(a, i);
970
970
  let o = await t.fetch(r, i);
971
971
  return n.removeAbortController(a, i), r.unstable_responseMapper ? r.unstable_responseMapper(o) : o;
@@ -975,17 +975,17 @@ var Rt = /* @__PURE__ */ function(e) {
975
975
  ...e,
976
976
  cachePolicy: void 0
977
977
  };
978
- if (n === "network-only") return qt(i, a);
978
+ if (n === "network-only") return Kt(i, a);
979
979
  let o = i.read();
980
- if (n === "cache-first") return o ? Kt(i, o) : qt(i, a);
980
+ if (n === "cache-first") return o ? Gt(i, o) : Kt(i, a);
981
981
  if (o) {
982
- let e = await Kt(i, o);
983
- return qt(i, a), e;
982
+ let e = await Gt(i, o);
983
+ return Kt(i, a), e;
984
984
  }
985
- return qt(i, a);
985
+ return Kt(i, a);
986
986
  };
987
987
  static fromJSON = (t, n) => new e(t, n.requestOptions, n);
988
- }, Xt = async ({ request: e, requestId: t, resolve: n, onStartTime: r, internalErrorMapping: i }) => {
988
+ }, Yt = async ({ request: e, requestId: t, resolve: n, onStartTime: r, internalErrorMapping: i }) => {
989
989
  let { requestManager: a, loggerManager: o } = e.client, { unstable_payloadMapper: s } = e.client.adapter, c = o.initialize(e.client, "Adapter"), l = null, u = null, d = e, f = 1, p = 1, m = 0, h = 0;
990
990
  c.debug({
991
991
  title: "Running middleware callbacks",
@@ -995,7 +995,7 @@ var Rt = /* @__PURE__ */ function(e) {
995
995
  requestId: t
996
996
  }
997
997
  }), d = await d.client.unstable_modifyRequest(d), d.auth && (d = await d.client.unstable_modifyAuth(d)), d.unstable_requestMapper && (d = await d.unstable_requestMapper(d, t));
998
- let { client: g, abortKey: _ } = d, v = H(_, d.scope), y = d.payload;
998
+ let { client: g, abortKey: _ } = d, v = U(_, d.scope), y = d.payload;
999
999
  d.unstable_payloadMapper ? y = await d.unstable_payloadMapper(d.payload) : s && (y = await s(y));
1000
1000
  let b = d.options, x = +/* @__PURE__ */ new Date();
1001
1001
  r(x);
@@ -1004,14 +1004,14 @@ var Rt = /* @__PURE__ */ function(e) {
1004
1004
  let n = Number(t.total || 0), r = Number(t.loaded || 0);
1005
1005
  return Math.max(n, r, e);
1006
1006
  }, T = (e, n, r) => {
1007
- let i = Ht(new Date(e), new Date(n), r);
1007
+ let i = Vt(new Date(e), new Date(n), r);
1008
1008
  m !== 100 && (m = i.total, a.events.emitUploadProgress({
1009
1009
  ...i,
1010
1010
  requestId: t,
1011
1011
  request: d
1012
1012
  }));
1013
1013
  }, E = (e, n, r) => {
1014
- let i = Ht(new Date(e), new Date(n), r);
1014
+ let i = Vt(new Date(e), new Date(n), r);
1015
1015
  h !== 100 && (h = i.total, a.events.emitDownloadProgress({
1016
1016
  ...i,
1017
1017
  requestId: t,
@@ -1067,21 +1067,21 @@ var Rt = /* @__PURE__ */ function(e) {
1067
1067
  requestId: t,
1068
1068
  request: d
1069
1069
  }), u;
1070
- }, te = (e) => {
1070
+ }, j = (e) => {
1071
1071
  u ||= +/* @__PURE__ */ new Date();
1072
1072
  let t = +/* @__PURE__ */ new Date();
1073
1073
  return p = w(p, e), E(u, t, {
1074
1074
  total: e.total || p,
1075
1075
  loaded: e.loaded || 0
1076
1076
  }), t;
1077
- }, ne = () => {
1077
+ }, te = () => {
1078
1078
  u ||= +/* @__PURE__ */ new Date();
1079
1079
  let e = +/* @__PURE__ */ new Date();
1080
1080
  return E(u, e, {
1081
1081
  total: p,
1082
1082
  loaded: p
1083
1083
  }), e;
1084
- }, re = async ({ data: e, error: r, status: i, extra: a }) => {
1084
+ }, ne = async ({ data: e, error: r, status: i, extra: a }) => {
1085
1085
  let o = {
1086
1086
  data: e,
1087
1087
  error: r ?? null,
@@ -1106,50 +1106,50 @@ var Rt = /* @__PURE__ */ function(e) {
1106
1106
  response: o
1107
1107
  }
1108
1108
  }), o;
1109
- }, j = Zt({
1109
+ }, M = Xt({
1110
1110
  request: d,
1111
1111
  requestId: t,
1112
1112
  startTime: x,
1113
1113
  logger: c,
1114
1114
  resolve: n
1115
- }), M = ({ status: e, extra: n }) => (c.error({
1115
+ }), N = ({ status: e, extra: n }) => (c.error({
1116
1116
  title: "Abort error",
1117
1117
  type: "request",
1118
1118
  extra: {
1119
1119
  request: d,
1120
1120
  requestId: t
1121
1121
  }
1122
- }), j({
1123
- error: i(V("abort")),
1122
+ }), M({
1123
+ error: i(jt("abort")),
1124
1124
  status: e,
1125
1125
  extra: n
1126
- })), N = ({ status: e, extra: n }) => (c.error({
1126
+ })), P = ({ status: e, extra: n }) => (c.error({
1127
1127
  title: "Timeout error",
1128
1128
  type: "request",
1129
1129
  extra: {
1130
1130
  request: d,
1131
1131
  requestId: t
1132
1132
  }
1133
- }), j({
1134
- error: V("timeout"),
1133
+ }), M({
1134
+ error: jt("timeout"),
1135
1135
  status: e,
1136
1136
  extra: n
1137
- })), ie = ({ status: e, extra: n }) => (c.error({
1137
+ })), re = ({ status: e, extra: n }) => (c.error({
1138
1138
  title: "Unexpected error",
1139
1139
  type: "request",
1140
1140
  extra: {
1141
1141
  request: d,
1142
1142
  requestId: t
1143
1143
  }
1144
- }), j({
1145
- error: V(),
1144
+ }), M({
1145
+ error: jt(),
1146
1146
  status: e,
1147
1147
  extra: n
1148
- })), P = () => a.getAbortController(v, t), ae = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1149
- let i = P();
1150
- if (!i) throw new jt("Controller is not found");
1148
+ })), F = () => a.getAbortController(v, t), ie = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1149
+ let i = F();
1150
+ if (!i) throw new kt("Controller is not found");
1151
1151
  let o = () => {
1152
- M({
1152
+ N({
1153
1153
  status: e,
1154
1154
  extra: n
1155
1155
  }), r(), a.events.emitAbort({
@@ -1169,36 +1169,36 @@ var Rt = /* @__PURE__ */ function(e) {
1169
1169
  adapterOptions: b
1170
1170
  }
1171
1171
  });
1172
- let oe = e.client.adapter.unstable_queryParamsMapper(d.queryParams), se = e.client.adapter.unstable_endpointMapper(d.endpoint), ce = e.client.adapter.unstable_headerMapper(d), { url: F } = e.client;
1172
+ let ae = e.client.adapter.unstable_queryParamsMapper(d.queryParams), oe = e.client.adapter.unstable_endpointMapper(d.endpoint), se = e.client.adapter.unstable_headerMapper(d), { url: I } = e.client;
1173
1173
  return {
1174
1174
  request: d,
1175
1175
  requestId: t,
1176
- url: F,
1177
- endpoint: se,
1178
- queryParams: oe,
1176
+ url: I,
1177
+ endpoint: oe,
1178
+ queryParams: ae,
1179
1179
  payload: y,
1180
- headers: ce,
1180
+ headers: se,
1181
1181
  adapter: e.client.adapter,
1182
1182
  adapterOptions: b,
1183
- getAbortController: P,
1183
+ getAbortController: F,
1184
1184
  getRequestStartTimestamp: S,
1185
1185
  getResponseStartTimestamp: C,
1186
- createAbortListener: ae,
1186
+ createAbortListener: ie,
1187
1187
  onBeforeRequest: D,
1188
1188
  onRequestStart: O,
1189
1189
  onRequestProgress: k,
1190
1190
  onRequestEnd: ee,
1191
1191
  onResponseStart: A,
1192
- onResponseProgress: te,
1193
- onResponseEnd: ne,
1194
- onSuccess: re,
1195
- onAbortError: M,
1196
- onTimeoutError: N,
1197
- onUnexpectedError: ie,
1198
- onError: j
1192
+ onResponseProgress: j,
1193
+ onResponseEnd: te,
1194
+ onSuccess: ne,
1195
+ onAbortError: N,
1196
+ onTimeoutError: P,
1197
+ onUnexpectedError: re,
1198
+ onError: M
1199
1199
  };
1200
1200
  };
1201
- function Zt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1201
+ function Xt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1202
1202
  let { client: a } = e;
1203
1203
  return async ({ error: o, status: s, extra: c }) => {
1204
1204
  let l = {
@@ -1227,8 +1227,8 @@ function Zt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1227
1227
  }), l;
1228
1228
  };
1229
1229
  }
1230
- var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTimeoutError: i, onRequestEnd: a, createAbortListener: o, onResponseProgress: s, onRequestProgress: c, onResponseStart: l, onBeforeRequest: u, onRequestStart: d, onSuccess: f, onAbortError: p, adapter: m }) => {
1231
- if (!e.unstable_mock) throw new jt("Mock should be defined when calling mocker");
1230
+ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTimeoutError: i, onRequestEnd: a, createAbortListener: o, onResponseProgress: s, onRequestProgress: c, onResponseStart: l, onBeforeRequest: u, onRequestStart: d, onSuccess: f, onAbortError: p, adapter: m }) => {
1231
+ if (!e.unstable_mock) throw new kt("Mock should be defined when calling mocker");
1232
1232
  let h = !1, { requestTime: g = 20, responseTime: _ = 20, totalUploaded: v = 1e3, totalDownloaded: y = 1e3, timeout: b } = e.unstable_mock.config, { data: x, error: S, status: C, success: w = !0, extra: T = e.client.adapter.defaultExtra } = await e.unstable_mock.fn({
1233
1233
  request: e,
1234
1234
  requestId: t
@@ -1272,7 +1272,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1272
1272
  status: C,
1273
1273
  extra: T
1274
1274
  }), h || r();
1275
- }, $t = (e) => e, en = class {
1275
+ }, Qt = (e) => e, $t = class {
1276
1276
  unstable_fetcher;
1277
1277
  name;
1278
1278
  defaultMethod;
@@ -1294,10 +1294,10 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1294
1294
  initialize = (e) => (this.logger = e.loggerManager.initialize(e, "Adapter"), this.initialized = !0, this.client = e, this.unstable_onInitializeCallback?.({ client: e }), this);
1295
1295
  onInitialize = (e) => (this.unstable_onInitializeCallback = e, this);
1296
1296
  unstable_internalErrorMapping = (e) => e;
1297
- unstable_headerMapper = Pt;
1298
- unstable_payloadMapper = Ft;
1299
- unstable_endpointMapper = $t;
1300
- unstable_queryParamsMapper = $t;
1297
+ unstable_headerMapper = Nt;
1298
+ unstable_payloadMapper = Pt;
1299
+ unstable_endpointMapper = Qt;
1300
+ unstable_queryParamsMapper = Qt;
1301
1301
  unstable_getAdapterDefaults;
1302
1302
  unstable_getRequestDefaults;
1303
1303
  unstable_devtoolsEndpointGetter = (e) => e;
@@ -1321,14 +1321,14 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1321
1321
  async fetch(e, t) {
1322
1322
  let n, r = async (r) => {
1323
1323
  try {
1324
- if (!this.initialized) throw new jt(`Adapter ${this.options.name} is not initialized`);
1325
- if (!this.unstable_fetcher) throw new jt(`Fetcher for ${this.options.name} adapter is not set`);
1324
+ if (!this.initialized) throw new kt(`Adapter ${this.options.name} is not initialized`);
1325
+ if (!this.unstable_fetcher) throw new kt(`Fetcher for ${this.options.name} adapter is not set`);
1326
1326
  this.client.triggerPlugins("onAdapterFetch", {
1327
1327
  adapter: this,
1328
1328
  request: e,
1329
1329
  requestId: t
1330
1330
  });
1331
- let i = await Xt({
1331
+ let i = await Yt({
1332
1332
  request: e,
1333
1333
  requestId: t,
1334
1334
  resolve: r,
@@ -1337,9 +1337,9 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1337
1337
  n = e;
1338
1338
  }
1339
1339
  });
1340
- return e.unstable_mock && e.isMockerEnabled && e.client.isMockerEnabled ? await Qt(i) : this.unstable_fetcher(i);
1340
+ return e.unstable_mock && e.isMockerEnabled && e.client.isMockerEnabled ? await Zt(i) : this.unstable_fetcher(i);
1341
1341
  } catch (i) {
1342
- return Zt({
1342
+ return Xt({
1343
1343
  request: e,
1344
1344
  requestId: t,
1345
1345
  startTime: n || Date.now(),
@@ -1356,66 +1356,66 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1356
1356
  r(e);
1357
1357
  });
1358
1358
  }
1359
- }, tn = (e) => {
1359
+ }, en = (e) => {
1360
1360
  try {
1361
1361
  return JSON.parse(e);
1362
1362
  } catch {
1363
1363
  return e;
1364
1364
  }
1365
- }, nn = (e) => e ? tn(e) : V(), rn = (e) => (t) => {
1365
+ }, tn = (e) => e ? en(e) : jt(), nn = (e) => (t) => {
1366
1366
  let { skipNull: n, skipEmptyString: r } = e;
1367
1367
  return !(r && t === void 0 || r && t === "" || n && t === null);
1368
- }, U = (e, { encode: t, strict: n }) => t && n ? encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`) : t ? encodeURIComponent(e) : e, an = (e, t, n) => {
1369
- let r = !rn(n)(t);
1370
- return !e || r ? "" : `${U(e, n)}=${U(t instanceof Date ? n.dateParser?.(t) || t.toISOString() : typeof t == "object" && !Array.isArray(t) ? n.objectParser?.(t) || JSON.stringify(t) : String(t), n)}`;
1371
- }, on = (e, t, n) => {
1368
+ }, W = (e, { encode: t, strict: n }) => t && n ? encodeURIComponent(e).replace(/[!'()*]/g, (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`) : t ? encodeURIComponent(e) : e, rn = (e, t, n) => {
1369
+ let r = !nn(n)(t);
1370
+ return !e || r ? "" : `${W(e, n)}=${W(t instanceof Date ? n.dateParser?.(t) || t.toISOString() : typeof t == "object" && !Array.isArray(t) ? n.objectParser?.(t) || JSON.stringify(t) : String(t), n)}`;
1371
+ }, an = (e, t, n) => {
1372
1372
  let { arrayFormat: r, arraySeparator: i } = n;
1373
- return t.filter(rn(n)).reduce((t, a, o) => {
1373
+ return t.filter(nn(n)).reduce((t, a, o) => {
1374
1374
  switch (r) {
1375
1375
  case "index": {
1376
- let r = `${U(e, n)}[${U(String(o), n)}]=`;
1377
- t.push(`${r}${U(String(a), n)}`);
1376
+ let r = `${W(e, n)}[${W(String(o), n)}]=`;
1377
+ t.push(`${r}${W(String(a), n)}`);
1378
1378
  break;
1379
1379
  }
1380
1380
  case "bracket": {
1381
- let r = `${U(e, n)}[]=`;
1382
- t.push(`${r}${U(String(a), n)}`);
1381
+ let r = `${W(e, n)}[]=`;
1382
+ t.push(`${r}${W(String(a), n)}`);
1383
1383
  break;
1384
1384
  }
1385
1385
  case "comma": {
1386
- let r = !t.length && `${U(e, n)}=` || "";
1387
- return [[...t, `${r}${U(String(a), n)}`].join(",")];
1386
+ let r = !t.length && `${W(e, n)}=` || "";
1387
+ return [[...t, `${r}${W(String(a), n)}`].join(",")];
1388
1388
  }
1389
1389
  case "separator": {
1390
- let r = !t.length && `${U(e, n)}=` || "";
1391
- return [[...t, `${r}${U(String(a), n)}`].join(i || "|")];
1390
+ let r = !t.length && `${W(e, n)}=` || "";
1391
+ return [[...t, `${r}${W(String(a), n)}`].join(i || "|")];
1392
1392
  }
1393
1393
  case "bracket-separator": {
1394
- let r = !t.length && `${U(e, n)}[]=` || "";
1395
- return [[...t, `${r}${U(String(a), n)}`].join(i || "|")];
1394
+ let r = !t.length && `${W(e, n)}[]=` || "";
1395
+ return [[...t, `${r}${W(String(a), n)}`].join(i || "|")];
1396
1396
  }
1397
1397
  default: {
1398
- let r = `${U(e, n)}=`;
1399
- t.push(`${r}${U(String(a), n)}`);
1398
+ let r = `${W(e, n)}=`;
1399
+ t.push(`${r}${W(String(a), n)}`);
1400
1400
  }
1401
1401
  }
1402
1402
  return t;
1403
1403
  }, []).join("&");
1404
- }, sn = (e, t = In) => {
1404
+ }, on = (e, t = Fn) => {
1405
1405
  if (!e || !Object.keys(e).length) return "";
1406
1406
  if (typeof e == "string") return e[0] === "?" ? e : `?${e}`;
1407
- let n = Object.entries(e).map(([e, n]) => Array.isArray(n) ? on(e, n, t) : an(e, n, t)).filter(Boolean).join("&");
1407
+ let n = Object.entries(e).map(([e, n]) => Array.isArray(n) ? an(e, n, t) : rn(e, n, t)).filter(Boolean).join("&");
1408
1408
  return n ? `?${n}` : "";
1409
- }, cn = Jt.SEC * 5, ln = { headers: {} }, un = () => new en({
1409
+ }, sn = qt.SEC * 5, cn = { headers: {} }, ln = () => new $t({
1410
1410
  name: "http",
1411
- defaultMethod: Rt.GET,
1412
- defaultExtra: ln,
1411
+ defaultMethod: Lt.GET,
1412
+ defaultExtra: cn,
1413
1413
  systemErrorStatus: 0,
1414
- systemErrorExtra: ln
1415
- }).setQueryParamsMapper(sn).setFetcher(async ({ request: e, adapterOptions: t, headers: n, payload: r, onError: i, onResponseEnd: a, onTimeoutError: o, onRequestEnd: s, createAbortListener: c, getAbortController: l, onResponseProgress: u, onResponseStart: d, onBeforeRequest: f, onRequestStart: p, onRequestProgress: m, onSuccess: h }) => {
1416
- let { method: g, client: _, endpoint: v, queryParams: y } = e, b = y ? sn(y) : "", x = `${_.url}${v}${b}`, S = l(), { timeout: C = cn, streaming: w = !1, ...T } = t || {}, E = !1, D, O = c({
1414
+ systemErrorExtra: cn
1415
+ }).setQueryParamsMapper(on).setFetcher(async ({ request: e, adapterOptions: t, headers: n, payload: r, onError: i, onResponseEnd: a, onTimeoutError: o, onRequestEnd: s, createAbortListener: c, getAbortController: l, onResponseProgress: u, onResponseStart: d, onBeforeRequest: f, onRequestStart: p, onRequestProgress: m, onSuccess: h }) => {
1416
+ let { method: g, client: _, endpoint: v, queryParams: y } = e, b = y ? on(y) : "", x = `${_.url}${v}${b}`, S = l(), { timeout: C = sn, streaming: w = !1, ...T } = t || {}, E = !1, D, O = c({
1417
1417
  status: 0,
1418
- extra: ln
1418
+ extra: cn
1419
1419
  });
1420
1420
  C > 0 && S && (D = setTimeout(() => {
1421
1421
  E = !0, O(), S.abort();
@@ -1447,7 +1447,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1447
1447
  status: l,
1448
1448
  extra: c
1449
1449
  }) : i({
1450
- error: nn(await t.text()),
1450
+ error: tn(await t.text()),
1451
1451
  status: l,
1452
1452
  extra: c
1453
1453
  });
@@ -1468,11 +1468,11 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1468
1468
  e = new TextDecoder().decode(o);
1469
1469
  } else e = await t.text();
1470
1470
  a(), O(), t.ok ? h({
1471
- data: tn(e),
1471
+ data: en(e),
1472
1472
  status: l,
1473
1473
  extra: c
1474
1474
  }) : i({
1475
- error: nn(e),
1475
+ error: tn(e),
1476
1476
  status: l,
1477
1477
  extra: c
1478
1478
  });
@@ -1481,18 +1481,18 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1481
1481
  if (D && clearTimeout(D), O(), S?.signal?.aborted) {
1482
1482
  E && o({
1483
1483
  status: 0,
1484
- extra: ln
1484
+ extra: cn
1485
1485
  });
1486
1486
  return;
1487
1487
  }
1488
1488
  i({
1489
1489
  error: e,
1490
1490
  status: 0,
1491
- extra: ln
1491
+ extra: cn
1492
1492
  });
1493
1493
  }
1494
- }), dn = () => un(), fn = class {
1495
- emitter = new Fe();
1494
+ }), un = () => ln(), dn = class {
1495
+ emitter = new Pe();
1496
1496
  events;
1497
1497
  storage;
1498
1498
  lazyStorage;
@@ -1503,7 +1503,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1503
1503
  constructor(e) {
1504
1504
  this.options = e;
1505
1505
  let { storage: t = /* @__PURE__ */ new Map(), lazyStorage: n, version: r = "0.0.1" } = e ?? {};
1506
- this.emitter?.setMaxListeners(1e3), this.events = bn(this.emitter), this.storage = t, this.version = r, this.lazyStorage = n;
1506
+ this.emitter?.setMaxListeners(1e3), this.events = yn(this.emitter), this.storage = t, this.version = r, this.lazyStorage = n;
1507
1507
  }
1508
1508
  initialize = (e) => (this.client = e, this.logger = e.loggerManager.initialize(e, "Cache"), e.appManager.events.onOnline(() => {
1509
1509
  [...this.storage.keys()].forEach(this.scheduleGarbageCollector);
@@ -1517,7 +1517,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1517
1517
  response: t
1518
1518
  }
1519
1519
  });
1520
- let { cacheKey: n, cache: r, staleTime: i, cacheTime: a, scope: o } = e, s = H(n, o), c = this.storage.get(s), l = typeof t == "function" ? t(c || null) : t, u = pn(c, l), d = {
1520
+ let { cacheKey: n, cache: r, staleTime: i, cacheTime: a, scope: o } = e, s = U(n, o), c = this.storage.get(s), l = typeof t == "function" ? t(c || null) : t, u = fn(c, l), d = {
1521
1521
  ...u,
1522
1522
  scope: o,
1523
1523
  staleTime: i,
@@ -1563,7 +1563,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1563
1563
  partialResponse: t
1564
1564
  }
1565
1565
  });
1566
- let { cacheKey: n, scope: r } = e, i = H(n, r), a = this.storage.get(i), o = typeof t == "function" ? t(a || null) : t;
1566
+ let { cacheKey: n, scope: r } = e, i = U(n, r), a = this.storage.get(i), o = typeof t == "function" ? t(a || null) : t;
1567
1567
  a && this.set(e, {
1568
1568
  ...a,
1569
1569
  ...o
@@ -1601,7 +1601,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1601
1601
  cacheKey: t
1602
1602
  }), this.events.emitInvalidation(t);
1603
1603
  };
1604
- e instanceof Yt ? n(H(e.cacheKey, e.scope), e.cacheKey) : typeof e == "string" ? n(e) : t.length && t.forEach((t) => {
1604
+ e instanceof Jt ? n(U(e.cacheKey, e.scope), e.cacheKey) : typeof e == "string" ? n(e) : t.length && t.forEach((t) => {
1605
1605
  e.test(t) && n(t);
1606
1606
  });
1607
1607
  };
@@ -1656,49 +1656,49 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1656
1656
  clear = async () => {
1657
1657
  this.garbageCollectors.forEach((e) => clearTimeout(e)), this.storage.clear();
1658
1658
  };
1659
- }, pn = (e, t) => {
1659
+ }, fn = (e, t) => {
1660
1660
  let { data: n, success: r } = t, i = !r && e ? e.data : null, a = n || i;
1661
1661
  return {
1662
1662
  ...t,
1663
1663
  data: a
1664
1664
  };
1665
- }, mn = () => "invalidate", hn = (e) => `${e}_invalidate`, gn = () => "delete", _n = (e) => `${e}_delete`, vn = (e) => `${e}_cache`, yn = () => "cache", bn = (e) => ({
1665
+ }, pn = () => "invalidate", mn = (e) => `${e}_invalidate`, hn = () => "delete", gn = (e) => `${e}_delete`, _n = (e) => `${e}_cache`, vn = () => "cache", yn = (e) => ({
1666
1666
  emitCacheData: (t, n = !1) => {
1667
- e.emit(yn(), t, n), e.emit(vn(t.cacheKey), t, n);
1667
+ e.emit(vn(), t, n), e.emit(_n(t.cacheKey), t, n);
1668
1668
  },
1669
1669
  emitInvalidation: (t, n = !1) => {
1670
- e.emit(mn(), t, n), e.emit(hn(t), n);
1670
+ e.emit(pn(), t, n), e.emit(mn(t), n);
1671
1671
  },
1672
1672
  emitDelete: (t, n = !1) => {
1673
- e.emit(gn(), t, n), e.emit(_n(t), n);
1673
+ e.emit(hn(), t, n), e.emit(gn(t), n);
1674
1674
  },
1675
- onData: (t) => (e.on(yn(), t), () => e.removeListener(yn(), t)),
1676
- onDataByKey: (t, n) => (e.on(vn(t), n), () => e.removeListener(vn(t), n)),
1677
- onInvalidate: (t) => (e.on(mn(), t), () => e.removeListener(mn(), t)),
1678
- onInvalidateByKey: (t, n) => (e.on(hn(t), n), () => e.removeListener(hn(t), n)),
1679
- onDelete: (t) => (e.on(gn(), t), () => e.removeListener(gn(), t)),
1680
- onDeleteByKey: (t, n) => (e.on(_n(t), n), () => e.removeListener(_n(t), n))
1681
- }), W = /* @__PURE__ */ function(e) {
1675
+ onData: (t) => (e.on(vn(), t), () => e.removeListener(vn(), t)),
1676
+ onDataByKey: (t, n) => (e.on(_n(t), n), () => e.removeListener(_n(t), n)),
1677
+ onInvalidate: (t) => (e.on(pn(), t), () => e.removeListener(pn(), t)),
1678
+ onInvalidateByKey: (t, n) => (e.on(mn(t), n), () => e.removeListener(mn(t), n)),
1679
+ onDelete: (t) => (e.on(hn(), t), () => e.removeListener(hn(), t)),
1680
+ onDeleteByKey: (t, n) => (e.on(gn(t), n), () => e.removeListener(gn(t), n))
1681
+ }), G = /* @__PURE__ */ function(e) {
1682
1682
  return e.ONE_BY_ONE = "one-by-one", e.ALL_AT_ONCE = "all-at-once", e.PREVIOUS_CANCELED = "previous-canceled", e.DEDUPLICATED = "deduplicated", e;
1683
- }({}), xn = (e) => ({
1683
+ }({}), bn = (e) => ({
1684
1684
  emitDrained: (t, n) => {
1685
- e.emit(Cn(), t, n), e.emit(wn(t.queryKey), t, n);
1685
+ e.emit(Sn(), t, n), e.emit(Cn(t.queryKey), t, n);
1686
1686
  },
1687
1687
  emitQueueStatusChanged: (t, n) => {
1688
- e.emit(Tn(), t, n), e.emit(En(t.queryKey), t, n);
1688
+ e.emit(wn(), t, n), e.emit(Tn(t.queryKey), t, n);
1689
1689
  },
1690
1690
  emitQueueChanged: (t, n) => {
1691
- e.emit(Dn(), t, n), e.emit(On(t.queryKey), t, n);
1691
+ e.emit(En(), t, n), e.emit(Dn(t.queryKey), t, n);
1692
1692
  },
1693
- onDrained: (t) => (e.on(Cn(), t), () => e.removeListener(Cn(), t)),
1694
- onDrainedByKey: (t, n) => (e.on(wn(t), n), () => e.removeListener(wn(t), n)),
1695
- onQueueStatusChange: (t) => (e.on(Tn(), t), () => e.removeListener(Tn(), t)),
1696
- onQueueStatusChangeByKey: (t, n) => (e.on(En(t), n), () => e.removeListener(En(t), n)),
1697
- onQueueChange: (t) => (e.on(Dn(), t), () => e.removeListener(Dn(), t)),
1698
- onQueueChangeByKey: (t, n) => (e.on(On(t), n), () => e.removeListener(On(t), n))
1699
- }), Sn = class {
1700
- emitter = new Fe();
1701
- events = xn(this.emitter);
1693
+ onDrained: (t) => (e.on(Sn(), t), () => e.removeListener(Sn(), t)),
1694
+ onDrainedByKey: (t, n) => (e.on(Cn(t), n), () => e.removeListener(Cn(t), n)),
1695
+ onQueueStatusChange: (t) => (e.on(wn(), t), () => e.removeListener(wn(), t)),
1696
+ onQueueStatusChangeByKey: (t, n) => (e.on(Tn(t), n), () => e.removeListener(Tn(t), n)),
1697
+ onQueueChange: (t) => (e.on(En(), t), () => e.removeListener(En(), t)),
1698
+ onQueueChangeByKey: (t, n) => (e.on(Dn(t), n), () => e.removeListener(Dn(t), n))
1699
+ }), xn = class {
1700
+ emitter = new Pe();
1701
+ events = bn(this.emitter);
1702
1702
  storage = /* @__PURE__ */ new Map();
1703
1703
  requestCount = /* @__PURE__ */ new Map();
1704
1704
  runningRequests = /* @__PURE__ */ new Map();
@@ -1707,7 +1707,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1707
1707
  constructor(e) {
1708
1708
  this.options = e, this.emitter?.setMaxListeners(1e3), this.options?.storage && (this.storage = this.options.storage);
1709
1709
  }
1710
- isRequestJSON = (e) => !(e instanceof Yt);
1710
+ isRequestJSON = (e) => !(e instanceof Jt);
1711
1711
  initialize = (e) => (this.client = e, this.logger = e.loggerManager.initialize(e, "Dispatcher"), this.client.appManager.events.onOnline(() => {
1712
1712
  this.flush();
1713
1713
  }), this);
@@ -1831,14 +1831,14 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1831
1831
  hasRunningRequest = (e, t) => !!this.getRunningRequests(e).find((e) => e.requestId === t);
1832
1832
  cancelRunningRequests = (e) => {
1833
1833
  this.runningRequests.get(e)?.forEach((e) => {
1834
- let t = H(e.request.abortKey, e.request.scope);
1834
+ let t = U(e.request.abortKey, e.request.scope);
1835
1835
  this.client.requestManager.abortByRequestId(t, e.requestId);
1836
1836
  }), this.deleteRunningRequests(e);
1837
1837
  };
1838
1838
  cancelRunningRequest = (e, t) => {
1839
1839
  let n = this.getRunningRequests(e).filter((e) => {
1840
1840
  if (e.requestId === t) {
1841
- let t = H(e.request.abortKey, e.request.scope);
1841
+ let t = U(e.request.abortKey, e.request.scope);
1842
1842
  return this.client.requestManager.abortByRequestId(t, e.requestId), !1;
1843
1843
  }
1844
1844
  return !0;
@@ -1866,7 +1866,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1866
1866
  resolved: !1
1867
1867
  });
1868
1868
  add = (e) => {
1869
- let t = H(e.queryKey, e.scope), n = this.createStorageItem(e), { requestId: r } = n, [i] = this.getQueue(t).requests.slice(-1), a = jn(e, i);
1869
+ let t = U(e.queryKey, e.scope), n = this.createStorageItem(e), { requestId: r } = n, [i] = this.getQueue(t).requests.slice(-1), a = An(e, i);
1870
1870
  switch (this.logger.debug({
1871
1871
  title: "Adding request to queue",
1872
1872
  type: "system",
@@ -1876,9 +1876,9 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1876
1876
  requestId: r
1877
1877
  }
1878
1878
  }), a) {
1879
- case W.ONE_BY_ONE: return this.addQueueItem(t, n), this.flushQueue(t), r;
1880
- case W.PREVIOUS_CANCELED: return this.cancelRunningRequests(t), this.clearQueue(t), this.addQueueItem(t, n), this.flushQueue(t), r;
1881
- case W.DEDUPLICATED: return this.client.requestManager.events.emitDeduplicated({
1879
+ case G.ONE_BY_ONE: return this.addQueueItem(t, n), this.flushQueue(t), r;
1880
+ case G.PREVIOUS_CANCELED: return this.cancelRunningRequests(t), this.clearQueue(t), this.addQueueItem(t, n), this.flushQueue(t), r;
1881
+ case G.DEDUPLICATED: return this.client.requestManager.events.emitDeduplicated({
1882
1882
  request: i.request,
1883
1883
  requestId: r,
1884
1884
  deduplicatedRequest: e
@@ -1920,7 +1920,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1920
1920
  requestId: n
1921
1921
  }
1922
1922
  });
1923
- let { retry: r, retryTime: i, queryKey: a, abortKey: o, offline: s, scope: c } = t, l = H(a, c), u = H(o, c), { adapter: d, requestManager: f, cache: p, appManager: m } = this.client, h = kn(e.retries, r), g = !m.isOnline && s, _ = this.hasRunningRequest(l, n), v = e.stopped;
1923
+ let { retry: r, retryTime: i, queryKey: a, abortKey: o, offline: s, scope: c } = t, l = U(a, c), u = U(o, c), { adapter: d, requestManager: f, cache: p, appManager: m } = this.client, h = On(e.retries, r), g = !m.isOnline && s, _ = this.hasRunningRequest(l, n), v = e.stopped;
1924
1924
  if (g || _ || v) return this.logger.warning({
1925
1925
  title: "Unable to perform request",
1926
1926
  type: "system",
@@ -1940,7 +1940,7 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1940
1940
  }), this.incrementQueueRequestCount(l), f.addAbortController(u, n);
1941
1941
  let b = await d.fetch(t, n);
1942
1942
  e.resolved = !0, f.removeAbortController(u, n);
1943
- let x = !m.isOnline, S = V("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1943
+ let x = !m.isOnline, S = jt("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1944
1944
  this.deleteRunningRequest(l, n);
1945
1945
  let w = b.success || !h || !t.retryOnError || t.retryOnError(b), T = !b.success && h && w && !C && !x, E = {
1946
1946
  isCanceled: C,
@@ -2054,26 +2054,26 @@ var Qt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
2054
2054
  }
2055
2055
  }), this.delete(l, n, u));
2056
2056
  };
2057
- }, Cn = () => "drained-event", wn = (e) => `${e}-drained-event`, Tn = () => "status-event", En = (e) => `${e}-status-event`, Dn = () => "change-event", On = (e) => `${e}-change-event`, kn = (e, t) => !!(t && e < t), An = (e, t) => e.deduplicateTime ? +/* @__PURE__ */ new Date() - t.timestamp <= e.deduplicateTime : !0, jn = (e, t) => {
2058
- let { queued: n, cancelable: r, deduplicate: i } = e, a = t ? An(e, t) : !1;
2059
- return n ? W.ONE_BY_ONE : r ? W.PREVIOUS_CANCELED : a && i ? W.DEDUPLICATED : W.ALL_AT_ONCE;
2057
+ }, Sn = () => "drained-event", Cn = (e) => `${e}-drained-event`, wn = () => "status-event", Tn = (e) => `${e}-status-event`, En = () => "change-event", Dn = (e) => `${e}-change-event`, On = (e, t) => !!(t && e < t), kn = (e, t) => e.deduplicateTime ? +/* @__PURE__ */ new Date() - t.timestamp <= e.deduplicateTime : !0, An = (e, t) => {
2058
+ let { queued: n, cancelable: r, deduplicate: i } = e, a = t ? kn(e, t) : !1;
2059
+ return n ? G.ONE_BY_ONE : r ? G.PREVIOUS_CANCELED : a && i ? G.DEDUPLICATED : G.ALL_AT_ONCE;
2060
2060
  };
2061
- function Mn(e) {
2061
+ function jn(e) {
2062
2062
  return e === "client" || e === "server" ? e : typeof window < "u" && typeof document < "u" ? "client" : "server";
2063
2063
  }
2064
- var Nn = async (e, t) => {
2064
+ var Mn = async (e, t) => {
2065
2065
  let n = t;
2066
2066
  if (!t.requestOptions.disableRequestInterceptors) {
2067
2067
  for (let r of e) if (n = await r(t), !n) throw Error("Request modifier must return request");
2068
2068
  }
2069
2069
  return n;
2070
- }, Pn = async (e, t, n) => {
2070
+ }, Nn = async (e, t, n) => {
2071
2071
  let r = t;
2072
2072
  if (!n.requestOptions.disableResponseInterceptors) {
2073
2073
  for (let i of e) if (r = await i(t, n), !r) throw Error("Response modifier must return data");
2074
2074
  }
2075
2075
  return r;
2076
- }, Fn = class {
2076
+ }, Pn = class {
2077
2077
  url;
2078
2078
  mode;
2079
2079
  debug;
@@ -2082,8 +2082,8 @@ var Nn = async (e, t) => {
2082
2082
  unstable_onResponseCallbacks = [];
2083
2083
  unstable_onAuthCallbacks = [];
2084
2084
  unstable_onRequestCallbacks = [];
2085
- loggerManager = new bt();
2086
- requestManager = new Ue();
2085
+ loggerManager = new vt();
2086
+ requestManager = new Ve();
2087
2087
  appManager;
2088
2088
  adapter;
2089
2089
  cache;
@@ -2091,15 +2091,15 @@ var Nn = async (e, t) => {
2091
2091
  submitDispatcher;
2092
2092
  isMockerEnabled = !0;
2093
2093
  plugins = [];
2094
- unstable_abortKeyMapper = Ut;
2095
- unstable_cacheKeyMapper = Wt;
2096
- unstable_queryKeyMapper = Wt;
2097
- unstable_requestIdMapper = Me;
2094
+ unstable_abortKeyMapper = Ht;
2095
+ unstable_cacheKeyMapper = Ut;
2096
+ unstable_queryKeyMapper = Ut;
2097
+ unstable_requestIdMapper = je;
2098
2098
  logger = this.loggerManager.initialize(this, "Client");
2099
2099
  constructor(e) {
2100
2100
  this.options = e;
2101
2101
  let { url: t, appManager: n, cache: r, fetchDispatcher: i, submitDispatcher: a, mode: o } = this.options;
2102
- this.url = t, this.mode = Mn(o), this.adapter = dn(), this.appManager = n?.() || new Ie(), this.cache = r?.() || new fn(), this.fetchDispatcher = i?.() || new Sn(), this.submitDispatcher = a?.() || new Sn(), this.adapter.initialize(this), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2102
+ this.url = t, this.mode = jn(o), this.adapter = un(), this.appManager = n?.() || new Fe(), this.cache = r?.() || new dn(), this.fetchDispatcher = i?.() || new xn(), this.submitDispatcher = a?.() || new xn(), this.adapter.initialize(this), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2103
2103
  }
2104
2104
  setDebug = (e) => (this.debug = e, this);
2105
2105
  setLogLevel = (e) => (this.loggerManager.setSeverity(e), this);
@@ -2128,15 +2128,15 @@ var Nn = async (e, t) => {
2128
2128
  setCacheKeyMapper = (e) => (this.unstable_cacheKeyMapper = e, this);
2129
2129
  setQueryKeyMapper = (e) => (this.unstable_queryKeyMapper = e, this);
2130
2130
  setRequestIdMapper = (e) => (this.unstable_requestIdMapper = e, this);
2131
- unstable_modifyAuth = async (e) => Nn(this.unstable_onAuthCallbacks, e);
2132
- unstable_modifyRequest = async (e) => Nn(this.unstable_onRequestCallbacks, e);
2133
- unstable_modifyErrorResponse = async (e, t) => Pn(this.unstable_onErrorCallbacks, e, t);
2134
- unstable_modifySuccessResponse = async (e, t) => Pn(this.unstable_onSuccessCallbacks, e, t);
2135
- unstable_modifyResponse = async (e, t) => Pn(this.unstable_onResponseCallbacks, e, t);
2136
- fromJSON = (e) => Yt.fromJSON(this, e);
2131
+ unstable_modifyAuth = async (e) => Mn(this.unstable_onAuthCallbacks, e);
2132
+ unstable_modifyRequest = async (e) => Mn(this.unstable_onRequestCallbacks, e);
2133
+ unstable_modifyErrorResponse = async (e, t) => Nn(this.unstable_onErrorCallbacks, e, t);
2134
+ unstable_modifySuccessResponse = async (e, t) => Nn(this.unstable_onSuccessCallbacks, e, t);
2135
+ unstable_modifyResponse = async (e, t) => Nn(this.unstable_onResponseCallbacks, e, t);
2136
+ fromJSON = (e) => Jt.fromJSON(this, e);
2137
2137
  clear = () => {
2138
2138
  let { appManager: e, cache: t, fetchDispatcher: n, submitDispatcher: r } = this.options;
2139
- this.requestManager.abortControllers.clear(), this.fetchDispatcher.clear(), this.submitDispatcher.clear(), this.cache.clear(), this.requestManager.emitter.removeAllListeners(), this.fetchDispatcher.emitter.removeAllListeners(), this.submitDispatcher.emitter.removeAllListeners(), this.cache.emitter.removeAllListeners(), this.cache = t?.() || new fn(), this.appManager = e?.() || new Ie(), this.fetchDispatcher = n?.() || new Sn(), this.submitDispatcher = r?.() || new Sn(), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2139
+ this.requestManager.abortControllers.clear(), this.fetchDispatcher.clear(), this.submitDispatcher.clear(), this.cache.clear(), this.requestManager.emitter.removeAllListeners(), this.fetchDispatcher.emitter.removeAllListeners(), this.submitDispatcher.emitter.removeAllListeners(), this.cache.emitter.removeAllListeners(), this.cache = t?.() || new dn(), this.appManager = e?.() || new Fe(), this.fetchDispatcher = n?.() || new xn(), this.submitDispatcher = r?.() || new xn(), this.appManager.initialize(), this.cache.initialize(this), this.fetchDispatcher.initialize(this), this.submitDispatcher.initialize(this);
2140
2140
  };
2141
2141
  hydrate = (e, t) => {
2142
2142
  e?.forEach((e) => {
@@ -2153,8 +2153,8 @@ var Nn = async (e, t) => {
2153
2153
  ...a,
2154
2154
  ...t
2155
2155
  };
2156
- if (!s.override && this.cache.get(H(n, r))) return;
2157
- let c = tn(i);
2156
+ if (!s.override && this.cache.get(U(n, r))) return;
2157
+ let c = en(i);
2158
2158
  this.cache.set({
2159
2159
  ...s,
2160
2160
  cacheKey: n,
@@ -2166,10 +2166,10 @@ var Nn = async (e, t) => {
2166
2166
  let t = this.adapter.unstable_endpointMapper(e.endpoint), n = {
2167
2167
  ...e,
2168
2168
  endpoint: String(t)
2169
- }, r = new Yt(this, n);
2169
+ }, r = new Jt(this, n);
2170
2170
  return this.plugins.forEach((e) => e.trigger("onRequestCreate", { request: r })), r;
2171
2171
  };
2172
- }, In = {
2172
+ }, Fn = {
2173
2173
  strict: !0,
2174
2174
  encode: !0,
2175
2175
  arrayFormat: "bracket",
@@ -2178,101 +2178,101 @@ var Nn = async (e, t) => {
2178
2178
  skipNull: !0,
2179
2179
  skipEmptyString: !0
2180
2180
  };
2181
- function Ln(e) {
2182
- return new Fn(e);
2181
+ function In(e) {
2182
+ return new Pn(e);
2183
2183
  }
2184
2184
  //#endregion
2185
2185
  //#region src/core/client.ts
2186
- var G = Ln({ url: F() });
2186
+ var K = In({ url: I() });
2187
2187
  //#endregion
2188
2188
  //#region src/core/auth-api.ts
2189
- async function Rn(e) {
2190
- let { data: t, success: n } = await G.createRequest()({
2189
+ async function Ln(e) {
2190
+ let { data: t, success: n } = await K.createRequest()({
2191
2191
  endpoint: "/auth/cli/whoami",
2192
2192
  method: "GET"
2193
2193
  }).setHeaders({ Authorization: `Bearer ${e}` }).send();
2194
2194
  return !n || !t ? null : t;
2195
2195
  }
2196
- async function zn(e) {
2197
- await G.createRequest()({
2196
+ async function Rn(e) {
2197
+ await K.createRequest()({
2198
2198
  endpoint: "/auth/cli/token",
2199
2199
  method: "DELETE"
2200
2200
  }).setHeaders({ Authorization: `Bearer ${e}` }).send();
2201
2201
  }
2202
2202
  //#endregion
2203
2203
  //#region src/core/auth-store.ts
2204
- var Bn = 1, Vn = "hype-stack", Hn = "auth.json";
2205
- function Un() {
2204
+ var zn = 1, Bn = "hype-stack", Vn = "auth.json";
2205
+ function Hn() {
2206
2206
  let e = process.env.HYPE_STACK_CONFIG_DIR;
2207
- if (e) return T.join(e, Vn);
2207
+ if (e) return T.join(e, Bn);
2208
2208
  let t = w.homedir();
2209
2209
  if (process.platform === "win32") {
2210
2210
  let e = process.env.APPDATA ?? T.join(t, "AppData", "Roaming");
2211
- return T.join(e, Vn);
2211
+ return T.join(e, Bn);
2212
2212
  }
2213
- if (process.platform === "darwin") return T.join(t, "Library", "Application Support", Vn);
2213
+ if (process.platform === "darwin") return T.join(t, "Library", "Application Support", Bn);
2214
2214
  let n = process.env.XDG_CONFIG_HOME ?? T.join(t, ".config");
2215
- return T.join(n, Vn);
2215
+ return T.join(n, Bn);
2216
2216
  }
2217
- function Wn() {
2218
- return T.join(Un(), Hn);
2217
+ function Un() {
2218
+ return T.join(Hn(), Vn);
2219
2219
  }
2220
- async function Gn() {
2221
- let e = await y.readFile(Wn(), "utf-8").catch(() => null);
2220
+ async function Wn() {
2221
+ let e = await y.readFile(Un(), "utf-8").catch(() => null);
2222
2222
  if (!e) return {
2223
- version: Bn,
2223
+ version: zn,
2224
2224
  tokens: {}
2225
2225
  };
2226
2226
  let t = JSON.parse(e);
2227
2227
  return {
2228
- version: t.version ?? Bn,
2228
+ version: t.version ?? zn,
2229
2229
  tokens: t.tokens ?? {}
2230
2230
  };
2231
2231
  }
2232
- async function Kn(e) {
2233
- let t = Un();
2234
- await y.mkdir(t, { recursive: !0 }), await y.writeFile(Wn(), `${JSON.stringify(e, null, 2)}\n`, { mode: 384 });
2232
+ async function Gn(e) {
2233
+ let t = Hn();
2234
+ await y.mkdir(t, { recursive: !0 }), await y.writeFile(Un(), `${JSON.stringify(e, null, 2)}\n`, { mode: 384 });
2235
2235
  }
2236
- async function qn(e) {
2237
- return (await Gn()).tokens[e] ?? null;
2236
+ async function Kn(e) {
2237
+ return (await Wn()).tokens[e] ?? null;
2238
2238
  }
2239
- async function Jn(e, t) {
2240
- let n = await Gn();
2241
- n.tokens[e] = t, await Kn(n);
2239
+ async function qn(e, t) {
2240
+ let n = await Wn();
2241
+ n.tokens[e] = t, await Gn(n);
2242
2242
  }
2243
- async function Yn(e) {
2244
- let t = await Gn();
2245
- e in t.tokens && (delete t.tokens[e], await Kn(t));
2243
+ async function Jn(e) {
2244
+ let t = await Wn();
2245
+ e in t.tokens && (delete t.tokens[e], await Gn(t));
2246
2246
  }
2247
2247
  //#endregion
2248
2248
  //#region src/core/device.ts
2249
- function Xn() {
2249
+ function Yn() {
2250
2250
  let e = w.networkInterfaces();
2251
2251
  for (let t of Object.values(e)) if (t) {
2252
2252
  for (let e of t) if (!e.internal && e.mac !== "00:00:00:00:00:00") return e.mac;
2253
2253
  }
2254
2254
  return "unknown";
2255
2255
  }
2256
- function Zn() {
2257
- let e = `${Xn()}:${w.hostname()}:${w.platform()}:${w.arch()}`;
2256
+ function Xn() {
2257
+ let e = `${Yn()}:${w.hostname()}:${w.platform()}:${w.arch()}`;
2258
2258
  return x("sha256").update(e).digest("hex").slice(0, 16);
2259
2259
  }
2260
- function Qn() {
2260
+ function Zn() {
2261
2261
  return `hype-stack/${A} ${w.platform()} ${w.arch()} node/${process.version.slice(1)}`;
2262
2262
  }
2263
2263
  //#endregion
2264
2264
  //#region src/core/open-browser.ts
2265
- function $n(e) {
2265
+ function Qn(e) {
2266
2266
  E(process.platform === "darwin" ? `open "${e}"` : process.platform === "win32" ? `start "" "${e}"` : `xdg-open "${e}"`);
2267
2267
  }
2268
2268
  //#endregion
2269
2269
  //#region src/core/login.ts
2270
- var er = 300 * 1e3, tr = (e) => `<!doctype html><html><head><meta charset="utf-8"><title>Hype Stack CLI</title></head><body style="font-family:system-ui,sans-serif;text-align:center;padding-top:4rem;color:#111"><h2>${e}</h2><p>You can close this tab and return to your terminal.</p></body></html>`;
2271
- async function nr(e = {}) {
2272
- let t = S(16).toString("hex"), n = F(), r = C.createServer(), i = await new Promise((n, i) => {
2270
+ var $n = 300 * 1e3, er = (e) => `<!doctype html><html><head><meta charset="utf-8"><title>Hype Stack CLI</title></head><body style="font-family:system-ui,sans-serif;text-align:center;padding-top:4rem;color:#111"><h2>${e}</h2><p>You can close this tab and return to your terminal.</p></body></html>`;
2271
+ async function tr(e = {}) {
2272
+ let t = S(16).toString("hex"), n = I(), r = C.createServer(), i = await new Promise((n, i) => {
2273
2273
  let a = setTimeout(() => {
2274
2274
  o(), i(/* @__PURE__ */ Error("Login timed out. Run `npx @hype-stack/cli login` again."));
2275
- }, er);
2275
+ }, $n);
2276
2276
  function o() {
2277
2277
  clearTimeout(a), r.close(), r.closeAllConnections?.();
2278
2278
  }
@@ -2286,7 +2286,7 @@ async function nr(e = {}) {
2286
2286
  r.writeHead(200, {
2287
2287
  "Content-Type": "text/html",
2288
2288
  Connection: "close"
2289
- }), r.end(tr(e));
2289
+ }), r.end(er(e));
2290
2290
  };
2291
2291
  if (a.searchParams.get("state") !== t) {
2292
2292
  s("Login failed."), o(), i(/* @__PURE__ */ Error("Login failed: state mismatch. Run `npx @hype-stack/cli login` again."));
@@ -2301,53 +2301,53 @@ async function nr(e = {}) {
2301
2301
  }), r.on("error", (e) => {
2302
2302
  o(), i(e);
2303
2303
  }), r.listen(0, "127.0.0.1", () => {
2304
- let { port: n } = r.address(), i = encodeURIComponent(Qn()), a = `${le()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2305
- e.onUrl?.(a), $n(a);
2304
+ let { port: n } = r.address(), i = encodeURIComponent(Zn()), a = `${ce()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2305
+ e.onUrl?.(a), Qn(a);
2306
2306
  });
2307
- }), a = await Rn(i).catch(() => null), o = {
2307
+ }), a = await Ln(i).catch(() => null), o = {
2308
2308
  token: i,
2309
2309
  email: a?.email,
2310
2310
  organizationId: a?.organizationId
2311
2311
  };
2312
- return await Jn(n, o), o;
2312
+ return await qn(n, o), o;
2313
2313
  }
2314
2314
  //#endregion
2315
2315
  //#region src/core/access-prompts.ts
2316
- async function rr() {
2316
+ async function nr() {
2317
2317
  let e = await s.confirm({ message: "Log in to install packs your organization owns? (opens your browser)" });
2318
2318
  if (s.isCancel(e) || !e) return null;
2319
2319
  s.log.step("Opening your browser to sign in...");
2320
2320
  try {
2321
- let e = await nr({ onUrl: (e) => {
2322
- s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
2321
+ let e = await tr({ onUrl: (e) => {
2322
+ s.log.info(`If your browser didn't open, visit:\n ${z.path(e)}`);
2323
2323
  } });
2324
2324
  return s.log.success(e.email ? `Logged in as ${e.email}` : "Logged in"), e.token;
2325
2325
  } catch (e) {
2326
2326
  return s.log.error(e instanceof Error ? e.message : String(e)), null;
2327
2327
  }
2328
2328
  }
2329
- async function ir(e) {
2329
+ async function rr(e) {
2330
2330
  if (e.length === 0) return;
2331
2331
  s.note([
2332
2332
  "These packs need a purchase before they can be installed:",
2333
2333
  "",
2334
- ...e.map((e) => ` ${R.brand(e.displayName)} ${R.highlight(`$${e.price}`)}`)
2334
+ ...e.map((e) => ` ${z.brand(e.displayName)} ${z.highlight(`$${e.price}`)}`)
2335
2335
  ].join("\n"), "Locked Packs");
2336
2336
  let t = await s.confirm({ message: `Open the purchase ${e.length === 1 ? "page" : "pages"} in your browser?` });
2337
2337
  if (s.isCancel(t) || !t) {
2338
- s.log.info(R.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2338
+ s.log.info(z.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2339
2339
  return;
2340
2340
  }
2341
- for (let t of e) $n(Se(t.name));
2341
+ for (let t of e) Qn(xe(t.name));
2342
2342
  s.log.info([
2343
- R.muted("After purchasing, run:"),
2344
- ` ${R.highlight("npx @hype-stack/cli login")} ${R.muted("Save your access")}`,
2345
- ` ${R.highlight("npx @hype-stack/cli compose")} ${R.muted("Install the packs")}`
2343
+ z.muted("After purchasing, run:"),
2344
+ ` ${z.highlight("npx @hype-stack/cli login")} ${z.muted("Save your access")}`,
2345
+ ` ${z.highlight("npx @hype-stack/cli compose")} ${z.muted("Install the packs")}`
2346
2346
  ].join("\n"));
2347
2347
  }
2348
2348
  //#endregion
2349
2349
  //#region src/utils/exec.ts
2350
- function K(e, t, n) {
2350
+ function q(e, t, n) {
2351
2351
  return new Promise((r, i) => {
2352
2352
  let a = D(e, t, {
2353
2353
  cwd: n.cwd,
@@ -2378,7 +2378,7 @@ function K(e, t, n) {
2378
2378
  });
2379
2379
  });
2380
2380
  }
2381
- function ar(e, t, n) {
2381
+ function ir(e, t, n) {
2382
2382
  return new Promise((r, i) => {
2383
2383
  let a = D(e, t, {
2384
2384
  cwd: n.cwd,
@@ -2395,7 +2395,7 @@ function ar(e, t, n) {
2395
2395
  }
2396
2396
  //#endregion
2397
2397
  //#region src/utils/fs.ts
2398
- async function q(e) {
2398
+ async function ar(e) {
2399
2399
  return (await y.stat(e).catch(() => null))?.isDirectory() ?? !1;
2400
2400
  }
2401
2401
  async function J(e) {
@@ -2413,7 +2413,7 @@ async function cr(e, t) {
2413
2413
  }
2414
2414
  async function lr(e) {
2415
2415
  let t = {};
2416
- if (!await q(e)) return t;
2416
+ if (!await ar(e)) return t;
2417
2417
  let n = await y.readdir(e, { withFileTypes: !0 });
2418
2418
  for (let r of n) r.isDirectory() && await J(T.join(e, r.name, "package.json")) && (t[r.name] = T.relative(T.dirname(e), T.join(e, r.name)));
2419
2419
  return t;
@@ -2430,24 +2430,24 @@ function dr(e, t) {
2430
2430
  //#endregion
2431
2431
  //#region src/core/codegen.ts
2432
2432
  function fr(e) {
2433
- s.log.info(R.muted("Run database setup yourself when ready:")), s.note([
2434
- `${R.command(`cd ${e}`)}`,
2435
- `${R.command("pnpm exec prisma generate")} ${R.muted("(regenerate the Prisma client)")}`,
2436
- `${R.command("pnpm exec prisma migrate dev")} ${R.muted("(create + apply tables for new packs)")}`
2433
+ s.log.info(z.muted("Run database setup yourself when ready:")), s.note([
2434
+ `${z.command(`cd ${e}`)}`,
2435
+ `${z.command("pnpm exec prisma generate")} ${z.muted("(regenerate the Prisma client)")}`,
2436
+ `${z.command("pnpm exec prisma migrate dev")} ${z.muted("(create + apply tables for new packs)")}`
2437
2437
  ].join("\n"), "Database Setup");
2438
2438
  }
2439
2439
  async function pr(e) {
2440
- let { projectRoot: t, paths: n, skipPrompts: r, dbReady: i, freshScaffold: a, runCommand: o = ar } = e, c = n.backend.root, l = T.join(t, c);
2440
+ let { projectRoot: t, paths: n, skipPrompts: r, dbReady: i, freshScaffold: a, runCommand: o = ir } = e, c = n.backend.root, l = T.join(t, c);
2441
2441
  if (!await J(T.join(l, "package.json"))) return;
2442
2442
  if (!r) {
2443
- s.log.step(R.muted(`Generating Prisma client (${R.command("prisma generate")})...`));
2443
+ s.log.step(z.muted(`Generating Prisma client (${z.command("prisma generate")})...`));
2444
2444
  let e = await o("pnpm", [
2445
2445
  "exec",
2446
2446
  "prisma",
2447
2447
  "generate"
2448
2448
  ], { cwd: l });
2449
2449
  if (e.exitCode !== 0) {
2450
- s.log.error(R.muted("prisma generate failed. See the output above, or finish setup manually:")), mr(e), fr(c);
2450
+ s.log.error(z.muted("prisma generate failed. See the output above, or finish setup manually:")), mr(e), fr(c);
2451
2451
  return;
2452
2452
  }
2453
2453
  s.log.success("Prisma client generated");
@@ -2457,14 +2457,14 @@ async function pr(e) {
2457
2457
  return;
2458
2458
  }
2459
2459
  let u = await s.confirm({
2460
- message: `Run database setup now? (${R.command("prisma migrate dev")})`,
2460
+ message: `Run database setup now? (${z.command("prisma migrate dev")})`,
2461
2461
  initialValue: !0
2462
2462
  });
2463
2463
  if (s.isCancel(u) || !u) {
2464
2464
  fr(c);
2465
2465
  return;
2466
2466
  }
2467
- s.log.step(R.muted(`Running ${R.command("prisma migrate dev --name add-packs")}...`));
2467
+ s.log.step(z.muted(`Running ${z.command("prisma migrate dev --name add-packs")}...`));
2468
2468
  let d = await o("pnpm", [
2469
2469
  "exec",
2470
2470
  "prisma",
@@ -2479,7 +2479,7 @@ async function pr(e) {
2479
2479
  initialValue: !0
2480
2480
  });
2481
2481
  if (!s.isCancel(e) && e) {
2482
- s.log.step(R.muted(`Resetting dev database (${R.command("prisma migrate reset --force")})...`));
2482
+ s.log.step(z.muted(`Resetting dev database (${z.command("prisma migrate reset --force")})...`));
2483
2483
  let e = await o("pnpm", [
2484
2484
  "exec",
2485
2485
  "prisma",
@@ -2487,7 +2487,7 @@ async function pr(e) {
2487
2487
  "reset",
2488
2488
  "--force"
2489
2489
  ], { cwd: l });
2490
- if (e.exitCode === 0) s.log.step(R.muted(`Running ${R.command("prisma migrate dev --name add-packs")}...`)), d = await o("pnpm", [
2490
+ if (e.exitCode === 0) s.log.step(z.muted(`Running ${z.command("prisma migrate dev --name add-packs")}...`)), d = await o("pnpm", [
2491
2491
  "exec",
2492
2492
  "prisma",
2493
2493
  "migrate",
@@ -2496,20 +2496,20 @@ async function pr(e) {
2496
2496
  "add-packs"
2497
2497
  ], { cwd: l });
2498
2498
  else {
2499
- s.log.error(R.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), mr(e), fr(c);
2499
+ s.log.error(z.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), mr(e), fr(c);
2500
2500
  return;
2501
2501
  }
2502
2502
  }
2503
2503
  }
2504
2504
  if (d.exitCode !== 0) {
2505
- s.log.error(R.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), mr(d), fr(c);
2505
+ s.log.error(z.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), mr(d), fr(c);
2506
2506
  return;
2507
2507
  }
2508
2508
  s.log.success("Database schema applied");
2509
2509
  }
2510
2510
  function mr(e) {
2511
2511
  let t = (e.stderr || e.stdout).trim();
2512
- t && s.log.warn(R.muted(t));
2512
+ t && s.log.warn(z.muted(t));
2513
2513
  }
2514
2514
  //#endregion
2515
2515
  //#region src/core/onboard-catalog.ts
@@ -2623,13 +2623,13 @@ function Dr(e) {
2623
2623
  //#endregion
2624
2624
  //#region src/core/stack-config.ts
2625
2625
  async function Or(e) {
2626
- return sr(T.join(e, ne));
2626
+ return sr(T.join(e, te));
2627
2627
  }
2628
2628
  async function kr(e) {
2629
- return J(T.join(e, ne));
2629
+ return J(T.join(e, te));
2630
2630
  }
2631
2631
  async function Ar(e, t) {
2632
- await cr(T.join(e, ne), t);
2632
+ await cr(T.join(e, te), t);
2633
2633
  }
2634
2634
  async function jr(e) {
2635
2635
  let t = T.join(e, "apps"), n = T.join(e, "packages"), [r, i] = await Promise.all([lr(t), lr(n)]);
@@ -2674,7 +2674,7 @@ function Mr(e) {
2674
2674
  }
2675
2675
  function Nr(e, t) {
2676
2676
  return {
2677
- $schema: de(),
2677
+ $schema: ue(),
2678
2678
  version: 1,
2679
2679
  name: e,
2680
2680
  apps: t.apps,
@@ -2685,7 +2685,7 @@ function Nr(e, t) {
2685
2685
  };
2686
2686
  }
2687
2687
  async function Pr(e) {
2688
- let t = T.join(e, "package.json"), n = T.join(e, "apps"), [r, i] = await Promise.all([J(t), q(n)]);
2688
+ let t = T.join(e, "package.json"), n = T.join(e, "apps"), [r, i] = await Promise.all([J(t), ar(n)]);
2689
2689
  return r && i;
2690
2690
  }
2691
2691
  function X(e, t) {
@@ -2700,7 +2700,7 @@ function X(e, t) {
2700
2700
  //#endregion
2701
2701
  //#region src/core/registry.ts
2702
2702
  async function Fr(e) {
2703
- let { data: t, error: n, status: r } = await G.createRequest()({
2703
+ let { data: t, error: n, status: r } = await K.createRequest()({
2704
2704
  endpoint: `/packs/${encodeURIComponent(e)}/manifest`,
2705
2705
  method: "GET"
2706
2706
  }).send();
@@ -2709,12 +2709,12 @@ async function Fr(e) {
2709
2709
  return t;
2710
2710
  }
2711
2711
  async function Ir(e, t = {}) {
2712
- let n = G.createRequest()({
2712
+ let n = K.createRequest()({
2713
2713
  endpoint: `/packs/${encodeURIComponent(e)}/download`,
2714
2714
  method: "POST"
2715
2715
  }), r = {
2716
- "X-Device-Id": Zn(),
2717
- "X-Client-Info": Qn()
2716
+ "X-Device-Id": Xn(),
2717
+ "X-Client-Info": Zn()
2718
2718
  };
2719
2719
  t.token && (r.Authorization = `Bearer ${t.token}`);
2720
2720
  let { data: i, error: a, success: o } = await n.setPayload({ key: t.licenseKey ?? void 0 }).setHeaders(r).send();
@@ -2741,7 +2741,7 @@ function Lr(e, t, n) {
2741
2741
  function Rr(e, t) {
2742
2742
  return T.join(t, e);
2743
2743
  }
2744
- var zr = G.createRequest()({
2744
+ var zr = K.createRequest()({
2745
2745
  endpoint: "/packs/list",
2746
2746
  method: "GET"
2747
2747
  });
@@ -2752,7 +2752,7 @@ async function Br() {
2752
2752
  }
2753
2753
  async function Vr(e, t = {}) {
2754
2754
  if (e.length === 0) return {};
2755
- let n = G.createRequest()({
2755
+ let n = K.createRequest()({
2756
2756
  endpoint: "/packs/authorize",
2757
2757
  method: "POST"
2758
2758
  }), r = {};
@@ -2895,13 +2895,56 @@ function ii(e, t) {
2895
2895
  return i === -1 ? e : e.slice(0, i) + n + "\n" + e.slice(i);
2896
2896
  }
2897
2897
  async function ai(e, t, n) {
2898
- let r = T.resolve(n, X("{{enums.src}}", t), "index.ts");
2898
+ let r = T.resolve(n, X("{{backend.root}}", t), "src/context.ts");
2899
2899
  if (!await J(r)) return;
2900
2900
  let i = await y.readFile(r, "utf-8");
2901
- for (let t of e) i.includes(`from "${t.from}"`) || (i = oi(i, t));
2901
+ for (let t of e) i = oi(i, t);
2902
2902
  await y.writeFile(r, i, "utf-8");
2903
2903
  }
2904
2904
  function oi(e, t) {
2905
+ let n = si(t), r = RegExp(`^[ \\t]*export let ${n}[ \\t]*:[ \\t]*([^;\\n]+);[ \\t]*$`, "m"), i = e.match(r)?.[1] ?? "", a = e;
2906
+ a = ci(a, r), a = ci(a, RegExp(`^[ \\t]*${n}[ \\t]*:[ \\t]*[^;\\n]+;[ \\t]*$`, "m")), a = ci(a, RegExp(`^[ \\t]*${n}[ \\t]*=[ \\t]*[^;\\n]*;[ \\t]*$`, "m"));
2907
+ for (let e of li(i)) ui(a, e) || (a = di(a, e));
2908
+ return a;
2909
+ }
2910
+ function si(e) {
2911
+ return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2912
+ }
2913
+ function ci(e, t) {
2914
+ let n = t.exec(e);
2915
+ if (!n || n.index === void 0) return e;
2916
+ let r = n.index, i = r + n[0].length;
2917
+ return e[i] === "\n" && (i += 1), e.slice(0, r) + e.slice(i);
2918
+ }
2919
+ function li(e) {
2920
+ let t = e.match(/[A-Za-z_$][A-Za-z0-9_$]*/g) ?? [];
2921
+ return [...new Set(t)];
2922
+ }
2923
+ function ui(e, t) {
2924
+ let n = RegExp(`\\b${si(t)}\\b`);
2925
+ return e.split("\n").filter((e) => !e.trimStart().startsWith("import ")).some((e) => n.test(e));
2926
+ }
2927
+ function di(e, t) {
2928
+ let n = RegExp(`\\b${si(t)}\\b`);
2929
+ return e.split("\n").flatMap((e) => {
2930
+ if (!e.trimStart().startsWith("import ") || !n.test(e)) return [e];
2931
+ let r = e.match(/^(\s*import\s+(?:type\s+)?)\{([^}]*)\}(\s+from\s+["'][^"']+["'];?\s*)$/);
2932
+ if (r) {
2933
+ let e = r[2].split(",").map((e) => e.trim()).filter(Boolean).filter((e) => e.replace(/^type\s+/, "") !== t);
2934
+ return e.length === 0 ? [] : [`${r[1]}{ ${e.join(", ")} }${r[3]}`];
2935
+ }
2936
+ let i = e.match(/^\s*import\s+(?:type\s+)?([A-Za-z0-9_$]+)\s+from\s+["'][^"']+["'];?\s*$/);
2937
+ return i && i[1] === t ? [] : [e];
2938
+ }).join("\n");
2939
+ }
2940
+ async function fi(e, t, n) {
2941
+ let r = T.resolve(n, X("{{enums.src}}", t), "index.ts");
2942
+ if (!await J(r)) return;
2943
+ let i = await y.readFile(r, "utf-8");
2944
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = pi(i, t));
2945
+ await y.writeFile(r, i, "utf-8");
2946
+ }
2947
+ function pi(e, t) {
2905
2948
  let n = `export * from "${t.from}";`, r = e.lastIndexOf("export * from");
2906
2949
  if (r !== -1) {
2907
2950
  let t = e.indexOf("\n", r);
@@ -2909,14 +2952,14 @@ function oi(e, t) {
2909
2952
  }
2910
2953
  return e.trim() === "" ? n + "\n" : e.trimEnd() + "\n" + n + "\n";
2911
2954
  }
2912
- async function si(e, t, n) {
2955
+ async function mi(e, t, n) {
2913
2956
  let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
2914
2957
  if (!await J(i)) return;
2915
2958
  let a = await y.readFile(i, "utf-8");
2916
- for (let t of e) a.includes(`from "${t.from}"`) || (a = ci(a, t), a = li(a, t));
2917
- await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = ui(a)), await y.writeFile(i, a, "utf-8");
2959
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = hi(a, t), a = gi(a, t));
2960
+ await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = _i(a)), await y.writeFile(i, a, "utf-8");
2918
2961
  }
2919
- function ci(e, t) {
2962
+ function hi(e, t) {
2920
2963
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2921
2964
  if (r !== -1) {
2922
2965
  let t = e.indexOf("\n", r);
@@ -2925,7 +2968,7 @@ function ci(e, t) {
2925
2968
  let i = e.indexOf("const sockets");
2926
2969
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2927
2970
  }
2928
- function li(e, t) {
2971
+ function gi(e, t) {
2929
2972
  let n = `.socket("${t.prefix}", ${t.import})`, r = e.indexOf("const sockets");
2930
2973
  if (r === -1) return e;
2931
2974
  let i = e.indexOf("new SocketRouter", r);
@@ -2939,7 +2982,7 @@ function li(e, t) {
2939
2982
  }
2940
2983
  return e;
2941
2984
  }
2942
- function ui(e) {
2985
+ function _i(e) {
2943
2986
  if (e.includes("wsAuthenticate")) return e;
2944
2987
  let t = e.indexOf("from \"@backend/libs/websocket/socket-router\""), n = e;
2945
2988
  if (t !== -1) {
@@ -2948,14 +2991,14 @@ function ui(e) {
2948
2991
  }
2949
2992
  return n.replace("new SocketRouter()", "new SocketRouter({ authenticate: wsAuthenticate })");
2950
2993
  }
2951
- async function di(e, t, n) {
2994
+ async function vi(e, t, n) {
2952
2995
  let r = X("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
2953
2996
  if (!await J(i)) return;
2954
2997
  let a = await y.readFile(i, "utf-8");
2955
- for (let t of e) a.includes(`.$configure(${t.import})`) || (a = fi(a, t), a = pi(a, t));
2998
+ for (let t of e) a.includes(`.$configure(${t.import})`) || (a = yi(a, t), a = bi(a, t));
2956
2999
  await y.writeFile(i, a, "utf-8");
2957
3000
  }
2958
- function fi(e, t) {
3001
+ function yi(e, t) {
2959
3002
  let n = `import { ${t.import} } from "${t.from}";`;
2960
3003
  if (e.includes(n)) return e;
2961
3004
  let r = e.lastIndexOf("from \"./");
@@ -2966,20 +3009,20 @@ function fi(e, t) {
2966
3009
  let i = e.indexOf("export const sdk");
2967
3010
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2968
3011
  }
2969
- function pi(e, t) {
3012
+ function bi(e, t) {
2970
3013
  let n = `.$configure(${t.import})`, r = e.indexOf("export const sdk");
2971
3014
  if (r === -1) return e;
2972
3015
  let i = e.indexOf(";", r);
2973
3016
  return i === -1 ? e : e.slice(0, i) + "\n " + n + e.slice(i);
2974
3017
  }
2975
- async function mi(e, t, n) {
3018
+ async function xi(e, t, n) {
2976
3019
  let r = T.resolve(n, X("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
2977
3020
  if (!await J(r)) return;
2978
3021
  let i = await y.readFile(r, "utf-8");
2979
- for (let t of e) i.includes(`"${t.path}"`) || (i = hi(i, t));
3022
+ for (let t of e) i.includes(`"${t.path}"`) || (i = Si(i, t));
2980
3023
  await y.writeFile(r, i, "utf-8");
2981
3024
  }
2982
- function hi(e, t) {
3025
+ function Si(e, t) {
2983
3026
  let n = ` "${t.path}": ${t.search};`, r = e.indexOf("type RouteDefinitions = {");
2984
3027
  if (r === -1) return e;
2985
3028
  let i = e.indexOf("{", r);
@@ -2995,20 +3038,20 @@ function hi(e, t) {
2995
3038
  }
2996
3039
  return o === -1 ? e : e.slice(0, o) + n + "\n" + e.slice(o);
2997
3040
  }
2998
- var gi = "import { type LucideIcon } from \"lucide-react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n\nexport type NavItem = {\n label: string;\n icon: LucideIcon;\n to: string;\n params?: Record<string, string>;\n};\n\nexport type NavSection = {\n label: string;\n icon: LucideIcon;\n items: NavItem[];\n};\n\nexport type NavSectionLink = NavSection & { to: string; params?: Record<string, string> };\n\nexport type NavEntry = NavSection | NavSectionLink;\n\n/* -------------------------------------------------------------------------------------------------\n * Navigation\n * -----------------------------------------------------------------------------------------------*/\n\nexport const primaryNav: NavEntry[] = [];\n\nexport const secondaryNav: NavEntry[] = [];\n\nexport const tertiaryNav: NavEntry[] = [];\n\nexport const settingsNav: NavEntry[] = [];\n", _i = {
3041
+ var Ci = "import { type LucideIcon } from \"lucide-react\";\n\n/* -------------------------------------------------------------------------------------------------\n * Types\n * -----------------------------------------------------------------------------------------------*/\n\nexport type NavItem = {\n label: string;\n icon: LucideIcon;\n to: string;\n params?: Record<string, string>;\n};\n\nexport type NavSection = {\n label: string;\n icon: LucideIcon;\n items: NavItem[];\n};\n\nexport type NavSectionLink = NavSection & { to: string; params?: Record<string, string> };\n\nexport type NavEntry = NavSection | NavSectionLink;\n\n/* -------------------------------------------------------------------------------------------------\n * Navigation\n * -----------------------------------------------------------------------------------------------*/\n\nexport const primaryNav: NavEntry[] = [];\n\nexport const secondaryNav: NavEntry[] = [];\n\nexport const tertiaryNav: NavEntry[] = [];\n\nexport const settingsNav: NavEntry[] = [];\n", wi = {
2999
3042
  primary: "primaryNav",
3000
3043
  secondary: "secondaryNav",
3001
3044
  tertiary: "tertiaryNav",
3002
3045
  settings: "settingsNav"
3003
3046
  };
3004
- async function vi(e) {
3047
+ async function Ti(e) {
3005
3048
  let { entries: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ur(i, n), o = T.resolve(r, a, "src/constants/nav.constants.ts"), s;
3006
- await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = gi);
3007
- for (let e of t) s.includes(`label: "${e.label}"`) || (s = xi(s, e));
3008
- for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = Ci(s, e));
3049
+ await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Ci);
3050
+ for (let e of t) s.includes(`label: "${e.label}"`) || (s = Oi(s, e));
3051
+ for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = Ai(s, e));
3009
3052
  await y.writeFile(o, s, "utf-8");
3010
3053
  }
3011
- async function yi(e) {
3054
+ async function Ei(e) {
3012
3055
  let { postLoginRedirect: t, paths: n, projectRoot: r, slot: i = "frontend" } = e, a = Ur(i, n), o = T.resolve(r, a, "src/features/auth/constants/auth.constants.ts");
3013
3056
  if (!await J(o)) return;
3014
3057
  let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
@@ -3016,17 +3059,17 @@ async function yi(e) {
3016
3059
  let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
3017
3060
  await y.writeFile(o, l, "utf-8");
3018
3061
  }
3019
- function bi(e) {
3062
+ function Di(e) {
3020
3063
  let t = [e.icon];
3021
3064
  if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
3022
3065
  return t;
3023
3066
  }
3024
- function xi(e, t) {
3025
- let n = bi(t), r = e;
3026
- for (let e of n) r = Si(r, e);
3067
+ function Oi(e, t) {
3068
+ let n = Di(t), r = e;
3069
+ for (let e of n) r = ki(r, e);
3027
3070
  return r;
3028
3071
  }
3029
- function Si(e, t) {
3072
+ function ki(e, t) {
3030
3073
  let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
3031
3074
  if (!n) return e;
3032
3075
  let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
@@ -3034,21 +3077,21 @@ function Si(e, t) {
3034
3077
  let i = r.findIndex((e) => e.startsWith("type "));
3035
3078
  return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
3036
3079
  }
3037
- function Ci(e, t) {
3038
- let n = _i[t.group];
3080
+ function Ai(e, t) {
3081
+ let n = wi[t.group];
3039
3082
  if (!n) return e;
3040
- let r = Ti(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
3083
+ let r = Mi(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
3041
3084
  if (!a) return e;
3042
- let o = e.indexOf(a[0]) + a[0].length, s = wi(e, o - 1);
3085
+ let o = e.indexOf(a[0]) + a[0].length, s = ji(e, o - 1);
3043
3086
  return s === -1 ? e : e.slice(o, s).trim() === "" ? e.slice(0, o) + "\n" + r + "\n" + e.slice(o) : e.slice(0, o) + "\n" + r + e.slice(o);
3044
3087
  }
3045
- function wi(e, t) {
3088
+ function ji(e, t) {
3046
3089
  let n = 0;
3047
3090
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3048
3091
  else if (e[r] === "]" && (n--, n === 0)) return r;
3049
3092
  return -1;
3050
3093
  }
3051
- function Ti(e) {
3094
+ function Mi(e) {
3052
3095
  let t = [];
3053
3096
  if (t.push(" {"), t.push(` label: "${e.label}",`), t.push(` icon: ${e.icon},`), e.to && t.push(` to: "${e.to}",`), e.params && t.push(` params: ${e.params},`), e.items && e.items.length > 0) {
3054
3097
  t.push(" items: [");
@@ -3064,14 +3107,14 @@ function Ti(e) {
3064
3107
  } else t.push(" items: [],");
3065
3108
  return t.push(" },"), t.join("\n");
3066
3109
  }
3067
- async function Ei(e, t, n) {
3110
+ async function Ni(e, t, n) {
3068
3111
  let r = X("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
3069
3112
  if (!await J(i)) return;
3070
3113
  let a = await y.readFile(i, "utf-8");
3071
- for (let t of e) a.includes(`from "${t.from}"`) || (a = Di(a, t), a = Oi(a, t));
3114
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = Pi(a, t), a = Fi(a, t));
3072
3115
  await y.writeFile(i, a, "utf-8");
3073
3116
  }
3074
- function Di(e, t) {
3117
+ function Pi(e, t) {
3075
3118
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
3076
3119
  if (r !== -1) {
3077
3120
  let t = e.indexOf("\n", e.indexOf(";", r));
@@ -3079,38 +3122,38 @@ function Di(e, t) {
3079
3122
  }
3080
3123
  return e.indexOf("type "), n + "\n\n" + e;
3081
3124
  }
3082
- function Oi(e, t) {
3125
+ function Fi(e, t) {
3083
3126
  let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
3084
3127
  if (!r) return e;
3085
- let i = e.indexOf(r[0]) + r[0].length, a = ki(e, i - 1);
3128
+ let i = e.indexOf(r[0]) + r[0].length, a = Ii(e, i - 1);
3086
3129
  return a === -1 ? e : e.slice(i, a).trim() === "" ? e.slice(0, a) + "\n" + n + "\n" + e.slice(a) : e.slice(0, a) + n + "\n" + e.slice(a);
3087
3130
  }
3088
- function ki(e, t) {
3131
+ function Ii(e, t) {
3089
3132
  let n = 0;
3090
3133
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3091
3134
  else if (e[r] === "]" && (n--, n === 0)) return r;
3092
3135
  return -1;
3093
3136
  }
3094
- var Ai = "import { type ComponentType } from \"react\";\n\nexport type NavbarAction = {\n id: string;\n component: ComponentType;\n};\n\nexport const navbarActions: NavbarAction[] = [];\n\nexport const userMenuActions: NavbarAction[] = [];\n";
3095
- async function ji(e) {
3096
- await Ni({
3137
+ var Li = "import { type ComponentType } from \"react\";\n\nexport type NavbarAction = {\n id: string;\n component: ComponentType;\n};\n\nexport const navbarActions: NavbarAction[] = [];\n\nexport const userMenuActions: NavbarAction[] = [];\n";
3138
+ async function Ri(e) {
3139
+ await Bi({
3097
3140
  ...e,
3098
3141
  arrayName: "navbarActions"
3099
3142
  });
3100
3143
  }
3101
- async function Mi(e) {
3102
- await Ni({
3144
+ async function zi(e) {
3145
+ await Bi({
3103
3146
  ...e,
3104
3147
  arrayName: "userMenuActions"
3105
3148
  });
3106
3149
  }
3107
- async function Ni({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3150
+ async function Bi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3108
3151
  let a = Ur(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
3109
- await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Ai);
3110
- for (let n of e) s = Pi(s, n), s = Fi(s, n, t);
3152
+ await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = Li);
3153
+ for (let n of e) s = Vi(s, n), s = Hi(s, n, t);
3111
3154
  await y.writeFile(o, s, "utf-8");
3112
3155
  }
3113
- function Pi(e, t) {
3156
+ function Vi(e, t) {
3114
3157
  let n = `import { ${t.import} } from "${t.from}";`;
3115
3158
  if (e.includes(n)) return e;
3116
3159
  let r = e.lastIndexOf("import ");
@@ -3118,38 +3161,38 @@ function Pi(e, t) {
3118
3161
  let i = e.indexOf("\n", r);
3119
3162
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
3120
3163
  }
3121
- function Fi(e, t, n) {
3164
+ function Hi(e, t, n) {
3122
3165
  let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
3123
3166
  if (!r) return e;
3124
- let i = e.indexOf(r[0]) + r[0].length, a = Ii(e, i - 1);
3167
+ let i = e.indexOf(r[0]) + r[0].length, a = Ui(e, i - 1);
3125
3168
  if (a === -1) return e;
3126
3169
  let o = e.slice(i, a);
3127
3170
  if (o.includes(`id: "${t.id}"`)) return e;
3128
3171
  let s = ` { id: "${t.id}", component: ${t.import} },`;
3129
3172
  return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
3130
3173
  }
3131
- function Ii(e, t) {
3174
+ function Ui(e, t) {
3132
3175
  let n = 0;
3133
3176
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3134
3177
  else if (e[r] === "]" && (n--, n === 0)) return r;
3135
3178
  return -1;
3136
3179
  }
3137
- var Li = new Set([
3180
+ var Wi = new Set([
3138
3181
  ".ts",
3139
3182
  ".tsx",
3140
3183
  ".js",
3141
3184
  ".jsx"
3142
3185
  ]);
3143
- async function Ri(e) {
3186
+ async function Gi(e) {
3144
3187
  let { files: t, paths: n, projectRoot: r, projectName: i } = e;
3145
3188
  if (i === "hype-stack") return;
3146
3189
  let a = `@${i}/`;
3147
3190
  await Promise.all(t.map(async (e) => {
3148
3191
  let t = Lr(e.target, n, r), i = await y.stat(t).catch(() => null);
3149
- i?.isDirectory() ? await Vi(t, a) : i?.isFile() && Li.has(T.extname(t)) && await Hi(t, a);
3192
+ i?.isDirectory() ? await Ji(t, a) : i?.isFile() && Wi.has(T.extname(t)) && await Yi(t, a);
3150
3193
  }));
3151
3194
  }
3152
- var zi = new Set([
3195
+ var Ki = new Set([
3153
3196
  ".git",
3154
3197
  "node_modules",
3155
3198
  "dist",
@@ -3158,20 +3201,20 @@ var zi = new Set([
3158
3201
  ".next",
3159
3202
  "coverage"
3160
3203
  ]);
3161
- async function Bi(e, t) {
3162
- t !== "hype-stack" && await Vi(e, `@${t}/`);
3204
+ async function qi(e, t) {
3205
+ t !== "hype-stack" && await Ji(e, `@${t}/`);
3163
3206
  }
3164
- async function Vi(e, t) {
3207
+ async function Ji(e, t) {
3165
3208
  let n = await y.readdir(e, { withFileTypes: !0 });
3166
3209
  await Promise.all(n.map(async (n) => {
3167
3210
  let r = T.join(e, n.name);
3168
3211
  if (n.isDirectory()) {
3169
- if (zi.has(n.name)) return;
3170
- await Vi(r, t);
3171
- } else n.isFile() && Li.has(T.extname(n.name)) && await Hi(r, t);
3212
+ if (Ki.has(n.name)) return;
3213
+ await Ji(r, t);
3214
+ } else n.isFile() && Wi.has(T.extname(n.name)) && await Yi(r, t);
3172
3215
  }));
3173
3216
  }
3174
- async function Hi(e, t) {
3217
+ async function Yi(e, t) {
3175
3218
  let n = await y.readFile(e, "utf-8");
3176
3219
  if (!n.includes(Hr)) return;
3177
3220
  let r = n.replaceAll(Hr, t);
@@ -3179,22 +3222,22 @@ async function Hi(e, t) {
3179
3222
  }
3180
3223
  //#endregion
3181
3224
  //#region src/core/installer.ts
3182
- function Ui(e, t) {
3225
+ function Xi(e, t) {
3183
3226
  return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
3184
3227
  }
3185
- async function Wi(e, t) {
3228
+ async function Zi(e, t) {
3186
3229
  if ((await y.stat(e)).isDirectory()) {
3187
3230
  await y.mkdir(t, { recursive: !0 });
3188
3231
  let n = await y.readdir(e, { withFileTypes: !0 });
3189
- for (let r of n) await Wi(T.join(e, r.name), T.join(t, r.name));
3232
+ for (let r of n) await Zi(T.join(e, r.name), T.join(t, r.name));
3190
3233
  } else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
3191
3234
  }
3192
- async function Gi(e) {
3235
+ async function Qi(e) {
3193
3236
  let { src: t, dest: n, projectRoot: r, skip: i } = e;
3194
3237
  if ((await y.stat(t)).isDirectory()) {
3195
3238
  await y.mkdir(n, { recursive: !0 });
3196
3239
  let e = await y.readdir(t, { withFileTypes: !0 });
3197
- return (await Promise.all(e.map((e) => Gi({
3240
+ return (await Promise.all(e.map((e) => Qi({
3198
3241
  src: T.join(t, e.name),
3199
3242
  dest: T.join(n, e.name),
3200
3243
  projectRoot: r,
@@ -3203,17 +3246,17 @@ async function Gi(e) {
3203
3246
  }
3204
3247
  return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
3205
3248
  }
3206
- async function Ki(e) {
3249
+ async function $i(e) {
3207
3250
  let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Rr(t.source, n), o = Lr(t.target, r, i);
3208
3251
  return {
3209
3252
  sourcePath: a,
3210
3253
  targetPath: o,
3211
- sourceExists: await J(a) || await q(a),
3212
- targetExists: await J(o) || await q(o)
3254
+ sourceExists: await J(a) || await ar(a),
3255
+ targetExists: await J(o) || await ar(o)
3213
3256
  };
3214
3257
  }
3215
- async function qi(e) {
3216
- let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await Ki({
3258
+ async function ea(e) {
3259
+ let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await $i({
3217
3260
  file: t,
3218
3261
  packDir: n,
3219
3262
  paths: r,
@@ -3228,8 +3271,8 @@ async function qi(e) {
3228
3271
  default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
3229
3272
  }
3230
3273
  }
3231
- async function Ji(e) {
3232
- let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await Ki({
3274
+ async function ta(e) {
3275
+ let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await $i({
3233
3276
  file: t,
3234
3277
  packDir: n,
3235
3278
  paths: r,
@@ -3247,7 +3290,7 @@ async function Ji(e) {
3247
3290
  status: "skipped",
3248
3291
  path: t.target,
3249
3292
  reason: "Already exists"
3250
- } : (await Wi(s, c), {
3293
+ } : (await Zi(s, c), {
3251
3294
  status: "installed",
3252
3295
  path: t.target
3253
3296
  });
@@ -3256,16 +3299,16 @@ async function Ji(e) {
3256
3299
  status: "skipped",
3257
3300
  path: t.target,
3258
3301
  reason: "Already exists (skip-if-exists)"
3259
- } : (await Wi(s, c), {
3302
+ } : (await Zi(s, c), {
3260
3303
  status: "installed",
3261
3304
  path: t.target
3262
3305
  });
3263
- case "override": return await Wi(s, c), {
3306
+ case "override": return await Zi(s, c), {
3264
3307
  status: "installed",
3265
3308
  path: t.target
3266
3309
  };
3267
3310
  case "merge": {
3268
- if (!u) return await Wi(s, c), {
3311
+ if (!u) return await Zi(s, c), {
3269
3312
  status: "installed",
3270
3313
  path: t.target
3271
3314
  };
@@ -3295,15 +3338,15 @@ async function Ji(e) {
3295
3338
  };
3296
3339
  }
3297
3340
  }
3298
- async function Yi(e) {
3341
+ async function na(e) {
3299
3342
  let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
3300
3343
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3301
3344
  let o = [], s = /* @__PURE__ */ new Set();
3302
3345
  for (let e of t) {
3303
3346
  let t = i?.get(e.manifest.name);
3304
3347
  for (let n of e.manifest.files) {
3305
- if (n.strategy !== "create" || !Ui(n, t)) continue;
3306
- let { targetPath: i, targetExists: c } = await Ki({
3348
+ if (n.strategy !== "create" || !Xi(n, t)) continue;
3349
+ let { targetPath: i, targetExists: c } = await $i({
3307
3350
  file: n,
3308
3351
  packDir: e.packDir,
3309
3352
  paths: a,
@@ -3318,13 +3361,13 @@ async function Yi(e) {
3318
3361
  }
3319
3362
  return o;
3320
3363
  }
3321
- async function Xi(e) {
3364
+ async function ra(e) {
3322
3365
  let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
3323
3366
  if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3324
3367
  let c = [];
3325
3368
  for (let e of t.files) {
3326
- if (!Ui(e, o)) continue;
3327
- let t = await qi({
3369
+ if (!Xi(e, o)) continue;
3370
+ let t = await ea({
3328
3371
  file: e,
3329
3372
  packDir: a,
3330
3373
  paths: s,
@@ -3335,16 +3378,16 @@ async function Xi(e) {
3335
3378
  }
3336
3379
  return c;
3337
3380
  }
3338
- async function Zi(e) {
3381
+ async function ia(e) {
3339
3382
  let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
3340
3383
  if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3341
3384
  let l = {
3342
3385
  installed: [],
3343
3386
  skipped: [],
3344
3387
  errors: []
3345
- }, u = t.files.filter((e) => Ui(e, s));
3388
+ }, u = t.files.filter((e) => Xi(e, s));
3346
3389
  for (let e of u) {
3347
- let t = await Ji({
3390
+ let t = await ta({
3348
3391
  file: e,
3349
3392
  packDir: o,
3350
3393
  paths: c,
@@ -3364,40 +3407,40 @@ async function Zi(e) {
3364
3407
  break;
3365
3408
  }
3366
3409
  }
3367
- await Ri({
3410
+ await Gi({
3368
3411
  files: u,
3369
3412
  paths: c,
3370
3413
  projectRoot: r,
3371
3414
  projectName: n.name
3372
- }), t.env && t.env.length > 0 && await Wr(t.env, c, r), t.routes && t.routes.length > 0 && await Xr(t.routes, c, r), t.context && t.context.length > 0 && await $r(t.context, c, r), t.sockets && t.sockets.length > 0 && await si(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await di(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await ai(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await mi(t.frontendRoutes, c, r);
3415
+ }), t.env && t.env.length > 0 && await Wr(t.env, c, r), t.routes && t.routes.length > 0 && await Xr(t.routes, c, r), t.context && t.context.length > 0 && await $r(t.context, c, r), t.contextRemove && t.contextRemove.length > 0 && await ai(t.contextRemove, c, r), t.sockets && t.sockets.length > 0 && await mi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await vi(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await fi(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await xi(t.frontendRoutes, c, r);
3373
3416
  let d = s && s.length > 0 ? s : ["frontend"];
3374
- for (let e of d) t.nav && t.nav.length > 0 && await vi({
3417
+ for (let e of d) t.nav && t.nav.length > 0 && await Ti({
3375
3418
  entries: t.nav,
3376
3419
  paths: c,
3377
3420
  projectRoot: r,
3378
3421
  slot: e
3379
- }), t.navbarActions && t.navbarActions.length > 0 && await ji({
3422
+ }), t.navbarActions && t.navbarActions.length > 0 && await Ri({
3380
3423
  actions: t.navbarActions,
3381
3424
  paths: c,
3382
3425
  projectRoot: r,
3383
3426
  slot: e
3384
- }), t.userMenuActions && t.userMenuActions.length > 0 && await Mi({
3427
+ }), t.userMenuActions && t.userMenuActions.length > 0 && await zi({
3385
3428
  actions: t.userMenuActions,
3386
3429
  paths: c,
3387
3430
  projectRoot: r,
3388
3431
  slot: e
3389
3432
  });
3390
- return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ei(t.onboardingSteps, c, r), t.postLoginRedirect && await yi({
3433
+ return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ni(t.onboardingSteps, c, r), t.postLoginRedirect && await Ei({
3391
3434
  postLoginRedirect: t.postLoginRedirect,
3392
3435
  paths: c,
3393
3436
  projectRoot: r,
3394
3437
  slot: d[0]
3395
3438
  }), l;
3396
3439
  }
3397
- async function Qi(e) {
3440
+ async function aa(e) {
3398
3441
  let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
3399
3442
  for (let e of t) {
3400
- let t = o?.get(e.manifest.name), a = await Xi({
3443
+ let t = o?.get(e.manifest.name), a = await ra({
3401
3444
  manifest: e.manifest,
3402
3445
  config: n,
3403
3446
  projectRoot: r,
@@ -3417,7 +3460,7 @@ async function Qi(e) {
3417
3460
  };
3418
3461
  let c = [], l = [], u = [], d = [], f = n;
3419
3462
  for (let e of t) {
3420
- let t = o?.get(e.manifest.name), n = await Zi({
3463
+ let t = o?.get(e.manifest.name), n = await ia({
3421
3464
  manifest: e.manifest,
3422
3465
  config: f,
3423
3466
  projectRoot: r,
@@ -3426,7 +3469,7 @@ async function Qi(e) {
3426
3469
  packDir: e.packDir,
3427
3470
  slots: t
3428
3471
  });
3429
- c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await $i(f, e.manifest, r), d.push(e.manifest.name);
3472
+ c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await oa(f, e.manifest, r), d.push(e.manifest.name);
3430
3473
  }
3431
3474
  return {
3432
3475
  installed: c,
@@ -3437,7 +3480,7 @@ async function Qi(e) {
3437
3480
  config: f
3438
3481
  };
3439
3482
  }
3440
- async function $i(e, t, n) {
3483
+ async function oa(e, t, n) {
3441
3484
  let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : wr(t.env), a = Tr([...e.onboarding?.envSections ?? [], ...i]), o = {
3442
3485
  ...e,
3443
3486
  installedPacks: [...e.installedPacks ?? [], r],
@@ -3448,17 +3491,17 @@ async function $i(e, t, n) {
3448
3491
  };
3449
3492
  return await Ar(n, o), o;
3450
3493
  }
3451
- async function ea(e) {
3494
+ async function sa(e) {
3452
3495
  let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
3453
3496
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3454
3497
  let o = [], s = [], c = t.files.filter((e) => e.strategy === "merge"), l = new Set(c.map((e) => Rr(e.source, i))), u = T.join(i, "files");
3455
- if (await q(u)) {
3498
+ if (await ar(u)) {
3456
3499
  let e = await y.readdir(u, { withFileTypes: !0 });
3457
3500
  for (let t of e) {
3458
3501
  if (!t.isDirectory()) continue;
3459
3502
  let e = a[t.name]?.root;
3460
3503
  if (!e) continue;
3461
- let n = await Gi({
3504
+ let n = await Qi({
3462
3505
  src: T.join(u, t.name),
3463
3506
  dest: T.resolve(r, e),
3464
3507
  projectRoot: r,
@@ -3468,7 +3511,7 @@ async function ea(e) {
3468
3511
  }
3469
3512
  }
3470
3513
  for (let e of c) {
3471
- let t = await Ji({
3514
+ let t = await ta({
3472
3515
  file: e,
3473
3516
  packDir: i,
3474
3517
  paths: a,
@@ -3479,11 +3522,11 @@ async function ea(e) {
3479
3522
  t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
3480
3523
  }
3481
3524
  let d = T.join(Lr("{{frontend.root}}", a, r), "src", "routes"), f = T.join(d, "(public)", "index.tsx"), p = T.join(d, "(private)", "index.tsx");
3482
- return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await mi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await vi({
3525
+ return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await xi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await Ti({
3483
3526
  entries: t.nav,
3484
3527
  paths: a,
3485
3528
  projectRoot: r
3486
- }), t.postLoginRedirect && await yi({
3529
+ }), t.postLoginRedirect && await Ei({
3487
3530
  postLoginRedirect: t.postLoginRedirect,
3488
3531
  paths: a,
3489
3532
  projectRoot: r
@@ -3494,32 +3537,32 @@ async function ea(e) {
3494
3537
  }
3495
3538
  //#endregion
3496
3539
  //#region src/core/pack-categories.ts
3497
- var ta = [
3540
+ var ca = [
3498
3541
  "starter",
3499
3542
  "layout",
3500
3543
  "feature"
3501
- ], na = {
3544
+ ], la = {
3502
3545
  starter: "Starter",
3503
3546
  layout: "Layout",
3504
3547
  feature: "Features"
3505
- }, ra = new Set(["starter", "layout"]), ia = "starter-saas-betterauth", aa = "layout-basic";
3506
- function oa(e, t = {}) {
3548
+ }, ua = new Set(["starter", "layout"]), da = "starter-saas-betterauth", fa = "layout-basic";
3549
+ function pa(e, t = {}) {
3507
3550
  let n = [];
3508
- for (let r of ta) {
3551
+ for (let r of ca) {
3509
3552
  let i = e.filter((e) => e.category === r);
3510
3553
  if (i.length === 0) continue;
3511
- let a = ra.has(r) ? "single" : "multiple";
3554
+ let a = ua.has(r) ? "single" : "multiple";
3512
3555
  if (r === "layout") {
3513
- n.push(ca("frontend", i)), t.adminAvailable && n.push(ca("admin", i));
3556
+ n.push(ha("frontend", i)), t.adminAvailable && n.push(ha("admin", i));
3514
3557
  continue;
3515
3558
  }
3516
3559
  if (r === "starter") {
3517
- n.push(sa(i));
3560
+ n.push(ma(i));
3518
3561
  continue;
3519
3562
  }
3520
3563
  n.push({
3521
3564
  category: r,
3522
- label: na[r],
3565
+ label: la[r],
3523
3566
  mode: a,
3524
3567
  packs: i,
3525
3568
  preselect: null
@@ -3527,65 +3570,70 @@ function oa(e, t = {}) {
3527
3570
  }
3528
3571
  return n;
3529
3572
  }
3530
- function sa(e) {
3531
- let t = e.some((e) => e.name === ia);
3573
+ function ma(e) {
3574
+ let t = e.some((e) => e.name === da);
3532
3575
  return {
3533
3576
  category: "starter",
3534
- label: na.starter,
3577
+ label: la.starter,
3535
3578
  mode: "single",
3536
3579
  packs: e,
3537
- preselect: t ? ia : null
3580
+ preselect: t ? da : null
3538
3581
  };
3539
3582
  }
3540
- function ca(e, t) {
3541
- let n = t.some((e) => e.name === aa);
3583
+ function ha(e, t) {
3584
+ let n = t.some((e) => e.name === fa);
3542
3585
  return {
3543
3586
  category: "layout",
3544
3587
  label: e === "admin" ? "Admin Layout" : "Layout",
3545
3588
  mode: "single",
3546
3589
  packs: t,
3547
- preselect: n ? aa : null,
3590
+ preselect: n ? fa : null,
3548
3591
  slot: e
3549
3592
  };
3550
3593
  }
3551
3594
  //#endregion
3552
3595
  //#region src/ui/logger.ts
3553
- function la(e) {
3554
- s.note(e.map((e) => `${z.arrow} ${e}`).join("\n"), "Next steps");
3596
+ var ga = [he.orangeBright, he.skyBlue];
3597
+ function _a(e) {
3598
+ let t = e.map((e, t) => {
3599
+ let n = ga[t % ga.length];
3600
+ return `${z.bold(n(`${t + 1}.`))} ${z.bold(e)}`;
3601
+ }).join("\n");
3602
+ s.note(t, "Next steps");
3555
3603
  }
3556
3604
  function Z() {
3557
- s.cancel(R.muted("Operation cancelled.")), process.exit(0);
3605
+ s.cancel(z.muted("Operation cancelled.")), process.exit(0);
3558
3606
  }
3559
3607
  //#endregion
3560
3608
  //#region src/core/post-setup.ts
3561
- async function ua() {
3562
- return (await K("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
3609
+ async function va() {
3610
+ return (await q("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
3563
3611
  }
3564
- async function da(e) {
3612
+ async function ya(e) {
3565
3613
  return J(`${e}/apps/backend/.env`);
3566
3614
  }
3567
- async function fa(e, t, n) {
3568
- let r = n ? `Start services with ${R.command("docker compose up -d")}?` : `Docker is not running. Start services with ${R.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
3615
+ async function ba(e, t, n) {
3616
+ let r = n ? `Start services with ${z.command("docker compose up -d")}?` : `Docker is not running. Start services with ${z.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
3569
3617
  message: r,
3570
3618
  initialValue: !0
3571
3619
  });
3572
- if (s.isCancel(i) && Z(), !i) return s.log.info(R.muted("Skipping Docker services and database migrations.")), !1;
3620
+ if (s.isCancel(i) && Z(), !i) return s.log.info(z.muted("Skipping Docker services and database migrations.")), !1;
3573
3621
  let a = s.spinner();
3574
3622
  a.start("Starting Docker services...");
3575
- let o = await K("docker", [
3623
+ let o = await q("docker", [
3576
3624
  "compose",
3577
3625
  "up",
3578
3626
  "-d"
3579
3627
  ], { cwd: `${e}/apps/backend` });
3580
- return o.exitCode === 0 ? (a.stop(R.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), pa(o), !1);
3628
+ return o.exitCode === 0 ? (a.stop(z.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), xa(o), !1);
3581
3629
  }
3582
- function pa(e) {
3630
+ function xa(e) {
3583
3631
  let t = (e.stderr || e.stdout).trim();
3584
- t && s.log.warn(R.muted(t));
3632
+ t && s.log.warn(z.muted(t));
3585
3633
  }
3586
- async function ma(e, t = 15, n = 2e3) {
3634
+ async function Sa(e, t = 15, n = 2e3) {
3587
3635
  for (let r = 0; r < t; r++) {
3588
- if ((await K("docker", [
3636
+ if ((await q("docker", [
3589
3637
  "compose",
3590
3638
  "exec",
3591
3639
  "-T",
@@ -3598,9 +3646,9 @@ async function ma(e, t = 15, n = 2e3) {
3598
3646
  }
3599
3647
  return !1;
3600
3648
  }
3601
- var ha = "Database schema is up to date";
3602
- async function ga(e) {
3603
- let t = await K("pnpm", [
3649
+ var Ca = "Database schema is up to date";
3650
+ async function wa(e) {
3651
+ let t = await q("pnpm", [
3604
3652
  "--filter",
3605
3653
  "@internal/backend",
3606
3654
  "exec",
@@ -3608,48 +3656,48 @@ async function ga(e) {
3608
3656
  "migrate",
3609
3657
  "status"
3610
3658
  ], { cwd: e });
3611
- return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(ha) : !1;
3659
+ return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(Ca) : !1;
3612
3660
  }
3613
- async function _a(e) {
3661
+ async function Ta(e) {
3614
3662
  let t = s.spinner();
3615
3663
  t.start("Running database migrations...");
3616
- let n = await K("pnpm", [
3664
+ let n = await q("pnpm", [
3617
3665
  "--filter",
3618
3666
  "@internal/backend",
3619
3667
  "migration:latest"
3620
3668
  ], { cwd: e });
3621
- return n.exitCode === 0 ? (t.stop(R.success("Database migrations applied")), !0) : (t.error("Migrations failed"), pa(n), s.log.warn(R.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
3669
+ return n.exitCode === 0 ? (t.stop(z.success("Database migrations applied")), !0) : (t.error("Migrations failed"), xa(n), s.log.warn(z.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
3622
3670
  }
3623
- async function va(e, t, n = {}) {
3624
- if (!await fa(e, t, await ua())) return !1;
3671
+ async function Ea(e, t, n = {}) {
3672
+ if (!await ba(e, t, await va())) return !1;
3625
3673
  let r = s.spinner();
3626
- return r.start("Waiting for Postgres to be ready..."), await ma(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(R.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(R.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
3674
+ return r.start("Waiting for Postgres to be ready..."), await Sa(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(z.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(z.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
3627
3675
  }
3628
- async function ya(e, t, n = {}) {
3629
- if (!await va(e, t, n)) return;
3676
+ async function Da(e, t, n = {}) {
3677
+ if (!await Ea(e, t, n)) return;
3630
3678
  let r = t ? !0 : await s.confirm({
3631
- message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
3679
+ message: `Run database migrations with ${z.command("prisma migrate deploy")}?`,
3632
3680
  initialValue: !0
3633
3681
  });
3634
3682
  if (s.isCancel(r) && Z(), !r) {
3635
- s.log.info(R.muted("Skipping database migrations."));
3683
+ s.log.info(z.muted("Skipping database migrations."));
3636
3684
  return;
3637
3685
  }
3638
- await _a(e);
3686
+ await Ta(e);
3639
3687
  }
3640
- async function ba(e, t, n = {}) {
3641
- if (!await da(e)) {
3642
- s.log.warn(`${R.path(".env")} not found in ${R.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
3688
+ async function Oa(e, t, n = {}) {
3689
+ if (!await ya(e)) {
3690
+ s.log.warn(`${z.path(".env")} not found in ${z.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
3643
3691
  return;
3644
3692
  }
3645
- await ya(e, t, n);
3693
+ await Da(e, t, n);
3646
3694
  }
3647
- async function xa(e, t, n = {}) {
3648
- return await da(e) ? va(e, t, n) : (s.log.warn(`${R.path(".env")} not found in ${R.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
3695
+ async function ka(e, t, n = {}) {
3696
+ return await ya(e) ? Ea(e, t, n) : (s.log.warn(`${z.path(".env")} not found in ${z.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
3649
3697
  }
3650
3698
  //#endregion
3651
3699
  //#region src/core/resolve.ts
3652
- function Sa(e) {
3700
+ function Aa(e) {
3653
3701
  let t = /* @__PURE__ */ new Map();
3654
3702
  for (let n of e) t.set(n.name, {
3655
3703
  name: n.name,
@@ -3657,7 +3705,7 @@ function Sa(e) {
3657
3705
  });
3658
3706
  return t;
3659
3707
  }
3660
- function Ca(e, t, n = /* @__PURE__ */ new Set()) {
3708
+ function ja(e, t, n = /* @__PURE__ */ new Set()) {
3661
3709
  let r = /* @__PURE__ */ new Set();
3662
3710
  function i(e) {
3663
3711
  if (n.has(e)) return [];
@@ -3671,10 +3719,10 @@ function Ca(e, t, n = /* @__PURE__ */ new Set()) {
3671
3719
  }
3672
3720
  return i(e);
3673
3721
  }
3674
- function wa(e, t, n = []) {
3722
+ function Ma(e, t, n = []) {
3675
3723
  let r = new Set(n), i = new Set(n), a = [];
3676
3724
  for (let n of e) {
3677
- let e = Ca(n, t, new Set(i));
3725
+ let e = ja(n, t, new Set(i));
3678
3726
  for (let t of e) i.has(t) || (i.add(t), a.push(t));
3679
3727
  }
3680
3728
  return {
@@ -3682,7 +3730,7 @@ function wa(e, t, n = []) {
3682
3730
  alreadyInstalled: e.filter((e) => r.has(e))
3683
3731
  };
3684
3732
  }
3685
- function Ta(e) {
3733
+ function Na(e) {
3686
3734
  let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
3687
3735
  for (let e of t) {
3688
3736
  let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
@@ -3695,7 +3743,7 @@ function Ta(e) {
3695
3743
  }
3696
3744
  //#endregion
3697
3745
  //#region src/core/variants.ts
3698
- function Ea(e, t = {}) {
3746
+ function Pa(e, t = {}) {
3699
3747
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
3700
3748
  for (let i of e) {
3701
3749
  let e = t[i.family] ?? i.default;
@@ -3707,14 +3755,14 @@ function Ea(e, t = {}) {
3707
3755
  familyOf: r
3708
3756
  };
3709
3757
  }
3710
- function Da(e, t, n) {
3758
+ function Fa(e, t, n) {
3711
3759
  return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
3712
3760
  }
3713
- function Oa(e, t) {
3761
+ function Ia(e, t) {
3714
3762
  let n = t.familyOf.get(e);
3715
3763
  return n ? t.chosen.get(n) ?? e : e;
3716
3764
  }
3717
- function ka(e, t) {
3765
+ function La(e, t) {
3718
3766
  let n = /* @__PURE__ */ new Map();
3719
3767
  for (let t of e) t.family && n.set(t.name, t.family);
3720
3768
  let r = new Set(t), i = /* @__PURE__ */ new Map();
@@ -3730,65 +3778,65 @@ function ka(e, t) {
3730
3778
  familyOf: n
3731
3779
  };
3732
3780
  }
3733
- function Aa(e, t) {
3781
+ function Ra(e, t) {
3734
3782
  return e.map((e) => ({
3735
3783
  ...e,
3736
- dependencies: e.dependencies.map((e) => Oa(e, t))
3784
+ dependencies: e.dependencies.map((e) => Ia(e, t))
3737
3785
  }));
3738
3786
  }
3739
3787
  //#endregion
3740
3788
  //#region src/ui/banner.ts
3741
- var ja = [
3789
+ var za = [
3742
3790
  " ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
3743
3791
  " ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
3744
3792
  " ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
3745
3793
  " ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
3746
3794
  " ██║ ██║ ██║ ██║ ███████╗",
3747
3795
  " ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
3748
- ], Ma = [
3796
+ ], Ba = [
3749
3797
  " ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
3750
3798
  " ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
3751
3799
  " ███████╗ ██║ ███████║ ██║ █████╔╝ ",
3752
3800
  " ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
3753
3801
  " ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
3754
3802
  " ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
3755
- ], Na = [
3803
+ ], Va = [
3756
3804
  253,
3757
3805
  176,
3758
3806
  21
3759
- ], Pa = [
3807
+ ], Ha = [
3760
3808
  245,
3761
3809
  76,
3762
3810
  2
3763
- ], Fa = 5, Ia = [
3811
+ ], Ua = 5, Wa = [
3764
3812
  17,
3765
3813
  103,
3766
3814
  248
3767
- ], La = [
3815
+ ], Ga = [
3768
3816
  42,
3769
3817
  160,
3770
3818
  250
3771
- ], Ra = .2;
3772
- function za() {
3819
+ ], Ka = .2;
3820
+ function qa() {
3773
3821
  console.log();
3774
- for (let e of xe(ja, {
3775
- start: Na,
3776
- end: Pa,
3777
- angle: Fa
3822
+ for (let e of be(za, {
3823
+ start: Va,
3824
+ end: Ha,
3825
+ angle: Ua
3778
3826
  })) console.log(b.bold(e));
3779
- for (let e of xe(Ma, {
3780
- start: Ia,
3781
- end: La,
3782
- angle: Ra
3827
+ for (let e of be(Ba, {
3828
+ start: Wa,
3829
+ end: Ga,
3830
+ angle: Ka
3783
3831
  })) console.log(b.bold(e));
3784
- console.log(), console.log(` ${z.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ye("Ship web + desktop apps from one codebase")}`), console.log();
3832
+ console.log(), console.log(` ${B.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ve("Ship web + desktop apps from one codebase")}`), console.log();
3785
3833
  }
3786
- function Ba() {
3787
- console.log(), console.log(` ${z.bolt} ${ge.orange("Hype")}${ge.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3834
+ function Ja() {
3835
+ console.log(), console.log(` ${B.bolt} ${he.orange("Hype")}${he.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3788
3836
  }
3789
3837
  //#endregion
3790
3838
  //#region src/ui/pack-multiselect.ts
3791
- var Va = class extends O {
3839
+ var Ya = class extends O {
3792
3840
  options;
3793
3841
  cursor = 0;
3794
3842
  selected;
@@ -3892,44 +3940,44 @@ var Va = class extends O {
3892
3940
  }
3893
3941
  }
3894
3942
  };
3895
- function Ha(e) {
3896
- return new Va(e).prompt();
3943
+ function Xa(e) {
3944
+ return new Ya(e).prompt();
3897
3945
  }
3898
3946
  //#endregion
3899
3947
  //#region src/utils/naming.ts
3900
- function Ua(e) {
3948
+ function Za(e) {
3901
3949
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3902
3950
  }
3903
- function Wa(e) {
3951
+ function Qa(e) {
3904
3952
  return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
3905
3953
  }
3906
3954
  //#endregion
3907
3955
  //#region src/utils/validate.ts
3908
- function Ga(e) {
3956
+ function $a(e) {
3909
3957
  if (!e.trim()) return "Project name cannot be empty";
3910
3958
  if (e.length > 214) return "Project name is too long (max 214 characters)";
3911
- let t = Ua(e);
3912
- if (!ie.test(t)) return "Project name must contain at least one letter or number";
3959
+ let t = Za(e);
3960
+ if (!re.test(t)) return "Project name must contain at least one letter or number";
3913
3961
  }
3914
3962
  //#endregion
3915
3963
  //#region src/core/apply-mode.ts
3916
- var Ka = "src/hooks/use-theme.ts", qa = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
3917
- function Ja(e, t) {
3918
- return e.replace(qa, (e, n, r) => `${n}${r}${t}${r}`);
3964
+ var eo = "src/hooks/use-theme.ts", to = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
3965
+ function no(e, t) {
3966
+ return e.replace(to, (e, n, r) => `${n}${r}${t}${r}`);
3919
3967
  }
3920
- async function Ya(e, t) {
3921
- let n = T.resolve(e, Ka), r;
3968
+ async function ro(e, t) {
3969
+ let n = T.resolve(e, eo), r;
3922
3970
  try {
3923
3971
  r = await y.readFile(n, "utf-8");
3924
3972
  } catch {
3925
3973
  return !1;
3926
3974
  }
3927
- let i = Ja(r, t);
3975
+ let i = no(r, t);
3928
3976
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3929
3977
  }
3930
3978
  //#endregion
3931
3979
  //#region src/core/apply-theme.ts
3932
- function Xa(e, t) {
3980
+ function io(e, t) {
3933
3981
  let n = 0;
3934
3982
  for (; n < e.length;) {
3935
3983
  let r = e.indexOf(t, n);
@@ -3952,47 +4000,47 @@ function Xa(e, t) {
3952
4000
  }
3953
4001
  return null;
3954
4002
  }
3955
- function Za(e, t) {
4003
+ function ao(e, t) {
3956
4004
  let n = e;
3957
4005
  for (let [e, r] of Object.entries(t)) {
3958
- let t = RegExp(`(^[ \\t]*--${Qa(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
4006
+ let t = RegExp(`(^[ \\t]*--${oo(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
3959
4007
  n = n.replace(t, (e, t) => `${t}${r};`);
3960
4008
  }
3961
4009
  return n;
3962
4010
  }
3963
- function Qa(e) {
4011
+ function oo(e) {
3964
4012
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3965
4013
  }
3966
- function $a(e, t) {
3967
- let n = Xa(e, ":root"), r = Xa(e, ".dark"), i = e;
4014
+ function so(e, t) {
4015
+ let n = io(e, ":root"), r = io(e, ".dark"), i = e;
3968
4016
  if (n) {
3969
4017
  let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
3970
- i = e + Za(r, t.light) + a;
4018
+ i = e + ao(r, t.light) + a;
3971
4019
  }
3972
4020
  if (r) {
3973
- let e = Xa(i, ".dark");
4021
+ let e = io(i, ".dark");
3974
4022
  if (e) {
3975
4023
  let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
3976
- i = n + Za(r, t.dark) + a;
4024
+ i = n + ao(r, t.dark) + a;
3977
4025
  }
3978
4026
  }
3979
4027
  return i;
3980
4028
  }
3981
- var eo = "assets/styles.css";
3982
- async function to(e, t) {
3983
- let n = T.resolve(e, eo), r;
4029
+ var co = "assets/styles.css";
4030
+ async function lo(e, t) {
4031
+ let n = T.resolve(e, co), r;
3984
4032
  try {
3985
4033
  r = await y.readFile(n, "utf-8");
3986
4034
  } catch {
3987
4035
  return !1;
3988
4036
  }
3989
- let i = $a(r, t);
4037
+ let i = so(r, t);
3990
4038
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3991
4039
  }
3992
4040
  //#endregion
3993
4041
  //#region src/core/clone.ts
3994
- async function no(e) {
3995
- let t = await ee(te, {
4042
+ async function uo(e) {
4043
+ let t = await ee(j, {
3996
4044
  dir: e,
3997
4045
  force: !0
3998
4046
  });
@@ -4003,7 +4051,7 @@ async function no(e) {
4003
4051
  }
4004
4052
  //#endregion
4005
4053
  //#region src/core/editor-config.ts
4006
- function ro(e) {
4054
+ function fo(e) {
4007
4055
  let t = {
4008
4056
  globs: [],
4009
4057
  alwaysApply: !1
@@ -4038,10 +4086,10 @@ function ro(e) {
4038
4086
  content: i
4039
4087
  };
4040
4088
  }
4041
- function io(e) {
4089
+ function po(e) {
4042
4090
  return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
4043
4091
  }
4044
- function ao(e) {
4092
+ function mo(e) {
4045
4093
  let t;
4046
4094
  t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
4047
4095
  let n = [`trigger: ${t}`];
@@ -4051,30 +4099,30 @@ function ao(e) {
4051
4099
  }
4052
4100
  return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
4053
4101
  }
4054
- function oo(e) {
4102
+ function ho(e) {
4055
4103
  return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
4056
4104
  }
4057
- var so = {
4105
+ var go = {
4058
4106
  claude: {
4059
4107
  rulesDir: ".claude/rules",
4060
4108
  extension: ".md",
4061
- convert: io
4109
+ convert: po
4062
4110
  },
4063
4111
  windsurf: {
4064
4112
  rulesDir: ".windsurf/rules",
4065
4113
  extension: ".md",
4066
- convert: ao
4114
+ convert: mo
4067
4115
  },
4068
4116
  copilot: {
4069
4117
  rulesDir: ".github/instructions",
4070
4118
  extension: ".instructions.md",
4071
- convert: oo
4119
+ convert: ho
4072
4120
  }
4073
4121
  };
4074
- async function co(e) {
4075
- let t = T.join(e, oe), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
4122
+ async function _o(e) {
4123
+ let t = T.join(e, ae), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
4076
4124
  return await Promise.all(n.map(async (e) => {
4077
- let n = T.join(t, e.name), { frontmatter: r, content: i } = ro(await y.readFile(n, "utf-8"));
4125
+ let n = T.join(t, e.name), { frontmatter: r, content: i } = fo(await y.readFile(n, "utf-8"));
4078
4126
  return {
4079
4127
  frontmatter: r,
4080
4128
  content: i,
@@ -4082,31 +4130,31 @@ async function co(e) {
4082
4130
  };
4083
4131
  }));
4084
4132
  }
4085
- async function lo(e, t) {
4133
+ async function vo(e, t) {
4086
4134
  if (t === "cursor") return;
4087
- let n = so[t], r = await co(e), i = T.join(e, n.rulesDir);
4135
+ let n = go[t], r = await _o(e), i = T.join(e, n.rulesDir);
4088
4136
  await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
4089
4137
  let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
4090
4138
  return y.writeFile(T.join(i, r), t, "utf-8");
4091
- })), await ur(T.join(e, se)), await ur(T.join(e, ce));
4139
+ })), await ur(T.join(e, oe)), await ur(T.join(e, se));
4092
4140
  }
4093
4141
  //#endregion
4094
4142
  //#region src/core/env-files.ts
4095
- var uo = [
4143
+ var yo = [
4096
4144
  "apps",
4097
4145
  "packages",
4098
4146
  "libs",
4099
4147
  "shared"
4100
4148
  ];
4101
- async function fo(e) {
4102
- let t = await po(e);
4149
+ async function bo(e) {
4150
+ let t = await xo(e);
4103
4151
  return (await Promise.all(t.map(async (t) => {
4104
4152
  let n = T.join(T.dirname(t), ".env");
4105
4153
  return await J(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
4106
4154
  }))).filter((e) => e !== null).sort();
4107
4155
  }
4108
- async function po(e) {
4109
- let t = [T.join(e, ".env.example")], n = await Promise.all(uo.map(async (t) => {
4156
+ async function xo(e) {
4157
+ let t = [T.join(e, ".env.example")], n = await Promise.all(yo.map(async (t) => {
4110
4158
  let n = T.join(e, t);
4111
4159
  return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
4112
4160
  }));
@@ -4114,12 +4162,12 @@ async function po(e) {
4114
4162
  }
4115
4163
  //#endregion
4116
4164
  //#region src/core/post-clone.ts
4117
- var Q = "@hype-stack/", mo = "hype-stack";
4118
- async function ho(e) {
4165
+ var Q = "@hype-stack/", So = "hype-stack";
4166
+ async function Co(e) {
4119
4167
  await ur(T.join(e, ".git"));
4120
4168
  }
4121
- async function go(e) {
4122
- await K("git", ["init"], { cwd: e }), await K("git", ["add", "."], { cwd: e }), await K("git", [
4169
+ async function wo(e) {
4170
+ await q("git", ["init"], { cwd: e }), await q("git", ["add", "."], { cwd: e }), await q("git", [
4123
4171
  "-c",
4124
4172
  "user.name=Hype Stack CLI",
4125
4173
  "-c",
@@ -4129,22 +4177,22 @@ async function go(e) {
4129
4177
  "Initial commit from Hype Stack CLI"
4130
4178
  ], { cwd: e });
4131
4179
  }
4132
- async function _o(e, t) {
4133
- let n = `@${t}/`, r = await To(e);
4180
+ async function To(e, t) {
4181
+ let n = `@${t}/`, r = await No(e);
4134
4182
  for (let e of r) {
4135
4183
  let t = await sr(e);
4136
4184
  if (!t) continue;
4137
4185
  let r = !1;
4138
- t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), So(t.dependencies, n) && (r = !0), So(t.devDependencies, n) && (r = !0), t.nx && Co(t.nx, n) && (r = !0);
4186
+ t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), Ao(t.dependencies, n) && (r = !0), Ao(t.devDependencies, n) && (r = !0), t.nx && jo(t.nx, n) && (r = !0);
4139
4187
  let i = await y.readFile(e, "utf-8");
4140
4188
  if (i.includes(Q)) {
4141
4189
  let t = i.replaceAll(Q, n);
4142
4190
  await y.writeFile(e, t, "utf-8");
4143
4191
  } else r && await cr(e, t);
4144
4192
  }
4145
- await Bi(e, t), await bo(e, t), await wo(e, t);
4193
+ await qi(e, t), await Oo(e, t), await Mo(e, t);
4146
4194
  }
4147
- var vo = new Set([
4195
+ var Eo = new Set([
4148
4196
  ".git",
4149
4197
  "node_modules",
4150
4198
  "dist",
@@ -4152,10 +4200,10 @@ var vo = new Set([
4152
4200
  ".nx",
4153
4201
  ".next",
4154
4202
  "coverage"
4155
- ]), yo = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4156
- async function bo(e, t) {
4157
- if (t === mo) return;
4158
- let n = await xo(e);
4203
+ ]), Do = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4204
+ async function Oo(e, t) {
4205
+ if (t === So) return;
4206
+ let n = await ko(e);
4159
4207
  await Promise.all(n.map(async (e) => {
4160
4208
  let n = await y.readFile(e, "utf-8").catch(() => null);
4161
4209
  if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
@@ -4163,14 +4211,14 @@ async function bo(e, t) {
4163
4211
  await y.writeFile(e, r, "utf-8");
4164
4212
  }));
4165
4213
  }
4166
- async function xo(e) {
4214
+ async function ko(e) {
4167
4215
  let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
4168
4216
  return (await Promise.all(t.map(async (t) => {
4169
4217
  let n = T.join(e, t.name);
4170
- return t.isDirectory() ? vo.has(t.name) ? [] : xo(n) : t.isFile() && yo.test(t.name) ? [n] : [];
4218
+ return t.isDirectory() ? Eo.has(t.name) ? [] : ko(n) : t.isFile() && Do.test(t.name) ? [n] : [];
4171
4219
  }))).flat();
4172
4220
  }
4173
- function So(e, t) {
4221
+ function Ao(e, t) {
4174
4222
  if (!e) return !1;
4175
4223
  let n = !1;
4176
4224
  for (let r of Object.keys(e)) if (r.startsWith(Q)) {
@@ -4179,7 +4227,7 @@ function So(e, t) {
4179
4227
  }
4180
4228
  return n;
4181
4229
  }
4182
- function Co(e, t) {
4230
+ function jo(e, t) {
4183
4231
  if (!e) return !1;
4184
4232
  let n = !1;
4185
4233
  if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
@@ -4187,13 +4235,13 @@ function Co(e, t) {
4187
4235
  }
4188
4236
  return n;
4189
4237
  }
4190
- async function wo(e, t) {
4238
+ async function Mo(e, t) {
4191
4239
  let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
4192
4240
  if (!r) return;
4193
- let i = Wa(t), a = r.replaceAll(`id: "${mo}"`, `id: "${t}"`).replaceAll(`name: "${mo}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
4241
+ let i = Qa(t), a = r.replaceAll(`id: "${So}"`, `id: "${t}"`).replaceAll(`name: "${So}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
4194
4242
  await y.writeFile(n, a, "utf-8");
4195
4243
  }
4196
- async function To(e) {
4244
+ async function No(e) {
4197
4245
  let t = [], n = T.join(e, "package.json");
4198
4246
  (await y.stat(n).catch(() => null))?.isFile() && t.push(n);
4199
4247
  for (let n of [
@@ -4213,7 +4261,7 @@ async function To(e) {
4213
4261
  }
4214
4262
  //#endregion
4215
4263
  //#region src/core/readme.ts
4216
- var Eo = {
4264
+ var Po = {
4217
4265
  cursor: {
4218
4266
  label: "Cursor",
4219
4267
  rulesDir: ".cursor/rules"
@@ -4230,21 +4278,21 @@ var Eo = {
4230
4278
  label: "GitHub Copilot",
4231
4279
  rulesDir: ".github/instructions"
4232
4280
  }
4233
- }, Do = {
4281
+ }, Fo = {
4234
4282
  backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
4235
4283
  frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
4236
- }, Oo = {
4284
+ }, Io = {
4237
4285
  enums: "Shared enums and app config used across apps",
4238
4286
  cli: "Project tooling and code generators"
4239
4287
  };
4240
- function ko(e, t) {
4288
+ function Lo(e, t) {
4241
4289
  return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
4242
4290
  let r = t[e];
4243
4291
  return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
4244
4292
  });
4245
4293
  }
4246
- function Ao(e) {
4247
- let { projectName: t, editor: n, workspace: r } = e, i = Wa(t), a = Eo[n], o = !!r.apps.backend, s = ko(r.apps, Do), c = ko(r.packages, Oo), l = [];
4294
+ function Ro(e) {
4295
+ let { projectName: t, editor: n, workspace: r } = e, i = Qa(t), a = Po[n], o = !!r.apps.backend, s = Lo(r.apps, Fo), c = Lo(r.packages, Io), l = [];
4248
4296
  s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
4249
4297
  let u = [];
4250
4298
  u.push(`# ${i}`), u.push([
@@ -4347,19 +4395,19 @@ function Ao(e) {
4347
4395
  "stays useful."
4348
4396
  ].join("\n")), u.join("\n\n") + "\n";
4349
4397
  }
4350
- async function jo(e, t) {
4398
+ async function zo(e, t) {
4351
4399
  let n = T.join(e, "README.md");
4352
- await y.writeFile(n, Ao(t), "utf-8");
4400
+ await y.writeFile(n, Ro(t), "utf-8");
4353
4401
  }
4354
4402
  //#endregion
4355
4403
  //#region src/core/tracking.ts
4356
- async function Mo(e) {
4404
+ async function Bo(e) {
4357
4405
  try {
4358
4406
  let t = {
4359
- "X-Device-Id": Zn(),
4360
- "X-Client-Info": Qn()
4361
- }, n = await qn(F()).catch(() => null);
4362
- n?.token && (t.Authorization = `Bearer ${n.token}`), await G.createRequest()({
4407
+ "X-Device-Id": Xn(),
4408
+ "X-Client-Info": Zn()
4409
+ }, n = await Kn(I()).catch(() => null);
4410
+ n?.token && (t.Authorization = `Bearer ${n.token}`), await K.createRequest()({
4363
4411
  endpoint: "/cli/track",
4364
4412
  method: "POST"
4365
4413
  }).setPayload({ event: e }).setHeaders(t).send();
@@ -4367,7 +4415,7 @@ async function Mo(e) {
4367
4415
  }
4368
4416
  //#endregion
4369
4417
  //#region src/core/npm-deps.ts
4370
- function No(e, t) {
4418
+ function Vo(e, t) {
4371
4419
  let n = [], r = [];
4372
4420
  if (!e) return {
4373
4421
  errors: n,
@@ -4398,7 +4446,7 @@ function No(e, t) {
4398
4446
  operations: r
4399
4447
  };
4400
4448
  }
4401
- function Po(e) {
4449
+ function Ho(e) {
4402
4450
  let t = {};
4403
4451
  for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
4404
4452
  ...t[e],
@@ -4406,7 +4454,7 @@ function Po(e) {
4406
4454
  };
4407
4455
  return t;
4408
4456
  }
4409
- async function Fo(e, t, n = K) {
4457
+ async function Uo(e, t, n = q) {
4410
4458
  let r = [];
4411
4459
  for (let i of e) {
4412
4460
  let e = T.join(t, i.relativeDir);
@@ -4442,25 +4490,25 @@ async function Fo(e, t, n = K) {
4442
4490
  function $(e) {
4443
4491
  return e instanceof Error ? e.message : String(e);
4444
4492
  }
4445
- async function Io(e, t, n) {
4493
+ async function Wo(e, t, n) {
4446
4494
  let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
4447
4495
  return r.length === 0 ? {} : Vr(r, n).catch(() => ({}));
4448
4496
  }
4449
- function Lo(e, t) {
4450
- return e === "free" ? R.success("free") : e === "owned" ? R.accent("owned") : `${R.highlight(`$${t}`)} ${R.muted("locked")}`;
4497
+ function Go(e, t) {
4498
+ return e === "free" ? z.success("free") : e === "owned" ? z.accent("owned") : `${z.highlight(`$${t}`)} ${z.muted("locked")}`;
4451
4499
  }
4452
- async function Ro(e, t, n) {
4500
+ async function Ko(e, t, n) {
4453
4501
  let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
4454
- i.length > 0 && s.log.warning(`Skipping ${i.join(", ")} because ${i.length === 1 ? "it depends" : "they depend"} on a pack you don't own yet.`), await ir(r.map((e) => n.get(e)).filter((e) => e !== void 0).map((e) => ({
4502
+ i.length > 0 && s.log.warning(`Skipping ${i.join(", ")} because ${i.length === 1 ? "it depends" : "they depend"} on a pack you don't own yet.`), await rr(r.map((e) => n.get(e)).filter((e) => e !== void 0).map((e) => ({
4455
4503
  name: e.name,
4456
4504
  displayName: e.displayName,
4457
4505
  price: e.price
4458
4506
  })));
4459
4507
  }
4460
- function zo(e, t) {
4508
+ function qo(e, t) {
4461
4509
  let n = e.map((e, n) => {
4462
4510
  let r = t.get(e), i = r ? r.displayName : e;
4463
- return ` ${R.muted(`${n + 1}.`)} ${R.brand(i)}`;
4511
+ return ` ${z.muted(`${n + 1}.`)} ${z.brand(i)}`;
4464
4512
  });
4465
4513
  s.note([
4466
4514
  "These packs will be installed, in order:",
@@ -4468,7 +4516,7 @@ function zo(e, t) {
4468
4516
  ...n
4469
4517
  ].join("\n"), "Install Plan");
4470
4518
  }
4471
- async function Bo(e, t) {
4519
+ async function Jo(e, t) {
4472
4520
  let n = [];
4473
4521
  for (let r of e) {
4474
4522
  let e = await Fr(r), i = await Ir(r, t);
@@ -4480,32 +4528,32 @@ async function Bo(e, t) {
4480
4528
  }
4481
4529
  return n;
4482
4530
  }
4483
- async function Vo(e) {
4484
- let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = No(Po(t.map((e) => e.manifest.dependencies_npm)), n);
4531
+ async function Yo(e) {
4532
+ let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Vo(Ho(t.map((e) => e.manifest.dependencies_npm)), n);
4485
4533
  if (a.errors.length > 0) {
4486
4534
  for (let e of a.errors) s.log.error(e);
4487
4535
  return;
4488
4536
  }
4489
4537
  if (a.operations.length === 0) return;
4490
4538
  i.start("Installing npm dependencies...");
4491
- let o = await Fo(a.operations, r);
4539
+ let o = await Uo(a.operations, r);
4492
4540
  if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
4493
4541
  }
4494
- function Ho() {
4495
- s.note([` ${R.command("1. npx @hype-stack/cli onboard")} ${R.muted("(set up env vars + run migrations)")}`, ` ${R.command("2. pnpm dev")} ${R.muted("(start frontend + backend)")}`].join("\n"), "Next steps");
4542
+ function Xo() {
4543
+ _a([`${z.command("npx @hype-stack/cli onboard")} ${z.muted("(set up env vars + run migrations)")}`, `${z.command("pnpm dev")} ${z.muted("(start frontend + backend)")}`]);
4496
4544
  }
4497
- function Uo(e) {
4545
+ function Zo(e) {
4498
4546
  if (e.length === 0) return;
4499
4547
  let t = e.map((e) => {
4500
4548
  let t = e.replace(/^\{\{[^}]+\}\}\//, "");
4501
- return ` ${R.muted("•")} ${R.path(t)}`;
4549
+ return ` ${z.muted("•")} ${z.path(t)}`;
4502
4550
  });
4503
4551
  s.note(t.join("\n"), "Skipped (already exist)");
4504
4552
  }
4505
- async function Wo(e) {
4553
+ async function Qo(e) {
4506
4554
  let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
4507
4555
  if (i) return c;
4508
- let l = await Yi({
4556
+ let l = await na({
4509
4557
  packs: t,
4510
4558
  config: n,
4511
4559
  projectRoot: r,
@@ -4513,17 +4561,17 @@ async function Wo(e) {
4513
4561
  });
4514
4562
  if (l.length === 0) return c;
4515
4563
  if (a) {
4516
- s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${R.command("--force")} to overwrite.`);
4564
+ s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${z.command("--force")} to overwrite.`);
4517
4565
  let e = l.map((e) => {
4518
4566
  let t = T.relative(r, e.targetPath) || e.target;
4519
- return ` ${R.muted("•")} ${R.path(t)} ${R.muted(`(${e.packName})`)}`;
4567
+ return ` ${z.muted("•")} ${z.path(t)} ${z.muted(`(${e.packName})`)}`;
4520
4568
  });
4521
4569
  return s.note(e.join("\n"), "Kept existing files"), c;
4522
4570
  }
4523
4571
  s.log.warning(`${l.length} file${l.length === 1 ? "" : "s"} already exist in your project.`);
4524
4572
  for (let e of l) {
4525
4573
  let t = T.relative(r, e.targetPath) || e.target, n = await s.confirm({
4526
- message: `Overwrite ${R.path(t)}? ${R.muted(`(${e.packName})`)}`,
4574
+ message: `Overwrite ${z.path(t)}? ${z.muted(`(${e.packName})`)}`,
4527
4575
  initialValue: !1
4528
4576
  });
4529
4577
  s.isCancel(n) && (s.cancel("Installation cancelled."), process.exit(0)), n && c.add(e.targetPath);
@@ -4532,7 +4580,7 @@ async function Wo(e) {
4532
4580
  }
4533
4581
  //#endregion
4534
4582
  //#region src/ui/swatch.ts
4535
- function Go(e) {
4583
+ function $o(e) {
4536
4584
  let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
4537
4585
  if (!t) return null;
4538
4586
  let n = t[1].trim().split(/\s+/);
@@ -4551,58 +4599,58 @@ function Go(e) {
4551
4599
  h: a
4552
4600
  };
4553
4601
  }
4554
- function Ko(e) {
4602
+ function es(e) {
4555
4603
  return Math.min(255, Math.max(0, Math.round(e)));
4556
4604
  }
4557
- function qo(e) {
4605
+ function ts(e) {
4558
4606
  return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
4559
4607
  }
4560
- function Jo({ l: e, c: t, h: n }) {
4608
+ function ns({ l: e, c: t, h: n }) {
4561
4609
  let r = n * Math.PI / 180, i = t * Math.cos(r), a = t * Math.sin(r), o = e + .3963377774 * i + .2158037573 * a, s = e - .1055613458 * i - .0638541728 * a, c = e - .0894841775 * i - 1.291485548 * a, l = o ** 3, u = s ** 3, d = c ** 3, f = 4.0767416621 * l - 3.3077115913 * u + .2309699292 * d, p = -1.2684380042 * l + 2.6097570613 * u - .3413193965 * d, m = -.0041960863 * l - .7034186147 * u + 1.7076146937 * d;
4562
4610
  return [
4563
- Ko(qo(f) * 255),
4564
- Ko(qo(p) * 255),
4565
- Ko(qo(m) * 255)
4611
+ es(ts(f) * 255),
4612
+ es(ts(p) * 255),
4613
+ es(ts(m) * 255)
4566
4614
  ];
4567
4615
  }
4568
- var Yo = "\x1B[49m";
4569
- function Xo(e, t) {
4616
+ var rs = "\x1B[49m";
4617
+ function is(e, t) {
4570
4618
  let n = e[t];
4571
4619
  if (!n) return b.dim(" ");
4572
- let r = Go(n);
4620
+ let r = $o(n);
4573
4621
  if (!r) return b.dim(" ");
4574
- let [i, a, o] = Jo(r);
4575
- return `\x1b[48;2;${i};${a};${o}m ${Yo}`;
4622
+ let [i, a, o] = ns(r);
4623
+ return `\x1b[48;2;${i};${a};${o}m ${rs}`;
4576
4624
  }
4577
- var Zo = [
4625
+ var as = [
4578
4626
  "primary",
4579
4627
  "secondary",
4580
4628
  "accent"
4581
4629
  ];
4582
- function Qo(e) {
4583
- return Zo.map((t) => Xo(e, t)).join("");
4630
+ function os(e) {
4631
+ return as.map((t) => is(e, t)).join("");
4584
4632
  }
4585
- function $o(e) {
4586
- return `${Qo(e.light)} ${b.dim("·")} ${Qo(e.dark)}`;
4633
+ function ss(e) {
4634
+ return `${os(e.light)} ${b.dim("·")} ${os(e.dark)}`;
4587
4635
  }
4588
4636
  //#endregion
4589
4637
  //#region src/commands/create.ts
4590
- async function es(e) {
4591
- e.skipBanner || za(), s.intro(R.brandBold("Create a new Hype Stack project"));
4638
+ async function cs(e) {
4639
+ e.skipBanner || qa(), s.intro(z.brandBold("Create a new Hype Stack project"));
4592
4640
  let o = e.yes === !0, c, l;
4593
4641
  if (o && e.name) {
4594
- let t = Ga(e.name);
4595
- t && (s.log.error(t), Z()), l = e.name, c = Ua(e.name);
4642
+ let t = $a(e.name);
4643
+ t && (s.log.error(t), Z()), l = e.name, c = Za(e.name);
4596
4644
  } else {
4597
4645
  let t = await s.text({
4598
4646
  message: "What is your project named?",
4599
4647
  placeholder: "my-app",
4600
4648
  initialValue: e.name ?? "",
4601
- validate: (e) => Ga(e ?? "")
4649
+ validate: (e) => $a(e ?? "")
4602
4650
  });
4603
- s.isCancel(t) && Z(), l = t, c = Ua(l);
4651
+ s.isCancel(t) && Z(), l = t, c = Za(l);
4604
4652
  }
4605
- l.trim() !== c && s.log.info(R.muted(`Using "${R.highlight(c)}" as the project name`));
4653
+ l.trim() !== c && s.log.info(z.muted(`Using "${z.highlight(c)}" as the project name`));
4606
4654
  let u;
4607
4655
  if (e.directory !== void 0) u = e.directory;
4608
4656
  else {
@@ -4620,14 +4668,14 @@ async function es(e) {
4620
4668
  u = dr(t, c);
4621
4669
  }
4622
4670
  let d = T.resolve(u);
4623
- o || s.note(R.path(d), "Project will be created at");
4624
- let f = e.editor && ae.includes(e.editor) ? e.editor : null, p;
4671
+ o || s.note(z.path(d), "Project will be created at");
4672
+ let f = e.editor && ie.includes(e.editor) ? e.editor : null, p;
4625
4673
  if (f) p = f;
4626
4674
  else if (o) p = "cursor";
4627
4675
  else {
4628
4676
  let e = await s.select({
4629
4677
  message: "Which code editor do you use?",
4630
- options: P.map((e) => ({
4678
+ options: F.map((e) => ({
4631
4679
  value: e.value,
4632
4680
  label: e.label,
4633
4681
  hint: "hint" in e ? e.hint : void 0
@@ -4644,78 +4692,78 @@ async function es(e) {
4644
4692
  message: "Pick a color theme",
4645
4693
  options: r.map((e) => ({
4646
4694
  value: e.name,
4647
- label: `${$o(e)} ${e.label}`
4695
+ label: `${ss(e)} ${e.label}`
4648
4696
  })),
4649
4697
  initialValue: h
4650
4698
  });
4651
4699
  s.isCancel(e) && Z(), g = e;
4652
4700
  }
4653
4701
  if (!o) {
4654
- let e = P.find((e) => e.value === p)?.label ?? p, t = n.find((e) => e.value === g)?.label ?? g, r = await s.confirm({ message: `Create ${R.highlight(c)} in ${R.path(d)} with ${R.highlight(e)} config and the ${R.highlight(t)} theme?` });
4702
+ let e = F.find((e) => e.value === p)?.label ?? p, t = n.find((e) => e.value === g)?.label ?? g, r = await s.confirm({ message: `Create ${z.highlight(c)} in ${z.path(d)} with ${z.highlight(e)} config and the ${z.highlight(t)} theme?` });
4655
4703
  (s.isCancel(r) || !r) && Z();
4656
4704
  }
4657
- if (await q(d) && !await or(d)) {
4705
+ if (await ar(d) && !await or(d)) {
4658
4706
  let e = await s.confirm({
4659
- message: `Directory ${R.path(d)} is not empty. Continue anyway?`,
4707
+ message: `Directory ${z.path(d)} is not empty. Continue anyway?`,
4660
4708
  initialValue: !1
4661
4709
  });
4662
4710
  (s.isCancel(e) || !e) && Z();
4663
4711
  }
4664
4712
  let _ = s.spinner();
4665
- _.start("Cloning Hype Stack template..."), await no(d), _.stop(R.success("Template cloned"));
4713
+ _.start("Cloning Hype Stack template..."), await uo(d), _.stop(z.success("Template cloned"));
4666
4714
  let v = s.spinner();
4667
- v.start("Setting up project..."), await ho(d), await _o(d, c), await lo(d, p);
4715
+ v.start("Setting up project..."), await Co(d), await To(d, c), await vo(d, p);
4668
4716
  let y = await jr(d), b = Nr(c, y);
4669
- await Ar(d, b), await jo(d, {
4717
+ await Ar(d, b), await zo(d, {
4670
4718
  projectName: c,
4671
4719
  editor: p,
4672
4720
  workspace: y
4673
4721
  });
4674
4722
  let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
4675
- a(g) && (await to(x, i(g)) || s.log.warn(R.muted(`Could not find ${R.path("assets/styles.css")} to apply the ${g} theme`))), await Ya(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(R.muted(`Could not find ${R.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(R.success("Project configured"));
4723
+ a(g) && (await lo(x, i(g)) || s.log.warn(z.muted(`Could not find ${z.path("assets/styles.css")} to apply the ${g} theme`))), await ro(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(z.muted(`Could not find ${z.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(z.success("Project configured"));
4676
4724
  let S = s.spinner();
4677
- S.start("Installing dependencies..."), (await K("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(R.success("Dependencies installed")) : (S.stop(R.warning("Dependencies installed with warnings")), s.log.warn(R.muted("You may need to run `pnpm install` manually to resolve issues.")));
4725
+ S.start("Installing dependencies..."), (await q("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(z.success("Dependencies installed")) : (S.stop(z.warning("Dependencies installed with warnings")), s.log.warn(z.muted("You may need to run `pnpm install` manually to resolve issues.")));
4678
4726
  let C = s.spinner();
4679
- C.start("Initializing git repository..."), await go(d), C.stop(R.success("Git repository initialized with clean history"));
4727
+ C.start("Initializing git repository..."), await wo(d), C.stop(z.success("Git repository initialized with clean history"));
4680
4728
  let w = s.spinner();
4681
4729
  w.start("Creating .env files from examples...");
4682
- let E = await fo(d);
4730
+ let E = await bo(d);
4683
4731
  if (E.length > 0) {
4684
4732
  let e = E.length;
4685
- w.stop(R.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4686
- } else w.stop(R.muted("No .env.example files to copy"));
4687
- s.log.success(`${R.brandBold("Hype Stack")} project ${R.highlight(c)} is ready!`);
4688
- let D = T.relative(process.cwd(), d) || ".", O = [`${R.command(`cd ${D}`)}`];
4689
- E.length > 0 ? O.push(`Review your ${R.path(".env")} files and fill in any secrets`) : O.push(`Copy ${R.path(".env.example")} to ${R.path(".env")} and configure`), la(O);
4733
+ w.stop(z.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4734
+ } else w.stop(z.muted("No .env.example files to copy"));
4735
+ s.log.success(`${z.brandBold("Hype Stack")} project ${z.highlight(c)} is ready!`);
4736
+ let D = T.relative(process.cwd(), d) || ".", O = [`${z.command(`cd ${D}`)}`];
4737
+ E.length > 0 ? O.push(`Review your ${z.path(".env")} files and fill in any secrets`) : O.push(`Copy ${z.path(".env.example")} to ${z.path(".env")} and configure`), _a(O);
4690
4738
  let k = e.setup === !1;
4691
- if (e.deferSetup) s.log.info(R.muted("Docker and migrations will run after your packs are installed."));
4739
+ if (e.deferSetup) s.log.info(z.muted("Docker and migrations will run after your packs are installed."));
4692
4740
  else {
4693
4741
  let e = !k && (o || await s.confirm({
4694
4742
  message: "Would you like to start Docker services and run database migrations now?",
4695
4743
  initialValue: !0
4696
4744
  }));
4697
- s.isCancel(e) && Z(), e ? await ba(d, o) : s.log.info(R.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Ho();
4745
+ s.isCancel(e) && Z(), e ? await Oa(d, o) : s.log.info(z.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Xo();
4698
4746
  }
4699
- return await Mo("project_create"), s.outro(R.muted("Happy building!")), d;
4747
+ return await Bo("project_create"), s.outro(z.muted("Happy building!")), d;
4700
4748
  }
4701
4749
  //#endregion
4702
4750
  //#region src/commands/init.ts
4703
- async function ts(e) {
4751
+ async function ls(e) {
4704
4752
  let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
4705
- if (n || (Ba(), s.intro(R.brandBold("Initialize Hype Stack configuration"))), !await Pr(t)) {
4706
- s.log.error(`This doesn't look like a Hype Stack project. ${R.muted("Expected apps/ directory and package.json")}`), s.outro(R.muted(`Run ${R.command("npx @hype-stack/cli create")} to scaffold a new project.`));
4753
+ if (n || (Ja(), s.intro(z.brandBold("Initialize Hype Stack configuration"))), !await Pr(t)) {
4754
+ s.log.error(`This doesn't look like a Hype Stack project. ${z.muted("Expected apps/ directory and package.json")}`), s.outro(z.muted(`Run ${z.command("npx @hype-stack/cli create")} to scaffold a new project.`));
4707
4755
  return;
4708
4756
  }
4709
4757
  if (await kr(t)) {
4710
4758
  let e = await Or(t);
4711
4759
  if (e && !n) {
4712
- s.log.info(`Found existing ${R.path("stack.json")} for project ${R.highlight(e.name)}`);
4760
+ s.log.info(`Found existing ${z.path("stack.json")} for project ${z.highlight(e.name)}`);
4713
4761
  let t = await s.confirm({
4714
4762
  message: "Overwrite existing configuration?",
4715
4763
  initialValue: !1
4716
4764
  });
4717
4765
  if (s.isCancel(t) || !t) {
4718
- s.outro(R.muted("Keeping existing configuration."));
4766
+ s.outro(z.muted("Keeping existing configuration."));
4719
4767
  return;
4720
4768
  }
4721
4769
  }
@@ -4724,12 +4772,12 @@ async function ts(e) {
4724
4772
  if (!n) {
4725
4773
  let e = Object.entries(r.apps), t = Object.entries(r.packages);
4726
4774
  if (e.length > 0) {
4727
- s.log.info(R.bold("Detected apps:"));
4728
- for (let [t, n] of e) s.log.message(` ${z.arrow} ${R.highlight(t)} ${R.muted(`→ ${n}`)}`);
4775
+ s.log.info(z.bold("Detected apps:"));
4776
+ for (let [t, n] of e) s.log.message(` ${B.arrow} ${z.highlight(t)} ${z.muted(`→ ${n}`)}`);
4729
4777
  }
4730
4778
  if (t.length > 0) {
4731
- s.log.info(R.bold("Detected packages:"));
4732
- for (let [e, n] of t) s.log.message(` ${z.arrow} ${R.highlight(e)} ${R.muted(`→ ${n}`)}`);
4779
+ s.log.info(z.bold("Detected packages:"));
4780
+ for (let [e, n] of t) s.log.message(` ${B.arrow} ${z.highlight(e)} ${z.muted(`→ ${n}`)}`);
4733
4781
  }
4734
4782
  e.length === 0 && t.length === 0 && s.log.warn("No apps or packages detected in the workspace.");
4735
4783
  }
@@ -4739,21 +4787,21 @@ async function ts(e) {
4739
4787
  message: "Project name for stack.json?",
4740
4788
  placeholder: i,
4741
4789
  initialValue: i,
4742
- validate: (e) => Ga(e ?? "")
4790
+ validate: (e) => $a(e ?? "")
4743
4791
  });
4744
- s.isCancel(e) && Z(), a = Ua(e);
4792
+ s.isCancel(e) && Z(), a = Za(e);
4745
4793
  }
4746
- await Ar(t, Nr(a, r)), n || (s.log.success(`${R.path("stack.json")} written successfully`), s.outro(R.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
4794
+ await Ar(t, Nr(a, r)), n || (s.log.success(`${z.path("stack.json")} written successfully`), s.outro(z.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
4747
4795
  }
4748
- async function ns(e, t = {}, n) {
4796
+ async function us(e, t = {}, n) {
4749
4797
  if (await kr(e)) return {
4750
4798
  projectRoot: e,
4751
4799
  scaffolded: !1
4752
4800
  };
4753
- let r = t.runInit ?? ((e) => ts({
4801
+ let r = t.runInit ?? ((e) => ls({
4754
4802
  cwd: e,
4755
4803
  silent: !0
4756
- })), i = t.runCreate ?? ((e, t) => es({
4804
+ })), i = t.runCreate ?? ((e, t) => cs({
4757
4805
  parentDirectory: e,
4758
4806
  deferSetup: !0,
4759
4807
  skipBanner: !0,
@@ -4761,22 +4809,22 @@ async function ns(e, t = {}, n) {
4761
4809
  defaultMode: t?.defaultMode
4762
4810
  }));
4763
4811
  if (await Pr(e)) {
4764
- s.log.warn(`No ${R.path("stack.json")} found in ${R.path(e)}.`);
4812
+ s.log.warn(`No ${z.path("stack.json")} found in ${z.path(e)}.`);
4765
4813
  let t = await s.confirm({
4766
- message: `Create ${R.path("stack.json")} now?`,
4814
+ message: `Create ${z.path("stack.json")} now?`,
4767
4815
  initialValue: !0
4768
4816
  });
4769
4817
  if (s.isCancel(t) || !t) return null;
4770
4818
  await r(e);
4771
4819
  let n = await kr(e);
4772
- return n && s.log.success(`${R.path("stack.json")} created`), n ? {
4820
+ return n && s.log.success(`${z.path("stack.json")} created`), n ? {
4773
4821
  projectRoot: e,
4774
4822
  scaffolded: !1
4775
4823
  } : null;
4776
4824
  }
4777
- s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${R.path("stack.json")} here.`);
4825
+ s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${z.path("stack.json")} here.`);
4778
4826
  let a = await s.confirm({
4779
- message: `Is ${R.path(e)} where you want to work?`,
4827
+ message: `Is ${z.path(e)} where you want to work?`,
4780
4828
  initialValue: !0
4781
4829
  });
4782
4830
  if (s.isCancel(a) || !a) return null;
@@ -4793,18 +4841,18 @@ async function ns(e, t = {}, n) {
4793
4841
  }
4794
4842
  //#endregion
4795
4843
  //#region src/commands/compose.ts
4796
- async function rs(e = {}) {
4844
+ async function ds(e = {}) {
4797
4845
  let t = e.cwd ?? process.cwd();
4798
- za();
4799
- let n = await ns(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4846
+ qa();
4847
+ let n = await us(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4800
4848
  try {
4801
4849
  a = await Or(r ?? t);
4802
4850
  } catch (e) {
4803
- s.cancel(`Could not parse ${R.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4851
+ s.cancel(`Could not parse ${z.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4804
4852
  }
4805
- a || (s.cancel(r ? `Could not read ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli compose' again.` : `No ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli compose'.`), process.exit(1)), a.paths || (s.cancel(`${R.path("stack.json")} is missing ${R.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
4853
+ a || (s.cancel(r ? `Could not read ${z.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli compose' again.` : `No ${z.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli compose'.`), process.exit(1)), a.paths || (s.cancel(`${z.path("stack.json")} is missing ${z.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
4806
4854
  let o = r ?? t;
4807
- s.intro(R.brandBold("Compose your stack"));
4855
+ s.intro(z.brandBold("Compose your stack"));
4808
4856
  let c = s.spinner();
4809
4857
  c.start("Loading packs...");
4810
4858
  let l;
@@ -4814,13 +4862,13 @@ async function rs(e = {}) {
4814
4862
  c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
4815
4863
  }
4816
4864
  c.stop("Packs loaded");
4817
- let u = a.installedPacks ?? [], d = new Set(u), f = new Map(l.map((e) => [e.name, e])), p = e.licenseKey ?? a.licenseKey ?? null, m = (await qn(F()))?.token ?? null, h = await Io(l, d, {
4865
+ let u = a.installedPacks ?? [], d = new Set(u), f = new Map(l.map((e) => [e.name, e])), p = e.licenseKey ?? a.licenseKey ?? null, m = (await Kn(I()))?.token ?? null, h = await Wo(l, d, {
4818
4866
  token: m,
4819
4867
  key: p
4820
4868
  }), g = (e) => {
4821
4869
  let t = f.get(e);
4822
4870
  return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
4823
- }, _ = (e) => !d.has(e) && g(e) === "locked", v = await is({
4871
+ }, _ = (e) => !d.has(e) && g(e) === "locked", v = await fs({
4824
4872
  packs: l,
4825
4873
  installedSet: d,
4826
4874
  stateOf: g,
@@ -4828,49 +4876,49 @@ async function rs(e = {}) {
4828
4876
  adminAvailable: !!a.apps.admin
4829
4877
  });
4830
4878
  if (v === null && (s.cancel("Cancelled."), process.exit(0)), v.length === 0) {
4831
- s.outro(R.muted("No packs selected. Nothing to do."));
4879
+ s.outro(z.muted("No packs selected. Nothing to do."));
4832
4880
  return;
4833
4881
  }
4834
- let b = ss(v), x = cs(v), S = ka(l, b), C = Sa(Aa(l, S)), w;
4882
+ let b = hs(v), x = gs(v), S = La(l, b), C = Aa(Ra(l, S)), w;
4835
4883
  try {
4836
- w = wa(b, C, u);
4884
+ w = Ma(b, C, u);
4837
4885
  } catch (e) {
4838
4886
  s.cancel($(e)), process.exit(1);
4839
4887
  }
4840
4888
  if (w.order.length === 0) {
4841
- s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(R.muted("Your selection is already part of the project."));
4889
+ s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(z.muted("Your selection is already part of the project."));
4842
4890
  return;
4843
4891
  }
4844
- let T = Ta({
4892
+ let T = Na({
4845
4893
  order: w.order,
4846
4894
  graph: C,
4847
4895
  isLocked: _,
4848
4896
  installed: u
4849
4897
  });
4850
4898
  if (T.blocked.length > 0 && !m && !p) {
4851
- let e = await rr();
4852
- e && (m = e, h = await Io(l, d, {
4899
+ let e = await nr();
4900
+ e && (m = e, h = await Wo(l, d, {
4853
4901
  token: m,
4854
4902
  key: p
4855
- }), T = Ta({
4903
+ }), T = Na({
4856
4904
  order: w.order,
4857
4905
  graph: C,
4858
4906
  isLocked: _,
4859
4907
  installed: u
4860
4908
  }));
4861
4909
  }
4862
- if (T.blocked.length > 0 && await Ro(T.blocked, _, f), T.installable.length === 0) {
4863
- s.outro(R.muted("Nothing left to install once locked packs are removed."));
4910
+ if (T.blocked.length > 0 && await Ko(T.blocked, _, f), T.installable.length === 0) {
4911
+ s.outro(z.muted("Nothing left to install once locked packs are removed."));
4864
4912
  return;
4865
4913
  }
4866
- if (zo(T.installable, f), !e.yes) {
4914
+ if (qo(T.installable, f), !e.yes) {
4867
4915
  let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
4868
4916
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
4869
4917
  }
4870
4918
  c.start("Downloading packs...");
4871
4919
  let E;
4872
4920
  try {
4873
- E = await Bo(T.installable, {
4921
+ E = await Jo(T.installable, {
4874
4922
  token: m,
4875
4923
  key: p
4876
4924
  });
@@ -4878,7 +4926,7 @@ async function rs(e = {}) {
4878
4926
  c.stop("Download failed"), s.cancel($(e)), process.exit(1);
4879
4927
  }
4880
4928
  c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
4881
- let D = await Wo({
4929
+ let D = await Qo({
4882
4930
  prepared: E,
4883
4931
  config: a,
4884
4932
  cwd: o,
@@ -4888,7 +4936,7 @@ async function rs(e = {}) {
4888
4936
  });
4889
4937
  try {
4890
4938
  c.start("Installing pack files...");
4891
- let t = await Qi({
4939
+ let t = await aa({
4892
4940
  packs: E,
4893
4941
  config: a,
4894
4942
  projectRoot: o,
@@ -4901,22 +4949,22 @@ async function rs(e = {}) {
4901
4949
  for (let e of t.errors) s.log.error(e);
4902
4950
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
4903
4951
  }
4904
- c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${R.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), Uo(t.skipped));
4952
+ c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${z.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), Zo(t.skipped));
4905
4953
  for (let e of t.errors) s.log.error(e);
4906
- await Vo({
4954
+ await Yo({
4907
4955
  prepared: E,
4908
4956
  paths: a.paths,
4909
4957
  cwd: o,
4910
4958
  spinner: c
4911
4959
  });
4912
4960
  let n;
4913
- i && (n = await xa(o, e.yes ?? !1)), await pr({
4961
+ i && (n = await ka(o, e.yes ?? !1)), await pr({
4914
4962
  projectRoot: o,
4915
4963
  paths: a.paths,
4916
4964
  skipPrompts: e.yes ?? !1,
4917
4965
  dbReady: n,
4918
4966
  freshScaffold: i
4919
- }), Ho(), s.outro(R.brand(`Installed ${t.appliedPacks.join(", ")}.`));
4967
+ }), Xo(), s.outro(z.brand(`Installed ${t.appliedPacks.join(", ")}.`));
4920
4968
  } finally {
4921
4969
  await Promise.all(E.map((e) => y.rm(e.packDir, {
4922
4970
  recursive: !0,
@@ -4924,25 +4972,25 @@ async function rs(e = {}) {
4924
4972
  })));
4925
4973
  }
4926
4974
  }
4927
- async function is(e) {
4975
+ async function fs(e) {
4928
4976
  let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
4929
4977
  if (i.packs && i.packs.length > 0) {
4930
- let e = i.packs.map(os), n = e.filter((e) => !t.some((t) => t.name === e.name));
4978
+ let e = i.packs.map(ms), n = e.filter((e) => !t.some((t) => t.name === e.name));
4931
4979
  return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
4932
4980
  }
4933
4981
  let o = t.filter((e) => n.has(e.name));
4934
- o.length > 0 && s.note(o.map((e) => ` ${R.muted("✓")} ${e.displayName}`).join("\n"), "Already Installed");
4982
+ o.length > 0 && s.note(o.map((e) => ` ${z.muted("✓")} ${e.displayName}`).join("\n"), "Already Installed");
4935
4983
  let c = t.filter((e) => !n.has(e.name));
4936
- if (c.length === 0) return s.outro(R.muted("Every available pack is already installed.")), [];
4937
- let l = le();
4938
- s.note(c.map((e) => ` ${z.arrow} ${R.highlight(e.displayName)} ${_e(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
4939
- let u = oa(c, { adminAvailable: a }), d = [];
4984
+ if (c.length === 0) return s.outro(z.muted("Every available pack is already installed.")), [];
4985
+ let l = ce();
4986
+ s.note(c.map((e) => ` ${B.arrow} ${z.highlight(e.displayName)} ${ge(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
4987
+ let u = pa(c, { adminAvailable: a }), d = [];
4940
4988
  for (let e of u) {
4941
4989
  let t = e.packs.map((e) => {
4942
4990
  let t = r(e.name);
4943
4991
  return {
4944
4992
  value: e.name,
4945
- label: `${e.displayName} ${Lo(t, e.price)}`,
4993
+ label: `${e.displayName} ${Go(t, e.price)}`,
4946
4994
  hint: e.description
4947
4995
  };
4948
4996
  });
@@ -4959,7 +5007,7 @@ async function is(e) {
4959
5007
  });
4960
5008
  continue;
4961
5009
  }
4962
- let n = await Ha({
5010
+ let n = await Xa({
4963
5011
  message: `Select ${e.label.toLowerCase()} to add (optional)`,
4964
5012
  options: t,
4965
5013
  required: !1
@@ -4969,20 +5017,20 @@ async function is(e) {
4969
5017
  }
4970
5018
  return d;
4971
5019
  }
4972
- var as = /@(frontend|admin)$/;
4973
- function os(e) {
4974
- let t = e.match(as);
5020
+ var ps = /@(frontend|admin)$/;
5021
+ function ms(e) {
5022
+ let t = e.match(ps);
4975
5023
  return t ? {
4976
5024
  name: e.slice(0, -t[0].length),
4977
5025
  slot: t[1]
4978
5026
  } : { name: e };
4979
5027
  }
4980
- function ss(e) {
5028
+ function hs(e) {
4981
5029
  let t = /* @__PURE__ */ new Set(), n = [];
4982
5030
  for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
4983
5031
  return n;
4984
5032
  }
4985
- function cs(e) {
5033
+ function gs(e) {
4986
5034
  let t = /* @__PURE__ */ new Map();
4987
5035
  for (let n of e) {
4988
5036
  if (!n.slot) continue;
@@ -4993,32 +5041,32 @@ function cs(e) {
4993
5041
  }
4994
5042
  //#endregion
4995
5043
  //#region src/commands/login.ts
4996
- async function ls() {
4997
- Ba(), s.intro(R.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
5044
+ async function _s() {
5045
+ Ja(), s.intro(z.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
4998
5046
  let e;
4999
5047
  try {
5000
- e = await nr({ onUrl: (e) => {
5001
- s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
5048
+ e = await tr({ onUrl: (e) => {
5049
+ s.log.info(`If your browser didn't open, visit:\n ${z.path(e)}`);
5002
5050
  } });
5003
5051
  } catch (e) {
5004
5052
  s.cancel(e instanceof Error ? e.message : String(e)), process.exit(1);
5005
5053
  }
5006
- s.outro(R.brand(e.email ? `Logged in as ${e.email}. You can now install packs your organization owns.` : "Logged in. You can now install packs your organization owns."));
5054
+ s.outro(z.brand(e.email ? `Logged in as ${e.email}. You can now install packs your organization owns.` : "Logged in. You can now install packs your organization owns."));
5007
5055
  }
5008
5056
  //#endregion
5009
5057
  //#region src/commands/logout.ts
5010
- async function us() {
5011
- Ba(), s.intro(R.brandBold("Log out of Hype Stack"));
5012
- let e = F(), t = await qn(e);
5058
+ async function vs() {
5059
+ Ja(), s.intro(z.brandBold("Log out of Hype Stack"));
5060
+ let e = I(), t = await Kn(e);
5013
5061
  if (!t) {
5014
- s.outro(R.muted("You're not logged in."));
5062
+ s.outro(z.muted("You're not logged in."));
5015
5063
  return;
5016
5064
  }
5017
- await zn(t.token).catch(() => null), await Yn(e), s.outro(R.brand("Logged out."));
5065
+ await Rn(t.token).catch(() => null), await Jn(e), s.outro(z.brand("Logged out."));
5018
5066
  }
5019
5067
  //#endregion
5020
5068
  //#region src/core/onboard-env.ts
5021
- function ds(e) {
5069
+ function ys(e) {
5022
5070
  let t = [], n = "";
5023
5071
  for (let r of e.split(/\r?\n/)) {
5024
5072
  let e = r.trim();
@@ -5044,19 +5092,7 @@ function ds(e) {
5044
5092
  }
5045
5093
  return t;
5046
5094
  }
5047
- var fs = [
5048
- "replace-with",
5049
- "examplepublickey",
5050
- "change-me",
5051
- "your-key-here"
5052
- ];
5053
- function ps(e) {
5054
- let t = e.trim();
5055
- if (t === "") return !0;
5056
- let n = t.toLowerCase();
5057
- return fs.some((e) => n.includes(e));
5058
- }
5059
- function ms(e, t, n) {
5095
+ function bs(e, t, n) {
5060
5096
  let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
5061
5097
  if (i) return e;
5062
5098
  let r = e.trim();
@@ -5066,119 +5102,118 @@ function ms(e, t, n) {
5066
5102
  });
5067
5103
  return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
5068
5104
  }
5069
- async function hs(e) {
5105
+ async function xs(e) {
5070
5106
  return await J(e) ? y.readFile(e, "utf-8") : "";
5071
5107
  }
5072
- async function gs(e) {
5108
+ async function Ss(e) {
5073
5109
  let t = T.join(T.dirname(e), ".env");
5074
5110
  return await J(t) || await y.copyFile(e, t), t;
5075
5111
  }
5076
- async function _s(e, t, n) {
5077
- let r = ms(await hs(e), t, n);
5112
+ async function Cs(e, t, n) {
5113
+ let r = bs(await xs(e), t, n);
5078
5114
  await y.writeFile(e, r, "utf-8");
5079
5115
  }
5080
5116
  //#endregion
5081
5117
  //#region src/commands/onboard.ts
5082
- async function vs(e = {}) {
5118
+ async function ws(e = {}) {
5083
5119
  let t = e.cwd ?? process.cwd();
5084
- za(), s.intro(R.brandBold("Onboard your stack"));
5120
+ qa(), s.intro(z.brandBold("Onboard your stack"));
5085
5121
  let n;
5086
5122
  try {
5087
5123
  n = await Or(t);
5088
5124
  } catch {
5089
5125
  n = null;
5090
5126
  }
5091
- n || (s.cancel(`${R.path("stack.json")} not found. Run ${R.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5092
- let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await po(t);
5093
- a.length === 0 && s.log.warn(R.muted("No .env.example files found; skipping env setup."));
5094
- for (let n of a) await ys({
5127
+ n || (s.cancel(`${z.path("stack.json")} not found. Run ${z.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5128
+ let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await xo(t);
5129
+ a.length === 0 && s.log.warn(z.muted("No .env.example files found; skipping env setup."));
5130
+ for (let n of a) await Ts({
5095
5131
  examplePath: n,
5096
5132
  projectRoot: t,
5097
5133
  skipPrompts: e.yes ?? !1,
5098
5134
  installedEnvSections: i
5099
5135
  });
5100
5136
  let o = Dr(r);
5101
- o.length > 0 && s.note(o.map((e) => ` ${R.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await Ss(t, e.yes ?? !1), s.outro(R.brand(`All set. Run ${R.command("pnpm dev")} to start your app.`));
5137
+ o.length > 0 && s.note(o.map((e) => ` ${z.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await Os(t, e.yes ?? !1), s.outro(z.brand(`All set. Run ${z.command("pnpm dev")} to start your app.`));
5102
5138
  }
5103
- async function ys(e) {
5104
- let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await gs(t), c = await hs(o), l = ds(await y.readFile(t, "utf-8")), u = R.path(a);
5139
+ async function Ts(e) {
5140
+ let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await Ss(t), c = await xs(o), l = ys(await y.readFile(t, "utf-8")), u = z.path(a);
5105
5141
  s.log.step(`Env: ${u}`);
5106
5142
  for (let e of l) {
5107
- let t = e.vars.filter((e) => ps(e.value));
5108
- if (t.length === 0) continue;
5143
+ if (e.vars.length === 0) continue;
5109
5144
  if (!Cr(e.section, i)) {
5110
- let t = e.section ? R.bold(e.section) : R.bold("Variables");
5111
- s.log.info(`${t} ${R.muted("skipped (pack not installed)")}`);
5145
+ let t = e.section ? z.bold(e.section) : z.bold("Variables");
5146
+ s.log.info(`${t} ${z.muted("skipped (pack not installed)")}`);
5112
5147
  continue;
5113
5148
  }
5114
- let n = xr(e.section), a = e.section ? R.bold(e.section) : R.bold("Variables");
5115
- s.log.step(a), n.link && (s.log.info(`${R.muted("Get your values:")} ${_e(n.link)}`), n.serviceChecklist && n.serviceChecklist.length > 0 && s.note(n.serviceChecklist.map((e) => ` ${R.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(R.muted(n.hint));
5116
- for (let e of t) {
5149
+ let t = xr(e.section), n = e.section ? z.bold(e.section) : z.bold("Variables");
5150
+ s.log.step(n), t.link && (s.log.info(`${z.muted("Get your values:")} ${ge(t.link)}`), t.serviceChecklist && t.serviceChecklist.length > 0 && s.note(t.serviceChecklist.map((e) => ` ${z.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(z.muted(t.hint)), s.log.info(z.muted("Press Enter to keep the current value."));
5151
+ for (let n of e.vars) {
5117
5152
  if (r) {
5118
- s.log.info(`${R.label(e.key)} ${R.muted("skipped (non-interactive)")}`);
5153
+ s.log.info(`${z.label(n.key)} ${z.muted("skipped (non-interactive)")}`);
5119
5154
  continue;
5120
5155
  }
5121
- let t = bs(c, e.key), i = await s.text({
5122
- message: `${R.label(e.key)}`,
5123
- placeholder: t || n.hint
5156
+ let e = Es(c, n.key), i = await s.text({
5157
+ message: `${z.label(n.key)}`,
5158
+ placeholder: e ? `${e} ${z.muted("(Enter keeps this)")}` : t.hint
5124
5159
  });
5125
5160
  s.isCancel(i) && Z();
5126
5161
  let a = (i ?? "").trim();
5127
5162
  if (a === "") {
5128
- s.log.warn(R.muted(`${e.key} left blank.`));
5163
+ s.log.info(z.muted(`${n.key} unchanged.`));
5129
5164
  continue;
5130
5165
  }
5131
- await _s(o, e.key, a), s.log.success(`${e.key} saved`);
5166
+ await Cs(o, n.key, a), s.log.success(`${n.key} saved`);
5132
5167
  }
5133
5168
  }
5134
5169
  }
5135
- function bs(e, t) {
5170
+ function Es(e, t) {
5136
5171
  for (let n of e.split(/\r?\n/)) {
5137
- let e = n.match(RegExp(`^${xs(t)}\\s*=\\s*(.*)$`));
5172
+ let e = n.match(RegExp(`^${Ds(t)}\\s*=\\s*(.*)$`));
5138
5173
  if (e) return e[1].trim();
5139
5174
  }
5140
5175
  return "";
5141
5176
  }
5142
- function xs(e) {
5177
+ function Ds(e) {
5143
5178
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5144
5179
  }
5145
- async function Ss(e, t) {
5146
- if (!await ua() && !await fa(e, t, !1)) {
5147
- s.log.info(R.muted(`Start services later with ${R.command("docker compose up -d")} (in apps/backend), then ${R.command("pnpm --filter @internal/backend migration:latest")}.`));
5180
+ async function Os(e, t) {
5181
+ if (!await va() && !await ba(e, t, !1)) {
5182
+ s.log.info(z.muted(`Start services later with ${z.command("docker compose up -d")} (in apps/backend), then ${z.command("pnpm --filter @internal/backend migration:latest")}.`));
5148
5183
  return;
5149
5184
  }
5150
5185
  let n = s.spinner();
5151
- if (n.start("Waiting for Postgres to be ready..."), !await ma(e)) {
5152
- n.error("Postgres health check timed out"), s.log.warn(R.muted(`Run migrations manually once Postgres is ready: ${R.command("pnpm --filter @internal/backend migration:latest")}`));
5186
+ if (n.start("Waiting for Postgres to be ready..."), !await Sa(e)) {
5187
+ n.error("Postgres health check timed out"), s.log.warn(z.muted(`Run migrations manually once Postgres is ready: ${z.command("pnpm --filter @internal/backend migration:latest")}`));
5153
5188
  return;
5154
5189
  }
5155
- if (n.stop(R.success("Postgres is ready")), await ga(e)) {
5156
- s.log.info(R.muted("Migrations already applied, skipping."));
5190
+ if (n.stop(z.success("Postgres is ready")), await wa(e)) {
5191
+ s.log.info(z.muted("Migrations already applied, skipping."));
5157
5192
  return;
5158
5193
  }
5159
5194
  let r = t ? !0 : await s.confirm({
5160
- message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
5195
+ message: `Run database migrations with ${z.command("prisma migrate deploy")}?`,
5161
5196
  initialValue: !0
5162
5197
  });
5163
5198
  if (s.isCancel(r) && Z(), !r) {
5164
- s.log.info(R.muted("Skipping database migrations."));
5199
+ s.log.info(z.muted("Skipping database migrations."));
5165
5200
  return;
5166
5201
  }
5167
- await _a(e);
5202
+ await Ta(e);
5168
5203
  }
5169
5204
  //#endregion
5170
5205
  //#region src/core/templates.ts
5171
- var Cs = G.createRequest()({
5206
+ var ks = K.createRequest()({
5172
5207
  endpoint: "/templates/list",
5173
5208
  method: "GET"
5174
5209
  });
5175
- async function ws() {
5176
- let { data: e, error: t } = await Cs.send();
5210
+ async function As() {
5211
+ let { data: e, error: t } = await ks.send();
5177
5212
  if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
5178
5213
  return e.templates;
5179
5214
  }
5180
- async function Ts(e) {
5181
- let { data: t, error: n, status: r } = await G.createRequest()({
5215
+ async function js(e) {
5216
+ let { data: t, error: n, status: r } = await K.createRequest()({
5182
5217
  endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
5183
5218
  method: "GET"
5184
5219
  }).send();
@@ -5186,13 +5221,13 @@ async function Ts(e) {
5186
5221
  if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
5187
5222
  return t;
5188
5223
  }
5189
- async function Es(e, t = {}) {
5190
- let n = G.createRequest()({
5224
+ async function Ms(e, t = {}) {
5225
+ let n = K.createRequest()({
5191
5226
  endpoint: `/templates/${encodeURIComponent(e)}/download`,
5192
5227
  method: "POST"
5193
5228
  }), r = {
5194
- "X-Device-Id": Zn(),
5195
- "X-Client-Info": Qn()
5229
+ "X-Device-Id": Xn(),
5230
+ "X-Client-Info": Zn()
5196
5231
  };
5197
5232
  t.token && (r.Authorization = `Bearer ${t.token}`);
5198
5233
  let { data: i, error: a, success: o } = await n.setPayload({ key: t.licenseKey ?? void 0 }).setHeaders(r).send();
@@ -5214,9 +5249,9 @@ async function Es(e, t = {}) {
5214
5249
  }
5215
5250
  //#endregion
5216
5251
  //#region src/commands/template.ts
5217
- async function Ds(t = {}) {
5252
+ async function Ns(t = {}) {
5218
5253
  let n = t.cwd ?? process.cwd();
5219
- za();
5254
+ qa();
5220
5255
  let r = s.spinner();
5221
5256
  r.start("Loading packs...");
5222
5257
  let o;
@@ -5228,15 +5263,15 @@ async function Ds(t = {}) {
5228
5263
  r.stop("Packs loaded"), r.start("Loading templates...");
5229
5264
  let c;
5230
5265
  try {
5231
- c = await ws();
5266
+ c = await As();
5232
5267
  } catch (e) {
5233
5268
  r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
5234
5269
  }
5235
5270
  let l = t.templateId;
5236
5271
  if (!l) {
5237
5272
  t.yes && (r.stop("Template id required"), s.cancel("Pass a template id with `npx @hype-stack/cli template <id>` (required in --yes mode)."), process.exit(1)), c.length === 0 && (r.stop("No templates available"), s.cancel("No templates are available yet. Check back later."), process.exit(1)), r.stop("Templates loaded");
5238
- let e = le();
5239
- s.note(c.map((t) => ` ${z.arrow} ${R.highlight(t.name)} ${_e(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
5273
+ let e = ce();
5274
+ s.note(c.map((t) => ` ${B.arrow} ${z.highlight(t.name)} ${ge(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
5240
5275
  let n = await s.select({
5241
5276
  message: "Choose a template",
5242
5277
  options: c.map((e) => ({
@@ -5251,151 +5286,151 @@ async function Ds(t = {}) {
5251
5286
  u || (r.stop("Template not found"), s.cancel(`Template "${l}" not found. Available: ${c.map((e) => e.id).join(", ") || "(none)"}`), process.exit(1)), r.stop(`Template: ${u.name}`);
5252
5287
  let d;
5253
5288
  try {
5254
- d = await Ts(u.id);
5289
+ d = await js(u.id);
5255
5290
  } catch (e) {
5256
5291
  s.cancel($(e)), process.exit(1);
5257
5292
  }
5258
- let f = await ns(n, {}, {
5293
+ let f = await us(n, {}, {
5259
5294
  defaultTheme: d.theme,
5260
5295
  defaultMode: d.defaultMode
5261
5296
  }), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
5262
5297
  try {
5263
5298
  h = await Or(p ?? n);
5264
5299
  } catch (e) {
5265
- s.cancel(`Could not parse ${R.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5300
+ s.cancel(`Could not parse ${z.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5266
5301
  }
5267
- h || (s.cancel(p ? `Could not read ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${R.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${R.path("stack.json")} is missing ${R.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
5302
+ h || (s.cancel(p ? `Could not read ${z.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${z.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${z.path("stack.json")} is missing ${z.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
5268
5303
  let g = p ?? n;
5269
- s.intro(R.brandBold("Install a template"));
5270
- let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await qn(F()))?.token ?? null, C = await Os(u, t.variants, t.yes ?? !1), w = Ea(u.slots, C), E = Da(u.slots, u.packs, w), D = await ks({
5304
+ s.intro(z.brandBold("Install a template"));
5305
+ let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Kn(I()))?.token ?? null, C = await Ps(u, t.variants, t.yes ?? !1), w = Pa(u.slots, C), E = Fa(u.slots, u.packs, w), D = await Fs({
5271
5306
  packs: o,
5272
5307
  templatePacks: E,
5273
5308
  installedSet: v,
5274
5309
  options: t
5275
5310
  }), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
5276
5311
  k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
5277
- let ee = Aa(o, w), A = Sa(ee), te;
5312
+ let ee = Ra(o, w), A = Aa(ee), j;
5278
5313
  try {
5279
- te = wa(O, A, _);
5314
+ j = Ma(O, A, _);
5280
5315
  } catch (e) {
5281
5316
  s.cancel($(e)), process.exit(1);
5282
5317
  }
5283
- if (te.order.length === 0) {
5284
- s.outro(R.muted("Every pack in this template is already installed."));
5318
+ if (j.order.length === 0) {
5319
+ s.outro(z.muted("Every pack in this template is already installed."));
5285
5320
  return;
5286
5321
  }
5287
- let ne = await Io(ee, v, {
5322
+ let te = await Wo(ee, v, {
5288
5323
  token: S,
5289
5324
  key: x
5290
- }), re = (e) => {
5325
+ }), ne = (e) => {
5291
5326
  let t = b.get(e);
5292
- return !t || t.tier === "free" ? "free" : ne[e]?.owned ? "owned" : "locked";
5293
- }, j = (e) => !v.has(e) && re(e) === "locked", M = Ta({
5294
- order: te.order,
5327
+ return !t || t.tier === "free" ? "free" : te[e]?.owned ? "owned" : "locked";
5328
+ }, M = (e) => !v.has(e) && ne(e) === "locked", N = Na({
5329
+ order: j.order,
5295
5330
  graph: A,
5296
- isLocked: j,
5331
+ isLocked: M,
5297
5332
  installed: _
5298
5333
  });
5299
- if (M.blocked.length > 0 && !S && !x) {
5300
- let e = await rr();
5301
- e && (S = e, ne = await Io(ee, v, {
5334
+ if (N.blocked.length > 0 && !S && !x) {
5335
+ let e = await nr();
5336
+ e && (S = e, te = await Wo(ee, v, {
5302
5337
  token: S,
5303
5338
  key: x
5304
- }), M = Ta({
5305
- order: te.order,
5339
+ }), N = Na({
5340
+ order: j.order,
5306
5341
  graph: A,
5307
- isLocked: j,
5342
+ isLocked: M,
5308
5343
  installed: _
5309
5344
  }));
5310
5345
  }
5311
- if (M.blocked.length > 0 && await Ro(M.blocked, j, b), M.installable.length === 0) {
5312
- s.outro(R.muted("Nothing left to install once locked packs are removed."));
5346
+ if (N.blocked.length > 0 && await Ko(N.blocked, M, b), N.installable.length === 0) {
5347
+ s.outro(z.muted("Nothing left to install once locked packs are removed."));
5313
5348
  return;
5314
5349
  }
5315
- if (zo(M.installable, b), !t.yes) {
5316
- let e = await s.confirm({ message: `Install template ${R.brandBold(u.name)} (${M.installable.length} pack${M.installable.length === 1 ? "" : "s"})?` });
5350
+ if (qo(N.installable, b), !t.yes) {
5351
+ let e = await s.confirm({ message: `Install template ${z.brandBold(u.name)} (${N.installable.length} pack${N.installable.length === 1 ? "" : "s"})?` });
5317
5352
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
5318
5353
  }
5319
5354
  r.start("Downloading packs...");
5320
- let N;
5355
+ let P;
5321
5356
  try {
5322
- N = await Bo(M.installable, {
5357
+ P = await Jo(N.installable, {
5323
5358
  token: S,
5324
5359
  key: x
5325
5360
  });
5326
5361
  } catch (e) {
5327
5362
  r.stop("Download failed"), s.cancel($(e)), process.exit(1);
5328
5363
  }
5329
- r.stop(`Downloaded ${N.length} pack${N.length === 1 ? "" : "s"}`);
5330
- let ie = await Wo({
5331
- prepared: N,
5364
+ r.stop(`Downloaded ${P.length} pack${P.length === 1 ? "" : "s"}`);
5365
+ let re = await Qo({
5366
+ prepared: P,
5332
5367
  config: h,
5333
5368
  cwd: g,
5334
5369
  force: t.force ?? !1,
5335
5370
  yes: t.yes ?? !1
5336
- }), P = null;
5371
+ }), F = null;
5337
5372
  try {
5338
5373
  r.start("Installing pack files...");
5339
- let n = await Qi({
5340
- packs: N,
5374
+ let n = await aa({
5375
+ packs: P,
5341
5376
  config: h,
5342
5377
  projectRoot: g,
5343
5378
  force: t.force ?? !1,
5344
- overwrite: ie
5379
+ overwrite: re
5345
5380
  });
5346
5381
  if (n.aborted) {
5347
5382
  r.stop("Installation aborted");
5348
5383
  for (let e of n.errors) s.log.error(e);
5349
5384
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
5350
5385
  }
5351
- r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${R.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), Uo(n.skipped));
5386
+ r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${z.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), Zo(n.skipped));
5352
5387
  for (let e of n.errors) s.log.error(e);
5353
5388
  r.start("Applying template overrides...");
5354
- let o = await Es(u.id, {
5389
+ let o = await Ms(u.id, {
5355
5390
  token: S,
5356
5391
  licenseKey: x
5357
5392
  });
5358
- o.status === "denied" && (r.stop("Template download denied"), s.cancel(`Access to template "${u.id}" was denied (${o.reason}). Try 'npx @hype-stack/cli login' or check your license.`), process.exit(1)), P = o.templateDir;
5359
- let c = await ea({
5393
+ o.status === "denied" && (r.stop("Template download denied"), s.cancel(`Access to template "${u.id}" was denied (${o.reason}). Try 'npx @hype-stack/cli login' or check your license.`), process.exit(1)), F = o.templateDir;
5394
+ let c = await sa({
5360
5395
  manifest: d,
5361
5396
  config: h,
5362
5397
  projectRoot: g,
5363
- templateDir: P
5398
+ templateDir: F
5364
5399
  });
5365
5400
  r.stop("Template overrides applied"), c.installed.length > 0 && s.log.success(`${c.installed.length} template file${c.installed.length === 1 ? "" : "s"} applied`);
5366
5401
  for (let e of c.errors) s.log.error(e);
5367
5402
  if (!m) {
5368
5403
  let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
5369
- a(n) && (await to(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(R.muted(`Could not find ${R.path("assets/styles.css")} to apply the theme`)));
5404
+ a(n) && (await lo(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(z.muted(`Could not find ${z.path("assets/styles.css")} to apply the theme`)));
5370
5405
  let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
5371
- await Ya(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(R.muted(`Could not find ${R.path("src/hooks/use-theme.ts")} to set the default color mode`));
5406
+ await ro(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(z.muted(`Could not find ${z.path("src/hooks/use-theme.ts")} to set the default color mode`));
5372
5407
  }
5373
- await As({
5374
- prepared: N,
5408
+ await Is({
5409
+ prepared: P,
5375
5410
  templateNpm: d.dependencies_npm,
5376
5411
  paths: h.paths,
5377
5412
  cwd: g,
5378
5413
  spinner: r
5379
5414
  });
5380
5415
  let l;
5381
- m && (l = await xa(g, t.yes ?? !1)), await pr({
5416
+ m && (l = await ka(g, t.yes ?? !1)), await pr({
5382
5417
  projectRoot: g,
5383
5418
  paths: h.paths,
5384
5419
  skipPrompts: t.yes ?? !1,
5385
5420
  dbReady: l,
5386
5421
  freshScaffold: m
5387
- }), Ho(), s.outro(R.brand(`Installed template ${u.name}.`));
5422
+ }), Xo(), s.outro(z.brand(`Installed template ${u.name}.`));
5388
5423
  } finally {
5389
- await Promise.all(N.map((e) => y.rm(e.packDir, {
5424
+ await Promise.all(P.map((e) => y.rm(e.packDir, {
5390
5425
  recursive: !0,
5391
5426
  force: !0
5392
- }))), P && await y.rm(P, {
5427
+ }))), F && await y.rm(F, {
5393
5428
  recursive: !0,
5394
5429
  force: !0
5395
5430
  });
5396
5431
  }
5397
5432
  }
5398
- async function Os(e, t, n) {
5433
+ async function Ps(e, t, n) {
5399
5434
  let r = {};
5400
5435
  for (let i of e.slots) {
5401
5436
  if (t?.[i.family]) {
@@ -5419,7 +5454,7 @@ async function Os(e, t, n) {
5419
5454
  }
5420
5455
  return r;
5421
5456
  }
5422
- async function ks(e) {
5457
+ async function Fs(e) {
5423
5458
  let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
5424
5459
  if (i.packs && i.packs.length > 0) {
5425
5460
  let e = i.packs.filter((e) => !t.some((t) => t.name === e));
@@ -5428,9 +5463,9 @@ async function ks(e) {
5428
5463
  if (i.yes) return [];
5429
5464
  let o = t.filter((e) => e.category === "feature" && !a.has(e.name) && !r.has(e.name));
5430
5465
  if (o.length === 0) return [];
5431
- let c = le();
5432
- s.note(o.map((e) => ` ${z.arrow} ${R.highlight(e.displayName)} ${_e(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5433
- let l = await Ha({
5466
+ let c = ce();
5467
+ s.note(o.map((e) => ` ${B.arrow} ${z.highlight(e.displayName)} ${ge(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5468
+ let l = await Xa({
5434
5469
  message: "Add extra packs on top of the template (optional)",
5435
5470
  options: o.map((e) => ({
5436
5471
  value: e.name,
@@ -5441,25 +5476,25 @@ async function ks(e) {
5441
5476
  });
5442
5477
  return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
5443
5478
  }
5444
- async function As(e) {
5445
- let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = Po(t.map((e) => e.manifest.dependencies_npm)), c = No(n ? Po([o, n]) : o, r);
5479
+ async function Is(e) {
5480
+ let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = Ho(t.map((e) => e.manifest.dependencies_npm)), c = Vo(n ? Ho([o, n]) : o, r);
5446
5481
  if (c.errors.length > 0) {
5447
5482
  for (let e of c.errors) s.log.error(e);
5448
5483
  return;
5449
5484
  }
5450
5485
  if (c.operations.length === 0) return;
5451
5486
  a.start("Installing npm dependencies...");
5452
- let l = await Fo(c.operations, i);
5487
+ let l = await Uo(c.operations, i);
5453
5488
  if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
5454
5489
  }
5455
5490
  //#endregion
5456
5491
  //#region src/cli.ts
5457
- function js(e) {
5492
+ function Ls(e) {
5458
5493
  if (!e) return;
5459
5494
  let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
5460
5495
  return t.length > 0 ? t : void 0;
5461
5496
  }
5462
- function Ms(e) {
5497
+ function Rs(e) {
5463
5498
  if (!e) return;
5464
5499
  let t = {};
5465
5500
  for (let n of e.split(",")) {
@@ -5468,10 +5503,10 @@ function Ms(e) {
5468
5503
  }
5469
5504
  return Object.keys(t).length > 0 ? t : void 0;
5470
5505
  }
5471
- function Ns() {
5506
+ function zs() {
5472
5507
  let e = new o();
5473
5508
  return e.name("hype-stack").description("Build with Hype Stack -- templates, components, modules, and more").version(A, "-v, --version"), e.command("create").description("Create a new Hype Stack project").option("-n, --name <name>", "Project name").option("-d, --directory <path>", "Target directory").option("-e, --editor <editor>", "Code editor (cursor, claude, windsurf, copilot)").option("-t, --theme <theme>", "Color theme (default, slate, rose, emerald, violet, amber, ocean, zinc-mono, crimson, midnight)").option("--no-install", "Skip dependency installation").option("--no-setup", "Skip Docker services and database migrations after create").option("-y, --yes", "Skip confirmation prompts (requires --name)").action(async (e) => {
5474
- await es({
5509
+ await cs({
5475
5510
  name: e.name,
5476
5511
  directory: e.directory,
5477
5512
  install: e.install,
@@ -5481,38 +5516,38 @@ function Ns() {
5481
5516
  setup: e.setup
5482
5517
  });
5483
5518
  }), e.command("init").description("Initialize stack.json in the current project").action(async () => {
5484
- await ts({});
5519
+ await ls({});
5485
5520
  }), e.command("onboard").description("Set up env vars, run migrations, and get the start command").option("-y, --yes", "Skip prompts, accept defaults").option("--skip-migrations", "Skip Docker services and database migrations").option("--cwd <path>", "Working directory").action(async (e) => {
5486
- await vs({
5521
+ await ws({
5487
5522
  cwd: e.cwd,
5488
5523
  yes: e.yes,
5489
5524
  skipMigrations: e.skipMigrations
5490
5525
  });
5491
5526
  }), e.command("compose").description("Choose feature packs to add to your project").option("--packs <list>", "Comma-separated pack names (non-interactive). Append @frontend or @admin to a layout pack to target that app shell, e.g. layout-basic@frontend,layout-native-app-shell@admin").option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts").option("-k, --key <key>", "License key").option("--license-key <key>", "License key (alias for --key)").option("--cwd <path>", "Working directory").action(async (e) => {
5492
- await rs({
5493
- packs: js(e.packs),
5527
+ await ds({
5528
+ packs: Ls(e.packs),
5494
5529
  force: e.force,
5495
5530
  yes: e.yes,
5496
5531
  licenseKey: e.key ?? e.licenseKey,
5497
5532
  cwd: e.cwd
5498
5533
  });
5499
5534
  }), e.command("template").description("Install a template by id, with starter/layout variant swaps and extra packs on top").argument("[id]", "Template id (omit to pick interactively)").option("--variants <map>", "Preselect slot variants, e.g. starter-saas=starter-saas-better-auth,layout=layout-basic").option("--packs <list>", "Extra packs to add on top of the template (comma-separated)").option("--force", "Overwrite existing files").option("-y, --yes", "Skip confirmation prompts (requires <id>)").option("-k, --key <key>", "License key").option("--license-key <key>", "License key (alias for --key)").option("--cwd <path>", "Working directory").action(async (e, t) => {
5500
- await Ds({
5535
+ await Ns({
5501
5536
  templateId: e,
5502
- variants: Ms(t.variants),
5503
- packs: js(t.packs),
5537
+ variants: Rs(t.variants),
5538
+ packs: Ls(t.packs),
5504
5539
  force: t.force,
5505
5540
  yes: t.yes,
5506
5541
  licenseKey: t.key ?? t.licenseKey,
5507
5542
  cwd: t.cwd
5508
5543
  });
5509
5544
  }), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
5510
- await ls();
5545
+ await _s();
5511
5546
  }), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
5512
- await us();
5547
+ await vs();
5513
5548
  }), e.command("auth").description("Alias for `login`").action(async () => {
5514
- await ls();
5549
+ await _s();
5515
5550
  }), e;
5516
5551
  }
5517
5552
  //#endregion
5518
- export { ns as a, rs as i, us as n, ts as o, ls as r, es as s, Ns as t };
5553
+ export { us as a, ds as i, vs as n, ls as o, _s as r, cs as s, zs as t };