@hype-stack/cli 0.5.12 → 0.5.14

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