pi-adaptive-thinking 0.1.1 → 0.1.2

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/index.js DELETED
@@ -1,4346 +0,0 @@
1
- import { createRequire } from "node:module";
2
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
3
- import { homedir } from "os";
4
- import { join } from "path";
5
- import { Type } from "typebox";
6
- import { readFile } from "node:fs/promises";
7
- import { homedir as homedir$1 } from "node:os";
8
- import { join as join$1 } from "node:path";
9
- import { getSupportedThinkingLevels } from "@earendil-works/pi-ai";
10
- //#region \0rolldown/runtime.js
11
- var __create = Object.create;
12
- var __defProp = Object.defineProperty;
13
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
- var __getOwnPropNames = Object.getOwnPropertyNames;
15
- var __getProtoOf = Object.getPrototypeOf;
16
- var __hasOwnProp = Object.prototype.hasOwnProperty;
17
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
20
- key = keys[i];
21
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
22
- get: ((k) => from[k]).bind(null, key),
23
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
24
- });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
29
- value: mod,
30
- enumerable: true
31
- }) : target, mod));
32
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
33
- //#endregion
34
- //#region node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
35
- var require_polyfills = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36
- var constants = __require("constants");
37
- var origCwd = process.cwd;
38
- var cwd = null;
39
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
40
- process.cwd = function() {
41
- if (!cwd) cwd = origCwd.call(process);
42
- return cwd;
43
- };
44
- try {
45
- process.cwd();
46
- } catch (er) {}
47
- if (typeof process.chdir === "function") {
48
- var chdir = process.chdir;
49
- process.chdir = function(d) {
50
- cwd = null;
51
- chdir.call(process, d);
52
- };
53
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
54
- }
55
- module.exports = patch;
56
- function patch(fs) {
57
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) patchLchmod(fs);
58
- if (!fs.lutimes) patchLutimes(fs);
59
- fs.chown = chownFix(fs.chown);
60
- fs.fchown = chownFix(fs.fchown);
61
- fs.lchown = chownFix(fs.lchown);
62
- fs.chmod = chmodFix(fs.chmod);
63
- fs.fchmod = chmodFix(fs.fchmod);
64
- fs.lchmod = chmodFix(fs.lchmod);
65
- fs.chownSync = chownFixSync(fs.chownSync);
66
- fs.fchownSync = chownFixSync(fs.fchownSync);
67
- fs.lchownSync = chownFixSync(fs.lchownSync);
68
- fs.chmodSync = chmodFixSync(fs.chmodSync);
69
- fs.fchmodSync = chmodFixSync(fs.fchmodSync);
70
- fs.lchmodSync = chmodFixSync(fs.lchmodSync);
71
- fs.stat = statFix(fs.stat);
72
- fs.fstat = statFix(fs.fstat);
73
- fs.lstat = statFix(fs.lstat);
74
- fs.statSync = statFixSync(fs.statSync);
75
- fs.fstatSync = statFixSync(fs.fstatSync);
76
- fs.lstatSync = statFixSync(fs.lstatSync);
77
- if (fs.chmod && !fs.lchmod) {
78
- fs.lchmod = function(path, mode, cb) {
79
- if (cb) process.nextTick(cb);
80
- };
81
- fs.lchmodSync = function() {};
82
- }
83
- if (fs.chown && !fs.lchown) {
84
- fs.lchown = function(path, uid, gid, cb) {
85
- if (cb) process.nextTick(cb);
86
- };
87
- fs.lchownSync = function() {};
88
- }
89
- if (platform === "win32") fs.rename = typeof fs.rename !== "function" ? fs.rename : (function(fs$rename) {
90
- function rename(from, to, cb) {
91
- var start = Date.now();
92
- var backoff = 0;
93
- fs$rename(from, to, function CB(er) {
94
- if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
95
- setTimeout(function() {
96
- fs.stat(to, function(stater, st) {
97
- if (stater && stater.code === "ENOENT") fs$rename(from, to, CB);
98
- else cb(er);
99
- });
100
- }, backoff);
101
- if (backoff < 100) backoff += 10;
102
- return;
103
- }
104
- if (cb) cb(er);
105
- });
106
- }
107
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
108
- return rename;
109
- })(fs.rename);
110
- fs.read = typeof fs.read !== "function" ? fs.read : (function(fs$read) {
111
- function read(fd, buffer, offset, length, position, callback_) {
112
- var callback;
113
- if (callback_ && typeof callback_ === "function") {
114
- var eagCounter = 0;
115
- callback = function(er, _, __) {
116
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
117
- eagCounter++;
118
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
119
- }
120
- callback_.apply(this, arguments);
121
- };
122
- }
123
- return fs$read.call(fs, fd, buffer, offset, length, position, callback);
124
- }
125
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
126
- return read;
127
- })(fs.read);
128
- fs.readSync = typeof fs.readSync !== "function" ? fs.readSync : (function(fs$readSync) {
129
- return function(fd, buffer, offset, length, position) {
130
- var eagCounter = 0;
131
- while (true) try {
132
- return fs$readSync.call(fs, fd, buffer, offset, length, position);
133
- } catch (er) {
134
- if (er.code === "EAGAIN" && eagCounter < 10) {
135
- eagCounter++;
136
- continue;
137
- }
138
- throw er;
139
- }
140
- };
141
- })(fs.readSync);
142
- function patchLchmod(fs) {
143
- fs.lchmod = function(path, mode, callback) {
144
- fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
145
- if (err) {
146
- if (callback) callback(err);
147
- return;
148
- }
149
- fs.fchmod(fd, mode, function(err) {
150
- fs.close(fd, function(err2) {
151
- if (callback) callback(err || err2);
152
- });
153
- });
154
- });
155
- };
156
- fs.lchmodSync = function(path, mode) {
157
- var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode);
158
- var threw = true;
159
- var ret;
160
- try {
161
- ret = fs.fchmodSync(fd, mode);
162
- threw = false;
163
- } finally {
164
- if (threw) try {
165
- fs.closeSync(fd);
166
- } catch (er) {}
167
- else fs.closeSync(fd);
168
- }
169
- return ret;
170
- };
171
- }
172
- function patchLutimes(fs) {
173
- if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) {
174
- fs.lutimes = function(path, at, mt, cb) {
175
- fs.open(path, constants.O_SYMLINK, function(er, fd) {
176
- if (er) {
177
- if (cb) cb(er);
178
- return;
179
- }
180
- fs.futimes(fd, at, mt, function(er) {
181
- fs.close(fd, function(er2) {
182
- if (cb) cb(er || er2);
183
- });
184
- });
185
- });
186
- };
187
- fs.lutimesSync = function(path, at, mt) {
188
- var fd = fs.openSync(path, constants.O_SYMLINK);
189
- var ret;
190
- var threw = true;
191
- try {
192
- ret = fs.futimesSync(fd, at, mt);
193
- threw = false;
194
- } finally {
195
- if (threw) try {
196
- fs.closeSync(fd);
197
- } catch (er) {}
198
- else fs.closeSync(fd);
199
- }
200
- return ret;
201
- };
202
- } else if (fs.futimes) {
203
- fs.lutimes = function(_a, _b, _c, cb) {
204
- if (cb) process.nextTick(cb);
205
- };
206
- fs.lutimesSync = function() {};
207
- }
208
- }
209
- function chmodFix(orig) {
210
- if (!orig) return orig;
211
- return function(target, mode, cb) {
212
- return orig.call(fs, target, mode, function(er) {
213
- if (chownErOk(er)) er = null;
214
- if (cb) cb.apply(this, arguments);
215
- });
216
- };
217
- }
218
- function chmodFixSync(orig) {
219
- if (!orig) return orig;
220
- return function(target, mode) {
221
- try {
222
- return orig.call(fs, target, mode);
223
- } catch (er) {
224
- if (!chownErOk(er)) throw er;
225
- }
226
- };
227
- }
228
- function chownFix(orig) {
229
- if (!orig) return orig;
230
- return function(target, uid, gid, cb) {
231
- return orig.call(fs, target, uid, gid, function(er) {
232
- if (chownErOk(er)) er = null;
233
- if (cb) cb.apply(this, arguments);
234
- });
235
- };
236
- }
237
- function chownFixSync(orig) {
238
- if (!orig) return orig;
239
- return function(target, uid, gid) {
240
- try {
241
- return orig.call(fs, target, uid, gid);
242
- } catch (er) {
243
- if (!chownErOk(er)) throw er;
244
- }
245
- };
246
- }
247
- function statFix(orig) {
248
- if (!orig) return orig;
249
- return function(target, options, cb) {
250
- if (typeof options === "function") {
251
- cb = options;
252
- options = null;
253
- }
254
- function callback(er, stats) {
255
- if (stats) {
256
- if (stats.uid < 0) stats.uid += 4294967296;
257
- if (stats.gid < 0) stats.gid += 4294967296;
258
- }
259
- if (cb) cb.apply(this, arguments);
260
- }
261
- return options ? orig.call(fs, target, options, callback) : orig.call(fs, target, callback);
262
- };
263
- }
264
- function statFixSync(orig) {
265
- if (!orig) return orig;
266
- return function(target, options) {
267
- var stats = options ? orig.call(fs, target, options) : orig.call(fs, target);
268
- if (stats) {
269
- if (stats.uid < 0) stats.uid += 4294967296;
270
- if (stats.gid < 0) stats.gid += 4294967296;
271
- }
272
- return stats;
273
- };
274
- }
275
- function chownErOk(er) {
276
- if (!er) return true;
277
- if (er.code === "ENOSYS") return true;
278
- if (!process.getuid || process.getuid() !== 0) {
279
- if (er.code === "EINVAL" || er.code === "EPERM") return true;
280
- }
281
- return false;
282
- }
283
- }
284
- }));
285
- //#endregion
286
- //#region node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
287
- var require_legacy_streams = /* @__PURE__ */ __commonJSMin(((exports, module) => {
288
- var Stream = __require("stream").Stream;
289
- module.exports = legacy;
290
- function legacy(fs) {
291
- return {
292
- ReadStream,
293
- WriteStream
294
- };
295
- function ReadStream(path, options) {
296
- if (!(this instanceof ReadStream)) return new ReadStream(path, options);
297
- Stream.call(this);
298
- var self = this;
299
- this.path = path;
300
- this.fd = null;
301
- this.readable = true;
302
- this.paused = false;
303
- this.flags = "r";
304
- this.mode = 438;
305
- this.bufferSize = 64 * 1024;
306
- options = options || {};
307
- var keys = Object.keys(options);
308
- for (var index = 0, length = keys.length; index < length; index++) {
309
- var key = keys[index];
310
- this[key] = options[key];
311
- }
312
- if (this.encoding) this.setEncoding(this.encoding);
313
- if (this.start !== void 0) {
314
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
315
- if (this.end === void 0) this.end = Infinity;
316
- else if ("number" !== typeof this.end) throw TypeError("end must be a Number");
317
- if (this.start > this.end) throw new Error("start must be <= end");
318
- this.pos = this.start;
319
- }
320
- if (this.fd !== null) {
321
- process.nextTick(function() {
322
- self._read();
323
- });
324
- return;
325
- }
326
- fs.open(this.path, this.flags, this.mode, function(err, fd) {
327
- if (err) {
328
- self.emit("error", err);
329
- self.readable = false;
330
- return;
331
- }
332
- self.fd = fd;
333
- self.emit("open", fd);
334
- self._read();
335
- });
336
- }
337
- function WriteStream(path, options) {
338
- if (!(this instanceof WriteStream)) return new WriteStream(path, options);
339
- Stream.call(this);
340
- this.path = path;
341
- this.fd = null;
342
- this.writable = true;
343
- this.flags = "w";
344
- this.encoding = "binary";
345
- this.mode = 438;
346
- this.bytesWritten = 0;
347
- options = options || {};
348
- var keys = Object.keys(options);
349
- for (var index = 0, length = keys.length; index < length; index++) {
350
- var key = keys[index];
351
- this[key] = options[key];
352
- }
353
- if (this.start !== void 0) {
354
- if ("number" !== typeof this.start) throw TypeError("start must be a Number");
355
- if (this.start < 0) throw new Error("start must be >= zero");
356
- this.pos = this.start;
357
- }
358
- this.busy = false;
359
- this._queue = [];
360
- if (this.fd === null) {
361
- this._open = fs.open;
362
- this._queue.push([
363
- this._open,
364
- this.path,
365
- this.flags,
366
- this.mode,
367
- void 0
368
- ]);
369
- this.flush();
370
- }
371
- }
372
- }
373
- }));
374
- //#endregion
375
- //#region node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
376
- var require_clone = /* @__PURE__ */ __commonJSMin(((exports, module) => {
377
- module.exports = clone;
378
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
379
- return obj.__proto__;
380
- };
381
- function clone(obj) {
382
- if (obj === null || typeof obj !== "object") return obj;
383
- if (obj instanceof Object) var copy = { __proto__: getPrototypeOf(obj) };
384
- else var copy = Object.create(null);
385
- Object.getOwnPropertyNames(obj).forEach(function(key) {
386
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
387
- });
388
- return copy;
389
- }
390
- }));
391
- //#endregion
392
- //#region node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
393
- var require_graceful_fs = /* @__PURE__ */ __commonJSMin(((exports, module) => {
394
- var fs = __require("fs");
395
- var polyfills = require_polyfills();
396
- var legacy = require_legacy_streams();
397
- var clone = require_clone();
398
- var util = __require("util");
399
- /* istanbul ignore next - node 0.x polyfill */
400
- var gracefulQueue;
401
- var previousSymbol;
402
- /* istanbul ignore else - node 0.x polyfill */
403
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
404
- gracefulQueue = Symbol.for("graceful-fs.queue");
405
- previousSymbol = Symbol.for("graceful-fs.previous");
406
- } else {
407
- gracefulQueue = "___graceful-fs.queue";
408
- previousSymbol = "___graceful-fs.previous";
409
- }
410
- function noop() {}
411
- function publishQueue(context, queue) {
412
- Object.defineProperty(context, gracefulQueue, { get: function() {
413
- return queue;
414
- } });
415
- }
416
- var debug = noop;
417
- if (util.debuglog) debug = util.debuglog("gfs4");
418
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) debug = function() {
419
- var m = util.format.apply(util, arguments);
420
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
421
- console.error(m);
422
- };
423
- if (!fs[gracefulQueue]) {
424
- publishQueue(fs, global[gracefulQueue] || []);
425
- fs.close = (function(fs$close) {
426
- function close(fd, cb) {
427
- return fs$close.call(fs, fd, function(err) {
428
- if (!err) resetQueue();
429
- if (typeof cb === "function") cb.apply(this, arguments);
430
- });
431
- }
432
- Object.defineProperty(close, previousSymbol, { value: fs$close });
433
- return close;
434
- })(fs.close);
435
- fs.closeSync = (function(fs$closeSync) {
436
- function closeSync(fd) {
437
- fs$closeSync.apply(fs, arguments);
438
- resetQueue();
439
- }
440
- Object.defineProperty(closeSync, previousSymbol, { value: fs$closeSync });
441
- return closeSync;
442
- })(fs.closeSync);
443
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) process.on("exit", function() {
444
- debug(fs[gracefulQueue]);
445
- __require("assert").equal(fs[gracefulQueue].length, 0);
446
- });
447
- }
448
- if (!global[gracefulQueue]) publishQueue(global, fs[gracefulQueue]);
449
- module.exports = patch(clone(fs));
450
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {
451
- module.exports = patch(fs);
452
- fs.__patched = true;
453
- }
454
- function patch(fs) {
455
- polyfills(fs);
456
- fs.gracefulify = patch;
457
- fs.createReadStream = createReadStream;
458
- fs.createWriteStream = createWriteStream;
459
- var fs$readFile = fs.readFile;
460
- fs.readFile = readFile;
461
- function readFile(path, options, cb) {
462
- if (typeof options === "function") cb = options, options = null;
463
- return go$readFile(path, options, cb);
464
- function go$readFile(path, options, cb, startTime) {
465
- return fs$readFile(path, options, function(err) {
466
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
467
- go$readFile,
468
- [
469
- path,
470
- options,
471
- cb
472
- ],
473
- err,
474
- startTime || Date.now(),
475
- Date.now()
476
- ]);
477
- else if (typeof cb === "function") cb.apply(this, arguments);
478
- });
479
- }
480
- }
481
- var fs$writeFile = fs.writeFile;
482
- fs.writeFile = writeFile;
483
- function writeFile(path, data, options, cb) {
484
- if (typeof options === "function") cb = options, options = null;
485
- return go$writeFile(path, data, options, cb);
486
- function go$writeFile(path, data, options, cb, startTime) {
487
- return fs$writeFile(path, data, options, function(err) {
488
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
489
- go$writeFile,
490
- [
491
- path,
492
- data,
493
- options,
494
- cb
495
- ],
496
- err,
497
- startTime || Date.now(),
498
- Date.now()
499
- ]);
500
- else if (typeof cb === "function") cb.apply(this, arguments);
501
- });
502
- }
503
- }
504
- var fs$appendFile = fs.appendFile;
505
- if (fs$appendFile) fs.appendFile = appendFile;
506
- function appendFile(path, data, options, cb) {
507
- if (typeof options === "function") cb = options, options = null;
508
- return go$appendFile(path, data, options, cb);
509
- function go$appendFile(path, data, options, cb, startTime) {
510
- return fs$appendFile(path, data, options, function(err) {
511
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
512
- go$appendFile,
513
- [
514
- path,
515
- data,
516
- options,
517
- cb
518
- ],
519
- err,
520
- startTime || Date.now(),
521
- Date.now()
522
- ]);
523
- else if (typeof cb === "function") cb.apply(this, arguments);
524
- });
525
- }
526
- }
527
- var fs$copyFile = fs.copyFile;
528
- if (fs$copyFile) fs.copyFile = copyFile;
529
- function copyFile(src, dest, flags, cb) {
530
- if (typeof flags === "function") {
531
- cb = flags;
532
- flags = 0;
533
- }
534
- return go$copyFile(src, dest, flags, cb);
535
- function go$copyFile(src, dest, flags, cb, startTime) {
536
- return fs$copyFile(src, dest, flags, function(err) {
537
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
538
- go$copyFile,
539
- [
540
- src,
541
- dest,
542
- flags,
543
- cb
544
- ],
545
- err,
546
- startTime || Date.now(),
547
- Date.now()
548
- ]);
549
- else if (typeof cb === "function") cb.apply(this, arguments);
550
- });
551
- }
552
- }
553
- var fs$readdir = fs.readdir;
554
- fs.readdir = readdir;
555
- var noReaddirOptionVersions = /^v[0-5]\./;
556
- function readdir(path, options, cb) {
557
- if (typeof options === "function") cb = options, options = null;
558
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir(path, options, cb, startTime) {
559
- return fs$readdir(path, fs$readdirCallback(path, options, cb, startTime));
560
- } : function go$readdir(path, options, cb, startTime) {
561
- return fs$readdir(path, options, fs$readdirCallback(path, options, cb, startTime));
562
- };
563
- return go$readdir(path, options, cb);
564
- function fs$readdirCallback(path, options, cb, startTime) {
565
- return function(err, files) {
566
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
567
- go$readdir,
568
- [
569
- path,
570
- options,
571
- cb
572
- ],
573
- err,
574
- startTime || Date.now(),
575
- Date.now()
576
- ]);
577
- else {
578
- if (files && files.sort) files.sort();
579
- if (typeof cb === "function") cb.call(this, err, files);
580
- }
581
- };
582
- }
583
- }
584
- if (process.version.substr(0, 4) === "v0.8") {
585
- var legStreams = legacy(fs);
586
- ReadStream = legStreams.ReadStream;
587
- WriteStream = legStreams.WriteStream;
588
- }
589
- var fs$ReadStream = fs.ReadStream;
590
- if (fs$ReadStream) {
591
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
592
- ReadStream.prototype.open = ReadStream$open;
593
- }
594
- var fs$WriteStream = fs.WriteStream;
595
- if (fs$WriteStream) {
596
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
597
- WriteStream.prototype.open = WriteStream$open;
598
- }
599
- Object.defineProperty(fs, "ReadStream", {
600
- get: function() {
601
- return ReadStream;
602
- },
603
- set: function(val) {
604
- ReadStream = val;
605
- },
606
- enumerable: true,
607
- configurable: true
608
- });
609
- Object.defineProperty(fs, "WriteStream", {
610
- get: function() {
611
- return WriteStream;
612
- },
613
- set: function(val) {
614
- WriteStream = val;
615
- },
616
- enumerable: true,
617
- configurable: true
618
- });
619
- var FileReadStream = ReadStream;
620
- Object.defineProperty(fs, "FileReadStream", {
621
- get: function() {
622
- return FileReadStream;
623
- },
624
- set: function(val) {
625
- FileReadStream = val;
626
- },
627
- enumerable: true,
628
- configurable: true
629
- });
630
- var FileWriteStream = WriteStream;
631
- Object.defineProperty(fs, "FileWriteStream", {
632
- get: function() {
633
- return FileWriteStream;
634
- },
635
- set: function(val) {
636
- FileWriteStream = val;
637
- },
638
- enumerable: true,
639
- configurable: true
640
- });
641
- function ReadStream(path, options) {
642
- if (this instanceof ReadStream) return fs$ReadStream.apply(this, arguments), this;
643
- else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
644
- }
645
- function ReadStream$open() {
646
- var that = this;
647
- open(that.path, that.flags, that.mode, function(err, fd) {
648
- if (err) {
649
- if (that.autoClose) that.destroy();
650
- that.emit("error", err);
651
- } else {
652
- that.fd = fd;
653
- that.emit("open", fd);
654
- that.read();
655
- }
656
- });
657
- }
658
- function WriteStream(path, options) {
659
- if (this instanceof WriteStream) return fs$WriteStream.apply(this, arguments), this;
660
- else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
661
- }
662
- function WriteStream$open() {
663
- var that = this;
664
- open(that.path, that.flags, that.mode, function(err, fd) {
665
- if (err) {
666
- that.destroy();
667
- that.emit("error", err);
668
- } else {
669
- that.fd = fd;
670
- that.emit("open", fd);
671
- }
672
- });
673
- }
674
- function createReadStream(path, options) {
675
- return new fs.ReadStream(path, options);
676
- }
677
- function createWriteStream(path, options) {
678
- return new fs.WriteStream(path, options);
679
- }
680
- var fs$open = fs.open;
681
- fs.open = open;
682
- function open(path, flags, mode, cb) {
683
- if (typeof mode === "function") cb = mode, mode = null;
684
- return go$open(path, flags, mode, cb);
685
- function go$open(path, flags, mode, cb, startTime) {
686
- return fs$open(path, flags, mode, function(err, fd) {
687
- if (err && (err.code === "EMFILE" || err.code === "ENFILE")) enqueue([
688
- go$open,
689
- [
690
- path,
691
- flags,
692
- mode,
693
- cb
694
- ],
695
- err,
696
- startTime || Date.now(),
697
- Date.now()
698
- ]);
699
- else if (typeof cb === "function") cb.apply(this, arguments);
700
- });
701
- }
702
- }
703
- return fs;
704
- }
705
- function enqueue(elem) {
706
- debug("ENQUEUE", elem[0].name, elem[1]);
707
- fs[gracefulQueue].push(elem);
708
- retry();
709
- }
710
- var retryTimer;
711
- function resetQueue() {
712
- var now = Date.now();
713
- for (var i = 0; i < fs[gracefulQueue].length; ++i) if (fs[gracefulQueue][i].length > 2) {
714
- fs[gracefulQueue][i][3] = now;
715
- fs[gracefulQueue][i][4] = now;
716
- }
717
- retry();
718
- }
719
- function retry() {
720
- clearTimeout(retryTimer);
721
- retryTimer = void 0;
722
- if (fs[gracefulQueue].length === 0) return;
723
- var elem = fs[gracefulQueue].shift();
724
- var fn = elem[0];
725
- var args = elem[1];
726
- var err = elem[2];
727
- var startTime = elem[3];
728
- var lastTime = elem[4];
729
- if (startTime === void 0) {
730
- debug("RETRY", fn.name, args);
731
- fn.apply(null, args);
732
- } else if (Date.now() - startTime >= 6e4) {
733
- debug("TIMEOUT", fn.name, args);
734
- var cb = args.pop();
735
- if (typeof cb === "function") cb.call(null, err);
736
- } else {
737
- var sinceAttempt = Date.now() - lastTime;
738
- var sinceStart = Math.max(lastTime - startTime, 1);
739
- if (sinceAttempt >= Math.min(sinceStart * 1.2, 100)) {
740
- debug("RETRY", fn.name, args);
741
- fn.apply(null, args.concat([startTime]));
742
- } else fs[gracefulQueue].push(elem);
743
- }
744
- if (retryTimer === void 0) retryTimer = setTimeout(retry, 0);
745
- }
746
- }));
747
- //#endregion
748
- //#region node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry_operation.js
749
- var require_retry_operation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
750
- function RetryOperation(timeouts, options) {
751
- if (typeof options === "boolean") options = { forever: options };
752
- this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
753
- this._timeouts = timeouts;
754
- this._options = options || {};
755
- this._maxRetryTime = options && options.maxRetryTime || Infinity;
756
- this._fn = null;
757
- this._errors = [];
758
- this._attempts = 1;
759
- this._operationTimeout = null;
760
- this._operationTimeoutCb = null;
761
- this._timeout = null;
762
- this._operationStart = null;
763
- if (this._options.forever) this._cachedTimeouts = this._timeouts.slice(0);
764
- }
765
- module.exports = RetryOperation;
766
- RetryOperation.prototype.reset = function() {
767
- this._attempts = 1;
768
- this._timeouts = this._originalTimeouts;
769
- };
770
- RetryOperation.prototype.stop = function() {
771
- if (this._timeout) clearTimeout(this._timeout);
772
- this._timeouts = [];
773
- this._cachedTimeouts = null;
774
- };
775
- RetryOperation.prototype.retry = function(err) {
776
- if (this._timeout) clearTimeout(this._timeout);
777
- if (!err) return false;
778
- var currentTime = (/* @__PURE__ */ new Date()).getTime();
779
- if (err && currentTime - this._operationStart >= this._maxRetryTime) {
780
- this._errors.unshift(/* @__PURE__ */ new Error("RetryOperation timeout occurred"));
781
- return false;
782
- }
783
- this._errors.push(err);
784
- var timeout = this._timeouts.shift();
785
- if (timeout === void 0) if (this._cachedTimeouts) {
786
- this._errors.splice(this._errors.length - 1, this._errors.length);
787
- this._timeouts = this._cachedTimeouts.slice(0);
788
- timeout = this._timeouts.shift();
789
- } else return false;
790
- var self = this;
791
- var timer = setTimeout(function() {
792
- self._attempts++;
793
- if (self._operationTimeoutCb) {
794
- self._timeout = setTimeout(function() {
795
- self._operationTimeoutCb(self._attempts);
796
- }, self._operationTimeout);
797
- if (self._options.unref) self._timeout.unref();
798
- }
799
- self._fn(self._attempts);
800
- }, timeout);
801
- if (this._options.unref) timer.unref();
802
- return true;
803
- };
804
- RetryOperation.prototype.attempt = function(fn, timeoutOps) {
805
- this._fn = fn;
806
- if (timeoutOps) {
807
- if (timeoutOps.timeout) this._operationTimeout = timeoutOps.timeout;
808
- if (timeoutOps.cb) this._operationTimeoutCb = timeoutOps.cb;
809
- }
810
- var self = this;
811
- if (this._operationTimeoutCb) this._timeout = setTimeout(function() {
812
- self._operationTimeoutCb();
813
- }, self._operationTimeout);
814
- this._operationStart = (/* @__PURE__ */ new Date()).getTime();
815
- this._fn(this._attempts);
816
- };
817
- RetryOperation.prototype.try = function(fn) {
818
- console.log("Using RetryOperation.try() is deprecated");
819
- this.attempt(fn);
820
- };
821
- RetryOperation.prototype.start = function(fn) {
822
- console.log("Using RetryOperation.start() is deprecated");
823
- this.attempt(fn);
824
- };
825
- RetryOperation.prototype.start = RetryOperation.prototype.try;
826
- RetryOperation.prototype.errors = function() {
827
- return this._errors;
828
- };
829
- RetryOperation.prototype.attempts = function() {
830
- return this._attempts;
831
- };
832
- RetryOperation.prototype.mainError = function() {
833
- if (this._errors.length === 0) return null;
834
- var counts = {};
835
- var mainError = null;
836
- var mainErrorCount = 0;
837
- for (var i = 0; i < this._errors.length; i++) {
838
- var error = this._errors[i];
839
- var message = error.message;
840
- var count = (counts[message] || 0) + 1;
841
- counts[message] = count;
842
- if (count >= mainErrorCount) {
843
- mainError = error;
844
- mainErrorCount = count;
845
- }
846
- }
847
- return mainError;
848
- };
849
- }));
850
- //#endregion
851
- //#region node_modules/.pnpm/retry@0.12.0/node_modules/retry/lib/retry.js
852
- var require_retry$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
853
- var RetryOperation = require_retry_operation();
854
- exports.operation = function(options) {
855
- return new RetryOperation(exports.timeouts(options), {
856
- forever: options && options.forever,
857
- unref: options && options.unref,
858
- maxRetryTime: options && options.maxRetryTime
859
- });
860
- };
861
- exports.timeouts = function(options) {
862
- if (options instanceof Array) return [].concat(options);
863
- var opts = {
864
- retries: 10,
865
- factor: 2,
866
- minTimeout: 1 * 1e3,
867
- maxTimeout: Infinity,
868
- randomize: false
869
- };
870
- for (var key in options) opts[key] = options[key];
871
- if (opts.minTimeout > opts.maxTimeout) throw new Error("minTimeout is greater than maxTimeout");
872
- var timeouts = [];
873
- for (var i = 0; i < opts.retries; i++) timeouts.push(this.createTimeout(i, opts));
874
- if (options && options.forever && !timeouts.length) timeouts.push(this.createTimeout(i, opts));
875
- timeouts.sort(function(a, b) {
876
- return a - b;
877
- });
878
- return timeouts;
879
- };
880
- exports.createTimeout = function(attempt, opts) {
881
- var random = opts.randomize ? Math.random() + 1 : 1;
882
- var timeout = Math.round(random * opts.minTimeout * Math.pow(opts.factor, attempt));
883
- timeout = Math.min(timeout, opts.maxTimeout);
884
- return timeout;
885
- };
886
- exports.wrap = function(obj, options, methods) {
887
- if (options instanceof Array) {
888
- methods = options;
889
- options = null;
890
- }
891
- if (!methods) {
892
- methods = [];
893
- for (var key in obj) if (typeof obj[key] === "function") methods.push(key);
894
- }
895
- for (var i = 0; i < methods.length; i++) {
896
- var method = methods[i];
897
- var original = obj[method];
898
- obj[method] = function retryWrapper(original) {
899
- var op = exports.operation(options);
900
- var args = Array.prototype.slice.call(arguments, 1);
901
- var callback = args.pop();
902
- args.push(function(err) {
903
- if (op.retry(err)) return;
904
- if (err) arguments[0] = op.mainError();
905
- callback.apply(this, arguments);
906
- });
907
- op.attempt(function() {
908
- original.apply(obj, args);
909
- });
910
- }.bind(obj, original);
911
- obj[method].options = options;
912
- }
913
- };
914
- }));
915
- //#endregion
916
- //#region node_modules/.pnpm/retry@0.12.0/node_modules/retry/index.js
917
- var require_retry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
918
- module.exports = require_retry$1();
919
- }));
920
- //#endregion
921
- //#region node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/signals.js
922
- var require_signals = /* @__PURE__ */ __commonJSMin(((exports, module) => {
923
- module.exports = [
924
- "SIGABRT",
925
- "SIGALRM",
926
- "SIGHUP",
927
- "SIGINT",
928
- "SIGTERM"
929
- ];
930
- if (process.platform !== "win32") module.exports.push("SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
931
- if (process.platform === "linux") module.exports.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT", "SIGUNUSED");
932
- }));
933
- //#endregion
934
- //#region node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js
935
- var require_signal_exit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
936
- var process = global.process;
937
- const processOk = function(process) {
938
- return process && typeof process === "object" && typeof process.removeListener === "function" && typeof process.emit === "function" && typeof process.reallyExit === "function" && typeof process.listeners === "function" && typeof process.kill === "function" && typeof process.pid === "number" && typeof process.on === "function";
939
- };
940
- /* istanbul ignore if */
941
- if (!processOk(process)) module.exports = function() {
942
- return function() {};
943
- };
944
- else {
945
- var assert = __require("assert");
946
- var signals = require_signals();
947
- var isWin = /^win/i.test(process.platform);
948
- var EE = __require("events");
949
- /* istanbul ignore if */
950
- if (typeof EE !== "function") EE = EE.EventEmitter;
951
- var emitter;
952
- if (process.__signal_exit_emitter__) emitter = process.__signal_exit_emitter__;
953
- else {
954
- emitter = process.__signal_exit_emitter__ = new EE();
955
- emitter.count = 0;
956
- emitter.emitted = {};
957
- }
958
- if (!emitter.infinite) {
959
- emitter.setMaxListeners(Infinity);
960
- emitter.infinite = true;
961
- }
962
- module.exports = function(cb, opts) {
963
- /* istanbul ignore if */
964
- if (!processOk(global.process)) return function() {};
965
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
966
- if (loaded === false) load();
967
- var ev = "exit";
968
- if (opts && opts.alwaysLast) ev = "afterexit";
969
- var remove = function() {
970
- emitter.removeListener(ev, cb);
971
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) unload();
972
- };
973
- emitter.on(ev, cb);
974
- return remove;
975
- };
976
- var unload = function unload() {
977
- if (!loaded || !processOk(global.process)) return;
978
- loaded = false;
979
- signals.forEach(function(sig) {
980
- try {
981
- process.removeListener(sig, sigListeners[sig]);
982
- } catch (er) {}
983
- });
984
- process.emit = originalProcessEmit;
985
- process.reallyExit = originalProcessReallyExit;
986
- emitter.count -= 1;
987
- };
988
- module.exports.unload = unload;
989
- var emit = function emit(event, code, signal) {
990
- /* istanbul ignore if */
991
- if (emitter.emitted[event]) return;
992
- emitter.emitted[event] = true;
993
- emitter.emit(event, code, signal);
994
- };
995
- var sigListeners = {};
996
- signals.forEach(function(sig) {
997
- sigListeners[sig] = function listener() {
998
- /* istanbul ignore if */
999
- if (!processOk(global.process)) return;
1000
- if (process.listeners(sig).length === emitter.count) {
1001
- unload();
1002
- emit("exit", null, sig);
1003
- /* istanbul ignore next */
1004
- emit("afterexit", null, sig);
1005
- /* istanbul ignore next */
1006
- if (isWin && sig === "SIGHUP") sig = "SIGINT";
1007
- /* istanbul ignore next */
1008
- process.kill(process.pid, sig);
1009
- }
1010
- };
1011
- });
1012
- module.exports.signals = function() {
1013
- return signals;
1014
- };
1015
- var loaded = false;
1016
- var load = function load() {
1017
- if (loaded || !processOk(global.process)) return;
1018
- loaded = true;
1019
- emitter.count += 1;
1020
- signals = signals.filter(function(sig) {
1021
- try {
1022
- process.on(sig, sigListeners[sig]);
1023
- return true;
1024
- } catch (er) {
1025
- return false;
1026
- }
1027
- });
1028
- process.emit = processEmit;
1029
- process.reallyExit = processReallyExit;
1030
- };
1031
- module.exports.load = load;
1032
- var originalProcessReallyExit = process.reallyExit;
1033
- var processReallyExit = function processReallyExit(code) {
1034
- /* istanbul ignore if */
1035
- if (!processOk(global.process)) return;
1036
- process.exitCode = code || 0;
1037
- emit("exit", process.exitCode, null);
1038
- /* istanbul ignore next */
1039
- emit("afterexit", process.exitCode, null);
1040
- /* istanbul ignore next */
1041
- originalProcessReallyExit.call(process, process.exitCode);
1042
- };
1043
- var originalProcessEmit = process.emit;
1044
- var processEmit = function processEmit(ev, arg) {
1045
- if (ev === "exit" && processOk(global.process)) {
1046
- /* istanbul ignore else */
1047
- if (arg !== void 0) process.exitCode = arg;
1048
- var ret = originalProcessEmit.apply(this, arguments);
1049
- /* istanbul ignore next */
1050
- emit("exit", process.exitCode, null);
1051
- /* istanbul ignore next */
1052
- emit("afterexit", process.exitCode, null);
1053
- /* istanbul ignore next */
1054
- return ret;
1055
- } else return originalProcessEmit.apply(this, arguments);
1056
- };
1057
- }
1058
- }));
1059
- //#endregion
1060
- //#region node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js
1061
- var require_mtime_precision = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1062
- const cacheSymbol = Symbol();
1063
- function probe(file, fs, callback) {
1064
- const cachedPrecision = fs[cacheSymbol];
1065
- if (cachedPrecision) return fs.stat(file, (err, stat) => {
1066
- /* istanbul ignore if */
1067
- if (err) return callback(err);
1068
- callback(null, stat.mtime, cachedPrecision);
1069
- });
1070
- const mtime = /* @__PURE__ */ new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
1071
- fs.utimes(file, mtime, mtime, (err) => {
1072
- /* istanbul ignore if */
1073
- if (err) return callback(err);
1074
- fs.stat(file, (err, stat) => {
1075
- /* istanbul ignore if */
1076
- if (err) return callback(err);
1077
- const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1078
- Object.defineProperty(fs, cacheSymbol, { value: precision });
1079
- callback(null, stat.mtime, precision);
1080
- });
1081
- });
1082
- }
1083
- function getMtime(precision) {
1084
- let now = Date.now();
1085
- if (precision === "s") now = Math.ceil(now / 1e3) * 1e3;
1086
- return new Date(now);
1087
- }
1088
- module.exports.probe = probe;
1089
- module.exports.getMtime = getMtime;
1090
- }));
1091
- //#endregion
1092
- //#region node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js
1093
- var require_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1094
- const path = __require("path");
1095
- const fs = require_graceful_fs();
1096
- const retry = require_retry();
1097
- const onExit = require_signal_exit();
1098
- const mtimePrecision = require_mtime_precision();
1099
- const locks = {};
1100
- function getLockFile(file, options) {
1101
- return options.lockfilePath || `${file}.lock`;
1102
- }
1103
- function resolveCanonicalPath(file, options, callback) {
1104
- if (!options.realpath) return callback(null, path.resolve(file));
1105
- options.fs.realpath(file, callback);
1106
- }
1107
- function acquireLock(file, options, callback) {
1108
- const lockfilePath = getLockFile(file, options);
1109
- options.fs.mkdir(lockfilePath, (err) => {
1110
- if (!err) return mtimePrecision.probe(lockfilePath, options.fs, (err, mtime, mtimePrecision) => {
1111
- /* istanbul ignore if */
1112
- if (err) {
1113
- options.fs.rmdir(lockfilePath, () => {});
1114
- return callback(err);
1115
- }
1116
- callback(null, mtime, mtimePrecision);
1117
- });
1118
- if (err.code !== "EEXIST") return callback(err);
1119
- if (options.stale <= 0) return callback(Object.assign(/* @__PURE__ */ new Error("Lock file is already being held"), {
1120
- code: "ELOCKED",
1121
- file
1122
- }));
1123
- options.fs.stat(lockfilePath, (err, stat) => {
1124
- if (err) {
1125
- if (err.code === "ENOENT") return acquireLock(file, {
1126
- ...options,
1127
- stale: 0
1128
- }, callback);
1129
- return callback(err);
1130
- }
1131
- if (!isLockStale(stat, options)) return callback(Object.assign(/* @__PURE__ */ new Error("Lock file is already being held"), {
1132
- code: "ELOCKED",
1133
- file
1134
- }));
1135
- removeLock(file, options, (err) => {
1136
- if (err) return callback(err);
1137
- acquireLock(file, {
1138
- ...options,
1139
- stale: 0
1140
- }, callback);
1141
- });
1142
- });
1143
- });
1144
- }
1145
- function isLockStale(stat, options) {
1146
- return stat.mtime.getTime() < Date.now() - options.stale;
1147
- }
1148
- function removeLock(file, options, callback) {
1149
- options.fs.rmdir(getLockFile(file, options), (err) => {
1150
- if (err && err.code !== "ENOENT") return callback(err);
1151
- callback();
1152
- });
1153
- }
1154
- function updateLock(file, options) {
1155
- const lock = locks[file];
1156
- /* istanbul ignore if */
1157
- if (lock.updateTimeout) return;
1158
- lock.updateDelay = lock.updateDelay || options.update;
1159
- lock.updateTimeout = setTimeout(() => {
1160
- lock.updateTimeout = null;
1161
- options.fs.stat(lock.lockfilePath, (err, stat) => {
1162
- const isOverThreshold = lock.lastUpdate + options.stale < Date.now();
1163
- if (err) {
1164
- if (err.code === "ENOENT" || isOverThreshold) return setLockAsCompromised(file, lock, Object.assign(err, { code: "ECOMPROMISED" }));
1165
- lock.updateDelay = 1e3;
1166
- return updateLock(file, options);
1167
- }
1168
- if (!(lock.mtime.getTime() === stat.mtime.getTime())) return setLockAsCompromised(file, lock, Object.assign(/* @__PURE__ */ new Error("Unable to update lock within the stale threshold"), { code: "ECOMPROMISED" }));
1169
- const mtime = mtimePrecision.getMtime(lock.mtimePrecision);
1170
- options.fs.utimes(lock.lockfilePath, mtime, mtime, (err) => {
1171
- const isOverThreshold = lock.lastUpdate + options.stale < Date.now();
1172
- if (lock.released) return;
1173
- if (err) {
1174
- if (err.code === "ENOENT" || isOverThreshold) return setLockAsCompromised(file, lock, Object.assign(err, { code: "ECOMPROMISED" }));
1175
- lock.updateDelay = 1e3;
1176
- return updateLock(file, options);
1177
- }
1178
- lock.mtime = mtime;
1179
- lock.lastUpdate = Date.now();
1180
- lock.updateDelay = null;
1181
- updateLock(file, options);
1182
- });
1183
- });
1184
- }, lock.updateDelay);
1185
- /* istanbul ignore else */
1186
- if (lock.updateTimeout.unref) lock.updateTimeout.unref();
1187
- }
1188
- function setLockAsCompromised(file, lock, err) {
1189
- lock.released = true;
1190
- /* istanbul ignore if */
1191
- if (lock.updateTimeout) clearTimeout(lock.updateTimeout);
1192
- if (locks[file] === lock) delete locks[file];
1193
- lock.options.onCompromised(err);
1194
- }
1195
- function lock(file, options, callback) {
1196
- /* istanbul ignore next */
1197
- options = {
1198
- stale: 1e4,
1199
- update: null,
1200
- realpath: true,
1201
- retries: 0,
1202
- fs,
1203
- onCompromised: (err) => {
1204
- throw err;
1205
- },
1206
- ...options
1207
- };
1208
- options.retries = options.retries || 0;
1209
- options.retries = typeof options.retries === "number" ? { retries: options.retries } : options.retries;
1210
- options.stale = Math.max(options.stale || 0, 2e3);
1211
- options.update = options.update == null ? options.stale / 2 : options.update || 0;
1212
- options.update = Math.max(Math.min(options.update, options.stale / 2), 1e3);
1213
- resolveCanonicalPath(file, options, (err, file) => {
1214
- if (err) return callback(err);
1215
- const operation = retry.operation(options.retries);
1216
- operation.attempt(() => {
1217
- acquireLock(file, options, (err, mtime, mtimePrecision) => {
1218
- if (operation.retry(err)) return;
1219
- if (err) return callback(operation.mainError());
1220
- const lock = locks[file] = {
1221
- lockfilePath: getLockFile(file, options),
1222
- mtime,
1223
- mtimePrecision,
1224
- options,
1225
- lastUpdate: Date.now()
1226
- };
1227
- updateLock(file, options);
1228
- callback(null, (releasedCallback) => {
1229
- if (lock.released) return releasedCallback && releasedCallback(Object.assign(/* @__PURE__ */ new Error("Lock is already released"), { code: "ERELEASED" }));
1230
- unlock(file, {
1231
- ...options,
1232
- realpath: false
1233
- }, releasedCallback);
1234
- });
1235
- });
1236
- });
1237
- });
1238
- }
1239
- function unlock(file, options, callback) {
1240
- options = {
1241
- fs,
1242
- realpath: true,
1243
- ...options
1244
- };
1245
- resolveCanonicalPath(file, options, (err, file) => {
1246
- if (err) return callback(err);
1247
- const lock = locks[file];
1248
- if (!lock) return callback(Object.assign(/* @__PURE__ */ new Error("Lock is not acquired/owned by you"), { code: "ENOTACQUIRED" }));
1249
- lock.updateTimeout && clearTimeout(lock.updateTimeout);
1250
- lock.released = true;
1251
- delete locks[file];
1252
- removeLock(file, options, callback);
1253
- });
1254
- }
1255
- function check(file, options, callback) {
1256
- options = {
1257
- stale: 1e4,
1258
- realpath: true,
1259
- fs,
1260
- ...options
1261
- };
1262
- options.stale = Math.max(options.stale || 0, 2e3);
1263
- resolveCanonicalPath(file, options, (err, file) => {
1264
- if (err) return callback(err);
1265
- options.fs.stat(getLockFile(file, options), (err, stat) => {
1266
- if (err) return err.code === "ENOENT" ? callback(null, false) : callback(err);
1267
- return callback(null, !isLockStale(stat, options));
1268
- });
1269
- });
1270
- }
1271
- function getLocks() {
1272
- return locks;
1273
- }
1274
- /* istanbul ignore next */
1275
- onExit(() => {
1276
- for (const file in locks) {
1277
- const options = locks[file].options;
1278
- try {
1279
- options.fs.rmdirSync(getLockFile(file, options));
1280
- } catch (e) {}
1281
- }
1282
- });
1283
- module.exports.lock = lock;
1284
- module.exports.unlock = unlock;
1285
- module.exports.check = check;
1286
- module.exports.getLocks = getLocks;
1287
- }));
1288
- //#endregion
1289
- //#region node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js
1290
- var require_adapter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1291
- const fs = require_graceful_fs();
1292
- function createSyncFs(fs) {
1293
- const methods = [
1294
- "mkdir",
1295
- "realpath",
1296
- "stat",
1297
- "rmdir",
1298
- "utimes"
1299
- ];
1300
- const newFs = { ...fs };
1301
- methods.forEach((method) => {
1302
- newFs[method] = (...args) => {
1303
- const callback = args.pop();
1304
- let ret;
1305
- try {
1306
- ret = fs[`${method}Sync`](...args);
1307
- } catch (err) {
1308
- return callback(err);
1309
- }
1310
- callback(null, ret);
1311
- };
1312
- });
1313
- return newFs;
1314
- }
1315
- function toPromise(method) {
1316
- return (...args) => new Promise((resolve, reject) => {
1317
- args.push((err, result) => {
1318
- if (err) reject(err);
1319
- else resolve(result);
1320
- });
1321
- method(...args);
1322
- });
1323
- }
1324
- function toSync(method) {
1325
- return (...args) => {
1326
- let err;
1327
- let result;
1328
- args.push((_err, _result) => {
1329
- err = _err;
1330
- result = _result;
1331
- });
1332
- method(...args);
1333
- if (err) throw err;
1334
- return result;
1335
- };
1336
- }
1337
- function toSyncOptions(options) {
1338
- options = { ...options };
1339
- options.fs = createSyncFs(options.fs || fs);
1340
- if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) throw Object.assign(/* @__PURE__ */ new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
1341
- return options;
1342
- }
1343
- module.exports = {
1344
- toPromise,
1345
- toSync,
1346
- toSyncOptions
1347
- };
1348
- }));
1349
- //#endregion
1350
- //#region node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/index.js
1351
- var require_proper_lockfile = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1352
- const lockfile = require_lockfile();
1353
- const { toPromise, toSync, toSyncOptions } = require_adapter();
1354
- async function lock(file, options) {
1355
- return toPromise(await toPromise(lockfile.lock)(file, options));
1356
- }
1357
- function lockSync(file, options) {
1358
- return toSync(toSync(lockfile.lock)(file, toSyncOptions(options)));
1359
- }
1360
- function unlock(file, options) {
1361
- return toPromise(lockfile.unlock)(file, options);
1362
- }
1363
- function unlockSync(file, options) {
1364
- return toSync(lockfile.unlock)(file, toSyncOptions(options));
1365
- }
1366
- function check(file, options) {
1367
- return toPromise(lockfile.check)(file, options);
1368
- }
1369
- function checkSync(file, options) {
1370
- return toSync(lockfile.check)(file, toSyncOptions(options));
1371
- }
1372
- module.exports = lock;
1373
- module.exports.lock = lock;
1374
- module.exports.unlock = unlock;
1375
- module.exports.lockSync = lockSync;
1376
- module.exports.unlockSync = unlockSync;
1377
- module.exports.check = check;
1378
- module.exports.checkSync = checkSync;
1379
- }));
1380
- //#endregion
1381
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/guard/string.mjs
1382
- function IsBetween(value, min, max) {
1383
- return value >= min && value <= max;
1384
- }
1385
- function IsRegionalIndicator(value) {
1386
- return IsBetween(value, 127462, 127487);
1387
- }
1388
- function IsVariationSelector(value) {
1389
- return IsBetween(value, 65024, 65039);
1390
- }
1391
- function IsCombiningMark$1(value) {
1392
- return IsBetween(value, 768, 879) || IsBetween(value, 6832, 6911) || IsBetween(value, 7616, 7679) || IsBetween(value, 65056, 65071);
1393
- }
1394
- function CodePointLength(value) {
1395
- return value > 65535 ? 2 : 1;
1396
- }
1397
- function ConsumeModifiers(value, index) {
1398
- while (index < value.length) {
1399
- const point = value.codePointAt(index);
1400
- if (IsCombiningMark$1(point) || IsVariationSelector(point)) index += CodePointLength(point);
1401
- else break;
1402
- }
1403
- return index;
1404
- }
1405
- function NextGraphemeClusterIndex(value, clusterStart) {
1406
- const startCP = value.codePointAt(clusterStart);
1407
- let clusterEnd = clusterStart + CodePointLength(startCP);
1408
- clusterEnd = ConsumeModifiers(value, clusterEnd);
1409
- while (clusterEnd < value.length - 1 && value[clusterEnd] === "‍") {
1410
- const nextCP = value.codePointAt(clusterEnd + 1);
1411
- clusterEnd += 1 + CodePointLength(nextCP);
1412
- clusterEnd = ConsumeModifiers(value, clusterEnd);
1413
- }
1414
- if (IsRegionalIndicator(startCP) && clusterEnd < value.length && IsRegionalIndicator(value.codePointAt(clusterEnd))) clusterEnd += CodePointLength(value.codePointAt(clusterEnd));
1415
- return clusterEnd;
1416
- }
1417
- function IsGraphemeCodePoint(value) {
1418
- return IsBetween(value, 55296, 56319) || IsBetween(value, 768, 879) || value === 8205;
1419
- }
1420
- /** Checks if a string has at least a minimum number of grapheme clusters */
1421
- function IsMinLength$2(value, minLength) {
1422
- if (minLength === 0) return true;
1423
- let count = 0;
1424
- let index = 0;
1425
- while (index < value.length) {
1426
- index = NextGraphemeClusterIndex(value, index);
1427
- count++;
1428
- if (count >= minLength) return true;
1429
- }
1430
- return false;
1431
- }
1432
- /** Checks if a string has at most a maximum number of grapheme clusters */
1433
- function IsMaxLength$2(value, maxLength) {
1434
- let count = 0;
1435
- let index = 0;
1436
- while (index < value.length) {
1437
- index = NextGraphemeClusterIndex(value, index);
1438
- count++;
1439
- if (count > maxLength) return false;
1440
- }
1441
- return true;
1442
- }
1443
- /** Fast check for minimum grapheme length, falls back to full check if needed */
1444
- function IsMinLengthFast(value, minLength) {
1445
- if (minLength === 0) return true;
1446
- let index = 0;
1447
- while (index < value.length) {
1448
- if (IsGraphemeCodePoint(value.charCodeAt(index))) return IsMinLength$2(value, minLength);
1449
- index++;
1450
- if (index >= minLength) return true;
1451
- }
1452
- return false;
1453
- }
1454
- /** Fast check for maximum grapheme length, falls back to full check if needed */
1455
- function IsMaxLengthFast(value, maxLength) {
1456
- let index = 0;
1457
- while (index < value.length) {
1458
- if (IsGraphemeCodePoint(value.charCodeAt(index))) return IsMaxLength$2(value, maxLength);
1459
- index++;
1460
- if (index > maxLength) return false;
1461
- }
1462
- return true;
1463
- }
1464
- //#endregion
1465
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/guard/guard.mjs
1466
- /** Returns true if this value is an array */
1467
- function IsArray(value) {
1468
- return Array.isArray(value);
1469
- }
1470
- /** Returns true if this value is an async iterator */
1471
- function IsAsyncIterator(value) {
1472
- return IsObject(value) && Symbol.asyncIterator in value;
1473
- }
1474
- /** Returns true if this value is bigint */
1475
- function IsBigInt(value) {
1476
- return IsEqual(typeof value, "bigint");
1477
- }
1478
- /** Returns true if this value is a boolean */
1479
- function IsBoolean$1(value) {
1480
- return IsEqual(typeof value, "boolean");
1481
- }
1482
- /** Returns true if this value is a constructor */
1483
- function IsConstructor(value) {
1484
- if (IsUndefined(value) || !IsFunction(value)) return false;
1485
- const result = Function.prototype.toString.call(value);
1486
- if (/^class\s/.test(result)) return true;
1487
- if (/\[native code\]/.test(result)) return true;
1488
- return false;
1489
- }
1490
- /** Returns true if this value is a function */
1491
- function IsFunction(value) {
1492
- return IsEqual(typeof value, "function");
1493
- }
1494
- /** Returns true if this value is integer */
1495
- function IsInteger(value) {
1496
- return Number.isInteger(value);
1497
- }
1498
- /** Returns true if this value is an iterator */
1499
- function IsIterator(value) {
1500
- return IsObject(value) && Symbol.iterator in value;
1501
- }
1502
- /** Returns true if this value is null */
1503
- function IsNull(value) {
1504
- return IsEqual(value, null);
1505
- }
1506
- /** Returns true if this value is number */
1507
- function IsNumber$1(value) {
1508
- return Number.isFinite(value);
1509
- }
1510
- /** Returns true if this value is an object but not an array */
1511
- function IsObjectNotArray(value) {
1512
- return IsObject(value) && !IsArray(value);
1513
- }
1514
- /** Returns true if this value is an object */
1515
- function IsObject(value) {
1516
- return IsEqual(typeof value, "object") && !IsNull(value);
1517
- }
1518
- /** Returns true if this value is string */
1519
- function IsString$1(value) {
1520
- return IsEqual(typeof value, "string");
1521
- }
1522
- /** Returns true if this value is symbol */
1523
- function IsSymbol(value) {
1524
- return IsEqual(typeof value, "symbol");
1525
- }
1526
- /** Returns true if this value is undefined */
1527
- function IsUndefined(value) {
1528
- return IsEqual(value, void 0);
1529
- }
1530
- function IsEqual(left, right) {
1531
- return left === right;
1532
- }
1533
- function IsGreaterThan(left, right) {
1534
- return left > right;
1535
- }
1536
- function IsLessThan(left, right) {
1537
- return left < right;
1538
- }
1539
- function IsLessEqualThan(left, right) {
1540
- return left <= right;
1541
- }
1542
- function IsGreaterEqualThan(left, right) {
1543
- return left >= right;
1544
- }
1545
- function IsMultipleOf$1(dividend, divisor) {
1546
- if (IsBigInt(dividend) || IsBigInt(divisor)) return BigInt(dividend) % BigInt(divisor) === 0n;
1547
- const tolerance = 1e-10;
1548
- if (!IsNumber$1(dividend)) return true;
1549
- if (IsInteger(dividend) && 1 / divisor % 1 === 0) return true;
1550
- const mod = dividend % divisor;
1551
- return Math.min(Math.abs(mod), Math.abs(mod - divisor)) < tolerance;
1552
- }
1553
- function IsValueLike(value) {
1554
- return IsBigInt(value) || IsBoolean$1(value) || IsNull(value) || IsNumber$1(value) || IsString$1(value) || IsUndefined(value);
1555
- }
1556
- /** Returns true if the string has at most the given number of graphemes */
1557
- function IsMaxLength$1(value, length) {
1558
- return IsMaxLengthFast(value, length);
1559
- }
1560
- /** Returns true if the string has at least the given number of graphemes */
1561
- function IsMinLength$1(value, length) {
1562
- return IsMinLengthFast(value, length);
1563
- }
1564
- /** Returns true if all elements from offset satisfy the callback, short-circuiting on the first failure */
1565
- function Every(value, offset, callback) {
1566
- for (let index = offset; index < value.length; index++) if (!callback(value[index], index)) return false;
1567
- return true;
1568
- }
1569
- /** Returns true if all elements from offset satisfy the callback, visiting every element regardless of failure */
1570
- function EveryAll(value, offset, callback) {
1571
- let result = true;
1572
- for (let index = offset; index < value.length; index++) if (!callback(value[index], index)) result = false;
1573
- return result;
1574
- }
1575
- /** Returns true if the PropertyKey is Unsafe (ref: prototype-pollution). */
1576
- function IsUnsafePropertyKey(key) {
1577
- return IsEqual(key, "__proto__") || IsEqual(key, "constructor") || IsEqual(key, "prototype");
1578
- }
1579
- /** Returns true if this value has this property key */
1580
- function HasPropertyKey(value, key) {
1581
- return IsUnsafePropertyKey(key) ? Object.prototype.hasOwnProperty.call(value, key) : key in value;
1582
- }
1583
- /** Returns object entries as `[string, Value][]` */
1584
- function Entries(value) {
1585
- return Object.entries(value);
1586
- }
1587
- /** Returns property keys for this object via `Object.getOwnPropertyKeys({ ... })` */
1588
- function Keys(value) {
1589
- return Object.getOwnPropertyNames(value);
1590
- }
1591
- function DeepEqualObject(left, right) {
1592
- if (!IsObject(right)) return false;
1593
- const keys = Keys(left);
1594
- return IsEqual(keys.length, Keys(right).length) && keys.every((key) => IsDeepEqual(left[key], right[key]));
1595
- }
1596
- function DeepEqualArray(left, right) {
1597
- return IsArray(right) && IsEqual(left.length, right.length) && left.every((_, index) => IsDeepEqual(left[index], right[index]));
1598
- }
1599
- /** Tests values for deep equality */
1600
- function IsDeepEqual(left, right) {
1601
- return IsArray(left) ? DeepEqualArray(left, right) : IsObject(left) ? DeepEqualObject(left, right) : IsEqual(left, right);
1602
- }
1603
- //#endregion
1604
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/guard/globals.mjs
1605
- function IsBoolean(value) {
1606
- return value instanceof Boolean;
1607
- }
1608
- function IsNumber(value) {
1609
- return value instanceof Number;
1610
- }
1611
- function IsString(value) {
1612
- return value instanceof String;
1613
- }
1614
- function IsTypeArray(value) {
1615
- return globalThis.ArrayBuffer.isView(value);
1616
- }
1617
- /** Returns true if the value is a RegExp */
1618
- function IsRegExp(value) {
1619
- return value instanceof globalThis.RegExp;
1620
- }
1621
- /** Returns true if the value is a Date */
1622
- function IsDate$1(value) {
1623
- return value instanceof globalThis.Date;
1624
- }
1625
- //#endregion
1626
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/_guard.mjs
1627
- function IsGuardInterface(value) {
1628
- return IsObject(value) && HasPropertyKey(value, "check") && HasPropertyKey(value, "errors") && IsFunction(value.check) && IsFunction(value.errors);
1629
- }
1630
- function IsGuard(value) {
1631
- return HasPropertyKey(value, "~guard") && IsGuardInterface(value["~guard"]);
1632
- }
1633
- //#endregion
1634
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/_refine.mjs
1635
- /**
1636
- * Returns true if the schema contains an '~refine` keyword
1637
- * @specification None
1638
- */
1639
- function IsRefine(value) {
1640
- return HasPropertyKey(value, "~refine") && IsArray(value["~refine"]) && Every(value["~refine"], 0, (value) => IsObject(value) && HasPropertyKey(value, "check") && HasPropertyKey(value, "error") && IsFunction(value.check) && IsFunction(value.error));
1641
- }
1642
- //#endregion
1643
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/schema.mjs
1644
- /** Returns true if this value is object like */
1645
- function IsSchemaObject(value) {
1646
- return IsObject(value) && !IsArray(value);
1647
- }
1648
- /** Returns true if this value is a boolean */
1649
- function IsBooleanSchema(value) {
1650
- return IsBoolean$1(value);
1651
- }
1652
- /** Returns true if this value is schema like */
1653
- function IsSchema(value) {
1654
- return IsSchemaObject(value) || IsBooleanSchema(value);
1655
- }
1656
- //#endregion
1657
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/additionalItems.mjs
1658
- /**
1659
- * Returns true if the schema contains a valid additionalItems property
1660
- * @specification Json Schema 7
1661
- */
1662
- function IsAdditionalItems(schema) {
1663
- return HasPropertyKey(schema, "additionalItems") && IsSchema(schema.additionalItems);
1664
- }
1665
- //#endregion
1666
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/additionalProperties.mjs
1667
- /**
1668
- * Returns true if the schema contains a valid additionalProperties property
1669
- * @specification Json Schema 7
1670
- */
1671
- function IsAdditionalProperties(schema) {
1672
- return HasPropertyKey(schema, "additionalProperties") && IsSchema(schema.additionalProperties);
1673
- }
1674
- //#endregion
1675
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/allOf.mjs
1676
- /**
1677
- * Returns true if the schema contains a valid allOf property
1678
- * @specification Json Schema 7
1679
- */
1680
- function IsAllOf(schema) {
1681
- return HasPropertyKey(schema, "allOf") && IsArray(schema.allOf) && schema.allOf.every((value) => IsSchema(value));
1682
- }
1683
- //#endregion
1684
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/anchor.mjs
1685
- /**
1686
- * Returns true if the schema contains a valid $anchor property
1687
- */
1688
- function IsAnchor(schema) {
1689
- return HasPropertyKey(schema, "$anchor") && IsString$1(schema.$anchor);
1690
- }
1691
- //#endregion
1692
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/anyOf.mjs
1693
- /**
1694
- * Returns true if the schema contains a valid anyOf property
1695
- * @specification Json Schema 7
1696
- */
1697
- function IsAnyOf(schema) {
1698
- return HasPropertyKey(schema, "anyOf") && IsArray(schema.anyOf) && schema.anyOf.every((value) => IsSchema(value));
1699
- }
1700
- //#endregion
1701
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/const.mjs
1702
- /**
1703
- * Returns true if the schema contains a valid const property
1704
- * @specification Json Schema 7
1705
- */
1706
- function IsConst(value) {
1707
- return HasPropertyKey(value, "const");
1708
- }
1709
- //#endregion
1710
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/contains.mjs
1711
- /**
1712
- * Returns true if the schema contains a valid contains property
1713
- * @specification Json Schema 7
1714
- */
1715
- function IsContains(schema) {
1716
- return HasPropertyKey(schema, "contains") && IsSchema(schema.contains);
1717
- }
1718
- //#endregion
1719
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/dependencies.mjs
1720
- /**
1721
- * Returns true if the schema contains a valid dependencies property
1722
- * @specification Json Schema 7
1723
- */
1724
- function IsDependencies(schema) {
1725
- return HasPropertyKey(schema, "dependencies") && IsObject(schema.dependencies) && Object.values(schema.dependencies).every((value) => IsSchema(value) || IsArray(value) && value.every((value) => IsString$1(value)));
1726
- }
1727
- //#endregion
1728
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/dependentRequired.mjs
1729
- /**
1730
- * Returns true if the schema contains a valid dependentRequired property
1731
- * @specification Json Schema 2019-09
1732
- */
1733
- function IsDependentRequired(schema) {
1734
- return HasPropertyKey(schema, "dependentRequired") && IsObject(schema.dependentRequired) && Object.values(schema.dependentRequired).every((value) => IsArray(value) && value.every((value) => IsString$1(value)));
1735
- }
1736
- //#endregion
1737
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/dependentSchemas.mjs
1738
- /**
1739
- * Returns true if the schema contains a valid dependentRequired property
1740
- * @specification Json Schema 2019-09
1741
- */
1742
- function IsDependentSchemas(schema) {
1743
- return HasPropertyKey(schema, "dependentSchemas") && IsObject(schema.dependentSchemas) && Object.values(schema.dependentSchemas).every((value) => IsSchema(value));
1744
- }
1745
- //#endregion
1746
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/dynamicAnchor.mjs
1747
- /**
1748
- * Returns true if the schema contains a valid $dynamicAnchor property
1749
- */
1750
- function IsDynamicAnchor(schema) {
1751
- return HasPropertyKey(schema, "$dynamicAnchor") && IsString$1(schema.$dynamicAnchor);
1752
- }
1753
- //#endregion
1754
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/dynamicRef.mjs
1755
- /**
1756
- * Returns true if the schema contains a valid $dynamicRef property
1757
- */
1758
- function IsDynamicRef(schema) {
1759
- return HasPropertyKey(schema, "$dynamicRef") && IsString$1(schema.$dynamicRef);
1760
- }
1761
- //#endregion
1762
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/else.mjs
1763
- /**
1764
- * Returns true if the schema contains a valid else property
1765
- * @specification Json Schema 7
1766
- */
1767
- function IsElse(schema) {
1768
- return HasPropertyKey(schema, "else") && IsSchema(schema.else);
1769
- }
1770
- //#endregion
1771
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/enum.mjs
1772
- /**
1773
- * Returns true if the schema contains a valid enum property
1774
- * @specification Json Schema 7
1775
- */
1776
- function IsEnum(schema) {
1777
- return HasPropertyKey(schema, "enum") && IsArray(schema.enum);
1778
- }
1779
- //#endregion
1780
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/exclusiveMaximum.mjs
1781
- /**
1782
- * Returns true if the schema contains a valid exclusiveMaximum property
1783
- * @specification Json Schema 7
1784
- */
1785
- function IsExclusiveMaximum(schema) {
1786
- return HasPropertyKey(schema, "exclusiveMaximum") && (IsNumber$1(schema.exclusiveMaximum) || IsBigInt(schema.exclusiveMaximum));
1787
- }
1788
- //#endregion
1789
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/exclusiveMinimum.mjs
1790
- /**
1791
- * Returns true if the schema contains a valid exclusiveMinimum property
1792
- * @specification Json Schema 7
1793
- */
1794
- function IsExclusiveMinimum(schema) {
1795
- return HasPropertyKey(schema, "exclusiveMinimum") && (IsNumber$1(schema.exclusiveMinimum) || IsBigInt(schema.exclusiveMinimum));
1796
- }
1797
- //#endregion
1798
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/format.mjs
1799
- /**
1800
- * Returns true if the schema contains a valid format property
1801
- * @specification Json Schema 7
1802
- */
1803
- function IsFormat(schema) {
1804
- return HasPropertyKey(schema, "format") && IsString$1(schema.format);
1805
- }
1806
- //#endregion
1807
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/id.mjs
1808
- /**
1809
- * Returns true if the schema contains a valid $id property
1810
- * @specification Json Schema 7
1811
- */
1812
- function IsId(schema) {
1813
- return HasPropertyKey(schema, "$id") && IsString$1(schema.$id);
1814
- }
1815
- //#endregion
1816
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/if.mjs
1817
- /**
1818
- * Returns true if the schema contains a valid $id property
1819
- * @specification Json Schema 7
1820
- */
1821
- function IsIf(schema) {
1822
- return HasPropertyKey(schema, "if") && IsSchema(schema.if);
1823
- }
1824
- //#endregion
1825
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/items.mjs
1826
- /**
1827
- * Returns true if the schema contains a valid items property
1828
- * @specification Json Schema 7
1829
- */
1830
- function IsItems(schema) {
1831
- return HasPropertyKey(schema, "items") && (IsSchema(schema.items) || IsArray(schema.items) && schema.items.every((value) => {
1832
- return IsSchema(value);
1833
- }));
1834
- }
1835
- /** Returns true if this schema is a sized items variant */
1836
- function IsItemsSized(schema) {
1837
- return IsItems(schema) && IsArray(schema.items);
1838
- }
1839
- //#endregion
1840
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/maximum.mjs
1841
- /**
1842
- * Returns true if the schema contains a valid maximum property
1843
- * @specification Json Schema 7
1844
- */
1845
- function IsMaximum(schema) {
1846
- return HasPropertyKey(schema, "maximum") && (IsNumber$1(schema.maximum) || IsBigInt(schema.maximum));
1847
- }
1848
- //#endregion
1849
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/maxContains.mjs
1850
- /**
1851
- * Returns true if the schema contains a valid maxContains property
1852
- * @specification Json Schema 2019-09
1853
- */
1854
- function IsMaxContains(schema) {
1855
- return HasPropertyKey(schema, "maxContains") && IsNumber$1(schema.maxContains);
1856
- }
1857
- //#endregion
1858
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/maxItems.mjs
1859
- /**
1860
- * Returns true if the schema contains a valid maxItems property
1861
- * @specification Json Schema 7
1862
- */
1863
- function IsMaxItems(schema) {
1864
- return HasPropertyKey(schema, "maxItems") && IsNumber$1(schema.maxItems);
1865
- }
1866
- //#endregion
1867
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/maxLength.mjs
1868
- /**
1869
- * Returns true if the schema contains a valid maxLength property
1870
- * @specification Json Schema 7
1871
- */
1872
- function IsMaxLength(schema) {
1873
- return HasPropertyKey(schema, "maxLength") && IsNumber$1(schema.maxLength);
1874
- }
1875
- //#endregion
1876
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/maxProperties.mjs
1877
- /**
1878
- * Returns true if the schema contains a valid maxProperties property
1879
- * @specification Json Schema 7
1880
- */
1881
- function IsMaxProperties(schema) {
1882
- return HasPropertyKey(schema, "maxProperties") && IsNumber$1(schema.maxProperties);
1883
- }
1884
- //#endregion
1885
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/minimum.mjs
1886
- /**
1887
- * Returns true if the schema contains a valid minimum property
1888
- * @specification Json Schema 7
1889
- */
1890
- function IsMinimum(schema) {
1891
- return HasPropertyKey(schema, "minimum") && (IsNumber$1(schema.minimum) || IsBigInt(schema.minimum));
1892
- }
1893
- //#endregion
1894
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/minContains.mjs
1895
- /**
1896
- * Returns true if the schema contains a valid maxContains property
1897
- * @specification Json Schema 2019-09
1898
- */
1899
- function IsMinContains(schema) {
1900
- return HasPropertyKey(schema, "minContains") && IsNumber$1(schema.minContains);
1901
- }
1902
- //#endregion
1903
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/minItems.mjs
1904
- /**
1905
- * Returns true if the schema contains a valid minItems property
1906
- * @specification Json Schema 7
1907
- */
1908
- function IsMinItems(schema) {
1909
- return HasPropertyKey(schema, "minItems") && IsNumber$1(schema.minItems);
1910
- }
1911
- //#endregion
1912
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/minLength.mjs
1913
- /**
1914
- * Returns true if the schema contains a valid minLength property
1915
- * @specification Json Schema 7
1916
- */
1917
- function IsMinLength(schema) {
1918
- return HasPropertyKey(schema, "minLength") && IsNumber$1(schema.minLength);
1919
- }
1920
- //#endregion
1921
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/minProperties.mjs
1922
- /**
1923
- * Returns true if the schema contains a valid minProperties property
1924
- * @specification Json Schema 7
1925
- */
1926
- function IsMinProperties(schema) {
1927
- return HasPropertyKey(schema, "minProperties") && IsNumber$1(schema.minProperties);
1928
- }
1929
- //#endregion
1930
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/multipleOf.mjs
1931
- /**
1932
- * Returns true if the schema contains a valid multipleOf property
1933
- * @specification Json Schema 7
1934
- */
1935
- function IsMultipleOf(schema) {
1936
- return HasPropertyKey(schema, "multipleOf") && (IsNumber$1(schema.multipleOf) || IsBigInt(schema.multipleOf));
1937
- }
1938
- //#endregion
1939
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/not.mjs
1940
- /**
1941
- * Returns true if the schema contains a valid not property
1942
- * @specification Json Schema 7
1943
- */
1944
- function IsNot(schema) {
1945
- return HasPropertyKey(schema, "not") && IsSchema(schema.not);
1946
- }
1947
- //#endregion
1948
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/oneOf.mjs
1949
- /**
1950
- * Returns true if the schema contains a valid oneOf property
1951
- * @specification Json Schema 7
1952
- */
1953
- function IsOneOf(schema) {
1954
- return HasPropertyKey(schema, "oneOf") && IsArray(schema.oneOf) && schema.oneOf.every((value) => IsSchema(value));
1955
- }
1956
- //#endregion
1957
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/pattern.mjs
1958
- /**
1959
- * Returns true if the schema contains a valid pattern property
1960
- * @specification Json Schema 7
1961
- */
1962
- function IsPattern(schema) {
1963
- return HasPropertyKey(schema, "pattern") && (IsString$1(schema.pattern) || schema.pattern instanceof RegExp);
1964
- }
1965
- //#endregion
1966
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/patternProperties.mjs
1967
- /**
1968
- * Returns true if the schema contains a valid patternProperties property
1969
- * @specification Json Schema 7
1970
- */
1971
- function IsPatternProperties(schema) {
1972
- return HasPropertyKey(schema, "patternProperties") && IsObject(schema.patternProperties) && Object.values(schema.patternProperties).every((value) => IsSchema(value));
1973
- }
1974
- //#endregion
1975
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/prefixItems.mjs
1976
- /**
1977
- * Returns true if the schema contains a valid prefixItems property
1978
- */
1979
- function IsPrefixItems(schema) {
1980
- return HasPropertyKey(schema, "prefixItems") && IsArray(schema.prefixItems) && schema.prefixItems.every((schema) => IsSchema(schema));
1981
- }
1982
- //#endregion
1983
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/properties.mjs
1984
- /**
1985
- * Returns true if the schema contains a valid properties property
1986
- * @specification Json Schema 7
1987
- */
1988
- function IsProperties(schema) {
1989
- return HasPropertyKey(schema, "properties") && IsObject(schema.properties) && Object.values(schema.properties).every((value) => IsSchema(value));
1990
- }
1991
- //#endregion
1992
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/propertyNames.mjs
1993
- /**
1994
- * Returns true if the schema contains a valid propertyNames property
1995
- * @specification Json Schema 7
1996
- */
1997
- function IsPropertyNames(schema) {
1998
- return HasPropertyKey(schema, "propertyNames") && (IsObject(schema.propertyNames) || IsSchema(schema.propertyNames));
1999
- }
2000
- //#endregion
2001
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/recursiveAnchor.mjs
2002
- /**
2003
- * Returns true if the schema contains a valid $recursiveAnchor property
2004
- */
2005
- function IsRecursiveAnchor(schema) {
2006
- return HasPropertyKey(schema, "$recursiveAnchor") && IsBoolean$1(schema.$recursiveAnchor);
2007
- }
2008
- /**
2009
- * Returns true if the schema contains a valid $recursiveAnchor property that is true
2010
- */
2011
- function IsRecursiveAnchorTrue(schema) {
2012
- return IsRecursiveAnchor(schema) && IsEqual(schema.$recursiveAnchor, true);
2013
- }
2014
- //#endregion
2015
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/recursiveRef.mjs
2016
- /**
2017
- * Returns true if the schema contains a valid $recursiveRef property
2018
- */
2019
- function IsRecursiveRef(schema) {
2020
- return HasPropertyKey(schema, "$recursiveRef") && IsString$1(schema.$recursiveRef);
2021
- }
2022
- //#endregion
2023
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/ref.mjs
2024
- /**
2025
- * Returns true if the schema contains a valid $ref property
2026
- * @specification Json Schema 7
2027
- */
2028
- function IsRef(schema) {
2029
- return HasPropertyKey(schema, "$ref") && IsString$1(schema.$ref);
2030
- }
2031
- //#endregion
2032
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/required.mjs
2033
- /**
2034
- * Returns true if the schema contains a valid required property
2035
- * @specification Json Schema 7
2036
- */
2037
- function IsRequired(schema) {
2038
- return HasPropertyKey(schema, "required") && IsArray(schema.required) && schema.required.every((value) => IsString$1(value));
2039
- }
2040
- //#endregion
2041
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/then.mjs
2042
- /**
2043
- * Returns true if the schema contains a valid then property
2044
- * @specification Json Schema 7
2045
- */
2046
- function IsThen(schema) {
2047
- return HasPropertyKey(schema, "then") && IsSchema(schema.then);
2048
- }
2049
- //#endregion
2050
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/type.mjs
2051
- /**
2052
- * Returns true if the schema contains a valid type property
2053
- * @specification Json Schema 7
2054
- */
2055
- function IsType(schema) {
2056
- return HasPropertyKey(schema, "type") && (IsString$1(schema.type) || IsArray(schema.type) && schema.type.every((value) => IsString$1(value)));
2057
- }
2058
- //#endregion
2059
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/uniqueItems.mjs
2060
- /**
2061
- * Returns true if the schema contains a valid uniqueItems property
2062
- * @specification Json Schema 7
2063
- */
2064
- function IsUniqueItems(schema) {
2065
- return HasPropertyKey(schema, "uniqueItems") && IsBoolean$1(schema.uniqueItems);
2066
- }
2067
- //#endregion
2068
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/unevaluatedItems.mjs
2069
- /**
2070
- * Returns true if the schema contains a valid unevaluatedItems property
2071
- * @specification Json Schema 2019-09
2072
- */
2073
- function IsUnevaluatedItems(schema) {
2074
- return HasPropertyKey(schema, "unevaluatedItems") && IsSchema(schema.unevaluatedItems);
2075
- }
2076
- //#endregion
2077
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/types/unevaluatedProperties.mjs
2078
- /**
2079
- * Returns true if the schema contains a valid unevaluatedProperties property
2080
- * @specification Json Schema 2019-09
2081
- */
2082
- function IsUnevaluatedProperties(schema) {
2083
- return HasPropertyKey(schema, "unevaluatedProperties") && IsSchema(schema.unevaluatedProperties);
2084
- }
2085
- //#endregion
2086
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/_context.mjs
2087
- var import_proper_lockfile = /* @__PURE__ */ __toESM(require_proper_lockfile(), 1);
2088
- var CheckContext = class {
2089
- constructor() {
2090
- const indices = /* @__PURE__ */ new Set();
2091
- const keys = /* @__PURE__ */ new Set();
2092
- this.stack = [{
2093
- indices,
2094
- keys
2095
- }];
2096
- }
2097
- Push() {
2098
- const indices = /* @__PURE__ */ new Set();
2099
- const keys = /* @__PURE__ */ new Set();
2100
- this.stack.push({
2101
- indices,
2102
- keys
2103
- });
2104
- return true;
2105
- }
2106
- Pop() {
2107
- this.stack.pop();
2108
- return true;
2109
- }
2110
- AddIndex(index) {
2111
- this.GetIndices().add(index);
2112
- return true;
2113
- }
2114
- AddKey(key) {
2115
- this.GetKeys().add(key);
2116
- return true;
2117
- }
2118
- GetIndices() {
2119
- return this.stack[this.stack.length - 1].indices;
2120
- }
2121
- GetKeys() {
2122
- return this.stack[this.stack.length - 1].keys;
2123
- }
2124
- Merge(results) {
2125
- for (const context of results) {
2126
- context.GetIndices().forEach((value) => this.GetIndices().add(value));
2127
- context.GetKeys().forEach((value) => this.GetKeys().add(value));
2128
- }
2129
- return true;
2130
- }
2131
- };
2132
- var ErrorContext = class extends CheckContext {
2133
- constructor(callback) {
2134
- super();
2135
- this.callback = callback;
2136
- }
2137
- AddError(error) {
2138
- this.callback(error);
2139
- return false;
2140
- }
2141
- };
2142
- var AccumulatedErrorContext = class extends ErrorContext {
2143
- constructor() {
2144
- super((error) => this.errors.push(error));
2145
- this.errors = [];
2146
- }
2147
- AddError(error) {
2148
- this.errors.push(error);
2149
- return false;
2150
- }
2151
- GetErrors() {
2152
- return this.errors;
2153
- }
2154
- };
2155
- //#endregion
2156
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/_guard.mjs
2157
- function CheckGuard(_stack, _context, schema, value) {
2158
- return schema["~guard"].check(value);
2159
- }
2160
- function ErrorGuard(_stack, context, schemaPath, instancePath, schema, value) {
2161
- return schema["~guard"].check(value) || context.AddError({
2162
- keyword: "~guard",
2163
- schemaPath,
2164
- instancePath,
2165
- params: { errors: schema["~guard"].errors(value) }
2166
- });
2167
- }
2168
- //#endregion
2169
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/system/unreachable/unreachable.mjs
2170
- /** Used for unreachable logic */
2171
- function Unreachable() {
2172
- throw new Error("Unreachable");
2173
- }
2174
- //#endregion
2175
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/system/hashing/hash.mjs
2176
- function InstanceKeys(value) {
2177
- const propertyKeys = /* @__PURE__ */ new Set();
2178
- let current = value;
2179
- while (current && current !== Object.prototype) {
2180
- for (const key of Reflect.ownKeys(current)) if (key !== "constructor" && typeof key !== "symbol") propertyKeys.add(key);
2181
- current = Object.getPrototypeOf(current);
2182
- }
2183
- return [...propertyKeys];
2184
- }
2185
- function IsIEEE754(value) {
2186
- return typeof value === "number";
2187
- }
2188
- var ByteMarker;
2189
- (function(ByteMarker) {
2190
- ByteMarker[ByteMarker["Array"] = 0] = "Array";
2191
- ByteMarker[ByteMarker["BigInt"] = 1] = "BigInt";
2192
- ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean";
2193
- ByteMarker[ByteMarker["Date"] = 3] = "Date";
2194
- ByteMarker[ByteMarker["Constructor"] = 4] = "Constructor";
2195
- ByteMarker[ByteMarker["Function"] = 5] = "Function";
2196
- ByteMarker[ByteMarker["Null"] = 6] = "Null";
2197
- ByteMarker[ByteMarker["Number"] = 7] = "Number";
2198
- ByteMarker[ByteMarker["Object"] = 8] = "Object";
2199
- ByteMarker[ByteMarker["RegExp"] = 9] = "RegExp";
2200
- ByteMarker[ByteMarker["String"] = 10] = "String";
2201
- ByteMarker[ByteMarker["Symbol"] = 11] = "Symbol";
2202
- ByteMarker[ByteMarker["TypeArray"] = 12] = "TypeArray";
2203
- ByteMarker[ByteMarker["Undefined"] = 13] = "Undefined";
2204
- })(ByteMarker || (ByteMarker = {}));
2205
- let Accumulator = BigInt("14695981039346656037");
2206
- const [Prime, Size] = [BigInt("1099511628211"), BigInt("18446744073709551616")];
2207
- const Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
2208
- const F64 = new Float64Array(1);
2209
- const F64In = new DataView(F64.buffer);
2210
- const F64Out = new Uint8Array(F64.buffer);
2211
- function FNV1A64_OP(byte) {
2212
- Accumulator = Accumulator ^ Bytes[byte];
2213
- Accumulator = Accumulator * Prime % Size;
2214
- }
2215
- function FromArray$1(value) {
2216
- FNV1A64_OP(ByteMarker.Array);
2217
- for (const item of value) FromValue$1(item);
2218
- }
2219
- function FromBigInt(value) {
2220
- FNV1A64_OP(ByteMarker.BigInt);
2221
- F64In.setBigInt64(0, value);
2222
- for (const byte of F64Out) FNV1A64_OP(byte);
2223
- }
2224
- function FromBoolean(value) {
2225
- FNV1A64_OP(ByteMarker.Boolean);
2226
- FNV1A64_OP(value ? 1 : 0);
2227
- }
2228
- function FromConstructor(value) {
2229
- FNV1A64_OP(ByteMarker.Constructor);
2230
- FromValue$1(value.toString());
2231
- }
2232
- function FromDate(value) {
2233
- FNV1A64_OP(ByteMarker.Date);
2234
- FromValue$1(value.getTime());
2235
- }
2236
- function FromFunction(value) {
2237
- FNV1A64_OP(ByteMarker.Function);
2238
- FromValue$1(value.toString());
2239
- }
2240
- function FromNull(_value) {
2241
- FNV1A64_OP(ByteMarker.Null);
2242
- }
2243
- function FromNumber(value) {
2244
- FNV1A64_OP(ByteMarker.Number);
2245
- F64In.setFloat64(0, value, true);
2246
- for (const byte of F64Out) FNV1A64_OP(byte);
2247
- }
2248
- function FromObject$1(value) {
2249
- FNV1A64_OP(ByteMarker.Object);
2250
- for (const key of InstanceKeys(value).sort()) {
2251
- FromValue$1(key);
2252
- FromValue$1(value[key]);
2253
- }
2254
- }
2255
- function FromRegExp(value) {
2256
- FNV1A64_OP(ByteMarker.RegExp);
2257
- FromString(value.toString());
2258
- }
2259
- const encoder = new TextEncoder();
2260
- function FromString(value) {
2261
- FNV1A64_OP(ByteMarker.String);
2262
- for (const byte of encoder.encode(value)) FNV1A64_OP(byte);
2263
- }
2264
- function FromSymbol(value) {
2265
- FNV1A64_OP(ByteMarker.Symbol);
2266
- FromValue$1(value.toString());
2267
- }
2268
- function FromTypeArray(value) {
2269
- FNV1A64_OP(ByteMarker.TypeArray);
2270
- const buffer = new Uint8Array(value.buffer);
2271
- for (let i = 0; i < buffer.length; i++) FNV1A64_OP(buffer[i]);
2272
- }
2273
- function FromUndefined(_value) {
2274
- return FNV1A64_OP(ByteMarker.Undefined);
2275
- }
2276
- function FromValue$1(value) {
2277
- return IsTypeArray(value) ? FromTypeArray(value) : IsDate$1(value) ? FromDate(value) : IsRegExp(value) ? FromRegExp(value) : IsBoolean(value) ? FromBoolean(value.valueOf()) : IsString(value) ? FromString(value.valueOf()) : IsNumber(value) ? FromNumber(value.valueOf()) : IsIEEE754(value) ? FromNumber(value) : IsArray(value) ? FromArray$1(value) : IsBoolean$1(value) ? FromBoolean(value) : IsBigInt(value) ? FromBigInt(value) : IsConstructor(value) ? FromConstructor(value) : IsNull(value) ? FromNull(value) : IsObject(value) ? FromObject$1(value) : IsString$1(value) ? FromString(value) : IsSymbol(value) ? FromSymbol(value) : IsUndefined(value) ? FromUndefined(value) : IsFunction(value) ? FromFunction(value) : Unreachable();
2278
- }
2279
- /** Generates a FNV1A-64 non cryptographic hash of the given value */
2280
- function HashCode(value) {
2281
- Accumulator = BigInt("14695981039346656037");
2282
- FromValue$1(value);
2283
- return Accumulator;
2284
- }
2285
- /** Generates a FNV1A-64 non cryptographic hash of the given value */
2286
- function Hash(value) {
2287
- return HashCode(value).toString(16).padStart(16, "0");
2288
- }
2289
- //#endregion
2290
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/_refine.mjs
2291
- function CheckRefine(_stack, _context, schema, value) {
2292
- return Every(schema["~refine"], 0, (refinement, _) => refinement.check(value));
2293
- }
2294
- function ErrorRefine(_stack, context, schemaPath, instancePath, schema, value) {
2295
- return EveryAll(schema["~refine"], 0, (refinement, index) => {
2296
- return refinement.check(value) || context.AddError({
2297
- keyword: "~refine",
2298
- schemaPath,
2299
- instancePath,
2300
- params: {
2301
- index,
2302
- message: refinement.error(value)
2303
- }
2304
- });
2305
- });
2306
- }
2307
- //#endregion
2308
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/additionalItems.mjs
2309
- function IsValid$4(schema) {
2310
- return IsItems(schema) && IsArray(schema.items);
2311
- }
2312
- function CheckAdditionalItems(stack, context, schema, value) {
2313
- if (!IsValid$4(schema)) return true;
2314
- return value.every((item, index) => {
2315
- return IsLessThan(index, schema.items.length) || CheckSchemaPushStack(stack, context, schema.additionalItems, item) && context.AddIndex(index);
2316
- });
2317
- }
2318
- function ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema, value) {
2319
- if (!IsValid$4(schema)) return true;
2320
- return value.every((item, index) => {
2321
- const nextSchemaPath = `${schemaPath}/additionalItems`;
2322
- const nextInstancePath = `${instancePath}/${index}`;
2323
- return IsLessThan(index, schema.items.length) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema.additionalItems, item) && context.AddIndex(index);
2324
- });
2325
- }
2326
- //#endregion
2327
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/additionalProperties.mjs
2328
- function GetPropertyKeyAsPattern(key) {
2329
- return `^${key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`;
2330
- }
2331
- function GetPropertiesPattern(schema) {
2332
- const patterns = [];
2333
- if (IsPatternProperties(schema)) patterns.push(...Keys(schema.patternProperties));
2334
- if (IsProperties(schema)) patterns.push(...Keys(schema.properties).map(GetPropertyKeyAsPattern));
2335
- return IsEqual(patterns.length, 0) ? "(?!)" : `(${patterns.join("|")})`;
2336
- }
2337
- function CheckAdditionalProperties(stack, context, schema, value) {
2338
- const regexp = new RegExp(GetPropertiesPattern(schema));
2339
- return Every(Keys(value), 0, (key, _index) => {
2340
- return regexp.test(key) || CheckSchemaPushStack(stack, context, schema.additionalProperties, value[key]) && context.AddKey(key);
2341
- });
2342
- }
2343
- function ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value) {
2344
- const regexp = new RegExp(GetPropertiesPattern(schema));
2345
- const additionalProperties = [];
2346
- return EveryAll(Keys(value), 0, (key, _index) => {
2347
- const nextSchemaPath = `${schemaPath}/additionalProperties`;
2348
- const nextInstancePath = `${instancePath}/${key}`;
2349
- const nextContext = new AccumulatedErrorContext();
2350
- const isAdditionalProperty = regexp.test(key) || ErrorSchemaPushStack(stack, nextContext, nextSchemaPath, nextInstancePath, schema.additionalProperties, value[key]) && context.AddKey(key);
2351
- if (!isAdditionalProperty) additionalProperties.push(key);
2352
- return isAdditionalProperty;
2353
- }) || context.AddError({
2354
- keyword: "additionalProperties",
2355
- schemaPath,
2356
- instancePath,
2357
- params: { additionalProperties }
2358
- });
2359
- }
2360
- //#endregion
2361
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/allOf.mjs
2362
- function CheckAllOf(stack, context, schema, value) {
2363
- const results = schema.allOf.reduce((result, schema) => {
2364
- const nextContext = new CheckContext();
2365
- return CheckSchema(stack, nextContext, schema, value) ? [...result, nextContext] : result;
2366
- }, []);
2367
- return IsEqual(results.length, schema.allOf.length) && context.Merge(results);
2368
- }
2369
- function ErrorAllOf(stack, context, schemaPath, instancePath, schema, value) {
2370
- const failedContexts = [];
2371
- const results = schema.allOf.reduce((result, schema, index) => {
2372
- const nextSchemaPath = `${schemaPath}/allOf/${index}`;
2373
- const nextContext = new AccumulatedErrorContext();
2374
- const isSchema = ErrorSchema(stack, nextContext, nextSchemaPath, instancePath, schema, value);
2375
- if (!isSchema) failedContexts.push(nextContext);
2376
- return isSchema ? [...result, nextContext] : result;
2377
- }, []);
2378
- const isAllOf = IsEqual(results.length, schema.allOf.length) && context.Merge(results);
2379
- if (!isAllOf) failedContexts.forEach((failed) => failed.GetErrors().forEach((error) => context.AddError(error)));
2380
- return isAllOf;
2381
- }
2382
- //#endregion
2383
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/anyOf.mjs
2384
- function CheckAnyOf(stack, context, schema, value) {
2385
- const results = schema.anyOf.reduce((result, schema) => {
2386
- const nextContext = new CheckContext();
2387
- return CheckSchema(stack, nextContext, schema, value) ? [...result, nextContext] : result;
2388
- }, []);
2389
- return IsGreaterThan(results.length, 0) && context.Merge(results);
2390
- }
2391
- function ErrorAnyOf(stack, context, schemaPath, instancePath, schema, value) {
2392
- const failedContexts = [];
2393
- const results = schema.anyOf.reduce((result, schema, index) => {
2394
- const nextContext = new AccumulatedErrorContext();
2395
- const isSchema = ErrorSchema(stack, nextContext, `${schemaPath}/anyOf/${index}`, instancePath, schema, value);
2396
- if (!isSchema) failedContexts.push(nextContext);
2397
- return isSchema ? [...result, nextContext] : result;
2398
- }, []);
2399
- const isAnyOf = IsGreaterThan(results.length, 0) && context.Merge(results);
2400
- if (!isAnyOf) failedContexts.forEach((failed) => failed.GetErrors().forEach((error) => context.AddError(error)));
2401
- return isAnyOf || context.AddError({
2402
- keyword: "anyOf",
2403
- schemaPath,
2404
- instancePath,
2405
- params: {}
2406
- });
2407
- }
2408
- //#endregion
2409
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/boolean.mjs
2410
- function CheckBooleanSchema(_stack, _context, schema, _value) {
2411
- return schema;
2412
- }
2413
- function ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema, value) {
2414
- return CheckBooleanSchema(stack, context, schema, value) || context.AddError({
2415
- keyword: "boolean",
2416
- schemaPath,
2417
- instancePath,
2418
- params: {}
2419
- });
2420
- }
2421
- //#endregion
2422
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/const.mjs
2423
- function CheckConst(_stack, _context, schema, value) {
2424
- return IsValueLike(schema.const) ? IsEqual(value, schema.const) : IsDeepEqual(value, schema.const);
2425
- }
2426
- function ErrorConst(stack, context, schemaPath, instancePath, schema, value) {
2427
- return CheckConst(stack, context, schema, value) || context.AddError({
2428
- keyword: "const",
2429
- schemaPath,
2430
- instancePath,
2431
- params: { allowedValue: schema.const }
2432
- });
2433
- }
2434
- //#endregion
2435
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/contains.mjs
2436
- function IsValid$3(schema) {
2437
- return !(IsMinContains(schema) && IsEqual(schema.minContains, 0));
2438
- }
2439
- function CheckContains(stack, context, schema, value) {
2440
- if (!IsValid$3(schema)) return true;
2441
- return !IsEqual(value.length, 0) && value.some((item) => CheckSchema(stack, context, schema.contains, item));
2442
- }
2443
- function ErrorContains(stack, context, schemaPath, instancePath, schema, value) {
2444
- return CheckContains(stack, context, schema, value) || context.AddError({
2445
- keyword: "contains",
2446
- schemaPath,
2447
- instancePath,
2448
- params: { minContains: 1 }
2449
- });
2450
- }
2451
- //#endregion
2452
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/dependencies.mjs
2453
- function CheckDependencies(stack, context, schema, value) {
2454
- const isLength = IsEqual(Keys(value).length, 0);
2455
- const isEvery = Every(Entries(schema.dependencies), 0, ([key, schema]) => {
2456
- return !HasPropertyKey(value, key) || (IsArray(schema) ? schema.every((key) => HasPropertyKey(value, key)) : CheckSchema(stack, context, schema, value));
2457
- });
2458
- return isLength || isEvery;
2459
- }
2460
- function ErrorDependencies(stack, context, schemaPath, instancePath, schema, value) {
2461
- const isLength = IsEqual(Keys(value).length, 0);
2462
- const isEvery = EveryAll(Entries(schema.dependencies), 0, ([key, schema]) => {
2463
- const nextSchemaPath = `${schemaPath}/dependencies/${key}`;
2464
- return !HasPropertyKey(value, key) || (IsArray(schema) ? schema.every((dependency) => HasPropertyKey(value, dependency) || context.AddError({
2465
- keyword: "dependencies",
2466
- schemaPath,
2467
- instancePath,
2468
- params: {
2469
- property: key,
2470
- dependencies: schema
2471
- }
2472
- })) : ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value));
2473
- });
2474
- return isLength || isEvery;
2475
- }
2476
- //#endregion
2477
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/dependentRequired.mjs
2478
- function CheckDependentRequired(_stack, _context, schema, value) {
2479
- const isLength = IsEqual(Keys(value).length, 0);
2480
- const isEvery = Every(Entries(schema.dependentRequired), 0, ([key, keys]) => {
2481
- return !HasPropertyKey(value, key) || keys.every((key) => HasPropertyKey(value, key));
2482
- });
2483
- return isLength || isEvery;
2484
- }
2485
- function ErrorDependentRequired(_stack, context, schemaPath, instancePath, schema, value) {
2486
- const isLength = IsEqual(Keys(value).length, 0);
2487
- const isEveryEntry = EveryAll(Entries(schema.dependentRequired), 0, ([key, keys]) => {
2488
- return !HasPropertyKey(value, key) || EveryAll(keys, 0, (dependency) => HasPropertyKey(value, dependency) || context.AddError({
2489
- keyword: "dependentRequired",
2490
- schemaPath,
2491
- instancePath,
2492
- params: {
2493
- property: key,
2494
- dependencies: keys
2495
- }
2496
- }));
2497
- });
2498
- return isLength || isEveryEntry;
2499
- }
2500
- //#endregion
2501
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/dependentSchemas.mjs
2502
- function CheckDependentSchemas(stack, context, schema, value) {
2503
- const isLength = IsEqual(Keys(value).length, 0);
2504
- const isEvery = Every(Entries(schema.dependentSchemas), 0, ([key, schema]) => {
2505
- return !HasPropertyKey(value, key) || CheckSchema(stack, context, schema, value);
2506
- });
2507
- return isLength || isEvery;
2508
- }
2509
- function ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value) {
2510
- const isLength = IsEqual(Keys(value).length, 0);
2511
- const isEvery = EveryAll(Entries(schema.dependentSchemas), 0, ([key, schema]) => {
2512
- const nextSchemaPath = `${schemaPath}/dependentSchemas/${key}`;
2513
- return !HasPropertyKey(value, key) || ErrorSchema(stack, context, nextSchemaPath, instancePath, schema, value);
2514
- });
2515
- return isLength || isEvery;
2516
- }
2517
- //#endregion
2518
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/dynamicRef.mjs
2519
- function CheckDynamicRef(stack, context, schema, value) {
2520
- const target = stack.DynamicRef(schema) ?? false;
2521
- return IsSchema(target) && CheckSchema(stack, context, target, value);
2522
- }
2523
- function ErrorDynamicRef(stack, context, _schemaPath, instancePath, schema, value) {
2524
- const target = stack.DynamicRef(schema) ?? false;
2525
- return IsSchema(target) && ErrorSchema(stack, context, "#", instancePath, target, value);
2526
- }
2527
- //#endregion
2528
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/enum.mjs
2529
- function CheckEnum(_stack, _context, schema, value) {
2530
- return schema.enum.some((option) => IsValueLike(option) ? IsEqual(value, option) : IsDeepEqual(value, option));
2531
- }
2532
- function ErrorEnum(stack, context, schemaPath, instancePath, schema, value) {
2533
- return CheckEnum(stack, context, schema, value) || context.AddError({
2534
- keyword: "enum",
2535
- schemaPath,
2536
- instancePath,
2537
- params: { allowedValues: schema.enum }
2538
- });
2539
- }
2540
- //#endregion
2541
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs
2542
- function CheckExclusiveMaximum(_stack, _context, schema, value) {
2543
- return IsLessThan(value, schema.exclusiveMaximum);
2544
- }
2545
- function ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value) {
2546
- return CheckExclusiveMaximum(stack, context, schema, value) || context.AddError({
2547
- keyword: "exclusiveMaximum",
2548
- schemaPath,
2549
- instancePath,
2550
- params: {
2551
- comparison: "<",
2552
- limit: schema.exclusiveMaximum
2553
- }
2554
- });
2555
- }
2556
- //#endregion
2557
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs
2558
- function CheckExclusiveMinimum(_stack, _context, schema, value) {
2559
- return IsGreaterThan(value, schema.exclusiveMinimum);
2560
- }
2561
- function ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value) {
2562
- return CheckExclusiveMinimum(stack, context, schema, value) || context.AddError({
2563
- keyword: "exclusiveMinimum",
2564
- schemaPath,
2565
- instancePath,
2566
- params: {
2567
- comparison: ">",
2568
- limit: schema.exclusiveMinimum
2569
- }
2570
- });
2571
- }
2572
- //#endregion
2573
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/date.mjs
2574
- const DAYS = [
2575
- 0,
2576
- 31,
2577
- 28,
2578
- 31,
2579
- 30,
2580
- 31,
2581
- 30,
2582
- 31,
2583
- 31,
2584
- 30,
2585
- 31,
2586
- 30,
2587
- 31
2588
- ];
2589
- const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
2590
- function IsLeapYear(year) {
2591
- return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
2592
- }
2593
- /**
2594
- * Returns true if the value is a ISO8601 Date component string
2595
- * @source ajv-formats
2596
- * @example `2020-12-12`
2597
- */
2598
- function IsDate(value) {
2599
- const matches = DATE.exec(value);
2600
- if (!matches) return false;
2601
- const year = +matches[1];
2602
- const month = +matches[2];
2603
- const day = +matches[3];
2604
- return month >= 1 && month <= 12 && day >= 1 && day <= (month === 2 && IsLeapYear(year) ? 29 : DAYS[month]);
2605
- }
2606
- //#endregion
2607
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/time.mjs
2608
- const TIME = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(?:Z|([+-])(\d\d):(\d\d))?$/i;
2609
- /**
2610
- * Returns true if the value is a ISO time string
2611
- * @specification
2612
- */
2613
- function IsTime(value, strictTimeZone = true) {
2614
- const matches = TIME.exec(value);
2615
- if (!matches) return false;
2616
- const hr = +matches[1];
2617
- const min = +matches[2];
2618
- const sec = +matches[3];
2619
- const tzSign = matches[4] === "-" ? -1 : 1;
2620
- const tzH = +(matches[5] || 0);
2621
- const tzM = +(matches[6] || 0);
2622
- if (tzH > 23 || tzM > 59) return false;
2623
- if (strictTimeZone && !matches[4] && value.toLowerCase().indexOf("z") === -1) return false;
2624
- if (hr <= 23 && min <= 59 && sec < 60) return true;
2625
- const utcMin = min - tzM * tzSign;
2626
- const utcHr = hr - tzH * tzSign - (utcMin < 0 ? 1 : 0);
2627
- return (utcHr === 23 || utcHr === -1) && (utcMin === 59 || utcMin === -1) && sec < 61;
2628
- }
2629
- //#endregion
2630
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/date_time.mjs
2631
- /**
2632
- * Returns true if the value is a ISO8601 DateTime string
2633
- * @source ajv-formats
2634
- * @example `2020-12-12T20:20:40+00:00`
2635
- */
2636
- function IsDateTime(value, strictTimeZone = true) {
2637
- const dateTime = value.split(/T/i);
2638
- return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1], strictTimeZone);
2639
- }
2640
- //#endregion
2641
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/duration.mjs
2642
- const Duration = /^P((\d+Y(\d+M(\d+D)?)?|\d+M(\d+D)?|\d+D)(T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S))?|T(\d+H(\d+M(\d+S)?)?|\d+M(\d+S)?|\d+S)|\d+W)$/;
2643
- /**
2644
- * Returns true if the value is a valid ISO-8601 duration.
2645
- * @specification https://tools.ietf.org/html/rfc3339
2646
- */
2647
- function IsDuration(value) {
2648
- return Duration.test(value);
2649
- }
2650
- //#endregion
2651
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/email.mjs
2652
- const Email = /^(?!.*\.\.)[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i;
2653
- /**
2654
- * Returns true if the value is an Email
2655
- * @specification ajv-formats
2656
- */
2657
- function IsEmail(value) {
2658
- return Email.test(value);
2659
- }
2660
- //#endregion
2661
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/_puny.mjs
2662
- const PUNYCODE_BASE = 36;
2663
- const PUNYCODE_TMIN = 1;
2664
- const PUNYCODE_TMAX = 26;
2665
- const PUNYCODE_SKEW = 38;
2666
- const PUNYCODE_DAMP = 700;
2667
- const PUNYCODE_INITIAL_BIAS = 72;
2668
- const PUNYCODE_INITIAL_N = 128;
2669
- function Adapt(delta, numPoints, firstTime) {
2670
- delta = firstTime ? Math.floor(delta / PUNYCODE_DAMP) : delta >> 1;
2671
- delta += Math.floor(delta / numPoints);
2672
- let k = 0;
2673
- while (delta > 455) {
2674
- delta = Math.floor(delta / (PUNYCODE_BASE - PUNYCODE_TMIN));
2675
- k += PUNYCODE_BASE;
2676
- }
2677
- return k + Math.floor(36 * delta / (delta + PUNYCODE_SKEW));
2678
- }
2679
- function Decode(value) {
2680
- const output = [];
2681
- let n = PUNYCODE_INITIAL_N;
2682
- let i = 0;
2683
- let bias = PUNYCODE_INITIAL_BIAS;
2684
- const delimIdx = value.lastIndexOf("-");
2685
- if (delimIdx > 0) for (let j = 0; j < delimIdx; j++) {
2686
- const cp = value.charCodeAt(j);
2687
- if (cp >= 128) throw new Error("Invalid punycode: non-basic before delimiter");
2688
- output.push(cp);
2689
- }
2690
- let inIdx = delimIdx < 0 ? 0 : delimIdx + 1;
2691
- while (inIdx < value.length) {
2692
- const oldi = i;
2693
- let w = 1;
2694
- let k = PUNYCODE_BASE;
2695
- while (true) {
2696
- if (inIdx >= value.length) throw new Error("Invalid punycode: unexpected end of input");
2697
- const ch = value.charCodeAt(inIdx++);
2698
- let digit;
2699
- if (ch >= 97 && ch <= 122) digit = ch - 97;
2700
- else if (ch >= 48 && ch <= 57) digit = ch - 48 + 26;
2701
- else if (ch >= 65 && ch <= 90) digit = ch - 65;
2702
- else throw new Error("Invalid punycode: bad digit character");
2703
- i += digit * w;
2704
- const t = k <= bias ? PUNYCODE_TMIN : k >= bias + PUNYCODE_TMAX ? PUNYCODE_TMAX : k - bias;
2705
- if (digit < t) break;
2706
- w *= PUNYCODE_BASE - t;
2707
- k += PUNYCODE_BASE;
2708
- }
2709
- const outLen = output.length + 1;
2710
- bias = Adapt(i - oldi, outLen, oldi === 0);
2711
- n += Math.floor(i / outLen);
2712
- i %= outLen;
2713
- output.splice(i, 0, n);
2714
- i++;
2715
- }
2716
- return globalThis.String.fromCodePoint(...output);
2717
- }
2718
- //#endregion
2719
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/_idna.mjs
2720
- function IsNonspacingMark(cp) {
2721
- return /\p{Mn}/u.test(String.fromCodePoint(cp));
2722
- }
2723
- function IsSpacingCombiningMark(cp) {
2724
- return /\p{Mc}/u.test(String.fromCodePoint(cp));
2725
- }
2726
- function IsEnclosingMark(cp) {
2727
- return /\p{Me}/u.test(String.fromCodePoint(cp));
2728
- }
2729
- function IsCombiningMark(cp) {
2730
- return IsNonspacingMark(cp) || IsSpacingCombiningMark(cp) || IsEnclosingMark(cp);
2731
- }
2732
- const RFC5892_DISALLOWED = new Set([
2733
- 1600,
2734
- 2042,
2735
- 12334,
2736
- 12335,
2737
- 12337,
2738
- 12338,
2739
- 12339,
2740
- 12340,
2741
- 12341,
2742
- 12347
2743
- ]);
2744
- const VIRAMA_CPS = new Set([
2745
- 2381,
2746
- 2509,
2747
- 2637,
2748
- 2765,
2749
- 2893,
2750
- 3021,
2751
- 3149,
2752
- 3277,
2753
- 3387,
2754
- 3388,
2755
- 3405,
2756
- 3530,
2757
- 6980,
2758
- 7082,
2759
- 7083,
2760
- 43456,
2761
- 69702,
2762
- 69759,
2763
- 69817,
2764
- 69939,
2765
- 69940,
2766
- 70080,
2767
- 70197,
2768
- 70477,
2769
- 70722,
2770
- 70850,
2771
- 71103,
2772
- 71231,
2773
- 71350,
2774
- 72767,
2775
- 73028,
2776
- 73029
2777
- ]);
2778
- function IsGreek(cp) {
2779
- return /\p{Script=Greek}/u.test(String.fromCodePoint(cp));
2780
- }
2781
- function IsHebrew(cp) {
2782
- return /\p{Script=Hebrew}/u.test(String.fromCodePoint(cp));
2783
- }
2784
- function IsHiragana(cp) {
2785
- return /\p{Script=Hiragana}/u.test(String.fromCodePoint(cp));
2786
- }
2787
- function IsKatakana(cp) {
2788
- return /\p{Script=Katakana}/u.test(String.fromCodePoint(cp));
2789
- }
2790
- function IsHan(cp) {
2791
- return /\p{Script=Han}/u.test(String.fromCodePoint(cp));
2792
- }
2793
- function IsArabicIndicDigit(cp) {
2794
- return cp >= 1632 && cp <= 1641;
2795
- }
2796
- function IsExtendedArabicIndicDigit(cp) {
2797
- return cp >= 1776 && cp <= 1785;
2798
- }
2799
- function IsVirama(cp) {
2800
- return VIRAMA_CPS.has(cp);
2801
- }
2802
- function IsUnicodeLabel(value) {
2803
- if (value.length === 0) return false;
2804
- const cps = [...value].map((c) => c.codePointAt(0));
2805
- const len = cps.length;
2806
- if (cps[0] === 45 || cps[len - 1] === 45) return false;
2807
- if (len >= 4 && cps[2] === 45 && cps[3] === 45) return false;
2808
- if (IsCombiningMark(cps[0])) return false;
2809
- let hasJapanese = false;
2810
- let hasArabicIndic = false;
2811
- let hasExtendedArabicIndic = false;
2812
- for (let i = 0; i < len; i++) {
2813
- const cp = cps[i];
2814
- if (RFC5892_DISALLOWED.has(cp)) return false;
2815
- if (IsHiragana(cp) || IsKatakana(cp) || IsHan(cp)) hasJapanese = true;
2816
- if (IsArabicIndicDigit(cp)) hasArabicIndic = true;
2817
- if (IsExtendedArabicIndicDigit(cp)) hasExtendedArabicIndic = true;
2818
- const prev = cps[i - 1], next = cps[i + 1];
2819
- switch (cp) {
2820
- case 183:
2821
- if (prev !== 108 || next !== 108) return false;
2822
- break;
2823
- case 885:
2824
- if (next === void 0 || !IsGreek(next)) return false;
2825
- break;
2826
- case 1523:
2827
- case 1524:
2828
- if (prev === void 0 || !IsHebrew(prev)) return false;
2829
- break;
2830
- case 8205:
2831
- if (prev === void 0 || !IsVirama(prev)) return false;
2832
- break;
2833
- case 12539: break;
2834
- }
2835
- }
2836
- if (value.includes("・") && !hasJapanese) return false;
2837
- if (hasArabicIndic && hasExtendedArabicIndic) return false;
2838
- return true;
2839
- }
2840
- function IsAsciiLabel(value) {
2841
- if (value.charCodeAt(0) === 45 || value.charCodeAt(value.length - 1) === 45) return false;
2842
- if (value.length >= 4 && value.charCodeAt(2) === 45 && value.charCodeAt(3) === 45) return false;
2843
- for (let i = 0; i < value.length; i++) {
2844
- const ch = value.charCodeAt(i);
2845
- if (!(ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90 || ch >= 48 && ch <= 57 || ch === 45)) return false;
2846
- }
2847
- return true;
2848
- }
2849
- function IsPuny(value) {
2850
- return value.toLowerCase().startsWith("xn--");
2851
- }
2852
- function IsPunyLabel(value) {
2853
- try {
2854
- return IsUnicodeLabel(Decode(value.slice(4)));
2855
- } catch {
2856
- return false;
2857
- }
2858
- }
2859
- function IsIdnLabel(value) {
2860
- if (value.length === 0 || value.length > 63) return false;
2861
- return IsPuny(value) ? IsPunyLabel(value) : IsUnicodeLabel(value);
2862
- }
2863
- function IsLabel(value) {
2864
- if (value.length === 0 || value.length > 63) return false;
2865
- return IsPuny(value) ? IsPunyLabel(value) : IsAsciiLabel(value);
2866
- }
2867
- //#endregion
2868
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/hostname.mjs
2869
- /**
2870
- * Returns true if the value is a valid hostname.
2871
- * @specification https://tools.ietf.org/html/rfc1123
2872
- * @specification https://tools.ietf.org/html/rfc5891
2873
- * @specification https://tools.ietf.org/html/rfc5892
2874
- */
2875
- function IsHostname(value) {
2876
- if (value.length === 0 || value.length > 253) return false;
2877
- if (value.charCodeAt(value.length - 1) === 46) return false;
2878
- for (const label of value.split(".")) if (!IsLabel(label)) return false;
2879
- return true;
2880
- }
2881
- //#endregion
2882
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/idn_email.mjs
2883
- const IdnEmail = /^(?!.*\.\.)[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+(?:\.[\p{L}\p{N}!#$%&'*+/=?^_`{|}~-]+)*@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,61}[\p{L}\p{N}])?)*$/iu;
2884
- /**
2885
- * Returns true if the value is an IdnEmail
2886
- * @specification ajv-formats (unicode-extension)
2887
- */
2888
- function IsIdnEmail(value) {
2889
- return IdnEmail.test(value);
2890
- }
2891
- //#endregion
2892
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/idn_hostname.mjs
2893
- /**
2894
- * Returns true if the value is a valid internationalized (IDN) hostname.
2895
- * @specification https://tools.ietf.org/html/rfc3490
2896
- * @specification https://tools.ietf.org/html/rfc5891
2897
- * @specification https://tools.ietf.org/html/rfc5892
2898
- */
2899
- function IsIdnHostname(value) {
2900
- if (value.length === 0 || value.includes(" ")) return false;
2901
- const canonical = value.normalize("NFC").replace(/[\u002E\u3002\uFF0E\uFF61]/g, ".");
2902
- if (canonical.length > 253) return false;
2903
- for (const label of canonical.split(".")) if (!IsIdnLabel(label)) return false;
2904
- return true;
2905
- }
2906
- //#endregion
2907
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/ipv4.mjs
2908
- function IsIPv4Internal(value, start, end) {
2909
- let dots = 0;
2910
- let num = 0;
2911
- let digits = 0;
2912
- let leading = 0;
2913
- for (let i = start; i < end; i++) {
2914
- const ch = value.charCodeAt(i);
2915
- if (ch === 46) {
2916
- if (digits === 0 || num > 255 || leading === 48 && digits > 1) return false;
2917
- dots++;
2918
- num = 0;
2919
- digits = 0;
2920
- leading = 0;
2921
- } else if (ch >= 48 && ch <= 57) {
2922
- if (digits === 0) leading = ch;
2923
- num = num * 10 + (ch - 48);
2924
- digits++;
2925
- } else return false;
2926
- }
2927
- return dots === 3 && digits > 0 && num <= 255 && !(leading === 48 && digits > 1);
2928
- }
2929
- /**
2930
- * Returns true if the value is a IPV4 address
2931
- * @specification http://tools.ietf.org/html/rfc2673#section-3.2
2932
- */
2933
- function IsIPv4(value) {
2934
- return IsIPv4Internal(value, 0, value.length);
2935
- }
2936
- //#endregion
2937
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/ipv6.mjs
2938
- function InRange(ch) {
2939
- return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102;
2940
- }
2941
- /**
2942
- * Returns true if the value is an IPv6 address
2943
- * @specification http://tools.ietf.org/html/rfc2373#section-2.2
2944
- */
2945
- function IsIPv6(value) {
2946
- const length = value.length;
2947
- if (length === 0) return false;
2948
- let groups = 0;
2949
- let compressed = false;
2950
- let i = 0;
2951
- if (value.charCodeAt(0) === 58 && value.charCodeAt(1) === 58) {
2952
- if (length === 2) return true;
2953
- compressed = true;
2954
- i = 2;
2955
- }
2956
- while (i < length) {
2957
- let digits = 0;
2958
- const start = i;
2959
- while (i < length && InRange(value.charCodeAt(i))) {
2960
- i++;
2961
- digits++;
2962
- }
2963
- if (digits === 0) return false;
2964
- const next = value.charCodeAt(i);
2965
- if (next === 46) {
2966
- if (!IsIPv4Internal(value, start, length)) return false;
2967
- groups += 2;
2968
- i = length;
2969
- break;
2970
- }
2971
- if (digits > 4) return false;
2972
- groups++;
2973
- if (i === length) break;
2974
- if (next !== 58) return false;
2975
- i++;
2976
- if (value.charCodeAt(i) === 58) {
2977
- if (compressed) return false;
2978
- if (value.charCodeAt(i + 1) === 58) return false;
2979
- compressed = true;
2980
- i++;
2981
- if (i === length) break;
2982
- }
2983
- }
2984
- return compressed ? groups <= 7 : groups === 8;
2985
- }
2986
- //#endregion
2987
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/iri_reference.mjs
2988
- function TryUrl(value) {
2989
- try {
2990
- new URL(value, "http://example.com");
2991
- return true;
2992
- } catch {
2993
- return false;
2994
- }
2995
- }
2996
- /**
2997
- * Returns true if the value is a Iri reference
2998
- * @specification
2999
- */
3000
- function IsIriReference(value) {
3001
- if (value.includes(" ")) return false;
3002
- if (value.includes("\\")) return false;
3003
- if (/[\x00-\x1F\x7F]/.test(value)) return false;
3004
- if (/%(?![0-9a-fA-F]{2})/.test(value)) return false;
3005
- if (value === "") return true;
3006
- const colonIndex = value.indexOf(":");
3007
- if (colonIndex > 0 && /^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(value.substring(0, colonIndex))) return TryUrl(value);
3008
- else {
3009
- if (value.match(/^([a-zA-Z][a-zA-Z0-9+\-.]*)(\/\/)/) && colonIndex === -1) return false;
3010
- return TryUrl(value);
3011
- }
3012
- }
3013
- //#endregion
3014
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/iri.mjs
3015
- /**
3016
- * Returns true if the value is a Iri
3017
- * @specification
3018
- */
3019
- function IsIri(value) {
3020
- try {
3021
- new URL(value);
3022
- return true;
3023
- } catch {
3024
- return false;
3025
- }
3026
- }
3027
- //#endregion
3028
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs
3029
- const JsonPointerUriFragment = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
3030
- /**
3031
- * Returns true if the value is a json pointer uri fragment
3032
- * @specification
3033
- * @source ajv-formats
3034
- */
3035
- function IsJsonPointerUriFragment(value) {
3036
- return JsonPointerUriFragment.test(value);
3037
- }
3038
- //#endregion
3039
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/json_pointer.mjs
3040
- const JsonPointer = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
3041
- /**
3042
- * Returns true if the value is a json pointer
3043
- * @specification
3044
- * @source ajv-formats
3045
- */
3046
- function IsJsonPointer(value) {
3047
- return JsonPointer.test(value);
3048
- }
3049
- //#endregion
3050
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/regex.mjs
3051
- /**
3052
- * Returns true if the value is a regular expression string pattern
3053
- * @specification
3054
- * @source ajv-formats
3055
- */
3056
- function IsRegex(value) {
3057
- if (value.length === 0) return false;
3058
- try {
3059
- new RegExp(value);
3060
- return true;
3061
- } catch {
3062
- return false;
3063
- }
3064
- }
3065
- //#endregion
3066
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/relative_json_pointer.mjs
3067
- const RelativeJsonPointer = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
3068
- /**
3069
- * Returns true if the value is a relative json pointer
3070
- * @specification
3071
- * @source ajv-formats
3072
- */
3073
- function IsRelativeJsonPointer(value) {
3074
- return RelativeJsonPointer.test(value);
3075
- }
3076
- //#endregion
3077
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/uri_reference.mjs
3078
- const UriReference = /^(?!.*[^\x00-\x7F])(?!.*\\)(?:(?:[a-z][a-z0-9+\-.]*:)?(?:\/\/[^\s[\]{}<>^`|]*)?|[^\s[\]{}<>^`|]*)(?:\?[^\s[\]{}<>^`|]*)?(?:#[^\s[\]{}<>^`|]*)?$/i;
3079
- /**
3080
- * Returns true if the value is a valid URI Reference.
3081
- * @specification https://tools.ietf.org/html/rfc3986
3082
- */
3083
- function IsUriReference(value) {
3084
- return UriReference.test(value);
3085
- }
3086
- //#endregion
3087
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/uri_template.mjs
3088
- const UriTemplate = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
3089
- /**
3090
- * Returns true if the value is a uri template
3091
- * @specification
3092
- * @source ajv-formats
3093
- */
3094
- function IsUriTemplate(value) {
3095
- return UriTemplate.test(value);
3096
- }
3097
- //#endregion
3098
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/uri.mjs
3099
- function IsAlpha(ch) {
3100
- return ch >= 97 && ch <= 122 || ch >= 65 && ch <= 90;
3101
- }
3102
- function IsAlphaNumeric(ch) {
3103
- return IsAlpha(ch) || ch >= 48 && ch <= 57;
3104
- }
3105
- function IsHex(ch) {
3106
- return ch >= 48 && ch <= 57 || ch >= 65 && ch <= 70 || ch >= 97 && ch <= 102;
3107
- }
3108
- function IsSchemeChar(ch) {
3109
- return IsAlphaNumeric(ch) || ch === 43 || ch === 45 || ch === 46;
3110
- }
3111
- function IsUnreserved(ch) {
3112
- return IsAlphaNumeric(ch) || ch === 45 || ch === 46 || ch === 95 || ch === 126;
3113
- }
3114
- function IsSubDelim(ch) {
3115
- return ch === 33 || ch === 36 || ch === 38 || ch === 39 || ch === 40 || ch === 41 || ch === 42 || ch === 43 || ch === 44 || ch === 59 || ch === 61;
3116
- }
3117
- function IsPchar(ch) {
3118
- return IsUnreserved(ch) || IsSubDelim(ch) || ch === 58 || ch === 64;
3119
- }
3120
- /**
3121
- * Returns true if the value matches RFC 3986 URI syntax.
3122
- * @specification https://tools.ietf.org/html/rfc3986
3123
- */
3124
- function IsUri(value) {
3125
- const length = value.length;
3126
- if (length === 0) return false;
3127
- if (!IsAlpha(value.charCodeAt(0))) return false;
3128
- let i = 1;
3129
- while (i < length) {
3130
- const ch = value.charCodeAt(i);
3131
- if (ch === 58) break;
3132
- if (!IsSchemeChar(ch)) return false;
3133
- i++;
3134
- }
3135
- if (value.charCodeAt(i) !== 58) return false;
3136
- i++;
3137
- if (value.charCodeAt(i) === 47 && value.charCodeAt(i + 1) === 47) {
3138
- i += 2;
3139
- const authorityStart = i;
3140
- let atPos = -1;
3141
- for (let j = i; j < length; j++) {
3142
- const ch = value.charCodeAt(j);
3143
- if (ch === 64) {
3144
- atPos = j;
3145
- break;
3146
- }
3147
- if (ch === 47 || ch === 63 || ch === 35) break;
3148
- }
3149
- if (atPos !== -1) {
3150
- for (let j = authorityStart; j < atPos; j++) {
3151
- const ch = value.charCodeAt(j);
3152
- if (ch === 91 || ch === 93) return false;
3153
- if (ch === 37) {
3154
- if (j + 2 >= atPos || !IsHex(value.charCodeAt(j + 1)) || !IsHex(value.charCodeAt(j + 2))) return false;
3155
- j += 2;
3156
- } else if (!IsUnreserved(ch) && !IsSubDelim(ch) && ch !== 58) return false;
3157
- }
3158
- i = atPos + 1;
3159
- }
3160
- if (value.charCodeAt(i) === 91) {
3161
- i++;
3162
- while (i < length && value.charCodeAt(i) !== 93) i++;
3163
- if (value.charCodeAt(i) !== 93) return false;
3164
- i++;
3165
- } else while (i < length) {
3166
- const ch = value.charCodeAt(i);
3167
- if (ch === 47 || ch === 63 || ch === 35 || ch === 58) break;
3168
- if (ch < 128 && !IsUnreserved(ch) && !IsSubDelim(ch)) return false;
3169
- i++;
3170
- }
3171
- if (value.charCodeAt(i) === 58) {
3172
- i++;
3173
- while (i < length) {
3174
- const ch = value.charCodeAt(i);
3175
- if (ch === 47 || ch === 63 || ch === 35) break;
3176
- if (ch < 48 || ch > 57) return false;
3177
- i++;
3178
- }
3179
- }
3180
- }
3181
- while (i < length) {
3182
- const ch = value.charCodeAt(i);
3183
- if (ch === 37) {
3184
- if (i + 2 >= length || !IsHex(value.charCodeAt(i + 1)) || !IsHex(value.charCodeAt(i + 2))) return false;
3185
- i += 2;
3186
- } else if (ch > 127) return false;
3187
- else if (!(IsPchar(ch) || ch === 47 || ch === 63 || ch === 35)) return false;
3188
- i++;
3189
- }
3190
- return true;
3191
- }
3192
- //#endregion
3193
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/url.mjs
3194
- const Url = /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
3195
- /**
3196
- * Returns true if the value is a Url
3197
- * @specification
3198
- * @source ajv-formats
3199
- */
3200
- function IsUrl(value) {
3201
- return Url.test(value);
3202
- }
3203
- //#endregion
3204
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/uuid.mjs
3205
- const Uuid = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
3206
- /**
3207
- * Returns true if the value is a uuid
3208
- * @specification
3209
- * @source ajv-formats
3210
- */
3211
- function IsUuid(value) {
3212
- return Uuid.test(value);
3213
- }
3214
- //#endregion
3215
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/format/_registry.mjs
3216
- const formats = /* @__PURE__ */ new Map();
3217
- /** Clears all entries */
3218
- function Clear() {
3219
- formats.clear();
3220
- }
3221
- /** Tests a value against a format, if the format is not registered, true */
3222
- function Test(format, value) {
3223
- return formats.get(format)?.(value) ?? true;
3224
- }
3225
- /** Resets all formats to defaults */
3226
- function Reset() {
3227
- Clear();
3228
- formats.set("date-time", IsDateTime);
3229
- formats.set("date", IsDate);
3230
- formats.set("duration", IsDuration);
3231
- formats.set("email", IsEmail);
3232
- formats.set("hostname", IsHostname);
3233
- formats.set("idn-email", IsIdnEmail);
3234
- formats.set("idn-hostname", IsIdnHostname);
3235
- formats.set("ipv4", IsIPv4);
3236
- formats.set("ipv6", IsIPv6);
3237
- formats.set("iri-reference", IsIriReference);
3238
- formats.set("iri", IsIri);
3239
- formats.set("json-pointer-uri-fragment", IsJsonPointerUriFragment);
3240
- formats.set("json-pointer", IsJsonPointer);
3241
- formats.set("regex", IsRegex);
3242
- formats.set("relative-json-pointer", IsRelativeJsonPointer);
3243
- formats.set("time", IsTime);
3244
- formats.set("uri-reference", IsUriReference);
3245
- formats.set("uri-template", IsUriTemplate);
3246
- formats.set("uri", IsUri);
3247
- formats.set("url", IsUrl);
3248
- formats.set("uuid", IsUuid);
3249
- }
3250
- Reset();
3251
- //#endregion
3252
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/format.mjs
3253
- function CheckFormat(_stack, _context, schema, value) {
3254
- return Test(schema.format, value);
3255
- }
3256
- function ErrorFormat(stack, context, schemaPath, instancePath, schema, value) {
3257
- return CheckFormat(stack, context, schema, value) || context.AddError({
3258
- keyword: "format",
3259
- schemaPath,
3260
- instancePath,
3261
- params: { format: schema.format }
3262
- });
3263
- }
3264
- //#endregion
3265
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/if.mjs
3266
- function CheckIf(stack, context, schema, value) {
3267
- const thenSchema = IsThen(schema) ? schema.then : true;
3268
- const elseSchema = IsElse(schema) ? schema.else : true;
3269
- return CheckSchema(stack, context, schema.if, value) ? CheckSchema(stack, context, thenSchema, value) : CheckSchema(stack, context, elseSchema, value);
3270
- }
3271
- function ErrorIf(stack, context, schemaPath, instancePath, schema, value) {
3272
- const thenSchema = IsThen(schema) ? schema.then : true;
3273
- const elseSchema = IsElse(schema) ? schema.else : true;
3274
- const trueContext = new AccumulatedErrorContext();
3275
- const isIf = ErrorSchema(stack, trueContext, `${schemaPath}/if`, instancePath, schema.if, value) ? ErrorSchema(stack, trueContext, `${schemaPath}/then`, instancePath, thenSchema, value) || context.AddError({
3276
- keyword: "if",
3277
- schemaPath,
3278
- instancePath,
3279
- params: { failingKeyword: "then" }
3280
- }) : ErrorSchema(stack, context, `${schemaPath}/else`, instancePath, elseSchema, value) || context.AddError({
3281
- keyword: "if",
3282
- schemaPath,
3283
- instancePath,
3284
- params: { failingKeyword: "else" }
3285
- });
3286
- if (isIf) context.Merge([trueContext]);
3287
- return isIf;
3288
- }
3289
- //#endregion
3290
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/items.mjs
3291
- function CheckItemsSized(stack, context, schema, value) {
3292
- return Every(schema.items, 0, (schema, index) => {
3293
- return IsLessEqualThan(value.length, index) || CheckSchemaPushStack(stack, context, schema, value[index]) && context.AddIndex(index);
3294
- });
3295
- }
3296
- function ErrorItemsSized(stack, context, schemaPath, instancePath, schema, value) {
3297
- return EveryAll(schema.items, 0, (schema, index) => {
3298
- const nextSchemaPath = `${schemaPath}/items/${index}`;
3299
- const nextInstancePath = `${instancePath}/${index}`;
3300
- return IsLessEqualThan(value.length, index) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value[index]) && context.AddIndex(index);
3301
- });
3302
- }
3303
- function CheckItemsUnsized(stack, context, schema, value) {
3304
- return Every(value, IsPrefixItems(schema) ? schema.prefixItems.length : 0, (element, index) => {
3305
- return CheckSchemaPushStack(stack, context, schema.items, element) && context.AddIndex(index);
3306
- });
3307
- }
3308
- function ErrorItemsUnsized(stack, context, schemaPath, instancePath, schema, value) {
3309
- return EveryAll(value, IsPrefixItems(schema) ? schema.prefixItems.length : 0, (element, index) => {
3310
- return ErrorSchemaPushStack(stack, context, `${schemaPath}/items`, `${instancePath}/${index}`, schema.items, element) && context.AddIndex(index);
3311
- });
3312
- }
3313
- function CheckItems(stack, context, schema, value) {
3314
- return IsItemsSized(schema) ? CheckItemsSized(stack, context, schema, value) : CheckItemsUnsized(stack, context, schema, value);
3315
- }
3316
- function ErrorItems(stack, context, schemaPath, instancePath, schema, value) {
3317
- return IsItemsSized(schema) ? ErrorItemsSized(stack, context, schemaPath, instancePath, schema, value) : ErrorItemsUnsized(stack, context, schemaPath, instancePath, schema, value);
3318
- }
3319
- //#endregion
3320
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/maxContains.mjs
3321
- function IsValid$2(schema) {
3322
- return IsContains(schema);
3323
- }
3324
- function CheckMaxContains(stack, context, schema, value) {
3325
- if (!IsValid$2(schema)) return true;
3326
- return IsLessEqualThan(value.reduce((result, item) => CheckSchema(stack, context, schema.contains, item) ? ++result : result, 0), schema.maxContains);
3327
- }
3328
- function ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value) {
3329
- const minContains = IsMinContains(schema) ? schema.minContains : 1;
3330
- return CheckMaxContains(stack, context, schema, value) || context.AddError({
3331
- keyword: "contains",
3332
- schemaPath,
3333
- instancePath,
3334
- params: {
3335
- minContains,
3336
- maxContains: schema.maxContains
3337
- }
3338
- });
3339
- }
3340
- //#endregion
3341
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/maximum.mjs
3342
- function CheckMaximum(_stack, _context, schema, value) {
3343
- return IsLessEqualThan(value, schema.maximum);
3344
- }
3345
- function ErrorMaximum(stack, context, schemaPath, instancePath, schema, value) {
3346
- return CheckMaximum(stack, context, schema, value) || context.AddError({
3347
- keyword: "maximum",
3348
- schemaPath,
3349
- instancePath,
3350
- params: {
3351
- comparison: "<=",
3352
- limit: schema.maximum
3353
- }
3354
- });
3355
- }
3356
- //#endregion
3357
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/maxItems.mjs
3358
- function CheckMaxItems(_stack, _context, schema, value) {
3359
- return IsLessEqualThan(value.length, schema.maxItems);
3360
- }
3361
- function ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value) {
3362
- return CheckMaxItems(stack, context, schema, value) || context.AddError({
3363
- keyword: "maxItems",
3364
- schemaPath,
3365
- instancePath,
3366
- params: { limit: schema.maxItems }
3367
- });
3368
- }
3369
- //#endregion
3370
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/maxLength.mjs
3371
- function CheckMaxLength(_stack, _context, schema, value) {
3372
- return IsMaxLength$1(value, schema.maxLength);
3373
- }
3374
- function ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value) {
3375
- return CheckMaxLength(stack, context, schema, value) || context.AddError({
3376
- keyword: "maxLength",
3377
- schemaPath,
3378
- instancePath,
3379
- params: { limit: schema.maxLength }
3380
- });
3381
- }
3382
- //#endregion
3383
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/maxProperties.mjs
3384
- function CheckMaxProperties(_stack, _context, schema, value) {
3385
- return IsLessEqualThan(Keys(value).length, schema.maxProperties);
3386
- }
3387
- function ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value) {
3388
- return CheckMaxProperties(stack, context, schema, value) || context.AddError({
3389
- keyword: "maxProperties",
3390
- schemaPath,
3391
- instancePath,
3392
- params: { limit: schema.maxProperties }
3393
- });
3394
- }
3395
- //#endregion
3396
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/minContains.mjs
3397
- function IsValid$1(schema) {
3398
- return IsContains(schema);
3399
- }
3400
- function CheckMinContains(stack, context, schema, value) {
3401
- if (!IsValid$1(schema)) return true;
3402
- return IsGreaterEqualThan(value.reduce((result, item) => CheckSchema(stack, context, schema.contains, item) ? ++result : result, 0), schema.minContains);
3403
- }
3404
- function ErrorMinContains(stack, context, schemaPath, instancePath, schema, value) {
3405
- return CheckMinContains(stack, context, schema, value) || context.AddError({
3406
- keyword: "contains",
3407
- schemaPath,
3408
- instancePath,
3409
- params: { minContains: schema.minContains }
3410
- });
3411
- }
3412
- //#endregion
3413
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/minimum.mjs
3414
- function CheckMinimum(_stack, _context, schema, value) {
3415
- return IsGreaterEqualThan(value, schema.minimum);
3416
- }
3417
- function ErrorMinimum(stack, context, schemaPath, instancePath, schema, value) {
3418
- return CheckMinimum(stack, context, schema, value) || context.AddError({
3419
- keyword: "minimum",
3420
- schemaPath,
3421
- instancePath,
3422
- params: {
3423
- comparison: ">=",
3424
- limit: schema.minimum
3425
- }
3426
- });
3427
- }
3428
- //#endregion
3429
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/minItems.mjs
3430
- function CheckMinItems(_stack, _context, schema, value) {
3431
- return IsGreaterEqualThan(value.length, schema.minItems);
3432
- }
3433
- function ErrorMinItems(stack, context, schemaPath, instancePath, schema, value) {
3434
- return CheckMinItems(stack, context, schema, value) || context.AddError({
3435
- keyword: "minItems",
3436
- schemaPath,
3437
- instancePath,
3438
- params: { limit: schema.minItems }
3439
- });
3440
- }
3441
- //#endregion
3442
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/minLength.mjs
3443
- function CheckMinLength(_stack, _context, schema, value) {
3444
- return IsMinLength$1(value, schema.minLength);
3445
- }
3446
- function ErrorMinLength(stack, context, schemaPath, instancePath, schema, value) {
3447
- return CheckMinLength(stack, context, schema, value) || context.AddError({
3448
- keyword: "minLength",
3449
- schemaPath,
3450
- instancePath,
3451
- params: { limit: schema.minLength }
3452
- });
3453
- }
3454
- //#endregion
3455
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/minProperties.mjs
3456
- function CheckMinProperties(_stack, _context, schema, value) {
3457
- return IsGreaterEqualThan(Keys(value).length, schema.minProperties);
3458
- }
3459
- function ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value) {
3460
- return CheckMinProperties(stack, context, schema, value) || context.AddError({
3461
- keyword: "minProperties",
3462
- schemaPath,
3463
- instancePath,
3464
- params: { limit: schema.minProperties }
3465
- });
3466
- }
3467
- //#endregion
3468
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/multipleOf.mjs
3469
- function CheckMultipleOf(_stack, _context, schema, value) {
3470
- return IsMultipleOf$1(value, schema.multipleOf);
3471
- }
3472
- function ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value) {
3473
- return CheckMultipleOf(stack, context, schema, value) || context.AddError({
3474
- keyword: "multipleOf",
3475
- schemaPath,
3476
- instancePath,
3477
- params: { multipleOf: schema.multipleOf }
3478
- });
3479
- }
3480
- //#endregion
3481
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/not.mjs
3482
- function CheckNot(stack, context, schema, value) {
3483
- const nextContext = new CheckContext();
3484
- return !CheckSchema(stack, nextContext, schema.not, value) && context.Merge([nextContext]);
3485
- }
3486
- function ErrorNot(stack, context, schemaPath, instancePath, schema, value) {
3487
- return CheckNot(stack, context, schema, value) || context.AddError({
3488
- keyword: "not",
3489
- schemaPath,
3490
- instancePath,
3491
- params: {}
3492
- });
3493
- }
3494
- //#endregion
3495
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/oneOf.mjs
3496
- function CheckOneOf(stack, context, schema, value) {
3497
- const passedContexts = schema.oneOf.reduce((result, schema) => {
3498
- const nextContext = new CheckContext();
3499
- return CheckSchema(stack, nextContext, schema, value) ? [...result, nextContext] : result;
3500
- }, []);
3501
- return IsEqual(passedContexts.length, 1) && context.Merge(passedContexts);
3502
- }
3503
- function ErrorOneOf(stack, context, schemaPath, instancePath, schema, value) {
3504
- const failedContexts = [];
3505
- const passingSchemas = [];
3506
- const passedContexts = schema.oneOf.reduce((result, schema, index) => {
3507
- const nextContext = new AccumulatedErrorContext();
3508
- const isSchema = ErrorSchema(stack, nextContext, `${schemaPath}/oneOf/${index}`, instancePath, schema, value);
3509
- if (isSchema) passingSchemas.push(index);
3510
- if (!isSchema) failedContexts.push(nextContext);
3511
- return isSchema ? [...result, nextContext] : result;
3512
- }, []);
3513
- const isOneOf = IsEqual(passedContexts.length, 1) && context.Merge(passedContexts);
3514
- if (!isOneOf && IsEqual(passingSchemas.length, 0)) failedContexts.forEach((failed) => failed.GetErrors().forEach((error) => context.AddError(error)));
3515
- return isOneOf || context.AddError({
3516
- keyword: "oneOf",
3517
- schemaPath,
3518
- instancePath,
3519
- params: { passingSchemas }
3520
- });
3521
- }
3522
- //#endregion
3523
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/pattern.mjs
3524
- function CheckPattern(_stack, _context, schema, value) {
3525
- return (IsString$1(schema.pattern) ? new RegExp(schema.pattern, "u") : schema.pattern).test(value);
3526
- }
3527
- function ErrorPattern(stack, context, schemaPath, instancePath, schema, value) {
3528
- return CheckPattern(stack, context, schema, value) || context.AddError({
3529
- keyword: "pattern",
3530
- schemaPath,
3531
- instancePath,
3532
- params: { pattern: schema.pattern }
3533
- });
3534
- }
3535
- //#endregion
3536
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/patternProperties.mjs
3537
- function CheckPatternProperties(stack, context, schema, value) {
3538
- return Every(Entries(schema.patternProperties), 0, ([pattern, schema]) => {
3539
- const regexp = new RegExp(pattern, "u");
3540
- return Every(Entries(value), 0, ([key, prop]) => {
3541
- return !regexp.test(key) || CheckSchemaPushStack(stack, context, schema, prop) && context.AddKey(key);
3542
- });
3543
- });
3544
- }
3545
- function ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value) {
3546
- return EveryAll(Entries(schema.patternProperties), 0, ([pattern, schema]) => {
3547
- const nextSchemaPath = `${schemaPath}/patternProperties/${pattern}`;
3548
- const regexp = new RegExp(pattern, "u");
3549
- return EveryAll(Entries(value), 0, ([key, value]) => {
3550
- const nextInstancePath = `${instancePath}/${key}`;
3551
- return !regexp.test(key) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value) && context.AddKey(key);
3552
- });
3553
- });
3554
- }
3555
- //#endregion
3556
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/prefixItems.mjs
3557
- function CheckPrefixItems(stack, context, schema, value) {
3558
- return IsEqual(value.length, 0) || Every(schema.prefixItems, 0, (schema, index) => {
3559
- return IsLessEqualThan(value.length, index) || CheckSchemaPushStack(stack, context, schema, value[index]) && context.AddIndex(index);
3560
- });
3561
- }
3562
- function ErrorPrefixItems(stack, context, schemaPath, instancePath, schema, value) {
3563
- return IsEqual(value.length, 0) || EveryAll(schema.prefixItems, 0, (schema, index) => {
3564
- const nextSchemaPath = `${schemaPath}/prefixItems/${index}`;
3565
- const nextInstancePath = `${instancePath}/${index}`;
3566
- return IsLessEqualThan(value.length, index) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value[index]) && context.AddIndex(index);
3567
- });
3568
- }
3569
- //#endregion
3570
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/system/settings/settings.mjs
3571
- const settings = {
3572
- immutableTypes: false,
3573
- maxErrors: 8,
3574
- useAcceleration: true,
3575
- exactOptionalPropertyTypes: false,
3576
- enumerableKind: false,
3577
- correctiveParse: false
3578
- };
3579
- /** Gets current system settings */
3580
- function Get$2() {
3581
- return settings;
3582
- }
3583
- //#endregion
3584
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/_exact_optional.mjs
3585
- function IsExactOptional(required, key) {
3586
- return required.includes(key) || Get$2().exactOptionalPropertyTypes;
3587
- }
3588
- function InexactOptionalCheck(value, key) {
3589
- return IsUndefined(value[key]);
3590
- }
3591
- //#endregion
3592
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/properties.mjs
3593
- function CheckProperties(stack, context, schema, value) {
3594
- const required = IsRequired(schema) ? schema.required : [];
3595
- return Every(Entries(schema.properties), 0, ([key, schema]) => {
3596
- const isProperty = !HasPropertyKey(value, key) || CheckSchemaPushStack(stack, context, schema, value[key]) && context.AddKey(key);
3597
- return IsExactOptional(required, key) ? isProperty : InexactOptionalCheck(value, key) || isProperty;
3598
- });
3599
- }
3600
- function ErrorProperties(stack, context, schemaPath, instancePath, schema, value) {
3601
- const required = IsRequired(schema) ? schema.required : [];
3602
- return EveryAll(Entries(schema.properties), 0, ([key, schema]) => {
3603
- const nextSchemaPath = `${schemaPath}/properties/${key}`;
3604
- const nextInstancePath = `${instancePath}/${key}`;
3605
- const isProperty = () => !HasPropertyKey(value, key) || ErrorSchemaPushStack(stack, context, nextSchemaPath, nextInstancePath, schema, value[key]) && context.AddKey(key);
3606
- return IsExactOptional(required, key) ? isProperty() : InexactOptionalCheck(value, key) || isProperty();
3607
- });
3608
- }
3609
- //#endregion
3610
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/propertyNames.mjs
3611
- function CheckPropertyNames(stack, context, schema, value) {
3612
- return Every(Keys(value), 0, (key, _index) => CheckSchema(stack, context, schema.propertyNames, key));
3613
- }
3614
- function ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value) {
3615
- const propertyNames = [];
3616
- return EveryAll(Keys(value), 0, (key, _index) => {
3617
- const nextInstancePath = `${instancePath}/${key}`;
3618
- const nextSchemaPath = `${schemaPath}/propertyNames`;
3619
- const isPropertyName = ErrorSchema(stack, new AccumulatedErrorContext(), nextSchemaPath, nextInstancePath, schema.propertyNames, key);
3620
- if (!isPropertyName) propertyNames.push(key);
3621
- return isPropertyName;
3622
- }) || context.AddError({
3623
- keyword: "propertyNames",
3624
- schemaPath,
3625
- instancePath,
3626
- params: { propertyNames }
3627
- });
3628
- }
3629
- //#endregion
3630
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/recursiveRef.mjs
3631
- function CheckRecursiveRef(stack, context, schema, value) {
3632
- const target = stack.RecursiveRef(schema) ?? false;
3633
- return IsSchema(target) && CheckSchema(stack, context, target, value);
3634
- }
3635
- function ErrorRecursiveRef(stack, context, _schemaPath, instancePath, schema, value) {
3636
- const target = stack.RecursiveRef(schema) ?? false;
3637
- return IsSchema(target) && ErrorSchema(stack, context, "#", instancePath, target, value);
3638
- }
3639
- //#endregion
3640
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/ref.mjs
3641
- function CheckRef(stack, context, schema, value) {
3642
- const target = stack.Ref(schema) ?? false;
3643
- const nextContext = new CheckContext();
3644
- const result = IsSchema(target) && CheckSchema(stack, nextContext, target, value);
3645
- if (result) context.Merge([nextContext]);
3646
- return result;
3647
- }
3648
- function ErrorRef(stack, context, _schemaPath, instancePath, schema, value) {
3649
- const target = stack.Ref(schema) ?? false;
3650
- const nextContext = new AccumulatedErrorContext();
3651
- const result = IsSchema(target) && ErrorSchema(stack, nextContext, "#", instancePath, target, value);
3652
- if (result) context.Merge([nextContext]);
3653
- if (!result) nextContext.GetErrors().forEach((error) => context.AddError(error));
3654
- return result;
3655
- }
3656
- //#endregion
3657
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/required.mjs
3658
- function CheckRequired(_stack, _context, schema, value) {
3659
- return Every(schema.required, 0, (key) => HasPropertyKey(value, key));
3660
- }
3661
- function ErrorRequired(_stack, context, schemaPath, instancePath, schema, value) {
3662
- const requiredProperties = [];
3663
- return EveryAll(schema.required, 0, (key) => {
3664
- const hasKey = HasPropertyKey(value, key);
3665
- if (!hasKey) requiredProperties.push(key);
3666
- return hasKey;
3667
- }) || context.AddError({
3668
- keyword: "required",
3669
- schemaPath,
3670
- instancePath,
3671
- params: { requiredProperties }
3672
- });
3673
- }
3674
- //#endregion
3675
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/type.mjs
3676
- function CheckTypeName(_stack, _context, type, _schema, value) {
3677
- return IsEqual(type, "object") ? IsObjectNotArray(value) : IsEqual(type, "array") ? IsArray(value) : IsEqual(type, "boolean") ? IsBoolean$1(value) : IsEqual(type, "integer") ? IsInteger(value) : IsEqual(type, "number") ? IsNumber$1(value) : IsEqual(type, "null") ? IsNull(value) : IsEqual(type, "string") ? IsString$1(value) : IsEqual(type, "asyncIterator") ? IsAsyncIterator(value) : IsEqual(type, "bigint") ? IsBigInt(value) : IsEqual(type, "constructor") ? IsConstructor(value) : IsEqual(type, "function") ? IsFunction(value) : IsEqual(type, "iterator") ? IsIterator(value) : IsEqual(type, "symbol") ? IsSymbol(value) : IsEqual(type, "undefined") ? IsUndefined(value) : IsEqual(type, "void") ? IsUndefined(value) : true;
3678
- }
3679
- function CheckTypeNames(stack, context, types, schema, value) {
3680
- return types.some((type) => CheckTypeName(stack, context, type, schema, value));
3681
- }
3682
- function CheckType(stack, context, schema, value) {
3683
- return IsArray(schema.type) ? CheckTypeNames(stack, context, schema.type, schema, value) : CheckTypeName(stack, context, schema.type, schema, value);
3684
- }
3685
- function ErrorType(stack, context, schemaPath, instancePath, schema, value) {
3686
- return (IsArray(schema.type) ? CheckTypeNames(stack, context, schema.type, schema, value) : CheckTypeName(stack, context, schema.type, schema, value)) || context.AddError({
3687
- keyword: "type",
3688
- schemaPath,
3689
- instancePath,
3690
- params: { type: schema.type }
3691
- });
3692
- }
3693
- //#endregion
3694
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs
3695
- function CheckUnevaluatedItems(stack, context, schema, value) {
3696
- const indices = context.GetIndices();
3697
- return Every(value, 0, (item, index) => {
3698
- return (indices.has(index) || CheckSchema(stack, context, schema.unevaluatedItems, item)) && context.AddIndex(index);
3699
- });
3700
- }
3701
- function ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema, value) {
3702
- const indices = context.GetIndices();
3703
- const unevaluatedItems = [];
3704
- return EveryAll(value, 0, (item, index) => {
3705
- const nextContext = new AccumulatedErrorContext();
3706
- const isEvaluatedItem = (indices.has(index) || ErrorSchema(stack, nextContext, schemaPath, instancePath, schema.unevaluatedItems, item)) && context.AddIndex(index);
3707
- if (!isEvaluatedItem) unevaluatedItems.push(index);
3708
- return isEvaluatedItem;
3709
- }) || context.AddError({
3710
- keyword: "unevaluatedItems",
3711
- schemaPath,
3712
- instancePath,
3713
- params: { unevaluatedItems }
3714
- });
3715
- }
3716
- //#endregion
3717
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs
3718
- function CheckUnevaluatedProperties(stack, context, schema, value) {
3719
- const keys = context.GetKeys();
3720
- return Every(Entries(value), 0, ([key, prop]) => {
3721
- return keys.has(key) || CheckSchema(stack, context, schema.unevaluatedProperties, prop) && context.AddKey(key);
3722
- });
3723
- }
3724
- function ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema, value) {
3725
- const keys = context.GetKeys();
3726
- const unevaluatedProperties = [];
3727
- return EveryAll(Entries(value), 0, ([key, prop]) => {
3728
- const nextContext = new AccumulatedErrorContext();
3729
- const isEvaluatedProperty = keys.has(key) || ErrorSchema(stack, nextContext, schemaPath, instancePath, schema.unevaluatedProperties, prop) && context.AddKey(key);
3730
- if (!isEvaluatedProperty) unevaluatedProperties.push(key);
3731
- return isEvaluatedProperty;
3732
- }) || context.AddError({
3733
- keyword: "unevaluatedProperties",
3734
- schemaPath,
3735
- instancePath,
3736
- params: { unevaluatedProperties }
3737
- });
3738
- }
3739
- //#endregion
3740
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/uniqueItems.mjs
3741
- function IsValid(schema) {
3742
- return !IsEqual(schema.uniqueItems, false);
3743
- }
3744
- function CheckUniqueItems(_stack, _context, schema, value) {
3745
- if (!IsValid(schema)) return true;
3746
- const set = new Set(value.map(Hash)).size;
3747
- const isLength = value.length;
3748
- return IsEqual(set, isLength);
3749
- }
3750
- function ErrorUniqueItems(_stack, context, schemaPath, instancePath, schema, value) {
3751
- if (!IsValid(schema)) return true;
3752
- const set = /* @__PURE__ */ new Set();
3753
- const duplicateItems = value.reduce((result, value, index) => {
3754
- const hash = Hash(value);
3755
- if (set.has(hash)) return [...result, index];
3756
- set.add(hash);
3757
- return result;
3758
- }, []);
3759
- return IsEqual(duplicateItems.length, 0) || context.AddError({
3760
- keyword: "uniqueItems",
3761
- schemaPath,
3762
- instancePath,
3763
- params: { duplicateItems }
3764
- });
3765
- }
3766
- //#endregion
3767
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/schema.mjs
3768
- function CheckSchemaPushStack(stack, context, schema, value) {
3769
- return context.Push() && CheckSchema(stack, context, schema, value) && context.Pop();
3770
- }
3771
- function CheckSchema(stack, context, schema, value) {
3772
- stack.Push(schema);
3773
- const result = IsBooleanSchema(schema) ? CheckBooleanSchema(stack, context, schema, value) : (!IsType(schema) || CheckType(stack, context, schema, value)) && (!(IsObject(value) && !IsArray(value)) || (!IsRequired(schema) || CheckRequired(stack, context, schema, value)) && (!IsAdditionalProperties(schema) || CheckAdditionalProperties(stack, context, schema, value)) && (!IsDependencies(schema) || CheckDependencies(stack, context, schema, value)) && (!IsDependentRequired(schema) || CheckDependentRequired(stack, context, schema, value)) && (!IsDependentSchemas(schema) || CheckDependentSchemas(stack, context, schema, value)) && (!IsPatternProperties(schema) || CheckPatternProperties(stack, context, schema, value)) && (!IsProperties(schema) || CheckProperties(stack, context, schema, value)) && (!IsPropertyNames(schema) || CheckPropertyNames(stack, context, schema, value)) && (!IsMinProperties(schema) || CheckMinProperties(stack, context, schema, value)) && (!IsMaxProperties(schema) || CheckMaxProperties(stack, context, schema, value))) && (!IsArray(value) || (!IsAdditionalItems(schema) || CheckAdditionalItems(stack, context, schema, value)) && (!IsContains(schema) || CheckContains(stack, context, schema, value)) && (!IsItems(schema) || CheckItems(stack, context, schema, value)) && (!IsMaxContains(schema) || CheckMaxContains(stack, context, schema, value)) && (!IsMaxItems(schema) || CheckMaxItems(stack, context, schema, value)) && (!IsMinContains(schema) || CheckMinContains(stack, context, schema, value)) && (!IsMinItems(schema) || CheckMinItems(stack, context, schema, value)) && (!IsPrefixItems(schema) || CheckPrefixItems(stack, context, schema, value)) && (!IsUniqueItems(schema) || CheckUniqueItems(stack, context, schema, value))) && (!IsString$1(value) || (!IsMaxLength(schema) || CheckMaxLength(stack, context, schema, value)) && (!IsMinLength(schema) || CheckMinLength(stack, context, schema, value)) && (!IsFormat(schema) || CheckFormat(stack, context, schema, value)) && (!IsPattern(schema) || CheckPattern(stack, context, schema, value))) && (!(IsNumber$1(value) || IsBigInt(value)) || (!IsExclusiveMaximum(schema) || CheckExclusiveMaximum(stack, context, schema, value)) && (!IsExclusiveMinimum(schema) || CheckExclusiveMinimum(stack, context, schema, value)) && (!IsMaximum(schema) || CheckMaximum(stack, context, schema, value)) && (!IsMinimum(schema) || CheckMinimum(stack, context, schema, value)) && (!IsMultipleOf(schema) || CheckMultipleOf(stack, context, schema, value))) && (!IsRef(schema) || CheckRef(stack, context, schema, value)) && (!IsRecursiveRef(schema) || CheckRecursiveRef(stack, context, schema, value)) && (!IsDynamicRef(schema) || CheckDynamicRef(stack, context, schema, value)) && (!IsGuard(schema) || CheckGuard(stack, context, schema, value)) && (!IsConst(schema) || CheckConst(stack, context, schema, value)) && (!IsEnum(schema) || CheckEnum(stack, context, schema, value)) && (!IsIf(schema) || CheckIf(stack, context, schema, value)) && (!IsNot(schema) || CheckNot(stack, context, schema, value)) && (!IsAllOf(schema) || CheckAllOf(stack, context, schema, value)) && (!IsAnyOf(schema) || CheckAnyOf(stack, context, schema, value)) && (!IsOneOf(schema) || CheckOneOf(stack, context, schema, value)) && (!IsUnevaluatedItems(schema) || !IsArray(value) || CheckUnevaluatedItems(stack, context, schema, value)) && (!IsUnevaluatedProperties(schema) || !IsObject(value) || CheckUnevaluatedProperties(stack, context, schema, value)) && (!IsRefine(schema) || CheckRefine(stack, context, schema, value));
3774
- stack.Pop(schema);
3775
- return result;
3776
- }
3777
- function ErrorSchemaPushStack(stack, context, schemaPath, instancePath, schema, value) {
3778
- return context.Push() && ErrorSchema(stack, context, schemaPath, instancePath, schema, value) && context.Pop();
3779
- }
3780
- function ErrorSchema(stack, context, schemaPath, instancePath, schema, value) {
3781
- stack.Push(schema);
3782
- const result = IsBooleanSchema(schema) ? ErrorBooleanSchema(stack, context, schemaPath, instancePath, schema, value) : !!(+(!IsType(schema) || ErrorType(stack, context, schemaPath, instancePath, schema, value)) & +(!(IsObject(value) && !IsArray(value)) || !!(+(!IsRequired(schema) || ErrorRequired(stack, context, schemaPath, instancePath, schema, value)) & +(!IsAdditionalProperties(schema) || ErrorAdditionalProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDependencies(schema) || ErrorDependencies(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDependentRequired(schema) || ErrorDependentRequired(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDependentSchemas(schema) || ErrorDependentSchemas(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPatternProperties(schema) || ErrorPatternProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsProperties(schema) || ErrorProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPropertyNames(schema) || ErrorPropertyNames(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinProperties(schema) || ErrorMinProperties(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaxProperties(schema) || ErrorMaxProperties(stack, context, schemaPath, instancePath, schema, value)))) & +(!IsArray(value) || !!(+(!IsAdditionalItems(schema) || ErrorAdditionalItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsContains(schema) || ErrorContains(stack, context, schemaPath, instancePath, schema, value)) & +(!IsItems(schema) || ErrorItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaxContains(schema) || ErrorMaxContains(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaxItems(schema) || ErrorMaxItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinContains(schema) || ErrorMinContains(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinItems(schema) || ErrorMinItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPrefixItems(schema) || ErrorPrefixItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsUniqueItems(schema) || ErrorUniqueItems(stack, context, schemaPath, instancePath, schema, value)))) & +(!IsString$1(value) || !!(+(!IsMaxLength(schema) || ErrorMaxLength(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinLength(schema) || ErrorMinLength(stack, context, schemaPath, instancePath, schema, value)) & +(!IsFormat(schema) || ErrorFormat(stack, context, schemaPath, instancePath, schema, value)) & +(!IsPattern(schema) || ErrorPattern(stack, context, schemaPath, instancePath, schema, value)))) & +(!(IsNumber$1(value) || IsBigInt(value)) || !!(+(!IsExclusiveMaximum(schema) || ErrorExclusiveMaximum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsExclusiveMinimum(schema) || ErrorExclusiveMinimum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMaximum(schema) || ErrorMaximum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMinimum(schema) || ErrorMinimum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsMultipleOf(schema) || ErrorMultipleOf(stack, context, schemaPath, instancePath, schema, value)))) & +(!IsRef(schema) || ErrorRef(stack, context, schemaPath, instancePath, schema, value)) & +(!IsRecursiveRef(schema) || ErrorRecursiveRef(stack, context, schemaPath, instancePath, schema, value)) & +(!IsDynamicRef(schema) || ErrorDynamicRef(stack, context, schemaPath, instancePath, schema, value)) & +(!IsGuard(schema) || ErrorGuard(stack, context, schemaPath, instancePath, schema, value)) & +(!IsConst(schema) || ErrorConst(stack, context, schemaPath, instancePath, schema, value)) & +(!IsEnum(schema) || ErrorEnum(stack, context, schemaPath, instancePath, schema, value)) & +(!IsIf(schema) || ErrorIf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsNot(schema) || ErrorNot(stack, context, schemaPath, instancePath, schema, value)) & +(!IsAllOf(schema) || ErrorAllOf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsAnyOf(schema) || ErrorAnyOf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsOneOf(schema) || ErrorOneOf(stack, context, schemaPath, instancePath, schema, value)) & +(!IsUnevaluatedItems(schema) || !IsArray(value) || ErrorUnevaluatedItems(stack, context, schemaPath, instancePath, schema, value)) & +(!IsUnevaluatedProperties(schema) || !IsObject(value) || ErrorUnevaluatedProperties(stack, context, schemaPath, instancePath, schema, value))) && (!IsRefine(schema) || ErrorRefine(stack, context, schemaPath, instancePath, schema, value));
3783
- stack.Pop(schema);
3784
- return result;
3785
- }
3786
- //#endregion
3787
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/pointer/pointer.mjs
3788
- function GetIndex(index, value) {
3789
- return IsObject(value) && !IsUnsafePropertyKey(index) ? value[index] : void 0;
3790
- }
3791
- function GetIndices(indices, value) {
3792
- return indices.reduce((value, index) => GetIndex(index, value), value);
3793
- }
3794
- /** Returns an array of path indices for the given pointer */
3795
- function Indices(pointer) {
3796
- if (IsEqual(pointer.length, 0)) return [];
3797
- const indices = pointer.split("/").map((index) => index.replace(/~1/g, "/").replace(/~0/g, "~"));
3798
- return indices.length > 0 && indices[0] === "" ? indices.slice(1) : indices;
3799
- }
3800
- /** Gets a value at the pointer, or undefined if not exists */
3801
- function Get$1(value, pointer) {
3802
- return GetIndices(Indices(pointer), value);
3803
- }
3804
- //#endregion
3805
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/resolve/ref.mjs
3806
- function MatchId(schema, base, ref) {
3807
- if (schema.$id === ref.hash) return schema;
3808
- const absoluteId = new URL(schema.$id, base.href);
3809
- const absoluteRef = new URL(ref.href, base.href);
3810
- if (IsEqual(absoluteId.pathname, absoluteRef.pathname)) return ref.hash.startsWith("#") ? MatchHash(schema, base, ref) : schema;
3811
- }
3812
- function MatchAnchor(schema, base, ref) {
3813
- const absoluteAnchor = new URL(`#${schema.$anchor}`, base.href);
3814
- const absoluteRef = new URL(ref.href, base.href);
3815
- return IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : void 0;
3816
- }
3817
- function MatchDynamicAnchor(schema, base, ref) {
3818
- const absoluteAnchor = new URL(`#${schema.$dynamicAnchor}`, base.href);
3819
- const absoluteRef = new URL(ref.href, base.href);
3820
- return IsEqual(absoluteAnchor.href, absoluteRef.href) ? schema : void 0;
3821
- }
3822
- function MatchHash(schema, _base, ref) {
3823
- if (ref.href.endsWith("#")) return schema;
3824
- if (!ref.hash.startsWith("#")) return void 0;
3825
- const fragment = decodeURIComponent(ref.hash.slice(1));
3826
- if (!fragment.startsWith("/")) return void 0;
3827
- return Get$1(schema, fragment);
3828
- }
3829
- function Match$1(schema, base, ref) {
3830
- if (IsId(schema)) {
3831
- const result = MatchId(schema, base, ref);
3832
- if (!IsUndefined(result)) return result;
3833
- }
3834
- if (IsAnchor(schema)) {
3835
- const result = MatchAnchor(schema, base, ref);
3836
- if (!IsUndefined(result)) return result;
3837
- }
3838
- if (IsDynamicAnchor(schema)) {
3839
- const result = MatchDynamicAnchor(schema, base, ref);
3840
- if (!IsUndefined(result)) return result;
3841
- }
3842
- return MatchHash(schema, base, ref);
3843
- }
3844
- function FromArray(schema, base, ref) {
3845
- return schema.reduce((result, item) => {
3846
- const match = FromValue(item, base, ref);
3847
- return !IsUndefined(match) ? match : result;
3848
- }, void 0);
3849
- }
3850
- function FromObject(schema, base, ref) {
3851
- return Keys(schema).reduce((result, key) => {
3852
- const match = FromValue(schema[key], base, ref);
3853
- return !IsUndefined(match) ? match : result;
3854
- }, void 0);
3855
- }
3856
- function FromValue(schema, base, ref) {
3857
- const nextBase = IsSchemaObject(schema) && IsId(schema) ? new URL(schema.$id, base.href) : base;
3858
- if (IsSchemaObject(schema)) {
3859
- const result = Match$1(schema, nextBase, ref);
3860
- if (!IsUndefined(result)) return result;
3861
- }
3862
- if (IsArray(schema)) return FromArray(schema, nextBase, ref);
3863
- if (IsObject(schema)) return FromObject(schema, nextBase, ref);
3864
- }
3865
- function Ref(schema, ref) {
3866
- const defaultBase = new URL("http://unknown/");
3867
- const initialBase = IsId(schema) ? new URL(schema.$id, defaultBase.href) : defaultBase;
3868
- return FromValue(schema, initialBase, new URL(ref, initialBase.href));
3869
- }
3870
- function DynamicRef(root, base, dynamicRef, dynamicAnchors) {
3871
- const fragmentTarget = dynamicRef.$dynamicRef.startsWith("#") ? Ref(base, dynamicRef.$dynamicRef) : Ref(root, dynamicRef.$dynamicRef);
3872
- if (IsUndefined(fragmentTarget)) return void 0;
3873
- if (!IsSchemaObject(fragmentTarget) || !IsDynamicAnchor(fragmentTarget)) return fragmentTarget;
3874
- if (new URL(dynamicRef.$dynamicRef, "http://unknown/").hash.startsWith("#/")) return fragmentTarget;
3875
- return dynamicAnchors.find((anchor) => anchor.$dynamicAnchor === fragmentTarget.$dynamicAnchor) ?? fragmentTarget;
3876
- }
3877
- //#endregion
3878
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/engine/_stack.mjs
3879
- var __classPrivateFieldGet = function(receiver, state, kind, f) {
3880
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3881
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
3882
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
3883
- };
3884
- var _Stack_instances, _Stack_PushResourceAnchors, _Stack_PopResourceAnchors, _Stack_FromContext, _Stack_FromRef;
3885
- var Stack = class {
3886
- constructor(context, schema) {
3887
- _Stack_instances.add(this);
3888
- this.context = context;
3889
- this.schema = schema;
3890
- this.ids = [];
3891
- this.anchors = [];
3892
- this.recursiveAnchors = [];
3893
- this.dynamicAnchors = [];
3894
- }
3895
- BaseURL() {
3896
- return this.ids.reduce((result, schema) => new URL(schema.$id, result), new URL("http://unknown"));
3897
- }
3898
- Base() {
3899
- return this.ids[this.ids.length - 1] ?? this.schema;
3900
- }
3901
- Push(schema) {
3902
- if (!IsSchemaObject(schema)) return;
3903
- if (IsId(schema)) {
3904
- this.ids.push(schema);
3905
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PushResourceAnchors).call(this, schema);
3906
- }
3907
- if (IsAnchor(schema)) this.anchors.push(schema);
3908
- if (IsRecursiveAnchorTrue(schema)) this.recursiveAnchors.push(schema);
3909
- if (IsDynamicAnchor(schema)) this.dynamicAnchors.push(schema);
3910
- }
3911
- Pop(schema) {
3912
- if (!IsSchemaObject(schema)) return;
3913
- if (IsId(schema)) {
3914
- this.ids.pop();
3915
- __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PopResourceAnchors).call(this, schema);
3916
- }
3917
- if (IsAnchor(schema)) this.anchors.pop();
3918
- if (IsRecursiveAnchorTrue(schema)) this.recursiveAnchors.pop();
3919
- if (IsDynamicAnchor(schema)) this.dynamicAnchors.pop();
3920
- }
3921
- Ref(ref) {
3922
- return __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_FromContext).call(this, ref) ?? __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_FromRef).call(this, ref);
3923
- }
3924
- RecursiveRef(recursiveRef) {
3925
- return IsRecursiveAnchorTrue(this.Base()) ? Ref(this.recursiveAnchors[0], recursiveRef.$recursiveRef) : Ref(this.Base(), recursiveRef.$recursiveRef);
3926
- }
3927
- DynamicRef(dynamicRef) {
3928
- const root = this.schema;
3929
- return DynamicRef(root, this.Base(), dynamicRef, this.dynamicAnchors);
3930
- }
3931
- };
3932
- _Stack_instances = /* @__PURE__ */ new WeakSet(), _Stack_PushResourceAnchors = function _Stack_PushResourceAnchors(schema, isRoot = true) {
3933
- if (!IsSchemaObject(schema)) return;
3934
- const current = schema;
3935
- if (!isRoot && IsId(current)) return;
3936
- if (!isRoot && IsDynamicAnchor(current)) this.dynamicAnchors.push(current);
3937
- for (const key of Keys(current)) __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PushResourceAnchors).call(this, current[key], false);
3938
- }, _Stack_PopResourceAnchors = function _Stack_PopResourceAnchors(schema, isRoot = true) {
3939
- if (!IsSchemaObject(schema)) return;
3940
- const current = schema;
3941
- if (!isRoot && IsId(current)) return;
3942
- if (!isRoot && IsDynamicAnchor(current)) this.dynamicAnchors.pop();
3943
- for (const key of Keys(current)) __classPrivateFieldGet(this, _Stack_instances, "m", _Stack_PopResourceAnchors).call(this, current[key], false);
3944
- }, _Stack_FromContext = function _Stack_FromContext(ref) {
3945
- return HasPropertyKey(this.context, ref.$ref) ? this.context[ref.$ref] : void 0;
3946
- }, _Stack_FromRef = function _Stack_FromRef(ref) {
3947
- const root = this.schema;
3948
- return !ref.$ref.startsWith("#") ? Ref(root, ref.$ref) : Ref(this.Base(), ref.$ref);
3949
- };
3950
- //#endregion
3951
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/system/arguments/arguments.mjs
3952
- /**
3953
- * Match arguments for overloaded functions that use the `...args: unknown[]` pattern. Arguments
3954
- * are parsed using argument length only.
3955
- */
3956
- function Match(args, match) {
3957
- return match[args.length]?.(...args) ?? (() => {
3958
- throw Error("Invalid Arguments");
3959
- })();
3960
- }
3961
- //#endregion
3962
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/system/locale/en_US.mjs
3963
- /** en_US: English (United States) - ISO 639-1 language code 'en' with ISO 3166-1 alpha-2 country code 'US' for United States. */
3964
- function en_US(error) {
3965
- switch (error.keyword) {
3966
- case "additionalProperties": return "must not have additional properties";
3967
- case "anyOf": return "must match a schema in anyOf";
3968
- case "boolean": return "schema is false";
3969
- case "const": return "must be equal to constant";
3970
- case "contains": return "must contain at least 1 valid item";
3971
- case "dependencies": return `must have properties ${error.params.dependencies.join(", ")} when property ${error.params.property} is present`;
3972
- case "dependentRequired": return `must have properties ${error.params.dependencies.join(", ")} when property ${error.params.property} is present`;
3973
- case "enum": return "must be equal to one of the allowed values";
3974
- case "exclusiveMaximum": return `must be ${error.params.comparison} ${error.params.limit}`;
3975
- case "exclusiveMinimum": return `must be ${error.params.comparison} ${error.params.limit}`;
3976
- case "format": return `must match format "${error.params.format}"`;
3977
- case "if": return `must match "${error.params.failingKeyword}" schema`;
3978
- case "maxItems": return `must not have more than ${error.params.limit} items`;
3979
- case "maxLength": return `must not have more than ${error.params.limit} characters`;
3980
- case "maxProperties": return `must not have more than ${error.params.limit} properties`;
3981
- case "maximum": return `must be ${error.params.comparison} ${error.params.limit}`;
3982
- case "minItems": return `must not have fewer than ${error.params.limit} items`;
3983
- case "minLength": return `must not have fewer than ${error.params.limit} characters`;
3984
- case "minProperties": return `must not have fewer than ${error.params.limit} properties`;
3985
- case "minimum": return `must be ${error.params.comparison} ${error.params.limit}`;
3986
- case "multipleOf": return `must be multiple of ${error.params.multipleOf}`;
3987
- case "not": return "must not be valid";
3988
- case "oneOf": return "must match exactly one schema in oneOf";
3989
- case "pattern": return `must match pattern "${error.params.pattern}"`;
3990
- case "propertyNames": return `property names ${error.params.propertyNames.join(", ")} are invalid`;
3991
- case "required": return `must have required properties ${error.params.requiredProperties.join(", ")}`;
3992
- case "type": return typeof error.params.type === "string" ? `must be ${error.params.type}` : `must be either ${error.params.type.join(" or ")}`;
3993
- case "unevaluatedItems": return "must not have unevaluated items";
3994
- case "unevaluatedProperties": return "must not have unevaluated properties";
3995
- case "uniqueItems": return `must not have duplicate items`;
3996
- case "~guard": return `must match check function`;
3997
- case "~refine": return error.params.message;
3998
- default: return "an unknown validation error occurred";
3999
- }
4000
- }
4001
- //#endregion
4002
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/system/locale/_config.mjs
4003
- let locale = en_US;
4004
- /** Gets the locale */
4005
- function Get() {
4006
- return locale;
4007
- }
4008
- //#endregion
4009
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/errors.mjs
4010
- /** Checks a value and returns validation errors */
4011
- function Errors(...args) {
4012
- const [context, schema, value] = Match(args, {
4013
- 3: (context, schema, value) => [
4014
- context,
4015
- schema,
4016
- value
4017
- ],
4018
- 2: (schema, value) => [
4019
- {},
4020
- schema,
4021
- value
4022
- ]
4023
- });
4024
- const settings = Get$2();
4025
- const locale = Get();
4026
- const errors = [];
4027
- return [ErrorSchema(new Stack(context, schema), new ErrorContext((error) => {
4028
- if (IsGreaterEqualThan(errors.length, settings.maxErrors)) return;
4029
- return errors.push({
4030
- ...error,
4031
- message: locale(error)
4032
- });
4033
- }), "#", "", schema, value), errors];
4034
- }
4035
- //#endregion
4036
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/check.mjs
4037
- /** Checks a value against the provided schema */
4038
- function Check(...args) {
4039
- const [context, schema, value] = Match(args, {
4040
- 3: (context, schema, value) => [
4041
- context,
4042
- schema,
4043
- value
4044
- ],
4045
- 2: (schema, value) => [
4046
- {},
4047
- schema,
4048
- value
4049
- ]
4050
- });
4051
- return CheckSchema(new Stack(context, schema), new CheckContext(), schema, value);
4052
- }
4053
- //#endregion
4054
- //#region node_modules/.pnpm/typebox@1.1.38/node_modules/typebox/build/schema/parse.mjs
4055
- var ParseError = class {
4056
- constructor(schema, value, errors) {
4057
- this.schema = schema;
4058
- this.value = value;
4059
- this.errors = errors;
4060
- }
4061
- };
4062
- /** Parses a value against the provided schema */
4063
- function Parse(...args) {
4064
- const [context, schema, value] = Match(args, {
4065
- 3: (context, schema, value) => [
4066
- context,
4067
- schema,
4068
- value
4069
- ],
4070
- 2: (schema, value) => [
4071
- {},
4072
- schema,
4073
- value
4074
- ]
4075
- });
4076
- if (!Check(context, schema, value)) {
4077
- const [_result, errors] = Errors(context, schema, value);
4078
- throw new ParseError(schema, value, errors);
4079
- }
4080
- return value;
4081
- }
4082
- const configDefaults = {
4083
- enabled: true,
4084
- quiet: false,
4085
- toolName: "set_thinking_level",
4086
- toolDescription: "Set your thinking level",
4087
- systemPrompt: "You MUST manage thinking level actively. Lower it before trivial or routine turns; raise it for ambiguity, debugging, risky changes, or multi-step synthesis. Reassess at turn start, after meaningful new evidence, and when the task shifts. NEVER leave the current level unchanged by inertia, and NEVER reply to a trivial turn before considering a downshift."
4088
- };
4089
- const ConfigSchema = Type.Object({
4090
- enabled: Type.Boolean(),
4091
- quiet: Type.Boolean(),
4092
- toolName: Type.String({ minLength: 1 }),
4093
- toolDescription: Type.String({ minLength: 1 }),
4094
- systemPrompt: Type.String({ minLength: 1 })
4095
- }, { additionalProperties: false });
4096
- const parseConfig = (input) => {
4097
- return Parse(ConfigSchema, input === void 0 ? configDefaults : {
4098
- ...configDefaults,
4099
- ...input
4100
- });
4101
- };
4102
- //#endregion
4103
- //#region src/config-loader.ts
4104
- const hasCode = (error, code) => {
4105
- return typeof error === "object" && error !== null && "code" in error && error.code === code;
4106
- };
4107
- const errorMessage$1 = (error) => error instanceof Error ? error.message : String(error);
4108
- const invalidConfig = (source, error) => ({
4109
- success: false,
4110
- source,
4111
- error: /* @__PURE__ */ new Error(`Invalid Adaptive Thinking configuration in ${source}: ${errorMessage$1(error)}`)
4112
- });
4113
- const loadConfig = async ({ cwd, homeDir = homedir$1() }) => {
4114
- const candidates = [join$1(cwd, ".pi", "adaptive-thinking.json"), join$1(homeDir, ".pi", "agent", "adaptive-thinking.json")];
4115
- for (const source of candidates) {
4116
- let raw;
4117
- try {
4118
- raw = await readFile(source, "utf8");
4119
- } catch (error) {
4120
- if (hasCode(error, "ENOENT")) continue;
4121
- return invalidConfig(source, error);
4122
- }
4123
- try {
4124
- return {
4125
- success: true,
4126
- source,
4127
- config: parseConfig(JSON.parse(raw))
4128
- };
4129
- } catch (error) {
4130
- return invalidConfig(source, error);
4131
- }
4132
- }
4133
- return {
4134
- success: true,
4135
- config: parseConfig(void 0)
4136
- };
4137
- };
4138
- //#endregion
4139
- //#region src/thinking-levels.ts
4140
- const fallbackThinkingLevels = [
4141
- "off",
4142
- "minimal",
4143
- "low",
4144
- "medium",
4145
- "high",
4146
- "xhigh"
4147
- ];
4148
- const levelSet = new Set(fallbackThinkingLevels);
4149
- const isThinkingLevel = (level) => levelSet.has(level);
4150
- const resolveSupportedThinkingLevels = (model) => {
4151
- if (!model) return [...fallbackThinkingLevels];
4152
- return getSupportedThinkingLevels(model).filter((level) => isThinkingLevel(level));
4153
- };
4154
- //#endregion
4155
- //#region src/index.ts
4156
- const ToolParameters = Type.Object({
4157
- level: Type.String({
4158
- minLength: 1,
4159
- description: "The Pi thinking level to apply. Higher levels may improve hard-task quality but may take more time and resources."
4160
- }),
4161
- persist: Type.Optional(Type.Boolean({
4162
- default: false,
4163
- description: "Whether to persist the setting for this session; otherwise it applies only for the current turn."
4164
- }))
4165
- }, { additionalProperties: false });
4166
- const textResult = (text) => ({
4167
- content: [{
4168
- type: "text",
4169
- text
4170
- }],
4171
- details: void 0
4172
- });
4173
- const errorMessage = (error) => error instanceof Error ? error.message : String(error);
4174
- const agentDir = () => process.env.PI_CODING_AGENT_DIR ?? join(homedir(), ".pi", "agent");
4175
- const globalSettingsPath = () => join(agentDir(), "settings.json");
4176
- const sleepSync = (milliseconds) => {
4177
- const end = Date.now() + milliseconds;
4178
- while (Date.now() < end);
4179
- };
4180
- const acquireSettingsLock = (lockPath) => {
4181
- const maxAttempts = 100;
4182
- const delayMs = 20;
4183
- for (let attempt = 1; attempt <= maxAttempts; attempt++) try {
4184
- return import_proper_lockfile.default.lockSync(lockPath, { realpath: false });
4185
- } catch (error) {
4186
- if ((typeof error === "object" && error !== null && "code" in error ? error.code : void 0) !== "ELOCKED" || attempt === maxAttempts) throw error;
4187
- sleepSync(delayMs);
4188
- }
4189
- throw new Error(`Failed to acquire settings lock: ${lockPath}`);
4190
- };
4191
- const withSettingsLock = (settingsPath, fn) => {
4192
- mkdirSync(join(settingsPath, ".."), { recursive: true });
4193
- const lockPath = `${settingsPath}.adaptive-thinking`;
4194
- if (!existsSync(lockPath)) writeFileSync(lockPath, "");
4195
- const release = acquireSettingsLock(lockPath);
4196
- try {
4197
- return fn();
4198
- } finally {
4199
- release();
4200
- }
4201
- };
4202
- const readDefaultThinkingLevel = (settingsPath) => {
4203
- if (!existsSync(settingsPath)) return void 0;
4204
- try {
4205
- const parsed = JSON.parse(readFileSync(settingsPath, "utf-8"));
4206
- return typeof parsed.defaultThinkingLevel === "string" && isThinkingLevel(parsed.defaultThinkingLevel) ? parsed.defaultThinkingLevel : void 0;
4207
- } catch {
4208
- return;
4209
- }
4210
- };
4211
- const restoreDefaultThinkingLevel = (settingsPath, previousDefaultThinkingLevel) => {
4212
- if (!existsSync(settingsPath)) return;
4213
- try {
4214
- const settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
4215
- if (previousDefaultThinkingLevel === void 0) delete settings.defaultThinkingLevel;
4216
- else settings.defaultThinkingLevel = previousDefaultThinkingLevel;
4217
- writeFileSync(settingsPath, JSON.stringify(settings, void 0, 2) + "\n");
4218
- } catch {
4219
- return;
4220
- }
4221
- };
4222
- const withSessionOnlyThinkingLevelChange = (changeThinkingLevel) => {
4223
- const settingsPath = globalSettingsPath();
4224
- return withSettingsLock(settingsPath, () => {
4225
- const previousDefaultThinkingLevel = readDefaultThinkingLevel(settingsPath);
4226
- changeThinkingLevel();
4227
- restoreDefaultThinkingLevel(settingsPath, previousDefaultThinkingLevel);
4228
- });
4229
- };
4230
- const notify = (ctx, type, message, config) => {
4231
- if (config?.quiet) return;
4232
- if (!ctx.hasUI) return;
4233
- ctx.ui.notify(message, type);
4234
- };
4235
- const appendSystemPromptBlock = (systemPrompt, block) => {
4236
- const trimmedBlock = block.trim();
4237
- if (!trimmedBlock) return systemPrompt;
4238
- if (!systemPrompt.trim()) return trimmedBlock;
4239
- return `${systemPrompt.trimEnd()}\n\n${trimmedBlock}`;
4240
- };
4241
- const formatGuidance = (config, currentLevel, validLevels) => {
4242
- return config.systemPrompt.trim() + " " + (currentLevel ? `Current thinking level: ${currentLevel}. ` : "") + `Valid thinking levels for this session: ${validLevels.join(", ")}. To change the thinking level, use the \`${config.toolName}\` tool with one of the valid levels. Only call it when the task complexity justifies changing levels. Do not call ${config.toolName} if the current thinking level already matches the target level. Do not call ${config.toolName} twice in a row; reassess only after new evidence from other tool calls or user input.`;
4243
- };
4244
- function adaptiveThinking(pi) {
4245
- let runtime;
4246
- let runtimeHandlersRegistered = false;
4247
- const registerRuntimeHandlers = () => {
4248
- if (runtimeHandlersRegistered) return;
4249
- runtimeHandlersRegistered = true;
4250
- pi.on("thinking_level_select", async (event) => {
4251
- if (!runtime) return;
4252
- runtime.currentLevel = event.level;
4253
- });
4254
- pi.on("tool_call", async (event) => {
4255
- const state = runtime;
4256
- if (!state) return;
4257
- if (event.toolName === state.config.toolName) {
4258
- state.reasoningToolCallBackToBackById.set(event.toolCallId, state.lastToolCallWasReasoningTool ?? false);
4259
- state.lastToolCallWasReasoningTool = true;
4260
- } else state.lastToolCallWasReasoningTool = false;
4261
- });
4262
- pi.on("before_agent_start", async (event, ctx) => beforeAgentStart(event, ctx));
4263
- pi.on("agent_end", async (_event, ctx) => {
4264
- await resetTemporaryLevel(ctx);
4265
- if (!runtime) return;
4266
- runtime.lastToolCallWasReasoningTool = false;
4267
- runtime.reasoningToolCallBackToBackById.clear();
4268
- });
4269
- };
4270
- const beforeAgentStart = async (event, ctx) => {
4271
- const state = runtime;
4272
- if (!state) return { systemPrompt: event.systemPrompt };
4273
- state.lastToolCallWasReasoningTool = false;
4274
- state.reasoningToolCallBackToBackById.clear();
4275
- const currentLevel = state.currentLevel ?? pi.getThinkingLevel();
4276
- if (isThinkingLevel(currentLevel)) state.currentLevel = currentLevel;
4277
- const validLevels = resolveSupportedThinkingLevels(ctx.model);
4278
- return { systemPrompt: appendSystemPromptBlock(event.systemPrompt, formatGuidance(state.config, state.currentLevel, validLevels)) };
4279
- };
4280
- const resetTemporaryLevel = async (ctx) => {
4281
- const state = runtime;
4282
- const resetLevel = state?.temporaryResetLevel;
4283
- if (!state || !resetLevel) return;
4284
- try {
4285
- withSessionOnlyThinkingLevelChange(() => pi.setThinkingLevel(resetLevel));
4286
- state.currentLevel = resetLevel;
4287
- delete state.temporaryResetLevel;
4288
- } catch (error) {
4289
- notify(ctx, "error", `Failed to reset thinking level: ${errorMessage(error)}`, state.config);
4290
- }
4291
- };
4292
- pi.on("session_start", async (_event, ctx) => {
4293
- const configResult = await loadConfig({ cwd: ctx.cwd });
4294
- if (!configResult.success) {
4295
- runtime = void 0;
4296
- notify(ctx, "error", configResult.error.message);
4297
- return;
4298
- }
4299
- const { config } = configResult;
4300
- if (!config.enabled) {
4301
- runtime = void 0;
4302
- return;
4303
- }
4304
- const initialLevel = pi.getThinkingLevel();
4305
- runtime = {
4306
- config,
4307
- reasoningToolCallBackToBackById: /* @__PURE__ */ new Map()
4308
- };
4309
- if (isThinkingLevel(initialLevel)) runtime.currentLevel = initialLevel;
4310
- pi.registerTool({
4311
- name: config.toolName,
4312
- label: "Set Thinking Level",
4313
- description: config.toolDescription,
4314
- promptSnippet: "Set the current Pi thinking level.",
4315
- promptGuidelines: [`Use ${config.toolName} to change the thinking level when task complexity justifies a different level.`],
4316
- parameters: ToolParameters,
4317
- execute: async (toolCallId, params, _signal, _onUpdate, ctx) => {
4318
- const state = runtime;
4319
- if (!state) return textResult("Adaptive Thinking is not enabled for this session.");
4320
- const level = params.level.trim();
4321
- const validLevels = resolveSupportedThinkingLevels(ctx.model);
4322
- if (!isThinkingLevel(level) || !validLevels.includes(level)) return textResult(`Invalid thinking level: ${level}. Valid levels: ${validLevels.join(", ")}.`);
4323
- const persist = params.persist ?? false;
4324
- const currentLevel = state.currentLevel ?? pi.getThinkingLevel();
4325
- if (currentLevel === level) return textResult(`Thinking level is already ${level}; no change made.`);
4326
- if (state.reasoningToolCallBackToBackById.get(toolCallId) ?? false) return textResult(`Thinking level change skipped because the previous tool call was also ${state.config.toolName}. Reassess after another tool call or new user input.`);
4327
- const resetLevel = state.persistedLevel ?? (isThinkingLevel(currentLevel) ? currentLevel : void 0);
4328
- try {
4329
- withSessionOnlyThinkingLevelChange(() => pi.setThinkingLevel(level));
4330
- } catch (error) {
4331
- return textResult(`Failed to set thinking level: ${errorMessage(error)}`);
4332
- }
4333
- state.currentLevel = level;
4334
- if (persist) {
4335
- state.persistedLevel = level;
4336
- delete state.temporaryResetLevel;
4337
- } else if (resetLevel && resetLevel !== level) state.temporaryResetLevel = resetLevel;
4338
- else delete state.temporaryResetLevel;
4339
- return textResult(`Thinking level set to ${level}`);
4340
- }
4341
- });
4342
- registerRuntimeHandlers();
4343
- });
4344
- }
4345
- //#endregion
4346
- export { adaptiveThinking as default };