@hype-stack/cli 0.5.8 → 0.5.9

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.8", j = "gh:BetterTyped/hype-stack", M = "stack.json", te = "/schema/stack.json", N = "https://api.hype-stack.dev", P = "HYPE_STACK_API_URL", F = "https://www.hype-stack.dev", ne = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/, I = [
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 = [
17
17
  {
18
18
  value: "cursor",
19
19
  label: "Cursor",
@@ -31,109 +31,109 @@ var A = "0.5.8", j = "gh:BetterTyped/hype-stack", M = "stack.json", te = "/schem
31
31
  value: "copilot",
32
32
  label: "GitHub Copilot"
33
33
  }
34
- ], re = I.map((e) => e.value), ie = ".cursor/rules", ae = ".cursor", oe = ".agents";
35
- function L() {
34
+ ], ae = P.map((e) => e.value), oe = ".cursor/rules", se = ".cursor", ce = ".agents";
35
+ function F() {
36
36
  let e = process.env.HYPE_STACK_API_URL;
37
- return e ? (ce(e), e.replace(/\/+$/, "")) : N;
37
+ return e ? (ue(e), e.replace(/\/+$/, "")) : j;
38
38
  }
39
- function se() {
39
+ function le() {
40
40
  let e = process.env.HYPE_STACK_WEB_URL;
41
- return e ? (ce(e), e.replace(/\/+$/, "")) : F;
41
+ return e ? (ue(e), e.replace(/\/+$/, "")) : N;
42
42
  }
43
- function ce(e) {
43
+ function ue(e) {
44
44
  try {
45
45
  let t = new URL(e);
46
- if (!t.protocol.startsWith("http")) throw Error(`${P} must use http or https protocol, got "${t.protocol}"`);
46
+ if (!t.protocol.startsWith("http")) throw Error(`${M} must use http or https protocol, got "${t.protocol}"`);
47
47
  } catch (t) {
48
- throw t instanceof TypeError ? Error(`${P} is not a valid URL: "${e}"`, { cause: t }) : t;
48
+ throw t instanceof TypeError ? Error(`${M} is not a valid URL: "${e}"`, { cause: t }) : t;
49
49
  }
50
50
  }
51
- function le() {
52
- return `${L()}${te}`;
51
+ function de() {
52
+ return `${F()}${re}`;
53
53
  }
54
54
  //#endregion
55
55
  //#region src/ui/theme.ts
56
- var ue = (e) => `\x1b[38;5;208m${e}\x1b[39m`, de = (e) => `\x1b[38;5;214m${e}\x1b[39m`, R = (e) => `\x1b[38;5;220m${e}\x1b[39m`, fe = (e) => `\x1b[38;5;33m${e}\x1b[39m`, z = (e) => `\x1b[38;5;39m${e}\x1b[39m`, pe = (e) => `\x1b[38;5;81m${e}\x1b[39m`, me = {
57
- orange: ue,
58
- orangeBright: de,
59
- amber: R,
60
- deepBlue: fe,
61
- skyBlue: z,
62
- lightBlue: pe
63
- }, B = {
64
- brand: (e) => ue(e),
65
- brandBold: (e) => b.bold(ue(e)),
66
- accent: (e) => z(e),
67
- accentBold: (e) => b.bold(z(e)),
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)),
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(z(e)),
75
- command: (e) => b.bold(R(e)),
74
+ path: (e) => b.underline(L(e)),
75
+ command: (e) => b.bold(I(e)),
76
76
  label: (e) => b.dim(b.bold(e))
77
77
  };
78
- function he(e, t = e) {
79
- return `\x1b]8;;${e}\x07${z(t)}\x1b]8;;\x07`;
80
- }
81
- var V = {
82
- arrow: ue("›"),
83
- bullet: B.muted("·"),
84
- dash: B.muted("─"),
85
- corner: B.muted("╰"),
86
- pipe: B.muted("│"),
87
- dot: B.muted("•"),
88
- spark: R("✦"),
89
- sparkSmall: de("✧"),
90
- bolt: R("⚡")
91
- }, ge = [
92
- R,
93
- R,
94
- de,
95
- ue,
96
- fe,
97
- z,
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,
98
94
  pe,
99
- pe
95
+ fe,
96
+ me,
97
+ L,
98
+ he,
99
+ he
100
100
  ];
101
- function _e(e) {
101
+ function ye(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 ge[Math.min(Math.floor(r * ge.length), ge.length - 1)](e);
106
+ return ve[Math.min(Math.floor(r * ve.length), ve.length - 1)](e);
107
107
  }).join("");
108
108
  }
109
- function ve(e, t, n) {
109
+ function be(e, t, n) {
110
110
  return Math.round(e + (t - e) * n);
111
111
  }
112
- function ye(e, t) {
112
+ function xe(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;${ve(n[0], r[0], u)};${ve(n[1], r[1], u)};${ve(n[2], r[2], u)}m${e}\x1b[39m`;
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`;
118
118
  }).join(""));
119
119
  }
120
120
  //#endregion
121
121
  //#region src/core/license.ts
122
- function be(e) {
123
- return `${se()}/packs/${e}`;
122
+ function Se(e) {
123
+ return `${le()}/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 xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDescriptor, we = Object.getOwnPropertyNames, Te = Object.getPrototypeOf, Ee = Object.prototype.hasOwnProperty, De = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), Oe = (e, t, n, r) => {
128
- if (t && typeof t == "object" || typeof t == "function") for (var i = we(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ee.call(e, s) && s !== n && Se(e, s, {
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, {
129
129
  get: ((e) => t[e]).bind(null, s),
130
- enumerable: !(r = Ce(t, s)) || r.enumerable
130
+ enumerable: !(r = Te(t, s)) || r.enumerable
131
131
  });
132
132
  return e;
133
- }, ke = (e, t, n) => (n = e == null ? {} : xe(Te(e)), Oe(t || !e || !e.__esModule ? Se(n, "default", {
133
+ }, je = (e, t, n) => (n = e == null ? {} : Ce(De(e)), Ae(t || !e || !e.__esModule ? we(n, "default", {
134
134
  value: e,
135
135
  enumerable: !0
136
- }) : n, e)), Ae = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, je = /* @__PURE__ */ ke((/* @__PURE__ */ De(((e, t) => {
136
+ }) : n, e)), Me = (e) => `${e.queryKey}_${Date.now().toString(36)}_${Math.random().toString(36).substring(2)}`, Ne = /* @__PURE__ */ je((/* @__PURE__ */ ke(((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 xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDe
308
308
  });
309
309
  else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
310
310
  }
311
- })))()), Me = (e) => `listen_${String(e)}`, Ne = class extends je.default {
311
+ })))()), Pe = (e) => `listen_${String(e)}`, Fe = class extends Ne.default {
312
312
  emitCallbacks = [];
313
313
  constructor(e) {
314
314
  super(e);
@@ -320,26 +320,26 @@ var xe = Object.create, Se = Object.defineProperty, Ce = 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(Me(e), t), () => {
324
- super.off(Me(e), t);
323
+ onListener = (e, t) => (super.on(Pe(e), t), () => {
324
+ super.off(Pe(e), t);
325
325
  });
326
- on = (e, t) => (super.on(e, t), super.emit(Me(e), super.listeners(e).length), this);
327
- off = (e, t) => (super.off(e, t), super.emit(Me(e), super.listeners(e).length), this);
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);
328
328
  addListener = this.on;
329
329
  removeListener = this.off;
330
- }, Pe = class {
331
- emitter = new Ne();
332
- events = ze(this.emitter);
330
+ }, Ie = class {
331
+ emitter = new Fe();
332
+ events = Ve(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 = Be.initiallyFocused, initiallyOnline: n = Be.initiallyOnline } = this.options || Be;
339
- this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Ie();
338
+ let { initiallyFocused: t = He.initiallyFocused, initiallyOnline: n = He.initiallyOnline } = this.options || He;
339
+ this.setInitialFocus(t), this.setInitialOnline(n), this.isBrowser = Re();
340
340
  }
341
341
  initialize = () => {
342
- let { focusEvent: e = Be.focusEvent, onlineEvent: t = Be.onlineEvent } = this.options || Be;
342
+ let { focusEvent: e = He.focusEvent, onlineEvent: t = He.onlineEvent } = this.options || He;
343
343
  e(this.setFocused), t(this.setOnline);
344
344
  };
345
345
  setInitialFocus = async (e) => {
@@ -354,51 +354,51 @@ var xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDe
354
354
  setOnline = (e) => {
355
355
  this.isOnline = e, e ? this.events.emitOnline() : this.events.emitOffline();
356
356
  };
357
- }, Fe = () => {
357
+ }, Le = () => {
358
358
  try {
359
359
  return !!(window && window.addEventListener);
360
360
  } catch {
361
361
  /* istanbul ignore next */
362
362
  return !1;
363
363
  }
364
- }, Ie = () => {
364
+ }, Re = () => {
365
365
  try {
366
- return !!(Fe() && window.document && window.document.addEventListener);
366
+ return !!(Le() && window.document && window.document.addEventListener);
367
367
  } catch {
368
368
  /* istanbul ignore next */
369
369
  return !1;
370
370
  }
371
- }, Le = (e, t, n) => Fe() ? (window.addEventListener(e, t, n), () => window.removeEventListener(e, t, n)) : () => null, Re = (e, t, n) => Ie() ? (window.document.addEventListener(e, t, n), () => window.document.removeEventListener(e, t, n)) : () => null, ze = (e) => ({
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) => ({
372
372
  emitFocus: () => {
373
- e.emit(H.FOCUS);
373
+ e.emit(B.FOCUS);
374
374
  },
375
375
  emitBlur: () => {
376
- e.emit(H.BLUR);
376
+ e.emit(B.BLUR);
377
377
  },
378
378
  emitOnline: () => {
379
- e.emit(H.ONLINE);
379
+ e.emit(B.ONLINE);
380
380
  },
381
381
  emitOffline: () => {
382
- e.emit(H.OFFLINE);
382
+ e.emit(B.OFFLINE);
383
383
  },
384
- onFocus: (t) => (e.on(H.FOCUS, t), () => e.removeListener(H.FOCUS, t)),
385
- onBlur: (t) => (e.on(H.BLUR, t), () => e.removeListener(H.BLUR, t)),
386
- onOnline: (t) => (e.on(H.ONLINE, t), () => e.removeListener(H.ONLINE, t)),
387
- onOffline: (t) => (e.on(H.OFFLINE, t), () => e.removeListener(H.OFFLINE, t))
388
- }), H = /* @__PURE__ */ function(e) {
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) {
389
389
  return e.FOCUS = "focus", e.BLUR = "blur", e.ONLINE = "online", e.OFFLINE = "offline", e;
390
- }({}), Be = {
390
+ }({}), He = {
391
391
  initiallyFocused: !0,
392
392
  initiallyOnline: !0,
393
393
  focusEvent: (e) => {
394
- Re("visibilitychange", () => e(!0)), Le("focus", () => e(!0)), Le("blur", () => e(!1));
394
+ Be("visibilitychange", () => e(!0)), ze("focus", () => e(!0)), ze("blur", () => e(!1));
395
395
  },
396
396
  onlineEvent: (e) => {
397
- Le("online", () => e(!0)), Le("offline", () => e(!1));
397
+ ze("online", () => e(!0)), ze("offline", () => e(!1));
398
398
  }
399
- }, Ve = class {
400
- emitter = new Ne();
401
- events = _t(this.emitter);
399
+ }, Ue = class {
400
+ emitter = new Fe();
401
+ events = yt(this.emitter);
402
402
  constructor() {
403
403
  this.emitter?.setMaxListeners(1e3);
404
404
  }
@@ -435,71 +435,71 @@ var xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDe
435
435
  });
436
436
  });
437
437
  };
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) => ({
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) => ({
439
439
  emitDeduplicated: (t, n = !1) => {
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);
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);
441
441
  },
442
442
  emitLoading: (t, n = !1) => {
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);
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);
444
444
  },
445
445
  emitRequestStart: (t, n = !1) => {
446
- e.emit(tt(), t, n), e.emit(rt(t.requestId), t, n), e.emit(nt(t.request.queryKey), t, n);
446
+ e.emit(rt(), t, n), e.emit(at(t.requestId), t, n), e.emit(it(t.request.queryKey), t, n);
447
447
  },
448
448
  emitResponseStart: (t, n = !1) => {
449
- e.emit(it(), t, n), e.emit(ot(t.requestId), t, n), e.emit(at(t.request.queryKey), t, n);
449
+ e.emit(ot(), t, n), e.emit(ct(t.requestId), t, n), e.emit(st(t.request.queryKey), t, n);
450
450
  },
451
451
  emitUploadProgress: (t, n = !1) => {
452
- e.emit(st(), t, n), e.emit(lt(t.requestId), t, n), e.emit(ct(t.request.queryKey), t, n);
452
+ e.emit(lt(), t, n), e.emit(dt(t.requestId), t, n), e.emit(ut(t.request.queryKey), t, n);
453
453
  },
454
454
  emitDownloadProgress: (t, n = !1) => {
455
- e.emit(ut(), t, n), e.emit(ft(t.requestId), t, n), e.emit(dt(t.request.queryKey), t, n);
455
+ e.emit(ft(), t, n), e.emit(mt(t.requestId), t, n), e.emit(pt(t.request.queryKey), t, n);
456
456
  },
457
457
  emitResponse: (t, n = !1) => {
458
- e.emit(Qe(), t, n), e.emit(et(t.requestId), t, n), e.emit($e(t.request.cacheKey), t, n);
458
+ e.emit(et(), t, n), e.emit(nt(t.requestId), t, n), e.emit(tt(t.request.cacheKey), t, n);
459
459
  },
460
460
  emitAbort: (t, n = !1) => {
461
- e.emit(Ye(), t, n), e.emit(Ze(t.requestId), t, n), e.emit(Xe(t.request.abortKey), t, n);
461
+ e.emit(Ze(), t, n), e.emit($e(t.requestId), t, n), e.emit(Qe(t.request.abortKey), t, n);
462
462
  },
463
463
  emitRemove: (t, n = !1) => {
464
- e.emit(Ke(), t, n), e.emit(Je(t.requestId), t, n), e.emit(qe(t.request.queryKey), t, n);
464
+ e.emit(Je(), t, n), e.emit(Xe(t.requestId), t, n), e.emit(Ye(t.request.queryKey), t, n);
465
465
  },
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 {
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 {
496
496
  logger;
497
497
  level;
498
498
  modules;
499
- emitter = new je.default();
499
+ emitter = new Ne.default();
500
500
  client;
501
501
  constructor(e) {
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;
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;
503
503
  }
504
504
  setSeverity = (e) => {
505
505
  this.level = e;
@@ -530,58 +530,58 @@ var xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDe
530
530
  })
531
531
  });
532
532
  log = (e) => {
533
- this.client.debug && (St.indexOf(this.level) <= St.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
533
+ this.client.debug && (wt.indexOf(this.level) <= wt.indexOf(e.level) || this.modules && !this.modules.includes(e.module) || this.logger(e));
534
534
  };
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;`;
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;`;
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
- }, St = [
538
+ }, wt = [
539
539
  "error",
540
540
  "warning",
541
541
  "info",
542
542
  "debug"
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 = {
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 = {
549
549
  error: "color:#ff3737;",
550
550
  warning: "color:#ffc107;",
551
551
  info: "color:#34a8ff;",
552
552
  debug: "color:#cccccc;"
553
- }, Et = class extends Error {
553
+ }, Ot = class extends Error {
554
554
  constructor() {
555
555
  super("Request timeout"), this.name = "TimeoutError";
556
556
  }
557
- }, Dt = class extends Error {
557
+ }, kt = class extends Error {
558
558
  constructor() {
559
559
  super("Request aborted"), this.name = "AbortError";
560
560
  }
561
- }, Ot = class extends Error {
561
+ }, At = class extends Error {
562
562
  constructor() {
563
563
  super("Request deleted"), this.name = "DeletedError";
564
564
  }
565
- }, kt = class extends Error {
565
+ }, jt = 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
- }, At = class extends Error {
570
+ }, Mt = class extends Error {
571
571
  description;
572
572
  constructor(e) {
573
573
  super("Unexpected error"), this.description = e, this.name = "UnexpectedError";
574
574
  }
575
- }, jt = (e) => e === "timeout" ? new Et() : e === "abort" ? new Dt() : e === "deleted" ? new Ot() : e === "processing" ? new kt() : new At(), Mt = (e) => {
575
+ }, V = (e) => e === "timeout" ? new Ot() : e === "abort" ? new kt() : e === "deleted" ? new At() : e === "processing" ? new jt() : new Mt(), Nt = (e) => {
576
576
  try {
577
577
  return JSON.stringify(e);
578
578
  } catch {
579
579
  return "";
580
580
  }
581
- }, Nt = (e) => {
582
- let t = Fe() && e.payload instanceof FormData, n = typeof e.payload == "object" && e.payload !== null, r = {};
581
+ }, Pt = (e) => {
582
+ let t = Le() && 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
- }, Pt = (e) => Fe() && e instanceof FormData ? e : Mt(e), Ft = [
584
+ }, Ft = (e) => Le() && e instanceof FormData ? e : Nt(e), It = [
585
585
  "onBeforeSent",
586
586
  "onRequestStart",
587
587
  "onResponseStart",
@@ -590,7 +590,7 @@ var xe = Object.create, Se = Object.defineProperty, Ce = Object.getOwnPropertyDe
590
590
  "onResponse",
591
591
  "onRemove"
592
592
  ];
593
- function It(e) {
593
+ function Lt(e) {
594
594
  let t = {
595
595
  onBeforeSent: [],
596
596
  onRequestStart: [],
@@ -600,7 +600,7 @@ function It(e) {
600
600
  onResponse: [],
601
601
  onRemove: []
602
602
  };
603
- e && Ft.forEach((n) => {
603
+ e && It.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 It(e) {
622
622
  },
623
623
  __snapshot() {
624
624
  let e = {};
625
- return Ft.forEach((n) => {
625
+ return It.forEach((n) => {
626
626
  e[n] = [...t[n]];
627
627
  }), e;
628
628
  }
629
629
  };
630
630
  }
631
- var Lt = /* @__PURE__ */ function(e) {
631
+ var Rt = /* @__PURE__ */ function(e) {
632
632
  return e.GET = "GET", e.POST = "POST", e.PUT = "PUT", e.PATCH = "PATCH", e.DELETE = "DELETE", e;
633
- }({}), U = (e, t) => t ? `${t}__${e}` : e, Rt = (e) => {
633
+ }({}), H = (e, t) => t ? `${t}__${e}` : e, zt = (e) => {
634
634
  try {
635
635
  if (typeof e == "string") return e;
636
636
  if (e == null) return "";
@@ -640,13 +640,13 @@ var Lt = /* @__PURE__ */ function(e) {
640
640
  } catch {
641
641
  return "";
642
642
  }
643
- }, zt = ({ loaded: e, total: t }) => !e || !t ? 0 : Number((e * 100 / t).toFixed(0)), Bt = (e, t, { total: n, loaded: r }) => {
643
+ }, Bt = ({ loaded: e, total: t }) => !e || !t ? 0 : Number((e * 100 / t).toFixed(0)), Vt = (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
- }, Vt = (e, t, n) => {
649
+ }, Ht = (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 Lt = /* @__PURE__ */ function(e) {
656
656
  loaded: 0,
657
657
  startTimestamp: +e
658
658
  };
659
- let { timeLeft: a, sizeLeft: o } = Bt(e, t, n);
659
+ let { timeLeft: a, sizeLeft: o } = Vt(e, t, n);
660
660
  return {
661
- progress: zt(n),
661
+ progress: Bt(n),
662
662
  timeLeft: a,
663
663
  sizeLeft: o,
664
664
  total: r,
665
665
  loaded: i,
666
666
  startTimestamp: +e
667
667
  };
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";
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";
670
670
  return [a ? n : r, a];
671
- }, Gt = async (e, t) => {
671
+ }, Kt = async (e, t) => {
672
672
  let n = e.unstable_responseMapper?.(t);
673
673
  return n instanceof Promise ? await n : n || t;
674
- }, Kt = async (e, t) => {
675
- let { client: n } = e, { requestManager: r } = n, [i] = Wt(e, t?.dispatcherType), a;
674
+ }, qt = async (e, t) => {
675
+ let { client: n } = e, { requestManager: r } = n, [i] = Gt(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 Lt = /* @__PURE__ */ function(e) {
748
748
  data: null,
749
749
  status: null,
750
750
  success: !1,
751
- error: jt("deleted"),
751
+ error: V("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 Lt = /* @__PURE__ */ function(e) {
759
759
  u(), d(), f(), p(), m(), h();
760
760
  }
761
761
  });
762
- }, qt = /* @__PURE__ */ function(e) {
762
+ }, Jt = /* @__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
- }({}), Jt = class e {
764
+ }({}), Yt = class e {
765
765
  endpoint;
766
766
  headers;
767
767
  auth;
@@ -785,7 +785,7 @@ var Lt = /* @__PURE__ */ function(e) {
785
785
  deduplicate;
786
786
  deduplicateTime;
787
787
  scope;
788
- $hooks = It();
788
+ $hooks = Lt();
789
789
  isMockerEnabled = !1;
790
790
  unstable_mock;
791
791
  unstable_payloadMapper;
@@ -802,7 +802,7 @@ var Lt = /* @__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 = 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 } = {
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 } = {
806
806
  ...this.client.adapter.unstable_getRequestDefaults?.(t),
807
807
  ...t
808
808
  };
@@ -912,11 +912,11 @@ var Lt = /* @__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 = It(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 = Lt(this.$hooks.__snapshot()), r;
916
916
  }
917
917
  abort = () => {
918
918
  let { requestManager: e } = this.client;
919
- return e.abortByKey(U(this.abortKey, this.scope)), this.clone();
919
+ return e.abortByKey(H(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 Lt = /* @__PURE__ */ function(e) {
931
931
  cache: !0,
932
932
  response: t
933
933
  };
934
- let r = this.client.cache.get(U(this.cacheKey, this.scope));
934
+ let r = this.client.cache.get(H(this.cacheKey, this.scope));
935
935
  if (r) return {
936
936
  override: n,
937
937
  cacheTime: this.cacheTime,
@@ -953,7 +953,7 @@ var Lt = /* @__PURE__ */ function(e) {
953
953
  };
954
954
  };
955
955
  read() {
956
- let e = this.client.cache.get(U(this.cacheKey, this.scope));
956
+ let e = this.client.cache.get(H(this.cacheKey, this.scope));
957
957
  if (e) return {
958
958
  data: e.data,
959
959
  error: e.error,
@@ -965,7 +965,7 @@ var Lt = /* @__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 = U(this.abortKey, this.scope);
968
+ let { adapter: t, requestManager: n } = this.client, r = this.clone(e), i = this.client.unstable_requestIdMapper(this), a = H(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 Lt = /* @__PURE__ */ function(e) {
975
975
  ...e,
976
976
  cachePolicy: void 0
977
977
  };
978
- if (n === "network-only") return Kt(i, a);
978
+ if (n === "network-only") return qt(i, a);
979
979
  let o = i.read();
980
- if (n === "cache-first") return o ? Gt(i, o) : Kt(i, a);
980
+ if (n === "cache-first") return o ? Kt(i, o) : qt(i, a);
981
981
  if (o) {
982
- let e = await Gt(i, o);
983
- return Kt(i, a), e;
982
+ let e = await Kt(i, o);
983
+ return qt(i, a), e;
984
984
  }
985
- return Kt(i, a);
985
+ return qt(i, a);
986
986
  };
987
987
  static fromJSON = (t, n) => new e(t, n.requestOptions, n);
988
- }, Yt = async ({ request: e, requestId: t, resolve: n, onStartTime: r, internalErrorMapping: i }) => {
988
+ }, Xt = 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 Lt = /* @__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 = U(_, d.scope), y = d.payload;
998
+ let { client: g, abortKey: _ } = d, v = H(_, 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 Lt = /* @__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 = Vt(new Date(e), new Date(n), r);
1007
+ let i = Ht(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 = Vt(new Date(e), new Date(n), r);
1014
+ let i = Ht(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 Lt = /* @__PURE__ */ function(e) {
1067
1067
  requestId: t,
1068
1068
  request: d
1069
1069
  }), u;
1070
- }, j = (e) => {
1070
+ }, te = (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
- }, M = () => {
1077
+ }, ne = () => {
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
- }, te = async ({ data: e, error: r, status: i, extra: a }) => {
1084
+ }, re = 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 Lt = /* @__PURE__ */ function(e) {
1106
1106
  response: o
1107
1107
  }
1108
1108
  }), o;
1109
- }, N = Xt({
1109
+ }, j = Zt({
1110
1110
  request: d,
1111
1111
  requestId: t,
1112
1112
  startTime: x,
1113
1113
  logger: c,
1114
1114
  resolve: n
1115
- }), P = ({ status: e, extra: n }) => (c.error({
1115
+ }), M = ({ 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
- }), N({
1123
- error: i(jt("abort")),
1122
+ }), j({
1123
+ error: i(V("abort")),
1124
1124
  status: e,
1125
1125
  extra: n
1126
- })), F = ({ status: e, extra: n }) => (c.error({
1126
+ })), N = ({ 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
- }), N({
1134
- error: jt("timeout"),
1133
+ }), j({
1134
+ error: V("timeout"),
1135
1135
  status: e,
1136
1136
  extra: n
1137
- })), ne = ({ status: e, extra: n }) => (c.error({
1137
+ })), ie = ({ 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
- }), N({
1145
- error: jt(),
1144
+ }), j({
1145
+ error: V(),
1146
1146
  status: e,
1147
1147
  extra: n
1148
- })), I = () => a.getAbortController(v, t), re = ({ status: e, extra: n, onAbort: r = () => {} }) => {
1149
- let i = I();
1150
- if (!i) throw new kt("Controller is not found");
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");
1151
1151
  let o = () => {
1152
- P({
1152
+ M({
1153
1153
  status: e,
1154
1154
  extra: n
1155
1155
  }), r(), a.events.emitAbort({
@@ -1169,36 +1169,36 @@ var Lt = /* @__PURE__ */ function(e) {
1169
1169
  adapterOptions: b
1170
1170
  }
1171
1171
  });
1172
- let ie = e.client.adapter.unstable_queryParamsMapper(d.queryParams), ae = e.client.adapter.unstable_endpointMapper(d.endpoint), oe = e.client.adapter.unstable_headerMapper(d), { url: L } = e.client;
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;
1173
1173
  return {
1174
1174
  request: d,
1175
1175
  requestId: t,
1176
- url: L,
1177
- endpoint: ae,
1178
- queryParams: ie,
1176
+ url: F,
1177
+ endpoint: se,
1178
+ queryParams: oe,
1179
1179
  payload: y,
1180
- headers: oe,
1180
+ headers: ce,
1181
1181
  adapter: e.client.adapter,
1182
1182
  adapterOptions: b,
1183
- getAbortController: I,
1183
+ getAbortController: P,
1184
1184
  getRequestStartTimestamp: S,
1185
1185
  getResponseStartTimestamp: C,
1186
- createAbortListener: re,
1186
+ createAbortListener: ae,
1187
1187
  onBeforeRequest: D,
1188
1188
  onRequestStart: O,
1189
1189
  onRequestProgress: k,
1190
1190
  onRequestEnd: ee,
1191
1191
  onResponseStart: A,
1192
- onResponseProgress: j,
1193
- onResponseEnd: M,
1194
- onSuccess: te,
1195
- onAbortError: P,
1196
- onTimeoutError: F,
1197
- onUnexpectedError: ne,
1198
- onError: N
1192
+ onResponseProgress: te,
1193
+ onResponseEnd: ne,
1194
+ onSuccess: re,
1195
+ onAbortError: M,
1196
+ onTimeoutError: N,
1197
+ onUnexpectedError: ie,
1198
+ onError: j
1199
1199
  };
1200
1200
  };
1201
- function Xt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1201
+ function Zt({ 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 Xt({ request: e, requestId: t, startTime: n, resolve: r, logger: i }) {
1227
1227
  }), l;
1228
1228
  };
1229
1229
  }
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");
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");
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 Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1272
1272
  status: C,
1273
1273
  extra: T
1274
1274
  }), h || r();
1275
- }, Qt = (e) => e, $t = class {
1275
+ }, $t = (e) => e, en = class {
1276
1276
  unstable_fetcher;
1277
1277
  name;
1278
1278
  defaultMethod;
@@ -1294,10 +1294,10 @@ var Zt = 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 = Nt;
1298
- unstable_payloadMapper = Pt;
1299
- unstable_endpointMapper = Qt;
1300
- unstable_queryParamsMapper = Qt;
1297
+ unstable_headerMapper = Pt;
1298
+ unstable_payloadMapper = Ft;
1299
+ unstable_endpointMapper = $t;
1300
+ unstable_queryParamsMapper = $t;
1301
1301
  unstable_getAdapterDefaults;
1302
1302
  unstable_getRequestDefaults;
1303
1303
  unstable_devtoolsEndpointGetter = (e) => e;
@@ -1321,14 +1321,14 @@ var Zt = 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 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`);
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`);
1326
1326
  this.client.triggerPlugins("onAdapterFetch", {
1327
1327
  adapter: this,
1328
1328
  request: e,
1329
1329
  requestId: t
1330
1330
  });
1331
- let i = await Yt({
1331
+ let i = await Xt({
1332
1332
  request: e,
1333
1333
  requestId: t,
1334
1334
  resolve: r,
@@ -1337,9 +1337,9 @@ var Zt = 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 Zt(i) : this.unstable_fetcher(i);
1340
+ return e.unstable_mock && e.isMockerEnabled && e.client.isMockerEnabled ? await Qt(i) : this.unstable_fetcher(i);
1341
1341
  } catch (i) {
1342
- return Xt({
1342
+ return Zt({
1343
1343
  request: e,
1344
1344
  requestId: t,
1345
1345
  startTime: n || Date.now(),
@@ -1356,66 +1356,66 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1356
1356
  r(e);
1357
1357
  });
1358
1358
  }
1359
- }, en = (e) => {
1359
+ }, tn = (e) => {
1360
1360
  try {
1361
1361
  return JSON.parse(e);
1362
1362
  } catch {
1363
1363
  return e;
1364
1364
  }
1365
- }, tn = (e) => e ? en(e) : jt(), nn = (e) => (t) => {
1365
+ }, nn = (e) => e ? tn(e) : V(), rn = (e) => (t) => {
1366
1366
  let { skipNull: n, skipEmptyString: r } = e;
1367
1367
  return !(r && t === void 0 || r && t === "" || n && t === null);
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) => {
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) => {
1372
1372
  let { arrayFormat: r, arraySeparator: i } = n;
1373
- return t.filter(nn(n)).reduce((t, a, o) => {
1373
+ return t.filter(rn(n)).reduce((t, a, o) => {
1374
1374
  switch (r) {
1375
1375
  case "index": {
1376
- let r = `${W(e, n)}[${W(String(o), n)}]=`;
1377
- t.push(`${r}${W(String(a), n)}`);
1376
+ let r = `${U(e, n)}[${U(String(o), n)}]=`;
1377
+ t.push(`${r}${U(String(a), n)}`);
1378
1378
  break;
1379
1379
  }
1380
1380
  case "bracket": {
1381
- let r = `${W(e, n)}[]=`;
1382
- t.push(`${r}${W(String(a), n)}`);
1381
+ let r = `${U(e, n)}[]=`;
1382
+ t.push(`${r}${U(String(a), n)}`);
1383
1383
  break;
1384
1384
  }
1385
1385
  case "comma": {
1386
- let r = !t.length && `${W(e, n)}=` || "";
1387
- return [[...t, `${r}${W(String(a), n)}`].join(",")];
1386
+ let r = !t.length && `${U(e, n)}=` || "";
1387
+ return [[...t, `${r}${U(String(a), n)}`].join(",")];
1388
1388
  }
1389
1389
  case "separator": {
1390
- let r = !t.length && `${W(e, n)}=` || "";
1391
- return [[...t, `${r}${W(String(a), n)}`].join(i || "|")];
1390
+ let r = !t.length && `${U(e, n)}=` || "";
1391
+ return [[...t, `${r}${U(String(a), n)}`].join(i || "|")];
1392
1392
  }
1393
1393
  case "bracket-separator": {
1394
- let r = !t.length && `${W(e, n)}[]=` || "";
1395
- return [[...t, `${r}${W(String(a), n)}`].join(i || "|")];
1394
+ let r = !t.length && `${U(e, n)}[]=` || "";
1395
+ return [[...t, `${r}${U(String(a), n)}`].join(i || "|")];
1396
1396
  }
1397
1397
  default: {
1398
- let r = `${W(e, n)}=`;
1399
- t.push(`${r}${W(String(a), n)}`);
1398
+ let r = `${U(e, n)}=`;
1399
+ t.push(`${r}${U(String(a), n)}`);
1400
1400
  }
1401
1401
  }
1402
1402
  return t;
1403
1403
  }, []).join("&");
1404
- }, on = (e, t = Fn) => {
1404
+ }, sn = (e, t = In) => {
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) ? an(e, n, t) : rn(e, n, t)).filter(Boolean).join("&");
1407
+ let n = Object.entries(e).map(([e, n]) => Array.isArray(n) ? on(e, n, t) : an(e, n, t)).filter(Boolean).join("&");
1408
1408
  return n ? `?${n}` : "";
1409
- }, sn = qt.SEC * 5, cn = { headers: {} }, ln = () => new $t({
1409
+ }, cn = Jt.SEC * 5, ln = { headers: {} }, un = () => new en({
1410
1410
  name: "http",
1411
- defaultMethod: Lt.GET,
1412
- defaultExtra: cn,
1411
+ defaultMethod: Rt.GET,
1412
+ defaultExtra: ln,
1413
1413
  systemErrorStatus: 0,
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({
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({
1417
1417
  status: 0,
1418
- extra: cn
1418
+ extra: ln
1419
1419
  });
1420
1420
  C > 0 && S && (D = setTimeout(() => {
1421
1421
  E = !0, O(), S.abort();
@@ -1447,7 +1447,7 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1447
1447
  status: l,
1448
1448
  extra: c
1449
1449
  }) : i({
1450
- error: tn(await t.text()),
1450
+ error: nn(await t.text()),
1451
1451
  status: l,
1452
1452
  extra: c
1453
1453
  });
@@ -1468,11 +1468,11 @@ var Zt = 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: en(e),
1471
+ data: tn(e),
1472
1472
  status: l,
1473
1473
  extra: c
1474
1474
  }) : i({
1475
- error: tn(e),
1475
+ error: nn(e),
1476
1476
  status: l,
1477
1477
  extra: c
1478
1478
  });
@@ -1481,18 +1481,18 @@ var Zt = 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: cn
1484
+ extra: ln
1485
1485
  });
1486
1486
  return;
1487
1487
  }
1488
1488
  i({
1489
1489
  error: e,
1490
1490
  status: 0,
1491
- extra: cn
1491
+ extra: ln
1492
1492
  });
1493
1493
  }
1494
- }), un = () => ln(), dn = class {
1495
- emitter = new Ne();
1494
+ }), dn = () => un(), fn = class {
1495
+ emitter = new Fe();
1496
1496
  events;
1497
1497
  storage;
1498
1498
  lazyStorage;
@@ -1503,7 +1503,7 @@ var Zt = 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 = yn(this.emitter), this.storage = t, this.version = r, this.lazyStorage = n;
1506
+ this.emitter?.setMaxListeners(1e3), this.events = bn(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 Zt = 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 = U(n, o), c = this.storage.get(s), l = typeof t == "function" ? t(c || null) : t, u = fn(c, l), d = {
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 = {
1521
1521
  ...u,
1522
1522
  scope: o,
1523
1523
  staleTime: i,
@@ -1563,7 +1563,7 @@ var Zt = 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 = U(n, r), a = this.storage.get(i), o = typeof t == "function" ? t(a || null) : t;
1566
+ let { cacheKey: n, scope: r } = e, i = H(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 Zt = 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 Jt ? n(U(e.cacheKey, e.scope), e.cacheKey) : typeof e == "string" ? n(e) : t.length && t.forEach((t) => {
1604
+ e instanceof Yt ? n(H(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 Zt = 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
- }, fn = (e, t) => {
1659
+ }, pn = (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
- }, pn = () => "invalidate", mn = (e) => `${e}_invalidate`, hn = () => "delete", gn = (e) => `${e}_delete`, _n = (e) => `${e}_cache`, vn = () => "cache", yn = (e) => ({
1665
+ }, mn = () => "invalidate", hn = (e) => `${e}_invalidate`, gn = () => "delete", _n = (e) => `${e}_delete`, vn = (e) => `${e}_cache`, yn = () => "cache", bn = (e) => ({
1666
1666
  emitCacheData: (t, n = !1) => {
1667
- e.emit(vn(), t, n), e.emit(_n(t.cacheKey), t, n);
1667
+ e.emit(yn(), t, n), e.emit(vn(t.cacheKey), t, n);
1668
1668
  },
1669
1669
  emitInvalidation: (t, n = !1) => {
1670
- e.emit(pn(), t, n), e.emit(mn(t), n);
1670
+ e.emit(mn(), t, n), e.emit(hn(t), n);
1671
1671
  },
1672
1672
  emitDelete: (t, n = !1) => {
1673
- e.emit(hn(), t, n), e.emit(gn(t), n);
1673
+ e.emit(gn(), t, n), e.emit(_n(t), n);
1674
1674
  },
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) {
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) {
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
- }({}), bn = (e) => ({
1683
+ }({}), xn = (e) => ({
1684
1684
  emitDrained: (t, n) => {
1685
- e.emit(Sn(), t, n), e.emit(Cn(t.queryKey), t, n);
1685
+ e.emit(Cn(), t, n), e.emit(wn(t.queryKey), t, n);
1686
1686
  },
1687
1687
  emitQueueStatusChanged: (t, n) => {
1688
- e.emit(wn(), t, n), e.emit(Tn(t.queryKey), t, n);
1688
+ e.emit(Tn(), t, n), e.emit(En(t.queryKey), t, n);
1689
1689
  },
1690
1690
  emitQueueChanged: (t, n) => {
1691
- e.emit(En(), t, n), e.emit(Dn(t.queryKey), t, n);
1691
+ e.emit(Dn(), t, n), e.emit(On(t.queryKey), t, n);
1692
1692
  },
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 Ne();
1701
- events = bn(this.emitter);
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);
1702
1702
  storage = /* @__PURE__ */ new Map();
1703
1703
  requestCount = /* @__PURE__ */ new Map();
1704
1704
  runningRequests = /* @__PURE__ */ new Map();
@@ -1707,7 +1707,7 @@ var Zt = 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 Jt);
1710
+ isRequestJSON = (e) => !(e instanceof Yt);
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 Zt = 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 = U(e.request.abortKey, e.request.scope);
1834
+ let t = H(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 = U(e.request.abortKey, e.request.scope);
1841
+ let t = H(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 Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1866
1866
  resolved: !1
1867
1867
  });
1868
1868
  add = (e) => {
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);
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);
1870
1870
  switch (this.logger.debug({
1871
1871
  title: "Adding request to queue",
1872
1872
  type: "system",
@@ -1876,9 +1876,9 @@ var Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
1876
1876
  requestId: r
1877
1877
  }
1878
1878
  }), a) {
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({
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({
1882
1882
  request: i.request,
1883
1883
  requestId: r,
1884
1884
  deduplicatedRequest: e
@@ -1920,7 +1920,7 @@ var Zt = 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 = 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;
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;
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 Zt = 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 = jt("abort").message === b.error?.message, C = !this.hasRunningRequest(l, n) || S;
1943
+ let x = !m.isOnline, S = V("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 Zt = async ({ request: e, requestId: t, onError: n, onResponseEnd: r, onTime
2054
2054
  }
2055
2055
  }), this.delete(l, n, u));
2056
2056
  };
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;
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;
2060
2060
  };
2061
- function jn(e) {
2061
+ function Mn(e) {
2062
2062
  return e === "client" || e === "server" ? e : typeof window < "u" && typeof document < "u" ? "client" : "server";
2063
2063
  }
2064
- var Mn = async (e, t) => {
2064
+ var Nn = 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
- }, Nn = async (e, t, n) => {
2070
+ }, Pn = 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
- }, Pn = class {
2076
+ }, Fn = class {
2077
2077
  url;
2078
2078
  mode;
2079
2079
  debug;
@@ -2082,8 +2082,8 @@ var Mn = async (e, t) => {
2082
2082
  unstable_onResponseCallbacks = [];
2083
2083
  unstable_onAuthCallbacks = [];
2084
2084
  unstable_onRequestCallbacks = [];
2085
- loggerManager = new vt();
2086
- requestManager = new Ve();
2085
+ loggerManager = new bt();
2086
+ requestManager = new Ue();
2087
2087
  appManager;
2088
2088
  adapter;
2089
2089
  cache;
@@ -2091,15 +2091,15 @@ var Mn = async (e, t) => {
2091
2091
  submitDispatcher;
2092
2092
  isMockerEnabled = !0;
2093
2093
  plugins = [];
2094
- unstable_abortKeyMapper = Ht;
2095
- unstable_cacheKeyMapper = Ut;
2096
- unstable_queryKeyMapper = Ut;
2097
- unstable_requestIdMapper = Ae;
2094
+ unstable_abortKeyMapper = Ut;
2095
+ unstable_cacheKeyMapper = Wt;
2096
+ unstable_queryKeyMapper = Wt;
2097
+ unstable_requestIdMapper = Me;
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 = jn(o), this.adapter = un(), this.appManager = n?.() || new Pe(), 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);
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);
2103
2103
  }
2104
2104
  setDebug = (e) => (this.debug = e, this);
2105
2105
  setLogLevel = (e) => (this.loggerManager.setSeverity(e), this);
@@ -2128,15 +2128,15 @@ var Mn = 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) => 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);
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);
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 dn(), this.appManager = e?.() || new Pe(), 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);
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);
2140
2140
  };
2141
2141
  hydrate = (e, t) => {
2142
2142
  e?.forEach((e) => {
@@ -2153,8 +2153,8 @@ var Mn = async (e, t) => {
2153
2153
  ...a,
2154
2154
  ...t
2155
2155
  };
2156
- if (!s.override && this.cache.get(U(n, r))) return;
2157
- let c = en(i);
2156
+ if (!s.override && this.cache.get(H(n, r))) return;
2157
+ let c = tn(i);
2158
2158
  this.cache.set({
2159
2159
  ...s,
2160
2160
  cacheKey: n,
@@ -2166,10 +2166,10 @@ var Mn = 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 Jt(this, n);
2169
+ }, r = new Yt(this, n);
2170
2170
  return this.plugins.forEach((e) => e.trigger("onRequestCreate", { request: r })), r;
2171
2171
  };
2172
- }, Fn = {
2172
+ }, In = {
2173
2173
  strict: !0,
2174
2174
  encode: !0,
2175
2175
  arrayFormat: "bracket",
@@ -2178,101 +2178,101 @@ var Mn = async (e, t) => {
2178
2178
  skipNull: !0,
2179
2179
  skipEmptyString: !0
2180
2180
  };
2181
- function In(e) {
2182
- return new Pn(e);
2181
+ function Ln(e) {
2182
+ return new Fn(e);
2183
2183
  }
2184
2184
  //#endregion
2185
2185
  //#region src/core/client.ts
2186
- var K = In({ url: L() });
2186
+ var G = Ln({ url: F() });
2187
2187
  //#endregion
2188
2188
  //#region src/core/auth-api.ts
2189
- async function Ln(e) {
2190
- let { data: t, success: n } = await K.createRequest()({
2189
+ async function Rn(e) {
2190
+ let { data: t, success: n } = await G.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 Rn(e) {
2197
- await K.createRequest()({
2196
+ async function zn(e) {
2197
+ await G.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 zn = 1, Bn = "hype-stack", Vn = "auth.json";
2205
- function Hn() {
2204
+ var Bn = 1, Vn = "hype-stack", Hn = "auth.json";
2205
+ function Un() {
2206
2206
  let e = process.env.HYPE_STACK_CONFIG_DIR;
2207
- if (e) return T.join(e, Bn);
2207
+ if (e) return T.join(e, Vn);
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, Bn);
2211
+ return T.join(e, Vn);
2212
2212
  }
2213
- if (process.platform === "darwin") return T.join(t, "Library", "Application Support", Bn);
2213
+ if (process.platform === "darwin") return T.join(t, "Library", "Application Support", Vn);
2214
2214
  let n = process.env.XDG_CONFIG_HOME ?? T.join(t, ".config");
2215
- return T.join(n, Bn);
2215
+ return T.join(n, Vn);
2216
2216
  }
2217
- function Un() {
2218
- return T.join(Hn(), Vn);
2217
+ function Wn() {
2218
+ return T.join(Un(), Hn);
2219
2219
  }
2220
- async function Wn() {
2221
- let e = await y.readFile(Un(), "utf-8").catch(() => null);
2220
+ async function Gn() {
2221
+ let e = await y.readFile(Wn(), "utf-8").catch(() => null);
2222
2222
  if (!e) return {
2223
- version: zn,
2223
+ version: Bn,
2224
2224
  tokens: {}
2225
2225
  };
2226
2226
  let t = JSON.parse(e);
2227
2227
  return {
2228
- version: t.version ?? zn,
2228
+ version: t.version ?? Bn,
2229
2229
  tokens: t.tokens ?? {}
2230
2230
  };
2231
2231
  }
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
- }
2236
2232
  async function Kn(e) {
2237
- return (await Wn()).tokens[e] ?? null;
2233
+ let t = Un();
2234
+ await y.mkdir(t, { recursive: !0 }), await y.writeFile(Wn(), `${JSON.stringify(e, null, 2)}\n`, { mode: 384 });
2235
+ }
2236
+ async function qn(e) {
2237
+ return (await Gn()).tokens[e] ?? null;
2238
2238
  }
2239
- async function qn(e, t) {
2240
- let n = await Wn();
2241
- n.tokens[e] = t, await Gn(n);
2239
+ async function Jn(e, t) {
2240
+ let n = await Gn();
2241
+ n.tokens[e] = t, await Kn(n);
2242
2242
  }
2243
- async function Jn(e) {
2244
- let t = await Wn();
2245
- e in t.tokens && (delete t.tokens[e], await Gn(t));
2243
+ async function Yn(e) {
2244
+ let t = await Gn();
2245
+ e in t.tokens && (delete t.tokens[e], await Kn(t));
2246
2246
  }
2247
2247
  //#endregion
2248
2248
  //#region src/core/device.ts
2249
- function Yn() {
2249
+ function Xn() {
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 Xn() {
2257
- let e = `${Yn()}:${w.hostname()}:${w.platform()}:${w.arch()}`;
2256
+ function Zn() {
2257
+ let e = `${Xn()}:${w.hostname()}:${w.platform()}:${w.arch()}`;
2258
2258
  return x("sha256").update(e).digest("hex").slice(0, 16);
2259
2259
  }
2260
- function Zn() {
2260
+ function Qn() {
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 Qn(e) {
2265
+ function $n(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 $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 = L(), r = C.createServer(), i = await new Promise((n, i) => {
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) => {
2273
2273
  let a = setTimeout(() => {
2274
2274
  o(), i(/* @__PURE__ */ Error("Login timed out. Run `npx @hype-stack/cli login` again."));
2275
- }, $n);
2275
+ }, er);
2276
2276
  function o() {
2277
2277
  clearTimeout(a), r.close(), r.closeAllConnections?.();
2278
2278
  }
@@ -2286,7 +2286,7 @@ async function tr(e = {}) {
2286
2286
  r.writeHead(200, {
2287
2287
  "Content-Type": "text/html",
2288
2288
  Connection: "close"
2289
- }), r.end(er(e));
2289
+ }), r.end(tr(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 tr(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(Zn()), a = `${se()}/cli/authorize?port=${n}&state=${t}&label=${i}`;
2305
- e.onUrl?.(a), Qn(a);
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);
2306
2306
  });
2307
- }), a = await Ln(i).catch(() => null), o = {
2307
+ }), a = await Rn(i).catch(() => null), o = {
2308
2308
  token: i,
2309
2309
  email: a?.email,
2310
2310
  organizationId: a?.organizationId
2311
2311
  };
2312
- return await qn(n, o), o;
2312
+ return await Jn(n, o), o;
2313
2313
  }
2314
2314
  //#endregion
2315
2315
  //#region src/core/access-prompts.ts
2316
- async function nr() {
2316
+ async function rr() {
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 tr({ onUrl: (e) => {
2322
- s.log.info(`If your browser didn't open, visit:\n ${B.path(e)}`);
2321
+ let e = await nr({ onUrl: (e) => {
2322
+ s.log.info(`If your browser didn't open, visit:\n ${R.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 rr(e) {
2329
+ async function ir(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) => ` ${B.brand(e.displayName)} ${B.highlight(`$${e.price}`)}`)
2334
+ ...e.map((e) => ` ${R.brand(e.displayName)} ${R.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(B.muted("Run 'npx @hype-stack/cli login' after purchasing, then 'npx @hype-stack/cli compose' again."));
2338
+ s.log.info(R.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) Qn(be(t.name));
2341
+ for (let t of e) $n(Se(t.name));
2342
2342
  s.log.info([
2343
- B.muted("After purchasing, run:"),
2344
- ` ${B.highlight("npx @hype-stack/cli login")} ${B.muted("Save your access")}`,
2345
- ` ${B.highlight("npx @hype-stack/cli compose")} ${B.muted("Install the packs")}`
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")}`
2346
2346
  ].join("\n"));
2347
2347
  }
2348
2348
  //#endregion
2349
2349
  //#region src/utils/exec.ts
2350
- function q(e, t, n) {
2350
+ function K(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 q(e, t, n) {
2378
2378
  });
2379
2379
  });
2380
2380
  }
2381
- function ir(e, t, n) {
2381
+ function ar(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 ir(e, t, n) {
2395
2395
  }
2396
2396
  //#endregion
2397
2397
  //#region src/utils/fs.ts
2398
- async function ar(e) {
2398
+ async function q(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 ar(e)) return t;
2416
+ if (!await q(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(B.muted("Run database setup yourself when ready:")), s.note([
2434
- `${B.command(`cd ${e}`)}`,
2435
- `${B.command("pnpm exec prisma generate")} ${B.muted("(regenerate the Prisma client)")}`,
2436
- `${B.command("pnpm exec prisma migrate dev")} ${B.muted("(create + apply tables for new packs)")}`
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)")}`
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 = ir } = e, c = n.backend.root, l = T.join(t, c);
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);
2441
2441
  if (!await J(T.join(l, "package.json"))) return;
2442
2442
  if (!r) {
2443
- s.log.step(B.muted(`Generating Prisma client (${B.command("prisma generate")})...`));
2443
+ s.log.step(R.muted(`Generating Prisma client (${R.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(B.muted("prisma generate failed. See the output above, or finish setup manually:")), mr(e), fr(c);
2450
+ s.log.error(R.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? (${B.command("prisma migrate dev")})`,
2460
+ message: `Run database setup now? (${R.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(B.muted(`Running ${B.command("prisma migrate dev --name add-packs")}...`));
2467
+ s.log.step(R.muted(`Running ${R.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(B.muted(`Resetting dev database (${B.command("prisma migrate reset --force")})...`));
2482
+ s.log.step(R.muted(`Resetting dev database (${R.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(B.muted(`Running ${B.command("prisma migrate dev --name add-packs")}...`)), d = await o("pnpm", [
2490
+ if (e.exitCode === 0) s.log.step(R.muted(`Running ${R.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(B.muted("prisma migrate reset did not complete. See the output above, or finish setup manually:")), mr(e), fr(c);
2499
+ s.log.error(R.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(B.muted("prisma migrate dev did not complete. See the output above, or finish setup manually:")), mr(d), fr(c);
2505
+ s.log.error(R.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(B.muted(t));
2512
+ t && s.log.warn(R.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, M));
2626
+ return sr(T.join(e, ne));
2627
2627
  }
2628
2628
  async function kr(e) {
2629
- return J(T.join(e, M));
2629
+ return J(T.join(e, ne));
2630
2630
  }
2631
2631
  async function Ar(e, t) {
2632
- await cr(T.join(e, M), t);
2632
+ await cr(T.join(e, ne), 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: le(),
2677
+ $schema: de(),
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), ar(n)]);
2688
+ let t = T.join(e, "package.json"), n = T.join(e, "apps"), [r, i] = await Promise.all([J(t), q(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 K.createRequest()({
2703
+ let { data: t, error: n, status: r } = await G.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 = K.createRequest()({
2712
+ let n = G.createRequest()({
2713
2713
  endpoint: `/packs/${encodeURIComponent(e)}/download`,
2714
2714
  method: "POST"
2715
2715
  }), r = {
2716
- "X-Device-Id": Xn(),
2717
- "X-Client-Info": Zn()
2716
+ "X-Device-Id": Zn(),
2717
+ "X-Client-Info": Qn()
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 = K.createRequest()({
2744
+ var zr = G.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 = K.createRequest()({
2755
+ let n = G.createRequest()({
2756
2756
  endpoint: "/packs/authorize",
2757
2757
  method: "POST"
2758
2758
  }), r = {};
@@ -2771,21 +2771,16 @@ function Ur(e, t) {
2771
2771
  return X(e === "admin" ? "{{admin.root}}" : "{{frontend.root}}", t);
2772
2772
  }
2773
2773
  async function Wr(e, t, n) {
2774
- let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/config/env/env.config.ts"), a = T.resolve(n, r, ".env.example"), o = T.resolve(n, r, ".env.test");
2774
+ let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/config/env/env.config.ts"), a = T.resolve(n, r, ".env.example"), o = T.resolve(n, r, ".env"), s = T.resolve(n, r, ".env.test");
2775
2775
  if (await J(i)) {
2776
2776
  let t = await y.readFile(i, "utf-8");
2777
2777
  for (let n of e) t.includes(`from "${n.from}"`) || (t = Gr(t, n), t = Kr(t, n));
2778
2778
  await y.writeFile(i, t, "utf-8");
2779
2779
  }
2780
- if (await J(a)) {
2781
- let t = await y.readFile(a, "utf-8");
2782
- for (let n of e) t = qr(t, n);
2783
- await y.writeFile(a, t, "utf-8");
2784
- }
2785
- if (await J(o)) {
2786
- let t = await y.readFile(o, "utf-8");
2787
- for (let n of e) t = Jr(t, n);
2788
- await y.writeFile(o, t, "utf-8");
2780
+ if (await Promise.all([a, o].map((t) => qr(t, e))), await J(s)) {
2781
+ let t = await y.readFile(s, "utf-8");
2782
+ for (let n of e) t = Yr(t, n);
2783
+ await y.writeFile(s, t, "utf-8");
2789
2784
  }
2790
2785
  }
2791
2786
  function Gr(e, t) {
@@ -2809,27 +2804,33 @@ function Kr(e, t) {
2809
2804
  let o = a + 2;
2810
2805
  return e.slice(0, o) + n + e.slice(o);
2811
2806
  }
2812
- function qr(e, t) {
2807
+ async function qr(e, t) {
2808
+ if (!await J(e)) return;
2809
+ let n = await y.readFile(e, "utf-8");
2810
+ for (let e of t) n = Jr(n, e);
2811
+ await y.writeFile(e, n, "utf-8");
2812
+ }
2813
+ function Jr(e, t) {
2813
2814
  for (let n of Object.keys(t.envExample.vars)) if (e.includes(`${n}=`)) return e;
2814
2815
  let n = [];
2815
2816
  n.push(""), n.push(`# ${hr[t.envExample.section]}`);
2816
2817
  for (let [e, r] of Object.entries(t.envExample.vars)) n.push(`${e}=${r}`);
2817
2818
  return e.trimEnd() + "\n" + n.join("\n") + "\n";
2818
2819
  }
2819
- function Jr(e, t) {
2820
+ function Yr(e, t) {
2820
2821
  for (let n of Object.keys(t.envTest)) if (e.includes(`${n}=`)) return e;
2821
2822
  let n = [""];
2822
2823
  for (let [e, r] of Object.entries(t.envTest)) n.push(`${e}=${r}`);
2823
2824
  return e.trimEnd() + "\n" + n.join("\n") + "\n";
2824
2825
  }
2825
- async function Yr(e, t, n) {
2826
+ async function Xr(e, t, n) {
2826
2827
  let r = T.resolve(n, X("{{backend.routes}}", t), "index.ts");
2827
2828
  if (!await J(r)) return;
2828
2829
  let i = await y.readFile(r, "utf-8");
2829
- for (let t of e) i.includes(`from "${t.from}"`) || (i = Xr(i, t), i = Zr(i, t));
2830
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = Zr(i, t), i = Qr(i, t));
2830
2831
  await y.writeFile(r, i, "utf-8");
2831
2832
  }
2832
- function Xr(e, t) {
2833
+ function Zr(e, t) {
2833
2834
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2834
2835
  if (r !== -1) {
2835
2836
  let t = e.indexOf("\n", r);
@@ -2838,7 +2839,7 @@ function Xr(e, t) {
2838
2839
  let i = e.indexOf("export const registerRoutes");
2839
2840
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2840
2841
  }
2841
- function Zr(e, t) {
2842
+ function Qr(e, t) {
2842
2843
  let n = `.route("${t.prefix}", ${t.import})`, r = e.match(/\.route\([^)]+\);/g);
2843
2844
  if (r) {
2844
2845
  let t = r[r.length - 1], i = e.lastIndexOf(t) + t.length - 1;
@@ -2846,14 +2847,14 @@ function Zr(e, t) {
2846
2847
  }
2847
2848
  return e.replace("return app;", `return app\n ${n};`);
2848
2849
  }
2849
- async function Qr(e, t, n) {
2850
+ async function $r(e, t, n) {
2850
2851
  let r = T.resolve(n, X("{{backend.root}}", t), "src/context.ts");
2851
2852
  if (!await J(r)) return;
2852
2853
  let i = await y.readFile(r, "utf-8");
2853
- for (let t of e) i.includes(`export let ${t.export}`) || (i = $r(i, t), i = ei(i, t), i = ti(i, t), i = ri(i, t));
2854
+ for (let t of e) i.includes(`export let ${t.export}`) || (i = ei(i, t), i = ti(i, t), i = ni(i, t), i = ii(i, t));
2854
2855
  await y.writeFile(r, i, "utf-8");
2855
2856
  }
2856
- function $r(e, t) {
2857
+ function ei(e, t) {
2857
2858
  let n = `import { ${t.typeImport.name} } from "${t.typeImport.from}";`;
2858
2859
  if (e.includes(`from "${t.typeImport.from}"`)) return e;
2859
2860
  let r = e.lastIndexOf("import ");
@@ -2861,7 +2862,7 @@ function $r(e, t) {
2861
2862
  let i = e.indexOf("\n", e.indexOf(";", r));
2862
2863
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2863
2864
  }
2864
- function ei(e, t) {
2865
+ function ti(e, t) {
2865
2866
  let n = `export let ${t.export}: ${t.type};`, r = e.lastIndexOf("export let ");
2866
2867
  if (r === -1) {
2867
2868
  let t = e.indexOf("export const setupContext");
@@ -2870,15 +2871,15 @@ function ei(e, t) {
2870
2871
  let i = e.indexOf("\n", r);
2871
2872
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
2872
2873
  }
2873
- function ti(e, t) {
2874
+ function ni(e, t) {
2874
2875
  let n = ` ${t.export} = ${t.init};`, r = e.match(/export const setupContext\s*=\s*async\s*\([^)]*\)\s*=>\s*\{/);
2875
2876
  if (!r) return e;
2876
2877
  let i = e.indexOf("{", e.indexOf(r[0]));
2877
2878
  if (i === -1) return e;
2878
- let a = ni(e, i);
2879
+ let a = ri(e, i);
2879
2880
  return a === -1 ? e : e.slice(0, a) + n + "\n" + e.slice(a);
2880
2881
  }
2881
- function ni(e, t) {
2882
+ function ri(e, t) {
2882
2883
  let n = 0;
2883
2884
  for (let r = t; r < e.length; r++) {
2884
2885
  let t = e[r];
@@ -2887,20 +2888,20 @@ function ni(e, t) {
2887
2888
  }
2888
2889
  return -1;
2889
2890
  }
2890
- function ri(e, t) {
2891
+ function ii(e, t) {
2891
2892
  let n = ` ${t.export}: ${t.type};`, r = e.indexOf("export type ContextVariables = {");
2892
2893
  if (r === -1) return e;
2893
2894
  let i = e.indexOf("};", r);
2894
2895
  return i === -1 ? e : e.slice(0, i) + n + "\n" + e.slice(i);
2895
2896
  }
2896
- async function ii(e, t, n) {
2897
+ async function ai(e, t, n) {
2897
2898
  let r = T.resolve(n, X("{{enums.src}}", t), "index.ts");
2898
2899
  if (!await J(r)) return;
2899
2900
  let i = await y.readFile(r, "utf-8");
2900
- for (let t of e) i.includes(`from "${t.from}"`) || (i = ai(i, t));
2901
+ for (let t of e) i.includes(`from "${t.from}"`) || (i = oi(i, t));
2901
2902
  await y.writeFile(r, i, "utf-8");
2902
2903
  }
2903
- function ai(e, t) {
2904
+ function oi(e, t) {
2904
2905
  let n = `export * from "${t.from}";`, r = e.lastIndexOf("export * from");
2905
2906
  if (r !== -1) {
2906
2907
  let t = e.indexOf("\n", r);
@@ -2908,14 +2909,14 @@ function ai(e, t) {
2908
2909
  }
2909
2910
  return e.trim() === "" ? n + "\n" : e.trimEnd() + "\n" + n + "\n";
2910
2911
  }
2911
- async function oi(e, t, n) {
2912
+ async function si(e, t, n) {
2912
2913
  let r = X("{{backend.root}}", t), i = T.resolve(n, r, "src/sockets/index.ts");
2913
2914
  if (!await J(i)) return;
2914
2915
  let a = await y.readFile(i, "utf-8");
2915
- for (let t of e) a.includes(`from "${t.from}"`) || (a = si(a, t), a = ci(a, t));
2916
- await J(T.resolve(n, r, "src/libs/websocket/ws-authenticate.ts")) && (a = li(a)), await y.writeFile(i, a, "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");
2917
2918
  }
2918
- function si(e, t) {
2919
+ function ci(e, t) {
2919
2920
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("from \"./");
2920
2921
  if (r !== -1) {
2921
2922
  let t = e.indexOf("\n", r);
@@ -2924,7 +2925,7 @@ function si(e, t) {
2924
2925
  let i = e.indexOf("const sockets");
2925
2926
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2926
2927
  }
2927
- function ci(e, t) {
2928
+ function li(e, t) {
2928
2929
  let n = `.socket("${t.prefix}", ${t.import})`, r = e.indexOf("const sockets");
2929
2930
  if (r === -1) return e;
2930
2931
  let i = e.indexOf("new SocketRouter", r);
@@ -2938,7 +2939,7 @@ function ci(e, t) {
2938
2939
  }
2939
2940
  return e;
2940
2941
  }
2941
- function li(e) {
2942
+ function ui(e) {
2942
2943
  if (e.includes("wsAuthenticate")) return e;
2943
2944
  let t = e.indexOf("from \"@backend/libs/websocket/socket-router\""), n = e;
2944
2945
  if (t !== -1) {
@@ -2947,14 +2948,14 @@ function li(e) {
2947
2948
  }
2948
2949
  return n.replace("new SocketRouter()", "new SocketRouter({ authenticate: wsAuthenticate })");
2949
2950
  }
2950
- async function ui(e, t, n) {
2951
+ async function di(e, t, n) {
2951
2952
  let r = X("{{frontend.root}}", t), i = T.resolve(n, r, "src/api/sdk.ts");
2952
2953
  if (!await J(i)) return;
2953
2954
  let a = await y.readFile(i, "utf-8");
2954
- for (let t of e) a.includes(`.$configure(${t.import})`) || (a = di(a, t), a = fi(a, t));
2955
+ for (let t of e) a.includes(`.$configure(${t.import})`) || (a = fi(a, t), a = pi(a, t));
2955
2956
  await y.writeFile(i, a, "utf-8");
2956
2957
  }
2957
- function di(e, t) {
2958
+ function fi(e, t) {
2958
2959
  let n = `import { ${t.import} } from "${t.from}";`;
2959
2960
  if (e.includes(n)) return e;
2960
2961
  let r = e.lastIndexOf("from \"./");
@@ -2965,20 +2966,20 @@ function di(e, t) {
2965
2966
  let i = e.indexOf("export const sdk");
2966
2967
  return i === -1 ? e : e.slice(0, i) + n + "\n\n" + e.slice(i);
2967
2968
  }
2968
- function fi(e, t) {
2969
+ function pi(e, t) {
2969
2970
  let n = `.$configure(${t.import})`, r = e.indexOf("export const sdk");
2970
2971
  if (r === -1) return e;
2971
2972
  let i = e.indexOf(";", r);
2972
2973
  return i === -1 ? e : e.slice(0, i) + "\n " + n + e.slice(i);
2973
2974
  }
2974
- async function pi(e, t, n) {
2975
+ async function mi(e, t, n) {
2975
2976
  let r = T.resolve(n, X("{{backend.utils}}", t), "frontend-url/frontend-url.ts");
2976
2977
  if (!await J(r)) return;
2977
2978
  let i = await y.readFile(r, "utf-8");
2978
- for (let t of e) i.includes(`"${t.path}"`) || (i = mi(i, t));
2979
+ for (let t of e) i.includes(`"${t.path}"`) || (i = hi(i, t));
2979
2980
  await y.writeFile(r, i, "utf-8");
2980
2981
  }
2981
- function mi(e, t) {
2982
+ function hi(e, t) {
2982
2983
  let n = ` "${t.path}": ${t.search};`, r = e.indexOf("type RouteDefinitions = {");
2983
2984
  if (r === -1) return e;
2984
2985
  let i = e.indexOf("{", r);
@@ -2994,20 +2995,20 @@ function mi(e, t) {
2994
2995
  }
2995
2996
  return o === -1 ? e : e.slice(0, o) + n + "\n" + e.slice(o);
2996
2997
  }
2997
- var hi = "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", gi = {
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 = {
2998
2999
  primary: "primaryNav",
2999
3000
  secondary: "secondaryNav",
3000
3001
  tertiary: "tertiaryNav",
3001
3002
  settings: "settingsNav"
3002
3003
  };
3003
- async function _i(e) {
3004
+ async function vi(e) {
3004
3005
  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;
3005
- await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = hi);
3006
- for (let e of t) s.includes(`label: "${e.label}"`) || (s = bi(s, e));
3007
- for (let e of t.toReversed()) s.includes(`label: "${e.label}"`) || (s = Si(s, e));
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));
3008
3009
  await y.writeFile(o, s, "utf-8");
3009
3010
  }
3010
- async function vi(e) {
3011
+ async function yi(e) {
3011
3012
  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");
3012
3013
  if (!await J(o)) return;
3013
3014
  let s = await y.readFile(o, "utf-8"), c = /export const POST_LOGIN_REDIRECT_PATH = "[^"]*";/;
@@ -3015,17 +3016,17 @@ async function vi(e) {
3015
3016
  let l = s.replace(c, `export const POST_LOGIN_REDIRECT_PATH = "${t}";`);
3016
3017
  await y.writeFile(o, l, "utf-8");
3017
3018
  }
3018
- function yi(e) {
3019
+ function bi(e) {
3019
3020
  let t = [e.icon];
3020
3021
  if (e.items) for (let n of e.items) t.includes(n.icon) || t.push(n.icon);
3021
3022
  return t;
3022
3023
  }
3023
- function bi(e, t) {
3024
- let n = yi(t), r = e;
3025
- for (let e of n) r = xi(r, e);
3024
+ function xi(e, t) {
3025
+ let n = bi(t), r = e;
3026
+ for (let e of n) r = Si(r, e);
3026
3027
  return r;
3027
3028
  }
3028
- function xi(e, t) {
3029
+ function Si(e, t) {
3029
3030
  let n = e.match(/import \{([^}]+)\} from "lucide-react";/);
3030
3031
  if (!n) return e;
3031
3032
  let r = n[1].split(",").map((e) => e.trim()).filter(Boolean);
@@ -3033,21 +3034,21 @@ function xi(e, t) {
3033
3034
  let i = r.findIndex((e) => e.startsWith("type "));
3034
3035
  return i === -1 ? r.push(t) : r.splice(i, 0, t), e.replace(n[0], `import { ${r.join(", ")} } from "lucide-react";`);
3035
3036
  }
3036
- function Si(e, t) {
3037
- let n = gi[t.group];
3037
+ function Ci(e, t) {
3038
+ let n = _i[t.group];
3038
3039
  if (!n) return e;
3039
- let r = wi(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
3040
+ let r = Ti(t), i = RegExp(`export const ${n}: NavEntry\\[\\] = \\[`), a = e.match(i);
3040
3041
  if (!a) return e;
3041
- let o = e.indexOf(a[0]) + a[0].length, s = Ci(e, o - 1);
3042
+ let o = e.indexOf(a[0]) + a[0].length, s = wi(e, o - 1);
3042
3043
  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);
3043
3044
  }
3044
- function Ci(e, t) {
3045
+ function wi(e, t) {
3045
3046
  let n = 0;
3046
3047
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3047
3048
  else if (e[r] === "]" && (n--, n === 0)) return r;
3048
3049
  return -1;
3049
3050
  }
3050
- function wi(e) {
3051
+ function Ti(e) {
3051
3052
  let t = [];
3052
3053
  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) {
3053
3054
  t.push(" items: [");
@@ -3063,14 +3064,14 @@ function wi(e) {
3063
3064
  } else t.push(" items: [],");
3064
3065
  return t.push(" },"), t.join("\n");
3065
3066
  }
3066
- async function Ti(e, t, n) {
3067
+ async function Ei(e, t, n) {
3067
3068
  let r = X("{{backend.features}}", t), i = T.resolve(n, r, "organizations/modules/setup-organization/steps/index.ts");
3068
3069
  if (!await J(i)) return;
3069
3070
  let a = await y.readFile(i, "utf-8");
3070
- for (let t of e) a.includes(`from "${t.from}"`) || (a = Ei(a, t), a = Di(a, t));
3071
+ for (let t of e) a.includes(`from "${t.from}"`) || (a = Di(a, t), a = Oi(a, t));
3071
3072
  await y.writeFile(i, a, "utf-8");
3072
3073
  }
3073
- function Ei(e, t) {
3074
+ function Di(e, t) {
3074
3075
  let n = `import { ${t.import} } from "${t.from}";`, r = e.lastIndexOf("import ");
3075
3076
  if (r !== -1) {
3076
3077
  let t = e.indexOf("\n", e.indexOf(";", r));
@@ -3078,38 +3079,38 @@ function Ei(e, t) {
3078
3079
  }
3079
3080
  return e.indexOf("type "), n + "\n\n" + e;
3080
3081
  }
3081
- function Di(e, t) {
3082
+ function Oi(e, t) {
3082
3083
  let n = ` { id: "${t.id}", execute: (ctx) => ${t.import}(ctx) },`, r = e.match(/export const steps:\s*Step\[\]\s*=\s*\[/);
3083
3084
  if (!r) return e;
3084
- let i = e.indexOf(r[0]) + r[0].length, a = Oi(e, i - 1);
3085
+ let i = e.indexOf(r[0]) + r[0].length, a = ki(e, i - 1);
3085
3086
  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);
3086
3087
  }
3087
- function Oi(e, t) {
3088
+ function ki(e, t) {
3088
3089
  let n = 0;
3089
3090
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3090
3091
  else if (e[r] === "]" && (n--, n === 0)) return r;
3091
3092
  return -1;
3092
3093
  }
3093
- var ki = "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";
3094
- async function Ai(e) {
3095
- await Mi({
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({
3096
3097
  ...e,
3097
3098
  arrayName: "navbarActions"
3098
3099
  });
3099
3100
  }
3100
- async function ji(e) {
3101
- await Mi({
3101
+ async function Mi(e) {
3102
+ await Ni({
3102
3103
  ...e,
3103
3104
  arrayName: "userMenuActions"
3104
3105
  });
3105
3106
  }
3106
- async function Mi({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3107
+ async function Ni({ actions: e, arrayName: t, paths: n, projectRoot: r, slot: i }) {
3107
3108
  let a = Ur(i, n), o = T.resolve(r, a, "src/constants/navbar-actions.tsx"), s;
3108
- await J(o) ? s = await y.readFile(o, "utf-8") : (await y.mkdir(T.dirname(o), { recursive: !0 }), s = ki);
3109
- for (let n of e) s = Ni(s, n), s = Pi(s, n, t);
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);
3110
3111
  await y.writeFile(o, s, "utf-8");
3111
3112
  }
3112
- function Ni(e, t) {
3113
+ function Pi(e, t) {
3113
3114
  let n = `import { ${t.import} } from "${t.from}";`;
3114
3115
  if (e.includes(n)) return e;
3115
3116
  let r = e.lastIndexOf("import ");
@@ -3117,38 +3118,38 @@ function Ni(e, t) {
3117
3118
  let i = e.indexOf("\n", r);
3118
3119
  return i === -1 ? e + "\n" + n : e.slice(0, i + 1) + n + "\n" + e.slice(i + 1);
3119
3120
  }
3120
- function Pi(e, t, n) {
3121
+ function Fi(e, t, n) {
3121
3122
  let r = e.match(RegExp(`export const ${n}:\\s*NavbarAction\\[\\]\\s*=\\s*\\[`));
3122
3123
  if (!r) return e;
3123
- let i = e.indexOf(r[0]) + r[0].length, a = Fi(e, i - 1);
3124
+ let i = e.indexOf(r[0]) + r[0].length, a = Ii(e, i - 1);
3124
3125
  if (a === -1) return e;
3125
3126
  let o = e.slice(i, a);
3126
3127
  if (o.includes(`id: "${t.id}"`)) return e;
3127
3128
  let s = ` { id: "${t.id}", component: ${t.import} },`;
3128
3129
  return o.trim() === "" ? e.slice(0, a) + "\n" + s + "\n" + e.slice(a) : e.slice(0, a) + s + "\n" + e.slice(a);
3129
3130
  }
3130
- function Fi(e, t) {
3131
+ function Ii(e, t) {
3131
3132
  let n = 0;
3132
3133
  for (let r = t; r < e.length; r++) if (e[r] === "[") n++;
3133
3134
  else if (e[r] === "]" && (n--, n === 0)) return r;
3134
3135
  return -1;
3135
3136
  }
3136
- var Ii = new Set([
3137
+ var Li = new Set([
3137
3138
  ".ts",
3138
3139
  ".tsx",
3139
3140
  ".js",
3140
3141
  ".jsx"
3141
3142
  ]);
3142
- async function Li(e) {
3143
+ async function Ri(e) {
3143
3144
  let { files: t, paths: n, projectRoot: r, projectName: i } = e;
3144
3145
  if (i === "hype-stack") return;
3145
3146
  let a = `@${i}/`;
3146
3147
  await Promise.all(t.map(async (e) => {
3147
3148
  let t = Lr(e.target, n, r), i = await y.stat(t).catch(() => null);
3148
- i?.isDirectory() ? await Bi(t, a) : i?.isFile() && Ii.has(T.extname(t)) && await Vi(t, a);
3149
+ i?.isDirectory() ? await Vi(t, a) : i?.isFile() && Li.has(T.extname(t)) && await Hi(t, a);
3149
3150
  }));
3150
3151
  }
3151
- var Ri = new Set([
3152
+ var zi = new Set([
3152
3153
  ".git",
3153
3154
  "node_modules",
3154
3155
  "dist",
@@ -3157,20 +3158,20 @@ var Ri = new Set([
3157
3158
  ".next",
3158
3159
  "coverage"
3159
3160
  ]);
3160
- async function zi(e, t) {
3161
- t !== "hype-stack" && await Bi(e, `@${t}/`);
3162
- }
3163
3161
  async function Bi(e, t) {
3162
+ t !== "hype-stack" && await Vi(e, `@${t}/`);
3163
+ }
3164
+ async function Vi(e, t) {
3164
3165
  let n = await y.readdir(e, { withFileTypes: !0 });
3165
3166
  await Promise.all(n.map(async (n) => {
3166
3167
  let r = T.join(e, n.name);
3167
3168
  if (n.isDirectory()) {
3168
- if (Ri.has(n.name)) return;
3169
- await Bi(r, t);
3170
- } else n.isFile() && Ii.has(T.extname(n.name)) && await Vi(r, t);
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);
3171
3172
  }));
3172
3173
  }
3173
- async function Vi(e, t) {
3174
+ async function Hi(e, t) {
3174
3175
  let n = await y.readFile(e, "utf-8");
3175
3176
  if (!n.includes(Hr)) return;
3176
3177
  let r = n.replaceAll(Hr, t);
@@ -3178,22 +3179,22 @@ async function Vi(e, t) {
3178
3179
  }
3179
3180
  //#endregion
3180
3181
  //#region src/core/installer.ts
3181
- function Hi(e, t) {
3182
+ function Ui(e, t) {
3182
3183
  return e.slot ? t ? t.includes(e.slot) : e.slot === "frontend" : !0;
3183
3184
  }
3184
- async function Ui(e, t) {
3185
+ async function Wi(e, t) {
3185
3186
  if ((await y.stat(e)).isDirectory()) {
3186
3187
  await y.mkdir(t, { recursive: !0 });
3187
3188
  let n = await y.readdir(e, { withFileTypes: !0 });
3188
- for (let r of n) await Ui(T.join(e, r.name), T.join(t, r.name));
3189
+ for (let r of n) await Wi(T.join(e, r.name), T.join(t, r.name));
3189
3190
  } else await y.mkdir(T.dirname(t), { recursive: !0 }), await y.copyFile(e, t);
3190
3191
  }
3191
- async function Wi(e) {
3192
+ async function Gi(e) {
3192
3193
  let { src: t, dest: n, projectRoot: r, skip: i } = e;
3193
3194
  if ((await y.stat(t)).isDirectory()) {
3194
3195
  await y.mkdir(n, { recursive: !0 });
3195
3196
  let e = await y.readdir(t, { withFileTypes: !0 });
3196
- return (await Promise.all(e.map((e) => Wi({
3197
+ return (await Promise.all(e.map((e) => Gi({
3197
3198
  src: T.join(t, e.name),
3198
3199
  dest: T.join(n, e.name),
3199
3200
  projectRoot: r,
@@ -3202,17 +3203,17 @@ async function Wi(e) {
3202
3203
  }
3203
3204
  return i.has(t) ? [] : (await y.mkdir(T.dirname(n), { recursive: !0 }), await y.copyFile(t, n), [T.relative(r, n)]);
3204
3205
  }
3205
- async function Gi(e) {
3206
+ async function Ki(e) {
3206
3207
  let { file: t, packDir: n, paths: r, projectRoot: i } = e, a = Rr(t.source, n), o = Lr(t.target, r, i);
3207
3208
  return {
3208
3209
  sourcePath: a,
3209
3210
  targetPath: o,
3210
- sourceExists: await J(a) || await ar(a),
3211
- targetExists: await J(o) || await ar(o)
3211
+ sourceExists: await J(a) || await q(a),
3212
+ targetExists: await J(o) || await q(o)
3212
3213
  };
3213
3214
  }
3214
- async function Ki(e) {
3215
- let { file: t, packDir: n, paths: r, projectRoot: i } = e, { sourcePath: a, targetPath: o, sourceExists: s, targetExists: c } = await Gi({
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({
3216
3217
  file: t,
3217
3218
  packDir: n,
3218
3219
  paths: r,
@@ -3227,8 +3228,8 @@ async function Ki(e) {
3227
3228
  default: return `${t.target}: Unknown strategy: ${String(t.strategy)}`;
3228
3229
  }
3229
3230
  }
3230
- async function qi(e) {
3231
- let { file: t, packDir: n, paths: r, projectRoot: i, force: a, overwrite: o } = e, { sourcePath: s, targetPath: c, sourceExists: l, targetExists: u } = await Gi({
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({
3232
3233
  file: t,
3233
3234
  packDir: n,
3234
3235
  paths: r,
@@ -3246,7 +3247,7 @@ async function qi(e) {
3246
3247
  status: "skipped",
3247
3248
  path: t.target,
3248
3249
  reason: "Already exists"
3249
- } : (await Ui(s, c), {
3250
+ } : (await Wi(s, c), {
3250
3251
  status: "installed",
3251
3252
  path: t.target
3252
3253
  });
@@ -3255,16 +3256,16 @@ async function qi(e) {
3255
3256
  status: "skipped",
3256
3257
  path: t.target,
3257
3258
  reason: "Already exists (skip-if-exists)"
3258
- } : (await Ui(s, c), {
3259
+ } : (await Wi(s, c), {
3259
3260
  status: "installed",
3260
3261
  path: t.target
3261
3262
  });
3262
- case "override": return await Ui(s, c), {
3263
+ case "override": return await Wi(s, c), {
3263
3264
  status: "installed",
3264
3265
  path: t.target
3265
3266
  };
3266
3267
  case "merge": {
3267
- if (!u) return await Ui(s, c), {
3268
+ if (!u) return await Wi(s, c), {
3268
3269
  status: "installed",
3269
3270
  path: t.target
3270
3271
  };
@@ -3294,15 +3295,15 @@ async function qi(e) {
3294
3295
  };
3295
3296
  }
3296
3297
  }
3297
- async function Ji(e) {
3298
+ async function Yi(e) {
3298
3299
  let { packs: t, config: n, projectRoot: r, slotsByPack: i } = e, a = n.paths;
3299
3300
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3300
3301
  let o = [], s = /* @__PURE__ */ new Set();
3301
3302
  for (let e of t) {
3302
3303
  let t = i?.get(e.manifest.name);
3303
3304
  for (let n of e.manifest.files) {
3304
- if (n.strategy !== "create" || !Hi(n, t)) continue;
3305
- let { targetPath: i, targetExists: c } = await Gi({
3305
+ if (n.strategy !== "create" || !Ui(n, t)) continue;
3306
+ let { targetPath: i, targetExists: c } = await Ki({
3306
3307
  file: n,
3307
3308
  packDir: e.packDir,
3308
3309
  paths: a,
@@ -3317,13 +3318,13 @@ async function Ji(e) {
3317
3318
  }
3318
3319
  return o;
3319
3320
  }
3320
- async function Yi(e) {
3321
+ async function Xi(e) {
3321
3322
  let { manifest: t, config: n, projectRoot: r, force: i, packDir: a, slots: o } = e, s = n.paths;
3322
3323
  if (!s) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3323
3324
  let c = [];
3324
3325
  for (let e of t.files) {
3325
- if (!Hi(e, o)) continue;
3326
- let t = await Ki({
3326
+ if (!Ui(e, o)) continue;
3327
+ let t = await qi({
3327
3328
  file: e,
3328
3329
  packDir: a,
3329
3330
  paths: s,
@@ -3334,16 +3335,16 @@ async function Yi(e) {
3334
3335
  }
3335
3336
  return c;
3336
3337
  }
3337
- async function Xi(e) {
3338
+ async function Zi(e) {
3338
3339
  let { manifest: t, config: n, projectRoot: r, force: i, overwrite: a, packDir: o, slots: s } = e, c = n.paths;
3339
3340
  if (!c) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3340
3341
  let l = {
3341
3342
  installed: [],
3342
3343
  skipped: [],
3343
3344
  errors: []
3344
- }, u = t.files.filter((e) => Hi(e, s));
3345
+ }, u = t.files.filter((e) => Ui(e, s));
3345
3346
  for (let e of u) {
3346
- let t = await qi({
3347
+ let t = await Ji({
3347
3348
  file: e,
3348
3349
  packDir: o,
3349
3350
  paths: c,
@@ -3363,40 +3364,40 @@ async function Xi(e) {
3363
3364
  break;
3364
3365
  }
3365
3366
  }
3366
- await Li({
3367
+ await Ri({
3367
3368
  files: u,
3368
3369
  paths: c,
3369
3370
  projectRoot: r,
3370
3371
  projectName: n.name
3371
- }), t.env && t.env.length > 0 && await Wr(t.env, c, r), t.routes && t.routes.length > 0 && await Yr(t.routes, c, r), t.context && t.context.length > 0 && await Qr(t.context, c, r), t.sockets && t.sockets.length > 0 && await oi(t.sockets, c, r), t.sdkConfigurations && t.sdkConfigurations.length > 0 && await ui(t.sdkConfigurations, c, r), t.enums && t.enums.length > 0 && await ii(t.enums, c, r), t.frontendRoutes && t.frontendRoutes.length > 0 && await pi(t.frontendRoutes, c, r);
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);
3372
3373
  let d = s && s.length > 0 ? s : ["frontend"];
3373
- for (let e of d) t.nav && t.nav.length > 0 && await _i({
3374
+ for (let e of d) t.nav && t.nav.length > 0 && await vi({
3374
3375
  entries: t.nav,
3375
3376
  paths: c,
3376
3377
  projectRoot: r,
3377
3378
  slot: e
3378
- }), t.navbarActions && t.navbarActions.length > 0 && await Ai({
3379
+ }), t.navbarActions && t.navbarActions.length > 0 && await ji({
3379
3380
  actions: t.navbarActions,
3380
3381
  paths: c,
3381
3382
  projectRoot: r,
3382
3383
  slot: e
3383
- }), t.userMenuActions && t.userMenuActions.length > 0 && await ji({
3384
+ }), t.userMenuActions && t.userMenuActions.length > 0 && await Mi({
3384
3385
  actions: t.userMenuActions,
3385
3386
  paths: c,
3386
3387
  projectRoot: r,
3387
3388
  slot: e
3388
3389
  });
3389
- return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ti(t.onboardingSteps, c, r), t.postLoginRedirect && await vi({
3390
+ return t.onboardingSteps && t.onboardingSteps.length > 0 && await Ei(t.onboardingSteps, c, r), t.postLoginRedirect && await yi({
3390
3391
  postLoginRedirect: t.postLoginRedirect,
3391
3392
  paths: c,
3392
3393
  projectRoot: r,
3393
3394
  slot: d[0]
3394
3395
  }), l;
3395
3396
  }
3396
- async function Zi(e) {
3397
+ async function Qi(e) {
3397
3398
  let { packs: t, config: n, projectRoot: r, force: i, overwrite: a, slotsByPack: o } = e, s = [];
3398
3399
  for (let e of t) {
3399
- let t = o?.get(e.manifest.name), a = await Yi({
3400
+ let t = o?.get(e.manifest.name), a = await Xi({
3400
3401
  manifest: e.manifest,
3401
3402
  config: n,
3402
3403
  projectRoot: r,
@@ -3416,7 +3417,7 @@ async function Zi(e) {
3416
3417
  };
3417
3418
  let c = [], l = [], u = [], d = [], f = n;
3418
3419
  for (let e of t) {
3419
- let t = o?.get(e.manifest.name), n = await Xi({
3420
+ let t = o?.get(e.manifest.name), n = await Zi({
3420
3421
  manifest: e.manifest,
3421
3422
  config: f,
3422
3423
  projectRoot: r,
@@ -3425,7 +3426,7 @@ async function Zi(e) {
3425
3426
  packDir: e.packDir,
3426
3427
  slots: t
3427
3428
  });
3428
- c.push(...n.installed), l.push(...n.skipped), u.push(...n.errors), f = await Qi(f, e.manifest, r), d.push(e.manifest.name);
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);
3429
3430
  }
3430
3431
  return {
3431
3432
  installed: c,
@@ -3436,7 +3437,7 @@ async function Zi(e) {
3436
3437
  config: f
3437
3438
  };
3438
3439
  }
3439
- async function Qi(e, t, n) {
3440
+ async function $i(e, t, n) {
3440
3441
  let r = typeof t == "string" ? t : t.name, i = typeof t == "string" ? [] : wr(t.env), a = Tr([...e.onboarding?.envSections ?? [], ...i]), o = {
3441
3442
  ...e,
3442
3443
  installedPacks: [...e.installedPacks ?? [], r],
@@ -3447,17 +3448,17 @@ async function Qi(e, t, n) {
3447
3448
  };
3448
3449
  return await Ar(n, o), o;
3449
3450
  }
3450
- async function $i(e) {
3451
+ async function ea(e) {
3451
3452
  let { manifest: t, config: n, projectRoot: r, templateDir: i } = e, a = n.paths;
3452
3453
  if (!a) throw Error("stack.json is missing 'paths' configuration. Run 'npx @hype-stack/cli init' to set it up.");
3453
3454
  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");
3454
- if (await ar(u)) {
3455
+ if (await q(u)) {
3455
3456
  let e = await y.readdir(u, { withFileTypes: !0 });
3456
3457
  for (let t of e) {
3457
3458
  if (!t.isDirectory()) continue;
3458
3459
  let e = a[t.name]?.root;
3459
3460
  if (!e) continue;
3460
- let n = await Wi({
3461
+ let n = await Gi({
3461
3462
  src: T.join(u, t.name),
3462
3463
  dest: T.resolve(r, e),
3463
3464
  projectRoot: r,
@@ -3467,7 +3468,7 @@ async function $i(e) {
3467
3468
  }
3468
3469
  }
3469
3470
  for (let e of c) {
3470
- let t = await qi({
3471
+ let t = await Ji({
3471
3472
  file: e,
3472
3473
  packDir: i,
3473
3474
  paths: a,
@@ -3478,11 +3479,11 @@ async function $i(e) {
3478
3479
  t.status === "installed" ? o.push(t.path) : t.status === "error" && s.push(`${t.path}: ${t.reason}`);
3479
3480
  }
3480
3481
  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");
3481
- return await J(f) && await J(p) && await y.rm(p, { force: !0 }), t.frontendRoutes && t.frontendRoutes.length > 0 && await pi(t.frontendRoutes, a, r), t.nav && t.nav.length > 0 && await _i({
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({
3482
3483
  entries: t.nav,
3483
3484
  paths: a,
3484
3485
  projectRoot: r
3485
- }), t.postLoginRedirect && await vi({
3486
+ }), t.postLoginRedirect && await yi({
3486
3487
  postLoginRedirect: t.postLoginRedirect,
3487
3488
  paths: a,
3488
3489
  projectRoot: r
@@ -3493,32 +3494,32 @@ async function $i(e) {
3493
3494
  }
3494
3495
  //#endregion
3495
3496
  //#region src/core/pack-categories.ts
3496
- var ea = [
3497
+ var ta = [
3497
3498
  "starter",
3498
3499
  "layout",
3499
3500
  "feature"
3500
- ], ta = {
3501
+ ], na = {
3501
3502
  starter: "Starter",
3502
3503
  layout: "Layout",
3503
3504
  feature: "Features"
3504
- }, na = new Set(["starter", "layout"]), ra = "starter-saas-betterauth", ia = "layout-basic";
3505
- function aa(e, t = {}) {
3505
+ }, ra = new Set(["starter", "layout"]), ia = "starter-saas-betterauth", aa = "layout-basic";
3506
+ function oa(e, t = {}) {
3506
3507
  let n = [];
3507
- for (let r of ea) {
3508
+ for (let r of ta) {
3508
3509
  let i = e.filter((e) => e.category === r);
3509
3510
  if (i.length === 0) continue;
3510
- let a = na.has(r) ? "single" : "multiple";
3511
+ let a = ra.has(r) ? "single" : "multiple";
3511
3512
  if (r === "layout") {
3512
- n.push(sa("frontend", i)), t.adminAvailable && n.push(sa("admin", i));
3513
+ n.push(ca("frontend", i)), t.adminAvailable && n.push(ca("admin", i));
3513
3514
  continue;
3514
3515
  }
3515
3516
  if (r === "starter") {
3516
- n.push(oa(i));
3517
+ n.push(sa(i));
3517
3518
  continue;
3518
3519
  }
3519
3520
  n.push({
3520
3521
  category: r,
3521
- label: ta[r],
3522
+ label: na[r],
3522
3523
  mode: a,
3523
3524
  packs: i,
3524
3525
  preselect: null
@@ -3526,65 +3527,65 @@ function aa(e, t = {}) {
3526
3527
  }
3527
3528
  return n;
3528
3529
  }
3529
- function oa(e) {
3530
- let t = e.some((e) => e.name === ra);
3530
+ function sa(e) {
3531
+ let t = e.some((e) => e.name === ia);
3531
3532
  return {
3532
3533
  category: "starter",
3533
- label: ta.starter,
3534
+ label: na.starter,
3534
3535
  mode: "single",
3535
3536
  packs: e,
3536
- preselect: t ? ra : null
3537
+ preselect: t ? ia : null
3537
3538
  };
3538
3539
  }
3539
- function sa(e, t) {
3540
- let n = t.some((e) => e.name === ia);
3540
+ function ca(e, t) {
3541
+ let n = t.some((e) => e.name === aa);
3541
3542
  return {
3542
3543
  category: "layout",
3543
3544
  label: e === "admin" ? "Admin Layout" : "Layout",
3544
3545
  mode: "single",
3545
3546
  packs: t,
3546
- preselect: n ? ia : null,
3547
+ preselect: n ? aa : null,
3547
3548
  slot: e
3548
3549
  };
3549
3550
  }
3550
3551
  //#endregion
3551
3552
  //#region src/ui/logger.ts
3552
- function ca(e) {
3553
- s.note(e.map((e) => `${V.arrow} ${e}`).join("\n"), "Next steps");
3553
+ function la(e) {
3554
+ s.note(e.map((e) => `${z.arrow} ${e}`).join("\n"), "Next steps");
3554
3555
  }
3555
3556
  function Z() {
3556
- s.cancel(B.muted("Operation cancelled.")), process.exit(0);
3557
+ s.cancel(R.muted("Operation cancelled.")), process.exit(0);
3557
3558
  }
3558
3559
  //#endregion
3559
3560
  //#region src/core/post-setup.ts
3560
- async function la() {
3561
- return (await q("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
3561
+ async function ua() {
3562
+ return (await K("docker", ["info"], { cwd: process.cwd() })).exitCode === 0;
3562
3563
  }
3563
- async function ua(e) {
3564
+ async function da(e) {
3564
3565
  return J(`${e}/apps/backend/.env`);
3565
3566
  }
3566
- async function da(e, t, n) {
3567
- let r = n ? `Start services with ${B.command("docker compose up -d")}?` : `Docker is not running. Start services with ${B.command("docker compose up -d")}?`, i = t ? !0 : await s.confirm({
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({
3568
3569
  message: r,
3569
3570
  initialValue: !0
3570
3571
  });
3571
- if (s.isCancel(i) && Z(), !i) return s.log.info(B.muted("Skipping Docker services and database migrations.")), !1;
3572
+ if (s.isCancel(i) && Z(), !i) return s.log.info(R.muted("Skipping Docker services and database migrations.")), !1;
3572
3573
  let a = s.spinner();
3573
3574
  a.start("Starting Docker services...");
3574
- let o = await q("docker", [
3575
+ let o = await K("docker", [
3575
3576
  "compose",
3576
3577
  "up",
3577
3578
  "-d"
3578
3579
  ], { cwd: `${e}/apps/backend` });
3579
- return o.exitCode === 0 ? (a.stop(B.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), fa(o), !1);
3580
+ return o.exitCode === 0 ? (a.stop(R.success("Docker services started")), !0) : (a.error("Failed to start Docker services"), pa(o), !1);
3580
3581
  }
3581
- function fa(e) {
3582
+ function pa(e) {
3582
3583
  let t = (e.stderr || e.stdout).trim();
3583
- t && s.log.warn(B.muted(t));
3584
+ t && s.log.warn(R.muted(t));
3584
3585
  }
3585
- async function pa(e, t = 15, n = 2e3) {
3586
+ async function ma(e, t = 15, n = 2e3) {
3586
3587
  for (let r = 0; r < t; r++) {
3587
- if ((await q("docker", [
3588
+ if ((await K("docker", [
3588
3589
  "compose",
3589
3590
  "exec",
3590
3591
  "-T",
@@ -3597,9 +3598,9 @@ async function pa(e, t = 15, n = 2e3) {
3597
3598
  }
3598
3599
  return !1;
3599
3600
  }
3600
- var ma = "Database schema is up to date";
3601
- async function ha(e) {
3602
- let t = await q("pnpm", [
3601
+ var ha = "Database schema is up to date";
3602
+ async function ga(e) {
3603
+ let t = await K("pnpm", [
3603
3604
  "--filter",
3604
3605
  "@internal/backend",
3605
3606
  "exec",
@@ -3607,48 +3608,48 @@ async function ha(e) {
3607
3608
  "migrate",
3608
3609
  "status"
3609
3610
  ], { cwd: e });
3610
- return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(ma) : !1;
3611
+ return t.exitCode === 0 ? `${t.stdout}\n${t.stderr}`.includes(ha) : !1;
3611
3612
  }
3612
- async function ga(e) {
3613
+ async function _a(e) {
3613
3614
  let t = s.spinner();
3614
3615
  t.start("Running database migrations...");
3615
- let n = await q("pnpm", [
3616
+ let n = await K("pnpm", [
3616
3617
  "--filter",
3617
3618
  "@internal/backend",
3618
3619
  "migration:latest"
3619
3620
  ], { cwd: e });
3620
- return n.exitCode === 0 ? (t.stop(B.success("Database migrations applied")), !0) : (t.error("Migrations failed"), fa(n), s.log.warn(B.muted("Run `pnpm --filter @internal/backend migration:latest` manually to apply migrations.")), !1);
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);
3621
3622
  }
3622
- async function _a(e, t, n = {}) {
3623
- if (!await da(e, t, await la())) return !1;
3623
+ async function va(e, t, n = {}) {
3624
+ if (!await fa(e, t, await ua())) return !1;
3624
3625
  let r = s.spinner();
3625
- return r.start("Waiting for Postgres to be ready..."), await pa(e, n.postgresMaxAttempts ?? 15, n.postgresCheckIntervalMs ?? 2e3) ? (r.stop(B.success("Postgres is ready")), !0) : (r.error("Postgres health check timed out"), s.log.warn(B.muted("Run migrations manually once Postgres is ready: pnpm --filter @internal/backend migration:latest")), !1);
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);
3626
3627
  }
3627
- async function va(e, t, n = {}) {
3628
- if (!await _a(e, t, n)) return;
3628
+ async function ya(e, t, n = {}) {
3629
+ if (!await va(e, t, n)) return;
3629
3630
  let r = t ? !0 : await s.confirm({
3630
- message: `Run database migrations with ${B.command("prisma migrate deploy")}?`,
3631
+ message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
3631
3632
  initialValue: !0
3632
3633
  });
3633
3634
  if (s.isCancel(r) && Z(), !r) {
3634
- s.log.info(B.muted("Skipping database migrations."));
3635
+ s.log.info(R.muted("Skipping database migrations."));
3635
3636
  return;
3636
3637
  }
3637
- await ga(e);
3638
+ await _a(e);
3638
3639
  }
3639
- async function ya(e, t, n = {}) {
3640
- if (!await ua(e)) {
3641
- s.log.warn(`${B.path(".env")} not found in ${B.path("apps/backend")}. Skipping Docker and migrations - configure it first.`);
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.`);
3642
3643
  return;
3643
3644
  }
3644
- await va(e, t, n);
3645
+ await ya(e, t, n);
3645
3646
  }
3646
- async function ba(e, t, n = {}) {
3647
- return await ua(e) ? _a(e, t, n) : (s.log.warn(`${B.path(".env")} not found in ${B.path("apps/backend")}. Skipping Docker - configure it first.`), !1);
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);
3648
3649
  }
3649
3650
  //#endregion
3650
3651
  //#region src/core/resolve.ts
3651
- function xa(e) {
3652
+ function Sa(e) {
3652
3653
  let t = /* @__PURE__ */ new Map();
3653
3654
  for (let n of e) t.set(n.name, {
3654
3655
  name: n.name,
@@ -3656,7 +3657,7 @@ function xa(e) {
3656
3657
  });
3657
3658
  return t;
3658
3659
  }
3659
- function Sa(e, t, n = /* @__PURE__ */ new Set()) {
3660
+ function Ca(e, t, n = /* @__PURE__ */ new Set()) {
3660
3661
  let r = /* @__PURE__ */ new Set();
3661
3662
  function i(e) {
3662
3663
  if (n.has(e)) return [];
@@ -3670,10 +3671,10 @@ function Sa(e, t, n = /* @__PURE__ */ new Set()) {
3670
3671
  }
3671
3672
  return i(e);
3672
3673
  }
3673
- function Ca(e, t, n = []) {
3674
+ function wa(e, t, n = []) {
3674
3675
  let r = new Set(n), i = new Set(n), a = [];
3675
3676
  for (let n of e) {
3676
- let e = Sa(n, t, new Set(i));
3677
+ let e = Ca(n, t, new Set(i));
3677
3678
  for (let t of e) i.has(t) || (i.add(t), a.push(t));
3678
3679
  }
3679
3680
  return {
@@ -3681,7 +3682,7 @@ function Ca(e, t, n = []) {
3681
3682
  alreadyInstalled: e.filter((e) => r.has(e))
3682
3683
  };
3683
3684
  }
3684
- function wa(e) {
3685
+ function Ta(e) {
3685
3686
  let { order: t, graph: n, isLocked: r, installed: i = [] } = e, a = new Set(i), o = /* @__PURE__ */ new Set();
3686
3687
  for (let e of t) {
3687
3688
  let t = n.get(e)?.dependencies.some((e) => !a.has(e) && o.has(e)) ?? !1;
@@ -3694,7 +3695,7 @@ function wa(e) {
3694
3695
  }
3695
3696
  //#endregion
3696
3697
  //#region src/core/variants.ts
3697
- function Ta(e, t = {}) {
3698
+ function Ea(e, t = {}) {
3698
3699
  let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
3699
3700
  for (let i of e) {
3700
3701
  let e = t[i.family] ?? i.default;
@@ -3706,14 +3707,14 @@ function Ta(e, t = {}) {
3706
3707
  familyOf: r
3707
3708
  };
3708
3709
  }
3709
- function Ea(e, t, n) {
3710
+ function Da(e, t, n) {
3710
3711
  return [...e.map((e) => n.chosen.get(e.family) ?? e.default), ...t];
3711
3712
  }
3712
- function Da(e, t) {
3713
+ function Oa(e, t) {
3713
3714
  let n = t.familyOf.get(e);
3714
3715
  return n ? t.chosen.get(n) ?? e : e;
3715
3716
  }
3716
- function Oa(e, t) {
3717
+ function ka(e, t) {
3717
3718
  let n = /* @__PURE__ */ new Map();
3718
3719
  for (let t of e) t.family && n.set(t.name, t.family);
3719
3720
  let r = new Set(t), i = /* @__PURE__ */ new Map();
@@ -3729,65 +3730,65 @@ function Oa(e, t) {
3729
3730
  familyOf: n
3730
3731
  };
3731
3732
  }
3732
- function ka(e, t) {
3733
+ function Aa(e, t) {
3733
3734
  return e.map((e) => ({
3734
3735
  ...e,
3735
- dependencies: e.dependencies.map((e) => Da(e, t))
3736
+ dependencies: e.dependencies.map((e) => Oa(e, t))
3736
3737
  }));
3737
3738
  }
3738
3739
  //#endregion
3739
3740
  //#region src/ui/banner.ts
3740
- var Aa = [
3741
+ var ja = [
3741
3742
  " ██╗ ██╗ ██╗ ██╗ ██████╗ ███████╗",
3742
3743
  " ██║ ██║ ╚██╗ ██╔╝ ██╔══██╗ ██╔════╝",
3743
3744
  " ███████║ ╚████╔╝ ██████╔╝ █████╗ ",
3744
3745
  " ██╔══██║ ╚██╔╝ ██╔═══╝ ██╔══╝ ",
3745
3746
  " ██║ ██║ ██║ ██║ ███████╗",
3746
3747
  " ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚══════╝"
3747
- ], ja = [
3748
+ ], Ma = [
3748
3749
  " ███████╗ ████████╗ █████╗ ██████╗ ██╗ ██╗",
3749
3750
  " ██╔════╝ ╚══██╔══╝ ██╔══██╗ ██╔════╝ ██║ ██╔╝",
3750
3751
  " ███████╗ ██║ ███████║ ██║ █████╔╝ ",
3751
3752
  " ╚════██║ ██║ ██╔══██║ ██║ ██╔═██╗ ",
3752
3753
  " ███████║ ██║ ██║ ██║ ╚██████╗ ██║ ██╗",
3753
3754
  " ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝"
3754
- ], Ma = [
3755
+ ], Na = [
3755
3756
  253,
3756
3757
  176,
3757
3758
  21
3758
- ], Na = [
3759
+ ], Pa = [
3759
3760
  245,
3760
3761
  76,
3761
3762
  2
3762
- ], Pa = 5, Fa = [
3763
+ ], Fa = 5, Ia = [
3763
3764
  17,
3764
3765
  103,
3765
3766
  248
3766
- ], Ia = [
3767
+ ], La = [
3767
3768
  42,
3768
3769
  160,
3769
3770
  250
3770
- ], La = .2;
3771
- function Ra() {
3771
+ ], Ra = .2;
3772
+ function za() {
3772
3773
  console.log();
3773
- for (let e of ye(Aa, {
3774
- start: Ma,
3775
- end: Na,
3776
- angle: Pa
3774
+ for (let e of xe(ja, {
3775
+ start: Na,
3776
+ end: Pa,
3777
+ angle: Fa
3777
3778
  })) console.log(b.bold(e));
3778
- for (let e of ye(ja, {
3779
- start: Fa,
3780
- end: Ia,
3781
- angle: La
3779
+ for (let e of xe(Ma, {
3780
+ start: Ia,
3781
+ end: La,
3782
+ angle: Ra
3782
3783
  })) console.log(b.bold(e));
3783
- console.log(), console.log(` ${V.spark} ${b.dim("v" + A)} ${b.dim("·")} ${_e("Ship web + desktop apps from one codebase")}`), console.log();
3784
+ console.log(), console.log(` ${z.spark} ${b.dim("v" + A)} ${b.dim("·")} ${ye("Ship web + desktop apps from one codebase")}`), console.log();
3784
3785
  }
3785
- function za() {
3786
- console.log(), console.log(` ${V.bolt} ${me.orange("Hype")}${me.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3786
+ function Ba() {
3787
+ console.log(), console.log(` ${z.bolt} ${ge.orange("Hype")}${ge.skyBlue("Stack")} ${b.dim("v" + A)}`), console.log();
3787
3788
  }
3788
3789
  //#endregion
3789
3790
  //#region src/ui/pack-multiselect.ts
3790
- var Ba = class extends O {
3791
+ var Va = class extends O {
3791
3792
  options;
3792
3793
  cursor = 0;
3793
3794
  selected;
@@ -3891,44 +3892,44 @@ var Ba = class extends O {
3891
3892
  }
3892
3893
  }
3893
3894
  };
3894
- function Va(e) {
3895
- return new Ba(e).prompt();
3895
+ function Ha(e) {
3896
+ return new Va(e).prompt();
3896
3897
  }
3897
3898
  //#endregion
3898
3899
  //#region src/utils/naming.ts
3899
- function Ha(e) {
3900
+ function Ua(e) {
3900
3901
  return e.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
3901
3902
  }
3902
- function Ua(e) {
3903
+ function Wa(e) {
3903
3904
  return e.split(/[-_]/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
3904
3905
  }
3905
3906
  //#endregion
3906
3907
  //#region src/utils/validate.ts
3907
- function Wa(e) {
3908
+ function Ga(e) {
3908
3909
  if (!e.trim()) return "Project name cannot be empty";
3909
3910
  if (e.length > 214) return "Project name is too long (max 214 characters)";
3910
- let t = Ha(e);
3911
- if (!ne.test(t)) return "Project name must contain at least one letter or number";
3911
+ let t = Ua(e);
3912
+ if (!ie.test(t)) return "Project name must contain at least one letter or number";
3912
3913
  }
3913
3914
  //#endregion
3914
3915
  //#region src/core/apply-mode.ts
3915
- var Ga = "src/hooks/use-theme.ts", Ka = /(\bexport\s+const\s+defaultTheme\s*=\s*)(["'])(?:light|dark)\2/;
3916
- function qa(e, t) {
3917
- return e.replace(Ka, (e, n, r) => `${n}${r}${t}${r}`);
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}`);
3918
3919
  }
3919
- async function Ja(e, t) {
3920
- let n = T.resolve(e, Ga), r;
3920
+ async function Ya(e, t) {
3921
+ let n = T.resolve(e, Ka), r;
3921
3922
  try {
3922
3923
  r = await y.readFile(n, "utf-8");
3923
3924
  } catch {
3924
3925
  return !1;
3925
3926
  }
3926
- let i = qa(r, t);
3927
+ let i = Ja(r, t);
3927
3928
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3928
3929
  }
3929
3930
  //#endregion
3930
3931
  //#region src/core/apply-theme.ts
3931
- function Ya(e, t) {
3932
+ function Xa(e, t) {
3932
3933
  let n = 0;
3933
3934
  for (; n < e.length;) {
3934
3935
  let r = e.indexOf(t, n);
@@ -3951,47 +3952,47 @@ function Ya(e, t) {
3951
3952
  }
3952
3953
  return null;
3953
3954
  }
3954
- function Xa(e, t) {
3955
+ function Za(e, t) {
3955
3956
  let n = e;
3956
3957
  for (let [e, r] of Object.entries(t)) {
3957
- let t = RegExp(`(^[ \\t]*--${Za(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
3958
+ let t = RegExp(`(^[ \\t]*--${Qa(e)}[ \\t]*:[ \\t]*)([^;\\n]*);`, "m");
3958
3959
  n = n.replace(t, (e, t) => `${t}${r};`);
3959
3960
  }
3960
3961
  return n;
3961
3962
  }
3962
- function Za(e) {
3963
+ function Qa(e) {
3963
3964
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3964
3965
  }
3965
- function Qa(e, t) {
3966
- let n = Ya(e, ":root"), r = Ya(e, ".dark"), i = e;
3966
+ function $a(e, t) {
3967
+ let n = Xa(e, ":root"), r = Xa(e, ".dark"), i = e;
3967
3968
  if (n) {
3968
3969
  let e = i.slice(0, n.bodyStart), r = i.slice(n.bodyStart, n.bodyEnd), a = i.slice(n.bodyEnd);
3969
- i = e + Xa(r, t.light) + a;
3970
+ i = e + Za(r, t.light) + a;
3970
3971
  }
3971
3972
  if (r) {
3972
- let e = Ya(i, ".dark");
3973
+ let e = Xa(i, ".dark");
3973
3974
  if (e) {
3974
3975
  let n = i.slice(0, e.bodyStart), r = i.slice(e.bodyStart, e.bodyEnd), a = i.slice(e.bodyEnd);
3975
- i = n + Xa(r, t.dark) + a;
3976
+ i = n + Za(r, t.dark) + a;
3976
3977
  }
3977
3978
  }
3978
3979
  return i;
3979
3980
  }
3980
- var $a = "assets/styles.css";
3981
- async function eo(e, t) {
3982
- let n = T.resolve(e, $a), r;
3981
+ var eo = "assets/styles.css";
3982
+ async function to(e, t) {
3983
+ let n = T.resolve(e, eo), r;
3983
3984
  try {
3984
3985
  r = await y.readFile(n, "utf-8");
3985
3986
  } catch {
3986
3987
  return !1;
3987
3988
  }
3988
- let i = Qa(r, t);
3989
+ let i = $a(r, t);
3989
3990
  return i === r || await y.writeFile(n, i, "utf-8"), !0;
3990
3991
  }
3991
3992
  //#endregion
3992
3993
  //#region src/core/clone.ts
3993
- async function to(e) {
3994
- let t = await ee(j, {
3994
+ async function no(e) {
3995
+ let t = await ee(te, {
3995
3996
  dir: e,
3996
3997
  force: !0
3997
3998
  });
@@ -4002,7 +4003,7 @@ async function to(e) {
4002
4003
  }
4003
4004
  //#endregion
4004
4005
  //#region src/core/editor-config.ts
4005
- function no(e) {
4006
+ function ro(e) {
4006
4007
  let t = {
4007
4008
  globs: [],
4008
4009
  alwaysApply: !1
@@ -4037,10 +4038,10 @@ function no(e) {
4037
4038
  content: i
4038
4039
  };
4039
4040
  }
4040
- function ro(e) {
4041
+ function io(e) {
4041
4042
  return e.frontmatter.globs.length > 0 ? `---\npaths:\n${e.frontmatter.globs.map((e) => ` - "${e}"`).join("\n")}\n---\n\n${e.content}` : e.content;
4042
4043
  }
4043
- function io(e) {
4044
+ function ao(e) {
4044
4045
  let t;
4045
4046
  t = e.frontmatter.alwaysApply ? "always_on" : e.frontmatter.globs.length > 0 ? "glob" : "model_decision";
4046
4047
  let n = [`trigger: ${t}`];
@@ -4050,30 +4051,30 @@ function io(e) {
4050
4051
  }
4051
4052
  return e.frontmatter.description && n.push(`description: ${e.frontmatter.description}`), `---\n${n.join("\n")}\n---\n\n${e.content}`;
4052
4053
  }
4053
- function ao(e) {
4054
+ function oo(e) {
4054
4055
  return e.frontmatter.globs.length > 0 ? `---\napplyTo: "${e.frontmatter.globs.join(", ")}"\n---\n\n${e.content}` : e.content;
4055
4056
  }
4056
- var oo = {
4057
+ var so = {
4057
4058
  claude: {
4058
4059
  rulesDir: ".claude/rules",
4059
4060
  extension: ".md",
4060
- convert: ro
4061
+ convert: io
4061
4062
  },
4062
4063
  windsurf: {
4063
4064
  rulesDir: ".windsurf/rules",
4064
4065
  extension: ".md",
4065
- convert: io
4066
+ convert: ao
4066
4067
  },
4067
4068
  copilot: {
4068
4069
  rulesDir: ".github/instructions",
4069
4070
  extension: ".instructions.md",
4070
- convert: ao
4071
+ convert: oo
4071
4072
  }
4072
4073
  };
4073
- async function so(e) {
4074
- let t = T.join(e, ie), n = (await y.readdir(t, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isFile() && e.name.endsWith(".mdc"));
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"));
4075
4076
  return await Promise.all(n.map(async (e) => {
4076
- let n = T.join(t, e.name), { frontmatter: r, content: i } = no(await y.readFile(n, "utf-8"));
4077
+ let n = T.join(t, e.name), { frontmatter: r, content: i } = ro(await y.readFile(n, "utf-8"));
4077
4078
  return {
4078
4079
  frontmatter: r,
4079
4080
  content: i,
@@ -4081,31 +4082,31 @@ async function so(e) {
4081
4082
  };
4082
4083
  }));
4083
4084
  }
4084
- async function co(e, t) {
4085
+ async function lo(e, t) {
4085
4086
  if (t === "cursor") return;
4086
- let n = oo[t], r = await so(e), i = T.join(e, n.rulesDir);
4087
+ let n = so[t], r = await co(e), i = T.join(e, n.rulesDir);
4087
4088
  await y.mkdir(i, { recursive: !0 }), await Promise.all(r.map((e) => {
4088
4089
  let t = n.convert(e), r = e.filename.replace(/\.mdc$/, n.extension);
4089
4090
  return y.writeFile(T.join(i, r), t, "utf-8");
4090
- })), await ur(T.join(e, ae)), await ur(T.join(e, oe));
4091
+ })), await ur(T.join(e, se)), await ur(T.join(e, ce));
4091
4092
  }
4092
4093
  //#endregion
4093
4094
  //#region src/core/env-files.ts
4094
- var lo = [
4095
+ var uo = [
4095
4096
  "apps",
4096
4097
  "packages",
4097
4098
  "libs",
4098
4099
  "shared"
4099
4100
  ];
4100
- async function uo(e) {
4101
- let t = await fo(e);
4101
+ async function fo(e) {
4102
+ let t = await po(e);
4102
4103
  return (await Promise.all(t.map(async (t) => {
4103
4104
  let n = T.join(T.dirname(t), ".env");
4104
4105
  return await J(n) ? null : (await y.copyFile(t, n), T.relative(e, n));
4105
4106
  }))).filter((e) => e !== null).sort();
4106
4107
  }
4107
- async function fo(e) {
4108
- let t = [T.join(e, ".env.example")], n = await Promise.all(lo.map(async (t) => {
4108
+ async function po(e) {
4109
+ let t = [T.join(e, ".env.example")], n = await Promise.all(uo.map(async (t) => {
4109
4110
  let n = T.join(e, t);
4110
4111
  return (await y.readdir(n, { withFileTypes: !0 }).catch(() => [])).filter((e) => e.isDirectory()).map((e) => T.join(n, e.name, ".env.example"));
4111
4112
  }));
@@ -4113,12 +4114,12 @@ async function fo(e) {
4113
4114
  }
4114
4115
  //#endregion
4115
4116
  //#region src/core/post-clone.ts
4116
- var Q = "@hype-stack/", po = "hype-stack";
4117
- async function mo(e) {
4117
+ var Q = "@hype-stack/", mo = "hype-stack";
4118
+ async function ho(e) {
4118
4119
  await ur(T.join(e, ".git"));
4119
4120
  }
4120
- async function ho(e) {
4121
- await q("git", ["init"], { cwd: e }), await q("git", ["add", "."], { cwd: e }), await q("git", [
4121
+ async function go(e) {
4122
+ await K("git", ["init"], { cwd: e }), await K("git", ["add", "."], { cwd: e }), await K("git", [
4122
4123
  "-c",
4123
4124
  "user.name=Hype Stack CLI",
4124
4125
  "-c",
@@ -4128,22 +4129,22 @@ async function ho(e) {
4128
4129
  "Initial commit from Hype Stack CLI"
4129
4130
  ], { cwd: e });
4130
4131
  }
4131
- async function go(e, t) {
4132
- let n = `@${t}/`, r = await wo(e);
4132
+ async function _o(e, t) {
4133
+ let n = `@${t}/`, r = await To(e);
4133
4134
  for (let e of r) {
4134
4135
  let t = await sr(e);
4135
4136
  if (!t) continue;
4136
4137
  let r = !1;
4137
- t.name?.startsWith(Q) && (t.name = t.name.replace(Q, n), r = !0), xo(t.dependencies, n) && (r = !0), xo(t.devDependencies, n) && (r = !0), t.nx && So(t.nx, n) && (r = !0);
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);
4138
4139
  let i = await y.readFile(e, "utf-8");
4139
4140
  if (i.includes(Q)) {
4140
4141
  let t = i.replaceAll(Q, n);
4141
4142
  await y.writeFile(e, t, "utf-8");
4142
4143
  } else r && await cr(e, t);
4143
4144
  }
4144
- await zi(e, t), await yo(e, t), await Co(e, t);
4145
+ await Bi(e, t), await bo(e, t), await wo(e, t);
4145
4146
  }
4146
- var _o = new Set([
4147
+ var vo = new Set([
4147
4148
  ".git",
4148
4149
  "node_modules",
4149
4150
  "dist",
@@ -4151,10 +4152,10 @@ var _o = new Set([
4151
4152
  ".nx",
4152
4153
  ".next",
4153
4154
  "coverage"
4154
- ]), vo = /^(docker-compose|compose)(\.[\w.-]+)?\.ya?ml$/;
4155
- async function yo(e, t) {
4156
- if (t === po) return;
4157
- let n = await bo(e);
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);
4158
4159
  await Promise.all(n.map(async (e) => {
4159
4160
  let n = await y.readFile(e, "utf-8").catch(() => null);
4160
4161
  if (!n || !/^name:[ \t]*hype-stack/m.test(n)) return;
@@ -4162,14 +4163,14 @@ async function yo(e, t) {
4162
4163
  await y.writeFile(e, r, "utf-8");
4163
4164
  }));
4164
4165
  }
4165
- async function bo(e) {
4166
+ async function xo(e) {
4166
4167
  let t = await y.readdir(e, { withFileTypes: !0 }).catch(() => []);
4167
4168
  return (await Promise.all(t.map(async (t) => {
4168
4169
  let n = T.join(e, t.name);
4169
- return t.isDirectory() ? _o.has(t.name) ? [] : bo(n) : t.isFile() && vo.test(t.name) ? [n] : [];
4170
+ return t.isDirectory() ? vo.has(t.name) ? [] : xo(n) : t.isFile() && yo.test(t.name) ? [n] : [];
4170
4171
  }))).flat();
4171
4172
  }
4172
- function xo(e, t) {
4173
+ function So(e, t) {
4173
4174
  if (!e) return !1;
4174
4175
  let n = !1;
4175
4176
  for (let r of Object.keys(e)) if (r.startsWith(Q)) {
@@ -4178,7 +4179,7 @@ function xo(e, t) {
4178
4179
  }
4179
4180
  return n;
4180
4181
  }
4181
- function So(e, t) {
4182
+ function Co(e, t) {
4182
4183
  if (!e) return !1;
4183
4184
  let n = !1;
4184
4185
  if (e.implicitDependencies &&= e.implicitDependencies.map((e) => e.startsWith(Q) ? (n = !0, e.replace(Q, t)) : e), e.targets) {
@@ -4186,13 +4187,13 @@ function So(e, t) {
4186
4187
  }
4187
4188
  return n;
4188
4189
  }
4189
- async function Co(e, t) {
4190
+ async function wo(e, t) {
4190
4191
  let n = T.join(e, "packages/enums/src/app/index.ts"), r = await y.readFile(n, "utf-8").catch(() => null);
4191
4192
  if (!r) return;
4192
- let i = Ua(t), a = r.replaceAll(`id: "${po}"`, `id: "${t}"`).replaceAll(`name: "${po}"`, `name: "${t}"`).replace(/name: "Hype Stack"/, `name: "${i}"`).replace(/description: ".*?"/, `description: "${i} application"`);
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"`);
4193
4194
  await y.writeFile(n, a, "utf-8");
4194
4195
  }
4195
- async function wo(e) {
4196
+ async function To(e) {
4196
4197
  let t = [], n = T.join(e, "package.json");
4197
4198
  (await y.stat(n).catch(() => null))?.isFile() && t.push(n);
4198
4199
  for (let n of [
@@ -4212,7 +4213,7 @@ async function wo(e) {
4212
4213
  }
4213
4214
  //#endregion
4214
4215
  //#region src/core/readme.ts
4215
- var To = {
4216
+ var Eo = {
4216
4217
  cursor: {
4217
4218
  label: "Cursor",
4218
4219
  rulesDir: ".cursor/rules"
@@ -4229,21 +4230,21 @@ var To = {
4229
4230
  label: "GitHub Copilot",
4230
4231
  rulesDir: ".github/instructions"
4231
4232
  }
4232
- }, Eo = {
4233
+ }, Do = {
4233
4234
  backend: "Hono API server (Postgres, Prisma, Kysely, Valkey cache, WorkOS auth)",
4234
4235
  frontend: "React + Vite app talking to the backend through the typed HyperFetch SDK"
4235
- }, Do = {
4236
+ }, Oo = {
4236
4237
  enums: "Shared enums and app config used across apps",
4237
4238
  cli: "Project tooling and code generators"
4238
4239
  };
4239
- function Oo(e, t) {
4240
+ function ko(e, t) {
4240
4241
  return Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)).map(([e, n]) => {
4241
4242
  let r = t[e];
4242
4243
  return r ? `- \`${n}\` - ${r}` : `- \`${n}\``;
4243
4244
  });
4244
4245
  }
4245
- function ko(e) {
4246
- let { projectName: t, editor: n, workspace: r } = e, i = Ua(t), a = To[n], o = !!r.apps.backend, s = Oo(r.apps, Eo), c = Oo(r.packages, Do), l = [];
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 = [];
4247
4248
  s.length > 0 && l.push(...s), c.length > 0 && l.push(...c), l.push("- `stack.json` - Hype Stack workspace config (apps, paths, installed packs)");
4248
4249
  let u = [];
4249
4250
  u.push(`# ${i}`), u.push([
@@ -4346,19 +4347,19 @@ function ko(e) {
4346
4347
  "stays useful."
4347
4348
  ].join("\n")), u.join("\n\n") + "\n";
4348
4349
  }
4349
- async function Ao(e, t) {
4350
+ async function jo(e, t) {
4350
4351
  let n = T.join(e, "README.md");
4351
- await y.writeFile(n, ko(t), "utf-8");
4352
+ await y.writeFile(n, Ao(t), "utf-8");
4352
4353
  }
4353
4354
  //#endregion
4354
4355
  //#region src/core/tracking.ts
4355
- async function jo(e) {
4356
+ async function Mo(e) {
4356
4357
  try {
4357
4358
  let t = {
4358
- "X-Device-Id": Xn(),
4359
- "X-Client-Info": Zn()
4360
- }, n = await Kn(L()).catch(() => null);
4361
- n?.token && (t.Authorization = `Bearer ${n.token}`), await K.createRequest()({
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()({
4362
4363
  endpoint: "/cli/track",
4363
4364
  method: "POST"
4364
4365
  }).setPayload({ event: e }).setHeaders(t).send();
@@ -4366,7 +4367,7 @@ async function jo(e) {
4366
4367
  }
4367
4368
  //#endregion
4368
4369
  //#region src/core/npm-deps.ts
4369
- function Mo(e, t) {
4370
+ function No(e, t) {
4370
4371
  let n = [], r = [];
4371
4372
  if (!e) return {
4372
4373
  errors: n,
@@ -4397,7 +4398,7 @@ function Mo(e, t) {
4397
4398
  operations: r
4398
4399
  };
4399
4400
  }
4400
- function No(e) {
4401
+ function Po(e) {
4401
4402
  let t = {};
4402
4403
  for (let n of e) if (n) for (let [e, r] of Object.entries(n)) t[e] = {
4403
4404
  ...t[e],
@@ -4405,7 +4406,7 @@ function No(e) {
4405
4406
  };
4406
4407
  return t;
4407
4408
  }
4408
- async function Po(e, t, n = q) {
4409
+ async function Fo(e, t, n = K) {
4409
4410
  let r = [];
4410
4411
  for (let i of e) {
4411
4412
  let e = T.join(t, i.relativeDir);
@@ -4441,25 +4442,25 @@ async function Po(e, t, n = q) {
4441
4442
  function $(e) {
4442
4443
  return e instanceof Error ? e.message : String(e);
4443
4444
  }
4444
- async function Fo(e, t, n) {
4445
+ async function Io(e, t, n) {
4445
4446
  let r = e.filter((e) => e.tier === "paid" && !t.has(e.name)).map((e) => e.name);
4446
4447
  return r.length === 0 ? {} : Vr(r, n).catch(() => ({}));
4447
4448
  }
4448
- function Io(e, t) {
4449
- return e === "free" ? B.success("free") : e === "owned" ? B.accent("owned") : `${B.highlight(`$${t}`)} ${B.muted("locked")}`;
4449
+ function Lo(e, t) {
4450
+ return e === "free" ? R.success("free") : e === "owned" ? R.accent("owned") : `${R.highlight(`$${t}`)} ${R.muted("locked")}`;
4450
4451
  }
4451
- async function Lo(e, t, n) {
4452
+ async function Ro(e, t, n) {
4452
4453
  let r = e.filter((e) => t(e)), i = e.filter((e) => !t(e));
4453
- 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) => ({
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) => ({
4454
4455
  name: e.name,
4455
4456
  displayName: e.displayName,
4456
4457
  price: e.price
4457
4458
  })));
4458
4459
  }
4459
- function Ro(e, t) {
4460
+ function zo(e, t) {
4460
4461
  let n = e.map((e, n) => {
4461
4462
  let r = t.get(e), i = r ? r.displayName : e;
4462
- return ` ${B.muted(`${n + 1}.`)} ${B.brand(i)}`;
4463
+ return ` ${R.muted(`${n + 1}.`)} ${R.brand(i)}`;
4463
4464
  });
4464
4465
  s.note([
4465
4466
  "These packs will be installed, in order:",
@@ -4467,7 +4468,7 @@ function Ro(e, t) {
4467
4468
  ...n
4468
4469
  ].join("\n"), "Install Plan");
4469
4470
  }
4470
- async function zo(e, t) {
4471
+ async function Bo(e, t) {
4471
4472
  let n = [];
4472
4473
  for (let r of e) {
4473
4474
  let e = await Fr(r), i = await Ir(r, t);
@@ -4479,32 +4480,32 @@ async function zo(e, t) {
4479
4480
  }
4480
4481
  return n;
4481
4482
  }
4482
- async function Bo(e) {
4483
- let { prepared: t, paths: n, cwd: r, spinner: i } = e, a = Mo(No(t.map((e) => e.manifest.dependencies_npm)), n);
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);
4484
4485
  if (a.errors.length > 0) {
4485
4486
  for (let e of a.errors) s.log.error(e);
4486
4487
  return;
4487
4488
  }
4488
4489
  if (a.operations.length === 0) return;
4489
4490
  i.start("Installing npm dependencies...");
4490
- let o = await Po(a.operations, r);
4491
+ let o = await Fo(a.operations, r);
4491
4492
  if (i.stop(o.ok ? "npm dependencies installed" : "npm dependency installation failed"), !o.ok) for (let e of o.errors) s.log.error(e);
4492
4493
  }
4493
- function Vo() {
4494
- s.note([` ${B.command("1. npx @hype-stack/cli onboard")} ${B.muted("(set up env vars + run migrations)")}`, ` ${B.command("2. pnpm dev")} ${B.muted("(start frontend + backend)")}`].join("\n"), "Next steps");
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");
4495
4496
  }
4496
- function Ho(e) {
4497
+ function Uo(e) {
4497
4498
  if (e.length === 0) return;
4498
4499
  let t = e.map((e) => {
4499
4500
  let t = e.replace(/^\{\{[^}]+\}\}\//, "");
4500
- return ` ${B.muted("•")} ${B.path(t)}`;
4501
+ return ` ${R.muted("•")} ${R.path(t)}`;
4501
4502
  });
4502
4503
  s.note(t.join("\n"), "Skipped (already exist)");
4503
4504
  }
4504
- async function Uo(e) {
4505
+ async function Wo(e) {
4505
4506
  let { prepared: t, config: n, cwd: r, force: i, yes: a, slotsByPack: o } = e, c = /* @__PURE__ */ new Set();
4506
4507
  if (i) return c;
4507
- let l = await Ji({
4508
+ let l = await Yi({
4508
4509
  packs: t,
4509
4510
  config: n,
4510
4511
  projectRoot: r,
@@ -4512,17 +4513,17 @@ async function Uo(e) {
4512
4513
  });
4513
4514
  if (l.length === 0) return c;
4514
4515
  if (a) {
4515
- s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${B.command("--force")} to overwrite.`);
4516
+ s.log.warning(`${l.length} existing file${l.length === 1 ? "" : "s"} kept. Pass ${R.command("--force")} to overwrite.`);
4516
4517
  let e = l.map((e) => {
4517
4518
  let t = T.relative(r, e.targetPath) || e.target;
4518
- return ` ${B.muted("•")} ${B.path(t)} ${B.muted(`(${e.packName})`)}`;
4519
+ return ` ${R.muted("•")} ${R.path(t)} ${R.muted(`(${e.packName})`)}`;
4519
4520
  });
4520
4521
  return s.note(e.join("\n"), "Kept existing files"), c;
4521
4522
  }
4522
4523
  s.log.warning(`${l.length} file${l.length === 1 ? "" : "s"} already exist in your project.`);
4523
4524
  for (let e of l) {
4524
4525
  let t = T.relative(r, e.targetPath) || e.target, n = await s.confirm({
4525
- message: `Overwrite ${B.path(t)}? ${B.muted(`(${e.packName})`)}`,
4526
+ message: `Overwrite ${R.path(t)}? ${R.muted(`(${e.packName})`)}`,
4526
4527
  initialValue: !1
4527
4528
  });
4528
4529
  s.isCancel(n) && (s.cancel("Installation cancelled."), process.exit(0)), n && c.add(e.targetPath);
@@ -4531,7 +4532,7 @@ async function Uo(e) {
4531
4532
  }
4532
4533
  //#endregion
4533
4534
  //#region src/ui/swatch.ts
4534
- function Wo(e) {
4535
+ function Go(e) {
4535
4536
  let t = e.trim().match(/^oklch\(([^)]+)\)$/i);
4536
4537
  if (!t) return null;
4537
4538
  let n = t[1].trim().split(/\s+/);
@@ -4550,58 +4551,58 @@ function Wo(e) {
4550
4551
  h: a
4551
4552
  };
4552
4553
  }
4553
- function Go(e) {
4554
+ function Ko(e) {
4554
4555
  return Math.min(255, Math.max(0, Math.round(e)));
4555
4556
  }
4556
- function Ko(e) {
4557
+ function qo(e) {
4557
4558
  return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
4558
4559
  }
4559
- function qo({ l: e, c: t, h: n }) {
4560
+ function Jo({ l: e, c: t, h: n }) {
4560
4561
  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;
4561
4562
  return [
4562
- Go(Ko(f) * 255),
4563
- Go(Ko(p) * 255),
4564
- Go(Ko(m) * 255)
4563
+ Ko(qo(f) * 255),
4564
+ Ko(qo(p) * 255),
4565
+ Ko(qo(m) * 255)
4565
4566
  ];
4566
4567
  }
4567
- var Jo = "\x1B[49m";
4568
- function Yo(e, t) {
4568
+ var Yo = "\x1B[49m";
4569
+ function Xo(e, t) {
4569
4570
  let n = e[t];
4570
4571
  if (!n) return b.dim(" ");
4571
- let r = Wo(n);
4572
+ let r = Go(n);
4572
4573
  if (!r) return b.dim(" ");
4573
- let [i, a, o] = qo(r);
4574
- return `\x1b[48;2;${i};${a};${o}m ${Jo}`;
4574
+ let [i, a, o] = Jo(r);
4575
+ return `\x1b[48;2;${i};${a};${o}m ${Yo}`;
4575
4576
  }
4576
- var Xo = [
4577
+ var Zo = [
4577
4578
  "primary",
4578
4579
  "secondary",
4579
4580
  "accent"
4580
4581
  ];
4581
- function Zo(e) {
4582
- return Xo.map((t) => Yo(e, t)).join("");
4583
- }
4584
4582
  function Qo(e) {
4585
- return `${Zo(e.light)} ${b.dim("·")} ${Zo(e.dark)}`;
4583
+ return Zo.map((t) => Xo(e, t)).join("");
4584
+ }
4585
+ function $o(e) {
4586
+ return `${Qo(e.light)} ${b.dim("·")} ${Qo(e.dark)}`;
4586
4587
  }
4587
4588
  //#endregion
4588
4589
  //#region src/commands/create.ts
4589
- async function $o(e) {
4590
- e.skipBanner || Ra(), s.intro(B.brandBold("Create a new Hype Stack project"));
4590
+ async function es(e) {
4591
+ e.skipBanner || za(), s.intro(R.brandBold("Create a new Hype Stack project"));
4591
4592
  let o = e.yes === !0, c, l;
4592
4593
  if (o && e.name) {
4593
- let t = Wa(e.name);
4594
- t && (s.log.error(t), Z()), l = e.name, c = Ha(e.name);
4594
+ let t = Ga(e.name);
4595
+ t && (s.log.error(t), Z()), l = e.name, c = Ua(e.name);
4595
4596
  } else {
4596
4597
  let t = await s.text({
4597
4598
  message: "What is your project named?",
4598
4599
  placeholder: "my-app",
4599
4600
  initialValue: e.name ?? "",
4600
- validate: (e) => Wa(e ?? "")
4601
+ validate: (e) => Ga(e ?? "")
4601
4602
  });
4602
- s.isCancel(t) && Z(), l = t, c = Ha(l);
4603
+ s.isCancel(t) && Z(), l = t, c = Ua(l);
4603
4604
  }
4604
- l.trim() !== c && s.log.info(B.muted(`Using "${B.highlight(c)}" as the project name`));
4605
+ l.trim() !== c && s.log.info(R.muted(`Using "${R.highlight(c)}" as the project name`));
4605
4606
  let u;
4606
4607
  if (e.directory !== void 0) u = e.directory;
4607
4608
  else {
@@ -4619,14 +4620,14 @@ async function $o(e) {
4619
4620
  u = dr(t, c);
4620
4621
  }
4621
4622
  let d = T.resolve(u);
4622
- o || s.note(B.path(d), "Project will be created at");
4623
- let f = e.editor && re.includes(e.editor) ? e.editor : null, p;
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;
4624
4625
  if (f) p = f;
4625
4626
  else if (o) p = "cursor";
4626
4627
  else {
4627
4628
  let e = await s.select({
4628
4629
  message: "Which code editor do you use?",
4629
- options: I.map((e) => ({
4630
+ options: P.map((e) => ({
4630
4631
  value: e.value,
4631
4632
  label: e.label,
4632
4633
  hint: "hint" in e ? e.hint : void 0
@@ -4643,78 +4644,78 @@ async function $o(e) {
4643
4644
  message: "Pick a color theme",
4644
4645
  options: r.map((e) => ({
4645
4646
  value: e.name,
4646
- label: `${Qo(e)} ${e.label}`
4647
+ label: `${$o(e)} ${e.label}`
4647
4648
  })),
4648
4649
  initialValue: h
4649
4650
  });
4650
4651
  s.isCancel(e) && Z(), g = e;
4651
4652
  }
4652
4653
  if (!o) {
4653
- let e = I.find((e) => e.value === p)?.label ?? p, t = n.find((e) => e.value === g)?.label ?? g, r = await s.confirm({ message: `Create ${B.highlight(c)} in ${B.path(d)} with ${B.highlight(e)} config and the ${B.highlight(t)} theme?` });
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?` });
4654
4655
  (s.isCancel(r) || !r) && Z();
4655
4656
  }
4656
- if (await ar(d) && !await or(d)) {
4657
+ if (await q(d) && !await or(d)) {
4657
4658
  let e = await s.confirm({
4658
- message: `Directory ${B.path(d)} is not empty. Continue anyway?`,
4659
+ message: `Directory ${R.path(d)} is not empty. Continue anyway?`,
4659
4660
  initialValue: !1
4660
4661
  });
4661
4662
  (s.isCancel(e) || !e) && Z();
4662
4663
  }
4663
4664
  let _ = s.spinner();
4664
- _.start("Cloning Hype Stack template..."), await to(d), _.stop(B.success("Template cloned"));
4665
+ _.start("Cloning Hype Stack template..."), await no(d), _.stop(R.success("Template cloned"));
4665
4666
  let v = s.spinner();
4666
- v.start("Setting up project..."), await mo(d), await go(d, c), await co(d, p);
4667
+ v.start("Setting up project..."), await ho(d), await _o(d, c), await lo(d, p);
4667
4668
  let y = await jr(d), b = Nr(c, y);
4668
- await Ar(d, b), await Ao(d, {
4669
+ await Ar(d, b), await jo(d, {
4669
4670
  projectName: c,
4670
4671
  editor: p,
4671
4672
  workspace: y
4672
4673
  });
4673
4674
  let x = T.resolve(d, b.paths?.frontend.root ?? "apps/frontend");
4674
- a(g) && (await eo(x, i(g)) || s.log.warn(B.muted(`Could not find ${B.path("assets/styles.css")} to apply the ${g} theme`))), await Ja(x, e.defaultMode === "dark" || e.defaultMode === "light" ? e.defaultMode : "light") || s.log.warn(B.muted(`Could not find ${B.path("src/hooks/use-theme.ts")} to set the default color mode`)), v.stop(B.success("Project configured"));
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"));
4675
4676
  let S = s.spinner();
4676
- S.start("Installing dependencies..."), (await q("pnpm", ["install"], { cwd: d })).exitCode === 0 ? S.stop(B.success("Dependencies installed")) : (S.stop(B.warning("Dependencies installed with warnings")), s.log.warn(B.muted("You may need to run `pnpm install` manually to resolve issues.")));
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.")));
4677
4678
  let C = s.spinner();
4678
- C.start("Initializing git repository..."), await ho(d), C.stop(B.success("Git repository initialized with clean history"));
4679
+ C.start("Initializing git repository..."), await go(d), C.stop(R.success("Git repository initialized with clean history"));
4679
4680
  let w = s.spinner();
4680
4681
  w.start("Creating .env files from examples...");
4681
- let E = await uo(d);
4682
+ let E = await fo(d);
4682
4683
  if (E.length > 0) {
4683
4684
  let e = E.length;
4684
- w.stop(B.success(`Created ${e} .env file${e === 1 ? "" : "s"} from examples`));
4685
- } else w.stop(B.muted("No .env.example files to copy"));
4686
- s.log.success(`${B.brandBold("Hype Stack")} project ${B.highlight(c)} is ready!`);
4687
- let D = T.relative(process.cwd(), d) || ".", O = [`${B.command(`cd ${D}`)}`];
4688
- E.length > 0 ? O.push(`Review your ${B.path(".env")} files and fill in any secrets`) : O.push(`Copy ${B.path(".env.example")} to ${B.path(".env")} and configure`), ca(O);
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);
4689
4690
  let k = e.setup === !1;
4690
- if (e.deferSetup) s.log.info(B.muted("Docker and migrations will run after your packs are installed."));
4691
+ if (e.deferSetup) s.log.info(R.muted("Docker and migrations will run after your packs are installed."));
4691
4692
  else {
4692
4693
  let e = !k && (o || await s.confirm({
4693
4694
  message: "Would you like to start Docker services and run database migrations now?",
4694
4695
  initialValue: !0
4695
4696
  }));
4696
- s.isCancel(e) && Z(), e ? await ya(d, o) : s.log.info(B.muted("Docker and migrations can run later via `npx @hype-stack/cli onboard`.")), Vo();
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();
4697
4698
  }
4698
- return await jo("project_create"), s.outro(B.muted("Happy building!")), d;
4699
+ return await Mo("project_create"), s.outro(R.muted("Happy building!")), d;
4699
4700
  }
4700
4701
  //#endregion
4701
4702
  //#region src/commands/init.ts
4702
- async function es(e) {
4703
+ async function ts(e) {
4703
4704
  let t = e.cwd ?? process.cwd(), n = e.silent ?? !1;
4704
- if (n || (za(), s.intro(B.brandBold("Initialize Hype Stack configuration"))), !await Pr(t)) {
4705
- s.log.error(`This doesn't look like a Hype Stack project. ${B.muted("Expected apps/ directory and package.json")}`), s.outro(B.muted(`Run ${B.command("npx @hype-stack/cli create")} to scaffold a new project.`));
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.`));
4706
4707
  return;
4707
4708
  }
4708
4709
  if (await kr(t)) {
4709
4710
  let e = await Or(t);
4710
4711
  if (e && !n) {
4711
- s.log.info(`Found existing ${B.path("stack.json")} for project ${B.highlight(e.name)}`);
4712
+ s.log.info(`Found existing ${R.path("stack.json")} for project ${R.highlight(e.name)}`);
4712
4713
  let t = await s.confirm({
4713
4714
  message: "Overwrite existing configuration?",
4714
4715
  initialValue: !1
4715
4716
  });
4716
4717
  if (s.isCancel(t) || !t) {
4717
- s.outro(B.muted("Keeping existing configuration."));
4718
+ s.outro(R.muted("Keeping existing configuration."));
4718
4719
  return;
4719
4720
  }
4720
4721
  }
@@ -4723,12 +4724,12 @@ async function es(e) {
4723
4724
  if (!n) {
4724
4725
  let e = Object.entries(r.apps), t = Object.entries(r.packages);
4725
4726
  if (e.length > 0) {
4726
- s.log.info(B.bold("Detected apps:"));
4727
- for (let [t, n] of e) s.log.message(` ${V.arrow} ${B.highlight(t)} ${B.muted(`→ ${n}`)}`);
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}`)}`);
4728
4729
  }
4729
4730
  if (t.length > 0) {
4730
- s.log.info(B.bold("Detected packages:"));
4731
- for (let [e, n] of t) s.log.message(` ${V.arrow} ${B.highlight(e)} ${B.muted(`→ ${n}`)}`);
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}`)}`);
4732
4733
  }
4733
4734
  e.length === 0 && t.length === 0 && s.log.warn("No apps or packages detected in the workspace.");
4734
4735
  }
@@ -4738,21 +4739,21 @@ async function es(e) {
4738
4739
  message: "Project name for stack.json?",
4739
4740
  placeholder: i,
4740
4741
  initialValue: i,
4741
- validate: (e) => Wa(e ?? "")
4742
+ validate: (e) => Ga(e ?? "")
4742
4743
  });
4743
- s.isCancel(e) && Z(), a = Ha(e);
4744
+ s.isCancel(e) && Z(), a = Ua(e);
4744
4745
  }
4745
- await Ar(t, Nr(a, r)), n || (s.log.success(`${B.path("stack.json")} written successfully`), s.outro(B.muted("Your project is mapped and ready for Hype Stack CLI commands.")));
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.")));
4746
4747
  }
4747
- async function ts(e, t = {}, n) {
4748
+ async function ns(e, t = {}, n) {
4748
4749
  if (await kr(e)) return {
4749
4750
  projectRoot: e,
4750
4751
  scaffolded: !1
4751
4752
  };
4752
- let r = t.runInit ?? ((e) => es({
4753
+ let r = t.runInit ?? ((e) => ts({
4753
4754
  cwd: e,
4754
4755
  silent: !0
4755
- })), i = t.runCreate ?? ((e, t) => $o({
4756
+ })), i = t.runCreate ?? ((e, t) => es({
4756
4757
  parentDirectory: e,
4757
4758
  deferSetup: !0,
4758
4759
  skipBanner: !0,
@@ -4760,22 +4761,22 @@ async function ts(e, t = {}, n) {
4760
4761
  defaultMode: t?.defaultMode
4761
4762
  }));
4762
4763
  if (await Pr(e)) {
4763
- s.log.warn(`No ${B.path("stack.json")} found in ${B.path(e)}.`);
4764
+ s.log.warn(`No ${R.path("stack.json")} found in ${R.path(e)}.`);
4764
4765
  let t = await s.confirm({
4765
- message: `Create ${B.path("stack.json")} now?`,
4766
+ message: `Create ${R.path("stack.json")} now?`,
4766
4767
  initialValue: !0
4767
4768
  });
4768
4769
  if (s.isCancel(t) || !t) return null;
4769
4770
  await r(e);
4770
4771
  let n = await kr(e);
4771
- return n && s.log.success(`${B.path("stack.json")} created`), n ? {
4772
+ return n && s.log.success(`${R.path("stack.json")} created`), n ? {
4772
4773
  projectRoot: e,
4773
4774
  scaffolded: !1
4774
4775
  } : null;
4775
4776
  }
4776
- s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${B.path("stack.json")} here.`);
4777
+ s.log.warn(`This doesn't look like a Hype Stack project, and there's no ${R.path("stack.json")} here.`);
4777
4778
  let a = await s.confirm({
4778
- message: `Is ${B.path(e)} where you want to work?`,
4779
+ message: `Is ${R.path(e)} where you want to work?`,
4779
4780
  initialValue: !0
4780
4781
  });
4781
4782
  if (s.isCancel(a) || !a) return null;
@@ -4792,18 +4793,18 @@ async function ts(e, t = {}, n) {
4792
4793
  }
4793
4794
  //#endregion
4794
4795
  //#region src/commands/compose.ts
4795
- async function ns(e = {}) {
4796
+ async function rs(e = {}) {
4796
4797
  let t = e.cwd ?? process.cwd();
4797
- Ra();
4798
- let n = await ts(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4798
+ za();
4799
+ let n = await ns(t), r = n?.projectRoot ?? null, i = n?.scaffolded ?? !1, a;
4799
4800
  try {
4800
4801
  a = await Or(r ?? t);
4801
4802
  } catch (e) {
4802
- s.cancel(`Could not parse ${B.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4803
+ s.cancel(`Could not parse ${R.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
4803
4804
  }
4804
- a || (s.cancel(r ? `Could not read ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli compose' again.` : `No ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli compose'.`), process.exit(1)), a.paths || (s.cancel(`${B.path("stack.json")} is missing ${B.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
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));
4805
4806
  let o = r ?? t;
4806
- s.intro(B.brandBold("Compose your stack"));
4807
+ s.intro(R.brandBold("Compose your stack"));
4807
4808
  let c = s.spinner();
4808
4809
  c.start("Loading packs...");
4809
4810
  let l;
@@ -4813,13 +4814,13 @@ async function ns(e = {}) {
4813
4814
  c.stop("Failed to load packs"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
4814
4815
  }
4815
4816
  c.stop("Packs loaded");
4816
- 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(L()))?.token ?? null, h = await Fo(l, d, {
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, {
4817
4818
  token: m,
4818
4819
  key: p
4819
4820
  }), g = (e) => {
4820
4821
  let t = f.get(e);
4821
4822
  return !t || t.tier === "free" ? "free" : h[e]?.owned ? "owned" : "locked";
4822
- }, _ = (e) => !d.has(e) && g(e) === "locked", v = await rs({
4823
+ }, _ = (e) => !d.has(e) && g(e) === "locked", v = await is({
4823
4824
  packs: l,
4824
4825
  installedSet: d,
4825
4826
  stateOf: g,
@@ -4827,49 +4828,49 @@ async function ns(e = {}) {
4827
4828
  adminAvailable: !!a.apps.admin
4828
4829
  });
4829
4830
  if (v === null && (s.cancel("Cancelled."), process.exit(0)), v.length === 0) {
4830
- s.outro(B.muted("No packs selected. Nothing to do."));
4831
+ s.outro(R.muted("No packs selected. Nothing to do."));
4831
4832
  return;
4832
4833
  }
4833
- let b = os(v), x = ss(v), S = Oa(l, b), C = xa(ka(l, S)), w;
4834
+ let b = ss(v), x = cs(v), S = ka(l, b), C = Sa(Aa(l, S)), w;
4834
4835
  try {
4835
- w = Ca(b, C, u);
4836
+ w = wa(b, C, u);
4836
4837
  } catch (e) {
4837
4838
  s.cancel($(e)), process.exit(1);
4838
4839
  }
4839
4840
  if (w.order.length === 0) {
4840
- s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(B.muted("Your selection is already part of the project."));
4841
+ s.note(`${w.alreadyInstalled.join(", ")} already installed.`, "Nothing to do"), s.outro(R.muted("Your selection is already part of the project."));
4841
4842
  return;
4842
4843
  }
4843
- let T = wa({
4844
+ let T = Ta({
4844
4845
  order: w.order,
4845
4846
  graph: C,
4846
4847
  isLocked: _,
4847
4848
  installed: u
4848
4849
  });
4849
4850
  if (T.blocked.length > 0 && !m && !p) {
4850
- let e = await nr();
4851
- e && (m = e, h = await Fo(l, d, {
4851
+ let e = await rr();
4852
+ e && (m = e, h = await Io(l, d, {
4852
4853
  token: m,
4853
4854
  key: p
4854
- }), T = wa({
4855
+ }), T = Ta({
4855
4856
  order: w.order,
4856
4857
  graph: C,
4857
4858
  isLocked: _,
4858
4859
  installed: u
4859
4860
  }));
4860
4861
  }
4861
- if (T.blocked.length > 0 && await Lo(T.blocked, _, f), T.installable.length === 0) {
4862
- s.outro(B.muted("Nothing left to install once locked packs are removed."));
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."));
4863
4864
  return;
4864
4865
  }
4865
- if (Ro(T.installable, f), !e.yes) {
4866
+ if (zo(T.installable, f), !e.yes) {
4866
4867
  let e = await s.confirm({ message: `Install ${T.installable.length} pack${T.installable.length === 1 ? "" : "s"}?` });
4867
4868
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
4868
4869
  }
4869
4870
  c.start("Downloading packs...");
4870
4871
  let E;
4871
4872
  try {
4872
- E = await zo(T.installable, {
4873
+ E = await Bo(T.installable, {
4873
4874
  token: m,
4874
4875
  key: p
4875
4876
  });
@@ -4877,7 +4878,7 @@ async function ns(e = {}) {
4877
4878
  c.stop("Download failed"), s.cancel($(e)), process.exit(1);
4878
4879
  }
4879
4880
  c.stop(`Downloaded ${E.length} pack${E.length === 1 ? "" : "s"}`);
4880
- let D = await Uo({
4881
+ let D = await Wo({
4881
4882
  prepared: E,
4882
4883
  config: a,
4883
4884
  cwd: o,
@@ -4887,7 +4888,7 @@ async function ns(e = {}) {
4887
4888
  });
4888
4889
  try {
4889
4890
  c.start("Installing pack files...");
4890
- let t = await Zi({
4891
+ let t = await Qi({
4891
4892
  packs: E,
4892
4893
  config: a,
4893
4894
  projectRoot: o,
@@ -4900,22 +4901,22 @@ async function ns(e = {}) {
4900
4901
  for (let e of t.errors) s.log.error(e);
4901
4902
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
4902
4903
  }
4903
- c.stop("Files installed"), t.installed.length > 0 && s.log.success(`${B.highlight(String(t.installed.length))} files installed`), t.skipped.length > 0 && (s.log.warning(`${t.skipped.length} files skipped (use --force to overwrite)`), Ho(t.skipped));
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));
4904
4905
  for (let e of t.errors) s.log.error(e);
4905
- await Bo({
4906
+ await Vo({
4906
4907
  prepared: E,
4907
4908
  paths: a.paths,
4908
4909
  cwd: o,
4909
4910
  spinner: c
4910
4911
  });
4911
4912
  let n;
4912
- i && (n = await ba(o, e.yes ?? !1)), await pr({
4913
+ i && (n = await xa(o, e.yes ?? !1)), await pr({
4913
4914
  projectRoot: o,
4914
4915
  paths: a.paths,
4915
4916
  skipPrompts: e.yes ?? !1,
4916
4917
  dbReady: n,
4917
4918
  freshScaffold: i
4918
- }), Vo(), s.outro(B.brand(`Installed ${t.appliedPacks.join(", ")}.`));
4919
+ }), Ho(), s.outro(R.brand(`Installed ${t.appliedPacks.join(", ")}.`));
4919
4920
  } finally {
4920
4921
  await Promise.all(E.map((e) => y.rm(e.packDir, {
4921
4922
  recursive: !0,
@@ -4923,25 +4924,25 @@ async function ns(e = {}) {
4923
4924
  })));
4924
4925
  }
4925
4926
  }
4926
- async function rs(e) {
4927
+ async function is(e) {
4927
4928
  let { packs: t, installedSet: n, stateOf: r, options: i, adminAvailable: a } = e;
4928
4929
  if (i.packs && i.packs.length > 0) {
4929
- let e = i.packs.map(as), n = e.filter((e) => !t.some((t) => t.name === e.name));
4930
+ let e = i.packs.map(os), n = e.filter((e) => !t.some((t) => t.name === e.name));
4930
4931
  return n.length > 0 && (s.cancel(`Unknown pack${n.length === 1 ? "" : "s"}: ${n.map((e) => e.name).join(", ")}`), process.exit(1)), e;
4931
4932
  }
4932
4933
  let o = t.filter((e) => n.has(e.name));
4933
- o.length > 0 && s.note(o.map((e) => ` ${B.muted("✓")} ${e.displayName}`).join("\n"), "Already Installed");
4934
+ o.length > 0 && s.note(o.map((e) => ` ${R.muted("✓")} ${e.displayName}`).join("\n"), "Already Installed");
4934
4935
  let c = t.filter((e) => !n.has(e.name));
4935
- if (c.length === 0) return s.outro(B.muted("Every available pack is already installed.")), [];
4936
- let l = se();
4937
- s.note(c.map((e) => ` ${V.arrow} ${B.highlight(e.displayName)} ${he(`${l}/packs/${e.name}`)}`).join("\n"), "Browse packs");
4938
- let u = aa(c, { adminAvailable: a }), d = [];
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 = [];
4939
4940
  for (let e of u) {
4940
4941
  let t = e.packs.map((e) => {
4941
4942
  let t = r(e.name);
4942
4943
  return {
4943
4944
  value: e.name,
4944
- label: `${e.displayName} ${Io(t, e.price)}`,
4945
+ label: `${e.displayName} ${Lo(t, e.price)}`,
4945
4946
  hint: e.description
4946
4947
  };
4947
4948
  });
@@ -4958,7 +4959,7 @@ async function rs(e) {
4958
4959
  });
4959
4960
  continue;
4960
4961
  }
4961
- let n = await Va({
4962
+ let n = await Ha({
4962
4963
  message: `Select ${e.label.toLowerCase()} to add (optional)`,
4963
4964
  options: t,
4964
4965
  required: !1
@@ -4968,20 +4969,20 @@ async function rs(e) {
4968
4969
  }
4969
4970
  return d;
4970
4971
  }
4971
- var is = /@(frontend|admin)$/;
4972
- function as(e) {
4973
- let t = e.match(is);
4972
+ var as = /@(frontend|admin)$/;
4973
+ function os(e) {
4974
+ let t = e.match(as);
4974
4975
  return t ? {
4975
4976
  name: e.slice(0, -t[0].length),
4976
4977
  slot: t[1]
4977
4978
  } : { name: e };
4978
4979
  }
4979
- function os(e) {
4980
+ function ss(e) {
4980
4981
  let t = /* @__PURE__ */ new Set(), n = [];
4981
4982
  for (let r of e) t.has(r.name) || (t.add(r.name), n.push(r.name));
4982
4983
  return n;
4983
4984
  }
4984
- function ss(e) {
4985
+ function cs(e) {
4985
4986
  let t = /* @__PURE__ */ new Map();
4986
4987
  for (let n of e) {
4987
4988
  if (!n.slot) continue;
@@ -4992,32 +4993,32 @@ function ss(e) {
4992
4993
  }
4993
4994
  //#endregion
4994
4995
  //#region src/commands/login.ts
4995
- async function cs() {
4996
- za(), s.intro(B.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
4996
+ async function ls() {
4997
+ Ba(), s.intro(R.brandBold("Log in to Hype Stack")), s.log.step("Opening your browser to sign in...");
4997
4998
  let e;
4998
4999
  try {
4999
- e = await tr({ onUrl: (e) => {
5000
- s.log.info(`If your browser didn't open, visit:\n ${B.path(e)}`);
5000
+ e = await nr({ onUrl: (e) => {
5001
+ s.log.info(`If your browser didn't open, visit:\n ${R.path(e)}`);
5001
5002
  } });
5002
5003
  } catch (e) {
5003
5004
  s.cancel(e instanceof Error ? e.message : String(e)), process.exit(1);
5004
5005
  }
5005
- s.outro(B.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."));
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."));
5006
5007
  }
5007
5008
  //#endregion
5008
5009
  //#region src/commands/logout.ts
5009
- async function ls() {
5010
- za(), s.intro(B.brandBold("Log out of Hype Stack"));
5011
- let e = L(), t = await Kn(e);
5010
+ async function us() {
5011
+ Ba(), s.intro(R.brandBold("Log out of Hype Stack"));
5012
+ let e = F(), t = await qn(e);
5012
5013
  if (!t) {
5013
- s.outro(B.muted("You're not logged in."));
5014
+ s.outro(R.muted("You're not logged in."));
5014
5015
  return;
5015
5016
  }
5016
- await Rn(t.token).catch(() => null), await Jn(e), s.outro(B.brand("Logged out."));
5017
+ await zn(t.token).catch(() => null), await Yn(e), s.outro(R.brand("Logged out."));
5017
5018
  }
5018
5019
  //#endregion
5019
5020
  //#region src/core/onboard-env.ts
5020
- function us(e) {
5021
+ function ds(e) {
5021
5022
  let t = [], n = "";
5022
5023
  for (let r of e.split(/\r?\n/)) {
5023
5024
  let e = r.trim();
@@ -5043,19 +5044,19 @@ function us(e) {
5043
5044
  }
5044
5045
  return t;
5045
5046
  }
5046
- var ds = [
5047
+ var fs = [
5047
5048
  "replace-with",
5048
5049
  "examplepublickey",
5049
5050
  "change-me",
5050
5051
  "your-key-here"
5051
5052
  ];
5052
- function fs(e) {
5053
+ function ps(e) {
5053
5054
  let t = e.trim();
5054
5055
  if (t === "") return !0;
5055
5056
  let n = t.toLowerCase();
5056
- return ds.some((e) => n.includes(e));
5057
+ return fs.some((e) => n.includes(e));
5057
5058
  }
5058
- function ps(e, t, n) {
5059
+ function ms(e, t, n) {
5059
5060
  let r = e.split(/\r?\n/), i = !1, a = r.map((e) => {
5060
5061
  if (i) return e;
5061
5062
  let r = e.trim();
@@ -5065,119 +5066,119 @@ function ps(e, t, n) {
5065
5066
  });
5066
5067
  return i ? a.join("\n") : e + `${e.length > 0 && !e.endsWith("\n") ? "\n" : ""}${t}=${n}\n`;
5067
5068
  }
5068
- async function ms(e) {
5069
+ async function hs(e) {
5069
5070
  return await J(e) ? y.readFile(e, "utf-8") : "";
5070
5071
  }
5071
- async function hs(e) {
5072
+ async function gs(e) {
5072
5073
  let t = T.join(T.dirname(e), ".env");
5073
5074
  return await J(t) || await y.copyFile(e, t), t;
5074
5075
  }
5075
- async function gs(e, t, n) {
5076
- let r = ps(await ms(e), t, n);
5076
+ async function _s(e, t, n) {
5077
+ let r = ms(await hs(e), t, n);
5077
5078
  await y.writeFile(e, r, "utf-8");
5078
5079
  }
5079
5080
  //#endregion
5080
5081
  //#region src/commands/onboard.ts
5081
- async function _s(e = {}) {
5082
+ async function vs(e = {}) {
5082
5083
  let t = e.cwd ?? process.cwd();
5083
- Ra(), s.intro(B.brandBold("Onboard your stack"));
5084
+ za(), s.intro(R.brandBold("Onboard your stack"));
5084
5085
  let n;
5085
5086
  try {
5086
5087
  n = await Or(t);
5087
5088
  } catch {
5088
5089
  n = null;
5089
5090
  }
5090
- n || (s.cancel(`${B.path("stack.json")} not found. Run ${B.command("npx @hype-stack/cli init")} first.`), process.exit(1));
5091
- let r = n.installedPacks ?? [], i = n.onboarding?.envSections ?? [], a = await fo(t);
5092
- a.length === 0 && s.log.warn(B.muted("No .env.example files found; skipping env setup."));
5093
- for (let n of a) await vs({
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({
5094
5095
  examplePath: n,
5095
5096
  projectRoot: t,
5096
5097
  skipPrompts: e.yes ?? !1,
5097
5098
  installedEnvSections: i
5098
5099
  });
5099
5100
  let o = Dr(r);
5100
- o.length > 0 && s.note(o.map((e) => ` ${B.muted("·")} ${e}`).join("\n"), "Tips"), e.skipMigrations || await xs(t, e.yes ?? !1), s.outro(B.brand(`All set. Run ${B.command("pnpm dev")} to start your app.`));
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.`));
5101
5102
  }
5102
- async function vs(e) {
5103
- let { examplePath: t, projectRoot: n, skipPrompts: r, installedEnvSections: i } = e, a = T.relative(n, t) || t, o = await hs(t), c = await ms(o), l = us(await y.readFile(t, "utf-8")), u = B.path(a);
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);
5104
5105
  s.log.step(`Env: ${u}`);
5105
5106
  for (let e of l) {
5106
- let t = e.vars.filter((e) => fs(e.value));
5107
+ let t = e.vars.filter((e) => ps(e.value));
5107
5108
  if (t.length === 0) continue;
5108
5109
  if (!Cr(e.section, i)) {
5109
- let t = e.section ? B.bold(e.section) : B.bold("Variables");
5110
- s.log.info(`${t} ${B.muted("skipped (pack not installed)")}`);
5110
+ let t = e.section ? R.bold(e.section) : R.bold("Variables");
5111
+ s.log.info(`${t} ${R.muted("skipped (pack not installed)")}`);
5111
5112
  continue;
5112
5113
  }
5113
- let n = xr(e.section), a = e.section ? B.bold(e.section) : B.bold("Variables");
5114
- s.log.step(a), n.link && (s.log.info(`${B.muted("Get your values:")} ${he(n.link)}`), n.serviceChecklist && n.serviceChecklist.length > 0 && s.note(n.serviceChecklist.map((e) => ` ${B.muted("·")} ${e}`).join("\n"), "Setup")), s.log.info(B.muted(n.hint));
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));
5115
5116
  for (let e of t) {
5116
5117
  if (r) {
5117
- s.log.info(`${B.label(e.key)} ${B.muted("skipped (non-interactive)")}`);
5118
+ s.log.info(`${R.label(e.key)} ${R.muted("skipped (non-interactive)")}`);
5118
5119
  continue;
5119
5120
  }
5120
- let t = ys(c, e.key), i = await s.text({
5121
- message: `${B.label(e.key)}`,
5121
+ let t = bs(c, e.key), i = await s.text({
5122
+ message: `${R.label(e.key)}`,
5122
5123
  placeholder: t || n.hint
5123
5124
  });
5124
5125
  s.isCancel(i) && Z();
5125
5126
  let a = (i ?? "").trim();
5126
5127
  if (a === "") {
5127
- s.log.warn(B.muted(`${e.key} left blank.`));
5128
+ s.log.warn(R.muted(`${e.key} left blank.`));
5128
5129
  continue;
5129
5130
  }
5130
- await gs(o, e.key, a), s.log.success(`${e.key} saved`);
5131
+ await _s(o, e.key, a), s.log.success(`${e.key} saved`);
5131
5132
  }
5132
5133
  }
5133
5134
  }
5134
- function ys(e, t) {
5135
+ function bs(e, t) {
5135
5136
  for (let n of e.split(/\r?\n/)) {
5136
- let e = n.match(RegExp(`^${bs(t)}\\s*=\\s*(.*)$`));
5137
+ let e = n.match(RegExp(`^${xs(t)}\\s*=\\s*(.*)$`));
5137
5138
  if (e) return e[1].trim();
5138
5139
  }
5139
5140
  return "";
5140
5141
  }
5141
- function bs(e) {
5142
+ function xs(e) {
5142
5143
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5143
5144
  }
5144
- async function xs(e, t) {
5145
- if (!await la() && !await da(e, t, !1)) {
5146
- s.log.info(B.muted(`Start services later with ${B.command("docker compose up -d")} (in apps/backend), then ${B.command("pnpm --filter @internal/backend migration:latest")}.`));
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")}.`));
5147
5148
  return;
5148
5149
  }
5149
5150
  let n = s.spinner();
5150
- if (n.start("Waiting for Postgres to be ready..."), !await pa(e)) {
5151
- n.error("Postgres health check timed out"), s.log.warn(B.muted(`Run migrations manually once Postgres is ready: ${B.command("pnpm --filter @internal/backend migration:latest")}`));
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")}`));
5152
5153
  return;
5153
5154
  }
5154
- if (n.stop(B.success("Postgres is ready")), await ha(e)) {
5155
- s.log.info(B.muted("Migrations already applied, skipping."));
5155
+ if (n.stop(R.success("Postgres is ready")), await ga(e)) {
5156
+ s.log.info(R.muted("Migrations already applied, skipping."));
5156
5157
  return;
5157
5158
  }
5158
5159
  let r = t ? !0 : await s.confirm({
5159
- message: `Run database migrations with ${B.command("prisma migrate deploy")}?`,
5160
+ message: `Run database migrations with ${R.command("prisma migrate deploy")}?`,
5160
5161
  initialValue: !0
5161
5162
  });
5162
5163
  if (s.isCancel(r) && Z(), !r) {
5163
- s.log.info(B.muted("Skipping database migrations."));
5164
+ s.log.info(R.muted("Skipping database migrations."));
5164
5165
  return;
5165
5166
  }
5166
- await ga(e);
5167
+ await _a(e);
5167
5168
  }
5168
5169
  //#endregion
5169
5170
  //#region src/core/templates.ts
5170
- var Ss = K.createRequest()({
5171
+ var Cs = G.createRequest()({
5171
5172
  endpoint: "/templates/list",
5172
5173
  method: "GET"
5173
5174
  });
5174
- async function Cs() {
5175
- let { data: e, error: t } = await Ss.send();
5175
+ async function ws() {
5176
+ let { data: e, error: t } = await Cs.send();
5176
5177
  if (t || !e) throw Error(`Failed to fetch template list: ${String(t)}`);
5177
5178
  return e.templates;
5178
5179
  }
5179
- async function ws(e) {
5180
- let { data: t, error: n, status: r } = await K.createRequest()({
5180
+ async function Ts(e) {
5181
+ let { data: t, error: n, status: r } = await G.createRequest()({
5181
5182
  endpoint: `/templates/${encodeURIComponent(e)}/manifest`,
5182
5183
  method: "GET"
5183
5184
  }).send();
@@ -5185,13 +5186,13 @@ async function ws(e) {
5185
5186
  if (n || !t) throw Error(`Failed to load manifest for template "${e}": ${String(n)}`);
5186
5187
  return t;
5187
5188
  }
5188
- async function Ts(e, t = {}) {
5189
- let n = K.createRequest()({
5189
+ async function Es(e, t = {}) {
5190
+ let n = G.createRequest()({
5190
5191
  endpoint: `/templates/${encodeURIComponent(e)}/download`,
5191
5192
  method: "POST"
5192
5193
  }), r = {
5193
- "X-Device-Id": Xn(),
5194
- "X-Client-Info": Zn()
5194
+ "X-Device-Id": Zn(),
5195
+ "X-Client-Info": Qn()
5195
5196
  };
5196
5197
  t.token && (r.Authorization = `Bearer ${t.token}`);
5197
5198
  let { data: i, error: a, success: o } = await n.setPayload({ key: t.licenseKey ?? void 0 }).setHeaders(r).send();
@@ -5213,9 +5214,9 @@ async function Ts(e, t = {}) {
5213
5214
  }
5214
5215
  //#endregion
5215
5216
  //#region src/commands/template.ts
5216
- async function Es(t = {}) {
5217
+ async function Ds(t = {}) {
5217
5218
  let n = t.cwd ?? process.cwd();
5218
- Ra();
5219
+ za();
5219
5220
  let r = s.spinner();
5220
5221
  r.start("Loading packs...");
5221
5222
  let o;
@@ -5227,15 +5228,15 @@ async function Es(t = {}) {
5227
5228
  r.stop("Packs loaded"), r.start("Loading templates...");
5228
5229
  let c;
5229
5230
  try {
5230
- c = await Cs();
5231
+ c = await ws();
5231
5232
  } catch (e) {
5232
5233
  r.stop("Failed to load templates"), s.cancel(`Could not reach Hype Stack. Check your connection and try again.\n${$(e)}`), process.exit(1);
5233
5234
  }
5234
5235
  let l = t.templateId;
5235
5236
  if (!l) {
5236
5237
  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");
5237
- let e = se();
5238
- s.note(c.map((t) => ` ${V.arrow} ${B.highlight(t.name)} ${he(`${e}/templates/${t.id}`)}`).join("\n"), "Browse templates");
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");
5239
5240
  let n = await s.select({
5240
5241
  message: "Choose a template",
5241
5242
  options: c.map((e) => ({
@@ -5250,151 +5251,151 @@ async function Es(t = {}) {
5250
5251
  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}`);
5251
5252
  let d;
5252
5253
  try {
5253
- d = await ws(u.id);
5254
+ d = await Ts(u.id);
5254
5255
  } catch (e) {
5255
5256
  s.cancel($(e)), process.exit(1);
5256
5257
  }
5257
- let f = await ts(n, {}, {
5258
+ let f = await ns(n, {}, {
5258
5259
  defaultTheme: d.theme,
5259
5260
  defaultMode: d.defaultMode
5260
5261
  }), p = f?.projectRoot ?? null, m = f?.scaffolded ?? !1, h;
5261
5262
  try {
5262
5263
  h = await Or(p ?? n);
5263
5264
  } catch (e) {
5264
- s.cancel(`Could not parse ${B.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5265
+ s.cancel(`Could not parse ${R.path("stack.json")}: ${$(e)} Run 'npx @hype-stack/cli init' to regenerate it.`), process.exit(1);
5265
5266
  }
5266
- h || (s.cancel(p ? `Could not read ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' to regenerate it, then run 'npx @hype-stack/cli template' again.` : `No ${B.path("stack.json")}. Run 'npx @hype-stack/cli init' first, then 'npx @hype-stack/cli template'.`), process.exit(1)), h.paths || (s.cancel(`${B.path("stack.json")} is missing ${B.path("paths")}. Run 'npx @hype-stack/cli init' again to regenerate it.`), process.exit(1));
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));
5267
5268
  let g = p ?? n;
5268
- s.intro(B.brandBold("Install a template"));
5269
- let _ = h.installedPacks ?? [], v = new Set(_), b = new Map(o.map((e) => [e.name, e])), x = t.licenseKey ?? h.licenseKey ?? null, S = (await Kn(L()))?.token ?? null, C = await Ds(u, t.variants, t.yes ?? !1), w = Ta(u.slots, C), E = Ea(u.slots, u.packs, w), D = await Os({
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({
5270
5271
  packs: o,
5271
5272
  templatePacks: E,
5272
5273
  installedSet: v,
5273
5274
  options: t
5274
5275
  }), O = [...E, ...D.filter((e) => !E.includes(e))], k = O.filter((e) => !b.has(e));
5275
5276
  k.length > 0 && (s.cancel(`Unknown pack${k.length === 1 ? "" : "s"}: ${k.join(", ")}`), process.exit(1));
5276
- let ee = ka(o, w), A = xa(ee), j;
5277
+ let ee = Aa(o, w), A = Sa(ee), te;
5277
5278
  try {
5278
- j = Ca(O, A, _);
5279
+ te = wa(O, A, _);
5279
5280
  } catch (e) {
5280
5281
  s.cancel($(e)), process.exit(1);
5281
5282
  }
5282
- if (j.order.length === 0) {
5283
- s.outro(B.muted("Every pack in this template is already installed."));
5283
+ if (te.order.length === 0) {
5284
+ s.outro(R.muted("Every pack in this template is already installed."));
5284
5285
  return;
5285
5286
  }
5286
- let M = await Fo(ee, v, {
5287
+ let ne = await Io(ee, v, {
5287
5288
  token: S,
5288
5289
  key: x
5289
- }), te = (e) => {
5290
+ }), re = (e) => {
5290
5291
  let t = b.get(e);
5291
- return !t || t.tier === "free" ? "free" : M[e]?.owned ? "owned" : "locked";
5292
- }, N = (e) => !v.has(e) && te(e) === "locked", P = wa({
5293
- order: j.order,
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,
5294
5295
  graph: A,
5295
- isLocked: N,
5296
+ isLocked: j,
5296
5297
  installed: _
5297
5298
  });
5298
- if (P.blocked.length > 0 && !S && !x) {
5299
- let e = await nr();
5300
- e && (S = e, M = await Fo(ee, v, {
5299
+ if (M.blocked.length > 0 && !S && !x) {
5300
+ let e = await rr();
5301
+ e && (S = e, ne = await Io(ee, v, {
5301
5302
  token: S,
5302
5303
  key: x
5303
- }), P = wa({
5304
- order: j.order,
5304
+ }), M = Ta({
5305
+ order: te.order,
5305
5306
  graph: A,
5306
- isLocked: N,
5307
+ isLocked: j,
5307
5308
  installed: _
5308
5309
  }));
5309
5310
  }
5310
- if (P.blocked.length > 0 && await Lo(P.blocked, N, b), P.installable.length === 0) {
5311
- s.outro(B.muted("Nothing left to install once locked packs are removed."));
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."));
5312
5313
  return;
5313
5314
  }
5314
- if (Ro(P.installable, b), !t.yes) {
5315
- let e = await s.confirm({ message: `Install template ${B.brandBold(u.name)} (${P.installable.length} pack${P.installable.length === 1 ? "" : "s"})?` });
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"})?` });
5316
5317
  (s.isCancel(e) || !e) && (s.cancel("Installation cancelled."), process.exit(0));
5317
5318
  }
5318
5319
  r.start("Downloading packs...");
5319
- let F;
5320
+ let N;
5320
5321
  try {
5321
- F = await zo(P.installable, {
5322
+ N = await Bo(M.installable, {
5322
5323
  token: S,
5323
5324
  key: x
5324
5325
  });
5325
5326
  } catch (e) {
5326
5327
  r.stop("Download failed"), s.cancel($(e)), process.exit(1);
5327
5328
  }
5328
- r.stop(`Downloaded ${F.length} pack${F.length === 1 ? "" : "s"}`);
5329
- let ne = await Uo({
5330
- prepared: F,
5329
+ r.stop(`Downloaded ${N.length} pack${N.length === 1 ? "" : "s"}`);
5330
+ let ie = await Wo({
5331
+ prepared: N,
5331
5332
  config: h,
5332
5333
  cwd: g,
5333
5334
  force: t.force ?? !1,
5334
5335
  yes: t.yes ?? !1
5335
- }), I = null;
5336
+ }), P = null;
5336
5337
  try {
5337
5338
  r.start("Installing pack files...");
5338
- let n = await Zi({
5339
- packs: F,
5339
+ let n = await Qi({
5340
+ packs: N,
5340
5341
  config: h,
5341
5342
  projectRoot: g,
5342
5343
  force: t.force ?? !1,
5343
- overwrite: ne
5344
+ overwrite: ie
5344
5345
  });
5345
5346
  if (n.aborted) {
5346
5347
  r.stop("Installation aborted");
5347
5348
  for (let e of n.errors) s.log.error(e);
5348
5349
  s.cancel("No files were written. Fix the errors above (or pass --force for existing files) and try again."), process.exit(1);
5349
5350
  }
5350
- r.stop("Files installed"), n.installed.length > 0 && s.log.success(`${B.highlight(String(n.installed.length))} files installed`), n.skipped.length > 0 && (s.log.warning(`${n.skipped.length} files skipped (use --force to overwrite)`), Ho(n.skipped));
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));
5351
5352
  for (let e of n.errors) s.log.error(e);
5352
5353
  r.start("Applying template overrides...");
5353
- let o = await Ts(u.id, {
5354
+ let o = await Es(u.id, {
5354
5355
  token: S,
5355
5356
  licenseKey: x
5356
5357
  });
5357
- 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)), I = o.templateDir;
5358
- let c = await $i({
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({
5359
5360
  manifest: d,
5360
5361
  config: h,
5361
5362
  projectRoot: g,
5362
- templateDir: I
5363
+ templateDir: P
5363
5364
  });
5364
5365
  r.stop("Template overrides applied"), c.installed.length > 0 && s.log.success(`${c.installed.length} template file${c.installed.length === 1 ? "" : "s"} applied`);
5365
5366
  for (let e of c.errors) s.log.error(e);
5366
5367
  if (!m) {
5367
5368
  let t = T.resolve(g, h.paths?.frontend.root ?? "apps/frontend"), n = d.theme ?? "zinc-mono";
5368
- a(n) && (await eo(t, i(n)) ? s.log.success(`Applied the ${i(n).label} theme`) : s.log.warning(B.muted(`Could not find ${B.path("assets/styles.css")} to apply the theme`)));
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`)));
5369
5370
  let r = d.defaultMode === "dark" || d.defaultMode === "light" ? d.defaultMode : e;
5370
- await Ja(t, r) ? s.log.success(`Default color mode set to ${r}`) : s.log.warning(B.muted(`Could not find ${B.path("src/hooks/use-theme.ts")} to set the default color mode`));
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`));
5371
5372
  }
5372
- await ks({
5373
- prepared: F,
5373
+ await As({
5374
+ prepared: N,
5374
5375
  templateNpm: d.dependencies_npm,
5375
5376
  paths: h.paths,
5376
5377
  cwd: g,
5377
5378
  spinner: r
5378
5379
  });
5379
5380
  let l;
5380
- m && (l = await ba(g, t.yes ?? !1)), await pr({
5381
+ m && (l = await xa(g, t.yes ?? !1)), await pr({
5381
5382
  projectRoot: g,
5382
5383
  paths: h.paths,
5383
5384
  skipPrompts: t.yes ?? !1,
5384
5385
  dbReady: l,
5385
5386
  freshScaffold: m
5386
- }), Vo(), s.outro(B.brand(`Installed template ${u.name}.`));
5387
+ }), Ho(), s.outro(R.brand(`Installed template ${u.name}.`));
5387
5388
  } finally {
5388
- await Promise.all(F.map((e) => y.rm(e.packDir, {
5389
+ await Promise.all(N.map((e) => y.rm(e.packDir, {
5389
5390
  recursive: !0,
5390
5391
  force: !0
5391
- }))), I && await y.rm(I, {
5392
+ }))), P && await y.rm(P, {
5392
5393
  recursive: !0,
5393
5394
  force: !0
5394
5395
  });
5395
5396
  }
5396
5397
  }
5397
- async function Ds(e, t, n) {
5398
+ async function Os(e, t, n) {
5398
5399
  let r = {};
5399
5400
  for (let i of e.slots) {
5400
5401
  if (t?.[i.family]) {
@@ -5418,7 +5419,7 @@ async function Ds(e, t, n) {
5418
5419
  }
5419
5420
  return r;
5420
5421
  }
5421
- async function Os(e) {
5422
+ async function ks(e) {
5422
5423
  let { packs: t, templatePacks: n, installedSet: r, options: i } = e, a = new Set(n);
5423
5424
  if (i.packs && i.packs.length > 0) {
5424
5425
  let e = i.packs.filter((e) => !t.some((t) => t.name === e));
@@ -5427,9 +5428,9 @@ async function Os(e) {
5427
5428
  if (i.yes) return [];
5428
5429
  let o = t.filter((e) => e.category === "feature" && !a.has(e.name) && !r.has(e.name));
5429
5430
  if (o.length === 0) return [];
5430
- let c = se();
5431
- s.note(o.map((e) => ` ${V.arrow} ${B.highlight(e.displayName)} ${he(`${c}/packs/${e.name}`)}`).join("\n"), "Browse packs");
5432
- let l = await Va({
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({
5433
5434
  message: "Add extra packs on top of the template (optional)",
5434
5435
  options: o.map((e) => ({
5435
5436
  value: e.name,
@@ -5440,25 +5441,25 @@ async function Os(e) {
5440
5441
  });
5441
5442
  return m(l) && (s.cancel("Cancelled."), process.exit(0)), l;
5442
5443
  }
5443
- async function ks(e) {
5444
- let { prepared: t, templateNpm: n, paths: r, cwd: i, spinner: a } = e, o = No(t.map((e) => e.manifest.dependencies_npm)), c = Mo(n ? No([o, n]) : o, r);
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);
5445
5446
  if (c.errors.length > 0) {
5446
5447
  for (let e of c.errors) s.log.error(e);
5447
5448
  return;
5448
5449
  }
5449
5450
  if (c.operations.length === 0) return;
5450
5451
  a.start("Installing npm dependencies...");
5451
- let l = await Po(c.operations, i);
5452
+ let l = await Fo(c.operations, i);
5452
5453
  if (a.stop(l.ok ? "npm dependencies installed" : "npm dependency installation failed"), !l.ok) for (let e of l.errors) s.log.error(e);
5453
5454
  }
5454
5455
  //#endregion
5455
5456
  //#region src/cli.ts
5456
- function As(e) {
5457
+ function js(e) {
5457
5458
  if (!e) return;
5458
5459
  let t = e.split(",").map((e) => e.trim()).filter((e) => e.length > 0);
5459
5460
  return t.length > 0 ? t : void 0;
5460
5461
  }
5461
- function js(e) {
5462
+ function Ms(e) {
5462
5463
  if (!e) return;
5463
5464
  let t = {};
5464
5465
  for (let n of e.split(",")) {
@@ -5467,10 +5468,10 @@ function js(e) {
5467
5468
  }
5468
5469
  return Object.keys(t).length > 0 ? t : void 0;
5469
5470
  }
5470
- function Ms() {
5471
+ function Ns() {
5471
5472
  let e = new o();
5472
5473
  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) => {
5473
- await $o({
5474
+ await es({
5474
5475
  name: e.name,
5475
5476
  directory: e.directory,
5476
5477
  install: e.install,
@@ -5480,38 +5481,38 @@ function Ms() {
5480
5481
  setup: e.setup
5481
5482
  });
5482
5483
  }), e.command("init").description("Initialize stack.json in the current project").action(async () => {
5483
- await es({});
5484
+ await ts({});
5484
5485
  }), 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) => {
5485
- await _s({
5486
+ await vs({
5486
5487
  cwd: e.cwd,
5487
5488
  yes: e.yes,
5488
5489
  skipMigrations: e.skipMigrations
5489
5490
  });
5490
5491
  }), 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) => {
5491
- await ns({
5492
- packs: As(e.packs),
5492
+ await rs({
5493
+ packs: js(e.packs),
5493
5494
  force: e.force,
5494
5495
  yes: e.yes,
5495
5496
  licenseKey: e.key ?? e.licenseKey,
5496
5497
  cwd: e.cwd
5497
5498
  });
5498
5499
  }), 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) => {
5499
- await Es({
5500
+ await Ds({
5500
5501
  templateId: e,
5501
- variants: js(t.variants),
5502
- packs: As(t.packs),
5502
+ variants: Ms(t.variants),
5503
+ packs: js(t.packs),
5503
5504
  force: t.force,
5504
5505
  yes: t.yes,
5505
5506
  licenseKey: t.key ?? t.licenseKey,
5506
5507
  cwd: t.cwd
5507
5508
  });
5508
5509
  }), e.command("login").description("Log in via your browser to install packs your organization owns").action(async () => {
5509
- await cs();
5510
- }), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
5511
5510
  await ls();
5511
+ }), e.command("logout").description("Log out and remove the saved CLI token").action(async () => {
5512
+ await us();
5512
5513
  }), e.command("auth").description("Alias for `login`").action(async () => {
5513
- await cs();
5514
+ await ls();
5514
5515
  }), e;
5515
5516
  }
5516
5517
  //#endregion
5517
- export { ts as a, ns as i, ls as n, es as o, cs as r, $o as s, Ms as t };
5518
+ export { ns as a, rs as i, us as n, ts as o, ls as r, es as s, Ns as t };