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