@dreamboard-games/cli 0.1.30-alpha.19 → 0.1.30-alpha.20

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 (97) hide show
  1. package/README.md +22 -102
  2. package/dist/agent-verifier/agent-workspace-verifier.mjs +1508 -55
  3. package/dist/agent-verifier/agent-workspace-verifier.mjs.map +1 -1
  4. package/dist/agent-verifier/{chunk-V7ABTZXW.mjs → chunk-4I2WWAPK.mjs} +26 -7
  5. package/dist/agent-verifier/chunk-4I2WWAPK.mjs.map +1 -0
  6. package/dist/agent-verifier/{chunk-7LFDFXLS.mjs → chunk-BWBN2TDJ.mjs} +338 -133
  7. package/dist/agent-verifier/chunk-BWBN2TDJ.mjs.map +1 -0
  8. package/dist/agent-verifier/{chunk-AWZ4M4NS.mjs → chunk-DQUYBIGQ.mjs} +5 -6
  9. package/dist/agent-verifier/chunk-DQUYBIGQ.mjs.map +1 -0
  10. package/dist/agent-verifier/{chunk-H5L4KK4Y.mjs → chunk-GCFGAFYC.mjs} +7 -7
  11. package/dist/agent-verifier/chunk-GCFGAFYC.mjs.map +1 -0
  12. package/dist/agent-verifier/{chunk-TAEQKBJB.mjs → chunk-GWRZRWCF.mjs} +1 -1
  13. package/dist/agent-verifier/chunk-GWRZRWCF.mjs.map +1 -0
  14. package/dist/agent-verifier/{chunk-6AKXIY37.mjs → chunk-IWB4L2HV.mjs} +3 -3
  15. package/dist/agent-verifier/chunk-IWB4L2HV.mjs.map +1 -0
  16. package/dist/agent-verifier/{chunk-334H4LE4.mjs → chunk-KDAQ4CZY.mjs} +3 -3
  17. package/dist/agent-verifier/{chunk-WSIYUUSD.mjs → chunk-TIDX3YLW.mjs} +2 -2
  18. package/dist/agent-verifier/{chunk-WSIYUUSD.mjs.map → chunk-TIDX3YLW.mjs.map} +1 -1
  19. package/dist/agent-verifier/{chunk-UMW24KZI.mjs → chunk-UXGTT25Q.mjs} +3 -3
  20. package/dist/agent-verifier/{global-config-SXR6X3OZ.mjs → global-config-IXZLY4BS.mjs} +4 -4
  21. package/dist/agent-verifier/{local-files-DAFIR7SN.mjs → local-files-OF4QFISU.mjs} +4 -4
  22. package/dist/agent-verifier/{chunk-POBFNXD4.mjs → local-typecheck-DHVLM37Z.mjs} +3 -3
  23. package/dist/agent-verifier/local-typecheck-DHVLM37Z.mjs.map +1 -0
  24. package/dist/agent-verifier/{materialize-workspace-PWNT6HQK.mjs → materialize-workspace-VS5RHSBO.mjs} +7 -7
  25. package/dist/agent-verifier/{chunk-HLHT57AW.mjs → reducer-bundle-preflight-GLUJKTWU.mjs} +13 -10
  26. package/dist/agent-verifier/reducer-bundle-preflight-GLUJKTWU.mjs.map +1 -0
  27. package/dist/agent-verifier/{chunk-INIK6LHK.mjs → reducer-contract-preflight-WVQQPW5F.mjs} +6 -5
  28. package/dist/agent-verifier/reducer-contract-preflight-WVQQPW5F.mjs.map +1 -0
  29. package/dist/agent-verifier/{chunk-3Y4FRMTK.mjs → reducer-native-test-harness-H6G6RBRY.mjs} +150 -34
  30. package/dist/agent-verifier/reducer-native-test-harness-H6G6RBRY.mjs.map +1 -0
  31. package/dist/agent-verifier/{static-scaffold-HXUQLJVN.mjs → static-scaffold-C36KROJA.mjs} +3 -3
  32. package/dist/agent-verifier/{workspace-dependencies-ZMHPHVQV.mjs → workspace-dependencies-5HEEKZFP.mjs} +4 -2
  33. package/dist/authoring-compatibility-internal.js +2 -2
  34. package/dist/{chunk-R6RB4EKH.js → chunk-5PJWUB6W.js} +179 -210
  35. package/dist/chunk-5PJWUB6W.js.map +1 -0
  36. package/dist/{chunk-YRSE5DLH.js → chunk-EJGB3IR7.js} +422 -264
  37. package/dist/chunk-EJGB3IR7.js.map +1 -0
  38. package/dist/{chunk-FFO2IJL3.js → chunk-EQNBQVIW.js} +1 -1
  39. package/dist/chunk-EQNBQVIW.js.map +1 -0
  40. package/dist/{chunk-VWMKJL4A.js → chunk-UI7NWSYA.js} +3 -3
  41. package/dist/chunk-UI7NWSYA.js.map +1 -0
  42. package/dist/{global-config-UHGWFJIK.js → global-config-GK2UC2X6.js} +3 -3
  43. package/dist/index.js +2691 -3953
  44. package/dist/index.js.map +1 -1
  45. package/dist/internal.js +4 -4
  46. package/package.json +1 -1
  47. package/release/authoring-release-set.json +2 -2
  48. package/skills/dreamboard/SKILL.md +30 -28
  49. package/skills/dreamboard/references/building-your-first-game.md +15 -15
  50. package/skills/dreamboard/references/cli.md +48 -47
  51. package/skills/dreamboard/references/quickstart.md +16 -13
  52. package/skills/dreamboard/references/testing.md +10 -10
  53. package/dist/agent-verifier/chunk-3Y4FRMTK.mjs.map +0 -1
  54. package/dist/agent-verifier/chunk-5D3OJBDT.mjs +0 -1547
  55. package/dist/agent-verifier/chunk-5D3OJBDT.mjs.map +0 -1
  56. package/dist/agent-verifier/chunk-6AKXIY37.mjs.map +0 -1
  57. package/dist/agent-verifier/chunk-7LFDFXLS.mjs.map +0 -1
  58. package/dist/agent-verifier/chunk-AWZ4M4NS.mjs.map +0 -1
  59. package/dist/agent-verifier/chunk-H5L4KK4Y.mjs.map +0 -1
  60. package/dist/agent-verifier/chunk-HLHT57AW.mjs.map +0 -1
  61. package/dist/agent-verifier/chunk-INIK6LHK.mjs.map +0 -1
  62. package/dist/agent-verifier/chunk-LEWM26XR.mjs +0 -618
  63. package/dist/agent-verifier/chunk-LEWM26XR.mjs.map +0 -1
  64. package/dist/agent-verifier/chunk-PLXXH5LY.mjs +0 -222
  65. package/dist/agent-verifier/chunk-PLXXH5LY.mjs.map +0 -1
  66. package/dist/agent-verifier/chunk-POBFNXD4.mjs.map +0 -1
  67. package/dist/agent-verifier/chunk-TAEQKBJB.mjs.map +0 -1
  68. package/dist/agent-verifier/chunk-V7ABTZXW.mjs.map +0 -1
  69. package/dist/agent-verifier/chunk-ZOR5FTIG.mjs +0 -39
  70. package/dist/agent-verifier/chunk-ZOR5FTIG.mjs.map +0 -1
  71. package/dist/agent-verifier/compile-MO2URO5Z.mjs +0 -317
  72. package/dist/agent-verifier/compile-MO2URO5Z.mjs.map +0 -1
  73. package/dist/agent-verifier/local-typecheck-3JXL2NMG.mjs +0 -10
  74. package/dist/agent-verifier/reducer-bundle-preflight-3DSXIELT.mjs +0 -20
  75. package/dist/agent-verifier/reducer-contract-preflight-FQB7M4PU.mjs +0 -11
  76. package/dist/agent-verifier/reducer-native-test-harness-X2KQYSCD.mjs +0 -53
  77. package/dist/agent-verifier/reducer-native-test-harness-X2KQYSCD.mjs.map +0 -1
  78. package/dist/agent-verifier/static-scaffold-HXUQLJVN.mjs.map +0 -1
  79. package/dist/agent-verifier/sync-5YM4CSXL.mjs +0 -598
  80. package/dist/agent-verifier/sync-5YM4CSXL.mjs.map +0 -1
  81. package/dist/agent-verifier/test-CNNVTFIG.mjs +0 -356
  82. package/dist/agent-verifier/test-CNNVTFIG.mjs.map +0 -1
  83. package/dist/agent-verifier/workspace-dependencies-ZMHPHVQV.mjs.map +0 -1
  84. package/dist/chunk-FFO2IJL3.js.map +0 -1
  85. package/dist/chunk-R6RB4EKH.js.map +0 -1
  86. package/dist/chunk-VWMKJL4A.js.map +0 -1
  87. package/dist/chunk-YRSE5DLH.js.map +0 -1
  88. package/dist/global-config-UHGWFJIK.js.map +0 -1
  89. package/skills/dreamboard/scripts/events-extract.mjs +0 -218
  90. /package/dist/agent-verifier/{chunk-334H4LE4.mjs.map → chunk-KDAQ4CZY.mjs.map} +0 -0
  91. /package/dist/agent-verifier/{chunk-UMW24KZI.mjs.map → chunk-UXGTT25Q.mjs.map} +0 -0
  92. /package/dist/agent-verifier/{global-config-SXR6X3OZ.mjs.map → global-config-IXZLY4BS.mjs.map} +0 -0
  93. /package/dist/agent-verifier/{local-files-DAFIR7SN.mjs.map → local-files-OF4QFISU.mjs.map} +0 -0
  94. /package/dist/agent-verifier/{materialize-workspace-PWNT6HQK.mjs.map → materialize-workspace-VS5RHSBO.mjs.map} +0 -0
  95. /package/dist/agent-verifier/{local-typecheck-3JXL2NMG.mjs.map → static-scaffold-C36KROJA.mjs.map} +0 -0
  96. /package/dist/agent-verifier/{reducer-bundle-preflight-3DSXIELT.mjs.map → workspace-dependencies-5HEEKZFP.mjs.map} +0 -0
  97. /package/dist/{agent-verifier/reducer-contract-preflight-FQB7M4PU.mjs.map → global-config-GK2UC2X6.js.map} +0 -0
@@ -1,21 +1,1508 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- assertCompilerPortableDependencies,
4
- consola,
5
- resolveProjectContext
6
- } from "./chunk-5D3OJBDT.mjs";
7
- import "./chunk-WSIYUUSD.mjs";
8
- import "./chunk-AWZ4M4NS.mjs";
9
- import "./chunk-UMW24KZI.mjs";
10
- import "./chunk-6AKXIY37.mjs";
11
- import "./chunk-TAEQKBJB.mjs";
12
- import "./chunk-RDYXWXXC.mjs";
13
- import "./chunk-MYMVXTZT.mjs";
14
- import "./chunk-M7UVBANQ.mjs";
3
+ findProjectRoot,
4
+ loadProjectConfig
5
+ } from "./chunk-TIDX3YLW.mjs";
6
+ import {
7
+ IS_PUBLISHED_BUILD,
8
+ PUBLISHED_ENVIRONMENT,
9
+ createUserTokenManager,
10
+ resolveLocalHarnessAccessToken
11
+ } from "./chunk-DQUYBIGQ.mjs";
12
+ import {
13
+ loadGlobalConfig
14
+ } from "./chunk-UXGTT25Q.mjs";
15
+ import {
16
+ getStoredSession
17
+ } from "./chunk-IWB4L2HV.mjs";
18
+ import "./chunk-GWRZRWCF.mjs";
19
+ import {
20
+ readJsonFile,
21
+ readTextFileIfExists
22
+ } from "./chunk-RDYXWXXC.mjs";
23
+ import {
24
+ client
25
+ } from "./chunk-MYMVXTZT.mjs";
26
+ import {
27
+ DEFAULT_API_BASE_URL,
28
+ DEFAULT_WEB_BASE_URL,
29
+ ENVIRONMENT_CONFIGS
30
+ } from "./chunk-M7UVBANQ.mjs";
15
31
  import "./chunk-H6XDQJ3N.mjs";
16
32
 
17
33
  // src/agent-verifier/agent-workspace-verifier.ts
18
34
  import { readFile } from "fs/promises";
35
+
36
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
37
+ var LogLevels = {
38
+ silent: Number.NEGATIVE_INFINITY,
39
+ fatal: 0,
40
+ error: 0,
41
+ warn: 1,
42
+ log: 2,
43
+ info: 3,
44
+ success: 3,
45
+ fail: 3,
46
+ ready: 3,
47
+ start: 3,
48
+ box: 3,
49
+ debug: 4,
50
+ trace: 5,
51
+ verbose: Number.POSITIVE_INFINITY
52
+ };
53
+ var LogTypes = {
54
+ // Silent
55
+ silent: {
56
+ level: -1
57
+ },
58
+ // Level 0
59
+ fatal: {
60
+ level: LogLevels.fatal
61
+ },
62
+ error: {
63
+ level: LogLevels.error
64
+ },
65
+ // Level 1
66
+ warn: {
67
+ level: LogLevels.warn
68
+ },
69
+ // Level 2
70
+ log: {
71
+ level: LogLevels.log
72
+ },
73
+ // Level 3
74
+ info: {
75
+ level: LogLevels.info
76
+ },
77
+ success: {
78
+ level: LogLevels.success
79
+ },
80
+ fail: {
81
+ level: LogLevels.fail
82
+ },
83
+ ready: {
84
+ level: LogLevels.info
85
+ },
86
+ start: {
87
+ level: LogLevels.info
88
+ },
89
+ box: {
90
+ level: LogLevels.info
91
+ },
92
+ // Level 4
93
+ debug: {
94
+ level: LogLevels.debug
95
+ },
96
+ // Level 5
97
+ trace: {
98
+ level: LogLevels.trace
99
+ },
100
+ // Verbose
101
+ verbose: {
102
+ level: LogLevels.verbose
103
+ }
104
+ };
105
+ function isPlainObject$1(value) {
106
+ if (value === null || typeof value !== "object") {
107
+ return false;
108
+ }
109
+ const prototype = Object.getPrototypeOf(value);
110
+ if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
111
+ return false;
112
+ }
113
+ if (Symbol.iterator in value) {
114
+ return false;
115
+ }
116
+ if (Symbol.toStringTag in value) {
117
+ return Object.prototype.toString.call(value) === "[object Module]";
118
+ }
119
+ return true;
120
+ }
121
+ function _defu(baseObject, defaults, namespace = ".", merger) {
122
+ if (!isPlainObject$1(defaults)) {
123
+ return _defu(baseObject, {}, namespace, merger);
124
+ }
125
+ const object = Object.assign({}, defaults);
126
+ for (const key in baseObject) {
127
+ if (key === "__proto__" || key === "constructor") {
128
+ continue;
129
+ }
130
+ const value = baseObject[key];
131
+ if (value === null || value === void 0) {
132
+ continue;
133
+ }
134
+ if (merger && merger(object, key, value, namespace)) {
135
+ continue;
136
+ }
137
+ if (Array.isArray(value) && Array.isArray(object[key])) {
138
+ object[key] = [...value, ...object[key]];
139
+ } else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
140
+ object[key] = _defu(
141
+ value,
142
+ object[key],
143
+ (namespace ? `${namespace}.` : "") + key.toString(),
144
+ merger
145
+ );
146
+ } else {
147
+ object[key] = value;
148
+ }
149
+ }
150
+ return object;
151
+ }
152
+ function createDefu(merger) {
153
+ return (...arguments_) => (
154
+ // eslint-disable-next-line unicorn/no-array-reduce
155
+ arguments_.reduce((p, c2) => _defu(p, c2, "", merger), {})
156
+ );
157
+ }
158
+ var defu = createDefu();
159
+ function isPlainObject(obj) {
160
+ return Object.prototype.toString.call(obj) === "[object Object]";
161
+ }
162
+ function isLogObj(arg) {
163
+ if (!isPlainObject(arg)) {
164
+ return false;
165
+ }
166
+ if (!arg.message && !arg.args) {
167
+ return false;
168
+ }
169
+ if (arg.stack) {
170
+ return false;
171
+ }
172
+ return true;
173
+ }
174
+ var paused = false;
175
+ var queue = [];
176
+ var Consola = class _Consola {
177
+ options;
178
+ _lastLog;
179
+ _mockFn;
180
+ /**
181
+ * Creates an instance of Consola with specified options or defaults.
182
+ *
183
+ * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
184
+ */
185
+ constructor(options = {}) {
186
+ const types = options.types || LogTypes;
187
+ this.options = defu(
188
+ {
189
+ ...options,
190
+ defaults: { ...options.defaults },
191
+ level: _normalizeLogLevel(options.level, types),
192
+ reporters: [...options.reporters || []]
193
+ },
194
+ {
195
+ types: LogTypes,
196
+ throttle: 1e3,
197
+ throttleMin: 5,
198
+ formatOptions: {
199
+ date: true,
200
+ colors: false,
201
+ compact: true
202
+ }
203
+ }
204
+ );
205
+ for (const type in types) {
206
+ const defaults = {
207
+ type,
208
+ ...this.options.defaults,
209
+ ...types[type]
210
+ };
211
+ this[type] = this._wrapLogFn(defaults);
212
+ this[type].raw = this._wrapLogFn(
213
+ defaults,
214
+ true
215
+ );
216
+ }
217
+ if (this.options.mockFn) {
218
+ this.mockTypes();
219
+ }
220
+ this._lastLog = {};
221
+ }
222
+ /**
223
+ * Gets the current log level of the Consola instance.
224
+ *
225
+ * @returns {number} The current log level.
226
+ */
227
+ get level() {
228
+ return this.options.level;
229
+ }
230
+ /**
231
+ * Sets the minimum log level that will be output by the instance.
232
+ *
233
+ * @param {number} level - The new log level to set.
234
+ */
235
+ set level(level) {
236
+ this.options.level = _normalizeLogLevel(
237
+ level,
238
+ this.options.types,
239
+ this.options.level
240
+ );
241
+ }
242
+ /**
243
+ * Displays a prompt to the user and returns the response.
244
+ * Throw an error if `prompt` is not supported by the current configuration.
245
+ *
246
+ * @template T
247
+ * @param {string} message - The message to display in the prompt.
248
+ * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
249
+ * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
250
+ */
251
+ prompt(message, opts) {
252
+ if (!this.options.prompt) {
253
+ throw new Error("prompt is not supported!");
254
+ }
255
+ return this.options.prompt(message, opts);
256
+ }
257
+ /**
258
+ * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
259
+ *
260
+ * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
261
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
262
+ */
263
+ create(options) {
264
+ const instance = new _Consola({
265
+ ...this.options,
266
+ ...options
267
+ });
268
+ if (this._mockFn) {
269
+ instance.mockTypes(this._mockFn);
270
+ }
271
+ return instance;
272
+ }
273
+ /**
274
+ * Creates a new Consola instance with the specified default log object properties.
275
+ *
276
+ * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
277
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
278
+ */
279
+ withDefaults(defaults) {
280
+ return this.create({
281
+ ...this.options,
282
+ defaults: {
283
+ ...this.options.defaults,
284
+ ...defaults
285
+ }
286
+ });
287
+ }
288
+ /**
289
+ * Creates a new Consola instance with a specified tag, which will be included in every log.
290
+ *
291
+ * @param {string} tag - The tag to include in each log of the new instance.
292
+ * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
293
+ */
294
+ withTag(tag) {
295
+ return this.withDefaults({
296
+ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
297
+ });
298
+ }
299
+ /**
300
+ * Adds a custom reporter to the Consola instance.
301
+ * Reporters will be called for each log message, depending on their implementation and log level.
302
+ *
303
+ * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
304
+ * @returns {Consola} The current Consola instance.
305
+ */
306
+ addReporter(reporter) {
307
+ this.options.reporters.push(reporter);
308
+ return this;
309
+ }
310
+ /**
311
+ * Removes a custom reporter from the Consola instance.
312
+ * If no reporter is specified, all reporters will be removed.
313
+ *
314
+ * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
315
+ * @returns {Consola} The current Consola instance.
316
+ */
317
+ removeReporter(reporter) {
318
+ if (reporter) {
319
+ const i2 = this.options.reporters.indexOf(reporter);
320
+ if (i2 !== -1) {
321
+ return this.options.reporters.splice(i2, 1);
322
+ }
323
+ } else {
324
+ this.options.reporters.splice(0);
325
+ }
326
+ return this;
327
+ }
328
+ /**
329
+ * Replaces all reporters of the Consola instance with the specified array of reporters.
330
+ *
331
+ * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
332
+ * @returns {Consola} The current Consola instance.
333
+ */
334
+ setReporters(reporters) {
335
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
336
+ return this;
337
+ }
338
+ wrapAll() {
339
+ this.wrapConsole();
340
+ this.wrapStd();
341
+ }
342
+ restoreAll() {
343
+ this.restoreConsole();
344
+ this.restoreStd();
345
+ }
346
+ /**
347
+ * Overrides console methods with Consola logging methods for consistent logging.
348
+ */
349
+ wrapConsole() {
350
+ for (const type in this.options.types) {
351
+ if (!console["__" + type]) {
352
+ console["__" + type] = console[type];
353
+ }
354
+ console[type] = this[type].raw;
355
+ }
356
+ }
357
+ /**
358
+ * Restores the original console methods, removing Consola overrides.
359
+ */
360
+ restoreConsole() {
361
+ for (const type in this.options.types) {
362
+ if (console["__" + type]) {
363
+ console[type] = console["__" + type];
364
+ delete console["__" + type];
365
+ }
366
+ }
367
+ }
368
+ /**
369
+ * Overrides standard output and error streams to redirect them through Consola.
370
+ */
371
+ wrapStd() {
372
+ this._wrapStream(this.options.stdout, "log");
373
+ this._wrapStream(this.options.stderr, "log");
374
+ }
375
+ _wrapStream(stream, type) {
376
+ if (!stream) {
377
+ return;
378
+ }
379
+ if (!stream.__write) {
380
+ stream.__write = stream.write;
381
+ }
382
+ stream.write = (data) => {
383
+ this[type].raw(String(data).trim());
384
+ };
385
+ }
386
+ /**
387
+ * Restores the original standard output and error streams, removing the Consola redirection.
388
+ */
389
+ restoreStd() {
390
+ this._restoreStream(this.options.stdout);
391
+ this._restoreStream(this.options.stderr);
392
+ }
393
+ _restoreStream(stream) {
394
+ if (!stream) {
395
+ return;
396
+ }
397
+ if (stream.__write) {
398
+ stream.write = stream.__write;
399
+ delete stream.__write;
400
+ }
401
+ }
402
+ /**
403
+ * Pauses logging, queues incoming logs until resumed.
404
+ */
405
+ pauseLogs() {
406
+ paused = true;
407
+ }
408
+ /**
409
+ * Resumes logging, processing any queued logs.
410
+ */
411
+ resumeLogs() {
412
+ paused = false;
413
+ const _queue = queue.splice(0);
414
+ for (const item of _queue) {
415
+ item[0]._logFn(item[1], item[2]);
416
+ }
417
+ }
418
+ /**
419
+ * Replaces logging methods with mocks if a mock function is provided.
420
+ *
421
+ * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
422
+ */
423
+ mockTypes(mockFn) {
424
+ const _mockFn = mockFn || this.options.mockFn;
425
+ this._mockFn = _mockFn;
426
+ if (typeof _mockFn !== "function") {
427
+ return;
428
+ }
429
+ for (const type in this.options.types) {
430
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
431
+ this[type].raw = this[type];
432
+ }
433
+ }
434
+ _wrapLogFn(defaults, isRaw) {
435
+ return (...args) => {
436
+ if (paused) {
437
+ queue.push([this, defaults, args, isRaw]);
438
+ return;
439
+ }
440
+ return this._logFn(defaults, args, isRaw);
441
+ };
442
+ }
443
+ _logFn(defaults, args, isRaw) {
444
+ if ((defaults.level || 0) > this.level) {
445
+ return false;
446
+ }
447
+ const logObj = {
448
+ date: /* @__PURE__ */ new Date(),
449
+ args: [],
450
+ ...defaults,
451
+ level: _normalizeLogLevel(defaults.level, this.options.types)
452
+ };
453
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) {
454
+ Object.assign(logObj, args[0]);
455
+ } else {
456
+ logObj.args = [...args];
457
+ }
458
+ if (logObj.message) {
459
+ logObj.args.unshift(logObj.message);
460
+ delete logObj.message;
461
+ }
462
+ if (logObj.additional) {
463
+ if (!Array.isArray(logObj.additional)) {
464
+ logObj.additional = logObj.additional.split("\n");
465
+ }
466
+ logObj.args.push("\n" + logObj.additional.join("\n"));
467
+ delete logObj.additional;
468
+ }
469
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
470
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
471
+ const resolveLog = (newLog = false) => {
472
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
473
+ if (this._lastLog.object && repeated > 0) {
474
+ const args2 = [...this._lastLog.object.args];
475
+ if (repeated > 1) {
476
+ args2.push(`(repeated ${repeated} times)`);
477
+ }
478
+ this._log({ ...this._lastLog.object, args: args2 });
479
+ this._lastLog.count = 1;
480
+ }
481
+ if (newLog) {
482
+ this._lastLog.object = logObj;
483
+ this._log(logObj);
484
+ }
485
+ };
486
+ clearTimeout(this._lastLog.timeout);
487
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
488
+ this._lastLog.time = logObj.date;
489
+ if (diffTime < this.options.throttle) {
490
+ try {
491
+ const serializedLog = JSON.stringify([
492
+ logObj.type,
493
+ logObj.tag,
494
+ logObj.args
495
+ ]);
496
+ const isSameLog = this._lastLog.serialized === serializedLog;
497
+ this._lastLog.serialized = serializedLog;
498
+ if (isSameLog) {
499
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
500
+ if (this._lastLog.count > this.options.throttleMin) {
501
+ this._lastLog.timeout = setTimeout(
502
+ resolveLog,
503
+ this.options.throttle
504
+ );
505
+ return;
506
+ }
507
+ }
508
+ } catch {
509
+ }
510
+ }
511
+ resolveLog(true);
512
+ }
513
+ _log(logObj) {
514
+ for (const reporter of this.options.reporters) {
515
+ reporter.log(logObj, {
516
+ options: this.options
517
+ });
518
+ }
519
+ }
520
+ };
521
+ function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
522
+ if (input === void 0) {
523
+ return defaultLevel;
524
+ }
525
+ if (typeof input === "number") {
526
+ return input;
527
+ }
528
+ if (types[input] && types[input].level !== void 0) {
529
+ return types[input].level;
530
+ }
531
+ return defaultLevel;
532
+ }
533
+ Consola.prototype.add = Consola.prototype.addReporter;
534
+ Consola.prototype.remove = Consola.prototype.removeReporter;
535
+ Consola.prototype.clear = Consola.prototype.removeReporter;
536
+ Consola.prototype.withScope = Consola.prototype.withTag;
537
+ Consola.prototype.mock = Consola.prototype.mockTypes;
538
+ Consola.prototype.pause = Consola.prototype.pauseLogs;
539
+ Consola.prototype.resume = Consola.prototype.resumeLogs;
540
+ function createConsola(options = {}) {
541
+ return new Consola(options);
542
+ }
543
+
544
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
545
+ import { formatWithOptions } from "util";
546
+ import { sep } from "path";
547
+ function parseStack(stack, message) {
548
+ const cwd = process.cwd() + sep;
549
+ const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
550
+ return lines;
551
+ }
552
+ function writeStream(data, stream) {
553
+ const write = stream.__write || stream.write;
554
+ return write.call(stream, data);
555
+ }
556
+ var bracket = (x) => x ? `[${x}]` : "";
557
+ var BasicReporter = class {
558
+ formatStack(stack, message, opts) {
559
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
560
+ return indent + parseStack(stack, message).join(`
561
+ ${indent}`);
562
+ }
563
+ formatError(err, opts) {
564
+ const message = err.message ?? formatWithOptions(opts, err);
565
+ const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
566
+ const level = opts?.errorLevel || 0;
567
+ const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
568
+ const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
569
+ return causedPrefix + message + "\n" + stack + causedError;
570
+ }
571
+ formatArgs(args, opts) {
572
+ const _args = args.map((arg) => {
573
+ if (arg && typeof arg.stack === "string") {
574
+ return this.formatError(arg, opts);
575
+ }
576
+ return arg;
577
+ });
578
+ return formatWithOptions(opts, ..._args);
579
+ }
580
+ formatDate(date, opts) {
581
+ return opts.date ? date.toLocaleTimeString() : "";
582
+ }
583
+ filterAndJoin(arr) {
584
+ return arr.filter(Boolean).join(" ");
585
+ }
586
+ formatLogObj(logObj, opts) {
587
+ const message = this.formatArgs(logObj.args, opts);
588
+ if (logObj.type === "box") {
589
+ return "\n" + [
590
+ bracket(logObj.tag),
591
+ logObj.title && logObj.title,
592
+ ...message.split("\n")
593
+ ].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
594
+ }
595
+ return this.filterAndJoin([
596
+ bracket(logObj.type),
597
+ bracket(logObj.tag),
598
+ message
599
+ ]);
600
+ }
601
+ log(logObj, ctx) {
602
+ const line = this.formatLogObj(logObj, {
603
+ columns: ctx.options.stdout.columns || 0,
604
+ ...ctx.options.formatOptions
605
+ });
606
+ return writeStream(
607
+ line + "\n",
608
+ logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
609
+ );
610
+ }
611
+ };
612
+
613
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
614
+ import g$1 from "process";
615
+
616
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
617
+ import * as tty from "tty";
618
+ var {
619
+ env = {},
620
+ argv = [],
621
+ platform = ""
622
+ } = typeof process === "undefined" ? {} : process;
623
+ var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
624
+ var isForced = "FORCE_COLOR" in env || argv.includes("--color");
625
+ var isWindows = platform === "win32";
626
+ var isDumbTerminal = env.TERM === "dumb";
627
+ var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
628
+ var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
629
+ var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
630
+ 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)) {
631
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
632
+ }
633
+ function clearBleed(index, string, open, close, replace) {
634
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
635
+ }
636
+ function filterEmpty(open, close, replace = open, at = open.length + 1) {
637
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(
638
+ ("" + string).indexOf(close, at),
639
+ string,
640
+ open,
641
+ close,
642
+ replace
643
+ ) : "";
644
+ }
645
+ function init(open, close, replace) {
646
+ return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
647
+ }
648
+ var colorDefs = {
649
+ reset: init(0, 0),
650
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
651
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
652
+ italic: init(3, 23),
653
+ underline: init(4, 24),
654
+ inverse: init(7, 27),
655
+ hidden: init(8, 28),
656
+ strikethrough: init(9, 29),
657
+ black: init(30, 39),
658
+ red: init(31, 39),
659
+ green: init(32, 39),
660
+ yellow: init(33, 39),
661
+ blue: init(34, 39),
662
+ magenta: init(35, 39),
663
+ cyan: init(36, 39),
664
+ white: init(37, 39),
665
+ gray: init(90, 39),
666
+ bgBlack: init(40, 49),
667
+ bgRed: init(41, 49),
668
+ bgGreen: init(42, 49),
669
+ bgYellow: init(43, 49),
670
+ bgBlue: init(44, 49),
671
+ bgMagenta: init(45, 49),
672
+ bgCyan: init(46, 49),
673
+ bgWhite: init(47, 49),
674
+ blackBright: init(90, 39),
675
+ redBright: init(91, 39),
676
+ greenBright: init(92, 39),
677
+ yellowBright: init(93, 39),
678
+ blueBright: init(94, 39),
679
+ magentaBright: init(95, 39),
680
+ cyanBright: init(96, 39),
681
+ whiteBright: init(97, 39),
682
+ bgBlackBright: init(100, 49),
683
+ bgRedBright: init(101, 49),
684
+ bgGreenBright: init(102, 49),
685
+ bgYellowBright: init(103, 49),
686
+ bgBlueBright: init(104, 49),
687
+ bgMagentaBright: init(105, 49),
688
+ bgCyanBright: init(106, 49),
689
+ bgWhiteBright: init(107, 49)
690
+ };
691
+ function createColors(useColor = isColorSupported) {
692
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
693
+ }
694
+ var colors = createColors();
695
+ function getColor(color, fallback = "reset") {
696
+ return colors[color] || colors[fallback];
697
+ }
698
+ var ansiRegex = [
699
+ String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
700
+ String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
701
+ ].join("|");
702
+ function stripAnsi(text) {
703
+ return text.replace(new RegExp(ansiRegex, "g"), "");
704
+ }
705
+ var boxStylePresets = {
706
+ solid: {
707
+ tl: "\u250C",
708
+ tr: "\u2510",
709
+ bl: "\u2514",
710
+ br: "\u2518",
711
+ h: "\u2500",
712
+ v: "\u2502"
713
+ },
714
+ double: {
715
+ tl: "\u2554",
716
+ tr: "\u2557",
717
+ bl: "\u255A",
718
+ br: "\u255D",
719
+ h: "\u2550",
720
+ v: "\u2551"
721
+ },
722
+ doubleSingle: {
723
+ tl: "\u2553",
724
+ tr: "\u2556",
725
+ bl: "\u2559",
726
+ br: "\u255C",
727
+ h: "\u2500",
728
+ v: "\u2551"
729
+ },
730
+ doubleSingleRounded: {
731
+ tl: "\u256D",
732
+ tr: "\u256E",
733
+ bl: "\u2570",
734
+ br: "\u256F",
735
+ h: "\u2500",
736
+ v: "\u2551"
737
+ },
738
+ singleThick: {
739
+ tl: "\u250F",
740
+ tr: "\u2513",
741
+ bl: "\u2517",
742
+ br: "\u251B",
743
+ h: "\u2501",
744
+ v: "\u2503"
745
+ },
746
+ singleDouble: {
747
+ tl: "\u2552",
748
+ tr: "\u2555",
749
+ bl: "\u2558",
750
+ br: "\u255B",
751
+ h: "\u2550",
752
+ v: "\u2502"
753
+ },
754
+ singleDoubleRounded: {
755
+ tl: "\u256D",
756
+ tr: "\u256E",
757
+ bl: "\u2570",
758
+ br: "\u256F",
759
+ h: "\u2550",
760
+ v: "\u2502"
761
+ },
762
+ rounded: {
763
+ tl: "\u256D",
764
+ tr: "\u256E",
765
+ bl: "\u2570",
766
+ br: "\u256F",
767
+ h: "\u2500",
768
+ v: "\u2502"
769
+ }
770
+ };
771
+ var defaultStyle = {
772
+ borderColor: "white",
773
+ borderStyle: "rounded",
774
+ valign: "center",
775
+ padding: 2,
776
+ marginLeft: 1,
777
+ marginTop: 1,
778
+ marginBottom: 1
779
+ };
780
+ function box(text, _opts = {}) {
781
+ const opts = {
782
+ ..._opts,
783
+ style: {
784
+ ...defaultStyle,
785
+ ..._opts.style
786
+ }
787
+ };
788
+ const textLines = text.split("\n");
789
+ const boxLines = [];
790
+ const _color = getColor(opts.style.borderColor);
791
+ const borderStyle = {
792
+ ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
793
+ };
794
+ if (_color) {
795
+ for (const key in borderStyle) {
796
+ borderStyle[key] = _color(
797
+ borderStyle[key]
798
+ );
799
+ }
800
+ }
801
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
802
+ const height = textLines.length + paddingOffset;
803
+ const width = Math.max(
804
+ ...textLines.map((line) => stripAnsi(line).length),
805
+ opts.title ? stripAnsi(opts.title).length : 0
806
+ ) + paddingOffset;
807
+ const widthOffset = width + paddingOffset;
808
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
809
+ if (opts.style.marginTop > 0) {
810
+ boxLines.push("".repeat(opts.style.marginTop));
811
+ }
812
+ if (opts.title) {
813
+ const title = _color ? _color(opts.title) : opts.title;
814
+ const left = borderStyle.h.repeat(
815
+ Math.floor((width - stripAnsi(opts.title).length) / 2)
816
+ );
817
+ const right = borderStyle.h.repeat(
818
+ width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
819
+ );
820
+ boxLines.push(
821
+ `${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
822
+ );
823
+ } else {
824
+ boxLines.push(
825
+ `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
826
+ );
827
+ }
828
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
829
+ for (let i2 = 0; i2 < height; i2++) {
830
+ if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
831
+ boxLines.push(
832
+ `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
833
+ );
834
+ } else {
835
+ const line = textLines[i2 - valignOffset];
836
+ const left = " ".repeat(paddingOffset);
837
+ const right = " ".repeat(width - stripAnsi(line).length);
838
+ boxLines.push(
839
+ `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
840
+ );
841
+ }
842
+ }
843
+ boxLines.push(
844
+ `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
845
+ );
846
+ if (opts.style.marginBottom > 0) {
847
+ boxLines.push("".repeat(opts.style.marginBottom));
848
+ }
849
+ return boxLines.join("\n");
850
+ }
851
+
852
+ // ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
853
+ import "util";
854
+ import "path";
855
+ import "tty";
856
+ var r = /* @__PURE__ */ Object.create(null);
857
+ var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
858
+ var o = new Proxy(r, { get(e, s2) {
859
+ return i()[s2] ?? r[s2];
860
+ }, has(e, s2) {
861
+ const E = i();
862
+ return s2 in E || s2 in r;
863
+ }, set(e, s2, E) {
864
+ const B = i(true);
865
+ return B[s2] = E, true;
866
+ }, deleteProperty(e, s2) {
867
+ if (!s2) return false;
868
+ const E = i(true);
869
+ return delete E[s2], true;
870
+ }, ownKeys() {
871
+ const e = i(true);
872
+ return Object.keys(e);
873
+ } });
874
+ var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
875
+ 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 }]];
876
+ function b() {
877
+ if (globalThis.process?.env) for (const e of f) {
878
+ const s2 = e[1] || e[0];
879
+ if (globalThis.process?.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
880
+ }
881
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? { name: "stackblitz", ci: false } : { name: "", ci: false };
882
+ }
883
+ var l = b();
884
+ l.name;
885
+ function n(e) {
886
+ return e ? e !== "false" : false;
887
+ }
888
+ var I = globalThis.process?.platform || "";
889
+ var T = n(o.CI) || l.ci !== false;
890
+ var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
891
+ var g = n(o.DEBUG);
892
+ var R = t === "test" || n(o.TEST);
893
+ n(o.MINIMAL) || T || R || !a;
894
+ var A = /^win/i.test(I);
895
+ !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
896
+ var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
897
+ Number(C?.split(".")[0]) || null;
898
+ var y = globalThis.process || /* @__PURE__ */ Object.create(null);
899
+ var _ = { versions: {} };
900
+ new Proxy(y, { get(e, s2) {
901
+ if (s2 === "env") return o;
902
+ if (s2 in e) return e[s2];
903
+ if (s2 in _) return _[s2];
904
+ } });
905
+ var c = globalThis.process?.release?.name === "node";
906
+ var O = !!globalThis.Bun || !!globalThis.process?.versions?.bun;
907
+ var D = !!globalThis.Deno;
908
+ var L = !!globalThis.fastly;
909
+ var S = !!globalThis.Netlify;
910
+ var u = !!globalThis.EdgeRuntime;
911
+ var N = globalThis.navigator?.userAgent === "Cloudflare-Workers";
912
+ var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
913
+ function G() {
914
+ const e = F.find((s2) => s2[0]);
915
+ if (e) return { name: e[1] };
916
+ }
917
+ var P = G();
918
+ P?.name || "";
919
+ function ansiRegex2({ onlyFirst = false } = {}) {
920
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
921
+ const pattern = [
922
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
923
+ "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
924
+ ].join("|");
925
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
926
+ }
927
+ var regex = ansiRegex2();
928
+ function stripAnsi2(string) {
929
+ if (typeof string !== "string") {
930
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
931
+ }
932
+ return string.replace(regex, "");
933
+ }
934
+ function isAmbiguous(x) {
935
+ 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;
936
+ }
937
+ function isFullWidth(x) {
938
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
939
+ }
940
+ function isWide(x) {
941
+ 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;
942
+ }
943
+ function validate(codePoint) {
944
+ if (!Number.isSafeInteger(codePoint)) {
945
+ throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
946
+ }
947
+ }
948
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
949
+ validate(codePoint);
950
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
951
+ return 2;
952
+ }
953
+ return 1;
954
+ }
955
+ var emojiRegex = () => {
956
+ 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;
957
+ };
958
+ var segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
959
+ var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
960
+ function stringWidth$1(string, options = {}) {
961
+ if (typeof string !== "string" || string.length === 0) {
962
+ return 0;
963
+ }
964
+ const {
965
+ ambiguousIsNarrow = true,
966
+ countAnsiEscapeCodes = false
967
+ } = options;
968
+ if (!countAnsiEscapeCodes) {
969
+ string = stripAnsi2(string);
970
+ }
971
+ if (string.length === 0) {
972
+ return 0;
973
+ }
974
+ let width = 0;
975
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
976
+ for (const { segment: character } of segmenter.segment(string)) {
977
+ const codePoint = character.codePointAt(0);
978
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
979
+ continue;
980
+ }
981
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
982
+ continue;
983
+ }
984
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
985
+ continue;
986
+ }
987
+ if (codePoint >= 55296 && codePoint <= 57343) {
988
+ continue;
989
+ }
990
+ if (codePoint >= 65024 && codePoint <= 65039) {
991
+ continue;
992
+ }
993
+ if (defaultIgnorableCodePointRegex.test(character)) {
994
+ continue;
995
+ }
996
+ if (emojiRegex().test(character)) {
997
+ width += 2;
998
+ continue;
999
+ }
1000
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
1001
+ }
1002
+ return width;
1003
+ }
1004
+ function isUnicodeSupported() {
1005
+ const { env: env2 } = g$1;
1006
+ const { TERM, TERM_PROGRAM } = env2;
1007
+ if (g$1.platform !== "win32") {
1008
+ return TERM !== "linux";
1009
+ }
1010
+ 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";
1011
+ }
1012
+ var TYPE_COLOR_MAP = {
1013
+ info: "cyan",
1014
+ fail: "red",
1015
+ success: "green",
1016
+ ready: "green",
1017
+ start: "magenta"
1018
+ };
1019
+ var LEVEL_COLOR_MAP = {
1020
+ 0: "red",
1021
+ 1: "yellow"
1022
+ };
1023
+ var unicode = isUnicodeSupported();
1024
+ var s = (c2, fallback) => unicode ? c2 : fallback;
1025
+ var TYPE_ICONS = {
1026
+ error: s("\u2716", "\xD7"),
1027
+ fatal: s("\u2716", "\xD7"),
1028
+ ready: s("\u2714", "\u221A"),
1029
+ warn: s("\u26A0", "\u203C"),
1030
+ info: s("\u2139", "i"),
1031
+ success: s("\u2714", "\u221A"),
1032
+ debug: s("\u2699", "D"),
1033
+ trace: s("\u2192", "\u2192"),
1034
+ fail: s("\u2716", "\xD7"),
1035
+ start: s("\u25D0", "o"),
1036
+ log: ""
1037
+ };
1038
+ function stringWidth(str) {
1039
+ const hasICU = typeof Intl === "object";
1040
+ if (!hasICU || !Intl.Segmenter) {
1041
+ return stripAnsi(str).length;
1042
+ }
1043
+ return stringWidth$1(str);
1044
+ }
1045
+ var FancyReporter = class extends BasicReporter {
1046
+ formatStack(stack, message, opts) {
1047
+ const indent = " ".repeat((opts?.errorLevel || 0) + 1);
1048
+ return `
1049
+ ${indent}` + parseStack(stack, message).map(
1050
+ (line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
1051
+ ).join(`
1052
+ ${indent}`);
1053
+ }
1054
+ formatType(logObj, isBadge, opts) {
1055
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
1056
+ if (isBadge) {
1057
+ return getBgColor(typeColor)(
1058
+ colors.black(` ${logObj.type.toUpperCase()} `)
1059
+ );
1060
+ }
1061
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
1062
+ return _type ? getColor2(typeColor)(_type) : "";
1063
+ }
1064
+ formatLogObj(logObj, opts) {
1065
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
1066
+ "\n"
1067
+ );
1068
+ if (logObj.type === "box") {
1069
+ return box(
1070
+ characterFormat(
1071
+ message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
1072
+ ),
1073
+ {
1074
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
1075
+ style: logObj.style
1076
+ }
1077
+ );
1078
+ }
1079
+ const date = this.formatDate(logObj.date, opts);
1080
+ const coloredDate = date && colors.gray(date);
1081
+ const isBadge = logObj.badge ?? logObj.level < 2;
1082
+ const type = this.formatType(logObj, isBadge, opts);
1083
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
1084
+ let line;
1085
+ const left = this.filterAndJoin([type, characterFormat(message)]);
1086
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
1087
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
1088
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
1089
+ line += characterFormat(
1090
+ additional.length > 0 ? "\n" + additional.join("\n") : ""
1091
+ );
1092
+ if (logObj.type === "trace") {
1093
+ const _err = new Error("Trace: " + logObj.message);
1094
+ line += this.formatStack(_err.stack || "", _err.message);
1095
+ }
1096
+ return isBadge ? "\n" + line + "\n" : line;
1097
+ }
1098
+ };
1099
+ function characterFormat(str) {
1100
+ return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
1101
+ }
1102
+ function getColor2(color = "white") {
1103
+ return colors[color] || colors.white;
1104
+ }
1105
+ function getBgColor(color = "bgWhite") {
1106
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
1107
+ }
1108
+ function createConsola2(options = {}) {
1109
+ let level = _getDefaultLogLevel();
1110
+ if (process.env.CONSOLA_LEVEL) {
1111
+ level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
1112
+ }
1113
+ const consola2 = createConsola({
1114
+ level,
1115
+ defaults: { level },
1116
+ stdout: process.stdout,
1117
+ stderr: process.stderr,
1118
+ prompt: (...args) => import("./prompt-VKHMCQT6.mjs").then((m) => m.prompt(...args)),
1119
+ reporters: options.reporters || [
1120
+ options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
1121
+ ],
1122
+ ...options
1123
+ });
1124
+ return consola2;
1125
+ }
1126
+ function _getDefaultLogLevel() {
1127
+ if (g) {
1128
+ return LogLevels.debug;
1129
+ }
1130
+ if (R) {
1131
+ return LogLevels.warn;
1132
+ }
1133
+ return LogLevels.info;
1134
+ }
1135
+ var consola = createConsola2();
1136
+
1137
+ // src/config/resolve.ts
1138
+ var DEFAULT_REFRESH_WINDOW_MS = 5 * 60 * 1e3;
1139
+ var TRANSIENT_READ_RETRY_DELAYS_MS = [100, 300];
1140
+ function resolveConfig(globalConfig, flags, project, credentials) {
1141
+ if (IS_PUBLISHED_BUILD) {
1142
+ assertPublicRuntimeFlags(flags);
1143
+ }
1144
+ const envEnvironment = IS_PUBLISHED_BUILD ? void 0 : environmentFromProcess();
1145
+ const projectEnvironment = IS_PUBLISHED_BUILD ? void 0 : project?.environment;
1146
+ const environment = IS_PUBLISHED_BUILD ? PUBLISHED_ENVIRONMENT : flags.env || envEnvironment || projectEnvironment || globalConfig.environment || "staging";
1147
+ const envConfig = ENVIRONMENT_CONFIGS[environment];
1148
+ const publishedEnvConfig = ENVIRONMENT_CONFIGS[PUBLISHED_ENVIRONMENT];
1149
+ const hasExplicitEnvironmentOverride = !IS_PUBLISHED_BUILD && Boolean(flags.env || envEnvironment || projectEnvironment);
1150
+ 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;
1151
+ const apiBaseUrl = valueOrUndefined(process.env.DREAMBOARD_API_BASE_URL) ?? resolvedApiBaseUrl;
1152
+ 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;
1153
+ const webBaseUrl = valueOrUndefined(process.env.DREAMBOARD_WEB_BASE_URL) ?? resolvedWebBaseUrl;
1154
+ const snapshot = buildCredentialSnapshot(flags, credentials, environment);
1155
+ const oauthConfig = resolveEnvironmentOAuthConfig(environment, envConfig);
1156
+ return {
1157
+ environment,
1158
+ apiBaseUrl,
1159
+ webBaseUrl,
1160
+ authToken: snapshot.dreamboardApiToken ?? (snapshot.refreshToken ? void 0 : snapshot.accessToken),
1161
+ refreshToken: snapshot.refreshToken,
1162
+ tokenExpiresAt: snapshot.dreamboardApiExpiresAt ?? (snapshot.refreshToken ? void 0 : snapshot.tokenExpiresAt),
1163
+ clerkAccessToken: snapshot.accessToken,
1164
+ clerkAccessExpiresAt: snapshot.tokenExpiresAt,
1165
+ dreamboardApiToken: snapshot.dreamboardApiToken,
1166
+ dreamboardApiExpiresAt: snapshot.dreamboardApiExpiresAt,
1167
+ clerkOAuthIssuer: snapshot.clerkOAuthIssuer ?? oauthConfig.issuer,
1168
+ clerkOAuthClientId: snapshot.clerkOAuthClientId ?? oauthConfig.clientId,
1169
+ clerkOAuthTokenUrl: snapshot.clerkOAuthTokenUrl ?? oauthConfig.tokenUrl,
1170
+ clerkOAuthScope: oauthConfig.scope,
1171
+ authTokenSource: snapshot.authTokenSource,
1172
+ refreshTokenSource: snapshot.refreshTokenSource
1173
+ };
1174
+ }
1175
+ function resolveEnvironmentOAuthConfig(environment, envConfig) {
1176
+ const prefix = environment.toUpperCase();
1177
+ return {
1178
+ issuer: valueOrUndefined(
1179
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_ISSUER`]
1180
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_ISSUER) ?? envConfig?.clerkOAuthIssuer,
1181
+ clientId: valueOrUndefined(
1182
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_CLIENT_ID`]
1183
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_CLIENT_ID) ?? envConfig?.clerkOAuthClientId,
1184
+ tokenUrl: valueOrUndefined(
1185
+ process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_TOKEN_URL`]
1186
+ ) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_TOKEN_URL) ?? envConfig?.clerkOAuthTokenUrl,
1187
+ scope: valueOrUndefined(process.env[`DREAMBOARD_${prefix}_CLERK_OAUTH_SCOPE`]) ?? valueOrUndefined(process.env.DREAMBOARD_CLERK_OAUTH_SCOPE) ?? envConfig?.clerkOAuthScope
1188
+ };
1189
+ }
1190
+ function buildCredentialSnapshot(flags, storedCredentials, environment) {
1191
+ const flagToken = valueOrUndefined(flags.token);
1192
+ const agentEnvToken = valueOrUndefined(process.env.DREAMBOARD_AGENT_TOKEN);
1193
+ const envToken = valueOrUndefined(process.env.DREAMBOARD_TOKEN);
1194
+ const environmentScopedStoredCredentials = storedCredentials?.environment && environment && storedCredentials.environment !== environment ? null : storedCredentials ?? null;
1195
+ if (IS_PUBLISHED_BUILD) {
1196
+ const stored = environmentScopedStoredCredentials;
1197
+ if (agentEnvToken) {
1198
+ return {
1199
+ accessToken: agentEnvToken,
1200
+ refreshToken: void 0,
1201
+ tokenExpiresAt: void 0,
1202
+ authTokenSource: "agent-env",
1203
+ refreshTokenSource: "none"
1204
+ };
1205
+ }
1206
+ return {
1207
+ accessToken: stored?.accessToken,
1208
+ refreshToken: stored?.refreshToken,
1209
+ tokenExpiresAt: stored?.tokenExpiresAt,
1210
+ dreamboardApiToken: stored?.dreamboardApiToken,
1211
+ dreamboardApiExpiresAt: stored?.dreamboardApiExpiresAt,
1212
+ clerkOAuthIssuer: stored?.clerkOAuthIssuer,
1213
+ clerkOAuthClientId: stored?.clerkOAuthClientId,
1214
+ clerkOAuthTokenUrl: stored?.clerkOAuthTokenUrl,
1215
+ environment: stored?.environment,
1216
+ authTokenSource: stored?.dreamboardApiToken || stored?.accessToken && !stored.refreshToken ? "global" : "none",
1217
+ refreshTokenSource: stored?.refreshToken ? "global" : "none"
1218
+ };
1219
+ }
1220
+ const accessToken = flagToken || agentEnvToken || envToken || environmentScopedStoredCredentials?.accessToken;
1221
+ const refreshToken = environmentScopedStoredCredentials?.refreshToken;
1222
+ const authTokenSource = flagToken ? "flag" : agentEnvToken ? "agent-env" : envToken ? "env" : environmentScopedStoredCredentials?.accessToken ? "global" : "none";
1223
+ const refreshTokenSource = environmentScopedStoredCredentials?.refreshToken ? "global" : "none";
1224
+ return {
1225
+ accessToken,
1226
+ refreshToken,
1227
+ tokenExpiresAt: environmentScopedStoredCredentials?.tokenExpiresAt,
1228
+ dreamboardApiToken: environmentScopedStoredCredentials?.dreamboardApiToken,
1229
+ dreamboardApiExpiresAt: environmentScopedStoredCredentials?.dreamboardApiExpiresAt,
1230
+ clerkOAuthIssuer: environmentScopedStoredCredentials?.clerkOAuthIssuer,
1231
+ clerkOAuthClientId: environmentScopedStoredCredentials?.clerkOAuthClientId,
1232
+ clerkOAuthTokenUrl: environmentScopedStoredCredentials?.clerkOAuthTokenUrl,
1233
+ environment: environmentScopedStoredCredentials?.environment,
1234
+ authTokenSource,
1235
+ refreshTokenSource
1236
+ };
1237
+ }
1238
+ function environmentFromProcess() {
1239
+ const value = valueOrUndefined(process.env.DREAMBOARD_ENV);
1240
+ if (!value) return void 0;
1241
+ if (value === "local" || value === "staging" || value === "prod") {
1242
+ return value;
1243
+ }
1244
+ throw new Error(
1245
+ `Invalid DREAMBOARD_ENV '${value}'. Valid options: local, staging, prod`
1246
+ );
1247
+ }
1248
+ function projectLocalBaseUrl(rawUrl, environment) {
1249
+ if (environment !== "local" || !rawUrl) return void 0;
1250
+ try {
1251
+ const url = new URL(rawUrl);
1252
+ return url.hostname === "localhost" || url.hostname === "127.0.0.1" ? rawUrl : void 0;
1253
+ } catch {
1254
+ return void 0;
1255
+ }
1256
+ }
1257
+ function assertPublicRuntimeFlags(flags) {
1258
+ const argv2 = process.argv.slice(2);
1259
+ if (flags.env || argv2.includes("--env")) {
1260
+ throw new Error(
1261
+ "The published Dreamboard CLI is production-only and does not accept `--env`."
1262
+ );
1263
+ }
1264
+ if (valueOrUndefined(flags.token) || argv2.includes("--token")) {
1265
+ throw new Error(
1266
+ "Direct JWT injection is not supported in the published Dreamboard CLI. Use `dreamboard auth login` so the CLI can store and refresh your session."
1267
+ );
1268
+ }
1269
+ if (process.env.DREAMBOARD_TOKEN) {
1270
+ throw new Error(
1271
+ "The published Dreamboard CLI ignores direct token environment variables. Use `dreamboard auth login` so the CLI can manage refreshable credentials."
1272
+ );
1273
+ }
1274
+ }
1275
+ async function configureClient(config) {
1276
+ const localHarnessToken = resolveLocalHarnessAccessToken(config);
1277
+ const resolvedToken = localHarnessToken ? { token: localHarnessToken } : await createUserTokenManager(config).resolveApiToken();
1278
+ const effectiveAccessToken = resolvedToken?.token;
1279
+ client.setConfig({
1280
+ baseUrl: config.apiBaseUrl,
1281
+ fetch: createRetryingReadFetch(globalThis.fetch.bind(globalThis)),
1282
+ headers: effectiveAccessToken ? { Authorization: `Bearer ${effectiveAccessToken}` } : {}
1283
+ });
1284
+ }
1285
+ function createRetryingReadFetch(fetchImpl) {
1286
+ return (async (input, init2) => {
1287
+ const method = resolveFetchMethod(input, init2);
1288
+ if (method !== "GET" && method !== "HEAD") {
1289
+ return fetchImpl(input, init2);
1290
+ }
1291
+ let lastError;
1292
+ for (let attempt = 0; attempt <= TRANSIENT_READ_RETRY_DELAYS_MS.length; attempt += 1) {
1293
+ try {
1294
+ return await fetchImpl(input, init2);
1295
+ } catch (error) {
1296
+ lastError = error;
1297
+ if (attempt >= TRANSIENT_READ_RETRY_DELAYS_MS.length || !isTransientFetchError(error)) {
1298
+ throw error;
1299
+ }
1300
+ await sleep(TRANSIENT_READ_RETRY_DELAYS_MS[attempt]);
1301
+ }
1302
+ }
1303
+ throw lastError;
1304
+ });
1305
+ }
1306
+ function resolveFetchMethod(input, init2) {
1307
+ const method = init2?.method ?? (typeof Request !== "undefined" && input instanceof Request ? input.method : void 0);
1308
+ return (method ?? "GET").toUpperCase();
1309
+ }
1310
+ function isTransientFetchError(error) {
1311
+ const message = error instanceof Error ? error.message : typeof error === "object" && error !== null && "message" in error ? String(error.message) : String(error);
1312
+ const normalized = message.toLowerCase();
1313
+ return normalized.includes("fetch failed") || normalized.includes("network") || normalized.includes("timeout") || normalized.includes("econnreset") || normalized.includes("econnrefused") || normalized.includes("socket");
1314
+ }
1315
+ function sleep(ms) {
1316
+ return new Promise((resolve) => setTimeout(resolve, ms));
1317
+ }
1318
+ function requireAuth(config) {
1319
+ if (!config.authToken && !config.refreshToken && !resolveLocalHarnessAccessToken(config)) {
1320
+ throw new Error(
1321
+ "Missing Dreamboard session. Run `dreamboard auth login` to authenticate."
1322
+ );
1323
+ }
1324
+ }
1325
+ function valueOrUndefined(value) {
1326
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
1327
+ }
1328
+ async function loadProjectContextCredentials(requireAuth2, loadCredentials = getStoredSession) {
1329
+ return requireAuth2 ? loadCredentials() : void 0;
1330
+ }
1331
+ async function resolveProjectContext(flags, opts) {
1332
+ const projectRoot = await findProjectRoot(process.cwd());
1333
+ if (!projectRoot) {
1334
+ throw new Error(
1335
+ "Not inside a dreamboard project (missing .dreamboard/project.json)."
1336
+ );
1337
+ }
1338
+ const projectConfig = await loadProjectConfig(projectRoot);
1339
+ const requireAuthForContext = opts?.requireAuth !== false;
1340
+ const [globalConfig, credentials] = await Promise.all([
1341
+ loadGlobalConfig(),
1342
+ loadProjectContextCredentials(requireAuthForContext)
1343
+ ]);
1344
+ const config = resolveConfig(globalConfig, flags, projectConfig, credentials);
1345
+ if (requireAuthForContext) {
1346
+ requireAuth(config);
1347
+ await configureClient(config);
1348
+ }
1349
+ return { projectRoot, projectConfig, config };
1350
+ }
1351
+
1352
+ // src/services/project/dependency-portability.ts
1353
+ import path from "path";
1354
+ var DEPENDENCY_FIELDS = [
1355
+ "dependencies",
1356
+ "devDependencies",
1357
+ "optionalDependencies",
1358
+ "peerDependencies"
1359
+ ];
1360
+ var UNPORTABLE_SPECIFIER_PATTERN = /^(file|link|portal|workspace):/;
1361
+ async function buildSourceDependencyProfile(options) {
1362
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1363
+ const packages = collectDreamboardPackageSpecifiers(packageJson);
1364
+ const hasLocalSnapshotPackage = Object.values(packages).some(
1365
+ (value) => value.includes("-local.")
1366
+ );
1367
+ const localMaintainerRegistry = hasLocalSnapshotPackage ? options.projectConfig?.localMaintainerRegistry : void 0;
1368
+ return {
1369
+ kind: "npm-registry",
1370
+ packageManager: packageJson.packageManager,
1371
+ dreamboardRegistryUrl: await readDreamboardRegistryFromNpmrc(options.projectRoot) ?? localMaintainerRegistry?.registryUrl,
1372
+ localSnapshotId: localMaintainerRegistry?.snapshotId,
1373
+ packages
1374
+ };
1375
+ }
1376
+ async function assertCompilerPortableDependencies(options) {
1377
+ const packageJson = await readProjectPackageJson(options.projectRoot);
1378
+ const legacyProblems = collectLegacyDreamboardSpecifiers(packageJson);
1379
+ if (legacyProblems.length > 0) {
1380
+ throwLegacyDreamboardPackageError(legacyProblems);
1381
+ }
1382
+ const problems = collectUnportableDreamboardSpecifiers(packageJson);
1383
+ if (problems.length > 0) {
1384
+ const details = problems.map(
1385
+ (problem) => `${problem.location} ${problem.packageName} -> ${problem.specifier}`
1386
+ ).join("; ");
1387
+ throw new Error(
1388
+ [
1389
+ "Compiler-bound workspaces must install Dreamboard packages from a registry.",
1390
+ `Found unportable Dreamboard dependency specifier(s): ${details}.`,
1391
+ "Use a workspace created or cloned with the current Dreamboard CLI so @dreamboard-games/* and dreamboard versions are registry-pinned before building."
1392
+ ].join(" ")
1393
+ );
1394
+ }
1395
+ const profile = await buildSourceDependencyProfile(options);
1396
+ const hasLocalSnapshotPackage = Object.values(profile.packages).some(
1397
+ (value) => value.includes("-local.")
1398
+ );
1399
+ if (hasLocalSnapshotPackage && !profile.dreamboardRegistryUrl) {
1400
+ throw new Error(
1401
+ "This workspace references local Dreamboard snapshot versions but has no @dreamboard registry configured. Recreate or reclone the workspace with the local registry configuration before building."
1402
+ );
1403
+ }
1404
+ return profile;
1405
+ }
1406
+ async function readProjectPackageJson(projectRoot) {
1407
+ return readJsonFile(
1408
+ path.join(projectRoot, "package.json")
1409
+ );
1410
+ }
1411
+ function collectDreamboardPackageSpecifiers(packageJson) {
1412
+ const packages = {};
1413
+ for (const field of DEPENDENCY_FIELDS) {
1414
+ const dependencies = packageJson[field];
1415
+ if (!dependencies) continue;
1416
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1417
+ if (isPortableDreamboardPackage(packageName)) {
1418
+ packages[packageName] = specifier;
1419
+ }
1420
+ }
1421
+ }
1422
+ const overrides = packageJson.pnpm?.overrides;
1423
+ if (overrides) {
1424
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1425
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && packages[packageName] === void 0) {
1426
+ packages[packageName] = specifier;
1427
+ }
1428
+ }
1429
+ }
1430
+ return packages;
1431
+ }
1432
+ function collectUnportableDreamboardSpecifiers(packageJson) {
1433
+ const problems = [];
1434
+ for (const field of DEPENDENCY_FIELDS) {
1435
+ const dependencies = packageJson[field];
1436
+ if (!dependencies) continue;
1437
+ for (const [packageName, specifier] of Object.entries(dependencies)) {
1438
+ if (isPortableDreamboardPackage(packageName) && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
1439
+ problems.push({ location: field, packageName, specifier });
1440
+ }
1441
+ }
1442
+ }
1443
+ const overrides = packageJson.pnpm?.overrides;
1444
+ if (overrides) {
1445
+ for (const [packageName, specifier] of Object.entries(overrides)) {
1446
+ if (isPortableDreamboardPackage(packageName) && typeof specifier === "string" && UNPORTABLE_SPECIFIER_PATTERN.test(specifier)) {
1447
+ problems.push({
1448
+ location: "pnpm.overrides",
1449
+ packageName,
1450
+ specifier
1451
+ });
1452
+ }
1453
+ }
1454
+ }
1455
+ return problems;
1456
+ }
1457
+ function collectLegacyDreamboardSpecifiers(packageJson) {
1458
+ const problems = [];
1459
+ for (const field of DEPENDENCY_FIELDS) {
1460
+ const dependencies = packageJson[field];
1461
+ if (!dependencies) continue;
1462
+ for (const packageName of Object.keys(dependencies)) {
1463
+ if (isLegacyDreamboardPackage(packageName)) {
1464
+ problems.push({ location: field, packageName });
1465
+ }
1466
+ }
1467
+ }
1468
+ const overrides = packageJson.pnpm?.overrides;
1469
+ if (overrides) {
1470
+ for (const packageName of Object.keys(overrides)) {
1471
+ if (isLegacyDreamboardPackage(packageName)) {
1472
+ problems.push({ location: "pnpm.overrides", packageName });
1473
+ }
1474
+ }
1475
+ }
1476
+ return problems;
1477
+ }
1478
+ function throwLegacyDreamboardPackageError(problems) {
1479
+ const details = problems.map((problem) => `${problem.location} ${problem.packageName}`).join("; ");
1480
+ throw new Error(
1481
+ [
1482
+ "Legacy @dreamboard/* package dependencies are no longer supported in compiler-bound workspaces.",
1483
+ `Found ${details}.`,
1484
+ "Repin to the public @dreamboard-games/* packages and rerun the command."
1485
+ ].join(" ")
1486
+ );
1487
+ }
1488
+ function isPortableDreamboardPackage(packageName) {
1489
+ return packageName === "dreamboard" || packageName.startsWith("@dreamboard-games/");
1490
+ }
1491
+ function isLegacyDreamboardPackage(packageName) {
1492
+ return packageName.startsWith("@dreamboard/");
1493
+ }
1494
+ async function readDreamboardRegistryFromNpmrc(projectRoot) {
1495
+ const npmrc = await readTextFileIfExists(path.join(projectRoot, ".npmrc"));
1496
+ if (!npmrc) return void 0;
1497
+ for (const line of npmrc.split(/\r?\n/)) {
1498
+ const trimmed = line.trim();
1499
+ if (!trimmed.startsWith("@dreamboard-games:registry=")) continue;
1500
+ return trimmed.slice("@dreamboard-games:registry=".length).trim() || void 0;
1501
+ }
1502
+ return void 0;
1503
+ }
1504
+
1505
+ // src/agent-verifier/agent-workspace-verifier.ts
19
1506
  main().catch((error) => {
20
1507
  console.error(error instanceof Error ? error.message : String(error));
21
1508
  process.exit(1);
@@ -48,10 +1535,8 @@ Usage:
48
1535
  }
49
1536
  async function materializePreparedWorkspace(args) {
50
1537
  const inputPath = readRequiredOption(args, "--input");
51
- const { materializeWorkspaceProject } = await import("./materialize-workspace-PWNT6HQK.mjs");
52
- const input = JSON.parse(
53
- await readFile(inputPath, "utf8")
54
- );
1538
+ const { materializeWorkspaceProject } = await import("./materialize-workspace-VS5RHSBO.mjs");
1539
+ const input = JSON.parse(await readFile(inputPath, "utf8"));
55
1540
  await materializeWorkspaceProject({
56
1541
  ...input,
57
1542
  agentManaged: true,
@@ -70,10 +1555,6 @@ async function verifyAgentWorkspace(rawMode, args) {
70
1555
  consola.success("Agent workspace preflight passed.");
71
1556
  return;
72
1557
  }
73
- if (process.env.DREAMBOARD_AGENT_FINAL_SYNC_VERIFY === "1") {
74
- await runFullBackendConnectedVerification(parsedFlags);
75
- return;
76
- }
77
1558
  if (requestedMode === "cloud-local" || requestedMode === "verify" || requestedMode === "fin") {
78
1559
  await runCloudLocalVerification(projectRoot, projectConfig, config);
79
1560
  return;
@@ -82,34 +1563,6 @@ async function verifyAgentWorkspace(rawMode, args) {
82
1563
  "Agent workspaces now run cloud-local verification directly. Use `fin` only through the generated wrapper."
83
1564
  );
84
1565
  }
85
- async function runFullBackendConnectedVerification(parsedFlags) {
86
- const [{ default: cmdSync }, { default: cmdCompile }, { default: cmdTest }] = await Promise.all([
87
- import("./sync-5YM4CSXL.mjs"),
88
- import("./compile-MO2URO5Z.mjs"),
89
- import("./test-CNNVTFIG.mjs")
90
- ]);
91
- await runCommandDefinition(cmdSync, { ...parsedFlags, force: true });
92
- await runCommandDefinition(cmdCompile, parsedFlags);
93
- await runCommandDefinition(
94
- resolveTestSubCommand(cmdTest, "generate"),
95
- parsedFlags
96
- );
97
- await runCommandDefinition(resolveTestSubCommand(cmdTest, "run"), parsedFlags);
98
- }
99
- async function runCommandDefinition(command, args) {
100
- if (!command.run) {
101
- throw new Error("Verifier command is missing a runnable step.");
102
- }
103
- await command.run({ args, rawArgs: [], cmd: command });
104
- }
105
- function resolveTestSubCommand(cmdTest, name) {
106
- const subCommands = cmdTest.subCommands;
107
- const command = subCommands?.[name];
108
- if (!command) {
109
- throw new Error(`Verifier command is missing test ${name}.`);
110
- }
111
- return command;
112
- }
113
1566
  function parseVerificationMode(value) {
114
1567
  if (value === "preflight" || value === "verify" || value === "fin" || value === "cloud-local") {
115
1568
  return value;
@@ -150,11 +1603,11 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
150
1603
  { assertReducerContractPreflight },
151
1604
  { getProjectLocalMaintainerRegistry }
152
1605
  ] = await Promise.all([
153
- import("./static-scaffold-HXUQLJVN.mjs"),
154
- import("./local-files-DAFIR7SN.mjs"),
1606
+ import("./static-scaffold-C36KROJA.mjs"),
1607
+ import("./local-files-OF4QFISU.mjs"),
155
1608
  import("./workspace-codegen-SPPVHURX.mjs"),
156
- import("./workspace-dependencies-ZMHPHVQV.mjs"),
157
- import("./reducer-contract-preflight-FQB7M4PU.mjs"),
1609
+ import("./workspace-dependencies-5HEEKZFP.mjs"),
1610
+ import("./reducer-contract-preflight-WVQQPW5F.mjs"),
158
1611
  import("./project-state-XKUSCFSV.mjs")
159
1612
  ]);
160
1613
  consola.start("Refreshing static scaffold...");
@@ -169,8 +1622,8 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
169
1622
  consola.start("Validating reducer contract...");
170
1623
  await assertReducerContractPreflight(projectRoot);
171
1624
  const [{ runLocalTypecheck }, { assertReducerBundleSmoke }] = await Promise.all([
172
- import("./local-typecheck-3JXL2NMG.mjs"),
173
- import("./reducer-bundle-preflight-3DSXIELT.mjs")
1625
+ import("./local-typecheck-DHVLM37Z.mjs"),
1626
+ import("./reducer-bundle-preflight-GLUJKTWU.mjs")
174
1627
  ]);
175
1628
  consola.start("Running local typecheck...");
176
1629
  const typecheckResult = await runLocalTypecheck(projectRoot);
@@ -188,7 +1641,7 @@ async function runCloudLocalVerification(projectRoot, projectConfig, config) {
188
1641
  generateReducerNativeArtifacts,
189
1642
  isReducerNativeTestingWorkspace,
190
1643
  runReducerNativeScenarios
191
- } = await import("./reducer-native-test-harness-X2KQYSCD.mjs");
1644
+ } = await import("./reducer-native-test-harness-H6G6RBRY.mjs");
192
1645
  if (await isReducerNativeTestingWorkspace(projectRoot)) {
193
1646
  const { bases } = await generateReducerNativeArtifacts({
194
1647
  projectRoot,