@dreamboard-games/cli 0.1.30-alpha.2 → 0.1.30-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/agent-verifier/agent-workspace-verifier.mjs +227 -0
  2. package/dist/agent-verifier/agent-workspace-verifier.mjs.map +1 -0
  3. package/dist/agent-verifier/chunk-27EEIZCI.mjs +185 -0
  4. package/dist/agent-verifier/chunk-27EEIZCI.mjs.map +1 -0
  5. package/dist/agent-verifier/chunk-5NYBTZB4.mjs +226 -0
  6. package/dist/agent-verifier/chunk-5NYBTZB4.mjs.map +1 -0
  7. package/dist/agent-verifier/chunk-776W3UGV.mjs +167 -0
  8. package/dist/agent-verifier/chunk-776W3UGV.mjs.map +1 -0
  9. package/dist/agent-verifier/chunk-C3VW3DTA.mjs +2909 -0
  10. package/dist/agent-verifier/chunk-C3VW3DTA.mjs.map +1 -0
  11. package/dist/agent-verifier/chunk-F2DIOJJZ.mjs +302 -0
  12. package/dist/agent-verifier/chunk-F2DIOJJZ.mjs.map +1 -0
  13. package/dist/agent-verifier/chunk-G42BGGG2.mjs +70 -0
  14. package/dist/agent-verifier/chunk-G42BGGG2.mjs.map +1 -0
  15. package/dist/agent-verifier/chunk-H6XDQJ3N.mjs +11 -0
  16. package/dist/agent-verifier/chunk-H76MT5UR.mjs +57 -0
  17. package/dist/agent-verifier/chunk-H76MT5UR.mjs.map +1 -0
  18. package/dist/agent-verifier/chunk-IAYRNVUC.mjs +49 -0
  19. package/dist/agent-verifier/chunk-IAYRNVUC.mjs.map +1 -0
  20. package/dist/agent-verifier/chunk-IDVQXGAO.mjs +222 -0
  21. package/dist/agent-verifier/chunk-IDVQXGAO.mjs.map +1 -0
  22. package/dist/agent-verifier/chunk-JO5AMVZU.mjs +1744 -0
  23. package/dist/agent-verifier/chunk-JO5AMVZU.mjs.map +1 -0
  24. package/dist/agent-verifier/chunk-JZTH3EMV.mjs +14523 -0
  25. package/dist/agent-verifier/chunk-JZTH3EMV.mjs.map +1 -0
  26. package/dist/agent-verifier/chunk-KDBSVLCF.mjs +624 -0
  27. package/dist/agent-verifier/chunk-KDBSVLCF.mjs.map +1 -0
  28. package/dist/agent-verifier/chunk-MW2QIWWA.mjs +729 -0
  29. package/dist/agent-verifier/chunk-MW2QIWWA.mjs.map +1 -0
  30. package/dist/agent-verifier/chunk-NAK77WXW.mjs +767 -0
  31. package/dist/agent-verifier/chunk-NAK77WXW.mjs.map +1 -0
  32. package/dist/agent-verifier/chunk-ON62IGWK.mjs +3137 -0
  33. package/dist/agent-verifier/chunk-ON62IGWK.mjs.map +1 -0
  34. package/dist/agent-verifier/chunk-QBAF7EYR.mjs +214 -0
  35. package/dist/agent-verifier/chunk-QBAF7EYR.mjs.map +1 -0
  36. package/dist/agent-verifier/chunk-QZH6IEZS.mjs +39 -0
  37. package/dist/agent-verifier/chunk-QZH6IEZS.mjs.map +1 -0
  38. package/dist/agent-verifier/chunk-TAEQKBJB.mjs +107 -0
  39. package/dist/agent-verifier/chunk-TAEQKBJB.mjs.map +1 -0
  40. package/dist/agent-verifier/chunk-UIOLGH4A.mjs +150 -0
  41. package/dist/agent-verifier/chunk-UIOLGH4A.mjs.map +1 -0
  42. package/dist/agent-verifier/chunk-XKCJBIRY.mjs +75 -0
  43. package/dist/agent-verifier/chunk-XKCJBIRY.mjs.map +1 -0
  44. package/dist/agent-verifier/chunk-XQXDOBYB.mjs +382 -0
  45. package/dist/agent-verifier/chunk-XQXDOBYB.mjs.map +1 -0
  46. package/dist/agent-verifier/chunk-YDIOW2BO.mjs +45 -0
  47. package/dist/agent-verifier/chunk-YDIOW2BO.mjs.map +1 -0
  48. package/dist/agent-verifier/chunk-YE7UAO3T.mjs +129 -0
  49. package/dist/agent-verifier/chunk-YE7UAO3T.mjs.map +1 -0
  50. package/dist/agent-verifier/chunk-Z6OZWUIZ.mjs +261 -0
  51. package/dist/agent-verifier/chunk-Z6OZWUIZ.mjs.map +1 -0
  52. package/dist/agent-verifier/chunk-ZEELHSY3.mjs +20 -0
  53. package/dist/agent-verifier/chunk-ZEELHSY3.mjs.map +1 -0
  54. package/dist/agent-verifier/compile-576O7TYP.mjs +312 -0
  55. package/dist/agent-verifier/compile-576O7TYP.mjs.map +1 -0
  56. package/dist/agent-verifier/global-config-NYCSCAUI.mjs +18 -0
  57. package/dist/agent-verifier/keychain-backend-A3MRWLPF.mjs +135 -0
  58. package/dist/agent-verifier/keychain-backend-A3MRWLPF.mjs.map +1 -0
  59. package/dist/agent-verifier/local-files-QVJ2H3MH.mjs +45 -0
  60. package/dist/agent-verifier/local-files-QVJ2H3MH.mjs.map +1 -0
  61. package/dist/agent-verifier/local-typecheck-2JWG5IGL.mjs +10 -0
  62. package/dist/agent-verifier/local-typecheck-2JWG5IGL.mjs.map +1 -0
  63. package/dist/agent-verifier/materialize-workspace-OZKOQCSQ.mjs +89 -0
  64. package/dist/agent-verifier/materialize-workspace-OZKOQCSQ.mjs.map +1 -0
  65. package/dist/agent-verifier/project-state-XKUSCFSV.mjs +33 -0
  66. package/dist/agent-verifier/project-state-XKUSCFSV.mjs.map +1 -0
  67. package/dist/agent-verifier/prompt-VKHMCQT6.mjs +756 -0
  68. package/dist/agent-verifier/prompt-VKHMCQT6.mjs.map +1 -0
  69. package/dist/agent-verifier/reducer-bundle-preflight-7NYZF5ZT.mjs +20 -0
  70. package/dist/agent-verifier/reducer-bundle-preflight-7NYZF5ZT.mjs.map +1 -0
  71. package/dist/agent-verifier/reducer-contract-preflight-COD2CO22.mjs +11 -0
  72. package/dist/agent-verifier/reducer-contract-preflight-COD2CO22.mjs.map +1 -0
  73. package/dist/agent-verifier/reducer-native-test-harness-QC7HZUK4.mjs +50 -0
  74. package/dist/agent-verifier/reducer-native-test-harness-QC7HZUK4.mjs.map +1 -0
  75. package/dist/agent-verifier/static-scaffold-JBUE3ROP.mjs +27 -0
  76. package/dist/agent-verifier/static-scaffold-JBUE3ROP.mjs.map +1 -0
  77. package/dist/agent-verifier/sync-C6S3OGCD.mjs +588 -0
  78. package/dist/agent-verifier/sync-C6S3OGCD.mjs.map +1 -0
  79. package/dist/agent-verifier/test-Y5UGQV7J.mjs +353 -0
  80. package/dist/agent-verifier/test-Y5UGQV7J.mjs.map +1 -0
  81. package/dist/agent-verifier/workspace-codegen-WPZHMATU.mjs +10 -0
  82. package/dist/agent-verifier/workspace-codegen-WPZHMATU.mjs.map +1 -0
  83. package/dist/agent-verifier/workspace-dependencies-B6A2ZX55.mjs +15 -0
  84. package/dist/agent-verifier/workspace-dependencies-B6A2ZX55.mjs.map +1 -0
  85. package/dist/chunk-2H7UOFLK.js +11 -0
  86. package/dist/chunk-2H7UOFLK.js.map +1 -0
  87. package/dist/{chunk-N7XPNNUI.js → chunk-3NRROR4P.js} +3 -3
  88. package/dist/{chunk-TAQKH67O.js → chunk-M4SCKH5M.js} +8 -2224
  89. package/dist/chunk-M4SCKH5M.js.map +1 -0
  90. package/dist/{global-config-S4ZIPECE.js → global-config-YBFEGJQG.js} +3 -3
  91. package/dist/global-config-YBFEGJQG.js.map +1 -0
  92. package/dist/index.js +4 -4
  93. package/dist/internal.js +3 -3
  94. package/dist/{keychain-backend-HDF4TZDL.js → keychain-backend-JHTXAKWC.js} +2 -2
  95. package/dist/{prompt-NDV3AE5L.js → prompt-GMZABCJC.js} +2 -2
  96. package/package.json +3 -2
  97. package/dist/chunk-SEGVTWSK.js +0 -44
  98. package/dist/chunk-TAQKH67O.js.map +0 -1
  99. /package/dist/{chunk-SEGVTWSK.js.map → agent-verifier/chunk-H6XDQJ3N.mjs.map} +0 -0
  100. /package/dist/{global-config-S4ZIPECE.js.map → agent-verifier/global-config-NYCSCAUI.mjs.map} +0 -0
  101. /package/dist/{chunk-N7XPNNUI.js.map → chunk-3NRROR4P.js.map} +0 -0
  102. /package/dist/{keychain-backend-HDF4TZDL.js.map → keychain-backend-JHTXAKWC.js.map} +0 -0
  103. /package/dist/{prompt-NDV3AE5L.js.map → prompt-GMZABCJC.js.map} +0 -0
@@ -0,0 +1,1744 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ getStoredSession,
4
+ loadGlobalConfig,
5
+ setCredentials
6
+ } from "./chunk-5NYBTZB4.mjs";
7
+ import {
8
+ IS_PUBLISHED_BUILD,
9
+ PUBLISHED_ENVIRONMENT,
10
+ findProjectRoot,
11
+ loadProjectConfig
12
+ } from "./chunk-776W3UGV.mjs";
13
+ import {
14
+ client
15
+ } from "./chunk-NAK77WXW.mjs";
16
+ import {
17
+ readJsonFile,
18
+ readTextFileIfExists
19
+ } from "./chunk-IAYRNVUC.mjs";
20
+ import {
21
+ DEFAULT_API_BASE_URL,
22
+ DEFAULT_WEB_BASE_URL,
23
+ ENVIRONMENT_CONFIGS
24
+ } from "./chunk-H76MT5UR.mjs";
25
+
26
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
27
+ var LogLevels = {
28
+ silent: Number.NEGATIVE_INFINITY,
29
+ fatal: 0,
30
+ error: 0,
31
+ warn: 1,
32
+ log: 2,
33
+ info: 3,
34
+ success: 3,
35
+ fail: 3,
36
+ ready: 3,
37
+ start: 3,
38
+ box: 3,
39
+ debug: 4,
40
+ trace: 5,
41
+ verbose: Number.POSITIVE_INFINITY
42
+ };
43
+ var LogTypes = {
44
+ // Silent
45
+ silent: {
46
+ level: -1
47
+ },
48
+ // Level 0
49
+ fatal: {
50
+ level: LogLevels.fatal
51
+ },
52
+ error: {
53
+ level: LogLevels.error
54
+ },
55
+ // Level 1
56
+ warn: {
57
+ level: LogLevels.warn
58
+ },
59
+ // Level 2
60
+ log: {
61
+ level: LogLevels.log
62
+ },
63
+ // Level 3
64
+ info: {
65
+ level: LogLevels.info
66
+ },
67
+ success: {
68
+ level: LogLevels.success
69
+ },
70
+ fail: {
71
+ level: LogLevels.fail
72
+ },
73
+ ready: {
74
+ level: LogLevels.info
75
+ },
76
+ start: {
77
+ level: LogLevels.info
78
+ },
79
+ box: {
80
+ level: LogLevels.info
81
+ },
82
+ // Level 4
83
+ debug: {
84
+ level: LogLevels.debug
85
+ },
86
+ // Level 5
87
+ trace: {
88
+ level: LogLevels.trace
89
+ },
90
+ // Verbose
91
+ verbose: {
92
+ level: LogLevels.verbose
93
+ }
94
+ };
95
+ function isPlainObject$1(value) {
96
+ if (value === null || typeof value !== "object") {
97
+ return false;
98
+ }
99
+ const prototype = Object.getPrototypeOf(value);
100
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
101
+ return false;
102
+ }
103
+ if (Symbol.iterator in value) {
104
+ return false;
105
+ }
106
+ if (Symbol.toStringTag in value) {
107
+ return Object.prototype.toString.call(value) === "[object Module]";
108
+ }
109
+ return true;
110
+ }
111
+ function _defu(baseObject, defaults, namespace = ".", merger) {
112
+ if (!isPlainObject$1(defaults)) {
113
+ return _defu(baseObject, {}, namespace, merger);
114
+ }
115
+ const object = Object.assign({}, defaults);
116
+ for (const key in baseObject) {
117
+ if (key === "__proto__" || key === "constructor") {
118
+ continue;
119
+ }
120
+ const value = baseObject[key];
121
+ if (value === null || value === void 0) {
122
+ continue;
123
+ }
124
+ if (merger && merger(object, key, value, namespace)) {
125
+ continue;
126
+ }
127
+ if (Array.isArray(value) && Array.isArray(object[key])) {
128
+ object[key] = [...value, ...object[key]];
129
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
130
+ object[key] = _defu(
131
+ value,
132
+ object[key],
133
+ (namespace ? `${namespace}.` : "") + key.toString(),
134
+ merger
135
+ );
136
+ } else {
137
+ object[key] = value;
138
+ }
139
+ }
140
+ return object;
141
+ }
142
+ function createDefu(merger) {
143
+ return (...arguments_) => (
144
+ // eslint-disable-next-line unicorn/no-array-reduce
145
+ arguments_.reduce((p, c2) => _defu(p, c2, "", merger), {})
146
+ );
147
+ }
148
+ var defu = createDefu();
149
+ function isPlainObject(obj) {
150
+ return Object.prototype.toString.call(obj) === "[object Object]";
151
+ }
152
+ function isLogObj(arg) {
153
+ if (!isPlainObject(arg)) {
154
+ return false;
155
+ }
156
+ if (!arg.message && !arg.args) {
157
+ return false;
158
+ }
159
+ if (arg.stack) {
160
+ return false;
161
+ }
162
+ return true;
163
+ }
164
+ var paused = false;
165
+ var queue = [];
166
+ var Consola = class _Consola {
167
+ options;
168
+ _lastLog;
169
+ _mockFn;
170
+ /**
171
+ * Creates an instance of Consola with specified options or defaults.
172
+ *
173
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
174
+ */
175
+ constructor(options = {}) {
176
+ const types = options.types || LogTypes;
177
+ this.options = defu(
178
+ {
179
+ ...options,
180
+ defaults: { ...options.defaults },
181
+ level: _normalizeLogLevel(options.level, types),
182
+ reporters: [...options.reporters || []]
183
+ },
184
+ {
185
+ types: LogTypes,
186
+ throttle: 1e3,
187
+ throttleMin: 5,
188
+ formatOptions: {
189
+ date: true,
190
+ colors: false,
191
+ compact: true
192
+ }
193
+ }
194
+ );
195
+ for (const type in types) {
196
+ const defaults = {
197
+ type,
198
+ ...this.options.defaults,
199
+ ...types[type]
200
+ };
201
+ this[type] = this._wrapLogFn(defaults);
202
+ this[type].raw = this._wrapLogFn(
203
+ defaults,
204
+ true
205
+ );
206
+ }
207
+ if (this.options.mockFn) {
208
+ this.mockTypes();
209
+ }
210
+ this._lastLog = {};
211
+ }
212
+ /**
213
+ * Gets the current log level of the Consola instance.
214
+ *
215
+ * @returns {number} The current log level.
216
+ */
217
+ get level() {
218
+ return this.options.level;
219
+ }
220
+ /**
221
+ * Sets the minimum log level that will be output by the instance.
222
+ *
223
+ * @param {number} level - The new log level to set.
224
+ */
225
+ set level(level) {
226
+ this.options.level = _normalizeLogLevel(
227
+ level,
228
+ this.options.types,
229
+ this.options.level
230
+ );
231
+ }
232
+ /**
233
+ * Displays a prompt to the user and returns the response.
234
+ * Throw an error if `prompt` is not supported by the current configuration.
235
+ *
236
+ * @template T
237
+ * @param {string} message - The message to display in the prompt.
238
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
239
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
240
+ */
241
+ prompt(message, opts) {
242
+ if (!this.options.prompt) {
243
+ throw new Error("prompt is not supported!");
244
+ }
245
+ return this.options.prompt(message, opts);
246
+ }
247
+ /**
248
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
249
+ *
250
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
251
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
252
+ */
253
+ create(options) {
254
+ const instance = new _Consola({
255
+ ...this.options,
256
+ ...options
257
+ });
258
+ if (this._mockFn) {
259
+ instance.mockTypes(this._mockFn);
260
+ }
261
+ return instance;
262
+ }
263
+ /**
264
+ * Creates a new Consola instance with the specified default log object properties.
265
+ *
266
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
267
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
268
+ */
269
+ withDefaults(defaults) {
270
+ return this.create({
271
+ ...this.options,
272
+ defaults: {
273
+ ...this.options.defaults,
274
+ ...defaults
275
+ }
276
+ });
277
+ }
278
+ /**
279
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
280
+ *
281
+ * @param {string} tag - The tag to include in each log of the new instance.
282
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
283
+ */
284
+ withTag(tag) {
285
+ return this.withDefaults({
286
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
287
+ });
288
+ }
289
+ /**
290
+ * Adds a custom reporter to the Consola instance.
291
+ * Reporters will be called for each log message, depending on their implementation and log level.
292
+ *
293
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
294
+ * @returns {Consola} The current Consola instance.
295
+ */
296
+ addReporter(reporter) {
297
+ this.options.reporters.push(reporter);
298
+ return this;
299
+ }
300
+ /**
301
+ * Removes a custom reporter from the Consola instance.
302
+ * If no reporter is specified, all reporters will be removed.
303
+ *
304
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
305
+ * @returns {Consola} The current Consola instance.
306
+ */
307
+ removeReporter(reporter) {
308
+ if (reporter) {
309
+ const i2 = this.options.reporters.indexOf(reporter);
310
+ if (i2 !== -1) {
311
+ return this.options.reporters.splice(i2, 1);
312
+ }
313
+ } else {
314
+ this.options.reporters.splice(0);
315
+ }
316
+ return this;
317
+ }
318
+ /**
319
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
320
+ *
321
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
322
+ * @returns {Consola} The current Consola instance.
323
+ */
324
+ setReporters(reporters) {
325
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
326
+ return this;
327
+ }
328
+ wrapAll() {
329
+ this.wrapConsole();
330
+ this.wrapStd();
331
+ }
332
+ restoreAll() {
333
+ this.restoreConsole();
334
+ this.restoreStd();
335
+ }
336
+ /**
337
+ * Overrides console methods with Consola logging methods for consistent logging.
338
+ */
339
+ wrapConsole() {
340
+ for (const type in this.options.types) {
341
+ if (!console["__" + type]) {
342
+ console["__" + type] = console[type];
343
+ }
344
+ console[type] = this[type].raw;
345
+ }
346
+ }
347
+ /**
348
+ * Restores the original console methods, removing Consola overrides.
349
+ */
350
+ restoreConsole() {
351
+ for (const type in this.options.types) {
352
+ if (console["__" + type]) {
353
+ console[type] = console["__" + type];
354
+ delete console["__" + type];
355
+ }
356
+ }
357
+ }
358
+ /**
359
+ * Overrides standard output and error streams to redirect them through Consola.
360
+ */
361
+ wrapStd() {
362
+ this._wrapStream(this.options.stdout, "log");
363
+ this._wrapStream(this.options.stderr, "log");
364
+ }
365
+ _wrapStream(stream, type) {
366
+ if (!stream) {
367
+ return;
368
+ }
369
+ if (!stream.__write) {
370
+ stream.__write = stream.write;
371
+ }
372
+ stream.write = (data) => {
373
+ this[type].raw(String(data).trim());
374
+ };
375
+ }
376
+ /**
377
+ * Restores the original standard output and error streams, removing the Consola redirection.
378
+ */
379
+ restoreStd() {
380
+ this._restoreStream(this.options.stdout);
381
+ this._restoreStream(this.options.stderr);
382
+ }
383
+ _restoreStream(stream) {
384
+ if (!stream) {
385
+ return;
386
+ }
387
+ if (stream.__write) {
388
+ stream.write = stream.__write;
389
+ delete stream.__write;
390
+ }
391
+ }
392
+ /**
393
+ * Pauses logging, queues incoming logs until resumed.
394
+ */
395
+ pauseLogs() {
396
+ paused = true;
397
+ }
398
+ /**
399
+ * Resumes logging, processing any queued logs.
400
+ */
401
+ resumeLogs() {
402
+ paused = false;
403
+ const _queue = queue.splice(0);
404
+ for (const item of _queue) {
405
+ item[0]._logFn(item[1], item[2]);
406
+ }
407
+ }
408
+ /**
409
+ * Replaces logging methods with mocks if a mock function is provided.
410
+ *
411
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
412
+ */
413
+ mockTypes(mockFn) {
414
+ const _mockFn = mockFn || this.options.mockFn;
415
+ this._mockFn = _mockFn;
416
+ if (typeof _mockFn !== "function") {
417
+ return;
418
+ }
419
+ for (const type in this.options.types) {
420
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
421
+ this[type].raw = this[type];
422
+ }
423
+ }
424
+ _wrapLogFn(defaults, isRaw) {
425
+ return (...args) => {
426
+ if (paused) {
427
+ queue.push([this, defaults, args, isRaw]);
428
+ return;
429
+ }
430
+ return this._logFn(defaults, args, isRaw);
431
+ };
432
+ }
433
+ _logFn(defaults, args, isRaw) {
434
+ if ((defaults.level || 0) > this.level) {
435
+ return false;
436
+ }
437
+ const logObj = {
438
+ date: /* @__PURE__ */ new Date(),
439
+ args: [],
440
+ ...defaults,
441
+ level: _normalizeLogLevel(defaults.level, this.options.types)
442
+ };
443
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
444
+ Object.assign(logObj, args[0]);
445
+ } else {
446
+ logObj.args = [...args];
447
+ }
448
+ if (logObj.message) {
449
+ logObj.args.unshift(logObj.message);
450
+ delete logObj.message;
451
+ }
452
+ if (logObj.additional) {
453
+ if (!Array.isArray(logObj.additional)) {
454
+ logObj.additional = logObj.additional.split("\n");
455
+ }
456
+ logObj.args.push("\n" + logObj.additional.join("\n"));
457
+ delete logObj.additional;
458
+ }
459
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
460
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
461
+ const resolveLog = (newLog = false) => {
462
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
463
+ if (this._lastLog.object && repeated > 0) {
464
+ const args2 = [...this._lastLog.object.args];
465
+ if (repeated > 1) {
466
+ args2.push(`(repeated ${repeated} times)`);
467
+ }
468
+ this._log({ ...this._lastLog.object, args: args2 });
469
+ this._lastLog.count = 1;
470
+ }
471
+ if (newLog) {
472
+ this._lastLog.object = logObj;
473
+ this._log(logObj);
474
+ }
475
+ };
476
+ clearTimeout(this._lastLog.timeout);
477
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
478
+ this._lastLog.time = logObj.date;
479
+ if (diffTime < this.options.throttle) {
480
+ try {
481
+ const serializedLog = JSON.stringify([
482
+ logObj.type,
483
+ logObj.tag,
484
+ logObj.args
485
+ ]);
486
+ const isSameLog = this._lastLog.serialized === serializedLog;
487
+ this._lastLog.serialized = serializedLog;
488
+ if (isSameLog) {
489
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
490
+ if (this._lastLog.count > this.options.throttleMin) {
491
+ this._lastLog.timeout = setTimeout(
492
+ resolveLog,
493
+ this.options.throttle
494
+ );
495
+ return;
496
+ }
497
+ }
498
+ } catch {
499
+ }
500
+ }
501
+ resolveLog(true);
502
+ }
503
+ _log(logObj) {
504
+ for (const reporter of this.options.reporters) {
505
+ reporter.log(logObj, {
506
+ options: this.options
507
+ });
508
+ }
509
+ }
510
+ };
511
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
512
+ if (input === void 0) {
513
+ return defaultLevel;
514
+ }
515
+ if (typeof input === "number") {
516
+ return input;
517
+ }
518
+ if (types[input] && types[input].level !== void 0) {
519
+ return types[input].level;
520
+ }
521
+ return defaultLevel;
522
+ }
523
+ Consola.prototype.add = Consola.prototype.addReporter;
524
+ Consola.prototype.remove = Consola.prototype.removeReporter;
525
+ Consola.prototype.clear = Consola.prototype.removeReporter;
526
+ Consola.prototype.withScope = Consola.prototype.withTag;
527
+ Consola.prototype.mock = Consola.prototype.mockTypes;
528
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
529
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
530
+ function createConsola(options = {}) {
531
+ return new Consola(options);
532
+ }
533
+
534
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
535
+ import { formatWithOptions } from "util";
536
+ import { sep } from "path";
537
+ function parseStack(stack, message) {
538
+ const cwd = process.cwd() + sep;
539
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
540
+ return lines;
541
+ }
542
+ function writeStream(data, stream) {
543
+ const write = stream.__write || stream.write;
544
+ return write.call(stream, data);
545
+ }
546
+ var bracket = (x) => x ? `[${x}]` : "";
547
+ var BasicReporter = class {
548
+ formatStack(stack, message, opts) {
549
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
550
+ return indent + parseStack(stack, message).join(`
551
+ ${indent}`);
552
+ }
553
+ formatError(err, opts) {
554
+ const message = err.message ?? formatWithOptions(opts, err);
555
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
556
+ const level = opts?.errorLevel || 0;
557
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
558
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
559
+ return causedPrefix + message + "\n" + stack + causedError;
560
+ }
561
+ formatArgs(args, opts) {
562
+ const _args = args.map((arg) => {
563
+ if (arg && typeof arg.stack === "string") {
564
+ return this.formatError(arg, opts);
565
+ }
566
+ return arg;
567
+ });
568
+ return formatWithOptions(opts, ..._args);
569
+ }
570
+ formatDate(date, opts) {
571
+ return opts.date ? date.toLocaleTimeString() : "";
572
+ }
573
+ filterAndJoin(arr) {
574
+ return arr.filter(Boolean).join(" ");
575
+ }
576
+ formatLogObj(logObj, opts) {
577
+ const message = this.formatArgs(logObj.args, opts);
578
+ if (logObj.type === "box") {
579
+ return "\n" + [
580
+ bracket(logObj.tag),
581
+ logObj.title && logObj.title,
582
+ ...message.split("\n")
583
+ ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
584
+ }
585
+ return this.filterAndJoin([
586
+ bracket(logObj.type),
587
+ bracket(logObj.tag),
588
+ message
589
+ ]);
590
+ }
591
+ log(logObj, ctx) {
592
+ const line = this.formatLogObj(logObj, {
593
+ columns: ctx.options.stdout.columns || 0,
594
+ ...ctx.options.formatOptions
595
+ });
596
+ return writeStream(
597
+ line + "\n",
598
+ logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
599
+ );
600
+ }
601
+ };
602
+
603
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
604
+ import g$1 from "process";
605
+
606
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
607
+ import * as tty from "tty";
608
+ var {
609
+ env = {},
610
+ argv = [],
611
+ platform = ""
612
+ } = typeof process === "undefined" ? {} : process;
613
+ var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
614
+ var isForced = "FORCE_COLOR" in env || argv.includes("--color");
615
+ var isWindows = platform === "win32";
616
+ var isDumbTerminal = env.TERM === "dumb";
617
+ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
618
+ var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
619
+ var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
620
+ function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
621
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
622
+ }
623
+ function clearBleed(index, string, open, close, replace) {
624
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
625
+ }
626
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
627
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(
628
+ ("" + string).indexOf(close, at),
629
+ string,
630
+ open,
631
+ close,
632
+ replace
633
+ ) : "";
634
+ }
635
+ function init(open, close, replace) {
636
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
637
+ }
638
+ var colorDefs = {
639
+ reset: init(0, 0),
640
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
641
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
642
+ italic: init(3, 23),
643
+ underline: init(4, 24),
644
+ inverse: init(7, 27),
645
+ hidden: init(8, 28),
646
+ strikethrough: init(9, 29),
647
+ black: init(30, 39),
648
+ red: init(31, 39),
649
+ green: init(32, 39),
650
+ yellow: init(33, 39),
651
+ blue: init(34, 39),
652
+ magenta: init(35, 39),
653
+ cyan: init(36, 39),
654
+ white: init(37, 39),
655
+ gray: init(90, 39),
656
+ bgBlack: init(40, 49),
657
+ bgRed: init(41, 49),
658
+ bgGreen: init(42, 49),
659
+ bgYellow: init(43, 49),
660
+ bgBlue: init(44, 49),
661
+ bgMagenta: init(45, 49),
662
+ bgCyan: init(46, 49),
663
+ bgWhite: init(47, 49),
664
+ blackBright: init(90, 39),
665
+ redBright: init(91, 39),
666
+ greenBright: init(92, 39),
667
+ yellowBright: init(93, 39),
668
+ blueBright: init(94, 39),
669
+ magentaBright: init(95, 39),
670
+ cyanBright: init(96, 39),
671
+ whiteBright: init(97, 39),
672
+ bgBlackBright: init(100, 49),
673
+ bgRedBright: init(101, 49),
674
+ bgGreenBright: init(102, 49),
675
+ bgYellowBright: init(103, 49),
676
+ bgBlueBright: init(104, 49),
677
+ bgMagentaBright: init(105, 49),
678
+ bgCyanBright: init(106, 49),
679
+ bgWhiteBright: init(107, 49)
680
+ };
681
+ function createColors(useColor = isColorSupported) {
682
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
683
+ }
684
+ var colors = createColors();
685
+ function getColor(color, fallback = "reset") {
686
+ return colors[color] || colors[fallback];
687
+ }
688
+ var ansiRegex = [
689
+ String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
690
+ String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
691
+ ].join("|");
692
+ function stripAnsi(text) {
693
+ return text.replace(new RegExp(ansiRegex, "g"), "");
694
+ }
695
+ var boxStylePresets = {
696
+ solid: {
697
+ tl: "\u250C",
698
+ tr: "\u2510",
699
+ bl: "\u2514",
700
+ br: "\u2518",
701
+ h: "\u2500",
702
+ v: "\u2502"
703
+ },
704
+ double: {
705
+ tl: "\u2554",
706
+ tr: "\u2557",
707
+ bl: "\u255A",
708
+ br: "\u255D",
709
+ h: "\u2550",
710
+ v: "\u2551"
711
+ },
712
+ doubleSingle: {
713
+ tl: "\u2553",
714
+ tr: "\u2556",
715
+ bl: "\u2559",
716
+ br: "\u255C",
717
+ h: "\u2500",
718
+ v: "\u2551"
719
+ },
720
+ doubleSingleRounded: {
721
+ tl: "\u256D",
722
+ tr: "\u256E",
723
+ bl: "\u2570",
724
+ br: "\u256F",
725
+ h: "\u2500",
726
+ v: "\u2551"
727
+ },
728
+ singleThick: {
729
+ tl: "\u250F",
730
+ tr: "\u2513",
731
+ bl: "\u2517",
732
+ br: "\u251B",
733
+ h: "\u2501",
734
+ v: "\u2503"
735
+ },
736
+ singleDouble: {
737
+ tl: "\u2552",
738
+ tr: "\u2555",
739
+ bl: "\u2558",
740
+ br: "\u255B",
741
+ h: "\u2550",
742
+ v: "\u2502"
743
+ },
744
+ singleDoubleRounded: {
745
+ tl: "\u256D",
746
+ tr: "\u256E",
747
+ bl: "\u2570",
748
+ br: "\u256F",
749
+ h: "\u2550",
750
+ v: "\u2502"
751
+ },
752
+ rounded: {
753
+ tl: "\u256D",
754
+ tr: "\u256E",
755
+ bl: "\u2570",
756
+ br: "\u256F",
757
+ h: "\u2500",
758
+ v: "\u2502"
759
+ }
760
+ };
761
+ var defaultStyle = {
762
+ borderColor: "white",
763
+ borderStyle: "rounded",
764
+ valign: "center",
765
+ padding: 2,
766
+ marginLeft: 1,
767
+ marginTop: 1,
768
+ marginBottom: 1
769
+ };
770
+ function box(text, _opts = {}) {
771
+ const opts = {
772
+ ..._opts,
773
+ style: {
774
+ ...defaultStyle,
775
+ ..._opts.style
776
+ }
777
+ };
778
+ const textLines = text.split("\n");
779
+ const boxLines = [];
780
+ const _color = getColor(opts.style.borderColor);
781
+ const borderStyle = {
782
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
783
+ };
784
+ if (_color) {
785
+ for (const key in borderStyle) {
786
+ borderStyle[key] = _color(
787
+ borderStyle[key]
788
+ );
789
+ }
790
+ }
791
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
792
+ const height = textLines.length + paddingOffset;
793
+ const width = Math.max(
794
+ ...textLines.map((line) => stripAnsi(line).length),
795
+ opts.title ? stripAnsi(opts.title).length : 0
796
+ ) + paddingOffset;
797
+ const widthOffset = width + paddingOffset;
798
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
799
+ if (opts.style.marginTop > 0) {
800
+ boxLines.push("".repeat(opts.style.marginTop));
801
+ }
802
+ if (opts.title) {
803
+ const title = _color ? _color(opts.title) : opts.title;
804
+ const left = borderStyle.h.repeat(
805
+ Math.floor((width - stripAnsi(opts.title).length) / 2)
806
+ );
807
+ const right = borderStyle.h.repeat(
808
+ width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
809
+ );
810
+ boxLines.push(
811
+ `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
812
+ );
813
+ } else {
814
+ boxLines.push(
815
+ `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
816
+ );
817
+ }
818
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
819
+ for (let i2 = 0; i2 < height; i2++) {
820
+ if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
821
+ boxLines.push(
822
+ `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
823
+ );
824
+ } else {
825
+ const line = textLines[i2 - valignOffset];
826
+ const left = " ".repeat(paddingOffset);
827
+ const right = " ".repeat(width - stripAnsi(line).length);
828
+ boxLines.push(
829
+ `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
830
+ );
831
+ }
832
+ }
833
+ boxLines.push(
834
+ `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
835
+ );
836
+ if (opts.style.marginBottom > 0) {
837
+ boxLines.push("".repeat(opts.style.marginBottom));
838
+ }
839
+ return boxLines.join("\n");
840
+ }
841
+
842
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
843
+ import "util";
844
+ import "path";
845
+ import "tty";
846
+ var r = /* @__PURE__ */ Object.create(null);
847
+ var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
848
+ var o = new Proxy(r, { get(e, s2) {
849
+ return i()[s2] ?? r[s2];
850
+ }, has(e, s2) {
851
+ const E = i();
852
+ return s2 in E || s2 in r;
853
+ }, set(e, s2, E) {
854
+ const B = i(true);
855
+ return B[s2] = E, true;
856
+ }, deleteProperty(e, s2) {
857
+ if (!s2) return false;
858
+ const E = i(true);
859
+ return delete E[s2], true;
860
+ }, ownKeys() {
861
+ const e = i(true);
862
+ return Object.keys(e);
863
+ } });
864
+ var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
865
+ var f = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
866
+ function b() {
867
+ if (globalThis.process?.env) for (const e of f) {
868
+ const s2 = e[1] || e[0];
869
+ if (globalThis.process?.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
870
+ }
871
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
872
+ }
873
+ var l = b();
874
+ l.name;
875
+ function n(e) {
876
+ return e ? e !== "false" : false;
877
+ }
878
+ var I = globalThis.process?.platform || "";
879
+ var T = n(o.CI) || l.ci !== false;
880
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
881
+ var g = n(o.DEBUG);
882
+ var R = t === "test" || n(o.TEST);
883
+ n(o.MINIMAL) || T || R || !a;
884
+ var A = /^win/i.test(I);
885
+ !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
886
+ var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
887
+ Number(C?.split(".")[0]) || null;
888
+ var y = globalThis.process || /* @__PURE__ */ Object.create(null);
889
+ var _ = { versions: {} };
890
+ new Proxy(y, { get(e, s2) {
891
+ if (s2 === "env") return o;
892
+ if (s2 in e) return e[s2];
893
+ if (s2 in _) return _[s2];
894
+ } });
895
+ var c = globalThis.process?.release?.name === "node";
896
+ var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
897
+ var D = !!globalThis.Deno;
898
+ var L = !!globalThis.fastly;
899
+ var S = !!globalThis.Netlify;
900
+ var u = !!globalThis.EdgeRuntime;
901
+ var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
902
+ var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
903
+ function G() {
904
+ const e = F.find((s2) => s2[0]);
905
+ if (e) return { name: e[1] };
906
+ }
907
+ var P = G();
908
+ P?.name || "";
909
+ function ansiRegex2({ onlyFirst = false } = {}) {
910
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
911
+ const pattern = [
912
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
913
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
914
+ ].join("|");
915
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
916
+ }
917
+ var regex = ansiRegex2();
918
+ function stripAnsi2(string) {
919
+ if (typeof string !== "string") {
920
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
921
+ }
922
+ return string.replace(regex, "");
923
+ }
924
+ function isAmbiguous(x) {
925
+ return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
926
+ }
927
+ function isFullWidth(x) {
928
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
929
+ }
930
+ function isWide(x) {
931
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
932
+ }
933
+ function validate(codePoint) {
934
+ if (!Number.isSafeInteger(codePoint)) {
935
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
936
+ }
937
+ }
938
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
939
+ validate(codePoint);
940
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
941
+ return 2;
942
+ }
943
+ return 1;
944
+ }
945
+ var emojiRegex = () => {
946
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
947
+ };
948
+ var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
949
+ var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
950
+ function stringWidth$1(string, options = {}) {
951
+ if (typeof string !== "string" || string.length === 0) {
952
+ return 0;
953
+ }
954
+ const {
955
+ ambiguousIsNarrow = true,
956
+ countAnsiEscapeCodes = false
957
+ } = options;
958
+ if (!countAnsiEscapeCodes) {
959
+ string = stripAnsi2(string);
960
+ }
961
+ if (string.length === 0) {
962
+ return 0;
963
+ }
964
+ let width = 0;
965
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
966
+ for (const { segment: character } of segmenter.segment(string)) {
967
+ const codePoint = character.codePointAt(0);
968
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
969
+ continue;
970
+ }
971
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
972
+ continue;
973
+ }
974
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
975
+ continue;
976
+ }
977
+ if (codePoint >= 55296 && codePoint <= 57343) {
978
+ continue;
979
+ }
980
+ if (codePoint >= 65024 && codePoint <= 65039) {
981
+ continue;
982
+ }
983
+ if (defaultIgnorableCodePointRegex.test(character)) {
984
+ continue;
985
+ }
986
+ if (emojiRegex().test(character)) {
987
+ width += 2;
988
+ continue;
989
+ }
990
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
991
+ }
992
+ return width;
993
+ }
994
+ function isUnicodeSupported() {
995
+ const { env: env2 } = g$1;
996
+ const { TERM, TERM_PROGRAM } = env2;
997
+ if (g$1.platform !== "win32") {
998
+ return TERM !== "linux";
999
+ }
1000
+ return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
1001
+ }
1002
+ var TYPE_COLOR_MAP = {
1003
+ info: "cyan",
1004
+ fail: "red",
1005
+ success: "green",
1006
+ ready: "green",
1007
+ start: "magenta"
1008
+ };
1009
+ var LEVEL_COLOR_MAP = {
1010
+ 0: "red",
1011
+ 1: "yellow"
1012
+ };
1013
+ var unicode = isUnicodeSupported();
1014
+ var s = (c2, fallback) => unicode ? c2 : fallback;
1015
+ var TYPE_ICONS = {
1016
+ error: s("\u2716", "\xD7"),
1017
+ fatal: s("\u2716", "\xD7"),
1018
+ ready: s("\u2714", "\u221A"),
1019
+ warn: s("\u26A0", "\u203C"),
1020
+ info: s("\u2139", "i"),
1021
+ success: s("\u2714", "\u221A"),
1022
+ debug: s("\u2699", "D"),
1023
+ trace: s("\u2192", "\u2192"),
1024
+ fail: s("\u2716", "\xD7"),
1025
+ start: s("\u25D0", "o"),
1026
+ log: ""
1027
+ };
1028
+ function stringWidth(str) {
1029
+ const hasICU = typeof Intl === "object";
1030
+ if (!hasICU || !Intl.Segmenter) {
1031
+ return stripAnsi(str).length;
1032
+ }
1033
+ return stringWidth$1(str);
1034
+ }
1035
+ var FancyReporter = class extends BasicReporter {
1036
+ formatStack(stack, message, opts) {
1037
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1038
+ return `
1039
+ ${indent}` + parseStack(stack, message).map(
1040
+ (line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
1041
+ ).join(`
1042
+ ${indent}`);
1043
+ }
1044
+ formatType(logObj, isBadge, opts) {
1045
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1046
+ if (isBadge) {
1047
+ return getBgColor(typeColor)(
1048
+ colors.black(` ${logObj.type.toUpperCase()} `)
1049
+ );
1050
+ }
1051
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1052
+ return _type ? getColor2(typeColor)(_type) : "";
1053
+ }
1054
+ formatLogObj(logObj, opts) {
1055
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1056
+ "\n"
1057
+ );
1058
+ if (logObj.type === "box") {
1059
+ return box(
1060
+ characterFormat(
1061
+ message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1062
+ ),
1063
+ {
1064
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
1065
+ style: logObj.style
1066
+ }
1067
+ );
1068
+ }
1069
+ const date = this.formatDate(logObj.date, opts);
1070
+ const coloredDate = date && colors.gray(date);
1071
+ const isBadge = logObj.badge ?? logObj.level < 2;
1072
+ const type = this.formatType(logObj, isBadge, opts);
1073
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1074
+ let line;
1075
+ const left = this.filterAndJoin([type, characterFormat(message)]);
1076
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1077
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1078
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1079
+ line += characterFormat(
1080
+ additional.length > 0 ? "\n" + additional.join("\n") : ""
1081
+ );
1082
+ if (logObj.type === "trace") {
1083
+ const _err = new Error("Trace: " + logObj.message);
1084
+ line += this.formatStack(_err.stack || "", _err.message);
1085
+ }
1086
+ return isBadge ? "\n" + line + "\n" : line;
1087
+ }
1088
+ };
1089
+ function characterFormat(str) {
1090
+ return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
1091
+ }
1092
+ function getColor2(color = "white") {
1093
+ return colors[color] || colors.white;
1094
+ }
1095
+ function getBgColor(color = "bgWhite") {
1096
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1097
+ }
1098
+ function createConsola2(options = {}) {
1099
+ let level = _getDefaultLogLevel();
1100
+ if (process.env.CONSOLA_LEVEL) {
1101
+ level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1102
+ }
1103
+ const consola2 = createConsola({
1104
+ level,
1105
+ defaults: { level },
1106
+ stdout: process.stdout,
1107
+ stderr: process.stderr,
1108
+ prompt: (...args) => import("./prompt-VKHMCQT6.mjs").then((m) => m.prompt(...args)),
1109
+ reporters: options.reporters || [
1110
+ options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
1111
+ ],
1112
+ ...options
1113
+ });
1114
+ return consola2;
1115
+ }
1116
+ function _getDefaultLogLevel() {
1117
+ if (g) {
1118
+ return LogLevels.debug;
1119
+ }
1120
+ if (R) {
1121
+ return LogLevels.warn;
1122
+ }
1123
+ return LogLevels.info;
1124
+ }
1125
+ var consola = createConsola2();
1126
+
1127
+ // src/auth/clerk-oauth.ts
1128
+ import crypto from "crypto";
1129
+ async function refreshClerkOAuthToken(input) {
1130
+ const { clientId, tokenUrl } = assertConfigured(input.config);
1131
+ const body = new URLSearchParams({
1132
+ grant_type: "refresh_token",
1133
+ client_id: clientId,
1134
+ refresh_token: input.refreshToken
1135
+ });
1136
+ return requestClerkToken(tokenUrl, body);
1137
+ }
1138
+ function assertConfigured(config) {
1139
+ const issuer = config.issuer?.trim().replace(/\/$/, "");
1140
+ const clientId = config.clientId?.trim();
1141
+ if (!issuer || !clientId) {
1142
+ throw new Error(
1143
+ [
1144
+ "Clerk OAuth CLI is not configured for this environment.",
1145
+ "The CLI expects first-party environments to be configured in its built-in registry.",
1146
+ "If this environment has no registered public Clerk OAuth client, create one and release a CLI with its client id.",
1147
+ "For emergency overrides, set the environment-specific DREAMBOARD_<ENV>_CLERK_OAUTH_* variables or DREAMBOARD_CLERK_OAUTH_*.",
1148
+ "For local harness auth, use `pnpm auth:local` or the auto-bootstrapped local harness flows instead."
1149
+ ].join(" ")
1150
+ );
1151
+ }
1152
+ return {
1153
+ issuer,
1154
+ clientId,
1155
+ tokenUrl: config.tokenUrl?.trim() || new URL("/oauth/token", issuer).toString(),
1156
+ scope: config.scope?.trim() || void 0
1157
+ };
1158
+ }
1159
+ async function requestClerkToken(tokenUrl, body) {
1160
+ const response = await fetch(tokenUrl, {
1161
+ method: "POST",
1162
+ headers: {
1163
+ "Content-Type": "application/x-www-form-urlencoded",
1164
+ Accept: "application/json"
1165
+ },
1166
+ body
1167
+ });
1168
+ if (!response.ok) {
1169
+ const detail = await response.text();
1170
+ throw new Error(
1171
+ `Clerk OAuth token request failed (${response.status}): ${detail}`
1172
+ );
1173
+ }
1174
+ const payload = await response.json();
1175
+ if (typeof payload.access_token !== "string") {
1176
+ throw new Error("Clerk OAuth token response did not include access_token.");
1177
+ }
1178
+ if (typeof payload.refresh_token !== "string") {
1179
+ throw new Error(
1180
+ "Clerk OAuth token response did not include refresh_token."
1181
+ );
1182
+ }
1183
+ const expiresAt = typeof payload.expires_in === "number" ? new Date(Date.now() + payload.expires_in * 1e3).toISOString() : void 0;
1184
+ return {
1185
+ accessToken: payload.access_token,
1186
+ refreshToken: payload.refresh_token,
1187
+ expiresAt,
1188
+ tokenUrl
1189
+ };
1190
+ }
1191
+
1192
+ // src/config/local-harness-auth.ts
1193
+ import { createHmac, randomUUID } from "crypto";
1194
+ var DEFAULT_SUBJECT = "harness-smoke-local@dreamboard.local";
1195
+ var DEFAULT_ISSUER = "dreamboard-local-harness";
1196
+ var DEFAULT_SECRET = "dreamboard-local-harness-token-secret";
1197
+ var LOCAL_AWS_ISSUER = "dreamboard-local-aws-harness";
1198
+ var LOCAL_AWS_SECRET = "dreamboard-local-aws-harness-token-secret";
1199
+ var DEFAULT_TTL_SECONDS = 8 * 60 * 60;
1200
+ var mintedTokens = /* @__PURE__ */ new Map();
1201
+ function resolveLocalHarnessAccessToken(config) {
1202
+ if (IS_PUBLISHED_BUILD || config.environment !== "local") {
1203
+ return void 0;
1204
+ }
1205
+ const profile = inferLocalHarnessProfile(config);
1206
+ if (config.authToken && (profile !== "local-aws" || isExplicitTokenSource(config.authTokenSource))) {
1207
+ return void 0;
1208
+ }
1209
+ const cacheKey = [
1210
+ profile,
1211
+ process.env.LOCAL_HARNESS_TOKEN_ISSUER ?? "",
1212
+ process.env.LOCAL_HARNESS_TOKEN_SECRET ?? "",
1213
+ process.env.LOCAL_HARNESS_SUBJECT ?? "",
1214
+ process.env.HARNESS_USER_EMAIL ?? "",
1215
+ process.env.LOCAL_HARNESS_EMAIL ?? "",
1216
+ process.env.LOCAL_HARNESS_TOKEN_TTL_SECONDS ?? ""
1217
+ ].join("\0");
1218
+ const cached = mintedTokens.get(cacheKey);
1219
+ if (cached) return cached;
1220
+ const token = mintLocalHarnessToken(profile);
1221
+ mintedTokens.set(cacheKey, token);
1222
+ return token;
1223
+ }
1224
+ function isExplicitTokenSource(source) {
1225
+ return source === "flag" || source === "env" || source === "agent-env";
1226
+ }
1227
+ function inferLocalHarnessProfile(config) {
1228
+ return isLocalAwsUrl(config.apiBaseUrl) || isLocalAwsUrl(config.webBaseUrl) ? "local-aws" : "local";
1229
+ }
1230
+ function mintLocalHarnessToken(profile) {
1231
+ const subject = envValue(process.env.LOCAL_HARNESS_SUBJECT) ?? envValue(process.env.HARNESS_USER_EMAIL) ?? DEFAULT_SUBJECT;
1232
+ const email = envValue(process.env.LOCAL_HARNESS_EMAIL) ?? (subject.includes("@") ? subject : void 0);
1233
+ const issuer = envValue(process.env.LOCAL_HARNESS_TOKEN_ISSUER) ?? (profile === "local-aws" ? LOCAL_AWS_ISSUER : DEFAULT_ISSUER);
1234
+ const secret = envValue(process.env.LOCAL_HARNESS_TOKEN_SECRET) ?? (profile === "local-aws" ? LOCAL_AWS_SECRET : DEFAULT_SECRET);
1235
+ const ttlSeconds = Number(
1236
+ envValue(process.env.LOCAL_HARNESS_TOKEN_TTL_SECONDS) ?? String(DEFAULT_TTL_SECONDS)
1237
+ );
1238
+ if (!Number.isFinite(ttlSeconds) || ttlSeconds <= 0) {
1239
+ throw new Error(
1240
+ "LOCAL_HARNESS_TOKEN_TTL_SECONDS must be a positive number."
1241
+ );
1242
+ }
1243
+ const now = Math.floor(Date.now() / 1e3);
1244
+ const payload = {
1245
+ typ: "local_harness_access",
1246
+ dreamboard_provider: "local-harness",
1247
+ dreamboard_provider_subject: subject,
1248
+ ...email ? { email } : {},
1249
+ iss: issuer,
1250
+ sub: subject,
1251
+ iat: now,
1252
+ exp: now + Math.floor(ttlSeconds),
1253
+ jti: randomUUID()
1254
+ };
1255
+ const headerPart = base64UrlJson({ alg: "HS256", typ: "JWT" });
1256
+ const payloadPart = base64UrlJson(payload);
1257
+ const signature = createHmac("sha256", secret).update(`${headerPart}.${payloadPart}`).digest("base64url");
1258
+ return `${headerPart}.${payloadPart}.${signature}`;
1259
+ }
1260
+ function base64UrlJson(value) {
1261
+ return Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
1262
+ }
1263
+ function envValue(raw) {
1264
+ return typeof raw === "string" && raw.trim().length > 0 ? raw.trim() : void 0;
1265
+ }
1266
+ function isLocalAwsUrl(rawUrl) {
1267
+ if (!rawUrl) return false;
1268
+ try {
1269
+ const url = new URL(rawUrl);
1270
+ return (url.hostname === "localhost" || url.hostname === "127.0.0.1") && (url.port === "18080" || url.port === "8088");
1271
+ } catch {
1272
+ return false;
1273
+ }
1274
+ }
1275
+
1276
+ // src/config/resolve.ts
1277
+ var DEFAULT_REFRESH_WINDOW_MS = 5 * 60 * 1e3;
1278
+ var TRANSIENT_READ_RETRY_DELAYS_MS = [100, 300];
1279
+ function resolveConfig(globalConfig, flags, project, credentials) {
1280
+ if (IS_PUBLISHED_BUILD) {
1281
+ assertPublicRuntimeFlags(flags);
1282
+ }
1283
+ const envEnvironment = IS_PUBLISHED_BUILD ? void 0 : environmentFromProcess();
1284
+ const projectEnvironment = IS_PUBLISHED_BUILD ? void 0 : project?.environment;
1285
+ const environment = IS_PUBLISHED_BUILD ? PUBLISHED_ENVIRONMENT : flags.env || envEnvironment || projectEnvironment || globalConfig.environment || "staging";
1286
+ const envConfig = ENVIRONMENT_CONFIGS[environment];
1287
+ const publishedEnvConfig = ENVIRONMENT_CONFIGS[PUBLISHED_ENVIRONMENT];
1288
+ const hasExplicitEnvironmentOverride = !IS_PUBLISHED_BUILD && Boolean(flags.env || envEnvironment || projectEnvironment);
1289
+ const resolvedApiBaseUrl = IS_PUBLISHED_BUILD ? publishedEnvConfig?.apiBaseUrl ?? DEFAULT_API_BASE_URL : hasExplicitEnvironmentOverride ? projectLocalBaseUrl(project?.apiBaseUrl, environment) || envConfig?.apiBaseUrl || DEFAULT_API_BASE_URL : project?.apiBaseUrl || envConfig?.apiBaseUrl || DEFAULT_API_BASE_URL;
1290
+ const apiBaseUrl = valueOrUndefined(process.env.DREAMBOARD_API_BASE_URL) ?? resolvedApiBaseUrl;
1291
+ const resolvedWebBaseUrl = IS_PUBLISHED_BUILD ? publishedEnvConfig?.webBaseUrl ?? DEFAULT_WEB_BASE_URL : hasExplicitEnvironmentOverride ? projectLocalBaseUrl(project?.webBaseUrl, environment) || envConfig?.webBaseUrl || DEFAULT_WEB_BASE_URL : project?.webBaseUrl || envConfig?.webBaseUrl || DEFAULT_WEB_BASE_URL;
1292
+ const webBaseUrl = valueOrUndefined(process.env.DREAMBOARD_WEB_BASE_URL) ?? resolvedWebBaseUrl;
1293
+ const snapshot = buildCredentialSnapshot(flags, credentials, environment);
1294
+ const oauthConfig = resolveEnvironmentOAuthConfig(environment, envConfig);
1295
+ return {
1296
+ environment,
1297
+ apiBaseUrl,
1298
+ webBaseUrl,
1299
+ authToken: snapshot.accessToken,
1300
+ refreshToken: snapshot.refreshToken,
1301
+ tokenExpiresAt: snapshot.tokenExpiresAt,
1302
+ clerkOAuthIssuer: snapshot.clerkOAuthIssuer ?? oauthConfig.issuer,
1303
+ clerkOAuthClientId: snapshot.clerkOAuthClientId ?? oauthConfig.clientId,
1304
+ clerkOAuthTokenUrl: snapshot.clerkOAuthTokenUrl ?? oauthConfig.tokenUrl,
1305
+ clerkOAuthScope: oauthConfig.scope,
1306
+ authTokenSource: snapshot.authTokenSource,
1307
+ refreshTokenSource: snapshot.refreshTokenSource
1308
+ };
1309
+ }
1310
+ function resolveEnvironmentOAuthConfig(environment, envConfig) {
1311
+ const prefix = environment.toUpperCase();
1312
+ return {
1313
+ issuer: valueOrUndefined(
1314
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_ISSUER`]
1315
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_ISSUER) ?? envConfig?.clerkOAuthIssuer,
1316
+ clientId: valueOrUndefined(
1317
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_CLIENT_ID`]
1318
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_CLIENT_ID) ?? envConfig?.clerkOAuthClientId,
1319
+ tokenUrl: valueOrUndefined(
1320
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_TOKEN_URL`]
1321
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_TOKEN_URL) ?? envConfig?.clerkOAuthTokenUrl,
1322
+ scope: valueOrUndefined(
1323
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_SCOPE`]
1324
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_SCOPE) ?? envConfig?.clerkOAuthScope
1325
+ };
1326
+ }
1327
+ function buildCredentialSnapshot(flags, storedCredentials, environment) {
1328
+ const flagToken = valueOrUndefined(flags.token);
1329
+ const agentEnvToken = valueOrUndefined(process.env.DREAMBOARD_AGENT_TOKEN);
1330
+ const envToken = valueOrUndefined(process.env.DREAMBOARD_TOKEN);
1331
+ const environmentScopedStoredCredentials = storedCredentials?.environment && environment && storedCredentials.environment !== environment ? null : storedCredentials ?? null;
1332
+ if (IS_PUBLISHED_BUILD) {
1333
+ const stored = environmentScopedStoredCredentials;
1334
+ if (agentEnvToken) {
1335
+ return {
1336
+ accessToken: agentEnvToken,
1337
+ refreshToken: void 0,
1338
+ tokenExpiresAt: void 0,
1339
+ authTokenSource: "agent-env",
1340
+ refreshTokenSource: "none"
1341
+ };
1342
+ }
1343
+ return {
1344
+ accessToken: stored?.accessToken,
1345
+ refreshToken: stored?.refreshToken,
1346
+ tokenExpiresAt: stored?.tokenExpiresAt,
1347
+ clerkOAuthIssuer: stored?.clerkOAuthIssuer,
1348
+ clerkOAuthClientId: stored?.clerkOAuthClientId,
1349
+ clerkOAuthTokenUrl: stored?.clerkOAuthTokenUrl,
1350
+ environment: stored?.environment,
1351
+ authTokenSource: stored?.accessToken ? "global" : "none",
1352
+ refreshTokenSource: stored?.refreshToken ? "global" : "none"
1353
+ };
1354
+ }
1355
+ const accessToken = flagToken || agentEnvToken || envToken || environmentScopedStoredCredentials?.accessToken;
1356
+ const refreshToken = environmentScopedStoredCredentials?.refreshToken;
1357
+ const authTokenSource = flagToken ? "flag" : agentEnvToken ? "agent-env" : envToken ? "env" : environmentScopedStoredCredentials?.accessToken ? "global" : "none";
1358
+ const refreshTokenSource = environmentScopedStoredCredentials?.refreshToken ? "global" : "none";
1359
+ return {
1360
+ accessToken,
1361
+ refreshToken,
1362
+ tokenExpiresAt: environmentScopedStoredCredentials?.tokenExpiresAt,
1363
+ clerkOAuthIssuer: environmentScopedStoredCredentials?.clerkOAuthIssuer,
1364
+ clerkOAuthClientId: environmentScopedStoredCredentials?.clerkOAuthClientId,
1365
+ clerkOAuthTokenUrl: environmentScopedStoredCredentials?.clerkOAuthTokenUrl,
1366
+ environment: environmentScopedStoredCredentials?.environment,
1367
+ authTokenSource,
1368
+ refreshTokenSource
1369
+ };
1370
+ }
1371
+ function environmentFromProcess() {
1372
+ const value = valueOrUndefined(process.env.DREAMBOARD_ENV);
1373
+ if (!value) return void 0;
1374
+ if (value === "local" || value === "staging" || value === "prod") {
1375
+ return value;
1376
+ }
1377
+ throw new Error(
1378
+ `Invalid DREAMBOARD_ENV '${value}'. Valid options: local, staging, prod`
1379
+ );
1380
+ }
1381
+ function projectLocalBaseUrl(rawUrl, environment) {
1382
+ if (environment !== "local" || !rawUrl) return void 0;
1383
+ try {
1384
+ const url = new URL(rawUrl);
1385
+ return url.hostname === "localhost" || url.hostname === "127.0.0.1" ? rawUrl : void 0;
1386
+ } catch {
1387
+ return void 0;
1388
+ }
1389
+ }
1390
+ function assertPublicRuntimeFlags(flags) {
1391
+ const argv2 = process.argv.slice(2);
1392
+ if (flags.env || argv2.includes("--env")) {
1393
+ throw new Error(
1394
+ "The published Dreamboard CLI is production-only and does not accept `--env`."
1395
+ );
1396
+ }
1397
+ if (valueOrUndefined(flags.token) || argv2.includes("--token")) {
1398
+ throw new Error(
1399
+ "Direct JWT injection is not supported in the published Dreamboard CLI. Use `dreamboard login` so the CLI can store and refresh your session."
1400
+ );
1401
+ }
1402
+ if (process.env.DREAMBOARD_TOKEN) {
1403
+ throw new Error(
1404
+ "The published Dreamboard CLI ignores direct token environment variables. Use `dreamboard login` so the CLI can manage refreshable credentials."
1405
+ );
1406
+ }
1407
+ }
1408
+ async function configureClient(config) {
1409
+ const effectiveAccessToken = await ensureEffectiveAccessToken(config);
1410
+ client.setConfig({
1411
+ baseUrl: config.apiBaseUrl,
1412
+ fetch: createRetryingReadFetch(globalThis.fetch.bind(globalThis)),
1413
+ headers: effectiveAccessToken ? { Authorization: `Bearer ${effectiveAccessToken}` } : {}
1414
+ });
1415
+ }
1416
+ function createRetryingReadFetch(fetchImpl) {
1417
+ return (async (input, init2) => {
1418
+ const method = resolveFetchMethod(input, init2);
1419
+ if (method !== "GET" && method !== "HEAD") {
1420
+ return fetchImpl(input, init2);
1421
+ }
1422
+ let lastError;
1423
+ for (let attempt = 0; attempt <= TRANSIENT_READ_RETRY_DELAYS_MS.length; attempt += 1) {
1424
+ try {
1425
+ return await fetchImpl(input, init2);
1426
+ } catch (error) {
1427
+ lastError = error;
1428
+ if (attempt >= TRANSIENT_READ_RETRY_DELAYS_MS.length || !isTransientFetchError(error)) {
1429
+ throw error;
1430
+ }
1431
+ await sleep(TRANSIENT_READ_RETRY_DELAYS_MS[attempt]);
1432
+ }
1433
+ }
1434
+ throw lastError;
1435
+ });
1436
+ }
1437
+ function resolveFetchMethod(input, init2) {
1438
+ const method = init2?.method ?? (typeof Request !== "undefined" && input instanceof Request ? input.method : void 0);
1439
+ return (method ?? "GET").toUpperCase();
1440
+ }
1441
+ function isTransientFetchError(error) {
1442
+ const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : String(error);
1443
+ const normalized = message.toLowerCase();
1444
+ return normalized.includes("fetch failed") || normalized.includes("network") || normalized.includes("timeout") || normalized.includes("econnreset") || normalized.includes("econnrefused") || normalized.includes("socket");
1445
+ }
1446
+ function sleep(ms) {
1447
+ return new Promise((resolve) => setTimeout(resolve, ms));
1448
+ }
1449
+ async function ensureEffectiveAccessToken(config) {
1450
+ const localHarnessToken = resolveLocalHarnessAccessToken(config);
1451
+ if (localHarnessToken) return localHarnessToken;
1452
+ if (!usesStoredSession(config)) {
1453
+ return config.authToken;
1454
+ }
1455
+ if (config.refreshToken) {
1456
+ const credentials = await refreshClerkOAuthSessionIfNeeded(config);
1457
+ return credentials?.accessToken ?? config.authToken;
1458
+ }
1459
+ return config.authToken;
1460
+ }
1461
+ async function refreshClerkOAuthSessionIfNeeded(config) {
1462
+ const expiry = config.tokenExpiresAt ? new Date(config.tokenExpiresAt) : getAuthTokenExpiry(config.authToken);
1463
+ if (expiry && expiry.getTime() > Date.now() + DEFAULT_REFRESH_WINDOW_MS) {
1464
+ if (!config.authToken || !config.refreshToken) return null;
1465
+ return {
1466
+ accessToken: config.authToken,
1467
+ refreshToken: config.refreshToken,
1468
+ tokenExpiresAt: config.tokenExpiresAt,
1469
+ clerkOAuthIssuer: config.clerkOAuthIssuer,
1470
+ clerkOAuthClientId: config.clerkOAuthClientId,
1471
+ clerkOAuthTokenUrl: config.clerkOAuthTokenUrl,
1472
+ environment: config.environment
1473
+ };
1474
+ }
1475
+ return refreshClerkOAuthSession(config);
1476
+ }
1477
+ async function refreshClerkOAuthSession(config) {
1478
+ if (!config.refreshToken) return null;
1479
+ const payload = await refreshClerkOAuthToken({
1480
+ config: {
1481
+ issuer: config.clerkOAuthIssuer,
1482
+ clientId: config.clerkOAuthClientId,
1483
+ tokenUrl: config.clerkOAuthTokenUrl
1484
+ },
1485
+ refreshToken: config.refreshToken
1486
+ });
1487
+ const credentials = {
1488
+ accessToken: payload.accessToken,
1489
+ refreshToken: payload.refreshToken,
1490
+ tokenExpiresAt: payload.expiresAt,
1491
+ clerkOAuthIssuer: config.clerkOAuthIssuer,
1492
+ clerkOAuthClientId: config.clerkOAuthClientId,
1493
+ clerkOAuthTokenUrl: payload.tokenUrl,
1494
+ environment: config.environment
1495
+ };
1496
+ await setCredentials(credentials);
1497
+ return credentials;
1498
+ }
1499
+ function requireAuth(config) {
1500
+ if (!config.authToken && !resolveLocalHarnessAccessToken(config)) {
1501
+ throw new Error(
1502
+ "Missing Dreamboard session. Run `dreamboard login` to authenticate."
1503
+ );
1504
+ }
1505
+ }
1506
+ function valueOrUndefined(value) {
1507
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1508
+ }
1509
+ function getAuthTokenExpiry(accessToken) {
1510
+ if (!accessToken) return null;
1511
+ const parts = accessToken.split(".");
1512
+ if (parts.length !== 3) return null;
1513
+ try {
1514
+ const payload = JSON.parse(
1515
+ Buffer.from(parts[1], "base64url").toString("utf8")
1516
+ );
1517
+ if (typeof payload.exp !== "number" || !Number.isFinite(payload.exp)) {
1518
+ return null;
1519
+ }
1520
+ return new Date(payload.exp * 1e3);
1521
+ } catch {
1522
+ return null;
1523
+ }
1524
+ }
1525
+ function usesStoredSession(config) {
1526
+ return config.authTokenSource === "global" && config.refreshTokenSource === "global";
1527
+ }
1528
+ async function resolveProjectContext(flags, opts) {
1529
+ const projectRoot = await findProjectRoot(process.cwd());
1530
+ if (!projectRoot) {
1531
+ throw new Error(
1532
+ "Not inside a dreamboard project (missing .dreamboard/project.json)."
1533
+ );
1534
+ }
1535
+ const projectConfig = await loadProjectConfig(projectRoot);
1536
+ const [globalConfig, credentials] = await Promise.all([
1537
+ loadGlobalConfig(),
1538
+ getStoredSession()
1539
+ ]);
1540
+ const config = resolveConfig(globalConfig, flags, projectConfig, credentials);
1541
+ if (opts?.requireAuth !== false) {
1542
+ requireAuth(config);
1543
+ await configureClient(config);
1544
+ }
1545
+ return { projectRoot, projectConfig, config };
1546
+ }
1547
+
1548
+ // src/services/project/dependency-portability.ts
1549
+ import path from "path";
1550
+ var DEPENDENCY_FIELDS = [
1551
+ "dependencies",
1552
+ "devDependencies",
1553
+ "optionalDependencies",
1554
+ "peerDependencies"
1555
+ ];
1556
+ var UNPORTABLE_SPECIFIER_PATTERN = /^(file|link|portal|workspace):/;
1557
+ async function buildSourceDependencyProfile(options) {
1558
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1559
+ const packages = collectDreamboardPackageSpecifiers(packageJson);
1560
+ return {
1561
+ kind: "npm-registry",
1562
+ packageManager: packageJson.packageManager,
1563
+ dreamboardRegistryUrl: await readDreamboardRegistryFromNpmrc(options.projectRoot) ?? options.projectConfig?.localMaintainerRegistry?.registryUrl,
1564
+ localSnapshotId: options.projectConfig?.localMaintainerRegistry?.snapshotId,
1565
+ packages
1566
+ };
1567
+ }
1568
+ async function assertCompilerPortableDependencies(options) {
1569
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1570
+ const legacyProblems = collectLegacyDreamboardSpecifiers(packageJson);
1571
+ if (legacyProblems.length > 0) {
1572
+ throwLegacyDreamboardPackageError(legacyProblems);
1573
+ }
1574
+ const problems = collectUnportableDreamboardSpecifiers(packageJson);
1575
+ if (problems.length > 0) {
1576
+ const details = problems.map(
1577
+ (problem) => `${problem.location} ${problem.packageName} -> ${problem.specifier}`
1578
+ ).join("; ");
1579
+ throw new Error(
1580
+ [
1581
+ "Compiler-bound workspaces must install Dreamboard packages from a registry.",
1582
+ `Found unportable Dreamboard dependency specifier(s): ${details}.`,
1583
+ "Run `dreamboard sync` from a workspace that uses registry-pinned @dreamboard-games/* and dreamboard versions before compiling."
1584
+ ].join(" ")
1585
+ );
1586
+ }
1587
+ const profile = await buildSourceDependencyProfile(options);
1588
+ const hasLocalSnapshotPackage = Object.values(profile.packages).some(
1589
+ (value) => value.includes("-local.")
1590
+ );
1591
+ if (hasLocalSnapshotPackage && !profile.dreamboardRegistryUrl) {
1592
+ throw new Error(
1593
+ "This workspace references local Dreamboard snapshot versions but has no @dreamboard registry configured. Run `dreamboard sync --env local` to refresh .npmrc before compiling."
1594
+ );
1595
+ }
1596
+ return profile;
1597
+ }
1598
+ async function assertReleaseEnvironmentPortableDependencies(options) {
1599
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1600
+ const legacyProblems = collectLegacyDreamboardSpecifiers(packageJson);
1601
+ if (legacyProblems.length > 0) {
1602
+ throwLegacyDreamboardPackageError(legacyProblems);
1603
+ }
1604
+ const profile = await buildSourceDependencyProfile(options);
1605
+ if (!isReleaseEnvironment(options.environment)) {
1606
+ return profile;
1607
+ }
1608
+ const localPackages = Object.entries(profile.packages).filter(
1609
+ ([, version]) => version.includes("-local.")
1610
+ );
1611
+ const localRegistryUrl = isLocalRegistryUrl(profile.dreamboardRegistryUrl) ? profile.dreamboardRegistryUrl : void 0;
1612
+ if (localPackages.length === 0 && !localRegistryUrl) {
1613
+ return profile;
1614
+ }
1615
+ const packageDetails = localPackages.map(([name, version]) => `${name}@${version}`).join(", ");
1616
+ const registryDetails = localRegistryUrl ? `local registry ${localRegistryUrl}` : null;
1617
+ const details = [packageDetails || null, registryDetails].filter(Boolean).join("; ");
1618
+ throw new Error(
1619
+ [
1620
+ `The ${options.environment} environment does not support local Dreamboard package snapshots.`,
1621
+ `Found ${details}.`,
1622
+ "Publish a public alpha package, repin the workspace to that exact version, and rerun the command."
1623
+ ].join(" ")
1624
+ );
1625
+ }
1626
+ async function readProjectPackageJson(projectRoot) {
1627
+ return readJsonFile(
1628
+ path.join(projectRoot, "package.json")
1629
+ );
1630
+ }
1631
+ function collectDreamboardPackageSpecifiers(packageJson) {
1632
+ const packages = {};
1633
+ for (const field of DEPENDENCY_FIELDS) {
1634
+ const dependencies = packageJson[field];
1635
+ if (!dependencies) continue;
1636
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1637
+ if (isPortableDreamboardPackage(packageName)) {
1638
+ packages[packageName] = specifier;
1639
+ }
1640
+ }
1641
+ }
1642
+ const overrides = packageJson.pnpm?.overrides;
1643
+ if (overrides) {
1644
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1645
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && packages[packageName] === void 0) {
1646
+ packages[packageName] = specifier;
1647
+ }
1648
+ }
1649
+ }
1650
+ return packages;
1651
+ }
1652
+ function collectUnportableDreamboardSpecifiers(packageJson) {
1653
+ const problems = [];
1654
+ for (const field of DEPENDENCY_FIELDS) {
1655
+ const dependencies = packageJson[field];
1656
+ if (!dependencies) continue;
1657
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1658
+ if (isPortableDreamboardPackage(packageName) && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
1659
+ problems.push({ location: field, packageName, specifier });
1660
+ }
1661
+ }
1662
+ }
1663
+ const overrides = packageJson.pnpm?.overrides;
1664
+ if (overrides) {
1665
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1666
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
1667
+ problems.push({
1668
+ location: "pnpm.overrides",
1669
+ packageName,
1670
+ specifier
1671
+ });
1672
+ }
1673
+ }
1674
+ }
1675
+ return problems;
1676
+ }
1677
+ function collectLegacyDreamboardSpecifiers(packageJson) {
1678
+ const problems = [];
1679
+ for (const field of DEPENDENCY_FIELDS) {
1680
+ const dependencies = packageJson[field];
1681
+ if (!dependencies) continue;
1682
+ for (const packageName of Object.keys(dependencies)) {
1683
+ if (isLegacyDreamboardPackage(packageName)) {
1684
+ problems.push({ location: field, packageName });
1685
+ }
1686
+ }
1687
+ }
1688
+ const overrides = packageJson.pnpm?.overrides;
1689
+ if (overrides) {
1690
+ for (const packageName of Object.keys(overrides)) {
1691
+ if (isLegacyDreamboardPackage(packageName)) {
1692
+ problems.push({ location: "pnpm.overrides", packageName });
1693
+ }
1694
+ }
1695
+ }
1696
+ return problems;
1697
+ }
1698
+ function throwLegacyDreamboardPackageError(problems) {
1699
+ const details = problems.map((problem) => `${problem.location} ${problem.packageName}`).join("; ");
1700
+ throw new Error(
1701
+ [
1702
+ "Legacy @dreamboard/* package dependencies are no longer supported in compiler-bound workspaces.",
1703
+ `Found ${details}.`,
1704
+ "Repin to the public @dreamboard-games/* packages and rerun the command."
1705
+ ].join(" ")
1706
+ );
1707
+ }
1708
+ function isPortableDreamboardPackage(packageName) {
1709
+ return packageName === "dreamboard" || packageName.startsWith("@dreamboard-games/");
1710
+ }
1711
+ function isLegacyDreamboardPackage(packageName) {
1712
+ return packageName.startsWith("@dreamboard/");
1713
+ }
1714
+ function isReleaseEnvironment(environment) {
1715
+ return environment === "staging" || environment === "prod";
1716
+ }
1717
+ function isLocalRegistryUrl(rawUrl) {
1718
+ if (!rawUrl) return false;
1719
+ try {
1720
+ const url = new URL(rawUrl);
1721
+ return url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "::1" || url.hostname.endsWith(".local");
1722
+ } catch {
1723
+ return /localhost|127\.0\.0\.1|\.local\b/.test(rawUrl);
1724
+ }
1725
+ }
1726
+ async function readDreamboardRegistryFromNpmrc(projectRoot) {
1727
+ const npmrc = await readTextFileIfExists(path.join(projectRoot, ".npmrc"));
1728
+ if (!npmrc) return void 0;
1729
+ for (const line of npmrc.split(/\r?\n/)) {
1730
+ const trimmed = line.trim();
1731
+ if (!trimmed.startsWith("@dreamboard-games:registry=")) continue;
1732
+ return trimmed.slice("@dreamboard-games:registry=".length).trim() || void 0;
1733
+ }
1734
+ return void 0;
1735
+ }
1736
+
1737
+ export {
1738
+ consola,
1739
+ configureClient,
1740
+ resolveProjectContext,
1741
+ assertCompilerPortableDependencies,
1742
+ assertReleaseEnvironmentPortableDependencies
1743
+ };
1744
+ //# sourceMappingURL=chunk-JO5AMVZU.mjs.map