@todesktop/cli 1.19.0-3 → 1.19.1

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.
package/dist/cli.js CHANGED
@@ -5,3616 +5,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
-
28
- // ../../node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js
29
- var require_es_object_atoms = __commonJS({
30
- "../../node_modules/.pnpm/es-object-atoms@1.1.1/node_modules/es-object-atoms/index.js"(exports2, module2) {
31
- "use strict";
32
- module2.exports = Object;
33
- }
34
- });
35
-
36
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js
37
- var require_es_errors = __commonJS({
38
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js"(exports2, module2) {
39
- "use strict";
40
- module2.exports = Error;
41
- }
42
- });
43
-
44
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js
45
- var require_eval = __commonJS({
46
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js"(exports2, module2) {
47
- "use strict";
48
- module2.exports = EvalError;
49
- }
50
- });
51
-
52
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js
53
- var require_range = __commonJS({
54
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js"(exports2, module2) {
55
- "use strict";
56
- module2.exports = RangeError;
57
- }
58
- });
59
-
60
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js
61
- var require_ref = __commonJS({
62
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/ref.js"(exports2, module2) {
63
- "use strict";
64
- module2.exports = ReferenceError;
65
- }
66
- });
67
-
68
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js
69
- var require_syntax = __commonJS({
70
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js"(exports2, module2) {
71
- "use strict";
72
- module2.exports = SyntaxError;
73
- }
74
- });
75
-
76
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js
77
- var require_type = __commonJS({
78
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js"(exports2, module2) {
79
- "use strict";
80
- module2.exports = TypeError;
81
- }
82
- });
83
-
84
- // ../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js
85
- var require_uri = __commonJS({
86
- "../../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js"(exports2, module2) {
87
- "use strict";
88
- module2.exports = URIError;
89
- }
90
- });
91
-
92
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js
93
- var require_abs = __commonJS({
94
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js"(exports2, module2) {
95
- "use strict";
96
- module2.exports = Math.abs;
97
- }
98
- });
99
-
100
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js
101
- var require_floor = __commonJS({
102
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js"(exports2, module2) {
103
- "use strict";
104
- module2.exports = Math.floor;
105
- }
106
- });
107
-
108
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js
109
- var require_max = __commonJS({
110
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/max.js"(exports2, module2) {
111
- "use strict";
112
- module2.exports = Math.max;
113
- }
114
- });
115
-
116
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js
117
- var require_min = __commonJS({
118
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js"(exports2, module2) {
119
- "use strict";
120
- module2.exports = Math.min;
121
- }
122
- });
123
-
124
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js
125
- var require_pow = __commonJS({
126
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js"(exports2, module2) {
127
- "use strict";
128
- module2.exports = Math.pow;
129
- }
130
- });
131
-
132
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js
133
- var require_round = __commonJS({
134
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/round.js"(exports2, module2) {
135
- "use strict";
136
- module2.exports = Math.round;
137
- }
138
- });
139
-
140
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js
141
- var require_isNaN = __commonJS({
142
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/isNaN.js"(exports2, module2) {
143
- "use strict";
144
- module2.exports = Number.isNaN || function isNaN2(a) {
145
- return a !== a;
146
- };
147
- }
148
- });
149
-
150
- // ../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js
151
- var require_sign = __commonJS({
152
- "../../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js"(exports2, module2) {
153
- "use strict";
154
- var $isNaN = require_isNaN();
155
- module2.exports = function sign(number2) {
156
- if ($isNaN(number2) || number2 === 0) {
157
- return number2;
158
- }
159
- return number2 < 0 ? -1 : 1;
160
- };
161
- }
162
- });
163
-
164
- // ../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js
165
- var require_gOPD = __commonJS({
166
- "../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js"(exports2, module2) {
167
- "use strict";
168
- module2.exports = Object.getOwnPropertyDescriptor;
169
- }
170
- });
171
-
172
- // ../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js
173
- var require_gopd = __commonJS({
174
- "../../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js"(exports2, module2) {
175
- "use strict";
176
- var $gOPD = require_gOPD();
177
- if ($gOPD) {
178
- try {
179
- $gOPD([], "length");
180
- } catch (e) {
181
- $gOPD = null;
182
- }
183
- }
184
- module2.exports = $gOPD;
185
- }
186
- });
187
-
188
- // ../../node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js
189
- var require_es_define_property = __commonJS({
190
- "../../node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js"(exports2, module2) {
191
- "use strict";
192
- var $defineProperty = Object.defineProperty || false;
193
- if ($defineProperty) {
194
- try {
195
- $defineProperty({}, "a", { value: 1 });
196
- } catch (e) {
197
- $defineProperty = false;
198
- }
199
- }
200
- module2.exports = $defineProperty;
201
- }
202
- });
203
-
204
- // ../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js
205
- var require_shams = __commonJS({
206
- "../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js"(exports2, module2) {
207
- "use strict";
208
- module2.exports = function hasSymbols() {
209
- if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
210
- return false;
211
- }
212
- if (typeof Symbol.iterator === "symbol") {
213
- return true;
214
- }
215
- var obj = {};
216
- var sym = /* @__PURE__ */ Symbol("test");
217
- var symObj = Object(sym);
218
- if (typeof sym === "string") {
219
- return false;
220
- }
221
- if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
222
- return false;
223
- }
224
- if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
225
- return false;
226
- }
227
- var symVal = 42;
228
- obj[sym] = symVal;
229
- for (var _ in obj) {
230
- return false;
231
- }
232
- if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
233
- return false;
234
- }
235
- if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
236
- return false;
237
- }
238
- var syms = Object.getOwnPropertySymbols(obj);
239
- if (syms.length !== 1 || syms[0] !== sym) {
240
- return false;
241
- }
242
- if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
243
- return false;
244
- }
245
- if (typeof Object.getOwnPropertyDescriptor === "function") {
246
- var descriptor = (
247
- /** @type {PropertyDescriptor} */
248
- Object.getOwnPropertyDescriptor(obj, sym)
249
- );
250
- if (descriptor.value !== symVal || descriptor.enumerable !== true) {
251
- return false;
252
- }
253
- }
254
- return true;
255
- };
256
- }
257
- });
258
-
259
- // ../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js
260
- var require_has_symbols = __commonJS({
261
- "../../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js"(exports2, module2) {
262
- "use strict";
263
- var origSymbol = typeof Symbol !== "undefined" && Symbol;
264
- var hasSymbolSham = require_shams();
265
- module2.exports = function hasNativeSymbols() {
266
- if (typeof origSymbol !== "function") {
267
- return false;
268
- }
269
- if (typeof Symbol !== "function") {
270
- return false;
271
- }
272
- if (typeof origSymbol("foo") !== "symbol") {
273
- return false;
274
- }
275
- if (typeof /* @__PURE__ */ Symbol("bar") !== "symbol") {
276
- return false;
277
- }
278
- return hasSymbolSham();
279
- };
280
- }
281
- });
282
-
283
- // ../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js
284
- var require_Reflect_getPrototypeOf = __commonJS({
285
- "../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js"(exports2, module2) {
286
- "use strict";
287
- module2.exports = typeof Reflect !== "undefined" && Reflect.getPrototypeOf || null;
288
- }
289
- });
290
-
291
- // ../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js
292
- var require_Object_getPrototypeOf = __commonJS({
293
- "../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js"(exports2, module2) {
294
- "use strict";
295
- var $Object = require_es_object_atoms();
296
- module2.exports = $Object.getPrototypeOf || null;
297
- }
298
- });
299
-
300
- // ../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js
301
- var require_implementation = __commonJS({
302
- "../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js"(exports2, module2) {
303
- "use strict";
304
- var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
305
- var toStr = Object.prototype.toString;
306
- var max = Math.max;
307
- var funcType = "[object Function]";
308
- var concatty = function concatty2(a, b) {
309
- var arr = [];
310
- for (var i = 0; i < a.length; i += 1) {
311
- arr[i] = a[i];
312
- }
313
- for (var j = 0; j < b.length; j += 1) {
314
- arr[j + a.length] = b[j];
315
- }
316
- return arr;
317
- };
318
- var slicy = function slicy2(arrLike, offset) {
319
- var arr = [];
320
- for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
321
- arr[j] = arrLike[i];
322
- }
323
- return arr;
324
- };
325
- var joiny = function(arr, joiner) {
326
- var str = "";
327
- for (var i = 0; i < arr.length; i += 1) {
328
- str += arr[i];
329
- if (i + 1 < arr.length) {
330
- str += joiner;
331
- }
332
- }
333
- return str;
334
- };
335
- module2.exports = function bind(that) {
336
- var target = this;
337
- if (typeof target !== "function" || toStr.apply(target) !== funcType) {
338
- throw new TypeError(ERROR_MESSAGE + target);
339
- }
340
- var args2 = slicy(arguments, 1);
341
- var bound;
342
- var binder = function() {
343
- if (this instanceof bound) {
344
- var result = target.apply(
345
- this,
346
- concatty(args2, arguments)
347
- );
348
- if (Object(result) === result) {
349
- return result;
350
- }
351
- return this;
352
- }
353
- return target.apply(
354
- that,
355
- concatty(args2, arguments)
356
- );
357
- };
358
- var boundLength = max(0, target.length - args2.length);
359
- var boundArgs = [];
360
- for (var i = 0; i < boundLength; i++) {
361
- boundArgs[i] = "$" + i;
362
- }
363
- bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
364
- if (target.prototype) {
365
- var Empty = function Empty2() {
366
- };
367
- Empty.prototype = target.prototype;
368
- bound.prototype = new Empty();
369
- Empty.prototype = null;
370
- }
371
- return bound;
372
- };
373
- }
374
- });
375
-
376
- // ../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js
377
- var require_function_bind = __commonJS({
378
- "../../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/index.js"(exports2, module2) {
379
- "use strict";
380
- var implementation = require_implementation();
381
- module2.exports = Function.prototype.bind || implementation;
382
- }
383
- });
384
-
385
- // ../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js
386
- var require_functionCall = __commonJS({
387
- "../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js"(exports2, module2) {
388
- "use strict";
389
- module2.exports = Function.prototype.call;
390
- }
391
- });
392
-
393
- // ../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js
394
- var require_functionApply = __commonJS({
395
- "../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js"(exports2, module2) {
396
- "use strict";
397
- module2.exports = Function.prototype.apply;
398
- }
399
- });
400
-
401
- // ../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js
402
- var require_reflectApply = __commonJS({
403
- "../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js"(exports2, module2) {
404
- "use strict";
405
- module2.exports = typeof Reflect !== "undefined" && Reflect && Reflect.apply;
406
- }
407
- });
408
-
409
- // ../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js
410
- var require_actualApply = __commonJS({
411
- "../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js"(exports2, module2) {
412
- "use strict";
413
- var bind = require_function_bind();
414
- var $apply = require_functionApply();
415
- var $call = require_functionCall();
416
- var $reflectApply = require_reflectApply();
417
- module2.exports = $reflectApply || bind.call($call, $apply);
418
- }
419
- });
420
-
421
- // ../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js
422
- var require_call_bind_apply_helpers = __commonJS({
423
- "../../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js"(exports2, module2) {
424
- "use strict";
425
- var bind = require_function_bind();
426
- var $TypeError = require_type();
427
- var $call = require_functionCall();
428
- var $actualApply = require_actualApply();
429
- module2.exports = function callBindBasic(args2) {
430
- if (args2.length < 1 || typeof args2[0] !== "function") {
431
- throw new $TypeError("a function is required");
432
- }
433
- return $actualApply(bind, $call, args2);
434
- };
435
- }
436
- });
437
-
438
- // ../../node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js
439
- var require_get = __commonJS({
440
- "../../node_modules/.pnpm/dunder-proto@1.0.1/node_modules/dunder-proto/get.js"(exports2, module2) {
441
- "use strict";
442
- var callBind = require_call_bind_apply_helpers();
443
- var gOPD = require_gopd();
444
- var hasProtoAccessor;
445
- try {
446
- hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */
447
- [].__proto__ === Array.prototype;
448
- } catch (e) {
449
- if (!e || typeof e !== "object" || !("code" in e) || e.code !== "ERR_PROTO_ACCESS") {
450
- throw e;
451
- }
452
- }
453
- var desc = !!hasProtoAccessor && gOPD && gOPD(
454
- Object.prototype,
455
- /** @type {keyof typeof Object.prototype} */
456
- "__proto__"
457
- );
458
- var $Object = Object;
459
- var $getPrototypeOf = $Object.getPrototypeOf;
460
- module2.exports = desc && typeof desc.get === "function" ? callBind([desc.get]) : typeof $getPrototypeOf === "function" ? (
461
- /** @type {import('./get')} */
462
- function getDunder(value) {
463
- return $getPrototypeOf(value == null ? value : $Object(value));
464
- }
465
- ) : false;
466
- }
467
- });
468
-
469
- // ../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js
470
- var require_get_proto = __commonJS({
471
- "../../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js"(exports2, module2) {
472
- "use strict";
473
- var reflectGetProto = require_Reflect_getPrototypeOf();
474
- var originalGetProto = require_Object_getPrototypeOf();
475
- var getDunderProto = require_get();
476
- module2.exports = reflectGetProto ? function getProto(O) {
477
- return reflectGetProto(O);
478
- } : originalGetProto ? function getProto(O) {
479
- if (!O || typeof O !== "object" && typeof O !== "function") {
480
- throw new TypeError("getProto: not an object");
481
- }
482
- return originalGetProto(O);
483
- } : getDunderProto ? function getProto(O) {
484
- return getDunderProto(O);
485
- } : null;
486
- }
487
- });
488
-
489
- // ../../node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js
490
- var require_hasown = __commonJS({
491
- "../../node_modules/.pnpm/hasown@2.0.2/node_modules/hasown/index.js"(exports2, module2) {
492
- "use strict";
493
- var call = Function.prototype.call;
494
- var $hasOwn = Object.prototype.hasOwnProperty;
495
- var bind = require_function_bind();
496
- module2.exports = bind.call(call, $hasOwn);
497
- }
498
- });
499
-
500
- // ../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js
501
- var require_get_intrinsic = __commonJS({
502
- "../../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js"(exports2, module2) {
503
- "use strict";
504
- var undefined2;
505
- var $Object = require_es_object_atoms();
506
- var $Error = require_es_errors();
507
- var $EvalError = require_eval();
508
- var $RangeError = require_range();
509
- var $ReferenceError = require_ref();
510
- var $SyntaxError = require_syntax();
511
- var $TypeError = require_type();
512
- var $URIError = require_uri();
513
- var abs = require_abs();
514
- var floor = require_floor();
515
- var max = require_max();
516
- var min = require_min();
517
- var pow = require_pow();
518
- var round = require_round();
519
- var sign = require_sign();
520
- var $Function = Function;
521
- var getEvalledConstructor = function(expressionSyntax) {
522
- try {
523
- return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
524
- } catch (e) {
525
- }
526
- };
527
- var $gOPD = require_gopd();
528
- var $defineProperty = require_es_define_property();
529
- var throwTypeError = function() {
530
- throw new $TypeError();
531
- };
532
- var ThrowTypeError = $gOPD ? (function() {
533
- try {
534
- arguments.callee;
535
- return throwTypeError;
536
- } catch (calleeThrows) {
537
- try {
538
- return $gOPD(arguments, "callee").get;
539
- } catch (gOPDthrows) {
540
- return throwTypeError;
541
- }
542
- }
543
- })() : throwTypeError;
544
- var hasSymbols = require_has_symbols()();
545
- var getProto = require_get_proto();
546
- var $ObjectGPO = require_Object_getPrototypeOf();
547
- var $ReflectGPO = require_Reflect_getPrototypeOf();
548
- var $apply = require_functionApply();
549
- var $call = require_functionCall();
550
- var needsEval = {};
551
- var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined2 : getProto(Uint8Array);
552
- var INTRINSICS = {
553
- __proto__: null,
554
- "%AggregateError%": typeof AggregateError === "undefined" ? undefined2 : AggregateError,
555
- "%Array%": Array,
556
- "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined2 : ArrayBuffer,
557
- "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined2,
558
- "%AsyncFromSyncIteratorPrototype%": undefined2,
559
- "%AsyncFunction%": needsEval,
560
- "%AsyncGenerator%": needsEval,
561
- "%AsyncGeneratorFunction%": needsEval,
562
- "%AsyncIteratorPrototype%": needsEval,
563
- "%Atomics%": typeof Atomics === "undefined" ? undefined2 : Atomics,
564
- "%BigInt%": typeof BigInt === "undefined" ? undefined2 : BigInt,
565
- "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined2 : BigInt64Array,
566
- "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined2 : BigUint64Array,
567
- "%Boolean%": Boolean,
568
- "%DataView%": typeof DataView === "undefined" ? undefined2 : DataView,
569
- "%Date%": Date,
570
- "%decodeURI%": decodeURI,
571
- "%decodeURIComponent%": decodeURIComponent,
572
- "%encodeURI%": encodeURI,
573
- "%encodeURIComponent%": encodeURIComponent,
574
- "%Error%": $Error,
575
- "%eval%": eval,
576
- // eslint-disable-line no-eval
577
- "%EvalError%": $EvalError,
578
- "%Float16Array%": typeof Float16Array === "undefined" ? undefined2 : Float16Array,
579
- "%Float32Array%": typeof Float32Array === "undefined" ? undefined2 : Float32Array,
580
- "%Float64Array%": typeof Float64Array === "undefined" ? undefined2 : Float64Array,
581
- "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined2 : FinalizationRegistry,
582
- "%Function%": $Function,
583
- "%GeneratorFunction%": needsEval,
584
- "%Int8Array%": typeof Int8Array === "undefined" ? undefined2 : Int8Array,
585
- "%Int16Array%": typeof Int16Array === "undefined" ? undefined2 : Int16Array,
586
- "%Int32Array%": typeof Int32Array === "undefined" ? undefined2 : Int32Array,
587
- "%isFinite%": isFinite,
588
- "%isNaN%": isNaN,
589
- "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined2,
590
- "%JSON%": typeof JSON === "object" ? JSON : undefined2,
591
- "%Map%": typeof Map === "undefined" ? undefined2 : Map,
592
- "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
593
- "%Math%": Math,
594
- "%Number%": Number,
595
- "%Object%": $Object,
596
- "%Object.getOwnPropertyDescriptor%": $gOPD,
597
- "%parseFloat%": parseFloat,
598
- "%parseInt%": parseInt,
599
- "%Promise%": typeof Promise === "undefined" ? undefined2 : Promise,
600
- "%Proxy%": typeof Proxy === "undefined" ? undefined2 : Proxy,
601
- "%RangeError%": $RangeError,
602
- "%ReferenceError%": $ReferenceError,
603
- "%Reflect%": typeof Reflect === "undefined" ? undefined2 : Reflect,
604
- "%RegExp%": RegExp,
605
- "%Set%": typeof Set === "undefined" ? undefined2 : Set,
606
- "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined2 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
607
- "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined2 : SharedArrayBuffer,
608
- "%String%": String,
609
- "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined2,
610
- "%Symbol%": hasSymbols ? Symbol : undefined2,
611
- "%SyntaxError%": $SyntaxError,
612
- "%ThrowTypeError%": ThrowTypeError,
613
- "%TypedArray%": TypedArray,
614
- "%TypeError%": $TypeError,
615
- "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined2 : Uint8Array,
616
- "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined2 : Uint8ClampedArray,
617
- "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined2 : Uint16Array,
618
- "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined2 : Uint32Array,
619
- "%URIError%": $URIError,
620
- "%WeakMap%": typeof WeakMap === "undefined" ? undefined2 : WeakMap,
621
- "%WeakRef%": typeof WeakRef === "undefined" ? undefined2 : WeakRef,
622
- "%WeakSet%": typeof WeakSet === "undefined" ? undefined2 : WeakSet,
623
- "%Function.prototype.call%": $call,
624
- "%Function.prototype.apply%": $apply,
625
- "%Object.defineProperty%": $defineProperty,
626
- "%Object.getPrototypeOf%": $ObjectGPO,
627
- "%Math.abs%": abs,
628
- "%Math.floor%": floor,
629
- "%Math.max%": max,
630
- "%Math.min%": min,
631
- "%Math.pow%": pow,
632
- "%Math.round%": round,
633
- "%Math.sign%": sign,
634
- "%Reflect.getPrototypeOf%": $ReflectGPO
635
- };
636
- if (getProto) {
637
- try {
638
- null.error;
639
- } catch (e) {
640
- errorProto = getProto(getProto(e));
641
- INTRINSICS["%Error.prototype%"] = errorProto;
642
- }
643
- }
644
- var errorProto;
645
- var doEval = function doEval2(name) {
646
- var value;
647
- if (name === "%AsyncFunction%") {
648
- value = getEvalledConstructor("async function () {}");
649
- } else if (name === "%GeneratorFunction%") {
650
- value = getEvalledConstructor("function* () {}");
651
- } else if (name === "%AsyncGeneratorFunction%") {
652
- value = getEvalledConstructor("async function* () {}");
653
- } else if (name === "%AsyncGenerator%") {
654
- var fn = doEval2("%AsyncGeneratorFunction%");
655
- if (fn) {
656
- value = fn.prototype;
657
- }
658
- } else if (name === "%AsyncIteratorPrototype%") {
659
- var gen = doEval2("%AsyncGenerator%");
660
- if (gen && getProto) {
661
- value = getProto(gen.prototype);
662
- }
663
- }
664
- INTRINSICS[name] = value;
665
- return value;
666
- };
667
- var LEGACY_ALIASES = {
668
- __proto__: null,
669
- "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
670
- "%ArrayPrototype%": ["Array", "prototype"],
671
- "%ArrayProto_entries%": ["Array", "prototype", "entries"],
672
- "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
673
- "%ArrayProto_keys%": ["Array", "prototype", "keys"],
674
- "%ArrayProto_values%": ["Array", "prototype", "values"],
675
- "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
676
- "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
677
- "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
678
- "%BooleanPrototype%": ["Boolean", "prototype"],
679
- "%DataViewPrototype%": ["DataView", "prototype"],
680
- "%DatePrototype%": ["Date", "prototype"],
681
- "%ErrorPrototype%": ["Error", "prototype"],
682
- "%EvalErrorPrototype%": ["EvalError", "prototype"],
683
- "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
684
- "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
685
- "%FunctionPrototype%": ["Function", "prototype"],
686
- "%Generator%": ["GeneratorFunction", "prototype"],
687
- "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
688
- "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
689
- "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
690
- "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
691
- "%JSONParse%": ["JSON", "parse"],
692
- "%JSONStringify%": ["JSON", "stringify"],
693
- "%MapPrototype%": ["Map", "prototype"],
694
- "%NumberPrototype%": ["Number", "prototype"],
695
- "%ObjectPrototype%": ["Object", "prototype"],
696
- "%ObjProto_toString%": ["Object", "prototype", "toString"],
697
- "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
698
- "%PromisePrototype%": ["Promise", "prototype"],
699
- "%PromiseProto_then%": ["Promise", "prototype", "then"],
700
- "%Promise_all%": ["Promise", "all"],
701
- "%Promise_reject%": ["Promise", "reject"],
702
- "%Promise_resolve%": ["Promise", "resolve"],
703
- "%RangeErrorPrototype%": ["RangeError", "prototype"],
704
- "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
705
- "%RegExpPrototype%": ["RegExp", "prototype"],
706
- "%SetPrototype%": ["Set", "prototype"],
707
- "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
708
- "%StringPrototype%": ["String", "prototype"],
709
- "%SymbolPrototype%": ["Symbol", "prototype"],
710
- "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
711
- "%TypedArrayPrototype%": ["TypedArray", "prototype"],
712
- "%TypeErrorPrototype%": ["TypeError", "prototype"],
713
- "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
714
- "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
715
- "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
716
- "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
717
- "%URIErrorPrototype%": ["URIError", "prototype"],
718
- "%WeakMapPrototype%": ["WeakMap", "prototype"],
719
- "%WeakSetPrototype%": ["WeakSet", "prototype"]
720
- };
721
- var bind = require_function_bind();
722
- var hasOwn = require_hasown();
723
- var $concat = bind.call($call, Array.prototype.concat);
724
- var $spliceApply = bind.call($apply, Array.prototype.splice);
725
- var $replace = bind.call($call, String.prototype.replace);
726
- var $strSlice = bind.call($call, String.prototype.slice);
727
- var $exec = bind.call($call, RegExp.prototype.exec);
728
- var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
729
- var reEscapeChar = /\\(\\)?/g;
730
- var stringToPath = function stringToPath2(string2) {
731
- var first = $strSlice(string2, 0, 1);
732
- var last = $strSlice(string2, -1);
733
- if (first === "%" && last !== "%") {
734
- throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
735
- } else if (last === "%" && first !== "%") {
736
- throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
737
- }
738
- var result = [];
739
- $replace(string2, rePropName, function(match, number2, quote, subString) {
740
- result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number2 || match;
741
- });
742
- return result;
743
- };
744
- var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
745
- var intrinsicName = name;
746
- var alias;
747
- if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
748
- alias = LEGACY_ALIASES[intrinsicName];
749
- intrinsicName = "%" + alias[0] + "%";
750
- }
751
- if (hasOwn(INTRINSICS, intrinsicName)) {
752
- var value = INTRINSICS[intrinsicName];
753
- if (value === needsEval) {
754
- value = doEval(intrinsicName);
755
- }
756
- if (typeof value === "undefined" && !allowMissing) {
757
- throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
758
- }
759
- return {
760
- alias,
761
- name: intrinsicName,
762
- value
763
- };
764
- }
765
- throw new $SyntaxError("intrinsic " + name + " does not exist!");
766
- };
767
- module2.exports = function GetIntrinsic(name, allowMissing) {
768
- if (typeof name !== "string" || name.length === 0) {
769
- throw new $TypeError("intrinsic name must be a non-empty string");
770
- }
771
- if (arguments.length > 1 && typeof allowMissing !== "boolean") {
772
- throw new $TypeError('"allowMissing" argument must be a boolean');
773
- }
774
- if ($exec(/^%?[^%]*%?$/, name) === null) {
775
- throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
776
- }
777
- var parts = stringToPath(name);
778
- var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
779
- var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
780
- var intrinsicRealName = intrinsic.name;
781
- var value = intrinsic.value;
782
- var skipFurtherCaching = false;
783
- var alias = intrinsic.alias;
784
- if (alias) {
785
- intrinsicBaseName = alias[0];
786
- $spliceApply(parts, $concat([0, 1], alias));
787
- }
788
- for (var i = 1, isOwn = true; i < parts.length; i += 1) {
789
- var part = parts[i];
790
- var first = $strSlice(part, 0, 1);
791
- var last = $strSlice(part, -1);
792
- if ((first === '"' || first === "'" || first === "`" || (last === '"' || last === "'" || last === "`")) && first !== last) {
793
- throw new $SyntaxError("property names with quotes must have matching quotes");
794
- }
795
- if (part === "constructor" || !isOwn) {
796
- skipFurtherCaching = true;
797
- }
798
- intrinsicBaseName += "." + part;
799
- intrinsicRealName = "%" + intrinsicBaseName + "%";
800
- if (hasOwn(INTRINSICS, intrinsicRealName)) {
801
- value = INTRINSICS[intrinsicRealName];
802
- } else if (value != null) {
803
- if (!(part in value)) {
804
- if (!allowMissing) {
805
- throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
806
- }
807
- return void undefined2;
808
- }
809
- if ($gOPD && i + 1 >= parts.length) {
810
- var desc = $gOPD(value, part);
811
- isOwn = !!desc;
812
- if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
813
- value = desc.get;
814
- } else {
815
- value = value[part];
816
- }
817
- } else {
818
- isOwn = hasOwn(value, part);
819
- value = value[part];
820
- }
821
- if (isOwn && !skipFurtherCaching) {
822
- INTRINSICS[intrinsicRealName] = value;
823
- }
824
- }
825
- }
826
- return value;
827
- };
828
- }
829
- });
830
-
831
- // ../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js
832
- var require_call_bound = __commonJS({
833
- "../../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js"(exports2, module2) {
834
- "use strict";
835
- var GetIntrinsic = require_get_intrinsic();
836
- var callBindBasic = require_call_bind_apply_helpers();
837
- var $indexOf = callBindBasic([GetIntrinsic("%String.prototype.indexOf%")]);
838
- module2.exports = function callBoundIntrinsic(name, allowMissing) {
839
- var intrinsic = (
840
- /** @type {(this: unknown, ...args: unknown[]) => unknown} */
841
- GetIntrinsic(name, !!allowMissing)
842
- );
843
- if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
844
- return callBindBasic(
845
- /** @type {const} */
846
- [intrinsic]
847
- );
848
- }
849
- return intrinsic;
850
- };
851
- }
852
- });
853
-
854
- // ../../node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js
855
- var require_shams2 = __commonJS({
856
- "../../node_modules/.pnpm/has-tostringtag@1.0.2/node_modules/has-tostringtag/shams.js"(exports2, module2) {
857
- "use strict";
858
- var hasSymbols = require_shams();
859
- module2.exports = function hasToStringTagShams() {
860
- return hasSymbols() && !!Symbol.toStringTag;
861
- };
862
- }
863
- });
864
-
865
- // ../../node_modules/.pnpm/is-regex@1.2.1/node_modules/is-regex/index.js
866
- var require_is_regex = __commonJS({
867
- "../../node_modules/.pnpm/is-regex@1.2.1/node_modules/is-regex/index.js"(exports2, module2) {
868
- "use strict";
869
- var callBound = require_call_bound();
870
- var hasToStringTag = require_shams2()();
871
- var hasOwn = require_hasown();
872
- var gOPD = require_gopd();
873
- var fn;
874
- if (hasToStringTag) {
875
- $exec = callBound("RegExp.prototype.exec");
876
- isRegexMarker = {};
877
- throwRegexMarker = function() {
878
- throw isRegexMarker;
879
- };
880
- badStringifier = {
881
- toString: throwRegexMarker,
882
- valueOf: throwRegexMarker
883
- };
884
- if (typeof Symbol.toPrimitive === "symbol") {
885
- badStringifier[Symbol.toPrimitive] = throwRegexMarker;
886
- }
887
- fn = function isRegex2(value) {
888
- if (!value || typeof value !== "object") {
889
- return false;
890
- }
891
- var descriptor = (
892
- /** @type {NonNullable<typeof gOPD>} */
893
- gOPD(
894
- /** @type {{ lastIndex?: unknown }} */
895
- value,
896
- "lastIndex"
897
- )
898
- );
899
- var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, "value");
900
- if (!hasLastIndexDataProperty) {
901
- return false;
902
- }
903
- try {
904
- $exec(
905
- value,
906
- /** @type {string} */
907
- /** @type {unknown} */
908
- badStringifier
909
- );
910
- } catch (e) {
911
- return e === isRegexMarker;
912
- }
913
- };
914
- } else {
915
- $toString = callBound("Object.prototype.toString");
916
- regexClass = "[object RegExp]";
917
- fn = function isRegex2(value) {
918
- if (!value || typeof value !== "object" && typeof value !== "function") {
919
- return false;
920
- }
921
- return $toString(value) === regexClass;
922
- };
923
- }
924
- var $exec;
925
- var isRegexMarker;
926
- var throwRegexMarker;
927
- var badStringifier;
928
- var $toString;
929
- var regexClass;
930
- module2.exports = fn;
931
- }
932
- });
933
-
934
- // ../../node_modules/.pnpm/property-expr@2.0.6/node_modules/property-expr/index.js
935
- var require_property_expr = __commonJS({
936
- "../../node_modules/.pnpm/property-expr@2.0.6/node_modules/property-expr/index.js"(exports2, module2) {
937
- "use strict";
938
- function Cache(maxSize) {
939
- this._maxSize = maxSize;
940
- this.clear();
941
- }
942
- Cache.prototype.clear = function() {
943
- this._size = 0;
944
- this._values = /* @__PURE__ */ Object.create(null);
945
- };
946
- Cache.prototype.get = function(key) {
947
- return this._values[key];
948
- };
949
- Cache.prototype.set = function(key, value) {
950
- this._size >= this._maxSize && this.clear();
951
- if (!(key in this._values)) this._size++;
952
- return this._values[key] = value;
953
- };
954
- var SPLIT_REGEX = /[^.^\]^[]+|(?=\[\]|\.\.)/g;
955
- var DIGIT_REGEX = /^\d+$/;
956
- var LEAD_DIGIT_REGEX = /^\d/;
957
- var SPEC_CHAR_REGEX = /[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g;
958
- var CLEAN_QUOTES_REGEX = /^\s*(['"]?)(.*?)(\1)\s*$/;
959
- var MAX_CACHE_SIZE = 512;
960
- var pathCache = new Cache(MAX_CACHE_SIZE);
961
- var setCache = new Cache(MAX_CACHE_SIZE);
962
- var getCache = new Cache(MAX_CACHE_SIZE);
963
- module2.exports = {
964
- Cache,
965
- split,
966
- normalizePath,
967
- setter: function(path9) {
968
- var parts = normalizePath(path9);
969
- return setCache.get(path9) || setCache.set(path9, function setter(obj, value) {
970
- var index = 0;
971
- var len = parts.length;
972
- var data = obj;
973
- while (index < len - 1) {
974
- var part = parts[index];
975
- if (part === "__proto__" || part === "constructor" || part === "prototype") {
976
- return obj;
977
- }
978
- data = data[parts[index++]];
979
- }
980
- data[parts[index]] = value;
981
- });
982
- },
983
- getter: function(path9, safe) {
984
- var parts = normalizePath(path9);
985
- return getCache.get(path9) || getCache.set(path9, function getter(data) {
986
- var index = 0, len = parts.length;
987
- while (index < len) {
988
- if (data != null || !safe) data = data[parts[index++]];
989
- else return;
990
- }
991
- return data;
992
- });
993
- },
994
- join: function(segments) {
995
- return segments.reduce(function(path9, part) {
996
- return path9 + (isQuoted(part) || DIGIT_REGEX.test(part) ? "[" + part + "]" : (path9 ? "." : "") + part);
997
- }, "");
998
- },
999
- forEach: function(path9, cb, thisArg) {
1000
- forEach(Array.isArray(path9) ? path9 : split(path9), cb, thisArg);
1001
- }
1002
- };
1003
- function normalizePath(path9) {
1004
- return pathCache.get(path9) || pathCache.set(
1005
- path9,
1006
- split(path9).map(function(part) {
1007
- return part.replace(CLEAN_QUOTES_REGEX, "$2");
1008
- })
1009
- );
1010
- }
1011
- function split(path9) {
1012
- return path9.match(SPLIT_REGEX) || [""];
1013
- }
1014
- function forEach(parts, iter, thisArg) {
1015
- var len = parts.length, part, idx, isArray, isBracket;
1016
- for (idx = 0; idx < len; idx++) {
1017
- part = parts[idx];
1018
- if (part) {
1019
- if (shouldBeQuoted(part)) {
1020
- part = '"' + part + '"';
1021
- }
1022
- isBracket = isQuoted(part);
1023
- isArray = !isBracket && /^\d+$/.test(part);
1024
- iter.call(thisArg, part, isBracket, isArray, idx, parts);
1025
- }
1026
- }
1027
- }
1028
- function isQuoted(str) {
1029
- return typeof str === "string" && str && ["'", '"'].indexOf(str.charAt(0)) !== -1;
1030
- }
1031
- function hasLeadingNumber(part) {
1032
- return part.match(LEAD_DIGIT_REGEX) && !part.match(DIGIT_REGEX);
1033
- }
1034
- function hasSpecialChars(part) {
1035
- return SPEC_CHAR_REGEX.test(part);
1036
- }
1037
- function shouldBeQuoted(part) {
1038
- return !isQuoted(part) && (hasLeadingNumber(part) || hasSpecialChars(part));
1039
- }
1040
- }
1041
- });
1042
-
1043
- // ../../node_modules/.pnpm/tiny-case@1.0.3/node_modules/tiny-case/index.js
1044
- var require_tiny_case = __commonJS({
1045
- "../../node_modules/.pnpm/tiny-case@1.0.3/node_modules/tiny-case/index.js"(exports2, module2) {
1046
- var reWords = /[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g;
1047
- var words = (str) => str.match(reWords) || [];
1048
- var upperFirst = (str) => str[0].toUpperCase() + str.slice(1);
1049
- var join5 = (str, d) => words(str).join(d).toLowerCase();
1050
- var camelCase = (str) => words(str).reduce(
1051
- (acc, next) => `${acc}${!acc ? next.toLowerCase() : next[0].toUpperCase() + next.slice(1).toLowerCase()}`,
1052
- ""
1053
- );
1054
- var pascalCase = (str) => upperFirst(camelCase(str));
1055
- var snakeCase = (str) => join5(str, "_");
1056
- var kebabCase = (str) => join5(str, "-");
1057
- var sentenceCase = (str) => upperFirst(join5(str, " "));
1058
- var titleCase = (str) => words(str).map(upperFirst).join(" ");
1059
- module2.exports = {
1060
- words,
1061
- upperFirst,
1062
- camelCase,
1063
- pascalCase,
1064
- snakeCase,
1065
- kebabCase,
1066
- sentenceCase,
1067
- titleCase
1068
- };
1069
- }
1070
- });
1071
-
1072
- // ../../node_modules/.pnpm/toposort@2.0.2/node_modules/toposort/index.js
1073
- var require_toposort = __commonJS({
1074
- "../../node_modules/.pnpm/toposort@2.0.2/node_modules/toposort/index.js"(exports2, module2) {
1075
- module2.exports = function(edges) {
1076
- return toposort(uniqueNodes(edges), edges);
1077
- };
1078
- module2.exports.array = toposort;
1079
- function toposort(nodes, edges) {
1080
- var cursor = nodes.length, sorted = new Array(cursor), visited = {}, i = cursor, outgoingEdges = makeOutgoingEdges(edges), nodesHash = makeNodesHash(nodes);
1081
- edges.forEach(function(edge) {
1082
- if (!nodesHash.has(edge[0]) || !nodesHash.has(edge[1])) {
1083
- throw new Error("Unknown node. There is an unknown node in the supplied edges.");
1084
- }
1085
- });
1086
- while (i--) {
1087
- if (!visited[i]) visit(nodes[i], i, /* @__PURE__ */ new Set());
1088
- }
1089
- return sorted;
1090
- function visit(node, i2, predecessors) {
1091
- if (predecessors.has(node)) {
1092
- var nodeRep;
1093
- try {
1094
- nodeRep = ", node was:" + JSON.stringify(node);
1095
- } catch (e) {
1096
- nodeRep = "";
1097
- }
1098
- throw new Error("Cyclic dependency" + nodeRep);
1099
- }
1100
- if (!nodesHash.has(node)) {
1101
- throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: " + JSON.stringify(node));
1102
- }
1103
- if (visited[i2]) return;
1104
- visited[i2] = true;
1105
- var outgoing = outgoingEdges.get(node) || /* @__PURE__ */ new Set();
1106
- outgoing = Array.from(outgoing);
1107
- if (i2 = outgoing.length) {
1108
- predecessors.add(node);
1109
- do {
1110
- var child = outgoing[--i2];
1111
- visit(child, nodesHash.get(child), predecessors);
1112
- } while (i2);
1113
- predecessors.delete(node);
1114
- }
1115
- sorted[--cursor] = node;
1116
- }
1117
- }
1118
- function uniqueNodes(arr) {
1119
- var res = /* @__PURE__ */ new Set();
1120
- for (var i = 0, len = arr.length; i < len; i++) {
1121
- var edge = arr[i];
1122
- res.add(edge[0]);
1123
- res.add(edge[1]);
1124
- }
1125
- return Array.from(res);
1126
- }
1127
- function makeOutgoingEdges(arr) {
1128
- var edges = /* @__PURE__ */ new Map();
1129
- for (var i = 0, len = arr.length; i < len; i++) {
1130
- var edge = arr[i];
1131
- if (!edges.has(edge[0])) edges.set(edge[0], /* @__PURE__ */ new Set());
1132
- if (!edges.has(edge[1])) edges.set(edge[1], /* @__PURE__ */ new Set());
1133
- edges.get(edge[0]).add(edge[1]);
1134
- }
1135
- return edges;
1136
- }
1137
- function makeNodesHash(arr) {
1138
- var res = /* @__PURE__ */ new Map();
1139
- for (var i = 0, len = arr.length; i < len; i++) {
1140
- res.set(arr[i], i);
1141
- }
1142
- return res;
1143
- }
1144
- }
1145
- });
1146
-
1147
- // ../../node_modules/.pnpm/yup@1.7.0/node_modules/yup/index.js
1148
- var require_yup = __commonJS({
1149
- "../../node_modules/.pnpm/yup@1.7.0/node_modules/yup/index.js"(exports2) {
1150
- "use strict";
1151
- Object.defineProperty(exports2, "__esModule", { value: true });
1152
- var propertyExpr = require_property_expr();
1153
- var tinyCase = require_tiny_case();
1154
- var toposort = require_toposort();
1155
- function _interopDefaultLegacy(e) {
1156
- return e && typeof e === "object" && "default" in e ? e : { "default": e };
1157
- }
1158
- var toposort__default = /* @__PURE__ */ _interopDefaultLegacy(toposort);
1159
- var toString = Object.prototype.toString;
1160
- var errorToString = Error.prototype.toString;
1161
- var regExpToString = RegExp.prototype.toString;
1162
- var symbolToString = typeof Symbol !== "undefined" ? Symbol.prototype.toString : () => "";
1163
- var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
1164
- function printNumber(val) {
1165
- if (val != +val) return "NaN";
1166
- const isNegativeZero = val === 0 && 1 / val < 0;
1167
- return isNegativeZero ? "-0" : "" + val;
1168
- }
1169
- function printSimpleValue(val, quoteStrings = false) {
1170
- if (val == null || val === true || val === false) return "" + val;
1171
- const typeOf = typeof val;
1172
- if (typeOf === "number") return printNumber(val);
1173
- if (typeOf === "string") return quoteStrings ? `"${val}"` : val;
1174
- if (typeOf === "function") return "[Function " + (val.name || "anonymous") + "]";
1175
- if (typeOf === "symbol") return symbolToString.call(val).replace(SYMBOL_REGEXP, "Symbol($1)");
1176
- const tag = toString.call(val).slice(8, -1);
1177
- if (tag === "Date") return isNaN(val.getTime()) ? "" + val : val.toISOString(val);
1178
- if (tag === "Error" || val instanceof Error) return "[" + errorToString.call(val) + "]";
1179
- if (tag === "RegExp") return regExpToString.call(val);
1180
- return null;
1181
- }
1182
- function printValue(value, quoteStrings) {
1183
- let result = printSimpleValue(value, quoteStrings);
1184
- if (result !== null) return result;
1185
- return JSON.stringify(value, function(key, value2) {
1186
- let result2 = printSimpleValue(this[key], quoteStrings);
1187
- if (result2 !== null) return result2;
1188
- return value2;
1189
- }, 2);
1190
- }
1191
- function toArray(value) {
1192
- return value == null ? [] : [].concat(value);
1193
- }
1194
- var _Symbol$toStringTag;
1195
- var _Symbol$hasInstance;
1196
- var _Symbol$toStringTag2;
1197
- var strReg = /\$\{\s*(\w+)\s*\}/g;
1198
- _Symbol$toStringTag = Symbol.toStringTag;
1199
- var ValidationErrorNoStack = class {
1200
- constructor(errorOrErrors, value, field, type) {
1201
- this.name = void 0;
1202
- this.message = void 0;
1203
- this.value = void 0;
1204
- this.path = void 0;
1205
- this.type = void 0;
1206
- this.params = void 0;
1207
- this.errors = void 0;
1208
- this.inner = void 0;
1209
- this[_Symbol$toStringTag] = "Error";
1210
- this.name = "ValidationError";
1211
- this.value = value;
1212
- this.path = field;
1213
- this.type = type;
1214
- this.errors = [];
1215
- this.inner = [];
1216
- toArray(errorOrErrors).forEach((err) => {
1217
- if (ValidationError2.isError(err)) {
1218
- this.errors.push(...err.errors);
1219
- const innerErrors = err.inner.length ? err.inner : [err];
1220
- this.inner.push(...innerErrors);
1221
- } else {
1222
- this.errors.push(err);
1223
- }
1224
- });
1225
- this.message = this.errors.length > 1 ? `${this.errors.length} errors occurred` : this.errors[0];
1226
- }
1227
- };
1228
- _Symbol$hasInstance = Symbol.hasInstance;
1229
- _Symbol$toStringTag2 = Symbol.toStringTag;
1230
- var ValidationError2 = class _ValidationError extends Error {
1231
- static formatError(message2, params) {
1232
- const path9 = params.label || params.path || "this";
1233
- params = Object.assign({}, params, {
1234
- path: path9,
1235
- originalPath: params.path
1236
- });
1237
- if (typeof message2 === "string") return message2.replace(strReg, (_, key) => printValue(params[key]));
1238
- if (typeof message2 === "function") return message2(params);
1239
- return message2;
1240
- }
1241
- static isError(err) {
1242
- return err && err.name === "ValidationError";
1243
- }
1244
- constructor(errorOrErrors, value, field, type, disableStack) {
1245
- const errorNoStack = new ValidationErrorNoStack(errorOrErrors, value, field, type);
1246
- if (disableStack) {
1247
- return errorNoStack;
1248
- }
1249
- super();
1250
- this.value = void 0;
1251
- this.path = void 0;
1252
- this.type = void 0;
1253
- this.params = void 0;
1254
- this.errors = [];
1255
- this.inner = [];
1256
- this[_Symbol$toStringTag2] = "Error";
1257
- this.name = errorNoStack.name;
1258
- this.message = errorNoStack.message;
1259
- this.type = errorNoStack.type;
1260
- this.value = errorNoStack.value;
1261
- this.path = errorNoStack.path;
1262
- this.errors = errorNoStack.errors;
1263
- this.inner = errorNoStack.inner;
1264
- if (Error.captureStackTrace) {
1265
- Error.captureStackTrace(this, _ValidationError);
1266
- }
1267
- }
1268
- static [_Symbol$hasInstance](inst) {
1269
- return ValidationErrorNoStack[Symbol.hasInstance](inst) || super[Symbol.hasInstance](inst);
1270
- }
1271
- };
1272
- var mixed = {
1273
- default: "${path} is invalid",
1274
- required: "${path} is a required field",
1275
- defined: "${path} must be defined",
1276
- notNull: "${path} cannot be null",
1277
- oneOf: "${path} must be one of the following values: ${values}",
1278
- notOneOf: "${path} must not be one of the following values: ${values}",
1279
- notType: ({
1280
- path: path9,
1281
- type,
1282
- value,
1283
- originalValue
1284
- }) => {
1285
- const castMsg = originalValue != null && originalValue !== value ? ` (cast from the value \`${printValue(originalValue, true)}\`).` : ".";
1286
- return type !== "mixed" ? `${path9} must be a \`${type}\` type, but the final value was: \`${printValue(value, true)}\`` + castMsg : `${path9} must match the configured type. The validated value was: \`${printValue(value, true)}\`` + castMsg;
1287
- }
1288
- };
1289
- var string2 = {
1290
- length: "${path} must be exactly ${length} characters",
1291
- min: "${path} must be at least ${min} characters",
1292
- max: "${path} must be at most ${max} characters",
1293
- matches: '${path} must match the following: "${regex}"',
1294
- email: "${path} must be a valid email",
1295
- url: "${path} must be a valid URL",
1296
- uuid: "${path} must be a valid UUID",
1297
- datetime: "${path} must be a valid ISO date-time",
1298
- datetime_precision: "${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",
1299
- datetime_offset: '${path} must be a valid ISO date-time with UTC "Z" timezone',
1300
- trim: "${path} must be a trimmed string",
1301
- lowercase: "${path} must be a lowercase string",
1302
- uppercase: "${path} must be a upper case string"
1303
- };
1304
- var number2 = {
1305
- min: "${path} must be greater than or equal to ${min}",
1306
- max: "${path} must be less than or equal to ${max}",
1307
- lessThan: "${path} must be less than ${less}",
1308
- moreThan: "${path} must be greater than ${more}",
1309
- positive: "${path} must be a positive number",
1310
- negative: "${path} must be a negative number",
1311
- integer: "${path} must be an integer"
1312
- };
1313
- var date2 = {
1314
- min: "${path} field must be later than ${min}",
1315
- max: "${path} field must be at earlier than ${max}"
1316
- };
1317
- var boolean2 = {
1318
- isValue: "${path} field must be ${value}"
1319
- };
1320
- var object2 = {
1321
- noUnknown: "${path} field has unspecified keys: ${unknown}",
1322
- exact: "${path} object contains unknown properties: ${properties}"
1323
- };
1324
- var array = {
1325
- min: "${path} field must have at least ${min} items",
1326
- max: "${path} field must have less than or equal to ${max} items",
1327
- length: "${path} must have ${length} items"
1328
- };
1329
- var tuple = {
1330
- notType: (params) => {
1331
- const {
1332
- path: path9,
1333
- value,
1334
- spec
1335
- } = params;
1336
- const typeLen = spec.types.length;
1337
- if (Array.isArray(value)) {
1338
- if (value.length < typeLen) return `${path9} tuple value has too few items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
1339
- if (value.length > typeLen) return `${path9} tuple value has too many items, expected a length of ${typeLen} but got ${value.length} for value: \`${printValue(value, true)}\``;
1340
- }
1341
- return ValidationError2.formatError(mixed.notType, params);
1342
- }
1343
- };
1344
- var locale = Object.assign(/* @__PURE__ */ Object.create(null), {
1345
- mixed,
1346
- string: string2,
1347
- number: number2,
1348
- date: date2,
1349
- object: object2,
1350
- array,
1351
- boolean: boolean2,
1352
- tuple
1353
- });
1354
- var isSchema = (obj) => obj && obj.__isYupSchema__;
1355
- var Condition = class _Condition {
1356
- static fromOptions(refs, config) {
1357
- if (!config.then && !config.otherwise) throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");
1358
- let {
1359
- is,
1360
- then,
1361
- otherwise
1362
- } = config;
1363
- let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
1364
- return new _Condition(refs, (values, schema) => {
1365
- var _branch;
1366
- let branch2 = check(...values) ? then : otherwise;
1367
- return (_branch = branch2 == null ? void 0 : branch2(schema)) != null ? _branch : schema;
1368
- });
1369
- }
1370
- constructor(refs, builder) {
1371
- this.fn = void 0;
1372
- this.refs = refs;
1373
- this.refs = refs;
1374
- this.fn = builder;
1375
- }
1376
- resolve(base, options) {
1377
- let values = this.refs.map((ref) => (
1378
- // TODO: ? operator here?
1379
- ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
1380
- ));
1381
- let schema = this.fn(values, base, options);
1382
- if (schema === void 0 || // @ts-ignore this can be base
1383
- schema === base) {
1384
- return base;
1385
- }
1386
- if (!isSchema(schema)) throw new TypeError("conditions must return a schema object");
1387
- return schema.resolve(options);
1388
- }
1389
- };
1390
- var prefixes = {
1391
- context: "$",
1392
- value: "."
1393
- };
1394
- function create$9(key, options) {
1395
- return new Reference(key, options);
1396
- }
1397
- var Reference = class {
1398
- constructor(key, options = {}) {
1399
- this.key = void 0;
1400
- this.isContext = void 0;
1401
- this.isValue = void 0;
1402
- this.isSibling = void 0;
1403
- this.path = void 0;
1404
- this.getter = void 0;
1405
- this.map = void 0;
1406
- if (typeof key !== "string") throw new TypeError("ref must be a string, got: " + key);
1407
- this.key = key.trim();
1408
- if (key === "") throw new TypeError("ref must be a non-empty string");
1409
- this.isContext = this.key[0] === prefixes.context;
1410
- this.isValue = this.key[0] === prefixes.value;
1411
- this.isSibling = !this.isContext && !this.isValue;
1412
- let prefix = this.isContext ? prefixes.context : this.isValue ? prefixes.value : "";
1413
- this.path = this.key.slice(prefix.length);
1414
- this.getter = this.path && propertyExpr.getter(this.path, true);
1415
- this.map = options.map;
1416
- }
1417
- getValue(value, parent, context) {
1418
- let result = this.isContext ? context : this.isValue ? value : parent;
1419
- if (this.getter) result = this.getter(result || {});
1420
- if (this.map) result = this.map(result);
1421
- return result;
1422
- }
1423
- /**
1424
- *
1425
- * @param {*} value
1426
- * @param {Object} options
1427
- * @param {Object=} options.context
1428
- * @param {Object=} options.parent
1429
- */
1430
- cast(value, options) {
1431
- return this.getValue(value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context);
1432
- }
1433
- resolve() {
1434
- return this;
1435
- }
1436
- describe() {
1437
- return {
1438
- type: "ref",
1439
- key: this.key
1440
- };
1441
- }
1442
- toString() {
1443
- return `Ref(${this.key})`;
1444
- }
1445
- static isRef(value) {
1446
- return value && value.__isYupRef;
1447
- }
1448
- };
1449
- Reference.prototype.__isYupRef = true;
1450
- var isAbsent = (value) => value == null;
1451
- function createValidation(config) {
1452
- function validate({
1453
- value,
1454
- path: path9 = "",
1455
- options,
1456
- originalValue,
1457
- schema
1458
- }, panic, next) {
1459
- const {
1460
- name,
1461
- test,
1462
- params,
1463
- message: message2,
1464
- skipAbsent
1465
- } = config;
1466
- let {
1467
- parent,
1468
- context,
1469
- abortEarly = schema.spec.abortEarly,
1470
- disableStackTrace = schema.spec.disableStackTrace
1471
- } = options;
1472
- const resolveOptions = {
1473
- value,
1474
- parent,
1475
- context
1476
- };
1477
- function createError(overrides = {}) {
1478
- const nextParams = resolveParams(Object.assign({
1479
- value,
1480
- originalValue,
1481
- label: schema.spec.label,
1482
- path: overrides.path || path9,
1483
- spec: schema.spec,
1484
- disableStackTrace: overrides.disableStackTrace || disableStackTrace
1485
- }, params, overrides.params), resolveOptions);
1486
- const error = new ValidationError2(ValidationError2.formatError(overrides.message || message2, nextParams), value, nextParams.path, overrides.type || name, nextParams.disableStackTrace);
1487
- error.params = nextParams;
1488
- return error;
1489
- }
1490
- const invalid = abortEarly ? panic : next;
1491
- let ctx = {
1492
- path: path9,
1493
- parent,
1494
- type: name,
1495
- from: options.from,
1496
- createError,
1497
- resolve(item) {
1498
- return resolveMaybeRef(item, resolveOptions);
1499
- },
1500
- options,
1501
- originalValue,
1502
- schema
1503
- };
1504
- const handleResult = (validOrError) => {
1505
- if (ValidationError2.isError(validOrError)) invalid(validOrError);
1506
- else if (!validOrError) invalid(createError());
1507
- else next(null);
1508
- };
1509
- const handleError = (err) => {
1510
- if (ValidationError2.isError(err)) invalid(err);
1511
- else panic(err);
1512
- };
1513
- const shouldSkip = skipAbsent && isAbsent(value);
1514
- if (shouldSkip) {
1515
- return handleResult(true);
1516
- }
1517
- let result;
1518
- try {
1519
- var _result;
1520
- result = test.call(ctx, value, ctx);
1521
- if (typeof ((_result = result) == null ? void 0 : _result.then) === "function") {
1522
- if (options.sync) {
1523
- throw new Error(`Validation test of type: "${ctx.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);
1524
- }
1525
- return Promise.resolve(result).then(handleResult, handleError);
1526
- }
1527
- } catch (err) {
1528
- handleError(err);
1529
- return;
1530
- }
1531
- handleResult(result);
1532
- }
1533
- validate.OPTIONS = config;
1534
- return validate;
1535
- }
1536
- function resolveParams(params, options) {
1537
- if (!params) return params;
1538
- for (const key of Object.keys(params)) {
1539
- params[key] = resolveMaybeRef(params[key], options);
1540
- }
1541
- return params;
1542
- }
1543
- function resolveMaybeRef(item, options) {
1544
- return Reference.isRef(item) ? item.getValue(options.value, options.parent, options.context) : item;
1545
- }
1546
- function getIn(schema, path9, value, context = value) {
1547
- let parent, lastPart, lastPartDebug;
1548
- if (!path9) return {
1549
- parent,
1550
- parentPath: path9,
1551
- schema
1552
- };
1553
- propertyExpr.forEach(path9, (_part, isBracket, isArray) => {
1554
- let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
1555
- schema = schema.resolve({
1556
- context,
1557
- parent,
1558
- value
1559
- });
1560
- let isTuple = schema.type === "tuple";
1561
- let idx = isArray ? parseInt(part, 10) : 0;
1562
- if (schema.innerType || isTuple) {
1563
- if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
1564
- if (value && idx >= value.length) {
1565
- throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path9}. because there is no value at that index. `);
1566
- }
1567
- parent = value;
1568
- value = value && value[idx];
1569
- schema = isTuple ? schema.spec.types[idx] : schema.innerType;
1570
- }
1571
- if (!isArray) {
1572
- if (!schema.fields || !schema.fields[part]) throw new Error(`The schema does not contain the path: ${path9}. (failed at: ${lastPartDebug} which is a type: "${schema.type}")`);
1573
- parent = value;
1574
- value = value && value[part];
1575
- schema = schema.fields[part];
1576
- }
1577
- lastPart = part;
1578
- lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
1579
- });
1580
- return {
1581
- schema,
1582
- parent,
1583
- parentPath: lastPart
1584
- };
1585
- }
1586
- function reach(obj, path9, value, context) {
1587
- return getIn(obj, path9, value, context).schema;
1588
- }
1589
- var ReferenceSet = class _ReferenceSet extends Set {
1590
- describe() {
1591
- const description = [];
1592
- for (const item of this.values()) {
1593
- description.push(Reference.isRef(item) ? item.describe() : item);
1594
- }
1595
- return description;
1596
- }
1597
- resolveAll(resolve5) {
1598
- let result = [];
1599
- for (const item of this.values()) {
1600
- result.push(resolve5(item));
1601
- }
1602
- return result;
1603
- }
1604
- clone() {
1605
- return new _ReferenceSet(this.values());
1606
- }
1607
- merge(newItems, removeItems) {
1608
- const next = this.clone();
1609
- newItems.forEach((value) => next.add(value));
1610
- removeItems.forEach((value) => next.delete(value));
1611
- return next;
1612
- }
1613
- };
1614
- function clone(src, seen = /* @__PURE__ */ new Map()) {
1615
- if (isSchema(src) || !src || typeof src !== "object") return src;
1616
- if (seen.has(src)) return seen.get(src);
1617
- let copy;
1618
- if (src instanceof Date) {
1619
- copy = new Date(src.getTime());
1620
- seen.set(src, copy);
1621
- } else if (src instanceof RegExp) {
1622
- copy = new RegExp(src);
1623
- seen.set(src, copy);
1624
- } else if (Array.isArray(src)) {
1625
- copy = new Array(src.length);
1626
- seen.set(src, copy);
1627
- for (let i = 0; i < src.length; i++) copy[i] = clone(src[i], seen);
1628
- } else if (src instanceof Map) {
1629
- copy = /* @__PURE__ */ new Map();
1630
- seen.set(src, copy);
1631
- for (const [k, v] of src.entries()) copy.set(k, clone(v, seen));
1632
- } else if (src instanceof Set) {
1633
- copy = /* @__PURE__ */ new Set();
1634
- seen.set(src, copy);
1635
- for (const v of src) copy.add(clone(v, seen));
1636
- } else if (src instanceof Object) {
1637
- copy = {};
1638
- seen.set(src, copy);
1639
- for (const [k, v] of Object.entries(src)) copy[k] = clone(v, seen);
1640
- } else {
1641
- throw Error(`Unable to clone ${src}`);
1642
- }
1643
- return copy;
1644
- }
1645
- function createStandardPath(path9) {
1646
- if (!(path9 != null && path9.length)) {
1647
- return void 0;
1648
- }
1649
- const segments = [];
1650
- let currentSegment = "";
1651
- let inBrackets = false;
1652
- let inQuotes = false;
1653
- for (let i = 0; i < path9.length; i++) {
1654
- const char = path9[i];
1655
- if (char === "[" && !inQuotes) {
1656
- if (currentSegment) {
1657
- segments.push(...currentSegment.split(".").filter(Boolean));
1658
- currentSegment = "";
1659
- }
1660
- inBrackets = true;
1661
- continue;
1662
- }
1663
- if (char === "]" && !inQuotes) {
1664
- if (currentSegment) {
1665
- if (/^\d+$/.test(currentSegment)) {
1666
- segments.push(currentSegment);
1667
- } else {
1668
- segments.push(currentSegment.replace(/^"|"$/g, ""));
1669
- }
1670
- currentSegment = "";
1671
- }
1672
- inBrackets = false;
1673
- continue;
1674
- }
1675
- if (char === '"') {
1676
- inQuotes = !inQuotes;
1677
- continue;
1678
- }
1679
- if (char === "." && !inBrackets && !inQuotes) {
1680
- if (currentSegment) {
1681
- segments.push(currentSegment);
1682
- currentSegment = "";
1683
- }
1684
- continue;
1685
- }
1686
- currentSegment += char;
1687
- }
1688
- if (currentSegment) {
1689
- segments.push(...currentSegment.split(".").filter(Boolean));
1690
- }
1691
- return segments;
1692
- }
1693
- function createStandardIssues(error, parentPath) {
1694
- const path9 = parentPath ? `${parentPath}.${error.path}` : error.path;
1695
- return error.errors.map((err) => ({
1696
- message: err,
1697
- path: createStandardPath(path9)
1698
- }));
1699
- }
1700
- function issuesFromValidationError(error, parentPath) {
1701
- var _error$inner;
1702
- if (!((_error$inner = error.inner) != null && _error$inner.length) && error.errors.length) {
1703
- return createStandardIssues(error, parentPath);
1704
- }
1705
- const path9 = parentPath ? `${parentPath}.${error.path}` : error.path;
1706
- return error.inner.flatMap((err) => issuesFromValidationError(err, path9));
1707
- }
1708
- var Schema = class {
1709
- constructor(options) {
1710
- this.type = void 0;
1711
- this.deps = [];
1712
- this.tests = void 0;
1713
- this.transforms = void 0;
1714
- this.conditions = [];
1715
- this._mutate = void 0;
1716
- this.internalTests = {};
1717
- this._whitelist = new ReferenceSet();
1718
- this._blacklist = new ReferenceSet();
1719
- this.exclusiveTests = /* @__PURE__ */ Object.create(null);
1720
- this._typeCheck = void 0;
1721
- this.spec = void 0;
1722
- this.tests = [];
1723
- this.transforms = [];
1724
- this.withMutation(() => {
1725
- this.typeError(mixed.notType);
1726
- });
1727
- this.type = options.type;
1728
- this._typeCheck = options.check;
1729
- this.spec = Object.assign({
1730
- strip: false,
1731
- strict: false,
1732
- abortEarly: true,
1733
- recursive: true,
1734
- disableStackTrace: false,
1735
- nullable: false,
1736
- optional: true,
1737
- coerce: true
1738
- }, options == null ? void 0 : options.spec);
1739
- this.withMutation((s) => {
1740
- s.nonNullable();
1741
- });
1742
- }
1743
- // TODO: remove
1744
- get _type() {
1745
- return this.type;
1746
- }
1747
- clone(spec) {
1748
- if (this._mutate) {
1749
- if (spec) Object.assign(this.spec, spec);
1750
- return this;
1751
- }
1752
- const next = Object.create(Object.getPrototypeOf(this));
1753
- next.type = this.type;
1754
- next._typeCheck = this._typeCheck;
1755
- next._whitelist = this._whitelist.clone();
1756
- next._blacklist = this._blacklist.clone();
1757
- next.internalTests = Object.assign({}, this.internalTests);
1758
- next.exclusiveTests = Object.assign({}, this.exclusiveTests);
1759
- next.deps = [...this.deps];
1760
- next.conditions = [...this.conditions];
1761
- next.tests = [...this.tests];
1762
- next.transforms = [...this.transforms];
1763
- next.spec = clone(Object.assign({}, this.spec, spec));
1764
- return next;
1765
- }
1766
- label(label) {
1767
- let next = this.clone();
1768
- next.spec.label = label;
1769
- return next;
1770
- }
1771
- meta(...args2) {
1772
- if (args2.length === 0) return this.spec.meta;
1773
- let next = this.clone();
1774
- next.spec.meta = Object.assign(next.spec.meta || {}, args2[0]);
1775
- return next;
1776
- }
1777
- withMutation(fn) {
1778
- let before = this._mutate;
1779
- this._mutate = true;
1780
- let result = fn(this);
1781
- this._mutate = before;
1782
- return result;
1783
- }
1784
- concat(schema) {
1785
- if (!schema || schema === this) return this;
1786
- if (schema.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema.type}`);
1787
- let base = this;
1788
- let combined = schema.clone();
1789
- const mergedSpec = Object.assign({}, base.spec, combined.spec);
1790
- combined.spec = mergedSpec;
1791
- combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
1792
- combined._whitelist = base._whitelist.merge(schema._whitelist, schema._blacklist);
1793
- combined._blacklist = base._blacklist.merge(schema._blacklist, schema._whitelist);
1794
- combined.tests = base.tests;
1795
- combined.exclusiveTests = base.exclusiveTests;
1796
- combined.withMutation((next) => {
1797
- schema.tests.forEach((fn) => {
1798
- next.test(fn.OPTIONS);
1799
- });
1800
- });
1801
- combined.transforms = [...base.transforms, ...combined.transforms];
1802
- return combined;
1803
- }
1804
- isType(v) {
1805
- if (v == null) {
1806
- if (this.spec.nullable && v === null) return true;
1807
- if (this.spec.optional && v === void 0) return true;
1808
- return false;
1809
- }
1810
- return this._typeCheck(v);
1811
- }
1812
- resolve(options) {
1813
- let schema = this;
1814
- if (schema.conditions.length) {
1815
- let conditions = schema.conditions;
1816
- schema = schema.clone();
1817
- schema.conditions = [];
1818
- schema = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema);
1819
- schema = schema.resolve(options);
1820
- }
1821
- return schema;
1822
- }
1823
- resolveOptions(options) {
1824
- var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
1825
- return Object.assign({}, options, {
1826
- from: options.from || [],
1827
- strict: (_options$strict = options.strict) != null ? _options$strict : this.spec.strict,
1828
- abortEarly: (_options$abortEarly = options.abortEarly) != null ? _options$abortEarly : this.spec.abortEarly,
1829
- recursive: (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive,
1830
- disableStackTrace: (_options$disableStack = options.disableStackTrace) != null ? _options$disableStack : this.spec.disableStackTrace
1831
- });
1832
- }
1833
- /**
1834
- * Run the configured transform pipeline over an input value.
1835
- */
1836
- cast(value, options = {}) {
1837
- let resolvedSchema = this.resolve(Object.assign({
1838
- value
1839
- }, options));
1840
- let allowOptionality = options.assert === "ignore-optionality";
1841
- let result = resolvedSchema._cast(value, options);
1842
- if (options.assert !== false && !resolvedSchema.isType(result)) {
1843
- if (allowOptionality && isAbsent(result)) {
1844
- return result;
1845
- }
1846
- let formattedValue = printValue(value);
1847
- let formattedResult = printValue(result);
1848
- throw new TypeError(`The value of ${options.path || "field"} could not be cast to a value that satisfies the schema type: "${resolvedSchema.type}".
1849
-
1850
- attempted value: ${formattedValue}
1851
- ` + (formattedResult !== formattedValue ? `result of cast: ${formattedResult}` : ""));
1852
- }
1853
- return result;
1854
- }
1855
- _cast(rawValue, options) {
1856
- let value = rawValue === void 0 ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this), rawValue);
1857
- if (value === void 0) {
1858
- value = this.getDefault(options);
1859
- }
1860
- return value;
1861
- }
1862
- _validate(_value, options = {}, panic, next) {
1863
- let {
1864
- path: path9,
1865
- originalValue = _value,
1866
- strict = this.spec.strict
1867
- } = options;
1868
- let value = _value;
1869
- if (!strict) {
1870
- value = this._cast(value, Object.assign({
1871
- assert: false
1872
- }, options));
1873
- }
1874
- let initialTests = [];
1875
- for (let test of Object.values(this.internalTests)) {
1876
- if (test) initialTests.push(test);
1877
- }
1878
- this.runTests({
1879
- path: path9,
1880
- value,
1881
- originalValue,
1882
- options,
1883
- tests: initialTests
1884
- }, panic, (initialErrors) => {
1885
- if (initialErrors.length) {
1886
- return next(initialErrors, value);
1887
- }
1888
- this.runTests({
1889
- path: path9,
1890
- value,
1891
- originalValue,
1892
- options,
1893
- tests: this.tests
1894
- }, panic, next);
1895
- });
1896
- }
1897
- /**
1898
- * Executes a set of validations, either schema, produced Tests or a nested
1899
- * schema validate result.
1900
- */
1901
- runTests(runOptions, panic, next) {
1902
- let fired = false;
1903
- let {
1904
- tests,
1905
- value,
1906
- originalValue,
1907
- path: path9,
1908
- options
1909
- } = runOptions;
1910
- let panicOnce = (arg) => {
1911
- if (fired) return;
1912
- fired = true;
1913
- panic(arg, value);
1914
- };
1915
- let nextOnce = (arg) => {
1916
- if (fired) return;
1917
- fired = true;
1918
- next(arg, value);
1919
- };
1920
- let count = tests.length;
1921
- let nestedErrors = [];
1922
- if (!count) return nextOnce([]);
1923
- let args2 = {
1924
- value,
1925
- originalValue,
1926
- path: path9,
1927
- options,
1928
- schema: this
1929
- };
1930
- for (let i = 0; i < tests.length; i++) {
1931
- const test = tests[i];
1932
- test(args2, panicOnce, function finishTestRun(err) {
1933
- if (err) {
1934
- Array.isArray(err) ? nestedErrors.push(...err) : nestedErrors.push(err);
1935
- }
1936
- if (--count <= 0) {
1937
- nextOnce(nestedErrors);
1938
- }
1939
- });
1940
- }
1941
- }
1942
- asNestedTest({
1943
- key,
1944
- index,
1945
- parent,
1946
- parentPath,
1947
- originalParent,
1948
- options
1949
- }) {
1950
- const k = key != null ? key : index;
1951
- if (k == null) {
1952
- throw TypeError("Must include `key` or `index` for nested validations");
1953
- }
1954
- const isIndex = typeof k === "number";
1955
- let value = parent[k];
1956
- const testOptions = Object.assign({}, options, {
1957
- // Nested validations fields are always strict:
1958
- // 1. parent isn't strict so the casting will also have cast inner values
1959
- // 2. parent is strict in which case the nested values weren't cast either
1960
- strict: true,
1961
- parent,
1962
- value,
1963
- originalValue: originalParent[k],
1964
- // FIXME: tests depend on `index` being passed around deeply,
1965
- // we should not let the options.key/index bleed through
1966
- key: void 0,
1967
- // index: undefined,
1968
- [isIndex ? "index" : "key"]: k,
1969
- path: isIndex || k.includes(".") ? `${parentPath || ""}[${isIndex ? k : `"${k}"`}]` : (parentPath ? `${parentPath}.` : "") + key
1970
- });
1971
- return (_, panic, next) => this.resolve(testOptions)._validate(value, testOptions, panic, next);
1972
- }
1973
- validate(value, options) {
1974
- var _options$disableStack2;
1975
- let schema = this.resolve(Object.assign({}, options, {
1976
- value
1977
- }));
1978
- let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema.spec.disableStackTrace;
1979
- return new Promise((resolve5, reject) => schema._validate(value, options, (error, parsed) => {
1980
- if (ValidationError2.isError(error)) error.value = parsed;
1981
- reject(error);
1982
- }, (errors, validated) => {
1983
- if (errors.length) reject(new ValidationError2(errors, validated, void 0, void 0, disableStackTrace));
1984
- else resolve5(validated);
1985
- }));
1986
- }
1987
- validateSync(value, options) {
1988
- var _options$disableStack3;
1989
- let schema = this.resolve(Object.assign({}, options, {
1990
- value
1991
- }));
1992
- let result;
1993
- let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema.spec.disableStackTrace;
1994
- schema._validate(value, Object.assign({}, options, {
1995
- sync: true
1996
- }), (error, parsed) => {
1997
- if (ValidationError2.isError(error)) error.value = parsed;
1998
- throw error;
1999
- }, (errors, validated) => {
2000
- if (errors.length) throw new ValidationError2(errors, value, void 0, void 0, disableStackTrace);
2001
- result = validated;
2002
- });
2003
- return result;
2004
- }
2005
- isValid(value, options) {
2006
- return this.validate(value, options).then(() => true, (err) => {
2007
- if (ValidationError2.isError(err)) return false;
2008
- throw err;
2009
- });
2010
- }
2011
- isValidSync(value, options) {
2012
- try {
2013
- this.validateSync(value, options);
2014
- return true;
2015
- } catch (err) {
2016
- if (ValidationError2.isError(err)) return false;
2017
- throw err;
2018
- }
2019
- }
2020
- _getDefault(options) {
2021
- let defaultValue = this.spec.default;
2022
- if (defaultValue == null) {
2023
- return defaultValue;
2024
- }
2025
- return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
2026
- }
2027
- getDefault(options) {
2028
- let schema = this.resolve(options || {});
2029
- return schema._getDefault(options);
2030
- }
2031
- default(def) {
2032
- if (arguments.length === 0) {
2033
- return this._getDefault();
2034
- }
2035
- let next = this.clone({
2036
- default: def
2037
- });
2038
- return next;
2039
- }
2040
- strict(isStrict = true) {
2041
- return this.clone({
2042
- strict: isStrict
2043
- });
2044
- }
2045
- nullability(nullable, message2) {
2046
- const next = this.clone({
2047
- nullable
2048
- });
2049
- next.internalTests.nullable = createValidation({
2050
- message: message2,
2051
- name: "nullable",
2052
- test(value) {
2053
- return value === null ? this.schema.spec.nullable : true;
2054
- }
2055
- });
2056
- return next;
2057
- }
2058
- optionality(optional, message2) {
2059
- const next = this.clone({
2060
- optional
2061
- });
2062
- next.internalTests.optionality = createValidation({
2063
- message: message2,
2064
- name: "optionality",
2065
- test(value) {
2066
- return value === void 0 ? this.schema.spec.optional : true;
2067
- }
2068
- });
2069
- return next;
2070
- }
2071
- optional() {
2072
- return this.optionality(true);
2073
- }
2074
- defined(message2 = mixed.defined) {
2075
- return this.optionality(false, message2);
2076
- }
2077
- nullable() {
2078
- return this.nullability(true);
2079
- }
2080
- nonNullable(message2 = mixed.notNull) {
2081
- return this.nullability(false, message2);
2082
- }
2083
- required(message2 = mixed.required) {
2084
- return this.clone().withMutation((next) => next.nonNullable(message2).defined(message2));
2085
- }
2086
- notRequired() {
2087
- return this.clone().withMutation((next) => next.nullable().optional());
2088
- }
2089
- transform(fn) {
2090
- let next = this.clone();
2091
- next.transforms.push(fn);
2092
- return next;
2093
- }
2094
- /**
2095
- * Adds a test function to the schema's queue of tests.
2096
- * tests can be exclusive or non-exclusive.
2097
- *
2098
- * - exclusive tests, will replace any existing tests of the same name.
2099
- * - non-exclusive: can be stacked
2100
- *
2101
- * If a non-exclusive test is added to a schema with an exclusive test of the same name
2102
- * the exclusive test is removed and further tests of the same name will be stacked.
2103
- *
2104
- * If an exclusive test is added to a schema with non-exclusive tests of the same name
2105
- * the previous tests are removed and further tests of the same name will replace each other.
2106
- */
2107
- test(...args2) {
2108
- let opts;
2109
- if (args2.length === 1) {
2110
- if (typeof args2[0] === "function") {
2111
- opts = {
2112
- test: args2[0]
2113
- };
2114
- } else {
2115
- opts = args2[0];
2116
- }
2117
- } else if (args2.length === 2) {
2118
- opts = {
2119
- name: args2[0],
2120
- test: args2[1]
2121
- };
2122
- } else {
2123
- opts = {
2124
- name: args2[0],
2125
- message: args2[1],
2126
- test: args2[2]
2127
- };
2128
- }
2129
- if (opts.message === void 0) opts.message = mixed.default;
2130
- if (typeof opts.test !== "function") throw new TypeError("`test` is a required parameters");
2131
- let next = this.clone();
2132
- let validate = createValidation(opts);
2133
- let isExclusive = opts.exclusive || opts.name && next.exclusiveTests[opts.name] === true;
2134
- if (opts.exclusive) {
2135
- if (!opts.name) throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");
2136
- }
2137
- if (opts.name) next.exclusiveTests[opts.name] = !!opts.exclusive;
2138
- next.tests = next.tests.filter((fn) => {
2139
- if (fn.OPTIONS.name === opts.name) {
2140
- if (isExclusive) return false;
2141
- if (fn.OPTIONS.test === validate.OPTIONS.test) return false;
2142
- }
2143
- return true;
2144
- });
2145
- next.tests.push(validate);
2146
- return next;
2147
- }
2148
- when(keys, options) {
2149
- if (!Array.isArray(keys) && typeof keys !== "string") {
2150
- options = keys;
2151
- keys = ".";
2152
- }
2153
- let next = this.clone();
2154
- let deps = toArray(keys).map((key) => new Reference(key));
2155
- deps.forEach((dep) => {
2156
- if (dep.isSibling) next.deps.push(dep.key);
2157
- });
2158
- next.conditions.push(typeof options === "function" ? new Condition(deps, options) : Condition.fromOptions(deps, options));
2159
- return next;
2160
- }
2161
- typeError(message2) {
2162
- let next = this.clone();
2163
- next.internalTests.typeError = createValidation({
2164
- message: message2,
2165
- name: "typeError",
2166
- skipAbsent: true,
2167
- test(value) {
2168
- if (!this.schema._typeCheck(value)) return this.createError({
2169
- params: {
2170
- type: this.schema.type
2171
- }
2172
- });
2173
- return true;
2174
- }
2175
- });
2176
- return next;
2177
- }
2178
- oneOf(enums, message2 = mixed.oneOf) {
2179
- let next = this.clone();
2180
- enums.forEach((val) => {
2181
- next._whitelist.add(val);
2182
- next._blacklist.delete(val);
2183
- });
2184
- next.internalTests.whiteList = createValidation({
2185
- message: message2,
2186
- name: "oneOf",
2187
- skipAbsent: true,
2188
- test(value) {
2189
- let valids = this.schema._whitelist;
2190
- let resolved = valids.resolveAll(this.resolve);
2191
- return resolved.includes(value) ? true : this.createError({
2192
- params: {
2193
- values: Array.from(valids).join(", "),
2194
- resolved
2195
- }
2196
- });
2197
- }
2198
- });
2199
- return next;
2200
- }
2201
- notOneOf(enums, message2 = mixed.notOneOf) {
2202
- let next = this.clone();
2203
- enums.forEach((val) => {
2204
- next._blacklist.add(val);
2205
- next._whitelist.delete(val);
2206
- });
2207
- next.internalTests.blacklist = createValidation({
2208
- message: message2,
2209
- name: "notOneOf",
2210
- test(value) {
2211
- let invalids = this.schema._blacklist;
2212
- let resolved = invalids.resolveAll(this.resolve);
2213
- if (resolved.includes(value)) return this.createError({
2214
- params: {
2215
- values: Array.from(invalids).join(", "),
2216
- resolved
2217
- }
2218
- });
2219
- return true;
2220
- }
2221
- });
2222
- return next;
2223
- }
2224
- strip(strip = true) {
2225
- let next = this.clone();
2226
- next.spec.strip = strip;
2227
- return next;
2228
- }
2229
- /**
2230
- * Return a serialized description of the schema including validations, flags, types etc.
2231
- *
2232
- * @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc).
2233
- */
2234
- describe(options) {
2235
- const next = (options ? this.resolve(options) : this).clone();
2236
- const {
2237
- label,
2238
- meta,
2239
- optional,
2240
- nullable
2241
- } = next.spec;
2242
- const description = {
2243
- meta,
2244
- label,
2245
- optional,
2246
- nullable,
2247
- default: next.getDefault(options),
2248
- type: next.type,
2249
- oneOf: next._whitelist.describe(),
2250
- notOneOf: next._blacklist.describe(),
2251
- tests: next.tests.filter((n, idx, list) => list.findIndex((c) => c.OPTIONS.name === n.OPTIONS.name) === idx).map((fn) => {
2252
- const params = fn.OPTIONS.params && options ? resolveParams(Object.assign({}, fn.OPTIONS.params), options) : fn.OPTIONS.params;
2253
- return {
2254
- name: fn.OPTIONS.name,
2255
- params
2256
- };
2257
- })
2258
- };
2259
- return description;
2260
- }
2261
- get ["~standard"]() {
2262
- const schema = this;
2263
- const standard = {
2264
- version: 1,
2265
- vendor: "yup",
2266
- async validate(value) {
2267
- try {
2268
- const result = await schema.validate(value, {
2269
- abortEarly: false
2270
- });
2271
- return {
2272
- value: result
2273
- };
2274
- } catch (err) {
2275
- if (err instanceof ValidationError2) {
2276
- return {
2277
- issues: issuesFromValidationError(err)
2278
- };
2279
- }
2280
- throw err;
2281
- }
2282
- }
2283
- };
2284
- return standard;
2285
- }
2286
- };
2287
- Schema.prototype.__isYupSchema__ = true;
2288
- for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At`] = function(path9, value, options = {}) {
2289
- const {
2290
- parent,
2291
- parentPath,
2292
- schema
2293
- } = getIn(this, path9, value, options.context);
2294
- return schema[method](parent && parent[parentPath], Object.assign({}, options, {
2295
- parent,
2296
- path: path9
2297
- }));
2298
- };
2299
- for (const alias of ["equals", "is"]) Schema.prototype[alias] = Schema.prototype.oneOf;
2300
- for (const alias of ["not", "nope"]) Schema.prototype[alias] = Schema.prototype.notOneOf;
2301
- var returnsTrue = () => true;
2302
- function create$8(spec) {
2303
- return new MixedSchema(spec);
2304
- }
2305
- var MixedSchema = class extends Schema {
2306
- constructor(spec) {
2307
- super(typeof spec === "function" ? {
2308
- type: "mixed",
2309
- check: spec
2310
- } : Object.assign({
2311
- type: "mixed",
2312
- check: returnsTrue
2313
- }, spec));
2314
- }
2315
- };
2316
- create$8.prototype = MixedSchema.prototype;
2317
- function create$7() {
2318
- return new BooleanSchema();
2319
- }
2320
- var BooleanSchema = class extends Schema {
2321
- constructor() {
2322
- super({
2323
- type: "boolean",
2324
- check(v) {
2325
- if (v instanceof Boolean) v = v.valueOf();
2326
- return typeof v === "boolean";
2327
- }
2328
- });
2329
- this.withMutation(() => {
2330
- this.transform((value, _raw, ctx) => {
2331
- if (ctx.spec.coerce && !ctx.isType(value)) {
2332
- if (/^(true|1)$/i.test(String(value))) return true;
2333
- if (/^(false|0)$/i.test(String(value))) return false;
2334
- }
2335
- return value;
2336
- });
2337
- });
2338
- }
2339
- isTrue(message2 = boolean2.isValue) {
2340
- return this.test({
2341
- message: message2,
2342
- name: "is-value",
2343
- exclusive: true,
2344
- params: {
2345
- value: "true"
2346
- },
2347
- test(value) {
2348
- return isAbsent(value) || value === true;
2349
- }
2350
- });
2351
- }
2352
- isFalse(message2 = boolean2.isValue) {
2353
- return this.test({
2354
- message: message2,
2355
- name: "is-value",
2356
- exclusive: true,
2357
- params: {
2358
- value: "false"
2359
- },
2360
- test(value) {
2361
- return isAbsent(value) || value === false;
2362
- }
2363
- });
2364
- }
2365
- default(def) {
2366
- return super.default(def);
2367
- }
2368
- defined(msg) {
2369
- return super.defined(msg);
2370
- }
2371
- optional() {
2372
- return super.optional();
2373
- }
2374
- required(msg) {
2375
- return super.required(msg);
2376
- }
2377
- notRequired() {
2378
- return super.notRequired();
2379
- }
2380
- nullable() {
2381
- return super.nullable();
2382
- }
2383
- nonNullable(msg) {
2384
- return super.nonNullable(msg);
2385
- }
2386
- strip(v) {
2387
- return super.strip(v);
2388
- }
2389
- };
2390
- create$7.prototype = BooleanSchema.prototype;
2391
- var isoReg = /^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;
2392
- function parseIsoDate(date3) {
2393
- const struct = parseDateStruct(date3);
2394
- if (!struct) return Date.parse ? Date.parse(date3) : Number.NaN;
2395
- if (struct.z === void 0 && struct.plusMinus === void 0) {
2396
- return new Date(struct.year, struct.month, struct.day, struct.hour, struct.minute, struct.second, struct.millisecond).valueOf();
2397
- }
2398
- let totalMinutesOffset = 0;
2399
- if (struct.z !== "Z" && struct.plusMinus !== void 0) {
2400
- totalMinutesOffset = struct.hourOffset * 60 + struct.minuteOffset;
2401
- if (struct.plusMinus === "+") totalMinutesOffset = 0 - totalMinutesOffset;
2402
- }
2403
- return Date.UTC(struct.year, struct.month, struct.day, struct.hour, struct.minute + totalMinutesOffset, struct.second, struct.millisecond);
2404
- }
2405
- function parseDateStruct(date3) {
2406
- var _regexResult$7$length, _regexResult$;
2407
- const regexResult = isoReg.exec(date3);
2408
- if (!regexResult) return null;
2409
- return {
2410
- year: toNumber(regexResult[1]),
2411
- month: toNumber(regexResult[2], 1) - 1,
2412
- day: toNumber(regexResult[3], 1),
2413
- hour: toNumber(regexResult[4]),
2414
- minute: toNumber(regexResult[5]),
2415
- second: toNumber(regexResult[6]),
2416
- millisecond: regexResult[7] ? (
2417
- // allow arbitrary sub-second precision beyond milliseconds
2418
- toNumber(regexResult[7].substring(0, 3))
2419
- ) : 0,
2420
- precision: (_regexResult$7$length = (_regexResult$ = regexResult[7]) == null ? void 0 : _regexResult$.length) != null ? _regexResult$7$length : void 0,
2421
- z: regexResult[8] || void 0,
2422
- plusMinus: regexResult[9] || void 0,
2423
- hourOffset: toNumber(regexResult[10]),
2424
- minuteOffset: toNumber(regexResult[11])
2425
- };
2426
- }
2427
- function toNumber(str, defaultValue = 0) {
2428
- return Number(str) || defaultValue;
2429
- }
2430
- var rEmail = (
2431
- // eslint-disable-next-line
2432
- /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
2433
- );
2434
- var rUrl = (
2435
- // eslint-disable-next-line
2436
- /^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i
2437
- );
2438
- var rUUID = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
2439
- var yearMonthDay = "^\\d{4}-\\d{2}-\\d{2}";
2440
- var hourMinuteSecond = "\\d{2}:\\d{2}:\\d{2}";
2441
- var zOrOffset = "(([+-]\\d{2}(:?\\d{2})?)|Z)";
2442
- var rIsoDateTime = new RegExp(`${yearMonthDay}T${hourMinuteSecond}(\\.\\d+)?${zOrOffset}$`);
2443
- var isTrimmed = (value) => isAbsent(value) || value === value.trim();
2444
- var objStringTag = {}.toString();
2445
- function create$6() {
2446
- return new StringSchema();
2447
- }
2448
- var StringSchema = class extends Schema {
2449
- constructor() {
2450
- super({
2451
- type: "string",
2452
- check(value) {
2453
- if (value instanceof String) value = value.valueOf();
2454
- return typeof value === "string";
2455
- }
2456
- });
2457
- this.withMutation(() => {
2458
- this.transform((value, _raw, ctx) => {
2459
- if (!ctx.spec.coerce || ctx.isType(value)) return value;
2460
- if (Array.isArray(value)) return value;
2461
- const strValue = value != null && value.toString ? value.toString() : value;
2462
- if (strValue === objStringTag) return value;
2463
- return strValue;
2464
- });
2465
- });
2466
- }
2467
- required(message2) {
2468
- return super.required(message2).withMutation((schema) => schema.test({
2469
- message: message2 || mixed.required,
2470
- name: "required",
2471
- skipAbsent: true,
2472
- test: (value) => !!value.length
2473
- }));
2474
- }
2475
- notRequired() {
2476
- return super.notRequired().withMutation((schema) => {
2477
- schema.tests = schema.tests.filter((t) => t.OPTIONS.name !== "required");
2478
- return schema;
2479
- });
2480
- }
2481
- length(length, message2 = string2.length) {
2482
- return this.test({
2483
- message: message2,
2484
- name: "length",
2485
- exclusive: true,
2486
- params: {
2487
- length
2488
- },
2489
- skipAbsent: true,
2490
- test(value) {
2491
- return value.length === this.resolve(length);
2492
- }
2493
- });
2494
- }
2495
- min(min, message2 = string2.min) {
2496
- return this.test({
2497
- message: message2,
2498
- name: "min",
2499
- exclusive: true,
2500
- params: {
2501
- min
2502
- },
2503
- skipAbsent: true,
2504
- test(value) {
2505
- return value.length >= this.resolve(min);
2506
- }
2507
- });
2508
- }
2509
- max(max, message2 = string2.max) {
2510
- return this.test({
2511
- name: "max",
2512
- exclusive: true,
2513
- message: message2,
2514
- params: {
2515
- max
2516
- },
2517
- skipAbsent: true,
2518
- test(value) {
2519
- return value.length <= this.resolve(max);
2520
- }
2521
- });
2522
- }
2523
- matches(regex, options) {
2524
- let excludeEmptyString = false;
2525
- let message2;
2526
- let name;
2527
- if (options) {
2528
- if (typeof options === "object") {
2529
- ({
2530
- excludeEmptyString = false,
2531
- message: message2,
2532
- name
2533
- } = options);
2534
- } else {
2535
- message2 = options;
2536
- }
2537
- }
2538
- return this.test({
2539
- name: name || "matches",
2540
- message: message2 || string2.matches,
2541
- params: {
2542
- regex
2543
- },
2544
- skipAbsent: true,
2545
- test: (value) => value === "" && excludeEmptyString || value.search(regex) !== -1
2546
- });
2547
- }
2548
- email(message2 = string2.email) {
2549
- return this.matches(rEmail, {
2550
- name: "email",
2551
- message: message2,
2552
- excludeEmptyString: true
2553
- });
2554
- }
2555
- url(message2 = string2.url) {
2556
- return this.matches(rUrl, {
2557
- name: "url",
2558
- message: message2,
2559
- excludeEmptyString: true
2560
- });
2561
- }
2562
- uuid(message2 = string2.uuid) {
2563
- return this.matches(rUUID, {
2564
- name: "uuid",
2565
- message: message2,
2566
- excludeEmptyString: false
2567
- });
2568
- }
2569
- datetime(options) {
2570
- let message2 = "";
2571
- let allowOffset;
2572
- let precision;
2573
- if (options) {
2574
- if (typeof options === "object") {
2575
- ({
2576
- message: message2 = "",
2577
- allowOffset = false,
2578
- precision = void 0
2579
- } = options);
2580
- } else {
2581
- message2 = options;
2582
- }
2583
- }
2584
- return this.matches(rIsoDateTime, {
2585
- name: "datetime",
2586
- message: message2 || string2.datetime,
2587
- excludeEmptyString: true
2588
- }).test({
2589
- name: "datetime_offset",
2590
- message: message2 || string2.datetime_offset,
2591
- params: {
2592
- allowOffset
2593
- },
2594
- skipAbsent: true,
2595
- test: (value) => {
2596
- if (!value || allowOffset) return true;
2597
- const struct = parseDateStruct(value);
2598
- if (!struct) return false;
2599
- return !!struct.z;
2600
- }
2601
- }).test({
2602
- name: "datetime_precision",
2603
- message: message2 || string2.datetime_precision,
2604
- params: {
2605
- precision
2606
- },
2607
- skipAbsent: true,
2608
- test: (value) => {
2609
- if (!value || precision == void 0) return true;
2610
- const struct = parseDateStruct(value);
2611
- if (!struct) return false;
2612
- return struct.precision === precision;
2613
- }
2614
- });
2615
- }
2616
- //-- transforms --
2617
- ensure() {
2618
- return this.default("").transform((val) => val === null ? "" : val);
2619
- }
2620
- trim(message2 = string2.trim) {
2621
- return this.transform((val) => val != null ? val.trim() : val).test({
2622
- message: message2,
2623
- name: "trim",
2624
- test: isTrimmed
2625
- });
2626
- }
2627
- lowercase(message2 = string2.lowercase) {
2628
- return this.transform((value) => !isAbsent(value) ? value.toLowerCase() : value).test({
2629
- message: message2,
2630
- name: "string_case",
2631
- exclusive: true,
2632
- skipAbsent: true,
2633
- test: (value) => isAbsent(value) || value === value.toLowerCase()
2634
- });
2635
- }
2636
- uppercase(message2 = string2.uppercase) {
2637
- return this.transform((value) => !isAbsent(value) ? value.toUpperCase() : value).test({
2638
- message: message2,
2639
- name: "string_case",
2640
- exclusive: true,
2641
- skipAbsent: true,
2642
- test: (value) => isAbsent(value) || value === value.toUpperCase()
2643
- });
2644
- }
2645
- };
2646
- create$6.prototype = StringSchema.prototype;
2647
- var isNaN$1 = (value) => value != +value;
2648
- function create$5() {
2649
- return new NumberSchema();
2650
- }
2651
- var NumberSchema = class extends Schema {
2652
- constructor() {
2653
- super({
2654
- type: "number",
2655
- check(value) {
2656
- if (value instanceof Number) value = value.valueOf();
2657
- return typeof value === "number" && !isNaN$1(value);
2658
- }
2659
- });
2660
- this.withMutation(() => {
2661
- this.transform((value, _raw, ctx) => {
2662
- if (!ctx.spec.coerce) return value;
2663
- let parsed = value;
2664
- if (typeof parsed === "string") {
2665
- parsed = parsed.replace(/\s/g, "");
2666
- if (parsed === "") return NaN;
2667
- parsed = +parsed;
2668
- }
2669
- if (ctx.isType(parsed) || parsed === null) return parsed;
2670
- return parseFloat(parsed);
2671
- });
2672
- });
2673
- }
2674
- min(min, message2 = number2.min) {
2675
- return this.test({
2676
- message: message2,
2677
- name: "min",
2678
- exclusive: true,
2679
- params: {
2680
- min
2681
- },
2682
- skipAbsent: true,
2683
- test(value) {
2684
- return value >= this.resolve(min);
2685
- }
2686
- });
2687
- }
2688
- max(max, message2 = number2.max) {
2689
- return this.test({
2690
- message: message2,
2691
- name: "max",
2692
- exclusive: true,
2693
- params: {
2694
- max
2695
- },
2696
- skipAbsent: true,
2697
- test(value) {
2698
- return value <= this.resolve(max);
2699
- }
2700
- });
2701
- }
2702
- lessThan(less, message2 = number2.lessThan) {
2703
- return this.test({
2704
- message: message2,
2705
- name: "max",
2706
- exclusive: true,
2707
- params: {
2708
- less
2709
- },
2710
- skipAbsent: true,
2711
- test(value) {
2712
- return value < this.resolve(less);
2713
- }
2714
- });
2715
- }
2716
- moreThan(more, message2 = number2.moreThan) {
2717
- return this.test({
2718
- message: message2,
2719
- name: "min",
2720
- exclusive: true,
2721
- params: {
2722
- more
2723
- },
2724
- skipAbsent: true,
2725
- test(value) {
2726
- return value > this.resolve(more);
2727
- }
2728
- });
2729
- }
2730
- positive(msg = number2.positive) {
2731
- return this.moreThan(0, msg);
2732
- }
2733
- negative(msg = number2.negative) {
2734
- return this.lessThan(0, msg);
2735
- }
2736
- integer(message2 = number2.integer) {
2737
- return this.test({
2738
- name: "integer",
2739
- message: message2,
2740
- skipAbsent: true,
2741
- test: (val) => Number.isInteger(val)
2742
- });
2743
- }
2744
- truncate() {
2745
- return this.transform((value) => !isAbsent(value) ? value | 0 : value);
2746
- }
2747
- round(method) {
2748
- var _method;
2749
- let avail = ["ceil", "floor", "round", "trunc"];
2750
- method = ((_method = method) == null ? void 0 : _method.toLowerCase()) || "round";
2751
- if (method === "trunc") return this.truncate();
2752
- if (avail.indexOf(method.toLowerCase()) === -1) throw new TypeError("Only valid options for round() are: " + avail.join(", "));
2753
- return this.transform((value) => !isAbsent(value) ? Math[method](value) : value);
2754
- }
2755
- };
2756
- create$5.prototype = NumberSchema.prototype;
2757
- var invalidDate = /* @__PURE__ */ new Date("");
2758
- var isDate = (obj) => Object.prototype.toString.call(obj) === "[object Date]";
2759
- function create$4() {
2760
- return new DateSchema();
2761
- }
2762
- var DateSchema = class _DateSchema extends Schema {
2763
- constructor() {
2764
- super({
2765
- type: "date",
2766
- check(v) {
2767
- return isDate(v) && !isNaN(v.getTime());
2768
- }
2769
- });
2770
- this.withMutation(() => {
2771
- this.transform((value, _raw, ctx) => {
2772
- if (!ctx.spec.coerce || ctx.isType(value) || value === null) return value;
2773
- value = parseIsoDate(value);
2774
- return !isNaN(value) ? new Date(value) : _DateSchema.INVALID_DATE;
2775
- });
2776
- });
2777
- }
2778
- prepareParam(ref, name) {
2779
- let param;
2780
- if (!Reference.isRef(ref)) {
2781
- let cast = this.cast(ref);
2782
- if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
2783
- param = cast;
2784
- } else {
2785
- param = ref;
2786
- }
2787
- return param;
2788
- }
2789
- min(min, message2 = date2.min) {
2790
- let limit4 = this.prepareParam(min, "min");
2791
- return this.test({
2792
- message: message2,
2793
- name: "min",
2794
- exclusive: true,
2795
- params: {
2796
- min
2797
- },
2798
- skipAbsent: true,
2799
- test(value) {
2800
- return value >= this.resolve(limit4);
2801
- }
2802
- });
2803
- }
2804
- max(max, message2 = date2.max) {
2805
- let limit4 = this.prepareParam(max, "max");
2806
- return this.test({
2807
- message: message2,
2808
- name: "max",
2809
- exclusive: true,
2810
- params: {
2811
- max
2812
- },
2813
- skipAbsent: true,
2814
- test(value) {
2815
- return value <= this.resolve(limit4);
2816
- }
2817
- });
2818
- }
2819
- };
2820
- DateSchema.INVALID_DATE = invalidDate;
2821
- create$4.prototype = DateSchema.prototype;
2822
- create$4.INVALID_DATE = invalidDate;
2823
- function sortFields(fields, excludedEdges = []) {
2824
- let edges = [];
2825
- let nodes = /* @__PURE__ */ new Set();
2826
- let excludes = new Set(excludedEdges.map(([a, b]) => `${a}-${b}`));
2827
- function addNode(depPath, key) {
2828
- let node = propertyExpr.split(depPath)[0];
2829
- nodes.add(node);
2830
- if (!excludes.has(`${key}-${node}`)) edges.push([key, node]);
2831
- }
2832
- for (const key of Object.keys(fields)) {
2833
- let value = fields[key];
2834
- nodes.add(key);
2835
- if (Reference.isRef(value) && value.isSibling) addNode(value.path, key);
2836
- else if (isSchema(value) && "deps" in value) value.deps.forEach((path9) => addNode(path9, key));
2837
- }
2838
- return toposort__default["default"].array(Array.from(nodes), edges).reverse();
2839
- }
2840
- function findIndex(arr, err) {
2841
- let idx = Infinity;
2842
- arr.some((key, ii) => {
2843
- var _err$path;
2844
- if ((_err$path = err.path) != null && _err$path.includes(key)) {
2845
- idx = ii;
2846
- return true;
2847
- }
2848
- });
2849
- return idx;
2850
- }
2851
- function sortByKeyOrder(keys) {
2852
- return (a, b) => {
2853
- return findIndex(keys, a) - findIndex(keys, b);
2854
- };
2855
- }
2856
- var parseJson = (value, _, ctx) => {
2857
- if (typeof value !== "string") {
2858
- return value;
2859
- }
2860
- let parsed = value;
2861
- try {
2862
- parsed = JSON.parse(value);
2863
- } catch (err) {
2864
- }
2865
- return ctx.isType(parsed) ? parsed : value;
2866
- };
2867
- function deepPartial(schema) {
2868
- if ("fields" in schema) {
2869
- const partial = {};
2870
- for (const [key, fieldSchema] of Object.entries(schema.fields)) {
2871
- partial[key] = deepPartial(fieldSchema);
2872
- }
2873
- return schema.setFields(partial);
2874
- }
2875
- if (schema.type === "array") {
2876
- const nextArray = schema.optional();
2877
- if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
2878
- return nextArray;
2879
- }
2880
- if (schema.type === "tuple") {
2881
- return schema.optional().clone({
2882
- types: schema.spec.types.map(deepPartial)
2883
- });
2884
- }
2885
- if ("optional" in schema) {
2886
- return schema.optional();
2887
- }
2888
- return schema;
2889
- }
2890
- var deepHas = (obj, p) => {
2891
- const path9 = [...propertyExpr.normalizePath(p)];
2892
- if (path9.length === 1) return path9[0] in obj;
2893
- let last = path9.pop();
2894
- let parent = propertyExpr.getter(propertyExpr.join(path9), true)(obj);
2895
- return !!(parent && last in parent);
2896
- };
2897
- var isObject = (obj) => Object.prototype.toString.call(obj) === "[object Object]";
2898
- function unknown(ctx, value) {
2899
- let known = Object.keys(ctx.fields);
2900
- return Object.keys(value).filter((key) => known.indexOf(key) === -1);
2901
- }
2902
- var defaultSort = sortByKeyOrder([]);
2903
- function create$3(spec) {
2904
- return new ObjectSchema(spec);
2905
- }
2906
- var ObjectSchema = class extends Schema {
2907
- constructor(spec) {
2908
- super({
2909
- type: "object",
2910
- check(value) {
2911
- return isObject(value) || typeof value === "function";
2912
- }
2913
- });
2914
- this.fields = /* @__PURE__ */ Object.create(null);
2915
- this._sortErrors = defaultSort;
2916
- this._nodes = [];
2917
- this._excludedEdges = [];
2918
- this.withMutation(() => {
2919
- if (spec) {
2920
- this.shape(spec);
2921
- }
2922
- });
2923
- }
2924
- _cast(_value, options = {}) {
2925
- var _options$stripUnknown;
2926
- let value = super._cast(_value, options);
2927
- if (value === void 0) return this.getDefault(options);
2928
- if (!this._typeCheck(value)) return value;
2929
- let fields = this.fields;
2930
- let strip = (_options$stripUnknown = options.stripUnknown) != null ? _options$stripUnknown : this.spec.noUnknown;
2931
- let props = [].concat(this._nodes, Object.keys(value).filter((v) => !this._nodes.includes(v)));
2932
- let intermediateValue = {};
2933
- let innerOptions = Object.assign({}, options, {
2934
- parent: intermediateValue,
2935
- __validating: options.__validating || false
2936
- });
2937
- let isChanged = false;
2938
- for (const prop of props) {
2939
- let field = fields[prop];
2940
- let exists2 = prop in value;
2941
- if (field) {
2942
- let fieldValue;
2943
- let inputValue = value[prop];
2944
- innerOptions.path = (options.path ? `${options.path}.` : "") + prop;
2945
- field = field.resolve({
2946
- value: inputValue,
2947
- context: options.context,
2948
- parent: intermediateValue
2949
- });
2950
- let fieldSpec = field instanceof Schema ? field.spec : void 0;
2951
- let strict = fieldSpec == null ? void 0 : fieldSpec.strict;
2952
- if (fieldSpec != null && fieldSpec.strip) {
2953
- isChanged = isChanged || prop in value;
2954
- continue;
2955
- }
2956
- fieldValue = !options.__validating || !strict ? (
2957
- // TODO: use _cast, this is double resolving
2958
- field.cast(value[prop], innerOptions)
2959
- ) : value[prop];
2960
- if (fieldValue !== void 0) {
2961
- intermediateValue[prop] = fieldValue;
2962
- }
2963
- } else if (exists2 && !strip) {
2964
- intermediateValue[prop] = value[prop];
2965
- }
2966
- if (exists2 !== prop in intermediateValue || intermediateValue[prop] !== value[prop]) {
2967
- isChanged = true;
2968
- }
2969
- }
2970
- return isChanged ? intermediateValue : value;
2971
- }
2972
- _validate(_value, options = {}, panic, next) {
2973
- let {
2974
- from = [],
2975
- originalValue = _value,
2976
- recursive = this.spec.recursive
2977
- } = options;
2978
- options.from = [{
2979
- schema: this,
2980
- value: originalValue
2981
- }, ...from];
2982
- options.__validating = true;
2983
- options.originalValue = originalValue;
2984
- super._validate(_value, options, panic, (objectErrors, value) => {
2985
- if (!recursive || !isObject(value)) {
2986
- next(objectErrors, value);
2987
- return;
2988
- }
2989
- originalValue = originalValue || value;
2990
- let tests = [];
2991
- for (let key of this._nodes) {
2992
- let field = this.fields[key];
2993
- if (!field || Reference.isRef(field)) {
2994
- continue;
2995
- }
2996
- tests.push(field.asNestedTest({
2997
- options,
2998
- key,
2999
- parent: value,
3000
- parentPath: options.path,
3001
- originalParent: originalValue
3002
- }));
3003
- }
3004
- this.runTests({
3005
- tests,
3006
- value,
3007
- originalValue,
3008
- options
3009
- }, panic, (fieldErrors) => {
3010
- next(fieldErrors.sort(this._sortErrors).concat(objectErrors), value);
3011
- });
3012
- });
3013
- }
3014
- clone(spec) {
3015
- const next = super.clone(spec);
3016
- next.fields = Object.assign({}, this.fields);
3017
- next._nodes = this._nodes;
3018
- next._excludedEdges = this._excludedEdges;
3019
- next._sortErrors = this._sortErrors;
3020
- return next;
3021
- }
3022
- concat(schema) {
3023
- let next = super.concat(schema);
3024
- let nextFields = next.fields;
3025
- for (let [field, schemaOrRef] of Object.entries(this.fields)) {
3026
- const target = nextFields[field];
3027
- nextFields[field] = target === void 0 ? schemaOrRef : target;
3028
- }
3029
- return next.withMutation((s) => (
3030
- // XXX: excludes here is wrong
3031
- s.setFields(nextFields, [...this._excludedEdges, ...schema._excludedEdges])
3032
- ));
3033
- }
3034
- _getDefault(options) {
3035
- if ("default" in this.spec) {
3036
- return super._getDefault(options);
3037
- }
3038
- if (!this._nodes.length) {
3039
- return void 0;
3040
- }
3041
- let dft = {};
3042
- this._nodes.forEach((key) => {
3043
- var _innerOptions;
3044
- const field = this.fields[key];
3045
- let innerOptions = options;
3046
- if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
3047
- innerOptions = Object.assign({}, innerOptions, {
3048
- parent: innerOptions.value,
3049
- value: innerOptions.value[key]
3050
- });
3051
- }
3052
- dft[key] = field && "getDefault" in field ? field.getDefault(innerOptions) : void 0;
3053
- });
3054
- return dft;
3055
- }
3056
- setFields(shape, excludedEdges) {
3057
- let next = this.clone();
3058
- next.fields = shape;
3059
- next._nodes = sortFields(shape, excludedEdges);
3060
- next._sortErrors = sortByKeyOrder(Object.keys(shape));
3061
- if (excludedEdges) next._excludedEdges = excludedEdges;
3062
- return next;
3063
- }
3064
- shape(additions, excludes = []) {
3065
- return this.clone().withMutation((next) => {
3066
- let edges = next._excludedEdges;
3067
- if (excludes.length) {
3068
- if (!Array.isArray(excludes[0])) excludes = [excludes];
3069
- edges = [...next._excludedEdges, ...excludes];
3070
- }
3071
- return next.setFields(Object.assign(next.fields, additions), edges);
3072
- });
3073
- }
3074
- partial() {
3075
- const partial = {};
3076
- for (const [key, schema] of Object.entries(this.fields)) {
3077
- partial[key] = "optional" in schema && schema.optional instanceof Function ? schema.optional() : schema;
3078
- }
3079
- return this.setFields(partial);
3080
- }
3081
- deepPartial() {
3082
- const next = deepPartial(this);
3083
- return next;
3084
- }
3085
- pick(keys) {
3086
- const picked = {};
3087
- for (const key of keys) {
3088
- if (this.fields[key]) picked[key] = this.fields[key];
3089
- }
3090
- return this.setFields(picked, this._excludedEdges.filter(([a, b]) => keys.includes(a) && keys.includes(b)));
3091
- }
3092
- omit(keys) {
3093
- const remaining = [];
3094
- for (const key of Object.keys(this.fields)) {
3095
- if (keys.includes(key)) continue;
3096
- remaining.push(key);
3097
- }
3098
- return this.pick(remaining);
3099
- }
3100
- from(from, to, alias) {
3101
- let fromGetter = propertyExpr.getter(from, true);
3102
- return this.transform((obj) => {
3103
- if (!obj) return obj;
3104
- let newObj = obj;
3105
- if (deepHas(obj, from)) {
3106
- newObj = Object.assign({}, obj);
3107
- if (!alias) delete newObj[from];
3108
- newObj[to] = fromGetter(obj);
3109
- }
3110
- return newObj;
3111
- });
3112
- }
3113
- /** Parse an input JSON string to an object */
3114
- json() {
3115
- return this.transform(parseJson);
3116
- }
3117
- /**
3118
- * Similar to `noUnknown` but only validates that an object is the right shape without stripping the unknown keys
3119
- */
3120
- exact(message2) {
3121
- return this.test({
3122
- name: "exact",
3123
- exclusive: true,
3124
- message: message2 || object2.exact,
3125
- test(value) {
3126
- if (value == null) return true;
3127
- const unknownKeys = unknown(this.schema, value);
3128
- return unknownKeys.length === 0 || this.createError({
3129
- params: {
3130
- properties: unknownKeys.join(", ")
3131
- }
3132
- });
3133
- }
3134
- });
3135
- }
3136
- stripUnknown() {
3137
- return this.clone({
3138
- noUnknown: true
3139
- });
3140
- }
3141
- noUnknown(noAllow = true, message2 = object2.noUnknown) {
3142
- if (typeof noAllow !== "boolean") {
3143
- message2 = noAllow;
3144
- noAllow = true;
3145
- }
3146
- let next = this.test({
3147
- name: "noUnknown",
3148
- exclusive: true,
3149
- message: message2,
3150
- test(value) {
3151
- if (value == null) return true;
3152
- const unknownKeys = unknown(this.schema, value);
3153
- return !noAllow || unknownKeys.length === 0 || this.createError({
3154
- params: {
3155
- unknown: unknownKeys.join(", ")
3156
- }
3157
- });
3158
- }
3159
- });
3160
- next.spec.noUnknown = noAllow;
3161
- return next;
3162
- }
3163
- unknown(allow = true, message2 = object2.noUnknown) {
3164
- return this.noUnknown(!allow, message2);
3165
- }
3166
- transformKeys(fn) {
3167
- return this.transform((obj) => {
3168
- if (!obj) return obj;
3169
- const result = {};
3170
- for (const key of Object.keys(obj)) result[fn(key)] = obj[key];
3171
- return result;
3172
- });
3173
- }
3174
- camelCase() {
3175
- return this.transformKeys(tinyCase.camelCase);
3176
- }
3177
- snakeCase() {
3178
- return this.transformKeys(tinyCase.snakeCase);
3179
- }
3180
- constantCase() {
3181
- return this.transformKeys((key) => tinyCase.snakeCase(key).toUpperCase());
3182
- }
3183
- describe(options) {
3184
- const next = (options ? this.resolve(options) : this).clone();
3185
- const base = super.describe(options);
3186
- base.fields = {};
3187
- for (const [key, value] of Object.entries(next.fields)) {
3188
- var _innerOptions2;
3189
- let innerOptions = options;
3190
- if ((_innerOptions2 = innerOptions) != null && _innerOptions2.value) {
3191
- innerOptions = Object.assign({}, innerOptions, {
3192
- parent: innerOptions.value,
3193
- value: innerOptions.value[key]
3194
- });
3195
- }
3196
- base.fields[key] = value.describe(innerOptions);
3197
- }
3198
- return base;
3199
- }
3200
- };
3201
- create$3.prototype = ObjectSchema.prototype;
3202
- function create$2(type) {
3203
- return new ArraySchema(type);
3204
- }
3205
- var ArraySchema = class extends Schema {
3206
- constructor(type) {
3207
- super({
3208
- type: "array",
3209
- spec: {
3210
- types: type
3211
- },
3212
- check(v) {
3213
- return Array.isArray(v);
3214
- }
3215
- });
3216
- this.innerType = void 0;
3217
- this.innerType = type;
3218
- }
3219
- _cast(_value, _opts) {
3220
- const value = super._cast(_value, _opts);
3221
- if (!this._typeCheck(value) || !this.innerType) {
3222
- return value;
3223
- }
3224
- let isChanged = false;
3225
- const castArray = value.map((v, idx) => {
3226
- const castElement = this.innerType.cast(v, Object.assign({}, _opts, {
3227
- path: `${_opts.path || ""}[${idx}]`
3228
- }));
3229
- if (castElement !== v) {
3230
- isChanged = true;
3231
- }
3232
- return castElement;
3233
- });
3234
- return isChanged ? castArray : value;
3235
- }
3236
- _validate(_value, options = {}, panic, next) {
3237
- var _options$recursive;
3238
- let innerType = this.innerType;
3239
- let recursive = (_options$recursive = options.recursive) != null ? _options$recursive : this.spec.recursive;
3240
- options.originalValue != null ? options.originalValue : _value;
3241
- super._validate(_value, options, panic, (arrayErrors, value) => {
3242
- var _options$originalValu2;
3243
- if (!recursive || !innerType || !this._typeCheck(value)) {
3244
- next(arrayErrors, value);
3245
- return;
3246
- }
3247
- let tests = new Array(value.length);
3248
- for (let index = 0; index < value.length; index++) {
3249
- var _options$originalValu;
3250
- tests[index] = innerType.asNestedTest({
3251
- options,
3252
- index,
3253
- parent: value,
3254
- parentPath: options.path,
3255
- originalParent: (_options$originalValu = options.originalValue) != null ? _options$originalValu : _value
3256
- });
3257
- }
3258
- this.runTests({
3259
- value,
3260
- tests,
3261
- originalValue: (_options$originalValu2 = options.originalValue) != null ? _options$originalValu2 : _value,
3262
- options
3263
- }, panic, (innerTypeErrors) => next(innerTypeErrors.concat(arrayErrors), value));
3264
- });
3265
- }
3266
- clone(spec) {
3267
- const next = super.clone(spec);
3268
- next.innerType = this.innerType;
3269
- return next;
3270
- }
3271
- /** Parse an input JSON string to an object */
3272
- json() {
3273
- return this.transform(parseJson);
3274
- }
3275
- concat(schema) {
3276
- let next = super.concat(schema);
3277
- next.innerType = this.innerType;
3278
- if (schema.innerType)
3279
- next.innerType = next.innerType ? (
3280
- // @ts-expect-error Lazy doesn't have concat and will break
3281
- next.innerType.concat(schema.innerType)
3282
- ) : schema.innerType;
3283
- return next;
3284
- }
3285
- of(schema) {
3286
- let next = this.clone();
3287
- if (!isSchema(schema)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema));
3288
- next.innerType = schema;
3289
- next.spec = Object.assign({}, next.spec, {
3290
- types: schema
3291
- });
3292
- return next;
3293
- }
3294
- length(length, message2 = array.length) {
3295
- return this.test({
3296
- message: message2,
3297
- name: "length",
3298
- exclusive: true,
3299
- params: {
3300
- length
3301
- },
3302
- skipAbsent: true,
3303
- test(value) {
3304
- return value.length === this.resolve(length);
3305
- }
3306
- });
3307
- }
3308
- min(min, message2) {
3309
- message2 = message2 || array.min;
3310
- return this.test({
3311
- message: message2,
3312
- name: "min",
3313
- exclusive: true,
3314
- params: {
3315
- min
3316
- },
3317
- skipAbsent: true,
3318
- // FIXME(ts): Array<typeof T>
3319
- test(value) {
3320
- return value.length >= this.resolve(min);
3321
- }
3322
- });
3323
- }
3324
- max(max, message2) {
3325
- message2 = message2 || array.max;
3326
- return this.test({
3327
- message: message2,
3328
- name: "max",
3329
- exclusive: true,
3330
- params: {
3331
- max
3332
- },
3333
- skipAbsent: true,
3334
- test(value) {
3335
- return value.length <= this.resolve(max);
3336
- }
3337
- });
3338
- }
3339
- ensure() {
3340
- return this.default(() => []).transform((val, original) => {
3341
- if (this._typeCheck(val)) return val;
3342
- return original == null ? [] : [].concat(original);
3343
- });
3344
- }
3345
- compact(rejector) {
3346
- let reject = !rejector ? (v) => !!v : (v, i, a) => !rejector(v, i, a);
3347
- return this.transform((values) => values != null ? values.filter(reject) : values);
3348
- }
3349
- describe(options) {
3350
- const next = (options ? this.resolve(options) : this).clone();
3351
- const base = super.describe(options);
3352
- if (next.innerType) {
3353
- var _innerOptions;
3354
- let innerOptions = options;
3355
- if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
3356
- innerOptions = Object.assign({}, innerOptions, {
3357
- parent: innerOptions.value,
3358
- value: innerOptions.value[0]
3359
- });
3360
- }
3361
- base.innerType = next.innerType.describe(innerOptions);
3362
- }
3363
- return base;
3364
- }
3365
- };
3366
- create$2.prototype = ArraySchema.prototype;
3367
- function create$1(schemas) {
3368
- return new TupleSchema(schemas);
3369
- }
3370
- var TupleSchema = class extends Schema {
3371
- constructor(schemas) {
3372
- super({
3373
- type: "tuple",
3374
- spec: {
3375
- types: schemas
3376
- },
3377
- check(v) {
3378
- const types = this.spec.types;
3379
- return Array.isArray(v) && v.length === types.length;
3380
- }
3381
- });
3382
- this.withMutation(() => {
3383
- this.typeError(tuple.notType);
3384
- });
3385
- }
3386
- _cast(inputValue, options) {
3387
- const {
3388
- types
3389
- } = this.spec;
3390
- const value = super._cast(inputValue, options);
3391
- if (!this._typeCheck(value)) {
3392
- return value;
3393
- }
3394
- let isChanged = false;
3395
- const castArray = types.map((type, idx) => {
3396
- const castElement = type.cast(value[idx], Object.assign({}, options, {
3397
- path: `${options.path || ""}[${idx}]`
3398
- }));
3399
- if (castElement !== value[idx]) isChanged = true;
3400
- return castElement;
3401
- });
3402
- return isChanged ? castArray : value;
3403
- }
3404
- _validate(_value, options = {}, panic, next) {
3405
- let itemTypes = this.spec.types;
3406
- super._validate(_value, options, panic, (tupleErrors, value) => {
3407
- var _options$originalValu2;
3408
- if (!this._typeCheck(value)) {
3409
- next(tupleErrors, value);
3410
- return;
3411
- }
3412
- let tests = [];
3413
- for (let [index, itemSchema] of itemTypes.entries()) {
3414
- var _options$originalValu;
3415
- tests[index] = itemSchema.asNestedTest({
3416
- options,
3417
- index,
3418
- parent: value,
3419
- parentPath: options.path,
3420
- originalParent: (_options$originalValu = options.originalValue) != null ? _options$originalValu : _value
3421
- });
3422
- }
3423
- this.runTests({
3424
- value,
3425
- tests,
3426
- originalValue: (_options$originalValu2 = options.originalValue) != null ? _options$originalValu2 : _value,
3427
- options
3428
- }, panic, (innerTypeErrors) => next(innerTypeErrors.concat(tupleErrors), value));
3429
- });
3430
- }
3431
- describe(options) {
3432
- const next = (options ? this.resolve(options) : this).clone();
3433
- const base = super.describe(options);
3434
- base.innerType = next.spec.types.map((schema, index) => {
3435
- var _innerOptions;
3436
- let innerOptions = options;
3437
- if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
3438
- innerOptions = Object.assign({}, innerOptions, {
3439
- parent: innerOptions.value,
3440
- value: innerOptions.value[index]
3441
- });
3442
- }
3443
- return schema.describe(innerOptions);
3444
- });
3445
- return base;
3446
- }
3447
- };
3448
- create$1.prototype = TupleSchema.prototype;
3449
- function create(builder) {
3450
- return new Lazy(builder);
3451
- }
3452
- function catchValidationError(fn) {
3453
- try {
3454
- return fn();
3455
- } catch (err) {
3456
- if (ValidationError2.isError(err)) return Promise.reject(err);
3457
- throw err;
3458
- }
3459
- }
3460
- var Lazy = class _Lazy {
3461
- constructor(builder) {
3462
- this.type = "lazy";
3463
- this.__isYupSchema__ = true;
3464
- this.spec = void 0;
3465
- this._resolve = (value, options = {}) => {
3466
- let schema = this.builder(value, options);
3467
- if (!isSchema(schema)) throw new TypeError("lazy() functions must return a valid schema");
3468
- if (this.spec.optional) schema = schema.optional();
3469
- return schema.resolve(options);
3470
- };
3471
- this.builder = builder;
3472
- this.spec = {
3473
- meta: void 0,
3474
- optional: false
3475
- };
3476
- }
3477
- clone(spec) {
3478
- const next = new _Lazy(this.builder);
3479
- next.spec = Object.assign({}, this.spec, spec);
3480
- return next;
3481
- }
3482
- optionality(optional) {
3483
- const next = this.clone({
3484
- optional
3485
- });
3486
- return next;
3487
- }
3488
- optional() {
3489
- return this.optionality(true);
3490
- }
3491
- resolve(options) {
3492
- return this._resolve(options.value, options);
3493
- }
3494
- cast(value, options) {
3495
- return this._resolve(value, options).cast(value, options);
3496
- }
3497
- asNestedTest(config) {
3498
- let {
3499
- key,
3500
- index,
3501
- parent,
3502
- options
3503
- } = config;
3504
- let value = parent[index != null ? index : key];
3505
- return this._resolve(value, Object.assign({}, options, {
3506
- value,
3507
- parent
3508
- })).asNestedTest(config);
3509
- }
3510
- validate(value, options) {
3511
- return catchValidationError(() => this._resolve(value, options).validate(value, options));
3512
- }
3513
- validateSync(value, options) {
3514
- return this._resolve(value, options).validateSync(value, options);
3515
- }
3516
- validateAt(path9, value, options) {
3517
- return catchValidationError(() => this._resolve(value, options).validateAt(path9, value, options));
3518
- }
3519
- validateSyncAt(path9, value, options) {
3520
- return this._resolve(value, options).validateSyncAt(path9, value, options);
3521
- }
3522
- isValid(value, options) {
3523
- try {
3524
- return this._resolve(value, options).isValid(value, options);
3525
- } catch (err) {
3526
- if (ValidationError2.isError(err)) {
3527
- return Promise.resolve(false);
3528
- }
3529
- throw err;
3530
- }
3531
- }
3532
- isValidSync(value, options) {
3533
- return this._resolve(value, options).isValidSync(value, options);
3534
- }
3535
- describe(options) {
3536
- return options ? this.resolve(options).describe(options) : {
3537
- type: "lazy",
3538
- meta: this.spec.meta,
3539
- label: void 0
3540
- };
3541
- }
3542
- meta(...args2) {
3543
- if (args2.length === 0) return this.spec.meta;
3544
- let next = this.clone();
3545
- next.spec.meta = Object.assign(next.spec.meta || {}, args2[0]);
3546
- return next;
3547
- }
3548
- get ["~standard"]() {
3549
- const schema = this;
3550
- const standard = {
3551
- version: 1,
3552
- vendor: "yup",
3553
- async validate(value) {
3554
- try {
3555
- const result = await schema.validate(value, {
3556
- abortEarly: false
3557
- });
3558
- return {
3559
- value: result
3560
- };
3561
- } catch (err) {
3562
- if (ValidationError2.isError(err)) {
3563
- return {
3564
- issues: issuesFromValidationError(err)
3565
- };
3566
- }
3567
- throw err;
3568
- }
3569
- }
3570
- };
3571
- return standard;
3572
- }
3573
- };
3574
- function setLocale(custom) {
3575
- Object.keys(custom).forEach((type) => {
3576
- Object.keys(custom[type]).forEach((method) => {
3577
- locale[type][method] = custom[type][method];
3578
- });
3579
- });
3580
- }
3581
- function addMethod(schemaType, name, fn) {
3582
- if (!schemaType || !isSchema(schemaType.prototype)) throw new TypeError("You must provide a yup schema constructor function");
3583
- if (typeof name !== "string") throw new TypeError("A Method name must be provided");
3584
- if (typeof fn !== "function") throw new TypeError("Method function must be provided");
3585
- schemaType.prototype[name] = fn;
3586
- }
3587
- exports2.ArraySchema = ArraySchema;
3588
- exports2.BooleanSchema = BooleanSchema;
3589
- exports2.DateSchema = DateSchema;
3590
- exports2.LazySchema = Lazy;
3591
- exports2.MixedSchema = MixedSchema;
3592
- exports2.NumberSchema = NumberSchema;
3593
- exports2.ObjectSchema = ObjectSchema;
3594
- exports2.Schema = Schema;
3595
- exports2.StringSchema = StringSchema;
3596
- exports2.TupleSchema = TupleSchema;
3597
- exports2.ValidationError = ValidationError2;
3598
- exports2.addMethod = addMethod;
3599
- exports2.array = create$2;
3600
- exports2.bool = create$7;
3601
- exports2.boolean = create$7;
3602
- exports2.date = create$4;
3603
- exports2.defaultLocale = locale;
3604
- exports2.getIn = getIn;
3605
- exports2.isSchema = isSchema;
3606
- exports2.lazy = create;
3607
- exports2.mixed = create$8;
3608
- exports2.number = create$5;
3609
- exports2.object = create$3;
3610
- exports2.printValue = printValue;
3611
- exports2.reach = reach;
3612
- exports2.ref = create$9;
3613
- exports2.setLocale = setLocale;
3614
- exports2.string = create$6;
3615
- exports2.tuple = create$1;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
3616
13
  }
3617
- });
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
3618
24
 
3619
25
  // src/index.ts
3620
26
  var import_commander = require("commander");
@@ -3994,82 +400,7 @@ function BreakpointNotice({ plan }) {
3994
400
  var import_ink4 = require("ink");
3995
401
  var import_react2 = require("react");
3996
402
 
3997
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/package.json
3998
- var package_default = {
3999
- name: "@todesktop/shared",
4000
- version: "7.193.0",
4001
- description: "",
4002
- main: "./lib/cjs/index.js",
4003
- module: "./lib/esm/index.js",
4004
- types: "./lib/esm/index.d.ts",
4005
- exports: {
4006
- ".": {
4007
- import: {
4008
- types: "./lib/esm/index.d.ts",
4009
- default: "./lib/esm/index.js"
4010
- },
4011
- require: {
4012
- types: "./lib/cjs/index.d.ts",
4013
- default: "./lib/cjs/index.js"
4014
- }
4015
- }
4016
- },
4017
- scripts: {
4018
- build: "rm -rf ./lib && pnpm run build:cjs && pnpm run build:esm && pnpm run build:rename-cjs-index",
4019
- "build:cjs": "tsc -p tsconfig.json",
4020
- "build:esm": "tsc -p tsconfig.esm.json",
4021
- "build:rename-cjs-index": "mv ./lib/cjs/index.cjs.js ./lib/cjs/index.js && mv ./lib/cjs/index.cjs.d.ts ./lib/cjs/index.d.ts",
4022
- bump: "npm version minor && git push && npm publish",
4023
- dev: "tsc",
4024
- format: "prettier . --write && eslint --fix",
4025
- lint: "prettier . --check && eslint",
4026
- prepublishOnly: "npm run build",
4027
- test: "vitest run",
4028
- typecheck: "tsc --noEmit"
4029
- },
4030
- author: "Dave Jeffery <dave@davejeffery.com>",
4031
- license: "UNLICENSED",
4032
- dependencies: {
4033
- "@todesktop/client-electron-types": "^28.0.0",
4034
- "@types/debug": "^4.1.1",
4035
- "@types/node": "^16.4.12",
4036
- "is-regex": "^1.0.4",
4037
- semver: "^7.3.5",
4038
- yup: "^1.4.0"
4039
- },
4040
- devDependencies: {
4041
- "@todesktop/dev-config": "workspace:*",
4042
- "@types/semver": "^7.3.9",
4043
- "app-builder-lib": "^25.1.8",
4044
- eslint: "catalog:",
4045
- prettier: "catalog:",
4046
- typescript: "catalog:",
4047
- vitest: "^1.6.1"
4048
- }
4049
- };
4050
-
4051
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/base.js
4052
- var WindowsEVOnboardingSteps;
4053
- (function(WindowsEVOnboardingSteps2) {
4054
- WindowsEVOnboardingSteps2["hasBeenVerified"] = "hasBeenVerified";
4055
- WindowsEVOnboardingSteps2["hasChosenProvider"] = "hasChosenProvider";
4056
- WindowsEVOnboardingSteps2["hasGeneratedCert"] = "hasGeneratedCert";
4057
- WindowsEVOnboardingSteps2["hasOrderedCert"] = "hasOrderedCert";
4058
- WindowsEVOnboardingSteps2["hasUploadedCert"] = "hasUploadedCert";
4059
- })(WindowsEVOnboardingSteps || (WindowsEVOnboardingSteps = {}));
4060
- var WindowsEVOnboardingProvider;
4061
- (function(WindowsEVOnboardingProvider2) {
4062
- WindowsEVOnboardingProvider2["globalsign"] = "globalsign";
4063
- WindowsEVOnboardingProvider2["other"] = "other";
4064
- })(WindowsEVOnboardingProvider || (WindowsEVOnboardingProvider = {}));
4065
- var WindowsHSMCertType;
4066
- (function(WindowsHSMCertType2) {
4067
- WindowsHSMCertType2["azureTrustedSigning"] = "azureTrustedSigning";
4068
- WindowsHSMCertType2["ev"] = "ev";
4069
- WindowsHSMCertType2["file"] = "file";
4070
- })(WindowsHSMCertType || (WindowsHSMCertType = {}));
4071
-
4072
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/desktopify.js
403
+ // ../shared/lib/esm/desktopify.js
4073
404
  var PlatformName;
4074
405
  (function(PlatformName3) {
4075
406
  PlatformName3["linux"] = "linux";
@@ -4108,13 +439,13 @@ var ManifestCategory;
4108
439
  ManifestCategory2["versioned"] = "versioned";
4109
440
  })(ManifestCategory || (ManifestCategory = {}));
4110
441
 
4111
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/introspection/breakpoints.js
442
+ // ../shared/lib/esm/introspection/breakpoints.js
4112
443
  var MINUTE = 60 * 1e3;
4113
444
  var BREAKPOINT_DEFAULT_LEASE_MS = 20 * MINUTE;
4114
445
  var BREAKPOINT_RENEW_INCREMENT_MS = 10 * MINUTE;
4115
446
  var BREAKPOINT_MAX_REMAINING_MS = 20 * MINUTE;
4116
447
 
4117
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/introspection/status.js
448
+ // ../shared/lib/esm/introspection/status.js
4118
449
  function formatIntrospectionStatus(breakpointStatus, shellStatus) {
4119
450
  if (breakpointStatus === "paused") {
4120
451
  if (shellStatus === "connected") {
@@ -4149,675 +480,6 @@ function formatIntrospectionStatus(breakpointStatus, shellStatus) {
4149
480
  return "status unknown";
4150
481
  }
4151
482
 
4152
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/plans.js
4153
- var PortalConfigKey;
4154
- (function(PortalConfigKey2) {
4155
- PortalConfigKey2["BuilderUpdateDev"] = "builder_update_dev";
4156
- PortalConfigKey2["BuilderUpdateProd"] = "builder_update_prod";
4157
- PortalConfigKey2["BuilderUpgradeDev"] = "builder_upgrade_dev";
4158
- PortalConfigKey2["BuilderUpgradeProd"] = "builder_upgrade_prod";
4159
- PortalConfigKey2["CLIUpdateDev"] = "cli_update_dev";
4160
- PortalConfigKey2["CLIUpdateProd"] = "cli_update_prod";
4161
- PortalConfigKey2["CLIUpgradeDev"] = "cli_upgrade_dev";
4162
- PortalConfigKey2["CLIUpgradeProd"] = "cli_upgrade_prod";
4163
- })(PortalConfigKey || (PortalConfigKey = {}));
4164
- var createPrice = (id, price) => {
4165
- return Object.assign({ id }, price);
4166
- };
4167
- var createProduct = (id, prices) => ({ id, prices });
4168
- var createPlan = (tier, products2) => {
4169
- const record = {
4170
- basic: { label: "Basic", tiers: ["basic", "legacy_pro", "pro", "scale"] },
4171
- legacy_pro: { label: "Pro", tiers: ["legacy_pro", "pro", "scale"] },
4172
- pro: { label: "Pro", tiers: ["pro", "scale"] },
4173
- scale: { label: "Scale", tiers: ["scale"] }
4174
- };
4175
- const { label, tiers } = record[tier];
4176
- return {
4177
- eligiblePlanTiers: tiers,
4178
- label,
4179
- products: { dev: products2.dev, prod: products2.prod },
4180
- tier
4181
- };
4182
- };
4183
- var PORTAL_VERSION = 1;
4184
- var createPortalConfig = (key, products2) => {
4185
- return {
4186
- business_profile: {
4187
- headline: "ToDesktop Billing Portal",
4188
- privacy_policy_url: "https://www.todesktop.com/privacy-policy",
4189
- terms_of_service_url: "https://www.todesktop.com/terms"
4190
- },
4191
- default_return_url: "https://app.todesktop.com",
4192
- features: {
4193
- payment_method_update: { enabled: true },
4194
- subscription_update: {
4195
- default_allowed_updates: ["price"],
4196
- enabled: true,
4197
- products: products2.map((product) => {
4198
- return {
4199
- prices: Object.values(product.prices).filter((price) => price.status === "active").map((price) => price.id),
4200
- product: product.id
4201
- };
4202
- })
4203
- }
4204
- },
4205
- metadata: { key, version: PORTAL_VERSION }
4206
- };
4207
- };
4208
- var products = {
4209
- dev: {
4210
- builder: {
4211
- essential: createProduct("prod_MoR1S4o0nLv00y", {
4212
- monthly_125: createPrice("price_1PuuAqIewCKA2h0Iw4judQNj", {
4213
- amount: 125,
4214
- period: "monthly",
4215
- status: "active"
4216
- }),
4217
- monthly_99: createPrice("price_1M4o9XIewCKA2h0IVfGrid8E", {
4218
- amount: 99,
4219
- period: "monthly",
4220
- status: "inactive"
4221
- }),
4222
- yearly_1200: createPrice("price_1PuvdgIewCKA2h0IisTKqjFN", {
4223
- amount: 1200,
4224
- period: "yearly",
4225
- status: "active"
4226
- })
4227
- }),
4228
- professional: createProduct("prod_MoR1SchsRDAIgY", {
4229
- monthly_199: createPrice("price_1M4o9vIewCKA2h0IHREokdD8", {
4230
- amount: 199,
4231
- period: "monthly",
4232
- status: "inactive"
4233
- }),
4234
- monthly_240: createPrice("price_1M4o9vIewCKA2h0IHREokdD8", {
4235
- amount: 240,
4236
- period: "monthly",
4237
- status: "inactive"
4238
- }),
4239
- monthly_300: createPrice("price_1PuuHrIewCKA2h0IQfEZ4Wog", {
4240
- amount: 300,
4241
- period: "monthly",
4242
- status: "active"
4243
- }),
4244
- yearly_2880: createPrice("price_1PuuJAIewCKA2h0IibpUIhf9", {
4245
- amount: 2880,
4246
- period: "yearly",
4247
- status: "active"
4248
- })
4249
- })
4250
- },
4251
- cli: {
4252
- founder: createProduct("prod_Gq0E8nbTYHtkPl", {
4253
- monthly_100: createPrice("plan_Gq0FzdmoTJshQL", {
4254
- amount: 100,
4255
- period: "monthly",
4256
- status: "inactive"
4257
- }),
4258
- monthly_125: createPrice("price_1PuuMRIewCKA2h0IrggfwCwA", {
4259
- amount: 125,
4260
- period: "monthly",
4261
- status: "active"
4262
- }),
4263
- yearly_1200: createPrice("price_1PuuMkIewCKA2h0IRxhkDpmk", {
4264
- amount: 1200,
4265
- period: "yearly",
4266
- status: "active"
4267
- })
4268
- }),
4269
- founder30: createProduct("prod_GsL6LaRo4NFD5n", {
4270
- monthly_30: createPrice("plan_GsL7NZskOY0TC9", {
4271
- amount: 30,
4272
- period: "monthly",
4273
- status: "active"
4274
- })
4275
- }),
4276
- founder50: createProduct("prod_GsL5O1PdbxOrxJ", {
4277
- monthly_50: createPrice("plan_GsL6VYAshfh7c4", {
4278
- amount: 50,
4279
- period: "monthly",
4280
- status: "active"
4281
- }),
4282
- monthly_90: createPrice("plan_GsL6VYAshfh7c4", {
4283
- amount: 90,
4284
- period: "monthly",
4285
- status: "inactive"
4286
- })
4287
- }),
4288
- performance: createProduct("prod_LphQku6BNkzCga", {
4289
- monthly_300: createPrice("price_1L821UIewCKA2h0IUwRhicyo", {
4290
- amount: 300,
4291
- period: "monthly",
4292
- status: "inactive"
4293
- }),
4294
- monthly_375: createPrice("price_1PuuO7IewCKA2h0IOK9ivzS0", {
4295
- amount: 375,
4296
- period: "monthly",
4297
- status: "active"
4298
- }),
4299
- yearly_3600: createPrice("price_1PuuOKIewCKA2h0IrcVvJkgG", {
4300
- amount: 3600,
4301
- period: "yearly",
4302
- status: "active"
4303
- })
4304
- }),
4305
- scale: createProduct("prod_LphQxNgfUIxVfA", {
4306
- monthly_1200: createPrice("price_1L821wIewCKA2h0IMLUmjulL", {
4307
- amount: 1200,
4308
- period: "monthly",
4309
- status: "inactive"
4310
- }),
4311
- monthly_1500: createPrice("price_1PuuPFIewCKA2h0IbPmKdsJr", {
4312
- amount: 1500,
4313
- period: "monthly",
4314
- status: "active"
4315
- }),
4316
- yearly_14400: createPrice("price_1PuuPaIewCKA2h0IhLfSlRFj", {
4317
- amount: 14400,
4318
- period: "yearly",
4319
- status: "active"
4320
- })
4321
- })
4322
- },
4323
- legacy: {
4324
- business: createProduct("prod_Fe8CbCE2wGJIWr", {
4325
- monthly_199: createPrice("plan_Fe8CUkZfXasFtB", {
4326
- amount: 199,
4327
- period: "monthly",
4328
- status: "active"
4329
- })
4330
- }),
4331
- enterprise: createProduct("prod_Hc9PMnHUmHvOlw", {
4332
- monthly_700: createPrice("price_1H2v6JIewCKA2h0IgUwsuctb", {
4333
- amount: 700,
4334
- period: "monthly",
4335
- status: "active"
4336
- })
4337
- }),
4338
- essential: createProduct("prod_FplN7CkqFRH0ye", {
4339
- monthly_58: createPrice("plan_FpljxNuZtNFFbm", {
4340
- amount: 58,
4341
- period: "monthly",
4342
- status: "active"
4343
- })
4344
- }),
4345
- essentialNew: createProduct("prod_GYXm5X66hM1Ywj", {
4346
- monthly_58: createPrice("plan_GYXmTA3EdfCv4q", {
4347
- amount: 58,
4348
- period: "monthly",
4349
- status: "active"
4350
- }),
4351
- yearly_580: createPrice("plan_GYXmTA3EdfCv4q", {
4352
- amount: 580,
4353
- period: "yearly",
4354
- status: "active"
4355
- })
4356
- }),
4357
- growth: createProduct("prod_FplOSDbBmxba94", {
4358
- monthly_199: createPrice("plan_FplOshrr1w3Mvu", {
4359
- amount: 199,
4360
- period: "monthly",
4361
- status: "active"
4362
- })
4363
- }),
4364
- professional: createProduct("prod_GYXo54YK5kga12", {
4365
- monthly_199: createPrice("plan_GYXoIkvwVKyfF2", {
4366
- amount: 199,
4367
- period: "monthly",
4368
- status: "active"
4369
- }),
4370
- yearly_1990: createPrice("price_1KHU70IewCKA2h0IR87yXOQ2", {
4371
- amount: 1990,
4372
- period: "yearly",
4373
- status: "inactive"
4374
- }),
4375
- yearly_2388: createPrice("price_1KHU70IewCKA2h0IR87yXOQ2", {
4376
- amount: 2388,
4377
- period: "yearly",
4378
- status: "active"
4379
- })
4380
- }),
4381
- startup: createProduct("prod_Fe8BTslXbdylxV", {
4382
- monthly_49: createPrice("plan_Fe8BzLp7k71eGD", {
4383
- amount: 49,
4384
- period: "monthly",
4385
- status: "active"
4386
- }),
4387
- yearly_200: createPrice("plan_Fe8BzLp7k71eGD", {
4388
- amount: 200,
4389
- period: "yearly",
4390
- status: "active"
4391
- })
4392
- })
4393
- }
4394
- },
4395
- prod: {
4396
- builder: {
4397
- essential: createProduct("prod_MoR2Ldm5PJpJZJ", {
4398
- monthly_125: createPrice("price_1PuuU1IewCKA2h0IUSAcuUUb", {
4399
- amount: 125,
4400
- period: "monthly",
4401
- status: "active"
4402
- }),
4403
- monthly_99: createPrice("price_1M4oA4IewCKA2h0IWgfbSJBe", {
4404
- amount: 99,
4405
- period: "monthly",
4406
- status: "inactive"
4407
- }),
4408
- yearly_1200: createPrice("price_1PuuUZIewCKA2h0IDMNwNqQl", {
4409
- amount: 1200,
4410
- period: "yearly",
4411
- status: "active"
4412
- })
4413
- }),
4414
- professional: createProduct("prod_MoR2h0Nf16hhgb", {
4415
- monthly_199: createPrice("price_1M4oABIewCKA2h0INkbaCbIS", {
4416
- amount: 199,
4417
- period: "monthly",
4418
- status: "inactive"
4419
- }),
4420
- monthly_240: createPrice("price_1MIDxtIewCKA2h0IvWi5weJL", {
4421
- amount: 240,
4422
- period: "monthly",
4423
- status: "inactive"
4424
- }),
4425
- monthly_300: createPrice("price_1PuuVSIewCKA2h0IETsLUwF9", {
4426
- amount: 300,
4427
- period: "monthly",
4428
- status: "active"
4429
- }),
4430
- yearly_2880: createPrice("price_1PuuVmIewCKA2h0I37dMpqI5", {
4431
- amount: 2880,
4432
- period: "yearly",
4433
- status: "active"
4434
- })
4435
- })
4436
- },
4437
- cli: {
4438
- founder: createProduct("prod_GpzVRVsBgluoef", {
4439
- monthly_100: createPrice("plan_GpzWZLfsOzjrvI", {
4440
- amount: 100,
4441
- period: "monthly",
4442
- status: "inactive"
4443
- }),
4444
- monthly_125: createPrice("price_1PuuXFIewCKA2h0IVHSyfFsd", {
4445
- amount: 125,
4446
- period: "monthly",
4447
- status: "active"
4448
- }),
4449
- yearly_1200: createPrice("price_1PuuXYIewCKA2h0IAsygBajd", {
4450
- amount: 1200,
4451
- period: "yearly",
4452
- status: "active"
4453
- })
4454
- }),
4455
- founder30: createProduct("prod_GrHtZKuUDvLZOF", {
4456
- monthly_30: createPrice("plan_GrHuyGjzYN0XN2", {
4457
- amount: 30,
4458
- period: "monthly",
4459
- status: "active"
4460
- })
4461
- }),
4462
- founder50: createProduct("prod_GsL0ntimYpTTwD", {
4463
- monthly_50: createPrice("plan_GsL1IRUwpj5CIF", {
4464
- amount: 50,
4465
- period: "monthly",
4466
- status: "active"
4467
- }),
4468
- monthly_90: createPrice("price_1JMHNnIewCKA2h0II5RGjVtk", {
4469
- amount: 90,
4470
- period: "monthly",
4471
- status: "inactive"
4472
- })
4473
- }),
4474
- performance: createProduct("prod_LphRn5Rfuq3CMh", {
4475
- monthly_300: createPrice("price_1L822LIewCKA2h0I5JYyOG1p", {
4476
- amount: 300,
4477
- period: "monthly",
4478
- status: "inactive"
4479
- }),
4480
- monthly_375: createPrice("price_1PuuYKIewCKA2h0IWBJ4cyRQ", {
4481
- amount: 375,
4482
- period: "monthly",
4483
- status: "active"
4484
- }),
4485
- yearly_3600: createPrice("price_1PuuYcIewCKA2h0IzeU1xWbQ", {
4486
- amount: 3600,
4487
- period: "yearly",
4488
- status: "active"
4489
- })
4490
- }),
4491
- scale: createProduct("prod_LphRKSuMLjQriP", {
4492
- monthly_1200: createPrice("price_1L822RIewCKA2h0IPt9f2nZM", {
4493
- amount: 1200,
4494
- period: "monthly",
4495
- status: "inactive"
4496
- }),
4497
- monthly_1500: createPrice("price_1PuuarIewCKA2h0IEONPcFU5", {
4498
- amount: 1500,
4499
- period: "monthly",
4500
- status: "active"
4501
- }),
4502
- yearly_14400: createPrice("price_1Puub5IewCKA2h0IMJ3CQ58r", {
4503
- amount: 14400,
4504
- period: "yearly",
4505
- status: "active"
4506
- })
4507
- })
4508
- },
4509
- legacy: {
4510
- business: createProduct("prod_FdmEvAgT7ZtVEw", {
4511
- monthly_199: createPrice("plan_FdmE8akq9ukxiY", {
4512
- amount: 199,
4513
- period: "monthly",
4514
- status: "active"
4515
- })
4516
- }),
4517
- enterprise: createProduct("prod_GuGGWeMQ3SCuE9", {
4518
- monthly_700: createPrice("plan_GuGICX6nRtDthN", {
4519
- amount: 700,
4520
- period: "monthly",
4521
- status: "active"
4522
- })
4523
- }),
4524
- essential: createProduct("prod_FohIP5aSMWWGyY", {
4525
- monthly_58: createPrice("plan_FohJzCujA6vvt4", {
4526
- amount: 58,
4527
- period: "monthly",
4528
- status: "active"
4529
- })
4530
- }),
4531
- essentialNew: createProduct("prod_GYXn73zcoJKsF8", {
4532
- monthly_58: createPrice("plan_GYXn2cnPl5dy7j", {
4533
- amount: 58,
4534
- period: "monthly",
4535
- status: "active"
4536
- }),
4537
- yearly_580: createPrice("price_1Gqb24IewCKA2h0ILP5rxTnT", {
4538
- amount: 580,
4539
- period: "yearly",
4540
- status: "active"
4541
- })
4542
- }),
4543
- growth: createProduct("prod_FohKfjLOlJNm1W", {
4544
- monthly_199: createPrice("plan_FohKGuWis5ocsi", {
4545
- amount: 199,
4546
- period: "monthly",
4547
- status: "active"
4548
- })
4549
- }),
4550
- professional: createProduct("prod_GYXouE5K7vuitU", {
4551
- monthly_199: createPrice("plan_GYXoKsa2j0yURg", {
4552
- amount: 199,
4553
- period: "monthly",
4554
- status: "active"
4555
- }),
4556
- yearly_1990: createPrice("price_1KHTgaIewCKA2h0I81TVg85r", {
4557
- amount: 1990,
4558
- period: "yearly",
4559
- status: "inactive"
4560
- }),
4561
- yearly_2388: createPrice("price_1KLT32IewCKA2h0IFeJOAgG5", {
4562
- amount: 2388,
4563
- period: "yearly",
4564
- status: "active"
4565
- })
4566
- }),
4567
- startup: createProduct("prod_FdmCGcrX2IETUH", {
4568
- monthly_49: createPrice("plan_FdmDAUN7JGD8pR", {
4569
- amount: 49,
4570
- period: "monthly",
4571
- status: "active"
4572
- }),
4573
- yearly_200: createPrice("plan_Ft8qvk401twwrW", {
4574
- amount: 200,
4575
- period: "yearly",
4576
- status: "active"
4577
- })
4578
- })
4579
- }
4580
- }
4581
- };
4582
- var { dev, prod } = products;
4583
- var basicPlan = createPlan("basic", {
4584
- dev: [
4585
- dev.builder.essential,
4586
- dev.cli.founder30,
4587
- dev.cli.founder50,
4588
- dev.cli.founder,
4589
- dev.legacy.essential,
4590
- dev.legacy.essentialNew,
4591
- dev.legacy.startup
4592
- ],
4593
- prod: [
4594
- prod.builder.essential,
4595
- prod.cli.founder30,
4596
- prod.cli.founder50,
4597
- prod.cli.founder,
4598
- prod.legacy.essential,
4599
- prod.legacy.essentialNew,
4600
- prod.legacy.startup
4601
- ]
4602
- });
4603
- var legacyProPlan = createPlan("legacy_pro", {
4604
- dev: [
4605
- dev.builder.professional,
4606
- dev.cli.founder,
4607
- dev.cli.founder30,
4608
- dev.cli.founder50,
4609
- dev.cli.performance,
4610
- dev.cli.scale,
4611
- dev.legacy.professional,
4612
- dev.legacy.growth,
4613
- dev.legacy.business
4614
- ],
4615
- prod: [
4616
- prod.builder.professional,
4617
- prod.cli.founder,
4618
- prod.cli.founder30,
4619
- prod.cli.founder50,
4620
- prod.cli.performance,
4621
- prod.cli.scale,
4622
- prod.legacy.professional,
4623
- prod.legacy.growth,
4624
- prod.legacy.business
4625
- ]
4626
- });
4627
- var proPlan = createPlan("pro", {
4628
- dev: [
4629
- dev.builder.professional,
4630
- dev.cli.performance,
4631
- dev.legacy.professional,
4632
- dev.legacy.growth,
4633
- dev.legacy.business
4634
- ],
4635
- prod: [
4636
- prod.builder.professional,
4637
- prod.cli.performance,
4638
- prod.legacy.professional,
4639
- prod.legacy.growth,
4640
- prod.legacy.business
4641
- ]
4642
- });
4643
- var scalePlan = createPlan("scale", {
4644
- dev: [dev.cli.scale, dev.legacy.enterprise],
4645
- prod: [prod.cli.scale, prod.legacy.enterprise]
4646
- });
4647
- var configurations = {
4648
- dev: {
4649
- builder: {
4650
- update: createPortalConfig(PortalConfigKey.BuilderUpdateDev, [
4651
- dev.builder.essential,
4652
- dev.builder.professional
4653
- ]),
4654
- upgrade: createPortalConfig(PortalConfigKey.BuilderUpgradeDev, [
4655
- dev.builder.professional
4656
- ])
4657
- },
4658
- cli: {
4659
- update: createPortalConfig(PortalConfigKey.CLIUpdateDev, [
4660
- dev.cli.founder,
4661
- dev.cli.performance,
4662
- dev.cli.scale
4663
- ]),
4664
- upgrade: createPortalConfig(PortalConfigKey.CLIUpgradeDev, [
4665
- dev.cli.performance,
4666
- dev.cli.scale
4667
- ])
4668
- }
4669
- },
4670
- prod: {
4671
- builder: {
4672
- update: createPortalConfig(PortalConfigKey.BuilderUpdateProd, [
4673
- prod.builder.essential,
4674
- prod.builder.professional
4675
- ]),
4676
- upgrade: createPortalConfig(PortalConfigKey.BuilderUpgradeProd, [
4677
- prod.builder.professional
4678
- ])
4679
- },
4680
- cli: {
4681
- update: createPortalConfig(PortalConfigKey.CLIUpdateProd, [
4682
- prod.cli.founder,
4683
- prod.cli.performance,
4684
- prod.cli.scale
4685
- ]),
4686
- upgrade: createPortalConfig(PortalConfigKey.CLIUpgradeProd, [
4687
- prod.cli.performance,
4688
- prod.cli.scale
4689
- ])
4690
- }
4691
- }
4692
- };
4693
- var LegacyProductRecord = {
4694
- builder_essential: {
4695
- dev: dev.builder.essential,
4696
- prod: prod.builder.essential
4697
- },
4698
- builder_professional: {
4699
- dev: dev.builder.professional,
4700
- prod: prod.builder.professional
4701
- },
4702
- business: { dev: dev.legacy.business, prod: prod.legacy.business },
4703
- cli_founder: { dev: dev.cli.founder, prod: prod.cli.founder },
4704
- cli_founder_30: { dev: dev.cli.founder30, prod: prod.cli.founder30 },
4705
- cli_founder_50: { dev: dev.cli.founder50, prod: prod.cli.founder50 },
4706
- cli_performance: { dev: dev.cli.performance, prod: prod.cli.performance },
4707
- cli_scale: { dev: dev.cli.scale, prod: prod.cli.scale },
4708
- enterprise: { dev: dev.legacy.enterprise, prod: prod.legacy.enterprise },
4709
- essential: { dev: dev.legacy.essential, prod: prod.legacy.essential },
4710
- essential_new: {
4711
- dev: dev.legacy.essentialNew,
4712
- prod: prod.legacy.essentialNew
4713
- },
4714
- growth: { dev: dev.legacy.growth, prod: prod.legacy.growth },
4715
- professional: {
4716
- dev: dev.legacy.professional,
4717
- prod: prod.legacy.professional
4718
- },
4719
- professional_annual: {
4720
- dev: dev.legacy.professional,
4721
- prod: prod.legacy.professional
4722
- },
4723
- professional_annual_full_price: {
4724
- dev: dev.legacy.professional,
4725
- prod: prod.legacy.professional
4726
- },
4727
- startup: { dev: dev.legacy.startup, prod: prod.legacy.startup }
4728
- };
4729
-
4730
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/validations.js
4731
- var import_is_regex = __toESM(require_is_regex());
4732
- var import_semver = __toESM(require("semver"));
4733
- var yup = __toESM(require_yup());
4734
- var appTitleValidation = yup.string().label("App title").max(26).matches(/^[\w\-\s]+$/, "App title may contain letters, numbers, spaces and dashes only").matches(/^[^\s]+(\s+[^\s]+)*$/, "App title may not begin or end with space").required();
4735
- function isNumeric(str) {
4736
- if (typeof str !== "string")
4737
- return false;
4738
- return !Number.isNaN(Number(str)) && !Number.isNaN(parseFloat(str));
4739
- }
4740
- function isNumericSemver(value) {
4741
- if (!import_semver.default.valid(value))
4742
- return false;
4743
- if (!value.split(".").every((num) => isNumeric(num)))
4744
- return false;
4745
- return true;
4746
- }
4747
- var forceVersionValidation = yup.string().label("App version").required().when("$currentVersion", ([currentVersion], schema) => schema.test("semantic-version", "App version must follow a numeric SemVer versioning scheme (e.g. 1.0.0) and be greater than prior version.", (forceVersion) => {
4748
- return isNumericSemver(forceVersion) && import_semver.default.gt(forceVersion, currentVersion);
4749
- }));
4750
- var iconValidation = yup.string().label("Icon").url().required("You must upload an icon for your app");
4751
- var urlValidation = yup.string().matches(/^(?:([a-z0-9+.-]+):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/, {
4752
- excludeEmptyString: true,
4753
- message: "Invalid URL. Don't forget to include the protocol (e.g.. https://)."
4754
- }).label("Website URL").required();
4755
- var urlValidationForm = yup.object().shape({
4756
- url: urlValidation
4757
- });
4758
- var heightValidation = yup.number().label("Height").moreThan(1).lessThan(2e3).required();
4759
- var widthValidation = yup.number().label("Width").moreThan(1).lessThan(3e3).required();
4760
- var internalAppRegexValidation = yup.string().required().label("Internal URLs").test("escape-forward-slash", "a forward-slash ('/') must be escaped with a back-slash ('\\')", (value) => {
4761
- if (value.includes("/")) {
4762
- const forwardSlashCount = value.split("").map((char) => char === "/").filter((isTrue) => isTrue).length;
4763
- const backSlashEscapeCount = ((value || "").match(/(?=\\\/)/g) || []).length;
4764
- return forwardSlashCount === backSlashEscapeCount;
4765
- }
4766
- return true;
4767
- }).test(
4768
- "is-regex",
4769
- // eslint-disable-next-line no-template-curly-in-string
4770
- "${path} must be valid regular expression",
4771
- (value) => (0, import_is_regex.default)(RegExp(value))
4772
- );
4773
- var appProtocolValidation = yup.string().required().label("App Protocol").test("ends-with-protocol", "Protocols must end with `://`", (value) => value.endsWith("://")).test("is-lowercase", "Protocols must be lowercase", (value) => value === value.toLowerCase()).matches(/^[a-zA-Z-.]+:\/\/$/, "Protocols contain letters, dots (.) and dashes (-) only").min(5);
4774
- var appConfigValidation = yup.object({
4775
- customUserAgent: yup.string().required(),
4776
- disableDevTools: yup.boolean().required(),
4777
- iconUrl: iconValidation,
4778
- id: yup.string().required(),
4779
- internalURLs: yup.string().required(),
4780
- isFrameBlocked: yup.boolean().required(),
4781
- meta: yup.object({
4782
- appIterations: yup.number().required(),
4783
- hasAppChanged: yup.boolean().required(),
4784
- publishedVersions: yup.object({
4785
- desktopify: yup.string().notRequired(),
4786
- electron: yup.string().notRequired(),
4787
- version: yup.string().notRequired()
4788
- }),
4789
- schemaVersion: yup.number().required()
4790
- }).required(),
4791
- name: appTitleValidation,
4792
- secret: yup.string().required(),
4793
- singleInstance: yup.boolean().required(),
4794
- url: urlValidation,
4795
- windowOptions: yup.object({
4796
- hasMaxHeight: yup.boolean().required(),
4797
- hasMaxWidth: yup.boolean().required(),
4798
- hasMinHeight: yup.boolean().required(),
4799
- hasMinWidth: yup.boolean().required(),
4800
- height: yup.number().required(),
4801
- isFullscreenable: yup.boolean().required(),
4802
- isMaximizable: yup.boolean().required(),
4803
- isMinimizable: yup.boolean().required(),
4804
- isResizable: yup.boolean().required(),
4805
- maxHeight: yup.number().required(),
4806
- maxWidth: yup.number().required(),
4807
- minHeight: yup.number().required(),
4808
- minWidth: yup.number().required(),
4809
- startInFullscreenMode: yup.boolean().required(),
4810
- width: yup.number().required(),
4811
- alwaysOnTop: yup.boolean().required(),
4812
- autoHideMenuBar: yup.boolean().required(),
4813
- transparentInsetTitlebar: yup.boolean().required(),
4814
- transparentTitlebar: yup.boolean().required()
4815
- }).required()
4816
- });
4817
-
4818
- // ../../node_modules/.pnpm/@todesktop+shared@7.193.0/node_modules/@todesktop/shared/lib/esm/index.js
4819
- var schemaVersion = package_default.version;
4820
-
4821
483
  // src/utilities/useInput.ts
4822
484
  var import_is_ci = __toESM(require("is-ci"));
4823
485
  var import_react = require("react");
@@ -6214,8 +1876,7 @@ function loadTypeScriptConfig(configPath) {
6214
1876
  logger_default.debug(`Found TypeScript in user's project at: ${tsPath}`);
6215
1877
  } catch {
6216
1878
  try {
6217
- const moduleName = "typescript";
6218
- typescript = require(moduleName);
1879
+ typescript = require("typescript");
6219
1880
  logger_default.debug("Using globally available TypeScript installation");
6220
1881
  } catch {
6221
1882
  throw new Error(
@@ -6391,7 +2052,7 @@ var import_email_regex = __toESM(require("email-regex"));
6391
2052
  var fs2 = __toESM(require("fs"));
6392
2053
  var path4 = __toESM(require("path"));
6393
2054
  var import_parse_author = __toESM(require("parse-author"));
6394
- var semver2 = __toESM(require("semver"));
2055
+ var semver = __toESM(require("semver"));
6395
2056
 
6396
2057
  // src/utilities/projectConfig/validatePackageJSON.ts
6397
2058
  var import_ajv = __toESM(require("ajv"));
@@ -6750,7 +2411,7 @@ var addCustomKeywords_default = (ajv, context) => {
6750
2411
  type: "string",
6751
2412
  validate: (schema, data) => {
6752
2413
  const keyword = (schema.packageName ? `${schema.packageName} ` : "") + "version";
6753
- if (!(semver2.valid(data) || semver2.validRange(data))) {
2414
+ if (!(semver.valid(data) || semver.validRange(data))) {
6754
2415
  throw new import_ajv2.ValidationError([
6755
2416
  {
6756
2417
  keyword,
@@ -7174,7 +2835,7 @@ var schema_default = {
7174
2835
  minLength: 1,
7175
2836
  description: "The version of the Linux image that ToDesktop should use to build your app.",
7176
2837
  examples: ["0.1.0"],
7177
- default: "0.0.11"
2838
+ default: "0.0.12"
7178
2839
  },
7179
2840
  noSandbox: {
7180
2841
  type: "boolean",
@@ -10236,13 +5897,13 @@ var import_util = __toESM(require("util"));
10236
5897
  var import_jsx_runtime30 = require("react/jsx-runtime");
10237
5898
  var supportsColor = import_chalk2.default.stderr.supportsColor;
10238
5899
  var SyntaxHighlight = ({
10239
- object: object2,
5900
+ object,
10240
5901
  colors = supportsColor == null ? void 0 : supportsColor.hasBasic
10241
5902
  }) => {
10242
5903
  const { stdout } = (0, import_ink28.useStdout)();
10243
5904
  const highlightedCode = React3.useMemo(() => {
10244
- return stdout.isTTY ? import_util.default.inspect(object2, { colors, depth: 6 }) : JSON.stringify(object2, null, 2);
10245
- }, [colors, object2, stdout.isTTY]);
5905
+ return stdout.isTTY ? import_util.default.inspect(object, { colors, depth: 6 }) : JSON.stringify(object, null, 2);
5906
+ }, [colors, object, stdout.isTTY]);
10246
5907
  return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_ink28.Text, { wrap: "end", children: highlightedCode });
10247
5908
  };
10248
5909
  var SyntaxHighlight_default = SyntaxHighlight;
@@ -12030,7 +7691,7 @@ var import_ink41 = require("ink");
12030
7691
  var import_react29 = require("react");
12031
7692
 
12032
7693
  // src/commands/smoke-test/utilities/build.ts
12033
- var import_semver2 = __toESM(require("semver"));
7694
+ var import_semver = __toESM(require("semver"));
12034
7695
  var MIN_RUNTIME_VERSION = "1.2.3-0";
12035
7696
  function isBuildTestable(build) {
12036
7697
  try {
@@ -12119,16 +7780,16 @@ function validateBuild(build) {
12119
7780
  }
12120
7781
  }
12121
7782
  function isRuntimeVerRangeAllowed(runtimeVerRange) {
12122
- const minRuntimeVersionForApp = import_semver2.default.minVersion(runtimeVerRange, {
7783
+ const minRuntimeVersionForApp = import_semver.default.minVersion(runtimeVerRange, {
12123
7784
  loose: true
12124
7785
  });
12125
- return import_semver2.default.gte(minRuntimeVersionForApp, MIN_RUNTIME_VERSION, {
7786
+ return import_semver.default.gte(minRuntimeVersionForApp, MIN_RUNTIME_VERSION, {
12126
7787
  loose: true
12127
7788
  });
12128
7789
  }
12129
7790
 
12130
7791
  // src/commands/release/utilities/analyzeRelease.ts
12131
- var import_semver3 = __toESM(require("semver"));
7792
+ var import_semver2 = __toESM(require("semver"));
12132
7793
  var MIN_RUNTIME_VERSION_FOR_DOWNGRADE = "1.4.1-1";
12133
7794
  function analyzeRelease({
12134
7795
  build,
@@ -12136,7 +7797,7 @@ function analyzeRelease({
12136
7797
  }) {
12137
7798
  const result = {
12138
7799
  downgradeAllowed: Boolean(
12139
- (latestReleasedBuild == null ? void 0 : latestReleasedBuild.todesktopRuntimeVersionUsed) && import_semver3.default.gte(
7800
+ (latestReleasedBuild == null ? void 0 : latestReleasedBuild.todesktopRuntimeVersionUsed) && import_semver2.default.gte(
12140
7801
  latestReleasedBuild.todesktopRuntimeVersionUsed,
12141
7802
  MIN_RUNTIME_VERSION_FOR_DOWNGRADE
12142
7803
  )
@@ -12145,7 +7806,7 @@ function analyzeRelease({
12145
7806
  isAlreadyReleased: Boolean(build.releasedAt),
12146
7807
  isAlreadyTheLatest: build.id === (latestReleasedBuild == null ? void 0 : latestReleasedBuild.id),
12147
7808
  isOlderThanLatest: Boolean(
12148
- latestReleasedBuild && latestReleasedBuild.appVersion && build.appVersion && import_semver3.default.gt(latestReleasedBuild.appVersion, build.appVersion)
7809
+ latestReleasedBuild && latestReleasedBuild.appVersion && build.appVersion && import_semver2.default.gt(latestReleasedBuild.appVersion, build.appVersion)
12149
7810
  ),
12150
7811
  isReleasable: false,
12151
7812
  isSucceeded: build.status === "succeeded",
@@ -12938,14 +8599,14 @@ var WhoamiCommand_default = WhoAmIWrapper;
12938
8599
  var import_chalk3 = __toESM(require("chalk"));
12939
8600
  var import_is_installed_globally = __toESM(require("is-installed-globally"));
12940
8601
  var import_latest_version = __toESM(require("latest-version"));
12941
- var import_semver4 = __toESM(require("semver"));
8602
+ var import_semver3 = __toESM(require("semver"));
12942
8603
  var exitIfCLIOutOfDate_default = () => {
12943
8604
  if (process.env.AVA_PATH) {
12944
8605
  return;
12945
8606
  }
12946
8607
  const pkg = getToDesktopPackageJson();
12947
8608
  (0, import_latest_version.default)(pkg.name).then((latest) => {
12948
- if (import_semver4.default.gt(latest, pkg.version)) {
8609
+ if (import_semver3.default.gt(latest, pkg.version)) {
12949
8610
  const commandToUpdate = import_chalk3.default.greenBright(
12950
8611
  `npm install ${import_is_installed_globally.default ? "-g" : "--save-dev"} @todesktop/cli`
12951
8612
  );
@@ -12953,7 +8614,7 @@ var exitIfCLIOutOfDate_default = () => {
12953
8614
  `Your version of @todesktop/cli is out of date.
12954
8615
  Run ${commandToUpdate} to update to v${latest}.`
12955
8616
  );
12956
- if (!import_semver4.default.satisfies(latest, `^${pkg.version}`)) {
8617
+ if (!import_semver3.default.satisfies(latest, `^${pkg.version}`)) {
12957
8618
  console.error(`CLI is exiting because it is out out of date.`);
12958
8619
  process.exit(1);
12959
8620
  }
@@ -12966,13 +8627,13 @@ var Sentry3 = __toESM(require("@sentry/node"));
12966
8627
  var import_os2 = __toESM(require("os"));
12967
8628
 
12968
8629
  // package.json
12969
- var package_default2 = {
8630
+ var package_default = {
12970
8631
  private: false,
12971
8632
  publishConfig: {
12972
8633
  access: "public"
12973
8634
  },
12974
8635
  name: "@todesktop/cli",
12975
- version: "1.19.0-3",
8636
+ version: "1.19.1",
12976
8637
  license: "MIT",
12977
8638
  author: "Dave Jeffery <dave@todesktop.com> (http://www.todesktop.com/)",
12978
8639
  homepage: "https://todesktop.com/cli",
@@ -13057,7 +8718,7 @@ var package_default2 = {
13057
8718
  },
13058
8719
  devDependencies: {
13059
8720
  "@todesktop/dev-config": "workspace:*",
13060
- "@todesktop/shared": "^7.193.0",
8721
+ "@todesktop/shared": "workspace:*",
13061
8722
  "@types/bunyan": "^1.8.11",
13062
8723
  "@types/ink-testing-library": "^1.0.4",
13063
8724
  "@types/is-ci": "^3.0.4",
@@ -13142,8 +8803,8 @@ var initSentry_default = () => {
13142
8803
  }
13143
8804
  try {
13144
8805
  scope.setContext("app", {
13145
- app_name: package_default2.name,
13146
- app_version: package_default2.version
8806
+ app_name: package_default.name,
8807
+ app_version: package_default.version
13147
8808
  });
13148
8809
  } catch {
13149
8810
  }