@hype-stack/cli 0.5.9 → 0.5.10

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